gunshi 0.37.3 → 1.0.0-beta.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.d.ts +2 -7
- package/lib/bone.d.ts +3 -16
- package/lib/bone.js +1 -1
- package/lib/{cli-BnmSo-DW.js → builtin-CMCjNe-j.js} +34 -14
- package/lib/combinators.d.ts +740 -86
- package/lib/combinators.js +33 -327
- package/lib/{context-CAPhwgJJ.js → context-CSecf6R5.js} +1 -1
- package/lib/context.d.ts +4 -21
- package/lib/context.js +1 -1
- package/lib/core-C-EvVI4v.js +887 -0
- package/lib/definition.d.ts +6 -10
- package/lib/definition.js +7 -3
- package/lib/{error-DHF6LJCG.d.ts → error-e_--t4mB.d.ts} +57 -8
- package/lib/{error-B5QxSzk9.js → error-wB83kWiv.js} +64 -4
- package/lib/generator.d.ts +1 -3
- package/lib/generator.js +4 -4
- package/lib/index.d.ts +4 -17
- package/lib/index.js +13 -7
- package/lib/{plugin-DneW3Toi.js → plugin-CG94VzCl.js} +2 -1
- package/lib/plugin.d.ts +4 -12
- package/lib/plugin.js +5 -5
- package/lib/renderer.d.ts +1 -14
- package/lib/renderer.js +1 -1
- package/lib/{resolver-CbDvcwY3.d.ts → resolver-BezrTUr7.d.ts} +200 -66
- package/lib/{resolver-D5skgYcF.js → resolver-CAlgxe_R-y4BytVTg.js} +442 -84
- package/lib/{src-80_afJQM.js → src-BI37Q7Wx.js} +228 -51
- package/lib/{types-H9nag_2Z.d.ts → types-lD5uzpd5.d.ts} +56 -42
- package/lib/{utils-DbRhwNIU.js → utils-CJLgPw25.js} +1 -1
- package/lib/utils.d.ts +24 -10
- package/lib/utils.js +56 -10
- package/package.json +9 -9
- package/lib/core-CLzX86kY.js +0 -519
package/lib/agent.d.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
//#region ../../node_modules/.pnpm/std-env@4.1.0/node_modules/std-env/dist/index.d.mts
|
|
2
2
|
//#region src/agents.d.ts
|
|
3
3
|
/**
|
|
4
|
-
* Represents the name of an AI coding agent.
|
|
5
|
-
*/
|
|
4
|
+
* Represents the name of an AI coding agent.
|
|
5
|
+
*/
|
|
6
6
|
type AgentName = (string & {}) | "cursor" | "claude" | "devin" | "replit" | "gemini" | "codex" | "auggie" | "opencode" | "kiro" | "goose" | "pi";
|
|
7
|
-
/**
|
|
8
|
-
* Provides information about an AI coding agent.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
7
|
//#endregion
|
|
12
8
|
//#region src/agent.d.ts
|
|
13
|
-
|
|
14
9
|
/**
|
|
15
10
|
* A profile that summarizes whether the current process is running on an
|
|
16
11
|
* AI coding agent.
|
package/lib/bone.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { i as Args, l as ArgToken, n as ArgSchema, r as ArgValues } from "./resolver-
|
|
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-
|
|
3
|
-
|
|
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";
|
|
4
3
|
//#region src/cli/bone.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
7
|
-
* @license MIT
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
4
|
/**
|
|
11
5
|
* Run the command.
|
|
12
6
|
*
|
|
@@ -47,11 +41,4 @@ declare function cli<E extends ExtendContext = ExtendContext, G extends GunshiPa
|
|
|
47
41
|
*/
|
|
48
42
|
declare function cli<G extends GunshiParams = DefaultGunshiParams>(args: string[], entry: Command<G> | CommandRunner<G> | LazyCommand<G>, options?: CliOptions<G>): Promise<string | undefined>;
|
|
49
43
|
//#endregion
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
53
|
-
* @license MIT
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
//#endregion
|
|
57
|
-
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, MergeGunshiExtensions, NormalizeToGunshiParams, Prettify, RendererDecorator, RenderingOptions, SubCommandable, ValidationErrorsDecorator, cli };
|
|
44
|
+
export { type ArgSchema, type ArgToken, type ArgValues, type Args, type Awaitable, type CliOptions, type Command, type CommandCallMode, type CommandContext, type CommandContextCore, type CommandContextExtension, type CommandDecorator, type CommandEnvironment, type CommandExamplesFetcher, type CommandLoader, type CommandRunner, type Commandable, type DefaultGunshiParams, type ExtendContext, type ExtractArgExplicitlyProvided, type ExtractArgs, type ExtractExtensions, type GunshiParams, type GunshiParamsConstraint, type LazyCommand, type MergeGunshiExtensions, type NormalizeToGunshiParams, type Prettify, type RendererDecorator, type RenderingOptions, type SubCommandable, type ValidationErrorsDecorator, cli };
|
package/lib/bone.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as plugin } from "./plugin-
|
|
3
|
-
import { a as namespacedId, o as COMMON_ARGS, t as renderer } from "./src-
|
|
4
|
-
import { t as cliCore } from "./core-
|
|
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-BI37Q7Wx.js";
|
|
4
|
+
import { t as cliCore } from "./core-C-EvVI4v.js";
|
|
5
5
|
//#region ../plugin-global/src/types.ts
|
|
6
6
|
/**
|
|
7
7
|
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
@@ -24,16 +24,21 @@ const pluginId = namespacedId("global");
|
|
|
24
24
|
* @returns A command decorator that adds global options handling
|
|
25
25
|
*/
|
|
26
26
|
const decorator = (baseRunner) => async (ctx) => {
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* NOTE(kazupon): the core puts the globals still in effect on `env.globalOptions`. A command that
|
|
29
|
+
* declares the same name — even with an identical schema — is not in that map, so `--version` /
|
|
30
|
+
* `--help` belong to the command.
|
|
31
|
+
*/
|
|
32
|
+
const { values, validationError, env: { globalOptions }, extensions: { [pluginId]: { showVersion, showHeader, showUsage, showValidationErrors } } } = ctx;
|
|
28
33
|
if (hasPriorityValidationError(validationError)) {
|
|
29
34
|
await showValidationErrors(validationError);
|
|
30
35
|
throw validationError;
|
|
31
36
|
}
|
|
32
|
-
if (values.version) return showVersion();
|
|
37
|
+
if (values.version && globalOptions?.has("version")) return showVersion();
|
|
33
38
|
const buf = [];
|
|
34
39
|
const header = await showHeader();
|
|
35
40
|
if (header) buf.push(header);
|
|
36
|
-
if (values.help) {
|
|
41
|
+
if (values.help && globalOptions?.has("help")) {
|
|
37
42
|
const usage = await showUsage();
|
|
38
43
|
if (usage) {
|
|
39
44
|
buf.push(usage);
|
|
@@ -160,14 +165,29 @@ function global() {
|
|
|
160
165
|
* @returns A rendered usage or undefined. if you will use {@linkcode CliOptions.usageSilent} option, it will return rendered usage string.
|
|
161
166
|
*/
|
|
162
167
|
async function cli(args, entry, options = {}) {
|
|
163
|
-
|
|
164
|
-
return cliCore(args, entry, options, builtInPlugins);
|
|
168
|
+
return cliCore(args, entry, options, createBuiltInPlugins());
|
|
165
169
|
}
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region src/cli.ts
|
|
168
170
|
/**
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
+
* Render the usage of a command, without running it.
|
|
172
|
+
*
|
|
173
|
+
* This is what `generate` of `gunshi/generator` is made of. It resolves the command the same way
|
|
174
|
+
* {@linkcode cli} does, with the same built-in plugins, and renders the usage of the command it
|
|
175
|
+
* arrives at, whatever that command declares as its own arguments.
|
|
176
|
+
*
|
|
177
|
+
* @internal
|
|
178
|
+
*
|
|
179
|
+
* @typeParam G - A type extending {@linkcode GunshiParams} to specify the shape of command and cli options.
|
|
180
|
+
*
|
|
181
|
+
* @param args - Command line arguments, which name the command to render
|
|
182
|
+
* @param entry - A {@link Command | entry command}, an {@link CommandRunner | inline command runner}, or a {@link LazyCommand | lazily-loaded command}
|
|
183
|
+
* @param options - A {@link CliOptions | CLI options}
|
|
184
|
+
* @returns A rendered usage, or `undefined` if there is no usage renderer to render it
|
|
171
185
|
*/
|
|
186
|
+
async function cliUsage(args, entry, options = {}) {
|
|
187
|
+
return cliCore(args, entry, options, createBuiltInPlugins(), true);
|
|
188
|
+
}
|
|
189
|
+
function createBuiltInPlugins() {
|
|
190
|
+
return [global(), renderer()];
|
|
191
|
+
}
|
|
172
192
|
//#endregion
|
|
173
|
-
export { cli as t };
|
|
193
|
+
export { cliUsage as n, cli as t };
|