# CC Launcher
**Repository Path**: minimote/cc-launcher
## Basic Information
- **Project Name**: CC Launcher
- **Description**: 使用指定的 CC-Switch 供应商启动 Claude Code,可同时运行多个不同供应商的 Claude Code 实例,不影响 CC-Switch 的全局激活状态。
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 0
- **Created**: 2026-07-13
- **Last Updated**: 2026-07-13
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# CC Launcher
> Launch Claude Code with a specified CC-Switch provider. Multiple Claude Code instances using different providers can run simultaneously without affecting the global active state in CC-Switch.
## Features
- Instance-level isolation: each Claude instance launches with its own settings file, mutually independent
- Read-only access to the cc-switch database, no modification to the original config
- Interactive provider selection (arrow keys to navigate, Enter to confirm); automatically prompts for selection when multiple providers share the same name
- Automatically filters critical system environment variables such as `PATH` and `HOME` to prevent accidental override of system settings
- Bundled PowerShell script to create a desktop shortcut; double-click to launch
- Zero dependencies, uses only Node.js built-in modules (`node:sqlite`, etc.)
## Known Limitations
**Only supports providers using the native Anthropic format.**
This tool launches Claude by injecting the provider configuration via `claude --settings`; Claude Code connects directly to the provider's real API endpoint without going through CC-Switch's local router, so only `Anthropic`-format (native Anthropic Messages) providers are supported.
## Project Structure
> `settings/settings_.json` contains sensitive information such as API keys. It is ignored via `.gitignore`; do not commit it to remote repositories.
```text
cc-launcher/
├── settings/ # Runtime-generated settings files (gitignored)
├── cc-launcher.mjs # Main script; reads the cc-switch database and launches Claude
└── create-shortcut.ps1 # PowerShell script that creates a desktop shortcut for a given provider
```
## Prerequisites
- Node.js 22.13 or later (uses the built-in `node:sqlite` module; experimental warnings are automatically suppressed)
- CC-Switch desktop installed, with at least one `claude`-type provider configured
- `claude` CLI installed and available in PATH
## Quick Start
### 1. Run Directly
> Do not delete `settings/settings_.json` while running.
> These files are the configuration source for instance isolation; deleting them causes env to be overwritten when switching providers in CC-Switch, breaking the isolation.
```bash
# Interactively select a provider
node cc-launcher.mjs
# Specify a provider
node cc-launcher.mjs "Free-ds-v4-Flash"
# Specify a provider and pass extra arguments to claude
node cc-launcher.mjs "Free-ds-v4-Flash" --continue
```
### 2. Create a Desktop Shortcut (Recommended)
Edit the configuration section at the top of [create-shortcut.ps1](create-shortcut.ps1):
```powershell
# Provider name in CC-Switch
$ProviderName = "Free-ds-v4-Flash"
# Shortcut working directory (project directory)
$WorkingDirectory = "F:\AI\workspace\Claude"
```
Run the script to generate `.lnk` in the project directory:
```powershell
powershell -ExecutionPolicy Bypass -File .\create-shortcut.ps1
```
Double-click the shortcut to launch Claude Code with the specified provider.
## Command Line Usage
```bash
node cc-launcher.mjs [provider_name] [extra claude args...]
```
| Position | Description |
| :------------- | :---------------------------------------------------------------------- |
| 1st argument | Provider name in CC-Switch (optional; prompts interactively if omitted) |
| Remaining args | Passed through to the `claude` CLI, e.g. `--continue`, `--resume` |
## How It Works
1. **Check database**: verifies `~/.cc-switch/cc-switch.db` exists
2. **Resolve provider**:
- No name given -> list all `claude`-type providers for interactive selection
- Single match -> use directly
- Multiple matches with the same name -> prompt to pick one
- Not found -> fall back to interactive selection (up to 3 retries)
3. **Extract env vars**: parses the provider's `settings_config`, extracts the `env` field, and filters out critical system variables (`PATH`, `HOME`, `USERPROFILE`, etc.) and non-string values
4. **Write settings file**: writes env to `settings/settings_.json`
5. **Launch Claude**: runs `claude --settings `, forwarding extra arguments
## Changelog
[CHANGELOG](CHANGELOG.md)
## Related Projects
- **CodingPlan Usage Query** ([Gitee](https://gitee.com/minimote/coding-plan-usage-query) | [GitHub](https://github.com/minimote/coding-plan-usage-query)): Query Coding Plan usage and reset countdowns across platforms; recommended for use with ccstatusline / ccstatusline-zh custom commands, displayed in the Claude Code status bar.
## License
[MIT License](LICENSE)