diff --git a/CLAUDE.md b/CLAUDE.md index e03b27e..397875f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,11 +7,33 @@ Self-hosted remote control for Claude Code. Wrap CLI in PTY, stream output to se Pure Bun stack: no frameworks, minimal dependencies. Target ~1000-1500 lines total. Core tech: + - bun-pty for PTY wrapper (FFI to Rust, pre-built binaries) - bun:sqlite for persistence - Bun.serve() for HTTP + WebSocket + SSE - plain text output (no xterm.js) for mobile-friendly display +## References + +Inspiration and patterns to steal from: + +| Source | Path | What to look at | +| ---------- | ---------------- | ------------------------------------------------------------------ | +| crabigator | `../crabigator/` | Architecture, WebSocket protocol, cloud client, session management | +| bun-pty | `../bun-pty/` | PTY API, spawn patterns, event handling | + +Key files in crabigator: + +- `src/cloud/client.rs` - WebSocket connection, reconnection logic +- `src/cloud/events.rs` - event types for streaming +- `src/capture.rs` - output capture patterns +- `workers/crabigator-api/src/session-do.ts` - session state management + +Key files in bun-pty: + +- `src/index.ts` - spawn API, IPty interface +- `src/terminal.ts` - FFI bindings (for understanding internals) + ## Contribution policy If bun-pty needs changes, fork and contribute upstream. Don't vendor or patch locally. @@ -19,6 +41,7 @@ If bun-pty needs changes, fork and contribute upstream. Don't vendor or patch lo ## Workflow After making changes: + ```bash just check # lint + typecheck + test ```