octocode-cli 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -93
- package/out/octocode-cli.js +9818 -1626
- package/package.json +15 -6
- package/skills/README.md +121 -0
- package/skills/octocode-generate/SKILL.md +166 -0
- package/skills/octocode-plan/SKILL.md +166 -0
- package/skills/octocode-pr-review/SKILL.md +137 -0
- package/skills/octocode-research/SKILL.md +177 -0
- package/skills/octocode-research/references/tool-reference.md +304 -0
- package/skills/octocode-research/references/workflow-patterns.md +325 -0
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "octocode-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Interactive CLI installer for octocode-mcp - Configure MCP servers for Cursor, Claude Desktop, and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/octocode-cli.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"octocode": "./out/octocode-cli.js",
|
|
9
8
|
"octocode-cli": "./out/octocode-cli.js"
|
|
10
9
|
},
|
|
11
10
|
"files": [
|
|
12
11
|
"out/octocode-cli.js",
|
|
12
|
+
"skills",
|
|
13
13
|
"assets/example.png",
|
|
14
14
|
"README.md",
|
|
15
15
|
"LICENSE"
|
|
@@ -18,13 +18,17 @@
|
|
|
18
18
|
"build": "yarn lint && vite build",
|
|
19
19
|
"build:dev": "vite build",
|
|
20
20
|
"clean": "rm -rf out/",
|
|
21
|
-
"lint": "eslint src/**/*.ts",
|
|
22
|
-
"lint:fix": "eslint src/**/*.ts --fix",
|
|
21
|
+
"lint": "eslint src/**/*.ts tests/**/*.ts",
|
|
22
|
+
"lint:fix": "eslint src/**/*.ts tests/**/*.ts --fix",
|
|
23
23
|
"start": "node ./out/octocode-cli.js",
|
|
24
24
|
"test": "vitest run --coverage",
|
|
25
25
|
"test:quiet": "vitest run --reporter=dot --silent",
|
|
26
26
|
"test:watch": "vitest --watch",
|
|
27
|
-
"typecheck": "tsc --noEmit"
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"validate:mcp": "npx tsx scripts/validate-mcp-registry.ts",
|
|
29
|
+
"validate:mcp:json": "npx tsx scripts/validate-mcp-registry.ts --json",
|
|
30
|
+
"validate:skills": "npx tsx scripts/validate-skills-marketplace.ts",
|
|
31
|
+
"validate:skills:json": "npx tsx scripts/validate-skills-marketplace.ts --json"
|
|
28
32
|
},
|
|
29
33
|
"keywords": [
|
|
30
34
|
"octocode",
|
|
@@ -51,7 +55,12 @@
|
|
|
51
55
|
"bugs": "https://github.com/bgauryy/octocode-mcp/issues",
|
|
52
56
|
"license": "PolyForm-Small-Business-1.0.0",
|
|
53
57
|
"dependencies": {
|
|
54
|
-
"@inquirer/prompts": "^7.2.1"
|
|
58
|
+
"@inquirer/prompts": "^7.2.1",
|
|
59
|
+
"@octokit/auth-oauth-device": "^8.0.3",
|
|
60
|
+
"@octokit/oauth-methods": "^6.0.2",
|
|
61
|
+
"@octokit/request": "^10.0.7",
|
|
62
|
+
"keytar": "^7.9.0",
|
|
63
|
+
"open": "^11.0.0"
|
|
55
64
|
},
|
|
56
65
|
"devDependencies": {
|
|
57
66
|
"@types/node": "^22.15.29",
|
package/skills/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Octocode Skills
|
|
2
|
+
|
|
3
|
+
Pre-built Claude Code skills for enhanced AI-assisted research and development.
|
|
4
|
+
|
|
5
|
+
## Available Skills
|
|
6
|
+
|
|
7
|
+
| Skill | Description | Flow |
|
|
8
|
+
|-------|-------------|------|
|
|
9
|
+
| `octocode-research` | Evidence-first code forensics (local & GitHub) | PREPARE → DISCOVER → ANALYZE → OUTPUT |
|
|
10
|
+
| `octocode-pr-review` | Defects-first PR review across 6 domains | CONTEXT → CHECKPOINT → ANALYSIS → REPORT |
|
|
11
|
+
| `octocode-plan` | Research-driven planning & implementation | UNDERSTAND → RESEARCH → PLAN → IMPLEMENT → VERIFY |
|
|
12
|
+
| `octocode-generate` | App scaffolding with stack selection | DISCOVERY → STACK → PLAN → SCAFFOLD → VALIDATE |
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
### Option 1: CLI Command
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
octocode skills install
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This copies all skills to `~/.claude/skills/` for global availability.
|
|
23
|
+
|
|
24
|
+
### Option 2: Manual Copy
|
|
25
|
+
|
|
26
|
+
Copy skill folders to your Claude skills directory:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Global (all projects)
|
|
30
|
+
cp -r skills/octocode-* ~/.claude/skills/
|
|
31
|
+
|
|
32
|
+
# Project-specific
|
|
33
|
+
cp -r skills/octocode-* .claude/skills/
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Skill Details
|
|
37
|
+
|
|
38
|
+
### octocode-research
|
|
39
|
+
**Use when**: Answering questions about codebases, implementations, dependencies, or bugs.
|
|
40
|
+
|
|
41
|
+
Features:
|
|
42
|
+
- Local-first strategy (prefer local tools over shell commands)
|
|
43
|
+
- GitHub code forensics
|
|
44
|
+
- Cross-domain transitions (Local ↔ GitHub)
|
|
45
|
+
- node_modules inspection
|
|
46
|
+
|
|
47
|
+
### octocode-pr-review
|
|
48
|
+
**Use when**: Reviewing pull requests for issues.
|
|
49
|
+
|
|
50
|
+
Domain Reviewers:
|
|
51
|
+
- Bug (runtime errors, logic flaws)
|
|
52
|
+
- Architecture (pattern violations, coupling)
|
|
53
|
+
- Performance (O(n²), memory leaks)
|
|
54
|
+
- Code Quality (naming, conventions)
|
|
55
|
+
- Error Handling (swallowed exceptions)
|
|
56
|
+
- Flow Impact (breaking changes)
|
|
57
|
+
|
|
58
|
+
### octocode-plan
|
|
59
|
+
**Use when**: Planning complex implementations requiring research.
|
|
60
|
+
|
|
61
|
+
Goal Types:
|
|
62
|
+
- RESEARCH_ONLY - No code changes
|
|
63
|
+
- ANALYSIS - Understand existing code
|
|
64
|
+
- CREATION - New files/features
|
|
65
|
+
- FEATURE / BUG / REFACTOR - Modify existing
|
|
66
|
+
|
|
67
|
+
### octocode-generate
|
|
68
|
+
**Use when**: Scaffolding new applications.
|
|
69
|
+
|
|
70
|
+
Supported Frameworks:
|
|
71
|
+
- Fullstack: Next.js, T3 Stack, Remix, Nuxt
|
|
72
|
+
- Frontend: Vite, Angular
|
|
73
|
+
- Mobile: Expo
|
|
74
|
+
- Desktop: Electron Vite
|
|
75
|
+
- Backend: NestJS, Hono, Fastify
|
|
76
|
+
|
|
77
|
+
## Skill Structure
|
|
78
|
+
|
|
79
|
+
Each skill follows Anthropic's best practices:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
{skill-name}/
|
|
83
|
+
├── SKILL.md # Main reference (<500 lines)
|
|
84
|
+
└── resources/ # Supporting documentation (optional)
|
|
85
|
+
├── tool-reference.md
|
|
86
|
+
└── workflow-patterns.md
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Shared Principles
|
|
90
|
+
|
|
91
|
+
All skills follow these core principles:
|
|
92
|
+
|
|
93
|
+
1. **Local-First**: Prefer local tools over shell commands
|
|
94
|
+
2. **Research Before Action**: Always gather evidence first
|
|
95
|
+
3. **User Checkpoints**: Ask before major actions
|
|
96
|
+
4. **TodoWrite**: Track progress with tasks
|
|
97
|
+
5. **Validation**: Green build required
|
|
98
|
+
6. **No Time Estimates**: Never provide timing
|
|
99
|
+
|
|
100
|
+
## Creating Custom Skills
|
|
101
|
+
|
|
102
|
+
See `octocode-research/` as a template. Key guidelines:
|
|
103
|
+
|
|
104
|
+
1. **SKILL.md** - Main file with YAML frontmatter:
|
|
105
|
+
```yaml
|
|
106
|
+
---
|
|
107
|
+
name: skill-name
|
|
108
|
+
description: Use when [specific triggers]...
|
|
109
|
+
---
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
2. **Keep SKILL.md under 500 lines** - Use resources/ for details
|
|
113
|
+
|
|
114
|
+
3. **Description = When to Use** - Don't describe workflow, describe triggers
|
|
115
|
+
|
|
116
|
+
4. **Test with pressure scenarios** before deploying
|
|
117
|
+
|
|
118
|
+
## More Info
|
|
119
|
+
|
|
120
|
+
- [Claude Skills Documentation](https://support.claude.com/en/articles/12512176-what-are-skills)
|
|
121
|
+
- [Octocode MCP](https://octocode.ai)
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: octocode-generate
|
|
3
|
+
description: Scaffolds new applications with optimal tech stack selection and project boilerplate. Use when creating new projects, setting up frameworks, generating boilerplate, or starting new applications.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Octocode Generate
|
|
7
|
+
|
|
8
|
+
Research-driven app scaffolding using Octocode MCP tools.
|
|
9
|
+
|
|
10
|
+
## Core Principle
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
MEASURE TWICE, CUT ONCE
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
1. **Research First**: Validate patterns before scaffolding
|
|
17
|
+
2. **Stack Selection**: Choose optimal framework based on requirements
|
|
18
|
+
3. **Green Build Required**: Scaffold must compile and run
|
|
19
|
+
|
|
20
|
+
## Flow
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
DISCOVERY → STACK → PLAN → RESEARCH → SCAFFOLD → VALIDATE
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Tools
|
|
27
|
+
|
|
28
|
+
| Tool | Purpose |
|
|
29
|
+
|------|---------|
|
|
30
|
+
| `githubSearchRepositories` | Find template repos |
|
|
31
|
+
| `githubViewRepoStructure` | Explore structure |
|
|
32
|
+
| `githubSearchCode` | Find config patterns |
|
|
33
|
+
| `githubGetFileContent` | Read implementations |
|
|
34
|
+
| `packageSearch` | Check package info |
|
|
35
|
+
|
|
36
|
+
## Recommended Frameworks
|
|
37
|
+
|
|
38
|
+
### Fullstack
|
|
39
|
+
| Name | CLI Command | Best For |
|
|
40
|
+
|------|-------------|----------|
|
|
41
|
+
| Next.js | `npx create-next-app@latest` | React + SSR/SSG |
|
|
42
|
+
| T3 Stack | `npx create-t3-app@latest` | Type-safe fullstack |
|
|
43
|
+
| Remix | `npx create-remix@latest` | Web standards |
|
|
44
|
+
| Nuxt | `npx nuxi@latest init` | Vue + SSR |
|
|
45
|
+
|
|
46
|
+
### Frontend
|
|
47
|
+
| Name | CLI Command | Best For |
|
|
48
|
+
|------|-------------|----------|
|
|
49
|
+
| Vite | `npm create vite@latest` | Fast SPA |
|
|
50
|
+
| Angular | `npx @angular/cli new` | Enterprise SPA |
|
|
51
|
+
|
|
52
|
+
### Mobile
|
|
53
|
+
| Name | CLI Command | Best For |
|
|
54
|
+
|------|-------------|----------|
|
|
55
|
+
| Expo | `npx create-expo-app@latest` | React Native |
|
|
56
|
+
|
|
57
|
+
### Desktop
|
|
58
|
+
| Name | CLI Command | Best For |
|
|
59
|
+
|------|-------------|----------|
|
|
60
|
+
| Electron Vite | `npm create electron-vite` | Cross-platform |
|
|
61
|
+
|
|
62
|
+
### Backend
|
|
63
|
+
| Name | CLI Command | Best For |
|
|
64
|
+
|------|-------------|----------|
|
|
65
|
+
| NestJS | `npx @nestjs/cli new` | Enterprise API |
|
|
66
|
+
| Hono | `npm create hono@latest` | Edge/lightweight |
|
|
67
|
+
| Fastify | `npx fastify-cli generate` | High-perf Node |
|
|
68
|
+
|
|
69
|
+
## Execution Phases
|
|
70
|
+
|
|
71
|
+
### Phase 0: Discovery
|
|
72
|
+
1. Classify app type: Fullstack | SPA | API | Mobile | Desktop
|
|
73
|
+
2. Ask for references (existing apps, designs, specs)
|
|
74
|
+
3. Confirm package manager: npm (default) | yarn | pnpm
|
|
75
|
+
|
|
76
|
+
**User Checkpoint**: If requirements unclear → STOP & ASK
|
|
77
|
+
|
|
78
|
+
### Phase 1: Stack Selection
|
|
79
|
+
**Selection Criteria**:
|
|
80
|
+
- Match app type to framework strengths
|
|
81
|
+
- Check framework freshness (avoid stale)
|
|
82
|
+
- Verify TypeScript support if required
|
|
83
|
+
- Consider deployment target (Vercel, AWS, etc.)
|
|
84
|
+
|
|
85
|
+
### Phase 2: Planning
|
|
86
|
+
Write plan with:
|
|
87
|
+
- Requirements summary
|
|
88
|
+
- Research tasks
|
|
89
|
+
- Scaffold steps
|
|
90
|
+
- Validation checklist
|
|
91
|
+
|
|
92
|
+
**User Checkpoint**: Present plan → Wait for approval
|
|
93
|
+
|
|
94
|
+
### Phase 3: Research
|
|
95
|
+
**Research Dimensions**:
|
|
96
|
+
|
|
97
|
+
| Dimension | Goal | Example Query |
|
|
98
|
+
|-----------|------|---------------|
|
|
99
|
+
| Official Examples | Canonical patterns | `owner:vercel repo:next.js path:examples` |
|
|
100
|
+
| Popular Templates | Community patterns | `topics:starter topics:template stars:>1000` |
|
|
101
|
+
| Integration Code | How libs connect | `filename:trpc extension:ts "createTRPCNext"` |
|
|
102
|
+
| Config Files | Tooling setup | `filename:next.config extension:mjs` |
|
|
103
|
+
|
|
104
|
+
**Quality Guards**:
|
|
105
|
+
- Prefer repos updated within last 6 months
|
|
106
|
+
- Prefer repos with `stars` > 500
|
|
107
|
+
- Verify active maintenance (recent commits/PRs)
|
|
108
|
+
|
|
109
|
+
### Phase 4: Scaffold
|
|
110
|
+
**Execution Order**:
|
|
111
|
+
1. **Initialize**: Run framework CLI
|
|
112
|
+
2. **Install**: Add dependencies (from research)
|
|
113
|
+
3. **Configure**: Create/update config files
|
|
114
|
+
4. **Implement**: Add features using researched patterns
|
|
115
|
+
|
|
116
|
+
**Guidelines**:
|
|
117
|
+
- Follow researched patterns exactly
|
|
118
|
+
- Use explicit file paths
|
|
119
|
+
- Add TypeScript types
|
|
120
|
+
- Create `.env.example` (never commit secrets)
|
|
121
|
+
- Add essential comments for non-obvious code
|
|
122
|
+
|
|
123
|
+
### Phase 5: Validate
|
|
124
|
+
**Validation Gates (ALL MANDATORY)**:
|
|
125
|
+
- [ ] `npm run build` / `yarn build` - passes
|
|
126
|
+
- [ ] `npx tsc --noEmit` - no errors
|
|
127
|
+
- [ ] Dev server starts without errors
|
|
128
|
+
- [ ] All imports resolve
|
|
129
|
+
- [ ] No TypeScript `any` escapes
|
|
130
|
+
|
|
131
|
+
**Loop**: Fail → Fix → Re-validate until all gates pass
|
|
132
|
+
|
|
133
|
+
## Research Flows
|
|
134
|
+
|
|
135
|
+
| From | Need | Go To |
|
|
136
|
+
|------|------|-------|
|
|
137
|
+
| `githubSearchRepositories` | Structure | `githubViewRepoStructure` |
|
|
138
|
+
| `githubSearchRepositories` | Patterns | `githubSearchCode` |
|
|
139
|
+
| `githubViewRepoStructure` | File content | `githubGetFileContent` |
|
|
140
|
+
| `githubSearchCode` | Full context | `githubGetFileContent` |
|
|
141
|
+
| `packageSearch` | Source code | `githubViewRepoStructure` |
|
|
142
|
+
|
|
143
|
+
## Confidence Framework
|
|
144
|
+
|
|
145
|
+
| Decision Type | Confidence Required | Action |
|
|
146
|
+
|---------------|---------------------|--------|
|
|
147
|
+
| Framework choice | HIGH (2+ sources) | Proceed |
|
|
148
|
+
| Config patterns | MED (1 quality source) | Proceed with note |
|
|
149
|
+
| Uncertain practice | LOW | Ask user |
|
|
150
|
+
|
|
151
|
+
## When to Skip Research
|
|
152
|
+
|
|
153
|
+
- Standard CLI defaults (Next.js app router, Vite React)
|
|
154
|
+
- User explicitly specified tech stack
|
|
155
|
+
- Common boilerplate (`.env.example`, `tsconfig.json` base)
|
|
156
|
+
- Trivial choices with no architectural impact
|
|
157
|
+
|
|
158
|
+
## Error Recovery
|
|
159
|
+
|
|
160
|
+
| Error | Action |
|
|
161
|
+
|-------|--------|
|
|
162
|
+
| Build fails | Fix imports/types, re-validate |
|
|
163
|
+
| Missing types | `npm i -D @types/{package}` |
|
|
164
|
+
| Version conflict | Research compatible versions |
|
|
165
|
+
| Config error | Research correct config pattern |
|
|
166
|
+
| CLI fails | Check framework docs via research |
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: octocode-plan
|
|
3
|
+
description: Plans complex implementations with research-driven analysis and step-by-step breakdowns. Use when planning features, making architectural decisions, designing systems, or implementing multi-step changes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Octocode Plan
|
|
7
|
+
|
|
8
|
+
Research-driven planning and implementation using Octocode MCP tools.
|
|
9
|
+
|
|
10
|
+
## Core Principle
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
RESEARCH BEFORE CODE. VERIFY PATTERNS. FOLLOW THE PLAN.
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
1. **Research First**: Validate patterns in high-quality repos before writing code
|
|
17
|
+
2. **Plan Before Implement**: Break down tasks, identify risks
|
|
18
|
+
3. **Green Build Required**: All changes must pass build/lint/test
|
|
19
|
+
|
|
20
|
+
## Flow
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
UNDERSTAND → RESEARCH → PLAN → [IMPLEMENT] → VERIFY
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Tools
|
|
27
|
+
|
|
28
|
+
**Research**:
|
|
29
|
+
| Tool | Purpose |
|
|
30
|
+
|------|---------|
|
|
31
|
+
| `packageSearch` | Find libs/metadata |
|
|
32
|
+
| `githubSearchRepositories` | Find reference repos |
|
|
33
|
+
| `githubViewRepoStructure` | Map layout |
|
|
34
|
+
| `githubSearchCode` | Find implementations |
|
|
35
|
+
| `githubGetFileContent` | Read code |
|
|
36
|
+
| `localSearchCode` | Search local codebase |
|
|
37
|
+
| `localGetFileContent` | Read local files |
|
|
38
|
+
|
|
39
|
+
**Execution**: `Read`, `Write`, `Edit`, `Bash`
|
|
40
|
+
|
|
41
|
+
## Goal Classification
|
|
42
|
+
|
|
43
|
+
| Type | Description | Action |
|
|
44
|
+
|------|-------------|--------|
|
|
45
|
+
| `RESEARCH_ONLY` | No code changes | Research → Report |
|
|
46
|
+
| `ANALYSIS` | Understand existing code | Research → Document |
|
|
47
|
+
| `CREATION` | New files/features | Research → Plan → Implement |
|
|
48
|
+
| `FEATURE` | Add to existing | Research → Plan → Implement |
|
|
49
|
+
| `BUG` | Fix issue | Research → Plan → Implement |
|
|
50
|
+
| `REFACTOR` | Improve structure | Research → Plan → Implement |
|
|
51
|
+
|
|
52
|
+
## Execution Phases
|
|
53
|
+
|
|
54
|
+
### Phase 0: Understand
|
|
55
|
+
1. Classify goal type (above)
|
|
56
|
+
2. Assess complexity: Quick | Medium | Thorough
|
|
57
|
+
3. Gather context: existing code, patterns, dependencies
|
|
58
|
+
4. Define constraints: tech stack, style, testing requirements
|
|
59
|
+
|
|
60
|
+
**User Checkpoint**: If scope unclear or >2 repos involved → STOP & ASK
|
|
61
|
+
|
|
62
|
+
### Phase 1: Research
|
|
63
|
+
**Progressive Discovery**: PKG → REPO → STRUCT → PATTERN → READ
|
|
64
|
+
|
|
65
|
+
| Stage | Tool | Goal |
|
|
66
|
+
|-------|------|------|
|
|
67
|
+
| PKG | `packageSearch` | Find libs/metadata |
|
|
68
|
+
| REPO | `githubSearchRepositories` | Find reference repos |
|
|
69
|
+
| STRUCT | `githubViewRepoStructure` | Map layout |
|
|
70
|
+
| PATTERN | `githubSearchCode` | Find implementations |
|
|
71
|
+
| READ | `githubGetFileContent` | Read code |
|
|
72
|
+
|
|
73
|
+
**Research Loop (ReAct)**:
|
|
74
|
+
1. **THOUGHT**: What do I need to know next?
|
|
75
|
+
2. **ACTION**: Execute Octocode tool
|
|
76
|
+
3. **OBSERVATION**: Analyze results - hypothesis confirmed?
|
|
77
|
+
4. **DECISION**: Use finding | Research more | Ask user
|
|
78
|
+
|
|
79
|
+
**Quality Guards**:
|
|
80
|
+
- Key findings need second source unless primary is definitive
|
|
81
|
+
- Prefer repos updated within last year
|
|
82
|
+
- Real code only (no dead code, deprecated, tests unless researching tests)
|
|
83
|
+
|
|
84
|
+
### Phase 2: Plan
|
|
85
|
+
Write plan with:
|
|
86
|
+
- Summary of approach
|
|
87
|
+
- Step-by-step tasks with file paths
|
|
88
|
+
- Dependencies/prerequisites
|
|
89
|
+
- Risk areas and mitigations
|
|
90
|
+
- Validation checklist
|
|
91
|
+
|
|
92
|
+
**Plan Template**:
|
|
93
|
+
```markdown
|
|
94
|
+
# Plan: {Title}
|
|
95
|
+
|
|
96
|
+
## Summary
|
|
97
|
+
[TL;DR of approach]
|
|
98
|
+
|
|
99
|
+
## Research Findings
|
|
100
|
+
[Key patterns with confidence levels]
|
|
101
|
+
|
|
102
|
+
## Implementation Steps
|
|
103
|
+
1. [ ] Step 1: [Description] - `path/to/file`
|
|
104
|
+
2. [ ] Step 2: [Description] - `path/to/file`
|
|
105
|
+
|
|
106
|
+
## Risk Areas
|
|
107
|
+
- [Potential issues and mitigations]
|
|
108
|
+
|
|
109
|
+
## Validation
|
|
110
|
+
- [ ] Build passes
|
|
111
|
+
- [ ] Tests pass
|
|
112
|
+
- [ ] [Custom checks]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**CRITICAL**: Wait for explicit user approval before implementing
|
|
116
|
+
|
|
117
|
+
### Phase 3: Implement
|
|
118
|
+
Prerequisite: Approved plan from Phase 2
|
|
119
|
+
|
|
120
|
+
**Execution Loop**:
|
|
121
|
+
1. **THOUGHT**: Next plan step? Dependencies resolved?
|
|
122
|
+
2. **ACTION**: Read file → Write/Edit → Verify
|
|
123
|
+
3. **OBSERVATION**: Success? Errors? Side effects?
|
|
124
|
+
4. **LOOP**: Success → Next step; Fail → Fix
|
|
125
|
+
|
|
126
|
+
**Guidelines**:
|
|
127
|
+
- Follow plan sequentially
|
|
128
|
+
- Use explicit file paths
|
|
129
|
+
- Add TypeScript types
|
|
130
|
+
- Handle errors appropriately
|
|
131
|
+
- Minimal changes only
|
|
132
|
+
|
|
133
|
+
### Phase 4: Verify
|
|
134
|
+
**For Code Changes**:
|
|
135
|
+
- [ ] `npm run build` passes
|
|
136
|
+
- [ ] `npm run lint` clean
|
|
137
|
+
- [ ] `npm test` passes
|
|
138
|
+
- [ ] No TypeScript errors
|
|
139
|
+
|
|
140
|
+
**Loop**: Fail → Fix → Re-verify until all green
|
|
141
|
+
|
|
142
|
+
## Confidence Framework
|
|
143
|
+
|
|
144
|
+
| Finding | Confidence | Action |
|
|
145
|
+
|---------|------------|--------|
|
|
146
|
+
| Single authoritative source | HIGH | Use directly |
|
|
147
|
+
| Multiple consistent sources | HIGH | Use with references |
|
|
148
|
+
| Single non-authoritative source | MED | Seek second source |
|
|
149
|
+
| Conflicting sources | LOW | Ask user |
|
|
150
|
+
| No sources found | LOW | Try semantic variants OR ask user |
|
|
151
|
+
|
|
152
|
+
## When to Skip Planning
|
|
153
|
+
|
|
154
|
+
- Single-file, obvious fix
|
|
155
|
+
- User provides exact implementation
|
|
156
|
+
- Trivial changes (typo, comment, formatting)
|
|
157
|
+
|
|
158
|
+
## Error Recovery
|
|
159
|
+
|
|
160
|
+
| Situation | Action |
|
|
161
|
+
|-----------|--------|
|
|
162
|
+
| Research returns empty | Try semantic variants, broaden scope |
|
|
163
|
+
| Too many results | Add filters (path, extension, owner/repo) |
|
|
164
|
+
| Conflicting patterns | Find authoritative source OR ask user |
|
|
165
|
+
| Build fails | Check error, fix, re-verify |
|
|
166
|
+
| Blocked >2 attempts | Summarize → Ask user for guidance |
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: octocode-pr-review
|
|
3
|
+
description: Reviews pull requests for bugs, security vulnerabilities, architecture problems, performance issues, and code quality. Use when reviewing PRs, analyzing diffs, checking code changes, or performing code review.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Octocode PR Review
|
|
7
|
+
|
|
8
|
+
Defects-first PR review using Octocode MCP tools.
|
|
9
|
+
|
|
10
|
+
## Core Principle
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
FOCUS ON CHANGED CODE ONLY ('+' prefix lines)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
1. **Defects First**: Prioritize bugs, security, and breaking changes
|
|
17
|
+
2. **Unique Suggestions**: Check existing PR comments to avoid duplicates
|
|
18
|
+
3. **Cite Precisely**: Reference exact file paths and line numbers
|
|
19
|
+
|
|
20
|
+
## Flow
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
CONTEXT → USER CHECKPOINT → ANALYSIS → FINALIZE → REPORT
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Tools
|
|
27
|
+
|
|
28
|
+
| Tool | Purpose |
|
|
29
|
+
|------|---------|
|
|
30
|
+
| `githubSearchPullRequests` | Fetch PR metadata, diffs, comments |
|
|
31
|
+
| `githubGetFileContent` | Read full file context |
|
|
32
|
+
| `githubSearchCode` | Find patterns in repo |
|
|
33
|
+
| `localSearchCode` | Search local codebase |
|
|
34
|
+
| `localGetFileContent` | Read local files |
|
|
35
|
+
| `packageSearch` | Check dependency info |
|
|
36
|
+
|
|
37
|
+
## Domain Reviewers
|
|
38
|
+
|
|
39
|
+
### Bug Domain
|
|
40
|
+
**Detect**: Runtime errors, logic flaws, null access, race conditions, type violations
|
|
41
|
+
**Priority**:
|
|
42
|
+
- HIGH: Crashes, data corruption, security breach
|
|
43
|
+
- MED: Edge-case errors, uncertain race conditions
|
|
44
|
+
- LOW: Theoretical issues without evidence
|
|
45
|
+
|
|
46
|
+
### Architecture Domain
|
|
47
|
+
**Detect**: Pattern violations, tight coupling, circular dependencies, wrong module placement
|
|
48
|
+
**Priority**:
|
|
49
|
+
- HIGH: Breaking public API, circular dependencies causing bugs
|
|
50
|
+
- MED: Significant pattern deviations, tech debt increase
|
|
51
|
+
- LOW: Minor inconsistencies
|
|
52
|
+
|
|
53
|
+
### Performance Domain
|
|
54
|
+
**Detect**: O(n²) where O(n) possible, blocking operations, memory leaks, missing cache
|
|
55
|
+
**Priority**:
|
|
56
|
+
- HIGH: O(n²) on large datasets, memory leaks, blocking main thread
|
|
57
|
+
- MED: Moderate inefficiency in frequent paths
|
|
58
|
+
- LOW: Micro-optimizations
|
|
59
|
+
|
|
60
|
+
### Code Quality Domain
|
|
61
|
+
**Detect**: Naming violations, convention breaks, visible typos, magic numbers
|
|
62
|
+
**Priority**:
|
|
63
|
+
- HIGH: Typos in public API/endpoints
|
|
64
|
+
- MED: Internal naming issues, DRY violations
|
|
65
|
+
- LOW: Comment typos, minor readability
|
|
66
|
+
|
|
67
|
+
### Error Handling Domain
|
|
68
|
+
**Detect**: Swallowed exceptions, unclear error messages, missing debugging context
|
|
69
|
+
**Priority**:
|
|
70
|
+
- HIGH: Swallowed exceptions hiding critical failures
|
|
71
|
+
- MED: Unclear error messages, missing context in logs
|
|
72
|
+
- LOW: Verbose logging improvements
|
|
73
|
+
|
|
74
|
+
### Flow Impact Domain
|
|
75
|
+
**Detect**: How changed code alters existing execution flows
|
|
76
|
+
**Priority**:
|
|
77
|
+
- HIGH: Changes that break existing callers, alter critical paths
|
|
78
|
+
- MED: Flow changes requiring updates in dependent code
|
|
79
|
+
- LOW: Internal refactors with same external behavior
|
|
80
|
+
|
|
81
|
+
## Execution
|
|
82
|
+
|
|
83
|
+
### Phase 1: Context
|
|
84
|
+
1. Fetch PR metadata and diff: `githubSearchPullRequests(prNumber, type="metadata")`
|
|
85
|
+
2. Review existing PR comments first (avoid duplicates!)
|
|
86
|
+
3. Classify risk: High (Logic/Auth/API/Data) vs Low (Docs/CSS)
|
|
87
|
+
4. Flag large PRs (>500 lines) → suggest splitting
|
|
88
|
+
|
|
89
|
+
### Phase 2: User Checkpoint (MANDATORY)
|
|
90
|
+
Present to user:
|
|
91
|
+
- **PR Overview**: What this PR does (1-2 sentences)
|
|
92
|
+
- **Files Changed**: Count and key areas
|
|
93
|
+
- **Risk Assessment**: HIGH / MEDIUM / LOW
|
|
94
|
+
- **Key Areas**: List 3-5 main functional areas
|
|
95
|
+
|
|
96
|
+
Ask: "Which areas would you like me to focus on?"
|
|
97
|
+
|
|
98
|
+
### Phase 3: Analysis
|
|
99
|
+
For each changed file:
|
|
100
|
+
1. Read full context with `githubGetFileContent`
|
|
101
|
+
2. Apply domain reviewers (Bug, Security, Architecture, Performance, Quality)
|
|
102
|
+
3. Search for patterns in repo with `githubSearchCode`
|
|
103
|
+
4. Check local impact with `localSearchCode`
|
|
104
|
+
|
|
105
|
+
### Phase 4: Report
|
|
106
|
+
Generate structured review with:
|
|
107
|
+
- Summary of changes
|
|
108
|
+
- Findings by priority (HIGH → MED → LOW)
|
|
109
|
+
- Each finding: Domain, File, Line, Issue, Suggested Fix
|
|
110
|
+
|
|
111
|
+
## What to Skip
|
|
112
|
+
|
|
113
|
+
- Compiler/TypeScript/Linter errors (tooling catches these)
|
|
114
|
+
- Unchanged code (no '+' prefix)
|
|
115
|
+
- Test implementation details (unless broken)
|
|
116
|
+
- Generated/vendor files
|
|
117
|
+
- Style preferences (use linters)
|
|
118
|
+
- Issues already raised in existing PR comments
|
|
119
|
+
|
|
120
|
+
## Research Flows
|
|
121
|
+
|
|
122
|
+
| From | Need | Go To |
|
|
123
|
+
|------|------|-------|
|
|
124
|
+
| PR Diff | Full file context | `githubGetFileContent` |
|
|
125
|
+
| Changed function | Existing callers | `githubSearchCode` |
|
|
126
|
+
| Import statement | External definition | `packageSearch` → `githubViewRepoStructure` |
|
|
127
|
+
| Changed API | Local impact | `localSearchCode` |
|
|
128
|
+
|
|
129
|
+
## Confidence Levels
|
|
130
|
+
|
|
131
|
+
| Level | Certainty | Action |
|
|
132
|
+
|-------|-----------|--------|
|
|
133
|
+
| HIGH | Verified issue exists | Include |
|
|
134
|
+
| MED | Likely issue, missing context | Include with caveat |
|
|
135
|
+
| LOW | Uncertain | Investigate more OR skip |
|
|
136
|
+
|
|
137
|
+
Note: Confidence ≠ Severity. HIGH confidence typo = Low Priority. LOW confidence security flaw = flag but mark uncertain.
|