octocode-cli 1.0.0 → 1.1.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/README.md +93 -93
- package/out/octocode-cli.js +9818 -1626
- package/package.json +15 -5
- 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
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# Workflow Patterns
|
|
2
|
+
|
|
3
|
+
Common research flows for different investigation types.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Local-First Patterns
|
|
8
|
+
|
|
9
|
+
### 1. Explore-First (Unknown Codebase)
|
|
10
|
+
|
|
11
|
+
**Use when**: Entry points unclear, mixed tech, new repo.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
localViewStructure(depth=1) → drill dirs(depth=2) → localSearchCode → localGetFileContent
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Steps:**
|
|
18
|
+
1. **Map Root**: View top-level folders (`depth: 1`)
|
|
19
|
+
2. **Drill Down**: Pick one relevant folder (e.g., `src`)
|
|
20
|
+
3. **Search**: Look for architectural keywords (`App`, `Server`, `Main`)
|
|
21
|
+
4. **Read**: Get content of entry file
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
// 1. Map root
|
|
25
|
+
{ "path": "", "depth": 1 }
|
|
26
|
+
|
|
27
|
+
// 2. Drill into src
|
|
28
|
+
{ "path": "src", "depth": 2 }
|
|
29
|
+
|
|
30
|
+
// 3. Find entry points
|
|
31
|
+
{ "pattern": "createServer|createApp", "path": "src", "filesOnly": true }
|
|
32
|
+
|
|
33
|
+
// 4. Read implementation
|
|
34
|
+
{ "path": "src/index.ts", "matchString": "createApp" }
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Pitfall**: Diving deep without map → keep breadth-first.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### 2. Search-First (Know WHAT, not WHERE)
|
|
42
|
+
|
|
43
|
+
**Use when**: Feature name, error keyword, class/function known.
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
localSearchCode(filesOnly=true) → localGetFileContent(matchString)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Steps:**
|
|
50
|
+
1. **Discovery**: Find files containing the term (fast)
|
|
51
|
+
2. **Target**: Pick the most likely file
|
|
52
|
+
3. **Read**: Read specific function with context
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
// 1. Discovery
|
|
56
|
+
{ "pattern": "AuthService", "path": "src", "type": "ts", "filesOnly": true }
|
|
57
|
+
|
|
58
|
+
// 2. Read implementation
|
|
59
|
+
{ "path": "src/auth/AuthService.ts", "matchString": "class AuthService", "matchStringContextLines": 20 }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Pitfall**: Reading full files; prefer `matchString` + small context windows.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### 3. Trace-from-Match (Follow the Trail)
|
|
67
|
+
|
|
68
|
+
**Use when**: Found definition, need impact graph (imports/usages).
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
localSearchCode(symbol) → localGetFileContent → localSearchCode(usages) → iterate
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Steps:**
|
|
75
|
+
1. **Find Definition**: Search for the symbol
|
|
76
|
+
2. **Read Implementation**: Get context
|
|
77
|
+
3. **Trace Usages**: Search for imports/calls
|
|
78
|
+
4. **Iterate**: Follow 1-3 focused branches (cap depth)
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
// 1. Find definition
|
|
82
|
+
{ "pattern": "export.*useAuth", "path": "src", "filesOnly": true }
|
|
83
|
+
|
|
84
|
+
// 2. Read implementation
|
|
85
|
+
{ "path": "src/hooks/useAuth.ts", "matchString": "export function useAuth" }
|
|
86
|
+
|
|
87
|
+
// 3. Find usages
|
|
88
|
+
{ "pattern": "import.*useAuth|useAuth\\(", "path": "src", "filesOnly": true }
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Pitfall**: Unlimited fan-out; cap depth and batch size.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### 4. Metadata-Driven (Recent Changes)
|
|
96
|
+
|
|
97
|
+
**Use when**: Debugging recent breaks, finding config files, large files.
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
localFindFiles(modifiedWithin/size) → localGetFileContent
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Steps:**
|
|
104
|
+
1. **Filter**: Find files by metadata (time, size, type)
|
|
105
|
+
2. **Read**: Examine content of candidates
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
// Find recently modified TypeScript files
|
|
109
|
+
{ "path": "src", "name": "*.ts", "modifiedWithin": "7d" }
|
|
110
|
+
|
|
111
|
+
// Find large files that might need attention
|
|
112
|
+
{ "path": "", "sizeGreater": "100K", "type": "f" }
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### 5. node_modules Inspection
|
|
118
|
+
|
|
119
|
+
**Use when**: Debugging dependency behavior, understanding library internals.
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
localSearchCode(noIgnore=true) → localGetFileContent → compare with GitHub source
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Steps:**
|
|
126
|
+
1. **Search Inside**: Use `noIgnore: true` to search node_modules
|
|
127
|
+
2. **Read Local**: Get content from installed version
|
|
128
|
+
3. **Cross-Reference**: Compare with canonical GitHub source
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
// 1. Search inside dependency
|
|
132
|
+
{ "pattern": "createContext", "path": "node_modules/react", "noIgnore": true }
|
|
133
|
+
|
|
134
|
+
// 2. Read local implementation
|
|
135
|
+
{ "path": "node_modules/react/cjs/react.development.js", "matchString": "createContext" }
|
|
136
|
+
|
|
137
|
+
// 3. Compare with canonical (use GitHub tools)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## GitHub Patterns
|
|
143
|
+
|
|
144
|
+
### 6. Package Investigation
|
|
145
|
+
|
|
146
|
+
**Goal**: Understand how a package works internally.
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
packageSearch → githubViewRepoStructure → githubSearchCode → githubGetFileContent
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Steps:**
|
|
153
|
+
1. **Locate**: Find the correct repo URL
|
|
154
|
+
2. **Map**: View directory structure (don't map everything)
|
|
155
|
+
3. **Entry**: Find the main entry point (`package.json` main or index file)
|
|
156
|
+
4. **Read**: Get actual content of the entry file
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
// 1. Find repo
|
|
160
|
+
{ "name": "express", "ecosystem": "npm" }
|
|
161
|
+
|
|
162
|
+
// 2. Map structure
|
|
163
|
+
{ "owner": "expressjs", "repo": "express", "branch": "master", "depth": 1 }
|
|
164
|
+
|
|
165
|
+
// 3. Find entry
|
|
166
|
+
{ "keywordsToSearch": ["index.js"], "match": "path", "owner": "expressjs", "repo": "express" }
|
|
167
|
+
|
|
168
|
+
// 4. Read implementation
|
|
169
|
+
{ "owner": "expressjs", "repo": "express", "path": "lib/express.js", "matchString": "createApplication" }
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
### 7. Implementation Tracing (Remote)
|
|
175
|
+
|
|
176
|
+
**Goal**: Understand how a feature is implemented in an external library.
|
|
177
|
+
|
|
178
|
+
**Pattern**: Trace from *User Surface* → *Internal Logic* → *Data Layer*.
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
githubSearchCode(surface) → githubGetFileContent → trace imports → repeat
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Steps:**
|
|
185
|
+
1. **Surface**: Find the public API/Component (e.g., `useState`)
|
|
186
|
+
2. **Definition**: Read the function definition
|
|
187
|
+
3. **Dependency**: Identify one key internal dependency
|
|
188
|
+
4. **Trace**: Search for that dependency's definition
|
|
189
|
+
5. **Repeat**: Continue until you hit the bottom
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
// 1. Find feature surface
|
|
193
|
+
{ "keywordsToSearch": ["useState"], "match": "file", "path": "packages/react", "owner": "facebook", "repo": "react" }
|
|
194
|
+
|
|
195
|
+
// 2. Read definition (The Gate: Read before assuming)
|
|
196
|
+
{ "owner": "facebook", "repo": "react", "path": "packages/react/src/ReactHooks.js", "matchString": "export function useState" }
|
|
197
|
+
|
|
198
|
+
// 3. Trace dependency
|
|
199
|
+
{ "keywordsToSearch": ["resolveDispatcher"], "match": "file", "owner": "facebook", "repo": "react" }
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
### 8. Bug Investigation
|
|
205
|
+
|
|
206
|
+
**Goal**: Find root cause of a bug.
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
githubSearchCode(error) → githubGetFileContent → githubSearchPullRequests
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Steps:**
|
|
213
|
+
1. **Locate Error**: Find where the error string/code is defined
|
|
214
|
+
2. **Read Context**: Read the condition causing the error
|
|
215
|
+
3. **Blame/History**: Who changed this last and why?
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
// 1. Find error source
|
|
219
|
+
{ "keywordsToSearch": ["ENOENT"], "match": "file", "owner": "nodejs", "repo": "node" }
|
|
220
|
+
|
|
221
|
+
// 2. Read context
|
|
222
|
+
{ "owner": "nodejs", "repo": "node", "path": "lib/fs.js", "matchString": "ENOENT" }
|
|
223
|
+
|
|
224
|
+
// 3. Check history
|
|
225
|
+
{ "query": "file reader ENOENT", "owner": "nodejs", "repo": "node", "merged": true, "type": "metadata" }
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Cross-Domain Patterns
|
|
231
|
+
|
|
232
|
+
### 9. Local → GitHub (Upstream Research)
|
|
233
|
+
|
|
234
|
+
**Use when**: Local code uses a dependency, need canonical source.
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
localSearchCode → packageSearch → githubViewRepoStructure → githubGetFileContent
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
```json
|
|
241
|
+
// 1. Find import in local code
|
|
242
|
+
{ "pattern": "import.*from 'axios'", "path": "src", "filesOnly": true }
|
|
243
|
+
|
|
244
|
+
// 2. Find package repo
|
|
245
|
+
{ "name": "axios", "ecosystem": "npm" }
|
|
246
|
+
|
|
247
|
+
// 3. Explore upstream
|
|
248
|
+
{ "owner": "axios", "repo": "axios", "branch": "v1.x", "depth": 1 }
|
|
249
|
+
|
|
250
|
+
// 4. Read canonical implementation
|
|
251
|
+
{ "owner": "axios", "repo": "axios", "path": "lib/core/Axios.js", "matchString": "class Axios" }
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### 10. GitHub → Local (Impact Analysis)
|
|
255
|
+
|
|
256
|
+
**Use when**: Found upstream change, check local impact.
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
githubSearchPullRequests → extract changed patterns → localSearchCode
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
```json
|
|
263
|
+
// 1. Find breaking change PR
|
|
264
|
+
{ "query": "breaking change v2", "owner": "some-lib", "repo": "lib", "merged": true }
|
|
265
|
+
|
|
266
|
+
// 2. Get changed API (from PR)
|
|
267
|
+
// → Extracted: "oldMethod renamed to newMethod"
|
|
268
|
+
|
|
269
|
+
// 3. Check local usage
|
|
270
|
+
{ "pattern": "oldMethod", "path": "src", "filesOnly": true }
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## The Verification Gate
|
|
276
|
+
|
|
277
|
+
**BEFORE claiming a finding, pass this gate:**
|
|
278
|
+
|
|
279
|
+
1. **IDENTIFY**: What exact lines of code prove this?
|
|
280
|
+
2. **FETCH**: Did you read the *actual file content*? (Search snippets don't count)
|
|
281
|
+
3. **VERIFY**: Does the logic actually do what you think?
|
|
282
|
+
4. **CHECK DATES**: Is this code from 5 years ago?
|
|
283
|
+
5. **ONLY THEN**: Output the finding.
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Batch Queries
|
|
288
|
+
|
|
289
|
+
Parallelize independent searches (max 3 GitHub, max 5 local):
|
|
290
|
+
|
|
291
|
+
```json
|
|
292
|
+
{
|
|
293
|
+
"queries": [
|
|
294
|
+
{ "pattern": "AuthService", "path": "src", "filesOnly": true },
|
|
295
|
+
{ "pattern": "authMiddleware", "path": "src", "filesOnly": true },
|
|
296
|
+
{ "pattern": "AuthUser", "path": "src", "filesOnly": true }
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Anti-Patterns
|
|
304
|
+
|
|
305
|
+
| Bad | Good |
|
|
306
|
+
|-----|------|
|
|
307
|
+
| **Citing Search Results** | **Citing File Content** (Read the file!) |
|
|
308
|
+
| **"I assume..."** | **"The code shows..."** |
|
|
309
|
+
| **"Should work like..."** | **"Logic implements..."** |
|
|
310
|
+
| **Broad Search (`auth`)** | **Targeted Search (`class AuthService`)** |
|
|
311
|
+
| **Ignoring Dates** | **Checking `lastModified`** |
|
|
312
|
+
| **Shell commands for search** | **Local tools with pagination** |
|
|
313
|
+
| **Full file dumps** | **matchString + context** |
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Checklist
|
|
318
|
+
|
|
319
|
+
- [ ] **Goal defined?** (Atomic question)
|
|
320
|
+
- [ ] **Local-first?** (Checked workspace before GitHub)
|
|
321
|
+
- [ ] **Code evidence found?** (Line numbers/paths)
|
|
322
|
+
- [ ] **The Gate passed?** (Read full content)
|
|
323
|
+
- [ ] **Cross-referenced?** (Imports/Usage)
|
|
324
|
+
- [ ] **Updated dates checked?**
|
|
325
|
+
- [ ] **Gaps documented?**
|