@mandujs/cli 0.15.0 → 0.15.2

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 (90) hide show
  1. package/README.ko.md +33 -33
  2. package/README.md +354 -354
  3. package/package.json +2 -2
  4. package/src/commands/check.ts +71 -7
  5. package/src/commands/contract.ts +173 -173
  6. package/src/commands/dev.ts +9 -42
  7. package/src/commands/guard-arch.ts +303 -303
  8. package/src/commands/init.ts +50 -5
  9. package/src/commands/monitor.ts +300 -300
  10. package/src/commands/openapi.ts +107 -107
  11. package/src/commands/registry.ts +1 -0
  12. package/src/commands/start.ts +9 -42
  13. package/src/errors/codes.ts +35 -35
  14. package/src/errors/index.ts +2 -2
  15. package/src/errors/messages.ts +143 -143
  16. package/src/hooks/index.ts +17 -17
  17. package/src/hooks/preaction.ts +256 -256
  18. package/src/main.ts +9 -7
  19. package/src/terminal/banner.ts +166 -166
  20. package/src/terminal/help.ts +306 -306
  21. package/src/terminal/index.ts +71 -71
  22. package/src/terminal/output.ts +295 -295
  23. package/src/terminal/palette.ts +30 -30
  24. package/src/terminal/progress.ts +327 -327
  25. package/src/terminal/stream-writer.ts +214 -214
  26. package/src/terminal/table.ts +354 -354
  27. package/src/terminal/theme.ts +142 -142
  28. package/src/util/bun.ts +6 -6
  29. package/src/util/fs.ts +23 -23
  30. package/src/util/handlers.ts +49 -5
  31. package/src/util/lockfile.ts +66 -0
  32. package/src/util/output.ts +22 -22
  33. package/src/util/port.ts +71 -71
  34. package/templates/default/AGENTS.md +96 -96
  35. package/templates/default/app/api/health/route.ts +13 -13
  36. package/templates/default/app/globals.css +49 -49
  37. package/templates/default/app/layout.tsx +27 -27
  38. package/templates/default/app/page.tsx +38 -38
  39. package/templates/default/src/client/shared/lib/utils.ts +16 -16
  40. package/templates/default/src/client/shared/ui/button.tsx +57 -57
  41. package/templates/default/src/client/shared/ui/card.tsx +1 -1
  42. package/templates/default/src/client/shared/ui/index.ts +21 -21
  43. package/templates/default/src/client/shared/ui/input.tsx +5 -1
  44. package/templates/default/tests/example.test.ts +58 -58
  45. package/templates/default/tests/helpers.ts +52 -52
  46. package/templates/default/tests/setup.ts +9 -9
  47. package/templates/default/tsconfig.json +23 -23
  48. package/templates/realtime-chat/AGENTS.md +96 -0
  49. package/templates/realtime-chat/app/api/chat/messages/route.ts +63 -0
  50. package/templates/realtime-chat/app/api/chat/stream/route.ts +48 -0
  51. package/templates/realtime-chat/app/api/health/route.ts +13 -0
  52. package/templates/realtime-chat/app/globals.css +49 -0
  53. package/templates/realtime-chat/app/layout.tsx +27 -0
  54. package/templates/realtime-chat/app/page.tsx +16 -0
  55. package/templates/realtime-chat/package.json +34 -0
  56. package/templates/realtime-chat/src/client/app/index.ts +1 -0
  57. package/templates/realtime-chat/src/client/entities/index.ts +1 -0
  58. package/templates/realtime-chat/src/client/features/chat/chat-api.ts +177 -0
  59. package/templates/realtime-chat/src/client/features/chat/realtime-chat-starter.client.tsx +89 -0
  60. package/templates/realtime-chat/src/client/features/chat/use-realtime-chat.ts +73 -0
  61. package/templates/realtime-chat/src/client/features/index.ts +1 -0
  62. package/templates/realtime-chat/src/client/pages/index.ts +1 -0
  63. package/templates/realtime-chat/src/client/shared/index.ts +1 -0
  64. package/templates/realtime-chat/src/client/shared/lib/utils.ts +16 -0
  65. package/templates/realtime-chat/src/client/shared/ui/button.tsx +57 -0
  66. package/templates/realtime-chat/src/client/shared/ui/card.tsx +78 -0
  67. package/templates/realtime-chat/src/client/shared/ui/index.ts +21 -0
  68. package/templates/realtime-chat/src/client/shared/ui/input.tsx +28 -0
  69. package/templates/realtime-chat/src/client/widgets/index.ts +1 -0
  70. package/templates/realtime-chat/src/server/api/index.ts +1 -0
  71. package/templates/realtime-chat/src/server/application/ai-adapter.ts +24 -0
  72. package/templates/realtime-chat/src/server/application/chat-store.ts +88 -0
  73. package/templates/realtime-chat/src/server/application/index.ts +1 -0
  74. package/templates/realtime-chat/src/server/core/index.ts +1 -0
  75. package/templates/realtime-chat/src/server/domain/index.ts +1 -0
  76. package/templates/realtime-chat/src/server/infra/index.ts +1 -0
  77. package/templates/realtime-chat/src/shared/contracts/chat.ts +29 -0
  78. package/templates/realtime-chat/src/shared/contracts/index.ts +1 -0
  79. package/templates/realtime-chat/src/shared/env/index.ts +1 -0
  80. package/templates/realtime-chat/src/shared/schema/index.ts +1 -0
  81. package/templates/realtime-chat/src/shared/types/index.ts +1 -0
  82. package/templates/realtime-chat/src/shared/utils/client/index.ts +1 -0
  83. package/templates/realtime-chat/src/shared/utils/server/index.ts +1 -0
  84. package/templates/realtime-chat/tests/chat-api.sse.test.ts +151 -0
  85. package/templates/realtime-chat/tests/chat-starter.test.ts +149 -0
  86. package/templates/realtime-chat/tests/chat-store.concurrency.test.ts +39 -0
  87. package/templates/realtime-chat/tests/example.test.ts +58 -0
  88. package/templates/realtime-chat/tests/helpers.ts +52 -0
  89. package/templates/realtime-chat/tests/setup.ts +9 -0
  90. package/templates/realtime-chat/tsconfig.json +23 -0
