politty 0.4.15 → 0.5.0
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/dist/{arg-registry-Dw0f11Zc.d.ts → arg-registry--NRaNFJM.d.cts} +238 -6
- package/dist/arg-registry--NRaNFJM.d.cts.map +1 -0
- package/dist/{arg-registry-CB5gGtzp.d.cts → arg-registry-6E0WHOh_.d.ts} +238 -6
- package/dist/arg-registry-6E0WHOh_.d.ts.map +1 -0
- package/dist/augment.d.cts +1 -1
- package/dist/augment.d.cts.map +1 -1
- package/dist/augment.d.ts +1 -1
- package/dist/augment.d.ts.map +1 -1
- package/dist/completion/index.cjs +2 -1
- package/dist/completion/index.d.cts +3 -2
- package/dist/completion/index.d.ts +3 -2
- package/dist/completion/index.js +2 -2
- package/dist/completion-BA5JMvVG.js +4067 -0
- package/dist/completion-BA5JMvVG.js.map +1 -0
- package/dist/completion-Cqs1Ja7C.cjs +4169 -0
- package/dist/completion-Cqs1Ja7C.cjs.map +1 -0
- package/dist/docs/index.cjs +89 -29
- package/dist/docs/index.cjs.map +1 -1
- package/dist/docs/index.d.cts +1 -1
- package/dist/docs/index.d.cts.map +1 -1
- package/dist/docs/index.d.ts +1 -1
- package/dist/docs/index.d.ts.map +1 -1
- package/dist/docs/index.js +92 -31
- package/dist/docs/index.js.map +1 -1
- package/dist/{index-C1gGgUeB.d.cts → index-DBMfKZ34.d.ts} +189 -17
- package/dist/index-DBMfKZ34.d.ts.map +1 -0
- package/dist/{index-Dg9Fpz0R.d.ts → index-DJp8k5Bq.d.cts} +189 -17
- package/dist/index-DJp8k5Bq.d.cts.map +1 -0
- package/dist/index.cjs +12 -10
- package/dist/index.d.cts +36 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +36 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/log-collector-Cd2_mv87.cjs.map +1 -1
- package/dist/log-collector-Cu6MCtAx.js.map +1 -1
- package/dist/prompt/clack/index.cjs.map +1 -1
- package/dist/prompt/clack/index.d.cts +1 -1
- package/dist/prompt/clack/index.d.cts.map +1 -1
- package/dist/prompt/clack/index.d.ts +1 -1
- package/dist/prompt/clack/index.d.ts.map +1 -1
- package/dist/prompt/clack/index.js.map +1 -1
- package/dist/prompt/index.d.cts +1 -1
- package/dist/prompt/index.d.cts.map +1 -1
- package/dist/prompt/index.d.ts +1 -1
- package/dist/prompt/index.d.ts.map +1 -1
- package/dist/prompt/inquirer/index.cjs.map +1 -1
- package/dist/prompt/inquirer/index.d.cts +1 -1
- package/dist/prompt/inquirer/index.d.cts.map +1 -1
- package/dist/prompt/inquirer/index.d.ts +1 -1
- package/dist/prompt/inquirer/index.d.ts.map +1 -1
- package/dist/prompt/inquirer/index.js.map +1 -1
- package/dist/prompt-BKHqGrFw.js.map +1 -1
- package/dist/prompt-aXfSf27y.cjs.map +1 -1
- package/dist/{runner-DKAQBNNh.js → runner-BmSEiD9A.js} +319 -52
- package/dist/runner-BmSEiD9A.js.map +1 -0
- package/dist/{runner-CriXJlm4.cjs → runner-CRZ_7Y9i.cjs} +366 -87
- package/dist/runner-CRZ_7Y9i.cjs.map +1 -0
- package/dist/{subcommand-router-ENeCymvX.js → schema-extractor-C50R-1re.js} +175 -137
- package/dist/schema-extractor-C50R-1re.js.map +1 -0
- package/dist/{subcommand-router-CqZX3orq.cjs → schema-extractor-SLPgBNgZ.cjs} +174 -136
- package/dist/schema-extractor-SLPgBNgZ.cjs.map +1 -0
- package/package.json +16 -16
- package/dist/arg-registry-CB5gGtzp.d.cts.map +0 -1
- package/dist/arg-registry-Dw0f11Zc.d.ts.map +0 -1
- package/dist/completion-B5fgnUGm.cjs +0 -1940
- package/dist/completion-B5fgnUGm.cjs.map +0 -1
- package/dist/completion-Ca5ESJlG.js +0 -1844
- package/dist/completion-Ca5ESJlG.js.map +0 -1
- package/dist/index-C1gGgUeB.d.cts.map +0 -1
- package/dist/index-Dg9Fpz0R.d.ts.map +0 -1
- package/dist/runner-CriXJlm4.cjs.map +0 -1
- package/dist/runner-DKAQBNNh.js.map +0 -1
- package/dist/subcommand-router-CqZX3orq.cjs.map +0 -1
- package/dist/subcommand-router-ENeCymvX.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
const require_completion = require('./completion-
|
|
4
|
-
const require_runner = require('./runner-
|
|
2
|
+
const require_schema_extractor = require('./schema-extractor-SLPgBNgZ.cjs');
|
|
3
|
+
const require_completion = require('./completion-Cqs1Ja7C.cjs');
|
|
4
|
+
const require_runner = require('./runner-CRZ_7Y9i.cjs');
|
|
5
5
|
|
|
6
6
|
exports.CaseVariantCollisionError = require_runner.CaseVariantCollisionError;
|
|
7
7
|
exports.DuplicateAliasError = require_runner.DuplicateAliasError;
|
|
8
8
|
exports.DuplicateFieldError = require_runner.DuplicateFieldError;
|
|
9
|
+
exports.DuplicateNegationError = require_runner.DuplicateNegationError;
|
|
9
10
|
exports.PositionalConfigError = require_runner.PositionalConfigError;
|
|
10
11
|
exports.ReservedAliasError = require_runner.ReservedAliasError;
|
|
11
|
-
exports.arg =
|
|
12
|
+
exports.arg = require_schema_extractor.arg;
|
|
12
13
|
exports.createDefineCommand = require_completion.createDefineCommand;
|
|
13
14
|
exports.createDualCaseProxy = require_runner.createDualCaseProxy;
|
|
14
15
|
exports.defineCommand = require_completion.defineCommand;
|
|
15
|
-
exports.extractFields =
|
|
16
|
+
exports.extractFields = require_schema_extractor.extractFields;
|
|
16
17
|
exports.formatCommandValidationErrors = require_runner.formatCommandValidationErrors;
|
|
17
18
|
exports.formatValidationErrors = require_runner.formatValidationErrors;
|
|
18
19
|
exports.generateCompletion = require_completion.generateCompletion;
|
|
19
20
|
exports.generateHelp = require_runner.generateHelp;
|
|
20
|
-
exports.getUnknownKeysMode =
|
|
21
|
+
exports.getUnknownKeysMode = require_schema_extractor.getUnknownKeysMode;
|
|
21
22
|
exports.isColorEnabled = require_runner.isColorEnabled;
|
|
22
|
-
exports.isLazyCommand =
|
|
23
|
-
exports.lazy =
|
|
23
|
+
exports.isLazyCommand = require_schema_extractor.isLazyCommand;
|
|
24
|
+
exports.lazy = require_schema_extractor.lazy;
|
|
24
25
|
exports.logger = require_runner.logger;
|
|
25
26
|
exports.parseArgv = require_runner.parseArgv;
|
|
26
27
|
exports.renderInline = require_runner.renderInline;
|
|
@@ -30,13 +31,14 @@ exports.runMain = require_runner.runMain;
|
|
|
30
31
|
exports.setColorEnabled = require_runner.setColorEnabled;
|
|
31
32
|
exports.styles = require_runner.styles;
|
|
32
33
|
exports.symbols = require_runner.symbols;
|
|
33
|
-
exports.toCamelCase =
|
|
34
|
-
exports.toKebabCase =
|
|
34
|
+
exports.toCamelCase = require_schema_extractor.toCamelCase;
|
|
35
|
+
exports.toKebabCase = require_schema_extractor.toKebabCase;
|
|
35
36
|
exports.validateCaseVariantCollisions = require_runner.validateCaseVariantCollisions;
|
|
36
37
|
exports.validateCommand = require_runner.validateCommand;
|
|
37
38
|
exports.validateCrossSchemaCollisions = require_runner.validateCrossSchemaCollisions;
|
|
38
39
|
exports.validateDuplicateAliases = require_runner.validateDuplicateAliases;
|
|
39
40
|
exports.validateDuplicateFields = require_runner.validateDuplicateFields;
|
|
41
|
+
exports.validateDuplicateNegations = require_runner.validateDuplicateNegations;
|
|
40
42
|
exports.validatePositionalConfig = require_runner.validatePositionalConfig;
|
|
41
43
|
exports.validateReservedAliases = require_runner.validateReservedAliases;
|
|
42
44
|
exports.withCompletionCommand = require_completion.withCompletionCommand;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { D as
|
|
1
|
+
import { A as LogStream, B as SetupContext, C as Example, D as IsEmpty, E as GlobalSetupContext, F as RunCommandOptions, G as lazy, H as SubCommandsRecord, I as RunResult, J as UnknownKeysMode, K as ExtractedFields, L as RunResultFailure, M as MainOptions, N as NonRunnableCommand, O as LogEntry, P as PromptResolver, Q as toKebabCase, R as RunResultSuccess, S as CommandBase, T as GlobalCleanupContext, U as LazyCommand, V as SubCommandValue, W as isLazyCommand, X as getUnknownKeysMode, Y as extractFields, Z as toCamelCase, _ as AnyCommand, a as EffectContext, b as CollectedLogs, c as arg, d as ResolvedExpandCandidate, f as CompletionDirectiveMask, g as DynamicCompletionResult, h as DynamicCompletionResolver, i as CustomCompletion, j as Logger, k as LogLevel, l as ExpandCandidate, m as DynamicCompletionContext, n as CompletionMeta, o as PromptMeta, p as DynamicCompletionCandidate, q as ResolvedFieldMeta, r as CompletionType, s as PromptType, t as ArgMeta, u as ExpandCompletion, v as ArgsSchema, w as GlobalArgs, x as Command, y as CleanupContext, z as RunnableCommand } from "./arg-registry--NRaNFJM.cjs";
|
|
2
|
+
import { D as CompletionOptions, O as CompletionResult, a as generateCompletion, s as withCompletionCommand, t as WithCompletionOptions } from "./index-DJp8k5Bq.cjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/core/case-types.d.ts
|
|
@@ -236,6 +236,11 @@ declare function runCommand<TResult = unknown>(command: AnyCommand, argv: string
|
|
|
236
236
|
* - Uses process.argv for arguments
|
|
237
237
|
* - Handles SIGINT/SIGTERM signals
|
|
238
238
|
* - Calls process.exit with the appropriate exit code
|
|
239
|
+
* - Invokes `command.runMainHook` once before parsing if set, so plug-ins
|
|
240
|
+
* like `withCompletionCommand` can fire detached background work
|
|
241
|
+
* - Bypasses user `setup`/`cleanup`/`prompt` and required `globalArgs`
|
|
242
|
+
* for registered hidden subcommands whose name starts with `__`
|
|
243
|
+
* (e.g. `__refresh-completion`)
|
|
239
244
|
*
|
|
240
245
|
* @param command - The command to run
|
|
241
246
|
* @param options - Main options (version, debug)
|
|
@@ -446,6 +451,18 @@ interface ParserOptions {
|
|
|
446
451
|
* boolean negation of `flag`.
|
|
447
452
|
*/
|
|
448
453
|
definedNames?: Set<string>;
|
|
454
|
+
/**
|
|
455
|
+
* Map from a custom negation CLI name (and camelCase variant) to the
|
|
456
|
+
* canonical field name. Used to recognize user-defined boolean negation
|
|
457
|
+
* options (e.g. `--disable-cache` → `{ cache: false }`).
|
|
458
|
+
*/
|
|
459
|
+
negationMap?: Map<string, string>;
|
|
460
|
+
/**
|
|
461
|
+
* Canonical field names that have a custom `negation` configured.
|
|
462
|
+
* For these fields the default `--no-<name>` / `--no<Name>` negation
|
|
463
|
+
* forms are suppressed.
|
|
464
|
+
*/
|
|
465
|
+
customNegatedFields?: Set<string>;
|
|
449
466
|
}
|
|
450
467
|
/**
|
|
451
468
|
* Parse argv into a flat record
|
|
@@ -501,6 +518,14 @@ declare class DuplicateAliasError extends Error {
|
|
|
501
518
|
declare class CaseVariantCollisionError extends Error {
|
|
502
519
|
constructor(message: string);
|
|
503
520
|
}
|
|
521
|
+
/**
|
|
522
|
+
* Error thrown when a custom boolean negation name collides with another
|
|
523
|
+
* field's name, cliName, alias, or another field's negation (including
|
|
524
|
+
* derived camelCase variants).
|
|
525
|
+
*/
|
|
526
|
+
declare class DuplicateNegationError extends Error {
|
|
527
|
+
constructor(message: string);
|
|
528
|
+
}
|
|
504
529
|
//#endregion
|
|
505
530
|
//#region src/validator/command-validator.d.ts
|
|
506
531
|
/**
|
|
@@ -510,7 +535,7 @@ interface CommandValidationError {
|
|
|
510
535
|
/** Path to the command (e.g., ["cli", "build", "watch"]) */
|
|
511
536
|
commandPath: string[];
|
|
512
537
|
/** Error type */
|
|
513
|
-
type: "duplicate_field" | "duplicate_alias" | "invalid_alias" | "positional_config" | "reserved_alias" | "case_variant_collision";
|
|
538
|
+
type: "duplicate_field" | "duplicate_alias" | "invalid_alias" | "positional_config" | "reserved_alias" | "case_variant_collision" | "duplicate_negation";
|
|
514
539
|
/** Error message */
|
|
515
540
|
message: string;
|
|
516
541
|
/** Related field name (if applicable) */
|
|
@@ -575,6 +600,13 @@ declare function validatePositionalConfig(extracted: ExtractedFields): void;
|
|
|
575
600
|
* @throws {ReservedAliasError} If a reserved alias is used without override flag
|
|
576
601
|
*/
|
|
577
602
|
declare function validateReservedAliases(extracted: ExtractedFields, _hasSubCommands: boolean): void;
|
|
603
|
+
/**
|
|
604
|
+
* Validate that custom boolean negation names do not collide with anything
|
|
605
|
+
*
|
|
606
|
+
* @param extracted - Extracted fields from schema
|
|
607
|
+
* @throws {DuplicateNegationError} If a colliding negation is found
|
|
608
|
+
*/
|
|
609
|
+
declare function validateDuplicateNegations(extracted: ExtractedFields): void;
|
|
578
610
|
/**
|
|
579
611
|
* Validate that no case-variant collisions exist
|
|
580
612
|
*
|
|
@@ -649,5 +681,5 @@ type ValidationResult<T> = {
|
|
|
649
681
|
*/
|
|
650
682
|
declare function formatValidationErrors(errors: ValidationError[]): string;
|
|
651
683
|
//#endregion
|
|
652
|
-
export { type AnyCommand, type ArgMeta, type ArgsSchema, type BuiltinOptionDescriptions, type CamelCase, CaseVariantCollisionError, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, type CompletionMeta, type CompletionOptions, type CompletionResult, type CompletionType, type CustomCompletion, DuplicateAliasError, DuplicateFieldError, type EffectContext, type Example, type ExtractedFields, type GlobalArgs, type GlobalCleanupContext, type GlobalSetupContext, type HelpOptions, type KebabCase, type LazyCommand, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type MergedArgs, type NonRunnableCommand, type ParsedArgv, type ParserOptions, PositionalConfigError, type PromptMeta, type PromptResolver, type PromptType, ReservedAliasError, type ResolvedFieldMeta, type RunCommandOptions, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type ValidationError, type ValidationResult, type WithCaseVariants, type WithCompletionOptions, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validatePositionalConfig, validateReservedAliases, withCompletionCommand };
|
|
684
|
+
export { type AnyCommand, type ArgMeta, type ArgsSchema, type BuiltinOptionDescriptions, type CamelCase, CaseVariantCollisionError, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, type CompletionDirectiveMask, type CompletionMeta, type CompletionOptions, type CompletionResult, type CompletionType, type CustomCompletion, DuplicateAliasError, DuplicateFieldError, DuplicateNegationError, type DynamicCompletionCandidate, type DynamicCompletionContext, type DynamicCompletionResolver, type DynamicCompletionResult, type EffectContext, type Example, type ExpandCandidate, type ExpandCompletion, type ExtractedFields, type GlobalArgs, type GlobalCleanupContext, type GlobalSetupContext, type HelpOptions, type KebabCase, type LazyCommand, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type MergedArgs, type NonRunnableCommand, type ParsedArgv, type ParserOptions, PositionalConfigError, type PromptMeta, type PromptResolver, type PromptType, ReservedAliasError, type ResolvedExpandCandidate, type ResolvedFieldMeta, type RunCommandOptions, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type ValidationError, type ValidationResult, type WithCaseVariants, type WithCompletionOptions, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validateDuplicateNegations, validatePositionalConfig, validateReservedAliases, withCompletionCommand };
|
|
653
685
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/core/case-types.ts","../src/core/case-proxy.ts","../src/core/command.ts","../src/core/runner.ts","../src/output/help-generator.ts","../src/output/logger.ts","../src/output/markdown-renderer.ts","../src/parser/argv-parser.ts","../src/validator/validation-errors.ts","../src/validator/command-validator.ts","../src/validator/zod-validator.ts"],"mappings":";;;;;;;;;;AAcA;;;;;;;;KAAY,SAAA,qBAA8B,CAAA,gDACnC,CAAA,GAAI,SAAA,CAAU,CAAA,IAAK,SAAA,CAAU,CAAA,MAChC,CAAA;;;;;;;;;;;;;;KAeC,cAAA,qBAAmC,CAAA,yCACpC,IAAA,cACE,KAAA,SAAc,SAAA,CAAU,KAAA,IACtB,KAAA,OACI,SAAA,CAAU,KAAA,MAChB,KAAA,SAAc,SAAA,CAAU,KAAA,OACnB,KAAA,GAAQ,cAAA,CAAe,IAAA,MAC1B,IAAA,wCACE,IAAA,SAAa,SAAA,CAAU,IAAA,QACjB,SAAA,CAAU,KAAA,IAAS,IAAA,GAAO,cAAA,CAAe,IAAA,SAC1C,SAAA,CAAU,KAAA,IAAS,cAAA,CAAe,IAAA,UACnC,SAAA,CAAU,KAAA,MACpB,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/core/case-types.ts","../src/core/case-proxy.ts","../src/core/command.ts","../src/core/runner.ts","../src/output/help-generator.ts","../src/output/logger.ts","../src/output/markdown-renderer.ts","../src/parser/argv-parser.ts","../src/validator/validation-errors.ts","../src/validator/command-validator.ts","../src/validator/zod-validator.ts"],"mappings":";;;;;;;;;;AAcA;;;;;;;;KAAY,SAAA,qBAA8B,CAAA,gDACnC,CAAA,GAAI,SAAA,CAAU,CAAA,IAAK,SAAA,CAAU,CAAA,MAChC,CAAA;;;;;;;;;;;;;;KAeC,cAAA,qBAAmC,CAAA,yCACpC,IAAA,cACE,KAAA,SAAc,SAAA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EAAY,eAAA,EACZ,UAAA,EAAY,eAAe;;;;;;;;ATxb8C;AAU3E;;;;;;;;;;iBSujBsB,eAAA,CACpB,OAAA,EAAS,UAAA,EACT,OAAA,GAAS,sBAAA,GACR,OAAA,CAAQ,uBAAA;;;AT1jBkE;AAc7E;;;iBSolBgB,6BAAA,CAA8B,MAAgC,EAAxB,sBAAsB;;;;;;UCtpB3D,eAAA;EVQI;EUNnB,IAAA;EVMwC;EUJxC,OAAA;EVKmB;EUHnB,IAAA;EVGkC;EUDlC,QAAA;EVEE;EUAF,QAAA;AAAA;;;;KAMU,gBAAA;EACN,OAAA;EAAe,IAAA,EAAM,CAAA;AAAA;EACrB,OAAA;EAAgB,MAAA,EAAQ,eAAe;AAAA;;;;iBA4C7B,sBAAA,CAAuB,MAAyB,EAAjB,eAAe"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { D as
|
|
1
|
+
import { A as LogStream, B as SetupContext, C as Example, D as IsEmpty, E as GlobalSetupContext, F as RunCommandOptions, G as lazy, H as SubCommandsRecord, I as RunResult, J as UnknownKeysMode, K as ExtractedFields, L as RunResultFailure, M as MainOptions, N as NonRunnableCommand, O as LogEntry, P as PromptResolver, Q as toKebabCase, R as RunResultSuccess, S as CommandBase, T as GlobalCleanupContext, U as LazyCommand, V as SubCommandValue, W as isLazyCommand, X as getUnknownKeysMode, Y as extractFields, Z as toCamelCase, _ as AnyCommand, a as EffectContext, b as CollectedLogs, c as arg, d as ResolvedExpandCandidate, f as CompletionDirectiveMask, g as DynamicCompletionResult, h as DynamicCompletionResolver, i as CustomCompletion, j as Logger, k as LogLevel, l as ExpandCandidate, m as DynamicCompletionContext, n as CompletionMeta, o as PromptMeta, p as DynamicCompletionCandidate, q as ResolvedFieldMeta, r as CompletionType, s as PromptType, t as ArgMeta, u as ExpandCompletion, v as ArgsSchema, w as GlobalArgs, x as Command, y as CleanupContext, z as RunnableCommand } from "./arg-registry-6E0WHOh_.js";
|
|
2
|
+
import { D as CompletionOptions, O as CompletionResult, a as generateCompletion, s as withCompletionCommand, t as WithCompletionOptions } from "./index-DBMfKZ34.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/core/case-types.d.ts
|
|
@@ -236,6 +236,11 @@ declare function runCommand<TResult = unknown>(command: AnyCommand, argv: string
|
|
|
236
236
|
* - Uses process.argv for arguments
|
|
237
237
|
* - Handles SIGINT/SIGTERM signals
|
|
238
238
|
* - Calls process.exit with the appropriate exit code
|
|
239
|
+
* - Invokes `command.runMainHook` once before parsing if set, so plug-ins
|
|
240
|
+
* like `withCompletionCommand` can fire detached background work
|
|
241
|
+
* - Bypasses user `setup`/`cleanup`/`prompt` and required `globalArgs`
|
|
242
|
+
* for registered hidden subcommands whose name starts with `__`
|
|
243
|
+
* (e.g. `__refresh-completion`)
|
|
239
244
|
*
|
|
240
245
|
* @param command - The command to run
|
|
241
246
|
* @param options - Main options (version, debug)
|
|
@@ -446,6 +451,18 @@ interface ParserOptions {
|
|
|
446
451
|
* boolean negation of `flag`.
|
|
447
452
|
*/
|
|
448
453
|
definedNames?: Set<string>;
|
|
454
|
+
/**
|
|
455
|
+
* Map from a custom negation CLI name (and camelCase variant) to the
|
|
456
|
+
* canonical field name. Used to recognize user-defined boolean negation
|
|
457
|
+
* options (e.g. `--disable-cache` → `{ cache: false }`).
|
|
458
|
+
*/
|
|
459
|
+
negationMap?: Map<string, string>;
|
|
460
|
+
/**
|
|
461
|
+
* Canonical field names that have a custom `negation` configured.
|
|
462
|
+
* For these fields the default `--no-<name>` / `--no<Name>` negation
|
|
463
|
+
* forms are suppressed.
|
|
464
|
+
*/
|
|
465
|
+
customNegatedFields?: Set<string>;
|
|
449
466
|
}
|
|
450
467
|
/**
|
|
451
468
|
* Parse argv into a flat record
|
|
@@ -501,6 +518,14 @@ declare class DuplicateAliasError extends Error {
|
|
|
501
518
|
declare class CaseVariantCollisionError extends Error {
|
|
502
519
|
constructor(message: string);
|
|
503
520
|
}
|
|
521
|
+
/**
|
|
522
|
+
* Error thrown when a custom boolean negation name collides with another
|
|
523
|
+
* field's name, cliName, alias, or another field's negation (including
|
|
524
|
+
* derived camelCase variants).
|
|
525
|
+
*/
|
|
526
|
+
declare class DuplicateNegationError extends Error {
|
|
527
|
+
constructor(message: string);
|
|
528
|
+
}
|
|
504
529
|
//#endregion
|
|
505
530
|
//#region src/validator/command-validator.d.ts
|
|
506
531
|
/**
|
|
@@ -510,7 +535,7 @@ interface CommandValidationError {
|
|
|
510
535
|
/** Path to the command (e.g., ["cli", "build", "watch"]) */
|
|
511
536
|
commandPath: string[];
|
|
512
537
|
/** Error type */
|
|
513
|
-
type: "duplicate_field" | "duplicate_alias" | "invalid_alias" | "positional_config" | "reserved_alias" | "case_variant_collision";
|
|
538
|
+
type: "duplicate_field" | "duplicate_alias" | "invalid_alias" | "positional_config" | "reserved_alias" | "case_variant_collision" | "duplicate_negation";
|
|
514
539
|
/** Error message */
|
|
515
540
|
message: string;
|
|
516
541
|
/** Related field name (if applicable) */
|
|
@@ -575,6 +600,13 @@ declare function validatePositionalConfig(extracted: ExtractedFields): void;
|
|
|
575
600
|
* @throws {ReservedAliasError} If a reserved alias is used without override flag
|
|
576
601
|
*/
|
|
577
602
|
declare function validateReservedAliases(extracted: ExtractedFields, _hasSubCommands: boolean): void;
|
|
603
|
+
/**
|
|
604
|
+
* Validate that custom boolean negation names do not collide with anything
|
|
605
|
+
*
|
|
606
|
+
* @param extracted - Extracted fields from schema
|
|
607
|
+
* @throws {DuplicateNegationError} If a colliding negation is found
|
|
608
|
+
*/
|
|
609
|
+
declare function validateDuplicateNegations(extracted: ExtractedFields): void;
|
|
578
610
|
/**
|
|
579
611
|
* Validate that no case-variant collisions exist
|
|
580
612
|
*
|
|
@@ -649,5 +681,5 @@ type ValidationResult<T> = {
|
|
|
649
681
|
*/
|
|
650
682
|
declare function formatValidationErrors(errors: ValidationError[]): string;
|
|
651
683
|
//#endregion
|
|
652
|
-
export { type AnyCommand, type ArgMeta, type ArgsSchema, type BuiltinOptionDescriptions, type CamelCase, CaseVariantCollisionError, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, type CompletionMeta, type CompletionOptions, type CompletionResult, type CompletionType, type CustomCompletion, DuplicateAliasError, DuplicateFieldError, type EffectContext, type Example, type ExtractedFields, type GlobalArgs, type GlobalCleanupContext, type GlobalSetupContext, type HelpOptions, type KebabCase, type LazyCommand, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type MergedArgs, type NonRunnableCommand, type ParsedArgv, type ParserOptions, PositionalConfigError, type PromptMeta, type PromptResolver, type PromptType, ReservedAliasError, type ResolvedFieldMeta, type RunCommandOptions, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type ValidationError, type ValidationResult, type WithCaseVariants, type WithCompletionOptions, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validatePositionalConfig, validateReservedAliases, withCompletionCommand };
|
|
684
|
+
export { type AnyCommand, type ArgMeta, type ArgsSchema, type BuiltinOptionDescriptions, type CamelCase, CaseVariantCollisionError, type CleanupContext, type CollectedLogs, type Command, type CommandBase, type CommandContext, type CommandValidationError, type CommandValidationResult, type CompletionDirectiveMask, type CompletionMeta, type CompletionOptions, type CompletionResult, type CompletionType, type CustomCompletion, DuplicateAliasError, DuplicateFieldError, DuplicateNegationError, type DynamicCompletionCandidate, type DynamicCompletionContext, type DynamicCompletionResolver, type DynamicCompletionResult, type EffectContext, type Example, type ExpandCandidate, type ExpandCompletion, type ExtractedFields, type GlobalArgs, type GlobalCleanupContext, type GlobalSetupContext, type HelpOptions, type KebabCase, type LazyCommand, type LogEntry, type LogLevel, type LogStream, type Logger, type MainOptions, type MergedArgs, type NonRunnableCommand, type ParsedArgv, type ParserOptions, PositionalConfigError, type PromptMeta, type PromptResolver, type PromptType, ReservedAliasError, type ResolvedExpandCandidate, type ResolvedFieldMeta, type RunCommandOptions, type RunResult, type RunResultFailure, type RunResultSuccess, type RunnableCommand, type SetupContext, type SubCommandValue, type SubCommandsRecord, type UnknownKeysMode, type ValidationError, type ValidationResult, type WithCaseVariants, type WithCompletionOptions, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validateDuplicateNegations, validatePositionalConfig, validateReservedAliases, withCompletionCommand };
|
|
653
685
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/core/case-types.ts","../src/core/case-proxy.ts","../src/core/command.ts","../src/core/runner.ts","../src/output/help-generator.ts","../src/output/logger.ts","../src/output/markdown-renderer.ts","../src/parser/argv-parser.ts","../src/validator/validation-errors.ts","../src/validator/command-validator.ts","../src/validator/zod-validator.ts"],"mappings":";;;;;;;;;;AAcA;;;;;;;;KAAY,SAAA,qBAA8B,CAAA,gDACnC,CAAA,GAAI,SAAA,CAAU,CAAA,IAAK,SAAA,CAAU,CAAA,MAChC,CAAA;;;;;;;;;;;;;;KAeC,cAAA,qBAAmC,CAAA,yCACpC,IAAA,cACE,KAAA,SAAc,SAAA,CAAU,KAAA,IACtB,KAAA,OACI,SAAA,CAAU,KAAA,MAChB,KAAA,SAAc,SAAA,CAAU,KAAA,OACnB,KAAA,GAAQ,cAAA,CAAe,IAAA,MAC1B,IAAA,wCACE,IAAA,SAAa,SAAA,CAAU,IAAA,QACjB,SAAA,CAAU,KAAA,IAAS,IAAA,GAAO,cAAA,CAAe,IAAA,SAC1C,SAAA,CAAU,KAAA,IAAS,cAAA,CAAe,IAAA,UACnC,SAAA,CAAU,KAAA,MACpB,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/core/case-types.ts","../src/core/case-proxy.ts","../src/core/command.ts","../src/core/runner.ts","../src/output/help-generator.ts","../src/output/logger.ts","../src/output/markdown-renderer.ts","../src/parser/argv-parser.ts","../src/validator/validation-errors.ts","../src/validator/command-validator.ts","../src/validator/zod-validator.ts"],"mappings":";;;;;;;;;;AAcA;;;;;;;;KAAY,SAAA,qBAA8B,CAAA,gDACnC,CAAA,GAAI,SAAA,CAAU,CAAA,IAAK,SAAA,CAAU,CAAA,MAChC,CAAA;;;;;;;;;;;;;;KAeC,cAAA,qBAAmC,CAAA,yCACpC,IAAA,cACE,KAAA,SAAc,SAAA,CAAU,KAAA,IACtB,KAAA,OACI,SAAA,CAAU,KAAA,MAChB,KAAA,SAAc,SAAA,CAAU,KAAA,OACnB,KAAA,GAAQ,cAAA,CAAe,IAAA,MAC1B,IAAA,wCACE,IAAA,SAAa,SAAA,CAAU,IAAA,QACjB,SAAA,CAAU,KAAA,IAAS,IAAA,GAAO,cAAA,CAAe,IAAA,SAC1C,SAAA,CAAU,KAAA,IAAS,cAAA,CAAe,IAAA,UACnC,SAAA,CAAU,KAAA,MACpB,CAAA;;AA3BC;AAAC;KAgCD,kBAAA,qBAAuC,CAAA,yBAA0B,CAAA,GAAI,CAAC;;;;;;;;;KAU/D,SAAA,qBAA8B,kBAAA,CAAmB,cAAA,CAAe,CAAA;;;;;;;;;;;;;KAchE,gBAAA,MAAsB,CAAA,mBAC9B,CAAA,iBAC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
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { C as renderMarkdown, D as styles, E as setColorEnabled, O as symbols, S as renderInline, T as logger, _ as DuplicateFieldError, a as parseArgv, b as ReservedAliasError, c as validateCommand, d as validateDuplicateFields, f as validateDuplicateNegations, g as DuplicateAliasError, h as CaseVariantCollisionError, i as formatValidationErrors, k as createDualCaseProxy, l as validateCrossSchemaCollisions, m as validateReservedAliases, n as runMain, o as formatCommandValidationErrors, p as validatePositionalConfig, s as validateCaseVariantCollisions, t as runCommand, u as validateDuplicateAliases, v as DuplicateNegationError, w as isColorEnabled, x as generateHelp, y as PositionalConfigError } from "./runner-BmSEiD9A.js";
|
|
2
|
+
import { a as toCamelCase, f as isLazyCommand, h as arg, i as getUnknownKeysMode, o as toKebabCase, p as lazy, t as extractFields } from "./schema-extractor-C50R-1re.js";
|
|
3
|
+
import { _ as defineCommand, g as createDefineCommand, i as generateCompletion, o as withCompletionCommand } from "./completion-BA5JMvVG.js";
|
|
4
4
|
|
|
5
|
-
export { CaseVariantCollisionError, DuplicateAliasError, DuplicateFieldError, PositionalConfigError, ReservedAliasError, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validatePositionalConfig, validateReservedAliases, withCompletionCommand };
|
|
5
|
+
export { CaseVariantCollisionError, DuplicateAliasError, DuplicateFieldError, DuplicateNegationError, PositionalConfigError, ReservedAliasError, arg, createDefineCommand, createDualCaseProxy, defineCommand, extractFields, formatCommandValidationErrors, formatValidationErrors, generateCompletion, generateHelp, getUnknownKeysMode, isColorEnabled, isLazyCommand, lazy, logger, parseArgv, renderInline, renderMarkdown, runCommand, runMain, setColorEnabled, styles, symbols, toCamelCase, toKebabCase, validateCaseVariantCollisions, validateCommand, validateCrossSchemaCollisions, validateDuplicateAliases, validateDuplicateFields, validateDuplicateNegations, validatePositionalConfig, validateReservedAliases, withCompletionCommand };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-collector-Cd2_mv87.cjs","names":[],"sources":["../src/executor/log-collector.ts"],"sourcesContent":["import type { CollectedLogs, LogEntry, LogLevel, LogStream } from \"../types.js\";\n\n/**\n * Mapping from log level to output stream\n */\nconst LOG_STREAM_MAP: Record<LogLevel, LogStream> = {\n log: \"stdout\",\n info: \"stdout\",\n debug: \"stdout\",\n warn: \"stderr\",\n error: \"stderr\",\n};\n\n/**\n * All log levels\n */\nconst ALL_LOG_LEVELS: LogLevel[] = [\"log\", \"info\", \"debug\", \"warn\", \"error\"];\n\n/**\n * Options for log collector\n */\nexport interface LogCollectorOptions {\n /** Log levels to capture (default: all) */\n levels?: LogLevel[];\n /** Whether to call original console methods (default: true) */\n passthrough?: boolean;\n}\n\n/**\n * Log collector that intercepts console methods\n */\nexport interface LogCollector {\n /** Get collected logs */\n getLogs: () => CollectedLogs;\n /** Start collecting logs */\n start: () => void;\n /** Stop collecting and restore original console methods */\n stop: () => void;\n}\n\n/**\n * Format console arguments to string\n */\nexport function formatArgs(args: unknown[]): string {\n return args\n .map((arg) => {\n if (arg instanceof Error) {\n return arg.message;\n }\n if (typeof arg === \"object\" && arg !== null) {\n try {\n return JSON.stringify(arg);\n } catch {\n return String(arg);\n }\n }\n return String(arg);\n })\n .join(\" \");\n}\n\n/**\n * Create a log collector that intercepts console methods\n *\n * @param options - Options for the log collector\n * @returns A log collector instance\n *\n * @example\n * ```ts\n * const collector = createLogCollector();\n * collector.start();\n *\n * console.log(\"Info message\");\n * console.error(\"Something went wrong\");\n * console.warn(\"This is a warning\");\n *\n * collector.stop();\n * const logs = collector.getLogs();\n * // {\n * // entries: [\n * // { message: \"Info message\", level: \"log\", stream: \"stdout\", timestamp: ... },\n * // { message: \"Something went wrong\", level: \"error\", stream: \"stderr\", timestamp: ... },\n * // { message: \"This is a warning\", level: \"warn\", stream: \"stderr\", timestamp: ... }\n * // ]\n * // }\n * ```\n */\nexport function createLogCollector(options: LogCollectorOptions = {}): LogCollector {\n const entries: LogEntry[] = [];\n const levels = options.levels ?? ALL_LOG_LEVELS;\n const passthrough = options.passthrough ?? true;\n\n let originals: Record<LogLevel, typeof console.log> | null = null;\n\n const createInterceptor = (level: LogLevel, original: typeof console.log) => {\n return (...args: unknown[]) => {\n entries.push({\n message: formatArgs(args),\n timestamp: new Date(),\n level,\n stream: LOG_STREAM_MAP[level],\n });\n if (passthrough) {\n original.apply(console, args);\n }\n };\n };\n\n return {\n getLogs() {\n return { entries: [...entries] };\n },\n start() {\n if (originals !== null) {\n // Already started\n return;\n }\n originals = {\n log: console.log,\n info: console.info,\n debug: console.debug,\n warn: console.warn,\n error: console.error,\n };\n for (const level of levels) {\n console[level] = createInterceptor(level, originals[level]);\n }\n },\n stop() {\n if (originals === null) {\n return;\n }\n for (const level of levels) {\n console[level] = originals[level];\n }\n originals = null;\n },\n };\n}\n\n/**\n * Merge multiple CollectedLogs into one (sorted by timestamp)\n */\nexport function mergeLogs(...logsArray: CollectedLogs[]): CollectedLogs {\n return {\n entries: logsArray\n .flatMap((l) => l.entries)\n .sort((a, b) => a.timestamp.getTime() - b.timestamp.getTime()),\n };\n}\n\n/**\n * Create an empty CollectedLogs object\n */\nexport function emptyLogs(): CollectedLogs {\n return { entries: [] };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,iBAA8C;CAClD,KAAK;CACL,MAAM;CACN,OAAO;CACP,MAAM;CACN,OAAO;
|
|
1
|
+
{"version":3,"file":"log-collector-Cd2_mv87.cjs","names":[],"sources":["../src/executor/log-collector.ts"],"sourcesContent":["import type { CollectedLogs, LogEntry, LogLevel, LogStream } from \"../types.js\";\n\n/**\n * Mapping from log level to output stream\n */\nconst LOG_STREAM_MAP: Record<LogLevel, LogStream> = {\n log: \"stdout\",\n info: \"stdout\",\n debug: \"stdout\",\n warn: \"stderr\",\n error: \"stderr\",\n};\n\n/**\n * All log levels\n */\nconst ALL_LOG_LEVELS: LogLevel[] = [\"log\", \"info\", \"debug\", \"warn\", \"error\"];\n\n/**\n * Options for log collector\n */\nexport interface LogCollectorOptions {\n /** Log levels to capture (default: all) */\n levels?: LogLevel[];\n /** Whether to call original console methods (default: true) */\n passthrough?: boolean;\n}\n\n/**\n * Log collector that intercepts console methods\n */\nexport interface LogCollector {\n /** Get collected logs */\n getLogs: () => CollectedLogs;\n /** Start collecting logs */\n start: () => void;\n /** Stop collecting and restore original console methods */\n stop: () => void;\n}\n\n/**\n * Format console arguments to string\n */\nexport function formatArgs(args: unknown[]): string {\n return args\n .map((arg) => {\n if (arg instanceof Error) {\n return arg.message;\n }\n if (typeof arg === \"object\" && arg !== null) {\n try {\n return JSON.stringify(arg);\n } catch {\n return String(arg);\n }\n }\n return String(arg);\n })\n .join(\" \");\n}\n\n/**\n * Create a log collector that intercepts console methods\n *\n * @param options - Options for the log collector\n * @returns A log collector instance\n *\n * @example\n * ```ts\n * const collector = createLogCollector();\n * collector.start();\n *\n * console.log(\"Info message\");\n * console.error(\"Something went wrong\");\n * console.warn(\"This is a warning\");\n *\n * collector.stop();\n * const logs = collector.getLogs();\n * // {\n * // entries: [\n * // { message: \"Info message\", level: \"log\", stream: \"stdout\", timestamp: ... },\n * // { message: \"Something went wrong\", level: \"error\", stream: \"stderr\", timestamp: ... },\n * // { message: \"This is a warning\", level: \"warn\", stream: \"stderr\", timestamp: ... }\n * // ]\n * // }\n * ```\n */\nexport function createLogCollector(options: LogCollectorOptions = {}): LogCollector {\n const entries: LogEntry[] = [];\n const levels = options.levels ?? ALL_LOG_LEVELS;\n const passthrough = options.passthrough ?? true;\n\n let originals: Record<LogLevel, typeof console.log> | null = null;\n\n const createInterceptor = (level: LogLevel, original: typeof console.log) => {\n return (...args: unknown[]) => {\n entries.push({\n message: formatArgs(args),\n timestamp: new Date(),\n level,\n stream: LOG_STREAM_MAP[level],\n });\n if (passthrough) {\n original.apply(console, args);\n }\n };\n };\n\n return {\n getLogs() {\n return { entries: [...entries] };\n },\n start() {\n if (originals !== null) {\n // Already started\n return;\n }\n originals = {\n log: console.log,\n info: console.info,\n debug: console.debug,\n warn: console.warn,\n error: console.error,\n };\n for (const level of levels) {\n console[level] = createInterceptor(level, originals[level]);\n }\n },\n stop() {\n if (originals === null) {\n return;\n }\n for (const level of levels) {\n console[level] = originals[level];\n }\n originals = null;\n },\n };\n}\n\n/**\n * Merge multiple CollectedLogs into one (sorted by timestamp)\n */\nexport function mergeLogs(...logsArray: CollectedLogs[]): CollectedLogs {\n return {\n entries: logsArray\n .flatMap((l) => l.entries)\n .sort((a, b) => a.timestamp.getTime() - b.timestamp.getTime()),\n };\n}\n\n/**\n * Create an empty CollectedLogs object\n */\nexport function emptyLogs(): CollectedLogs {\n return { entries: [] };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,iBAA8C;CAClD,KAAK;CACL,MAAM;CACN,OAAO;CACP,MAAM;CACN,OAAO;AACT;;;;AAKA,MAAM,iBAA6B;CAAC;CAAO;CAAQ;CAAS;CAAQ;AAAO;;;;AA2B3E,SAAgB,WAAW,MAAyB;CAClD,OAAO,KACJ,KAAK,QAAQ;EACZ,IAAI,eAAe,OACjB,OAAO,IAAI;EAEb,IAAI,OAAO,QAAQ,YAAY,QAAQ,MACrC,IAAI;GACF,OAAO,KAAK,UAAU,GAAG;EAC3B,QAAQ;GACN,OAAO,OAAO,GAAG;EACnB;EAEF,OAAO,OAAO,GAAG;CACnB,CAAC,EACA,KAAK,GAAG;AACb;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,mBAAmB,UAA+B,CAAC,GAAiB;CAClF,MAAM,UAAsB,CAAC;CAC7B,MAAM,SAAS,QAAQ,UAAU;CACjC,MAAM,cAAc,QAAQ,eAAe;CAE3C,IAAI,YAAyD;CAE7D,MAAM,qBAAqB,OAAiB,aAAiC;EAC3E,QAAQ,GAAG,SAAoB;GAC7B,QAAQ,KAAK;IACX,SAAS,WAAW,IAAI;IACxB,2BAAW,IAAI,KAAK;IACpB;IACA,QAAQ,eAAe;GACzB,CAAC;GACD,IAAI,aACF,SAAS,MAAM,SAAS,IAAI;EAEhC;CACF;CAEA,OAAO;EACL,UAAU;GACR,OAAO,EAAE,SAAS,CAAC,GAAG,OAAO,EAAE;EACjC;EACA,QAAQ;GACN,IAAI,cAAc,MAEhB;GAEF,YAAY;IACV,KAAK,QAAQ;IACb,MAAM,QAAQ;IACd,OAAO,QAAQ;IACf,MAAM,QAAQ;IACd,OAAO,QAAQ;GACjB;GACA,KAAK,MAAM,SAAS,QAClB,QAAQ,SAAS,kBAAkB,OAAO,UAAU,MAAM;EAE9D;EACA,OAAO;GACL,IAAI,cAAc,MAChB;GAEF,KAAK,MAAM,SAAS,QAClB,QAAQ,SAAS,UAAU;GAE7B,YAAY;EACd;CACF;AACF;;;;AAKA,SAAgB,UAAU,GAAG,WAA2C;CACtE,OAAO,EACL,SAAS,UACN,SAAS,MAAM,EAAE,OAAO,EACxB,MAAM,GAAG,MAAM,EAAE,UAAU,QAAQ,IAAI,EAAE,UAAU,QAAQ,CAAC,EACjE;AACF;;;;AAKA,SAAgB,YAA2B;CACzC,OAAO,EAAE,SAAS,CAAC,EAAE;AACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-collector-Cu6MCtAx.js","names":[],"sources":["../src/executor/log-collector.ts"],"sourcesContent":["import type { CollectedLogs, LogEntry, LogLevel, LogStream } from \"../types.js\";\n\n/**\n * Mapping from log level to output stream\n */\nconst LOG_STREAM_MAP: Record<LogLevel, LogStream> = {\n log: \"stdout\",\n info: \"stdout\",\n debug: \"stdout\",\n warn: \"stderr\",\n error: \"stderr\",\n};\n\n/**\n * All log levels\n */\nconst ALL_LOG_LEVELS: LogLevel[] = [\"log\", \"info\", \"debug\", \"warn\", \"error\"];\n\n/**\n * Options for log collector\n */\nexport interface LogCollectorOptions {\n /** Log levels to capture (default: all) */\n levels?: LogLevel[];\n /** Whether to call original console methods (default: true) */\n passthrough?: boolean;\n}\n\n/**\n * Log collector that intercepts console methods\n */\nexport interface LogCollector {\n /** Get collected logs */\n getLogs: () => CollectedLogs;\n /** Start collecting logs */\n start: () => void;\n /** Stop collecting and restore original console methods */\n stop: () => void;\n}\n\n/**\n * Format console arguments to string\n */\nexport function formatArgs(args: unknown[]): string {\n return args\n .map((arg) => {\n if (arg instanceof Error) {\n return arg.message;\n }\n if (typeof arg === \"object\" && arg !== null) {\n try {\n return JSON.stringify(arg);\n } catch {\n return String(arg);\n }\n }\n return String(arg);\n })\n .join(\" \");\n}\n\n/**\n * Create a log collector that intercepts console methods\n *\n * @param options - Options for the log collector\n * @returns A log collector instance\n *\n * @example\n * ```ts\n * const collector = createLogCollector();\n * collector.start();\n *\n * console.log(\"Info message\");\n * console.error(\"Something went wrong\");\n * console.warn(\"This is a warning\");\n *\n * collector.stop();\n * const logs = collector.getLogs();\n * // {\n * // entries: [\n * // { message: \"Info message\", level: \"log\", stream: \"stdout\", timestamp: ... },\n * // { message: \"Something went wrong\", level: \"error\", stream: \"stderr\", timestamp: ... },\n * // { message: \"This is a warning\", level: \"warn\", stream: \"stderr\", timestamp: ... }\n * // ]\n * // }\n * ```\n */\nexport function createLogCollector(options: LogCollectorOptions = {}): LogCollector {\n const entries: LogEntry[] = [];\n const levels = options.levels ?? ALL_LOG_LEVELS;\n const passthrough = options.passthrough ?? true;\n\n let originals: Record<LogLevel, typeof console.log> | null = null;\n\n const createInterceptor = (level: LogLevel, original: typeof console.log) => {\n return (...args: unknown[]) => {\n entries.push({\n message: formatArgs(args),\n timestamp: new Date(),\n level,\n stream: LOG_STREAM_MAP[level],\n });\n if (passthrough) {\n original.apply(console, args);\n }\n };\n };\n\n return {\n getLogs() {\n return { entries: [...entries] };\n },\n start() {\n if (originals !== null) {\n // Already started\n return;\n }\n originals = {\n log: console.log,\n info: console.info,\n debug: console.debug,\n warn: console.warn,\n error: console.error,\n };\n for (const level of levels) {\n console[level] = createInterceptor(level, originals[level]);\n }\n },\n stop() {\n if (originals === null) {\n return;\n }\n for (const level of levels) {\n console[level] = originals[level];\n }\n originals = null;\n },\n };\n}\n\n/**\n * Merge multiple CollectedLogs into one (sorted by timestamp)\n */\nexport function mergeLogs(...logsArray: CollectedLogs[]): CollectedLogs {\n return {\n entries: logsArray\n .flatMap((l) => l.entries)\n .sort((a, b) => a.timestamp.getTime() - b.timestamp.getTime()),\n };\n}\n\n/**\n * Create an empty CollectedLogs object\n */\nexport function emptyLogs(): CollectedLogs {\n return { entries: [] };\n}\n"],"mappings":";;;;AAKA,MAAM,iBAA8C;CAClD,KAAK;CACL,MAAM;CACN,OAAO;CACP,MAAM;CACN,OAAO;
|
|
1
|
+
{"version":3,"file":"log-collector-Cu6MCtAx.js","names":[],"sources":["../src/executor/log-collector.ts"],"sourcesContent":["import type { CollectedLogs, LogEntry, LogLevel, LogStream } from \"../types.js\";\n\n/**\n * Mapping from log level to output stream\n */\nconst LOG_STREAM_MAP: Record<LogLevel, LogStream> = {\n log: \"stdout\",\n info: \"stdout\",\n debug: \"stdout\",\n warn: \"stderr\",\n error: \"stderr\",\n};\n\n/**\n * All log levels\n */\nconst ALL_LOG_LEVELS: LogLevel[] = [\"log\", \"info\", \"debug\", \"warn\", \"error\"];\n\n/**\n * Options for log collector\n */\nexport interface LogCollectorOptions {\n /** Log levels to capture (default: all) */\n levels?: LogLevel[];\n /** Whether to call original console methods (default: true) */\n passthrough?: boolean;\n}\n\n/**\n * Log collector that intercepts console methods\n */\nexport interface LogCollector {\n /** Get collected logs */\n getLogs: () => CollectedLogs;\n /** Start collecting logs */\n start: () => void;\n /** Stop collecting and restore original console methods */\n stop: () => void;\n}\n\n/**\n * Format console arguments to string\n */\nexport function formatArgs(args: unknown[]): string {\n return args\n .map((arg) => {\n if (arg instanceof Error) {\n return arg.message;\n }\n if (typeof arg === \"object\" && arg !== null) {\n try {\n return JSON.stringify(arg);\n } catch {\n return String(arg);\n }\n }\n return String(arg);\n })\n .join(\" \");\n}\n\n/**\n * Create a log collector that intercepts console methods\n *\n * @param options - Options for the log collector\n * @returns A log collector instance\n *\n * @example\n * ```ts\n * const collector = createLogCollector();\n * collector.start();\n *\n * console.log(\"Info message\");\n * console.error(\"Something went wrong\");\n * console.warn(\"This is a warning\");\n *\n * collector.stop();\n * const logs = collector.getLogs();\n * // {\n * // entries: [\n * // { message: \"Info message\", level: \"log\", stream: \"stdout\", timestamp: ... },\n * // { message: \"Something went wrong\", level: \"error\", stream: \"stderr\", timestamp: ... },\n * // { message: \"This is a warning\", level: \"warn\", stream: \"stderr\", timestamp: ... }\n * // ]\n * // }\n * ```\n */\nexport function createLogCollector(options: LogCollectorOptions = {}): LogCollector {\n const entries: LogEntry[] = [];\n const levels = options.levels ?? ALL_LOG_LEVELS;\n const passthrough = options.passthrough ?? true;\n\n let originals: Record<LogLevel, typeof console.log> | null = null;\n\n const createInterceptor = (level: LogLevel, original: typeof console.log) => {\n return (...args: unknown[]) => {\n entries.push({\n message: formatArgs(args),\n timestamp: new Date(),\n level,\n stream: LOG_STREAM_MAP[level],\n });\n if (passthrough) {\n original.apply(console, args);\n }\n };\n };\n\n return {\n getLogs() {\n return { entries: [...entries] };\n },\n start() {\n if (originals !== null) {\n // Already started\n return;\n }\n originals = {\n log: console.log,\n info: console.info,\n debug: console.debug,\n warn: console.warn,\n error: console.error,\n };\n for (const level of levels) {\n console[level] = createInterceptor(level, originals[level]);\n }\n },\n stop() {\n if (originals === null) {\n return;\n }\n for (const level of levels) {\n console[level] = originals[level];\n }\n originals = null;\n },\n };\n}\n\n/**\n * Merge multiple CollectedLogs into one (sorted by timestamp)\n */\nexport function mergeLogs(...logsArray: CollectedLogs[]): CollectedLogs {\n return {\n entries: logsArray\n .flatMap((l) => l.entries)\n .sort((a, b) => a.timestamp.getTime() - b.timestamp.getTime()),\n };\n}\n\n/**\n * Create an empty CollectedLogs object\n */\nexport function emptyLogs(): CollectedLogs {\n return { entries: [] };\n}\n"],"mappings":";;;;AAKA,MAAM,iBAA8C;CAClD,KAAK;CACL,MAAM;CACN,OAAO;CACP,MAAM;CACN,OAAO;AACT;;;;AAKA,MAAM,iBAA6B;CAAC;CAAO;CAAQ;CAAS;CAAQ;AAAO;;;;AA2B3E,SAAgB,WAAW,MAAyB;CAClD,OAAO,KACJ,KAAK,QAAQ;EACZ,IAAI,eAAe,OACjB,OAAO,IAAI;EAEb,IAAI,OAAO,QAAQ,YAAY,QAAQ,MACrC,IAAI;GACF,OAAO,KAAK,UAAU,GAAG;EAC3B,QAAQ;GACN,OAAO,OAAO,GAAG;EACnB;EAEF,OAAO,OAAO,GAAG;CACnB,CAAC,EACA,KAAK,GAAG;AACb;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,mBAAmB,UAA+B,CAAC,GAAiB;CAClF,MAAM,UAAsB,CAAC;CAC7B,MAAM,SAAS,QAAQ,UAAU;CACjC,MAAM,cAAc,QAAQ,eAAe;CAE3C,IAAI,YAAyD;CAE7D,MAAM,qBAAqB,OAAiB,aAAiC;EAC3E,QAAQ,GAAG,SAAoB;GAC7B,QAAQ,KAAK;IACX,SAAS,WAAW,IAAI;IACxB,2BAAW,IAAI,KAAK;IACpB;IACA,QAAQ,eAAe;GACzB,CAAC;GACD,IAAI,aACF,SAAS,MAAM,SAAS,IAAI;EAEhC;CACF;CAEA,OAAO;EACL,UAAU;GACR,OAAO,EAAE,SAAS,CAAC,GAAG,OAAO,EAAE;EACjC;EACA,QAAQ;GACN,IAAI,cAAc,MAEhB;GAEF,YAAY;IACV,KAAK,QAAQ;IACb,MAAM,QAAQ;IACd,OAAO,QAAQ;IACf,MAAM,QAAQ;IACd,OAAO,QAAQ;GACjB;GACA,KAAK,MAAM,SAAS,QAClB,QAAQ,SAAS,kBAAkB,OAAO,UAAU,MAAM;EAE9D;EACA,OAAO;GACL,IAAI,cAAc,MAChB;GAEF,KAAK,MAAM,SAAS,QAClB,QAAQ,SAAS,UAAU;GAE7B,YAAY;EACd;CACF;AACF;;;;AAKA,SAAgB,UAAU,GAAG,WAA2C;CACtE,OAAO,EACL,SAAS,UACN,SAAS,MAAM,EAAE,OAAO,EACxB,MAAM,GAAG,MAAM,EAAE,UAAU,QAAQ,IAAI,EAAE,UAAU,QAAQ,CAAC,EACjE;AACF;;;;AAKA,SAAgB,YAA2B;CACzC,OAAO,EAAE,SAAS,CAAC,EAAE;AACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["isCancel","promptMissingArgs"],"sources":["../../../src/prompt/clack/index.ts"],"sourcesContent":["import { confirm, isCancel, password, select, text } from \"@clack/prompts\";\nimport type { PromptResolver } from \"../../types.js\";\nimport { promptMissingArgs } from \"../index.js\";\nimport type { PromptAdapter } from \"../types.js\";\n\nfunction createClackAdapter(): PromptAdapter {\n return {\n text: (config) =>\n text({\n message: config.message,\n ...(config.placeholder !== undefined && { placeholder: config.placeholder }),\n }),\n password: (config) => password(config),\n confirm: (config) => confirm(config),\n select: (config) => select(config),\n isCancelled: isCancel,\n };\n}\n\n/**\n * Prompt resolver backed by @clack/prompts.\n *\n * @example\n * ```ts\n * import { runMain, defineCommand } from \"politty\";\n * import { prompt } from \"politty/prompt/clack\";\n *\n * runMain(cmd, { version: \"1.0.0\", prompt });\n * ```\n */\nexport const prompt: PromptResolver = (rawArgs, extracted) =>\n promptMissingArgs(rawArgs, extracted, { adapter: createClackAdapter() });\n"],"mappings":";;;;;;AAKA,SAAS,qBAAoC;
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["isCancel","promptMissingArgs"],"sources":["../../../src/prompt/clack/index.ts"],"sourcesContent":["import { confirm, isCancel, password, select, text } from \"@clack/prompts\";\nimport type { PromptResolver } from \"../../types.js\";\nimport { promptMissingArgs } from \"../index.js\";\nimport type { PromptAdapter } from \"../types.js\";\n\nfunction createClackAdapter(): PromptAdapter {\n return {\n text: (config) =>\n text({\n message: config.message,\n ...(config.placeholder !== undefined && { placeholder: config.placeholder }),\n }),\n password: (config) => password(config),\n confirm: (config) => confirm(config),\n select: (config) => select(config),\n isCancelled: isCancel,\n };\n}\n\n/**\n * Prompt resolver backed by @clack/prompts.\n *\n * @example\n * ```ts\n * import { runMain, defineCommand } from \"politty\";\n * import { prompt } from \"politty/prompt/clack\";\n *\n * runMain(cmd, { version: \"1.0.0\", prompt });\n * ```\n */\nexport const prompt: PromptResolver = (rawArgs, extracted) =>\n promptMissingArgs(rawArgs, extracted, { adapter: createClackAdapter() });\n"],"mappings":";;;;;;AAKA,SAAS,qBAAoC;CAC3C,OAAO;EACL,OAAO,oCACA;GACH,SAAS,OAAO;GAChB,GAAI,OAAO,gBAAgB,UAAa,EAAE,aAAa,OAAO,YAAY;EAC5E,CAAC;EACH,WAAW,wCAAoB,MAAM;EACrC,UAAU,uCAAmB,MAAM;EACnC,SAAS,sCAAkB,MAAM;EACjC,aAAaA;CACf;AACF;;;;;;;;;;;;AAaA,MAAa,UAA0B,SAAS,cAC9CC,iCAAkB,SAAS,WAAW,EAAE,SAAS,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/prompt/clack/index.ts"],"mappings":";;;;;AA8BA
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/prompt/clack/index.ts"],"mappings":";;;;;AA8BA;;;;AAC0E;;;;;cAD7D,MAAA,EAAQ,cACqD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/prompt/clack/index.ts"],"mappings":";;;;;AA8BA
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/prompt/clack/index.ts"],"mappings":";;;;;AA8BA;;;;AAC0E;;;;;cAD7D,MAAA,EAAQ,cACqD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/prompt/clack/index.ts"],"sourcesContent":["import { confirm, isCancel, password, select, text } from \"@clack/prompts\";\nimport type { PromptResolver } from \"../../types.js\";\nimport { promptMissingArgs } from \"../index.js\";\nimport type { PromptAdapter } from \"../types.js\";\n\nfunction createClackAdapter(): PromptAdapter {\n return {\n text: (config) =>\n text({\n message: config.message,\n ...(config.placeholder !== undefined && { placeholder: config.placeholder }),\n }),\n password: (config) => password(config),\n confirm: (config) => confirm(config),\n select: (config) => select(config),\n isCancelled: isCancel,\n };\n}\n\n/**\n * Prompt resolver backed by @clack/prompts.\n *\n * @example\n * ```ts\n * import { runMain, defineCommand } from \"politty\";\n * import { prompt } from \"politty/prompt/clack\";\n *\n * runMain(cmd, { version: \"1.0.0\", prompt });\n * ```\n */\nexport const prompt: PromptResolver = (rawArgs, extracted) =>\n promptMissingArgs(rawArgs, extracted, { adapter: createClackAdapter() });\n"],"mappings":";;;;AAKA,SAAS,qBAAoC;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/prompt/clack/index.ts"],"sourcesContent":["import { confirm, isCancel, password, select, text } from \"@clack/prompts\";\nimport type { PromptResolver } from \"../../types.js\";\nimport { promptMissingArgs } from \"../index.js\";\nimport type { PromptAdapter } from \"../types.js\";\n\nfunction createClackAdapter(): PromptAdapter {\n return {\n text: (config) =>\n text({\n message: config.message,\n ...(config.placeholder !== undefined && { placeholder: config.placeholder }),\n }),\n password: (config) => password(config),\n confirm: (config) => confirm(config),\n select: (config) => select(config),\n isCancelled: isCancel,\n };\n}\n\n/**\n * Prompt resolver backed by @clack/prompts.\n *\n * @example\n * ```ts\n * import { runMain, defineCommand } from \"politty\";\n * import { prompt } from \"politty/prompt/clack\";\n *\n * runMain(cmd, { version: \"1.0.0\", prompt });\n * ```\n */\nexport const prompt: PromptResolver = (rawArgs, extracted) =>\n promptMissingArgs(rawArgs, extracted, { adapter: createClackAdapter() });\n"],"mappings":";;;;AAKA,SAAS,qBAAoC;CAC3C,OAAO;EACL,OAAO,WACL,KAAK;GACH,SAAS,OAAO;GAChB,GAAI,OAAO,gBAAgB,UAAa,EAAE,aAAa,OAAO,YAAY;EAC5E,CAAC;EACH,WAAW,WAAW,SAAS,MAAM;EACrC,UAAU,WAAW,QAAQ,MAAM;EACnC,SAAS,WAAW,OAAO,MAAM;EACjC,aAAa;CACf;AACF;;;;;;;;;;;;AAaA,MAAa,UAA0B,SAAS,cAC9C,kBAAkB,SAAS,WAAW,EAAE,SAAS,mBAAmB,EAAE,CAAC"}
|
package/dist/prompt/index.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/prompt/types.ts","../../src/prompt/prompt-resolver.ts","../../src/prompt/tty-detector.ts","../../src/prompt/index.ts"],"mappings":";;;;;AAKA;UAAiB,oBAAA;;EAEf,KAAA,EAAO,iBAAA;EAAP;EAEA,IAAA;EAAA;EAEA,OAAA;EAEA;EAAA,OAAA,GAAU,
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/prompt/types.ts","../../src/prompt/prompt-resolver.ts","../../src/prompt/tty-detector.ts","../../src/prompt/index.ts"],"mappings":";;;;;AAKA;UAAiB,oBAAA;;EAEf,KAAA,EAAO,iBAAA;EAAP;EAEA,IAAA;EAAA;EAEA,OAAA;EAEA;EAAA,OAAA,GAAU,KAAK;IAAG,KAAA;IAAe,KAAA;EAAA;AAAA;AAOnC;;;;AAAA,UAAiB,aAAA;EAMuB;EAJtC,IAAA,CAAK,MAAA;IAAU,OAAA;IAAiB,WAAA;EAAA,IAAqC,OAAA;EAArE;EAEA,QAAA,CAAS,MAAA;IAAU,OAAA;EAAA,IAAoB,OAAA;EAF8B;EAIrE,OAAA,CAAQ,MAAA;IAAU,OAAA;EAAA,IAAoB,OAAA;EAFC;EAIvC,MAAA,CAAO,MAAA;IACL,OAAA;IACA,OAAA,EAAS,KAAA;MAAQ,KAAA;MAAe,KAAA;IAAA;EAAA,IAC9B,OAAA;EADO;EAGX,WAAA,CAAY,KAAA;AAAA;;;;AA5Bd;;;;;;;;;;;;;iBCYgB,mBAAA,CAAoB,KAAA,EAAO,iBAAA,GAAoB,oBAAoB;ADGnF;;;;;;;;;;;;;AAAA,iBC+DgB,iBAAA,CACd,MAAA,EAAQ,iBAAA,IACR,OAAA,EAAS,MAAA,oBACR,oBAAA;;;;;;ADjFH;iBEDgB,aAAA,CAAA;;;;;;UCQC,aAAA;EHHf;EGKA,OAAA,EAAS,aAAa;EHDtB;EGGA,WAAA;AAAA;;;AHHsC;AAOxC;;;;iBGMsB,iBAAA,CACpB,OAAA,EAAS,MAAA,mBACT,SAAA,EAAW,eAAA,EACX,OAAA,EAAS,aAAA,GACR,OAAA,CAAQ,MAAA"}
|
package/dist/prompt/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/prompt/types.ts","../../src/prompt/prompt-resolver.ts","../../src/prompt/tty-detector.ts","../../src/prompt/index.ts"],"mappings":";;;;;AAKA;UAAiB,oBAAA;;EAEf,KAAA,EAAO,iBAAA;EAAP;EAEA,IAAA;EAAA;EAEA,OAAA;EAEA;EAAA,OAAA,GAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/prompt/types.ts","../../src/prompt/prompt-resolver.ts","../../src/prompt/tty-detector.ts","../../src/prompt/index.ts"],"mappings":";;;;;AAKA;UAAiB,oBAAA;;EAEf,KAAA,EAAO,iBAAA;EAAP;EAEA,IAAA;EAAA;EAEA,OAAA;EAEA;EAAA,OAAA,GAAU,KAAK;IAAG,KAAA;IAAe,KAAA;EAAA;AAAA;AAOnC;;;;AAAA,UAAiB,aAAA;EAMuB;EAJtC,IAAA,CAAK,MAAA;IAAU,OAAA;IAAiB,WAAA;EAAA,IAAqC,OAAA;EAArE;EAEA,QAAA,CAAS,MAAA;IAAU,OAAA;EAAA,IAAoB,OAAA;EAF8B;EAIrE,OAAA,CAAQ,MAAA;IAAU,OAAA;EAAA,IAAoB,OAAA;EAFC;EAIvC,MAAA,CAAO,MAAA;IACL,OAAA;IACA,OAAA,EAAS,KAAA;MAAQ,KAAA;MAAe,KAAA;IAAA;EAAA,IAC9B,OAAA;EADO;EAGX,WAAA,CAAY,KAAA;AAAA;;;;AA5Bd;;;;;;;;;;;;;iBCYgB,mBAAA,CAAoB,KAAA,EAAO,iBAAA,GAAoB,oBAAoB;ADGnF;;;;;;;;;;;;;AAAA,iBC+DgB,iBAAA,CACd,MAAA,EAAQ,iBAAA,IACR,OAAA,EAAS,MAAA,oBACR,oBAAA;;;;;;ADjFH;iBEDgB,aAAA,CAAA;;;;;;UCQC,aAAA;EHHf;EGKA,OAAA,EAAS,aAAa;EHDtB;EGGA,WAAA;AAAA;;;AHHsC;AAOxC;;;;iBGMsB,iBAAA,CACpB,OAAA,EAAS,MAAA,mBACT,SAAA,EAAW,eAAA,EACX,OAAA,EAAS,aAAA,GACR,OAAA,CAAQ,MAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["promptMissingArgs"],"sources":["../../../src/prompt/inquirer/index.ts"],"sourcesContent":["import { confirm, input, password, select } from \"@inquirer/prompts\";\nimport type { PromptResolver } from \"../../types.js\";\nimport { promptMissingArgs } from \"../index.js\";\nimport type { PromptAdapter } from \"../types.js\";\n\nconst cancelSymbol = Symbol(\"inquirer-cancel\");\n\nasync function wrapCancellation<T>(fn: () => Promise<T>): Promise<T | symbol> {\n try {\n return await fn();\n } catch (error) {\n if (error instanceof Error && error.name === \"ExitPromptError\") {\n return cancelSymbol;\n }\n throw error;\n }\n}\n\nfunction createInquirerAdapter(): PromptAdapter {\n return {\n text: (config) =>\n wrapCancellation(() =>\n input({\n message: config.message,\n ...(config.placeholder !== undefined && { default: config.placeholder }),\n }),\n ),\n password: (config) => wrapCancellation(() => password({ message: config.message })),\n confirm: (config) => wrapCancellation(() => confirm({ message: config.message })),\n select: (config) =>\n wrapCancellation(() =>\n select({\n message: config.message,\n choices: config.options.map((o) => ({ name: o.label, value: o.value })),\n }),\n ),\n isCancelled: (value) => value === cancelSymbol,\n };\n}\n\n/**\n * Prompt resolver backed by @inquirer/prompts.\n *\n * @example\n * ```ts\n * import { runMain, defineCommand } from \"politty\";\n * import { prompt } from \"politty/prompt/inquirer\";\n *\n * runMain(cmd, { version: \"1.0.0\", prompt });\n * ```\n */\nexport const prompt: PromptResolver = (rawArgs, extracted) =>\n promptMissingArgs(rawArgs, extracted, { adapter: createInquirerAdapter() });\n"],"mappings":";;;;;;AAKA,MAAM,eAAe,OAAO,
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["promptMissingArgs"],"sources":["../../../src/prompt/inquirer/index.ts"],"sourcesContent":["import { confirm, input, password, select } from \"@inquirer/prompts\";\nimport type { PromptResolver } from \"../../types.js\";\nimport { promptMissingArgs } from \"../index.js\";\nimport type { PromptAdapter } from \"../types.js\";\n\nconst cancelSymbol = Symbol(\"inquirer-cancel\");\n\nasync function wrapCancellation<T>(fn: () => Promise<T>): Promise<T | symbol> {\n try {\n return await fn();\n } catch (error) {\n if (error instanceof Error && error.name === \"ExitPromptError\") {\n return cancelSymbol;\n }\n throw error;\n }\n}\n\nfunction createInquirerAdapter(): PromptAdapter {\n return {\n text: (config) =>\n wrapCancellation(() =>\n input({\n message: config.message,\n ...(config.placeholder !== undefined && { default: config.placeholder }),\n }),\n ),\n password: (config) => wrapCancellation(() => password({ message: config.message })),\n confirm: (config) => wrapCancellation(() => confirm({ message: config.message })),\n select: (config) =>\n wrapCancellation(() =>\n select({\n message: config.message,\n choices: config.options.map((o) => ({ name: o.label, value: o.value })),\n }),\n ),\n isCancelled: (value) => value === cancelSymbol,\n };\n}\n\n/**\n * Prompt resolver backed by @inquirer/prompts.\n *\n * @example\n * ```ts\n * import { runMain, defineCommand } from \"politty\";\n * import { prompt } from \"politty/prompt/inquirer\";\n *\n * runMain(cmd, { version: \"1.0.0\", prompt });\n * ```\n */\nexport const prompt: PromptResolver = (rawArgs, extracted) =>\n promptMissingArgs(rawArgs, extracted, { adapter: createInquirerAdapter() });\n"],"mappings":";;;;;;AAKA,MAAM,eAAe,OAAO,iBAAiB;AAE7C,eAAe,iBAAoB,IAA2C;CAC5E,IAAI;EACF,OAAO,MAAM,GAAG;CAClB,SAAS,OAAO;EACd,IAAI,iBAAiB,SAAS,MAAM,SAAS,mBAC3C,OAAO;EAET,MAAM;CACR;AACF;AAEA,SAAS,wBAAuC;CAC9C,OAAO;EACL,OAAO,WACL,oDACQ;GACJ,SAAS,OAAO;GAChB,GAAI,OAAO,gBAAgB,UAAa,EAAE,SAAS,OAAO,YAAY;EACxE,CAAC,CACH;EACF,WAAW,WAAW,uDAAgC,EAAE,SAAS,OAAO,QAAQ,CAAC,CAAC;EAClF,UAAU,WAAW,sDAA+B,EAAE,SAAS,OAAO,QAAQ,CAAC,CAAC;EAChF,SAAS,WACP,qDACS;GACL,SAAS,OAAO;GAChB,SAAS,OAAO,QAAQ,KAAK,OAAO;IAAE,MAAM,EAAE;IAAO,OAAO,EAAE;GAAM,EAAE;EACxE,CAAC,CACH;EACF,cAAc,UAAU,UAAU;CACpC;AACF;;;;;;;;;;;;AAaA,MAAa,UAA0B,SAAS,cAC9CA,iCAAkB,SAAS,WAAW,EAAE,SAAS,sBAAsB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/prompt/inquirer/index.ts"],"mappings":";;;;;AAmDA
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/prompt/inquirer/index.ts"],"mappings":";;;;;AAmDA;;;;AAC6E;;;;;cADhE,MAAA,EAAQ,cACwD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/prompt/inquirer/index.ts"],"mappings":";;;;;AAmDA
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/prompt/inquirer/index.ts"],"mappings":";;;;;AAmDA;;;;AAC6E;;;;;cADhE,MAAA,EAAQ,cACwD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/prompt/inquirer/index.ts"],"sourcesContent":["import { confirm, input, password, select } from \"@inquirer/prompts\";\nimport type { PromptResolver } from \"../../types.js\";\nimport { promptMissingArgs } from \"../index.js\";\nimport type { PromptAdapter } from \"../types.js\";\n\nconst cancelSymbol = Symbol(\"inquirer-cancel\");\n\nasync function wrapCancellation<T>(fn: () => Promise<T>): Promise<T | symbol> {\n try {\n return await fn();\n } catch (error) {\n if (error instanceof Error && error.name === \"ExitPromptError\") {\n return cancelSymbol;\n }\n throw error;\n }\n}\n\nfunction createInquirerAdapter(): PromptAdapter {\n return {\n text: (config) =>\n wrapCancellation(() =>\n input({\n message: config.message,\n ...(config.placeholder !== undefined && { default: config.placeholder }),\n }),\n ),\n password: (config) => wrapCancellation(() => password({ message: config.message })),\n confirm: (config) => wrapCancellation(() => confirm({ message: config.message })),\n select: (config) =>\n wrapCancellation(() =>\n select({\n message: config.message,\n choices: config.options.map((o) => ({ name: o.label, value: o.value })),\n }),\n ),\n isCancelled: (value) => value === cancelSymbol,\n };\n}\n\n/**\n * Prompt resolver backed by @inquirer/prompts.\n *\n * @example\n * ```ts\n * import { runMain, defineCommand } from \"politty\";\n * import { prompt } from \"politty/prompt/inquirer\";\n *\n * runMain(cmd, { version: \"1.0.0\", prompt });\n * ```\n */\nexport const prompt: PromptResolver = (rawArgs, extracted) =>\n promptMissingArgs(rawArgs, extracted, { adapter: createInquirerAdapter() });\n"],"mappings":";;;;AAKA,MAAM,eAAe,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/prompt/inquirer/index.ts"],"sourcesContent":["import { confirm, input, password, select } from \"@inquirer/prompts\";\nimport type { PromptResolver } from \"../../types.js\";\nimport { promptMissingArgs } from \"../index.js\";\nimport type { PromptAdapter } from \"../types.js\";\n\nconst cancelSymbol = Symbol(\"inquirer-cancel\");\n\nasync function wrapCancellation<T>(fn: () => Promise<T>): Promise<T | symbol> {\n try {\n return await fn();\n } catch (error) {\n if (error instanceof Error && error.name === \"ExitPromptError\") {\n return cancelSymbol;\n }\n throw error;\n }\n}\n\nfunction createInquirerAdapter(): PromptAdapter {\n return {\n text: (config) =>\n wrapCancellation(() =>\n input({\n message: config.message,\n ...(config.placeholder !== undefined && { default: config.placeholder }),\n }),\n ),\n password: (config) => wrapCancellation(() => password({ message: config.message })),\n confirm: (config) => wrapCancellation(() => confirm({ message: config.message })),\n select: (config) =>\n wrapCancellation(() =>\n select({\n message: config.message,\n choices: config.options.map((o) => ({ name: o.label, value: o.value })),\n }),\n ),\n isCancelled: (value) => value === cancelSymbol,\n };\n}\n\n/**\n * Prompt resolver backed by @inquirer/prompts.\n *\n * @example\n * ```ts\n * import { runMain, defineCommand } from \"politty\";\n * import { prompt } from \"politty/prompt/inquirer\";\n *\n * runMain(cmd, { version: \"1.0.0\", prompt });\n * ```\n */\nexport const prompt: PromptResolver = (rawArgs, extracted) =>\n promptMissingArgs(rawArgs, extracted, { adapter: createInquirerAdapter() });\n"],"mappings":";;;;AAKA,MAAM,eAAe,OAAO,iBAAiB;AAE7C,eAAe,iBAAoB,IAA2C;CAC5E,IAAI;EACF,OAAO,MAAM,GAAG;CAClB,SAAS,OAAO;EACd,IAAI,iBAAiB,SAAS,MAAM,SAAS,mBAC3C,OAAO;EAET,MAAM;CACR;AACF;AAEA,SAAS,wBAAuC;CAC9C,OAAO;EACL,OAAO,WACL,uBACE,MAAM;GACJ,SAAS,OAAO;GAChB,GAAI,OAAO,gBAAgB,UAAa,EAAE,SAAS,OAAO,YAAY;EACxE,CAAC,CACH;EACF,WAAW,WAAW,uBAAuB,SAAS,EAAE,SAAS,OAAO,QAAQ,CAAC,CAAC;EAClF,UAAU,WAAW,uBAAuB,QAAQ,EAAE,SAAS,OAAO,QAAQ,CAAC,CAAC;EAChF,SAAS,WACP,uBACE,OAAO;GACL,SAAS,OAAO;GAChB,SAAS,OAAO,QAAQ,KAAK,OAAO;IAAE,MAAM,EAAE;IAAO,OAAO,EAAE;GAAM,EAAE;EACxE,CAAC,CACH;EACF,cAAc,UAAU,UAAU;CACpC;AACF;;;;;;;;;;;;AAaA,MAAa,UAA0B,SAAS,cAC9C,kBAAkB,SAAS,WAAW,EAAE,SAAS,sBAAsB,EAAE,CAAC"}
|