@tokens-studio/tokenscript-schemas 0.0.13 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/README.md +21 -0
  2. package/bundled/functions/adjust_chroma.json +60 -0
  3. package/bundled/functions/adjust_hue.json +60 -0
  4. package/bundled/functions/adjust_lightness.json +60 -0
  5. package/bundled/functions/adjust_to_contrast.json +67 -0
  6. package/bundled/functions/alpha_blend.json +31 -0
  7. package/bundled/functions/alpha_scale.json +27 -0
  8. package/bundled/functions/analogous.json +32 -0
  9. package/bundled/functions/apca_contrast.json +27 -0
  10. package/bundled/functions/are_similar.json +73 -0
  11. package/bundled/functions/auto_text_color.json +66 -0
  12. package/bundled/functions/best_contrast.json +28 -0
  13. package/bundled/functions/chroma.json +54 -0
  14. package/bundled/functions/clamp_chroma.json +66 -0
  15. package/bundled/functions/clamp_lightness.json +66 -0
  16. package/bundled/functions/clamp_to_gamut.json +23 -0
  17. package/bundled/functions/complement.json +24 -0
  18. package/bundled/functions/contrast_ratio.json +27 -0
  19. package/bundled/functions/cooler.json +52 -0
  20. package/bundled/functions/darken.json +28 -0
  21. package/bundled/functions/delta_e_2000.json +40 -0
  22. package/bundled/functions/delta_e_76.json +27 -0
  23. package/bundled/functions/delta_e_ok.json +27 -0
  24. package/bundled/functions/desaturate.json +28 -0
  25. package/bundled/functions/distributed.json +36 -0
  26. package/bundled/functions/diverging.json +36 -0
  27. package/bundled/functions/grayscale.json +24 -0
  28. package/bundled/functions/harmonize.json +65 -0
  29. package/bundled/functions/hue.json +54 -0
  30. package/bundled/functions/hue_difference.json +27 -0
  31. package/bundled/functions/in_gamut.json +27 -0
  32. package/bundled/functions/interpolate.json +66 -0
  33. package/bundled/functions/invert.json +1 -1
  34. package/bundled/functions/is_cool.json +23 -0
  35. package/bundled/functions/is_dark.json +27 -0
  36. package/bundled/functions/is_light.json +27 -0
  37. package/bundled/functions/is_neutral.json +65 -0
  38. package/bundled/functions/is_warm.json +23 -0
  39. package/bundled/functions/lighten.json +28 -0
  40. package/bundled/functions/lightness.json +61 -0
  41. package/bundled/functions/luminance.json +23 -0
  42. package/bundled/functions/meets_contrast.json +31 -0
  43. package/bundled/functions/mix.json +32 -0
  44. package/bundled/functions/monochromatic.json +28 -0
  45. package/bundled/functions/muted.json +59 -0
  46. package/bundled/functions/neutral_variant.json +59 -0
  47. package/bundled/functions/relative_luminance.json +61 -0
  48. package/bundled/functions/rotate_hue.json +28 -0
  49. package/bundled/functions/saturate.json +28 -0
  50. package/bundled/functions/scale_chroma.json +60 -0
  51. package/bundled/functions/scale_lightness.json +60 -0
  52. package/bundled/functions/sepia.json +59 -0
  53. package/bundled/functions/set_chroma.json +28 -0
  54. package/bundled/functions/set_hue.json +28 -0
  55. package/bundled/functions/set_lightness.json +28 -0
  56. package/bundled/functions/shade_scale.json +28 -0
  57. package/bundled/functions/split_complement.json +28 -0
  58. package/bundled/functions/steps.json +32 -0
  59. package/bundled/functions/tetradic.json +24 -0
  60. package/bundled/functions/tint_scale.json +36 -0
  61. package/bundled/functions/to_gamut.json +59 -0
  62. package/bundled/functions/triadic.json +24 -0
  63. package/bundled/functions/vibrant.json +59 -0
  64. package/bundled/functions/warmer.json +52 -0
  65. package/bundled/functions/wcag_level.json +60 -0
  66. package/bundled/functions.json +2602 -6
  67. package/bundled/registry.json +3705 -84
  68. package/bundled/types/css-color.json +151 -0
  69. package/bundled/types/hsl-color.json +66 -0
  70. package/bundled/types/hsv-color.json +57 -0
  71. package/bundled/types/hwb-color.json +66 -0
  72. package/bundled/types/lab-color.json +57 -0
  73. package/bundled/types/lch-color.json +57 -0
  74. package/bundled/types/okhsl-color.json +57 -0
  75. package/bundled/types/okhsv-color.json +57 -0
  76. package/bundled/types/oklab-color.json +87 -0
  77. package/bundled/types/oklch-color.json +57 -0
  78. package/bundled/types/p3-color.json +57 -0
  79. package/bundled/types/p3-linear-color.json +57 -0
  80. package/bundled/types/rgb-color.json +12 -3
  81. package/bundled/types/srgb-color.json +77 -0
  82. package/bundled/types/srgb-linear-color.json +67 -0
  83. package/bundled/types/xyz-d50-color.json +57 -0
  84. package/bundled/types/xyz-d65-color.json +77 -0
  85. package/bundled/types.json +1067 -43
  86. package/dist/cli/index.cjs +231 -22
  87. package/dist/cli/index.cjs.map +1 -1
  88. package/dist/cli/index.js +231 -22
  89. package/dist/cli/index.js.map +1 -1
  90. package/dist/index.cjs +5 -2
  91. package/dist/index.cjs.map +1 -1
  92. package/dist/index.d.cts +4 -1
  93. package/dist/index.d.ts +4 -1
  94. package/dist/index.js +5 -2
  95. package/dist/index.js.map +1 -1
  96. package/package.json +4 -2
  97. package/src/bundler/index.ts +7 -0
  98. package/src/bundler/presets/css.ts +21 -0
  99. package/src/bundler/presets/index.ts +47 -0
  100. package/src/bundler/presets/types.ts +10 -0
  101. package/src/bundler/selective-bundler.ts +9 -0
  102. package/src/bundler/types.ts +1 -0
  103. package/src/cli/commands/bundle.test.ts +34 -0
  104. package/src/cli/commands/bundle.ts +37 -11
  105. package/src/cli/commands/list.ts +36 -4
  106. package/src/cli/commands/presets.ts +81 -0
  107. package/src/cli/index.ts +12 -1
  108. package/src/cli/output-generator.ts +8 -2
  109. package/src/cli/version-info.ts +93 -0
  110. package/src/schemas/types/css-color/from-hsl-color.tokenscript +17 -4
  111. package/src/schemas/types/css-color/from-hwb-color.tokenscript +17 -4
  112. package/src/schemas/types/css-color/from-lab-color.tokenscript +17 -4
  113. package/src/schemas/types/css-color/from-lch-color.tokenscript +17 -4
  114. package/src/schemas/types/css-color/from-oklab-color.tokenscript +17 -4
  115. package/src/schemas/types/css-color/from-oklch-color.tokenscript +17 -4
  116. package/src/schemas/types/css-color/from-p3-color.tokenscript +17 -4
  117. package/src/schemas/types/css-color/from-rgb-color.tokenscript +17 -4
  118. package/src/schemas/types/css-color/from-srgb-color.tokenscript +17 -4
  119. package/src/schemas/types/css-color/from-xyz-d50-color.tokenscript +17 -4
  120. package/src/schemas/types/css-color/from-xyz-d65-color.tokenscript +17 -4
  121. package/src/schemas/types/css-color/unit.test.ts +216 -0
  122. package/src/schemas/types/hex-color/unit.test.ts +18 -0
  123. package/src/schemas/types/hsl-color/hsla-initializer.tokenscript +17 -0
  124. package/src/schemas/types/hsl-color/initializer.tokenscript +6 -1
  125. package/src/schemas/types/hsl-color/schema.json +9 -0
  126. package/src/schemas/types/hsl-color/unit.test.ts +95 -1
  127. package/src/schemas/types/hsv-color/initializer.tokenscript +6 -1
  128. package/src/schemas/types/hsv-color/unit.test.ts +44 -0
  129. package/src/schemas/types/hwb-color/hwba-initializer.tokenscript +17 -0
  130. package/src/schemas/types/hwb-color/initializer.tokenscript +6 -1
  131. package/src/schemas/types/hwb-color/schema.json +9 -0
  132. package/src/schemas/types/hwb-color/unit.test.ts +70 -0
  133. package/src/schemas/types/lab-color/initializer.tokenscript +6 -1
  134. package/src/schemas/types/lab-color/unit.test.ts +44 -0
  135. package/src/schemas/types/lch-color/initializer.tokenscript +6 -1
  136. package/src/schemas/types/lch-color/unit.test.ts +44 -0
  137. package/src/schemas/types/okhsl-color/initializer.tokenscript +8 -1
  138. package/src/schemas/types/okhsl-color/unit.test.ts +37 -0
  139. package/src/schemas/types/okhsv-color/initializer.tokenscript +8 -1
  140. package/src/schemas/types/okhsv-color/unit.test.ts +37 -0
  141. package/src/schemas/types/oklab-color/initializer.tokenscript +6 -1
  142. package/src/schemas/types/oklab-color/unit.test.ts +58 -0
  143. package/src/schemas/types/oklch-color/initializer.tokenscript +6 -1
  144. package/src/schemas/types/oklch-color/unit.test.ts +58 -0
  145. package/src/schemas/types/p3-color/initializer.tokenscript +6 -1
  146. package/src/schemas/types/p3-color/unit.test.ts +47 -0
  147. package/src/schemas/types/rgb-color/initializer.tokenscript +7 -1
  148. package/src/schemas/types/rgb-color/rgba-initializer.tokenscript +17 -0
  149. package/src/schemas/types/rgb-color/schema.json +9 -0
  150. package/src/schemas/types/rgb-color/unit.test.ts +110 -1
  151. package/src/schemas/types/srgb-color/initializer.tokenscript +6 -1
  152. package/src/schemas/types/srgb-color/unit.test.ts +89 -0
  153. package/bundled/types/rgba-color.json +0 -89
