gunshi 1.0.0-beta.2 → 1.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/agent.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- //#region ../../node_modules/.pnpm/std-env@4.1.0/node_modules/std-env/dist/index.d.mts
2
- //#region src/agents.d.ts
1
+ //#region ../../node_modules/.pnpm/std-env@4.2.0/node_modules/std-env/dist/index.d.mts
3
2
  /**
4
3
  * Represents the name of an AI coding agent.
5
4
  */
6
- type AgentName = (string & {}) | "cursor" | "claude" | "devin" | "replit" | "gemini" | "codex" | "auggie" | "opencode" | "kiro" | "goose" | "pi";
5
+ type AgentName = (string & {}) | "cursor" | "claude" | "devin" | "replit" | "gemini" | "codex" | "auggie" | "opencode" | "kiro" | "goose" | "pi" | "junie";
7
6
  //#endregion
8
7
  //#region src/agent.d.ts
9
8
  /**
package/lib/agent.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/std-env@4.1.0/node_modules/std-env/dist/index.mjs
1
+ //#region ../../node_modules/.pnpm/std-env@4.2.0/node_modules/std-env/dist/index.mjs
2
2
  const e = globalThis.process?.env || Object.create(null);
3
3
  const t = globalThis.process || { env: e };
4
4
  const n = t !== void 0 && t.env && t.env.NODE_ENV || void 0;
@@ -11,14 +11,16 @@ const r = [
11
11
  [`pi`, [i(`PATH`, /\.pi[\\/]agent/)]],
12
12
  [`auggie`, [`AUGMENT_AGENT`]],
13
13
  [`goose`, [`GOOSE_PROVIDER`]],
14
+ [`junie`, [`JUNIE_DATA`, `JUNIE_SHIM_PATH`]],
14
15
  [`devin`, [i(`EDITOR`, /devin/)]],
15
16
  [`cursor`, [`CURSOR_AGENT`]],
16
- [`kiro`, [i(`TERM_PROGRAM`, /kiro/)]]
17
+ [`kiro`, [i(`TERM_PROGRAM`, /kiro/, { noTTY: !0 })]]
17
18
  ];
18
- function i(t, n) {
19
+ function i(n, r, i) {
19
20
  return () => {
20
- let r = e[t];
21
- return r ? n.test(r) : !1;
21
+ if (i?.noTTY && t.stdout?.isTTY) return !1;
22
+ let a = e[n];
23
+ return a ? r.test(a) : !1;
22
24
  };
23
25
  }
24
26
  function a() {
package/lib/bone.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { i as Args, l as ArgToken, n as ArgSchema, r as ArgValues } from "./resolver-BezrTUr7.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-lD5uzpd5.js";
1
+ import { i as Args, l as ArgToken, n as ArgSchema, r as ArgValues } from "./resolver-Cbtx2IyH.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-jrddQ_Kw.js";
3
3
  //#region src/cli/bone.d.ts
4
4
  /**
5
5
  * Run the command.
package/lib/bone.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as cliCore } from "./core-D9EEP3Ac.js";
1
+ import { t as cliCore } from "./core-CrrcHkyV.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 { a as hasPriorityValidationError } from "./error-wB83kWiv.js";
2
- import { t as plugin } from "./plugin-CG94VzCl.js";
3
- import { a as namespacedId, o as COMMON_ARGS, t as renderer } from "./src-Dr9mmkFc.js";
4
- import { t as cliCore } from "./core-D9EEP3Ac.js";
1
+ import { a as hasPriorityValidationError } from "./error-pbHb3QAL.js";
2
+ import { t as plugin } from "./plugin-Fea3gCnT.js";
3
+ import { a as namespacedId, o as COMMON_ARGS, t as renderer } from "./src-0zuC_LJU.js";
4
+ import { t as cliCore } from "./core-CrrcHkyV.js";
5
5
  //#region ../plugin-global/src/types.ts
6
6
  /**
7
7
  * @author kazuya kawaguchi (a.k.a. kazupon)
@@ -18,6 +18,36 @@ const pluginId = namespacedId("global");
18
18
  * @license MIT
19
19
  */
20
20
  /**
21
+ * The key of the registry in which the core keeps, for the command context of each run, the set of the
22
+ * errors that have been reported to the user. An error in the set tells `cli()` to end without
23
+ * rejecting. The errors are frozen with the command context, so they are not marked themselves. The key
24
+ * is a registered symbol, since `gunshi` and the plugins bundle their own copies.
25
+ */
26
+ const REPORTED = Symbol.for("gunshi.reported");
27
+ /**
28
+ * Mark an error as reported to the user, in the set that the core keeps for the run of the context.
29
+ *
30
+ * @param ctx - The command context of the run
31
+ * @param error - The error that has been reported
32
+ * @returns `true` if the error is marked, `false` if the core keeps no set for the run
33
+ */
34
+ function markReported(ctx, error) {
35
+ const reported = globalThis[REPORTED]?.get(ctx);
36
+ if (reported === void 0) return false;
37
+ reported.add(error);
38
+ return true;
39
+ }
40
+ /**
41
+ * Set the exit code of the process, where the runtime has one (Node.js, Bun and Deno 2 have `process`).
42
+ * The core does not call the APIs of a runtime, so the plugin, which reports the errors, sets it.
43
+ *
44
+ * @param code - The exit code
45
+ */
46
+ function setExitCode(code) {
47
+ const proc = globalThis.process;
48
+ if (proc != null && typeof proc === "object") proc.exitCode = code;
49
+ }
50
+ /**
21
51
  * Decorator function to extend the command with global options.
22
52
  *
23
53
  * @param baseRunner - The base command runner
@@ -29,27 +59,25 @@ const decorator = (baseRunner) => async (ctx) => {
29
59
  * declares the same name — even with an identical schema — is not in that map, so `--version` /
30
60
  * `--help` belong to the command.
31
61
  */
