gunshi 0.27.0 → 0.27.4

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/lib/bone.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ValidationErrorsDecorator, C as GunshiParams, D as Prettify, E as NormalizeToGunshiParams, O as RendererDecorator, S as ExtractExtensions, T as LazyCommand, _ as Commandable, a as Awaitable, b as ExtractArgExplicitlyProvided, c as CommandCallMode, d as CommandContextExtension, f as CommandDecorator, g as CommandRunner, h as CommandLoader, i as Args, k as RenderingOptions, l as CommandContext, m as CommandExamplesFetcher, n as ArgToken, o as CliOptions, p as CommandEnvironment, r as ArgValues, s as Command, t as ArgSchema, u as CommandContextCore, v as DefaultGunshiParams, w as GunshiParamsConstraint, x as ExtractArgs, y as ExtendContext } from "./types-DIfsK4mZ.js";
1
+ import { A as SubCommandable, C as GunshiParams, D as Prettify, E as NormalizeToGunshiParams, O as RendererDecorator, S as ExtractExtensions, T as LazyCommand, _ as Commandable, a as Awaitable, b as ExtractArgExplicitlyProvided, c as CommandCallMode, d as CommandContextExtension, f as CommandDecorator, g as CommandRunner, h as CommandLoader, i as Args, j as ValidationErrorsDecorator, k as RenderingOptions, l as CommandContext, m as CommandExamplesFetcher, n as ArgToken, o as CliOptions, p as CommandEnvironment, r as ArgValues, s as Command, t as ArgSchema, u as CommandContextCore, v as DefaultGunshiParams, w as GunshiParamsConstraint, x as ExtractArgs, y as ExtendContext } from "./types-B2vSsTAs.js";
2
2
 
3
3
  //#region src/cli/bone.d.ts
4
4
  /**
@@ -46,4 +46,4 @@ declare function cli<E extends ExtendContext = ExtendContext, G extends GunshiPa
46
46
  */
47
47
  declare function cli<G extends GunshiParams = DefaultGunshiParams>(args: string[], entry: Command<G> | CommandRunner<G> | LazyCommand<G>, options?: CliOptions<G>): Promise<string | undefined>;
48
48
  //#endregion
49
- export { ArgSchema, ArgToken, ArgValues, Args, Awaitable, CliOptions, Command, CommandCallMode, CommandContext, CommandContextCore, CommandContextExtension, CommandDecorator, CommandEnvironment, CommandExamplesFetcher, CommandLoader, CommandRunner, Commandable, DefaultGunshiParams, ExtendContext, ExtractArgExplicitlyProvided, ExtractArgs, ExtractExtensions, GunshiParams, GunshiParamsConstraint, LazyCommand, NormalizeToGunshiParams, Prettify, RendererDecorator, RenderingOptions, ValidationErrorsDecorator, cli };
49
+ export { ArgSchema, ArgToken, ArgValues, Args, Awaitable, CliOptions, Command, CommandCallMode, CommandContext, CommandContextCore, CommandContextExtension, CommandDecorator, CommandEnvironment, CommandExamplesFetcher, CommandLoader, CommandRunner, Commandable, DefaultGunshiParams, ExtendContext, ExtractArgExplicitlyProvided, ExtractArgs, ExtractExtensions, GunshiParams, GunshiParamsConstraint, LazyCommand, NormalizeToGunshiParams, Prettify, RendererDecorator, RenderingOptions, SubCommandable, ValidationErrorsDecorator, cli };
@@ -1,4 +1,4 @@
1
- import { C as GunshiParams, T as LazyCommand, b as ExtractArgExplicitlyProvided, c as CommandCallMode, d as CommandContextExtension, i as Args, l as CommandContext, n as ArgToken, o as CliOptions, r as ArgValues, s as Command, v as DefaultGunshiParams, w as GunshiParamsConstraint, x as ExtractArgs, y as ExtendContext } from "./types-DIfsK4mZ.js";
1
+ import { C as GunshiParams, T as LazyCommand, b as ExtractArgExplicitlyProvided, c as CommandCallMode, d as CommandContextExtension, i as Args, l as CommandContext, n as ArgToken, o as CliOptions, r as ArgValues, s as Command, v as DefaultGunshiParams, w as GunshiParamsConstraint, x as ExtractArgs, y as ExtendContext } from "./types-B2vSsTAs.js";
2
2
 
