sonamu 0.8.24 → 0.8.26

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.
Files changed (88) hide show
  1. package/dist/api/__tests__/config.test.js +189 -0
  2. package/dist/api/config.d.ts.map +1 -1
  3. package/dist/api/config.js +7 -2
  4. package/dist/api/sonamu.d.ts.map +1 -1
  5. package/dist/api/sonamu.js +14 -10
  6. package/dist/auth/index.d.ts +1 -0
  7. package/dist/auth/index.d.ts.map +1 -1
  8. package/dist/auth/index.js +2 -1
  9. package/dist/auth/knex-adapter.d.ts +23 -0
  10. package/dist/auth/knex-adapter.d.ts.map +1 -0
  11. package/dist/auth/knex-adapter.js +163 -0
  12. package/dist/auth/plugins/wrappers/admin.d.ts +2 -2
  13. package/dist/bin/__tests__/ts-loader-register.test.js +45 -0
  14. package/dist/bin/cli.js +47 -9
  15. package/dist/bin/ts-loader-register.js +3 -29
  16. package/dist/bin/ts-loader-registration.d.ts +2 -0
  17. package/dist/bin/ts-loader-registration.d.ts.map +1 -0
  18. package/dist/bin/ts-loader-registration.js +42 -0
  19. package/dist/cone/cone-generator.js +3 -3
  20. package/dist/database/puri-subset.test-d.js +9 -1
  21. package/dist/database/puri-subset.types.d.ts +1 -1
  22. package/dist/database/puri-subset.types.d.ts.map +1 -1
  23. package/dist/database/puri-subset.types.js +1 -1
  24. package/dist/testing/fixture-generator.js +5 -5
  25. package/dist/ui/ai-client.js +2 -2
  26. package/dist/ui/api.d.ts.map +1 -1
  27. package/dist/ui/api.js +14 -14
  28. package/dist/ui/cdd-service.d.ts +15 -18
  29. package/dist/ui/cdd-service.d.ts.map +1 -1
  30. package/dist/ui/cdd-service.js +246 -222
  31. package/dist/ui/cdd-types.d.ts +41 -68
  32. package/dist/ui/cdd-types.d.ts.map +1 -1
  33. package/dist/ui/cdd-types.js +2 -2
  34. package/dist/ui-web/assets/index-CKo0Z2Iu.css +1 -0
  35. package/dist/ui-web/assets/{index-CxiydzeC.js → index-DK-2aacv.js} +83 -83
  36. package/dist/ui-web/index.html +2 -2
  37. package/package.json +6 -2
  38. package/src/api/__tests__/config.test.ts +225 -0
  39. package/src/api/config.ts +10 -4
  40. package/src/api/sonamu.ts +16 -13
  41. package/src/auth/index.ts +1 -0
  42. package/src/auth/knex-adapter.ts +208 -0
  43. package/src/bin/__tests__/ts-loader-register.test.ts +62 -0
  44. package/src/bin/cli.ts +52 -9
  45. package/src/bin/ts-loader-register.ts +2 -32
  46. package/src/bin/ts-loader-registration.ts +55 -0
  47. package/src/cone/cone-generator.ts +2 -2
  48. package/src/database/puri-subset.test-d.ts +102 -0
  49. package/src/database/puri-subset.types.ts +1 -1
  50. package/src/skills/commands/sonamu-skills.md +20 -0
  51. package/src/skills/sonamu/SKILL.md +179 -137
  52. package/src/skills/sonamu/ai-agents.md +69 -69
  53. package/src/skills/sonamu/api.md +147 -147
  54. package/src/skills/sonamu/auth-migration.md +220 -220
  55. package/src/skills/sonamu/auth-plugins.md +83 -83
  56. package/src/skills/sonamu/auth.md +106 -106
  57. package/src/skills/sonamu/cdd.md +65 -200
  58. package/src/skills/sonamu/cone.md +138 -138
  59. package/src/skills/sonamu/config.md +191 -191
  60. package/src/skills/sonamu/create-sonamu.md +66 -66
  61. package/src/skills/sonamu/database.md +158 -158
  62. package/src/skills/sonamu/entity-basic.md +292 -293
  63. package/src/skills/sonamu/entity-relations.md +246 -246
  64. package/src/skills/sonamu/entity-validation-checklist.md +124 -124
  65. package/src/skills/sonamu/fixture-cli.md +231 -231
  66. package/src/skills/sonamu/framework-change.md +37 -37
  67. package/src/skills/sonamu/frontend.md +223 -223
  68. package/src/skills/sonamu/i18n.md +82 -82
  69. package/src/skills/sonamu/migration.md +77 -77
  70. package/src/skills/sonamu/model.md +222 -222
  71. package/src/skills/sonamu/naite.md +86 -86
  72. package/src/skills/sonamu/project-init.md +228 -228
  73. package/src/skills/sonamu/puri.md +122 -122
  74. package/src/skills/sonamu/scaffolding.md +154 -154
  75. package/src/skills/sonamu/skill-contribution.md +124 -124
  76. package/src/skills/sonamu/subset.md +46 -46
  77. package/src/skills/sonamu/tasks.md +82 -82
  78. package/src/skills/sonamu/testing-devrunner.md +147 -147
  79. package/src/skills/sonamu/testing.md +673 -673
  80. package/src/skills/sonamu/upsert.md +79 -79
  81. package/src/skills/sonamu/vector.md +67 -67
  82. package/src/testing/fixture-generator.ts +4 -4
  83. package/src/ui/ai-client.ts +1 -1
  84. package/src/ui/api.ts +18 -17
  85. package/src/ui/cdd-service.ts +264 -254
  86. package/src/ui/cdd-types.ts +40 -75
  87. package/dist/ui-web/assets/index-BrQKU3j9.css +0 -1
  88. package/src/skills/sonamu/workflow.md +0 -317
