sonamu 0.10.5 → 0.10.7

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 (99) hide show
  1. package/dist/api/base-frame.d.ts +2 -0
  2. package/dist/api/base-frame.d.ts.map +1 -1
  3. package/dist/api/base-frame.js +8 -1
  4. package/dist/api/decorators.js +1 -1
  5. package/dist/api/sonamu.js +1 -1
  6. package/dist/bin/cli.js +195 -187
  7. package/dist/cone/cone-generator.js +3 -9
  8. package/dist/database/base-model.js +2 -2
  9. package/dist/database/knex.d.ts.map +1 -1
  10. package/dist/database/knex.js +2 -2
  11. package/dist/database/puri.d.ts +17 -0
  12. package/dist/database/puri.d.ts.map +1 -1
  13. package/dist/database/puri.js +102 -3
  14. package/dist/entity/entity-manager.js +1 -1
  15. package/dist/index.js +3 -3
  16. package/dist/migration/code-generation.js +6 -6
  17. package/dist/migration/migrator.d.ts.map +1 -1
  18. package/dist/migration/migrator.js +52 -7
  19. package/dist/migration/slack-confirm.js +1 -1
  20. package/dist/naite/naite-reporter.js +1 -1
  21. package/dist/syncer/checksum.js +1 -1
  22. package/dist/syncer/code-generator.js +1 -1
  23. package/dist/syncer/entity-operations.js +1 -1
  24. package/dist/syncer/syncer-actions.js +1 -1
  25. package/dist/syncer/syncer.js +1 -1
  26. package/dist/ui-web/assets/{index-BLX4zN8c.js → index-D0MHYbxl.js} +1 -1
  27. package/dist/ui-web/assets/index-Dx_JX4aQ.css +1 -0
  28. package/dist/ui-web/index.html +2 -2
  29. package/dist/utils/formatter.js +1 -1
  30. package/package.json +3 -3
  31. package/src/api/base-frame.ts +14 -1
  32. package/src/bin/cli.ts +268 -280
  33. package/src/cone/cone-generator.ts +2 -18
  34. package/src/database/__tests__/puri.test.ts +183 -0
  35. package/src/database/knex.ts +4 -1
  36. package/src/database/puri.ts +229 -2
  37. package/src/database/puri.types.test-d.ts +56 -0
  38. package/src/migration/code-generation.ts +5 -5
  39. package/src/migration/migrator.ts +81 -7
  40. package/src/skills/AGENTS.md +76 -50
  41. package/src/skills/sonamu/SKILL.md +46 -227
  42. package/src/skills/{sonamu/ai-agents.md → sonamu-ai-agents/SKILL.md} +3 -3
  43. package/src/skills/{sonamu/api.md → sonamu-api/SKILL.md} +3 -2
  44. package/src/skills/{sonamu/auth.md → sonamu-auth/SKILL.md} +9 -4
  45. package/src/skills/{sonamu/auth-plugins.md → sonamu-auth/references/plugins.md} +2 -7
  46. package/src/skills/sonamu-auth/references/user-id-migration-followups.md +192 -0
  47. package/src/skills/{sonamu/auth-migration.md → sonamu-auth/references/user-id-migration.md} +1 -195
  48. package/src/skills/sonamu-config/SKILL.md +203 -0
  49. package/src/skills/{sonamu → sonamu-config/references}/database.md +3 -8
  50. package/src/skills/sonamu-config/references/environments.md +178 -0
  51. package/src/skills/sonamu-config/references/server-options.md +400 -0
  52. package/src/skills/sonamu-entity/SKILL.md +180 -0
  53. package/src/skills/{sonamu/entity-validation-checklist.md → sonamu-entity/references/creation-workflow.md} +117 -8
  54. package/src/skills/sonamu-entity/references/design-guides.md +243 -0
  55. package/src/skills/sonamu-entity/references/field-types.md +170 -0
  56. package/src/skills/sonamu-entity/references/relations-detail.md +245 -0
  57. package/src/skills/{sonamu/entity-relations.md → sonamu-entity/references/relations.md} +1 -258
  58. package/src/skills/{sonamu → sonamu-entity/references}/subset.md +1 -11
  59. package/src/skills/sonamu-fixture/SKILL.md +180 -0
  60. package/src/skills/{sonamu/fixture-cli.md → sonamu-fixture/references/cli-usage.md} +5 -176
  61. package/src/skills/{sonamu → sonamu-fixture/references}/cone.md +4 -14
  62. package/src/skills/sonamu-frontend/SKILL.md +142 -0
  63. package/src/skills/sonamu-frontend/references/components.md +323 -0
  64. package/src/skills/sonamu-frontend/references/examples.md +64 -0
  65. package/src/skills/sonamu-frontend/references/hooks.md +273 -0
  66. package/src/skills/sonamu-frontend/references/runtime.md +165 -0
  67. package/src/skills/{sonamu → sonamu-frontend/references}/scaffolding.md +3 -8
  68. package/src/skills/{sonamu/i18n.md → sonamu-i18n/SKILL.md} +2 -2
  69. package/src/skills/{sonamu/migration.md → sonamu-migration/SKILL.md} +1 -1
  70. package/src/skills/{sonamu/naite.md → sonamu-naite/SKILL.md} +5 -5
  71. package/src/skills/sonamu-query/SKILL.md +48 -0
  72. package/src/skills/sonamu-query/references/model-patterns.md +390 -0
  73. package/src/skills/{sonamu → sonamu-query/references}/model.md +1 -401
  74. package/src/skills/{sonamu → sonamu-query/references}/puri.md +31 -243
  75. package/src/skills/sonamu-query/references/search.md +238 -0
  76. package/src/skills/{sonamu → sonamu-query/references}/upsert.md +1 -6
  77. package/src/skills/{sonamu/tasks.md → sonamu-tasks/SKILL.md} +1 -1
  78. package/src/skills/sonamu-testing/SKILL.md +251 -0
  79. package/src/skills/{sonamu/testing-devrunner.md → sonamu-testing/references/devrunner.md} +4 -9
  80. package/src/skills/sonamu-testing/references/helpers.md +185 -0
  81. package/src/skills/sonamu-testing/references/patterns.md +263 -0
  82. package/src/skills/sonamu-testing/references/pitfalls.md +588 -0
  83. package/src/skills/sonamu-testing/references/quick-start.md +285 -0
  84. package/src/skills/sonamu-testing/references/type-safety.md +172 -0
  85. package/src/skills/sonamu-testing/references/writing-plan.md +375 -0
  86. package/src/skills/{sonamu/vector.md → sonamu-vector/SKILL.md} +1 -1
  87. package/dist/ui-web/assets/index-Dx4ap5i4.css +0 -1
  88. package/src/skills/commands/sonamu-skills.md +0 -20
  89. package/src/skills/project/README.md +0 -19
  90. package/src/skills/project/architecture.md +0 -373
  91. package/src/skills/sonamu/cdd.md +0 -129
  92. package/src/skills/sonamu/config.md +0 -772
  93. package/src/skills/sonamu/create-sonamu.md +0 -208
  94. package/src/skills/sonamu/entity-basic.md +0 -678
  95. package/src/skills/sonamu/framework-change.md +0 -96
  96. package/src/skills/sonamu/frontend.md +0 -915
  97. package/src/skills/sonamu/project-init.md +0 -477
  98. package/src/skills/sonamu/skill-contribution.md +0 -247
  99. package/src/skills/sonamu/testing.md +0 -2163