3
3
  //#region src/context.d.ts
4
4
 
package/lib/context.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import "./types-DIfsK4mZ.js";
2
- import { n as ExtractExtensions, r as createCommandContext, t as CommandContextParams } from "./context-CMrZI9J4.js";
1
+ import "./types-B2vSsTAs.js";
2
+ import { n as ExtractExtensions, r as createCommandContext, t as CommandContextParams } from "./context-c3TYozQR.js";
3
3
  export { CommandContextParams, ExtractExtensions, createCommandContext };
@@ -1,4 +1,4 @@
1
- import { C as GunshiParams, D as Prettify, S as ExtractExtensions, T as LazyCommand, h as CommandLoader, i as Args, s as Command, v as DefaultGunshiParams, w as GunshiParamsConstraint, x as ExtractArgs, y as ExtendContext } from "./types-DIfsK4mZ.js";
1
+ import { C as GunshiParams, D as Prettify, S as ExtractExtensions, T as LazyCommand, h as CommandLoader, i as Args, s as Command, v as DefaultGunshiParams, w as GunshiParamsConstraint, x as ExtractArgs, y as ExtendContext } from "./types-B2vSsTAs.js";
2
2
 
3
3
  //#region src/definition.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { C as GunshiParams, T as LazyCommand, g as CommandRunner, h as CommandLoader, i as Args, r as ArgValues, s as Command, t as ArgSchema, v as DefaultGunshiParams, y as ExtendContext } from "./types-DIfsK4mZ.js";
2
- import { r as createCommandContext, t as CommandContextParams } from "./context-CMrZI9J4.js";
3
- import { i as lazyWithTypes, n as defineWithTypes, r as lazy, t as define } from "./definition-BWGhvqMF.js";
1
+ import { C as GunshiParams, T as LazyCommand, g as CommandRunner, h as CommandLoader, i as Args, r as ArgValues, s as Command, t as ArgSchema, v as DefaultGunshiParams, y as ExtendContext } from "./types-B2vSsTAs.js";
2
+ import { r as createCommandContext, t as CommandContextParams } from "./context-c3TYozQR.js";
3
+ import { i as lazyWithTypes, n as defineWithTypes, r as lazy, t as define } from "./definition-Bhhx1dzQ.js";
4
4
  export { ArgSchema, ArgValues, Args, Command, CommandContextParams, CommandLoader, CommandRunner, DefaultGunshiParams, ExtendContext, GunshiParams, LazyCommand, createCommandContext, define, defineWithTypes, lazy, lazyWithTypes };
@@ -1,4 +1,4 @@
1
- import { T as LazyCommand, o as CliOptions, s as Command, v as DefaultGunshiParams, w as GunshiParamsConstraint } from "./types-DIfsK4mZ.js";
1
+ import { T as LazyCommand, o as CliOptions, s as Command, v as DefaultGunshiParams, w as GunshiParamsConstraint } from "./types-B2vSsTAs.js";
2
2
 
3
3
  //#region src/generator.d.ts
4
4
 
@@ -1,4 +1,4 @@
1
- import { C as GunshiParams, T as LazyCommand, g as CommandRunner, i as Args$1, o as CliOptions, s as Command, v as DefaultGunshiParams, w as GunshiParamsConstraint, y as ExtendContext } from "./types-DIfsK4mZ.js";
1
+ import { A as SubCommandable, C as GunshiParams, T as LazyCommand, g as CommandRunner, i as Args$1, o as CliOptions, s as Command, v as DefaultGunshiParams, w as GunshiParamsConstraint, y as ExtendContext } from "./types-B2vSsTAs.js";
2
2
  import { parseArgs as parseArgs$1, resolveArgs as resolveArgs$1 } from "args-tokens";
3
3
 
4
4
  //#region ../plugin-i18n/src/types.d.ts
@@ -104,6 +104,18 @@ declare class DefaultTranslation implements TranslationAdapter {
104
104
  }
