tamperward 2.10.6 → 2.10.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 +16 -4
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -2869,21 +2869,33 @@ import { readFileSync as readFileSync3, realpathSync as realpathSync2 } from "no
2869
2869
  import { homedir } from "node:os";
2870
2870
  import { basename, dirname, isAbsolute as isAbsolute3, join as join5, posix } from "node:path";
2871
2871
  import { fileURLToPath } from "node:url";
2872
+ var PLAIN_SEMVER = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/;
2872
2873
  function shippedVersion() {
2873
2874
  try {
2874
2875
  const here = dirname(fileURLToPath(import.meta.url));
2875
2876
  for (const rel of ["../package.json", "../../package.json", "../../../package.json"]) {
2876
2877
  try {
2877
2878
  const pkg = JSON.parse(readFileSync3(join5(here, rel), "utf8"));
2878
- if (pkg.name === "tamperward" && pkg.version) return pkg.version;
2879
+ if (pkg.name === "tamperward" && typeof pkg.version === "string" && PLAIN_SEMVER.test(pkg.version)) {
2880
+ return pkg.version;
2881
+ }
2879
2882
  } catch {
2880
2883
  }
2881
2884
  }
2882
2885
  } catch {
2883
2886
  }
2884
- return "latest";
2887
+ return null;
2888
+ }
2889
+ var RESOLVED_TW_VERSION = shippedVersion();
2890
+ var TW_VERSION = RESOLVED_TW_VERSION ?? "0.0.0-unresolved";
2891
+ function requireShippedVersion() {
2892
+ if (RESOLVED_TW_VERSION === null) {
2893
+ throw new Error(
2894
+ "cannot resolve a plain TamperWard release version from package.json; refusing to generate canonical wiring"
2895
+ );
2896
+ }
2897
+ return RESOLVED_TW_VERSION;
2885
2898
  }
2886
- var TW_VERSION = shippedVersion();
2887
2899
  var PRE_TOOLS = ["Bash", "Edit", "Write", "MultiEdit", "NotebookEdit"];
2888
2900
  var PRE_MATCHER = PRE_TOOLS.join("|");
2889
2901
  var MARKER = "# tamperward: block agent shortcuts before they land";
@@ -2893,7 +2905,6 @@ var HOOK_CMD = `${NPX_AUTHORITY} tamperward@${TW_VERSION} hook claude${AUTHORITY
2893
2905
  var SWEEP_CMD = `${NPX_AUTHORITY} tamperward@${TW_VERSION} sweep claude${AUTHORITY_FAIL_CLOSED}`;
2894
2906
  var PRECOMMIT_CMD = `${NPX_AUTHORITY} tamperward@${TW_VERSION} check --staged`;
2895
2907
  var OURS = /^\s*npx --yes --global --userconfig=\/dev\/null --globalconfig=\/dev\/null\/npmrc-global --registry=https:\/\/registry\.npmjs\.org\/ --node-options=' ' --script-shell= --ignore-scripts --offline=false --prefer-online tamperward(?:@(\S+))? (?:(hook claude|sweep claude) \|\| \(echo tamperward: authority failed to start >&2 && exit 2\)|(check --staged))\s*$/;
2896
- var PLAIN_SEMVER = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/;
2897
2908
  function compareVersions(a, b) {
2898
2909
  if (!PLAIN_SEMVER.test(a) || !PLAIN_SEMVER.test(b)) return null;
2899
2910
  const pa = a.split(".").map(Number);
@@ -8092,6 +8103,7 @@ function planned(item, path, plan) {
8092
8103
  }
8093
8104
  }
8094
8105
  function planInit(cwd, opts = {}) {
8106
+ requireShippedVersion();
8095
8107
  return [
8096
8108
  planned("policy", POLICY_FILE, () => planPolicy(cwd)),
8097
8109
  planned("agent", ".claude/settings.json", () => planClaudeHooks(cwd)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamperward",
3
- "version": "2.10.6",
3
+ "version": "2.10.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",