@@ -1,150 +1,87 @@
1
1
  ---
2
2
  name: sonamu-cdd
3
- description: AC + Claim 기반 개발 가이드. *.contract.md(도메인 규칙), Rules, AC(테스트명), Claim(작업 지시서). 기능 구현 반드시 읽을 것. Use when planning or implementing features.
3
+ description: CDD artifact technical reference. contract.md format, rules.json format, AC patterns, CDD CLI commands. Read when you need to write CDD artifacts or use the CLI during CDD work.
4
4
  ---
5
5
 
6
- # AC + Claim 기반 개발
7
-
8
- Spec 문서 없이 **3종의 영구 문서 + 일회성 Claim**으로 개발한다.
9
-
10
- **Ground truth는 코드다.** `*.contract.md`는 코드 결정의 근거를 기록하는 문서이지 선행 정의서가 아니다.
11
-
12
- ## 두 가지 개발 경로
13
-
14
- | 경로 | 순서 | 적용 상황 |
15
- |------|------|----------|
16
- | **신규 개발** | contract 작성 → Claim → `(AC → implement) × N` | 새 기능, 새 도메인 |
17
- | **코드 변경** | code 수정 → Claim 등록 → contract 확인/갱신 | 기존 기능 수정, 버그 픽스 |
18
-
19
- **Claim은 유닛 단위다.** Claim 안에서 AC 작성과 구현은 교차 반복된다.
20
-
21
- ```
22
- Claim C-001
23
- ├─ AC: "이메일 중복 시 409를 반환한다" → 구현
24
- ├─ AC: "비밀번호가 8자 미만이면 400을 반환한다" → 구현
25
- └─ AC: "성공 시 생성된 user_id를 반환한다" → 구현
26
- ```
27
-
28
- AC 하나를 작성하는 행위는 그 자체로 설계 행위다 — 어떤 입력/출력을 기대하는지 명확히 함으로써 구현 방향을 먼저 확정한다. AC가 작고 구체적일수록 구현이 명확해진다.
29
-
30
- 코드 변경 경로에서 `*.contract.md`를 갱신할 때는 변경 이유(근거)를 함께 기록한다.
6
+ # CDD Artifact Technical Reference
31
7
 
32
8
  ---
33
9
 
34
- ## 영구 문서 (3종)
35
-
36
- | 문서 | 위치 | 내용 | 갱신 시점 |
37
- |------|------|------|----------|
38
- | 비즈니스 로직 | `contract/**/*.contract.md` | 도메인 규칙 + 결정 근거 | 정책 변경 시 |
39
- | Rules | `contract/rules/*.rules.json` | 코드 컨벤션, UI/API 규칙 | 컨벤션 변경 시 |
40
- | AC | `*.test.ts` describe/test 이름 | 수락 기준 — 코드에 직접 존재 | 기능 추가/변경 시 |
41
-
42
- ### 비즈니스 로직 (`*.contract.md`)
43
-
44
- 비즈니스 로직은 코드에 전부 존재한다. 하지만 코드에서는 여러 파일에 분산되어 있고 구현 디테일과 섞여 있어서 도메인 규칙만 골라 읽기 어렵다. `*.contract.md`의 역할은:
45
-
46
- > 비즈니스 로직을 도메인 수준에서 응집된 형태로 기술하고, 코드만으로는 파악하기 어려운 결정 근거를 함께 기록한다.
10
+ ## Business Logic (`*.contract.md`)
47
11
 
