@ronkovic/aad 0.3.9 → 0.5.0

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 (132) hide show
  1. package/README.md +332 -14
  2. package/package.json +6 -1
  3. package/src/__tests__/e2e/cleanup-e2e.test.ts +186 -0
  4. package/src/__tests__/e2e/dashboard-api-e2e.test.ts +87 -0
  5. package/src/__tests__/e2e/pipeline-e2e.test.ts +10 -68
  6. package/src/__tests__/e2e/resume-e2e.test.ts +9 -11
  7. package/src/__tests__/e2e/retry-e2e.test.ts +285 -0
  8. package/src/__tests__/e2e/status-e2e.test.ts +227 -0
  9. package/src/__tests__/e2e/tdd-pipeline-e2e.test.ts +360 -0
  10. package/src/__tests__/helpers/index.ts +6 -0
  11. package/src/__tests__/helpers/mock-claude-provider.ts +53 -0
  12. package/src/__tests__/helpers/mock-logger.ts +36 -0
  13. package/src/__tests__/helpers/wait-helpers.ts +34 -0
  14. package/src/__tests__/integration/pipeline.test.ts +3 -0
  15. package/src/modules/claude-provider/__tests__/claude-sdk-real-env.test.ts +1 -1
  16. package/src/modules/claude-provider/__tests__/claude-sdk.adapter.test.ts +6 -0
  17. package/src/modules/claude-provider/__tests__/provider-registry.test.ts +3 -0
  18. package/src/modules/cli/__tests__/cleanup.test.ts +73 -0
  19. package/src/modules/cli/__tests__/resume.test.ts +4 -0
  20. package/src/modules/cli/__tests__/run.test.ts +37 -0
  21. package/src/modules/cli/__tests__/status.test.ts +1 -0
  22. package/src/modules/cli/app.ts +2 -0
  23. package/src/modules/cli/commands/__tests__/task-dispatch-handler.test.ts +145 -0
  24. package/src/modules/cli/commands/cleanup.ts +26 -11
  25. package/src/modules/cli/commands/resume.ts +14 -8
  26. package/src/modules/cli/commands/run.ts +70 -8
  27. package/src/modules/cli/commands/task-dispatch-handler.ts +73 -3
  28. package/src/modules/dashboard/__tests__/api-graph.test.ts +332 -0
  29. package/src/modules/dashboard/__tests__/api-timeline.test.ts +461 -0
  30. package/src/modules/dashboard/routes/sse.ts +3 -2
  31. package/src/modules/dashboard/server.ts +1 -0
  32. package/src/modules/dashboard/services/sse-broadcaster.ts +29 -0
  33. package/src/modules/dashboard/ui/dashboard.html +640 -349
  34. package/src/modules/git-workspace/__tests__/branch-manager.test.ts +52 -0
  35. package/src/modules/git-workspace/__tests__/dependency-installer.test.ts +77 -0
  36. package/src/modules/git-workspace/__tests__/git-exec.test.ts +26 -0
  37. package/src/modules/git-workspace/__tests__/merge-service.test.ts +19 -0
  38. package/src/modules/git-workspace/__tests__/pr-manager.test.ts +80 -0
  39. package/src/modules/git-workspace/__tests__/template-copy.test.ts +189 -0
  40. package/src/modules/git-workspace/__tests__/worktree-cleanup.test.ts +29 -2
  41. package/src/modules/git-workspace/__tests__/worktree-manager.test.ts +64 -4
  42. package/src/modules/git-workspace/branch-manager.ts +24 -3
  43. package/src/modules/git-workspace/dependency-installer.ts +113 -0
  44. package/src/modules/git-workspace/git-exec.ts +3 -2
  45. package/src/modules/git-workspace/index.ts +10 -1
  46. package/src/modules/git-workspace/merge-service.ts +36 -2
  47. package/src/modules/git-workspace/pr-manager.ts +278 -0
  48. package/src/modules/git-workspace/template-copy.ts +302 -0
  49. package/src/modules/git-workspace/worktree-manager.ts +37 -11
  50. package/src/modules/planning/__tests__/planning-service.test.ts +3 -0
  51. package/src/modules/planning/__tests__/planning.service.test.ts +149 -0
  52. package/src/modules/planning/__tests__/project-detection.test.ts +7 -1
  53. package/src/modules/planning/planning.service.ts +16 -2
  54. package/src/modules/planning/project-detection.ts +4 -1
  55. package/src/modules/process-manager/__tests__/process-manager.test.ts +3 -0
  56. package/src/modules/process-manager/process-manager.ts +2 -1
  57. package/src/modules/task-execution/__tests__/executor.test.ts +496 -0
  58. package/src/modules/task-execution/__tests__/tester-verify.test.ts +4 -3
  59. package/src/modules/task-execution/executor.ts +163 -4
  60. package/src/modules/task-execution/phases/implementer-green.ts +22 -5
  61. package/src/modules/task-execution/phases/merge.ts +44 -2
  62. package/src/modules/task-execution/phases/tester-red.ts +22 -5
  63. package/src/modules/task-execution/phases/tester-verify.ts +22 -6
  64. package/src/modules/task-queue/dispatcher.ts +96 -3
  65. package/src/shared/__tests__/config.test.ts +30 -0
  66. package/src/shared/__tests__/events.test.ts +42 -16
  67. package/src/shared/__tests__/prerequisites.test.ts +176 -0
  68. package/src/shared/__tests__/shutdown-handler.test.ts +96 -0
  69. package/src/shared/config.ts +10 -0
  70. package/src/shared/events.ts +5 -0
  71. package/src/shared/memory-check.ts +2 -2
  72. package/src/shared/prerequisites.ts +190 -0
  73. package/src/shared/shutdown-handler.ts +12 -5
  74. package/src/shared/types.ts +25 -0
  75. package/templates/CLAUDE.md +122 -0
  76. package/templates/settings.json +117 -0
  77. package/src/modules/persistence/__tests__/.tmp-stores-test-81991/progress.json +0 -10
  78. package/src/modules/persistence/__tests__/.tmp-stores-test-81991/queue/completed/task-getall-2.json +0 -10
  79. package/src/modules/persistence/__tests__/.tmp-stores-test-81991/queue/pending/task-1.json +0 -13
  80. package/src/modules/persistence/__tests__/.tmp-stores-test-81991/queue/pending/task-getall-1.json +0 -10
  81. package/src/modules/persistence/__tests__/.tmp-stores-test-81991/queue/pending/task-status-change.json +0 -10
  82. package/src/modules/persistence/__tests__/.tmp-stores-test-81991/workers/worker-1.json +0 -5
  83. package/src/modules/persistence/__tests__/.tmp-stores-test-81991/workers/worker-2.json +0 -5
  84. package/src/modules/persistence/__tests__/.tmp-stores-test-82469/progress.json +0 -10
  85. package/src/modules/persistence/__tests__/.tmp-stores-test-82469/queue/completed/task-getall-2.json +0 -10
  86. package/src/modules/persistence/__tests__/.tmp-stores-test-82469/queue/pending/task-1.json +0 -13
  87. package/src/modules/persistence/__tests__/.tmp-stores-test-82469/queue/pending/task-getall-1.json +0 -10
  88. package/src/modules/persistence/__tests__/.tmp-stores-test-82469/queue/pending/task-status-change.json +0 -10
  89. package/src/modules/persistence/__tests__/.tmp-stores-test-82469/workers/worker-1.json +0 -5
  90. package/src/modules/persistence/__tests__/.tmp-stores-test-82469/workers/worker-2.json +0 -5
  91. package/src/modules/persistence/__tests__/.tmp-stores-test-85301/progress.json +0 -10
  92. package/src/modules/persistence/__tests__/.tmp-stores-test-85301/queue/completed/task-getall-2.json +0 -10
  93. package/src/modules/persistence/__tests__/.tmp-stores-test-85301/queue/pending/task-1.json +0 -13
  94. package/src/modules/persistence/__tests__/.tmp-stores-test-85301/queue/pending/task-getall-1.json +0 -10
  95. package/src/modules/persistence/__tests__/.tmp-stores-test-85301/queue/pending/task-status-change.json +0 -10
  96. package/src/modules/persistence/__tests__/.tmp-stores-test-85301/workers/worker-1.json +0 -5
  97. package/src/modules/persistence/__tests__/.tmp-stores-test-85301/workers/worker-2.json +0 -5
  98. package/src/modules/persistence/__tests__/.tmp-stores-test-85759/progress.json +0 -10
  99. package/src/modules/persistence/__tests__/.tmp-stores-test-85759/queue/completed/task-getall-2.json +0 -10
  100. package/src/modules/persistence/__tests__/.tmp-stores-test-85759/queue/pending/task-1.json +0 -13
  101. package/src/modules/persistence/__tests__/.tmp-stores-test-85759/queue/pending/task-getall-1.json +0 -10
  102. package/src/modules/persistence/__tests__/.tmp-stores-test-85759/queue/pending/task-status-change.json +0 -10
  103. package/src/modules/persistence/__tests__/.tmp-stores-test-85759/workers/worker-1.json +0 -5
  104. package/src/modules/persistence/__tests__/.tmp-stores-test-85759/workers/worker-2.json +0 -5
  105. package/src/modules/persistence/__tests__/.tmp-stores-test-86184/progress.json +0 -10
  106. package/src/modules/persistence/__tests__/.tmp-stores-test-86184/queue/completed/task-getall-2.json +0 -10
  107. package/src/modules/persistence/__tests__/.tmp-stores-test-86184/queue/pending/task-1.json +0 -13
  108. package/src/modules/persistence/__tests__/.tmp-stores-test-86184/queue/pending/task-getall-1.json +0 -10
  109. package/src/modules/persistence/__tests__/.tmp-stores-test-86184/queue/pending/task-status-change.json +0 -10
  110. package/src/modules/persistence/__tests__/.tmp-stores-test-86184/workers/worker-1.json +0 -5
  111. package/src/modules/persistence/__tests__/.tmp-stores-test-86184/workers/worker-2.json +0 -5
  112. package/src/modules/persistence/__tests__/.tmp-stores-test-88026/progress.json +0 -10
  113. package/src/modules/persistence/__tests__/.tmp-stores-test-88026/queue/completed/task-getall-2.json +0 -10
  114. package/src/modules/persistence/__tests__/.tmp-stores-test-88026/queue/pending/task-1.json +0 -13
  115. package/src/modules/persistence/__tests__/.tmp-stores-test-88026/queue/pending/task-getall-1.json +0 -10
  116. package/src/modules/persistence/__tests__/.tmp-stores-test-88026/queue/pending/task-status-change.json +0 -10
  117. package/src/modules/persistence/__tests__/.tmp-stores-test-88026/workers/worker-1.json +0 -5
  118. package/src/modules/persistence/__tests__/.tmp-stores-test-88026/workers/worker-2.json +0 -5
  119. package/src/modules/persistence/__tests__/.tmp-stores-test-89475/progress.json +0 -10
  120. package/src/modules/persistence/__tests__/.tmp-stores-test-89475/queue/completed/task-getall-2.json +0 -10
  121. package/src/modules/persistence/__tests__/.tmp-stores-test-89475/queue/pending/task-1.json +0 -13
  122. package/src/modules/persistence/__tests__/.tmp-stores-test-89475/queue/pending/task-getall-1.json +0 -10
  123. package/src/modules/persistence/__tests__/.tmp-stores-test-89475/queue/pending/task-status-change.json +0 -10
  124. package/src/modules/persistence/__tests__/.tmp-stores-test-89475/workers/worker-1.json +0 -5
  125. package/src/modules/persistence/__tests__/.tmp-stores-test-89475/workers/worker-2.json +0 -5
  126. package/src/modules/persistence/__tests__/.tmp-stores-test-89924/progress.json +0 -10
  127. package/src/modules/persistence/__tests__/.tmp-stores-test-89924/queue/completed/task-getall-2.json +0 -10
  128. package/src/modules/persistence/__tests__/.tmp-stores-test-89924/queue/pending/task-1.json +0 -13
  129. package/src/modules/persistence/__tests__/.tmp-stores-test-89924/queue/pending/task-getall-1.json +0 -10
  130. package/src/modules/persistence/__tests__/.tmp-stores-test-89924/queue/pending/task-status-change.json +0 -10
  131. package/src/modules/persistence/__tests__/.tmp-stores-test-89924/workers/worker-1.json +0 -5
  132. package/src/modules/persistence/__tests__/.tmp-stores-test-89924/workers/worker-2.json +0 -5
