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,92 +1,92 @@
1
1
  ---
2
2
  name: sonamu-skill-contribution
3
- description: 트러블슈팅 해결 스킬 반영 워크플로우. 기존 스킬 매칭, 중복 판정, 포맷 표준, 사용자 승인 게이트. Use when a troubleshooting session concludes and the resolution should be captured as reusable knowledge.
3
+ description: Workflow for reflecting troubleshooting resolutions into skills. Covers existing skill matching, duplication check, format standards, and user approval gate. Use when a troubleshooting session concludes and the resolution should be captured as reusable knowledge.
4
4
  ---
5
5
 
6
- # 트러블슈팅스킬 반영 워크플로우
6
+ # TroubleshootingSkill Contribution Workflow
7
7
 
8
- 트러블슈팅을 해결한 뒤, 지식을 스킬에 반영하는 프로세스.
8
+ The process for capturing knowledge from a resolved troubleshooting session into skills.
9
9
 
10
10
  ---
11
11
 
12
- ## 트리거
12
+ ## Triggers
13
13
 
14
- | 트리거 | 주체 | 예시 |
15
- |--------|------|------|
16
- | **명시적 요청** | 사용자 | "이거 스킬로 정리해줘", " 해결법 기록해줘" |
17
- | **에이전트 제안** | 에이전트 | 아래 감지 패턴에 해당하면 " 내용을 스킬에 반영할까요?" 제안 |
14
+ | Trigger | Owner | Example |
15
+ |---------|-------|---------|
16
+ | **Explicit request** | User | "Document this in skills", "Record this fix" |
17
+ | **Agent suggestion** | Agent | When a detection pattern below is met, propose: "Should I add this to skills?" |
18
18
 
19
- ### 에이전트 감지 패턴
19
+ ### Agent detection patterns
20
20
 
21
- 다음 흐름이 대화에서 관찰되면 제안한다:
21
+ Suggest contribution when the following flow is observed in the conversation:
22
22
 
23
- 1. **에러/실패조사수정성공** 패턴이 완료됨
24
- 2. 해결 과정에서 **프레임워크 내부 동작**이나 **문서화되지 않은 제약**이 밝혀짐
25
- 3. 동일 문제를 **다른 사용자/프로젝트에서도 겪을 가능성**이 있음
23
+ 1. **Error/failureinvestigationfixsuccess** pattern completes
24
+ 2. The resolution reveals **internal framework behavior** or **undocumented constraints**
25
+ 3. The same problem is **likely to occur in other projects or for other users**
26
26
 
27
- 다음의 경우에는 제안하지 않는다:
28
- - 단순 오타, import 누락 등 코딩 실수
29
- - 프로젝트 고유 비즈니스 로직 버그
30
- - 일회성 환경 문제 (특정 머신의 포트 충돌 )
27
+ Do not suggest when:
28
+ - Simple typos or missing imports
29
+ - Project-specific business logic bugs
30
+ - One-off environment issues (e.g., port conflict on a specific machine)
31
31
 
32
32
  ---
33
33
 
34
- ## 단계
34
+ ## Steps
35
35
 
36
36
  ```
37
- [1] 추출 문제/원인/해결/소스 정리
38
- [2] 매칭 기존 스킬과 대조
39
- [3] 판정 어디에 넣을지 결정
40
- [4] 드래프트 내용 작성
41
- [5] 승인 사용자 확인
42
- [6] 반영 파일 수정/생성
37
+ [1] Extract summarize problem / cause / solution / source
38
+ [2] Match compare against existing skills
39
+ [3] Decide determine where to put it
40
+ [4] Draft write the content
41
+ [5] Approve get user confirmation
42
+ [6] Apply update or create the file
43
43
  ```
44
44
 
45
45
  ---
46
46
 
47
- ## [1] 추출
47
+ ## [1] Extract
48
48
 
49
- 대화에서 다음 구조로 정리한다:
49
+ Summarize from the conversation using the following structure:
50
50
 
