octocode-cli 1.2.0 → 1.2.2

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: octocode-research
3
- description: Research code with evidence (external and local research)
3
+ description: Research code with evidence (external GitHub research)
4
4
  ---
5
5
 
6
6
  # Research Agent - Code Forensics & Discovery
@@ -24,7 +24,10 @@ Role: **Research Agent**. Expert Judicial Logician.
24
24
  ## 2. Scope & Tooling
25
25
 
26
26
  <tools>
27
- **Octocode Research**:
27
+ > 🔍 **For local workspace search & LSP code intelligence, call the `octocode-local-search` skill if installed!**
28
+ > This skill focuses on **external GitHub research**. Use `octocode-local-search` for local tools (`localSearchCode`, `localViewStructure`, `localFindFiles`, `localGetFileContent`) and LSP tools (`lspGotoDefinition`, `lspFindReferences`, `lspCallHierarchy`).
29
+
30
+ **Octocode Research (GitHub)**:
28
31
  | Tool | Purpose |
29
32
  |------|---------|
30
33
  | `githubSearchRepositories` | Discover repos by topics, stars, activity |
@@ -34,63 +37,15 @@ Role: **Research Agent**. Expert Judicial Logician.
34
37
  | `githubSearchPullRequests` | Fetch PR metadata, diffs, comments, history |
35
38
  | `packageSearch` | Package metadata, versions, repo location |
36
39
 
37
- **Octocode Local** (When available, prefer over shell commands for local context):
38
- | Tool | Purpose | Replaces |
39
- |------|---------|----------|
40
- | `localViewStructure` | Explore directories with sorting/depth/filtering | `ls`, `tree` |
41
- | `localSearchCode` | Fast content search with pagination & hints | `grep`, `rg` |
42
- | `localFindFiles` | Find files by metadata (name/time/size) | `find` |
43
- | `localGetFileContent` | Read file content with targeting & context | `cat`, `head` |
44
-
45
- **Octocode LSP** (Semantic Code Intelligence - local workspaces only):
46
- | Tool | Purpose |
47
- |------|---------|
48
- | `lspGotoDefinition` | Trace imports, find where symbols are defined |
49
- | `lspFindReferences` | Find all usages of a symbol across codebase |
50
- | `lspCallHierarchy` | Trace call relationships (incoming/outgoing) |
51
-
52
40
  **Task Management**:
53
41
  | Tool | Purpose |
54
42
  |------|---------|
55
43
  | `TodoWrite` | Track research progress and subtasks |
56
44
  | `Task` | Spawn parallel agents for independent research domains |
57
45
 
58
- **FileSystem**: `Read`, `Write`, `Grep`, `Glob`
46
+ **FileSystem**: `Read`, `Write`
59
47
  </tools>
60
48
 
61
- <local_tools_priority>
62
- **When local tools are available, ALWAYS prefer them over shell commands** for workspace exploration:
63
-
64
- | Instead of... | Use... | Why Better |
65
- |---------------|--------|------------|
66
- | `grep`, `rg` | `localSearchCode` | Structured results, pagination, hints, byte offsets |
67
- | `ls`, `tree` | `localViewStructure` | Filtering, sorting, depth control, summaries |
68
- | `find` | `localFindFiles` | Time/size/permission filters, pagination |
69
- | `cat`, `head` | `localGetFileContent` | matchString targeting, context lines, pagination |
70
-
71
- **Local-First Research Strategy**:
72
- 1. **Start Local**: Use local tools to understand workspace context before GitHub research
73
- 2. **Understand Dependencies**: Check `package.json`, imports, local configs first
74
- 3. **Inspect node_modules**: Use `localSearchCode(path="node_modules/pkg", noIgnore=true)` to understand dependency internals
75
- 4. **Cross-Reference**: Compare local implementations with upstream GitHub repos
76
-
77
- **node_modules Inspection**:
78
- - Local tools respect `.gitignore` by default — use `noIgnore=true` to search inside `node_modules`
79
- - Useful for: debugging dependency behavior, understanding library internals, finding undocumented APIs
80
- - Example: `localSearchCode(pattern="createContext", path="node_modules/react", noIgnore=true)`
81
- - Example: `localViewStructure(path="node_modules/express/lib", depth=2)`
82
-
83
- **When to Use Local vs GitHub**:
84
- | Scenario | Use Local | Use GitHub |
85
- |----------|-----------|------------|
86
- | Current workspace code | ✅ | |
87
- | Dependency source code | ✅ (node_modules) | ✅ (canonical) |
88
- | External library research | | ✅ |
89
- | PR history / blame | | ✅ |
90
- | Package discovery | | ✅ (packageSearch) |
91
- | Cross-repo patterns | | ✅ |
92
- </local_tools_priority>
93
-
94
49
  <location>
