pi-hashline-edit-pro 1.0.2 → 1.0.4
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 +2 -0
- package/package.json +2 -1
- package/src/replace.ts +6 -2
package/README.md
CHANGED
|
@@ -72,6 +72,8 @@ Edge cases:
|
|
|
72
72
|
|
|
73
73
|
## The `replace` tool
|
|
74
74
|
|
|
75
|
+
The built-in `edit` tool is disabled — `replace` is the only edit path; call it with the hash anchors from `read` output.
|
|
76
|
+
|
|
75
77
|
Exactly one edit per call, with `hash_range_inclusive` and `content_lines` at the top level of the request:
|
|
76
78
|
|
|
77
79
|
```json
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-hashline-edit-pro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Strict hashline read/replace tool for pi-coding-agent with hash-anchored edits (3-char, 62-symbol, perfect hashing)",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"diff": "^8.0.2",
|
|
36
36
|
"file-type": "^21.3.0",
|
|
37
|
+
"typebox": "^1.1.24",
|
|
37
38
|
"xxhash-wasm": "^1.1.0"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
package/src/replace.ts
CHANGED
|
@@ -165,6 +165,7 @@ function countLineChanges(
|
|
|
165
165
|
edit: HEdit,
|
|
166
166
|
originalHashes: string[],
|
|
167
167
|
isNoop: boolean,
|
|
168
|
+
removedAutoFixes: number,
|
|
168
169
|
): { totalAddedLines: number; totalRemovedLines: number } {
|
|
169
170
|
if (isNoop) return { totalAddedLines: 0, totalRemovedLines: 0 };
|
|
170
171
|
let totalRemovedLines = 0;
|
|
@@ -173,7 +174,10 @@ function countLineChanges(
|
|
|
173
174
|
if (startLine >= 0 && endLine >= 0) {
|
|
174
175
|
totalRemovedLines = Math.abs(endLine - startLine) + 1;
|
|
175
176
|
}
|
|
176
|
-
return {
|
|
177
|
+
return {
|
|
178
|
+
totalAddedLines: Math.max(0, edit.content_lines.length - removedAutoFixes),
|
|
179
|
+
totalRemovedLines,
|
|
180
|
+
};
|
|
177
181
|
}
|
|
178
182
|
|
|
179
183
|
export async function execPipeline(
|
|
@@ -219,7 +223,7 @@ export async function execPipeline(
|
|
|
219
223
|
const warnings = [...(anchorResult.warnings ?? [])];
|
|
220
224
|
|
|
221
225
|
const { totalAddedLines, totalRemovedLines } = countLineChanges(
|
|
222
|
-
edit, originalHashes, isNoop,
|
|
226
|
+
edit, originalHashes, isNoop, anchorResult.autoFixes?.length ?? 0,
|
|
223
227
|
);
|
|
224
228
|
|
|
225
229
|
return {
|