pi-hashline-edit-pro 0.13.2 → 0.13.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-hashline-edit-pro",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
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": {
@@ -42,14 +42,29 @@ export function normReq(input: unknown): unknown {
42
42
  const hasChangesField = has(record, "changes");
43
43
  const hasEditsField = has(record, "edits");
44
44
 
45
- if (hasChangesField) {
45
+ if (hasChangesField) {
46
46
  const raw = tryParseJSON(record.changes, Array.isArray) ?? record.changes;
47
- if (Array.isArray(raw)) record.changes = coerceEditArray(raw);
48
- } else if (hasEditsField) {
47
+ if (Array.isArray(raw)) {
48
+ record.changes = coerceEditArray(raw);
49
+ } else {
50
+ // Single object (JSON string or literal) → wrap in array
51
+ const single = typeof raw === "string"
52
+ ? tryParseJSON(raw, isRec)
53
+ : isRec(raw) ? raw : undefined;
54
+ if (single) record.changes = coerceEditArray([single]);
55
+ }
56
+ } else if (hasEditsField) {
49
57
  const raw = tryParseJSON(record.edits, Array.isArray) ?? record.edits;
50
- if (Array.isArray(raw)) record.changes = coerceEditArray(raw);
58
+ if (Array.isArray(raw)) {
59
+ record.changes = coerceEditArray(raw);
60
+ } else {
61
+ const single = typeof raw === "string"
62
+ ? tryParseJSON(raw, isRec)
63
+ : isRec(raw) ? raw : undefined;
64
+ if (single) record.changes = coerceEditArray([single]);
65
+ }
51
66
  delete record.edits;
52
- }
67
+ }
53
68
 
54
69
  return record;
55
70
  }