dsh-hashline-edit 0.5.2 → 0.5.4
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 +12 -6
- package/cordis.patch.yml +7 -2
- package/lib/index.js +6662 -6481
- package/lib/types/dsh/index.d.ts +11 -1
- package/lib/types/dsh/rg/tools.d.ts +7 -5
- package/lib/types/dsh/shell-view.d.ts +25 -1
- package/lib/types/dsh/write-hook.d.ts +16 -2
- package/package.json +1 -1
- package/prompts/rg-guidelines.md +1 -1
- package/prompts/write-guidelines.md +1 -0
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ Served anchors are leased per session and per file. A stale, unknown, retired or
|
|
|
92
92
|
|
|
93
93
|
### Live switches and profiles
|
|
94
94
|
|
|
95
|
-
`read`, `applyPatch`, `edit`, `rg`, `codegraph` and `
|
|
95
|
+
`read`, `applyPatch`, `edit`, `rg`, `codegraph`, `diagnostics` and `writeAutoRead` are seven live per-agent switches. The host reloads the bundle row and remounts every live agent, so flipping one takes effect without a rebuild. `read` shadows the built-in read and enables the shell/grep views; `applyPatch` registers the `apply_patch` tool; `edit` registers the anchored range `edit` tool; `rg` registers an `rg` tool that runs the system `rg` and hides the host's built-in `grep` (and its brief) ([rg](#rg)); `codegraph` registers the optional codegraph graph tools ([Codegraph tools](#codegraph-tools)); `diagnostics` registers the anchored `diagnostics` tool ([diagnostics](#diagnostics)); `writeAutoRead` appends the written file's anchored page to the built-in `write` result so the next `edit` needs no `read` — off by default, so a write returns the native one-line success.
|
|
96
96
|
|
|
97
97
|
| Switch | Default | Effect |
|
|
98
98
|
| --- | --- | --- |
|
|
@@ -101,7 +101,8 @@ Served anchors are leased per session and per file. A stale, unknown, retired or
|
|
|
101
101
|
| `edit` | `false` | Register the anchored range `edit` tool. |
|
|
102
102
|
| `codegraph` | `false` (`cordis.patch.yml` ships `true`) | Register the eight `codegraph_*` graph tools and the `tool:codegraph` prompt section. |
|
|
103
103
|
| `diagnostics` | `false` (`cordis.patch.yml` ships `true`) | Register the `diagnostics` tool and the `tool:diagnostics` prompt section. |
|
|
104
|
-
| `rg` | `true` | Register the `rg` tool over the system `rg` and hide the host's built-in `grep` tool and its brief; the read switch's grep view
|
|
104
|
+
| `rg` | `true` | Register the `rg` tool over the system `rg` and hide the host's built-in `grep` tool and its brief; the read switch's grep view serves its matches through the tool's own value — each match gains its `hash` anchor and the rendered page is `HASH│content`, on a direct call and inside `run_code` alike. |
|
|
105
|
+
| `writeAutoRead` | `false` | Append the written file's anchored page to the built-in `write` result. Off: the write returns the native one-line success and injects nothing. The served hash-echo refusal guard runs either way. |
|
|
105
106
|
|
|
106
107
|
The two mutation switches form three supported profiles. With both mutation switches off, neither write tool is registered and the native-hide layer is not installed; the native editors and the host's built-in `write` stay visible. Each snippet below is the `config` block of the `dsh-hashline-edit` row:
|
|
107
108
|
|
|
@@ -226,7 +227,7 @@ rg({ pattern: "run_code", include: "*.ts", ignoreCase: true })
|
|
|
226
227
|
```
|
|
227
228
|
|
|
228
229
|
- **System `rg`, no shell.** One process, a plain argv vector (`rg --json --regexp=… --glob=… -- <path>`), both streams captured, a 30 s budget and an 8 MB capture ceiling. The user's own ripgrep runs, so `RIPGREP_CONFIG_PATH`, the installed version and the ignore rules are the ones they configured; `rgPath` pins an executable outside `PATH`.
|
|
229
|
-
- **Anchored rows through the read switch.** The canonical value
|
|
230
|
+
- **Anchored rows through the read switch.** The canonical value keeps the native grep's `{ matches: [{ path, lineNumber, line }] }` shape, so the unchanged grep view re-reads every matched line from disk, serves it as `HASH│content` and leases it; the served anchors are then written onto that value — each match gains its `hash` — and the tool's renderer turns them into the shared search page. That value channel is also the only one a nested `run_code` caller receives, so the anchors work there too. Over 250 matches or over the inline token budget the view passes the result through and the rendered text reports `Found N of M matches` instead.
|
|
230
231
|
- **Expected failures are text results, not tool errors.** No `rg` on `PATH`, a pattern ripgrep rejects, an unreadable target, the deadline and a capture overflow all return a normal successful result carrying guidance; only an empty `pattern` or a malformed `include` is a hard argument error.
|
|
231
232
|
|
|
232
233
|
### codegraph tools
|
|
@@ -266,7 +267,7 @@ Runs the project's own toolchain and serves what it reports as anchors — one c
|
|
|
266
267
|
- **Expected failures are text results, not tool errors.** A missing toolchain, a missing `tsconfig.json`/`jsconfig.json` for `tsc`, the 120 s budget, a non-zero exit and output that does not parse (the raw tail is shown) all return a normal successful result carrying that guidance. Only a `tool` outside the enum is a hard argument error.
|
|
267
268
|
- **No shell.** `cargo` comes from `PATH`; `tsc` prefers `node_modules/typescript/bin/tsc`, walking up from `cwd`, then a `tsc` on `PATH`. The tool is registered only while `diagnostics: true`, and its brief is `prompts/diagnostics-guidelines.md`.
|
|
268
269
|
|
|
269
|
-
The plugin installs a `tools/post-execute` listener for the host's `pwsh`, `bash` and `grep` tools. When the command is a whitelisted read-only file view, the captured stdout is replaced with the aligned file's `HASH│content` rows, and those rows are served (leased) exactly like a read — a following `apply_patch` or `edit` can use them with no re-read. A `grep
|
|
270
|
+
The plugin installs a `tools/post-execute` listener for the host's `pwsh`, `bash` and `grep` tools. When the command is a whitelisted read-only file view, the captured stdout is replaced with the aligned file's `HASH│content` rows, and those rows are served (leased) exactly like a read — a following `apply_patch` or `edit` can use them with no re-read. A `grep`-shaped result whose matches are proven against disk is served the same way (see the table below). The `rg` tool is the `grep`-shaped result that reaches this listener unless the `grep` switch is off: its value declares the anchor on every match, so the served anchors are projected there rather than onto its content, which is what makes a nested `run_code` call served as well.
|
|
270
271
|
|
|
271
272
|
| Command shape | Served as |
|
|
272
273
|
| --- | --- |
|
|
@@ -274,11 +275,16 @@ The plugin installs a `tools/post-execute` listener for the host's `pwsh`, `bash
|
|
|
274
275
|
| `Get-Content <file> \| Select-Object -First\|-Last\|-Skip <N>` | the bounded slice |
|
|
275
276
|
| `Get-Content <file> \| Select-Object -Skip N -First M` (either order) | disk lines N+1 through N+M |
|
|
276
277
|
| `Select-String <pattern> <file>` | the matched lines, with their line numbers |
|
|
277
|
-
| `rg <pattern> <file>` (explicit single file
|
|
278
|
-
| `
|
|
278
|
+
| `rg <pattern> <file>` (explicit single file; matching-only switches such as `-i`, `-F`, `-w`, `-S`, `-n`) | the matched lines, with their line numbers |
|
|
279
|
+
| `grep -n <pattern> <file>` | the matched lines, with their line numbers |
|
|
280
|
+
| `grep <pattern> <file>` | the matched lines, aligned by content (refused when a duplicate makes the position ambiguous) |
|
|
281
|
+
| `head [-n N|-N] <file>`, `tail [-n N|-N] <file>` | the bounded head or tail slice |
|
|
282
|
+
| `rg` (this plugin's system-`rg` tool) | each match's anchor on the canonical value, rendered as the grouped `HASH│content` page |
|
|
279
283
|
|
|
280
284
|
The grep view applies the host's spill policy: at most 250 matches and at most 12,500 inline tokens (the host estimate `ceil(chars / 4) + 4`). A result over either cap, a failed call, a forged or stale match line, or non-ascending coordinates passes through byte-for-byte with no lease.
|
|
281
285
|
|
|
286
|
+
A nested (`run_code`) dispatch never receives model-facing content, so it is served only through the value — this plugin's `rg`, whose matches carry `hash`. Two host-owned values cannot gain an anchor field (`additionalProperties: false`): the native `grep` tool's matches and the built-in `write` tool's auto-read reach a nested caller unanchored, while both stay anchored on their model-facing result. Inside `run_code`, use `rg` (the default replacement) when anchors are needed, and `read` after a built-in `write`.
|
|
287
|
+
|
|
282
288
|
Alignment is strict: stdout lines are mapped to 1-based disk line numbers with a monotonic, unique match (search output's own line numbers are used as hints). Every served view is prefixed with the shared `[Bash view: <file> (lines a-b of N total)]` page header, so the positions the raw output used to name are not lost. Anything the view cannot prove — an unknown pipeline, a statement separator (`;`), a variable path (`$f`), a wildcard, formatted output, a truncated capture, a failed command — passes through byte-for-byte. The hook never guesses and never serves the wrong occurrence of a duplicated line.
|
|
283
289
|
## Encoding: UTF-8 only
|
|
284
290
|
|
package/cordis.patch.yml
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
# plugin re-mounts every live agent. Defaults: read on, apply_patch on, edit off, rg on.
|
|
11
11
|
# `rg` registers an `rg` tool over the system `rg` and disables the built-in `grep` (and its
|
|
12
12
|
# brief); the tool's matches keep the built-in value shape, so the read switch's grep view still
|
|
13
|
-
# serves them as `HASH│content` rows
|
|
13
|
+
# serves them as `HASH│content` rows — written onto each match's `hash`, so a nested `run_code` call is
|
|
14
|
+
# served too. `rgPath` pins an `rg` executable outside PATH.
|
|
14
15
|
- insert:
|
|
15
16
|
# `codegraph` adds the eight graph tools (explore/node/context/search/callers/callees/
|
|
16
17
|
# impact/implementations); the three source tools serve `HASH│content` rows. It needs the
|
|
@@ -30,6 +31,10 @@
|
|
|
30
31
|
diagnostics: true
|
|
31
32
|
# `rg` replaces the built-in grep with a tool over the system `rg`, exposing ripgrep's
|
|
32
33
|
# matching switches and hiding the built-in grep and its brief; the read switch's grep
|
|
33
|
-
# view
|
|
34
|
+
# view serves its matches as anchors, on each match's `hash` for a nested `run_code` call too.
|
|
34
35
|
rg: true
|
|
35
36
|
rgPath: ""
|
|
37
|
+
# `writeAutoRead` appends the written file's anchored page to the built-in `write` result
|
|
38
|
+
# so the next `edit` needs no `read`; off by default (the write returns the native one-line
|
|
39
|
+
# success) because the whole-file page is context the call did not ask for.
|
|
40
|
+
writeAutoRead: false
|