npm package: @henrygoodenough/ccrc
Description: CCRC - Claude Code Replacement Client with integrated installation
Author: CCRC Development Team
Latest version: 1.0.1

# CCRC - Claude Code Replacement Client

A complete Claude Code management solution with integrated installation, configuration, and custom backend support.

## ✨ Features

- **🚀 One-Click Installation**: Automatically installs Claude Code via npm
- **⚙️ Integrated Configuration**: Seamlessly configures Claude Code with your custom backend
- **🌍 Cross-Platform**: Full Windows, macOS, and Linux support
- **🔐 Secure Setup**: Protected API key input and local configuration storage
- **🎯 Native Experience**: Use Claude Code exactly as intended, just with your backend

## 🚀 Quick Start

### 1. Install CCRC
```bash
npm install -g ccrc
```

### 2. Install and Configure Claude Code
```bash
ccrc install
```

This single command will:
- Install Claude Code automatically
- Configure your API key (with hidden input)
- Set up your custom backend URL
- Create all necessary configuration files

### 3. Start Using Claude
   ```bash
claude
```

That's it! You now have a fully configured Claude Code installation.

## 🔧 Commands

| Command | Description |
|---------|-------------|
| `ccrc install` | Install Claude Code and configure everything |
| `ccrc config` | Update API key or backend URL |
| `claude` | Start Claude Code directly |
| `claude [args]` | Pass arguments directly to Claude Code |

## 📋 Installation Process

When you run `ccrc install`, here's what happens:

```
╔══════════════════════════════════════════════════════════════════════════════╗
║                        CCRC Installation & Setup                            ║
╚══════════════════════════════════════════════════════════════════════════════╝

ℹ️  Claude Code not found. Installing...
ℹ️  Installing Claude Code via npm...
✅ Claude Code installed successfully!

╔══════════════════════════════════════════════════════════════════════════════╗
║                          Initial Configuration                              ║
╚══════════════════════════════════════════════════════════════════════════════╝

Welcome to CCRC! Let's configure your Claude Code setup.
You'll need to provide your API key and backend URL.

Please enter your API key:
(This will be used to authenticate with the backend service)
API Key: ********************************

Backend URL configuration:
Please enter your backend service URL (e.g., http://your-server.com:3456):
Backend URL: http://your-backend.com:3456

✅ Configuration saved successfully!
Backend URL: http://your-backend.com:3456
Claude settings created at: ~/.claude/settings.json

✅ Installation and configuration completed!

You can now use Claude by running:
  claude

To reconfigure later, run:
  ccrc config
```

## ⚙️ Configuration

### Reconfiguration
```bash
ccrc config
```

This allows you to:
- Update your API key
- Change your backend URL
- Regenerate Claude Code settings

### Configuration Files

CCRC creates and manages two configuration files:

**CCRC Configuration** (`~/.ccrc/config.json`):
```json
{
  "apiKey": "your-api-key",
  "backendUrl": "http://your-backend.com:",
  "configuredAt": "2024-01-01T00:00:00.000Z",
  "claudeCodeInstalled": true
}
```

**Claude Code Settings** (`~/.claude/settings.json`):
```json
{
  "anthropic": {
    "apiKey": "your-api-key",
    "baseURL": "http://your-backend.com:"
  },
  "env": {
    "ANTHROPIC_API_KEY": "your-api-key",
    "ANTHROPIC_BASE_URL": "http://your-backend.com:"
  }
}
```

## 🔧 Platform Support

CCRC is designed to work seamlessly across different platforms:

### macOS/Linux
- **Shell Support**: Automatically detects and configures Bash, Zsh, Fish, and other POSIX shells
- **Configuration Files**: Updates appropriate shell configuration files (`~/.zshrc`, `~/.bash_profile`, `~/.config/fish/config.fish`, etc.)
- **Environment Variables**: Exports `ANTHROPIC_AUTH_TOKEN` and `ANTHROPIC_BASE_URL`

### Windows
- **PowerShell Integration**: Uses PowerShell to set user-level environment variables permanently
- **Command Prompt Support**: Provides manual setup instructions for cmd
- **Session Variables**: Sets variables for current session as fallback
- **Automatic Detection**: Automatically handles Windows-specific configuration

### Universal Features
- **Automatic Platform Detection**: CCRC automatically detects your operating system and applies the appropriate configuration method
- **Fallback Instructions**: If automatic configuration fails, CCRC provides manual setup instructions for your specific platform
- **Cross-Platform API**: Same commands (`ccrc install`, `ccrc config`) work on all platforms

## 📋 Requirements

- **Node.js 18.0.0** or higher
- **npm** (included with Node.js)
- **Internet connection** (for initial Claude Code installation)
- **Network access** to your backend service

## 🐛 Troubleshooting

### Installation Issues

**Permission Errors (Linux/macOS)**:
```bash
# Try with sudo
sudo npm install -g ccrc
# Then run
ccrc install
```

**Permission Errors (Windows)**:
- Run Command Prompt or PowerShell as Administrator
- Install: `npm install -g ccrc`
- Configure: `ccrc install`

**Claude Code Installation Fails**:
```bash
# Manual installation
npm install -g @anthropic-ai/claude-code

# Then configure CCRC
ccrc config
```

### Configuration Issues

```bash
# Reconfigure if needed
ccrc config
```

### Connection Issues

**Backend Unreachable**:
- Verify backend URL format: `http://server:port` or `https://server:port`
- Check network connectivity: `ping your-server.com`
- Confirm backend service is running

**Authentication Errors**:
- Verify API key is correct
- Check backend service logs
- Reconfigure: `ccrc config`

## 🔄 Updates

### Update CCRC
```bash
npm update -g ccrc
```

## 🗑️ Uninstallation

```bash
# Uninstall CCRC
npm uninstall -g ccrc

# Clean up configuration (optional)
rm -rf ~/.ccrc ~/.claude
```

## 💡 Tips

- The `claude` command works exactly like the original
- All configuration is stored locally
- You can backup/restore config files for easy setup on multiple machines
- Backend URL must include protocol (http:// or https://)

## 📞 Support

Common solutions:

1. **Verify Node.js version**: `node --version` (need 18+)
2. **Reconfigure if needed**: `ccrc config`
3. **Reinstall if broken**: `ccrc install`

## 📄 License

MIT - see LICENSE file for details

---

**CCRC makes Claude Code setup effortless! 🚀**

Install once, configure once, use everywhere.