@mandujs/mcp 0.38.12 → 0.39.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/README.md +3 -3
  2. package/package.json +3 -5
  3. package/src/activity-adapter.ts +23 -23
  4. package/src/activity-monitor.ts +39 -10
  5. package/src/adapters/index.ts +20 -20
  6. package/src/adapters/monitor-adapter.ts +100 -100
  7. package/src/adapters/tool-adapter.ts +90 -90
  8. package/src/executor/index.ts +22 -22
  9. package/src/executor/tool-executor.ts +148 -148
  10. package/src/hooks/config-watcher.ts +173 -173
  11. package/src/hooks/index.ts +23 -23
  12. package/src/hooks/mcp-hooks.ts +227 -227
  13. package/src/index.ts +5 -5
  14. package/src/logging/index.ts +15 -15
  15. package/src/logging/mcp-transport.ts +134 -134
  16. package/src/new-resources.ts +2 -2
  17. package/src/profiles.ts +25 -54
  18. package/src/prompts.ts +4 -4
  19. package/src/registry/index.ts +13 -13
  20. package/src/registry/mcp-tool-registry.ts +298 -298
  21. package/src/resources/generated-skills/catalog.ts +36 -0
  22. package/src/resources/generated-skills/mandu-agent-workflow/SKILL.md +48 -0
  23. package/src/resources/generated-skills/mandu-contract/SKILL.md +20 -0
  24. package/src/resources/generated-skills/mandu-fs-routes/SKILL.md +19 -0
  25. package/src/resources/generated-skills/mandu-guard/SKILL.md +20 -0
  26. package/src/resources/generated-skills/mandu-hydration/SKILL.md +19 -0
  27. package/src/resources/generated-skills/mandu-testing/SKILL.md +20 -0
  28. package/src/resources/handlers.ts +3 -3
  29. package/src/resources/skills/guides.ts +49 -49
  30. package/src/resources/skills/index.ts +12 -12
  31. package/src/resources/skills/loader.ts +8 -35
  32. package/src/resources/skills/recipes.ts +28 -28
  33. package/src/server.ts +1 -1
  34. package/src/tools/agent.ts +479 -409
  35. package/src/tools/ate-exemplar.ts +92 -92
  36. package/src/tools/ate-flakes.ts +90 -90
  37. package/src/tools/ate-mutate.ts +103 -103
  38. package/src/tools/ate-mutation-report.ts +64 -64
  39. package/src/tools/ate-oracle-pending.ts +49 -49
  40. package/src/tools/ate-oracle-replay.ts +44 -44
  41. package/src/tools/ate-oracle-verdict.ts +70 -70
  42. package/src/tools/ate-prompt.ts +146 -146
  43. package/src/tools/ate-run.ts +1 -1
  44. package/src/tools/ate.ts +38 -38
  45. package/src/tools/brain.ts +6 -6
  46. package/src/tools/composite.ts +19 -61
  47. package/src/tools/contract.ts +11 -9
  48. package/src/tools/deploy-plan.ts +2 -2
  49. package/src/tools/deploy-preview.ts +316 -316
  50. package/src/tools/design.ts +825 -825
  51. package/src/tools/docs.ts +350 -350
  52. package/src/tools/generate.ts +4 -3
  53. package/src/tools/guard.ts +1 -1
  54. package/src/tools/history.ts +1 -1
  55. package/src/tools/hydration.ts +64 -64
  56. package/src/tools/index.ts +0 -118
  57. package/src/tools/kitchen.ts +72 -72
  58. package/src/tools/lint.ts +226 -226
  59. package/src/tools/loop-close.ts +175 -175
  60. package/src/tools/negotiate.ts +263 -263
  61. package/src/tools/resource.ts +1 -1
  62. package/src/tools/run-tests.ts +424 -424
  63. package/src/tools/runtime.ts +1 -1
  64. package/src/tools/seo.ts +1 -1
  65. package/src/tools/slot-validation.ts +19 -19
  66. package/src/tools/spec.ts +201 -201
  67. package/src/tools/transaction.ts +1 -1
  68. package/src/tx-lock.ts +73 -73
  69. package/src/utils/runtime-control.ts +52 -52
  70. package/src/utils/withWarnings.ts +1 -1
  71. package/src/resources/skills/mandu-agent-workflow/SKILL.md +0 -124
  72. package/src/resources/skills/mandu-agent-workflow/metadata.json +0 -7
  73. package/src/resources/skills/mandu-composition/SKILL.md +0 -131
  74. package/src/resources/skills/mandu-composition/metadata.json +0 -13
  75. package/src/resources/skills/mandu-composition/rules/_sections.md +0 -26
  76. package/src/resources/skills/mandu-composition/rules/_template.md +0 -77
  77. package/src/resources/skills/mandu-composition/rules/comp-arch-avoid-boolean-props.md +0 -146
  78. package/src/resources/skills/mandu-composition/rules/comp-arch-compound-components.md +0 -164
  79. package/src/resources/skills/mandu-composition/rules/comp-island-event.md +0 -161
  80. package/src/resources/skills/mandu-composition/rules/comp-island-slot-split.md +0 -167
  81. package/src/resources/skills/mandu-composition/rules/comp-pattern-children.md +0 -149
  82. package/src/resources/skills/mandu-composition/rules/comp-state-context-interface.md +0 -148
  83. package/src/resources/skills/mandu-composition/rules/comp-state-lift-state.md +0 -150
  84. package/src/resources/skills/mandu-deployment/SKILL.md +0 -135
  85. package/src/resources/skills/mandu-deployment/_sections.md +0 -41
  86. package/src/resources/skills/mandu-deployment/_template.md +0 -38
  87. package/src/resources/skills/mandu-deployment/metadata.json +0 -13
  88. package/src/resources/skills/mandu-deployment/rules/db-provider-supabase.md +0 -300
  89. package/src/resources/skills/mandu-deployment/rules/deploy-build-bun.md +0 -109
  90. package/src/resources/skills/mandu-deployment/rules/deploy-build-output.md +0 -115
  91. package/src/resources/skills/mandu-deployment/rules/deploy-cicd-github.md +0 -219
  92. package/src/resources/skills/mandu-deployment/rules/deploy-docker-bun.md +0 -150
  93. package/src/resources/skills/mandu-deployment/rules/deploy-docker-compose.md +0 -223
  94. package/src/resources/skills/mandu-deployment/rules/deploy-platform-fly.md +0 -152
  95. package/src/resources/skills/mandu-deployment/rules/deploy-platform-render.md +0 -179
  96. package/src/resources/skills/mandu-deployment/rules/deploy-platform-vercel.md +0 -140
  97. package/src/resources/skills/mandu-fs-routes/SKILL.md +0 -122
  98. package/src/resources/skills/mandu-fs-routes/metadata.json +0 -12
  99. package/src/resources/skills/mandu-fs-routes/rules/_sections.md +0 -36
  100. package/src/resources/skills/mandu-fs-routes/rules/_template.md +0 -69
  101. package/src/resources/skills/mandu-fs-routes/rules/routes-api-methods.md +0 -65
  102. package/src/resources/skills/mandu-fs-routes/rules/routes-dynamic-param.md +0 -93
  103. package/src/resources/skills/mandu-fs-routes/rules/routes-naming-page.md +0 -55
  104. package/src/resources/skills/mandu-guard/SKILL.md +0 -162
  105. package/src/resources/skills/mandu-guard/metadata.json +0 -12
  106. package/src/resources/skills/mandu-guard/rules/_sections.md +0 -36
  107. package/src/resources/skills/mandu-guard/rules/_template.md +0 -82
  108. package/src/resources/skills/mandu-guard/rules/guard-config-rules.md +0 -100
  109. package/src/resources/skills/mandu-guard/rules/guard-layer-direction.md +0 -76
  110. package/src/resources/skills/mandu-guard/rules/guard-preset-mandu.md +0 -81
  111. package/src/resources/skills/mandu-guard/rules/guard-validate-import.md +0 -80
  112. package/src/resources/skills/mandu-hydration/SKILL.md +0 -139
  113. package/src/resources/skills/mandu-hydration/metadata.json +0 -12
  114. package/src/resources/skills/mandu-hydration/rules/_sections.md +0 -31
  115. package/src/resources/skills/mandu-hydration/rules/_template.md +0 -72
  116. package/src/resources/skills/mandu-hydration/rules/hydration-data-event.md +0 -109
  117. package/src/resources/skills/mandu-hydration/rules/hydration-directive-use-client.md +0 -55
  118. package/src/resources/skills/mandu-hydration/rules/hydration-island-setup.md +0 -160
  119. package/src/resources/skills/mandu-hydration/rules/hydration-priority-visible.md +0 -91
  120. package/src/resources/skills/mandu-performance/SKILL.md +0 -125
  121. package/src/resources/skills/mandu-performance/metadata.json +0 -14
  122. package/src/resources/skills/mandu-performance/rules/_sections.md +0 -31
  123. package/src/resources/skills/mandu-performance/rules/_template.md +0 -64
  124. package/src/resources/skills/mandu-performance/rules/perf-async-defer-await.md +0 -103
  125. package/src/resources/skills/mandu-performance/rules/perf-async-parallel.md +0 -95
  126. package/src/resources/skills/mandu-performance/rules/perf-bun-file.md +0 -124
  127. package/src/resources/skills/mandu-performance/rules/perf-bun-serve.md +0 -125
  128. package/src/resources/skills/mandu-performance/rules/perf-bundle-imports.md +0 -80
  129. package/src/resources/skills/mandu-performance/rules/perf-bundle-island-lazy.md +0 -145
  130. package/src/resources/skills/mandu-performance/rules/perf-cache-react.md +0 -98
  131. package/src/resources/skills/mandu-performance/rules/perf-render-transitions.md +0 -154
  132. package/src/resources/skills/mandu-security/SKILL.md +0 -127
  133. package/src/resources/skills/mandu-security/metadata.json +0 -13
  134. package/src/resources/skills/mandu-security/rules/_sections.md +0 -31
  135. package/src/resources/skills/mandu-security/rules/_template.md +0 -74
  136. package/src/resources/skills/mandu-security/rules/sec-auth-guard.md +0 -127
  137. package/src/resources/skills/mandu-security/rules/sec-env-management.md +0 -133
  138. package/src/resources/skills/mandu-security/rules/sec-input-validate.md +0 -148
  139. package/src/resources/skills/mandu-security/rules/sec-protect-csrf.md +0 -146
  140. package/src/resources/skills/mandu-security/rules/sec-protect-headers.md +0 -138
  141. package/src/resources/skills/mandu-slot/SKILL.md +0 -125
  142. package/src/resources/skills/mandu-slot/metadata.json +0 -12
  143. package/src/resources/skills/mandu-slot/rules/_sections.md +0 -36
  144. package/src/resources/skills/mandu-slot/rules/_template.md +0 -63
  145. package/src/resources/skills/mandu-slot/rules/slot-basic-structure.md +0 -38
  146. package/src/resources/skills/mandu-slot/rules/slot-ctx-response.md +0 -56
  147. package/src/resources/skills/mandu-slot/rules/slot-guard-auth.md +0 -59
  148. package/src/resources/skills/mandu-slot/rules/slot-http-methods.md +0 -64
  149. package/src/resources/skills/mandu-styling/SKILL.md +0 -196
  150. package/src/resources/skills/mandu-styling/_sections.md +0 -43
  151. package/src/resources/skills/mandu-styling/_template.md +0 -32
  152. package/src/resources/skills/mandu-styling/metadata.json +0 -15
  153. package/src/resources/skills/mandu-styling/rules/style-component-compound.md +0 -235
  154. package/src/resources/skills/mandu-styling/rules/style-component-slots.md +0 -255
  155. package/src/resources/skills/mandu-styling/rules/style-component-tokens.md +0 -205
  156. package/src/resources/skills/mandu-styling/rules/style-island-animations.md +0 -272
  157. package/src/resources/skills/mandu-styling/rules/style-island-scoping.md +0 -167
  158. package/src/resources/skills/mandu-styling/rules/style-island-variants.md +0 -221
  159. package/src/resources/skills/mandu-styling/rules/style-perf-critical.md +0 -209
  160. package/src/resources/skills/mandu-styling/rules/style-perf-purge.md +0 -192
  161. package/src/resources/skills/mandu-styling/rules/style-setup-modules.md +0 -162
  162. package/src/resources/skills/mandu-styling/rules/style-setup-panda.md +0 -164
  163. package/src/resources/skills/mandu-styling/rules/style-setup-tailwind.md +0 -170
  164. package/src/resources/skills/mandu-styling/rules/style-tailwind-v4-gotchas.md +0 -179
  165. package/src/resources/skills/mandu-styling/rules/style-theme-darkmode.md +0 -229
  166. package/src/resources/skills/mandu-testing/SKILL.md +0 -132
  167. package/src/resources/skills/mandu-testing/metadata.json +0 -13
  168. package/src/resources/skills/mandu-testing/rules/_sections.md +0 -26
  169. package/src/resources/skills/mandu-testing/rules/_template.md +0 -65
  170. package/src/resources/skills/mandu-testing/rules/test-component-island.md +0 -195
  171. package/src/resources/skills/mandu-testing/rules/test-e2e-playwright.md +0 -196
  172. package/src/resources/skills/mandu-testing/rules/test-mock-fetch.md +0 -219
  173. package/src/resources/skills/mandu-testing/rules/test-slot-unit.md +0 -192
  174. package/src/resources/skills/mandu-ui/SKILL.md +0 -159
  175. package/src/resources/skills/mandu-ui/_sections.md +0 -23
  176. package/src/resources/skills/mandu-ui/_template.md +0 -32
  177. package/src/resources/skills/mandu-ui/metadata.json +0 -13
  178. package/src/resources/skills/mandu-ui/rules/ui-accessibility-aria.md +0 -232
  179. package/src/resources/skills/mandu-ui/rules/ui-accessibility-focus.md +0 -238
  180. package/src/resources/skills/mandu-ui/rules/ui-composition-patterns.md +0 -259
  181. package/src/resources/skills/mandu-ui/rules/ui-island-integration.md +0 -258
  182. package/src/resources/skills/mandu-ui/rules/ui-radix-patterns.md +0 -213
  183. package/src/resources/skills/mandu-ui/rules/ui-shadcn-setup.md +0 -209
