spec-runner 1.1.0 → 1.1.4

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/README.md CHANGED
@@ -22,7 +22,6 @@ curl -sSL https://raw.githubusercontent.com/TEEE88/spec-runner/main/install.sh |
22
22
 
23
23
  - `mkdocs.yml` / `requirements-docs.txt`
24
24
  - `docs/index.md`(サイトのホーム)
25
- - `docs/spec-runner-フロー.md`(`spec-runner` パッケージ同梱の手順書)
26
25
 
27
26
  `.spec-runner/` がすでにあり **2 回目以降はエラーで止まる** 場合も、**その手前**で上記 MkDocs 用ファイルの不足分だけ補完される(初回導入以前のリポジトリで MkDocs だけ足したいときに便利)。
28
27
 
@@ -22,7 +22,6 @@
22
22
  * MkDocs(任意・プロジェクトルート):
23
23
  * - templates/mkdocs-scaffold/ の mkdocs.yml / requirements-docs.txt / docs/index.md を
24
24
  * 未有効時のみコピー(憲章・設計書は既存の docs/01..06 をそのまま閲覧)
25
- * - パッケージ同梱の docs/flow.md を docs/spec-runner-フロー.md としてコピー(未存在時のみ)
26
25
  */
27
26
 
28
27
  const fs = require("fs");
@@ -35,7 +34,6 @@ const DEST_DIR = path.join(CWD, ".spec-runner");
35
34
  const TEMPLATES_DIR = path.join(TEMPLATE_SPEC_RUNNER_DIR, "templates");
36
35
  const PHASE_LOCKS_TEMPLATE = path.join(TEMPLATES_DIR, "phase-locks.json");
37
36
  const MKDOCS_SCAFFOLD_DIR = path.join(PKG_DIR, "templates", "mkdocs-scaffold");
38
- const FLOW_DOC_SRC = path.join(PKG_DIR, "docs", "flow.md");
39
37
  const SKILLS_TEMPLATE_DIR = path.join(PKG_DIR, "templates", "skills");
40
38
 
41
39
  /** コピー時はスキップし、FORCE 時は消さない(ユーザー状態を保持) */
@@ -234,9 +232,6 @@ function installMkdocsScaffold() {
234
232
  path.join(MKDOCS_SCAFFOLD_DIR, "docs", "index.md"),
235
233
  path.join(CWD, "docs", "index.md"),
236
234
  );
237
- if (exists(FLOW_DOC_SRC)) {
238
- copyFileIfMissing(FLOW_DOC_SRC, path.join(CWD, "docs", "spec-runner-フロー.md"));
239
- }
240
235
  appendGitignoreVenvDocsIfNeeded();
241
236
  }
242
237
 
package/docs/flow.md CHANGED
@@ -49,6 +49,7 @@
49
49
  - 全 UC レビュー済みなら `domain`(必要に応じ `clarify` / `analyze`)
50
50
  4. `architecture.completed` が false
51
51
  - `architecture_plan`(必要に応じ `clarify` / `analyze`)
52
+ - lock が true でも、設計成果物(`docs/03` / `docs/04` の `.md`)が無い場合は該当設計フェーズに戻る
52
53
  5. 最新 UC がレビュー済みかつテスト準備済み
53
54
  - `implement`
54
55
  それ以外は `test_design`
@@ -68,3 +69,4 @@
68
69
  3. コミット前に `docs/work.md` の `- [ ]` を確認する
69
70
  4. 完了時に `docs/work.md` の検証結果を更新する
70
71
  5. UC を十分に作ってレビュー完了したら `uc_discovery.completed` を `true` にする