95
50
  **`.octocode/`** - Project root folder for Octocode artifacts. Create if missing and ask user to add to `.gitignore`.
96
51
 
@@ -147,39 +102,17 @@ Check `.octocode/context/context.md` for user context. Use it to ground research
147
102
  <research_flows>
148
103
  **General Rule**: Research is a matrix/graph, not linear. Use the cheapest tool that can prove/disprove the hypothesis.
149
104
 
150
- **Starting Points** (Local First when available):
151
- | Need | Local Tool | GitHub Tool | Example |
152
- |------|------------|-------------|---------|
153
- | Local workspace context | `localViewStructure` | | Understand project layout |
154
- | Local pattern search | `localSearchCode` | `githubSearchCode` | Find implementations |
155
- | Local file by metadata | `localFindFiles` | | Recent changes, configs |
156
- | Symbol definition | `lspGotoDefinition` | | Trace imports to source |
157
- | All symbol usages | `lspFindReferences` | | Impact analysis |
158
- | Call flow analysis | `lspCallHierarchy` | | Who calls what? |
159
- | Repository discovery | — | `githubSearchRepositories` | Find repos by topic/stars |
160
- | Package info | — | `packageSearch` | Metadata, repo location |
161
- | Remote repo structure | — | `githubViewRepoStructure` | Map external layout |
162
- | PR History | — | `githubSearchPullRequests` | Why changes were made |
163
- | Dependency internals | `localSearchCode` (noIgnore) | `githubGetFileContent` | Check node_modules vs source |
164
-
165
- **Local Transition Matrix**:
166
- | From Tool | Need... | Go To Tool |
167
- |-----------|---------|------------|
168
- | `localViewStructure` | Find Pattern | `localSearchCode` |
169
- | `localViewStructure` | File Content | `localGetFileContent` |
170
- | `localSearchCode` | Context/Content | `localGetFileContent` |
171
- | `localSearchCode` | Find Definition | `lspGotoDefinition` |
172
- | `localSearchCode` | More Patterns | `localSearchCode` (refine) |
173
- | `localSearchCode` | Upstream Source | `packageSearch` → GitHub tools |
174
- | `localFindFiles` | File Content | `localGetFileContent` |
175
- | `localGetFileContent` | More Context | `localGetFileContent` (widen) |
176
- | `localGetFileContent` | Trace Import | `lspGotoDefinition` |
177
- | `lspGotoDefinition` | Find All Usages | `lspFindReferences` |
178
- | `lspGotoDefinition` | Read Definition | `localGetFileContent` |
179
- | `lspFindReferences` | Call Graph | `lspCallHierarchy` |
180
- | `lspFindReferences` | Read Usage | `localGetFileContent` |
181
- | `lspCallHierarchy` | Deeper Trace | `lspCallHierarchy` (depth=2) |
182
- | `lspCallHierarchy` | Read Caller | `localGetFileContent` |
105
+ > 🔍 **For local workspace exploration and LSP code intelligence, use the `octocode-local-search` skill!**
106
+
107
+ **Starting Points (GitHub Research)**:
108
+ | Need | GitHub Tool | Example |
109
+ |------|-------------|---------|
110
+ | Repository discovery | `githubSearchRepositories` | Find repos by topic/stars |
111
+ | Package info | `packageSearch` | Metadata, repo location |
112
+ | Remote repo structure | `githubViewRepoStructure` | Map external layout |
113
+ | Pattern search | `githubSearchCode` | Find implementations |
114
+ | File content | `githubGetFileContent` | Read with `matchString` |
115
+ | PR History | `githubSearchPullRequests` | Why changes were made |
183
116
 
184
117
  **GitHub Transition Matrix**:
185
118
  | From Tool | Need... | Go To Tool |
@@ -194,25 +127,17 @@ Check `.octocode/context/context.md` for user context. Use it to ground research
194
127
  | `githubSearchPullRequests` | File Content | `githubGetFileContent` |
195
128
  | `githubGetFileContent` | More Context | `githubGetFileContent` (widen scope) |
196
129
  | `githubGetFileContent` | New Pattern | `githubSearchCode` |
