Commit 6e16997
committed
feat(claude-code): hook emitter wires real Claude work → inspector
The producer side of the real-data wire-up. After installing, every
PreToolUse / PostToolUse / UserPromptSubmit / Stop / etc. event from
Claude Code emits a bridge JSONL line to a local file, where the
inspector's --tail mode picks it up.
- scripts/hooks/claude-code-emit.mjs (~ stdlib-only Node ESM):
reads the hook payload from stdin, translates by --event flag to
a bridge wire-format event, appends to ~/.cache/enchanter/claude-
code.jsonl (XDG_CACHE_HOME / LOCALAPPDATA / HOME-cache fallback).
Errors → sibling .err file; exit 0 always so a misconfigured hook
never blocks Claude Code. Truncates large fields to 16 KB and
rotates the file at 5 MB to .1 to prevent unbounded growth.
- scripts/hooks/install-hooks.mjs: idempotent installer that adds
the hook entries to ~/.claude/settings.json. Run once; re-run to
uninstall via --uninstall.
- docs/claude-code-integration.md: walkthrough + hook → wire-event
mapping table + privacy notes (data stays on the local machine,
truncated, file-rotated).
- README.md: short subsection pointing at the doc.
- bridge.ts: tighten the typecheck guard on event.phase (was
comparing a typed enum to '' which TS rejects).
End-to-end loop:
cd client/enchanter
node scripts/hooks/install-hooks.mjs
enchanter inspect --tail ~/.cache/enchanter/claude-code.jsonl
# ... use Claude Code in another terminal; cockpit lights up1 parent 3673abd commit 6e16997
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
0 commit comments