72
+ 6. カテゴリは箱として扱い、1カテゴリに UC を複数(目安 2〜3 件以上)用意してからドメインへ進む
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-runner",
3
- "version": "1.1.0",
3
+ "version": "1.1.4",
4
4
  "description": "フェーズ駆動で設計先行を強制。npx で .spec-runner を展開し、次のステップ .md に従って進める",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -91,7 +91,7 @@ latest_unreviewed_uc_spec() {
91
91
  local f key
92
92
  while IFS= read -r f; do
93
93
  key="$(basename "$f" .md)"
94
- jq -e --arg u "$key" '.uc_reviewed[]? == $u' "$LOCK_FILE" >/dev/null 2>&1 && continue
94
+ jq -e --arg u "$key" 'any(.uc_reviewed[]?; . == $u)' "$LOCK_FILE" >/dev/null 2>&1 && continue
95
95
  echo "$f"
96
96
  return 0
97
97
  done < <(find docs/02_ユースケース仕様 -mindepth 2 -maxdepth 2 -type f -name "UC-*.md" 2>/dev/null | sort -V)
@@ -143,6 +143,8 @@ run_phase() {
143
143
  charter_doc="$(get_steps_common_doc "charter")"
144
144
  domain_root="$(get_steps_common_doc "domain_root")"
145
145
  architecture_root="$(get_steps_common_doc "architecture_root")"
146
+ domain_spec_present=0
147
+ arch_spec_present=0
146
148
 
147
149
  doc_key() { basename "$1" .md; }
148
150
  first_md_in_dir() {
@@ -153,6 +155,12 @@ run_phase() {
153
155
 
154
156
  uc_count_total=$(find docs/02_ユースケース仕様 -mindepth 2 -maxdepth 2 -name "UC-*.md" 2>/dev/null | wc -l | tr -d ' ')
155
157
  uc_count_total=${uc_count_total:-0}
158
+ [[ -n "$(first_md_in_dir "$domain_root" || true)" ]] && domain_spec_present=1
159
+ [[ -n "$(first_md_in_dir "$architecture_root" || true)" ]] && arch_spec_present=1
160
+
161
+ # lock が先に立っていても、設計成果物が無い場合は必ず設計フェーズへ戻す
162
+ [[ $domain_spec_present -eq 0 ]] && has_domain_lock=0
163
+ [[ $arch_spec_present -eq 0 ]] && has_arch_lock=0
156
164
 
157
165
  if [[ $has_charter_lock -eq 0 ]]; then
158
166
  if [[ -f "$charter_doc" ]]; then
@@ -240,7 +248,7 @@ run_phase() {
240
248
  feature_dir="$(dirname "$uc_spec")"
241
249
  uc_key="$(doc_key "$uc_spec")"
242
250
  reviewed=0
243
- jq -e --arg u "$uc_key" '.uc_reviewed[]? == $u' "$LOCK_FILE" 2>/dev/null | grep -q true && reviewed=1
251
+ jq -e --arg u "$uc_key" 'any(.uc_reviewed[]?; . == $u)' "$LOCK_FILE" >/dev/null 2>&1 && reviewed=1
244
252
  if [[ $reviewed -eq 0 ]]; then
245
253
  if ! quality_done "clarified" "uc" "$uc_key"; then
246
254
  phase=1; phase_name_ja="ユースケース仕様(曖昧さ解消)"; resolve_step "clarify"
@@ -45,11 +45,12 @@ UC_ID_RE="$(jq -r '.naming.uc_id_pattern' "$PROJECT_JSON")"
45
45
  exit 1
46
46
  }
47
47
 
48
- next_uc_id() {
49
- local dir="$REPO_ROOT/docs/02_ユースケース仕様"
48
+ next_uc_id_for_category() {
49
+ local category="$1"
50
+ local dir="$REPO_ROOT/docs/02_ユースケース仕様/${category}"
50
51
  mkdir -p "$dir"
51
52
  local max=0
52
- for f in "$dir"/*/UC-*.md; do
53
+ for f in "$dir"/UC-*.md; do
53
54
  [[ -e "$f" ]] || continue
54
55
  base=$(basename "$f" .md)
55
56
  if [[ "$base" =~ ^(${UC_ID_RE})- ]]; then
@@ -63,7 +64,8 @@ next_uc_id() {
63
64
  printf "UC-%d\n" $((max + 1))
64
65
  }
65
66
 
66
- NEXT_UC="$(next_uc_id)"
67
+ NEXT_UC=""
68
+ UC_ID_EXPLICIT=0
67
69
  SLUG=""
68
70
  TITLE=""
69
71
  CATEGORY=""
@@ -74,6 +76,7 @@ if [[ ${#ARGS[@]} -ge 1 ]] && [[ "${ARGS[0]}" =~ ^${UC_ID_RE}$ ]]; then
74
76
  exit 1
75
77
  }
76
78
  NEXT_UC="${ARGS[0]}"
79
+ UC_ID_EXPLICIT=1
77
80
  SLUG="${ARGS[1]}"
78
81
  TITLE="${ARGS[2]}"
79
82
  CATEGORY="${ARGS[3]}"
@@ -113,6 +116,10 @@ if [[ -z "$CATEGORY" ]]; then
113
116
  exit 1
114
117
  fi
115
118
 
119
+ if [[ $UC_ID_EXPLICIT -eq 0 ]]; then
120
+ NEXT_UC="$(next_uc_id_for_category "$CATEGORY")"
121
+ fi
122
+
116
123
  FEATURE_DIR="docs/02_ユースケース仕様/${CATEGORY}"
117
124
  UC_DOC="${FEATURE_DIR}/${NEXT_UC}-${DOC_TITLE}.md"
118
125
 
@@ -28,9 +28,10 @@ $ARGUMENTS
28
28
 
29
29
  ## フォルダの作成
30
30
 
31
- - **`docs/02_ユースケース仕様/`** が無ければ新規作成。**カテゴリごとにフォルダ**(例: タスク管理、認証)を切り、その中に **UC-N-xxx.md 1 本**。
31
+ - **`docs/02_ユースケース仕様/`** が無ければ新規作成。**カテゴリごとにフォルダ**(例: タスク管理、認証)を切り、その中に **UC-N-xxx.md を複数本**作る(カテゴリは 1 UC で終わらせない)。
32
32
  - `uc-next-start.sh` でカテゴリ指定するとそのフォルダ内に作成される。
33
33
  - **CRUD は原則別 UC**(作成 / 編集 / 削除を分ける)。同一フロー・同一権限・同一受入条件で差分が小さい場合のみ統合可。
34
+ - 目安: 1カテゴリにつき最低 2〜3 UC。MVP は最小 1 UC でも可だが、次に必ず細分化候補を洗い出す。
34
35
 
35
36
  ## 実行フロー
36
37
 
@@ -13,7 +13,7 @@
13
13
  | インフラ設計 | `docs/05_インフラ設計/` |
14
14
  | API 仕様 | `docs/06_API仕様/` |
15
15
 
16
- 手順・コマンド・ロックの考え方は **[spec-runner のフロー](spec-runner-フロー.md)** を参照してください(`npx spec-runner` 時にコピーされます)。
16
+ 手順・コマンド・ロックの考え方は、リポジトリの `docs/flow.md` を参照してください。
17
17
 
18
18
  ---
19
19