sonamu 0.8.21 → 0.8.22
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/dist/api/config.d.ts +1 -1
- package/dist/api/config.d.ts.map +1 -1
- package/dist/api/config.js +1 -1
- package/dist/api/sonamu.d.ts +1 -1
- package/dist/api/sonamu.d.ts.map +1 -1
- package/dist/api/sonamu.js +14 -19
- package/dist/cone/cone-generator.js +29 -16
- package/dist/database/base-model.js +2 -2
- package/dist/database/db.d.ts +1 -1
- package/dist/database/db.d.ts.map +1 -1
- package/dist/database/db.js +1 -1
- package/dist/syncer/syncer.js +2 -2
- package/dist/testing/global-setup.d.ts.map +1 -1
- package/dist/testing/global-setup.js +1 -4
- package/dist/ui/api.d.ts.map +1 -1
- package/dist/ui/api.js +11 -11
- package/package.json +4 -4
- package/src/api/config.ts +1 -1
- package/src/api/sonamu.ts +15 -20
- package/src/cone/cone-generator.ts +39 -19
- package/src/database/base-model.ts +1 -1
- package/src/database/db.ts +1 -1
- package/src/skills/AGENTS.md +11 -1
- package/src/skills/sonamu/SKILL.md +42 -149
- package/src/skills/sonamu/cdd.md +172 -517
- package/src/skills/sonamu/cone.md +3 -4
- package/src/skills/sonamu/fixture-cli.md +1 -1
- package/src/skills/sonamu/workflow.md +72 -80
- package/src/syncer/syncer.ts +1 -1
- package/src/testing/global-setup.ts +0 -4
- package/src/ui/api.ts +6 -15
- package/src/skills/project/business-logic.md +0 -270
- package/src/skills/project/requirements.md +0 -160
package/src/skills/sonamu/cdd.md
CHANGED
|
@@ -1,307 +1,117 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sonamu-cdd
|
|
3
|
-
description:
|
|
3
|
+
description: AC + Claim 기반 개발 가이드. *.contract.md(도메인 규칙), Rules, AC(테스트명), Claim(작업 지시서). 기능 구현 전 반드시 읽을 것. Use when planning or implementing features.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
This project follows Contract-Driven Development (CDD). All development work must follow the rules below.
|
|
9
|
-
|
|
10
|
-
## Core Principles
|
|
11
|
-
|
|
12
|
-
- The `.contract.json` files under the `contract/` directory are the Single Source of Truth (SSoT) for this project.
|
|
13
|
-
- All development follows a **Waterfall process**. Move to the next stage only after the current stage is completed.
|
|
14
|
-
- Authority flows in this order: **Contract -> Spec -> Code**.
|
|
15
|
-
- Code must always follow Spec.
|
|
16
|
-
- Spec must always follow Contract.
|
|
17
|
-
- **1 Contract Feature = 1 Spec File**. Each feature in Contract's `Features/Capabilities` maps to exactly one Spec file. Shared infrastructure across features may be separated into `shared/*.spec.json`.
|
|
18
|
-
- Even if a better structure appears during implementation, do not change code first. Update Spec first, then update code.
|
|
19
|
-
- Contract is human-managed. AI must not modify Contract files without user request. When the user explicitly asks to update Contract, AI may edit directly. Otherwise, AI should only propose changes.
|
|
20
|
-
- Code-document consistency is verified by AI automated validation (1st pass) and review checklist (2nd pass for feature mapping/coverage).
|
|
21
|
-
|
|
22
|
-
## Project Structure
|
|
23
|
-
|
|
24
|
-
```text
|
|
25
|
-
contract/
|
|
26
|
-
|- schemas/
|
|
27
|
-
| |- default-contract.schema.json # contract schema definition
|
|
28
|
-
| \- default-spec.schema.json # spec schema definition
|
|
29
|
-
|- rules/
|
|
30
|
-
| \- *.rules.json # reusable implementation conventions
|
|
31
|
-
|- main.contract.json # project root contract
|
|
32
|
-
|- {domain}/
|
|
33
|
-
| |- main.contract.json # domain representative contract
|
|
34
|
-
| |- {sub-contract}.contract.json
|
|
35
|
-
| |- {feature-key}.spec.json # 1 feature = 1 spec file
|
|
36
|
-
|- shared/
|
|
37
|
-
| |- {shared-infra}.spec.json # cross-feature shared infrastructure
|
|
38
|
-
\- ...
|
|
39
|
-
```
|
|
6
|
+
# AC + Claim 기반 개발
|
|
40
7
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
```text
|
|
44
|
-
contract/
|
|
45
|
-
|- main.contract.json
|
|
46
|
-
|- auth/
|
|
47
|
-
| |- main.contract.json
|
|
48
|
-
| |- login.spec.json # login feature spec (1:1)
|
|
49
|
-
| |- session.spec.json # session feature spec (1:1)
|
|
50
|
-
| \- password-reset.spec.json # password-reset feature spec (1:1)
|
|
51
|
-
|- payment/
|
|
52
|
-
| |- main.contract.json
|
|
53
|
-
| |- checkout.spec.json # checkout feature spec (1:1)
|
|
54
|
-
| \- refund.spec.json # refund feature spec (1:1)
|
|
55
|
-
\- shared/
|
|
56
|
-
\- auth-session.spec.json # shared session infrastructure
|
|
57
|
-
```
|
|
8
|
+
Spec 문서 없이 **3종의 영구 문서 + 일회성 Claim**으로 개발한다.
|
|
58
9
|
|
|
59
|
-
|
|
60
|
-
- Spec: `*.spec.json` - one file per feature, placed in the same folder as related Contract files. The filename is the feature key (`login.spec.json` -> feature key `login`).
|
|
10
|
+
**Ground truth는 코드다.** `*.contract.md`는 코드 결정의 근거를 기록하는 문서이지 선행 정의서가 아니다.
|
|
61
11
|
|
|
62
|
-
|
|
12
|
+
## 두 가지 개발 경로
|
|
63
13
|
|
|
64
|
-
|
|
14
|
+
| 경로 | 순서 | 적용 상황 |
|
|
15
|
+
|------|------|----------|
|
|
16
|
+
| **신규 개발** | contract 작성 → Claim → `(AC → implement) × N` | 새 기능, 새 도메인 |
|
|
17
|
+
| **코드 변경** | code 수정 → Claim 등록 → contract 확인/갱신 | 기존 기능 수정, 버그 픽스 |
|
|
65
18
|
|
|
66
|
-
|
|
19
|
+
**Claim은 유닛 단위다.** Claim 안에서 AC 작성과 구현은 교차 반복된다.
|
|
67
20
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"type": "spec",
|
|
74
|
-
"fields": [
|
|
75
|
-
{
|
|
76
|
-
"name": "modules",
|
|
77
|
-
"type": "Record<string, string>",
|
|
78
|
-
"renderer": "label-grid",
|
|
79
|
-
"required": true,
|
|
80
|
-
"description": "구현에 사용되는 모듈 정의"
|
|
81
|
-
}
|
|
82
|
-
]
|
|
83
|
-
}
|
|
21
|
+
```
|
|
22
|
+
Claim C-001
|
|
23
|
+
├─ AC: "이메일 중복 시 409를 반환한다" → 구현
|
|
24
|
+
├─ AC: "비밀번호가 8자 미만이면 400을 반환한다" → 구현
|
|
25
|
+
└─ AC: "성공 시 생성된 user_id를 반환한다" → 구현
|
|
84
26
|
```
|
|
85
27
|
|
|
86
|
-
|
|
87
|
-
|---|---|
|
|
88
|
-
| `id` | 스키마 식별자 (Contract/Spec의 `schema` 필드에서 참조) |
|
|
89
|
-
| `type` | `contract` \| `spec` |
|
|
90
|
-
| `fields` | 문서에 포함될 커스텀 필드 목록 |
|
|
91
|
-
| `fields[].name` | 필드명 |
|
|
92
|
-
| `fields[].type` | `string`, `string[]`, `Record<string, string>`, `Record<string, object>` |
|
|
93
|
-
| `fields[].renderer` | 렌더링 컴포넌트 (생략 시 디폴트 사용) |
|
|
94
|
-
| `fields[].required` | 필수 여부 |
|
|
95
|
-
| `fields[].description` | `cdd advance` Layer 2 검증 기준으로 사용됨 |
|
|
96
|
-
|
|
97
|
-
### Contract (`.contract.json`)
|
|
28
|
+
AC 하나를 작성하는 행위는 그 자체로 설계 행위다 — 어떤 입력/출력을 기대하는지 명확히 함으로써 구현 방향을 먼저 확정한다. AC가 작고 구체적일수록 구현이 명확해진다.
|
|
98
29
|
|
|
99
|
-
|
|
30
|
+
코드 변경 경로에서 `*.contract.md`를 갱신할 때는 변경 이유(근거)를 함께 기록한다.
|
|
100
31
|
|
|
101
|
-
|
|
102
|
-
{
|
|
103
|
-
"schema": "default-contract",
|
|
104
|
-
"lastModified": "YYYY-MM-DD",
|
|
105
|
-
"features": {
|
|
106
|
-
"login": "이메일/비밀번호 로그인 및 세션 발급"
|
|
107
|
-
},
|
|
108
|
-
"overview": [...],
|
|
109
|
-
"domainGlossary": [...],
|
|
110
|
-
"userRoles": [...],
|
|
111
|
-
"businessRules": [...],
|
|
112
|
-
"edgeCases": [...]
|
|
113
|
-
}
|
|
114
|
-
```
|
|
32
|
+
---
|
|
115
33
|
|
|
116
|
-
|
|
34
|
+
## 영구 문서 (3종)
|
|
117
35
|
|
|
118
|
-
|
|
36
|
+
| 문서 | 위치 | 내용 | 갱신 시점 |
|
|
37
|
+
|------|------|------|----------|
|
|
38
|
+
| 비즈니스 로직 | `contract/**/*.contract.md` | 도메인 규칙 + 결정 근거 | 정책 변경 시 |
|
|
39
|
+
| Rules | `contract/rules/*.rules.json` | 코드 컨벤션, UI/API 규칙 | 컨벤션 변경 시 |
|
|
40
|
+
| AC | `*.test.ts` describe/test 이름 | 수락 기준 — 코드에 직접 존재 | 기능 추가/변경 시 |
|
|
119
41
|
|
|
120
|
-
###
|
|
42
|
+
### 비즈니스 로직 (`*.contract.md`)
|
|
121
43
|
|
|
122
|
-
|
|
44
|
+
비즈니스 로직은 코드에 전부 존재한다. 하지만 코드에서는 여러 파일에 분산되어 있고 구현 디테일과 섞여 있어서 도메인 규칙만 골라 읽기 어렵다. `*.contract.md`의 역할은:
|
|
123
45
|
|
|
124
|
-
|
|
125
|
-
{
|
|
126
|
-
"schema": "default-spec",
|
|
127
|
-
"schemaVersion": 2,
|
|
128
|
-
"summary": "Login processing and session issuance",
|
|
129
|
-
"description": [
|
|
130
|
-
"Validates user credentials and issues JWT-based sessions.",
|
|
131
|
-
"Includes password retry limit and account lockout policy."
|
|
132
|
-
],
|
|
133
|
-
"acceptanceCriteria": [
|
|
134
|
-
{
|
|
135
|
-
"id": "ac-login-1",
|
|
136
|
-
"condition": "유효한 이메일/비밀번호 로그인 시 세션이 생성된다",
|
|
137
|
-
"testRef": {
|
|
138
|
-
"target": "packages/api/src/application/auth/login.test.ts",
|
|
139
|
-
"pattern": "ac-login-1"
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
"id": "ac-login-2",
|
|
144
|
-
"condition": "잘못된 비밀번호 입력 시 인증 실패 응답이 반환된다",
|
|
145
|
-
"testRef": {
|
|
146
|
-
"target": "",
|
|
147
|
-
"pattern": ""
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
],
|
|
151
|
-
"lastModified": "YYYY-MM-DD",
|
|
152
|
-
"status": "draft | specifying | implementing | validating | done",
|
|
153
|
-
"sources": ["packages/api/src/application/auth/login.ts", "packages/api/src/application/auth/login.test.ts"],
|
|
154
|
-
"contracts": ["./main.contract.json"],
|
|
155
|
-
"dependsOnSpecs": ["./session.spec.json"],
|
|
156
|
-
"modules": {
|
|
157
|
-
"LoginService": "Handles login processing",
|
|
158
|
-
"SessionManager": "Manages sessions"
|
|
159
|
-
},
|
|
160
|
-
"interfaces": {
|
|
161
|
-
"LoginService.authenticate()": "Performs authentication",
|
|
162
|
-
"LoginService.validate()": "Validates input"
|
|
163
|
-
},
|
|
164
|
-
"dataFlow": [
|
|
165
|
-
"1. Client -> LoginService.validate(): validate email/password input",
|
|
166
|
-
"2. LoginService.validate() -> LoginService.authenticate(): pass validated credentials",
|
|
167
|
-
"3. LoginService.authenticate() -> Database: query user record and compare password hash",
|
|
168
|
-
"4. LoginService.authenticate() -> SessionManager: request session creation on auth success",
|
|
169
|
-
"5. SessionManager -> Client: return Access Token + Refresh Token"
|
|
170
|
-
],
|
|
171
|
-
"errorHandling": {
|
|
172
|
-
"InvalidCredentialsError": "Wrong password",
|
|
173
|
-
"AccountLockedError": "Account locked after 5 retries"
|
|
174
|
-
},
|
|
175
|
-
"constraints": ["Session timeout: 30 min", "Login retry limit: 5 attempts"]
|
|
176
|
-
}
|
|
177
|
-
```
|
|
46
|
+
> 비즈니스 로직을 도메인 수준에서 응집된 형태로 기술하고, 코드만으로는 파악하기 어려운 결정 근거를 함께 기록한다.
|
|
178
47
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
| `lastModified` | `string` | Y | Last modified date (YYYY-MM-DD) |
|
|
187
|
-
| `status` | `string` | Y | `"draft"` / `"specifying"` / `"implementing"` / `"validating"` / `"done"` |
|
|
188
|
-
| `sources` | `string[]` | Y | Implementation/test files (relative to project root) |
|
|
189
|
-
| `contracts` | `string[]` | Y | Referenced Contract files (relative to Spec file) |
|
|
190
|
-
| `dependsOnSpecs` | `string[]` | N | Dependent Spec files (relative to Spec file) |
|
|
191
|
-
| `modules` | `Record<string, string>` | Y | Module structure (key: module name, value: role) |
|
|
192
|
-
| `interfaces` | `Record<string, string>` | Y | Functions/APIs (key: function name, value: description) |
|
|
193
|
-
| `dataFlow` | `string[]` | Y | Inter-module data flow |
|
|
194
|
-
| `errorHandling` | `Record<string, string>` | Y | Error handling (key: error name, value: trigger condition) |
|
|
195
|
-
| `constraints` | `string[]` | Y | Technical constraints |
|
|
196
|
-
| `guards` | `string[]` | N | Access control guards (e.g. `["admin"]`, `["admin", "sot"]`) |
|
|
197
|
-
| `testCases` | `string[]` | N | Key test scenarios derived from errorHandling/acceptanceCriteria (used as fixture/test design hints) |
|
|
198
|
-
| `fixtureStrategy` | `string` | N | Notes on fixture generation order or dependencies (e.g. "User → Department → Lab 순으로 생성") |
|
|
199
|
-
|
|
200
|
-
**Empty section notation**: `string[]` -> `[]`, `Record<string, string>` -> `{}`
|
|
201
|
-
|
|
202
|
-
### 엔티티 레벨 권장 추가 항목 (constraints에 명시)
|
|
203
|
-
|
|
204
|
-
다음 항목들은 Entity 설계에 영향을 주므로 `constraints` 또는 별도 필드에 명시해 두면 Entity 설계 시 혼선을 방지할 수 있다.
|
|
205
|
-
|
|
206
|
-
| 항목 | 예시 |
|
|
207
|
-
|---|---|
|
|
208
|
-
| PK 타입 전략 | `"User.id는 string (better-auth). 나머지는 number auto-increment"` |
|
|
209
|
-
| i18n 대상 여부 | `"name 필드는 ko/en 다국어 지원 (naite 패턴 사용)"` |
|
|
210
|
-
| 파일 업로드 여부 | `"thumbnail: SonamuFile (eager upload)"` |
|
|
211
|
-
| ManyToMany FK 타입 일치 | `"user__roles: user_id(string FK), role_id(number FK) 혼합"` |
|
|
212
|
-
| Read-only 엔티티 | `"Log 엔티티는 insert only. save/del 불필요"` |
|
|
213
|
-
|
|
214
|
-
**Spec is higher authority than code.** Code must always follow the confirmed Spec. If Spec and code conflict, code is wrong.
|
|
215
|
-
|
|
216
|
-
### Contract-Spec linking
|
|
217
|
-
|
|
218
|
-
Contract is not extended as a structural source of feature keys. **Spec references Contract unidirectionally.**
|
|
219
|
-
|
|
220
|
-
1. **Spec filename = feature key**: `login.spec.json` -> `login`
|
|
221
|
-
2. **`contracts` field** points to referenced Contract files
|
|
222
|
-
3. **`summary`/`description`** describes which Contract feature this Spec implements (human-readable)
|
|
223
|
-
4. Duplicate feature keys within the same Contract boundary are not allowed
|
|
224
|
-
5. Renaming a Spec file = changing the feature key
|
|
225
|
-
|
|
226
|
-
### `status` field
|
|
227
|
-
|
|
228
|
-
| Value | Meaning | Transition condition |
|
|
229
|
-
|---|---|---|
|
|
230
|
-
| `draft` | Spec 초안 작성 중, 미확정 | 초기 상태 |
|
|
231
|
-
| `specifying` | 명세 세분화 중 | contracts 유효 참조, required 필드 충족, summary/description/AC 비어있지 않음 |
|
|
232
|
-
| `implementing` | Spec 확정, 구현 진행 중 | 명세 전체 확정 후 |
|
|
233
|
-
| `validating` | 구현 완료, AC 매칭 검증 중 | sources 파일 존재, AC testRef 지정 및 존재 |
|
|
234
|
-
| `done` | 전체 AC 만족, 일관성 검증 통과 | testRef.pattern 매칭, 빌드/테스트 통과 |
|
|
235
|
-
|
|
236
|
-
**Regression**: When `sources`, `contracts`, `dependsOnSpecs`, or `acceptanceCriteria` change on a `done` Spec, `status` reverts to `implementing`.
|
|
237
|
-
|
|
238
|
-
### `acceptanceCriteria` field
|
|
239
|
-
|
|
240
|
-
Conditions that must be met for this Spec's implementation to be considered "done". Each item is an object:
|
|
48
|
+
**들어가야 하는 것:**
|
|
49
|
+
- 도메인 규칙과 제약 ("환불은 결제 후 7일 이내만 가능")
|
|
50
|
+
- 결정 근거 ("PG사 정책 때문")
|
|
51
|
+
- 여러 모듈에 걸친 도메인 워크플로우 ("주문 상태: 대기 → 확인 → 배송 → 완료")
|
|
52
|
+
- 우선순위/순서 규칙 ("할인: 멤버십 등급 > 쿠폰 > 프로모션")
|
|
53
|
+
- 도메인 용어 정의, 역할 구분
|
|
54
|
+
- Edge case와 의도된 처리 방식
|
|
241
55
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
"target": "packages/api/src/application/auth/login.test.ts",
|
|
248
|
-
"pattern": "ac-login-1"
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
```
|
|
56
|
+
**들어가지 않는 것:**
|
|
57
|
+
- 구현 디테일 (파일 경로, 함수명, 클래스 구조)
|
|
58
|
+
- API 엔드포인트나 데이터 스키마
|
|
59
|
+
- UI 레이아웃이나 컴포넌트 구조
|
|
60
|
+
- 코드 컨벤션 (이건 `*.rules.json`에)
|
|
252
61
|
|
|
253
|
-
|
|
254
|
-
|---|---|
|
|
255
|
-
| `id` | AC 식별자. `ac-{feature}-{n}` 형식 |
|
|
256
|
-
| `condition` | 검증 가능한 구체적 조건 |
|
|
257
|
-
| `testRef.target` | AC를 검증하는 테스트 파일 경로 |
|
|
258
|
-
| `testRef.pattern` | 테스트 파일 내 항목 식별 패턴 (`pnpm cdd test <target> -p <pattern>`) |
|
|
62
|
+
처음부터 완벽할 필요 없다. 사용자와 대화하면서 점진적으로 정리한다.
|
|
259
63
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
- Include conditions derived from Contract's business rules and Edge Cases.
|
|
263
|
-
- Conditions derived from `constraints` and `errorHandling` may also be included.
|
|
264
|
-
- Recommended format: "조건 X이면 Y이다" (input-result).
|
|
265
|
-
- `testRef`는 `implementing` 단계에서 비워두고, `validating` 단계에서 채운다.
|
|
64
|
+
```markdown
|
|
65
|
+
# {도메인} 비즈니스 로직
|
|
266
66
|
|
|
267
|
-
|
|
268
|
-
- `testRef.target`은 실제로 존재하는 파일 경로만 기재한다. 존재하지 않는 경로(예: `admin/` 접두)는 MISSING 오류 발생.
|
|
269
|
-
- `testRef.pattern`은 `it()/test()` 설명문에서 실제로 매칭되는 문자열을 사용한다. 테스트 작성 전이면 작성 예정 테스트명을 그대로 pattern으로 기입한다.
|
|
270
|
-
- 구현이 완료됐음에도 testRef 경로 오류로 누락처럼 보이는 경우가 있다. `pnpm cdd test` 결과 MISSING/NO_MATCH가 나오면 코드가 아닌 testRef 경로/패턴부터 확인한다.
|
|
67
|
+
## 규칙
|
|
271
68
|
|
|
272
|
-
|
|
69
|
+
- 환불은 결제 후 7일 이내만 가능 [근거: PG사 정책]
|
|
70
|
+
- 주문 상태 전환: 대기 → 확인 → 배송 → 완료
|
|
71
|
+
- 할인 적용 순서: 멤버십 등급 > 쿠폰 > 프로모션
|
|
273
72
|
|
|
274
|
-
|
|
73
|
+
## 워크플로우
|
|
275
74
|
|
|
276
|
-
|
|
277
|
-
|
|
75
|
+
1. ...
|
|
76
|
+
2. ...
|
|
77
|
+
```
|
|
278
78
|
|
|
279
|
-
###
|
|
79
|
+
### Contract 유지 정책
|
|
280
80
|
|
|
281
|
-
|
|
282
|
-
- `sources` field: relative path from the project root (e.g. `"packages/api/src/application/auth/login.ts"`).
|
|
283
|
-
- `dependsOnSpecs` field: relative path from the Spec file (e.g. `"../shared/auth-session.spec.json"`).
|
|
81
|
+
플래닝 중 구현 계획이 기존 contract와 충돌하거나 새로운 도메인 규칙이 드러나면, **구현을 시작하기 전에** 사용자에게 contract 수정을 먼저 제안한다. 오케스트레이터는 contract 업데이트가 필요한 상황을 조용히 넘기지 않는다.
|
|
284
82
|
|
|
285
|
-
###
|
|
83
|
+
### AC = 테스트 이름
|
|
286
84
|
|
|
287
|
-
|
|
85
|
+
AC를 별도 문서로 관리하지 않는다. 테스트 파일의 describe/test 이름이 AC 그 자체다.
|
|
288
86
|
|
|
289
|
-
|
|
87
|
+
**AC 작성 원칙:**
|
|
88
|
+
- **작고 구체적으로**: 하나의 AC = 하나의 행동/결과. 모호한 AC는 구현 범위를 불명확하게 만든다.
|
|
89
|
+
- **입력과 기대 결과를 이름에 담는다**: `"이메일 중복 시 409를 반환한다"` > `"에러를 반환한다"`
|
|
90
|
+
- **AC 작성이 곧 설계**: AC를 먼저 작성하면 구현 전에 인터페이스와 경계 조건이 확정된다.
|
|
290
91
|
|
|
291
|
-
|
|
92
|
+
```typescript
|
|
93
|
+
describe('회원가입', () => {
|
|
94
|
+
// 좋은 AC: 조건과 결과가 명확
|
|
95
|
+
test('이메일 중복 시 409를 반환한다', () => { /* TODO */ });
|
|
96
|
+
test('비밀번호가 8자 미만이면 400을 반환한다', () => { /* TODO */ });
|
|
97
|
+
test('성공 시 생성된 user_id를 반환한다', () => { /* TODO */ });
|
|
292
98
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
99
|
+
// 나쁜 AC: 범위가 너무 넓음
|
|
100
|
+
// test('회원가입이 동작한다', () => { ... });
|
|
101
|
+
});
|
|
296
102
|
```
|
|
297
103
|
|
|
298
|
-
|
|
104
|
+
CLI로 관리:
|
|
299
105
|
|
|
300
|
-
|
|
106
|
+
```bash
|
|
107
|
+
# AC 추가 (빈 테스트 스켈레톤 생성)
|
|
108
|
+
pnpm cdd ac add <파일> [--describe <그룹>] <테스트명>
|
|
301
109
|
|
|
302
|
-
|
|
110
|
+
# AC 목록 조회
|
|
111
|
+
pnpm cdd ac list [파일]
|
|
112
|
+
```
|
|
303
113
|
|
|
304
|
-
### 파일
|
|
114
|
+
### Rules 파일
|
|
305
115
|
|
|
306
116
|
```json
|
|
307
117
|
{
|
|
@@ -318,291 +128,136 @@ git log --follow -- contract/auth/login.spec.json # track renames
|
|
|
318
128
|
```
|
|
319
129
|
|
|
320
130
|
| 필드 | 설명 |
|
|
321
|
-
|
|
322
|
-
| `description` | rule
|
|
323
|
-
| `rules[].id` | 안정적인 식별자
|
|
131
|
+
|------|------|
|
|
132
|
+
| `description` | rule-set의 범위와 의도 |
|
|
133
|
+
| `rules[].id` | 안정적인 식별자 |
|
|
324
134
|
| `rules[].when` | 규칙의 적용 조건 |
|
|
325
|
-
| `rules[].instruction` |
|
|
135
|
+
| `rules[].instruction` | 따라야 할 구체적 지침 |
|
|
326
136
|
| `rules[].examples` | 선택적 코드/사용 예시 |
|
|
327
137
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
- Orchestrator는 phase 라우팅 전에 `contract/rules/`를 확인하고, 현재 작업에 해당하는 `*.rules.json` 파일을 읽는다.
|
|
331
|
-
- Orchestrator는 worker를 스폰할 때 해당 파일 경로를 `rules_paths`로 전달한다.
|
|
332
|
-
- 모든 worker는 변경 작업 시작 전에 `rules_paths`의 각 파일을 읽고, 담당 범위에 맞는 규칙을 적용한다.
|
|
333
|
-
- 작업에 매칭되는 rule 파일이 없거나, 참조된 파일이 누락/형식 오류인 경우 blind하게 진행하지 않고 중단 후 보고한다.
|
|
334
|
-
|
|
335
|
-
---
|
|
336
|
-
|
|
337
|
-
## Development Process
|
|
338
|
-
|
|
339
|
-
All processes follow Waterfall. Each stage starts only after the previous stage is complete. If you need to change a previous stage artifact, go back, update the document first, then re-run downstream stages.
|
|
340
|
-
|
|
341
|
-
### 1. New feature development
|
|
138
|
+
`contract/rules/`에는 `*.known-issues.json`도 선택적으로 둘 수 있다. 알려진 버그, 프레임워크 제약, 임시 우회법 등 "지금 당장은 고칠 수 없지만 알고 있어야 하는 것"을 기록한다. Claim 실행 시 `rules` 필드에 포함하면 서브에이전트가 같은 실수를 반복하지 않는다.
|
|
342
139
|
|
|
343
|
-
```
|
|
344
|
-
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"description": "알려진 이슈 및 우회법",
|
|
143
|
+
"issues": [
|
|
144
|
+
{
|
|
145
|
+
"id": "upload-multipart-form-required",
|
|
146
|
+
"symptom": "@upload 메서드 호출 시 Content-Type: application/json으로 보내면 파일이 누락됨",
|
|
147
|
+
"workaround": "multipart/form-data로 전송해야 함. api.md @upload 패턴 참조"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
345
151
|
```
|
|
346
152
|
|
|
347
|
-
|
|
348
|
-
- Read related `.contract.json` files and identify business requirements for the target feature.
|
|
349
|
-
- Confirm the feature is defined under Contract `Features/Capabilities`.
|
|
350
|
-
- If not defined, propose a Contract update to the user. Continue only after Contract is updated.
|
|
351
|
-
|
|
352
|
-
**Step 2: Spec authoring/fix**
|
|
353
|
-
- Create `{feature-key}.spec.json` in the same folder as related Contract files.
|
|
354
|
-
- Set `status` to `"draft"`.
|
|
355
|
-
- Fill `contracts` with relative paths to base Contract files.
|
|
356
|
-
- Fill `summary` and `description` to clearly state which Contract feature this Spec implements.
|
|
357
|
-
- Fill all structured fields (`modules`, `interfaces`, `dataFlow`, `errorHandling`, `constraints`).
|
|
358
|
-
- Define `acceptanceCriteria` with verifiable completion conditions.
|
|
359
|
-
- Add planned implementation file paths to `sources`.
|
|
360
|
-
- **All fields must be confirmed in this step.** After confirmation, set `status` to `"implementing"` and continue.
|
|
361
|
-
|
|
362
|
-
**Step 3: Code implementation**
|
|
363
|
-
- Implement exactly following the confirmed module structure and interfaces defined in Spec.
|
|
364
|
-
- If a better structure appears during implementation, do not change code first. Go back to Step 2, update Spec first, then implement against the updated Spec.
|
|
365
|
-
- If new files are added or plans change, update `sources` in Spec first.
|
|
366
|
-
|
|
367
|
-
**Step 4: Test authoring and execution**
|
|
368
|
-
- Write tests for implemented code.
|
|
369
|
-
- Add test file paths to `sources`.
|
|
370
|
-
- Run tests and confirm they pass.
|
|
371
|
-
|
|
372
|
-
**Step 5: Consistency validation**
|
|
373
|
-
- Validate that implemented code follows the confirmed Spec exactly.
|
|
374
|
-
- Check whether `modules`, `interfaces`, and `dataFlow` match Spec.
|
|
375
|
-
- Verify all `acceptanceCriteria` items are satisfied in code.
|
|
376
|
-
- **If mismatch exists, fix code.** Spec should not be changed to match code.
|
|
377
|
-
- After all validations pass, set `status` to `"done"` and update `lastModified` to today.
|
|
378
|
-
|
|
379
|
-
### 2. Existing code changes
|
|
380
|
-
|
|
381
|
-
```text
|
|
382
|
-
Impact analysis -> Contract/Spec review -> Spec update/fix -> Code update -> Test execution -> Consistency validation
|
|
383
|
-
```
|
|
153
|
+
---
|
|
384
154
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
-
|
|
401
|
-
|
|
402
|
-
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
**Step 4: Code update**
|
|
406
|
-
- Update code within confirmed Spec scope.
|
|
407
|
-
- If a better structure appears, do not change code first. Go back to Step 3 and update Spec first.
|
|
408
|
-
|
|
409
|
-
**Step 5: Test execution**
|
|
410
|
-
- Confirm existing tests pass.
|
|
411
|
-
- Add/update tests according to the change.
|
|
412
|
-
|
|
413
|
-
**Step 6: Consistency validation**
|
|
414
|
-
- Validate that updated code follows confirmed Spec exactly.
|
|
415
|
-
- Verify all `acceptanceCriteria` items are satisfied.
|
|
416
|
-
- **If mismatch exists, fix code.**
|
|
417
|
-
- 관련 Spec(`dependsOnSpecs`에서 참조하는 Spec 포함), Contract 정합성도 함께 확인한다.
|
|
418
|
-
- After all validations pass, set `status` to `"done"` and update `lastModified` to today.
|
|
419
|
-
|
|
420
|
-
### 3. Bug fixes
|
|
421
|
-
|
|
422
|
-
```text
|
|
423
|
-
Bug analysis -> Related Spec/Contract review -> Spec update/fix (if needed) -> Code fix -> Tests -> Consistency validation
|
|
155
|
+
## 일회성 문서: Claim
|
|
156
|
+
|
|
157
|
+
서브에이전트에 전달하는 작업 지시서. `tmp/claims/`에 YAML로 생성, 완료 후 폐기.
|
|
158
|
+
|
|
159
|
+
```yaml
|
|
160
|
+
id: "C-001"
|
|
161
|
+
type: "surface|test|implement"
|
|
162
|
+
objective: "한 줄 목표"
|
|
163
|
+
context: |
|
|
164
|
+
objective만으로 부족한 배경.
|
|
165
|
+
*.contract.md에서 발췌하거나 플래닝에서 생성.
|
|
166
|
+
scope:
|
|
167
|
+
read: ["참고할 파일 경로"]
|
|
168
|
+
write: ["수정/생성할 파일 경로"]
|
|
169
|
+
ac_targets:
|
|
170
|
+
- "파일경로::describe그룹::테스트명"
|
|
171
|
+
rules:
|
|
172
|
+
- "contract/rules/api.rules.json"
|
|
173
|
+
depends_on: []
|
|
174
|
+
findings: []
|
|
424
175
|
```
|
|
425
176
|
|
|
426
|
-
|
|
427
|
-
|
|
177
|
+
| 필드 | 역할 |
|
|
178
|
+
|------|------|
|
|
179
|
+
| `id` | 추적용 식별자 |
|
|
180
|
+
| `type` | 서브에이전트 종류 결정 |
|
|
181
|
+
| `objective` | 스코프 앵커 — 서브에이전트가 벗어나지 않는 기준 |
|
|
182
|
+
| `context` | 배경 정보. *.contract.md에서 발췌하거나 플래닝에서 생성 |
|
|
183
|
+
| `scope.read` | 컨텍스트 로딩 범위 |
|
|
184
|
+
| `scope.write` | 소유권 경계 — 이 밖의 파일 수정 금지 |
|
|
185
|
+
| `ac_targets` | 만족시킬 AC (`파일::describe::테스트명` 형식) |
|
|
186
|
+
| `rules` | 적용할 규칙 파일 경로 |
|
|
187
|
+
| `depends_on` | 선행 Claim ID |
|
|
188
|
+
| `findings` | 리뷰 실패 시 재시도 컨텍스트 |
|
|
189
|
+
|
|
190
|
+
### type별 역할
|
|
191
|
+
|
|
192
|
+
| type | 역할 | 편집 범위 | 금지 |
|
|
193
|
+
|------|------|----------|------|
|
|
194
|
+
| `surface` | 공유 타입/인터페이스/마이그레이션 등 선행 작업 | 공유 타입, 마이그레이션 | 비즈니스 로직, 테스트 |
|
|
195
|
+
| `test` | AC별 테스트 구현 | 테스트 파일, 테스트 지원 파일 | 프로덕션 코드 |
|
|
196
|
+
| `implement` | AC 작성과 프로덕션 코드를 교차 반복 구현 | 테스트 파일 + 프로덕션 코드 | — |
|
|
197
|
+
|
|
198
|
+
`implement` Claim은 TDD 사이클을 따른다: AC 하나 작성 → 구현 → 테스트 통과 확인 → 다음 AC. AC와 구현이 함께 있는 것이 기본이다. `test` Claim은 구현 없이 테스트 스켈레톤만 필요할 때(선행 설계, 스펙 확정)에만 사용한다.
|
|
428
199
|
|
|
429
|
-
|
|
430
|
-
- Find Spec files whose `sources` include affected files.
|
|
431
|
-
- Classify root cause:
|
|
432
|
-
- Business rule violation -> verify Spec and code against Contract.
|
|
433
|
-
- Implementation bug -> check Spec `errorHandling` and Contract `Edge Cases`.
|
|
434
|
-
- Spec defect -> Spec failed to represent Contract correctly.
|
|
200
|
+
---
|
|
435
201
|
|
|
436
|
-
|
|
437
|
-
- If the bug is a missing technical case in Spec `errorHandling` or `constraints`, update those fields first.
|
|
438
|
-
- If the bug is a missing business case in Contract `Edge Cases`, propose Contract update to user. After Contract update, update Spec.
|
|
439
|
-
- Add missing conditions to `acceptanceCriteria` if applicable.
|
|
440
|
-
- Set `status` to `"implementing"`.
|
|
441
|
-
- **Continue only after Spec is confirmed.**
|
|
202
|
+
## 개발 프로세스 (6단계)
|
|
442
203
|
|
|
443
|
-
|
|
444
|
-
- Fix code according to confirmed Spec.
|
|
204
|
+
### 1. 플래닝
|
|
445
205
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
- Confirm existing tests are not broken.
|
|
206
|
+
`contract/{domain}/*.contract.md`와 **실제 코드**를 함께 참고하여 구현 계획 초안 작성.
|
|
207
|
+
코드와 *.contract.md가 충돌하면 코드를 우선한다 (ground truth). *.contract.md가 오래된 것일 수 있음.
|
|
208
|
+
사용자가 특정 *.contract.md를 지정하면 해당 파일만, 아니면 `contract/**/*.contract.md` 전체를 읽는다.
|
|
450
209
|
|
|
451
|
-
|
|
452
|
-
- Validate that fixed code follows confirmed Spec exactly.
|
|
453
|
-
- Verify all `acceptanceCriteria` items are satisfied.
|
|
454
|
-
- **If mismatch exists, fix code.**
|
|
455
|
-
- After all validations pass, set `status` to `"done"` and update `lastModified` to today.
|
|
210
|
+
### 2. AC 구체화
|
|
456
211
|
|
|
457
|
-
|
|
212
|
+
사용자와 논의하며 `pnpm cdd ac add`로 테스트 스켈레톤 생성.
|
|
213
|
+
`pnpm cdd ac list`로 확정된 AC 목록 확인.
|
|
458
214
|
|
|
459
|
-
|
|
215
|
+
**AC는 작은 단위로 쪼갠다.** Claim 하나에 5~10개의 구체적 AC가 전체를 포괄하는 2~3개보다 낫다. AC 목록이 곧 구현 체크리스트가 된다.
|
|
460
216
|
|
|
461
|
-
|
|
462
|
-
전체 Spec 스캔 -> 누락/불일치 목록 작성 -> 우선순위 정렬 -> 순차 수정
|
|
463
|
-
```
|
|
217
|
+
### 3. 계획 픽스 (Claim 구성)
|
|
464
218
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
- 각 Spec의 `acceptanceCriteria`와 `interfaces`를 기준으로 코드 구현 여부 확인
|
|
468
|
-
- 누락된 API, 잘못된 guard, 미구현 에러 처리 등을 목록으로 정리
|
|
219
|
+
사용자 확인 후 Claim을 `tmp/claims/`에 YAML로 작성.
|
|
220
|
+
`surface` → `implement` 순으로 분해하고 `depends_on`으로 선후관계 명시.
|
|
469
221
|
|
|
470
|
-
|
|
471
|
-
- `contract/spec-vs-code-audit.md` 또는 `.claude/skills/project/spec-audit.md`에 기록
|
|
472
|
-
- 형식: `[domain/feature] 항목 — 상태 (구현됨 / 누락 / 불일치)`
|
|
473
|
-
- 이 파일을 새 세션에서 컨텍스트 복원용으로 활용 가능
|
|
222
|
+
각 `implement` Claim은 독립적으로 완결되어야 한다: AC 작성 + 구현 + 테스트 통과까지.
|
|
474
223
|
|
|
475
|
-
|
|
476
|
-
- 가장 쉽고 확실한 것부터 순서 번호를 붙여 처리
|
|
477
|
-
- 각 항목 완료 시 감사 파일에 완료 표시
|
|
224
|
+
### 4. 실행
|
|
478
225
|
|
|
479
|
-
|
|
480
|
-
-
|
|
481
|
-
- Claude Desktop에서 전체 Spec 스캔 → Claude Code에서 불일치 수정하는 분업 패턴에서 유용
|
|
482
|
-
- 도메인 단위 구현 완료 후 PR 전 최종 점검
|
|
226
|
+
**서브에이전트 모드 (기본)**: `Agent` tool로 워커 스폰.
|
|
227
|
+
- 적합: Claim이 독립적이거나 순차적 작업. 불확실하면 이 모드가 기본값.
|
|
483
228
|
|
|
484
|
-
|
|
229
|
+
**에이전트팀 모드**: `TeamCreate`로 팀 구성, 워커 간 `SendMessage`로 직접 통신.
|
|
230
|
+
- 적합: test-writer와 implementer가 밀결합된 코드를 다룰 때, 워커가 서로의 중간 결과물을 자주 참조할 때.
|
|
485
231
|
|
|
486
|
-
|
|
232
|
+
### 5. 리뷰
|
|
487
233
|
|
|
488
|
-
|
|
234
|
+
모든 implement Claim 완료 후 리뷰어 스폰.
|
|
235
|
+
`findings`가 있으면 해당 Claim의 서브에이전트에 전달하여 재스폰.
|
|
489
236
|
|
|
490
|
-
|
|
491
|
-
- Do not include code, technical jargon, or implementation details.
|
|
492
|
-
- Define project-specific terms in `Domain Glossary`.
|
|
493
|
-
- Each item in `Features/Capabilities` must include clear business rules.
|
|
494
|
-
- `Business Rules/Constraints` should contain only global rules that cross individual features.
|
|
495
|
-
- `Edge Cases` should define business-level boundary conditions and decisions.
|
|
237
|
+
### 6. AC 검증
|
|
496
238
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
- `summary`/`description` must make it clear which Contract feature this Spec implements.
|
|
501
|
-
- `modules` and `interfaces` use `Record<string, string>` format (key: name, value: description).
|
|
502
|
-
- In `interfaces`, include only function/API names and short descriptions (no signatures or implementation logic).
|
|
503
|
-
- `dataFlow` and `constraints` use `string[]` format.
|
|
504
|
-
- `errorHandling` uses `Record<string, string>` format (key: error name, value: trigger condition).
|
|
505
|
-
- `acceptanceCriteria` is an `object[]`. Each item must have `id`, `condition`, `testRef`. `condition` must be a verifiable, specific condition.
|
|
506
|
-
- `sources` must list all related implementation and test files.
|
|
507
|
-
- `contracts` must list relative paths to base Contract files.
|
|
508
|
-
- Empty sections: `[]` for `string[]` fields, `{}` for `Record<string, string>` fields.
|
|
239
|
+
테스트 실행 → 전체 통과 시 완료.
|
|
240
|
+
실패 시 implementer에 실패 로그 전달 → 수정 → 5번부터 반복.
|
|
241
|
+
동일 실패 3회 반복 시 사용자에게 보고.
|
|
509
242
|
|
|
510
243
|
---
|
|
511
244
|
|
|
512
245
|
## CDD CLI (`@sonamu-kit/cdd`)
|
|
513
246
|
|
|
514
|
-
The `cdd` CLI tool automates CDD workflow tasks. Run via `pnpm cdd <command>`.
|
|
515
|
-
|
|
516
|
-
### Commands
|
|
517
|
-
|
|
518
|
-
| Command | Description |
|
|
519
|
-
|---|---|
|
|
520
|
-
| `cdd init [dir]` | Initialize a CDD project (creates `contract/`, `main.contract.json`, `cdd.md`) |
|
|
521
|
-
| `cdd advance <spec> [--commit]` | Gate 검증 + delegate (Layer 1/2). `--commit`: Layer 2 통과 선언 후 즉시 상태 전이 |
|
|
522
|
-
| `cdd tree` | Display Contract/Spec tree grouped by domain with status colors |
|
|
523
|
-
| `cdd status` | Show project dashboard (Contract/Spec counts, status breakdown) |
|
|
524
|
-
| `cdd status <file>` | Spec/Contract status with relationship info (contracts, deps, dependents) |
|
|
525
|
-
| `cdd validate` | Verify schema/path/reference integrity (file existence, path resolution, required fields) |
|
|
526
|
-
| `cdd impact <file>` | Analyze source file change impact (direct Specs, chain Contracts, indirect Specs) |
|
|
527
|
-
| `cdd check` | Verify Code-Spec-Contract consistency + `acceptanceCriteria` fulfillment |
|
|
528
|
-
| `cdd spec create <n>` | Create a Spec template. Requires `--domain <n>` or `--contract <path>` |
|
|
529
|
-
| `cdd contract create [name]` | Contract 템플릿 생성. `name` 미지정 시 `main` |
|
|
530
|
-
| `cdd spec set-status <spec> <status>` | Change Spec status |
|
|
531
|
-
| `cdd rules validate` | `contract/rules/*.rules.json` 포맷 검증 |
|
|
532
|
-
| `cdd spec list` | List Specs. Filters: `--status`, `--domain`, `--contract` |
|
|
533
|
-
| `cdd spec get <spec>` | Show full Spec or a specific field (`--field`) |
|
|
534
|
-
| `cdd spec set <spec>` | Update a Spec field (`--field`, `--value`, `--json`) |
|
|
535
|
-
| `cdd spec add <spec>` | Add an item to an array/map field (`--field`, `--value`, `--key`) |
|
|
536
|
-
| `cdd spec remove <spec>` | Remove an item from an array/map field (`--field`, `--index`/`--value`/`--key`) |
|
|
537
|
-
| `cdd spec blame <feature>` | Contributor analysis per Spec (ownership, score, AI role summary) |
|
|
538
|
-
| `cdd spec log <feature>` | Change timeline grouped by time period and author |
|
|
539
|
-
| `cdd spec explain <feature>` | AI-powered diff analysis: what changed, why, and impact level |
|
|
540
|
-
| `cdd source blame <file>` | Contributor analysis per source file |
|
|
541
|
-
| `cdd source log <file>` | Source file change timeline grouped by time period and author |
|
|
542
|
-
| `cdd source explain <file>` | AI-powered source file diff analysis |
|
|
543
|
-
|
|
544
|
-
### Common Options
|
|
545
|
-
|
|
546
|
-
- `--cwd <dir>` : Set working directory (default: current directory)
|
|
547
|
-
- `--raw` / `--json` : Force raw JSON output (auto-enabled in pipe/CI environments)
|
|
548
|
-
- `-h, --help` : Show help
|
|
549
|
-
|
|
550
|
-
### Git + AI Options (blame, log, explain)
|
|
551
|
-
|
|
552
|
-
- `--since=<date>` : Start date filter (ISO 8601, e.g. `2025-01-01`)
|
|
553
|
-
- `--until=<date>` : End date filter (ISO 8601, default: HEAD)
|
|
554
|
-
- `--group-by=day|week|month` : Grouping interval for `spec log` / `source log` (default: `day`)
|
|
555
|
-
- `--commit=<hash>` : Analyze a single commit for `spec explain` / `source explain`
|
|
556
|
-
|
|
557
|
-
AI uses `claude --model haiku` via local CLI.
|
|
558
|
-
|
|
559
|
-
### Usage Examples
|
|
560
|
-
|
|
561
247
|
```bash
|
|
562
|
-
|
|
563
|
-
pnpm cdd spec list --status in-progress
|
|
564
|
-
|
|
565
|
-
# Show full spec
|
|
566
|
-
pnpm cdd spec get signin
|
|
567
|
-
|
|
568
|
-
# Update a field
|
|
569
|
-
pnpm cdd spec set signin --field summary --value "Updated summary"
|
|
570
|
-
|
|
571
|
-
# Add a constraint
|
|
572
|
-
pnpm cdd spec add signin --field constraints --value "New constraint"
|
|
573
|
-
|
|
574
|
-
# Contributor analysis for a spec
|
|
575
|
-
pnpm cdd spec blame signin
|
|
576
|
-
|
|
577
|
-
# Weekly changelog for a spec
|
|
578
|
-
pnpm cdd spec log signin --group-by=week
|
|
579
|
-
|
|
580
|
-
# Explain changes in a date range
|
|
581
|
-
pnpm cdd spec explain signin --since=2025-03-01
|
|
582
|
-
|
|
583
|
-
# JSON output for scripting
|
|
584
|
-
pnpm cdd spec list --raw | jq '.[].status'
|
|
248
|
+
pnpm cdd <command>
|
|
585
249
|
```
|
|
586
250
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
|
592
|
-
|
|
593
|
-
|
|
|
594
|
-
| Feature split | Keep/delete existing file + create new files, in the same commit |
|
|
595
|
-
| Feature merge | Consolidate into one file, delete the rest, in the same commit |
|
|
596
|
-
| Feature removal | Confirm removal from Contract, delete Spec file with user approval |
|
|
597
|
-
|
|
598
|
-
---
|
|
251
|
+
| 커맨드 | 설명 |
|
|
252
|
+
|--------|------|
|
|
253
|
+
| `cdd init [dir]` | CDD 프로젝트 초기화 (`contract/`, `*.contract.md` 템플릿 생성) |
|
|
254
|
+
| `cdd ac add <파일> <테스트명>` | 테스트 파일에 빈 테스트 스켈레톤 추가. `--describe <그룹>` 옵션으로 describe 블록 지정 |
|
|
255
|
+
| `cdd ac list [파일]` | 테스트 파일의 describe/test 트리 출력 |
|
|
256
|
+
| `cdd validate` | 스키마/경로/참조 무결성 검증 |
|
|
257
|
+
| `cdd rules validate` | `contract/rules/*.rules.json` 포맷 검증 |
|
|
599
258
|
|
|
600
|
-
|
|
259
|
+
### 공통 옵션
|
|
601
260
|
|
|
602
|
-
-
|
|
603
|
-
-
|
|
604
|
-
-
|
|
605
|
-
- Do not include implementation internals, algorithm details, or code snippets in Spec.
|
|
606
|
-
- **Do not start implementation (Entity design) before Spec is confirmed.**
|
|
607
|
-
- **If Spec and code conflict, do not change Spec to match code. Always fix code to match Spec.**
|
|
608
|
-
- **If a better approach appears during implementation, do not change code first. Update Spec first.**
|
|
261
|
+
- `--cwd <dir>`: 작업 디렉토리 지정 (기본값: 현재 디렉토리)
|
|
262
|
+
- `--raw` / `--json`: JSON 출력 강제 (CI 환경에서 자동 활성화)
|
|
263
|
+
- `-h, --help`: 도움말 표시
|