修复 rust
This commit is contained in:
2
.github/copilot-instructions.md
vendored
2
.github/copilot-instructions.md
vendored
@@ -24,4 +24,4 @@ rtk gain --history # Per-command savings history
|
|||||||
rtk discover # Find missed rtk opportunities
|
rtk discover # Find missed rtk opportunities
|
||||||
rtk proxy <cmd> # Run raw (no filtering) but track usage
|
rtk proxy <cmd> # Run raw (no filtering) but track usage
|
||||||
```
|
```
|
||||||
<!-- /rtk-instructions -->
|
<!-- /rtk-instructions -->
|
||||||
43
claude-dev-stack/.env
Normal file
43
claude-dev-stack/.env
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# =============================================================
|
||||||
|
# Claude Dev Stack 配置文件
|
||||||
|
# 复制为 .env 并按需填写
|
||||||
|
# =============================================================
|
||||||
|
|
||||||
|
# ── Claude / API 配置 ────────────────────────────────────────
|
||||||
|
# 推荐:灵眸 AI(国内直连,无需代理)https://docs.lmuai.com/docs/tools/claude-code
|
||||||
|
ANTHROPIC_AUTH_TOKEN=sk-ccaf8169bce7c735dfa1f021ec326b3904842dfd50e1ae817c3417017e0d8ee0
|
||||||
|
ANTHROPIC_BASE_URL=https://api.lmuai.com
|
||||||
|
|
||||||
|
# 备选:Anthropic 官方 API Key(海外直连)
|
||||||
|
# ANTHROPIC_API_KEY=
|
||||||
|
# ANTHROPIC_BASE_URL=https://api.anthropic.com
|
||||||
|
|
||||||
|
# 备选:DeepSeek 兼容接口
|
||||||
|
# ANTHROPIC_API_KEY=
|
||||||
|
# ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
|
||||||
|
|
||||||
|
# 默认使用的模型
|
||||||
|
# 灵眸可选:claude-opus-4-7 | claude-sonnet-4-6 | claude-sonnet-4-5 | claude-haiku-4-5
|
||||||
|
# DeepSeek可选:deepseek-v4-pro
|
||||||
|
CLAUDE_MODEL=claude-sonnet-4-6
|
||||||
|
|
||||||
|
# ── WSL2 ────────────────────────────────────────────────────
|
||||||
|
# WSL2 发行版名称(wsl --list 查看已安装发行版)
|
||||||
|
WSL_DISTRO=Ubuntu
|
||||||
|
|
||||||
|
# 设为 true 可跳过 WSL2 安装步骤(已安装时使用)
|
||||||
|
SKIP_WSL_INSTALL=false
|
||||||
|
|
||||||
|
# ── Unity MCP ───────────────────────────────────────────────
|
||||||
|
# unity-mcp-server 自动克隆至 WSL2 ~/.mcp-servers/unity-mcp-server/
|
||||||
|
# Unity Plugin 需手动通过 Package Manager 安装:
|
||||||
|
# https://github.com/AnkleBreaker-Studio/unity-mcp-plugin.git
|
||||||
|
# (无需额外配置)
|
||||||
|
|
||||||
|
# ── Rust / Token Killer ──────────────────────────────────────
|
||||||
|
# (暂无需配置,预留扩展用)
|
||||||
|
# CARGO_REGISTRY_MIRROR=https://rsproxy.cn/
|
||||||
|
|
||||||
|
# ── Docker 镜像加速(可选)──────────────────────────────────
|
||||||
|
# 若 WSL2 内需要 Docker,可配置国内加速镜像(逗号分隔)
|
||||||
|
# DOCKER_REGISTRY_MIRRORS=https://docker.m.daocloud.io,https://hub-mirror.c.163.com
|
||||||
@@ -103,13 +103,18 @@ function Refresh-Path {
|
|||||||
# ──────────────────────────────────────────────────────────────
|
# ──────────────────────────────────────────────────────────────
|
||||||
function Install-Winget {
|
function Install-Winget {
|
||||||
param([string]$Id, [string]$DisplayName)
|
param([string]$Id, [string]$DisplayName)
|
||||||
$wg = Get-Command winget -ErrorAction SilentlyContinue
|
# pwsh (Core) 里 winget 不在 PATH,尝试固定路径
|
||||||
if (-not $wg) {
|
$wgPath = (Get-Command winget -ErrorAction SilentlyContinue)?.Source
|
||||||
|
if (-not $wgPath) {
|
||||||
|
$wgPath = "$env:LOCALAPPDATA\Microsoft\WindowsApps\winget.exe"
|
||||||
|
if (-not (Test-Path $wgPath)) { $wgPath = $null }
|
||||||
|
}
|
||||||
|
if (-not $wgPath) {
|
||||||
Write-Warn "未找到 winget,请手动安装 $DisplayName"
|
Write-Warn "未找到 winget,请手动安装 $DisplayName"
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
Write-Info "winget install $Id ..."
|
Write-Info "winget install $Id ..."
|
||||||
winget install --id $Id --silent --accept-source-agreements --accept-package-agreements 2>&1 | Out-Null
|
& $wgPath install --id $Id --silent --accept-source-agreements --accept-package-agreements 2>&1 | Out-Null
|
||||||
Refresh-Path
|
Refresh-Path
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
@@ -576,7 +581,12 @@ if ($cargoCmd) {
|
|||||||
Write-OK "Rust 已安装: $($rustcVer.Trim())"
|
Write-OK "Rust 已安装: $($rustcVer.Trim())"
|
||||||
} else {
|
} else {
|
||||||
# 检查 winget 是否已记录安装(避免重复安装时阻塞)
|
# 检查 winget 是否已记录安装(避免重复安装时阻塞)
|
||||||
$wgList = winget list --id Rustlang.Rustup --accept-source-agreements 2>&1 | Out-String
|
$wgPath = (Get-Command winget -ErrorAction SilentlyContinue)?.Source
|
||||||
|
if (-not $wgPath) {
|
||||||
|
$fallback = "$env:LOCALAPPDATA\Microsoft\WindowsApps\winget.exe"
|
||||||
|
if (Test-Path $fallback) { $wgPath = $fallback }
|
||||||
|
}
|
||||||
|
$wgList = if ($wgPath) { & $wgPath list --id Rustlang.Rustup --accept-source-agreements 2>&1 | Out-String } else { "" }
|
||||||
if ($wgList -match "Rustlang.Rustup") {
|
if ($wgList -match "Rustlang.Rustup") {
|
||||||
Write-Info "rustup 已安装,但当前会话 PATH 未更新。已将 $cargoBin 加入 PATH"
|
Write-Info "rustup 已安装,但当前会话 PATH 未更新。已将 $cargoBin 加入 PATH"
|
||||||
# rustup 首次运行会初始化 stable 工具链
|
# rustup 首次运行会初始化 stable 工具链
|
||||||
@@ -586,14 +596,16 @@ if ($cargoCmd) {
|
|||||||
} else {
|
} else {
|
||||||
Write-Info "通过 winget 安装 Rust (rustup)..."
|
Write-Info "通过 winget 安装 Rust (rustup)..."
|
||||||
$ok = Install-Winget "Rustlang.Rustup" "Rustup"
|
$ok = Install-Winget "Rustlang.Rustup" "Rustup"
|
||||||
if (Test-Path $cargoBin) { $env:Path = "$cargoBin;$env:Path" }
|
if ($ok) {
|
||||||
Refresh-Path
|
if (Test-Path $cargoBin) { $env:Path = "$cargoBin;$env:Path" }
|
||||||
$cargoCmd = Get-Command cargo -ErrorAction SilentlyContinue
|
Refresh-Path
|
||||||
if ($cargoCmd) {
|
$cargoCmd = Get-Command cargo -ErrorAction SilentlyContinue
|
||||||
Write-OK "Rust 安装完成: $(& rustc --version 2>&1)"
|
if ($cargoCmd) {
|
||||||
} else {
|
Write-OK "Rust 安装完成: $(& rustc --version 2>&1)"
|
||||||
Write-Warn "Rust 安装后未找到 cargo,请关闭并重开终端后继续"
|
} else {
|
||||||
Write-Warn " 或手动安装:https://rustup.rs"
|
Write-Warn "Rust 安装后未找到 cargo,请关闭并重开终端后继续"
|
||||||
|
Write-Warn " 或手动安装:https://rustup.rs"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user