Repository navigation
fix(agent-config): route Claude Code's PowerShell tool to gate-bash - #1110
Merged
sandstream merged 3 commits intoNov 27, 2026
Merged
Conversation
kit wired the Claude Code install gate with the matcher `Bash`, so a command Claude Code ran through its `PowerShell` tool never reached `kit gate-bash`. The Claude Code hooks reference says to "Match `Bash|PowerShell` in hooks that inspect shell commands" and that "A hook that matches only `Bash` never fires there" (Windows without Git Bash). - New installs write `Bash|PowerShell` (src/gate-bash-matcher.ts). - gateLiveness reports `Bash`-only gate-bash matchers (project and user settings); `kit check` fails enforcement gate liveness on one. - `kit agent-config` (installInstallGate) and `kit hooks gates` widen a stale matcher in place, moving kit's gate out of a shared group and never leaving two gate-bash entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the already-installed branch (command refresh plus matcher widening) into refreshInstallGate, and stop exporting SHELL_TOOLS (self-audit: unreferenced export). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published. |
CI standards failed: src/agent-config.ts grew past its frozen size (1780 lines) and the gateLiveness describe block in agent-config.test.ts changed hash while over 80 lines. Keep GateLiveness as it was and read stale gate-bash matchers in gate-bash-matcher.ts (staleGateBashMatchersFor: project and user settings). The command refresh takes an optional widen step instead of a new helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published. |
sandstream
deleted the
claude/web-kit-status-sync-p6fg9a-protected-pwsh-matcher
branch
November 27, 2026 11:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Protected change (
src/agent-config.ts): the owner's to merge. macOS is unverified (no CI job runs macOS), and nobody has run this against a live Claude Code on Windows.Problem
kit installed Claude Code's PreToolUse hook for
kit gate-bashwith the matcherBash. Claude Code also has aPowerShelltool, so a command run through it never reached the gate.npm install <untriaged>andirm … | iexsent through PowerShell ran unchecked.Evidence for the tool name and matcher
kit-research
clickfix-vs-kit-install-gatelisted this as not verified. The Claude Code hooks reference (https://code.claude.com/docs/en/hooks) says:command", and "MatchBash|PowerShellin hooks that inspect shell commands, so they cover both tools: … On Windows without Git Bash, the tool is enabled automatically and Claude Code doesn't register the Bash tool at all. A hook that matches onlyBashnever fires there."_,-, spaces,,and|is a list of exact names.Bash|PowerShellis read as two exact names, not as a regular expression.The gate does not depend on the tool name: it reads
tool_input.command.src/install-gate-pipe-interp.test.tsalready showsgate-bashexiting 2 fortool_name: "PowerShell".Change
src/gate-bash-matcher.ts(new) holdsGATE_BASH_MATCHER = "Bash|PowerShell",matcherSelects(Claude Code's documented matcher rules),staleGateBashMatchersandwidenGateBashMatchers.installInstallGatewritesBash|PowerShell. When the gate is already installed, it widens a stale matcher in place:gate-bashentry.staleGateBashMatchersForreads stale matchers in the project's.claude/settings*.jsonand in~/.claude/settings.json.GateLivenessis unchanged.kit check(enforcement gate liveness) fails withmatcher "Bash" does not select both of Claude Code's shell tools (Bash, PowerShell) … Run: kit agent-config. Thekit hooks gatesSessionStart path treats a stale matcher as not wired, so it repairs it.kit agent-config, the remediation this check already names.kit fixdoes not touch PreToolUse gates today, and this PR does not change that.docs/ENFORCEMENT_AND_AUDIT.md, thekit gate-bashrow indocs/COMMANDS.md, andchanges/pwsh-matcher.md.Tests
src/gate-bash-matcher.test.ts:PowerShell. This test fails onmainwithmatcher Bash must select PowerShell.kit checkfails on an oldBash-only entry.installInstallGatewidens it to exactly oneBash|PowerShellgroup with one hook, a second run isunchanged, and the check then passes.matcherSelectsfollows the documented rules.Fixtures that stand for a current install were updated to the new matcher.
Other harnesses, not changed
kit's harness fixtures (kit-research
caniuse-agent-gates) document no separate PowerShell tool for any other harness, so none was changed. These are unverified on Windows:.claude/settings.jsonhooks, so it gets the new matcher, but its Windows shell tool name is not documented in the fixtures.^Bash$), Amazon Q and Kiro (execute_bash), Droid (Execute), Augment (bash|launch-process), Antigravity (run_command) and Cline (execute_command) name one shell tool each. Nothing in kit says whether they have a separate PowerShell tool."") and Cursor (beforeShellExecution) are not tied to a tool name.bashandshell.Not in this PR
gate-egress(exec-broker, opt-in) is also installed with the matcherBashand has the same gap.gate-bashin both shells:iwr URL -OutFile x.exe; & .\x.exeandcurl -o x URL; ./xboth exit 0. Only a download piped or wrapped intoiex/a shell is refused.Generated by Claude Code