@mandujs/mcp 0.38.12 → 0.39.0-beta.1

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 (183) hide show
  1. package/README.md +3 -3
  2. package/package.json +3 -5
  3. package/src/activity-adapter.ts +23 -23
  4. package/src/activity-monitor.ts +39 -10
  5. package/src/adapters/index.ts +20 -20
  6. package/src/adapters/monitor-adapter.ts +100 -100
  7. package/src/adapters/tool-adapter.ts +90 -90
  8. package/src/executor/index.ts +22 -22
  9. package/src/executor/tool-executor.ts +148 -148
  10. package/src/hooks/config-watcher.ts +173 -173
  11. package/src/hooks/index.ts +23 -23
  12. package/src/hooks/mcp-hooks.ts +227 -227
  13. package/src/index.ts +5 -5
  14. package/src/logging/index.ts +15 -15
  15. package/src/logging/mcp-transport.ts +134 -134
  16. package/src/new-resources.ts +2 -2
  17. package/src/profiles.ts +25 -54
  18. package/src/prompts.ts +4 -4
  19. package/src/registry/index.ts +13 -13
  20. package/src/registry/mcp-tool-registry.ts +298 -298
  21. package/src/resources/generated-skills/catalog.ts +36 -0
  22. package/src/resources/generated-skills/mandu-agent-workflow/SKILL.md +48 -0
  23. package/src/resources/generated-skills/mandu-contract/SKILL.md +20 -0
  24. package/src/resources/generated-skills/mandu-fs-routes/SKILL.md +19 -0
  25. package/src/resources/generated-skills/mandu-guard/SKILL.md +20 -0
  26. package/src/resources/generated-skills/mandu-hydration/SKILL.md +19 -0
  27. package/src/resources/generated-skills/mandu-testing/SKILL.md +20 -0
  28. package/src/resources/handlers.ts +3 -3
  29. package/src/resources/skills/guides.ts +49 -49
  30. package/src/resources/skills/index.ts +12 -12
  31. package/src/resources/skills/loader.ts +8 -35
  32. package/src/resources/skills/recipes.ts +28 -28
  33. package/src/server.ts +1 -1
  34. package/src/tools/agent.ts +479 -409
  35. package/src/tools/ate-exemplar.ts +92 -92
  36. package/src/tools/ate-flakes.ts +90 -90
  37. package/src/tools/ate-mutate.ts +103 -103
  38. package/src/tools/ate-mutation-report.ts +64 -64
  39. package/src/tools/ate-oracle-pending.ts +49 -49
  40. package/src/tools/ate-oracle-replay.ts +44 -44
  41. package/src/tools/ate-oracle-verdict.ts +70 -70
  42. package/src/tools/ate-prompt.ts +146 -146
  43. package/src/tools/ate-run.ts +1 -1
  44. package/src/tools/ate.ts +38 -38
  45. package/src/tools/brain.ts +6 -6
  46. package/src/tools/composite.ts +19 -61
  47. package/src/tools/contract.ts +11 -9
  48. package/src/tools/deploy-plan.ts +2 -2
  49. package/src/tools/deploy-preview.ts +316 -316
  50. package/src/tools/design.ts +825 -825
  51. package/src/tools/docs.ts +350 -350
  52. package/src/tools/generate.ts +4 -3
  53. package/src/tools/guard.ts +1 -1
  54. package/src/tools/history.ts +1 -1
  55. package/src/tools/hydration.ts +64 -64
  56. package/src/tools/index.ts +0 -118
  57. package/src/tools/kitchen.ts +72 -72
  58. package/src/tools/lint.ts +226 -226
  59. package/src/tools/loop-close.ts +175 -175
  60. package/src/tools/negotiate.ts +263 -263
  61. package/src/tools/resource.ts +1 -1
  62. package/src/tools/run-tests.ts +424 -424
  63. package/src/tools/runtime.ts +1 -1
  64. package/src/tools/seo.ts +1 -1
  65. package/src/tools/slot-validation.ts +19 -19
  66. package/src/tools/spec.ts +201 -201
  67. package/src/tools/transaction.ts +1 -1
  68. package/src/tx-lock.ts +73 -73
  69. package/src/utils/runtime-control.ts +52 -52
  70. package/src/utils/withWarnings.ts +1 -1
  71. package/src/resources/skills/mandu-agent-workflow/SKILL.md +0 -124
  72. package/src/resources/skills/mandu-agent-workflow/metadata.json +0 -7
  73. package/src/resources/skills/mandu-composition/SKILL.md +0 -131
  74. package/src/resources/skills/mandu-composition/metadata.json +0 -13
  75. package/src/resources/skills/mandu-composition/rules/_sections.md +0 -26
  76. package/src/resources/skills/mandu-composition/rules/_template.md +0 -77
  77. package/src/resources/skills/mandu-composition/rules/comp-arch-avoid-boolean-props.md +0 -146
  78. package/src/resources/skills/mandu-composition/rules/comp-arch-compound-components.md +0 -164
  79. package/src/resources/skills/mandu-composition/rules/comp-island-event.md +0 -161
  80. package/src/resources/skills/mandu-composition/rules/comp-island-slot-split.md +0 -167
  81. package/src/resources/skills/mandu-composition/rules/comp-pattern-children.md +0 -149
  82. package/src/resources/skills/mandu-composition/rules/comp-state-context-interface.md +0 -148
  83. package/src/resources/skills/mandu-composition/rules/comp-state-lift-state.md +0 -150
  84. package/src/resources/skills/mandu-deployment/SKILL.md +0 -135
  85. package/src/resources/skills/mandu-deployment/_sections.md +0 -41
  86. package/src/resources/skills/mandu-deployment/_template.md +0 -38
  87. package/src/resources/skills/mandu-deployment/metadata.json +0 -13
  88. package/src/resources/skills/mandu-deployment/rules/db-provider-supabase.md +0 -300
  89. package/src/resources/skills/mandu-deployment/rules/deploy-build-bun.md +0 -109
  90. package/src/resources/skills/mandu-deployment/rules/deploy-build-output.md +0 -115
  91. package/src/resources/skills/mandu-deployment/rules/deploy-cicd-github.md +0 -219
  92. package/src/resources/skills/mandu-deployment/rules/deploy-docker-bun.md +0 -150
  93. package/src/resources/skills/mandu-deployment/rules/deploy-docker-compose.md +0 -223
  94. package/src/resources/skills/mandu-deployment/rules/deploy-platform-fly.md +0 -152
  95. package/src/resources/skills/mandu-deployment/rules/deploy-platform-render.md +0 -179
  96. package/src/resources/skills/mandu-deployment/rules/deploy-platform-vercel.md +0 -140
  97. package/src/resources/skills/mandu-fs-routes/SKILL.md +0 -122
  98. package/src/resources/skills/mandu-fs-routes/metadata.json +0 -12
  99. package/src/resources/skills/mandu-fs-routes/rules/_sections.md +0 -36
  100. package/src/resources/skills/mandu-fs-routes/rules/_template.md +0 -69
  101. package/src/resources/skills/mandu-fs-routes/rules/routes-api-methods.md +0 -65
  102. package/src/resources/skills/mandu-fs-routes/rules/routes-dynamic-param.md +0 -93
  103. package/src/resources/skills/mandu-fs-routes/rules/routes-naming-page.md +0 -55
  104. package/src/resources/skills/mandu-guard/SKILL.md +0 -162
  105. package/src/resources/skills/mandu-guard/metadata.json +0 -12
  106. package/src/resources/skills/mandu-guard/rules/_sections.md +0 -36
  107. package/src/resources/skills/mandu-guard/rules/_template.md +0 -82
  108. package/src/resources/skills/mandu-guard/rules/guard-config-rules.md +0 -100
  109. package/src/resources/skills/mandu-guard/rules/guard-layer-direction.md +0 -76
  110. package/src/resources/skills/mandu-guard/rules/guard-preset-mandu.md +0 -81
  111. package/src/resources/skills/mandu-guard/rules/guard-validate-import.md +0 -80
  112. package/src/resources/skills/mandu-hydration/SKILL.md +0 -139
  113. package/src/resources/skills/mandu-hydration/metadata.json +0 -12
  114. package/src/resources/skills/mandu-hydration/rules/_sections.md +0 -31
  115. package/src/resources/skills/mandu-hydration/rules/_template.md +0 -72
  116. package/src/resources/skills/mandu-hydration/rules/hydration-data-event.md +0 -109
  117. package/src/resources/skills/mandu-hydration/rules/hydration-directive-use-client.md +0 -55
  118. package/src/resources/skills/mandu-hydration/rules/hydration-island-setup.md +0 -160
  119. package/src/resources/skills/mandu-hydration/rules/hydration-priority-visible.md +0 -91
  120. package/src/resources/skills/mandu-performance/SKILL.md +0 -125
  121. package/src/resources/skills/mandu-performance/metadata.json +0 -14
  122. package/src/resources/skills/mandu-performance/rules/_sections.md +0 -31
  123. package/src/resources/skills/mandu-performance/rules/_template.md +0 -64
  124. package/src/resources/skills/mandu-performance/rules/perf-async-defer-await.md +0 -103
  125. package/src/resources/skills/mandu-performance/rules/perf-async-parallel.md +0 -95
  126. package/src/resources/skills/mandu-performance/rules/perf-bun-file.md +0 -124
  127. package/src/resources/skills/mandu-performance/rules/perf-bun-serve.md +0 -125
  128. package/src/resources/skills/mandu-performance/rules/perf-bundle-imports.md +0 -80
  129. package/src/resources/skills/mandu-performance/rules/perf-bundle-island-lazy.md +0 -145
  130. package/src/resources/skills/mandu-performance/rules/perf-cache-react.md +0 -98
  131. package/src/resources/skills/mandu-performance/rules/perf-render-transitions.md +0 -154
  132. package/src/resources/skills/mandu-security/SKILL.md +0 -127
  133. package/src/resources/skills/mandu-security/metadata.json +0 -13
  134. package/src/resources/skills/mandu-security/rules/_sections.md +0 -31
  135. package/src/resources/skills/mandu-security/rules/_template.md +0 -74
  136. package/src/resources/skills/mandu-security/rules/sec-auth-guard.md +0 -127
  137. package/src/resources/skills/mandu-security/rules/sec-env-management.md +0 -133
  138. package/src/resources/skills/mandu-security/rules/sec-input-validate.md +0 -148
  139. package/src/resources/skills/mandu-security/rules/sec-protect-csrf.md +0 -146
  140. package/src/resources/skills/mandu-security/rules/sec-protect-headers.md +0 -138
  141. package/src/resources/skills/mandu-slot/SKILL.md +0 -125
  142. package/src/resources/skills/mandu-slot/metadata.json +0 -12
  143. package/src/resources/skills/mandu-slot/rules/_sections.md +0 -36
  144. package/src/resources/skills/mandu-slot/rules/_template.md +0 -63
  145. package/src/resources/skills/mandu-slot/rules/slot-basic-structure.md +0 -38
  146. package/src/resources/skills/mandu-slot/rules/slot-ctx-response.md +0 -56
  147. package/src/resources/skills/mandu-slot/rules/slot-guard-auth.md +0 -59
  148. package/src/resources/skills/mandu-slot/rules/slot-http-methods.md +0 -64
  149. package/src/resources/skills/mandu-styling/SKILL.md +0 -196
  150. package/src/resources/skills/mandu-styling/_sections.md +0 -43
  151. package/src/resources/skills/mandu-styling/_template.md +0 -32
  152. package/src/resources/skills/mandu-styling/metadata.json +0 -15
  153. package/src/resources/skills/mandu-styling/rules/style-component-compound.md +0 -235
  154. package/src/resources/skills/mandu-styling/rules/style-component-slots.md +0 -255
  155. package/src/resources/skills/mandu-styling/rules/style-component-tokens.md +0 -205
  156. package/src/resources/skills/mandu-styling/rules/style-island-animations.md +0 -272
  157. package/src/resources/skills/mandu-styling/rules/style-island-scoping.md +0 -167
  158. package/src/resources/skills/mandu-styling/rules/style-island-variants.md +0 -221
  159. package/src/resources/skills/mandu-styling/rules/style-perf-critical.md +0 -209
  160. package/src/resources/skills/mandu-styling/rules/style-perf-purge.md +0 -192
  161. package/src/resources/skills/mandu-styling/rules/style-setup-modules.md +0 -162
  162. package/src/resources/skills/mandu-styling/rules/style-setup-panda.md +0 -164
  163. package/src/resources/skills/mandu-styling/rules/style-setup-tailwind.md +0 -170
  164. package/src/resources/skills/mandu-styling/rules/style-tailwind-v4-gotchas.md +0 -179
  165. package/src/resources/skills/mandu-styling/rules/style-theme-darkmode.md +0 -229
  166. package/src/resources/skills/mandu-testing/SKILL.md +0 -132
  167. package/src/resources/skills/mandu-testing/metadata.json +0 -13
  168. package/src/resources/skills/mandu-testing/rules/_sections.md +0 -26
  169. package/src/resources/skills/mandu-testing/rules/_template.md +0 -65
  170. package/src/resources/skills/mandu-testing/rules/test-component-island.md +0 -195
  171. package/src/resources/skills/mandu-testing/rules/test-e2e-playwright.md +0 -196
  172. package/src/resources/skills/mandu-testing/rules/test-mock-fetch.md +0 -219
  173. package/src/resources/skills/mandu-testing/rules/test-slot-unit.md +0 -192
  174. package/src/resources/skills/mandu-ui/SKILL.md +0 -159
  175. package/src/resources/skills/mandu-ui/_sections.md +0 -23
  176. package/src/resources/skills/mandu-ui/_template.md +0 -32
  177. package/src/resources/skills/mandu-ui/metadata.json +0 -13
  178. package/src/resources/skills/mandu-ui/rules/ui-accessibility-aria.md +0 -232
  179. package/src/resources/skills/mandu-ui/rules/ui-accessibility-focus.md +0 -238
  180. package/src/resources/skills/mandu-ui/rules/ui-composition-patterns.md +0 -259
  181. package/src/resources/skills/mandu-ui/rules/ui-island-integration.md +0 -258
  182. package/src/resources/skills/mandu-ui/rules/ui-radix-patterns.md +0 -213
  183. package/src/resources/skills/mandu-ui/rules/ui-shadcn-setup.md +0 -209
