AI Coding CLI 工具一键安装
本文档提供了常用 AI 辅助编程 CLI 工具的安装指南。
🛠️ 包含工具列表
Section titled “🛠️ 包含工具列表”脚本和指南涵盖以下主流 AI 编程工具:
| 工具名称 | 安装建议 | 说明 |
|---|---|---|
| Claude Code | 推荐原生安装 | Anthropic 官方推出的 AI 编程代理工具,直接在终端中运行,支持代码库理解和日常任务自动化。 |
| OpenCode | 推荐原生安装 | 开源的终端 AI 编程代理,提供极速响应和强大的代码操作能力。 |
| Oh My OpenCode | npm 安装 | OpenCode 的增强插件包,提供多代理编排、并行处理和增强功能。 |
| iFlow CLI | npm 安装 | 终端 AI 助手,专注于代码分析、任务自动化和自然语言交互,支持 ACP 协议。 |
| Qwen Code | npm 安装 | 基于 Qwen3-Coder 模型优化的开源终端 AI 代理。 |
| Gemini CLI | npm 安装 | Google 官方开源 AI 代理,将 Gemini 模型能力带入终端。 |
| Codex | npm 安装 | OpenAI 推出的命令行编码代理,支持读取、编辑、运行代码及修复 Bug。 |
| Happy Coder | npm 安装 | Claude Code 和 Codex 的开源移动端/Web端客户端。 |
| Qoder CLI (可选) | npm 安装 | Qoder AI 平台的命令行接口。 |
| CodeBuddy (可选) | npm 安装 | 腾讯云推出的 AI 编程助手,基于混元大模型。 |
🤖 Claude Code 官方安装
Section titled “🤖 Claude Code 官方安装”Claude Code 官方推荐使用以下原生安装命令(Native Install),该方式支持自动后台更新:
Linux / macOS / WSL
Section titled “Linux / macOS / WSL”curl -fsSL https://claude.ai/install.sh | bashWindows PowerShell
Section titled “Windows PowerShell”irm https://claude.ai/install.ps1 | iexWindows CMD
Section titled “Windows CMD”curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd🚀 OpenCode 官方安装
Section titled “🚀 OpenCode 官方安装”OpenCode 同样推荐使用原生安装方式,以获得最佳性能:
Linux / macOS / WSL
Section titled “Linux / macOS / WSL”curl -fsSL https://opencode.ai/install | bashWindows (推荐使用包管理器)
Section titled “Windows (推荐使用包管理器)”- Chocolatey:
choco install opencode - Scoop:
scoop install opencode - Homebrew (macOS/Linux):
brew install anomalyco/tap/opencode
🖥️ OpenCode 桌面版(推荐)
Section titled “🖥️ OpenCode 桌面版(推荐)”访问 OpenCode 官方下载页面 获取最新版本:
| 平台 | 下载方式 |
|---|---|
| macOS (Apple Silicon) | 下载 DMG 安装包 |
| macOS (Intel) | 下载 DMG 安装包 |
| Windows (x64) | 下载 EXE 安装程序 |
| Linux (Debian/Ubuntu) | 下载 .deb 包 |
| Linux (RHEL/Fedora) | 下载 .rpm 包 |
方式一:Homebrew Cask(推荐)
brew install --cask opencode-desktop方式二:手动安装
- 从官网下载对应架构的 DMG 文件
- 双击打开 DMG 文件
- 将 OpenCode 图标拖拽到 Applications 文件夹
Windows
Section titled “Windows”- 从官网下载
opencode-desktop-windows-x64.exe - 双击运行安装程序
- 按提示完成安装
Debian/Ubuntu:
# 下载 .deb 包后sudo dpkg -i opencode-desktop_*.debsudo apt-get install -f # 解决依赖问题RHEL/Fedora:
# 下载 .rpm 包后sudo rpm -i opencode-desktop_*.rpm安装完成后,首次启动需要进行 API 提供商配置:
方式一:使用 /connect 命令(推荐)
Section titled “方式一:使用 /connect 命令(推荐)”- 启动 OpenCode 桌面应用
- 在聊天输入框中输入
/connect - 从列表中选择 AI 提供商(如 Anthropic、OpenAI、Google 等)
- 输入您的 API 密钥
- 使用
/models命令选择要使用的模型
方式二:环境变量配置
Section titled “方式二:环境变量配置”在系统环境变量中设置 API 密钥:
# Linux/macOS (添加到 ~/.zshrc 或 ~/.bashrc)export ANTHROPIC_API_KEY="your-anthropic-key"export OPENAI_API_KEY="your-openai-key"
# Windows PowerShell$env:ANTHROPIC_API_KEY = "your-anthropic-key"方式三:配置文件
Section titled “方式三:配置文件”编辑配置文件 ~/.config/opencode/opencode.json:
{ "$schema": "https://opencode.ai/schema.json", "model": "claude-sonnet-4-20250514", "provider": { "anthropic": { "options": { "apiKey": "{env:ANTHROPIC_API_KEY}" } } }}Plan 模式与 Build 模式
Section titled “Plan 模式与 Build 模式”OpenCode 提供两种工作模式,可通过 Tab 键切换:
| 模式 | 说明 | 适用场景 |
|---|---|---|
| Plan 模式 | 只读模式,仅分析代码,不做修改 | 理解代码库、制定实施计划、代码审查 |
| Build 模式 | 完整权限,可修改文件和执行命令 | 功能开发、Bug 修复、重构代码 |
从桌面版安装 CLI
Section titled “从桌面版安装 CLI”桌面版支持将 CLI 安装到系统,安装后可在终端直接使用 opencode 命令:
- 打开 OpenCode 桌面应用
- 进入设置或使用命令面板
- 选择 “Install CLI” 选项
🔤 LSP 语言服务器安装(可选)
Section titled “🔤 LSP 语言服务器安装(可选)”AI Coding 工具通过 LSP(Language Server Protocol)获得更强的代码理解能力,如类型检查、跳转定义、自动补全等。安装后 Claude Code 和 OpenCode 会自动发现并使用,无需额外配置。
| 语言/格式 | LSP 名称 | 安装方式 | 更新方式 |
|---|---|---|---|
| Python | basedpyright | uv | uv tool upgrade basedpyright |
| TypeScript | typescript-language-server | npm | npm outdated -g 后重装 |
| Rust | rust-analyzer | rustup | rustup update |
| Bash/Shell | bash-language-server | bun/npm | bun update -g |
| Perl | Perl::LanguageServer | cpanm | cpanm Perl::LanguageServer |
| SQL | sql-language-server | bun/npm | bun update -g |
| Dockerfile | dockerfile-language-server-nodejs | bun/npm | bun update -g |
| YAML | yaml-language-server | bun/npm | bun update -g |
| JSON/HTML/CSS/ESLint | vscode-langservers-extracted | bun/npm | bun update -g |
| TOML | @taplo/cli | bun/npm | bun update -g |
| Vue/Markdown | @vue/language-server | bun/npm | bun update -g |
Python — basedpyright
Section titled “Python — basedpyright”uv tool install basedpyrightTypeScript — typescript-language-server
Section titled “TypeScript — typescript-language-server”npm i -g typescript-language-server typescriptRust — rust-analyzer
Section titled “Rust — rust-analyzer”rustup component add rust-analyzer # 语言服务器rustup component add rust-src # 标准库源码(必须)rustup component add clippy rustfmt # 代码检查和格式化(推荐)Bash/Shell — bash-language-server
Section titled “Bash/Shell — bash-language-server”bun add -g bash-language-server支持 bash、zsh、fish 等多种 Shell,提供智能补全、语法检查和代码导航。
Perl — Perl::LanguageServer
Section titled “Perl — Perl::LanguageServer”brew install cpanminus # 先安装 cpanm(如果没有)cpanm Perl::LanguageServerSQL — sql-language-server
Section titled “SQL — sql-language-server”bun add -g sql-language-server支持 MySQL、PostgreSQL、SQLite、SQL Server 等主流数据库,可连接实际数据库进行 schema 分析。
Dockerfile — dockerfile-language-server-nodejs
Section titled “Dockerfile — dockerfile-language-server-nodejs”bun add -g dockerfile-language-server-nodejsDocker 官方维护,同时支持 Dockerfile 和 docker-compose.yml。
YAML — yaml-language-server
Section titled “YAML — yaml-language-server”bun add -g yaml-language-serverRed Hat 官方维护,内置 Kubernetes、Docker Compose、GitHub Actions 等数百种 Schema。
JSON / HTML / CSS / ESLint — vscode-langservers-extracted
Section titled “JSON / HTML / CSS / ESLint — vscode-langservers-extracted”bun add -g vscode-langservers-extracted社区从 VS Code 提取的合集包,一个包同时提供四个语言服务器:
vscode-json-language-server(JSON/JSONC)vscode-html-language-server(HTML)vscode-css-language-server(CSS/SCSS/Less)vscode-eslint-language-server(ESLint)
TOML — @taplo/cli
Section titled “TOML — @taplo/cli”bun add -g @taplo/cliRust 编写,性能极佳,完美支持 Cargo.toml、pyproject.toml 等常用格式。
Vue / Markdown — @vue/language-server
Section titled “Vue / Markdown — @vue/language-server”bun add -g @vue/language-serverVue 官方维护的 LSP(原 Volar),支持 Vue 单文件组件和 Markdown 语法。
一键安装脚本
Section titled “一键安装脚本”将以下脚本保存为 install_lsp.sh,自动检测已安装的包管理器并安装对应 LSP:
#!/bin/bash# 一键安装所有推荐的 LSP 语言服务器# 自动检测:bun / npm / uv / rustup / cpanm,跳过未安装的包管理器
GREEN='\033[0;32m'YELLOW='\033[1;33m'RED='\033[0;31m'NC='\033[0m'
ok() { echo -e "${GREEN}✔${NC} $1"; }skip() { echo -e "${YELLOW}⊘${NC} $1($2 未安装,跳过)"; }fail() { echo -e "${RED}✖${NC} $1"; }
echo "=========================================="echo " LSP 语言服务器一键安装"echo "=========================================="echo ""
installed=0skipped=0failed=0
# ---------- Bun 管理的 LSP (7 种) ----------BUN_PKGS=( bash-language-server sql-language-server dockerfile-language-server-nodejs yaml-language-server vscode-langservers-extracted "@taplo/cli" "@vue/language-server")
if command -v bun &> /dev/null; then echo "[Bun] 安装 7 种 LSP..." for pkg in "${BUN_PKGS[@]}"; do if bun add -g "$pkg" > /dev/null; then ok "$pkg" ((installed++)) else fail "$pkg" ((failed++)) fi doneelse for pkg in "${BUN_PKGS[@]}"; do skip "$pkg" "bun" ((skipped++)) done echo -e " 提示: 安装 Bun 后可安装以上 LSP → ${YELLOW}curl -fsSL https://bun.sh/install | bash${NC}"fi
# ---------- Python: basedpyright ----------if command -v uv &> /dev/null; then echo "[uv] 安装 basedpyright..." if uv tool install basedpyright > /dev/null; then ok "basedpyright" ((installed++)) else fail "basedpyright" ((failed++)) fielse skip "basedpyright" "uv" echo -e " 提示: 安装 uv 后可安装 → ${YELLOW}curl -LsSf https://astral.sh/uv/install.sh | sh${NC}" ((skipped++))fi
# ---------- TypeScript: typescript-language-server ----------if command -v npm &> /dev/null; then echo "[npm] 安装 typescript-language-server..." if npm i -g typescript-language-server typescript > /dev/null; then ok "typescript-language-server" ((installed++)) else fail "typescript-language-server" ((failed++)) fielse skip "typescript-language-server" "npm" ((skipped++))fi
# ---------- Rust: rust-analyzer ----------if command -v rustup &> /dev/null; then echo "[rustup] 安装 rust-analyzer + rust-src + clippy + rustfmt..." if rustup component add rust-analyzer rust-src clippy rustfmt > /dev/null; then ok "rust-analyzer" ((installed++)) else fail "rust-analyzer" ((failed++)) fielse skip "rust-analyzer" "rustup" echo -e " 提示: 安装 Rust 后可安装 → ${YELLOW}curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh${NC}" ((skipped++))fi
# ---------- Perl: Perl::LanguageServer ----------if command -v cpanm &> /dev/null; then echo "[cpanm] 安装 Perl::LanguageServer..." if cpanm Perl::LanguageServer > /dev/null; then ok "Perl::LanguageServer" ((installed++)) else fail "Perl::LanguageServer" ((failed++)) fielif command -v brew &> /dev/null; then echo "[brew] 安装 cpanm..." if brew install cpanminus -q > /dev/null; then if cpanm Perl::LanguageServer > /dev/null; then ok "Perl::LanguageServer" ((installed++)) else fail "Perl::LanguageServer" ((failed++)) fi else fail "cpanm (brew 安装失败)" ((failed++)) fielse skip "Perl::LanguageServer" "cpanm" ((skipped++))fi
# ---------- 汇总 ----------echo ""echo "=========================================="echo -e " 安装完成: ${GREEN}${installed}${NC} 种 跳过: ${YELLOW}${skipped}${NC} 种 失败: ${RED}${failed}${NC} 种"echo " 请重启 Claude Code/OpenCode 以生效"echo "=========================================="一键更新脚本
Section titled “一键更新脚本”将以下脚本保存为 update_lsp.sh,自动检测并更新所有已安装的 LSP:
#!/bin/bash# 一键更新所有已安装的 LSP 语言服务器# 自动检测:bun / npm / uv / rustup / cpanm,跳过未安装的包管理器
GREEN='\033[0;32m'YELLOW='\033[1;33m'RED='\033[0;31m'NC='\033[0m'
ok() { echo -e "${GREEN}✔${NC} $1"; }skip() { echo -e "${YELLOW}⊘${NC} $1(未安装,跳过)"; }fail() { echo -e "${RED}✖${NC} $1(更新失败)"; }
echo "=========================================="echo " LSP 语言服务器一键更新"echo "=========================================="echo ""
updated=0skipped=0failed=0
# ---------- Bun 管理的 LSP (7 种) ----------if command -v bun &> /dev/null; then echo "[Bun] 批量更新所有全局包..." if bun update -g; then ok "Bun 管理的 7 种 LSP 已更新" ((updated++)) else fail "Bun 管理的 LSP" ((failed++)) fielse skip "Bun 管理的 LSP" ((skipped++))fi
# ---------- npm 管理的 LSP (TypeScript) ----------if command -v npm &> /dev/null; then echo "[npm] 检查 typescript-language-server 更新..." npm outdated -g typescript-language-server typescript 2>/dev/null || true if npm i -g typescript-language-server typescript; then ok "typescript-language-server" ((updated++)) else fail "typescript-language-server" ((failed++)) fielse skip "typescript-language-server" ((skipped++))fi
# ---------- Python: basedpyright ----------if command -v uv &> /dev/null; then echo "[uv] 更新 basedpyright..." if uv tool upgrade basedpyright; then ok "basedpyright" ((updated++)) else fail "basedpyright" ((failed++)) fielse skip "basedpyright" ((skipped++))fi
# ---------- Rust: rust-analyzer ----------if command -v rustup &> /dev/null; then echo "[rustup] 更新 Rust 工具链和组件..." if rustup update; then ok "rust-analyzer + rust-src + clippy + rustfmt" ((updated++)) else fail "rust-analyzer" ((failed++)) fielse skip "rust-analyzer" ((skipped++))fi
# ---------- Perl: Perl::LanguageServer ----------if command -v cpanm &> /dev/null; then echo "[cpanm] 更新 Perl::LanguageServer..." if cpanm Perl::LanguageServer; then ok "Perl::LanguageServer" ((updated++)) else fail "Perl::LanguageServer" ((failed++)) fielse skip "Perl::LanguageServer" ((skipped++))fi
# ---------- 汇总 ----------echo ""echo "=========================================="echo -e " 更新完成: ${GREEN}${updated}${NC} 组 跳过: ${YELLOW}${skipped}${NC} 组 失败: ${RED}${failed}${NC} 组"echo " 请重启 Claude Code/OpenCode 以生效"echo "=========================================="📋 前提条件
Section titled “📋 前提条件”虽然 Claude Code 和 OpenCode 的主程序已支持原生安装且无需 Node.js,但其插件(如 oh-my-opencode)以及其他基于 npm 的工具仍依赖 Node.js 环境。
请确保已安装:
- Node.js: v18.0.0 或更高版本
- npm: 通常随 Node.js 一起安装
🐧 Linux / macOS 安装脚本
Section titled “🐧 Linux / macOS 安装脚本”使用 Bash 脚本一键安装。
- 创建文件
install_ai_tools.sh并粘贴以下内容:
#!/bin/bash
# ==========================================# 配置与颜色定义# ==========================================RED='\033[0;31m'GREEN='\033[0;32m'YELLOW='\033[1;33m'BLUE='\033[0;34m'CYAN='\033[0;36m'NC='\033[0m' # No ColorBOLD='\033[1m'
# 用于存储最终结果的数组SUCCESS_LIST=()FAIL_LIST=()SKIP_LIST=()
# ==========================================# 辅助函数# ==========================================
# 打印带样式的标题print_header() { echo -e "\n${BLUE}========================================${NC}" echo -e "${BOLD}$1${NC}" echo -e "${BLUE}========================================${NC}"}
# 打印信息log_info() { echo -e "${CYAN}➜${NC} $1"}
# 打印成功log_success() { echo -e "${GREEN}✔ $1${NC}"}
# 打印警告log_warn() { echo -e "${YELLOW}⚠ $1${NC}"}
# 打印错误log_error() { echo -e "${RED}✖ $1${NC}"}
# 获取全局包版本的函数 (优化:增加 --depth=0 提升速度)get_version() { local package=$1 local version=$(npm list -g --depth=0 "$package" 2>/dev/null | grep "$package@" | sed 's/.*@//' | head -n 1) if [ -n "$version" ]; then echo "$version" else echo "未安装" fi}
# 安装并显示状态的函数install_package() { local package=$1 local display_name=$2
echo -e "\n${BOLD}正在处理: ${CYAN}$display_name${NC} ($package)"
local before_version=$(get_version "$package")
# 提示开始安装,不换行 echo -ne " 状态: ${YELLOW}正在安装/更新...${NC}\r"
# 执行安装,将标准输出和错误重定向到临时文件以便出错时查看 local log_file=$(mktemp) if npm i -g "$package" > "$log_file" 2>&1; then # 安装成功 local after_version=$(get_version "$package")
# 清除当前行 echo -ne "\033[2K\r"
if [ "$before_version" = "未安装" ]; then log_success "安装完成 (版本: $after_version)" SUCCESS_LIST+=("$display_name (新安装: $after_version)") elif [ "$before_version" = "$after_version" ]; then log_success "已是最新 (版本: $after_version)" SUCCESS_LIST+=("$display_name (保持不变)") else log_success "更新成功 ($before_version ➜ $after_version)" SUCCESS_LIST+=("$display_name (更新: $after_version)") fi else # 安装失败 echo -ne "\033[2K\r" log_error "安装失败!" echo -e "${RED}错误日志如下:${NC}" cat "$log_file" FAIL_LIST+=("$display_name") fi rm -f "$log_file"}
# ==========================================# 主程序# ==========================================
# 检查 npm 是否安装if ! command -v npm &> /dev/null; then log_error "未检测到 Node.js/npm 环境,请先安装 Node.js。" exit 1fi
print_header "开始安装 AICoding 相关工具..."
# 工具列表# 注意:opencode-ai 已移除,推荐使用原生安装,见上方"OpenCode 官方安装"章节install_package "oh-my-opencode" "oh-my-opencode"install_package "@iflow-ai/iflow-cli" "iflow-cli"install_package "@qwen-code/qwen-code" "qwen-code"install_package "@google/gemini-cli" "gemini-cli"# 已移除 claude-codeinstall_package "@openai/codex" "codex"install_package "happy-coder" "happy-coder"
# 可选包 (保持注释状态)# install_package "@qoder-ai/qodercli" "qodercli"# install_package "@tencent-ai/codebuddy-code" "codebuddy-code"
# ==========================================# 打印汇总报告# ==========================================print_header "安装任务汇总"
# 打印成功列表if [ ${#SUCCESS_LIST[@]} -gt 0 ]; then echo -e "${GREEN}成功项:${NC}" for item in "${SUCCESS_LIST[@]}"; do echo " • $item" donefi
# 打印失败列表if [ ${#FAIL_LIST[@]} -gt 0 ]; then echo -e "\n${RED}失败项 (请检查网络或权限):${NC}" for item in "${FAIL_LIST[@]}"; do echo " • $item" done exit 1else echo -e "\n${BOLD}${GREEN}所有工具已就绪!Happy Coding! 🚀${NC}"fi- 赋予执行权限并运行:
chmod +x install_ai_tools.sh./install_ai_tools.sh🪟 Windows 安装脚本
Section titled “🪟 Windows 安装脚本”使用 PowerShell 脚本一键安装。
- 创建文件
install_ai_tools.ps1并粘贴以下内容:
# AICoding Tools Installer Script (Enhanced PowerShell Version)# Usage: Right-click and select "Run with PowerShell" (Run as Administrator recommended)
# 1. Setup UI and Encoding$Host.UI.RawUI.WindowTitle = "AICoding Tools Installer"[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
# 2. Check for Administrator Privileges$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())$isAdmin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) { Write-Host "WARNING: You are not running as Administrator." -ForegroundColor Yellow Write-Host "Global installations (npm -g) often require Admin rights." Write-Host "If installation fails, please restart this script as Administrator." Write-Host "----------------------------------------" Start-Sleep -Seconds 2}
# 3. Check Prerequisites (Node & NPM)if (-not (Get-Command npm -ErrorAction SilentlyContinue)) { Write-Host "ERROR: 'npm' is not found in your PATH." -ForegroundColor Red Write-Host "Please install Node.js first: https://nodejs.org/" -ForegroundColor Red $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") Exit}
# Define the package list$packages = @( # opencode-ai 已移除,推荐使用原生安装,见上方"OpenCode 官方安装"章节 @{ Name = "oh-my-opencode"; Display = "oh-my-opencode" }, @{ Name = "@iflow-ai/iflow-cli"; Display = "iflow-cli" }, @{ Name = "@qwen-code/qwen-code"; Display = "qwen-code" }, @{ Name = "@google/gemini-cli"; Display = "gemini-cli" }, # Removed claude-code @{ Name = "@openai/codex"; Display = "codex" }, @{ Name = "happy-coder"; Display = "happy-coder" } # Add more packages here)
# Initialize report list$report = @()
# Function to safely get versionfunction Get-NpmPackageVersion { param([string]$PackageName) try { # --depth=0 is faster; 2>$null suppresses stderr $output = npm list -g $PackageName --depth=0 2>$null | Out-String $escapedName = [regex]::Escape($PackageName) if ($output -match "$escapedName@([a-zA-Z0-9\.\-\+]+)") { return $matches[1] } } catch { return "Error" } return "Not installed"}
Write-Host "Starting installation process..." -ForegroundColor Cyan$startTime = Get-Date
# 4. Main Loop with Progress Barfor ($i = 0; $i -lt $packages.Count; $i++) { $pkg = $packages[$i] $percent = [int](($i / $packages.Count) * 100)
# Update Windows Progress Bar Write-Progress -Activity "Installing AICoding Tools" -Status "Processing $($pkg.Display)..." -PercentComplete $percent -CurrentOperation "$($i+1)/$($packages.Count)"
$status = "Unknown" $currentVer = Get-NpmPackageVersion -PackageName $pkg.Name
# Try to install try { # Using Start-Process to verify exit code cleanly, or just Invoke-Expression # We redirect output to null to keep console clean, but you can remove "| Out-Null" to debug npm install -g $pkg.Name | Out-Null
if ($LASTEXITCODE -ne 0) { throw "NPM Exit Code $LASTEXITCODE" }
$newVer = Get-NpmPackageVersion -PackageName $pkg.Name
# Determine status if ($currentVer -eq "Not installed") { $status = "New Install" } elseif ($currentVer -ne $newVer) { $status = "Updated" } else { $status = "Up to date" } } catch { $status = "Failed" $newVer = "Error" Write-Host " Error installing $($pkg.Display)" -ForegroundColor Red }
# Add to report object $report += [PSCustomObject]@{ Package = $pkg.Display Status = $status "Old Version" = $currentVer "New Version" = $newVer }}
# Complete Progress BarWrite-Progress -Activity "Installing AICoding Tools" -Completed
# 5. Display Summary TableClear-HostWrite-Host "AICoding Tools Installation Report" -ForegroundColor CyanWrite-Host "----------------------------------"
# Configure table colors based on status$report | Format-Table -AutoSize | Out-String | ForEach-Object { if ($_ -match "Failed") { Write-Host $_ -ForegroundColor Red } elseif ($_ -match "New Install") { Write-Host $_ -ForegroundColor Green } elseif ($_ -match "Updated") { Write-Host $_ -ForegroundColor Yellow } else { Write-Host $_ -ForegroundColor Gray }}
$duration = (Get-Date) - $startTimeWrite-Host "Total time: $($duration.TotalSeconds.ToString("N1")) seconds" -ForegroundColor DarkGrayWrite-Host "Done. Press any key to exit..."$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")- 运行方法:
- 右键点击
install_ai_tools.ps1文件 - 选择 “Run with PowerShell” (建议选择 “以管理员身份运行” 以避免权限问题)
- 右键点击