genomic 0.0.1 → 4.0.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/prompt.d.ts ADDED
@@ -0,0 +1,116 @@
1
+ import { Readable, Writable } from 'stream';
2
+ import { AutocompleteQuestion, CheckboxQuestion, ConfirmQuestion, ListQuestion, NumberQuestion, OptionValue, Question, TextQuestion, Validation } from './question';
3
+ import { DefaultResolverRegistry } from './resolvers';
4
+ export interface ManPageInfo {
5
+ commandName: string;
6
+ questions: Question[];
7
+ author?: string;
8
+ description?: string;
9
+ }
10
+ export interface PromptOptions {
11
+ usageText?: string;
12
+ manPageInfo?: ManPageInfo;
13
+ mutateArgs?: boolean;
14
+ }
15
+ export declare function reorderQuestionsByDeps(questions: Question[]): Question[];
16
+ declare class PromptContext {
17
+ numTries: number;
18
+ needsInput: boolean;
19
+ validation: Validation;
20
+ constructor();
21
+ tryAgain(validation: Partial<Validation>): void;
22
+ nextQuestion(): void;
23
+ process(validation: Validation | boolean): Validation;
24
+ }
25
+ export interface PrompterOptions {
26
+ noTty?: boolean;
27
+ input?: Readable;
28
+ output?: Writable;
29
+ useDefaults?: boolean;
30
+ globalMaxLines?: number;
31
+ mutateArgs?: boolean;
32
+ resolverRegistry?: DefaultResolverRegistry;
33
+ }
34
+ export declare class Prompter {
35
+ private rl;
36
+ private keypress;
37
+ private noTty;
38
+ private output;
39
+ private input;
40
+ private useDefaults;
41
+ private globalMaxLines;
42
+ private mutateArgs;
43
+ private resolverRegistry;
44
+ private handledKeys;
45
+ constructor(options?: PrompterOptions);
46
+ private clearScreen;
47
+ private write;
48
+ private log;
49
+ private getInput;
50
+ private getPrompt;
51
+ private displayPrompt;
52
+ generateManPage(opts: ManPageInfo): string;
53
+ private isValidatableAnswer;
54
+ private validateAnswer;
55
+ private isValid;
56
+ private validateAnswerPattern;
57
+ private isEmptyAnswer;
58
+ private sanitizeAnswer;
59
+ exit(): void;
60
+ prompt<T extends object>(argv: T, questions: Question[], options?: PromptOptions): Promise<T>;
61
+ private handleMissingArgsError;
62
+ private hasMissingRequiredArgs;
63
+ /**
64
+ * Resolves the default value for a question using the resolver system.
65
+ * Priority: defaultFrom > default > undefined
66
+ */
67
+ private resolveQuestionDefault;
68
+ /**
69
+ * Resolves dynamic defaults for all questions that have defaultFrom specified.
70
+ * Updates the question.default property with the resolved value.
71
+ */
72
+ private resolveDynamicDefaults;
73
+ /**
74
+ * Resolves setFrom values for all questions that have setFrom specified.
75
+ * Sets the value directly in obj, bypassing the prompt entirely.
76
+ */
77
+ private resolveSetValues;
78
+ /**
79
+ * Resolves optionsFrom values for all questions that have optionsFrom specified.
80
+ * Updates the question.options property with the resolved array.
81
+ */
82
+ private resolveOptionsFrom;
83
+ /**
84
+ * Extracts positional arguments from obj._ and assigns them to questions marked with _: true.
85
+ *
86
+ * Rules:
87
+ * 1. Named arguments take precedence - if a question already has a value in obj, skip it
88
+ * 2. Positional questions consume from obj._ left-to-right in declaration order
89
+ * 3. Returns the count of consumed positionals so caller can strip them from obj._
90
+ * 4. Missing positional values leave questions unset (for prompting/validation)
91
+ *
92
+ * This effectively allows "naming positional parameters" - users can pass values
93
+ * without flags and they'll be assigned to the appropriate question names.
94
+ *
95
+ * @returns The number of positional arguments consumed
96
+ */
97
+ private extractPositionalArgs;
98
+ private applyDefaultValues;
99
+ private applyOverrides;
100
+ private handleOverrides;
101
+ private handleOverridesForCheckboxOptions;
102
+ private handleOverridesWithOptions;
103
+ private handleQuestionType;
104
+ confirm(question: ConfirmQuestion, ctx: PromptContext): Promise<boolean>;
105
+ text(question: TextQuestion, ctx: PromptContext): Promise<string | null>;
106
+ number(question: NumberQuestion, ctx: PromptContext): Promise<number | null>;
107
+ checkbox(question: CheckboxQuestion, ctx: PromptContext): Promise<OptionValue[]>;
108
+ autocomplete(question: AutocompleteQuestion, ctx: PromptContext): Promise<any>;
109
+ list(question: ListQuestion, ctx: PromptContext): Promise<any>;
110
+ private getOptionValue;
111
+ private sanitizeOptions;
112
+ private filterOptions;
113
+ private getMaxLines;
114
+ close(): void;
115
+ }
116
+ export {};