51
51
  ```yaml
52
- symptom: "증상 (에러 메시지 또는 현상)"
53
- cause: "원인 설명"
54
- solution: "해결 방법 (구체적 명령어/코드 포함)"
55
- source_paths: # 관련 소스코드 경로
52
+ symptom: "one-line description (error message or observed behavior)"
53
+ cause: "explanation of root cause"
54
+ solution: "resolution steps (include specific commands/code)"
55
+ source_paths: # related source file paths
56
56
  - "src/testing/dev-vitest-manager.ts"
57
- tags: # 매칭에 사용할 키워드
57
+ tags: # keywords for matching
58
58
  - "testing"
59
59
  - "devrunner"
60
- scope: "sonamu" # "sonamu" (공식) 또는 "local" (프로젝트 고유)
60
+ scope: "sonamu" # "sonamu" (framework-level) or "local" (project-specific)
61
61
  ```
62
62
 
63
- ### scope 판정 기준
63
+ ### Scope decision criteria
64
64
 
65
- | 조건 | scope |
66
- |------|-------|
67
- | Sonamu 프레임워크 자체의 동작/제약 | `sonamu` |
68
- | Sonamu CLI, config, migration 공통 도구 관련 | `sonamu` |
69
- | 특정 프로젝트의 비즈니스 로직/설정 | `local` |
70
- | 판단 어려움 | 사용자에게 물어본다 |
65
+ | Condition | scope |
66
+ |-----------|-------|
67
+ | Relates to Sonamu framework behavior or constraints | `sonamu` |
68
+ | Relates to Sonamu CLI, config, migration, or shared tooling | `sonamu` |
69
+ | Relates to a specific project's business logic or configuration | `local` |
70
+ | Unclear | Ask the user |
71
71
 
72
72
  ---
73
73
 
74
- ## [2] 매칭기존 스킬 대조
74
+ ## [2] MatchCompare Against Existing Skills
75
75
 
76
- **반드시 기존 스킬을 먼저 읽고 중복 여부를 확인한다.** 파일 생성은 최후의 수단.
76
+ **Always read existing skills first and check for duplication.** Creating a new file is a last resort.
77
77
 
78
- ### 매칭 우선순위
78
+ ### Match priority
79
79
 
80
- | 순위 | 방법 | 설명 |
81
- |------|------|------|
82
- | 1 | **소스 경로** | `source_paths`가 기존 스킬의 "소스코드" 참조와 겹치는지 확인 |
83
- | 2 | **태그/키워드** | 스킬의 YAML `description`과 tags 대조 |
84
- | 3 | **SKILL.md 작업별 테이블** | 문제 도메인이 어떤 작업 행에 해당하는지 역참조 |
80
+ | Priority | Method | Description |
81
+ |----------|--------|-------------|
82
+ | 1 | **Source paths** | Check whether `source_paths` overlap with source references in existing skills |
83
+ | 2 | **Tags/keywords** | Compare against each skill's YAML `description` and tags |
84
+ | 3 | **SKILL.md task table** | Cross-reference which task row maps to the problem domain |
85
85
 
86
- ### 소스 경로스킬 매핑 (주요)
86
+ ### Source pathskill mapping (key paths)
87
87
 
88
- | 소스 경로 패턴 | 대응 스킬 |
89
- |---------------|----------|
88
+ | Source path pattern | Corresponding skill |
89
+ |---------------------|---------------------|
90
90
  | `src/testing/*` | testing.md, testing-devrunner.md, naite.md, fixture-cli.md |
91
91
  | `src/database/puri*` | puri.md |
92
92
  | `src/database/migrator*` | migration.md |
@@ -99,144 +99,144 @@ scope: "sonamu" # "sonamu" (공식) 또는 "local" (프로젝트 고유)
99
99
  | `src/api/*` | api.md |
100
100
  | `src/template/*` | framework-change.md |
101
101
  | `src/model/*` | model.md |
102
- | `src/ssr/*` | (스킬 없음 파일 후보) |
103
- | `sonamu.config.ts` 관련 | config.md |
102
+ | `src/ssr/*` | (no skillcandidate for new file) |
103
+ | `sonamu.config.ts` related | config.md |
104
104
 
