opencode-codebase-index 0.14.0 ā 0.16.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 +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +2 -2
- package/README.md +73 -12
- package/dist/cli.cjs +1782 -607
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1781 -596
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +1610 -533
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1606 -519
- package/dist/index.js.map +1 -1
- package/dist/pi-extension.cjs +1396 -311
- package/dist/pi-extension.cjs.map +1 -1
- package/dist/pi-extension.js +1395 -300
- package/dist/pi-extension.js.map +1 -1
- package/hooks/hooks.json +2 -2
- 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 +11 -8
- package/skills/codebase-search/SKILL.md +9 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codebase-index",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Semantic code search and codebase graph tools for Codex",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Kenneth",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"termsOfServiceURL": "https://github.com/Helweg/opencode-codebase-index/blob/main/LICENSE",
|
|
38
38
|
"brandColor": "#3B82F6",
|
|
39
39
|
"defaultPrompt": [
|
|
40
|
-
"
|
|
40
|
+
"For repository questions, use index_status when readiness is unknown, then call codebase_context before shell search or broad file reads."
|
|
41
41
|
]
|
|
42
42
|
}
|
|
43
43
|
}
|
package/README.md
CHANGED
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://www.npmjs.com/package/opencode-codebase-index)
|
|
6
6
|
[](https://github.com/Helweg/opencode-codebase-index/actions)
|
|
7
|
-
[](https://nodejs.org/)
|
|
8
8
|
|
|
9
9
|
> **Stop grepping for concepts. Start searching for meaning.**
|
|
10
10
|
|
|
11
|
-
**opencode-codebase-index** brings semantic understanding to your [OpenCode](https://opencode.ai), [Pi](https://pi.dev), Codex, and MCP-compatible workflows. Instead of guessing function names or grepping for keywords, ask your codebase questions in plain English.
|
|
11
|
+
**opencode-codebase-index** brings semantic understanding to your [OpenCode](https://opencode.ai), [Jcode](https://github.com/1jehuang/jcode), [Pi](https://pi.dev), Codex, and MCP-compatible workflows. Instead of guessing function names or grepping for keywords, ask your codebase questions in plain English.
|
|
12
12
|
|
|
13
13
|
## š Quick Navigation
|
|
14
14
|
|
|
15
15
|
- [ā” Quick Start](#-quick-start)
|
|
16
|
+
- [š§ Jcode](#-jcode)
|
|
16
17
|
- [š„§ Pi Package](#-pi-package)
|
|
17
18
|
- [š§© Codex Plugin](#-codex-plugin)
|
|
18
19
|
- [š§© Claude Code Plugin](#-claude-code-plugin)
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
## š Choose Your Path
|
|
30
31
|
|
|
31
32
|
- **I want to try it now** ā go to [Quick Start](#-quick-start)
|
|
33
|
+
- **I use Jcode** ā go to [Jcode](#-jcode)
|
|
32
34
|
- **I use Pi** ā go to [Pi Package](#-pi-package)
|
|
33
35
|
- **I use Cursor/Claude Code/Windsurf** ā go to [MCP Server setup](#-mcp-server-cursor-claude-code-windsurf-etc)
|
|
34
36
|
- **Iām comparing tools and workflows** ā go to [When to Use What](#-when-to-use-what)
|
|
@@ -42,11 +44,14 @@
|
|
|
42
44
|
- šæ **Branch-Aware**: Seamlessly handles git branch switches ā reuses embeddings, filters stale results.
|
|
43
45
|
- š **Privacy Focused**: Your vector index is stored locally in your project.
|
|
44
46
|
- š **Model Agnostic**: Works out-of-the-box with GitHub Copilot, OpenAI, Gemini, or local Ollama models.
|
|
47
|
+
- š§ **Jcode Host**: One global MCP configuration follows each Jcode session into its active repository.
|
|
45
48
|
- š„§ **Pi Package**: First-class Pi extension and skill package with native tools.
|
|
46
49
|
- š **MCP Server**: Use with Cursor, Claude Code, Windsurf, or any MCP-compatible client ā index once, search from anywhere.
|
|
47
50
|
|
|
48
51
|
## ā” Quick Start
|
|
49
52
|
|
|
53
|
+
Requires Node.js 20 or newer.
|
|
54
|
+
|
|
50
55
|
1. **Install the plugin**
|
|
51
56
|
```bash
|
|
52
57
|
npm install opencode-codebase-index
|
|
@@ -67,6 +72,37 @@
|
|
|
67
72
|
4. **Start Searching**
|
|
68
73
|
Ask:
|
|
69
74
|
> "Find the function that handles credit card validation errors"
|
|
75
|
+
|
|
76
|
+
## š§ Jcode
|
|
77
|
+
|
|
78
|
+
Jcode v0.56.0 and newer starts non-shared MCP servers in each session's working directory. Configure the server once in `~/.jcode/mcp.json` and it will index the repository where each Jcode session is running.
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"servers": {
|
|
83
|
+
"codebase-index": {
|
|
84
|
+
"command": "npx",
|
|
85
|
+
"args": [
|
|
86
|
+
"-y",
|
|
87
|
+
"--package",
|
|
88
|
+
"opencode-codebase-index@latest",
|
|
89
|
+
"opencode-codebase-index-mcp",
|
|
90
|
+
"--host",
|
|
91
|
+
"jcode"
|
|
92
|
+
],
|
|
93
|
+
"env": {},
|
|
94
|
+
"shared": false
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Do not add a fixed `--project` argument. Jcode supplies the active session directory as the MCP process working directory. `shared: false` gives every repository session its own indexer process and prevents cross-repository state from being shared accidentally.
|
|
101
|
+
|
|
102
|
+
Jcode uses the neutral `.codebase-index/` project storage and falls back to existing OpenCode state when present. Restart Jcode after changing `~/.jcode/mcp.json`, then use `index_codebase`, `index_status`, `codebase_peek`, or `codebase_search`.
|
|
103
|
+
|
|
104
|
+
The explicit `@latest` keeps `npx` on the published package even when Jcode is opened inside an `opencode-codebase-index` source checkout. For local development of this package instead, run `npm run build:ts && npm run dev:link-mcp` first.
|
|
105
|
+
|
|
70
106
|
## š„§ Pi Package
|
|
71
107
|
|
|
72
108
|
Install as a Pi package to get first-class `codebase_search`, `index_codebase`, call graph, PR impact, and knowledge-base tools plus the `codebase-search` skill.
|
|
@@ -79,6 +115,8 @@ pi install ./path/to/opencode-codebase-index
|
|
|
79
115
|
|
|
80
116
|
Pi uses the neutral `.codebase-index/` project storage and falls back to existing OpenCode state when present.
|
|
81
117
|
|
|
118
|
+
The Pi extension injects lightweight routing guidance and exposes `codebase_context` as its preferred first repository tool. It routes conceptual discovery, known-symbol definitions, and dependency paths before broad shell search or file reads.
|
|
119
|
+
|
|
82
120
|
## š§© Codex Plugin
|
|
83
121
|
Install once for Codex threads and get skill guidance plus MCP tools in one manifest.
|
|
84
122
|
|
|
@@ -108,6 +146,8 @@ npm run dev:link-mcp
|
|
|
108
146
|
|
|
109
147
|
After that, the normal `.mcp.json` command also works when Codex starts the plugin from this repository.
|
|
110
148
|
|
|
149
|
+
The native Codex plugin is important: its session hook and `codebase-search` skill tell Codex to use `index_status` and `codebase_context` before shell exploration. A bare MCP configuration does not provide the same selection reliability. Current Codex `exec` releases may cancel MCP calls in non-interactive mode while waiting for an app-tool approval; use an interactive Codex thread to approve the tool call. This is a Codex client limitation, not an MCP server failure.
|
|
150
|
+
|
|
111
151
|
## š§© Claude Code Plugin
|
|
112
152
|
Install once for Claude Code sessions and get skill guidance plus MCP tools in one manifest.
|
|
113
153
|
|
|
@@ -189,7 +229,19 @@ Use the same semantic search from any MCP-compatible client. Index once, search
|
|
|
189
229
|
npx -y --package opencode-codebase-index opencode-codebase-index-mcp
|
|
190
230
|
```
|
|
191
231
|
|
|
192
|
-
The MCP server exposes all
|
|
232
|
+
The MCP server exposes all 13 tools (`codebase_context`, `codebase_search`, `codebase_peek`, `find_similar`, `implementation_lookup`, `call_graph`, `call_graph_path`, `pr_impact`, `index_codebase`, `index_status`, `index_health_check`, `index_metrics`, `index_logs`) and 5 prompts (`search`, `find`, `definition`, `index`, `status`).
|
|
233
|
+
|
|
234
|
+
The tools carry self-routing descriptions so clients can choose the lightweight path without relying on separate documentation:
|
|
235
|
+
|
|
236
|
+
1. `codebase_context` as the preferred single entry point for repository questions
|
|
237
|
+
2. `index_status` when index readiness is unknown
|
|
238
|
+
3. `codebase_peek` for direct low-token conceptual discovery
|
|
239
|
+
4. `implementation_lookup` for direct known-symbol definition lookup
|
|
240
|
+
5. `codebase_search` only when full semantic content is needed
|
|
241
|
+
6. `grep` for exact identifiers or exhaustive matches
|
|
242
|
+
7. `call_graph` / `call_graph_path` for direct graph queries
|
|
243
|
+
|
|
244
|
+
The server also publishes this workflow through the standard MCP initialization `instructions` field. Client behavior remains client-controlled: an MCP server can describe and recommend its tools, but cannot force an agent host to read server instructions or invoke a tool before filesystem search. Clients that ignore MCP instructions still receive the routing guidance in each tool description.
|
|
193
245
|
|
|
194
246
|
The MCP dependencies (`@modelcontextprotocol/sdk`, `zod`) ship with the package so published `npx --package opencode-codebase-index` launches work in clean MCP clients.
|
|
195
247
|
|
|
@@ -218,9 +270,9 @@ src/api/checkout.ts:89 (Route handler for /pay)
|
|
|
218
270
|
|
|
219
271
|
| Scenario | Tool | Why |
|
|
220
272
|
|----------|------|-----|
|
|
221
|
-
| Don't know the function name | `
|
|
222
|
-
| Exploring unfamiliar codebase | `
|
|
223
|
-
| Just need to find locations | `codebase_peek` | Returns metadata only, saves ~90% tokens |
|
|
273
|
+
| Don't know the function name | `codebase_context` (MCP) | Routes conceptual questions to low-token discovery first |
|
|
274
|
+
| Exploring unfamiliar codebase | `codebase_context` (MCP) | Discovers related code and then guides to definitions or graph queries |
|
|
275
|
+
| Just need to find locations | `codebase_peek` (or `codebase_context`) | Returns metadata only, saves ~90% tokens |
|
|
224
276
|
| Need the authoritative definition site | `implementation_lookup` | Prioritizes real implementation definitions over docs/tests |
|
|
225
277
|
| Understand code flow | `call_graph` | Find callers/callees of any function |
|
|
226
278
|
| Trace dependency paths | `call_graph_path` | Find the shortest known call path between two symbols |
|
|
@@ -228,7 +280,7 @@ src/api/checkout.ts:89 (Route handler for /pay)
|
|
|
228
280
|
| Need ALL matches | `grep` | Semantic returns top N only |
|
|
229
281
|
| Mixed discovery + precision | `/find` (hybrid) | Best of both worlds |
|
|
230
282
|
|
|
231
|
-
**Rule of thumb**: `
|
|
283
|
+
**Rule of thumb**: `codebase_context` to route discovery first. Then `Read` to examine exact content and `grep` for precision. For symbol-definition questions, use `implementation_lookup` first.
|
|
232
284
|
|
|
233
285
|
## š§ OMO CodeGraph Compatibility
|
|
234
286
|
|
|
@@ -245,7 +297,7 @@ Recent OMO releases include a built-in CodeGraph MCP and make it part of the def
|
|
|
245
297
|
|
|
246
298
|
Recommended OMO workflow:
|
|
247
299
|
|
|
248
|
-
1. Start broad with `
|
|
300
|
+
1. Start broad with `codebase_context` when the prompt is conceptual, such as "where is auth enforced?" or "payment validation flow".
|
|
249
301
|
2. Use `implementation_lookup` once you have a symbol or concept that should resolve to a definition.
|
|
250
302
|
3. Use OMO CodeGraph, `call_graph`, or `call_graph_path` after locating the relevant symbol to check blast radius and dependency flow.
|
|
251
303
|
4. Keep `grep` for exact identifiers and exhaustive text matches.
|
|
@@ -309,8 +361,8 @@ graph TD
|
|
|
309
361
|
|
|
310
362
|
**Default File Patterns**:
|
|
311
363
|
```
|
|
312
|
-
**/*.{ts,tsx,js,jsx,mjs,cjs} **/*.{py,pyi}
|
|
313
|
-
**/*.{go,rs,java,kt,scala}
|
|
364
|
+
**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs} **/*.{py,pyi}
|
|
365
|
+
**/*.{go,rs,java,cs,kt,scala} **/*.{c,cpp,cc,cxx,h,hpp,hxx}
|
|
314
366
|
**/*.{rb,php,inc,swift} **/*.{vue,svelte,astro}
|
|
315
367
|
**/*.{sql,graphql,proto} **/*.{yaml,yml,toml}
|
|
316
368
|
**/*.{md,mdx} **/*.{sh,bash,zsh}
|
|
@@ -388,9 +440,18 @@ The following files/folders are excluded from indexing by default:
|
|
|
388
440
|
|
|
389
441
|
The plugin exposes these tools to the OpenCode agent:
|
|
390
442
|
|
|
443
|
+
`codebase_context` is MCP-server-only.
|
|
444
|
+
|
|
445
|
+
### `codebase_context`
|
|
446
|
+
*MCP-only entrypoint for combined routing*
|
|
447
|
+
**Preferred first tool for repository questions.** Routes to the lowest-token indexed operation that matches the query: conceptual discovery, definition lookup, callers/callees, or symbol-to-symbol paths.
|
|
448
|
+
- **Use for**: New questions about behavior, locating symbols, or tracing direct call relationships.
|
|
449
|
+
- **Example**: `"Where is the payment validation logic?"`
|
|
450
|
+
- **Workflow**: If the query is conceptual, it may return locations first. For exact behavior text, follow with `codebase_search`.
|
|
451
|
+
|
|
391
452
|
### `codebase_search`
|
|
392
|
-
**
|
|
393
|
-
- **Use for**: Discovery
|
|
453
|
+
**Behavioral semantic retrieval with full content.** Searches code by describing behavior.
|
|
454
|
+
- **Use for**: Discovery when you already want full matching snippets and are ready to inspect implementation text.
|
|
394
455
|
- **Example**: `"find the middleware that sanitizes input"`
|
|
395
456
|
- **Ranking path**: hybrid retrieval ā fusion (`search.fusionStrategy`) ā deterministic rerank (`search.rerankTopN`) ā filters
|
|
396
457
|
- **Blame filters**: when `indexing.gitBlame.enabled` is `true`, filter with `blameAuthor`, `blameSha`, or `blameSince`.
|