pi-hashline-edit-pro 0.9.5 → 0.9.6

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 RimuruW
3
+ Copyright (c) 2026 RimuruW and Yugimob
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-hashline-edit-pro",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Strict hashline read/replace tool for pi-coding-agent with hash-anchored edits (3-char, 18-bit, perfect hashing)",
5
5
  "main": "index.ts",
6
6
  "repository": {
@@ -1,3 +1,3 @@
1
1
  - Use `replace` with HASH anchors for all file changes; batch every change to one file into a single `replace` call.
2
- - After a successful `replace`, the returned `--- Anchors ---` block has fresh hashes for nearby follow-up replaces.
3
- - On `[E_STALE_ANCHOR]`, retry with the `>>>` lines quoted in the error instead of re-reading the whole file.
2
+ - After a successful `replace`, the response text is empty (warnings only). Call `read` to get fresh anchors for follow-up edits.
3
+ - On `[E_STALE_ANCHOR]`, call `read` to get fresh anchors, copy the 3-character HASH from each line into `old_range`, and retry.
@@ -134,7 +134,7 @@ function assertEditItem(edit: Record<string, unknown>, index: number): void {
134
134
  const unknownKeys = Object.keys(edit).filter((key) => !ITEM_KEYS.has(key));
135
135
  if (unknownKeys.length > 0) {
136
136
  throw new Error(
137
- `[E_BAD_SHAPE] Edit ${index} contains unknown or unsupported fields: ${unknownKeys.join(", ")}.`,
137
+ `[E_BAD_SHAPE] Edit ${index} contains unknown or unsupported fields: ${unknownKeys.join(", ")}. Each edit takes only { old_range, new_lines }.`,
138
138
  );
139
139
  }
140
140
 
@@ -144,7 +144,7 @@ function assertEditItem(edit: Record<string, unknown>, index: number): void {
144
144
  );
145
145
  }
146
146
  if (!("new_lines" in edit)) {
147
- throw new Error(`[E_BAD_SHAPE] Edit ${index} requires a "new_lines" field.`);
147
+ throw new Error(`[E_BAD_SHAPE] Edit ${index} requires a "new_lines" field. Provide the replacement lines (use [] to delete).`);
148
148
  }
149
149
  if ("new_lines" in edit && !isStringArray(edit.new_lines)) {
150
150
  throw new Error(`[E_BAD_SHAPE] Edit ${index} field "new_lines" must be a string array.`);
package/src/replace.ts CHANGED
@@ -118,7 +118,7 @@ export function assertReplaceRequest(
118
118
  );
119
119
  if (unknownRootKeys.length > 0) {
120
120
  throw new Error(
121
- `[E_BAD_SHAPE] Edit request contains unknown or unsupported fields: ${unknownRootKeys.join(", ")}.`,
121
+ `[E_BAD_SHAPE] Edit request contains unknown or unsupported fields: ${unknownRootKeys.join(", ")}. Use only { path, edits }; each edit is { old_range: ["<START>", "<END>"], new_lines: [...] }.`,
122
122
  );
123
123
  }
124
124
 
@@ -127,7 +127,7 @@ export function assertReplaceRequest(
127
127
  }
128
128
 
129
129
  if (hasOwn(request, "edits") && !Array.isArray(request.edits)) {
130
- throw new Error('[E_BAD_SHAPE] Edit request requires an "edits" array when provided.');
130
+ throw new Error('[E_BAD_SHAPE] Edit request requires an "edits" array when provided. Each edit is { old_range: ["<START>", "<END>"], new_lines: [...] }.');
131
131
  }
132
132
 
133
133
  }