opencode-codebase-index 0.13.2 → 0.15.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/README.md CHANGED
@@ -4,15 +4,16 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![Downloads](https://img.shields.io/npm/dm/opencode-codebase-index.svg)](https://www.npmjs.com/package/opencode-codebase-index)
6
6
  [![Build Status](https://img.shields.io/github/actions/workflow/status/Helweg/opencode-codebase-index/ci.yml?branch=main)](https://github.com/Helweg/opencode-codebase-index/actions)
7
- [![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg)](https://nodejs.org/)
7
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](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.
@@ -309,8 +345,8 @@ graph TD
309
345
 
310
346
  **Default File Patterns**:
311
347
  ```
312
- **/*.{ts,tsx,js,jsx,mjs,cjs} **/*.{py,pyi}
313
- **/*.{go,rs,java,kt,scala} **/*.{c,cpp,cc,h,hpp}
348
+ **/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs} **/*.{py,pyi}
349
+ **/*.{go,rs,java,cs,kt,scala} **/*.{c,cpp,cc,cxx,h,hpp,hxx}
314
350
  **/*.{rb,php,inc,swift} **/*.{vue,svelte,astro}
315
351
  **/*.{sql,graphql,proto} **/*.{yaml,yml,toml}
316
352
  **/*.{md,mdx} **/*.{sh,bash,zsh}
@@ -393,6 +429,7 @@ The plugin exposes these tools to the OpenCode agent:
393
429
  - **Use for**: Discovery, understanding flows, finding logic when you don't know the names.
394
430
  - **Example**: `"find the middleware that sanitizes input"`
395
431
  - **Ranking path**: hybrid retrieval → fusion (`search.fusionStrategy`) → deterministic rerank (`search.rerankTopN`) → filters
432
+ - **Blame filters**: when `indexing.gitBlame.enabled` is `true`, filter with `blameAuthor`, `blameSha`, or `blameSince`.
396
433
 
397
434
  **Writing good queries:**
398
435
 
@@ -411,6 +448,7 @@ The plugin exposes these tools to the OpenCode agent:
411
448
  - **Example output**:
412
449
  ```
413
450
  [1] function "validatePayment" at src/billing.ts:45-67 (score: 0.92)
451
+ abc1234 | Jane Doe | 2025-03-14 | billing: validate payment state
414
452
  [2] class "PaymentProcessor" at src/processor.ts:12-89 (score: 0.87)
415
453
 
416
454
  Use Read tool to examine specific files.
@@ -450,7 +488,7 @@ Returns recent debug logs with optional filtering.
450
488
 
451
489
  ### `call_graph`
452
490
 
453
- Query the call graph to find callers or callees of a function/method. Automatically built during indexing for TypeScript, JavaScript, Python, Go, Rust, PHP, Apex, Zig, GDScript, and MATLAB.
491
+ Query the call graph to find callers or callees of a function/method. Automatically built during indexing for TypeScript, JavaScript, Python, Go, Rust, PHP, Apex, Zig, GDScript, MATLAB, and Bash.
454
492
 
455
493
  - **Use for**: Understanding code flow, tracing dependencies, impact analysis.
456
494
  - **Parameters**: `name` (function name), `direction` (`callers` or `callees`), `symbolId` (required for `callees`, returned by previous queries), `relationshipType` (optional: `Call`, `MethodCall`, `Constructor`, `Import`, `Inherits`, `Implements`).
@@ -786,6 +824,7 @@ String values in `codebase-index.json` can reference environment variables with
786
824
  | `maxDepth` | `5` | Max directory traversal depth. `-1` = unlimited, `0` = only files in root dir, `1` = one level of subdirectories, etc. |
787
825
  | `maxFilesPerDirectory` | `100` | Max files to index per directory. Always picks the smallest files first. |
788
826
  | `fallbackToTextOnMaxChunks` | `true` | When a file exceeds `maxChunksPerFile`, fallback to text-based (line-by-line) chunking instead of skipping the rest of the file. |
827
+ | `gitBlame.enabled` | `false` | Annotate changed chunks with `git blame` commit SHA, author, author email, commit timestamp, and summary. Enables `blameAuthor`, `blameSha`, and `blameSince` filters. |
789
828
  | **search** | | |
790
829
  | `maxResults` | `20` | Maximum results to return |
791
830
  | `minScore` | `0.1` | Minimum similarity score (0-1). Lower = more results |
@@ -1175,7 +1214,7 @@ The Rust native module handles performance-critical operations:
1175
1214
  - **usearch**: High-performance vector similarity search with F16 quantization
1176
1215
  - **SQLite**: Persistent storage for embeddings, chunks, branch catalog, symbols, and call edges
1177
1216
  - **BM25 inverted index**: Fast keyword search for hybrid retrieval
1178
- - **Call graph extraction**: Tree-sitter query-based extraction of function calls, method calls, constructors, and imports (TypeScript/JavaScript, Python, Go, Rust, PHP, Apex, Zig, GDScript, MATLAB)
1217
+ - **Call graph extraction**: Tree-sitter query-based extraction of function calls, method calls, constructors, and imports (TypeScript/JavaScript, Python, Go, Rust, PHP, Apex, Zig, GDScript, MATLAB, Bash)
1179
1218
  - **xxhash**: Fast content hashing for change detection
1180
1219
 
1181
1220
  Rebuild with: `npm run build:native` (requires Rust toolchain)
package/commands/peek.md CHANGED
@@ -11,6 +11,9 @@ The first part is the search query. Look for optional parameters:
11
11
  - `type=X` or mentions "functions"/"classes"/"methods" → set chunkType
12
12
  - `dir=X` or "in folder X" → set directory filter
13
13
  - File extensions like ".ts", "typescript", ".py" → set fileType
14
+ - `author=X` or `blameAuthor=X` → set blameAuthor filter
15
+ - `sha=X` or `blameSha=X` → set blameSha filter
16
+ - `since=YYYY-MM-DD` or `blameSince=YYYY-MM-DD` → set blameSince filter
14
17
 
15
18
  Call `codebase_peek` with the parsed arguments.
16
19
 
@@ -18,6 +21,7 @@ Examples:
18
21
  - `/peek authentication logic` → query="authentication logic"
19
22
  - `/peek error handling limit=5` → query="error handling", limit=5
20
23
  - `/peek validation functions` → query="validation", chunkType="function"
24
+ - `/peek auth logic author=jane@example.com since=2025-01-01` → query="auth logic", blameAuthor="jane@example.com", blameSince="2025-01-01"
21
25
 
22
26
  If the index doesn't exist, run `index_codebase` first.
23
27
 
@@ -11,6 +11,9 @@ The first part is the search query. Look for optional parameters:
11
11
  - `type=X` or mentions "functions"/"classes"/"methods" → set chunkType
12
12
  - `dir=X` or "in folder X" → set directory filter
13
13
  - File extensions like ".ts", "typescript", ".py" → set fileType
14
+ - `author=X` or `blameAuthor=X` → set blameAuthor filter
15
+ - `sha=X` or `blameSha=X` → set blameSha filter
16
+ - `since=YYYY-MM-DD` or `blameSince=YYYY-MM-DD` → set blameSince filter
14
17
 
15
18
  Call `codebase_search` with the parsed arguments.
16
19
 
@@ -18,6 +21,7 @@ Examples:
18
21
  - `/search authentication logic` → query="authentication logic"
19
22
  - `/search error handling limit=5` → query="error handling", limit=5
20
23
  - `/search validation functions` → query="validation", chunkType="function"
24
+ - `/search auth logic author=jane@example.com since=2025-01-01` → query="auth logic", blameAuthor="jane@example.com", blameSince="2025-01-01"
21
25
 
22
26
  If the index doesn't exist, run `index_codebase` first.
23
27