@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.
Files changed (89) hide show
  1. package/dist/ai-client-I6MDWNYA.js +21 -0
  2. package/dist/bin.js +419 -410
  3. package/dist/bin.js.map +1 -1
  4. package/dist/{chunk-HRFUSSZI.js → chunk-3SOAPJDX.js} +2 -2
  5. package/dist/{chunk-D5PYOXEI.js → chunk-4K7EAQ5L.js} +148 -13
  6. package/dist/{chunk-D5PYOXEI.js.map → chunk-4K7EAQ5L.js.map} +1 -1
  7. package/dist/chunk-DXX6HADE.js +443 -0
  8. package/dist/chunk-DXX6HADE.js.map +1 -0
  9. package/dist/chunk-EYXVAMEX.js +626 -0
  10. package/dist/chunk-EYXVAMEX.js.map +1 -0
  11. package/dist/{chunk-ZM4ZQZWZ.js → chunk-FO6EBJWP.js} +39 -37
  12. package/dist/chunk-FO6EBJWP.js.map +1 -0
  13. package/dist/{chunk-OQO55NKV.js → chunk-QM7SVOGF.js} +120 -12
  14. package/dist/chunk-QM7SVOGF.js.map +1 -0
  15. package/dist/{chunk-5G3VZH43.js → chunk-RF3C6LGA.js} +281 -351
  16. package/dist/chunk-RF3C6LGA.js.map +1 -0
  17. package/dist/{chunk-WXSR2II7.js → chunk-SM674YAS.js} +58 -6
  18. package/dist/chunk-SM674YAS.js.map +1 -0
  19. package/dist/chunk-SXTKFDCR.js +104 -0
  20. package/dist/chunk-SXTKFDCR.js.map +1 -0
  21. package/dist/{chunk-PW7QTQA6.js → chunk-UV5JQV3R.js} +2 -2
  22. package/dist/core/index.js +13 -1
  23. package/dist/{discovery-NEOY4MPN.js → discovery-VSGC76JN.js} +3 -3
  24. package/dist/{generate-FBHSXR3D.js → generate-QZXOXYFW.js} +4 -4
  25. package/dist/index.js +7 -6
  26. package/dist/index.js.map +1 -1
  27. package/dist/init-XK6PRUE5.js +636 -0
  28. package/dist/init-XK6PRUE5.js.map +1 -0
  29. package/dist/mcp-bin.js +2 -2
  30. package/dist/{scan-CJF2DOQW.js → scan-CHQHXWVD.js} +6 -6
  31. package/dist/scan-generate-U3RFVDTX.js +1115 -0
  32. package/dist/scan-generate-U3RFVDTX.js.map +1 -0
  33. package/dist/{service-TQYWY65E.js → service-MMEKG4MZ.js} +3 -3
  34. package/dist/{snapshot-SV2JOFZH.js → snapshot-53TUR3HW.js} +2 -2
  35. package/dist/{static-viewer-NUBFPKWH.js → static-viewer-KKCR4KXR.js} +3 -3
  36. package/dist/static-viewer-KKCR4KXR.js.map +1 -0
  37. package/dist/{test-Z5LVO724.js → test-5UCKXYSC.js} +4 -4
  38. package/dist/{tokens-CE46OTMD.js → tokens-L46MK5AW.js} +5 -5
  39. package/dist/{viewer-DLLJIMCK.js → viewer-M2EQQSGE.js} +14 -14
  40. package/dist/viewer-M2EQQSGE.js.map +1 -0
  41. package/package.json +11 -9
  42. package/src/ai-client.ts +156 -0
  43. package/src/bin.ts +99 -2
  44. package/src/build.ts +95 -33
  45. package/src/commands/__tests__/drift-sync.test.ts +252 -0
  46. package/src/commands/__tests__/scan-generate.test.ts +497 -45
  47. package/src/commands/enhance.ts +11 -35
  48. package/src/commands/govern.ts +122 -0
  49. package/src/commands/init.ts +288 -260
  50. package/src/commands/scan-generate.ts +740 -139
  51. package/src/commands/scan.ts +37 -32
  52. package/src/commands/setup.ts +143 -52
  53. package/src/commands/sync.ts +357 -0
  54. package/src/commands/validate.ts +43 -1
  55. package/src/core/component-extractor.test.ts +282 -0
  56. package/src/core/component-extractor.ts +1030 -0
  57. package/src/core/discovery.ts +93 -7
  58. package/src/service/enhance/props-extractor.ts +235 -13
  59. package/src/validators.ts +236 -0
  60. package/src/viewer/vite-plugin.ts +1 -1
  61. package/dist/chunk-5G3VZH43.js.map +0 -1
  62. package/dist/chunk-OQO55NKV.js.map +0 -1
  63. package/dist/chunk-WXSR2II7.js.map +0 -1
  64. package/dist/chunk-ZM4ZQZWZ.js.map +0 -1
  65. package/dist/init-UFGK5TCN.js +0 -867
  66. package/dist/init-UFGK5TCN.js.map +0 -1
  67. package/dist/scan-generate-SJAN5MVI.js +0 -691
  68. package/dist/scan-generate-SJAN5MVI.js.map +0 -1
  69. package/dist/viewer-DLLJIMCK.js.map +0 -1
  70. package/src/ai.ts +0 -266
  71. package/src/commands/init-framework.ts +0 -414
  72. package/src/mcp/bin.ts +0 -36
  73. package/src/migrate/bin.ts +0 -114
  74. package/src/theme/index.ts +0 -77
  75. package/src/viewer/bin.ts +0 -86
  76. package/src/viewer/cli/health.ts +0 -256
  77. package/src/viewer/cli/index.ts +0 -33
  78. package/src/viewer/cli/scan.ts +0 -124
  79. package/src/viewer/cli/utils.ts +0 -174
  80. /package/dist/{discovery-NEOY4MPN.js.map → ai-client-I6MDWNYA.js.map} +0 -0
  81. /package/dist/{chunk-HRFUSSZI.js.map → chunk-3SOAPJDX.js.map} +0 -0
  82. /package/dist/{chunk-PW7QTQA6.js.map → chunk-UV5JQV3R.js.map} +0 -0
  83. /package/dist/{scan-CJF2DOQW.js.map → discovery-VSGC76JN.js.map} +0 -0
  84. /package/dist/{generate-FBHSXR3D.js.map → generate-QZXOXYFW.js.map} +0 -0
  85. /package/dist/{service-TQYWY65E.js.map → scan-CHQHXWVD.js.map} +0 -0
  86. /package/dist/{static-viewer-NUBFPKWH.js.map → service-MMEKG4MZ.js.map} +0 -0
  87. /package/dist/{snapshot-SV2JOFZH.js.map → snapshot-53TUR3HW.js.map} +0 -0
  88. /package/dist/{test-Z5LVO724.js.map → test-5UCKXYSC.js.map} +0 -0
  89. /package/dist/{tokens-CE46OTMD.js.map → tokens-L46MK5AW.js.map} +0 -0