@@ -6,6 +6,8 @@ var ulog = require('ulog');
6
6
  var promises = require('fs/promises');
7
7
  var path = require('path');
8
8
  var url = require('url');
9
+ var child_process = require('child_process');
10
+ var fs = require('fs');
9
11
 
10
12
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
11
13
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -19,6 +21,49 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
19
21
  if (typeof require !== "undefined") return require.apply(this, arguments);
20
22
  throw Error('Dynamic require of "' + x + '" is not supported');
21
23
  });
24
+
25
+ // src/bundler/presets/css.ts
26
+ var css = {
27
+ name: "CSS",
28
+ description: "CSS color types",
29
+ types: [
30
+ "hex-color",
31
+ "rgb-color",
32
+ "hsl-color",
33
+ "oklch-color",
34
+ "oklab-color",
35
+ // Converting colors to css strings
36
+ "css-color"
37
+ ],
38
+ functions: ["lighten", "darken", "saturate", "desaturate", "mix", "invert"]
39
+ };
40
+
41
+ // src/bundler/presets/index.ts
42
+ var BUNDLE_PRESETS = {
43
+ css
44
+ };
45
+ function expandPresetSchemas(schemas) {
46
+ const expanded = [];
47
+ for (const schema of schemas) {
48
+ if (schema.startsWith("preset:")) {
49
+ const presetName = schema.slice(7);
50
+ const preset = BUNDLE_PRESETS[presetName];
51
+ if (preset) {
52
+ for (const type of preset.types) {
53
+ expanded.push(type === "*" ? "*" : `type:${type}`);
54
+ }
55
+ for (const func of preset.functions) {
56
+ expanded.push(func === "*" ? "*" : `function:${func}`);
57
+ }
58
+ } else {
59
+ console.warn(`\u26A0 Unknown preset: ${presetName}`);
60
+ }
61
+ } else {
62
+ expanded.push(schema);
63
+ }
64
+ }
65
+ return expanded;
66
+ }
22
67
  async function bundleSchemaFromDirectory(schemaDir, options) {
23
68
  const schemaJsonPath = path.join(schemaDir, "schema.json");
24
69
  const schemaContent = await promises.readFile(schemaJsonPath, "utf-8");
@@ -393,12 +438,15 @@ async function bundleSelectiveSchemas(options) {
393
438
  });
