agnosticui-cli 2.0.0-alpha.2

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 (50) hide show
  1. package/README.md +1268 -0
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +98 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/add.d.ts +3 -0
  7. package/dist/commands/add.d.ts.map +1 -0
  8. package/dist/commands/add.js +464 -0
  9. package/dist/commands/add.js.map +1 -0
  10. package/dist/commands/init.d.ts +3 -0
  11. package/dist/commands/init.d.ts.map +1 -0
  12. package/dist/commands/init.js +381 -0
  13. package/dist/commands/init.js.map +1 -0
  14. package/dist/commands/list.d.ts +2 -0
  15. package/dist/commands/list.d.ts.map +1 -0
  16. package/dist/commands/list.js +72 -0
  17. package/dist/commands/list.js.map +1 -0
  18. package/dist/commands/remove.d.ts +3 -0
  19. package/dist/commands/remove.d.ts.map +1 -0
  20. package/dist/commands/remove.js +96 -0
  21. package/dist/commands/remove.js.map +1 -0
  22. package/dist/commands/sync.d.ts +6 -0
  23. package/dist/commands/sync.d.ts.map +1 -0
  24. package/dist/commands/sync.js +143 -0
  25. package/dist/commands/sync.js.map +1 -0
  26. package/dist/types/index.d.ts +61 -0
  27. package/dist/types/index.d.ts.map +1 -0
  28. package/dist/types/index.js +5 -0
  29. package/dist/types/index.js.map +1 -0
  30. package/dist/utils/components.d.ts +76 -0
  31. package/dist/utils/components.d.ts.map +1 -0
  32. package/dist/utils/components.js +208 -0
  33. package/dist/utils/components.js.map +1 -0
  34. package/dist/utils/config.d.ts +9 -0
  35. package/dist/utils/config.d.ts.map +1 -0
  36. package/dist/utils/config.js +78 -0
  37. package/dist/utils/config.js.map +1 -0
  38. package/dist/utils/dependencies.d.ts +23 -0
  39. package/dist/utils/dependencies.d.ts.map +1 -0
  40. package/dist/utils/dependencies.js +93 -0
  41. package/dist/utils/dependencies.js.map +1 -0
  42. package/dist/utils/files.d.ts +48 -0
  43. package/dist/utils/files.d.ts.map +1 -0
  44. package/dist/utils/files.js +171 -0
  45. package/dist/utils/files.js.map +1 -0
  46. package/dist/utils/logger.d.ts +11 -0
  47. package/dist/utils/logger.d.ts.map +1 -0
  48. package/dist/utils/logger.js +34 -0
  49. package/dist/utils/logger.js.map +1 -0
  50. package/package.json +60 -0
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * AgnosticUI CLI - Main entry point
4
+ *
5
+ * Package Resolution Strategy:
6
+ * ============================
7
+ *
8
+ * The CLI uses a two-tier approach to locate the AgnosticUI core library:
9
+ *
10
+ * 1. Local Development (Priority):
11
+ * - Checks for: ../../dist/agnosticui-local-v2.0.0-alpha.tar.gz
12
+ * - Built via: ./scripts/build-local-tarball.sh
13
+ * - Used for: Testing changes before publishing
14
+ *
15
+ * 2. Production (NPM Registry):
16
+ * - Downloads: agnosticui-core@{version} from NPM
17
+ * - Command: npm pack agnosticui-core@alpha (or latest, or specific version)
18
+ * - Used for: Production installations after publishing
19
+ *
20
+ * Package Naming:
21
+ * - Local tarball: agnosticui-local-v*.tar.gz
22
+ * - NPM package: agnosticui-core
23
+ * - This CLI: agnosticui-cli
24
+ *
25
+ * Note: The different naming prevents confusion between local dev builds
26
+ * and published NPM packages.
27
+ *
28
+ * See: v2/cli/README.md "Testing After NPM Publication" for verification steps.
29
+ */
30
+ import { Command } from 'commander';
31
+ import { init } from './commands/init.js';
32
+ import { add } from './commands/add.js';
33
+ import { remove } from './commands/remove.js';
34
+ import { list } from './commands/list.js';
35
+ import { sync } from './commands/sync.js';
36
+ const program = new Command();
37
+ program
38
+ .name('ag')
39
+ .description('AgnosticUI Local - The UI kit that lives in your codebase')
40
+ .version('2.0.0-alpha.2');
41
+ // ag init command
42
+ program
43
+ .command('init')
44
+ .description('Initialize AgnosticUI Local in your project')
45
+ .option('-f, --framework <framework>', 'Framework to use (react, vue, lit, svelte)')
46
+ .option('-p, --components-path <path>', 'Path where components will be generated')
47
+ .option('-t, --tarball <path>', 'Path to local tarball (for development)')
48
+ .option('-v, --version <version>', 'NPM version to download (e.g., alpha, latest, 2.0.0)', 'alpha')
49
+ .action(async (options) => {
50
+ await init({
51
+ framework: options.framework,
52
+ componentsPath: options.componentsPath,
53
+ tarball: options.tarball,
54
+ version: options.version,
55
+ });
56
+ });
57
+ // ag add command
58
+ program
59
+ .command('add <components...>')
60
+ .description('Add component(s) to your project')
61
+ .option('--force', 'Overwrite existing components')
62
+ .action(async (components, options) => {
63
+ await add(components, {
64
+ force: options.force,
65
+ });
66
+ });
67
+ // ag remove command
68
+ program
69
+ .command('remove <components...>')
70
+ .description('Remove component(s) from your project')
71
+ .option('--force', 'Skip confirmation prompt')
72
+ .action(async (components, options) => {
73
+ await remove(components, {
74
+ force: options.force,
75
+ });
76
+ });
77
+ // ag list command
78
+ program
79
+ .command('list')
80
+ .description('List available components')
81
+ .action(async () => {
82
+ await list();
83
+ });
84
+ // ag sync command
85
+ program
86
+ .command('sync')
87
+ .description('Update reference library from tarball')
88
+ .option('-t, --tarball <path>', 'Path to tarball (overrides config)')
89
+ .option('--force', 'Bypass confirmation prompt')
90
+ .action(async (options) => {
91
+ await sync({
92
+ tarball: options.tarball,
93
+ force: options.force,
94
+ });
95
+ });
96
+ // Parse arguments
97
+ program.parse();
98
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC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K;KACrB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,oBAAoB;AACpB,OAAO;KACJ,OAAO,CAAC,wBAAwB,CAAC;KACjC,WAAW,CAAC,uCAAuC,CAAC;KACpD,MAAM,CAAC,SAAS,EAAE,0BAA0B,CAAC;KAC7C,MAAM,CAAC,KAAK,EAAE,UAAoB,EAAE,OAAO,EAAE,EAAE;IAC9C,MAAM,MAAM,CAAC,UAAU,EAAE;QACvB,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,kBAAkB;AAClB,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,2BAA2B,CAAC;KACxC,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,IAAI,EAAE,CAAC;AACf,CAAC,CAAC,CAAC;AAEL,kBAAkB;AAClB,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,uCAAuC,CAAC;KACpD,MAAM,CAAC,sBAAsB,EAAE,oCAAoC,CAAC;KACpE,MAAM,CAAC,SAAS,EAAE,4BAA4B,CAAC;KAC/C,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,MAAM,IAAI,CAAC;QACT,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,kBAAkB;AAClB,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { AddOptions } from '../types/index.js';
2
+ export declare function add(componentNames: string[], options?: AddOptions): Promise<void>;
3
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,mBAAmB,CAAC;AAe/D,wBAAsB,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA8M3F"}
@@ -0,0 +1,464 @@
1
+ /**
2
+ * ag add command - Add components to the project
3
+ */
4
+ import * as p from '@clack/prompts';
5
+ import path from 'node:path';
6
+ import { stat, readdir, readFile, writeFile } from 'node:fs/promises';
7
+ import { logger } from '../utils/logger.js';
8
+ import { loadConfig, saveConfig, addComponentToConfig, hasComponent } from '../utils/config.js';
9
+ import { ensureDir, pathExists } from '../utils/files.js';
10
+ import { getAvailableComponents, componentExists, getComponentSourcePaths, normalizeComponentName, scanForSharedDependencies, scanForComponentDependencies, getSharedComponentSourcePaths, } from '../utils/components.js';
11
+ import pc from 'picocolors';
12
+ export async function add(componentNames, options = {}) {
13
+ // Setup signal handlers to allow Control-C to work
14
+ let spinner = null;
15
+ const handleExit = () => {
16
+ if (spinner) {
17
+ spinner.stop('Operation cancelled');
18
+ }
19
+ process.exit(130); // Standard exit code for SIGINT
20
+ };
21
+ process.on('SIGINT', handleExit);
22
+ process.on('SIGTERM', handleExit);
23
+ try {
24
+ // Load config
25
+ const config = await loadConfig();
26
+ if (!config) {
27
+ logger.error('AgnosticUI is not initialized in this project.');
28
+ logger.info('Run ' + pc.cyan('npx ag init') + ' to get started.');
29
+ process.exit(1);
30
+ }
31
+ const referencePath = path.resolve(config.paths.reference);
32
+ const componentsPath = path.resolve(config.paths.components);
33
+ // Validate reference library exists
34
+ if (!pathExists(referencePath)) {
35
+ logger.error(`Reference library not found at: ${referencePath}`);
36
+ logger.info('Please run ' + pc.cyan('npx ag init') + ' again.');
37
+ process.exit(1);
38
+ }
39
+ // Get available components
40
+ const availableComponents = await getAvailableComponents(referencePath);
41
+ // Normalize and validate component names
42
+ const normalizedNames = componentNames.map(normalizeComponentName);
43
+ const invalidComponents = normalizedNames.filter(name => !availableComponents.includes(name));
44
+ if (invalidComponents.length > 0) {
45
+ logger.error(`Invalid component(s): ${invalidComponents.join(', ')}`);
46
+ logger.info('Run ' + pc.cyan('npx ag list') + ' to see available components.');
47
+ process.exit(1);
48
+ }
49
+ // Check for already added components (unless --force)
50
+ if (!options.force) {
51
+ const alreadyAdded = normalizedNames.filter(name => hasComponent(config, name));
52
+ if (alreadyAdded.length > 0) {
53
+ logger.warn(`Component(s) already added: ${alreadyAdded.join(', ')}`);
54
+ logger.info('Use ' + pc.cyan('--force') + ' to overwrite.');
55
+ // Filter out already added components
56
+ const toAdd = normalizedNames.filter(name => !alreadyAdded.includes(name));
57
+ if (toAdd.length === 0) {
58
+ process.exit(0);
59
+ }
60
+ // Continue with remaining components
61
+ componentNames = toAdd;
62
+ }
63
+ else {
64
+ componentNames = normalizedNames;
65
+ }
66
+ }
67
+ else {
68
+ componentNames = normalizedNames;
69
+ }
70
+ // Process each component
71
+ spinner = p.spinner();
72
+ const results = [];
73
+ // Start spinner once before the loop
74
+ spinner.start('Processing components...');
75
+ for (let i = 0; i < componentNames.length; i++) {
76
+ const componentName = componentNames[i];
77
+ const progress = `[${i + 1}/${componentNames.length}]`;
78
+ // Update spinner message, don't call start() again
79
+ spinner.message(`${progress} Adding ${componentName}...`);
80
+ try {
81
+ const files = await addComponent(componentName, referencePath, componentsPath, config.framework, config.paths.components);
82
+ // Process shared component dependencies (e.g., CloseButton)
83
+ spinner.message(`${progress} Processing shared dependencies for ${componentName}...`);
84
+ const sharedFiles = await processSharedDependencies(files, referencePath, componentsPath, config.paths.components, spinner, progress);
85
+ files.push(...sharedFiles);
86
+ // Process component dependencies (e.g., CopyButton depends on IconButton)
87
+ spinner.message(`${progress} Processing component dependencies for ${componentName}...`);
88
+ const componentFiles = await processComponentDependencies(files, referencePath, componentsPath, config.framework, config.paths.components, config, spinner, progress);
89
+ files.push(...componentFiles);
90
+ // Note: utils, styles, types, and shared files are now copied during 'npx ag init'
91
+ // so we don't need to scan for them here
92
+ results.push({ name: componentName, success: true, files });
93
+ spinner.message(`${progress} Added ${componentName}`);
94
+ }
95
+ catch (error) {
96
+ results.push({ name: componentName, success: false, files: [] });
97
+ spinner.stop(`${progress} Failed to add ${componentName}`);
98
+ logger.error(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
99
+ // Restart spinner for next component only if there are more components
100
+ if (i < componentNames.length - 1) {
101
+ spinner = p.spinner();
102
+ spinner.start(`Processing remaining components...`);
103
+ }
104
+ }
105
+ }
106
+ // Stop spinner if it's still running (in case all components succeeded)
107
+ if (spinner) {
108
+ spinner.stop();
109
+ }
110
+ // Update config with successfully added components
111
+ let updatedConfig = config;
112
+ for (const result of results) {
113
+ if (result.success) {
114
+ updatedConfig = addComponentToConfig(updatedConfig, result.name, '2.0.0-alpha', result.files);
115
+ }
116
+ }
117
+ await saveConfig(updatedConfig);
118
+ // Display results
119
+ const successCount = results.filter(r => r.success).length;
120
+ const failureCount = results.filter(r => !r.success).length;
121
+ logger.newline();
122
+ if (successCount > 0) {
123
+ logger.success(`Added ${successCount} component(s) successfully!`);
124
+ logger.newline();
125
+ // Show import examples for each added component
126
+ for (const result of results) {
127
+ if (result.success) {
128
+ // Calculate import path relative to src/ directory (where most app files are)
129
+ const fullComponentPath = path.join(componentsPath, result.name);
130
+ let importPath = path.relative(process.cwd(), fullComponentPath);
131
+ // If the path starts with 'src/', remove it since imports are typically
132
+ // from files already in src/
133
+ if (importPath.startsWith('src' + path.sep)) {
134
+ importPath = importPath.substring(4); // Remove 'src/'
135
+ }
136
+ else if (importPath.startsWith('src/')) {
137
+ importPath = importPath.substring(4); // Remove 'src/' (forward slash)
138
+ }
139
+ let importStatement = '';
140
+ const componentExportName = getComponentExportName(result.name, config.framework);
141
+ if (config.framework === 'react' || config.framework === 'vue') {
142
+ // React and Vue have framework-specific wrapper components
143
+ importStatement = `import { ${componentExportName} } from './${importPath}/${config.framework}/${componentExportName}'`;
144
+ }
145
+ else {
146
+ // Lit, Svelte, etc. use web components from core directory (side-effect import)
147
+ importStatement = `import './${importPath}/core/${result.name}'`;
148
+ }
149
+ logger.box(`${result.name}:`, [
150
+ pc.dim('Import in your app (assuming consuming script is in src/):'),
151
+ ' ' + logger.command(importStatement),
152
+ '',
153
+ pc.dim('Files created:'),
154
+ ...result.files.map(f => ' ' + pc.dim(f)),
155
+ ]);
156
+ }
157
+ }
158
+ }
159
+ if (failureCount > 0) {
160
+ logger.error(`Failed to add ${failureCount} component(s).`);
161
+ process.exit(1);
162
+ }
163
+ }
164
+ finally {
165
+ // Clean up signal handlers
166
+ process.off('SIGINT', handleExit);
167
+ process.off('SIGTERM', handleExit);
168
+ }
169
+ }
170
+ /**
171
+ * Add a single component
172
+ */
173
+ async function addComponent(componentName, referencePath, componentsPath, framework, configComponentsPath) {
174
+ // Verify component exists
175
+ if (!(await componentExists(referencePath, componentName))) {
176
+ throw new Error(`Component "${componentName}" not found in reference library`);
177
+ }
178
+ // Get source paths
179
+ const sourcePaths = getComponentSourcePaths(referencePath, componentName, framework);
180
+ // Create destination directory
181
+ const destPath = path.join(componentsPath, componentName);
182
+ await ensureDir(destPath);
183
+ const copiedFiles = [];
184
+ // Copy core directory (always needed)
185
+ if (pathExists(sourcePaths.core)) {
186
+ const destCore = path.join(destPath, 'core');
187
+ await copyAndTransform(sourcePaths.core, destCore, configComponentsPath);
188
+ // Track files (relative to project root)
189
+ copiedFiles.push(path.join(destPath, 'core'));
190
+ }
191
+ // Copy framework-specific directory
192
+ if (pathExists(sourcePaths.framework)) {
193
+ const destFramework = path.join(destPath, framework);
194
+ await copyAndTransform(sourcePaths.framework, destFramework, configComponentsPath);
195
+ // Track files (relative to project root)
196
+ copiedFiles.push(path.join(destPath, framework));
197
+ }
198
+ else {
199
+ // For Lit, we use the core component directly, so it's okay if a specific 'lit' folder doesn't exist
200
+ if (framework !== 'lit') {
201
+ throw new Error(`${framework} implementation not found for ${componentName}`);
202
+ }
203
+ }
204
+ return copiedFiles;
205
+ }
206
+ /**
207
+ * Get the export name for a component based on framework
208
+ */
209
+ function getComponentExportName(componentName, framework) {
210
+ if (framework === 'react') {
211
+ return `React${componentName}`;
212
+ }
213
+ else if (framework === 'vue') {
214
+ return `Vue${componentName}`;
215
+ }
216
+ else {
217
+ return componentName;
218
+ }
219
+ }
220
+ /**
221
+ * Process shared dependencies for a list of files
222
+ */
223
+ async function processSharedDependencies(files, referencePath, componentsPath, configComponentsPath, spinner, progress, processed = new Set(), depth = 0, scannedFiles = new Set()) {
224
+ // Prevent infinite recursion - max depth of 10 levels
225
+ if (depth > 10) {
226
+ logger.warn('Maximum dependency depth reached (10 levels). Stopping recursive dependency scan.');
227
+ return [];
228
+ }
229
+ const newFiles = [];
230
+ for (const fileOrDir of files) {
231
+ const absPath = path.resolve(process.cwd(), fileOrDir);
232
+ // Skip if we've already scanned this path
233
+ if (scannedFiles.has(absPath)) {
234
+ continue;
235
+ }
236
+ scannedFiles.add(absPath);
237
+ let filesToScan = [];
238
+ try {
239
+ const stats = await stat(absPath);
240
+ if (stats.isDirectory()) {
241
+ const children = await readdir(absPath);
242
+ filesToScan = children
243
+ .filter(f => /\.(ts|js|tsx|jsx|vue|svelte)$/.test(f))
244
+ .map(f => path.join(absPath, f))
245
+ .slice(0, 100); // Limit to first 100 files to prevent hangs
246
+ }
247
+ else {
248
+ if (/\.(ts|js|tsx|jsx|vue|svelte)$/.test(absPath)) {
249
+ filesToScan = [absPath];
250
+ }
251
+ }
252
+ }
253
+ catch (err) {
254
+ // Silently skip files that can't be accessed
255
+ continue;
256
+ }
257
+ for (const file of filesToScan) {
258
+ // Skip if we've already scanned this file
259
+ if (scannedFiles.has(file)) {
260
+ continue;
261
+ }
262
+ scannedFiles.add(file);
263
+ const deps = await scanForSharedDependencies(file);
264
+ for (const dep of deps) {
265
+ if (processed.has(dep))
266
+ continue;
267
+ processed.add(dep);
268
+ try {
269
+ // Add this shared component
270
+ const sharedFiles = await addSharedComponent(dep, referencePath, componentsPath, configComponentsPath);
271
+ newFiles.push(...sharedFiles);
272
+ // Update spinner with dependency info
273
+ if (spinner && progress) {
274
+ spinner.message(`${progress} Processing shared dependency: ${dep}...`);
275
+ }
276
+ // Recursively process its deps
277
+ const recursiveFiles = await processSharedDependencies(sharedFiles, referencePath, componentsPath, configComponentsPath, spinner, progress, processed, depth + 1, scannedFiles);
278
+ newFiles.push(...recursiveFiles);
279
+ }
280
+ catch (error) {
281
+ logger.warn(`Failed to add shared component "${dep}": ${error instanceof Error ? error.message : 'Unknown error'}`);
282
+ }
283
+ }
284
+ }
285
+ }
286
+ return newFiles;
287
+ }
288
+ /**
289
+ * Add a shared component
290
+ */
291
+ async function addSharedComponent(componentName, referencePath, componentsPath, configComponentsPath) {
292
+ const sourcePaths = getSharedComponentSourcePaths(referencePath, componentName);
293
+ const destPath = path.join(componentsPath, 'shared', componentName); // src/components/ag/shared/Name
294
+ await ensureDir(destPath);
295
+ if (pathExists(sourcePaths.path)) {
296
+ await copyAndTransform(sourcePaths.path, destPath, configComponentsPath);
297
+ return [path.join(destPath)];
298
+ }
299
+ else {
300
+ throw new Error(`Shared component "${componentName}" not found at ${sourcePaths.path}`);
301
+ }
302
+ }
303
+ /**
304
+ * Process component dependencies for a list of files
305
+ * Handles cases like CopyButton depending on IconButton
306
+ */
307
+ async function processComponentDependencies(files, referencePath, componentsPath, framework, configComponentsPath, config, spinner, progress, processed = new Set(), depth = 0, scannedFiles = new Set()) {
308
+ // Prevent infinite recursion
309
+ if (depth > 10) {
310
+ logger.warn('Maximum component dependency depth reached (10 levels).');
311
+ return [];
312
+ }
313
+ const newFiles = [];
314
+ for (const fileOrDir of files) {
315
+ const absPath = path.resolve(process.cwd(), fileOrDir);
316
+ // Skip if we've already scanned this path
317
+ if (scannedFiles.has(absPath)) {
318
+ continue;
319
+ }
320
+ scannedFiles.add(absPath);
321
+ let filesToScan = [];
322
+ try {
323
+ const stats = await stat(absPath);
324
+ if (stats.isDirectory()) {
325
+ const children = await readdir(absPath);
326
+ filesToScan = children
327
+ .filter(f => /\.(ts|js|tsx|jsx|vue|svelte)$/.test(f))
328
+ .map(f => path.join(absPath, f))
329
+ .slice(0, 100);
330
+ }
331
+ else {
332
+ if (/\.(ts|js|tsx|jsx|vue|svelte)$/.test(absPath)) {
333
+ filesToScan = [absPath];
334
+ }
335
+ }
336
+ }
337
+ catch (err) {
338
+ continue;
339
+ }
340
+ for (const file of filesToScan) {
341
+ // Skip if we've already scanned this file
342
+ if (scannedFiles.has(file)) {
343
+ continue;
344
+ }
345
+ scannedFiles.add(file);
346
+ const deps = await scanForComponentDependencies(file);
347
+ for (const dep of deps) {
348
+ if (processed.has(dep))
349
+ continue;
350
+ // Check if component is already added
351
+ if (hasComponent(config, dep)) {
352
+ processed.add(dep);
353
+ continue;
354
+ }
355
+ processed.add(dep);
356
+ try {
357
+ // Update spinner with dependency info
358
+ if (spinner && progress) {
359
+ spinner.message(`${progress} Adding component dependency: ${dep}...`);
360
+ }
361
+ else {
362
+ logger.info(` → Detected dependency: ${dep}`);
363
+ }
364
+ // Add the component using the same logic as the main add
365
+ const componentFiles = await addComponent(dep, referencePath, componentsPath, framework, configComponentsPath);
366
+ newFiles.push(...componentFiles);
367
+ // Update config for this dependency
368
+ config = addComponentToConfig(config, dep, '2.0.0-alpha', componentFiles);
369
+ // Recursively process dependencies of this component
370
+ const recursiveFiles = await processComponentDependencies(componentFiles, referencePath, componentsPath, framework, configComponentsPath, config, spinner, progress, processed, depth + 1, scannedFiles);
371
+ newFiles.push(...recursiveFiles);
372
+ }
373
+ catch (error) {
374
+ logger.warn(`Failed to add component dependency "${dep}": ${error instanceof Error ? error.message : 'Unknown error'}`);
375
+ }
376
+ }
377
+ }
378
+ }
379
+ return newFiles;
380
+ }
381
+ /**
382
+ * Calculate the number of '../' needed based on components path depth
383
+ * Reference library: src/components/BadgeFx/core/_File.ts uses ../../../ to reach src/
384
+ * User's project: src/components/ag/BadgeFx/core/_File.ts should use ../../../../ to reach src/
385
+ */
386
+ function calculatePathDepth(componentsPath) {
387
+ // Normalize the path and remove leading './'
388
+ const normalized = componentsPath.replace(/^\.\//, '');
389
+ // Find the position of 'src' in the path
390
+ const parts = normalized.split('/').filter(s => s.length > 0);
391
+ const srcIndex = parts.indexOf('src');
392
+ if (srcIndex === -1) {
393
+ // No 'src' directory, assume styles/types/utils are at project root
394
+ // Count all segments + ComponentName + core
395
+ return parts.length + 2;
396
+ }
397
+ // Count segments after 'src' (e.g., for 'src/components/ag' -> ['components', 'ag'] = 2)
398
+ const segmentsAfterSrc = parts.slice(srcIndex + 1);
399
+ // Add 2 for ComponentName/core/
400
+ return segmentsAfterSrc.length + 2;
401
+ }
402
+ /**
403
+ * Copy directory and transform extension from .js to empty in imports
404
+ */
405
+ async function copyAndTransform(src, dest, componentsPath) {
406
+ await ensureDir(dest);
407
+ const entries = await readdir(src, { withFileTypes: true });
408
+ // Calculate how many '../' we need for the user's project structure
409
+ const userDepth = calculatePathDepth(componentsPath);
410
+ const referenceDepth = 3; // Reference library uses ../../../ for src/components/Component/core/
411
+ const extraLevels = userDepth - referenceDepth;
412
+ for (const entry of entries) {
413
+ const srcPath = path.join(src, entry.name);
414
+ const destPath = path.join(dest, entry.name);
415
+ if (entry.name.startsWith('._')) {
416
+ continue;
417
+ }
418
+ // Skip test files
419
+ if (/\.(spec|test)\.(ts|js|tsx|jsx)$/.test(entry.name)) {
420
+ continue;
421
+ }
422
+ if (entry.isDirectory()) {
423
+ await copyAndTransform(srcPath, destPath, componentsPath);
424
+ }
425
+ else {
426
+ // If it is a code file, we transform content
427
+ if (/\.(ts|tsx|js|jsx|vue|svelte)$/.test(entry.name)) {
428
+ let content = await readFile(srcPath, 'utf-8');
429
+ // Transform imports: strip .js extension from relative imports
430
+ // 1. import ... from './something.js' -> import ... from './something'
431
+ // 2. export ... from './something.js' -> export ... from './something'
432
+ // 3. import './something.js' -> import './something'
433
+ content = content.replace(/(from\s+['"]\..+?)\.js(['"])/g, '$1$2');
434
+ content = content.replace(/(import\s+['"]\..+?)\.js(['"])/g, '$1$2');
435
+ // Adjust imports for different nesting depth based on componentsPath
436
+ // Rewrite imports for shared infrastructure
437
+ // Old Reference: ../../../utils/ -> src/utils (via ../../../)
438
+ // New User: ../../utils/ -> src/components/ag/utils (via ../../) assuming we are in src/components/ag/Comp/framework
439
+ // We know that reference code uses:
440
+ // ../../../shared/
441
+ // ../../../utils/
442
+ // ../../../styles/
443
+ // ../../../types/
444
+ // In the new layout, infrastructure is at `componentsPath/utils` etc.
445
+ // A component file is at `componentsPath/Component/framework/file.ts`
446
+ // So valid path is `../../utils/`
447
+ // Replace exact pattern match from reference library styles
448
+ const patterns = ['shared', 'utils', 'styles', 'types'];
449
+ for (const dir of patterns) {
450
+ const regex = new RegExp(`(from\\s+['"]|import\\s+['"])(?:\\.\\.\\/){3}(${dir}\\/)`, 'g');
451
+ content = content.replace(regex, `$1../../$2`);
452
+ }
453
+ // If extraLevels === 0, no transformation needed (same depth as reference)
454
+ await writeFile(destPath, content, 'utf-8');
455
+ }
456
+ else {
457
+ // Just copy binary or other files
458
+ const { copyFile } = await import('node:fs/promises');
459
+ await copyFile(srcPath, destPath);
460
+ }
461
+ }
462
+ }
463
+ }
464
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,4BAA4B,EAC5B,6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,kCAAkC;gBAClC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;gBACtD,MAAM,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { InitOptions } from '../types/index.js';
2
+ export declare function init(options?: InitOptions): Promise<void>;
3
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAehE,wBAAsB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4MnE"}