padrone 1.7.1 → 1.8.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/CHANGELOG.md +26 -0
- package/README.md +3 -2
- package/dist/{args-Cnq0nwSM.mjs → args-DrCXxXeP.mjs} +20 -4
- package/dist/args-DrCXxXeP.mjs.map +1 -0
- package/dist/codegen/index.mjs +1 -1
- package/dist/{commands-B_gufyR9.mjs → commands-DLR0rFgq.mjs} +2 -2
- package/dist/{commands-B_gufyR9.mjs.map → commands-DLR0rFgq.mjs.map} +1 -1
- package/dist/{completion-BEuflbDO.mjs → completion-UnBKfGuk.mjs} +2 -2
- package/dist/{completion-BEuflbDO.mjs.map → completion-UnBKfGuk.mjs.map} +1 -1
- package/dist/docs/index.d.mts +1 -1
- package/dist/docs/index.mjs +2 -2
- package/dist/{formatter-DrvhDMrq.d.mts → formatter-CY3KrOEd.d.mts} +3 -2
- package/dist/formatter-CY3KrOEd.d.mts.map +1 -0
- package/dist/{help-BtxLgrF_.mjs → help-B-ZMYyn-.mjs} +16 -6
- package/dist/help-B-ZMYyn-.mjs.map +1 -0
- package/dist/{index-C0Tab27T.d.mts → index-Guyz-CBm.d.mts} +340 -116
- package/dist/index-Guyz-CBm.d.mts.map +1 -0
- package/dist/index.d.mts +17 -160
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +227 -102
- package/dist/index.mjs.map +1 -1
- package/dist/{mcp-6-Jw4Bpq.mjs → mcp-D6PdtjIs.mjs} +4 -4
- package/dist/{mcp-6-Jw4Bpq.mjs.map → mcp-D6PdtjIs.mjs.map} +1 -1
- package/dist/{serve-YVTPzBCl.mjs → serve-PaCLsNoD.mjs} +4 -4
- package/dist/{serve-YVTPzBCl.mjs.map → serve-PaCLsNoD.mjs.map} +1 -1
- package/dist/test.d.mts +1 -1
- package/dist/zod.d.mts +1 -1
- package/package.json +3 -3
- package/src/core/args.ts +24 -1
- package/src/core/create.ts +21 -14
- package/src/core/exec.ts +87 -46
- package/src/core/interceptors.ts +107 -7
- package/src/core/program-methods.ts +12 -2
- package/src/core/validate.ts +26 -7
- package/src/extension/auto-output.ts +1 -1
- package/src/extension/config.ts +2 -1
- package/src/extension/env.ts +5 -4
- package/src/extension/index.ts +1 -0
- package/src/extension/interactive.ts +2 -1
- package/src/extension/logger.ts +1 -1
- package/src/extension/progress-renderer.ts +3 -0
- package/src/extension/progress.ts +37 -3
- package/src/extension/tracing.ts +1 -1
- package/src/index.ts +6 -1
- package/src/output/formatter.ts +6 -1
- package/src/output/help.ts +15 -3
- package/src/types/args-meta.ts +10 -0
- package/src/types/builder.ts +75 -2
- package/src/types/index.ts +3 -0
- package/src/types/interceptor.ts +26 -12
- package/src/util/type-utils.ts +22 -0
- package/dist/args-Cnq0nwSM.mjs.map +0 -1
- package/dist/formatter-DrvhDMrq.d.mts.map +0 -1
- package/dist/help-BtxLgrF_.mjs.map +0 -1
- package/dist/index-C0Tab27T.d.mts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ColorConfig, n as HelpFormat, o as ColorTheme, t as HelpDetail } from "./formatter-
|
|
1
|
+
import { a as ColorConfig, n as HelpFormat, o as ColorTheme, t as HelpDetail } from "./formatter-CY3KrOEd.mjs";
|
|
2
2
|
import { StandardJSONSchemaV1, StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
3
|
import { Tool } from "ai";
|
|
4
4
|
|
|
@@ -12,6 +12,16 @@ interface PadroneFieldMeta {
|
|
|
12
12
|
flags?: readonly SingleChar[] | SingleChar;
|
|
13
13
|
/** Multi-character alternative long names. Used with double dash (e.g. `--dry-run` for `--dryRun`). */
|
|
14
14
|
alias?: readonly string[] | string;
|
|
15
|
+
/**
|
|
16
|
+
* Custom negative keyword(s) for boolean options. When provided, `--<keyword>` sets this option to `false`.
|
|
17
|
+
* Disables the default `--no-<option>` negation prefix. Set to `''` or `[]` to only disable the prefix.
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* local: z.boolean().default(true).meta({ negative: 'remote' })
|
|
21
|
+
* // --remote sets local to false, --no-local is disabled
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
negative?: readonly string[] | string;
|
|
15
25
|
deprecated?: boolean | string;
|
|
16
26
|
hidden?: boolean;
|
|
17
27
|
examples?: readonly unknown[];
|
|
@@ -322,105 +332,6 @@ type ResolvedPadroneRuntime = Required<Omit<PadroneRuntime, 'prompt' | 'interact
|
|
|
322
332
|
*/
|
|
323
333
|
declare const REPL_SIGINT: unique symbol;
|
|
324
334
|
//#endregion
|
|
325
|
-
//#region src/feature/mcp.d.ts
|
|
326
|
-
type PadroneMcpPreferences = {
|
|
327
|
-
/** Server name. Defaults to the program name. */name?: string; /** Server version. Defaults to the program version. */
|
|
328
|
-
version?: string;
|
|
329
|
-
/**
|
|
330
|
-
* Transport mode.
|
|
331
|
-
* - `'http'` — Start a Streamable HTTP server (default). Responds with `application/json` or `text/event-stream` based on the client's `Accept` header. Use `port` and `host` to configure.
|
|
332
|
-
* - `'stdio'` — Communicate over stdin/stdout with newline-delimited JSON.
|
|
333
|
-
*/
|
|
334
|
-
transport?: 'http' | 'stdio'; /** HTTP port. Defaults to `3000`. Only used with `transport: 'http'`. */
|
|
335
|
-
port?: number; /** HTTP host. Defaults to `'127.0.0.1'`. Only used with `transport: 'http'`. */
|
|
336
|
-
host?: string; /** Base path for the MCP endpoint. Defaults to `'/mcp'`. Only used with `transport: 'http'`. */
|
|
337
|
-
basePath?: string; /** CORS allowed origin. Defaults to `'*'`. Set to a specific origin or `false` to disable CORS headers. Only used with HTTP transports. */
|
|
338
|
-
cors?: string | false;
|
|
339
|
-
};
|
|
340
|
-
//#endregion
|
|
341
|
-
//#region src/feature/serve.d.ts
|
|
342
|
-
type PadroneServePreferences = {
|
|
343
|
-
/** Port to listen on. Default: 3000 */port?: number; /** Host to bind to. Default: '127.0.0.1' */
|
|
344
|
-
host?: string; /** Base path prefix for all routes. Default: '/' */
|
|
345
|
-
basePath?: string; /** CORS allowed origin. Default: '*'. Set to `false` to disable CORS headers. */
|
|
346
|
-
cors?: string | false; /** Control built-in utility endpoints. All enabled by default. */
|
|
347
|
-
builtins?: {
|
|
348
|
-
/** GET /_health — returns 200 OK. */health?: boolean; /** GET /_help and GET /_help/:command — returns help text. */
|
|
349
|
-
help?: boolean; /** GET /_schema and GET /_schema/:command — returns JSON Schema. */
|
|
350
|
-
schema?: boolean; /** GET /_docs — Scalar OpenAPI docs viewer. */
|
|
351
|
-
docs?: boolean;
|
|
352
|
-
}; /** Hook to run before each request. Return a Response to short-circuit. */
|
|
353
|
-
onRequest?: (req: Request) => Response | void | Promise<Response | void>; /** Transform errors into responses. */
|
|
354
|
-
onError?: (error: unknown, req: Request) => Response;
|
|
355
|
-
};
|
|
356
|
-
//#endregion
|
|
357
|
-
//#region src/feature/wrap.d.ts
|
|
358
|
-
/**
|
|
359
|
-
* Configuration for wrapping an external CLI tool.
|
|
360
|
-
*/
|
|
361
|
-
type WrapConfig<TCommandArgs extends PadroneSchema = PadroneSchema, TWrapArgs extends PadroneSchema = TCommandArgs> = {
|
|
362
|
-
/**
|
|
363
|
-
* The command to execute (e.g., 'git', 'docker', 'npm').
|
|
364
|
-
*/
|
|
365
|
-
command: string;
|
|
366
|
-
/**
|
|
367
|
-
* Optional fixed arguments that always precede the arguments (e.g., ['commit'] for 'git commit').
|
|
368
|
-
*/
|
|
369
|
-
args?: string[];
|
|
370
|
-
/**
|
|
371
|
-
* Positional argument configuration for the external command.
|
|
372
|
-
* If not provided, defaults to the wrapping command's positional configuration.
|
|
373
|
-
*/
|
|
374
|
-
positional?: string[];
|
|
375
|
-
/**
|
|
376
|
-
* Whether to inherit stdio streams (stdin, stdout, stderr) from the parent process.
|
|
377
|
-
* Default: true
|
|
378
|
-
*/
|
|
379
|
-
inheritStdio?: boolean;
|
|
380
|
-
/**
|
|
381
|
-
* Optional schema that transforms command arguments to external CLI arguments.
|
|
382
|
-
* The schema's input type should match the command arguments, and its output type defines
|
|
383
|
-
* the arguments expected by the external command.
|
|
384
|
-
* If not provided, command arguments are passed through as-is.
|
|
385
|
-
*/
|
|
386
|
-
schema?: TWrapArgs | ((commandArguments: TCommandArgs) => TWrapArgs);
|
|
387
|
-
};
|
|
388
|
-
/**
|
|
389
|
-
* Result from executing a wrapped CLI tool.
|
|
390
|
-
*/
|
|
391
|
-
type WrapResult = {
|
|
392
|
-
/**
|
|
393
|
-
* The exit code of the process.
|
|
394
|
-
*/
|
|
395
|
-
exitCode: number;
|
|
396
|
-
/**
|
|
397
|
-
* Standard output from the process (only if inheritStdio is false).
|
|
398
|
-
*/
|
|
399
|
-
stdout?: string;
|
|
400
|
-
/**
|
|
401
|
-
* Standard error from the process (only if inheritStdio is false).
|
|
402
|
-
*/
|
|
403
|
-
stderr?: string;
|
|
404
|
-
/**
|
|
405
|
-
* Whether the process exited successfully (exit code 0).
|
|
406
|
-
*/
|
|
407
|
-
success: boolean;
|
|
408
|
-
};
|
|
409
|
-
//#endregion
|
|
410
|
-
//#region src/output/help.d.ts
|
|
411
|
-
type HelpPreferences = {
|
|
412
|
-
format?: HelpFormat | 'auto';
|
|
413
|
-
detail?: HelpDetail;
|
|
414
|
-
theme?: ColorTheme | ColorConfig; /** Show all global commands and flags in full detail */
|
|
415
|
-
all?: boolean; /** Terminal width for text wrapping. Defaults to terminal columns or 80. */
|
|
416
|
-
width?: number; /** Terminal capabilities for auto-detection of ANSI and width. */
|
|
417
|
-
terminal?: {
|
|
418
|
-
columns?: number;
|
|
419
|
-
isTTY?: boolean;
|
|
420
|
-
}; /** Environment variables for auto-detection (e.g., NO_COLOR, CI). */
|
|
421
|
-
env?: Record<string, string | undefined>;
|
|
422
|
-
};
|
|
423
|
-
//#endregion
|
|
424
335
|
//#region src/types/schema.d.ts
|
|
425
336
|
/**
|
|
426
337
|
* A schema that supports both validation (StandardSchemaV1) and JSON schema generation (StandardJSONSchemaV1).
|
|
@@ -569,6 +480,25 @@ type WithInterceptor<T, TProvides> = T extends {
|
|
|
569
480
|
} ? T extends {
|
|
570
481
|
run: any;
|
|
571
482
|
} ? PadroneProgram<PN, N, PaN, A, R, C, any, AS, CTX, CTXP & TProvides> : PadroneBuilder<PN, N, PaN, A, R, C, any, AS, CTX, CTXP & TProvides> : T;
|
|
483
|
+
/**
|
|
484
|
+
* Utility type for extensions that force the builder/program into async mode.
|
|
485
|
+
* Sets `TAsync` to `true` while preserving all other type params.
|
|
486
|
+
*/
|
|
487
|
+
type WithAsync<T> = T extends {
|
|
488
|
+
'~types': {
|
|
489
|
+
programName: infer PN extends string;
|
|
490
|
+
name: infer N extends string;
|
|
491
|
+
parentName: infer PaN extends string;
|
|
492
|
+
argsSchema: infer A extends PadroneSchema;
|
|
493
|
+
result: infer R;
|
|
494
|
+
commands: infer C extends [...AnyPadroneCommand[]];
|
|
495
|
+
async: any;
|
|
496
|
+
context: infer CTX;
|
|
497
|
+
contextProvided: infer CTXP;
|
|
498
|
+
};
|
|
499
|
+
} ? T extends {
|
|
500
|
+
run: any;
|
|
501
|
+
} ? PadroneProgram<PN, N, PaN, A, R, C, any, true, CTX, CTXP> : PadroneBuilder<PN, N, PaN, A, R, C, any, true, CTX, CTXP> : T;
|
|
572
502
|
type PickCommandByName<TCommands extends AnyPadroneCommand[], TName extends string | AnyPadroneCommand> = TName extends AnyPadroneCommand ? TName : FlattenCommands<TCommands> extends infer Cmd extends AnyPadroneCommand ? Cmd extends AnyPadroneCommand ? TName extends GetCommandPathsAndAliases<Cmd> ? Cmd : never : never : never;
|
|
573
503
|
type FlattenCommands<TCommands extends AnyPadroneCommand[]> = TCommands extends [] ? never : number extends TCommands['length'] ? IsAny<TCommands[number]> extends true ? never : TCommands[number] : TCommands[number] extends infer Cmd extends AnyPadroneCommand ? Cmd | FlattenCommands<Cmd['~types']['commands']> : never;
|
|
574
504
|
/**
|
|
@@ -603,9 +533,250 @@ type RepathCommands<TCommands extends [...AnyPadroneCommand[]], TNewParentPath e
|
|
|
603
533
|
type RepathCommand<TCommand extends AnyPadroneCommand, TNewParentName extends string> = PadroneCommand<TCommand['~types']['name'], TNewParentName, TCommand['~types']['argsSchema'], TCommand['~types']['result'], RepathCommands<TCommand['~types']['commands'], FullCommandName<TCommand['~types']['name'], TNewParentName>>, TCommand['~types']['aliases'], TCommand['~types']['async'], TCommand['~types']['context'], TCommand['~types']['contextProvided']>;
|
|
604
534
|
type PickCommandByPossibleCommands<TCommands extends AnyPadroneCommand[], TCommand extends PossibleCommands<TCommands, true, true> | SafeString> = CommandIsUnknownable<TCommand> extends true ? FlattenCommands<TCommands> : TCommand extends AnyPadroneCommand ? TCommand : TCommand extends string ? TCommand extends GetCommandPathsOrAliases<TCommands> ? PickCommandByName<TCommands, TCommand> : SplitLastSpace<TCommand> extends [infer Prefix extends string, infer Rest] ? IsNever<Rest> extends true ? PickCommandByName<TCommands, Prefix> : PickCommandByPossibleCommands<TCommands, Prefix> : never : never;
|
|
605
535
|
//#endregion
|
|
536
|
+
//#region src/extension/logger.d.ts
|
|
537
|
+
/** Log level values ordered by severity. */
|
|
538
|
+
type PadroneLogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
539
|
+
/** Logger instance injected into the command context. */
|
|
540
|
+
type PadroneLogger = {
|
|
541
|
+
trace: (...args: unknown[]) => void;
|
|
542
|
+
debug: (...args: unknown[]) => void;
|
|
543
|
+
info: (...args: unknown[]) => void;
|
|
544
|
+
warn: (...args: unknown[]) => void;
|
|
545
|
+
error: (...args: unknown[]) => void; /** The current effective log level. */
|
|
546
|
+
level: PadroneLogLevel; /** Create a child logger with a prefix label. */
|
|
547
|
+
child: (label: string) => PadroneLogger;
|
|
548
|
+
};
|
|
549
|
+
/** Configuration for the logger extension. */
|
|
550
|
+
type PadroneLoggerConfig = {
|
|
551
|
+
/** Minimum log level to output. Defaults to `'info'`. */level?: PadroneLogLevel; /** Prefix prepended to every log message. */
|
|
552
|
+
prefix?: string; /** Include timestamps in log output. Defaults to `false`. */
|
|
553
|
+
timestamps?: boolean;
|
|
554
|
+
};
|
|
555
|
+
/** Builder/program type after applying `padroneLogger()`. Adds `{ logger: PadroneLogger }` to the command context. */
|
|
556
|
+
type WithLogger<T> = WithInterceptor<T, {
|
|
557
|
+
logger: PadroneLogger;
|
|
558
|
+
}>;
|
|
559
|
+
/**
|
|
560
|
+
* Extension that injects a structured logger into the command context.
|
|
561
|
+
*
|
|
562
|
+
* The logger respects a configurable log level threshold, supports prefixed
|
|
563
|
+
* child loggers, and routes output through the runtime's `output`/`error`
|
|
564
|
+
* functions so it works in any environment (terminal, test, web).
|
|
565
|
+
*
|
|
566
|
+
* Supports CLI flags for runtime level overrides:
|
|
567
|
+
* - `--trace` → sets level to `trace`
|
|
568
|
+
* - `--verbose` or `--debug` → sets level to `debug`
|
|
569
|
+
* - `--silent` or `--quiet` → sets level to `silent`
|
|
570
|
+
* - `--log-level=<level>` → sets an explicit level (`trace`, `debug`, `info`, `warn`, `error`, `silent`)
|
|
571
|
+
*
|
|
572
|
+
* CLI flags take precedence over the programmatic config.
|
|
573
|
+
*
|
|
574
|
+
* Provides `{ logger: PadroneLogger }` on the command context.
|
|
575
|
+
* Access it in action handlers as `ctx.context.logger`.
|
|
576
|
+
*
|
|
577
|
+
* Usage:
|
|
578
|
+
* ```ts
|
|
579
|
+
* createPadrone('my-cli')
|
|
580
|
+
* .extend(padroneLogger({ level: 'info' }))
|
|
581
|
+
* .command('sync', (c) =>
|
|
582
|
+
* c.action((_args, ctx) => {
|
|
583
|
+
* ctx.context.logger.info('starting sync');
|
|
584
|
+
* const db = ctx.context.logger.child('db');
|
|
585
|
+
* db.debug('connecting...');
|
|
586
|
+
* })
|
|
587
|
+
* )
|
|
588
|
+
* ```
|
|
589
|
+
*
|
|
590
|
+
* Then run:
|
|
591
|
+
* ```sh
|
|
592
|
+
* my-cli sync --verbose # debug level
|
|
593
|
+
* my-cli sync --quiet # silent
|
|
594
|
+
* my-cli sync --log-level=warn
|
|
595
|
+
* ```
|
|
596
|
+
*/
|
|
597
|
+
declare function padroneLogger<T extends CommandTypesBase>(config?: PadroneLoggerConfig): (builder: T) => WithLogger<T>;
|
|
598
|
+
//#endregion
|
|
599
|
+
//#region src/extension/tracing.d.ts
|
|
600
|
+
/** Minimal subset of OTEL `SpanStatusCode`. */
|
|
601
|
+
type SpanStatusCode = 0 | 1 | 2;
|
|
602
|
+
/** Minimal subset of OTEL `SpanStatus`. */
|
|
603
|
+
type SpanStatus = {
|
|
604
|
+
code: SpanStatusCode;
|
|
605
|
+
message?: string;
|
|
606
|
+
};
|
|
607
|
+
/** Minimal subset of OTEL `Span`. */
|
|
608
|
+
interface OtelSpan {
|
|
609
|
+
setAttribute(key: string, value: string | number | boolean): this;
|
|
610
|
+
addEvent(name: string, attributes?: Record<string, string | number | boolean>): this;
|
|
611
|
+
setStatus(status: SpanStatus): this;
|
|
612
|
+
recordException(error: unknown): this;
|
|
613
|
+
end(): void;
|
|
614
|
+
spanContext(): {
|
|
615
|
+
traceId: string;
|
|
616
|
+
spanId: string;
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
/** Minimal subset of OTEL `Tracer`. */
|
|
620
|
+
interface OtelTracer {
|
|
621
|
+
startSpan(name: string): OtelSpan;
|
|
622
|
+
}
|
|
623
|
+
/** Minimal subset of OTEL `TracerProvider`. */
|
|
624
|
+
interface OtelTracerProvider {
|
|
625
|
+
getTracer(name: string, version?: string): OtelTracer;
|
|
626
|
+
}
|
|
627
|
+
/** Tracing handle injected into the command context. */
|
|
628
|
+
type PadroneTracer = {
|
|
629
|
+
/** The underlying OTEL tracer. */tracer: OtelTracer; /** Root span covering the full command execution. */
|
|
630
|
+
rootSpan: OtelSpan; /** Run `fn` inside a child span that is automatically ended when `fn` returns (or rejects). */
|
|
631
|
+
span: <T>(name: string, fn: (span: OtelSpan) => T) => T;
|
|
632
|
+
};
|
|
633
|
+
/** Configuration for the tracing extension. */
|
|
634
|
+
type PadroneTracingConfig = {
|
|
635
|
+
/** OTEL `TracerProvider`. Required — there is no global fallback. */provider: OtelTracerProvider; /** Service / tracer name. Defaults to the CLI program name. */
|
|
636
|
+
serviceName?: string;
|
|
637
|
+
};
|
|
638
|
+
/** Builder/program type after applying `padroneTracing()`. Adds `{ tracing: PadroneTracer }` to the command context. */
|
|
639
|
+
type WithTracing<T> = WithInterceptor<T, {
|
|
640
|
+
tracing: PadroneTracer;
|
|
641
|
+
}>;
|
|
642
|
+
/**
|
|
643
|
+
* Extension that adds OpenTelemetry tracing to command execution.
|
|
644
|
+
*
|
|
645
|
+
* Creates a root span for each command invocation and provides a `PadroneTracer`
|
|
646
|
+
* on the command context for creating child spans in action handlers.
|
|
647
|
+
*
|
|
648
|
+
* When used with `padroneLogger()`, the logger automatically emits span events
|
|
649
|
+
* for each log call — no extra configuration needed. The logger detects the
|
|
650
|
+
* tracing context and bridges log output to span events.
|
|
651
|
+
*
|
|
652
|
+
* Uses minimal OTEL-compatible interfaces — pass any `TracerProvider` that
|
|
653
|
+
* implements `getTracer()`. Works with `@opentelemetry/api` or compatible
|
|
654
|
+
* libraries.
|
|
655
|
+
*
|
|
656
|
+
* Provides `{ tracing: PadroneTracer }` on the command context.
|
|
657
|
+
* Access it in action handlers as `ctx.context.tracing`.
|
|
658
|
+
*
|
|
659
|
+
* Usage:
|
|
660
|
+
* ```ts
|
|
661
|
+
* import { trace } from '@opentelemetry/api';
|
|
662
|
+
*
|
|
663
|
+
* createPadrone('my-cli')
|
|
664
|
+
* .extend(padroneTracing({ provider: trace.getTracerProvider() }))
|
|
665
|
+
* .extend(padroneLogger())
|
|
666
|
+
* .command('deploy', (c) =>
|
|
667
|
+
* c.action((_args, ctx) => {
|
|
668
|
+
* ctx.context.logger.info('deploying'); // also emits a span event
|
|
669
|
+
* ctx.context.tracing.span('build', (span) => {
|
|
670
|
+
* span.setAttribute('target', 'production');
|
|
671
|
+
* });
|
|
672
|
+
* })
|
|
673
|
+
* )
|
|
674
|
+
* ```
|
|
675
|
+
*/
|
|
676
|
+
declare function padroneTracing<T extends CommandTypesBase>(config: PadroneTracingConfig): (builder: T) => WithTracing<T>;
|
|
677
|
+
//#endregion
|
|
678
|
+
//#region src/feature/mcp.d.ts
|
|
679
|
+
type PadroneMcpPreferences = {
|
|
680
|
+
/** Server name. Defaults to the program name. */name?: string; /** Server version. Defaults to the program version. */
|
|
681
|
+
version?: string;
|
|
682
|
+
/**
|
|
683
|
+
* Transport mode.
|
|
684
|
+
* - `'http'` — Start a Streamable HTTP server (default). Responds with `application/json` or `text/event-stream` based on the client's `Accept` header. Use `port` and `host` to configure.
|
|
685
|
+
* - `'stdio'` — Communicate over stdin/stdout with newline-delimited JSON.
|
|
686
|
+
*/
|
|
687
|
+
transport?: 'http' | 'stdio'; /** HTTP port. Defaults to `3000`. Only used with `transport: 'http'`. */
|
|
688
|
+
port?: number; /** HTTP host. Defaults to `'127.0.0.1'`. Only used with `transport: 'http'`. */
|
|
689
|
+
host?: string; /** Base path for the MCP endpoint. Defaults to `'/mcp'`. Only used with `transport: 'http'`. */
|
|
690
|
+
basePath?: string; /** CORS allowed origin. Defaults to `'*'`. Set to a specific origin or `false` to disable CORS headers. Only used with HTTP transports. */
|
|
691
|
+
cors?: string | false;
|
|
692
|
+
};
|
|
693
|
+
//#endregion
|
|
694
|
+
//#region src/feature/serve.d.ts
|
|
695
|
+
type PadroneServePreferences = {
|
|
696
|
+
/** Port to listen on. Default: 3000 */port?: number; /** Host to bind to. Default: '127.0.0.1' */
|
|
697
|
+
host?: string; /** Base path prefix for all routes. Default: '/' */
|
|
698
|
+
basePath?: string; /** CORS allowed origin. Default: '*'. Set to `false` to disable CORS headers. */
|
|
699
|
+
cors?: string | false; /** Control built-in utility endpoints. All enabled by default. */
|
|
700
|
+
builtins?: {
|
|
701
|
+
/** GET /_health — returns 200 OK. */health?: boolean; /** GET /_help and GET /_help/:command — returns help text. */
|
|
702
|
+
help?: boolean; /** GET /_schema and GET /_schema/:command — returns JSON Schema. */
|
|
703
|
+
schema?: boolean; /** GET /_docs — Scalar OpenAPI docs viewer. */
|
|
704
|
+
docs?: boolean;
|
|
705
|
+
}; /** Hook to run before each request. Return a Response to short-circuit. */
|
|
706
|
+
onRequest?: (req: Request) => Response | void | Promise<Response | void>; /** Transform errors into responses. */
|
|
707
|
+
onError?: (error: unknown, req: Request) => Response;
|
|
708
|
+
};
|
|
709
|
+
//#endregion
|
|
710
|
+
//#region src/feature/wrap.d.ts
|
|
711
|
+
/**
|
|
712
|
+
* Configuration for wrapping an external CLI tool.
|
|
713
|
+
*/
|
|
714
|
+
type WrapConfig<TCommandArgs extends PadroneSchema = PadroneSchema, TWrapArgs extends PadroneSchema = TCommandArgs> = {
|
|
715
|
+
/**
|
|
716
|
+
* The command to execute (e.g., 'git', 'docker', 'npm').
|
|
717
|
+
*/
|
|
718
|
+
command: string;
|
|
719
|
+
/**
|
|
720
|
+
* Optional fixed arguments that always precede the arguments (e.g., ['commit'] for 'git commit').
|
|
721
|
+
*/
|
|
722
|
+
args?: string[];
|
|
723
|
+
/**
|
|
724
|
+
* Positional argument configuration for the external command.
|
|
725
|
+
* If not provided, defaults to the wrapping command's positional configuration.
|
|
726
|
+
*/
|
|
727
|
+
positional?: string[];
|
|
728
|
+
/**
|
|
729
|
+
* Whether to inherit stdio streams (stdin, stdout, stderr) from the parent process.
|
|
730
|
+
* Default: true
|
|
731
|
+
*/
|
|
732
|
+
inheritStdio?: boolean;
|
|
733
|
+
/**
|
|
734
|
+
* Optional schema that transforms command arguments to external CLI arguments.
|
|
735
|
+
* The schema's input type should match the command arguments, and its output type defines
|
|
736
|
+
* the arguments expected by the external command.
|
|
737
|
+
* If not provided, command arguments are passed through as-is.
|
|
738
|
+
*/
|
|
739
|
+
schema?: TWrapArgs | ((commandArguments: TCommandArgs) => TWrapArgs);
|
|
740
|
+
};
|
|
741
|
+
/**
|
|
742
|
+
* Result from executing a wrapped CLI tool.
|
|
743
|
+
*/
|
|
744
|
+
type WrapResult = {
|
|
745
|
+
/**
|
|
746
|
+
* The exit code of the process.
|
|
747
|
+
*/
|
|
748
|
+
exitCode: number;
|
|
749
|
+
/**
|
|
750
|
+
* Standard output from the process (only if inheritStdio is false).
|
|
751
|
+
*/
|
|
752
|
+
stdout?: string;
|
|
753
|
+
/**
|
|
754
|
+
* Standard error from the process (only if inheritStdio is false).
|
|
755
|
+
*/
|
|
756
|
+
stderr?: string;
|
|
757
|
+
/**
|
|
758
|
+
* Whether the process exited successfully (exit code 0).
|
|
759
|
+
*/
|
|
760
|
+
success: boolean;
|
|
761
|
+
};
|
|
762
|
+
//#endregion
|
|
763
|
+
//#region src/output/help.d.ts
|
|
764
|
+
type HelpPreferences = {
|
|
765
|
+
format?: HelpFormat | 'auto';
|
|
766
|
+
detail?: HelpDetail;
|
|
767
|
+
theme?: ColorTheme | ColorConfig; /** Show all global commands and flags in full detail */
|
|
768
|
+
all?: boolean; /** Terminal width for text wrapping. Defaults to terminal columns or 80. */
|
|
769
|
+
width?: number; /** Terminal capabilities for auto-detection of ANSI and width. */
|
|
770
|
+
terminal?: {
|
|
771
|
+
columns?: number;
|
|
772
|
+
isTTY?: boolean;
|
|
773
|
+
}; /** Environment variables for auto-detection (e.g., NO_COLOR, CI). */
|
|
774
|
+
env?: Record<string, string | undefined>;
|
|
775
|
+
};
|
|
776
|
+
//#endregion
|
|
606
777
|
//#region src/types/interceptor.d.ts
|
|
607
778
|
/** Base context shared across all interceptor phases within a single execution. */
|
|
608
|
-
type InterceptorBaseContext<TContext =
|
|
779
|
+
type InterceptorBaseContext<TContext = object> = {
|
|
609
780
|
/** The resolved command for this execution. In the parse phase, this is the root program. */command: AnyPadroneCommand; /** The raw CLI input string (undefined when invoked without input). */
|
|
610
781
|
input: string | undefined; /** Cancellation signal that fires when the process receives a termination signal. */
|
|
611
782
|
signal: AbortSignal; /** User-defined context object, resolved through the command's parent chain. */
|
|
@@ -615,15 +786,20 @@ type InterceptorBaseContext<TContext = unknown> = {
|
|
|
615
786
|
caller: PadroneActionContext['caller'];
|
|
616
787
|
};
|
|
617
788
|
/** Context for the parse phase. */
|
|
618
|
-
type InterceptorParseContext<TContext =
|
|
789
|
+
type InterceptorParseContext<TContext = object> = InterceptorBaseContext<TContext>;
|
|
619
790
|
/** Result returned by the parse phase's `next()`. */
|
|
620
791
|
type InterceptorParseResult = {
|
|
621
792
|
command: AnyPadroneCommand;
|
|
622
793
|
rawArgs: Record<string, unknown>;
|
|
623
794
|
positionalArgs: string[];
|
|
624
795
|
};
|
|
796
|
+
/** Context for the route phase. Runs after the target command is resolved, before validation. */
|
|
797
|
+
type InterceptorRouteContext<TContext = object> = InterceptorBaseContext<TContext> & {
|
|
798
|
+
/** Raw named arguments extracted by the parser. */rawArgs: Record<string, unknown>; /** Positional argument strings extracted by the parser. */
|
|
799
|
+
positionalArgs: string[];
|
|
800
|
+
};
|
|
625
801
|
/** Context for the validate phase. */
|
|
626
|
-
type InterceptorValidateContext<TContext =
|
|
802
|
+
type InterceptorValidateContext<TContext = object> = InterceptorBaseContext<TContext> & {
|
|
627
803
|
/** Raw named arguments extracted by the parser. Mutable — modify before `next()` to inject/override values. */rawArgs: Record<string, unknown>; /** Positional argument strings extracted by the parser. */
|
|
628
804
|
positionalArgs: string[]; /** Interactive mode override (set by the interactive extension when `--interactive` / `-i` flag is used). */
|
|
629
805
|
interactive?: boolean; /** Interactive mode preference from eval/cli options. Available for the interactive extension. */
|
|
@@ -635,7 +811,7 @@ type InterceptorValidateResult<TArgs = unknown> = {
|
|
|
635
811
|
argsResult: StandardSchemaV1.Result<TArgs>;
|
|
636
812
|
};
|
|
637
813
|
/** Context for the execute phase. Includes validate context fields (rawArgs, positionalArgs). */
|
|
638
|
-
type InterceptorExecuteContext<TArgs = unknown, TContext =
|
|
814
|
+
type InterceptorExecuteContext<TArgs = unknown, TContext = object> = InterceptorValidateContext<TContext> & {
|
|
639
815
|
/** Validated arguments that will be passed to the action. Mutable — modify before `next()` to override. */args: TArgs;
|
|
640
816
|
};
|
|
641
817
|
/** Result returned by the execute phase's `next()`. */
|
|
@@ -643,9 +819,9 @@ type InterceptorExecuteResult<TResult = unknown> = {
|
|
|
643
819
|
result: TResult;
|
|
644
820
|
};
|
|
645
821
|
/** Context for the start phase. Runs before parsing, wraps the entire pipeline. */
|
|
646
|
-
type InterceptorStartContext<TContext =
|
|
822
|
+
type InterceptorStartContext<TContext = object> = InterceptorBaseContext<TContext>;
|
|
647
823
|
/** Context for the error phase. Called when the pipeline throws. Includes pipeline state accumulated before the error. */
|
|
648
|
-
type InterceptorErrorContext<TContext =
|
|
824
|
+
type InterceptorErrorContext<TContext = object> = InterceptorBaseContext<TContext> & {
|
|
649
825
|
/** The error that was thrown. */error: unknown; /** Raw named arguments (available if parse completed). */
|
|
650
826
|
rawArgs?: Record<string, unknown>; /** Positional argument strings (available if parse completed). */
|
|
651
827
|
positionalArgs?: string[]; /** Validated arguments (available if validate completed). */
|
|
@@ -657,7 +833,7 @@ type InterceptorErrorResult<TResult = unknown> = {
|
|
|
657
833
|
result?: TResult;
|
|
658
834
|
};
|
|
659
835
|
/** Context for the shutdown phase. Always runs after the pipeline (success or failure). Includes pipeline state accumulated before completion. */
|
|
660
|
-
type InterceptorShutdownContext<TResult = unknown, TContext =
|
|
836
|
+
type InterceptorShutdownContext<TResult = unknown, TContext = object> = InterceptorBaseContext<TContext> & {
|
|
661
837
|
/** The error, if the pipeline failed (after error phase processing). */error?: unknown; /** The pipeline result, if it succeeded. */
|
|
662
838
|
result?: TResult; /** Raw named arguments (available if parse completed). */
|
|
663
839
|
rawArgs?: Record<string, unknown>; /** Positional argument strings (available if parse completed). */
|
|
@@ -708,13 +884,19 @@ type InterceptorMeta = {
|
|
|
708
884
|
* - `TArgs` — the validated arguments type (output of the args schema).
|
|
709
885
|
* - `TResult` — the command's return type.
|
|
710
886
|
*/
|
|
711
|
-
type InterceptorPhases<TArgs = unknown, TResult = unknown, TContext =
|
|
887
|
+
type InterceptorPhases<TArgs = unknown, TResult = unknown, TContext = object> = {
|
|
712
888
|
/**
|
|
713
889
|
* Runs before the pipeline (parse → validate → execute). `next()` proceeds to the pipeline.
|
|
714
890
|
* Root interceptors only. Use for startup tasks like telemetry, update checks, or global config loading.
|
|
715
891
|
*/
|
|
716
892
|
start?: InterceptorPhaseHandler<InterceptorStartContext<TContext>, unknown>; /** Intercepts command routing and raw argument extraction. */
|
|
717
|
-
parse?: InterceptorPhaseHandler<InterceptorParseContext<TContext>, InterceptorParseResult>;
|
|
893
|
+
parse?: InterceptorPhaseHandler<InterceptorParseContext<TContext>, InterceptorParseResult>;
|
|
894
|
+
/**
|
|
895
|
+
* Runs after the target command is resolved (post-parse), before validation.
|
|
896
|
+
* Use for per-command setup: authorization, resource loading, logging, etc.
|
|
897
|
+
* Root and command-level interceptors both participate.
|
|
898
|
+
*/
|
|
899
|
+
route?: InterceptorPhaseHandler<InterceptorRouteContext<TContext>, void>; /** Intercepts argument preprocessing and schema validation. Interactive prompting is handled by the interactive extension. */
|
|
718
900
|
validate?: InterceptorPhaseHandler<InterceptorValidateContext<TContext>, InterceptorValidateResult<TArgs>, InterceptorValidateResult>; /** Intercepts handler execution. */
|
|
719
901
|
execute?: InterceptorPhaseHandler<InterceptorExecuteContext<TArgs, TContext>, InterceptorExecuteResult<TResult>, InterceptorExecuteResult>;
|
|
720
902
|
/**
|
|
@@ -732,7 +914,7 @@ type InterceptorPhases<TArgs = unknown, TResult = unknown, TContext = unknown> =
|
|
|
732
914
|
* Factory function that creates phase handlers for an interceptor.
|
|
733
915
|
* Called once per command execution — the closure provides typed, scoped cross-phase state across phases.
|
|
734
916
|
*/
|
|
735
|
-
type InterceptorFactory<TArgs = unknown, TResult = unknown, TContext =
|
|
917
|
+
type InterceptorFactory<TArgs = unknown, TResult = unknown, TContext = object> = () => InterceptorPhases<TArgs, TResult, TContext>;
|
|
736
918
|
/**
|
|
737
919
|
* A self-contained interceptor value: a factory function with static metadata as own properties.
|
|
738
920
|
* Created via `defineInterceptor(meta, factory)`. This is the distributable form — a single
|
|
@@ -741,7 +923,7 @@ type InterceptorFactory<TArgs = unknown, TResult = unknown, TContext = unknown>
|
|
|
741
923
|
* Also accepted directly by `.intercept()` as the single-argument form.
|
|
742
924
|
* Call `.provides<T>()` to brand it as a context-providing interceptor.
|
|
743
925
|
*/
|
|
744
|
-
type PadroneInterceptorFn<TArgs = unknown, TResult = unknown, TContext =
|
|
926
|
+
type PadroneInterceptorFn<TArgs = unknown, TResult = unknown, TContext = object> = InterceptorFactory<TArgs, TResult, TContext> & InterceptorMeta & {
|
|
745
927
|
/** Brand this interceptor as providing additional context of type `TProvides`. No-op at runtime; purely a type-level cast. */provides: <TProvides>() => PadroneContextInterceptor<TProvides, TArgs, TResult, TContext>;
|
|
746
928
|
/**
|
|
747
929
|
* Brand this interceptor as requiring context of type `TRequires` to be available.
|
|
@@ -757,7 +939,7 @@ type PadroneInterceptorFn<TArgs = unknown, TResult = unknown, TContext = unknown
|
|
|
757
939
|
*
|
|
758
940
|
* Create with `defineInterceptor(meta, factory)` or pass `(meta, factory)` directly to `.intercept()`.
|
|
759
941
|
*/
|
|
760
|
-
type PadroneInterceptor<TArgs = unknown, TResult = unknown, TContext =
|
|
942
|
+
type PadroneInterceptor<TArgs = unknown, TResult = unknown, TContext = object> = PadroneInterceptorFn<TArgs, TResult, TContext>;
|
|
761
943
|
/**
|
|
762
944
|
* A context-providing interceptor. Carries a phantom `'~context'` brand declaring what it adds
|
|
763
945
|
* to the command context. When registered via `.intercept()`, the builder's context type is
|
|
@@ -766,7 +948,7 @@ type PadroneInterceptor<TArgs = unknown, TResult = unknown, TContext = unknown>
|
|
|
766
948
|
* Created by calling `.provides<T>()` on a `PadroneInterceptorFn`.
|
|
767
949
|
* Chain `.requires<T>()` to also declare context dependencies.
|
|
768
950
|
*/
|
|
769
|
-
type PadroneContextInterceptor<TProvides = unknown, TArgs = unknown, TResult = unknown, TContext =
|
|
951
|
+
type PadroneContextInterceptor<TProvides = unknown, TArgs = unknown, TResult = unknown, TContext = object> = Omit<PadroneInterceptorFn<TArgs, TResult, TContext>, 'requires'> & InterceptorFactory<TArgs, TResult, TContext> & {
|
|
770
952
|
/** Phantom brand — declares the context type this interceptor provides. */'~context': TProvides; /** Like `.requires()` on `PadroneInterceptorFn` but preserves the `'~context'` brand. */
|
|
771
953
|
requires: <TRequires>() => PadroneContextInterceptor<TProvides, TArgs, TResult, TContext> & InterceptorRequiresBrand<TRequires>;
|
|
772
954
|
};
|
|
@@ -1121,6 +1303,9 @@ type PadroneBuilderMethods<TProgramName extends string, TName extends string, TP
|
|
|
1121
1303
|
wrap: <TWrapArgs extends PadroneSchema = TArgs>(config: WrapConfig<TArgs, TWrapArgs>) => BuilderOrProgram<TReturn, TProgramName, TName, TParentName, TArgs, Promise<WrapResult>, TCommands, TParentArgs, TAsync, TContext, TContextProvided>; /** Add or override a subcommand. Pass a builder function to define its schema, action, and nested commands. @category Builder */
|
|
1122
1304
|
command: {
|
|
1123
1305
|
<TNameNested extends string, TAliases extends string[] = [], TBuilder extends CommandTypesBase = DefaultCommandBuilder<TProgramName, TNameNested, FullCommandName<TName, TParentName>, TArgs, TCommands, TContext & TContextProvided>>(name: TNameNested | readonly [TNameNested, ...TAliases], builderFn?: (builder: InitialCommandBuilder<TProgramName, TNameNested, FullCommandName<TName, TParentName>, TArgs, TCommands, TContext & TContextProvided>) => TBuilder): BuilderOrProgram<TReturn, TProgramName, TName, TParentName, TArgs, TRes, TCommands extends [] ? [WithAliases<TBuilder['~types']['command'], TAliases>] : AnyPadroneCommand[] extends TCommands ? [WithAliases<TBuilder['~types']['command'], TAliases>] : ReplaceOrAppendCommand<TCommands, TNameNested, WithAliases<TBuilder['~types']['command'], ResolvedAliases<TCommands, TNameNested, TAliases>>>, TParentArgs, TAsync, TContext, TContextProvided>;
|
|
1306
|
+
<TNameNested extends string, TAliases extends string[] = [], TBuilder extends CommandTypesBase = CommandTypesBase, TReq = unknown>(name: TNameNested | readonly [TNameNested, ...TAliases], builderFn: ((builder: any) => TBuilder) & {
|
|
1307
|
+
'~contextRequires': (ctx: TReq) => void;
|
|
1308
|
+
}): TContext & TContextProvided extends TReq ? BuilderOrProgram<TReturn, TProgramName, TName, TParentName, TArgs, TRes, TCommands extends [] ? [WithAliases<TBuilder['~types']['command'], TAliases>] : AnyPadroneCommand[] extends TCommands ? [WithAliases<TBuilder['~types']['command'], TAliases>] : ReplaceOrAppendCommand<TCommands, TNameNested, WithAliases<TBuilder['~types']['command'], ResolvedAliases<TCommands, TNameNested, TAliases>>>, TParentArgs, TAsync, TContext, TContextProvided> : DefineCommandRequiresError;
|
|
1124
1309
|
<TNameNested extends string, TAliases extends string[] = [], TBuilder extends CommandTypesBase = CommandTypesBase>(name: TNameNested | readonly [TNameNested, ...TAliases], builderFn?: (builder: any) => TBuilder): BuilderOrProgram<TReturn, TProgramName, TName, TParentName, TArgs, TRes, TCommands extends [] ? [WithAliases<TBuilder['~types']['command'], TAliases>] : AnyPadroneCommand[] extends TCommands ? [WithAliases<TBuilder['~types']['command'], TAliases>] : ReplaceOrAppendCommand<TCommands, TNameNested, WithAliases<TBuilder['~types']['command'], ResolvedAliases<TCommands, TNameNested, TAliases>>>, TParentArgs, TAsync, TContext, TContextProvided>;
|
|
1125
1310
|
}; /** Mount an existing program as a subcommand, optionally transforming the context. @category Builder */
|
|
1126
1311
|
mount: {
|
|
@@ -1175,6 +1360,28 @@ type AnyPadroneProgram = PadroneProgram<string, string, string, any, any, [...An
|
|
|
1175
1360
|
* ```
|
|
1176
1361
|
*/
|
|
1177
1362
|
type PadroneExtension<TIn extends CommandTypesBase = CommandTypesBase, TOut extends CommandTypesBase = TIn> = (builder: TIn) => TOut;
|
|
1363
|
+
/**
|
|
1364
|
+
* Default context type for commands defined with `defineCommand()`.
|
|
1365
|
+
* Includes optional context properties provided by common extensions (logger, tracing, progress).
|
|
1366
|
+
*
|
|
1367
|
+
* Override globally via module augmentation to add your application's context:
|
|
1368
|
+
* ```ts
|
|
1369
|
+
* declare module 'padrone' {
|
|
1370
|
+
* interface DefineCommandContext {
|
|
1371
|
+
* db: Database;
|
|
1372
|
+
* }
|
|
1373
|
+
* }
|
|
1374
|
+
* ```
|
|
1375
|
+
*/
|
|
1376
|
+
interface DefineCommandContext {
|
|
1377
|
+
logger?: PadroneLogger;
|
|
1378
|
+
tracing?: PadroneTracer;
|
|
1379
|
+
progress?: PadroneProgressIndicator;
|
|
1380
|
+
}
|
|
1381
|
+
/** Error brand returned by `.command()` when a `defineCommand.requires()` context requirement is not satisfied. */
|
|
1382
|
+
type DefineCommandRequiresError = {
|
|
1383
|
+
readonly '~error': 'Required context not satisfied. Ensure required interceptors are registered on the program.';
|
|
1384
|
+
};
|
|
1178
1385
|
/**
|
|
1179
1386
|
* Type for a command builder callback used with `.command()`.
|
|
1180
1387
|
* Use this when defining commands in separate files where full return type inference isn't needed.
|
|
@@ -1192,8 +1399,25 @@ type PadroneExtension<TIn extends CommandTypesBase = CommandTypesBase, TOut exte
|
|
|
1192
1399
|
* createPadrone('test').command('my-command', myCommand)
|
|
1193
1400
|
* ```
|
|
1194
1401
|
*/
|
|
1195
|
-
type DefineCommand<TContext = unknown, TParentArgs extends PadroneSchema = PadroneSchema> = (builder: PadroneBuilder<string, string, string, PadroneSchema<void>, void, [], TParentArgs, false, TContext>) => CommandTypesBase;
|
|
1402
|
+
type DefineCommand<TContext = unknown, TParentArgs extends PadroneSchema = PadroneSchema> = (builder: PadroneBuilder<string, string, string, PadroneSchema<void>, void, [], TParentArgs, false, TContext, DefineCommandContext>) => CommandTypesBase;
|
|
1403
|
+
/**
|
|
1404
|
+
* Builder returned by `defineCommand()` (no-arg form).
|
|
1405
|
+
* Call `.requires<T>()` to declare context dependencies, then `.command()` to provide the builder callback.
|
|
1406
|
+
*
|
|
1407
|
+
* @example
|
|
1408
|
+
* ```ts
|
|
1409
|
+
* const adminCommand = defineCommand()
|
|
1410
|
+
* .requires<{ adminDb: AdminDB }>()
|
|
1411
|
+
* .define((c) => c.action((_args, ctx) => ctx.context.adminDb.query(...)));
|
|
1412
|
+
* ```
|
|
1413
|
+
*/
|
|
1414
|
+
type DefineCommandBuilder<TContextProvided = DefineCommandContext, TBrand = unknown> = {
|
|
1415
|
+
/** Declare context types this command requires. Purely type-level — no runtime effect. */requires: <TRequires>() => DefineCommandBuilder<DefineCommandContext & TRequires, {
|
|
1416
|
+
'~contextRequires': (ctx: TRequires) => void;
|
|
1417
|
+
}>; /** Provide the command builder callback. */
|
|
1418
|
+
define: <TContext = unknown, TOut extends CommandTypesBase = CommandTypesBase>(fn: (builder: PadroneBuilder<string, string, string, PadroneSchema<void>, void, [], any, false, TContext, TContextProvided>) => TOut) => typeof fn & TBrand;
|
|
1419
|
+
};
|
|
1196
1420
|
type DefaultArgs = Record<string, unknown> | void;
|
|
1197
1421
|
//#endregion
|
|
1198
|
-
export {
|
|
1199
|
-
//# sourceMappingURL=index-
|
|
1422
|
+
export { PadroneLogger as $, InterceptorParseResult as A, RegisteredInterceptor as B, InterceptorErrorContext as C, PadroneSpinnerPreset as Ct, InterceptorFactory as D, InterceptorExecuteResult as E, InterceptorValidateContext as F, OtelSpan as G, WrapResult as H, InterceptorValidateResult as I, PadroneTracer as J, OtelTracer as K, PadroneContextInterceptor as L, InterceptorRouteContext as M, InterceptorShutdownContext as N, InterceptorMeta as O, InterceptorStartContext as P, PadroneLogLevel as Q, PadroneInterceptor as R, InterceptorDefBuilder as S, PadroneSpinnerConfig as St, InterceptorExecuteContext as T, PadroneServePreferences as U, WrapConfig as V, PadroneMcpPreferences as W, WithTracing as X, PadroneTracingConfig as Y, padroneTracing as Z, PadroneCommand as _, PadroneProgressOptions as _t, DefineCommandContext as a, PossibleCommands as at, ExtractInterceptorRequires as b, PadroneRuntime as bt, PadroneProgram as c, WithInterceptor as ct, PadroneParseResult as d, InteractiveMode as dt, PadroneLoggerConfig as et, PadroneReplPreferences as f, InteractivePromptConfig as ft, PadroneActionContext as g, PadroneProgressIndicator as gt, GetArgsMeta as h, PadroneBarConfig as ht, DefineCommandBuilder as i, PickCommandByName as it, InterceptorPhases as j, InterceptorParseContext as k, PadroneCommandResult as l, AsyncPadroneSchema as lt, CommandTypesBase as m, PadroneBarChar as mt, AnyPadroneProgram as n, padroneLogger as nt, PadroneBuilder as o, WithAsync as ot, AnyPadroneCommand as p, PadroneBarAnimation as pt, OtelTracerProvider as q, DefineCommand as r, Drained as rt, PadroneExtension as s, WithCommand as st, AnyPadroneBuilder as t, WithLogger as tt, PadroneDrainResult as u, PadroneSchema as ut, PadroneProgramMeta as v, PadroneProgressShow as vt, InterceptorErrorResult as w, REPL_SIGINT as wt, InterceptorBaseContext as x, PadroneSignal as xt, ExtractInterceptorContext as y, PadroneProgressUpdate as yt, PadroneInterceptorFn as z };
|
|
1423
|
+
//# sourceMappingURL=index-Guyz-CBm.d.mts.map
|