opencode-codebase-index 0.17.1 → 0.18.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 +1 -1
- package/README.md +45 -8
- package/THIRD_PARTY_LICENSES.md +64 -0
- package/dist/cli.cjs +576 -346
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +582 -352
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +342 -114
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +356 -128
- package/dist/index.js.map +1 -1
- package/dist/pi-extension.cjs +735 -505
- package/dist/pi-extension.cjs.map +1 -1
- package/dist/pi-extension.js +697 -467
- package/dist/pi-extension.js.map +1 -1
- 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 +2 -1
package/README.md
CHANGED
|
@@ -355,12 +355,35 @@ graph TD
|
|
|
355
355
|
|
|
356
356
|
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.
|
|
357
357
|
|
|
358
|
-
**Supported Languages (Tree-sitter semantic parsing)**: TypeScript, JavaScript, Python, Rust, Go, Java, C#, Ruby, PHP, Apex, Bash, C, C++, JSON, TOML, YAML, Zig, GDScript, MATLAB†
|
|
358
|
+
**Supported Languages (Tree-sitter semantic parsing)**: TypeScript, JavaScript, Python, Rust, Swift, Go, Java, C#, Ruby, PHP, Apex, Bash, C, C++, Metal, JSON, TOML, YAML, Zig, GDScript, MATLAB†
|
|
359
|
+
|
|
360
|
+
Swift support uses [`tree-sitter-swift` 0.7.3](https://github.com/alex-pinkus/tree-sitter-swift/tree/0.7.3), distributed under the MIT license. It provides Tree-sitter syntax analysis for chunks, symbols, and calls, but does not replace SourceKit semantic analysis.
|
|
359
361
|
|
|
360
362
|
† MATLAB (`.m`) is opt-in — see below.
|
|
361
363
|
|
|
362
364
|
**Additional Supported Formats (line-based chunking)**: TXT, HTML, HTM, Markdown, Shell scripts
|
|
363
365
|
|
|
366
|
+
#### Verified PHP 8.x compatibility
|
|
367
|
+
|
|
368
|
+
PHP support uses [`tree-sitter-php` 0.24.2](https://github.com/tree-sitter/tree-sitter-php/releases/tag/v0.24.2), distributed under the MIT license. The regression fixture [`php-8-features.php`](tests/fixtures/call-graph/php-8-features.php) and the Rust and Vitest suites cover the following matrix:
|
|
369
|
+
|
|
370
|
+
| Version | Verified syntax |
|
|
371
|
+
|---|---|
|
|
372
|
+
| PHP 8.0 | attributes, named arguments, promoted properties, union types, the nullsafe operator, and `match` expressions |
|
|
373
|
+
| PHP 8.1 | enums with constants, `readonly` properties, intersection types, and first-class callables |
|
|
374
|
+
| PHP 8.2 | `readonly` classes and DNF types |
|
|
375
|
+
| PHP 8.3 | typed constants and dynamic class-constant access |
|
|
376
|
+
| PHP 8.4 | property hooks, asymmetric visibility, and unparenthesized chaining on `new` |
|
|
377
|
+
| PHP 8.5 | attributes on constants and the pipe operator `|>` |
|
|
378
|
+
|
|
379
|
+
Semantic parsing verifies chunk names and types for functions, classes, interfaces, traits, and `enum_declaration`. Methods remain inside their containing chunk rather than becoming standalone chunks.
|
|
380
|
+
|
|
381
|
+
The call graph distinguishes invocations from callable references. Standalone `foo(...)`, `$object->method(...)`, and `Type::method(...)` references do not create edges, while the same callables used as direct or parenthesized `|>` operands are recorded because the pipe invokes them. Coverage also includes qualified and relative `namespace\foo()` calls, nullsafe and static calls, constructors, named arguments, `match` bodies, property hooks, and enum methods.
|
|
382
|
+
|
|
383
|
+
The graph remains limited to statically resolvable named targets. Dynamic calls such as `$callable()`, `$object->$method()`, and `new $class()`, `include` and `require` expressions, and `extends` and `implements` relationships are outside this contribution.
|
|
384
|
+
|
|
385
|
+
PHP 8.5 support remains partial in upstream grammar 0.24.2. Final promoted properties and `clone($object, [...])` still produce `ERROR` nodes, so this project does not claim support for those two forms.
|
|
386
|
+
|
|
364
387
|
**Default File Patterns**:
|
|
365
388
|
```
|
|
366
389
|
**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs} **/*.{py,pyi}
|
|
@@ -370,6 +393,7 @@ graph TD
|
|
|
370
393
|
**/*.{md,mdx} **/*.{sh,bash,zsh}
|
|
371
394
|
**/*.{txt,html,htm} **/*.{cls,trigger}
|
|
372
395
|
**/*.zig **/*.gd
|
|
396
|
+
**/*.metal
|
|
373
397
|
```
|
|
374
398
|
|
|
375
399
|
Use `include` to replace defaults, or `additionalInclude` to extend (e.g. `"**/*.pdf"`, `"**/*.csv"`).
|
|
@@ -515,7 +539,9 @@ Returns recent debug logs with optional filtering.
|
|
|
515
539
|
|
|
516
540
|
### `call_graph`
|
|
517
541
|
|
|
518
|
-
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
|
|
542
|
+
Query the call graph to find callers or callees of a function/method. Automatically built during indexing for TypeScript, JavaScript, Python, Go, Rust, Swift, PHP, Apex, Zig, GDScript, MATLAB, Bash, C, C++, and Metal.
|
|
543
|
+
|
|
544
|
+
For Swift, resolution remains name-based, so overloads, extension duplicates, and protocol dispatch can remain ambiguous. Syntax alone cannot always distinguish a superclass from a protocol conformance or an enum raw-value type from a protocol. Constructor classification uses an uppercase ASCII initial heuristic while retaining the exact name for resolution. `tree-sitter-swift` 0.7.3 also has limitations around `sending`, abbreviated collection constructors such as `[Int]()`, and some generic calls after `self`, `super`, optional chaining, or chained calls. The index does not infer SourceKit semantics for these cases.
|
|
519
545
|
|
|
520
546
|
- **Use for**: Understanding code flow, tracing dependencies, impact analysis.
|
|
521
547
|
- **Parameters**: `name` (function name), `direction` (`callers` or `callees`), `symbolId` (required for `callees`, returned by previous queries), `relationshipType` (optional: `Call`, `MethodCall`, `Constructor`, `Import`, `Inherits`, `Implements`).
|
|
@@ -1065,11 +1091,20 @@ ollama pull nomic-embed-text
|
|
|
1065
1091
|
}
|
|
1066
1092
|
```
|
|
1067
1093
|
|
|
1068
|
-
The built-in `ollama` provider uses Ollama's native
|
|
1094
|
+
The built-in `ollama` provider uses Ollama's native API. It discovers installed embedding-capable models and reads their vector dimensions and context length from `/api/show`.
|
|
1069
1095
|
|
|
1070
1096
|
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.
|
|
1071
1097
|
|
|
1072
|
-
|
|
1098
|
+
To select another installed embedding model, configure it directly:
|
|
1099
|
+
|
|
1100
|
+
```json
|
|
1101
|
+
{
|
|
1102
|
+
"embeddingProvider": "ollama",
|
|
1103
|
+
"embeddingModel": "qwen3-embedding:0.6b"
|
|
1104
|
+
}
|
|
1105
|
+
```
|
|
1106
|
+
|
|
1107
|
+
When `embeddingModel` is omitted, auto-detection selects the first installed model that advertises embedding capability. Set `OLLAMA_HOST` only to a trusted Ollama server because source text is sent to that endpoint for embedding.
|
|
1073
1108
|
|
|
1074
1109
|
## 📈 Performance
|
|
1075
1110
|
|
|
@@ -1130,8 +1165,8 @@ Works with any server that implements the OpenAI `/v1/embeddings` API format (ll
|
|
|
1130
1165
|
```
|
|
1131
1166
|
Required fields: `baseUrl`, `model`, `dimensions` (positive integer). Optional: `apiKey`, `maxTokens`, `timeoutMs` (default: 30000), `maxBatchSize` (or `max_batch_size`) to cap inputs per `/embeddings` request for servers like text-embeddings-inference. `{env:VAR_NAME}` placeholders are resolved before config validation for fields that are actually used and throw if the referenced environment variable is missing or malformed.
|
|
1132
1167
|
|
|
1133
|
-
**
|
|
1134
|
-
|
|
1168
|
+
**Ollama through an OpenAI-compatible proxy**
|
|
1169
|
+
Use the `custom` provider only when Ollama is exposed through an OpenAI-compatible proxy or when you need to override metadata manually:
|
|
1135
1170
|
|
|
1136
1171
|
```json
|
|
1137
1172
|
{
|
|
@@ -1148,7 +1183,7 @@ If you are running Ollama locally and want to use an embedding model other than
|
|
|
1148
1183
|
Notes:
|
|
1149
1184
|
- The plugin appends `/embeddings`, so `baseUrl` should be `http://127.0.0.1:11434/v1`, not just `http://127.0.0.1:11434`.
|
|
1150
1185
|
- Ollama ignores the API key, but some OpenAI-compatible clients expect one, so a placeholder like `"ollama"` is fine.
|
|
1151
|
-
- Make sure `dimensions` matches the actual output
|
|
1186
|
+
- Make sure `dimensions` matches the actual model output. The built-in `ollama` provider discovers this value automatically and is preferred for direct Ollama connections.
|
|
1152
1187
|
|
|
1153
1188
|
## ⚠️ Tradeoffs
|
|
1154
1189
|
|
|
@@ -1241,7 +1276,7 @@ The Rust native module handles performance-critical operations:
|
|
|
1241
1276
|
- **usearch**: High-performance vector similarity search with F16 quantization
|
|
1242
1277
|
- **SQLite**: Persistent storage for embeddings, chunks, branch catalog, symbols, and call edges
|
|
1243
1278
|
- **BM25 inverted index**: Fast keyword search for hybrid retrieval
|
|
1244
|
-
- **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)
|
|
1279
|
+
- **Call graph extraction**: Tree-sitter query-based extraction of function calls, method calls, constructors, and imports (TypeScript/JavaScript, Python, Go, Rust, Swift, PHP, Apex, Zig, GDScript, MATLAB, Bash, C, C++, Metal)
|
|
1245
1280
|
- **xxhash**: Fast content hashing for change detection
|
|
1246
1281
|
|
|
1247
1282
|
Rebuild with: `npm run build:native` (requires Rust toolchain)
|
|
@@ -1263,3 +1298,5 @@ Windows builds use scalar distance functions instead of SIMD — functionally id
|
|
|
1263
1298
|
## License
|
|
1264
1299
|
|
|
1265
1300
|
MIT
|
|
1301
|
+
|
|
1302
|
+
Notices for third-party components distributed with the package are available in [`THIRD_PARTY_LICENSES.md`](./THIRD_PARTY_LICENSES.md).
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Third-party licenses
|
|
2
|
+
|
|
3
|
+
This file records third-party license notices added with their respective components. It does not claim to retroactively inventory every project dependency.
|
|
4
|
+
|
|
5
|
+
## tree-sitter-php 0.24.2
|
|
6
|
+
|
|
7
|
+
- Project: [tree-sitter/tree-sitter-php](https://github.com/tree-sitter/tree-sitter-php)
|
|
8
|
+
- Source: [crate 0.24.2](https://crates.io/crates/tree-sitter-php/0.24.2)
|
|
9
|
+
- License: MIT
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
The MIT License (MIT)
|
|
13
|
+
|
|
14
|
+
Copyright (c) 2017 Josh Vera, GitHub
|
|
15
|
+
Copyright (c) 2019 Max Brunsfeld, Amaan Qureshi, Christian Frøystad, Caleb White
|
|
16
|
+
|
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
in the Software without restriction, including without limitation the rights
|
|
20
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
furnished to do so, subject to the following conditions:
|
|
23
|
+
|
|
24
|
+
The above copyright notice and this permission notice shall be included in all
|
|
25
|
+
copies or substantial portions of the Software.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
+
SOFTWARE.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## tree-sitter-swift 0.7.3
|
|
37
|
+
|
|
38
|
+
- Project: [alex-pinkus/tree-sitter-swift](https://github.com/alex-pinkus/tree-sitter-swift)
|
|
39
|
+
- Source: [tag 0.7.3](https://github.com/alex-pinkus/tree-sitter-swift/tree/0.7.3)
|
|
40
|
+
- License: MIT
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
MIT License
|
|
44
|
+
|
|
45
|
+
Copyright (c) 2021 alex-pinkus
|
|
46
|
+
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
48
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
49
|
+
in the Software without restriction, including without limitation the rights
|
|
50
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
51
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
52
|
+
furnished to do so, subject to the following conditions:
|
|
53
|
+
|
|
54
|
+
The above copyright notice and this permission notice shall be included in all
|
|
55
|
+
copies or substantial portions of the Software.
|
|
56
|
+
|
|
57
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
58
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
59
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
60
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
61
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
62
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
63
|
+
SOFTWARE.
|
|
64
|
+
```
|