package/README.md CHANGED
@@ -6,13 +6,15 @@ TypeScript/Bun製マルチエージェント開発オーケストレーター。
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue)](https://www.typescriptlang.org/)
7
7
  [![Bun](https://img.shields.io/badge/Bun-1.2+-black)](https://bun.sh/)
8
8
  [![npm](https://img.shields.io/npm/v/@ronkovic/aad)](https://www.npmjs.com/package/@ronkovic/aad)
9
- [![Tests](https://img.shields.io/badge/tests-913%20passing-brightgreen)]()
10
- [![Version](https://img.shields.io/badge/version-0.3.7-orange)]()
9
+ [![Tests](https://img.shields.io/badge/tests-1037%20passing-brightgreen)]()
10
+ [![Version](https://img.shields.io/badge/version-0.5.0-orange)]()
11
11
 
12
12
  ## 主要機能
13
13
 
14
14
  - **マルチエージェント並列実行**: 複数のClaudeエージェントが独立したタスクを並列処理
15
15
  - **TDDパイプライン**: Red → Green → Verify → Review → Merge の自動化されたテスト駆動開発
16
+ - **スマート実行最適化**: テスト事前チェックで既に通過済みタスクを自動スキップ *(v0.5.0)*
17
+ - **実行メトリクス**: スキップ/実行タスク数を完了時に表示、効率を可視化 *(v0.5.0)*
16
18
  - **インタラクティブモード**: `aad` で対話型ウィザードを起動、認証・プロジェクト設定を簡単に *(v0.3.6)*
17
19
  - **セルフアップデート**: `aad update` で最新版に自動更新 *(v0.3.6)*
18
20
  - **スマートブランチ命名**: 要件ドキュメントから自動でconventional commit prefix付きブランチ名を生成 *(v0.3.7)*
@@ -21,10 +23,40 @@ TypeScript/Bun製マルチエージェント開発オーケストレーター。
21
23
  - **プラグインシステム**: カスタムアダプター・パイプラインステップの拡張
22
24
  - **Git Workspace管理**: タスクごとに独立したworktreeを自動作成・管理
23
25
  - **依存関係解決**: タスク間の依存関係を自動検出し、適切な順序で実行
24
- - **リアルタイム監視**: Webダッシュボードで進捗・ログをリアルタイム表示
26
+ - **リアルタイム監視**: TypeScript化されたWebダッシュボードで進捗・ログをリアルタイム表示 *(v0.5.0)*
25
27
  - **構造化ログ**: pinoによる構造化ログで詳細なトレーシングが可能
26
28
  - **メモリ安全機構**: OOMを防止する自動メモリゲート・シーケンシャルフォールバック
27
29
 
30
+ ## 🎉 v0.5.0の新機能
31
+
32
+ ### スマート実行最適化
33
+
34
+ 既にテストが通過しているタスクを自動でスキップする**pre-check機能**を追加しました。これにより、再実行時や部分的な変更時の実行時間を大幅に短縮できます。
35
+
36
+ - **デフォルトで有効**: `skipCompleted: true` (設定で無効化可能)
37
+ - **従来の動作に戻す**: `--strict-tdd` フラグで完全なTDDパイプラインを強制実行
38
+ - **メトリクス表示**: 実行完了時にスキップ/実行タスク数を表示
39
+
40
+ ```bash
41
+ # スマート実行(デフォルト)- テスト通過済みタスクを自動スキップ
42
+ aad run requirements.md
43
+
44
+ # 完全TDD実行 - 全タスクで完全なパイプラインを実行
45
+ aad run requirements.md --strict-tdd
46
+ ```
47
+
48
+ ### UX改善
49
+
50
+ - **Dashboard URL自動表示**: `aad run`/`aad resume`実行時にダッシュボードURLを自動表示
51
+ - **Resume案内表示**: Ctrl+C中断時に`aad resume <run-id>`コマンド例を表示
52
+ - **TypeScript化Dashboard**: React風コンポーネントでメンテナンス性向上
53
+
54
+ ### テストスイート強化
55
+
56
+ - **1037テスト全pass**: 30個の失敗を解消し、全テストが通過
57
+ - **E2Eテスト追加**: cleanup, TDD pipeline, dashboardの包括的E2Eテスト
58
+ - **CI強化**: E2Eジョブ分離、build matrix (ubuntu + macos)
59
+
28
60
  ## アーキテクチャ
29
61
 
30
62
  AADは12個のモジュールで構成された**Hexagonal-flavored Modular Monolith**です:
@@ -112,6 +144,233 @@ bun run dev
112
144
 
113
145
  > **macOS:** メモリ監視は `vm_stat` ベースで実装されています。Linux環境では `/proc/meminfo` を使用します。
114
146
 
147
+ ## コマンドリファレンス
148
+
149
+ ### グローバルオプション
150
+
151
+ 以下のオプションはすべてのコマンドで使用可能です:
152
+
153
+ | オプション | 説明 | デフォルト |
154
+ |----------|------|----------|
155
+ | `-w, --workers <数>` | 並列実行するワーカー数 | 2 |
156
+ | `--persist <モード>` | 永続化モード: `memory` (インメモリ) または `fs` (ファイルシステム) | `memory` |
157
+ | `--debug` | デバッグログを有効化 | `false` |
158
+ | `--no-dashboard` | Webダッシュボードを無効化 | `false` (有効) |
159
+ | `--provider <タイプ>` | デフォルトのClaudeプロバイダー: `cli` または `sdk` | `sdk` |
160
+
161
+ ### コマンド一覧
162
+
163
+ #### `aad` (引数なし)
164
+
165
+ インタラクティブモードを起動します。認証設定、プロジェクト設定、実行を対話的に行うウィザードです。
166
+
167
+ ```bash
168
+ aad
169
+ ```
170
+
171
+ **フロー:**
172
+ 1. **認証設定**: Claude API キーまたは OAuth トークンを設定
173
+ 2. **プロジェクト設定**: 要件ファイルとプロジェクトディレクトリを選択
174
+ 3. **実行**: ワーカー数とプロバイダーを選択して実行
175
+
176
+ ---
177
+
178
+ #### `aad run <requirements>`
179
+
180
+ 要件ファイルを元にタスクを計画・実行します。
181
+
182
+ ```bash
183
+ aad run requirements.md [オプション]
184
+ ```
185
+
186
+ **引数:**
187
+ - `<requirements>`: 要件ファイルのパス(必須)
188
+
189
+ **オプション:**
190
+
191
+ | オプション | 説明 | デフォルト |
192
+ |----------|------|----------|
193
+ | `-w, --workers <数>` | 並列実行するワーカー数 | 2 |
194
+ | `--persist <モード>` | 永続化モード: `memory` または `fs` | `memory` |
195
+ | `--debug` | デバッグログを有効化 | `false` |
196
+ | `--no-dashboard` | Webダッシュボードを無効化 | `false` |
197
+ | `--provider <タイプ>` | Claudeプロバイダー: `cli` または `sdk` | `sdk` |
198
+ | `--repos <パス>` | マルチリポジトリモード: カンマ区切りのリポジトリパス | - |
199
+ | `--strategy <戦略>` | マルチリポジトリ戦略: `independent` (独立) または `coordinated` (協調) | `independent` |
200
+ | `--plugins <パス>` | カスタムプラグインのパス(カンマ区切り) | - |
201
+ | `--keep-worktrees` | 完了後にworktreeとブランチを自動削除しない | `false` (自動削除) |
202
+ | `--dry-run` | タスク一覧のみ表示して実行しない(ドライラン) | `false` |
203
+ | `--strict-tdd` | 事前チェックをスキップし、常に完全なTDDパイプラインを実行 | `false` (最適化有効) |
204
+
205
+ **例:**
206
+
207
+ ```bash
208
+ # 基本的な実行
209
+ aad run requirements.md
210
+
211
+ # ワーカー数を指定
212
+ aad run requirements.md --workers 4
213
+
214
+ # CLIプロバイダーを使用
215
+ aad run requirements.md --provider cli
216
+
217
+ # ダッシュボードを無効化
218
+ aad run requirements.md --no-dashboard
219
+
220
+ # ドライラン(タスク一覧のみ表示)
221
+ aad run requirements.md --dry-run
222
+
223
+ # worktreeを残す(手動クリーンアップが必要)
224
+ aad run requirements.md --keep-worktrees
225
+
226
+ # デバッグモード
227
+ aad run requirements.md --debug
228
+
229
+ # 完全なTDDパイプライン(最適化無効)
230
+ aad run requirements.md --strict-tdd
231
+
232
+ # マルチリポジトリモード
233
+ aad run requirements.md --repos /path/to/repo1,/path/to/repo2 --strategy coordinated
234
+ ```
235
+
236
+ ---
237
+
238
+ #### `aad resume <runId>`
239
+
240
+ 中断された実行を再開します。
241
+
242
+ ```bash
243
+ aad resume <runId>
244
+ ```
245
+
246
+ **引数:**
247
+ - `<runId>`: 再開する実行のID(必須)
248
+
249
+ **例:**
250
+
251
+ ```bash
252
+ # 特定のrunを再開
253
+ aad resume abc-123-def-456
254
+
255
+ # runIdは `aad status` で確認可能
256
+ aad status
257
+ aad resume <表示されたrunId>
258
+ ```
259
+
260
+ **動作:**
261
+ - `running` または `failed` 状態のタスクを `pending` にリセット
262
+ - ワーカーを再初期化してタスクを再実行
263
+ - 完了済みのタスクはスキップ
264
+
265
+ ---
266
+
267
+ #### `aad status [run-id]`
268
+
269
+ 実行の進捗とタスクステータスを表示します。
270
+
271
+ ```bash
272
+ aad status [run-id]
273
+ ```
274
+
275
+ **引数:**
276
+ - `[run-id]`: 確認する実行のID(省略時は最新の実行を表示)
277
+
278
+ **例:**
279
+
280
+ ```bash
281
+ # 最新の実行を表示
282
+ aad status
283
+
284
+ # 特定のrunを表示
285
+ aad status abc-123-def-456
286
+ ```
287
+
288
+ **表示内容:**
289
+ - 実行ID、親ブランチ、開始時刻
290
+ - タスク総数、pending/running/completed/failed の数
291
+ - 各タスクの詳細(タスクID、タイトル、ステータス、ワーカーID)
292
+
293
+ ---
294
+
295
+ #### `aad cleanup [run-id]`
296
+
297
+ worktreeと孤立したブランチをクリーンアップします。
298
+
299
+ ```bash
300
+ aad cleanup [run-id] [オプション]
301
+ ```
302
+
303
+ **引数:**
304
+ - `[run-id]`: クリーンアップする実行のID(省略時はすべてのAAD worktreeを対象)
305
+
306
+ **オプション:**
307
+
308
+ | オプション | 説明 | デフォルト |
309
+ |----------|------|----------|
310
+ | `-f, --force` | 変更があるworktreeも強制削除、parentブランチも削除 | `false` |
311
+
312
+ **例:**
313
+
314
+ ```bash
315
+ # すべてのAAD worktreeをクリーンアップ(parentは保護)
316
+ aad cleanup
317
+
318
+ # 特定のrunのみクリーンアップ
319
+ aad cleanup abc-123-def-456
320
+
321
+ # 強制削除(parentブランチも削除、変更も無視)
322
+ aad cleanup --force
323
+ aad cleanup abc-123-def-456 --force
324
+ ```
325
+
326
+ **動作:**
327
+ - デフォルトではparentブランチとworktreeを保護(レビュー用)
328
+ - `--force` を指定すると parent を含むすべてのworktreeとブランチを削除
329
+ - 孤立したworktreeは自動的にprune
330
+
331
+ ---
332
+
333
+ #### `aad update`
334
+
335
+ AADを最新バージョンに更新します。
336
+
337
+ ```bash
338
+ aad update [オプション]
339
+ ```
340
+
341
+ **オプション:**
342
+
343
+ | オプション | 説明 | デフォルト |
344
+ |----------|------|----------|
345
+ | `--check` | 更新の有無のみ確認(インストールしない) | `false` |
346
+
347
+ **例:**
348
+
349
+ ```bash
350
+ # 最新版に更新
351
+ aad update
352
+
353
+ # 更新の有無のみ確認
354
+ aad update --check
355
+ ```
356
+
357
+ **動作:**
358
+ - 現在のバージョンと最新バージョンをnpmレジストリから取得して比較
359
+ - `bun`使用時は `bunx` キャッシュをクリア(次回実行時に最新版を使用)
360
+ - `npm`使用時は `npm install -g @ronkovic/aad@latest` を実行
361
+
362
+ ---
363
+
364
+ #### `aad interactive`
365
+
366
+ インタラクティブモードを明示的に起動します(`aad` のみと同じ)。
367
+
368
+ ```bash
369
+ aad interactive
370
+ ```
371
+
372
+ ---
373
+
115
374
  ## クイックスタート
116
375
 
117
376
  ### 1. 要件ファイルの作成
@@ -136,6 +395,9 @@ bun run dev
136
395
 
137
396
  ```bash
138
397
  # 直接実行
398
+ aad run requirements.md
399
+
400
+ # ワーカー数を指定
139
401
  aad run requirements.md --workers 4
140
402
 
141
403
  # インタラクティブモード(対話型ウィザード)
@@ -149,31 +411,62 @@ AADが自動的に:
149
411
  4. ワーカーで並列実行 (TDD: テスト作成 → 実装 → 検証 → レビュー)
150
412
  5. 親ブランチへのマージ
151
413
 
414
+ **よく使うオプション:**
415
+ - `--workers <数>`: 並列ワーカー数(デフォルト: 2)
416
+ - `--provider cli`: Claude CLIを使用(デフォルトは SDK)
417
+ - `--dry-run`: タスク一覧のみ表示(実行しない)
418
+ - `--keep-worktrees`: 完了後もworktreeを削除しない
419
+ - `--debug`: デバッグログを有効化
420
+
421
+ 詳細は [コマンドリファレンス](#コマンドリファレンス) をご覧ください。
422
+
152
423
  ### 3. 進捗確認・管理
153
424
 
154
425
  ```bash
155
- # ステータス確認
156
- aad status [run_id]
426
+ # ステータス確認(最新の実行)
427
+ aad status
157
428
 
158
- # 実行の再開
429
+ # 特定の実行のステータス確認
430
+ aad status <run_id>
431
+
432
+ # 中断された実行の再開
159
433
  aad resume <run_id>
160
434
 
161
- # worktreeのクリーンアップ
162
- aad cleanup [run_id] [--force]
435
+ # worktreeのクリーンアップ(parentは保護)
436
+ aad cleanup
437
+
438
+ # 特定のrunのクリーンアップ
439
+ aad cleanup <run_id>
440
+
441
+ # 強制クリーンアップ(parentも削除)
442
+ aad cleanup --force
163
443
 
164
444
  # バージョン確認・アップデート
165
- aad update [--check]
445
+ aad update
446
+ aad update --check
166
447
  ```
167
448
 
449
+ すべてのコマンドとオプションの詳細は [コマンドリファレンス](#コマンドリファレンス) をご覧ください。
450
+
168
451
  ### 4. Webダッシュボード
169
452
 
170
453
  ダッシュボードはデフォルトで有効です。`http://localhost:7333` でリアルタイムの進捗・ログ・依存グラフを確認できます。
171
454
 
172
- 無効にする場合:
455
+ **ダッシュボード機能:**
456
+ - タスク進捗のリアルタイム可視化
457
+ - ワーカーステータス監視
458
+ - タスク依存グラフ (DAG)
459
+ - 構造化ログのストリーミング表示
460
+ - タスクタイムライン (Gantt)
461
+
462
+ **無効にする場合:**
173
463
  ```bash
174
- aad run requirements.md --workers 4 --no-dashboard
464
+ aad run requirements.md --no-dashboard
175
465
  ```
176
466
 
467
+ **ポート変更:**
468
+ 設定ファイル `.aad/config.json` で `dashboard.port` を変更できます。
469
+
177
470
  ## 開発ガイド
178
471
 
179
472
  ### 環境セットアップ
@@ -254,7 +547,9 @@ describe("MyModule", () => {
254
547
  "dashboard": {
255
548
  "enabled": true,
256
549
  "port": 7333
257
- }
550
+ },
551
+ "skipCompleted": true,
552
+ "strictTdd": false
258
553
  }
259
554
  ```
260
555
 
@@ -308,16 +603,22 @@ aad run requirements.md --provider cli
308
603
  ```bash
309
604
  # 構造化ログの確認
310
605
  cat .aad/docs/<run_id>/logs/structured.jsonl | bunx pino-pretty
606
+
607
+ # デバッグモードで実行
608
+ aad run requirements.md --debug
311
609
  ```
312
610
 
313
611
  ### Worktreeが残っている
314
612
 
315
613
  ```bash
316
- # 全AAD worktreeをクリーンアップ
614
+ # 全AAD worktreeをクリーンアップ(parentは保護)
317
615
  aad cleanup
318
616
 
319
617
  # 特定のrunのみ
320
618
  aad cleanup <run_id>
619
+
620
+ # parentも含めて強制削除
621
+ aad cleanup --force
321
622
  ```
322
623
 
323
624
  ### タスクがスタックした
@@ -326,10 +627,27 @@ aad cleanup <run_id>
326
627
  # ステータス確認
327
628
  aad status <run_id>
328
629
 
329
- # 強制クリーンアップ
630
+ # 実行を再開
631
+ aad resume <run_id>
632
+
633
+ # 強制クリーンアップして最初からやり直し
330
634
  aad cleanup <run_id> --force
635
+ aad run requirements.md
331
636
  ```
332
637
 
638
+ ### メモリ不足エラー
639
+
640
+ AADは自動的にメモリを監視し、不足時にワーカー数を削減します。手動でワーカー数を減らすこともできます:
641
+
642
+ ```bash
643
+ # ワーカー数を1に減らす
644
+ aad run requirements.md --workers 1
645
+ ```
646
+
647
+ ### コマンドオプションの詳細
648
+
649
+ すべてのコマンドとオプションの詳細は [コマンドリファレンス](#コマンドリファレンス) をご覧ください。
650
+
333
651
  ## ライセンス
334
652
 
335
653
  [MIT License](LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronkovic/aad",
3
- "version": "0.3.9",
3
+ "version": "0.5.0",
4
4
  "description": "Autonomous Agent Development Orchestrator - Multi-agent TDD pipeline powered by Claude",
5
5
  "module": "src/main.ts",
6
6
  "type": "module",
@@ -11,6 +11,7 @@
11
11
  "files": [
12
12
  "bin",
13
13
  "src",
14
+ "templates",
14
15
  "README.md",
15
16
  "LICENSE",
16
17
  "tsconfig.json"
@@ -34,6 +35,10 @@
34
35
  "test:coverage:report": "bun test --coverage --coverage-reporter=html",
35
36
  "typecheck": "tsc --noEmit",
36
37
  "lint": "eslint src/",
38
+ "ci": "bash scripts/ci-local.sh",
39
+ "ci:lint": "bash scripts/ci-local.sh --lint",
40
+ "ci:test": "bash scripts/ci-local.sh --test",
41
+ "ci:build": "bash scripts/ci-local.sh --build",
37
42
  "prepublishOnly": "bun run typecheck && bun run lint && bun test"
38
43
  },
39
44
  "dependencies": {
@@ -0,0 +1,186 @@
1
+ /**
2
+ * E2E Test: Cleanup command (worktree removal)
3
+ */
4
+ import { describe, test, expect } from "bun:test";
5
+ import { cleanupWorktrees } from "../../modules/cli/commands/cleanup";
6
+ import { createMockLogger } from "../helpers/mock-logger";
7
+ import type { App } from "../../modules/cli/app";
8
+
9
+ interface WorktreeInfo {
10
+ path: string;
11
+ branch: string;
12
+ head: string;
13
+ }
14
+
15
+ describe("E2E Cleanup Command", () => {
16
+ test("cleanup lists all AAD worktrees", async () => {
17
+ const mockWorktrees: WorktreeInfo[] = [
18
+ { path: "/project/.aad/worktrees/run-1/task-1", branch: "aad/task-1", head: "abc123" },
19
+ { path: "/project/.aad/worktrees/run-1/task-2", branch: "aad/task-2", head: "def456" },
20
+ { path: "/project/.aad/worktrees/run-1/parent-main", branch: "main", head: "ghi789" },
21
+ ];
22
+
23
+ let listedWorktrees: WorktreeInfo[] = [];
24
+
25
+ const app = {
26
+ logger: createMockLogger(),
27
+ worktreeManager: {
28
+ async listWorktrees() {
29
+ listedWorktrees = mockWorktrees;
30
+ return mockWorktrees;
31
+ },
32
+ async removeWorktree() {},
33
+ async pruneWorktrees() {},
34
+ },
35
+ branchManager: {
36
+ async cleanupOrphanBranches() {
37
+ return [];
38
+ },
39
+ },
40
+ } as unknown as App;
41
+
42
+ await cleanupWorktrees(app);
43
+
44
+ // Verify worktrees were listed
45
+ expect(listedWorktrees.length).toBe(3);
46
+ expect(listedWorktrees.some((wt) => wt.path.includes("task-1"))).toBe(true);
47
+ }, 15_000);
48
+
49
+ test("cleanup removes specified worktrees", async () => {
50
+ const mockWorktrees: WorktreeInfo[] = [
51
+ { path: "/project/.aad/worktrees/run-1/task-1", branch: "aad/task-1", head: "abc123" },
52
+ { path: "/project/.aad/worktrees/run-1/task-2", branch: "aad/task-2", head: "def456" },
53
+ ];
54
+
55
+ const removedPaths: string[] = [];
56
+
57
+ const app = {
58
+ logger: createMockLogger(),
59
+ worktreeManager: {
60
+ async listWorktrees() {
61
+ return mockWorktrees;
62
+ },
63
+ async removeWorktree(path: string) {
64
+ removedPaths.push(path);
65
+ },
66
+ async pruneWorktrees() {},
67
+ },
68
+ branchManager: {
69
+ async cleanupOrphanBranches() {
70
+ return [];
71
+ },
72
+ },
73
+ } as unknown as App;
74
+
75
+ await cleanupWorktrees(app);
76
+
77
+ // Verify worktrees were removed
78
+ expect(removedPaths.length).toBe(2);
79
+ expect(removedPaths.some((p) => p.includes("task-1"))).toBe(true);
80
+ expect(removedPaths.some((p) => p.includes("task-2"))).toBe(true);
81
+ }, 15_000);
82
+
83
+ test("cleanup with --all flag removes all AAD worktrees", async () => {
84
+ const mockWorktrees: WorktreeInfo[] = [
85
+ { path: "/project/.aad/worktrees/run-1/task-1", branch: "aad/task-1", head: "abc123" },
86
+ { path: "/project/.aad/worktrees/run-1/parent-main", branch: "main", head: "def456" },
87
+ ];
88
+
89
+ const removedPaths: string[] = [];
90
+
91
+ const app = {
92
+ logger: createMockLogger(),
93
+ worktreeManager: {
94
+ async listWorktrees() {
95
+ return mockWorktrees;
96
+ },
97
+ async removeWorktree(path: string) {
98
+ removedPaths.push(path);
99
+ },
100
+ async pruneWorktrees() {},
101
+ },
102
+ branchManager: {
103
+ async cleanupOrphanBranches() {
104
+ return [];
105
+ },
106
+ },
107
+ } as unknown as App;
108
+
109
+ // force=true should include parent worktrees
110
+ await cleanupWorktrees(app, undefined, true);
111
+
112
+ // Verify all worktrees including parent were removed
113
+ expect(removedPaths.length).toBe(2);
114
+ expect(removedPaths.some((p) => p.includes("task-1"))).toBe(true);
115
+ expect(removedPaths.some((p) => p.includes("parent-main"))).toBe(true);
116
+ }, 15_000);
117
+
118
+ test("cleanup skips non-AAD worktrees", async () => {
119
+ const mockWorktrees: WorktreeInfo[] = [
120
+ { path: "/project/.aad/worktrees/run-1/task-1", branch: "aad/task-1", head: "abc123" },
121
+ { path: "/some/other/worktree", branch: "feature/xyz", head: "def456" },
122
+ ];
123
+
124
+ const removedPaths: string[] = [];
125
+
126
+ const app = {
127
+ logger: createMockLogger(),
128
+ worktreeManager: {
129
+ async listWorktrees() {
130
+ return mockWorktrees;
131
+ },
132
+ async removeWorktree(path: string) {
133
+ removedPaths.push(path);
134
+ },
135
+ async pruneWorktrees() {},
136
+ },
137
+ branchManager: {
138
+ async cleanupOrphanBranches() {
139
+ return [];
140
+ },
141
+ },
142
+ } as unknown as App;
143
+
144
+ await cleanupWorktrees(app);
145
+
146
+ // Verify only AAD worktree was removed
147
+ expect(removedPaths.length).toBe(1);
148
+ expect(removedPaths[0]).toContain(".aad/worktrees");
149
+ expect(removedPaths[0]).not.toContain("/some/other/worktree");
150
+ }, 15_000);
151
+
152
+ test("cleanup handles worktree not found gracefully", async () => {
153
+ const mockWorktrees: WorktreeInfo[] = [
154
+ { path: "/project/.aad/worktrees/run-1/task-1", branch: "aad/task-1", head: "abc123" },
155
+ ];
156
+
157
+ let errorThrown = false;
158
+
159
+ const app = {
160
+ logger: createMockLogger(),
161
+ worktreeManager: {
162
+ async listWorktrees() {
163
+ return mockWorktrees;
164
+ },
165
+ async removeWorktree() {
166
+ throw new Error("worktree not found");
167
+ },
168
+ async pruneWorktrees() {},
169
+ },
170
+ branchManager: {
171
+ async cleanupOrphanBranches() {
172
+ return [];
173
+ },
174
+ },
175
+ } as unknown as App;
176
+
177
+ try {
178
+ await cleanupWorktrees(app);
179
+ } catch {
180
+ errorThrown = true;
181
+ }
182
+
183
+ // Should not throw - errors are caught and logged
184
+ expect(errorThrown).toBe(false);
185
+ }, 15_000);
186
+ });