Skip to content

MLAI-1333 - Run skill-governance hooks through a node launcher for Windows - #88

Merged
nadav-dvir merged 3 commits into
mainfrom
windows-node-hook-launcher
Oct 26, 2026
Merged

nadav-dvir merged 3 commits into
mainfrom
windows-node-hook-launcher

Conversation

@nadav-dvir

Copy link
Copy Markdown
Collaborator

VS Code runs hook strings with PowerShell on Windows, which cannot parse the POSIX env prefix and $(date) in the old one-liner, so skills ran unchecked.

  • plugin/scripts/enforce-skill.mjs: computes the enforcement deadline, sets the npm fetch bounds, and spawns npx @jfrog/agent-guard --enforce-skill --client vscode (npx.cmd through cmd.exe on Windows). Exit 2 and stdout pass through; a spawn failure fails open.
  • hooks.json: UserPromptSubmit and PreToolUse (--prefer-offline) start the launcher.
  • validate-skill-governance.mjs: asserts the launcher wiring and the Windows spawn plan, and executes the real hook strings against a stub npx.

Mirrors the same launcher in jfrog/claude-plugin.

VS Code runs hook strings with PowerShell on Windows, which cannot parse the
POSIX env prefix and $(date) in the old one-liner, so skills ran unchecked.

- plugin/scripts/enforce-skill.mjs: computes the enforcement deadline, sets
  the npm fetch bounds, and spawns `npx @jfrog/agent-guard --enforce-skill
  --client vscode` (npx.cmd through cmd.exe on Windows). Exit 2 and stdout
  pass through; a spawn failure fails open.
- hooks.json: UserPromptSubmit and PreToolUse (--prefer-offline) start the
  launcher.
- validate-skill-governance.mjs: asserts the launcher wiring and the Windows
  spawn plan, and executes the real hook strings against a stub npx.

Mirrors the same launcher in jfrog/claude-plugin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nadav-dvir
nadav-dvir requested a review from a team as a code owner October 15, 2026 11:32
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Comment thread plugin/scripts/enforce-skill.mjs Resolved
Comment thread plugin/scripts/enforce-skill.mjs Resolved
Comment thread plugin/scripts/enforce-skill.mjs Resolved
Comment thread scripts/validate-skill-governance.mjs Resolved
Comment thread scripts/validate-skill-governance.mjs Resolved
Comment thread scripts/validate-skill-governance.mjs Resolved
Comment thread scripts/validate-skill-governance.mjs Resolved
VS Code's PreToolUse denies the tool call on any non-zero exit other than
2, so the launcher's exit 1 on a spawn error, signal or npx failure blocked
every tool call instead of failing open. The launcher now buffers the
child's stdout and passes through only exit 0 or 2 with that output; every
other outcome prints {} and exits 0.

On Windows it runs npm's npx-cli.js with node and no shell, falling back
to npx.cmd under cmd.exe only when npm is not beside node.exe. The fallback
refuses arguments cmd.exe cannot carry (%, ", CR/LF) instead of the %%
escaping, which cmd /c does not undo. The registry comes from the shared
resolveAgentGuardNpmRegistry.

Spawn-plan and exit-code coverage moves to plugin/scripts/enforce-skill.test.mjs
with a fake spawn. The validator now asserts exit 0 and {} for fail-open,
and drops the date(1), POSIX-sh and top-level ';' checks that no longer
test anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nadav-dvir
nadav-dvir requested a review from a team as a code owner October 26, 2026 13:00
Comment thread README.md Resolved
Comment thread plugin/scripts/enforce-skill.mjs Resolved
Every fail-open path in the launcher now writes one stderr line naming the
cause and stating that the skill was not governed, so a silent allow is
diagnosable. The README no longer claims a missing node fails open: the
hook command fails before the launcher starts, and PreToolUse denies any
exit other than 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nadav-dvir

Copy link
Copy Markdown
Collaborator Author

I have read the CLA Document and I hereby sign the CLA

@nadav-dvir
nadav-dvir merged commit 0f053f6 into main Oct 26, 2026
4 of 5 checks passed
@nadav-dvir
nadav-dvir deleted the windows-node-hook-launcher branch October 26, 2026 19:21
yanivt-jfrog pushed a commit that referenced this pull request Oct 28, 2026
v1.1.4 was already released from #90, so the release for #88 (Windows
skill-governance launcher) stopped at the version gate. 1.1.5 publishes it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants