opencode-readseek 0.9.9 → 0.9.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.
- package/README.md +2 -3
- package/dist/index.js +18 -28
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -22,7 +22,6 @@ OpenCode installs the package and its platform-specific
|
|
|
22
22
|
|
|
23
23
|
| Tool | Purpose |
|
|
24
24
|
| ------------------ | ----------------------------------------------------------------------- |
|
|
25
|
-
| `readseek_read` | Read text with `LINE:HASH` anchors; read standalone images |
|
|
26
25
|
| `readseek_edit` | Apply hash-verified edits to an existing text file |
|
|
27
26
|
| `readseek_write` | Create or replace a complete text file |
|
|
28
27
|
| `readseek_grep` | Search text or regex and return anchors |
|
|
@@ -42,8 +41,8 @@ OpenCode is instructed to prefer ReadSeek over the built-in `read`, `edit`,
|
|
|
42
41
|
`write`, `grep`, and `apply_patch` tools when ReadSeek can do the job. Built-ins
|
|
43
42
|
remain available as fallbacks.
|
|
44
43
|
|
|
45
|
-
Documents such as PDFs are owned by `readseek_view`. Calling `
|
|
46
|
-
a document returns a cache receipt and directs the caller to `readseek_view`.
|
|
44
|
+
Documents such as PDFs are owned by `readseek_view`. Calling `readseek_digest`
|
|
45
|
+
on a document returns a cache receipt and directs the caller to `readseek_view`.
|
|
47
46
|
|
|
48
47
|
## Configuration
|
|
49
48
|
|
package/dist/index.js
CHANGED
|
@@ -416,11 +416,11 @@ var PREFERENCE_LEADS = {
|
|
|
416
416
|
view: "Preferred for digesting document structure or selected content."
|
|
417
417
|
};
|
|
418
418
|
var FALLBACK_TEMPLATES = {
|
|
419
|
-
read: "
|
|
420
|
-
edit: "
|
|
421
|
-
write: "
|
|
422
|
-
grep: "
|
|
423
|
-
apply_patch: "
|
|
419
|
+
read: "Prefer `digest` with fresh LINE:HASH anchors.",
|
|
420
|
+
edit: "Prefer `edit` with fresh LINE:HASH anchors.",
|
|
421
|
+
write: "Prefer `write` so the result returns LINE:HASH anchors.",
|
|
422
|
+
grep: "Prefer `grep` for text/regex search with edit-ready anchors.",
|
|
423
|
+
apply_patch: "Prefer `edit` for existing text files."
|
|
424
424
|
};
|
|
425
425
|
function resolveToolName(name, aliases = {}) {
|
|
426
426
|
return aliases[name] ?? name;
|
|
@@ -654,6 +654,7 @@ function buildRenameArgs(input) {
|
|
|
654
654
|
return appendGitSelectionArgs(args, input);
|
|
655
655
|
}
|
|
656
656
|
// ../readseek-api/src/platform.ts
|
|
657
|
+
import { accessSync, constants as fsConstants } from "node:fs";
|
|
657
658
|
import { createRequire } from "node:module";
|
|
658
659
|
import path from "node:path";
|
|
659
660
|
var READSEEK_PLATFORM_PACKAGES = {
|
|
@@ -682,10 +683,17 @@ function resolveReadSeekBinaryFromPackages(resolver = resolveFromPackage, option
|
|
|
682
683
|
const metaPackage = options.metaPackage ?? "@jarkkojs/readseek";
|
|
683
684
|
const metaPackageJson = resolve(`${metaPackage}/package.json`);
|
|
684
685
|
const metaPackageDir = path.dirname(metaPackageJson);
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
686
|
+
let packageJsonPath;
|
|
687
|
+
try {
|
|
688
|
+
packageJsonPath = resolve(`${platformPackage}/package.json`);
|
|
689
|
+
} catch {
|
|
690
|
+
packageJsonPath = resolve(`${platformPackage}/package.json`, {
|
|
691
|
+
paths: [metaPackageDir]
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
const binaryPath = path.join(path.dirname(packageJsonPath), "bin", readSeekBinaryName(platform));
|
|
695
|
+
accessSync(binaryPath, fsConstants.X_OK);
|
|
696
|
+
return binaryPath;
|
|
689
697
|
}
|
|
690
698
|
// ../readseek-api/src/json.ts
|
|
691
699
|
var READSEEK_USAGE_HINT = /\n\s*Run readseek(?: [\w-]+)* --help for more information\.?\s*$/;
|
|
@@ -1046,7 +1054,7 @@ var TOOL_POLICY = renderToolRoutingPolicy({
|
|
|
1046
1054
|
demoteBuiltIns: ["read", "edit", "write", "grep", "apply_patch"]
|
|
1047
1055
|
});
|
|
1048
1056
|
var PREFERRED_TOOL_DESCRIPTIONS = preferredToolDescriptionMap(OPENCODE_TOOL_ALIASES);
|
|
1049
|
-
var FALLBACK_TOOL_DESCRIPTIONS = fallbackToolDescriptionMap(["edit", "write", "grep", "apply_patch"], OPENCODE_TOOL_ALIASES);
|
|
1057
|
+
var FALLBACK_TOOL_DESCRIPTIONS = fallbackToolDescriptionMap(["read", "edit", "write", "grep", "apply_patch"], OPENCODE_TOOL_ALIASES);
|
|
1050
1058
|
function openCodeToolDescription(name) {
|
|
1051
1059
|
return renderToolDescription(name, OPENCODE_TOOL_ALIASES);
|
|
1052
1060
|
}
|
|
@@ -1491,8 +1499,6 @@ async function authorizeEdit(context, filePaths, diff = "", authorizeExternalPat
|
|
|
1491
1499
|
import { tool } from "@opencode-ai/plugin";
|
|
1492
1500
|
function initialTitle(kind, args) {
|
|
1493
1501
|
switch (kind) {
|
|
1494
|
-
case "read":
|
|
1495
|
-
return `Read ${args.path}`;
|
|
1496
1502
|
case "view":
|
|
1497
1503
|
return `View ${args.path}`;
|
|
1498
1504
|
case "digest":
|
|
@@ -1516,22 +1522,6 @@ function initialTitle(kind, args) {
|
|
|
1516
1522
|
function resultPresentation(kind, args, value) {
|
|
1517
1523
|
const output = record(value);
|
|
1518
1524
|
switch (kind) {
|
|
1519
|
-
case "read": {
|
|
1520
|
-
const startLine = output.start_line;
|
|
1521
|
-
const endLine = output.end_line;
|
|
1522
|
-
if (typeof startLine === "number" && typeof endLine === "number") {
|
|
1523
|
-
return {
|
|
1524
|
-
title: `Read ${args.path}:${startLine}-${endLine}`,
|
|
1525
|
-
metadata: { start_line: startLine, end_line: endLine, line_count: endLine - startLine + 1 }
|
|
1526
|
-
};
|
|
1527
|
-
}
|
|
1528
|
-
const width = output.width;
|
|
1529
|
-
const height = output.height;
|
|
1530
|
-
if (typeof width === "number" && typeof height === "number") {
|
|
1531
|
-
return { title: `Read ${args.path} (${width}x${height})`, metadata: { width, height } };
|
|
1532
|
-
}
|
|
1533
|
-
break;
|
|
1534
|
-
}
|
|
1535
1525
|
case "view":
|
|
1536
1526
|
return { title: `Viewed ${args.path}`, metadata: {} };
|
|
1537
1527
|
case "digest": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-readseek",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.11",
|
|
4
4
|
"description": "OpenCode plugin for anchored file operations and structural code navigation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "git+https://
|
|
19
|
+
"url": "git+https://gitlab.com/jarkkojs/readseek.git"
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"files": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"node": ">=20.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@jarkkojs/readseek": "^0.9.
|
|
36
|
+
"@jarkkojs/readseek": "^0.9.11",
|
|
37
37
|
"@opencode-ai/plugin": "^1.17.20"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|