@@ -1,152 +0,0 @@
1
- ---
2
- title: Deploy to Fly.io
3
- impact: MEDIUM
4
- impactDescription: Edge deployment for global performance
5
- tags: deployment, fly, edge, platform
6
- ---
7
-
8
- ## Deploy to Fly.io
9
-
10
- **Impact: MEDIUM (Edge deployment for global performance)**
11
-
12
- Fly.io를 사용하여 전 세계 엣지에서 Mandu 앱을 실행하세요.
13
-
14
- **fly.toml 설정:**
15
-
16
- ```toml
17
- app = "mandu-app"
18
- primary_region = "nrt" # Tokyo
19
-
20
- [build]
21
- dockerfile = "Dockerfile"
22
-
23
- [env]
24
- NODE_ENV = "production"
25
- BUN_ENV = "production"
26
-
27
- [http_service]
28
- internal_port = 3000
29
- force_https = true
30
- auto_stop_machines = true
31
- auto_start_machines = true
32
- min_machines_running = 1
33
-
34
- [http_service.concurrency]
35
- type = "requests"
36
- hard_limit = 250
37
- soft_limit = 200
38
-
39
- [[vm]]
40
- cpu_kind = "shared"
41
- cpus = 1
42
- memory_mb = 512
43
- ```
44
-
45
- **Dockerfile:**
46
-
47
- ```dockerfile
48
- FROM oven/bun:1.0-slim as builder
49
-
50
- WORKDIR /app
51
- COPY package.json bun.lockb ./
52
- RUN bun install --frozen-lockfile
53
-
54
- COPY . .
55
- RUN bun run build
56
-
57
- # Production image
58
- FROM oven/bun:1.0-slim
59
-
60
- WORKDIR /app
61
- COPY --from=builder /app/dist ./dist
62
- COPY --from=builder /app/node_modules ./node_modules
63
- COPY package.json ./
64
-
65
- EXPOSE 3000
66
- USER bun
67
-
68
- CMD ["bun", "run", "start"]
69
- ```
70
-
71
- ## 배포 명령어
72
-
73
- ```bash
74
- # Fly CLI 설치
75
- curl -L https://fly.io/install.sh | sh
76
-
77
- # 로그인
78
- fly auth login
79
-
80
- # 앱 생성
81
- fly launch --name mandu-app --region nrt
82
-
83
- # 배포
84
- fly deploy
85
-
86
- # 스케일링
87
- fly scale count 2 --region nrt,sin
88
-
89
- # 로그 확인
90
- fly logs
91
- ```
92
-
93
- ## 멀티 리전 배포
94
-
95
- ```toml
96
- # fly.toml
97
- app = "mandu-app"
98
- primary_region = "nrt"
99
-
100
- # 여러 리전에 배포
101
- [processes]
102
- app = "bun run start"
103
-
104
- [[vm]]
105
- cpu_kind = "shared"
106
- cpus = 1
107
- memory_mb = 512
108
-
109
- # 리전별 스케일링
110
- # fly scale count app=2 --region nrt
111
- # fly scale count app=1 --region sin
112
- ```
113
-
114
- ## Secrets 관리
115
-
116
- ```bash
117
- # Secret 설정
118
- fly secrets set DATABASE_URL="postgresql://..."
119
- fly secrets set SESSION_SECRET="..."
120
-
121
- # Secret 목록
122
- fly secrets list
123
-
124
- # Secret 삭제
125
- fly secrets unset OLD_SECRET
126
- ```
127
-
128
- ## 볼륨 (Persistent Storage)
129
-
130
- ```bash
131
- # 볼륨 생성
132
- fly volumes create mandu_data --region nrt --size 1
133
-
134
- # fly.toml에 마운트
135
- [mounts]
136
- source = "mandu_data"
137
- destination = "/data"
138
- ```
139
-
140
- ## 헬스체크
141
-
142
- ```toml
143
- # fly.toml
144
- [[services.http_checks]]
145
- interval = "10s"
146
- timeout = "2s"
147
- grace_period = "5s"
148
- method = "GET"
149
- path = "/health"
150
- ```
151
-
152
- Reference: [Fly.io Documentation](https://fly.io/docs/)
@@ -1,179 +0,0 @@
1
- ---
2
- title: Deploy to Render
3
- impact: HIGH
4
- impactDescription: Managed platform for production workloads
5
- tags: deployment, render, platform, hosting
6
- ---
7
-
8
- ## Deploy to Render
9
-
10
- **Impact: HIGH (Managed platform for production workloads)**
11
-
12
- Render를 사용하여 Mandu 앱을 배포하세요. 자동 HTTPS, 스케일링, 무중단 배포를 지원합니다.
13
-
14
- **render.yaml (Blueprint):**
15
-
16
- ```yaml
17
- services:
18
- - type: web
19
- name: mandu-app
20
- runtime: node
21
- region: singapore # 또는 oregon, frankfurt 등
22
- plan: starter # starter, standard, pro
23
-
24
- buildCommand: |
25
- curl -fsSL https://bun.sh/install | bash
26
- export PATH="$HOME/.bun/bin:$PATH"
27
- bun install --frozen-lockfile
28
- bun run build
29
-
30
- startCommand: |
31
- export PATH="$HOME/.bun/bin:$PATH"
32
- bun run start
33
-
34
- healthCheckPath: /health
35
-
36
- envVars:
37
- - key: NODE_ENV
38
- value: production
39
- - key: BUN_ENV
40
- value: production
41
- - key: DATABASE_URL
42
- fromDatabase:
43
- name: mandu-db
44
- property: connectionString
45
- - key: SESSION_SECRET
46
- generateValue: true
47
-
48
- databases:
49
- - name: mandu-db
50
- plan: starter
51
- databaseName: mandu
52
- user: mandu
53
- ```
54
-
55
- ## 헬스체크 엔드포인트
56
-
57
- ```typescript
58
- // app/health/slot.ts
59
- import { Mandu } from "@mandujs/core";
60
-
61
- export default Mandu.filling({
62
- get: async (ctx) => {
63
- // 데이터베이스 연결 확인
64
- try {
65
- await db.query("SELECT 1");
66
- return ctx.ok({ status: "healthy", timestamp: new Date().toISOString() });
67
- } catch (error) {
68
- return ctx.fail("Database connection failed");
69
- }
70
- },
71
- });
72
- ```
73
-
74
- ## Render Native Runtime (Bun 직접 지원)
75
-
76
- ```yaml
77
- # render.yaml - Bun 네이티브 (Beta)
78
- services:
79
- - type: web
80
- name: mandu-app
81
- runtime: docker
82
- dockerfilePath: ./Dockerfile
83
-
84
- envVars:
85
- - key: NODE_ENV
86
- value: production
87
- ```
88
-
89
- ```dockerfile
90
- # Dockerfile
91
- FROM oven/bun:1.0-slim
92
-
93
- WORKDIR /app
94
-
95
- COPY package.json bun.lockb ./
96
- RUN bun install --frozen-lockfile --production
97
-
98
- COPY . .
99
- RUN bun run build
100
-
101
- EXPOSE 3000
102
- USER bun
103
-
104
- CMD ["bun", "run", "start"]
105
- ```
106
-
107
- ## 환경별 배포
108
-
109
- ```yaml
110
- # render.yaml - Preview Environments
111
- previewsEnabled: true
112
- previewsExpireAfterDays: 7
113
-
114
- services:
115
- - type: web
116
- name: mandu-app
117
- # ... 기본 설정
118
-
119
- envVars:
120
- - key: NODE_ENV
121
- value: production
122
- - key: API_URL
123
- fromGroup: mandu-production # Production
124
-
125
- previews:
126
- generation: automatic
127
- envVars:
128
- - key: API_URL
129
- fromGroup: mandu-staging # Preview는 staging 사용
130
- ```
131
-
132
- ## 자동 배포 설정
133
-
134
- ```yaml
135
- # GitHub 연동 시 자동 배포
136
- # render.yaml
137
- services:
138
- - type: web
139
- name: mandu-app
140
- repo: https://github.com/your-org/mandu-app
141
- branch: main # main 브랜치 자동 배포
142
- autoDeploy: true # push 시 자동 배포
143
- ```
144
-
145
- ## 스케일링 설정
146
-
147
- ```yaml
148
- services:
149
- - type: web
150
- name: mandu-app
151
- plan: standard
152
-
153
- scaling:
154
- minInstances: 1
155
- maxInstances: 5
156
- targetMemoryPercent: 80
157
- targetCPUPercent: 70
158
- ```
159
-
160
- ## Render CLI
161
-
162
- ```bash
163
- # CLI 설치
164
- npm install -g @render/cli
165
-
166
- # 로그인
167
- render login
168
-
169
- # 서비스 목록
170
- render services list
171
-
172
- # 수동 배포
173
- render deploys create --service-id srv-xxx
174
-
175
- # 로그 확인
176
- render logs --service-id srv-xxx --tail
177
- ```
178
-
179
- Reference: [Render Documentation](https://render.com/docs)
@@ -1,140 +0,0 @@
1
- ---
2
- title: Deploy to Vercel
3
- impact: MEDIUM
4
- impactDescription: Serverless deployment with edge functions
5
- tags: deployment, vercel, serverless, edge
6
- ---
7
-
8
- ## Deploy to Vercel
9
-
10
- **Impact: MEDIUM (Serverless deployment with edge functions)**
11
-
12
- Vercel을 사용하여 Mandu 앱을 서버리스로 배포하세요.
13
-
14
- **vercel.json 설정:**
15
-
16
- ```json
17
- {
18
- "buildCommand": "bun run build",
19
- "outputDirectory": "dist",
20
- "framework": null,
21
- "functions": {
22
- "api/**/*.ts": {
23
- "runtime": "nodejs20.x",
24
- "memory": 1024,
25
- "maxDuration": 10
26
- }
27
- },
28
- "rewrites": [
29
- { "source": "/api/(.*)", "destination": "/api/$1" },
30
- { "source": "/(.*)", "destination": "/index.html" }
31
- ]
32
- }
33
- ```
34
-
35
- **주의사항:**
36
- Vercel은 Bun 런타임을 직접 지원하지 않으므로, Node.js 호환 모드로 빌드해야 합니다.
37
-
38
- **Node.js 호환 빌드:**
39
-
40
- ```typescript
41
- // scripts/build-vercel.ts
42
- await Bun.build({
43
- entrypoints: ["./src/server.ts"],
44
- outdir: "./dist",
45
- target: "node", // Node.js 타겟으로 빌드
46
- minify: true,
47
- external: ["@vercel/node"],
48
- });
49
- ```
50
-
51
- ## API Routes 변환
52
-
53
- ```typescript
54
- // api/users/index.ts (Vercel Serverless Function)
55
- import type { VercelRequest, VercelResponse } from "@vercel/node";
56
- import { createHandler } from "@mandujs/vercel";
57
- import usersSlot from "../../app/users/slot";
58
-
59
- export default createHandler(usersSlot);
60
- ```
61
-
62
- **createHandler 구현:**
63
-
64
- ```typescript
65
- // lib/vercel.ts
66
- import type { VercelRequest, VercelResponse } from "@vercel/node";
67
-
68
- export function createHandler(slot: Slot) {
69
- return async (req: VercelRequest, res: VercelResponse) => {
70
- const method = req.method?.toLowerCase() || "get";
71
- const handler = slot.handlers[method];
72
-
73
- if (!handler) {
74
- return res.status(405).json({ error: "Method not allowed" });
75
- }
76
-
77
- const ctx = createContext(req);
78
- const result = await handler(ctx);
79
-
80
- return res.status(result.status || 200).json(result.body);
81
- };
82
- }
83
- ```
84
-
85
- ## Edge Functions
86
-
87
- ```typescript
88
- // api/geo.ts
89
- export const config = {
90
- runtime: "edge",
91
- };
92
-
93
- export default async function handler(request: Request) {
94
- const geo = request.headers.get("x-vercel-ip-country");
95
-
96
- return new Response(JSON.stringify({ country: geo }), {
97
- headers: { "Content-Type": "application/json" },
98
- });
99
- }
100
- ```
101
-
102
- ## 환경 변수
103
-
104
- ```bash
105
- # Vercel CLI로 환경 변수 설정
106
- vercel env add DATABASE_URL production
107
- vercel env add SESSION_SECRET production
108
-
109
- # .env.local (로컬 개발)
110
- DATABASE_URL=postgresql://localhost:5432/mandu
111
- SESSION_SECRET=dev-secret
112
- ```
113
-
114
- ## 배포
115
-
116
- ```bash
117
- # Vercel CLI 설치
118
- npm install -g vercel
119
-
120
- # 프로젝트 연결
121
- vercel link
122
-
123
- # Preview 배포
124
- vercel
125
-
126
- # Production 배포
127
- vercel --prod
128
- ```
129
-
130
- ## 추천 사용 케이스
131
-
132
- - 정적 사이트 + API routes
133
- - Edge에서 가벼운 처리가 필요한 경우
134
- - Vercel의 다른 서비스(Analytics, Speed Insights)와 통합
135
-
136
- **비추천:**
137
- - 장시간 실행 프로세스 (WebSocket, 스트리밍)
138
- - Bun 특화 기능 필요 시
139
-
140
- Reference: [Vercel Documentation](https://vercel.com/docs)
@@ -1,122 +0,0 @@
1
- ---
2
- name: mandu-fs-routes
3
- description: |
4
- File-system based routing for Mandu. Use when creating pages, API routes,
5
- layouts, or dynamic routes. Triggers on tasks involving app/ folder,
6
- page.tsx, route.ts, layout.tsx, [id], [...slug], or URL patterns.
7
- license: MIT
8
- metadata:
9
- author: mandu
10
- version: "1.0.0"
11
- ---
12
-
13
- # Mandu FS Routes
14
-
15
- FS Routes는 파일 시스템 기반 라우팅입니다. `app/` 폴더의 파일 구조가 URL이 됩니다.
16
-
17
- ## Agent Workflow Contract
18
-
19
- This skill is a Domain addendum. It must not replace `mandu-agent-workflow`.
20
- Use it only after `mandu.agent.plan` selects the route or API domain.
21
-
22
- Canonical workflow step: `plan -> apply -> verify`.
23
-
24
- Preferred MCP tools:
25
-
26
- | Step | Tools |
27
- |------|-------|
28
- | plan | `mandu.agent.plan`, `mandu.route.list` |
29
- | apply | `mandu.agent.apply`, `mandu.generate`, `mandu.route.add` |
30
- | verify | `mandu.agent.verify`, `mandu.manifest.validate` |
31
- | repair | `mandu.agent.repair` |
32
-
33
- Allowed file edits:
34
-
35
- - `app/**/page.tsx`, `app/**/layout.tsx`, `app/**/route.ts`
36
- - Route-local metadata files and co-located helpers
37
- - Related contract/slot files only when the plan includes those domains
38
-
39
- Verification command:
40
-
41
- ```bash
42
- mandu agent verify --changed --json --write
43
- ```
44
-
45
- Common failures:
46
-
47
- - Creating a page or API route before reading the local `app/` pattern
48
- - Editing generated route manifests by hand
49
- - Adding API files without contract verification when the plan includes API work
50
-
51
- Repair path:
52
-
53
- ```bash
54
- mandu agent repair --from .mandu/agent-verify.json --json
55
- ```
56
-
57
- ## When to Apply
58
-
59
- Reference these guidelines when:
60
- - Creating new pages or API endpoints
61
- - Setting up dynamic routes with parameters
62
- - Implementing shared layouts
63
- - Organizing route groups
64
- - Working with catch-all routes
65
-
66
- ## Rule Categories by Priority
67
-
68
- | Priority | Category | Impact | Prefix |
69
- |----------|----------|--------|--------|
70
- | 1 | File Naming | CRITICAL | `routes-naming-` |
71
- | 2 | Page Routes | HIGH | `routes-page-` |
72
- | 3 | API Routes | HIGH | `routes-api-` |
73
- | 4 | Dynamic Routes | MEDIUM | `routes-dynamic-` |
74
- | 5 | Layouts | MEDIUM | `routes-layout-` |
75
-
76
- ## Quick Reference
77
-
78
- ### 1. File Naming (CRITICAL)
79
-
80
- - `routes-naming-page` - Use page.tsx for page components
81
- - `routes-naming-route` - Use route.ts for API handlers
82
- - `routes-naming-layout` - Use layout.tsx for shared layouts
83
-
84
- ### 2. Page Routes (HIGH)
85
-
86
- - `routes-page-component` - Export default function component
87
- - `routes-page-metadata` - Export metadata object for SEO
88
-
89
- ### 3. API Routes (HIGH)
90
-
91
- - `routes-api-methods` - Export GET, POST, PUT, DELETE functions
92
- - `routes-api-request` - Access Request object as first parameter
93
-
94
- ### 4. Dynamic Routes (MEDIUM)
95
-
96
- - `routes-dynamic-param` - Use [id] for single parameter
97
- - `routes-dynamic-catchall` - Use [...slug] for catch-all
98
- - `routes-dynamic-optional` - Use [[...slug]] for optional catch-all
99
-
100
- ### 5. Layouts (MEDIUM)
101
-
102
- - `routes-layout-wrapper` - Layouts wrap all child pages
103
- - `routes-layout-nesting` - Layouts can be nested
104
-
105
- ## URL Mapping
106
-
107
- | File Path | URL |
108
- |-----------|-----|
109
- | `app/page.tsx` | `/` |
110
- | `app/about/page.tsx` | `/about` |
111
- | `app/users/[id]/page.tsx` | `/users/:id` |
112
- | `app/api/users/route.ts` | `/api/users` |
113
- | `app/(auth)/login/page.tsx` | `/login` |
114
-
115
- ## How to Use
116
-
117
- Read individual rule files for detailed explanations:
118
-
119
- ```
120
- rules/routes-naming-page.md
121
- rules/routes-dynamic-param.md
122
- ```
@@ -1,12 +0,0 @@
1
- {
2
- "version": "1.0.0",
3
- "organization": "Mandu Framework",
4
- "date": "February 2026",
5
- "abstract": "파일 시스템 기반 라우팅 가이드. app/ 폴더 구조가 URL이 되는 규칙, 동적 라우트 [id], catch-all [...slug], 라우트 그룹 (group), 특수 파일 (page.tsx, route.ts, layout.tsx) 사용법을 다룹니다.",
6
- "references": [
7
- "https://nextjs.org/docs/app/building-your-application/routing",
8
- "https://fresh.deno.dev/docs/concepts/routing",
9
- "https://kit.svelte.dev/docs/routing"
10
- ],
11
- "tags": ["routes", "filesystem", "pages", "api", "mandu"]
12
- }
@@ -1,36 +0,0 @@
1
- # Sections
2
-
3
- This file defines all sections, their ordering, impact levels, and descriptions.
4
- The section ID (in parentheses) is the filename prefix used to group rules.
5
-
6
- ---
7
-
8
- ## 1. File Naming (routes-naming)
9
-
10
- **Impact:** CRITICAL
11
- **Description:** page.tsx, route.ts, layout.tsx 등 특수 파일 명명 규칙. 잘못된 파일명은 라우트로 인식되지 않습니다.
12
-
13
- ## 2. Page Routes (routes-page)
14
-
15
- **Impact:** HIGH
16
- **Description:** page.tsx 컴포넌트 작성법. default export, metadata, props 접근 패턴을 다룹니다.
17
-
18
- ## 3. API Routes (routes-api)
19
-
20
- **Impact:** HIGH
21
- **Description:** route.ts에서 HTTP 메서드 함수 export. GET, POST, PUT, DELETE 핸들러 작성법입니다.
22
-
23
- ## 4. Dynamic Routes (routes-dynamic)
24
-
25
- **Impact:** MEDIUM
26
- **Description:** [id], [...slug], [[...slug]] 동적 세그먼트. URL 파라미터 캡처와 접근 방법을 다룹니다.
27
-
28
- ## 5. Layouts (routes-layout)
29
-
30
- **Impact:** MEDIUM
31
- **Description:** layout.tsx로 페이지 감싸기. 중첩 레이아웃과 공유 UI 패턴입니다.
32
-
33
- ## 6. Route Groups (routes-group)
34
-
35
- **Impact:** LOW
36
- **Description:** (group) 괄호로 URL에 영향 없이 폴더 구조 정리. 코드 구성에만 사용됩니다.
@@ -1,69 +0,0 @@
1
- # Rule Template
2
-
3
- Use this template when creating new rules for mandu-fs-routes.
4
-
5
- ---
6
-
7
- ```markdown
8
- ---
9
- title: Rule Title Here
10
- impact: CRITICAL | HIGH | MEDIUM | LOW
11
- impactDescription: 영향 설명
12
- tags: routes, tag1, tag2
13
- ---
14
-
15
- ## Rule Title Here
16
-
17
- **Impact: {LEVEL} ({impactDescription})**
18
-
19
- 규칙의 목적과 중요성을 설명합니다.
20
-
21
- **Incorrect (문제점 설명):**
22
-
23
- \`\`\`
24
- app/
25
- ├── about/
26
- │ └── About.tsx ❌ 인식되지 않음
27
- └── users/
28
- └── index.tsx ❌ 인식되지 않음
29
- \`\`\`
30
-
31
- **Correct (올바른 구조):**
32
-
33
- \`\`\`
34
- app/
35
- ├── about/
36
- │ └── page.tsx ✅ → /about
37
- └── users/
38
- └── page.tsx ✅ → /users
39
- \`\`\`
40
-
41
- ## Code Example
42
-
43
- \`\`\`tsx
44
- // app/about/page.tsx
45
-
46
- export default function AboutPage() {
47
- return <h1>About Us</h1>;
48
- }
49
- \`\`\`
50
-
51
- Reference: [관련 문서 링크](https://example.com)
52
- ```
53
-
54
- ---
55
-
56
- ## Naming Convention
57
-
58
- - 파일명: `{section}-{rule-name}.md`
59
- - 예시: `routes-naming-page.md`, `routes-dynamic-param.md`
60
-
61
- ## URL Mapping Quick Reference
62
-
63
- | File Path | URL |
64
- |-----------|-----|
65
- | `app/page.tsx` | `/` |
66
- | `app/about/page.tsx` | `/about` |
67
- | `app/users/[id]/page.tsx` | `/users/:id` |
68
- | `app/api/users/route.ts` | `/api/users` |
69
- | `app/(auth)/login/page.tsx` | `/login` |