394
439
  }
395
440
  }
441
+ const baseCommand = "npx @tokens-studio/tokenscript-schemas bundle";
442
+ const generatedBy = options.cliArgs?.length ? `${baseCommand} ${options.cliArgs.join(" ")}` : void 0;
396
443
  return {
397
444
  schemas: bundledSchemas,
398
445
  metadata: {
399
446
  requestedSchemas: options.schemas,
400
447
  resolvedDependencies: allSchemas,
401
- generatedAt: (/* @__PURE__ */ new Date()).toISOString()
448
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
449
+ generatedBy
402
450
  },
403
451
  dependencyTree
404
452
  };
@@ -424,16 +472,78 @@ function validateBundleConfig(data) {
424
472
  output: config.output
425
473
  };
426
474
  }
475
+ var __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
476
+ var __dirname$1 = path.dirname(__filename$1);
477
+ function getGitSha() {
478
+ try {
479
+ return child_process.execSync("git rev-parse --short HEAD", {
480
+ encoding: "utf-8",
481
+ stdio: ["pipe", "pipe", "ignore"]
482
+ }).trim();
483
+ } catch {
484
+ return null;
485
+ }
486
+ }
487
+ function isGitRepo() {
488
+ try {
489
+ child_process.execSync("git rev-parse --git-dir", {
490
+ stdio: ["pipe", "pipe", "ignore"]
491
+ });
492
+ return true;
493
+ } catch {
494
+ return false;
495
+ }
496
+ }
497
+ function getPackageVersion() {
498
+ try {
499
+ const paths = [
500
+ path.join(__dirname$1, "../../package.json"),
501
+ // From src/cli
502
+ path.join(__dirname$1, "../../../package.json")
503
+ // From dist/cli
504
+ ];
505
+ for (const path of paths) {
506
+ try {
507
+ const pkg = JSON.parse(fs.readFileSync(path, "utf-8"));
508
+ return pkg.version || "unknown";
509
+ } catch {
510
+ }
511
+ }
512
+ return "unknown";
513
+ } catch {
514
+ return "unknown";
515
+ }
516
+ }
517
+ function getVersionInfo() {
518
+ const githubUrl = "https://github.com/tokens-studio/tokenscript-schemas";
519
+ const isLocal = isGitRepo();
520
+ let version;
521
+ if (isLocal) {
522
+ const sha = getGitSha();
523
+ version = sha ? `local-${sha}` : "local";
524
+ } else {
525
+ version = getPackageVersion();
526
+ }
527
+ return {
528
+ version,
529
+ githubUrl,
530
+ isLocal
531
+ };
532
+ }
427
533
 
