from pr_agent.config_loader import get_settings from pr_agent.git_providers import get_git_provider from pr_agent.log import get_logger class PRHelpMessage: def __init__(self, pr_url: str, args=None, ai_handler=None): self.git_provider = get_git_provider()(pr_url) async def run(self): try: get_logger().info('Getting PR Help Message...') pr_comment = "## PR Agent Walkthrough\n\n" pr_comment += "🤖 Welcome to the PR Agent, an AI-powered tool for automated pull request analysis, feedback, suggestions and more.""" pr_comment += "\n\nHere is a list of tools you can use to interact with the PR Agent:\n" base_path = "https://github.com/Codium-ai/pr-agent/tree/main/docs" pr_comment += f"" pr_comment += f"\n" pr_comment += f"\n" pr_comment += f"\n" pr_comment += f"\n" pr_comment += f"\n" pr_comment += f"\n" pr_comment += f"\n" pr_comment += f"\n" pr_comment += f"\n" pr_comment += f"\n" pr_comment += f"\n" pr_comment += f"\n" pr_comment += "
ToolDescription
\n\n[DESCRIBE]({base_path}/DESCRIBE.md)Generates PR description - title, type, summary, code walkthrough and labels
\n\n[REVIEW]({base_path}/REVIEW.md)Adjustable feedback about the PR, possible issues, security concerns, review effort and more
\n\n[IMPROVE]({base_path}/IMPROVE.md)Code suggestions for improving the PR.
\n\n[ASK]({base_path}/ASK.md)Answering free-text questions about the PR.
\n\n[SIMILAR ISSUE]({base_path}/SIMILAR_ISSUE.md)Automatically retrieves and presents similar issues.
\n\n[UPDATE CHANGELOG]({base_path}/UPDATE_CHANGELOG.md)Automatically updates the changelog.
\n\n[ADD DOCUMENTATION]({base_path}/ADD_DOCUMENTATION.md)Generates documentation to methods/functions/classes that changed in the PR.
\n\n[GENERATE CUSTOM LABELS]({base_path}/GENERATE_CUSTOM_LABELS.md)Generates custom labels for the PR, based on specific guidelines defined by the user
\n\n[ANALYZE]({base_path}/Analyze.md)Identifies code components that changed in the PR, and enables to interactively generate tests, docs, and code suggestions for each component.
\n\n[TEST]({base_path}/TEST.md)Generates unit tests for a selected component, based on the PR code change.
\n\n[CI FEEDBACK]({base_path}/CI_FEEDBACK.md)Generates feedback and analysis for a failed CI job.
\n\n[CUSTOM SUGGESTIONS]({base_path}/CUSTOM_SUGGESTIONS.md)Generates custom suggestions for improving the PR code, based on specific guidelines defined by the user.
\n\n" pr_comment += f"""\n\nNote that each tool be [invoked automatically](https://github.com/Codium-ai/pr-agent/blob/main/Usage.md#github-app-automatic-tools-for-pr-actions) when a new PR is opened, or called manually by [commenting on a PR](https://github.com/Codium-ai/pr-agent/blob/main/Usage.md#online-usage).""" if get_settings().config.publish_output: self.git_provider.publish_comment(pr_comment) except Exception as e: get_logger().error(f"Error while running PRHelpMessage: {e}") return ""