105
105
  //#endregion
106
106
  //#region src/cli/builtin.d.ts
107
+ /**
108
+ * Run the command.
109
+ *
110
+ * This overload accepts any command-like object using a loose structural type.
111
+ * It bypasses TypeScript contravariance issues with callback properties.
112
+ *
113
+ * @param args - Command line arguments
114
+ * @param entry - A command-like object (command, command runner, or lazy command)
115
+ * @param options - A {@link CliOptions | CLI options}
116
+ * @returns A rendered usage or undefined. if you will use {@linkcode CliOptions.usageSilent} option, it will return rendered usage string.
117
+ */
118
+ declare function cli(args: string[], entry: SubCommandable, options?: CliOptions): Promise<string | undefined>;
107
119
  /**
108
120
  * Run the command.
109
121
  *
package/lib/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { A as ValidationErrorsDecorator, B as PluginContext, C as GunshiParams, D as Prettify, E as NormalizeToGunshiParams, F as PluginFunction, I as PluginOptions, L as PluginWithExtension, M as Plugin, N as PluginDependency, O as RendererDecorator, P as PluginExtension, R as PluginWithoutExtension, S as ExtractExtensions, T as LazyCommand, _ as Commandable, a as Awaitable, b as ExtractArgExplicitlyProvided, c as CommandCallMode, d as CommandContextExtension, f as CommandDecorator, g as CommandRunner, h as CommandLoader, i as Args, j as OnPluginExtension, k as RenderingOptions, l as CommandContext, m as CommandExamplesFetcher, n as ArgToken, o as CliOptions, p as CommandEnvironment, r as ArgValues, s as Command, t as ArgSchema, u as CommandContextCore, v as DefaultGunshiParams, w as GunshiParamsConstraint, x as ExtractArgs, y as ExtendContext, z as plugin } from "./types-DIfsK4mZ.js";
2
- import { r as createCommandContext, t as CommandContextParams } from "./context-CMrZI9J4.js";
3
- import { i as lazyWithTypes, n as defineWithTypes, r as lazy, t as define } from "./definition-BWGhvqMF.js";
4
- import { t as ANONYMOUS_COMMAND_NAME } from "./plugin-gv9ogu9N.js";
5
- import { i as DefaultTranslation, n as resolveArgs, r as cli, t as parseArgs } from "./index-BDRk6VtJ.js";
6
- import "./utils-BVBpgaJv.js";
7
- export { ANONYMOUS_COMMAND_NAME, ArgSchema, ArgToken, ArgValues, Args, Awaitable, CliOptions, Command, CommandCallMode, CommandContext, CommandContextCore, CommandContextExtension, CommandContextParams, CommandDecorator, CommandEnvironment, CommandExamplesFetcher, CommandLoader, CommandRunner, Commandable, DefaultGunshiParams, DefaultTranslation, ExtendContext, ExtractArgExplicitlyProvided, ExtractArgs, ExtractExtensions, GunshiParams, GunshiParamsConstraint, LazyCommand, NormalizeToGunshiParams, OnPluginExtension, Plugin, PluginContext, PluginDependency, PluginExtension, PluginFunction, PluginOptions, PluginWithExtension, PluginWithoutExtension, Prettify, RendererDecorator, RenderingOptions, ValidationErrorsDecorator, cli, createCommandContext, define, defineWithTypes, lazy, lazyWithTypes, parseArgs, plugin, resolveArgs };
1
+ import { A as SubCommandable, B as plugin, C as GunshiParams, D as Prettify, E as NormalizeToGunshiParams, F as PluginExtension, I as PluginFunction, L as PluginOptions, M as OnPluginExtension, N as Plugin, O as RendererDecorator, P as PluginDependency, R as PluginWithExtension, S as ExtractExtensions, T as LazyCommand, V as PluginContext, _ as Commandable, a as Awaitable, b as ExtractArgExplicitlyProvided, c as CommandCallMode, d as CommandContextExtension, f as CommandDecorator, g as CommandRunner, h as CommandLoader, i as Args, j as ValidationErrorsDecorator, k as RenderingOptions, l as CommandContext, m as CommandExamplesFetcher, n as ArgToken, o as CliOptions, p as CommandEnvironment, r as ArgValues, s as Command, t as ArgSchema, u as CommandContextCore, v as DefaultGunshiParams, w as GunshiParamsConstraint, x as ExtractArgs, y as ExtendContext, z as PluginWithoutExtension } from "./types-B2vSsTAs.js";
2
+ import { r as createCommandContext, t as CommandContextParams } from "./context-c3TYozQR.js";
3
+ import { i as lazyWithTypes, n as defineWithTypes, r as lazy, t as define } from "./definition-Bhhx1dzQ.js";
4
+ import { t as ANONYMOUS_COMMAND_NAME } from "./plugin-BCYPEeKH.js";
5
+ import { i as DefaultTranslation, n as resolveArgs, r as cli, t as parseArgs } from "./index-D_NQFhLl.js";
6
+ import "./utils-_mX9Q7d9.js";
7
+ export { ANONYMOUS_COMMAND_NAME, ArgSchema, ArgToken, ArgValues, Args, Awaitable, CliOptions, Command, CommandCallMode, CommandContext, CommandContextCore, CommandContextExtension, CommandContextParams, CommandDecorator, CommandEnvironment, CommandExamplesFetcher, CommandLoader, CommandRunner, Commandable, DefaultGunshiParams, DefaultTranslation, ExtendContext, ExtractArgExplicitlyProvided, ExtractArgs, ExtractExtensions, GunshiParams, GunshiParamsConstraint, LazyCommand, NormalizeToGunshiParams, OnPluginExtension, Plugin, PluginContext, PluginDependency, PluginExtension, PluginFunction, PluginOptions, PluginWithExtension, PluginWithoutExtension, Prettify, RendererDecorator, RenderingOptions, SubCommandable, ValidationErrorsDecorator, cli, createCommandContext, define, defineWithTypes, lazy, lazyWithTypes, parseArgs, plugin, resolveArgs };
package/lib/index.js CHANGED
@@ -66,7 +66,7 @@ var DefaultTranslation = class {
66
66
  if (message === void 0 && locale !== this.#options.fallbackLocale) message = this.getMessage(this.#options.fallbackLocale, key);
67
67
  if (message === void 0) return;
68
68
  return message.replaceAll(/\{\$(\w+)\}/g, (_, name) => {
69
- return values[name] == null ? "" : values[name].toString();
69
+ return values[name] == null ? "" : values[name];
70
70
  });
71
71
  }
72
72
  };
@@ -1,4 +1,4 @@
1
- import { o as CliOptions, v as DefaultGunshiParams } from "./types-DIfsK4mZ.js";
1
+ import { o as CliOptions, v as DefaultGunshiParams } from "./types-B2vSsTAs.js";
2
2
 
3
3
  //#region src/constants.d.ts
4
4
  /**
package/lib/plugin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ValidationErrorsDecorator, B as PluginContext, C as GunshiParams, D as Prettify, E as NormalizeToGunshiParams, F as PluginFunction, I as PluginOptions, L as PluginWithExtension, M as Plugin, N as PluginDependency, O as RendererDecorator, P as PluginExtension, R as PluginWithoutExtension, S as ExtractExtensions, T as LazyCommand, a as Awaitable, d as CommandContextExtension, f as CommandDecorator, g as CommandRunner, i as Args, j as OnPluginExtension, l as CommandContext, m as CommandExamplesFetcher, n as ArgToken, r as ArgValues, s as Command, t as ArgSchema, u as CommandContextCore, v as DefaultGunshiParams, w as GunshiParamsConstraint, x as ExtractArgs, y as ExtendContext, z as plugin } from "./types-DIfsK4mZ.js";
2
- import { r as createCommandContext, t as CommandContextParams } from "./context-CMrZI9J4.js";
3
- import { n as CLI_OPTIONS_DEFAULT, t as ANONYMOUS_COMMAND_NAME } from "./plugin-gv9ogu9N.js";
1
+ import { B as plugin, C as GunshiParams, D as Prettify, E as NormalizeToGunshiParams, F as PluginExtension, I as PluginFunction, L as PluginOptions, M as OnPluginExtension, N as Plugin, O as RendererDecorator, P as PluginDependency, R as PluginWithExtension, S as ExtractExtensions, T as LazyCommand, V as PluginContext, a as Awaitable, d as CommandContextExtension, f as CommandDecorator, g as CommandRunner, i as Args, j as ValidationErrorsDecorator, l as CommandContext, m as CommandExamplesFetcher, n as ArgToken, r as ArgValues, s as Command, t as ArgSchema, u as CommandContextCore, v as DefaultGunshiParams, w as GunshiParamsConstraint, x as ExtractArgs, y as ExtendContext, z as PluginWithoutExtension } from "./types-B2vSsTAs.js";
2
+ import { r as createCommandContext, t as CommandContextParams } from "./context-c3TYozQR.js";
3
+ import { n as CLI_OPTIONS_DEFAULT, t as ANONYMOUS_COMMAND_NAME } from "./plugin-BCYPEeKH.js";
4
4
  export { ANONYMOUS_COMMAND_NAME, ArgSchema, ArgToken, ArgValues, Args, Awaitable, CLI_OPTIONS_DEFAULT, Command, CommandContext, CommandContextCore, CommandContextExtension, CommandContextParams, CommandDecorator, CommandExamplesFetcher, CommandRunner, DefaultGunshiParams, ExtendContext, ExtractArgs, ExtractExtensions, GunshiParams, GunshiParamsConstraint, LazyCommand, NormalizeToGunshiParams, OnPluginExtension, Plugin, PluginContext, PluginDependency, PluginExtension, PluginFunction, PluginOptions, PluginWithExtension, PluginWithoutExtension, Prettify, RendererDecorator, ValidationErrorsDecorator, createCommandContext, plugin };
package/lib/renderer.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { C as GunshiParams, l as CommandContext, v as DefaultGunshiParams } from "./types-DIfsK4mZ.js";
2
- import "./context-CMrZI9J4.js";
3
- import "./definition-BWGhvqMF.js";
4
- import "./plugin-gv9ogu9N.js";
5
- import "./index-BDRk6VtJ.js";
6
- import "./utils-BVBpgaJv.js";
1
+ import { C as GunshiParams, l as CommandContext, v as DefaultGunshiParams } from "./types-B2vSsTAs.js";
2
+ import "./context-c3TYozQR.js";
3
+ import "./definition-Bhhx1dzQ.js";
4
+ import "./plugin-BCYPEeKH.js";
5
+ import "./index-D_NQFhLl.js";
6
+ import "./utils-_mX9Q7d9.js";
7
7
 
8
8
  //#region ../plugin-renderer/src/header.d.ts
9
9
  /**
@@ -93,18 +93,18 @@ interface PluginContext<G extends GunshiParamsConstraint = DefaultGunshiParams>
93
93
  }
94
94
  //#endregion
95
95
  //#region src/plugin/core.d.ts
96
- type ProcessDependency<D, A$1 extends ExtendContext> = D extends string ? D extends keyof A$1 ? { [K in D]: A$1[K] } : {} : D extends {
96
+ type ProcessDependency<D, A extends ExtendContext> = D extends string ? D extends keyof A ? { [K in D]: A[K] } : {} : D extends {
97
97
  id: infer ID;
98
98
  optional?: any;
99
- } ? ID extends string ? ID extends keyof A$1 ? D extends {
99
+ } ? ID extends string ? ID extends keyof A ? D extends {
100
100
  optional: true;
101
- } ? { [K in ID]: A$1[K] | undefined } : { [K in ID]: A$1[K] } : {} : never : never;
101
+ } ? { [K in ID]: A[K] | undefined } : { [K in ID]: A[K] } : {} : never : never;
102
102
  /**
103
103
  * Helper type to infer dependency extensions with optional support
104
104
  *
105
105
  * @internal
106
106
  */
