{"repo": "bingfengfeifei/switcher", "files": {"README.md": {"a4cc10c71bd801bf2e1bc0405ddb8603fb502399": {"t": 1785674436.2035809, "n": 9988, "h": "2fcecd194fd68501", "c": "# πŸ”„ Switcher\n\n
\n\n![Go Version](https://img.shields.io/badge/Go-1.24+-00ADD8?style=for-the-badge&logo=go)\n![License](https://img.shields.io/badge/License-Apache%202.0-green?style=for-the-badge)\n![Platform](https://img.shields.io/badge/Platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey?style=for-the-badge)\n\n**English** | [δΈ­ζ–‡](README_zh.md)\n\n*A beautiful TUI-based CLI tool for managing and switching between Claude Code, Codex, and Droid configurations*\n\n[![Demo](https://img.shields.io/badge/Demo-🎬-ff69b4?style=for-the-badge)](#-demo)\n[![Installation](https://img.shields.io/badge/Installation-πŸ“¦-4285f4?style=for-the-badge)](#-installation)\n[![Usage](https://img.shields.io/badge/Usage-πŸš€-f39c12?style=for-the-badge)](#-usage)\n\n
\n\n## ✨ Features\n\n- 🎨 **Beautiful TUI** - Elegant terminal experience built with [Bubble Tea](https://github.com/charmbracelet/bubbletea)\n- 🌐 **Bilingual Support** - Seamlessly switch between English and Chinese with 'L' key\n- ⚑ **Quick Switching** - Instantly switch between different API configurations\n- πŸ”’ **Secure Management** - API keys are masked in display for security\n- πŸ“ **Configuration CRUD** - Easily add, edit, delete, and manage configurations\n- 🎯 **Three Services** - Manage Claude Code, Codex, and Droid configurations simultaneously\n- πŸ’» **CLI Mode** - Non-interactive command-line switching support\n- πŸ“‚ **Auto Import** - Automatically imports existing configurations on first run\n- πŸ”„ **Live Updates** - Changes are immediately applied to your configuration files\n\n## 🎬 Demo\n\n### Main Menu\n
\n\"Main\n\n*Main menu with bilingual support - easily switch between services or change language*\n
\n\n### Configuration List\n
\n\"Configuration\n\n*Browse and manage your configurations with active status indicators*\n
\n\n### Edit Configuration\n
\n\"Edit\n\n*Intuitive form interface with field-by-field editing and API key masking*\n
\n\n### Quick Commands\n\n```bash\n# Launch interactive TUI\nswitcher\n\n# Or switch directly via CLI\nswitcher -switch-claude \"OpenAI GPT-4\"\nswitcher -switch-codex \"Anthropic Claude\"\nswitcher -switch-droid \"Droid Model\"\n```\n\n## πŸ“¦ Installation\n\n### Linux / macOS\n\n**From Source**\n\n```bash\n# Clone repository\ngit clone https://github.com/bingfengfeifei/switcher.git\ncd switcher\n\n# Build and install\nmake build\nsudo make install\n```\n\n**Using Go**\n\n```bash\n# Direct install\ngo install github.com/bingfengfeifei/switcher@latest\n\n# Or clone and build\ngit clone https://github.com/bingfengfeifei/switcher.git\ncd switcher\ngo build -o switcher .\n```\n\n### Windows\n\n**Using PowerShell**\n\n```powershell\n# Clone repository\ngit clone https://github.com/bingfengfeifei/switcher.git\ncd switcher\n\n# Build\n.\\build.ps1\n\n# Build and install to system\n.\\build.ps1 -Install\n```\n\n**Using Go**\n\n```powershell\n# Direct install\ngo install github.com/bingfengfeifei/switcher@latest\n\n# Or clone and build\ngit clone https://github.com/bingfengfeifei/switcher.git\ncd switcher\ngo build -o switcher.exe .\n```\n\n## πŸš€ Usage\n\n### Interactive Mode (Default)\n\n```bash\nswitcher\n```\n\nNavigate the beautiful TUI with:\n- **↑/↓** or **j/k** - Navigate menu items\n- **Enter** - Select/confirm action\n- **Tab** - Switch between form fields\n- **Esc** - Go back/exit\n- **q** - Quit application\n\n### Command-line Mode\n\n```bash\n# Switch Claude Code configuration\nswitcher -switch-claude \"Configuration Name\"\n\n# Switch Codex configuration\nswitcher -switch-codex \"Configuration Name\"\n\n# Switch Droid configuration\nswitcher -switch-droid \"Configuration Name\"\n```\n\n## πŸ“ File Locations\n\n### Linux\n\n| File | Location | Purpose |\n|------|----------|---------|\n| **Executable** | `/usr/bin/switcher` | System executable |\n| **App Config** | `~/.config/switcher/config.json` | Stored configurations |\n| **Claude Code** | `~/.claude/settings.json` | Claude Code settings |\n| **Codex Auth** | `~/.codex/auth.json` | Codex authentication |\n| **Codex Config** | `~/.codex/config.toml` | Codex configuration |\n| **Droid Config** | `~/.factory/config.json` | Droid configuration |\n\n### macOS\n\n| File | Location | Purpose |\n|------|----------|---------|\n| **Executable** | `/usr/bin/switcher` | System executable |\n| **App Config** | `~/Library/Application Support/switcher/config.json` | Stored configurations |\n| **Claude Code** | `~/.claude/settings.json` | Claude Code settings |\n| **Codex Auth** | `~/.codex/auth.json` | Codex authentication |\n| **Codex Config** | `~/.codex/config.toml` | Codex configuration |\n| **Droid Config** | `~/.factory/config.json` | Droid configuration |\n\n### Windows\n\n| File | Location | Purpose |\n|------|----------|---------|\n| **Executable** | `%LOCALAPPDATA%\\Programs\\switcher\\switcher.exe` | System executable |\n| **App Config** | `%APPDATA%\\switcher\\config.json` | Stored configurations |\n| **Claude Code** | `%USERPROFILE%\\.claude\\settings.json` | Claude Code settings |\n| **Codex Auth** | `%USERPROFILE%\\.codex\\auth.json` | Codex authentication |\n| **Codex Config** | `%USERPROFILE%\\.codex\\config.toml` | Codex configuration |\n| **Droid Config** | `%USERPROFILE%\\.factory\\config.json` | Droid configuration |\n\n## πŸ› οΈ Configuration Structure\n\n### Claude Code & Droid\n\n```json\n{\n \"name\": \"My API Config\",\n \"provider\": \"openai\",\n \"base_url\": \"https://api.openai.com/v1\",\n \"api_key\": \"sk-...\"\n}\n```\n\n### Codex (with Authentication Method)\n\n```json\n{\n \"name\": \"My Codex Config\",\n \"provider\": \"openai\",\n \"base_url\": \"https://api.openai.com/v1\",\n \"api_key\": \"sk-...\",\n \"model\": \"gpt-5.1-codex\",\n \"wire_api\": \"responses\",\n \"auth_method\": \"auth.json\",\n \"model_reasoning_effort\": \"medium\"\n}\n```\n\n**Codex Authentication Methods:**\n- **`auth.json`** (default) - Uses `~/.codex/auth.json` file for authentication\n- **`env`** - Uses environment variable `CODEX_KEY` (automatically set in shell config)\n\n## 🎯 Supported Providers\n\n- **OpenAI** - GPT models and API\n- **Anthropic** - Claude models\n- **Custom** - Any OpenAI-compatible API endpoint\n\n## πŸ—οΈ Architecture\n\n```\nswitcher/\nβ”œβ”€β”€ main.go # Entry point and CLI arguments\nβ”œβ”€β”€ tui/\nβ”‚ β”œβ”€β”€ config.go # Configuration management\nβ”‚ β”œβ”€β”€ platform.go # Cross-platform path abstraction\nβ”‚ β”œβ”€β”€ shell.go # Shell environment variable management\nβ”‚ β”œβ”€β”€ controller.go # Event handling and state machine\nβ”‚ β”œβ”€β”€ menu.go # State definitions and view routing\nβ”‚ β”œβ”€β”€ init.go # Model initialization\nβ”‚ β”œβ”€β”€ style.go # Styling and UI components\nβ”‚ β”œβ”€β”€ util.go # Utility functions\nβ”‚ β”œβ”€β”€ claudecode.go # Claude Code service component\nβ”‚ β”œβ”€β”€ codex.go # Codex service component\nβ”‚ └── droid.go # Droid service component\nβ”œβ”€β”€ Makefile # Build automation (Linux/macOS)\nβ”œβ”€β”€ build.ps1 # Build script (Windows)\n└── README.md # This file\n```\n\n### Core Components\n\n- **Configuration Engine** (`tui/config.go`) - Handles loading, saving, and applying configurations for Claude Code, Codex, and Droid\n- **Platform Abstraction** (`tui/platform.go`) - Cross-platform path management for Linux, macOS, and Windows\n- **Shell Manager** (`tui/shell.go`) - Cross-platform environment variable management (bash/zsh/fish/PowerShell)\n- **TUI Controller** (`tui/controller.go`) - Central event handling, state transitions, and keyboard input processing\n- **TUI Menu System** (`tui/menu.go`) - State management, model structure, and view routing\n- **Service Components** (`tui/*code*.go`) - List views and specialized logic for each service\n- **Style System** (`tui/style.go`) - Styling library using Lipgloss\n- **CLI Interface** (`main.go`) - Command-line switching functionality and TUI initialization\n\n## πŸ”§ Development\n\n### Requirements\n\n- Go 1.24.0 or higher\n- Linux, macOS, or Windows operating system\n- Make (optional, for Linux/macOS build automation)\n- PowerShell (Windows build)\n\n### Building\n\n**Linux / macOS**\n\n```bash\n# Build binary\nmake build\n\n# Build for all platforms\nmake build-all\n\n# Install to system\nsudo make install\n\n# Clean build artifacts\nmake clean\n```\n\n**Windows**\n\n```powershell\n# Build binary\n.\\build.ps1\n\n# Build and install\n.\\build.ps1 -Install\n```\n\n### Running Locally\n\n```bash\n# Run from source\ngo run .\n\n# Or build and run\ngo build -o switcher .\n./switcher\n```\n\n## 🎨 Customization\n\nThe TUI supports keyboard shortcuts for power users:\n\n- **Vim-style navigation** with `j` and `k`\n- **Quick actions** with single-key operations\n- **Form navigation** with Tab between fields\n- **Escape sequences** for intuitive navigation\n\n## πŸ”’ Security\n\n- API keys are **masked** in TUI display (`sk-****...`)\n- Configuration files have **appropriate permissions**\n- No API keys are logged or exposed in command output\n\n## 🀝 Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Create a Pull Request\n\n## πŸ“„ License\n\nThis project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.\n\n## πŸ™ Acknowledgments\n\n- [Bubble Tea](https://github.com/charmbracelet/bubbletea) - Amazing TUI framework\n- [Lipgloss](https://github.com/charmbracelet/lipgloss) - Beautiful styling library\n- The excellent Go community ecosystem\n\n## πŸ“ž Support\n\nIf you encounter any issues or have feature requests:\n\n- πŸ› [Report a Bug](https://github.com/bingfengfeifei/switcher/issues/new?template=bug_report.md)\n- πŸ’‘ [Request a Feature](https://github.com/bingfengfeifei/switcher/issues/new?template=feature_request.md)\n- πŸ’¬ [Start a Discussion](https://github.com/bingfengfeifei/switcher/discussions)\n\n---\n\n
\n\n**⭐ If this project helps you, please give it a star!**\n\nMade with ❀️ by the open source community\n\n
\n"}}}}