Initial commit
This commit is contained in:
145
commands/download-issues.md
Normal file
145
commands/download-issues.md
Normal file
@@ -0,0 +1,145 @@
|
||||
---
|
||||
description: Download CodeRabbit AI review comments for a Pull Request
|
||||
---
|
||||
|
||||
## Download PR Reviews
|
||||
|
||||
This command downloads CodeRabbit AI review comments from a GitHub Pull Request and organizes them by severity for systematic resolution.
|
||||
|
||||
**This command works from any directory** - it will save reviews to the current working directory's `.reviews/` folder.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# With PR number
|
||||
/reviewer:download-issues --pr 123
|
||||
|
||||
# Without PR number (auto-detects latest open PR)
|
||||
/reviewer:download-issues
|
||||
```
|
||||
|
||||
## How Claude Code Executes This
|
||||
|
||||
When you run `/reviewer:download-issues --pr 123` or `/reviewer:download-issues`, Claude Code will:
|
||||
|
||||
1. Find the installed `pr-reviewer` skill location
|
||||
2. Execute the download script from the skill directory
|
||||
3. Save output to **your current working directory** (the repo you're working on)
|
||||
|
||||
## Command
|
||||
|
||||
```bash
|
||||
# Execute from skill location, save to current working directory
|
||||
CWD=$(pwd) node ~/.claude/plugins/marketplaces/claude-craftkit/plugins/reviewer/skills/pull-request-skill/run.js download <pr>
|
||||
|
||||
# Or without PR number (auto-detect latest)
|
||||
CWD=$(pwd) node ~/.claude/plugins/marketplaces/claude-craftkit/plugins/reviewer/skills/pull-request-skill/run.js download
|
||||
```
|
||||
|
||||
**Note:** The exact path may vary depending on where Claude Code installs plugins. Claude will handle finding the correct path automatically.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. **GitHub Personal Access Token**
|
||||
|
||||
The skill needs a `.env` file in its installation directory with your GitHub token:
|
||||
|
||||
```bash
|
||||
# Location: ~/.claude/plugins/marketplaces/claude-craftkit/plugins/reviewer/skills/pull-request-skill/.env
|
||||
GITHUB_TOKEN=ghp_your_personal_access_token_here
|
||||
OUTPUT_DIR=./.reviews
|
||||
LOG_LEVEL=info
|
||||
PR_REVIEW_TZ=America/Sao_Paulo
|
||||
```
|
||||
|
||||
Generate token at: https://github.com/settings/tokens
|
||||
Required scopes: `repo` (full repository access)
|
||||
|
||||
2. **Dependencies**
|
||||
|
||||
Dependencies will be auto-installed on first run. To install manually:
|
||||
|
||||
```bash
|
||||
cd ~/.claude/plugins/marketplaces/claude-craftkit/plugins/reviewer/skills/pull-request-skill
|
||||
bun install
|
||||
```
|
||||
|
||||
## Output Structure
|
||||
|
||||
The command creates a directory structure in **your repo's** `.reviews/reviews-pr-<pr>/`:
|
||||
|
||||
```
|
||||
your-repo/
|
||||
└── .reviews/ # Created in YOUR working directory
|
||||
└── reviews-pr-123/
|
||||
├── summary.md # 📊 Overview with statistics
|
||||
├── pr-review-combined.log # 📋 Full execution logs
|
||||
├── pr-review-error.log # ⚠️ Error logs only
|
||||
├── issues/ # 🔧 Resolvable issues (threads)
|
||||
│ ├── issue_001_critical_unresolved.md
|
||||
│ ├── issue_002_major_unresolved.md
|
||||
│ └── issue_003_trivial_resolved.md
|
||||
└── comments/ # 💬 General comments
|
||||
├── comment_001.md
|
||||
└── comment_002.md
|
||||
```
|
||||
|
||||
## Issue Severity Levels
|
||||
|
||||
Issues are automatically categorized by severity:
|
||||
|
||||
- **🔴 Critical**: Serious problems requiring immediate attention
|
||||
- **🟠 Major**: Important issues affecting functionality
|
||||
- **🔵 Trivial**: Minor issues and style improvements
|
||||
|
||||
## Next Steps
|
||||
|
||||
After downloading reviews:
|
||||
|
||||
1. **Review the summary**: Check `.reviews/reviews-pr-<pr>/summary.md`
|
||||
2. **Start fixing issues**: Use the `/fix` command
|
||||
3. **Track progress**: Issues are marked as resolved/unresolved
|
||||
|
||||
## Environment Variables
|
||||
|
||||
- `GITHUB_TOKEN` (required): GitHub Personal Access Token
|
||||
- `OUTPUT_DIR` (optional): Output directory relative to working dir (default: `./.reviews`)
|
||||
- `CWD` (optional): Override working directory (default: current directory)
|
||||
- `LOG_LEVEL` (optional): Logging level - `error`, `warn`, `info`, `debug` (default: `info`)
|
||||
- `PR_REVIEW_TZ` (optional): Timezone for dates (default: system timezone)
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
# Download PR #123 - saves to current directory's .reviews/
|
||||
/reviewer:download-issues --pr 123
|
||||
|
||||
# Download latest open PR (auto-detects)
|
||||
/reviewer:download-issues
|
||||
|
||||
# With debug logging
|
||||
LOG_LEVEL=debug /reviewer:download-issues --pr 123
|
||||
|
||||
# Save to custom directory
|
||||
OUTPUT_DIR=./my-reviews /reviewer:download-issues --pr 123
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**"GITHUB_TOKEN is not set"**
|
||||
- Create `.env` file in the skill's installation directory
|
||||
- Path: `~/.claude/plugins/marketplaces/claude-craftkit/plugins/reviewer/skills/pull-request-skill/.env`
|
||||
|
||||
**"No CodeRabbit AI comments found"**
|
||||
- CodeRabbit hasn't reviewed the PR yet
|
||||
- Check if PR has comments from `@coderabbitai[bot]`
|
||||
|
||||
**"Repository information could not be parsed"**
|
||||
- Verify you're in a git repository
|
||||
- Check git remote: `git remote -v`
|
||||
- Remote must be: `https://github.com/owner/repo.git`
|
||||
|
||||
## See Also
|
||||
|
||||
- `/reviewer:fix-issues` - Fix issues from a downloaded PR review
|
||||
- `/reviewer:pr-status` - Check status of PR reviews
|
||||
107
commands/fix-issues.md
Normal file
107
commands/fix-issues.md
Normal file
@@ -0,0 +1,107 @@
|
||||
---
|
||||
description: Fix issues for a given PR
|
||||
---
|
||||
|
||||
<type>--type</type>
|
||||
<pr>--pr</pr>
|
||||
<from>--from</from>
|
||||
|
||||
## Fix PR Review Issues
|
||||
|
||||
This command helps you systematically fix issues from a downloaded CodeRabbit AI review.
|
||||
|
||||
**Works from any directory** - reads issues from `.reviews/` in your current working directory.
|
||||
|
||||
## Helper Commands
|
||||
|
||||
Before starting work on fixing issues, use the `read-pr-issues.sh` script to review what needs to be addressed:
|
||||
|
||||
```bash
|
||||
# Read all issues for a PR (from your working directory's .reviews/)
|
||||
~/.claude/plugins/marketplaces/claude-craftkit/plugins/reviewer/skills/pull-request-skill/read-pr-issues.sh --pr <pr> --type issue --all
|
||||
|
||||
# Read a specific range of issues
|
||||
~/.claude/plugins/marketplaces/claude-craftkit/plugins/reviewer/skills/pull-request-skill/read-pr-issues.sh --pr <pr> --type issue --from <from> --to 10
|
||||
|
||||
# Read critical issues only
|
||||
~/.claude/plugins/marketplaces/claude-craftkit/plugins/reviewer/skills/pull-request-skill/read-pr-issues.sh --pr <pr> --type critical --all
|
||||
|
||||
# Read major issues only
|
||||
~/.claude/plugins/marketplaces/claude-craftkit/plugins/reviewer/skills/pull-request-skill/read-pr-issues.sh --pr <pr> --type major --all
|
||||
|
||||
# Read trivial issues only
|
||||
~/.claude/plugins/marketplaces/claude-craftkit/plugins/reviewer/skills/pull-request-skill/read-pr-issues.sh --pr <pr> --type trivial --all
|
||||
```
|
||||
|
||||
**Note:** The exact path may vary. Claude Code will find the skill automatically.
|
||||
|
||||
This script displays issues in a clean, readable format with:
|
||||
|
||||
- Issue numbers and titles
|
||||
- File locations
|
||||
- Current status (resolved/unresolved)
|
||||
- Issue descriptions
|
||||
- Thread IDs for GitHub reference
|
||||
|
||||
## Critical Requirements
|
||||
|
||||
<critical>
|
||||
- **YOU NEED** to fix the <type> from <from> in the `.reviews/reviews-pr-<pr>`, and only finish when ALL THESE ISSUES are addressed;
|
||||
- This should be fixed in THE BEST WAY possible, not using workarounds;
|
||||
- **YOU MUST** follow project standards and rules from `.cursor/rules` or `.claude/CLAUDE.md`, and ensure all parameters are addressed;
|
||||
- If, in the end, you don't have all issues addressed, your work will be **INVALIDATED**;
|
||||
- After making all the changes, you need to update the progress in the `summary.md` file and all the related issue files.
|
||||
- **MUST DO:** After resolving every issue run `~/.claude/plugins/marketplaces/claude-craftkit/plugins/reviewer/skills/pull-request-skill/resolve-pr-issues.sh --pr-dir .reviews/reviews-pr-<pr> --from <from> --to <end>` so the script calls `gh` to close the review threads and refreshes the summary.
|
||||
</critical>
|
||||
|
||||
## Workflow
|
||||
|
||||
1. **Read issues** to understand what needs to be fixed
|
||||
2. **Fix the code** following best practices and project standards
|
||||
3. **Mark as resolved** using the resolve script
|
||||
4. **Commit changes** with descriptive message
|
||||
|
||||
## After Finishing
|
||||
|
||||
<after_finish>
|
||||
|
||||
- **MUST COMMIT:** After fixing ALL issues in this batch and ensuring `make lint && make test` pass (or equivalent),
|
||||
commit the changes with a descriptive message that references the PR and fixed issues.
|
||||
Example: `git commit -am "fix(repo): resolve PR #<pr> issues [batch <from>-<end>]"`
|
||||
Note: Commit locally only - do NOT push. Multiple batches will be committed separately.
|
||||
</after_finish>
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
# Fix critical issues starting from issue 1
|
||||
/fix --pr 123 --type critical --from 1
|
||||
|
||||
# Fix major issues from 5 to 10
|
||||
/fix --pr 123 --type major --from 5
|
||||
|
||||
# Fix all trivial issues
|
||||
/fix --pr 123 --type trivial --from 1
|
||||
```
|
||||
|
||||
## Resolving Issues
|
||||
|
||||
After fixing issues, mark them as resolved:
|
||||
|
||||
```bash
|
||||
# Resolve issues 1-10
|
||||
~/.claude/plugins/marketplaces/claude-craftkit/plugins/reviewer/skills/pull-request-skill/resolve-pr-issues.sh --pr-dir .reviews/reviews-pr-123 --from 1 --to 10
|
||||
|
||||
# Resolve all unresolved issues
|
||||
~/.claude/plugins/marketplaces/claude-craftkit/plugins/reviewer/skills/pull-request-skill/resolve-pr-issues.sh --pr-dir .reviews/reviews-pr-123 --all
|
||||
```
|
||||
|
||||
This will:
|
||||
- Mark threads as resolved in GitHub
|
||||
- Rename files from `*_unresolved.md` to `*_resolved.md`
|
||||
- Update the summary
|
||||
|
||||
## See Also
|
||||
|
||||
- `/reviewer:download-issues` - Download PR reviews
|
||||
- `/reviewer:pr-status` - Check status of PR reviews
|
||||
82
commands/pr-status.md
Normal file
82
commands/pr-status.md
Normal file
@@ -0,0 +1,82 @@
|
||||
---
|
||||
description: Check status of PR review issues
|
||||
---
|
||||
|
||||
<pr>--pr</pr>
|
||||
|
||||
## Check PR Review Status
|
||||
|
||||
This command displays a summary of the current status of issues for a Pull Request review.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# View summary file for a PR
|
||||
cat .reviews/reviews-pr-<pr>/summary.md
|
||||
|
||||
# Count unresolved issues
|
||||
find .reviews/reviews-pr-<pr>/issues -name "*_unresolved.md" | wc -l
|
||||
|
||||
# Count resolved issues
|
||||
find .reviews/reviews-pr-<pr>/issues -name "*_resolved.md" | wc -l
|
||||
|
||||
# List unresolved critical issues
|
||||
ls .reviews/reviews-pr-<pr>/issues/*_critical_unresolved.md
|
||||
|
||||
# List unresolved major issues
|
||||
ls .reviews/reviews-pr-<pr>/issues/*_major_unresolved.md
|
||||
|
||||
# List unresolved trivial issues
|
||||
ls .reviews/reviews-pr-<pr>/issues/*_trivial_unresolved.md
|
||||
```
|
||||
|
||||
## Summary File
|
||||
|
||||
The `summary.md` file contains:
|
||||
|
||||
- **Total Issues**: Breakdown by severity (Critical/Major/Trivial)
|
||||
- **Resolution Status**: Resolved vs Unresolved counts
|
||||
- **Issue Links**: Direct links to each issue file
|
||||
- **File Locations**: Code locations for each issue
|
||||
|
||||
## Progress Tracking
|
||||
|
||||
The summary is automatically updated when you:
|
||||
|
||||
1. Download PR reviews (`/reviewer:download-issues`)
|
||||
2. Resolve issues using the resolve script
|
||||
|
||||
## Example Output
|
||||
|
||||
```markdown
|
||||
# PR Review #123 - CodeRabbit AI Export
|
||||
|
||||
## Summary
|
||||
|
||||
- **Issues (resolvable review comments):** 15
|
||||
- 🔴 Critical: 3
|
||||
- 🟠 Major: 7
|
||||
- 🔵 Trivial: 5
|
||||
- **Comments (simple, not resolvable):** 8
|
||||
- **Resolved issues:** 10 ✓
|
||||
- **Unresolved issues:** 5
|
||||
|
||||
**Generated on:** 2025-01-15 14:30:00 America/Sao_Paulo
|
||||
```
|
||||
|
||||
## Quick Status Check
|
||||
|
||||
Create an alias for quick status checks:
|
||||
|
||||
```bash
|
||||
# Add to your .bashrc or .zshrc
|
||||
alias pr-status='f() { cat .reviews/reviews-pr-$1/summary.md | head -20; }; f'
|
||||
|
||||
# Usage
|
||||
pr-status 123
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `/reviewer:download-issues` - Download PR reviews
|
||||
- `/reviewer:fix-issues` - Fix issues from a PR review
|
||||
Reference in New Issue
Block a user