spec-runner 1.0.17 → 1.0.19
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
|
@@ -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")"
|
|
@@ -314,22 +318,28 @@ run_health_check() {
|
|
|
314
318
|
for f in "$UC_ROOT"/*/UC-*.md; do
|
|
315
319
|
[[ -f "$f" ]] || continue
|
|
316
320
|
base=$(basename "$f" .md)
|
|
317
|
-
|
|
321
|
+
# 表ヘッダ(例: `| 前提 | 操作 | 期待 |`)の `|` は `\|` としてリテラル扱いする
|
|
322
|
+
if ! grep -qE '受入条件|成功基準|前提:|操作:|期待:|\|[[:space:]]*前提[[:space:]]*\|[[:space:]]*操作[[:space:]]*\|[[:space:]]*期待[[:space:]]*\|' "$f" 2>/dev/null; then
|
|
318
323
|
drifts+=("UC ${base}: 受入条件または成功基準がありません")
|
|
319
324
|
fi
|
|
320
|
-
count=$(grep -c '
|
|
325
|
+
count=$(grep -c '\[要確認:' "$f" 2>/dev/null || echo 0)
|
|
321
326
|
count=$(echo "$count" | head -1 | tr -cd '0-9'); count=${count:-0}
|
|
322
327
|
[[ "$count" -gt 3 ]] && drifts+=("UC ${base}: [要確認: が ${count} 個(3個以下にすること)")
|
|
323
|
-
|
|
324
|
-
|
|
328
|
+
# `## 実装方針` / `## タスク(一覧)` は実装計画以降で埋まる想定。
|
|
329
|
+
# ただし `clarify/analyze` は「任意フェーズで挿入」されるため、
|
|
330
|
+
# 実装計画が回っていない(=生成物がまだ無い)タイミングで先回りで落とさない。
|
|
331
|
+
if [[ "$current_phase" -ge 3 && "$is_quality_step" -eq 0 ]]; then
|
|
332
|
+
grep -qE '^## 実装方針' "$f" 2>/dev/null || drifts+=("UC ${base}: 「## 実装方針」の見出しがありません(UC 仕様書の一番下に記載すること)")
|
|
333
|
+
grep -qE '^## タスク一覧|^## タスク\\b' "$f" 2>/dev/null || drifts+=("UC ${base}: 「## タスク」または「## タスク一覧」の見出しがありません(UC 仕様書の一番下に記載すること)")
|
|
334
|
+
fi
|
|
325
335
|
done
|
|
326
336
|
|
|
327
|
-
if [[ "$current_phase" -ge 3 ]]; then
|
|
337
|
+
if [[ "$current_phase" -ge 3 && "$is_quality_step" -eq 0 ]]; then
|
|
328
338
|
adr_count=$(find "$ARCH_ROOT/設計判断記録" -name "*.md" 2>/dev/null | wc -l)
|
|
329
339
|
[[ "${adr_count:-0}" -lt 1 ]] && drifts+=("ADR が 1 件もありません(設計判断記録)")
|
|
330
340
|
fi
|
|
331
341
|
|
|
332
|
-
if [[ "$current_phase" -ge 2 ]]; then
|
|
342
|
+
if [[ "$current_phase" -ge 2 && "$is_quality_step" -eq 0 ]]; then
|
|
333
343
|
if [[ ! -f "$DOMAIN_ROOT/ユビキタス言語辞書.md" ]]; then
|
|
334
344
|
drifts+=("ユビキタス言語辞書.md が存在しません")
|
|
335
345
|
else
|
|
@@ -345,13 +355,13 @@ run_health_check() {
|
|
|
345
355
|
elif command -v jq >/dev/null 2>&1; then
|
|
346
356
|
grade=$(jq -r '.current_grade' .spec-runner/grade-history.json)
|
|
347
357
|
[[ -n "$grade" && "$grade" != "null" ]] || drifts+=("grade-history.json の current_grade が未設定です")
|
|
348
|
-
if [[ "$grade" == "A" && "$current_phase" -ge 4 ]]; then
|
|
358
|
+
if [[ "$grade" == "A" && "$current_phase" -ge 4 && "$is_quality_step" -eq 0 ]]; then
|
|
349
359
|
[[ ! -f "$INFRA_ROOT/schema.dbml" ]] && drifts+=("Grade A 必須: schema.dbml が存在しません")
|
|
350
360
|
schema_sync_check >/dev/null 2>&1 || drifts+=("Prisma と schema.dbml のテーブルが一致していません(スキーマ同期チェック)")
|
|
351
361
|
fi
|
|
352
362
|
fi
|
|
353
363
|
|
|
354
|
-
if [[ "$current_phase" -ge 3 ]]; then
|
|
364
|
+
if [[ "$current_phase" -ge 3 && "$is_quality_step" -eq 0 ]]; then
|
|
355
365
|
[[ ! -f "$OPENAPI_PATH" ]] && drifts+=("openapi.yaml が存在しません")
|
|
356
366
|
fi
|
|
357
367
|
|