import { PadroneSchema } from "../types/schema.mjs"; import { CommandTypesBase } from "../types/command.mjs"; import { DefineCommandBuilder, DefineCommandContext, PadroneBuilder, PadroneProgram } from "../types/builder.mjs"; import { buildReplCompleter } from "./commands.mjs"; import { HelpCommand } from "../extension/help.mjs"; import { VersionCommand } from "../extension/version.mjs"; import { asyncSchema } from "./results.mjs"; //#region src/core/create.d.ts /** * Options for configuring which built-in extensions are applied by default. */ type PadroneBuiltins = { /** Enable `help` command, `--help` / `-h` flags, and default help display. Defaults to `true`. */help?: boolean; /** Enable `version` command and `--version` / `-v` / `-V` flags. Defaults to `true`. */ version?: boolean; /** Enable `repl` command and `--repl` flag. Defaults to `true`. */ repl?: boolean; /** Enable `--color` / `--no-color` flag support. Defaults to `true`. */ color?: boolean; /** Enable "Did you mean?" suggestions for unknown commands and options. Defaults to `true`. */ suggestions?: boolean; /** Enable signal handling (SIGINT, SIGTERM, SIGHUP). Defaults to `true`. */ signal?: boolean; /** Enable automatic result output for `cli()`. Defaults to `true`. */ autoOutput?: boolean; /** Enable stdin piping support. Defaults to `true`. */ stdin?: boolean; /** Enable interactive prompting for missing arguments. Defaults to `true`. */ interactive?: boolean; }; type PadroneOptions = { builtins?: PadroneBuiltins; }; type DefaultBuiltins = {}; type BuiltinCommands = [...(B extends { help: false; } ? [] : [HelpCommand]), ...(B extends { version: false; } ? [] : [VersionCommand])]; declare function createPadrone(name: TProgramName, options?: { builtins?: TBuiltins; }): PadroneProgram, void, BuiltinCommands>; /** * Identity helper that contextually types a command builder callback while preserving its full return type. * Use this when defining commands in separate files — the parent program retains exact type information * about the subcommand's args, result, and nested commands. * * The builder's context includes `DefineCommandContext` by default (optional `logger`, `tracing`, `progress`). * Override globally via module augmentation on `DefineCommandContext`, or per-command via `.requires()`. * * @example Direct form (most common) * ```ts * export const myCommand = defineCommand((c) => * c.arguments(z.object({ name: z.string() })) * .action((args) => console.log(args.name)) * ); * ``` * * @example With required interceptor context * ```ts * export const adminCommand = defineCommand() * .requires<{ adminDb: AdminDB }>() * .define((c) => c.action((_args, ctx) => ctx.context.adminDb.query(...))); * ``` */ declare function defineCommand(fn: (builder: PadroneBuilder, void, [], any, false, TContext, DefineCommandContext>) => TOut): typeof fn; declare function defineCommand(): DefineCommandBuilder; //#endregion export { PadroneBuiltins, PadroneOptions, createPadrone, defineCommand }; //# sourceMappingURL=create.d.mts.map