@dalexto/lexsys-cli 0.0.4 → 0.0.6

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 CHANGED
@@ -169,16 +169,31 @@ var saveConfig = async (config) => {
169
169
  const configPath = getConfigPath();
170
170
  await writeFile(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
171
171
  };
172
- var crossLayerImportPatterns = [
172
+ var monorepoCrossLayerPatterns = [
173
173
  /\.\.\/\.\.\/primitives\//g,
174
174
  /\.\.\/\.\.\/blocks\//g,
175
175
  /\.\.\/\.\.\/templates\//g
176
176
  ];
177
+ var registryTemplateLayers = ["primitives", "blocks", "templates"];
178
+ var toFlatSiblingImportPath = (importPath) => {
179
+ const segments = importPath.split("/").filter(Boolean);
180
+ if (segments.length >= 2) {
181
+ return `../${segments.join("/")}`;
182
+ }
183
+ const name = segments[0] ?? importPath;
184
+ return `../${name}/${name}`;
185
+ };
177
186
  var rewriteCrossLayerImports = (content) => {
178
187
  let rewritten = content;
179
- for (const pattern of crossLayerImportPatterns) {
188
+ for (const pattern of monorepoCrossLayerPatterns) {
180
189
  rewritten = rewritten.replace(pattern, "../");
181
190
  }
191
+ for (const layer of registryTemplateLayers) {
192
+ const pattern = new RegExp(`from "@/components/${layer}/([^"]+)"`, "g");
193
+ rewritten = rewritten.replace(pattern, (_, importPath) => {
194
+ return `from "${toFlatSiblingImportPath(importPath)}"`;
195
+ });
196
+ }
182
197
  return rewritten;
183
198
  };
184
199
  var prepareInstalledFileContent = (content, item) => {
@@ -298,9 +313,14 @@ var getRegistryTemplatePath = (templatePath) => {
298
313
  );
299
314
  return fileURLToPath(templateUrl);
300
315
  };
301
- var generatedStyleHeader = "/* Generated by @dalexto/lexsys-tokens. Do not edit directly. */";
316
+ var generatedStyleFileHeader = `/**
317
+ * AUTO-GENERATED FILE.
318
+ *
319
+ * Generated by @dalexto/lexsys-tokens.
320
+ * Manual changes will be overwritten.
321
+ `;
302
322
  var isGeneratedLexsysStyle = (content) => {
303
- return content.startsWith(generatedStyleHeader);
323
+ return content.startsWith(generatedStyleFileHeader);
304
324
  };
305
325
  var ensureProjectStructure = async (config) => {
306
326
  await mkdir(join(getCwd(), config.paths.components), { recursive: true });
@@ -1104,7 +1124,14 @@ var runAdd = async (args2) => {
1104
1124
  ]);
1105
1125
  if (!items.length) {
1106
1126
  if (yes) {
1107
- console.log("No components specified. Pass component names to add them.");
1127
+ console.log(
1128
+ "No components specified. Pass names to install non-interactively, for example:"
1129
+ );
1130
+ console.log(" lexsys add button dialog --yes");
1131
+ console.log(
1132
+ "To refresh all tracked components, use `lexsys update --yes` instead."
1133
+ );
1134
+ process.exitCode = 1;
1108
1135
  return;
1109
1136
  }
1110
1137
  items = await promptSelectItems();
@@ -1240,6 +1267,29 @@ var runConfig = async (options = {}) => {
1240
1267
  const config = await loadConfig();
1241
1268
  console.log(JSON.stringify(config, null, 2));
1242
1269
  };
1270
+
1271
+ // src/utils/registry-errors.ts
1272
+ var formatRegistryResolveError = (error) => {
1273
+ return error instanceof Error ? error.message : String(error);
1274
+ };
1275
+ var markRegistryResolveFailure = () => {
1276
+ process.exitCode = 1;
1277
+ };
1278
+ var printRegistryResolveFailure = (error) => {
1279
+ console.log("Failed to resolve registry.");
1280
+ console.log(formatRegistryResolveError(error));
1281
+ markRegistryResolveFailure();
1282
+ };
1283
+ var printRegistryResolveFailureChecklist = (error, options = {}) => {
1284
+ if (options.sectionHeading) {
1285
+ console.log(options.sectionHeading);
1286
+ }
1287
+ console.log("\xD7 failed to resolve registry");
1288
+ console.log(formatRegistryResolveError(error));
1289
+ markRegistryResolveFailure();
1290
+ };
1291
+
1292
+ // src/commands/doctor.ts
1243
1293
  var runDoctor = async (options = {}) => {
1244
1294
  console.log("Lexsys doctor\n");
1245
1295
  const config = await loadConfig();
@@ -1280,10 +1330,9 @@ var runDoctor = async (options = {}) => {
1280
1330
  console.log(`\u2713 items: ${registryResult.items.length}`);
1281
1331
  } catch (error) {
1282
1332
  registryFailed = true;
1283
- console.log("\nRegistry:");
1284
- console.log("\xD7 failed to resolve registry");
1285
- console.log(error instanceof Error ? error.message : String(error));
1286
- process.exitCode = 1;
1333
+ printRegistryResolveFailureChecklist(error, {
1334
+ sectionHeading: "\nRegistry:"
1335
+ });
1287
1336
  }
1288
1337
  if (registryFailed && options.noFallback) {
1289
1338
  return;
@@ -1337,7 +1386,7 @@ Usage
1337
1386
 
1338
1387
  Options
1339
1388
  --dry-run, -d Preview files, dependencies, and install paths
1340
- --yes, -y Auto-confirm safe prompts
1389
+ --yes, -y Non-interactive when component names are provided
1341
1390
  --no-fallback Fail instead of falling back to local registry
1342
1391
  --cwd, -C <path> Run from a different project directory
1343
1392
  --help, -h Show this help
@@ -1366,6 +1415,7 @@ Options
1366
1415
  --help, -h Show this help
1367
1416
 
1368
1417
  Run without arguments for guided update picker.
1418
+ With --yes and no names, updates all tracked components.
1369
1419
 
1370
1420
  Examples
1371
1421
  lexsys up
@@ -1393,6 +1443,9 @@ Usage
1393
1443
  lexsys status
1394
1444
  lexsys st
1395
1445
 
1446
+ Shows template drift for tracked components (up to date vs out of sync).
1447
+ For project paths and registry connectivity, use \`lexsys doctor\`.
1448
+
1396
1449
  Options
1397
1450
  --no-fallback Fail instead of falling back to local registry
1398
1451
  --help, -h Show this help
@@ -1404,6 +1457,7 @@ Usage
1404
1457
  Options
1405
1458
  --dry-run, -d Preview reset without writing files
1406
1459
  --with-deps, -w Also reset installed registry dependencies in the closure
1460
+ --yes, -y Non-interactive; with no names, resets all tracked components
1407
1461
  --no-fallback Fail instead of falling back to local registry
1408
1462
  --cwd, -C <path> Run from a different project directory
1409
1463
  --help, -h Show this help
@@ -1423,6 +1477,8 @@ Usage
1423
1477
  Options
1424
1478
  --dry-run, -d Preview uninstall without removing files
1425
1479
  --with-deps, -w Also remove registry-owned shared dependencies
1480
+ --yes, -y Non-interactive; with no names, uninstalls all tracked components
1481
+ --no-fallback Fail instead of falling back to local registry
1426
1482
  --help, -h Show this help
1427
1483
 
1428
1484
  Run without arguments for guided uninstall picker.
@@ -1436,6 +1492,9 @@ Usage
1436
1492
  lexsys doctor
1437
1493
  lexsys dr
1438
1494
 
1495
+ Checks project paths, registry connectivity, and on-disk component folders.
1496
+ For template drift vs the registry, use \`lexsys status\`.
1497
+
1439
1498
  Options
1440
1499
  --no-fallback Fail instead of falling back to local registry
1441
1500
  --help, -h Show this help
@@ -1501,8 +1560,8 @@ Components
1501
1560
 
1502
1561
  Inspect
1503
1562
  list List available registry items [alias: ls]
1504
- status Show installed component status [alias: st]
1505
- doctor Check local project setup [alias: dr]
1563
+ status Template drift for installed components [alias: st]
1564
+ doctor Project paths and registry health [alias: dr]
1506
1565
  registry Inspect registry source and manifest [alias: reg]
1507
1566
  config Print or update Lexsys config [alias: cfg]
1508
1567
 
@@ -1512,7 +1571,7 @@ Meta
1512
1571
 
1513
1572
  Global Options
1514
1573
  --cwd, -C <path> Run from a different project directory
1515
- --yes, -y Auto-confirm safe prompts where supported
1574
+ --yes, -y Non-interactive mode (add, update, reset, uninstall)
1516
1575
  --no-fallback Disable local registry fallback
1517
1576
  --help, -h Show help
1518
1577
  --version, -v Show CLI version
@@ -2615,9 +2674,7 @@ var runStatus = async (options = {}) => {
2615
2674
  fallback: !options.noFallback
2616
2675
  });
2617
2676
  } catch (error) {
2618
- console.log("Failed to resolve registry.");
2619
- console.log(error instanceof Error ? error.message : String(error));
2620
- process.exitCode = 1;
2677
+ printRegistryResolveFailure(error);
2621
2678
  return;
2622
2679
  }
2623
2680
  console.log("Installed Lexsys components:\n");
@@ -2847,6 +2904,7 @@ var resolveInstalledKey = async (name, installed) => {
2847
2904
  var runReset = async (args2) => {
2848
2905
  const dryRun = hasFlag(args2, "--dry-run", "-d");
2849
2906
  const withDeps = hasFlag(args2, "--with-deps", "-w");
2907
+ const yes = hasFlag(args2, "--yes", "-y");
2850
2908
  const noFallback = hasFlag(args2, "--no-fallback");
2851
2909
  const targetArgs = removeFlagsWithValues(
2852
2910
  removeFlags(args2, [
@@ -2854,6 +2912,8 @@ var runReset = async (args2) => {
2854
2912
  "-d",
2855
2913
  "--with-deps",
2856
2914
  "-w",
2915
+ "--yes",
2916
+ "-y",
2857
2917
  "--no-fallback"
2858
2918
  ]),
2859
2919
  ["--cwd", "-C"]
@@ -2875,13 +2935,17 @@ var runReset = async (args2) => {
2875
2935
  return;
2876
2936
  }
2877
2937
  if (!targetArgs.length) {
2878
- const selected = await promptMultiselect(
2879
- "Select components to reset",
2880
- installed.map((name) => ({ title: name, value: name })),
2881
- { min: 1 }
2882
- );
2883
- if (!selected.length) return;
2884
- targetArgs.push(...selected);
2938
+ if (yes) {
2939
+ targetArgs.push(...installed);
2940
+ } else {
2941
+ const selected = await promptMultiselect(
2942
+ "Select components to reset",
2943
+ installed.map((name) => ({ title: name, value: name })),
2944
+ { min: 1 }
2945
+ );
2946
+ if (!selected.length) return;
2947
+ targetArgs.push(...selected);
2948
+ }
2885
2949
  }
2886
2950
  const resetNames = /* @__PURE__ */ new Set();
2887
2951
  for (const name of targetArgs) {
@@ -2948,6 +3012,7 @@ var collectOrphanedSharedResources = (removedItems, remainingItems) => {
2948
3012
  var runUninstall = async (args2) => {
2949
3013
  const dryRun = hasFlag(args2, "--dry-run", "-d");
2950
3014
  const withDeps = hasFlag(args2, "--with-deps", "-w");
3015
+ const yes = hasFlag(args2, "--yes", "-y");
2951
3016
  const noFallback = hasFlag(args2, "--no-fallback");
2952
3017
  const targetArgs = removeFlagsWithValues(
2953
3018
  removeFlags(args2, [
@@ -2955,27 +3020,31 @@ var runUninstall = async (args2) => {
2955
3020
  "-d",
2956
3021
  "--with-deps",
2957
3022
  "-w",
3023
+ "--yes",
3024
+ "-y",
2958
3025
  "--no-fallback"
2959
3026
  ]),
2960
3027
  ["--cwd", "-C"]
2961
3028
  );
3029
+ const config = await loadConfig();
3030
+ const installed = [...config.installed ?? []];
2962
3031
  if (!targetArgs.length) {
2963
- const preConfig = await loadConfig();
2964
- const installedNames = preConfig.installed ?? [];
2965
- if (installedNames.length === 0) {
3032
+ if (!installed.length) {
2966
3033
  console.log("No components installed.");
2967
3034
  return;
2968
3035
  }
2969
- const selected = await promptMultiselect(
2970
- "Select components to uninstall",
2971
- installedNames.map((name) => ({ title: name, value: name })),
2972
- { min: 1 }
2973
- );
2974
- if (!selected.length) return;
2975
- targetArgs.push(...selected);
3036
+ if (yes) {
3037
+ targetArgs.push(...installed);
3038
+ } else {
3039
+ const selected = await promptMultiselect(
3040
+ "Select components to uninstall",
3041
+ installed.map((name) => ({ title: name, value: name })),
3042
+ { min: 1 }
3043
+ );
3044
+ if (!selected.length) return;
3045
+ targetArgs.push(...selected);
3046
+ }
2976
3047
  }
2977
- const config = await loadConfig();
2978
- const installed = [...config.installed ?? []];
2979
3048
  const resolvedTargets = [];
2980
3049
  const notTracked = [];
2981
3050
  for (const name of targetArgs) {
@@ -0,0 +1,6 @@
1
+ export declare const formatRegistryResolveError: (error: unknown) => string;
2
+ export declare const markRegistryResolveFailure: () => void;
3
+ export declare const printRegistryResolveFailure: (error: unknown) => void;
4
+ export declare const printRegistryResolveFailureChecklist: (error: unknown, options?: {
5
+ sectionHeading?: string;
6
+ }) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalexto/lexsys-cli",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Registry-first CLI that installs Lexsys React UI components into your project",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "prompts": "^2.4.2",
35
- "@dalexto/lexsys-registry": "0.0.4"
35
+ "@dalexto/lexsys-registry": "0.0.6"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^25.9.1",