opencode-readseek 0.7.1 → 0.7.2
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 +9 -2
- package/package.json +2 -2
package/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { tool, type Plugin, type PluginOptions, type ToolAttachment, type ToolCo
|
|
|
11
11
|
const require = createRequire(import.meta.url);
|
|
12
12
|
const MAX_OUTPUT_BYTES = 32 * 1024 * 1024;
|
|
13
13
|
const DEFAULT_READ_LIMIT = 2000;
|
|
14
|
+
const EDIT_RESULT_READ_LIMIT = 40;
|
|
14
15
|
const MAX_DOCUMENT_OUTPUT_BYTES = 256 * 1024;
|
|
15
16
|
const MAX_DOCUMENT_OUTPUT_LINES = 2000;
|
|
16
17
|
const EDITING_POLICY = [
|
|
@@ -1296,14 +1297,20 @@ export const ReadSeekPlugin: Plugin = async (_input, options) => {
|
|
|
1296
1297
|
context.abort.throwIfAborted();
|
|
1297
1298
|
await authorizeRead(context, filePath);
|
|
1298
1299
|
await rejectSymlinkMutation(filePath);
|
|
1299
|
-
const edits = input.edits;
|
|
1300
|
+
const edits = input.edits as AnchorEdit[];
|
|
1300
1301
|
const before = await readFile(filePath, "utf8");
|
|
1301
1302
|
await verifyAnchors(context, filePath, edits);
|
|
1302
1303
|
const after = applyAnchorEdits(before, edits);
|
|
1303
1304
|
await authorizeEdit(context, [filePath], simpleDiff(filePath, before, after), false);
|
|
1304
1305
|
context.abort.throwIfAborted();
|
|
1305
1306
|
if (before !== after) await writeText(filePath, { exists: true, content: before }, after);
|
|
1306
|
-
|
|
1307
|
+
const firstEditedLine = Math.min(...edits.flatMap((edit) => anchorRefs(edit).map((ref) => ref.line)));
|
|
1308
|
+
const previewStart = Math.max(1, firstEditedLine - 3);
|
|
1309
|
+
return runReadSeek(
|
|
1310
|
+
context,
|
|
1311
|
+
["read", `${filePath}:${previewStart}`, "--end", String(previewStart + EDIT_RESULT_READ_LIMIT - 1)],
|
|
1312
|
+
{ cancelable: false },
|
|
1313
|
+
);
|
|
1307
1314
|
});
|
|
1308
1315
|
},
|
|
1309
1316
|
),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-readseek",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
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.2",
|
|
34
34
|
"@opencode-ai/plugin": "^1.17.20"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|