@oh-my-pi/hashline 15.9.67 → 15.10.0
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/package.json +1 -1
- package/src/prompt.md +14 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/hashline",
|
|
4
|
-
"version": "15.
|
|
4
|
+
"version": "15.10.0",
|
|
5
5
|
"description": "Hashline: a compact, line-anchored patch language and applier. Pluggable FS/IO so it works over disk, in-memory, or any custom backend.",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
7
7
|
"author": "Can Boluk",
|
package/src/prompt.md
CHANGED
|
@@ -5,7 +5,7 @@ Every file section starts with `[PATH#TAG]`. `TAG` is the 4-hex snapshot tag fro
|
|
|
5
5
|
</headers>
|
|
6
6
|
|
|
7
7
|
<ops>
|
|
8
|
-
replace N..M: replace original lines N..M with the body rows below.
|
|
8
|
+
replace N..M: replace original lines N..M with the body rows below. CAUTION, IT IS INCLUSIVE! MAKE SURE YOU INTEND TO DELETE BOTH ENDS!
|
|
9
9
|
replace block N: replace the whole syntactic block that BEGINS on line N — its header line through its closing line — resolved with tree-sitter. Body rows below. Point N at the line that OPENS the construct (the `if`/`function`/`def`/`{`-bearing line), not a closing `}` or a blank line.
|
|
10
10
|
delete N..M delete original lines N..M. No body.
|
|
11
11
|
delete block N delete the whole syntactic block that BEGINS on line N.
|
|
@@ -27,10 +27,13 @@ There is NO other body row kind. NEVER write `-old` or a bare/context line. To k
|
|
|
27
27
|
- Numbers refer to the ORIGINAL file and stay valid for the whole patch — they do not shift as hunks apply.
|
|
28
28
|
- Across calls they do NOT survive: each applied edit mints a fresh `#TAG` and renumbers the file, so the tag and line numbers you just used are dead. Anchor the next edit on the `[PATH#TAG]` and lines from the edit response (or re-`read`), never on pre-edit numbers.
|
|
29
29
|
- A line number is an offset, not a structural boundary: never `insert after N` into a construct you have not read, and never start or end a `replace`/`delete` range mid-expression or mid-block. If unsure what is on those lines, `read` them first.
|
|
30
|
+
- A valid `#TAG` is NOT permission to patch the whole file — it certifies the snapshot, not your knowledge of it. Authority to touch a line comes from having literally seen that line as a `LINE:TEXT` row in a `read`/`search`, not from holding the tag. Every line in a hunk's range, and the lines bounding it, must be lines you actually saw.
|
|
31
|
+
- An elided or partial read is NOT a read of the gap. A `…` (or any collapsed/truncated region) between two excerpts means those lines are UNSEEN — treat them exactly like lines you never opened. Never place a hunk on, or span a range across, an elided region; `read` that range explicitly first. Reconstructing it from memory of "what the code probably looks like" is how ranges drift off-by-N and shred neighboring blocks.
|
|
30
32
|
- On a stale-tag rejection — or any result you cannot fully account for — STOP and re-`read`. Never stack more line-numbered edits onto output you have not re-grounded; that compounds corruption.
|
|
31
33
|
- One hunk per range; the body is the final content, never an old/new pair.
|
|
32
34
|
- Keep every range as tight as the change: a range must cover ONLY lines whose content actually changes. Never widen it to swallow an unchanged signature, brace, or neighboring statement just to rewrite a few lines inside — change one line with `replace N..N`, not the whole block around it. (A range where every line genuinely changes is correctly long; tightness is about excluding unchanged lines, not about being short.) This bounds the blast radius if a number is off: a stale single-line replace corrupts one line, while a stale block replace shreds the whole block and its structure.
|
|
33
35
|
- To change lines 2 and 5 while keeping 3–4, issue two hunks (`replace 2..2:` and `replace 5..5:`). Untouched lines are simply absent from every range.
|
|
36
|
+
- Pure additions use `insert`, never a widened `replace`. If the change only adds lines, `insert before/after` the spot and keep every existing line out of all ranges. Do NOT `replace` a span of keepers and retype them around the new line "to preserve" them — those retyped keepers are exactly what gets silently dropped when one is forgotten. A keeper that never enters your body cannot be lost. `replace` is only for lines whose own text changes.
|
|
34
37
|
- NEVER use this tool to format code — reordering imports, re-indenting, aligning columns, or any mechanical restyling. That is the project formatter's job; run it instead of hand-editing layout here.
|
|
35
38
|
</rules>
|
|
36
39
|
|
|
@@ -99,6 +102,16 @@ replace 3..3:
|
|
|
99
102
|
# RIGHT
|
|
100
103
|
replace 3..3:
|
|
101
104
|
+ return msg
|
|
105
|
+
|
|
106
|
+
# WRONG — a pure insertion done as a widened `replace`: you only want to add one line after 2,
|
|
107
|
+
# but you replace 2..4, retype the keepers in the body, and drop one (here line 4, `greet("world")`).
|
|
108
|
+
replace 2..4:
|
|
109
|
+
+ msg = "Hello, " + name
|
|
110
|
+
+ extra = compute(name)
|
|
111
|
+
+ print(msg)
|
|
112
|
+
# RIGHT — touch nothing you keep; the new line is the whole body.
|
|
113
|
+
insert after 2:
|
|
114
|
+
+ extra = compute(name)
|
|
102
115
|
</anti-patterns>
|
|
103
116
|
|
|
104
117
|
<critical>
|