clawt 3.9.13 → 3.10.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/README.md +80 -1
- package/README.zh-CN.md +81 -0
- package/dist/index.js +1935 -592
- package/dist/postinstall.js +1626 -283
- package/docs/config-file.md +2 -0
- package/docs/config.md +2 -1
- package/docs/init.md +3 -2
- package/docs/project-config.md +10 -1
- package/docs/spec.md +69 -2
- package/package.json +1 -1
- package/src/commands/alias.ts +5 -4
- package/src/commands/completion.ts +2 -1
- package/src/commands/config.ts +25 -7
- package/src/commands/cover-validate.ts +3 -2
- package/src/commands/create.ts +8 -7
- package/src/commands/home.ts +2 -1
- package/src/commands/init.ts +13 -6
- package/src/commands/list.ts +6 -4
- package/src/commands/merge.ts +8 -7
- package/src/commands/projects.ts +5 -3
- package/src/commands/remove.ts +7 -6
- package/src/commands/reset.ts +3 -2
- package/src/commands/resume.ts +10 -7
- package/src/commands/run.ts +8 -7
- package/src/commands/status.ts +16 -11
- package/src/commands/sync.ts +4 -3
- package/src/commands/tasks.ts +8 -6
- package/src/commands/validate.ts +7 -6
- package/src/constants/ai-prompts.ts +11 -11
- package/src/constants/config.ts +30 -0
- package/src/constants/index.ts +3 -2
- package/src/constants/messages/alias.ts +44 -14
- package/src/constants/messages/cli-descriptions.ts +91 -0
- package/src/constants/messages/common.ts +221 -36
- package/src/constants/messages/completion.ts +43 -14
- package/src/constants/messages/config.ts +61 -18
- package/src/constants/messages/cover-validate.ts +43 -14
- package/src/constants/messages/create.ts +16 -5
- package/src/constants/messages/home.ts +19 -6
- package/src/constants/messages/index.ts +2 -0
- package/src/constants/messages/init.ts +45 -14
- package/src/constants/messages/interactive-panel.ts +183 -29
- package/src/constants/messages/merge.ts +140 -38
- package/src/constants/messages/post-create.ts +59 -19
- package/src/constants/messages/projects.ts +51 -14
- package/src/constants/messages/remove.ts +50 -15
- package/src/constants/messages/reset.ts +14 -4
- package/src/constants/messages/resume.ts +116 -19
- package/src/constants/messages/run.ts +165 -35
- package/src/constants/messages/status.ts +84 -23
- package/src/constants/messages/sync.ts +54 -17
- package/src/constants/messages/tasks.ts +21 -7
- package/src/constants/messages/update.ts +35 -11
- package/src/constants/messages/validate.ts +218 -57
- package/src/constants/progress.ts +17 -6
- package/src/constants/project-config.ts +17 -0
- package/src/constants/prompt.ts +18 -2
- package/src/constants/tasks-template.ts +56 -2
- package/src/hooks/post-create.ts +5 -2
- package/src/index.ts +6 -5
- package/src/types/config.ts +2 -0
- package/src/utils/alias.ts +2 -1
- package/src/utils/claude.ts +10 -9
- package/src/utils/config-strategy.ts +3 -3
- package/src/utils/dry-run.ts +2 -2
- package/src/utils/formatter.ts +18 -11
- package/src/utils/i18n.ts +63 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/interactive-panel-render.ts +6 -3
- package/src/utils/progress-render.ts +11 -9
- package/src/utils/prompt.ts +2 -1
- package/src/utils/task-executor.ts +10 -7
- package/src/utils/task-file.ts +2 -1
- package/src/utils/terminal.ts +9 -9
- package/src/utils/ui-prompts.ts +4 -3
- package/src/utils/update-checker.ts +1 -1
- package/src/utils/validate-branch.ts +16 -9
- package/src/utils/validate-core.ts +2 -1
- package/src/utils/validate-runner.ts +2 -2
- package/src/utils/worktree-matcher.ts +9 -7
- package/tests/unit/commands/alias.test.ts +4 -0
- package/tests/unit/commands/completion.test.ts +14 -0
- package/tests/unit/commands/config.test.ts +61 -28
- package/tests/unit/commands/cover-validate.test.ts +13 -2
- package/tests/unit/commands/init.test.ts +6 -2
- package/tests/unit/commands/merge.test.ts +14 -0
- package/tests/unit/commands/run.test.ts +17 -0
- package/tests/unit/commands/tasks.test.ts +39 -9
- package/tests/unit/constants/config.test.ts +16 -1
- package/tests/unit/constants/messages-post-create.test.ts +93 -1
- package/tests/unit/constants/messages.test.ts +85 -1
- package/tests/unit/hooks/post-create.test.ts +32 -0
- package/tests/unit/utils/alias.test.ts +14 -0
- package/tests/unit/utils/claude.test.ts +24 -4
- package/tests/unit/utils/config-strategy.test.ts +21 -0
- package/tests/unit/utils/conflict-resolver.test.ts +24 -4
- package/tests/unit/utils/formatter.test.ts +21 -0
- package/tests/unit/utils/i18n.test.ts +91 -0
- package/tests/unit/utils/progress.test.ts +39 -18
- package/tests/unit/utils/prompt.test.ts +25 -2
- package/tests/unit/utils/task-file.test.ts +73 -10
- package/tests/unit/utils/terminal-cmux.test.ts +19 -4
- package/tests/unit/utils/update-checker.test.ts +2 -0
- package/tests/unit/utils/validate-branch.test.ts +26 -1
- package/tests/unit/utils/validation.test.ts +2 -2
- package/tests/unit/utils/worktree-matcher.test.ts +2 -0
|
@@ -1,25 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { createMessages } from '../../utils/i18n.js';
|
|
2
|
+
|
|
3
|
+
/** remove 命令专属提示消息(双语映射) */
|
|
4
|
+
const REMOVE_MESSAGES_I18N = {
|
|
3
5
|
/** remove 无可用 worktree */
|
|
4
|
-
REMOVE_NO_WORKTREES:
|
|
6
|
+
REMOVE_NO_WORKTREES: {
|
|
7
|
+
en: 'No worktrees available, nothing to remove',
|
|
8
|
+
'zh-CN': '当前项目没有可用的 worktree,无需移除',
|
|
9
|
+
},
|
|
5
10
|
/** remove 多选交互提示 */
|
|
6
|
-
REMOVE_SELECT_BRANCH:
|
|
11
|
+
REMOVE_SELECT_BRANCH: {
|
|
12
|
+
en: 'Select branches to remove (space to select, enter to confirm)',
|
|
13
|
+
'zh-CN': '请选择要移除的分支(空格选择,回车确认)',
|
|
14
|
+
},
|
|
7
15
|
/** remove 模糊匹配到多个结果提示 */
|
|
8
|
-
REMOVE_MULTIPLE_MATCHES:
|
|
16
|
+
REMOVE_MULTIPLE_MATCHES: {
|
|
17
|
+
en: (name: string) => `"${name}" matched multiple branches, please select which to remove (space to select, enter to confirm):`,
|
|
18
|
+
'zh-CN': (name: string) => `"${name}" 匹配到多个分支,请选择要移除的(空格选择,回车确认):`,
|
|
19
|
+
},
|
|
9
20
|
/** remove 模糊匹配无结果,列出可用分支 */
|
|
10
|
-
REMOVE_NO_MATCH:
|
|
11
|
-
|
|
21
|
+
REMOVE_NO_MATCH: {
|
|
22
|
+
en: (name: string, branches: string[]) =>
|
|
23
|
+
`No branches matching "${name}"\n Available branches:\n${branches.map((b) => ` - ${b}`).join('\n')}`,
|
|
24
|
+
'zh-CN': (name: string, branches: string[]) =>
|
|
25
|
+
`未找到与 "${name}" 匹配的分支\n 可用分支:\n${branches.map((b) => ` - ${b}`).join('\n')}`,
|
|
26
|
+
},
|
|
12
27
|
/** 批量移除部分失败 */
|
|
13
|
-
REMOVE_PARTIAL_FAILURE:
|
|
14
|
-
|
|
28
|
+
REMOVE_PARTIAL_FAILURE: {
|
|
29
|
+
en: (failures: Array<{ path: string; error: string }>) =>
|
|
30
|
+
`Failed to remove the following worktrees:\n${failures.map((f) => ` ✗ ${f.path}: ${f.error}`).join('\n')}`,
|
|
31
|
+
'zh-CN': (failures: Array<{ path: string; error: string }>) =>
|
|
32
|
+
`以下 worktree 移除失败:\n${failures.map((f) => ` ✗ ${f.path}: ${f.error}`).join('\n')}`,
|
|
33
|
+
},
|
|
15
34
|
/** 用户选择保留本地分支 */
|
|
16
|
-
REMOVE_BRANCHES_KEPT:
|
|
35
|
+
REMOVE_BRANCHES_KEPT: {
|
|
36
|
+
en: 'Local branches kept. You can manually delete them later with: git branch -D <branch-name>',
|
|
37
|
+
'zh-CN': '已保留本地分支,可稍后使用 git branch -D <分支名> 手动删除',
|
|
38
|
+
},
|
|
17
39
|
/** 确认删除本地分支和验证分支 */
|
|
18
|
-
REMOVE_CONFIRM_DELETE_BRANCHES:
|
|
40
|
+
REMOVE_CONFIRM_DELETE_BRANCHES: {
|
|
41
|
+
en: 'Also delete the associated local and validation branches?',
|
|
42
|
+
'zh-CN': '是否同时删除对应的本地分支和验证分支?',
|
|
43
|
+
},
|
|
19
44
|
/** 待移除的 worktree 的分支是主 worktree 当前所在分支 */
|
|
20
|
-
REMOVE_BRANCH_IS_CURRENT:
|
|
21
|
-
|
|
45
|
+
REMOVE_BRANCH_IS_CURRENT: {
|
|
46
|
+
en: (branch: string) =>
|
|
47
|
+
`Cannot remove: branch ${branch} is the current branch of the main worktree. Please switch to another branch first`,
|
|
48
|
+
'zh-CN': (branch: string) =>
|
|
49
|
+
`无法移除:分支 ${branch} 是主 worktree 当前所在分支,请先切换到其他分支后再移除`,
|
|
50
|
+
},
|
|
22
51
|
/** 待移除的 worktree 对应的验证分支是主 worktree 当前所在分支 */
|
|
23
|
-
REMOVE_VALIDATE_BRANCH_IS_CURRENT:
|
|
24
|
-
|
|
52
|
+
REMOVE_VALIDATE_BRANCH_IS_CURRENT: {
|
|
53
|
+
en: (branch: string, validateBranch: string) =>
|
|
54
|
+
`Cannot remove: the validation branch ${validateBranch} of branch ${branch} is the current branch of the main worktree. Please switch to another branch first`,
|
|
55
|
+
'zh-CN': (branch: string, validateBranch: string) =>
|
|
56
|
+
`无法移除:分支 ${branch} 的验证分支 ${validateBranch} 是主 worktree 当前所在分支,请先切换到其他分支后再移除`,
|
|
57
|
+
},
|
|
25
58
|
} as const;
|
|
59
|
+
|
|
60
|
+
export const REMOVE_MESSAGES = createMessages(REMOVE_MESSAGES_I18N);
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { createMessages } from '../../utils/i18n.js';
|
|
2
|
+
|
|
3
|
+
/** reset 命令专属提示消息(双语映射) */
|
|
4
|
+
const RESET_MESSAGES_I18N = {
|
|
3
5
|
/** reset 成功 */
|
|
4
|
-
RESET_SUCCESS:
|
|
6
|
+
RESET_SUCCESS: {
|
|
7
|
+
en: '✓ Main worktree working directory and staging area have been reset',
|
|
8
|
+
'zh-CN': '✓ 主 worktree 工作区和暂存区已重置',
|
|
9
|
+
},
|
|
5
10
|
/** reset 时工作区和暂存区已干净 */
|
|
6
|
-
RESET_ALREADY_CLEAN:
|
|
11
|
+
RESET_ALREADY_CLEAN: {
|
|
12
|
+
en: 'Main worktree working directory and staging area are already clean, no reset needed',
|
|
13
|
+
'zh-CN': '主 worktree 工作区和暂存区已是干净状态,无需重置',
|
|
14
|
+
},
|
|
7
15
|
} as const;
|
|
16
|
+
|
|
17
|
+
export const RESET_MESSAGES = createMessages(RESET_MESSAGES_I18N);
|
|
@@ -1,31 +1,128 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { createMessages } from '../../utils/i18n.js';
|
|
2
|
+
|
|
3
|
+
/** resume 命令专属提示消息(双语映射) */
|
|
4
|
+
const RESUME_MESSAGES_I18N = {
|
|
3
5
|
/** resume 无可用 worktree */
|
|
4
|
-
RESUME_NO_WORKTREES:
|
|
6
|
+
RESUME_NO_WORKTREES: {
|
|
7
|
+
en: 'No worktrees available, please create one with clawt run or clawt create first',
|
|
8
|
+
'zh-CN': '当前项目没有可用的 worktree,请先通过 clawt run 或 clawt create 创建',
|
|
9
|
+
},
|
|
5
10
|
/** resume 模糊匹配无结果,列出可用分支 */
|
|
6
|
-
RESUME_NO_MATCH:
|
|
7
|
-
|
|
11
|
+
RESUME_NO_MATCH: {
|
|
12
|
+
en: (name: string, branches: string[]) =>
|
|
13
|
+
`No branch matching "${name}"\n Available branches:\n${branches.map((b) => ` - ${b}`).join('\n')}`,
|
|
14
|
+
'zh-CN': (name: string, branches: string[]) =>
|
|
15
|
+
`未找到与 "${name}" 匹配的分支\n 可用分支:\n${branches.map((b) => ` - ${b}`).join('\n')}`,
|
|
16
|
+
},
|
|
8
17
|
/** resume 多选交互提示 */
|
|
9
|
-
RESUME_SELECT_BRANCH:
|
|
18
|
+
RESUME_SELECT_BRANCH: {
|
|
19
|
+
en: 'Select branches to resume (space to select, enter to confirm)',
|
|
20
|
+
'zh-CN': '请选择要恢复的分支(空格选择,回车确认)',
|
|
21
|
+
},
|
|
10
22
|
/** resume 模糊匹配到多个结果的多选提示 */
|
|
11
|
-
RESUME_MULTIPLE_MATCHES:
|
|
12
|
-
|
|
23
|
+
RESUME_MULTIPLE_MATCHES: {
|
|
24
|
+
en: (keyword: string) => `"${keyword}" matched multiple branches, please select which to resume:`,
|
|
25
|
+
'zh-CN': (keyword: string) => `"${keyword}" 匹配到多个分支,请选择要恢复的:`,
|
|
26
|
+
},
|
|
13
27
|
/** 批量 resume 确认提示 */
|
|
14
|
-
RESUME_ALL_CONFIRM:
|
|
28
|
+
RESUME_ALL_CONFIRM: {
|
|
29
|
+
en: (count: number) => `About to resume Claude Code sessions in ${count} terminal tabs, continue?`,
|
|
30
|
+
'zh-CN': (count: number) => `即将在 ${count} 个独立终端 Tab 中恢复 Claude Code 会话,是否继续?`,
|
|
31
|
+
},
|
|
15
32
|
/** 批量 resume 完成提示 */
|
|
16
|
-
RESUME_ALL_SUCCESS:
|
|
33
|
+
RESUME_ALL_SUCCESS: {
|
|
34
|
+
en: (count: number) => `Claude Code sessions started in ${count} terminal tabs`,
|
|
35
|
+
'zh-CN': (count: number) => `已在 ${count} 个终端 Tab 中启动 Claude Code 会话`,
|
|
36
|
+
},
|
|
17
37
|
/** 批量 resume 非 macOS 平台提示 */
|
|
18
|
-
RESUME_ALL_PLATFORM_UNSUPPORTED:
|
|
38
|
+
RESUME_ALL_PLATFORM_UNSUPPORTED: {
|
|
39
|
+
en: 'Batch resume is only supported on macOS (via AppleScript to open terminal tabs)',
|
|
40
|
+
'zh-CN': '批量 resume 目前仅支持 macOS 平台(通过 AppleScript 打开终端 Tab)',
|
|
41
|
+
},
|
|
19
42
|
/** 批量 resume 无匹配分支提示 */
|
|
20
|
-
RESUME_ALL_NO_MATCH:
|
|
21
|
-
|
|
43
|
+
RESUME_ALL_NO_MATCH: {
|
|
44
|
+
en: (keyword: string) => `No branch matching "${keyword}"`,
|
|
45
|
+
'zh-CN': (keyword: string) => `未找到与 "${keyword}" 匹配的分支`,
|
|
46
|
+
},
|
|
22
47
|
/** --prompt 必须配合 -b 指定目标分支 */
|
|
23
|
-
RESUME_PROMPT_REQUIRES_BRANCH:
|
|
48
|
+
RESUME_PROMPT_REQUIRES_BRANCH: {
|
|
49
|
+
en: '--prompt requires -b to specify the target branch',
|
|
50
|
+
'zh-CN': '--prompt 必须配合 -b 指定目标分支',
|
|
51
|
+
},
|
|
24
52
|
/** --prompt 和 -f 不能同时使用 */
|
|
25
|
-
RESUME_PROMPT_FILE_CONFLICT:
|
|
53
|
+
RESUME_PROMPT_FILE_CONFLICT: {
|
|
54
|
+
en: '--prompt and -f cannot be used together',
|
|
55
|
+
'zh-CN': '--prompt 和 -f 不能同时使用',
|
|
56
|
+
},
|
|
26
57
|
/** 未找到对应 worktree */
|
|
27
|
-
RESUME_WORKTREE_NOT_FOUND:
|
|
28
|
-
|
|
58
|
+
RESUME_WORKTREE_NOT_FOUND: {
|
|
59
|
+
en: (branch: string, available: string[]) =>
|
|
60
|
+
`No worktree found for branch "${branch}"\n Available branches:\n${available.map((b) => ` - ${b}`).join('\n')}`,
|
|
61
|
+
'zh-CN': (branch: string, available: string[]) =>
|
|
62
|
+
`未找到分支 "${branch}" 对应的 worktree\n 可用分支:\n${available.map((b) => ` - ${b}`).join('\n')}`,
|
|
63
|
+
},
|
|
29
64
|
/** 追问文件加载完成 */
|
|
30
|
-
RESUME_FOLLOW_UP_FILE_LOADED:
|
|
31
|
-
}
|
|
65
|
+
RESUME_FOLLOW_UP_FILE_LOADED: {
|
|
66
|
+
en: (count: number, path: string) => `Loaded ${count} follow-up task(s) from ${path}`,
|
|
67
|
+
'zh-CN': (count: number, path: string) => `从 ${path} 加载了 ${count} 个追问任务`,
|
|
68
|
+
},
|
|
69
|
+
// --- 从 terminal.ts 迁移 ---
|
|
70
|
+
/** 当前不在 cmux 环境中 */
|
|
71
|
+
NOT_IN_CMUX: {
|
|
72
|
+
en: 'Not currently in a cmux environment, cannot create surface\nPlease run clawt resume from a cmux terminal, or change the terminalApp config',
|
|
73
|
+
'zh-CN': '当前不在 cmux 环境中,无法创建 surface\n请确保在 cmux 终端中执行 clawt resume 命令,或修改 terminalApp 配置',
|
|
74
|
+
},
|
|
75
|
+
/** Terminal.app 辅助功能权限提示 */
|
|
76
|
+
TERMINAL_ACCESSIBILITY_HINT: {
|
|
77
|
+
en: '\nHint: Terminal.app requires Accessibility permission. Grant it in System Settings → Privacy & Security → Accessibility',
|
|
78
|
+
'zh-CN': '\n提示:Terminal.app 需要辅助功能权限,请在「系统设置 → 隐私与安全性 → 辅助功能」中授权终端应用',
|
|
79
|
+
},
|
|
80
|
+
/** 批量 resume 仅支持 macOS */
|
|
81
|
+
BATCH_RESUME_MACOS_ONLY: {
|
|
82
|
+
en: 'Batch resume is only supported on macOS',
|
|
83
|
+
'zh-CN': '批量 resume 目前仅支持 macOS 平台',
|
|
84
|
+
},
|
|
85
|
+
// --- 从 claude.ts 迁移 ---
|
|
86
|
+
/** 正在 worktree 中启动 Claude Code 交互式界面 */
|
|
87
|
+
STARTING_CLAUDE_INTERACTIVE: {
|
|
88
|
+
en: 'Starting Claude Code interactive session in worktree...',
|
|
89
|
+
'zh-CN': '正在 worktree 中启动 Claude Code 交互式界面...',
|
|
90
|
+
},
|
|
91
|
+
/** 分支标签 */
|
|
92
|
+
BRANCH_LABEL: {
|
|
93
|
+
en: 'Branch:',
|
|
94
|
+
'zh-CN': '分支:',
|
|
95
|
+
},
|
|
96
|
+
/** 路径标签(resume 专用,与 run 中的 PATH_LABEL 区分) */
|
|
97
|
+
PATH_LABEL_RESUME: {
|
|
98
|
+
en: 'Path:',
|
|
99
|
+
'zh-CN': '路径:',
|
|
100
|
+
},
|
|
101
|
+
/** 指令标签 */
|
|
102
|
+
COMMAND_LABEL: {
|
|
103
|
+
en: 'Command:',
|
|
104
|
+
'zh-CN': '指令:',
|
|
105
|
+
},
|
|
106
|
+
/** 模式标签 */
|
|
107
|
+
MODE_LABEL: {
|
|
108
|
+
en: 'Mode:',
|
|
109
|
+
'zh-CN': '模式:',
|
|
110
|
+
},
|
|
111
|
+
/** 继续上次对话 */
|
|
112
|
+
CONTINUE_SESSION: {
|
|
113
|
+
en: 'Continue previous session',
|
|
114
|
+
'zh-CN': '继续上次对话',
|
|
115
|
+
},
|
|
116
|
+
/** 新对话 */
|
|
117
|
+
NEW_SESSION: {
|
|
118
|
+
en: 'New session',
|
|
119
|
+
'zh-CN': '新对话',
|
|
120
|
+
},
|
|
121
|
+
/** 启动 Claude Code 失败 */
|
|
122
|
+
CLAUDE_START_FAILED: {
|
|
123
|
+
en: (message: string) => `Failed to start Claude Code: ${message}`,
|
|
124
|
+
'zh-CN': (message: string) => `启动 Claude Code 失败: ${message}`,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const RESUME_MESSAGES = createMessages(RESUME_MESSAGES_I18N);
|
|
@@ -1,62 +1,192 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { createMessages } from '../../utils/i18n.js';
|
|
2
|
+
|
|
3
|
+
/** run 命令专属提示消息(双语映射) */
|
|
4
|
+
const RUN_MESSAGES_I18N = {
|
|
3
5
|
/** 分支已存在时提示使用 resume */
|
|
4
|
-
BRANCH_EXISTS_USE_RESUME:
|
|
5
|
-
|
|
6
|
+
BRANCH_EXISTS_USE_RESUME: {
|
|
7
|
+
en: (name: string) => `Branch ${name} already exists, please use clawt resume -b ${name} to resume session`,
|
|
8
|
+
'zh-CN': (name: string) => `分支 ${name} 已存在,请使用 clawt resume -b ${name} 恢复会话`,
|
|
9
|
+
},
|
|
6
10
|
/** 检测到用户中断 */
|
|
7
|
-
INTERRUPTED:
|
|
11
|
+
INTERRUPTED: {
|
|
12
|
+
en: 'Exit signal detected, Claude Code tasks stopped',
|
|
13
|
+
'zh-CN': '检测到退出指令,已停止 Claude Code 任务',
|
|
14
|
+
},
|
|
8
15
|
/** 中断后自动清理完成 */
|
|
9
|
-
INTERRUPT_AUTO_CLEANED:
|
|
16
|
+
INTERRUPT_AUTO_CLEANED: {
|
|
17
|
+
en: (count: number) => `✓ Auto-cleaned ${count} worktree(s) and corresponding branches`,
|
|
18
|
+
'zh-CN': (count: number) => `✓ 已自动清理 ${count} 个 worktree 和对应分支`,
|
|
19
|
+
},
|
|
10
20
|
/** 中断后手动确认清理 */
|
|
11
|
-
INTERRUPT_CONFIRM_CLEANUP:
|
|
21
|
+
INTERRUPT_CONFIRM_CLEANUP: {
|
|
22
|
+
en: 'Remove the newly created worktrees and corresponding branches?',
|
|
23
|
+
'zh-CN': '是否移除刚刚创建的 worktree 和对应分支?',
|
|
24
|
+
},
|
|
12
25
|
/** 中断后清理完成 */
|
|
13
|
-
INTERRUPT_CLEANED:
|
|
26
|
+
INTERRUPT_CLEANED: {
|
|
27
|
+
en: (count: number) => `✓ Cleaned ${count} worktree(s) and corresponding branches`,
|
|
28
|
+
'zh-CN': (count: number) => `✓ 已清理 ${count} 个 worktree 和对应分支`,
|
|
29
|
+
},
|
|
14
30
|
/** 中断后保留 worktree */
|
|
15
|
-
INTERRUPT_KEPT:
|
|
31
|
+
INTERRUPT_KEPT: {
|
|
32
|
+
en: 'Worktrees kept, use clawt remove to clean up later',
|
|
33
|
+
'zh-CN': '已保留 worktree,可稍后使用 clawt remove 手动清理',
|
|
34
|
+
},
|
|
16
35
|
/** 非 TTY 环境降级输出:任务启动 */
|
|
17
|
-
PROGRESS_TASK_STARTED:
|
|
18
|
-
|
|
36
|
+
PROGRESS_TASK_STARTED: {
|
|
37
|
+
en: (index: number, total: number, branch: string, path: string) =>
|
|
38
|
+
`[${index}/${total}] ${branch} started ${path}`,
|
|
39
|
+
'zh-CN': (index: number, total: number, branch: string, path: string) =>
|
|
40
|
+
`[${index}/${total}] ${branch} 启动 ${path}`,
|
|
41
|
+
},
|
|
19
42
|
/** 非 TTY 环境降级输出:任务完成 */
|
|
20
|
-
PROGRESS_TASK_DONE:
|
|
21
|
-
|
|
43
|
+
PROGRESS_TASK_DONE: {
|
|
44
|
+
en: (index: number, total: number, branch: string, duration: string, cost: string, detail: string) =>
|
|
45
|
+
`[${index}/${total}] ${branch} ✓ done ${duration} ${cost} ${detail}`,
|
|
46
|
+
'zh-CN': (index: number, total: number, branch: string, duration: string, cost: string, detail: string) =>
|
|
47
|
+
`[${index}/${total}] ${branch} ✓ 完成 ${duration} ${cost} ${detail}`,
|
|
48
|
+
},
|
|
22
49
|
/** 非 TTY 环境降级输出:任务失败 */
|
|
23
|
-
PROGRESS_TASK_FAILED:
|
|
24
|
-
|
|
50
|
+
PROGRESS_TASK_FAILED: {
|
|
51
|
+
en: (index: number, total: number, branch: string, duration: string, detail: string) =>
|
|
52
|
+
`[${index}/${total}] ${branch} ✗ failed ${duration} ${detail}`,
|
|
53
|
+
'zh-CN': (index: number, total: number, branch: string, duration: string, detail: string) =>
|
|
54
|
+
`[${index}/${total}] ${branch} ✗ 失败 ${duration} ${detail}`,
|
|
55
|
+
},
|
|
25
56
|
/** 并发限制提示 */
|
|
26
|
-
CONCURRENCY_INFO:
|
|
27
|
-
|
|
57
|
+
CONCURRENCY_INFO: {
|
|
58
|
+
en: (concurrency: number, total: number) =>
|
|
59
|
+
`Concurrency: ${concurrency}, total tasks: ${total}`,
|
|
60
|
+
'zh-CN': (concurrency: number, total: number) =>
|
|
61
|
+
`并发限制: ${concurrency},共 ${total} 个任务`,
|
|
62
|
+
},
|
|
28
63
|
/** 并发数无效提示 */
|
|
29
|
-
CONCURRENCY_INVALID:
|
|
64
|
+
CONCURRENCY_INVALID: {
|
|
65
|
+
en: 'Concurrency must be a positive integer',
|
|
66
|
+
'zh-CN': '并发数必须为正整数',
|
|
67
|
+
},
|
|
30
68
|
/** 任务文件不存在 */
|
|
31
|
-
TASK_FILE_NOT_FOUND:
|
|
69
|
+
TASK_FILE_NOT_FOUND: {
|
|
70
|
+
en: (path: string) => `Task file not found: ${path}`,
|
|
71
|
+
'zh-CN': (path: string) => `任务文件不存在: ${path}`,
|
|
72
|
+
},
|
|
32
73
|
/** 任务文件中没有解析到有效任务 */
|
|
33
|
-
TASK_FILE_EMPTY:
|
|
74
|
+
TASK_FILE_EMPTY: {
|
|
75
|
+
en: 'No valid tasks found in the task file',
|
|
76
|
+
'zh-CN': '任务文件中没有解析到有效任务',
|
|
77
|
+
},
|
|
34
78
|
/** 任务文件中某个任务块缺少分支名 */
|
|
35
|
-
TASK_FILE_MISSING_BRANCH:
|
|
79
|
+
TASK_FILE_MISSING_BRANCH: {
|
|
80
|
+
en: (blockIndex: number) => `Task block #${blockIndex} is missing branch name (# branch: ...)`,
|
|
81
|
+
'zh-CN': (blockIndex: number) => `任务文件第 ${blockIndex} 个任务块缺少分支名(# branch: ...)`,
|
|
82
|
+
},
|
|
36
83
|
/** 任务文件中某个任务块缺少任务描述 */
|
|
37
|
-
TASK_FILE_MISSING_TASK:
|
|
84
|
+
TASK_FILE_MISSING_TASK: {
|
|
85
|
+
en: (branch: string) => `Task file is missing task description for branch ${branch}`,
|
|
86
|
+
'zh-CN': (branch: string) => `任务文件中分支 ${branch} 缺少任务描述`,
|
|
87
|
+
},
|
|
38
88
|
/** 任务文件中某个任务块缺少任务描述(无分支名时按索引定位) */
|
|
39
|
-
TASK_FILE_MISSING_TASK_BY_INDEX:
|
|
89
|
+
TASK_FILE_MISSING_TASK_BY_INDEX: {
|
|
90
|
+
en: (blockIndex: number) => `Task block #${blockIndex} is missing task description`,
|
|
91
|
+
'zh-CN': (blockIndex: number) => `任务文件第 ${blockIndex} 个任务块缺少任务描述`,
|
|
92
|
+
},
|
|
40
93
|
/** --file 和 --tasks 不能同时使用 */
|
|
41
|
-
FILE_AND_TASKS_CONFLICT:
|
|
94
|
+
FILE_AND_TASKS_CONFLICT: {
|
|
95
|
+
en: '--file and --tasks cannot be used together',
|
|
96
|
+
'zh-CN': '--file 和 --tasks 不能同时使用',
|
|
97
|
+
},
|
|
42
98
|
/** 任务文件加载成功 */
|
|
43
|
-
TASK_FILE_LOADED:
|
|
99
|
+
TASK_FILE_LOADED: {
|
|
100
|
+
en: (count: number, path: string) => `✓ Loaded ${count} task(s) from ${path}`,
|
|
101
|
+
'zh-CN': (count: number, path: string) => `✓ 从 ${path} 加载了 ${count} 个任务`,
|
|
102
|
+
},
|
|
44
103
|
/** 未指定 -b 或 -f */
|
|
45
|
-
BRANCH_OR_FILE_REQUIRED:
|
|
104
|
+
BRANCH_OR_FILE_REQUIRED: {
|
|
105
|
+
en: 'Please specify -b <branch> or -f <task-file>',
|
|
106
|
+
'zh-CN': '请指定 -b 分支名或 -f 任务文件',
|
|
107
|
+
},
|
|
46
108
|
/** dry-run 预览标题 */
|
|
47
|
-
DRY_RUN_TITLE:
|
|
109
|
+
DRY_RUN_TITLE: {
|
|
110
|
+
en: 'Dry Run Preview',
|
|
111
|
+
'zh-CN': 'Dry Run 预览',
|
|
112
|
+
},
|
|
48
113
|
/** dry-run 任务数量 */
|
|
49
|
-
DRY_RUN_TASK_COUNT:
|
|
114
|
+
DRY_RUN_TASK_COUNT: {
|
|
115
|
+
en: (count: number) => `Tasks: ${count}`,
|
|
116
|
+
'zh-CN': (count: number) => `任务数: ${count}`,
|
|
117
|
+
},
|
|
50
118
|
/** dry-run 并发数 */
|
|
51
|
-
DRY_RUN_CONCURRENCY:
|
|
119
|
+
DRY_RUN_CONCURRENCY: {
|
|
120
|
+
en: (concurrency: number) => `Concurrency: ${concurrency === 0 ? 'unlimited' : concurrency}`,
|
|
121
|
+
'zh-CN': (concurrency: number) => `并发数: ${concurrency === 0 ? '不限制' : concurrency}`,
|
|
122
|
+
},
|
|
52
123
|
/** dry-run worktree 目录 */
|
|
53
|
-
DRY_RUN_WORKTREE_DIR:
|
|
124
|
+
DRY_RUN_WORKTREE_DIR: {
|
|
125
|
+
en: (dir: string) => `Worktree: ${dir}`,
|
|
126
|
+
'zh-CN': (dir: string) => `Worktree: ${dir}`,
|
|
127
|
+
},
|
|
54
128
|
/** dry-run 分支已存在警告 */
|
|
55
|
-
DRY_RUN_BRANCH_EXISTS_WARNING:
|
|
129
|
+
DRY_RUN_BRANCH_EXISTS_WARNING: {
|
|
130
|
+
en: (name: string) => `Branch ${name} already exists`,
|
|
131
|
+
'zh-CN': (name: string) => `分支 ${name} 已存在`,
|
|
132
|
+
},
|
|
56
133
|
/** dry-run 交互式模式提示(无任务描述) */
|
|
57
|
-
DRY_RUN_INTERACTIVE_MODE:
|
|
134
|
+
DRY_RUN_INTERACTIVE_MODE: {
|
|
135
|
+
en: 'Mode: Interactive (no preset task)',
|
|
136
|
+
'zh-CN': '模式: 交互式(无预设任务)',
|
|
137
|
+
},
|
|
58
138
|
/** dry-run 预览完成且无冲突 */
|
|
59
|
-
DRY_RUN_READY:
|
|
139
|
+
DRY_RUN_READY: {
|
|
140
|
+
en: 'Preview complete, no conflicts. Remove --dry-run to execute.',
|
|
141
|
+
'zh-CN': '预览完成,无冲突。移除 --dry-run 即可正式执行。',
|
|
142
|
+
},
|
|
60
143
|
/** dry-run 存在分支冲突 */
|
|
61
|
-
DRY_RUN_HAS_CONFLICT:
|
|
62
|
-
|
|
144
|
+
DRY_RUN_HAS_CONFLICT: {
|
|
145
|
+
en: 'Branch conflicts detected. Execution will fail. Please resolve conflicting branches first.',
|
|
146
|
+
'zh-CN': '存在分支冲突,实际执行时将会报错。请先处理冲突的分支。',
|
|
147
|
+
},
|
|
148
|
+
// --- 从 dry-run.ts 迁移 ---
|
|
149
|
+
/** 路径标签 */
|
|
150
|
+
PATH_LABEL: {
|
|
151
|
+
en: 'Path:',
|
|
152
|
+
'zh-CN': '路径:',
|
|
153
|
+
},
|
|
154
|
+
/** 任务标签 */
|
|
155
|
+
TASK_LABEL: {
|
|
156
|
+
en: 'Task:',
|
|
157
|
+
'zh-CN': '任务:',
|
|
158
|
+
},
|
|
159
|
+
// --- 从 task-executor.ts 迁移 ---
|
|
160
|
+
/** 任务执行失败 */
|
|
161
|
+
TASK_FAILED: {
|
|
162
|
+
en: 'Task execution failed',
|
|
163
|
+
'zh-CN': '任务执行失败',
|
|
164
|
+
},
|
|
165
|
+
/** 全部任务已完成 */
|
|
166
|
+
ALL_TASKS_COMPLETED: {
|
|
167
|
+
en: (total: number) => `All tasks completed (${total}/${total})`,
|
|
168
|
+
'zh-CN': (total: number) => `全部任务已完成 (${total}/${total})`,
|
|
169
|
+
},
|
|
170
|
+
/** 成功标签 */
|
|
171
|
+
SUCCESS_LABEL: {
|
|
172
|
+
en: 'Succeeded:',
|
|
173
|
+
'zh-CN': '成功:',
|
|
174
|
+
},
|
|
175
|
+
/** 失败标签 */
|
|
176
|
+
FAILURE_LABEL: {
|
|
177
|
+
en: 'Failed:',
|
|
178
|
+
'zh-CN': '失败:',
|
|
179
|
+
},
|
|
180
|
+
/** 总耗时标签 */
|
|
181
|
+
TOTAL_DURATION_LABEL: {
|
|
182
|
+
en: 'Total duration:',
|
|
183
|
+
'zh-CN': '总耗时:',
|
|
184
|
+
},
|
|
185
|
+
/** 总花费标签 */
|
|
186
|
+
TOTAL_COST_LABEL: {
|
|
187
|
+
en: 'Total cost:',
|
|
188
|
+
'zh-CN': '总花费:',
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export const RUN_MESSAGES = createMessages(RUN_MESSAGES_I18N);
|
|
@@ -1,42 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { createMessages } from '../../utils/i18n.js';
|
|
2
|
+
|
|
3
|
+
/** status 命令专属提示消息(双语映射) */
|
|
4
|
+
const STATUS_MESSAGES_I18N = {
|
|
3
5
|
/** status 命令标题 */
|
|
4
|
-
STATUS_TITLE:
|
|
6
|
+
STATUS_TITLE: {
|
|
7
|
+
en: (projectName: string) => `Project Status Overview: ${projectName}`,
|
|
8
|
+
'zh-CN': (projectName: string) => `项目状态总览: ${projectName}`,
|
|
9
|
+
},
|
|
5
10
|
/** status 主 worktree 区块标题 */
|
|
6
|
-
STATUS_MAIN_SECTION:
|
|
11
|
+
STATUS_MAIN_SECTION: {
|
|
12
|
+
en: 'Main Worktree',
|
|
13
|
+
'zh-CN': '主 Worktree',
|
|
14
|
+
},
|
|
7
15
|
/** status worktrees 区块标题 */
|
|
8
|
-
STATUS_WORKTREES_SECTION:
|
|
16
|
+
STATUS_WORKTREES_SECTION: {
|
|
17
|
+
en: 'Worktrees',
|
|
18
|
+
'zh-CN': 'Worktree 列表',
|
|
19
|
+
},
|
|
9
20
|
/** status 快照区块标题 */
|
|
10
|
-
STATUS_SNAPSHOTS_SECTION:
|
|
21
|
+
STATUS_SNAPSHOTS_SECTION: {
|
|
22
|
+
en: 'Validate Snapshots',
|
|
23
|
+
'zh-CN': 'Validate 快照',
|
|
24
|
+
},
|
|
11
25
|
/** status 无 worktree */
|
|
12
|
-
STATUS_NO_WORKTREES:
|
|
26
|
+
STATUS_NO_WORKTREES: {
|
|
27
|
+
en: '(No active worktrees)',
|
|
28
|
+
'zh-CN': '(无活跃 worktree)',
|
|
29
|
+
},
|
|
13
30
|
/** status 无未清理快照 */
|
|
14
|
-
STATUS_NO_SNAPSHOTS:
|
|
31
|
+
STATUS_NO_SNAPSHOTS: {
|
|
32
|
+
en: '(No pending snapshots)',
|
|
33
|
+
'zh-CN': '(无未清理的快照)',
|
|
34
|
+
},
|
|
15
35
|
/** status 变更状态:已提交 */
|
|
16
|
-
STATUS_CHANGE_COMMITTED:
|
|
36
|
+
STATUS_CHANGE_COMMITTED: {
|
|
37
|
+
en: 'Committed',
|
|
38
|
+
'zh-CN': '已提交',
|
|
39
|
+
},
|
|
17
40
|
/** status 变更状态:未提交修改 */
|
|
18
|
-
STATUS_CHANGE_UNCOMMITTED:
|
|
41
|
+
STATUS_CHANGE_UNCOMMITTED: {
|
|
42
|
+
en: 'Uncommitted changes',
|
|
43
|
+
'zh-CN': '未提交修改',
|
|
44
|
+
},
|
|
19
45
|
/** status 变更状态:合并冲突 */
|
|
20
|
-
STATUS_CHANGE_CONFLICT:
|
|
46
|
+
STATUS_CHANGE_CONFLICT: {
|
|
47
|
+
en: 'Merge conflict',
|
|
48
|
+
'zh-CN': '合并冲突',
|
|
49
|
+
},
|
|
21
50
|
/** status 变更状态:无变更 */
|
|
22
|
-
STATUS_CHANGE_CLEAN:
|
|
51
|
+
STATUS_CHANGE_CLEAN: {
|
|
52
|
+
en: 'No changes',
|
|
53
|
+
'zh-CN': '无变更',
|
|
54
|
+
},
|
|
23
55
|
/** status 快照对应 worktree 已不存在 */
|
|
24
|
-
STATUS_SNAPSHOT_ORPHANED:
|
|
56
|
+
STATUS_SNAPSHOT_ORPHANED: {
|
|
57
|
+
en: (count: number) => `${count} snapshot(s) reference worktrees that no longer exist`,
|
|
58
|
+
'zh-CN': (count: number) => `其中 ${count} 个快照对应的 worktree 已不存在`,
|
|
59
|
+
},
|
|
25
60
|
/** status 分支创建时间标签 */
|
|
26
|
-
STATUS_CREATED_AT:
|
|
61
|
+
STATUS_CREATED_AT: {
|
|
62
|
+
en: (relativeTime: string) => `Created ${relativeTime}`,
|
|
63
|
+
'zh-CN': (relativeTime: string) => `创建于 ${relativeTime}`,
|
|
64
|
+
},
|
|
27
65
|
/** status 分支无分叉提交时的提示 */
|
|
28
|
-
STATUS_NO_DIVERGED_COMMITS:
|
|
66
|
+
STATUS_NO_DIVERGED_COMMITS: {
|
|
67
|
+
en: 'No diverged commits yet',
|
|
68
|
+
'zh-CN': '尚无分叉提交',
|
|
69
|
+
},
|
|
29
70
|
/** status 上次验证时间标签 */
|
|
30
|
-
STATUS_LAST_VALIDATED:
|
|
71
|
+
STATUS_LAST_VALIDATED: {
|
|
72
|
+
en: (relativeTime: string) => `Last validated: ${relativeTime}`,
|
|
73
|
+
'zh-CN': (relativeTime: string) => `上次验证: ${relativeTime}`,
|
|
74
|
+
},
|
|
31
75
|
/** status 未验证警示 */
|
|
32
|
-
STATUS_NOT_VALIDATED:
|
|
76
|
+
STATUS_NOT_VALIDATED: {
|
|
77
|
+
en: '✗ Not validated',
|
|
78
|
+
'zh-CN': '✗ 未验证',
|
|
79
|
+
},
|
|
33
80
|
/** status 配置的主工作分支(正常状态) */
|
|
34
|
-
STATUS_CONFIGURED_BRANCH:
|
|
35
|
-
|
|
81
|
+
STATUS_CONFIGURED_BRANCH: {
|
|
82
|
+
en: (branchName: string) =>
|
|
83
|
+
`Main work branch: ${branchName}`,
|
|
84
|
+
'zh-CN': (branchName: string) =>
|
|
85
|
+
`主工作分支: ${branchName}`,
|
|
86
|
+
},
|
|
36
87
|
/** status 配置的主工作分支已不存在 */
|
|
37
|
-
STATUS_CONFIGURED_BRANCH_DELETED:
|
|
38
|
-
|
|
88
|
+
STATUS_CONFIGURED_BRANCH_DELETED: {
|
|
89
|
+
en: (branchName: string) =>
|
|
90
|
+
`✗ Main work branch: ${branchName} (no longer exists, run clawt init to reset)`,
|
|
91
|
+
'zh-CN': (branchName: string) =>
|
|
92
|
+
`✗ 主工作分支: ${branchName}(已不存在,请执行 clawt init 重新设置)`,
|
|
93
|
+
},
|
|
39
94
|
/** status 当前分支与配置的主工作分支不一致 */
|
|
40
|
-
STATUS_CONFIGURED_BRANCH_MISMATCH:
|
|
41
|
-
|
|
95
|
+
STATUS_CONFIGURED_BRANCH_MISMATCH: {
|
|
96
|
+
en: (branchName: string) =>
|
|
97
|
+
`⚠ Main work branch: ${branchName} (current branch mismatch, run clawt init to update)`,
|
|
98
|
+
'zh-CN': (branchName: string) =>
|
|
99
|
+
`⚠ 主工作分支: ${branchName}(当前分支不一致,如需更新请执行 clawt init)`,
|
|
100
|
+
},
|
|
42
101
|
} as const;
|
|
102
|
+
|
|
103
|
+
export const STATUS_MESSAGES = createMessages(STATUS_MESSAGES_I18N);
|