update-all

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Update All

一键全量更新

Update all system packages and developer tools in parallel — bringing everything up to date in one command.
并行更新所有系统包和开发者工具 —— 一条命令完成所有内容的更新。

Update Tasks

更新任务

TaskWhen to RunExecution Mode
winget upgradeWindows only✅ Each package upgraded in parallel
Windows UpdateWindows onlySerial (scan → download → install → monitor)
npm update -gIf Node.js is installedSingle command
npx skills update -g -yIf Node.js is installedSingle command
sudo apt update → sudo apt upgrade -yLinux 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:
  1. Operating System:
    • Windows:
      [System.Environment]::OSVersion
      or
      $env:OS
    • macOS/Linux:
      uname -s
      and
      cat /etc/os-release 2>/dev/null | head -3
  2. Shell environment:
    • PowerShell:
      $PSVersionTable.PSVersion
    • bash/zsh:
      echo $SHELL
  3. Agent identity: Identify which agent is running (Claude Code, GitHub Copilot CLI, Cursor, etc.)
  4. Available tools — check which of the following are installed:
    • winget
      :
      Get-Command winget -ErrorAction SilentlyContinue
      (Windows)
    • node
      /
      npm
      :
      Get-Command node -ErrorAction SilentlyContinue
      or
      which node
    • apt
      :
      which apt
      (Linux)
    • PSWindowsUpdate
      module (Windows):
      Get-Module -ListAvailable PSWindowsUpdate
  5. 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
      /
      normal
      : ⛔ STOP winget updates. Tell user to run:
      sudo sudo config --enable normal
      (this requires a one-time UAC confirmation to switch to inline mode)
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 -y
Another 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 -y
CRITICAL: 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.

在执行任何操作前,检测并明确显示以下信息:
  1. 操作系统:
    • Windows:
      [System.Environment]::OSVersion
      $env:OS
    • macOS/Linux:
      uname -s
      cat /etc/os-release 2>/dev/null | head -3
  2. Shell环境:
    • PowerShell:
      $PSVersionTable.PSVersion
    • bash/zsh:
      echo $SHELL
  3. Agent标识: 识别当前运行的Agent(Claude Code、GitHub Copilot CLI、Cursor等)
  4. 可用工具 —— 检查以下工具是否已安装:
    • winget
      :
      Get-Command winget -ErrorAction SilentlyContinue
      (Windows)
    • node
      /
      npm
      :
      Get-Command node -ErrorAction SilentlyContinue
      which node
    • apt
      :
      which apt
      (Linux)
    • PSWindowsUpdate
      模块(Windows):
      Get-Module -ListAvailable PSWindowsUpdate
  5. sudo状态(仅Windows,winget需要):
    • 检查sudo是否存在:
      Get-Command sudo -ErrorAction SilentlyContinue
    • 检查sudo模式:
      sudo config
    • 若未安装sudo: ⛔ 停止winget更新。告知用户在「设置 → 系统 → 开发者选项 → 启用sudo」中开启。
    • 若sudo模式非Inline/normal: ⛔ 停止winget更新。告知用户运行命令:
      sudo sudo config --enable normal
      (此操作需要一次UAC确认以切换到inline模式)
清晰显示检测结果,例如:
环境检测结果:
  操作系统:  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)
  1. Run
    winget upgrade
    (no elevation) to list all upgradable packages
  2. Parse the output to extract package IDs
  3. If no packages to upgrade, skip
  4. Upgrade all packages in parallel (see Parallel Strategy for agent-specific approach)
  5. 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.
  1. Run
    sudo apt update -y 2>&1
    — refresh package index
    • Wait for completion, capture and display output
    • If this fails, STOP — do not proceed to upgrade
  2. Run
    sudo apt upgrade -y 2>&1
    — upgrade all packages
    • 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):
  1. Ensure PSWindowsUpdate module:
    powershell
    if (-not (Get-Module -ListAvailable PSWindowsUpdate)) { Install-Module -Name PSWindowsUpdate -Force }; Import-Module PSWindowsUpdate
  2. Scan:
    Get-WindowsUpdate
    — if no updates, report "up to date" and skip
  3. Install:
    Install-WindowsUpdate -AcceptAll -AutoReboot:$false -Verbose
    never auto-reboot
  4. Check reboot:
    Get-WURebootStatus
    — inform user if reboot needed
