tamperward 2.29.2 → 2.29.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/dist/cli/index.js +4 -4
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1391,10 +1391,10 @@ function relForDisplay(path, cwd) {
|
|
|
1391
1391
|
const rel = relative(cwd, path);
|
|
1392
1392
|
return rel && !rel.startsWith("..") && !isAbsolute4(rel) ? rel : path;
|
|
1393
1393
|
}
|
|
1394
|
-
function applyEdit(content, oldStr, newStr) {
|
|
1394
|
+
function applyEdit(content, oldStr, newStr, replaceAll = false) {
|
|
1395
1395
|
if (content === null) return newStr;
|
|
1396
1396
|
if (oldStr !== "" && !content.includes(oldStr)) return content + "\n" + newStr;
|
|
1397
|
-
return content.replace(oldStr, () => newStr);
|
|
1397
|
+
return replaceAll ? content.replaceAll(oldStr, () => newStr) : content.replace(oldStr, () => newStr);
|
|
1398
1398
|
}
|
|
1399
1399
|
function synthFileChange(displayPath, before, after) {
|
|
1400
1400
|
if (before === after) return [];
|
|
@@ -1446,7 +1446,7 @@ function changesFromClaudeHook(input, cwd, base = cwd) {
|
|
|
1446
1446
|
const fp = asStr(ti.file_path);
|
|
1447
1447
|
if (!fp) return [];
|
|
1448
1448
|
const before = readDisk(abs(fp));
|
|
1449
|
-
const after = applyEdit(before, asStr(ti.old_string), asStr(ti.new_string));
|
|
1449
|
+
const after = applyEdit(before, asStr(ti.old_string), asStr(ti.new_string), ti.replace_all === true);
|
|
1450
1450
|
return synthFileChange(relForDisplay(abs(fp), cwd), before, after);
|
|
1451
1451
|
}
|
|
1452
1452
|
case "MultiEdit": {
|
|
@@ -1457,7 +1457,7 @@ function changesFromClaudeHook(input, cwd, base = cwd) {
|
|
|
1457
1457
|
const edits = Array.isArray(ti.edits) ? ti.edits : [];
|
|
1458
1458
|
for (const raw of edits) {
|
|
1459
1459
|
const ed = isRecord(raw) ? raw : {};
|
|
1460
|
-
after = applyEdit(after, asStr(ed.old_string), asStr(ed.new_string));
|
|
1460
|
+
after = applyEdit(after, asStr(ed.old_string), asStr(ed.new_string), ed.replace_all === true);
|
|
1461
1461
|
}
|
|
1462
1462
|
return synthFileChange(relForDisplay(abs(fp), cwd), before, after);
|
|
1463
1463
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tamperward",
|
|
3
|
-
"version": "2.29.
|
|
3
|
+
"version": "2.29.3",
|
|
4
4
|
"description": "The deterministic agent-integrity gate. One ruleset, evaluated on the actual diff/commands as a verdict, enforced everywhere a change can be made.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "hexrift",
|