105
- 테이블에 없는 경로면 태그/키워드 매칭으로 넘어간다.
105
+ If the path is not in this table, fall through to tag/keyword matching.
106
106
 
107
- ### 매칭 실행
107
+ ### Matching steps
108
108
 
109
- 1. `SKILL.md`의 Skills 목록 테이블을 읽는다
110
- 2. 후보 스킬 파일(1~3)을 읽는다
111
- 3. 해당 스킬 내에 **동일하거나 유사한 내용이 이미 있는지** 확인한다
109
+ 1. Read the Skills list table in `SKILL.md`
110
+ 2. Read candidate skill files (13 files)
111
+ 3. Check whether **identical or similar content already exists** in those skills
112
112
 
113
113
  ---
114
114
 
115
- ## [3] 판정
115
+ ## [3] Decide
116
116
 
117
- | 매칭 결과 | 판정 | 설명 |
118
- |----------|------|------|
119
- | 기존 스킬에 **동일 내용 있음** | **SKIP** | "이미 {skill}.md에 문서화되어 있습니다" 보고 |
120
- | 매칭 + 해당 스킬에 **트러블슈팅 섹션 있음** | **APPEND** | 기존 섹션에 항목 추가 |
121
- | 매칭 + 해당 스킬에 **트러블슈팅 섹션 없음** | **ADD_SECTION** | 해당 스킬 끝에 트러블슈팅 섹션 신설 |
122
- | 매칭 없음 + scope=`sonamu` | **NEW_FILE** | 스킬 파일 생성 (드묾) |
123
- | 매칭 없음 + scope=`local` | **LOCAL** | `.claude/skills/local/`에 생성 |
117
+ | Match result | Decision | Description |
118
+ |--------------|----------|-------------|
119
+ | **Same content exists** in an existing skill | **SKIP** | Report: "Already documented in {skill}.md" |
120
+ | Match found + skill has **troubleshooting section** | **APPEND** | Add item to existing section |
121
+ | Match found + skill has **no troubleshooting section** | **ADD_SECTION** | Add a new troubleshooting section at the end |
122
+ | No match + scope=`sonamu` | **NEW_FILE** | Create a new skill file (rare) |
123
+ | No match + scope=`local` | **LOCAL** | Create in `.claude/skills/local/` |
124
124
 
125
- **CRITICAL: APPEND ADD_SECTION 전체의 대부분을 차지해야 한다.** NEW_FILE 정말로 기존 스킬 어디에도 맞지 않을 때만.
125
+ **CRITICAL: APPEND and ADD_SECTION should account for the vast majority of cases.** NEW_FILE is only for when the content genuinely does not fit anywhere in the existing skills.
126
126
 
127
127
  ---
128
128
 
129
- ## [4] 드래프트포맷 표준
129
+ ## [4] DraftFormat Standards
130
130
 
131
- ### 트러블슈팅 섹션 포맷
131
+ ### Troubleshooting section format
132
132
 
133
- 기존 `testing-devrunner.md`의 패턴을 표준으로 한다:
133
+ Use the pattern from `testing-devrunner.md` as the standard:
134
134
 
135
135
  ```markdown
136
- ## 트러블슈팅
136
+ ## Troubleshooting
137
137
 
138
- ### "에러 메시지 또는 증상 한 줄"
139
- 원인 설명
140
- 해결: 구체적 해결 방법 (명령어/코드/설정 포함)
138
+ ### "Error message or one-line symptom"
139
+ Explanation of root cause
140
+ Fix: specific resolution (commands / code / config)
141
141
  ```
142
142
 
143
- 여러 항목이 있으면 ### 단위로 나열한다.
143
+ List multiple items as separate `###` entries.
144
144
 
145
- ### 예시 — APPEND
145
+ ### Example — APPEND
146
146
 
147
- cone.md에 추가하는 경우:
147
+ Adding to cone.md:
148
148
 