⚠️ Windows Update can take a long time (minutes to hours) — use generous timeouts and poll for progress.
任务A:winget upgrade(仅Windows,需要权限提升)
  1. 运行
    winget upgrade
    (无需权限)列出所有可升级包
  2. 解析输出提取包ID
  3. 若无可升级包则跳过
  4. 并行升级所有包(参考Agent专属的并行策略)
  5. 收集每个包的升级结果
⚠️ 内部并行至关重要:每个包的升级都是独立的 —— 必须全部并行运行,而非串行。
任务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可以分别观察并报告每个步骤。
  1. 运行
    sudo apt update -y 2>&1
    —— 刷新包索引
    • 等待执行完成,捕获并显示输出
    • 若执行失败,停止后续操作 —— 不要继续执行升级
  2. 运行
    sudo apt upgrade -y 2>&1
    —— 升级所有包
    • 等待执行完成,捕获并显示输出
    • 报告升级、新安装、保留的包数量
这种串行方式让Agent能够:
  • 在每个步骤检测并报告失败
  • 在升级前向用户展示即将更新的内容
  • 避免使用过期或损坏的包索引执行升级
任务E:Windows Update(仅Windows,需要权限提升)
使用PSWindowsUpdate模块扫描、安装和监控Windows Update。串行执行(扫描 → 安装 → 重启检查)。参考并行策略中各Agent的权限提升处理方式。
Windows Update步骤(在权限提升的上下文内运行):
  1. 确保PSWindowsUpdate模块已安装:
    powershell
    if (-not (Get-Module -ListAvailable PSWindowsUpdate)) { Install-Module -Name PSWindowsUpdate -Force }; Import-Module PSWindowsUpdate
  2. 扫描:
    Get-WindowsUpdate
    —— 若无更新,报告“已是最新版本”并跳过
  3. 安装:
    Install-WindowsUpdate -AcceptAll -AutoReboot:$false -Verbose
    —— 绝不自动重启
  4. 检查重启需求:
    Get-WURebootStatus
    —— 告知用户是否需要重启
⚠️ Windows Update可能耗时较长(数分钟到数小时)—— 使用充足的超时时间并轮询进度。

Parallel Strategy

并行策略

Windows sudo caches credentials per console session. This determines how many UAC prompts the user sees:
AgentShell Modelsudo Behavior
GitHub Copilot CLIPersistent shell session✅ Cached — one UAC prompt for all
sudo
calls
Claude CodeNew process per command❌ Not cached — one UAC prompt per
sudo
call
Other agentsVariesTest with two
sudo
calls to determine behavior

Strategy for GitHub Copilot CLI: parallel tool calls (one UAC prompt total)
sudo credential caching means all
sudo
calls share one UAC prompt. Use the agent's native parallel tool calls:
parallel:
  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
sudo
reuses the cached credential. One UAC prompt for everything.

