360 Secure SkillHub
360 安全技能中心

choco

核心功能涵盖Chocolatey升级前后处理、NSSM服务路径刷新、NSSM转shawl迁移(如Syncthing v2)、UniGetUI/Choco元数据修复及服务诊断。典型场景包括:升级后服务路径失效、大版本升级后NSSM兼容问题、元数据陈旧引发重复升级提示、批量排查服务故障。输入为相关触发词或命令,输出对应操作流程、脚本命令,部分操作需管理员权限。

drumrobot
drumrobot
热度 57.71
最近更新 2026-09-18 23:56:18
分类:自动化依赖:代码执行 / 第三方 API应用场景:自动化脚本 / 工作流 / 任务管理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add choco
Metadata
name
choco
metadata
{"author":"es6kr","version":"1.0.5"}
description
Chocolatey operations integration — post-processing after choco upgrade, nssm service path refresh, NSSM → shawl migration (syncthing v2 etc.), resync on UniGetUI/choco metadata update failures. diagnose [diagnose.md], metadata-fix [metadata-fix.md], post-upgrade [post-upgrade.md], shawl-migration [shawl-migration.md], update-path [update-path.md]. Use when: "choco", "chocolatey", "choco upgrade", "choco outdated", "vcredist", "nssm", "nssm recovery", "nssm path", "service path refresh", "after choco upgrade", "service failure", "SERVICE_STOPPED", "shim issue", "syncthing nssm", "syncthing v2", "shawl migration", "nssm deprecation", "service-specific error", "UniGetUI", "metadata update failure", "metadata stale", ".nuspec stale", "choco metadata".

Choco

Chocolatey operations integration skill. Pre- and post-processing for choco upgrade, nssm service compatibility management, and metadata update failure recovery.

Core Problems

Area Problem Resolution Topic
Package path After choco upgrade, the nssm Application path becomes stale due to version-specific folders update-path.md
Service compatibility After major upgrade (e.g., syncthing v1→v2), NSSM fails with service-specific error shawl-migration.md
Metadata Runtime install succeeds + chocolatey .nuspec is stale (UniGetUI shows repeated upgrades) metadata-fix.md
Diagnosis Identify which service has issues / which package is stale diagnose.md
Bulk post-processing Automatically check affected services after choco upgrade post-upgrade.md

Path Strategy (HARD STOP — required decision before nssm set Application)

Strategy Example Path Pros Cons
Stable shim path (recommended) %ChocolateyInstall%\bin\syncthing.exe Path remains unchanged after choco upgrade Without --shimgen-waitforexit, nssm may misinterpret shim exit as a crash
Version-specific actual path %ChocolateyInstall%\lib\syncthing\tools\...-v2.1.0\syncthing.exe No shim issues Path breaks on every upgrade — this is why this skill exists

Default choice: stable shim path. Use version-specific path + post-upgrade hook combination only for services where shim issues occur. When NSSM compatibility itself breaks (like syncthing v2), apply shawl-migration.

Using environment variable paths in nssm

nssm supports REG_EXPAND_SZ but nssm set defaults to REG_SZ. Set registry directly via PowerShell:

$regPath = "HKLM:\SYSTEM\CurrentControlSet\Services\<service>\Parameters"
Set-ItemProperty -Path $regPath -Name "Application" -Value '%ChocolateyInstall%\bin\<exe>' -Type ExpandString

Or use an expanded literal path:

gsudo nssm set <service> Application "C:\ProgramData\chocolatey\bin\<exe>"

Topics

Topic File Description
diagnose diagnose.md nssm service diagnosis procedure
metadata-fix metadata-fix.md Recovery for UniGetUI/choco metadata (.nuspec) update failures
post-upgrade post-upgrade.md Post-processing after choco upgrade
shawl-migration shawl-migration.md NSSM → shawl migration (major upgrades like syncthing v2)
update-path update-path.md nssm path refresh

Scripts

Mode Command Description
diagnose node <skill-dir>/scripts/nssm-manager.js diagnose Check all nssm services
update-path node <skill-dir>/scripts/nssm-manager.js update-path <service> Output path refresh command for a specific service
post-upgrade node <skill-dir>/scripts/nssm-manager.js post-upgrade Full post-processing check

<skill-dir> = ~/.claude/skills/choco

Note: node may not be on PATH in bash. In an fnm environment, use the full path:

"$APPDATA/fnm/node-versions/v20.20.0/installation/node.exe" <skill-dir>/scripts/nssm-manager.js <mode>

Administrator Privileges

nssm set/stop/start and choco upgrade commands require administrator privileges. Per the Windows rule, using gsudo is the default:

gsudo choco upgrade <pkg> -y
gsudo nssm set <service> Application "<path>"

Or invoke via the PowerShell tool:

gsudo powershell -ExecutionPolicy Bypass -File "<script.ps1>"

Topic Dependencies

choco (main workflow)
  ├─→ diagnose (step 1 diagnosis)
  ├─→ metadata-fix (recover stale choco/UniGetUI metadata)
  ├─→ post-upgrade (bulk check after choco upgrade)
  ├─→ update-path (nssm path refresh)
  └─→ shawl-migration (NSSM → shawl migration)
        └─→ shawl binary (~/.local/bin/shawl.exe, downloaded from GitHub releases)
  • Simple path refresh → update-path
  • Major upgrade requiring nssm deprecation → shawl-migration
  • Runtime OK + only chocolatey metadata stale → metadata-fix
  • Multiple services in bulk → diagnose + post-upgrade

Self-heal

This skill is subject to self-improvement after execution. If malfunction is detected, improve it via /skill-kit upgrade choco.

Checklist:

  1. Are the trigger keywords in description sufficient?
  2. Was the topic selection accurate? (e.g., misrouting metadata stale to update-path)
  3. Was the procedure complete? (Was no manual correction needed?)
  4. Were there no omissions in the deliverables?

References