@@ -1,477 +0,0 @@
1
- ---
2
- name: sonamu-project-init
3
- description: Sonamu project creation and initialization. Check whether a project already exists before starting entity design. Use before entity design.
4
- ---
5
-
6
- # Project Initialization
7
-
8
- ## Question Order When Entity Design Is Requested
9
-
10
- **One question at a time, in order:**
11
-
12
- ```
13
- 0. Confirm working directory ← top priority
14
- 1. Check if project already exists
15
- 2. (If no project) Ask whether to create one
16
- 3. (If yes to create) Ask for project name
17
- 4. (If yes to create) Use defaults vs configure options
18
- 5. Run project creation
19
- 6. (If requirements provided) Document requirements ← important!
20
- 7. Review/customize configuration (see config.md)
21
- 8. → Proceed to entity-basic.md
22
- ```
23
-
24
- ---
25
-
26
- ## Documenting Requirements
27
-
28
- **If the user provides requirements along with the project creation request, always document them.**
29
-
30
- ### Process
31
-
32
- 1. **Confirm project creation is complete**
33
- - `pnpm create sonamu` complete
34
- - `pnpm install` complete
35
- - Confirm `.claude/skills/project/` directory was auto-created
36
-
37
- 2. **Write requirements**
38
-
39
- ```bash
40
- # Write to .claude/skills/project/requirements.md
41
- ```
42
-
43
- 3. **Content to include**
44
- - Project overview
45
- - Core feature list
46
- - User role definitions
47
- - Key entity list
48
- - Business rules
49
- - Tech stack
50
- - Additional requirements
51
-
52
- 4. **Ongoing reference**
53
- - Refer to this document throughout all subsequent development
54
- - Maintain consistency during entity design, API development, and business logic implementation
55
-
56
- ### Example Scenario
57
-
58
- ```
59
- User: "I want to build a research project management system.
60
- I need announcement, project, and evaluation management,
61
- with roles for admin, reviewer, and applicant."
62
-
63
- Claude:
64
- 1. Confirm project path
65
- 2. Run "pnpm create sonamu research_system --yes"
66
- 3. Project creation complete
67
- 4. Write the following to .claude/skills/project/requirements.md:
68
-
69
- ---
70
- # Research Project Management System
71
-
72
- ## Project Overview
73
- A system for managing research project calls, applications, and evaluations
74
-
75
- ## Core Features
76
- - Announcement management (create, edit, publish, close)
77
- - Project application and management
78
- - Evaluation process (reviewer assignment, evaluation form creation, score calculation)
79
- - User permission management
80
-
81
- ## User Roles
82
- - Admin: full system management, announcement creation, reviewer assignment
83
- - Reviewer: write evaluation forms, assign scores
84
- - Applicant: apply for projects, check progress
85
-
86
- ## Key Entities
87
- - Announcement
88
- - Project
89
- - Evaluation
90
- - User
91
- - ...
92
- ---
93
-
94
- 5. Reference this document for consistent entity design going forward
95
- ```
96
-
97
- ### Important Notes
98
-
99
- **Always document when:**
100
-
101
- - The user provides requirements or a feature specification together with project creation
102
- - There are business rules or special constraints
103
-
104
- **When to document:**
105
-
106
- - Immediately after project creation
107
- - Before starting entity design
108
-
109
- **How the document is used:**
110
-
111
- - Reference during entity design
112
- - Reference during API business logic implementation
113
- - Reference when writing test cases
114
- - Reference during frontend UI design
115
-
116
- ---
117
-
118
- ## 0. Confirm Working Directory
119
-
120
- **Must confirm before creating a project:**
121
-
122
- Developers often separate working directories by project type:
123
-
124
- - Company/framework projects: `~/Development/`
125
- - Personal projects: `~/dev/programming/`
126
- - Client work: `~/Projects/clients/`
127
-
128
- ### Confirmation Process
129
-
130
- 1. **Determine the current working directory**
131
-
132
- ```bash
133
- pwd # check current directory
134
- ```
135
-
136
- 2. **Ask the user to confirm**
137
-
138
- ```
139
- "You are currently in {current_directory}. Should I create the project here?
140
- If you work in a different location, please tell me the directory to create the project in.
141
-
142
- 1. Create in current directory
143
- 2. Specify a different directory"
144
- ```
145
-
146
- 3. **Handle each choice**
147
-
148
- **If option 1:**
149
- - Proceed directly in the current directory
150
- - Move to the next step (confirm project creation)
151
-
152
- **If option 2:**
153
- - "Please provide the directory path where you want to create the project."
154
- - After receiving the path: `cd {specified_path}`
155
- - Check whether the directory exists
156
- - If it doesn't exist: `mkdir -p {specified_path} && cd {specified_path}`
157
- - Move to the next step
158
-
159
- ### Example Conversation
160
-
161
- ```
162
- User: "I want to build a survey system. Design the entities for me."
163
-
164
- Claude: "You are currently in /Users/noa/Documents. Should I create the project here?
165
- If you work in a different location, please tell me the directory to create the project in.
166
-
167
- 1. Create in current directory
168
- 2. Specify a different directory"
169
-
170
- User: "2"
171
-
172
- Claude: "Please provide the directory path where you want to create the project."
173
-
174
- User: "/Users/noa/Development"
175
-
176
- Claude: "Moving to /Users/noa/Development.
177
-
178
- Is a Sonamu project already set up there?"
179
- ```
180
-
181
- ### Notes
182
-
183
- - **Relative paths are accepted**: `~/Development`, `../projects`, etc.
184
- - **Tilde (~) expansion**: home directory is expanded automatically
185
- - **Path validation**: ask whether to create the directory if it doesn't exist
186
- - **Working directory change**: all subsequent commands use the new path
187
-
188
- ---
189
-
190
- ## Full Process Details
191
-
192
- ### A. For Sonamu Developers (Local Link)
193
-
194
- > **Why use a local link:**
195
- >
196
- > - Sync directly from the Skills source
197
- > - Local Sonamu changes take effect immediately
198
- > - Required for framework development
199
-
200
- #### 1. Create the Project
201
-
202
- ```bash
203
- pnpm create sonamu [project-name] --yes
204
- ```
205
-
206
- See `create-sonamu.md` for CLI options.
207
-
208
- #### 2. Set Up the Sonamu Link
209
-
210
- Add to the `overrides` section of `pnpm-workspace.yaml`:
211
-
212
- ```yaml
213
- overrides:
214
- sonamu: link:../../sonamu/modules/sonamu
215
- ```
216
-
217
- > **Path example:**
218
- >
219
- > - If Sonamu is at `~/Development/sonamu`
220
- > - And the project is at `~/Development/my_project`
221
- > - → `link:../../sonamu/modules/sonamu`
222
-
223
- #### 3. Install Dependencies and Build
224
-
225
- From the project root:
226
-
227
- ```bash
228
- pnpm install
229
- pnpm -r build
230
- ```
231
-
232
- > **If build fails:** may be a resource initialization failure. Start Docker first (step 4), then start the dev server (step 5) and retry.
233
-
234
- #### 4. Start the DB
235
-
236
- ```bash
237
- cd packages/api
238
- pnpm docker:up
239
- ```
240
-
241
- > If a port conflict error occurs → see `database.md`
242
-
243
- #### 5. Start the Dev Server
244
-
245
- ```bash
246
- pnpm dev
247
- ```
248
-
249
- > If step 3 build failed, retry `pnpm -r build` from the project root after the dev server is running
250
-
251
- > Sonamu UI: http://localhost:34900/sonamu-ui
252
-
253
- #### 6. Generate Auth Entities (Separate Terminal)
254
-
255
- In a separate terminal **while the dev server is running**:
256
-
257
- ```bash
258
- cd packages/api
259
- pnpm sonamu auth generate
260
- ```
261
-
262
- > **Note:** Must run in dev mode for types files to be auto-generated as well
263
-
264
- #### 7. Check Subsets
265
-
266
- In the Sonamu UI (`http://localhost:34900/sonamu-ui`) Entity menu:
267
-
268
- - Check subsets for User, Account, Session, Verification entities
269
-
270
- #### 8. DB Migration
271
-
272
- Run migrations from Sonamu UI
273
-
274
- #### 9. Scaffolding
275
-
276
- ```bash
277
- pnpm sonamu scaffold model User
278
- pnpm sonamu scaffold model Account
279
- pnpm sonamu scaffold model Session
280
- pnpm sonamu scaffold model Verification
281
- ```
282
-
283
- #### 10. Sync Skills (Optional)
284
-
285
- If you need to sync from the Skills source:
286
-
287
- ```bash
288
- cd packages/api
289
- pnpm sonamu skills sync
290
- ```
291
-
292
- `.claude/skills/sonamu/` will be created at the project root.
293
-
294
- ---
295
-
296
- ### B. For Sonamu Users (npm Version)
297
-
298
- > **When using the npm version:**
299
- >
300
- > - Skills are included in the npm package
301
- > - No local link needed
302
- > - For general users
303
-
304
- #### 1-3. Create and Configure the Project
305
-
306
- ```bash
307
- pnpm create sonamu [project-name] --yes
308
- cd [project-name]
309
- pnpm install
310
- pnpm -r build
311
- ```
312
-
313
- > **If build fails:** Same as A step 3 - start Docker first, then start dev, then rebuild
314
-
315
- #### 4-9. Same as A Steps 4-9
316
-
317
- (Skills sync is not needed)
318
-
319
- ---
320
-
321
- ## Example Conversations
322
-
323
- ### DO - Correct Example
324
-
325
- ```
326
- User: "I want to build a survey system. Design the entities for me."
327
-
328
- Claude: "You are currently in /Users/noa/Documents. Should I create the project here?
329
- If you work in a different location, please tell me the directory to create the project in.
330
-
331
- 1. Create in current directory
332
- 2. Specify a different directory"
333
-
334
- User: "1"
335
-
336
- Claude: "Is a Sonamu project already set up here?"
337
-
338
- User: "No"
339
-
340
- Claude: "Should I create a project with pnpm create sonamu?"
341
-
342
- User: "Yes"
343
-
344
- Claude: "What should the project name be? (e.g. survey_system)"
345
-
346
- User: "survey_system"
347
-
348
- Claude: "Should I create it quickly with defaults, or would you like to configure DB settings and other options yourself?
349
- 1. Create with defaults (--yes)
350
- 2. Configure options manually"
351
-
352
- User: "1"
353
-
354
- Claude: "Creating with the following command:
355
- pnpm create sonamu survey_system --yes
356
-
357
- Let me know if you need any additional configuration after creation."
358
- ```
359
-
360
- ### DO NOT - Incorrect Example
361
-
362
- ```
363
- User: "I want to build a survey system. Design the entities for me."
364
-
365
- Claude: "Before designing the survey system entities, let me confirm a few things.
366
-
367
- 1. Which directory should I create the project in?
368
- 2. Is a Sonamu project already set up?
369
- 3. What should the project name be?
370
- 4. Should I use defaults or configure options manually?"
371
- ```
372
-
373
- **Why this is wrong:**
374
-
375
- - Asking multiple questions at once (should ask one at a time)
376
- - The question order is not clear
377
-
378
- ---
379
-
380
- ## Post-Creation Configuration
381
-
382
- Items to confirm with the user after project creation:
383
-
384
- ### 1. Check .env
385
-
386
- ```
387
- Claude: "The packages/api/.env file has been created. Would you like to review the default settings?"
388
- ```
389
-
390
- Default generated .env:
391
-
392
- ```env
393
- DB_HOST=0.0.0.0
394
- DB_PORT=5432
395
- DB_USER=postgres
396
- DB_PASSWORD=1234
397
- CONTAINER_NAME={project-name}-container
398
- DATABASE_NAME={project-name}
399
- PROJECT_NAME={project-name}
400
- SESSION_SECRET={auto-generated}
401
- SESSION_SALT={auto-generated}
402
- ```
403
-
404
- ### 1.5 Check for Leftover Template Defaults (CRITICAL)
405
-
406
- Projects created with `pnpm create sonamu` contain placeholder values. **These must be replaced with real values.**
407
-
408
- ```bash
409
- # Check: search for leftover default values
410
- grep -r 'SonamuProject' packages/api/src/
411
- ```
412
-
413
- **`packages/api/src/sonamu.config.ts`:**
414
-
415
- ```typescript
416
- // DO NOT - template default left as-is
417
- projectName: process.env.PROJECT_NAME ?? "SonamuProject";
418
-
419
- // DO - replace with real project name
420
- projectName: process.env.PROJECT_NAME ?? "NIFOS";
421
- ```
422
-
423
- **Replacement checklist:**
424
-
425
- - [ ] `projectName` default in `sonamu.config.ts`
426
- - [ ] `name` field in `package.json` (root)
427
- - [ ] `PROJECT_NAME`, `DATABASE_NAME` in `.env`
428
- - [ ] `SESSION_SECRET`, `SESSION_SALT` in `.env` (must replace before going to production)
429
-
430
- ### 2. Check Whether Additional Configuration Is Needed
431
-
432
- ```
433
- Claude: "Is there anything else you need to configure?
434
- - Session security settings (for production)
435
- - S3 file upload
436
- - Change server port
437
- - Nothing (proceed immediately)"
438
- ```
439
-
440
- See `config.md` for configuration details for each item.
441
-
442
- ### 3. Proceed After Configuration
443
-
444
- ```
445
- Claude: "Configuration is complete. Ready to proceed to the next step?
446
-
447
- 1. cd survey_system/packages/api
448
- 2. pnpm docker:up
449
- 3. pnpm dev
450
- 4. (separate terminal) pnpm sonamu auth generate"
451
- ```
452
-
453
- ---
454
-
455
- ## Checking an Existing Project
456
-
457
- If the user says "I already have a project", ask for the path:
458
-
459
- ```
460
- Claude: "Please tell me the project path."
461
- ```
462
-
463
- After receiving the path, you can confirm by checking whether `packages/api/src/application/` exists.
464
-
465
- ---
466
-
467
- ## Handling Configuration Questions
468
-
469
- When the user asks a configuration-related question, refer to `config.md` for the answer:
470
-
471
- | Question | Reference |
472
- | --------------------------------------- | ---------------------------------- |
473
- | "How do I configure .env?" | config.md - .env file |
474
- | "How do I connect S3?" | config.md - server.storage |
475
- | "How do I change the session settings?" | config.md - server.plugins.session |
476
- | "How do I change the port?" | config.md - server.listen |
477
- | "Cache settings?" | config.md - server.cache |