@mandujs/mcp 0.9.19 → 0.9.21

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 (122) hide show
  1. package/README.md +320 -0
  2. package/package.json +1 -1
  3. package/src/activity-monitor.ts +847 -231
  4. package/src/resources/handlers.ts +244 -0
  5. package/src/resources/skills/guides.ts +1136 -0
  6. package/src/resources/skills/index.ts +12 -0
  7. package/src/resources/skills/loader.ts +218 -0
  8. package/src/resources/skills/mandu-composition/SKILL.md +91 -0
  9. package/src/resources/skills/mandu-composition/metadata.json +13 -0
  10. package/src/resources/skills/mandu-composition/rules/_sections.md +26 -0
  11. package/src/resources/skills/mandu-composition/rules/_template.md +77 -0
  12. package/src/resources/skills/mandu-composition/rules/comp-arch-avoid-boolean-props.md +146 -0
  13. package/src/resources/skills/mandu-composition/rules/comp-arch-compound-components.md +164 -0
  14. package/src/resources/skills/mandu-composition/rules/comp-island-event.md +161 -0
  15. package/src/resources/skills/mandu-composition/rules/comp-island-slot-split.md +167 -0
  16. package/src/resources/skills/mandu-composition/rules/comp-pattern-children.md +149 -0
  17. package/src/resources/skills/mandu-composition/rules/comp-state-context-interface.md +148 -0
  18. package/src/resources/skills/mandu-composition/rules/comp-state-lift-state.md +150 -0
  19. package/src/resources/skills/mandu-deployment/SKILL.md +92 -0
  20. package/src/resources/skills/mandu-deployment/_sections.md +41 -0
  21. package/src/resources/skills/mandu-deployment/_template.md +38 -0
  22. package/src/resources/skills/mandu-deployment/metadata.json +13 -0
  23. package/src/resources/skills/mandu-deployment/rules/deploy-build-bun.md +109 -0
  24. package/src/resources/skills/mandu-deployment/rules/deploy-build-output.md +115 -0
  25. package/src/resources/skills/mandu-deployment/rules/deploy-cicd-github.md +219 -0
  26. package/src/resources/skills/mandu-deployment/rules/deploy-docker-bun.md +150 -0
  27. package/src/resources/skills/mandu-deployment/rules/deploy-docker-compose.md +223 -0
  28. package/src/resources/skills/mandu-deployment/rules/deploy-platform-fly.md +152 -0
  29. package/src/resources/skills/mandu-deployment/rules/deploy-platform-render.md +179 -0
  30. package/src/resources/skills/mandu-deployment/rules/deploy-platform-supabase.md +323 -0
  31. package/src/resources/skills/mandu-deployment/rules/deploy-platform-vercel.md +140 -0
  32. package/src/resources/skills/mandu-fs-routes/SKILL.md +82 -0
  33. package/src/resources/skills/mandu-fs-routes/metadata.json +12 -0
  34. package/src/resources/skills/mandu-fs-routes/rules/_sections.md +36 -0
  35. package/src/resources/skills/mandu-fs-routes/rules/_template.md +69 -0
  36. package/src/resources/skills/mandu-fs-routes/rules/routes-api-methods.md +65 -0
  37. package/src/resources/skills/mandu-fs-routes/rules/routes-dynamic-param.md +93 -0
  38. package/src/resources/skills/mandu-fs-routes/rules/routes-naming-page.md +55 -0
  39. package/src/resources/skills/mandu-guard/SKILL.md +129 -0
  40. package/src/resources/skills/mandu-guard/metadata.json +12 -0
  41. package/src/resources/skills/mandu-guard/rules/_sections.md +36 -0
  42. package/src/resources/skills/mandu-guard/rules/_template.md +82 -0
  43. package/src/resources/skills/mandu-guard/rules/guard-config-rules.md +100 -0
  44. package/src/resources/skills/mandu-guard/rules/guard-layer-direction.md +76 -0
  45. package/src/resources/skills/mandu-guard/rules/guard-preset-mandu.md +81 -0
  46. package/src/resources/skills/mandu-guard/rules/guard-validate-import.md +80 -0
  47. package/src/resources/skills/mandu-hydration/SKILL.md +91 -0
  48. package/src/resources/skills/mandu-hydration/metadata.json +12 -0
  49. package/src/resources/skills/mandu-hydration/rules/_sections.md +31 -0
  50. package/src/resources/skills/mandu-hydration/rules/_template.md +72 -0
  51. package/src/resources/skills/mandu-hydration/rules/hydration-data-event.md +109 -0
  52. package/src/resources/skills/mandu-hydration/rules/hydration-directive-use-client.md +55 -0
  53. package/src/resources/skills/mandu-hydration/rules/hydration-island-setup.md +113 -0
  54. package/src/resources/skills/mandu-hydration/rules/hydration-priority-visible.md +68 -0
  55. package/src/resources/skills/mandu-performance/SKILL.md +85 -0
  56. package/src/resources/skills/mandu-performance/metadata.json +14 -0
  57. package/src/resources/skills/mandu-performance/rules/_sections.md +31 -0
  58. package/src/resources/skills/mandu-performance/rules/_template.md +64 -0
  59. package/src/resources/skills/mandu-performance/rules/perf-async-defer-await.md +103 -0
  60. package/src/resources/skills/mandu-performance/rules/perf-async-parallel.md +95 -0
  61. package/src/resources/skills/mandu-performance/rules/perf-bun-file.md +124 -0
  62. package/src/resources/skills/mandu-performance/rules/perf-bun-serve.md +125 -0
  63. package/src/resources/skills/mandu-performance/rules/perf-bundle-imports.md +80 -0
  64. package/src/resources/skills/mandu-performance/rules/perf-bundle-island-lazy.md +145 -0
  65. package/src/resources/skills/mandu-performance/rules/perf-cache-react.md +98 -0
  66. package/src/resources/skills/mandu-performance/rules/perf-render-transitions.md +154 -0
  67. package/src/resources/skills/mandu-security/SKILL.md +87 -0
  68. package/src/resources/skills/mandu-security/metadata.json +13 -0
  69. package/src/resources/skills/mandu-security/rules/_sections.md +31 -0
  70. package/src/resources/skills/mandu-security/rules/_template.md +74 -0
  71. package/src/resources/skills/mandu-security/rules/sec-auth-guard.md +127 -0
  72. package/src/resources/skills/mandu-security/rules/sec-env-management.md +133 -0
  73. package/src/resources/skills/mandu-security/rules/sec-input-validate.md +148 -0
  74. package/src/resources/skills/mandu-security/rules/sec-protect-csrf.md +146 -0
  75. package/src/resources/skills/mandu-security/rules/sec-protect-headers.md +138 -0
  76. package/src/resources/skills/mandu-slot/SKILL.md +85 -0
  77. package/src/resources/skills/mandu-slot/metadata.json +12 -0
  78. package/src/resources/skills/mandu-slot/rules/_sections.md +36 -0
  79. package/src/resources/skills/mandu-slot/rules/_template.md +63 -0
  80. package/src/resources/skills/mandu-slot/rules/slot-basic-structure.md +38 -0
  81. package/src/resources/skills/mandu-slot/rules/slot-ctx-response.md +56 -0
  82. package/src/resources/skills/mandu-slot/rules/slot-guard-auth.md +59 -0
  83. package/src/resources/skills/mandu-slot/rules/slot-http-methods.md +64 -0
  84. package/src/resources/skills/mandu-styling/SKILL.md +118 -0
  85. package/src/resources/skills/mandu-styling/_sections.md +36 -0
  86. package/src/resources/skills/mandu-styling/_template.md +32 -0
  87. package/src/resources/skills/mandu-styling/metadata.json +13 -0
  88. package/src/resources/skills/mandu-styling/rules/style-component-compound.md +235 -0
  89. package/src/resources/skills/mandu-styling/rules/style-component-slots.md +255 -0
  90. package/src/resources/skills/mandu-styling/rules/style-component-tokens.md +205 -0
  91. package/src/resources/skills/mandu-styling/rules/style-island-animations.md +272 -0
  92. package/src/resources/skills/mandu-styling/rules/style-island-scoping.md +167 -0
  93. package/src/resources/skills/mandu-styling/rules/style-island-variants.md +221 -0
  94. package/src/resources/skills/mandu-styling/rules/style-perf-critical.md +209 -0
  95. package/src/resources/skills/mandu-styling/rules/style-perf-purge.md +192 -0
  96. package/src/resources/skills/mandu-styling/rules/style-setup-modules.md +162 -0
  97. package/src/resources/skills/mandu-styling/rules/style-setup-panda.md +164 -0
  98. package/src/resources/skills/mandu-styling/rules/style-setup-tailwind.md +161 -0
  99. package/src/resources/skills/mandu-styling/rules/style-theme-darkmode.md +229 -0
  100. package/src/resources/skills/mandu-testing/SKILL.md +99 -0
  101. package/src/resources/skills/mandu-testing/metadata.json +13 -0
  102. package/src/resources/skills/mandu-testing/rules/_sections.md +26 -0
  103. package/src/resources/skills/mandu-testing/rules/_template.md +65 -0
  104. package/src/resources/skills/mandu-testing/rules/test-component-island.md +195 -0
  105. package/src/resources/skills/mandu-testing/rules/test-e2e-playwright.md +196 -0
  106. package/src/resources/skills/mandu-testing/rules/test-mock-fetch.md +219 -0
  107. package/src/resources/skills/mandu-testing/rules/test-slot-unit.md +192 -0
  108. package/src/resources/skills/mandu-ui/SKILL.md +117 -0
  109. package/src/resources/skills/mandu-ui/_sections.md +23 -0
  110. package/src/resources/skills/mandu-ui/_template.md +32 -0
  111. package/src/resources/skills/mandu-ui/metadata.json +13 -0
  112. package/src/resources/skills/mandu-ui/rules/ui-accessibility-aria.md +232 -0
  113. package/src/resources/skills/mandu-ui/rules/ui-accessibility-focus.md +238 -0
  114. package/src/resources/skills/mandu-ui/rules/ui-composition-patterns.md +259 -0
  115. package/src/resources/skills/mandu-ui/rules/ui-island-integration.md +258 -0
  116. package/src/resources/skills/mandu-ui/rules/ui-radix-patterns.md +213 -0
  117. package/src/resources/skills/mandu-ui/rules/ui-shadcn-setup.md +209 -0
  118. package/src/resources/skills/recipes.ts +932 -0
  119. package/src/server.ts +3 -0
  120. package/src/tools/hydration.ts +8 -8
  121. package/src/tools/index.ts +1 -0
  122. package/src/tools/seo.ts +417 -0
