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.
Files changed (106) hide show
  1. package/README.md +80 -1
  2. package/README.zh-CN.md +81 -0
  3. package/dist/index.js +1935 -592
  4. package/dist/postinstall.js +1626 -283
  5. package/docs/config-file.md +2 -0
  6. package/docs/config.md +2 -1
  7. package/docs/init.md +3 -2
  8. package/docs/project-config.md +10 -1
  9. package/docs/spec.md +69 -2
  10. package/package.json +1 -1
  11. package/src/commands/alias.ts +5 -4
  12. package/src/commands/completion.ts +2 -1
  13. package/src/commands/config.ts +25 -7
  14. package/src/commands/cover-validate.ts +3 -2
  15. package/src/commands/create.ts +8 -7
  16. package/src/commands/home.ts +2 -1
  17. package/src/commands/init.ts +13 -6
  18. package/src/commands/list.ts +6 -4
  19. package/src/commands/merge.ts +8 -7
  20. package/src/commands/projects.ts +5 -3
  21. package/src/commands/remove.ts +7 -6
  22. package/src/commands/reset.ts +3 -2
  23. package/src/commands/resume.ts +10 -7
  24. package/src/commands/run.ts +8 -7
  25. package/src/commands/status.ts +16 -11
  26. package/src/commands/sync.ts +4 -3
  27. package/src/commands/tasks.ts +8 -6
  28. package/src/commands/validate.ts +7 -6
  29. package/src/constants/ai-prompts.ts +11 -11
  30. package/src/constants/config.ts +30 -0
  31. package/src/constants/index.ts +3 -2
  32. package/src/constants/messages/alias.ts +44 -14
  33. package/src/constants/messages/cli-descriptions.ts +91 -0
  34. package/src/constants/messages/common.ts +221 -36
  35. package/src/constants/messages/completion.ts +43 -14
  36. package/src/constants/messages/config.ts +61 -18
  37. package/src/constants/messages/cover-validate.ts +43 -14
  38. package/src/constants/messages/create.ts +16 -5
  39. package/src/constants/messages/home.ts +19 -6
  40. package/src/constants/messages/index.ts +2 -0
  41. package/src/constants/messages/init.ts +45 -14
  42. package/src/constants/messages/interactive-panel.ts +183 -29
  43. package/src/constants/messages/merge.ts +140 -38
  44. package/src/constants/messages/post-create.ts +59 -19
  45. package/src/constants/messages/projects.ts +51 -14
  46. package/src/constants/messages/remove.ts +50 -15
  47. package/src/constants/messages/reset.ts +14 -4
  48. package/src/constants/messages/resume.ts +116 -19
  49. package/src/constants/messages/run.ts +165 -35
  50. package/src/constants/messages/status.ts +84 -23
  51. package/src/constants/messages/sync.ts +54 -17
  52. package/src/constants/messages/tasks.ts +21 -7
  53. package/src/constants/messages/update.ts +35 -11
  54. package/src/constants/messages/validate.ts +218 -57
  55. package/src/constants/progress.ts +17 -6
  56. package/src/constants/project-config.ts +17 -0
  57. package/src/constants/prompt.ts +18 -2
  58. package/src/constants/tasks-template.ts +56 -2
  59. package/src/hooks/post-create.ts +5 -2
  60. package/src/index.ts +6 -5
  61. package/src/types/config.ts +2 -0
  62. package/src/utils/alias.ts +2 -1
  63. package/src/utils/claude.ts +10 -9
  64. package/src/utils/config-strategy.ts +3 -3
  65. package/src/utils/dry-run.ts +2 -2
  66. package/src/utils/formatter.ts +18 -11
  67. package/src/utils/i18n.ts +63 -0
  68. package/src/utils/index.ts +2 -0
  69. package/src/utils/interactive-panel-render.ts +6 -3
  70. package/src/utils/progress-render.ts +11 -9
  71. package/src/utils/prompt.ts +2 -1
  72. package/src/utils/task-executor.ts +10 -7
  73. package/src/utils/task-file.ts +2 -1
  74. package/src/utils/terminal.ts +9 -9
  75. package/src/utils/ui-prompts.ts +4 -3
  76. package/src/utils/update-checker.ts +1 -1
  77. package/src/utils/validate-branch.ts +16 -9
  78. package/src/utils/validate-core.ts +2 -1
  79. package/src/utils/validate-runner.ts +2 -2
  80. package/src/utils/worktree-matcher.ts +9 -7
  81. package/tests/unit/commands/alias.test.ts +4 -0
  82. package/tests/unit/commands/completion.test.ts +14 -0
  83. package/tests/unit/commands/config.test.ts +61 -28
  84. package/tests/unit/commands/cover-validate.test.ts +13 -2
  85. package/tests/unit/commands/init.test.ts +6 -2
  86. package/tests/unit/commands/merge.test.ts +14 -0
  87. package/tests/unit/commands/run.test.ts +17 -0
  88. package/tests/unit/commands/tasks.test.ts +39 -9
  89. package/tests/unit/constants/config.test.ts +16 -1
  90. package/tests/unit/constants/messages-post-create.test.ts +93 -1
  91. package/tests/unit/constants/messages.test.ts +85 -1
  92. package/tests/unit/hooks/post-create.test.ts +32 -0
  93. package/tests/unit/utils/alias.test.ts +14 -0
  94. package/tests/unit/utils/claude.test.ts +24 -4
  95. package/tests/unit/utils/config-strategy.test.ts +21 -0
  96. package/tests/unit/utils/conflict-resolver.test.ts +24 -4
  97. package/tests/unit/utils/formatter.test.ts +21 -0
  98. package/tests/unit/utils/i18n.test.ts +91 -0
  99. package/tests/unit/utils/progress.test.ts +39 -18
  100. package/tests/unit/utils/prompt.test.ts +25 -2
  101. package/tests/unit/utils/task-file.test.ts +73 -10
  102. package/tests/unit/utils/terminal-cmux.test.ts +19 -4
  103. package/tests/unit/utils/update-checker.test.ts +2 -0
  104. package/tests/unit/utils/validate-branch.test.ts +26 -1
  105. package/tests/unit/utils/validation.test.ts +2 -2
  106. package/tests/unit/utils/worktree-matcher.test.ts +2 -0
