Skip to content

docs(tools): add consolidated usage examples for all tools - #2547

Merged
naorpeled merged 2 commits into
The-PR-Agent:mainfrom
naorpeled:docs/tool-usage-examples
Jul 25, 2026
Merged

naorpeled merged 2 commits into
The-PR-Agent:mainfrom
naorpeled:docs/tool-usage-examples

Conversation

@naorpeled

Copy link
Copy Markdown
Member

Resolves #2039

Issue #2039 asked for usage examples for the core AI review tools. The README and the Tools docs listed the tools but gave no invocation examples. This adds a consolidated examples reference in the docs and a short pointer block in the README.

Changes

  • docs/docs/tools/index.md — new Usage examples section: explains the two ways to trigger a tool (comment on a PR vs. CLI) and a compact table giving the exact /command and python -m pr_agent.cli --pr_url=<PR_URL> <tool> line for every currently-enabled tool. Each row links to that tool's page for screenshots and options.
  • README.md — a short Usage Examples block under "See It in Action" with the four most common commands (including /ask, which the screenshots omit) plus a CLI one-liner, linking to the docs section as the source of truth.

Notes

Resolves The-PR-Agent#2039. The README and tools docs listed the core tools but gave
no invocation examples. Add a 'Usage examples' section to the Tools index
page with the PR-comment and CLI command for every (currently enabled)
tool, and a short pointer block in the README linking to it.

