skill-update

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

skill-update

skill-update

Finds every skill installed on this machine, works out where each one came from, compares it with its upstream and updates what is outdated, with a backup first. The engine is
scripts/skill_update.py
(Python 3.9+, standard library; the network is only touched through
git
).
Run it as
python3 "<this skill's folder>/scripts/skill_update.py" ...
. The folder is the "Base directory" shown when this skill loads.
查找本机上安装的所有 skill,确定每个 skill 的来源,将其与上游版本进行比较,并先创建备份,再更新所有过时版本。核心程序为
scripts/skill_update.py
(Python 3.9+,仅使用标准库;仅通过
git
访问网络)。
运行方式:
python3 "<this skill's folder>/scripts/skill_update.py" ...
。该文件夹就是加载此 skill 时显示的“Base directory”。

Workflow

工作流程

  1. Check (changes nothing):
    check --json
    . A cold first run can take up to a minute.
  2. Summarize for the user, in their language. Count what is outdated and list each outdated item with its name, source and size of change (
    changes
    ). Call out separately:
    • modified: true
      : the user edited that skill, and an update overwrites the edits after a backup.
    • setup_script: true
      : a git clone with a setup script. A plain
      update
      leaves it out (see
      skipped[]
      ). Offer to update it by name, and tell the user to run its setup script themselves.
    • blocked
      ,
      error
      ,
      unknown
      : say why, using
      notes
      . Do not retry in a loop.
    • unmanaged
      : only a count; these have no upstream to compare with.
  3. Ask which to update (default: all outdated). Do not run
    update
    until the user agrees.
  4. Update:
    update --yes [names...]
    . Add
    --keep-modified
    when the user wants their edits protected. Use
    --dry-run
    first when they want a preview. Naming a skill is the only way to update a
    setup_script
    clone.
  5. Report
    results
    (updated, unchanged, failed) and
    skipped[]
    with each reason, plus the
    run_id
    and how to undo it:
    rollback <run_id>
    . Relay
    notes
    : plugin changes need a restart, and new skill versions load in a new session.
  1. 检查(不会进行任何更改):
    check --json
    。首次冷启动最长可能需要一分钟。
  2. 向用户总结,使用用户所用的语言。统计过时项目的数量,并逐项列出每个过时项目的名称、来源和变更规模(
    changes
    )。另外单独说明:
    • modified: true
      :用户编辑过该 skill;更新时会在备份后覆盖这些修改。
    • setup_script: true
      :这是一个带 setup script 的 git clone。普通
      update
      会跳过它(见
      skipped[]
      )。可询问用户是否按名称更新,并提醒用户自行运行其 setup script。
    • blocked
      、
      error
      、
      unknown
      :使用
      notes
      说明原因。不要循环重试。
    • unmanaged
      :仅统计数量;这些 skill 没有可比较的上游版本。
  3. 询问用户要更新哪些项目(默认更新全部过时项目)。在用户同意前,不要运行
    update
    。
  4. 更新:
    update --yes [names...]
    。如果用户希望保护其修改,请添加
    --keep-modified
    。如果用户希望先预览,请先使用
    --dry-run
    。只有按名称指定 skill,才能更新
    setup_script
    clone。
  5. 报告
    results
    (updated、unchanged、failed)和
    skipped[]
    中的各项原因,同时提供
    run_id
    及撤销方法:
    rollback <run_id>
    。转达
    notes
    :plugin 变更需要重启,新的 skill 版本会在新会话中加载。

Rules

规则

  • Never pass
    --yes
    before the user approved the list.
  • Never run scripts that an updated skill ships (
    setup
    ,
    install.sh
    ,
    npm install
    ). When a result mentions one, tell the user and let them decide.
  • A source such as
    owner/repo
    can be passed to
    check
    and
    update
    to select everything from that source.
  • A failure on one item never blocks the others; report it and move on.
  • 在用户批准更新列表之前,绝不能传入
    --yes
    。
  • 绝不能运行更新后的 skill 所附带的脚本(
    setup
    、
    install.sh
    、
    npm install
    )。如果结果提到其中某个脚本,应告知用户,并由用户决定是否运行。
  • 可将
    owner/repo
    这样的来源传给
    check
    和
    update
    ,以选择该来源下的全部项目。
  • 单个项目的失败绝不能阻止其他项目;报告失败后继续处理。

Commands

命令

CommandWhat it does
check [--json] [--refresh] [names]
List what is outdated.
--refresh
also refreshes the plugin marketplaces first.
update [names] --yes [--dry-run] [--keep-modified] [--no-backup] [--refresh]
Apply updates.
--no-backup
is refused while a skill has local edits.
rollback [run_id] [--list]
Undo an update run.
scan
Show which skill folders were found.
Limit a run with
--only lock|git|plugin
, leave a skill out with
--ignore NAME
, scan another folder with
--root DIR
.
命令作用
check [--json] [--refresh] [names]
列出所有过时项目。
--refresh
还会先刷新 plugin 市场。
update [names] --yes [--dry-run] [--keep-modified] [--no-backup] [--refresh]
应用更新。当 skill 存在本地修改时,会拒绝
--no-backup
。
rollback [run_id] [--list]
撤销一次更新运行。
scan
显示已找到的 skill 文件夹。
可使用
--only lock|git|plugin
限制本次运行范围,使用
--ignore NAME
排除某个 skill,使用
--root DIR
扫描其他文件夹。

JSON fields

JSON 字段

items[]
:
name
,
kind
(lock, git, plugin, unmanaged),
status
(outdated, current, blocked, unknown, error, unmanaged),
source
,
agents
,
locations
,
modified
,
setup_script
(only when true),
changes
(
added
,
modified
,
removed
,
files
),
notes
.
update
returns
results[]
(
outcome
: updated, unchanged, failed),
skipped[]
(
name
,
reason
),
run_id
and
notes
.
items[]
:
name
、
kind
(lock、git、plugin、unmanaged)、
status
(outdated、current、blocked、unknown、error、unmanaged)、
source
、
agents
、
locations
、
modified
、
setup_script
(仅在为 true 时出现)、
changes
(
added
、
modified
、
removed
、
files
)、
notes
。
update
返回
results[]
(
outcome
:updated、unchanged、failed)、
skipped[]
(
name
、
reason
)、
run_id
和
notes
。