32
- const { values, validationError, env: { globalOptions }, extensions: { [pluginId]: { showVersion, showHeader, showUsage, showValidationErrors } } } = ctx;
33
- if (hasPriorityValidationError(validationError)) {
34
- await showValidationErrors(validationError);
35
- throw validationError;
36
- }
62
+ const { values, validationError, env: { globalOptions }, extensions: { [pluginId]: { showVersion, showUsage, showValidationErrors } } } = ctx;
63
+ /**
64
+ * NOTE(kazupon): when the plugin has shown the validation errors to the user, they have been
65
+ * reported: the exit code is 1, and `cli()` ends without rejecting, as the other CLI libraries end
66
+ * without a stack trace. They are still thrown, so that the `onErrorCommand` hook sees them. When
67
+ * nothing was shown (`renderValidationErrors: null`, an empty message, or `usageSilent`), `cli()`
68
+ * rejects with them, for the app to report them. So it does when the core keeps no set of reported
69
+ * errors for the run, and then the exit code is left alone.
70
+ *
71
+ * @param error - The aggregate error of the validation errors
72
+ */
73
+ const report = async (error) => {
74
+ if (await showValidationErrors(error) && !ctx.env.usageSilent && markReported(ctx, error)) setExitCode(1);
75
+ throw error;
76
+ };
77
+ if (hasPriorityValidationError(validationError)) return await report(validationError);
37
78
  if (values.version && globalOptions?.has("version")) return showVersion();
38
- const buf = [];
39
- const header = await showHeader();
40
- if (header) buf.push(header);
41
- if (values.help && globalOptions?.has("help")) {
42
- const usage = await showUsage();
43
- if (usage) {
44
- buf.push(usage);
45
- return buf.join("\n");
46
- }
47
- return;
48
- }
49
- if (validationError) {
50
- await showValidationErrors(validationError);
51
- throw validationError;
52
- }
79
+ if (values.help && globalOptions?.has("help")) return await showUsage();
80
+ if (validationError) return await report(validationError);
53
81
  return baseRunner(ctx);
54
82
  };
55
83
  //#endregion
@@ -83,19 +111,31 @@ function extension(ctx) {
83
111
  return header;
84
112
  },
