docs: Standardize XCodeCLI casing in setup script
This commit is contained in:
224
README.md
Normal file
224
README.md
Normal file
@@ -0,0 +1,224 @@
|
||||
# XCodeCLI-Shells
|
||||
|
||||
> Configuration scripts for integrating Claude Code with XCodeCLI API router
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://github.com/your-username/XCodeCLI-Shells)
|
||||
|
||||
## Overview
|
||||
|
||||
XCodeCLI-Shells is a cross-platform configuration toolkit for setting up Claude Code integration with XCodeCLI API router. These scripts enable you to easily configure Claude Code to use custom API endpoints, supporting both personal and team API access.
|
||||
|
||||
## Features
|
||||
|
||||
- 🌐 **Cross-platform support**: Windows (PowerShell) and Unix/Linux/macOS (Bash)
|
||||
- 🔐 **Security validation**: API key format validation and connection testing
|
||||
- ⚡ **Quick setup**: Auto-generates Claude Code configuration files and environment variables
|
||||
- 🛡️ **Data protection**: Automatic backup of existing configs, sensitive info masking
|
||||
- 🎯 **Multi-endpoint support**: Supports both personal and team API endpoints
|
||||
- 📊 **Real-time feedback**: Colored output and detailed status information
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Requirements
|
||||
|
||||
#### Windows
|
||||
- PowerShell 5.0 or higher
|
||||
- Internet connection
|
||||
|
||||
#### Unix/Linux/macOS
|
||||
- Bash shell
|
||||
- `jq` command-line tool
|
||||
- `curl` tool
|
||||
|
||||
### Install jq (Unix/Linux/macOS only)
|
||||
|
||||
```bash
|
||||
# macOS (using Homebrew)
|
||||
brew install jq
|
||||
|
||||
# Ubuntu/Debian
|
||||
sudo apt-get install jq
|
||||
|
||||
# CentOS/RHEL/Fedora
|
||||
sudo yum install jq
|
||||
# or (newer versions)
|
||||
sudo dnf install jq
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Windows (PowerShell)
|
||||
|
||||
#### Basic usage
|
||||
```powershell
|
||||
.\setup-claude-code.ps1 -BaseUrl https://api.xcodecli.com -ApiKey your-api-key-here
|
||||
```
|
||||
|
||||
#### Interactive mode
|
||||
```powershell
|
||||
.\setup-claude-code.ps1
|
||||
```
|
||||
|
||||
#### Test connection
|
||||
```powershell
|
||||
.\setup-claude-code.ps1 -Test -BaseUrl https://api.xcodecli.com -ApiKey your-api-key-here
|
||||
```
|
||||
|
||||
#### Show current settings
|
||||
```powershell
|
||||
.\setup-claude-code.ps1 -Show
|
||||
```
|
||||
|
||||
#### Help
|
||||
```powershell
|
||||
.\setup-claude-code.ps1 -Help
|
||||
```
|
||||
|
||||
### Unix/Linux/macOS (Bash)
|
||||
|
||||
#### Basic usage
|
||||
```bash
|
||||
./setup-claude-code.sh --url https://api.xcodecli.com --key your-api-key-here
|
||||
```
|
||||
|
||||
#### Interactive mode
|
||||
```bash
|
||||
./setup-claude-code.sh
|
||||
```
|
||||
|
||||
#### Test connection
|
||||
```bash
|
||||
./setup-claude-code.sh --test --url https://api.xcodecli.com --key your-api-key-here
|
||||
```
|
||||
|
||||
#### Show current settings
|
||||
```bash
|
||||
./setup-claude-code.sh --show
|
||||
```
|
||||
|
||||
#### Help
|
||||
```bash
|
||||
./setup-claude-code.sh --help
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### PowerShell Script Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
|-----------|------|-------------|
|
||||
| `-BaseUrl` | String | XCodeCLI API base URL |
|
||||
| `-ApiKey` | String | API key |
|
||||
| `-Test` | Switch | Test API connection only |
|
||||
| `-Show` | Switch | Show current settings |
|
||||
| `-Help` | Switch | Show help information |
|
||||
|
||||
### Bash Script Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
|-----------|------|-------------|
|
||||
| `-u, --url` | String | XCodeCLI API base URL |
|
||||
| `-k, --key` | String | API key |
|
||||
| `-t, --test` | Flag | Test API connection only |
|
||||
| `-s, --show` | Flag | Show current settings |
|
||||
| `-h, --help` | Flag | Show help information |
|
||||
|
||||
## API Endpoint Support
|
||||
|
||||
### Personal API
|
||||
- **Endpoint**: `/api/v1/claude/balance`
|
||||
- **Response field**: `balance`
|
||||
- **Usage**: Query personal account balance
|
||||
|
||||
### Team API
|
||||
- **Endpoint**: `/api/v1/team/stats/spending`
|
||||
- **Response field**: `daily_remaining`
|
||||
- **Usage**: Query team daily remaining quota
|
||||
- **URL format**: Must end with `/team`
|
||||
|
||||
## Configuration Files
|
||||
|
||||
Scripts create configuration files at:
|
||||
|
||||
- **Windows**: `%USERPROFILE%\.claude\settings.json`
|
||||
- **Unix/Linux/macOS**: `~/.claude/settings.json`
|
||||
|
||||
### Configuration Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"env": {
|
||||
"ANTHROPIC_BASE_URL": "https://api.xcodecli.com",
|
||||
"ANTHROPIC_AUTH_TOKEN": "your-api-key",
|
||||
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": 20000,
|
||||
"DISABLE_TELEMETRY": 1,
|
||||
"DISABLE_ERROR_REPORTING": 1,
|
||||
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1,
|
||||
"CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR": 1,
|
||||
"MAX_THINKING_TOKENS": 12000
|
||||
},
|
||||
"model": "sonnet"
|
||||
}
|
||||
```
|
||||
|
||||
## Security Features
|
||||
|
||||
- **API key validation**: Only accepts keys with alphanumeric characters, hyphens, and underscores
|
||||
- **Configuration backup**: Auto-backup existing config files (with timestamp)
|
||||
- **Sensitive info protection**: Automatic masking of API keys in output
|
||||
- **Connection verification**: Test API connection validity before configuration
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Windows PowerShell Execution Policy Error
|
||||
|
||||
If you encounter execution policy errors, use:
|
||||
|
||||
```powershell
|
||||
powershell -ExecutionPolicy Bypass -File setup-claude-code.ps1
|
||||
```
|
||||
|
||||
### Unix/Linux/macOS Permission Issues
|
||||
|
||||
Ensure the script has execute permissions:
|
||||
|
||||
```bash
|
||||
chmod +x setup-claude-code.sh
|
||||
```
|
||||
|
||||
### jq Not Installed Error
|
||||
|
||||
Please install `jq` tool according to the [Requirements](#requirements) section.
|
||||
|
||||
### API Connection Failed
|
||||
|
||||
1. Check network connection
|
||||
2. Verify API URL is correct
|
||||
3. Confirm API key validity
|
||||
4. Check firewall settings
|
||||
|
||||
## Verify Installation
|
||||
|
||||
After installation, you can verify Claude Code configuration with:
|
||||
|
||||
```bash
|
||||
claude --version
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Welcome to submit Issues and Pull Requests to improve this project.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License. See [LICENSE](LICENSE) file for details.
|
||||
|
||||
## Related Links
|
||||
|
||||
- [Claude Code Official Documentation](https://docs.claude.com/en/docs/claude-code)
|
||||
- [XCodeCLI Project](https://github.com/your-username/XCodeCLI)
|
||||
|
||||
---
|
||||
|
||||
**Note**: Please keep your API key secure and do not commit configuration files containing real API keys to public repositories.
|
||||
Reference in New Issue
Block a user