@sk8metal/michi-cli 0.8.6 → 0.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 (35) hide show
  1. package/CHANGELOG.md +95 -1
  2. package/README.md +4 -4
  3. package/dist/scripts/config/config-schema.d.ts +3 -0
  4. package/dist/scripts/config/config-schema.d.ts.map +1 -1
  5. package/dist/scripts/config/config-schema.js +18 -0
  6. package/dist/scripts/config/config-schema.js.map +1 -1
  7. package/dist/scripts/constants/environments.js +3 -3
  8. package/dist/scripts/constants/environments.js.map +1 -1
  9. package/dist/scripts/utils/multi-repo-validator.d.ts +20 -1
  10. package/dist/scripts/utils/multi-repo-validator.d.ts.map +1 -1
  11. package/dist/scripts/utils/multi-repo-validator.js +124 -1
  12. package/dist/scripts/utils/multi-repo-validator.js.map +1 -1
  13. package/docs/michi-development/testing/manual-verification-other-tools.md +10 -8
  14. package/docs/user-guide/getting-started/new-repository-setup.md +4 -3
  15. package/docs/user-guide/guides/migration-guide.md +138 -0
  16. package/docs/user-guide/guides/multi-repo-guide.md +573 -10
  17. package/docs/user-guide/guides/workflow.md +4 -14
  18. package/docs/user-guide/hands-on/workflow-walkthrough.md +173 -4
  19. package/package.json +1 -1
  20. package/scripts/__tests__/multi-repo-config-schema.test.ts +106 -0
  21. package/scripts/__tests__/multi-repo-validator.test.ts +229 -1
  22. package/scripts/config/config-schema.ts +20 -0
  23. package/scripts/constants/__tests__/environments.test.ts +3 -3
  24. package/scripts/constants/environments.ts +3 -3
  25. package/scripts/utils/multi-repo-validator.ts +160 -1
  26. package/templates/claude/agents/mermaid-validator/AGENT.md +257 -0
  27. package/templates/claude/commands/michi-multi-repo/impl-all.md +264 -0
  28. package/templates/claude/commands/michi-multi-repo/propagate-specs.md +271 -0
  29. package/templates/claude/commands/{michi_multi_repo → michi-multi-repo}/spec-design.md +69 -6
  30. package/templates/claude/commands/{michi_multi_repo → michi-multi-repo}/spec-init.md +6 -6
  31. package/templates/claude/commands/{michi_multi_repo → michi-multi-repo}/spec-requirements.md +2 -2
  32. package/templates/claude/commands/michi-multi-repo/spec-review.md +247 -0
  33. package/templates/claude/skills/mermaid-validator/SKILL.md +261 -0
  34. package/templates/claude-agent/agents/cross-repo-reviewer.md +194 -0
  35. package/templates/claude-agent/agents/repo-spec-executor.md +113 -0
@@ -2,9 +2,14 @@
2
2
  * multi-repo-validator.ts
3
3
  * Multi-Repo機能のバリデーションユーティリティ
4
4
  *
5
- * プロジェクト名、JIRAキー、リポジトリURLのバリデーションとセキュリティチェックを行います。
5
+ * プロジェクト名、JIRAキー、リポジトリURL、localPathのバリデーションとセキュリティチェックを行います。
6
6
  */
7
7
 
8
+ import * as fs from 'fs';
9
+ import * as path from 'path';
10
+ import { execSync } from 'child_process';
11
+ import type { Repository } from '../config/config-schema.js';
12
+
8
13
  /**
9
14
  * バリデーション結果
10
15
  */
@@ -14,6 +19,17 @@ export interface ValidationResult {
14
19
  warnings: string[];
15
20
  }
16
21
 
