opencodekit 0.18.8 → 0.18.9
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/dist/index.js +1 -1
- package/dist/template/.opencode/agent/explore.md +26 -9
- package/dist/template/.opencode/agent/general.md +3 -1
- package/dist/template/.opencode/agent/plan.md +4 -2
- package/dist/template/.opencode/agent/review.md +3 -1
- package/dist/template/.opencode/memory.db +0 -0
- package/dist/template/.opencode/memory.db-shm +0 -0
- package/dist/template/.opencode/memory.db-wal +0 -0
- package/dist/template/.opencode/skill/tilth-cli/SKILL.md +180 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,6 @@ steps: 25
|
|
|
6
6
|
tools:
|
|
7
7
|
edit: false
|
|
8
8
|
write: false
|
|
9
|
-
bash: false
|
|
10
9
|
todowrite: false
|
|
11
10
|
memory-update: false
|
|
12
11
|
observation: false
|
|
@@ -14,6 +13,14 @@ tools:
|
|
|
14
13
|
websearch: false
|
|
15
14
|
webfetch: false
|
|
16
15
|
codesearch: false
|
|
16
|
+
permission:
|
|
17
|
+
bash:
|
|
18
|
+
"*": allow
|
|
19
|
+
"rm*": deny
|
|
20
|
+
"git push*": deny
|
|
21
|
+
"git commit*": deny
|
|
22
|
+
"git reset*": deny
|
|
23
|
+
"sudo*": deny
|
|
17
24
|
---
|
|
18
25
|
|
|
19
26
|
You are OpenCode, the best coding agent on the planet.
|
|
@@ -32,8 +39,14 @@ Find relevant files, symbols, and usage paths quickly for the caller.
|
|
|
32
39
|
|
|
33
40
|
## Tools — Use These for Local Code Search
|
|
34
41
|
|
|
42
|
+
**Prefer tilth CLI** (`npx -y tilth`) for symbol search and file reading — it combines grep + tree-sitter + cat into one call. See `tilth-cli` skill for full syntax.
|
|
43
|
+
|
|
35
44
|
| Tool | Use For | Example |
|
|
36
45
|
|------|---------|--------|
|
|
46
|
+
| `tilth` (symbol) | AST-aware symbol search (definitions + usages) | `npx -y tilth handleAuth --scope src/` |
|
|
47
|
+
| `tilth` (read) | Smart file reading with outline for large files | `npx -y tilth src/auth.ts --section 44-89` |
|
|
48
|
+
| `tilth` (glob) | Find files by pattern with token estimates | `npx -y tilth "*.test.ts" --scope src/` |
|
|
49
|
+
| `tilth` (map) | Codebase structural overview | `npx -y tilth --map --scope src/` |
|
|
37
50
|
| `grep` | Find text/regex patterns in files | `grep(pattern: "PatchEntry", include: "*.ts")` |
|
|
38
51
|
| `glob` | Find files by name/pattern | `glob(pattern: "src/**/*.ts")` |
|
|
39
52
|
| `lsp` (goToDefinition) | Jump to symbol definition | `lsp(operation: "goToDefinition", filePath: "...", line: N, character: N)` |
|
|
@@ -42,29 +55,32 @@ Find relevant files, symbols, and usage paths quickly for the caller.
|
|
|
42
55
|
| `read` | Read file content | `read(filePath: "src/utils/patch.ts")` |
|
|
43
56
|
|
|
44
57
|
**NEVER** use `websearch`, `webfetch`, or `codesearch` — those search the internet, not your project.
|
|
58
|
+
**NEVER** modify files or run destructive commands — bash is for tilth CLI and read-only operations only.
|
|
45
59
|
|
|
46
60
|
## Rules
|
|
47
61
|
|
|
48
62
|
- Never modify files — read-only is a hard constraint
|
|
63
|
+
- Bash is enabled **only** for tilth CLI (`npx -y tilth`) — do not use bash for anything else
|
|
49
64
|
- Return absolute paths in final output
|
|
50
65
|
- Cite `file:line` evidence whenever possible
|
|
51
|
-
- **
|
|
66
|
+
- **Prefer tilth** for symbol search, then fall back to `grep` or `glob`
|
|
52
67
|
- Use LSP for precise navigation after finding candidate locations
|
|
53
68
|
- Stop when you can answer with concrete evidence
|
|
54
69
|
|
|
55
70
|
## Navigation Patterns
|
|
56
71
|
|
|
57
|
-
1. **
|
|
72
|
+
1. **tilth first, grep second**: `npx -y tilth <symbol> --scope src/` finds definitions AND usages in one call; fall back to `grep` if tilth is unavailable
|
|
58
73
|
2. **Don't re-read**: If you already read a file, reference what you learned — don't read it again
|
|
59
|
-
3. **Follow the chain**: definition → usages → callers via LSP findReferences
|
|
60
|
-
4. **Target ≤3 tool calls per symbol**:
|
|
74
|
+
3. **Follow the chain**: definition → usages → callers via tilth symbol search or LSP findReferences
|
|
75
|
+
4. **Target ≤3 tool calls per symbol**: tilth search → read section → done
|
|
61
76
|
|
|
62
77
|
## Workflow
|
|
63
78
|
|
|
64
|
-
1. `
|
|
65
|
-
2. `
|
|
66
|
-
3. `
|
|
67
|
-
4.
|
|
79
|
+
1. `npx -y tilth <symbol> --scope src/` or `grep`/`glob` to discover symbols and files
|
|
80
|
+
2. `npx -y tilth <file> --section <range>` or `read` for targeted file sections
|
|
81
|
+
3. `lsp` goToDefinition/findReferences for precise cross-file navigation when needed
|
|
82
|
+
4. `npx -y tilth --map --scope <dir>` for structural overview of unfamiliar areas
|
|
83
|
+
5. Return findings with file:line evidence
|
|
68
84
|
|
|
69
85
|
## Output
|
|
70
86
|
|
|
@@ -74,6 +90,7 @@ Find relevant files, symbols, and usage paths quickly for the caller.
|
|
|
74
90
|
|
|
75
91
|
## Failure Handling
|
|
76
92
|
|
|
93
|
+
- If tilth is unavailable, fall back to `grep` + `glob` + targeted `read`
|
|
77
94
|
- If LSP is unavailable, fall back to `grep` + targeted `read`
|
|
78
95
|
- If results are ambiguous, list assumptions and best candidate paths
|
|
79
96
|
- Never guess — mark uncertainty explicitly
|
|
@@ -147,12 +147,14 @@ Before claiming task done:
|
|
|
147
147
|
|
|
148
148
|
## Workflow
|
|
149
149
|
|
|
150
|
-
1. Read relevant files
|
|
150
|
+
1. Read relevant files (prefer `npx -y tilth <symbol> --scope src/` for fast symbol lookup)
|
|
151
151
|
2. Confirm scope is small and clear
|
|
152
152
|
3. Make surgical edits
|
|
153
153
|
4. Run validation (lint/typecheck/tests as applicable)
|
|
154
154
|
5. Report changed files with `file:line` references
|
|
155
155
|
|
|
156
|
+
**Code navigation:** Use tilth CLI for AST-aware search when available — see `tilth-cli` skill for syntax. Prefer `npx -y tilth <symbol> --scope <dir>` over grep for symbol definitions.
|
|
157
|
+
|
|
156
158
|
## Progress Updates
|
|
157
159
|
|
|
158
160
|
- For multi-step work, provide brief milestone updates
|
|
@@ -381,12 +381,14 @@ When planning under constraint:
|
|
|
381
381
|
|
|
382
382
|
## Workflow
|
|
383
383
|
|
|
384
|
-
1. **Ground**: Read bead artifacts (`prd.md`, `plan.md` if present)
|
|
384
|
+
1. **Ground**: Read bead artifacts (`prd.md`, `plan.md` if present); use `npx -y tilth --map --scope src/` for codebase overview
|
|
385
385
|
2. **Calibrate**: Understand goal, constraints, and success criteria
|
|
386
|
-
3. **Transform**: Launch parallel research (`task` subagents) when uncertainty remains; decompose into phases/tasks with explicit dependencies
|
|
386
|
+
3. **Transform**: Launch parallel research (`task` subagents) when uncertainty remains; use `npx -y tilth <symbol> --scope src/` for fast codebase discovery; decompose into phases/tasks with explicit dependencies
|
|
387
387
|
4. **Release**: Write actionable plan with exact file paths, commands, and verification
|
|
388
388
|
5. **Reset**: End with a concrete next command (`/ship <id>`, `/start <child-id>`, etc.)
|
|
389
389
|
|
|
390
|
+
**Code navigation:** Use tilth CLI for AST-aware search and `--map` for structural overview — see `tilth-cli` skill.
|
|
391
|
+
|
|
390
392
|
## Output
|
|
391
393
|
|
|
392
394
|
- Keep plan steps small and executable
|
|
@@ -193,11 +193,13 @@ return <div>No messages</div> // State exists but not used
|
|
|
193
193
|
|
|
194
194
|
## Workflow
|
|
195
195
|
|
|
196
|
-
1. Read changed files and nearby context
|
|
196
|
+
1. Read changed files and nearby context (prefer `npx -y tilth <symbol> --scope src/` for fast cross-file tracing)
|
|
197
197
|
2. Identify and validate findings by severity (P0, P1, P2, P3)
|
|
198
198
|
3. For each finding: explain why, when it happens, and impact
|
|
199
199
|
4. If no qualifying findings exist, say so explicitly
|
|
200
200
|
|
|
201
|
+
**Code navigation:** Use tilth CLI for AST-aware symbol search when tracing cross-file dependencies — see `tilth-cli` skill. Prefer `npx -y tilth <symbol> --scope <dir>` over grep for understanding call chains.
|
|
202
|
+
|
|
201
203
|
## Output
|
|
202
204
|
|
|
203
205
|
Structure:
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tilth-cli
|
|
3
|
+
description: AST-aware code navigation via tilth CLI. Use when subagents need structural code search, smart file reading, or codebase mapping — complements MCP tilth (which only the main agent can access).
|
|
4
|
+
version: 1.1.0
|
|
5
|
+
tags: [code-navigation, search, subagent]
|
|
6
|
+
dependencies: []
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# tilth CLI for Subagents
|
|
10
|
+
|
|
11
|
+
> **Why this exists:** tilth MCP tools (`tilth_tilth_search`, `tilth_tilth_read`, etc.) are only available to the main agent. Subagents cannot access MCP tools but CAN use Bash. This skill teaches subagents to call tilth directly from the command line.
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
- When subagents need structural code search (they cannot access tilth MCP tools)
|
|
16
|
+
- When you need `--map` for codebase skeleton (CLI-only feature, not in MCP)
|
|
17
|
+
- For any agent that has Bash access but not tilth MCP
|
|
18
|
+
|
|
19
|
+
## When NOT to Use
|
|
20
|
+
|
|
21
|
+
- Main agent should prefer tilth MCP tools — they have session dedup and hash-anchored editing
|
|
22
|
+
- For trivial lookups where grep/read suffices
|
|
23
|
+
|
|
24
|
+
## Prerequisites
|
|
25
|
+
|
|
26
|
+
tilth must be available. Use `npx -y tilth` if not globally installed:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx -y tilth <query> [options]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## How tilth CLI Works
|
|
33
|
+
|
|
34
|
+
tilth has **one command** with **smart auto-detection**. Pass a query and it figures out what to do:
|
|
35
|
+
|
|
36
|
+
| Query Pattern | Detection | Action |
|
|
37
|
+
| ------------- | -------------------------------- | ------------------------------------------------------- |
|
|
38
|
+
| `src/auth.ts` | File path (exists on disk) | **Read file** — smart outline for large, full for small |
|
|
39
|
+
| `handleAuth` | Symbol name (camelCase, etc.) | **Symbol search** — AST definitions + usages |
|
|
40
|
+
| `"*.test.ts"` | Glob pattern (contains `*`, `?`) | **File listing** — matched paths with token estimates |
|
|
41
|
+
| `"TODO fix"` | Text (doesn't match above) | **Text search** — literal content matches |
|
|
42
|
+
|
|
43
|
+
## Core Operations
|
|
44
|
+
|
|
45
|
+
### 1. Read a File
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx -y tilth src/index.ts # Smart view (outline if large, full if small)
|
|
49
|
+
npx -y tilth src/index.ts --full # Force full content
|
|
50
|
+
npx -y tilth src/index.ts --section 45-89 # Exact line range
|
|
51
|
+
npx -y tilth src/index.ts --section "## Config" # By heading
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Output: numbered lines (`N content`). Large files get a structural outline; use `--section` to drill into specific ranges.
|
|
55
|
+
|
|
56
|
+
### 2. Search for Symbols
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx -y tilth initCommand --scope src/ # Find definition + all usages
|
|
60
|
+
npx -y tilth handleAuth --scope src/auth/ # Scoped to subdirectory
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Returns: definitions first (with expanded source), then usages with context lines.
|
|
64
|
+
|
|
65
|
+
### 3. Search for Text
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx -y tilth "TODO" --scope src/ # Literal text search
|
|
69
|
+
npx -y tilth "version" --scope src/ # Finds all occurrences
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
tilth auto-detects text vs symbol. Identifiers (camelCase, snake_case) → symbol search. Multi-word or quoted strings → text search.
|
|
73
|
+
|
|
74
|
+
### 4. List Files (Glob)
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npx -y tilth "*.test.ts" --scope src/ # List test files
|
|
78
|
+
npx -y tilth "*.ts" --scope src/commands/ # List TS files in subdir
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Returns: matched file paths with token size estimates.
|
|
82
|
+
|
|
83
|
+
### 5. Codebase Map (CLI-Only)
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npx -y tilth --map --scope src/ # Structural skeleton
|
|
87
|
+
npx -y tilth --map --scope . # Whole project
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Returns: directory tree with exported symbols per file. **CLI-only** — not available in MCP mode.
|
|
91
|
+
|
|
92
|
+
## Available Flags
|
|
93
|
+
|
|
94
|
+
| Flag | Purpose | Example |
|
|
95
|
+
| ------------------- | -------------------------------------- | -------------------- |
|
|
96
|
+
| `--scope <DIR>` | Restrict search to directory | `--scope src/` |
|
|
97
|
+
| `--section <RANGE>` | Line range or heading for file reads | `--section 45-89` |
|
|
98
|
+
| `--full` | Force full file content (skip outline) | `--full` |
|
|
99
|
+
| `--budget <N>` | Max tokens in response | `--budget 2000` |
|
|
100
|
+
| `--json` | Machine-readable JSON output | `--json` |
|
|
101
|
+
| `--map` | Generate codebase structure map | `--map --scope src/` |
|
|
102
|
+
|
|
103
|
+
**Note:** `--kind`, `--deps`, `--expand`, and multi-symbol comma syntax are MCP-only features. The CLI does not support them.
|
|
104
|
+
|
|
105
|
+
## MCP vs CLI Comparison
|
|
106
|
+
|
|
107
|
+
| Feature | MCP (main agent) | CLI (all agents) |
|
|
108
|
+
| ------------------------------------- | ---------------- | ------------------- |
|
|
109
|
+
| Session dedup (`[shown earlier]`) | Yes | No |
|
|
110
|
+
| Hash-anchored editing (`tilth_edit`) | Yes | No |
|
|
111
|
+
| Blast-radius analysis (`tilth_deps`) | Yes | No |
|
|
112
|
+
| Multi-symbol search (`sym1,sym2`) | Yes | No |
|
|
113
|
+
| `--kind` flag (content/regex/callers) | Yes | No |
|
|
114
|
+
| `--expand` control | Yes | No |
|
|
115
|
+
| `--map` codebase skeleton | No | Yes |
|
|
116
|
+
| Subagent access | No (main only) | Yes (any with Bash) |
|
|
117
|
+
| Process overhead | Once (~17ms) | Per call (~17ms) |
|
|
118
|
+
|
|
119
|
+
## Output Format Examples
|
|
120
|
+
|
|
121
|
+
### File read (small file)
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
# src/config.ts (45 lines, ~380 tokens) [full]
|
|
125
|
+
|
|
126
|
+
1 import { z } from 'zod';
|
|
127
|
+
2 export const schema = z.object({
|
|
128
|
+
...
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Symbol search
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
# Search: "initCommand" in src/ — 6 matches (2 definitions, 4 usages)
|
|
135
|
+
|
|
136
|
+
### Definitions (2)
|
|
137
|
+
## commands/init.ts:515-961 [definition]
|
|
138
|
+
→ [515-961] export async function initCommand(...)
|
|
139
|
+
|
|
140
|
+
### Usages — same package (4)
|
|
141
|
+
## index.ts:10 [usage]
|
|
142
|
+
→ [10] import { initCommand } from "./commands/init.js";
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Codebase map
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
# Map: src/ (depth 3)
|
|
149
|
+
index.ts (~1214 tokens)
|
|
150
|
+
commands/
|
|
151
|
+
init.ts: initCommand, detectMode, ...
|
|
152
|
+
upgrade.ts: checkVersion, upgradeCommand, ...
|
|
153
|
+
utils/
|
|
154
|
+
errors.ts: resolveOpencodePath, showError, ...
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Usage Tips
|
|
158
|
+
|
|
159
|
+
- **Search first, read second** — symbol search finds definitions AND shows expanded source
|
|
160
|
+
- **Use `--section` for large files** — outline tells you line ranges; drill in with `--section 44-89`
|
|
161
|
+
- **Use `--scope`** to narrow searches — avoids scanning irrelevant directories
|
|
162
|
+
- **Use `--budget`** when you need concise output (limits token count)
|
|
163
|
+
- **~17ms per call** — fast enough for interactive use, but avoid unnecessary repeated calls
|
|
164
|
+
|
|
165
|
+
## Example Subagent Dispatch
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
task({
|
|
169
|
+
subagent_type: "general",
|
|
170
|
+
prompt: `Use tilth CLI for code navigation (run via: npx -y tilth).
|
|
171
|
+
|
|
172
|
+
Find the definition of \`initCommand\` and understand how it's called:
|
|
173
|
+
npx -y tilth initCommand --scope src/
|
|
174
|
+
|
|
175
|
+
Then read the relevant file section:
|
|
176
|
+
npx -y tilth src/commands/init.ts --section 515-600
|
|
177
|
+
|
|
178
|
+
[rest of task instructions]`,
|
|
179
|
+
});
|
|
180
|
+
```
|