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.
- package/dist/api/__tests__/config.test.js +189 -0
- package/dist/api/config.d.ts.map +1 -1
- package/dist/api/config.js +7 -2
- package/dist/api/sonamu.d.ts.map +1 -1
- package/dist/api/sonamu.js +14 -10
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +2 -1
- package/dist/auth/knex-adapter.d.ts +23 -0
- package/dist/auth/knex-adapter.d.ts.map +1 -0
- package/dist/auth/knex-adapter.js +163 -0
- package/dist/auth/plugins/wrappers/admin.d.ts +2 -2
- package/dist/bin/__tests__/ts-loader-register.test.js +45 -0
- package/dist/bin/cli.js +47 -9
- package/dist/bin/ts-loader-register.js +3 -29
- package/dist/bin/ts-loader-registration.d.ts +2 -0
- package/dist/bin/ts-loader-registration.d.ts.map +1 -0
- package/dist/bin/ts-loader-registration.js +42 -0
- package/dist/cone/cone-generator.js +3 -3
- package/dist/database/puri-subset.test-d.js +9 -1
- package/dist/database/puri-subset.types.d.ts +1 -1
- package/dist/database/puri-subset.types.d.ts.map +1 -1
- package/dist/database/puri-subset.types.js +1 -1
- package/dist/testing/fixture-generator.js +5 -5
- package/dist/ui/ai-client.js +2 -2
- package/dist/ui/api.d.ts.map +1 -1
- package/dist/ui/api.js +14 -14
- package/dist/ui/cdd-service.d.ts +15 -18
- package/dist/ui/cdd-service.d.ts.map +1 -1
- package/dist/ui/cdd-service.js +246 -222
- package/dist/ui/cdd-types.d.ts +41 -68
- package/dist/ui/cdd-types.d.ts.map +1 -1
- package/dist/ui/cdd-types.js +2 -2
- package/dist/ui-web/assets/index-CKo0Z2Iu.css +1 -0
- package/dist/ui-web/assets/{index-CxiydzeC.js → index-DK-2aacv.js} +83 -83
- package/dist/ui-web/index.html +2 -2
- package/package.json +6 -2
- package/src/api/__tests__/config.test.ts +225 -0
- package/src/api/config.ts +10 -4
- package/src/api/sonamu.ts +16 -13
- package/src/auth/index.ts +1 -0
- package/src/auth/knex-adapter.ts +208 -0
- package/src/bin/__tests__/ts-loader-register.test.ts +62 -0
- package/src/bin/cli.ts +52 -9
- package/src/bin/ts-loader-register.ts +2 -32
- package/src/bin/ts-loader-registration.ts +55 -0
- package/src/cone/cone-generator.ts +2 -2
- package/src/database/puri-subset.test-d.ts +102 -0
- package/src/database/puri-subset.types.ts +1 -1
- package/src/skills/commands/sonamu-skills.md +20 -0
- package/src/skills/sonamu/SKILL.md +179 -137
- package/src/skills/sonamu/ai-agents.md +69 -69
- package/src/skills/sonamu/api.md +147 -147
- package/src/skills/sonamu/auth-migration.md +220 -220
- package/src/skills/sonamu/auth-plugins.md +83 -83
- package/src/skills/sonamu/auth.md +106 -106
- package/src/skills/sonamu/cdd.md +65 -200
- package/src/skills/sonamu/cone.md +138 -138
- package/src/skills/sonamu/config.md +191 -191
- package/src/skills/sonamu/create-sonamu.md +66 -66
- package/src/skills/sonamu/database.md +158 -158
- package/src/skills/sonamu/entity-basic.md +292 -293
- package/src/skills/sonamu/entity-relations.md +246 -246
- package/src/skills/sonamu/entity-validation-checklist.md +124 -124
- package/src/skills/sonamu/fixture-cli.md +231 -231
- package/src/skills/sonamu/framework-change.md +37 -37
- package/src/skills/sonamu/frontend.md +223 -223
- package/src/skills/sonamu/i18n.md +82 -82
- package/src/skills/sonamu/migration.md +77 -77
- package/src/skills/sonamu/model.md +222 -222
- package/src/skills/sonamu/naite.md +86 -86
- package/src/skills/sonamu/project-init.md +228 -228
- package/src/skills/sonamu/puri.md +122 -122
- package/src/skills/sonamu/scaffolding.md +154 -154
- package/src/skills/sonamu/skill-contribution.md +124 -124
- package/src/skills/sonamu/subset.md +46 -46
- package/src/skills/sonamu/tasks.md +82 -82
- package/src/skills/sonamu/testing-devrunner.md +147 -147
- package/src/skills/sonamu/testing.md +673 -673
- package/src/skills/sonamu/upsert.md +79 -79
- package/src/skills/sonamu/vector.md +67 -67
- package/src/testing/fixture-generator.ts +4 -4
- package/src/ui/ai-client.ts +1 -1
- package/src/ui/api.ts +18 -17
- package/src/ui/cdd-service.ts +264 -254
- package/src/ui/cdd-types.ts +40 -75
- package/dist/ui-web/assets/index-BrQKU3j9.css +0 -1
- package/src/skills/sonamu/workflow.md +0 -317
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sonamu-entity-validation-checklist
|
|
3
|
-
description:
|
|
3
|
+
description: Required validation checklist after entity creation. Covers entity.json validation (index type, Subset FieldExpr, duplicate columns, Boolean dbDefault), required file generation, sync, migration, and scaffolding steps. Use when entity.json validation fails or verifying entity creation steps.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Entity
|
|
6
|
+
# Entity Creation Validation Checklist
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
After creating an entity, you must perform the following steps in order. Skipping any step will cause scaffolding errors.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Overall Workflow
|
|
11
11
|
|
|
12
12
|
```
|
|
13
|
-
1. stub
|
|
14
|
-
2. entity.json
|
|
15
|
-
3.
|
|
16
|
-
4. model.ts, types.ts
|
|
17
|
-
5. sync
|
|
18
|
-
6. migration
|
|
19
|
-
7. migration
|
|
20
|
-
8. scaffolding
|
|
13
|
+
1. Generate stub
|
|
14
|
+
2. Write entity.json
|
|
15
|
+
3. Run automated validation (this checklist)
|
|
16
|
+
4. Create model.ts, types.ts
|
|
17
|
+
5. Run sync
|
|
18
|
+
6. Create migration
|
|
19
|
+
7. Apply migration
|
|
20
|
+
8. Run scaffolding
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
## PHASE 1: entity.json
|
|
23
|
+
## PHASE 1: entity.json Validation (Before Sync)
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Immediately after writing your entity.json file, validate the following **before running sync**.
|
|
26
26
|
|
|
27
|
-
### 1.1 Index
|
|
27
|
+
### 1.1 Index Validation
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
**Does every index have a `type` field?**
|
|
30
30
|
|
|
31
31
|
```json
|
|
32
32
|
// DO NOT - Incorrect
|
|
@@ -40,50 +40,50 @@ Entity.json 파일을 작성한 직후, **sync 실행 전에** 다음을 검증
|
|
|
40
40
|
]
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
**How to validate:**
|
|
44
44
|
```bash
|
|
45
|
-
#
|
|
45
|
+
# Find indexes without type in all entity.json files
|
|
46
46
|
grep -r '"indexes"' packages/api/src/application/*/\*.entity.json | \
|
|
47
47
|
xargs -I {} sh -c 'grep -L "\"type\":" {}'
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
### 1.2 Subset
|
|
50
|
+
### 1.2 Subset Validation
|
|
51
51
|
|
|
52
|
-
**
|
|
52
|
+
**Are you avoiding direct foreign key references?**
|
|
53
53
|
|
|
54
54
|
```json
|
|
55
|
-
// DO NOT - Incorrect: foreign key
|
|
55
|
+
// DO NOT - Incorrect: direct foreign key reference
|
|
56
56
|
"subsets": {
|
|
57
57
|
"A": ["id", "user_id", "task_id"]
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
// DO - Correct:
|
|
60
|
+
// DO - Correct: reference through relation (Sonamu auto-optimizes when only .id is referenced)
|
|
61
61
|
"subsets": {
|
|
62
62
|
"A": ["id", "user.id", "task.id"]
|
|
63
63
|
}
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
**Rules:**
|
|
67
67
|
- `{relation_name}_id` → `{relation_name}.id`
|
|
68
|
-
- BelongsToOne relation
|
|
69
|
-
- Sonamu
|
|
68
|
+
- If a BelongsToOne relation exists, always use `relation.id` format
|
|
69
|
+
- Sonamu optimizes by reading the FK column directly and skipping JOINs when only `.id` is referenced
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
**How to validate:**
|
|
72
72
|
```bash
|
|
73
|
-
#
|
|
73
|
+
# Find subset fields ending in _id in entity.json
|
|
74
74
|
grep -A 20 '"subsets"' your-entity.entity.json | grep '_id"'
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
**Reference working code:**
|
|
78
78
|
- `sonamu/examples/miomock/api/src/application/project/project.entity.json`
|
|
79
79
|
- `sonamu/examples/miomock/api/src/application/employee/employee.entity.json`
|
|
80
80
|
|
|
81
|
-
### 1.3 Subset A
|
|
81
|
+
### 1.3 Subset A Completeness Validation
|
|
82
82
|
|
|
83
|
-
**Subset A
|
|
83
|
+
**Does Subset A include all fields?**
|
|
84
84
|
|
|
85
85
|
```json
|
|
86
|
-
// DO - Correct:
|
|
86
|
+
// DO - Correct: all props included
|
|
87
87
|
{
|
|
88
88
|
"props": [
|
|
89
89
|
{ "name": "id" },
|
|
@@ -103,20 +103,20 @@ grep -A 20 '"subsets"' your-entity.entity.json | grep '_id"'
|
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
- [ ]
|
|
108
|
-
- [ ]
|
|
109
|
-
- [ ] nullable
|
|
106
|
+
**Validation checklist:**
|
|
107
|
+
- [ ] All regular fields included
|
|
108
|
+
- [ ] All relations include at least `.id`
|
|
109
|
+
- [ ] Non-nullable relations also include required fields
|
|
110
110
|
|
|
111
|
-
### 1.4
|
|
111
|
+
### 1.4 Duplicate Column Validation
|
|
112
112
|
|
|
113
|
-
**BelongsToOne
|
|
113
|
+
**Are BelongsToOne relations and their foreign keys not defined twice?**
|
|
114
114
|
|
|
115
115
|
```json
|
|
116
|
-
// DO NOT - Incorrect:
|
|
116
|
+
// DO NOT - Incorrect: duplicate definition
|
|
117
117
|
{
|
|
118
118
|
"props": [
|
|
119
|
-
{ "name": "user_id", "type": "integer" }, //
|
|
119
|
+
{ "name": "user_id", "type": "integer" }, // should be removed
|
|
120
120
|
{
|
|
121
121
|
"type": "relation",
|
|
122
122
|
"name": "user",
|
|
@@ -126,7 +126,7 @@ grep -A 20 '"subsets"' your-entity.entity.json | grep '_id"'
|
|
|
126
126
|
]
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
// DO - Correct: relation
|
|
129
|
+
// DO - Correct: define relation only
|
|
130
130
|
{
|
|
131
131
|
"props": [
|
|
132
132
|
{
|
|
@@ -139,16 +139,16 @@ grep -A 20 '"subsets"' your-entity.entity.json | grep '_id"'
|
|
|
139
139
|
}
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
**How to validate:**
|
|
143
143
|
```bash
|
|
144
|
-
# BelongsToOne relation
|
|
144
|
+
# Check if a BelongsToOne relation also has an _id field
|
|
145
145
|
grep -A 5 '"relationType": "BelongsToOne"' your-entity.entity.json
|
|
146
146
|
grep '"name": ".*_id"' your-entity.entity.json
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
### 1.5 Boolean dbDefault
|
|
149
|
+
### 1.5 Boolean dbDefault Validation
|
|
150
150
|
|
|
151
|
-
**
|
|
151
|
+
**Is the dbDefault for Boolean types the string "true"/"false"?**
|
|
152
152
|
|
|
153
153
|
```json
|
|
154
154
|
// DO NOT - Incorrect
|
|
@@ -160,31 +160,31 @@ grep '"name": ".*_id"' your-entity.entity.json
|
|
|
160
160
|
{ "name": "is_deleted", "type": "boolean", "dbDefault": "false" }
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
### 1.6 OrderBy Enum
|
|
163
|
+
### 1.6 OrderBy Enum Validation
|
|
164
164
|
|
|
165
|
-
**OrderBy enum
|
|
165
|
+
**Does the OrderBy enum contain only `id-desc`?**
|
|
166
166
|
|
|
167
167
|
```json
|
|
168
|
-
// DO NOT - Incorrect: scaffolding
|
|
168
|
+
// DO NOT - Incorrect: causes scaffolding errors!
|
|
169
169
|
"enums": {
|
|
170
170
|
"ProductOrderBy": {
|
|
171
|
-
"id-desc": "ID
|
|
172
|
-
"name-asc": "
|
|
173
|
-
"created_at-desc": "
|
|
171
|
+
"id-desc": "ID Latest",
|
|
172
|
+
"name-asc": "By Name",
|
|
173
|
+
"created_at-desc": "By Registration Date"
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
// DO - Correct
|
|
178
178
|
"enums": {
|
|
179
|
-
"ProductOrderBy": { "id-desc": "ID
|
|
179
|
+
"ProductOrderBy": { "id-desc": "ID Latest" }
|
|
180
180
|
}
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
**Reason:** The model code generated by scaffolding only handles `id-desc`.
|
|
184
184
|
|
|
185
|
-
### 1.7 Enum dbDefault
|
|
185
|
+
### 1.7 Enum dbDefault Validation
|
|
186
186
|
|
|
187
|
-
**
|
|
187
|
+
**Is the dbDefault for Enum types wrapped in escaped double quotes?**
|
|
188
188
|
|
|
189
189
|
```json
|
|
190
190
|
// DO NOT - Incorrect
|
|
@@ -195,36 +195,36 @@ grep '"name": ".*_id"' your-entity.entity.json
|
|
|
195
195
|
{ "name": "status", "type": "enum", "id": "Status", "dbDefault": "\"pending\"" }
|
|
196
196
|
```
|
|
197
197
|
|
|
198
|
-
## PHASE 2:
|
|
198
|
+
## PHASE 2: Required File Generation Validation
|
|
199
199
|
|
|
200
|
-
### 2.1 model.ts
|
|
200
|
+
### 2.1 model.ts File Creation
|
|
201
201
|
|
|
202
|
-
**entity
|
|
202
|
+
**Does the entity folder contain a `{entity}.model.ts` file?**
|
|
203
203
|
|
|
204
204
|
```bash
|
|
205
|
-
#
|
|
205
|
+
# Check
|
|
206
206
|
ls packages/api/src/application/your-entity/your-entity.model.ts
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
|
|
209
|
+
**If missing, manual creation is required** (refer to another entity's model.ts)
|
|
210
210
|
|
|
211
|
-
|
|
211
|
+
Required methods:
|
|
212
212
|
- `findById`
|
|
213
213
|
- `findOne`
|
|
214
214
|
- `findMany`
|
|
215
215
|
- `save`
|
|
216
216
|
- `del`
|
|
217
217
|
|
|
218
|
-
### 2.2 types.ts
|
|
218
|
+
### 2.2 types.ts File Creation
|
|
219
219
|
|
|
220
|
-
**entity
|
|
220
|
+
**Does the entity folder contain a `{entity}.types.ts` file?**
|
|
221
221
|
|
|
222
222
|
```bash
|
|
223
|
-
#
|
|
223
|
+
# Check
|
|
224
224
|
ls packages/api/src/application/your-entity/your-entity.types.ts
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
**Required content:**
|
|
228
228
|
```typescript
|
|
229
229
|
import { z } from "zod";
|
|
230
230
|
import {
|
|
@@ -235,7 +235,7 @@ import {
|
|
|
235
235
|
export const YourEntityListParams = YourEntityBaseListParams;
|
|
236
236
|
export type YourEntityListParams = z.infer<typeof YourEntityListParams>;
|
|
237
237
|
|
|
238
|
-
//
|
|
238
|
+
// Basic pattern (no relations)
|
|
239
239
|
export const YourEntitySaveParams = YourEntityBaseSchema.partial({
|
|
240
240
|
id: true,
|
|
241
241
|
created_at: true,
|
|
@@ -243,9 +243,9 @@ export const YourEntitySaveParams = YourEntityBaseSchema.partial({
|
|
|
243
243
|
export type YourEntitySaveParams = z.infer<typeof YourEntitySaveParams>;
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
**ManyToMany relation
|
|
246
|
+
**If a ManyToMany relation exists:**
|
|
247
247
|
```typescript
|
|
248
|
-
// ManyToMany
|
|
248
|
+
// ManyToMany relation: add {relation_name}_ids array
|
|
249
249
|
export const YourEntitySaveParams = YourEntityBaseSchema.partial({
|
|
250
250
|
id: true,
|
|
251
251
|
created_at: true,
|
|
@@ -256,29 +256,29 @@ export const YourEntitySaveParams = YourEntityBaseSchema.partial({
|
|
|
256
256
|
export type YourEntitySaveParams = z.infer<typeof YourEntitySaveParams>;
|
|
257
257
|
```
|
|
258
258
|
|
|
259
|
-
|
|
260
|
-
- `sonamu/examples/miomock/api/src/application/project/project.types.ts` - ManyToMany
|
|
261
|
-
- `sonamu/examples/miomock/api/src/application/employee/employee.types.ts` -
|
|
259
|
+
**Reference working code:**
|
|
260
|
+
- `sonamu/examples/miomock/api/src/application/project/project.types.ts` - ManyToMany example
|
|
261
|
+
- `sonamu/examples/miomock/api/src/application/employee/employee.types.ts` - basic pattern
|
|
262
262
|
|
|
263
|
-
## PHASE 3: Sync
|
|
263
|
+
## PHASE 3: Sync Execution and Validation
|
|
264
264
|
|
|
265
|
-
### 3.1 Sync
|
|
265
|
+
### 3.1 Run Sync
|
|
266
266
|
|
|
267
267
|
```bash
|
|
268
268
|
cd packages/api
|
|
269
269
|
pnpm sonamu sync
|
|
270
270
|
```
|
|
271
271
|
|
|
272
|
-
### 3.2 Sync
|
|
272
|
+
### 3.2 Sync Result Validation
|
|
273
273
|
|
|
274
|
-
**
|
|
274
|
+
**Are all 3 files registered in sonamu.lock?**
|
|
275
275
|
|
|
276
276
|
```bash
|
|
277
|
-
#
|
|
277
|
+
# Check
|
|
278
278
|
grep "your-entity" packages/api/sonamu.lock
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
-
|
|
281
|
+
**Expected result:**
|
|
282
282
|
```json
|
|
283
283
|
[
|
|
284
284
|
{
|
|
@@ -296,102 +296,102 @@ grep "your-entity" packages/api/sonamu.lock
|
|
|
296
296
|
]
|
|
297
297
|
```
|
|
298
298
|
|
|
299
|
-
### 3.3 Web
|
|
299
|
+
### 3.3 Web Package Sync Validation
|
|
300
300
|
|
|
301
|
-
**
|
|
301
|
+
**Have the required files been generated in the web package?**
|
|
302
302
|
|
|
303
303
|
```bash
|
|
304
|
-
#
|
|
304
|
+
# Check service generation
|
|
305
305
|
grep "YourEntityService" packages/web/src/services/services.generated.ts
|
|
306
306
|
|
|
307
|
-
#
|
|
307
|
+
# Check component generation
|
|
308
308
|
ls packages/web/src/components/your-entity/
|
|
309
309
|
|
|
310
|
-
#
|
|
310
|
+
# Check route generation
|
|
311
311
|
ls packages/web/src/routes/admin/your-entities/
|
|
312
312
|
```
|
|
313
313
|
|
|
314
|
-
### 3.4 i18n
|
|
314
|
+
### 3.4 i18n Key Generation Validation
|
|
315
315
|
|
|
316
|
-
**
|
|
316
|
+
**Have labels been generated for foreign key fields?**
|
|
317
317
|
|
|
318
318
|
```bash
|
|
319
|
-
#
|
|
319
|
+
# Check
|
|
320
320
|
grep "entity.YourEntity" packages/web/src/i18n/sd.generated.ts
|
|
321
321
|
```
|
|
322
322
|
|
|
323
|
-
## PHASE 4: Migration
|
|
323
|
+
## PHASE 4: Migration Validation
|
|
324
324
|
|
|
325
|
-
### 4.1 Migration
|
|
325
|
+
### 4.1 Create Migration File
|
|
326
326
|
|
|
327
327
|
```bash
|
|
328
328
|
cd packages/api
|
|
329
329
|
pnpm sonamu migration:create
|
|
330
330
|
```
|
|
331
331
|
|
|
332
|
-
### 4.2 Migration
|
|
332
|
+
### 4.2 Migration File Validation
|
|
333
333
|
|
|
334
|
-
|
|
334
|
+
**Check the generated migration file:**
|
|
335
335
|
|
|
336
336
|
```bash
|
|
337
337
|
ls packages/api/src/migrations/*_create__your_entities.ts
|
|
338
338
|
```
|
|
339
339
|
|
|
340
|
-
|
|
341
|
-
- [ ]
|
|
342
|
-
- [ ]
|
|
343
|
-
- [ ]
|
|
344
|
-
- [ ]
|
|
345
|
-
- [ ]
|
|
340
|
+
**Validation checklist:**
|
|
341
|
+
- [ ] Is the table name correct? (plural, snake_case)
|
|
342
|
+
- [ ] Are all columns defined?
|
|
343
|
+
- [ ] Are foreign key constraints present?
|
|
344
|
+
- [ ] Are indexes created?
|
|
345
|
+
- [ ] Is the default for Boolean columns correct? (true/false)
|
|
346
346
|
|
|
347
347
|
### 4.3 Migration Dry-run
|
|
348
348
|
|
|
349
349
|
```bash
|
|
350
|
-
#
|
|
350
|
+
# Check SQL before applying migration
|
|
351
351
|
cd packages/api
|
|
352
352
|
pnpm sonamu migration:latest --dry-run
|
|
353
353
|
```
|
|
354
354
|
|
|
355
|
-
|
|
356
|
-
- SQL
|
|
357
|
-
-
|
|
358
|
-
- Boolean default
|
|
355
|
+
**Check for:**
|
|
356
|
+
- No SQL syntax errors
|
|
357
|
+
- No duplicate column definitions
|
|
358
|
+
- No Boolean default type errors
|
|
359
359
|
|
|
360
|
-
## PHASE 5: Scaffolding
|
|
360
|
+
## PHASE 5: Scaffolding Validation
|
|
361
361
|
|
|
362
|
-
### 5.1 Scaffolding
|
|
362
|
+
### 5.1 Pre-Scaffolding Check
|
|
363
363
|
|
|
364
|
-
|
|
364
|
+
**Have all previous steps been completed?**
|
|
365
365
|
|
|
366
|
-
- [ ] entity.json
|
|
367
|
-
- [ ] model.ts, types.ts
|
|
368
|
-
- [ ] sync
|
|
369
|
-
- [ ] migration
|
|
366
|
+
- [ ] entity.json validation complete
|
|
367
|
+
- [ ] model.ts, types.ts created
|
|
368
|
+
- [ ] sync executed
|
|
369
|
+
- [ ] migration created and applied
|
|
370
370
|
|
|
371
|
-
### 5.2 Scaffolding
|
|
371
|
+
### 5.2 Run Scaffolding
|
|
372
372
|
|
|
373
373
|
```bash
|
|
374
374
|
cd packages/api
|
|
375
375
|
pnpm sonamu scaffold your-entity
|
|
376
376
|
```
|
|
377
377
|
|
|
378
|
-
### 5.3 Build
|
|
378
|
+
### 5.3 Build Validation
|
|
379
379
|
|
|
380
380
|
```bash
|
|
381
|
-
# API
|
|
381
|
+
# API build
|
|
382
382
|
cd packages/api
|
|
383
383
|
pnpm build
|
|
384
384
|
|
|
385
|
-
# Web
|
|
385
|
+
# Web build
|
|
386
386
|
cd packages/web
|
|
387
387
|
pnpm build
|
|
388
388
|
```
|
|
389
389
|
|
|
390
|
-
|
|
390
|
+
**There must be no build errors!**
|
|
391
391
|
|
|
392
|
-
##
|
|
392
|
+
## Automated Validation Script (Optional)
|
|
393
393
|
|
|
394
|
-
|
|
394
|
+
Save the following script as `packages/api/scripts/validate-entity.sh`:
|
|
395
395
|
|
|
396
396
|
```bash
|
|
397
397
|
#!/bin/bash
|
|
@@ -442,27 +442,27 @@ fi
|
|
|
442
442
|
echo "[COMPLETE] Entity validation complete!"
|
|
443
443
|
```
|
|
444
444
|
|
|
445
|
-
|
|
445
|
+
**Usage:**
|
|
446
446
|
```bash
|
|
447
447
|
chmod +x packages/api/scripts/validate-entity.sh
|
|
448
448
|
./packages/api/scripts/validate-entity.sh your-entity
|
|
449
449
|
```
|
|
450
450
|
|
|
451
|
-
##
|
|
451
|
+
## Checklist Summary
|
|
452
452
|
|
|
453
|
-
|
|
453
|
+
When creating an entity, **always** proceed in the following order:
|
|
454
454
|
|
|
455
455
|
1. STEP 1: `pnpm sonamu stub entity YourEntity`
|
|
456
|
-
2. STEP 2: `your-entity.entity.json`
|
|
457
|
-
3. STEP 3:
|
|
458
|
-
4. STEP 4: `your-entity.model.ts`
|
|
459
|
-
5. STEP 5: `your-entity.types.ts`
|
|
456
|
+
2. STEP 2: Write `your-entity.entity.json`
|
|
457
|
+
3. STEP 3: **Validate using this checklist** (CRITICAL - must be performed)
|
|
458
|
+
4. STEP 4: Create `your-entity.model.ts`
|
|
459
|
+
5. STEP 5: Create `your-entity.types.ts`
|
|
460
460
|
6. STEP 6: `pnpm sonamu sync`
|
|
461
|
-
7. STEP 7:
|
|
461
|
+
7. STEP 7: Validate sync results (sonamu.lock, web files)
|
|
462
462
|
8. STEP 8: `pnpm sonamu migration:create`
|
|
463
|
-
9. STEP 9:
|
|
463
|
+
9. STEP 9: Validate migration file
|
|
464
464
|
10. STEP 10: `pnpm sonamu migration:latest` (apply)
|
|
465
465
|
11. STEP 11: `pnpm sonamu scaffold your-entity`
|
|
466
|
-
12. STEP 12: Build
|
|
466
|
+
12. STEP 12: Build test
|
|
467
467
|
|
|
468
|
-
|
|
468
|
+
**Do not skip any step!** Order matters.
|