$ show ayuayue/PiDeck
PiDeck is an open-source Electron desktop application that serves as a comprehensive workbench for AI coding agents, primarily wrapping the `pi` coding agent and the DeepSeek Harness (DSH) backend. It provides a rich session-centric chat workspace with features including multi-project management, Git integration, a built-in terminal, voice transcription, image generation, scheduled automation tasks, a desktop pet companion, and extensive configuration options. The application supports importing sessions from other tools like Claude, Codex, Cursor, and OpenCode, and offers a web service variant for remote access. Architecturally, PiDeck follows the standard Electron pattern with a main process (Node.js services, IPC handlers, filesystem operations), a preload script for secure IPC bridging, and a renderer process built with React 19, TypeScript, Jotai for state management, and Tailwind CSS v4 with shadcn/ui-style components. The codebase is organized into `src/main/` for backend services, `src/renderer/` for the UI, and `src/shared/` for cross-process types and utilities. Key entry points include the main process index, renderer bootstrap, and numerous IPC modules that validate inputs and delegate to domain services. Data flows center on session files stored in JSONL format (for pi) or compressed JSONL (for DSH), with model catalogs, usage statistics, and configuration persisted in user data directories. The application manages multiple backends through a unified session catalog, with runtime state synchronized via IPC events and Jotai atoms. External dependencies include the pi-coding-agent CLI, DSH runtime packages, node-pty for terminal emulation, whisper.cpp for local speech-to-text, and electron-updater for cross-platform updates. The codebase demonstrates strong engineering practices with extensive unit tests (node:test), Playwright E2E tests, pure-function modules extracted for testability, and consistent IPC boundary validation patterns.
The LLM identified 5 files worth highlighting for reuse:
A shared constant module that defines the mapping of model thinking levels (e.g., 'none', 'low', 'medium', 'high') to numeric values. It is explicitly designed to be the single source of truth consumed by three different parts of the codebase (main process, renderer, and shared types), preventing drift across the IPC boundary. This is a simple but effective pattern for maintaining consistency in cross-process applications.
A robust git subprocess runner that handles process-tree termination to avoid hanging on grandchild processes holding pipes. It provides a clean abstraction for executing git commands with timeout, cancellation, and error handling. The module is self-contained and could be extracted for use in any Node.js project requiring reliable git operations, demonstrating non-obvious skill in managing subprocess lifecycle.
A pure-function scroll engine that implements a state machine for 'stick-to-bottom' behavior in chat-like interfaces. It tracks gesture ownership (user scroll vs programmatic), accumulates scroll offset thresholds, and manages chain cuts to prevent jitter. The module is fully testable with no DOM dependencies and demonstrates sophisticated handling of scroll intent, making it reusable across any scrollable container that needs auto-follow behavior.
A React hook that provides smooth streaming of text content using Intl.Segmenter for grapheme-aware chunking, requestAnimationFrame for timing, and divisors for rate limiting. It handles idle detection and stop conditions gracefully. This is a reusable pattern for any application that needs to display streaming text (e.g., AI responses) with smooth, performant rendering, demonstrating non-obvious skill in combining browser APIs for optimal user experience.
A module that implements release selection logic with mirror health probing. It classifies update mirrors as ok/slow/broken based on range-download speed measurements and selects the best available source. The pattern of dual-source fallback (AtomGit/GitHub) with health checks is reusable for any application needing resilient update infrastructure, and the module is self-contained with pure functions for testability.