149
149
  ```markdown
150
- ### "pnpm sonamu cone gen --all 실행 'ANTHROPIC_API_KEY is not set' 에러"
151
- → .env 키가 없거나 packages/api/.env가 아닌 루트 .env에만 설정한 경우
152
- 해결: `packages/api/.env`에 `ANTHROPIC_API_KEY=sk-ant-...` 추가
150
+ ### "pnpm sonamu cone gen --all fails with 'ANTHROPIC_API_KEY is not set'"
151
+ Key is missing from .env or was set only in root .env rather than packages/api/.env
152
+ Fix: add `ANTHROPIC_API_KEY=sk-ant-...` to `packages/api/.env`
153
153
  ```
154
154
 
155
- ### 예시 — ADD_SECTION
155
+ ### Example — ADD_SECTION
156
156
 
157
- puri.md 끝에 섹션을 추가하는 경우:
157
+ Adding a new section at the end of puri.md:
158
158
 
159
159
  ```markdown
160
160
  ---
161
161
 
162
- ## 트러블슈팅
162
+ ## Troubleshooting
163
163
 
164
- ### "leftJoin nullable 필드 타입이 non-null 추론됨"
165
- → Puri 타입 추론은 join 방향을 반영하지 않음. leftJoin 결과는 런타임에 null 있지만 타입에는 반영
166
- 해결: subset에서 해당 필드를 optional 명시하거나, 사용 null 체크 추가
164
+ ### "nullable field type inferred as non-null after leftJoin"
165
+ → Puri type inference does not account for join direction. leftJoin results may be null at runtime but are not reflected as optional in the types.
166
+ Fix: explicitly mark the field as optional in the subset, or add a null check at the call site
167
167
  ```
168
168
 
169
- ### 예시 — LOCAL
169
+ ### Example — LOCAL
170
170
 
171
171
  `.claude/skills/local/kopri-deployment.md`:
172
172
 
173
173
  ```markdown
174
174
  ---
175
175
  name: kopri-deployment
176
- description: KOPRI 프로젝트 배포 주의사항. Use when deploying KOPRI project.
176
+ description: Deployment notes for the KOPRI project. Use when deploying KOPRI project.
177
177
  ---
178
178
 
179
- # KOPRI 배포 트러블슈팅
179
+ # KOPRI Deployment Troubleshooting
180
180
 
181
- ## 트러블슈팅
181
+ ## Troubleshooting
182
182
 
183
- ### "Docker build sharp 패키지 설치 실패"
184
- → Alpine 이미지에서 sharp의 native dependency가 빠짐
185
- 해결: Dockerfile에 `RUN apk add --no-cache vips-dev` 추가
183
+ ### "sharp package installation fails during Docker build"
184
+ → Alpine image is missing native dependencies for sharp
185
+ Fix: add `RUN apk add --no-cache vips-dev` to Dockerfile
186
186
  ```
187
187
 
188
188
  ---
189
189
 
190
- ## [5] 승인사용자 확인 게이트
190
+ ## [5] ApproveUser Confirmation Gate
191
191
 
192
- 에이전트가 사용자에게 보여줄 내용:
192
+ Show the user:
193
193
 
194
- 1. **판정 결과**: 어디에 넣을지 + 이유 한 줄
195
- 2. **내용 미리보기**: 추가/수정될 마크다운
196
- 3. **승인 요청**
194
+ 1. **Decision**: where to put it + one-line reason
195
+ 2. **Content preview**: the markdown to be added or modified
196
+ 3. **Approval request**
197
197
 
198
198
  ```
199
- 판정: cone.md에 트러블슈팅 항목 추가 (APPEND)
200
- 이유: source_paths src/cone/에 해당, cone.md에 트러블슈팅 섹션이 이미 존재
199
+ Decision: APPEND adding troubleshooting entry to cone.md
200
+ Reason: source_paths match src/cone/; troubleshooting section already exists in cone.md
201
201
 
202
- 추가 내용:
203
- ### "cone gen 'No entity found' 에러"
202
+ Content to add:
203
+ ### "cone gen fails with 'No entity found'"
204
204
  → ...
205
205
 
206
- 반영할까요?
206
+ Shall I apply this?
207
207
  ```
