@mutmutco/pi-plugin 4.1.15 → 4.1.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/pi-plugin",
3
- "version": "4.1.15",
3
+ "version": "4.1.17",
4
4
  "description": "MMI workflow skills and org gates delivery.",
5
5
  "author": {
6
6
  "name": "MMI Future",
@@ -339,7 +339,7 @@ function git(root, args) {
339
339
  * already trusts, and only ever feeds a read-only `git -C` probe. */
340
340
  function commandWorkingDirectory(command, base) {
341
341
  const [first] = boundedShellSegments(command);
342
- const match = /^cd\s+(?!-)(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))\s*$/.exec(first?.text ?? '');
342
+ const match = /^(?:cd|Set-Location)\s+(?!-)(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))\s*$/i.exec(first?.text ?? '');
343
343
  const target = match?.[1] ?? match?.[2] ?? match?.[3];
344
344
  if (!target || target.startsWith('~')) return null;
345
345
  const resolved = isAbsolute(target) ? target : (typeof base === 'string' && base ? resolve(base, target) : null);
@@ -404,7 +404,9 @@ function runTestCommandPolicy(input, { stdout = process.stdout } = {}) {
404
404
  });
405
405
  if (decision.testCommandsAllowed) return { denied: false, decision };
406
406
  } catch (error) {
407
+ // #5726: the deny aborts the ENTIRE tool call, so say so first — see the matching note below.
407
408
  const reason = 'TEST-POLICY TEST COMMAND REFUSED [test-command-policy-unresolvable]: '
409
+ + 'the ENTIRE command was aborted before execution; no segment ran, so any edit or other non-test step batched into the same call was NOT applied — re-run those steps separately. '
408
410
  + `a test-policy.json applies but its repository, policy, or task diff could not be established (${error.message}). `
409
411
  + 'Do not run tests; use policy-approved non-test verification, or repair the repository/base reference before retrying.';
410
412
  appendHookActivity({ event: 'PreToolUse', script: TEST_COMMAND_GATE_NAME, outcome: 'deny', action: reason, reasonId: 'test-command-policy-unresolvable', tool: input?.tool_name });
@@ -415,9 +417,14 @@ function runTestCommandPolicy(input, { stdout = process.stdout } = {}) {
415
417
  // gets pasted into PR bodies as verification, so a bare "the current diff" — with no statement of
416
418
  // WHICH diff — reads as a claim about the repo the author is working in even when the gate resolved
417
419
  // a different one. Naming the root makes a wrong resolution self-evident instead of quotable.
420
+ // #5726: a PreToolUse deny aborts the ENTIRE tool call before execution, but this refusal used to
421
+ // read as a verdict on the test segment alone. An agent that batched `<edit> && <test runner>` kept
422
+ // working believing the edit had landed when the deny had discarded it with the rest. Lead with the
423
+ // abort fact, mirroring the operator-input guard's "entire compound tool call was cancelled" wording.
418
424
  const reason = 'TEST-POLICY TEST COMMAND REFUSED [test-command-outside-mandatory-zone]: '
425
+ + 'the ENTIRE command was aborted before execution; no segment ran, so any edit or other non-test step batched into the same call was NOT applied — re-run those steps separately. '
419
426
  + `no path in ${root}'s task diff matches a mandatory glob in its test-policy.json. `
420
- + 'Verify that is the repository you meant before quoting this: it is resolved from the command\'s own `cd`, then the host cwd. '
427
+ + 'Verify that is the repository you meant before quoting this: it is resolved from a leading `cd` or `Set-Location` with a literal path, then the host cwd. '
421
428
  + 'Do not run tests; use policy-approved non-test verification, '
422
429
  + 'or touch and run mandatory-zone coverage only when the diff actually requires it.';
423
430
  appendHookActivity({ event: 'PreToolUse', script: TEST_COMMAND_GATE_NAME, outcome: 'deny', action: reason, reasonId: 'test-command-outside-mandatory-zone', tool: input?.tool_name });