Strategy for Claude Code: ONE shared elevated session (one UAC prompt total)
Since Claude Code spawns a new process per command, open one
sudo pwsh
async session
and run ALL elevated tasks (winget + Windows Update) inside it. Non-elevated tasks (npm, skills) run in parallel outside.
┌─ 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 -y
Key points:
  • ONE
    sudo pwsh
    session = ONE UAC prompt for both winget and Windows Update
  • winget packages run in parallel via
    Start-Job
    inside the session
  • 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
    write_powershell
    , observing output at each step
  • Use
    read_powershell
    with generous delays (60+ seconds) for Windows Update progress
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 → monitor
Or (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提示:
AgentShell模式sudo行为
GitHub Copilot CLI持久化Shell会话✅ 凭据已缓存 —— 所有
sudo
调用仅需一次UAC提示
Claude Code每个命令启动新进程❌ 不缓存 —— 每个
sudo
调用需一次UAC提示
其他Agent各不相同通过两次
sudo
调用测试其行为

GitHub Copilot CLI策略:并行工具调用(仅一次UAC提示)
sudo凭据缓存意味着所有
sudo
调用共享一次UAC提示。使用Agent原生的并行工具调用:
并行执行:
  任务A: 多个并行的`sudo winget upgrade --id <pkg> ...`工具调用
  任务B: npm update -g
  任务C: npx skills update -g -y
  任务E: Windows Update的串行sudo调用(扫描 → 安装 → 重启检查)
所有任务并行运行。每个
sudo
调用复用缓存的凭据。所有操作仅需一次UAC提示。

Claude Code策略:单个共享权限提升会话(仅一次UAC提示)
由于Claude Code为每个命令启动新进程,需打开一个
sudo pwsh
异步会话
,并在其中运行所有需要权限提升的任务(winget + Windows Update)。无需权限提升的任务(npm、skills)在外部并行运行。
┌─ 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
关键点:
  • 一个
    sudo pwsh
    会话 = winget和Windows Update仅需一次UAC提示
  • winget包通过会话内的
    Start-Job
    并行升级
  • Windows Update在winget完成后串行执行(两者需同一个权限提升会话)
  • npm和skills更新在权限提升会话外部并行运行(无需权限)
  • Agent通过
    write_powershell
    逐步发送命令,观察每一步的输出
  • 对于Windows Update进度,使用
    read_powershell
    并设置60秒以上的延迟
执行前显示计划,例如(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):
  1. Run
    winget upgrade
    to discover packages
  2. Parse package IDs from the table output (the ID column)
  3. For each package, launch a parallel tool call:
    sudo winget upgrade --id <pkg> --silent --accept-package-agreements --accept-source-agreements
  4. Collect all results
For Task E (Windows Update):
  1. sudo pwsh -NoProfile -Command "Import-Module PSWindowsUpdate; Get-WindowsUpdate"
    — scan
  2. If updates exist:
    sudo pwsh -NoProfile -Command "Import-Module PSWindowsUpdate; Install-WindowsUpdate -AcceptAll -AutoReboot:$false -Verbose"
  3. sudo pwsh -NoProfile -Command "Import-Module PSWindowsUpdate; Get-WURebootStatus"
    — check reboot
  4. All sudo calls reuse cached credential — no additional UAC prompts
For Tasks B, C: run the single command and capture output.
Claude Code execution:
  1. Start shared elevated session:
    powershell(command: "sudo pwsh -NoProfile", mode: "async")
    one UAC prompt
  2. In parallel, also launch Tasks B and C (no elevation needed)
  3. Inside elevated session via
    write_powershell
    : a. Run winget Jobs (parallel package upgrades) b. Wait for Jobs to complete, collect results c. Import PSWindowsUpdate, run
    Get-WindowsUpdate
    d. If updates exist, run
    Install-WindowsUpdate
    — use
    read_powershell
    with 60+ second delays e. Run
    Get-WURebootStatus
  4. stop_powershell
    to close elevated session
  5. Collect results from all tracks
Linux execution (all agents):
For Task D (apt):
  1. Run
    sudo apt update -y 2>&1
    and wait for completion
  2. Check exit code — if non-zero, report failure and STOP (do not run upgrade)
  3. Run
    sudo apt upgrade -y 2>&1
    and wait for completion
  4. 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):
  1. 运行
    winget upgrade
    发现可升级包
  2. 从表格输出中解析包ID(ID列)
  3. 对每个包,启动并行工具调用:
    sudo winget upgrade --id <pkg> --silent --accept-package-agreements --accept-source-agreements
  4. 收集所有结果
对于任务E(Windows Update):
  1. sudo pwsh -NoProfile -Command "Import-Module PSWindowsUpdate; Get-WindowsUpdate"
    —— 扫描
  2. 若存在更新:
    sudo pwsh -NoProfile -Command "Import-Module PSWindowsUpdate; Install-WindowsUpdate -AcceptAll -AutoReboot:$false -Verbose"
  3. sudo pwsh -NoProfile -Command "Import-Module PSWindowsUpdate; Get-WURebootStatus"
    —— 检查重启需求
  4. 所有sudo调用复用缓存凭据 —— 无额外UAC提示
