opencode-codebase-index 0.7.0 → 0.8.1

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 CHANGED
@@ -56,10 +56,32 @@
56
56
  3. **Index your codebase**
57
57
  Run `/index` or ask the agent to index your codebase. This only needs to be done once — subsequent updates are incremental.
58
58
 
59
+ **Recommended check:** run `/status` after the first index so you can confirm the detected provider/model before you start searching.
60
+
59
61
  4. **Start Searching**
60
62
  Ask:
61
63
  > "Find the function that handles credit card validation errors"
62
64
 
65
+ ### Provider selection notes
66
+
67
+ - **Default auto-detect order:** Ollama → GitHub Copilot → OpenAI → Google
68
+ - **Ollama** is the preferred zero-cost local option and works especially well for large repos:
69
+
70
+ ```bash
71
+ ollama pull nomic-embed-text
72
+ ```
73
+
74
+ ```json
75
+ {
76
+ "embeddingProvider": "ollama"
77
+ }
78
+ ```
79
+
80
+ - **GitHub Copilot** is a good default if OpenCode already has Copilot auth and you prefer hosted embeddings.
81
+ - **OpenAI** is a good hosted option when you want predictable API behavior and standard cloud setup.
82
+ - **Google** is available if you prefer Gemini-hosted embeddings.
83
+ - If `/status` reports provider or compatibility problems, follow that guidance before using `/index force`.
84
+
63
85
  ## 🌐 MCP Server (Cursor, Claude Code, Windsurf, etc.)
64
86
 
65
87
  Use the same semantic search from any MCP-compatible client. Index once, search from anywhere.
@@ -189,7 +211,7 @@ graph TD
189
211
 
190
212
  1. **Parsing**: We use `tree-sitter` to intelligently parse your code into meaningful blocks (functions, classes, interfaces). JSDoc comments and docstrings are automatically included with their associated code.
191
213
 
192
- **Supported Languages (Tree-sitter semantic parsing)**: TypeScript, JavaScript, Python, Rust, Go, Java, C#, Ruby, PHP, Bash, C, C++, JSON, TOML, YAML
214
+ **Supported Languages (Tree-sitter semantic parsing)**: TypeScript, JavaScript, Python, Rust, Go, Java, C#, Ruby, PHP, Apex, Bash, C, C++, JSON, TOML, YAML, Zig
193
215
 
194
216
  **Additional Supported Formats (line-based chunking)**: TXT, HTML, HTM, Markdown, Shell scripts
195
217
 
@@ -200,7 +222,8 @@ graph TD
200
222
  **/*.{rb,php,inc,swift} **/*.{vue,svelte,astro}
201
223
  **/*.{sql,graphql,proto} **/*.{yaml,yml,toml}
202
224
  **/*.{md,mdx} **/*.{sh,bash,zsh}
203
- **/*.{txt,html,htm}
225
+ **/*.{txt,html,htm} **/*.{cls,trigger}
226
+ **/*.zig
204
227
  ```
205
228
 
206
229
  Use `include` to replace defaults, or `additionalInclude` to extend (e.g. `"**/*.pdf"`, `"**/*.csv"`).
@@ -292,7 +315,7 @@ The plugin exposes these tools to the OpenCode agent:
292
315
  ```
293
316
  [1] function "validatePayment" at src/billing.ts:45-67 (score: 0.92)
294
317
  [2] class "PaymentProcessor" at src/processor.ts:12-89 (score: 0.87)
295
-
318
+
296
319
  Use Read tool to examine specific files.
