@fragments-sdk/cli 0.11.1 → 0.13.0
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/dist/ai-client-I6MDWNYA.js +21 -0
- package/dist/bin.js +419 -410
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-HRFUSSZI.js → chunk-3SOAPJDX.js} +2 -2
- package/dist/{chunk-D5PYOXEI.js → chunk-4K7EAQ5L.js} +148 -13
- package/dist/{chunk-D5PYOXEI.js.map → chunk-4K7EAQ5L.js.map} +1 -1
- package/dist/chunk-DXX6HADE.js +443 -0
- package/dist/chunk-DXX6HADE.js.map +1 -0
- package/dist/chunk-EYXVAMEX.js +626 -0
- package/dist/chunk-EYXVAMEX.js.map +1 -0
- package/dist/{chunk-ZM4ZQZWZ.js → chunk-FO6EBJWP.js} +39 -37
- package/dist/chunk-FO6EBJWP.js.map +1 -0
- package/dist/{chunk-OQO55NKV.js → chunk-QM7SVOGF.js} +120 -12
- package/dist/chunk-QM7SVOGF.js.map +1 -0
- package/dist/{chunk-5G3VZH43.js → chunk-RF3C6LGA.js} +281 -351
- package/dist/chunk-RF3C6LGA.js.map +1 -0
- package/dist/{chunk-WXSR2II7.js → chunk-SM674YAS.js} +58 -6
- package/dist/chunk-SM674YAS.js.map +1 -0
- package/dist/chunk-SXTKFDCR.js +104 -0
- package/dist/chunk-SXTKFDCR.js.map +1 -0
- package/dist/{chunk-PW7QTQA6.js → chunk-UV5JQV3R.js} +2 -2
- package/dist/core/index.js +13 -1
- package/dist/{discovery-NEOY4MPN.js → discovery-VSGC76JN.js} +3 -3
- package/dist/{generate-FBHSXR3D.js → generate-QZXOXYFW.js} +4 -4
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/init-XK6PRUE5.js +636 -0
- package/dist/init-XK6PRUE5.js.map +1 -0
- package/dist/mcp-bin.js +2 -2
- package/dist/{scan-CJF2DOQW.js → scan-CHQHXWVD.js} +6 -6
- package/dist/scan-generate-U3RFVDTX.js +1115 -0
- package/dist/scan-generate-U3RFVDTX.js.map +1 -0
- package/dist/{service-TQYWY65E.js → service-MMEKG4MZ.js} +3 -3
- package/dist/{snapshot-SV2JOFZH.js → snapshot-53TUR3HW.js} +2 -2
- package/dist/{static-viewer-NUBFPKWH.js → static-viewer-KKCR4KXR.js} +3 -3
- package/dist/static-viewer-KKCR4KXR.js.map +1 -0
- package/dist/{test-Z5LVO724.js → test-5UCKXYSC.js} +4 -4
- package/dist/{tokens-CE46OTMD.js → tokens-L46MK5AW.js} +5 -5
- package/dist/{viewer-DLLJIMCK.js → viewer-M2EQQSGE.js} +14 -14
- package/dist/viewer-M2EQQSGE.js.map +1 -0
- package/package.json +11 -9
- package/src/ai-client.ts +156 -0
- package/src/bin.ts +99 -2
- package/src/build.ts +95 -33
- package/src/commands/__tests__/drift-sync.test.ts +252 -0
- package/src/commands/__tests__/scan-generate.test.ts +497 -45
- package/src/commands/enhance.ts +11 -35
- package/src/commands/govern.ts +122 -0
- package/src/commands/init.ts +288 -260
- package/src/commands/scan-generate.ts +740 -139
- package/src/commands/scan.ts +37 -32
- package/src/commands/setup.ts +143 -52
- package/src/commands/sync.ts +357 -0
- package/src/commands/validate.ts +43 -1
- package/src/core/component-extractor.test.ts +282 -0
- package/src/core/component-extractor.ts +1030 -0
- package/src/core/discovery.ts +93 -7
- package/src/service/enhance/props-extractor.ts +235 -13
- package/src/validators.ts +236 -0
- package/src/viewer/vite-plugin.ts +1 -1
- package/dist/chunk-5G3VZH43.js.map +0 -1
- package/dist/chunk-OQO55NKV.js.map +0 -1
- package/dist/chunk-WXSR2II7.js.map +0 -1
- package/dist/chunk-ZM4ZQZWZ.js.map +0 -1
- package/dist/init-UFGK5TCN.js +0 -867
- package/dist/init-UFGK5TCN.js.map +0 -1
- package/dist/scan-generate-SJAN5MVI.js +0 -691
- package/dist/scan-generate-SJAN5MVI.js.map +0 -1
- package/dist/viewer-DLLJIMCK.js.map +0 -1
- package/src/ai.ts +0 -266
- package/src/commands/init-framework.ts +0 -414
- package/src/mcp/bin.ts +0 -36
- package/src/migrate/bin.ts +0 -114
- package/src/theme/index.ts +0 -77
- package/src/viewer/bin.ts +0 -86
- package/src/viewer/cli/health.ts +0 -256
- package/src/viewer/cli/index.ts +0 -33
- package/src/viewer/cli/scan.ts +0 -124
- package/src/viewer/cli/utils.ts +0 -174
- /package/dist/{discovery-NEOY4MPN.js.map → ai-client-I6MDWNYA.js.map} +0 -0
- /package/dist/{chunk-HRFUSSZI.js.map → chunk-3SOAPJDX.js.map} +0 -0
- /package/dist/{chunk-PW7QTQA6.js.map → chunk-UV5JQV3R.js.map} +0 -0
- /package/dist/{scan-CJF2DOQW.js.map → discovery-VSGC76JN.js.map} +0 -0
- /package/dist/{generate-FBHSXR3D.js.map → generate-QZXOXYFW.js.map} +0 -0
- /package/dist/{service-TQYWY65E.js.map → scan-CHQHXWVD.js.map} +0 -0
- /package/dist/{static-viewer-NUBFPKWH.js.map → service-MMEKG4MZ.js.map} +0 -0
- /package/dist/{snapshot-SV2JOFZH.js.map → snapshot-53TUR3HW.js.map} +0 -0
- /package/dist/{test-Z5LVO724.js.map → test-5UCKXYSC.js.map} +0 -0
- /package/dist/{tokens-CE46OTMD.js.map → tokens-L46MK5AW.js.map} +0 -0
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import { createRequire as __banner_createRequire } from 'module'; const require = __banner_createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
BRAND
|
|
4
|
+
} from "./chunk-QM7SVOGF.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/setup.ts
|
|
7
|
+
import { readFile, writeFile, access, mkdir } from "fs/promises";
|
|
8
|
+
import { join, resolve, dirname } from "path";
|
|
9
|
+
import pc from "picocolors";
|
|
10
|
+
async function fileExists(path) {
|
|
11
|
+
try {
|
|
12
|
+
await access(path);
|
|
13
|
+
return true;
|
|
14
|
+
} catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
async function detectSetupFramework(root) {
|
|
19
|
+
if (await fileExists(join(root, "app/layout.tsx")) || await fileExists(join(root, "src/app/layout.tsx"))) {
|
|
20
|
+
return "nextjs-app";
|
|
21
|
+
}
|
|
22
|
+
if (await fileExists(join(root, "pages/_app.tsx")) || await fileExists(join(root, "pages/_app.ts"))) {
|
|
23
|
+
return "nextjs-pages";
|
|
24
|
+
}
|
|
25
|
+
if (await fileExists(join(root, "next.config.ts")) || await fileExists(join(root, "next.config.js")) || await fileExists(join(root, "next.config.mjs"))) {
|
|
26
|
+
return "nextjs-app";
|
|
27
|
+
}
|
|
28
|
+
if (await fileExists(join(root, "app/root.tsx")) || await fileExists(join(root, "app/root.ts"))) {
|
|
29
|
+
return "remix";
|
|
30
|
+
}
|
|
31
|
+
if (await fileExists(join(root, "astro.config.mjs")) || await fileExists(join(root, "astro.config.ts"))) {
|
|
32
|
+
return "astro";
|
|
33
|
+
}
|
|
34
|
+
if (await fileExists(join(root, "vite.config.ts")) || await fileExists(join(root, "vite.config.js"))) {
|
|
35
|
+
return "vite";
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const pkgPath = join(root, "package.json");
|
|
39
|
+
const pkgContent = await readFile(pkgPath, "utf-8");
|
|
40
|
+
const pkg = JSON.parse(pkgContent);
|
|
41
|
+
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
42
|
+
if (allDeps["next"]) return "nextjs-app";
|
|
43
|
+
if (allDeps["@remix-run/react"]) return "remix";
|
|
44
|
+
if (allDeps["astro"]) return "astro";
|
|
45
|
+
if (allDeps["vite"]) return "vite";
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
return "unknown";
|
|
49
|
+
}
|
|
50
|
+
async function findEntryFile(root, framework) {
|
|
51
|
+
const candidates = [];
|
|
52
|
+
switch (framework) {
|
|
53
|
+
case "nextjs-app":
|
|
54
|
+
candidates.push(
|
|
55
|
+
"src/app/layout.tsx",
|
|
56
|
+
"app/layout.tsx",
|
|
57
|
+
"src/app/layout.ts",
|
|
58
|
+
"app/layout.ts"
|
|
59
|
+
);
|
|
60
|
+
break;
|
|
61
|
+
case "nextjs-pages":
|
|
62
|
+
candidates.push("pages/_app.tsx", "pages/_app.ts");
|
|
63
|
+
break;
|
|
64
|
+
case "remix":
|
|
65
|
+
candidates.push("app/root.tsx", "app/root.ts");
|
|
66
|
+
break;
|
|
67
|
+
case "astro":
|
|
68
|
+
candidates.push(
|
|
69
|
+
"src/layouts/Layout.astro",
|
|
70
|
+
"src/layouts/BaseLayout.astro",
|
|
71
|
+
"src/pages/index.astro"
|
|
72
|
+
);
|
|
73
|
+
break;
|
|
74
|
+
case "vite":
|
|
75
|
+
candidates.push(
|
|
76
|
+
"src/main.tsx",
|
|
77
|
+
"src/main.ts",
|
|
78
|
+
"src/index.tsx",
|
|
79
|
+
"src/index.ts"
|
|
80
|
+
);
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
candidates.push(
|
|
84
|
+
"src/main.tsx",
|
|
85
|
+
"src/main.ts",
|
|
86
|
+
"src/index.tsx",
|
|
87
|
+
"src/index.ts",
|
|
88
|
+
"src/App.tsx",
|
|
89
|
+
"src/App.ts"
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
for (const candidate of candidates) {
|
|
93
|
+
if (await fileExists(join(root, candidate))) {
|
|
94
|
+
return candidate;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
async function findNextConfig(root) {
|
|
100
|
+
const candidates = ["next.config.ts", "next.config.mjs", "next.config.js"];
|
|
101
|
+
for (const candidate of candidates) {
|
|
102
|
+
if (await fileExists(join(root, candidate))) {
|
|
103
|
+
return candidate;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
async function addStylesImport(root, entryFile) {
|
|
109
|
+
const fullPath = join(root, entryFile);
|
|
110
|
+
const content = await readFile(fullPath, "utf-8");
|
|
111
|
+
if (content.includes("@fragments-sdk/ui/styles")) {
|
|
112
|
+
return { modified: false, message: `Styles already imported in ${entryFile}` };
|
|
113
|
+
}
|
|
114
|
+
const stylesImport = "import '@fragments-sdk/ui/styles';";
|
|
115
|
+
let newContent;
|
|
116
|
+
if (entryFile.endsWith(".astro")) {
|
|
117
|
+
const fenceStart = content.indexOf("---");
|
|
118
|
+
if (fenceStart !== -1) {
|
|
119
|
+
const insertPos = fenceStart + 4;
|
|
120
|
+
newContent = content.slice(0, insertPos) + stylesImport + "\n" + content.slice(insertPos);
|
|
121
|
+
} else {
|
|
122
|
+
newContent = `---
|
|
123
|
+
${stylesImport}
|
|
124
|
+
---
|
|
125
|
+
${content}`;
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
const useClientMatch = content.match(/^(?:\uFEFF)?[ \t]*['"]use client['"]\s*;?[ \t]*$/m);
|
|
129
|
+
if (useClientMatch && useClientMatch.index != null) {
|
|
130
|
+
const directiveLineEnd = content.indexOf("\n", useClientMatch.index);
|
|
131
|
+
const directiveEnd = directiveLineEnd === -1 ? content.length : directiveLineEnd + 1;
|
|
132
|
+
const separator = directiveLineEnd === -1 ? "\n" : "";
|
|
133
|
+
newContent = content.slice(0, directiveEnd) + separator + stylesImport + "\n" + content.slice(directiveEnd);
|
|
134
|
+
} else {
|
|
135
|
+
newContent = stylesImport + "\n" + content;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
await writeFile(fullPath, newContent, "utf-8");
|
|
139
|
+
return { modified: true, message: `Added styles import to ${entryFile}` };
|
|
140
|
+
}
|
|
141
|
+
async function addThemeProvider(root, entryFile, framework) {
|
|
142
|
+
const fullPath = join(root, entryFile);
|
|
143
|
+
const content = await readFile(fullPath, "utf-8");
|
|
144
|
+
if (content.includes("ThemeProvider")) {
|
|
145
|
+
return { modified: false, message: `ThemeProvider already present in ${entryFile}` };
|
|
146
|
+
}
|
|
147
|
+
if (framework === "astro") {
|
|
148
|
+
return { modified: false, message: "Add ThemeProvider in your React island \u2014 see https://usefragments.com/getting-started#astro" };
|
|
149
|
+
}
|
|
150
|
+
const providerImport = "import { ThemeProvider, TooltipProvider, ToastProvider } from '@fragments-sdk/ui';";
|
|
151
|
+
let newContent = content;
|
|
152
|
+
const lines = content.split("\n");
|
|
153
|
+
let insertIdx = -1;
|
|
154
|
+
for (let i = 0; i < lines.length; i++) {
|
|
155
|
+
if (lines[i].includes("@fragments-sdk/ui/styles")) {
|
|
156
|
+
insertIdx = i;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (insertIdx === -1) {
|
|
161
|
+
for (let i = 0; i < lines.length; i++) {
|
|
162
|
+
if (lines[i].startsWith("import ") || lines[i].startsWith("import '") || lines[i].startsWith('import "')) {
|
|
163
|
+
insertIdx = i;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (insertIdx >= 0) {
|
|
168
|
+
lines.splice(insertIdx + 1, 0, providerImport);
|
|
169
|
+
newContent = lines.join("\n");
|
|
170
|
+
} else {
|
|
171
|
+
newContent = providerImport + "\n" + content;
|
|
172
|
+
}
|
|
173
|
+
await writeFile(fullPath, newContent, "utf-8");
|
|
174
|
+
if (framework === "nextjs-app") {
|
|
175
|
+
const hint = !content.includes("suppressHydrationWarning") ? `
|
|
176
|
+
Add suppressHydrationWarning to your <html> tag` : "";
|
|
177
|
+
return {
|
|
178
|
+
modified: true,
|
|
179
|
+
message: `Added provider imports to ${entryFile}. Wrap {children} with:
|
|
180
|
+
<ThemeProvider defaultMode="system"><TooltipProvider><ToastProvider>{children}</ToastProvider></TooltipProvider></ThemeProvider>${hint}`
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
if (framework === "nextjs-pages") {
|
|
184
|
+
return {
|
|
185
|
+
modified: true,
|
|
186
|
+
message: `Added provider imports to ${entryFile}. Wrap <Component {...pageProps} /> with:
|
|
187
|
+
<ThemeProvider defaultMode="system"><TooltipProvider><ToastProvider>...</ToastProvider></TooltipProvider></ThemeProvider>`
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
if (framework === "remix") {
|
|
191
|
+
return {
|
|
192
|
+
modified: true,
|
|
193
|
+
message: `Added provider imports to ${entryFile}. Wrap <Outlet /> with:
|
|
194
|
+
<ThemeProvider defaultMode="system"><TooltipProvider><ToastProvider>...</ToastProvider></TooltipProvider></ThemeProvider>`
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
modified: true,
|
|
199
|
+
message: `Added provider imports to ${entryFile}. Wrap your app root with:
|
|
200
|
+
<ThemeProvider defaultMode="system"><TooltipProvider><ToastProvider>...</ToastProvider></TooltipProvider></ThemeProvider>`
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
async function addTranspilePackages(root) {
|
|
204
|
+
const configFile = await findNextConfig(root);
|
|
205
|
+
if (!configFile) {
|
|
206
|
+
return { modified: false, message: "No next.config found" };
|
|
207
|
+
}
|
|
208
|
+
const fullPath = join(root, configFile);
|
|
209
|
+
const content = await readFile(fullPath, "utf-8");
|
|
210
|
+
if (content.includes("transpilePackages") && content.includes("@fragments-sdk/ui")) {
|
|
211
|
+
return { modified: false, message: `transpilePackages already configured in ${configFile}` };
|
|
212
|
+
}
|
|
213
|
+
if (content.includes("transpilePackages")) {
|
|
214
|
+
return {
|
|
215
|
+
modified: false,
|
|
216
|
+
message: `transpilePackages found in ${configFile} but missing '@fragments-sdk/ui'. Please add it manually.`
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
const patterns = [
|
|
220
|
+
// const nextConfig: NextConfig = { ... } (with optional type annotation)
|
|
221
|
+
{ search: /const\s+\w+\s*(?::\s*\w+)?\s*=\s*\{/, replacement: (match) => `${match}
|
|
222
|
+
transpilePackages: ['@fragments-sdk/ui'],` },
|
|
223
|
+
// module.exports = { ... }
|
|
224
|
+
{ search: /module\.exports\s*=\s*\{/, replacement: (match) => `${match}
|
|
225
|
+
transpilePackages: ['@fragments-sdk/ui'],` },
|
|
226
|
+
// export default { ... }
|
|
227
|
+
{ search: /export\s+default\s*\{/, replacement: (match) => `${match}
|
|
228
|
+
transpilePackages: ['@fragments-sdk/ui'],` }
|
|
229
|
+
];
|
|
230
|
+
for (const pattern of patterns) {
|
|
231
|
+
if (pattern.search.test(content)) {
|
|
232
|
+
const newContent = content.replace(pattern.search, pattern.replacement);
|
|
233
|
+
await writeFile(fullPath, newContent, "utf-8");
|
|
234
|
+
return { modified: true, message: `Added transpilePackages to ${configFile}` };
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
modified: false,
|
|
239
|
+
message: `Could not auto-modify ${configFile}. Add transpilePackages: ['@fragments-sdk/ui'] manually.`
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
async function createScssSeeds(root, brand) {
|
|
243
|
+
const scssLocations = [
|
|
244
|
+
"src/app/globals.scss",
|
|
245
|
+
"app/globals.scss",
|
|
246
|
+
"src/styles/globals.scss",
|
|
247
|
+
"src/globals.scss",
|
|
248
|
+
"styles/globals.scss"
|
|
249
|
+
];
|
|
250
|
+
for (const loc of scssLocations) {
|
|
251
|
+
const fullPath2 = join(root, loc);
|
|
252
|
+
if (await fileExists(fullPath2)) {
|
|
253
|
+
const content = await readFile(fullPath2, "utf-8");
|
|
254
|
+
if (content.includes("@fragments-sdk/ui/styles")) {
|
|
255
|
+
return { modified: false, message: `SCSS seeds already configured in ${loc}` };
|
|
256
|
+
}
|
|
257
|
+
const seedContent = generateScssSeedImport(brand);
|
|
258
|
+
const newContent = seedContent + "\n" + content;
|
|
259
|
+
await writeFile(fullPath2, newContent, "utf-8");
|
|
260
|
+
return { modified: true, message: `Added SCSS seed import to ${loc}` };
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const targetDir = await fileExists(join(root, "src/app")) ? "src/app" : await fileExists(join(root, "src")) ? "src/styles" : "styles";
|
|
264
|
+
const targetPath = join(targetDir, "globals.scss");
|
|
265
|
+
const fullPath = join(root, targetPath);
|
|
266
|
+
await mkdir(dirname(fullPath), { recursive: true });
|
|
267
|
+
await writeFile(fullPath, generateScssSeedImport(brand), "utf-8");
|
|
268
|
+
return { modified: true, message: `Created ${targetPath} with SCSS seed configuration` };
|
|
269
|
+
}
|
|
270
|
+
async function setupMcpConfig(root) {
|
|
271
|
+
const mcpConfigPaths = [
|
|
272
|
+
".cursor/mcp.json",
|
|
273
|
+
".vscode/mcp.json"
|
|
274
|
+
];
|
|
275
|
+
for (const configPath of mcpConfigPaths) {
|
|
276
|
+
const fullPath = join(root, configPath);
|
|
277
|
+
if (await fileExists(fullPath)) {
|
|
278
|
+
try {
|
|
279
|
+
const content = await readFile(fullPath, "utf-8");
|
|
280
|
+
const config = JSON.parse(content);
|
|
281
|
+
const servers = config.mcpServers || {};
|
|
282
|
+
const hasFragments = Object.values(servers).some((server) => {
|
|
283
|
+
const s = server;
|
|
284
|
+
return s.args?.some((arg) => arg.includes("@fragments-sdk/mcp"));
|
|
285
|
+
});
|
|
286
|
+
if (hasFragments) {
|
|
287
|
+
return { modified: false, message: `MCP server already configured in ${configPath}` };
|
|
288
|
+
}
|
|
289
|
+
servers.fragments = {
|
|
290
|
+
command: "npx",
|
|
291
|
+
args: ["@fragments-sdk/mcp"]
|
|
292
|
+
};
|
|
293
|
+
config.mcpServers = servers;
|
|
294
|
+
await writeFile(fullPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
295
|
+
return { modified: true, message: `Added Fragments MCP server to ${configPath}` };
|
|
296
|
+
} catch {
|
|
297
|
+
return { modified: false, message: `Could not parse ${configPath}` };
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
const cursorDir = join(root, ".cursor");
|
|
302
|
+
const cursorMcpPath = join(cursorDir, "mcp.json");
|
|
303
|
+
await mkdir(cursorDir, { recursive: true });
|
|
304
|
+
const mcpConfig = {
|
|
305
|
+
mcpServers: {
|
|
306
|
+
fragments: {
|
|
307
|
+
command: "npx",
|
|
308
|
+
args: ["@fragments-sdk/mcp"]
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
await writeFile(cursorMcpPath, JSON.stringify(mcpConfig, null, 2) + "\n", "utf-8");
|
|
313
|
+
return { modified: true, message: "Created .cursor/mcp.json with Fragments MCP server" };
|
|
314
|
+
}
|
|
315
|
+
function generateScssSeedImport(brand) {
|
|
316
|
+
const brandColor = brand || "#0066ff";
|
|
317
|
+
return `@use '@fragments-sdk/ui/styles' with (
|
|
318
|
+
$fui-brand: ${brandColor},
|
|
319
|
+
$fui-neutral: "stone",
|
|
320
|
+
$fui-density: "default",
|
|
321
|
+
$fui-radius-style: "rounded"
|
|
322
|
+
);
|
|
323
|
+
`;
|
|
324
|
+
}
|
|
325
|
+
async function setup(options = {}) {
|
|
326
|
+
const root = resolve(options.root ?? process.cwd());
|
|
327
|
+
const actions = [];
|
|
328
|
+
const errors = [];
|
|
329
|
+
console.log(pc.cyan(`
|
|
330
|
+
${BRAND.name} Setup
|
|
331
|
+
`));
|
|
332
|
+
const framework = await detectSetupFramework(root);
|
|
333
|
+
const frameworkLabels = {
|
|
334
|
+
"nextjs-app": "Next.js (App Router)",
|
|
335
|
+
"nextjs-pages": "Next.js (Pages Router)",
|
|
336
|
+
"vite": "Vite",
|
|
337
|
+
"remix": "Remix",
|
|
338
|
+
"astro": "Astro"
|
|
339
|
+
};
|
|
340
|
+
const frameworkLabel = frameworkLabels[framework] || "Unknown";
|
|
341
|
+
console.log(` ${pc.dim("Framework:")} ${frameworkLabel}`);
|
|
342
|
+
const entryFile = await findEntryFile(root, framework);
|
|
343
|
+
if (entryFile) {
|
|
344
|
+
console.log(` ${pc.dim("Entry:")} ${entryFile}`);
|
|
345
|
+
} else {
|
|
346
|
+
console.log(` ${pc.yellow("!")} Could not detect entry file`);
|
|
347
|
+
}
|
|
348
|
+
console.log();
|
|
349
|
+
if (entryFile) {
|
|
350
|
+
try {
|
|
351
|
+
const result = await addStylesImport(root, entryFile);
|
|
352
|
+
const icon = result.modified ? pc.green("+") : pc.dim("\xB7");
|
|
353
|
+
console.log(` ${icon} ${result.message}`);
|
|
354
|
+
if (result.modified) actions.push(result.message);
|
|
355
|
+
} catch (error) {
|
|
356
|
+
const msg = `Failed to add styles import: ${error instanceof Error ? error.message : error}`;
|
|
357
|
+
console.log(` ${pc.red("\u2717")} ${msg}`);
|
|
358
|
+
errors.push(msg);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (entryFile) {
|
|
362
|
+
try {
|
|
363
|
+
const result = await addThemeProvider(root, entryFile, framework);
|
|
364
|
+
const icon = result.modified ? pc.green("+") : pc.dim("\xB7");
|
|
365
|
+
console.log(` ${icon} ${result.message}`);
|
|
366
|
+
if (result.modified) actions.push(result.message);
|
|
367
|
+
} catch (error) {
|
|
368
|
+
const msg = `Failed to add ThemeProvider: ${error instanceof Error ? error.message : error}`;
|
|
369
|
+
console.log(` ${pc.red("\u2717")} ${msg}`);
|
|
370
|
+
errors.push(msg);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (framework === "nextjs-app" || framework === "nextjs-pages") {
|
|
374
|
+
try {
|
|
375
|
+
const result = await addTranspilePackages(root);
|
|
376
|
+
const icon = result.modified ? pc.green("+") : pc.dim("\xB7");
|
|
377
|
+
console.log(` ${icon} ${result.message}`);
|
|
378
|
+
if (result.modified) actions.push(result.message);
|
|
379
|
+
} catch (error) {
|
|
380
|
+
const msg = `Failed to update next.config: ${error instanceof Error ? error.message : error}`;
|
|
381
|
+
console.log(` ${pc.red("\u2717")} ${msg}`);
|
|
382
|
+
errors.push(msg);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
if (options.scss || options.brand) {
|
|
386
|
+
try {
|
|
387
|
+
const result = await createScssSeeds(root, options.brand);
|
|
388
|
+
const icon = result.modified ? pc.green("+") : pc.dim("\xB7");
|
|
389
|
+
console.log(` ${icon} ${result.message}`);
|
|
390
|
+
if (result.modified) actions.push(result.message);
|
|
391
|
+
} catch (error) {
|
|
392
|
+
const msg = `Failed to create SCSS seeds: ${error instanceof Error ? error.message : error}`;
|
|
393
|
+
console.log(` ${pc.red("\u2717")} ${msg}`);
|
|
394
|
+
errors.push(msg);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
if (options.mcp) {
|
|
398
|
+
try {
|
|
399
|
+
const result = await setupMcpConfig(root);
|
|
400
|
+
const icon = result.modified ? pc.green("+") : pc.dim("\xB7");
|
|
401
|
+
console.log(` ${icon} ${result.message}`);
|
|
402
|
+
if (result.modified) actions.push(result.message);
|
|
403
|
+
} catch (error) {
|
|
404
|
+
const msg = `Failed to configure MCP: ${error instanceof Error ? error.message : error}`;
|
|
405
|
+
console.log(` ${pc.red("\u2717")} ${msg}`);
|
|
406
|
+
errors.push(msg);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
console.log();
|
|
410
|
+
if (errors.length > 0) {
|
|
411
|
+
console.log(pc.red(` ${errors.length} error(s) occurred during setup`));
|
|
412
|
+
} else if (actions.length > 0) {
|
|
413
|
+
console.log(pc.green(` \u2713 Setup complete \u2014 ${actions.length} file(s) modified`));
|
|
414
|
+
} else {
|
|
415
|
+
console.log(pc.green(" \u2713 Already configured \u2014 no changes needed"));
|
|
416
|
+
}
|
|
417
|
+
console.log();
|
|
418
|
+
console.log(pc.dim(" Next steps:"));
|
|
419
|
+
if (!options.scss && !options.brand) {
|
|
420
|
+
console.log(pc.dim(" \u2022 Run with --scss to add build-time theme seeds"));
|
|
421
|
+
}
|
|
422
|
+
if (!options.mcp) {
|
|
423
|
+
console.log(pc.dim(" \u2022 Run with --mcp to configure AI tooling (MCP server)"));
|
|
424
|
+
}
|
|
425
|
+
console.log(pc.dim(" \u2022 Run `fragments doctor` to verify your setup"));
|
|
426
|
+
console.log(pc.dim(" \u2022 Visit https://usefragments.com/getting-started"));
|
|
427
|
+
console.log();
|
|
428
|
+
return {
|
|
429
|
+
success: errors.length === 0,
|
|
430
|
+
actions,
|
|
431
|
+
errors
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export {
|
|
436
|
+
detectSetupFramework,
|
|
437
|
+
findEntryFile,
|
|
438
|
+
addStylesImport,
|
|
439
|
+
addThemeProvider,
|
|
440
|
+
addTranspilePackages,
|
|
441
|
+
setup
|
|
442
|
+
};
|
|
443
|
+
//# sourceMappingURL=chunk-DXX6HADE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/setup.ts"],"sourcesContent":["/**\n * fragments setup - Configure @fragments-sdk/ui in a consumer project\n *\n * Auto-detects framework (Next.js, Vite, etc.) and scaffolds:\n * - Styles import in entry file\n * - ThemeProvider wrapper in layout/app\n * - transpilePackages for Next.js\n * - SCSS seeds file (optional)\n */\n\nimport { readFile, writeFile, access, mkdir } from 'node:fs/promises';\nimport { join, resolve, dirname } from 'node:path';\nimport pc from 'picocolors';\nimport { BRAND } from '../core/index.js';\n\n// ============================================\n// Types\n// ============================================\n\nexport interface SetupOptions {\n /** Project root directory (defaults to cwd) */\n root?: string;\n /** Skip interactive prompts */\n yes?: boolean;\n /** Brand color hex (e.g., #6366f1) */\n brand?: string;\n /** Include SCSS seed file */\n scss?: boolean;\n /** Configure MCP server for AI tooling */\n mcp?: boolean;\n}\n\nexport interface SetupResult {\n success: boolean;\n actions: string[];\n errors: string[];\n}\n\nexport type Framework = 'nextjs-app' | 'nextjs-pages' | 'vite' | 'remix' | 'astro' | 'unknown';\n\n// ============================================\n// Detection\n// ============================================\n\nexport async function fileExists(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function detectSetupFramework(root: string): Promise<Framework> {\n // Next.js App Router\n if (\n await fileExists(join(root, 'app/layout.tsx')) ||\n await fileExists(join(root, 'src/app/layout.tsx'))\n ) {\n return 'nextjs-app';\n }\n\n // Next.js Pages Router\n if (\n await fileExists(join(root, 'pages/_app.tsx')) ||\n await fileExists(join(root, 'pages/_app.ts'))\n ) {\n return 'nextjs-pages';\n }\n\n // Next.js (config exists but no router detected yet)\n if (\n await fileExists(join(root, 'next.config.ts')) ||\n await fileExists(join(root, 'next.config.js')) ||\n await fileExists(join(root, 'next.config.mjs'))\n ) {\n return 'nextjs-app';\n }\n\n // Remix\n if (\n await fileExists(join(root, 'app/root.tsx')) ||\n await fileExists(join(root, 'app/root.ts'))\n ) {\n return 'remix';\n }\n\n // Astro\n if (\n await fileExists(join(root, 'astro.config.mjs')) ||\n await fileExists(join(root, 'astro.config.ts'))\n ) {\n return 'astro';\n }\n\n // Vite (check after Remix/Astro since they also use Vite under the hood)\n if (\n await fileExists(join(root, 'vite.config.ts')) ||\n await fileExists(join(root, 'vite.config.js'))\n ) {\n return 'vite';\n }\n\n // Fallback: check package.json for framework deps\n try {\n const pkgPath = join(root, 'package.json');\n const pkgContent = await readFile(pkgPath, 'utf-8');\n const pkg = JSON.parse(pkgContent);\n const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };\n\n if (allDeps['next']) return 'nextjs-app';\n if (allDeps['@remix-run/react']) return 'remix';\n if (allDeps['astro']) return 'astro';\n if (allDeps['vite']) return 'vite';\n } catch {\n // No package.json or parse error\n }\n\n return 'unknown';\n}\n\nexport async function findEntryFile(root: string, framework: Framework): Promise<string | null> {\n const candidates: string[] = [];\n\n switch (framework) {\n case 'nextjs-app':\n candidates.push(\n 'src/app/layout.tsx', 'app/layout.tsx',\n 'src/app/layout.ts', 'app/layout.ts'\n );\n break;\n case 'nextjs-pages':\n candidates.push('pages/_app.tsx', 'pages/_app.ts');\n break;\n case 'remix':\n candidates.push('app/root.tsx', 'app/root.ts');\n break;\n case 'astro':\n candidates.push(\n 'src/layouts/Layout.astro',\n 'src/layouts/BaseLayout.astro',\n 'src/pages/index.astro'\n );\n break;\n case 'vite':\n candidates.push(\n 'src/main.tsx', 'src/main.ts',\n 'src/index.tsx', 'src/index.ts'\n );\n break;\n default:\n candidates.push(\n 'src/main.tsx', 'src/main.ts',\n 'src/index.tsx', 'src/index.ts',\n 'src/App.tsx', 'src/App.ts'\n );\n }\n\n for (const candidate of candidates) {\n if (await fileExists(join(root, candidate))) {\n return candidate;\n }\n }\n\n return null;\n}\n\nasync function findNextConfig(root: string): Promise<string | null> {\n const candidates = ['next.config.ts', 'next.config.mjs', 'next.config.js'];\n for (const candidate of candidates) {\n if (await fileExists(join(root, candidate))) {\n return candidate;\n }\n }\n return null;\n}\n\n// ============================================\n// Actions\n// ============================================\n\nexport async function addStylesImport(root: string, entryFile: string): Promise<{ modified: boolean; message: string }> {\n const fullPath = join(root, entryFile);\n const content = await readFile(fullPath, 'utf-8');\n\n if (content.includes('@fragments-sdk/ui/styles')) {\n return { modified: false, message: `Styles already imported in ${entryFile}` };\n }\n\n const stylesImport = \"import '@fragments-sdk/ui/styles';\";\n let newContent: string;\n\n // Astro files: insert inside frontmatter block (between --- fences)\n if (entryFile.endsWith('.astro')) {\n const fenceStart = content.indexOf('---');\n if (fenceStart !== -1) {\n const insertPos = fenceStart + 4; // after \"---\\n\"\n newContent = content.slice(0, insertPos) + stylesImport + '\\n' + content.slice(insertPos);\n } else {\n // No frontmatter — add one\n newContent = `---\\n${stylesImport}\\n---\\n${content}`;\n }\n } else {\n const useClientMatch = content.match(/^(?:\\uFEFF)?[ \\t]*['\"]use client['\"]\\s*;?[ \\t]*$/m);\n\n if (useClientMatch && useClientMatch.index != null) {\n const directiveLineEnd = content.indexOf('\\n', useClientMatch.index);\n const directiveEnd = directiveLineEnd === -1 ? content.length : directiveLineEnd + 1;\n const separator = directiveLineEnd === -1 ? '\\n' : '';\n newContent = content.slice(0, directiveEnd) + separator + stylesImport + '\\n' + content.slice(directiveEnd);\n } else {\n newContent = stylesImport + '\\n' + content;\n }\n }\n\n await writeFile(fullPath, newContent, 'utf-8');\n return { modified: true, message: `Added styles import to ${entryFile}` };\n}\n\nexport async function addThemeProvider(root: string, entryFile: string, framework: Framework): Promise<{ modified: boolean; message: string }> {\n const fullPath = join(root, entryFile);\n const content = await readFile(fullPath, 'utf-8');\n\n if (content.includes('ThemeProvider')) {\n return { modified: false, message: `ThemeProvider already present in ${entryFile}` };\n }\n\n // Astro uses .astro files — can't inject React imports\n if (framework === 'astro') {\n return { modified: false, message: 'Add ThemeProvider in your React island — see https://usefragments.com/getting-started#astro' };\n }\n\n // Add provider import after the last import line\n const providerImport = \"import { ThemeProvider, TooltipProvider, ToastProvider } from '@fragments-sdk/ui';\";\n\n let newContent = content;\n const lines = content.split('\\n');\n\n // Prefer placing right after the @fragments-sdk/ui/styles import if it exists\n let insertIdx = -1;\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].includes('@fragments-sdk/ui/styles')) {\n insertIdx = i;\n break;\n }\n }\n\n // Otherwise, place after the last import line\n if (insertIdx === -1) {\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].startsWith('import ') || lines[i].startsWith(\"import '\") || lines[i].startsWith('import \"')) {\n insertIdx = i;\n }\n }\n }\n\n if (insertIdx >= 0) {\n lines.splice(insertIdx + 1, 0, providerImport);\n newContent = lines.join('\\n');\n } else {\n newContent = providerImport + '\\n' + content;\n }\n\n await writeFile(fullPath, newContent, 'utf-8');\n\n // Framework-specific wrap instructions\n if (framework === 'nextjs-app') {\n const hint = !content.includes('suppressHydrationWarning')\n ? `\\n Add suppressHydrationWarning to your <html> tag`\n : '';\n return {\n modified: true,\n message: `Added provider imports to ${entryFile}. Wrap {children} with:\\n` +\n ` <ThemeProvider defaultMode=\"system\"><TooltipProvider><ToastProvider>{children}</ToastProvider></TooltipProvider></ThemeProvider>${hint}`,\n };\n }\n\n if (framework === 'nextjs-pages') {\n return {\n modified: true,\n message: `Added provider imports to ${entryFile}. Wrap <Component {...pageProps} /> with:\\n` +\n ` <ThemeProvider defaultMode=\"system\"><TooltipProvider><ToastProvider>...</ToastProvider></TooltipProvider></ThemeProvider>`,\n };\n }\n\n if (framework === 'remix') {\n return {\n modified: true,\n message: `Added provider imports to ${entryFile}. Wrap <Outlet /> with:\\n` +\n ` <ThemeProvider defaultMode=\"system\"><TooltipProvider><ToastProvider>...</ToastProvider></TooltipProvider></ThemeProvider>`,\n };\n }\n\n // Vite and unknown — generic instruction\n return {\n modified: true,\n message: `Added provider imports to ${entryFile}. Wrap your app root with:\\n` +\n ` <ThemeProvider defaultMode=\"system\"><TooltipProvider><ToastProvider>...</ToastProvider></TooltipProvider></ThemeProvider>`,\n };\n}\n\nexport async function addTranspilePackages(root: string): Promise<{ modified: boolean; message: string }> {\n const configFile = await findNextConfig(root);\n if (!configFile) {\n return { modified: false, message: 'No next.config found' };\n }\n\n const fullPath = join(root, configFile);\n const content = await readFile(fullPath, 'utf-8');\n\n if (content.includes('transpilePackages') && content.includes('@fragments-sdk/ui')) {\n return { modified: false, message: `transpilePackages already configured in ${configFile}` };\n }\n\n if (content.includes('transpilePackages')) {\n // transpilePackages exists but without @fragments-sdk/ui — need manual addition\n return {\n modified: false,\n message: `transpilePackages found in ${configFile} but missing '@fragments-sdk/ui'. Please add it manually.`,\n };\n }\n\n // Add transpilePackages to the config\n // Try to find the config object and add the property\n const patterns = [\n // const nextConfig: NextConfig = { ... } (with optional type annotation)\n { search: /const\\s+\\w+\\s*(?::\\s*\\w+)?\\s*=\\s*\\{/, replacement: (match: string) => `${match}\\n transpilePackages: ['@fragments-sdk/ui'],` },\n // module.exports = { ... }\n { search: /module\\.exports\\s*=\\s*\\{/, replacement: (match: string) => `${match}\\n transpilePackages: ['@fragments-sdk/ui'],` },\n // export default { ... }\n { search: /export\\s+default\\s*\\{/, replacement: (match: string) => `${match}\\n transpilePackages: ['@fragments-sdk/ui'],` },\n ];\n\n for (const pattern of patterns) {\n if (pattern.search.test(content)) {\n const newContent = content.replace(pattern.search, pattern.replacement);\n await writeFile(fullPath, newContent, 'utf-8');\n return { modified: true, message: `Added transpilePackages to ${configFile}` };\n }\n }\n\n return {\n modified: false,\n message: `Could not auto-modify ${configFile}. Add transpilePackages: ['@fragments-sdk/ui'] manually.`,\n };\n}\n\nasync function createScssSeeds(root: string, brand?: string): Promise<{ modified: boolean; message: string }> {\n // Try common SCSS locations\n const scssLocations = [\n 'src/app/globals.scss',\n 'app/globals.scss',\n 'src/styles/globals.scss',\n 'src/globals.scss',\n 'styles/globals.scss',\n ];\n\n // Check if any exists already\n for (const loc of scssLocations) {\n const fullPath = join(root, loc);\n if (await fileExists(fullPath)) {\n const content = await readFile(fullPath, 'utf-8');\n if (content.includes('@fragments-sdk/ui/styles')) {\n return { modified: false, message: `SCSS seeds already configured in ${loc}` };\n }\n\n // Prepend @use to existing file\n const seedContent = generateScssSeedImport(brand);\n const newContent = seedContent + '\\n' + content;\n await writeFile(fullPath, newContent, 'utf-8');\n return { modified: true, message: `Added SCSS seed import to ${loc}` };\n }\n }\n\n // Create new globals.scss in the most common location\n const targetDir = await fileExists(join(root, 'src/app'))\n ? 'src/app'\n : await fileExists(join(root, 'src'))\n ? 'src/styles'\n : 'styles';\n\n const targetPath = join(targetDir, 'globals.scss');\n const fullPath = join(root, targetPath);\n\n await mkdir(dirname(fullPath), { recursive: true });\n await writeFile(fullPath, generateScssSeedImport(brand), 'utf-8');\n return { modified: true, message: `Created ${targetPath} with SCSS seed configuration` };\n}\n\nasync function setupMcpConfig(root: string): Promise<{ modified: boolean; message: string }> {\n // Check common MCP config locations\n const mcpConfigPaths = [\n '.cursor/mcp.json',\n '.vscode/mcp.json',\n ];\n\n for (const configPath of mcpConfigPaths) {\n const fullPath = join(root, configPath);\n if (await fileExists(fullPath)) {\n try {\n const content = await readFile(fullPath, 'utf-8');\n const config = JSON.parse(content);\n const servers = config.mcpServers || {};\n\n // Check if fragments is already configured\n const hasFragments = Object.values(servers).some((server: unknown) => {\n const s = server as { command?: string; args?: string[] };\n return s.args?.some((arg: string) => arg.includes('@fragments-sdk/mcp'));\n });\n\n if (hasFragments) {\n return { modified: false, message: `MCP server already configured in ${configPath}` };\n }\n\n // Add fragments MCP server\n servers.fragments = {\n command: 'npx',\n args: ['@fragments-sdk/mcp'],\n };\n config.mcpServers = servers;\n\n await writeFile(fullPath, JSON.stringify(config, null, 2) + '\\n', 'utf-8');\n return { modified: true, message: `Added Fragments MCP server to ${configPath}` };\n } catch {\n return { modified: false, message: `Could not parse ${configPath}` };\n }\n }\n }\n\n // No existing MCP config — create one for Cursor (most common)\n const cursorDir = join(root, '.cursor');\n const cursorMcpPath = join(cursorDir, 'mcp.json');\n\n await mkdir(cursorDir, { recursive: true });\n const mcpConfig = {\n mcpServers: {\n fragments: {\n command: 'npx',\n args: ['@fragments-sdk/mcp'],\n },\n },\n };\n\n await writeFile(cursorMcpPath, JSON.stringify(mcpConfig, null, 2) + '\\n', 'utf-8');\n return { modified: true, message: 'Created .cursor/mcp.json with Fragments MCP server' };\n}\n\nfunction generateScssSeedImport(brand?: string): string {\n const brandColor = brand || '#0066ff';\n return `@use '@fragments-sdk/ui/styles' with (\n $fui-brand: ${brandColor},\n $fui-neutral: \"stone\",\n $fui-density: \"default\",\n $fui-radius-style: \"rounded\"\n);\n`;\n}\n\n// ============================================\n// Main Setup Function\n// ============================================\n\nexport async function setup(options: SetupOptions = {}): Promise<SetupResult> {\n const root = resolve(options.root ?? process.cwd());\n const actions: string[] = [];\n const errors: string[] = [];\n\n console.log(pc.cyan(`\\n${BRAND.name} Setup\\n`));\n\n // 1. Detect framework\n const framework = await detectSetupFramework(root);\n const frameworkLabels: Record<string, string> = {\n 'nextjs-app': 'Next.js (App Router)',\n 'nextjs-pages': 'Next.js (Pages Router)',\n 'vite': 'Vite',\n 'remix': 'Remix',\n 'astro': 'Astro',\n };\n const frameworkLabel = frameworkLabels[framework] || 'Unknown';\n\n console.log(` ${pc.dim('Framework:')} ${frameworkLabel}`);\n\n // 2. Find entry file\n const entryFile = await findEntryFile(root, framework);\n if (entryFile) {\n console.log(` ${pc.dim('Entry:')} ${entryFile}`);\n } else {\n console.log(` ${pc.yellow('!')} Could not detect entry file`);\n }\n console.log();\n\n // 3. Add styles import\n if (entryFile) {\n try {\n const result = await addStylesImport(root, entryFile);\n const icon = result.modified ? pc.green('+') : pc.dim('·');\n console.log(` ${icon} ${result.message}`);\n if (result.modified) actions.push(result.message);\n } catch (error) {\n const msg = `Failed to add styles import: ${error instanceof Error ? error.message : error}`;\n console.log(` ${pc.red('✗')} ${msg}`);\n errors.push(msg);\n }\n }\n\n // 4. Add ThemeProvider imports\n if (entryFile) {\n try {\n const result = await addThemeProvider(root, entryFile, framework);\n const icon = result.modified ? pc.green('+') : pc.dim('·');\n console.log(` ${icon} ${result.message}`);\n if (result.modified) actions.push(result.message);\n } catch (error) {\n const msg = `Failed to add ThemeProvider: ${error instanceof Error ? error.message : error}`;\n console.log(` ${pc.red('✗')} ${msg}`);\n errors.push(msg);\n }\n }\n\n // 5. Next.js: add transpilePackages\n if (framework === 'nextjs-app' || framework === 'nextjs-pages') {\n try {\n const result = await addTranspilePackages(root);\n const icon = result.modified ? pc.green('+') : pc.dim('·');\n console.log(` ${icon} ${result.message}`);\n if (result.modified) actions.push(result.message);\n } catch (error) {\n const msg = `Failed to update next.config: ${error instanceof Error ? error.message : error}`;\n console.log(` ${pc.red('✗')} ${msg}`);\n errors.push(msg);\n }\n }\n\n // 6. Create SCSS seeds file (if --scss flag or brand color specified)\n if (options.scss || options.brand) {\n try {\n const result = await createScssSeeds(root, options.brand);\n const icon = result.modified ? pc.green('+') : pc.dim('·');\n console.log(` ${icon} ${result.message}`);\n if (result.modified) actions.push(result.message);\n } catch (error) {\n const msg = `Failed to create SCSS seeds: ${error instanceof Error ? error.message : error}`;\n console.log(` ${pc.red('✗')} ${msg}`);\n errors.push(msg);\n }\n }\n\n // 7. Configure MCP server (if --mcp flag)\n if (options.mcp) {\n try {\n const result = await setupMcpConfig(root);\n const icon = result.modified ? pc.green('+') : pc.dim('·');\n console.log(` ${icon} ${result.message}`);\n if (result.modified) actions.push(result.message);\n } catch (error) {\n const msg = `Failed to configure MCP: ${error instanceof Error ? error.message : error}`;\n console.log(` ${pc.red('✗')} ${msg}`);\n errors.push(msg);\n }\n }\n\n // Summary\n console.log();\n if (errors.length > 0) {\n console.log(pc.red(` ${errors.length} error(s) occurred during setup`));\n } else if (actions.length > 0) {\n console.log(pc.green(` ✓ Setup complete — ${actions.length} file(s) modified`));\n } else {\n console.log(pc.green(' ✓ Already configured — no changes needed'));\n }\n\n // Next steps\n console.log();\n console.log(pc.dim(' Next steps:'));\n if (!options.scss && !options.brand) {\n console.log(pc.dim(' • Run with --scss to add build-time theme seeds'));\n }\n if (!options.mcp) {\n console.log(pc.dim(' • Run with --mcp to configure AI tooling (MCP server)'));\n }\n console.log(pc.dim(' • Run `fragments doctor` to verify your setup'));\n console.log(pc.dim(' • Visit https://usefragments.com/getting-started'));\n console.log();\n\n return {\n success: errors.length === 0,\n actions,\n errors,\n };\n}\n"],"mappings":";;;;;;AAUA,SAAS,UAAU,WAAW,QAAQ,aAAa;AACnD,SAAS,MAAM,SAAS,eAAe;AACvC,OAAO,QAAQ;AAgCf,eAAsB,WAAW,MAAgC;AAC/D,MAAI;AACF,UAAM,OAAO,IAAI;AACjB,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAsB,qBAAqB,MAAkC;AAE3E,MACE,MAAM,WAAW,KAAK,MAAM,gBAAgB,CAAC,KAC7C,MAAM,WAAW,KAAK,MAAM,oBAAoB,CAAC,GACjD;AACA,WAAO;AAAA,EACT;AAGA,MACE,MAAM,WAAW,KAAK,MAAM,gBAAgB,CAAC,KAC7C,MAAM,WAAW,KAAK,MAAM,eAAe,CAAC,GAC5C;AACA,WAAO;AAAA,EACT;AAGA,MACE,MAAM,WAAW,KAAK,MAAM,gBAAgB,CAAC,KAC7C,MAAM,WAAW,KAAK,MAAM,gBAAgB,CAAC,KAC7C,MAAM,WAAW,KAAK,MAAM,iBAAiB,CAAC,GAC9C;AACA,WAAO;AAAA,EACT;AAGA,MACE,MAAM,WAAW,KAAK,MAAM,cAAc,CAAC,KAC3C,MAAM,WAAW,K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