428
534
  // src/cli/output-generator.ts
429
535
  function generateOutput(options) {
430
536
  const { schemas, includeHelper = true } = options;
431
537
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
432
- const schemaList = schemas.map((s) => s.uri).join(", ");
538
+ const versionInfo = getVersionInfo();
433
539
  const lines = [];
434
540
  lines.push("// Auto-generated by @tokens-studio/tokenscript-schemas");
541
+ lines.push(`// Version: ${versionInfo.version}`);
542
+ lines.push(`// GitHub: ${versionInfo.githubUrl}`);
543
+ if (options.generatedBy) {
544
+ lines.push(`// Command: ${options.generatedBy}`);
545
+ }
435
546
  lines.push(`// Generated: ${timestamp}`);
436
- lines.push(`// Schemas: ${schemaList}`);
437
547
  lines.push("");
438
548
  lines.push('import { Config } from "@tokens-studio/tokenscript-interpreter";');
439
549
  lines.push("");
@@ -520,36 +630,38 @@ function formatDryRunOutput(schemas, resolvedDependencies) {
520
630
  return lines.join("\n");
521
631
  }
522
632
  function findSchemasDir() {
523
- const __filename = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
524
- const __dirname = path.dirname(__filename);
525
- const fromDist = path.join(__dirname, "../../src/schemas");
526
- const fromSource = path.join(__dirname, "../../schemas");
633
+ const __filename2 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
634
+ const __dirname2 = path.dirname(__filename2);
635
+ const fromSource = path.join(__dirname2, "../../schemas");
636
+ const fromDist = path.join(__dirname2, "../../../src/schemas");
527
637
  try {
528
638
  const fs = __require("fs");
529
- if (fs.existsSync(fromDist)) {
530
- return fromDist;
531
- }
532
639
  if (fs.existsSync(fromSource)) {
533
640
  return fromSource;
534
641
  }
642
+ if (fs.existsSync(fromDist)) {
643
+ return fromDist;
644
+ }
535
645
  } catch {
536
646
  }
537
- return fromDist;
647
+ return fromSource;
538
648
  }
539
- async function bundleSchemas(schemas, schemasDir) {
649
+ async function bundleSchemas(schemas, schemasDir, cliArgs) {
540
650
  const resolvedSchemasDir = findSchemasDir();
541
651
  log2.info("Bundling schemas:", schemas);
542
652
  log2.debug("Schemas directory:", resolvedSchemasDir);
543
653
  const result = await bundleSelectiveSchemas({
544
654
  schemas,
545
- schemasDir: resolvedSchemasDir
655
+ schemasDir: resolvedSchemasDir,
656
+ cliArgs
546
657
  });
547
658
  log2.info(
548
659
  `Resolved ${result.metadata.resolvedDependencies.length} schemas (including dependencies)`
549
660
  );
550
661
  const output = generateOutput({
551
662
  schemas: result.schemas,
552
- includeHelper: true
663
+ includeHelper: true,
664
+ generatedBy: result.metadata.generatedBy
553
665
  });
554
666
  return {
555
667
  output,
@@ -572,7 +684,25 @@ async function handleBundleCommand(schemas, options = {}) {
572
684
  if (!configSchemas || configSchemas.length === 0) {
573
685
  throw new Error("No schemas specified. Provide schemas as arguments or via --config");
574
686
  }
575
- const { output, metadata, dependencyTree } = await bundleSchemas(configSchemas);
687
+ configSchemas = expandPresetSchemas(configSchemas);
688
+ const cliArgs = [];
689
+ if (schemas.length > 0) {
690
+ cliArgs.push(...schemas);
691
+ }
692
+ if (options.config) {
693
+ cliArgs.push("--config", options.config);
694
+ }
695
+ if (options.output) {
696
+ cliArgs.push("--output", options.output);
697
+ }
698
+ if (options.dryRun) {
699
+ cliArgs.push("--dry-run");
700
+ }
701
+ const { output, metadata, dependencyTree } = await bundleSchemas(
702
+ configSchemas,
703
+ void 0,
704
+ cliArgs
705
+ );
576
706
  console.log("");
577
707
  console.log(formatDependencyTree(dependencyTree, metadata.requestedSchemas));
578
708
  console.log("");
@@ -592,14 +722,32 @@ async function handleBundleCommand(schemas, options = {}) {
592
722
  }
593
723
  }
594
724
  var log3 = ulog__default.default("list");
595
- async function listSchemas(schemasDir = path.join(process.cwd(), "src/schemas"), options = {}) {
725
+ function findSchemasDir2() {
726
+ const __filename2 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
727
+ const __dirname2 = path.dirname(__filename2);
728
+ const fromDist = path.join(__dirname2, "../../src/schemas");
729
+ const fromSource = path.join(__dirname2, "../../schemas");
730
+ try {
731
+ const fs = __require("fs");
732
+ if (fs.existsSync(fromDist)) {
733
+ return fromDist;
734
+ }
735
+ if (fs.existsSync(fromSource)) {
736
+ return fromSource;
737
+ }
738
+ } catch {
739
+ }
740
+ return fromDist;
741
+ }
742
+ async function listSchemas(schemasDir, options = {}) {
743
+ const resolvedSchemasDir = findSchemasDir2();
596
744
  const showTypes = options.types || !options.types && !options.functions;
597
745
  const showFunctions = options.functions || !options.types && !options.functions;
598
746
  const types = [];
599
747
  const functions = [];
600
748
  if (showTypes) {
601
749
  try {
602
- const typesDir = path.join(schemasDir, "types");
750
+ const typesDir = path.join(resolvedSchemasDir, "types");
603
751
  const typeEntries = await promises.readdir(typesDir, { withFileTypes: true });
604
752
  types.push(
605
753
  ...typeEntries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort()
@@ -610,7 +758,7 @@ async function listSchemas(schemasDir = path.join(process.cwd(), "src/schemas"),
610
758
  }
611
759
  if (showFunctions) {
612
760
  try {
613
- const functionsDir = path.join(schemasDir, "functions");
761
+ const functionsDir = path.join(resolvedSchemasDir, "functions");
614
762
  const funcEntries = await promises.readdir(functionsDir, { withFileTypes: true });
615
763
  functions.push(
616
764
  ...funcEntries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort()
@@ -648,15 +796,68 @@ async function handleListCommand(options = {}) {
648
796
  const output = formatListOutput(result, options);
649
797
  console.log(output);
650
798
  }
799
+ var log4 = ulog__default.default("presets");
800
+ function formatPresetInfo() {
801
+ const lines = [];
802
+ lines.push("=".repeat(60));
803
+ lines.push("Available Bundle Presets");
804
+ lines.push("=".repeat(60));
805
+ for (const [key, preset] of Object.entries(BUNDLE_PRESETS)) {
806
+ lines.push("");
807
+ lines.push(`preset:${key}`);
808
+ lines.push(` ${preset.description}`);
809
+ const typesCount = preset.types.length === 1 && preset.types[0] === "*" ? "all" : preset.types.length;
810
+ lines.push("");
811
+ lines.push(` Types (${typesCount}):`);
812
+ if (preset.types.length > 0 && preset.types[0] !== "*") {
813
+ for (const type of preset.types) {
814
+ lines.push(` - ${type}`);
815
+ }
816
+ } else {
817
+ lines.push(` - all`);
818
+ }
819
+ const functionsCount = preset.functions.length === 1 && preset.functions[0] === "*" ? "all" : preset.functions.length;
820
+ lines.push("");
821
+ lines.push(` Functions (${functionsCount}):`);
822
+ if (preset.functions.length > 0 && preset.functions[0] !== "*") {
823
+ for (const func of preset.functions) {
824
+ lines.push(` - ${func}`);
825
+ }
826
+ } else {
827
+ lines.push(` - all`);
828
+ }
829
+ }
830
+ lines.push("");
831
+ lines.push("=".repeat(60));
832
+ lines.push("Usage Examples:");
833
+ lines.push("=".repeat(60));
834
+ lines.push("npx tokenscript-schemas bundle preset:css");
835
+ lines.push("npx tokenscript-schemas bundle preset:css type:oklab-color");
836
+ lines.push("npx tokenscript-schemas bundle type:hex-color function:lighten");
837
+ lines.push("");
838
+ lines.push("Note: You can combine multiple presets and specific schemas!");
839
+ return lines.join("\n");
840
+ }
841
+ async function handlePresetsCommand() {
842
+ try {
843
+ log4.info("Listing available presets");
844
+ const output = formatPresetInfo();
845
+ console.log(output);
846
+ log4.info(`Listed ${Object.keys(BUNDLE_PRESETS).length} presets`);
847
+ } catch (error) {
848
+ log4.error("Failed to list presets:", error);
849
+ throw error;
850
+ }
851
+ }
651
852
 
652
853
  // src/cli/index.ts
653
- var log4 = ulog__default.default("cli");
854
+ var log5 = ulog__default.default("cli");
654
855
  var cli = cac__default.default("tokenscript-schemas");
655
856
  cli.command("bundle [...schemas]", "Bundle schemas into a JS file").option("-c, --config <path>", "Path to config file").option("-o, --output <path>", "Output file path", { default: "./tokenscript-schemas.js" }).option("-d, --dry-run", "Preview what would be bundled without writing").action(async (schemas, options) => {
656
857
  try {
657
858
  await handleBundleCommand(schemas, options);
658
859
  } catch (error) {
659
- log4.error("Error:", error);
860
+ log5.error("Error:", error);
660
861
  process.exit(1);
661
862
  }
662
863
  });
@@ -664,12 +865,20 @@ cli.command("list", "List available schemas").option("--types", "List only type
664
865
  try {
665
866
  await handleListCommand(options);
666
867
  } catch (error) {
667
- log4.error("Error:", error);
868
+ log5.error("Error:", error);
869
+ process.exit(1);
870
+ }
871
+ });
872
+ cli.command("presets", "List available bundle presets").action(async () => {
873
+ try {
874
+ await handlePresetsCommand();
875
+ } catch (error) {
876
+ log5.error("Error:", error);
668
877
  process.exit(1);
669
878
  }
670
879
  });
671
880
  cli.help();
672
- cli.version("0.0.13");
881
+ cli.version("0.0.14");
673
882
  cli.parse();
674
883
  //# sourceMappingURL=index.cjs.map
675
884
  //# sourceMappingURL=index.cjs.map