22
+ /**
23
+ * LocalPathバリデーション結果(詳細情報付き)
24
+ */
25
+ export interface LocalPathValidationResult extends ValidationResult {
26
+ exists: boolean;
27
+ isGitRepository: boolean;
28
+ currentBranch: string | null;
29
+ branchMatches: boolean;
30
+ hasUncommittedChanges: boolean;
31
+ }
32
+
17
33
  /**
18
34
  * プロジェクト名のバリデーション
19
35
  * セキュリティ対策: パストラバーサル、相対パス、制御文字をチェック
@@ -139,3 +155,146 @@ export function validateRepositoryUrl(url: string): ValidationResult {
139
155
  warnings,
140
156
  };
141
157
  }
158
+
159
+ /**
160
+ * LocalPathのバリデーション
161
+ * ディレクトリ存在、Gitリポジトリ、ブランチ、未コミット変更をチェック
162
+ *
163
+ * @param repository - リポジトリ設定
164
+ * @returns バリデーション結果(詳細情報付き)
165
+ */
166
+ export function validateLocalPath(
167
+ repository: Repository,
168
+ ): LocalPathValidationResult {
169
+ const errors: string[] = [];
170
+ const warnings: string[] = [];
171
+
172
+ // 初期値
173
+ let exists = false;
174
+ let isGitRepository = false;
175
+ let currentBranch: string | null = null;
176
+ let branchMatches = false;
177
+ let hasUncommittedChanges = false;
178
+
179
+ // 1. localPath設定確認
180
+ if (!repository.localPath) {
181
+ warnings.push(
182
+ `Repository '${repository.name}' does not have localPath configured`,
183
+ );
184
+ return {
185
+ isValid: false,
186
+ errors,
187
+ warnings,
188
+ exists,
189
+ isGitRepository,
190
+ currentBranch,
191
+ branchMatches,
192
+ hasUncommittedChanges,
193
+ };
194
+ }
195
+
196
+ const localPath = repository.localPath;
197
+
198
+ // 2. ディレクトリ存在確認
199
+ try {
200
+ const stats = fs.statSync(localPath);
201
+ if (!stats.isDirectory()) {
202
+ errors.push(
203
+ `localPath '${localPath}' exists but is not a directory`,
204
+ );
205
+ return {
206
+ isValid: false,
207
+ errors,
208
+ warnings,
209
+ exists: true,
210
+ isGitRepository,
211
+ currentBranch,
212
+ branchMatches,
213
+ hasUncommittedChanges,
214
+ };
215
+ }
216
+ exists = true;
217
+ } catch (_error) {
218
+ errors.push(`localPath '${localPath}' does not exist`);
219
+ return {
220
+ isValid: false,
221
+ errors,
222
+ warnings,
223
+ exists,
224
+ isGitRepository,
225
+ currentBranch,
226
+ branchMatches,
227
+ hasUncommittedChanges,
228
+ };
229
+ }
230
+
231
+ // 3. Gitリポジトリ確認
232
+ const gitDir = path.join(localPath, '.git');
233
+ if (!fs.existsSync(gitDir)) {
234
+ errors.push(
235
+ `localPath '${localPath}' is not a Git repository (no .git directory)`,
236
+ );
237
+ return {
238
+ isValid: false,
239
+ errors,
240
+ warnings,
241
+ exists,
242
+ isGitRepository,
243
+ currentBranch,
244
+ branchMatches,
245
+ hasUncommittedChanges,
246
+ };
247
+ }
248
+ isGitRepository = true;
249
+
250
+ // 4. ブランチ確認
251
+ try {
252
+ currentBranch = execSync('git branch --show-current', {
253
+ cwd: localPath,
254
+ encoding: 'utf-8',
255
+ }).trim();
256
+
257
+ if (currentBranch !== repository.branch) {
258
+ warnings.push(
259
+ `Current branch '${currentBranch}' does not match configured branch '${repository.branch}'`,
260
+ );
261
+ branchMatches = false;
262
+ } else {
263
+ branchMatches = true;
264
+ }
265
+ } catch (error) {
266
+ warnings.push(
267
+ `Failed to get current branch: ${error instanceof Error ? error.message : String(error)}`,
268
+ );
269
+ }
270
+
271
+ // 5. 未コミット変更確認
272
+ try {
273
+ const statusOutput = execSync('git status --porcelain', {
274
+ cwd: localPath,
275
+ encoding: 'utf-8',
276
+ }).trim();
277
+
278
+ if (statusOutput.length > 0) {
279
+ warnings.push(
280
+ `Repository '${repository.name}' has uncommitted changes`,
281
+ );
282
+ hasUncommittedChanges = true;
283
+ }
284
+ } catch (error) {
285
+ warnings.push(
286
+ `Failed to check uncommitted changes: ${error instanceof Error ? error.message : String(error)}`,
287
+ );
288
+ }
289
+
290
+ return {
291
+ isValid: errors.length === 0,
292
+ errors,
293
+ warnings,
294
+ exists,
295
+ isGitRepository,
296
+ currentBranch,
297
+ branchMatches,
298
+ hasUncommittedChanges,
299
+ };
300
+ }
@@ -0,0 +1,257 @@
1
+ ---
2
+ name: mermaid-validator
3
+ description: |
4
+ Mermaid図の構文検証と自動修正を行う実行エージェント。
5
+ architecture.md生成時やドキュメント編集時に PROACTIVELY 使用してください。
6
+ allowed-tools: Bash, Read, Grep, Glob, Edit, Write, WebFetch
7
+ ---
8
+
9
+ # Mermaid Validator Agent
10
+
11
+ ## 目的
12
+
13
+ Markdownファイル内のMermaid図を検証し、構文エラーを検出して自動修正する。
14
+
15
+ ## 前提条件
16
+
17
+ - Mermaid図を含むMarkdownファイルが存在
18
+ - 検証対象: `docs/**/*.md`, `*.md`
19
+
20
+ ## 参照すべきスキル
21
+
22
+ 実行前に必ず `.claude/skills/mermaid-validator/SKILL.md` を確認し、そのガイドラインに従ってMermaid図を検証してください。
23
+
24
+ ## 実行フロー
25
+
26
+ ### Step 1: Mermaid図の検出
27
+
28
+ ```bash
29
+ # Mermaid図を含むMarkdownファイルを検索
30
+ echo "=== Mermaid diagrams found in: ==="
31
+ find . -name "*.md" -exec grep -l '```mermaid' {} \; | head -20
32
+ ```
33
+
34
+ ### Step 2: Mermaid図の抽出と検証
35
+
36
+ 各ファイルから Mermaid ブロックを抽出し、構文チェックを実行:
37
+
38
+ ```bash
39
+ # ファイルからMermaid図を抽出
40
+ FILE="docs/michi/project/overview/architecture.md"
41
+
42
+ # Mermaidブロックを抽出
43
+ sed -n '/```mermaid/,/```/p' "$FILE" > /tmp/extracted-mermaid.txt
44
+
45
+ # 抽出結果を確認
46
+ cat /tmp/extracted-mermaid.txt
47
+ ```
48
+
49
+ ### Step 3: 構文エラーの検出
50
+
51
+ 以下の項目をチェック:
52
+
53
+ #### 3.1 C4モデルの検証
54
+
55
+ ```bash
56
+ # C4モデルの構文チェック
57
+ grep -E 'C4(Context|Container|Component)' /tmp/extracted-mermaid.txt
58
+
59
+ # タイトル行のチェック(コロンが含まれていないか)
60
+ grep -E '^\s*title:' /tmp/extracted-mermaid.txt && echo "ERROR: 'title:' should be 'title' (no colon)"
61
+
62
+ # Rel()の引数チェック(4つの引数が必須)
63
+ grep -E 'Rel\(' /tmp/extracted-mermaid.txt | grep -v 'Rel([^,]+,[^,]+,[^,]+,[^,]+)' && echo "WARNING: Rel() requires 4 arguments"
64
+ ```
65
+
66
+ #### 3.2 シーケンス図の検証
67
+
68
+ ```bash
69
+ # シーケンス図の矢印記法チェック
70
+ grep -E 'sequenceDiagram' /tmp/extracted-mermaid.txt && {
71
+ # 不正な矢印記法を検出(->, -->, -x ではなく ->>, -->>, ->> を使用すべき)
72
+ grep -E '([A-Za-z]+)->([A-Za-z]+):' /tmp/extracted-mermaid.txt && echo "WARNING: Use '->' instead of '->'"
73
+ }
74
+ ```
75
+
76
+ #### 3.3 グラフの検証
77
+
78
+ ```bash
79
+ # サブグラフのインデントチェック
80
+ grep -E 'subgraph' /tmp/extracted-mermaid.txt && {
81
+ # サブグラフの直後の行がインデントされていない場合
82
+ grep -A 1 'subgraph' /tmp/extracted-mermaid.txt | grep -v '^\s\+' && echo "WARNING: Subgraph content should be indented"
83
+ }
84
+ ```
85
+
86
+ #### 3.4 ER図の検証
87
+
88
+ ```bash
89
+ # ER図のリレーションシップ記法チェック
90
+ grep -E 'erDiagram' /tmp/extracted-mermaid.txt && {
91
+ # 不正なリレーションシップ記法を検出
92
+ grep -E '([A-Z_]+)\s*->\s*([A-Z_]+)' /tmp/extracted-mermaid.txt && echo "ERROR: Use proper ER relationship notation (e.g., ||--o{)"
93
+ }
94
+ ```
95
+
96
+ ### Step 4: 自動修正
97
+
98
+ 検出されたエラーを自動修正:
99
+
100
+ #### 修正ルール1: C4モデルのタイトル修正
101
+
102
+ ```bash
103
+ # "title: System Context" → "title System Context"
104
+ sed -i 's/^\s*title:\s*/ title /g' "$FILE"
105
+ ```
106
+
107
+ #### 修正ルール2: シーケンス図の矢印記法修正
108
+
109
+ ```bash
110
+ # "->" → "->>"(同期呼び出し)
111
+ # ただし、既に "-->" の場合は修正しない
112
+ sed -i 's/\([A-Za-z]\+\)->\([A-Za-z]\+\):/\1->>\2:/g' "$FILE"
113
+ ```
114
+
115
+ #### 修正ルール3: サブグラフのインデント修正
116
+
117
+ ```bash
118
+ # サブグラフ内のインデントを自動追加(簡易版)
119
+ # 実際の実装では、構文解析が必要
120
+ # ここではガイダンスのみ提供
121
+ ```
122
+
123
+ #### 修正ルール4: ER図のリレーションシップ記法修正
124
+
125
+ ```bash
126
+ # 簡易的な修正例(実際にはコンテキストに応じて調整が必要)
127
+ # 1対多の場合
128
+ sed -i 's/\([A-Z_]\+\)\s*->\s*\([A-Z_]\+\)/\1 ||--o{ \2/g' "$FILE"
129
+ ```
130
+
131
+ ### Step 5: 検証レポート出力
132
+
133
+ 修正内容をレポート形式で出力:
134
+
135
+ ```markdown
136
+ # Mermaid検証レポート
137
+
138
+ ## 検証日時
139
+ YYYY-MM-DD HH:MM:SS
140
+
141
+ ## 検証対象ファイル
142
+ - `docs/michi/project/overview/architecture.md`
143
+ - `docs/michi/project/overview/sequence.md`
144
+
145
+ ## 検出されたエラー
146
+
147
+ ### Critical(即時修正必要)
148
+
149
+ #### architecture.md:15 - C4モデル: タイトル記法エラー
150
+ - **エラー内容**: `title: System Context Diagram`
151
+ - **修正内容**: `title System Context Diagram`
152
+ - **ステータス**: ✅ 自動修正済み
153
+
154
+ #### sequence.md:8 - シーケンス図: 矢印記法エラー
155
+ - **エラー内容**: `User->Frontend: リクエスト`
156
+ - **修正内容**: `User->>Frontend: リクエスト`
157
+ - **ステータス**: ✅ 自動修正済み
158
+
159
+ ### Warning(推奨修正)
160
+
161
+ #### architecture.md:45 - グラフ: サブグラフのインデント不足
162
+ - **エラー内容**: サブグラフ内の要素がインデントされていない
163
+ - **推奨修正**: 4スペースでインデント
164
+ - **ステータス**: ⚠️ 手動修正を推奨
165
+
166
+ ### Info(任意対応)
167
+
168
+ #### design.md:30 - Rel()の引数が3つのみ
169
+ - **警告内容**: `Rel(user, system, "Uses")`
170
+ - **推奨修正**: プロトコル情報を追加 `Rel(user, system, "Uses", "HTTPS")`
171
+ - **ステータス**: 🟢 動作するが推奨形式ではない
172
+
173
+ ## サマリー
174
+
175
+ - **検証ファイル数**: 3
176
+ - **検出エラー数**: 5
177
+ - Critical: 2(自動修正済み)
178
+ - Warning: 2(要手動修正)
179
+ - Info: 1(任意対応)
180
+
181
+ ## 修正済みファイル
182
+
183
+ 以下のファイルが自動修正されました:
184
+ - `docs/michi/project/overview/architecture.md`
185
+ - `docs/michi/project/overview/sequence.md`
186
+
187
+ ## 次のステップ
188
+
189
+ 1. 修正内容を確認: `git diff docs/michi/project/overview/architecture.md`
190
+ 2. 残りのWarningを手動修正
191
+ 3. Mermaid Live Editorで最終確認: https://mermaid.live/
192
+ ```
193
+
194
+ ## 安全性ルール
195
+
196
+ ### 自動修正の範囲
197
+
198
+ - ✅ 明らかな構文エラー(タイトル記法、矢印記法)
199
+ - ✅ インデントの正規化
200
+ - ❌ **構造的な変更は行わない**(ノード追加、削除、関係性変更)
201
+
202
+ ### 必須確認ケース
203
+
204
+ 1. **修正前のバックアップ**: 元のファイルを`.backup`として保存
205
+ 2. **修正内容の報告**: どのような修正を行ったかを明示
206
+ 3. **手動確認推奨**: 複雑な図は手動確認を推奨
207
+
208
+ ### 禁止事項
209
+
210
+ - ❌ ユーザー確認なしでの構造的変更
211
+ - ❌ 図の意味を変える修正
212
+ - ❌ ノードやリレーションシップの追加・削除
213
+
214
+ ### 推奨パターン
215
+
216
+ ```
217
+ AIエージェント:
218
+ 「Mermaid図の検証結果:
219
+
220
+ 🔴 Critical (2件)
221
+ - architecture.md:15 - C4モデルのタイトル記法エラー → 自動修正済み
222
+ - sequence.md:8 - シーケンス図の矢印記法エラー → 自動修正済み
223
+
224
+ ⚠️ Warning (1件)
225
+ - architecture.md:45 - サブグラフのインデント不足 → 手動修正を推奨
226
+
227
+ 修正内容を確認しますか?
228
+ A) git diffで差分確認
229
+ B) Mermaid Live Editorで動作確認
230
+ C) そのまま続行」
231
+ ```
232
+
233
+ ## Mermaid Live Editorでの検証
234
+
235
+ 修正後、Mermaid Live Editorで最終確認を推奨:
236
+
237
+ ```bash
238
+ # 修正後のMermaid図を抽出
239
+ sed -n '/```mermaid/,/```/p' architecture.md | sed '1d;$d' > /tmp/diagram.mmd
240
+
241
+ echo "以下のURLで図を確認してください:"
242
+ echo "https://mermaid.live/"
243
+ echo ""
244
+ echo "下記のコードをエディタに貼り付けてください:"
245
+ cat /tmp/diagram.mmd
246
+ ```
247
+
248
+ ## CI/CD統合
249
+
250
+ バージョン管理に組み込む場合、`ci-cd` スキル(`.claude/skills/ci-cd/SKILL.md`)を参照してください。
251
+
252
+ ## 参考資料
253
+
254
+ - [Mermaid公式ドキュメント](https://mermaid.js.org/)
255
+ - [Mermaid Live Editor](https://mermaid.live/)
256
+ - [C4モデルガイド](https://c4model.com/)
257
+ - [Mermaid CLI](https://github.com/mermaid-js/mermaid-cli)
@@ -0,0 +1,264 @@
1
+ ---
2
+ description: Multi-Repoプロジェクトの全リポジトリで実装を並行実行
3
+ allowed-tools: Task, Bash, Read, Write, Glob, Grep
4
+ argument-hint: <project-name> [--tasks <task-numbers>]
5
+ ---
6
+
7
+ # Multi-Repo Implementation (All Repositories)
8
+
9
+ <background_information>
10
+ - **Mission**: Multi-Repoプロジェクトの全リポジトリで実装を並行実行
11
+ - **Success Criteria**:
12
+ - 全リポジトリでTDD実装サイクルが完了
13
+ - テストカバレッジ95%以上
14
+ - 品質自動化(Lint/Type-check)パス
15
+ - PR作成可能な状態
16
+ </background_information>
17
+
18
+ <instructions>
19
+ ## Core Task
20
+ Multi-Repoプロジェクト **$1** の全リポジトリで `/michi:spec-impl` を並行実行します。
21
+
22
+ ## 引数解析
23
+
24
+ 引数の形式:
25
+ ```
26
+ /michi-multi-repo:impl-all <project-name> [--tasks <task-numbers>]
27
+ ```
28
+
29
+ パラメータ:
30
+ - **$1**: プロジェクト名(必須)
31
+ - **--tasks**: 実行するタスク番号(オプション)
32
+ - 例: `--tasks 1,2,3` → タスク1-3のみ実行
33
+ - 省略時: 全タスクを実行
34
+
35
+ ## Execution Steps
36
+
37
+ ### Step 1: 前提条件確認
38
+
39
+ 1. `docs/michi/$1/reviews/` に最新のレビューレポートが存在するか確認
40
+
41
+ 2. 最新レビューの品質ゲート判定を確認
42
+ ```bash
43
+ grep "品質ゲート判定" docs/michi/$1/reviews/cross-repo-review-*.md | tail -1
44
+ ```
45
+
46
+ 3. **判定が「不合格」の場合**:
47
+ ```
48
+ ❌ エラー: 品質ゲート不合格
49
+
50
+ BLOCK問題が未解決です。実装を開始できません。
51
+
52
+ 次のアクション:
53
+ 1. BLOCK問題を修正
54
+ 2. `/michi-multi-repo:spec-review $1` を再実行
55
+ 3. 合格後に再度このコマンドを実行
56
+ ```
57
+
58
+ 4. **判定が「条件付き合格」の場合**:
59
+ ```
60
+ ⚠️ 警告: 品質ゲート条件付き合格
61
+
62
+ WARN問題が検出されています。このまま実装を開始しますか? (y/n)
63
+
64
+ 推奨: WARN問題を修正してから実装開始
65
+ ```
66
+
67
+ ### Step 2: コンテキスト読み込み
68
+
69
+ 1. `.michi/config.json` からプロジェクト情報取得
70
+
71
+ 2. 登録リポジトリの一覧を取得
72
+
73
+ 3. 各リポジトリの `localPath` を取得
74
+
75
+ 4. 各リポジトリのタスクファイル確認
76
+ - `{localPath}/.kiro/specs/{feature}/tasks.md`
77
+
78
+ ### Step 3: チェックポイント確認
79
+
80
+ `docs/michi/$1/.checkpoint-impl.json` の存在を確認
81
+
82
+ 存在する場合:
83
+ ```
84
+ ⚠️ チェックポイントファイルが見つかりました
85
+
86
+ 前回の実装が中断された可能性があります。
87
+
88
+ 次のアクション:
89
+ A) チェックポイントから再開(未完了リポジトリのみ処理)
90
+ B) 最初から実行(チェックポイント削除)
91
+ C) キャンセル
92
+
93
+ 選択 (A/B/C): _
94
+ ```
95
+
96
+ ### Step 4: サブエージェント並行起動
97
+
98
+ **並行実行数**: 最大3並列
99
+
100
+ repo-spec-executorサブエージェントを使用して、以下のリポジトリで実装を並行実行してください:
101
+
102
+ **Repository 1**: {repo1.name}
103
+ - LOCAL_PATH: {repo1.localPath}
104
+ - PARENT_PROJECT: $1
105
+ - FEATURE_NAME: {feature}
106
+ - OPERATION: impl
107
+ - TASKS: {指定されたtask-numbers または "all"}
108
+
109
+ **Repository 2**: {repo2.name}
110
+ - LOCAL_PATH: {repo2.localPath}
111
+ - PARENT_PROJECT: $1
112
+ - FEATURE_NAME: {feature}
113
+ - OPERATION: impl
114
+ - TASKS: {指定されたtask-numbers または "all"}
115
+
116
+ (以下、登録されている全リポジトリ)
117
+
118
+ **重要**: 各サブエージェントの完了を待ち、結果を集約してください。
119
+
120
+ ### Step 5: 結果集約とレポート
121
+
122
+ 各リポジトリの実行結果を集約:
123
+
124
+ | リポジトリ | タスク進捗 | カバレッジ | Lint | Build | ステータス |
125
+ |-----------|----------|-----------|------|-------|----------|
126
+ | frontend | 5/5 | 96% | ✅ | ✅ | ✅ 完了 |
127
+ | backend | 8/8 | 98% | ✅ | ✅ | ✅ 完了 |
128
+ | shared | 3/3 | 95% | ✅ | ✅ | ✅ 完了 |
129
+
130
+ **成功件数**: 3/3
131
+ **全体カバレッジ**: 96.3%
132
+
133
+ ### Step 6: チェックポイント保存(失敗時)
134
+
135
+ 失敗したリポジトリがある場合、チェックポイントを保存:
136
+
137
+ ```json
138
+ {
139
+ "projectName": "$1",
140
+ "operation": "impl",
141
+ "repositories": {
142
+ "frontend": {
143
+ "status": "completed",
144
+ "tasksCompleted": 5,
145
+ "tasksTotal": 5,
146
+ "coverage": 96,
147
+ "completedAt": "2025-12-23T11:00:00Z"
148
+ },
149
+ "backend": {
150
+ "status": "failed",
151
+ "tasksCompleted": 3,
152
+ "tasksTotal": 8,
153
+ "error": "Test failed: auth.test.ts",
154
+ "failedAt": "2025-12-23T11:10:00Z"
155
+ }
156
+ },
157
+ "savedAt": "2025-12-23T11:11:00Z"
158
+ }
159
+ ```
160
+
161
+ 保存先: `docs/michi/$1/.checkpoint-impl.json`
162
+
163
+ ### Step 7: 次のアクション案内
164
+
165
+ **全成功時**:
166
+ ```markdown
167
+ 🎉 全リポジトリで実装が完了しました
168
+
169
+ ### 実装サマリー
170
+
171
+ | 指標 | 結果 |
172
+ |------|------|
173
+ | 完了リポジトリ | 3/3 |
174
+ | 全体カバレッジ | 96.3% |
175
+ | Lint/Build | ✅ All Pass |
176
+
177
+ ### 次のステップ
178
+
179
+ 1. 各リポジトリでPR作成:
180
+ 各リポジトリで `/pr` コマンドを実行
181
+
182
+ 2. CI結果を監視:
183
+ `michi multi-repo:ci-status $1`
184
+
185
+ 3. PRマージ後、リリース準備:
186
+ - Confluenceリリース手順書作成
187
+ - JIRAリリースチケット起票
188
+ ```
189
+
190
+ **一部失敗時**:
191
+ ```markdown
192
+ ⚠️ 一部のリポジトリで失敗しました
193
+
194
+ ### 失敗したリポジトリ
195
+ - backend: Test failed: auth.test.ts (タスク3/8完了)
196
+
197
+ ### 対処方法
198
+
199
+ 1. 失敗箇所を確認:
200
+ ```bash
201
+ cd {backend.localPath}
202
+ npm test auth.test.ts
203
+ ```
204
+
205
+ 2. 修正後、チェックポイントから再開:
206
+ `/michi-multi-repo:impl-all $1`
207
+ (失敗したリポジトリのみ処理されます)
208
+ ```
209
+
210
+ ## Important Constraints
211
+ - spec-review合格が前提(BLOCK問題がないこと)
212
+ - 並行実行は最大3リポジトリ
213
+ - TDDサイクル(RED-GREEN-REFACTOR)を遵守
214
+ - テストカバレッジ95%以上を維持
215
+ - 各リポジトリは独立して処理(依存関係なし)
216
+
217
+ </instructions>
218
+
219
+ ## Tool Guidance
220
+ - **Task**: repo-spec-executorサブエージェント起動に使用
221
+ - **Read**: config.json、レビューレポート、タスクファイル読み込み
222
+ - **Write**: チェックポイント保存
223
+ - **Bash**: Git操作、カバレッジ確認
224
+
225
+ ## Output Description
226
+
227
+ 日本語で以下の情報を出力してください:
228
+
229
+ 1. **処理対象リポジトリ一覧**: 各リポジトリのタスク進捗
230
+ 2. **実行結果サマリー**: 成功/失敗件数、全体カバレッジ
231
+ 3. **各リポジトリの詳細結果**: カバレッジ、Lint/Build結果、エラー内容
232
+ 4. **次のアクション**: 成功時/失敗時の推奨ステップ
233
+
234
+ ## Safety & Fallback
235
+
236
+ ### Error Scenarios
237
+
238
+ - **品質ゲート不合格**:
239
+ ```
240
+ エラー: 品質ゲート不合格のため、実装を開始できません。
241
+
242
+ `/michi-multi-repo:spec-review $1` を実行し、BLOCK問題を解決してください。
243
+ ```
244
+
245
+ - **タスクファイル不存在**:
246
+ ```
247
+ エラー: リポジトリ '{name}' にタスクファイルがありません: .kiro/specs/{feature}/tasks.md
248
+
249
+ タスクを生成してください:
250
+ cd {localPath}
251
+ /kiro:spec-tasks {feature}
252
+ ```
253
+
254
+ - **localPath未設定**:
255
+ ```
256
+ 警告: リポジトリ '{name}' の localPath が未設定です。スキップします。
257
+ ```
258
+
259
+ ### Fallback Strategy
260
+ - localPath未設定: 該当リポジトリをスキップし、他のリポジトリで処理続行
261
+ - サブエージェント失敗: チェックポイント保存し、リトライ可能にする
262
+ - テスト失敗: 自動修正を試行(最大3回)、失敗時はチェックポイント保存
263
+
264
+ think hard