|
1 | | -# OneCode |
| 1 | +# OneCode |
| 2 | + |
| 3 | +<div align="center"> |
| 4 | + |
| 5 | +**Manage Codex and Claude Code with one click - The open-source version of ZCode** |
| 6 | + |
| 7 | +[](https://github.com/AIDotNet/OneCode/actions) |
| 8 | +[](https://github.com/AIDotNet/OneCode/releases) |
| 9 | +[](LICENSE) |
| 10 | + |
| 11 | +[English](README.md) | [简体中文](README.zh-CN.md) |
| 12 | + |
| 13 | +</div> |
| 14 | + |
| 15 | +## Introduction |
| 16 | + |
| 17 | +OneCode is an open-source tool designed to help users conveniently operate [Codex](https://github.com/openai/codex) and [Claude Code](https://claude.ai/code) through a web interface. It supports local deployment and can be accessed externally through intranet mapping, making it convenient for users to use remotely via mobile devices and other platforms. Part of the design experience is inspired by [ZCode](https://zcode.dev/). |
| 18 | + |
| 19 | +## Features |
| 20 | + |
| 21 | +- **Web Interface**: Modern and responsive web UI built with React + TypeScript + Tailwind CSS |
| 22 | +- **AI Integration**: Seamless integration with OpenAI Codex and Claude Code |
| 23 | +- **Session Management**: Visualize and manage AI coding sessions with detailed history |
| 24 | +- **Project Workspace**: File explorer and code editor integration for seamless development workflow |
| 25 | +- **Token Usage Tracking**: Monitor and visualize token consumption across sessions |
| 26 | +- **Real-time Updates**: Server-Sent Events (SSE) for live AI response streaming |
| 27 | +- **Cross-platform**: Support for Windows, Linux, and macOS |
| 28 | +- **System Tray**: Windows desktop application with tray icon support |
| 29 | + |
| 30 | +## Screenshots |
| 31 | + |
| 32 | +### System Tray |
| 33 | +After launching OneCode.Win.exe, a system tray icon appears with the background service running automatically. |
| 34 | + |
| 35 | +### Project Selection |
| 36 | +Automatically scans and loads local projects that have used Codex, allowing you to select and enter a workspace. |
| 37 | + |
| 38 | +### Session Management |
| 39 | +- Start new conversations or select from session history |
| 40 | +- Load previous sessions to restore full context |
| 41 | +- View session details including token usage and timeline |
| 42 | + |
| 43 | +### File Browser |
| 44 | +Integrated file browser to view and edit code files directly while interacting with AI. |
| 45 | + |
| 46 | +## Download & Installation |
| 47 | + |
| 48 | +### Windows Desktop Application |
| 49 | + |
| 50 | +1. Visit the [GitHub Releases](https://github.com/AIDotNet/OneCode/releases) page |
| 51 | +2. Download the latest Windows archive (`OneCode-*-win-x64.zip`) |
| 52 | +3. Extract and run `OneCode.Win.exe` |
| 53 | +4. The program will display an icon in the system tray |
| 54 | +5. Open your browser and visit `http://localhost:9110/` |
| 55 | + |
| 56 | +### Linux |
| 57 | + |
| 58 | +1. Download the latest Linux package (`OneCode-*-linux-x64.tar.gz`) from [Releases](https://github.com/AIDotNet/OneCode/releases) |
| 59 | +2. Extract the archive: |
| 60 | + ```bash |
| 61 | + tar -xzf OneCode-*-linux-x64.tar.gz |
| 62 | + cd OneCode-*-linux-x64 |
| 63 | + ``` |
| 64 | +3. Run directly: |
| 65 | + ```bash |
| 66 | + ./run.sh |
| 67 | + ``` |
| 68 | +4. Or install as a systemd service: |
| 69 | + ```bash |
| 70 | + sudo ./install-service.sh |
| 71 | + ``` |
| 72 | + |
| 73 | +### macOS |
| 74 | + |
| 75 | +1. Download the latest macOS package (`OneCode-*-osx-x64.tar.gz`) from [Releases](https://github.com/AIDotNet/OneCode/releases) |
| 76 | +2. Extract the archive: |
| 77 | + ```bash |
| 78 | + tar -xzf OneCode-*-osx-x64.tar.gz |
| 79 | + cd OneCode-*-osx-x64 |
| 80 | + ``` |
| 81 | +3. Run directly: |
| 82 | + ```bash |
| 83 | + ./run.sh |
| 84 | + ``` |
| 85 | +4. Or install as a launch daemon: |
| 86 | + ```bash |
| 87 | + sudo ./install-service.sh |
| 88 | + ``` |
| 89 | + |
| 90 | +## Prerequisites |
| 91 | + |
| 92 | +- **.NET 10.0 Runtime** (for standalone executables, it's self-contained) |
| 93 | +- **Codex CLI** (required for Codex integration): |
| 94 | + ```bash |
| 95 | + npm install -g @openai/codex |
| 96 | + ``` |
| 97 | + |
| 98 | +## Usage |
| 99 | + |
| 100 | +### Accessing OneCode |
| 101 | + |
| 102 | +After starting the application, open your browser and navigate to: |
| 103 | + |
| 104 | +- HTTP: `http://localhost:9110/` |
| 105 | +- HTTPS: `https://localhost:9111/` (if configured) |
| 106 | + |
| 107 | +### Project Workflow |
| 108 | + |
| 109 | +1. **Select Project**: OneCode automatically scans for projects with Codex usage history |
| 110 | +2. **Enter Workspace**: Click on a project to enter its workspace |
| 111 | +3. **Start Conversation**: Begin a new chat or load a previous session |
| 112 | +4. **View Code**: Use the integrated file browser to view and edit files |
| 113 | +5. **Monitor Usage**: Track token usage and session statistics |
| 114 | + |
| 115 | +### Session Management |
| 116 | + |
| 117 | +- Click the session list button in the top-right corner |
| 118 | +- Select a historical session |
| 119 | +- Click "Load Session" to restore the complete context |
| 120 | +- View session details including token usage, timeline, and metadata |
| 121 | + |
| 122 | +## Development |
| 123 | + |
| 124 | +### Backend (C# / ASP.NET Core) |
| 125 | + |
| 126 | +```bash |
| 127 | +# Build |
| 128 | +dotnet build src/OneCode/OneCode.csproj |
| 129 | + |
| 130 | +# Run (HTTP) |
| 131 | +dotnet run --project src/OneCode/OneCode.csproj --launch-profile http |
| 132 | + |
| 133 | +# Run (HTTPS) |
| 134 | +dotnet run --project src/OneCode/OneCode.csproj --launch-profile https |
| 135 | +``` |
| 136 | + |
| 137 | +### Frontend (React / Vite) |
| 138 | + |
| 139 | +```bash |
| 140 | +cd web |
| 141 | + |
| 142 | +# Install dependencies |
| 143 | +npm ci |
| 144 | + |
| 145 | +# Development server |
| 146 | +npm run dev |
| 147 | + |
| 148 | +# Build for production |
| 149 | +npm run build |
| 150 | + |
| 151 | +# Lint code |
| 152 | +npm run lint |
| 153 | +``` |
| 154 | + |
| 155 | +### Build Full Application |
| 156 | + |
| 157 | +The CI pipeline automatically builds both frontend and backend: |
| 158 | + |
| 159 | +```bash |
| 160 | +# Install frontend dependencies |
| 161 | +npm ci |
| 162 | + |
| 163 | +# Build frontend |
| 164 | +npm run build |
| 165 | + |
| 166 | +# Sync frontend to backend wwwroot |
| 167 | +rsync -a --delete web/dist/ src/OneCode/wwwroot/ |
| 168 | + |
| 169 | +# Build backend |
| 170 | +dotnet build src/OneCode/OneCode.csproj -c Release |
| 171 | +``` |
| 172 | + |
| 173 | +## Architecture |
| 174 | + |
| 175 | +OneCode follows a dual-stack architecture: |
| 176 | + |
| 177 | +### Backend |
| 178 | +- **Framework**: ASP.NET Core 10.0 Web API |
| 179 | +- **Communication**: JSON-RPC over stdio with Codex app-server |
| 180 | +- **Database**: SQLite with Entity Framework Core |
| 181 | +- **Protocols**: Agent-to-Agent (A2A) protocol for streaming AI interactions |
| 182 | + |
| 183 | +### Frontend |
| 184 | +- **Framework**: React 19 with TypeScript |
| 185 | +- **Build Tool**: Vite |
| 186 | +- **Styling**: Tailwind CSS v4 |
| 187 | +- **State**: React Router + local component state |
| 188 | +- **UI Components**: Radix UI with custom animations |
| 189 | + |
| 190 | +See [CLAUDE.md](CLAUDE.md) for detailed architecture documentation. |
| 191 | + |
| 192 | +## Contributing |
| 193 | + |
| 194 | +Contributions are welcome! Please feel free to submit issues or pull requests. |
| 195 | + |
| 196 | +1. Fork the repository |
| 197 | +2. Create your feature branch |
| 198 | +3. Commit your changes |
| 199 | +4. Push to the branch |
| 200 | +5. Create a Pull Request |
| 201 | + |
| 202 | +## License |
| 203 | + |
| 204 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 205 | + |
| 206 | +## Community |
| 207 | + |
| 208 | +- GitHub: [https://github.com/AIDotNet/OneCode](https://github.com/AIDotNet/OneCode) |
| 209 | +- Issues: [https://github.com/AIDotNet/OneCode/issues](https://github.com/AIDotNet/OneCode/issues) |
| 210 | +- Discussions: [https://github.com/AIDotNet/OneCode/discussions](https://github.com/AIDotNet/OneCode/discussions) |
| 211 | + |
| 212 | +## Acknowledgments |
| 213 | + |
| 214 | +- Inspired by [ZCode](https://zcode.dev/) |
| 215 | +- Built with [OpenAI Codex](https://github.com/openai/codex) and [Anthropic Claude Code](https://claude.ai/code) |
0 commit comments