208
208
 
209
- **승인 없이 반영하지 않는다.**
209
+ **Do not apply without approval.**
210
210
 
211
211
  ---
212
212
 
213
- ## [6] 반영
213
+ ## [6] Apply
214
214
 
215
- | 판정 | 액션 |
216
- |------|------|
217
- | SKIP | 없음 |
218
- | APPEND | 해당 스킬의 트러블슈팅 섹션에 ### 항목 추가 |
219
- | ADD_SECTION | 해당 스킬 파일 (`## 참고` 바로 또는 파일 끝)에 `## 트러블슈팅` 섹션 + 항목 추가 |
220
- | NEW_FILE | .md 파일 생성 + **SKILL.md 두 테이블에 등록** |
221
- | LOCAL | `.claude/skills/local/{name}.md` 생성 |
215
+ | Decision | Action |
216
+ |----------|--------|
217
+ | SKIP | None |
218
+ | APPEND | Add `###` entry to the troubleshooting section in the skill |
219
+ | ADD_SECTION | Add `## Troubleshooting` section + entry at the end of the skill (just before `## References` if it exists, otherwise at the very end) |
220
+ | NEW_FILE | Create new .md file + **register in both tables in SKILL.md** |
221
+ | LOCAL | Create `.claude/skills/local/{name}.md` |
222
222
 
223
- ### ADD_SECTION 삽입 위치
223
+ ### ADD_SECTION insertion position
224
224
 
225
- - `## 참고` 섹션이 있으면 **바로 위**
226
- - 없으면 파일 **맨 끝**
225
+ - If a `## References` section exists, insert **immediately before it**
226
+ - Otherwise, insert at the **very end** of the file
227
227
 
228
- ### NEW_FILE 필수 작업
228
+ ### NEW_FILE required actions
229
229
 
230
- 1. `skills/sonamu/` 에 파일 생성
231
- 2. YAML frontmatter (name, description) 포함
232
- 3. `SKILL.md` "Skills 목록" 테이블에 추가
233
- 4. `SKILL.md` "작업별 Skill 선택" 테이블에 추가
234
- 5. `workflow.md`에서 관련 PHASE가 있으면 참조 스킬에 추가
230
+ 1. Create file in `skills/sonamu/`
231
+ 2. Include YAML frontmatter (name, description)
232
+ 3. Add a row to the "Skills List" table in `SKILL.md`
233
+ 4. Add a row to the "Task-to-Skill" table in `SKILL.md`
234
+ 5. If a related PHASE exists in `.claude/workflow/project_init.md`, add the new skill to its reference skills
235
235
 
236
236
  ---
237
237
 
238
- ## 참고
238
+ ## References
239
239
 
240
- - **스킬 목록 구조**: `SKILL.md`
241
- - **에이전트 규칙**: `AGENTS.md`
242
- - **프로젝트별 로컬 스킬**: `.claude/skills/local/`
240
+ - **Skill list and structure**: `SKILL.md`
241
+ - **Agent rules**: `AGENTS.md`
242
+ - **Project-local skills**: `.claude/skills/local/`
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  name: sonamu-subset
3
- description: Sonamu Subset으로 API 응답 필드 범위 정의. dot notation으로 관계 필드 포함. Use when defining which fields to return in API responses.
3
+ description: Define API response field scope with Sonamu Subsets. Include relation fields using dot notation. Use when defining which fields to return in API responses.
4
4
  ---
5
5
 
6
- # Subset 정의
6
+ # Subset Definition
7
7
 
8
- **실제 동작 코드 참고:**
9
- - `sonamu/examples/miomock/api/src/application/project/project.entity.json` - 복잡한 Subset 예시
10
- - `sonamu/examples/miomock/api/src/application/employee/employee.entity.json` - 기본 Subset 예시
8
+ **Working code references:**
9
+ - `sonamu/examples/miomock/api/src/application/project/project.entity.json` - complex Subset example
10
+ - `sonamu/examples/miomock/api/src/application/employee/employee.entity.json` - basic Subset example
11
11
 
