docs: Standardize XCodeCLI casing in setup script
This commit is contained in:
111
CLAUDE.md
Normal file
111
CLAUDE.md
Normal file
@@ -0,0 +1,111 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## 项目概述
|
||||
|
||||
XCodeCLI-Shells 是一个配置工具集,用于设置 Claude Code 与 XCodeCLI API 路由器的集成。项目包含跨平台的安装脚本,支持 Windows (PowerShell) 和 Unix/Linux/macOS (Bash)。
|
||||
|
||||
## 核心架构
|
||||
|
||||
### 脚本功能
|
||||
- **setup-claude-code.ps1**: Windows PowerShell 配置脚本
|
||||
- **setup-claude-code.sh**: Unix/Linux/macOS Bash 配置脚本
|
||||
|
||||
两个脚本提供相同的功能:
|
||||
- 验证 API 密钥格式
|
||||
- 测试 API 连接
|
||||
- 创建 Claude Code 配置文件 (~/.claude/settings.json)
|
||||
- 设置环境变量 (ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN)
|
||||
- 支持团队和个人 API 端点
|
||||
|
||||
### 配置结构
|
||||
脚本生成的 settings.json 包含:
|
||||
```json
|
||||
{
|
||||
"env": {
|
||||
"ANTHROPIC_BASE_URL": "<用户提供的URL>",
|
||||
"ANTHROPIC_AUTH_TOKEN": "<用户API密钥>",
|
||||
"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"
|
||||
}
|
||||
```
|
||||
|
||||
## 常用命令
|
||||
|
||||
### Windows (PowerShell)
|
||||
```powershell
|
||||
# 基本使用
|
||||
.\setup-claude-code.ps1 -BaseUrl https://api.xcodecli.com -ApiKey your-api-key
|
||||
|
||||
# 测试连接
|
||||
.\setup-claude-code.ps1 -Test -BaseUrl https://api.xcodecli.com -ApiKey your-api-key
|
||||
|
||||
# 显示当前设置
|
||||
.\setup-claude-code.ps1 -Show
|
||||
|
||||
# 交互模式
|
||||
.\setup-claude-code.ps1
|
||||
|
||||
# 帮助
|
||||
.\setup-claude-code.ps1 -Help
|
||||
```
|
||||
|
||||
### Unix/Linux/macOS (Bash)
|
||||
```bash
|
||||
# 基本使用
|
||||
./setup-claude-code.sh --url https://api.xcodecli.com --key your-api-key
|
||||
|
||||
# 测试连接
|
||||
./setup-claude-code.sh --test --url https://api.xcodecli.com --key your-api-key
|
||||
|
||||
# 显示当前设置
|
||||
./setup-claude-code.sh --show
|
||||
|
||||
# 交互模式
|
||||
./setup-claude-code.sh
|
||||
|
||||
# 帮助
|
||||
./setup-claude-code.sh --help
|
||||
```
|
||||
|
||||
## API 端点支持
|
||||
|
||||
### 个人 API
|
||||
- 端点: `/api/v1/claude/balance`
|
||||
- 响应字段: `balance`
|
||||
|
||||
### 团队 API
|
||||
- 端点: `/api/v1/team/stats/spending`
|
||||
- 响应字段: `daily_remaining`
|
||||
- URL 格式: 必须以 `/team` 结尾
|
||||
|
||||
## 开发注意事项
|
||||
|
||||
### PowerShell 脚本特性
|
||||
- 支持执行策略绕过: `powershell -ExecutionPolicy Bypass`
|
||||
- 彩色输出功能 (Blue/Green/Yellow/Red)
|
||||
- 环境变量持久化 (用户级别)
|
||||
- JSON 配置验证
|
||||
|
||||
### Bash 脚本特性
|
||||
- 依赖 jq 进行 JSON 处理
|
||||
- ANSI 颜色输出
|
||||
- 临时文件清理
|
||||
- 错误处理和回滚机制
|
||||
|
||||
### 安全考虑
|
||||
- API 密钥格式验证 (仅允许字母数字、连字符、下划线)
|
||||
- 配置文件自动备份 (时间戳)
|
||||
- 敏感信息掩码显示
|
||||
- HTTP 状态码验证
|
||||
|
||||
### 配置文件位置
|
||||
- Windows: `%USERPROFILE%\.claude\settings.json`
|
||||
- Unix/Linux/macOS: `~/.claude/settings.json`
|
||||
Reference in New Issue
Block a user