pi-hashline-edit-pro 6.3.1 → 6.4.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.
Files changed (45) hide show
  1. package/README.md +33 -32
  2. package/index.ts +32 -16
  3. package/package.json +1 -1
  4. package/src/batch.ts +30 -9
  5. package/src/commit.ts +17 -3
  6. package/src/config-ui.ts +1 -1
  7. package/src/constants.ts +3 -0
  8. package/src/copy-move.ts +100 -68
  9. package/src/edit-common.ts +86 -54
  10. package/src/edit-fidelity.ts +16 -6
  11. package/src/fs-write.ts +14 -2
  12. package/src/grep.ts +22 -11
  13. package/src/insert.ts +5 -4
  14. package/src/line-endings.ts +6 -2
  15. package/src/model-gate.ts +1 -1
  16. package/src/payload-contract.ts +13 -9
  17. package/src/pre-edit-snapshot.ts +19 -0
  18. package/src/prompts.ts +32 -0
  19. package/src/read.ts +5 -10
  20. package/src/replace-diff.ts +5 -3
  21. package/src/replace-match.ts +2 -2
  22. package/src/replace-render.ts +4 -4
  23. package/src/replace-response.ts +1 -0
  24. package/src/replace-undo.ts +4 -4
  25. package/src/replace.ts +2 -2
  26. package/src/structured.ts +2 -1
  27. package/src/utils.ts +29 -0
  28. package/src/write-hook.ts +1 -1
  29. package/tool-prompts/copy-snippet.md +1 -1
  30. package/tool-prompts/copy.md +2 -2
  31. package/tool-prompts/grep-guidelines.md +2 -1
  32. package/tool-prompts/grep-snippet.md +1 -1
  33. package/tool-prompts/grep.md +1 -1
  34. package/tool-prompts/insert.md +1 -1
  35. package/tool-prompts/move-snippet.md +1 -1
  36. package/tool-prompts/move.md +2 -2
  37. package/tool-prompts/read-guidelines.md +2 -2
  38. package/tool-prompts/read.md +1 -3
  39. package/tool-prompts/replace-match-guidelines.md +1 -0
  40. package/tool-prompts/replace-match-snippet.md +1 -1
  41. package/tool-prompts/replace-match.md +1 -1
  42. package/tool-prompts/replace.md +3 -2
  43. package/tool-prompts/transfer-guidelines.md +3 -3
  44. package/tool-prompts/undo-last-change-snippet.md +1 -1
  45. package/tool-prompts/undo-last-change.md +1 -1
@@ -1,3 +1,3 @@
1
- Copy a range of lines to another position, targeted by 4-character anchors from any served anchor│content row. Give `source_from` and `source_to` as bare anchors marking the first and last line to copy in the source file, and `insert_after` as the bare anchor of the destination line after which the copy goes. The source lines stay in place, and the copied lines are written exactly as the source file holds them.
1
+ Duplicate a range of lines at another anchor, in this or another file. The source rows and anchors stay live; the copied lines get fresh anchors in the destination's post-edit diff and keep their source line endings.
2
2
 
