@karmaniverous/get-dotenv 7.0.8 → 7.0.10

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.
@@ -6,19 +6,19 @@ import 'fs-extra';
6
6
  import 'node:path';
7
7
  import 'radash';
8
8
  import 'node:buffer';
9
- import { a as defaultsDeep, g as getDotenvCliOptions2Options, b as baseRootOptionDefaults, G as GetDotenvCli, c as attachRootOptions } from './readMergedOptions-BT1C87_u.mjs';
9
+ import { a as defaultsDeep, g as getDotenvCliOptions2Options, b as baseRootOptionDefaults, G as GetDotenvCli, c as attachRootOptions } from './readMergedOptions-Bjl6rWXd.mjs';
10
10
  import 'crypto';
11
11
  import 'url';
12
12
  import '@commander-js/extra-typings';
13
13
  import 'dotenv';
14
14
  import 'execa';
15
15
  import { t as toHelpConfig } from './helpConfig-CGejgwWW.mjs';
16
- import { r as resolveCliOptions } from './resolveCliOptions-BbfouWSK.mjs';
16
+ import { r as resolveCliOptions } from './resolveCliOptions-C0Jmb-6I.mjs';
17
17
  import { v as validateEnvAgainstSources } from './validate-CDl0rE6k.mjs';
18
18
  import { awsPlugin } from '../plugins-aws.mjs';
19
- import { a as awsWhoamiPlugin } from './index-CNXekCQC.mjs';
19
+ import { a as awsWhoamiPlugin } from './index-DREvD42I.mjs';
20
20
  import { batchPlugin } from '../plugins-batch.mjs';
21
- import { c as cmdPlugin } from './index-DnG3N6yj.mjs';
21
+ import { c as cmdPlugin } from './index-BAcAtESJ.mjs';
22
22
  import { initPlugin } from '../plugins-init.mjs';
23
23
 
24
24
  const dbg = (...args) => {
@@ -88,6 +88,10 @@ function installRootHooks(program, defaults) {
88
88
  runAfterResolve: false,
89
89
  });
90
90
  propagateResolvedEnv(merged);
91
+ // Propagate debug flag to env so dbg() helpers and error boundary see it.
92
+ if (merged.debug) {
93
+ process.env.GETDOTENV_DEBUG = '1';
94
+ }
91
95
  // Refresh dynamic help text using the resolved config slices.
