项目文件夹

文件
wehub-resource-sync bb5c75ce05
Component Security Validation / Security Audit (push) Has been cancelled
Deploy to Cloudflare Pages / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:38:58 +08:00

1 行
11 KiB
JSON

{"content": "---\nallowed-tools: Bash(gh:*), Read, Grep, TodoWrite, Edit, MultiEdit\nargument-hint: [pr-number] | --analyze-only | --preview | --priority high|medium|low\ndescription: Transform Gemini Code Assist PR reviews into prioritized TodoLists with automated execution\nmodel: claude-sonnet-4-5-20250929\n---\n\n# Gemini PR Review Automation\n\n## Why This Command Exists\n\n**The Problem**: Gemini Code Assist provides free, automated PR reviews on GitHub. But AI-generated reviews often get ignored because they lack the urgency of human feedback.\n\n**The Pain Point**: Manually asking Claude Code to:\n1. \"Analyze PR #42's Gemini review\"\n2. \"Prioritize the issues\"\n3. \"Create a TodoList\"\n4. \"Start working on them\"\n\n...gets tedious fast.\n\n**The Solution**: One command that automatically fetches Gemini's review, analyzes severity, creates prioritized TodoLists, and optionally starts execution.\n\n## What Makes This Different\n\n| | Code Analysis | Code Improvement | Gemini Review |\n|---|---|---|---|\n| **Trigger** | When you want analysis | When you want improvements | **When Gemini already reviewed** |\n| **Input** | Local codebase | Local codebase | **GitHub PR's Gemini comments** |\n| **Purpose** | General analysis | General improvements | **Convert AI review → actionable TODOs** |\n| **Output** | Analysis report | Applied improvements | **TodoList + Priority + Execution** |\n\n## Triggers\n- PR has Gemini Code Assist review comments waiting to be addressed\n- Need to convert AI feedback into structured action items\n- Want to systematically process automated review feedback\n- Reduce manual context switching between GitHub and development\n\n## Usage\n```bash\n/gemini-review [pr-number] [--analyze-only] [--preview] [--priority high|medium|low]\n```\n\n## Behavioral Flow\n1. **Fetch**: Retrieve PR details and Gemini review comments using GitHub CLI\n2. **Analyze**: Parse and categorize review comments by type and severity\n3. **Prioritize**: Assess each comment for refactoring necessity and impact\n4. **TodoList**: Generate structured TodoList with priority ordering\n5. **Execute**: (Optional) Start working on high-priority items with user confirmation\n\nKey behaviors:\n- Intelligent comment categorization (critical, improvement, suggestion, style)\n- Impact assessment for each review item with effort estimation\n- Automatic TodoList creation with priority matrix (must-fix, should-fix, nice-to-have)\n- Code location mapping and dependency analysis\n- Implementation strategy with phased approach\n\n## Tool Coordination\n- **Bash**: GitHub CLI operations for PR and review data fetching\n- **Sequential Thinking**: Multi-step reasoning for complex refactoring decisions\n- **Grep**: Code pattern analysis and issue location identification\n- **Read**: Source code inspection for context understanding\n- **TodoWrite**: Automatic TodoList generation with priorities\n- **Edit/MultiEdit**: Code modifications when executing fixes\n\n## Key Patterns\n- **Review Parsing**: Gemini comments → structured analysis data\n- **Severity Classification**: Comment type → priority level assignment (Must-fix/Should-fix/Nice-to-have/Skip)\n- **TodoList Generation**: Analysis results → TodoWrite with prioritized items\n- **Impact Analysis**: Code changes → ripple effect assessment\n- **Execution Planning**: Strategy → actionable implementation steps\n\n## Examples\n\n### Analyze Current Branch's PR\n```bash\n/gemini-review\n# Automatically detects current branch's PR\n# Generates prioritized TodoList from Gemini review\n# Ready to execute after user confirmation\n```\n\n### Analyze Specific PR\n```bash\n/gemini-review 42\n# Analyzes Gemini review comments on PR #42\n# Creates prioritized TodoList with effort estimates\n```\n\n### Preview Mode (Safe Execution)\n```bash\n/gemini-review --preview\n# Shows what would be fixed without applying changes\n# Creates TodoList for manual execution\n# Allows review before implementation\n```\n\n## Real Workflow Example\n\n**Before (Manual, Tedious)**:\n```bash\n1. Open GitHub PR page\n2. Read Gemini review (often skipped because \"AI generated\")\n3. Tell Claude: \"Analyze PR #42 Gemini review\"\n4. Tell Claude: \"Prioritize these issues\"\n5. Tell Claude: \"Create TodoList\"\n6. Tell Claude: \"Start working on them\"\n```\n\n**After (Automated)**:\n```bash\n/gemini-review 42\n# → TodoList automatically created\n# → Priorities set based on severity\n# → Ready to execute immediately\n```\n\n## Analysis Output Structure\n\n### 1. Review Summary\n- Total comments count by severity\n- Severity distribution (critical/improvement/suggestion/style)\n- Common themes and patterns identified\n- Overall review sentiment and key focus areas\n- Estimated total effort required\n\n### 2. Categorized Analysis\nFor each review comment:\n- **Category**: Critical | Improvement | Suggestion | Style\n- **Location**: File path and line numbers with context\n- **Issue**: Description of the problem from Gemini\n- **Impact**: Potential consequences if unaddressed\n- **Decision**: Must-fix | Should-fix | Nice-to-have | Skip\n- **Reasoning**: Why this priority was assigned\n- **Effort**: Estimated implementation time (Small/Medium/Large)\n\n### 3. TodoList Generation\n\n**Automatically creates TodoList with user confirmation before execution**\n\n```\nHigh Priority (Must-Fix):\n✓ Fix SQL injection in auth.js:45 (15 min)\n✓ Remove exposed API key in config.js:12 (5 min)\n\nMedium Priority (Should-Fix):\n○ Refactor UserService complexity (45 min)\n○ Add error handling to payment flow (30 min)\n\nLow Priority (Nice-to-Have):\n○ Update JSDoc comments (20 min)\n○ Rename variable for clarity (5 min)\n\nSkipped:\n- Style suggestion conflicts with project standards\n- Already addressed in different approach\n```\n\n*Note: User reviews and confirms TodoList before any code modifications are made*\n\n### 4. Execution Plan\n- **Phase 1 - Critical Fixes**: Security and breaking issues (immediate)\n- **Phase 2 - Important Improvements**: Maintainability and performance (same PR)\n- **Phase 3 - Optional Enhancements**: Style and documentation (future PR)\n- **Dependencies**: Order of implementation based on code dependencies\n- **Testing Strategy**: Required test updates for each phase\n\n### 5. Decision Record\n- **Accepted Changes**: What will be implemented and why\n- **Deferred Changes**: What will be addressed in future iterations\n- **Rejected Changes**: What won't be implemented and reasoning\n- **Trade-offs**: Analyzed costs vs. benefits for each decision\n\n## Boundaries\n\n**Will:**\n- Fetch and analyze Gemini Code Assist review comments from GitHub PRs\n- Categorize and prioritize review feedback systematically\n- Generate TodoLists with priority ordering and effort estimates\n- Provide decision reasoning and trade-off analysis\n- Map review comments to specific code locations\n- Execute fixes with user confirmation in preview mode\n\n**Will Not:**\n- Automatically implement changes without user review (unless explicitly requested)\n- Dismiss Gemini suggestions without analysis and documentation\n- Make architectural decisions without considering project context\n- Modify code outside the scope of review comments\n- Work with non-Gemini review systems (GitHub Copilot, CodeRabbit, etc.)\n\n## Decision Criteria\n\n### Must-Fix (Critical) - High Priority\n- Security vulnerabilities and data exposure\n- Data integrity issues and potential corruption\n- Breaking changes or runtime errors\n- Critical performance problems (>100ms delay, memory leaks)\n- Violations of core architecture principles\n\n### Should-Fix (Improvement) - Medium Priority\n- Code maintainability issues and technical debt\n- Moderate performance improvements (10-100ms gains)\n- Important best practice violations\n- Significant readability and documentation gaps\n- Error handling and resilience improvements\n\n### Nice-to-Have (Suggestion) - Low Priority\n- Code style improvements and formatting\n- Minor optimizations (<10ms gains)\n- Optional refactoring opportunities\n- Enhanced error messages and logging\n- Additional code comments and documentation\n\n### Skip (Not Applicable)\n- Conflicts with established project standards\n- Out of scope for current iteration\n- Low ROI improvements (high effort, low impact)\n- Overly opinionated suggestions without clear benefit\n- Already addressed by other means or different approach\n\n## Integration with Git Workflow\n\n### Recommended Flow\n```bash\n1. Create PR → Gemini reviews automatically\n2. Run /gemini-review to generate TodoList\n3. Review TodoList priorities and adjust if needed\n4. Execute fixes systematically (Phase 1 → Phase 2 → Phase 3)\n5. Commit changes with conventional commit messages\n6. Update PR and re-request Gemini review if needed\n```\n\n### Commit Strategy\n- Group related refactoring changes by category\n- Use conventional commit messages referencing review items\n - `fix(auth): resolve SQL injection vulnerability (Gemini PR#42)`\n - `refactor(services): reduce UserService complexity (Gemini PR#42)`\n - `docs: update JSDoc comments (Gemini PR#42)`\n- Create separate commits for critical vs. improvement changes\n- Document decision rationale in commit messages\n\n## Advanced Usage\n\n### Interactive Mode (Recommended for Complex Reviews)\n```\n/gemini-review --interactive\n# Step through each review comment with decision prompts\n# Allows manual priority adjustment\n# Shows code context for each issue\n```\n\n### Export Analysis\n```\n/gemini-review --export gemini-analysis.md\n# Export comprehensive analysis to markdown file\n# Useful for team review and documentation\n# Includes all decisions and reasoning\n```\n\n### Dry Run (No TodoList Creation)\n```\n/gemini-review --dry-run\n# Shows analysis and priorities without creating TodoList\n# Useful for understanding scope before committing\n# No changes to workflow state\n```\n\n## Tool Requirements\n- **GitHub CLI** (`gh`) installed and authenticated\n- **Repository** must have Gemini Code Assist configured as PR reviewer\n- **Current branch** must have associated PR or provide PR number explicitly\n\n## Setup Gemini Code Assist\n\nIf you haven't set up Gemini Code Assist yet:\n\n1. Visit [Gemini Code Assist GitHub App](https://developers.google.com/gemini-code-assist/docs/set-up-code-assist-github)\n2. Install the app on your organization/account\n3. Select repositories for integration\n4. Gemini will automatically review PRs with `/gemini` tag or auto-review\n\n**Why Gemini?**\n- **Free**: No cost for automated PR reviews\n- **Comprehensive**: Covers security, performance, best practices\n- **GitHub Native**: Integrated directly into PR workflow\n- **Automated**: No manual review requests needed\n\n## Limitations\n\n- Only supports Gemini Code Assist reviews (not GitHub Copilot, CodeRabbit, etc.)\n- Requires GitHub CLI access and authentication\n- Analysis quality depends on Gemini review quality\n- Cannot modify reviews or re-trigger Gemini analysis\n"}