pi-readseek 0.8.18 → 0.8.19
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 +53 -37
- package/dist/index.ts +37 -37
- package/package.json +3 -3
- package/prompts/check.md +2 -2
- package/prompts/def.md +6 -5
- package/prompts/edit.md +41 -44
- package/prompts/grep.md +17 -14
- package/prompts/hover.md +3 -2
- package/prompts/read.md +42 -37
- package/prompts/refs.md +16 -20
- package/prompts/rename.md +7 -5
- package/prompts/search.md +28 -28
- package/prompts/view.md +9 -9
- package/prompts/write.md +7 -10
package/README.md
CHANGED
|
@@ -1,37 +1,44 @@
|
|
|
1
1
|
# pi-readseek
|
|
2
2
|
|
|
3
|
-
`pi-readseek` adds ReadSeek's anchored file
|
|
4
|
-
navigation to Pi. Built-
|
|
5
|
-
`read`, `edit`, `write`, or `grep` to
|
|
3
|
+
`pi-readseek` adds ReadSeek's anchored file operations, structural search,
|
|
4
|
+
symbol navigation, and PDF tools to Pi. Built-ins remain available unless
|
|
5
|
+
`replacedTools` maps `read`, `edit`, `write`, or `grep` to a ReadSeek-backed
|
|
6
|
+
implementation.
|
|
6
7
|
|
|
7
|
-
##
|
|
8
|
+
## Install
|
|
8
9
|
|
|
9
10
|
```sh
|
|
10
11
|
pi install npm:pi-readseek
|
|
11
12
|
```
|
|
12
13
|
|
|
13
|
-
The
|
|
14
|
+
The package depends on `@jarkkojs/readseek`, which supplies the native binary on
|
|
14
15
|
supported platforms.
|
|
15
16
|
|
|
16
17
|
## Tools
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
| Tool | Purpose |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `readSeek_read` | Read anchored text by range, symbol, or map; read images and PDFs |
|
|
22
|
+
| `readSeek_edit` | Apply hash-verified edits to an existing text file |
|
|
23
|
+
| `readSeek_write` | Create or replace a complete text file and return anchors |
|
|
24
|
+
| `readSeek_grep` | Search text or regex and return edit-ready anchors |
|
|
25
|
+
| `readSeek_search` | Search AST patterns |
|
|
26
|
+
| `readSeek_def` | Find symbol definitions |
|
|
27
|
+
| `readSeek_refs` | Find identifier usages, optionally scoped to a cursor binding |
|
|
28
|
+
| `readSeek_hover` | Identify the token and enclosing symbol at a cursor |
|
|
29
|
+
| `readSeek_rename` | Apply a binding-aware rename; set `apply: false` for a dry run |
|
|
30
|
+
| `readSeek_check` | Report parser errors and missing syntax |
|
|
31
|
+
| `readSeek_view` | View or narrow a structural PDF index |
|
|
32
|
+
|
|
33
|
+
Workspace renames use name matching where binding resolution is unavailable.
|
|
34
|
+
The extension also adds a short editing policy to Pi's system prompt so models
|
|
35
|
+
prefer fresh `LINE:HASH` anchors and run a quick syntax check after source edits.
|
|
30
36
|
|
|
31
37
|
## Settings
|
|
32
38
|
|
|
33
|
-
Add
|
|
34
|
-
`.pi/settings.json` (project). Project settings
|
|
39
|
+
Add a `readseek` object to `~/.pi/agent/settings.json` (global) or
|
|
40
|
+
`.pi/settings.json` (project). Project settings override matching global values.
|
|
41
|
+
Defaults:
|
|
35
42
|
|
|
36
43
|
```json
|
|
37
44
|
{
|
|
@@ -54,24 +61,33 @@ Add an optional `readseek` section to `~/.pi/agent/settings.json` (global) or
|
|
|
54
61
|
}
|
|
55
62
|
```
|
|
56
63
|
|
|
57
|
-
- `replacedTools`:
|
|
58
|
-
|
|
59
|
-
- `
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
- `timeoutMs`:
|
|
69
|
-
- `grep.maxLines` and `grep.maxBytes`: output limits
|
|
70
|
-
|
|
71
|
-
- `display`:
|
|
64
|
+
- `replacedTools`: any of `"read"`, `"edit"`, `"write"`, and `"grep"`.
|
|
65
|
+
- `imageMode`:
|
|
66
|
+
- `"auto"` exposes `none`, `all`, `ocr`, `caption`, and `objects`. If the
|
|
67
|
+
active model accepts images, prepared images go directly to the model.
|
|
68
|
+
- `"on"` always runs the selected local analysis and omits `none`.
|
|
69
|
+
- `"off"` skips standalone and PDF-embedded images; PDF text is still read.
|
|
70
|
+
Omitting `image` skips standalone images and, unless native vision is active
|
|
71
|
+
in `"auto"` mode, embedded PDF images.
|
|
72
|
+
- `syntaxValidation`: `"warn"` (write and warn), `"block"` (abort), or `"off"`.
|
|
73
|
+
Validation triggers only when an edit increases parser error or missing-node
|
|
74
|
+
counts.
|
|
75
|
+
- `timeoutMs`: native command timeout in milliseconds.
|
|
76
|
+
- `grep.maxLines` and `grep.maxBytes`: output limits; larger values are clamped
|
|
77
|
+
to the defaults.
|
|
78
|
+
- `display`: initial `"compact"` or `"expanded"` state for `read`, `grep`,
|
|
79
|
+
`edit`, and `write` results.
|
|
80
|
+
|
|
81
|
+
## Development
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
npm install
|
|
85
|
+
npm test
|
|
86
|
+
npm run typecheck
|
|
87
|
+
```
|
|
72
88
|
|
|
73
|
-
##
|
|
89
|
+
## License
|
|
74
90
|
|
|
75
|
-
`pi-readseek` is
|
|
91
|
+
`pi-readseek` is Apache-2.0; see [LICENSE](LICENSE).
|
|
76
92
|
`@jarkkojs/readseek` is licensed separately under
|
|
77
|
-
|
|
93
|
+
Apache-2.0 AND LGPL-2.1-or-later.
|
package/dist/index.ts
CHANGED
|
@@ -15,7 +15,7 @@ var REPLACEABLE_TOOL_GUIDELINES = {
|
|
|
15
15
|
"read.md": {
|
|
16
16
|
readSeekName: "readSeek_read",
|
|
17
17
|
builtInName: "read",
|
|
18
|
-
benefit: "it
|
|
18
|
+
benefit: "it returns LINE:HASH anchors for safe edits."
|
|
19
19
|
},
|
|
20
20
|
"edit.md": {
|
|
21
21
|
readSeekName: "readSeek_edit",
|
|
@@ -25,7 +25,7 @@ var REPLACEABLE_TOOL_GUIDELINES = {
|
|
|
25
25
|
"grep.md": {
|
|
26
26
|
readSeekName: "readSeek_grep",
|
|
27
27
|
builtInName: "grep",
|
|
28
|
-
benefit: "it returns
|
|
28
|
+
benefit: "it returns LINE:HASH anchors."
|
|
29
29
|
},
|
|
30
30
|
"write.md": {
|
|
31
31
|
readSeekName: "readSeek_write",
|
|
@@ -35,23 +35,23 @@ var REPLACEABLE_TOOL_GUIDELINES = {
|
|
|
35
35
|
};
|
|
36
36
|
var COMPACT_GUIDELINES = {
|
|
37
37
|
"read.md": [
|
|
38
|
-
"Use readSeek_read map or symbol
|
|
38
|
+
"Use readSeek_read with map or symbol to inspect large files without reading them in full."
|
|
39
39
|
],
|
|
40
40
|
"edit.md": [
|
|
41
|
-
"
|
|
41
|
+
"Prefer set_line, replace_lines, and insert_after; use replace only when anchors are impractical."
|
|
42
42
|
],
|
|
43
43
|
"grep.md": [
|
|
44
|
-
"Use readSeek_grep summary
|
|
44
|
+
"Use readSeek_grep with summary first for broad searches, then narrow by path, glob, or pattern."
|
|
45
45
|
],
|
|
46
46
|
"write.md": [
|
|
47
|
-
"Use anchored edits rather than readSeek_write for small changes or appends
|
|
47
|
+
"Use anchored edits rather than readSeek_write for small changes or appends."
|
|
48
48
|
],
|
|
49
49
|
"search.md": [
|
|
50
|
-
"Use readSeek_search for
|
|
50
|
+
"Use readSeek_search for AST patterns; use readSeek_grep for plain text."
|
|
51
51
|
],
|
|
52
52
|
"refs.md": [
|
|
53
|
-
"Use readSeek_refs
|
|
54
|
-
"Use readSeek_refs with scope plus line/column to follow
|
|
53
|
+
"Use readSeek_refs before renaming or deleting an identifier.",
|
|
54
|
+
"Use readSeek_refs with scope plus line/column to follow one binding and exclude same-named bindings."
|
|
55
55
|
]
|
|
56
56
|
};
|
|
57
57
|
function loadPrompt(promptUrl) {
|
|
@@ -3667,15 +3667,15 @@ function registerReadTool(pi, options = {}) {
|
|
|
3667
3667
|
const tool = registerReadSeekTool(pi, {
|
|
3668
3668
|
name,
|
|
3669
3669
|
label: "Read",
|
|
3670
|
-
description: imageMode === "off" ?
|
|
3670
|
+
description: imageMode === "off" ? "Read anchored text by range, map, or symbol. Standalone and PDF-embedded images are skipped; PDFs are read as text." : promptMetadata.description,
|
|
3671
3671
|
promptSnippet: promptMetadata.promptSnippet,
|
|
3672
3672
|
promptGuidelines: [
|
|
3673
3673
|
...promptMetadata.promptGuidelines,
|
|
3674
|
-
imageMode === "off" ? "The image parameter is unavailable; standalone
|
|
3674
|
+
imageMode === "off" ? "The image parameter is unavailable; standalone and PDF-embedded images are skipped, while PDFs are read as text." : `Select image explicitly for standalone images: ${imageModes.join(", ")}. Omitting it skips standalone images. PDF text is always returned; image controls embedded images.${imageMode === "auto" ? " Native image-capable models receive prepared standalone and PDF-embedded images directly instead of using local analysis." : ""}`
|
|
3675
3675
|
],
|
|
3676
3676
|
parameters: Type2.Object({
|
|
3677
3677
|
path: filePathParam(),
|
|
3678
|
-
offset: optionalIntOrString("
|
|
3678
|
+
offset: optionalIntOrString("One-based starting line"),
|
|
3679
3679
|
limit: optionalIntOrString("Maximum lines to return"),
|
|
3680
3680
|
page: optionalIntOrString("One-based PDF page; defaults to 1"),
|
|
3681
3681
|
symbol: Type2.Optional(Type2.String({ description: "Symbol name to read" })),
|
|
@@ -3685,7 +3685,7 @@ function registerReadTool(pi, options = {}) {
|
|
|
3685
3685
|
})),
|
|
3686
3686
|
...imageMode === "off" ? {} : {
|
|
3687
3687
|
image: Type2.Optional(Type2.Union(imageModes.map((mode) => Type2.Literal(mode)), {
|
|
3688
|
-
description: `Standalone
|
|
3688
|
+
description: `Standalone/PDF-embedded image mode: ${imageModes.join(", ")}. Required for standalone images.`
|
|
3689
3689
|
}))
|
|
3690
3690
|
}
|
|
3691
3691
|
}),
|
|
@@ -4803,10 +4803,10 @@ var hashlineEditItemSchema = Type3.Union([
|
|
|
4803
4803
|
var hashlineEditSchema = Type3.Object({
|
|
4804
4804
|
path: filePathParam(),
|
|
4805
4805
|
edits: Type3.Optional(Type3.Array(hashlineEditItemSchema, {
|
|
4806
|
-
description: "
|
|
4806
|
+
description: "Use set_line, replace_lines, insert_after, replace_symbol, or replace"
|
|
4807
4807
|
})),
|
|
4808
4808
|
postEditVerify: Type3.Optional(Type3.Boolean({
|
|
4809
|
-
description: "
|
|
4809
|
+
description: "Read back and verify persisted content"
|
|
4810
4810
|
}))
|
|
4811
4811
|
}, { additionalProperties: true });
|
|
4812
4812
|
function buildEditError(path2, code, message, hint, errorDetails) {
|
|
@@ -5202,7 +5202,7 @@ function registerEditTool(pi, options = {}) {
|
|
|
5202
5202
|
const name = options.name ?? "readSeek_edit";
|
|
5203
5203
|
const promptMetadata = defineToolPromptMetadata({
|
|
5204
5204
|
promptUrl: new URL("../prompts/edit.md", import.meta.url),
|
|
5205
|
-
promptSnippet: "
|
|
5205
|
+
promptSnippet: "Edit existing files with fresh LINE:HASH anchors",
|
|
5206
5206
|
registeredName: name,
|
|
5207
5207
|
toolAliases: options.toolAliases
|
|
5208
5208
|
});
|
|
@@ -5669,7 +5669,7 @@ function validateIgnoredRequiresOthers(tool, params) {
|
|
|
5669
5669
|
|
|
5670
5670
|
// src/grep.ts
|
|
5671
5671
|
var grepSchema = Type5.Object({
|
|
5672
|
-
pattern: Type5.String({ description: "Regex pattern;
|
|
5672
|
+
pattern: Type5.String({ description: "Regex pattern; set literal for exact text" }),
|
|
5673
5673
|
path: searchPathParam(),
|
|
5674
5674
|
glob: Type5.Optional(Type5.String({ description: "File-name glob, such as *.ts" })),
|
|
5675
5675
|
ignoreCase: Type5.Optional(Type5.Boolean({ description: "Ignore case" })),
|
|
@@ -6040,7 +6040,7 @@ function registerGrepTool(pi, options = {}) {
|
|
|
6040
6040
|
const name = options.name ?? "readSeek_grep";
|
|
6041
6041
|
const promptMetadata = defineToolPromptMetadata({
|
|
6042
6042
|
promptUrl: new URL("../prompts/grep.md", import.meta.url),
|
|
6043
|
-
promptSnippet: "Search
|
|
6043
|
+
promptSnippet: "Search text or regex with edit-ready LINE:HASH anchors",
|
|
6044
6044
|
registeredName: name
|
|
6045
6045
|
});
|
|
6046
6046
|
const tool = registerReadSeekTool(pi, {
|
|
@@ -6186,7 +6186,7 @@ function mergeRanges(ranges) {
|
|
|
6186
6186
|
}
|
|
6187
6187
|
var SEARCH_PROMPT_METADATA = defineToolPromptMetadata({
|
|
6188
6188
|
promptUrl: new URL("../prompts/search.md", import.meta.url),
|
|
6189
|
-
promptSnippet: "Search
|
|
6189
|
+
promptSnippet: "Search source code with AST patterns"
|
|
6190
6190
|
});
|
|
6191
6191
|
function linesFromSearchResult(result, ranges) {
|
|
6192
6192
|
const lineMap = new Map;
|
|
@@ -6295,7 +6295,7 @@ function registerSearchTool(pi, options = {}) {
|
|
|
6295
6295
|
promptSnippet: SEARCH_PROMPT_METADATA.promptSnippet,
|
|
6296
6296
|
promptGuidelines: SEARCH_PROMPT_METADATA.promptGuidelines,
|
|
6297
6297
|
parameters: Type6.Object({
|
|
6298
|
-
pattern: Type6.String({ description: "ast-grep
|
|
6298
|
+
pattern: Type6.String({ description: "AST pattern (ast-grep style), such as console.log($$$ARGS)" }),
|
|
6299
6299
|
lang: langParam(),
|
|
6300
6300
|
path: searchPathParam(),
|
|
6301
6301
|
...readSeekGitSearchParams()
|
|
@@ -6349,7 +6349,7 @@ function buildRefsOutput(input) {
|
|
|
6349
6349
|
// src/refs.ts
|
|
6350
6350
|
var REFS_PROMPT_METADATA = defineToolPromptMetadata({
|
|
6351
6351
|
promptUrl: new URL("../prompts/refs.md", import.meta.url),
|
|
6352
|
-
promptSnippet: "Find usages
|
|
6352
|
+
promptSnippet: "Find identifier usages or a cursor binding"
|
|
6353
6353
|
});
|
|
6354
6354
|
function refsLine(reference) {
|
|
6355
6355
|
return {
|
|
@@ -6431,8 +6431,8 @@ function registerRefsTool(pi, options = {}) {
|
|
|
6431
6431
|
path: searchPathParam(),
|
|
6432
6432
|
lang: langParam(),
|
|
6433
6433
|
scope: Type7.Optional(Type7.Boolean({ description: "Restrict results to the binding at the cursor" })),
|
|
6434
|
-
line: Type7.Optional(Type7.Number({ description: "
|
|
6435
|
-
column: Type7.Optional(Type7.Number({ description: "
|
|
6434
|
+
line: Type7.Optional(Type7.Number({ description: "One-based cursor line; required with scope" })),
|
|
6435
|
+
column: Type7.Optional(Type7.Number({ description: "One-based cursor byte column for disambiguation" })),
|
|
6436
6436
|
...readSeekGitSearchParams()
|
|
6437
6437
|
}),
|
|
6438
6438
|
async execute(_toolCallId, params, signal, _onUpdate, ctx) {
|
|
@@ -6463,15 +6463,15 @@ import path5 from "node:path";
|
|
|
6463
6463
|
import { Text as Text6 } from "@earendil-works/pi-tui";
|
|
6464
6464
|
var RENAME_PROMPT_METADATA = defineToolPromptMetadata({
|
|
6465
6465
|
promptUrl: new URL("../prompts/rename.md", import.meta.url),
|
|
6466
|
-
promptSnippet: "Rename the symbol at a cursor
|
|
6466
|
+
promptSnippet: "Rename the symbol at a cursor while preserving same-named bindings"
|
|
6467
6467
|
});
|
|
6468
6468
|
var renameSchema = Type8.Object({
|
|
6469
6469
|
path: filePathParam(),
|
|
6470
|
-
line: Type8.Integer({ minimum: 1, description: "One-based line of the symbol to rename" }),
|
|
6471
|
-
column: Type8.Optional(Type8.Integer({ minimum: 1, description: "One-based byte column for disambiguation" })),
|
|
6470
|
+
line: Type8.Integer({ minimum: 1, description: "One-based cursor line of the symbol to rename" }),
|
|
6471
|
+
column: Type8.Optional(Type8.Integer({ minimum: 1, description: "One-based cursor byte column for disambiguation" })),
|
|
6472
6472
|
to: Type8.String({ description: "New symbol name" }),
|
|
6473
6473
|
workspace: Type8.Optional(Type8.Boolean({ description: "Rename across the project" })),
|
|
6474
|
-
apply: Type8.Optional(Type8.Boolean({ description: "Apply the verified edits;
|
|
6474
|
+
apply: Type8.Optional(Type8.Boolean({ description: "Apply the verified edits; defaults to true" }))
|
|
6475
6475
|
});
|
|
6476
6476
|
async function executeRename(opts) {
|
|
6477
6477
|
const { params, signal, cwd, onFileMutated } = opts;
|
|
@@ -6886,7 +6886,7 @@ function registerWriteTool(pi, options = {}) {
|
|
|
6886
6886
|
const name = options.name ?? "readSeek_write";
|
|
6887
6887
|
const promptMetadata = defineToolPromptMetadata({
|
|
6888
6888
|
promptUrl: new URL("../prompts/write.md", import.meta.url),
|
|
6889
|
-
promptSnippet: "Create or replace a complete file with
|
|
6889
|
+
promptSnippet: "Create or replace a complete file with LINE:HASH anchors",
|
|
6890
6890
|
registeredName: name
|
|
6891
6891
|
});
|
|
6892
6892
|
const tool = registerReadSeekTool(pi, {
|
|
@@ -6897,7 +6897,7 @@ function registerWriteTool(pi, options = {}) {
|
|
|
6897
6897
|
promptGuidelines: promptMetadata.promptGuidelines,
|
|
6898
6898
|
parameters: Type10.Object({
|
|
6899
6899
|
path: filePathParam(),
|
|
6900
|
-
content: Type10.String({ description: "Complete file content" }),
|
|
6900
|
+
content: Type10.String({ description: "Complete text file content" }),
|
|
6901
6901
|
map: mapParam()
|
|
6902
6902
|
}),
|
|
6903
6903
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
@@ -7002,7 +7002,7 @@ import { Type as Type11 } from "@sinclair/typebox";
|
|
|
7002
7002
|
import path6 from "node:path";
|
|
7003
7003
|
var DEF_PROMPT_METADATA = defineToolPromptMetadata({
|
|
7004
7004
|
promptUrl: new URL("../prompts/def.md", import.meta.url),
|
|
7005
|
-
promptSnippet: "Find
|
|
7005
|
+
promptSnippet: "Find symbol declarations by name"
|
|
7006
7006
|
});
|
|
7007
7007
|
async function executeDef(opts) {
|
|
7008
7008
|
const { params, signal, cwd, onFileAnchored } = opts;
|
|
@@ -7107,7 +7107,7 @@ import { Text as Text9 } from "@earendil-works/pi-tui";
|
|
|
7107
7107
|
import { Type as Type12 } from "@sinclair/typebox";
|
|
7108
7108
|
var CHECK_PROMPT_METADATA = defineToolPromptMetadata({
|
|
7109
7109
|
promptUrl: new URL("../prompts/check.md", import.meta.url),
|
|
7110
|
-
promptSnippet: "
|
|
7110
|
+
promptSnippet: "Run a quick syntax check on a source file"
|
|
7111
7111
|
});
|
|
7112
7112
|
async function executeCheck(opts) {
|
|
7113
7113
|
const { params, signal, cwd } = opts;
|
|
@@ -7200,7 +7200,7 @@ var NODE_KINDS = [
|
|
|
7200
7200
|
];
|
|
7201
7201
|
var VIEW_PROMPT_METADATA = defineToolPromptMetadata({
|
|
7202
7202
|
promptUrl: new URL("../prompts/view.md", import.meta.url),
|
|
7203
|
-
promptSnippet: "View
|
|
7203
|
+
promptSnippet: "View PDF structure or selected content"
|
|
7204
7204
|
});
|
|
7205
7205
|
async function executeView(opts) {
|
|
7206
7206
|
const { params, signal, cwd } = opts;
|
|
@@ -7266,7 +7266,7 @@ function registerViewTool(pi) {
|
|
|
7266
7266
|
kind: Type13.Optional(Type13.Union(NODE_KINDS.map((kind) => Type13.Literal(kind)), {
|
|
7267
7267
|
description: "Node kind filter"
|
|
7268
7268
|
})),
|
|
7269
|
-
depth: optionalIntOrString("Maximum depth below
|
|
7269
|
+
depth: optionalIntOrString("Maximum depth below selected roots"),
|
|
7270
7270
|
outline: Type13.Optional(Type13.Boolean({ description: "Return outline nodes only" }))
|
|
7271
7271
|
}),
|
|
7272
7272
|
async execute(_toolCallId, params, signal, _onUpdate, ctx) {
|
|
@@ -7341,10 +7341,10 @@ function formatSettingsWarning(warning) {
|
|
|
7341
7341
|
function editingPolicy(readName, editName, writeName) {
|
|
7342
7342
|
return [
|
|
7343
7343
|
"ReadSeek editing policy:",
|
|
7344
|
-
`-
|
|
7345
|
-
`-
|
|
7346
|
-
"- Do not use Pi's built-in edit or
|
|
7347
|
-
"-
|
|
7344
|
+
`- Read first with ${readName} when preparing to edit; ${editName} needs fresh LINE:HASH anchors.`,
|
|
7345
|
+
`- Use ${editName} for existing files, ${writeName} for whole-file creation or replacement, and readSeek_rename for symbol renames.`,
|
|
7346
|
+
"- Do not use Pi's built-in read, edit, write, or grep when the corresponding ReadSeek tool is available.",
|
|
7347
|
+
"- Run readSeek_check after source edits for a quick syntax check."
|
|
7348
7348
|
].join(`
|
|
7349
7349
|
`);
|
|
7350
7350
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-readseek",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"description": "Pi extension for
|
|
3
|
+
"version": "0.8.19",
|
|
4
|
+
"description": "Pi extension for LINE:HASH-anchored file operations and structural code navigation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dist/index.ts"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"node": ">=20.0.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@jarkkojs/readseek": "^0.8.
|
|
43
|
+
"@jarkkojs/readseek": "^0.8.19",
|
|
44
44
|
"diff": "^9.0.0",
|
|
45
45
|
"xxhash-wasm": "^1.1.0"
|
|
46
46
|
},
|
package/prompts/check.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
Run a quick syntax check on a source file. Use after edits to find parser errors and missing syntax; this is not a compiler or linter.
|
|
2
2
|
|
|
3
3
|
## Parameters
|
|
4
4
|
|
|
5
|
-
- `path` — source file
|
|
5
|
+
- `path` — source file.
|
|
6
6
|
|
|
7
7
|
## Output
|
|
8
8
|
|
package/prompts/def.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
Find symbol declarations by qualified or unqualified name. Use instead of text search when locating
|
|
1
|
+
Find symbol declarations by qualified or unqualified name. Use this instead of text search when locating a function, class, type, or other definition.
|
|
2
2
|
|
|
3
3
|
## Parameters
|
|
4
4
|
|
|
5
|
-
- `path` — file or directory, default `.`.
|
|
6
5
|
- `name` — qualified or unqualified symbol name.
|
|
7
|
-
- `
|
|
8
|
-
- `
|
|
6
|
+
- `path` — file or directory; defaults to the current directory.
|
|
7
|
+
- `lang` — language override when detection is ambiguous.
|
|
8
|
+
- `cached`, `others`, `ignored` — Git file selection; `ignored` requires
|
|
9
|
+
`others`.
|
|
9
10
|
|
|
10
|
-
After `readSeek_hover`,
|
|
11
|
+
After `readSeek_hover`, prefer its qualified symbol name.
|
package/prompts/edit.md
CHANGED
|
@@ -1,71 +1,68 @@
|
|
|
1
|
-
Edit existing text files
|
|
1
|
+
Edit existing text files with fresh `LINE:HASH` anchors. Read or search the file first when no fresh anchors are available.
|
|
2
2
|
|
|
3
|
-
Anchors come from `readSeek_read`, `readSeek_grep`, `readSeek_search`, or
|
|
3
|
+
Anchors come from `readSeek_read`, `readSeek_grep`, `readSeek_search`, or
|
|
4
|
+
`readSeek_write`.
|
|
4
5
|
|
|
5
6
|
## Variants
|
|
6
7
|
|
|
7
|
-
| Variant | Use |
|
|
8
|
-
|
|
9
|
-
| `set_line` | Replace or delete one line |
|
|
10
|
-
| `replace_lines` | Replace or delete one contiguous range |
|
|
11
|
-
| `insert_after` | Insert after
|
|
12
|
-
| `replace_symbol` | Replace one mapped symbol |
|
|
13
|
-
| `replace` |
|
|
8
|
+
| Variant | Use | Required anchor |
|
|
9
|
+
| --- | --- | --- |
|
|
10
|
+
| `set_line` | Replace or delete one line | `anchor` |
|
|
11
|
+
| `replace_lines` | Replace or delete one contiguous range | `start_anchor`, `end_anchor` |
|
|
12
|
+
| `insert_after` | Insert after one line | `anchor` |
|
|
13
|
+
| `replace_symbol` | Replace one mapped symbol | `symbol` instead of an anchor |
|
|
14
|
+
| `replace` | Replace exact text; one match unless `all: true` | None |
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
anchored variants. Use `
|
|
16
|
+
Use `new_text: ""` to delete lines and `new_text: "\n"` for a blank line.
|
|
17
|
+
Prefer anchored variants. Use `replace_symbol` for a whole symbol and `replace`
|
|
18
|
+
only when anchors are impractical.
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
Each `edits[]` item contains exactly one variant. `new_text` and `new_body` are
|
|
21
|
+
plain file content, not a diff or hashline output.
|
|
19
22
|
|
|
20
23
|
```json
|
|
21
24
|
{
|
|
22
25
|
"path": "src/foo.ts",
|
|
23
26
|
"edits": [
|
|
24
27
|
{ "set_line": { "anchor": "42:ab1", "new_text": "const x = 2;" } },
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
{
|
|
29
|
+
"replace_lines": {
|
|
30
|
+
"start_anchor": "50:c3d",
|
|
31
|
+
"end_anchor": "55:e4f",
|
|
32
|
+
"new_text": "const y = 3;\nreturn y;"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{ "insert_after": { "anchor": "60:f5a", "new_text": "// TODO\n" } }
|
|
29
36
|
]
|
|
30
37
|
}
|
|
31
38
|
```
|
|
32
39
|
|
|
33
|
-
|
|
34
|
-
and `new_body` are plain file content, not diffs or hashlines.
|
|
40
|
+
## Exact, fuzzy, and symbol replacement
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
`replace` is exact by default and fails when its text is absent. `fuzzy: true`
|
|
43
|
+
retries only after exact matching fails and normalizes whitespace plus
|
|
44
|
+
confusable Unicode. Verify any warned fuzzy match.
|
|
37
45
|
|
|
38
|
-
`
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
`replace_symbol` accepts `Name`, `Class.method`, or `Name@<line>` in a mappable
|
|
47
|
+
source file. `new_body` must be non-empty and unindented. Do not overlap a
|
|
48
|
+
symbol replacement with anchored edits.
|
|
41
49
|
|
|
42
|
-
##
|
|
50
|
+
## Stale anchors and validation
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
`Name@<line>` in any mappable source file. `new_body` must be non-empty and
|
|
46
|
-
unindented. Confirm fuzzy symbol matches first; do not overlap them with anchored
|
|
47
|
-
edits.
|
|
48
|
-
|
|
49
|
-
## Stale anchors
|
|
50
|
-
|
|
51
|
-
On `hash-mismatch`, nearby lines marked `>>>` include fresh anchors:
|
|
52
|
+
A `hash-mismatch` response marks nearby current lines with `>>>`, for example:
|
|
52
53
|
|
|
53
54
|
```text
|
|
54
55
|
>>> 41:b34| const renamed = 3;
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
Retry with those anchors
|
|
58
|
-
|
|
59
|
-
## Validation and warnings
|
|
60
|
-
|
|
61
|
-
All edits validate before writing; hard failures write nothing. Anchored edits run
|
|
62
|
-
bottom-up. `no-op` means no change. Syntax validation for every language with a
|
|
63
|
-
tree-sitter parser follows `readseek.syntaxValidation`: `warn` (default), `block`,
|
|
64
|
-
or `off`. It triggers when error or missing-node counts increase and reports the
|
|
65
|
-
post-edit diagnostic ranges.
|
|
58
|
+
Retry with those anchors or read/search again. Verify any automatic relocation
|
|
59
|
+
warning.
|
|
66
60
|
|
|
67
|
-
|
|
61
|
+
All edits validate before writing; a hard failure writes nothing. Anchored edits
|
|
62
|
+
run bottom-up. `no-op` means no content changed. For languages with a tree-sitter
|
|
63
|
+
parser, `readseek.syntaxValidation` controls newly introduced parse errors:
|
|
64
|
+
`warn` (default), `block`, or `off`.
|
|
68
65
|
|
|
69
|
-
`postEditVerify: true`
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
Set `postEditVerify: true` to read back the file and compare persisted content,
|
|
67
|
+
including its BOM and line endings. Verification returns a compact anchored
|
|
68
|
+
diff, unified patch, and structured `details.diffData`.
|
package/prompts/grep.md
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
Search
|
|
1
|
+
Search text or regex in files and return edit-ready `LINE:HASH` anchors. Use for identifiers, strings, configuration, errors, comments, and documentation.
|
|
2
2
|
|
|
3
3
|
## Modes
|
|
4
4
|
|
|
5
|
-
- Default: matching lines
|
|
6
|
-
- `context: N`: include N lines
|
|
7
|
-
|
|
8
|
-
- `
|
|
5
|
+
- Default: return matching lines as `path:>>LINE:HASH|content`.
|
|
6
|
+
- `context: N`: include N surrounding lines. Context rows use
|
|
7
|
+
`path: LINE:HASH|content`; overlapping ranges are merged.
|
|
8
|
+
- `summary: true`: return per-file counts only. Use this first for a broad
|
|
9
|
+
search, then narrow by `path`, `glob`, or pattern.
|
|
10
|
+
- `scope: "symbol"`: group matches by their enclosing symbol. By default the
|
|
11
|
+
full symbol is returned; `scopeContext: N` clips each match to ±N lines inside
|
|
12
|
+
it, and `0` returns only matching lines. `summary` ignores symbol scope.
|
|
9
13
|
|
|
10
14
|
## Parameters
|
|
11
15
|
|
|
12
|
-
- `pattern` — regular expression by default; set `literal: true` for exact text
|
|
13
|
-
- `path` — file or directory
|
|
16
|
+
- `pattern` — regular expression by default; set `literal: true` for exact text.
|
|
17
|
+
- `path` — file or directory; defaults to the current directory.
|
|
14
18
|
- `glob` — file-name filter such as `*.ts` or `**/*.test.ts`.
|
|
15
19
|
- `ignoreCase` — case-insensitive search.
|
|
16
|
-
- `context` — surrounding lines
|
|
17
|
-
- `limit` — maximum matches
|
|
18
|
-
- `summary` — counts
|
|
20
|
+
- `context` — surrounding lines in normal mode.
|
|
21
|
+
- `limit` — maximum matches; defaults to 100.
|
|
22
|
+
- `summary` — return counts without anchors.
|
|
19
23
|
- `scope` — only `"symbol"` is supported.
|
|
20
|
-
- `scopeContext` — non-negative context
|
|
24
|
+
- `scopeContext` — non-negative context inside symbol scope.
|
|
21
25
|
|
|
22
|
-
If
|
|
23
|
-
|
|
24
|
-
after narrowing.
|
|
26
|
+
If `limit` or the display budget truncates output, start with `summary`, narrow
|
|
27
|
+
the file set and pattern, then request context or symbol blocks.
|
package/prompts/hover.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
Identify the token and enclosing symbol at a cursor. Use before
|
|
1
|
+
Identify the token and enclosing symbol at a cursor. Use before definition lookup or rename, or to identify a line's enclosing symbol.
|
|
2
2
|
|
|
3
3
|
## Parameters
|
|
4
4
|
|
|
5
|
-
- `path
|
|
5
|
+
- `path` — source file.
|
|
6
|
+
- `line` — one-based cursor line.
|
|
6
7
|
- `column` — optional one-based cursor byte column.
|
package/prompts/read.md
CHANGED
|
@@ -1,45 +1,50 @@
|
|
|
1
|
-
Read anchored text by range, map, or symbol
|
|
1
|
+
Read anchored text by range, map, or symbol; process images only with an explicit mode. PDF text is always returned.
|
|
2
2
|
|
|
3
|
-
## Choose
|
|
3
|
+
## Choose a read
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
- `map: true`: append
|
|
5
|
+
- Default: read a small file or an `offset` / `limit` range.
|
|
6
|
+
- `map: true`: append the file's structural map.
|
|
7
7
|
- `symbol: "Name"`: read one mapped symbol.
|
|
8
|
-
- `bundle: "local"`: include
|
|
8
|
+
- `bundle: "local"`: include directly related symbols from the same file.
|
|
9
9
|
|
|
10
10
|
## Parameters
|
|
11
11
|
|
|
12
12
|
- `path` — file path.
|
|
13
|
-
- `offset` / `limit` — positive
|
|
14
|
-
- `map` — full-file map; incompatible with `symbol`
|
|
15
|
-
- `symbol` — `Name`, `Class.method`, or `Name@<line>`; incompatible with
|
|
13
|
+
- `offset` / `limit` — positive line numbers; `offset` is one-based.
|
|
14
|
+
- `map` — append a full-file map; incompatible with `symbol` and `bundle`.
|
|
15
|
+
- `symbol` — `Name`, `Class.method`, or `Name@<line>`; incompatible with
|
|
16
|
+
`offset` and `limit`.
|
|
16
17
|
- `bundle` — only `"local"`; requires `symbol` and excludes `map`.
|
|
17
|
-
- `image` —
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
18
|
+
- `image` — standalone-image/PDF embedded-image mode; unavailable when
|
|
19
|
+
`imageMode` is `"off"`.
|
|
20
|
+
- `page` — one-based PDF page; defaults to 1 and excludes `offset` / `limit`.
|
|
21
|
+
|
|
22
|
+
Text output is capped at {{DEFAULT_MAX_LINES}} lines or {{DEFAULT_MAX_BYTES}}.
|
|
23
|
+
A truncated full-file read appends a map when available; use its ranges for
|
|
24
|
+
follow-up reads.
|
|
25
|
+
|
|
26
|
+
Standalone images require an explicit `image` mode. PDF text is always read;
|
|
27
|
+
omitting `image` skips embedded images unless native vision is active in
|
|
28
|
+
`"auto"` mode. With native vision, prepared standalone and PDF-embedded images
|
|
29
|
+
go directly to the model instead of local analysis.
|
|
30
|
+
|
|
31
|
+
## Symbol lookup
|
|
32
|
+
|
|
33
|
+
| Query | Result |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| `{"symbol":"processEvent"}` | Function or other unqualified symbol |
|
|
36
|
+
| `{"symbol":"EventEmitter"}` | Class, interface, type, enum, or similar symbol |
|
|
37
|
+
| `{"symbol":"EventEmitter.emit"}` | Qualified child method or member |
|
|
38
|
+
| `{"symbol":"Foo.bar@42"}` | Definition or overload near line 42 |
|
|
39
|
+
| `{"symbol":"handleRequest","bundle":"local"}` | Symbol plus direct same-file support |
|
|
40
|
+
|
|
41
|
+
`@<line>` is a trailing disambiguator; `foo@bar` remains an ordinary name.
|
|
42
|
+
Resolution prefers a containing range, then the nearest symbol at or after the
|
|
43
|
+
line, then one above it.
|
|
44
|
+
|
|
45
|
+
A successful lookup returns the symbol range. Ambiguous results include
|
|
46
|
+
`name@<startLine>` retry hints. Verify fuzzy matches before editing. A missing or
|
|
47
|
+
unmappable symbol falls back to a normal read with a warning.
|
|
48
|
+
|
|
49
|
+
Anchors from text, symbol, and bundled reads remain valid for `readSeek_edit`
|
|
50
|
+
until the file changes.
|
package/prompts/refs.md
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
Find identifier usages with enclosing symbols and edit-ready anchors. Use before renaming, deleting, or changing a symbol; add
|
|
1
|
+
Find identifier usages with enclosing symbols and edit-ready `LINE:HASH` anchors. Use before renaming, deleting, or changing a symbol; add cursor scope to exclude same-named bindings.
|
|
2
2
|
|
|
3
3
|
## Parameters
|
|
4
4
|
|
|
5
|
-
- `name` — identifier to find
|
|
6
|
-
- `path` — file or directory
|
|
7
|
-
- `lang` — language
|
|
8
|
-
- `scope` — restrict results to the binding
|
|
9
|
-
|
|
10
|
-
- `
|
|
11
|
-
- `
|
|
12
|
-
- `
|
|
13
|
-
- `
|
|
5
|
+
- `name` — identifier to find.
|
|
6
|
+
- `path` — file or directory; defaults to the current directory.
|
|
7
|
+
- `lang` — language override for ambiguous, extensionless, or generated source.
|
|
8
|
+
- `scope` — restrict results to the binding at `line` / `column` in one file;
|
|
9
|
+
requires `line`.
|
|
10
|
+
- `line` — one-based cursor line used with `scope`.
|
|
11
|
+
- `column` — optional one-based cursor byte column used with `scope`.
|
|
12
|
+
- `cached` — search tracked/indexed files in a Git repository.
|
|
13
|
+
- `others` — search untracked files in a Git repository.
|
|
14
|
+
- `ignored` — include ignored untracked files; requires `others`.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
Without `scope`, results match by name. With `scope`, results follow the cursor
|
|
17
|
+
binding and exclude shadows.
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## Git selection
|
|
22
|
-
|
|
23
|
-
In Git repositories, directory search includes tracked/indexed and untracked,
|
|
24
|
-
non-ignored files by default. `cached` or `others` restricts the search to that
|
|
25
|
-
group; `ignored` requires `others`.
|
|
19
|
+
In a Git work tree, directory search includes tracked/indexed and untracked
|
|
20
|
+
non-ignored files by default. Setting `cached` or `others` restricts the set;
|
|
21
|
+
`ignored` requires `others`.
|
package/prompts/rename.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
Rename the symbol at a cursor
|
|
1
|
+
Rename the symbol at a cursor while preserving resolvable same-named bindings. Use search and anchored edits for broader refactors.
|
|
2
2
|
|
|
3
3
|
## Parameters
|
|
4
4
|
|
|
5
|
-
- `path
|
|
5
|
+
- `path` — source file containing the cursor.
|
|
6
|
+
- `line` — one-based cursor line.
|
|
6
7
|
- `column` — optional one-based cursor byte column.
|
|
7
|
-
- `
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
- `to` — new plain identifier.
|
|
9
|
+
- `workspace` — expand across the project. The cursor file remains binding-aware;
|
|
10
|
+
other files use name matching where binding resolution is unavailable.
|
|
11
|
+
- `apply` — defaults to `true`; set `false` to return only the verified plan.
|
package/prompts/search.md
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
Search
|
|
1
|
+
Search AST patterns (ast-grep style) and return edit-ready `LINE:HASH` anchors. Use `readSeek_grep` for plain text or regex.
|
|
2
2
|
|
|
3
3
|
## Parameters
|
|
4
4
|
|
|
5
|
-
- `pattern` —
|
|
6
|
-
- `
|
|
7
|
-
- `
|
|
8
|
-
-
|
|
9
|
-
- `
|
|
10
|
-
- `
|
|
5
|
+
- `pattern` — AST pattern to match.
|
|
6
|
+
- `path` — file or directory; defaults to the current directory.
|
|
7
|
+
- `lang` — language override for ambiguous, extensionless, generated, or
|
|
8
|
+
JSX-like source.
|
|
9
|
+
- `cached` — search tracked/indexed files in a Git repository.
|
|
10
|
+
- `others` — search untracked files in a Git repository.
|
|
11
|
+
- `ignored` — include ignored untracked files; requires `others`.
|
|
11
12
|
|
|
12
13
|
## Pattern syntax
|
|
13
14
|
|
|
14
15
|
- `$NAME` matches one AST node.
|
|
15
|
-
- `$_` matches
|
|
16
|
-
- `$$$ARGS` matches zero or more sibling nodes
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
group; `ignored` requires `others`.
|
|
16
|
+
- `$_` matches one node without capturing a reusable value.
|
|
17
|
+
- `$$$ARGS` matches zero or more sibling nodes, such as arguments, statements,
|
|
18
|
+
object fields, or JSX children.
|
|
19
|
+
- Reusing a metavariable requires every occurrence to match the same source text.
|
|
20
|
+
|
|
21
|
+
Patterns are code, not text. Formatting is mostly ignored, but syntax and
|
|
22
|
+
required punctuation must be valid for the selected language.
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
console.log($$$ARGS)
|
|
26
|
+
import $NAME from '$SOURCE'
|
|
27
|
+
export function $NAME($$$PARAMS) { $$$BODY }
|
|
28
|
+
$OBJ.$METHOD($$$ARGS)
|
|
29
|
+
<$TAG $$$ATTRS>$$$CHILDREN</$TAG>
|
|
30
|
+
if ($COND) { $$$BODY }
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
In a Git work tree, directory search includes tracked/indexed and untracked
|
|
34
|
+
non-ignored files by default. Setting `cached` or `others` restricts the set;
|
|
35
|
+
`ignored` requires `others`.
|
package/prompts/view.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
View the structure or selected content of
|
|
1
|
+
View the structure or selected content of a PDF. Start with the overview, then narrow by page or node instead of reading the whole document.
|
|
2
2
|
|
|
3
3
|
## Parameters
|
|
4
4
|
|
|
5
|
-
- `path` — PDF
|
|
6
|
-
- `node` —
|
|
7
|
-
- `page` —
|
|
8
|
-
- `kind` —
|
|
9
|
-
- `depth` —
|
|
5
|
+
- `path` — PDF file.
|
|
6
|
+
- `node` — node ID to use as the view root.
|
|
7
|
+
- `page` — one-based source page.
|
|
8
|
+
- `kind` — node kind filter.
|
|
9
|
+
- `depth` — maximum depth below selected roots.
|
|
10
10
|
- `outline` — return outline nodes only.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
A `.readseek/` directory must already exist; run `readseek init` if needed. The
|
|
13
|
+
first call then creates a reusable structural index. Output is a bounded text
|
|
14
|
+
projection with stable node IDs and source-page references.
|
package/prompts/write.md
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
Create or replace a complete file and return `LINE:HASH` anchors. Use
|
|
1
|
+
Create or replace a complete text file and return `LINE:HASH` anchors. Use anchored edits for small changes to an existing file.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Existing files are overwritten without confirmation. Binary-looking content is
|
|
6
|
-
rejected without writing.
|
|
3
|
+
Existing files are replaced without confirmation. Binary-looking content is
|
|
4
|
+
rejected before writing.
|
|
7
5
|
|
|
8
6
|
## Parameters
|
|
9
7
|
|
|
10
8
|
- `path` — file path.
|
|
11
|
-
- `content` — complete file
|
|
9
|
+
- `content` — complete file content.
|
|
12
10
|
- `map` — append a best-effort structural map.
|
|
13
11
|
|
|
14
12
|
## Output
|
|
15
13
|
|
|
16
|
-
Text
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
diff, unified patch, and structured `details.diffData`.
|
|
14
|
+
Text output uses `LINE:HASH|content` and is capped at {{DEFAULT_MAX_LINES}} lines
|
|
15
|
+
or {{DEFAULT_MAX_BYTES}}. Complete anchors remain in `readSeekValue`. Results
|
|
16
|
+
also include a compact diff, unified patch, and structured `details.diffData`.
|