dsh-hashline-edit 0.5.0 → 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.
Files changed (53) hide show
  1. package/README.md +84 -7
  2. package/cordis.patch.yml +20 -2
  3. package/lib/client.js +13 -3
  4. package/lib/index.js +2643 -78
  5. package/lib/types/dsh/codegraph/cli.d.ts +61 -0
  6. package/lib/types/dsh/codegraph/project.d.ts +27 -0
  7. package/lib/types/dsh/codegraph/tools.d.ts +36 -0
  8. package/lib/types/dsh/codegraph/view.d.ts +25 -0
  9. package/lib/types/dsh/diagnostics/cli.d.ts +76 -0
  10. package/lib/types/dsh/diagnostics/messages.d.ts +37 -0
  11. package/lib/types/dsh/diagnostics/parse.d.ts +39 -0
  12. package/lib/types/dsh/diagnostics/tools.d.ts +20 -0
  13. package/lib/types/dsh/diagnostics/view.d.ts +31 -0
  14. package/lib/types/dsh/guidance.d.ts +10 -4
  15. package/lib/types/dsh/hide.d.ts +6 -0
  16. package/lib/types/dsh/index.d.ts +51 -3
  17. package/lib/types/dsh/rg/cli.d.ts +67 -0
  18. package/lib/types/dsh/rg/command.d.ts +70 -0
  19. package/lib/types/dsh/rg/tools.d.ts +47 -0
  20. package/lib/types/dsh/rg/view.d.ts +81 -0
  21. package/lib/types/dsh/shell-view.d.ts +2 -2
  22. package/lib/types/dsh/tools/edit.d.ts +15 -1
  23. package/lib/types/dsh/tools/read-folded.d.ts +85 -0
  24. package/lib/types/src/domain-errors.d.ts +12 -1
  25. package/lib/types/src/edit-tool.d.ts +9 -1
  26. package/lib/types/src/mutation-engine/edit-expand.d.ts +36 -0
  27. package/lib/types/src/mutation-engine/edit-indent.d.ts +49 -0
  28. package/lib/types/src/mutation-engine/edit-request.d.ts +4 -0
  29. package/lib/types/src/mutation-engine/types.d.ts +57 -0
  30. package/lib/types/src/payload-contract.d.ts +4 -0
  31. package/lib/types/src/read-expansion/fold-skeleton.d.ts +32 -0
  32. package/lib/types/src/read-expansion/span-expansion.d.ts +26 -0
  33. package/package.json +1 -1
  34. package/prompts/codegraph-guidelines.md +8 -0
  35. package/prompts/diagnostics-guidelines.md +8 -0
  36. package/prompts/edit-guidelines.md +3 -1
  37. package/prompts/edit.md +3 -1
  38. package/prompts/read-description.md +1 -1
  39. package/prompts/read-guidelines.md +3 -1
  40. package/prompts/rg-guidelines.md +8 -0
  41. package/src/domain-errors.ts +52 -1
  42. package/src/edit-tool.ts +12 -1
  43. package/src/mutation-engine/edit-expand.ts +328 -0
  44. package/src/mutation-engine/edit-indent.ts +121 -0
  45. package/src/mutation-engine/edit-request.ts +4 -0
  46. package/src/mutation-engine/pipeline.ts +134 -48
  47. package/src/mutation-engine/types.ts +54 -0
  48. package/src/payload-contract.ts +74 -4
  49. package/src/read-expansion/ast-provider.ts +32 -0
  50. package/src/read-expansion/fold-skeleton.ts +56 -0
  51. package/src/read-expansion/qualified-names.ts +7 -0
  52. package/src/read-expansion/read-provider.ts +9 -0
  53. package/src/read-expansion/span-expansion.ts +26 -0
