@alcyone-labs/arg-parser 3.0.0 → 3.0.1

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
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -19,17 +20,31 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
19
20
  value: mod,
20
21
  enumerable: true
21
22
  }) : target, mod));
22
- let __alcyone_labs_simple_chalk = require("@alcyone-labs/simple-chalk");
23
- __alcyone_labs_simple_chalk = __toESM(__alcyone_labs_simple_chalk);
23
+ //#endregion
24
+ let _alcyone_labs_simple_chalk = require("@alcyone-labs/simple-chalk");
25
+ _alcyone_labs_simple_chalk = __toESM(_alcyone_labs_simple_chalk);
24
26
  let zod = require("zod");
25
27
  let node_path = require("node:path");
26
28
  node_path = __toESM(node_path);
27
- const FlagInheritance = {
29
+ //#region src/core/types.ts
30
+ /**
31
+ * Core types for ArgParser
32
+ *
33
+ * These types define the shape of flags, commands, and configuration
34
+ * for the argument parser.
35
+ */
36
+ /**
37
+ * Defines the behavior for flag inheritance in sub-commands.
38
+ */
39
+ var FlagInheritance = {
28
40
  NONE: "none",
29
41
  DirectParentOnly: "direct-parent-only",
30
42
  AllParents: "all-parents"
31
43
  };
32
- const zodDxtOptionsSchema = zod.z.object({
44
+ /**
45
+ * Zod schema for validating DXT-specific options
46
+ */
47
+ var zodDxtOptionsSchema = zod.z.object({
33
48
  sensitive: zod.z.boolean().optional(),
34
49
  localDefault: zod.z.string().optional(),
35
50
  type: zod.z.enum([
@@ -51,7 +66,7 @@ const zodDxtOptionsSchema = zod.z.object({
51
66
  message: "min cannot be greater than max",
52
67
  path: ["min"]
53
68
  });
54
- const zodFlagSchema = zod.z.object({
69
+ var zodFlagSchema = zod.z.object({
55
70
  name: zod.z.string().min(1),
56
71
  allowLigature: zod.z.boolean().default(true),
57
72
  allowMultiple: zod.z.boolean().default(false),
@@ -101,7 +116,7 @@ function getJsonSchemaTypeFromFlag(flagType) {
101
116
  }
102
117
  return "string";
103
118
  }
104
- const OutputSchemaPatterns = {
119
+ var OutputSchemaPatterns = {
105
120
  successError: () => zod.z.object({
106
121
  success: zod.z.boolean(),
107
122
  message: zod.z.string().optional(),
@@ -139,6 +154,17 @@ function createOutputSchema(pattern) {
139
154
  if (pattern && typeof pattern === "object") return zod.z.object(pattern);
140
155
  return OutputSchemaPatterns.successError();
141
156
  }
157
+ //#endregion
158
+ //#region src/core/FlagManager.ts
159
+ /**
160
+ * FlagManager - Manages flag definitions and collision detection
161
+ *
162
+ * This class handles the registration, storage, and retrieval of CLI flags.
163
+ * It provides collision detection to prevent duplicate flag definitions.
164
+ */
165
+ /**
166
+ * Manages flag definitions for an ArgParser instance
167
+ */
142
168
  var FlagManager = class {
143
169
  constructor(options = {}, initialFlags = []) {
144
170
  this.flags = /* @__PURE__ */ new Map();
@@ -149,6 +175,9 @@ var FlagManager = class {
149
175
  };
150
176
  for (const flag of initialFlags) this.addFlag(flag);
151
177
  }
178
+ /**
179
+ * Add a single flag
180
+ */
152
181
  addFlag(flag) {
153
182
  const processedFlag = this.processFlag(flag);
154
183
  if (this.flags.has(processedFlag.name)) {
@@ -165,46 +194,79 @@ var FlagManager = class {
165
194
  }
166
195
  this.flags.set(processedFlag.name, processedFlag);
167
196
  }
197
+ /**
198
+ * Add multiple flags
199
+ */
168
200
  addFlags(flags) {
169
201
  for (const flag of flags) this.addFlag(flag);
170
202
  }
203
+ /**
204
+ * Remove a flag by name
205
+ */
171
206
  removeFlag(name) {
172
207
  const flag = this.flags.get(name);
173
208
  if (!flag) return false;
174
209
  for (const option of flag.options) this.optionToFlagMap.delete(option);
175
210
  return this.flags.delete(name);
176
211
  }
212
+ /**
213
+ * Check if a flag exists
214
+ */
177
215
  hasFlag(name) {
178
216
  return this.flags.has(name);
179
217
  }
218
+ /**
219
+ * Get a flag by name
220
+ */
180
221
  getFlag(name) {
181
222
  return this.flags.get(name);
182
223
  }
224
+ /**
225
+ * Get all flags as an array
226
+ */
183
227
  getAllFlags() {
184
228
  return Array.from(this.flags.values());
185
229
  }
230
+ /**
231
+ * Get all flag names
232
+ */
186
233
  getFlagNames() {
187
234
  return Array.from(this.flags.keys());
188
235
  }
236
+ /**
237
+ * Find flag by option
238
+ */
189
239
  findFlagByOption(option) {
190
240
  const flagName = this.optionToFlagMap.get(option);
191
241
  if (!flagName) return void 0;
192
242
  return this.flags.get(flagName);
193
243
  }
244
+ /**
245
+ * Process a raw flag into a ProcessedFlag
246
+ */
194
247
  processFlag(flag) {
195
248
  const rawFlag = { ...flag };
196
249
  if ("default" in rawFlag && rawFlag.default !== void 0 && !("defaultValue" in rawFlag)) rawFlag.defaultValue = rawFlag.default;
197
250
  if ("required" in rawFlag && rawFlag.required !== void 0 && !("mandatory" in rawFlag)) rawFlag.mandatory = rawFlag.required;
198
251
  return zodFlagSchema.parse(rawFlag);
199
252
  }
253
+ /**
254
+ * Internal method to set a processed flag directly (for inheritance)
255
+ */
200
256
  _setProcessedFlagForInheritance(flag) {
201
257
  this.flags.set(flag.name, flag);
202
258
  for (const option of flag.options) this.optionToFlagMap.set(option, flag.name);
203
259
  }
260
+ /**
261
+ * Clear all flags
262
+ */
204
263
  clear() {
205
264
  this.flags.clear();
206
265
  this.optionToFlagMap.clear();
207
266
  }
267
+ /**
268
+ * Get collision report
269
+ */
208
270
  getCollisions() {
209
271
  const collisions = [];
210
272
  const seen = /* @__PURE__ */ new Map();
@@ -220,6 +282,11 @@ var FlagManager = class {
220
282
  return collisions;
221
283
  }
222
284
  };
285
+ //#endregion
286
+ //#region src/core/PromptManager.ts
287
+ /**
288
+ * Manages interactive prompts for an ArgParser instance
289
+ */
223
290
  var PromptManager = class {
224
291
  constructor(options = {}) {
225
292
  this.promptableFlags = /* @__PURE__ */ new Map();
@@ -231,20 +298,38 @@ var PromptManager = class {
231
298
  get sequenceOffset() {
232
299
  return this._options.sequenceOffset ?? 0;
233
300
  }
301
+ /**
302
+ * Register a promptable flag
303
+ */
234
304
  registerPromptableFlag(flag) {
235
305
  this.promptableFlags.set(flag.name, flag);
236
306
  }
307
+ /**
308
+ * Unregister a promptable flag
309
+ */
237
310
  unregisterPromptableFlag(name) {
238
311
  return this.promptableFlags.delete(name);
239
312
  }
313
+ /**
314
+ * Check if a flag has a prompt
315
+ */
240
316
  hasPrompt(name) {
241
317
  return this.promptableFlags.has(name);
242
318
  }
319
+ /**
320
+ * Get all promptable flags sorted by sequence
321
+ */
243
322
  getPromptableFlags() {
244
323
  return Array.from(this.promptableFlags.values()).sort((a, b) => {
245
324
  return (a.promptSequence ?? Infinity) - (b.promptSequence ?? Infinity);
246
325
  });
247
326
  }
327
+ /**
328
+ * Execute prompts for missing flags
329
+ *
330
+ * This is a placeholder implementation. The actual implementation
331
+ * would integrate with @clack/prompts.
332
+ */
248
333
  async executePrompts(context, missingFlagNames) {
249
334
  const answers = {};
250
335
  const results = [];
@@ -273,10 +358,24 @@ var PromptManager = class {
273
358
  cancelled: false
274
359
  };
275
360
  }
361
+ /**
362
+ * Clear all registered flags
363
+ */
276
364
  clear() {
277
365
  this.promptableFlags.clear();
278
366
  }
279
367
  };
368
+ //#endregion
369
+ //#region src/core/ArgParser.ts
370
+ /**
371
+ * Core ArgParser implementation
372
+ *
373
+ * This is the main ArgParser class with full CLI parsing capabilities.
374
+ * It has NO dependencies on MCP, DXT, or TUI - those are provided by plugins.
375
+ */
376
+ /**
377
+ * Error thrown by ArgParser
378
+ */
280
379
  var ArgParserError = class extends Error {
281
380
  constructor(message, cmdChain = []) {
282
381
  super(message);
@@ -285,6 +384,16 @@ var ArgParserError = class extends Error {
285
384
  this.commandChain = cmdChain;
286
385
  }
287
386
  };
387
+ /**
388
+ * Core ArgParser class
389
+ *
390
+ * Provides complete CLI argument parsing with support for:
391
+ * - Flags (with types, validation, defaults)
392
+ * - Subcommands
393
+ * - Interactive prompts
394
+ * - Help generation
395
+ * - Plugin system
396
+ */
288
397
  var ArgParser = class {
289
398
  #appName = "Argument Parser";
290
399
  #appCommandName;
@@ -326,42 +435,75 @@ var ArgParser = class {
326
435
  });
327
436
  if (params.subCommands) for (const sub of params.subCommands) this.addSubCommand(sub);
328
437
  }
438
+ /**
439
+ * Install a plugin
440
+ */
329
441
  use(plugin) {
330
442
  if (this.#plugins.has(plugin.name)) throw new Error(`Plugin '${plugin.name}' is already installed`);
331
443
  const result = plugin.install(this);
332
444
  this.#plugins.set(plugin.name, plugin);
333
445
  return result || this;
334
446
  }
447
+ /**
448
+ * Check if a plugin is installed
449
+ */
335
450
  hasPlugin(name) {
336
451
  return this.#plugins.has(name);
337
452
  }
453
+ /**
454
+ * Get an installed plugin
455
+ */
338
456
  getPlugin(name) {
339
457
  return this.#plugins.get(name);
340
458
  }
459
+ /**
460
+ * List all installed plugins
461
+ */
341
462
  listPlugins() {
342
463
  return Array.from(this.#plugins.keys());
343
464
  }
465
+ /**
466
+ * Add a flag
467
+ */
344
468
  addFlag(flag) {
345
469
  this.#flagManager.addFlag(flag);
346
470
  if ("prompt" in flag && typeof flag.prompt === "function") this.#promptManager.registerPromptableFlag(flag);
347
471
  return this;
348
472
  }
473
+ /**
474
+ * Add multiple flags
475
+ */
349
476
  addFlags(flags) {
350
477
  for (const flag of flags) this.addFlag(flag);
351
478
  return this;
352
479
  }
480
+ /**
481
+ * Check if a flag exists
482
+ */
353
483
  hasFlag(name) {
354
484
  return this.#flagManager.hasFlag(name);
355
485
  }
486
+ /**
487
+ * Get a flag definition
488
+ */
356
489
  getFlagDefinition(name) {
357
490
  return this.#flagManager.getFlag(name);
358
491
  }
492
+ /**
493
+ * Get all flags
494
+ */
359
495
  get flags() {
360
496
  return this.#flagManager.getAllFlags();
361
497
  }
498
+ /**
499
+ * Get all flag names
500
+ */
362
501
  get flagNames() {
363
502
  return this.#flagManager.getFlagNames();
364
503
  }
504
+ /**
505
+ * Add a subcommand
506
+ */
365
507
  addSubCommand(subCommand) {
366
508
  if (this.#subCommands.has(subCommand.name)) throw new Error(`Subcommand '${subCommand.name}' already exists`);
367
509
  const subParser = subCommand.parser;
@@ -373,20 +515,35 @@ var ArgParser = class {
373
515
  this.#subCommands.set(subCommand.name, subCommand);
374
516
  return this;
375
517
  }
518
+ /**
519
+ * Get a subcommand
520
+ */
376
521
  getSubCommand(name) {
377
522
  return this.#subCommands.get(name);
378
523
  }
524
+ /**
525
+ * Get all subcommands
526
+ */
379
527
  getSubCommands() {
380
528
  return new Map(this.#subCommands);
381
529
  }
530
+ /**
531
+ * Inherit flags to a sub-parser
532
+ */
382
533
  inheritFlagsToSubParser(subParser) {
383
534
  const parentFlags = this.#flagManager.getAllFlags();
384
535
  for (const flag of parentFlags) if (!subParser.hasFlag(flag.name)) subParser.#flagManager._setProcessedFlagForInheritance(flag);
385
536
  }
537
+ /**
538
+ * Set the handler
539
+ */
386
540
  setHandler(handler) {
387
541
  this.#handler = handler;
388
542
  return this;
389
543
  }
544
+ /**
545
+ * Get the handler
546
+ */
390
547
  getHandler() {
391
548
  return this.#handler;
392
549
  }
@@ -408,6 +565,9 @@ var ArgParser = class {
408
565
  getPromptWhen() {
409
566
  return this.#promptWhen;
410
567
  }
568
+ /**
569
+ * Parse command line arguments
570
+ */
411
571
  async parse(processArgs, options = {}) {
412
572
  const args = processArgs || process.argv.slice(2);
413
573
  try {
@@ -434,12 +594,15 @@ var ArgParser = class {
434
594
  } catch (error) {
435
595
  if (error instanceof ArgParserError) {
436
596
  if (!this.#handleErrors) throw error;
437
- console.error(__alcyone_labs_simple_chalk.default.red(error.message));
597
+ console.error(_alcyone_labs_simple_chalk.default.red(error.message));
438
598
  return this.handleExit(1, error.message, "error");
439
599
  }
440
600
  throw error;
441
601
  }
442
602
  }
603
+ /**
604
+ * Parse flags only
605
+ */
443
606
  async parseFlags(args, _options = {}) {
444
607
  const result = {};
445
608
  const flags = this.#flagManager.getAllFlags();
@@ -473,6 +636,9 @@ var ArgParser = class {
473
636
  if (missingFlags.length > 0) throw new ArgParserError(`Missing mandatory flags: ${missingFlags.join(", ")}`, [this.#appName]);
474
637
  return result;
475
638
  }
639
+ /**
640
+ * Parse a flag value based on type
641
+ */
476
642
  parseFlagValue(value, type) {
477
643
  if (type === Boolean || type === "boolean") return /^(true|yes|1)$/i.test(value);
478
644
  if (type === Number || type === "number") return Number(value);
@@ -480,6 +646,9 @@ var ArgParser = class {
480
646
  if (typeof type === "function") return type(value);
481
647
  return value;
482
648
  }
649
+ /**
650
+ * Find the command chain for subcommands
651
+ */
483
652
  findCommandChain(args) {
484
653
  let currentParser = this;
485
654
  const commandChain = [];
@@ -498,6 +667,9 @@ var ArgParser = class {
498
667
  remainingArgs
499
668
  };
500
669
  }
670
+ /**
671
+ * Detect and strip system flags
672
+ */
501
673
  detectAndStripSystemFlags(args) {
502
674
  const systemArgs = {};
503
675
  const filteredArgs = [];
@@ -520,6 +692,9 @@ var ArgParser = class {
520
692
  filteredArgs
521
693
  };
522
694
  }
695
+ /**
696
+ * Handle exit
697
+ */
523
698
  handleExit(exitCode, message, type) {
524
699
  const result = {
525
700
  success: exitCode === 0,
@@ -531,18 +706,21 @@ var ArgParser = class {
531
706
  if (this.#autoExit && typeof process !== "undefined" && process.exit) process.exit(exitCode);
532
707
  return result;
533
708
  }
709
+ /**
710
+ * Generate help text
711
+ */
534
712
  helpText() {
535
713
  const lines = [];
536
- lines.push(__alcyone_labs_simple_chalk.default.bold(this.#appName));
714
+ lines.push(_alcyone_labs_simple_chalk.default.bold(this.#appName));
537
715
  if (this.#description) lines.push(this.#description);
538
716
  lines.push("");
539
717
  const commandName = this.#appCommandName || this.#appName.toLowerCase();
540
- lines.push(__alcyone_labs_simple_chalk.default.bold("Usage:"));
718
+ lines.push(_alcyone_labs_simple_chalk.default.bold("Usage:"));
541
719
  lines.push(` ${commandName} [options] [command]`);
542
720
  lines.push("");
543
721
  const flags = this.#flagManager.getAllFlags();
544
722
  if (flags.length > 0) {
545
- lines.push(__alcyone_labs_simple_chalk.default.bold("Options:"));
723
+ lines.push(_alcyone_labs_simple_chalk.default.bold("Options:"));
546
724
  for (const flag of flags) {
547
725
  const options = flag.options.join(", ");
548
726
  const defaultStr = flag.defaultValue !== void 0 ? ` (default: ${flag.defaultValue})` : "";
@@ -552,18 +730,29 @@ var ArgParser = class {
552
730
  lines.push("");
553
731
  }
554
732
  if (this.#subCommands.size > 0) {
555
- lines.push(__alcyone_labs_simple_chalk.default.bold("Commands:"));
733
+ lines.push(_alcyone_labs_simple_chalk.default.bold("Commands:"));
556
734
  for (const [name, sub] of this.#subCommands) lines.push(` ${name.padEnd(20)} ${sub.description || ""}`);
557
735
  lines.push("");
558
736
  }
559
737
  return lines.join("\n");
560
738
  }
561
739
  };
740
+ //#endregion
741
+ //#region src/plugin/types.ts
742
+ /**
743
+ * Plugin registry for managing installed plugins
744
+ *
745
+ * This class tracks which plugins are installed on a parser instance
746
+ * and provides methods for introspection.
747
+ */
562
748
  var PluginRegistry = class {
563
749
  constructor() {
564
750
  this.plugins = /* @__PURE__ */ new Map();
565
751
  this.metadata = /* @__PURE__ */ new Map();
566
752
  }
753
+ /**
754
+ * Register a plugin in the registry
755
+ */
567
756
  register(plugin, metadata) {
568
757
  if (this.plugins.has(plugin.name)) {
569
758
  console.warn(`[ArgParser] Plugin '${plugin.name}' is already registered`);
@@ -572,36 +761,74 @@ var PluginRegistry = class {
572
761
  this.plugins.set(plugin.name, plugin);
573
762
  if (metadata) this.metadata.set(plugin.name, metadata);
574
763
  }
764
+ /**
765
+ * Get a registered plugin by name
766
+ */
575
767
  get(name) {
576
768
  return this.plugins.get(name);
577
769
  }
770
+ /**
771
+ * Check if a plugin is registered
772
+ */
578
773
  has(name) {
579
774
  return this.plugins.has(name);
580
775
  }
776
+ /**
777
+ * List all registered plugin names
778
+ */
581
779
  list() {
582
780
  return Array.from(this.plugins.keys());
583
781
  }
782
+ /**
783
+ * Get metadata for a plugin
784
+ */
584
785
  getMetadata(name) {
585
786
  return this.metadata.get(name);
586
787
  }
788
+ /**
789
+ * Unregister a plugin
790
+ */
587
791
  unregister(name) {
588
792
  const plugin = this.plugins.get(name);
589
793
  if (plugin?.destroy) plugin.destroy();
590
794
  this.metadata.delete(name);
591
795
  return this.plugins.delete(name);
592
796
  }
797
+ /**
798
+ * Clear all registered plugins
799
+ */
593
800
  clear() {
594
801
  for (const [, plugin] of this.plugins) if (plugin.destroy) plugin.destroy();
595
802
  this.plugins.clear();
596
803
  this.metadata.clear();
597
804
  }
598
805
  };
599
- const globalPluginRegistry = new PluginRegistry();
806
+ /**
807
+ * Global plugin registry for system-wide plugin management
808
+ */
809
+ var globalPluginRegistry = new PluginRegistry();
810
+ /**
811
+ * Decorator for plugin methods that should be exposed on the parser
812
+ *
813
+ * @example
814
+ * ```typescript
815
+ * class MyPlugin implements IArgParserPlugin {
816
+ * name = 'my-plugin';
817
+ *
818
+ @expose()
819
+ * myMethod(parser: ArgParserBase, ...args: any[]) {
820
+ * // Implementation
821
+ * }
822
+ * }
823
+ * ```
824
+ */
600
825
  function expose(_target, propertyKey, descriptor) {
601
826
  descriptor.value._isExposed = true;
602
827
  descriptor.value._exposedName = propertyKey;
603
828
  return descriptor;
604
829
  }
830
+ //#endregion
831
+ //#region src/config/plugins/index.ts
605
832
  var ConfigPlugin = class {};
606
833
  var JsonConfigPlugin = class extends ConfigPlugin {
607
834
  constructor(..._args) {
@@ -642,7 +869,7 @@ var ConfigPluginRegistry = class {
642
869
  for (const plugin of this.plugins.values()) if (plugin.canLoad(source)) return plugin;
643
870
  }
644
871
  };
645
- const globalConfigPluginRegistry = new ConfigPluginRegistry();
872
+ var globalConfigPluginRegistry = new ConfigPluginRegistry();
646
873
  globalConfigPluginRegistry.register(new JsonConfigPlugin());
647
874
  globalConfigPluginRegistry.register(new EnvConfigPlugin());
648
875
  async function enableOptionalConfigPlugins() {}
@@ -650,7 +877,15 @@ async function enableOptionalConfigPluginsAsync() {
650
877
  await enableOptionalConfigPlugins();
651
878
  }
652
879
  function enableConfigPlugins() {}
653
- const debug = {
880
+ //#endregion
881
+ //#region src/utils/debug-utils.ts
882
+ /**
883
+ * Debug utilities for ArgParser
884
+ */
885
+ /**
886
+ * Debug logger that only logs when DEBUG environment variable is set
887
+ */
888
+ var debug = {
654
889
  log: (...args) => {
655
890
  if (process.env["DEBUG"] || process.env["ARG_PARSER_DEBUG"]) console.log("[ArgParser Debug]", ...args);
656
891
  },
@@ -661,10 +896,25 @@ const debug = {
661
896
  if (process.env["DEBUG"] || process.env["ARG_PARSER_DEBUG"]) console.warn("[ArgParser Debug]", ...args);
662
897
  }
663
898
  };
899
+ //#endregion
900
+ //#region src/core/log-path-utils.ts
901
+ /**
902
+ * Log path utilities for ArgParser
903
+ *
904
+ * Provides flexible path resolution for log files, supporting
905
+ * relative paths (to entry point or cwd), absolute paths, and
906
+ * configuration objects.
907
+ */
908
+ /**
909
+ * Detect the entry point of the application
910
+ */
664
911
  function detectEntryPoint() {
665
912
  if (process.argv[1]) return node_path.resolve(process.argv[1]);
666
913
  return process.cwd();
667
914
  }
915
+ /**
916
+ * Get entry point from import.meta.url
917
+ */
668
918
  function getEntryPointFromImportMeta(importMetaUrl) {
669
919
  try {
670
920
  return new URL(importMetaUrl).pathname;
@@ -672,18 +922,21 @@ function getEntryPointFromImportMeta(importMetaUrl) {
672
922
  return process.cwd();
673
923
  }
674
924
  }
925
+ /**
926
+ * Resolve a log path to an absolute path
927
+ */
675
928
  function resolveLogPath(logPath) {
676
929
  if (typeof logPath === "string") {
677
930
  if (logPath.startsWith("cwd:")) return node_path.resolve(process.cwd(), logPath.slice(4));
678
931
  if (logPath.startsWith("entry:")) {
679
- const entryPoint$2 = detectEntryPoint();
680
- const entryDir$2 = node_path.dirname(entryPoint$2);
681
- return node_path.resolve(entryDir$2, logPath.slice(6));
932
+ const entryPoint = detectEntryPoint();
933
+ const entryDir = node_path.dirname(entryPoint);
934
+ return node_path.resolve(entryDir, logPath.slice(6));
682
935
  }
683
936
  if (node_path.isAbsolute(logPath)) return logPath;
684
- const entryPoint$1 = detectEntryPoint();
685
- const entryDir$1 = node_path.dirname(entryPoint$1);
686
- return node_path.resolve(entryDir$1, logPath);
937
+ const entryPoint = detectEntryPoint();
938
+ const entryDir = node_path.dirname(entryPoint);
939
+ return node_path.resolve(entryDir, logPath);
687
940
  }
688
941
  const { path: pathStr, relativeTo = "entry", basePath } = logPath;
689
942
  if (relativeTo === "absolute") return pathStr;
@@ -692,20 +945,33 @@ function resolveLogPath(logPath) {
692
945
  const entryDir = node_path.dirname(entryPoint);
693
946
  return node_path.resolve(entryDir, pathStr);
694
947
  }
948
+ /**
949
+ * Create a path relative to the entry point
950
+ */
695
951
  function entryRelative(subPath) {
696
952
  const entryPoint = detectEntryPoint();
697
953
  const entryDir = node_path.dirname(entryPoint);
698
954
  return node_path.resolve(entryDir, subPath);
699
955
  }
956
+ /**
957
+ * Create a path relative to the current working directory
958
+ */
700
959
  function cwdRelative(subPath) {
701
960
  return node_path.resolve(process.cwd(), subPath);
702
961
  }
962
+ /**
963
+ * Create an absolute path
964
+ */
703
965
  function absolutePath(pathStr) {
704
966
  return node_path.resolve(pathStr);
705
967
  }
968
+ /**
969
+ * Legacy cwd-relative path (for backward compatibility)
970
+ */
706
971
  function legacyCwdPath(subPath) {
707
972
  return cwdRelative(subPath);
708
973
  }
974
+ //#endregion
709
975
  exports.ArgParser = ArgParser;
710
976
  exports.ArgParserError = ArgParserError;
711
977
  exports.ConfigPlugin = ConfigPlugin;
@@ -720,7 +986,7 @@ exports.PromptManager = PromptManager;
720
986
  Object.defineProperty(exports, "SimpleChalk", {
721
987
  enumerable: true,
722
988
  get: function() {
723
- return __alcyone_labs_simple_chalk.default;
989
+ return _alcyone_labs_simple_chalk.default;
724
990
  }
725
991
  });
726
992
  exports.absolutePath = absolutePath;