297
320
  ```
298
321
  - **Workflow**: `codebase_peek` → find locations → `Read` specific files
@@ -315,6 +338,7 @@ Manually trigger indexing.
315
338
 
316
339
  ### `index_status`
317
340
  Checks if the index is ready and healthy.
341
+ - **Recommended workflow**: run this after `/index` to confirm the detected provider/model and whether the index is ready to search.
318
342
 
319
343
  ### `index_health_check`
320
344
  Maintenance tool to remove stale entries from deleted files and orphaned embeddings/chunks from the database.
@@ -328,7 +352,9 @@ Returns recent debug logs with optional filtering.
328
352
  - **Parameters**: `category` (optional: `search`, `embedding`, `cache`, `gc`, `branch`), `level` (optional: `error`, `warn`, `info`, `debug`), `limit` (default: 50).
329
353
 
330
354
  ### `call_graph`
331
- Query the call graph to find callers or callees of a function/method. Automatically built during indexing for TypeScript, JavaScript, Python, Go, and Rust.
355
+
356
+ Query the call graph to find callers or callees of a function/method. Automatically built during indexing for TypeScript, JavaScript, Python, Go, Rust, PHP, and Zig.
357
+
332
358
  - **Use for**: Understanding code flow, tracing dependencies, impact analysis.
333
359
  - **Parameters**: `name` (function name), `direction` (`callers` or `callees`), `symbolId` (required for `callees`, returned by previous queries).
334
360
  - **Example**: Find who calls `validateToken` → `call_graph(name="validateToken", direction="callers")`
@@ -353,10 +379,13 @@ The plugin automatically registers these slash commands:
353
379
 
354
380
  | Command | Description |
355
381
  | ------- | ----------- |
382
+ | `/definition <query>` | **Definition Lookup**. Finds the authoritative implementation site for a symbol or concept. |
383
+ | `/peek <query>` | **Quick Semantic Lookup**. Returns likely locations only, without full code content. |
384
+ | `/reindex` | **Full Rebuild**. Rebuilds the codebase index from scratch. |
356
385
  | `/search <query>` | **Pure Semantic Search**. Best for "How does X work?" |
357
386
  | `/find <query>` | **Hybrid Search**. Combines semantic search + grep. Best for "Find usage of X". |
358
387
  | `/call-graph <query>` | **Call Graph Trace**. Find callers/callees to understand execution flow. |
359
- | `/index` | **Update Index**. Forces a refresh of the codebase index. |
388
+ | `/index` | **Update Index**. Runs incremental indexing by default; use `/index force` for a full rebuild. |
360
389
  | `/status` | **Check Status**. Shows if indexed, chunk count, and provider info. |
361
390
 
362
391
  ## 📚 Knowledge Base
@@ -804,6 +833,8 @@ ollama pull nomic-embed-text
804
833
 
805
834
  The built-in `ollama` provider uses Ollama's native `/api/embeddings` endpoint and is the simplest setup when you want to use `nomic-embed-text`.
806
835
 
836
+ For the built-in Ollama path, the plugin budgets `nomic-embed-text` against an observed effective input limit of about **2048 tokens**, not the model's higher advertised theoretical context. This keeps batching and chunk text generation aligned with real Ollama embedding runtime behavior.
837
+
807
838
  If you want to use a different Ollama embedding model through its OpenAI-compatible API, use the `custom` provider instead and set `customProvider.baseUrl` to `http://127.0.0.1:11434/v1` so the plugin calls `.../v1/embeddings`.
808
839
 
809
840
  ## 📈 Performance
@@ -912,7 +943,7 @@ Be aware of these characteristics:
912
943
  ]
913
944
  }