48
- **들어가야 하는 것:**
49
- - 도메인 규칙과 제약 ("환불은 결제 후 7일 이내만 가능")
50
- - 결정 근거 ("PG사 정책 때문")
51
- - 여러 모듈에 걸친 도메인 워크플로우 ("주문 상태: 대기 → 확인 → 배송 → 완료")
52
- - 우선순위/순서 규칙 ("할인: 멤버십 등급 > 쿠폰 > 프로모션")
53
- - 도메인 용어 정의, 역할 구분
54
- - Edge case와 의도된 처리 방식
12
+ Documents domain rules and decision rationale in a cohesive form. Located at `contract/**/*.contract.md`.
55
13
 
56
- **들어가지 않는 것:**
57
- - 구현 디테일 (파일 경로, 함수명, 클래스 구조)
58
- - API 엔드포인트나 데이터 스키마
59
- - UI 레이아웃이나 컴포넌트 구조
60
- - 코드 컨벤션 (이건 `*.rules.json`에)
14
+ **Include:**
15
+ - Domain rules and constraints ("Refunds are only allowed within 7 days of payment")
16
+ - Decision rationale ("Due to PG provider policy")
17
+ - Cross-module domain workflows ("Order status: pending → confirmed → shipped → completed")
18
+ - Priority/ordering rules ("Discounts: membership tier > coupon > promotion")
19
+ - Domain term definitions and role distinctions
20
+ - Edge cases and intended handling
61
21
 
62
- 처음부터 완벽할 필요 없다. 사용자와 대화하면서 점진적으로 정리한다.
22
+ **Exclude:**
23
+ - Implementation details (file paths, function names, class structure)
24
+ - API endpoints or data schemas
25
+ - UI layouts or component structure
26
+ - Code conventions (those go in `*.rules.json`)
63
27
 
64
28
  ```markdown
65
- # {도메인} 비즈니스 로직
29
+ # {Domain} Business Logic
66
30
 
67
- ## 규칙
31
+ ## Rules
68
32
 
69
- - 환불은 결제 7 이내만 가능 [근거: PG 정책]
70
- - 주문 상태 전환: 대기확인배송완료
71
- - 할인 적용 순서: 멤버십 등급 > 쿠폰 > 프로모션
33
+ - Refunds are only allowed within 7 days of payment [Rationale: PG provider policy]
34
+ - Order status transitions: pendingconfirmedshippedcompleted
35
+ - Discount application order: membership tier > coupon > promotion
72
36
 
73
- ## 워크플로우
37
+ ## Workflow
74
38
 
75
39
  1. ...
76
40
  2. ...
77
41
  ```
78
42
 
79
- ### Contract 유지 정책
80
-
81
- 플래닝 중 구현 계획이 기존 contract와 충돌하거나 새로운 도메인 규칙이 드러나면, **구현을 시작하기 전에** 사용자에게 contract 수정을 먼저 제안한다. 오케스트레이터는 contract 업데이트가 필요한 상황을 조용히 넘기지 않는다.
82
-
83
- ### AC = 테스트 이름
84
-
85
- AC를 별도 문서로 관리하지 않는다. 테스트 파일의 describe/test 이름이 AC 그 자체다.
86
-
87
- **AC 작성 원칙:**
88
- - **작고 구체적으로**: 하나의 AC = 하나의 행동/결과. 모호한 AC는 구현 범위를 불명확하게 만든다.
89
- - **입력과 기대 결과를 이름에 담는다**: `"이메일 중복 시 409를 반환한다"` > `"에러를 반환한다"`
90
- - **AC 작성이 곧 설계**: AC를 먼저 작성하면 구현 전에 인터페이스와 경계 조건이 확정된다.
91
-
92
- ```typescript
93
- describe('회원가입', () => {
94
- // 좋은 AC: 조건과 결과가 명확
95
- test('이메일 중복 시 409를 반환한다', () => { /* TODO */ });
96
- test('비밀번호가 8자 미만이면 400을 반환한다', () => { /* TODO */ });
97
- test('성공 시 생성된 user_id를 반환한다', () => { /* TODO */ });
98
-
99
- // 나쁜 AC: 범위가 너무 넓음
100
- // test('회원가입이 동작한다', () => { ... });
101
- });
102
- ```
103
-
104
- CLI로 관리:
43
+ ---
105
44
 
