spec-runner 1.0.0-alpha.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.
- package/LICENSE +34 -0
- package/README.md +193 -0
- package/bin/spec-runner.js +715 -0
- package/install.sh +80 -0
- package/package.json +45 -0
- package/templates/base/.github/PULL_REQUEST_TEMPLATE.md +43 -0
- package/templates/base/.github/workflows/phase-gate-check.yml +216 -0
- package/templates/base/docs/adr/TEMPLATE.md +46 -0
- package/templates/base/docs/glossary.md +51 -0
- package/templates/base/docs/review/debt.md +8 -0
- package/templates/base/scripts/spec-runner.sh +1079 -0
- package/templates/base/templates/requirement/template.md +40 -0
- package/templates/claude/.claude/commands/sr-complete.md +9 -0
- package/templates/claude/.claude/commands/sr-configure.md +11 -0
- package/templates/claude/.claude/commands/sr-design-detail.md +9 -0
- package/templates/claude/.claude/commands/sr-design-high.md +9 -0
- package/templates/claude/.claude/commands/sr-fix.md +9 -0
- package/templates/claude/.claude/commands/sr-hotfix.md +9 -0
- package/templates/claude/.claude/commands/sr-implement.md +9 -0
- package/templates/claude/.claude/commands/sr-init.md +10 -0
- package/templates/claude/.claude/commands/sr-review.md +9 -0
- package/templates/claude/.claude/commands/sr-set-gate.md +9 -0
- package/templates/claude/.claude/commands/sr-status.md +9 -0
- package/templates/claude/.claude/commands/sr-test-design.md +9 -0
- package/templates/claude/.claude/hooks/pre-tool-use.sh +79 -0
- package/templates/claude/.claude/settings.json +29 -0
- package/templates/claude/CLAUDE.md +141 -0
- package/templates/copilot/.github/copilot-instructions.md +25 -0
- package/templates/copilot/.github/prompts/sr-complete.prompt.md +13 -0
- package/templates/copilot/.github/prompts/sr-configure.prompt.md +13 -0
- package/templates/copilot/.github/prompts/sr-design-detail.prompt.md +14 -0
- package/templates/copilot/.github/prompts/sr-design-high.prompt.md +13 -0
- package/templates/copilot/.github/prompts/sr-fix.prompt.md +14 -0
- package/templates/copilot/.github/prompts/sr-hotfix.prompt.md +14 -0
- package/templates/copilot/.github/prompts/sr-implement.prompt.md +13 -0
- package/templates/copilot/.github/prompts/sr-init.prompt.md +15 -0
- package/templates/copilot/.github/prompts/sr-review.prompt.md +14 -0
- package/templates/copilot/.github/prompts/sr-set-gate.prompt.md +14 -0
- package/templates/copilot/.github/prompts/sr-status.prompt.md +13 -0
- package/templates/copilot/.github/prompts/sr-test-design.prompt.md +13 -0
- package/templates/cursor/.cursor/commands/sr-complete.md +9 -0
- package/templates/cursor/.cursor/commands/sr-configure.md +11 -0
- package/templates/cursor/.cursor/commands/sr-design-detail.md +9 -0
- package/templates/cursor/.cursor/commands/sr-design-high.md +9 -0
- package/templates/cursor/.cursor/commands/sr-fix.md +9 -0
- package/templates/cursor/.cursor/commands/sr-hotfix.md +9 -0
- package/templates/cursor/.cursor/commands/sr-implement.md +9 -0
- package/templates/cursor/.cursor/commands/sr-init.md +10 -0
- package/templates/cursor/.cursor/commands/sr-review.md +9 -0
- package/templates/cursor/.cursor/commands/sr-set-gate.md +9 -0
- package/templates/cursor/.cursor/commands/sr-status.md +9 -0
- package/templates/cursor/.cursor/commands/sr-test-design.md +9 -0
- package/templates/cursor/.cursorrules +25 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: {{USECASE}}
|
|
3
|
+
status: draft
|
|
4
|
+
created: {{DATE}}
|
|
5
|
+
updated: {{DATE}}
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# {{USECASE}}
|
|
9
|
+
|
|
10
|
+
## この要件が反映されるレイヤー
|
|
11
|
+
|
|
12
|
+
- **Domain**: `{{DOMAIN_PATH}}`
|
|
13
|
+
- **UseCase**: `{{USECASE_PATH}}`
|
|
14
|
+
- **Infrastructure**: `{{INFRA_PATH}}`
|
|
15
|
+
|
|
16
|
+
※ フォルダ構造は `.spec-runner/config.sh` で変更可能です。
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 何がしたいのか
|
|
21
|
+
|
|
22
|
+
<!-- ざっくりと。ユーザーの視点で書く -->
|
|
23
|
+
|
|
24
|
+
## 現状の問題
|
|
25
|
+
|
|
26
|
+
<!-- なぜこの機能が必要なのか。問題提起 -->
|
|
27
|
+
|
|
28
|
+
## 期待する結果
|
|
29
|
+
|
|
30
|
+
- ユーザーは _____ できる
|
|
31
|
+
|
|
32
|
+
## スコープ
|
|
33
|
+
|
|
34
|
+
### やること
|
|
35
|
+
-
|
|
36
|
+
|
|
37
|
+
### やらないこと
|
|
38
|
+
-
|
|
39
|
+
|
|
40
|
+
## メモ
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# /sr-configure
|
|
2
|
+
|
|
3
|
+
詳細設定(パス・TDD・DDD 等)の**対話のみ**を実行します。ユースケースは作成しません。
|
|
4
|
+
|
|
5
|
+
以下を**必ずターミナルで実行**してください。
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
./scripts/spec-runner.sh init
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
引数なしの init のため、対話で Domain/UseCase のパスやテスト設定を聞かれたあと「最初のユースケースを開始するには…」と表示されて終わります。ユースケースを作る場合は `/sr-init ユースケース名 集約名` を使ってください。
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# /sr-design-detail
|
|
2
|
+
|
|
3
|
+
以下を**必ずターミナルで実行**してください。$ARGUMENTS にはサブフェーズ(domain / usecase / table / infra)のいずれかを指定します(例: `/sr-design-detail domain`)。
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
./scripts/spec-runner.sh design-detail $ARGUMENTS
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
引数が空、または domain / usecase / table / infra 以外の場合は、ユーザーに「サブフェーズを指定してください: domain, usecase, table, infra」と伝えてください。
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# /sr-init
|
|
2
|
+
|
|
3
|
+
以下を**必ずターミナルで実行**してください。$ARGUMENTS にはユーザーが続けて入力した文字列が入ります(例: `/sr-init 顧客登録 顧客管理` → 引数は「顧客登録 顧客管理」)。
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
./scripts/spec-runner.sh init $ARGUMENTS
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
- **引数あり**(例: `顧客登録 顧客管理`): 未設定なら詳細設定の対話 → 続けてユースケース作成。
|
|
10
|
+
- **引数が空**の場合は、ユーザーに「ユースケース名(と任意で集約名)を指定してください」と伝えるか、**設定対話だけ**したい場合は `/sr-configure` を案内してください。
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# /sr-review
|
|
2
|
+
|
|
3
|
+
以下を**必ずターミナルで実行**してください。$ARGUMENTS にレビュー通過させるファイルパスを指定します(例: `/sr-review docs/requirements/顧客登録.md`)。
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
./scripts/spec-runner.sh review-pass $ARGUMENTS
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
引数が空の場合は、ユーザーに「レビュー通過させるファイルパスを指定してください(例: docs/requirements/顧客登録.md)」と伝えてください。
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# =============================================================================
|
|
3
|
+
# Claude Code Pre-Tool-Use Hook
|
|
4
|
+
# ファイル書き込み前にフェーズを確認し、実装フェーズ以外でのコード生成をブロックする
|
|
5
|
+
#
|
|
6
|
+
# Claude Code の hooks 仕様:
|
|
7
|
+
# - stdin: JSON {"tool_name": "...", "tool_input": {...}}
|
|
8
|
+
# - exit 0: 許可
|
|
9
|
+
# - exit 2: ブロック(Claude にエラーメッセージを返す)
|
|
10
|
+
# =============================================================================
|
|
11
|
+
|
|
12
|
+
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)"
|
|
13
|
+
STATE_FILE="$PROJECT_ROOT/.spec-runner/state.json"
|
|
14
|
+
CONFIG_FILE="$PROJECT_ROOT/.spec-runner/config.sh"
|
|
15
|
+
|
|
16
|
+
# ステートファイルがなければ素通り(init前は制限しない)
|
|
17
|
+
[[ -f "$STATE_FILE" ]] || exit 0
|
|
18
|
+
|
|
19
|
+
# フレームワーク設定を読み込む(拡張子の設定のため)
|
|
20
|
+
if [[ -f "$CONFIG_FILE" ]]; then
|
|
21
|
+
# shellcheck source=.spec-runner/config.sh
|
|
22
|
+
source "$CONFIG_FILE"
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
# デフォルト拡張子(config.sh がない場合)
|
|
26
|
+
SOURCE_EXTENSIONS="${SOURCE_EXTENSIONS:-ts tsx js jsx php py rb}"
|
|
27
|
+
|
|
28
|
+
# stdinからツール情報を読む
|
|
29
|
+
input=$(cat)
|
|
30
|
+
tool_name=$(echo "$input" | jq -r '.tool_name // empty' 2>/dev/null)
|
|
31
|
+
file_path=$(echo "$input" | jq -r '.tool_input.file_path // empty' 2>/dev/null)
|
|
32
|
+
|
|
33
|
+
# ファイル書き込み系のツールのみチェック
|
|
34
|
+
case "$tool_name" in
|
|
35
|
+
Write|Edit|NotebookEdit) ;;
|
|
36
|
+
*) exit 0 ;;
|
|
37
|
+
esac
|
|
38
|
+
|
|
39
|
+
# 設計ドキュメントや設定ファイルへの書き込みは常に許可
|
|
40
|
+
case "$file_path" in
|
|
41
|
+
*/docs/*|*/CLAUDE.md|*/.spec-runner/state.json|*/scripts/*|*/.github/*|\
|
|
42
|
+
*/templates/*|*/glossary.md|*.json|*.yml|*.yaml|*.sh|*.lock|\
|
|
43
|
+
*/.spec-runner/*|*/node_modules/*|*/vendor/*)
|
|
44
|
+
exit 0
|
|
45
|
+
;;
|
|
46
|
+
esac
|
|
47
|
+
|
|
48
|
+
# SOURCE_EXTENSIONS を配列に変換して拡張子チェック
|
|
49
|
+
phase=$(jq -r '.phase // empty' "$STATE_FILE" 2>/dev/null)
|
|
50
|
+
|
|
51
|
+
# 拡張子チェック: SOURCE_EXTENSIONS に含まれる拡張子のみブロック対象
|
|
52
|
+
should_block=false
|
|
53
|
+
for ext in $SOURCE_EXTENSIONS; do
|
|
54
|
+
if [[ "$file_path" == *."$ext" ]]; then
|
|
55
|
+
should_block=true
|
|
56
|
+
break
|
|
57
|
+
fi
|
|
58
|
+
done
|
|
59
|
+
|
|
60
|
+
if [[ "$should_block" == "true" ]]; then
|
|
61
|
+
if [[ "$phase" != "implement" && "$phase" != "fix" && "$phase" != "hotfix" ]]; then
|
|
62
|
+
next_cmd=$(case "$phase" in
|
|
63
|
+
require*) echo "design-high" ;;
|
|
64
|
+
design-high) echo "design-detail domain" ;;
|
|
65
|
+
design-detail*) echo "design-detail <次のサブフェーズ>" ;;
|
|
66
|
+
test-design) echo "implement" ;;
|
|
67
|
+
*) echo "status" ;;
|
|
68
|
+
esac)
|
|
69
|
+
cat <<MSG
|
|
70
|
+
{
|
|
71
|
+
"decision": "block",
|
|
72
|
+
"reason": "【フェーズゲート】現在のフェーズは '$phase' です。実装コードの生成は 'implement' フェーズでのみ許可されています。\n\n現在の状態を確認: ./scripts/spec-runner.sh status\n次のフェーズへ: ./scripts/spec-runner.sh $next_cmd"
|
|
73
|
+
}
|
|
74
|
+
MSG
|
|
75
|
+
exit 2
|
|
76
|
+
fi
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
exit 0
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"PreToolUse": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "Write|Edit",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": ".claude/hooks/pre-tool-use.sh"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
"permissions": {
|
|
16
|
+
"allow": [
|
|
17
|
+
"Bash(./scripts/spec-runner.sh:*)",
|
|
18
|
+
"Bash(git checkout:*)",
|
|
19
|
+
"Bash(git branch:*)",
|
|
20
|
+
"Bash(git status:*)",
|
|
21
|
+
"Bash(git add:*)",
|
|
22
|
+
"Bash(git commit:*)",
|
|
23
|
+
"Bash(git push:*)",
|
|
24
|
+
"Bash(git log:*)",
|
|
25
|
+
"Bash(jq:*)",
|
|
26
|
+
"Bash(date:*)"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# 開発ルール(Claude Code 向け)
|
|
2
|
+
|
|
3
|
+
このプロジェクトは **scripts/spec-runner.sh** によるフェーズゲートで運用している。
|
|
4
|
+
本ファイルは AI 向けの指示であり、**scripts/spec-runner.sh** はフェーズが通過していないと実行を拒否するため、設計をスキップできない。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 最優先ルール
|
|
9
|
+
|
|
10
|
+
**何かを実装する前に必ず実行せよ:**
|
|
11
|
+
|
|
12
|
+
`./scripts/spec-runner.sh status`(チャットでは `/sr-status`)で現在のフェーズを確認する。
|
|
13
|
+
|
|
14
|
+
`phase` が `implement` でない場合、実装コードを生成してはならない。
|
|
15
|
+
代わりに「現在のフェーズを確認してください」と伝えてユーザーに委ねよ。
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## TDD(テスト駆動)ルール(デフォルトで有効)
|
|
20
|
+
|
|
21
|
+
**実装フェーズに進むまでに、テストを必ず含める。**
|
|
22
|
+
|
|
23
|
+
1. **テスト設計** … `docs/test-design/<UC名>.md` を書く
|
|
24
|
+
2. **テストを先に書く(Red)** … 実装より前にテストコードを書き、失敗することを確認する
|
|
25
|
+
3. **テストコードをコミット** … `./scripts/spec-runner.sh set-gate test_code_committed` でゲート通過
|
|
26
|
+
4. **実装で Green** … `implement` フェーズでテストを通す実装を書く
|
|
27
|
+
|
|
28
|
+
ドキュメントだけでなく**テストコードも必須**。テストを書かずに実装に進むことはできない。ゲートが `TEST_DIR` 配下の未コミットを検出し、コミットするまで `implement` に進めない。
|
|
29
|
+
|
|
30
|
+
- **テストのパス**は `.spec-runner/config.sh` の `TEST_DIR` で動的に指定(例: `tests`, `spec`, `__tests__`)。ここに置いたテストが未コミットだと implement ゲートでブロックされる。
|
|
31
|
+
- TDD をオプションにしたい場合: `export TDD_ENABLED="false"` にすると、実装前にテストコードを書かなくても `implement` に進める。
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## スラッシュコマンド(チャット用)
|
|
36
|
+
|
|
37
|
+
### .claude/commands/(Claude Code カスタムスラッシュコマンド)
|
|
38
|
+
|
|
39
|
+
`.claude/commands/` に Markdown を置くと、チャット欄で `/sr-*` として呼び出せる。各ファイルは「spec-runner.sh を実行せよ」という指示になっており、**ハード強制**に繋がる。コマンド一覧は **README の「スラッシュコマンド」** を参照。各 .md 内の `$ARGUMENTS` には、ユーザーがスラッシュの後に続けて入力した文字列が入る。
|
|
40
|
+
|
|
41
|
+
### 自然言語・短いスラッシュでの依頼
|
|
42
|
+
|
|
43
|
+
ユーザーが `/init`・`/status`・`/design-high` などの短いスラッシュ、または「init して」「顧客登録で design-high まで進めて」などの自然言語で依頼した場合も、**必ず** 対応する `./scripts/spec-runner.sh` をターミナルで実行すること(上記の `/sr-*` と同じ動作)。
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## フェーズ別の行動規則
|
|
48
|
+
|
|
49
|
+
### require(要件定義)フェーズ
|
|
50
|
+
- `docs/requirements/<UC名>.md` を編集する
|
|
51
|
+
- 実装・設計・テーブル定義は書かない
|
|
52
|
+
- 完了後: `./scripts/spec-runner.sh review-pass docs/requirements/<UC名>.md`
|
|
53
|
+
|
|
54
|
+
### design-high(概要設計)フェーズ
|
|
55
|
+
- `docs/high-level/<UC名>.md` を編集する
|
|
56
|
+
- ユースケース記述とドメインモデル候補の洗い出しのみ
|
|
57
|
+
- **具体的なメソッド定義・テーブルカラムは書かない**
|
|
58
|
+
- 新しい概念が出たら先に `docs/glossary.md` に追加する
|
|
59
|
+
- 完了後: `./scripts/spec-runner.sh review-pass docs/high-level/<UC名>.md`
|
|
60
|
+
|
|
61
|
+
### design-detail(詳細設計)フェーズ
|
|
62
|
+
この順序で作業する:
|
|
63
|
+
|
|
64
|
+
1. **domain** → `docs/detailed/<UC名>/domain.md`
|
|
65
|
+
- エンティティ・値オブジェクト・ドメインイベント・集約・リポジトリIF
|
|
66
|
+
- 振る舞い(メソッド)の定義
|
|
67
|
+
- ← レビュー通過後に次へ
|
|
68
|
+
|
|
69
|
+
2. **usecase** → `docs/detailed/<UC名>/usecase.md`
|
|
70
|
+
- ドメインモデルを使う設計(ドメインモデルを参照して書く)
|
|
71
|
+
- Command/Query の入出力・シーケンス図
|
|
72
|
+
- ← レビュー通過後に次へ
|
|
73
|
+
|
|
74
|
+
3. **table** → `docs/detailed/<UC名>/table.md`
|
|
75
|
+
- ドメインモデル ≠ テーブル(用途で分けてOK)
|
|
76
|
+
- ER図(Mermaid)
|
|
77
|
+
- ← レビュー通過後に次へ
|
|
78
|
+
|
|
79
|
+
4. **infra** → `docs/detailed/<UC名>/infra.md`
|
|
80
|
+
- APIエンドポイント定義
|
|
81
|
+
- リポジトリ実装方針
|
|
82
|
+
- フロントエンドコンポーネント構成
|
|
83
|
+
- ← レビュー通過後に次へ
|
|
84
|
+
|
|
85
|
+
### test-design(テスト設計)フェーズ
|
|
86
|
+
- `docs/test-design/<UC名>.md` を編集する
|
|
87
|
+
- **TDD: テストコードを実装より先に書く(Red 状態で OK)**
|
|
88
|
+
- テストコードをコミットしてから次へ: `./scripts/spec-runner.sh set-gate test_code_committed`
|
|
89
|
+
- 完了後: `./scripts/spec-runner.sh review-pass docs/test-design/<UC名>.md`
|
|
90
|
+
|
|
91
|
+
### implement(実装)フェーズ
|
|
92
|
+
- **TDD: テストを Green にする実装を書く**
|
|
93
|
+
- 設計と乖離した場合は先にドキュメントを更新する
|
|
94
|
+
- コードとドキュメントを同一コミットに含める
|
|
95
|
+
- 完了後: `./scripts/spec-runner.sh complete`
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## ドキュメント同時更新ルール
|
|
100
|
+
|
|
101
|
+
| 変更内容 | 必ず同時更新するもの |
|
|
102
|
+
|---------|-------------------|
|
|
103
|
+
| `Domain/` 配下のクラス変更 | `docs/detailed/<UC名>/domain.md` |
|
|
104
|
+
| `UseCase/` 配下のクラス変更 | `docs/detailed/<UC名>/usecase.md` |
|
|
105
|
+
| `Infrastructure/Api/` の変更 | `docs/detailed/<UC名>/infra.md` |
|
|
106
|
+
| DBマイグレーション | `docs/detailed/<UC名>/table.md` |
|
|
107
|
+
| 新しいエンティティ/値オブジェクト | `docs/glossary.md` |
|
|
108
|
+
| アーキテクチャ判断 | `docs/adr/<番号>-<タイトル>.md` |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## ユビキタス言語ルール
|
|
113
|
+
|
|
114
|
+
- 設計ドキュメント → `docs/glossary.md` の **日本語** 列を使う
|
|
115
|
+
- コード(クラス名・メソッド名・変数名)→ **英語** 列を使う
|
|
116
|
+
- PHPDoc/JSDoc → 日本語のユビキタス言語を `@description` に併記する
|
|
117
|
+
- 新しい概念が登場 → **まず `docs/glossary.md` に追加してから**設計・実装に入る
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## DDDレイヤー依存ルール(違反禁止)
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
Infrastructure → UseCase → Domain
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
- `Domain/` のコードは `UseCase/` や `Infrastructure/` を import してはならない
|
|
128
|
+
- `UseCase/` のコードは `Infrastructure/` の具体実装を import してはならない
|
|
129
|
+
- Eloquentモデルは `Infrastructure/Persistence/` のみで使用する
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Gitコミットメッセージ
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
<type>(<scope>): <日本語の説明>
|
|
137
|
+
|
|
138
|
+
type: feat, fix, docs, refactor, test, chore
|
|
139
|
+
scope: domain, usecase, infra, frontend, design, adr, test
|
|
140
|
+
```
|
|
141
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# spec-runner(GitHub Copilot 用指示)
|
|
2
|
+
|
|
3
|
+
このプロジェクトは **scripts/spec-runner.sh** によるフェーズゲートで運用している。実装前に必ずフェーズを確認すること。
|
|
4
|
+
|
|
5
|
+
## 最優先
|
|
6
|
+
|
|
7
|
+
- 実装コードを書く前に **必ず** `./scripts/spec-runner.sh status` を実行する。
|
|
8
|
+
- `phase` が `implement` でないときは実装コードを生成しない。ユーザーに「現在のフェーズを確認してください」と伝える。
|
|
9
|
+
- ユーザーが「init して」「status 確認して」「design-high で進めて」などと言ったら、対応する `./scripts/spec-runner.sh` をターミナルで実行する。
|
|
10
|
+
- スラッシュコマンド `/sr-init` などは `.github/prompts/*.prompt.md` に定義済み。`tools: [shell]` でシェル実行される。
|
|
11
|
+
|
|
12
|
+
## TDD(テスト駆動)— デフォルトで有効
|
|
13
|
+
|
|
14
|
+
- 実装前に **テスト設計ドキュメント** と **テストコード** を必ず書く。テストを先に書いて Red → 実装で Green。
|
|
15
|
+
- `.spec-runner/config.sh` の `TDD_ENABLED=false` で無効化すると、テストなしでも implement に進める(オプション)。
|
|
16
|
+
|
|
17
|
+
## フェーズとコマンド
|
|
18
|
+
|
|
19
|
+
- require → design-high → design-detail (domain → usecase → table → infra) → test-design → implement
|
|
20
|
+
- 各フェーズ完了時: `./scripts/spec-runner.sh review-pass <該当ファイル>`
|
|
21
|
+
- ゲート: `./scripts/spec-runner.sh set-gate glossary_checked` など
|
|
22
|
+
- 実装完了: `./scripts/spec-runner.sh complete`
|
|
23
|
+
- 修正: `./scripts/spec-runner.sh fix "内容"` / `./scripts/spec-runner.sh hotfix "内容"`
|
|
24
|
+
|
|
25
|
+
詳細はプロジェクトの README を参照。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
agent: 'agent'
|
|
3
|
+
description: 'spec-runner: 詳細設定の対話のみ(パス・TDD等)。ユースケースは作らない'
|
|
4
|
+
tools: ['shell']
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
以下を**必ずシェルで実行**してください。
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
./scripts/spec-runner.sh init
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
引数なしのため、対話でパス・TDD 等を聞かれたあと終了します。ユースケースを作成する場合は sr-init でユースケース名・集約名を指定してください。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
agent: 'agent'
|
|
3
|
+
description: 'spec-runner: 詳細設計サブフェーズ(domain / usecase / table / infra)'
|
|
4
|
+
argument-hint: 'domain | usecase | table | infra'
|
|
5
|
+
tools: ['shell']
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
以下を**必ずシェルで実行**してください。
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
./scripts/spec-runner.sh design-detail ${input:sub:サブフェーズ(domain, usecase, table, infra)}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
引数が無効な場合は、ユーザーに「domain, usecase, table, infra のいずれかを指定してください」と伝えてください。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
agent: 'agent'
|
|
3
|
+
description: 'spec-runner: 通常修正(設計変更を伴う)'
|
|
4
|
+
argument-hint: '修正内容'
|
|
5
|
+
tools: ['shell']
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
以下を**必ずシェルで実行**してください。
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
./scripts/spec-runner.sh fix "${input:content:修正内容}"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
引数が空の場合は、ユーザーに「修正内容を指定してください」と伝えてください。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
agent: 'agent'
|
|
3
|
+
description: 'spec-runner: 緊急修正(負債として記録)'
|
|
4
|
+
argument-hint: '修正内容'
|
|
5
|
+
tools: ['shell']
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
以下を**必ずシェルで実行**してください。
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
./scripts/spec-runner.sh hotfix "${input:content:修正内容}"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
引数が空の場合は、ユーザーに「修正内容を指定してください」と伝えてください。
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
agent: 'agent'
|
|
3
|
+
description: 'spec-runner: ユースケースを初期化(未設定なら詳細設定の対話から)'
|
|
4
|
+
argument-hint: 'ユースケース名 集約名(例: 顧客登録 顧客管理)。空なら設定対話のみ'
|
|
5
|
+
tools: ['shell']
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
以下を**必ずシェルで実行**してください。
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
./scripts/spec-runner.sh init ${input:args:ユースケース名 集約名(スペース区切り。集約名は省略可)}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- **引数あり**: 未設定なら詳細設定の対話 → ユースケース作成。
|
|
15
|
+
- **引数が空**: 設定対話のみ。ユースケースを作らない場合はこのまま実行でよい。ユースケースを作る場合は引数で名前を指定するよう伝えてください。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
agent: 'agent'
|
|
3
|
+
description: 'spec-runner: レビュー通過を記録'
|
|
4
|
+
argument-hint: 'ファイルパス(例: docs/requirements/顧客登録.md)'
|
|
5
|
+
tools: ['shell']
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
以下を**必ずシェルで実行**してください。
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
./scripts/spec-runner.sh review-pass ${input:path:レビュー通過させるファイルパス}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
引数が空の場合は、ユーザーに「ファイルパスを指定してください」と伝えてください。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
agent: 'agent'
|
|
3
|
+
description: 'spec-runner: ゲート通過を記録'
|
|
4
|
+
argument-hint: 'ゲート名(例: glossary_checked, test_code_committed)'
|
|
5
|
+
tools: ['shell']
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
以下を**必ずシェルで実行**してください。
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
./scripts/spec-runner.sh set-gate ${input:gate:ゲート名}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
引数が空の場合は、ユーザーに「ゲート名を指定してください」と伝えてください。
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# /sr-configure
|
|
2
|
+
|
|
3
|
+
詳細設定(パス・TDD・DDD 等)の**対話のみ**を実行します。ユースケースは作成しません。
|
|
4
|
+
|
|
5
|
+
以下を**必ずターミナルで実行**してください。
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
./scripts/spec-runner.sh init
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
引数なしの init のため、対話で Domain/UseCase のパスやテスト設定を聞かれたあと「最初のユースケースを開始するには…」と表示されて終わります。ユースケースを作る場合は `/sr-init ユースケース名 集約名` を使ってください。
|