help_docs is omitted from the quick reference since it is temporarily
disabled (see The-PR-Agent#2445).
Copilot AI review requested due to automatic review settings July 25, 2026 11:52
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 25, 2026
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

docs(tools): add consolidated usage examples for PR-Agent tools

📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Add a consolidated “Usage examples” reference for all enabled PR-Agent tools.
• Document both PR-comment (/command) and CLI invocation patterns with copy-paste examples.
• Add a small README pointer block linking to the tools docs as the source of truth.
Diagram

graph TD
  U((User)) --> R["README.md"] --> T["Tools index"] --> P["Tool pages"]
  U --> C{{"PR comment /command"}} --> A["PR-Agent"]
  U --> L{{"CLI: python -m pr_agent.cli"}} --> A
  subgraph Legend
    direction LR
    _u((User)) ~~~ _doc["Doc page"] ~~~ _cmd{{"Command"}}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Auto-generate the tools table from command registry
  • ➕ Prevents drift between docs and actual enabled commands (e.g., help_docs being disabled)
  • ➕ Reduces manual maintenance when adding/removing tools
  • ➖ Requires a small doc-generation step (script/CI) and a canonical export format
  • ➖ May complicate the docs build pipeline depending on current tooling
2. Centralize examples via a reusable docs include/snippet
  • ➕ Avoids duplicating example blocks between README and docs
  • ➕ Keeps the README minimal while still always up-to-date
  • ➖ Depends on docs tooling supporting includes/partials
  • ➖ README (GitHub-rendered) can’t easily consume the same include without extra build steps

Recommendation: The current approach (single source of truth in tools index + a small README pointer) is appropriate for a docs-only change and minimizes duplication. If tool churn is frequent, consider auto-generating the tools/examples table from the command registry to eliminate future inconsistencies.

Files changed (2) +42 / -0

Documentation (2) +42 / -0
README.mdAdd quick usage examples block linking to tools docs +19/-0

Add quick usage examples block linking to tools docs

• Adds a short “Usage Examples” section under “See It in Action” with common PR-comment commands and a CLI one-liner. Links readers to the Tools docs usage examples section as the canonical reference.

README.md

index.mdAdd consolidated PR-comment and CLI invocation table for tools +23/-0

Add consolidated PR-comment and CLI invocation table for tools

• Introduces a “Usage examples” section explaining the two invocation modes (PR comment vs CLI). Adds a compact table listing each enabled tool with its exact /command and the corresponding 'python -m pr_agent.cli --pr_url=<PR_URL> <tool>' example, linking back to each tool’s page.

docs/docs/tools/index.md

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Wrong similar_issue CLI flag ✓ Resolved 🐞 Bug ≡ Correctness
Description
docs/docs/tools/index.md documents similar_issue as runnable with --pr_url=, but the CLI and
tool implementation require an issue URL via --issue_url and will raise when given a PR URL.
Code

docs/docs/tools/index.md[35]

+| [Similar Issues](./similar_issues.md)    | `/similar_issue`                 | `python -m pr_agent.cli --pr_url=<PR_URL> similar_issue`       |
Evidence
The CLI usage string and routing clearly distinguish PR vs issue inputs, and the GitHub provider
rejects non-issue URLs for issue parsing; therefore documenting similar_issue with --pr_url is
incorrect and will fail.

pr_agent/cli.py[15-27]
pr_agent/agent/pr_agent.py[23-41]
pr_agent/tools/pr_similar_issue.py[18-30]
pr_agent/git_providers/github_provider.py[994-1013]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Usage examples table documents the `similar_issue` tool with `--pr_url=<PR_URL>`, but the CLI/tool expect an issue URL (`--issue_url`). This makes the documented command fail when copied.
### Issue Context
- `similar_issue` is routed to `PRSimilarIssue`, which parses the input as a GitHub issue URL.
- The CLI explicitly documents `--issue_url=... similar_issue`.
### Fix Focus Areas
- docs/docs/tools/index.md[20-37]
### Proposed fix
- Change the `Similar Issues` row CLI example to: `python -m pr_agent.cli --issue_url=<ISSUE_URL> similar_issue`.
- Adjust the surrounding text if needed to clarify that some tools use `--issue_url` rather than `--pr_url`. (Keep the table compact, but make the command correct.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Disabled tool still listed 🐞 Bug ≡ Correctness
Description
docs/docs/tools/index.md lists **Help Docs (/help_docs)** in the main tools table even though
/help_docs is unregistered in command2class and explicitly called out as temporarily disabled
later in the same doc, which can mislead users into trying a command that cannot run.
Code

docs/docs/tools/index.md[15]

| **[Help Docs (`/help_docs`)](./help_docs.md)**                                           | Answer a free-text question based on a git documentation folder                                                                             |
Evidence
The docs page lists /help_docs as a tool, but the implementation explicitly omits it from
command2class and tests assert it must not be registered; the same doc also states /help_docs is
temporarily disabled, creating an internal inconsistency.

docs/docs/tools/index.md[7-16]
docs/docs/tools/index.md[39-41]
pr_agent/agent/pr_agent.py[23-45]
tests/unittest/test_help_docs_disabled.py[7-25]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`/help_docs` is currently disabled in code (unregistered), but it is still shown as an available tool in the main tools list. This contradicts the later note that it is disabled and can cause users to attempt a non-functional command.
## Issue Context
- The tools index contains two separate sections: the main tools list and the newly added Usage examples + disabled note.
- The codebase intentionally removed `help_docs` from `command2class` and has a unit test enforcing that it stays disabled.
## Fix Focus Areas
- docs/docs/tools/index.md[7-16]
- docs/docs/tools/index.md[39-41]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. PR-only trigger claim 🐞 Bug ≡ Correctness
Description
README.md states every tool runs as a comment on a PR, but the system routes commands from both PR
comments and issue comments; this is misleading particularly for issue-URL tools like
similar_issue.
Code

README.md[227]

+Every tool runs either as a comment on a PR or from the CLI. A few common ones:
Evidence
The GitHub Action runner explicitly handles issue_comment events and routes non-PR issue comments
to PR-Agent with an issue URL, so the README’s PR-only claim is inaccurate.

pr_agent/servers/github_action_runner.py[241-288]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new README Usage Examples text says tools run as a comment on a PR, but the codebase also supports triggering tools from issue comments (non-PR issues). The wording can lead users to try issue-scoped tools in PRs.
### Issue Context
GitHub Action runner processes `issue_comment` events for both PRs and regular issues; for non-PR issues it passes the issue URL to PR-Agent.
### Fix Focus Areas
- README.md[225-238]
### Proposed fix
Update the sentence to reflect reality, e.g. "Every tool runs either as a comment on a PR (and some also on issues) or from the CLI." or "...as a comment on a PR/issue..."

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

  • Author self-review: I have reviewed the code review findings, and addressed the relevant ones.

Qodo Logo

Comment thread docs/docs/tools/index.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR improves PR-Agent onboarding by adding a consolidated “usage examples” reference for tool invocations (PR-comment vs CLI) and a small README pointer so users can quickly find runnable command examples.

Changes:

  • Added a “Usage examples” section to the Tools index docs with PR-comment and CLI invocation examples per tool.
  • Added a short “Usage Examples” block in the README linking to the docs as the source of truth.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
README.md Adds a small “Usage Examples” snippet (PR comment + CLI) and links to the full tools examples in docs.
docs/docs/tools/index.md Adds a consolidated “Usage examples” section with a compact per-tool command table.
Comments suppressed due to low confidence (1)

README.md:233

  • The PR-comment examples are wrapped in a fenced block and start with a # ... line. If someone copy/pastes the whole block into a PR comment, PR-Agent won’t trigger because the command must appear at the beginning of the comment (the fence/leading # would come first). Consider formatting PR-comment commands separately (plain bullets or an indented block) and keeping the CLI invocation separate.
```bash
# Comment on a PR (GitHub/GitLab/Bitbucket/…):
/describe                        # generate title, summary, walkthrough and labels
/review                          # findings, security, review effort and tests
/improve                         # actionable code-improvement suggestions

Comment thread docs/docs/tools/index.md Resolved
Comment thread README.md Resolved
Address code-review feedback on The-PR-Agent#2547:
- similar_issue takes --issue_url=<ISSUE_URL>, not --pr_url; correct the
  CLI example and note that issue-scoped tools use --issue_url.
- Soften the 'every tool runs as a PR comment' wording since some tools
  (e.g. similar_issue) operate on issues.
- Explain that /help_docs is omitted because it is temporarily disabled
  (The-PR-Agent#2445).
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit e91e3b0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation Enhancement: Include Examples for Core AI Review Tools

2 participants