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.
- package/README.md +33 -32
- package/index.ts +32 -16
- package/package.json +1 -1
- package/src/batch.ts +30 -9
- package/src/commit.ts +17 -3
- package/src/config-ui.ts +1 -1
- package/src/constants.ts +3 -0
- package/src/copy-move.ts +100 -68
- package/src/edit-common.ts +86 -54
- package/src/edit-fidelity.ts +16 -6
- package/src/fs-write.ts +14 -2
- package/src/grep.ts +22 -11
- package/src/insert.ts +5 -4
- package/src/line-endings.ts +6 -2
- package/src/model-gate.ts +1 -1
- package/src/payload-contract.ts +13 -9
- package/src/pre-edit-snapshot.ts +19 -0
- package/src/prompts.ts +32 -0
- package/src/read.ts +5 -10
- package/src/replace-diff.ts +5 -3
- package/src/replace-match.ts +2 -2
- package/src/replace-render.ts +4 -4
- package/src/replace-response.ts +1 -0
- package/src/replace-undo.ts +4 -4
- package/src/replace.ts +2 -2
- package/src/structured.ts +2 -1
- package/src/utils.ts +29 -0
- package/src/write-hook.ts +1 -1
- package/tool-prompts/copy-snippet.md +1 -1
- package/tool-prompts/copy.md +2 -2
- package/tool-prompts/grep-guidelines.md +2 -1
- package/tool-prompts/grep-snippet.md +1 -1
- package/tool-prompts/grep.md +1 -1
- package/tool-prompts/insert.md +1 -1
- package/tool-prompts/move-snippet.md +1 -1
- package/tool-prompts/move.md +2 -2
- package/tool-prompts/read-guidelines.md +2 -2
- package/tool-prompts/read.md +1 -3
- package/tool-prompts/replace-match-guidelines.md +1 -0
- package/tool-prompts/replace-match-snippet.md +1 -1
- package/tool-prompts/replace-match.md +1 -1
- package/tool-prompts/replace.md +3 -2
- package/tool-prompts/transfer-guidelines.md +3 -3
- package/tool-prompts/undo-last-change-snippet.md +1 -1
- package/tool-prompts/undo-last-change.md +1 -1
package/tool-prompts/copy.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
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
|
|
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
|
-
- `
|
|
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
|
|
1
|
+
Search with `lineNumber:│ anchor│content` hits (`lineNumber-│` for context) usable directly for `replace`/`insert`; use `literal`/`glob`/`context`
|
package/tool-prompts/grep.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Search text files with ripgrep. Hits
|
|
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`.
|
package/tool-prompts/insert.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Insert text after or before one existing 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,
|
|
1
|
+
Move lines to another position by anchor: `source_from`/`source_to` mark the range, `anchor` and `direction` the destination
|
package/tool-prompts/move.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
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
|
|
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
|
|
2
|
-
- `read`: an auto-read-all outline row shows a symbol label, or
|
|
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.
|
package/tool-prompts/read.md
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
Read a text file
|
|
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
|
|
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
|
|
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.
|
package/tool-prompts/replace.md
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
Replace a range of lines (or a single line) in a text file by anchor
|
|
2
|
-
|
|
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`:
|
|
2
|
-
- `copy`/`move`:
|
|
3
|
-
- `copy`/`move`: `source_from` and `source_to` may live in a different file than `
|
|
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
|
-
|
|
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.
|
|
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.
|