@h3ravel/musket 0.6.0 → 0.6.2

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
@@ -23,11 +23,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  //#endregion
24
24
  let __h3ravel_shared = require("@h3ravel/shared");
25
25
  let commander = require("commander");
26
+ let __h3ravel_support = require("@h3ravel/support");
26
27
  let tsdown = require("tsdown");
27
28
  let glob = require("glob");
28
29
  let node_path = require("node:path");
29
30
  node_path = __toESM(node_path);
30
- let __h3ravel_support = require("@h3ravel/support");
31
31
  let node_module = require("node:module");
32
32
  let node_fs_promises = require("node:fs/promises");
33
33
 
@@ -77,8 +77,8 @@ var Command = class {
77
77
  setApplication(app) {
78
78
  this.app = app;
79
79
  }
80
- setInput(options, args, regArgs, dictionary, program$1) {
81
- this.program = program$1;
80
+ setInput(options, args, regArgs, dictionary, program) {
81
+ this.program = program;
82
82
  this.dictionary = dictionary;
83
83
  this.input.options = options;
84
84
  this.input.arguments = regArgs.map((e, i) => ({ [e.name()]: args[i] })).reduce((e, x) => Object.assign(e, x), {});
@@ -94,8 +94,8 @@ var Command = class {
94
94
  this.program.setOptionValue(key, value);
95
95
  return this;
96
96
  }
97
- setProgram(program$1) {
98
- this.program = program$1;
97
+ setProgram(program) {
98
+ this.program = program;
99
99
  return this;
100
100
  }
101
101
  getSignature() {
@@ -255,6 +255,147 @@ var Command = class {
255
255
  }
256
256
  };
257
257
 
258
+ //#endregion
259
+ //#region src/Commands/HelpCommand.ts
260
+ var HelpCommand = class extends Command {
261
+ /**
262
+ * The name and signature of the console command.
263
+ *
264
+ * @var string
265
+ */
266
+ signature = `help
267
+ {command_name=help : The command name}
268
+ {--format=txt : The output format}
269
+ `;
270
+ /**
271
+ * The console command description.
272
+ *
273
+ * @var string
274
+ */
275
+ description = "Display help for a command";
276
+ async handle() {
277
+ const cmd = this.argument("command_name");
278
+ if (!cmd) {
279
+ this.program.outputHelp();
280
+ return;
281
+ }
282
+ const target = this.program.commands.find((c) => c.name() === cmd);
283
+ if (!target) {
284
+ this.error(`ERROR: Unknown command: ${__h3ravel_shared.Logger.log(cmd, ["italic", "grey"], false)}.`);
285
+ process.exit(1);
286
+ }
287
+ target.outputHelp();
288
+ }
289
+ };
290
+
291
+ //#endregion
292
+ //#region src/logo.ts
293
+ const logo = String.raw`
294
+ 111
295
+ 111111111
296
+ 1111111111 111111
297
+ 111111 111 111111
298
+ 111111 111 111111
299
+ 11111 111 11111
300
+ 1111111 111 1111111
301
+ 111 11111 111 111111 111 1111 1111 11111111 1111
302
+ 111 11111 1111 111111 111 1111 1111 1111 11111 1111
303
+ 111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
304
+ 111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
305
+ 111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
306
+ 111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
307
+ 111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
308
+ 1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
309
+ 11011 111111 11 11111
310
+ 111111 11101 111111
311
+ 111111 111 111111
312
+ 111111 111 111111
313
+ 111111111
314
+ 110
315
+ `;
316
+ const altLogo = String.raw`
317
+ _ _ _____ _
318
+ | | | |___ / _ __ __ ___ _____| |
319
+ | |_| | |_ \| '__/ _ \ \ / / _ \ |
320
+ | _ |___) | | | (_| |\ V / __/ |
321
+ |_| |_|____/|_| \__,_| \_/ \___|_|
322
+
323
+ `;
324
+
325
+ //#endregion
326
+ //#region src/Commands/ListCommand.ts
327
+ var ListCommand = class ListCommand extends Command {
328
+ /**
329
+ * The name and signature of the console command.
330
+ *
331
+ * @var string
332
+ */
333
+ signature = "list";
334
+ /**
335
+ * The console command description.
336
+ *
337
+ * @var string
338
+ */
339
+ description = "List all available commands";
340
+ async handle() {
341
+ const options = [{
342
+ short: "-h",
343
+ long: "--help",
344
+ description: "Display help for the given command. When no command is given display help for the list command"
345
+ }].concat(this.program.options).map((e) => {
346
+ return __h3ravel_shared.Logger.describe(__h3ravel_shared.Logger.log(" " + [e.short, e.long].filter((e$1) => !!e$1).join(", "), "green", false), e.description, 25, false).join("");
347
+ });
348
+ /** Get the program commands */
349
+ const commands = this.program.commands.map((e) => {
350
+ return __h3ravel_shared.Logger.describe(__h3ravel_shared.Logger.log(" " + e.name(), "green", false), e.description(), 25, false).join("");
351
+ });
352
+ const list = ListCommand.groupItems(commands);
353
+ /** Output the modules version */
354
+ const version = this.kernel.modules.map((e) => {
355
+ return __h3ravel_shared.Logger.log([[`${__h3ravel_support.Str.of(e.alias ?? e.name).afterLast("/").ucfirst().replace(["-", "_"], " ").replace("cli", "CLI", false)}:`, "white"], [e.version, "green"]], " ", false);
356
+ }).join(" | ");
357
+ this.newLine();
358
+ console.log(version);
359
+ this.newLine();
360
+ console.log(this.kernel.config.logo ?? altLogo);
361
+ this.newLine();
362
+ __h3ravel_shared.Logger.log("Usage:", "yellow");
363
+ __h3ravel_shared.Logger.log(" command [options] [arguments]", "white");
364
+ this.newLine();
365
+ /** Output the options */
366
+ __h3ravel_shared.Logger.log("Options:", "yellow");
367
+ console.log(options.join("\n").trim());
368
+ this.newLine();
369
+ /** Ootput the commands */
370
+ __h3ravel_shared.Logger.log("Available Commands:", "yellow");
371
+ console.log(list.join("\n\n").trim());
372
+ this.newLine();
373
+ }
374
+ /**
375
+ * Group Commands based on thier names
376
+ *
377
+ * @param commands
378
+ * @returns
379
+ */
380
+ static groupItems(commands, fmtd = false) {
381
+ const grouped = commands.reduce((acc, cmd) => {
382
+ /** strip colors before checking prefix */
383
+ const clean = cmd.replace(/\x1b\[\d+m/g, "");
384
+ const prefix = clean.includes(":") ? clean.split(":")[0].trim() : "__root__";
385
+ acc[prefix] ??= [];
386
+ /** keep original with colors */
387
+ acc[prefix].push(cmd);
388
+ return acc;
389
+ }, {});
390
+ return Object.entries(grouped).map(([group, cmds]) => {
391
+ const label = group === "__root__" ? "" : group;
392
+ let out = [__h3ravel_shared.Logger.log(label, "yellow", false), cmds.join("\n")].join("\n");
393
+ if (fmtd) out += "\n";
394
+ return out;
395
+ });
396
+ }
397
+ };
398
+
258
399
  //#endregion
259
400
  //#region src/Signature.ts
260
401
  var Signature = class Signature {
@@ -441,147 +582,6 @@ var Signature = class Signature {
441
582
  }
442
583
  };
443
584
 
444
- //#endregion
445
- //#region src/logo.ts
446
- const logo = String.raw`
447
- 111
448
- 111111111
449
- 1111111111 111111
450
- 111111 111 111111
451
- 111111 111 111111
452
- 11111 111 11111
453
- 1111111 111 1111111
454
- 111 11111 111 111111 111 1111 1111 11111111 1111
455
- 111 11111 1111 111111 111 1111 1111 1111 11111 1111
456
- 111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
457
- 111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
458
- 111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
459
- 111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
460
- 111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
461
- 1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
462
- 11011 111111 11 11111
463
- 111111 11101 111111
464
- 111111 111 111111
465
- 111111 111 111111
466
- 111111111
467
- 110
468
- `;
469
- const altLogo = String.raw`
470
- _ _ _____ _
471
- | | | |___ / _ __ __ ___ _____| |
472
- | |_| | |_ \| '__/ _ \ \ / / _ \ |
473
- | _ |___) | | | (_| |\ V / __/ |
474
- |_| |_|____/|_| \__,_| \_/ \___|_|
475
-
476
- `;
477
-
478
- //#endregion
479
- //#region src/Commands/HelpCommand.ts
480
- var HelpCommand = class extends Command {
481
- /**
482
- * The name and signature of the console command.
483
- *
484
- * @var string
485
- */
486
- signature = `help
487
- {command_name=help : The command name}
488
- {--format=txt : The output format}
489
- `;
490
- /**
491
- * The console command description.
492
- *
493
- * @var string
494
- */
495
- description = "Display help for a command";
496
- async handle() {
497
- const cmd = this.argument("command_name");
498
- if (!cmd) {
499
- this.program.outputHelp();
500
- return;
501
- }
502
- const target = this.program.commands.find((c) => c.name() === cmd);
503
- if (!target) {
504
- this.error(`ERROR: Unknown command: ${__h3ravel_shared.Logger.log(cmd, ["italic", "grey"], false)}.`);
505
- process.exit(1);
506
- }
507
- target.outputHelp();
508
- }
509
- };
510
-
511
- //#endregion
512
- //#region src/Commands/ListCommand.ts
513
- var ListCommand = class ListCommand extends Command {
514
- /**
515
- * The name and signature of the console command.
516
- *
517
- * @var string
518
- */
519
- signature = "list";
520
- /**
521
- * The console command description.
522
- *
523
- * @var string
524
- */
525
- description = "List all available commands";
526
- async handle() {
527
- const options = [{
528
- short: "-h",
529
- long: "--help",
530
- description: "Display help for the given command. When no command is given display help for the list command"
531
- }].concat(this.program.options).map((e) => {
532
- return __h3ravel_shared.Logger.describe(__h3ravel_shared.Logger.log(" " + [e.short, e.long].filter((e$1) => !!e$1).join(", "), "green", false), e.description, 25, false).join("");
533
- });
534
- /** Get the program commands */
535
- const commands = this.program.commands.map((e) => {
536
- return __h3ravel_shared.Logger.describe(__h3ravel_shared.Logger.log(" " + e.name(), "green", false), e.description(), 25, false).join("");
537
- });
538
- const list = ListCommand.groupItems(commands);
539
- /** Output the modules version */
540
- const version = this.kernel.modules.map((e) => {
541
- return __h3ravel_shared.Logger.log([[`${__h3ravel_support.Str.of(e.alias ?? e.name).afterLast("/").ucfirst().replace(["-", "_"], " ").replace("cli", "CLI", false)}:`, "white"], [e.version, "green"]], " ", false);
542
- }).join(" | ");
543
- this.newLine();
544
- console.log(version);
545
- this.newLine();
546
- console.log(this.kernel.config.logo ?? altLogo);
547
- this.newLine();
548
- __h3ravel_shared.Logger.log("Usage:", "yellow");
549
- __h3ravel_shared.Logger.log(" command [options] [arguments]", "white");
550
- this.newLine();
551
- /** Output the options */
552
- __h3ravel_shared.Logger.log("Options:", "yellow");
553
- console.log(options.join("\n").trim());
554
- this.newLine();
555
- /** Ootput the commands */
556
- __h3ravel_shared.Logger.log("Available Commands:", "yellow");
557
- console.log(list.join("\n\n").trim());
558
- this.newLine();
559
- }
560
- /**
561
- * Group Commands based on thier names
562
- *
563
- * @param commands
564
- * @returns
565
- */
566
- static groupItems(commands, fmtd = false) {
567
- const grouped = commands.reduce((acc, cmd) => {
568
- /** strip colors before checking prefix */
569
- const clean = cmd.replace(/\x1b\[\d+m/g, "");
570
- const prefix = clean.includes(":") ? clean.split(":")[0].trim() : "__root__";
571
- acc[prefix] ??= [];
572
- /** keep original with colors */
573
- acc[prefix].push(cmd);
574
- return acc;
575
- }, {});
576
- return Object.entries(grouped).map(([group, cmds]) => {
577
- const label = group === "__root__" ? "" : group;
578
- let out = [__h3ravel_shared.Logger.log(label, "yellow", false), cmds.join("\n")].join("\n");
579
- if (fmtd) out += "\n";
580
- return out;
581
- });
582
- }
583
- };
584
-
585
585
  //#endregion
586
586
  //#region src/Musket.ts
587
587
  var Musket = class Musket {
@@ -593,12 +593,14 @@ var Musket = class Musket {
593
593
  cliName = "musket";
594
594
  config = {};
595
595
  commands = [];
596
+ program;
596
597
  constructor(app, kernel, baseCommands = [], resolver, tsDownConfig = {}) {
597
598
  this.app = app;
598
599
  this.kernel = kernel;
599
600
  this.baseCommands = baseCommands;
600
601
  this.resolver = resolver;
601
602
  this.tsDownConfig = tsDownConfig;
603
+ this.program = new commander.Command();
602
604
  }
603
605
  async build() {
604
606
  await this.loadBaseCommands().loadDiscoveredCommands();
@@ -661,10 +663,16 @@ var Musket = class Musket {
661
663
  *
662
664
  * @param command
663
665
  */
664
- resolveCommands(commands) {
666
+ registerCommands(commands) {
665
667
  commands.forEach((e) => this.addCommand(e));
666
668
  return this;
667
669
  }
670
+ /**
671
+ * Get all the registered commands
672
+ */
673
+ getRegisteredCommands() {
674
+ return this.commands;
675
+ }
668
676
  async initialize() {
669
677
  if (process.argv.includes("--help") || process.argv.includes("-h")) await this.rebuild("help");
670
678
  /**
@@ -683,7 +691,7 @@ var Musket = class Musket {
683
691
  /**
684
692
  * Run the base Command if a root command was not defined
685
693
  */
686
- commander.program.name(this.cliName).version(moduleVersions).description(this.config.logo ?? altLogo).configureHelp({ showGlobalOptions: true }).addOption(new commander.Option(additional.quiet[0], additional.quiet[1])).addOption(new commander.Option(additional.silent[0], additional.silent[1]).implies({ quiet: true })).addOption(new commander.Option(additional.verbose[0], additional.verbose[1]).choices([
694
+ this.program.name(this.cliName).version(moduleVersions).description(this.config.logo ?? altLogo).configureHelp({ showGlobalOptions: true }).addOption(new commander.Option(additional.quiet[0], additional.quiet[1])).addOption(new commander.Option(additional.silent[0], additional.silent[1]).implies({ quiet: true })).addOption(new commander.Option(additional.verbose[0], additional.verbose[1]).choices([
687
695
  "1",
688
696
  "2",
689
697
  "3",
@@ -691,7 +699,7 @@ var Musket = class Musket {
691
699
  "vv"
692
700
  ]).default("1")).addOption(new commander.Option(additional.noInteraction[0], additional.noInteraction[1])).action(async () => {
693
701
  const instance = new ListCommand(this.app, this.kernel);
694
- instance.setInput(commander.program.opts(), commander.program.args, commander.program.registeredArguments, {}, commander.program);
702
+ instance.setInput(this.program.opts(), this.program.args, this.program.registeredArguments, {}, this.program);
695
703
  await this.handle(instance);
696
704
  });
697
705
  else {
@@ -700,8 +708,8 @@ var Musket = class Musket {
700
708
  */
701
709
  const root = new this.config.rootCommand(this.app, this.kernel);
702
710
  const sign = Signature.parseSignature(root.getSignature(), root);
703
- const cmd = commander.program.name(sign.baseCommand).description(sign.description ?? sign.baseCommand).configureHelp({ showGlobalOptions: true }).action(async () => {
704
- root.setInput(commander.program.opts(), commander.program.args, commander.program.registeredArguments, {}, commander.program);
711
+ const cmd = this.program.name(sign.baseCommand).description(sign.description ?? sign.baseCommand).configureHelp({ showGlobalOptions: true }).action(async () => {
712
+ root.setInput(this.program.opts(), this.program.args, this.program.registeredArguments, {}, this.program);
705
713
  await this.handle(root);
706
714
  });
707
715
  if ((sign.options?.length ?? 0) > 0) sign.options?.filter((v, i, a) => a.findIndex((t) => t.name === v.name) === i).forEach((opt) => {
@@ -711,7 +719,7 @@ var Musket = class Musket {
711
719
  /**
712
720
  * Format the help command display
713
721
  */
714
- commander.program.configureHelp({
722
+ this.program.configureHelp({
715
723
  styleTitle: (str) => __h3ravel_shared.Logger.log(str, "yellow", false),
716
724
  styleOptionTerm: (str) => __h3ravel_shared.Logger.log(str, "green", false),
717
725
  styleArgumentTerm: (str) => __h3ravel_shared.Logger.log(str, "green", false),
@@ -739,8 +747,8 @@ var Musket = class Musket {
739
747
  /**
740
748
  * Initialize the base command
741
749
  */
742
- const cmd = command.isHidden ? commander.program : commander.program.command(command.baseCommand).description(command.description ?? "").action(async () => {
743
- instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, commander.program);
750
+ const cmd = command.isHidden ? this.program : this.program.command(command.baseCommand).description(command.description ?? "").action(async () => {
751
+ instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, this.program);
744
752
  await this.handle(instance);
745
753
  });
746
754
  /**
@@ -753,8 +761,8 @@ var Musket = class Musket {
753
761
  * Initialize the sub commands
754
762
  */
755
763
  command.subCommands.filter((v, i$1, a) => !v.shared && a.findIndex((t) => t.name === v.name) === i$1).forEach((sub) => {
756
- const cmd$1 = commander.program.command(`${command.baseCommand}:${sub.name}`).description(sub.description || "").action(async () => {
757
- instance.setInput(cmd$1.opts(), cmd$1.args, cmd$1.registeredArguments, sub, commander.program);
764
+ const cmd$1 = this.program.command(`${command.baseCommand}:${sub.name}`).description(sub.description || "").action(async () => {
765
+ instance.setInput(cmd$1.opts(), cmd$1.args, cmd$1.registeredArguments, sub, this.program);
758
766
  await this.handle(instance);
759
767
  });
760
768
  /**
@@ -780,12 +788,12 @@ var Musket = class Musket {
780
788
  /**
781
789
  * Initialize command with options
782
790
  */
783
- const cmd = commander.program.command(command.baseCommand).description(command.description ?? "");
791
+ const cmd = this.program.command(command.baseCommand).description(command.description ?? "");
784
792
  command?.options?.filter((v, i$1, a) => a.findIndex((t) => t.name === v.name) === i$1).forEach((opt) => {
785
793
  this.makeOption(opt, cmd, true);
786
794
  });
787
795
  cmd.action(async () => {
788
- instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, commander.program);
796
+ instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, this.program);
789
797
  await this.handle(instance);
790
798
  });
791
799
  }
@@ -793,10 +801,10 @@ var Musket = class Musket {
793
801
  /**
794
802
  * Rebuild the app on every command except fire so we wont need TS
795
803
  */
796
- commander.program.hook("preAction", async (_, cmd) => {
804
+ this.program.hook("preAction", async (_, cmd) => {
797
805
  this.rebuild(cmd.name());
798
806
  });
799
- return commander.program;
807
+ return this.program;
800
808
  }
801
809
  async rebuild(name) {
802
810
  if (name !== "fire" && name !== "build" && this.config.allowRebuilds) await (0, tsdown.build)({
@@ -837,11 +845,17 @@ var Musket = class Musket {
837
845
  if (this.resolver) return await this.resolver(cmd, "handle");
838
846
  await cmd.handle(this.app);
839
847
  }
840
- static async parse(kernel, config = {}) {
841
- const commands = config.baseCommands?.map((e) => new e(kernel.app, kernel));
848
+ static async parse(kernel, config = {}, extraCommands = [], returnExit = false) {
849
+ let exitCode = 0;
850
+ if (typeof extraCommands === "boolean") {
851
+ returnExit = extraCommands;
852
+ extraCommands = [];
853
+ }
854
+ const commands = config.baseCommands?.concat(extraCommands)?.map((e) => new e(kernel.app, kernel));
842
855
  const cli = new Musket(kernel.app, kernel, commands, config.resolver, config.tsDownConfig).configure(config);
843
856
  if (config.cliName) cli.cliName = config.cliName;
844
857
  const command = (await cli.build()).exitOverride((e) => {
858
+ exitCode = e.exitCode;
845
859
  if (e.exitCode <= 0) return;
846
860
  __h3ravel_shared.Logger.log("Unknown command or argument.", "white");
847
861
  __h3ravel_shared.Logger.log([
@@ -850,8 +864,9 @@ var Musket = class Musket {
850
864
  ["to see available commands.", "white"]
851
865
  ], " ");
852
866
  });
853
- if (!config.skipParsing) await command.parseAsync(process.argv).catch((e) => e);
867
+ if (!config.skipParsing) await command.parseAsync(process.argv).catch((e) => void 0);
854
868
  if (cli.app) cli.app.musket = cli;
869
+ if (returnExit === true) return exitCode;
855
870
  return command;
856
871
  }
857
872
  };
@@ -870,6 +885,10 @@ var Kernel = class Kernel {
870
885
  */
871
886
  basePath = "";
872
887
  /**
888
+ * A list of pre-registered CLI commands
889
+ */
890
+ commands = /* @__PURE__ */ new Set([]);
891
+ /**
873
892
  * Packages that should show up up when the -V flag is passed
874
893
  */
875
894
  packages = [];
@@ -896,8 +915,8 @@ var Kernel = class Kernel {
896
915
  /**
897
916
  * Run the CLI IO
898
917
  */
899
- async run() {
900
- return await Musket.parse(this, this.config);
918
+ async run(returnExit) {
919
+ return await Musket.parse(this, this.config, this.getRegisteredCommands(), returnExit);
901
920
  }
902
921
  /**
903
922
  * Set the configuration for the CLI
@@ -939,6 +958,21 @@ var Kernel = class Kernel {
939
958
  return this.packages;
940
959
  }
941
960
  /**
961
+ * Push a list of new commands to commands stack
962
+ *
963
+ * @param command
964
+ */
965
+ registerCommands(commands) {
966
+ commands.forEach((e) => this.commands.add(e));
967
+ return this;
968
+ }
969
+ /**
970
+ * Get all the pre-registered commands
971
+ */
972
+ getRegisteredCommands() {
973
+ return Array.from(this.commands);
974
+ }
975
+ /**
942
976
  * Bootstrap the CLI
943
977
  */
944
978
  bootstrap() {
package/dist/index.d.ts CHANGED
@@ -131,6 +131,10 @@ declare class Kernel<A extends Application = Application> {
131
131
  * The base path for the CLI app
132
132
  */
133
133
  basePath: string;
134
+ /**
135
+ * A list of pre-registered CLI commands
136
+ */
137
+ private commands;
134
138
  /**
135
139
  * Packages that should show up up when the -V flag is passed
136
140
  */
@@ -152,7 +156,7 @@ declare class Kernel<A extends Application = Application> {
152
156
  /**
153
157
  * Run the CLI IO
154
158
  */
155
- run(): Promise<commander0.Command>;
159
+ run<E extends boolean = false>(returnExit?: E): Promise<E extends true ? number : commander0.Command>;
156
160
  /**
157
161
  * Set the configuration for the CLI
158
162
  */
@@ -177,6 +181,16 @@ declare class Kernel<A extends Application = Application> {
177
181
  * Get the packages that should show up up when the -V flag is passed
178
182
  */
179
183
  getPackages(): NonNullable<InitConfig['packages']>;
184
+ /**
185
+ * Push a list of new commands to commands stack
186
+ *
187
+ * @param command
188
+ */
189
+ registerCommands(commands: typeof Command[]): this;
190
+ /**
191
+ * Get all the pre-registered commands
192
+ */
193
+ getRegisteredCommands(): typeof Command[];
180
194
  /**
181
195
  * Bootstrap the CLI
182
196
  */
@@ -383,6 +397,7 @@ declare class Musket {
383
397
  cliName: string;
384
398
  private config;
385
399
  private commands;
400
+ private program;
386
401
  constructor(app: Application, kernel: Kernel, baseCommands?: Command[], resolver?: NonNullable<InitConfig["resolver"]> | undefined, tsDownConfig?: UserConfig);
387
402
  build(): Promise<Command$1>;
388
403
  private loadBaseCommands;
@@ -416,12 +431,17 @@ declare class Musket {
416
431
  *
417
432
  * @param command
418
433
  */
419
- resolveCommands(commands: Command[]): this;
434
+ registerCommands(commands: Command[]): this;
435
+ /**
436
+ * Get all the registered commands
437
+ */
438
+ getRegisteredCommands(): ParsedCommand[];
420
439
  private initialize;
421
440
  rebuild(name: string): Promise<void>;
422
441
  private makeOption;
423
442
  private handle;
424
- static parse(kernel: Kernel, config?: InitConfig): Promise<Command$1>;
443
+ static parse<E extends boolean = false>(kernel: Kernel, config: InitConfig, returnExit?: E): Promise<E extends true ? number : Command$1>;
444
+ static parse<E extends boolean = false>(kernel: Kernel, config: InitConfig, commands: typeof Command[], returnExit?: E): Promise<E extends true ? number : Command$1>;
425
445
  }
426
446
  //#endregion
427
447
  //#region src/Contracts/Application.d.ts
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { FileSystem, Logger, Prompts } from "@h3ravel/shared";
3
- import { Argument, Option, program } from "commander";
3
+ import { Argument, Command as Command$1, Option } from "commander";
4
+ import { Arr, Str } from "@h3ravel/support";
4
5
  import { build } from "tsdown";
5
6
  import { glob } from "glob";
6
7
  import path from "node:path";
7
- import { Arr, Str } from "@h3ravel/support";
8
8
  import { mkdir } from "node:fs/promises";
9
9
 
10
10
  //#region src/Core/Command.ts
@@ -53,8 +53,8 @@ var Command = class {
53
53
  setApplication(app) {
54
54
  this.app = app;
55
55
  }
56
- setInput(options, args, regArgs, dictionary, program$1) {
57
- this.program = program$1;
56
+ setInput(options, args, regArgs, dictionary, program) {
57
+ this.program = program;
58
58
  this.dictionary = dictionary;
59
59
  this.input.options = options;
60
60
  this.input.arguments = regArgs.map((e, i) => ({ [e.name()]: args[i] })).reduce((e, x) => Object.assign(e, x), {});
@@ -70,8 +70,8 @@ var Command = class {
70
70
  this.program.setOptionValue(key, value);
71
71
  return this;
72
72
  }
73
- setProgram(program$1) {
74
- this.program = program$1;
73
+ setProgram(program) {
74
+ this.program = program;
75
75
  return this;
76
76
  }
77
77
  getSignature() {
@@ -231,6 +231,147 @@ var Command = class {
231
231
  }
232
232
  };
233
233
 
234
+ //#endregion
235
+ //#region src/Commands/HelpCommand.ts
236
+ var HelpCommand = class extends Command {
237
+ /**
238
+ * The name and signature of the console command.
239
+ *
240
+ * @var string
241
+ */
242
+ signature = `help
243
+ {command_name=help : The command name}
244
+ {--format=txt : The output format}
245
+ `;
246
+ /**
247
+ * The console command description.
248
+ *
249
+ * @var string
250
+ */
251
+ description = "Display help for a command";
252
+ async handle() {
253
+ const cmd = this.argument("command_name");
254
+ if (!cmd) {
255
+ this.program.outputHelp();
256
+ return;
257
+ }
258
+ const target = this.program.commands.find((c) => c.name() === cmd);
259
+ if (!target) {
260
+ this.error(`ERROR: Unknown command: ${Logger.log(cmd, ["italic", "grey"], false)}.`);
261
+ process.exit(1);
262
+ }
263
+ target.outputHelp();
264
+ }
265
+ };
266
+
267
+ //#endregion
268
+ //#region src/logo.ts
269
+ const logo = String.raw`
270
+ 111
271
+ 111111111
272
+ 1111111111 111111
273
+ 111111 111 111111
274
+ 111111 111 111111
275
+ 11111 111 11111
276
+ 1111111 111 1111111
277
+ 111 11111 111 111111 111 1111 1111 11111111 1111
278
+ 111 11111 1111 111111 111 1111 1111 1111 11111 1111
279
+ 111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
280
+ 111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
281
+ 111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
282
+ 111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
283
+ 111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
284
+ 1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
285
+ 11011 111111 11 11111
286
+ 111111 11101 111111
287
+ 111111 111 111111
288
+ 111111 111 111111
289
+ 111111111
290
+ 110
291
+ `;
292
+ const altLogo = String.raw`
293
+ _ _ _____ _
294
+ | | | |___ / _ __ __ ___ _____| |
295
+ | |_| | |_ \| '__/ _ \ \ / / _ \ |
296
+ | _ |___) | | | (_| |\ V / __/ |
297
+ |_| |_|____/|_| \__,_| \_/ \___|_|
298
+
299
+ `;
300
+
301
+ //#endregion
302
+ //#region src/Commands/ListCommand.ts
303
+ var ListCommand = class ListCommand extends Command {
304
+ /**
305
+ * The name and signature of the console command.
306
+ *
307
+ * @var string
308
+ */
309
+ signature = "list";
310
+ /**
311
+ * The console command description.
312
+ *
313
+ * @var string
314
+ */
315
+ description = "List all available commands";
316
+ async handle() {
317
+ const options = [{
318
+ short: "-h",
319
+ long: "--help",
320
+ description: "Display help for the given command. When no command is given display help for the list command"
321
+ }].concat(this.program.options).map((e) => {
322
+ return Logger.describe(Logger.log(" " + [e.short, e.long].filter((e$1) => !!e$1).join(", "), "green", false), e.description, 25, false).join("");
323
+ });
324
+ /** Get the program commands */
325
+ const commands = this.program.commands.map((e) => {
326
+ return Logger.describe(Logger.log(" " + e.name(), "green", false), e.description(), 25, false).join("");
327
+ });
328
+ const list = ListCommand.groupItems(commands);
329
+ /** Output the modules version */
330
+ const version = this.kernel.modules.map((e) => {
331
+ return Logger.log([[`${Str.of(e.alias ?? e.name).afterLast("/").ucfirst().replace(["-", "_"], " ").replace("cli", "CLI", false)}:`, "white"], [e.version, "green"]], " ", false);
332
+ }).join(" | ");
333
+ this.newLine();
334
+ console.log(version);
335
+ this.newLine();
336
+ console.log(this.kernel.config.logo ?? altLogo);
337
+ this.newLine();
338
+ Logger.log("Usage:", "yellow");
339
+ Logger.log(" command [options] [arguments]", "white");
340
+ this.newLine();
341
+ /** Output the options */
342
+ Logger.log("Options:", "yellow");
343
+ console.log(options.join("\n").trim());
344
+ this.newLine();
345
+ /** Ootput the commands */
346
+ Logger.log("Available Commands:", "yellow");
347
+ console.log(list.join("\n\n").trim());
348
+ this.newLine();
349
+ }
350
+ /**
351
+ * Group Commands based on thier names
352
+ *
353
+ * @param commands
354
+ * @returns
355
+ */
356
+ static groupItems(commands, fmtd = false) {
357
+ const grouped = commands.reduce((acc, cmd) => {
358
+ /** strip colors before checking prefix */
359
+ const clean = cmd.replace(/\x1b\[\d+m/g, "");
360
+ const prefix = clean.includes(":") ? clean.split(":")[0].trim() : "__root__";
361
+ acc[prefix] ??= [];
362
+ /** keep original with colors */
363
+ acc[prefix].push(cmd);
364
+ return acc;
365
+ }, {});
366
+ return Object.entries(grouped).map(([group, cmds]) => {
367
+ const label = group === "__root__" ? "" : group;
368
+ let out = [Logger.log(label, "yellow", false), cmds.join("\n")].join("\n");
369
+ if (fmtd) out += "\n";
370
+ return out;
371
+ });
372
+ }
373
+ };
374
+
234
375
  //#endregion
235
376
  //#region src/Signature.ts
236
377
  var Signature = class Signature {
@@ -417,147 +558,6 @@ var Signature = class Signature {
417
558
  }
418
559
  };
419
560
 
420
- //#endregion
421
- //#region src/logo.ts
422
- const logo = String.raw`
423
- 111
424
- 111111111
425
- 1111111111 111111
426
- 111111 111 111111
427
- 111111 111 111111
428
- 11111 111 11111
429
- 1111111 111 1111111
430
- 111 11111 111 111111 111 1111 1111 11111111 1111
431
- 111 11111 1111 111111 111 1111 1111 1111 11111 1111
432
- 111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
433
- 111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
434
- 111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
435
- 111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
436
- 111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
437
- 1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
438
- 11011 111111 11 11111
439
- 111111 11101 111111
440
- 111111 111 111111
441
- 111111 111 111111
442
- 111111111
443
- 110
444
- `;
445
- const altLogo = String.raw`
446
- _ _ _____ _
447
- | | | |___ / _ __ __ ___ _____| |
448
- | |_| | |_ \| '__/ _ \ \ / / _ \ |
449
- | _ |___) | | | (_| |\ V / __/ |
450
- |_| |_|____/|_| \__,_| \_/ \___|_|
451
-
452
- `;
453
-
454
- //#endregion
455
- //#region src/Commands/HelpCommand.ts
456
- var HelpCommand = class extends Command {
457
- /**
458
- * The name and signature of the console command.
459
- *
460
- * @var string
461
- */
462
- signature = `help
463
- {command_name=help : The command name}
464
- {--format=txt : The output format}
465
- `;
466
- /**
467
- * The console command description.
468
- *
469
- * @var string
470
- */
471
- description = "Display help for a command";
472
- async handle() {
473
- const cmd = this.argument("command_name");
474
- if (!cmd) {
475
- this.program.outputHelp();
476
- return;
477
- }
478
- const target = this.program.commands.find((c) => c.name() === cmd);
479
- if (!target) {
480
- this.error(`ERROR: Unknown command: ${Logger.log(cmd, ["italic", "grey"], false)}.`);
481
- process.exit(1);
482
- }
483
- target.outputHelp();
484
- }
485
- };
486
-
487
- //#endregion
488
- //#region src/Commands/ListCommand.ts
489
- var ListCommand = class ListCommand extends Command {
490
- /**
491
- * The name and signature of the console command.
492
- *
493
- * @var string
494
- */
495
- signature = "list";
496
- /**
497
- * The console command description.
498
- *
499
- * @var string
500
- */
501
- description = "List all available commands";
502
- async handle() {
503
- const options = [{
504
- short: "-h",
505
- long: "--help",
506
- description: "Display help for the given command. When no command is given display help for the list command"
507
- }].concat(this.program.options).map((e) => {
508
- return Logger.describe(Logger.log(" " + [e.short, e.long].filter((e$1) => !!e$1).join(", "), "green", false), e.description, 25, false).join("");
509
- });
510
- /** Get the program commands */
511
- const commands = this.program.commands.map((e) => {
512
- return Logger.describe(Logger.log(" " + e.name(), "green", false), e.description(), 25, false).join("");
513
- });
514
- const list = ListCommand.groupItems(commands);
515
- /** Output the modules version */
516
- const version = this.kernel.modules.map((e) => {
517
- return Logger.log([[`${Str.of(e.alias ?? e.name).afterLast("/").ucfirst().replace(["-", "_"], " ").replace("cli", "CLI", false)}:`, "white"], [e.version, "green"]], " ", false);
518
- }).join(" | ");
519
- this.newLine();
520
- console.log(version);
521
- this.newLine();
522
- console.log(this.kernel.config.logo ?? altLogo);
523
- this.newLine();
524
- Logger.log("Usage:", "yellow");
525
- Logger.log(" command [options] [arguments]", "white");
526
- this.newLine();
527
- /** Output the options */
528
- Logger.log("Options:", "yellow");
529
- console.log(options.join("\n").trim());
530
- this.newLine();
531
- /** Ootput the commands */
532
- Logger.log("Available Commands:", "yellow");
533
- console.log(list.join("\n\n").trim());
534
- this.newLine();
535
- }
536
- /**
537
- * Group Commands based on thier names
538
- *
539
- * @param commands
540
- * @returns
541
- */
542
- static groupItems(commands, fmtd = false) {
543
- const grouped = commands.reduce((acc, cmd) => {
544
- /** strip colors before checking prefix */
545
- const clean = cmd.replace(/\x1b\[\d+m/g, "");
546
- const prefix = clean.includes(":") ? clean.split(":")[0].trim() : "__root__";
547
- acc[prefix] ??= [];
548
- /** keep original with colors */
549
- acc[prefix].push(cmd);
550
- return acc;
551
- }, {});
552
- return Object.entries(grouped).map(([group, cmds]) => {
553
- const label = group === "__root__" ? "" : group;
554
- let out = [Logger.log(label, "yellow", false), cmds.join("\n")].join("\n");
555
- if (fmtd) out += "\n";
556
- return out;
557
- });
558
- }
559
- };
560
-
561
561
  //#endregion
562
562
  //#region src/Musket.ts
563
563
  var Musket = class Musket {
@@ -569,12 +569,14 @@ var Musket = class Musket {
569
569
  cliName = "musket";
570
570
  config = {};
571
571
  commands = [];
572
+ program;
572
573
  constructor(app, kernel, baseCommands = [], resolver, tsDownConfig = {}) {
573
574
  this.app = app;
574
575
  this.kernel = kernel;
575
576
  this.baseCommands = baseCommands;
576
577
  this.resolver = resolver;
577
578
  this.tsDownConfig = tsDownConfig;
579
+ this.program = new Command$1();
578
580
  }
579
581
  async build() {
580
582
  await this.loadBaseCommands().loadDiscoveredCommands();
@@ -637,10 +639,16 @@ var Musket = class Musket {
637
639
  *
638
640
  * @param command
639
641
  */
640
- resolveCommands(commands) {
642
+ registerCommands(commands) {
641
643
  commands.forEach((e) => this.addCommand(e));
642
644
  return this;
643
645
  }
646
+ /**
647
+ * Get all the registered commands
648
+ */
649
+ getRegisteredCommands() {
650
+ return this.commands;
651
+ }
644
652
  async initialize() {
645
653
  if (process.argv.includes("--help") || process.argv.includes("-h")) await this.rebuild("help");
646
654
  /**
@@ -659,7 +667,7 @@ var Musket = class Musket {
659
667
  /**
660
668
  * Run the base Command if a root command was not defined
661
669
  */
662
- program.name(this.cliName).version(moduleVersions).description(this.config.logo ?? altLogo).configureHelp({ showGlobalOptions: true }).addOption(new Option(additional.quiet[0], additional.quiet[1])).addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true })).addOption(new Option(additional.verbose[0], additional.verbose[1]).choices([
670
+ this.program.name(this.cliName).version(moduleVersions).description(this.config.logo ?? altLogo).configureHelp({ showGlobalOptions: true }).addOption(new Option(additional.quiet[0], additional.quiet[1])).addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true })).addOption(new Option(additional.verbose[0], additional.verbose[1]).choices([
663
671
  "1",
664
672
  "2",
665
673
  "3",
@@ -667,7 +675,7 @@ var Musket = class Musket {
667
675
  "vv"
668
676
  ]).default("1")).addOption(new Option(additional.noInteraction[0], additional.noInteraction[1])).action(async () => {
669
677
  const instance = new ListCommand(this.app, this.kernel);
670
- instance.setInput(program.opts(), program.args, program.registeredArguments, {}, program);
678
+ instance.setInput(this.program.opts(), this.program.args, this.program.registeredArguments, {}, this.program);
671
679
  await this.handle(instance);
672
680
  });
673
681
  else {
@@ -676,8 +684,8 @@ var Musket = class Musket {
676
684
  */
677
685
  const root = new this.config.rootCommand(this.app, this.kernel);
678
686
  const sign = Signature.parseSignature(root.getSignature(), root);
679
- const cmd = program.name(sign.baseCommand).description(sign.description ?? sign.baseCommand).configureHelp({ showGlobalOptions: true }).action(async () => {
680
- root.setInput(program.opts(), program.args, program.registeredArguments, {}, program);
687
+ const cmd = this.program.name(sign.baseCommand).description(sign.description ?? sign.baseCommand).configureHelp({ showGlobalOptions: true }).action(async () => {
688
+ root.setInput(this.program.opts(), this.program.args, this.program.registeredArguments, {}, this.program);
681
689
  await this.handle(root);
682
690
  });
683
691
  if ((sign.options?.length ?? 0) > 0) sign.options?.filter((v, i, a) => a.findIndex((t) => t.name === v.name) === i).forEach((opt) => {
@@ -687,7 +695,7 @@ var Musket = class Musket {
687
695
  /**
688
696
  * Format the help command display
689
697
  */
690
- program.configureHelp({
698
+ this.program.configureHelp({
691
699
  styleTitle: (str) => Logger.log(str, "yellow", false),
692
700
  styleOptionTerm: (str) => Logger.log(str, "green", false),
693
701
  styleArgumentTerm: (str) => Logger.log(str, "green", false),
@@ -715,8 +723,8 @@ var Musket = class Musket {
715
723
  /**
716
724
  * Initialize the base command
717
725
  */
718
- const cmd = command.isHidden ? program : program.command(command.baseCommand).description(command.description ?? "").action(async () => {
719
- instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, program);
726
+ const cmd = command.isHidden ? this.program : this.program.command(command.baseCommand).description(command.description ?? "").action(async () => {
727
+ instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, this.program);
720
728
  await this.handle(instance);
721
729
  });
722
730
  /**
@@ -729,8 +737,8 @@ var Musket = class Musket {
729
737
  * Initialize the sub commands
730
738
  */
731
739
  command.subCommands.filter((v, i$1, a) => !v.shared && a.findIndex((t) => t.name === v.name) === i$1).forEach((sub) => {
732
- const cmd$1 = program.command(`${command.baseCommand}:${sub.name}`).description(sub.description || "").action(async () => {
733
- instance.setInput(cmd$1.opts(), cmd$1.args, cmd$1.registeredArguments, sub, program);
740
+ const cmd$1 = this.program.command(`${command.baseCommand}:${sub.name}`).description(sub.description || "").action(async () => {
741
+ instance.setInput(cmd$1.opts(), cmd$1.args, cmd$1.registeredArguments, sub, this.program);
734
742
  await this.handle(instance);
735
743
  });
736
744
  /**
@@ -756,12 +764,12 @@ var Musket = class Musket {
756
764
  /**
757
765
  * Initialize command with options
758
766
  */
759
- const cmd = program.command(command.baseCommand).description(command.description ?? "");
767
+ const cmd = this.program.command(command.baseCommand).description(command.description ?? "");
760
768
  command?.options?.filter((v, i$1, a) => a.findIndex((t) => t.name === v.name) === i$1).forEach((opt) => {
761
769
  this.makeOption(opt, cmd, true);
762
770
  });
763
771
  cmd.action(async () => {
764
- instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, program);
772
+ instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, this.program);
765
773
  await this.handle(instance);
766
774
  });
767
775
  }
@@ -769,10 +777,10 @@ var Musket = class Musket {
769
777
  /**
770
778
  * Rebuild the app on every command except fire so we wont need TS
771
779
  */
772
- program.hook("preAction", async (_, cmd) => {
780
+ this.program.hook("preAction", async (_, cmd) => {
773
781
  this.rebuild(cmd.name());
774
782
  });
775
- return program;
783
+ return this.program;
776
784
  }
777
785
  async rebuild(name) {
778
786
  if (name !== "fire" && name !== "build" && this.config.allowRebuilds) await build({
@@ -813,11 +821,17 @@ var Musket = class Musket {
813
821
  if (this.resolver) return await this.resolver(cmd, "handle");
814
822
  await cmd.handle(this.app);
815
823
  }
816
- static async parse(kernel, config = {}) {
817
- const commands = config.baseCommands?.map((e) => new e(kernel.app, kernel));
824
+ static async parse(kernel, config = {}, extraCommands = [], returnExit = false) {
825
+ let exitCode = 0;
826
+ if (typeof extraCommands === "boolean") {
827
+ returnExit = extraCommands;
828
+ extraCommands = [];
829
+ }
830
+ const commands = config.baseCommands?.concat(extraCommands)?.map((e) => new e(kernel.app, kernel));
818
831
  const cli = new Musket(kernel.app, kernel, commands, config.resolver, config.tsDownConfig).configure(config);
819
832
  if (config.cliName) cli.cliName = config.cliName;
820
833
  const command = (await cli.build()).exitOverride((e) => {
834
+ exitCode = e.exitCode;
821
835
  if (e.exitCode <= 0) return;
822
836
  Logger.log("Unknown command or argument.", "white");
823
837
  Logger.log([
@@ -826,8 +840,9 @@ var Musket = class Musket {
826
840
  ["to see available commands.", "white"]
827
841
  ], " ");
828
842
  });
829
- if (!config.skipParsing) await command.parseAsync(process.argv).catch((e) => e);
843
+ if (!config.skipParsing) await command.parseAsync(process.argv).catch((e) => void 0);
830
844
  if (cli.app) cli.app.musket = cli;
845
+ if (returnExit === true) return exitCode;
831
846
  return command;
832
847
  }
833
848
  };
@@ -846,6 +861,10 @@ var Kernel = class Kernel {
846
861
  */
847
862
  basePath = "";
848
863
  /**
864
+ * A list of pre-registered CLI commands
865
+ */
866
+ commands = /* @__PURE__ */ new Set([]);
867
+ /**
849
868
  * Packages that should show up up when the -V flag is passed
850
869
  */
851
870
  packages = [];
@@ -872,8 +891,8 @@ var Kernel = class Kernel {
872
891
  /**
873
892
  * Run the CLI IO
874
893
  */
875
- async run() {
876
- return await Musket.parse(this, this.config);
894
+ async run(returnExit) {
895
+ return await Musket.parse(this, this.config, this.getRegisteredCommands(), returnExit);
877
896
  }
878
897
  /**
879
898
  * Set the configuration for the CLI
@@ -915,6 +934,21 @@ var Kernel = class Kernel {
915
934
  return this.packages;
916
935
  }
917
936
  /**
937
+ * Push a list of new commands to commands stack
938
+ *
939
+ * @param command
940
+ */
941
+ registerCommands(commands) {
942
+ commands.forEach((e) => this.commands.add(e));
943
+ return this;
944
+ }
945
+ /**
946
+ * Get all the pre-registered commands
947
+ */
948
+ getRegisteredCommands() {
949
+ return Array.from(this.commands);
950
+ }
951
+ /**
918
952
  * Bootstrap the CLI
919
953
  */
920
954
  bootstrap() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h3ravel/musket",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
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",