Private
Public Access
1
0
Files
xcodecli-shells/docs/guide/claude-code.md
sususu98 34c950057c
Some checks failed
Deploy to Cloudflare Pages / deploy (push) Failing after 11s
refactor: Claude Code 安装方式从官方原生脚本改为 npm install
国内用户无法访问 claude.ai/install.sh,统一三个工具的安装路径:
- 移除 setup.sh/ps1 中 Claude Code 的特殊安装分支
- ClaudeCode 独立脚本添加 Node.js/fnm 检测安装函数链
- 三个工具均使用 npm install -g 安装 (需要 Node.js >= 20)
- 更新 CLAUDE.md 和文档中的安装说明
2026-02-28 19:38:00 +08:00

53 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Claude Code 配置指南
Claude Code 是 Anthropic 推出的 AI 编码助手。通过 XCodeCLI你可以将其连接到自定义 API 端点。
## 快速安装与配置
使用下面的单一行命令即可自动完成安装和配置。
::: code-group
```bash [macOS / Linux]
API_KEY='你的密钥' bash -c "$(curl -fsSL https://gitea.sususu.cf/sususu/xcodecli-shells/raw/branch/main/ClaudeCode/setup-claude-code.sh)"
```
```powershell [Windows]
$key='你的密钥'; $f="$env:TEMP\xc.ps1";iwr -useb https://gitea.sususu.cf/sususu/xcodecli-shells/raw/branch/main/ClaudeCode/setup-claude-code.ps1 -OutFile $f;& $f
```
:::
> 请将命令中的 `你的密钥` 替换为你的实际 API 密钥。
::: warning ⚠️ 配置完成后请重启终端
脚本会自动配置环境变量(`ANTHROPIC_AUTH_TOKEN` 等),但需要**重启终端**才能生效。
- **macOS / Linux**:重新打开终端,或执行 `source ~/.zshrc`(或 `source ~/.bashrc`
- **Windows**:重新打开 PowerShell 窗口
如果不重启Claude Code 首次启动时可能无法读取 API 密钥。
:::
## 手动配置说明
如果你想手动配置Claude Code 的配置文件位于:
- **macOS / Linux**: `~/.claude/settings.json`
- **Windows**: `~/.claude/settings.json` (位于用户主目录下)
配置内容示例:
```json
{
"apiBaseUrl": "https://api2.xcodecli.com",
"apiKey": "sk-your-key-here"
}
```
## 常见问题
- **Q: 安装后无法使用?**
- A: 请确保已重新打开终端。Claude Code 通过 npm 安装,需要 Node.js >= 20。如果问题仍存在检查 Node.js 和 npm 全局目录是否在 PATH 中。
- **Q: 权限错误?**
- A: 使用 npm 安装时,建议通过 fnm 管理 Node.js避免全局安装需要 `sudo`。