Skip to content
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

The Configurator Strikes Back #159

Merged
merged 7 commits into from
Jul 30, 2023
Merged

The Configurator Strikes Back #159

merged 7 commits into from
Jul 30, 2023

Conversation

mrT23
Copy link
Collaborator

@mrT23 mrT23 commented Jul 30, 2023

PR Type:

Enhancement


PR Description:

This PR is like a Swiss Army knife for our PR agent. It allows users to tweak any configuration parameter from 'configuration.toml' on-the-fly, right from the command line or bot commands. It's like giving our PR agent a new superpower, but without the need for a radioactive spider or a trip to Krypton.


PR Main Files Walkthrough:

-pr_agent/agent/pr_agent.py: The PR agent now takes additional arguments for each action, allowing users to modify settings on the fly.
-pr_agent/algo/utils.py: A new function update_settings_from_args has been added to parse and apply configuration changes from the command line arguments.
-pr_agent/cli.py: The command line interface now accepts configuration changes as arguments.
-pr_agent/servers/help.py: The help text has been updated to include instructions for modifying configuration settings.
-pr_agent/tools/pr_code_suggestions.py: The PR code suggestions tool now accepts additional arguments to modify settings.
-pr_agent/tools/pr_description.py: The PR description tool now accepts additional arguments to modify settings.
-pr_agent/tools/pr_information_from_user.py: The PR information from user tool now accepts additional arguments to modify settings.
-pr_agent/tools/pr_reviewer.py: The PR reviewer tool now accepts additional arguments to modify settings.
-pr_agent/tools/pr_update_changelog.py: The PR update changelog tool now accepts additional arguments to modify settings.
-pr_agent/settings/configuration.toml: The configuration file has been updated with new fields for each tool to accept extra instructions.


Extra human details:

was generated from cli with:

--pr_url=https://github.com/Codium-ai/pr-agent/pull/159
describe
--pr_description.extra_instructions="make the PR description funny"

@mrT23 mrT23 requested a review from okotek July 30, 2023 08:43
@github-actions
Copy link
Contributor

PR Analysis

  • 🎯 Main theme: This PR introduces the ability to modify any configuration setting from the command line arguments. It also includes updates to the help text and the configuration file to reflect these changes.
  • 📌 Type of PR: Enhancement
  • 🧪 Relevant tests added: No
  • Focused PR: Yes, the PR is focused as it concentrates on a single feature - allowing configuration settings to be updated from command line arguments. The title, 'update_settings_from_args', accurately represents the changes made in the PR.
  • 🔒 Security concerns: No, the PR does not introduce any apparent security issues. The changes are primarily related to configuration settings and do not involve any sensitive data handling or operations that could potentially lead to security vulnerabilities.

PR Feedback

  • 💡 General PR suggestions: The PR is generally well-structured and the changes are consistent across different files. However, it would be beneficial to include tests that verify the new functionality. Additionally, it would be helpful to provide a more detailed PR description to explain the changes and their impact on the existing codebase.

How to use

To invoke the PR-Agent, add a comment using one of the following commands:
/review [-i]: Request a review of your Pull Request. For an incremental review, which only considers changes since the last review, include the '-i' option.
/describe [-c]: Modify the PR title and description based on the contents of the PR. To get the description as comment instead of modifying the PR description, include the '-c' option.
/improve: Suggest improvements to the code in the PR. These will be provided as pull request comments, ready to commit.
/ask <QUESTION>: Pose a question about the PR.

@mrT23
Copy link
Collaborator Author

mrT23 commented Jul 30, 2023

PR Title

The Configurator Strikes Back

PR Type

Enhancement

PR Description

This PR is like a Swiss army knife for configuration settings! It allows users to modify any configuration parameter from 'configuration.toml' directly from the command line. This is the kind of flexibility that makes a contortionist jealous. It's like giving a chameleon a box of crayons and saying, 'Go nuts, buddy!'

