octocode-cli 1.1.1 → 1.2.0
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/out/octocode-cli.js +7906 -8034
- package/package.json +36 -39
- package/skills/README.md +70 -31
- package/skills/octocode-generate/SKILL.md +15 -9
- package/skills/octocode-implement/SKILL.md +288 -0
- package/skills/octocode-implement/references/execution-phases.md +317 -0
- package/skills/octocode-implement/references/tool-reference.md +403 -0
- package/skills/octocode-implement/references/workflow-patterns.md +385 -0
- package/skills/octocode-local-search/SKILL.md +418 -0
- package/skills/octocode-local-search/references/tool-reference.md +328 -0
- package/skills/octocode-local-search/references/workflow-patterns.md +383 -0
- package/skills/octocode-pr-review/SKILL.md +321 -109
- package/skills/octocode-pr-review/references/domain-reviewers.md +105 -0
- package/skills/octocode-pr-review/references/execution-lifecycle.md +116 -0
- package/skills/octocode-pr-review/references/research-flows.md +75 -0
- package/skills/octocode-research/SKILL.md +291 -80
- package/skills/octocode-roast/SKILL.md +369 -0
- package/skills/octocode-roast/references/sin-registry.md +239 -0
- package/skills/octocode-plan/SKILL.md +0 -166
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
# Workflow Patterns - Implementation Agent
|
|
2
|
+
|
|
3
|
+
Common implementation flows for different task types.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Pre-Implementation Patterns
|
|
8
|
+
|
|
9
|
+
### 1. Codebase Orientation (First Time)
|
|
10
|
+
|
|
11
|
+
**Use when**: New to the repository, need mental model.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
localViewStructure(root, depth=1) → identify src/tests/config → drill into src (depth=2)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Steps:**
|
|
18
|
+
1. **Map Root**: See top-level structure
|
|
19
|
+
2. **Identify Key Dirs**: src, tests, config, types
|
|
20
|
+
3. **Drill Into Source**: Understand feature organization
|
|
21
|
+
4. **Find Entry Points**: main.ts, index.ts, app.ts
|
|
22
|
+
5. **Note Test Structure**: How are tests organized?
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
// 1. Map root
|
|
26
|
+
{ "path": "", "depth": 1 }
|
|
27
|
+
|
|
28
|
+
// 2. Drill into source
|
|
29
|
+
{ "path": "src", "depth": 2 }
|
|
30
|
+
|
|
31
|
+
// 3. Find entry points
|
|
32
|
+
{ "pattern": "createApp|bootstrap|main", "path": "src", "filesOnly": true }
|
|
33
|
+
|
|
34
|
+
// 4. Understand test structure
|
|
35
|
+
{ "path": "tests", "depth": 1 }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Output**: Clear mental model of where things live.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
### 2. Feature Area Discovery
|
|
43
|
+
|
|
44
|
+
**Use when**: Know what feature to implement, need to find where.
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
localSearchCode(featureName, filesOnly) → localGetFileContent → trace dependencies
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Steps:**
|
|
51
|
+
1. **Search for Similar**: Find existing similar features
|
|
52
|
+
2. **Read Implementation**: Understand the pattern
|
|
53
|
+
3. **Trace Dependencies**: What does it import/use?
|
|
54
|
+
4. **Find Tests**: How is it tested?
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
// 1. Find similar feature
|
|
58
|
+
{ "pattern": "export.*UserService|class.*UserService", "path": "src", "filesOnly": true }
|
|
59
|
+
|
|
60
|
+
// 2. Read implementation
|
|
61
|
+
{ "path": "src/services/UserService.ts", "matchString": "export class UserService", "matchStringContextLines": 50 }
|
|
62
|
+
|
|
63
|
+
// 3. Find tests
|
|
64
|
+
{ "pattern": "describe.*UserService", "path": "tests", "filesOnly": true }
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### 3. Impact Analysis (Before Modification)
|
|
70
|
+
|
|
71
|
+
**Use when**: About to modify existing code, need to understand impact.
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
lspFindReferences → lspCallHierarchy(incoming) → map affected files
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Steps:**
|
|
78
|
+
1. **Find All Usages**: Who uses this function/class?
|
|
79
|
+
2. **Trace Callers**: What's the call chain?
|
|
80
|
+
3. **Map Affected Files**: Create change impact list
|
|
81
|
+
4. **Prioritize**: Which callers need updates?
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
// 1. Find all usages
|
|
85
|
+
{ "uri": "src/core/processor.ts", "symbolName": "processData", "lineHint": 45, "includeDeclaration": false }
|
|
86
|
+
|
|
87
|
+
// 2. Trace call hierarchy
|
|
88
|
+
{ "uri": "src/core/processor.ts", "symbolName": "processData", "lineHint": 45, "direction": "incoming", "depth": 2 }
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Output**: List of files that need attention.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Implementation Patterns
|
|
96
|
+
|
|
97
|
+
### 4. Feature Addition (Copy Pattern)
|
|
98
|
+
|
|
99
|
+
**Use when**: Adding new feature similar to existing one.
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
Find Similar → Read Thoroughly → Copy Structure → Adapt → Test
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Steps:**
|
|
106
|
+
1. **Find Exemplar**: Locate similar existing feature
|
|
107
|
+
2. **Deep Read**: Read entire implementation + tests
|
|
108
|
+
3. **Copy Structure**: Create files mirroring the pattern
|
|
109
|
+
4. **Adapt Content**: Modify for new requirements
|
|
110
|
+
5. **Add Tests**: Follow same test patterns
|
|
111
|
+
6. **Validate**: Run test suite
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
// 1. Find similar feature
|
|
115
|
+
{ "pattern": "export class ProductService", "path": "src/services", "filesOnly": true }
|
|
116
|
+
|
|
117
|
+
// 2. Read implementation fully
|
|
118
|
+
{ "path": "src/services/ProductService.ts", "fullContent": true } // if small
|
|
119
|
+
// OR
|
|
120
|
+
{ "path": "src/services/ProductService.ts", "matchString": "export class", "matchStringContextLines": 100 }
|
|
121
|
+
|
|
122
|
+
// 3. Read its tests
|
|
123
|
+
{ "path": "tests/services/ProductService.test.ts", "fullContent": true }
|
|
124
|
+
|
|
125
|
+
// 4. Create new files following same patterns...
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
### 5. API Addition
|
|
131
|
+
|
|
132
|
+
**Use when**: Adding new endpoint/method to existing API.
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
Find API Layer → Read Existing Endpoints → Copy Pattern → Add Types → Test
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Steps:**
|
|
139
|
+
1. **Locate API Layer**: Find route/controller files
|
|
140
|
+
2. **Read Existing**: Understand endpoint patterns
|
|
141
|
+
3. **Find Types**: Locate request/response types
|
|
142
|
+
4. **Find Validation**: How is input validated?
|
|
143
|
+
5. **Implement**: Follow exact pattern
|
|
144
|
+
6. **Add Tests**: Follow API test patterns
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
// 1. Find API routes
|
|
148
|
+
{ "pattern": "@(Controller|Router|Get|Post)", "path": "src", "type": "ts", "filesOnly": true }
|
|
149
|
+
|
|
150
|
+
// 2. Read existing endpoint
|
|
151
|
+
{ "path": "src/api/users.ts", "matchString": "@Get", "matchStringContextLines": 30 }
|
|
152
|
+
|
|
153
|
+
// 3. Find types
|
|
154
|
+
{ "pattern": "interface.*Request|interface.*Response", "path": "src/types", "filesOnly": true }
|
|
155
|
+
|
|
156
|
+
// 4. Find validation
|
|
157
|
+
{ "pattern": "validate|schema|zod|yup", "path": "src/api", "filesOnly": true }
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### 6. Bug Fix
|
|
163
|
+
|
|
164
|
+
**Use when**: Fixing specific broken behavior.
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
Understand Bug → Locate Code → Trace Flow → Find Root Cause → Minimal Fix → Regression Test
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Steps:**
|
|
171
|
+
1. **Understand**: What's expected vs actual?
|
|
172
|
+
2. **Locate**: Find the relevant code area
|
|
173
|
+
3. **Trace Flow**: How does data flow through?
|
|
174
|
+
4. **Root Cause**: Why does it fail?
|
|
175
|
+
5. **Minimal Fix**: Change as little as possible
|
|
176
|
+
6. **Test**: Add regression test
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
// 1. Find relevant area
|
|
180
|
+
{ "pattern": "handleUserLogin|processLogin", "path": "src", "filesOnly": true }
|
|
181
|
+
|
|
182
|
+
// 2. Read implementation
|
|
183
|
+
{ "path": "src/auth/login.ts", "matchString": "handleUserLogin", "matchStringContextLines": 40 }
|
|
184
|
+
|
|
185
|
+
// 3. Trace the flow
|
|
186
|
+
{ "uri": "src/auth/login.ts", "symbolName": "handleUserLogin", "lineHint": 25, "direction": "outgoing" }
|
|
187
|
+
|
|
188
|
+
// 4. Find where validation happens
|
|
189
|
+
{ "pattern": "validate.*credentials|checkPassword", "path": "src/auth" }
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
### 7. Refactoring (Rename/Move)
|
|
195
|
+
|
|
196
|
+
**Use when**: Restructuring without changing behavior.
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
Find ALL References → Plan Changes → Execute Incrementally → Keep Tests Green
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**CRITICAL**: Tests must pass after EVERY change.
|
|
203
|
+
|
|
204
|
+
**Steps:**
|
|
205
|
+
1. **Find All Usages**: Complete impact analysis
|
|
206
|
+
2. **Plan Order**: Determine safe change order
|
|
207
|
+
3. **Execute One**: Make single atomic change
|
|
208
|
+
4. **Run Tests**: Must pass
|
|
209
|
+
5. **Repeat**: Continue until complete
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
// 1. Find ALL references
|
|
213
|
+
{ "uri": "src/utils/helper.ts", "symbolName": "oldFunctionName", "lineHint": 10, "includeDeclaration": true }
|
|
214
|
+
|
|
215
|
+
// 2. Use LSP across all found files
|
|
216
|
+
// ... then make changes file by file, testing after each
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
### 8. Interface Change
|
|
222
|
+
|
|
223
|
+
**Use when**: Modifying types/interfaces used by multiple modules.
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
Find All Usages → Assess Impact → Update Types → Update Consumers → Update Implementation
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Steps:**
|
|
230
|
+
1. **Find All Usages**: Where is this type used?
|
|
231
|
+
2. **Categorize**: Type assertions, function params, returns
|
|
232
|
+
3. **Plan Migration**: Adding required field? Make optional first
|
|
233
|
+
4. **Update Types**: Change the interface
|
|
234
|
+
5. **Update Consumers**: Fix each usage
|
|
235
|
+
6. **Validate**: Full test suite
|
|
236
|
+
|
|
237
|
+
```json
|
|
238
|
+
// 1. Find type usages
|
|
239
|
+
{ "uri": "src/types/user.ts", "symbolName": "UserDTO", "lineHint": 5, "includeDeclaration": true, "referencesPerPage": 50 }
|
|
240
|
+
|
|
241
|
+
// 2. Categorize by reviewing each reference
|
|
242
|
+
// 3. Make changes incrementally
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
### 9. Adding Tests
|
|
248
|
+
|
|
249
|
+
**Use when**: Need to add tests for existing code.
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
Find Code → Understand Behavior → Find Test Patterns → Write Tests
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Steps:**
|
|
256
|
+
1. **Read Code**: Understand what to test
|
|
257
|
+
2. **Find Test Patterns**: How are similar things tested?
|
|
258
|
+
3. **Find Mocking Patterns**: How are dependencies mocked?
|
|
259
|
+
4. **Write Tests**: Follow existing patterns
|
|
260
|
+
5. **Run**: Ensure they pass
|
|
261
|
+
|
|
262
|
+
```json
|
|
263
|
+
// 1. Read the code to test
|
|
264
|
+
{ "path": "src/services/OrderService.ts", "matchString": "export class OrderService", "matchStringContextLines": 100 }
|
|
265
|
+
|
|
266
|
+
// 2. Find similar test patterns
|
|
267
|
+
{ "pattern": "describe.*Service", "path": "tests", "filesOnly": true }
|
|
268
|
+
|
|
269
|
+
// 3. Read a similar test file
|
|
270
|
+
{ "path": "tests/services/UserService.test.ts", "fullContent": true }
|
|
271
|
+
|
|
272
|
+
// 4. Find mocking patterns
|
|
273
|
+
{ "pattern": "mock|jest.fn|vi.fn|beforeEach", "path": "tests/services/UserService.test.ts" }
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Advanced Patterns
|
|
279
|
+
|
|
280
|
+
### 10. Cross-Module Feature
|
|
281
|
+
|
|
282
|
+
**Use when**: Feature spans multiple modules/packages.
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
Map All Affected Modules → Research Each → Plan Integration Order → Implement Bottom-Up
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Steps:**
|
|
289
|
+
1. **Map Scope**: Which modules are affected?
|
|
290
|
+
2. **Research Each**: Understand each module's patterns
|
|
291
|
+
3. **Find Integration Points**: How do they communicate?
|
|
292
|
+
4. **Plan Order**: Bottom-up (dependencies first)
|
|
293
|
+
5. **Implement**: One module at a time, test between
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
### 11. External Library Integration
|
|
298
|
+
|
|
299
|
+
**Use when**: Integrating a new third-party library.
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
packageSearch → Read Upstream Docs → Find Local Examples → Implement Wrapper → Test
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Steps:**
|
|
306
|
+
1. **Find Library**: `packageSearch` for repo location
|
|
307
|
+
2. **Read Docs**: Understand API from upstream
|
|
308
|
+
3. **Find Local Examples**: Are similar libs used locally?
|
|
309
|
+
4. **Plan Wrapper**: How to isolate the dependency
|
|
310
|
+
5. **Implement**: Follow local patterns for external deps
|
|
311
|
+
6. **Test**: Include integration tests
|
|
312
|
+
|
|
313
|
+
```json
|
|
314
|
+
// 1. Find library repo
|
|
315
|
+
{ "name": "axios", "ecosystem": "npm" }
|
|
316
|
+
|
|
317
|
+
// 2. Search for existing usage patterns locally
|
|
318
|
+
{ "pattern": "import.*from 'axios'|require.*axios", "path": "src", "filesOnly": true }
|
|
319
|
+
|
|
320
|
+
// 3. Read existing wrapper if any
|
|
321
|
+
{ "path": "src/utils/http.ts", "matchString": "axios", "matchStringContextLines": 30 }
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
### 12. Performance Optimization
|
|
327
|
+
|
|
328
|
+
**Use when**: Need to improve performance of existing code.
|
|
329
|
+
|
|
330
|
+
```
|
|
331
|
+
Profile/Identify → Understand Current Flow → Find Optimization Patterns → Apply → Measure
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
**Steps:**
|
|
335
|
+
1. **Identify**: What's slow? (from spec)
|
|
336
|
+
2. **Trace Flow**: Understand current implementation
|
|
337
|
+
3. **Find Patterns**: How are similar things optimized in codebase?
|
|
338
|
+
4. **Research**: Check for caching, batching, async patterns
|
|
339
|
+
5. **Apply**: Make targeted changes
|
|
340
|
+
6. **Validate**: Ensure correctness, measure improvement
|
|
341
|
+
|
|
342
|
+
```json
|
|
343
|
+
// 1. Read slow code
|
|
344
|
+
{ "path": "src/data/processor.ts", "matchString": "processLargeDataset", "matchStringContextLines": 50 }
|
|
345
|
+
|
|
346
|
+
// 2. Trace its calls
|
|
347
|
+
{ "uri": "src/data/processor.ts", "symbolName": "processLargeDataset", "lineHint": 30, "direction": "outgoing", "depth": 2 }
|
|
348
|
+
|
|
349
|
+
// 3. Find optimization patterns in codebase
|
|
350
|
+
{ "pattern": "cache|memo|batch|Promise\\.all|concurrent", "path": "src", "filesOnly": true }
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## Anti-Patterns to Avoid
|
|
356
|
+
|
|
357
|
+
| Bad | Good |
|
|
358
|
+
|-----|------|
|
|
359
|
+
| **Implementing without reading similar code** | **Find exemplar first, then copy pattern** |
|
|
360
|
+
| **Modifying without impact analysis** | **lspFindReferences before any change** |
|
|
361
|
+
| **Writing new patterns** | **Follow existing codebase patterns** |
|
|
362
|
+
| **Big bang changes** | **Small incremental changes with tests** |
|
|
363
|
+
| **Skipping tests** | **Tests for every change** |
|
|
364
|
+
| **Guessing file locations** | **Search first, then read** |
|
|
365
|
+
| **Reading entire files** | **Use matchString for targeted reads** |
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## Checklist Before Starting Implementation
|
|
370
|
+
|
|
371
|
+
- [ ] **Spec understood?** (Requirements clear)
|
|
372
|
+
- [ ] **Codebase mapped?** (Know where things are)
|
|
373
|
+
- [ ] **Similar feature found?** (Pattern to follow)
|
|
374
|
+
- [ ] **Impact analyzed?** (Know what's affected)
|
|
375
|
+
- [ ] **Test patterns found?** (Know how to test)
|
|
376
|
+
- [ ] **User checkpoint?** (Approach confirmed)
|
|
377
|
+
|
|
378
|
+
## Checklist Before Declaring Done
|
|
379
|
+
|
|
380
|
+
- [ ] **All tasks complete?** (Per TodoWrite)
|
|
381
|
+
- [ ] **Patterns followed?** (No new patterns)
|
|
382
|
+
- [ ] **Tests added?** (Coverage maintained)
|
|
383
|
+
- [ ] **Validation passed?** (Compile, lint, test)
|
|
384
|
+
- [ ] **No scope creep?** (Only what spec asked)
|
|
385
|
+
|