12
- ## 기본 구조
12
+ ## Basic Structure
13
13
 
14
14
  ```json
15
15
  {
@@ -21,20 +21,20 @@ description: Sonamu Subset으로 API 응답 필드 범위 정의. dot notation
21
21
  }
22
22
  ```
23
23
 
24
- ## 네이밍 규칙
24
+ ## Naming Conventions
25
25
 
26
- **WARNING: Subset 이름은 A, P, SS 사용합니다. S, D, L 등 임의의 이름은 사용하지 마세요.**
26
+ **WARNING: Only use A, P, and SS as Subset names. Do not use arbitrary names like S, D, or L.**
27
27
 
28
- | Subset | 용도 |
29
- |--------|------|
30
- | `A` | All - 전체 필드 (상세, 관리자). **필수** |
31
- | `P` | Partial/Profile - 부분 필드, 관계 포함 (목록 조회용) |
32
- | `SS` | Super Simple/Summary - 최소 필드, ID+이름 정도 (드롭다운, 선택용) |
33
- | `P2`, `P3` | 추가 프로파일 (특수한 경우에만) |
28
+ | Subset | Purpose |
29
+ |--------|---------|
30
+ | `A` | All - all fields (detail view, admin). **Required** |
31
+ | `P` | Partial/Profile - partial fields including relations (for list views) |
32
+ | `SS` | Super Simple/Summary - minimal fields, just ID + name (for dropdowns, selects) |
33
+ | `P2`, `P3` | Additional profiles (only for special cases) |
34
34
 
35
- ### IMPORTANT: Subset A 모든 필드 포함 필수
35
+ ### IMPORTANT: Subset A Must Include All Fields
36
36
 
37
- **Subset A Entity의 모든 일반 필드와 주요 relation 필드를 포함해야 합니다.**
37
+ **Subset A must include all regular fields and major relation fields of the Entity.**
38
38
 
39
39
  **DO:**
40
40
  ```json
@@ -56,38 +56,38 @@ description: Sonamu Subset으로 API 응답 필드 범위 정의. dot notation
56
56
  ```json
57
57
  {
58
58
  "subsets": {
59
- "A": ["id", "title"] // created_at, status, author 누락 - 잘못됨
59
+ "A": ["id", "title"] // created_at, status, author omitted - incorrect
60
60
  }
61
61
  }
62
62
  ```
63
63
 
64
- **규칙:**
65
- - 모든 일반 필드(id, created_at, 비즈니스 필드 )를 포함
66
- - BelongsToOne relation은 최소한 `.id`와 표시용 필드(`.name`, `.title` ) 포함
67
- - HasMany relation은 선택적 (필요한 경우만 포함)
64
+ **Rules:**
65
+ - Include all regular fields (id, created_at, business fields, etc.)
66
+ - For BelongsToOne relations, include at least `.id` and a display field (`.name`, `.title`, etc.)
67
+ - HasMany relations are optional (include only when needed)
68
68
 
69
- ### 단일 Subset 필요한 경우
69
+ ### When Only a Single Subset Is Needed
70
70
 
71
71
  ```json
72
- // DO - Correct: A만 생성
72
+ // DO - Correct: create only A
73
73
  { "subsets": { "A": ["id", "name", "created_at"] } }
74
74
  ```
75
75
 
76
76
  ### DO NOT - Incorrect Subset Names
77
77
 
78
78
  ```json
79
- // Incorrect: S, D, L 등 사용 금지
79
+ // Incorrect: do not use S, D, L, etc.
80
80
  {
81
81
  "subsets": {
82
82
  "A": [...],
83
- "S": [...], // NEVER - SS 사용할 것
84
- "D": [...], // NEVER - 사용하지
85
- "L": [...] // NEVER - P 사용할 것
83
+ "S": [...], // NEVER - use SS instead
84
+ "D": [...], // NEVER - do not use
85
+ "L": [...] // NEVER - use P instead
86
86
  }
87
87
  }
