Skip to content

Commit 36b7b18

Browse files
committed
test(smoke): expect Bash Claude hook matcher
Align the exact Claude PreToolUse smoke contract and documentation with the Bash-enabled search matcher. Signed-off-by: Jake Abendroth <contact@jakea.net>
1 parent 23dfea5 commit 36b7b18

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ overwrite user-modified agents.
441441

442442
| Agent | Activation | MCP config | Durable context / augmentation |
443443
|-------|------------|------------|--------------------------------|
444-
| Claude Code | Detected | `~/.claude.json` | Skill + three exact-tool graph agents; `SessionStart`, `SubagentStart`, non-blocking `PreToolUse` for `Grep`/`Glob`, and post-`Read` coverage |
444+
| Claude Code | Detected | `~/.claude.json` | Skill + three exact-tool graph agents; `SessionStart`, `SubagentStart`, non-blocking `PreToolUse` for `Grep`/`Glob`/`Bash`, and post-`Read` coverage |
445445
| Codex CLI | Detected | `$CODEX_HOME/config.toml` | `AGENTS.md`, skill, three read-only agents; `SessionStart` + `SubagentStart` |
446446
| Gemini CLI | Detected | `.gemini/settings.json` | `GEMINI.md`, three explicit read/graph-tool subagents; `BeforeTool`, `AfterTool` `read_file` coverage, and `SessionStart` |
447447
| Zed | Detected | platform `settings.json` (JSONC) | `AGENTS.md` + shared skill |
@@ -488,7 +488,7 @@ overwrite user-modified agents.
488488
### Sessions, compaction, and subagents
489489

490490
Hooks installed by this project are fail-open and context-only. Claude Code's
491-
`PreToolUse` observes `Grep`/`Glob` and injects matching graph symbols as
491+
`PreToolUse` observes `Grep`/`Glob`/`Bash` and injects matching graph symbols as
492492
`additionalContext`; `PostToolUse` on `Read` adds targeted coverage context when
493493
the graph could not fully parse or index that file. It never denies or replaces
494494
the requested tool call.

‎scripts/smoke-test.sh‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,23 +1415,23 @@ fi
14151415
echo "OK 8c-i: Claude exact-tool graph subagent"
14161416

14171417
# 8d: Claude Code hooks keep search augmentation and read-coverage reporting
1418-
# separate: PreToolUse matches exactly Grep|Glob, while PostToolUse matches
1418+
# separate: PreToolUse matches exactly Grep|Glob|Bash, while PostToolUse matches
14191419
# exactly Read. Neither hook may grow a Search or catch-all matcher.
14201420
if ! cat "$FAKE_HOME/.claude/settings.json" 2>/dev/null | python3 -c "
14211421
import json, sys
14221422
d = json.load(sys.stdin)
14231423
all_hooks = d.get('hooks', {})
14241424
pre = all_hooks.get('PreToolUse', [])
14251425
post = all_hooks.get('PostToolUse', [])
1426-
ok = (any(h.get('matcher') == 'Grep|Glob' for h in pre) and
1426+
ok = (any(h.get('matcher') == 'Grep|Glob|Bash' for h in pre) and
14271427
any(h.get('matcher') == 'Read' for h in post))
14281428
bad = any('Search' in str(h.get('matcher', '')) for h in pre + post)
14291429
sys.exit(0 if (ok and not bad) else 1)
14301430
" 2>/dev/null; then
14311431
echo "FAIL 8d: Claude search/read hook matchers are not exact"
14321432
exit 1
14331433
fi
1434-
echo "OK 8d: Claude Code PreToolUse Grep|Glob + PostToolUse Read"
1434+
echo "OK 8d: Claude Code PreToolUse Grep|Glob|Bash + PostToolUse Read"
14351435

14361436
# 8e: Claude Code shim script — must be non-blocking augmenter, not a gate.
14371437
# #929: Windows installs a .cmd script (extensionless bash shims triggered the

‎src/cli/cli.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ const char *cbm_get_aider_instructions(void);
283283
/* ── Pre-tool hook management ─────────────────────────────────── */
284284

285285
/* Upsert a PreToolUse hook in ~/.claude/settings.json for Claude Code.
286-
* Adds a Grep|Glob matcher that reminds to use MCP tools.
286+
* Adds a Grep|Glob|Bash matcher that reminds to use MCP tools.
287287
* Returns 0 on success. */
288288
int cbm_upsert_claude_hooks(const char *settings_path);
289289

0 commit comments

Comments
 (0)