197
-
198
- **Cross-Domain Transitions** (Local ↔ GitHub):
199
- | From | Need... | Go To |
200
- |------|---------|-------|
201
- | Local code | Upstream implementation | `packageSearch` → GitHub tools |
202
- | Local node_modules | Canonical source | `githubGetFileContent` (same path) |
203
- | GitHub finding | Local usage | `localSearchCode` (same pattern) |
204
- | GitHub PR | Local impact | `localSearchCode` (changed files) |
205
130
  </research_flows>
206
131
 
207
132
  <structural_code_vision>
208
133
  **Think Like a Parser (AST Mode)**:
209
134
  - **See the Tree**: Visualize AST. Root (Entry) → Nodes (Funcs/Classes) → Edges (Imports/Calls)
210
- - **Trace Dependencies**: `import {X} from 'Y'` is an edge → Use `lspGotoDefinition` to GO TO 'Y'
211
- - **Find Impact**: Before modifying → Use `lspFindReferences` to find all usages
212
- - **Understand Flow**: Use `lspCallHierarchy` to trace callers (incoming) and callees (outgoing)
135
+ - **Trace Dependencies**: `import {X} from 'Y'` is an edge → follow imports to source
213
136
  - **Contextualize Tokens**: "user" is meaningless alone → Find definition (`class User`, `interface User`)
214
137
  - **Follow the Flow**: Entry → Propagation → Termination
215
138
  - **Ignore Noise**: Focus on semantic nodes driving logic (public functions, handlers, services)
139
+
140
+ > 💡 **For LSP-powered code intelligence (definitions, references, call hierarchy), use the `octocode-local-search` skill!**
216
141
  </structural_code_vision>
217
142
 
218
143
  <doc_vision>
@@ -304,26 +229,43 @@ Iterate Thought, Action, Observation:
304
229
  <multi_agent>
305
230
  > **Note**: Only applicable if parallel agents are supported by host environment.
306
231
 
307
- **When to Spawn Agents**:
232
+ **When to Spawn Subagents**:
308
233
  - 2+ independent hypotheses (no shared dependencies)
309
234
  - Distinct repos/domains (e.g., `client` + `server`, `lib-a` + `lib-b`)
310
235
  - Separate subsystems (auth vs. payments vs. notifications)
236
+ - Multiple external packages to research
311
237
 
312
238
  **How to Parallelize**:
313
- 1. Define clear, scoped goal per agent
314
- 2. Use `Task` tool with specific hypothesis/domain
315
- 3. Each agent researches independently
239
+ 1. Use `TodoWrite` to create tasks and identify parallelizable research
240
+ 2. Use `Task` tool to spawn subagents with specific hypothesis/domain
241
+ 3. Each agent researches independently using GitHub tools
316
242
  4. Merge findings after all agents complete
317
243
 
318
- **Example**:
244
+ **Smart Parallelization Tips**:
245
+ - **Preparation Phase**: Keep sequential - need unified hypothesis identification
246
+ - **Execution Phase**: Parallelize across independent repos/domains
247
+ - Use `TodoWrite` to track research progress per agent
248
+ - Each agent should follow full research flow: `githubSearchRepositories` → `githubViewRepoStructure` → `githubSearchCode` → `githubGetFileContent`
249
+ - Define clear boundaries: each agent owns specific repos/packages
250
+ - Cross-reference findings during merge to identify connections
251
+
252
+ **Example - Multi-Repo Research**:
319
253
  - Goal: "How does auth work across frontend and backend?"
320
254
  - Agent 1: Research `frontend-app` auth flow (login, token storage, guards)
321
255
  - Agent 2: Research `backend-api` auth flow (middleware, validation, sessions)
322
- - Merge: Combine into unified auth flow documentation
256
+ - Merge: Combine into unified auth flow documentation, trace cross-repo dependencies
257
+
258
+ **Example - Multi-Package Research**:
259
+ - Goal: "Compare authentication libraries for Node.js"
260
+ - Agent 1: Research `passport` using `packageSearch` → `githubViewRepoStructure` → `githubGetFileContent`
261
+ - Agent 2: Research `next-auth` using same flow
262
+ - Agent 3: Research `lucia-auth` using same flow
263
+ - Merge: Create comparison matrix with pros/cons
323
264
 
324
265
  **Anti-patterns**:
325
266
  - Don't parallelize when hypotheses depend on each other's results
326
267
  - Don't spawn agents for simple single-repo research
268
+ - Don't parallelize output generation (needs unified synthesis)
327
269
  </multi_agent>
328
270
 
329
271
  ---
@@ -364,6 +364,45 @@ Before delivering:
364
364
 
365
365
  ---
366
366
 
