tamperward 2.39.5 → 2.39.7

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 +22 -4
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -1239,11 +1239,26 @@ function git(args, cwd) {
1239
1239
  throw new Error(detail ? `git ${args[0]}: ${detail}` : failure.message || `git ${args[0]} failed`);
1240
1240
  }
1241
1241
  }
1242
+ function entryKindAt(rev2, path, cwd) {
1243
+ const listing = rev2 === "" ? git(["ls-files", "-s", "-z", "--", `:(literal)${path}`], cwd) : git(["ls-tree", "-z", rev2, "--", `:(literal)${path}`], cwd);
1244
+ for (const record of listing.split("\0")) {
1245
+ const tab = record.indexOf(" ");
1246
+ if (tab === -1 || record.slice(tab + 1) !== path) continue;
1247
+ const meta2 = record.slice(0, tab).split(" ");
1248
+ const mode = meta2[0] ?? "";
1249
+ const isBlob = rev2 === "" ? mode !== "160000" && !mode.startsWith("04") : meta2[1] === "blob";
1250
+ return isBlob ? "blob" : "other";
1251
+ }
1252
+ return "absent";
1253
+ }
1242
1254
  function blobAt(rev2, path, cwd) {
1243
1255
  try {
1244
1256
  return git(["show", `${rev2}:${path}`], cwd);
1245
- } catch {
1246
- return null;
1257
+ } catch (e) {
1258
+ if (entryKindAt(rev2, path, cwd) !== "blob") return null;
1259
+ const detail = (e instanceof Error ? e.message : String(e)).split("\n")[0];
1260
+ const where = rev2 === "" ? "the index entry " : `${rev2}:`;
1261
+ throw new Error(`cannot read ${where}${path} although the tree lists it as a blob (${detail}); refusing to judge it as absent`);
1247
1262
  }
1248
1263
  }
1249
1264
  function fromDisk(path, cwd) {
@@ -15895,8 +15910,10 @@ function surfacePaths(base, cwd, policy) {
15895
15910
  let listing;
15896
15911
  try {
15897
15912
  listing = git2(["ls-tree", "-r", "--name-only", "-z", base], cwd);
15898
- } catch {
15899
- return [];
15913
+ } catch (e) {
15914
+ const failure = execFailure(e);
15915
+ const detail = failure.stderr.trim().split("\n")[0] || failure.message.split("\n")[0];
15916
+ throw new Error(`cannot list the protected verification surface at base ${base}: ${detail}`);
15900
15917
  }
15901
15918
  const inputs = policy.verify?.inputs ?? [];
15902
15919
  return listing.split("\0").filter(Boolean).filter((p) => isProtected(p, policy) || matchesAny(p, inputs)).sort();
@@ -16194,6 +16211,7 @@ var init_verification_state = __esm({
16194
16211
  init_trusted();
16195
16212
  init_fingerprint();
16196
16213
  init_policy();
16214
+ init_narrow();
16197
16215
  init_policy_load();
16198
16216
  init_repo_context();
16199
16217
  init_wiring();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamperward",
3
- "version": "2.39.5",
3
+ "version": "2.39.7",
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",