clawt 2.7.3 → 2.7.4

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.
package/dist/index.js CHANGED
@@ -55,7 +55,7 @@ var MESSAGES = {
55
55
  /** merge 成功(无提交信息,目标 worktree 已提交过) */
56
56
  MERGE_SUCCESS_NO_MESSAGE: (branch, pushed) => `\u2713 \u5206\u652F ${branch} \u5DF2\u6210\u529F\u5408\u5E76\u5230\u5F53\u524D\u5206\u652F${pushed ? "\n \u5DF2\u63A8\u9001\u5230\u8FDC\u7A0B\u4ED3\u5E93" : ""}`,
57
57
  /** merge 冲突 */
58
- MERGE_CONFLICT: "\u5408\u5E76\u5B58\u5728\u51B2\u7A81\uFF0C\u8BF7\u624B\u52A8\u5904\u7406",
58
+ MERGE_CONFLICT: "\u5408\u5E76\u5B58\u5728\u51B2\u7A81\uFF0C\u8BF7\u624B\u52A8\u5904\u7406\uFF1A\n \u89E3\u51B3\u51B2\u7A81\u540E\u6267\u884C git add . && git merge --continue",
59
59
  /** merge 后清理 worktree 和分支成功 */
60
60
  WORKTREE_CLEANED: (branch) => `\u2713 \u5DF2\u6E05\u7406 worktree \u548C\u5206\u652F: ${branch}`,
61
61
  /** 请提供提交信息 */
@@ -166,7 +166,11 @@ ${branches.map((b) => ` - ${b}`).join("\n")}`,
166
166
  /** sync 交互选择提示 */
167
167
  SYNC_SELECT_BRANCH: "\u8BF7\u9009\u62E9\u8981\u540C\u6B65\u7684\u5206\u652F",
168
168
  /** sync 模糊匹配到多个结果提示 */
169
- SYNC_MULTIPLE_MATCHES: (name) => `"${name}" \u5339\u914D\u5230\u591A\u4E2A\u5206\u652F\uFF0C\u8BF7\u9009\u62E9\uFF1A`
169
+ SYNC_MULTIPLE_MATCHES: (name) => `"${name}" \u5339\u914D\u5230\u591A\u4E2A\u5206\u652F\uFF0C\u8BF7\u9009\u62E9\uFF1A`,
170
+ /** merge 后 pull 冲突 */
171
+ PULL_CONFLICT: "\u81EA\u52A8 pull \u65F6\u53D1\u751F\u51B2\u7A81\uFF0Cmerge \u5DF2\u5B8C\u6210\u4F46\u8FDC\u7A0B\u540C\u6B65\u5931\u8D25\n \u8BF7\u624B\u52A8\u89E3\u51B3\u51B2\u7A81\uFF1A\n \u89E3\u51B3\u51B2\u7A81\u540E\u6267\u884C git add . && git commit\n \u7136\u540E\u6267\u884C git push \u63A8\u9001\u5230\u8FDC\u7A0B",
172
+ /** push 失败 */
173
+ PUSH_FAILED: "\u81EA\u52A8 push \u5931\u8D25\uFF0Cmerge \u548C pull \u5DF2\u5B8C\u6210\n \u8BF7\u624B\u52A8\u6267\u884C git push"
170
174
  };
171
175
 
172
176
  // src/constants/exitCodes.ts
@@ -1430,8 +1434,21 @@ async function handleMerge(options) {
1430
1434
  }
1431
1435
  const autoPullPush = getConfigValue("autoPullPush");
1432
1436
  if (autoPullPush) {
1433
- gitPull(mainWorktreePath);
1434
- gitPush(mainWorktreePath);
1437
+ try {
1438
+ gitPull(mainWorktreePath);
1439
+ } catch {
1440
+ if (hasMergeConflict(mainWorktreePath)) {
1441
+ printWarning(MESSAGES.PULL_CONFLICT);
1442
+ return;
1443
+ }
1444
+ throw new ClawtError(MESSAGES.PULL_CONFLICT);
1445
+ }
1446
+ try {
1447
+ gitPush(mainWorktreePath);
1448
+ } catch {
1449
+ printWarning(MESSAGES.PUSH_FAILED);
1450
+ return;
1451
+ }
1435
1452
  } else {
1436
1453
  printInfo("\u5DF2\u8DF3\u8FC7\u81EA\u52A8 pull/push\uFF0C\u8BF7\u624B\u52A8\u6267\u884C git pull && git push");
1437
1454
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawt",
3
- "version": "2.7.3",
3
+ "version": "2.7.4",
4
4
  "description": "本地并行执行多个Claude Code Agent任务,融合 Git Worktree 与 Claude Code CLI 的命令行工具",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -196,8 +196,23 @@ async function handleMerge(options: MergeOptions): Promise<void> {
196
196
  // 步骤 7:根据配置决定是否自动 pull 和 push
197
197
  const autoPullPush = getConfigValue('autoPullPush');
198
198
  if (autoPullPush) {
199
- gitPull(mainWorktreePath);
200
- gitPush(mainWorktreePath);
199
+ // pull 阶段:检测冲突并给出针对性引导
200
+ try {
201
+ gitPull(mainWorktreePath);
202
+ } catch {
203
+ if (hasMergeConflict(mainWorktreePath)) {
204
+ printWarning(MESSAGES.PULL_CONFLICT);
205
+ return;
206
+ }
207
+ throw new ClawtError(MESSAGES.PULL_CONFLICT);
208
+ }
209
+ // push 阶段
210
+ try {
211
+ gitPush(mainWorktreePath);
212
+ } catch {
213
+ printWarning(MESSAGES.PUSH_FAILED);
214
+ return;
215
+ }
201
216
  } else {
202
217
  printInfo('已跳过自动 pull/push,请手动执行 git pull && git push');
203
218
  }
@@ -39,7 +39,7 @@ export const MESSAGES = {
39
39
  MERGE_SUCCESS_NO_MESSAGE: (branch: string, pushed: boolean) =>
40
40
  `✓ 分支 ${branch} 已成功合并到当前分支${pushed ? '\n 已推送到远程仓库' : ''}`,
41
41
  /** merge 冲突 */
42
- MERGE_CONFLICT: '合并存在冲突,请手动处理',
42
+ MERGE_CONFLICT: '合并存在冲突,请手动处理:\n 解决冲突后执行 git add . && git merge --continue',
43
43
  /** merge 后清理 worktree 和分支成功 */
44
44
  WORKTREE_CLEANED: (branch: string) => `✓ 已清理 worktree 和分支: ${branch}`,
45
45
  /** 请提供提交信息 */
@@ -148,4 +148,9 @@ export const MESSAGES = {
148
148
  SYNC_SELECT_BRANCH: '请选择要同步的分支',
149
149
  /** sync 模糊匹配到多个结果提示 */
150
150
  SYNC_MULTIPLE_MATCHES: (name: string) => `"${name}" 匹配到多个分支,请选择:`,
151
+ /** merge 后 pull 冲突 */
152
+ PULL_CONFLICT:
153
+ '自动 pull 时发生冲突,merge 已完成但远程同步失败\n 请手动解决冲突:\n 解决冲突后执行 git add . && git commit\n 然后执行 git push 推送到远程',
154
+ /** push 失败 */
155
+ PUSH_FAILED: '自动 push 失败,merge 和 pull 已完成\n 请手动执行 git push',
151
156
  } as const;