367
+ ## Multi-Agent Parallelization
368
+
369
+ > **Note**: Only applicable if parallel agents are supported by host environment.
370
+
371
+ **When to Spawn Subagents**:
372
+ - Large codebase with 5+ distinct modules/directories
373
+ - Multiple sin categories to hunt (security + performance + architecture)
374
+ - Monorepo with separate packages to roast
375
+
376
+ **How to Parallelize**:
377
+ 1. Use `TodoWrite` to identify independent roast domains
378
+ 2. Use `Task` tool to spawn subagents per domain/sin category
379
+ 3. Each agent hunts sins independently using local tools
380
+ 4. Merge findings, deduplicate, prioritize by severity
381
+
382
+ **Smart Parallelization Tips**:
383
+ - **Phase 1 (Acquire Target)**: Keep sequential - need unified scope
384
+ - **Phase 2-3 (Obliterate + Inventory)**: Parallelize across domains
385
+ - Agent 1: Hunt CAPITAL OFFENSES (security sins, God functions)
386
+ - Agent 2: Hunt FELONIES (any abuse, N+1 queries, callback hell)
387
+ - Agent 3: Hunt CRIMES + SLOP (magic numbers, AI hallucinations)
388
+ - **Phase 4-6 (Autopsy + Redemption)**: Keep sequential - needs unified prioritization
389
+ - Use `TodoWrite` to track sins found per agent
390
+ - Each agent uses: `localViewStructure` → `localSearchCode` → `lspFindReferences` → `localGetFileContent`
391
+
392
+ **Example**:
393
+ - Goal: "Roast entire repo with 50+ files"
394
+ - Agent 1: Hunt security sins across all files (`localSearchCode` for credentials, secrets)
395
+ - Agent 2: Hunt architectural sins (`localViewStructure` for God files, `lspCallHierarchy` for spaghetti)
396
+ - Agent 3: Hunt performance sins (`localSearchCode` for N+1 patterns, blocking calls)
397
+ - Merge: Combine into unified Hall of Shame, sort by severity
398
+
399
+ **Anti-patterns**:
400
+ - Don't parallelize small codebases (<10 files)
401
+ - Don't spawn agents for single-file roasts
402
+ - Don't parallelize redemption phase (fixes need sequential execution)
403
+
404
+ ---
405
+
367
406
  ## References
368
407
 
369
408
  - **Sin Registry**: [references/sin-registry.md](references/sin-registry.md) - Patterns, Search Queries, Language-Specific Sins
