clawt 2.3.0 → 2.3.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.
- package/dist/index.js +7 -7
- package/package.json +1 -1
- package/src/commands/merge.ts +4 -3
- package/src/constants/messages.ts +4 -4
package/dist/index.js
CHANGED
|
@@ -46,11 +46,10 @@ var MESSAGES = {
|
|
|
46
46
|
VALIDATE_SUCCESS: (branch) => `\u2713 \u5DF2\u5C06\u5206\u652F ${branch} \u7684\u53D8\u66F4\u5E94\u7528\u5230\u4E3B worktree
|
|
47
47
|
\u53EF\u4EE5\u5F00\u59CB\u9A8C\u8BC1\u4E86`,
|
|
48
48
|
/** merge 成功 */
|
|
49
|
-
MERGE_SUCCESS: (branch, message) => `\u2713 \u5206\u652F ${branch} \u5DF2\u6210\u529F\u5408\u5E76\u5230\u5F53\u524D\u5206\u652F
|
|
50
|
-
\u63D0\u4EA4\u4FE1\u606F: ${message}
|
|
51
|
-
\u5DF2\u63A8\u9001\u5230\u8FDC\u7A0B\u4ED3\u5E93`,
|
|
49
|
+
MERGE_SUCCESS: (branch, message, pushed) => `\u2713 \u5206\u652F ${branch} \u5DF2\u6210\u529F\u5408\u5E76\u5230\u5F53\u524D\u5206\u652F
|
|
50
|
+
\u63D0\u4EA4\u4FE1\u606F: ${message}${pushed ? "\n \u5DF2\u63A8\u9001\u5230\u8FDC\u7A0B\u4ED3\u5E93" : ""}`,
|
|
52
51
|
/** merge 成功(无提交信息,目标 worktree 已提交过) */
|
|
53
|
-
MERGE_SUCCESS_NO_MESSAGE: (branch) => `\u2713 \u5206\u652F ${branch} \u5DF2\u6210\u529F\u5408\u5E76\u5230\u5F53\u524D\u5206\u652F`,
|
|
52
|
+
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" : ""}`,
|
|
54
53
|
/** merge 冲突 */
|
|
55
54
|
MERGE_CONFLICT: "\u5408\u5E76\u5B58\u5728\u51B2\u7A81\uFF0C\u8BF7\u624B\u52A8\u5904\u7406",
|
|
56
55
|
/** merge 后清理 worktree 和分支成功 */
|
|
@@ -1192,16 +1191,17 @@ async function handleMerge(options) {
|
|
|
1192
1191
|
if (hasMergeConflict(mainWorktreePath)) {
|
|
1193
1192
|
throw new ClawtError(MESSAGES.MERGE_CONFLICT);
|
|
1194
1193
|
}
|
|
1195
|
-
|
|
1194
|
+
const autoPullPush = getConfigValue("autoPullPush");
|
|
1195
|
+
if (autoPullPush) {
|
|
1196
1196
|
gitPull(mainWorktreePath);
|
|
1197
1197
|
gitPush(mainWorktreePath);
|
|
1198
1198
|
} else {
|
|
1199
1199
|
printInfo("\u5DF2\u8DF3\u8FC7\u81EA\u52A8 pull/push\uFF0C\u8BF7\u624B\u52A8\u6267\u884C git pull && git push");
|
|
1200
1200
|
}
|
|
1201
1201
|
if (options.message) {
|
|
1202
|
-
printSuccess(MESSAGES.MERGE_SUCCESS(options.branch, options.message));
|
|
1202
|
+
printSuccess(MESSAGES.MERGE_SUCCESS(options.branch, options.message, autoPullPush));
|
|
1203
1203
|
} else {
|
|
1204
|
-
printSuccess(MESSAGES.MERGE_SUCCESS_NO_MESSAGE(options.branch));
|
|
1204
|
+
printSuccess(MESSAGES.MERGE_SUCCESS_NO_MESSAGE(options.branch, autoPullPush));
|
|
1205
1205
|
}
|
|
1206
1206
|
if (shouldCleanup) {
|
|
1207
1207
|
cleanupWorktreeAndBranch(targetWorktreePath, options.branch);
|
package/package.json
CHANGED
package/src/commands/merge.ts
CHANGED
|
@@ -191,7 +191,8 @@ async function handleMerge(options: MergeOptions): Promise<void> {
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
// 步骤 7:根据配置决定是否自动 pull 和 push
|
|
194
|
-
|
|
194
|
+
const autoPullPush = getConfigValue('autoPullPush');
|
|
195
|
+
if (autoPullPush) {
|
|
195
196
|
gitPull(mainWorktreePath);
|
|
196
197
|
gitPush(mainWorktreePath);
|
|
197
198
|
} else {
|
|
@@ -200,9 +201,9 @@ async function handleMerge(options: MergeOptions): Promise<void> {
|
|
|
200
201
|
|
|
201
202
|
// 步骤 8:输出成功提示(根据是否有 message 选择对应模板)
|
|
202
203
|
if (options.message) {
|
|
203
|
-
printSuccess(MESSAGES.MERGE_SUCCESS(options.branch, options.message));
|
|
204
|
+
printSuccess(MESSAGES.MERGE_SUCCESS(options.branch, options.message, autoPullPush));
|
|
204
205
|
} else {
|
|
205
|
-
printSuccess(MESSAGES.MERGE_SUCCESS_NO_MESSAGE(options.branch));
|
|
206
|
+
printSuccess(MESSAGES.MERGE_SUCCESS_NO_MESSAGE(options.branch, autoPullPush));
|
|
206
207
|
}
|
|
207
208
|
|
|
208
209
|
// 步骤 9:merge 成功后清理 worktree 和分支
|
|
@@ -27,11 +27,11 @@ export const MESSAGES = {
|
|
|
27
27
|
VALIDATE_SUCCESS: (branch: string) =>
|
|
28
28
|
`✓ 已将分支 ${branch} 的变更应用到主 worktree\n 可以开始验证了`,
|
|
29
29
|
/** merge 成功 */
|
|
30
|
-
MERGE_SUCCESS: (branch: string, message: string) =>
|
|
31
|
-
`✓ 分支 ${branch} 已成功合并到当前分支\n 提交信息: ${message}\n
|
|
30
|
+
MERGE_SUCCESS: (branch: string, message: string, pushed: boolean) =>
|
|
31
|
+
`✓ 分支 ${branch} 已成功合并到当前分支\n 提交信息: ${message}${pushed ? '\n 已推送到远程仓库' : ''}`,
|
|
32
32
|
/** merge 成功(无提交信息,目标 worktree 已提交过) */
|
|
33
|
-
MERGE_SUCCESS_NO_MESSAGE: (branch: string) =>
|
|
34
|
-
`✓ 分支 ${branch}
|
|
33
|
+
MERGE_SUCCESS_NO_MESSAGE: (branch: string, pushed: boolean) =>
|
|
34
|
+
`✓ 分支 ${branch} 已成功合并到当前分支${pushed ? '\n 已推送到远程仓库' : ''}`,
|
|
35
35
|
/** merge 冲突 */
|
|
36
36
|
MERGE_CONFLICT: '合并存在冲突,请手动处理',
|
|
37
37
|
/** merge 后清理 worktree 和分支成功 */
|