Skip to content

Commit fa53a64

Browse files
Nick Sullivanclaude
andcommitted
🐛 Fix hook checks for user-project context and missing settings fallback
- Hook script file checks now scoped to source-repo only; user-project context checks hooks registration in settings instead of script files - auto-fix chmod also scoped to source-repo only context - Settings check now reads .claude/settings.json if present, falls back to ~/.claude/settings.json for projects using only global settings Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5ecf04d commit fa53a64

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

plugins/core/commands/ai-coding-config.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -585,21 +585,23 @@ ls -la "$(pwd)/rules"
585585

586586
### Hook Scripts
587587

588-
Read `plugins/core/hooks/hooks.json` with the Read tool to get declared hooks. Use Glob
589-
to list `plugins/core/hooks/*.sh`, then check each file individually:
588+
**Source repo:** Read `plugins/core/hooks/hooks.json` with the Read tool to get
589+
declared hooks. Use Glob to list `plugins/core/hooks/*.sh`, then check each file:
590590

591591
- ✅ File exists, executable (`-x`), and first line is `#!/bin/bash`
592592
- ⚠️ Exists but not executable → offer to auto-fix: `chmod +x <path>`
593593
- ❌ File missing → note as broken
594594

595-
Check that hooks are registered in project or global settings:
595+
**User project:** Hook script files are managed by the plugin cache — skip the script
596+
file checks. Instead, verify hooks are registered in settings (see below).
596597

597-
```bash
598-
jq . .claude/settings.json > /dev/null 2>&1 && echo "valid" || echo "invalid"
599-
```
598+
Check that hooks are registered in project or global settings. Read `.claude/settings.json`
599+
if it exists; otherwise fall back to `~/.claude/settings.json`:
600600

601-
-`settings.json` parses as valid JSON
602-
- ❌ Invalid JSON → note the parse error from jq output
601+
- ✅ Settings file parses as valid JSON and contains hook entries
602+
- ⚠️ Valid JSON but no hooks registered → hooks won't fire; suggest running `/ai-coding-config update`
603+
- ❌ Invalid JSON → note the parse error
604+
- ℹ️ No local `.claude/settings.json` and global settings has no hooks → hooks rely on plugin marketplace loading
603605

604606
### Marketplace JSON Consistency (source repo only)
605607

@@ -640,7 +642,8 @@ Report a single summary line per skill (not per field) to keep output scannable.
640642
</checks>
641643

642644
<auto-fix>
643-
Hook permissions are the only thing doctor auto-fixes (with user confirmation):
645+
Hook permissions are the only thing doctor auto-fixes (with user confirmation), and
646+
only in source-repo context where the script files are present:
644647

645648
"⚠️ todo-persist.sh is not executable. Fix now? [y/N]"
646649

0 commit comments

Comments
 (0)