spec-runner 1.0.16 → 1.0.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-runner",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "フェーズ駆動で設計先行を強制。npx で .spec-runner を展開し、次のステップ .md に従って進める",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -298,12 +298,16 @@ schema_drift_check() {
298
298
  run_health_check() {
299
299
  local drifts=()
300
300
  local current_phase=0
301
+ local current_step_id=""
302
+ local is_quality_step=0
301
303
 
302
304
  # フェーズに応じてチェック強度を段階適用する
303
305
  if [[ -x ".spec-runner/scripts/spec-runner-core.sh" ]] && command -v jq >/dev/null 2>&1; then
304
306
  current_phase="$(.spec-runner/scripts/spec-runner-core.sh --json 2>/dev/null | jq -r '.phase // 0' 2>/dev/null)"
305
307
  [[ -n "$current_phase" && "$current_phase" != "null" ]] || current_phase=0
308
+ current_step_id="$(.spec-runner/scripts/spec-runner-core.sh --json 2>/dev/null | jq -r '.step_id // empty' 2>/dev/null)"
306
309
  fi
310
+ [[ "$current_step_id" == "clarify" || "$current_step_id" == "analyze" ]] && is_quality_step=1
307
311
 
308
312
  UC_ROOT="$(get_steps_common_doc "uc_root")"
309
313
  DOMAIN_ROOT="$(get_steps_common_doc "domain_root")"
@@ -320,16 +324,21 @@ run_health_check() {
320
324
  count=$(grep -c '\\[要確認:' "$f" 2>/dev/null || echo 0)
321
325
  count=$(echo "$count" | head -1 | tr -cd '0-9'); count=${count:-0}
322
326
  [[ "$count" -gt 3 ]] && drifts+=("UC ${base}: [要確認: が ${count} 個(3個以下にすること)")
323
- grep -qE '^## 実装方針' "$f" 2>/dev/null || drifts+=("UC ${base}: 「## 実装方針」の見出しがありません(UC 仕様書の一番下に記載すること)")
324
- grep -qE '^## タスク一覧|^## タスク\\b' "$f" 2>/dev/null || drifts+=("UC ${base}: 「## タスク」または「## タスク一覧」の見出しがありません(UC 仕様書の一番下に記載すること)")
327
+ # `## 実装方針` / `## タスク(一覧)` は実装計画以降で埋まる想定。
328
+ # ただし `clarify/analyze` は「任意フェーズで挿入」されるため、
329
+ # 実装計画が回っていない(=生成物がまだ無い)タイミングで先回りで落とさない。
330
+ if [[ "$current_phase" -ge 3 && "$is_quality_step" -eq 0 ]]; then
331
+ grep -qE '^## 実装方針' "$f" 2>/dev/null || drifts+=("UC ${base}: 「## 実装方針」の見出しがありません(UC 仕様書の一番下に記載すること)")
332
+ grep -qE '^## タスク一覧|^## タスク\\b' "$f" 2>/dev/null || drifts+=("UC ${base}: 「## タスク」または「## タスク一覧」の見出しがありません(UC 仕様書の一番下に記載すること)")
333
+ fi
325
334
  done
326
335
 
327
- if [[ "$current_phase" -ge 3 ]]; then
336
+ if [[ "$current_phase" -ge 3 && "$is_quality_step" -eq 0 ]]; then
328
337
  adr_count=$(find "$ARCH_ROOT/設計判断記録" -name "*.md" 2>/dev/null | wc -l)
329
338
  [[ "${adr_count:-0}" -lt 1 ]] && drifts+=("ADR が 1 件もありません(設計判断記録)")
330
339
  fi
331
340
 
332
- if [[ "$current_phase" -ge 2 ]]; then
341
+ if [[ "$current_phase" -ge 2 && "$is_quality_step" -eq 0 ]]; then
333
342
  if [[ ! -f "$DOMAIN_ROOT/ユビキタス言語辞書.md" ]]; then
334
343
  drifts+=("ユビキタス言語辞書.md が存在しません")
335
344
  else
@@ -345,13 +354,13 @@ run_health_check() {
345
354
  elif command -v jq >/dev/null 2>&1; then
346
355
  grade=$(jq -r '.current_grade' .spec-runner/grade-history.json)
347
356
  [[ -n "$grade" && "$grade" != "null" ]] || drifts+=("grade-history.json の current_grade が未設定です")
348
- if [[ "$grade" == "A" && "$current_phase" -ge 4 ]]; then
357
+ if [[ "$grade" == "A" && "$current_phase" -ge 4 && "$is_quality_step" -eq 0 ]]; then
349
358
  [[ ! -f "$INFRA_ROOT/schema.dbml" ]] && drifts+=("Grade A 必須: schema.dbml が存在しません")
350
359
  schema_sync_check >/dev/null 2>&1 || drifts+=("Prisma と schema.dbml のテーブルが一致していません(スキーマ同期チェック)")
351
360
  fi
352
361
  fi
353
362
 
354
- if [[ "$current_phase" -ge 3 ]]; then
363
+ if [[ "$current_phase" -ge 3 && "$is_quality_step" -eq 0 ]]; then
355
364
  [[ ! -f "$OPENAPI_PATH" ]] && drifts+=("openapi.yaml が存在しません")
356
365
  fi
357
366
 
@@ -31,6 +31,16 @@ $ARGUMENTS
31
31
 
32
32
  ## 実行フロー
33
33
 
34
+ ### 0. スコープ判定と UC 分解提案(先に実施)
35
+
36
+ - 入力が広いテーマ(例: 「タスク管理基盤」「認証基盤」「決済基盤」)の場合、**そのまま 1 UC を作らない**。
37
+ - 先に AI が UC 分解案を提案し、ユーザー合意を取ってから UC を作成する。
38
+ - 提案フォーマット(簡潔):
39
+ - 候補 UC 一覧(`UC-候補: 目的 / 範囲 / 非対象`)
40
+ - 優先順(MVP から)
41
+ - まず作る 1 件(最小価値)
42
+ - 合意後は **1 件ずつ** `uc-next-start.sh` で作成する(CRUD は原則別 UC)。
43
+
34
44
  ### 1. ブランチ用短名(2〜4 語)
35
45
 
36
46
  - 機能説明からキーワード抽出。**ブランチ名は ASCII のみ**、kebab-case(例: order-placement, user-auth)。
@@ -87,6 +97,8 @@ checklists を使う場合のみ `FEATURE_DIR/checklists/requirements.md` を生
87
97
 
88
98
  ブランチ名・仕様パス・チェックリスト結果・次フェーズ(曖昧さ解消 / 実装計画)の準備状況。
89
99
 
100
+ ※ 分解提案を経た場合は、採用された UC 分割案(採用順)も合わせて報告する。
101
+
90
102
  **注**: スクリプトは書き込み前にブランチ作成・チェックアウトと仕様の初期化を行う。
91
103
 
92
104
  ## 付録 A: 仕様品質チェックリスト例