opencode-codebase-index 0.11.0 → 0.13.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/.claude-plugin/marketplace.json +16 -0
- package/.claude-plugin/plugin.json +29 -0
- package/.codex-plugin/plugin.json +43 -0
- package/.mcp.json +8 -0
- package/README.md +143 -4
- package/commands/call-graph.md +9 -5
- package/commands/pr-impact.md +23 -0
- package/commands/visualize.md +30 -0
- package/dist/cli.cjs +4449 -700
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +4439 -704
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +9512 -7957
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8029 -6474
- package/dist/index.js.map +1 -1
- package/dist/pi-extension.cjs +9594 -0
- package/dist/pi-extension.cjs.map +1 -0
- package/dist/pi-extension.js +9586 -0
- package/dist/pi-extension.js.map +1 -0
- package/hooks/hooks.json +17 -0
- package/native/codebase-index-native.darwin-arm64.node +0 -0
- package/native/codebase-index-native.darwin-x64.node +0 -0
- package/native/codebase-index-native.linux-arm64-gnu.node +0 -0
- package/native/codebase-index-native.linux-x64-gnu.node +0 -0
- package/native/codebase-index-native.win32-x64-msvc.node +0 -0
- package/package.json +29 -15
- package/skill/SKILL.md +6 -3
- package/skills/codebase-search/SKILL.md +41 -0
package/hooks/hooks.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "startup|resume|clear|compact",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "printf '\nUse codebase_peek for quick location discovery, then codebase_search for implementation details. Use index_status before searching on first run.\\n'",
|
|
10
|
+
"commandWindows": "Write-Output 'Use codebase_peek for quick location discovery, then codebase_search for implementation details. Use index_status before searching on first run.'",
|
|
11
|
+
"statusMessage": "Codebase Index ready"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-codebase-index",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Semantic codebase indexing and search for OpenCode - find code by meaning, not just keywords",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,7 +28,9 @@
|
|
|
28
28
|
"vector-search",
|
|
29
29
|
"embeddings",
|
|
30
30
|
"tree-sitter",
|
|
31
|
-
"ai-coding"
|
|
31
|
+
"ai-coding",
|
|
32
|
+
"pi-package",
|
|
33
|
+
"pi"
|
|
32
34
|
],
|
|
33
35
|
"engines": {
|
|
34
36
|
"node": ">=18.0.0"
|
|
@@ -38,6 +40,7 @@
|
|
|
38
40
|
"build:ts": "tsup",
|
|
39
41
|
"build:native": "cd native && cargo build --release && napi build --release --platform",
|
|
40
42
|
"build:native:all": "cd native && napi build --release --platform --target x86_64-apple-darwin --target aarch64-apple-darwin --target x86_64-unknown-linux-gnu --target aarch64-unknown-linux-gnu --target x86_64-pc-windows-msvc",
|
|
43
|
+
"visualize": "node dist/cli.js visualize",
|
|
41
44
|
"dev": "tsup --watch",
|
|
42
45
|
"eval": "npx tsx src/cli.ts eval run",
|
|
43
46
|
"eval:smoke": "npx tsx src/cli.ts eval run --config .github/eval-config.json --reindex --dataset benchmarks/golden/small.json",
|
|
@@ -57,7 +60,12 @@
|
|
|
57
60
|
"dist",
|
|
58
61
|
"native/*.node",
|
|
59
62
|
"skill",
|
|
60
|
-
"commands"
|
|
63
|
+
"commands",
|
|
64
|
+
".codex-plugin",
|
|
65
|
+
".claude-plugin",
|
|
66
|
+
".mcp.json",
|
|
67
|
+
"skills",
|
|
68
|
+
"hooks"
|
|
61
69
|
],
|
|
62
70
|
"napi": {
|
|
63
71
|
"binaryName": "codebase-index-native",
|
|
@@ -70,16 +78,19 @@
|
|
|
70
78
|
]
|
|
71
79
|
},
|
|
72
80
|
"dependencies": {
|
|
81
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
73
82
|
"@opencode-ai/plugin": "~1.3.13",
|
|
74
83
|
"chokidar": "^5.0.0",
|
|
75
84
|
"ignore": "^7.0.5",
|
|
76
85
|
"p-queue": "^9.1.1",
|
|
77
86
|
"p-retry": "^7.1.1",
|
|
78
|
-
"tiktoken": "^1.0.15"
|
|
87
|
+
"tiktoken": "^1.0.15",
|
|
88
|
+
"typebox": "^1.3.2",
|
|
89
|
+
"zod": "^4.4.3"
|
|
79
90
|
},
|
|
80
91
|
"devDependencies": {
|
|
92
|
+
"@earendil-works/pi-coding-agent": "^0.80.2",
|
|
81
93
|
"@eslint/js": "^9.39.4",
|
|
82
|
-
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
83
94
|
"@napi-rs/cli": "^3.6.0",
|
|
84
95
|
"@types/node": "^25.5.2",
|
|
85
96
|
"@vitest/coverage-v8": "^4.1.2",
|
|
@@ -87,15 +98,14 @@
|
|
|
87
98
|
"tsup": "^8.1.0",
|
|
88
99
|
"typescript": "^5.9.3",
|
|
89
100
|
"typescript-eslint": "^8.58.0",
|
|
90
|
-
"vitest": "^4.1.2"
|
|
91
|
-
"zod": "^3.25.76"
|
|
101
|
+
"vitest": "^4.1.2"
|
|
92
102
|
},
|
|
93
103
|
"overrides": {
|
|
94
104
|
"@hono/node-server": "1.19.14",
|
|
95
105
|
"brace-expansion": "5.0.6",
|
|
96
106
|
"express-rate-limit": "8.5.2",
|
|
97
107
|
"fast-uri": "3.1.2",
|
|
98
|
-
"hono": "4.12.
|
|
108
|
+
"hono": "4.12.25",
|
|
99
109
|
"ip-address": "10.2.0",
|
|
100
110
|
"postcss": "8.5.15",
|
|
101
111
|
"qs": "6.15.2",
|
|
@@ -103,19 +113,23 @@
|
|
|
103
113
|
"esbuild": "0.28.1"
|
|
104
114
|
},
|
|
105
115
|
"peerDependencies": {
|
|
106
|
-
"@
|
|
107
|
-
"@opencode-ai/plugin": "^1.0.0"
|
|
108
|
-
"zod": "^3.0.0"
|
|
116
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
117
|
+
"@opencode-ai/plugin": "^1.0.0"
|
|
109
118
|
},
|
|
110
119
|
"peerDependenciesMeta": {
|
|
111
|
-
"@modelcontextprotocol/sdk": {
|
|
112
|
-
"optional": true
|
|
113
|
-
},
|
|
114
120
|
"@opencode-ai/plugin": {
|
|
115
121
|
"optional": true
|
|
116
122
|
},
|
|
117
|
-
"
|
|
123
|
+
"@earendil-works/pi-coding-agent": {
|
|
118
124
|
"optional": true
|
|
119
125
|
}
|
|
126
|
+
},
|
|
127
|
+
"pi": {
|
|
128
|
+
"extensions": [
|
|
129
|
+
"./dist/pi-extension.js"
|
|
130
|
+
],
|
|
131
|
+
"skills": [
|
|
132
|
+
"./skills"
|
|
133
|
+
]
|
|
120
134
|
}
|
|
121
135
|
}
|
package/skill/SKILL.md
CHANGED
|
@@ -21,6 +21,8 @@ The indexed codebase contains **two types of content**:
|
|
|
21
21
|
| Need to see actual code | `codebase_search` | Returns full code content |
|
|
22
22
|
| Find duplicates/patterns | `find_similar` | Given code snippet → similar code |
|
|
23
23
|
| Understand code flow | `call_graph` | Find callers/callees of any function |
|
|
24
|
+
| Trace dependency paths | `call_graph_path` | Find a shortest known path between two symbols |
|
|
25
|
+
| Analyze PR blast radius | `pr_impact` | Find affected symbols, communities, hub nodes, and risk |
|
|
24
26
|
| Don't know function/class names | `codebase_peek` or `codebase_search` | Natural language → code |
|
|
25
27
|
| Know exact identifier names | `grep` | Faster, more precise |
|
|
26
28
|
| Need ALL occurrences | `grep` | Semantic returns top N only |
|
|
@@ -54,10 +56,11 @@ Suggest: "知识库中未找到相关信息,是否添加相关文档文件夹
|
|
|
54
56
|
|
|
55
57
|
## Recommended Workflow
|
|
56
58
|
|
|
57
|
-
1. **
|
|
58
|
-
2. **
|
|
59
|
+
1. **Locate by meaning first**: `codebase_peek("authentication flow")` → get likely locations before grep or graph tools
|
|
60
|
+
2. **Search with content**: `codebase_search("ADC channels ESP32")` → inspect implementation or knowledge-base matches
|
|
59
61
|
3. **Read what matters**: `Read` the specific files you need
|
|
60
|
-
4. **
|
|
62
|
+
4. **Trace structure after discovery**: `call_graph`, `call_graph_path`, `pr_impact`, or OMO CodeGraph once you know the relevant symbol
|
|
63
|
+
5. **Drill down with grep**: `grep "validateToken"` for exact matches
|
|
61
64
|
|
|
62
65
|
## Tools
|
|
63
66
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codebase-search
|
|
3
|
+
description: Semantic code and documentation search by meaning for Pi and Codex workflows. Use codebase_peek to find WHERE code is first, then codebase_search for implementation details.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Codebase Search Skill
|
|
7
|
+
|
|
8
|
+
Use this skill when you need local repository knowledge before web lookup.
|
|
9
|
+
|
|
10
|
+
## Core workflow
|
|
11
|
+
|
|
12
|
+
1. `codebase_peek(query, ...)` to find likely locations quickly with metadata-only results.
|
|
13
|
+
2. `codebase_search(query, ...)` when you need full code context.
|
|
14
|
+
3. `call_graph(name, direction)` when you need callers/callees after locating a symbol.
|
|
15
|
+
4. `find_similar(code)` for duplicate patterns and refactor planning.
|
|
16
|
+
5. `implementation_lookup(query)` when you need the authoritative definition location.
|
|
17
|
+
|
|
18
|
+
If results are weak, run `index_status` (check readiness) and `index_codebase`.
|
|
19
|
+
|
|
20
|
+
## Tool Priority
|
|
21
|
+
|
|
22
|
+
- `codebase_peek` for discovery (fastest, cheap tokens).
|
|
23
|
+
- `codebase_search` for exact implementation review.
|
|
24
|
+
- `find_similar` for pattern matching and duplication.
|
|
25
|
+
- `call_graph` and `call_graph_path` for execution flow.
|
|
26
|
+
- `index_codebase` (force/estimate/verbose) for first-time or stale indexes.
|
|
27
|
+
- `index_status`, `index_health_check`, `index_metrics`, `index_logs` for operational checks.
|
|
28
|
+
|
|
29
|
+
## Suggested Commands
|
|
30
|
+
|
|
31
|
+
1. `codebase_peek("payment processing flow")`
|
|
32
|
+
2. `codebase_search("payment processing flow")`
|
|
33
|
+
3. `call_graph("chargeCard", "callees")`
|
|
34
|
+
4. `find_similar("function validate(data)")`
|
|
35
|
+
5. `implementation_lookup("validate")`
|
|
36
|
+
|
|
37
|
+
## Additional Notes
|
|
38
|
+
|
|
39
|
+
- Use `grep` for exact identifiers and tiny, deterministic lookups.
|
|
40
|
+
- Use `websearch` only when local tools return no results and docs are likely missing.
|
|
41
|
+
- Prefer `codebase_peek` before `codebase_search` to avoid high token usage.
|