@h3ravel/musket 0.6.16 → 0.6.18

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.cjs CHANGED
@@ -510,10 +510,18 @@ var Signature = class Signature {
510
510
  } else flags.push(part);
511
511
  }
512
512
  }
513
- const desc = description.match(/^([^:]+?)\s*:\s*\[?([\w\s,]+)\]?$/);
514
- if (match) {
515
- description = desc?.[1].trim() ?? description;
516
- choices = desc?.[2].split(",").map((s) => s.trim()).filter(Boolean) ?? choices;
513
+ /**
514
+ * Extract choices from the descriptions.
515
+ *
516
+ * Choices can be in the format:
517
+ * [choice1, choice2, choice3]
518
+ * choice1, choice2, choice3
519
+ * choices can have dots as well: [opt1.val, opt2.val]
520
+ */
521
+ const desc = description.match(/\[([^\]]+)\]/) || description.match(/: ([^:\[\]]+(?:,[^:\[\]]+)*)$/);
522
+ if (desc) {
523
+ description = description.replace(desc[0], "").trim();
524
+ choices = desc[1].split(",").map((c) => c.trim());
517
525
  }
518
526
  options.push({
519
527
  name: isFlag ? flags[flags.length - 1] : name,
@@ -636,7 +644,7 @@ var Musket = class Musket {
636
644
  }
637
645
  async loadDiscoveredCommands() {
638
646
  const commands = [...(this.app.registeredCommands ?? []).map((cmd) => new cmd(this.app, this.kernel))];
639
- const paths = Array.isArray(this.config.discoveryPaths) ? this.config.discoveryPaths : [this.config.discoveryPaths];
647
+ const paths = (Array.isArray(this.config.discoveryPaths) ? this.config.discoveryPaths : [this.config.discoveryPaths]).filter((e) => typeof e === "string");
640
648
  /**
641
649
  * CLI Commands auto registration
642
650
  */
package/dist/index.js CHANGED
@@ -486,10 +486,18 @@ var Signature = class Signature {
486
486
  } else flags.push(part);
487
487
  }
488
488
  }
489
- const desc = description.match(/^([^:]+?)\s*:\s*\[?([\w\s,]+)\]?$/);
490
- if (match) {
491
- description = desc?.[1].trim() ?? description;
492
- choices = desc?.[2].split(",").map((s) => s.trim()).filter(Boolean) ?? choices;
489
+ /**
490
+ * Extract choices from the descriptions.
491
+ *
492
+ * Choices can be in the format:
493
+ * [choice1, choice2, choice3]
494
+ * choice1, choice2, choice3
495
+ * choices can have dots as well: [opt1.val, opt2.val]
496
+ */
497
+ const desc = description.match(/\[([^\]]+)\]/) || description.match(/: ([^:\[\]]+(?:,[^:\[\]]+)*)$/);
498
+ if (desc) {
499
+ description = description.replace(desc[0], "").trim();
500
+ choices = desc[1].split(",").map((c) => c.trim());
493
501
  }
494
502
  options.push({
495
503
  name: isFlag ? flags[flags.length - 1] : name,
@@ -612,7 +620,7 @@ var Musket = class Musket {
612
620
  }
613
621
  async loadDiscoveredCommands() {
614
622
  const commands = [...(this.app.registeredCommands ?? []).map((cmd) => new cmd(this.app, this.kernel))];
615
- const paths = Array.isArray(this.config.discoveryPaths) ? this.config.discoveryPaths : [this.config.discoveryPaths];
623
+ const paths = (Array.isArray(this.config.discoveryPaths) ? this.config.discoveryPaths : [this.config.discoveryPaths]).filter((e) => typeof e === "string");
616
624
  /**
617
625
  * CLI Commands auto registration
618
626
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h3ravel/musket",
3
- "version": "0.6.16",
3
+ "version": "0.6.18",
4
4
  "description": "Musket CLI is a framework-agnostic CLI framework designed to allow you build artisan-like CLI apps and for use in the H3ravel framework.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -63,7 +63,7 @@
63
63
  "vitest": "^3.2.4"
64
64
  },
65
65
  "dependencies": {
66
- "@h3ravel/shared": "^0.29.0-alpha.8",
66
+ "@h3ravel/shared": "^0.28.4",
67
67
  "chalk": "^5.6.2",
68
68
  "commander": "^14.0.1",
69
69
  "dayjs": "^1.11.18",