对于任务B、C:运行单条命令并捕获输出。
Claude Code执行方式:
  1. 启动共享权限提升会话:
    powershell(command: "sudo pwsh -NoProfile", mode: "async")
    —— 仅一次UAC提示
  2. 同时并行启动任务B和C(无需权限)
  3. 通过
    write_powershell
    在权限提升会话内执行: a. 运行winget Jobs(并行包升级) b. 等待Jobs完成,收集结果 c. 导入PSWindowsUpdate,运行
    Get-WindowsUpdate
    d. 若存在更新,运行
    Install-WindowsUpdate
    —— 使用
    read_powershell
    并设置60秒以上延迟 e. 运行
    Get-WURebootStatus
  4. 执行
    stop_powershell
    关闭权限提升会话
  5. 收集所有轨道的结果
Linux执行方式(所有Agent通用):
对于任务D(apt):
  1. 运行
    sudo apt update -y 2>&1
    并等待完成
  2. 检查退出码 —— 若非0,报告失败并停止(不要运行升级)
  3. 运行
    sudo apt upgrade -y 2>&1
    并等待完成
  4. 解析输出获取摘要(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
    ,
    apt
    , or other Linux/macOS commands
Linux:
  • If
    apt update
    failed, suggest checking network connectivity and sources list:
    cat /etc/apt/sources.list
  • If
    apt upgrade
    failed, suggest
    sudo apt --fix-broken install
  • If packages were held back, inform the user and suggest
    sudo apt full-upgrade
    if they want to force them
  • If npm update failed with permission errors, suggest checking npm prefix:
    npm config get prefix
  • Never suggest
    winget
    ,
    sudo config
    , or other Windows commands
macOS:
  • Note that this skill does not include Homebrew updates (yet) — user can run
    brew update && brew upgrade
    separately
  • Never suggest
    winget
    ,
    apt
    , or other Windows/Linux commands

仅针对检测到的环境提供建议:
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
    apt
    或其他Linux/macOS命令
Linux系统:
  • apt update
    失败,建议检查网络连接和源列表:
    cat /etc/apt/sources.list
  • apt upgrade
    失败,建议运行
    sudo apt --fix-broken install
  • 若有包被保留,告知用户并建议若需强制升级可运行
    sudo apt full-upgrade
  • 若npm更新因权限错误失败,建议检查npm前缀:
    npm config get prefix
  • 绝不建议使用
    winget
    sudo config
    或其他Windows命令
macOS系统:
  • 注意:本技能暂不包含Homebrew更新 —— 用户可单独运行
    brew update && brew upgrade
  • 绝不建议使用
    winget
    apt
    或其他Windows/Linux命令

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
    Id
    column header and the separator line of dashes)
  • 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,
    apt update
    and
    apt upgrade
    are intentionally separate commands (not combined with
    &&
    ) for better observability and error handling
  • If
    PSWindowsUpdate
    module is not available and cannot be installed, skip Windows Update and inform the user
  • Windows系统的sudo要求仅针对winget和Windows Update —— npm和skills更新通常无需权限提升
  • 若仅部分任务适用(如未安装Node.js),仅运行适用的任务
  • 用户可能要求仅运行特定任务(如“只更新winget”)—— 需遵守此要求并跳过其他任务
  • winget的表格输出格式可能因区域设置而异 —— Agent应自适应解析(查找
    Id
    列标题和分隔线)
  • Windows Update可能耗时极长 —— 始终使用充足的超时时间(300秒以上)并轮询完成状态
  • Windows Update绝不会触发自动重启 —— Agent必须告知用户并由用户决定
  • 在Linux系统中,
    apt update
    apt upgrade
    特意分为独立命令(不用
    &&
    合并),以提升可观察性和错误处理能力
  • PSWindowsUpdate
    模块不可用且无法安装,跳过Windows Update并告知用户