lean-update
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineselean-update
lean-update
The script (, ) is the only thing that changes files: deterministic, tested, undone by . You are the middleware: detect, ask, run it, read it back. Change nothing before the user says yes.
lean-agentsscripts/lean.mjs--uninstallRun the script with (the latest release version, below). Without npm access or Node.js 22.20+, use the fallback bootstrap. It checks git and Node.js the way the README does ( offers only with Homebrew, asks first, else stops with a link; uses ), then downloads that release and checks its SHA256: . In a clone, works too. Use the latest release tag: .
npx -y lean-agents@<version> <flags>install.shbrew installinstall.ps1wingetcurl -fsSL https://github.com/estebanmr99/lean-agents/releases/download/<tag>/install.sh | bash -s -- <flags>node scripts/lean.mjs ...gh release view --repo estebanmr99/lean-agents --json tagName -q .tagName- Read the release. Fetch at that tag from
core/pins.json. Then read every release between the installed lean-agents version (https://raw.githubusercontent.com/estebanmr99/lean-agents/<tag>/inversion; for a hand install, ask or say it is unknown and read from the oldest release you can match) and the latest:state.json, and the matchinggh release view <tag> --repo estebanmr99/lean-agents --json body -q .bodysections. A pin'sCHANGELOG.mdadds to the impact.note- Start your answer with the breaking changes and upgrade steps from those notes, before any table.
- The notes mention OpenCode 2: say that upgrading OpenCode is the user's own step (lean-agents never upgrades it), and that before it they should back up the OpenCode data folder () and config; see "Staying on OpenCode 1.x" in
opencode.db. This skill never runs the OpenCode upgrade.docs/compatibility.md - A release with no clear "Upgrade" or "Breaking" notes: say so in plain words, and put "none in the release notes" in the table.
- Detect.
- exists (or
~/.config/lean-agents/state.jsonworks): run--doctor --json. Its--doctor --jsonlist is what is older than the pins.behind - No (installed by hand): run the read-only commands in "Detect what is installed" in
state.jsonto learn which agents and tools are there. Say that this install has no state yet and that the script will take it over without overwriting user files.docs/manual-install.md
- Dry run as JSON, with the script.
- With state: .
--update --dry-run --yes --json - Without state: . The JSON lists files, commands (exact
--dry-run --yes --json --agents <detected> --tools <detected>/npxlines, all pinned) and, on update,brew.behind
- With state:
- Show one table in plain words: . Installed comes from
tool | installed | pinned | impact | upgrade notes | what it would runor the detection; impact from step 1 ("not in the changelog" when it is not); upgrade notes from the releases in step 1 ("none in the release notes" when there are none); what it would run from the JSONbehind. Then ask: "Update these N tools?" Stop on no.commands - Back up only what changes, then run. One backup folder in the OS temp directory holding the files the JSON says will change (paths start with : expand them to full paths first) and that the engine does not already restore. This snippet is proven in bash only; its embedded quotes are untested on PowerShell 5.1, so on Windows PowerShell save the same JavaScript to a
~file in the temp folder and run.jsinstead. It prints the folder and copies each path in asnode <file> <path1> <path2>:<n>-<name>. Then run the same flags withoutnode -e "const fs=require('fs'),os=require('os'),p=require('path');const d=fs.mkdtempSync(p.join(os.tmpdir(),'lean-agents-backup-'));process.argv.slice(1).forEach((f,i)=>{if(fs.existsSync(f))fs.cpSync(f,p.join(d,i+'-'+p.basename(f)),{recursive:true})});console.log(d)" <path1> <path2>:--dry-run, or--update --yes. Stop at the first failure and report it.--yes --agents ... --tools ... - Read it back. Run . When
--doctor --jsonis true andokis empty, delete the backup folder (same PowerShell 5.1 caveat: use abehindfile there) with.jsand tell the user it is gone and thatnode -e "require('fs').rmSync(process.argv[1],{recursive:true,force:true})" <folder>still undoes everything. When it is not, keep the backup, say where it is, and offer to restore.--uninstall- Hand-off: if this lean-agents release offers the finish-step summary page (#181), tell the user it exists and offer to open it after they agree; the page lists what was updated, kept and skipped and the logins still needed. If this release has no such page, skip this and go to step 8.
- Share findings (optional). Only if you found a problem or an improvement (a failed command, a tool the detection cannot see, a missing changelog note):
- Never offer under ,
--privacy strictor--network off. Read the saved preset from--outbound off; with no state, ask once whether outbound calls are allowed.state.json - Ask: "Draft a redacted issue for lean-agents?" Stop on no.
- with the details on stdin (bash:
lean-agents --feedback-draft --feedback-kind update --failed-command "<tool>" --network on; PowerShell:< details.txt).Get-Content details.txt | npx -y lean-agents@<version> ...means stop.{"offer": false} - Duplicates: . If one matches, show it and stop.
gh issue list --repo estebanmr99/lean-agents --search "<title words>" - Show the full draft. Only after a yes: .
gh issue create --repo estebanmr99/lean-agents --title "<title>" --body-file <draft>
- Never offer under
- Report: old -> new per tool, what you verified (), what is left for the user.
--doctor --json
脚本(、)是唯一会修改文件的部分:行为确定、经过测试,并可通过 撤销。你负责充当中间层:执行检测、询问用户、运行脚本并回读结果。在用户同意前不要做任何更改。
lean-agentsscripts/lean.mjs--uninstall使用 运行脚本(使用下文给出的最新 release 版本)。如果无法访问 npm 或 Node.js 版本低于 22.20+,则使用 fallback bootstrap。它会按照 README 中的方式检查 git 和 Node.js( 仅在已安装 Homebrew 时提供 ,并会先询问;否则停止并给出链接; 使用 ),随后下载该 release 并校验其 SHA256:。在 clone 中,也可以运行 。使用最新 release tag:。
npx -y lean-agents@<version> <flags>install.shbrew installinstall.ps1wingetcurl -fsSL https://github.com/estebanmr99/lean-agents/releases/download/<tag>/install.sh | bash -s -- <flags>node scripts/lean.mjs ...gh release view --repo estebanmr99/lean-agents --json tagName -q .tagName- 读取 release。 从 获取该 tag 对应的
https://raw.githubusercontent.com/estebanmr99/lean-agents/<tag>/。然后读取已安装的 lean-agents 版本(core/pins.json中的state.json;对于手动安装,先询问,若无法确定则说明版本未知,并从能够匹配的最早 release 开始读取)与最新版本之间的每个 release:version,以及gh release view <tag> --repo estebanmr99/lean-agents --json body -q .body中对应的章节。某个 pin 的CHANGELOG.md会补充说明其影响。note- 回答时,先给出这些说明中的 breaking changes 和升级步骤,然后再展示表格。
- 说明中提到 OpenCode 2 时,要说明升级 OpenCode 需要用户自行完成(lean-agents 绝不升级它),并且应在此之前备份 OpenCode 数据文件夹()和配置;参见
opencode.db中的 “Staying on OpenCode 1.x”。此 skill 绝不运行 OpenCode 升级。docs/compatibility.md - 如果某个 release 没有明确的 “Upgrade” 或 “Breaking” 说明,用通俗易懂的话指出这一点,并在表格中填写 “release notes 中无相关说明”。
- 检测。
- 如果 存在(或
~/.config/lean-agents/state.json可运行):运行--doctor --json。其--doctor --json列表包含版本低于 pins 的项目。behind - 如果没有 (手动安装):运行
state.json中 “Detect what is installed” 部分的只读命令,了解已安装的 agents 和 tools。告知用户此安装尚无 state,脚本将接管该安装,但不会覆盖用户文件。docs/manual-install.md
- 如果
- 使用脚本以 JSON 形式执行 dry run。
- 有 state 时:。
--update --dry-run --yes --json - 没有 state 时:。 JSON 会列出 files、commands(准确的
--dry-run --yes --json --agents <detected> --tools <detected>/npx命令行,且均为已 pin 的版本),并在 update 时列出brew。behind
- 有 state 时:
- 用通俗易懂的语言展示一张表格:。“已安装版本”取自
工具 | 已安装版本 | 固定版本 | 影响 | 升级说明 | 将运行的命令或检测结果;“影响”取自步骤 1(若没有则填写 “not in the changelog”);“升级说明”取自步骤 1 中的 releases(没有相关说明时填写 “release notes 中无相关说明”);“将运行的命令”取自 JSON 的behind。然后询问:“更新这 N 个工具吗?”用户拒绝时停止。commands - 仅备份将要更改的内容,然后运行。 在操作系统临时目录中创建一个备份文件夹,其中保存 JSON 指明将更改、且 engine 本身不会恢复的文件(路径以 开头:先将其展开为完整路径)。此代码段仅在 bash 中经过验证;其内嵌引号未在 PowerShell 5.1 上测试,因此在 Windows PowerShell 上,应将同一段 JavaScript 保存到临时文件夹中的
~文件,再运行.js。它会输出文件夹路径,并将每个路径复制进去,命名为node <file> <path1> <path2>:<n>-<name>。然后使用相同 flags、但不带node -e "const fs=require('fs'),os=require('os'),p=require('path');const d=fs.mkdtempSync(p.join(os.tmpdir(),'lean-agents-backup-'));process.argv.slice(1).forEach((f,i)=>{if(fs.existsSync(f))fs.cpSync(f,p.join(d,i+'-'+p.basename(f)),{recursive:true})});console.log(d)" <path1> <path2>运行:--dry-run,或--update --yes。首次失败时立即停止并报告。--yes --agents ... --tools ... - 回读结果。 运行 。当
--doctor --json为 true 且ok为空时,使用behind删除备份文件夹(同样注意 PowerShell 5.1 的限制:应在该环境中使用node -e "require('fs').rmSync(process.argv[1],{recursive:true,force:true})" <folder>文件),并告知用户备份已删除,且.js仍可撤销所有更改。否则,保留备份,说明其所在位置,并主动询问是否恢复。--uninstall- 交接: 如果此 lean-agents release 提供了完成步骤的汇总页面(#181),告知用户该页面的存在,并在用户同意后询问是否打开。页面会列出已更新、保留和跳过的内容,以及仍需完成的登录。如果此 release 没有该页面,则跳过此步骤并进入步骤 8。
- 分享发现(可选)。 仅当发现问题时或存在改进机会时才执行(例如命令失败、检测程序无法看到的工具、缺少 changelog 说明):
- 在 、
--privacy strict或--network off模式下,绝不提供此选项。从--outbound off读取已保存的 preset;如果没有 state,则询问一次是否允许 outbound calls。state.json - 询问:“为 lean-agents 起草一份已脱敏的 issue 吗?”用户拒绝时停止。
- 运行 ,并通过 stdin 提供详细信息(bash:
lean-agents --feedback-draft --feedback-kind update --failed-command "<tool>" --network on;PowerShell:< details.txt)。Get-Content details.txt | npx -y lean-agents@<version> ...表示停止。{"offer": false} - 重复项:运行 。如果找到匹配项,展示该 issue 并停止。
gh issue list --repo estebanmr99/lean-agents --search "<title words>" - 展示完整草稿。仅在用户同意后运行:。
gh issue create --repo estebanmr99/lean-agents --title "<title>" --body-file <draft>
- 在
- 报告: 按工具列出旧版本 -> 新版本、已验证的内容(),以及仍需用户处理的事项。
--doctor --json
Fallback: the script cannot run
Fallback:脚本无法运行
Only when Node is missing or the machine blocks the script. Use the table of commands and the install lines in (sections 4, 6, 7) by hand, with the same table, the same ask, the same backup and the same read-back. Say that this is the fallback: nothing here is recorded in , so will not know about it.
docs/manual-install.mdstate.json--uninstall仅当缺少 Node.js 或机器阻止脚本运行时使用此 fallback。根据 第 4、6、7 节中的命令表和安装命令行手动执行,同时使用相同的表格、询问、备份和回读流程。明确说明这是 fallback:此处执行的操作不会记录到 ,因此 不会知道这些更改。
docs/manual-install.mdstate.json--uninstall