opencode-rag-plugin 1.3.6 → 1.4.2
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 +33 -1
- package/dist/cli.d.ts +0 -5
- package/dist/cli.js +245 -102
- package/dist/cli.js.map +1 -1
- package/dist/core/config.d.ts +17 -0
- package/dist/core/config.js +16 -0
- package/dist/core/config.js.map +1 -1
- package/dist/core/interfaces.d.ts +6 -1
- package/dist/core/manifest.d.ts +2 -0
- package/dist/core/manifest.js +5 -2
- package/dist/core/manifest.js.map +1 -1
- package/dist/core/runtime-overrides.d.ts +28 -0
- package/dist/core/runtime-overrides.js +83 -0
- package/dist/core/runtime-overrides.js.map +1 -0
- package/dist/describer/describer.d.ts +12 -0
- package/dist/describer/describer.js +177 -0
- package/dist/describer/describer.js.map +1 -0
- package/dist/describer/factory.d.ts +3 -0
- package/dist/describer/factory.js +5 -0
- package/dist/describer/factory.js.map +1 -0
- package/dist/embedder/factory.d.ts +1 -1
- package/dist/embedder/factory.js +2 -2
- package/dist/embedder/factory.js.map +1 -1
- package/dist/embedder/ollama.d.ts +1 -1
- package/dist/embedder/ollama.js +1 -1
- package/dist/embedder/ollama.js.map +1 -1
- package/dist/embedder/openai.d.ts +1 -1
- package/dist/embedder/openai.js +6 -2
- package/dist/embedder/openai.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/indexer.d.ts +2 -1
- package/dist/indexer.js +36 -1
- package/dist/indexer.js.map +1 -1
- package/dist/opencode/create-read-tool.js +2 -2
- package/dist/opencode/create-read-tool.js.map +1 -1
- package/dist/plugin.d.ts +2 -1
- package/dist/plugin.js +42 -13
- package/dist/plugin.js.map +1 -1
- package/dist/retriever/retriever.d.ts +1 -0
- package/dist/retriever/retriever.js +2 -1
- package/dist/retriever/retriever.js.map +1 -1
- package/dist/tui.js +285 -11
- package/dist/tui.js.map +1 -1
- package/dist/vectorstore/lancedb.d.ts +19 -0
- package/dist/vectorstore/lancedb.js +162 -41
- package/dist/vectorstore/lancedb.js.map +1 -1
- package/dist/watcher.d.ts +6 -1
- package/dist/watcher.js +72 -26
- package/dist/watcher.js.map +1 -1
- package/package.json +3 -2
package/ReadMe.md
CHANGED
|
@@ -111,6 +111,33 @@ Running `opencode-rag init` creates the config file `opencode-rag.json` in your
|
|
|
111
111
|
| `retrieval.topK` | `10` | Default number of chunks fetched per query. |
|
|
112
112
|
| `retrieval.hybridSearch.enabled` | `true` | Enables combined TF×IDF + vector search. |
|
|
113
113
|
|
|
114
|
+
### Description-Based Embedding (Optional)
|
|
115
|
+
|
|
116
|
+
When enabled, the indexer uses an LLM to generate natural-language descriptions of code chunks, then combines the description with the raw code for embedding. This captures both semantic meaning (from the description) and code-level similarity (from the code itself), dramatically improving search quality for natural language and code-based queries alike.
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"description": {
|
|
121
|
+
"enabled": true,
|
|
122
|
+
"provider": "ollama",
|
|
123
|
+
"baseUrl": "http://localhost:11434/api",
|
|
124
|
+
"model": "qwen2.5:3b",
|
|
125
|
+
"timeoutMs": 60000,
|
|
126
|
+
"systemPrompt": "You are a code analysis assistant. Given a code snippet, write a short (2-3 sentence) description of what the code does, its purpose, and key functionality. Focus on semantic meaning that would help someone searching for this code. Do not include code in your response."
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
| Option | Default | Description |
|
|
132
|
+
|--------|---------|-------------|
|
|
133
|
+
| `description.enabled` | `true` | Enable description-based embedding. Set to `false` to embed raw code instead. |
|
|
134
|
+
| `description.provider` | `"ollama"` | LLM provider (`"ollama"` or `"openai"`). |
|
|
135
|
+
| `description.model` | `"qwen2.5:3b"` | Model name for description generation. |
|
|
136
|
+
| `description.systemPrompt` | *(see above)* | Customizable system prompt for the LLM. |
|
|
137
|
+
| `description.timeoutMs` | `60000` | Timeout per LLM call. |
|
|
138
|
+
|
|
139
|
+
The embedded text is formed as `description + "\n\n" + code content`. The description and code are still stored as separate fields in LanceDB. Keyword search continues to use the raw code content. Set `description.enabled` to `false` to disable and embed raw code content instead. If the LLM call fails during indexing, the chunk falls back to embedding raw content with a warning logged.
|
|
140
|
+
|
|
114
141
|
<details>
|
|
115
142
|
<summary>View Logging Configuration</summary>
|
|
116
143
|
|
|
@@ -155,7 +182,7 @@ After each user message, a `chat.message` hook appends up to 10 relevant file su
|
|
|
155
182
|
|
|
156
183
|
## CLI Interface
|
|
157
184
|
|
|
158
|
-
The CLI interface (`opencode-rag`) provides full access to build, manage, and search your project's vector database, even without
|
|
185
|
+
The CLI interface (`opencode-rag`) provides full access to build, manage, and search your project's vector database, even without using OpenCode.
|
|
159
186
|
This is mainly intended for testing/debugging purposes, but can also be integrated into your own applications or scripts.
|
|
160
187
|
|
|
161
188
|
```bash
|
|
@@ -174,6 +201,11 @@ opencode-rag query "How is authentication handled?" --top-k 5
|
|
|
174
201
|
# Show index statistics or clear data
|
|
175
202
|
opencode-rag status
|
|
176
203
|
opencode-rag clear
|
|
204
|
+
|
|
205
|
+
# Inspect indexed data
|
|
206
|
+
opencode-rag list # list all indexed files with chunk counts
|
|
207
|
+
opencode-rag show src/auth.ts # show chunks for a specific file
|
|
208
|
+
opencode-rag dump --limit 50 # dump all chunks (paginated)
|
|
177
209
|
```
|
|
178
210
|
|
|
179
211
|
---
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
export declare function removeStaleGlobalPluginRegistrations(homeDir: string, pluginName: string): string[];
|
|
3
|
-
/**
|
|
4
|
-
* Determine whether the CLI should auto-run for the current module.
|
|
5
|
-
* Resolves the first argv entry so symlinked binaries compare against the
|
|
6
|
-
* real file path, and returns false if the path cannot be resolved.
|
|
7
|
-
*/
|
|
8
3
|
export declare function shouldAutoRunCli(moduleUrl: string, argv1?: string): boolean;
|
|
9
4
|
export declare function runCli(argv?: string[]): Promise<void>;
|