How paperwave/claude-code-cli-leaked works
Claude Code is a terminal-based AI software-engineering assistant. The main user workflow is to submit a prompt, process it into model requests and tool activity, then present responses in the terminal; session data is also persisted. The tree also identifies command-driven configuration and MCP, remote bridge, agent, and task features. The README documents editing, shell, search, and git workflows, but their implementation files are absent from this tree. Source excerpts are partial, so uncertain internal wiring is omitted.
Main entry points: QueryEngine.ts Query engine · sessionStorage.ts Session storage · commands.ts Commands · cli.js CLI entry
Components 21
CLI interaction
- CLI entry
cli.js - Terminal interface
src/components/App.tsx - Commands
src/commands.ts - Prompt input
src/components/PromptInput/PromptInput.tsx - Message rendering
src/components/Messages.tsx
Assistant runtime
- Query engine
src/QueryEngine.ts - Input processing
- Model query loop
- Tool contract
src/Tool.ts - Tool permissions
src/components/permissions/FilePermissionDialog/usePermissionHandler.ts - Task tracking
src/hooks/useTasksV2.ts
Session and state
- Session storage
src/utils/sessionStorage.ts - Portable transcript access
src/utils/sessionStoragePortable.ts - Session history
src/assistant/sessionHistory.ts
Extensions and remote
- Agent commands
src/commands/agents/agents.tsx - MCP management
src/commands/mcp/mcp.tsx - MCP interface
src/components/mcp/index.ts - Remote bridge
src/bridge/bridgeMain.ts
Other components
- Terminal user
- Local filesystem
- Model service
Connections 20
- Terminal user → CLI entry: invokes
- CLI entry → Terminal interface: starts interface
- Terminal user → Prompt input: enters prompt
- Prompt input → Query engine: submits input
- Terminal interface → Commands: dispatches commands
- Query engine → Input processing: processes input
- Query engine → Model query loop: runs query
- Query engine → Session storage: flushes session
- Model query loop → Model service: requests completion
- Model query loop → Tool contract: uses tool definitions
- Query engine → Message rendering: yields results
- Tool permissions → Tool contract: authorizes use
- Session storage → Portable transcript access: reads transcripts
- Session history → Session storage: loads sessions
- Session storage → Local filesystem: reads and writes
- Task tracking → Local filesystem: watches task files
- Commands → Agent commands: routes agent commands
- Commands → MCP management: routes MCP commands
- MCP management → MCP interface: renders management UI
- Remote bridge → Local filesystem: accesses local state