PR Main Files Walkthrough

  • pr_agent.py: The main agent now takes arguments for each action, allowing for on-the-fly configuration changes.
  • utils.py: Added a function to update settings based on provided arguments. It's like a personal trainer for your settings.
  • cli.py: Command line interface now accepts configuration parameters. It's like a drive-thru for your settings.
  • help.py: Updated help text to include information about the new configuration options. It's like a user manual, but less boring.
  • pr_code_suggestions.py, pr_description.py, pr_information_from_user.py, pr_reviewer.py, pr_update_changelog.py: All these files now update settings from arguments. It's like a settings party, and everyone's invited!
  • configuration.toml: Added an 'extra_instructions' field for each command. It's like a secret menu for your commands.
  • pr_code_suggestions_prompts.toml, pr_description_prompts.toml, pr_reviewer_prompts.toml: Added condition to include extra instructions if provided. It's like a whisper in your AI's ear.

@mrT23 mrT23 changed the title update_settings_from_args The Configurator: Edit Any Setting On-the-Fly Jul 30, 2023
@mrT23 mrT23 added the enhancement New feature or request label Jul 30, 2023
@mrT23 mrT23 changed the title The Configurator: Edit Any Setting On-the-Fly The Configurator Strikes Back Jul 30, 2023
pr_agent/algo/utils.py Outdated Show resolved Hide resolved
pr_agent/agent/pr_agent.py Show resolved Hide resolved
pr_agent/algo/utils.py Outdated Show resolved Hide resolved
@mrT23
Copy link
Collaborator Author

mrT23 commented Jul 30, 2023

Changelog updates:

2023-07-30

Enhanced

  • Added the ability to modify any configuration parameter on-the-fly from the command line or bot commands.
  • Updated the command line interface and help text to support configuration changes.
  • Each tool now accepts additional arguments to modify settings.

to commit the new content to the CHANGELOG.md file, please type:
'/update_changelog --pr_update_changelog.push_changelog_changes=true'

Comment on lines +1 to +6
## 2023-07-30

### Enhanced
- Added the ability to modify any configuration parameter from 'configuration.toml' on-the-fly.
- Updated the command line interface and bot commands to accept configuration changes as arguments.
- Improved the PR agent to handle additional arguments for each action.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CHANGELOG.md update

@mrT23 mrT23 merged commit 5a181e5 into main Jul 30, 2023
1 check passed
@mrT23 mrT23 deleted the tr/edit_any_config_setting branch July 30, 2023 12:19
pr_agent/tools/pr_update_changelog.py Show resolved Hide resolved
pr_agent/tools/pr_description.py Show resolved Hide resolved
pr_agent/tools/pr_code_suggestions.py Show resolved Hide resolved
pr_agent/tools/pr_reviewer.py Show resolved Hide resolved
@mrT23
Copy link
Collaborator Author

mrT23 commented Jul 30, 2023

/improve --pr_code_suggestions.num_code_suggestions=1

Comment on lines 24 to 31
self.main_language = get_main_pr_language(
self.git_provider.get_languages(), self.git_provider.get_files()
)
self.commit_changelog = self._parse_args(args, settings)
update_settings_from_args(args)
self.commit_changelog = settings.pr_update_changelog.push_changelog_changes
self._get_changlog_file() # self.changelog_file_str
self.ai_handler = AiHandler()
self.patches_diff = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The update_settings_from_args(args) function is called before the args variable is checked for None. This could lead to a TypeError if args is None. To prevent this, the function should be called after checking if args is not None.

Suggested change
self.main_language = get_main_pr_language(
self.git_provider.get_languages(), self.git_provider.get_files()
)
self.commit_changelog = self._parse_args(args, settings)
update_settings_from_args(args)
self.commit_changelog = settings.pr_update_changelog.push_changelog_changes
self._get_changlog_file() # self.changelog_file_str
self.ai_handler = AiHandler()
self.patches_diff = None
def __init__(self, pr_url: str, cli_mode=False, args: list = None):
self.git_provider = get_git_provider()(pr_url)
self.main_language = get_main_pr_language(
self.git_provider.get_languages(), self.git_provider.get_files()
)
if args is not None:
update_settings_from_args(args)
self.commit_changelog = settings.pr_update_changelog.push_changelog_changes
self._get_changlog_file() # self.changelog_file_str
self.ai_handler = AiHandler()
self.patches_diff = None

@lufficc
Copy link

lufficc commented Aug 10, 2023

Preparing pr description...

5 similar comments
@lufficc
Copy link

lufficc commented Aug 10, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 10, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

11 similar comments
@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

@lufficc
Copy link

lufficc commented Aug 11, 2023

Preparing pr description...

yochail pushed a commit to yochail/pr-agent that referenced this pull request Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants