aetherx-dt-ui 0.1.2 → 0.1.3

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.
@@ -182,6 +182,12 @@ function appendComponentDoc(componentName) {
182
182
  const separator = "\n---\n\n";
183
183
  fs.appendFileSync(agentPath, docContent + separator, "utf-8");
184
184
  }
185
+ function rebuildAgentMd(config) {
186
+ createAgentMd();
187
+ for (const componentName of config.installedComponents) {
188
+ appendComponentDoc(componentName);
189
+ }
190
+ }
185
191
 
186
192
  async function initCommand() {
187
193
  p.intro(pc.bold(pc.cyan("dt-ui init")));
@@ -432,9 +438,82 @@ async function listCommand() {
432
438
  p.outro("");
433
439
  }
434
440
 
441
+ async function updateCommand() {
442
+ p.intro(pc.bold(pc.cyan("dt-ui update")));
443
+ if (!configExists()) {
444
+ p.cancel("No .dtui.json found. Run `npx dt-ui init` first.");
445
+ process.exit(1);
446
+ }
447
+ const config = readConfig();
448
+ const registry = loadRegistry();
449
+ const s = p.spinner();
450
+ s.start("Updating base.css...");
451
+ const stylesPath = path.resolve(process.cwd(), config.stylesDir);
452
+ fs.mkdirSync(stylesPath, { recursive: true });
453
+ fs.writeFileSync(
454
+ path.join(stylesPath, "base.css"),
455
+ getStylesContent(),
456
+ "utf-8"
457
+ );
458
+ s.stop("base.css updated");
459
+ s.start("Updating lib/utils.ts...");
460
+ const libPath = path.resolve(process.cwd(), config.libDir);
461
+ fs.mkdirSync(libPath, { recursive: true });
462
+ fs.writeFileSync(
463
+ path.join(libPath, "utils.ts"),
464
+ getLibContent(),
465
+ "utf-8"
466
+ );
467
+ s.stop("lib/utils.ts updated");
468
+ if (config.installedComponents.length > 0) {
469
+ const updateComponents = await p.confirm({
470
+ message: `Update ${config.installedComponents.length} installed component(s)? This will overwrite any local changes.`,
471
+ initialValue: false
472
+ });
473
+ if (!p.isCancel(updateComponents) && updateComponents) {
474
+ const updatedComponents = [];
475
+ for (const componentName of config.installedComponents) {
476
+ const comp = registry.components[componentName];
477
+ if (!comp) continue;
478
+ s.start(`Updating ${pc.cyan(comp.name)}...`);
479
+ const files = getComponentFiles(componentName);
480
+ const targetDir = path.resolve(
481
+ process.cwd(),
482
+ config.componentsDir,
483
+ componentName
484
+ );
485
+ fs.mkdirSync(targetDir, { recursive: true });
486
+ for (const file of files) {
487
+ fs.writeFileSync(path.join(targetDir, file.name), file.content, "utf-8");
488
+ }
489
+ updatedComponents.push(componentName);
490
+ s.stop(`${pc.green("\u2713")} ${comp.name} updated`);
491
+ }
492
+ if (updatedComponents.length > 0) {
493
+ p.log.success(`${updatedComponents.length} component(s) updated`);
494
+ }
495
+ }
496
+ }
497
+ if (config.agent) {
498
+ s.start("Rebuilding AGENT.md...");
499
+ rebuildAgentMd(config);
500
+ s.stop("AGENT.md rebuilt");
501
+ }
502
+ p.note(
503
+ [
504
+ `${pc.green("\u2713")} base.css \u2014 latest design tokens`,
505
+ `${pc.green("\u2713")} lib/utils.ts \u2014 latest helpers`,
506
+ config.agent ? `${pc.green("\u2713")} AGENT.md \u2014 rebuilt with current components` : ""
507
+ ].filter(Boolean).join("\n"),
508
+ "Updated files"
509
+ );
510
+ p.outro(pc.green("dt-ui updated successfully!"));
511
+ }
512
+
435
513
  const program = new Command();
436
514
  program.name("dt-ui").description("DT UI \u2014 Lightweight, customizable Vue components for DT projects").version("0.1.0");
437
515
  program.command("init").description("Initialize dt-ui in your project").action(initCommand);
438
516
  program.command("add").description("Add a component to your project").argument("[components...]", "Component names to add").action(addCommand);
439
517
  program.command("list").description("List all available components").action(listCommand);
518
+ program.command("update").description("Update base.css, utils, and AGENT.md to latest version").action(updateCommand);
440
519
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aetherx-dt-ui",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Lightweight, customizable Vue components for DT projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -3,7 +3,7 @@
3
3
  --dt-background: hsl(0 0% 100%);
4
4
  --dt-foreground: hsl(240 10% 10%);
5
5
 
6
- /* Primary — the brand color (RGB 0, 150, 178) */
6
+ /* Primary — brand color (RGB 0, 150, 178) */
7
7
  --dt-primary: hsl(190 100% 35%);
8
8
  --dt-primary-hover: hsl(190 100% 28%);
9
9
  --dt-primary-foreground: hsl(0 0% 100%);