914
945
  ```
915
-
946
+
916
947
  This loads directly from your source directory, so changes take effect after rebuilding.
917
948
 
918
949
  ## 🤝 Contributing
@@ -938,6 +969,7 @@ To ensure release notes reflect all merged work, this repo uses a draft-release
938
969
  - PRs are validated by CI (`Release Label Check`) and fail if no release category label is present
939
970
  2. **Let Release Drafter build the draft notes** automatically from merged PRs on `main`.
940
971
  3. **Before publishing**:
972
+ - compare `git log --oneline vX.Y.Z..HEAD` (or the previous release tag range) against the draft release notes so the release summary covers the full shipped delta, not just the current `CHANGELOG.md` `Unreleased` section
941
973
  - copy/finalize relevant highlights into `CHANGELOG.md`
942
974
  - bump `package.json` version
943
975
  - run: `npm run build && npm run typecheck && npm run lint && npm run test:run`
@@ -975,7 +1007,7 @@ The Rust native module handles performance-critical operations:
975
1007
  - **usearch**: High-performance vector similarity search with F16 quantization
976
1008
  - **SQLite**: Persistent storage for embeddings, chunks, branch catalog, symbols, and call edges
977
1009
  - **BM25 inverted index**: Fast keyword search for hybrid retrieval
978
- - **Call graph extraction**: Tree-sitter query-based extraction of function calls, method calls, constructors, and imports (TypeScript/JavaScript, Python, Go, Rust)
1010
+ - **Call graph extraction**: Tree-sitter query-based extraction of function calls, method calls, constructors, and imports (TypeScript/JavaScript, Python, Go, Rust, PHP, Zig)
979
1011
  - **xxhash**: Fast content hashing for change detection
980
1012
 
981
1013
  Rebuild with: `npm run build:native` (requires Rust toolchain)
package/commands/index.md CHANGED
@@ -21,3 +21,7 @@ Examples:
21
21
  IMPORTANT: You MUST pass the parsed arguments to `index_codebase`. Do not ignore them.
22
22
 
23
23
  Show final statistics including files processed, chunks indexed, tokens used, and duration.
24
+
25
+ If indexing completes but the codebase still is not ready, tell the user to run `/status` next.
26
+ - If `/status` reports failed embedding batches, fix the provider/auth issue and rerun `/index` normally.
27
+ - Use `/index force` only for a full rebuild or when `/status` reports provider/model incompatibility.
@@ -0,0 +1,24 @@
1
+ ---
2
+ description: Quickly find likely code locations without returning full code
3
+ ---
4
+
5
+ Search the codebase using `codebase_peek`.
6
+
7
+ User input: $ARGUMENTS
8
+
9
+ The first part is the search query. Look for optional parameters:
10
+ - `limit=N` or "top N" or "first N" → set limit
11
+ - `type=X` or mentions "functions"/"classes"/"methods" → set chunkType
12
+ - `dir=X` or "in folder X" → set directory filter
13
+ - File extensions like ".ts", "typescript", ".py" → set fileType
14
+
15
+ Call `codebase_peek` with the parsed arguments.
16
+
17
+ Examples:
18
+ - `/peek authentication logic` → query="authentication logic"
19
+ - `/peek error handling limit=5` → query="error handling", limit=5
20
+ - `/peek validation functions` → query="validation", chunkType="function"
21
+
22
+ If the index doesn't exist, run `index_codebase` first.
23
+
24
+ Return results as concise locations with file paths and line numbers. Suggest reading the returned files or using `codebase_search` when the user needs full code context.
@@ -0,0 +1,25 @@
1
+ ---
2
+ description: Fully rebuild the codebase index from scratch
3
+ ---
4
+
5
+ Run the `index_codebase` tool with `force=true` to rebuild the index from scratch.
6
+
7
+ User input: $ARGUMENTS
8
+
9
+ Parse the input and set tool arguments:
10
+ - force=true always
11
+ - estimateOnly=false always
12
+ - verbose=false (default, for token efficiency)
13
+ - verbose=true if input contains "verbose" (for detailed output)
14
+
15
+ Examples:
16
+ - `/reindex` → force=true, estimateOnly=false, verbose=false
17
+ - `/reindex verbose` → force=true, estimateOnly=false, verbose=true
18
+
19
+ IMPORTANT: You MUST call `index_codebase` with `force=true`.
20
+
21
+ Show final statistics including files processed, chunks indexed, tokens used, and duration.
22
+
23
+ If indexing completes but the codebase still is not ready, tell the user to run `/status` next.
24
+ - If `/status` reports failed embedding batches, fix the provider/auth issue and rerun `/index` normally.
25
+ - If `/status` reports provider/model incompatibility again after a rebuild, surface that clearly as an unexpected issue.
@@ -9,7 +9,11 @@ This shows:
9
9
  - Number of indexed chunks
10
10
  - Embedding provider and model being used
11
11
  - Current git branch
12
+ - Failed embedding batches or compatibility warnings that explain why search is not ready
12
13
 
13
14
  No arguments needed - just run `index_status`.
14
15
 
15
- If not indexed, suggest running `/index` to create the index.
16
+ If not indexed:
17
+ - suggest running `/index` when no index exists yet
18
+ - if status reports failed embedding batches, tell the user to fix the provider/auth issue and rerun `/index` normally
19
+ - if status reports provider/model incompatibility, tell the user to run `/index force` for a full rebuild