107
- type InferDependencyExtensions<D extends ReadonlyArray<PluginDependency | string>, A$1 extends ExtendContext> = D extends readonly [] ? {} : D extends readonly [infer First, ...infer Rest] ? ProcessDependency<First, A$1> & (Rest extends ReadonlyArray<PluginDependency | string> ? InferDependencyExtensions<Rest, A$1> : {}) : {};
107
+ type InferDependencyExtensions<D extends ReadonlyArray<PluginDependency | string>, A extends ExtendContext> = D extends readonly [] ? {} : D extends readonly [infer First, ...infer Rest] ? ProcessDependency<First, A> & (Rest extends ReadonlyArray<PluginDependency | string> ? InferDependencyExtensions<Rest, A> : {}) : {};
108
108
  /**
109
109
  * Plugin dependency definition
110
110
  *
@@ -210,11 +210,11 @@ ResolvedDepExt extends GunshiParams = GunshiParams<{
210
210
  *
211
211
  * @since v0.27.0
212
212
  */
213
- type Plugin<E$1 extends GunshiParams['extensions'] = DefaultGunshiParams['extensions']> = PluginFunction & {
213
+ type Plugin<E extends GunshiParams['extensions'] = DefaultGunshiParams['extensions']> = PluginFunction & {
214
214
  id: string;
215
215
  name?: string;
216
216
  dependencies?: (PluginDependency | string)[];
217
- extension?: CommandContextExtension<E$1>;
217
+ extension?: CommandContextExtension<E>;
218
218
  };
219
219
  /**
220
220
  * Plugin return type with extension, which includes the plugin ID, name, dependencies, and extension.
@@ -223,7 +223,7 @@ type Plugin<E$1 extends GunshiParams['extensions'] = DefaultGunshiParams['extens
223
223
  *
224
224
  * @typeParam E - A type extending {@link GunshiParams} to specify the shape of {@linkcode CommandContext}'s extensions.
225
225
  */
226
- interface PluginWithExtension<E$1 extends GunshiParams['extensions'] = DefaultGunshiParams['extensions']> extends Plugin<E$1> {
226
+ interface PluginWithExtension<E extends GunshiParams['extensions'] = DefaultGunshiParams['extensions']> extends Plugin<E> {
227
227
  /**
228
228
  * Plugin identifier
229
229
  */
@@ -239,7 +239,7 @@ interface PluginWithExtension<E$1 extends GunshiParams['extensions'] = DefaultGu
239
239
  /**
240
240
  * Plugin extension
241
241
  */
242
- extension: CommandContextExtension<E$1>;
242
+ extension: CommandContextExtension<E>;
243
243
  }
244
244
  /**
245
245
  * Plugin return type without extension, which includes the plugin ID, name, and dependencies, but no extension.
@@ -248,7 +248,7 @@ interface PluginWithExtension<E$1 extends GunshiParams['extensions'] = DefaultGu
248
248
  *
249
249
  * @typeParam E - A type extending {@link GunshiParams} to specify the shape of {@linkcode CommandContext}'s extensions.
250
250
  */
251
- interface PluginWithoutExtension<E$1 extends GunshiParams['extensions'] = DefaultGunshiParams['extensions']> extends Plugin<E$1> {
251
+ interface PluginWithoutExtension<E extends GunshiParams['extensions'] = DefaultGunshiParams['extensions']> extends Plugin<E> {
252
252
  /**
253
253
  * Plugin identifier
254
254
  */
@@ -572,7 +572,7 @@ interface CliOptions<G extends GunshiParamsConstraint = DefaultGunshiParams> {
572
572
  /**
573
573
  * Sub commands.
574
574
  */
575
- subCommands?: Record<string, Command<any> | LazyCommand<any>> | Map<string, Command<any> | LazyCommand<any>>;
575
+ subCommands?: Record<string, SubCommandable> | Map<string, SubCommandable>;
576
576
  /**
577
577
  * Left margin of the command output.
578
578
  */
@@ -759,7 +759,7 @@ type CommandContextCore<G extends GunshiParamsConstraint = DefaultGunshiParams>
759
759
  *
760
760
  * @since v0.27.0
761
761
  */
762
- interface CommandContextExtension<E$1 extends GunshiParams['extensions'] = DefaultGunshiParams['extensions']> {
762
+ interface CommandContextExtension<E extends GunshiParams['extensions'] = DefaultGunshiParams['extensions']> {
763
763
  /**
764
764
  * Plugin identifier
765
765
  */
@@ -767,7 +767,7 @@ interface CommandContextExtension<E$1 extends GunshiParams['extensions'] = Defau
767
767
  /**
768
768
  * Plugin extension factory
769
769
  */
770
- readonly factory: (ctx: CommandContextCore, cmd: Command) => Awaitable<E$1>;
770
+ readonly factory: (ctx: CommandContextCore, cmd: Command) => Awaitable<E>;
771
771
  /**
772
772
  * Plugin extension factory after hook
773
773
  */
@@ -886,6 +886,60 @@ type LazyCommand<G extends GunshiParamsConstraint = DefaultGunshiParams, D exten
886
886
  * @typeParam G - A type extending {@linkcode GunshiParams} to specify the shape of command.
887
887
  */
888
888
  type Commandable<G extends GunshiParamsConstraint = DefaultGunshiParams> = Command<G> | LazyCommand<G, {}>;
889
+ /**
890
+ * Sub-command entry type for use in subCommands.
891
+ *
892
+ * This type uses a loose structural match to bypass TypeScript's contravariance issues
893
+ * with function parameters, allowing any Command or LazyCommand to be used as a sub-command.
894
+ *
895
+ * @since v0.27.1
896
+ */
897
+ interface SubCommandable {
898
+ /**
899
+ * see {@link Command.name}
900
+ */
901
+ name?: string;
902
+ /**
903
+ * see {@link Command.description}
904
+ */
905
+ description?: string;
906
+ /**
907
+ * see {@link Command.args}
908
+ */
909
+ args?: Args | Record<string, any>;
910
+ /**
911
+ * see {@link Command.examples}
912
+ */
913
+ examples?: string | ((...args: any[]) => any);
914
+ /**
915
+ * see {@link Command.run}
916
+ */
917
+ run?: (...args: any[]) => any;
918
+ /**
919
+ * see {@link Command.toKebab}
920
+ */
921
+ toKebab?: boolean;
922
+ /**
923
+ * see {@link Command.internal}
924
+ */
925
+ internal?: boolean;
926
+ /**
927
+ * see {@link Command.entry}
928
+ */
929
+ entry?: boolean;
930
+ /**
931
+ * see {@link Command.rendering}
932
+ */
933
+ rendering?: any;
934
+ /**
935
+ * see {@link LazyCommand.commandName}
936
+ */
937
+ commandName?: string;
938
+ /**
939
+ * Index signature to allow additional properties
940
+ */
941
+ [key: string]: any;
942
+ }
889
943
  /**
890
944
  * Command examples fetcher.
891
945
  *
@@ -958,4 +1012,4 @@ type RendererDecorator<T, G extends GunshiParamsConstraint = DefaultGunshiParams
958
1012
  */
959
1013
  type ValidationErrorsDecorator<G extends GunshiParamsConstraint = DefaultGunshiParams> = (baseRenderer: (ctx: Readonly<CommandContext<G>>, error: AggregateError) => Promise<string>, ctx: Readonly<CommandContext<G>>, error: AggregateError) => Promise<string>;
960
1014
  //#endregion
961
- export { ValidationErrorsDecorator as A, PluginContext as B, GunshiParams as C, Prettify as D, NormalizeToGunshiParams as E, PluginFunction as F, PluginOptions as I, PluginWithExtension as L, Plugin as M, PluginDependency as N, RendererDecorator as O, PluginExtension as P, PluginWithoutExtension as R, ExtractExtensions as S, LazyCommand as T, Commandable as _, Awaitable as a, ExtractArgExplicitlyProvided as b, CommandCallMode as c, CommandContextExtension as d, CommandDecorator as f, CommandRunner as g, CommandLoader as h, Args$1 as i, OnPluginExtension as j, RenderingOptions as k, CommandContext as l, CommandExamplesFetcher as m, ArgToken$1 as n, CliOptions as o, CommandEnvironment as p, ArgValues$1 as r, Command as s, ArgSchema$1 as t, CommandContextCore as u, DefaultGunshiParams as v, GunshiParamsConstraint as w, ExtractArgs as x, ExtendContext as y, plugin as z };
1015
+ export { SubCommandable as A, plugin as B, GunshiParams as C, Prettify as D, NormalizeToGunshiParams as E, PluginExtension as F, PluginFunction as I, PluginOptions as L, OnPluginExtension as M, Plugin as N, RendererDecorator as O, PluginDependency as P, PluginWithExtension as R, ExtractExtensions as S, LazyCommand as T, PluginContext as V, Commandable as _, Awaitable as a, ExtractArgExplicitlyProvided as b, CommandCallMode as c, CommandContextExtension as d, CommandDecorator as f, CommandRunner as g, CommandLoader as h, Args$1 as i, ValidationErrorsDecorator as j, RenderingOptions as k, CommandContext as l, CommandExamplesFetcher as m, ArgToken$1 as n, CliOptions as o, CommandEnvironment as p, ArgValues$1 as r, Command as s, ArgSchema$1 as t, CommandContextCore as u, DefaultGunshiParams as v, GunshiParamsConstraint as w, ExtractArgs as x, ExtendContext as y, PluginWithoutExtension as z };
@@ -1,4 +1,4 @@
1
- import { T as LazyCommand, _ as Commandable, s as Command, v as DefaultGunshiParams, w as GunshiParamsConstraint } from "./types-DIfsK4mZ.js";
1
+ import { T as LazyCommand, _ as Commandable, s as Command, v as DefaultGunshiParams, w as GunshiParamsConstraint } from "./types-B2vSsTAs.js";
2
2
  import { kebabnize } from "args-tokens/utils";
3
3
 
4
4
  //#region src/utils.d.ts
@@ -43,8 +43,6 @@ declare function log(...args: unknown[]): void;
43
43
  * @param ignores - Properties to ignore during freezing
44
44
  * @returns A frozen object
45
45
  */
46
- declare function deepFreeze<T extends Record<string, any>>(
47
- // eslint-disable-line @typescript-eslint/no-explicit-any -- NOTE(kazupon): generic type for deepFreeze
48
- obj: T, ignores?: string[]): Readonly<T>;
46
+ declare function deepFreeze<T extends Record<string, any>>(obj: T, ignores?: string[]): Readonly<T>;
49
47
  //#endregion
50
48
  export { log as a, kebabnize as i, deepFreeze as n, resolveLazyCommand as o, isLazyCommand as r, create as t };
package/lib/utils.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import "./types-DIfsK4mZ.js";
2
- import { a as log, i as kebabnize, n as deepFreeze, o as resolveLazyCommand, r as isLazyCommand, t as create } from "./utils-BVBpgaJv.js";
1
+ import "./types-B2vSsTAs.js";
2
+ import { a as log, i as kebabnize, n as deepFreeze, o as resolveLazyCommand, r as isLazyCommand, t as create } from "./utils-_mX9Q7d9.js";
3
3
  export { create, deepFreeze, isLazyCommand, kebabnize, log, resolveLazyCommand };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gunshi",
3
3
  "description": "Modern javascript command-line library",
4
- "version": "0.27.0",
4
+ "version": "0.27.4",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
7
7
  "email": "kawakazu80@gmail.com"
@@ -104,12 +104,12 @@
104
104
  "jsr-exports-lint": "^0.4.1",
105
105
  "publint": "^0.3.16",
106
106
  "tsdown": "0.15.12",
107
- "zod": "^4.1.13",
108
- "@gunshi/plugin-global": "0.27.0",
109
- "@gunshi/plugin-renderer": "0.27.0",
110
- "@gunshi/resources": "0.27.0",
111
- "@gunshi/plugin-i18n": "0.27.0",
112
- "@gunshi/shared": "0.27.0"
107
+ "zod": "^4.2.1",
108
+ "@gunshi/plugin-i18n": "0.27.4",
109
+ "@gunshi/plugin-global": "0.27.4",
110
+ "@gunshi/shared": "0.27.4",
111
+ "@gunshi/plugin-renderer": "0.27.4",
112
+ "@gunshi/resources": "0.27.4"
113
113
  },
114
114
  "scripts": {
115
115
  "build": "tsdown",