opencode-codebase-index 0.15.0 → 0.17.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 +35 -8
- package/dist/cli.cjs +2992 -1824
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +3003 -1829
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +928 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +935 -14
- package/dist/index.js.map +1 -1
- package/dist/pi-extension.cjs +953 -19
- package/dist/pi-extension.cjs.map +1 -1
- package/dist/pi-extension.js +960 -20
- 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.win32-x64-msvc.node +0 -0
- package/package.json +3 -1
- 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.17.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
|
@@ -115,6 +115,8 @@ pi install ./path/to/opencode-codebase-index
|
|
|
115
115
|
|
|
116
116
|
Pi uses the neutral `.codebase-index/` project storage and falls back to existing OpenCode state when present.
|
|
117
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
|
+
|
|
118
120
|
## 🧩 Codex Plugin
|
|
119
121
|
Install once for Codex threads and get skill guidance plus MCP tools in one manifest.
|
|
120
122
|
|
|
@@ -144,6 +146,8 @@ npm run dev:link-mcp
|
|
|
144
146
|
|
|
145
147
|
After that, the normal `.mcp.json` command also works when Codex starts the plugin from this repository.
|
|
146
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
|
+
|
|
147
151
|
## 🧩 Claude Code Plugin
|
|
148
152
|
Install once for Claude Code sessions and get skill guidance plus MCP tools in one manifest.
|
|
149
153
|
|
|
@@ -225,7 +229,21 @@ Use the same semantic search from any MCP-compatible client. Index once, search
|
|
|
225
229
|
npx -y --package opencode-codebase-index opencode-codebase-index-mcp
|
|
226
230
|
```
|
|
227
231
|
|
|
228
|
-
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`). Native OpenCode and Pi integrations expose the same `codebase_context` entry point.
|
|
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
|
+
`codebase_context` accepts a `tokenBudget` from 128 to 4000 tokens, defaulting to 1200. The hard cap is counted with the `cl100k_base` tokenizer, including multilingual and emoji text. It returns deterministic location evidence rather than source bodies, removes overlapping same-file results, diversifies evidence across files, and distinguishes duplicates, result-limit exclusions, and token-budget omissions. Increase the budget only when broader location coverage is useful. Use `implementation_lookup`, `codebase_search`, or a targeted file read for the exact source after selecting a location.
|
|
245
|
+
|
|
246
|
+
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.
|
|
229
247
|
|
|
230
248
|
The MCP dependencies (`@modelcontextprotocol/sdk`, `zod`) ship with the package so published `npx --package opencode-codebase-index` launches work in clean MCP clients.
|
|
231
249
|
|
|
@@ -254,9 +272,9 @@ src/api/checkout.ts:89 (Route handler for /pay)
|
|
|
254
272
|
|
|
255
273
|
| Scenario | Tool | Why |
|
|
256
274
|
|----------|------|-----|
|
|
257
|
-
| Don't know the function name | `
|
|
258
|
-
| Exploring unfamiliar codebase | `
|
|
259
|
-
| Just need to find locations | `codebase_peek` | Returns metadata only, saves ~90% tokens |
|
|
275
|
+
| Don't know the function name | `codebase_context` | Routes conceptual questions to a bounded, low-token evidence pack |
|
|
276
|
+
| Exploring unfamiliar codebase | `codebase_context` | Available natively in OpenCode and Pi, and through MCP for other clients |
|
|
277
|
+
| Just need to find locations | `codebase_peek` (or `codebase_context`) | Returns metadata only, saves ~90% tokens |
|
|
260
278
|
| Need the authoritative definition site | `implementation_lookup` | Prioritizes real implementation definitions over docs/tests |
|
|
261
279
|
| Understand code flow | `call_graph` | Find callers/callees of any function |
|
|
262
280
|
| Trace dependency paths | `call_graph_path` | Find the shortest known call path between two symbols |
|
|
@@ -264,7 +282,7 @@ src/api/checkout.ts:89 (Route handler for /pay)
|
|
|
264
282
|
| Need ALL matches | `grep` | Semantic returns top N only |
|
|
265
283
|
| Mixed discovery + precision | `/find` (hybrid) | Best of both worlds |
|
|
266
284
|
|
|
267
|
-
**Rule of thumb**: `
|
|
285
|
+
**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.
|
|
268
286
|
|
|
269
287
|
## 🧭 OMO CodeGraph Compatibility
|
|
270
288
|
|
|
@@ -281,7 +299,7 @@ Recent OMO releases include a built-in CodeGraph MCP and make it part of the def
|
|
|
281
299
|
|
|
282
300
|
Recommended OMO workflow:
|
|
283
301
|
|
|
284
|
-
1. Start broad with `
|
|
302
|
+
1. Start broad with `codebase_context` when the prompt is conceptual, such as "where is auth enforced?" or "payment validation flow".
|
|
285
303
|
2. Use `implementation_lookup` once you have a symbol or concept that should resolve to a definition.
|
|
286
304
|
3. Use OMO CodeGraph, `call_graph`, or `call_graph_path` after locating the relevant symbol to check blast radius and dependency flow.
|
|
287
305
|
4. Keep `grep` for exact identifiers and exhaustive text matches.
|
|
@@ -424,9 +442,18 @@ The following files/folders are excluded from indexing by default:
|
|
|
424
442
|
|
|
425
443
|
The plugin exposes these tools to the OpenCode agent:
|
|
426
444
|
|
|
445
|
+
`codebase_context` is MCP-server-only.
|
|
446
|
+
|
|
447
|
+
### `codebase_context`
|
|
448
|
+
*MCP-only entrypoint for combined routing*
|
|
449
|
+
**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.
|
|
450
|
+
- **Use for**: New questions about behavior, locating symbols, or tracing direct call relationships.
|
|
451
|
+
- **Example**: `"Where is the payment validation logic?"`
|
|
452
|
+
- **Workflow**: If the query is conceptual, it may return locations first. For exact behavior text, follow with `codebase_search`.
|
|
453
|
+
|
|
427
454
|
### `codebase_search`
|
|
428
|
-
**
|
|
429
|
-
- **Use for**: Discovery
|
|
455
|
+
**Behavioral semantic retrieval with full content.** Searches code by describing behavior.
|
|
456
|
+
- **Use for**: Discovery when you already want full matching snippets and are ready to inspect implementation text.
|
|
430
457
|
- **Example**: `"find the middleware that sanitizes input"`
|
|
431
458
|
- **Ranking path**: hybrid retrieval → fusion (`search.fusionStrategy`) → deterministic rerank (`search.rerankTopN`) → filters
|
|
432
459
|
- **Blame filters**: when `indexing.gitBlame.enabled` is `true`, filter with `blameAuthor`, `blameSha`, or `blameSince`.
|