3
- A copy always duplicates the content its source anchors were served from, so a same-message edit to the source file does not change what is copied.
3
+ A copy duplicates the content its source anchors were served from, so a same-message edit to the source file does not change what is copied.
@@ -1 +1,2 @@
1
- - `anchor_grep`: prefer it over shell `rg`/`grep` for searching, so hits carry anchors and need no `read`; use `literal: true` when the pattern contains regex metacharacters.
1
+ - `grep`: set `literal: true` when the pattern contains regex metacharacters.
2
+ - `grep`: `N:│` rows are matches and `N-│` rows are context;
@@ -1 +1 @@
1
- Search with `lineNumber │ anchor│content` hits usable directly for `replace`/`insert`; use `literal`/`glob`/`context`
1
+ Search with `lineNumber:│ anchor│content` hits (`lineNumber-│` for context) usable directly for `replace`/`insert`; use `literal`/`glob`/`context`
@@ -1 +1 @@
1
- Search text files with ripgrep. Hits and context lines come back as `lineNumber │ anchor│content` rows, editable with replace, insert, copy, or move without a new read; the `=== path ===` header and line numbers locate the match. Patterns are regex by default; set `literal: true` to search exact text, `ignoreCase` for case-insensitive search, and `context` for surrounding rows. Backreferences and look-around are rejected by ripgrep's engine; nested quantifiers and alternation run in linear time. Searches respect `.gitignore`, always skip `.git`, and skip binary and image files silently. A match over 500 bytes is shown as a `...` fragment around the hit, but its anchor still covers the whole line. When cut by match limit, raise `limit` (default 100); when cut by rows/bytes, refine `pattern` / narrow path.
1
+ Search text files with ripgrep. Hits come back as `lineNumber:│ anchor│content` rows and context lines as `lineNumber-│ anchor│content`, editable with replace, insert, copy, or move without a new read; the `=== path ===` header and line numbers locate the match. Patterns are regex by default; set `literal: true` for exact text, `ignoreCase` for case-insensitive search, and `context` for surrounding rows. Rust regex syntax (no backreferences or look-around) through a linear-time engine. Searches respect `.gitignore`, always skip `.git`, and skip binary and image files silently. A match over 500 bytes is shown as a `...` fragment around the hit, but its anchor still covers the whole line. When cut by match limit, raise `limit` (default 100); when cut by rows/bytes, refine `pattern` or narrow `path`.
@@ -1 +1 @@
1
- Insert text after or before one existing line in a text file, addressed by the `anchor` field (a bare anchor from any served anchor│content row). `text` goes after the anchor line with `direction: "after"` or before it with `direction: "before"`. `text` is one string holding the exact text to insert; a trailing line break sets the newline of the last line written instead of adding a blank line, and a leading break is an ordinary blank line.
1
+ Insert text after or before one existing line, addressed by `anchor` (a bare anchor from any served `anchor│content` row). `direction` places `text` after or before the anchor line; `text` is the exact text to insert.
@@ -1 +1 @@
1
- Move lines to another position by anchor: `source_from`/`source_to` mark the range, it lands after `insert_after`; each anchor resolves its own file
1
+ Move lines to another position by anchor: `source_from`/`source_to` mark the range, `anchor` and `direction` the destination
@@ -1,3 +1,3 @@
1
- Move a range of lines to another position, targeted by 4-character anchors from any served anchor│content row. Give `source_from` and `source_to` as bare anchors marking the first and last line to move in the source file, and `insert_after` as the bare anchor of the destination line after which the range goes. `insert_after` must sit outside the source range when both anchors share a file.
1
+ Relocate a range of lines to another anchor, in this or another file. Within one file the destination must sit outside the source range; moving a range onto itself reports `No changes made` and leaves the anchors alone.
2
2
 
3
- A cross-file `move` commits on its own when its source file also has batched edits in the message.
3
+ A cross-file move commits on its own when its source file also has batched edits in the message.
@@ -1,3 +1,3 @@
1
- - `read`: call again after an edit when you need anchors you lack — post-edit diff `+anchor│`/` anchor│` rows and any served `anchor│content` rows already carry fresh anchors for the changed range.
2
- - `read`: an auto-read-all outline row shows a symbol label, or the line content for a single-line symbol; its `[limit N]` is the span to request.
1
+ - `read`: call again after an edit when you need anchors you lack — post-edit diff `+`/` ` rows and served `anchor│content` rows already carry fresh anchors for the changed range.
2
+ - `read`: an auto-read-all outline row shows a symbol label, or a single-line symbol's content; its `[limit N]` is the span to request.
3
3
  - `read`: `replace_match` needs both boundary lines served; copy `old_string` from a served row or read the lines first.
@@ -1,3 +1 @@
1
- Read a text file and return it as `anchor│content` rows, one per line: a 4-character anchor (letters only, case-sensitive), the `│` separator, then the line content. Target edits by anchor, never by content or line number. Page long files with `offset` and `limit`; when the output says truncated, continue from the hinted `offset`. Images attach visually; binary, directory, and UTF-16/UTF-32 text are rejected; an empty file returns one empty row you can replace to seed content.
2
-
3
- `offset` takes a 1-indexed line number or a served anchor; with an anchor, `limit` counts the lines to return after it, so no line-number math is needed. A stale anchor is refused with the current context rows and fresh anchors.
1
+ Read a text file as `anchor│content` rows: a 4-character anchor (letters only, case-sensitive), `│`, then the line. Target edits by anchor, never by content or line number. `offset` takes a 1-indexed line number or a served anchor; with an anchor, `limit` counts lines after it — no line-number math. Page long files with `offset` and `limit`; when output says truncated, continue from the hinted `offset`. A stale anchor is refused with the current rows and fresh anchors. Images attach visually; binary, directory, and UTF-16/UTF-32 text are rejected; an empty file returns one empty row you can replace to seed content.
@@ -1 +1,2 @@
1
1
  - `replace_match`: `old_string` is usually a fragment of the line, not the whole line; every occurrence inside the range is replaced, so scope the range with anchors when only some occurrences should change.