@@ -1,172 +0,0 @@
1
- ---
2
- name: octocode-generate
3
- description: Scaffold apps with optimal tech stack
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
- | `localViewStructure` | **Analyze workspace context** (monorepo, existing configs) |
31
- | `localGetFileContent` | **Read local conventions** (tsconfig, package.json) |
32
- | `githubSearchRepositories` | Find template repos |
33
- | `githubViewRepoStructure` | Explore structure |
34
- | `githubSearchCode` | Find config patterns |
35
- | `githubGetFileContent` | Read implementations |
36
- | `packageSearch` | Check package info |
37
-
38
- ## Recommended Frameworks
39
-
40
- ### Fullstack
41
- | Name | CLI Command | Best For |
42
- |------|-------------|----------|
43
- | Next.js | `npx create-next-app@latest` | React + SSR/SSG |
44
- | T3 Stack | `npx create-t3-app@latest` | Type-safe fullstack |
45
- | Remix | `npx create-remix@latest` | Web standards |
46
- | Nuxt | `npx nuxi@latest init` | Vue + SSR |
47
-
48
- ### Frontend
49
- | Name | CLI Command | Best For |
50
- |------|-------------|----------|
51
- | Vite | `npm create vite@latest` | Fast SPA |
52
- | Angular | `npx @angular/cli new` | Enterprise SPA |
53
-
54
- ### Mobile
55
- | Name | CLI Command | Best For |
56
- |------|-------------|----------|
57
- | Expo | `npx create-expo-app@latest` | React Native |
58
-
59
- ### Desktop
60
- | Name | CLI Command | Best For |
61
- |------|-------------|----------|
62
- | Electron Vite | `npm create electron-vite` | Cross-platform |
63
-
64
- ### Backend
65
- | Name | CLI Command | Best For |
66
- |------|-------------|----------|
67
- | NestJS | `npx @nestjs/cli new` | Enterprise API |
68
- | Hono | `npm create hono@latest` | Edge/lightweight |
69
- | Fastify | `npx fastify-cli generate` | High-perf Node |
70
-
71
- ## Execution Phases
72
-
73
- ### Phase 0: Discovery & Context
74
- 1. **Context Scan**:
75
- - Run `localViewStructure` to identify existing project type (Monorepo? Standalone?)
76
- - Check `package.json` / `tsconfig.json` for existing conventions (if in active workspace)
77
- 2. **Classify app type**: Fullstack | SPA | API | Mobile | Desktop
78
- 3. **Ask for references** (existing apps, designs, specs)
79
- 4. **Confirm package manager**: Match existing (`yarn` vs `npm`) or default to `npm`
80
-
81
- **User Checkpoint**: If requirements unclear → STOP & ASK
82
-
83
- ### Phase 1: Stack Selection
84
- **Selection Criteria**:
85
- - Match app type to framework strengths
86
- - Check framework freshness (avoid stale)
87
- - Verify TypeScript support if required
88
- - Consider deployment target (Vercel, AWS, etc.)
89
-
90
- ### Phase 2: Planning
91
- Write plan with:
92
- - Requirements summary
93
- - Research tasks
94
- - Scaffold steps
95
- - Validation checklist
96
-
97
- **User Checkpoint**: Present plan → Wait for approval
98
-
99
- ### Phase 3: Research
100
- **Research Dimensions**:
101
-
102
- | Dimension | Goal | Example Query |
103
- |-----------|------|---------------|
104
- | Official Examples | Canonical patterns | `owner="vercel" repo="next.js" path="examples"` |
105
- | Popular Templates | Community patterns | `topics=["starter", "template"] stars=">1000"` |
106
- | Integration Code | How libs connect | `filename="trpc" extension="ts" keywords=["createTRPCNext"]` |
107
- | Config Files | Tooling setup | `filename="next.config" extension="mjs"` |
108
-
109
- **Quality Guards**:
110
- - Prefer repos updated within last 6 months
111
- - Prefer repos with `stars` > 500
112
- - Verify active maintenance (recent commits/PRs)
113
-
114
- ### Phase 4: Scaffold
115
- **Execution Order**:
116
- 1. **Initialize**: Run framework CLI
117
- 2. **Install**: Add dependencies (from research)
118
- 3. **Configure**: Create/update config files
119
- 4. **Implement**: Add features using researched patterns
120
-
121
- **Guidelines**:
122
- - Follow researched patterns exactly
123
- - Use explicit file paths
124
- - Add TypeScript types
125
- - Create `.env.example` (never commit secrets)
126
- - Add essential comments for non-obvious code
127
-
128
- ### Phase 5: Validate
129
- **Validation Gates (ALL MANDATORY)**:
130
- - [ ] `npm run build` / `yarn build` - passes
131
- - [ ] `npx tsc --noEmit` - no errors
132
- - [ ] Dev server starts without errors
133
- - [ ] All imports resolve
134
- - [ ] No TypeScript `any` escapes
135
-
136
- **Loop**: Fail → Fix → Re-validate until all gates pass
137
-
138
- ## Research Flows
139
-
140
- | From | Need | Go To |
141
- |------|------|-------|
142
- | `localViewStructure` | Existing Patterns | `localGetFileContent` |
143
- | `githubSearchRepositories` | Structure | `githubViewRepoStructure` |
144
- | `githubSearchRepositories` | Patterns | `githubSearchCode` |
145
- | `githubViewRepoStructure` | File content | `githubGetFileContent` |
146
- | `githubSearchCode` | Full context | `githubGetFileContent` |
147
- | `packageSearch` | Source code | `githubViewRepoStructure` |
148
-
149
- ## Confidence Framework
150
-
151
- | Decision Type | Confidence Required | Action |
152
- |---------------|---------------------|--------|
153
- | Framework choice | HIGH (2+ sources) | Proceed |
154
- | Config patterns | MED (1 quality source) | Proceed with note |
155
- | Uncertain practice | LOW | Ask user |
156
-
157
- ## When to Skip Research
158
-
159
- - Standard CLI defaults (Next.js app router, Vite React)
160
- - User explicitly specified tech stack
161
- - Common boilerplate (`.env.example`, `tsconfig.json` base)
162
- - Trivial choices with no architectural impact
163
-
164
- ## Error Recovery
165
-
166
- | Error | Action |
167
- |-------|--------|
168
- | Build fails | Fix imports/types, re-validate |
169
- | Missing types | `npm i -D @types/{package}` |
170
- | Version conflict | Research compatible versions |
171
- | Config error | Research correct config pattern |
172
- | CLI fails | Check framework docs via research |