package/README.md CHANGED
@@ -14,6 +14,9 @@ The semantic core is the [pi-better-edit](https://github.com/Rianico/pi-better-e
14
14
  | Node.js | ≥ 24.0.0 |
15
15
  | pnpm | 12.x |
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
+ | codegraph CLI | ≥ 1.6.4 — optional; needed only for the eight `codegraph_*` graph tools ([Codegraph tools](#codegraph-tools)) |
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 |
17
20
 
18
21
  ### Anchor width (3 or 4)
19
22
 
@@ -89,13 +92,16 @@ Served anchors are leased per session and per file. A stale, unknown, retired or
89
92
 
90
93
  ### Live switches and profiles
91
94
 
92
- `read`, `applyPatch` and `edit` are three 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.
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)).
93
96
 
94
97
  | Switch | Default | Effect |
95
98
  | --- | --- | --- |
96
99
  | `read` | `true` | Register the hash-anchored `read` tool and its shell/grep views. |
97
100
  | `applyPatch` | `true` | Register the `apply_patch` tool. |
98
101
  | `edit` | `false` | Register the anchored range `edit` tool. |
102
+ | `codegraph` | `false` (`cordis.patch.yml` ships `true`) | Register the eight `codegraph_*` graph tools and the `tool:codegraph` prompt section. |
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. |
99
105
 
100
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:
101
107
 
@@ -110,6 +116,13 @@ config: { read: true, applyPatch: true, edit: true }
110
116
  config: { read: true, applyPatch: false, edit: true }
111
117
  ```
112
118
 
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`.
120
+
121
+ | Config key | Default | Effect |
122
+ | --- | --- | --- |
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`. |
125
+
113
126
  ### `read`
114
127
 
115
128
  ```ts
@@ -121,14 +134,16 @@ read({
121
134
  | { offset: number; limit: number }
122
135
  | { around_anchor: string; radius?: number } // radius defaults to 10
123
136
  >,
124
- mode?: "served" | "verbatim", // default "served"
137
+ mode?: "served" | "verbatim" | "folded", // default "served"
138
+ foldDepth?: number, // 1-3, default 1; only with mode: "folded"
125
139
  })
126
140
  ```
127
141
 
128
142
  - **Served mode** returns one `HASH│content` row per line and records every shown row as a lease for this session. A windowed read also includes a `[Lines A-B of N total]` page header. Every row shown is usable by one subsequent `apply_patch` or `edit`, even when the windows are far apart.
129
143
  - **Verbatim mode** returns the same page as plain text with no anchors and serves nothing; an `apply_patch` identity hunk or an `edit` item cannot target those lines.
144
+ - **Folded mode** is the whole-file structural skeleton (`mode: "folded"`): one row per syntax item in file order, the item's opening line verbatim, and the item's first and last anchors — `HASH│opening line` for a single-line item, `HASH1..HASH2│opening line` for a multi-line one. An item is the language's decorated scope (wrapper plus leading doc comment), so a whole-item replacement owns the docs too. Lines no retained item covers collapse into ONE gap row per contiguous run, `HASH1..HASH2│… (N lines) …`: the edges are served, the interior is not. `foldDepth` (1–3, default 1) sets the fold depth; it is refused unless `mode: "folded"`, and `offset`/`limit`/`windows` are refused with folded (`E_BAD_PAYLOAD`). The page header is `[Folded view, N items, M lines elided: file (X lines total)]`. Folded is fail-open: no grammar, a cold grammar, a parse failure or an empty file fall back to the ordinary served page with one note row naming the reason — never a guessed anchor ([ADR-0029](docs/adr/0029-folded-read-mode-and-range-rows.md)).
130
145
  - A small requested window — up to 61 lines after folding — may widen to its enclosing function, method, class, section or paragraph; a `[widened …]` note names the block that was served. Expansion applies in both modes. Languages: TypeScript/TSX, Python, Go, Rust, Java and Vue through pinned tree-sitter wasm grammars (all seven ship inside the package under `grammars/` and are verified against a committed SHA-256; the lazy download only covers a manifest entry with no shipped asset), plus Bash through the existing `unbash` parser (no wasm). Vue widens a top-level `template`/`script`/`style` block without parsing embedded JS/TS. SQL is not supported: real migrations largely fail to parse and `.tql` is a Java template, not SQL (see [`docs/spec/sql-vue-feasibility-gate.md`](docs/spec/sql-vue-feasibility-gate.md)).
131
- - `offset`/`limit` and `windows` are page requests, not anchors: only `served` output grants mutation leases.
146
+ - `offset`/`limit` and `windows` are page requests, not anchors: only anchored output grants a mutation lease, and `folded` is whole-file, so it accepts none of the three.
132
147
 
133
148
  ### `apply_patch`
134
149
 
@@ -188,9 +203,70 @@ The anchored range writer. One call targets one file and carries one ordered `ed
188
203
 
189
204
  Each item names one inclusive bare anchor, `anchor_from`, and exactly one payload: `text` is the replacement content (`""` deletes the range), or `text_ref` is a served span read in `copy` or `cut` mode. A multi-line range adds the optional second anchor `anchor_to` (the last line, inclusive), so a single-line edit omits it and the target is the one line `anchor_from` names — spelling `anchor_from === anchor_to` still validates. A `text_ref` span always names both bounds. Optional `at` is `in-place` by default; `before` / `after` insert at the boundary and require a single-line target. A `text_ref.file` may name another served file as the copy/cut source, and `cut` also retires those source lines; the call's own target remains one file. The retired item-level `file` field is not part of the payload — an old multi-file item shape is refused with `[E_BAD_PAYLOAD]`, and a different target file is a different call. The call commits as one transaction and writes one undo record for recovery; undo is not exposed as a model tool. A pure insertion can instead carry its own payload slot: `after` places the given lines immediately below the single line `anchor_from` names and `before` places them above, without restating the anchor line (`at` + `text` is the older spelling of the same insertion).
190
205
 
191
- ## Shell view
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)).
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)).
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
+
232
+ ### codegraph tools
233
+
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:
235
+
236
+ | Tool | CLI call | Returns |
237
+ | --- | --- | --- |
238
+ | `codegraph_explore` | `codegraph explore <query> [--max-files N] -p <project>` | source, as `HASH│content` rows |
239
+ | `codegraph_node` | `codegraph node [symbol] [-f file] [--offset N] [--limit N] [--symbols-only] -p <project>` | source, as `HASH│content` rows |
240
+ | `codegraph_context` | `codegraph context <task> [-n N] [--no-code] -p <project>` | source, as `HASH│content` rows |
241
+ | `codegraph_search` | `codegraph query <search> [-k kind] [-l N] -p <project>` | locations only |
242
+ | `codegraph_callers` | `codegraph callers <symbol> [-f file] [-l N] -p <project>` | locations only |
243
+ | `codegraph_callees` | `codegraph callees <symbol> [-f file] [-l N] -p <project>` | locations only |
244
+ | `codegraph_impact` | `codegraph impact <symbol> [-f file] [-d depth] -p <project>` | locations only |
245
+ | `codegraph_implementations` | `codegraph implementations <symbol> [-f file] [-d depth] -p <project>` | locations only |
246
+
247
+ - **Anchored source.** `explore`, `node` and `context` output is re-read from disk through the same governed decode `read` uses and served through the same seam, so the printed source arrives as `HASH│content` rows `apply_patch` and `edit` accept directly. A block that does not verify byte-for-byte against disk is returned exactly as codegraph printed it — never with a guessed anchor.
248
+ - **Project resolution.** An explicit `projectPath` tool argument wins; otherwise the nearest `.codegraph` at or above the session working directory. An ancestor index is accepted only when that ancestor is a repository root (has `.git`), so a `.codegraph` in a home directory cannot capture unrelated directories; a nested repository without its own index is reported as unindexed instead of being answered by a parent index.
249
+ - **Expected failures are text results, not tool errors.** A missing CLI (guidance naming `codegraphPath` and the install step), no index (indexing is the user's decision — ask before `codegraph init`), the 120 s timeout, a non-zero exit (the CLI's stderr is reported) and empty output (a hint to `codegraph sync`) all return a normal successful result carrying that guidance.
250
+ - **Requires codegraph ≥ 1.6.4** and an index built by it: `context` and `implementations` ship in 1.6.4, and a stale index is refreshed with `codegraph sync`.
251
+
252
+ The surface is a subprocess, not an imported library and not an MCP server: the CLI prints exactly the rendering the codegraph MCP server returns, so the host carries no second module graph, worker pool or daemon — and serving that text through this plugin's read seam is what makes it editable. The tools register only while `codegraph: true`; see [Live switches and profiles](#live-switches-and-profiles).
253
+
254
+ ### diagnostics
255
+
256
+ Runs the project's own toolchain and serves what it reports as anchors — one call is compile, diagnose and locate in a single round trip.
257
+
258
+ | Parameter | Type | Effect |
259
+ | --- | --- | --- |
260
+ | `tool` | required; `"cargo-check"` \| `"cargo-clippy"` \| `"tsc"` | Which toolchain to run. Any other value is a hard argument error. |
261
+ | `cwd` | `string` | Project directory; defaults to the session working directory. |
262
+ | `contextLines` | `1`–`10`, default `2` | Lines of context served above and below each reported line. |
263
+ | `maxDiagnostics` | `1`–`100`, default `20` | Diagnostics served; a larger request is clamped. |
264
+
265
+ - **Anchored rows, not a compiler dump.** Each reported line plus ±`contextLines` is served through the read seam, byte-identical to a read page, so the rows are `HASH│content` anchors `edit` and `apply_patch` accept with no separate `read`. The page header is `N diagnostics (X errors, Y warnings) from <tool> in <cwd>`, and each diagnostic opens with its own line, e.g. `error[E0308] mismatched types — crates/x/src/queue.rs:4:9`, before its rows ([ADR-0032](docs/adr/0032-anchored-diagnostics-tool.md)).
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.
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`.
192
268
 
193
- 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.
194
270
 
195
271
  | Command shape | Served as |
196
272
  | --- | --- |
@@ -199,7 +275,7 @@ The plugin installs a `tools/post-execute` listener for the host's `pwsh`, `bash
199
275
  | `Get-Content <file> \| Select-Object -Skip N -First M` (either order) | disk lines N+1 through N+M |
