tamperward 2.30.1 → 2.30.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.
Files changed (2) hide show
  1. package/dist/cli/index.js +63 -49
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -866,10 +866,10 @@ function headerPaths(line) {
866
866
  first = rest.slice(0, mid);
867
867
  rest = rest.slice(mid + 1);
868
868
  } else {
869
- const m = rest.match(/^(.*) (b\/.*)$/);
870
- if (!m) return [null, null];
871
- first = m[1];
872
- rest = m[2];
869
+ const at = rest.lastIndexOf(" b/");
870
+ if (at < 0) return [null, null];
871
+ first = rest.slice(0, at);
872
+ rest = rest.slice(at + 1);
873
873
  }
874
874
  }
875
875
  }
@@ -2874,7 +2874,6 @@ function expandShellPath(t, env = process.env) {
2874
2874
  function hookTests(policy, ctx) {
2875
2875
  const cwd = ctx?.cwd;
2876
2876
  const diskCwd = cwd !== void 0 && existsSync3(cwd) ? cwd : void 0;
2877
- const onDisk = diskCwd !== void 0;
2878
2877
  const root = diskCwd !== void 0 ? canonicalPath(diskCwd) : cwd;
2879
2878
  const memo = /* @__PURE__ */ new Map();
2880
2879
  const rel = (t) => {
@@ -2938,7 +2937,7 @@ function shellHookTarget(seg, toks, policy, ctx) {
2938
2937
  return null;
2939
2938
  }
2940
2939
  function shellWritesHook(seg, toks, policy, ctx) {
2941
- const { rel, hook, whole, holds, hookish } = hookTests(policy, ctx);
2940
+ const { hook, whole, holds, hookish } = hookTests(policy, ctx);
2942
2941
  for (const m of seg.matchAll(REDIRECT_TARGET)) {
2943
2942
  if (hook(m[1])) return "a redirect empties or rewrites a protected hook";
2944
2943
  }
@@ -2947,7 +2946,6 @@ function shellWritesHook(seg, toks, policy, ctx) {
2947
2946
  const cmd = (toks[at] ?? "").replace(/^.*\//, "");
2948
2947
  const args = toks.slice(at + 1);
2949
2948
  const positional = args.filter((a) => a !== "--" && !a.startsWith("-"));
2950
- const last = positional[positional.length - 1] ?? "";
2951
2949
  const anyHook = args.some(hook);
2952
2950
  const inPlace = args.some((a) => /^-[A-Za-z]*i|^--in-place/.test(a));
2953
2951
  const scripts = args.filter((_, i) => i > 0 && INLINE_FLAG.test(args[i - 1]));
@@ -9837,7 +9835,8 @@ var init_test_deletion = __esm({
9837
9835
  fed.push(...toks);
9838
9836
  const testToks = source.filter((t) => expand(t).some(specPath));
9839
9837
  const dirToks = source.filter((t) => !t.startsWith("-") && !testToks.includes(t) && expand(t).some(dirPath));
9840
- if (testToks.length === 0 && dirToks.length === 0) continue;
9838
+ const gitResetHard = toks.some((t) => t === "git" || t.endsWith("/git")) && toks.some((t) => t === "--hard" || t === "--merge" || t === "--keep");
9839
+ if (testToks.length === 0 && dirToks.length === 0 && !(gitResetHard && rootHasProtected())) continue;
9841
9840
  const named = [...testToks, ...dirToks];
9842
9841
  let at = 0;
9843
9842
  while (at < toks.length && WRAPPERS.test(toks[at])) at++;
@@ -9856,9 +9855,19 @@ var init_test_deletion = __esm({
9856
9855
  const gitSub = cmd === "git" ? gitSubcommand(cmdToks) : null;
9857
9856
  const gitRestoresOld = (gitSub === "checkout" || gitSub === "restore") && (() => {
9858
9857
  const src = seg.match(/--source[= ]\s*(\S+)/)?.[1];
9858
+ const stagedRequested = cmdToks.includes("--staged") || cmdToks.includes("-S");
9859
+ const worktreeRequested = cmdToks.includes("--worktree") || cmdToks.includes("-W");
9860
+ const stagedOnly = stagedRequested && !worktreeRequested;
9861
+ if (stagedOnly) return false;
9859
9862
  const revIdx = cmdToks.findIndex((t, i) => i >= 2 && !t.startsWith("-") && !named.includes(t) && t !== "--");
9860
9863
  const rev2 = src ?? (revIdx >= 0 ? cmdToks[revIdx] : void 0);
9861
- if (!rev2 || rev2 === "HEAD" || rev2 === "@" || revIsHead(rev2, ctx) === true) return false;
9864
+ if (rev2 && (rev2 === "HEAD" || rev2 === "@" || revIsHead(rev2, ctx) === true)) return false;
9865
+ if (!rev2) {
9866
+ const stagedRequested2 = cmdToks.includes("--staged") || cmdToks.includes("-S");
9867
+ const worktreeRequested2 = cmdToks.includes("--worktree") || cmdToks.includes("-W");
9868
+ const stagedOnly2 = stagedRequested2 && !worktreeRequested2;
9869
+ return !stagedOnly2 && gitSub === "restore";
9870
+ }
9862
9871
  if (src || seg.includes(" -- ")) return true;
9863
9872
  return revIdx >= 0 && cmdToks.some((t, i) => i > revIdx && named.includes(t));
9864
9873
  })();
@@ -9894,6 +9903,8 @@ var init_test_deletion = __esm({
9894
9903
  why = "find -delete removes test files";
9895
9904
  } else if (gitRestoresOld) {
9896
9905
  why = "git checkout <rev> replaces a test file with an older version";
9906
+ } else if (gitSub === "reset" && gitResetHard) {
9907
+ why = "git reset can discard changes to a test file";
9897
9908
  } else if (cmd === "mv") {
9898
9909
  const dest = positional[positional.length - 1];
9899
9910
  if (dest && testToks.length > 0 && !isSpec(dest)) {
@@ -11144,7 +11155,7 @@ function annotations(findings) {
11144
11155
  });
11145
11156
  }
11146
11157
  function cell(s) {
11147
- return stripControl(s).replace(/\s+/g, " ").replace(/\|/g, "\\|").trim();
11158
+ return stripControl(s).replace(/\s+/g, " ").replace(/\\/g, "\\\\").replace(/\|/g, "\\|").trim();
11148
11159
  }
11149
11160
  function mdCode(s) {
11150
11161
  return s.replace(/`/g, "'").replace(/[\r\n]/g, " ");
@@ -14512,7 +14523,7 @@ function freezeRoot(kind, path) {
14512
14523
  }
14513
14524
  }
14514
14525
  function shellTokens(command) {
14515
- const matches = command.match(/(?:[^\s"'\\]+|"(?:\\.|[^"])*"|'[^']*')+/g) ?? [];
14526
+ const matches = command.match(/(?:[^\s"'\\]|"[^"\\]*(?:\\.[^"\\]*)*"|'[^']*')+/g) ?? [];
14516
14527
  return matches.map((token) => {
14517
14528
  if (token.startsWith("'") && token.endsWith("'") || token.startsWith('"') && token.endsWith('"')) return token.slice(1, -1);
14518
14529
  return token;
@@ -15079,7 +15090,7 @@ if (child) {
15079
15090
  // src/verifier-backend.ts
15080
15091
  import { createHash as createHash11, randomUUID } from "node:crypto";
15081
15092
  import { spawnSync as spawnSync2 } from "node:child_process";
15082
- import { accessSync as accessSync2, constants as constants3, readFileSync as readFileSync16, realpathSync as realpathSync7, statSync as statSync4 } from "node:fs";
15093
+ import { accessSync as accessSync2, constants as constants3, readFileSync as readFileSync15, realpathSync as realpathSync7, statSync as statSync4 } from "node:fs";
15083
15094
  import { delimiter as delimiter2, dirname as dirname7, join as join18, resolve as resolve7 } from "node:path";
15084
15095
  function identity() {
15085
15096
  const uid = typeof process.getuid === "function" ? process.getuid() : null;
@@ -15124,7 +15135,7 @@ function findExecutable(name) {
15124
15135
  return null;
15125
15136
  }
15126
15137
  function fileSha256(path) {
15127
- return createHash11("sha256").update(readFileSync16(path)).digest("hex");
15138
+ return createHash11("sha256").update(readFileSync15(path)).digest("hex");
15128
15139
  }
15129
15140
  function engineClientEnv() {
15130
15141
  return {
@@ -15558,7 +15569,7 @@ var init_verifier_backend = __esm({
15558
15569
  // src/cli/verify.ts
15559
15570
  import { execFileSync as execFileSync8, spawnSync as spawnSync3 } from "node:child_process";
15560
15571
  import { createHash as createHash12 } from "node:crypto";
15561
- import { chmodSync as chmodSync2, cpSync, lstatSync as lstatSync9, mkdirSync as mkdirSync8, mkdtempSync as mkdtempSync3, readFileSync as readFileSync17, readlinkSync as readlinkSync3, rmSync as rmSync7, symlinkSync, writeFileSync as writeFileSync9, existsSync as existsSync14 } from "node:fs";
15572
+ import { chmodSync as chmodSync2, cpSync, lstatSync as lstatSync9, mkdirSync as mkdirSync8, mkdtempSync as mkdtempSync3, readFileSync as readFileSync16, readlinkSync as readlinkSync3, rmSync as rmSync7, symlinkSync, writeFileSync as writeFileSync9, existsSync as existsSync14 } from "node:fs";
15562
15573
  import { tmpdir as tmpdir4 } from "node:os";
15563
15574
  import { dirname as dirname8, isAbsolute as isAbsolute11, join as join19, relative as relative5, resolve as resolve8, sep as sep3 } from "node:path";
15564
15575
  function oracleAssuranceReport() {
@@ -15779,7 +15790,7 @@ function overlayDigest(dest, paths) {
15779
15790
  try {
15780
15791
  const st = lstatSync9(p);
15781
15792
  h.update(String(st.mode));
15782
- h.update(st.isSymbolicLink() ? readlinkSync3(p) : readFileSync17(p));
15793
+ h.update(st.isSymbolicLink() ? readlinkSync3(p) : readFileSync16(p));
15783
15794
  } catch {
15784
15795
  h.update("<gone>");
15785
15796
  }
@@ -16493,7 +16504,7 @@ var init_verify = __esm({
16493
16504
  // src/cli/run.ts
16494
16505
  import { execFileSync as execFileSync9, spawn, spawnSync as spawnSync4 } from "node:child_process";
16495
16506
  import { randomBytes as randomBytes3 } from "node:crypto";
16496
- import { accessSync as accessSync3, constants as fsConstants, mkdtempSync as mkdtempSync4, readdirSync as readdirSync4, readFileSync as readFileSync18, readlinkSync as readlinkSync4, realpathSync as realpathSync9, rmSync as rmSync8, statSync as statSync5, writeFileSync as writeFileSync10 } from "node:fs";
16507
+ import { accessSync as accessSync3, constants as fsConstants, mkdtempSync as mkdtempSync4, readdirSync as readdirSync4, readFileSync as readFileSync17, readlinkSync as readlinkSync4, realpathSync as realpathSync8, rmSync as rmSync8, statSync as statSync5, writeFileSync as writeFileSync10 } from "node:fs";
16497
16508
  import { tmpdir as tmpdir5 } from "node:os";
16498
16509
  import { dirname as dirname9, join as join20, resolve as resolve9 } from "node:path";
16499
16510
  function authoritativeRunLifecyclePlatform(platform = process.platform) {
@@ -16548,7 +16559,7 @@ function trustedLinuxPython(candidates = DEFAULT_TRUSTED_PYTHON_CANDIDATES) {
16548
16559
  }
16549
16560
  for (const candidate of candidates) {
16550
16561
  try {
16551
- const real = realpathSync9(candidate);
16562
+ const real = realpathSync8(candidate);
16552
16563
  const st = statSync5(real);
16553
16564
  if (!st.isFile() || writableByCaller2(real)) continue;
16554
16565
  const probe = spawnSync4(
@@ -16647,7 +16658,7 @@ function runAgentSupervised(argv, cwd, budgetSecs, linuxPythonCandidates, lifecy
16647
16658
  }
16648
16659
  let state = {};
16649
16660
  try {
16650
- state = JSON.parse(readFileSync18(resultFile, "utf8"));
16661
+ state = JSON.parse(readFileSync17(resultFile, "utf8"));
16651
16662
  } catch {
16652
16663
  return {
16653
16664
  exit: 1,
@@ -16691,7 +16702,7 @@ function observerExited(pid) {
16691
16702
  if (!pidAlive3(pid)) return true;
16692
16703
  if (process.platform !== "linux") return false;
16693
16704
  try {
16694
- const stat = readFileSync18(`/proc/${pid}/stat`, "utf8");
16705
+ const stat = readFileSync17(`/proc/${pid}/stat`, "utf8");
16695
16706
  const state = stat.slice(stat.lastIndexOf(")") + 2).split(" ")[0];
16696
16707
  return state === "Z" || state === "X";
16697
16708
  } catch (e) {
@@ -16813,7 +16824,7 @@ function git3(args, cwd) {
16813
16824
  }
16814
16825
  function nowTicks() {
16815
16826
  try {
16816
- return Math.floor(parseFloat(readFileSync18("/proc/uptime", "utf8").split(" ")[0]) * 100);
16827
+ return Math.floor(parseFloat(readFileSync17("/proc/uptime", "utf8").split(" ")[0]) * 100);
16817
16828
  } catch {
16818
16829
  return Number.POSITIVE_INFINITY;
16819
16830
  }
@@ -16822,7 +16833,7 @@ function survivorsHoldingTree(cwd, spawnedAfterTicks) {
16822
16833
  const out3 = [];
16823
16834
  let real;
16824
16835
  try {
16825
- real = realpathSync9(cwd);
16836
+ real = realpathSync8(cwd);
16826
16837
  } catch {
16827
16838
  return out3;
16828
16839
  }
@@ -16836,7 +16847,7 @@ function survivorsHoldingTree(cwd, spawnedAfterTicks) {
16836
16847
  const n = Number(pid);
16837
16848
  if (n === process.pid) continue;
16838
16849
  try {
16839
- const stat = readFileSync18(`/proc/${pid}/stat`, "utf8");
16850
+ const stat = readFileSync17(`/proc/${pid}/stat`, "utf8");
16840
16851
  const startTicks = Number(stat.slice(stat.lastIndexOf(")") + 2).split(" ")[19]);
16841
16852
  if (!Number.isFinite(startTicks) || startTicks < spawnedAfterTicks) continue;
16842
16853
  } catch {
@@ -17408,7 +17419,7 @@ raise SystemExit(0)
17408
17419
 
17409
17420
  // src/cli/doctor.ts
17410
17421
  import { execFileSync as execFileSync10 } from "node:child_process";
17411
- import { existsSync as existsSync15, readFileSync as readFileSync19, readdirSync as readdirSync5 } from "node:fs";
17422
+ import { existsSync as existsSync15, readFileSync as readFileSync18, readdirSync as readdirSync5 } from "node:fs";
17412
17423
  import { join as join21, resolve as resolve10 } from "node:path";
17413
17424
  function lifecyclePlatformCheck(platform = process.platform, linuxPython = platform === "linux" ? trustedLinuxPython() : null) {
17414
17425
  if (platform === "linux") {
@@ -17467,7 +17478,7 @@ function pinsInFile(path) {
17467
17478
  if (!existsSync15(path)) return [];
17468
17479
  let src = "";
17469
17480
  try {
17470
- src = readFileSync19(path, "utf8");
17481
+ src = readFileSync18(path, "utf8");
17471
17482
  } catch {
17472
17483
  return [];
17473
17484
  }
@@ -17494,7 +17505,7 @@ function workflowPermissionCheck(cwd, workflowRels = [".github/workflows/tamperw
17494
17505
  }
17495
17506
  let doc;
17496
17507
  try {
17497
- doc = yaml.parse(readFileSync19(path, "utf8"));
17508
+ doc = yaml.parse(readFileSync18(path, "utf8"));
17498
17509
  } catch (e) {
17499
17510
  broken.push(`${rel} is not valid YAML (${e instanceof Error ? e.message : String(e)})`);
17500
17511
  continue;
@@ -17918,7 +17929,7 @@ function diagnose(opts = {}) {
17918
17929
  }
17919
17930
  let doc;
17920
17931
  try {
17921
- doc = yaml.parse(readFileSync19(workflowPath, "utf8"));
17932
+ doc = yaml.parse(readFileSync18(workflowPath, "utf8"));
17922
17933
  } catch (e) {
17923
17934
  return fail(
17924
17935
  "ci-verifier",
@@ -18097,9 +18108,9 @@ import { execFileSync as execFileSync11, spawnSync as spawnSync5 } from "node:ch
18097
18108
  import {
18098
18109
  existsSync as existsSync16,
18099
18110
  mkdtempSync as mkdtempSync5,
18100
- readFileSync as readFileSync20,
18111
+ readFileSync as readFileSync19,
18101
18112
  readdirSync as readdirSync6,
18102
- realpathSync as realpathSync10,
18113
+ realpathSync as realpathSync9,
18103
18114
  rmSync as rmSync9,
18104
18115
  symlinkSync as symlinkSync2
18105
18116
  } from "node:fs";
@@ -18116,7 +18127,7 @@ function parseStraceFileAccess(raw) {
18116
18127
  const call = line.match(/\b(execveat|execve|openat2|openat|open|newfstatat|fstatat|statx|lstat|stat|access|readlinkat|readlink)\s*\(/);
18117
18128
  if (!call) continue;
18118
18129
  const afterCall = line.slice((call.index ?? 0) + call[0].length);
18119
- const quoted = afterCall.match(/"((?:\\.|[^"])*)"/);
18130
+ const quoted = afterCall.match(/"([^"\\]*(?:\\.[^"\\]*)*)"/);
18120
18131
  if (!quoted) continue;
18121
18132
  const path = unescapeStraceString(quoted[1]);
18122
18133
  if (!path) continue;
@@ -18263,7 +18274,7 @@ function rewriteTraceRoot(accesses, actualRoot) {
18263
18274
  if (!inside3(actualRoot, abs)) return { ...item, path: abs };
18264
18275
  const rel = relative6(actualRoot, abs).split(sep4).join("/");
18265
18276
  try {
18266
- const real = resolve11(realpathSync10(abs));
18277
+ const real = resolve11(realpathSync9(abs));
18267
18278
  if (!inside3(actualRoot, real)) return { ...item, path: real };
18268
18279
  } catch {
18269
18280
  }
@@ -18302,7 +18313,7 @@ function straceOnce(root, command, budget) {
18302
18313
  }
18303
18314
  );
18304
18315
  const logs = traced.error ? [] : traceFiles(prefix);
18305
- const accesses = logs.flatMap((path) => parseStraceFileAccess(readFileSync20(path, "utf8")));
18316
+ const accesses = logs.flatMap((path) => parseStraceFileAccess(readFileSync19(path, "utf8")));
18306
18317
  const raw = {
18307
18318
  spawnError: traced.error ? traced.error.message : null,
18308
18319
  status: traced.status,
@@ -18532,7 +18543,7 @@ var init_trace_verify = __esm({
18532
18543
  });
18533
18544
 
18534
18545
  // src/runtimes.ts
18535
- import { existsSync as existsSync17, readFileSync as readFileSync21 } from "node:fs";
18546
+ import { existsSync as existsSync17, readFileSync as readFileSync20 } from "node:fs";
18536
18547
  import { join as join23 } from "node:path";
18537
18548
  function isRecord4(x) {
18538
18549
  return typeof x === "object" && x !== null && !Array.isArray(x);
@@ -18563,7 +18574,7 @@ function claudeSettingsBeyondTamperward(cwd) {
18563
18574
  let raw;
18564
18575
  try {
18565
18576
  if (!existsSync17(path)) return false;
18566
- raw = readFileSync21(path, "utf8");
18577
+ raw = readFileSync20(path, "utf8");
18567
18578
  } catch {
18568
18579
  return false;
18569
18580
  }
@@ -18670,7 +18681,7 @@ var init_runtimes = __esm({
18670
18681
 
18671
18682
  // src/cli/onboard.ts
18672
18683
  import { execFileSync as execFileSync12 } from "node:child_process";
18673
- import { lstatSync as lstatSync10, mkdtempSync as mkdtempSync6, readFileSync as readFileSync22, realpathSync as realpathSync11, rmSync as rmSync10 } from "node:fs";
18684
+ import { lstatSync as lstatSync10, mkdtempSync as mkdtempSync6, readFileSync as readFileSync21, realpathSync as realpathSync10, rmSync as rmSync10 } from "node:fs";
18674
18685
  import { tmpdir as tmpdir7 } from "node:os";
18675
18686
  import { join as join24, relative as relative7, resolve as resolve12, sep as sep5 } from "node:path";
18676
18687
  import { createInterface } from "node:readline";
@@ -18743,7 +18754,7 @@ function writeVerifyCommand(cwd, command) {
18743
18754
  return `${POLICY_FILE} is not a regular file; refusing to follow or replace a symlink or special file`;
18744
18755
  }
18745
18756
  const mode = existingMode(path, 420);
18746
- const original = kind === "file" ? readFileSync22(path, "utf8") : null;
18757
+ const original = kind === "file" ? readFileSync21(path, "utf8") : null;
18747
18758
  let next;
18748
18759
  try {
18749
18760
  const doc = parseDocument(original && original.trim() ? original : "version: 1\n");
@@ -18803,7 +18814,7 @@ async function runOnboard(opts, io = {}) {
18803
18814
  const cwd = resolve12(rootText);
18804
18815
  let sameRoot = cwd === requestedCwd;
18805
18816
  try {
18806
- sameRoot = realpathSync11(cwd) === realpathSync11(requestedCwd);
18817
+ sameRoot = realpathSync10(cwd) === realpathSync10(requestedCwd);
18807
18818
  } catch {
18808
18819
  }
18809
18820
  if (!sameRoot) {
@@ -19143,8 +19154,8 @@ function runDemo(cwd, head, runners, out3) {
19143
19154
  let worktreeRoot;
19144
19155
  let realTarget;
19145
19156
  try {
19146
- worktreeRoot = realpathSync11(wt);
19147
- realTarget = realpathSync11(targetPath);
19157
+ worktreeRoot = realpathSync10(wt);
19158
+ realTarget = realpathSync10(targetPath);
19148
19159
  } catch {
19149
19160
  out3("Demo skipped: the selected test could not be resolved safely inside the disposable worktree.");
19150
19161
  return;
@@ -19328,8 +19339,8 @@ var init_capture = __esm({
19328
19339
  });
19329
19340
 
19330
19341
  // src/research/manifest.ts
19331
- import { createHash as createHash14 } from "node:crypto";
19332
- import { readFileSync as readFileSync23 } from "node:fs";
19342
+ import { createHash as createHash13 } from "node:crypto";
19343
+ import { readFileSync as readFileSync22 } from "node:fs";
19333
19344
  import { dirname as dirname10, resolve as resolve14 } from "node:path";
19334
19345
  function taskFrom(raw, index, manifestDir) {
19335
19346
  const where = `task #${index + 1}`;
@@ -19363,7 +19374,7 @@ function readManifest(path) {
19363
19374
  const abs = resolve14(path);
19364
19375
  let bytes;
19365
19376
  try {
19366
- bytes = readFileSync23(abs);
19377
+ bytes = readFileSync22(abs);
19367
19378
  } catch (e) {
19368
19379
  throw new ResearchError(`cannot read task manifest ${abs}: ${e instanceof Error ? e.message : String(e)}`);
19369
19380
  }
@@ -19386,7 +19397,7 @@ function readManifest(path) {
19386
19397
  if (seen.has(t.id)) throw new ResearchError(`task manifest ${abs}: duplicate task id "${t.id}"`);
19387
19398
  seen.add(t.id);
19388
19399
  }
19389
- return { path: abs, sha256: createHash14("sha256").update(bytes).digest("hex"), tasks };
19400
+ return { path: abs, sha256: createHash13("sha256").update(bytes).digest("hex"), tasks };
19390
19401
  }
19391
19402
  var MANIFEST_VERSION;
19392
19403
  var init_manifest = __esm({
@@ -19575,7 +19586,7 @@ var init_record = __esm({
19575
19586
 
19576
19587
  // src/research/run.ts
19577
19588
  import { execFileSync as execFileSync13 } from "node:child_process";
19578
- import { existsSync as existsSync18, mkdirSync as mkdirSync9, readFileSync as readFileSync24, renameSync as renameSync4, rmSync as rmSync11, writeFileSync as writeFileSync11 } from "node:fs";
19589
+ import { existsSync as existsSync18, mkdirSync as mkdirSync9, readFileSync as readFileSync23, renameSync as renameSync4, rmSync as rmSync11, writeFileSync as writeFileSync11 } from "node:fs";
19579
19590
  import { join as join25, resolve as resolve15 } from "node:path";
19580
19591
  function git6(args, cwd) {
19581
19592
  return execFileSync13("git", args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
@@ -19586,7 +19597,7 @@ function pairRecordPath(ledger, task, pair) {
19586
19597
  function resumableRecord(path, expected) {
19587
19598
  let raw;
19588
19599
  try {
19589
- raw = JSON.parse(readFileSync24(path, "utf8"));
19600
+ raw = JSON.parse(readFileSync23(path, "utf8"));
19590
19601
  } catch (e) {
19591
19602
  throw new ResearchError(`ledger record ${path} is malformed (${errorMessage(e).split("\n")[0]}); remove it to regenerate the pair, or use a new --out`);
19592
19603
  }
@@ -19626,12 +19637,15 @@ function writeRecordAtomically(path, text) {
19626
19637
  writeFileSync11(tmp, text);
19627
19638
  renameSync4(tmp, path);
19628
19639
  }
19640
+ function cloneArgs(repo, ws3) {
19641
+ return ["-c", "protocol.ext.allow=never", "clone", "-q", "--no-hardlinks", "--", repo, ws3];
19642
+ }
19629
19643
  function freshWorkspace(ledger, task, pair, arm, sourceBase) {
19630
19644
  const ws3 = join25(ledger, "workspaces", `${task.id}--${pair}--${arm}`);
19631
19645
  rmSync11(ws3, { recursive: true, force: true });
19632
19646
  mkdirSync9(join25(ledger, "workspaces"), { recursive: true });
19633
19647
  try {
19634
- execFileSync13("git", ["clone", "-q", "--no-hardlinks", task.repo, ws3], { stdio: ["ignore", "ignore", "pipe"], encoding: "utf8" });
19648
+ execFileSync13("git", cloneArgs(task.repo, ws3), { stdio: ["ignore", "ignore", "pipe"], encoding: "utf8" });
19635
19649
  } catch (e) {
19636
19650
  throw new ResearchError(`task "${task.id}": cannot clone ${task.repo}: ${errorMessage(e).split("\n")[0]}`);
19637
19651
  }
@@ -20009,7 +20023,7 @@ var init_run2 = __esm({
20009
20023
  });
20010
20024
 
20011
20025
  // src/research/summarize.ts
20012
- import { readdirSync as readdirSync7, readFileSync as readFileSync25 } from "node:fs";
20026
+ import { readdirSync as readdirSync7, readFileSync as readFileSync24 } from "node:fs";
20013
20027
  import { join as join26, resolve as resolve16 } from "node:path";
20014
20028
  function readLedger2(dir) {
20015
20029
  const pairsDir = join26(resolve16(dir), "pairs");
@@ -20024,7 +20038,7 @@ function readLedger2(dir) {
20024
20038
  const path = join26(pairsDir, n);
20025
20039
  let raw;
20026
20040
  try {
20027
- raw = JSON.parse(readFileSync25(path, "utf8"));
20041
+ raw = JSON.parse(readFileSync24(path, "utf8"));
20028
20042
  } catch (e) {
20029
20043
  throw new ResearchError(`ledger record ${path} is not valid JSON: ${errorMessage(e)}`);
20030
20044
  }
@@ -20731,7 +20745,7 @@ var init_main = __esm({
20731
20745
  // src/cli/index.ts
20732
20746
  init_hook_client();
20733
20747
  init_exit();
20734
- import { readFileSync as readFileSync26 } from "node:fs";
20748
+ import { readFileSync as readFileSync25 } from "node:fs";
20735
20749
  function loadMain() {
20736
20750
  return Promise.resolve().then(() => (init_main(), main_exports));
20737
20751
  }
@@ -20744,7 +20758,7 @@ async function launch(argv) {
20744
20758
  if (kind && hookServiceEnabled()) {
20745
20759
  let raw = null;
20746
20760
  try {
20747
- raw = readFileSync26(0, "utf8");
20761
+ raw = readFileSync25(0, "utf8");
20748
20762
  } catch {
20749
20763
  raw = null;
20750
20764
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamperward",
3
- "version": "2.30.1",
3
+ "version": "2.30.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",