Files
server-deploy/windows-dev-stack/README.md
Joywayer dd3eb24d0f refactor: 拆分 claude-dev-stack 为 windows-dev-stack 和 wsl-dev-stack
将原 claude-dev-stack 目录拆分为独立的 Windows 和 WSL 部署栈,便于分别维护和使用。

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-29 01:11:20 +08:00

156 lines
4.5 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.
# Windows Dev Stack
**Windows 原生** Claude Code CLI + GitHub Copilot CLI + MCP + Rust Token Killer 一键部署方案。
不依赖 WSL2所有组件直接运行在 Windows 本机。
## 组件清单
| 组件 | 说明 | 安装位置 |
|------|------|---------|
| **Node.js LTS** | JS 运行时 | winget → 系统 |
| **Claude Code CLI** | `@anthropic-ai/claude-code` | npm global |
| **GitHub CLI + Copilot CLI** | `gh` + `github/gh-copilot` 扩展 | winget + gh extension |
| **Unity MCP Server** | AnkleBreaker-Studio — Claude ↔ Unity Editor | `%USERPROFILE%\unity-mcp-server\` |
| **Godot MCP Pro** | 本地包 v1.14.1 — Claude ↔ Godot Editor | `%USERPROFILE%\godot-mcp-pro\` |
| **Rust** | rustup stable 工具链 | winget → `%USERPROFILE%\.cargo\` |
| **RTK** | Rust Token Killer — LLM token 优化 | cargo install → `%USERPROFILE%\.cargo\bin\` |
## 目录结构
```
windows-dev-stack/
├── deploy.ps1 # Windows 一键部署PowerShell 5.1+
├── .env.example # 配置模板
└── README.md
```
> Godot MCP Pro 本地包位于 `../claude-dev-stack/godot-mcp-pro-v1.14.1/`
> 两个 stack 共用同一份本地包,无需重复存储。
---
## 快速开始
```powershell
# 1. 复制并填写配置
cd path\to\windows-dev-stack
cp .env.example .env
notepad .env
# 2. 运行部署(普通用户即可;防火墙步骤会弹 UAC 提权)
pwsh .\deploy.ps1
# 3. GitHub CLI 登录(首次使用前)
gh auth login
```
---
## 配置说明(`.env`
### 推荐:灵眸 AI国内直连无需代理
| 变量 | 说明 |
|------|------|
| `ANTHROPIC_AUTH_TOKEN` | 灵眸 API Key从 [lmuai.com](https://lmuai.com) 获取 |
| `ANTHROPIC_BASE_URL` | `https://api.lmuai.com`(默认) |
| `CLAUDE_MODEL` | `claude-sonnet-4-6`(默认) |
### 备选Anthropic 官方 API
| 变量 | 说明 |
|------|------|
| `ANTHROPIC_API_KEY` | 从 [console.anthropic.com](https://console.anthropic.com) 获取 |
| `ANTHROPIC_BASE_URL` | `https://api.anthropic.com` |
---
## 与 claude-dev-stack 的对比
| 特性 | `claude-dev-stack` | `windows-dev-stack` |
|------|--------------------|---------------------|
| 运行环境 | WSL2Linux | Windows 原生 |
| Claude Code CLI | WSL2 内 npm global | Windows npm global |
| GitHub Copilot CLI | WSL2 gh extension | Windows gh extension |
| Rust / RTK | WSL2 cargo | Windows cargo |
| MCP Servers | WSL2 node 进程 | Windows node 进程 |
| 适合场景 | Linux 工具链 / 命令行重度用户 | 纯 Windows 开发者 / 不想装 WSL2 |
两套 stack **可以共存**,各自写入独立配置,互不干扰。
---
## MCP 配置覆盖范围
`deploy.ps1` 自动写入以下客户端的 MCP 配置:
| 客户端 | 配置文件 |
|--------|---------|
| Claude Desktop | `%APPDATA%\Claude\claude_desktop_config.json` |
| Cursor | `%USERPROFILE%\.cursor\mcp.json` |
| Windsurf | `%APPDATA%\Windsurf\mcp_config.json` |
| VS Code | `%APPDATA%\Code\User\mcp.json` |
| Claude Code CLI | `claude mcp add --scope user`(写入用户级 MCP |
---
## RTK 使用
RTK 通过 Claude Code 的 PreToolUse hook 自动生效(`deploy.ps1` 运行 `rtk init -g` 注册)。
```powershell
# 查看 token 节省统计
rtk gain
rtk gain --history
# 手动使用
rtk git status
rtk cargo test
```
`.github/copilot-instructions.md` 已在仓库根目录配置GitHub Copilot (VS Code) 会自动读取并在终端命令前加 `rtk` 前缀。
---
## 故障排查
### Node.js 安装后找不到命令
```powershell
# 刷新当前会话 PATH
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" +
[System.Environment]::GetEnvironmentVariable("Path","User")
# 或直接重开 PowerShell
```
### Rust / cargo 安装后找不到命令
```powershell
# 手动加入 PATH当前会话
$env:Path = "$env:USERPROFILE\.cargo\bin;$env:Path"
# 或重开终端rustup installer 已写入用户 PATH
```
### rtk 安装失败(需要 Build Tools
```powershell
# 安装 Visual C++ Build ToolsRust Windows 编译器后端依赖)
winget install Microsoft.VisualStudio.2022.BuildTools
# 安装后重开终端,再运行:
cargo install --git https://github.com/rtk-ai/rtk
```
### gh copilot 找不到扩展
```powershell
# 确认已登录
gh auth status
# 重新安装扩展
gh extension install github/gh-copilot
```
### Unity MCP Bridge 连接失败
```powershell
# 检查 Bridge 端口
Invoke-WebRequest http://127.0.0.1:7890/api/ping
# 确认防火墙已放行
Get-NetFirewallRule -DisplayName "Unity MCP Bridge*" | Select-Object DisplayName, Enabled
```