2
+ - `replace_match`: when you intend to change every matching line in a range, anchor the first and last matching lines of that range so one call replaces them all, instead of one call per line.
@@ -1 +1 @@
1
- Replace part of a line or range by anchor: every occurrence of `old_string` inside `replace_from`/`replace_to` is replaced by `new_string`, leaving the rest of the text untouched
1
+ Replace part of a line or range by anchor: every `old_string` occurrence inside `replace_from`/`replace_to` becomes `new_string`; the rest of the line stays untouched
@@ -1,3 +1,3 @@
1
- Replace part of a line (or a range of lines) without retyping the rest. `replace_from` and `replace_to` are bare anchors from served `anchor│content` rows marking the first and last line of the range; use the same anchor for one line. `old_string` is the text to find inside that range, and `new_string` replaces every occurrence of it. `remove_from`/`remove_to` are accepted as aliases for `replace_from`/`replace_to`.
1
+ Replace part of a line (or a range of lines) without retyping the rest. `replace_from`/`replace_to` are bare anchors from served `anchor│content` rows marking the range's first and last line (the same anchor for one line), `old_string` is the text to find inside it, and `new_string` replaces every occurrence. `remove_from`/`remove_to` are accepted as aliases.
2
2
 
3
3
  The two boundary anchors must still match what was last shown; lines strictly inside the range are matched against the file as it is on disk.
@@ -1,2 +1,3 @@
1
- Replace a range of lines (or a single line) in a text file by anchor. `remove_from` and `remove_to` are the 4-character anchors of the first and last line to remove, and `text` is one string holding the exact replacement text. The text is written exactly as given, and nothing else in the file changes. `replace_from`/`replace_to` are accepted as aliases for `remove_from`/`remove_to`.
2
- To change only part of a line without retyping the rest, use `replace_match` instead; it preserves every character the request does not name. Deleting every line empties the file; the result names the new empty-line anchor, so a follow-up `replace` on it can seed content without a `read`.
1
+ Replace a range of lines (or a single line) in a text file by anchor: `remove_from` and `remove_to` are the 4-character anchors of its first and last line, `text` is the exact replacement text, and `replace_from`/`replace_to` are accepted as aliases. Deleting every line empties the file, and the result names the empty-line anchor, so a follow-up `replace` can seed content without a `read`.
2
+
3
+ To change only part of a line without retyping the rest, use `replace_match` instead; it preserves every character the request does not name.
@@ -1,4 +1,4 @@
1
- - `copy`/`move`: for a block transfer, only the source's two boundary rows and the destination line need serving; to append at the end, use the destination's last served line as `insert_after`.
2
- - `copy`/`move`: `insert_after` must sit outside the source range; `source_to` places the block right after itself.
3
- - `copy`/`move`: `source_from` and `source_to` may live in a different file than `insert_after`; an empty destination file is seeded with the copied or moved lines.
1
+ - `copy`/`move`: only the source's two boundary rows and the destination line need serving; to append to the end of a file, anchor that file's last line with `direction: "after"` — not a marker line and not the block's own end.
2
+ - `copy`/`move`: within one file the insertion point must fall before the source range's first line or after its last; anchoring the block's last line with `direction: "after"` (or its first line with `direction: "before"`) targets the gap right beside the block.
3
+ - `copy`/`move`: `source_from` and `source_to` may live in a different file than `anchor`; an empty destination file is seeded with the copied or moved lines.
4
4
  - `move`: a batched cross-file move does not display the source file's diff; its removal commits with the batch, and the source file needs a read for fresh anchors.
@@ -1 +1 @@
1
- Single-level undo: reverts a file's last `replace`, `replace_match`, `insert`, `copy`, or `move`
1
+ Revert a file's most recent edit (single level)
@@ -1 +1 @@
1
- Undo the last replace, replace_match, insert, copy, or move on a file, restoring the previous content, BOM, and line endings. Use it when an edit removed or changed the wrong lines. If the file changed since that edit, the undo is refused and the file is left untouched; do not force it. A file deleted since the edit is restored. If the diff is truncated, use read to see the full file.
1
+ Undo the last replace, replace_match, insert, copy, or move on a file, restoring the previous content, BOM, and line endings. If the file changed since that edit, the undo is refused and the file is left untouched; a file deleted since the edit is restored.