← ClaudeAtlas

pty-portable-debugginglisted

vibe-editor の PTY (`src-tauri/src/pty/`, portable-pty + xterm.js) のデバッグ・拡張時に必ず使う skill。reader thread / mpsc / batcher (16ms or 32KB) / tauri emit のデータフロー、Windows ConPTY の罠 (環境変数 escape / 親プロセス終了後の zombie / パス区切り)、文字化け対策 (CP932 / Shift_JIS encoding_rs, Issue
yusei531642/vibe-editor · ★ 3 · Code & Development · score 69
Install: claude install-skill yusei531642/vibe-editor
# pty-portable-debugging vibe-editor のターミナル基盤 (`src-tauri/src/pty/`) は **portable-pty + 自前 batcher + Tauri emit** という 3 層構造で、Windows / Unix 双方の罠を内部で吸収している。 このレイヤを触る作業 (新機能追加 / デバッグ / 退行修正) はミスのコストが大きいので、必ずこの skill のチェックリストに沿う。 --- ## データフロー (これを最初に頭に入れる) ``` (1) spawn_session(SpawnOptions) │ ▼ ┌────────────────────────────────┐ │ portable-pty PtyPair (Windows │ │ は ConPTY、Unix は openpty) │ └──────┬───────────────────┬─────┘ │ master read │ master write ▼ ▲ ┌──────────────────┐ ┌──────────────────────┐ │ reader 標準スレ │ │ writer (Mutex 保護) │ ← user_input / paste │ ブロッキング read│ └──────────────────────┘ └────┬─────────────┘ │ Vec<u8> ▼ mpsc::Sender<...> ▼ ┌──────────────────────────┐ │ batcher (16ms or 32KB) │ ← Issue #119 の hash 計算もここ近辺 └────┬─────────────────────┘ │ chunked Vec<u8> ▼ tauri::AppHandle::emit("pty:data", ...) ▼ Renderer (xterm.js) — UnlistenFn で購読 ``` 主要ファイル: - `src-tauri/src/pty/session.rs` — spawn / lifecycle (SpawnOptions / UserWriteOutcome) - `src-tauri/src/pty/registry.rs` — SessionRegistry (AppState 経由で共有) - `src-tauri/src/pty/batcher.rs` — 出力束ね (16ms / 32KB) - `src-tauri/src/pty/claude_watcher.rs` — Claude Code の session id 検出 (resume 用) - `src-tauri/src/pty/path_norm.rs` — Windows パス正規化 - `src-tauri/src/commands/