opencode-readseek 0.6.2 → 0.6.3
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/index.ts +19 -2
- package/package.json +2 -2
package/index.ts
CHANGED
|
@@ -8,8 +8,13 @@ import path from "node:path";
|
|
|
8
8
|
import { tool, type Plugin, type PluginOptions, type ToolContext } from "@opencode-ai/plugin";
|
|
9
9
|
|
|
10
10
|
const require = createRequire(import.meta.url);
|
|
11
|
-
const readseekScript = require.resolve("@jarkkojs/readseek/bin/readseek.js");
|
|
12
11
|
const MAX_OUTPUT_BYTES = 32 * 1024 * 1024;
|
|
12
|
+
const READSEEK_PLATFORM_PACKAGES: Record<string, string> = {
|
|
13
|
+
"darwin-arm64": "@jarkkojs/readseek-darwin-arm64",
|
|
14
|
+
"linux-arm64": "@jarkkojs/readseek-linux-arm64",
|
|
15
|
+
"linux-x64": "@jarkkojs/readseek-linux-x64",
|
|
16
|
+
"win32-x64": "@jarkkojs/readseek-win32-x64",
|
|
17
|
+
};
|
|
13
18
|
|
|
14
19
|
type RenamePlan = {
|
|
15
20
|
summary: string;
|
|
@@ -146,9 +151,21 @@ function optionalFlag(args: string[], enabled: boolean | undefined, flag: string
|
|
|
146
151
|
if (enabled) args.push(flag);
|
|
147
152
|
}
|
|
148
153
|
|
|
154
|
+
function readSeekBinaryPath(): string {
|
|
155
|
+
const platform = `${process.platform}-${process.arch}`;
|
|
156
|
+
const platformPackage = READSEEK_PLATFORM_PACKAGES[platform];
|
|
157
|
+
if (!platformPackage) {
|
|
158
|
+
throw new Error(`@jarkkojs/readseek ships no binary for ${platform}`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const readseekPackageDir = path.dirname(require.resolve("@jarkkojs/readseek/package.json"));
|
|
162
|
+
const packageJson = require.resolve(`${platformPackage}/package.json`, { paths: [readseekPackageDir] });
|
|
163
|
+
return path.join(path.dirname(packageJson), "bin", process.platform === "win32" ? "readseek.exe" : "readseek");
|
|
164
|
+
}
|
|
165
|
+
|
|
149
166
|
async function runReadSeek(context: ToolContext, args: string[]): Promise<unknown> {
|
|
150
167
|
context.abort.throwIfAborted();
|
|
151
|
-
const child = Bun.spawn([
|
|
168
|
+
const child = Bun.spawn([readSeekBinaryPath(), ...args], {
|
|
152
169
|
cwd: context.directory,
|
|
153
170
|
killSignal: "SIGKILL",
|
|
154
171
|
maxBuffer: MAX_OUTPUT_BYTES,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-readseek",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "OpenCode plugin for readseek-backed structural code navigation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"node": ">=20.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@jarkkojs/readseek": "^0.6.
|
|
33
|
+
"@jarkkojs/readseek": "^0.6.3",
|
|
34
34
|
"@opencode-ai/plugin": "^1.17.20"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|