@@ -1,174 +0,0 @@
1
- /**
2
- * Shared CLI Utilities
3
- * Common helpers for CLI commands
4
- */
5
-
6
- import pc from 'picocolors';
7
-
8
- /**
9
- * Parse command line arguments into options object
10
- */
11
- export function parseArgs(args: string[]): {
12
- positional: string[];
13
- options: Record<string, string | boolean>;
14
- } {
15
- const positional: string[] = [];
16
- const options: Record<string, string | boolean> = {};
17
-
18
- for (const arg of args) {
19
- if (arg.startsWith('--')) {
20
- const [key, value] = arg.slice(2).split('=');
21
- options[key] = value ?? true;
22
- } else if (arg.startsWith('-')) {
23
- const key = arg.slice(1);
24
- options[key] = true;
25
- } else {
26
- positional.push(arg);
27
- }
28
- }
29
-
30
- return { positional, options };
31
- }
32
-
33
- /**
34
- * Spinner for async operations
35
- */
36
- export function createSpinner(message: string): {
37
- start: () => void;
38
- stop: (success?: boolean, finalMessage?: string) => void;
39
- update: (message: string) => void;
40
- } {
41
- const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
42
- let frameIndex = 0;
43
- let interval: NodeJS.Timeout | null = null;
44
- let currentMessage = message;
45
-
46
- return {
47
- start() {
48
- process.stdout.write('\n');
49
- interval = setInterval(() => {
50
- process.stdout.write(`\r${pc.cyan(frames[frameIndex])} ${currentMessage}`);
51
- frameIndex = (frameIndex + 1) % frames.length;
52
- }, 80);
53
- },
54
- stop(success = true, finalMessage?: string) {
55
- if (interval) {
56
- clearInterval(interval);
57
- interval = null;
58
- }
59
- const icon = success ? pc.green('✓') : pc.red('✗');
60
- process.stdout.write(`\r${icon} ${finalMessage || currentMessage}\n`);
61
- },
62
- update(message: string) {
63
- currentMessage = message;
64
- },
65
- };
66
- }
67
-
68
- /**
69
- * Format a table for console output
70
- */
71
- export function formatTable(
72
- headers: string[],
73
- rows: string[][],
74
- options: { padding?: number; maxWidth?: number } = {}
75
- ): string {
76
- const { padding = 2, maxWidth = 50 } = options;
77
-
78
- // Calculate column widths
79
- const widths = headers.map((h, i) => {
80
- const columnValues = [h, ...rows.map((r) => r[i] || '')];
81
- return Math.min(maxWidth, Math.max(...columnValues.map((v) => v.length)));
82
- });
83
-
84
- // Format header
85
- const headerLine = headers
86
- .map((h, i) => h.padEnd(widths[i] + padding))
87
- .join('');
88
- const separator = widths.map((w) => '─'.repeat(w + padding)).join('');
89
-
90
- // Format rows
91
- const formattedRows = rows.map((row) =>
92
- row.map((cell, i) => (cell || '').padEnd(widths[i] + padding)).join('')
93
- );
94
-
95
- return [
96
- pc.bold(headerLine),
97
- pc.dim(separator),
98
- ...formattedRows,
99
- ].join('\n');
100
- }
101
-
102
- /**
103
- * Format bytes as human-readable size
104
- */
105
- export function formatBytes(bytes: number): string {
106
- if (bytes === 0) return '0 B';
107
- const k = 1024;
108
- const sizes = ['B', 'KB', 'MB', 'GB'];
109
- const i = Math.floor(Math.log(bytes) / Math.log(k));
110
- return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
111
- }
112
-
113
- /**
114
- * Format duration in milliseconds
115
- */
116
- export function formatDuration(ms: number): string {
117
- if (ms < 1000) return `${ms}ms`;
118
- if (ms < 60000) return `${(ms / 1000).toFixed(1)}s`;
119
- return `${(ms / 60000).toFixed(1)}m`;
120
- }
121
-
122
- /**
123
- * Format a score with color based on thresholds
124
- */
125
- export function formatScore(score: number, thresholds = { good: 80, warn: 50 }): string {
126
- const formatted = `${score}%`;
127
- if (score >= thresholds.good) return pc.green(formatted);
128
- if (score >= thresholds.warn) return pc.yellow(formatted);
129
- return pc.red(formatted);
130
- }
131
-
132
- /**
133
- * Print a section header
134
- */
135
- export function printHeader(title: string): void {
136
- console.log(`\n${pc.bold(pc.cyan(title))}`);
137
- console.log(pc.dim('─'.repeat(title.length + 4)));
138
- }
139
-
140
- /**
141
- * Print a key-value pair
142
- */
143
- export function printKV(key: string, value: string | number, color?: (s: string) => string): void {
144
- const valueStr = String(value);
145
- console.log(` ${pc.dim(key + ':')} ${color ? color(valueStr) : valueStr}`);
146
- }
147
-
148
- /**
149
- * Print a warning message
150
- */
151
- export function printWarning(message: string): void {
152
- console.log(pc.yellow(` ⚠ ${message}`));
153
- }
154
-
155
- /**
156
- * Print an error message
157
- */
158
- export function printError(message: string): void {
159
- console.log(pc.red(` ✗ ${message}`));
160
- }
161
-
162
- /**
163
- * Print a success message
164
- */
165
- export function printSuccess(message: string): void {
166
- console.log(pc.green(` ✓ ${message}`));
167
- }
168
-
169
- /**
170
- * Format a list for bullet points
171
- */
172
- export function formatList(items: string[], bullet = '•'): string {
173
- return items.map((item) => ` ${pc.dim(bullet)} ${item}`).join('\n');
174
- }