dsh-hashline-edit 0.4.3 → 0.5.1
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/CHANGELOG.md +345 -0
- package/README.md +58 -5
- package/cordis.patch.yml +11 -1
- package/grammars/go-0.25.0-9504573f352b20be.wasm +0 -0
- package/grammars/java-0.23.5-4fdeac4ca6ca089f.wasm +0 -0
- package/grammars/python-0.25.0-16108b50df4ee9a3.wasm +0 -0
- package/grammars/rust-0.24.2-24c89bd9252255e4.wasm +0 -0
- package/grammars/tsx-0.23.2-79e5da75ea62855a.wasm +0 -0
- package/grammars/typescript-0.23.2-778025db5a8be0e7.wasm +0 -0
- package/grammars/vue-0.1.0-193c01119229352f.wasm +0 -0
- package/lib/client.js +13 -3
- package/lib/index.js +2345 -75
- package/lib/types/dsh/codegraph/cli.d.ts +61 -0
- package/lib/types/dsh/codegraph/project.d.ts +27 -0
- package/lib/types/dsh/codegraph/tools.d.ts +36 -0
- package/lib/types/dsh/codegraph/view.d.ts +25 -0
- package/lib/types/dsh/diagnostics/cli.d.ts +76 -0
- package/lib/types/dsh/diagnostics/messages.d.ts +37 -0
- package/lib/types/dsh/diagnostics/parse.d.ts +39 -0
- package/lib/types/dsh/diagnostics/tools.d.ts +20 -0
- package/lib/types/dsh/diagnostics/view.d.ts +31 -0
- package/lib/types/dsh/guidance.d.ts +7 -3
- package/lib/types/dsh/index.d.ts +32 -3
- package/lib/types/dsh/syntax-health.d.ts +60 -0
- package/lib/types/dsh/tools/edit.d.ts +15 -1
- package/lib/types/dsh/tools/output.d.ts +10 -0
- package/lib/types/dsh/tools/read-folded.d.ts +85 -0
- package/lib/types/src/bundled-assets.d.ts +13 -0
- package/lib/types/src/domain-errors.d.ts +12 -1
- package/lib/types/src/edit-tool.d.ts +9 -1
- package/lib/types/src/mutation-engine/edit-expand.d.ts +36 -0
- package/lib/types/src/mutation-engine/edit-indent.d.ts +49 -0
- package/lib/types/src/mutation-engine/edit-request.d.ts +8 -0
- package/lib/types/src/mutation-engine/types.d.ts +57 -0
- package/lib/types/src/payload-contract.d.ts +8 -0
- package/lib/types/src/read-expansion/fold-skeleton.d.ts +32 -0
- package/lib/types/src/read-expansion/grammar-manifest.d.ts +3 -1
- package/lib/types/src/read-expansion/grammar-runtime.d.ts +1 -1
- package/lib/types/src/read-expansion/span-expansion.d.ts +26 -0
- package/package.json +21 -23
- package/prompts/codegraph-guidelines.md +8 -0
- package/prompts/diagnostics-guidelines.md +8 -0
- package/prompts/edit-guidelines.md +6 -2
- package/prompts/edit.md +3 -1
- package/prompts/read-description.md +1 -1
- package/prompts/read-guidelines.md +3 -1
- package/src/bundled-assets.ts +23 -0
- package/src/domain-errors.ts +52 -1
- package/src/edit-tool.ts +12 -1
- package/src/mutation-engine/edit-expand.ts +328 -0
- package/src/mutation-engine/edit-indent.ts +121 -0
- package/src/mutation-engine/edit-request.ts +8 -1
- package/src/mutation-engine/pipeline.ts +150 -48
- package/src/mutation-engine/types.ts +54 -0
- package/src/payload-contract.ts +165 -19
- package/src/read-expansion/ast-provider.ts +32 -0
- package/src/read-expansion/fold-skeleton.ts +56 -0
- package/src/read-expansion/grammar-cache.ts +33 -1
- package/src/read-expansion/grammar-manifest.ts +3 -1
- package/src/read-expansion/grammar-runtime.ts +1 -1
- package/src/read-expansion/qualified-names.ts +7 -0
- package/src/read-expansion/read-provider.ts +9 -0
- package/src/read-expansion/span-expansion.ts +26 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.5.1] - 2026-11-23
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **dsh:** add the optional `codegraph` tool surface — eight read-only tools (`codegraph_explore`, `codegraph_node`, `codegraph_context`, `codegraph_search`, `codegraph_callers`, `codegraph_callees`, `codegraph_impact`, `codegraph_implementations`) that spawn the external `codegraph` CLI once per call. `explore`/`node`/`context` print source that is re-read from disk through the read tool's governed decode and served as `HASH│content` rows the mutation tools accept directly; a block that does not verify byte-for-byte against disk is returned as printed, never with a guessed anchor (`dsh/codegraph/`).
|
|
10
|
+
* **dsh:** resolve the codegraph project from an explicit `projectPath` argument, else the nearest `.codegraph` at or above the session working directory, accepting an ancestor index only when that ancestor is a repository root (has `.git`) so a home-directory index cannot capture unrelated directories; expected failures — missing CLI, no index, the 120 s timeout, a non-zero exit, empty output — are successful text results carrying guidance, not tool errors.
|
|
11
|
+
* **dsh:** add the fourth live switch `codegraph` (schema default `false`; `cordis.patch.yml` ships `true`) and the `codegraphPath` string key (`""` = first runnable `codegraph` on `PATH`; set it to pin an executable outside `PATH`, resolving the node script behind a Windows `.cmd` shim), plus the `tool:codegraph` prompt section (`prompts/codegraph-guidelines.md`); the tools require codegraph 1.6.4 or newer for `context`/`implementations` (ADR-0028).
|
|
12
|
+
* **read:** add `mode: "folded"` and `foldDepth` (1–3, default 1): a whole-file structural skeleton with one row per decorated item — `HASH│opening line`, or `HASH1..HASH2│opening line` for a multi-line item — plus one `HASH1..HASH2│… (N lines) …` gap row per contiguous uncovered run, so the served edges are anchors and the elided interior is not. Folded is whole-file only (`foldDepth` without it, and `offset`/`limit`/`windows` with it, are refused with `E_BAD_PAYLOAD`) and fail-open: no grammar, cold grammar, parse failure or an empty file fall back to the served page with one note row naming the reason (ADR-0029).
|
|
13
|
+
* **edit:** add `indent: "auto"` (default `as-is`), which strips the payload's common leading-whitespace prefix and re-applies the `anchor_from` line's indent, leaving blank lines untouched; it is refused together with `text_ref` or a deletion, and the applied change is reported in the notes channel (ADR-0030).
|
|
14
|
+
* **edit:** add `expand: "item"`, which replaces the whole innermost enclosing syntax item — leading doc comment and attributes through the matching closing brace — naming only `anchor_from` and requiring it to be the only item in the call; unsupported files and grammars refuse with `E_EXPAND_UNAVAILABLE` and write nothing (ADR-0031).
|
|
15
|
+
* **dsh:** add the `diagnostics` tool (required `tool` = `cargo-check` | `cargo-clippy` | `tsc`; optional `cwd`, `contextLines` 1–10, `maxDiagnostics` 1–100), which runs the toolchain with no shell and a 120 s budget and serves each reported line ± context through the read seam, so diagnostics arrive as `HASH│content` rows usable by `edit`/`apply_patch`; expected failures are successful text results. With it: the fifth live switch `diagnostics` (schema default `false`; `cordis.patch.yml` ships `true`), the `tool:diagnostics` brief at order 1250 (`prompts/diagnostics-guidelines.md`) and the `dsh/diagnostics/` module (ADR-0032).
|
|
16
|
+
|
|
17
|
+
## [0.5.0] - 2026-11-23
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* **edit:** add `after` and `before` insertion payload slots — `{ "anchor_from": "aB3", "after": "…" }` places the given lines immediately below the anchor line without restating it, and `before` does the same above. Both normalize to the insertion arm `at` + `text` already produced, so the engine keeps one insertion vocabulary while the model states placement once (ADR-0025).
|
|
22
|
+
* **dsh:** run a post-edit Tree-sitter syntax check and append one `[W_SYNTAX]` warning when the call turned a clean file into one with parse errors. The check reads the baseline before the write, re-parses after it, and stays silent for an already-broken file, a clean result, an abort, a missing grammar or a parser crash — a bonus signal never fails a call (ADR-0027, `dsh/syntax-health.ts`).
|
|
23
|
+
* **read:** ship all seven pinned grammars inside the package (`grammars/`, 4.9 MB) so a first read parses offline instead of waiting on a GitHub release download; the lazy fetch stays as the fallback for a manifest entry with no shipped asset, and bundled bytes are digest-verified exactly like fetched ones (ADR-0026).
|
|
24
|
+
|
|
25
|
+
### Documentation
|
|
26
|
+
|
|
27
|
+
* **docs:** add ADR-0025 (insertion payload slots), ADR-0026 (bundled grammars) and ADR-0027 (post-edit syntax health).
|
|
28
|
+
|
|
29
|
+
## [0.4.3] - 2026-11-21
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* **edit:** make `anchor_to` optional — an item that names only `anchor_from` edits that single line, and an explicit `null` reads as omitted like every other optional slot. A multi-line range still names both bounds and a `text_ref` span always requires both, so recorded history keeps validating (the old two-anchor shape stays accepted) while a single-line edit no longer repeats the same hash twice.
|
|
34
|
+
|
|
35
|
+
### Documentation
|
|
36
|
+
|
|
37
|
+
* **docs:** record the Windows 8.3 short-name limitation of the workspace boundary guard (`docs/agents/windows-8dot3-short-name-guard.md`): a `%TEMP%` path like `C:\Users\ADMINI~1\…` makes `realpath(component) !== component` fire on a plain directory, so the 45 `test/apply-patch/*` acceptance cases fail locally while passing in CI. The note gives the verified mitigation (`TEMP`, not `TMPDIR`, at a long-form path — 16/16 files then pass), explains why the guard must stay fail-closed, and is linked from `AGENTS.md`.
|
|
38
|
+
|
|
39
|
+
## [0.4.2] - 2026-11-18
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* **prompts:** read the tool prose from the shipped `prompts/*.md` files at load time instead of a build-time `src/prompts-bundled.ts` table; `prompts/` is back in the package `files`, and the `read` tool description now loads `prompts/read-description.md` so all three tool descriptions resolve their own markdown.
|
|
44
|
+
* **prompts:** drop the guidance-section intro paragraph (it duplicated the tool description for `edit`/`apply_patch`) so every `tool:*` section renders its `-` guidelines only; `guidanceText` now handles an empty intro. `prompts/read.md` and `prompts/write.md` were pure intros — their non-duplicate sentences move into `read-description.md` / `write-guidelines.md` and the two files are removed. The `read`/`write` briefs now reference `edit` only (the `apply_patch` tool is being trialed as hidden), so the surviving mutation surface reads coherently.
|
|
45
|
+
* **dsh:** correct the native-editor hiding docs — the native `edit`/`str_replace_editor` are hidden only while this plugin's own `edit` registers, and `apply_patch` never hides them.
|
|
46
|
+
* **dsh:** when this plugin's `apply_patch` is off while `edit` is on, the hide layer now also denies the native `apply_patch`, so an edit-only profile does not re-expose the host's `apply_patch`.
|
|
47
|
+
|
|
48
|
+
### Documentation
|
|
49
|
+
|
|
50
|
+
* **docs:** add ADR-0022 (prompt prose reads the shipped markdown at runtime) and ADR-0023 (native editor hiding is per replacement tool); sync `README.md`, `dsh/README.md`, `cordis.patch.yml` and ADR-0021.
|
|
51
|
+
|
|
52
|
+
## [0.4.0] - 2026-11-11
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
* **edit:** ship the anchored range `edit` tool as production code: one target file per call, N anchored items per file, `text_ref` copy/cut with an optional foreign source file, and `in-place`/`before`/`after` placement. The retired item-level `file` is refused with `E_BAD_PAYLOAD`.
|
|
57
|
+
* **dsh:** add the `edit` switch (default off) next to `read` and `applyPatch`, so one bundle exposes the three cross-validation profiles — apply_patch only, both write tools, or edit only. With both mutation switches off, neither tool registers and no native-hide layer is installed.
|
|
58
|
+
* **dsh:** hide the native `edit`/`str_replace_editor`/`apply_patch` names only after a replacement tool registers, keep this plugin's own names out of the assembly and guard set, and retire the native `tool:edit` guidance only when the plugin provides no `edit` of its own.
|
|
59
|
+
* **prompts:** add `edit.md` and `edit-guidelines.md` in the apply_patch brief style — width-neutral `{{HASH_LEN}}` anchors, served `HASH│content` rows, symmetric with the `apply_patch` brief and silent about the other tool.
|
|
60
|
+
|
|
61
|
+
### Code Refactoring
|
|
62
|
+
|
|
63
|
+
* **dsh:** retire `undo_last_edit` from the model surface: tool, prompts, config switch and client toggle are gone, while the core still writes an undo row on every commit.
|
|
64
|
+
* **edit:** move the retired edit seam (`src/edit-tool.ts`, `src/payload-contract.ts`, `src/mutation-engine/engine.ts`, `src/mutation-result.ts`, `dsh/tools/edit.ts`) back into production and drop the multi-file preview fork that only the retired item-level `file` could reach.
|
|
65
|
+
|
|
66
|
+
### Documentation
|
|
67
|
+
|
|
68
|
+
* **docs:** add ADR-0021 (one bundle, three switches, symmetric briefs, one file per `edit`), and sync `README.md`, `GLOSSARY.md` and `dsh/README.md` with the three-state surface, the retired undo tool and the restored `edit` payload.
|
|
69
|
+
|
|
70
|
+
## [0.3.12] - 2026-11-10
|
|
71
|
+
|
|
72
|
+
### Bug Fixes
|
|
73
|
+
|
|
74
|
+
* **prompts:** compile the prompt prose into `src/prompts-bundled.ts` at build time, so the shipped bundle carries its own text and nothing reads a prompt file from disk; reinstalling the plugin is now the only step needed to change what the model reads.
|
|
75
|
+
|
|
76
|
+
## [0.3.11] - 2026-11-10
|
|
77
|
+
|
|
78
|
+
### Bug Fixes
|
|
79
|
+
|
|
80
|
+
* **prompts:** remove the unused `prompts/zh/` mirror set; only the English prompt files are loaded at runtime, so the duplicate Chinese copies were dead weight that had to be hand-synced on every prompt change.
|
|
81
|
+
* **prompts:** tighten the English `apply_patch` brief — a served row makes an identity hunk mandatory rather than preferred, a text match never licenses a fragment hunk on a served file, anchors already held need no re-read, and a hunk carries only the changed rows so a small edit stays a small patch.
|
|
82
|
+
|
|
83
|
+
## [0.3.10] - 2026-11-10
|
|
84
|
+
|
|
85
|
+
### Bug Fixes
|
|
86
|
+
|
|
87
|
+
* **prompts:** make a served `HASH│` identity hunk mandatory (not "preferred") whenever the session already served the file, forbid a redundant `read` when the anchors are already in hand, add a copyable identity-hunk template, and keep `write` as the whole-file-rewrite outlet, in both the English and Chinese prompt sets.
|
|
88
|
+
|
|
89
|
+
## [0.3.9] - 2026-11-10
|
|
90
|
+
|
|
91
|
+
### Bug Fixes
|
|
92
|
+
|
|
93
|
+
* **build:** bake the 3-char anchor width by default; `PI_BETTER_EDIT_ANCHOR_WIDTH=4` still builds the 4-char artifact.
|
|
94
|
+
|
|
95
|
+
## [0.3.8] - 2026-11-10
|
|
96
|
+
|
|
97
|
+
### Bug Fixes
|
|
98
|
+
|
|
99
|
+
* **prompts:** make `apply_patch` the default path for every change to an existing file, add a `tool:write` brief that keeps whole-file rewrites on `write`, and quote the live anchor width through `{{HASH_LEN}}` in the English and Chinese prompt sets.
|
|
100
|
+
|
|
101
|
+
## [0.3.7] - 2026-11-09
|
|
102
|
+
|
|
103
|
+
### Bug Fixes
|
|
104
|
+
|
|
105
|
+
* **prompts:** steer `apply_patch` toward served `HASH│` identity hunks (`@@<anchor>`) and treat text-matched fragment hunks as the fallback for unserved targets, in both the English and Chinese prompt sets.
|
|
106
|
+
|
|
107
|
+
## [0.3.6] - 2026-11-09
|
|
108
|
+
|
|
109
|
+
### Bug Fixes
|
|
110
|
+
|
|
111
|
+
* **dsh:** stop hiding the host's built-in `write` tool; `edit`/`str_replace_editor` and any preset `apply_patch` remain hidden.
|
|
112
|
+
* **dsh:** re-install the built-in `write` hook whenever `read` or `apply_patch` is enabled, so a served `HASH│` echo is refused, fresh anchors follow a successful write, and the post-write `fs/observed` publication keeps the host's read-before-write guard satisfied.
|
|
113
|
+
|
|
114
|
+
## [0.3.5] - 2026-11-08
|
|
115
|
+
|
|
116
|
+
### Bug Fixes
|
|
117
|
+
|
|
118
|
+
* **dsh:** register `read`, `apply_patch` and `undo_last_edit` through the standard root `ctx.tools.register()` path in addition to the per-agent shadow registration, and expose the corresponding root guidance sections so the installed plugin appears in the prompt UI. Root registration follows the shipped `tool-pwsh` plugin pattern; the per-agent registrations still own native-tool shadowing and live switches.
|
|
119
|
+
|
|
120
|
+
## [0.2.0] - 2026-11-04
|
|
121
|
+
|
|
122
|
+
### Breaking Changes
|
|
123
|
+
|
|
124
|
+
* **apply_patch:** `edit` is retired. `apply_patch` is the only file-mutation entry point: Codex patch syntax plus `@@<anchor>` identity hunks, `*** Copy From`/`*** Cut From` reference hunks, and `*** Add File`/`*** Delete File`/`*** Move to` lifecycle actions in one correlated transaction and one undo record. `write` remains for whole-file rewrites.
|
|
125
|
+
* **package:** remove pi host compatibility (`index.ts`, pi-only adapters/tests/scripts and `@earendil-works/pi-*` dependencies); the package is now DSH-only, version 0.2.0, targeting DSH 0.2.2-alpha.3.
|
|
126
|
+
|
|
127
|
+
## [Unreleased]
|
|
128
|
+
|
|
129
|
+
### Features
|
|
130
|
+
|
|
131
|
+
* **dsh:** hide the native `write` tool as well as `edit`/`str_replace_editor`, and deny a native `apply_patch` in the inherited/preset layer, so the plugin's `apply_patch` is the only file-mutation entry point in every profile; whole-file replacement is one `*** Update File:` identity hunk spanning every served line.
|
|
132
|
+
* **package:** declare `@deepseek-ai/cordis`, `@deepseek-ai/dsh-agent`, `@deepseek-ai/dsh-fs`, `@deepseek-ai/dsh-home-paths`, `@deepseek-ai/dsh-sandbox` and `@deepseek-ai/dsh-tools` as peer dependencies (mirrored in devDependencies) at DSH `0.2.2-rc.1`, so a linked checkout shares the running installation's package instances instead of its own devDependency copies.
|
|
133
|
+
* **edit:** one call may edit several files — an item may name its own `file`, falling back to the call's top-level file. The whole call commits through the correlated transaction skeleton (pre-mirror, undo rows, ordered renames, full rollback, per-file store commits, one response), and `runCutTransaction` now uses the same skeleton. ([ADR-0017](docs/adr/0017-multi-file-edit-item-level-file.md))
|
|
134
|
+
* **dsh:** serve built-in `grep` results as anchored rows: matches are grouped per file, byte-verified against disk, and served through the read seam so a following `edit` needs no `read`; a result over 250 matches or 12,500 inline tokens, or a failed/forged/non-ascending one, passes through untouched with zero leases. ([ADR-0016](docs/adr/0016-grep-view-served-anchored-rows.md))
|
|
135
|
+
* **read:** raise the read-expansion trigger from 24 to 61 lines after the measured refused-read distribution (median 61), and add Java and Vue top-level block boundaries (pinned tree-sitter wasm, lazy fetch with SHA-256 verification); Bash keeps the existing `unbash` parser and malformed Vue SFCs never widen. SQL was evaluated and not adopted. ([ADR-0015](docs/adr/0015-read-expansion-trigger-61-lines.md))
|
|
136
|
+
* **dsh:** read, edit and undo declare `presentCall`/`presentResult`/`output.presentationMeta` for host-local card consumers, and guidance overrides re-resolve through an `(mtime, size)` cache so an edit reaches the model without a restart.
|
|
137
|
+
* **dsh:** a global `tools/execute` metrics observer records every host tool call (including built-in `write`, `pwsh` and `grep`) under its own name, and each event carries its 1-based retry-chain `attempt`; the pre-change baseline is `dsh/metrics/pre-w1-observed-baseline.json`.
|
|
138
|
+
* **dsh:** read and write UTF-8 only — non-UTF-8 files are refused with their path and an ask-the-user instruction, and the multi-encoding governance (encoding bridge, `read({ encoding })`, auto-guess/Top-3 preview, save re-encode, `iconv-lite`) is removed. ([ADR-0014](docs/adr/0014-utf8-only-remove-multi-encoding-governance.md))
|
|
139
|
+
|
|
140
|
+
### Bug Fixes
|
|
141
|
+
|
|
142
|
+
* **dsh:** publish `fs/observed` after successful plugin reads, edits, undos, shell views and built-in writes, and dispatch `fs/write-intent` before plugin mutations, so the host's read-before-write guard lets a built-in `write` replace a file this plugin served; both paths are fail-open. ([ADR-0018](docs/adr/0018-host-fs-observed-publication.md))
|
|
143
|
+
* **dsh:** render a range-family rejection's current-row evidence exactly once (headline plus one `Current range (fresh read):` block); a single-line anchor pair is listed once and the distinct-anchor lists de-duplicate.
|
|
144
|
+
|
|
145
|
+
### Documentation
|
|
146
|
+
|
|
147
|
+
* **dsh:** record ADR-0014 (UTF-8 only), ADR-0015 (61-line trigger), ADR-0016 (grep view), ADR-0017 (multi-file edit) and ADR-0018 (`fs/observed` publication), and sync `README.md`, `dsh/README.md`, `GLOSSARY.md`, ADR-0003/0008/0009/0012 and the error-and-warning contract with the code.
|
|
148
|
+
## [0.1.1] - 2026-11-03
|
|
149
|
+
|
|
150
|
+
### Fixes
|
|
151
|
+
|
|
152
|
+
* **dsh:** extend the shell view to the `Select-Object -Skip N -First M` window (either flag order, clamped at EOF) and prefix every served view with the shared `[Bash view: …]` page header, so paged file views become editable and keep the line positions the raw output used to name; `$var` paths now refuse at parse instead of after a doomed file read, and `-Last` refuses pairing. ([ADR-0011](docs/adr/0011-shell-view-pwsh-alignment-value-rewrite.md))
|
|
153
|
+
|
|
154
|
+
## [0.1.0] - 2026-11-03
|
|
155
|
+
|
|
156
|
+
### Features
|
|
157
|
+
|
|
158
|
+
* **dsh:** add the dsh host layer as a separate `dsh/` tree over the upstream `pi-better-edit` semantic source, with upstream-as-base history, a cursor-based sync recorded in `dsh/UPSTREAM.md`, and a Windows-only `pnpm test:win` gate. The layer registers `read`, `edit`, and `undo_last_edit` on each agent's own scope, shadows the preset's built-in read/edit for that agent, and keeps the built-in write integration in the host write hook. ([ADR-0009](docs/adr/0009-dsh-host-layer-separate-tree-over-upstream.md), [ADR-0010](docs/adr/0010-one-served-key-agent-id.md))
|
|
159
|
+
* **dsh:** add one served key, `agent.id`, across read, edit, undo, and the shell hook, so anchors served by any surface remain resolvable by the next edit; a missing agent fails at the boundary instead of minting a key that would produce a misleading never-served rejection. ([ADR-0010](docs/adr/0010-one-served-key-agent-id.md))
|
|
160
|
+
* **dsh:** intercept whitelisted `pwsh` file views in `tools/post-execute` and rewrite only the canonical value's stdout text into anchored `HASH│content` rows served through the read seam. `Get-Content`/`type`/`cat`, optional `Select-Object -First`/`-Last`/`-Skip`, `Select-String`, and single-file `rg` are covered; truncated, ambiguous, non-whitelisted, failed, or unreadable views pass through untouched. ([ADR-0011](docs/adr/0011-shell-view-pwsh-alignment-value-rewrite.md))
|
|
161
|
+
* **dsh:** add host encoding governance for reads and saves: explicit reopen-with-encoding, BOM/UTF-8 detection, optional auto-guess with a Top-3 preview, recorded encoding/BOM/line-ending state, and re-encoding on save; missing or stale state suppresses the bridge instead of guessing.
|
|
162
|
+
* **dsh:** add the read-only `CoreReadIo` bridge: an optional port threaded through detection, the loader, `prepareFile`, validation, and the byte-read helper; range reads keep detection streaming; local `node:fs` and `ctx.fs` adapters; and an identity-less backend skips ADR-0043 stat adoption and falls back to content hashing. Edit and undo remain local-only and fail closed with `E_NOT_FOUND` for targets the local IO cannot reach. ([ADR-0012](docs/adr/0012-read-only-core-read-io-bridge.md))
|
|
163
|
+
* **dsh:** add optional JSONL tool-call metrics gated by `DSH_HASHLINE_METRICS`: one event per tool call with timing, result, path, code, line and character counts; no sink, timer, or allocation when the variable is unset, and a failed write disables the sink without failing the tool call. ([ADR-0013](docs/adr/0013-optional-jsonl-tool-call-metrics.md))
|
|
164
|
+
|
|
165
|
+
### Known Limitations
|
|
166
|
+
|
|
167
|
+
* The `CoreReadIo` bridge covers reads only. `writeAtomic`, the mutation engine, undo, and the `node:sqlite` hash/snapshot stores stay local; remote-only `edit`/`undo_last_edit` calls refuse with `E_NOT_FOUND`. Target-keyed store identity and versioned remote writes are M6 work.
|
|
168
|
+
* Encoding-governed decode and normalized-text materialization still use bounded whole-file reads; the read-expansion grammar cache remains host-local even though its `readTextFile` seam is bridge-backed.
|
|
169
|
+
* The shell view is a whitelist of provably pure, single-file views; arbitrary shell output, display transforms, truncation, and ambiguous duplicate alignment pass through raw.
|
|
170
|
+
* Windows is the only supported target; the upstream cursor and the Windows adaptation patch table are maintained in `dsh/UPSTREAM.md`.
|
|
171
|
+
|
|
172
|
+
## [2.16.0] - 2026-11-01
|
|
173
|
+
|
|
174
|
+
### Features
|
|
175
|
+
|
|
176
|
+
* **store-janitor:** report the janitor's maintenance pass to the operator: one info line for removed rows and reclaimed space, an info note when a busy store defers the compaction, and a warning — files untouched, plus the diagnostics log path — when compaction fails or the store is damaged and rebuilt. The notice prints on `session_start`, is log-only on `session_shutdown`, and every janitor console write now routes through that one per-event surface. (#197) (#198) (#199) (#200)
|
|
177
|
+
* **read:** widen a small read to the block that encloses it — function, method, class, heading section, paragraph or shell function — through one boundary seam. Windows fold before the 24-line trigger, and each block is capped at 80 lines of code or Markdown and 40 of plain text. A widened read names what it served in `[widened <requested> -> <served>, <label>]`; oversized code and plain-text blocks refuse silently, while an oversized Markdown section clamps and reports its extent. (#202) (#207) (#208) (#212) (#215)
|
|
178
|
+
* **read:** keep leading decoration with its item: TypeScript JSDoc and decorators, Python decorators, Go doc comments and stacked Rust attributes. Methods widen to the method rather than its class, impl or trait, and nested blocks widen to the enclosing function. (#209) (#210) (#211) (#215)
|
|
179
|
+
* **read:** add document units: a Markdown probe serves its heading section and treats `#` inside fences as content, a plain-text probe serves its paragraph, and line-oriented data extensions never expand. (#203) (#215)
|
|
180
|
+
* **read:** fetch grammars lazily. No grammar ships in the package; the first supported-language expansion fetches one into the state root, verifies its committed SHA-256 and caches it. Offline, digest-mismatch and unloadable paths serve the exact window with no model-visible error. (#204) (#215)
|
|
181
|
+
* **read:** add `read.expansion`, resolved through the same ladder as `bash.view`, and an optional qualified-name seam that consults only an already-attached language server and never starts one. Applied and refused expansions append to `read-expansion.log`, whose first entry of a session carries the resolved rung. (#213) (#206) (#215)
|
|
182
|
+
* **read:** make the wasm host optional: `web-tree-sitter` is an optional dependency loaded by dynamic import, so the extension still loads when the package is absent. Grammar-backed reads then serve the exact window with no note and no fetch; Markdown, plain text and bash expansion keep working, and `read-expansion.log` records one `runtime_absent` refusal per session. (#216)
|
|
183
|
+
* **read:** name each expansion refusal: `no_provider`, `boundary_crossing`, `over_cap` with its block size, `grammar_unavailable`, `cold_grammar`, `runtime_absent`, and one `toggle_off` per session, alongside the existing trigger and bounds reasons. `session_start` pre-warms grammars for the workspace's top-level extensions; a read that cannot finish a fetch inside its 250 ms budget serves the exact window as `cold_grammar`, and the shared fetch lets the next read widen. (#218)
|
|
184
|
+
* **read:** close the widened-note vocabulary to one `SpanKind` union: the 26 lowercase LSP 3.17 `SymbolKind` names plus the five documented extensions `arrow`, `impl`, `trait`, `section`, and `paragraph`. Every language ships a grammar-node-type data table beside its provider, and an unmatched node now declines instead of printing its raw type. Rust impl and trait headers widen as `impl`/`trait`, never LSP `Object`, and the optional resolver still replaces only the name. (#219)
|
|
185
|
+
* **read:** restore type aliases as the sixth extension, `typeAlias`: TypeScript `type_alias_declaration`, Go type declarations and Rust `type_item` widen again with that label. `PRODUCED_KINDS` now pins the exact kinds any current provider can emit, alongside the protocol-membership pin; `enumMember` and `typeParameter` render as `enum member` and `type parameter`, while the audit keeps their union spelling. (#220)
|
|
186
|
+
* **tooling:** add `pnpm run replay:read-expansion`, which reports per-language same-file re-read share and served-line waste from two session corpora, accepting a language at 200 or more reads with a 20% relative fall. (#205) (#215)
|
|
187
|
+
* **prompts:** replace the retired claims about symbol and heading widening with this tool's own terms: the trigger, the caps, the Markdown clamp extent and the widened-note chrome. An architecture test pins them. (#215)
|
|
188
|
+
|
|
189
|
+
## [2.15.0] - 2026-10-31
|
|
190
|
+
|
|
191
|
+
### Features
|
|
192
|
+
|
|
193
|
+
* **config:** relocate user-level settings and all persistent state out of `~/.config/pi-better-edit`: global settings move to `${PI_CODING_AGENT_DIR:-~/.pi/agent}/extensions/pi-better-edit/settings.json`, the project file to `<cwd>/.pi/agents/pi-better-edit/settings.json`, and the store, the pre-SQLite `hash-store.json` and `diagnostics.log`/`.1` to `${XDG_STATE_HOME:-~/.local/state}/pi-better-edit/`. `XDG_CONFIG_HOME` leaves resolution, a relative `XDG_STATE_HOME` counts as unset, and an unusable state root fails store-dependent calls closed with `[E_ACCESS]` instead of forking a fallback. (ADR-0050) (#190) (#191)
|
|
194
|
+
* **config:** adopt user settings from the retired locations once, in the order new file → `<PI_BETTER_EDIT_CONFIG_DIR>/pi-better-edit.json` (only when that variable is set) → `$XDG_CONFIG_HOME/pi-better-edit/pi-better-edit.json` → `~/.config/pi-better-edit/pi-better-edit.json` → `~/.pi/agents/pi-better-edit.json` (project: new file → the flat `.pi/agents/pi-better-edit.json`): the bytes are written through the atomic writer, verified by parse, and only then is every retired source renamed `.bak`. A failed adoption still serves the keys it read, project adoption is skipped — without a warning — when the tree is unwritable, and `.bak` files are never warned about or deleted. `XDG_CONFIG_HOME` is read only to find those retired sources. (ADR-0050) (#190) (#191)
|
|
195
|
+
* **config:** start the store fresh under the new state root: the old `hash-store.sqlite` is left untouched and its path logged once per session, because an un-restarted older session may own it, while `hash-store.json` and the diagnostics logs move in and `.corrupt-*` dumps are deleted. Retired roots are searched in one order — the override, `$XDG_CONFIG_HOME/pi-better-edit`, `~/.config/pi-better-edit` — and a failed move withholds the `.migration-v1` marker so the next session retries. `PI_BETTER_EDIT_CONFIG_DIR` keeps its verbatim meaning, remains the only thing that can move the store, and now owns `<override>/settings.json` and `<override>/state/`. (ADR-0050) (#190) (#191)
|
|
196
|
+
|
|
197
|
+
### Bug Fixes
|
|
198
|
+
|
|
199
|
+
* **config:** carry an override or `XDG_CONFIG_HOME` user's settings and state across the relocation instead of abandoning them: the retired-source lists become one ordered set (override root, XDG config root, `~/.config`), so `<override>/pi-better-edit.json` is adopted into `<override>/settings.json` and `<override>/hash-store.json` plus the logs move into `<override>/state/`. A `rename` across filesystems now copies and unlinks instead of losing the move, the migration marker is written only when no move failed, and project adoption skips an unwritable tree before attempting the write. (ADR-0050) (#190) (#191)
|
|
200
|
+
|
|
201
|
+
### Documentation
|
|
202
|
+
|
|
203
|
+
* **adr:** compact architecture decision records into a canonical 7-record suite (ADR-0001 through ADR-0007), archive historical records ADR-0001–0050 to `docs/.archive_adrs/`, and align glossary, agents, and readme documentation with active architecture. (#196)
|
|
204
|
+
* **adr:** land ADR-0050 recording the split of settings (pi agent dir) from state (XDG state dir), the verbatim override that now owns `<override>/state` and is still the only mover of the store, the fresh-store policy with the abandoned-store log, the artifact move/delete table, the settings adoption precedence with `.bak` retirement, the `[E_ACCESS]` fail-fast and the MINOR classification; point ADR-0037's store-directory paragraph at it rather than rewriting the record, and update the README, the schema prose and the MVCC spec's path mention. Docs only; the behaviour ships in the `config` entry above. (#190) (#191)
|
|
205
|
+
|
|
206
|
+
## [2.14.0] - 2026-10-28
|
|
207
|
+
|
|
208
|
+
### Features
|
|
209
|
+
|
|
210
|
+
* **bash:** admit an inert `wc -l`/`-c` count tail after the last verified block of a multi-block, statically glued compound (ADR-0048 D4): the verified blocks keep their banners, anchors and per-block leases, and the count's already-observed bytes ride through raw and unleased. Only `wc` with `-l`/`-c` and file operands qualifies; a tail before any block or before a later block, stdin, a redirect, a pipeline, another command, a glued single-block chain, and any post-block `cd` still decline with their original reasons, and D10's single-leading-block behaviour is unchanged. (#185) (#186)
|
|
211
|
+
* **bash:** serve context searches (ADR-0048 D3): admit `grep -A/-B/-C`, long context flags, and `rg -C` on single-file searches; match and context rows around `--` are re-read, byte-compared, and leased under the existing key. `SEARCH_MAX_TOTAL_ROWS` bounds total rows independently; recursive/multi-file context, attached short spellings, mixed options, and `-c`/`-o`/`-l` stay refused. (#183) (#188)
|
|
212
|
+
* **bash:** serve multi-file views (ADR-0049): admit `cat`, `cat -n`, `nl -ba`, and numeric `sed -n` over two or more newline-terminated files as per-file page sections; line-count boundaries, per-file leases, zero-row pages only inside a served result, and whole-command raw on any failed proof. Configurable `bash.multiFile.maxFiles` / `maxRows` (defaults 10 / 2,000) via `/pi-better-edit bash-view multi-file`. (#183) (#188)
|
|
213
|
+
* **bash:** serve terminal display tails (ADR-0048 D2): `cat -A`, `cat -vet`, `od -c`, `xxd`, and `hexdump -C` over raw-slice views are proved by re-running the transform on a temporary copy of the exact re-read slice, then serving the raw anchored rows with a disclosure. Transform bytes are never served or leased; unsupported heads, missing transforms, lone-CR files, and over-cap output pass through raw. (#176) (#189)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
### Documentation
|
|
217
|
+
|
|
218
|
+
* **adr:** land the bash serve admission record as ADR-0048 with an explicit accepted/deferred split (D1 accepted and implemented by #175, PR #177; D2 tracked by #176; D3/D4/D5 tracked by #183) together with its corpus analysis, and retarget the #175 serve-seam comments to cite ADR-0048. Comments and docs only; no behavior change. (#178)
|
|
219
|
+
* **adr:** record ADR-0048 D4 as accepted and implemented by #185 instead of deferred, extending the D1 amendment note and splitting the tracking bullet so #183 covers D3/D5 only. Docs only; the behaviour itself ships in the #185 feature entry above. (#185)
|
|
220
|
+
* **adr:** propose ADR-0049 for multi-file bash views: per-file page sections, line-count boundaries, zero-row pages, cross-file `sed` ranges, configurable 10/2,000 caps, and a real-workload evidence gate; implementation remains deferred. (#183)
|
|
221
|
+
* **adr:** record ADR-0048 D3 as accepted and implemented by #183 instead of deferred, adding the amendment note, the tracking split, and an "As implemented" paragraph that pins the admitted spellings, the leased-context geometry, the independent total-row cap and the compound boundary. Docs only; the behaviour itself ships in the #183 feature entry above. (#183)
|
|
222
|
+
* **adr:** accept ADR-0049 and record the M7 evidence gate as met, with the captured real-workload shapes, the limitation that only plain `cat` over 2+ files is attested, the twelve-fixture matrix, the implementation notes (numbering conventions, zero-row page literal, stream-leading BOM, no compound envelope, caps as policy); mark ADR-0048 D5 as landed through ADR-0049. Docs only; the behaviour ships in the #183 feature entry above. (#183)
|
|
223
|
+
|
|
224
|
+
## [2.13.4] - 2026-10-24
|
|
225
|
+
|
|
226
|
+
### Bug Fixes
|
|
227
|
+
|
|
228
|
+
* **bash:** refuse ambiguous `FILE:LINE:content` splits and non-monotone search rows at the serve seam, so every served row is byte-verified and its interval is ordered; add a real-binary attribution property suite. (#175) (#177)
|
|
229
|
+
* **prompts:** state what the tools actually do: bash-view and auto-read rows count as served, `[W_*]` is informational and `[E_*]` retries, `cut` removes the source span, undo names its scope and `E_UNDO_STALE` invariant, and a `-` diff row is not served. Read's description drops 2494 → 1377 chars; the guidelines become plain procedural English with glossary terms. The `mode: "literal"` escape stays refusal-only per ADR-0021, now pinned by a test. (#179) (#180)
|
|
230
|
+
* **errors:** replace the never-rendered per-code `remedy` with a refusal-scoped `Options:` list on the three codes whose evidence admits two neutral moves (`E_SUSPICIOUS_TEXT`, `E_BATCH_ABORT`, `E_UNDO_UNAVAILABLE`); every other rejection states facts only. `E_SUSPICIOUS_TEXT` branches `text`/`content`, discloses `mode: "literal"` once, and counts one submission as `1 time`. Fact-only producer messages, foreign-reference headlines and batch trailers lose their embedded imperatives; a wrapped item's options are indented under its bullet. (ADR-0047) (#181)
|
|
231
|
+
|
|
232
|
+
## [2.13.3] - 2026-10-22
|
|
233
|
+
|
|
234
|
+
### Features
|
|
235
|
+
|
|
236
|
+
* **store:** adopt an unchanged file from its `stat(2)` identity instead of re-deriving every line: stamp `ino:size:mtimeMs:ctimeMs` on the materialized snapshot and resolve only the kept page's lineage, verifying each served line against its committed canon hash. Any mismatch falls back to the content-hash path; touch, atomic rename, and same-size/same-mtime rewrites are covered. (store version 11, ADR-0043) (#166)
|
|
237
|
+
* **hashline:** pair a one-region change without scanning the unchanged boundary: zip the prefix/suffix whose canon is globally unique on both sides, then run patience pairing only on the changed middle. Duplicated or mismatched boundaries fall back to the full scan; untouched lines keep their anchors. (ADR-0044) (#166)
|
|
238
|
+
* **store:** end a served lease's authority at the 7-day TTL (hard expiry, ADR-0045): an un-retired lease older than `SERVED_TTL_MS` no longer resolves, and the janitor deletes expired active leases in bounded off-path batches. Resolution and vacuum share one expiry predicate; a lease exactly at the TTL still resolves, while retirement keeps its own 1-hour grace. Anchors older than the TTL fail closed and need a fresh read. (#166)
|
|
239
|
+
* **store:** reclaim the file space lease GC frees: run one gated `VACUUM` after a maintenance sweep (ADR-0046), only when free pages are at least a quarter of the file and at least 1 MB, and only on lifecycle events. A contended rewrite waits briefly and defers with a reason; the outcome reports reclaimed bytes and failures never escape the hook. (#166)
|
|
240
|
+
|
|
241
|
+
### Bug Fixes
|
|
242
|
+
|
|
243
|
+
* **store:** keep cache-hit reads off the LRU vacuum's store-wide pin scan by running retention only when a materialization inserts a fresh snapshot; add the covering `(file_path, served_snapshot_hash)` lease index (store version 10) so a fresh commit's sweep stays cheap on a large lease table. (#166)
|
|
244
|
+
|
|
245
|
+
### Code Refactoring
|
|
246
|
+
|
|
247
|
+
* **architecture:** reorganize internal module seams with no behavior change: delete the hashline barrel and retarget its importers, move serve rendering into served-session, fold the hash facade into snapshot-store/snapshot-io, move read admission into file-content/admission, sever the ambient IO fallback, and move store open/busy/janitor policy into store-kernel. (#167)
|
|
248
|
+
* **read:** make the page header the only chrome: it states the file's total line count, the shown range, and — for a byte-truncated page — the budget it stopped at. Remove the pagination footer and unify auto-read, bash-view, search and file-list banners into the same bracket grammar; `verbatim` is the sole mode marker. (#173)
|
|
249
|
+
|
|
250
|
+
## [2.13.2] - 2026-10-21
|
|
251
|
+
|
|
252
|
+
### Features
|
|
253
|
+
|
|
254
|
+
* **diagnostics:** internal failures are recorded in `<configDir>/diagnostics.log` (JSONL, 1 MiB cap with one rotated generation) instead of being written to the terminal Pi's renderer owns; `/pi-better-edit` reports the log path, size and last write. (#164)
|
|
255
|
+
* **config:** the global settings file moves from `~/.pi/agents/pi-better-edit.json` to `<configDir>/pi-better-edit.json`; a file left at the retired location is adopted on first read, written to the new path and renamed `.bak`. (#164)
|
|
256
|
+
|
|
257
|
+
### Bug Fixes
|
|
258
|
+
|
|
259
|
+
* **bash-view:** a `&&` chain whose operand is a compound statement (`for`, `if`, `while`, `time`, `{ …; }`, `( … )`, `case`, a function definition, `[[ … ]]`) no longer crashes the conversion; the chain fails closed and the raw output passes through. (#164)
|
|
260
|
+
|
|
261
|
+
## [2.13.1] - 2026-10-19
|
|
262
|
+
|
|
263
|
+
### Bug Fixes
|
|
264
|
+
* **read:** keep multi-window TUI call titles within their render width, preserve stable cached output across repeated renders, and retain builtin component reuse and invalidation instead of falling back after a `setText` error. Narrow titles truncate the count rather than overflowing. (#158)
|
|
265
|
+
|
|
266
|
+
## [2.13.0] - 2026-10-18
|
|
267
|
+
|
|
268
|
+
### Features
|
|
269
|
+
* **bash-view:** admit the Tier-3 interception surface (#82): `grep`/`rg` as downstream filter stages (`cat f | grep -v x`) and an unnumbered search source translated into a `keep` filter, multi-file `grep`/`rg PATTERN FILE...` served as per-file `FILE:LINE:content` sections, `grep -r`/`rg` directory walks that never descend into hidden or `node_modules` directories, an anchorless existence-checked `rg --files` list, and the `sort -u`/`uniq`/`wc -l` line-set consumers. Every bound fails closed to raw output with zero leases, and numbered sources and views still compose with nothing downstream. (#82) (#121)
|
|
270
|
+
* **bash-view:** admit Tier-2 view spellings to interception: explicit `-e` search patterns (separate, attached, cluster-close; exactly once), multi-range `sed -n -e RANGEp` merged at parse, and numbered `cat -n` / `nl -ba` sharing one full-file renderer. Malformed shapes fail closed to raw bash. (#82) (#120)
|
|
271
|
+
* **bash-view:** give `sed`/`cat`/`head`/`tail` views the same bracketed file banner the search and filter pipelines already use — `[<path> (lines X-Y of Z)]` for a slice and `[<path> (N lines)]` for a whole file — in place of the `<read>` tool's `=== Lines X-Y of Z ===` section header, which the read tool keeps. (#134) (#136)
|
|
272
|
+
* **bash-view:** admit a numbered `grep`/`rg` search piped into `head`/`tail` as a search with the slice applied to the resolved matches — only surviving rows are leased, rendered and counted under their original file line numbers, and a slice that removes every row declines. (#135) (#138)
|
|
273
|
+
* **bash-view:** intercept multi-statement compounds that combine literal banner prints with admitted views or searches — each segment's expected bytes are verified left to right against re-read disk, verified blocks anchor with leases for survivors only, and the peel halts with the verified prefix plus raw remainder at the first mismatch. (#135) (#138)
|
|
274
|
+
* **read:** the payload collapses to one canonical shape — the schema accepts only `{ files: [{ file, windows?, mode? }], mode? }`, the admission fold and its `legacyPage` support structure are deleted, and the repo's own call sites are migrated. Legacy-only payloads are rejected with the same error a file-less call gets; recorded transcripts still render via the projection fallback. Single-window reads using the preferred `files` shape now carry the §4.4 continuation footer they previously lacked. (#142) (#145)
|
|
275
|
+
* **read:** the payload is one flat target — the schema accepts `{ file, windows?, mode? }`, one file per call with parallel calls for fan-out; the outer `files` array, per-file `mode`, and the multi-file caps are deleted, and the repo's own call sites are migrated. Retired shapes are rejected; recorded transcripts still render via the projection fallback, single-window reads keep their §4.4 page chrome, and multi-window calls show `(N windows)`. (#147) (#148)
|
|
276
|
+
* **bash:** admit a compound with a single leading view/search block and an inert `wc` tail — no glue required (relaxation A, ADR-0039 D10): the block renders with its standard banner and anchors, then the tail’s raw bytes. Second blocks, non-first blocks, post-view/post-block `cd`s, and unsafe tails still decline with their original reasons. (#152) (#156)
|
|
277
|
+
|
|
278
|
+
### Bug Fixes
|
|
279
|
+
* **lifecycle:** the bash conversion chain is now data — an ordered `RULES` table with one `decide` walk owns precedence, and a single `renderDecision` routes by `decision.kind`. No behavior change. (#151) (#155)
|
|
280
|
+
* **lifecycle:** the four bash banners live behind one `bashBanner(kind)` builder — the frozen text is byte-identical, only the definition site moved. (#150) (#154)
|
|
281
|
+
* **read:** the served file header names the shown range a single windowed read actually rendered — `[f (lines a-b of N)]`, matching the bash view — while whole-file and multi-window reads keep the bare total. (#149) (#153)
|
|
282
|
+
* **errors:** drop the "Pass a plain file string and retry." tail from the three `fs-write` null-byte invariants: they raise `E_INTERNAL_INVARIANT`, which carries no remedy, so its message states the fact alone. The arch oracle now also reads the messages real producers pass — the code set derived from the registry's remedy-free entries — so a planted tail at any site fails the suite. It had checked only each code's declared format against its own example payload, which is how the tails survived #93. (#125) (#129)
|
|
283
|
+
* **store:** quarantine and rebuild the hash store on the first statement that fails with a corruption error, instead of leaving the damage for the next open or janitor run. The guarded handle rethrows the original error, so callers still fail loud. (#100)
|
|
284
|
+
* **read:** the TUI call line again shows the target file and line range for the canonical multi-file payload: one projection derives the display path (first target) and range (single file, single offset/limit window) for both renderers, while legacy shapes render exactly as before. (#141) (#144)
|
|
285
|
+
|
|
286
|
+
### Code Refactoring
|
|
287
|
+
* **config:** re-home the three config setters' enum guards off `E_BAD_PAYLOAD` onto the remedy-free `E_INTERNAL_INVARIANT`, since a typed slash command cannot reach them: every handler narrows its tokens and the overlay offers only enum choices. Their messages state the fact and name the offending value with no retry tail, and the command handler no longer renders a DomainError's `[MODEL] [E_…]` envelope into the user channel — the envelope goes to the log while the user sees a plain failure notice. (#94) (#126)
|
|
288
|
+
|
|
289
|
+
## [2.12.0] - 2026-10-13
|
|
290
|
+
|
|
291
|
+
### Features
|
|
292
|
+
* **store:** render the store's own section in `/pi-better-edit lens status` with configuration ladder provenance (`default` | `global` | `project` | `env`) and resolved path. The settings resolve through `resolveStoreJanitorSettingsWithSources` per key, while `isHealthy` and `shutdownDb` retain their explicit health check and checkpoint boundaries. (#90) (#103)
|
|
293
|
+
* **store:** run the store janitor on non-hot-path lifecycle events (`session_start`, `session_shutdown`) with batched deletes and deep quick_check recovery. Foreign generation and expired rows are purged in statements bounded by `store.janitorBatchSize` under the throttled `janitor_at` timestamp. (#90) (#103)
|
|
294
|
+
* **store:** resolve janitor settings from `.pi/agents/pi-better-edit.json` via a unified configuration ladder. Extracted `src/json-config.ts` handles atomic reads and writes across both lens bridge and store janitor settings, falling back safely to defaults on warnings. (#90) (#103)
|
|
295
|
+
* **bash-view:** admit the five Tier-1 `grep`/`rg` flag shapes (`-w`/`--word-regexp`, `-x`/`--line-regexp`, `-m N`, bundled clusters, and trailing flags) to intercepted search (#82). Flags before `--` are honoured while malformed counts or unsupported options fail closed to raw bash. (#83)
|
|
296
|
+
* **read:** recover PNG/JPG image reads by delegating to the builtin read tool (PR #52). A lone image returns the builtin's image block; a multi-file call with an image aggregates the blocks into `content` in request order while text targets keep the served and anchor path. Image bytes never enter served, hash, snapshot, or lease state. (#52) (#114)
|
|
297
|
+
* **bash-view:** gate interception behind a default-on `bash.view` option in `.pi/agents/pi-better-edit.json`, resolved per key through `PI_BETTER_EDIT_BASH_VIEW` over project file over global file with rung-source reporting. `/pi-better-edit bash-view [on|off|status] [project|global]` (alias `bash`) writes the switch with a five-option picker or the combined status; effective `off` passes views and searches through raw, and the first interception of each session warns once with the off-ramp. (#115) (#116)
|
|
298
|
+
* **pi-lens:** review every setting in one headed overlay: bare `/pi-better-edit` or the `settings` token opens target scope, lens bridge, bash view and store janitor rows with effective-source diagnostics, while headless hosts keep the combined status text. The scope switch steers later saves without persisting; each row saves through its matching saver and refreshes. (#117) (#118)
|
|
299
|
+
|
|
300
|
+
### Tests
|
|
301
|
+
* **harness:** harden the vitest harness against host-load timer lateness (#84) — a new `vitest.config.ts` raises `testTimeout` to 20s and `hookTimeout` to 30s, because the observed failures are a 5526ms test body against the 5000ms default and ~14s module-level `beforeAll(initHasher())` hooks against the 10000ms hook default; this is the lever the measurements support, since `isolate: false` fails 19 tests, `maxWorkers: 4` costs +33s wall without removing the failure mode, and `initHasher()` is already a module-level singleton with nothing to hoist. (#88)
|
|
302
|
+
* **harness:** isolate the hash store from the developer's real one using a per-worker temp directory under `PI_BETTER_EDIT_CONFIG_DIR`. Tests no longer touch `$HOME/.config` or race concurrent live sessions, with explicit opt-out support for fixed-path fixtures. (#89) (#92)
|
|
303
|
+
* **store:** assert the contention episode's structure instead of an exact attempt count (#87b). Added an optional `now` clock parameter to `BusyBudget` to evaluate deadline exhaustion deterministically without host load interference. (#96)
|
|
304
|
+
|
|
305
|
+
### Bug Fixes
|
|
306
|
+
* **errors:** attribute `E_BAD_PAYLOAD` to the registered tool that raised it (`read`, `edit`, `undo_last_edit`) via a typed `subject` field and `withPayloadSubject` helper (#86). Refusals without a stamped tool fall back to neutral phrasing. (#95)
|
|
307
|
+
* **store:** budget hash store lock contention explicitly with 250ms internal wait and 8 retry attempts with jittered exponential backoff (#87). Wall-clock deadlines bound contention episodes to 4300ms without waking contending processes in lockstep. (#96)
|
|
308
|
+
* **store:** gate store open on a two-part stamp (`PRAGMA user_version` and metadata table stamp) so healthy opens avoid write locks (#87). The generation sweep and version updates run only when store provenance changes. (#99)
|
|
309
|
+
* **store:** defer open stamp write to the open's final step so it certifies all registered lifecycle hooks (#87). Stamp writes are retried under the open retry budget if the store is briefly contended. (#99)
|
|
310
|
+
* **store:** check stamp-matching opens with a read-only 100-byte SQLite header smoke check rather than full `PRAGMA quick_check` (#87). Validates file magic, page size, and page count in sub-millisecond time while deferring full checks to periodic maintenance. (#101)
|
|
311
|
+
|
|
312
|
+
### Code Refactoring
|
|
313
|
+
* **read:** name the file-count cap's refusal in one constant (`MAX_READ_FILES_MESSAGE`) (#85) instead of an inline template, and pin the 10/11 boundary on both enforcement points — the registered `files`-array `maxItems` that an over-cap tool call actually hits and the admission guard that backstops a caller skipping the schema; the two wordings diverge by construction, because the runtime validates `parameters` before `execute` and builds its message from `maxItems`. (#88)
|
|
314
|
+
* **errors:** re-home tool-facing invariant guards onto a new remedy-free `E_INTERNAL_INVARIANT` code — path, snapshot-generation, unknown-fields, anchor-derivation and engine-only seams stop rendering the model-facing payload remedy; the payload keeps its optional subject and the same boundary helper stamps both codes, so model-wire `E_BAD_PAYLOAD` refusals stay byte-identical. (#93)
|
|
315
|
+
|
|
316
|
+
### Documentation
|
|
317
|
+
* **store:** record the janitor's maintenance model (#90) as [ADR-0037](docs/.archive_adrs/0037-store-janitor-lifecycle-maintenance-model.md), covering the lifecycle triggers (`session_start`, `session_shutdown`), throttle settings, batched deletes, and quarantine recovery architecture. (#103)
|
|
318
|
+
|
|
319
|
+
## [2.11.0] - 2026-10-10
|
|
320
|
+
|
|
321
|
+
### Features
|
|
322
|
+
* **edit:** declare the optional wire fields (`text`, `text_ref`, `at`, root `mode`, and `text_ref.file`) nullable so the served schema admits the `null` that admission already reads as absent, and reframe both XOR refusals as an explicit binary field choice — the flat wire contract, the required fields, and admission behaviour are unchanged. (ADR-0036) (#81)
|
|
323
|
+
* **edit:** return the anchored post-edit diff in the model-visible text — `content[0].text` is now the summary line, a blank line, then the same collapsed #174 single-projection diff, while `details.diff` stays byte-identical for TUI clients, so the summary the `tool_result` hook previously discarded and the diff the model edits against now travel together; a follow-up edit anchors on a row the previous edit modified with no intermediate `read`. (#79)
|
|
324
|
+
* **read:** disclose non-printable control characters under the verbatim rows (C0 minus tab/LF/CR, plus DEL and the C1 block) instead of escaping the bytes, so the model is warned about characters it cannot see without tokenizer-hostile escapes. (#79)
|
|
325
|
+
* **read:** serve many files and many windows in one call — `files: [{ file, windows: [{ offset, limit } | { around_anchor, radius }], mode }]` replaces the single-file shape (legacy `{ file/path, offset, limit }` and `windows: []` still fold, while the prompts publish only `files`), windows merge by interval and each file is walked once, a call carries at most 16 windows across all files and at most 10 files, every file draws on one shared `SERVED_MAX_LINES` budget, and an anchor resolves against the target file's active session lineage whether or not a sibling served rows — unknown/expired/foreign warns inline and the siblings still render, `mode: "verbatim"` renders a resolved window as plain rows and leases nothing, one failing file (or a failing mirror phase) is an inline section rather than a failed call, and each section carries its own `[path (N lines total)]` / `[path (verbatim, N lines, no anchors)]` header with a copy-pasteable `Use windows: [{ offset, limit }]` footer. (#79)
|
|
326
|
+
* **bash-view:** intercept pure `grep`/`rg` searches — a strict eight-flag allowlist (`-n|--line-number`, `-i|--ignore-case`, `-F|--fixed-strings`, `-E|--extended-regexp`) over exactly one file operand, with `-n`/`--line-number` injected before execution and before any `--` separator, serves the matched lines as `HASH│content` rows under the frozen `--- Bash search (hashline anchors) ---` header and leases exactly the matched lines, and witnesses every match against a disk re-read, so a non-zero exit, an unparsable line, a forged or stale disk line, or more than `SEARCH_MAX_MATCHES` matches all fail closed to byte-identical raw output — every other flag, pipeline, redirection, compound, glob, tilde, directory and multi-file shape passes through untouched. (#79)
|
|
327
|
+
|
|
328
|
+
### Build System
|
|
329
|
+
* **deps-dev:** import and pin knip 6.40.0 for dead code and export hygiene, and prune unused semantic-release dependencies. (#79)
|
|
330
|
+
|
|
331
|
+
## [2.10.1] - 2026-10-09
|
|
332
|
+
|
|
333
|
+
### Bug Fixes
|
|
334
|
+
* **edit:** read a null in the nested `text_ref.file` as absent and name the fields that are genuinely required, so a harness using strict structured output is no longer refused for a call it has no way to spell differently. (#77)
|
|
335
|
+
|
|
336
|
+
## [2.10.0] - 2026-10-09
|
|
337
|
+
|
|
338
|
+
### Features
|
|
339
|
+
* **pi-lens:** retire the frozen v1 bridges and mirror through the unified v2 File I/O Lifecycle Bridge — a single `io-bridge` adapter records served spans (caller content sliced per single-range span, disk evidence only when the notification carried no bytes) and file mutations (whole-file authorship as `write`) via structural `Symbol.for("pi-lens:io-bridge")` detection with no pi-lens import; mutated-file notifications precede served-span notifications so facet-split records reflect post-mutation state; the integration stays optional (only the entry point wires it, removal recipe in README) with the boundary test pinning the v2 surface. (#66)
|
|
340
|
+
|
|
341
|
+
### Code Refactoring
|
|
342
|
+
* **errors:** revise all `E_*`/`W_*` refusal texts to concise single-fact STE100 sentences with structured bullets for batch failures and overlaps, and teach `mode: "literal"` on the refusal surface — no behavior change. (#61)
|
|
343
|
+
|
|
344
|
+
### Bug Fixes
|
|
345
|
+
* **edit:** fall back to git worktree root when outside git repository. (#59)
|
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ 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` |
|
|
17
19
|
|
|
18
20
|
### Anchor width (3 or 4)
|
|
19
21
|
|
|
@@ -89,13 +91,15 @@ Served anchors are leased per session and per file. A stale, unknown, retired or
|
|
|
89
91
|
|
|
90
92
|
### Live switches and profiles
|
|
91
93
|
|
|
92
|
-
`read`, `applyPatch` and `
|
|
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)).
|
|
93
95
|
|
|
94
96
|
| Switch | Default | Effect |
|
|
95
97
|
| --- | --- | --- |
|
|
96
98
|
| `read` | `true` | Register the hash-anchored `read` tool and its shell/grep views. |
|
|
97
99
|
| `applyPatch` | `true` | Register the `apply_patch` tool. |
|
|
98
100
|
| `edit` | `false` | Register the anchored range `edit` tool. |
|
|
101
|
+
| `codegraph` | `false` (`cordis.patch.yml` ships `true`) | Register the eight `codegraph_*` graph tools and the `tool:codegraph` prompt section. |
|
|
102
|
+
| `diagnostics` | `false` (`cordis.patch.yml` ships `true`) | Register the `diagnostics` tool and the `tool:diagnostics` prompt section. |
|
|
99
103
|
|
|
100
104
|
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
105
|
|
|
@@ -110,6 +114,12 @@ config: { read: true, applyPatch: true, edit: true }
|
|
|
110
114
|
config: { read: true, applyPatch: false, edit: true }
|
|
111
115
|
```
|
|
112
116
|
|
|
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`.
|
|
118
|
+
|
|
119
|
+
| Config key | Default | Effect |
|
|
120
|
+
| --- | --- | --- |
|
|
121
|
+
| `codegraphPath` | `""` | Config key (not a switch): pin an executable outside `PATH`; empty uses the first runnable `codegraph` on `PATH`. |
|
|
122
|
+
|
|
113
123
|
### `read`
|
|
114
124
|
|
|
115
125
|
```ts
|
|
@@ -121,14 +131,16 @@ read({
|
|
|
121
131
|
| { offset: number; limit: number }
|
|
122
132
|
| { around_anchor: string; radius?: number } // radius defaults to 10
|
|
123
133
|
>,
|
|
124
|
-
mode?: "served" | "verbatim", // default "served"
|
|
134
|
+
mode?: "served" | "verbatim" | "folded", // default "served"
|
|
135
|
+
foldDepth?: number, // 1-3, default 1; only with mode: "folded"
|
|
125
136
|
})
|
|
126
137
|
```
|
|
127
138
|
|
|
128
139
|
- **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
140
|
- **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.
|
|
130
|
-
-
|
|
131
|
-
- `
|
|
141
|
+
- **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)).
|
|
142
|
+
- 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)).
|
|
143
|
+
- `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
144
|
|
|
133
145
|
### `apply_patch`
|
|
134
146
|
|
|
@@ -186,7 +198,47 @@ The anchored range writer. One call targets one file and carries one ordered `ed
|
|
|
186
198
|
}
|
|
187
199
|
```
|
|
188
200
|
|
|
189
|
-
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.
|
|
201
|
+
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).
|
|
202
|
+
|
|
203
|
+
- **`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
|
+
- **`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
|
+
|
|
206
|
+
### codegraph tools
|
|
207
|
+
|
|
208
|
+
Eight read-only tools over a repository indexed by the external `codegraph` CLI, one process per call. Three return source, five return locations only:
|
|
209
|
+
|
|
210
|
+
| Tool | CLI call | Returns |
|
|
211
|
+
| --- | --- | --- |
|
|
212
|
+
| `codegraph_explore` | `codegraph explore <query> [--max-files N] -p <project>` | source, as `HASH│content` rows |
|
|
213
|
+
| `codegraph_node` | `codegraph node [symbol] [-f file] [--offset N] [--limit N] [--symbols-only] -p <project>` | source, as `HASH│content` rows |
|
|
214
|
+
| `codegraph_context` | `codegraph context <task> [-n N] [--no-code] -p <project>` | source, as `HASH│content` rows |
|
|
215
|
+
| `codegraph_search` | `codegraph query <search> [-k kind] [-l N] -p <project>` | locations only |
|
|
216
|
+
| `codegraph_callers` | `codegraph callers <symbol> [-f file] [-l N] -p <project>` | locations only |
|
|
217
|
+
| `codegraph_callees` | `codegraph callees <symbol> [-f file] [-l N] -p <project>` | locations only |
|
|
218
|
+
| `codegraph_impact` | `codegraph impact <symbol> [-f file] [-d depth] -p <project>` | locations only |
|
|
219
|
+
| `codegraph_implementations` | `codegraph implementations <symbol> [-f file] [-d depth] -p <project>` | locations only |
|
|
220
|
+
|
|
221
|
+
- **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.
|
|
222
|
+
- **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.
|
|
223
|
+
- **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.
|
|
224
|
+
- **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`.
|
|
225
|
+
|
|
226
|
+
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).
|
|
227
|
+
|
|
228
|
+
### diagnostics
|
|
229
|
+
|
|
230
|
+
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.
|
|
231
|
+
|
|
232
|
+
| Parameter | Type | Effect |
|
|
233
|
+
| --- | --- | --- |
|
|
234
|
+
| `tool` | required; `"cargo-check"` \| `"cargo-clippy"` \| `"tsc"` | Which toolchain to run. Any other value is a hard argument error. |
|
|
235
|
+
| `cwd` | `string` | Project directory; defaults to the session working directory. |
|
|
236
|
+
| `contextLines` | `1`–`10`, default `2` | Lines of context served above and below each reported line. |
|
|
237
|
+
| `maxDiagnostics` | `1`–`100`, default `20` | Diagnostics served; a larger request is clamped. |
|
|
238
|
+
|
|
239
|
+
- **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)).
|
|
240
|
+
- **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
|
+
- **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`.
|
|
190
242
|
|
|
191
243
|
## Shell view
|
|
192
244
|
|
|
@@ -249,6 +301,7 @@ Every refusal carries a bracketed code; `src/domain-errors.ts` is the source of
|
|
|
249
301
|
| `[E_BAD_PAYLOAD]` | Malformed or unknown tool payload; nothing is written. |
|
|
250
302
|
| `[E_BATCH_ABORT]` | A batch item failed; the whole batch was not applied. |
|
|
251
303
|
| `[E_EMPTY_RANGE]` | The patch would empty a non-empty file; use `write`. |
|
|
304
|
+
| `[E_EXPAND_UNAVAILABLE]` | The target file or grammar cannot resolve an enclosing item for `expand: "item"`; nothing is written. |
|
|
252
305
|
| `[E_FOREIGN_ANCHOR]` | The anchor belongs to a different file. |
|
|
253
306
|
| `[E_INTERNAL_INVARIANT]` | An internal invariant was violated. |
|
|
254
307
|
| `[E_LARGE_FILE]` | The file exceeds the served line or byte budget. |
|
package/cordis.patch.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
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
|
|
@@ -9,9 +9,19 @@
|
|
|
9
9
|
# both may be on at once. Each toggles live: the host reloads this row and the
|
|
10
10
|
# plugin re-mounts every live agent. Defaults: read on, apply_patch on, edit off.
|
|
11
11
|
- insert:
|
|
12
|
+
# `codegraph` adds the eight graph tools (explore/node/context/search/callers/callees/
|
|
13
|
+
# impact/implementations); the three source tools serve `HASH│content` rows. It needs the
|
|
14
|
+
# external `codegraph` CLI (>=1.6.4) and a repository indexed by it; `codegraphPath` pins
|
|
15
|
+
# an executable outside PATH.
|
|
12
16
|
- id: dsh-hashline-edit
|
|
13
17
|
name: dsh-hashline-edit
|
|
14
18
|
config:
|
|
15
19
|
read: true
|
|
16
20
|
applyPatch: true
|
|
17
21
|
edit: false
|
|
22
|
+
codegraph: true
|
|
23
|
+
codegraphPath: ""
|
|
24
|
+
# `diagnostics` adds the `diagnostics` tool: cargo check/clippy or tsc output served
|
|
25
|
+
# as `HASH│content` rows. It needs that toolchain on the machine, and reports a
|
|
26
|
+
# missing one (or a missing tsconfig) as call text.
|
|
27
|
+
diagnostics: true
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|