@hahlex/millar-mcp 0.0.0-stage → 0.1.0-draft.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/LICENSE +21 -0
- package/dist/docs/CHANGELOG.md +21 -0
- package/dist/docs/GLOSSARY.md +77 -0
- package/dist/http.d.ts +3 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +39566 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +6 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1115 -0
- package/dist/server.js.map +1 -0
- package/dist/skills/millar-animation/SKILL.md +66 -0
- package/dist/skills/millar-animation/references/animation-research-patterns.md +28 -0
- package/dist/skills/millar-animation/references/motion-choreography.md +80 -0
- package/dist/skills/millar-build-web/SKILL.md +59 -0
- package/dist/skills/millar-build-web/references/seo-cwv-and-copy.md +24 -0
- package/dist/skills/millar-build-web/references/web-architecture-checklist.md +47 -0
- package/dist/skills/millar-create-image/SKILL.md +62 -0
- package/dist/skills/millar-create-image/references/human-editorial-photography.md +74 -0
- package/dist/skills/millar-create-image/references/hybrid-plate-compositing.md +43 -0
- package/dist/skills/millar-create-image/references/image-art-direction.md +74 -0
- package/dist/skills/millar-create-image/references/multi-page-asset-map.md +27 -0
- package/dist/skills/millar-create-image/references/natural-editorial-illustration.md +57 -0
- package/dist/skills/millar-create-image/references/procedural-gallery-craft.md +84 -0
- package/dist/skills/millar-create-image/scripts/embed-provenance.mjs +185 -0
- package/dist/skills/millar-deep-research/SKILL.md +62 -0
- package/dist/skills/millar-deep-research/references/visual-extraction-protocol.md +36 -0
- package/dist/skills/millar-deep-research/references/world-class-benchmarks.md +30 -0
- package/dist/skills/millar-design/SKILL.md +83 -0
- package/dist/skills/millar-design/references/aesthetic-movements.md +49 -0
- package/dist/skills/millar-design/references/cross-page-sync-audit.md +25 -0
- package/dist/skills/millar-design/references/style-dna-contract.md +89 -0
- package/dist/skills/millar-verify-web/SKILL.md +76 -0
- package/dist/skills/millar-verify-web/references/five-layer-qa-gate.md +104 -0
- package/dist/skills/millar-verify-web/references/two-axis-review-rubric.md +23 -0
- package/dist/skills/millar-verify-web/scripts/millar-audit.mjs +617 -0
- package/dist/skills/millar-web-workflow/SKILL.md +60 -0
- package/dist/skills/millar-web-workflow/references/creative-divergence-protocol.md +52 -0
- package/dist/skills/millar-web-workflow/references/track-routing-and-gates.md +32 -0
- package/dist/skills-loader.d.ts +47 -0
- package/dist/skills-loader.d.ts.map +1 -0
- package/dist/skills-loader.js +204 -0
- package/dist/skills-loader.js.map +1 -0
- package/dist/sources/packages/marketing/src/assets/BrandAndGeometricAssets.tsx +373 -0
- package/dist/sources/packages/marketing/src/assets/SchematicAndProductAssets.tsx +497 -0
- package/dist/sources/packages/marketing/src/sections/MarketingSections.tsx +946 -0
- package/dist/sources/packages/marketing/src/templates/PageTemplates.tsx +304 -0
- package/dist/sources/packages/ui/src/components/Button.tsx +162 -0
- package/dist/sources/packages/ui/src/components/FormControls.tsx +476 -0
- package/dist/sources/packages/ui/src/components/Layout.tsx +176 -0
- package/dist/sources/packages/ui/src/components/OverlaysAndFeedback.tsx +291 -0
- package/dist/sources/packages/ui/src/components/SurfacesAndData.tsx +564 -0
- package/dist/stdio.d.ts +3 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +37380 -0
- package/dist/stdio.js.map +1 -0
- package/package.json +48 -3
- package/README.md +0 -3
package/dist/server.js
ADDED
|
@@ -0,0 +1,1115 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
+
import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import rawRegistry from "@hahlex/millar-tokens/registry";
|
|
7
|
+
import dtcgRaw from "@hahlex/millar-tokens/dtcg";
|
|
8
|
+
import { validateDesign } from "@hahlex/millar-validator";
|
|
9
|
+
import { loadMillarSkills, SKILL_COMBINATION_RECIPES } from "./skills-loader.js";
|
|
10
|
+
const registry = rawRegistry;
|
|
11
|
+
const READ_ONLY_ANNOTATIONS = {
|
|
12
|
+
readOnlyHint: true,
|
|
13
|
+
destructiveHint: false,
|
|
14
|
+
idempotentHint: true,
|
|
15
|
+
openWorldHint: false,
|
|
16
|
+
};
|
|
17
|
+
function readRepoDoc(rootDir, relPath, fallback) {
|
|
18
|
+
const full = path.join(rootDir, relPath);
|
|
19
|
+
if (fs.existsSync(full)) {
|
|
20
|
+
return fs.readFileSync(full, "utf8");
|
|
21
|
+
}
|
|
22
|
+
const bundled = path.join(import.meta.dirname, "docs", relPath);
|
|
23
|
+
if (fs.existsSync(bundled)) {
|
|
24
|
+
return fs.readFileSync(bundled, "utf8");
|
|
25
|
+
}
|
|
26
|
+
return fallback;
|
|
27
|
+
}
|
|
28
|
+
function readSourceSnippet(rootDir, sourcePath) {
|
|
29
|
+
if (!sourcePath)
|
|
30
|
+
return undefined;
|
|
31
|
+
const safeRel = path.normalize(sourcePath).replace(/^([/\\])+/, "");
|
|
32
|
+
if (safeRel.startsWith("..") || path.isAbsolute(safeRel))
|
|
33
|
+
return undefined;
|
|
34
|
+
const candidates = [
|
|
35
|
+
path.join(rootDir, safeRel),
|
|
36
|
+
path.join(import.meta.dirname, "sources", safeRel),
|
|
37
|
+
path.resolve(import.meta.dirname, "../dist/sources", safeRel),
|
|
38
|
+
];
|
|
39
|
+
for (const candidate of candidates) {
|
|
40
|
+
if (fs.existsSync(candidate)) {
|
|
41
|
+
return fs.readFileSync(candidate, "utf8");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
function toolJsonResult(payload, resourceLinks = []) {
|
|
47
|
+
const content = [
|
|
48
|
+
{
|
|
49
|
+
type: "text",
|
|
50
|
+
text: JSON.stringify(payload, null, 2),
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
for (const link of resourceLinks) {
|
|
54
|
+
content.push({
|
|
55
|
+
type: "resource_link",
|
|
56
|
+
uri: link.uri,
|
|
57
|
+
name: link.name,
|
|
58
|
+
mimeType: link.mimeType ?? "application/json",
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
content,
|
|
63
|
+
structuredContent: payload,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function formatGuidelinesMarkdown(register) {
|
|
67
|
+
const matched = register === "all"
|
|
68
|
+
? registry.guidelines
|
|
69
|
+
: registry.guidelines.filter((g) => g.register === register || g.register === "shared");
|
|
70
|
+
return matched
|
|
71
|
+
.map((g) => [
|
|
72
|
+
`# ${g.title} [${g.status.toUpperCase()} · v${g.sinceVersion}]`,
|
|
73
|
+
"",
|
|
74
|
+
g.summary,
|
|
75
|
+
"",
|
|
76
|
+
"## Rules",
|
|
77
|
+
...g.rules.map((r) => `- ${r}`),
|
|
78
|
+
"",
|
|
79
|
+
"## Do",
|
|
80
|
+
...g.doItems.map((d) => `- ${d}`),
|
|
81
|
+
"",
|
|
82
|
+
"## Don't",
|
|
83
|
+
...g.dontItems.map((d) => `- ${d}`),
|
|
84
|
+
].join("\n"))
|
|
85
|
+
.join("\n\n---\n\n");
|
|
86
|
+
}
|
|
87
|
+
export function createMillarMcpServer(options = {}) {
|
|
88
|
+
const rootDir = options.rootDir ?? path.resolve(import.meta.dirname, "../../..");
|
|
89
|
+
const skills = loadMillarSkills(rootDir);
|
|
90
|
+
const server = new McpServer({
|
|
91
|
+
name: "millar-mcp",
|
|
92
|
+
version: registry.version,
|
|
93
|
+
}, {
|
|
94
|
+
capabilities: {
|
|
95
|
+
resources: {},
|
|
96
|
+
tools: {},
|
|
97
|
+
prompts: {},
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
/* ==========================================================================
|
|
101
|
+
* 1. MCP RESOURCES (millar:// RFC 3986 URIs & RFC 6570 Templates)
|
|
102
|
+
* ========================================================================== */
|
|
103
|
+
const invariantsMarkdown = [
|
|
104
|
+
"# Millar Non-Negotiable Invariants",
|
|
105
|
+
"",
|
|
106
|
+
`- **Typography**: ${registry.invariants.typography}`,
|
|
107
|
+
`- **Product & Foundation Gradients**: ${registry.invariants.gradientPolicy.productAndFoundations}`,
|
|
108
|
+
`- **Marketing Gradients**: ${registry.invariants.gradientPolicy.marketing}`,
|
|
109
|
+
`- **Zero Em-Dash (U+2014) Scope**: ${registry.invariants.zeroEmDashScope}`,
|
|
110
|
+
`- **Accessibility Target**: ${registry.invariants.accessibilityTarget}`,
|
|
111
|
+
`- **Governance Lifecycle Rule**: ${registry.invariants.lifecycleRule}`,
|
|
112
|
+
].join("\n");
|
|
113
|
+
server.registerResource("millar-invariants", "millar://guidelines/invariants", {
|
|
114
|
+
title: "Millar Non-Negotiable Invariants",
|
|
115
|
+
description: "Core design system invariants, gradient boundaries, em-dash scope, WCAG target, and Draft/Approved governance rules.",
|
|
116
|
+
mimeType: "text/markdown",
|
|
117
|
+
}, async (uri) => ({
|
|
118
|
+
contents: [{ uri: uri.href, mimeType: "text/markdown", text: invariantsMarkdown }],
|
|
119
|
+
}));
|
|
120
|
+
server.registerResource("millar-guidelines-by-register", new ResourceTemplate("millar://guidelines/{register}", {
|
|
121
|
+
list: async () => ({
|
|
122
|
+
resources: [
|
|
123
|
+
{ uri: "millar://guidelines/shared", name: "Shared Foundations Guidelines", mimeType: "text/markdown" },
|
|
124
|
+
{ uri: "millar://guidelines/marketing", name: "Marketing Design Guidelines", mimeType: "text/markdown" },
|
|
125
|
+
{ uri: "millar://guidelines/product", name: "Product/App Design Guidelines", mimeType: "text/markdown" },
|
|
126
|
+
],
|
|
127
|
+
}),
|
|
128
|
+
}), {
|
|
129
|
+
title: "Millar Register Guidelines",
|
|
130
|
+
description: "Design rules and Do/Don't guidelines for shared, marketing, or product registers.",
|
|
131
|
+
mimeType: "text/markdown",
|
|
132
|
+
}, async (uri, vars) => {
|
|
133
|
+
const register = String(vars.register ?? "");
|
|
134
|
+
if (!["shared", "marketing", "product"].includes(register)) {
|
|
135
|
+
throw new McpError(ErrorCode.InvalidParams, `Unknown Millar register "${register}". Expected shared, marketing, or product.`);
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
contents: [{ uri: uri.href, mimeType: "text/markdown", text: formatGuidelinesMarkdown(register) }],
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
server.registerResource("millar-brand-identity", "millar://brand/identity", {
|
|
142
|
+
title: "Hahlex Brand Identity & Vector Marks",
|
|
143
|
+
description: "Canonical Title Case Geist 600 wordmark spec and all 4 normalized Arch + 3 Pillars Vector SVG marks.",
|
|
144
|
+
mimeType: "application/json",
|
|
145
|
+
}, async (uri) => ({
|
|
146
|
+
contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(registry.brand, null, 2) }],
|
|
147
|
+
}));
|
|
148
|
+
server.registerResource("millar-tokens-dtcg", "millar://tokens/dtcg", {
|
|
149
|
+
title: "Millar Raw W3C DTCG 2025.10 Tokens",
|
|
150
|
+
description: "Complete raw W3C DTCG 2025.10 token source and resolver manifest.",
|
|
151
|
+
mimeType: "application/design-tokens+json",
|
|
152
|
+
}, async (uri) => ({
|
|
153
|
+
contents: [{ uri: uri.href, mimeType: "application/design-tokens+json", text: JSON.stringify(dtcgRaw, null, 2) }],
|
|
154
|
+
}));
|
|
155
|
+
server.registerResource("millar-tokens-resolved", new ResourceTemplate("millar://tokens/resolved/{theme}", {
|
|
156
|
+
list: async () => ({
|
|
157
|
+
resources: [
|
|
158
|
+
{ uri: "millar://tokens/resolved/light", name: "Resolved Light Tokens", mimeType: "application/json" },
|
|
159
|
+
{ uri: "millar://tokens/resolved/dark", name: "Resolved Dark Tokens", mimeType: "application/json" },
|
|
160
|
+
],
|
|
161
|
+
}),
|
|
162
|
+
}), {
|
|
163
|
+
title: "Resolved Millar Tokens by Theme",
|
|
164
|
+
description: "Resolved CSS variables, hex/OKLCH values, and verified WCAG contrast checks for light or dark theme.",
|
|
165
|
+
mimeType: "application/json",
|
|
166
|
+
}, async (uri, vars) => {
|
|
167
|
+
const theme = String(vars.theme ?? "");
|
|
168
|
+
if (theme !== "light" && theme !== "dark") {
|
|
169
|
+
throw new McpError(ErrorCode.InvalidParams, `Unknown theme "${theme}". Expected "light" or "dark".`);
|
|
170
|
+
}
|
|
171
|
+
const payload = {
|
|
172
|
+
theme,
|
|
173
|
+
base: registry.tokens.base,
|
|
174
|
+
semantic: theme === "dark" ? registry.tokens.dark : registry.tokens.light,
|
|
175
|
+
localeVi: registry.tokens.localeVi,
|
|
176
|
+
};
|
|
177
|
+
return {
|
|
178
|
+
contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(payload, null, 2) }],
|
|
179
|
+
};
|
|
180
|
+
});
|
|
181
|
+
server.registerResource("millar-tokens-resolved-register", new ResourceTemplate("millar://tokens/resolved/{theme}/{register}", {
|
|
182
|
+
list: async () => ({
|
|
183
|
+
resources: [
|
|
184
|
+
{ uri: "millar://tokens/resolved/light/shared", name: "Resolved Light Tokens (Shared)", mimeType: "application/json" },
|
|
185
|
+
{ uri: "millar://tokens/resolved/dark/shared", name: "Resolved Dark Tokens (Shared)", mimeType: "application/json" },
|
|
186
|
+
{ uri: "millar://tokens/resolved/light/product", name: "Resolved Light Tokens (Product)", mimeType: "application/json" },
|
|
187
|
+
{ uri: "millar://tokens/resolved/dark/product", name: "Resolved Dark Tokens (Product)", mimeType: "application/json" },
|
|
188
|
+
{ uri: "millar://tokens/resolved/light/marketing", name: "Resolved Light Tokens (Marketing)", mimeType: "application/json" },
|
|
189
|
+
{ uri: "millar://tokens/resolved/dark/marketing", name: "Resolved Dark Tokens (Marketing)", mimeType: "application/json" },
|
|
190
|
+
],
|
|
191
|
+
}),
|
|
192
|
+
}), {
|
|
193
|
+
title: "Resolved Millar Tokens by Theme & Register",
|
|
194
|
+
description: "Resolved CSS variables, WCAG contrast checks, and register-specific overrides for light/dark + shared/product/marketing.",
|
|
195
|
+
mimeType: "application/json",
|
|
196
|
+
}, async (uri, vars) => {
|
|
197
|
+
const theme = String(vars.theme ?? "");
|
|
198
|
+
const register = String(vars.register ?? "");
|
|
199
|
+
if (theme !== "light" && theme !== "dark") {
|
|
200
|
+
throw new McpError(ErrorCode.InvalidParams, `Unknown theme "${theme}". Expected "light" or "dark".`);
|
|
201
|
+
}
|
|
202
|
+
if (register !== "shared" && register !== "product" && register !== "marketing") {
|
|
203
|
+
throw new McpError(ErrorCode.InvalidParams, `Unknown register "${register}". Expected "shared", "product", or "marketing".`);
|
|
204
|
+
}
|
|
205
|
+
const payload = {
|
|
206
|
+
theme,
|
|
207
|
+
register,
|
|
208
|
+
lifecycleStatus: "draft",
|
|
209
|
+
base: registry.tokens.base,
|
|
210
|
+
semantic: theme === "dark" ? registry.tokens.dark : registry.tokens.light,
|
|
211
|
+
registerMeta: register === "product"
|
|
212
|
+
? registry.tokens.registers.product
|
|
213
|
+
: register === "marketing"
|
|
214
|
+
? registry.tokens.registers.marketing
|
|
215
|
+
: [],
|
|
216
|
+
localeVi: registry.tokens.localeVi,
|
|
217
|
+
};
|
|
218
|
+
return {
|
|
219
|
+
contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(payload, null, 2) }],
|
|
220
|
+
};
|
|
221
|
+
});
|
|
222
|
+
server.registerResource("millar-registry-index", "millar://registry/index", {
|
|
223
|
+
title: "Millar Compact Catalog Index",
|
|
224
|
+
description: "Lightweight index of every component, composition pattern, visual asset, section, template, and motion preset with lifecycle status.",
|
|
225
|
+
mimeType: "application/json",
|
|
226
|
+
}, async (uri) => {
|
|
227
|
+
const index = {
|
|
228
|
+
version: registry.version,
|
|
229
|
+
dtcgSpecVersion: registry.dtcgSpecVersion,
|
|
230
|
+
components: registry.components.map((c) => ({ id: c.id, name: c.name, category: c.category, status: c.status, uri: `millar://components/${c.id}` })),
|
|
231
|
+
compositionPatterns: registry.compositionPatterns.map((p) => ({ id: p.id, name: p.name, status: p.status, uri: `millar://composition-patterns/${p.id}` })),
|
|
232
|
+
visualAssets: registry.visualAssets.map((v) => ({ id: v.id, name: v.name, kind: v.kind, gradientPolicy: v.gradientPolicy, status: v.status, uri: `millar://visual-assets/${v.id}` })),
|
|
233
|
+
sections: registry.sections.map((s) => ({ id: s.id, name: s.name, goal: s.goal, compositionPattern: s.compositionPattern, status: s.status, uri: `millar://sections/${s.id}` })),
|
|
234
|
+
templates: registry.templates.map((t) => ({ id: t.id, name: t.name, register: t.register, status: t.status, uri: `millar://templates/${t.id}` })),
|
|
235
|
+
motionPresets: registry.motionPresets.map((m) => ({ id: m.id, name: m.name, motionRegister: m.motionRegister, durationMs: m.durationMs, status: m.status, uri: `millar://motion-presets/${m.id}` })),
|
|
236
|
+
};
|
|
237
|
+
return {
|
|
238
|
+
contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(index, null, 2) }],
|
|
239
|
+
};
|
|
240
|
+
});
|
|
241
|
+
// Template resources for individual catalog items (return JSON-RPC -32602 on unknown ID)
|
|
242
|
+
server.registerResource("millar-component-by-id", new ResourceTemplate("millar://components/{id}", {
|
|
243
|
+
list: async () => ({
|
|
244
|
+
resources: registry.components.map((c) => ({ uri: `millar://components/${c.id}`, name: c.name, mimeType: "application/json" })),
|
|
245
|
+
}),
|
|
246
|
+
}), { title: "Millar Component Spec", description: "Individual Product/Shared UI component specification.", mimeType: "application/json" }, async (uri, vars) => {
|
|
247
|
+
const id = String(vars.id ?? "");
|
|
248
|
+
const found = registry.components.find((c) => c.id === id);
|
|
249
|
+
if (!found)
|
|
250
|
+
throw new McpError(ErrorCode.InvalidParams, `Component "${id}" not found in Millar registry.`);
|
|
251
|
+
return { contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(found, null, 2) }] };
|
|
252
|
+
});
|
|
253
|
+
server.registerResource("millar-composition-pattern-by-id", new ResourceTemplate("millar://composition-patterns/{id}", {
|
|
254
|
+
list: async () => ({
|
|
255
|
+
resources: registry.compositionPatterns.map((p) => ({ uri: `millar://composition-patterns/${p.id}`, name: p.name, mimeType: "application/json" })),
|
|
256
|
+
}),
|
|
257
|
+
}), { title: "Millar Marketing Composition Pattern", description: "Individual Marketing composition pattern.", mimeType: "application/json" }, async (uri, vars) => {
|
|
258
|
+
const id = String(vars.id ?? "");
|
|
259
|
+
const found = registry.compositionPatterns.find((p) => p.id === id);
|
|
260
|
+
if (!found)
|
|
261
|
+
throw new McpError(ErrorCode.InvalidParams, `Composition pattern "${id}" not found.`);
|
|
262
|
+
return { contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(found, null, 2) }] };
|
|
263
|
+
});
|
|
264
|
+
server.registerResource("millar-visual-asset-by-id", new ResourceTemplate("millar://visual-assets/{id}", {
|
|
265
|
+
list: async () => ({
|
|
266
|
+
resources: registry.visualAssets.map((v) => ({ uri: `millar://visual-assets/${v.id}`, name: v.name, mimeType: "application/json" })),
|
|
267
|
+
}),
|
|
268
|
+
}), { title: "Millar Code-Native Visual Asset", description: "Individual CSS/SVG/Canvas/React visual asset specification.", mimeType: "application/json" }, async (uri, vars) => {
|
|
269
|
+
const id = String(vars.id ?? "");
|
|
270
|
+
const found = registry.visualAssets.find((v) => v.id === id);
|
|
271
|
+
if (!found)
|
|
272
|
+
throw new McpError(ErrorCode.InvalidParams, `Visual asset "${id}" not found.`);
|
|
273
|
+
return { contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(found, null, 2) }] };
|
|
274
|
+
});
|
|
275
|
+
server.registerResource("millar-section-by-id", new ResourceTemplate("millar://sections/{id}", {
|
|
276
|
+
list: async () => ({
|
|
277
|
+
resources: registry.sections.map((s) => ({ uri: `millar://sections/${s.id}`, name: s.name, mimeType: "application/json" })),
|
|
278
|
+
}),
|
|
279
|
+
}), { title: "Millar Marketing Section Spec", description: "Individual photo-free Marketing section specification.", mimeType: "application/json" }, async (uri, vars) => {
|
|
280
|
+
const id = String(vars.id ?? "");
|
|
281
|
+
const found = registry.sections.find((s) => s.id === id);
|
|
282
|
+
if (!found)
|
|
283
|
+
throw new McpError(ErrorCode.InvalidParams, `Section "${id}" not found.`);
|
|
284
|
+
return { contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(found, null, 2) }] };
|
|
285
|
+
});
|
|
286
|
+
server.registerResource("millar-template-by-id", new ResourceTemplate("millar://templates/{id}", {
|
|
287
|
+
list: async () => ({
|
|
288
|
+
resources: registry.templates.map((t) => ({ uri: `millar://templates/${t.id}`, name: t.name, mimeType: "application/json" })),
|
|
289
|
+
}),
|
|
290
|
+
}), { title: "Millar Page/Application Template Spec", description: "Individual Marketing or Product template specification.", mimeType: "application/json" }, async (uri, vars) => {
|
|
291
|
+
const id = String(vars.id ?? "");
|
|
292
|
+
const found = registry.templates.find((t) => t.id === id);
|
|
293
|
+
if (!found)
|
|
294
|
+
throw new McpError(ErrorCode.InvalidParams, `Template "${id}" not found.`);
|
|
295
|
+
return { contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(found, null, 2) }] };
|
|
296
|
+
});
|
|
297
|
+
server.registerResource("millar-motion-preset-by-id", new ResourceTemplate("millar://motion-presets/{id}", {
|
|
298
|
+
list: async () => ({
|
|
299
|
+
resources: registry.motionPresets.map((m) => ({ uri: `millar://motion-presets/${m.id}`, name: m.name, mimeType: "application/json" })),
|
|
300
|
+
}),
|
|
301
|
+
}), { title: "Millar Motion Preset", description: "Productive or Expressive motion preset with reduced-motion contract.", mimeType: "application/json" }, async (uri, vars) => {
|
|
302
|
+
const id = String(vars.id ?? "");
|
|
303
|
+
const found = registry.motionPresets.find((m) => m.id === id);
|
|
304
|
+
if (!found)
|
|
305
|
+
throw new McpError(ErrorCode.InvalidParams, `Motion preset "${id}" not found.`);
|
|
306
|
+
return { contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(found, null, 2) }] };
|
|
307
|
+
});
|
|
308
|
+
server.registerResource("millar-glossary", "millar://glossary", { title: "Millar Canonical Domain Glossary", description: "Canonical Millar terminology (GLOSSARY.md).", mimeType: "text/markdown" }, async (uri) => ({
|
|
309
|
+
contents: [{ uri: uri.href, mimeType: "text/markdown", text: readRepoDoc(rootDir, "GLOSSARY.md", "# Millar Glossary\n") }],
|
|
310
|
+
}));
|
|
311
|
+
server.registerResource("millar-changelog", "millar://changelog", { title: "Millar Changelog", description: "Semantic versioning changelog and deprecation runway log.", mimeType: "text/markdown" }, async (uri) => ({
|
|
312
|
+
contents: [{ uri: uri.href, mimeType: "text/markdown", text: readRepoDoc(rootDir, "CHANGELOG.md", "# Changelog\n") }],
|
|
313
|
+
}));
|
|
314
|
+
server.registerResource("millar-skills-index", "millar://skills", {
|
|
315
|
+
title: "Millar Agent Skills Suite Index",
|
|
316
|
+
description: "Catalog of all 7 composable Millar web & design agent skills (millar-web-workflow, millar-deep-research, millar-design, millar-create-image, millar-animation, millar-build-web, millar-verify-web) with 17 progressive-disclosure references and standalone Zero-MCP audit CLI.",
|
|
317
|
+
mimeType: "application/json",
|
|
318
|
+
}, async (uri) => ({
|
|
319
|
+
contents: [
|
|
320
|
+
{
|
|
321
|
+
uri: uri.href,
|
|
322
|
+
mimeType: "application/json",
|
|
323
|
+
text: JSON.stringify({
|
|
324
|
+
lifecycleStatus: "draft",
|
|
325
|
+
installCommand: "npx millar install",
|
|
326
|
+
skills: skills.map((s) => ({
|
|
327
|
+
id: s.id,
|
|
328
|
+
name: s.name,
|
|
329
|
+
version: s.version,
|
|
330
|
+
description: s.description,
|
|
331
|
+
solves: s.solves,
|
|
332
|
+
roleLens: s.roleLens,
|
|
333
|
+
recommendedWith: s.recommendedWith,
|
|
334
|
+
mcpToolsUsed: s.mcpToolsUsed,
|
|
335
|
+
uri: s.uri,
|
|
336
|
+
references: s.references.map((r) => ({ file: r.file, title: r.title, uri: r.uri })),
|
|
337
|
+
})),
|
|
338
|
+
recipes: SKILL_COMBINATION_RECIPES,
|
|
339
|
+
}, null, 2),
|
|
340
|
+
},
|
|
341
|
+
],
|
|
342
|
+
}));
|
|
343
|
+
server.registerResource("millar-skill-by-name", new ResourceTemplate("millar://skills/{name}", {
|
|
344
|
+
list: async () => ({
|
|
345
|
+
resources: skills.map((s) => ({
|
|
346
|
+
uri: s.uri,
|
|
347
|
+
name: `Skill: ${s.name}`,
|
|
348
|
+
mimeType: "text/markdown",
|
|
349
|
+
})),
|
|
350
|
+
}),
|
|
351
|
+
}), {
|
|
352
|
+
title: "Millar Agent Skill Definition (SKILL.md)",
|
|
353
|
+
description: "Full SKILL.md playbook for millar-web-workflow, millar-deep-research, millar-design, millar-create-image, millar-animation, millar-build-web, or millar-verify-web.",
|
|
354
|
+
mimeType: "text/markdown",
|
|
355
|
+
}, async (uri, vars) => {
|
|
356
|
+
const name = String(vars.name ?? "");
|
|
357
|
+
const found = skills.find((s) => s.id === name);
|
|
358
|
+
if (!found) {
|
|
359
|
+
throw new McpError(ErrorCode.InvalidParams, `Unknown Millar skill "${name}". Expected one of: ${skills.map((s) => s.id).join(", ")}.`);
|
|
360
|
+
}
|
|
361
|
+
return { contents: [{ uri: uri.href, mimeType: "text/markdown", text: found.skillMarkdown }] };
|
|
362
|
+
});
|
|
363
|
+
server.registerResource("millar-skill-reference", new ResourceTemplate("millar://skills/{name}/references/{ref}", {
|
|
364
|
+
list: async () => ({
|
|
365
|
+
resources: skills.flatMap((s) => s.references.map((r) => ({
|
|
366
|
+
uri: r.uri,
|
|
367
|
+
name: `${s.name} / ${r.title}`,
|
|
368
|
+
mimeType: "text/markdown",
|
|
369
|
+
}))),
|
|
370
|
+
}),
|
|
371
|
+
}), {
|
|
372
|
+
title: "Millar Agent Skill Reference Playbook",
|
|
373
|
+
description: "Progressive-disclosure reference document bundled inside a Millar skill.",
|
|
374
|
+
mimeType: "text/markdown",
|
|
375
|
+
}, async (uri, vars) => {
|
|
376
|
+
const name = String(vars.name ?? "");
|
|
377
|
+
const ref = String(vars.ref ?? "");
|
|
378
|
+
const skill = skills.find((s) => s.id === name);
|
|
379
|
+
if (!skill) {
|
|
380
|
+
throw new McpError(ErrorCode.InvalidParams, `Unknown Millar skill "${name}".`);
|
|
381
|
+
}
|
|
382
|
+
const foundRef = skill.references.find((r) => r.file === ref || r.file === `${ref}.md`);
|
|
383
|
+
if (!foundRef) {
|
|
384
|
+
throw new McpError(ErrorCode.InvalidParams, `Reference "${ref}" not found in skill "${name}". Available: ${skill.references.map((r) => r.file).join(", ")}.`);
|
|
385
|
+
}
|
|
386
|
+
return { contents: [{ uri: uri.href, mimeType: "text/markdown", text: foundRef.content }] };
|
|
387
|
+
});
|
|
388
|
+
/* ==========================================================================
|
|
389
|
+
* 2. ALL 13 DEDICATED MCP TOOLS (Read-Only, Idempotent, Cross-Client Schemas)
|
|
390
|
+
* ========================================================================== */
|
|
391
|
+
// Tool 1: get_design_guidelines
|
|
392
|
+
server.registerTool("get_design_guidelines", {
|
|
393
|
+
title: "Get Millar Design Guidelines",
|
|
394
|
+
description: "Retrieve Millar brand principles, invariants, composition patterns, and register-specific rules (shared, marketing, or product).",
|
|
395
|
+
inputSchema: {
|
|
396
|
+
register: z.enum(["shared", "marketing", "product", "all"]).optional().describe("Target register (defaults to 'all')."),
|
|
397
|
+
topic: z.string().optional().describe("Optional keyword filter (e.g. 'typography', 'art-direction', 'components', 'principles')."),
|
|
398
|
+
includeCompositionPatterns: z.boolean().optional().describe("Include the 6 diverse Marketing Composition Patterns summary."),
|
|
399
|
+
},
|
|
400
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
401
|
+
}, async ({ register = "all", topic, includeCompositionPatterns = true }) => {
|
|
402
|
+
const q = topic?.trim().toLowerCase();
|
|
403
|
+
const guidelines = registry.guidelines.filter((g) => {
|
|
404
|
+
const regOk = register === "all" || g.register === register || g.register === "shared";
|
|
405
|
+
const topicOk = !q || g.topic.toLowerCase().includes(q) || g.title.toLowerCase().includes(q) || g.summary.toLowerCase().includes(q);
|
|
406
|
+
return regOk && topicOk;
|
|
407
|
+
});
|
|
408
|
+
const payload = {
|
|
409
|
+
version: registry.version,
|
|
410
|
+
invariants: registry.invariants,
|
|
411
|
+
guidelines,
|
|
412
|
+
};
|
|
413
|
+
if (includeCompositionPatterns && (register === "all" || register === "marketing")) {
|
|
414
|
+
payload.compositionPatterns = registry.compositionPatterns.map((p) => ({
|
|
415
|
+
id: p.id,
|
|
416
|
+
name: p.name,
|
|
417
|
+
status: p.status,
|
|
418
|
+
summary: p.summary,
|
|
419
|
+
bestFor: p.bestFor,
|
|
420
|
+
}));
|
|
421
|
+
}
|
|
422
|
+
const links = [
|
|
423
|
+
{ uri: "millar://guidelines/invariants", name: "Millar Invariants", mimeType: "text/markdown" },
|
|
424
|
+
...(register !== "all"
|
|
425
|
+
? [{ uri: `millar://guidelines/${register}`, name: `${register} guidelines`, mimeType: "text/markdown" }]
|
|
426
|
+
: []),
|
|
427
|
+
];
|
|
428
|
+
return toolJsonResult(payload, links);
|
|
429
|
+
});
|
|
430
|
+
// Tool 2: get_design_tokens
|
|
431
|
+
server.registerTool("get_design_tokens", {
|
|
432
|
+
title: "Get Millar Design Tokens",
|
|
433
|
+
description: "Retrieve resolved W3C DTCG 2025.10 design tokens filtered by category, theme, or search query, including WCAG contrast metadata.",
|
|
434
|
+
inputSchema: {
|
|
435
|
+
theme: z.enum(["light", "dark", "all"]).optional().describe("Theme polarity (defaults to 'light')."),
|
|
436
|
+
category: z.enum(["color", "typography", "spacing", "breakpoint", "radius", "zIndex", "motion", "shadow", "all"]).optional().describe("Token category filter."),
|
|
437
|
+
query: z.string().optional().describe("Optional substring match on CSS var, path, or description."),
|
|
438
|
+
includeEducationExtension: z.boolean().optional().describe("Include optional @hahlex/millar-domain-education skill tokens."),
|
|
439
|
+
},
|
|
440
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
441
|
+
}, async ({ theme = "light", category = "all", query, includeEducationExtension = false }) => {
|
|
442
|
+
const q = query?.trim().toLowerCase();
|
|
443
|
+
const filterList = (list) => list.filter((t) => {
|
|
444
|
+
const catOk = category === "all" || t.category === category;
|
|
445
|
+
const qOk = !q || t.cssVar.toLowerCase().includes(q) || t.path.toLowerCase().includes(q) || t.description.toLowerCase().includes(q);
|
|
446
|
+
return catOk && qOk;
|
|
447
|
+
});
|
|
448
|
+
const payload = {
|
|
449
|
+
version: registry.version,
|
|
450
|
+
lifecycleStatus: "draft",
|
|
451
|
+
dtcgSpecVersion: registry.dtcgSpecVersion,
|
|
452
|
+
contrastSummary: registry.contrastSummary,
|
|
453
|
+
base: filterList(registry.tokens.base),
|
|
454
|
+
registers: registry.tokens.registers,
|
|
455
|
+
};
|
|
456
|
+
if (theme === "light" || theme === "all")
|
|
457
|
+
payload.light = filterList(registry.tokens.light);
|
|
458
|
+
if (theme === "dark" || theme === "all")
|
|
459
|
+
payload.dark = filterList(registry.tokens.dark);
|
|
460
|
+
if (category === "all" || category === "typography")
|
|
461
|
+
payload.localeVi = registry.tokens.localeVi;
|
|
462
|
+
if (includeEducationExtension)
|
|
463
|
+
payload.educationExtension = registry.tokens.educationExtension;
|
|
464
|
+
return toolJsonResult(payload, [
|
|
465
|
+
{ uri: `millar://tokens/resolved/${theme === "dark" ? "dark" : "light"}`, name: "Resolved Tokens" },
|
|
466
|
+
{ uri: "millar://tokens/dtcg", name: "Raw DTCG 2025.10 Tokens", mimeType: "application/design-tokens+json" },
|
|
467
|
+
]);
|
|
468
|
+
});
|
|
469
|
+
// Tool 3: search_components
|
|
470
|
+
server.registerTool("search_components", {
|
|
471
|
+
title: "Search Product/Shared UI Components",
|
|
472
|
+
description: "Search Millar's accessible UI component catalog with compact results (2-step progressive disclosure).",
|
|
473
|
+
inputSchema: {
|
|
474
|
+
query: z.string().optional().describe("Search term matching name, summary, or props."),
|
|
475
|
+
category: z.enum(["actions", "forms", "navigation", "data-display", "feedback", "layout", "all"]).optional().describe("Component category."),
|
|
476
|
+
status: z.enum(["draft", "approved", "deprecated", "all"]).optional().describe("Lifecycle status filter."),
|
|
477
|
+
},
|
|
478
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
479
|
+
}, async ({ query, category = "all", status = "all" }) => {
|
|
480
|
+
const q = query?.trim().toLowerCase();
|
|
481
|
+
const matches = registry.components.filter((c) => {
|
|
482
|
+
const catOk = category === "all" || c.category === category;
|
|
483
|
+
const statusOk = status === "all" || c.status === status;
|
|
484
|
+
const qOk = !q || c.id.includes(q) || c.name.toLowerCase().includes(q) || c.summary.toLowerCase().includes(q);
|
|
485
|
+
return catOk && statusOk && qOk;
|
|
486
|
+
});
|
|
487
|
+
return toolJsonResult({
|
|
488
|
+
count: matches.length,
|
|
489
|
+
components: matches.map((c) => ({
|
|
490
|
+
id: c.id,
|
|
491
|
+
name: c.name,
|
|
492
|
+
category: c.category,
|
|
493
|
+
status: c.status,
|
|
494
|
+
summary: c.summary,
|
|
495
|
+
importPath: c.importPath,
|
|
496
|
+
uri: `millar://components/${c.id}`,
|
|
497
|
+
})),
|
|
498
|
+
}, matches.slice(0, 5).map((c) => ({ uri: `millar://components/${c.id}`, name: c.name })));
|
|
499
|
+
});
|
|
500
|
+
// Tool 4: get_component
|
|
501
|
+
server.registerTool("get_component", {
|
|
502
|
+
title: "Get Component Specification & Source",
|
|
503
|
+
description: "Fetch complete props API, invalid-prop guardrails, ARIA/keyboard contract, usage guidelines, and optional source code for one component.",
|
|
504
|
+
inputSchema: {
|
|
505
|
+
id: z.string().describe("Component ID (e.g. 'button', 'input', 'choice-toggle', 'data-table', 'dialog')."),
|
|
506
|
+
includeSource: z.boolean().optional().describe("Include full React/TypeScript source implementation."),
|
|
507
|
+
},
|
|
508
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
509
|
+
}, async ({ id, includeSource = false }) => {
|
|
510
|
+
const found = registry.components.find((c) => c.id === id);
|
|
511
|
+
if (!found) {
|
|
512
|
+
throw new McpError(ErrorCode.InvalidParams, `Component "${id}" not found. Available IDs: ${registry.components.map((c) => c.id).join(", ")}`);
|
|
513
|
+
}
|
|
514
|
+
const payload = { ...found };
|
|
515
|
+
if (includeSource) {
|
|
516
|
+
payload.sourceCode = readSourceSnippet(rootDir, found.sourcePath);
|
|
517
|
+
}
|
|
518
|
+
return toolJsonResult(payload, [{ uri: `millar://components/${found.id}`, name: found.name }]);
|
|
519
|
+
});
|
|
520
|
+
// Tool 5: search_sections
|
|
521
|
+
server.registerTool("search_sections", {
|
|
522
|
+
title: "Search Photo-Free Marketing Sections",
|
|
523
|
+
description: "Search Millar's Marketing Section Library by narrative goal, composition pattern, or keyword.",
|
|
524
|
+
inputSchema: {
|
|
525
|
+
query: z.string().optional().describe("Search term matching name, summary, or assets."),
|
|
526
|
+
goal: z.enum(["hero", "proof", "features", "editorial", "product-showcase", "workflow", "architecture", "metrics", "pricing", "faq", "cta", "all"]).optional().describe("Narrative section goal."),
|
|
527
|
+
compositionPattern: z.string().optional().describe("Filter by composition pattern ID (e.g. 'editorial-split', 'spatial-product-stage', 'bento-mosaic')."),
|
|
528
|
+
},
|
|
529
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
530
|
+
}, async ({ query, goal = "all", compositionPattern }) => {
|
|
531
|
+
const q = query?.trim().toLowerCase();
|
|
532
|
+
const matches = registry.sections.filter((s) => {
|
|
533
|
+
const goalOk = goal === "all" || s.goal === goal;
|
|
534
|
+
const patOk = !compositionPattern || s.compositionPattern === compositionPattern;
|
|
535
|
+
const qOk = !q || s.id.includes(q) || s.name.toLowerCase().includes(q) || s.summary.toLowerCase().includes(q);
|
|
536
|
+
return goalOk && patOk && qOk;
|
|
537
|
+
});
|
|
538
|
+
return toolJsonResult({
|
|
539
|
+
count: matches.length,
|
|
540
|
+
sections: matches.map((s) => ({
|
|
541
|
+
id: s.id,
|
|
542
|
+
name: s.name,
|
|
543
|
+
goal: s.goal,
|
|
544
|
+
compositionPattern: s.compositionPattern,
|
|
545
|
+
photoFree: s.photoFree,
|
|
546
|
+
staticFirst: s.staticFirst,
|
|
547
|
+
status: s.status,
|
|
548
|
+
summary: s.summary,
|
|
549
|
+
uri: `millar://sections/${s.id}`,
|
|
550
|
+
})),
|
|
551
|
+
}, matches.slice(0, 5).map((s) => ({ uri: `millar://sections/${s.id}`, name: s.name })));
|
|
552
|
+
});
|
|
553
|
+
// Tool 6: get_section
|
|
554
|
+
server.registerTool("get_section", {
|
|
555
|
+
title: "Get Marketing Section Spec & Code",
|
|
556
|
+
description: "Fetch complete anatomy, paired Visual Assets, responsive rules, accessibility notes, and copyable React code for one Marketing section.",
|
|
557
|
+
inputSchema: {
|
|
558
|
+
id: z.string().describe("Section ID (e.g. 'hero-spatial-stage', 'editorial-essay-split', 'bento-narrative-mosaic')."),
|
|
559
|
+
includeSource: z.boolean().optional().describe("Include full source file."),
|
|
560
|
+
},
|
|
561
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
562
|
+
}, async ({ id, includeSource = false }) => {
|
|
563
|
+
const found = registry.sections.find((s) => s.id === id);
|
|
564
|
+
if (!found) {
|
|
565
|
+
throw new McpError(ErrorCode.InvalidParams, `Section "${id}" not found. Available IDs: ${registry.sections.map((s) => s.id).join(", ")}`);
|
|
566
|
+
}
|
|
567
|
+
const payload = { ...found };
|
|
568
|
+
if (includeSource)
|
|
569
|
+
payload.sourceCode = readSourceSnippet(rootDir, found.sourcePath);
|
|
570
|
+
return toolJsonResult(payload, [{ uri: `millar://sections/${found.id}`, name: found.name }]);
|
|
571
|
+
});
|
|
572
|
+
// Tool 7: search_templates
|
|
573
|
+
server.registerTool("search_templates", {
|
|
574
|
+
title: "Search Marketing & Product Templates",
|
|
575
|
+
description: "Search complete multi-section Marketing Page Templates and Product Application Templates.",
|
|
576
|
+
inputSchema: {
|
|
577
|
+
query: z.string().optional().describe("Search term."),
|
|
578
|
+
register: z.enum(["marketing", "product", "all"]).optional().describe("Filter by marketing or product register."),
|
|
579
|
+
},
|
|
580
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
581
|
+
}, async ({ query, register = "all" }) => {
|
|
582
|
+
const q = query?.trim().toLowerCase();
|
|
583
|
+
const matches = registry.templates.filter((t) => {
|
|
584
|
+
const regOk = register === "all" || t.register === register;
|
|
585
|
+
const qOk = !q || t.id.includes(q) || t.name.toLowerCase().includes(q) || t.summary.toLowerCase().includes(q);
|
|
586
|
+
return regOk && qOk;
|
|
587
|
+
});
|
|
588
|
+
return toolJsonResult({
|
|
589
|
+
count: matches.length,
|
|
590
|
+
templates: matches.map((t) => ({
|
|
591
|
+
id: t.id,
|
|
592
|
+
name: t.name,
|
|
593
|
+
register: t.register,
|
|
594
|
+
compositionPatternsUsed: t.compositionPatternsUsed,
|
|
595
|
+
status: t.status,
|
|
596
|
+
summary: t.summary,
|
|
597
|
+
uri: `millar://templates/${t.id}`,
|
|
598
|
+
})),
|
|
599
|
+
}, matches.map((t) => ({ uri: `millar://templates/${t.id}`, name: t.name })));
|
|
600
|
+
});
|
|
601
|
+
// Tool 8: get_template
|
|
602
|
+
server.registerTool("get_template", {
|
|
603
|
+
title: "Get Complete Page or Application Template",
|
|
604
|
+
description: "Fetch full section/region layout, composition patterns used, responsive behavior, and runnable code for one template.",
|
|
605
|
+
inputSchema: {
|
|
606
|
+
id: z.string().describe("Template ID (e.g. 'product-launch-template', 'directory-workspace-template')."),
|
|
607
|
+
includeSource: z.boolean().optional().describe("Include full React source."),
|
|
608
|
+
},
|
|
609
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
610
|
+
}, async ({ id, includeSource = false }) => {
|
|
611
|
+
const found = registry.templates.find((t) => t.id === id);
|
|
612
|
+
if (!found) {
|
|
613
|
+
throw new McpError(ErrorCode.InvalidParams, `Template "${id}" not found. Available IDs: ${registry.templates.map((t) => t.id).join(", ")}`);
|
|
614
|
+
}
|
|
615
|
+
const payload = { ...found };
|
|
616
|
+
if (includeSource)
|
|
617
|
+
payload.sourceCode = readSourceSnippet(rootDir, found.sourcePath);
|
|
618
|
+
return toolJsonResult(payload, [{ uri: `millar://templates/${found.id}`, name: found.name }]);
|
|
619
|
+
});
|
|
620
|
+
// Tool 9: get_visual_assets
|
|
621
|
+
server.registerTool("get_visual_assets", {
|
|
622
|
+
title: "Get Code-Native Visual Assets",
|
|
623
|
+
description: "Retrieve reusable SVG, CSS, Canvas, and React visual assets engineered for photo-free editorial quality, including gradientPolicy metadata.",
|
|
624
|
+
inputSchema: {
|
|
625
|
+
kind: z.enum(["brand", "grid", "pattern", "texture", "atmosphere", "diagram", "product-viz", "all"]).optional().describe("Visual asset category."),
|
|
626
|
+
query: z.string().optional().describe("Optional keyword filter."),
|
|
627
|
+
includeSource: z.boolean().optional().describe("Include source file content."),
|
|
628
|
+
},
|
|
629
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
630
|
+
}, async ({ kind = "all", query, includeSource = false }) => {
|
|
631
|
+
const q = query?.trim().toLowerCase();
|
|
632
|
+
const matches = registry.visualAssets.filter((v) => {
|
|
633
|
+
const kindOk = kind === "all" || v.kind === kind;
|
|
634
|
+
const qOk = !q || v.id.includes(q) || v.name.toLowerCase().includes(q) || v.summary.toLowerCase().includes(q);
|
|
635
|
+
return kindOk && qOk;
|
|
636
|
+
});
|
|
637
|
+
const assets = matches.map((v) => ({
|
|
638
|
+
...v,
|
|
639
|
+
...(includeSource ? { sourceCode: readSourceSnippet(rootDir, v.sourcePath) } : {}),
|
|
640
|
+
}));
|
|
641
|
+
return toolJsonResult({ count: assets.length, visualAssets: assets }, matches.slice(0, 5).map((v) => ({ uri: `millar://visual-assets/${v.id}`, name: v.name })));
|
|
642
|
+
});
|
|
643
|
+
// Tool 10: get_motion_presets
|
|
644
|
+
server.registerTool("get_motion_presets", {
|
|
645
|
+
title: "Get Motion Presets (Productive & Expressive)",
|
|
646
|
+
description: "Retrieve calibrated Productive (Product UI) and Expressive (Marketing) durations, cubic-bezier curves, CSS/React snippets, and mandatory reduced-motion fallbacks.",
|
|
647
|
+
inputSchema: {
|
|
648
|
+
motionRegister: z.enum(["productive", "expressive", "all"]).optional().describe("Filter by productive or expressive motion register."),
|
|
649
|
+
id: z.string().optional().describe("Optional specific preset ID."),
|
|
650
|
+
},
|
|
651
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
652
|
+
}, async ({ motionRegister = "all", id }) => {
|
|
653
|
+
const matches = registry.motionPresets.filter((m) => {
|
|
654
|
+
const regOk = motionRegister === "all" || m.motionRegister === motionRegister;
|
|
655
|
+
const idOk = !id || m.id === id;
|
|
656
|
+
return regOk && idOk;
|
|
657
|
+
});
|
|
658
|
+
return toolJsonResult({ count: matches.length, motionPresets: matches }, matches.map((m) => ({ uri: `millar://motion-presets/${m.id}`, name: m.name })));
|
|
659
|
+
});
|
|
660
|
+
// Tool 11: validate_design (Q7: Explicitly separates automated checks vs human aesthetic review!)
|
|
661
|
+
server.registerTool("validate_design", {
|
|
662
|
+
title: "Validate UI Against Millar Design System",
|
|
663
|
+
description: "Audits JSX/TSX/HTML/CSS code against verifiable Millar invariants and returns two strictly separated sections: deterministic automatedChecks (pass/fail rules) and advisory humanReviewCriteria (aesthetic/editorial judgment).",
|
|
664
|
+
inputSchema: {
|
|
665
|
+
code: z.string().describe("Source code snippet (TSX, JSX, HTML, or CSS) to audit."),
|
|
666
|
+
language: z.enum(["tsx", "jsx", "html", "css"]).optional().describe("Code language (defaults to 'tsx')."),
|
|
667
|
+
register: z.enum(["shared", "marketing", "product"]).describe("Target Millar register determining gradient & control rules."),
|
|
668
|
+
sourceKind: z
|
|
669
|
+
.enum(["hahlex-ui", "user-data", "quoted-content", "third-party"])
|
|
670
|
+
.optional()
|
|
671
|
+
.describe("Content provenance; zero em-dash applies strictly to 'hahlex-ui' and never alters user/quoted/third-party content."),
|
|
672
|
+
colorPairs: z
|
|
673
|
+
.array(z.object({
|
|
674
|
+
label: z.string().optional(),
|
|
675
|
+
fg: z.string(),
|
|
676
|
+
bg: z.string(),
|
|
677
|
+
isLargeText: z.boolean().optional(),
|
|
678
|
+
}))
|
|
679
|
+
.optional()
|
|
680
|
+
.describe("Optional explicit foreground/background hex pairs to verify mathematically against WCAG 2.1 AA."),
|
|
681
|
+
},
|
|
682
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
683
|
+
}, async (args) => {
|
|
684
|
+
const report = validateDesign(args);
|
|
685
|
+
return toolJsonResult(report, [
|
|
686
|
+
{ uri: "millar://guidelines/invariants", name: "Millar Invariants", mimeType: "text/markdown" },
|
|
687
|
+
{ uri: `millar://guidelines/${args.register}`, name: `${args.register} Guidelines`, mimeType: "text/markdown" },
|
|
688
|
+
]);
|
|
689
|
+
});
|
|
690
|
+
// Tool 12: list_skills
|
|
691
|
+
server.registerTool("list_skills", {
|
|
692
|
+
title: "List Millar Agent Skills Suite",
|
|
693
|
+
description: "Lists all 7 composable Hahlex/Millar web engineering & design skills (millar-web-workflow, millar-deep-research, millar-design, millar-create-image, millar-animation, millar-build-web, millar-verify-web), bundled reference playbooks, and Track S/M/L recipes.",
|
|
694
|
+
inputSchema: {
|
|
695
|
+
query: z.string().optional().describe("Optional search keyword (e.g. 'workflow', 'build', 'verify', 'animation', 'image', 'sync', 'research')."),
|
|
696
|
+
},
|
|
697
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
698
|
+
}, async ({ query }) => {
|
|
699
|
+
const q = query?.trim().toLowerCase();
|
|
700
|
+
const matched = skills.filter((s) => !q ||
|
|
701
|
+
s.id.toLowerCase().includes(q) ||
|
|
702
|
+
s.description.toLowerCase().includes(q) ||
|
|
703
|
+
s.solves.toLowerCase().includes(q) ||
|
|
704
|
+
s.roleLens.some((r) => r.toLowerCase().includes(q)));
|
|
705
|
+
return toolJsonResult({
|
|
706
|
+
lifecycleStatus: "draft",
|
|
707
|
+
count: matched.length,
|
|
708
|
+
installCommand: "npx millar install",
|
|
709
|
+
skills: matched.map((s) => ({
|
|
710
|
+
id: s.id,
|
|
711
|
+
name: s.name,
|
|
712
|
+
version: s.version,
|
|
713
|
+
description: s.description,
|
|
714
|
+
solves: s.solves,
|
|
715
|
+
roleLens: s.roleLens,
|
|
716
|
+
recommendedWith: s.recommendedWith,
|
|
717
|
+
mcpToolsUsed: s.mcpToolsUsed,
|
|
718
|
+
uri: s.uri,
|
|
719
|
+
references: s.references.map((r) => ({ file: r.file, title: r.title, uri: r.uri })),
|
|
720
|
+
})),
|
|
721
|
+
recipes: SKILL_COMBINATION_RECIPES,
|
|
722
|
+
}, matched.map((s) => ({ uri: s.uri, name: `Skill: ${s.name}`, mimeType: "text/markdown" })));
|
|
723
|
+
});
|
|
724
|
+
// Tool 13: get_skill
|
|
725
|
+
server.registerTool("get_skill", {
|
|
726
|
+
title: "Get Millar Agent Skill Playbook & References",
|
|
727
|
+
description: "Fetches the complete SKILL.md instructions and optional progressive-disclosure reference playbooks for any of the 7 Millar skills (millar-web-workflow, millar-deep-research, millar-design, millar-create-image, millar-animation, millar-build-web, millar-verify-web).",
|
|
728
|
+
inputSchema: {
|
|
729
|
+
name: z
|
|
730
|
+
.enum([
|
|
731
|
+
"millar-web-workflow",
|
|
732
|
+
"millar-design",
|
|
733
|
+
"millar-deep-research",
|
|
734
|
+
"millar-create-image",
|
|
735
|
+
"millar-animation",
|
|
736
|
+
"millar-build-web",
|
|
737
|
+
"millar-verify-web",
|
|
738
|
+
])
|
|
739
|
+
.describe("Skill identifier to retrieve."),
|
|
740
|
+
reference: z
|
|
741
|
+
.string()
|
|
742
|
+
.optional()
|
|
743
|
+
.describe("Optional specific reference filename (e.g. 'style-dna-contract.md' or 'motion-choreography.md')."),
|
|
744
|
+
includeAllReferences: z
|
|
745
|
+
.boolean()
|
|
746
|
+
.optional()
|
|
747
|
+
.describe("Set true to inline every reference playbook bundled with this skill."),
|
|
748
|
+
},
|
|
749
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
750
|
+
}, async ({ name, reference, includeAllReferences }) => {
|
|
751
|
+
const skill = skills.find((s) => s.id === name);
|
|
752
|
+
if (!skill) {
|
|
753
|
+
throw new McpError(ErrorCode.InvalidParams, `Millar skill "${name}" not found.`);
|
|
754
|
+
}
|
|
755
|
+
let selectedRefs = includeAllReferences ? skill.references : [];
|
|
756
|
+
if (reference) {
|
|
757
|
+
const hit = skill.references.find((r) => r.file === reference || r.file === `${reference}.md`);
|
|
758
|
+
if (!hit) {
|
|
759
|
+
throw new McpError(ErrorCode.InvalidParams, `Reference "${reference}" not found in "${name}". Available: ${skill.references.map((r) => r.file).join(", ")}.`);
|
|
760
|
+
}
|
|
761
|
+
selectedRefs = [hit];
|
|
762
|
+
}
|
|
763
|
+
return toolJsonResult({
|
|
764
|
+
lifecycleStatus: "draft",
|
|
765
|
+
id: skill.id,
|
|
766
|
+
name: skill.name,
|
|
767
|
+
version: skill.version,
|
|
768
|
+
description: skill.description,
|
|
769
|
+
solves: skill.solves,
|
|
770
|
+
roleLens: skill.roleLens,
|
|
771
|
+
recommendedWith: skill.recommendedWith,
|
|
772
|
+
mcpToolsUsed: skill.mcpToolsUsed,
|
|
773
|
+
uri: skill.uri,
|
|
774
|
+
skillMarkdown: skill.skillMarkdown,
|
|
775
|
+
availableReferences: skill.references.map((r) => ({ file: r.file, title: r.title, uri: r.uri })),
|
|
776
|
+
includedReferences: selectedRefs.map((r) => ({ file: r.file, title: r.title, uri: r.uri, content: r.content })),
|
|
777
|
+
}, [
|
|
778
|
+
{ uri: skill.uri, name: `Skill: ${skill.name}`, mimeType: "text/markdown" },
|
|
779
|
+
...skill.references.map((r) => ({ uri: r.uri, name: r.title, mimeType: "text/markdown" })),
|
|
780
|
+
]);
|
|
781
|
+
});
|
|
782
|
+
/* ==========================================================================
|
|
783
|
+
* 3. TEN USER-CONTROLLED MCP PROMPTS (English Prompts · 3 Core + 7 Skills)
|
|
784
|
+
* ========================================================================== */
|
|
785
|
+
const langArg = z
|
|
786
|
+
.enum(["vi", "en"])
|
|
787
|
+
.optional()
|
|
788
|
+
.describe("Optional output locale for user-facing explanations & visible UI/artwork copy ('en' default, 'vi' for Vietnamese). All agent and image-generation prompts remain in crisp English.");
|
|
789
|
+
const localeLine = (lang) => lang === "vi"
|
|
790
|
+
? "Locale: Write user-facing replies and visible UI/artwork copy in Vietnamese (full UTF-8 diacritics, :lang(vi) headroom); keep ALL internal image-generation prompts, art specs, and technical briefs in English."
|
|
791
|
+
: "";
|
|
792
|
+
server.registerPrompt("millar-build-marketing", {
|
|
793
|
+
title: "Build Photo-Free Marketing Surface with Millar",
|
|
794
|
+
description: "Compose a high-craft Hahlex marketing page using diverse Composition Patterns and code-native Visual Assets, then validate via validate_design.",
|
|
795
|
+
argsSchema: {
|
|
796
|
+
feature: z.string().describe("Product, launch, or campaign topic to design."),
|
|
797
|
+
lang: langArg,
|
|
798
|
+
},
|
|
799
|
+
}, async ({ feature, lang }) => ({
|
|
800
|
+
messages: [
|
|
801
|
+
{
|
|
802
|
+
role: "user",
|
|
803
|
+
content: {
|
|
804
|
+
type: "resource",
|
|
805
|
+
resource: {
|
|
806
|
+
uri: "millar://guidelines/invariants",
|
|
807
|
+
mimeType: "text/markdown",
|
|
808
|
+
text: invariantsMarkdown,
|
|
809
|
+
},
|
|
810
|
+
},
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
role: "user",
|
|
814
|
+
content: {
|
|
815
|
+
type: "text",
|
|
816
|
+
text: [
|
|
817
|
+
`Build a photo-free Hahlex Marketing surface for: "${feature}".`,
|
|
818
|
+
"1. Query live get_design_guidelines(register='marketing', includeCompositionPatterns=true), get_design_tokens(), get_visual_assets(), and search_sections() (never hardcode tokens).",
|
|
819
|
+
"2. Combine >= 3 distinct Composition Patterns (no repeated equal 3-column card grids), static-first 0% scroll visibility, and top-level <footer> outside <main>.",
|
|
820
|
+
"3. Run validate_design(register='marketing') until automatedChecks.passed === true and report humanReviewCriteria separately.",
|
|
821
|
+
localeLine(lang),
|
|
822
|
+
]
|
|
823
|
+
.filter(Boolean)
|
|
824
|
+
.join("\n"),
|
|
825
|
+
},
|
|
826
|
+
},
|
|
827
|
+
],
|
|
828
|
+
}));
|
|
829
|
+
server.registerPrompt("millar-build-product", {
|
|
830
|
+
title: "Build Operational Product Screen with Millar",
|
|
831
|
+
description: "Implement a crisp, WCAG 2.1/2.2 AA Hahlex Product screen using zero-gradient primitives from @hahlex/millar-ui.",
|
|
832
|
+
argsSchema: {
|
|
833
|
+
screen: z.string().describe("Product screen or workflow to build."),
|
|
834
|
+
lang: langArg,
|
|
835
|
+
},
|
|
836
|
+
}, async ({ screen, lang }) => ({
|
|
837
|
+
messages: [
|
|
838
|
+
{
|
|
839
|
+
role: "user",
|
|
840
|
+
content: {
|
|
841
|
+
type: "resource",
|
|
842
|
+
resource: {
|
|
843
|
+
uri: "millar://guidelines/invariants",
|
|
844
|
+
mimeType: "text/markdown",
|
|
845
|
+
text: invariantsMarkdown,
|
|
846
|
+
},
|
|
847
|
+
},
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
role: "user",
|
|
851
|
+
content: {
|
|
852
|
+
type: "text",
|
|
853
|
+
text: [
|
|
854
|
+
`Implement the Hahlex Product screen: "${screen}".`,
|
|
855
|
+
"1. Query get_design_guidelines(register='product') and search_components() -> get_component() for exact props and invalid-prop guardrails.",
|
|
856
|
+
"2. Enforce zero CSS gradients, zero raw <button>/<input>, 2px .millar-focus rings, role='alert' errors, and --fg-on-accent-soft on --accent-soft chips.",
|
|
857
|
+
"3. Run validate_design(register='product') until automatedChecks.passed === true.",
|
|
858
|
+
localeLine(lang),
|
|
859
|
+
]
|
|
860
|
+
.filter(Boolean)
|
|
861
|
+
.join("\n"),
|
|
862
|
+
},
|
|
863
|
+
},
|
|
864
|
+
],
|
|
865
|
+
}));
|
|
866
|
+
server.registerPrompt("millar-audit-code", {
|
|
867
|
+
title: "Audit UI Code Against Millar",
|
|
868
|
+
description: "Run deterministic automated compliance checks and separate human aesthetic review criteria.",
|
|
869
|
+
argsSchema: {
|
|
870
|
+
register: z.enum(["shared", "marketing", "product"]).describe("Target Millar register."),
|
|
871
|
+
lang: langArg,
|
|
872
|
+
},
|
|
873
|
+
}, async ({ register, lang }) => ({
|
|
874
|
+
messages: [
|
|
875
|
+
{
|
|
876
|
+
role: "user",
|
|
877
|
+
content: {
|
|
878
|
+
type: "text",
|
|
879
|
+
text: [
|
|
880
|
+
`Audit the provided UI code with validate_design(register="${register}") and millar-audit.mjs.`,
|
|
881
|
+
"Report (1) deterministic automatedChecks violations with exact fixes and docUris, and (2) advisory humanReviewCriteria separately.",
|
|
882
|
+
localeLine(lang),
|
|
883
|
+
]
|
|
884
|
+
.filter(Boolean)
|
|
885
|
+
.join("\n"),
|
|
886
|
+
},
|
|
887
|
+
},
|
|
888
|
+
],
|
|
889
|
+
}));
|
|
890
|
+
const embedSkillMessage = (skillId) => {
|
|
891
|
+
const found = skills.find((s) => s.id === skillId);
|
|
892
|
+
return {
|
|
893
|
+
role: "user",
|
|
894
|
+
content: {
|
|
895
|
+
type: "resource",
|
|
896
|
+
resource: {
|
|
897
|
+
uri: found?.uri ?? `millar://skills/${skillId}`,
|
|
898
|
+
mimeType: "text/markdown",
|
|
899
|
+
text: found?.skillMarkdown ?? `# ${skillId}\n`,
|
|
900
|
+
},
|
|
901
|
+
},
|
|
902
|
+
};
|
|
903
|
+
};
|
|
904
|
+
server.registerPrompt("millar-design", {
|
|
905
|
+
title: "Millar Design Director & Cross-Page Continuity",
|
|
906
|
+
description: "Activates millar-design v0.3 (5-role studio, Brand-First Research, Impeccable craft floor, 12-axis .millar/style-dna.md) to keep secondary pages visually cohesive.",
|
|
907
|
+
argsSchema: {
|
|
908
|
+
brief: z.string().describe("Website, app, or multi-page redesign brief."),
|
|
909
|
+
existingAssets: z
|
|
910
|
+
.string()
|
|
911
|
+
.optional()
|
|
912
|
+
.describe("Optional paths or notes describing user-supplied images, animations, or an existing hero page to sync."),
|
|
913
|
+
lang: langArg,
|
|
914
|
+
},
|
|
915
|
+
}, async ({ brief, existingAssets, lang }) => ({
|
|
916
|
+
messages: [
|
|
917
|
+
{
|
|
918
|
+
role: "user",
|
|
919
|
+
content: {
|
|
920
|
+
type: "resource",
|
|
921
|
+
resource: { uri: "millar://guidelines/invariants", mimeType: "text/markdown", text: invariantsMarkdown },
|
|
922
|
+
},
|
|
923
|
+
},
|
|
924
|
+
embedSkillMessage("millar-design"),
|
|
925
|
+
{
|
|
926
|
+
role: "user",
|
|
927
|
+
content: {
|
|
928
|
+
type: "text",
|
|
929
|
+
text: [
|
|
930
|
+
`Execute millar-design v0.3 for: "${brief}".`,
|
|
931
|
+
existingAssets ? `User-supplied hero assets to extract & sync across ALL routes: ${existingAssets}` : "",
|
|
932
|
+
"Research any named brand first (local DESIGN.md, live MCP tokens, or web research; never hardcode another brand's palette), lock 12-axis .millar/style-dna.md, produce >= 9.2/10 visuals, and verify every secondary route >= 4/5 continuity.",
|
|
933
|
+
localeLine(lang),
|
|
934
|
+
]
|
|
935
|
+
.filter(Boolean)
|
|
936
|
+
.join("\n"),
|
|
937
|
+
},
|
|
938
|
+
},
|
|
939
|
+
],
|
|
940
|
+
}));
|
|
941
|
+
server.registerPrompt("millar-deep-research", {
|
|
942
|
+
title: "Millar Brand-First Research & Visual DNA Extraction",
|
|
943
|
+
description: "Activates millar-deep-research v0.3 to research any named brand, extract Visual/Motion DNA from supplied assets, and emit an English .millar/research-dossier.md.",
|
|
944
|
+
argsSchema: {
|
|
945
|
+
topic: z.string().describe("Brand, product, visual style, or multi-page aesthetic brief to research."),
|
|
946
|
+
existingAssets: z.string().optional().describe("Optional supplied images, animations, or reference URLs to inspect."),
|
|
947
|
+
lang: langArg,
|
|
948
|
+
},
|
|
949
|
+
}, async ({ topic, existingAssets, lang }) => ({
|
|
950
|
+
messages: [
|
|
951
|
+
embedSkillMessage("millar-deep-research"),
|
|
952
|
+
{
|
|
953
|
+
role: "user",
|
|
954
|
+
content: {
|
|
955
|
+
type: "text",
|
|
956
|
+
text: [
|
|
957
|
+
`Run millar-deep-research v0.3 for: "${topic}".`,
|
|
958
|
+
existingAssets ? `Inspect and extract Visual & Motion DNA from: ${existingAssets}` : "",
|
|
959
|
+
"Research any named brand from primary sources (local DESIGN.md, live MCP tokens, or official web references) before picking any palette or motif, then save .millar/research-dossier.md in English.",
|
|
960
|
+
localeLine(lang),
|
|
961
|
+
]
|
|
962
|
+
.filter(Boolean)
|
|
963
|
+
.join("\n"),
|
|
964
|
+
},
|
|
965
|
+
},
|
|
966
|
+
],
|
|
967
|
+
}));
|
|
968
|
+
server.registerPrompt("millar-create-image", {
|
|
969
|
+
title: "Millar Natural Art Direction, Kinetic Storytelling & Path H Compositing",
|
|
970
|
+
description: "Activates millar-create-image v0.5 (Context-Right Bright Daylight for teaching/human scenes, Kinetic Mid-Action Storytelling, Natural Hand-Drawn Editorial Illustration, Brand Motif Elevation, Organic Printed-on-Paper Path H Hybrid, and PNG tEXt provenance).",
|
|
971
|
+
argsSchema: {
|
|
972
|
+
subject: z.string().describe("Page, section, or visual asset series to produce."),
|
|
973
|
+
styleContext: z.string().optional().describe("Optional path to .millar/style-dna.md or existing hero reference image."),
|
|
974
|
+
lang: langArg,
|
|
975
|
+
},
|
|
976
|
+
}, async ({ subject, styleContext, lang }) => ({
|
|
977
|
+
messages: [
|
|
978
|
+
embedSkillMessage("millar-create-image"),
|
|
979
|
+
{
|
|
980
|
+
role: "user",
|
|
981
|
+
content: {
|
|
982
|
+
type: "text",
|
|
983
|
+
text: [
|
|
984
|
+
`Run millar-create-image v0.5 for: "${subject}".`,
|
|
985
|
+
styleContext ? `Style anchor context: ${styleContext}` : "",
|
|
986
|
+
"Enforce Context-Appropriate Natural Daylight (bright airy daylight for teaching/classrooms, zero gloomy black caverns), Kinetic Concrete Mid-Action (specific physical verb + lived-in props, zero stiff vague pointing or awkward hovering hands), Natural Hand-Drawn Linework (natural-editorial-illustration.md for illustrations, organic ink-soak letterpress Path H without pasted CSS pills/plastic spheres for countable diagrams), Brand Motif Elevation, crisp 80-135w English prompts (no raw #HEX in natural art prompts), and PNG tEXt provenance via scripts/embed-provenance.mjs.",
|
|
987
|
+
localeLine(lang),
|
|
988
|
+
]
|
|
989
|
+
.filter(Boolean)
|
|
990
|
+
.join("\n"),
|
|
991
|
+
},
|
|
992
|
+
},
|
|
993
|
+
],
|
|
994
|
+
}));
|
|
995
|
+
server.registerPrompt("millar-animation", {
|
|
996
|
+
title: "Millar Motion Research & Cross-Page Choreography",
|
|
997
|
+
description: "Activates millar-animation v0.3 to lock a 4-line Motion Thesis and ship compositor-safe, static-first, reduced-motion-compliant choreography.",
|
|
998
|
+
argsSchema: {
|
|
999
|
+
target: z.string().describe("Component, page, or multi-page flow to choreograph."),
|
|
1000
|
+
motionFeel: z.string().optional().describe("Optional motion feel or existing hero animation reference to match."),
|
|
1001
|
+
lang: langArg,
|
|
1002
|
+
},
|
|
1003
|
+
}, async ({ target, motionFeel, lang }) => ({
|
|
1004
|
+
messages: [
|
|
1005
|
+
embedSkillMessage("millar-animation"),
|
|
1006
|
+
{
|
|
1007
|
+
role: "user",
|
|
1008
|
+
content: {
|
|
1009
|
+
type: "text",
|
|
1010
|
+
text: [
|
|
1011
|
+
`Run millar-animation v0.3 for: "${target}".`,
|
|
1012
|
+
motionFeel ? `Target motion feel / reference: ${motionFeel}` : "",
|
|
1013
|
+
"Query get_motion_presets() if applicable, lock a 4-line Motion Thesis, ship GPU compositor animations with static-first visibility and prefers-reduced-motion in the same edit, and verify both modes.",
|
|
1014
|
+
localeLine(lang),
|
|
1015
|
+
]
|
|
1016
|
+
.filter(Boolean)
|
|
1017
|
+
.join("\n"),
|
|
1018
|
+
},
|
|
1019
|
+
},
|
|
1020
|
+
],
|
|
1021
|
+
}));
|
|
1022
|
+
server.registerPrompt("millar-web-workflow", {
|
|
1023
|
+
title: "Millar End-to-End Web Engineering & Creative Workflow",
|
|
1024
|
+
description: "Activates millar-web-workflow v0.3 to run Brand-First Research, classify Track S/M/L, run Creative Divergence, orchestrate all 7 skills, and gate on independent verification.",
|
|
1025
|
+
argsSchema: {
|
|
1026
|
+
request: z.string().describe("Website, multi-page app, redesign, or UI feature request."),
|
|
1027
|
+
track: z.enum(["auto", "S", "M", "L"]).optional().describe("Optional explicit Track override (defaults to auto)."),
|
|
1028
|
+
lang: langArg,
|
|
1029
|
+
},
|
|
1030
|
+
}, async ({ request, track, lang }) => ({
|
|
1031
|
+
messages: [
|
|
1032
|
+
{
|
|
1033
|
+
role: "user",
|
|
1034
|
+
content: {
|
|
1035
|
+
type: "resource",
|
|
1036
|
+
resource: { uri: "millar://guidelines/invariants", mimeType: "text/markdown", text: invariantsMarkdown },
|
|
1037
|
+
},
|
|
1038
|
+
},
|
|
1039
|
+
embedSkillMessage("millar-web-workflow"),
|
|
1040
|
+
{
|
|
1041
|
+
role: "user",
|
|
1042
|
+
content: {
|
|
1043
|
+
type: "text",
|
|
1044
|
+
text: [
|
|
1045
|
+
`Execute millar-web-workflow v0.3 for: "${request}".`,
|
|
1046
|
+
track && track !== "auto" ? `Track override: Track ${track}.` : "Classify Track S, M, or L before editing any code.",
|
|
1047
|
+
"Research any named brand first (never hardcode another brand's tokens), run Creative Divergence on Track M/L, author all prompts in English, and gate completion on millar-verify-web (millar-audit.mjs v0.3 + Fresh-Context Independent Finish Reviewer).",
|
|
1048
|
+
localeLine(lang),
|
|
1049
|
+
]
|
|
1050
|
+
.filter(Boolean)
|
|
1051
|
+
.join("\n"),
|
|
1052
|
+
},
|
|
1053
|
+
},
|
|
1054
|
+
],
|
|
1055
|
+
}));
|
|
1056
|
+
server.registerPrompt("millar-build-web", {
|
|
1057
|
+
title: "Millar Frontend Architecture & Production Web Build",
|
|
1058
|
+
description: "Activates millar-build-web v0.3 for Server-First components, deep modules, Operate Mode hardening, 5 real interactive UI states, browser surface theming, CWV & SEO.",
|
|
1059
|
+
argsSchema: {
|
|
1060
|
+
scope: z.string().describe("Pages, components, or vertical slices to implement."),
|
|
1061
|
+
minimalChange: z
|
|
1062
|
+
.enum(["true", "false"])
|
|
1063
|
+
.optional()
|
|
1064
|
+
.describe("Set 'true' for Track S surgical fixes with zero unrelated refactors (MCP prompt arguments are strings)."),
|
|
1065
|
+
lang: langArg,
|
|
1066
|
+
},
|
|
1067
|
+
}, async ({ scope, minimalChange, lang }) => ({
|
|
1068
|
+
messages: [
|
|
1069
|
+
embedSkillMessage("millar-build-web"),
|
|
1070
|
+
{
|
|
1071
|
+
role: "user",
|
|
1072
|
+
content: {
|
|
1073
|
+
type: "text",
|
|
1074
|
+
text: [
|
|
1075
|
+
`Run millar-build-web v0.3 for: "${scope}".`,
|
|
1076
|
+
minimalChange === "true"
|
|
1077
|
+
? "Mode: Minimal-Change Track S (strictly scoped diff)."
|
|
1078
|
+
: "Mode: Vertical-Slice Build (deep modules, Server-First leaves, Operate Mode hardening, 5 UI states, browser surface theming, CWV/SEO).",
|
|
1079
|
+
"Load references via get_skill(name='millar-build-web', includeAllReferences=true) and ground tokens dynamically in .millar/style-dna.md or live MCP.",
|
|
1080
|
+
localeLine(lang),
|
|
1081
|
+
]
|
|
1082
|
+
.filter(Boolean)
|
|
1083
|
+
.join("\n"),
|
|
1084
|
+
},
|
|
1085
|
+
},
|
|
1086
|
+
],
|
|
1087
|
+
}));
|
|
1088
|
+
server.registerPrompt("millar-verify-web", {
|
|
1089
|
+
title: "Millar 5-Layer QA, Zero-MCP Audit & Independent Finish Review",
|
|
1090
|
+
description: "Activates millar-verify-web v0.3: standalone scripts/millar-audit.mjs v0.3 (SC 1.4.11 borders, view-transition-name, eyebrow-kicker), Playwright E2E, 1440/768/375 Light/Dark visual & anti-faux-3D check, axe-core WCAG AA, and fresh-context finish review.",
|
|
1091
|
+
argsSchema: {
|
|
1092
|
+
target: z.string().describe("Routes, PR diff, or website build to verify before shipping."),
|
|
1093
|
+
lang: langArg,
|
|
1094
|
+
},
|
|
1095
|
+
}, async ({ target, lang }) => ({
|
|
1096
|
+
messages: [
|
|
1097
|
+
embedSkillMessage("millar-verify-web"),
|
|
1098
|
+
{
|
|
1099
|
+
role: "user",
|
|
1100
|
+
content: {
|
|
1101
|
+
type: "text",
|
|
1102
|
+
text: [
|
|
1103
|
+
`Execute millar-verify-web v0.3 5-layer QA gate on: "${target}".`,
|
|
1104
|
+
"Run standalone scripts/millar-audit.mjs v0.3 (+ validate_design if Millar MCP is active), verify interactive Playwright flows & axe-core WCAG AA, inspect 1440/768/375 Light & Dark full-page visuals against clip-art/faux-3D/wax-skin bans, and delegate final Layer 3B + Layer 5 review to a fresh-context subagent.",
|
|
1105
|
+
localeLine(lang),
|
|
1106
|
+
]
|
|
1107
|
+
.filter(Boolean)
|
|
1108
|
+
.join("\n"),
|
|
1109
|
+
},
|
|
1110
|
+
},
|
|
1111
|
+
],
|
|
1112
|
+
}));
|
|
1113
|
+
return server;
|
|
1114
|
+
}
|
|
1115
|
+
//# sourceMappingURL=server.js.map
|