gunshi 0.37.0 → 0.37.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/lib/agent.js CHANGED
@@ -1,5 +1,8 @@
1
1
  //#region ../../node_modules/.pnpm/std-env@4.1.0/node_modules/std-env/dist/index.mjs
2
- const e = globalThis.process?.env || Object.create(null), t = globalThis.process || { env: e }, n = t !== void 0 && t.env && t.env.NODE_ENV || void 0, r = [
2
+ const e = globalThis.process?.env || Object.create(null);
3
+ const t = globalThis.process || { env: e };
4
+ const n = t !== void 0 && t.env && t.env.NODE_ENV || void 0;
5
+ const r = [
3
6
  [`claude`, [`CLAUDECODE`, `CLAUDE_CODE`]],
4
7
  [`replit`, [`REPL_ID`]],
5
8
  [`gemini`, [`GEMINI_CLI`]],
@@ -160,7 +163,14 @@ const S = /^win/i.test(p);
160
163
  !e.NO_COLOR && (e.FORCE_COLOR || (h || S) && e.TERM);
161
164
  const E = (t.versions?.node || ``).replace(/^v/, ``) || null;
162
165
  Number(E?.split(`.`)[0]);
163
- const O = !!t?.versions?.node, k = `Bun` in globalThis, A = `Deno` in globalThis, j = `fastly` in globalThis, M = `Netlify` in globalThis, N = `EdgeRuntime` in globalThis, P = globalThis.navigator?.userAgent === `Cloudflare-Workers`, F = [
166
+ const O = !!t?.versions?.node;
167
+ const k = `Bun` in globalThis;
168
+ const A = `Deno` in globalThis;
169
+ const j = `fastly` in globalThis;
170
+ const M = `Netlify` in globalThis;
171
+ const N = `EdgeRuntime` in globalThis;
172
+ const P = globalThis.navigator?.userAgent === `Cloudflare-Workers`;
173
+ const F = [
164
174
  [M, `netlify`],
165
175
  [N, `edge-light`],
166
176
  [P, `workerd`],
package/lib/bone.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { i as Args, n as ArgSchema, r as ArgValues, u as ArgToken } from "./resolver-CgkhQ6Tt.js";
2
- import { C as NormalizeToGunshiParams, D as SubCommandable, E as RenderingOptions, O as ValidationErrorsDecorator, S as MergeGunshiExtensions, T as RendererDecorator, _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, c as CommandDecorator, d as CommandLoader, f as CommandRunner, g as ExtractArgExplicitlyProvided, h as ExtendContext, i as CommandCallMode, l as CommandEnvironment, m as DefaultGunshiParams, n as CliOptions, o as CommandContextCore, p as Commandable, r as Command, s as CommandContextExtension, t as Awaitable, u as CommandExamplesFetcher, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-CD5eRJFK.js";
1
+ import { i as Args, n as ArgSchema, r as ArgValues, u as ArgToken } from "./resolver-CKLHkuQa.js";
2
+ import { C as NormalizeToGunshiParams, D as SubCommandable, E as RenderingOptions, O as ValidationErrorsDecorator, S as MergeGunshiExtensions, T as RendererDecorator, _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, c as CommandDecorator, d as CommandLoader, f as CommandRunner, g as ExtractArgExplicitlyProvided, h as ExtendContext, i as CommandCallMode, l as CommandEnvironment, m as DefaultGunshiParams, n as CliOptions, o as CommandContextCore, p as Commandable, r as Command, s as CommandContextExtension, t as Awaitable, u as CommandExamplesFetcher, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-8Qh1S2q6.js";
3
3
 
4
4
  //#region src/cli/bone.d.ts
5
5
  /**
package/lib/bone.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as cliCore } from "./core-CbE1I4Jl.js";
1
+ import { t as cliCore } from "./core-vmpEqkpT.js";
2
2
  //#region src/cli/bone.ts
3
3
  /**
4
4
  * @author kazuya kawaguchi (a.k.a. kazupon)
@@ -1,7 +1,7 @@
1
- import { r as hasPriorityValidationError } from "./error-xSnOOdnr.js";
2
- import { t as plugin } from "./plugin-DhJZVIbl.js";
3
- import { a as namespacedId, o as COMMON_ARGS, t as renderer } from "./src-DIz-QFuo.js";
4
- import { t as cliCore } from "./core-CbE1I4Jl.js";
1
+ import { r as hasPriorityValidationError } from "./error-BxeGn0JU.js";
2
+ import { t as plugin } from "./plugin-BY44BdcY.js";
3
+ import { a as namespacedId, o as COMMON_ARGS, t as renderer } from "./src-a-JpaUM5.js";
4
+ import { t as cliCore } from "./core-vmpEqkpT.js";
5
5
  //#region ../plugin-global/src/types.ts
6
6
  /**
7
7
  * @author kazuya kawaguchi (a.k.a. kazupon)
@@ -1,6 +1,6 @@
1
- import { i as Args, n as ArgSchema } from "./resolver-CgkhQ6Tt.js";
1
+ import { i as Args, n as ArgSchema } from "./resolver-CKLHkuQa.js";
2
2
 
3
- //#region ../../node_modules/.pnpm/args-tokens@0.28.0/node_modules/args-tokens/lib/combinators.d.ts
3
+ //#region ../../node_modules/.pnpm/args-tokens@0.28.1/node_modules/args-tokens/lib/combinators.d.ts
4
4
 
5
5
  //#region src/combinators.d.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { t as formatChoices } from "./utils-BKhsrjPW.js";
2
- import { n as ArgsValidationErrorKeys, t as ArgsValidationError } from "./resolver-UFOtObbe.js";
3
- //#region ../../node_modules/.pnpm/args-tokens@0.28.0/node_modules/args-tokens/lib/combinators.js
1
+ import { t as formatChoices } from "./utils-CfOBA5zn.js";
2
+ import { n as ArgsValidationErrorKeys, t as ArgsValidationError } from "./resolver-UjEQwV-U.js";
3
+ //#region ../../node_modules/.pnpm/args-tokens@0.28.1/node_modules/args-tokens/lib/combinators.js
4
4
  /**
5
5
  * Parser combinator factory functions for composable argument schema construction.
6
6
  *
package/lib/context.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { i as Args, r as ArgValues, u as ArgToken } from "./resolver-CgkhQ6Tt.js";
2
- import { _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, g as ExtractArgExplicitlyProvided, h as ExtendContext, i as CommandCallMode, m as DefaultGunshiParams, n as CliOptions, r as Command, s as CommandContextExtension, x as LazyCommand, y as GunshiParams } from "./types-CD5eRJFK.js";
1
+ import { i as Args, r as ArgValues, u as ArgToken } from "./resolver-CKLHkuQa.js";
2
+ import { _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, g as ExtractArgExplicitlyProvided, h as ExtendContext, i as CommandCallMode, m as DefaultGunshiParams, n as CliOptions, r as Command, s as CommandContextExtension, x as LazyCommand, y as GunshiParams } from "./types-8Qh1S2q6.js";
3
3
 
4
4
  //#region src/context.d.ts
5
5
 
@@ -1,8 +1,8 @@
1
1
  import { i as NOOP, r as CLI_OPTIONS_DEFAULT, t as createCommandContext } from "./context-CAPhwgJJ.js";
2
- import { n as kebabnize } from "./utils-BKhsrjPW.js";
2
+ import { n as kebabnize } from "./utils-CfOBA5zn.js";
3
3
  import { create, getCommandSubCommands, isLazyCommand, resolveLazyCommand } from "./utils.js";
4
- import { a as parseArgs, i as resolveArgs, n as ArgsValidationErrorKeys, t as ArgsValidationError } from "./resolver-UFOtObbe.js";
5
- import { n as CommandNotFoundErrorKeys, r as hasPriorityValidationError, t as CommandNotFoundError } from "./error-xSnOOdnr.js";
4
+ import { a as parseArgs, i as resolveArgs, n as ArgsValidationErrorKeys, t as ArgsValidationError } from "./resolver-UjEQwV-U.js";
5
+ import { n as CommandNotFoundErrorKeys, r as hasPriorityValidationError, t as CommandNotFoundError } from "./error-BxeGn0JU.js";
6
6
  //#region src/decorators.ts
7
7
  /**
8
8
  * @author kazuya kawaguchi (a.k.a. kazupon)
@@ -1,5 +1,5 @@
1
- import { i as Args, n as ArgSchema, r as ArgValues } from "./resolver-CgkhQ6Tt.js";
2
- import { C as NormalizeToGunshiParams, _ as ExtractArgs, b as GunshiParamsConstraint, d as CommandLoader, f as CommandRunner, h as ExtendContext, m as DefaultGunshiParams, r as Command, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-CD5eRJFK.js";
1
+ import { i as Args, n as ArgSchema, r as ArgValues } from "./resolver-CKLHkuQa.js";
2
+ import { C as NormalizeToGunshiParams, _ as ExtractArgs, b as GunshiParamsConstraint, d as CommandLoader, f as CommandRunner, h as ExtendContext, m as DefaultGunshiParams, r as Command, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-8Qh1S2q6.js";
3
3
  import { CommandContextParams, createCommandContext } from "./context.js";
4
4
 
5
5
  //#region src/definition.d.ts
@@ -1,5 +1,5 @@
1
- import { n as ArgsValidationErrorKeys, r as isArgsValidationError } from "./resolver-UFOtObbe.js";
2
- //#region ../../node_modules/.pnpm/args-tokens@0.28.0/node_modules/args-tokens/lib/index.js
1
+ import { n as ArgsValidationErrorKeys, r as isArgsValidationError } from "./resolver-UjEQwV-U.js";
2
+ //#region ../../node_modules/.pnpm/args-tokens@0.28.1/node_modules/args-tokens/lib/index.js
3
3
  /**
4
4
  * @author kazuya kawaguchi (a.k.a. kazupon)
5
5
  * @license MIT
@@ -1,4 +1,4 @@
1
- import { m as DefaultGunshiParams, n as CliOptions } from "./types-CD5eRJFK.js";
1
+ import { m as DefaultGunshiParams, n as CliOptions } from "./types-8Qh1S2q6.js";
2
2
 
3
3
  //#region src/constants.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { b as GunshiParamsConstraint, m as DefaultGunshiParams, n as CliOptions, r as Command, x as LazyCommand } from "./types-CD5eRJFK.js";
1
+ import { b as GunshiParamsConstraint, m as DefaultGunshiParams, n as CliOptions, r as Command, x as LazyCommand } from "./types-8Qh1S2q6.js";
2
2
 
3
3
  //#region src/generator.d.ts
4
4
 
package/lib/generator.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { create } from "./utils.js";
2
- import { t as cli } from "./cli-C4_IDXMQ.js";
2
+ import { t as cli } from "./cli-8lpU57Wl.js";
3
3
  //#region src/generator.ts
4
4
  /**
5
5
  * The entry for usage generator.
package/lib/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { a as ArgsValidationError, c as isArgsValidationError, d as parseArgs, i as Args, l as resolveArgs, n as ArgSchema, o as ArgsValidationErrorCode, r as ArgValues, s as ArgsValidationErrorKeys, u as ArgToken } from "./resolver-CgkhQ6Tt.js";
2
- import { A as Plugin, C as NormalizeToGunshiParams, D as SubCommandable, E as RenderingOptions, F as PluginWithExtension, I as PluginWithoutExtension, L as plugin, M as PluginExtension, N as PluginFunction, O as ValidationErrorsDecorator, P as PluginOptions, R as PluginContext, S as MergeGunshiExtensions, T as RendererDecorator, _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, c as CommandDecorator, d as CommandLoader, f as CommandRunner, g as ExtractArgExplicitlyProvided, h as ExtendContext, i as CommandCallMode, j as PluginDependency, k as OnPluginExtension, l as CommandEnvironment, m as DefaultGunshiParams, n as CliOptions, o as CommandContextCore, p as Commandable, r as Command, s as CommandContextExtension, t as Awaitable, u as CommandExamplesFetcher, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-CD5eRJFK.js";
1
+ import { a as ArgsValidationError, c as isArgsValidationError, d as parseArgs, i as Args, l as resolveArgs, n as ArgSchema, o as ArgsValidationErrorCode, r as ArgValues, s as ArgsValidationErrorKeys, u as ArgToken } from "./resolver-CKLHkuQa.js";
2
+ import { A as Plugin, C as NormalizeToGunshiParams, D as SubCommandable, E as RenderingOptions, F as PluginWithExtension, I as PluginWithoutExtension, L as plugin, M as PluginExtension, N as PluginFunction, O as ValidationErrorsDecorator, P as PluginOptions, R as PluginContext, S as MergeGunshiExtensions, T as RendererDecorator, _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, c as CommandDecorator, d as CommandLoader, f as CommandRunner, g as ExtractArgExplicitlyProvided, h as ExtendContext, i as CommandCallMode, j as PluginDependency, k as OnPluginExtension, l as CommandEnvironment, m as DefaultGunshiParams, n as CliOptions, o as CommandContextCore, p as Commandable, r as Command, s as CommandContextExtension, t as Awaitable, u as CommandExamplesFetcher, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-8Qh1S2q6.js";
3
3
  import { CommandContextParams, createCommandContext } from "./context.js";
4
4
  import { define, defineWithTypes, lazy, lazyWithTypes } from "./definition.js";
5
- import { a as hasPriorityValidationError, i as CommandNotFoundErrorOptions, n as CommandNotFoundErrorCode, o as isCommandNotFoundError, r as CommandNotFoundErrorKeys, s as ANONYMOUS_COMMAND_NAME, t as CommandNotFoundError } from "./error-6srXBX7u.js";
5
+ import { a as hasPriorityValidationError, i as CommandNotFoundErrorOptions, n as CommandNotFoundErrorCode, o as isCommandNotFoundError, r as CommandNotFoundErrorKeys, s as ANONYMOUS_COMMAND_NAME, t as CommandNotFoundError } from "./error-DdRv50OI.js";
6
6
 
7
7
  //#region ../plugin-i18n/src/types.d.ts
8
8
  /**
package/lib/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { n as ANONYMOUS_COMMAND_NAME, t as createCommandContext } from "./context-CAPhwgJJ.js";
2
- import { a as parseArgs, i as resolveArgs, n as ArgsValidationErrorKeys, r as isArgsValidationError, t as ArgsValidationError } from "./resolver-UFOtObbe.js";
3
- import { i as isCommandNotFoundError, n as CommandNotFoundErrorKeys, r as hasPriorityValidationError, t as CommandNotFoundError } from "./error-xSnOOdnr.js";
4
- import { t as plugin } from "./plugin-DhJZVIbl.js";
5
- import { a as namespacedId } from "./src-DIz-QFuo.js";
6
- import { t as cli } from "./cli-C4_IDXMQ.js";
2
+ import { a as parseArgs, i as resolveArgs, n as ArgsValidationErrorKeys, r as isArgsValidationError, t as ArgsValidationError } from "./resolver-UjEQwV-U.js";
3
+ import { i as isCommandNotFoundError, n as CommandNotFoundErrorKeys, r as hasPriorityValidationError, t as CommandNotFoundError } from "./error-BxeGn0JU.js";
4
+ import { t as plugin } from "./plugin-BY44BdcY.js";
5
+ import { a as namespacedId } from "./src-a-JpaUM5.js";
6
+ import { t as cli } from "./cli-8lpU57Wl.js";
7
7
  import { define, defineWithTypes, lazy, lazyWithTypes } from "./definition.js";
8
8
  //#region ../plugin-i18n/src/translation.ts
9
9
  /**
@@ -1,4 +1,4 @@
1
- import "./error-xSnOOdnr.js";
1
+ import "./error-BxeGn0JU.js";
2
2
  //#region src/plugin/core.ts
3
3
  /**
4
4
  * @author kazuya kawaguchi (a.k.a. kazupon)
package/lib/plugin.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as ArgsValidationError, c as isArgsValidationError, i as Args, n as ArgSchema, o as ArgsValidationErrorCode, r as ArgValues, s as ArgsValidationErrorKeys, u as ArgToken } from "./resolver-CgkhQ6Tt.js";
2
- import { A as Plugin, C as NormalizeToGunshiParams, F as PluginWithExtension, I as PluginWithoutExtension, L as plugin, M as PluginExtension, N as PluginFunction, O as ValidationErrorsDecorator, P as PluginOptions, R as PluginContext, S as MergeGunshiExtensions, T as RendererDecorator, _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, c as CommandDecorator, f as CommandRunner, h as ExtendContext, j as PluginDependency, k as OnPluginExtension, m as DefaultGunshiParams, o as CommandContextCore, r as Command, s as CommandContextExtension, t as Awaitable, u as CommandExamplesFetcher, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-CD5eRJFK.js";
1
+ import { a as ArgsValidationError, c as isArgsValidationError, i as Args, n as ArgSchema, o as ArgsValidationErrorCode, r as ArgValues, s as ArgsValidationErrorKeys, u as ArgToken } from "./resolver-CKLHkuQa.js";
2
+ import { A as Plugin, C as NormalizeToGunshiParams, F as PluginWithExtension, I as PluginWithoutExtension, L as plugin, M as PluginExtension, N as PluginFunction, O as ValidationErrorsDecorator, P as PluginOptions, R as PluginContext, S as MergeGunshiExtensions, T as RendererDecorator, _ as ExtractArgs, a as CommandContext, b as GunshiParamsConstraint, c as CommandDecorator, f as CommandRunner, h as ExtendContext, j as PluginDependency, k as OnPluginExtension, m as DefaultGunshiParams, o as CommandContextCore, r as Command, s as CommandContextExtension, t as Awaitable, u as CommandExamplesFetcher, v as ExtractExtensions, w as Prettify, x as LazyCommand, y as GunshiParams } from "./types-8Qh1S2q6.js";
3
3
  import { CommandContextParams, createCommandContext } from "./context.js";
4
- import { a as hasPriorityValidationError, c as CLI_OPTIONS_DEFAULT, i as CommandNotFoundErrorOptions, n as CommandNotFoundErrorCode, o as isCommandNotFoundError, r as CommandNotFoundErrorKeys, s as ANONYMOUS_COMMAND_NAME, t as CommandNotFoundError } from "./error-6srXBX7u.js";
4
+ import { a as hasPriorityValidationError, c as CLI_OPTIONS_DEFAULT, i as CommandNotFoundErrorOptions, n as CommandNotFoundErrorCode, o as isCommandNotFoundError, r as CommandNotFoundErrorKeys, s as ANONYMOUS_COMMAND_NAME, t as CommandNotFoundError } from "./error-DdRv50OI.js";
5
5
 
6
6
  //#region src/plugin.d.ts
7
7
  /**
package/lib/plugin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as ANONYMOUS_COMMAND_NAME, r as CLI_OPTIONS_DEFAULT, t as createCommandContext } from "./context-CAPhwgJJ.js";
2
- import { n as ArgsValidationErrorKeys, r as isArgsValidationError, t as ArgsValidationError } from "./resolver-UFOtObbe.js";
3
- import { i as isCommandNotFoundError, n as CommandNotFoundErrorKeys, r as hasPriorityValidationError, t as CommandNotFoundError } from "./error-xSnOOdnr.js";
4
- import { t as plugin } from "./plugin-DhJZVIbl.js";
2
+ import { n as ArgsValidationErrorKeys, r as isArgsValidationError, t as ArgsValidationError } from "./resolver-UjEQwV-U.js";
3
+ import { i as isCommandNotFoundError, n as CommandNotFoundErrorKeys, r as hasPriorityValidationError, t as CommandNotFoundError } from "./error-BxeGn0JU.js";
4
+ import { t as plugin } from "./plugin-BY44BdcY.js";
5
5
  export { ANONYMOUS_COMMAND_NAME, ArgsValidationError, ArgsValidationErrorKeys, CLI_OPTIONS_DEFAULT, CommandNotFoundError, CommandNotFoundErrorKeys, createCommandContext, hasPriorityValidationError, isArgsValidationError, isCommandNotFoundError, plugin };
package/lib/renderer.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as CommandContext, m as DefaultGunshiParams, y as GunshiParams } from "./types-CD5eRJFK.js";
1
+ import { a as CommandContext, m as DefaultGunshiParams, y as GunshiParams } from "./types-8Qh1S2q6.js";
2
2
 
3
3
  //#region ../plugin-renderer/src/header.d.ts
4
4
  /**
package/lib/renderer.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as renderHeader, n as renderValidationErrors, r as renderUsage } from "./src-DIz-QFuo.js";
1
+ import { i as renderHeader, n as renderValidationErrors, r as renderUsage } from "./src-a-JpaUM5.js";
2
2
  //#region src/renderer.ts
3
3
  /**
4
4
  * @author kazuya kawaguchi (a.k.a. kazupon)
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/args-tokens@0.28.0/node_modules/args-tokens/lib/parser-DT7Ztcch.d.ts
1
+ //#region ../../node_modules/.pnpm/args-tokens@0.28.1/node_modules/args-tokens/lib/parser-DT7Ztcch.d.ts
2
2
  //#region src/parser.d.ts
3
3
  /**
4
4
  * Entry point of argument parser.
@@ -88,7 +88,7 @@ declare function parseArgs(args: string[], options?: ParserOptions): ArgToken[];
88
88
  * @returns Whether `arg` is a short option.
89
89
  */
90
90
  //#endregion
91
- //#region ../../node_modules/.pnpm/args-tokens@0.28.0/node_modules/args-tokens/lib/resolver.d.ts
91
+ //#region ../../node_modules/.pnpm/args-tokens@0.28.1/node_modules/args-tokens/lib/resolver.d.ts
92
92
  //#region src/resolver.d.ts
93
93
  /**
94
94
  * An argument schema definition for command-line argument parsing.
@@ -1,5 +1,5 @@
1
- import { n as kebabnize, t as formatChoices } from "./utils-BKhsrjPW.js";
2
- //#region ../../node_modules/.pnpm/args-tokens@0.28.0/node_modules/args-tokens/lib/parser.js
1
+ import { n as kebabnize, t as formatChoices } from "./utils-CfOBA5zn.js";
2
+ //#region ../../node_modules/.pnpm/args-tokens@0.28.1/node_modules/args-tokens/lib/parser.js
3
3
  /**
4
4
  * forked from `nodejs/node` (`pkgjs/parseargs`)
5
5
  * repository url: https://github.com/nodejs/node (https://github.com/pkgjs/parseargs)
@@ -204,7 +204,7 @@ function hasOptionValue(value) {
204
204
  return !(value == null) && value.codePointAt(0) !== HYPHEN_CODE;
205
205
  }
206
206
  //#endregion
207
- //#region ../../node_modules/.pnpm/args-tokens@0.28.0/node_modules/args-tokens/lib/resolver.js
207
+ //#region ../../node_modules/.pnpm/args-tokens@0.28.1/node_modules/args-tokens/lib/resolver.js
208
208
  /**
209
209
  * Entry point of argument options resolver.
210
210
  *
@@ -306,9 +306,17 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
306
306
  const rest = [];
307
307
  const optionTokens = [];
308
308
  const positionalTokens = [];
309
+ const argEntries = Object.entries(args);
309
310
  let currentLongOption;
310
311
  let currentShortOption;
311
312
  const expandableShortOptions = [];
313
+ function getOptionName(rawArg, schema) {
314
+ return toKebab || schema.toKebab ? kebabnize(rawArg) : rawArg;
315
+ }
316
+ function checkLongTokenName(option, schema, token) {
317
+ if (token.rawName == void 0 || !hasLongOptionPrefix(token.rawName)) return false;
318
+ return token.name === option || schema.type === "boolean" && schema.negatable === true && token.name === `no-${option}`;
319
+ }
312
320
  function toShortValue() {
313
321
  if (expandableShortOptions.length === 0) return;
314
322
  else {
@@ -336,6 +344,13 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
336
344
  * separate tokens into positionals, long and short options, after that resolve values
337
345
  */
338
346
  const schemas = Object.values(args);
347
+ const booleanLongOptionNames = /* @__PURE__ */ new Set();
348
+ for (const [rawArg, schema] of Object.entries(args)) {
349
+ if (schema.type !== "boolean") continue;
350
+ const arg = toKebab || schema.toKebab ? kebabnize(rawArg) : rawArg;
351
+ booleanLongOptionNames.add(arg);
352
+ if (schema.negatable === true) booleanLongOptionNames.add(`no-${arg}`);
353
+ }
339
354
  let terminated = false;
340
355
  for (let i = 0; i < tokens.length; i++) {
341
356
  const token = tokens[i];
@@ -348,7 +363,7 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
348
363
  positionalTokens.push({ ...token });
349
364
  applyShortOptionValue();
350
365
  } else applyShortOptionValue(token.value);
351
- else if (currentLongOption) if (args[currentLongOption.name]?.type === "boolean") {
366
+ else if (currentLongOption) if (booleanLongOptionNames.has(currentLongOption.name)) {
352
367
  positionalTokens.push({ ...token });
353
368
  applyLongOptionValue();
354
369
  } else applyLongOptionValue(token.value);
@@ -401,11 +416,7 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
401
416
  const errors = [];
402
417
  const explicit = Object.create(null);
403
418
  const actualInputNames = /* @__PURE__ */ new Map();
404
- const argEntries = Object.entries(args);
405
419
  let requiredPositionalsAfter;
406
- function checkTokenName(option, schema, token) {
407
- return token.name === (schema.type === "boolean" ? schema.negatable && token.name?.startsWith("no-") ? `no-${option}` : option : option);
408
- }
409
420
  const positionalItemCount = tokens.filter((token) => token.kind === "positional").length;
410
421
  function getPositionalSkipIndex() {
411
422
  return Math.min(skipPositionalIndex, positionalItemCount);
@@ -416,7 +427,7 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
416
427
  }
417
428
  let positionalsCount = 0;
418
429
  for (const [rawArg, schema] of argEntries) {
419
- const arg = toKebab || schema.toKebab ? kebabnize(rawArg) : rawArg;
430
+ const arg = getOptionName(rawArg, schema);
420
431
  explicit[rawArg] = false;
421
432
  if (schema.type === "positional") {
422
433
  if (skipPositionalIndex > SKIP_POSITIONAL_DEFAULT) while (positionalsCount <= getPositionalSkipIndex()) positionalsCount++;
@@ -470,7 +481,7 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
470
481
  }
471
482
  if (schema.required) {
472
483
  if (!optionTokens.find((token) => {
473
- return schema.short && token.name === schema.short || token.rawName && hasLongOptionPrefix(token.rawName) && token.name === arg;
484
+ return schema.short && token.name === schema.short && token.rawName != void 0 && isShortOption(token.rawName) || checkLongTokenName(arg, schema, token);
474
485
  })) {
475
486
  errors.push(createRequireError(rawArg, arg, schema));
476
487
  continue;
@@ -478,14 +489,15 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
478
489
  }
479
490
  for (let i = 0; i < optionTokens.length; i++) {
480
491
  const token = optionTokens[i];
481
- if (checkTokenName(arg, schema, token) && token.rawName != void 0 && hasLongOptionPrefix(token.rawName) || schema.short === token.name && token.rawName != void 0 && isShortOption(token.rawName)) {
492
+ if (checkLongTokenName(arg, schema, token) || schema.short === token.name && token.rawName != void 0 && isShortOption(token.rawName)) {
482
493
  const invalid = validateRequire(token, rawArg, arg, schema);
483
494
  if (invalid) {
484
495
  errors.push(invalid);
485
496
  continue;
486
497
  }
487
498
  explicit[rawArg] = true;
488
- const actualInputName = isShortOption(token.rawName) ? `-${token.name}` : `--${arg}`;
499
+ const rawName = token.rawName;
500
+ const actualInputName = isShortOption(rawName) ? `-${token.name}` : rawName;
489
501
  actualInputNames.set(rawArg, actualInputName);
490
502
  const [parsedValue, error] = parse(token, rawArg, arg, schema);
491
503
  if (error) errors.push(error);
@@ -1,9 +1,9 @@
1
1
  import "./context-CAPhwgJJ.js";
2
- import { n as kebabnize } from "./utils-BKhsrjPW.js";
2
+ import { n as kebabnize } from "./utils-CfOBA5zn.js";
3
3
  import { resolveLazyCommand } from "./utils.js";
4
- import { n as ArgsValidationErrorKeys, r as isArgsValidationError } from "./resolver-UFOtObbe.js";
5
- import { i as isCommandNotFoundError } from "./error-xSnOOdnr.js";
6
- import { t as plugin } from "./plugin-DhJZVIbl.js";
4
+ import { n as ArgsValidationErrorKeys, r as isArgsValidationError } from "./resolver-UjEQwV-U.js";
5
+ import { i as isCommandNotFoundError } from "./error-BxeGn0JU.js";
6
+ import { t as plugin } from "./plugin-BY44BdcY.js";
7
7
  /**
8
8
  * @author kazuya kawaguchi (a.k.a. kazupon)
9
9
  * @license MIT
@@ -1,4 +1,4 @@
1
- import { i as Args, n as ArgSchema, r as ArgValues, t as ArgExplicitlyProvided, u as ArgToken } from "./resolver-CgkhQ6Tt.js";
1
+ import { i as Args, n as ArgSchema, r as ArgValues, t as ArgExplicitlyProvided, u as ArgToken } from "./resolver-CKLHkuQa.js";
2
2
 
3
3
  //#region src/plugin/context.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/args-tokens@0.28.0/node_modules/args-tokens/lib/utils.js
1
+ //#region ../../node_modules/.pnpm/args-tokens@0.28.1/node_modules/args-tokens/lib/utils.js
2
2
  /**
3
3
  * Entry point of utils.
4
4
  *
package/lib/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { b as GunshiParamsConstraint, m as DefaultGunshiParams, p as Commandable, r as Command, x as LazyCommand } from "./types-CD5eRJFK.js";
1
+ import { b as GunshiParamsConstraint, m as DefaultGunshiParams, p as Commandable, r as Command, x as LazyCommand } from "./types-8Qh1S2q6.js";
2
2
 
3
- //#region ../../node_modules/.pnpm/args-tokens@0.28.0/node_modules/args-tokens/lib/utils.d.ts
3
+ //#region ../../node_modules/.pnpm/args-tokens@0.28.1/node_modules/args-tokens/lib/utils.d.ts
4
4
 
5
5
  //#region src/utils.d.ts
6
6
  /**
package/lib/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as kebabnize } from "./utils-BKhsrjPW.js";
1
+ import { n as kebabnize } from "./utils-CfOBA5zn.js";
2
2
  //#region src/utils.ts
3
3
  /**
4
4
  * @author kazuya kawaguchi (a.k.a. kazupon)
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.37.0",
4
+ "version": "0.37.1",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
7
7
  "email": "kawakazu80@gmail.com"
@@ -108,7 +108,7 @@
108
108
  }
109
109
  },
110
110
  "devDependencies": {
111
- "args-tokens": "^0.28.0",
111
+ "args-tokens": "^0.28.1",
112
112
  "deno": "^2.7.14",
113
113
  "jsr": "^0.14.3",
114
114
  "jsr-exports-lint": "^0.4.2",
@@ -116,11 +116,11 @@
116
116
  "std-env": "^4.1.0",
117
117
  "tsdown": "0.21.0",
118
118
  "zod": "^4.4.3",
119
- "@gunshi/plugin-global": "0.37.0",
120
- "@gunshi/resources": "0.37.0",
121
- "@gunshi/plugin-i18n": "0.37.0",
122
- "@gunshi/plugin-renderer": "0.37.0",
123
- "@gunshi/shared": "0.37.0"
119
+ "@gunshi/plugin-i18n": "0.37.1",
120
+ "@gunshi/plugin-global": "0.37.1",
121
+ "@gunshi/plugin-renderer": "0.37.1",
122
+ "@gunshi/shared": "0.37.1",
123
+ "@gunshi/resources": "0.37.1"
124
124
  },
125
125
  "scripts": {
126
126
  "build": "tsdown",