pi-readseek 0.6.11 → 0.6.13
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 +30 -37
- package/package.json +2 -3
- package/prompts/check.md +1 -1
- package/prompts/edit.md +7 -6
- package/prompts/grep.md +3 -1
- package/prompts/read.md +1 -1
- package/prompts/refs.md +3 -2
- package/prompts/rename.md +3 -2
- package/prompts/search.md +3 -3
- package/prompts/write.md +1 -1
- package/src/readseek-client.ts +29 -3
package/README.md
CHANGED
|
@@ -1,50 +1,43 @@
|
|
|
1
1
|
# pi-readseek
|
|
2
2
|
|
|
3
|
-
`pi-readseek` is a
|
|
4
|
-
editing, anchored grep, structural maps, symbol
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
`pi-readseek` is a Pi extension for ReadSeek-backed file reading, hash-anchored
|
|
4
|
+
editing, anchored grep, structural maps, symbol navigation, and structural search.
|
|
5
|
+
Pi's built-in tools remain unchanged by default. `replacedTools` can register the
|
|
6
|
+
corresponding ReadSeek implementations under built-in names.
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
|
-
```
|
|
10
|
+
```sh
|
|
11
11
|
pi install npm:pi-readseek
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
binary
|
|
16
|
-
install it manually:
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
# Auto-installed by the extension on supported platforms.
|
|
20
|
-
# Manual install (if needed):
|
|
21
|
-
npm install --save-dev @jarkkojs/readseek
|
|
22
|
-
```
|
|
14
|
+
`pi-readseek` depends on `@jarkkojs/readseek`; installation includes the native
|
|
15
|
+
binary automatically on supported platforms.
|
|
23
16
|
|
|
24
17
|
## Tools
|
|
25
18
|
|
|
26
|
-
-
|
|
19
|
+
- `readSeek_read`: reads text with `LINE:HASH` anchors; when image modes are
|
|
27
20
|
enabled, images and PDFs can be returned as base64 or analyzed locally.
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
21
|
+
- `readSeek_edit`: edits existing text files using fresh `LINE:HASH` anchors.
|
|
22
|
+
- `readSeek_grep`: searches text and returns edit-ready anchors.
|
|
23
|
+
- `readSeek_search`: searches code by structural AST pattern.
|
|
24
|
+
- `readSeek_refs`: finds identifier references with enclosing symbols.
|
|
25
|
+
- `readSeek_rename`: plans or applies binding-aware renames; workspace matches are
|
|
26
|
+
name-based where binding support is unavailable.
|
|
27
|
+
- `readSeek_hover`: identifies the cursor token and enclosing symbol.
|
|
28
|
+
- `readSeek_def`: finds structural symbol definitions.
|
|
29
|
+
- `readSeek_check`: checks a source file for parser errors and missing syntax.
|
|
30
|
+
- `readSeek_write`: creates or overwrites whole files and returns anchors.
|
|
37
31
|
|
|
38
32
|
## Settings
|
|
39
33
|
|
|
40
34
|
`pi-readseek` reads optional JSON settings from:
|
|
41
35
|
|
|
42
|
-
- `~/.pi/agent/settings.json` —
|
|
43
|
-
- `.pi/settings.json` —
|
|
36
|
+
- `~/.pi/agent/settings.json` — global settings.
|
|
37
|
+
- `.pi/settings.json` — project settings.
|
|
44
38
|
|
|
45
|
-
Project settings override global settings. The `readseek` section lives
|
|
46
|
-
shared `settings.json
|
|
47
|
-
optional (defaults shown):
|
|
39
|
+
Project settings override global settings. The `readseek` section lives in Pi's
|
|
40
|
+
shared `settings.json`. All settings are optional; defaults are shown below.
|
|
48
41
|
|
|
49
42
|
```json
|
|
50
43
|
{
|
|
@@ -61,18 +54,18 @@ optional (defaults shown):
|
|
|
61
54
|
}
|
|
62
55
|
```
|
|
63
56
|
|
|
64
|
-
-
|
|
57
|
+
- `replacedTools`: built-in tool names to replace with ReadSeek implementations.
|
|
65
58
|
Valid values are `"read"`, `"edit"`, `"write"`, and `"grep"`. For a
|
|
66
|
-
|
|
67
|
-
-
|
|
59
|
+
ReadSeek-only file surface, use `["read", "edit", "write", "grep"]`.
|
|
60
|
+
- `imageMode`: `"auto"` exposes `none`, `all`, `ocr`, `caption`, and `objects`;
|
|
68
61
|
`"on"` omits `none`; `"off"` removes the `image` parameter and always skips
|
|
69
62
|
image/PDF files. Omitting `image` also skips visual files.
|
|
70
|
-
-
|
|
71
|
-
`"warn"` writes with a warning, `"block"` aborts without writing, `"off"`
|
|
63
|
+
- `syntaxValidation`: pre-write syntax-regression check in `readSeek_edit`:
|
|
64
|
+
`"warn"` writes with a warning, `"block"` aborts without writing, and `"off"`
|
|
72
65
|
skips the check.
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
|
|
66
|
+
- `timeoutMs`: ReadSeek invocation timeout in milliseconds.
|
|
67
|
+
- `grep.maxLines` / `grep.maxBytes`: visible `readSeek_grep` output budget; values
|
|
68
|
+
above the defaults are clamped.
|
|
76
69
|
|
|
77
70
|
## Licensing
|
|
78
71
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-readseek",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13",
|
|
4
4
|
"description": "Pi extension for readseek-backed hash-anchored read/edit/grep, structural code maps, structural search, and file exploration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"node": ">=20.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@jarkkojs/readseek": "^0.6.
|
|
42
|
+
"@jarkkojs/readseek": "^0.6.13",
|
|
43
43
|
"diff": "^8.0.3",
|
|
44
44
|
"xxhash-wasm": "^1.1.0"
|
|
45
45
|
},
|
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
"vitest": "^4.1.0"
|
|
60
60
|
},
|
|
61
61
|
"directories": {
|
|
62
|
-
"doc": "docs",
|
|
63
62
|
"test": "tests"
|
|
64
63
|
},
|
|
65
64
|
"bugs": {
|
package/prompts/check.md
CHANGED
package/prompts/edit.md
CHANGED
|
@@ -42,9 +42,9 @@ matches before continuing.
|
|
|
42
42
|
## `replace_symbol`
|
|
43
43
|
|
|
44
44
|
Use `replace_symbol` for one whole mapped `Name`, `Class.method`, or
|
|
45
|
-
`Name@<line>` in
|
|
46
|
-
|
|
47
|
-
|
|
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
48
|
|
|
49
49
|
## Stale anchors
|
|
50
50
|
|
|
@@ -59,9 +59,10 @@ Retry with those anchors, or read/search again. Verify any auto-relocation warni
|
|
|
59
59
|
## Validation and warnings
|
|
60
60
|
|
|
61
61
|
All edits validate before writing; hard failures write nothing. Anchored edits run
|
|
62
|
-
bottom-up. `no-op` means no change. Syntax validation for
|
|
63
|
-
|
|
64
|
-
It
|
|
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.
|
|
65
66
|
|
|
66
67
|
## Optional post-edit verification
|
|
67
68
|
|
package/prompts/grep.md
CHANGED
|
@@ -19,4 +19,6 @@ Search plain text or regex in files and return edit-ready `LINE:HASH` anchors. U
|
|
|
19
19
|
- `scope` — only `"symbol"` is supported.
|
|
20
20
|
- `scopeContext` — non-negative context within symbol scope; requires `scope: "symbol"`.
|
|
21
21
|
|
|
22
|
-
If output
|
|
22
|
+
If output is truncated at `limit` or by the display budget, narrow with `summary`,
|
|
23
|
+
then `path`/`glob`, then a stricter pattern. Request context or symbol blocks only
|
|
24
|
+
after narrowing.
|
package/prompts/read.md
CHANGED
|
@@ -24,7 +24,7 @@ Truncated full-file reads append a map when available. Use its ranges for follow
|
|
|
24
24
|
|
|
25
25
|
| Query | Reads |
|
|
26
26
|
|---|---|
|
|
27
|
-
| `{ "symbol": "processEvent" }` | function or
|
|
27
|
+
| `{ "symbol": "processEvent" }` | function or unqualified symbol |
|
|
28
28
|
| `{ "symbol": "EventEmitter" }` | class/interface/type/enum/etc. |
|
|
29
29
|
| `{ "symbol": "EventEmitter.emit" }` | child method/member |
|
|
30
30
|
| `{ "symbol": "Foo.bar@42" }` | overload/definition near line 42 |
|
package/prompts/refs.md
CHANGED
|
@@ -20,5 +20,6 @@ shadows.
|
|
|
20
20
|
|
|
21
21
|
## Git selection
|
|
22
22
|
|
|
23
|
-
In Git repositories, directory search includes tracked/indexed and untracked
|
|
24
|
-
non-ignored files. `
|
|
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`.
|
package/prompts/rename.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
Rename the symbol at a cursor without changing same-named bindings. Use for symbol renames; use search and edit for broader refactors.
|
|
1
|
+
Rename the symbol at a cursor without changing resolvable same-named bindings. Use for symbol renames; use search and edit for broader refactors.
|
|
2
2
|
|
|
3
3
|
## Parameters
|
|
4
4
|
|
|
5
5
|
- `path`, `line`, `to` — required file, one-based cursor line, and plain new name.
|
|
6
6
|
- `column` — optional one-based cursor byte column.
|
|
7
|
-
- `workspace` — expand across the project; local shadows
|
|
7
|
+
- `workspace` — expand across the project; local shadows are excluded where binding
|
|
8
|
+
support is available, and other files are otherwise matched by name.
|
|
8
9
|
- `apply` — default `true`; set `false` to return only the verified plan.
|
package/prompts/search.md
CHANGED
|
@@ -30,6 +30,6 @@ punctuation must be valid for the selected language.
|
|
|
30
30
|
|
|
31
31
|
## Git selection
|
|
32
32
|
|
|
33
|
-
In Git repositories, directory search includes tracked/indexed and untracked
|
|
34
|
-
non-ignored files.
|
|
35
|
-
requires `others`.
|
|
33
|
+
In Git repositories, directory search includes tracked/indexed and untracked,
|
|
34
|
+
non-ignored files by default. `cached` or `others` restricts the search to that
|
|
35
|
+
group; `ignored` requires `others`.
|
package/prompts/write.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Create or replace a complete file and return `LINE:HASH` anchors. Use for new or fully generated files; use anchored edits for small changes.
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Usage
|
|
4
4
|
|
|
5
5
|
Existing files are overwritten without confirmation. Binary-looking content is
|
|
6
6
|
rejected without writing.
|
package/src/readseek-client.ts
CHANGED
|
@@ -358,6 +358,7 @@ function defaultReadSeekDir(): string | null {
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
const DEFAULT_READSEEK_TIMEOUT_MS = 120_000;
|
|
361
|
+
const DEFAULT_READSEEK_VISION_TIMEOUT_MS = 30 * 60_000;
|
|
361
362
|
|
|
362
363
|
function readSeekTimeoutMs(): number {
|
|
363
364
|
return resolveReadSeekTimeoutMs() ?? DEFAULT_READSEEK_TIMEOUT_MS;
|
|
@@ -493,11 +494,36 @@ async function runReadSeekVision(args: string[], options: RunReadSeekOptions = {
|
|
|
493
494
|
});
|
|
494
495
|
const predecessor = visionInvocationTail;
|
|
495
496
|
visionInvocationTail = predecessor.then(() => gate);
|
|
497
|
+
const signal = options.signal;
|
|
496
498
|
|
|
497
|
-
await predecessor;
|
|
498
499
|
try {
|
|
499
|
-
|
|
500
|
-
|
|
500
|
+
if (signal) {
|
|
501
|
+
signal.throwIfAborted();
|
|
502
|
+
await new Promise<void>((resolve, reject) => {
|
|
503
|
+
const onAbort = (): void => {
|
|
504
|
+
signal.removeEventListener("abort", onAbort);
|
|
505
|
+
reject(signal.reason);
|
|
506
|
+
};
|
|
507
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
508
|
+
predecessor.then(
|
|
509
|
+
() => {
|
|
510
|
+
signal.removeEventListener("abort", onAbort);
|
|
511
|
+
resolve();
|
|
512
|
+
},
|
|
513
|
+
(error) => {
|
|
514
|
+
signal.removeEventListener("abort", onAbort);
|
|
515
|
+
reject(error);
|
|
516
|
+
},
|
|
517
|
+
);
|
|
518
|
+
});
|
|
519
|
+
} else {
|
|
520
|
+
await predecessor;
|
|
521
|
+
}
|
|
522
|
+
signal?.throwIfAborted();
|
|
523
|
+
return await runReadSeek(args, {
|
|
524
|
+
...options,
|
|
525
|
+
timeoutMs: options.timeoutMs ?? resolveReadSeekTimeoutMs() ?? DEFAULT_READSEEK_VISION_TIMEOUT_MS,
|
|
526
|
+
});
|
|
501
527
|
} finally {
|
|
502
528
|
release();
|
|
503
529
|
}
|