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
package/LICENSE
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 spec-runner contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
日本語訳(正文は英語です)
|
|
25
|
+
|
|
26
|
+
MIT ライセンス
|
|
27
|
+
|
|
28
|
+
Copyright (c) 2025 spec-runner contributors
|
|
29
|
+
|
|
30
|
+
本ソフトウェアおよび関連する文書(以下「ソフトウェア」)の複製を取得した何人に対しても、ソフトウェアを制限なく扱うことを許可します。これには、使用、複製、変更、結合、出版、頒布、サブライセンス、販売の権利およびソフトウェアの複製を提供された者に同様の許可を与える権利を含みます。ただし、以下の条件に従うものとします。
|
|
31
|
+
|
|
32
|
+
上記の著作権表示および本許諾表示を、ソフトウェアのすべての複製または重要な部分に含めること。
|
|
33
|
+
|
|
34
|
+
本ソフトウェアは「現状のまま」で、明示または黙示を問わず、商品性、特定目的への適合性、権利侵害の不存在についての保証を含みません。いかなる場合も、作者または著作権者は、契約、不法行為、その他の行為により生じた請求について、本ソフトウェアの使用またはその他の取引に起因する責任を負いません。
|
package/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# spec-runner — AI-driven DDD Phase Gate System
|
|
2
|
+
|
|
3
|
+
AI が設計を飛ばして実装に入るのを、**シェルとゲートで防ぐ**フェーズゲート。Claude Code / Cursor / GitHub Copilot 対応。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 新規開発の流れ(最初から)
|
|
8
|
+
|
|
9
|
+
### 1. やりたいことを AI に相談する
|
|
10
|
+
|
|
11
|
+
Cursor や Claude で「〇〇がしたい」と話す。
|
|
12
|
+
|
|
13
|
+
### 2. AI がフォルダ構造を提案し、人が OK する
|
|
14
|
+
|
|
15
|
+
AI が次のような案を出す:
|
|
16
|
+
|
|
17
|
+
- 使用フレームワーク・言語
|
|
18
|
+
- 拡張子
|
|
19
|
+
- 各レイヤーの**ルートパス**(Domain / UseCase / Infrastructure)
|
|
20
|
+
- マイグレーションのディレクトリ
|
|
21
|
+
- テストのディレクトリ
|
|
22
|
+
- 必要ならサブフォルダ案(例: UseCase を `会員登録/` `注文/` で分ける)
|
|
23
|
+
|
|
24
|
+
人が「それで」と OK した時点で、**パスが決まった**状態になる。
|
|
25
|
+
|
|
26
|
+
### 3. spec-runner を入れる
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx spec-runner
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
対話では**どの開発環境か**だけ聞かれる(AI ツール・CI・ドキュメント言語)。
|
|
33
|
+
ここまでで、`.spec-runner/config.sh`(既定値)と `scripts/`・`docs/`・`.github/` などができる。
|
|
34
|
+
|
|
35
|
+
### 4. init で詳細設定と最初のユースケースを開始する
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
./scripts/spec-runner.sh init "会員登録" "会員"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**init を実行すると対話が始まる**(初回のみ)。AI と相談して決めた次の内容を入力する:
|
|
42
|
+
|
|
43
|
+
- 使用フレームワーク・言語(メモ用・任意)
|
|
44
|
+
- Domain / UseCase / Infrastructure のパス
|
|
45
|
+
- マイグレーション・テストディレクトリ、ソース拡張子
|
|
46
|
+
- Domain が import してはいけないパターン(正規表現)
|
|
47
|
+
- DDD を使うか / TDD を必須にするか / CI / ドキュメントの言語
|
|
48
|
+
|
|
49
|
+
設定後、`docs/requirements/会員登録.md` ができ、ブランチ `feature/uc-会員登録` が作られる。
|
|
50
|
+
|
|
51
|
+
- 引数なしで `./scripts/spec-runner.sh init` だけ実行すると、**設定対話のみ**(ユースケースは作らない)。
|
|
52
|
+
- すでに設定済みの場合は対話をスキップし、そのままユースケース作成に進む。
|
|
53
|
+
|
|
54
|
+
### 5. 開発フロー(この順で進める)
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
① 要件定義
|
|
58
|
+
docs/requirements/会員登録.md を書く
|
|
59
|
+
|
|
60
|
+
② 要件レビュー通過
|
|
61
|
+
./scripts/spec-runner.sh review-pass docs/requirements/会員登録.md
|
|
62
|
+
./scripts/spec-runner.sh set-gate glossary_checked
|
|
63
|
+
|
|
64
|
+
③ 概要設計
|
|
65
|
+
./scripts/spec-runner.sh design-high
|
|
66
|
+
docs/high-level/会員登録.md を書く → review-pass
|
|
67
|
+
|
|
68
|
+
④ 詳細設計(この順)
|
|
69
|
+
./scripts/spec-runner.sh design-detail domain → domain.md を書く → review-pass
|
|
70
|
+
./scripts/spec-runner.sh design-detail usecase → usecase.md を書く → review-pass
|
|
71
|
+
./scripts/spec-runner.sh design-detail table → table.md を書く → review-pass
|
|
72
|
+
./scripts/spec-runner.sh design-detail infra → infra.md を書く → review-pass
|
|
73
|
+
|
|
74
|
+
⑤ テスト設計
|
|
75
|
+
./scripts/spec-runner.sh test-design
|
|
76
|
+
docs/test-design/会員登録.md を書く
|
|
77
|
+
テストコードを先に書く(Red)→ コミット
|
|
78
|
+
./scripts/spec-runner.sh set-gate test_code_committed
|
|
79
|
+
./scripts/spec-runner.sh review-pass docs/test-design/会員登録.md
|
|
80
|
+
|
|
81
|
+
⑥ 実装
|
|
82
|
+
./scripts/spec-runner.sh implement
|
|
83
|
+
テストを Green にする実装を書く
|
|
84
|
+
|
|
85
|
+
⑦ 完了
|
|
86
|
+
./scripts/spec-runner.sh complete
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
TDD はデフォルトで有効。実装に進むには「テスト設計ドキュメント」と「テストコードのコミット」が必須。無効にしたいときは `.spec-runner/config.sh` で `export TDD_ENABLED="false"`。
|
|
90
|
+
|
|
91
|
+
### 6. PR とマージ
|
|
92
|
+
|
|
93
|
+
`git push` して PR。`.github/workflows/phase-gate-check.yml` がドキュメントとパスの整合をチェックする。
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## インストール方法
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npx spec-runner
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
または:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
curl -sSL https://raw.githubusercontent.com/spec-runner/spec-runner/main/install.sh | bash
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
[Use this template](https://github.com/spec-runner/spec-runner/generate) からリポジトリを作る方法もある。
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 強制の仕組み(3層)
|
|
114
|
+
|
|
115
|
+
| 層 | 内容 |
|
|
116
|
+
|----|------|
|
|
117
|
+
| **1. spec-runner.sh** | 各コマンドで「必要なドキュメント・ゲート」をチェック。足りないと先に進めない。 |
|
|
118
|
+
| **2. 実装前ブロック** | Claude Code は `.claude/hooks` で implement 以外のコード出力をブロック。Cursor / Copilot は `.cursorrules` 等で「status で phase を確認し、implement でないときはコードを書かない」とルール指定。 |
|
|
119
|
+
| **3. CI** | `.github/workflows/phase-gate-check.yml` が PR 時にドキュメント鮮度・DDD 依存方向などをチェック。 |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 設定
|
|
124
|
+
|
|
125
|
+
`.spec-runner/config.sh` でパスやコマンドを変えられる。CI とゲートはこの設定を参照する。
|
|
126
|
+
|
|
127
|
+
- `DOMAIN_PATH` / `USECASE_PATH` / `INFRA_PATH` … 各レイヤーの**ルート**。その下のサブフォルダ(UseCase 内の `会員登録/` など)は自由。強制したいルールは `.cursorrules` や `CLAUDE.md` に書く。
|
|
128
|
+
- `TEST_DIR` … テストの置き場所。TDD 時の「未コミット検出」に使う。
|
|
129
|
+
- `TDD_ENABLED` … `false` にすると、テストなしでも implement に進める。
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 導入後に増えるもの
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
<プロジェクトルート>/
|
|
137
|
+
├── .spec-runner/
|
|
138
|
+
│ ├── config.sh # パス・拡張子・TDD 等
|
|
139
|
+
│ └── state.json # 現在のフェーズ(gitignore 推奨)
|
|
140
|
+
├── .github/
|
|
141
|
+
│ ├── workflows/phase-gate-check.yml
|
|
142
|
+
│ └── PULL_REQUEST_TEMPLATE.md
|
|
143
|
+
├── docs/ # 要件・概要・詳細設計・テスト設計
|
|
144
|
+
├── scripts/spec-runner.sh
|
|
145
|
+
└── templates/requirement/template.md
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
選択した AI ツールに応じて `.claude/` や `.cursorrules` や `.github/copilot-instructions.md` などが追加される。
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## アップデート
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
npx spec-runner --update
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
`scripts/spec-runner.sh` と `.claude/hooks/` が更新される。ドキュメントや config は上書きしない。
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## スラッシュコマンド
|
|
163
|
+
|
|
164
|
+
**`/sr-status` を実行すると、現在のフェーズと「次にやるべきこと」(次に打つコマンド)が動的に表示される。** フェーズ移行(概要設計〜実装完了)はこの案内に従えばよい。
|
|
165
|
+
|
|
166
|
+
| コマンド | 説明 |
|
|
167
|
+
|----------|------|
|
|
168
|
+
| `/sr-configure` | 詳細設定の対話のみ |
|
|
169
|
+
| `/sr-init` [ユースケース名] [集約名] | ユースケース開始(未設定時は対話から) |
|
|
170
|
+
| `/sr-status` | フェーズ・ゲート+**次にやるべきこと**を表示 |
|
|
171
|
+
| `/sr-review` ファイル | レビュー通過 |
|
|
172
|
+
| `/sr-set-gate` ゲート名 | ゲート手動通過 |
|
|
173
|
+
| `/sr-fix` 内容 | 修正 |
|
|
174
|
+
| `/sr-hotfix` 内容 | 緊急修正 |
|
|
175
|
+
|
|
176
|
+
design-high / design-detail / test-design / implement / complete は、status の案内に表示されるので個別に指定不要。
|
|
177
|
+
|
|
178
|
+
定義: Claude `.claude/commands/` / Cursor `.cursor/commands/` / Copilot `.github/prompts/*.prompt.md`
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 必要環境
|
|
183
|
+
|
|
184
|
+
- Node.js 16+
|
|
185
|
+
- jq
|
|
186
|
+
- git
|
|
187
|
+
- bash 4.0+
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## ライセンス
|
|
192
|
+
|
|
193
|
+
MIT
|