Commit Graph

23 Commits

Author SHA1 Message Date
can1357 5ea583e413 feat: replaced legacy editing commands with unified put and cut syntax
- Replaced legacy `SWAP`, `INS`, and `PASTE` commands with unified `PUT` and `CUT` hunks across parser, grammar, tokenizer, and test suites.
- Added support for named registers and span paste operations in clipboard and block execution logic.
- Implemented indentation repair and enhanced gap locator formatting for improved patch resilience.
- Updated documentation, system prompts, and session analysis scripts to reflect the new syntax and header shapes.
2026-07-31 00:19:52 +02:00
can1357 e05f229f43 refactor: standardized editing syntax by removing copy and delete operations
- Removed copy and delete operations across tokenizer, parser, grammar, and clipboard logic.
- Standardized line-editing operations and block resolvers to use cut exclusively.
- Updated documentation, prompts, and test suites to reflect the removal of copy and delete syntax.
2026-07-30 07:42:48 +02:00
can1357 03e6564c05 feat(hashline): enabled leniency rule for bare bullet minus rows
- Add leniency rule in parser to auto-accept bare `-` rows as literal content when hunks represent Markdown bullet lists.
- Emit MINUS_BULLET_AUTO_PIPED_WARNING when bullet-shaped rows lack explicit plus prefixes.
- Reject ambiguous or non-bullet minus rows to prevent unified-diff contamination.
2026-07-24 15:36:32 +02:00
can1357 766790cbac chore: unclanking edit pr 2026-07-17 21:37:20 +02:00
roboomp b65467291e fix(edit): recovered malformed local-model ranges
- Accepted comma-separated ranges and harmless malformed trailers emitted by local models.
- Added focused array-input diagnostics and reinforced canonical hashline syntax in the edit prompt.
- Covered the recovered forms with behavioral regression tests.

Fixes #5805
2026-07-17 07:46:25 +00:00
roboomp cf5150568f fix(edit): taught markdown bullet escaping
Clarified hashline minus-row errors and model-facing prompt examples so Markdown list rows use the + body-row prefix instead of triggering write fallbacks.

Fixes #4179
2026-07-01 22:15:53 +00:00
luk 00b08cc8a2 fix: tolerate GLM 5.2 stray dot in hunk headers
GLM 5.2 inserts an extra `.` between the line number/range and the
trailing `:` (e.g. `SWAP 2.=3.:`, `INS.POST 2.:`, `DEL 2.=3.`).
The parser failed with "payload line has no preceding hunk header"
and could not recover. Add a `skipStrayDot` helper that skips a
spurious `.` before the optional colon or end-of-line, wired into
`consumeOptionalColon` (covers SWAP, INS.*, SWAP.BLK, INS.BLK.POST)
and the DEL / DEL.BLK branches.
2026-06-28 21:15:51 +01:00
can1357 d6c51fe69a feat: hashline .= as seperator 2026-06-15 10:46:45 +02:00
can1357 ba82ed6e59 test: update hashline tests 2026-06-15 07:47:54 +02:00
can1357 907bc9979e feat: renamed opcodes to simplified variants
- Renamed line and block patch op verbs to XCHG, DEL, and INS in parsing and formatting.
- Updated grammar and tokenizer to support XCHG.BLK, DEL.BLK, and INS.PRE/POST/HEAD/TAIL forms.
- Updated diagnostics, docs, prompts, tests, and changelog to use XCHG/DEL/INS-based operators.
- Expanded session-stats parsing to normalize legacy op aliases to compact IDs.
2026-06-15 07:33:24 +02:00
can1357 fb9eae19bb feat(hashline): added format-v2 grammar and landing-shift repair; hardened lenient parsing
Includes parallel in-progress work (grammar.lark, parser, tokenizer, landing-shift repair) plus review fixes: boundary-echo balance-neutrality guard, interior blank rows preserved in bare bodies, uniform strip refuses numeric-keyed literals, multi-section write failures report which sections committed, snapshot store global byte ceiling, phantom-trailing-line delete anchors rejected.
2026-06-10 01:27:40 +02:00
can1357 1e163e4c80 fix(hashline): strip bare-row N: prefixes only when every bare row carries one
Defer read-output line-number stripping from #handleRaw to #flushPending and
gate it on uniformity: a bare "N:text" row is only a pasted-snapshot artifact
when *every* bare body row in the hunk carries the prefix. A mixed set (e.g.
"3:keep" next to "plain") is treated as genuine content and left intact,
avoiding silent corruption of bodies that legitimately start with "digits:".
Removes at most one prefix per row; "+"-prefixed literal rows stay untouched.

