Terminal For All of Us
A Tauri-based terminal application with integrated AI agent capabilities. Turtle provides a modern, cross-platform desktop terminal with multi-tab support and an intelligent assistant powered by language models for enhanced productivity.
Turtle is a desktop application that combines a feature-rich terminal interface with an AI agent (AgentForTerminal) to help interpret instructions, execute commands, and debug code automatically. The application is built with:
- Frontend: React + TypeScript with Chakra UI for the user interface
- Backend: Rust (Tauri) for native platform integration and terminal emulation
- AI Agent: Python-based assistant (located in TAI/) for intelligent command execution
- Multi-tab support with tab creation and switching
- Full terminal emulation with ANSI escape sequence parsing
- Ctrl+C signal handling for process interruption
- Real-time output rendering with HTML formatting
- Dark theme optimized for terminal work
- Intelligent instruction interpretation
- Automatic shell command generation and execution
- Code error detection and auto-fixing
- Language support: Python, JavaScript, Rust, TypeScript, Java, C, C++
- Git integration for snapshot commits and history tracking
- Dry-run capability for safety verification
- Native builds for macOS, Windows, and Linux via Tauri
- Responsive UI with Chakra UI components
- System tray integration available via Tauri plugins
- Node.js (v16 or higher) with pnpm package manager
- Rust toolchain (for building Tauri backend)
- Python 3.8+ (for AI agent)
- Git (for version control)
- Clone the repository:
git clone https://github.com/tars-terminal/turtle.git
cd turtle- Install JavaScript dependencies:
pnpm install- Install Python dependencies for the AI agent:
cd TAI
pip install typer prompt_toolkit rich python-dotenv openai
cd ..Start the development server with hot reload:
pnpm devThis will start:
- Vite dev server on port 1420
- Tauri development window with both frontend and backend
Build the AI agent:
pnpm build:agentBuild the application for your platform:
pnpm buildBuild the Tauri application:
pnpm tauri buildThe compiled binaries will be available in src-tauri/target/release/.
- React 18: UI library
- TypeScript: Type-safe JavaScript
- Chakra UI: Component library
- Zustand: State management
- Vite: Build tool and dev server
- React Icons: Icon library
- Next Themes: Theme management
- Tauri 2: Desktop application framework
- serde/serde_json: JSON serialization
- nix: Unix system calls (pty, fork, exec)
- zvariant: D-Bus variant types
- once_cell: Lazy static initialization
- Typer: CLI framework
- prompt_toolkit: Terminal UI
- Rich: Beautiful terminal output
- OpenAI: Language model API
- python-dotenv: Environment variable management
The Rust backend manages terminal emulation through:
- PTY (Pseudo Terminal): Uses
forkpty()to create a shell subprocess - Polling:
poll()system call for non-blocking I/O - Event Emission: Sends shell output to frontend via Tauri events
The frontend uses Zustand for global state:
- Tabs: Multi-tab terminal sessions
- Input/Output: Terminal command history and output
- UI State: Active tab tracking and navigation
Converts ANSI escape sequences (colors, formatting) into HTML for proper rendering in the browser.
pnpm testpnpm typecheckThe project uses Prettier for code formatting.
git checkout -b feature/your-feature-name
git commit -m "feat: description of changes"
git push origin feature/your-feature-nameEdit src-tauri/tauri.conf.json to modify:
- App metadata (name, version, identifier)
- Window settings (size, resizable)
- Build configuration (dev/build commands)
- Security policies (CSP)
- Bundle settings (icons, formats)
Create a .env file in the root directory:
OPENAI_API_KEY=your_api_key_here
The AI agent uses this key for language model requests.
- User Input: Terminal input via React component
- Frontend: Zustand store updates and event handling
- Tauri Bridge: Frontend calls Rust backend via
invoke() - Backend: PTY receives command and executes via shell
- Output: Backend emits shell output events to frontend
- Rendering: Frontend parses ANSI and displays in terminal
- User types instruction in terminal
- Frontend calls
execute_agent()via Tauri - Rust backend writes compiled Python agent binary to temp directory
- Binary executes in PTY with user instruction
- Agent processes instruction, may execute commands/fix code
- Output streamed back to terminal
Ensure the init() command is called when the app starts. Check console logs in Tauri dev tools.
Verify ANSI escape sequence parsing in useParseAnsi() hook. Check browser console for JavaScript errors.
Build the agent with pnpm build:agent and ensure the binary is in src-tauri/bin/agent.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is open source. Check the LICENSE file for details.
For issues, feature requests, or discussions, please open an issue on the GitHub repository.
- Advanced code editing plugin with completion and syntax highlighting
- Built-in web browsing tool for documentation lookup
- Command palette for quick access
- Session management and restoration
- Custom keybindings configuration
- Plugin system for extensibility