From af7dbf7a8f44ec0f11520db5b0582a3a5d5948b6 Mon Sep 17 00:00:00 2001 From: claudioemmanuel <42774167+claudioemmanuel@users.noreply.github.com> Date: Tue, 28 Apr 2026 15:52:14 -0300 Subject: [PATCH] fix(session-start): health check missed top-level event keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The squeez install patches `~/.claude/settings.json` by writing hook arrays at top-level event keys (settings.PreToolUse, settings.SessionStart, settings.PostToolUse). Other tools nest under settings.hooks.* — Claude Code reads both shapes for backwards compat. The G0 health check shipped in #90 only inspected settings.hooks.* and falsely reported "missing" on installs where squeez hooks live at the top level. Now scans both buckets plus the statusLine slot. Signed-off-by: claudioemmanuel <42774167+claudioemmanuel@users.noreply.github.com> --- hooks/session-start.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/hooks/session-start.sh b/hooks/session-start.sh index ee51983..7938ef9 100755 --- a/hooks/session-start.sh +++ b/hooks/session-start.sh @@ -14,14 +14,24 @@ _settings="$HOME/.claude/settings.json" if [ -f "$_settings" ]; then _has_squeez=$(python3 -c " import json, sys +HOOK_EVENTS = ('PreToolUse', 'PostToolUse', 'SessionStart', 'UserPromptSubmit', 'Stop') try: d = json.load(open(sys.argv[1])) - hooks = d.get('hooks', {}) if isinstance(d, dict) else {} - for entries in hooks.values(): - for e in (entries if isinstance(entries, list) else []): - for h in (e.get('hooks', []) if isinstance(e, dict) else []): - if 'squeez' in str(h.get('command', '')): - print('ok'); sys.exit(0) + if not isinstance(d, dict): + print('ok'); sys.exit(0) + # Squeez writes hooks at top-level event keys; some other tools nest under 'hooks.*'. + # Check both shapes plus the statusLine slot. + candidates = [d.get('hooks', {}) if isinstance(d.get('hooks'), dict) else {}] + candidates.append({k: d.get(k) for k in HOOK_EVENTS if k in d}) + for bucket in candidates: + for entries in bucket.values(): + for e in (entries if isinstance(entries, list) else []): + for h in (e.get('hooks', []) if isinstance(e, dict) else []): + if 'squeez' in str(h.get('command', '')): + print('ok'); sys.exit(0) + sl = d.get('statusLine', {}) + if isinstance(sl, dict) and 'squeez' in str(sl.get('command', '')): + print('ok'); sys.exit(0) print('missing') except Exception: print('ok')