@@ -0,0 +1,140 @@
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)
@@ -0,0 +1,82 @@
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
+ ## When to Apply
18
+
19
+ Reference these guidelines when:
20
+ - Creating new pages or API endpoints
21
+ - Setting up dynamic routes with parameters
22
+ - Implementing shared layouts
23
+ - Organizing route groups
24
+ - Working with catch-all routes
25
+
26
+ ## Rule Categories by Priority
27
+
28
+ | Priority | Category | Impact | Prefix |
29
+ |----------|----------|--------|--------|
30
+ | 1 | File Naming | CRITICAL | `routes-naming-` |
31
+ | 2 | Page Routes | HIGH | `routes-page-` |
32
+ | 3 | API Routes | HIGH | `routes-api-` |
33
+ | 4 | Dynamic Routes | MEDIUM | `routes-dynamic-` |
34
+ | 5 | Layouts | MEDIUM | `routes-layout-` |
35
+
36
+ ## Quick Reference
37
+
38
+ ### 1. File Naming (CRITICAL)
39
+
40
+ - `routes-naming-page` - Use page.tsx for page components
41
+ - `routes-naming-route` - Use route.ts for API handlers
42
+ - `routes-naming-layout` - Use layout.tsx for shared layouts
43
+
44
+ ### 2. Page Routes (HIGH)
45
+
46
+ - `routes-page-component` - Export default function component
47
+ - `routes-page-metadata` - Export metadata object for SEO
48
+
49
+ ### 3. API Routes (HIGH)
50
+
51
+ - `routes-api-methods` - Export GET, POST, PUT, DELETE functions
52
+ - `routes-api-request` - Access Request object as first parameter
53
+
54
+ ### 4. Dynamic Routes (MEDIUM)
55
+
56
+ - `routes-dynamic-param` - Use [id] for single parameter
57
+ - `routes-dynamic-catchall` - Use [...slug] for catch-all
58
+ - `routes-dynamic-optional` - Use [[...slug]] for optional catch-all
59
+
60
+ ### 5. Layouts (MEDIUM)
61
+
62
+ - `routes-layout-wrapper` - Layouts wrap all child pages
63
+ - `routes-layout-nesting` - Layouts can be nested
64
+
65
+ ## URL Mapping
66
+
67
+ | File Path | URL |
68
+ |-----------|-----|
69
+ | `app/page.tsx` | `/` |
70
+ | `app/about/page.tsx` | `/about` |
71
+ | `app/users/[id]/page.tsx` | `/users/:id` |
72
+ | `app/api/users/route.ts` | `/api/users` |
73
+ | `app/(auth)/login/page.tsx` | `/login` |
74
+
75
+ ## How to Use
76
+
77
+ Read individual rule files for detailed explanations:
78
+
79
+ ```
80
+ rules/routes-naming-page.md
81
+ rules/routes-dynamic-param.md
82
+ ```
@@ -0,0 +1,12 @@
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
+ }
@@ -0,0 +1,36 @@
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에 영향 없이 폴더 구조 정리. 코드 구성에만 사용됩니다.
@@ -0,0 +1,69 @@
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` |
@@ -0,0 +1,65 @@
1
+ ---
2
+ title: Export HTTP Method Functions for API Routes
3
+ impact: HIGH
4
+ impactDescription: RESTful API structure
5
+ tags: routes, api, methods
6
+ ---
7
+
8
+ ## Export HTTP Method Functions for API Routes
9
+
10
+ API routes use named exports for each HTTP method: GET, POST, PUT, PATCH, DELETE.
11
+
12
+ **Incorrect (default export handler):**
13
+
14
+ ```typescript
15
+ // app/api/users/route.ts
16
+ export default function handler(req: Request) {
17
+ if (req.method === "GET") {
18
+ return Response.json({ users: [] });
19
+ }
20
+ }
21
+ ```
22
+
23
+ **Correct (named method exports):**
24
+
25
+ ```typescript
26
+ // app/api/users/route.ts
27
+
28
+ export function GET() {
29
+ return Response.json({ users: [] });
30
+ }
31
+
32
+ export async function POST(request: Request) {
33
+ const body = await request.json();
34
+ return Response.json({ created: body }, { status: 201 });
35
+ }
36
+
37
+ export function DELETE() {
38
+ return new Response(null, { status: 204 });
39
+ }
40
+ ```
41
+
42
+ ## Supported Methods
43
+
44
+ ```typescript
45
+ export function GET(request: Request) { }
46
+ export function POST(request: Request) { }
47
+ export function PUT(request: Request) { }
48
+ export function PATCH(request: Request) { }
49
+ export function DELETE(request: Request) { }
50
+ export function HEAD(request: Request) { }
51
+ export function OPTIONS(request: Request) { }
52
+ ```
53
+
54
+ ## With Dynamic Parameters
55
+
56
+ ```typescript
57
+ // app/api/users/[id]/route.ts
58
+
59
+ export function GET(
60
+ request: Request,
61
+ { params }: { params: { id: string } }
62
+ ) {
63
+ return Response.json({ userId: params.id });
64
+ }
65
+ ```
@@ -0,0 +1,93 @@
1
+ ---
2
+ title: Use [param] for Dynamic Route Parameters
3
+ impact: MEDIUM
4
+ impactDescription: Enables dynamic URLs
5
+ tags: routes, dynamic, params
6
+ ---
7
+
8
+ ## Use [param] for Dynamic Route Parameters
9
+
10
+ Wrap folder name in brackets to create dynamic routes that capture URL segments.
11
+
12
+ **Incorrect (hardcoded routes):**
13
+
14
+ ```
15
+ app/users/
16
+ ├── user1/page.tsx
17
+ ├── user2/page.tsx
18
+ └── user3/page.tsx
19
+ ```
20
+
21
+ **Correct (dynamic parameter):**
22
+
23
+ ```
24
+ app/users/
25
+ └── [id]/
26
+ └── page.tsx → /users/:id
27
+ ```
28
+
29
+ ## Accessing Parameters
30
+
31
+ ### In Page Components
32
+
33
+ ```tsx
34
+ // app/users/[id]/page.tsx
35
+
36
+ interface Props {
37
+ params: { id: string };
38
+ }
39
+
40
+ export default function UserPage({ params }: Props) {
41
+ return <h1>User ID: {params.id}</h1>;
42
+ }
43
+ ```
44
+
45
+ ### In API Routes
46
+
47
+ ```typescript
48
+ // app/api/users/[id]/route.ts
49
+
50
+ export function GET(
51
+ request: Request,
52
+ { params }: { params: { id: string } }
53
+ ) {
54
+ return Response.json({ userId: params.id });
55
+ }
56
+ ```
57
+
58
+ ## Multiple Parameters
59
+
60
+ ```
61
+ app/posts/[postId]/comments/[commentId]/page.tsx
62
+ → /posts/:postId/comments/:commentId
63
+ ```
64
+
65
+ ```tsx
66
+ interface Props {
67
+ params: { postId: string; commentId: string };
68
+ }
69
+
70
+ export default function CommentPage({ params }: Props) {
71
+ return (
72
+ <div>
73
+ Post: {params.postId}, Comment: {params.commentId}
74
+ </div>
75
+ );
76
+ }
77
+ ```
78
+
79
+ ## Catch-All Routes
80
+
81
+ ```
82
+ app/docs/[...slug]/page.tsx → /docs/a, /docs/a/b, /docs/a/b/c
83
+ ```
84
+
85
+ ```tsx
86
+ interface Props {
87
+ params: { slug: string[] };
88
+ }
89
+
90
+ export default function DocsPage({ params }: Props) {
91
+ return <p>Path: {params.slug.join("/")}</p>;
92
+ }
93
+ ```
@@ -0,0 +1,55 @@
1
+ ---
2
+ title: Use page.tsx for Page Components
3
+ impact: CRITICAL
4
+ impactDescription: Required for routing to work
5
+ tags: routes, page, naming
6
+ ---
7
+
8
+ ## Use page.tsx for Page Components
9
+
10
+ Page components must be named `page.tsx`. This is how Mandu recognizes
11
+ which files should become routes.
12
+
13
+ **Incorrect (wrong filename):**
14
+
15
+ ```
16
+ app/
17
+ ├── about/
18
+ │ └── About.tsx ❌ Won't be recognized
19
+ └── users/
20
+ └── index.tsx ❌ Won't be recognized
21
+ ```
22
+
23
+ **Correct (page.tsx):**
24
+
25
+ ```
26
+ app/
27
+ ├── about/
28
+ │ └── page.tsx ✅ → /about
29
+ └── users/
30
+ └── page.tsx ✅ → /users
31
+ ```
32
+
33
+ ## Page Component Structure
34
+
35
+ ```tsx
36
+ // app/about/page.tsx
37
+
38
+ export default function AboutPage() {
39
+ return (
40
+ <div>
41
+ <h1>About Us</h1>
42
+ </div>
43
+ );
44
+ }
45
+ ```
46
+
47
+ ## Special Files
48
+
49
+ | File | Purpose |
50
+ |------|---------|
51
+ | `page.tsx` | Page component |
52
+ | `layout.tsx` | Shared layout |
53
+ | `loading.tsx` | Loading UI |
54
+ | `error.tsx` | Error boundary |
55
+ | `route.ts` | API handler |
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: mandu-guard
3
+ description: |
4
+ Architecture guard system for Mandu. Use when checking layer dependencies,
5
+ enforcing architecture rules, or validating file locations. Triggers on
6
+ tasks involving architecture, layers, dependencies, or guard commands.
7
+ license: MIT
8
+ metadata:
9
+ author: mandu
10
+ version: "1.0.0"
11
+ ---
12
+
13
+ # Mandu Guard
14
+
15
+ Mandu Guard는 아키텍처 규칙을 강제하는 시스템입니다.
16
+ 레이어 간 의존성을 검사하고 위반을 실시간으로 감지합니다.
17
+
18
+ ## When to Apply
19
+
20
+ Reference these guidelines when:
21
+ - Setting up architecture rules
22
+ - Checking layer dependencies
23
+ - Validating import paths
24
+ - Running architecture checks in CI
25
+ - Configuring guard presets
26
+
27
+ ## Rule Categories by Priority
28
+
29
+ | Priority | Category | Impact | Prefix |
30
+ |----------|----------|--------|--------|
31
+ | 1 | Layer Rules | CRITICAL | `guard-layer-` |
32
+ | 2 | Presets | HIGH | `guard-preset-` |
33
+ | 3 | Validation | HIGH | `guard-validate-` |
34
+ | 4 | Configuration | MEDIUM | `guard-config-` |
35
+
36
+ ## Quick Reference
37
+
38
+ ### 1. Layer Rules (CRITICAL)
39
+
40
+ - `guard-layer-direction` - Dependencies flow downward only
41
+ - `guard-layer-violation` - Detect and fix layer violations
42
+ - `guard-layer-same-level` - Restrict same-layer imports
43
+
44
+ ### 2. Presets (HIGH)
45
+
46
+ - `guard-preset-mandu` - FSD + Clean hybrid (default)
47
+ - `guard-preset-fsd` - Feature-Sliced Design
48
+ - `guard-preset-clean` - Clean Architecture
49
+ - `guard-preset-hexagonal` - Hexagonal/Ports & Adapters
50
+
51
+ ### 3. Validation (HIGH)
52
+
53
+ - `guard-validate-import` - Check import path validity
54
+ - `guard-validate-location` - Check file location
55
+ - `guard-validate-naming` - Check naming conventions
56
+
57
+ ### 4. Configuration (MEDIUM)
58
+
59
+ - `guard-config-rules` - Configure rule severity
60
+ - `guard-config-ignore` - Configure ignored paths
61
+
62
+ ## Mandu Preset Layers
63
+
64
+ ### Frontend (FSD)
65
+
66
+ ```
67
+ app # Top: app entry point
68
+
69
+ pages # Page components
70
+
71
+ widgets # Complex UI blocks
72
+
73
+ features # Feature units
74
+
75
+ entities # Business entities
76
+
77
+ shared # Shared utilities
78
+ ```
79
+
80
+ ### Backend (Clean)
81
+
82
+ ```
83
+ api # Top: API entry point
84
+
85
+ application # Use cases
86
+
87
+ domain # Business logic
88
+
89
+ infra # Infrastructure (DB, external APIs)
90
+
91
+ core # Core utilities
92
+
93
+ shared # Shared
94
+ ```
95
+
96
+ ## Validation Rules
97
+
98
+ | Rule ID | Description |
99
+ |---------|-------------|
100
+ | `LAYER_VIOLATION` | Layer dependency violation |
101
+ | `GENERATED_DIRECT_EDIT` | Direct edit of generated files |
102
+ | `WRONG_SLOT_LOCATION` | Wrong slot file location |
103
+ | `SLOT_NAMING` | Slot file naming rule violation |
104
+ | `FORBIDDEN_IMPORT` | Forbidden import (fs, child_process, etc.) |
105
+
106
+ ## CLI Commands
107
+
108
+ ```bash
109
+ # Architecture check
110
+ bunx mandu guard arch
111
+
112
+ # Watch mode
113
+ bunx mandu guard arch --watch
114
+
115
+ # CI mode (exit 1 on violation)
116
+ bunx mandu guard arch --ci
117
+
118
+ # Use specific preset
119
+ bunx mandu guard arch --preset fsd
120
+ ```
121
+
122
+ ## How to Use
123
+
124
+ Read individual rule files for detailed explanations:
125
+
126
+ ```
127
+ rules/guard-layer-direction.md
128
+ rules/guard-preset-mandu.md
129
+ ```
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "organization": "Mandu Framework",
4
+ "date": "February 2026",
5
+ "abstract": "아키텍처 가드 시스템 가이드. 레이어 간 의존성 규칙을 강제하고 위반을 실시간으로 감지합니다. FSD, Clean Architecture, Hexagonal 등 다양한 프리셋을 지원하며, CI/CD 파이프라인에 통합할 수 있습니다.",
6
+ "references": [
7
+ "https://feature-sliced.design/",
8
+ "https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html",
9
+ "https://alistair.cockburn.us/hexagonal-architecture/"
10
+ ],
11
+ "tags": ["guard", "architecture", "layers", "dependencies", "mandu"]
12
+ }