Documentation
¶
Overview ¶
Command substrate-guard fails the build if any claude-TUI substrate literal appears in pyrycode .go source outside an explicit allowlist.
The substrate — claude's on-screen literals, escape sequences, and glyphs — is owned by github.com/pyrycode/tui-driver. A consumer that hardcodes those literals drifts on every claude self-update and silently re-couples to the internals tui-driver exists to hide. The compiler seal (unexported buffer / pty, no public Write, no Mirror tap) stops a consumer reaching the substrate through the Session API; this guard is the second, different-fabric check for the hole the compiler cannot see: a hardcoded screen string or escape sequence in a string literal or comment.
Run via `make substrate-guard` (wired into `make check` and the check.yml PR gate). Scans every .go file under the repo root, skipping the allowlist; exits non-zero and prints file:line for every hit.
Allowlist: the two sanctioned fake-claude helpers, which legitimately emit these literals to simulate claude's TUI — internal/agentrun/ptyrunner/ helper_test.go for the ptyrunner integration tests, and internal/e2e/ internal/fakeclaude/main.go for the relay/send_message e2e flows (#603) — and this guard's own source, which must name the patterns it bans.