clawt 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@
29
29
  ## 关键约定
30
30
  - `autoDeleteBranch` 配置项影响三处:remove 命令、merge 命令、run 中断清理
31
31
  - `confirmDestructiveOps` 配置项影响两处:reset 命令、validate --clean
32
- - merge 的清理确认在 merge 操作之前询问(避免交互中断),但清理在 merge 成功后执行
32
+ - merge 的清理确认和清理操作均在 merge 成功后执行(避免 merge 冲突时提前询问用户造成困惑)
33
33
  - merge 成功后自动清理对应的 validate 快照(hasSnapshot + removeSnapshot)
34
34
  - merge 成功消息根据 `autoPullPush` 配置动态显示推送状态
35
35
  - run 的中断清理在所有子进程退出后执行
package/CLAUDE.md CHANGED
@@ -66,7 +66,7 @@ run 命令有两种模式:
66
66
  - tree 对象不依赖主分支 HEAD,无需一致性校验
67
67
  - 变更检测:同时检测目标 worktree 的未提交修改和已提交 commit,两者均无则提示无需验证
68
68
  - 未提交修改处理:有未提交修改时先做临时 commit,diff 完成后通过 `git reset --soft` 撤销恢复原状
69
- - `merge`:检测目标 worktree 状态(有修改则需 `-m` 提交,已提交则跳过,无变更则报错)→ **squash 检测**(检查目标分支是否存在 `AUTO_SAVE_COMMIT_MESSAGE` 前缀的 auto-save commit,如有则提示用户是否压缩所有提交:用户确认后通过 `gitMergeBase` 计算分叉点、`gitResetSoftTo` 将所有 commit reset 到暂存区;有 `-m` 则直接提交继续流程,无 `-m` 则提示用户自行提交后退出)→ 合并到主 worktree → 根据 `autoPullPush` 配置决定是否 pull + push(成功消息动态显示推送状态)→ 可选清理 worktree 和分支(受 `autoDeleteBranch` 配置或交互式确认控制)→ 清理对应的 validate 快照
69
+ - `merge`:检测目标 worktree 状态(有修改则需 `-m` 提交,已提交则跳过,无变更则报错)→ **squash 检测**(检查目标分支是否存在 `AUTO_SAVE_COMMIT_MESSAGE` 前缀的 auto-save commit,如有则提示用户是否压缩所有提交:用户确认后通过 `gitMergeBase` 计算分叉点、`gitResetSoftTo` 将所有 commit reset 到暂存区;有 `-m` 则直接提交继续流程,无 `-m` 则提示用户自行提交后退出)→ 合并到主 worktree → 根据 `autoPullPush` 配置决定是否 pull + push(成功消息动态显示推送状态)→ merge 成功后确认并清理 worktree 和分支(受 `autoDeleteBranch` 配置或交互式确认控制)→ 清理对应的 validate 快照
70
70
  - `run` 中断清理:Ctrl+C 终止所有子进程后,根据 `autoDeleteBranch` 配置自动清理或交互式确认清理本次创建的 worktree 和分支
71
71
 
72
72
  ### sync 命令流程
package/dist/index.js CHANGED
@@ -1274,7 +1274,7 @@ async function shouldCleanupAfterMerge(branchName) {
1274
1274
  printInfo(`\u5DF2\u914D\u7F6E\u81EA\u52A8\u5220\u9664\uFF0Cmerge \u6210\u529F\u540E\u5C06\u81EA\u52A8\u6E05\u7406 worktree \u548C\u5206\u652F: ${branchName}`);
1275
1275
  return true;
1276
1276
  }
1277
- return confirmAction(`merge \u6210\u529F\u540E\u662F\u5426\u5220\u9664\u5BF9\u5E94\u7684 worktree \u548C\u5206\u652F (${branchName})\uFF1F`);
1277
+ return confirmAction(`\u662F\u5426\u5220\u9664\u5BF9\u5E94\u7684 worktree \u548C\u5206\u652F (${branchName})\uFF1F`);
1278
1278
  }