package/README.md CHANGED
@@ -1,9 +1,87 @@
1
1
  # Clawt
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/clawt.svg)](https://www.npmjs.com/package/clawt) [![GitHub](https://img.shields.io/badge/GHub-afk101%2Fclawt-blue)](https://github.com/afk101/clawt)
4
+
3
5
  **[English](./README.md)** | [中文](./README.zh-CN.md)
4
6
 
5
7
  Run multiple Claude Code Agent tasks in parallel based on Git Worktree — all agents' code changes are fully isolated from each other.
6
8
 
9
+ > When AI coding assistants are already smart enough, the bottleneck is no longer "can it do this" — it's "how many things can you have it do at once."
10
+
11
+ ## Why Clawt
12
+
13
+ Claude Code can independently complete feature development, bug fixes, and refactoring. But in real projects, you rarely face a single task — you face an entire iteration cycle with **multiple independent tasks that could run in parallel**:
14
+
15
+ - Replace message list with virtual list
16
+ - Implement publish/deploy dialog
17
+ - Fix navbar flicker bug
18
+ - ………………
19
+
20
+ This is how most developers use Claude Code today — **serial execution**:
21
+
22
+ ![Serial timeline](https://p5.ssl.qhimg.com/d/inn/20812850b163/2026-03-22-16-00-00-serial-timeline.png)
23
+
24
+ **3 tasks total ≈ 49.5 min.** The biggest problem: **while Claude is working on task A, B, C — you're just waiting.**
25
+
26
+ Running multiple tasks in the same repo simultaneously isn't recommended either — there's only one Git working tree, files can conflict, and commits would mix multiple independent tasks together.
27
+
28
+ ## Clawt's Parallel Mode
29
+
30
+ The core idea is simple:
31
+
32
+ > **Use Git Worktree to create an isolated working directory for each task, letting multiple Claude Code Agents work in parallel on their own branches — without interfering with each other.**
33
+
34
+ Same 3 tasks, with Clawt:
35
+
36
+ ![Parallel timeline](https://p5.ssl.qhimg.com/d/inn/737a5d53c9a0/2026-03-22-15-34-32-parallel-timeline.png)
37
+
38
+ **3 tasks total ≈ 26.5 min (parallel execution, sequential review)**
39
+
40
+ | Mode | 3 tasks | 10 tasks |
41
+ |------|---------|----------|
42
+ | Serial | ~49.5 min | ~165 min |
43
+ | **Clawt parallel** | **~26.5 min** | **~65 min** |
44
+ | Speedup | **1.9×** | **2.5×** |
45
+
46
+ The more tasks, the bigger the advantage. In serial mode, **you wait for AI**. In parallel mode, **AI waits for you**.
47
+
48
+ ## Why Git Worktree?
49
+
50
+ Can't you just open multiple terminals and clone multiple copies? You can — but Git Worktree is the cleaner solution:
51
+
52
+ | Approach | Disk usage | Git history | Branch mgmt | Merge |
53
+ |----------|-----------|-------------|-------------|-------|
54
+ | Multiple `git clone` | Full copy per repo (hundreds of MB ~ GB) | Independent, needs remote sync | Separate, messy | Requires push/pull across repos |
55
+ | **Git Worktree** | Shared `.git` objects, minimal overhead | **Shared** | **Unified** | Local branch merge, instant |
56
+
57
+ Git Worktree is a native Git mechanism (`git worktree add`) that creates multiple working directories under one repo, each on its own branch, sharing the same `.git` object database — low disk usage, fast local operations.
58
+
59
+ ## Design Philosophy
60
+
61
+ > **Human's job: think about requirements, write prompts, review code(Optional). AI's job: write code. Git Worktree is the isolation layer between them.**
62
+
63
+ ![Architecture](https://p0.ssl.qhimg.com/t11b673bcd66632b91c744dad9c.png)
64
+
65
+ > **Clawt does not modify, replace, or wrap Claude Code itself. It only manages "where" and "how many" Claude Code instances run — at a higher level.**
66
+
67
+ ![Layer architecture](https://p4.ssl.qhimg.com/d/inn/1e5b09fd7000/clawt-layer-architecture.png)
68
+
69
+ Everything you use inside each worktree is vanilla Claude Code — same interaction, same commands, same `CLAUDE.md`, same MCP config. Any Claude Code update automatically benefits Clawt with zero adaptation needed.
70
+
71
+ The workflow maps directly to standard Git practices:
72
+
73
+ ```
74
+ ┌─────────────┐ ┌──────────────────┐ ┌───────────────┐
75
+ │ clawt run │───►│ clawt validate │───►│ clawt merge │
76
+ │ AI develops │ │ Human reviews │ │ Merge to main │
77
+ │ on branch │ │ in main worktree│ │ Clean branch │
78
+ └─────────────┘ └──────────────────┘ └───────────────┘
79
+ ```
80
+
81
+ - **`validate`**: equivalent to Code Review — view diff, run tests in the main worktree (works perfectly with hot reload)
82
+ - **`cover`**: for simple fixes (styling, constants), edit directly in the main worktree and push changes back to the target worktree
83
+ - **`merge`**: merge to main, each merge maps to one clear feature/fix — clean Git history
84
+
7
85
  ## Installation
8
86
 
9
87
  ```bash
@@ -40,7 +118,7 @@ clawt status -i
40
118
  | `q` | Quit panel | — |
41
119
 
42
120
  Example:
43
- ![](https://p3.ssl.qhimg.com/d/inn/8a3779be2486/upload_screenshot_1772675658.png)
121
+ ![](https://p1.ssl.qhimg.com/d/inn/5c6aaa8400cf/upload_screenshot_1779703026.png)
44
122
  > All operations can also be executed via standalone commands — see "Command Reference" below.
45
123
 
46
124
  ## Command Reference
@@ -335,6 +413,7 @@ Configuration file is located at `~/.clawt/config.json`, auto-generated after in
335
413
 
336
414
  | Config Item | Default | Description |
337
415
  | ------ | ------ | ---- |
416
+ | `language` | `"en"` | Interface language: `en` (English) / `zh-CN` (Chinese) |
338
417
  | `autoDeleteBranch` | `false` | Auto-delete merged/removed branches |
339
418
  | `claudeCodeCommand` | `"claude"` | Claude Code CLI launch command (can be overridden per-project via `clawt init show`) |
340
419
  | `autoPullPush` | `false` | Auto pull/push after merge |
package/README.zh-CN.md CHANGED
@@ -1,9 +1,89 @@
1
1
  # Clawt
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/clawt.svg)](https://www.npmjs.com/package/clawt) [![GitHub](https://img.shields.io/badge/GHub-afk101%2Fclawt-blue)](https://github.com/afk101/clawt)
4
+
3
5
  [English](./README.md) | **[中文](./README.zh-CN.md)**
4
6
 
5
7
  基于 Git Worktree 并行执行多个 Claude Code Agent 任务,所有 Agent 的代码修改互不干扰。
6
8
 
9
+ > 当 AI 编程助手已经足够聪明,瓶颈就不再是"它能不能做",而是"你能同时让它做多少件事"。
10
+
11
+ ## 为什么需要 Clawt
12
+
13
+ Claude Code 可以独立完成需求开发、Bug 修复、代码重构等任务。但在实际项目开发中,我们往往面对的不是一个任务,而是一整个迭代周期里的**多个可以并行的独立任务**:
14
+
15
+ - 消息列表替换为虚拟列表
16
+ - 完成发布、部署弹窗
17
+ - 修复导航栏闪烁 bug
18
+ - ………………
19
+
20
+ 这是大多数开发者使用 Claude Code 的现状——**串行执行**:
21
+
22
+ ![串行模式时间轴](https://p5.ssl.qhimg.com/d/inn/20812850b163/2026-03-22-16-00-00-serial-timeline.png)
23
+
24
+ **3 个任务总耗时 ≈ 49.5 分钟**。最大的问题是:**Claude 在执行任务的时候,你完全在干等。**
25
+
26
+ 而且不推荐在同一个代码仓库里同时开始多个任务,因为 Git 工作区只有一个,文件可能互相冲突。
27
+
28
+ ## Clawt 的并行模式
29
+
30
+ 核心思路非常简单:
31
+
32
+ > **利用 Git Worktree 为每个任务创建独立的工作目录,让多个 Claude Code Agent 在各自隔离的分支上并行工作,互不干扰。**
33
+
34
+ 同样的 3 个任务,使用 Clawt 后:
35
+
36
+ ![并行模式时间轴](https://p5.ssl.qhimg.com/d/inn/737a5d53c9a0/2026-03-22-15-34-32-parallel-timeline.png)
37
+
38
+ **3 个任务总耗时 ≈ 26.5 分钟(并行执行,串行验证)**
39
+
40
+ | 模式 | 3 个任务 | 10 个任务 |
41
+ |------|---------|----------|
42
+ | 串行模式 | ~49.5 分钟 | ~165 分钟 |
43
+ | **Clawt 并行** | **~26.5 分钟** | **~65 分钟** |
44
+ | 效率提升 | **1.9×** | **2.5×** |
45
+
46
+ 一定范围内,**任务越多,并行的优势越大**。
47
+
48
+ 核心差别一目了然:**串行模式下,人在等 AI;并行模式下,AI 在等你。**
49
+
50
+ ## 为什么是 Git Worktree?
51
+
52
+ 多开几个终端、多 clone 几份代码不也能并行吗?可以,但 Git Worktree 是更优雅的方案:
53
+
54
+ | 方案 | 磁盘占用 | Git 历史 | 分支管理 | 合并难度 |
55
+ |------|---------|---------|---------|---------|
56
+ | 多次 `git clone` | 每份完整副本(几百 MB ~ 几 GB) | 各自独立,需要 remote 同步 | 各自独立,容易混乱 | 需要 push/pull 跨仓库操作 |
57
+ | **Git Worktree** | 共享 `.git` 对象库,增量极小 | **共享同一份** | **统一管理** | 本地分支直接 merge |
58
+
59
+ Git Worktree 是 Git 原生支持的机制(`git worktree add`),它允许在同一个仓库下创建多个工作目录,每个目录 checkout 不同的分支,但**共享同一个 `.git` 对象数据库**。磁盘占用低,分支切换和合并都是本地操作,速度极快。
60
+
61
+ ## 设计哲学
62
+
63
+ > **人做的事情:思考需求、写 Prompt、审查代码(可选)。AI 做的事情:写代码。用 Git Worktree 作为两者之间的隔离层。**
64
+
65
+ ![架构图](https://p0.ssl.qhimg.com/t11b673bcd66632b91c744dad9c.png)
66
+
67
+ > **Clawt 不修改、不替换、不包装 Claude Code 本身。它只是在更高一层管理"在哪里"以及"同时启动多少个" Claude Code。**
68
+
69
+ ![分层架构](https://p4.ssl.qhimg.com/d/inn/1e5b09fd7000/clawt-layer-architecture.png)
70
+
71
+ 你在每个 Worktree 里使用的,就是原汁原味的 Claude Code——同样的交互方式、同样的命令、同样的 CLAUDE.md、同样的 MCP 配置。Claude Code 的任何更新,Clawt 自动受益,无需适配。
72
+
73
+ Clawt 的工作流直接映射到标准 Git 开发规范:
74
+
75
+ ```
76
+ ┌─────────────┐ ┌──────────────────┐ ┌───────────────┐
77
+ │ clawt run │───►│ clawt validate │───►│ clawt merge │
78
+ │ AI 在分支上 │ │ 人在主 worktree │ │ 合入主分支 │
79
+ │ 独立开发 │ │ 审查变更 │ │ 清理分支 │
80
+ └─────────────┘ └──────────────────┘ └───────────────┘
81
+ ```
82
+
83
+ - **`validate`**:相当于 Code Review,在主 Worktree 中查看 diff、运行测试、确认质量(可以完美契合热更新)
84
+ - **`cover`**:如有简单修改(改样式、改常量等),直接在主 worktree 改完推回目标 worktree,形成"AI 写 → 人审 → 人修 → AI 继续"的协作循环
85
+ - **`merge`**:合入主分支,每个 merge 对应一个明确的功能或修复,Git 历史一目了然
86
+
7
87
  ## 安装
8
88
 
9
89
  ```bash
@@ -335,6 +415,7 @@ clawt alias remove l
335
415
 
336
416
  | 配置项 | 默认值 | 说明 |
337
417
  | ------ | ------ | ---- |
418
+ | `language` | `"en"` | 界面语言:`en`(英文) / `zh-CN`(中文) |
338
419
  | `autoDeleteBranch` | `false` | 自动删除已合并/已移除的分支 |
339
420
  | `claudeCodeCommand` | `"claude"` | Claude Code CLI 启动命令 |
340
421
  | `autoPullPush` | `false` | merge 后自动 pull/push |