starwind 1.0.0 → 1.0.1
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/index.js +86 -73
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47,6 +47,7 @@ async function getAllComponents() {
|
|
|
47
47
|
|
|
48
48
|
// src/utils/component.ts
|
|
49
49
|
import semver from "semver";
|
|
50
|
+
import * as p from "@clack/prompts";
|
|
50
51
|
async function copyComponent(name, overwrite = false) {
|
|
51
52
|
const config = await getConfig();
|
|
52
53
|
const currentComponents = Array.isArray(config.components) ? config.components : [];
|
|
@@ -130,6 +131,18 @@ async function updateComponent(name, currentVersion) {
|
|
|
130
131
|
newVersion: registryComponent.version
|
|
131
132
|
};
|
|
132
133
|
}
|
|
134
|
+
const confirmUpdate = await p.confirm({
|
|
135
|
+
message: `Update component ${highlighter.info(name)} from ${highlighter.warn(`v${currentVersion}`)} to ${highlighter.success(`v${registryComponent.version}`)}? This will override the existing implementation.`
|
|
136
|
+
});
|
|
137
|
+
if (!confirmUpdate || p.isCancel(confirmUpdate)) {
|
|
138
|
+
p.log.info(`Skipping update for ${highlighter.info(name)}`);
|
|
139
|
+
return {
|
|
140
|
+
name,
|
|
141
|
+
status: "skipped",
|
|
142
|
+
oldVersion: currentVersion,
|
|
143
|
+
newVersion: registryComponent.version
|
|
144
|
+
};
|
|
145
|
+
}
|
|
133
146
|
const result = await copyComponent(name, true);
|
|
134
147
|
if (result.status === "installed") {
|
|
135
148
|
return {
|
|
@@ -155,7 +168,7 @@ async function updateComponent(name, currentVersion) {
|
|
|
155
168
|
}
|
|
156
169
|
|
|
157
170
|
// src/utils/prompts.ts
|
|
158
|
-
import { confirm, multiselect } from "@clack/prompts";
|
|
171
|
+
import { confirm as confirm2, multiselect } from "@clack/prompts";
|
|
159
172
|
async function selectComponents() {
|
|
160
173
|
const components = await getAllComponents();
|
|
161
174
|
const selected = await multiselect({
|
|
@@ -173,7 +186,7 @@ async function selectComponents() {
|
|
|
173
186
|
}
|
|
174
187
|
async function confirmInstall(component) {
|
|
175
188
|
if (component.dependencies.length === 0) return true;
|
|
176
|
-
const confirmed = await
|
|
189
|
+
const confirmed = await confirm2({
|
|
177
190
|
message: `This component requires the following dependencies: ${component.dependencies.join(", ")}. Install them?`
|
|
178
191
|
});
|
|
179
192
|
if (typeof confirmed === "symbol") {
|
|
@@ -222,25 +235,25 @@ async function isValidComponent(component, availableComponents) {
|
|
|
222
235
|
}
|
|
223
236
|
|
|
224
237
|
// src/commands/add.ts
|
|
225
|
-
import * as
|
|
238
|
+
import * as p2 from "@clack/prompts";
|
|
226
239
|
var { init: init2 } = await import("./init-JA2KC6GS.js");
|
|
227
240
|
async function add(components, options) {
|
|
228
241
|
try {
|
|
229
|
-
|
|
242
|
+
p2.intro(highlighter.title(" Welcome to the Starwind CLI "));
|
|
230
243
|
const configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);
|
|
231
244
|
if (!configExists) {
|
|
232
|
-
const shouldInit = await
|
|
245
|
+
const shouldInit = await p2.confirm({
|
|
233
246
|
message: `Starwind configuration not found. Would you like to run ${highlighter.info("starwind init")} now?`,
|
|
234
247
|
initialValue: true
|
|
235
248
|
});
|
|
236
|
-
if (
|
|
237
|
-
|
|
249
|
+
if (p2.isCancel(shouldInit)) {
|
|
250
|
+
p2.cancel("Operation cancelled");
|
|
238
251
|
process.exit(0);
|
|
239
252
|
}
|
|
240
253
|
if (shouldInit) {
|
|
241
254
|
await init2(true);
|
|
242
255
|
} else {
|
|
243
|
-
|
|
256
|
+
p2.log.error(
|
|
244
257
|
`Please initialize starwind with ${highlighter.info("starwind init")} before adding components`
|
|
245
258
|
);
|
|
246
259
|
process.exit(1);
|
|
@@ -250,7 +263,7 @@ async function add(components, options) {
|
|
|
250
263
|
if (options?.all) {
|
|
251
264
|
const availableComponents = await getAllComponents();
|
|
252
265
|
componentsToInstall = availableComponents.map((c) => c.name);
|
|
253
|
-
|
|
266
|
+
p2.log.info(`Adding all ${componentsToInstall.length} available components...`);
|
|
254
267
|
} else if (components && components.length > 0) {
|
|
255
268
|
const availableComponents = await getAllComponents();
|
|
256
269
|
const { valid, invalid } = await components.reduce(
|
|
@@ -267,7 +280,7 @@ async function add(components, options) {
|
|
|
267
280
|
Promise.resolve({ valid: [], invalid: [] })
|
|
268
281
|
);
|
|
269
282
|
if (invalid.length > 0) {
|
|
270
|
-
|
|
283
|
+
p2.log.warn(
|
|
271
284
|
`${highlighter.warn("Invalid components found:")}
|
|
272
285
|
${invalid.map((name) => ` ${name}`).join("\n")}`
|
|
273
286
|
);
|
|
@@ -275,28 +288,28 @@ ${invalid.map((name) => ` ${name}`).join("\n")}`
|
|
|
275
288
|
if (valid.length > 0) {
|
|
276
289
|
componentsToInstall = valid;
|
|
277
290
|
} else {
|
|
278
|
-
|
|
279
|
-
|
|
291
|
+
p2.log.warn(`${highlighter.warn("No valid components to install")}`);
|
|
292
|
+
p2.cancel("Operation cancelled");
|
|
280
293
|
return process.exit(0);
|
|
281
294
|
}
|
|
282
295
|
} else {
|
|
283
296
|
const selected = await selectComponents();
|
|
284
297
|
if (!selected) {
|
|
285
|
-
|
|
298
|
+
p2.cancel("No components selected");
|
|
286
299
|
return process.exit(0);
|
|
287
300
|
}
|
|
288
301
|
componentsToInstall = selected;
|
|
289
302
|
}
|
|
290
303
|
if (componentsToInstall.length === 0) {
|
|
291
|
-
|
|
292
|
-
|
|
304
|
+
p2.log.warn(`${highlighter.warn("No components selected")}`);
|
|
305
|
+
p2.cancel("Operation cancelled");
|
|
293
306
|
return process.exit(0);
|
|
294
307
|
}
|
|
295
|
-
const confirmed = await
|
|
308
|
+
const confirmed = await p2.confirm({
|
|
296
309
|
message: `Install ${componentsToInstall.map((comp) => highlighter.info(comp)).join(", ")} ${componentsToInstall.length > 1 ? "components" : "component"}?`
|
|
297
310
|
});
|
|
298
|
-
if (!confirmed ||
|
|
299
|
-
|
|
311
|
+
if (!confirmed || p2.isCancel(confirmed)) {
|
|
312
|
+
p2.cancel("Operation cancelled");
|
|
300
313
|
return process.exit(0);
|
|
301
314
|
}
|
|
302
315
|
const results = {
|
|
@@ -324,68 +337,68 @@ ${invalid.map((name) => ` ${name}`).join("\n")}`
|
|
|
324
337
|
try {
|
|
325
338
|
await updateConfig({ components: installedComponents }, { appendComponents: true });
|
|
326
339
|
} catch (error) {
|
|
327
|
-
|
|
340
|
+
p2.log.error(
|
|
328
341
|
`Failed to update config: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
329
342
|
);
|
|
330
343
|
process.exit(1);
|
|
331
344
|
}
|
|
332
345
|
}
|
|
333
|
-
|
|
346
|
+
p2.log.message(`
|
|
334
347
|
|
|
335
348
|
${highlighter.underline("Installation Summary")}`);
|
|
336
349
|
if (results.installed.length > 0) {
|
|
337
|
-
|
|
350
|
+
p2.log.success(
|
|
338
351
|
`${highlighter.success("Successfully installed components:")}
|
|
339
352
|
${results.installed.map((r) => ` ${r.name} v${r.version}`).join("\n")}`
|
|
340
353
|
);
|
|
341
354
|
}
|
|
342
355
|
if (results.skipped.length > 0) {
|
|
343
|
-
|
|
356
|
+
p2.log.warn(
|
|
344
357
|
`${highlighter.warn("Skipped components (already installed):")}
|
|
345
358
|
${results.skipped.map((r) => ` ${r.name} v${r.version}`).join("\n")}`
|
|
346
359
|
);
|
|
347
360
|
}
|
|
348
361
|
if (results.failed.length > 0) {
|
|
349
|
-
|
|
362
|
+
p2.log.error(
|
|
350
363
|
`${highlighter.error("Failed to install components:")}
|
|
351
364
|
${results.failed.map((r) => ` ${r.name} - ${r.error}`).join("\n")}`
|
|
352
365
|
);
|
|
353
366
|
}
|
|
354
367
|
await sleep(1e3);
|
|
355
|
-
|
|
368
|
+
p2.outro("Enjoy using Starwind UI \u{1F680}");
|
|
356
369
|
} catch (error) {
|
|
357
|
-
|
|
358
|
-
|
|
370
|
+
p2.log.error(error instanceof Error ? error.message : "Failed to add components");
|
|
371
|
+
p2.cancel("Operation cancelled");
|
|
359
372
|
process.exit(1);
|
|
360
373
|
}
|
|
361
374
|
}
|
|
362
375
|
|
|
363
376
|
// src/commands/remove.ts
|
|
364
|
-
import * as
|
|
377
|
+
import * as p3 from "@clack/prompts";
|
|
365
378
|
async function remove(components, options) {
|
|
366
379
|
try {
|
|
367
|
-
|
|
380
|
+
p3.intro(highlighter.title(" Welcome to the Starwind CLI "));
|
|
368
381
|
const configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);
|
|
369
382
|
if (!configExists) {
|
|
370
|
-
|
|
383
|
+
p3.log.error("No Starwind configuration found. Please run starwind init first.");
|
|
371
384
|
process.exit(1);
|
|
372
385
|
}
|
|
373
386
|
const config = await getConfig();
|
|
374
387
|
const installedComponents = config.components;
|
|
375
388
|
if (installedComponents.length === 0) {
|
|
376
|
-
|
|
389
|
+
p3.log.warn("No components are currently installed.");
|
|
377
390
|
process.exit(0);
|
|
378
391
|
}
|
|
379
392
|
let componentsToRemove = [];
|
|
380
393
|
if (options?.all) {
|
|
381
394
|
componentsToRemove = installedComponents.map((comp) => comp.name);
|
|
382
|
-
|
|
395
|
+
p3.log.info(`Removing all ${componentsToRemove.length} installed components...`);
|
|
383
396
|
} else if (components && components.length > 0) {
|
|
384
397
|
const invalid = components.filter(
|
|
385
398
|
(comp) => !installedComponents.some((ic) => ic.name === comp)
|
|
386
399
|
);
|
|
387
400
|
if (invalid.length > 0) {
|
|
388
|
-
|
|
401
|
+
p3.log.warn(
|
|
389
402
|
`${highlighter.warn("Components not found:")}
|
|
390
403
|
${invalid.map((name) => ` ${name}`).join("\n")}`
|
|
391
404
|
);
|
|
@@ -394,7 +407,7 @@ ${invalid.map((name) => ` ${name}`).join("\n")}`
|
|
|
394
407
|
(comp) => installedComponents.some((ic) => ic.name === comp)
|
|
395
408
|
);
|
|
396
409
|
if (componentsToRemove.length === 0) {
|
|
397
|
-
|
|
410
|
+
p3.log.warn("No valid components to remove");
|
|
398
411
|
process.exit(0);
|
|
399
412
|
}
|
|
400
413
|
} else {
|
|
@@ -402,25 +415,25 @@ ${invalid.map((name) => ` ${name}`).join("\n")}`
|
|
|
402
415
|
value: comp.name,
|
|
403
416
|
label: comp.name
|
|
404
417
|
}));
|
|
405
|
-
const selected = await
|
|
418
|
+
const selected = await p3.multiselect({
|
|
406
419
|
message: "Select components to remove",
|
|
407
420
|
options: choices
|
|
408
421
|
});
|
|
409
|
-
if (
|
|
410
|
-
|
|
422
|
+
if (p3.isCancel(selected)) {
|
|
423
|
+
p3.cancel("Operation cancelled");
|
|
411
424
|
process.exit(0);
|
|
412
425
|
}
|
|
413
426
|
componentsToRemove = selected;
|
|
414
427
|
}
|
|
415
428
|
if (componentsToRemove.length === 0) {
|
|
416
|
-
|
|
429
|
+
p3.log.warn("No components selected for removal");
|
|
417
430
|
process.exit(0);
|
|
418
431
|
}
|
|
419
|
-
const confirmed = await
|
|
432
|
+
const confirmed = await p3.confirm({
|
|
420
433
|
message: `Remove ${componentsToRemove.map((comp) => highlighter.info(comp)).join(", ")} ${componentsToRemove.length > 1 ? "components" : "component"}?`
|
|
421
434
|
});
|
|
422
|
-
if (!confirmed ||
|
|
423
|
-
|
|
435
|
+
if (!confirmed || p3.isCancel(confirmed)) {
|
|
436
|
+
p3.cancel("Operation cancelled");
|
|
424
437
|
process.exit(0);
|
|
425
438
|
}
|
|
426
439
|
const results = {
|
|
@@ -445,61 +458,61 @@ ${invalid.map((name) => ` ${name}`).join("\n")}`
|
|
|
445
458
|
},
|
|
446
459
|
{ appendComponents: false }
|
|
447
460
|
);
|
|
448
|
-
|
|
461
|
+
p3.log.message(`
|
|
449
462
|
|
|
450
463
|
${highlighter.underline("Removal Summary")}`);
|
|
451
464
|
if (results.removed.length > 0) {
|
|
452
|
-
|
|
465
|
+
p3.log.success(
|
|
453
466
|
`${highlighter.success("Successfully removed components:")}
|
|
454
467
|
${results.removed.map((r) => ` ${r.name}`).join("\n")}`
|
|
455
468
|
);
|
|
456
469
|
}
|
|
457
470
|
if (results.failed.length > 0) {
|
|
458
|
-
|
|
471
|
+
p3.log.error(
|
|
459
472
|
`${highlighter.error("Failed to remove components:")}
|
|
460
473
|
${results.failed.map((r) => ` ${r.name} - ${r.error}`).join("\n")}`
|
|
461
474
|
);
|
|
462
475
|
}
|
|
463
476
|
await sleep(1e3);
|
|
464
477
|
if (results.removed.length > 0) {
|
|
465
|
-
|
|
478
|
+
p3.outro("Components removed successfully \u{1F5D1}\uFE0F");
|
|
466
479
|
} else {
|
|
467
|
-
|
|
480
|
+
p3.cancel("Errors occurred while removing components");
|
|
468
481
|
process.exit(1);
|
|
469
482
|
}
|
|
470
483
|
} catch (error) {
|
|
471
|
-
|
|
472
|
-
|
|
484
|
+
p3.log.error(error instanceof Error ? error.message : "Failed to remove components");
|
|
485
|
+
p3.cancel("Operation cancelled");
|
|
473
486
|
process.exit(1);
|
|
474
487
|
}
|
|
475
488
|
}
|
|
476
489
|
|
|
477
490
|
// src/commands/update.ts
|
|
478
|
-
import * as
|
|
491
|
+
import * as p4 from "@clack/prompts";
|
|
479
492
|
async function update(components, options) {
|
|
480
493
|
try {
|
|
481
|
-
|
|
494
|
+
p4.intro(highlighter.title(" Welcome to the Starwind CLI "));
|
|
482
495
|
const configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);
|
|
483
496
|
if (!configExists) {
|
|
484
|
-
|
|
497
|
+
p4.log.error("No Starwind configuration found. Please run starwind init first.");
|
|
485
498
|
process.exit(1);
|
|
486
499
|
}
|
|
487
500
|
const config = await getConfig();
|
|
488
501
|
const installedComponents = config.components;
|
|
489
502
|
if (installedComponents.length === 0) {
|
|
490
|
-
|
|
503
|
+
p4.log.warn("No components are currently installed.");
|
|
491
504
|
process.exit(0);
|
|
492
505
|
}
|
|
493
506
|
let componentsToUpdate = [];
|
|
494
507
|
if (options?.all) {
|
|
495
508
|
componentsToUpdate = installedComponents.map((comp) => comp.name);
|
|
496
|
-
|
|
509
|
+
p4.log.info(`Checking updates for all ${componentsToUpdate.length} installed components...`);
|
|
497
510
|
} else if (components && components.length > 0) {
|
|
498
511
|
const invalid = components.filter(
|
|
499
512
|
(comp) => !installedComponents.some((ic) => ic.name === comp)
|
|
500
513
|
);
|
|
501
514
|
if (invalid.length > 0) {
|
|
502
|
-
|
|
515
|
+
p4.log.warn(
|
|
503
516
|
`${highlighter.warn("Components not found in project:")}
|
|
504
517
|
${invalid.map((name) => ` ${name}`).join("\n")}`
|
|
505
518
|
);
|
|
@@ -508,7 +521,7 @@ ${invalid.map((name) => ` ${name}`).join("\n")}`
|
|
|
508
521
|
(comp) => installedComponents.some((ic) => ic.name === comp)
|
|
509
522
|
);
|
|
510
523
|
if (componentsToUpdate.length === 0) {
|
|
511
|
-
|
|
524
|
+
p4.log.warn("No valid components to update");
|
|
512
525
|
process.exit(0);
|
|
513
526
|
}
|
|
514
527
|
} else {
|
|
@@ -516,25 +529,25 @@ ${invalid.map((name) => ` ${name}`).join("\n")}`
|
|
|
516
529
|
value: comp.name,
|
|
517
530
|
label: comp.name
|
|
518
531
|
}));
|
|
519
|
-
const selected = await
|
|
532
|
+
const selected = await p4.multiselect({
|
|
520
533
|
message: "Select components to update",
|
|
521
534
|
options: choices
|
|
522
535
|
});
|
|
523
|
-
if (
|
|
524
|
-
|
|
536
|
+
if (p4.isCancel(selected)) {
|
|
537
|
+
p4.cancel("Operation cancelled");
|
|
525
538
|
process.exit(0);
|
|
526
539
|
}
|
|
527
540
|
componentsToUpdate = selected;
|
|
528
541
|
}
|
|
529
542
|
if (componentsToUpdate.length === 0) {
|
|
530
|
-
|
|
543
|
+
p4.log.warn("No components selected for update");
|
|
531
544
|
process.exit(0);
|
|
532
545
|
}
|
|
533
|
-
const confirmed = await
|
|
546
|
+
const confirmed = await p4.confirm({
|
|
534
547
|
message: `Check for updates to ${componentsToUpdate.map((comp) => highlighter.info(comp)).join(", ")} ${componentsToUpdate.length > 1 ? "components" : "component"}?`
|
|
535
548
|
});
|
|
536
|
-
if (!confirmed ||
|
|
537
|
-
|
|
549
|
+
if (!confirmed || p4.isCancel(confirmed)) {
|
|
550
|
+
p4.cancel("Operation cancelled");
|
|
538
551
|
process.exit(0);
|
|
539
552
|
}
|
|
540
553
|
const results = {
|
|
@@ -585,45 +598,45 @@ ${invalid.map((name) => ` ${name}`).join("\n")}`
|
|
|
585
598
|
{ appendComponents: false }
|
|
586
599
|
);
|
|
587
600
|
} catch (error) {
|
|
588
|
-
|
|
601
|
+
p4.log.error(
|
|
589
602
|
`Failed to update config: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
590
603
|
);
|
|
591
604
|
process.exit(1);
|
|
592
605
|
}
|
|
593
606
|
}
|
|
594
|
-
|
|
607
|
+
p4.log.message(`
|
|
595
608
|
|
|
596
609
|
${highlighter.underline("Update Summary")}`);
|
|
597
610
|
if (results.skipped.length > 0) {
|
|
598
|
-
|
|
599
|
-
`${highlighter.info("Components already up to date:")}
|
|
600
|
-
${results.skipped.map((r) => ` ${r.name} (${r.
|
|
611
|
+
p4.log.info(
|
|
612
|
+
`${highlighter.info("Components already up to date or skipped:")}
|
|
613
|
+
${results.skipped.map((r) => ` ${r.name} (${r.oldVersion})`).join("\n")}`
|
|
601
614
|
);
|
|
602
615
|
}
|
|
603
616
|
if (results.updated.length > 0) {
|
|
604
|
-
|
|
617
|
+
p4.log.success(
|
|
605
618
|
`${highlighter.success("Successfully updated components:")}
|
|
606
619
|
${results.updated.map((r) => ` ${r.name} (${r.oldVersion} \u2192 ${r.newVersion})`).join("\n")}`
|
|
607
620
|
);
|
|
608
621
|
}
|
|
609
622
|
if (results.failed.length > 0) {
|
|
610
|
-
|
|
623
|
+
p4.log.error(
|
|
611
624
|
`${highlighter.error("Failed to update components:")}
|
|
612
625
|
${results.failed.map((r) => ` ${r.name} - ${r.error}`).join("\n")}`
|
|
613
626
|
);
|
|
614
627
|
}
|
|
615
628
|
await sleep(1e3);
|
|
616
629
|
if (results.updated.length > 0) {
|
|
617
|
-
|
|
630
|
+
p4.outro("Components updated successfully \u{1F680}");
|
|
618
631
|
} else if (results.skipped.length > 0 && results.failed.length === 0) {
|
|
619
|
-
|
|
632
|
+
p4.outro("Components already up to date or skipped \u2728");
|
|
620
633
|
} else {
|
|
621
|
-
|
|
634
|
+
p4.cancel("No components were updated");
|
|
622
635
|
process.exit(1);
|
|
623
636
|
}
|
|
624
637
|
} catch (error) {
|
|
625
|
-
|
|
626
|
-
|
|
638
|
+
p4.log.error(error instanceof Error ? error.message : "Failed to update components");
|
|
639
|
+
p4.cancel("Operation cancelled");
|
|
627
640
|
process.exit(1);
|
|
628
641
|
}
|
|
629
642
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/utils/component.ts","../src/utils/registry.ts","../src/utils/prompts.ts","../src/utils/install.ts","../src/utils/validate.ts","../src/commands/add.ts","../src/commands/remove.ts","../src/commands/update.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from \"commander\";\nimport { add } from \"./commands/add.js\";\nimport { init } from \"./commands/init.js\";\nimport { remove } from \"./commands/remove.js\";\nimport { update } from \"./commands/update.js\";\n\nconst program = new Command()\n\t.name(\"starwind\")\n\t.description(\"Add beautifully designed components to your Astro applications\")\n\t.version(\"0.0.1\");\n\nprogram\n\t.command(\"init\")\n\t.description(\"Initialize your project with Starwind\")\n\t.option(\"--no-install\", \"Skip dependency installation\")\n\t.action(() => init(false));\n\nprogram\n\t.command(\"add\")\n\t.description(\"Add Starwind components to your project\")\n\t.argument(\"[components...]\", \"The components to add (space separated)\")\n\t.allowExcessArguments()\n\t.option(\"-a, --all\", \"Add all available components\")\n\t.action(add);\n\nprogram\n\t.command(\"update\")\n\t.description(\"Update Starwind components to their latest versions\")\n\t.argument(\"[components...]\", \"The components to update (space separated)\")\n\t.allowExcessArguments()\n\t.option(\"-a, --all\", \"Update all installed components\")\n\t.action(update);\n\nprogram\n\t.command(\"remove\")\n\t.description(\"Remove Starwind components from your project\")\n\t.argument(\"[components...]\", \"The components to remove (space separated)\")\n\t.allowExcessArguments()\n\t.option(\"-a, --all\", \"Remove all installed components\")\n\t.action(remove);\n\nprogram.parse();\n","import * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport fs from \"fs-extra\";\nimport { getConfig, updateConfig } from \"./config.js\";\nimport { PATHS } from \"./constants.js\";\nimport { getRegistry, getComponent } from \"./registry.js\";\nimport semver from \"semver\";\n\nexport type InstallResult = {\n\tstatus: \"installed\" | \"skipped\" | \"failed\";\n\tname: string;\n\tversion?: string;\n\terror?: string;\n};\n\nexport interface RemoveResult {\n\tname: string;\n\tstatus: \"removed\" | \"failed\";\n\terror?: string;\n}\n\nexport interface UpdateResult {\n\tname: string;\n\tstatus: \"updated\" | \"skipped\" | \"failed\";\n\toldVersion?: string;\n\tnewVersion?: string;\n\terror?: string;\n}\n\n/**\n * Copies a component from the core package to the local components directory\n * @param name - The name of the component to copy\n * @param overwrite - If true, will overwrite existing component instead of skipping\n * @returns A result object indicating the installation status\n */\nexport async function copyComponent(name: string, overwrite = false): Promise<InstallResult> {\n\tconst config = await getConfig();\n\n\t// Ensure components array exists\n\tconst currentComponents = Array.isArray(config.components) ? config.components : [];\n\n\t// Check if component already exists\n\tif (!overwrite && currentComponents.some((component) => component.name === name)) {\n\t\tconst existingComponent = currentComponents.find((c) => c.name === name);\n\t\treturn {\n\t\t\tstatus: \"skipped\",\n\t\t\tname,\n\t\t\tversion: existingComponent?.version,\n\t\t};\n\t}\n\n\tconst componentDir = path.join(config.componentDir, \"starwind\", name);\n\n\ttry {\n\t\tawait fs.ensureDir(componentDir);\n\n\t\t// Get the path to the installed @starwind/core package\n\t\tconst pkgUrl = import.meta.resolve?.(PATHS.STARWIND_CORE);\n\t\tif (!pkgUrl) {\n\t\t\tthrow new Error(`Could not resolve ${PATHS.STARWIND_CORE} package, is it installed?`);\n\t\t}\n\n\t\tconst coreDir = path.dirname(fileURLToPath(pkgUrl));\n\t\tconst sourceDir = path.join(coreDir, PATHS.STARWIND_CORE_COMPONENTS, name);\n\n\t\tconst files = await fs.readdir(sourceDir);\n\n\t\tfor (const file of files) {\n\t\t\tconst sourcePath = path.join(sourceDir, file);\n\t\t\tconst destPath = path.join(componentDir, file);\n\t\t\tawait fs.copy(sourcePath, destPath, { overwrite: true });\n\t\t}\n\n\t\t// Get component version from registry\n\t\tconst registry = await getRegistry();\n\t\tconst componentInfo = registry.find((c) => c.name === name);\n\t\tif (!componentInfo) {\n\t\t\tthrow new Error(`Component ${name} not found in registry`);\n\t\t}\n\n\t\treturn {\n\t\t\tstatus: \"installed\",\n\t\t\tname,\n\t\t\tversion: componentInfo.version,\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\tstatus: \"failed\",\n\t\t\tname,\n\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t};\n\t}\n}\n\n/**\n * Removes a component from the project's component directory\n * @param name - The name of the component to remove\n * @param componentDir - The base directory where components are installed\n * @returns A result object indicating the removal status and any errors\n */\nexport async function removeComponent(name: string, componentDir: string): Promise<RemoveResult> {\n\ttry {\n\t\tconst componentPath = path.join(componentDir, \"starwind\", name);\n\n\t\t// Check if component directory exists\n\t\tif (await fs.pathExists(componentPath)) {\n\t\t\t// Remove the component directory\n\t\t\tawait fs.remove(componentPath);\n\t\t\treturn { name, status: \"removed\" };\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tstatus: \"failed\",\n\t\t\t\terror: \"Component directory not found\",\n\t\t\t};\n\t\t}\n\t} catch (error) {\n\t\treturn {\n\t\t\tname,\n\t\t\tstatus: \"failed\",\n\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t};\n\t}\n}\n\n/**\n * Updates a component to its latest version from the registry\n * @param name - The name of the component to update\n * @param currentVersion - The currently installed version\n * @returns A result object indicating the update status\n */\nexport async function updateComponent(name: string, currentVersion: string): Promise<UpdateResult> {\n\ttry {\n\t\t// Get latest version from registry\n\t\tconst registryComponent = await getComponent(name);\n\t\tif (!registryComponent) {\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tstatus: \"failed\",\n\t\t\t\terror: \"Component not found in registry\",\n\t\t\t};\n\t\t}\n\n\t\t// Compare versions\n\t\tif (!semver.gt(registryComponent.version, currentVersion)) {\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tstatus: \"skipped\",\n\t\t\t\toldVersion: currentVersion,\n\t\t\t\tnewVersion: registryComponent.version,\n\t\t\t};\n\t\t}\n\n\t\t// Remove and reinstall component with overwrite enabled\n\t\tconst result = await copyComponent(name, true);\n\n\t\tif (result.status === \"installed\") {\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tstatus: \"updated\",\n\t\t\t\toldVersion: currentVersion,\n\t\t\t\tnewVersion: result.version,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tstatus: \"failed\",\n\t\t\t\terror: result.error || \"Failed to update component\",\n\t\t\t};\n\t\t}\n\t} catch (error) {\n\t\treturn {\n\t\t\tname,\n\t\t\tstatus: \"failed\",\n\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t};\n\t}\n}\n","import { registry } from \"@starwind-ui/core\";\nimport { z } from \"zod\";\n\nconst componentSchema = z.object({\n\tname: z.string(),\n\tversion: z.string(),\n\tdependencies: z.array(z.string()).default([]),\n\ttype: z.enum([\"component\"]),\n});\n\nexport type Component = z.infer<typeof componentSchema>;\n\nconst registrySchema = z.array(componentSchema);\n\nexport async function getRegistry(): Promise<Component[]> {\n\ttry {\n\t\treturn registrySchema.parse(registry);\n\t} catch (error) {\n\t\tconsole.error(\"Failed to load registry:\", error);\n\t\tthrow error;\n\t}\n}\n\nexport async function getComponent(name: string): Promise<Component | undefined> {\n\tconst registry = await getRegistry();\n\treturn registry.find((component) => component.name === name);\n}\n\nexport async function getAllComponents(): Promise<Component[]> {\n\treturn getRegistry();\n}\n","import { confirm, multiselect } from \"@clack/prompts\";\nimport { getAllComponents } from \"./registry.js\";\nimport type { Component } from \"./registry.js\";\n\nexport async function selectComponents(): Promise<string[]> {\n\tconst components = await getAllComponents();\n\n\tconst selected = await multiselect({\n\t\tmessage: \"Select components to add\",\n\t\toptions: components.map((component) => ({\n\t\t\tlabel: component.name,\n\t\t\tvalue: component.name,\n\t\t})),\n\t\trequired: false,\n\t});\n\n\t// Return empty array if user cancels selection\n\tif (typeof selected === \"symbol\") {\n\t\treturn [];\n\t}\n\n\treturn selected;\n}\n\nexport async function confirmInstall(component: Component): Promise<boolean> {\n\tif (component.dependencies.length === 0) return true;\n\n\tconst confirmed = await confirm({\n\t\tmessage: `This component requires the following dependencies: ${component.dependencies.join(\", \")}. Install them?`,\n\t});\n\n\tif (typeof confirmed === \"symbol\") {\n\t\treturn false;\n\t}\n\n\treturn confirmed;\n}\n","import { type InstallResult, copyComponent } from \"./component.js\";\nimport { installDependencies, requestPackageManager } from \"./package-manager.js\";\nimport { confirmInstall } from \"./prompts.js\";\nimport { getComponent } from \"./registry.js\";\n\nexport async function installComponent(name: string): Promise<InstallResult> {\n\tconst component = await getComponent(name);\n\n\tif (!component) {\n\t\treturn {\n\t\t\tstatus: \"failed\",\n\t\t\tname,\n\t\t\terror: \"Component not found in registry\",\n\t\t};\n\t}\n\n\t// Handle dependencies installation\n\tif (component.dependencies.length > 0) {\n\t\tconst confirmed = await confirmInstall(component);\n\t\tif (!confirmed) {\n\t\t\treturn {\n\t\t\t\tstatus: \"failed\",\n\t\t\t\tname,\n\t\t\t\terror: \"Installation cancelled by user\",\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst pm = await requestPackageManager();\n\t\t\tawait installDependencies(component.dependencies, pm);\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\tstatus: \"failed\",\n\t\t\t\tname,\n\t\t\t\terror: `Failed to install dependencies: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t};\n\t\t}\n\t}\n\n\t// Copy the component files\n\treturn await copyComponent(name);\n}\n","import { highlighter } from \"../utils/highlighter.js\";\nimport { type Component, getAllComponents } from \"./registry.js\";\n\n/**\n * Checks if a component name exists in the registry\n * @param component - The component name to validate\n * @param availableComponents - Optional array of available components from registry\n */\nexport async function isValidComponent(\n\tcomponent: string,\n\tavailableComponents?: Component[],\n): Promise<boolean> {\n\tconst components = availableComponents || (await getAllComponents());\n\treturn components.some((c) => c.name === component);\n}\n\n/**\n * Validates that a component exists in the registry\n * @param component - The component name to validate\n * @throws {Error} If the component is not found in the registry\n */\nexport async function validateComponent(component: string): Promise<void> {\n\tconst components = await getAllComponents();\n\tif (!(await isValidComponent(component, components))) {\n\t\tconst availableComponents = components.map((c) => highlighter.info(c.name));\n\t\tthrow new Error(\n\t\t\t`Invalid component: ${highlighter.error(component)}.\\nAvailable components:\\n ${availableComponents.join(\"\\n \")}`,\n\t\t);\n\t}\n}\n","import type { InstallResult } from \"@/utils/component.js\";\nimport { PATHS } from \"@/utils/constants.js\";\nimport { fileExists } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport { installComponent } from \"@/utils/install.js\";\nimport { selectComponents } from \"@/utils/prompts.js\";\nimport { getAllComponents } from \"@/utils/registry.js\";\nimport { sleep } from \"@/utils/sleep.js\";\nimport { isValidComponent } from \"@/utils/validate.js\";\nimport { updateConfig } from \"@/utils/config.js\";\nimport * as p from \"@clack/prompts\";\nconst { init } = await import(\"./init.js\");\n\nexport async function add(components?: string[], options?: { all?: boolean }) {\n\ttry {\n\t\tp.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n\n\t\t// Check if starwind.config.json exists\n\t\tconst configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);\n\n\t\tif (!configExists) {\n\t\t\tconst shouldInit = await p.confirm({\n\t\t\t\tmessage: `Starwind configuration not found. Would you like to run ${highlighter.info(\"starwind init\")} now?`,\n\t\t\t\tinitialValue: true,\n\t\t\t});\n\n\t\t\tif (p.isCancel(shouldInit)) {\n\t\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tif (shouldInit) {\n\t\t\t\tawait init(true);\n\t\t\t} else {\n\t\t\t\tp.log.error(\n\t\t\t\t\t`Please initialize starwind with ${highlighter.info(\"starwind init\")} before adding components`,\n\t\t\t\t);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t}\n\n\t\tlet componentsToInstall: string[] = [];\n\n\t\t// ================================================================\n\t\t// Get components to install\n\t\t// ================================================================\n\t\tif (options?.all) {\n\t\t\t// Get all available components\n\t\t\tconst availableComponents = await getAllComponents();\n\t\t\tcomponentsToInstall = availableComponents.map((c) => c.name);\n\t\t\tp.log.info(`Adding all ${componentsToInstall.length} available components...`);\n\t\t} else if (components && components.length > 0) {\n\t\t\t// Get all available components once to avoid multiple registry calls\n\t\t\tconst availableComponents = await getAllComponents();\n\n\t\t\t// Filter valid components and collect invalid ones\n\t\t\tconst { valid, invalid } = await components.reduce<\n\t\t\t\tPromise<{ valid: string[]; invalid: string[] }>\n\t\t\t>(\n\t\t\t\tasync (accPromise, component) => {\n\t\t\t\t\tconst acc = await accPromise;\n\t\t\t\t\tconst isValid = await isValidComponent(component, availableComponents);\n\t\t\t\t\tif (isValid) {\n\t\t\t\t\t\tacc.valid.push(component);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tacc.invalid.push(component);\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\tPromise.resolve({ valid: [], invalid: [] }),\n\t\t\t);\n\n\t\t\t// Warn about invalid components\n\t\t\tif (invalid.length > 0) {\n\t\t\t\tp.log.warn(\n\t\t\t\t\t`${highlighter.warn(\"Invalid components found:\")}\\n${invalid\n\t\t\t\t\t\t.map((name) => ` ${name}`)\n\t\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Proceed with valid components\n\t\t\tif (valid.length > 0) {\n\t\t\t\tcomponentsToInstall = valid;\n\t\t\t} else {\n\t\t\t\tp.log.warn(`${highlighter.warn(\"No valid components to install\")}`);\n\t\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\t\treturn process.exit(0);\n\t\t\t}\n\t\t} else {\n\t\t\t// If no components provided, show the interactive prompt\n\t\t\tconst selected = await selectComponents();\n\t\t\tif (!selected) {\n\t\t\t\tp.cancel(\"No components selected\");\n\t\t\t\treturn process.exit(0);\n\t\t\t}\n\t\t\tcomponentsToInstall = selected;\n\t\t}\n\n\t\tif (componentsToInstall.length === 0) {\n\t\t\tp.log.warn(`${highlighter.warn(\"No components selected\")}`);\n\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\treturn process.exit(0);\n\t\t}\n\n\t\tconst confirmed = await p.confirm({\n\t\t\tmessage: `Install ${componentsToInstall\n\t\t\t\t.map((comp) => highlighter.info(comp))\n\t\t\t\t.join(\", \")} ${componentsToInstall.length > 1 ? \"components\" : \"component\"}?`,\n\t\t});\n\n\t\tif (!confirmed || p.isCancel(confirmed)) {\n\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\treturn process.exit(0);\n\t\t}\n\n\t\tconst results = {\n\t\t\tinstalled: [] as InstallResult[],\n\t\t\tskipped: [] as InstallResult[],\n\t\t\tfailed: [] as InstallResult[],\n\t\t};\n\n\t\t// ================================================================\n\t\t// Install components\n\t\t// ================================================================\n\t\tconst installedComponents = [];\n\t\tfor (const comp of componentsToInstall) {\n\t\t\tconst result = await installComponent(comp);\n\t\t\tswitch (result.status) {\n\t\t\t\tcase \"installed\":\n\t\t\t\t\tresults.installed.push(result);\n\t\t\t\t\tinstalledComponents.push({ name: result.name, version: result.version! });\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"skipped\":\n\t\t\t\t\tresults.skipped.push(result);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"failed\":\n\t\t\t\t\tresults.failed.push(result);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// ================================================================\n\t\t// Update Config File\n\t\t// ================================================================\n\t\tif (installedComponents.length > 0) {\n\t\t\ttry {\n\t\t\t\tawait updateConfig({ components: installedComponents }, { appendComponents: true });\n\t\t\t} catch (error) {\n\t\t\t\tp.log.error(\n\t\t\t\t\t`Failed to update config: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n\t\t\t\t);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t}\n\n\t\t// ================================================================\n\t\t// Installation summary\n\t\t// ================================================================\n\t\tp.log.message(`\\n\\n${highlighter.underline(\"Installation Summary\")}`);\n\n\t\tif (results.installed.length > 0) {\n\t\t\tp.log.success(\n\t\t\t\t`${highlighter.success(\"Successfully installed components:\")}\\n${results.installed\n\t\t\t\t\t.map((r) => ` ${r.name} v${r.version}`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tif (results.skipped.length > 0) {\n\t\t\tp.log.warn(\n\t\t\t\t`${highlighter.warn(\"Skipped components (already installed):\")}\\n${results.skipped\n\t\t\t\t\t.map((r) => ` ${r.name} v${r.version}`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tif (results.failed.length > 0) {\n\t\t\tp.log.error(\n\t\t\t\t`${highlighter.error(\"Failed to install components:\")}\\n${results.failed\n\t\t\t\t\t.map((r) => ` ${r.name} - ${r.error}`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tawait sleep(1000);\n\n\t\tp.outro(\"Enjoy using Starwind UI 🚀\");\n\t} catch (error) {\n\t\tp.log.error(error instanceof Error ? error.message : \"Failed to add components\");\n\t\tp.cancel(\"Operation cancelled\");\n\t\tprocess.exit(1);\n\t}\n}\n","import { getConfig, updateConfig } from \"@/utils/config.js\";\nimport { PATHS } from \"@/utils/constants.js\";\nimport { fileExists } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport { sleep } from \"@/utils/sleep.js\";\nimport * as p from \"@clack/prompts\";\nimport { type RemoveResult, removeComponent } from \"@/utils/component.js\";\n\nexport async function remove(components?: string[], options?: { all?: boolean }) {\n\ttry {\n\t\tp.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n\n\t\t// Check if starwind.config.json exists\n\t\tconst configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);\n\n\t\tif (!configExists) {\n\t\t\tp.log.error(\"No Starwind configuration found. Please run starwind init first.\");\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\t// Get current config and installed components\n\t\tconst config = await getConfig();\n\t\tconst installedComponents = config.components;\n\n\t\tif (installedComponents.length === 0) {\n\t\t\tp.log.warn(\"No components are currently installed.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tlet componentsToRemove: string[] = [];\n\n\t\t// ================================================================\n\t\t// Get components to remove\n\t\t// ================================================================\n\t\tif (options?.all) {\n\t\t\t// Remove all installed components\n\t\t\tcomponentsToRemove = installedComponents.map((comp) => comp.name);\n\t\t\tp.log.info(`Removing all ${componentsToRemove.length} installed components...`);\n\t\t} else if (components && components.length > 0) {\n\t\t\t// Validate that all specified components are installed\n\t\t\tconst invalid = components.filter(\n\t\t\t\t(comp) => !installedComponents.some((ic) => ic.name === comp),\n\t\t\t);\n\n\t\t\tif (invalid.length > 0) {\n\t\t\t\tp.log.warn(\n\t\t\t\t\t`${highlighter.warn(\"Components not found:\")}\\n${invalid\n\t\t\t\t\t\t.map((name) => ` ${name}`)\n\t\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tcomponentsToRemove = components.filter((comp) =>\n\t\t\t\tinstalledComponents.some((ic) => ic.name === comp),\n\t\t\t);\n\n\t\t\tif (componentsToRemove.length === 0) {\n\t\t\t\tp.log.warn(\"No valid components to remove\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t} else {\n\t\t\t// Show interactive prompt with installed components\n\t\t\tconst choices = installedComponents.map((comp) => ({\n\t\t\t\tvalue: comp.name,\n\t\t\t\tlabel: comp.name,\n\t\t\t}));\n\n\t\t\tconst selected = await p.multiselect({\n\t\t\t\tmessage: \"Select components to remove\",\n\t\t\t\toptions: choices,\n\t\t\t});\n\n\t\t\tif (p.isCancel(selected)) {\n\t\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tcomponentsToRemove = selected as string[];\n\t\t}\n\n\t\tif (componentsToRemove.length === 0) {\n\t\t\tp.log.warn(\"No components selected for removal\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\t// Confirm removal\n\t\tconst confirmed = await p.confirm({\n\t\t\tmessage: `Remove ${componentsToRemove\n\t\t\t\t.map((comp) => highlighter.info(comp))\n\t\t\t\t.join(\", \")} ${componentsToRemove.length > 1 ? \"components\" : \"component\"}?`,\n\t\t});\n\n\t\tif (!confirmed || p.isCancel(confirmed)) {\n\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tconst results = {\n\t\t\tremoved: [] as RemoveResult[],\n\t\t\tfailed: [] as RemoveResult[],\n\t\t};\n\n\t\t// ================================================================\n\t\t// Remove Components\n\t\t// ================================================================\n\t\tfor (const comp of componentsToRemove) {\n\t\t\tconst result = await removeComponent(comp, config.componentDir);\n\t\t\tif (result.status === \"removed\") {\n\t\t\t\tresults.removed.push(result);\n\t\t\t} else {\n\t\t\t\tresults.failed.push(result);\n\t\t\t}\n\t\t}\n\n\t\t// ================================================================\n\t\t// Update Config File\n\t\t// ================================================================\n\t\t// Update config file by writing the filtered components directly\n\t\tconst updatedComponents = config.components.filter(\n\t\t\t(comp) => !componentsToRemove.includes(comp.name),\n\t\t);\n\t\tawait updateConfig(\n\t\t\t{\n\t\t\t\t...config,\n\t\t\t\tcomponents: updatedComponents,\n\t\t\t},\n\t\t\t{ appendComponents: false },\n\t\t);\n\n\t\t// ================================================================\n\t\t// Removal summary\n\t\t// ================================================================\n\t\tp.log.message(`\\n\\n${highlighter.underline(\"Removal Summary\")}`);\n\n\t\tif (results.removed.length > 0) {\n\t\t\tp.log.success(\n\t\t\t\t`${highlighter.success(\"Successfully removed components:\")}\\n${results.removed\n\t\t\t\t\t.map((r) => ` ${r.name}`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tif (results.failed.length > 0) {\n\t\t\tp.log.error(\n\t\t\t\t`${highlighter.error(\"Failed to remove components:\")}\\n${results.failed\n\t\t\t\t\t.map((r) => ` ${r.name} - ${r.error}`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tawait sleep(1000);\n\n\t\tif (results.removed.length > 0) {\n\t\t\tp.outro(\"Components removed successfully 🗑️\");\n\t\t} else {\n\t\t\tp.cancel(\"Errors occurred while removing components\");\n\t\t\tprocess.exit(1);\n\t\t}\n\t} catch (error) {\n\t\tp.log.error(error instanceof Error ? error.message : \"Failed to remove components\");\n\t\tp.cancel(\"Operation cancelled\");\n\t\tprocess.exit(1);\n\t}\n}\n","import path from \"node:path\";\nimport { getConfig } from \"@/utils/config.js\";\nimport { PATHS } from \"@/utils/constants.js\";\nimport { fileExists, writeJsonFile } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport { sleep } from \"@/utils/sleep.js\";\nimport * as p from \"@clack/prompts\";\nimport { type UpdateResult, updateComponent } from \"@/utils/component.js\";\nimport { updateConfig } from \"@/utils/config.js\";\n\nexport async function update(components?: string[], options?: { all?: boolean }) {\n\ttry {\n\t\tp.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n\n\t\t// Check if starwind.config.json exists\n\t\tconst configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);\n\n\t\tif (!configExists) {\n\t\t\tp.log.error(\"No Starwind configuration found. Please run starwind init first.\");\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\t// Get current config and installed components\n\t\tconst config = await getConfig();\n\t\tconst installedComponents = config.components;\n\n\t\tif (installedComponents.length === 0) {\n\t\t\tp.log.warn(\"No components are currently installed.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tlet componentsToUpdate: string[] = [];\n\n\t\t// ================================================================\n\t\t// Get components to update\n\t\t// ================================================================\n\t\tif (options?.all) {\n\t\t\t// Update all installed components\n\t\t\tcomponentsToUpdate = installedComponents.map((comp) => comp.name);\n\t\t\tp.log.info(`Checking updates for all ${componentsToUpdate.length} installed components...`);\n\t\t} else if (components && components.length > 0) {\n\t\t\t// Validate that all specified components are installed\n\t\t\tconst invalid = components.filter(\n\t\t\t\t(comp) => !installedComponents.some((ic) => ic.name === comp),\n\t\t\t);\n\n\t\t\tif (invalid.length > 0) {\n\t\t\t\tp.log.warn(\n\t\t\t\t\t`${highlighter.warn(\"Components not found in project:\")}\\n${invalid\n\t\t\t\t\t\t.map((name) => ` ${name}`)\n\t\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tcomponentsToUpdate = components.filter((comp) =>\n\t\t\t\tinstalledComponents.some((ic) => ic.name === comp),\n\t\t\t);\n\n\t\t\tif (componentsToUpdate.length === 0) {\n\t\t\t\tp.log.warn(\"No valid components to update\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t} else {\n\t\t\t// Show interactive prompt with installed components\n\t\t\tconst choices = installedComponents.map((comp) => ({\n\t\t\t\tvalue: comp.name,\n\t\t\t\tlabel: comp.name,\n\t\t\t}));\n\n\t\t\tconst selected = await p.multiselect({\n\t\t\t\tmessage: \"Select components to update\",\n\t\t\t\toptions: choices,\n\t\t\t});\n\n\t\t\tif (p.isCancel(selected)) {\n\t\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tcomponentsToUpdate = selected as string[];\n\t\t}\n\n\t\tif (componentsToUpdate.length === 0) {\n\t\t\tp.log.warn(\"No components selected for update\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\t// Confirm update\n\t\tconst confirmed = await p.confirm({\n\t\t\tmessage: `Check for updates to ${componentsToUpdate\n\t\t\t\t.map((comp) => highlighter.info(comp))\n\t\t\t\t.join(\", \")} ${componentsToUpdate.length > 1 ? \"components\" : \"component\"}?`,\n\t\t});\n\n\t\tif (!confirmed || p.isCancel(confirmed)) {\n\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tconst results = {\n\t\t\tupdated: [] as UpdateResult[],\n\t\t\tskipped: [] as UpdateResult[],\n\t\t\tfailed: [] as UpdateResult[],\n\t\t};\n\n\t\t// ================================================================\n\t\t// Update Components\n\t\t// ================================================================\n\t\tfor (const comp of componentsToUpdate) {\n\t\t\tconst currentVersion = installedComponents.find((ic) => ic.name === comp)?.version;\n\t\t\tif (!currentVersion) {\n\t\t\t\tresults.failed.push({\n\t\t\t\t\tname: comp,\n\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\terror: \"Could not determine current version\",\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = await updateComponent(comp, currentVersion);\n\t\t\tswitch (result.status) {\n\t\t\t\tcase \"updated\":\n\t\t\t\t\tresults.updated.push(result);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"skipped\":\n\t\t\t\t\tresults.skipped.push(result);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"failed\":\n\t\t\t\t\tresults.failed.push(result);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// ================================================================\n\t\t// Update Config File\n\t\t// ================================================================\n\t\tif (results.updated.length > 0) {\n\t\t\ttry {\n\t\t\t\t// Create a map of current components, excluding updated ones\n\t\t\t\tconst updatedComponentNames = new Set(results.updated.map((r) => r.name));\n\t\t\t\tconst currentComponents = config.components.filter(\n\t\t\t\t\t(comp) => !updatedComponentNames.has(comp.name),\n\t\t\t\t);\n\n\t\t\t\t// Add the updated components with their new versions\n\t\t\t\tconst updatedComponents = [\n\t\t\t\t\t...currentComponents,\n\t\t\t\t\t...results.updated.map((r) => ({\n\t\t\t\t\t\tname: r.name,\n\t\t\t\t\t\tversion: r.newVersion!,\n\t\t\t\t\t})),\n\t\t\t\t];\n\n\t\t\t\tawait updateConfig(\n\t\t\t\t\t{\n\t\t\t\t\t\tcomponents: updatedComponents,\n\t\t\t\t\t},\n\t\t\t\t\t{ appendComponents: false },\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tp.log.error(\n\t\t\t\t\t`Failed to update config: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n\t\t\t\t);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t}\n\n\t\t// ================================================================\n\t\t// Update summary\n\t\t// ================================================================\n\t\tp.log.message(`\\n\\n${highlighter.underline(\"Update Summary\")}`);\n\n\t\tif (results.skipped.length > 0) {\n\t\t\tp.log.info(\n\t\t\t\t`${highlighter.info(\"Components already up to date:\")}\\n${results.skipped\n\t\t\t\t\t.map((r) => ` ${r.name} (${r.newVersion})`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tif (results.updated.length > 0) {\n\t\t\tp.log.success(\n\t\t\t\t`${highlighter.success(\"Successfully updated components:\")}\\n${results.updated\n\t\t\t\t\t.map((r) => ` ${r.name} (${r.oldVersion} → ${r.newVersion})`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tif (results.failed.length > 0) {\n\t\t\tp.log.error(\n\t\t\t\t`${highlighter.error(\"Failed to update components:\")}\\n${results.failed\n\t\t\t\t\t.map((r) => ` ${r.name} - ${r.error}`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tawait sleep(1000);\n\n\t\tif (results.updated.length > 0) {\n\t\t\tp.outro(\"Components updated successfully 🚀\");\n\t\t} else if (results.skipped.length > 0 && results.failed.length === 0) {\n\t\t\tp.outro(\"All components are up to date ✨\");\n\t\t} else {\n\t\t\tp.cancel(\"No components were updated\");\n\t\t\tprocess.exit(1);\n\t\t}\n\t} catch (error) {\n\t\tp.log.error(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AG;AACrE,MAAE,SAAM,sCAAiC;AAAA,IAC1C,OAAO;AACN,MAAE,UAAO,4BAA4B;AACrC,cAAQ,KAAK,CAAC;AAAA,IACf;AAAA,EACD,SAAS,OAAO;AACf,IAAE,OAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,6BAA6B;AAClF,IAAE,UAAO,qBAAqB;AAC9B,YAAQ,KAAK,CAAC;AAAA,EACf;AACD;;;AR5MA,IAAM,UAAU,IAAI,QAAQ,EAC1B,KAAK,UAAU,EACf,YAAY,gEAAgE,EAC5E,QAAQ,OAAO;AAEjB,QACE,QAAQ,MAAM,EACd,YAAY,uCAAuC,EACnD,OAAO,gBAAgB,8BAA8B,EACrD,OAAO,MAAM,KAAK,KAAK,CAAC;AAE1B,QACE,QAAQ,KAAK,EACb,YAAY,yCAAyC,EACrD,SAAS,mBAAmB,yCAAyC,EACrE,qBAAqB,EACrB,OAAO,aAAa,8BAA8B,EAClD,OAAO,GAAG;AAEZ,QACE,QAAQ,QAAQ,EAChB,YAAY,qDAAqD,EACjE,SAAS,mBAAmB,4CAA4C,EACxE,qBAAqB,EACrB,OAAO,aAAa,iCAAiC,EACrD,OAAO,MAAM;AAEf,QACE,QAAQ,QAAQ,EAChB,YAAY,8CAA8C,EAC1D,SAAS,mBAAmB,4CAA4C,EACxE,qBAAqB,EACrB,OAAO,aAAa,iCAAiC,EACrD,OAAO,MAAM;AAEf,QAAQ,MAAM;","names":["registry","registry","init","p","p"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/utils/component.ts","../src/utils/registry.ts","../src/utils/prompts.ts","../src/utils/install.ts","../src/utils/validate.ts","../src/commands/add.ts","../src/commands/remove.ts","../src/commands/update.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from \"commander\";\nimport { add } from \"./commands/add.js\";\nimport { init } from \"./commands/init.js\";\nimport { remove } from \"./commands/remove.js\";\nimport { update } from \"./commands/update.js\";\n\nconst program = new Command()\n\t.name(\"starwind\")\n\t.description(\"Add beautifully designed components to your Astro applications\")\n\t.version(\"0.0.1\");\n\nprogram\n\t.command(\"init\")\n\t.description(\"Initialize your project with Starwind\")\n\t.option(\"--no-install\", \"Skip dependency installation\")\n\t.action(() => init(false));\n\nprogram\n\t.command(\"add\")\n\t.description(\"Add Starwind components to your project\")\n\t.argument(\"[components...]\", \"The components to add (space separated)\")\n\t.allowExcessArguments()\n\t.option(\"-a, --all\", \"Add all available components\")\n\t.action(add);\n\nprogram\n\t.command(\"update\")\n\t.description(\"Update Starwind components to their latest versions\")\n\t.argument(\"[components...]\", \"The components to update (space separated)\")\n\t.allowExcessArguments()\n\t.option(\"-a, --all\", \"Update all installed components\")\n\t.action(update);\n\nprogram\n\t.command(\"remove\")\n\t.description(\"Remove Starwind components from your project\")\n\t.argument(\"[components...]\", \"The components to remove (space separated)\")\n\t.allowExcessArguments()\n\t.option(\"-a, --all\", \"Remove all installed components\")\n\t.action(remove);\n\nprogram.parse();\n","import * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport fs from \"fs-extra\";\nimport { getConfig, updateConfig } from \"./config.js\";\nimport { PATHS } from \"./constants.js\";\nimport { getRegistry, getComponent } from \"./registry.js\";\nimport semver from \"semver\";\nimport * as p from \"@clack/prompts\";\nimport { highlighter } from \"./highlighter.js\";\n\nexport type InstallResult = {\n\tstatus: \"installed\" | \"skipped\" | \"failed\";\n\tname: string;\n\tversion?: string;\n\terror?: string;\n};\n\nexport interface RemoveResult {\n\tname: string;\n\tstatus: \"removed\" | \"failed\";\n\terror?: string;\n}\n\nexport interface UpdateResult {\n\tname: string;\n\tstatus: \"updated\" | \"skipped\" | \"failed\";\n\toldVersion?: string;\n\tnewVersion?: string;\n\terror?: string;\n}\n\n/**\n * Copies a component from the core package to the local components directory\n * @param name - The name of the component to copy\n * @param overwrite - If true, will overwrite existing component instead of skipping\n * @returns A result object indicating the installation status\n */\nexport async function copyComponent(name: string, overwrite = false): Promise<InstallResult> {\n\tconst config = await getConfig();\n\n\t// Ensure components array exists\n\tconst currentComponents = Array.isArray(config.components) ? config.components : [];\n\n\t// Check if component already exists\n\tif (!overwrite && currentComponents.some((component) => component.name === name)) {\n\t\tconst existingComponent = currentComponents.find((c) => c.name === name);\n\t\treturn {\n\t\t\tstatus: \"skipped\",\n\t\t\tname,\n\t\t\tversion: existingComponent?.version,\n\t\t};\n\t}\n\n\tconst componentDir = path.join(config.componentDir, \"starwind\", name);\n\n\ttry {\n\t\tawait fs.ensureDir(componentDir);\n\n\t\t// Get the path to the installed @starwind/core package\n\t\tconst pkgUrl = import.meta.resolve?.(PATHS.STARWIND_CORE);\n\t\tif (!pkgUrl) {\n\t\t\tthrow new Error(`Could not resolve ${PATHS.STARWIND_CORE} package, is it installed?`);\n\t\t}\n\n\t\tconst coreDir = path.dirname(fileURLToPath(pkgUrl));\n\t\tconst sourceDir = path.join(coreDir, PATHS.STARWIND_CORE_COMPONENTS, name);\n\n\t\tconst files = await fs.readdir(sourceDir);\n\n\t\tfor (const file of files) {\n\t\t\tconst sourcePath = path.join(sourceDir, file);\n\t\t\tconst destPath = path.join(componentDir, file);\n\t\t\tawait fs.copy(sourcePath, destPath, { overwrite: true });\n\t\t}\n\n\t\t// Get component version from registry\n\t\tconst registry = await getRegistry();\n\t\tconst componentInfo = registry.find((c) => c.name === name);\n\t\tif (!componentInfo) {\n\t\t\tthrow new Error(`Component ${name} not found in registry`);\n\t\t}\n\n\t\treturn {\n\t\t\tstatus: \"installed\",\n\t\t\tname,\n\t\t\tversion: componentInfo.version,\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\tstatus: \"failed\",\n\t\t\tname,\n\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t};\n\t}\n}\n\n/**\n * Removes a component from the project's component directory\n * @param name - The name of the component to remove\n * @param componentDir - The base directory where components are installed\n * @returns A result object indicating the removal status and any errors\n */\nexport async function removeComponent(name: string, componentDir: string): Promise<RemoveResult> {\n\ttry {\n\t\tconst componentPath = path.join(componentDir, \"starwind\", name);\n\n\t\t// Check if component directory exists\n\t\tif (await fs.pathExists(componentPath)) {\n\t\t\t// Remove the component directory\n\t\t\tawait fs.remove(componentPath);\n\t\t\treturn { name, status: \"removed\" };\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tstatus: \"failed\",\n\t\t\t\terror: \"Component directory not found\",\n\t\t\t};\n\t\t}\n\t} catch (error) {\n\t\treturn {\n\t\t\tname,\n\t\t\tstatus: \"failed\",\n\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t};\n\t}\n}\n\n/**\n * Updates a component to its latest version from the registry\n * @param name - The name of the component to update\n * @param currentVersion - The currently installed version\n * @returns A result object indicating the update status\n */\nexport async function updateComponent(name: string, currentVersion: string): Promise<UpdateResult> {\n\ttry {\n\t\t// Get latest version from registry\n\t\tconst registryComponent = await getComponent(name);\n\t\tif (!registryComponent) {\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tstatus: \"failed\",\n\t\t\t\terror: \"Component not found in registry\",\n\t\t\t};\n\t\t}\n\n\t\t// Compare versions\n\t\tif (!semver.gt(registryComponent.version, currentVersion)) {\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tstatus: \"skipped\",\n\t\t\t\toldVersion: currentVersion,\n\t\t\t\tnewVersion: registryComponent.version,\n\t\t\t};\n\t\t}\n\n\t\t// Confirm the component update with warning about overriding\n\t\tconst confirmUpdate = await p.confirm({\n\t\t\tmessage: `Update component ${highlighter.info(name)} from ${highlighter.warn(`v${currentVersion}`)} to ${highlighter.success(`v${registryComponent.version}`)}? This will override the existing implementation.`,\n\t\t});\n\n\t\tif (!confirmUpdate || p.isCancel(confirmUpdate)) {\n\t\t\tp.log.info(`Skipping update for ${highlighter.info(name)}`);\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tstatus: \"skipped\",\n\t\t\t\toldVersion: currentVersion,\n\t\t\t\tnewVersion: registryComponent.version,\n\t\t\t};\n\t\t}\n\n\t\t// Remove and reinstall component with overwrite enabled\n\t\tconst result = await copyComponent(name, true);\n\n\t\tif (result.status === \"installed\") {\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tstatus: \"updated\",\n\t\t\t\toldVersion: currentVersion,\n\t\t\t\tnewVersion: result.version,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tstatus: \"failed\",\n\t\t\t\terror: result.error || \"Failed to update component\",\n\t\t\t};\n\t\t}\n\t} catch (error) {\n\t\treturn {\n\t\t\tname,\n\t\t\tstatus: \"failed\",\n\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t};\n\t}\n}\n","import { registry } from \"@starwind-ui/core\";\nimport { z } from \"zod\";\n\nconst componentSchema = z.object({\n\tname: z.string(),\n\tversion: z.string(),\n\tdependencies: z.array(z.string()).default([]),\n\ttype: z.enum([\"component\"]),\n});\n\nexport type Component = z.infer<typeof componentSchema>;\n\nconst registrySchema = z.array(componentSchema);\n\nexport async function getRegistry(): Promise<Component[]> {\n\ttry {\n\t\treturn registrySchema.parse(registry);\n\t} catch (error) {\n\t\tconsole.error(\"Failed to load registry:\", error);\n\t\tthrow error;\n\t}\n}\n\nexport async function getComponent(name: string): Promise<Component | undefined> {\n\tconst registry = await getRegistry();\n\treturn registry.find((component) => component.name === name);\n}\n\nexport async function getAllComponents(): Promise<Component[]> {\n\treturn getRegistry();\n}\n","import { confirm, multiselect } from \"@clack/prompts\";\nimport { getAllComponents } from \"./registry.js\";\nimport type { Component } from \"./registry.js\";\n\nexport async function selectComponents(): Promise<string[]> {\n\tconst components = await getAllComponents();\n\n\tconst selected = await multiselect({\n\t\tmessage: \"Select components to add\",\n\t\toptions: components.map((component) => ({\n\t\t\tlabel: component.name,\n\t\t\tvalue: component.name,\n\t\t})),\n\t\trequired: false,\n\t});\n\n\t// Return empty array if user cancels selection\n\tif (typeof selected === \"symbol\") {\n\t\treturn [];\n\t}\n\n\treturn selected;\n}\n\nexport async function confirmInstall(component: Component): Promise<boolean> {\n\tif (component.dependencies.length === 0) return true;\n\n\tconst confirmed = await confirm({\n\t\tmessage: `This component requires the following dependencies: ${component.dependencies.join(\", \")}. Install them?`,\n\t});\n\n\tif (typeof confirmed === \"symbol\") {\n\t\treturn false;\n\t}\n\n\treturn confirmed;\n}\n","import { type InstallResult, copyComponent } from \"./component.js\";\nimport { installDependencies, requestPackageManager } from \"./package-manager.js\";\nimport { confirmInstall } from \"./prompts.js\";\nimport { getComponent } from \"./registry.js\";\n\nexport async function installComponent(name: string): Promise<InstallResult> {\n\tconst component = await getComponent(name);\n\n\tif (!component) {\n\t\treturn {\n\t\t\tstatus: \"failed\",\n\t\t\tname,\n\t\t\terror: \"Component not found in registry\",\n\t\t};\n\t}\n\n\t// Handle dependencies installation\n\tif (component.dependencies.length > 0) {\n\t\tconst confirmed = await confirmInstall(component);\n\t\tif (!confirmed) {\n\t\t\treturn {\n\t\t\t\tstatus: \"failed\",\n\t\t\t\tname,\n\t\t\t\terror: \"Installation cancelled by user\",\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst pm = await requestPackageManager();\n\t\t\tawait installDependencies(component.dependencies, pm);\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\tstatus: \"failed\",\n\t\t\t\tname,\n\t\t\t\terror: `Failed to install dependencies: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t};\n\t\t}\n\t}\n\n\t// Copy the component files\n\treturn await copyComponent(name);\n}\n","import { highlighter } from \"../utils/highlighter.js\";\nimport { type Component, getAllComponents } from \"./registry.js\";\n\n/**\n * Checks if a component name exists in the registry\n * @param component - The component name to validate\n * @param availableComponents - Optional array of available components from registry\n */\nexport async function isValidComponent(\n\tcomponent: string,\n\tavailableComponents?: Component[],\n): Promise<boolean> {\n\tconst components = availableComponents || (await getAllComponents());\n\treturn components.some((c) => c.name === component);\n}\n\n/**\n * Validates that a component exists in the registry\n * @param component - The component name to validate\n * @throws {Error} If the component is not found in the registry\n */\nexport async function validateComponent(component: string): Promise<void> {\n\tconst components = await getAllComponents();\n\tif (!(await isValidComponent(component, components))) {\n\t\tconst availableComponents = components.map((c) => highlighter.info(c.name));\n\t\tthrow new Error(\n\t\t\t`Invalid component: ${highlighter.error(component)}.\\nAvailable components:\\n ${availableComponents.join(\"\\n \")}`,\n\t\t);\n\t}\n}\n","import type { InstallResult } from \"@/utils/component.js\";\nimport { PATHS } from \"@/utils/constants.js\";\nimport { fileExists } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport { installComponent } from \"@/utils/install.js\";\nimport { selectComponents } from \"@/utils/prompts.js\";\nimport { getAllComponents } from \"@/utils/registry.js\";\nimport { sleep } from \"@/utils/sleep.js\";\nimport { isValidComponent } from \"@/utils/validate.js\";\nimport { updateConfig } from \"@/utils/config.js\";\nimport * as p from \"@clack/prompts\";\nconst { init } = await import(\"./init.js\");\n\nexport async function add(components?: string[], options?: { all?: boolean }) {\n\ttry {\n\t\tp.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n\n\t\t// Check if starwind.config.json exists\n\t\tconst configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);\n\n\t\tif (!configExists) {\n\t\t\tconst shouldInit = await p.confirm({\n\t\t\t\tmessage: `Starwind configuration not found. Would you like to run ${highlighter.info(\"starwind init\")} now?`,\n\t\t\t\tinitialValue: true,\n\t\t\t});\n\n\t\t\tif (p.isCancel(shouldInit)) {\n\t\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tif (shouldInit) {\n\t\t\t\tawait init(true);\n\t\t\t} else {\n\t\t\t\tp.log.error(\n\t\t\t\t\t`Please initialize starwind with ${highlighter.info(\"starwind init\")} before adding components`,\n\t\t\t\t);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t}\n\n\t\tlet componentsToInstall: string[] = [];\n\n\t\t// ================================================================\n\t\t// Get components to install\n\t\t// ================================================================\n\t\tif (options?.all) {\n\t\t\t// Get all available components\n\t\t\tconst availableComponents = await getAllComponents();\n\t\t\tcomponentsToInstall = availableComponents.map((c) => c.name);\n\t\t\tp.log.info(`Adding all ${componentsToInstall.length} available components...`);\n\t\t} else if (components && components.length > 0) {\n\t\t\t// Get all available components once to avoid multiple registry calls\n\t\t\tconst availableComponents = await getAllComponents();\n\n\t\t\t// Filter valid components and collect invalid ones\n\t\t\tconst { valid, invalid } = await components.reduce<\n\t\t\t\tPromise<{ valid: string[]; invalid: string[] }>\n\t\t\t>(\n\t\t\t\tasync (accPromise, component) => {\n\t\t\t\t\tconst acc = await accPromise;\n\t\t\t\t\tconst isValid = await isValidComponent(component, availableComponents);\n\t\t\t\t\tif (isValid) {\n\t\t\t\t\t\tacc.valid.push(component);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tacc.invalid.push(component);\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\tPromise.resolve({ valid: [], invalid: [] }),\n\t\t\t);\n\n\t\t\t// Warn about invalid components\n\t\t\tif (invalid.length > 0) {\n\t\t\t\tp.log.warn(\n\t\t\t\t\t`${highlighter.warn(\"Invalid components found:\")}\\n${invalid\n\t\t\t\t\t\t.map((name) => ` ${name}`)\n\t\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Proceed with valid components\n\t\t\tif (valid.length > 0) {\n\t\t\t\tcomponentsToInstall = valid;\n\t\t\t} else {\n\t\t\t\tp.log.warn(`${highlighter.warn(\"No valid components to install\")}`);\n\t\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\t\treturn process.exit(0);\n\t\t\t}\n\t\t} else {\n\t\t\t// If no components provided, show the interactive prompt\n\t\t\tconst selected = await selectComponents();\n\t\t\tif (!selected) {\n\t\t\t\tp.cancel(\"No components selected\");\n\t\t\t\treturn process.exit(0);\n\t\t\t}\n\t\t\tcomponentsToInstall = selected;\n\t\t}\n\n\t\tif (componentsToInstall.length === 0) {\n\t\t\tp.log.warn(`${highlighter.warn(\"No components selected\")}`);\n\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\treturn process.exit(0);\n\t\t}\n\n\t\tconst confirmed = await p.confirm({\n\t\t\tmessage: `Install ${componentsToInstall\n\t\t\t\t.map((comp) => highlighter.info(comp))\n\t\t\t\t.join(\", \")} ${componentsToInstall.length > 1 ? \"components\" : \"component\"}?`,\n\t\t});\n\n\t\tif (!confirmed || p.isCancel(confirmed)) {\n\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\treturn process.exit(0);\n\t\t}\n\n\t\tconst results = {\n\t\t\tinstalled: [] as InstallResult[],\n\t\t\tskipped: [] as InstallResult[],\n\t\t\tfailed: [] as InstallResult[],\n\t\t};\n\n\t\t// ================================================================\n\t\t// Install components\n\t\t// ================================================================\n\t\tconst installedComponents = [];\n\t\tfor (const comp of componentsToInstall) {\n\t\t\tconst result = await installComponent(comp);\n\t\t\tswitch (result.status) {\n\t\t\t\tcase \"installed\":\n\t\t\t\t\tresults.installed.push(result);\n\t\t\t\t\tinstalledComponents.push({ name: result.name, version: result.version! });\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"skipped\":\n\t\t\t\t\tresults.skipped.push(result);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"failed\":\n\t\t\t\t\tresults.failed.push(result);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// ================================================================\n\t\t// Update Config File\n\t\t// ================================================================\n\t\tif (installedComponents.length > 0) {\n\t\t\ttry {\n\t\t\t\tawait updateConfig({ components: installedComponents }, { appendComponents: true });\n\t\t\t} catch (error) {\n\t\t\t\tp.log.error(\n\t\t\t\t\t`Failed to update config: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n\t\t\t\t);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t}\n\n\t\t// ================================================================\n\t\t// Installation summary\n\t\t// ================================================================\n\t\tp.log.message(`\\n\\n${highlighter.underline(\"Installation Summary\")}`);\n\n\t\tif (results.installed.length > 0) {\n\t\t\tp.log.success(\n\t\t\t\t`${highlighter.success(\"Successfully installed components:\")}\\n${results.installed\n\t\t\t\t\t.map((r) => ` ${r.name} v${r.version}`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tif (results.skipped.length > 0) {\n\t\t\tp.log.warn(\n\t\t\t\t`${highlighter.warn(\"Skipped components (already installed):\")}\\n${results.skipped\n\t\t\t\t\t.map((r) => ` ${r.name} v${r.version}`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tif (results.failed.length > 0) {\n\t\t\tp.log.error(\n\t\t\t\t`${highlighter.error(\"Failed to install components:\")}\\n${results.failed\n\t\t\t\t\t.map((r) => ` ${r.name} - ${r.error}`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tawait sleep(1000);\n\n\t\tp.outro(\"Enjoy using Starwind UI 🚀\");\n\t} catch (error) {\n\t\tp.log.error(error instanceof Error ? error.message : \"Failed to add components\");\n\t\tp.cancel(\"Operation cancelled\");\n\t\tprocess.exit(1);\n\t}\n}\n","import { getConfig, updateConfig } from \"@/utils/config.js\";\nimport { PATHS } from \"@/utils/constants.js\";\nimport { fileExists } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport { sleep } from \"@/utils/sleep.js\";\nimport * as p from \"@clack/prompts\";\nimport { type RemoveResult, removeComponent } from \"@/utils/component.js\";\n\nexport async function remove(components?: string[], options?: { all?: boolean }) {\n\ttry {\n\t\tp.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n\n\t\t// Check if starwind.config.json exists\n\t\tconst configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);\n\n\t\tif (!configExists) {\n\t\t\tp.log.error(\"No Starwind configuration found. Please run starwind init first.\");\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\t// Get current config and installed components\n\t\tconst config = await getConfig();\n\t\tconst installedComponents = config.components;\n\n\t\tif (installedComponents.length === 0) {\n\t\t\tp.log.warn(\"No components are currently installed.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tlet componentsToRemove: string[] = [];\n\n\t\t// ================================================================\n\t\t// Get components to remove\n\t\t// ================================================================\n\t\tif (options?.all) {\n\t\t\t// Remove all installed components\n\t\t\tcomponentsToRemove = installedComponents.map((comp) => comp.name);\n\t\t\tp.log.info(`Removing all ${componentsToRemove.length} installed components...`);\n\t\t} else if (components && components.length > 0) {\n\t\t\t// Validate that all specified components are installed\n\t\t\tconst invalid = components.filter(\n\t\t\t\t(comp) => !installedComponents.some((ic) => ic.name === comp),\n\t\t\t);\n\n\t\t\tif (invalid.length > 0) {\n\t\t\t\tp.log.warn(\n\t\t\t\t\t`${highlighter.warn(\"Components not found:\")}\\n${invalid\n\t\t\t\t\t\t.map((name) => ` ${name}`)\n\t\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tcomponentsToRemove = components.filter((comp) =>\n\t\t\t\tinstalledComponents.some((ic) => ic.name === comp),\n\t\t\t);\n\n\t\t\tif (componentsToRemove.length === 0) {\n\t\t\t\tp.log.warn(\"No valid components to remove\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t} else {\n\t\t\t// Show interactive prompt with installed components\n\t\t\tconst choices = installedComponents.map((comp) => ({\n\t\t\t\tvalue: comp.name,\n\t\t\t\tlabel: comp.name,\n\t\t\t}));\n\n\t\t\tconst selected = await p.multiselect({\n\t\t\t\tmessage: \"Select components to remove\",\n\t\t\t\toptions: choices,\n\t\t\t});\n\n\t\t\tif (p.isCancel(selected)) {\n\t\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tcomponentsToRemove = selected as string[];\n\t\t}\n\n\t\tif (componentsToRemove.length === 0) {\n\t\t\tp.log.warn(\"No components selected for removal\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\t// Confirm removal\n\t\tconst confirmed = await p.confirm({\n\t\t\tmessage: `Remove ${componentsToRemove\n\t\t\t\t.map((comp) => highlighter.info(comp))\n\t\t\t\t.join(\", \")} ${componentsToRemove.length > 1 ? \"components\" : \"component\"}?`,\n\t\t});\n\n\t\tif (!confirmed || p.isCancel(confirmed)) {\n\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tconst results = {\n\t\t\tremoved: [] as RemoveResult[],\n\t\t\tfailed: [] as RemoveResult[],\n\t\t};\n\n\t\t// ================================================================\n\t\t// Remove Components\n\t\t// ================================================================\n\t\tfor (const comp of componentsToRemove) {\n\t\t\tconst result = await removeComponent(comp, config.componentDir);\n\t\t\tif (result.status === \"removed\") {\n\t\t\t\tresults.removed.push(result);\n\t\t\t} else {\n\t\t\t\tresults.failed.push(result);\n\t\t\t}\n\t\t}\n\n\t\t// ================================================================\n\t\t// Update Config File\n\t\t// ================================================================\n\t\t// Update config file by writing the filtered components directly\n\t\tconst updatedComponents = config.components.filter(\n\t\t\t(comp) => !componentsToRemove.includes(comp.name),\n\t\t);\n\t\tawait updateConfig(\n\t\t\t{\n\t\t\t\t...config,\n\t\t\t\tcomponents: updatedComponents,\n\t\t\t},\n\t\t\t{ appendComponents: false },\n\t\t);\n\n\t\t// ================================================================\n\t\t// Removal summary\n\t\t// ================================================================\n\t\tp.log.message(`\\n\\n${highlighter.underline(\"Removal Summary\")}`);\n\n\t\tif (results.removed.length > 0) {\n\t\t\tp.log.success(\n\t\t\t\t`${highlighter.success(\"Successfully removed components:\")}\\n${results.removed\n\t\t\t\t\t.map((r) => ` ${r.name}`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tif (results.failed.length > 0) {\n\t\t\tp.log.error(\n\t\t\t\t`${highlighter.error(\"Failed to remove components:\")}\\n${results.failed\n\t\t\t\t\t.map((r) => ` ${r.name} - ${r.error}`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tawait sleep(1000);\n\n\t\tif (results.removed.length > 0) {\n\t\t\tp.outro(\"Components removed successfully 🗑️\");\n\t\t} else {\n\t\t\tp.cancel(\"Errors occurred while removing components\");\n\t\t\tprocess.exit(1);\n\t\t}\n\t} catch (error) {\n\t\tp.log.error(error instanceof Error ? error.message : \"Failed to remove components\");\n\t\tp.cancel(\"Operation cancelled\");\n\t\tprocess.exit(1);\n\t}\n}\n","import path from \"node:path\";\nimport { getConfig } from \"@/utils/config.js\";\nimport { PATHS } from \"@/utils/constants.js\";\nimport { fileExists, writeJsonFile } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport { sleep } from \"@/utils/sleep.js\";\nimport * as p from \"@clack/prompts\";\nimport { type UpdateResult, updateComponent } from \"@/utils/component.js\";\nimport { updateConfig } from \"@/utils/config.js\";\n\nexport async function update(components?: string[], options?: { all?: boolean }) {\n\ttry {\n\t\tp.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n\n\t\t// Check if starwind.config.json exists\n\t\tconst configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);\n\n\t\tif (!configExists) {\n\t\t\tp.log.error(\"No Starwind configuration found. Please run starwind init first.\");\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\t// Get current config and installed components\n\t\tconst config = await getConfig();\n\t\tconst installedComponents = config.components;\n\n\t\tif (installedComponents.length === 0) {\n\t\t\tp.log.warn(\"No components are currently installed.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tlet componentsToUpdate: string[] = [];\n\n\t\t// ================================================================\n\t\t// Get components to update\n\t\t// ================================================================\n\t\tif (options?.all) {\n\t\t\t// Update all installed components\n\t\t\tcomponentsToUpdate = installedComponents.map((comp) => comp.name);\n\t\t\tp.log.info(`Checking updates for all ${componentsToUpdate.length} installed components...`);\n\t\t} else if (components && components.length > 0) {\n\t\t\t// Validate that all specified components are installed\n\t\t\tconst invalid = components.filter(\n\t\t\t\t(comp) => !installedComponents.some((ic) => ic.name === comp),\n\t\t\t);\n\n\t\t\tif (invalid.length > 0) {\n\t\t\t\tp.log.warn(\n\t\t\t\t\t`${highlighter.warn(\"Components not found in project:\")}\\n${invalid\n\t\t\t\t\t\t.map((name) => ` ${name}`)\n\t\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tcomponentsToUpdate = components.filter((comp) =>\n\t\t\t\tinstalledComponents.some((ic) => ic.name === comp),\n\t\t\t);\n\n\t\t\tif (componentsToUpdate.length === 0) {\n\t\t\t\tp.log.warn(\"No valid components to update\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t} else {\n\t\t\t// Show interactive prompt with installed components\n\t\t\tconst choices = installedComponents.map((comp) => ({\n\t\t\t\tvalue: comp.name,\n\t\t\t\tlabel: comp.name,\n\t\t\t}));\n\n\t\t\tconst selected = await p.multiselect({\n\t\t\t\tmessage: \"Select components to update\",\n\t\t\t\toptions: choices,\n\t\t\t});\n\n\t\t\tif (p.isCancel(selected)) {\n\t\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tcomponentsToUpdate = selected as string[];\n\t\t}\n\n\t\tif (componentsToUpdate.length === 0) {\n\t\t\tp.log.warn(\"No components selected for update\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\t// Confirm update\n\t\tconst confirmed = await p.confirm({\n\t\t\tmessage: `Check for updates to ${componentsToUpdate\n\t\t\t\t.map((comp) => highlighter.info(comp))\n\t\t\t\t.join(\", \")} ${componentsToUpdate.length > 1 ? \"components\" : \"component\"}?`,\n\t\t});\n\n\t\tif (!confirmed || p.isCancel(confirmed)) {\n\t\t\tp.cancel(\"Operation cancelled\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tconst results = {\n\t\t\tupdated: [] as UpdateResult[],\n\t\t\tskipped: [] as UpdateResult[],\n\t\t\tfailed: [] as UpdateResult[],\n\t\t};\n\n\t\t// ================================================================\n\t\t// Update Components\n\t\t// ================================================================\n\t\tfor (const comp of componentsToUpdate) {\n\t\t\tconst currentVersion = installedComponents.find((ic) => ic.name === comp)?.version;\n\t\t\tif (!currentVersion) {\n\t\t\t\tresults.failed.push({\n\t\t\t\t\tname: comp,\n\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\terror: \"Could not determine current version\",\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst result = await updateComponent(comp, currentVersion);\n\t\t\tswitch (result.status) {\n\t\t\t\tcase \"updated\":\n\t\t\t\t\tresults.updated.push(result);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"skipped\":\n\t\t\t\t\tresults.skipped.push(result);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"failed\":\n\t\t\t\t\tresults.failed.push(result);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// ================================================================\n\t\t// Update Config File\n\t\t// ================================================================\n\t\tif (results.updated.length > 0) {\n\t\t\ttry {\n\t\t\t\t// Create a map of current components, excluding updated ones\n\t\t\t\tconst updatedComponentNames = new Set(results.updated.map((r) => r.name));\n\t\t\t\tconst currentComponents = config.components.filter(\n\t\t\t\t\t(comp) => !updatedComponentNames.has(comp.name),\n\t\t\t\t);\n\n\t\t\t\t// Add the updated components with their new versions\n\t\t\t\tconst updatedComponents = [\n\t\t\t\t\t...currentComponents,\n\t\t\t\t\t...results.updated.map((r) => ({\n\t\t\t\t\t\tname: r.name,\n\t\t\t\t\t\tversion: r.newVersion!,\n\t\t\t\t\t})),\n\t\t\t\t];\n\n\t\t\t\tawait updateConfig(\n\t\t\t\t\t{\n\t\t\t\t\t\tcomponents: updatedComponents,\n\t\t\t\t\t},\n\t\t\t\t\t{ appendComponents: false },\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tp.log.error(\n\t\t\t\t\t`Failed to update config: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n\t\t\t\t);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t}\n\n\t\t// ================================================================\n\t\t// Update summary\n\t\t// ================================================================\n\t\tp.log.message(`\\n\\n${highlighter.underline(\"Update Summary\")}`);\n\n\t\tif (results.skipped.length > 0) {\n\t\t\tp.log.info(\n\t\t\t\t`${highlighter.info(\"Components already up to date or skipped:\")}\\n${results.skipped\n\t\t\t\t\t.map((r) => ` ${r.name} (${r.oldVersion})`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tif (results.updated.length > 0) {\n\t\t\tp.log.success(\n\t\t\t\t`${highlighter.success(\"Successfully updated components:\")}\\n${results.updated\n\t\t\t\t\t.map((r) => ` ${r.name} (${r.oldVersion} → ${r.newVersion})`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tif (results.failed.length > 0) {\n\t\t\tp.log.error(\n\t\t\t\t`${highlighter.error(\"Failed to update components:\")}\\n${results.failed\n\t\t\t\t\t.map((r) => ` ${r.name} - ${r.error}`)\n\t\t\t\t\t.join(\"\\n\")}`,\n\t\t\t);\n\t\t}\n\n\t\tawait sleep(1000);\n\n\t\tif (results.updated.length > 0) {\n\t\t\tp.outro(\"Components updated successfully 🚀\");\n\t\t} else if (results.skipped.length > 0 && results.failed.length === 0) {\n\t\t\tp.outro(\"Components already up to date or skipped ✨\");\n\t\t} else {\n\t\t\tp.cancel(\"No components were updated\");\n\t\t\tprocess.exit(1);\n\t\t}\n\t} catch (error) {\n\t\tp.log.error(error instanceof Error ? error.message : \"Failed to update components\");\n\t\tp.cancel(\"Operation cancelled\");\n\t\tprocess.exit(1);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AACA,SAAS,eAAe;;;ACDxB,YAAY,UAAU;AACtB,SAAS,qBAAqB;AAC9B,OAAO,QAAQ;;;ACFf,SAAS,gBAAgB;AACzB,SAAS,SAAS;AAElB,IAAM,kBAAkB,EAAE,OAAO;AAAA,EACh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