opencode-readseek 0.8.9 → 0.8.11

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 (3) hide show
  1. package/README.md +2 -2
  2. package/index.ts +31 -8
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -36,8 +36,8 @@ The plugin requests read, grep, external-directory, and edit permissions as need
36
36
  File changes invalidate remembered anchors. Compaction state retains fresh paths
37
37
  and pending rename plans. Text reads return at most 2,000 lines by default.
38
38
 
39
- OpenCode is instructed to prefer ReadSeek's read, edit, write, and rename tools;
40
- built-in tools remain available as fallbacks.
39
+ OpenCode is instructed to prefer ReadSeek tools over built-in read/edit/write/grep
40
+ and symbol navigation; built-ins remain available as fallbacks.
41
41
 
42
42
  ## Configuration
43
43
 
package/index.ts CHANGED
@@ -14,18 +14,36 @@ const DEFAULT_READ_LIMIT = 2000;
14
14
  const EDIT_RESULT_READ_LIMIT = 40;
15
15
  const MAX_DOCUMENT_OUTPUT_BYTES = 256 * 1024;
16
16
  const MAX_DOCUMENT_OUTPUT_LINES = 2000;
17
- const EDITING_POLICY = [
18
- "ReadSeek editing policy:",
19
- "- Prefer readseek_read over built-in file reads when preparing to edit existing text; its LINE:HASH anchors are required by readseek_edit.",
17
+ const TOOL_POLICY = [
18
+ "ReadSeek tool policy:",
19
+ "- Prefer readseek_* tools over OpenCode built-ins whenever they can do the job.",
20
+ "- Prefer readseek_read for text file reads; its LINE:HASH anchors are required by readseek_edit.",
21
+ "- Prefer readseek_grep for text/regex search and readseek_search for syntax-aware code shapes.",
22
+ "- Prefer readseek_map, readseek_def, readseek_refs, and readseek_hover for symbol navigation.",
20
23
  "- Prefer readseek_edit for existing text files, readseek_write for whole-file creation or replacement, and readseek_rename for symbol renames.",
21
- "- Do not use built-in edit, write, or apply_patch when the corresponding ReadSeek tool can perform the change.",
24
+ "- Do not use built-in read, edit, write, grep, or apply_patch when the corresponding ReadSeek tool can perform the change.",
22
25
  "- Use readseek_check after source edits for a quick syntax check.",
23
26
  ].join("\n");
24
27
  const PREFERRED_TOOL_DESCRIPTIONS: Record<string, string> = {
28
+ readseek_read: "Preferred file reader; returns LINE:HASH anchors required by readseek_edit.",
25
29
  readseek_edit: "Preferred tool for editing existing text files with verified LINE:HASH anchors.",
26
- readseek_read: "Preferred file reader when an existing text file may be edited; returns the anchors required by readseek_edit.",
27
- readseek_rename: "Preferred tool for renaming code symbols safely across their resolved bindings.",
28
30
  readseek_write: "Preferred tool for creating or replacing a complete text file.",
31
+ readseek_rename: "Preferred tool for renaming code symbols safely across their resolved bindings.",
32
+ readseek_grep: "Preferred text/regex search; returns edit-ready LINE:HASH anchors.",
33
+ readseek_search: "Preferred syntax-aware code search for AST shapes and call sites.",
34
+ readseek_map: "Preferred structural outline of symbols in a source file.",
35
+ readseek_def: "Preferred symbol definition lookup.",
36
+ readseek_refs: "Preferred identifier usage finder before rename or delete.",
37
+ readseek_hover: "Preferred cursor token and enclosing-symbol inspector.",
38
+ readseek_view: "Preferred PDF structure and content viewer.",
39
+ readseek_check: "Preferred quick syntax check after source edits.",
40
+ };
41
+ const FALLBACK_TOOL_DESCRIPTIONS: Record<string, string> = {
42
+ read: "Fallback only. Prefer readseek_read for text files so edits can use LINE:HASH anchors.",
43
+ edit: "Fallback only. Prefer readseek_edit with anchors from readseek_read/readseek_grep/readseek_search.",
44
+ write: "Fallback only. Prefer readseek_write so the result returns LINE:HASH anchors.",
45
+ grep: "Fallback only. Prefer readseek_grep for project text search with edit-ready anchors.",
46
+ apply_patch: "Fallback only. Prefer readseek_edit for existing text files.",
29
47
  };
30
48
  const READSEEK_PLATFORM_PACKAGES: Record<string, string> = {
31
49
  "darwin-arm64": "@jarkkojs/readseek-darwin-arm64",
@@ -1354,11 +1372,16 @@ export const ReadSeekPlugin: Plugin = async (_input, options) => {
1354
1372
  ),
1355
1373
  },
1356
1374
  "experimental.chat.system.transform": async (_input, output) => {
1357
- output.system.push(EDITING_POLICY);
1375
+ output.system.push(TOOL_POLICY);
1358
1376
  },
1359
1377
  "tool.definition": async (input, output) => {
1360
1378
  const preference = PREFERRED_TOOL_DESCRIPTIONS[input.toolID];
1361
- if (preference) output.description = `${preference} ${output.description}`;
1379
+ if (preference) {
1380
+ output.description = `${preference} ${output.description}`;
1381
+ return;
1382
+ }
1383
+ const fallback = FALLBACK_TOOL_DESCRIPTIONS[input.toolID];
1384
+ if (fallback) output.description = `${fallback} ${output.description}`;
1362
1385
  },
1363
1386
  event: async ({ event }) => {
1364
1387
  if (event.type === "file.edited" || event.type === "file.watcher.updated") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-readseek",
3
- "version": "0.8.9",
3
+ "version": "0.8.11",
4
4
  "description": "OpenCode plugin for readseek-backed structural code navigation",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
@@ -31,11 +31,11 @@
31
31
  "node": ">=20.0.0"
32
32
  },
33
33
  "dependencies": {
34
- "@jarkkojs/readseek": "^0.8.9",
34
+ "@jarkkojs/readseek": "^0.8.11",
35
35
  "@opencode-ai/plugin": "^1.17.20"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/bun": "^1.3.14",
39
- "typescript": "^5.9.3"
39
+ "typescript": "^7.0.2"
40
40
  }
41
41
  }