← ClaudeAtlas

claude-wrap-conptylisted

Drive a REAL Claude Code TUI from code on Windows — spawn `claude.exe` on a pseudo-console (ConPTY), render its ANSI output into a readable screen, inject prompts as bracketed paste, and verify what actually landed in the session transcript on disk. This is the black-box test harness for Claude Code itself: what a headless `claude -p` can NEVER exercise (the Ink TUI's input box, startup modals, draft/type-ahead behavior, paste framing, the eaten-Enter class of bug). Ships a verified driver (`scripts/conpty_claude.py`, pywinpty + pyte) with a `selftest` that proves the whole chain on this machine in one tiny turn, plus `probe` / `send` / `raw` CLI verbs. Encodes the measured facts that make it work: `\r` submits while `\n` is a literal newline in the box; bracketed paste is the only atomic multi-line delivery; an inherited `CLAUDE_CODE_CHILD_SESSION` SILENTLY DISABLES transcript saving (so every on-disk verification fails for a reason nothing on screen explains) — the trap for any wrapper launched from inside
Nucs/Agentmaster · ★ 1 · AI & Automation · score 74
Install: claude install-skill Nucs/Agentmaster
# Driving the Claude Code TUI under ConPTY Claude Code's interactive mode is an **Ink (React-for-terminals) TUI**. It only behaves like itself when its stdin/stdout is a **real TTY** — on Windows that means a **pseudo-console (ConPTY)**. A plain pipe makes it degrade or refuse; `claude -p` is a different, non-interactive code path entirely. So this is the harness for everything `-p` can't reach: the input box, startup modals, paste framing, type-ahead queuing, draft handling, and the "the TUI ate my submit Enter" class of bug. **The contract:** drive it like a user (bytes into a pty), but **never assert on the screen** — assert on the **transcript on disk**. The screen repaints constantly and is a rendering, not a fact. The screen is for *waiting* and *diagnosing*; the `.jsonl` is for *verifying*. ## Quickstart ```bash S=".claude/skills/claude-wrap-ConPTY/scripts/conpty_claude.py" python "$S" selftest --cwd "C:/some/trusted/dir" # 11 checks, one tiny turn — run this first python "$S" probe --cwd "C:/some/trusted/dir" # spawn, wait for the box, dump the screen python "$S" send "What is 2+2?" --verify --wait-idle --cwd "C:/some/trusted/dir" python "$S" raw --seconds 10 --out raw.txt # the escape stream, for parser work ``` Exit codes: `0` ok · `1` verification failed · `3` blocked by a startup modal · `4` never ready. Add `--answer-modals` to auto-answer known modals that have a safe answer (read the caveat in §3 before you rely on it). The **screen goes t