@buoy-design/cli 0.1.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.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +5 -0
- package/dist/bin.js.map +1 -0
- package/dist/commands/__tests__/ci.test.d.ts +2 -0
- package/dist/commands/__tests__/ci.test.d.ts.map +1 -0
- package/dist/commands/__tests__/ci.test.js +33 -0
- package/dist/commands/__tests__/ci.test.js.map +1 -0
- package/dist/commands/bootstrap.d.ts +3 -0
- package/dist/commands/bootstrap.d.ts.map +1 -0
- package/dist/commands/bootstrap.js +458 -0
- package/dist/commands/bootstrap.js.map +1 -0
- package/dist/commands/build.d.ts +3 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +314 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/ci.d.ts +24 -0
- package/dist/commands/ci.d.ts.map +1 -0
- package/dist/commands/ci.js +273 -0
- package/dist/commands/ci.js.map +1 -0
- package/dist/commands/ci.logic.d.ts +20 -0
- package/dist/commands/ci.logic.d.ts.map +1 -0
- package/dist/commands/ci.logic.js +28 -0
- package/dist/commands/ci.logic.js.map +1 -0
- package/dist/commands/drift.d.ts +3 -0
- package/dist/commands/drift.d.ts.map +1 -0
- package/dist/commands/drift.js +178 -0
- package/dist/commands/drift.js.map +1 -0
- package/dist/commands/index.d.ts +9 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +9 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +490 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/plugins.d.ts +3 -0
- package/dist/commands/plugins.d.ts.map +1 -0
- package/dist/commands/plugins.js +72 -0
- package/dist/commands/plugins.js.map +1 -0
- package/dist/commands/scan.d.ts +3 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +266 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +205 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +8 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +67 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +1040 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +116 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/detect/frameworks.d.ts +18 -0
- package/dist/detect/frameworks.d.ts.map +1 -0
- package/dist/detect/frameworks.js +168 -0
- package/dist/detect/frameworks.js.map +1 -0
- package/dist/detect/index.d.ts +3 -0
- package/dist/detect/index.d.ts.map +1 -0
- package/dist/detect/index.js +3 -0
- package/dist/detect/index.js.map +1 -0
- package/dist/detect/project-detector.d.ts +61 -0
- package/dist/detect/project-detector.d.ts.map +1 -0
- package/dist/detect/project-detector.js +849 -0
- package/dist/detect/project-detector.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/output/formatters.d.ts +21 -0
- package/dist/output/formatters.d.ts.map +1 -0
- package/dist/output/formatters.js +421 -0
- package/dist/output/formatters.js.map +1 -0
- package/dist/output/index.d.ts +3 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +3 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/reporters.d.ts +23 -0
- package/dist/output/reporters.d.ts.map +1 -0
- package/dist/output/reporters.js +147 -0
- package/dist/output/reporters.js.map +1 -0
- package/dist/plugins/index.d.ts +3 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +3 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/loader.d.ts +11 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +77 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/registry.d.ts +15 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +32 -0
- package/dist/plugins/registry.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { loadConfig, getConfigPath } from '../config/loader.js';
|
|
4
|
+
import { spinner, success, error, info, warning, header, keyValue, newline, setJsonMode } from '../output/reporters.js';
|
|
5
|
+
import { loadDiscoveredPlugins, registry } from '../plugins/index.js';
|
|
6
|
+
import { formatComponentTable, formatTokenTable } from '../output/formatters.js';
|
|
7
|
+
export function createScanCommand() {
|
|
8
|
+
const cmd = new Command('scan')
|
|
9
|
+
.description('Scan sources for components and tokens')
|
|
10
|
+
.option('-s, --source <sources...>', 'Specific sources to scan (react, vue, svelte, angular, tokens, etc.)')
|
|
11
|
+
.option('--json', 'Output as JSON')
|
|
12
|
+
.option('-v, --verbose', 'Verbose output')
|
|
13
|
+
.action(async (options) => {
|
|
14
|
+
// Set JSON mode before creating spinner to redirect spinner to stderr
|
|
15
|
+
if (options.json) {
|
|
16
|
+
setJsonMode(true);
|
|
17
|
+
}
|
|
18
|
+
const spin = spinner('Loading configuration...');
|
|
19
|
+
try {
|
|
20
|
+
// Load config
|
|
21
|
+
const { config, configPath } = await loadConfig();
|
|
22
|
+
spin.text = 'Loading plugins...';
|
|
23
|
+
// Load discovered plugins from package.json
|
|
24
|
+
const plugins = await loadDiscoveredPlugins({ projectRoot: process.cwd() });
|
|
25
|
+
if (plugins.length > 0 && options.verbose) {
|
|
26
|
+
spin.stop();
|
|
27
|
+
console.log(chalk.dim(`Loaded ${plugins.length} plugin(s): ${plugins.map(p => p.metadata.name).join(', ')}`));
|
|
28
|
+
spin.start();
|
|
29
|
+
}
|
|
30
|
+
spin.text = 'Scanning sources...';
|
|
31
|
+
if (options.verbose && configPath) {
|
|
32
|
+
spin.stop();
|
|
33
|
+
info(`Using config: ${configPath}`);
|
|
34
|
+
spin.start();
|
|
35
|
+
}
|
|
36
|
+
// Determine which sources to scan
|
|
37
|
+
const sourcesToScan = options.source || [];
|
|
38
|
+
if (sourcesToScan.length === 0) {
|
|
39
|
+
// JS Frameworks
|
|
40
|
+
if (config.sources.react?.enabled)
|
|
41
|
+
sourcesToScan.push('react');
|
|
42
|
+
if (config.sources.vue?.enabled)
|
|
43
|
+
sourcesToScan.push('vue');
|
|
44
|
+
if (config.sources.svelte?.enabled)
|
|
45
|
+
sourcesToScan.push('svelte');
|
|
46
|
+
if (config.sources.angular?.enabled)
|
|
47
|
+
sourcesToScan.push('angular');
|
|
48
|
+
if (config.sources.webcomponent?.enabled)
|
|
49
|
+
sourcesToScan.push('webcomponent');
|
|
50
|
+
// Templates
|
|
51
|
+
if (config.sources.templates?.enabled)
|
|
52
|
+
sourcesToScan.push('templates');
|
|
53
|
+
// Design tools
|
|
54
|
+
if (config.sources.figma?.enabled)
|
|
55
|
+
sourcesToScan.push('figma');
|
|
56
|
+
if (config.sources.storybook?.enabled)
|
|
57
|
+
sourcesToScan.push('storybook');
|
|
58
|
+
if (config.sources.tokens?.enabled)
|
|
59
|
+
sourcesToScan.push('tokens');
|
|
60
|
+
}
|
|
61
|
+
if (sourcesToScan.length === 0) {
|
|
62
|
+
spin.stop();
|
|
63
|
+
// Check if config file even exists
|
|
64
|
+
const configExists = getConfigPath() !== null;
|
|
65
|
+
if (!configExists) {
|
|
66
|
+
error('No configuration found');
|
|
67
|
+
console.log('');
|
|
68
|
+
info('Run ' + chalk.cyan('buoy init') + ' to set up your project');
|
|
69
|
+
console.log('');
|
|
70
|
+
info('This will auto-detect components, tokens, and more.');
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
warning('No sources to scan');
|
|
74
|
+
console.log('');
|
|
75
|
+
info('Your config file has no sources enabled.');
|
|
76
|
+
console.log('');
|
|
77
|
+
info('This can happen if:');
|
|
78
|
+
info(' • Auto-detection found no components');
|
|
79
|
+
info(' • No token files (CSS variables, JSON tokens) were found');
|
|
80
|
+
info(' • This is not a frontend project');
|
|
81
|
+
console.log('');
|
|
82
|
+
info('To fix:');
|
|
83
|
+
info(' 1. Run ' + chalk.cyan('buoy bootstrap') + ' to extract tokens from existing code');
|
|
84
|
+
info(' 2. Run ' + chalk.cyan('buoy build') + ' to generate a design system with AI');
|
|
85
|
+
info(' 3. Or add paths manually to your config');
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// Import scanners dynamically
|
|
90
|
+
const { ReactComponentScanner, VueComponentScanner, SvelteComponentScanner, AngularComponentScanner, WebComponentScanner, TemplateScanner, TokenScanner, } = await import('@buoy-design/scanners/git');
|
|
91
|
+
const results = {
|
|
92
|
+
components: [],
|
|
93
|
+
tokens: [],
|
|
94
|
+
errors: [],
|
|
95
|
+
};
|
|
96
|
+
// Scan each source
|
|
97
|
+
for (const source of sourcesToScan) {
|
|
98
|
+
spin.text = `Scanning ${source}...`;
|
|
99
|
+
try {
|
|
100
|
+
// Check if a plugin can handle this source type
|
|
101
|
+
const plugin = registry.getByDetection(source);
|
|
102
|
+
if (plugin && plugin.scan) {
|
|
103
|
+
// Use plugin scanner
|
|
104
|
+
if (options.verbose) {
|
|
105
|
+
spin.stop();
|
|
106
|
+
console.log(chalk.dim(` Using plugin "${plugin.metadata.name}" for ${source}`));
|
|
107
|
+
spin.start();
|
|
108
|
+
}
|
|
109
|
+
const sourceConfig = config.sources[source];
|
|
110
|
+
const pluginResult = await plugin.scan({
|
|
111
|
+
projectRoot: process.cwd(),
|
|
112
|
+
config: sourceConfig || {},
|
|
113
|
+
include: sourceConfig?.include,
|
|
114
|
+
exclude: sourceConfig?.exclude,
|
|
115
|
+
});
|
|
116
|
+
results.components.push(...pluginResult.components);
|
|
117
|
+
results.tokens.push(...pluginResult.tokens);
|
|
118
|
+
if (pluginResult.errors.length > 0) {
|
|
119
|
+
results.errors.push(...pluginResult.errors.map(e => `[${source}] ${e.file || ''}: ${e.message}`));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
// Fall back to bundled scanners
|
|
124
|
+
// React
|
|
125
|
+
if (source === 'react' && config.sources.react) {
|
|
126
|
+
const scanner = new ReactComponentScanner({
|
|
127
|
+
projectRoot: process.cwd(),
|
|
128
|
+
include: config.sources.react.include,
|
|
129
|
+
exclude: config.sources.react.exclude,
|
|
130
|
+
designSystemPackage: config.sources.react.designSystemPackage,
|
|
131
|
+
});
|
|
132
|
+
const scanResult = await scanner.scan();
|
|
133
|
+
results.components.push(...scanResult.items);
|
|
134
|
+
if (scanResult.errors.length > 0) {
|
|
135
|
+
results.errors.push(...scanResult.errors.map(e => `[${source}] ${e.file || ''}: ${e.message}`));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Vue
|
|
139
|
+
if (source === 'vue' && config.sources.vue) {
|
|
140
|
+
const scanner = new VueComponentScanner({
|
|
141
|
+
projectRoot: process.cwd(),
|
|
142
|
+
include: config.sources.vue.include,
|
|
143
|
+
exclude: config.sources.vue.exclude,
|
|
144
|
+
});
|
|
145
|
+
const scanResult = await scanner.scan();
|
|
146
|
+
results.components.push(...scanResult.items);
|
|
147
|
+
if (scanResult.errors.length > 0) {
|
|
148
|
+
results.errors.push(...scanResult.errors.map(e => `[${source}] ${e.file || ''}: ${e.message}`));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// Svelte
|
|
152
|
+
if (source === 'svelte' && config.sources.svelte) {
|
|
153
|
+
const scanner = new SvelteComponentScanner({
|
|
154
|
+
projectRoot: process.cwd(),
|
|
155
|
+
include: config.sources.svelte.include,
|
|
156
|
+
exclude: config.sources.svelte.exclude,
|
|
157
|
+
});
|
|
158
|
+
const scanResult = await scanner.scan();
|
|
159
|
+
results.components.push(...scanResult.items);
|
|
160
|
+
if (scanResult.errors.length > 0) {
|
|
161
|
+
results.errors.push(...scanResult.errors.map(e => `[${source}] ${e.file || ''}: ${e.message}`));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// Angular
|
|
165
|
+
if (source === 'angular' && config.sources.angular) {
|
|
166
|
+
const scanner = new AngularComponentScanner({
|
|
167
|
+
projectRoot: process.cwd(),
|
|
168
|
+
include: config.sources.angular.include,
|
|
169
|
+
exclude: config.sources.angular.exclude,
|
|
170
|
+
});
|
|
171
|
+
const scanResult = await scanner.scan();
|
|
172
|
+
results.components.push(...scanResult.items);
|
|
173
|
+
if (scanResult.errors.length > 0) {
|
|
174
|
+
results.errors.push(...scanResult.errors.map(e => `[${source}] ${e.file || ''}: ${e.message}`));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// Web Components (Lit, Stencil)
|
|
178
|
+
if (source === 'webcomponent' && config.sources.webcomponent) {
|
|
179
|
+
const scanner = new WebComponentScanner({
|
|
180
|
+
projectRoot: process.cwd(),
|
|
181
|
+
include: config.sources.webcomponent.include,
|
|
182
|
+
exclude: config.sources.webcomponent.exclude,
|
|
183
|
+
framework: config.sources.webcomponent.framework,
|
|
184
|
+
});
|
|
185
|
+
const scanResult = await scanner.scan();
|
|
186
|
+
results.components.push(...scanResult.items);
|
|
187
|
+
if (scanResult.errors.length > 0) {
|
|
188
|
+
results.errors.push(...scanResult.errors.map(e => `[${source}] ${e.file || ''}: ${e.message}`));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Templates (Blade, ERB, Twig, etc.)
|
|
192
|
+
if (source === 'templates' && config.sources.templates) {
|
|
193
|
+
const scanner = new TemplateScanner({
|
|
194
|
+
projectRoot: process.cwd(),
|
|
195
|
+
include: config.sources.templates.include,
|
|
196
|
+
exclude: config.sources.templates.exclude,
|
|
197
|
+
templateType: config.sources.templates.type,
|
|
198
|
+
});
|
|
199
|
+
const scanResult = await scanner.scan();
|
|
200
|
+
results.components.push(...scanResult.items);
|
|
201
|
+
if (scanResult.errors.length > 0) {
|
|
202
|
+
results.errors.push(...scanResult.errors.map(e => `[${source}] ${e.file || ''}: ${e.message}`));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// Tokens
|
|
206
|
+
if (source === 'tokens' && config.sources.tokens) {
|
|
207
|
+
const scanner = new TokenScanner({
|
|
208
|
+
projectRoot: process.cwd(),
|
|
209
|
+
files: config.sources.tokens.files,
|
|
210
|
+
cssVariablePrefix: config.sources.tokens.cssVariablePrefix,
|
|
211
|
+
});
|
|
212
|
+
const scanResult = await scanner.scan();
|
|
213
|
+
results.tokens.push(...scanResult.items);
|
|
214
|
+
if (scanResult.errors.length > 0) {
|
|
215
|
+
results.errors.push(...scanResult.errors.map(e => `[${source}] ${e.file || ''}: ${e.message}`));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// TODO: Add figma, storybook scanners
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
catch (err) {
|
|
222
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
223
|
+
results.errors.push(`[${source}] ${message}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
spin.stop();
|
|
227
|
+
// Output results
|
|
228
|
+
if (options.json) {
|
|
229
|
+
console.log(JSON.stringify(results, null, 2));
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
header('Scan Results');
|
|
233
|
+
newline();
|
|
234
|
+
keyValue('Components found', String(results.components.length));
|
|
235
|
+
keyValue('Tokens found', String(results.tokens.length));
|
|
236
|
+
keyValue('Errors', String(results.errors.length));
|
|
237
|
+
newline();
|
|
238
|
+
if (results.components.length > 0) {
|
|
239
|
+
header('Components');
|
|
240
|
+
console.log(formatComponentTable(results.components));
|
|
241
|
+
newline();
|
|
242
|
+
}
|
|
243
|
+
if (results.tokens.length > 0) {
|
|
244
|
+
header('Tokens');
|
|
245
|
+
console.log(formatTokenTable(results.tokens));
|
|
246
|
+
newline();
|
|
247
|
+
}
|
|
248
|
+
if (results.errors.length > 0) {
|
|
249
|
+
header('Errors');
|
|
250
|
+
for (const err of results.errors) {
|
|
251
|
+
error(err);
|
|
252
|
+
}
|
|
253
|
+
newline();
|
|
254
|
+
}
|
|
255
|
+
success('Scan complete');
|
|
256
|
+
}
|
|
257
|
+
catch (err) {
|
|
258
|
+
spin.stop();
|
|
259
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
260
|
+
error(`Scan failed: ${message}`);
|
|
261
|
+
process.exit(1);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
return cmd;
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../../src/commands/scan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACxH,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEjF,MAAM,UAAU,iBAAiB;IAC/B,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;SAC5B,WAAW,CAAC,wCAAwC,CAAC;SACrD,MAAM,CAAC,2BAA2B,EAAE,sEAAsE,CAAC;SAC3G,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,eAAe,EAAE,gBAAgB,CAAC;SACzC,MAAM,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OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,KAAK,CAAC,gBAAgB,OAAO,EAAE,CAAC,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,wBAAgB,mBAAmB,IAAI,OAAO,CA8O7C"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { loadConfig, getConfigPath } from '../config/loader.js';
|
|
4
|
+
import { spinner, success, error, info, coverageGrid, setJsonMode, } from '../output/reporters.js';
|
|
5
|
+
import { ProjectDetector } from '../detect/project-detector.js';
|
|
6
|
+
export function createStatusCommand() {
|
|
7
|
+
const cmd = new Command('status')
|
|
8
|
+
.description('Show design system coverage at a glance')
|
|
9
|
+
.option('--json', 'Output as JSON')
|
|
10
|
+
.option('-v, --verbose', 'Verbose output')
|
|
11
|
+
.action(async (options) => {
|
|
12
|
+
// Set JSON mode before creating spinner to redirect spinner to stderr
|
|
13
|
+
if (options.json) {
|
|
14
|
+
setJsonMode(true);
|
|
15
|
+
}
|
|
16
|
+
const spin = spinner('Analyzing design system coverage...');
|
|
17
|
+
try {
|
|
18
|
+
// Check if config exists
|
|
19
|
+
const configExists = getConfigPath() !== null;
|
|
20
|
+
if (!configExists) {
|
|
21
|
+
spin.stop();
|
|
22
|
+
error('No configuration found');
|
|
23
|
+
console.log('');
|
|
24
|
+
info('Run buoy init to set up your project');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const { config } = await loadConfig();
|
|
28
|
+
// Import required modules
|
|
29
|
+
const { ReactComponentScanner, VueComponentScanner, SvelteComponentScanner, AngularComponentScanner, WebComponentScanner, TemplateScanner, } = await import('@buoy-design/scanners/git');
|
|
30
|
+
const { SemanticDiffEngine } = await import('@buoy-design/core/analysis');
|
|
31
|
+
const components = [];
|
|
32
|
+
spin.text = 'Scanning components...';
|
|
33
|
+
// React
|
|
34
|
+
if (config.sources.react?.enabled) {
|
|
35
|
+
const scanner = new ReactComponentScanner({
|
|
36
|
+
projectRoot: process.cwd(),
|
|
37
|
+
include: config.sources.react.include,
|
|
38
|
+
exclude: config.sources.react.exclude,
|
|
39
|
+
designSystemPackage: config.sources.react.designSystemPackage,
|
|
40
|
+
});
|
|
41
|
+
const result = await scanner.scan();
|
|
42
|
+
components.push(...result.items);
|
|
43
|
+
}
|
|
44
|
+
// Vue
|
|
45
|
+
if (config.sources.vue?.enabled) {
|
|
46
|
+
const scanner = new VueComponentScanner({
|
|
47
|
+
projectRoot: process.cwd(),
|
|
48
|
+
include: config.sources.vue.include,
|
|
49
|
+
exclude: config.sources.vue.exclude,
|
|
50
|
+
});
|
|
51
|
+
const result = await scanner.scan();
|
|
52
|
+
components.push(...result.items);
|
|
53
|
+
}
|
|
54
|
+
// Svelte
|
|
55
|
+
if (config.sources.svelte?.enabled) {
|
|
56
|
+
const scanner = new SvelteComponentScanner({
|
|
57
|
+
projectRoot: process.cwd(),
|
|
58
|
+
include: config.sources.svelte.include,
|
|
59
|
+
exclude: config.sources.svelte.exclude,
|
|
60
|
+
});
|
|
61
|
+
const result = await scanner.scan();
|
|
62
|
+
components.push(...result.items);
|
|
63
|
+
}
|
|
64
|
+
// Angular
|
|
65
|
+
if (config.sources.angular?.enabled) {
|
|
66
|
+
const scanner = new AngularComponentScanner({
|
|
67
|
+
projectRoot: process.cwd(),
|
|
68
|
+
include: config.sources.angular.include,
|
|
69
|
+
exclude: config.sources.angular.exclude,
|
|
70
|
+
});
|
|
71
|
+
const result = await scanner.scan();
|
|
72
|
+
components.push(...result.items);
|
|
73
|
+
}
|
|
74
|
+
// Web Components
|
|
75
|
+
if (config.sources.webcomponent?.enabled) {
|
|
76
|
+
const scanner = new WebComponentScanner({
|
|
77
|
+
projectRoot: process.cwd(),
|
|
78
|
+
include: config.sources.webcomponent.include,
|
|
79
|
+
exclude: config.sources.webcomponent.exclude,
|
|
80
|
+
framework: config.sources.webcomponent.framework,
|
|
81
|
+
});
|
|
82
|
+
const result = await scanner.scan();
|
|
83
|
+
components.push(...result.items);
|
|
84
|
+
}
|
|
85
|
+
// Templates
|
|
86
|
+
if (config.sources.templates?.enabled) {
|
|
87
|
+
const scanner = new TemplateScanner({
|
|
88
|
+
projectRoot: process.cwd(),
|
|
89
|
+
include: config.sources.templates.include,
|
|
90
|
+
exclude: config.sources.templates.exclude,
|
|
91
|
+
templateType: config.sources.templates.type,
|
|
92
|
+
});
|
|
93
|
+
const result = await scanner.scan();
|
|
94
|
+
components.push(...result.items);
|
|
95
|
+
}
|
|
96
|
+
// Detect frameworks for sprawl check
|
|
97
|
+
spin.text = 'Detecting frameworks...';
|
|
98
|
+
const detector = new ProjectDetector(process.cwd());
|
|
99
|
+
const projectInfo = await detector.detect();
|
|
100
|
+
// Run drift analysis
|
|
101
|
+
spin.text = 'Analyzing drift...';
|
|
102
|
+
const engine = new SemanticDiffEngine();
|
|
103
|
+
const diffResult = engine.analyzeComponents(components, {
|
|
104
|
+
checkDeprecated: true,
|
|
105
|
+
checkNaming: true,
|
|
106
|
+
checkDocumentation: true,
|
|
107
|
+
});
|
|
108
|
+
const drifts = [...diffResult.drifts];
|
|
109
|
+
// Check for framework sprawl
|
|
110
|
+
const sprawlSignal = engine.checkFrameworkSprawl(projectInfo.frameworks.map(f => ({ name: f.name, version: f.version })));
|
|
111
|
+
if (sprawlSignal) {
|
|
112
|
+
drifts.push(sprawlSignal);
|
|
113
|
+
}
|
|
114
|
+
// Calculate coverage stats
|
|
115
|
+
const driftingComponentIds = new Set(drifts.map(d => d.source.entityId));
|
|
116
|
+
const stats = {
|
|
117
|
+
aligned: components.filter(c => !driftingComponentIds.has(c.id)).length,
|
|
118
|
+
drifting: driftingComponentIds.size,
|
|
119
|
+
untracked: 0, // For future: components not yet analyzed
|
|
120
|
+
total: components.length,
|
|
121
|
+
};
|
|
122
|
+
spin.stop();
|
|
123
|
+
// Group components by status
|
|
124
|
+
const alignedComponents = components.filter(c => !driftingComponentIds.has(c.id));
|
|
125
|
+
const driftingComponentsList = components.filter(c => driftingComponentIds.has(c.id));
|
|
126
|
+
// Output
|
|
127
|
+
if (options.json) {
|
|
128
|
+
console.log(JSON.stringify({
|
|
129
|
+
stats,
|
|
130
|
+
alignedPercent: stats.total > 0 ? Math.round((stats.aligned / stats.total) * 100) : 0,
|
|
131
|
+
frameworks: projectInfo.frameworks.map(f => ({ name: f.name, version: f.version })),
|
|
132
|
+
frameworkSprawl: sprawlSignal !== null,
|
|
133
|
+
components: {
|
|
134
|
+
aligned: alignedComponents.map(c => ({ id: c.id, name: c.name, path: 'path' in c.source ? c.source.path : undefined })),
|
|
135
|
+
drifting: driftingComponentsList.map(c => ({ id: c.id, name: c.name, path: 'path' in c.source ? c.source.path : undefined })),
|
|
136
|
+
},
|
|
137
|
+
}, null, 2));
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (stats.total === 0) {
|
|
141
|
+
info('No components found to analyze.');
|
|
142
|
+
console.log('');
|
|
143
|
+
info('Options:');
|
|
144
|
+
info(' • Run ' + chalk.cyan('buoy bootstrap') + ' to extract tokens from existing code');
|
|
145
|
+
info(' • Run ' + chalk.cyan('buoy build') + ' to generate a design system with AI');
|
|
146
|
+
info(' • Check your config has component paths configured');
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
// Display framework sprawl warning if detected
|
|
150
|
+
if (sprawlSignal) {
|
|
151
|
+
console.log('');
|
|
152
|
+
console.log(chalk.yellow.bold('⚠️ Framework Sprawl Detected'));
|
|
153
|
+
console.log(chalk.dim(' Multiple UI frameworks in use:'));
|
|
154
|
+
projectInfo.frameworks.forEach(f => {
|
|
155
|
+
const version = f.version !== 'unknown' ? chalk.dim(` (${f.version})`) : '';
|
|
156
|
+
console.log(` • ${chalk.cyan(f.name)}${version}`);
|
|
157
|
+
});
|
|
158
|
+
console.log('');
|
|
159
|
+
}
|
|
160
|
+
// Display the coverage grid
|
|
161
|
+
coverageGrid(stats);
|
|
162
|
+
// Display component lists
|
|
163
|
+
console.log('');
|
|
164
|
+
if (driftingComponentsList.length > 0) {
|
|
165
|
+
console.log('\x1b[33m⛀ Drifting:\x1b[0m');
|
|
166
|
+
driftingComponentsList.forEach(c => {
|
|
167
|
+
console.log(` ${c.name}`);
|
|
168
|
+
});
|
|
169
|
+
console.log('');
|
|
170
|
+
}
|
|
171
|
+
if (alignedComponents.length > 0) {
|
|
172
|
+
console.log('\x1b[32m⛁ Aligned:\x1b[0m');
|
|
173
|
+
alignedComponents.forEach(c => {
|
|
174
|
+
console.log(` ${c.name}`);
|
|
175
|
+
});
|
|
176
|
+
console.log('');
|
|
177
|
+
}
|
|
178
|
+
// Summary message
|
|
179
|
+
const alignedPct = Math.round((stats.aligned / stats.total) * 100);
|
|
180
|
+
if (alignedPct === 100) {
|
|
181
|
+
success('Perfect alignment! No drift detected.');
|
|
182
|
+
}
|
|
183
|
+
else if (alignedPct >= 80) {
|
|
184
|
+
success('Good alignment. Minor drift to review.');
|
|
185
|
+
}
|
|
186
|
+
else if (alignedPct >= 50) {
|
|
187
|
+
info('Moderate alignment. Consider reviewing drifting components.');
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
error('Low alignment. Run buoy drift check for details.');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
catch (err) {
|
|
194
|
+
spin.stop();
|
|
195
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
196
|
+
error(`Status check failed: ${message}`);
|
|
197
|
+
if (options.verbose) {
|
|
198
|
+
console.error(err);
|
|
199
|
+
}
|
|
200
|
+
process.exit(1);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
return cmd;
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EACL,OAAO,EACP,OAAO,EACP,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,WAAW,GAEZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,MAAM,UAAU,mBAAmB;IACjC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;SAC9B,WAAW,CAAC,yCAAyC,CAAC;SACtD,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,eAAe,EAAE,gBAAgB,CAAC;SACzC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,sEAAsE;QACtE,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,WAAW,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;QAE5D,IAAI,CAAC;YACH,yBAAyB;YACzB,MAAM,YAAY,GAAG,aAAa,EAAE,KAAK,IAAI,CAAC;YAC9C,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,IAAI,CAAC,IAAI,EAAE,CAAC;gBACZ,KAAK,CAAC,wBAAwB,CAAC,CAAC;gBAChC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAChB,IAAI,CAAC,sCAAsC,CAA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O,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,KAAK,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;YAEzC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBACpB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACrB,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BuoyConfig } from './schema.js';
|
|
2
|
+
export interface LoadConfigResult {
|
|
3
|
+
config: BuoyConfig;
|
|
4
|
+
configPath: string | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function loadConfig(cwd?: string): Promise<LoadConfigResult>;
|
|
7
|
+
export declare function getConfigPath(cwd?: string): string | null;
|
|
8
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAoB,MAAM,aAAa,CAAC;AAU3D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,wBAAsB,UAAU,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAkDvF;AAED,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAQxE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { existsSync } from 'fs';
|
|
2
|
+
import { resolve, basename } from 'path';
|
|
3
|
+
import { pathToFileURL } from 'url';
|
|
4
|
+
import { BuoyConfigSchema } from './schema.js';
|
|
5
|
+
const CONFIG_FILES = [
|
|
6
|
+
'buoy.config.mjs',
|
|
7
|
+
'buoy.config.js',
|
|
8
|
+
'buoy.config.ts', // Requires tsx or similar runtime
|
|
9
|
+
'.buoyrc.json',
|
|
10
|
+
'.buoyrc',
|
|
11
|
+
];
|
|
12
|
+
export async function loadConfig(cwd = process.cwd()) {
|
|
13
|
+
// Find config file
|
|
14
|
+
let configPath = null;
|
|
15
|
+
for (const filename of CONFIG_FILES) {
|
|
16
|
+
const fullPath = resolve(cwd, filename);
|
|
17
|
+
if (existsSync(fullPath)) {
|
|
18
|
+
configPath = fullPath;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (!configPath) {
|
|
23
|
+
// Return default config if no file found
|
|
24
|
+
return {
|
|
25
|
+
config: BuoyConfigSchema.parse({
|
|
26
|
+
project: { name: basename(cwd) },
|
|
27
|
+
}),
|
|
28
|
+
configPath: null,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// Load config based on extension
|
|
32
|
+
const ext = configPath.split('.').pop();
|
|
33
|
+
try {
|
|
34
|
+
if (ext === 'json' || configPath.endsWith('.buoyrc')) {
|
|
35
|
+
const { readFileSync } = await import('fs');
|
|
36
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
37
|
+
const raw = JSON.parse(content);
|
|
38
|
+
return {
|
|
39
|
+
config: BuoyConfigSchema.parse(raw),
|
|
40
|
+
configPath,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// For JS/TS files, we need to import them
|
|
44
|
+
// Note: TypeScript files need tsx or similar runtime
|
|
45
|
+
const fileUrl = pathToFileURL(configPath).href;
|
|
46
|
+
const mod = await import(fileUrl);
|
|
47
|
+
const raw = mod.default || mod;
|
|
48
|
+
return {
|
|
49
|
+
config: BuoyConfigSchema.parse(raw),
|
|
50
|
+
configPath,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
55
|
+
throw new Error(`Failed to load config from ${configPath}: ${message}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export function getConfigPath(cwd = process.cwd()) {
|
|
59
|
+
for (const filename of CONFIG_FILES) {
|
|
60
|
+
const fullPath = resolve(cwd, filename);
|
|
61
|
+
if (existsSync(fullPath)) {
|
|
62
|
+
return fullPath;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAc,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE3D,MAAM,YAAY,GAAG;IACnB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB,EAAG,kCAAkC;IACrD,cAAc;IACd,SAAS;CACV,CAAC;AAOF,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IAC1D,mBAAmB;IACnB,IAAI,UAAU,GAAkB,IAAI,CAAC;IAErC,KAAK,MAAM,QAAQ,IAAI,YAA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