106
- ```bash
107
- # AC 추가 (빈 테스트 스켈레톤 생성)
108
- pnpm cdd ac add <파일> [--describe <그룹>] <테스트명>
45
+ ## Rules Files (`contract/rules/`)
109
46
 
110
- # AC 목록 조회
111
- pnpm cdd ac list [파일]
112
- ```
47
+ ### `*.rules.json`
113
48
 
114
- ### Rules 파일
49
+ Records code conventions and UI/API rules.
115
50
 
116
51
  ```json
117
52
  {
118
- "description": "Rule-set의 범위와 목적 설명",
53
+ "description": "Scope and purpose of this rule-set",
119
54
  "rules": [
120
55
  {
121
56
  "id": "readonly-money-display-uses-numf",
122
- "when": "금액을 읽기 전용 텍스트나 테이블 셀로 표시할 ",
123
- "instruction": "numF()를 적용합니다.",
57
+ "when": "Displaying a monetary value as read-only text or a table cell",
58
+ "instruction": "Apply numF().",
124
59
  "examples": ["numF(row.totalAmount)", "numF(summary.budget)"]
125
60
  }
126
61
  ]
127
62
  }
128
63
  ```
129
64
 
130
- | 필드 | 설명 |
131
- |------|------|
132
- | `description` | rule-set 범위와 의도 |
133
- | `rules[].id` | 안정적인 식별자 |
134
- | `rules[].when` | 규칙의 적용 조건 |
135
- | `rules[].instruction` | 따라야 구체적 지침 |
136
- | `rules[].examples` | 선택적 코드/사용 예시 |
65
+ | Field | Description |
66
+ |-------|-------------|
67
+ | `description` | Scope and intent of the rule-set |
68
+ | `rules[].id` | Stable identifier |
69
+ | `rules[].when` | Condition under which the rule applies |
70
+ | `rules[].instruction` | Specific directive to follow |
71
+ | `rules[].examples` | Optional code/usage examples |
137
72
 
138
- `contract/rules/`에는 `*.known-issues.json`도 선택적으로 둘 수 있다. 알려진 버그, 프레임워크 제약, 임시 우회법 등 "지금 당장은 고칠 수 없지만 알고 있어야 하는 것"을 기록한다. Claim 실행 시 `rules` 필드에 포함하면 서브에이전트가 같은 실수를 반복하지 않는다.
73
+ ### `*.known-issues.json`
74
+
75
+ Records known bugs, framework constraints, and temporary workarounds. Include in a Claim's `rules` field so sub-agents don't repeat the same mistakes.
139
76
 
140
77
  ```json
141
78
  {
142
- "description": "알려진 이슈 우회법",
79
+ "description": "Known issues and workarounds",
143
80
  "issues": [
144
81
  {
145
82
  "id": "upload-multipart-form-required",
146
- "symptom": "@upload 메서드 호출 Content-Type: application/json으로 보내면 파일이 누락됨",
147
- "workaround": "multipart/form-data 전송해야 함. api.md @upload 패턴 참조"
83
+ "symptom": "Calling an @upload method with Content-Type: application/json causes the file to be missing",
84
+ "workaround": "Must send as multipart/form-data. See the @upload pattern in api.md"
148
85
  }
149
86
  ]
150
87
  }
@@ -152,93 +89,21 @@ pnpm cdd ac list [파일]
152
89
 
153
90
  ---
154
91
 
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: []
175
- ```
176
-
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은 구현 없이 테스트 스켈레톤만 필요할 때(선행 설계, 스펙 확정)에만 사용한다.
199
-
200
- ---
201
-
202
- ## 개발 프로세스 (6단계)
203
-
204
- ### 1. 플래닝
205
-
206
- `contract/{domain}/*.contract.md`와 **실제 코드**를 함께 참고하여 구현 계획 초안 작성.
207
- 코드와 *.contract.md가 충돌하면 코드를 우선한다 (ground truth). *.contract.md가 오래된 것일 수 있음.
208
- 사용자가 특정 *.contract.md를 지정하면 해당 파일만, 아니면 `contract/**/*.contract.md` 전체를 읽는다.
92
+ ## AC = Test Names
209
93
 