Reverts the now-orphaned stripLeadingHashlinePrefixes export back to private.
2026-06-08 00:56:05 +02:00
WodenJay 102bd39854 fix(hashline): strip N: line-number prefix from auto-piped bare body rows (#1492)
- Replace recursive stripLeadingHashlinePrefixes with single-pass
  stripOneLeadingHashlinePrefix in #handleRaw to prevent over-stripping
  content whose own text starts with digits:colon (e.g. YAML ports,
  timestamps: 2:42:hello → 42:hello, not hello)
- Export stripOneLeadingHashlinePrefix from prefixes.ts
- Move hashline CHANGELOG entry to [Unreleased] section
- Add regression tests for nested N: prefix and +N: asymmetry
2026-06-07 00:17:43 +08:00
can1357 860eef3f2f refactor(hashline): switched header syntax to bracketed [path#tag]
- Replaced `¶path#hash` prefix with `[path#hash]` delimiters across parser, tokenizer, and grammar.
- Updated prompts, docs, and recovery paths to the new bracketed form.
2026-06-06 15:38:08 +02:00
roboomp 7fcdfd048f fix(hashline): rejected malformed snapshot tag suffixes
Aligned the runtime header parser with the formal grammar's no-`#`-in-filename rule: any `#` left in the path body after detecting the trailing `#XXXX` tag means the header is malformed (short `#1A2`, non-hex `#1A2G`, over-long `#1A2B5`, stale-tag copy-paste, line-suffixed tags), not a path with an embedded hash. Mirrored the same rule on the apply_patch recovery path.

Added strict and recovery regression coverage for the three malformed-tag shapes the reviewer named.
2026-06-06 01:43:50 +00:00
roboomp 7e42c281f8 fix(hashline): rejected line suffixes after snapshot tags
Rejected headers such as ¶src/file.ts#1A2B:42 as malformed headers instead of treating the whole tail as a hashless path and failing later in body parsing.

Added strict and apply_patch-recovery regression coverage for line-suffixed snapshot tags.
2026-06-06 01:38:02 +00:00
roboomp 52f86e9445 fix(hashline): rejected stale-tag junk after section header
Tightened the relaxed header parser so a 4-hex token sitting before whitespace + more content (e.g. `¶src/a.ts#1A2B copied from read`) still raises the focused "must be ¶PATH or ¶PATH#TAG" diagnostic instead of being silently re-interpreted as a hashless path.

Also stopped rejecting hashless paths whose last five characters look like #TAG with a non-hex digit, and mirrored the same anti-junk rule in the apply_patch recovery parser.
2026-06-06 01:38:01 +00:00
roboomp cc43defbf8 fix(hashline): accepted spaces in edit paths
Parsed hashline section headers by recognizing only a trailing #TAG as the snapshot delimiter, allowing whitespace inside valid paths.

Updated recovery parsing and grammar docs to match the runtime parser, and added regression coverage for canonical and recovered headers with spaces.

Fixes #1634
2026-06-06 01:38:01 +00:00
can1357 13d116bf15 fix(hashline): treated empty replace hunks as deletes
- Updated the grammar to parse replace hunks with zero body lines.
- Changed empty replace execution to emit delete edits across the target range.
- Updated tests to verify empty replace syntax deletes lines while empty inserts still throw errors.
2026-06-03 22:53:19 +02:00
can1357 2d7cd6d2de feat(hashline)!: migrated to verb-based v4 syntax for edits
- Replaced bare `A B` range headers with `replace N..M:`, `delete N..M`, `insert before N:`, `insert after N:`, `insert head:`, and `insert tail:`.
- Removed `&A..B` repeat rows; insert-before/after ops now express the same intent explicitly.
- Empty replace bodies now error instead of deleting; `delete` is the canonical deletion op.
- Updated grammar, prompt, docs, tests, and all call sites to the new syntax.
2026-05-29 17:36:17 +02:00
can1357 91d15b2ec8 fix(hashline)!: removed single-number hunk header shorthand
- Rejected bare `A` anchors; single-line ranges must now be spelled `A A`.
- Added a descriptive error for single-number headers to guide model output.
- Updated grammar, tokenizer, prompt docs, and tests to reflect the change.
2026-05-28 10:36:49 +02:00
can1357 7dd00c015b feat: hashline improvements for spark
- Redesigned hashline patch syntax from anchor-based (`A-B:`) to hunk-header format (`@@ A..B @@`) with unified-diff compatibility.
- Removed `autoDropPureInsertDuplicates` option and simplified apply behavior to preserve duplicated boundary and context lines.
- Changed repeat operator from `^A-B` to `&A..B` and range separator from `-` to `..` for consistency with hunk-header syntax.
- Added image resizing and dimension notes to eval tool output; improved write tool hashline header sanitation for legacy formats.
- Removed 521 lines of boundary-duplicate absorption code and simplified parser to auto-convert bare body rows and unified-diff contamination.
2026-05-28 03:06:52 +02:00
can1357 7c64576524 feat(hashline): replaced file-hash anchors with opaque snapshot-store tags
- Replaced 4-hex content-derived file hashes with 3-hex opaque tags minted by InMemorySnapshotStore, making tags session-bound pointers rather than content fingerprints.
- Removed lru-cache dependency; replaced LRU-bounded per-path rings with a flat 4096-slot global ring using a scrambled permutation to prevent LLM tag extrapolation.
- Made SnapshotStore required in Patcher (was optional); tag resolution now drives stale-anchor detection instead of recomputing hashes at apply time.
- Changed literal payload sigil from `|` to `+` and accepted `^A` shorthand for `^A-A`; added lenient recovery for bare bodies, lone `-` rows, and overlapping bare/concrete block pairs.
2026-05-28 01:00:23 +02:00