2.8 KiB
2.8 KiB
Tasks
1. Command File Scaffold
- 1.1 Create
.claude/commands/code-review.mdwith frontmatter (description, argument-hint, model, allowed-tools) matching existing command patterns (/commit,/catchup) - 1.2 Write argument parsing section: extract optional PR number and
--commentflag from$ARGUMENTS
2. PR Resolution and Pre-screening
- 2.1 Implement PR auto-detection:
git branch --show-current→list_repo_pull_requestslookup → prompt if ambiguous - 2.2 Implement explicit PR number path: parse number from arguments, call
get_pull_request_by_index - 2.3 Add pre-screening gate: skip draft, closed/merged, trivial (<5 lines), and warn on oversized (>500 lines) PRs
3. Context Gathering
- 3.1 Read
CLAUDE.mdandAGENTS.mdfrom the repository viaget_file_content(handle missing files gracefully) - 3.2 Retrieve PR metadata via
get_pull_request_by_indexand read each changed file's content viaget_file_content
4. Change Summarization
- 4.1 Write the Haiku-model summarization prompt: produce structured summary with file paths, change types (added/modified/deleted), and line number ranges per hunk
5. Parallel Review Agents
- 5.1 Write compliance agent prompt (Sonnet): check changed code against CLAUDE.md/AGENTS.md rules, output findings as JSON with
{file, line, rule, description} - 5.2 Write bug hunter agent prompt (Opus): analyze changed code for bugs, error handling gaps, edge cases, output findings as JSON with
{file, line, description} - 5.3 Write logic/security agent prompt (Opus): analyze changed code for logic errors, security issues, race conditions, output findings as JSON with
{file, line, severity, description} - 5.4 Wire all three agents as parallel Task tool calls with
run_in_background: true
6. Confidence Scoring and Filtering
- 6.1 Write the scoring prompt: independently score each finding 0-100, auto-zero pre-existing issues and linter-catchable problems
- 6.2 Add threshold filter: remove findings with confidence < 80
7. Output Formatting
- 7.1 Write terminal output format: group findings by file, show path, line, severity, agent source, confidence, and description
- 7.2 Write clean-result output: "No significant issues found" with filtered count
8. Forgejo Posting
- 8.1 Implement
--commentpath: buildcreate_pull_reviewcall with stateCOMMENT, summary body, and inline comments array (path,body,new_position) - 8.2 Implement clean-review posting: call
create_pull_reviewwith "No significant issues found" body when no findings pass threshold
9. Integration and Testing
- 9.1 End-to-end manual test: run
/code-reviewagainst a real PR in terminal-only mode - 9.2 End-to-end manual test: run
/code-review --commentagainst a test PR and verify inline comments appear on Forgejo