From 25299693c954d1503fc58fd5c77ae33a07758948 Mon Sep 17 00:00:00 2001 From: can1357 Date: Fri, 31 Jul 2026 00:28:54 +0200 Subject: [PATCH] feat(hashline): updated grammar and documentation for unified put and cut syntax - Update Lark grammar to support the unified put, cut, move, and remove operations. - Update documentation and prompts to reflect canonical inclusive range separators and named register rules. --- packages/coding-agent/CHANGELOG.md | 1 + packages/hashline/CHANGELOG.md | 11 ++++++++++- packages/hashline/README.md | 2 +- packages/hashline/src/grammar.lark | 4 ++-- packages/hashline/src/prompt.md | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index e555768c1..40331fb6a 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -9,6 +9,7 @@ ### Changed - Moved the display-reset default chord (`app.display.reset`) from `Ctrl+L` to `Alt+L` to make room for the live-mode toggle. +- Updated the hashline edit tool, streaming preview, and plan-mode guidance for the unified `PUT`/`CUT` grammar, `.=` ranges, and named registers. ## [17.2.1] - 2026-07-30 diff --git a/packages/hashline/CHANGELOG.md b/packages/hashline/CHANGELOG.md index e3a14b0af..06109f162 100644 --- a/packages/hashline/CHANGELOG.md +++ b/packages/hashline/CHANGELOG.md @@ -9,7 +9,16 @@ ### Added - Added named register support (`@reg`) and span paste capabilities to clipboard operations -- Added auto-shifting for uniformly omitted base indents under brace openers +- Added conservative recovery for uniformly omitted replacement indents that would otherwise escape an immediately preceding brace opener, while preserving intentional indentation-only edits + +### Changed + +- Made `.=` the canonical inclusive range separator while retaining legacy separator variants as lenient input +- Unified replacement, insertion, register paste, block, head/tail, move, and removal headers under the composable `PUT`, `CUT`, `MV`, and `REM` grammar + +### Fixed + +- Recovered common model output mistakes including numbered read rows, summarized ranges, diff-style old/new rows, empty `PUT` deletes, harmless `CUT` colons, and single-line span shorthand without weakening overlap or stale-snapshot guards ## [17.2.0] - 2026-07-30 diff --git a/packages/hashline/README.md b/packages/hashline/README.md index 6b0379b6c..1685e68e1 100644 --- a/packages/hashline/README.md +++ b/packages/hashline/README.md @@ -51,7 +51,7 @@ Inside a section: - `PUT A*:` — replace the syntactic block beginning on line A. - `PUT A:` — insert following body rows before/after line A (`<1` = head, `>$` = tail). - `PUT >A*:` — insert following body rows after the resolved block's last line. -- `PUT A` / `PUT A.=B @name` — paste a captured register at a gap or over a range (no `:` header, no body rows; `@name` optional at gaps). +- `PUT A` / `PUT A.=B @name` / `PUT A* @name` — paste a captured register at a gap, over a range, or over a resolved block (no `:` header or body rows; `@name` is optional only at gaps). - `CUT A.=B` / `CUT A*` — delete concrete lines or a resolved block and capture them (anonymous, or `@name` when given). - `REM` — delete the whole file named by the section header. - `MV DEST` — move/rename the section file to `DEST` (optionally after line edits). diff --git a/packages/hashline/src/grammar.lark b/packages/hashline/src/grammar.lark index 355d49c3d..1b4ed17e4 100644 --- a/packages/hashline/src/grammar.lark +++ b/packages/hashline/src/grammar.lark @@ -8,12 +8,12 @@ file_hash: /[0-9A-F]{4}/ filename: /[^#\r\n]+/ hunk: put_hunk | cut_hunk | rem_hunk | mv_hunk -put_hunk: "PUT " put_locator register? ":" LF body* +put_hunk: "PUT " put_locator ":" LF body+ | "PUT " put_locator register LF | "PUT " gap_locator LF cut_hunk: "CUT " cut_locator register? LF rem_hunk: "REM" LF -mv_hunk: "MV " filename LF body* +mv_hunk: "MV " filename LF put_locator: range | LID "*" | gap_locator cut_locator: range | LID "*" diff --git a/packages/hashline/src/prompt.md b/packages/hashline/src/prompt.md index 63f226b76..20ecbfad1 100644 --- a/packages/hashline/src/prompt.md +++ b/packages/hashline/src/prompt.md @@ -9,7 +9,7 @@ Every file section starts `[PATH#TAG]`. `TAG` = 4-hex snapshot tag from your lat `PUT N*:` — replace the syntactic block BEGINNING on line N; its closing line is resolved for you. `PUT N:` — insert body rows before / after line N (`PUT <1:` = file head, `PUT >$:` = file tail). `PUT >N*:` — insert body rows after the END of the block beginning at N (at sibling depth). Append inside a block → `PUT >M:`. -`PUT N` / `PUT N.=M @name` — paste a captured register at a gap or over a range (no `:` header, no body rows). Unlabeled `PUT` pastes the anonymous register; `@name` selects a named register. +`PUT N` / `PUT N.=M @name` / `PUT N* @name` — paste a captured register at a gap, over a range, or over a resolved block (no `:` header, no body rows). Unlabeled gap `PUT` pastes the anonymous register; span/block paste requires `@name`. `CUT N.=M` / `CUT N*` — delete lines N through M / block N and capture them (anonymous, or `@name` when given). `REM` — delete the whole section file. `MV DEST` — move/rename to `DEST` (quote paths with spaces); edits above `MV` land on the source first, final content written at `DEST`. Single line: `PUT N.=N:` / `CUT N.=N`. Range = ORIGINAL lines touched (`N.=M`, inclusive); body length irrelevant.