opencode-rag-plugin 2.0.0 → 2.0.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/dist/cli/commands/mcp.js +2 -1
- package/dist/tui.js +9 -1
- package/package.json +1 -1
package/dist/cli/commands/mcp.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* `mcp` command — starts an MCP server for semantic code retrieval via stdio transport.
|
|
6
6
|
*/
|
|
7
|
+
import path from "node:path";
|
|
7
8
|
import { logCliError } from "../format.js";
|
|
8
9
|
/**
|
|
9
10
|
* Register the `mcp` command on the given Commander program.
|
|
@@ -29,7 +30,7 @@ export function registerMcpCommand(program) {
|
|
|
29
30
|
}
|
|
30
31
|
catch (err) {
|
|
31
32
|
const message = err.message || String(err);
|
|
32
|
-
const logFilePath =
|
|
33
|
+
const logFilePath = path.resolve(process.cwd(), ".opencode", "opencode-rag.log");
|
|
33
34
|
logCliError(logFilePath, "mcp", `\nMCP server failed: ${message}`, err);
|
|
34
35
|
process.exit(1);
|
|
35
36
|
}
|
package/dist/tui.js
CHANGED
|
@@ -4,12 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { createElement, insert, setProp } from "@opentui/solid";
|
|
6
6
|
import { readFileSync, existsSync, writeFileSync, unlinkSync } from "node:fs";
|
|
7
|
+
import { createRequire } from "node:module";
|
|
7
8
|
import { dirname, join, resolve } from "node:path";
|
|
8
9
|
import { fileURLToPath } from "node:url";
|
|
9
10
|
import { loadRuntimeOverrides, saveRuntimeOverride } from "./core/runtime-overrides.js";
|
|
10
11
|
import { PROVIDER_DEFAULTS } from "./core/provider-defaults.js";
|
|
11
12
|
import { loadConfig, updateConfigValue } from "./core/config.js";
|
|
12
13
|
import { setPendingRagInjection } from "./core/rag-injection-flag.js";
|
|
14
|
+
/**
|
|
15
|
+
* Lazy CommonJS require — this file is ESM ("type": "module"), so a bare
|
|
16
|
+
* `require()` throws ReferenceError. Used by `readTokenStats` to keep
|
|
17
|
+
* `./eval/storage.js` out of the TUI startup path (same pattern as
|
|
18
|
+
* `src/eval/token-counter.ts`).
|
|
19
|
+
*/
|
|
20
|
+
const _require = createRequire(import.meta.url);
|
|
13
21
|
/** Cached plugin version string from package.json. */
|
|
14
22
|
let _version;
|
|
15
23
|
/** Read the plugin version from package.json, caching the result. */
|
|
@@ -635,7 +643,7 @@ function readTokenStats(worktree) {
|
|
|
635
643
|
const vs = cfg.vectorStore;
|
|
636
644
|
const storeRelPath = vs?.path ?? ".opencode/rag_db";
|
|
637
645
|
const storePath = resolve(worktree, storeRelPath);
|
|
638
|
-
const { listSessions } =
|
|
646
|
+
const { listSessions } = _require("./eval/storage.js");
|
|
639
647
|
const sessions = listSessions(storePath);
|
|
640
648
|
if (sessions.length === 0)
|
|
641
649
|
return undefined;
|