210
- ### 2. AC 구체화
94
+ ACs are not managed as separate documents. The describe/test names in test files are the ACs themselves.
211
95
 
212
- 사용자와 논의하며 `pnpm cdd ac add`로 테스트 스켈레톤 생성.
213
- `pnpm cdd ac list`로 확정된 AC 목록 확인.
96
+ **AC writing principles:**
97
+ - **Small and specific**: one AC = one behavior/outcome
98
+ - **Include input and expected result in the name**: `"Returns 409 when email is duplicate"` > `"Returns an error"`
214
99
 
215
- **AC는 작은 단위로 쪼갠다.** Claim 하나에 5~10개의 구체적 AC가 전체를 포괄하는 2~3개보다 낫다. AC 목록이 곧 구현 체크리스트가 된다.
216
-
217
- ### 3. 계획 픽스 (Claim 구성)
218
-
219
- 사용자 확인 Claim을 `tmp/claims/`에 YAML로 작성.
220
- `surface` → `implement` 순으로 분해하고 `depends_on`으로 선후관계 명시.
221
-
222
- 각 `implement` Claim은 독립적으로 완결되어야 한다: AC 작성 + 구현 + 테스트 통과까지.
223
-
224
- ### 4. 실행
225
-
226
- **서브에이전트 모드 (기본)**: `Agent` tool로 워커 스폰.
227
- - 적합: Claim이 독립적이거나 순차적 작업. 불확실하면 이 모드가 기본값.
228
-
229
- **에이전트팀 모드**: `TeamCreate`로 팀 구성, 워커 간 `SendMessage`로 직접 통신.
230
- - 적합: test-writer와 implementer가 밀결합된 코드를 다룰 때, 워커가 서로의 중간 결과물을 자주 참조할 때.
231
-
232
- ### 5. 리뷰
233
-
234
- 모든 implement Claim 완료 후 리뷰어 스폰.
235
- `findings`가 있으면 해당 Claim의 서브에이전트에 전달하여 재스폰.
236
-
237
- ### 6. AC 검증
238
-
239
- 테스트 실행 → 전체 통과 시 완료.
240
- 실패 시 implementer에 실패 로그 전달 → 수정 → 5번부터 반복.
241
- 동일 실패 3회 반복 시 사용자에게 보고.
100
+ ```typescript
101
+ describe('sign up', () => {
102
+ test('returns 409 when email is duplicate', () => { /* TODO */ });
103
+ test('returns 400 when password is shorter than 8 characters', () => { /* TODO */ });
104
+ test('returns the created user_id on success', () => { /* TODO */ });
105
+ });
106
+ ```
242
107
 
243
108
  ---
244
109
 
@@ -248,16 +113,16 @@ findings: []
248
113
  pnpm cdd <command>
249
114
  ```
250
115
 
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` 포맷 검증 |
116
+ | Command | Description |
117
+ |---------|-------------|
118
+ | `cdd ac add <file> <test-name>` | Add an empty test skeleton to a test file. Use `--describe <group>` to specify a describe block |
119
+ | `cdd ac list [file]` | Print the describe/test tree of a test file. Parses `test()`, `it()`, and `testAs()` patterns |
120
+ | `cdd rules validate` | Validate the format of `contract/rules/*.rules.json` |
121
+ | `cdd agents init [--force]` | Initialize CDD agent setup in the project (creates `.agents/`, `AGENTS.md`, and symlinks) |
122
+ | `cdd agents sync [--dry-run]` | Update CDD agent prompts to the latest version |
258
123
 
259
- ### 공통 옵션
124
+ ### Common options
260
125
 
261
- - `--cwd <dir>`: 작업 디렉토리 지정 (기본값: 현재 디렉토리)
262
- - `--raw` / `--json`: JSON 출력 강제 (CI 환경에서 자동 활성화)
263
- - `-h, --help`: 도움말 표시
126
+ - `--cwd <dir>`: Set working directory (default: current directory)
127
+ - `--raw` / `--json`: Force JSON output (enabled automatically in CI)
128
+ - `-h, --help`: Show help