opencodekit 0.9.0 → 0.9.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.
- package/README.md +35 -43
- package/dist/index.js +29 -9
- package/dist/template/.opencode/AGENTS.md +64 -38
- package/dist/template/.opencode/README.md +13 -9
- package/dist/template/.opencode/agent/build.md +41 -3
- package/dist/template/.opencode/agent/explore.md +18 -4
- package/dist/template/.opencode/agent/review.md +16 -3
- package/dist/template/.opencode/agent/rush.md +23 -4
- package/dist/template/.opencode/opencode.json +514 -474
- package/dist/template/.opencode/package.json +1 -1
- package/dist/template/.opencode/plugin/compaction.ts +87 -4
- package/dist/template/.opencode/plugin/skill-mcp.ts +1 -1
- package/dist/template/.opencode/skill/chrome-devtools/SKILL.md +88 -0
- package/dist/template/.opencode/skill/polar/SKILL.md +92 -0
- package/dist/template/.opencode/tool/lsp.ts +454 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,22 +24,13 @@ A pre-configured OpenCode distribution featuring:
|
|
|
24
24
|
### Option 1: Using CLI (Recommended)
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
# 1.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
ock init
|
|
35
|
-
cd my-opencode-project
|
|
36
|
-
|
|
37
|
-
# 3. Configure OpenCodeKit
|
|
38
|
-
ock setup
|
|
39
|
-
|
|
40
|
-
# 4. Explore
|
|
41
|
-
ock agent list
|
|
42
|
-
ock skill list
|
|
27
|
+
# 1. Create new project with npx
|
|
28
|
+
npx opencodekit init my-project
|
|
29
|
+
cd my-project
|
|
30
|
+
|
|
31
|
+
# 2. Or install globally
|
|
32
|
+
npm install -g opencodekit
|
|
33
|
+
ock init my-project
|
|
43
34
|
```
|
|
44
35
|
|
|
45
36
|
**See [CLI.md](./CLI.md) for complete CLI documentation**
|
|
@@ -73,13 +64,12 @@ create test.txt with "Hello OpenCodeKit"
|
|
|
73
64
|
|
|
74
65
|
```
|
|
75
66
|
build (Primary Orchestrator - 70% of work)
|
|
76
|
-
├→ @
|
|
77
|
-
├→ @
|
|
78
|
-
├→ @
|
|
79
|
-
├→ @
|
|
80
|
-
├→ @
|
|
81
|
-
├→ @
|
|
82
|
-
├→ @orchestrator (Multi-agent coordination)
|
|
67
|
+
├→ @rush (Fast agent for simple tasks)
|
|
68
|
+
├→ @planner (Complex planning ≥3 phases)
|
|
69
|
+
├→ @review (Code review + security + debugging)
|
|
70
|
+
├→ @scout (External research, library docs, GitHub patterns)
|
|
71
|
+
├→ @explore (Fast codebase search)
|
|
72
|
+
├→ @vision (UI/UX, mockups, visual analysis)
|
|
83
73
|
└→ @general (Fallback)
|
|
84
74
|
|
|
85
75
|
Background Plugins:
|
|
@@ -88,10 +78,10 @@ Background Plugins:
|
|
|
88
78
|
• truncator (Dynamic output truncation)
|
|
89
79
|
|
|
90
80
|
Supporting:
|
|
91
|
-
•
|
|
92
|
-
•
|
|
93
|
-
•
|
|
94
|
-
• Custom Tools (memory-*, observation, ast-grep)
|
|
81
|
+
• 30+ Skills (domain expertise loaded on-demand)
|
|
82
|
+
• 26+ Commands (workflow shortcuts)
|
|
83
|
+
• 3 MCP Services (context7, exa, gh_grep) + skill-embedded MCPs
|
|
84
|
+
• Custom Tools (memory-*, observation, ast-grep, lsp-*)
|
|
95
85
|
• Beads task tracking (`bd` CLI for multi-session workflows)
|
|
96
86
|
• Manual Handoffs (clean phase transitions)
|
|
97
87
|
```
|
|
@@ -181,20 +171,21 @@ session({
|
|
|
181
171
|
Is it a simple task?
|
|
182
172
|
✓ → Use build directly (70% of work)
|
|
183
173
|
|
|
174
|
+
Need speed over depth?
|
|
175
|
+
✓ → @rush (fast agent, same capabilities)
|
|
176
|
+
|
|
184
177
|
Complex task (≥3 phases)?
|
|
185
|
-
✓ → @
|
|
178
|
+
✓ → @planner (creates implementation plan)
|
|
186
179
|
|
|
187
180
|
Need research?
|
|
188
|
-
✓ → @
|
|
189
|
-
✓ → @
|
|
190
|
-
✓ → @docs (quick API reference)
|
|
191
|
-
✓ → @finder (codebase search)
|
|
181
|
+
✓ → @scout (library docs + GitHub patterns)
|
|
182
|
+
✓ → @explore (codebase search)
|
|
192
183
|
|
|
193
184
|
Quality gate before deployment?
|
|
194
|
-
✓ → @
|
|
185
|
+
✓ → @review (security + code review + debugging)
|
|
195
186
|
|
|
196
|
-
|
|
197
|
-
✓ → @
|
|
187
|
+
UI/UX work?
|
|
188
|
+
✓ → @vision (mockups, visual analysis, accessibility)
|
|
198
189
|
|
|
199
190
|
Everything else?
|
|
200
191
|
✓ → @general (fallback)
|
|
@@ -226,15 +217,15 @@ Everything else?
|
|
|
226
217
|
|
|
227
218
|
You've successfully set up OpenCodeKit when:
|
|
228
219
|
|
|
229
|
-
- ✅
|
|
220
|
+
- ✅ Agent files in place (.opencode/agent/\*.md)
|
|
230
221
|
- ✅ Build handles 70%+ directly
|
|
231
|
-
- ✅ Commands work (
|
|
232
|
-
- ✅ Skills load
|
|
222
|
+
- ✅ Commands work (/commit, /pr, /design, /fix, /implement)
|
|
223
|
+
- ✅ Skills load on-demand (30+ skills)
|
|
233
224
|
- ✅ Delegation is clear (build → specialized subagents)
|
|
234
225
|
- ✅ `/handoff` creates portable bundles (.opencode/memory/handoffs/)
|
|
235
|
-
- ✅ MCP services configured (
|
|
226
|
+
- ✅ MCP services configured (context7, gh_grep + skill-embedded)
|
|
236
227
|
- ✅ Background plugins active (enforcer, compactor, truncator)
|
|
237
|
-
- ✅ Custom tools available (memory
|
|
228
|
+
- ✅ Custom tools available (memory-_, observation, ast-grep, lsp-_)
|
|
238
229
|
- ✅ Environment variables set (.opencode/.env with API keys)
|
|
239
230
|
|
|
240
231
|
---
|
|
@@ -260,9 +251,10 @@ You've successfully set up OpenCodeKit when:
|
|
|
260
251
|
|
|
261
252
|
---
|
|
262
253
|
|
|
263
|
-
**OpenCodeKit v0.
|
|
254
|
+
**OpenCodeKit v0.9.2**
|
|
264
255
|
**Architecture**: Two-layer (Memory + Beads + Git)
|
|
265
|
-
**
|
|
256
|
+
**Package**: `npx opencodekit` to scaffold new projects
|
|
257
|
+
**New in v0.9.2**: 6 new LSP tools, `ock init --beads` flag, improved tool guidance
|
|
266
258
|
**Ready for**: Daily production use
|
|
267
259
|
|
|
268
|
-
Enjoy your streamlined agent system with clean phase transitions!
|
|
260
|
+
Enjoy your streamlined agent system with clean phase transitions!
|
package/dist/index.js
CHANGED
|
@@ -750,7 +750,7 @@ var cac = (name = "") => new CAC(name);
|
|
|
750
750
|
// package.json
|
|
751
751
|
var package_default = {
|
|
752
752
|
name: "opencodekit",
|
|
753
|
-
version: "0.9.
|
|
753
|
+
version: "0.9.2",
|
|
754
754
|
description: "CLI tool for bootstrapping and managing OpenCodeKit projects",
|
|
755
755
|
type: "module",
|
|
756
756
|
repository: {
|
|
@@ -3050,14 +3050,15 @@ async function editAutoupdate(configPath) {
|
|
|
3050
3050
|
}
|
|
3051
3051
|
|
|
3052
3052
|
// src/commands/init.ts
|
|
3053
|
+
import { execSync } from "node:child_process";
|
|
3053
3054
|
import {
|
|
3054
3055
|
existsSync as existsSync3,
|
|
3055
3056
|
mkdirSync as mkdirSync2,
|
|
3056
3057
|
readFileSync as readFileSync3,
|
|
3057
|
-
|
|
3058
|
-
|
|
3058
|
+
readdirSync as readdirSync2,
|
|
3059
|
+
writeFileSync as writeFileSync3
|
|
3059
3060
|
} from "node:fs";
|
|
3060
|
-
import { join as join3
|
|
3061
|
+
import { basename, dirname, join as join3 } from "node:path";
|
|
3061
3062
|
import { fileURLToPath } from "node:url";
|
|
3062
3063
|
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
3063
3064
|
var EXCLUDED_DIRS = [
|
|
@@ -3114,9 +3115,7 @@ async function copyDir(src, dest) {
|
|
|
3114
3115
|
continue;
|
|
3115
3116
|
const srcPath = join3(src, entry.name);
|
|
3116
3117
|
const destPath = join3(dest, entry.name);
|
|
3117
|
-
if (entry.isSymbolicLink()) {
|
|
3118
|
-
continue;
|
|
3119
|
-
} else if (entry.isDirectory()) {
|
|
3118
|
+
if (entry.isSymbolicLink()) {} else if (entry.isDirectory()) {
|
|
3120
3119
|
await copyDir(srcPath, destPath);
|
|
3121
3120
|
} else {
|
|
3122
3121
|
const content = readFileSync3(srcPath, "utf-8");
|
|
@@ -3178,7 +3177,28 @@ async function initCommand(options = {}) {
|
|
|
3178
3177
|
process.exit(1);
|
|
3179
3178
|
}
|
|
3180
3179
|
s.stop("Done");
|
|
3181
|
-
|
|
3180
|
+
if (options.beads) {
|
|
3181
|
+
const beadsDir = join3(targetDir, ".beads");
|
|
3182
|
+
if (!existsSync3(beadsDir)) {
|
|
3183
|
+
const bs = de();
|
|
3184
|
+
bs.start("Initializing .beads/");
|
|
3185
|
+
try {
|
|
3186
|
+
execSync("bd init", { cwd: targetDir, stdio: "ignore" });
|
|
3187
|
+
bs.stop("Beads initialized");
|
|
3188
|
+
} catch {
|
|
3189
|
+
mkdirSync2(beadsDir, { recursive: true });
|
|
3190
|
+
writeFileSync3(join3(beadsDir, "config.yaml"), `# Beads configuration
|
|
3191
|
+
version: 1
|
|
3192
|
+
`);
|
|
3193
|
+
writeFileSync3(join3(beadsDir, "issues.jsonl"), "");
|
|
3194
|
+
writeFileSync3(join3(beadsDir, "metadata.json"), JSON.stringify({ created: new Date().toISOString() }, null, 2));
|
|
3195
|
+
bs.stop("Beads initialized (manual)");
|
|
3196
|
+
}
|
|
3197
|
+
} else {
|
|
3198
|
+
f2.info(".beads/ already exists");
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
le("cd .opencode && bun install", "Next steps");
|
|
3182
3202
|
$e(import_picocolors7.default.green("Ready to code!"));
|
|
3183
3203
|
}
|
|
3184
3204
|
|
|
@@ -3724,7 +3744,7 @@ var cli = cac("ock");
|
|
|
3724
3744
|
cli.option("--verbose", "Enable verbose logging");
|
|
3725
3745
|
cli.option("--quiet", "Suppress all output");
|
|
3726
3746
|
cli.version(`${packageVersion}`);
|
|
3727
|
-
cli.command("init", "Initialize OpenCodeKit in current directory").option("--force", "Reinitialize even if already exists").action(initCommand);
|
|
3747
|
+
cli.command("init", "Initialize OpenCodeKit in current directory").option("--force", "Reinitialize even if already exists").option("--beads", "Also initialize .beads/ for multi-agent coordination").action(initCommand);
|
|
3728
3748
|
cli.command("agent [action]", "Manage agents (list, add, view)").action(async (action) => {
|
|
3729
3749
|
if (!action) {
|
|
3730
3750
|
console.log(`
|
|
@@ -79,35 +79,80 @@ Specify depth when delegating to control tool call budget:
|
|
|
79
79
|
|
|
80
80
|
## Tool Priority
|
|
81
81
|
|
|
82
|
-
**LSP tools → AST
|
|
82
|
+
**LSP tools → AST-grep → Built-in tools**
|
|
83
83
|
|
|
84
|
-
1.
|
|
85
|
-
2. `ast-grep` -
|
|
86
|
-
3. `grep
|
|
87
|
-
4. `
|
|
84
|
+
1. **LSP tools** - Semantic code intelligence (10 tools)
|
|
85
|
+
2. `ast-grep` - **Code search/replace** (functions, patterns, imports, hooks)
|
|
86
|
+
3. `grep` - **Text search** (logs, config, non-code files, simple strings)
|
|
87
|
+
4. `glob` - File discovery by name pattern
|
|
88
|
+
5. `read`, `edit`, `write` - File operations
|
|
89
|
+
|
|
90
|
+
### Choosing the Right Search Tool
|
|
91
|
+
|
|
92
|
+
Ask yourself: **"Am I looking for code structure or just text?"**
|
|
93
|
+
|
|
94
|
+
**Use `ast-grep` when you need to find:**
|
|
95
|
+
|
|
96
|
+
- How a function is called → `pattern="fetchUser($$$)"`
|
|
97
|
+
- Where a hook is used → `pattern="useState($$$)"`
|
|
98
|
+
- Import statements → `pattern="import { $$ } from '$MOD'"`
|
|
99
|
+
- Class definitions → `pattern="class $NAME { $$$ }"`
|
|
100
|
+
- Try-catch blocks → `pattern="try { $$$ } catch ($E) { $$$ }"`
|
|
101
|
+
|
|
102
|
+
**Use `grep` when you need to find:**
|
|
103
|
+
|
|
104
|
+
- Error messages in logs → `pattern="FATAL|ERROR"`
|
|
105
|
+
- Config values → `pattern="API_KEY"`
|
|
106
|
+
- TODO comments → `pattern="TODO|FIXME"`
|
|
107
|
+
- Text in markdown/docs → `pattern="deprecated"`
|
|
108
|
+
|
|
109
|
+
**Use LSP tools when you need to:**
|
|
110
|
+
|
|
111
|
+
- Understand what a symbol is → `lsp_hover`
|
|
112
|
+
- Jump to where something is defined → `lsp_goto_definition`
|
|
113
|
+
- Find all usages before refactoring → `lsp_find_references`
|
|
114
|
+
- Rename across the entire codebase → `lsp_rename`
|
|
88
115
|
|
|
89
116
|
**Rule**: Always `read` before `edit` to verify content.
|
|
90
117
|
|
|
91
|
-
### LSP Tools
|
|
118
|
+
### LSP Tools (10 tools)
|
|
92
119
|
|
|
93
|
-
Semantic
|
|
120
|
+
Semantic code intelligence via Language Server Protocol:
|
|
94
121
|
|
|
95
|
-
|
|
96
|
-
# Rename symbol across entire codebase
|
|
97
|
-
lsp_rename(filePath, line, character, newName)
|
|
122
|
+
**Navigation & Understanding:**
|
|
98
123
|
|
|
99
|
-
|
|
100
|
-
|
|
124
|
+
- `lsp_hover(filePath, line, character)` - Get type info and docs at cursor
|
|
125
|
+
- `lsp_goto_definition(filePath, line, character)` - Jump to where symbol is defined
|
|
126
|
+
- `lsp_find_references(filePath, line, character)` - Find all usages of a symbol
|
|
127
|
+
- `lsp_document_symbols(filePath)` - Get file outline (classes, functions, etc.)
|
|
128
|
+
- `lsp_workspace_symbols(query, filePath)` - Fuzzy search symbols across workspace
|
|
101
129
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
130
|
+
**Diagnostics:**
|
|
131
|
+
|
|
132
|
+
- `lsp_diagnostics(filePath, severity?)` - Get errors/warnings from language server
|
|
133
|
+
|
|
134
|
+
**Refactoring:**
|
|
135
|
+
|
|
136
|
+
- `lsp_rename(filePath, line, character, newName)` - Rename symbol across codebase
|
|
137
|
+
- `lsp_code_actions(filePath, startLine, startChar, endLine, endChar)` - Get available refactorings
|
|
138
|
+
- `lsp_code_action_apply(...)` - Apply a specific code action
|
|
139
|
+
- `lsp_organize_imports(filePath)` - Clean up and sort imports
|
|
105
140
|
|
|
106
|
-
**When to use
|
|
141
|
+
**When to use each tool:**
|
|
107
142
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
143
|
+
**"What type is this variable?"** → Use `lsp_hover` to see type signature without reading the entire definition file.
|
|
144
|
+
|
|
145
|
+
**"Where is this function defined?"** → Use `lsp_goto_definition` to jump directly to source instead of grepping.
|
|
146
|
+
|
|
147
|
+
**"What uses this function?"** → Use `lsp_find_references` before changing anything to see all call sites.
|
|
148
|
+
|
|
149
|
+
**"What's in this file?"** → Use `lsp_document_symbols` for a quick outline without reading the entire file.
|
|
150
|
+
|
|
151
|
+
**"Where is UserService defined?"** → Use `lsp_workspace_symbols` to fuzzy search across all files.
|
|
152
|
+
|
|
153
|
+
**"Are there type errors?"** → Use `lsp_diagnostics` to check before running tests.
|
|
154
|
+
|
|
155
|
+
**"Rename this function safely"** → Use `lsp_rename` to update all references automatically.
|
|
111
156
|
|
|
112
157
|
**Caveat**: LSP tools modify files directly. Re-read files before further edits.
|
|
113
158
|
|
|
@@ -355,25 +400,6 @@ Call `bd_insights` for graph analysis showing bottlenecks and high-priority keys
|
|
|
355
400
|
|
|
356
401
|
Get `bd_priority` recommendations for what to work on next based on graph analysis. Use `bd_diff` to compare issue changes between git revisions.
|
|
357
402
|
|
|
358
|
-
### Quick Start
|
|
359
|
-
|
|
360
|
-
```typescript
|
|
361
|
-
// 1. Join workspace
|
|
362
|
-
bd_init({ team: "project", role: "fe" });
|
|
363
|
-
|
|
364
|
-
// 2. Get next task
|
|
365
|
-
const task = bd_claim();
|
|
366
|
-
|
|
367
|
-
// 3. Lock files before editing
|
|
368
|
-
bd_reserve({ paths: ["src/auth.ts", "src/types.ts"] });
|
|
369
|
-
|
|
370
|
-
// 4. Do the work...
|
|
371
|
-
|
|
372
|
-
// 5. Complete and restart
|
|
373
|
-
bd_done({ id: task.id, msg: "Implemented auth" });
|
|
374
|
-
// RESTART SESSION
|
|
375
|
-
```
|
|
376
|
-
|
|
377
403
|
### Rules
|
|
378
404
|
|
|
379
405
|
- **Always `bd_init()` first** in any session using beads tools
|
|
@@ -186,7 +186,7 @@ ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" dryRun=true
|
|
|
186
186
|
|
|
187
187
|
## MCP Services
|
|
188
188
|
|
|
189
|
-
**Enabled by default (
|
|
189
|
+
**Enabled by default (3 total):**
|
|
190
190
|
|
|
191
191
|
1. **context7** - Up-to-date library documentation (37.6k+ libraries)
|
|
192
192
|
- Requires: CONTEXT7_API_KEY
|
|
@@ -200,16 +200,19 @@ ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" dryRun=true
|
|
|
200
200
|
- No API key needed (public service)
|
|
201
201
|
- GitHub: https://github.com/Shachlan/grep.app-mcp
|
|
202
202
|
|
|
203
|
-
**
|
|
203
|
+
**Skill-Embedded MCP (load on-demand):**
|
|
204
204
|
|
|
205
|
-
4. **
|
|
205
|
+
4. **figma** - Extract Figma layouts and design tokens
|
|
206
206
|
- Requires: FIGMA_API_KEY
|
|
207
|
-
-
|
|
208
|
-
- Enable: Set `"Framelink MCP for Figma": { "enabled": true }` in opencode.json
|
|
207
|
+
- Use: `skill({ name: "figma" })` then `skill_mcp()`
|
|
209
208
|
|
|
210
209
|
5. **playwright** - Browser automation for testing
|
|
211
210
|
- No API key needed
|
|
212
|
-
- Use
|
|
211
|
+
- Use: `skill({ name: "playwright" })` then `skill_mcp()`
|
|
212
|
+
|
|
213
|
+
6. **chrome-devtools** - DevTools for debugging and performance
|
|
214
|
+
- No API key needed
|
|
215
|
+
- Use: `skill({ name: "chrome-devtools" })` then `skill_mcp()`
|
|
213
216
|
|
|
214
217
|
---
|
|
215
218
|
|
|
@@ -326,7 +329,8 @@ fi
|
|
|
326
329
|
|
|
327
330
|
---
|
|
328
331
|
|
|
329
|
-
**OpenCodeKit v0.
|
|
332
|
+
**OpenCodeKit v0.9.2**
|
|
330
333
|
**Architecture:** Two-Layer (Memory + Beads + Git)
|
|
331
|
-
**New in v0.
|
|
332
|
-
**
|
|
334
|
+
**New in v0.9.2:** 6 new LSP tools, `ock init --beads` flag, improved tool guidance
|
|
335
|
+
**Package:** `npx opencodekit` to scaffold new projects
|
|
336
|
+
**Last Updated:** January 2, 2026
|
|
@@ -47,9 +47,31 @@ Primary orchestrator. Execute-first. Autonomous task completion until resolved.
|
|
|
47
47
|
## Tool Priority
|
|
48
48
|
|
|
49
49
|
1. **LSP tools** for semantic refactoring (rename, code actions, organize imports)
|
|
50
|
-
2. **AST-Grep** for
|
|
51
|
-
3. **
|
|
52
|
-
4. **
|
|
50
|
+
2. **AST-Grep** for code search/replace (functions, hooks, imports, patterns)
|
|
51
|
+
3. **grep** for text search (logs, config, non-code files)
|
|
52
|
+
4. **glob** for file discovery by name
|
|
53
|
+
5. **Bash** for running tests, builds, commands
|
|
54
|
+
|
|
55
|
+
### Choosing the Right Search Tool
|
|
56
|
+
|
|
57
|
+
Ask yourself: **"Am I looking for code structure or just text?"**
|
|
58
|
+
|
|
59
|
+
**Use `ast-grep` when you need to find:**
|
|
60
|
+
|
|
61
|
+
- How a function is called → `pattern="fetchUser($$$)"`
|
|
62
|
+
- Where a hook is used → `pattern="useState($$$)"`
|
|
63
|
+
- Import statements → `pattern="import { $$ } from '$MOD'"`
|
|
64
|
+
|
|
65
|
+
**Use `grep` when you need to find:**
|
|
66
|
+
|
|
67
|
+
- Error messages, config values, TODO comments, text in docs
|
|
68
|
+
|
|
69
|
+
**Use LSP tools when you need to:**
|
|
70
|
+
|
|
71
|
+
- Understand what a symbol is → `lsp_hover`
|
|
72
|
+
- Jump to where something is defined → `lsp_goto_definition`
|
|
73
|
+
- Find all usages before refactoring → `lsp_find_references`
|
|
74
|
+
- Rename across the entire codebase → `lsp_rename`
|
|
53
75
|
|
|
54
76
|
### LSP Tools
|
|
55
77
|
|
|
@@ -57,6 +79,22 @@ Use LSP tools for safe, semantic refactoring. Use `lsp_rename` to rename functio
|
|
|
57
79
|
|
|
58
80
|
**Caveat**: LSP tools modify files directly. Re-read before further edits.
|
|
59
81
|
|
|
82
|
+
### AST-Grep
|
|
83
|
+
|
|
84
|
+
Semantic code search/replace - smarter than regex:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
# Search patterns
|
|
88
|
+
ast-grep pattern="console.log($$$)" # Find all console.log
|
|
89
|
+
ast-grep pattern="async function $NAME($$$) { $$$ }" # Find async functions
|
|
90
|
+
ast-grep pattern="const [$S, $SET] = useState($$$)" # Find React hooks
|
|
91
|
+
|
|
92
|
+
# Replace (dry run first)
|
|
93
|
+
ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" dryRun=true
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Pattern syntax**: `$NAME` = single node, `$$$` = zero or more nodes
|
|
97
|
+
|
|
60
98
|
## Anti-Hallucination
|
|
61
99
|
|
|
62
100
|
**Before work:** Check bead spec if doing feature work (`bd show <id>`)
|
|
@@ -14,6 +14,7 @@ tools:
|
|
|
14
14
|
todoread: false
|
|
15
15
|
todowrite: false
|
|
16
16
|
ast-grep*: true
|
|
17
|
+
lsp*: true
|
|
17
18
|
---
|
|
18
19
|
|
|
19
20
|
# Explore Agent
|
|
@@ -26,6 +27,7 @@ File search specialist. Navigate and explore codebases efficiently.
|
|
|
26
27
|
- Searching code with regex patterns
|
|
27
28
|
- Reading and analyzing file contents
|
|
28
29
|
- Semantic code search with AST-Grep
|
|
30
|
+
- Understanding symbol types and definitions with LSP
|
|
29
31
|
|
|
30
32
|
## Guidelines
|
|
31
33
|
|
|
@@ -37,7 +39,19 @@ File search specialist. Navigate and explore codebases efficiently.
|
|
|
37
39
|
|
|
38
40
|
## Tool Priority
|
|
39
41
|
|
|
40
|
-
**
|
|
42
|
+
**LSP tools for understanding → AST-Grep for patterns → Built-in for text**
|
|
43
|
+
|
|
44
|
+
### LSP Tools (Code Intelligence)
|
|
45
|
+
|
|
46
|
+
**"What type is this?"** → Use `lsp_hover` to see type signature at a position.
|
|
47
|
+
|
|
48
|
+
**"Where is this defined?"** → Use `lsp_goto_definition` to jump to source.
|
|
49
|
+
|
|
50
|
+
**"What uses this?"** → Use `lsp_find_references` to find all call sites.
|
|
51
|
+
|
|
52
|
+
**"What's in this file?"** → Use `lsp_document_symbols` for quick outline.
|
|
53
|
+
|
|
54
|
+
**"Where is X defined in the codebase?"** → Use `lsp_workspace_symbols` to fuzzy search.
|
|
41
55
|
|
|
42
56
|
### AST-Grep (Semantic Search)
|
|
43
57
|
|
|
@@ -59,8 +73,8 @@ File search specialist. Navigate and explore codebases efficiently.
|
|
|
59
73
|
|
|
60
74
|
## Thoroughness Levels
|
|
61
75
|
|
|
62
|
-
**Quick**: Single ast-grep or glob. Read 1-3 files. Return immediately.
|
|
76
|
+
**Quick**: Single ast-grep, lsp_workspace_symbols, or glob. Read 1-3 files. Return immediately.
|
|
63
77
|
|
|
64
|
-
**Medium**: AST-grep +
|
|
78
|
+
**Medium**: AST-grep + LSP verification. Check 2-3 naming conventions. Read 3-5 files. Use `lsp_find_references` to trace usage.
|
|
65
79
|
|
|
66
|
-
**Very Thorough**: Comprehensive search across multiple terms and locations.
|
|
80
|
+
**Very Thorough**: Comprehensive search across multiple terms and locations. Use `lsp_find_references` to build dependency map. Report with file:line references.
|
|
@@ -18,6 +18,8 @@ tools:
|
|
|
18
18
|
codesearch: true
|
|
19
19
|
memory-read: true
|
|
20
20
|
memory-update: true
|
|
21
|
+
ast-grep*: true
|
|
22
|
+
lsp*: true
|
|
21
23
|
---
|
|
22
24
|
|
|
23
25
|
# Review Agent
|
|
@@ -30,6 +32,7 @@ Critical analysis: code review, debugging, security audit, refactoring decisions
|
|
|
30
32
|
- Root cause analysis
|
|
31
33
|
- Code quality assessment
|
|
32
34
|
- Evidence-based recommendations
|
|
35
|
+
- Understanding code with LSP tools
|
|
33
36
|
|
|
34
37
|
## Guidelines
|
|
35
38
|
|
|
@@ -69,9 +72,19 @@ bd create "[type]: [description]" -t bug -p [0-4] -d "[details, file:line]"
|
|
|
69
72
|
|
|
70
73
|
## Tool Priority
|
|
71
74
|
|
|
72
|
-
**
|
|
73
|
-
|
|
74
|
-
**
|
|
75
|
+
**LSP tools for understanding → AST-grep for patterns → Built-in for verification**
|
|
76
|
+
|
|
77
|
+
**"What type is this variable?"** → Use `lsp_hover` to understand without reading entire file.
|
|
78
|
+
|
|
79
|
+
**"Where is this defined?"** → Use `lsp_goto_definition` to jump to source.
|
|
80
|
+
|
|
81
|
+
**"What calls this function?"** → Use `lsp_find_references` to trace all usages.
|
|
82
|
+
|
|
83
|
+
**"Are there type errors?"** → Use `lsp_diagnostics` before investigating runtime issues.
|
|
84
|
+
|
|
85
|
+
**"Find this pattern across codebase"** → Use `ast-grep` for semantic code search.
|
|
86
|
+
|
|
87
|
+
**Verification**: `bash` for tests, lint, type-check. `git log -p`, `git blame` for history.
|
|
75
88
|
|
|
76
89
|
## Execution Discipline
|
|
77
90
|
|
|
@@ -45,11 +45,21 @@ Fast execute-first agent. Speed over depth. Delegate anything complex.
|
|
|
45
45
|
|
|
46
46
|
## Tool Priority
|
|
47
47
|
|
|
48
|
-
**LSP tools
|
|
48
|
+
1. **LSP tools** for semantic refactoring (rename, organize imports)
|
|
49
|
+
2. **AST-Grep** for code search/replace (functions, hooks, imports)
|
|
50
|
+
3. **grep** for text search (logs, config, non-code)
|
|
51
|
+
4. **glob** for file discovery
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
### Choosing the Right Search Tool
|
|
54
|
+
|
|
55
|
+
Ask: **"Code structure or just text?"**
|
|
56
|
+
|
|
57
|
+
- Code structure (functions, hooks, imports) → `ast-grep`
|
|
58
|
+
- Text patterns (logs, config, docs) → `grep`
|
|
59
|
+
- Understand symbol type → `lsp_hover`
|
|
60
|
+
- Find definition → `lsp_goto_definition`
|
|
61
|
+
- Find all usages → `lsp_find_references`
|
|
62
|
+
- Rename across codebase → `lsp_rename`
|
|
53
63
|
|
|
54
64
|
### LSP Tools (Fast Refactoring)
|
|
55
65
|
|
|
@@ -57,6 +67,15 @@ Use `lsp_rename` to rename symbols across the codebase - faster than manual find
|
|
|
57
67
|
|
|
58
68
|
**Caveat**: LSP tools modify files directly. Re-read before further edits.
|
|
59
69
|
|
|
70
|
+
### AST-Grep (Semantic Search/Replace)
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
ast-grep pattern="console.log($$$)" # Find console.log
|
|
74
|
+
ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" # Replace function calls
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Pattern syntax**: `$NAME` = single node, `$$$` = zero or more nodes
|
|
78
|
+
|
|
60
79
|
## Pre-Action Checks
|
|
61
80
|
|
|
62
81
|
Before mutations (edit, write, delete):
|