Update inline MCP #81
Conversation
- Added functionality to locate code lines automatically based on `code_block`. - Introduced support for GitHub suggestion blocks with optional `code_suggestion`. - Refined parameter validation for `code_block` and `code_suggestion`. - Enhanced inline comment creation to dynamically determine line ranges. - Streamlined initialization by reusing Octokit instance across methods.
|
Junie successfully finished! Result: Review PR Diff and Update Documentation Accuracy Summary
Changes
Verification
Notes
|
|
junie-agent code-review |
|
Junie successfully finished! Pull Request Diff Code Style Review
|
| }; | ||
| } | ||
| // If code_suggestion is provided, validate it | ||
| if (params.code_suggestion !== undefined && !params.code_suggestion.trim()) { |
There was a problem hiding this comment.
| if (params.code_suggestion !== undefined && !params.code_suggestion.trim()) { | |
| // If code_suggestion is provided, validate it (allow empty string for deletion) | |
| if (params.code_suggestion !== undefined && params.code_suggestion.length > 0 && !params.code_suggestion.trim()) { |
Empty suggestion blocks are valid in GitHub for suggesting deletions. The current check prevents this.
| const numLines = searchLines.length; | ||
|
|
||
| // Try to find exact match | ||
| for (let i = 0; i <= fileLines.length - numLines; i++) { |
There was a problem hiding this comment.
The algorithm returns the first match found. In files with repeated code blocks (e.g., closing braces or common utility calls), this may result in comments appearing on the wrong line. Suggestion: encourage providing unique context in code_block.
| .describe("The file path to comment on (e.g., 'src/utils/helper.ts')"), | ||
| code_block: z | ||
| .string() | ||
| .describe("The exact code block to comment on (can be multiple lines). Must match existing code in the file exactly. This is used to find the line numbers."), |
There was a problem hiding this comment.
| .describe("The exact code block to comment on (can be multiple lines). Must match existing code in the file exactly. This is used to find the line numbers."), | |
| code_block: z | |
| .string() | |
| .describe("The exact code block to comment on. Must match existing code in the file exactly (including indentation). Provide enough context to make it unique within the file."), |
Adding a reminder about uniqueness and indentation helps avoid targeting the wrong lines or losing formatting.
| .string() | ||
| .optional() | ||
| .describe("Side of the diff to comment on: LEFT (old code) or RIGHT (new code). Defaults to RIGHT."), | ||
| .describe("Optional: The suggested replacement code (can be multiple lines). If provided, creates a GitHub suggestion block. If omitted, creates a regular comment without suggestion."), |
There was a problem hiding this comment.
| .describe("Optional: The suggested replacement code (can be multiple lines). If provided, creates a GitHub suggestion block. If omitted, creates a regular comment without suggestion."), | |
| code_suggestion: z | |
| .string() | |
| .optional() | |
| .describe("Optional: The suggested replacement code. IMPORTANT: GitHub suggestions replace the entire line range. You must provide full lines including current indentation."), |
Removing the warning about entire line replacement increases the risk of the AI producing broken suggestions (e.g., partial line replacements or lost indentation).
Pull Request Diff Code Style Review Co-authored-by: nikitaBarkov <144887964+nikitaBarkov@users.noreply.github.com>
- Adjust `code_suggestion` validation to simplify condition check. - Simplify multi-line detection logic for comments. - Update `code_block` and `code_suggestion` descriptions to clarify requirements and ensure proper usage.
No description provided.