92
96
  try {
93
97
  const ctx = program.getCtx();
@@ -140,6 +144,10 @@ function installRootHooks(program, defaults) {
140
144
  // builds a fresh `merged` and overwrites the options bag, so the env
141
145
  // propagated by preSubcommand is lost without this call.
142
146
  propagateResolvedEnv(merged);
147
+ // Propagate debug flag to env so dbg() helpers and error boundary see it.
148
+ if (merged.debug) {
149
+ process.env.GETDOTENV_DEBUG = '1';
150
+ }
143
151
  try {
144
152
  const ctx = program.getCtx();
145
153
  const helpCfg = toHelpConfig(merged, ctx.pluginConfigs);
@@ -273,6 +281,25 @@ function applyRootVisibility(program, visibility) {
273
281
  }
274
282
  }
275
283
 
284
+ /**
285
+ * Top-level error boundary for the CLI runner.
286
+ *
287
+ * Presents errors as clean one-line messages by default.
288
+ * When GETDOTENV_DEBUG is set, prints the full stack trace.
289
+ */
290
+ function handleCliError(err, argv) {
291
+ const isDebug = process.env.GETDOTENV_DEBUG === '1' ||
292
+ process.env.GETDOTENV_DEBUG === 'true' ||
293
+ (Array.isArray(argv) && argv.includes('--debug'));
294
+ const message = err instanceof Error ? err.message : String(err);
295
+ if (isDebug) {
296
+ console.error(err instanceof Error ? (err.stack ?? message) : message);
297
+ }
298
+ else {
299
+ console.error(`Error: ${message}`);
300
+ }
301
+ process.exitCode = 1;
302
+ }
276
303
  /**
277
304
  * Create a configured get-dotenv CLI host.
278
305
  * Applies defaults, installs root hooks, and composes plugins.
@@ -365,7 +392,7 @@ function createCli(opts = {}) {
365
392
  }
366
393
  else {
367
394
  program
368
- .use(cmdPlugin({ optionAlias: '-c, --cmd <command...>' }))
395
+ .use(cmdPlugin({ asDefault: true, optionAlias: '-c, --cmd <command...>' }))
369
396
  .use(batchPlugin())
370
397
  .use(awsPlugin().use(awsWhoamiPlugin()))
371
398
  .use(initPlugin());
@@ -468,7 +495,12 @@ function createCli(opts = {}) {
468
495
  ? { helpHeader: opts.branding }
469
496
  : {}),
470
497
  });
471
- await program.parseAsync(['node', alias, ...argv]);
498
+ try {
499
+ await program.parseAsync(['node', alias, ...argv]);
500
+ }
501
+ catch (err) {
502
+ handleCliError(err, argv);
503
+ }
472
504
  };
473
505
  }
474
506
 
@@ -1,5 +1,5 @@
1
1
  import { camel } from 'radash';
2
- import { r as readMergedOptions, a as defaultsDeep, g as getDotenvCliOptions2Options, d as definePlugin } from './readMergedOptions-BT1C87_u.mjs';
2
+ import { r as readMergedOptions, a as defaultsDeep, g as getDotenvCliOptions2Options, d as definePlugin } from './readMergedOptions-Bjl6rWXd.mjs';
3
3
  import 'execa';
4
4
  import 'node:buffer';
5
5
  import 'fs-extra';
@@ -17,7 +17,7 @@ import { z } from 'zod';
17
17
  import { r as resolveCommand, a as resolveShell, t as tokenize, s as shouldCapture, c as runCommand, b as buildSpawnEnv } from './spawnEnv-DvisqPiU.mjs';
18
18
  import { m as maybePreserveNodeEvalArgv, c as composeNestedEnv, s as stripOne } from './invoke-DuRPU1oC.mjs';
19
19
  import { f as dotenvExpandFromProcessEnv } from './readDotenvCascade-CfFPgLCp.mjs';
20
- import { b as baseGetDotenvCliOptions, r as resolveCliOptions } from './resolveCliOptions-BbfouWSK.mjs';
20
+ import { b as baseGetDotenvCliOptions, r as resolveCliOptions } from './resolveCliOptions-C0Jmb-6I.mjs';
21
21
 
22
22
  /** src/diagnostics/entropy.ts
23
23
  * Entropy diagnostics (presentation-only).
@@ -455,6 +455,7 @@ const cmdPluginConfigSchema = z
455
455
  const cmdPlugin = (options = {}) => {
456
456
  const plugin = definePlugin({
457
457
  ns: 'cmd',
458
+ ...(options.asDefault ? { nsOptions: { isDefault: true } } : {}),
458
459
  configSchema: cmdPluginConfigSchema,
459
460
  setup(cli) {
460
461
  const aliasSpec = typeof options.optionAlias === 'string'
@@ -1,4 +1,4 @@
1
- import { d as definePlugin } from './readMergedOptions-BT1C87_u.mjs';
1
+ import { d as definePlugin } from './readMergedOptions-Bjl6rWXd.mjs';
2
2
  import 'execa';
3
3
  import 'radash';
4
4
  import 'node:buffer';
@@ -14,7 +14,6 @@ import './loader-C3DtD6HB.mjs';
14
14
  import 'package-directory';
15
15
  import 'yaml';
16
16
  import 'zod';
17
- import { STSClient, GetCallerIdentityCommand } from '@aws-sdk/client-sts';
18
17
 
19
18
  /**
20
19
  * Attach the default action for the `aws whoami` command.
@@ -26,6 +25,22 @@ import { STSClient, GetCallerIdentityCommand } from '@aws-sdk/client-sts';
26
25
  */
27
26
  function attachWhoamiDefaultAction(cli) {
28
27
  cli.action(async () => {
28
+ // Dynamic import: @aws-sdk/client-sts is an optional peer dependency.
29
+ // A static import would cause Node to fail at startup (even for -h)
30
+ // when the SDK is not installed in the consumer's project.
31
+ let GetCallerIdentityCommand;
32
+ let STSClient;
33
+ try {
34
+ const mod = await import('@aws-sdk/client-sts');
35
+ GetCallerIdentityCommand = mod.GetCallerIdentityCommand;
36
+ STSClient = mod.STSClient;
37
+ }
38
+ catch {
39
+ console.error('The aws whoami command requires @aws-sdk/client-sts.\n' +
40
+ 'Install it with: npm install @aws-sdk/client-sts');
41
+ process.exitCode = 1;
42
+ return;
43
+ }
29
44
  // The AWS SDK default providers will read credentials from process.env,
30
45
  // which the aws parent has already populated.
31
46
  const client = new STSClient();
@@ -737,6 +737,19 @@ const attachRootOptions = (program, defaults) => {
737
737
  program.addOption(lf);
738
738
  program.setOptionGroup(lf, GROUP);
739
739
  }
740
+ // Debug ON/OFF (dynamic)
741
+ {
742
+ const dOn = program
743
+ .createDynamicOption('--debug', (cfg) => `enable debug logging to stderr ${onOff(true, Boolean(cfg.debug))}`)
744
+ .conflicts('debugOff');
745
+ program.addOption(dOn);
746
+ program.setOptionGroup(dOn, GROUP);
747
+ const dOff = program
748
+ .createDynamicOption('--debug-off', (cfg) => `enable debug logging to stderr ${onOff(false, !cfg.debug)}`)
749
+ .conflicts('debug');
750
+ program.addOption(dOff);
751
+ program.setOptionGroup(dOff, GROUP);
752
+ }
740
753
  // Capture flag (no default display; static)
741
754
  {
742
755
  const opt = new Option('--capture', 'capture child process stdio for commands (tests/CI)');
@@ -1094,7 +1107,7 @@ const effectiveNs = (child) => {
1094
1107
  const isPromise = (v) => !!v && typeof v.then === 'function';
1095
1108
  function runInstall(parentCli, plugin) {
1096
1109
  // Create mount and run setup
1097
- const mount = parentCli.ns(plugin.ns);
1110
+ const mount = parentCli.ns(plugin.ns, plugin.nsOptions);
1098
1111
  const setupRet = plugin.setup(mount);
1099
1112
  const pending = [];
1100
1113
  if (isPromise(setupRet))
@@ -1351,13 +1364,16 @@ class GetDotenvCli extends Command {
1351
1364
  * Convenience helper to create a namespaced subcommand with argument inference.
1352
1365
  * This mirrors Commander generics so downstream chaining stays fully typed.
1353
1366
  */
1354
- ns(name) {
1367
+ ns(name, opts) {
1355
1368
  // Guard against same-level duplicate command names for clearer diagnostics.
1356
1369
  const exists = this.commands.some((c) => c.name() === name);
1357
1370
  if (exists) {
1358
1371
  throw new Error(`Duplicate command name: ${name}`);
1359
1372
  }
1360
- return this.command(name);
1373
+ return this.command(name, {
1374
+ ...(opts?.isDefault !== undefined ? { isDefault: opts.isDefault } : {}),
1375
+ ...(opts?.hidden !== undefined ? { hidden: opts.hidden } : {}),
1376
+ });
1361
1377
  }
1362
1378
  /**
1363
1379
  * Tag options added during the provided callback as 'app' for grouped help.
@@ -1,4 +1,4 @@
1
- import { b as baseRootOptionDefaults, a as defaultsDeep } from './readMergedOptions-BT1C87_u.mjs';
1
+ import { b as baseRootOptionDefaults, a as defaultsDeep } from './readMergedOptions-Bjl6rWXd.mjs';
2
2
  import 'radash';
3
3
  import 'node:buffer';
4
4
  import 'fs-extra';
@@ -1,4 +1,4 @@
1
- import { d as definePlugin } from './readMergedOptions-BT1C87_u.mjs';
1
+ import { d as definePlugin } from './readMergedOptions-Bjl6rWXd.mjs';
2
2
 
3
3
  /**
4
4
  * Create a namespace-only parent plugin (a group command) for composing plugins
package/dist/cli.d.ts CHANGED
@@ -484,7 +484,7 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
484
484
  * Create a namespaced child command with argument inference.
485
485
  * Mirrors Commander generics so downstream chaining remains fully typed.
486
486
  */
487
- ns<Usage extends string>(name: Usage): GetDotenvCliPublic<TOptions, [
487
+ ns<Usage extends string>(name: Usage, opts?: NsOptions): GetDotenvCliPublic<TOptions, [
488
488
  ...TArgs,
489
489
  ...InferCommandArguments<Usage>
490
490
  ], {}, TOpts & TGlobal>;
@@ -525,6 +525,23 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
525
525
  /** {@inheritDoc} */
526
526
  createDynamicOption<Usage extends string, TValue = unknown>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser: (value: string, previous?: TValue) => TValue, defaultValue?: TValue): Option<Usage>;
527
527
  }
528
+ /**
529
+ * Options for the `ns()` subcommand factory, forwarded to Commander's
530
+ * `command(name, opts)` second argument.
531
+ *
532
+ * @public
533
+ */
534
+ interface NsOptions {
535
+ /**
536
+ * When true, this subcommand becomes the default: Commander routes
537
+ * unrecognized positional tokens to it when no explicit subcommand matches.
538
+ */
539
+ isDefault?: boolean;
540
+ /**
541
+ * When true, the subcommand is hidden from help output.
542
+ */
543
+ hidden?: boolean;
544
+ }
528
545
  /**
529
546
  * Optional overrides for plugin composition.
530
547
  *
@@ -554,6 +571,11 @@ interface PluginChildEntry<TOptions extends GetDotenvOptions = GetDotenvOptions,
554
571
  interface GetDotenvCliPlugin<TOptions extends GetDotenvOptions = GetDotenvOptions, TArgs extends unknown[] = [], TOpts extends OptionValues = {}, TGlobal extends OptionValues = {}> {
555
572
  /** Namespace (required): the command name where this plugin is mounted. */
556
573
  ns: string;
574
+ /**
575
+ * Options forwarded to the host's `ns()` call when creating the mount
576
+ * for this plugin (e.g. `{ isDefault: true }`).
577
+ */
578
+ nsOptions?: NsOptions;
557
579
  /**
558
580
  * Setup phase: register commands and wiring on the provided mount.
559
581
  * Runs parent → children (pre-order). Return nothing (void).
@@ -677,7 +699,7 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions,
677
699
  * Convenience helper to create a namespaced subcommand with argument inference.
678
700
  * This mirrors Commander generics so downstream chaining stays fully typed.
679
701
  */
680
- ns<Usage extends string>(name: Usage): GetDotenvCliPublic<TOptions, [
702
+ ns<Usage extends string>(name: Usage, opts?: NsOptions): GetDotenvCliPublic<TOptions, [
681
703
  ...TArgs,
682
704
  ...InferCommandArguments<Usage>
683
705
  ], {}, TOpts & TGlobal>;
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as createCli } from './chunks/createCli-CUPiFVdZ.mjs';
1
+ export { c as createCli } from './chunks/createCli-BIG9hp19.mjs';
2
2
  import 'zod';
3
3
  import 'path';
4
4
  import './chunks/loader-C3DtD6HB.mjs';
@@ -13,22 +13,21 @@ import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
13
13
  import 'crypto';
14
14
  import '@commander-js/extra-typings';
15
15
  import 'nanoid';
16
- import './chunks/readMergedOptions-BT1C87_u.mjs';
16
+ import './chunks/readMergedOptions-Bjl6rWXd.mjs';
17
17
  import './chunks/readDotenvCascade-CfFPgLCp.mjs';
18
18
  import 'dotenv';
19
19
  import 'execa';
20
20
  import './chunks/helpConfig-CGejgwWW.mjs';
21
- import './chunks/resolveCliOptions-BbfouWSK.mjs';
21
+ import './chunks/resolveCliOptions-C0Jmb-6I.mjs';
22
22
  import './chunks/validate-CDl0rE6k.mjs';
23
23
  import './plugins-aws.mjs';
24
24
  import './chunks/spawnEnv-DvisqPiU.mjs';
25
- import './chunks/index-CNXekCQC.mjs';
26
- import '@aws-sdk/client-sts';
25
+ import './chunks/index-DREvD42I.mjs';
27
26
  import './plugins-batch.mjs';
28
27
  import './chunks/invoke-DuRPU1oC.mjs';
29
28
  import 'globby';
30
29
  import 'os';
31
- import './chunks/index-DnG3N6yj.mjs';
30
+ import './chunks/index-BAcAtESJ.mjs';
32
31
  import './plugins-init.mjs';
33
32
  import 'node:process';
34
33
  import 'readline/promises';
package/dist/cliHost.d.ts CHANGED
@@ -500,7 +500,7 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
500
500
  * Create a namespaced child command with argument inference.
501
501
  * Mirrors Commander generics so downstream chaining remains fully typed.
502
502
  */
503
- ns<Usage extends string>(name: Usage): GetDotenvCliPublic<TOptions, [
503
+ ns<Usage extends string>(name: Usage, opts?: NsOptions): GetDotenvCliPublic<TOptions, [
504
504
  ...TArgs,
505
505
  ...InferCommandArguments<Usage>
506
506
  ], {}, TOpts & TGlobal>;
@@ -541,6 +541,23 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
541
541
  /** {@inheritDoc} */
542
542
  createDynamicOption<Usage extends string, TValue = unknown>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser: (value: string, previous?: TValue) => TValue, defaultValue?: TValue): Option<Usage>;
543
543
  }
544
+ /**
545
+ * Options for the `ns()` subcommand factory, forwarded to Commander's
546
+ * `command(name, opts)` second argument.
547
+ *
548
+ * @public
549
+ */
550
+ interface NsOptions {
551
+ /**
552
+ * When true, this subcommand becomes the default: Commander routes
553
+ * unrecognized positional tokens to it when no explicit subcommand matches.
554
+ */
555
+ isDefault?: boolean;
556
+ /**
557
+ * When true, the subcommand is hidden from help output.
558
+ */
559
+ hidden?: boolean;
560
+ }
544
561
  /**
545
562
  * Optional overrides for plugin composition.
546
563
  *
@@ -570,6 +587,11 @@ interface PluginChildEntry<TOptions extends GetDotenvOptions = GetDotenvOptions,
570
587
  interface GetDotenvCliPlugin<TOptions extends GetDotenvOptions = GetDotenvOptions, TArgs extends unknown[] = [], TOpts extends OptionValues = {}, TGlobal extends OptionValues = {}> {
571
588
  /** Namespace (required): the command name where this plugin is mounted. */
572
589
  ns: string;
590
+ /**
591
+ * Options forwarded to the host's `ns()` call when creating the mount
592
+ * for this plugin (e.g. `{ isDefault: true }`).
593
+ */
594
+ nsOptions?: NsOptions;
573
595
  /**
574
596
  * Setup phase: register commands and wiring on the provided mount.
575
597
  * Runs parent → children (pre-order). Return nothing (void).
@@ -867,7 +889,7 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions,
867
889
  * Convenience helper to create a namespaced subcommand with argument inference.
868
890
  * This mirrors Commander generics so downstream chaining stays fully typed.
869
891
  */
870
- ns<Usage extends string>(name: Usage): GetDotenvCliPublic<TOptions, [
892
+ ns<Usage extends string>(name: Usage, opts?: NsOptions): GetDotenvCliPublic<TOptions, [
871
893
  ...TArgs,
872
894
  ...InferCommandArguments<Usage>
873
895
  ], {}, TOpts & TGlobal>;
@@ -1147,4 +1169,4 @@ declare const resolveCliOptions: <T extends ResolveCliOptionsShape>(rawCliOption
1147
1169
  declare const buildSpawnEnv: (base?: NodeJS.ProcessEnv, overlay?: ProcessEnv) => NodeJS.ProcessEnv;
1148
1170
 
1149
1171
  export { GetDotenvCli, baseGetDotenvCliOptions, buildSpawnEnv, composeNestedEnv, definePlugin, defineScripts, describeConfigKeyListDefaults, describeDefault, ensureForce, getRootCommand, groupPlugins, maybePreserveNodeEvalArgv, readMergedOptions, resolveCliOptions, resolveCommand, resolveShell, runCommand, runCommandResult, shouldCapture, stripOne, toHelpConfig };
1150
- export type { BrandOptions, DefineSpec, GetDotenvCliCtx, GetDotenvCliOptions, GetDotenvCliPlugin, GetDotenvCliPublic, GroupPluginsOptions, InferPluginConfig, PluginChildEntry, PluginFlattenedEntry, PluginNamespaceOverride, PluginWithInstanceHelpers, ResolveAndLoadOptions, ResolveCliOptionsResult, ResolvedHelpConfig, RootOptionsShape, RunCommandOptions, RunCommandResultOptions, ScriptDef, Scripts, ScriptsTable };
1172
+ export type { BrandOptions, DefineSpec, GetDotenvCliCtx, GetDotenvCliOptions, GetDotenvCliPlugin, GetDotenvCliPublic, GroupPluginsOptions, InferPluginConfig, NsOptions, PluginChildEntry, PluginFlattenedEntry, PluginNamespaceOverride, PluginWithInstanceHelpers, ResolveAndLoadOptions, ResolveCliOptionsResult, ResolvedHelpConfig, RootOptionsShape, RunCommandOptions, RunCommandResultOptions, ScriptDef, Scripts, ScriptsTable };
package/dist/cliHost.mjs CHANGED
@@ -1,7 +1,7 @@
1
- export { G as GetDotenvCli, d as definePlugin, r as readMergedOptions } from './chunks/readMergedOptions-BT1C87_u.mjs';
1
+ export { G as GetDotenvCli, d as definePlugin, r as readMergedOptions } from './chunks/readMergedOptions-Bjl6rWXd.mjs';
2
2
  export { b as buildSpawnEnv, r as resolveCommand, a as resolveShell, c as runCommand, d as runCommandResult, s as shouldCapture } from './chunks/spawnEnv-DvisqPiU.mjs';
3
- export { b as baseGetDotenvCliOptions, r as resolveCliOptions } from './chunks/resolveCliOptions-BbfouWSK.mjs';
4
- export { d as defineScripts, g as groupPlugins } from './chunks/types-BkQxnyZK.mjs';
3
+ export { b as baseGetDotenvCliOptions, r as resolveCliOptions } from './chunks/resolveCliOptions-C0Jmb-6I.mjs';
4
+ export { d as defineScripts, g as groupPlugins } from './chunks/types-CcDLYiJ3.mjs';
5
5
  export { t as toHelpConfig } from './chunks/helpConfig-CGejgwWW.mjs';
6
6
  export { c as composeNestedEnv, m as maybePreserveNodeEvalArgv, s as stripOne } from './chunks/invoke-DuRPU1oC.mjs';
7
7
  export { z } from 'zod';
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as createCli } from './chunks/createCli-CUPiFVdZ.mjs';
2
+ import { c as createCli } from './chunks/createCli-BIG9hp19.mjs';
3
3
  import 'zod';
4
4
  import 'path';
5
5
  import './chunks/loader-C3DtD6HB.mjs';
@@ -14,22 +14,21 @@ import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
14
14
  import 'crypto';
15
15
  import '@commander-js/extra-typings';
16
16
  import 'nanoid';
17
- import './chunks/readMergedOptions-BT1C87_u.mjs';
17
+ import './chunks/readMergedOptions-Bjl6rWXd.mjs';
18
18
  import './chunks/readDotenvCascade-CfFPgLCp.mjs';
19
19
  import 'dotenv';
20
20
  import 'execa';
21
21
  import './chunks/helpConfig-CGejgwWW.mjs';
22
- import './chunks/resolveCliOptions-BbfouWSK.mjs';
22
+ import './chunks/resolveCliOptions-C0Jmb-6I.mjs';
23
23
  import './chunks/validate-CDl0rE6k.mjs';
24
24
  import './plugins-aws.mjs';
25
25
  import './chunks/spawnEnv-DvisqPiU.mjs';
26
- import './chunks/index-CNXekCQC.mjs';
27
- import '@aws-sdk/client-sts';
26
+ import './chunks/index-DREvD42I.mjs';
28
27
  import './plugins-batch.mjs';
29
28
  import './chunks/invoke-DuRPU1oC.mjs';
30
29
  import 'globby';
31
30
  import 'os';
32
- import './chunks/index-DnG3N6yj.mjs';
31
+ import './chunks/index-BAcAtESJ.mjs';
33
32
  import './plugins-init.mjs';
34
33
  import 'node:process';
35
34
  import 'readline/promises';
package/dist/index.d.ts CHANGED
@@ -652,7 +652,7 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
652
652
  * Create a namespaced child command with argument inference.
653
653
  * Mirrors Commander generics so downstream chaining remains fully typed.
654
654
  */
655
- ns<Usage extends string>(name: Usage): GetDotenvCliPublic<TOptions, [
655
+ ns<Usage extends string>(name: Usage, opts?: NsOptions): GetDotenvCliPublic<TOptions, [
656
656
  ...TArgs,
657
657
  ...InferCommandArguments<Usage>
658
658
  ], {}, TOpts & TGlobal>;
@@ -693,6 +693,23 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
693
693
  /** {@inheritDoc} */
694
694
  createDynamicOption<Usage extends string, TValue = unknown>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser: (value: string, previous?: TValue) => TValue, defaultValue?: TValue): Option<Usage>;
695
695
  }
696
+ /**
697
+ * Options for the `ns()` subcommand factory, forwarded to Commander's
698
+ * `command(name, opts)` second argument.
699
+ *
700
+ * @public
701
+ */
702
+ interface NsOptions {
703
+ /**
704
+ * When true, this subcommand becomes the default: Commander routes
705
+ * unrecognized positional tokens to it when no explicit subcommand matches.
706
+ */
707
+ isDefault?: boolean;
708
+ /**
709
+ * When true, the subcommand is hidden from help output.
710
+ */
711
+ hidden?: boolean;
712
+ }
696
713
  /**
697
714
  * Optional overrides for plugin composition.
698
715
  *
@@ -722,6 +739,11 @@ interface PluginChildEntry<TOptions extends GetDotenvOptions = GetDotenvOptions,
722
739
  interface GetDotenvCliPlugin<TOptions extends GetDotenvOptions = GetDotenvOptions, TArgs extends unknown[] = [], TOpts extends OptionValues = {}, TGlobal extends OptionValues = {}> {
723
740
  /** Namespace (required): the command name where this plugin is mounted. */
724
741
  ns: string;
742
+ /**
743
+ * Options forwarded to the host's `ns()` call when creating the mount
744
+ * for this plugin (e.g. `{ isDefault: true }`).
745
+ */
746
+ nsOptions?: NsOptions;
725
747
  /**
726
748
  * Setup phase: register commands and wiring on the provided mount.
727
749
  * Runs parent → children (pre-order). Return nothing (void).
@@ -916,7 +938,7 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions,
916
938
  * Convenience helper to create a namespaced subcommand with argument inference.
917
939
  * This mirrors Commander generics so downstream chaining stays fully typed.
918
940
  */
919
- ns<Usage extends string>(name: Usage): GetDotenvCliPublic<TOptions, [
941
+ ns<Usage extends string>(name: Usage, opts?: NsOptions): GetDotenvCliPublic<TOptions, [
920
942
  ...TArgs,
921
943
  ...InferCommandArguments<Usage>
922
944
  ], {}, TOpts & TGlobal>;
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- export { c as createCli } from './chunks/createCli-CUPiFVdZ.mjs';
2
- import { e as resolveGetDotenvOptions, w as writeDotenvFile } from './chunks/readMergedOptions-BT1C87_u.mjs';
3
- export { G as GetDotenvCli, f as assertLogger, b as baseRootOptionDefaults, a as defaultsDeep, h as defineDynamic, i as defineGetDotenvConfig, d as definePlugin, g as getDotenvCliOptions2Options, j as interpolateDeep, r as readMergedOptions } from './chunks/readMergedOptions-BT1C87_u.mjs';
1
+ export { c as createCli } from './chunks/createCli-BIG9hp19.mjs';
2
+ import { e as resolveGetDotenvOptions, w as writeDotenvFile } from './chunks/readMergedOptions-Bjl6rWXd.mjs';
3
+ export { G as GetDotenvCli, f as assertLogger, b as baseRootOptionDefaults, a as defaultsDeep, h as defineDynamic, i as defineGetDotenvConfig, d as definePlugin, g as getDotenvCliOptions2Options, j as interpolateDeep, r as readMergedOptions } from './chunks/readMergedOptions-Bjl6rWXd.mjs';
4
4
  export { b as buildSpawnEnv, s as shouldCapture, t as tokenize } from './chunks/spawnEnv-DvisqPiU.mjs';
5
- export { d as defineScripts, g as groupPlugins } from './chunks/types-BkQxnyZK.mjs';
5
+ export { d as defineScripts, g as groupPlugins } from './chunks/types-CcDLYiJ3.mjs';
6
6
  import { omit, pick } from 'radash';
7
7
  import { Buffer } from 'node:buffer';
8
8
  export { l as loadModuleDefault } from './chunks/loadModuleDefault-Dj8B3Stt.mjs';
@@ -10,8 +10,8 @@ import { InvalidArgumentError } from '@commander-js/extra-typings';
10
10
  import 'zod';
11
11
  import { nanoid } from 'nanoid';
12
12
  import path$1 from 'path';
13
- import { r as redactObject, m as maybeWarnEntropy } from './chunks/index-DnG3N6yj.mjs';
14
- export { a as redactDisplay, t as traceChildEnv } from './chunks/index-DnG3N6yj.mjs';
13
+ import { r as redactObject, m as maybeWarnEntropy } from './chunks/index-BAcAtESJ.mjs';
14
+ export { a as redactDisplay, t as traceChildEnv } from './chunks/index-BAcAtESJ.mjs';
15
15
  import { g as readDotenv, d as dotenvExpandAll, a as applyDynamicMap, l as loadAndApplyDynamic } from './chunks/readDotenvCascade-CfFPgLCp.mjs';
16
16
  export { h as dotenvExpand, f as dotenvExpandFromProcessEnv } from './chunks/readDotenvCascade-CfFPgLCp.mjs';
17
17
  import fs from 'fs-extra';
@@ -24,11 +24,10 @@ import 'package-directory';
24
24
  import 'yaml';
25
25
  import 'execa';
26
26
  import './chunks/helpConfig-CGejgwWW.mjs';
27
- import './chunks/resolveCliOptions-BbfouWSK.mjs';
27
+ import './chunks/resolveCliOptions-C0Jmb-6I.mjs';
28
28
  import './chunks/validate-CDl0rE6k.mjs';
29
29
  import './plugins-aws.mjs';
30
- import './chunks/index-CNXekCQC.mjs';
31
- import '@aws-sdk/client-sts';
30
+ import './chunks/index-DREvD42I.mjs';
32
31
  import './plugins-batch.mjs';
33
32
  import './chunks/invoke-DuRPU1oC.mjs';
34
33
  import 'globby';
@@ -378,7 +378,7 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
378
378
  * Create a namespaced child command with argument inference.
379
379
  * Mirrors Commander generics so downstream chaining remains fully typed.
380
380
  */
381
- ns<Usage extends string>(name: Usage): GetDotenvCliPublic<TOptions, [
381
+ ns<Usage extends string>(name: Usage, opts?: NsOptions): GetDotenvCliPublic<TOptions, [
382
382
  ...TArgs,
383
383
  ...InferCommandArguments<Usage>
384
384
  ], {}, TOpts & TGlobal>;
@@ -419,6 +419,23 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
419
419
  /** {@inheritDoc} */
420
420
  createDynamicOption<Usage extends string, TValue = unknown>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser: (value: string, previous?: TValue) => TValue, defaultValue?: TValue): Option<Usage>;
421
421
  }
422
+ /**
423
+ * Options for the `ns()` subcommand factory, forwarded to Commander's
424
+ * `command(name, opts)` second argument.
425
+ *
426
+ * @public
427
+ */
428
+ interface NsOptions {
429
+ /**
430
+ * When true, this subcommand becomes the default: Commander routes
431
+ * unrecognized positional tokens to it when no explicit subcommand matches.
432
+ */
433
+ isDefault?: boolean;
434
+ /**
435
+ * When true, the subcommand is hidden from help output.
436
+ */
437
+ hidden?: boolean;
438
+ }
422
439
  /**
423
440
  * Optional overrides for plugin composition.
424
441
  *
@@ -448,6 +465,11 @@ interface PluginChildEntry<TOptions extends GetDotenvOptions = GetDotenvOptions,
448
465
  interface GetDotenvCliPlugin<TOptions extends GetDotenvOptions = GetDotenvOptions, TArgs extends unknown[] = [], TOpts extends OptionValues = {}, TGlobal extends OptionValues = {}> {
449
466
  /** Namespace (required): the command name where this plugin is mounted. */
450
467
  ns: string;
468
+ /**
469
+ * Options forwarded to the host's `ns()` call when creating the mount
470
+ * for this plugin (e.g. `{ isDefault: true }`).
471
+ */
472
+ nsOptions?: NsOptions;
451
473
  /**
452
474
  * Setup phase: register commands and wiring on the provided mount.
453
475
  * Runs parent → children (pre-order). Return nothing (void).
@@ -1,4 +1,4 @@
1
- import { r as readMergedOptions, d as definePlugin } from './chunks/readMergedOptions-BT1C87_u.mjs';
1
+ import { r as readMergedOptions, d as definePlugin } from './chunks/readMergedOptions-Bjl6rWXd.mjs';
2
2
  import 'execa';
3
3
  import { isObject } from 'radash';
4
4
  import 'node:buffer';
@@ -378,7 +378,7 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
378
378
  * Create a namespaced child command with argument inference.
379
379
  * Mirrors Commander generics so downstream chaining remains fully typed.
380
380
  */
381
- ns<Usage extends string>(name: Usage): GetDotenvCliPublic<TOptions, [
381
+ ns<Usage extends string>(name: Usage, opts?: NsOptions): GetDotenvCliPublic<TOptions, [
382
382
  ...TArgs,
383
383
  ...InferCommandArguments<Usage>
384
384
  ], {}, TOpts & TGlobal>;
@@ -419,6 +419,23 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
419
419
  /** {@inheritDoc} */
420
420
  createDynamicOption<Usage extends string, TValue = unknown>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser: (value: string, previous?: TValue) => TValue, defaultValue?: TValue): Option<Usage>;
421
421
  }
422
+ /**
423
+ * Options for the `ns()` subcommand factory, forwarded to Commander's
424
+ * `command(name, opts)` second argument.
425
+ *
426
+ * @public
427
+ */
428
+ interface NsOptions {
429
+ /**
430
+ * When true, this subcommand becomes the default: Commander routes
431
+ * unrecognized positional tokens to it when no explicit subcommand matches.
432
+ */
433
+ isDefault?: boolean;
434
+ /**
435
+ * When true, the subcommand is hidden from help output.
436
+ */
437
+ hidden?: boolean;
438
+ }
422
439
  /**
423
440
  * Optional overrides for plugin composition.
424
441
  *
@@ -448,6 +465,11 @@ interface PluginChildEntry<TOptions extends GetDotenvOptions = GetDotenvOptions,
448
465
  interface GetDotenvCliPlugin<TOptions extends GetDotenvOptions = GetDotenvOptions, TArgs extends unknown[] = [], TOpts extends OptionValues = {}, TGlobal extends OptionValues = {}> {
449
466
  /** Namespace (required): the command name where this plugin is mounted. */
450
467
  ns: string;
468
+ /**
469
+ * Options forwarded to the host's `ns()` call when creating the mount
470
+ * for this plugin (e.g. `{ isDefault: true }`).
471
+ */
472
+ nsOptions?: NsOptions;
451
473
  /**
452
474
  * Setup phase: register commands and wiring on the provided mount.
453
475
  * Runs parent → children (pre-order). Return nothing (void).
@@ -1,4 +1,4 @@
1
- import { r as readMergedOptions, d as definePlugin } from './chunks/readMergedOptions-BT1C87_u.mjs';
1
+ import { r as readMergedOptions, d as definePlugin } from './chunks/readMergedOptions-Bjl6rWXd.mjs';
2
2
  import 'execa';
3
3
  import 'radash';
4
4
  import 'node:buffer';
@@ -378,7 +378,7 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
378
378
  * Create a namespaced child command with argument inference.
379
379
  * Mirrors Commander generics so downstream chaining remains fully typed.
380
380
  */
381
- ns<Usage extends string>(name: Usage): GetDotenvCliPublic<TOptions, [
381
+ ns<Usage extends string>(name: Usage, opts?: NsOptions): GetDotenvCliPublic<TOptions, [
382
382
  ...TArgs,
383
383
  ...InferCommandArguments<Usage>
384
384
  ], {}, TOpts & TGlobal>;
@@ -419,6 +419,23 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
419
419
  /** {@inheritDoc} */
420
420
  createDynamicOption<Usage extends string, TValue = unknown>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser: (value: string, previous?: TValue) => TValue, defaultValue?: TValue): Option<Usage>;
421
421
  }
422
+ /**
423
+ * Options for the `ns()` subcommand factory, forwarded to Commander's
424
+ * `command(name, opts)` second argument.
425
+ *
426
+ * @public
427
+ */
428
+ interface NsOptions {
429
+ /**
430
+ * When true, this subcommand becomes the default: Commander routes
431
+ * unrecognized positional tokens to it when no explicit subcommand matches.
432
+ */
433
+ isDefault?: boolean;
434
+ /**
435
+ * When true, the subcommand is hidden from help output.
436
+ */
437
+ hidden?: boolean;
438
+ }
422
439
  /**
423
440
  * Optional overrides for plugin composition.
424
441
  *
@@ -448,6 +465,11 @@ interface PluginChildEntry<TOptions extends GetDotenvOptions = GetDotenvOptions,
448
465
  interface GetDotenvCliPlugin<TOptions extends GetDotenvOptions = GetDotenvOptions, TArgs extends unknown[] = [], TOpts extends OptionValues = {}, TGlobal extends OptionValues = {}> {
449
466
  /** Namespace (required): the command name where this plugin is mounted. */
450
467
  ns: string;
468
+ /**
469
+ * Options forwarded to the host's `ns()` call when creating the mount
470
+ * for this plugin (e.g. `{ isDefault: true }`).
471
+ */
472
+ nsOptions?: NsOptions;
451
473
  /**
452
474
  * Setup phase: register commands and wiring on the provided mount.
453
475
  * Runs parent → children (pre-order). Return nothing (void).
@@ -1,5 +1,5 @@
1
1
  import 'radash';
2
- import './chunks/readMergedOptions-BT1C87_u.mjs';
2
+ import './chunks/readMergedOptions-Bjl6rWXd.mjs';
3
3
  import 'execa';
4
4
  import 'node:buffer';
5
5
  import 'fs-extra';
@@ -14,9 +14,9 @@ import './chunks/loader-C3DtD6HB.mjs';
14
14
  import 'package-directory';
15
15
  import 'yaml';
16
16
  import 'zod';
17
- export { c as cmdPlugin } from './chunks/index-DnG3N6yj.mjs';
17
+ export { c as cmdPlugin } from './chunks/index-BAcAtESJ.mjs';
18
18
  import './chunks/readDotenvCascade-CfFPgLCp.mjs';
19
19
  import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
20
20
  import './chunks/spawnEnv-DvisqPiU.mjs';
21
21
  import './chunks/invoke-DuRPU1oC.mjs';
22
- import './chunks/resolveCliOptions-BbfouWSK.mjs';
22
+ import './chunks/resolveCliOptions-C0Jmb-6I.mjs';
@@ -378,7 +378,7 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
378
378
  * Create a namespaced child command with argument inference.
379
379
  * Mirrors Commander generics so downstream chaining remains fully typed.
380
380
  */
381
- ns<Usage extends string>(name: Usage): GetDotenvCliPublic<TOptions, [
381
+ ns<Usage extends string>(name: Usage, opts?: NsOptions): GetDotenvCliPublic<TOptions, [
382
382
  ...TArgs,
383
383
  ...InferCommandArguments<Usage>
384
384
  ], {}, TOpts & TGlobal>;
@@ -419,6 +419,23 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
419
419
  /** {@inheritDoc} */
420
420
  createDynamicOption<Usage extends string, TValue = unknown>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser: (value: string, previous?: TValue) => TValue, defaultValue?: TValue): Option<Usage>;
421
421
  }
422
+ /**
423
+ * Options for the `ns()` subcommand factory, forwarded to Commander's
424
+ * `command(name, opts)` second argument.
425
+ *
426
+ * @public
427
+ */
428
+ interface NsOptions {
429
+ /**
430
+ * When true, this subcommand becomes the default: Commander routes
431
+ * unrecognized positional tokens to it when no explicit subcommand matches.
432
+ */
433
+ isDefault?: boolean;
434
+ /**
435
+ * When true, the subcommand is hidden from help output.
436
+ */
437
+ hidden?: boolean;
438
+ }
422
439
  /**
423
440
  * Optional overrides for plugin composition.
424
441
  *
@@ -448,6 +465,11 @@ interface PluginChildEntry<TOptions extends GetDotenvOptions = GetDotenvOptions,
448
465
  interface GetDotenvCliPlugin<TOptions extends GetDotenvOptions = GetDotenvOptions, TArgs extends unknown[] = [], TOpts extends OptionValues = {}, TGlobal extends OptionValues = {}> {
449
466
  /** Namespace (required): the command name where this plugin is mounted. */
450
467
  ns: string;
468
+ /**
469
+ * Options forwarded to the host's `ns()` call when creating the mount
470
+ * for this plugin (e.g. `{ isDefault: true }`).
471
+ */
472
+ nsOptions?: NsOptions;
451
473
  /**
452
474
  * Setup phase: register commands and wiring on the provided mount.
453
475
  * Runs parent → children (pre-order). Return nothing (void).
@@ -1,4 +1,4 @@
1
- import { r as readMergedOptions, d as definePlugin } from './chunks/readMergedOptions-BT1C87_u.mjs';
1
+ import { r as readMergedOptions, d as definePlugin } from './chunks/readMergedOptions-Bjl6rWXd.mjs';
2
2
  import 'execa';
3
3
  import 'radash';
4
4
  import 'node:buffer';
package/dist/plugins.d.ts CHANGED
@@ -378,7 +378,7 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
378
378
  * Create a namespaced child command with argument inference.
379
379
  * Mirrors Commander generics so downstream chaining remains fully typed.
380
380
  */
381
- ns<Usage extends string>(name: Usage): GetDotenvCliPublic<TOptions, [
381
+ ns<Usage extends string>(name: Usage, opts?: NsOptions): GetDotenvCliPublic<TOptions, [
382
382
  ...TArgs,
383
383
  ...InferCommandArguments<Usage>
384
384
  ], {}, TOpts & TGlobal>;
@@ -419,6 +419,23 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
419
419
  /** {@inheritDoc} */
420
420
  createDynamicOption<Usage extends string, TValue = unknown>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser: (value: string, previous?: TValue) => TValue, defaultValue?: TValue): Option<Usage>;
421
421
  }
422
+ /**
423
+ * Options for the `ns()` subcommand factory, forwarded to Commander's
424
+ * `command(name, opts)` second argument.
425
+ *
426
+ * @public
427
+ */
428
+ interface NsOptions {
429
+ /**
430
+ * When true, this subcommand becomes the default: Commander routes
431
+ * unrecognized positional tokens to it when no explicit subcommand matches.
432
+ */
433
+ isDefault?: boolean;
434
+ /**
435
+ * When true, the subcommand is hidden from help output.
436
+ */
437
+ hidden?: boolean;
438
+ }
422
439
  /**
423
440
  * Optional overrides for plugin composition.
424
441
  *
@@ -448,6 +465,11 @@ interface PluginChildEntry<TOptions extends GetDotenvOptions = GetDotenvOptions,
448
465
  interface GetDotenvCliPlugin<TOptions extends GetDotenvOptions = GetDotenvOptions, TArgs extends unknown[] = [], TOpts extends OptionValues = {}, TGlobal extends OptionValues = {}> {
449
466
  /** Namespace (required): the command name where this plugin is mounted. */
450
467
  ns: string;
468
+ /**
469
+ * Options forwarded to the host's `ns()` call when creating the mount
470
+ * for this plugin (e.g. `{ isDefault: true }`).
471
+ */
472
+ nsOptions?: NsOptions;
451
473
  /**
452
474
  * Setup phase: register commands and wiring on the provided mount.
453
475
  * Runs parent → children (pre-order). Return nothing (void).
package/dist/plugins.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  export { awsPlugin, getAwsRegion } from './plugins-aws.mjs';
2
- export { a as awsWhoamiPlugin } from './chunks/index-CNXekCQC.mjs';
2
+ export { a as awsWhoamiPlugin } from './chunks/index-DREvD42I.mjs';
3
3
  export { batchPlugin } from './plugins-batch.mjs';
4
- export { c as cmdPlugin } from './chunks/index-DnG3N6yj.mjs';
4
+ export { c as cmdPlugin } from './chunks/index-BAcAtESJ.mjs';
5
5
  export { initPlugin } from './plugins-init.mjs';
6
- import './chunks/readMergedOptions-BT1C87_u.mjs';
6
+ import './chunks/readMergedOptions-Bjl6rWXd.mjs';
7
7
  import 'zod';
8
8
  import '@commander-js/extra-typings';
9
9
  import './chunks/readDotenvCascade-CfFPgLCp.mjs';
@@ -22,11 +22,10 @@ import 'package-directory';
22
22
  import 'yaml';
23
23
  import 'execa';
24
24
  import './chunks/spawnEnv-DvisqPiU.mjs';
25
- import '@aws-sdk/client-sts';
26
25
  import './chunks/invoke-DuRPU1oC.mjs';
27
26
  import 'globby';
28
27
  import 'os';
29
- import './chunks/resolveCliOptions-BbfouWSK.mjs';
28
+ import './chunks/resolveCliOptions-C0Jmb-6I.mjs';
30
29
  import 'node:process';
31
30
  import 'readline/promises';
32
31
  import 'node:url';
package/package.json CHANGED
@@ -221,5 +221,5 @@
221
221
  },
222
222
  "type": "module",
223
223
  "types": "dist/index.d.ts",
224
- "version": "7.0.8"
224
+ "version": "7.0.10"
225
225
  }