‹ 首页

thrunt-reapply-patches

@backbay-labs · 收录于 1 周前

Reapply local modifications after a THRUNT update

适合你,如果使用 THRUNT 并需要保留本地定制修改

/ 下载安装
thrunt-reapply-patches.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add backbay-labs/thrunt-god/thrunt-reapply-patches
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- backbay-labs/thrunt-god/thrunt-reapply-patches
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify backbay-labs/thrunt-god/thrunt-reapply-patches
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
34GitHub stars
~748上下文体积 · 单文件
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · 1e21b3d

<purpose> After a THRUNT update wipes and reinstalls files, this command merges user's previously saved local modifications back into the new version. Uses intelligent comparison to handle cases where the upstream file also changed. </purpose>

<process>

Step 1: Detect backed-up patches

Check for local patches directory:

# Global install — detect runtime config directory
if [ -d "$HOME/.config/opencode/thrunt-local-patches" ]; then
  PATCHES_DIR="$HOME/.config/opencode/thrunt-local-patches"
elif [ -d "$HOME/.opencode/thrunt-local-patches" ]; then
  PATCHES_DIR="$HOME/.opencode/thrunt-local-patches"
elif [ -d "$HOME/.gemini/thrunt-local-patches" ]; then
  PATCHES_DIR="$HOME/.gemini/thrunt-local-patches"
else
  PATCHES_DIR=".github/thrunt-local-patches"
fi
# Local install fallback — check all runtime directories
if [ ! -d "$PATCHES_DIR" ]; then
  for dir in .config/opencode .opencode .gemini .claude; do
    if [ -d "./$dir/thrunt-local-patches" ]; then
      PATCHES_DIR="./$dir/thrunt-local-patches"
      break
    fi
  done
fi

Read backup-meta.json from the patches directory.

If no patches found:

No local patches found. Nothing to reapply.

Local patches are automatically saved when you run /thrunt-update
after modifying any THRUNT workflow, command, or agent files.

Exit.

Step 2: Show patch summary
## Local Patches to Reapply

**Backed up from:** v{from_version}
**Current version:** {read VERSION file}
**Files modified:** {count}

| # | File | Status |
|---|------|--------|
| 1 | {file_path} | Pending |
| 2 | {file_path} | Pending |
Step 3: Merge each file

For each file in backup-meta.json:

  1. Read the backed-up version (user's modified copy from thrunt-local-patches/)
  2. Read the newly installed version (current file after update)
  3. Compare and merge:
  • If the new file is identical to the backed-up file: skip (modification was incorporated upstream)
  • If the new file differs: identify the user's modifications and apply them to the new version

Merge strategy:

  • Read both versions fully
  • Identify sections the user added or modified (look for additions, not just differences from path replacement)
  • Apply user's additions/modifications to the new version
  • If a section the user modified was also changed upstream: flag as conflict, show both versions, ask user which to keep
  1. Write merged result to the installed location
  2. Report status:
  3. Merged — user modifications applied cleanly
  4. Skipped — modification already in upstream
  5. Conflict — user chose resolution
Step 4: Update manifest

After reapplying, regenerate the file manifest so future updates correctly detect these as user modifications:

# The manifest will be regenerated on next /thrunt-update
# For now, just note which files were modified
Step 5: Cleanup option

Ask user:

  • "Keep patch backups for reference?" → preserve thrunt-local-patches/
  • "Clean up patch backups?" → remove thrunt-local-patches/ directory
Step 6: Report
## Patches Reapplied

| # | File | Status |
|---|------|--------|
| 1 | {file_path} | ✓ Merged |
| 2 | {file_path} | ○ Skipped (already upstream) |
| 3 | {file_path} | ⚠ Conflict resolved |

{count} file(s) updated. Your local modifications are active again.

</process>

<success_criteria>

  • [ ] All backed-up patches processed
  • [ ] User modifications merged into new version
  • [ ] Conflicts resolved with user input
  • [ ] Status reported for each file

</success_criteria>

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。