{"id":30111261,"url":"https://github.com/2ue/ccm","last_synced_at":"2025-08-10T05:33:40.122Z","repository":{"id":308482012,"uuid":"1032928677","full_name":"2ue/ccm","owner":"2ue","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-06T07:22:28.000Z","size":19970,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-06T07:23:14.732Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2ue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-06T03:48:09.000Z","updated_at":"2025-08-06T07:22:32.000Z","dependencies_parsed_at":"2025-08-06T07:23:17.609Z","dependency_job_id":"b39c0e53-8c35-4220-ada5-4762209539bb","html_url":"https://github.com/2ue/ccm","commit_stats":null,"previous_names":["2ue/ccm"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/2ue/ccm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2ue%2Fccm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2ue%2Fccm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2ue%2Fccm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2ue%2Fccm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2ue","download_url":"https://codeload.github.com/2ue/ccm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2ue%2Fccm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269682048,"owners_count":24458598,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-10T05:33:23.563Z","updated_at":"2025-08-10T05:33:40.107Z","avatar_url":"https://github.com/2ue.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CCM - Claude Code Manager\n\nA TypeScript-based command-line tool to manage Claude Code API configurations with **safe shell integration** through independent configuration files.\n\n\u003e **English Documentation** | [中文文档](./README_zh.md)\n\n## ✨ Features\n\n✅ **Environment Group Management** - Add, remove, switch between Claude Code environments  \n✅ **Safe Shell Integration** - Uses independent `~/.ccman/.ccmanrc` file to avoid modifying user configs  \n✅ **Interactive Source Control** - Choose manual or automatic source with risk warnings  \n✅ **Type Safety** - Full TypeScript implementation with strict typing  \n✅ **Interactive CLI** - User-friendly commands with colored output and inquirer prompts  \n✅ **Multi-Shell Support** - Works with bash, zsh, and fish  \n✅ **Complete Workflow** - From setup to usage in one seamless flow  \n\n## 🚀 Quick Start\n\n### Installation\n\n```bash\n# Install from NPM\nnpm install -g ccman\n\n# Or install dependencies for development\nnpm install \u0026\u0026 npm run build\n```\n\n### Basic Usage\n\n```bash\n# Interactive setup (recommended)\nccman config\n\n# Or add environment directly\nccman add default https://api.anthropic.com your-api-key\n\n# List all environments\nccman ls\n\n# Switch to an environment with source options\nccman use default\n\n# Show current environment\nccman current\n```\n\n## 📖 Commands Reference\n\n### Core Environment Management\n```bash\nccman add \u003cname\u003e \u003cbaseUrl\u003e [apiKey]     # Add environment (interactive API key if not provided)\nccman remove \u003cname\u003e                     # Remove environment group\nccman use \u003cname\u003e                        # Switch environment with source interaction\nccman list|ls                           # List all environments (* = current)\nccman current                           # Show current environment details\nccman clear|clearall                    # Clear ALL environments and shell integration (DESTRUCTIVE)\n```\n\n### Interactive Configuration\n```bash\nccman config                            # Full interactive configuration wizard\n                                     # - Add/switch/edit/remove environments\n                                     # - No existing environments? Guided setup\n                                     # - Complete menu-driven interface\n```\n\n### Advanced Operations\n```bash\nccman status                            # Show detailed CCM statistics\nccman test [name]                       # Test environment configuration\nccman env                               # Generate shell export script\n```\n\n### Shell Integration Options\n```bash\n# Disable automatic shell writing\nccman add \u003cname\u003e \u003curl\u003e --no-auto-write  \nccman use \u003cname\u003e --no-auto-write        \n\n# Force automatic source (risky)\nccman use \u003cname\u003e --auto-source          \n```\n\n## 🔧 Interactive Workflows\n\n### 1. Adding Environment with Smart Use Flow\n\n```bash\n$ ccman add myenv https://api.example.com\n? Enter API Key: ****************\n✓ Added environment group \"myenv\"\n  Base URL: https://api.example.com\n  Created: 2025-08-06 11:45:30\n\n? Set \"myenv\" as current environment? Yes\n✓ Environment variables written to /home/user/.ccman/.ccmanrc\n\n? How would you like to apply the environment variables?\n❯ Manual - I will restart terminal or source manually (Recommended)\n  Auto-source - Try to source automatically (May not work in all environments)\n\n\u003e Manual\nTo apply changes, restart your terminal or run:\nsource ~/.bashrc (or ~/.zshrc)\n```\n\n### 2. Interactive Configuration Menu\n\n```bash\n$ ccman config\n? What would you like to do?\n❯ Switch environment\n  Add new environment  \n  Edit environment\n  Remove environment\n  Show current status\n\n\u003e Add new environment\n? Environment name: staging\n? Base URL: https://staging-api.example.com\n? API Key: ****************\n✓ Added environment \"staging\"\n```\n\n### 3. Environment Switching with Source Control\n\n```bash\n$ ccman use production  \n✓ Switched to environment \"production\"\n  Base URL: https://api.anthropic.com\n✓ Environment variables written to /home/user/.ccman/.ccmanrc\n\n? How would you like to apply the environment variables?\n  Manual - I will restart terminal or source manually (Recommended)\n❯ Auto-source - Try to source automatically (May not work in all environments)\n\n\u003e Auto-source\n⚠️  Attempting auto-source - this may not work in all terminal environments\n✓ Shell configuration sourced successfully\n```\n\n## 🛡️ Safe Shell Integration Architecture\n\n### How It Works\n\nCCM uses a **two-tier architecture** for safe shell integration:\n\n1. **Independent Configuration File**: `~/.ccman/.ccmanrc`\n   ```bash\n   # CCM (Claude Code Manager) Environment Variables - Auto Generated\n   # Generated at: 2025-08-06 11:45:30\n   # Environment: production\n   export ANTHROPIC_BASE_URL=\"https://api.anthropic.com\"\n   export ANTHROPIC_AUTH_TOKEN=\"your-api-key\"\n   # End CCM Environment Variables\n   ```\n\n2. **Minimal Shell Reference**: One line added to `.bashrc`/`.zshrc`\n   ```bash\n   # CCM (Claude Code Manager) - Auto Generated Reference\n   [ -f \"/home/user/.ccman/.ccmanrc\" ] \u0026\u0026 source \"/home/user/.ccman/.ccmanrc\"\n   # End CCM Reference\n   ```\n\n### Benefits\n- ✅ **Non-invasive**: Only adds one reference line to shell config\n- ✅ **Safe**: User's existing shell config remains untouched\n- ✅ **Clean**: Easy to remove completely\n- ✅ **Isolated**: All CCM variables in separate file\n\n### Environment Variables Managed\n- `ANTHROPIC_BASE_URL` - API base URL\n- `ANTHROPIC_AUTH_TOKEN` - API authentication token\n\n## 📊 Configuration Structure\n\nCCM stores configuration in `~/.ccman/config.json`:\n\n```json\n{\n  \"current\": \"production\",\n  \"environments\": {\n    \"production\": {\n      \"name\": \"production\",\n      \"baseUrl\": \"https://api.anthropic.com\",\n      \"apiKey\": \"your-key\",\n      \"createdAt\": \"2025-08-06T03:45:30.000Z\",\n      \"lastUsed\": \"2025-08-06T03:50:15.000Z\"\n    },\n    \"staging\": {\n      \"name\": \"staging\", \n      \"baseUrl\": \"https://staging-api.example.com\",\n      \"apiKey\": \"staging-key\",\n      \"createdAt\": \"2025-08-06T03:46:00.000Z\"\n    }\n  },\n  \"settings\": {\n    \"autoWriteShell\": true,\n    \"preferredShell\": \"auto\",\n    \"shellConfigPath\": null\n  }\n}\n```\n\n## 💡 Usage Examples\n\n### Complete Setup Workflow\n```bash\n# Start with interactive setup\nccman config\n# → Guided through adding first environment\n# → Automatically prompted to set as current\n# → Choose source method (manual/auto)\n\n# Add more environments\nccman add staging https://staging.example.com\nccman add dev https://dev.example.com\n\n# Switch with full interaction\nccman use dev\n# → Writes to ~/.ccman/.ccmanrc\n# → Asks about sourcing method\n# → Provides clear instructions\n\n# Check status\nccman status\n# CCM Status:\n# Total environments: 3\n# Current environment: dev\n# Shell integration: Enabled\n```\n\n### Manual Environment Variable Setup\n```bash\n# If you prefer manual control\nccman use prod --no-auto-write\nccman env  # Shows export script\nsource \u003c(ccman env)  # Apply manually\n```\n\n### Advanced Usage\n```bash\n# Test environment connectivity\nccman test production\n\n# Force auto-source (with risk warning)\nccman use staging --auto-source\n\n# Edit existing environment\nccman config  # → Edit environment → Select → Update values\n\n# Complete reset (removes EVERYTHING - environments, shell config)\nccman clear   # Interactive confirmation required\n```\n\n## ⚙️ Development\n\n```bash\n# Development mode (with file watching)\nnpm run dev\n\n# Build TypeScript\nnpm run build\n\n# Clean build artifacts  \nnpm run clean\n\n# Start built CLI\nnpm start\n```\n\n## 🎯 Command Line Options\n\n### Global Options\nAll commands support standard CLI conventions:\n- `-h, --help` - Show command help\n- `-V, --version` - Show version\n\n### Add Command Options\n```bash\nccman add \u003cname\u003e \u003cbaseUrl\u003e [apiKey] [options]\n\nOptions:\n  --no-auto-write    Do not automatically write to shell config\n```\n\n### Use Command Options  \n```bash\nccman use \u003cname\u003e [options]\n\nOptions:\n  --no-auto-write    Do not automatically write to shell config\n  --auto-source      Automatically source shell config (risky)\n```\n\n## 🔍 Troubleshooting\n\n### Environment Variables Not Applied\n```bash\n# Check if .ccmanrc exists\nls -la ~/.ccman/.ccmanrc\n\n# Check shell reference\ngrep \"ccman\" ~/.bashrc ~/.zshrc\n\n# Manual application\nsource ~/.ccman/.ccmanrc\n\n# Or regenerate\nccman use \u003ccurrent-env\u003e\n```\n\n### Shell Integration Issues\n```bash\n# Check shell type detection\nccman status\n\n# Force manual setup\nccman use \u003cenv\u003e --no-auto-write\nsource \u003c(ccman env)\n```\n\n## 📋 Requirements\n\n- Node.js \u003e= 16.0.0  \n- TypeScript 5.0+\n- Supported shells: bash, zsh, fish\n- Operating systems: Linux, macOS, Windows (WSL)\n\n## 📄 License\n\nMIT License - see LICENSE file for details.\n\n---\n\n## 🚀 From Setup to Usage - Complete Flow\n\n```bash\n# 1. Interactive first-time setup\nccman config\n  → No environments? Guided creation\n  → Set as current? Yes\n  → Source method? Manual/Auto\n\n# 2. Add more environments  \nccman add dev https://dev.api.com\n  → Interactive API key input\n  → Set as current? Yes/No\n  → Full source interaction if Yes\n\n# 3. Switch anytime with full control\nccman use production\n  → Safe .ccmanrc update\n  → Source method choice\n  → Clear instructions\n\n# 4. Everything just works! ✨\n```\n\n*CCM - Making Claude Code API configuration management safe, interactive, and user-friendly.*","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2ue%2Fccm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2ue%2Fccm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2ue%2Fccm/lists"}