@mandujs/mcp 0.38.11 → 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,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
|
-
}
|