@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.
- package/README.md +3 -3
- package/package.json +3 -5
- package/src/activity-adapter.ts +23 -23
- package/src/activity-monitor.ts +39 -10
- package/src/adapters/index.ts +20 -20
- package/src/adapters/monitor-adapter.ts +100 -100
- package/src/adapters/tool-adapter.ts +90 -90
- package/src/executor/index.ts +22 -22
- package/src/executor/tool-executor.ts +148 -148
- package/src/hooks/config-watcher.ts +173 -173
- package/src/hooks/index.ts +23 -23
- package/src/hooks/mcp-hooks.ts +227 -227
- package/src/index.ts +5 -5
- package/src/logging/index.ts +15 -15
- package/src/logging/mcp-transport.ts +134 -134
- package/src/new-resources.ts +2 -2
- package/src/profiles.ts +25 -54
- package/src/prompts.ts +4 -4
- package/src/registry/index.ts +13 -13
- package/src/registry/mcp-tool-registry.ts +298 -298
- package/src/resources/generated-skills/catalog.ts +36 -0
- package/src/resources/generated-skills/mandu-agent-workflow/SKILL.md +48 -0
- package/src/resources/generated-skills/mandu-contract/SKILL.md +20 -0
- package/src/resources/generated-skills/mandu-fs-routes/SKILL.md +19 -0
- package/src/resources/generated-skills/mandu-guard/SKILL.md +20 -0
- package/src/resources/generated-skills/mandu-hydration/SKILL.md +19 -0
- package/src/resources/generated-skills/mandu-testing/SKILL.md +20 -0
- package/src/resources/handlers.ts +3 -3
- package/src/resources/skills/guides.ts +49 -49
- package/src/resources/skills/index.ts +12 -12
- package/src/resources/skills/loader.ts +8 -35
- package/src/resources/skills/recipes.ts +28 -28
- package/src/server.ts +1 -1
- package/src/tools/agent.ts +479 -409
- package/src/tools/ate-exemplar.ts +92 -92
- package/src/tools/ate-flakes.ts +90 -90
- package/src/tools/ate-mutate.ts +103 -103
- package/src/tools/ate-mutation-report.ts +64 -64
- package/src/tools/ate-oracle-pending.ts +49 -49
- package/src/tools/ate-oracle-replay.ts +44 -44
- package/src/tools/ate-oracle-verdict.ts +70 -70
- package/src/tools/ate-prompt.ts +146 -146
- package/src/tools/ate-run.ts +1 -1
- package/src/tools/ate.ts +38 -38
- package/src/tools/brain.ts +6 -6
- package/src/tools/composite.ts +19 -61
- package/src/tools/contract.ts +11 -9
- package/src/tools/deploy-plan.ts +2 -2
- package/src/tools/deploy-preview.ts +316 -316
- package/src/tools/design.ts +825 -825
- package/src/tools/docs.ts +350 -350
- package/src/tools/generate.ts +4 -3
- package/src/tools/guard.ts +1 -1
- package/src/tools/history.ts +1 -1
- package/src/tools/hydration.ts +64 -64
- package/src/tools/index.ts +0 -118
- package/src/tools/kitchen.ts +72 -72
- package/src/tools/lint.ts +226 -226
- package/src/tools/loop-close.ts +175 -175
- package/src/tools/negotiate.ts +263 -263
- package/src/tools/resource.ts +1 -1
- package/src/tools/run-tests.ts +424 -424
- package/src/tools/runtime.ts +1 -1
- package/src/tools/seo.ts +1 -1
- package/src/tools/slot-validation.ts +19 -19
- package/src/tools/spec.ts +201 -201
- package/src/tools/transaction.ts +1 -1
- package/src/tx-lock.ts +73 -73
- package/src/utils/runtime-control.ts +52 -52
- package/src/utils/withWarnings.ts +1 -1
- package/src/resources/skills/mandu-agent-workflow/SKILL.md +0 -124
- package/src/resources/skills/mandu-agent-workflow/metadata.json +0 -7
- package/src/resources/skills/mandu-composition/SKILL.md +0 -131
- package/src/resources/skills/mandu-composition/metadata.json +0 -13
- package/src/resources/skills/mandu-composition/rules/_sections.md +0 -26
- package/src/resources/skills/mandu-composition/rules/_template.md +0 -77
- package/src/resources/skills/mandu-composition/rules/comp-arch-avoid-boolean-props.md +0 -146
- package/src/resources/skills/mandu-composition/rules/comp-arch-compound-components.md +0 -164
- package/src/resources/skills/mandu-composition/rules/comp-island-event.md +0 -161
- package/src/resources/skills/mandu-composition/rules/comp-island-slot-split.md +0 -167
- package/src/resources/skills/mandu-composition/rules/comp-pattern-children.md +0 -149
- package/src/resources/skills/mandu-composition/rules/comp-state-context-interface.md +0 -148
- package/src/resources/skills/mandu-composition/rules/comp-state-lift-state.md +0 -150
- package/src/resources/skills/mandu-deployment/SKILL.md +0 -135
- package/src/resources/skills/mandu-deployment/_sections.md +0 -41
- package/src/resources/skills/mandu-deployment/_template.md +0 -38
- package/src/resources/skills/mandu-deployment/metadata.json +0 -13
- package/src/resources/skills/mandu-deployment/rules/db-provider-supabase.md +0 -300
- package/src/resources/skills/mandu-deployment/rules/deploy-build-bun.md +0 -109
- package/src/resources/skills/mandu-deployment/rules/deploy-build-output.md +0 -115
- package/src/resources/skills/mandu-deployment/rules/deploy-cicd-github.md +0 -219
- package/src/resources/skills/mandu-deployment/rules/deploy-docker-bun.md +0 -150
- package/src/resources/skills/mandu-deployment/rules/deploy-docker-compose.md +0 -223
- package/src/resources/skills/mandu-deployment/rules/deploy-platform-fly.md +0 -152
- package/src/resources/skills/mandu-deployment/rules/deploy-platform-render.md +0 -179
- package/src/resources/skills/mandu-deployment/rules/deploy-platform-vercel.md +0 -140
- package/src/resources/skills/mandu-fs-routes/SKILL.md +0 -122
- package/src/resources/skills/mandu-fs-routes/metadata.json +0 -12
- package/src/resources/skills/mandu-fs-routes/rules/_sections.md +0 -36
- package/src/resources/skills/mandu-fs-routes/rules/_template.md +0 -69
- package/src/resources/skills/mandu-fs-routes/rules/routes-api-methods.md +0 -65
- package/src/resources/skills/mandu-fs-routes/rules/routes-dynamic-param.md +0 -93
- package/src/resources/skills/mandu-fs-routes/rules/routes-naming-page.md +0 -55
- package/src/resources/skills/mandu-guard/SKILL.md +0 -162
- package/src/resources/skills/mandu-guard/metadata.json +0 -12
- package/src/resources/skills/mandu-guard/rules/_sections.md +0 -36
- package/src/resources/skills/mandu-guard/rules/_template.md +0 -82
- package/src/resources/skills/mandu-guard/rules/guard-config-rules.md +0 -100
- package/src/resources/skills/mandu-guard/rules/guard-layer-direction.md +0 -76
- package/src/resources/skills/mandu-guard/rules/guard-preset-mandu.md +0 -81
- package/src/resources/skills/mandu-guard/rules/guard-validate-import.md +0 -80
- package/src/resources/skills/mandu-hydration/SKILL.md +0 -139
- package/src/resources/skills/mandu-hydration/metadata.json +0 -12
- package/src/resources/skills/mandu-hydration/rules/_sections.md +0 -31
- package/src/resources/skills/mandu-hydration/rules/_template.md +0 -72
- package/src/resources/skills/mandu-hydration/rules/hydration-data-event.md +0 -109
- package/src/resources/skills/mandu-hydration/rules/hydration-directive-use-client.md +0 -55
- package/src/resources/skills/mandu-hydration/rules/hydration-island-setup.md +0 -160
- package/src/resources/skills/mandu-hydration/rules/hydration-priority-visible.md +0 -91
- package/src/resources/skills/mandu-performance/SKILL.md +0 -125
- package/src/resources/skills/mandu-performance/metadata.json +0 -14
- package/src/resources/skills/mandu-performance/rules/_sections.md +0 -31
- package/src/resources/skills/mandu-performance/rules/_template.md +0 -64
- package/src/resources/skills/mandu-performance/rules/perf-async-defer-await.md +0 -103
- package/src/resources/skills/mandu-performance/rules/perf-async-parallel.md +0 -95
- package/src/resources/skills/mandu-performance/rules/perf-bun-file.md +0 -124
- package/src/resources/skills/mandu-performance/rules/perf-bun-serve.md +0 -125
- package/src/resources/skills/mandu-performance/rules/perf-bundle-imports.md +0 -80
- package/src/resources/skills/mandu-performance/rules/perf-bundle-island-lazy.md +0 -145
- package/src/resources/skills/mandu-performance/rules/perf-cache-react.md +0 -98
- package/src/resources/skills/mandu-performance/rules/perf-render-transitions.md +0 -154
- package/src/resources/skills/mandu-security/SKILL.md +0 -127
- package/src/resources/skills/mandu-security/metadata.json +0 -13
- package/src/resources/skills/mandu-security/rules/_sections.md +0 -31
- package/src/resources/skills/mandu-security/rules/_template.md +0 -74
- package/src/resources/skills/mandu-security/rules/sec-auth-guard.md +0 -127
- package/src/resources/skills/mandu-security/rules/sec-env-management.md +0 -133
- package/src/resources/skills/mandu-security/rules/sec-input-validate.md +0 -148
- package/src/resources/skills/mandu-security/rules/sec-protect-csrf.md +0 -146
- package/src/resources/skills/mandu-security/rules/sec-protect-headers.md +0 -138
- package/src/resources/skills/mandu-slot/SKILL.md +0 -125
- package/src/resources/skills/mandu-slot/metadata.json +0 -12
- package/src/resources/skills/mandu-slot/rules/_sections.md +0 -36
- package/src/resources/skills/mandu-slot/rules/_template.md +0 -63
- package/src/resources/skills/mandu-slot/rules/slot-basic-structure.md +0 -38
- package/src/resources/skills/mandu-slot/rules/slot-ctx-response.md +0 -56
- package/src/resources/skills/mandu-slot/rules/slot-guard-auth.md +0 -59
- package/src/resources/skills/mandu-slot/rules/slot-http-methods.md +0 -64
- package/src/resources/skills/mandu-styling/SKILL.md +0 -196
- package/src/resources/skills/mandu-styling/_sections.md +0 -43
- package/src/resources/skills/mandu-styling/_template.md +0 -32
- package/src/resources/skills/mandu-styling/metadata.json +0 -15
- package/src/resources/skills/mandu-styling/rules/style-component-compound.md +0 -235
- package/src/resources/skills/mandu-styling/rules/style-component-slots.md +0 -255
- package/src/resources/skills/mandu-styling/rules/style-component-tokens.md +0 -205
- package/src/resources/skills/mandu-styling/rules/style-island-animations.md +0 -272
- package/src/resources/skills/mandu-styling/rules/style-island-scoping.md +0 -167
- package/src/resources/skills/mandu-styling/rules/style-island-variants.md +0 -221
- package/src/resources/skills/mandu-styling/rules/style-perf-critical.md +0 -209
- package/src/resources/skills/mandu-styling/rules/style-perf-purge.md +0 -192
- package/src/resources/skills/mandu-styling/rules/style-setup-modules.md +0 -162
- package/src/resources/skills/mandu-styling/rules/style-setup-panda.md +0 -164
- package/src/resources/skills/mandu-styling/rules/style-setup-tailwind.md +0 -170
- package/src/resources/skills/mandu-styling/rules/style-tailwind-v4-gotchas.md +0 -179
- package/src/resources/skills/mandu-styling/rules/style-theme-darkmode.md +0 -229
- package/src/resources/skills/mandu-testing/SKILL.md +0 -132
- package/src/resources/skills/mandu-testing/metadata.json +0 -13
- package/src/resources/skills/mandu-testing/rules/_sections.md +0 -26
- package/src/resources/skills/mandu-testing/rules/_template.md +0 -65
- package/src/resources/skills/mandu-testing/rules/test-component-island.md +0 -195
- package/src/resources/skills/mandu-testing/rules/test-e2e-playwright.md +0 -196
- package/src/resources/skills/mandu-testing/rules/test-mock-fetch.md +0 -219
- package/src/resources/skills/mandu-testing/rules/test-slot-unit.md +0 -192
- package/src/resources/skills/mandu-ui/SKILL.md +0 -159
- package/src/resources/skills/mandu-ui/_sections.md +0 -23
- package/src/resources/skills/mandu-ui/_template.md +0 -32
- package/src/resources/skills/mandu-ui/metadata.json +0 -13
- package/src/resources/skills/mandu-ui/rules/ui-accessibility-aria.md +0 -232
- package/src/resources/skills/mandu-ui/rules/ui-accessibility-focus.md +0 -238
- package/src/resources/skills/mandu-ui/rules/ui-composition-patterns.md +0 -259
- package/src/resources/skills/mandu-ui/rules/ui-island-integration.md +0 -258
- package/src/resources/skills/mandu-ui/rules/ui-radix-patterns.md +0 -213
- package/src/resources/skills/mandu-ui/rules/ui-shadcn-setup.md +0 -209
|
@@ -1,65 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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,162 +0,0 @@
|
|
|
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
|
-
## Agent Workflow Contract
|
|
19
|
-
|
|
20
|
-
This skill is a Domain addendum. It must not replace `mandu-agent-workflow`.
|
|
21
|
-
Use it only after `mandu.agent.verify` reports guard diagnostics or `mandu.agent.plan` selects the guard domain.
|
|
22
|
-
|
|
23
|
-
Canonical workflow step: `verify -> repair`.
|
|
24
|
-
|
|
25
|
-
Preferred MCP tools:
|
|
26
|
-
|
|
27
|
-
| Step | Tools |
|
|
28
|
-
|------|-------|
|
|
29
|
-
| plan | `mandu.agent.plan` |
|
|
30
|
-
| verify | `mandu.agent.verify`, `mandu.guard.check`, `mandu.guard.explain` |
|
|
31
|
-
| repair | `mandu.agent.repair`, `mandu.guard.heal` |
|
|
32
|
-
|
|
33
|
-
Allowed file edits:
|
|
34
|
-
|
|
35
|
-
- Source files that violate import/layer rules
|
|
36
|
-
- `mandu.config.*` guard settings only when the plan explicitly changes policy
|
|
37
|
-
- Generated files are not direct-edit targets
|
|
38
|
-
|
|
39
|
-
Verification command:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
mandu agent verify --changed --json --write
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Common failures:
|
|
46
|
-
|
|
47
|
-
- Running low-level guard commands before reading the agent verify report
|
|
48
|
-
- Weakening guard config instead of fixing the import boundary
|
|
49
|
-
- Directly editing generated files to silence diagnostics
|
|
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
|
-
- Setting up architecture rules
|
|
61
|
-
- Checking layer dependencies
|
|
62
|
-
- Validating import paths
|
|
63
|
-
- Running architecture checks in CI
|
|
64
|
-
- Configuring guard presets
|
|
65
|
-
|
|
66
|
-
## Rule Categories by Priority
|
|
67
|
-
|
|
68
|
-
| Priority | Category | Impact | Prefix |
|
|
69
|
-
|----------|----------|--------|--------|
|
|
70
|
-
| 1 | Layer Rules | CRITICAL | `guard-layer-` |
|
|
71
|
-
| 2 | Presets | HIGH | `guard-preset-` |
|
|
72
|
-
| 3 | Validation | HIGH | `guard-validate-` |
|
|
73
|
-
| 4 | Configuration | MEDIUM | `guard-config-` |
|
|
74
|
-
|
|
75
|
-
## Quick Reference
|
|
76
|
-
|
|
77
|
-
### 1. Layer Rules (CRITICAL)
|
|
78
|
-
|
|
79
|
-
- `guard-layer-direction` - Dependencies flow downward only
|
|
80
|
-
- `guard-layer-violation` - Detect and fix layer violations
|
|
81
|
-
- `guard-layer-same-level` - Restrict same-layer imports
|
|
82
|
-
|
|
83
|
-
### 2. Presets (HIGH)
|
|
84
|
-
|
|
85
|
-
- `guard-preset-mandu` - FSD + Clean hybrid (default)
|
|
86
|
-
- `guard-preset-fsd` - Feature-Sliced Design
|
|
87
|
-
- `guard-preset-clean` - Clean Architecture
|
|
88
|
-
- `guard-preset-hexagonal` - Hexagonal/Ports & Adapters
|
|
89
|
-
|
|
90
|
-
### 3. Validation (HIGH)
|
|
91
|
-
|
|
92
|
-
- `guard-validate-import` - Check import path validity
|
|
93
|
-
- `guard-validate-location` - Check file location
|
|
94
|
-
- `guard-validate-naming` - Check naming conventions
|
|
95
|
-
|
|
96
|
-
### 4. Configuration (MEDIUM)
|
|
97
|
-
|
|
98
|
-
- `guard-config-rules` - Configure rule severity
|
|
99
|
-
- `guard-config-ignore` - Configure ignored paths
|
|
100
|
-
|
|
101
|
-
## Mandu Preset Layers
|
|
102
|
-
|
|
103
|
-
### Frontend (FSD)
|
|
104
|
-
|
|
105
|
-
```
|
|
106
|
-
app # Top: app entry point
|
|
107
|
-
↓
|
|
108
|
-
pages # Page components
|
|
109
|
-
↓
|
|
110
|
-
widgets # Complex UI blocks
|
|
111
|
-
↓
|
|
112
|
-
features # Feature units
|
|
113
|
-
↓
|
|
114
|
-
entities # Business entities
|
|
115
|
-
↓
|
|
116
|
-
shared # Shared utilities
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### Backend (Clean)
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
api # Top: API entry point
|
|
123
|
-
↓
|
|
124
|
-
application # Use cases
|
|
125
|
-
↓
|
|
126
|
-
domain # Business logic
|
|
127
|
-
↓
|
|
128
|
-
infra # Infrastructure (DB, external APIs)
|
|
129
|
-
↓
|
|
130
|
-
core # Core utilities
|
|
131
|
-
↓
|
|
132
|
-
shared # Shared
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## Validation Rules
|
|
136
|
-
|
|
137
|
-
| Rule ID | Description |
|
|
138
|
-
|---------|-------------|
|
|
139
|
-
| `LAYER_VIOLATION` | Layer dependency violation |
|
|
140
|
-
| `GENERATED_DIRECT_EDIT` | Direct edit of generated files |
|
|
141
|
-
| `WRONG_SLOT_LOCATION` | Wrong slot file location |
|
|
142
|
-
| `SLOT_NAMING` | Slot file naming rule violation |
|
|
143
|
-
| `FORBIDDEN_IMPORT` | Forbidden import (fs, child_process, etc.) |
|
|
144
|
-
|
|
145
|
-
## Low-Level CLI Commands
|
|
146
|
-
|
|
147
|
-
Use these only when `agent verify` or `agent repair` asks for guard-specific detail:
|
|
148
|
-
|
|
149
|
-
```bash
|
|
150
|
-
mandu agent verify --changed --json --write
|
|
151
|
-
mandu guard arch --ci
|
|
152
|
-
mandu guard arch --preset fsd
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## How to Use
|
|
156
|
-
|
|
157
|
-
Read individual rule files for detailed explanations:
|
|
158
|
-
|
|
159
|
-
```
|
|
160
|
-
rules/guard-layer-direction.md
|
|
161
|
-
rules/guard-preset-mandu.md
|
|
162
|
-
```
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -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. Layer Rules (guard-layer)
|
|
9
|
-
|
|
10
|
-
**Impact:** CRITICAL
|
|
11
|
-
**Description:** 레이어 의존성 방향 규칙. 상위→하위만 허용, 역방향 import 금지. 아키텍처 무결성의 핵심입니다.
|
|
12
|
-
|
|
13
|
-
## 2. Presets (guard-preset)
|
|
14
|
-
|
|
15
|
-
**Impact:** HIGH
|
|
16
|
-
**Description:** mandu, fsd, clean, hexagonal 프리셋 선택. 프로젝트 유형에 맞는 아키텍처 템플릿입니다.
|
|
17
|
-
|
|
18
|
-
## 3. Validation (guard-validate)
|
|
19
|
-
|
|
20
|
-
**Impact:** HIGH
|
|
21
|
-
**Description:** import 경로, 파일 위치, 네이밍 검증. 실시간 위반 감지와 리포팅입니다.
|
|
22
|
-
|
|
23
|
-
## 4. Configuration (guard-config)
|
|
24
|
-
|
|
25
|
-
**Impact:** MEDIUM
|
|
26
|
-
**Description:** 규칙 severity 설정, ignore 패턴. 프로젝트 특성에 맞게 가드를 커스터마이징합니다.
|
|
27
|
-
|
|
28
|
-
## 5. CI Integration (guard-ci)
|
|
29
|
-
|
|
30
|
-
**Impact:** MEDIUM
|
|
31
|
-
**Description:** --ci 플래그, exit code, 리포트 생성. 자동화된 아키텍처 검증 파이프라인입니다.
|
|
32
|
-
|
|
33
|
-
## 6. Auto Fix (guard-fix)
|
|
34
|
-
|
|
35
|
-
**Impact:** LOW
|
|
36
|
-
**Description:** --auto-correct 옵션. 일부 위반의 자동 수정 기능입니다.
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
# Rule Template
|
|
2
|
-
|
|
3
|
-
Use this template when creating new rules for mandu-guard.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
```markdown
|
|
8
|
-
---
|
|
9
|
-
title: Rule Title Here
|
|
10
|
-
impact: CRITICAL | HIGH | MEDIUM | LOW
|
|
11
|
-
impactDescription: 영향 설명
|
|
12
|
-
tags: guard, tag1, tag2
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Rule Title Here
|
|
16
|
-
|
|
17
|
-
**Impact: {LEVEL} ({impactDescription})**
|
|
18
|
-
|
|
19
|
-
규칙의 목적과 중요성을 설명합니다.
|
|
20
|
-
|
|
21
|
-
**Incorrect (위반 예시):**
|
|
22
|
-
|
|
23
|
-
\`\`\`typescript
|
|
24
|
-
// ❌ entities → features (역방향 의존)
|
|
25
|
-
// src/entities/user/index.ts
|
|
26
|
-
import { useAuth } from "@/features/auth"; // VIOLATION!
|
|
27
|
-
|
|
28
|
-
export function User() {
|
|
29
|
-
const { isLoggedIn } = useAuth();
|
|
30
|
-
}
|
|
31
|
-
\`\`\`
|
|
32
|
-
|
|
33
|
-
**Correct (올바른 방향):**
|
|
34
|
-
|
|
35
|
-
\`\`\`typescript
|
|
36
|
-
// ✅ features → entities (순방향 의존)
|
|
37
|
-
// src/features/auth/index.ts
|
|
38
|
-
import { User } from "@/entities/user";
|
|
39
|
-
|
|
40
|
-
export function useAuth() {
|
|
41
|
-
const user = getCurrentUser();
|
|
42
|
-
return { user, isLoggedIn: !!user };
|
|
43
|
-
}
|
|
44
|
-
\`\`\`
|
|
45
|
-
|
|
46
|
-
## CLI Command
|
|
47
|
-
|
|
48
|
-
\`\`\`bash
|
|
49
|
-
bunx mandu guard arch --ci
|
|
50
|
-
\`\`\`
|
|
51
|
-
|
|
52
|
-
Reference: [관련 문서 링크](https://example.com)
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## Naming Convention
|
|
58
|
-
|
|
59
|
-
- 파일명: `{section}-{rule-name}.md`
|
|
60
|
-
- 예시: `guard-layer-direction.md`, `guard-preset-mandu.md`
|
|
61
|
-
|
|
62
|
-
## Layer Hierarchy Quick Reference
|
|
63
|
-
|
|
64
|
-
### Frontend (FSD)
|
|
65
|
-
```
|
|
66
|
-
app → pages → widgets → features → entities → shared
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Backend (Clean)
|
|
70
|
-
```
|
|
71
|
-
api → application → domain → infra → core → shared
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Rule IDs Quick Reference
|
|
75
|
-
|
|
76
|
-
| Rule ID | Description |
|
|
77
|
-
|---------|-------------|
|
|
78
|
-
| `LAYER_VIOLATION` | 레이어 의존성 위반 |
|
|
79
|
-
| `GENERATED_DIRECT_EDIT` | generated 파일 직접 수정 |
|
|
80
|
-
| `WRONG_SLOT_LOCATION` | 잘못된 slot 파일 위치 |
|
|
81
|
-
| `SLOT_NAMING` | slot 파일 이름 규칙 위반 |
|
|
82
|
-
| `FORBIDDEN_IMPORT` | 금지된 import |
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Configure Rule Severity Levels
|
|
3
|
-
impact: MEDIUM
|
|
4
|
-
impactDescription: Customize guard behavior
|
|
5
|
-
tags: guard, config, rules
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Configure Rule Severity Levels
|
|
9
|
-
|
|
10
|
-
Set severity levels for each guard rule based on your project needs.
|
|
11
|
-
|
|
12
|
-
## Severity Levels
|
|
13
|
-
|
|
14
|
-
| Level | Behavior | Use Case |
|
|
15
|
-
|-------|----------|----------|
|
|
16
|
-
| `error` | Fails check, blocks CI | Critical violations |
|
|
17
|
-
| `warn` | Reports issue, continues | Gradual migration |
|
|
18
|
-
| `off` | Ignores rule | Not applicable to project |
|
|
19
|
-
|
|
20
|
-
## Configuration File
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
// mandu.config.ts
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
guard: {
|
|
27
|
-
preset: "mandu",
|
|
28
|
-
rules: {
|
|
29
|
-
// Core rules
|
|
30
|
-
"LAYER_VIOLATION": "error", // Always enforce layers
|
|
31
|
-
"GENERATED_DIRECT_EDIT": "error", // Protect generated files
|
|
32
|
-
|
|
33
|
-
// Naming rules
|
|
34
|
-
"SLOT_NAMING": "warn", // Warn during migration
|
|
35
|
-
"WRONG_SLOT_LOCATION": "error",
|
|
36
|
-
|
|
37
|
-
// Security rules
|
|
38
|
-
"FORBIDDEN_IMPORT": "error", // Block dangerous imports
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Available Rules
|
|
45
|
-
|
|
46
|
-
| Rule ID | Default | Description |
|
|
47
|
-
|---------|---------|-------------|
|
|
48
|
-
| `LAYER_VIOLATION` | error | Layer dependency violation |
|
|
49
|
-
| `GENERATED_DIRECT_EDIT` | error | Direct edit of generated files |
|
|
50
|
-
| `WRONG_SLOT_LOCATION` | error | Slot file in wrong directory |
|
|
51
|
-
| `SLOT_NAMING` | error | Incorrect slot file naming |
|
|
52
|
-
| `FORBIDDEN_IMPORT` | warn | Importing fs, child_process, etc. in browser code |
|
|
53
|
-
| `CIRCULAR_DEPENDENCY` | warn | Circular import detected |
|
|
54
|
-
| `DEEP_IMPORT` | warn | Importing from nested paths instead of index |
|
|
55
|
-
|
|
56
|
-
## Ignoring Paths
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
export default {
|
|
60
|
-
guard: {
|
|
61
|
-
ignore: [
|
|
62
|
-
"**/test/**", // Test files
|
|
63
|
-
"**/*.test.ts", // Test files
|
|
64
|
-
"**/*.spec.ts", // Spec files
|
|
65
|
-
"**/mocks/**", // Mock files
|
|
66
|
-
"scripts/**", // Build scripts
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## Per-File Override
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
// src/features/legacy/index.ts
|
|
76
|
-
|
|
77
|
-
// @guard-disable LAYER_VIOLATION
|
|
78
|
-
import { oldHelper } from "@/entities/legacy"; // Allowed temporarily
|
|
79
|
-
// @guard-enable LAYER_VIOLATION
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Gradual Migration
|
|
83
|
-
|
|
84
|
-
```typescript
|
|
85
|
-
// Start with warnings for legacy code
|
|
86
|
-
{
|
|
87
|
-
rules: {
|
|
88
|
-
"LAYER_VIOLATION": "warn", // Start with warn
|
|
89
|
-
"SLOT_NAMING": "off", // Fix later
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// After migration, enforce strictly
|
|
94
|
-
{
|
|
95
|
-
rules: {
|
|
96
|
-
"LAYER_VIOLATION": "error", // Now enforce
|
|
97
|
-
"SLOT_NAMING": "error", // Now enforce
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
```
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Dependencies Must Flow Downward Only
|
|
3
|
-
impact: CRITICAL
|
|
4
|
-
impactDescription: Core architecture principle
|
|
5
|
-
tags: guard, layer, dependency
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Dependencies Must Flow Downward Only
|
|
9
|
-
|
|
10
|
-
In layered architecture, imports must always flow from higher to lower layers.
|
|
11
|
-
|
|
12
|
-
**Incorrect (upward dependency):**
|
|
13
|
-
|
|
14
|
-
```typescript
|
|
15
|
-
// ❌ entities/user/index.ts importing from features (higher layer)
|
|
16
|
-
import { useAuth } from "@/features/auth";
|
|
17
|
-
|
|
18
|
-
export function User() {
|
|
19
|
-
const { isLoggedIn } = useAuth(); // VIOLATION!
|
|
20
|
-
// ...
|
|
21
|
-
}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**Correct (downward dependency):**
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
// ✅ features/auth/index.ts importing from entities (lower layer)
|
|
28
|
-
import { User } from "@/entities/user";
|
|
29
|
-
|
|
30
|
-
export function useAuth() {
|
|
31
|
-
const user = getCurrentUser(); // Uses entity
|
|
32
|
-
return { user, isLoggedIn: !!user };
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Layer Hierarchy (Mandu Preset)
|
|
37
|
-
|
|
38
|
-
### Frontend Layers (top to bottom)
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
app → Can import: pages, widgets, features, entities, shared
|
|
42
|
-
pages → Can import: widgets, features, entities, shared
|
|
43
|
-
widgets → Can import: features, entities, shared
|
|
44
|
-
features → Can import: entities, shared
|
|
45
|
-
entities → Can import: shared
|
|
46
|
-
shared → Can import: (nothing above)
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Backend Layers (top to bottom)
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
api → Can import: application, domain, infra, core, shared
|
|
53
|
-
application → Can import: domain, infra, core, shared
|
|
54
|
-
domain → Can import: core, shared
|
|
55
|
-
infra → Can import: core, shared
|
|
56
|
-
core → Can import: shared
|
|
57
|
-
shared → Can import: (nothing above)
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Common Violations
|
|
61
|
-
|
|
62
|
-
| Violation | Fix |
|
|
63
|
-
|-----------|-----|
|
|
64
|
-
| Entity imports Feature | Move shared logic to Entity or Shared |
|
|
65
|
-
| Domain imports API | Use dependency injection |
|
|
66
|
-
| Shared imports Feature | Extract to Shared or keep in Feature |
|
|
67
|
-
|
|
68
|
-
## Checking Dependencies
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
# Check all architecture rules
|
|
72
|
-
bunx mandu guard arch
|
|
73
|
-
|
|
74
|
-
# Check specific file
|
|
75
|
-
bunx mandu guard check src/entities/user/index.ts
|
|
76
|
-
```
|