opencode-readseek 0.6.1 → 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.
Files changed (2) hide show
  1. package/index.ts +21 -2
  2. package/package.json +3 -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([process.execPath, readseekScript, ...args], {
168
+ const child = Bun.spawn([readSeekBinaryPath(), ...args], {
152
169
  cwd: context.directory,
153
170
  killSignal: "SIGKILL",
154
171
  maxBuffer: MAX_OUTPUT_BYTES,
@@ -537,3 +554,5 @@ export const ReadSeekPlugin: Plugin = async (_input, options) => {
537
554
  },
538
555
  };
539
556
  };
557
+
558
+ export default { id: "opencode-readseek", server: ReadSeekPlugin };
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "opencode-readseek",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "OpenCode plugin for readseek-backed structural code navigation",
5
5
  "type": "module",
6
+ "main": "./index.ts",
6
7
  "exports": {
7
8
  ".": "./index.ts",
8
9
  "./server": "./index.ts"
@@ -29,7 +30,7 @@
29
30
  "node": ">=20.0.0"
30
31
  },
31
32
  "dependencies": {
32
- "@jarkkojs/readseek": "^0.6.1",
33
+ "@jarkkojs/readseek": "^0.6.3",
33
34
  "@opencode-ai/plugin": "^1.17.20"
34
35
  },
35
36
  "devDependencies": {