88
88
  ```
89
89
 
90
- ## Relation 필드 (Dot Notation)
90
+ ## Relation Fields (Dot Notation)
91
91
 
92
92
  ```json
93
93
  {
@@ -102,18 +102,18 @@ description: Sonamu Subset으로 API 응답 필드 범위 정의. dot notation
102
102
  }
103
103
  ```
104
104
 
105
- - BelongsToOne/OneToOne: 자동 LEFT JOIN
106
- - HasMany/ManyToMany: DataLoader로 자동 최적화
105
+ - BelongsToOne/OneToOne: automatic LEFT JOIN
106
+ - HasMany/ManyToMany: automatically optimized with DataLoader
107
107
 
108
- ## ID 참조 최적화
108
+ ## ID-Only Reference Optimization
109
109
 
110
110
  ```json
111
111
  { "SS": ["id", "title", "user.id"] }
112
112
  ```
113
113
 
114
- - `user.id`만 참조하면 JOIN 없이 `user_id` 컬럼 사용
114
+ - Referencing only `user.id` reads the `user_id` column directly without a JOIN
115
115
 
116
- ## Internal 필드
116
+ ## Internal Fields
117
117
 
118
118
  ```json
119
119
  {
@@ -123,9 +123,9 @@ description: Sonamu Subset으로 API 응답 필드 범위 정의. dot notation
123
123
  }
124
124
  ```
125
125
 
126
- - 쿼리에 포함되지만 API 응답 타입에서 제외
126
+ - Included in the query but excluded from the API response type
127
127
 
128
- ## Model에서 사용
128
+ ## Usage in Models
129
129
 
130
130
  ```typescript
131
131
  // findById
@@ -145,22 +145,22 @@ const result = await UserModel.executeSubsetQuery({
145
145
  });
146
146
  ```
147
147
 
148
- ## 주의사항
148
+ ## Notes
149
149
 
150
- - 기본 Subset `A`는 필수
151
- - 중첩 depth 3단계 이하 권장
152
- - 목록용 Subset은 불필요한 관계 제외
153
- - **FK 컬럼은 relation 표기 사용**: BelongsToOne 관계의 FK 컬럼(예: `user_id`) Subset에서 `user.id` 형태로 접근해야 함. 이는 Sonamu relation 표기를 인식하여 `.id`만 참조 자동으로 FK 컬럼을 직접 읽는 최적화를 수행하기 때문
150
+ - The base Subset `A` is required
151
+ - Nesting depth of 3 or fewer levels is recommended
152
+ - Exclude unnecessary relations from list-purpose Subsets
153
+ - **Use relation notation for FK columns**: FK columns for BelongsToOne relations (e.g. `user_id`) must be accessed in Subsets using the `user.id` form. This is because Sonamu recognizes the relation notation and automatically optimizes by reading the FK column directly when only `.id` is referenced.
154
154
 
155
155
  ```json
156
- // DO NOT - Incorrect: FK 컬럼 직접 사용
156
+ // DO NOT - Incorrect: using FK column directly
157
157
  { "A": ["id", "user_id", "title"] }
158
158
 
159
- // DO - Correct: relation.field 형식 사용 (자동 최적화)
159
+ // DO - Correct: use relation.field format (auto-optimized)
160
160
  { "A": ["id", "user.id", "title"] }
161
- // → Sonamu user_id 컬럼을 직접 읽음 (JOIN 없음)
161
+ // → Sonamu reads the user_id column directly (no JOIN)
162
162
  ```
163
163
 
164
- **실제 동작 코드 참고:**
165
- - `sonamu/examples/miomock/api/src/application/project/project.entity.json` - Subset 정의 예시
166
- - `sonamu/examples/miomock/api/src/application/employee/employee.entity.json` - BelongsToOne 관계 예시
164
+ **Working code references:**
165
+ - `sonamu/examples/miomock/api/src/application/project/project.entity.json` - Subset definition examples
166
+ - `sonamu/examples/miomock/api/src/application/employee/employee.entity.json` - BelongsToOne relation examples