85
113
  showUsage: async () => {
86
- if (ctx.env.renderUsage != null) {
87
- const usage = await ctx.env.renderUsage(ctx);
88
- if (usage) {
89
- ctx.log(usage);
90
- return usage;
91
- }
114
+ if (ctx.env.renderUsage == null) return;
115
+ const usage = await ctx.env.renderUsage(ctx);
116
+ if (!usage) return;
117
+ /**
118
+ * NOTE(kazupon): the header is the title of the usage, so it comes with the usage, wherever the
119
+ * usage is shown: for `--help`, and when a command that takes `--help` itself shows it. It is not
120
+ * shown before a command runs, where it would come before what the command prints, such as JSON.
121
+ */
122
+ const header = ctx.env.renderHeader == null ? void 0 : await ctx.env.renderHeader(ctx);
123
+ if (header) {
124
+ ctx.log(header);
125
+ ctx.log();
92
126
  }
127
+ ctx.log(usage);
128
+ return header ? [header, usage].join("\n") : usage;
93
129
  },
94
130
  showValidationErrors: async (error) => {
95
131
  if (ctx.env.renderValidationErrors === null) return;
96
132
  if (ctx.env.renderValidationErrors !== void 0) {
97
133
  const message = await ctx.env.renderValidationErrors(ctx, error);
98
- ctx.log(message);
134
+ /**
135
+ * NOTE(kazupon): the validation errors are diagnostics, not the output of the command, so they
136
+ * go to stderr, as the other CLI libraries do. stdout stays for what a command prints, such as JSON.
137
+ */
138
+ if (message && !ctx.env.usageSilent) console.error(message);
99
139
  return message;
100
140
  }
101
141
  }
@@ -163,6 +203,7 @@ function global() {
163
203
  * @param entry - A {@link Command | entry command}, an {@link CommandRunner | inline command runner}, or a {@link LazyCommand | lazily-loaded command}
164
204
  * @param options - A {@link CliOptions | CLI options}
165
205
  * @returns A rendered usage or undefined. if you will use {@linkcode CliOptions.usageSilent} option, it will return rendered usage string.
206
+ * It is also `undefined` when the arguments fail validation and the errors are reported to stderr (see {@linkcode CliOptions.renderValidationErrors}).
166
207
  */
167
208
  async function cli(args, entry, options = {}) {
168
209
  return cliCore(args, entry, options, createBuiltInPlugins());
@@ -1,5 +1,5 @@
1
- import { i as Args, n as ArgSchema } from "./resolver-BezrTUr7.js";
2
- //#region ../../node_modules/.pnpm/args-tokens@1.0.0-beta.1/node_modules/args-tokens/lib/combinators.d.ts
1
+ import { i as Args, n as ArgSchema } from "./resolver-Cbtx2IyH.js";
2
+ //#region ../../node_modules/.pnpm/args-tokens@1.0.0/node_modules/args-tokens/lib/combinators.d.ts
3
3
  //#region src/combinators.d.ts
4
4
  /**
5
5
  * A combinator produced by combinator factory functions.
@@ -1,6 +1,6 @@
1
- import { t as formatChoices } from "./utils-CJLgPw25.js";
2
- import { n as ArgsValidationErrorKeys, r as PURE_PARSE, t as ArgsValidationError } from "./resolver-CAlgxe_R-y4BytVTg.js";
3
- //#region ../../node_modules/.pnpm/args-tokens@1.0.0-beta.1/node_modules/args-tokens/lib/combinators.js
1
+ import { t as formatChoices } from "./utils-D-MmF6sM.js";
2
+ import { n as ArgsValidationErrorKeys, r as PURE_PARSE, t as ArgsValidationError } from "./resolver-CAlgxe_R-3pz9PVFu.js";
3
+ //#region ../../node_modules/.pnpm/args-tokens@1.0.0/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, l as ArgToken, r as ArgValues } from "./resolver-BezrTUr7.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-lD5uzpd5.js";
1
+ import { i as Args, l as ArgToken, r as ArgValues } from "./resolver-Cbtx2IyH.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-jrddQ_Kw.js";
3
3
  //#region src/context.d.ts
4
4
  /**
5
5
  * Extract extension return types from extensions record
@@ -1,8 +1,8 @@
1
1
  import { i as NOOP, r as CLI_OPTIONS_DEFAULT, t as createCommandContext } from "./context-CSecf6R5.js";
2
- import { n as kebabnize } from "./utils-CJLgPw25.js";
2
+ import { n as kebabnize } from "./utils-D-MmF6sM.js";
3
3
  import { create, getCommandSubCommands, isLazyCommand, resolveLazyCommand } from "./utils.js";
4
- import { a as resolveArgs, n as ArgsValidationErrorKeys, o as parseArgs, t as ArgsValidationError } from "./resolver-CAlgxe_R-y4BytVTg.js";
5
- import { a as hasPriorityValidationError, i as CommandResolutionErrorKeys, n as CommandNotFoundErrorKeys, r as CommandResolutionError, t as CommandNotFoundError } from "./error-wB83kWiv.js";
4
+ import { a as resolveArgs, n as ArgsValidationErrorKeys, o as parseArgs, t as ArgsValidationError } from "./resolver-CAlgxe_R-3pz9PVFu.js";
5
+ import { a as hasPriorityValidationError, i as CommandResolutionErrorKeys, n as CommandNotFoundErrorKeys, r as CommandResolutionError, t as CommandNotFoundError } from "./error-pbHb3QAL.js";
6
6
  //#region src/decorators.ts
7
7
  /**
8
8
  * @author kazuya kawaguchi (a.k.a. kazupon)
@@ -324,7 +324,7 @@ async function cliCore(argv, entry, options, plugins, usageOnly = false) {
324
324
  skipPositional
325
325
  });
326
326
  const validationError = mergeValidationErrors(error, [...additionalValidationErrors, ...cliOptions.strict && !diagnostic ? createUnknownOptionErrors(findUnknownOptions(args, tokens, { toKebab: resolvedCommand.toKebab })) : []]);
327
- return await executeCommand(resolvedCommand, await createCommandContext({
327
+ const commandContext = await createCommandContext({
328
328
  args,
329
329
  explicit,
330
330
  values,
@@ -339,7 +339,41 @@ async function cliCore(argv, entry, options, plugins, usageOnly = false) {
339
339
  extensions: getPluginExtensions(resolvedPlugins),
340
340
  validationError,
341
341
  cliOptions
342
- }), decorators.commandDecorators);
342
+ });
343
+ const reported = trackReported(commandContext);
344
+ try {
345
+ return await executeCommand(resolvedCommand, commandContext, decorators.commandDecorators);
346
+ } catch (error) {
347
+ /**
348
+ * NOTE(kazupon): a plugin that has reported the validation errors to the user marks them, as the
349
+ * global options plugin does after it prints them to stderr and sets the exit code. They have been
350
+ * dealt with, and `onErrorCommand` has seen them in `executeCommand`, so `cli()` ends without
351
+ * rejecting. Errors that nobody reported, such as when the app renders the validation errors itself
352
+ * or an error thrown by a command, reject as before.
353
+ */
354
+ if (error != null && typeof error === "object" && reported.has(error)) return;
355
+ throw error;
356
+ }
357
+ }
358
+ /**
359
+ * The key of the registry that maps the command context of a run to the set of the errors that a plugin
360
+ * has reported to the user during the run. The global options plugin uses the same registered symbol,
361
+ * since `gunshi` and the plugins bundle their own copies.
362
+ */
363
+ const REPORTED = Symbol.for("gunshi.reported");
364
+ /**
365
+ * Prepare the set of the errors that a plugin reports to the user during a run. The set belongs to the
366
+ * command context of the run, so a report counts for this run only: not for a nested `cli()` in a hook,
367
+ * nor for a later run in which the same error is thrown again.
368
+ *
369
+ * @param ctx - The command context of the run
370
+ * @returns The set of the errors that have been reported during the run
371
+ */
372
+ function trackReported(ctx) {
373
+ const registry = globalThis;
374
+ const reported = /* @__PURE__ */ new WeakSet();
375
+ (registry[REPORTED] ??= /* @__PURE__ */ new WeakMap()).set(ctx, reported);
376
+ return reported;
343
377
  }
344
378
  /**
345
379
  * Create the decorator that renders the usage of the command instead of running it.
@@ -1,5 +1,5 @@
1
- import { i as Args, n as ArgSchema, r as ArgValues } from "./resolver-BezrTUr7.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-lD5uzpd5.js";
1
+ import { i as Args, n as ArgSchema, r as ArgValues } from "./resolver-Cbtx2IyH.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-jrddQ_Kw.js";
3
3
  import { CommandContextParams, createCommandContext } from "./context.js";
4
4
  //#region src/definition.d.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { a as ArgsValidationError } from "./resolver-BezrTUr7.js";
2
- import { m as DefaultGunshiParams, n as CliOptions } from "./types-lD5uzpd5.js";
1
+ import { a as ArgsValidationError } from "./resolver-Cbtx2IyH.js";
2
+ import { m as DefaultGunshiParams, n as CliOptions } from "./types-jrddQ_Kw.js";
3
3
  //#region src/constants.d.ts
4
4
  declare const ANONYMOUS_COMMAND_NAME = "(anonymous)";
5
5
  declare const CLI_OPTIONS_DEFAULT: CliOptions<DefaultGunshiParams>;
@@ -1,5 +1,5 @@
1
- import { i as isArgsValidationError$1, n as ArgsValidationErrorKeys, t as ArgsValidationError } from "./resolver-CAlgxe_R-y4BytVTg.js";
2
- //#region ../../node_modules/.pnpm/args-tokens@1.0.0-beta.1/node_modules/args-tokens/lib/index.js
1
+ import { i as isArgsValidationError$1, n as ArgsValidationErrorKeys, t as ArgsValidationError } from "./resolver-CAlgxe_R-3pz9PVFu.js";
2
+ //#region ../../node_modules/.pnpm/args-tokens@1.0.0/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 { b as GunshiParamsConstraint, m as DefaultGunshiParams, n as CliOptions, r as Command, x as LazyCommand } from "./types-lD5uzpd5.js";
1
+ import { b as GunshiParamsConstraint, m as DefaultGunshiParams, n as CliOptions, r as Command, x as LazyCommand } from "./types-jrddQ_Kw.js";
2
2
  //#region src/generator.d.ts
3
3
  /**
4
4
  * generate options of `generate` function.
package/lib/generator.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { create } from "./utils.js";
2
- import { n as cliUsage } from "./builtin-ClJbNR1q.js";
2
+ import { n as cliUsage } from "./builtin-C4T7jgn7.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 resolveArgs, i as Args, l as ArgToken, n as ArgSchema, o as ArgsValidationErrorCode, r as ArgValues, s as ArgsValidationErrorKeys, u as parseArgs } from "./resolver-BezrTUr7.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-lD5uzpd5.js";
1
+ import { a as ArgsValidationError, c as resolveArgs, i as Args, l as ArgToken, n as ArgSchema, o as ArgsValidationErrorCode, r as ArgValues, s as ArgsValidationErrorKeys, u as parseArgs } from "./resolver-Cbtx2IyH.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-jrddQ_Kw.js";
3
3
  import { CommandContextParams, createCommandContext } from "./context.js";
4
4
  import { define, defineWithTypes, lazy, lazyWithTypes } from "./definition.js";
5
- import { a as CommandResolutionError, c as CommandResolutionErrorOptions, d as isCommandNotFoundError, f as isCommandResolutionError, i as CommandNotFoundErrorOptions, l as hasPriorityValidationError, n as CommandNotFoundErrorCode, o as CommandResolutionErrorCode, p as ANONYMOUS_COMMAND_NAME, r as CommandNotFoundErrorKeys, s as CommandResolutionErrorKeys, t as CommandNotFoundError, u as isArgsValidationError } from "./error-e_--t4mB.js";
5
+ import { a as CommandResolutionError, c as CommandResolutionErrorOptions, d as isCommandNotFoundError, f as isCommandResolutionError, i as CommandNotFoundErrorOptions, l as hasPriorityValidationError, n as CommandNotFoundErrorCode, o as CommandResolutionErrorCode, p as ANONYMOUS_COMMAND_NAME, r as CommandNotFoundErrorKeys, s as CommandResolutionErrorKeys, t as CommandNotFoundError, u as isArgsValidationError } from "./error-DgUj3WPU.js";
6
6
  //#region ../plugin-i18n/src/types.d.ts
7
7
  /**
8
8
  * Translation adapter factory options.
@@ -114,6 +114,7 @@ declare class DefaultTranslation implements TranslationAdapter {
114
114
  * @param entry - A {@link Command | entry command}, an {@link CommandRunner | inline command runner}, or a {@link LazyCommand | lazily-loaded command}
115
115
  * @param options - A {@link CliOptions | CLI options}
116
116
  * @returns A rendered usage or undefined. if you will use {@linkcode CliOptions.usageSilent} option, it will return rendered usage string.
117
+ * It is also `undefined` when the arguments fail validation and the errors are reported to stderr (see {@linkcode CliOptions.renderValidationErrors}).
117
118
  */
118
119
  declare function cli<G extends GunshiParamsConstraint>(args: string[], entry: Command<G> | CommandRunner<G> | LazyCommand<G>, options?: CliOptions<G>): Promise<string | undefined>;
119
120
  /**
@@ -125,6 +126,7 @@ declare function cli<G extends GunshiParamsConstraint>(args: string[], entry: Co
125
126
  * @param entry - A {@link Command | entry command}, an {@link CommandRunner | inline command runner}, or a {@link LazyCommand | lazily-loaded command}
126
127
  * @param options - A {@link CliOptions | CLI options}
127
128
  * @returns A rendered usage or undefined. if you will use {@linkcode CliOptions.usageSilent} option, it will return rendered usage string.
129
+ * It is also `undefined` when the arguments fail validation and the errors are reported to stderr (see {@linkcode CliOptions.renderValidationErrors}).
128
130
  */
129
131
  declare function cli<A extends Args = Args, G extends GunshiParams = {
130
132
  args: A;
@@ -139,6 +141,7 @@ declare function cli<A extends Args = Args, G extends GunshiParams = {
139
141
  * @param entry - A {@link Command | entry command}, an {@link CommandRunner | inline command runner}, or a {@link LazyCommand | lazily-loaded command}
140
142
  * @param options - A {@link CliOptions | CLI options}
141
143
  * @returns A rendered usage or undefined. if you will use {@linkcode CliOptions.usageSilent} option, it will return rendered usage string.
144
+ * It is also `undefined` when the arguments fail validation and the errors are reported to stderr (see {@linkcode CliOptions.renderValidationErrors}).
142
145
  */
143
146
  declare function cli<E extends ExtendContext = ExtendContext, G extends GunshiParams = {
144
147
  args: Args;
@@ -153,6 +156,7 @@ declare function cli<E extends ExtendContext = ExtendContext, G extends GunshiPa
153
156
  * @param entry - A {@link Command | entry command}, an {@link CommandRunner | inline command runner}, or a {@link LazyCommand | lazily-loaded command}
154
157
  * @param options - A {@link CliOptions | CLI options}
155
158
  * @returns A rendered usage or undefined. if you will use {@linkcode CliOptions.usageSilent} option, it will return rendered usage string.
159
+ * It is also `undefined` when the arguments fail validation and the errors are reported to stderr (see {@linkcode CliOptions.renderValidationErrors}).
156
160
  */
157
161
  declare function cli<G extends GunshiParams = DefaultGunshiParams>(args: string[], entry: Command<G> | CommandRunner<G> | LazyCommand<G>, options?: CliOptions<G>): Promise<string | undefined>;
158
162
  /**
@@ -170,6 +174,7 @@ declare function cli<G extends GunshiParams = DefaultGunshiParams>(args: string[
170
174
  * @param entry - A command-like object (command, command runner, or lazy command)
171
175
  * @param options - A {@link CliOptions | CLI options}
172
176
  * @returns A rendered usage or undefined. if you will use {@linkcode CliOptions.usageSilent} option, it will return rendered usage string.
177
+ * It is also `undefined` when the arguments fail validation and the errors are reported to stderr (see {@linkcode CliOptions.renderValidationErrors}).
173
178
  */
174
179
  declare function cli(args: string[], entry: SubCommandable, options?: CliOptions): Promise<string | undefined>;
175
180
  //#endregion
package/lib/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { n as ANONYMOUS_COMMAND_NAME, t as createCommandContext } from "./context-CSecf6R5.js";
2
- import { a as resolveArgs, n as ArgsValidationErrorKeys, o as parseArgs, t as ArgsValidationError } from "./resolver-CAlgxe_R-y4BytVTg.js";
3
- import { a as hasPriorityValidationError, c as isCommandResolutionError, i as CommandResolutionErrorKeys, n as CommandNotFoundErrorKeys, o as isArgsValidationError, r as CommandResolutionError, s as isCommandNotFoundError, t as CommandNotFoundError } from "./error-wB83kWiv.js";
4
- import { t as plugin } from "./plugin-CG94VzCl.js";
5
- import { a as namespacedId } from "./src-Dr9mmkFc.js";
6
- import { t as cli } from "./builtin-ClJbNR1q.js";
2
+ import { a as resolveArgs, n as ArgsValidationErrorKeys, o as parseArgs, t as ArgsValidationError } from "./resolver-CAlgxe_R-3pz9PVFu.js";
3
+ import { a as hasPriorityValidationError, c as isCommandResolutionError, i as CommandResolutionErrorKeys, n as CommandNotFoundErrorKeys, o as isArgsValidationError, r as CommandResolutionError, s as isCommandNotFoundError, t as CommandNotFoundError } from "./error-pbHb3QAL.js";
4
+ import { t as plugin } from "./plugin-Fea3gCnT.js";
5
+ import { a as namespacedId } from "./src-0zuC_LJU.js";
6
+ import { t as cli } from "./builtin-C4T7jgn7.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-wB83kWiv.js";
1
+ import "./error-pbHb3QAL.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,5 +1,5 @@
1
- import { a as ArgsValidationError, i as Args, l as ArgToken, n as ArgSchema, o as ArgsValidationErrorCode, r as ArgValues, s as ArgsValidationErrorKeys } from "./resolver-BezrTUr7.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-lD5uzpd5.js";
1
+ import { a as ArgsValidationError, i as Args, l as ArgToken, n as ArgSchema, o as ArgsValidationErrorCode, r as ArgValues, s as ArgsValidationErrorKeys } from "./resolver-Cbtx2IyH.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-jrddQ_Kw.js";
3
3
  import { CommandContextParams, createCommandContext } from "./context.js";
4
- import { a as CommandResolutionError, c as CommandResolutionErrorOptions, d as isCommandNotFoundError, f as isCommandResolutionError, i as CommandNotFoundErrorOptions, l as hasPriorityValidationError, m as CLI_OPTIONS_DEFAULT, n as CommandNotFoundErrorCode, o as CommandResolutionErrorCode, p as ANONYMOUS_COMMAND_NAME, r as CommandNotFoundErrorKeys, s as CommandResolutionErrorKeys, t as CommandNotFoundError, u as isArgsValidationError } from "./error-e_--t4mB.js";
4
+ import { a as CommandResolutionError, c as CommandResolutionErrorOptions, d as isCommandNotFoundError, f as isCommandResolutionError, i as CommandNotFoundErrorOptions, l as hasPriorityValidationError, m as CLI_OPTIONS_DEFAULT, n as CommandNotFoundErrorCode, o as CommandResolutionErrorCode, p as ANONYMOUS_COMMAND_NAME, r as CommandNotFoundErrorKeys, s as CommandResolutionErrorKeys, t as CommandNotFoundError, u as isArgsValidationError } from "./error-DgUj3WPU.js";
5
5
  export { ANONYMOUS_COMMAND_NAME, type ArgSchema, type ArgToken, type ArgValues, type Args, ArgsValidationError, type ArgsValidationErrorCode, ArgsValidationErrorKeys, type Awaitable, CLI_OPTIONS_DEFAULT, type Command, type CommandContext, type CommandContextCore, type CommandContextExtension, type CommandContextParams, type CommandDecorator, type CommandExamplesFetcher, CommandNotFoundError, type CommandNotFoundErrorCode, CommandNotFoundErrorKeys, type CommandNotFoundErrorOptions, CommandResolutionError, type CommandResolutionErrorCode, CommandResolutionErrorKeys, type CommandResolutionErrorOptions, type CommandRunner, type DefaultGunshiParams, type ExtendContext, type ExtractArgs, type ExtractExtensions, type GunshiParams, type GunshiParamsConstraint, type LazyCommand, type MergeGunshiExtensions, type NormalizeToGunshiParams, type OnPluginExtension, type Plugin, type PluginContext, type PluginDependency, type PluginExtension, type PluginFunction, type PluginOptions, type PluginWithExtension, type PluginWithoutExtension, type Prettify, type RendererDecorator, type ValidationErrorsDecorator, createCommandContext, hasPriorityValidationError, isArgsValidationError, isCommandNotFoundError, isCommandResolutionError, plugin };
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-CSecf6R5.js";
2
- import { n as ArgsValidationErrorKeys, t as ArgsValidationError } from "./resolver-CAlgxe_R-y4BytVTg.js";
3
- import { a as hasPriorityValidationError, c as isCommandResolutionError, i as CommandResolutionErrorKeys, n as CommandNotFoundErrorKeys, o as isArgsValidationError, r as CommandResolutionError, s as isCommandNotFoundError, t as CommandNotFoundError } from "./error-wB83kWiv.js";
4
- import { t as plugin } from "./plugin-CG94VzCl.js";
2
+ import { n as ArgsValidationErrorKeys, t as ArgsValidationError } from "./resolver-CAlgxe_R-3pz9PVFu.js";
3
+ import { a as hasPriorityValidationError, c as isCommandResolutionError, i as CommandResolutionErrorKeys, n as CommandNotFoundErrorKeys, o as isArgsValidationError, r as CommandResolutionError, s as isCommandNotFoundError, t as CommandNotFoundError } from "./error-pbHb3QAL.js";
4
+ import { t as plugin } from "./plugin-Fea3gCnT.js";
5
5
  export { ANONYMOUS_COMMAND_NAME, ArgsValidationError, ArgsValidationErrorKeys, CLI_OPTIONS_DEFAULT, CommandNotFoundError, CommandNotFoundErrorKeys, CommandResolutionError, CommandResolutionErrorKeys, createCommandContext, hasPriorityValidationError, isArgsValidationError, isCommandNotFoundError, isCommandResolutionError, plugin };
package/lib/renderer.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as CommandContext, m as DefaultGunshiParams, y as GunshiParams } from "./types-lD5uzpd5.js";
1
+ import { a as CommandContext, m as DefaultGunshiParams, y as GunshiParams } from "./types-jrddQ_Kw.js";
2
2
  //#region ../plugin-renderer/src/header.d.ts
3
3
  /**
4
4
  * Render the header.
package/lib/renderer.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as renderHeader, n as renderValidationErrors, r as renderUsage } from "./src-Dr9mmkFc.js";
1
+ import { i as renderHeader, n as renderValidationErrors, r as renderUsage } from "./src-0zuC_LJU.js";
2
2
  //#region src/renderer.ts
3
3
  /**
4
4
  * @author kazuya kawaguchi (a.k.a. kazupon)
@@ -1,5 +1,5 @@
1
- import { n as kebabnize, t as formatChoices } from "./utils-CJLgPw25.js";
2
- //#region ../../node_modules/.pnpm/args-tokens@1.0.0-beta.1/node_modules/args-tokens/lib/parser.js
1
+ import { n as kebabnize, t as formatChoices } from "./utils-D-MmF6sM.js";
2
+ //#region ../../node_modules/.pnpm/args-tokens@1.0.0/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)
@@ -202,7 +202,7 @@ function hasLongOptionPrefix(arg) {
202
202
  return arg.startsWith(LONG_OPTION_PREFIX) && arg.length > 2;
203
203
  }
204
204
  //#endregion
205
- //#region ../../node_modules/.pnpm/args-tokens@1.0.0-beta.1/node_modules/args-tokens/lib/resolver-CAlgxe_R.js
205
+ //#region ../../node_modules/.pnpm/args-tokens@1.0.0/node_modules/args-tokens/lib/resolver-CAlgxe_R.js
206
206
  /**
207
207
  * Internal definitions shared by the modules of `args-tokens`.
208
208
  *
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/args-tokens@1.0.0-beta.1/node_modules/args-tokens/lib/parser-DhESN1gR.d.ts
1
+ //#region ../../node_modules/.pnpm/args-tokens@1.0.0/node_modules/args-tokens/lib/parser-DhESN1gR.d.ts
2
2
  //#region src/parser.d.ts
3
3
  /**
4
4
  * Entry point of argument parser.
@@ -86,7 +86,7 @@ interface ParserOptions {
86
86
  */
87
87
  declare function parseArgs(args: string[], options?: ParserOptions): ArgToken[];
88
88
  //#endregion
89
- //#region ../../node_modules/.pnpm/args-tokens@1.0.0-beta.1/node_modules/args-tokens/lib/resolver.d.ts
89
+ //#region ../../node_modules/.pnpm/args-tokens@1.0.0/node_modules/args-tokens/lib/resolver.d.ts
90
90
  //#region src/resolver.d.ts
91
91
  /**
92
92
  * An argument schema definition for command-line argument parsing.
@@ -1,9 +1,9 @@
1
1
  import { n as ANONYMOUS_COMMAND_NAME, t as createCommandContext } from "./context-CSecf6R5.js";
2
- import { n as kebabnize } from "./utils-CJLgPw25.js";
2
+ import { n as kebabnize } from "./utils-D-MmF6sM.js";
3
3
  import { resolveLazyCommand } from "./utils.js";
4
- import { n as ArgsValidationErrorKeys } from "./resolver-CAlgxe_R-y4BytVTg.js";
5
- import { c as isCommandResolutionError, o as isArgsValidationError, s as isCommandNotFoundError } from "./error-wB83kWiv.js";
6
- import { t as plugin } from "./plugin-CG94VzCl.js";
4
+ import { n as ArgsValidationErrorKeys } from "./resolver-CAlgxe_R-3pz9PVFu.js";
5
+ import { c as isCommandResolutionError, o as isArgsValidationError, s as isCommandNotFoundError } from "./error-pbHb3QAL.js";
6
+ import { t as plugin } from "./plugin-Fea3gCnT.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, l as ArgToken, n as ArgSchema, r as ArgValues, t as ArgExplicitlyProvided } from "./resolver-BezrTUr7.js";
1
+ import { i as Args, l as ArgToken, n as ArgSchema, r as ArgValues, t as ArgExplicitlyProvided } from "./resolver-Cbtx2IyH.js";
2
2
  //#region src/plugin/context.d.ts
3
3
  /**
4
4
  * Gunshi plugin context interface.
@@ -634,6 +634,9 @@ interface CliOptions<G extends GunshiParamsConstraint = DefaultGunshiParams> {
634
634
  * Output that must still appear — machine-readable results for an agent, warnings for the
635
635
  * CLI author — should use `console.log` / `console.warn`, not `ctx.log`.
636
636
  *
637
+ * The validation errors are not printed either, so `cli()` rejects with them, for the caller to
638
+ * report them (see {@linkcode CliOptions.renderValidationErrors}).
639
+ *
637
640
  * @default false
638
641
  */
639
642
  usageSilent?: boolean;
@@ -657,6 +660,12 @@ interface CliOptions<G extends GunshiParamsConstraint = DefaultGunshiParams> {
657
660
  renderHeader?: ((ctx: Readonly<CommandContext<G>>) => Promise<string>) | null;
658
661
  /**
659
662
  * Render function the validation errors.
663
+ *
664
+ * With the global options plugin, the rendered message is printed to stderr, the exit code is set
665
+ * to `1`, {@linkcode CliOptions.onErrorCommand} is called, and `cli()` resolves with `undefined`.
666
+ * Set it to `null` to report the validation errors yourself: nothing is printed, and `cli()` rejects
667
+ * with the `AggregateError`. A renderer that returns an empty message, and
668
+ * {@linkcode CliOptions.usageSilent}, also leave them to the caller.
660
669
  */
661
670
  renderValidationErrors?: ((ctx: Readonly<CommandContext<G>>, error: AggregateError) => Promise<string>) | null;
662
671
  /**
@@ -688,10 +697,14 @@ interface CliOptions<G extends GunshiParamsConstraint = DefaultGunshiParams> {
688
697
  */
689
698
  onAfterCommand?: (ctx: Readonly<CommandContext<G>>, result: string | undefined) => Awaitable<void>;
690
699
  /**
691
- * Hook that runs when a command throws an error
700
+ * Hook that runs when a command throws an error, or when the arguments fail validation
701
+ *
702
+ * For the validation errors that the global options plugin has printed, the exit code is already `1`
703
+ * when the hook runs, so the hook can set another one, and `cli()` resolves after it. Any other
704
+ * error rejects `cli()` after the hook.
692
705
  *
693
706
  * @param ctx - The command context
694
- * @param error - The error thrown during execution
707
+ * @param error - The error thrown during execution, or the `AggregateError` of the validation errors
695
708
  * @since v0.27.0
696
709
  */
697
710
  onErrorCommand?: (ctx: Readonly<CommandContext<G>>, error: Error) => Awaitable<void>;
@@ -860,9 +873,11 @@ interface RenderingOptions<G extends GunshiParamsConstraint = DefaultGunshiParam
860
873
  usage?: ((ctx: Readonly<CommandContext<G>>) => Promise<string>) | null;
861
874
  /**
862
875
  * Validation errors rendering configuration
863
- * - `null`: Disable rendering
876
+ * - `null`: Disable rendering. `cli()` rejects with the validation errors, for the caller to report them
864
877
  * - `function`: Use custom renderer
865
878
  * - `undefined` (when omitted): Use default renderer
879
+ *
880
+ * See {@linkcode CliOptions.renderValidationErrors} for where the rendered message goes.
866
881
  */
867
882
  validationErrors?: ((ctx: Readonly<CommandContext<G>>, error: AggregateError) => Promise<string>) | null;
868
883
  }
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/args-tokens@1.0.0-beta.1/node_modules/args-tokens/lib/utils.js
1
+ //#region ../../node_modules/.pnpm/args-tokens@1.0.0/node_modules/args-tokens/lib/utils.js
2
2
  /**
3
3
  * Entry point of utils.
4
4
  *
package/lib/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as GunshiParamsConstraint, m as DefaultGunshiParams, p as Commandable, r as Command, x as LazyCommand } from "./types-lD5uzpd5.js";
2
- //#region ../../node_modules/.pnpm/args-tokens@1.0.0-beta.1/node_modules/args-tokens/lib/utils.d.ts
1
+ import { b as GunshiParamsConstraint, m as DefaultGunshiParams, p as Commandable, r as Command, x as LazyCommand } from "./types-jrddQ_Kw.js";
2
+ //#region ../../node_modules/.pnpm/args-tokens@1.0.0/node_modules/args-tokens/lib/utils.d.ts
3
3
  //#region src/utils.d.ts
4
4
  /**
5
5
  * Entry point of utils.
package/lib/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as kebabnize } from "./utils-CJLgPw25.js";
1
+ import { n as kebabnize } from "./utils-D-MmF6sM.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": "1.0.0-beta.2",
4
+ "version": "1.0.0-rc.2",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
7
7
  "email": "kawakazu80@gmail.com"
@@ -32,7 +32,8 @@
32
32
  },
33
33
  "type": "module",
34
34
  "files": [
35
- "lib"
35
+ "lib",
36
+ "skills"
36
37
  ],
37
38
  "module": "lib/index.js",
38
39
  "exports": {
@@ -108,13 +109,13 @@
108
109
  }
109
110
  },
110
111
  "devDependencies": {
111
- "@gunshi/plugin-global": "1.0.0-beta.2",
112
- "@gunshi/plugin-i18n": "1.0.0-beta.2",
113
- "@gunshi/plugin-renderer": "1.0.0-beta.2",
114
- "@gunshi/resources": "1.0.0-beta.2",
115
- "@gunshi/shared": "1.0.0-beta.2",
116
- "@types/node": "^25.6.2",
117
- "args-tokens": "1.0.0-beta.1",
112
+ "@gunshi/plugin-global": "1.0.0-rc.2",
113
+ "@gunshi/plugin-i18n": "1.0.0-rc.2",
114
+ "@gunshi/plugin-renderer": "1.0.0-rc.2",
115
+ "@gunshi/resources": "1.0.0-rc.2",
116
+ "@gunshi/shared": "1.0.0-rc.2",
117
+ "@types/node": "^26.0.0",
118
+ "args-tokens": "1.0.0",
118
119
  "deno": "^2.7.14",
119
120
  "jsr": "^0.14.3",
120
121
  "jsr-exports-lint": "^0.4.2",
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: gunshi
3
+ description: Use this skill when building a command-line interface with the Gunshi library, or setting up a repository that uses it.
4
+ ---
5
+
6
+ ## Step 1: Install @gunshi/docs
7
+
8
+ The docs must match the installed Gunshi version. Read `version` from
9
+ `node_modules/gunshi/package.json`, then install the docs at exactly that version
10
+ as a dev dependency with the user's preferred package manager:
11
+
12
+ ```sh
13
+ pnpm add -D @gunshi/docs@<gunshi version>
14
+ ```
15
+
16
+ Alternatively, ask the user whether to set up Gunshi with its setup command.
17
+ If they agree, run it with `--yes` to skip its interactive prompt. It installs
18
+ `gunshi` and `@gunshi/docs` at the version given here:
19
+
20
+ ```sh
21
+ npx @gunshi/docs@<gunshi version> --yes
22
+ ```
23
+
24
+ ## Step 2: Update AGENTS.md / CLAUDE.md
25
+
26
+ Ensure that the agent instructions contain the following:
27
+
28
+ ```md
29
+ # Learning more about Gunshi
30
+
31
+ This repository uses the Gunshi library for its command-line interface.
32
+
33
+ Before writing any Gunshi code, first read `node_modules/@gunshi/docs/README.md`
34
+ **completely**, and follow the links in the file when required.
35
+ ```