update-all
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUpdate All
一键全量更新
Update all system packages and developer tools in parallel — bringing everything up to date in one command.
并行更新所有系统包和开发者工具 —— 一条命令完成所有内容的更新。
Update Tasks
更新任务
| Task | When to Run | Execution Mode |
|---|---|---|
| winget upgrade | Windows only | ✅ Each package upgraded in parallel |
| Windows Update | Windows only | Serial (scan → download → install → monitor) |
| npm update -g | If Node.js is installed | Single command |
| npx skills update -g -y | If Node.js is installed | Single command |
| sudo apt update → sudo apt upgrade -y | Linux only | ⚠️ Serial (update first, then upgrade) |
All tasks are completely independent and MUST run in parallel. However, some tasks have internal serial steps (apt, Windows Update) — those internal steps must run in order.
| 任务 | 运行时机 | 执行模式 |
|---|---|---|
| winget upgrade | 仅Windows系统 | ✅ 每个包并行升级 |
| Windows Update | 仅Windows系统 | 串行(扫描 → 下载 → 安装 → 监控) |
| npm update -g | 已安装Node.js时 | 单条命令 |
| npx skills update -g -y | 已安装Node.js时 | 单条命令 |
| sudo apt update → sudo apt upgrade -y | 仅Linux系统 | ⚠️ 串行(先更新索引,再升级包) |
所有任务完全独立,必须并行运行。不过部分任务内部包含串行步骤(如apt、Windows Update)—— 这些内部步骤必须按顺序执行。
Strict Execution Flow
严格执行流程
Do NOT use any scripts. Do NOT skip or merge phases. Execute each phase in order.
禁止使用任何脚本。禁止跳过或合并阶段。必须按顺序执行每个阶段。
Phase 1: Environment Detection (MANDATORY — must display results before proceeding)
阶段1:环境检测(必填项 —— 必须在执行前显示结果)
Detect and explicitly display the following before doing anything else:
- Operating System:
- Windows: or
[System.Environment]::OSVersion$env:OS - macOS/Linux: and
uname -scat /etc/os-release 2>/dev/null | head -3
- Windows:
- Shell environment:
- PowerShell:
$PSVersionTable.PSVersion - bash/zsh:
echo $SHELL
- PowerShell:
- Agent identity: Identify which agent is running (Claude Code, GitHub Copilot CLI, Cursor, etc.)
- Available tools — check which of the following are installed:
- :
winget(Windows)Get-Command winget -ErrorAction SilentlyContinue - /
node:npmorGet-Command node -ErrorAction SilentlyContinuewhich node - :
apt(Linux)which apt - module (Windows):
PSWindowsUpdateGet-Module -ListAvailable PSWindowsUpdate
- sudo status (Windows only, required for winget):
- Check if sudo exists:
Get-Command sudo -ErrorAction SilentlyContinue - Check sudo mode:
sudo config - If sudo is not installed: ⛔ STOP winget updates. Tell user to enable sudo in Settings → System → For Developers → Enable sudo
- If sudo mode is NOT /
Inline: ⛔ STOP winget updates. Tell user to run:normal(this requires a one-time UAC confirmation to switch to inline mode)sudo sudo config --enable normal
- Check if sudo exists:
Display the detection results clearly, for example:
Environment Detection:
OS: Windows 11 Pro (10.0.22631)
Shell: PowerShell 7.4
Agent: GitHub Copilot CLI
winget: ✅ available
node: ✅ v22.0.0
npm: ✅ v10.8.0
apt: ❌ not available (Windows)
sudo: ✅ v1.0.1, Inline mode
PSWindowsUpdate: ✅ v2.2.1.5 installed
Applicable update tasks:
1. winget upgrade (parallel per package)
2. Windows Update (scan → install → monitor)
3. npm update -g
4. npx skills update -g -yAnother example (Linux):
Environment Detection:
OS: Ubuntu 24.04 LTS
Shell: bash 5.2
Agent: Claude Code
winget: ❌ not available (Linux)
node: ✅ v22.0.0
npm: ✅ v10.8.0
apt: ✅ available
sudo: ✅ available (Linux native)
Applicable update tasks:
1. sudo apt update → sudo apt upgrade -y (serial)
2. npm update -g
3. npx skills update -g -yCRITICAL: If on Windows and sudo is missing or not in Inline/normal mode, do NOT proceed with winget updates. Display a clear warning and instructions. Other tasks (npm, skills) can still proceed.
在执行任何操作前,检测并明确显示以下信息:
- 操作系统:
- Windows: 或
[System.Environment]::OSVersion$env:OS - macOS/Linux: 和
uname -scat /etc/os-release 2>/dev/null | head -3
- Windows:
- Shell环境:
- PowerShell:
$PSVersionTable.PSVersion - bash/zsh:
echo $SHELL
- PowerShell:
- Agent标识: 识别当前运行的Agent(Claude Code、GitHub Copilot CLI、Cursor等)
- 可用工具 —— 检查以下工具是否已安装:
- :
winget(Windows)Get-Command winget -ErrorAction SilentlyContinue - /
node:npm或Get-Command node -ErrorAction SilentlyContinuewhich node - :
apt(Linux)which apt - 模块(Windows):
PSWindowsUpdateGet-Module -ListAvailable PSWindowsUpdate
- sudo状态(仅Windows,winget需要):
- 检查sudo是否存在:
Get-Command sudo -ErrorAction SilentlyContinue - 检查sudo模式:
sudo config - 若未安装sudo: ⛔ 停止winget更新。告知用户在「设置 → 系统 → 开发者选项 → 启用sudo」中开启。
- 若sudo模式非Inline/normal: ⛔ 停止winget更新。告知用户运行命令: (此操作需要一次UAC确认以切换到inline模式)
sudo sudo config --enable normal
- 检查sudo是否存在:
清晰显示检测结果,例如:
环境检测结果:
操作系统: Windows 11 Pro (10.0.22631)
Shell: PowerShell 7.4
Agent: GitHub Copilot CLI
winget: ✅ 可用
node: ✅ v22.0.0
npm: ✅ v10.8.0
apt: ❌ 不可用(Windows系统)
sudo: ✅ v1.0.1, Inline模式
PSWindowsUpdate: ✅ v2.2.1.5 已安装
适用的更新任务:
1. winget upgrade(按包并行升级)
2. Windows Update(扫描 → 安装 → 监控)
3. npm update -g
4. npx skills update -g -y另一个Linux示例:
环境检测结果:
操作系统: Ubuntu 24.04 LTS
Shell: bash 5.2
Agent: Claude Code
winget: ❌ 不可用(Linux系统)
node: ✅ v22.0.0
npm: ✅ v10.8.0
apt: ✅ 可用
sudo: ✅ 可用(Linux原生)
适用的更新任务:
1. sudo apt update → sudo apt upgrade -y(串行执行)
2. npm update -g
3. npx skills update -g -y关键提示:若在Windows系统中,sudo缺失或未处于Inline/normal模式,请勿继续执行winget更新。显示明确的警告和操作指引。其他任务(npm、skills)仍可继续执行。
Phase 2: Plan (generate environment-specific parallel execution plan)
阶段2:规划(生成适配当前环境的并行执行计划)
Based on Phase 1 results, build the task list and parallel strategy.
基于阶段1的结果,构建任务列表和并行策略。
Task Definitions
任务定义
Task A: winget upgrade (Windows only, requires elevation)
- Run (no elevation) to list all upgradable packages
winget upgrade - Parse the output to extract package IDs
- If no packages to upgrade, skip
- Upgrade all packages in parallel (see Parallel Strategy for agent-specific approach)
- Collect results per package
⚠️ Internal parallelism is CRITICAL: each package upgrade is independent — run them ALL in parallel, not sequentially.
Task B: npm update -g (if Node.js installed)
Single command:
- Windows PowerShell:
npm update -g 2>&1 - bash/zsh:
npm update -g 2>&1
Task C: npx skills update -g -y (if Node.js installed)
Single command:
- All platforms:
npx skills update -g -y 2>&1
Task D: sudo apt update → sudo apt upgrade (Linux only, MUST be serial)
⚠️ These two commands MUST run serially, NOT combined with in a single shell call. Run them as two separate sequential commands so the agent can observe and report each step independently.
&&- Run — refresh package index
sudo apt update -y 2>&1- Wait for completion, capture and display output
- If this fails, STOP — do not proceed to upgrade
- Run — upgrade all packages
sudo apt upgrade -y 2>&1- Wait for completion, capture and display output
- Report number of upgraded, newly installed, held back packages
This serial approach allows the agent to:
- Detect and report failures at each step
- Show the user what's being updated before upgrading
- Avoid running upgrade with a stale or broken package index
Task E: Windows Update (Windows only, requires elevation)
Uses PSWindowsUpdate to scan, install, and monitor Windows Update. Runs serially (scan → install → reboot check). See Parallel Strategy for how elevation is handled per agent.
WU Steps (run inside an elevated context):
- Ensure PSWindowsUpdate module:
powershell
if (-not (Get-Module -ListAvailable PSWindowsUpdate)) { Install-Module -Name PSWindowsUpdate -Force }; Import-Module PSWindowsUpdate - Scan: — if no updates, report "up to date" and skip
Get-WindowsUpdate - Install: — never auto-reboot
Install-WindowsUpdate -AcceptAll -AutoReboot:$false -Verbose - Check reboot: — inform user if reboot needed
Get-WURebootStatus
⚠️ Windows Update can take a long time (minutes to hours) — use generous timeouts and poll for progress.
任务A:winget upgrade(仅Windows,需要权限提升)
- 运行(无需权限)列出所有可升级包
winget upgrade - 解析输出提取包ID
- 若无可升级包则跳过
- 并行升级所有包(参考Agent专属的并行策略)
- 收集每个包的升级结果
⚠️ 内部并行至关重要:每个包的升级都是独立的 —— 必须全部并行运行,而非串行。
任务B:npm update -g(若已安装Node.js)
单条命令:
- Windows PowerShell:
npm update -g 2>&1 - bash/zsh:
npm update -g 2>&1
任务C:npx skills update -g -y(若已安装Node.js)
单条命令:
- 全平台:
npx skills update -g -y 2>&1
任务D:sudo apt update → sudo apt upgrade(仅Linux,必须串行执行)
⚠️ 这两条命令必须串行执行,不可在单个Shell调用中用合并。分两个独立的串行命令运行,以便Agent可以分别观察并报告每个步骤。
&&- 运行—— 刷新包索引
sudo apt update -y 2>&1- 等待执行完成,捕获并显示输出
- 若执行失败,停止后续操作 —— 不要继续执行升级
- 运行—— 升级所有包
sudo apt upgrade -y 2>&1- 等待执行完成,捕获并显示输出
- 报告升级、新安装、保留的包数量
这种串行方式让Agent能够:
- 在每个步骤检测并报告失败
- 在升级前向用户展示即将更新的内容
- 避免使用过期或损坏的包索引执行升级
任务E:Windows Update(仅Windows,需要权限提升)
使用PSWindowsUpdate模块扫描、安装和监控Windows Update。串行执行(扫描 → 安装 → 重启检查)。参考并行策略中各Agent的权限提升处理方式。
Windows Update步骤(在权限提升的上下文内运行):
- 确保PSWindowsUpdate模块已安装:
powershell
if (-not (Get-Module -ListAvailable PSWindowsUpdate)) { Install-Module -Name PSWindowsUpdate -Force }; Import-Module PSWindowsUpdate - 扫描: —— 若无更新,报告“已是最新版本”并跳过
Get-WindowsUpdate - 安装: —— 绝不自动重启
Install-WindowsUpdate -AcceptAll -AutoReboot:$false -Verbose - 检查重启需求: —— 告知用户是否需要重启
Get-WURebootStatus
⚠️ Windows Update可能耗时较长(数分钟到数小时)—— 使用充足的超时时间并轮询进度。
Parallel Strategy
并行策略
Windows sudo caches credentials per console session. This determines how many UAC prompts the user sees:
| Agent | Shell Model | sudo Behavior |
|---|---|---|
| GitHub Copilot CLI | Persistent shell session | ✅ Cached — one UAC prompt for all |
| Claude Code | New process per command | ❌ Not cached — one UAC prompt per |
| Other agents | Varies | Test with two |
Strategy for GitHub Copilot CLI: parallel tool calls (one UAC prompt total)
sudo credential caching means all calls share one UAC prompt. Use the agent's native parallel tool calls:
sudoparallel:
Task A: multiple parallel `sudo winget upgrade --id <pkg> ...` tool calls
Task B: npm update -g
Task C: npx skills update -g -y
Task E: sequential sudo calls for WU (scan → install → reboot check)All tasks run in parallel. Each reuses the cached credential. One UAC prompt for everything.
sudoStrategy for Claude Code: ONE shared elevated session (one UAC prompt total)
Since Claude Code spawns a new process per command, open one async session and run ALL elevated tasks (winget + Windows Update) inside it. Non-elevated tasks (npm, skills) run in parallel outside.
sudo pwsh┌─ powershell(command: "sudo pwsh -NoProfile", mode: "async") ──── ONE UAC prompt
│
│ ── winget (parallel via PowerShell Jobs) ──
│ $packages = @("<pkg1>", "<pkg2>", "<pkg3>")
│ $jobs = $packages | ForEach-Object {
│ Start-Job -ScriptBlock {
│ param($id)
│ winget upgrade --id $id --silent --accept-package-agreements --accept-source-agreements 2>&1
│ } -ArgumentList $_
│ }
│ $jobs | Wait-Job | Receive-Job
│ $jobs | Remove-Job
│
│ ── Windows Update (serial) ──
│ Import-Module PSWindowsUpdate
│ Get-WindowsUpdate
│ Install-WindowsUpdate -AcceptAll -AutoReboot:$false -Verbose
│ Get-WURebootStatus
│
└─ stop_powershell: close the elevated session
parallel (no elevation needed):
Task B: npm update -g
Task C: npx skills update -g -yKey points:
- ONE session = ONE UAC prompt for both winget and Windows Update
sudo pwsh - winget packages run in parallel via inside the session
Start-Job - Windows Update runs serially after winget completes (both need the same elevated session)
- npm and skills updates run in parallel OUTSIDE the elevated session (they don't need elevation)
- The agent sends commands step-by-step via , observing output at each step
write_powershell - Use with generous delays (60+ seconds) for Windows Update progress
read_powershell
Display the plan before executing, e.g. (GitHub Copilot CLI):
Plan: 4 parallel update tasks (one UAC prompt via sudo caching)
Task A: winget upgrade — 5 packages (parallel sudo calls)
Task B: npm update -g
Task C: npx skills update -g -y
Task E: Windows Update — scan → install → monitorOr (Claude Code):
Plan: 3 parallel tracks (one UAC prompt via shared elevated session)
Elevated session: winget (5 packages via Jobs) + Windows Update (serial)
Task B: npm update -g (parallel, no elevation)
Task C: npx skills update -g -y (parallel, no elevation)Windows系统的sudo会在每个控制台会话中缓存凭据。这决定了用户会看到多少次UAC提示:
| Agent | Shell模式 | sudo行为 |
|---|---|---|
| GitHub Copilot CLI | 持久化Shell会话 | ✅ 凭据已缓存 —— 所有 |
| Claude Code | 每个命令启动新进程 | ❌ 不缓存 —— 每个 |
| 其他Agent | 各不相同 | 通过两次 |
GitHub Copilot CLI策略:并行工具调用(仅一次UAC提示)
sudo凭据缓存意味着所有调用共享一次UAC提示。使用Agent原生的并行工具调用:
sudo并行执行:
任务A: 多个并行的`sudo winget upgrade --id <pkg> ...`工具调用
任务B: npm update -g
任务C: npx skills update -g -y
任务E: Windows Update的串行sudo调用(扫描 → 安装 → 重启检查)所有任务并行运行。每个调用复用缓存的凭据。所有操作仅需一次UAC提示。
sudoClaude Code策略:单个共享权限提升会话(仅一次UAC提示)
由于Claude Code为每个命令启动新进程,需打开一个异步会话,并在其中运行所有需要权限提升的任务(winget + Windows Update)。无需权限提升的任务(npm、skills)在外部并行运行。
sudo pwsh┌─ powershell(command: "sudo pwsh -NoProfile", mode: "async") ──── 仅一次UAC提示
│
│ ── winget(通过PowerShell Jobs并行执行) ──
│ $packages = @("<pkg1>", "<pkg2>", "<pkg3>")
│ $jobs = $packages | ForEach-Object {
│ Start-Job -ScriptBlock {
│ param($id)
│ winget upgrade --id $id --silent --accept-package-agreements --accept-source-agreements 2>&1
│ } -ArgumentList $_
│ }
│ $jobs | Wait-Job | Receive-Job
│ $jobs | Remove-Job
│
│ ── Windows Update(串行执行) ──
│ Import-Module PSWindowsUpdate
│ Get-WindowsUpdate
│ Install-WindowsUpdate -AcceptAll -AutoReboot:$false -Verbose
│ Get-WURebootStatus
│
└─ stop_powershell: 关闭权限提升会话
并行执行(无需权限提升):
任务B: npm update -g
任务C: npx skills update -g -y关键点:
- 一个会话 = winget和Windows Update仅需一次UAC提示
sudo pwsh - winget包通过会话内的并行升级
Start-Job - Windows Update在winget完成后串行执行(两者需同一个权限提升会话)
- npm和skills更新在权限提升会话外部并行运行(无需权限)
- Agent通过逐步发送命令,观察每一步的输出
write_powershell - 对于Windows Update进度,使用并设置60秒以上的延迟
read_powershell
执行前显示计划,例如(GitHub Copilot CLI):
执行计划: 4个并行更新任务(通过sudo缓存仅一次UAC提示)
任务A: winget upgrade —— 5个包(并行sudo调用)
任务B: npm update -g
任务C: npx skills update -g -y
任务E: Windows Update —— 扫描 → 安装 → 监控或(Claude Code):
执行计划: 3个并行执行轨道(通过共享权限提升会话仅一次UAC提示)
权限提升会话: winget(5个包通过Jobs并行) + Windows Update(串行)
任务B: npm update -g(并行,无需权限)
任务C: npx skills update -g -y(并行,无需权限)Phase 3: Execute (all tasks in parallel)
阶段3:执行(所有任务并行运行)
Launch ALL applicable tasks simultaneously. NEVER run them sequentially.
GitHub Copilot CLI execution:
For Task A (winget):
- Run to discover packages
winget upgrade - Parse package IDs from the table output (the ID column)
- For each package, launch a parallel tool call:
sudo winget upgrade --id <pkg> --silent --accept-package-agreements --accept-source-agreements - Collect all results
For Task E (Windows Update):
- — scan
sudo pwsh -NoProfile -Command "Import-Module PSWindowsUpdate; Get-WindowsUpdate" - If updates exist:
sudo pwsh -NoProfile -Command "Import-Module PSWindowsUpdate; Install-WindowsUpdate -AcceptAll -AutoReboot:$false -Verbose" - — check reboot
sudo pwsh -NoProfile -Command "Import-Module PSWindowsUpdate; Get-WURebootStatus" - All sudo calls reuse cached credential — no additional UAC prompts
For Tasks B, C: run the single command and capture output.
Claude Code execution:
- Start shared elevated session: — one UAC prompt
powershell(command: "sudo pwsh -NoProfile", mode: "async") - In parallel, also launch Tasks B and C (no elevation needed)
- Inside elevated session via : a. Run winget Jobs (parallel package upgrades) b. Wait for Jobs to complete, collect results c. Import PSWindowsUpdate, run
write_powershelld. If updates exist, runGet-WindowsUpdate— useInstall-WindowsUpdatewith 60+ second delays e. Runread_powershellGet-WURebootStatus - to close elevated session
stop_powershell - Collect results from all tracks
Linux execution (all agents):
For Task D (apt):
- Run and wait for completion
sudo apt update -y 2>&1 - Check exit code — if non-zero, report failure and STOP (do not run upgrade)
- Run and wait for completion
sudo apt upgrade -y 2>&1 - Parse output for summary (X upgraded, Y newly installed, Z held back)
For Tasks B, C: run in parallel alongside Task D.
同时启动所有适用的任务。绝不串行运行。
GitHub Copilot CLI执行方式:
对于任务A(winget):
- 运行发现可升级包
winget upgrade - 从表格输出中解析包ID(ID列)
- 对每个包,启动并行工具调用:
sudo winget upgrade --id <pkg> --silent --accept-package-agreements --accept-source-agreements - 收集所有结果
对于任务E(Windows Update):
- —— 扫描
sudo pwsh -NoProfile -Command "Import-Module PSWindowsUpdate; Get-WindowsUpdate" - 若存在更新:
sudo pwsh -NoProfile -Command "Import-Module PSWindowsUpdate; Install-WindowsUpdate -AcceptAll -AutoReboot:$false -Verbose" - —— 检查重启需求
sudo pwsh -NoProfile -Command "Import-Module PSWindowsUpdate; Get-WURebootStatus" - 所有sudo调用复用缓存凭据 —— 无额外UAC提示
对于任务B、C:运行单条命令并捕获输出。
Claude Code执行方式:
- 启动共享权限提升会话: —— 仅一次UAC提示
powershell(command: "sudo pwsh -NoProfile", mode: "async") - 同时并行启动任务B和C(无需权限)
- 通过在权限提升会话内执行: a. 运行winget Jobs(并行包升级) b. 等待Jobs完成,收集结果 c. 导入PSWindowsUpdate,运行
write_powershelld. 若存在更新,运行Get-WindowsUpdate—— 使用Install-WindowsUpdate并设置60秒以上延迟 e. 运行read_powershellGet-WURebootStatus - 执行关闭权限提升会话
stop_powershell - 收集所有轨道的结果
Linux执行方式(所有Agent通用):
对于任务D(apt):
- 运行并等待完成
sudo apt update -y 2>&1 - 检查退出码 —— 若非0,报告失败并停止(不要运行升级)
- 运行并等待完成
sudo apt upgrade -y 2>&1 - 解析输出获取摘要(X个升级,Y个新安装,Z个保留)
对于任务B、C:与任务D并行运行。
Phase 4: Report & Recommendations
阶段4:报告与建议
Summary Report
摘要报告
================================================================================
UPDATE ALL — SUMMARY
================================================================================
Timestamp: <time>
System: <OS>
Agent: <agent>
── winget upgrade ──────────────────────────────────
[✓] Git.Git (2.52.0 → 2.53.0)
[✓] Microsoft.VisualStudioCode (1.95 → 1.96)
[✗] SomeApp.Failed — installer error (exit code 1)
Succeeded: 2 / Failed: 1
── Windows Update ──────────────────────────────────
[✓] KB5034441 — Security Update (45 MB)
[✓] KB5034123 — .NET Runtime Update (12 MB)
[⚠] Reboot required to complete installation
Succeeded: 2 / Failed: 0
── npm update -g ───────────────────────────────────
[✓] Updated 3 packages
── npx skills update -g -y ─────────────────────────
[✓] All skills up to date
── apt update ──────────────────────────────────────
[✓] Package index refreshed (42 packages can be upgraded)
── apt upgrade ─────────────────────────────────────
[✓] 42 packages upgraded, 0 newly installed, 0 held back
================================================================================
Total tasks: 5 | Succeeded: 4 | Partial: 1 (winget had 1 failure)
⚠️ Reboot required for Windows Update
================================================================================================================================================================
一键全量更新 —— 摘要
================================================================================
时间戳: <时间>
系统: <操作系统>
Agent: <Agent名称>
── winget upgrade ──────────────────────────────────
[✓] Git.Git (2.52.0 → 2.53.0)
[✓] Microsoft.VisualStudioCode (1.95 → 1.96)
[✗] SomeApp.Failed —— 安装程序错误(退出码1)
成功: 2 / 失败: 1
── Windows Update ──────────────────────────────────
[✓] KB5034441 —— 安全更新(45 MB)
[✓] KB5034123 —— .NET运行时更新(12 MB)
[⚠] 需重启以完成安装
成功: 2 / 失败: 0
── npm update -g ───────────────────────────────────
[✓] 更新了3个包
── npx skills update -g -y ─────────────────────────
[✓] 所有技能已是最新版本
── apt update ──────────────────────────────────────
[✓] 包索引已刷新(42个包可升级)
── apt upgrade ─────────────────────────────────────
[✓] 42个包已升级,0个新安装,0个保留
================================================================================
总任务数: 5 | 成功: 4 | 部分完成: 1(winget有1个失败)
⚠️ Windows Update需重启
================================================================================Environment-Specific Recommendations
环境专属建议
Provide recommendations ONLY for the detected environment:
Windows:
- If winget packages failed, suggest retrying individually:
sudo winget upgrade --id <pkg> --silent --accept-package-agreements --accept-source-agreements - If a package failed due to "in use", suggest closing the application first
- If sudo was not in Inline mode, remind:
sudo sudo config --enable normal - If Windows Update requires reboot, inform: "Please restart your computer to complete the update installation. You can do this when convenient."
- If Windows Update failed to install some updates, suggest: "Try running Windows Update again after a reboot, or check Windows Update settings in Settings → Windows Update"
- If PSWindowsUpdate module installation failed, suggest: "Run PowerShell as Administrator and try: "
Install-Module -Name PSWindowsUpdate -Force - Never suggest ,
chmod, or other Linux/macOS commandsapt
Linux:
- If failed, suggest checking network connectivity and sources list:
apt updatecat /etc/apt/sources.list - If failed, suggest
apt upgradesudo apt --fix-broken install - If packages were held back, inform the user and suggest if they want to force them
sudo apt full-upgrade - If npm update failed with permission errors, suggest checking npm prefix:
npm config get prefix - Never suggest ,
winget, or other Windows commandssudo config
macOS:
- Note that this skill does not include Homebrew updates (yet) — user can run separately
brew update && brew upgrade - Never suggest ,
winget, or other Windows/Linux commandsapt
仅针对检测到的环境提供建议:
Windows系统:
- 若winget包升级失败,建议单独重试:
sudo winget upgrade --id <pkg> --silent --accept-package-agreements --accept-source-agreements - 若包因“正在使用中”升级失败,建议先关闭对应应用
- 若sudo未处于Inline模式,提醒用户:
sudo sudo config --enable normal - 若Windows Update需要重启,告知用户: "请重启电脑以完成安装。你可以在方便的时候进行。"
- 若Windows Update部分更新安装失败,建议: "重启后再次尝试运行Windows Update,或在设置 → Windows Update中检查设置"
- 若PSWindowsUpdate模块安装失败,建议: "以管理员身份运行PowerShell并尝试: "
Install-Module -Name PSWindowsUpdate -Force - 绝不建议使用、
chmod或其他Linux/macOS命令apt
Linux系统:
- 若失败,建议检查网络连接和源列表:
apt updatecat /etc/apt/sources.list - 若失败,建议运行
apt upgradesudo apt --fix-broken install - 若有包被保留,告知用户并建议若需强制升级可运行
sudo apt full-upgrade - 若npm更新因权限错误失败,建议检查npm前缀:
npm config get prefix - 绝不建议使用、
winget或其他Windows命令sudo config
macOS系统:
- 注意:本技能暂不包含Homebrew更新 —— 用户可单独运行
brew update && brew upgrade - 绝不建议使用、
winget或其他Windows/Linux命令apt
Notes
注意事项
- The sudo requirement on Windows is specifically for winget and Windows Update — npm and skills updates typically don't need elevation
- If only some tasks are applicable (e.g., no Node.js installed), run only the applicable ones
- The user may request to run only specific tasks (e.g., "just update winget") — honor that and skip others
- winget's table output format may vary by locale — the agent should parse it adaptively (look for the column header and the separator line of dashes)
Id - Windows Update can take a very long time — always use generous timeouts (300+ seconds) and poll for completion
- Windows Update will NEVER trigger an automatic reboot — the agent must inform the user and let them decide
- On Linux, and
apt updateare intentionally separate commands (not combined withapt upgrade) for better observability and error handling&& - If module is not available and cannot be installed, skip Windows Update and inform the user
PSWindowsUpdate
- Windows系统的sudo要求仅针对winget和Windows Update —— npm和skills更新通常无需权限提升
- 若仅部分任务适用(如未安装Node.js),仅运行适用的任务
- 用户可能要求仅运行特定任务(如“只更新winget”)—— 需遵守此要求并跳过其他任务
- winget的表格输出格式可能因区域设置而异 —— Agent应自适应解析(查找列标题和分隔线)
Id - Windows Update可能耗时极长 —— 始终使用充足的超时时间(300秒以上)并轮询完成状态
- Windows Update绝不会触发自动重启 —— Agent必须告知用户并由用户决定
- 在Linux系统中,和
apt update特意分为独立命令(不用apt upgrade合并),以提升可观察性和错误处理能力&& - 若模块不可用且无法安装,跳过Windows Update并告知用户
PSWindowsUpdate