200
276
  | `Select-String <pattern> <file>` | the matched lines, with their line numbers |
201
277
  | `rg <pattern> <file>` (explicit single file, no switches) | the matched lines, with their line numbers |
202
- | 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` |
203
279
 
204
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.
205
281
 
@@ -249,6 +325,7 @@ Every refusal carries a bracketed code; `src/domain-errors.ts` is the source of
249
325
  | `[E_BAD_PAYLOAD]` | Malformed or unknown tool payload; nothing is written. |
250
326
  | `[E_BATCH_ABORT]` | A batch item failed; the whole batch was not applied. |
251
327
  | `[E_EMPTY_RANGE]` | The patch would empty a non-empty file; use `write`. |
328
+ | `[E_EXPAND_UNAVAILABLE]` | The target file or grammar cannot resolve an enclosing item for `expand: "item"`; nothing is written. |
252
329
  | `[E_FOREIGN_ANCHOR]` | The anchor belongs to a different file. |
253
330
  | `[E_INTERNAL_INVARIANT]` | An internal invariant was violated. |
254
331
  | `[E_LARGE_FILE]` | The file exceeds the served line or byte budget. |
@@ -302,4 +379,4 @@ The hashline engine is [**pi-better-edit**](https://github.com/Rianico/pi-better
302
379
 
303
380
  ## License
304
381
 
305
- [MIT](LICENSE)
382
+ [MIT](LICENSE)
package/cordis.patch.yml CHANGED
@@ -1,17 +1,35 @@
1
1
  # dsh-hashline-edit bundle patch: mount the host-plane plugin row.
2
2
  # Installed via `dsh plugin --profile <name> add dsh-hashline-edit` (or a
3
- # profile's bundle list). The row carries three feature switches, edited on the
3
+ # profile's bundle list). The row carries its feature switches, edited on the
4
4
  # Plugins page: `read` shadows the built-in read, `applyPatch` exposes the
5
5
  # `apply_patch` tool, `edit` exposes the anchored range `edit` tool. `edit` hides
6
6
  # the native `edit`/`str_replace_editor` (and, in an edit-only profile, the native
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:
15
+ # `codegraph` adds the eight graph tools (explore/node/context/search/callers/callees/
16
+ # impact/implementations); the three source tools serve `HASH│content` rows. It needs the
17
+ # external `codegraph` CLI (>=1.6.4) and a repository indexed by it; `codegraphPath` pins
18
+ # an executable outside PATH.
12
19
  - id: dsh-hashline-edit
13
20
  name: dsh-hashline-edit
14
21
  config:
15
22
  read: true
16
23
  applyPatch: true
17
24
  edit: false
25
+ codegraph: true
26
+ codegraphPath: ""
27
+ # `diagnostics` adds the `diagnostics` tool: cargo check/clippy or tsc output served
28
+ # as `HASH│content` rows. It needs that toolchain on the machine, and reports a
29
+ # missing one (or a missing tsconfig) as call text.
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: ""
package/lib/client.js CHANGED
@@ -31,7 +31,9 @@ var import_jsx_runtime = require("react/jsx-runtime");
31
31
  var SWITCHES = [
32
32
  { key: "read", label: "swRead", hint: "swReadHint", fallback: true },
33
33
  { key: "applyPatch", label: "swApplyPatch", hint: "swApplyPatchHint", fallback: true },
34
- { key: "edit", label: "swEdit", hint: "swEditHint", fallback: false }
34
+ { key: "edit", label: "swEdit", hint: "swEditHint", fallback: false },
35
+ { key: "codegraph", label: "swCodegraph", hint: "swCodegraphHint", fallback: false },
36
+ { key: "diagnostics", label: "swDiagnostics", hint: "swDiagnosticsHint", fallback: false }
35
37
  ];
36
38
  var en = {
37
39
  swRead: "Read (shadow the host read)",
@@ -40,6 +42,10 @@ var en = {
40
42
  swApplyPatchHint: "Expose apply_patch and hide the native edit / write / apply_patch / str_replace_editor tools.",
41
43
  swEdit: "Edit (anchored ranges)",
42
44
  swEditHint: "Expose the single-file edit tool: N anchored range items in one call. It shares anchors, the store and the mutation queue with apply_patch.",
45
+ swCodegraph: "Codegraph tools",
46
+ swCodegraphHint: "Expose the eight codegraph graph tools; explore, node and context serve their source as hash rows. Needs the codegraph CLI (1.6.4+); set codegraphPath in the row config to pin an executable outside PATH.",
47
+ swDiagnostics: "Diagnostics",
48
+ swDiagnosticsHint: "Expose the diagnostics tool: run cargo check/clippy or tsc and get the reported lines back as hash rows. Needs that toolchain on the machine; a missing one is reported as call text.",
43
49
  groupTools: "Hashline tools",
44
50
  groupToolsHint: "Toggle each tool live. Turning one off restores the host's own tool.",
45
51
  save: "Save",
@@ -49,7 +55,7 @@ var en = {
49
55
  rejected: "The host refused this save; reset and review your changes.",
50
56
  loading: "Loading host settings\u2026",
51
57
  unavailable: "Enable this row with the built-in switch to edit its settings.",
52
- rowSummary: "Read, apply_patch and edit switches."
58
+ rowSummary: "Read, apply_patch, edit, codegraph and diagnostics switches."
53
59
  };
54
60
  var zh = {
55
61
  swRead: "\u8BFB\u53D6\uFF08\u906E\u853D\u5BBF\u4E3B read\uFF09",
@@ -58,6 +64,10 @@ var zh = {
58
64
  swApplyPatchHint: "\u542F\u7528 apply_patch\uFF0C\u5E76\u9690\u85CF\u539F\u751F edit / write / apply_patch / str_replace_editor\u3002",
59
65
  swEdit: "\u533A\u95F4\u7F16\u8F91",
60
66
  swEditHint: "\u542F\u7528\u5355\u6587\u4EF6 edit \u5DE5\u5177\uFF1A\u4E00\u6B21\u8C03\u7528\u63D0\u4EA4 N \u5904\u951A\u5B9A\u533A\u95F4\u4FEE\u6539\uFF1B\u4E0E apply_patch \u5171\u7528\u951A\u70B9\u3001\u5B58\u50A8\u4E0E\u53D8\u66F4\u961F\u5217\u3002",
67
+ swCodegraph: "Codegraph \u56FE\u8C31\u5DE5\u5177",
68
+ swCodegraphHint: "\u542F\u7528 8 \u4E2A codegraph \u56FE\u8C31\u5DE5\u5177\uFF1Bexplore\u3001node\u3001context \u8FD4\u56DE\u7684\u6E90\u7801\u4F1A\u76F4\u63A5\u5E26\u4E0A\u54C8\u5E0C\u951A\u70B9\u3002\u9700\u8981 codegraph CLI\uFF081.6.4+\uFF09\uFF1B\u4E0D\u5728 PATH \u65F6\u5728\u884C\u914D\u7F6E\u91CC\u8BBE\u7F6E codegraphPath\u3002",
69
+ swDiagnostics: "\u7F16\u8BD1\u8BCA\u65AD",
70
+ swDiagnosticsHint: "\u542F\u7528 diagnostics \u5DE5\u5177\uFF1A\u8DD1 cargo check/clippy \u6216 tsc\uFF0C\u628A\u62A5\u9519\u884C\u4F5C\u4E3A\u54C8\u5E0C\u884C\u8FD4\u56DE\u3002\u9700\u8981\u673A\u5668\u4E0A\u6709\u5BF9\u5E94\u5DE5\u5177\u94FE\uFF1B\u7F3A\u5931\u65F6\u4EE5\u6587\u672C\u63D0\u793A\u8FD4\u56DE\u3002",
61
71
  groupTools: "Hashline \u5DE5\u5177",
62
72
  groupToolsHint: "\u5B9E\u65F6\u5207\u6362\u6BCF\u4E2A\u5DE5\u5177\uFF1B\u5173\u95ED\u540E\u6062\u590D\u5BBF\u4E3B\u81EA\u5E26\u5DE5\u5177\u3002",
63
73
  save: "\u4FDD\u5B58",
@@ -67,7 +77,7 @@ var zh = {
67
77
  rejected: "\u5BBF\u4E3B\u62D2\u7EDD\u4E86\u6B64\u6B21\u4FDD\u5B58\uFF1B\u8BF7\u91CD\u7F6E\u540E\u91CD\u65B0\u68C0\u67E5\u66F4\u6539\u3002",
68
78
  loading: "\u6B63\u5728\u52A0\u8F7D\u5BBF\u4E3B\u8BBE\u7F6E\u2026",
69
79
  unavailable: "\u8BF7\u5148\u7528\u5185\u7F6E\u5F00\u5173\u542F\u7528\u6B64\u884C\u540E\u518D\u7F16\u8F91\u8BBE\u7F6E\u3002",
70
- rowSummary: "\u8BFB\u53D6\u3001apply_patch \u4E0E\u533A\u95F4\u7F16\u8F91\u5F00\u5173\u3002"
80
+ rowSummary: "\u8BFB\u53D6\u3001apply_patch\u3001\u533A\u95F4\u7F16\u8F91\u3001codegraph \u4E0E diagnostics \u5F00\u5173\u3002"
71
81
  };
72
82
  var CSS = `
73
83
  .hashline-settings { display:flex; flex-direction:column; gap:12px; font:inherit; color:var(--dsw-alias-label-primary,#222); }