tamperward 2.30.1 → 2.30.2

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 +15 -2
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -9837,7 +9837,8 @@ var init_test_deletion = __esm({
9837
9837
  fed.push(...toks);
9838
9838
  const testToks = source.filter((t) => expand(t).some(specPath));
9839
9839
  const dirToks = source.filter((t) => !t.startsWith("-") && !testToks.includes(t) && expand(t).some(dirPath));
9840
- if (testToks.length === 0 && dirToks.length === 0) continue;
9840
+ const gitResetHard = toks.some((t) => t === "git" || t.endsWith("/git")) && toks.some((t) => t === "--hard" || t === "--merge" || t === "--keep");
9841
+ if (testToks.length === 0 && dirToks.length === 0 && !(gitResetHard && rootHasProtected())) continue;
9841
9842
  const named = [...testToks, ...dirToks];
9842
9843
  let at = 0;
9843
9844
  while (at < toks.length && WRAPPERS.test(toks[at])) at++;
@@ -9856,9 +9857,19 @@ var init_test_deletion = __esm({
9856
9857
  const gitSub = cmd === "git" ? gitSubcommand(cmdToks) : null;
9857
9858
  const gitRestoresOld = (gitSub === "checkout" || gitSub === "restore") && (() => {
9858
9859
  const src = seg.match(/--source[= ]\s*(\S+)/)?.[1];
9860
+ const stagedRequested = cmdToks.includes("--staged") || cmdToks.includes("-S");
9861
+ const worktreeRequested = cmdToks.includes("--worktree") || cmdToks.includes("-W");
9862
+ const stagedOnly = stagedRequested && !worktreeRequested;
9863
+ if (stagedOnly) return false;
9859
9864
  const revIdx = cmdToks.findIndex((t, i) => i >= 2 && !t.startsWith("-") && !named.includes(t) && t !== "--");
9860
9865
  const rev2 = src ?? (revIdx >= 0 ? cmdToks[revIdx] : void 0);
9861
- if (!rev2 || rev2 === "HEAD" || rev2 === "@" || revIsHead(rev2, ctx) === true) return false;
9866
+ if (rev2 && (rev2 === "HEAD" || rev2 === "@" || revIsHead(rev2, ctx) === true)) return false;
9867
+ if (!rev2) {
9868
+ const stagedRequested2 = cmdToks.includes("--staged") || cmdToks.includes("-S");
9869
+ const worktreeRequested2 = cmdToks.includes("--worktree") || cmdToks.includes("-W");
9870
+ const stagedOnly2 = stagedRequested2 && !worktreeRequested2;
9871
+ return !stagedOnly2 && gitSub === "restore";
9872
+ }
9862
9873
  if (src || seg.includes(" -- ")) return true;
9863
9874
  return revIdx >= 0 && cmdToks.some((t, i) => i > revIdx && named.includes(t));
9864
9875
  })();
@@ -9894,6 +9905,8 @@ var init_test_deletion = __esm({
9894
9905
  why = "find -delete removes test files";
9895
9906
  } else if (gitRestoresOld) {
9896
9907
  why = "git checkout <rev> replaces a test file with an older version";
9908
+ } else if (gitSub === "reset" && gitResetHard) {
9909
+ why = "git reset can discard changes to a test file";
9897
9910
  } else if (cmd === "mv") {
9898
9911
  const dest = positional[positional.length - 1];
9899
9912
  if (dest && testToks.length > 0 && !isSpec(dest)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamperward",
3
- "version": "2.30.1",
3
+ "version": "2.30.2",
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",