@fragments-sdk/cli 0.12.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/bin.js +163 -61
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-AM4MRTMN.js → chunk-3SOAPJDX.js} +2 -2
- package/dist/{chunk-LVWFOLUZ.js → chunk-4K7EAQ5L.js} +2 -2
- package/dist/{chunk-T5OMVL7E.js → chunk-DXX6HADE.js} +2 -2
- package/dist/{chunk-JJ2VRTBU.js → chunk-EYXVAMEX.js} +2 -2
- package/dist/chunk-EYXVAMEX.js.map +1 -0
- package/dist/{chunk-TPWGL2XS.js → chunk-FO6EBJWP.js} +5 -5
- package/dist/{chunk-WFS63PCW.js → chunk-QM7SVOGF.js} +36 -2
- package/dist/chunk-QM7SVOGF.js.map +1 -0
- package/dist/{chunk-GVDSFQ4E.js → chunk-RF3C6LGA.js} +6 -6
- package/dist/{chunk-OQKMEFOS.js → chunk-SM674YAS.js} +2 -2
- package/dist/{chunk-4OC7FTJB.js → chunk-UV5JQV3R.js} +2 -2
- package/dist/core/index.js +5 -1
- package/dist/{discovery-ZJQSXF56.js → discovery-VSGC76JN.js} +3 -3
- package/dist/{generate-RJFS2JWA.js → generate-QZXOXYFW.js} +4 -4
- package/dist/index.js +7 -7
- package/dist/{init-ZSX3NRCZ.js → init-XK6PRUE5.js} +5 -5
- package/dist/mcp-bin.js +2 -2
- package/dist/{scan-3PMCJ4RB.js → scan-CHQHXWVD.js} +6 -6
- package/dist/{scan-generate-SYU4PYZD.js → scan-generate-U3RFVDTX.js} +5 -5
- package/dist/{service-VMGNJZ42.js → service-MMEKG4MZ.js} +3 -3
- package/dist/{snapshot-XOISO2IS.js → snapshot-53TUR3HW.js} +2 -2
- package/dist/{static-viewer-5GXH2MGE.js → static-viewer-KKCR4KXR.js} +3 -3
- package/dist/{test-SI4NSHQX.js → test-5UCKXYSC.js} +4 -4
- package/dist/{tokens-T6SIVUT5.js → tokens-L46MK5AW.js} +5 -5
- package/dist/{viewer-7ZEAFBVN.js → viewer-M2EQQSGE.js} +14 -14
- package/dist/viewer-M2EQQSGE.js.map +1 -0
- package/package.json +11 -9
- package/src/bin.ts +55 -0
- package/src/commands/govern.ts +122 -0
- package/src/core/component-extractor.ts +1 -1
- package/src/viewer/vite-plugin.ts +1 -1
- package/dist/chunk-JJ2VRTBU.js.map +0 -1
- package/dist/chunk-WFS63PCW.js.map +0 -1
- package/dist/viewer-7ZEAFBVN.js.map +0 -1
- /package/dist/{chunk-AM4MRTMN.js.map → chunk-3SOAPJDX.js.map} +0 -0
- /package/dist/{chunk-LVWFOLUZ.js.map → chunk-4K7EAQ5L.js.map} +0 -0
- /package/dist/{chunk-T5OMVL7E.js.map → chunk-DXX6HADE.js.map} +0 -0
- /package/dist/{chunk-TPWGL2XS.js.map → chunk-FO6EBJWP.js.map} +0 -0
- /package/dist/{chunk-GVDSFQ4E.js.map → chunk-RF3C6LGA.js.map} +0 -0
- /package/dist/{chunk-OQKMEFOS.js.map → chunk-SM674YAS.js.map} +0 -0
- /package/dist/{chunk-4OC7FTJB.js.map → chunk-UV5JQV3R.js.map} +0 -0
- /package/dist/{discovery-ZJQSXF56.js.map → discovery-VSGC76JN.js.map} +0 -0
- /package/dist/{generate-RJFS2JWA.js.map → generate-QZXOXYFW.js.map} +0 -0
- /package/dist/{init-ZSX3NRCZ.js.map → init-XK6PRUE5.js.map} +0 -0
- /package/dist/{scan-3PMCJ4RB.js.map → scan-CHQHXWVD.js.map} +0 -0
- /package/dist/{scan-generate-SYU4PYZD.js.map → scan-generate-U3RFVDTX.js.map} +0 -0
- /package/dist/{service-VMGNJZ42.js.map → service-MMEKG4MZ.js.map} +0 -0
- /package/dist/{snapshot-XOISO2IS.js.map → snapshot-53TUR3HW.js.map} +0 -0
- /package/dist/{static-viewer-5GXH2MGE.js.map → static-viewer-KKCR4KXR.js.map} +0 -0
- /package/dist/{test-SI4NSHQX.js.map → test-5UCKXYSC.js.map} +0 -0
- /package/dist/{tokens-T6SIVUT5.js.map → tokens-L46MK5AW.js.map} +0 -0
package/dist/bin.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-SXTKFDCR.js";
|
|
8
8
|
import {
|
|
9
9
|
setup
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DXX6HADE.js";
|
|
11
11
|
import {
|
|
12
12
|
buildFragments,
|
|
13
13
|
buildFragmentsDir,
|
|
@@ -22,21 +22,21 @@ import {
|
|
|
22
22
|
validateDrift,
|
|
23
23
|
validateSchema,
|
|
24
24
|
validateSnippets
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-RF3C6LGA.js";
|
|
26
26
|
import {
|
|
27
27
|
createComponentExtractor
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-EYXVAMEX.js";
|
|
29
29
|
import {
|
|
30
30
|
scan
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-FO6EBJWP.js";
|
|
32
32
|
import {
|
|
33
33
|
loadConfig,
|
|
34
34
|
loadFragmentFile,
|
|
35
35
|
parseFragmentFile
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-3SOAPJDX.js";
|
|
37
37
|
import {
|
|
38
38
|
discoverFragmentFiles
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-SM674YAS.js";
|
|
40
40
|
import {
|
|
41
41
|
FigmaClient,
|
|
42
42
|
StorageManager,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
renderAllComponentVariants,
|
|
53
53
|
scanCodebase,
|
|
54
54
|
shutdownSharedPool
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-4K7EAQ5L.js";
|
|
56
56
|
import "./chunk-D2CDBRNU.js";
|
|
57
57
|
import {
|
|
58
58
|
BRAND,
|
|
@@ -60,12 +60,12 @@ import {
|
|
|
60
60
|
formatBytes,
|
|
61
61
|
generateContext,
|
|
62
62
|
resolvePerformanceConfig
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-QM7SVOGF.js";
|
|
64
64
|
import "./chunk-Z7EY4VHE.js";
|
|
65
65
|
|
|
66
66
|
// src/bin.ts
|
|
67
67
|
import { Command } from "commander";
|
|
68
|
-
import
|
|
68
|
+
import pc25 from "picocolors";
|
|
69
69
|
import { readFileSync } from "fs";
|
|
70
70
|
import { fileURLToPath } from "url";
|
|
71
71
|
import { dirname as dirname4, join as join11 } from "path";
|
|
@@ -1901,7 +1901,7 @@ ${BRAND.name} Dev Server
|
|
|
1901
1901
|
}
|
|
1902
1902
|
}
|
|
1903
1903
|
}
|
|
1904
|
-
const { createDevServer } = await import("./viewer-
|
|
1904
|
+
const { createDevServer } = await import("./viewer-M2EQQSGE.js");
|
|
1905
1905
|
console.log(pc7.dim("\nStarting dev server..."));
|
|
1906
1906
|
const parsedPort = typeof port === "string" ? parseInt(port, 10) : port;
|
|
1907
1907
|
try {
|
|
@@ -6023,6 +6023,77 @@ function escapeRegex(str) {
|
|
|
6023
6023
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
6024
6024
|
}
|
|
6025
6025
|
|
|
6026
|
+
// src/commands/govern.ts
|
|
6027
|
+
import pc24 from "picocolors";
|
|
6028
|
+
async function governCheck(options = {}) {
|
|
6029
|
+
console.log(pc24.cyan(`
|
|
6030
|
+
${BRAND.name} Governance Check
|
|
6031
|
+
`));
|
|
6032
|
+
const { cliCheck, formatVerdict } = await import("@fragments-sdk/govern");
|
|
6033
|
+
const result = await cliCheck(options);
|
|
6034
|
+
const output = formatVerdict(result.verdict, options.format ?? "summary");
|
|
6035
|
+
if (!options.quiet) {
|
|
6036
|
+
console.log(output);
|
|
6037
|
+
console.log();
|
|
6038
|
+
}
|
|
6039
|
+
if (result.verdict.passed) {
|
|
6040
|
+
console.log(pc24.green(`\u2713 Governance check passed (score: ${result.verdict.score}/100)
|
|
6041
|
+
`));
|
|
6042
|
+
} else {
|
|
6043
|
+
console.log(pc24.red(`\u2717 Governance check failed (score: ${result.verdict.score}/100)
|
|
6044
|
+
`));
|
|
6045
|
+
}
|
|
6046
|
+
return { exitCode: result.exitCode };
|
|
6047
|
+
}
|
|
6048
|
+
async function governInit(options = {}) {
|
|
6049
|
+
const { writeFile: writeFile10 } = await import("fs/promises");
|
|
6050
|
+
const { resolve: resolve9 } = await import("path");
|
|
6051
|
+
const { generateConfigTemplate } = await import("@fragments-sdk/govern");
|
|
6052
|
+
const outputPath = resolve9(options.output ?? "govern.config.ts");
|
|
6053
|
+
const template = generateConfigTemplate();
|
|
6054
|
+
await writeFile10(outputPath, template, "utf-8");
|
|
6055
|
+
console.log(pc24.green(`\u2713 Created ${outputPath}
|
|
6056
|
+
`));
|
|
6057
|
+
}
|
|
6058
|
+
async function governReport() {
|
|
6059
|
+
const { readFile: readFile10 } = await import("fs/promises");
|
|
6060
|
+
console.log(pc24.cyan(`
|
|
6061
|
+
${BRAND.name} Governance Report
|
|
6062
|
+
`));
|
|
6063
|
+
let raw;
|
|
6064
|
+
try {
|
|
6065
|
+
raw = await readFile10(".govern-audit.jsonl", "utf-8");
|
|
6066
|
+
} catch {
|
|
6067
|
+
console.log(pc24.yellow("No audit log found (.govern-audit.jsonl)\n"));
|
|
6068
|
+
console.log(pc24.dim("Run `fragments govern check` to generate audit data.\n"));
|
|
6069
|
+
return;
|
|
6070
|
+
}
|
|
6071
|
+
const lines = raw.trim().split("\n").filter(Boolean);
|
|
6072
|
+
if (lines.length === 0) {
|
|
6073
|
+
console.log(pc24.yellow("Audit log is empty.\n"));
|
|
6074
|
+
return;
|
|
6075
|
+
}
|
|
6076
|
+
let totalScore = 0;
|
|
6077
|
+
let passCount = 0;
|
|
6078
|
+
let totalViolations = 0;
|
|
6079
|
+
for (const line of lines) {
|
|
6080
|
+
try {
|
|
6081
|
+
const entry = JSON.parse(line);
|
|
6082
|
+
totalScore += entry.score ?? 0;
|
|
6083
|
+
if (entry.passed) passCount++;
|
|
6084
|
+
totalViolations += entry.violationCount ?? 0;
|
|
6085
|
+
} catch {
|
|
6086
|
+
}
|
|
6087
|
+
}
|
|
6088
|
+
const avgScore = Math.round(totalScore / lines.length);
|
|
6089
|
+
const passRate = Math.round(passCount / lines.length * 100);
|
|
6090
|
+
console.log(` Checks: ${lines.length}`);
|
|
6091
|
+
console.log(` Pass rate: ${passRate}%`);
|
|
6092
|
+
console.log(` Avg score: ${avgScore}/100`);
|
|
6093
|
+
console.log(` Violations: ${totalViolations} total`);
|
|
6094
|
+
console.log();
|
|
6095
|
+
}
|
|
6096
|
+
|
|
6026
6097
|
// src/bin.ts
|
|
6027
6098
|
var __dirname = dirname4(fileURLToPath(import.meta.url));
|
|
6028
6099
|
var pkg = JSON.parse(readFileSync(join11(__dirname, "../package.json"), "utf-8"));
|
|
@@ -6035,7 +6106,7 @@ program.command("validate").description("Validate fragment files").option("-c, -
|
|
|
6035
6106
|
process.exit(1);
|
|
6036
6107
|
}
|
|
6037
6108
|
} catch (error) {
|
|
6038
|
-
console.error(
|
|
6109
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6039
6110
|
process.exit(1);
|
|
6040
6111
|
}
|
|
6041
6112
|
});
|
|
@@ -6051,7 +6122,7 @@ program.command("sync").description("Auto-update fragment files from component s
|
|
|
6051
6122
|
process.exit(1);
|
|
6052
6123
|
}
|
|
6053
6124
|
} catch (error) {
|
|
6054
|
-
console.error(
|
|
6125
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6055
6126
|
process.exit(1);
|
|
6056
6127
|
}
|
|
6057
6128
|
});
|
|
@@ -6071,7 +6142,7 @@ program.command("build").description(`Build compiled ${BRAND.outFile} and ${BRAN
|
|
|
6071
6142
|
process.exit(1);
|
|
6072
6143
|
}
|
|
6073
6144
|
} catch (error) {
|
|
6074
|
-
console.error(
|
|
6145
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6075
6146
|
process.exit(1);
|
|
6076
6147
|
}
|
|
6077
6148
|
});
|
|
@@ -6090,7 +6161,7 @@ program.command("context").description("Generate AI-ready context for your desig
|
|
|
6090
6161
|
process.exit(1);
|
|
6091
6162
|
}
|
|
6092
6163
|
} catch (error) {
|
|
6093
|
-
console.error(
|
|
6164
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6094
6165
|
process.exit(1);
|
|
6095
6166
|
}
|
|
6096
6167
|
});
|
|
@@ -6117,7 +6188,7 @@ program.command("ai").description("Generate context optimized for AI assistants
|
|
|
6117
6188
|
}
|
|
6118
6189
|
}
|
|
6119
6190
|
} catch (error) {
|
|
6120
|
-
console.error(
|
|
6191
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6121
6192
|
process.exit(1);
|
|
6122
6193
|
}
|
|
6123
6194
|
});
|
|
@@ -6125,7 +6196,7 @@ program.command("list").description("List all discovered fragment files").option
|
|
|
6125
6196
|
try {
|
|
6126
6197
|
await list(options);
|
|
6127
6198
|
} catch (error) {
|
|
6128
|
-
console.error(
|
|
6199
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6129
6200
|
process.exit(1);
|
|
6130
6201
|
}
|
|
6131
6202
|
});
|
|
@@ -6133,7 +6204,7 @@ program.command("reset").description("Reset to initial state (delete all generat
|
|
|
6133
6204
|
try {
|
|
6134
6205
|
await reset(options);
|
|
6135
6206
|
} catch (error) {
|
|
6136
|
-
console.error(
|
|
6207
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6137
6208
|
process.exit(1);
|
|
6138
6209
|
}
|
|
6139
6210
|
});
|
|
@@ -6147,7 +6218,7 @@ linkCommand.command("figma").argument("[figma-url]", "Figma file URL to link com
|
|
|
6147
6218
|
variants: options.variants
|
|
6148
6219
|
});
|
|
6149
6220
|
} catch (error) {
|
|
6150
|
-
console.error(
|
|
6221
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6151
6222
|
process.exit(1);
|
|
6152
6223
|
}
|
|
6153
6224
|
});
|
|
@@ -6162,7 +6233,7 @@ linkCommand.command("storybook").description("Bootstrap fragments from existing
|
|
|
6162
6233
|
exclude: options.exclude
|
|
6163
6234
|
});
|
|
6164
6235
|
} catch (error) {
|
|
6165
|
-
console.error(
|
|
6236
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6166
6237
|
process.exit(1);
|
|
6167
6238
|
}
|
|
6168
6239
|
});
|
|
@@ -6177,9 +6248,9 @@ program.command("dev").description("Start the development server with live compo
|
|
|
6177
6248
|
skipBuild: options.skipBuild
|
|
6178
6249
|
});
|
|
6179
6250
|
} catch (error) {
|
|
6180
|
-
console.error(
|
|
6251
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6181
6252
|
if (error instanceof Error && error.stack) {
|
|
6182
|
-
console.error(
|
|
6253
|
+
console.error(pc25.dim(error.stack));
|
|
6183
6254
|
}
|
|
6184
6255
|
process.exit(1);
|
|
6185
6256
|
}
|
|
@@ -6200,7 +6271,7 @@ program.command("screenshot").description("Capture screenshots of component vari
|
|
|
6200
6271
|
process.exit(1);
|
|
6201
6272
|
}
|
|
6202
6273
|
} catch (error) {
|
|
6203
|
-
console.error(
|
|
6274
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6204
6275
|
process.exit(1);
|
|
6205
6276
|
}
|
|
6206
6277
|
});
|
|
@@ -6219,7 +6290,7 @@ program.command("diff").argument("[component]", "Component name to diff (optiona
|
|
|
6219
6290
|
process.exit(1);
|
|
6220
6291
|
}
|
|
6221
6292
|
} catch (error) {
|
|
6222
|
-
console.error(
|
|
6293
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6223
6294
|
process.exit(1);
|
|
6224
6295
|
}
|
|
6225
6296
|
});
|
|
@@ -6238,8 +6309,8 @@ program.command("compare").argument("[component]", "Component name to compare").
|
|
|
6238
6309
|
process.exit(1);
|
|
6239
6310
|
}
|
|
6240
6311
|
} catch (error) {
|
|
6241
|
-
console.error(
|
|
6242
|
-
console.log(
|
|
6312
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6313
|
+
console.log(pc25.dim(`
|
|
6243
6314
|
Make sure the dev server is running: ${BRAND.cliCommand} dev`));
|
|
6244
6315
|
process.exit(1);
|
|
6245
6316
|
}
|
|
@@ -6258,7 +6329,7 @@ program.command("analyze").description("Analyze design system and generate repor
|
|
|
6258
6329
|
process.exit(1);
|
|
6259
6330
|
}
|
|
6260
6331
|
} catch (error) {
|
|
6261
|
-
console.error(
|
|
6332
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6262
6333
|
process.exit(1);
|
|
6263
6334
|
}
|
|
6264
6335
|
});
|
|
@@ -6277,7 +6348,7 @@ program.command("verify").argument("[component]", "Component name to verify (opt
|
|
|
6277
6348
|
if (options.ci) {
|
|
6278
6349
|
console.log(JSON.stringify({ error: error instanceof Error ? error.message : "Verification failed" }));
|
|
6279
6350
|
} else {
|
|
6280
|
-
console.error(
|
|
6351
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6281
6352
|
}
|
|
6282
6353
|
process.exit(1);
|
|
6283
6354
|
}
|
|
@@ -6294,7 +6365,7 @@ program.command("audit").description("Scan all fragments and show compliance met
|
|
|
6294
6365
|
if (options.json) {
|
|
6295
6366
|
console.log(JSON.stringify({ error: error instanceof Error ? error.message : "Audit failed" }));
|
|
6296
6367
|
} else {
|
|
6297
|
-
console.error(
|
|
6368
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6298
6369
|
}
|
|
6299
6370
|
process.exit(1);
|
|
6300
6371
|
}
|
|
@@ -6316,7 +6387,7 @@ program.command("a11y").description("Run accessibility checks on all component v
|
|
|
6316
6387
|
if (options.json) {
|
|
6317
6388
|
console.log(JSON.stringify({ error: error instanceof Error ? error.message : "A11y check failed" }));
|
|
6318
6389
|
} else {
|
|
6319
|
-
console.error(
|
|
6390
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6320
6391
|
}
|
|
6321
6392
|
process.exit(1);
|
|
6322
6393
|
}
|
|
@@ -6339,7 +6410,7 @@ program.command("enhance").description("AI-powered documentation generation from
|
|
|
6339
6410
|
if (options.format === "json") {
|
|
6340
6411
|
console.log(JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Enhance failed" }));
|
|
6341
6412
|
} else {
|
|
6342
|
-
console.error(
|
|
6413
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6343
6414
|
}
|
|
6344
6415
|
process.exit(1);
|
|
6345
6416
|
}
|
|
@@ -6360,7 +6431,7 @@ program.command("scan").description(`Zero-config ${BRAND.outFile} generation fro
|
|
|
6360
6431
|
process.exit(1);
|
|
6361
6432
|
}
|
|
6362
6433
|
} catch (error) {
|
|
6363
|
-
console.error(
|
|
6434
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6364
6435
|
process.exit(1);
|
|
6365
6436
|
}
|
|
6366
6437
|
});
|
|
@@ -6373,7 +6444,7 @@ program.command("storygen").description("Generate Storybook stories from fragmen
|
|
|
6373
6444
|
format: options.format
|
|
6374
6445
|
});
|
|
6375
6446
|
} catch (error) {
|
|
6376
|
-
console.error(
|
|
6447
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6377
6448
|
process.exit(1);
|
|
6378
6449
|
}
|
|
6379
6450
|
});
|
|
@@ -6385,7 +6456,7 @@ program.command("metrics").argument("[component]", "Component name (optional, sh
|
|
|
6385
6456
|
json: options.json
|
|
6386
6457
|
});
|
|
6387
6458
|
} catch (error) {
|
|
6388
|
-
console.error(
|
|
6459
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6389
6460
|
process.exit(1);
|
|
6390
6461
|
}
|
|
6391
6462
|
});
|
|
@@ -6399,9 +6470,9 @@ program.command("baseline").description("Manage visual regression baselines").ar
|
|
|
6399
6470
|
port: options.port
|
|
6400
6471
|
});
|
|
6401
6472
|
} catch (error) {
|
|
6402
|
-
console.error(
|
|
6473
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6403
6474
|
if (action === "update") {
|
|
6404
|
-
console.log(
|
|
6475
|
+
console.log(pc25.dim(`
|
|
6405
6476
|
Make sure the dev server is running: ${BRAND.cliCommand} dev`));
|
|
6406
6477
|
}
|
|
6407
6478
|
process.exit(1);
|
|
@@ -6409,27 +6480,27 @@ Make sure the dev server is running: ${BRAND.cliCommand} dev`));
|
|
|
6409
6480
|
});
|
|
6410
6481
|
program.command("view").description(`Generate a static HTML viewer for ${BRAND.outFile}`).option("-i, --input <path>", `Path to ${BRAND.outFile}`, BRAND.outFile).option("-o, --output <path>", "Output HTML file path", BRAND.viewerHtmlFile).option("--open", "Open in browser after generation").action(async (options) => {
|
|
6411
6482
|
try {
|
|
6412
|
-
const { generateViewerFromJson } = await import("./static-viewer-
|
|
6483
|
+
const { generateViewerFromJson } = await import("./static-viewer-KKCR4KXR.js");
|
|
6413
6484
|
const fs2 = await import("fs/promises");
|
|
6414
6485
|
const path = await import("path");
|
|
6415
6486
|
const inputPath = path.resolve(process.cwd(), options.input);
|
|
6416
6487
|
const outputPath = path.resolve(process.cwd(), options.output);
|
|
6417
|
-
console.log(
|
|
6488
|
+
console.log(pc25.cyan(`
|
|
6418
6489
|
${BRAND.name} Viewer Generator
|
|
6419
6490
|
`));
|
|
6420
6491
|
try {
|
|
6421
6492
|
await fs2.access(inputPath);
|
|
6422
6493
|
} catch {
|
|
6423
|
-
console.log(
|
|
6424
|
-
console.log(
|
|
6425
|
-
Run ${
|
|
6494
|
+
console.log(pc25.red(`Error: ${options.input} not found.`));
|
|
6495
|
+
console.log(pc25.dim(`
|
|
6496
|
+
Run ${pc25.cyan(`${BRAND.cliCommand} build`)} first to generate ${BRAND.outFile}
|
|
6426
6497
|
`));
|
|
6427
6498
|
process.exit(1);
|
|
6428
6499
|
}
|
|
6429
|
-
console.log(
|
|
6500
|
+
console.log(pc25.dim(`Reading: ${options.input}`));
|
|
6430
6501
|
const html = await generateViewerFromJson(inputPath);
|
|
6431
6502
|
await fs2.writeFile(outputPath, html);
|
|
6432
|
-
console.log(
|
|
6503
|
+
console.log(pc25.green(`
|
|
6433
6504
|
\u2713 Generated: ${options.output}
|
|
6434
6505
|
`));
|
|
6435
6506
|
if (options.open) {
|
|
@@ -6438,7 +6509,7 @@ Run ${pc24.cyan(`${BRAND.cliCommand} build`)} first to generate ${BRAND.outFile}
|
|
|
6438
6509
|
exec(`${openCmd} "${outputPath}"`);
|
|
6439
6510
|
}
|
|
6440
6511
|
} catch (error) {
|
|
6441
|
-
console.error(
|
|
6512
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6442
6513
|
process.exit(1);
|
|
6443
6514
|
}
|
|
6444
6515
|
});
|
|
@@ -6451,7 +6522,7 @@ program.command("add").argument("[name]", 'Component name (e.g., "Button", "Text
|
|
|
6451
6522
|
component: options.component
|
|
6452
6523
|
});
|
|
6453
6524
|
} catch (error) {
|
|
6454
|
-
console.error(
|
|
6525
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6455
6526
|
process.exit(1);
|
|
6456
6527
|
}
|
|
6457
6528
|
});
|
|
@@ -6468,13 +6539,13 @@ program.command("setup").description("Configure @fragments-sdk/ui in a consumer
|
|
|
6468
6539
|
process.exit(1);
|
|
6469
6540
|
}
|
|
6470
6541
|
} catch (error) {
|
|
6471
|
-
console.error(
|
|
6542
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6472
6543
|
process.exit(1);
|
|
6473
6544
|
}
|
|
6474
6545
|
});
|
|
6475
6546
|
program.command("init").description("Initialize fragments in a project (zero-config by default)").option("--force", "Overwrite existing config").option("-y, --yes", "Non-interactive mode (now the default)").option("--configure", "Interactive mode for theme seeds, snapshots, etc.").option("--scan <path>", "Scan a TypeScript component directory and generate fragment files").option("--enrich", "Use AI to fill knowledge fields during --scan (requires API key)").option("--dry-run", "Show what --enrich would generate without calling API").option("--provider <provider>", "AI provider for enrichment: anthropic or openai").option("--api-key <key>", "API key for AI enrichment").option("--model <model>", "Override AI model for enrichment").action(async (options) => {
|
|
6476
6547
|
try {
|
|
6477
|
-
const { init } = await import("./init-
|
|
6548
|
+
const { init } = await import("./init-XK6PRUE5.js");
|
|
6478
6549
|
const result = await init({
|
|
6479
6550
|
projectRoot: process.cwd(),
|
|
6480
6551
|
force: options.force,
|
|
@@ -6488,20 +6559,20 @@ program.command("init").description("Initialize fragments in a project (zero-con
|
|
|
6488
6559
|
model: options.model
|
|
6489
6560
|
});
|
|
6490
6561
|
if (!result.success) {
|
|
6491
|
-
console.error(
|
|
6562
|
+
console.error(pc25.red("\nInit failed with errors:"));
|
|
6492
6563
|
for (const error of result.errors) {
|
|
6493
|
-
console.error(
|
|
6564
|
+
console.error(pc25.red(` - ${error}`));
|
|
6494
6565
|
}
|
|
6495
6566
|
process.exit(1);
|
|
6496
6567
|
}
|
|
6497
6568
|
} catch (error) {
|
|
6498
|
-
console.error(
|
|
6569
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6499
6570
|
process.exit(1);
|
|
6500
6571
|
}
|
|
6501
6572
|
});
|
|
6502
6573
|
program.command("snapshot").description("Run visual snapshot tests per component variant").option("-p, --port <port>", "Port of running dev server (skips starting one)").option("--update", "Update existing snapshots instead of comparing").option("--component <name>", "Filter to a specific component").option("--spec <path>", "Path to snapshot spec file").option("--ci", "CI mode - exit 1 on mismatch").action(async (options) => {
|
|
6503
6574
|
try {
|
|
6504
|
-
const { snapshot } = await import("./snapshot-
|
|
6575
|
+
const { snapshot } = await import("./snapshot-53TUR3HW.js");
|
|
6505
6576
|
const result = await snapshot({
|
|
6506
6577
|
port: options.port,
|
|
6507
6578
|
update: options.update,
|
|
@@ -6513,13 +6584,13 @@ program.command("snapshot").description("Run visual snapshot tests per component
|
|
|
6513
6584
|
process.exit(1);
|
|
6514
6585
|
}
|
|
6515
6586
|
} catch (error) {
|
|
6516
|
-
console.error(
|
|
6587
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6517
6588
|
process.exit(1);
|
|
6518
6589
|
}
|
|
6519
6590
|
});
|
|
6520
6591
|
program.command("tokens").description("Discover and list design tokens from CSS/SCSS files").option("-c, --config <path>", "Path to config file").option("--json", "Output as JSON").option("--categories", "Group tokens by category").option("--theme <theme>", "Filter by theme name").option("--category <category>", "Filter by category (color, spacing, typography, etc.)").option("--verbose", "Show all tokens (no truncation)").action(async (options) => {
|
|
6521
6592
|
try {
|
|
6522
|
-
const { tokens } = await import("./tokens-
|
|
6593
|
+
const { tokens } = await import("./tokens-L46MK5AW.js");
|
|
6523
6594
|
const result = await tokens({
|
|
6524
6595
|
config: options.config,
|
|
6525
6596
|
json: options.json,
|
|
@@ -6532,13 +6603,13 @@ program.command("tokens").description("Discover and list design tokens from CSS/
|
|
|
6532
6603
|
process.exit(1);
|
|
6533
6604
|
}
|
|
6534
6605
|
} catch (error) {
|
|
6535
|
-
console.error(
|
|
6606
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6536
6607
|
process.exit(1);
|
|
6537
6608
|
}
|
|
6538
6609
|
});
|
|
6539
6610
|
program.command("generate").description("Generate fragment files from component source code").argument("[component]", "Specific component name to generate (optional)").option("--force", "Overwrite existing fragment files").option("--pattern <glob>", "Pattern for component files", "src/components/**/*.tsx").action(async (component, options) => {
|
|
6540
6611
|
try {
|
|
6541
|
-
const { generate } = await import("./generate-
|
|
6612
|
+
const { generate } = await import("./generate-QZXOXYFW.js");
|
|
6542
6613
|
const result = await generate({
|
|
6543
6614
|
projectRoot: process.cwd(),
|
|
6544
6615
|
component,
|
|
@@ -6546,11 +6617,11 @@ program.command("generate").description("Generate fragment files from component
|
|
|
6546
6617
|
componentPattern: options.pattern
|
|
6547
6618
|
});
|
|
6548
6619
|
if (!result.success) {
|
|
6549
|
-
console.error(
|
|
6620
|
+
console.error(pc25.red("\nGenerate completed with errors"));
|
|
6550
6621
|
process.exit(1);
|
|
6551
6622
|
}
|
|
6552
6623
|
} catch (error) {
|
|
6553
|
-
console.error(
|
|
6624
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6554
6625
|
process.exit(1);
|
|
6555
6626
|
}
|
|
6556
6627
|
});
|
|
@@ -6558,7 +6629,7 @@ program.command("graph").description("Query the component relationship graph").a
|
|
|
6558
6629
|
try {
|
|
6559
6630
|
await graph(component, options);
|
|
6560
6631
|
} catch (error) {
|
|
6561
|
-
console.error(
|
|
6632
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6562
6633
|
process.exit(1);
|
|
6563
6634
|
}
|
|
6564
6635
|
});
|
|
@@ -6576,14 +6647,14 @@ program.command("perf").description("Profile component bundle sizes and performa
|
|
|
6576
6647
|
process.exit(1);
|
|
6577
6648
|
}
|
|
6578
6649
|
} catch (error) {
|
|
6579
|
-
console.error(
|
|
6650
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6580
6651
|
process.exit(1);
|
|
6581
6652
|
}
|
|
6582
6653
|
});
|
|
6583
6654
|
program.command("test").description("Run interaction tests for fragments with play functions").option("-c, --config <path>", "Path to config file").option("--component <name>", "Filter by component name").option("--tags <tags>", "Filter by tags (comma-separated)").option("--grep <pattern>", "Filter by variant name pattern").option("--exclude <pattern>", "Exclude tests matching pattern").option("--parallel <count>", "Number of parallel browser contexts", parseInt, 4).option("--timeout <ms>", "Timeout per test in milliseconds", parseInt, 3e4).option("--retries <count>", "Number of retries for failed tests", parseInt, 0).option("--bail", "Stop on first failure").option("--browser <name>", "Browser to use (chromium, firefox, webkit)", "chromium").option("--headed", "Run in headed mode (show browser)").option("--a11y", "Run accessibility checks with axe-core").option("--visual", "Capture screenshots for visual regression").option("--update-snapshots", "Update visual snapshots").option("--watch", "Watch mode - re-run on file changes").option("--reporters <names>", "Reporters to use (console, junit, json)", "console").option("-o, --output <dir>", "Output directory for results", "./test-results").option("--server-url <url>", "URL of running dev server (skips starting server)").option("-p, --port <port>", "Port for dev server", parseInt, 6006).option("--ci", "CI mode - non-interactive, exit with code 1 on failure").option("--list", "List available tests without running them").action(async (options) => {
|
|
6584
6655
|
try {
|
|
6585
6656
|
const { config, configDir } = await loadConfig(options.config);
|
|
6586
|
-
const { runTestCommand, listTests } = await import("./test-
|
|
6657
|
+
const { runTestCommand, listTests } = await import("./test-5UCKXYSC.js");
|
|
6587
6658
|
if (options.list) {
|
|
6588
6659
|
await listTests(config, configDir, {
|
|
6589
6660
|
component: options.component,
|
|
@@ -6616,7 +6687,7 @@ program.command("test").description("Run interaction tests for fragments with pl
|
|
|
6616
6687
|
});
|
|
6617
6688
|
process.exit(exitCode);
|
|
6618
6689
|
} catch (error) {
|
|
6619
|
-
console.error(
|
|
6690
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6620
6691
|
process.exit(1);
|
|
6621
6692
|
}
|
|
6622
6693
|
});
|
|
@@ -6631,7 +6702,38 @@ program.command("doctor").description("Diagnose design system configuration issu
|
|
|
6631
6702
|
process.exit(1);
|
|
6632
6703
|
}
|
|
6633
6704
|
} catch (error) {
|
|
6634
|
-
console.error(
|
|
6705
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6706
|
+
process.exit(1);
|
|
6707
|
+
}
|
|
6708
|
+
});
|
|
6709
|
+
var governCmd = program.command("govern").description("AI UI governance checks");
|
|
6710
|
+
governCmd.command("check").description("Validate a UISpec against governance policies").option("-i, --input <path>", "Path to UISpec JSON file (or - for stdin)").option("-c, --config <path>", "Path to govern.config.ts").option("-f, --format <format>", "Output format: summary, json, sarif", "summary").option("-q, --quiet", "Suppress non-error output").action(async (options) => {
|
|
6711
|
+
try {
|
|
6712
|
+
const { exitCode } = await governCheck({
|
|
6713
|
+
input: options.input,
|
|
6714
|
+
config: options.config,
|
|
6715
|
+
format: options.format,
|
|
6716
|
+
quiet: options.quiet
|
|
6717
|
+
});
|
|
6718
|
+
process.exit(exitCode);
|
|
6719
|
+
} catch (error) {
|
|
6720
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6721
|
+
process.exit(1);
|
|
6722
|
+
}
|
|
6723
|
+
});
|
|
6724
|
+
governCmd.command("init").description("Generate a govern.config.ts template").option("-o, --output <path>", "Output path", "govern.config.ts").action(async (options) => {
|
|
6725
|
+
try {
|
|
6726
|
+
await governInit({ output: options.output });
|
|
6727
|
+
} catch (error) {
|
|
6728
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6729
|
+
process.exit(1);
|
|
6730
|
+
}
|
|
6731
|
+
});
|
|
6732
|
+
governCmd.command("report").description("Summarize governance audit log").action(async () => {
|
|
6733
|
+
try {
|
|
6734
|
+
await governReport();
|
|
6735
|
+
} catch (error) {
|
|
6736
|
+
console.error(pc25.red("Error:"), error instanceof Error ? error.message : error);
|
|
6635
6737
|
process.exit(1);
|
|
6636
6738
|
}
|
|
6637
6739
|
});
|