private formatReview()

in src/github/junie/new-prompt-formatter.ts [252:288]


    private formatReview(review: GraphQLReviewNode): string {
        const author = review.author?.login;
        const state = review.state;
        const submittedAt = review.submittedAt;
        const body = review.body;

        let reviewText = `[${submittedAt}] Review by @${author} (${state})`;

        if (body) {
            reviewText += `\n${body}`;
        }

        if (review.comments.nodes.length > 0) {
            reviewText += '\n\nReview Comments:';

            const sortedComments = [...review.comments.nodes].sort(
                (a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()
            );

            for (const comment of sortedComments) {
                const commentAuthor = comment.author?.login;
                const commentBody = comment.body;
                const path = comment.path;
                const diffHunk = comment.diffHunk;

                reviewText += `\n\n  ${path}:`;

                if (diffHunk) {
                    reviewText += `\n  \`\`\`diff\n${diffHunk}\n  \`\`\``;
                }

                reviewText += `\n  @${commentAuthor}: ${commentBody}`;
            }
        }

        return reviewText;
    }