verify-worktree-plugins
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVerify Worktree Plugin Patches
验证Worktree插件补丁
After plugin updates, the worktree skills (compound-engineering , superpowers ) lose custom patches that tell Claude Code to launch new instances in worktree directories.
git-worktreeusing-git-worktrees插件更新后,worktree技能(compound-engineering的、superpowers的)会丢失自定义补丁,这些补丁用于告知Claude Code在worktree目录中启动新实例。
git-worktreeusing-git-worktreesWhat This Checks
验证内容
| Component | What's Verified |
|---|---|
| compound-engineering SKILL.md | "Claude Code + Worktree Working Directory" section |
| compound-engineering worktree-manager.sh | "Open a NEW Claude Code instance" banner after create |
| superpowers SKILL.md | "Launch Claude Code" in step 5 report |
| PreCompact hook | |
Both marketplace and latest cache versions are checked.
| 组件 | 验证内容 |
|---|---|
| compound-engineering SKILL.md | "Claude Code + Worktree工作目录"章节 |
| compound-engineering worktree-manager.sh | 创建后显示“打开新的Claude Code实例”提示 |
| superpowers SKILL.md | 第5步报告中的“启动Claude Code”部分 |
| PreCompact钩子 | 确保 |
会检查市场版本和最新缓存版本。
Instructions
操作步骤
1. Run the verification script
1. 运行验证脚本
bash
bash ~/.claude/scripts/verify-worktree-plugins.shbash
bash ~/.claude/scripts/verify-worktree-plugins.sh2. If any checks fail, re-apply patches
2. 若任何检查失败,重新应用补丁
bash
bash ~/.claude/scripts/verify-worktree-plugins.sh --patchbash
bash ~/.claude/scripts/verify-worktree-plugins.sh --patch3. If the PreCompact hook is missing worktree detection
3. 若PreCompact钩子缺少worktree检测功能
The flag cannot auto-fix the TypeScript hook. Regenerate it manually:
--patchThe hook at needs a function that:
~/.claude/hooks/context-compression-hook.tsgetWorktreeContext()- Runs to detect if CWD is a worktree (path contains
git rev-parse --git-dir)/worktrees/ - If yes, outputs branch, worktree path, and main repo path
- This output gets injected as a during compaction
<system-reminder>
Regenerate it with this structure:
typescript
import { execSync } from "node:child_process";
function getWorktreeContext(): string | null {
// Check git-dir for "/worktrees/" to detect worktree
// Return formatted context string with branch, path, main repo
// Return null if not in a worktree
}
// In main(): call getWorktreeContext() and console.log if non-null--patch位于的钩子需要一个函数,该函数需实现:
~/.claude/hooks/context-compression-hook.tsgetWorktreeContext()- 执行以检测当前工作目录是否为worktree(路径包含
git rev-parse --git-dir)/worktrees/ - 若是,输出分支、worktree路径和主仓库路径
- 该输出会在压缩过程中作为注入
<system-reminder>
按以下结构重新生成:
typescript
import { execSync } from "node:child_process";
function getWorktreeContext(): string | null {
// 检查git-dir是否包含"/worktrees/"以检测worktree
// 返回包含分支、路径和主仓库的格式化上下文字符串
// 若不在worktree中则返回null
}
// 在main()中:调用getWorktreeContext(),若结果非空则console.log4. Report results to the user
4. 向用户报告结果
Show the verification output and note any files that needed patching.
显示验证输出,并记录所有需要打补丁的文件。
Background
背景信息
Claude Code's statusline, git context, and system prompt are set at launch time. Running in a Bash tool call does NOT change the process CWD. After auto-compact, Claude reverts to the launch directory's context. Each worktree needs its own Claude Code instance launched from that directory ().
cdcd /path && claudeThe worktree plugin patches ensure Claude always tells the user to open a new terminal and launch Claude Code from the worktree directory after creation.
Claude Code的状态栏、git上下文和系统提示在启动时设置。在Bash工具调用中运行不会改变进程的当前工作目录。自动压缩后,Claude会恢复到启动目录的上下文。每个worktree都需要从该目录启动独立的Claude Code实例()。
cdcd /path && claudeworktree插件补丁确保Claude始终告知用户在创建worktree后打开新终端并从worktree目录启动Claude Code。
When to Run
运行时机
- After updating the plugin
compound-engineering - After updating the plugin
superpowers - If worktree creation stops showing the "launch Claude Code" instructions
- Periodically as a sanity check
- 更新插件后
compound-engineering - 更新插件后
superpowers - 当worktree创建后不再显示“启动Claude Code”说明时
- 定期作为健康检查