opencode-readseek 0.7.0 → 0.7.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/README.md +17 -3
- package/index.ts +20 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Add the plugin to `opencode.json`:
|
|
|
9
9
|
|
|
10
10
|
```json
|
|
11
11
|
{
|
|
12
|
-
"plugin": [
|
|
12
|
+
"plugin": ["opencode-readseek"]
|
|
13
13
|
}
|
|
14
14
|
```
|
|
15
15
|
|
|
@@ -18,7 +18,8 @@ binary dependency with Bun at startup.
|
|
|
18
18
|
|
|
19
19
|
## Tools
|
|
20
20
|
|
|
21
|
-
- `readseek_read`: read text with `LINE:HASH` anchors;
|
|
21
|
+
- `readseek_read`: read text with `LINE:HASH` anchors; PDFs select one page by
|
|
22
|
+
default and accept an explicit page.
|
|
22
23
|
- `readseek_edit`: apply line, range, and insertion edits with fresh `LINE:HASH` anchors.
|
|
23
24
|
- `readseek_write`: create or replace a complete text file.
|
|
24
25
|
- `readseek_grep`: plain-text or regular-expression search with anchored results.
|
|
@@ -27,15 +28,28 @@ binary dependency with Bun at startup.
|
|
|
27
28
|
- `readseek_def`, `readseek_refs`, `readseek_hover`: symbol navigation.
|
|
28
29
|
- `readseek_rename`: apply a verified rename by default; `apply: false` returns a dry-run plan.
|
|
29
30
|
- `readseek_check`: parse diagnostics.
|
|
30
|
-
- `readseek_view`:
|
|
31
|
+
- `readseek_view`: create or reuse a PDF index, return its overview, or narrow
|
|
32
|
+
it by page, node, kind, or depth.
|
|
31
33
|
|
|
32
34
|
The plugin requests OpenCode read, grep, external-directory, and edit permissions
|
|
33
35
|
as needed. File changes invalidate remembered anchors. Compaction context records
|
|
34
36
|
paths with fresh anchors and summaries of pending dry-run rename plans. Text reads
|
|
35
37
|
return at most 2,000 lines by default.
|
|
36
38
|
|
|
39
|
+
The plugin also instructs OpenCode to prefer ReadSeek's anchored read, edit,
|
|
40
|
+
write, and rename tools over built-in file mutation tools while leaving the
|
|
41
|
+
built-ins available as fallbacks.
|
|
42
|
+
|
|
37
43
|
## Configuration
|
|
38
44
|
|
|
45
|
+
Pass options with OpenCode's plugin tuple form:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"plugin": [["opencode-readseek", { "imageMode": "auto" }]]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
39
53
|
`imageMode` defaults to `"auto"`: it exposes `none`, `all`, `ocr`, `caption`, and
|
|
40
54
|
`objects`. `"on"` omits `none`; `"off"` skips image/PDF files. Omitting
|
|
41
55
|
`image` also skips visual files.
|
package/index.ts
CHANGED
|
@@ -13,6 +13,19 @@ const MAX_OUTPUT_BYTES = 32 * 1024 * 1024;
|
|
|
13
13
|
const DEFAULT_READ_LIMIT = 2000;
|
|
14
14
|
const MAX_DOCUMENT_OUTPUT_BYTES = 256 * 1024;
|
|
15
15
|
const MAX_DOCUMENT_OUTPUT_LINES = 2000;
|
|
16
|
+
const EDITING_POLICY = [
|
|
17
|
+
"ReadSeek editing policy:",
|
|
18
|
+
"- Prefer readseek_read over built-in file reads when preparing to edit existing text; its LINE:HASH anchors are required by readseek_edit.",
|
|
19
|
+
"- Prefer readseek_edit for existing text files, readseek_write for whole-file creation or replacement, and readseek_rename for symbol renames.",
|
|
20
|
+
"- Do not use built-in edit, write, or apply_patch when the corresponding ReadSeek tool can perform the change.",
|
|
21
|
+
"- Use readseek_check after source edits for a quick syntax check.",
|
|
22
|
+
].join("\n");
|
|
23
|
+
const PREFERRED_TOOL_DESCRIPTIONS: Record<string, string> = {
|
|
24
|
+
readseek_edit: "Preferred tool for editing existing text files with verified LINE:HASH anchors.",
|
|
25
|
+
readseek_read: "Preferred file reader when an existing text file may be edited; returns the anchors required by readseek_edit.",
|
|
26
|
+
readseek_rename: "Preferred tool for renaming code symbols safely across their resolved bindings.",
|
|
27
|
+
readseek_write: "Preferred tool for creating or replacing a complete text file.",
|
|
28
|
+
};
|
|
16
29
|
const READSEEK_PLATFORM_PACKAGES: Record<string, string> = {
|
|
17
30
|
"darwin-arm64": "@jarkkojs/readseek-darwin-arm64",
|
|
18
31
|
"linux-arm64": "@jarkkojs/readseek-linux-arm64",
|
|
@@ -1333,6 +1346,13 @@ export const ReadSeekPlugin: Plugin = async (_input, options) => {
|
|
|
1333
1346
|
},
|
|
1334
1347
|
),
|
|
1335
1348
|
},
|
|
1349
|
+
"experimental.chat.system.transform": async (_input, output) => {
|
|
1350
|
+
output.system.push(EDITING_POLICY);
|
|
1351
|
+
},
|
|
1352
|
+
"tool.definition": async (input, output) => {
|
|
1353
|
+
const preference = PREFERRED_TOOL_DESCRIPTIONS[input.toolID];
|
|
1354
|
+
if (preference) output.description = `${preference} ${output.description}`;
|
|
1355
|
+
},
|
|
1336
1356
|
event: async ({ event }) => {
|
|
1337
1357
|
if (event.type === "file.edited" || event.type === "file.watcher.updated") {
|
|
1338
1358
|
anchors.forget(event.properties.file);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-readseek",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
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.7.
|
|
33
|
+
"@jarkkojs/readseek": "^0.7.1",
|
|
34
34
|
"@opencode-ai/plugin": "^1.17.20"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|