@@ -1,170 +0,0 @@
1
- ---
2
- title: Tailwind CSS v4 Setup
3
- impact: CRITICAL
4
- impactDescription: Primary CSS framework for Mandu applications (v4 required)
5
- tags: styling, tailwind, setup, v4, css-first
6
- ---
7
-
8
- ## Tailwind CSS v4 Setup
9
-
10
- **Impact: CRITICAL (Primary CSS framework for Mandu applications)**
11
-
12
- Tailwind CSS v4를 Mandu 프로젝트에 설정합니다. v4는 Oxide Engine(Rust)으로 재작성되어 빌드 속도가 3.5~5배 향상되었습니다.
13
-
14
- ## 설치
15
-
16
- ```bash
17
- bun add -d tailwindcss@^4.1 @tailwindcss/cli@^4.1
18
- bun add clsx tailwind-merge
19
- ```
20
-
21
- > **Note:** PostCSS, autoprefixer는 불필요합니다. Tailwind v4가 내장 처리합니다.
22
-
23
- ## app/globals.css (CSS-first Configuration)
24
-
25
- ```css
26
- @import "tailwindcss";
27
-
28
- /*
29
- * Tailwind CSS v4 - CSS-first Configuration
30
- * JavaScript 설정 파일 대신 CSS에서 직접 테마 정의
31
- */
32
-
33
- @theme {
34
- /* Colors - shadcn/ui compatible */
35
- --color-background: hsl(0 0% 100%);
36
- --color-foreground: hsl(222.2 84% 4.9%);
37
- --color-card: hsl(0 0% 100%);
38
- --color-card-foreground: hsl(222.2 84% 4.9%);
39
- --color-primary: hsl(222.2 47.4% 11.2%);
40
- --color-primary-foreground: hsl(210 40% 98%);
41
- --color-secondary: hsl(210 40% 96.1%);
42
- --color-secondary-foreground: hsl(222.2 47.4% 11.2%);
43
- --color-muted: hsl(210 40% 96.1%);
44
- --color-muted-foreground: hsl(215.4 16.3% 46.9%);
45
- --color-accent: hsl(210 40% 96.1%);
46
- --color-accent-foreground: hsl(222.2 47.4% 11.2%);
47
- --color-destructive: hsl(0 84.2% 60.2%);
48
- --color-destructive-foreground: hsl(210 40% 98%);
49
- --color-border: hsl(214.3 31.8% 91.4%);
50
- --color-input: hsl(214.3 31.8% 91.4%);
51
- --color-ring: hsl(222.2 84% 4.9%);
52
-
53
- /* Radius */
54
- --radius-sm: 0.25rem;
55
- --radius-md: 0.5rem;
56
- --radius-lg: 0.75rem;
57
-
58
- /* Fonts */
59
- --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
60
- }
61
-
62
- /* Base styles */
63
- * {
64
- border-color: var(--color-border);
65
- }
66
-
67
- body {
68
- background-color: var(--color-background);
69
- color: var(--color-foreground);
70
- font-family: var(--font-sans);
71
- }
72
- ```
73
-
74
- ## Mandu 자동 통합
75
-
76
- Mandu는 Tailwind v4를 자동으로 감지하고 처리합니다:
77
-
78
- ```
79
- mandu dev 실행 시:
80
- 1. app/globals.css에서 @import "tailwindcss" 감지
81
- 2. bunx @tailwindcss/cli --watch 자동 시작
82
- 3. 출력: .mandu/client/globals.css
83
- 4. SSR에서 <link> 태그 자동 주입
84
- 5. CSS 변경 시 HMR 핫 리로드
85
- ```
86
-
87
- ## cn 유틸리티 함수
88
-
89
- ```typescript
90
- // src/client/shared/lib/utils.ts
91
- import { clsx, type ClassValue } from "clsx";
92
- import { twMerge } from "tailwind-merge";
93
-
94
- export function cn(...inputs: ClassValue[]) {
95
- return twMerge(clsx(inputs));
96
- }
97
- ```
98
-
99
- ## Island 컴포넌트 스타일링
100
-
101
- ```tsx
102
- // src/client/features/counter/CounterIsland.tsx
103
- "use client";
104
-
105
- import { cn } from "@/shared/lib/utils";
106
-
107
- interface CounterProps {
108
- variant?: "default" | "outline";
109
- }
110
-
111
- export function CounterIsland({ variant = "default" }: CounterProps) {
112
- const variants = {
113
- default: "bg-primary text-primary-foreground",
114
- outline: "border-2 border-primary text-primary",
115
- };
116
-
117
- return (
118
- <button className={cn(
119
- "px-4 py-2 rounded-md transition-colors",
120
- variants[variant]
121
- )}>
122
- Count: 0
123
- </button>
124
- );
125
- }
126
- ```
127
-
128
- ## Custom Utilities (v4 방식)
129
-
130
- ```css
131
- /* @layer utilities 대신 @utility 사용 */
132
- @utility text-balance {
133
- text-wrap: balance;
134
- }
135
-
136
- @utility scrollbar-hide {
137
- -ms-overflow-style: none;
138
- scrollbar-width: none;
139
- &::-webkit-scrollbar {
140
- display: none;
141
- }
142
- }
143
- ```
144
-
145
- ## VSCode 설정
146
-
147
- ```json
148
- // .vscode/settings.json
149
- {
150
- "tailwindCSS.experimental.classRegex": [
151
- ["cn\\(([^)]*)\\)", "'([^']*)'"],
152
- ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
153
- ],
154
- "editor.quickSuggestions": {
155
- "strings": true
156
- },
157
- "files.associations": {
158
- "*.css": "tailwindcss"
159
- }
160
- }
161
- ```
162
-
163
- ## 삭제할 파일 (v3에서 마이그레이션 시)
164
-
165
- ```bash
166
- rm -f tailwind.config.ts tailwind.config.js
167
- rm -f postcss.config.js postcss.config.ts
168
- ```
169
-
170
- Reference: [Tailwind CSS v4 Documentation](https://tailwindcss.com/docs)
@@ -1,179 +0,0 @@
1
- ---
2
- title: Tailwind CSS v4 Gotchas
3
- impact: HIGH
4
- impactDescription: Critical breaking changes when using or migrating to Tailwind v4
5
- tags: styling, tailwind, v4, gotchas, migration, breaking-changes
6
- ---
7
-
8
- ## Tailwind CSS v4 Gotchas
9
-
10
- **Impact: HIGH (Critical breaking changes when using or migrating to Tailwind v4)**
11
-
12
- Tailwind v4는 완전히 재작성된 프레임워크입니다. v3에서 마이그레이션 시 반드시 확인해야 할 주의사항입니다.
13
-
14
- ## Browser Support
15
-
16
- ```
17
- Safari 16.4+ | Chrome 111+ | Firefox 128+
18
- ```
19
-
20
- > **Warning:** IE 및 구형 브라우저 지원 불가. 레거시 프로젝트는 v3 유지 권장.
21
-
22
- ## Import Syntax 변경
23
-
24
- ```css
25
- /* v3 (deprecated) */
26
- @tailwind base;
27
- @tailwind components;
28
- @tailwind utilities;
29
-
30
- /* v4 (required) */
31
- @import "tailwindcss";
32
- ```
33
-
34
- ## Important Modifier 위치 변경
35
-
36
- ```css
37
- /* v3 */
38
- !bg-red-500
39
-
40
- /* v4 - 끝에 위치 */
41
- bg-red-500!
42
- ```
43
-
44
- ## Custom Utilities 문법 변경
45
-
46
- ```css
47
- /* v3 */
48
- @layer utilities {
49
- .text-balance {
50
- text-wrap: balance;
51
- }
52
- }
53
-
54
- /* v4 - @utility 사용 */
55
- @utility text-balance {
56
- text-wrap: balance;
57
- }
58
- ```
59
-
60
- ## Stacked Variants 순서 변경
61
-
62
- ```html
63
- <!-- v3: right-to-left (hover가 dark보다 우선) -->
64
- <div class="dark:hover:bg-blue-500">
65
-
66
- <!-- v4: left-to-right (dark가 hover보다 우선) -->
67
- <div class="dark:hover:bg-blue-500">
68
- ```
69
-
70
- > v4에서는 왼쪽부터 적용되므로 variant 순서에 주의하세요.
71
-
72
- ## CSS Variable Syntax 변경
73
-
74
- ```html
75
- <!-- v3 -->
76
- <div class="bg-[var(--brand-color)]">
77
- <div class="bg-[--brand-color]">
78
-
79
- <!-- v4 - 괄호 문법 사용 -->
80
- <div class="bg-(--brand-color)">
81
- ```
82
-
83
- ## hover: 동작 변경
84
-
85
- ```html
86
- <!-- v4에서 hover:는 hover 지원 기기에서만 적용 -->
87
- <!-- 터치 기기에서는 적용되지 않음 -->
88
- <button class="hover:bg-blue-500">
89
-
90
- <!-- 모든 기기에서 적용하려면 -->
91
- <button class="hover:bg-blue-500 active:bg-blue-500">
92
- ```
93
-
94
- ## Default Color 변경
95
-
96
- ```css
97
- /* v4 기본값 변경 */
98
- border-color: currentColor; /* v3: gray-200 */
99
- ring-width: 1px; /* v3: 3px */
100
- ring-color: currentColor; /* v3: blue-500/50 */
101
- ```
102
-
103
- > 기존 디자인이 깨질 수 있으니 명시적 색상 지정 권장.
104
-
105
- ## Transform 초기화 변경
106
-
107
- ```html
108
- <!-- v3 -->
109
- <div class="transform-none">
110
-
111
- <!-- v4 - 개별 속성 사용 -->
112
- <div class="scale-none rotate-none translate-none">
113
- ```
114
-
115
- ## space-* / divide-* 선택자 변경
116
-
117
- ```html
118
- <!-- 레이아웃이 깨지면 gap으로 대체 -->
119
- <div class="flex gap-4"> <!-- space-x-4 대신 -->
120
- <div class="grid gap-4"> <!-- space-y-4 대신 -->
121
- ```
122
-
123
- ## CSS Modules에서 Theme 변수 접근
124
-
125
- ```css
126
- /* Component.module.css */
127
- @reference "tailwindcss"; /* v4 필수 */
128
-
129
- .button {
130
- background-color: var(--color-primary);
131
- }
132
- ```
133
-
134
- ## Prefix 설정 변경
135
-
136
- ```css
137
- /* v3: tailwind.config.js */
138
- module.exports = { prefix: 'tw-' }
139
-
140
- /* v4: CSS에서 설정 */
141
- @import "tailwindcss" prefix(tw);
142
-
143
- /* 사용 시 콜론 형식 */
144
- <div class="tw:bg-blue-500">
145
- ```
146
-
147
- ## Mandu 특화 주의사항
148
-
149
- ### Island 컴포넌트에서 @reference
150
-
151
- ```tsx
152
- // Island에서 CSS Modules 사용 시
153
- import styles from './Counter.module.css';
154
-
155
- // Counter.module.css에 @reference 필수
156
- ```
157
-
158
- ### SSR과 CSS 순서
159
-
160
- Mandu의 CSS Auto-Build는 `/.mandu/client/globals.css`에 출력합니다.
161
- SSR 시 이 경로로 자동 주입되므로 별도 설정 불필요.
162
-
163
- ### HMR 동작
164
-
165
- CSS 변경 시 `css-update` HMR 메시지로 스타일시트만 교체됩니다.
166
- 페이지 전체 리로드 없이 스타일 변경 확인 가능.
167
-
168
- ## 마이그레이션 체크리스트
169
-
170
- - [ ] Browser support 확인 (Safari 16.4+)
171
- - [ ] `@tailwind` → `@import "tailwindcss"` 변경
172
- - [ ] `tailwind.config.ts` 삭제, `@theme`으로 이전
173
- - [ ] `postcss.config.js` 삭제
174
- - [ ] Important modifier 위치 변경 (`!` → 끝)
175
- - [ ] `@layer utilities` → `@utility` 변경
176
- - [ ] CSS variable 문법 확인 `[--var]` → `(--var)`
177
- - [ ] space-*/divide-* 레이아웃 확인
178
-
179
- Reference: [Tailwind CSS v4 Upgrade Guide](https://tailwindcss.com/docs/upgrade-guide)
@@ -1,229 +0,0 @@
1
- ---
2
- title: Dark Mode Implementation
3
- impact: MEDIUM
4
- impactDescription: User preference and accessibility support
5
- tags: styling, theme, darkmode, accessibility
6
- ---
7
-
8
- ## Dark Mode Implementation
9
-
10
- **Impact: MEDIUM (User preference and accessibility support)**
11
-
12
- 다크모드를 구현하여 사용자 선호도와 접근성을 지원하세요.
13
-
14
- ## CSS Variables 기반 테마
15
-
16
- ```css
17
- /* app/globals.css */
18
- @layer base {
19
- :root {
20
- --background: 0 0% 100%;
21
- --foreground: 222.2 84% 4.9%;
22
- --card: 0 0% 100%;
23
- --card-foreground: 222.2 84% 4.9%;
24
- --primary: 221.2 83.2% 53.3%;
25
- --primary-foreground: 210 40% 98%;
26
- --muted: 210 40% 96.1%;
27
- --muted-foreground: 215.4 16.3% 46.9%;
28
- --border: 214.3 31.8% 91.4%;
29
- }
30
-
31
- .dark {
32
- --background: 222.2 84% 4.9%;
33
- --foreground: 210 40% 98%;
34
- --card: 222.2 84% 4.9%;
35
- --card-foreground: 210 40% 98%;
36
- --primary: 217.2 91.2% 59.8%;
37
- --primary-foreground: 222.2 47.4% 11.2%;
38
- --muted: 217.2 32.6% 17.5%;
39
- --muted-foreground: 215 20.2% 65.1%;
40
- --border: 217.2 32.6% 17.5%;
41
- }
42
- }
43
- ```
44
-
45
- ## Tailwind dark: 활성화
46
-
47
- ```typescript
48
- // tailwind.config.ts
49
- export default {
50
- darkMode: "class", // 또는 "media"
51
- // ...
52
- };
53
- ```
54
-
55
- ## 테마 Provider Island
56
-
57
- ```tsx
58
- // app/theme/client.tsx
59
- "use client";
60
-
61
- import { createContext, useContext, useEffect, useState } from "react";
62
-
63
- type Theme = "light" | "dark" | "system";
64
-
65
- interface ThemeContextValue {
66
- theme: Theme;
67
- setTheme: (theme: Theme) => void;
68
- resolvedTheme: "light" | "dark";
69
- }
70
-
71
- const ThemeContext = createContext<ThemeContextValue | null>(null);
72
-
73
- export function ThemeProviderIsland({ children }: { children: React.ReactNode }) {
74
- const [theme, setTheme] = useState<Theme>("system");
75
- const [resolvedTheme, setResolvedTheme] = useState<"light" | "dark">("light");
76
-
77
- useEffect(() => {
78
- // 저장된 테마 복원
79
- const stored = localStorage.getItem("theme") as Theme | null;
80
- if (stored) {
81
- setTheme(stored);
82
- }
83
- }, []);
84
-
85
- useEffect(() => {
86
- const root = document.documentElement;
87
-
88
- if (theme === "system") {
89
- const systemDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
90
- setResolvedTheme(systemDark ? "dark" : "light");
91
- root.classList.toggle("dark", systemDark);
92
- } else {
93
- setResolvedTheme(theme);
94
- root.classList.toggle("dark", theme === "dark");
95
- }
96
-
97
- localStorage.setItem("theme", theme);
98
- }, [theme]);
99
-
100
- // System 변경 감지
101
- useEffect(() => {
102
- if (theme !== "system") return;
103
-
104
- const mq = window.matchMedia("(prefers-color-scheme: dark)");
105
- const handler = (e: MediaQueryListEvent) => {
106
- setResolvedTheme(e.matches ? "dark" : "light");
107
- document.documentElement.classList.toggle("dark", e.matches);
108
- };
109
-
110
- mq.addEventListener("change", handler);
111
- return () => mq.removeEventListener("change", handler);
112
- }, [theme]);
113
-
114
- return (
115
- <ThemeContext.Provider value={{ theme, setTheme, resolvedTheme }}>
116
- {children}
117
- </ThemeContext.Provider>
118
- );
119
- }
120
-
121
- export function useTheme() {
122
- const context = useContext(ThemeContext);
123
- if (!context) {
124
- throw new Error("useTheme must be used within ThemeProviderIsland");
125
- }
126
- return context;
127
- }
128
- ```
129
-
130
- ## 테마 토글 컴포넌트
131
-
132
- ```tsx
133
- // app/theme/toggle.tsx
134
- "use client";
135
-
136
- import { useTheme } from "./client";
137
-
138
- export function ThemeToggleIsland() {
139
- const { theme, setTheme, resolvedTheme } = useTheme();
140
-
141
- return (
142
- <button
143
- onClick={() => setTheme(resolvedTheme === "dark" ? "light" : "dark")}
144
- className="p-2 rounded-md hover:bg-muted"
145
- aria-label={`Switch to ${resolvedTheme === "dark" ? "light" : "dark"} mode`}
146
- >
147
- {resolvedTheme === "dark" ? "🌙" : "☀️"}
148
- </button>
149
- );
150
- }
151
- ```
152
-
153
- ## 플래시 방지 스크립트
154
-
155
- ```tsx
156
- // app/layout.tsx
157
- export default function RootLayout({ children }) {
158
- return (
159
- <html lang="ko" suppressHydrationWarning>
160
- <head>
161
- {/* 다크모드 플래시 방지 */}
162
- <script
163
- dangerouslySetInnerHTML={{
164
- __html: `
165
- (function() {
166
- const theme = localStorage.getItem('theme');
167
- const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
168
-
169
- if (theme === 'dark' || (!theme && prefersDark)) {
170
- document.documentElement.classList.add('dark');
171
- }
172
- })();
173
- `,
174
- }}
175
- />
176
- </head>
177
- <body>
178
- <ThemeProviderIsland>
179
- {children}
180
- </ThemeProviderIsland>
181
- </body>
182
- </html>
183
- );
184
- }
185
- ```
186
-
187
- ## Island 간 테마 동기화
188
-
189
- ```tsx
190
- // useIslandEvent로 테마 변경 전파
191
- import { useIslandEvent } from "@mandujs/core/client";
192
-
193
- export function ThemeProviderIsland({ children }) {
194
- const { emit } = useIslandEvent<{ theme: string }>("theme-change");
195
- const [theme, setTheme] = useState("system");
196
-
197
- const handleSetTheme = (newTheme: Theme) => {
198
- setTheme(newTheme);
199
- emit({ theme: newTheme }); // 다른 Island에 전파
200
- };
201
-
202
- // ...
203
- }
204
-
205
- // 다른 Island에서 수신
206
- export function AnotherIsland() {
207
- useIslandEvent<{ theme: string }>("theme-change", (data) => {
208
- console.log("Theme changed to:", data.theme);
209
- });
210
- }
211
- ```
212
-
213
- ## 다크모드 특화 스타일
214
-
215
- ```tsx
216
- // Tailwind dark: 접두사 사용
217
- <div className="bg-white dark:bg-gray-900">
218
- <p className="text-gray-900 dark:text-gray-100">
219
- Content
220
- </p>
221
- </div>
222
-
223
- // 복잡한 경우 CSS Variables 활용
224
- <div className="bg-[hsl(var(--background))]">
225
- {/* 자동으로 테마 반영 */}
226
- </div>
227
- ```
228
-
229
- Reference: [Tailwind Dark Mode](https://tailwindcss.com/docs/dark-mode)
@@ -1,132 +0,0 @@
1
- ---
2
- name: mandu-testing
3
- description: |
4
- Testing patterns for Mandu applications. Use when writing unit tests,
5
- integration tests, or E2E tests. Triggers on test, spec, Bun test,
6
- Playwright, or testing tasks.
7
- license: MIT
8
- metadata:
9
- author: mandu
10
- version: "1.0.0"
11
- ---
12
-
13
- # Mandu Testing
14
-
15
- Mandu 애플리케이션의 테스트 패턴 가이드. Bun test를 활용한 단위 테스트, slot 테스트, Island 컴포넌트 테스트, Playwright E2E 테스트를 다룹니다.
16
-
17
- ## Agent Workflow Contract
18
-
19
- This skill is a Domain addendum. It must not replace `mandu-agent-workflow`.
20
- Use it only after `mandu.agent.plan` selects testing or `mandu.agent.verify` asks for targeted test coverage.
21
-
22
- Canonical workflow step: `verify -> repair`.
23
-
24
- Preferred MCP tools:
25
-
26
- | Step | Tools |
27
- |------|-------|
28
- | plan | `mandu.agent.plan` |
29
- | verify | `mandu.agent.verify`, `mandu.run.tests`, `mandu.ate.generate`, `mandu.ate.run` |
30
- | repair | `mandu.agent.repair`, `mandu.ate.heal` |
31
-
32
- Allowed file edits:
33
-
34
- - Co-located `*.test.ts` / `*.test.tsx` files
35
- - `tests/e2e/**/*.spec.ts`
36
- - Test fixtures and mocks scoped to the planned domain
37
-
38
- Verification command:
39
-
40
- ```bash
41
- mandu agent verify --changed --json --write
42
- ```
43
-
44
- Common failures:
45
-
46
- - Running broad watch-mode tests as an agent default
47
- - Adding tests that bypass the route/slot/contract path under change
48
- - Applying ATE healing before reading the verify report
49
-
50
- Repair path:
51
-
52
- ```bash
53
- mandu agent repair --from .mandu/agent-verify.json --json
54
- ```
55
-
56
- ## When to Apply
57
-
58
- Reference these guidelines when:
59
- - Writing unit tests for slots
60
- - Testing Island components
61
- - Setting up E2E tests with Playwright
62
- - Mocking external dependencies
63
- - Testing authentication flows
64
-
65
- ## Rule Categories by Priority
66
-
67
- | Priority | Category | Impact | Prefix |
68
- |----------|----------|--------|--------|
69
- | 1 | Slot Testing | HIGH | `test-slot-` |
70
- | 2 | Component Testing | HIGH | `test-component-` |
71
- | 3 | E2E Testing | MEDIUM | `test-e2e-` |
72
- | 4 | Mocking | MEDIUM | `test-mock-` |
73
-
74
- ## Quick Reference
75
-
76
- ### 1. Slot Testing (HIGH)
77
-
78
- - `test-slot-unit` - Unit test slot handlers
79
- - `test-slot-guard` - Test guard authentication
80
- - `test-slot-integration` - Integration test with database
81
-
82
- ### 2. Component Testing (HIGH)
83
-
84
- - `test-component-island` - Test Island components
85
- - `test-component-render` - Test rendering output
86
- - `test-component-interaction` - Test user interactions
87
-
88
- ### 3. E2E Testing (MEDIUM)
89
-
90
- - `test-e2e-playwright` - Playwright setup and patterns
91
- - `test-e2e-auth` - Test authentication flows
92
- - `test-e2e-navigation` - Test page navigation
93
-
94
- ### 4. Mocking (MEDIUM)
95
-
96
- - `test-mock-fetch` - Mock fetch requests
97
- - `test-mock-database` - Mock database operations
98
-
99
- ## Low-Level Test Commands
100
-
101
- Use these only after `agent plan` or `agent verify` identifies the target:
102
-
103
- ```bash
104
- mandu agent verify --changed --json --write
105
- bun test src/slots/user.test.ts
106
- bun test --coverage
107
- ```
108
-
109
- ## Test File Convention
110
-
111
- ```
112
- spec/slots/
113
- ├── users.slot.ts
114
- ├── users.slot.test.ts # Slot tests
115
- app/
116
- ├── dashboard/
117
- │ ├── client.tsx
118
- │ └── client.test.tsx # Component tests
119
- tests/
120
- └── e2e/
121
- └── auth.spec.ts # E2E tests
122
- ```
123
-
124
- ## How to Use
125
-
126
- Read individual rule files for detailed explanations:
127
-
128
- ```
129
- rules/test-slot-unit.md
130
- rules/test-component-island.md
131
- rules/test-e2e-playwright.md
132
- ```