-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hl/ask line #661
Hl/ask line #661
Conversation
PR Description updated to latest commit (8ed98c8)
|
PR Review
✨ Usage guide:Overview:
With a configuration file, use the following template:
See the review usage page for a comprehensive guide on using this tool. |
PR Code Suggestions
✨ Usage guide:Overview:
With a configuration file, use the following template:
See the improve usage page for a more comprehensive guide on using this tool. |
/ask does this PR contains proper documentation ? |
Question: does this PR contain proper documentation ? Answer: Moreover, the PR also includes comments in the code, especially in the However, it's always a good idea to ensure that the documentation is comprehensive and covers all the new features or changes introduced in the PR. It might be helpful to include examples or use-cases in the documentation to provide more context about the new features. ✨ Usage guide:Overview:
Note that the tool does not have "memory" of previous questions, and answers each question independently.
See the ask usage page for a comprehensive guide on using this tool. |
/improve --pr_code_suggestions.extra_instructions="focus on edge cases" |
PR Code Suggestions
✨ Usage guide:Overview:
With a configuration file, use the following template:
See the improve usage page for a more comprehensive guide on using this tool. |
/analyze |
PR Analysis
✨ Usage guide:Using static code analysis capabilities, the
Language that are currently supported: Python, Java, C++, JavaScript, TypeScript. |
Generated tests for 'extract_hunk_lines_from_patch'
Component signature: def extract_hunk_lines_from_patch(patch: str, file_name, line_start, line_end, side) -> tuple[str, str]:
✨ Usage guide:The
where 'component_name' is the name of a specific component in the PR. To get a list of the components that changed in the PR, use the Configuration options: See more information about the test tool in the docs. |
Generated docstring for 'extract_hunk_lines_from_patch'
Component signature: def extract_hunk_lines_from_patch(patch: str, file_name, line_start, line_end, side) -> tuple[str, str]: Docstring: """
Extracts the lines from a patch that correspond to a specific hunk.
Args:
patch (str): The patch string.
file_name: The name of the file in the patch.
line_start: The starting line number of the hunk.
line_end: The ending line number of the hunk.
side: The side of the hunk to extract ('left' or 'right').
Returns:
tuple[str, str]: A tuple containing the patch string with line numbers and the selected lines from the hunk.
Raises:
None
""" |
Generated code suggestions for 'extract_hunk_lines_from_patch'
Component signature: def extract_hunk_lines_from_patch(patch: str, file_name, line_start, line_end, side) -> tuple[str, str]:
|
/config |
Possible Configurations: pr_description.publish_labels = True pr_questions.enable_help_text = True pr_custom_suggestions.prompt = 'The suggestions should focus only on the following:\n- ...\n- ...\n...\n' pr_add_docs.extra_instructions = '' pr_update_changelog.push_changelog_changes = False pr_analyze.enable_help_text = True pr_test.extra_instructions = '' pr_improve_component.num_code_suggestions = 4 pr_similar_issue.skip_comments = False pr_reviewer.require_focused_review = False pr_code_suggestions.max_context_tokens = 8000 |
@@ -245,3 +245,59 @@ def convert_to_hunks_with_lines_numbers(patch: str, file) -> str: | |||
patch_with_lines_str += f"{line_old}\n" | |||
|
|||
return patch_with_lines_str.rstrip() | |||
|
|||
|
|||
def extract_hunk_lines_from_patch(patch: str, file_name, line_start, line_end, side) -> tuple[str, str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
תהיה בנאדם, תוסיף דוקסטרינג קצר. אח״כ רוצים להשתמש בזה שוב, וצריכים לנחש מה הפונקציה עושה
@@ -64,7 +64,25 @@ async def gitlab_webhook(background_tasks: BackgroundTasks, request: Request): | |||
mr = data['merge_request'] | |||
url = mr.get('url') | |||
body = data.get('object_attributes', {}).get('note') | |||
if data.get('object_attributes', {}).get('type') == 'DiffNote' and '/ask' in body: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to a dedicated function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes walkthrough
Relevant files | |||||||
---|---|---|---|---|---|---|---|
Enhancement | |||||||
Configuration changes | |||||||
Documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relevant files | ||||||
---|---|---|---|---|---|---|
Enhancement
| ||||||
Configuration changes
| ||||||
Documentation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enhancement
| ||||||
Configuration changes
| ||||||
Documentation
|
🔍 Finding similar code for 'reply_to_comment_from_comment_id'
|
🔍 Finding similar code for 'reply_to_comment_from_comment_id'
|
🔍 Finding similar code for 'reply_to_comment_from_comment_id'
|
4 similar comments
🔍 Finding similar code for 'extract_hunk_lines_from_patch'
|
🔍 Finding similar code for 'extract_hunk_lines_from_patch'
|
🔍 Finding similar code for 'extract_hunk_lines_from_patch'
|
Type
enhancement, documentation
Description
PR_LineQuestions
for handling line-specific queries in PRs.extract_hunk_lines_from_patch
to extract lines from patches for focused questions./ask
command usage for specific lines in PRs.Changes walkthrough
6 files
pr_agent.py
Integrate Line-Specific Question Handling in PR Agent
pr_agent/agent/pr_agent.py
PR_LineQuestions
for handling line-specific questions.ask_line
to the command mapping, allowing for line-specificqueries.
git_patch_processing.py
Add Function to Extract Specific Lines from Patches
pr_agent/algo/git_patch_processing.py
extract_hunk_lines_from_patch
to extract specific lines froma patch.
git_provider.py
Define Method for Replying to Comments by ID in Git Provider Interface
pr_agent/git_providers/git_provider.py
reply_to_comment_from_comment_id
method stub.github_provider.py
Implement Comment Reply and Reaction Features for GitHub Provider
pr_agent/git_providers/github_provider.py
reply_to_comment_from_comment_id
for GitHub.github_app.py
Add Handling for Line Comments in GitHub App
pr_agent/servers/github_app.py
pr_line_questions.py
Implement Line-Specific Question Handling
pr_agent/tools/pr_line_questions.py
PR_LineQuestions
class for answering line-specificquestions.
2 files
config_loader.py
Update Configuration Loader to Include Line Questions Prompts
pr_agent/config_loader.py
pr_line_questions_prompts.toml
in the configuration loader.pr_line_questions_prompts.toml
Add Prompts Configuration for Line-Specific Questions
pr_agent/settings/pr_line_questions_prompts.toml
1 files
ASK.md
Document Line-Specific Questions Feature
docs/ASK.md
/ask
command on specific lines of code.✨ Usage guide:
Overview:
The
describe
tool scans the PR code changes, and generates a description for the PR - title, type, summary, walkthrough and labels. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.When commenting, to edit configurations related to the describe tool (
pr_description
section), use the following template:With a configuration file, use the following template:
Enabling\disabling automation
meaning the
describe
tool will run automatically on every PR, will keep the original title, and will add the original user description above the generated description.the tool will replace every marker of the form
pr_agent:marker_name
in the PR description with the relevant content, wheremarker_name
is one of the following:type
: the PR type.summary
: the PR summary.walkthrough
: the PR walkthrough.Note that when markers are enabled, if the original PR description does not contain any markers, the tool will not alter the description at all.
Custom labels
The default labels of the
describe
tool are quite generic: [Bug fix
,Tests
,Enhancement
,Documentation
,Other
].If you specify custom labels in the repo's labels page or via configuration file, you can get tailored labels for your use cases.
Examples for custom labels:
Main topic:performance
- pr_agent:The main topic of this PR is performanceNew endpoint
- pr_agent:A new endpoint was added in this PRSQL query
- pr_agent:A new SQL query was added in this PRDockerfile changes
- pr_agent:The PR contains changes in the DockerfileThe list above is eclectic, and aims to give an idea of different possibilities. Define custom labels that are relevant for your repo and use cases.
Note that Labels are not mutually exclusive, so you can add multiple label categories.
Make sure to provide proper title, and a detailed and well-phrased description for each label, so the tool will know when to suggest it.
Inline File Walkthrough 💎
For enhanced user experience, the
describe
tool can add file summaries directly to the "Files changed" tab in the PR page.This will enable you to quickly understand the changes in each file, while reviewing the code changes (diffs).
To enable inline file summary, set
pr_description.inline_file_summary
in the configuration file, possible values are:'table'
: File changes walkthrough table will be displayed on the top of the "Files changed" tab, in addition to the "Conversation" tab.true
: A collapsable file comment with changes title and a changes summary for each file in the PR.false
(default): File changes walkthrough will be added only to the "Conversation" tab.Utilizing extra instructions
The
describe
tool can be configured with extra instructions, to guide the model to a feedback tailored to the needs of your project.Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Notice that the general structure of the description is fixed, and cannot be changed. Extra instructions can change the content or style of each sub-section of the PR description.
Examples for extra instructions:
Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.
More PR-Agent commands
See the describe usage page for a comprehensive guide on using this tool.