@fragments-sdk/cli 0.16.0 → 0.17.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 +24 -21
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-77AAP6R6.js → chunk-ANTWP3UG.js} +2 -2
- package/dist/{chunk-G6UVWMFU.js → chunk-B4A4ZEGS.js} +5 -5
- package/dist/{chunk-SJFSG7QF.js → chunk-FFCI6OVZ.js} +3 -1
- package/dist/chunk-FFCI6OVZ.js.map +1 -0
- package/dist/{chunk-XRADMHMV.js → chunk-HNHE64CR.js} +2 -2
- package/dist/{chunk-ACX7YWZW.js → chunk-MN3B2EE6.js} +2 -2
- package/dist/{chunk-QCN35LJU.js → chunk-SAQW37L5.js} +3 -2
- package/dist/chunk-SAQW37L5.js.map +1 -0
- package/dist/{chunk-OZZ4SVZX.js → chunk-SNZXGHL2.js} +2 -2
- package/dist/{chunk-ACFVKMVZ.js → chunk-VT2J62ND.js} +4 -4
- package/dist/{codebase-scanner-MQHUZC2G.js → codebase-scanner-2T5QIDBA.js} +2 -2
- package/dist/core/index.js +1 -1
- package/dist/{create-3ZFYQB3T.js → create-D44QD7MV.js} +2 -2
- package/dist/{doctor-4IDUM7HI.js → doctor-7B5N4JYU.js} +2 -2
- package/dist/{generate-VNUUWVWQ.js → generate-T47JZRVU.js} +3 -3
- package/dist/{govern-scan-HTACKYPF.js → govern-scan-X6UEIOSV.js} +187 -7
- package/dist/govern-scan-X6UEIOSV.js.map +1 -0
- package/dist/index.js +6 -6
- package/dist/{init-PXFRAQ64.js → init-2RGAY4W6.js} +5 -5
- package/dist/mcp-bin.js +2 -2
- package/dist/{scan-L4GWGEZX.js → scan-A2WJM54L.js} +6 -6
- package/dist/{scan-generate-74EYSAGH.js → scan-generate-LUSOHT36.js} +3 -3
- package/dist/{service-VELQHEWV.js → service-ROCP7TKG.js} +4 -4
- package/dist/{snapshot-DT4B6DPR.js → snapshot-B3SAW74Y.js} +2 -2
- package/dist/{static-viewer-E4OJWFDJ.js → static-viewer-7L6UEYTJ.js} +3 -3
- package/dist/{test-QJY2QO4X.js → test-PQDVDURE.js} +3 -3
- package/dist/{token-normalizer-56H4242J.js → token-normalizer-7TFCVDZL.js} +2 -2
- package/dist/{tokens-K6URXFPK.js → tokens-64FG5FDP.js} +5 -5
- package/dist/{tokens-generate-EL6IN536.js → tokens-generate-CL4LBBQA.js} +2 -2
- package/package.json +4 -4
- package/src/bin.ts +6 -0
- package/src/commands/__fixtures__/shadcn-label-wrapper/src/components/ui/label.contract.json +1 -1
- package/src/commands/__fixtures__/shadcn-label-wrapper/src/components/ui/primitive.contract.json +1 -1
- package/src/commands/govern-scan.ts +257 -5
- package/src/mcp/__tests__/server.integration.test.ts +9 -20
- package/src/service/enhance/codebase-scanner.ts +3 -2
- package/src/service/enhance/types.ts +3 -0
- package/dist/chunk-QCN35LJU.js.map +0 -1
- package/dist/chunk-SJFSG7QF.js.map +0 -1
- package/dist/govern-scan-HTACKYPF.js.map +0 -1
- /package/dist/{chunk-77AAP6R6.js.map → chunk-ANTWP3UG.js.map} +0 -0
- /package/dist/{chunk-G6UVWMFU.js.map → chunk-B4A4ZEGS.js.map} +0 -0
- /package/dist/{chunk-XRADMHMV.js.map → chunk-HNHE64CR.js.map} +0 -0
- /package/dist/{chunk-ACX7YWZW.js.map → chunk-MN3B2EE6.js.map} +0 -0
- /package/dist/{chunk-OZZ4SVZX.js.map → chunk-SNZXGHL2.js.map} +0 -0
- /package/dist/{chunk-ACFVKMVZ.js.map → chunk-VT2J62ND.js.map} +0 -0
- /package/dist/{codebase-scanner-MQHUZC2G.js.map → codebase-scanner-2T5QIDBA.js.map} +0 -0
- /package/dist/{create-3ZFYQB3T.js.map → create-D44QD7MV.js.map} +0 -0
- /package/dist/{doctor-4IDUM7HI.js.map → doctor-7B5N4JYU.js.map} +0 -0
- /package/dist/{generate-VNUUWVWQ.js.map → generate-T47JZRVU.js.map} +0 -0
- /package/dist/{init-PXFRAQ64.js.map → init-2RGAY4W6.js.map} +0 -0
- /package/dist/{scan-L4GWGEZX.js.map → scan-A2WJM54L.js.map} +0 -0
- /package/dist/{scan-generate-74EYSAGH.js.map → scan-generate-LUSOHT36.js.map} +0 -0
- /package/dist/{service-VELQHEWV.js.map → service-ROCP7TKG.js.map} +0 -0
- /package/dist/{snapshot-DT4B6DPR.js.map → snapshot-B3SAW74Y.js.map} +0 -0
- /package/dist/{static-viewer-E4OJWFDJ.js.map → static-viewer-7L6UEYTJ.js.map} +0 -0
- /package/dist/{test-QJY2QO4X.js.map → test-PQDVDURE.js.map} +0 -0
- /package/dist/{token-normalizer-56H4242J.js.map → token-normalizer-7TFCVDZL.js.map} +0 -0
- /package/dist/{tokens-K6URXFPK.js.map → tokens-64FG5FDP.js.map} +0 -0
- /package/dist/{tokens-generate-EL6IN536.js.map → tokens-generate-CL4LBBQA.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-MN3B2EE6.js";
|
|
11
11
|
import {
|
|
12
12
|
runAnalyzeCommand,
|
|
13
13
|
runDiffCommand,
|
|
@@ -17,19 +17,19 @@ import {
|
|
|
17
17
|
validateDrift,
|
|
18
18
|
validateSchema,
|
|
19
19
|
validateSnippets
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-VT2J62ND.js";
|
|
21
21
|
import {
|
|
22
22
|
projectFields
|
|
23
23
|
} from "./chunk-T47OLCSF.js";
|
|
24
24
|
import {
|
|
25
25
|
scan
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-B4A4ZEGS.js";
|
|
27
27
|
import {
|
|
28
28
|
discoverFragmentFiles,
|
|
29
29
|
loadConfig,
|
|
30
30
|
loadFragmentFile,
|
|
31
31
|
parseFragmentFile
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-HNHE64CR.js";
|
|
33
33
|
import {
|
|
34
34
|
FigmaClient,
|
|
35
35
|
StorageManager,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
parseAllStories,
|
|
44
44
|
renderAllComponentVariants,
|
|
45
45
|
shutdownSharedPool
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-ANTWP3UG.js";
|
|
47
47
|
import "./chunk-D2CDBRNU.js";
|
|
48
48
|
import {
|
|
49
49
|
BRAND,
|
|
@@ -54,11 +54,11 @@ import {
|
|
|
54
54
|
formatBytes,
|
|
55
55
|
generateContext,
|
|
56
56
|
resolvePerformanceConfig
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-FFCI6OVZ.js";
|
|
58
58
|
import {
|
|
59
59
|
getScanStats,
|
|
60
60
|
scanCodebase
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-SAQW37L5.js";
|
|
62
62
|
import "./chunk-7DZC4YEV.js";
|
|
63
63
|
|
|
64
64
|
// src/bin.ts
|
|
@@ -6432,7 +6432,7 @@ async function governInit(options = {}) {
|
|
|
6432
6432
|
const { existsSync: existsSync4 } = await import("fs");
|
|
6433
6433
|
const { resolve: resolve15 } = await import("path");
|
|
6434
6434
|
const { generateConfigTemplate } = await import("@fragments-sdk/govern");
|
|
6435
|
-
const { findTailwindConfig } = await import("./token-normalizer-
|
|
6435
|
+
const { findTailwindConfig } = await import("./token-normalizer-7TFCVDZL.js");
|
|
6436
6436
|
const cwd = process.cwd();
|
|
6437
6437
|
const detected = {
|
|
6438
6438
|
tokenIncludes: [],
|
|
@@ -7167,7 +7167,7 @@ Make sure a dev server is running on the expected port.`));
|
|
|
7167
7167
|
});
|
|
7168
7168
|
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) => {
|
|
7169
7169
|
try {
|
|
7170
|
-
const { generateViewerFromJson } = await import("./static-viewer-
|
|
7170
|
+
const { generateViewerFromJson } = await import("./static-viewer-7L6UEYTJ.js");
|
|
7171
7171
|
const fs2 = await import("fs/promises");
|
|
7172
7172
|
const path = await import("path");
|
|
7173
7173
|
const inputPath = path.resolve(process.cwd(), options.input);
|
|
@@ -7215,7 +7215,7 @@ program.command("add").argument("[name]", 'Component name (e.g., "Button", "Text
|
|
|
7215
7215
|
});
|
|
7216
7216
|
program.command("create").argument("[name]", "Project name").description("Create a new project with Fragments UI and your custom theme").option("-t, --template <template>", "Framework template (nextjs, vite)", "nextjs").option("--pm <manager>", "Package manager (npm, pnpm, yarn, bun)").option("--theme <encoded>", "Encoded theme string").option("--preset <id>", "Theme preset ID from usefragments.com/create").option("--brand <color>", "Brand color hex (e.g., #6366f1)").option("--scss", "Use SCSS output (installs sass)").option("--no-mcp", "Skip MCP server configuration").option("-y, --yes", "Skip interactive prompts").option("--no-git", "Skip git initialization").action(async (name, options) => {
|
|
7217
7217
|
try {
|
|
7218
|
-
const { create } = await import("./create-
|
|
7218
|
+
const { create } = await import("./create-D44QD7MV.js");
|
|
7219
7219
|
const result = await create({
|
|
7220
7220
|
name,
|
|
7221
7221
|
template: options.template,
|
|
@@ -7257,7 +7257,7 @@ program.command("setup").description("Configure @fragments-sdk/ui in a consumer
|
|
|
7257
7257
|
var initCmd = 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("--metadata-only", "Generate config and metadata without modifying runtime app setup").option("--govern", "Alias for --metadata-only").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");
|
|
7258
7258
|
initCmd.action(async (options) => {
|
|
7259
7259
|
try {
|
|
7260
|
-
const { init } = await import("./init-
|
|
7260
|
+
const { init } = await import("./init-2RGAY4W6.js");
|
|
7261
7261
|
const result = await init({
|
|
7262
7262
|
projectRoot: process.cwd(),
|
|
7263
7263
|
force: options.force,
|
|
@@ -7286,7 +7286,7 @@ initCmd.action(async (options) => {
|
|
|
7286
7286
|
});
|
|
7287
7287
|
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) => {
|
|
7288
7288
|
try {
|
|
7289
|
-
const { snapshot } = await import("./snapshot-
|
|
7289
|
+
const { snapshot } = await import("./snapshot-B3SAW74Y.js");
|
|
7290
7290
|
const result = await snapshot({
|
|
7291
7291
|
port: options.port,
|
|
7292
7292
|
update: options.update,
|
|
@@ -7305,7 +7305,7 @@ program.command("snapshot").description("Run visual snapshot tests per component
|
|
|
7305
7305
|
var tokensCmd = program.command("tokens").description("Design token discovery, listing, and generation");
|
|
7306
7306
|
tokensCmd.command("list", { isDefault: true }).description("Discover and list design tokens from CSS/SCSS/DTCG 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) => {
|
|
7307
7307
|
try {
|
|
7308
|
-
const { tokens } = await import("./tokens-
|
|
7308
|
+
const { tokens } = await import("./tokens-64FG5FDP.js");
|
|
7309
7309
|
const result = await tokens({
|
|
7310
7310
|
config: options.config,
|
|
7311
7311
|
json: options.json,
|
|
@@ -7324,7 +7324,7 @@ tokensCmd.command("list", { isDefault: true }).description("Discover and list de
|
|
|
7324
7324
|
});
|
|
7325
7325
|
tokensCmd.command("generate").description("Generate CSS, SCSS, Tailwind, or Figma output from a DTCG .tokens.json file").requiredOption("--from <path>", "Path to DTCG .tokens.json source file").requiredOption("--format <formats>", "Output formats (comma-separated: css, scss, tailwind, figma)").option("--out <dir>", "Output directory (default: same directory as source)").option("--prefix <prefix>", "Token name prefix").option("--selector <selector>", "CSS selector for custom properties (default: :root)").option("--verbose", "Verbose output").action(async (options) => {
|
|
7326
7326
|
try {
|
|
7327
|
-
const { tokensGenerate } = await import("./tokens-generate-
|
|
7327
|
+
const { tokensGenerate } = await import("./tokens-generate-CL4LBBQA.js");
|
|
7328
7328
|
await tokensGenerate({
|
|
7329
7329
|
from: options.from,
|
|
7330
7330
|
format: options.format,
|
|
@@ -7340,7 +7340,7 @@ tokensCmd.command("generate").description("Generate CSS, SCSS, Tailwind, or Figm
|
|
|
7340
7340
|
});
|
|
7341
7341
|
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) => {
|
|
7342
7342
|
try {
|
|
7343
|
-
const { generate } = await import("./generate-
|
|
7343
|
+
const { generate } = await import("./generate-T47JZRVU.js");
|
|
7344
7344
|
const result = await generate({
|
|
7345
7345
|
projectRoot: process.cwd(),
|
|
7346
7346
|
component,
|
|
@@ -7423,7 +7423,7 @@ program.command("perf").description("Profile component bundle sizes and performa
|
|
|
7423
7423
|
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) => {
|
|
7424
7424
|
try {
|
|
7425
7425
|
const { config, configDir } = await loadConfig(options.config);
|
|
7426
|
-
const { runTestCommand, listTests } = await import("./test-
|
|
7426
|
+
const { runTestCommand, listTests } = await import("./test-PQDVDURE.js");
|
|
7427
7427
|
if (options.list) {
|
|
7428
7428
|
await listTests(config, configDir, {
|
|
7429
7429
|
component: options.component,
|
|
@@ -7462,7 +7462,7 @@ program.command("test").description("Run interaction tests for fragments with pl
|
|
|
7462
7462
|
});
|
|
7463
7463
|
program.command("doctor").description("Diagnose design system configuration issues").option("--root <dir>", "Project root directory", process.cwd()).option("--json", "Output results as JSON").option("--fix", "Auto-fix issues where possible").action(async (options) => {
|
|
7464
7464
|
try {
|
|
7465
|
-
const { doctor } = await import("./doctor-
|
|
7465
|
+
const { doctor } = await import("./doctor-7B5N4JYU.js");
|
|
7466
7466
|
const result = await doctor({
|
|
7467
7467
|
root: options.root,
|
|
7468
7468
|
json: options.json,
|
|
@@ -7515,15 +7515,18 @@ governCmd.command("report").description("Summarize governance audit log").action
|
|
|
7515
7515
|
process.exit(1);
|
|
7516
7516
|
}
|
|
7517
7517
|
});
|
|
7518
|
-
governCmd.command("scan").description("Scan JSX/TSX codebase for governance violations").option("-d, --dir <path>", "Root directory (default: auto-detect)").option("-c, --config <path>", "Path to govern.config.ts").option("-f, --format <format>", "Output format: summary, json, sarif", "summary").option("-r, --report <path>", "Write an aggregated machine-readable JSON report").option("-q, --quiet", "Suppress non-error output").action(async (options) => {
|
|
7518
|
+
governCmd.command("scan").description("Scan JSX/TSX codebase for governance violations").option("-d, --dir <path>", "Root directory (default: auto-detect)").option("-c, --config <path>", "Path to govern.config.ts").option("-f, --format <format>", "Output format: summary, json, sarif", "summary").option("-r, --report <path>", "Write an aggregated machine-readable JSON report").option("-q, --quiet", "Suppress non-error output").option("--api-key <key>", "Fragments Cloud API key \u2014 report findings to Cloud").option("--cloud-url <url>", "Fragments Cloud URL (default: https://app.usefragments.com)").option("--diff [base]", "Only scan files changed vs a base ref (default: auto-detect merge base)").action(async (options) => {
|
|
7519
7519
|
try {
|
|
7520
|
-
const { governScan } = await import("./govern-scan-
|
|
7520
|
+
const { governScan } = await import("./govern-scan-X6UEIOSV.js");
|
|
7521
7521
|
const { exitCode } = await governScan({
|
|
7522
7522
|
dir: options.dir,
|
|
7523
7523
|
config: options.config,
|
|
7524
7524
|
format: options.format,
|
|
7525
7525
|
report: options.report,
|
|
7526
|
-
quiet: options.quiet
|
|
7526
|
+
quiet: options.quiet,
|
|
7527
|
+
apiKey: options.apiKey ?? process.env.FRAGMENTS_API_KEY,
|
|
7528
|
+
cloudUrl: options.cloudUrl ?? process.env.FRAGMENTS_CLOUD_URL,
|
|
7529
|
+
diff: options.diff
|
|
7527
7530
|
});
|
|
7528
7531
|
process.exit(exitCode);
|
|
7529
7532
|
} catch (error) {
|
|
@@ -7533,7 +7536,7 @@ governCmd.command("scan").description("Scan JSX/TSX codebase for governance viol
|
|
|
7533
7536
|
});
|
|
7534
7537
|
governCmd.command("watch").description("Watch JSX/TSX files and re-check on changes").option("-d, --dir <path>", "Root directory (default: auto-detect)").option("-c, --config <path>", "Path to govern.config.ts").option("-q, --quiet", "Suppress non-error output").option("--debounce <ms>", "Debounce interval in ms", "300").action(async (options) => {
|
|
7535
7538
|
try {
|
|
7536
|
-
const { governWatch } = await import("./govern-scan-
|
|
7539
|
+
const { governWatch } = await import("./govern-scan-X6UEIOSV.js");
|
|
7537
7540
|
await governWatch({
|
|
7538
7541
|
dir: options.dir,
|
|
7539
7542
|
config: options.config,
|