@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,149 +0,0 @@
1
- ---
2
- title: Use Children for Composition Over Render Props
3
- impact: MEDIUM
4
- impactDescription: Simpler API, better composition
5
- tags: composition, children, render-props, pattern
6
- ---
7
-
8
- ## Use Children for Composition Over Render Props
9
-
10
- **Impact: MEDIUM (Simpler API, better composition)**
11
-
12
- `renderX` props 대신 `children`을 사용하여 컴포지션하세요. 더 선언적이고 유연합니다.
13
-
14
- **Incorrect (render props):**
15
-
16
- ```tsx
17
- // ❌ renderX props 패턴
18
- function Modal({
19
- renderHeader,
20
- renderBody,
21
- renderFooter,
22
- renderCloseButton,
23
- }: ModalProps) {
24
- return (
25
- <div className="modal">
26
- <div className="modal-header">
27
- {renderCloseButton?.()}
28
- {renderHeader?.()}
29
- </div>
30
- <div className="modal-body">
31
- {renderBody?.()}
32
- </div>
33
- <div className="modal-footer">
34
- {renderFooter?.()}
35
- </div>
36
- </div>
37
- );
38
- }
39
-
40
- // 사용 시 복잡함
41
- <Modal
42
- renderHeader={() => <h2>Title</h2>}
43
- renderBody={() => <p>Content</p>}
44
- renderFooter={() => (
45
- <>
46
- <Button>Cancel</Button>
47
- <Button>Save</Button>
48
- </>
49
- )}
50
- renderCloseButton={() => <CloseButton />}
51
- />
52
- ```
53
-
54
- **Correct (children + compound):**
55
-
56
- ```tsx
57
- // ✅ children과 컴파운드 패턴
58
- function Modal({ children }: { children: React.ReactNode }) {
59
- return <div className="modal">{children}</div>;
60
- }
61
-
62
- function ModalHeader({ children }: { children: React.ReactNode }) {
63
- return <div className="modal-header">{children}</div>;
64
- }
65
-
66
- function ModalBody({ children }: { children: React.ReactNode }) {
67
- return <div className="modal-body">{children}</div>;
68
- }
69
-
70
- function ModalFooter({ children }: { children: React.ReactNode }) {
71
- return <div className="modal-footer">{children}</div>;
72
- }
73
-
74
- function ModalClose({ onClose }: { onClose: () => void }) {
75
- return <button onClick={onClose} className="modal-close">×</button>;
76
- }
77
-
78
- export { Modal, ModalHeader, ModalBody, ModalFooter, ModalClose };
79
- ```
80
-
81
- **사용:**
82
-
83
- ```tsx
84
- // 선언적이고 명확함
85
- <Modal>
86
- <ModalHeader>
87
- <ModalClose onClose={handleClose} />
88
- <h2>Title</h2>
89
- </ModalHeader>
90
-
91
- <ModalBody>
92
- <p>Content goes here</p>
93
- </ModalBody>
94
-
95
- <ModalFooter>
96
- <Button onClick={handleClose}>Cancel</Button>
97
- <Button onClick={handleSave}>Save</Button>
98
- </ModalFooter>
99
- </Modal>
100
- ```
101
-
102
- ## 장점
103
-
104
- | render props | children |
105
- |--------------|----------|
106
- | 숨겨진 구조 | 명시적 구조 |
107
- | 함수 호출 문법 | JSX 문법 |
108
- | 순서가 props에 의존 | 순서를 소비자가 제어 |
109
- | 어떤 props가 있는지 봐야 함 | 자동완성 지원 |
110
-
111
- ## Mandu Island에서의 적용
112
-
113
- ```tsx
114
- // ❌ 피해야 할 패턴
115
- <FormIsland
116
- renderInput={(value, onChange) => <Input value={value} onChange={onChange} />}
117
- renderSubmit={(onSubmit) => <Button onClick={onSubmit}>Submit</Button>}
118
- renderError={(error) => <ErrorMessage error={error} />}
119
- />
120
-
121
- // ✅ 권장 패턴
122
- <Form.Provider>
123
- <Form.Frame>
124
- <Form.Input name="email" />
125
- <Form.Input name="password" type="password" />
126
- <Form.Error />
127
- <Form.Submit>Sign In</Form.Submit>
128
- </Form.Frame>
129
- </Form.Provider>
130
- ```
131
-
132
- ## 언제 Render Props를 사용하나?
133
-
134
- render props가 여전히 유용한 경우:
135
- - 부모가 데이터를 제공하고 자식이 렌더링 방법을 결정 (예: virtualized list)
136
- - 자식에게 상태를 노출해야 하는 headless 컴포넌트
137
-
138
- ```tsx
139
- // Render props가 적합한 예: Virtualized List
140
- <VirtualList
141
- items={items}
142
- itemHeight={50}
143
- renderItem={(item, index) => (
144
- <div key={item.id}>{item.name}</div>
145
- )}
146
- />
147
- ```
148
-
149
- Reference: [Compound Components](https://kentcdodds.com/blog/compound-components-with-react-hooks)
@@ -1,148 +0,0 @@
1
- ---
2
- title: Define Generic Context Interface for Dependency Injection
3
- impact: HIGH
4
- impactDescription: Enables dependency-injectable state across use-cases
5
- tags: composition, context, state, typescript, dependency-injection
6
- ---
7
-
8
- ## Define Generic Context Interface for Dependency Injection
9
-
10
- **Impact: HIGH (Enables dependency-injectable state across use-cases)**
11
-
12
- 컴포넌트 context를 위한 제네릭 인터페이스를 `state`, `actions`, `meta` 세 부분으로 정의하세요. 어떤 Provider든 이 인터페이스를 구현할 수 있어, 같은 UI 컴포넌트가 완전히 다른 상태 구현과 작동할 수 있습니다.
13
-
14
- **핵심 원칙:** Lift state, compose internals, make state dependency-injectable.
15
-
16
- **Incorrect (특정 상태 구현에 결합):**
17
-
18
- ```tsx
19
- // ❌ 특정 훅에 강하게 결합
20
- function ComposerInput() {
21
- const { input, setInput } = useChannelComposerState();
22
- return <TextInput value={input} onChangeText={setInput} />;
23
- }
24
- ```
25
-
26
- **Correct (제네릭 인터페이스로 의존성 주입):**
27
-
28
- ```tsx
29
- // ✅ 어떤 Provider든 구현할 수 있는 제네릭 인터페이스
30
- interface ComposerState {
31
- input: string;
32
- attachments: Attachment[];
33
- isSubmitting: boolean;
34
- }
35
-
36
- interface ComposerActions {
37
- update: (updater: (state: ComposerState) => ComposerState) => void;
38
- submit: () => void;
39
- addAttachment: (file: File) => void;
40
- }
41
-
42
- interface ComposerMeta {
43
- inputRef: React.RefObject<HTMLTextAreaElement>;
44
- maxLength?: number;
45
- }
46
-
47
- interface ComposerContextValue {
48
- state: ComposerState;
49
- actions: ComposerActions;
50
- meta: ComposerMeta;
51
- }
52
-
53
- const ComposerContext = createContext<ComposerContextValue | null>(null);
54
- ```
55
-
56
- **UI 컴포넌트는 인터페이스만 소비:**
57
-
58
- ```tsx
59
- function ComposerInput() {
60
- const {
61
- state,
62
- actions: { update },
63
- meta,
64
- } = use(ComposerContext)!;
65
-
66
- // 이 컴포넌트는 인터페이스를 구현한 어떤 Provider와도 작동
67
- return (
68
- <textarea
69
- ref={meta.inputRef}
70
- value={state.input}
71
- maxLength={meta.maxLength}
72
- onChange={(e) => update((s) => ({ ...s, input: e.target.value }))}
73
- />
74
- );
75
- }
76
- ```
77
-
78
- **서로 다른 Provider가 같은 인터페이스 구현:**
79
-
80
- ```tsx
81
- // Provider A: 임시 폼을 위한 로컬 상태
82
- function ForwardMessageProvider({ children }: { children: React.ReactNode }) {
83
- const [state, setState] = useState(initialState);
84
- const inputRef = useRef<HTMLTextAreaElement>(null);
85
- const submit = useForwardMessage();
86
-
87
- return (
88
- <ComposerContext value={{
89
- state,
90
- actions: { update: setState, submit, addAttachment: ... },
91
- meta: { inputRef },
92
- }}>
93
- {children}
94
- </ComposerContext>
95
- );
96
- }
97
-
98
- // Provider B: 채널을 위한 전역 동기화 상태
99
- function ChannelProvider({ channelId, children }: Props) {
100
- const { state, update, submit } = useGlobalChannel(channelId);
101
- const inputRef = useRef<HTMLTextAreaElement>(null);
102
-
103
- return (
104
- <ComposerContext value={{
105
- state,
106
- actions: { update, submit, addAttachment: ... },
107
- meta: { inputRef, maxLength: 2000 },
108
- }}>
109
- {children}
110
- </ComposerContext>
111
- );
112
- }
113
- ```
114
-
115
- **같은 UI가 두 Provider와 모두 작동:**
116
-
117
- ```tsx
118
- // ForwardMessageProvider와 작동 (로컬 상태)
119
- <ForwardMessageProvider>
120
- <Composer.Frame>
121
- <Composer.Input />
122
- <Composer.Submit />
123
- </Composer.Frame>
124
- </ForwardMessageProvider>
125
-
126
- // ChannelProvider와 작동 (전역 동기화 상태)
127
- <ChannelProvider channelId="abc">
128
- <Composer.Frame>
129
- <Composer.Input />
130
- <Composer.Submit />
131
- </Composer.Frame>
132
- </ChannelProvider>
133
- ```
134
-
135
- ## Mandu Island에서의 활용
136
-
137
- ```tsx
138
- // Island 컴포넌트는 인터페이스만 알면 됨
139
- // slot에서 어떤 Provider를 사용하든 같은 Island 재사용 가능
140
-
141
- // spec/slots/forward.slot.ts → ForwardMessageProvider 사용
142
- // spec/slots/channel.slot.ts → ChannelProvider 사용
143
- // 둘 다 같은 Composer Island 컴포넌트 사용
144
- ```
145
-
146
- UI는 재사용 가능한 조각들이고, 상태는 Provider가 주입합니다. Provider를 바꾸면 UI는 그대로!
147
-
148
- Reference: [Context Interface Pattern](https://kentcdodds.com/blog/how-to-use-react-context-effectively)
@@ -1,150 +0,0 @@
1
- ---
2
- title: Lift State into Provider for Sibling Access
3
- impact: HIGH
4
- impactDescription: Enables state sharing without prop drilling
5
- tags: composition, state, provider, lift-state
6
- ---
7
-
8
- ## Lift State into Provider for Sibling Access
9
-
10
- **Impact: HIGH (Enables state sharing without prop drilling)**
11
-
12
- 형제 컴포넌트가 상태를 공유해야 할 때, 상태를 Provider로 끌어올리세요. Provider 경계 내의 모든 컴포넌트가 상태에 접근할 수 있습니다.
13
-
14
- **Incorrect (prop drilling):**
15
-
16
- ```tsx
17
- // ❌ 상태를 여러 단계로 전달
18
- function ChatPage() {
19
- const [message, setMessage] = useState("");
20
- const [isTyping, setIsTyping] = useState(false);
21
-
22
- return (
23
- <div>
24
- <MessageList
25
- isTyping={isTyping}
26
- typingMessage={message} // prop drilling
27
- />
28
- <Composer
29
- message={message}
30
- setMessage={setMessage}
31
- setIsTyping={setIsTyping}
32
- />
33
- <TypingIndicator isTyping={isTyping} /> // prop drilling
34
- </div>
35
- );
36
- }
37
- ```
38
-
39
- **Correct (Provider로 끌어올리기):**
40
-
41
- ```tsx
42
- // ✅ Provider가 상태 관리
43
- interface ChatContextValue {
44
- state: { message: string; isTyping: boolean };
45
- actions: { setMessage: (msg: string) => void; setIsTyping: (val: boolean) => void };
46
- }
47
-
48
- const ChatContext = createContext<ChatContextValue | null>(null);
49
-
50
- function ChatProvider({ children }: { children: React.ReactNode }) {
51
- const [message, setMessage] = useState("");
52
- const [isTyping, setIsTyping] = useState(false);
53
-
54
- return (
55
- <ChatContext value={{
56
- state: { message, isTyping },
57
- actions: { setMessage, setIsTyping },
58
- }}>
59
- {children}
60
- </ChatContext>
61
- );
62
- }
63
-
64
- // 각 컴포넌트가 필요한 것만 가져감
65
- function MessageList() {
66
- const { state } = use(ChatContext)!;
67
- return (
68
- <div>
69
- {messages.map(msg => <Message key={msg.id} {...msg} />)}
70
- {state.isTyping && <TypingPreview text={state.message} />}
71
- </div>
72
- );
73
- }
74
-
75
- function Composer() {
76
- const { state, actions } = use(ChatContext)!;
77
- return (
78
- <textarea
79
- value={state.message}
80
- onChange={(e) => {
81
- actions.setMessage(e.target.value);
82
- actions.setIsTyping(e.target.value.length > 0);
83
- }}
84
- />
85
- );
86
- }
87
-
88
- function TypingIndicator() {
89
- const { state } = use(ChatContext)!;
90
- if (!state.isTyping) return null;
91
- return <span>Someone is typing...</span>;
92
- }
93
- ```
94
-
95
- **사용:**
96
-
97
- ```tsx
98
- function ChatPage() {
99
- return (
100
- <ChatProvider>
101
- <div>
102
- <MessageList /> {/* context에서 상태 읽음 */}
103
- <Composer /> {/* context에서 상태 수정 */}
104
- <TypingIndicator /> {/* context에서 상태 읽음 */}
105
- </div>
106
- </ChatProvider>
107
- );
108
- }
109
- ```
110
-
111
- ## Provider 경계 이해하기
112
-
113
- Provider 경계 내라면 시각적 위치와 무관하게 상태 접근 가능:
114
-
115
- ```tsx
116
- <ChatProvider>
117
- <Dialog>
118
- {/* Dialog 내부 */}
119
- <Composer.Frame>
120
- <Composer.Input />
121
- </Composer.Frame>
122
-
123
- {/* Frame 외부지만 Provider 내부! */}
124
- <MessagePreview /> {/* ✅ context 접근 가능 */}
125
-
126
- <DialogActions>
127
- <SendButton /> {/* ✅ context 접근 가능 */}
128
- </DialogActions>
129
- </Dialog>
130
- </ChatProvider>
131
- ```
132
-
133
- ## Mandu Island에서의 적용
134
-
135
- ```tsx
136
- // app/chat/page.tsx
137
- import { ChatIsland } from "./client";
138
-
139
- export default function ChatPage({ data }) {
140
- return (
141
- <div>
142
- <h1>Chat</h1>
143
- {/* Island 내부에서 Provider로 상태 관리 */}
144
- <ChatIsland initialMessages={data.messages} />
145
- </div>
146
- );
147
- }
148
- ```
149
-
150
- Reference: [Lifting State Up](https://react.dev/learn/sharing-state-between-components)
@@ -1,135 +0,0 @@
1
- ---
2
- name: Mandu Deployment
3
- description: Production deployment patterns for Mandu applications
4
- metadata:
5
- version: "1.0.0"
6
- author: mandu
7
- globs:
8
- - "render.yaml"
9
- - "Dockerfile"
10
- - "docker-compose.yml"
11
- - ".github/workflows/*.yml"
12
- - "bunfig.toml"
13
- ---
14
-
15
- # Mandu Deployment Skill
16
-
17
- Mandu 앱을 프로덕션 환경에 안전하고 효율적으로 배포하기 위한 가이드입니다.
18
-
19
- ## Agent Workflow Contract
20
-
21
- This skill is a Domain addendum. It must not replace `mandu-agent-workflow`.
22
- Use it only after `mandu.agent.plan` selects the deploy domain.
23
-
24
- Canonical workflow step: `plan -> apply -> verify`.
25
-
26
- Preferred MCP tools:
27
-
28
- | Step | Tools |
29
- |------|-------|
30
- | plan | `mandu.agent.plan`, `mandu.deploy.plan` |
31
- | apply | `mandu.agent.apply`, `mandu.deploy.compile` |
32
- | verify | `mandu.agent.verify`, `mandu.deploy.preview` |
33
- | repair | `mandu.agent.repair` |
34
-
35
- Allowed file edits:
36
-
37
- - `.mandu/deploy.intent.json`
38
- - Provider artifacts named in the plan, such as `render.yaml`, `Dockerfile`, `docker-compose.yml`, `fly.toml`, `vercel.json`, or `netlify.toml`
39
- - CI workflow files only when deploy automation is explicitly requested
40
-
41
- Verification command:
42
-
43
- ```bash
44
- mandu agent verify --changed --json --write
45
- ```
46
-
47
- Common failures:
48
-
49
- - Executing a provider deploy before a dry-run or preview step
50
- - Writing secrets into tracked config
51
- - Changing provider artifacts without route/deploy intent verification
52
-
53
- Repair path:
54
-
55
- ```bash
56
- mandu agent repair --from .mandu/agent-verify.json --json
57
- ```
58
-
59
- ## 핵심 원칙
60
-
61
- 1. **Bun 네이티브**: Bun 런타임과 번들러를 최대한 활용
62
- 2. **환경 분리**: 개발/스테이징/프로덕션 환경 명확히 구분
63
- 3. **자동화**: CI/CD를 통한 일관된 배포 프로세스
64
- 4. **보안 우선**: 민감 정보는 환경 변수로 관리
65
-
66
- ## Provider Artifact Examples
67
-
68
- Use these examples only after `mandu.agent.plan` selects the deploy domain and
69
- `mandu.agent.apply` has produced the intended action order.
70
-
71
- ### Render 배포 (권장)
72
-
73
- ```yaml
74
- # render.yaml
75
- services:
76
- - type: web
77
- name: mandu-app
78
- runtime: node
79
- buildCommand: bun install && bun run build
80
- startCommand: bun run start
81
- envVars:
82
- - key: NODE_ENV
83
- value: production
84
- - key: BUN_ENV
85
- value: production
86
- ```
87
-
88
- ### Docker 배포
89
-
90
- ```dockerfile
91
- FROM oven/bun:1.0
92
-
93
- WORKDIR /app
94
- COPY package.json bun.lockb ./
95
- RUN bun install --frozen-lockfile --production
96
-
97
- COPY . .
98
- RUN bun run build
99
-
100
- EXPOSE 3000
101
- CMD ["bun", "run", "start"]
102
- ```
103
-
104
- ## 배포 체크리스트
105
-
106
- ### 빌드 준비
107
- - [ ] `bun run build` 성공 확인
108
- - [ ] 번들 크기 최적화 (tree-shaking, code-splitting)
109
- - [ ] 환경 변수 설정 완료
110
-
111
- ### 플랫폼 설정
112
- - [ ] Render/Docker 설정 파일 작성
113
- - [ ] 헬스체크 엔드포인트 구현
114
- - [ ] 로깅 설정 완료
115
-
116
- ### 보안
117
- - [ ] 민감 정보 환경 변수로 분리
118
- - [ ] HTTPS 강제 적용
119
- - [ ] 보안 헤더 설정
120
-
121
- ### 모니터링
122
- - [ ] 에러 트래킹 설정
123
- - [ ] 성능 모니터링 구성
124
- - [ ] 알림 설정
125
-
126
- ## 규칙 카테고리
127
-
128
- | Category | Description | Rules |
129
- |----------|-------------|-------|
130
- | Build | 프로덕션 빌드 최적화 | 2 |
131
- | Platform | 플랫폼별 배포 설정 | 3 |
132
- | Container | Docker 컨테이너화 | 2 |
133
- | CI/CD | 자동화 파이프라인 | 1 |
134
-
135
- → 세부 규칙은 `rules/` 폴더 참조
@@ -1,41 +0,0 @@
1
- # Mandu Deployment - Rule Categories
2
-
3
- ## Build
4
- 프로덕션 빌드 최적화 및 번들링 설정
5
-
6
- | Impact | Description |
7
- |--------|-------------|
8
- | CRITICAL | 빌드 실패 시 배포 불가 |
9
- | HIGH | 번들 크기, 빌드 시간에 큰 영향 |
10
-
11
- ## Platform
12
- 배포 플랫폼별 설정 및 최적화
13
-
14
- | Impact | Description |
15
- |--------|-------------|
16
- | CRITICAL | 플랫폼 호환성 필수 |
17
- | HIGH | 성능, 비용에 큰 영향 |
18
-
19
- ## Container
20
- Docker 컨테이너화 및 오케스트레이션
21
-
22
- | Impact | Description |
23
- |--------|-------------|
24
- | HIGH | 일관된 배포 환경 보장 |
25
- | MEDIUM | 개발/프로덕션 환경 일치 |
26
-
27
- ## CI/CD
28
- 지속적 통합 및 배포 파이프라인
29
-
30
- | Impact | Description |
31
- |--------|-------------|
32
- | HIGH | 자동화된 품질 보증 |
33
- | MEDIUM | 배포 속도 및 안정성 향상 |
34
-
35
- ## Environment
36
- 환경 변수 및 설정 관리
37
-
38
- | Impact | Description |
39
- |--------|-------------|
40
- | CRITICAL | 보안 민감 정보 보호 |
41
- | HIGH | 환경별 설정 분리 |
@@ -1,38 +0,0 @@
1
- ---
2
- title: Rule Title Here
3
- impact: CRITICAL | HIGH | MEDIUM | LOW
4
- impactDescription: One-line description of why this matters
5
- tags: deployment, tag2, tag3
6
- ---
7
-
8
- ## Rule Title Here
9
-
10
- **Impact: LEVEL (Impact description)**
11
-
12
- 규칙에 대한 간단한 설명.
13
-
14
- **설정 예시:**
15
-
16
- ```yaml
17
- # 설정 파일 예시
18
- key: value
19
- ```
20
-
21
- **구현 예시:**
22
-
23
- ```typescript
24
- // 코드 예시
25
- ```
26
-
27
- ## 추가 설정
28
-
29
- ```bash
30
- # 명령어 예시
31
- ```
32
-
33
- ## 주의사항
34
-
35
- - 첫 번째 주의사항
36
- - 두 번째 주의사항
37
-
38
- Reference: [문서 링크](https://example.com)
@@ -1,13 +0,0 @@
1
- {
2
- "id": "mandu-deployment",
3
- "name": "Mandu Deployment",
4
- "version": "1.0.0",
5
- "description": "Production deployment patterns for Mandu applications",
6
- "author": "mandu",
7
- "references": [
8
- "https://bun.sh/docs/bundler",
9
- "https://render.com/docs",
10
- "https://docs.docker.com/"
11
- ],
12
- "abstract": "Mandu 앱을 프로덕션 환경에 배포하기 위한 패턴과 가이드. Bun 빌드 최적화, Render/Docker 배포, CI/CD 파이프라인, 환경 설정을 다룹니다."
13
- }