package/README.ko.md CHANGED
@@ -72,7 +72,11 @@ my-app/
72
72
  │ ├── server/main.ts # 서버 진입점
73
73
  │ └── web/entry.tsx # 클라이언트 진입점
74
74
  ├── spec/
75
- └── routes.manifest.json # SSOT - 라우트 정의
75
+ ├── slots/ # 비즈니스 로직 파일
76
+ │ └── contracts/ # 타입 안전 계약
77
+ ├── .mandu/ # 생성된 산출물 (자동 관리)
78
+ │ ├── routes.manifest.json # 라우트 매니페스트 (자동 생성)
79
+ │ └── spec.lock.json # 해시 검증
76
80
  ├── package.json
77
81
  └── tsconfig.json
78
82
  ```
@@ -87,12 +91,12 @@ bun run dev
87
91
  bunx mandu dev
88
92
  ```
89
93
 
90
- ### `mandu spec`
94
+ ### `mandu routes generate`
91
95
 
92
- spec 파일을 검증하고 lock 파일을 갱신합니다.
96
+ FS Routes(app/)를 스캔하여 매니페스트를 생성합니다.
93
97
 
94
98
  ```bash
95
- bun run spec
99
+ bun run generate
96
100
  ```
97
101
 
98
102
  ### `mandu generate`
@@ -149,30 +153,28 @@ bunx mandu contract build
149
153
  bunx mandu contract diff
150
154
  ```
151
155
 
152
- ## Spec 파일 작성
156
+ ## FS Routes (라우트 정의)
153
157
 
154
- `spec/routes.manifest.json`이 모든 라우트의 단일 진실 공급원(SSOT)입니다.
158
+ `app/` 디렉토리가 모든 라우트의 단일 진실 공급원(SSOT)입니다. 파일을 생성하면 라우트가 자동으로 정의됩니다.
155
159
 
156
- ```json
157
- {
158
- "version": "1.0.0",
159
- "routes": [
160
- {
161
- "id": "getUsers",
162
- "pattern": "/api/users",
163
- "kind": "api",
164
- "module": "apps/server/api/users.ts"
165
- },
166
- {
167
- "id": "homePage",
168
- "pattern": "/",
169
- "kind": "page",
170
- "module": "apps/server/pages/home.ts",
171
- "componentModule": "apps/web/pages/Home.tsx"
172
- }
173
- ]
174
- }
175
160
  ```
161
+ app/
162
+ ├── page.tsx # / (홈 페이지)
163
+ ├── about/
164
+ │ └── page.tsx # /about
165
+ ├── api/
166
+ │ └── users/
167
+ │ └── route.ts # /api/users
168
+ └── blog/
169
+ └── [slug]/
170
+ └── page.tsx # /blog/:slug (동적 라우트)
171
+ ```
172
+
173
+ `bun run generate` 실행 시 `app/` 디렉토리를 스캔하여 `.mandu/routes.manifest.json`을 자동 생성합니다.
174
+ 직접 매니페스트를 편집할 필요가 없습니다.
175
+
176
+ - `spec/slots/` - 개발자가 작성하는 비즈니스 로직
177
+ - `spec/contracts/` - 타입 안전 계약 정의
176
178
 
177
179
  ### Slot 시스템 (v0.2.0+)
178
180
 
@@ -194,20 +196,18 @@ bunx mandu contract diff
194
196
  ## 개발 워크플로우
195
197
 
196
198
  ```bash
197
- # 1. spec 수정
198
- # 2. spec 검증 및 lock 갱신
199
- bun run spec
199
+ # 1. app/ 디렉토리에 라우트 파일 생성/수정
200
200
 
201
- # 3. 코드 생성
201
+ # 2. 코드 생성 (매니페스트 자동 갱신)
202
202
  bun run generate
203
203
 
204
- # 4. 아키텍처 검사
204
+ # 3. 아키텍처 검사
205
205
  bun run guard
206
206
 
207
- # 5. 테스트
207
+ # 4. 테스트
208
208
  bun test
209
209
 
210
- # 6. 개발 서버
210
+ # 5. 개발 서버
211
211
  bun run dev
212
212
  ```
213
213
 
@@ -231,4 +231,4 @@ bun test --watch # 감시 모드
231
231
 
232
232
  ## 라이선스
233
233
 
234
- MIT
234
+ MPL-2.0