π Interactive CLI tool for switching Claude Code environment variables quickly and seamlessly.
β¨ New in v1.1.0: Interactive list navigation with arrow keys for seamless environment switching!
- π― Interactive Navigation - Use arrow keys to browse and select environments
- β‘ Instant Switching - One keystroke to change your entire Claude Code environment
- π Automatic Application - Environment variables applied immediately (with shell integration)
- πΎ Persistent Sessions - New terminals remember your last environment
- π Project-aware - Automatically switch environments when entering project directories
- π§ Shell Integration - Works seamlessly with zsh, bash, and other shells
- π¨ Beautiful UI - Colorful, intuitive command-line interface
npm install -g ccenv
# or
pnpm install -g ccenvccenv add work
# Interactive prompts for ANTHROPIC_BASE_URL and ANTHROPIC_API_KEYccenv install
# Auto-detects and configures zsh/bash integration
source ~/.zshrc # or source ~/.bashrcπ― Interactive Mode (Recommended)
ccenv list -i
# Navigate with ββ arrow keys
# Press Enter to select environment
# β Switched to environment: work
# π Environment variables automatically applied!β‘ Direct Switch
ccenv use work
# β Applied ccenv environment: work
# Environment variables automatically applied to current shell# Add new environment
ccenv add <name>
# π― Interactive list (navigate with arrow keys)
ccenv list -i
ccenv list --interactive
# List all environments (traditional view)
ccenv list
# Switch environment (auto-apply with shell integration)
ccenv use <name>
# Show current environment
ccenv current
# Export environment variables
ccenv current --exportNavigate environments with ease using arrow keys:
ccenv list -iWhat you get:
- ββ Arrow key navigation through all environments
- π Live preview of Base URL and API Key (masked)
- β‘ Instant switching - just press Enter to select
- π Automatic application of environment variables (with shell integration)
- π Easy exit - select "β Back" to return to standard list
Demo:
? Select an environment to switch to: (Use arrow keys)
β― work (current)
https://api.anthropic.com | sk-123...
personal
https://api.personal.com | sk-456...
mirror
https://api.mirror.com | sk-789...
β Back (just list)
After installing shell integration, you get these automated features:
-
Auto-apply Environment Variables
ccenv use work # Direct command mode ccenv list -i # Interactive mode # Both automatically set environment variables, no manual eval needed!
-
Persistent Environment
# New terminals automatically restore last environment echo $ANTHROPIC_BASE_URL # Auto-loaded
-
Project-level Environment
# Create .ccenv file in project directory echo "work" > .ccenv cd project # Automatically switches to work environment
If you prefer not to install automatic integration:
# Manually apply to current shell
eval "$(ccenv current --export)"
# Or load specific environment
eval "$(ccenv use work --source)"ccenv manages these environment variables for Claude Code:
ANTHROPIC_BASE_URL- Anthropic API base URLANTHROPIC_API_KEY- Anthropic API key
~/.ccenv/config.json- Environment configurations~/.ccenv/current_env- Current environment persistence file.ccenv- Project-level environment configuration file
# Set up multiple environments
ccenv add work
ccenv add personal
ccenv add mirror
# Install automation
ccenv install
# π― Interactive mode - navigate with arrow keys
ccenv list -i
# Select environment with Enter key
# β Switched to environment: work
# π Environment variables automatically applied!
# Or direct command mode
ccenv use work
echo $ANTHROPIC_BASE_URL # https://api.work.com
# New terminals automatically restore environment
# Projects with .ccenv files auto-switch environments# Clone repository
git clone <repository-url>
cd ccenv
# Install dependencies
pnpm install
# Development mode
pnpm dev <command> [args]
# Example: pnpm dev add test
# Build TypeScript to JavaScript
pnpm build
# Test built CLI
node dist/index.js --helpccenv/
βββ src/
β βββ commands/ # CLI command implementations
β βββ config/ # Configuration management
β βββ index.ts # CLI entry point
β βββ types.ts # TypeScript interfaces
βββ dist/ # Built JavaScript files
βββ package.json
βββ tsconfig.json
- CLI Framework: Commander.js for argument parsing
- Interactive Prompts: Inquirer.js for user input
- Configuration: JSON files in
~/.ccenv/ - Shell Integration: Dynamic script generation following volta/bun patterns
- Fork the repository
- Create a feature branch
- Make your changes
- Run
pnpm buildto ensure it compiles - Test with
node dist/index.js - Submit a pull request