dsh-hashline-edit 0.5.1 → 0.5.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/README.md CHANGED
@@ -16,6 +16,7 @@ The semantic core is the [pi-better-edit](https://github.com/Rianico/pi-better-e
16
16
  | DeepSeek Harness | plugin-capable build; developed and tested against **DSH 0.2.2-rc.3**; host packages are declared as peer dependencies with range `>=0.2.2-rc.1 <0.2.3-0` |
17
17
  | codegraph CLI | ≥ 1.6.4 — optional; needed only for the eight `codegraph_*` graph tools ([Codegraph tools](#codegraph-tools)) |
18
18
  | Rust / TypeScript toolchain | optional; needed only for the `diagnostics` tool — `cargo` on `PATH`, and TypeScript from the project's `node_modules/typescript` or a `tsc` on `PATH` |
19
+ | ripgrep (`rg`) | optional; needed only for the `rg` tool — the first `rg` on `PATH`, or pin one with `rgPath` ([rg](#rg)); without it the call returns install guidance instead of searching |
19
20
 
20
21
  ### Anchor width (3 or 4)
21
22
 
@@ -91,7 +92,7 @@ Served anchors are leased per session and per file. A stale, unknown, retired or
91
92
 
92
93
  ### Live switches and profiles
93
94
 
94
- `read`, `applyPatch`, `edit`, `codegraph` and `diagnostics` are five 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; `codegraph` registers the optional codegraph graph tools ([Codegraph tools](#codegraph-tools)); `diagnostics` registers the anchored `diagnostics` tool ([diagnostics](#diagnostics)).
95
+ `read`, `applyPatch`, `edit`, `rg`, `codegraph` and `diagnostics` are six 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)).
95
96
 
96
97
  | Switch | Default | Effect |
97
98
  | --- | --- | --- |
@@ -100,6 +101,7 @@ Served anchors are leased per session and per file. A stale, unknown, retired or
100
101
  | `edit` | `false` | Register the anchored range `edit` tool. |
101
102
  | `codegraph` | `false` (`cordis.patch.yml` ships `true`) | Register the eight `codegraph_*` graph tools and the `tool:codegraph` prompt section. |
102
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 still serves its matches as `HASH│content` rows. |
103
105
 
104
106
  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:
105
107
 
@@ -114,11 +116,12 @@ config: { read: true, applyPatch: true, edit: true }
114
116
  config: { read: true, applyPatch: false, edit: true }
115
117
  ```
116
118
 
117
- `codegraph` and `diagnostics` are the two optional surfaces: neither changes which write tools register, both default to `false` in the schema while `cordis.patch.yml` ships them `true`, and both need something outside the package — an index for `codegraph` ([Codegraph tools](#codegraph-tools)), a project toolchain for `diagnostics` ([diagnostics](#diagnostics)). `codegraphPath` is a config key, not a switch: `""` (the default) uses the first runnable `codegraph` on `PATH`, and any other value pins an executable outside `PATH`.
119
+ `codegraph` and `diagnostics` are the two optional surfaces: neither changes which write tools register, both default to `false` in the schema while `cordis.patch.yml` ships them `true`, and both need something outside the package — an index for `codegraph` ([Codegraph tools](#codegraph-tools)), a project toolchain for `diagnostics` ([diagnostics](#diagnostics)). `rg` needs only ripgrep on the machine and defaults to `true`; `codegraphPath` and `rgPath` are config keys, not switches: `""` (the default) uses the first runnable executable on `PATH`, and any other value pins one outside `PATH`.
118
120
 
119
121
  | Config key | Default | Effect |
120
122
  | --- | --- | --- |
121
123
  | `codegraphPath` | `""` | Config key (not a switch): pin an executable outside `PATH`; empty uses the first runnable `codegraph` on `PATH`. |
124
+ | `rgPath` | `""` | Config key (not a switch): pin an `rg` outside `PATH`; empty uses the first runnable `rg` on `PATH`. |
122
125
 
123
126
  ### `read`
124
127
 
@@ -203,6 +206,29 @@ Each item names one inclusive bare anchor, `anchor_from`, and exactly one payloa
203
206
  - **`indent: "auto"`** (default `as-is`) re-bases the payload's indentation: the common leading-whitespace prefix of `text` is stripped and the leading whitespace of the `anchor_from` line is applied instead, with blank lines untouched. It is refused together with `text_ref` or a deletion (`text: ""`), and the applied change is reported in the call's notes channel ([ADR-0030](docs/adr/0030-edit-auto-indent.md)).
204
207
  - **`expand: "item"`** replaces the whole innermost enclosing syntax item — leading doc comment and attributes through the matching closing brace — instead of only the named rows. It names only `anchor_from` (an `anchor_to` is refused) and must be the only item in the call; an unsupported file or grammar refuses with `[E_EXPAND_UNAVAILABLE]` and writes nothing. Normal undo, diff and served rows still apply ([ADR-0031](docs/adr/0031-edit-expand-to-item.md)).
205
208
 
209
+ ### `rg`
210
+
211
+ File-content search executed by the system `rg`, replacing the host's built-in `grep` (which spawns the ripgrep binary vendored in `@vscode/ripgrep` with one fixed argv). It is registered as `rg` — not `grep` — so no call can be confused with the built-in tool or with a shell command of the same name; while the switch is on, the native `grep` and its `tool:grep` brief are hidden through the native-hide lane, and this tool ships its own brief, `prompts/rg-guidelines.md`, in the native `TOOL_GREP` prompt slot ([ADR-0033](docs/adr/0033-system-rg-grep-tool.md)).
212
+
213
+ | Parameter | Type | Effect |
214
+ | --- | --- | --- |
215
+ | `pattern` | required `string` | ripgrep regular expression, or literal text with `fixedStrings`. |
216
+ | `path` | `string` | File or directory to search; defaults to the session working directory. |
217
+ | `include` | `string` | One positive glob filter (e.g. `*.ts`, `*.{js,jsx}`); no lists, no negation. |
218
+ | `ignoreCase` | `boolean` | `-i`; absent keeps ripgrep's smart case. |
219
+ | `fixedStrings` | `boolean` | `-F`: literal text, not a regex. |
220
+ | `wordMatch` | `boolean` | `-w`: whole words only. |
221
+ | `hidden` | `boolean` | `--hidden`: also search hidden files and directories. |
222
+ | `noIgnore` | `boolean` | `--no-ignore`: ignore `.gitignore`/`.ignore` rules. |
223
+
224
+ ```text
225
+ rg({ pattern: "run_code", include: "*.ts", ignoreCase: true })
226
+ ```
227
+
228
+ - **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 is the native grep's `{ matches: [{ path, lineNumber, line }] }`, so the unchanged grep view re-reads every matched line from disk, serves it as `HASH│content` and leases it — the next `edit`/`apply_patch` needs no separate `read`. 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
+ - **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
+
206
232
  ### codegraph tools
207
233
 
208
234
  Eight read-only tools over a repository indexed by the external `codegraph` CLI, one process per call. Three return source, five return locations only:
@@ -240,9 +266,7 @@ Runs the project's own toolchain and serves what it reports as anchors — one c
240
266
  - **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.
241
267
  - **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`.
242
268
 
243
- ## Shell view
244
-
245
- The plugin installs a `tools/post-execute` listener for the host's `pwsh`, `bash` and built-in `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 built-in grep result whose matches are proven against disk is served the same way (see the table below).
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` result whose matches are proven against disk is served the same way (see the table below); the `grep` that reaches this listener is this plugin's own system-`rg` tool unless the `grep` switch is off.
246
270
 
247
271
  | Command shape | Served as |
248
272
  | --- | --- |
@@ -251,7 +275,7 @@ The plugin installs a `tools/post-execute` listener for the host's `pwsh`, `bash
251
275
  | `Get-Content <file> \| Select-Object -Skip N -First M` (either order) | disk lines N+1 through N+M |
252
276
  | `Select-String <pattern> <file>` | the matched lines, with their line numbers |
253
277
  | `rg <pattern> <file>` (explicit single file, no switches) | the matched lines, with their line numbers |
254
- | built-in `grep` (`@deepseek-ai/dsh-tool-fs-search`) | the matched lines grouped per file, each row `HASH│content` |
278
+ | `rg` (this plugin's system-`rg` tool) | the matched lines grouped per file, each row `HASH│content` |
255
279
 
256
280
  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.
257
281
 
@@ -355,4 +379,4 @@ The hashline engine is [**pi-better-edit**](https://github.com/Rianico/pi-better
355
379
 
356
380
  ## License
357
381
 
358
- [MIT](LICENSE)
382
+ [MIT](LICENSE)
package/cordis.patch.yml CHANGED
@@ -7,7 +7,10 @@
7
7
  # `apply_patch`); `apply_patch` hides only the native `apply_patch`; the built-in
8
8
  # `write` stays visible;
9
9
  # both may be on at once. Each toggles live: the host reloads this row and the
10
- # plugin re-mounts every live agent. Defaults: read on, apply_patch on, edit off.
10
+ # plugin re-mounts every live agent. Defaults: read on, apply_patch on, edit off, rg on.
11
+ # `rg` registers an `rg` tool over the system `rg` and disables the built-in `grep` (and its
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. `rgPath` pins an `rg` executable outside PATH.
11
14
  - insert:
12
15
  # `codegraph` adds the eight graph tools (explore/node/context/search/callers/callees/
13
16
  # impact/implementations); the three source tools serve `HASH│content` rows. It needs the
@@ -25,3 +28,8 @@
25
28
  # as `HASH│content` rows. It needs that toolchain on the machine, and reports a
26
29
  # missing one (or a missing tsconfig) as call text.
27
30
  diagnostics: true
31
+ # `rg` replaces the built-in grep with a tool over the system `rg`, exposing ripgrep's
32
+ # matching switches and hiding the built-in grep and its brief; the read switch's grep
33
+ # view still serves its matches as anchors.
34
+ rg: true
35
+ rgPath: ""