@mandujs/mcp 0.12.2 → 0.13.0
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.
- package/README.md +367 -367
- package/package.json +2 -2
- package/src/activity-monitor.ts +847 -847
- package/src/adapters/index.ts +20 -20
- package/src/adapters/monitor-adapter.ts +100 -100
- package/src/adapters/tool-adapter.ts +88 -88
- package/src/executor/error-handler.ts +250 -250
- package/src/executor/index.ts +22 -22
- package/src/executor/tool-executor.ts +148 -148
- package/src/hooks/config-watcher.ts +174 -174
- package/src/hooks/index.ts +23 -23
- package/src/hooks/mcp-hooks.ts +227 -227
- package/src/index.ts +106 -106
- package/src/logging/index.ts +15 -15
- package/src/logging/mcp-transport.ts +134 -134
- package/src/registry/index.ts +13 -13
- package/src/registry/mcp-tool-registry.ts +298 -298
- package/src/resources/skills/guides.ts +1136 -1136
- package/src/resources/skills/index.ts +12 -12
- package/src/resources/skills/loader.ts +218 -218
- package/src/resources/skills/mandu-composition/SKILL.md +91 -91
- package/src/resources/skills/mandu-composition/metadata.json +13 -13
- package/src/resources/skills/mandu-composition/rules/_sections.md +26 -26
- package/src/resources/skills/mandu-composition/rules/_template.md +77 -77
- package/src/resources/skills/mandu-composition/rules/comp-arch-avoid-boolean-props.md +146 -146
- package/src/resources/skills/mandu-composition/rules/comp-arch-compound-components.md +164 -164
- package/src/resources/skills/mandu-composition/rules/comp-island-event.md +161 -161
- package/src/resources/skills/mandu-composition/rules/comp-island-slot-split.md +167 -167
- package/src/resources/skills/mandu-composition/rules/comp-pattern-children.md +149 -149
- package/src/resources/skills/mandu-composition/rules/comp-state-context-interface.md +148 -148
- package/src/resources/skills/mandu-composition/rules/comp-state-lift-state.md +150 -150
- package/src/resources/skills/mandu-deployment/SKILL.md +92 -92
- package/src/resources/skills/mandu-deployment/_sections.md +41 -41
- package/src/resources/skills/mandu-deployment/_template.md +38 -38
- package/src/resources/skills/mandu-deployment/metadata.json +13 -13
- package/src/resources/skills/mandu-deployment/rules/deploy-build-bun.md +109 -109
- package/src/resources/skills/mandu-deployment/rules/deploy-build-output.md +115 -115
- package/src/resources/skills/mandu-deployment/rules/deploy-cicd-github.md +219 -219
- package/src/resources/skills/mandu-deployment/rules/deploy-docker-bun.md +150 -150
- package/src/resources/skills/mandu-deployment/rules/deploy-docker-compose.md +223 -223
- package/src/resources/skills/mandu-deployment/rules/deploy-platform-fly.md +152 -152
- package/src/resources/skills/mandu-deployment/rules/deploy-platform-render.md +179 -179
- package/src/resources/skills/mandu-deployment/rules/deploy-platform-supabase.md +323 -323
- package/src/resources/skills/mandu-deployment/rules/deploy-platform-vercel.md +140 -140
- package/src/resources/skills/mandu-fs-routes/SKILL.md +82 -82
- package/src/resources/skills/mandu-fs-routes/metadata.json +12 -12
- package/src/resources/skills/mandu-fs-routes/rules/_sections.md +36 -36
- package/src/resources/skills/mandu-fs-routes/rules/_template.md +69 -69
- package/src/resources/skills/mandu-fs-routes/rules/routes-api-methods.md +65 -65
- package/src/resources/skills/mandu-fs-routes/rules/routes-dynamic-param.md +93 -93
- package/src/resources/skills/mandu-fs-routes/rules/routes-naming-page.md +55 -55
- package/src/resources/skills/mandu-guard/SKILL.md +129 -129
- package/src/resources/skills/mandu-guard/metadata.json +12 -12
- package/src/resources/skills/mandu-guard/rules/_sections.md +36 -36
- package/src/resources/skills/mandu-guard/rules/_template.md +82 -82
- package/src/resources/skills/mandu-guard/rules/guard-config-rules.md +100 -100
- package/src/resources/skills/mandu-guard/rules/guard-layer-direction.md +76 -76
- package/src/resources/skills/mandu-guard/rules/guard-preset-mandu.md +81 -81
- package/src/resources/skills/mandu-guard/rules/guard-validate-import.md +80 -80
- package/src/resources/skills/mandu-hydration/SKILL.md +91 -91
- package/src/resources/skills/mandu-hydration/metadata.json +12 -12
- package/src/resources/skills/mandu-hydration/rules/_sections.md +31 -31
- package/src/resources/skills/mandu-hydration/rules/_template.md +72 -72
- package/src/resources/skills/mandu-hydration/rules/hydration-data-event.md +109 -109
- package/src/resources/skills/mandu-hydration/rules/hydration-directive-use-client.md +55 -55
- package/src/resources/skills/mandu-hydration/rules/hydration-island-setup.md +113 -113
- package/src/resources/skills/mandu-hydration/rules/hydration-priority-visible.md +68 -68
- package/src/resources/skills/mandu-performance/SKILL.md +85 -85
- package/src/resources/skills/mandu-performance/metadata.json +14 -14
- package/src/resources/skills/mandu-performance/rules/_sections.md +31 -31
- package/src/resources/skills/mandu-performance/rules/_template.md +64 -64
- package/src/resources/skills/mandu-performance/rules/perf-async-defer-await.md +103 -103
- package/src/resources/skills/mandu-performance/rules/perf-async-parallel.md +95 -95
- package/src/resources/skills/mandu-performance/rules/perf-bun-file.md +124 -124
- package/src/resources/skills/mandu-performance/rules/perf-bun-serve.md +125 -125
- package/src/resources/skills/mandu-performance/rules/perf-bundle-imports.md +80 -80
- package/src/resources/skills/mandu-performance/rules/perf-bundle-island-lazy.md +145 -145
- package/src/resources/skills/mandu-performance/rules/perf-cache-react.md +98 -98
- package/src/resources/skills/mandu-performance/rules/perf-render-transitions.md +154 -154
- package/src/resources/skills/mandu-security/SKILL.md +87 -87
- package/src/resources/skills/mandu-security/metadata.json +13 -13
- package/src/resources/skills/mandu-security/rules/_sections.md +31 -31
- package/src/resources/skills/mandu-security/rules/_template.md +74 -74
- package/src/resources/skills/mandu-security/rules/sec-auth-guard.md +127 -127
- package/src/resources/skills/mandu-security/rules/sec-env-management.md +133 -133
- package/src/resources/skills/mandu-security/rules/sec-input-validate.md +148 -148
- package/src/resources/skills/mandu-security/rules/sec-protect-csrf.md +146 -146
- package/src/resources/skills/mandu-security/rules/sec-protect-headers.md +138 -138
- package/src/resources/skills/mandu-slot/SKILL.md +85 -85
- package/src/resources/skills/mandu-slot/metadata.json +12 -12
- package/src/resources/skills/mandu-slot/rules/_sections.md +36 -36
- package/src/resources/skills/mandu-slot/rules/_template.md +63 -63
- package/src/resources/skills/mandu-slot/rules/slot-basic-structure.md +38 -38
- package/src/resources/skills/mandu-slot/rules/slot-ctx-response.md +56 -56
- package/src/resources/skills/mandu-slot/rules/slot-guard-auth.md +59 -59
- package/src/resources/skills/mandu-slot/rules/slot-http-methods.md +64 -64
- package/src/resources/skills/mandu-styling/SKILL.md +154 -154
- package/src/resources/skills/mandu-styling/_sections.md +43 -43
- package/src/resources/skills/mandu-styling/_template.md +32 -32
- package/src/resources/skills/mandu-styling/metadata.json +15 -15
- package/src/resources/skills/mandu-styling/rules/style-component-compound.md +235 -235
- package/src/resources/skills/mandu-styling/rules/style-component-slots.md +255 -255
- package/src/resources/skills/mandu-styling/rules/style-component-tokens.md +205 -205
- package/src/resources/skills/mandu-styling/rules/style-island-animations.md +272 -272
- package/src/resources/skills/mandu-styling/rules/style-island-scoping.md +167 -167
- package/src/resources/skills/mandu-styling/rules/style-island-variants.md +221 -221
- package/src/resources/skills/mandu-styling/rules/style-perf-critical.md +209 -209
- package/src/resources/skills/mandu-styling/rules/style-perf-purge.md +192 -192
- package/src/resources/skills/mandu-styling/rules/style-setup-modules.md +162 -162
- package/src/resources/skills/mandu-styling/rules/style-setup-panda.md +164 -164
- package/src/resources/skills/mandu-styling/rules/style-setup-tailwind.md +170 -170
- package/src/resources/skills/mandu-styling/rules/style-tailwind-v4-gotchas.md +179 -179
- package/src/resources/skills/mandu-styling/rules/style-theme-darkmode.md +229 -229
- package/src/resources/skills/mandu-testing/SKILL.md +99 -99
- package/src/resources/skills/mandu-testing/metadata.json +13 -13
- package/src/resources/skills/mandu-testing/rules/_sections.md +26 -26
- package/src/resources/skills/mandu-testing/rules/_template.md +65 -65
- package/src/resources/skills/mandu-testing/rules/test-component-island.md +195 -195
- package/src/resources/skills/mandu-testing/rules/test-e2e-playwright.md +196 -196
- package/src/resources/skills/mandu-testing/rules/test-mock-fetch.md +219 -219
- package/src/resources/skills/mandu-testing/rules/test-slot-unit.md +192 -192
- package/src/resources/skills/mandu-ui/SKILL.md +117 -117
- package/src/resources/skills/mandu-ui/_sections.md +23 -23
- package/src/resources/skills/mandu-ui/_template.md +32 -32
- package/src/resources/skills/mandu-ui/metadata.json +13 -13
- package/src/resources/skills/mandu-ui/rules/ui-accessibility-aria.md +232 -232
- package/src/resources/skills/mandu-ui/rules/ui-accessibility-focus.md +238 -238
- package/src/resources/skills/mandu-ui/rules/ui-composition-patterns.md +259 -259
- package/src/resources/skills/mandu-ui/rules/ui-island-integration.md +258 -258
- package/src/resources/skills/mandu-ui/rules/ui-radix-patterns.md +213 -213
- package/src/resources/skills/mandu-ui/rules/ui-shadcn-setup.md +209 -209
- package/src/resources/skills/recipes.ts +932 -932
- package/src/tools/generate.ts +7 -4
- package/src/tools/guard.ts +17 -4
- package/src/tools/hydration.ts +10 -10
- package/src/tools/project.ts +334 -334
- package/src/tools/runtime.ts +497 -497
- package/src/tools/seo.ts +417 -417
- package/src/tools/spec.ts +80 -159
- package/src/utils/project.ts +22 -12
- package/src/utils/withWarnings.ts +83 -83
|
@@ -1,65 +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
|
-
```
|
|
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
|
+
```
|
|
@@ -1,93 +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
|
-
```
|
|
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
|
+
```
|
|
@@ -1,55 +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 |
|
|
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 |
|
|
@@ -1,129 +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
|
-
```
|
|
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
|
+
```
|