Expand description
Hook binary logic — reads .symforge/sidecar.port, calls sidecar over sync HTTP,
and outputs a single JSON line to stdout.
Design constraints (HOOK-10):
- The ONLY thing written to stdout is the final JSON line.
- No tokio runtime. No tracing to stdout. No eprintln except for genuine errors.
- Sync I/O throughout — hooks must complete in well under 100 ms.
- Fail-open: if the sidecar is unreachable for any reason, output empty additionalContext JSON so Claude Code continues normally.
Functions§
- event_
name_ for - Returns the
hookEventNamestring for a given subcommand. - fail_
open_ json - Returns the fail-open JSON: empty
additionalContext. - run_
hook - Entry point called by main.rs for
symforge hook [subcommand]. - success_
json - Returns the success JSON with
contextas theadditionalContextvalue.