1279
1279
  function cleanupWorktreeAndBranch(worktreePath, branchName) {
1280
1280
  cleanupWorktrees([{ path: worktreePath, branch: branchName }]);
@@ -1300,7 +1300,6 @@ async function handleMerge(options) {
1300
1300
  if (shouldExit) {
1301
1301
  return;
1302
1302
  }
1303
- const shouldCleanup = await shouldCleanupAfterMerge(options.branch);
1304
1303
  const targetClean = isWorkingDirClean(targetWorktreePath);
1305
1304
  if (!targetClean) {
1306
1305
  if (!options.message) {
@@ -1336,6 +1335,7 @@ async function handleMerge(options) {
1336
1335
  } else {
1337
1336
  printSuccess(MESSAGES.MERGE_SUCCESS_NO_MESSAGE(options.branch, autoPullPush));
1338
1337
  }
1338
+ const shouldCleanup = await shouldCleanupAfterMerge(options.branch);
1339
1339
  if (shouldCleanup) {
1340
1340
  cleanupWorktreeAndBranch(targetWorktreePath, options.branch);
1341
1341
  }
package/docs/spec.md CHANGED
@@ -654,7 +654,7 @@ clawt merge -b <branchName> [-m <commitMessage>]
654
654
  ✓ 分支 feature-scheme-1 已成功合并到当前分支
655
655
  ```
656
656
 
657
- 9. **merge 成功后清理 worktree 和分支(可选)**
657
+ 9. **merge 成功后确认并清理 worktree 和分支(可选)**
658
658
  - 如果配置文件中 `autoDeleteBranch` 为 `true`,自动执行清理
659
659
  - 否则交互式询问用户是否清理
660
660
  - 用户确认后,依次执行:
@@ -672,7 +672,7 @@ clawt merge -b <branchName> [-m <commitMessage>]
672
672
  10. **清理 validate 快照**
673
673
  - merge 成功后,如果存在该分支的 validate 快照(`~/.clawt/validate-snapshots/<project>/<branchName>.tree`),自动删除该快照文件(merge 成功后快照已无意义)
674
674
 
675
- > **注意:** 清理确认在 merge 操作之前询问(避免 merge 成功后因交互中断而遗留未清理的 worktree),但清理操作在 merge 成功后才执行。
675
+ > **注意:** 清理确认和清理操作均在 merge 成功后执行。只有 merge 成功才会询问用户是否清理 worktree 和分支,避免 merge 冲突时用户被提前询问造成困惑。
676
676
 
677
677
  ---
678
678
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawt",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "本地并行执行多个Claude Code Agent任务,融合 Git Worktree 与 Claude Code CLI 的命令行工具",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -105,7 +105,7 @@ async function shouldCleanupAfterMerge(branchName: string): Promise<boolean> {
105
105
  printInfo(`已配置自动删除,merge 成功后将自动清理 worktree 和分支: ${branchName}`);
106
106
  return true;
107
107
  }
108
- return confirmAction(`merge 成功后是否删除对应的 worktree 和分支 (${branchName})?`);
108
+ return confirmAction(`是否删除对应的 worktree 和分支 (${branchName})?`);
109
109
  }
110
110
 
111
111
  /**
@@ -153,9 +153,6 @@ async function handleMerge(options: MergeOptions): Promise<void> {
153
153
  return;
154
154
  }
155
155
 
156
- // merge 前确认是否清理 worktree 和分支
157
- const shouldCleanup = await shouldCleanupAfterMerge(options.branch);
158
-
159
156
  // 步骤 4:根据目标 worktree 状态决定是否需要提交
160
157
  const targetClean = isWorkingDirClean(targetWorktreePath);
161
158
 
@@ -206,7 +203,8 @@ async function handleMerge(options: MergeOptions): Promise<void> {
206
203
  printSuccess(MESSAGES.MERGE_SUCCESS_NO_MESSAGE(options.branch, autoPullPush));
207
204
  }
208
205
 
209
- // 步骤 9:merge 成功后清理 worktree 和分支
206
+ // 步骤 9:merge 成功后确认并清理 worktree 和分支
207
+ const shouldCleanup = await shouldCleanupAfterMerge(options.branch);
210
208
  if (shouldCleanup) {
211
209
  cleanupWorktreeAndBranch(targetWorktreePath, options.branch);
212
210
  }