Skip to content

Commit

Permalink
Merge pull request #168 from Codium-ai/tr/further_use_commit_messages
Browse files Browse the repository at this point in the history
Use commit messages in PR tools
  • Loading branch information
mrT23 authored Aug 3, 2023
2 parents b97c4b6 + eb143ec commit cfa1417
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 2023-08-02

### Enhanced
- Updated several tools in the `pr_agent` package to use commit messages in their functionality.
- Commit messages are now retrieved and stored in the `vars` dictionary for each tool.
- Added a section to display the commit messages in the prompts of various tools.

## 2023-08-01

### Enhanced
Expand Down
5 changes: 5 additions & 0 deletions pr_agent/settings/pr_code_suggestions_prompts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ Description: '{{description}}'
{%- if language %}
Main language: {{language}}
{%- endif %}
{%- if commit_messages_str %}
Commit messages:
{{commit_messages_str}}
{%- endif %}
The PR Diff:
Expand Down
5 changes: 5 additions & 0 deletions pr_agent/settings/pr_information_from_user_prompts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ Description: '{{description}}'
{%- if language %}
Main language: {{language}}
{%- endif %}
{%- if commit_messages_str %}
Commit messages:
{{commit_messages_str}}
{%- endif %}
The PR Git Diff:
Expand Down
5 changes: 5 additions & 0 deletions pr_agent/settings/pr_questions_prompts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ Description: '{{description}}'
{%- if language %}
Main language: {{language}}
{%- endif %}
{%- if commit_messages_str %}
Commit messages:
{{commit_messages_str}}
{%- endif %}
The PR Git Diff:
Expand Down
5 changes: 5 additions & 0 deletions pr_agent/settings/pr_reviewer_prompts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ Description: '{{description}}'
{%- if language %}
Main language: {{language}}
{%- endif %}
{%- if commit_messages_str %}
Commit messages:
{{commit_messages_str}}
{%- endif %}
{%- if question_str %}
######
Expand Down
5 changes: 5 additions & 0 deletions pr_agent/settings/pr_update_changelog_prompts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ Description: '{{description}}'
{%- if language %}
Main language: {{language}}
{%- endif %}
{%- if commit_messages_str %}
Commit messages:
{{commit_messages_str}}
{%- endif %}
The PR Diff:
Expand Down
1 change: 1 addition & 0 deletions pr_agent/tools/pr_code_suggestions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(self, pr_url: str, cli_mode=False, args: list = None):
"diff": "", # empty diff for initial calculation
"num_code_suggestions": get_settings().pr_code_suggestions.num_code_suggestions,
"extra_instructions": get_settings().pr_code_suggestions.extra_instructions,
"commit_messages_str": self.git_provider.get_commit_messages(),
}
self.token_handler = TokenHandler(self.git_provider.pr,
self.vars,
Expand Down
3 changes: 1 addition & 2 deletions pr_agent/tools/pr_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def __init__(self, pr_url: str, args: list = None):
self.main_pr_language = get_main_pr_language(
self.git_provider.get_languages(), self.git_provider.get_files()
)
commit_messages_str = self.git_provider.get_commit_messages()

# Initialize the AI handler
self.ai_handler = AiHandler()
Expand All @@ -40,7 +39,7 @@ def __init__(self, pr_url: str, args: list = None):
"language": self.main_pr_language,
"diff": "", # empty diff for initial calculation
"extra_instructions": get_settings().pr_description.extra_instructions,
"commit_messages_str": commit_messages_str
"commit_messages_str": self.git_provider.get_commit_messages()
}

# Initialize the token handler
Expand Down
1 change: 1 addition & 0 deletions pr_agent/tools/pr_information_from_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, pr_url: str, args: list = None):
"description": self.git_provider.get_pr_description(),
"language": self.main_pr_language,
"diff": "", # empty diff for initial calculation
"commit_messages_str": self.git_provider.get_commit_messages(),
}
self.token_handler = TokenHandler(self.git_provider.pr,
self.vars,
Expand Down
1 change: 1 addition & 0 deletions pr_agent/tools/pr_questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(self, pr_url: str, args=None):
"language": self.main_pr_language,
"diff": "", # empty diff for initial calculation
"questions": self.question_str,
"commit_messages_str": self.git_provider.get_commit_messages(),
}
self.token_handler = TokenHandler(self.git_provider.pr,
self.vars,
Expand Down
1 change: 1 addition & 0 deletions pr_agent/tools/pr_reviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def __init__(self, pr_url: str, is_answer: bool = False, args: list = None):
'question_str': question_str,
'answer_str': answer_str,
"extra_instructions": get_settings().pr_reviewer.extra_instructions,
"commit_messages_str": self.git_provider.get_commit_messages(),
}

self.token_handler = TokenHandler(
Expand Down
1 change: 1 addition & 0 deletions pr_agent/tools/pr_update_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(self, pr_url: str, cli_mode=False, args=None):
"changelog_file_str": self.changelog_file_str,
"today": date.today(),
"extra_instructions": get_settings().pr_update_changelog.extra_instructions,
"commit_messages_str": self.git_provider.get_commit_messages(),
}
self.token_handler = TokenHandler(self.git_provider.pr,
self.vars,
Expand Down

0 comments on commit cfa1417

Please sign in to comment.