opencode-rag-plugin 1.12.17 → 1.14.7
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 +15 -13
- package/dist/api.d.ts +54 -2
- package/dist/api.js +41 -1
- package/dist/api.js.map +1 -1
- package/dist/chunker/base.js +2 -0
- package/dist/chunker/base.js.map +1 -1
- package/dist/chunker/bash.d.ts +5 -0
- package/dist/chunker/bash.js +5 -0
- package/dist/chunker/bash.js.map +1 -1
- package/dist/chunker/c.d.ts +6 -0
- package/dist/chunker/c.js +6 -0
- package/dist/chunker/c.js.map +1 -1
- package/dist/chunker/cpp.d.ts +6 -0
- package/dist/chunker/cpp.js +6 -0
- package/dist/chunker/cpp.js.map +1 -1
- package/dist/chunker/csharp.d.ts +6 -0
- package/dist/chunker/csharp.js +6 -0
- package/dist/chunker/csharp.js.map +1 -1
- package/dist/chunker/css.d.ts +6 -0
- package/dist/chunker/css.js +6 -0
- package/dist/chunker/css.js.map +1 -1
- package/dist/chunker/doc.d.ts +18 -0
- package/dist/chunker/doc.js +18 -0
- package/dist/chunker/doc.js.map +1 -1
- package/dist/chunker/dockerfile.d.ts +6 -0
- package/dist/chunker/dockerfile.js +6 -0
- package/dist/chunker/dockerfile.js.map +1 -1
- package/dist/chunker/docx.d.ts +18 -0
- package/dist/chunker/docx.js +18 -0
- package/dist/chunker/docx.js.map +1 -1
- package/dist/chunker/excel.d.ts +19 -0
- package/dist/chunker/excel.js +19 -0
- package/dist/chunker/excel.js.map +1 -1
- package/dist/chunker/go.d.ts +5 -0
- package/dist/chunker/go.js +5 -0
- package/dist/chunker/go.js.map +1 -1
- package/dist/chunker/grammar.d.ts +62 -0
- package/dist/chunker/grammar.js +133 -0
- package/dist/chunker/grammar.js.map +1 -1
- package/dist/chunker/html.d.ts +5 -0
- package/dist/chunker/html.js +5 -0
- package/dist/chunker/html.js.map +1 -1
- package/dist/chunker/image.d.ts +31 -0
- package/dist/chunker/image.js +50 -4
- package/dist/chunker/image.js.map +1 -1
- package/dist/chunker/ini.d.ts +5 -0
- package/dist/chunker/ini.js +5 -0
- package/dist/chunker/ini.js.map +1 -1
- package/dist/chunker/java.d.ts +5 -0
- package/dist/chunker/java.js +5 -0
- package/dist/chunker/java.js.map +1 -1
- package/dist/chunker/javascript.d.ts +6 -0
- package/dist/chunker/javascript.js +6 -0
- package/dist/chunker/javascript.js.map +1 -1
- package/dist/chunker/json.d.ts +5 -0
- package/dist/chunker/json.js +5 -0
- package/dist/chunker/json.js.map +1 -1
- package/dist/chunker/kotlin.d.ts +6 -0
- package/dist/chunker/kotlin.js +6 -0
- package/dist/chunker/kotlin.js.map +1 -1
- package/dist/chunker/loader.d.ts +11 -0
- package/dist/chunker/loader.js +20 -0
- package/dist/chunker/loader.js.map +1 -1
- package/dist/chunker/markdown.d.ts +5 -0
- package/dist/chunker/markdown.js +5 -0
- package/dist/chunker/markdown.js.map +1 -1
- package/dist/chunker/pdf.d.ts +19 -0
- package/dist/chunker/pdf.js +30 -0
- package/dist/chunker/pdf.js.map +1 -1
- package/dist/chunker/php.d.ts +5 -0
- package/dist/chunker/php.js +5 -0
- package/dist/chunker/php.js.map +1 -1
- package/dist/chunker/powershell.d.ts +5 -0
- package/dist/chunker/powershell.js +5 -0
- package/dist/chunker/powershell.js.map +1 -1
- package/dist/chunker/python.d.ts +5 -0
- package/dist/chunker/python.js +5 -0
- package/dist/chunker/python.js.map +1 -1
- package/dist/chunker/razor.d.ts +12 -0
- package/dist/chunker/razor.js +25 -0
- package/dist/chunker/razor.js.map +1 -1
- package/dist/chunker/ruby.d.ts +5 -0
- package/dist/chunker/ruby.js +5 -0
- package/dist/chunker/ruby.js.map +1 -1
- package/dist/chunker/rust.d.ts +6 -0
- package/dist/chunker/rust.js +6 -0
- package/dist/chunker/rust.js.map +1 -1
- package/dist/chunker/sln.d.ts +11 -0
- package/dist/chunker/sln.js +11 -0
- package/dist/chunker/sln.js.map +1 -1
- package/dist/chunker/sql.d.ts +5 -0
- package/dist/chunker/sql.js +5 -0
- package/dist/chunker/sql.js.map +1 -1
- package/dist/chunker/ssl.d.ts +12 -0
- package/dist/chunker/ssl.js +21 -2
- package/dist/chunker/ssl.js.map +1 -1
- package/dist/chunker/swift.d.ts +5 -0
- package/dist/chunker/swift.js +5 -0
- package/dist/chunker/swift.js.map +1 -1
- package/dist/chunker/tex.d.ts +12 -0
- package/dist/chunker/tex.js +12 -0
- package/dist/chunker/tex.js.map +1 -1
- package/dist/chunker/toml.d.ts +5 -0
- package/dist/chunker/toml.js +5 -0
- package/dist/chunker/toml.js.map +1 -1
- package/dist/chunker/typescript.d.ts +6 -0
- package/dist/chunker/typescript.js +6 -0
- package/dist/chunker/typescript.js.map +1 -1
- package/dist/chunker/xml.d.ts +5 -0
- package/dist/chunker/xml.js +5 -0
- package/dist/chunker/xml.js.map +1 -1
- package/dist/chunker/yaml.d.ts +5 -0
- package/dist/chunker/yaml.js +5 -0
- package/dist/chunker/yaml.js.map +1 -1
- package/dist/cli/commands/clear.d.ts +12 -0
- package/dist/cli/commands/clear.js +81 -0
- package/dist/cli/commands/clear.js.map +1 -0
- package/dist/cli/commands/describe-image.d.ts +14 -0
- package/dist/cli/commands/describe-image.js +68 -0
- package/dist/cli/commands/describe-image.js.map +1 -0
- package/dist/cli/commands/dump.d.ts +13 -0
- package/dist/cli/commands/dump.js +55 -0
- package/dist/cli/commands/dump.js.map +1 -0
- package/dist/cli/commands/eval.d.ts +32 -0
- package/dist/cli/commands/eval.js +158 -0
- package/dist/cli/commands/eval.js.map +1 -0
- package/dist/cli/commands/index-command.d.ts +17 -0
- package/dist/cli/commands/index-command.js +167 -0
- package/dist/cli/commands/index-command.js.map +1 -0
- package/dist/cli/commands/index.d.ts +16 -0
- package/dist/cli/commands/index.js +17 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/init-helpers.d.ts +101 -0
- package/dist/cli/commands/init-helpers.js +398 -0
- package/dist/cli/commands/init-helpers.js.map +1 -0
- package/dist/cli/commands/init.d.ts +19 -0
- package/dist/cli/commands/init.js +251 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/list.d.ts +13 -0
- package/dist/cli/commands/list.js +46 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/mcp.d.ts +14 -0
- package/dist/cli/commands/mcp.js +35 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/query.d.ts +14 -0
- package/dist/cli/commands/query.js +86 -0
- package/dist/cli/commands/query.js.map +1 -0
- package/dist/cli/commands/show.d.ts +13 -0
- package/dist/cli/commands/show.js +51 -0
- package/dist/cli/commands/show.js.map +1 -0
- package/dist/cli/commands/status.d.ts +14 -0
- package/dist/cli/commands/status.js +104 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/ui.d.ts +14 -0
- package/dist/cli/commands/ui.js +69 -0
- package/dist/cli/commands/ui.js.map +1 -0
- package/dist/cli/commands/update.d.ts +14 -0
- package/dist/cli/commands/update.js +76 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/format.d.ts +112 -0
- package/dist/cli/format.js +184 -0
- package/dist/cli/format.js.map +1 -0
- package/dist/cli/helpers.d.ts +51 -0
- package/dist/cli/helpers.js +86 -0
- package/dist/cli/helpers.js.map +1 -0
- package/dist/cli/index.d.ts +28 -0
- package/dist/cli/index.js +107 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/progress.d.ts +39 -0
- package/dist/cli/progress.js +137 -0
- package/dist/cli/progress.js.map +1 -0
- package/dist/cli/types.d.ts +40 -0
- package/dist/cli/types.js +3 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli.d.ts +11 -4
- package/dist/cli.js +9 -1253
- package/dist/cli.js.map +1 -1
- package/dist/content/doc.d.ts +1 -1
- package/dist/content/doc.js +1 -1
- package/dist/content/doc.js.map +1 -1
- package/dist/content/docx.d.ts +1 -1
- package/dist/content/docx.js +1 -1
- package/dist/content/docx.js.map +1 -1
- package/dist/content/excel.d.ts +1 -1
- package/dist/content/excel.js +1 -1
- package/dist/content/excel.js.map +1 -1
- package/dist/content/pdf.d.ts +1 -1
- package/dist/content/pdf.js +1 -1
- package/dist/content/pdf.js.map +1 -1
- package/dist/content/reader.d.ts +3 -1
- package/dist/content/reader.js +42 -10
- package/dist/content/reader.js.map +1 -1
- package/dist/core/bootstrap.d.ts +18 -0
- package/dist/core/bootstrap.js +9 -15
- package/dist/core/bootstrap.js.map +1 -1
- package/dist/core/config.d.ts +146 -0
- package/dist/core/config.js +66 -14
- package/dist/core/config.js.map +1 -1
- package/dist/core/doc-progress.d.ts +15 -0
- package/dist/core/doc-progress.js +61 -0
- package/dist/core/doc-progress.js.map +1 -0
- package/dist/core/fileLogger.d.ts +7 -0
- package/dist/core/fileLogger.js +2 -0
- package/dist/core/fileLogger.js.map +1 -1
- package/dist/core/interfaces.d.ts +52 -1
- package/dist/core/manifest.d.ts +25 -0
- package/dist/core/manifest.js +15 -1
- package/dist/core/manifest.js.map +1 -1
- package/dist/core/provider-defaults.d.ts +8 -0
- package/dist/core/provider-defaults.js +3 -0
- package/dist/core/provider-defaults.js.map +1 -1
- package/dist/core/rag-injection-flag.d.ts +3 -0
- package/dist/core/rag-injection-flag.js +2 -0
- package/dist/core/rag-injection-flag.js.map +1 -1
- package/dist/core/resolve-api-key.d.ts +1 -0
- package/dist/core/resolve-api-key.js +1 -0
- package/dist/core/resolve-api-key.js.map +1 -1
- package/dist/core/runtime-overrides.d.ts +4 -0
- package/dist/core/runtime-overrides.js +4 -1
- package/dist/core/runtime-overrides.js.map +1 -1
- package/dist/describer/anthropic.d.ts +22 -2
- package/dist/describer/anthropic.js +43 -111
- package/dist/describer/anthropic.js.map +1 -1
- package/dist/describer/describer.d.ts +21 -4
- package/dist/describer/describer.js +53 -112
- package/dist/describer/describer.js.map +1 -1
- package/dist/describer/gemini.d.ts +1 -2
- package/dist/describer/gemini.js +21 -114
- package/dist/describer/gemini.js.map +1 -1
- package/dist/describer/shared.d.ts +3 -0
- package/dist/describer/shared.js +23 -0
- package/dist/describer/shared.js.map +1 -0
- package/dist/embedder/factory.d.ts +25 -0
- package/dist/embedder/factory.js +25 -0
- package/dist/embedder/factory.js.map +1 -1
- package/dist/embedder/health.d.ts +10 -0
- package/dist/embedder/health.js +26 -14
- package/dist/embedder/health.js.map +1 -1
- package/dist/embedder/http.d.ts +47 -0
- package/dist/embedder/http.js +61 -3
- package/dist/embedder/http.js.map +1 -1
- package/dist/eval/index.d.ts +6 -0
- package/dist/eval/index.js.map +1 -1
- package/dist/eval/run-token-test.js +1 -5
- package/dist/eval/run-token-test.js.map +1 -1
- package/dist/eval/session-logger.d.ts +5 -0
- package/dist/eval/session-logger.js +4 -0
- package/dist/eval/session-logger.js.map +1 -1
- package/dist/eval/storage.d.ts +9 -0
- package/dist/eval/storage.js +9 -5
- package/dist/eval/storage.js.map +1 -1
- package/dist/eval/token-analysis.d.ts +8 -0
- package/dist/eval/token-analysis.js +6 -2
- package/dist/eval/token-analysis.js.map +1 -1
- package/dist/eval/token-counter.d.ts +1 -3
- package/dist/eval/token-counter.js +4 -5
- package/dist/eval/token-counter.js.map +1 -1
- package/dist/eval/types.d.ts +6 -0
- package/dist/eval/types.js +2 -0
- package/dist/eval/types.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/indexer/description-stage.d.ts +1 -1
- package/dist/indexer/description-stage.js +25 -5
- package/dist/indexer/description-stage.js.map +1 -1
- package/dist/indexer/embed-stage.js +0 -8
- package/dist/indexer/embed-stage.js.map +1 -1
- package/dist/indexer/pipeline.d.ts +27 -3
- package/dist/indexer/pipeline.js +325 -143
- package/dist/indexer/pipeline.js.map +1 -1
- package/dist/indexer/stats.d.ts +35 -0
- package/dist/indexer/stats.js +9 -0
- package/dist/indexer/stats.js.map +1 -1
- package/dist/indexer/watch.d.ts +25 -0
- package/dist/indexer/watch.js +21 -0
- package/dist/indexer/watch.js.map +1 -1
- package/dist/indexer/worker.d.ts +96 -2
- package/dist/indexer/worker.js +109 -24
- package/dist/indexer/worker.js.map +1 -1
- package/dist/indexer.d.ts +11 -1
- package/dist/indexer.js +9 -0
- package/dist/indexer.js.map +1 -1
- package/dist/mcp/cli.d.ts +3 -0
- package/dist/mcp/cli.js +1 -0
- package/dist/mcp/cli.js.map +1 -1
- package/dist/mcp/handlers.d.ts +41 -0
- package/dist/mcp/handlers.js +40 -1
- package/dist/mcp/handlers.js.map +1 -1
- package/dist/mcp/server.d.ts +8 -0
- package/dist/mcp/server.js +18 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/opencode/create-read-tool.js +1 -0
- package/dist/opencode/create-read-tool.js.map +1 -1
- package/dist/opencode/tools.d.ts +8 -17
- package/dist/opencode/tools.js +74 -109
- package/dist/opencode/tools.js.map +1 -1
- package/dist/plugin-entry.d.ts +6 -0
- package/dist/plugin-entry.js +6 -0
- package/dist/plugin-entry.js.map +1 -1
- package/dist/plugin.d.ts +37 -0
- package/dist/plugin.js +278 -41
- package/dist/plugin.js.map +1 -1
- package/dist/retriever/keyword-index.js +9 -9
- package/dist/retriever/keyword-index.js.map +1 -1
- package/dist/retriever/retriever.js +14 -4
- package/dist/retriever/retriever.js.map +1 -1
- package/dist/tui.d.ts +5 -0
- package/dist/tui.js +101 -13
- package/dist/tui.js.map +1 -1
- package/dist/types/opencode-plugin.d.ts +4 -1
- package/dist/updater.d.ts +23 -1
- package/dist/updater.js +55 -16
- package/dist/updater.js.map +1 -1
- package/dist/vectorstore/factory.d.ts +13 -0
- package/dist/vectorstore/factory.js +13 -0
- package/dist/vectorstore/factory.js.map +1 -1
- package/dist/vectorstore/lancedb.d.ts +78 -1
- package/dist/vectorstore/lancedb.js +195 -21
- package/dist/vectorstore/lancedb.js.map +1 -1
- package/dist/vectorstore/memory.d.ts +5 -0
- package/dist/vectorstore/memory.js +11 -0
- package/dist/vectorstore/memory.js.map +1 -1
- package/dist/watcher.d.ts +24 -0
- package/dist/watcher.js +17 -35
- package/dist/watcher.js.map +1 -1
- package/dist/web/api.d.ts +37 -0
- package/dist/web/api.js +54 -0
- package/dist/web/api.js.map +1 -1
- package/dist/web/server.d.ts +15 -0
- package/dist/web/server.js +14 -0
- package/dist/web/server.js.map +1 -1
- package/dist/web/static.d.ts +8 -0
- package/dist/web/static.js +8 -0
- package/dist/web/static.js.map +1 -1
- package/package.json +11 -15
package/ReadMe.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenCodeRAG
|
|
2
2
|
|
|
3
|
-
OpenCodeRAG is a **local-first RAG plugin** for semantic code search. It converts your codebase into vector indices and retrieves relevant code chunks on natural language queries. The primary aim is to save tokens by replacing full-file reads with targeted chunk retrieval and to speed-up tool calls for large codebases. Integrates seamlessly with [OpenCode](https://opencode.ai) and works as standalone MCP server or CLI tool.
|
|
3
|
+
OpenCodeRAG is a **local-first RAG plugin** for semantic code and image search. It converts your codebase into vector indices and retrieves relevant code chunks on natural language queries. The primary aim is to save tokens by replacing full-file reads with targeted chunk retrieval and to speed-up tool calls for large codebases. Integrates seamlessly with [OpenCode](https://opencode.ai) and works as a standalone MCP server or CLI tool for other AI harnesses.
|
|
4
4
|
|
|
5
5
|
You don't need a dedicated GPU to run smaller embedding LLMs, as these models can still run performant on modern CPUs.
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ You don't need a dedicated GPU to run smaller embedding LLMs, as these models ca
|
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
# 1. Clone and install
|
|
15
|
-
git clone https://github.com/
|
|
15
|
+
git clone https://github.com/MrDoe/OpenCodeRAG.git
|
|
16
16
|
cd OpenCodeRAG
|
|
17
17
|
npm install --legacy-peer-deps
|
|
18
18
|
npm run build
|
|
@@ -35,23 +35,22 @@ opencode-rag query "authentication middleware"
|
|
|
35
35
|
|
|
36
36
|
| Feature | Description |
|
|
37
37
|
|---|---|
|
|
38
|
-
| **MCP server** | `opencode-rag mcp` - stdio-based MCP server exposing `search_semantic`, `get_file_skeleton`, `find_usages` tools for any MCP-compatible client |
|
|
39
|
-
| **AST chunking** | 26 languages via tree-sitter (TS, JS, Python, Java, Go, Rust, C/C++, C#, Ruby, Kotlin, Swift, Bash, PHP, PowerShell, SQL, JSON, HTML, CSS, XML, YAML, TOML, INI, Dockerfile, Markdown, LaTeX, Razor) |
|
|
38
|
+
| **MCP server** | `opencode-rag mcp` - stdio-based MCP server exposing `search_semantic`, `get_file_skeleton`, `find_usages`, and `describe_image` tools for any MCP-compatible client |
|
|
39
|
+
| **AST chunking** | 26 languages via tree-sitter (TS, JS, Python, Java, Go, Rust, C/C++, C#, Ruby, Kotlin, Swift, Bash, PHP, PowerShell, SQL, JSON, HTML, CSS, XML (including SVG), YAML, TOML, INI, Dockerfile, Markdown, LaTeX, Razor) |
|
|
40
40
|
| **Document support** | Markdown, LaTeX, PDF, DOCX, DOC, Excel |
|
|
41
|
-
| **Image indexing** | Describe images via vision
|
|
41
|
+
| **Image indexing** | Describe images via vision LLM and store descriptions as searchable vector chunks |
|
|
42
42
|
| **Hybrid search** | Vector similarity + TF×IDF keyword fusion |
|
|
43
43
|
| **OpenCode plugin** | Auto-inject context, read-tool override, TUI settings, Ctrl+Enter to add RAG context, MCP registration on `init` |
|
|
44
44
|
| **Incremental indexing** | File-hash manifest, background watcher, auto-rebuild on corruption |
|
|
45
45
|
| **Privacy-first** | All processing stays local (when using Ollama) |
|
|
46
|
-
| **CLI** | `index`, `query`, `status`, `list`, `show`, `dump`, `clear`, `init`, `ui`, `mcp` |
|
|
47
|
-
| **Programmatic API** | TypeScript `search()`, `indexWorkspace()`, `getContext()`, `validateConfig()`, `scanWorkspace()`, `createBackgroundIndexer()`, `getIndexStatusSummary()` |
|
|
46
|
+
| **CLI Tools** | `index`, `query`, `status`, `list`, `show`, `dump`, `clear`, `init`, `ui`, `mcp` |
|
|
48
47
|
| **Proxy-aware** | Corporate proxy support with raw-socket localhost bypass |
|
|
49
|
-
| **OpenAI / Cohere** |
|
|
48
|
+
| **OpenAI / Anthropic / Cohere** | Use alternate embedding providers with API key auto-resolution |
|
|
50
49
|
| **Evaluation** | Session-level token tracking, RAG-on vs RAG-off comparison, tiktoken BPE counting |
|
|
51
50
|
|
|
52
51
|
## Web UI
|
|
53
52
|
|
|
54
|
-
A browser-based dashboard for exploring the indexed vector database - browse and inspect chunks and evaluate the OpenCode sessions in terms of retrieved chunks,
|
|
53
|
+
A browser-based dashboard for exploring the indexed vector database - browse and inspect chunks and evaluate the OpenCode sessions in terms of retrieved chunks, consumed tokens and more.
|
|
55
54
|
|
|
56
55
|

|
|
57
56
|
|
|
@@ -63,7 +62,7 @@ Launch with `opencode-rag ui`. See [Web UI documentation](doc/webui.md) for deta
|
|
|
63
62
|
|---|---|
|
|
64
63
|
| [Architecture](doc/architecture.md) | Module design, data flow, tech stack |
|
|
65
64
|
| [Installation](doc/installation.md) | Full install guide, global setup, uninstall |
|
|
66
|
-
| [Configuration](doc/configuration.md) | All options: embedding, indexing, retrieval, description, plugin |
|
|
65
|
+
| [Configuration](doc/configuration.md) | All options: embedding, indexing, retrieval, description, image description, plugin |
|
|
67
66
|
| [Chunking](doc/chunking.md) | Language matrix, adding new chunkers, custom chunkers |
|
|
68
67
|
| [Embedding](doc/embedding.md) | Providers, model recommendations, proxy, dimension probing |
|
|
69
68
|
| [Retrieval](doc/retrieval.md) | Pipeline, hybrid search, score fusion, caching |
|
|
@@ -80,7 +79,7 @@ Launch with `opencode-rag ui`. See [Web UI documentation](doc/webui.md) for deta
|
|
|
80
79
|
OpenCodeRAG can index image files (PNG, JPEG, WebP, etc.) by sending them to a vision-capable LLM and storing the generated text descriptions as searchable vector chunks. This makes visual assets discoverable via natural language queries (e.g., "login screen screenshot", "architecture diagram").
|
|
81
80
|
|
|
82
81
|
**Supported providers:** Ollama, OpenAI, Anthropic, Google Gemini compatible providers.
|
|
83
|
-
**Disabled by default** — enable in `opencode-rag.json` to opt in.
|
|
82
|
+
**Disabled by default** — enable in `opencode-rag.json` to opt in (recommended for dedicated GPUs).
|
|
84
83
|
|
|
85
84
|
## MCP Server
|
|
86
85
|
|
|
@@ -97,6 +96,7 @@ opencode-rag mcp
|
|
|
97
96
|
| `search_semantic` | Vector + keyword hybrid search across the indexed codebase |
|
|
98
97
|
| `get_file_skeleton` | AST-based file outline (functions, classes, methods) |
|
|
99
98
|
| `find_usages` | Find all references to a symbol by name |
|
|
99
|
+
| `describe_image` | Return the pre-generated description for an indexed image file |
|
|
100
100
|
|
|
101
101
|
Clients can configure the MCP server manually, or `opencode-rag init` auto-registers it.
|
|
102
102
|
|
|
@@ -107,8 +107,9 @@ OpenCodeRAG registers tools that agents can invoke directly. Agents discover the
|
|
|
107
107
|
1. **Skeleton first** - `get_file_skeleton(filePath)` to orient in a file
|
|
108
108
|
2. **Find usages** - `find_usages(symbolName)` before editing any symbol
|
|
109
109
|
3. **Search** - `search_semantic(query)` to find relevant code
|
|
110
|
-
4. **
|
|
111
|
-
5. **
|
|
110
|
+
4. **Describe images** - `describe_image(filePath)` when context involves an image
|
|
111
|
+
5. **Read** - use `read` on specific line ranges
|
|
112
|
+
6. **Edit** - make changes with full context
|
|
112
113
|
|
|
113
114
|
### Available Tools
|
|
114
115
|
|
|
@@ -117,6 +118,7 @@ OpenCodeRAG registers tools that agents can invoke directly. Agents discover the
|
|
|
117
118
|
| `search_semantic` | General-purpose code retrieval | Before any code task when you haven't read the relevant code |
|
|
118
119
|
| `get_file_skeleton` | Quick file overview via AST | Before reading a large file to decide which sections matter |
|
|
119
120
|
| `find_usages` | Symbol reference search | **Before editing** any function, variable, or class |
|
|
121
|
+
| `describe_image` | Retrieve pre-generated image description | When a user asks about a screenshot, diagram, or visual asset |
|
|
120
122
|
| `read` (optional) | RAG-enhanced file read | Full file contents with supplementary context chunks |
|
|
121
123
|
|
|
122
124
|
## OpenCode Integration
|
package/dist/api.d.ts
CHANGED
|
@@ -1,28 +1,80 @@
|
|
|
1
1
|
import { type IndexRunStats } from "./indexer.js";
|
|
2
|
+
import { type WorkspaceFile } from "./content/reader.js";
|
|
2
3
|
import type { SearchResult } from "./core/interfaces.js";
|
|
4
|
+
/** Options controlling a semantic search query. */
|
|
3
5
|
export interface SearchOptions {
|
|
6
|
+
/** Working directory to resolve relative paths against. */
|
|
4
7
|
cwd?: string;
|
|
8
|
+
/** Path to the opencode-rag.json config file. */
|
|
5
9
|
configPath?: string;
|
|
10
|
+
/** Maximum number of results to return (1-25). */
|
|
6
11
|
topK?: number;
|
|
12
|
+
/** Minimum relevance score threshold (0-1). */
|
|
7
13
|
minScore?: number;
|
|
14
|
+
/** Weight for hybrid keyword search (0-1). */
|
|
8
15
|
keywordWeight?: number;
|
|
16
|
+
/** Filter results to files matching these path patterns. */
|
|
9
17
|
pathHints?: string[];
|
|
18
|
+
/** Filter results to files matching these language identifiers. */
|
|
10
19
|
languageHints?: string[];
|
|
20
|
+
/** Include explanation metadata in results. */
|
|
11
21
|
explain?: boolean;
|
|
12
22
|
}
|
|
23
|
+
/** Options controlling workspace indexing. */
|
|
13
24
|
export interface IndexOptions {
|
|
25
|
+
/** Path to the opencode-rag.json config file. */
|
|
14
26
|
configPath?: string;
|
|
27
|
+
/** Force re-indexing even if already up to date. */
|
|
15
28
|
force?: boolean;
|
|
29
|
+
/** Callback invoked with progress messages during indexing. */
|
|
16
30
|
onProgress?: (message: string) => void;
|
|
17
31
|
}
|
|
32
|
+
/** The result of a context retrieval — matched chunks plus formatted text. */
|
|
18
33
|
export interface ContextResult {
|
|
34
|
+
/** Individual search results with chunk and score data. */
|
|
19
35
|
chunks: SearchResult[];
|
|
36
|
+
/** Formatted markdown text combining all results. */
|
|
20
37
|
text: string;
|
|
21
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Perform a semantic search against the indexed workspace.
|
|
41
|
+
* Bootstraps the RAG context (config, embedder, store) automatically.
|
|
42
|
+
*
|
|
43
|
+
* @param query - Natural language search query describing what to find.
|
|
44
|
+
* @param options - Optional search parameters (topK, filters, etc.).
|
|
45
|
+
* @returns An ordered array of search results with relevance scores.
|
|
46
|
+
*/
|
|
22
47
|
export declare function search(query: string, options?: SearchOptions): Promise<SearchResult[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Index (or re-index) the workspace files into the vector store.
|
|
50
|
+
* Reads the config, chunks all source files, embeds them, and writes to the store.
|
|
51
|
+
*
|
|
52
|
+
* @param cwd - Working directory to index (defaults to process.cwd()).
|
|
53
|
+
* @param options - Optional indexing parameters.
|
|
54
|
+
* @returns Statistics about the indexing run (files, chunks, etc.).
|
|
55
|
+
*/
|
|
23
56
|
export declare function indexWorkspace(cwd?: string, options?: IndexOptions): Promise<IndexRunStats>;
|
|
57
|
+
/**
|
|
58
|
+
* Retrieve and format context chunks for a query in one call.
|
|
59
|
+
* Combines `search()` with automatic formatting into a markdown block.
|
|
60
|
+
*
|
|
61
|
+
* @param query - Natural language query to search for.
|
|
62
|
+
* @param options - Optional search parameters.
|
|
63
|
+
* @returns A ContextResult with both raw chunks and formatted text.
|
|
64
|
+
*/
|
|
24
65
|
export declare function getContext(query: string, options?: SearchOptions): Promise<ContextResult>;
|
|
66
|
+
/** Validate an opencode-rag.json configuration file. */
|
|
25
67
|
export { validateConfig } from "./core/config.js";
|
|
26
68
|
export type { ConfigValidationResult } from "./core/config.js";
|
|
27
|
-
|
|
28
|
-
export
|
|
69
|
+
/** Scan workspace files and return a summary of indexing status. */
|
|
70
|
+
export { getIndexStatusSummary } from "./indexer.js";
|
|
71
|
+
export type { IndexRunStats } from "./indexer.js";
|
|
72
|
+
export type { WorkspaceFile } from "./content/reader.js";
|
|
73
|
+
import type { Logger } from "./indexer/pipeline.js";
|
|
74
|
+
/**
|
|
75
|
+
* Scan the workspace directory for indexable files according to the configuration.
|
|
76
|
+
* @param cwd - Root directory to scan.
|
|
77
|
+
* @param config - Workspace RAG configuration.
|
|
78
|
+
* @param logger - Optional logger.
|
|
79
|
+
*/
|
|
80
|
+
export declare function scanWorkspace(cwd: string, config: import("./core/config.js").RagConfig, logger?: Logger): Promise<WorkspaceFile[]>;
|
package/dist/api.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { resolveRagContext } from "./core/bootstrap.js";
|
|
2
2
|
import { retrieve } from "./retriever/retriever.js";
|
|
3
3
|
import { runIndexPass } from "./indexer.js";
|
|
4
|
+
import { scanWorkspaceFiles } from "./content/reader.js";
|
|
5
|
+
/**
|
|
6
|
+
* Format a list of search results into a human-readable markdown block.
|
|
7
|
+
* Each result is rendered as a code block with metadata header.
|
|
8
|
+
*/
|
|
4
9
|
function formatContextResults(results) {
|
|
5
10
|
if (results.length === 0)
|
|
6
11
|
return "No matching chunks found.";
|
|
@@ -18,6 +23,14 @@ function formatContextResults(results) {
|
|
|
18
23
|
}
|
|
19
24
|
return lines.join("\n");
|
|
20
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Perform a semantic search against the indexed workspace.
|
|
28
|
+
* Bootstraps the RAG context (config, embedder, store) automatically.
|
|
29
|
+
*
|
|
30
|
+
* @param query - Natural language search query describing what to find.
|
|
31
|
+
* @param options - Optional search parameters (topK, filters, etc.).
|
|
32
|
+
* @returns An ordered array of search results with relevance scores.
|
|
33
|
+
*/
|
|
21
34
|
export async function search(query, options = {}) {
|
|
22
35
|
const ctx = await resolveRagContext({
|
|
23
36
|
cwd: options.cwd,
|
|
@@ -32,6 +45,14 @@ export async function search(query, options = {}) {
|
|
|
32
45
|
explain: options.explain,
|
|
33
46
|
});
|
|
34
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Index (or re-index) the workspace files into the vector store.
|
|
50
|
+
* Reads the config, chunks all source files, embeds them, and writes to the store.
|
|
51
|
+
*
|
|
52
|
+
* @param cwd - Working directory to index (defaults to process.cwd()).
|
|
53
|
+
* @param options - Optional indexing parameters.
|
|
54
|
+
* @returns Statistics about the indexing run (files, chunks, etc.).
|
|
55
|
+
*/
|
|
35
56
|
export async function indexWorkspace(cwd, options = {}) {
|
|
36
57
|
const workDir = cwd ?? process.cwd();
|
|
37
58
|
const ctx = await resolveRagContext({
|
|
@@ -53,6 +74,14 @@ export async function indexWorkspace(cwd, options = {}) {
|
|
|
53
74
|
});
|
|
54
75
|
return stats;
|
|
55
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Retrieve and format context chunks for a query in one call.
|
|
79
|
+
* Combines `search()` with automatic formatting into a markdown block.
|
|
80
|
+
*
|
|
81
|
+
* @param query - Natural language query to search for.
|
|
82
|
+
* @param options - Optional search parameters.
|
|
83
|
+
* @returns A ContextResult with both raw chunks and formatted text.
|
|
84
|
+
*/
|
|
56
85
|
export async function getContext(query, options = {}) {
|
|
57
86
|
const results = await search(query, options);
|
|
58
87
|
return {
|
|
@@ -60,6 +89,17 @@ export async function getContext(query, options = {}) {
|
|
|
60
89
|
text: formatContextResults(results),
|
|
61
90
|
};
|
|
62
91
|
}
|
|
92
|
+
/** Validate an opencode-rag.json configuration file. */
|
|
63
93
|
export { validateConfig } from "./core/config.js";
|
|
64
|
-
|
|
94
|
+
/** Scan workspace files and return a summary of indexing status. */
|
|
95
|
+
export { getIndexStatusSummary } from "./indexer.js";
|
|
96
|
+
/**
|
|
97
|
+
* Scan the workspace directory for indexable files according to the configuration.
|
|
98
|
+
* @param cwd - Root directory to scan.
|
|
99
|
+
* @param config - Workspace RAG configuration.
|
|
100
|
+
* @param logger - Optional logger.
|
|
101
|
+
*/
|
|
102
|
+
export async function scanWorkspace(cwd, config, logger) {
|
|
103
|
+
return scanWorkspaceFiles(cwd, config, logger);
|
|
104
|
+
}
|
|
65
105
|
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;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,KAAK,IAAI,KAAK;QAC7B,YAAY,EAAE,GAAG,CAAC,YAAY;QAC9B,mBAAmB,EAAE,GAAG,CAAC,mBAAmB;KAC7C,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,KAAa,EACb,UAAyB,EAAE;IAE3B,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC7C,OAAO;QACL,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC;KACpC,CAAC;AACJ,CAAC;AAED,wDAAwD;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,oEAAoE;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAMrD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,GAAW,EACX,MAA4C,EAC5C,MAAe;IAEf,OAAO,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/chunker/base.js
CHANGED
|
@@ -21,6 +21,7 @@ export class TreeSitterChunker {
|
|
|
21
21
|
return nodes.map((node) => ({
|
|
22
22
|
id: uuid(),
|
|
23
23
|
content: node.text,
|
|
24
|
+
description: node.leadingDoc,
|
|
24
25
|
metadata: {
|
|
25
26
|
filePath,
|
|
26
27
|
startLine: node.startLine,
|
|
@@ -59,6 +60,7 @@ export class TreeSitterChunker {
|
|
|
59
60
|
return nodes.map((node) => ({
|
|
60
61
|
id: uuid(),
|
|
61
62
|
content: node.text,
|
|
63
|
+
description: node.leadingDoc,
|
|
62
64
|
metadata: {
|
|
63
65
|
filePath,
|
|
64
66
|
startLine: node.startLine,
|
package/dist/chunker/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["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AM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAE3C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAC;QAErB,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE/D,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC;YACnC,EAAE,EAAE,IAAI,EAAE;YACV,OAAO,EAAE,IAAI,CAAC,IAAI;YAClB,WAAW,EAAE,IAAI,CAAC,UAAU;YAC5B,QAAQ,EAAE;gBACR,QAAQ;gBACR,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB;SACF,CAAC,CAAC,CAAC;IACN,CAAC;CACF"}
|
package/dist/chunker/bash.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { TreeSitterChunker } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Chunker for Bash shell scripts (.sh, .bash, .zsh).
|
|
4
|
+
* Uses tree-sitter to parse and split by function definitions.
|
|
5
|
+
*/
|
|
2
6
|
export declare class BashChunker extends TreeSitterChunker {
|
|
3
7
|
readonly language = "bash";
|
|
4
8
|
readonly fileExtensions: string[];
|
|
5
9
|
readonly grammarName = "bash";
|
|
6
10
|
readonly nodeTypes: Set<string>;
|
|
7
11
|
}
|
|
12
|
+
/** Default singleton instance of {@link BashChunker}. */
|
|
8
13
|
export declare const bashChunker: BashChunker;
|
package/dist/chunker/bash.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { TreeSitterChunker } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Chunker for Bash shell scripts (.sh, .bash, .zsh).
|
|
4
|
+
* Uses tree-sitter to parse and split by function definitions.
|
|
5
|
+
*/
|
|
2
6
|
export class BashChunker extends TreeSitterChunker {
|
|
3
7
|
language = "bash";
|
|
4
8
|
fileExtensions = [".sh", ".bash", ".zsh"];
|
|
@@ -7,5 +11,6 @@ export class BashChunker extends TreeSitterChunker {
|
|
|
7
11
|
"function_definition",
|
|
8
12
|
]);
|
|
9
13
|
}
|
|
14
|
+
/** Default singleton instance of {@link BashChunker}. */
|
|
10
15
|
export const bashChunker = new BashChunker();
|
|
11
16
|
//# sourceMappingURL=bash.js.map
|
package/dist/chunker/bash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../src/chunker/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IACvC,QAAQ,GAAG,MAAM,CAAC;IAClB,cAAc,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1C,WAAW,GAAG,MAAM,CAAC;IACrB,SAAS,GAAG,IAAI,GAAG,CAAC;QAC3B,qBAAqB;KACtB,CAAC,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../src/chunker/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IACvC,QAAQ,GAAG,MAAM,CAAC;IAClB,cAAc,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1C,WAAW,GAAG,MAAM,CAAC;IACrB,SAAS,GAAG,IAAI,GAAG,CAAC;QAC3B,qBAAqB;KACtB,CAAC,CAAC;CACJ;AAED,yDAAyD;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC"}
|
package/dist/chunker/c.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { TreeSitterChunker } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Chunker for C source files (.c, .h).
|
|
4
|
+
* Uses tree-sitter to parse and split by function definitions, struct/enum/union
|
|
5
|
+
* specifiers, typedefs, and preprocessor defines.
|
|
6
|
+
*/
|
|
2
7
|
export declare class CChunker extends TreeSitterChunker {
|
|
3
8
|
readonly language = "c";
|
|
4
9
|
readonly fileExtensions: string[];
|
|
5
10
|
readonly grammarName = "c";
|
|
6
11
|
readonly nodeTypes: Set<string>;
|
|
7
12
|
}
|
|
13
|
+
/** Default singleton instance of {@link CChunker}. */
|
|
8
14
|
export declare const cChunker: CChunker;
|
package/dist/chunker/c.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { TreeSitterChunker } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Chunker for C source files (.c, .h).
|
|
4
|
+
* Uses tree-sitter to parse and split by function definitions, struct/enum/union
|
|
5
|
+
* specifiers, typedefs, and preprocessor defines.
|
|
6
|
+
*/
|
|
2
7
|
export class CChunker extends TreeSitterChunker {
|
|
3
8
|
language = "c";
|
|
4
9
|
fileExtensions = [".c", ".h"];
|
|
@@ -12,5 +17,6 @@ export class CChunker extends TreeSitterChunker {
|
|
|
12
17
|
"preproc_def",
|
|
13
18
|
]);
|
|
14
19
|
}
|
|
20
|
+
/** Default singleton instance of {@link CChunker}. */
|
|
15
21
|
export const cChunker = new CChunker();
|
|
16
22
|
//# sourceMappingURL=c.js.map
|
package/dist/chunker/c.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c.js","sourceRoot":"","sources":["../../src/chunker/c.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,OAAO,QAAS,SAAQ,iBAAiB;IACpC,QAAQ,GAAG,GAAG,CAAC;IACf,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,WAAW,GAAG,GAAG,CAAC;IAClB,SAAS,GAAG,IAAI,GAAG,CAAC;QAC3B,qBAAqB;QACrB,kBAAkB;QAClB,gBAAgB;QAChB,iBAAiB;QACjB,iBAAiB;QACjB,aAAa;KACd,CAAC,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"c.js","sourceRoot":"","sources":["../../src/chunker/c.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,iBAAiB;IACpC,QAAQ,GAAG,GAAG,CAAC;IACf,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,WAAW,GAAG,GAAG,CAAC;IAClB,SAAS,GAAG,IAAI,GAAG,CAAC;QAC3B,qBAAqB;QACrB,kBAAkB;QAClB,gBAAgB;QAChB,iBAAiB;QACjB,iBAAiB;QACjB,aAAa;KACd,CAAC,CAAC;CACJ;AAED,sDAAsD;AACtD,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC"}
|
package/dist/chunker/cpp.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { TreeSitterChunker } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Chunker for C++ source files (.cpp, .cc, .cxx, .hpp, .hxx).
|
|
4
|
+
* Uses tree-sitter to parse and split by function definitions and
|
|
5
|
+
* struct/enum/union specifiers.
|
|
6
|
+
*/
|
|
2
7
|
export declare class CppChunker extends TreeSitterChunker {
|
|
3
8
|
readonly language = "cpp";
|
|
4
9
|
readonly fileExtensions: string[];
|
|
5
10
|
readonly grammarName = "cpp";
|
|
6
11
|
readonly nodeTypes: Set<string>;
|
|
7
12
|
}
|
|
13
|
+
/** Default singleton instance of {@link CppChunker}. */
|
|
8
14
|
export declare const cppChunker: CppChunker;
|
package/dist/chunker/cpp.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { TreeSitterChunker } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Chunker for C++ source files (.cpp, .cc, .cxx, .hpp, .hxx).
|
|
4
|
+
* Uses tree-sitter to parse and split by function definitions and
|
|
5
|
+
* struct/enum/union specifiers.
|
|
6
|
+
*/
|
|
2
7
|
export class CppChunker extends TreeSitterChunker {
|
|
3
8
|
language = "cpp";
|
|
4
9
|
fileExtensions = [".cpp", ".cc", ".cxx", ".hpp", ".hxx"];
|
|
@@ -10,5 +15,6 @@ export class CppChunker extends TreeSitterChunker {
|
|
|
10
15
|
"union_specifier",
|
|
11
16
|
]);
|
|
12
17
|
}
|
|
18
|
+
/** Default singleton instance of {@link CppChunker}. */
|
|
13
19
|
export const cppChunker = new CppChunker();
|
|
14
20
|
//# sourceMappingURL=cpp.js.map
|
package/dist/chunker/cpp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cpp.js","sourceRoot":"","sources":["../../src/chunker/cpp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IACtC,QAAQ,GAAG,KAAK,CAAC;IACjB,cAAc,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACzD,WAAW,GAAG,KAAK,CAAC;IACpB,SAAS,GAAG,IAAI,GAAG,CAAC;QAC3B,qBAAqB;QACrB,kBAAkB;QAClB,gBAAgB;QAChB,iBAAiB;KAClB,CAAC,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"cpp.js","sourceRoot":"","sources":["../../src/chunker/cpp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IACtC,QAAQ,GAAG,KAAK,CAAC;IACjB,cAAc,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACzD,WAAW,GAAG,KAAK,CAAC;IACpB,SAAS,GAAG,IAAI,GAAG,CAAC;QAC3B,qBAAqB;QACrB,kBAAkB;QAClB,gBAAgB;QAChB,iBAAiB;KAClB,CAAC,CAAC;CACJ;AAED,wDAAwD;AACxD,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC"}
|
package/dist/chunker/csharp.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { TreeSitterChunker } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Chunker for C# source files (.cs).
|
|
4
|
+
* Uses tree-sitter to parse and split by method, interface, struct, record,
|
|
5
|
+
* and enum declarations.
|
|
6
|
+
*/
|
|
2
7
|
export declare class CSharpChunker extends TreeSitterChunker {
|
|
3
8
|
readonly language = "csharp";
|
|
4
9
|
readonly fileExtensions: string[];
|
|
5
10
|
readonly grammarName = "c_sharp";
|
|
6
11
|
readonly nodeTypes: Set<string>;
|
|
7
12
|
}
|
|
13
|
+
/** Default singleton instance of {@link CSharpChunker}. */
|
|
8
14
|
export declare const csharpChunker: CSharpChunker;
|
package/dist/chunker/csharp.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { TreeSitterChunker } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Chunker for C# source files (.cs).
|
|
4
|
+
* Uses tree-sitter to parse and split by method, interface, struct, record,
|
|
5
|
+
* and enum declarations.
|
|
6
|
+
*/
|
|
2
7
|
export class CSharpChunker extends TreeSitterChunker {
|
|
3
8
|
language = "csharp";
|
|
4
9
|
fileExtensions = [".cs"];
|
|
@@ -11,5 +16,6 @@ export class CSharpChunker extends TreeSitterChunker {
|
|
|
11
16
|
"enum_declaration",
|
|
12
17
|
]);
|
|
13
18
|
}
|
|
19
|
+
/** Default singleton instance of {@link CSharpChunker}. */
|
|
14
20
|
export const csharpChunker = new CSharpChunker();
|
|
15
21
|
//# sourceMappingURL=csharp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csharp.js","sourceRoot":"","sources":["../../src/chunker/csharp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IACzC,QAAQ,GAAG,QAAQ,CAAC;IACpB,cAAc,GAAG,CAAC,KAAK,CAAC,CAAC;IACzB,WAAW,GAAG,SAAS,CAAC;IACxB,SAAS,GAAG,IAAI,GAAG,CAAC;QAC3B,oBAAoB;QACpB,uBAAuB;QACvB,oBAAoB;QACpB,oBAAoB;QACpB,kBAAkB;KACnB,CAAC,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"csharp.js","sourceRoot":"","sources":["../../src/chunker/csharp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IACzC,QAAQ,GAAG,QAAQ,CAAC;IACpB,cAAc,GAAG,CAAC,KAAK,CAAC,CAAC;IACzB,WAAW,GAAG,SAAS,CAAC;IACxB,SAAS,GAAG,IAAI,GAAG,CAAC;QAC3B,oBAAoB;QACpB,uBAAuB;QACvB,oBAAoB;QACpB,oBAAoB;QACpB,kBAAkB;KACnB,CAAC,CAAC;CACJ;AAED,2DAA2D;AAC3D,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
|
package/dist/chunker/css.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { TreeSitterChunker } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Chunker for CSS stylesheets (.css).
|
|
4
|
+
* Uses tree-sitter to parse and split by rule sets, at-rules, media
|
|
5
|
+
* statements, and keyframes statements.
|
|
6
|
+
*/
|
|
2
7
|
export declare class CssChunker extends TreeSitterChunker {
|
|
3
8
|
readonly language = "css";
|
|
4
9
|
readonly fileExtensions: string[];
|
|
5
10
|
readonly grammarName = "css";
|
|
6
11
|
readonly nodeTypes: Set<string>;
|
|
7
12
|
}
|
|
13
|
+
/** Default singleton instance of {@link CssChunker}. */
|
|
8
14
|
export declare const cssChunker: CssChunker;
|
package/dist/chunker/css.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { TreeSitterChunker } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Chunker for CSS stylesheets (.css).
|
|
4
|
+
* Uses tree-sitter to parse and split by rule sets, at-rules, media
|
|
5
|
+
* statements, and keyframes statements.
|
|
6
|
+
*/
|
|
2
7
|
export class CssChunker extends TreeSitterChunker {
|
|
3
8
|
language = "css";
|
|
4
9
|
fileExtensions = [".css"];
|
|
@@ -10,5 +15,6 @@ export class CssChunker extends TreeSitterChunker {
|
|
|
10
15
|
"keyframes_statement",
|
|
11
16
|
]);
|
|
12
17
|
}
|
|
18
|
+
/** Default singleton instance of {@link CssChunker}. */
|
|
13
19
|
export const cssChunker = new CssChunker();
|
|
14
20
|
//# sourceMappingURL=css.js.map
|
package/dist/chunker/css.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../src/chunker/css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IACtC,QAAQ,GAAG,KAAK,CAAC;IACjB,cAAc,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,WAAW,GAAG,KAAK,CAAC;IACpB,SAAS,GAAG,IAAI,GAAG,CAAC;QAC3B,UAAU;QACV,SAAS;QACT,iBAAiB;QACjB,qBAAqB;KACtB,CAAC,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../src/chunker/css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IACtC,QAAQ,GAAG,KAAK,CAAC;IACjB,cAAc,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,WAAW,GAAG,KAAK,CAAC;IACpB,SAAS,GAAG,IAAI,GAAG,CAAC;QAC3B,UAAU;QACV,SAAS;QACT,iBAAiB;QACjB,qBAAqB;KACtB,CAAC,CAAC;CACJ;AAED,wDAAwD;AACxD,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC"}
|
package/dist/chunker/doc.d.ts
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import type { Chunker, Chunk } from "../core/interfaces.js";
|
|
2
|
+
/**
|
|
3
|
+
* Extract the body text from a legacy Word (.doc) file buffer.
|
|
4
|
+
* Uses the `word-extractor` library under the hood.
|
|
5
|
+
* @param buffer - Raw buffer of the .doc file.
|
|
6
|
+
* @returns The extracted body text as a string.
|
|
7
|
+
*/
|
|
2
8
|
export declare function extractDocText(buffer: Buffer): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Chunker for legacy Word (.doc) documents.
|
|
11
|
+
* Splits the extracted plain text by paragraph boundaries, grouping small
|
|
12
|
+
* paragraphs into chunks of up to 4000 characters.
|
|
13
|
+
*/
|
|
3
14
|
export declare class DocChunker implements Chunker {
|
|
4
15
|
readonly language = "doc";
|
|
5
16
|
readonly fileExtensions: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Split the document text into chunks by paragraph grouping.
|
|
19
|
+
* @param filePath - Original file path (for metadata).
|
|
20
|
+
* @param content - Extracted plain-text content of the .doc file.
|
|
21
|
+
* @returns A list of text chunks with file-path and line-range metadata.
|
|
22
|
+
*/
|
|
6
23
|
chunk(filePath: string, content: string): Promise<Chunk[]>;
|
|
7
24
|
}
|
|
25
|
+
/** Default singleton instance of {@link DocChunker}. */
|
|
8
26
|
export declare const docChunker: DocChunker;
|
package/dist/chunker/doc.js
CHANGED
|
@@ -2,15 +2,32 @@ import { uuid } from "./uuid.js";
|
|
|
2
2
|
const MAX_CHUNK_CHARS = 4000;
|
|
3
3
|
const MIN_GROUP_CHARS = 300;
|
|
4
4
|
const PARAGRAPH_SPLIT = /\n\s*\n/;
|
|
5
|
+
/**
|
|
6
|
+
* Extract the body text from a legacy Word (.doc) file buffer.
|
|
7
|
+
* Uses the `word-extractor` library under the hood.
|
|
8
|
+
* @param buffer - Raw buffer of the .doc file.
|
|
9
|
+
* @returns The extracted body text as a string.
|
|
10
|
+
*/
|
|
5
11
|
export async function extractDocText(buffer) {
|
|
6
12
|
const WordExtractor = (await import("word-extractor")).default;
|
|
7
13
|
const extractor = new WordExtractor();
|
|
8
14
|
const doc = await extractor.extract(buffer);
|
|
9
15
|
return doc.getBody();
|
|
10
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Chunker for legacy Word (.doc) documents.
|
|
19
|
+
* Splits the extracted plain text by paragraph boundaries, grouping small
|
|
20
|
+
* paragraphs into chunks of up to 4000 characters.
|
|
21
|
+
*/
|
|
11
22
|
export class DocChunker {
|
|
12
23
|
language = "doc";
|
|
13
24
|
fileExtensions = [".doc"];
|
|
25
|
+
/**
|
|
26
|
+
* Split the document text into chunks by paragraph grouping.
|
|
27
|
+
* @param filePath - Original file path (for metadata).
|
|
28
|
+
* @param content - Extracted plain-text content of the .doc file.
|
|
29
|
+
* @returns A list of text chunks with file-path and line-range metadata.
|
|
30
|
+
*/
|
|
14
31
|
async chunk(filePath, content) {
|
|
15
32
|
if (content.trim().length === 0)
|
|
16
33
|
return [];
|
|
@@ -75,5 +92,6 @@ export class DocChunker {
|
|
|
75
92
|
return chunks;
|
|
76
93
|
}
|
|
77
94
|
}
|
|
95
|
+
/** Default singleton instance of {@link DocChunker}. */
|
|
78
96
|
export const docChunker = new DocChunker();
|
|
79
97
|
//# sourceMappingURL=doc.js.map
|
package/dist/chunker/doc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc.js","sourceRoot":"","sources":["../../src/chunker/doc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAM,eAAe,GAAG,SAAS,CAAC;AAElC,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAc;IACjD,MAAM,aAAa,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/D,MAAM,SAAS,GAAG,IAAI,aAAa,EAAE,CAAC;IACtC,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO,GAAG,CAAC,OAAO,EAAE,CAAC;AACvB,CAAC;AAED,MAAM,OAAO,UAAU;IACZ,QAAQ,GAAG,KAAK,CAAC;IACjB,cAAc,GAAG,CAAC,MAAM,CAAC,CAAC;IAEnC,KAAK,CAAC,KAAK,CAAC,QAAgB,EAAE,OAAe;QAC3C,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;YAAE,OA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@ -1,8 +1,14 @@
|
|
|
1
1
|
import { TreeSitterChunker } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Chunker for Dockerfiles (.dockerfile, Dockerfile, .containerfile, Containerfile).
|
|
4
|
+
* Uses tree-sitter to parse and split by each Dockerfile instruction type
|
|
5
|
+
* (FROM, RUN, CMD, ENV, COPY, etc.).
|
|
6
|
+
*/
|
|
2
7
|
export declare class DockerfileChunker extends TreeSitterChunker {
|
|
3
8
|
readonly language = "dockerfile";
|
|
4
9
|
readonly fileExtensions: string[];
|
|
5
10
|
readonly grammarName = "dockerfile";
|
|
6
11
|
readonly nodeTypes: Set<string>;
|
|
7
12
|
}
|
|
13
|
+
/** Default singleton instance of {@link DockerfileChunker}. */
|
|
8
14
|
export declare const dockerfileChunker: DockerfileChunker;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { TreeSitterChunker } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Chunker for Dockerfiles (.dockerfile, Dockerfile, .containerfile, Containerfile).
|
|
4
|
+
* Uses tree-sitter to parse and split by each Dockerfile instruction type
|
|
5
|
+
* (FROM, RUN, CMD, ENV, COPY, etc.).
|
|
6
|
+
*/
|
|
2
7
|
export class DockerfileChunker extends TreeSitterChunker {
|
|
3
8
|
language = "dockerfile";
|
|
4
9
|
fileExtensions = [".dockerfile", "dockerfile", ".containerfile", "containerfile"];
|
|
@@ -25,5 +30,6 @@ export class DockerfileChunker extends TreeSitterChunker {
|
|
|
25
30
|
"cross_build_instruction",
|
|
26
31
|
]);
|
|
27
32
|
}
|
|
33
|
+
/** Default singleton instance of {@link DockerfileChunker}. */
|
|
28
34
|
export const dockerfileChunker = new DockerfileChunker();
|
|
29
35
|
//# sourceMappingURL=dockerfile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dockerfile.js","sourceRoot":"","sources":["../../src/chunker/dockerfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MA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