@reliverse/rempts-core 1.6.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/LICENSE +21 -0
- package/README.md +102 -0
- package/bin/core-impl/anykey/anykey-mod.d.ts +12 -0
- package/bin/core-impl/anykey/anykey-mod.js +125 -0
- package/bin/core-impl/date/date.d.ts +2 -0
- package/bin/core-impl/date/date.js +236 -0
- package/bin/core-impl/editor/editor-mod.d.ts +25 -0
- package/bin/core-impl/editor/editor-mod.js +896 -0
- package/bin/core-impl/figures/figures-mod.d.ts +233 -0
- package/bin/core-impl/figures/figures-mod.js +286 -0
- package/bin/core-impl/figures/figures.test.d.ts +1 -0
- package/bin/core-impl/figures/figures.test.js +474 -0
- package/bin/core-impl/input/confirm-prompt.d.ts +5 -0
- package/bin/core-impl/input/confirm-prompt.js +173 -0
- package/bin/core-impl/input/input-prompt.d.ts +16 -0
- package/bin/core-impl/input/input-prompt.js +370 -0
- package/bin/core-impl/launcher/_parser.d.ts +2 -0
- package/bin/core-impl/launcher/_parser.js +122 -0
- package/bin/core-impl/launcher/_utils.d.ts +8 -0
- package/bin/core-impl/launcher/_utils.js +29 -0
- package/bin/core-impl/launcher/args.d.ts +3 -0
- package/bin/core-impl/launcher/args.js +89 -0
- package/bin/core-impl/launcher/command.d.ts +8 -0
- package/bin/core-impl/launcher/command.js +68 -0
- package/bin/core-impl/launcher/launcher-mod.d.ts +8 -0
- package/bin/core-impl/launcher/launcher-mod.js +34 -0
- package/bin/core-impl/launcher/usage.d.ts +3 -0
- package/bin/core-impl/launcher/usage.js +104 -0
- package/bin/core-impl/msg-fmt/colors.d.ts +30 -0
- package/bin/core-impl/msg-fmt/colors.js +42 -0
- package/bin/core-impl/msg-fmt/logger.d.ts +17 -0
- package/bin/core-impl/msg-fmt/logger.js +106 -0
- package/bin/core-impl/msg-fmt/mapping.d.ts +3 -0
- package/bin/core-impl/msg-fmt/mapping.js +49 -0
- package/bin/core-impl/msg-fmt/messages.d.ts +35 -0
- package/bin/core-impl/msg-fmt/messages.js +314 -0
- package/bin/core-impl/msg-fmt/terminal.d.ts +15 -0
- package/bin/core-impl/msg-fmt/terminal.js +59 -0
- package/bin/core-impl/msg-fmt/variants.d.ts +11 -0
- package/bin/core-impl/msg-fmt/variants.js +52 -0
- package/bin/core-impl/next-steps/next-steps.d.ts +14 -0
- package/bin/core-impl/next-steps/next-steps.js +24 -0
- package/bin/core-impl/number/number-mod.d.ts +28 -0
- package/bin/core-impl/number/number-mod.js +197 -0
- package/bin/core-impl/results/results.d.ts +7 -0
- package/bin/core-impl/results/results.js +27 -0
- package/bin/core-impl/select/multiselect-prompt.d.ts +2 -0
- package/bin/core-impl/select/multiselect-prompt.js +341 -0
- package/bin/core-impl/select/nummultiselect-prompt.d.ts +6 -0
- package/bin/core-impl/select/nummultiselect-prompt.js +105 -0
- package/bin/core-impl/select/numselect-prompt.d.ts +7 -0
- package/bin/core-impl/select/numselect-prompt.js +115 -0
- package/bin/core-impl/select/select-prompt.d.ts +33 -0
- package/bin/core-impl/select/select-prompt.js +302 -0
- package/bin/core-impl/select/toggle-prompt.d.ts +5 -0
- package/bin/core-impl/select/toggle-prompt.js +208 -0
- package/bin/core-impl/st-end/end.d.ts +2 -0
- package/bin/core-impl/st-end/end.js +42 -0
- package/bin/core-impl/st-end/start.d.ts +17 -0
- package/bin/core-impl/st-end/start.js +66 -0
- package/bin/core-impl/task/progress.d.ts +2 -0
- package/bin/core-impl/task/progress.js +57 -0
- package/bin/core-impl/task/spinner.d.ts +15 -0
- package/bin/core-impl/task/spinner.js +110 -0
- package/bin/core-impl/utils/colorize.d.ts +2 -0
- package/bin/core-impl/utils/colorize.js +134 -0
- package/bin/core-impl/utils/errors.d.ts +1 -0
- package/bin/core-impl/utils/errors.js +15 -0
- package/bin/core-impl/utils/prevent.d.ts +10 -0
- package/bin/core-impl/utils/prevent.js +69 -0
- package/bin/core-impl/utils/prompt-end.d.ts +8 -0
- package/bin/core-impl/utils/prompt-end.js +33 -0
- package/bin/core-impl/utils/stream-text.d.ts +18 -0
- package/bin/core-impl/utils/stream-text.js +136 -0
- package/bin/core-impl/utils/system.d.ts +6 -0
- package/bin/core-impl/utils/system.js +7 -0
- package/bin/core-impl/utils/validate.d.ts +22 -0
- package/bin/core-impl/utils/validate.js +17 -0
- package/bin/core-impl/visual/animate/animate.d.ts +14 -0
- package/bin/core-impl/visual/animate/animate.js +64 -0
- package/bin/core-impl/visual/ascii-art/ascii-art.d.ts +6 -0
- package/bin/core-impl/visual/ascii-art/ascii-art.js +12 -0
- package/bin/core-types.d.ts +434 -0
- package/bin/core-types.js +0 -0
- package/bin/main.d.ts +41 -0
- package/bin/main.js +96 -0
- package/package.json +58 -0
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
export type MsgType = "M_NULL" | "M_INFO_NULL" | "M_START" | "M_MIDDLE" | "M_GENERAL" | "M_GENERAL_NULL" | "M_INFO" | "M_ERROR" | "M_ERROR_NULL" | "M_END" | "M_NEWLINE" | "M_BAR";
|
|
2
|
+
export type TypographyName = "bold" | "strikethrough" | "underline" | "italic" | "none";
|
|
3
|
+
export type BorderColorName = "reset" | "inverse" | "dim" | "black" | "red" | "redBright" | "green" | "greenBright" | "yellow" | "yellowBright" | "blue" | "blueBright" | "magenta" | "magentaBright" | "cyan" | "cyanBright" | "bgCyan" | "bgCyanBright" | "white" | "gray";
|
|
4
|
+
export type ColorName = BorderColorName | "gradientGradient" | "rainbowGradient" | "cristalGradient" | "mindGradient" | "passionGradient" | "viceGradient" | "retroGradient" | "none";
|
|
5
|
+
export type AnimationName = "rainbow" | "pulse" | "glitch" | "radar" | "neon" | "karaoke";
|
|
6
|
+
export type VariantName = "doubleBox" | "none";
|
|
7
|
+
export type MsgConfig = {
|
|
8
|
+
symbol: string;
|
|
9
|
+
prefix?: string;
|
|
10
|
+
color?: (text: string) => string;
|
|
11
|
+
newLineBefore?: boolean;
|
|
12
|
+
newLineAfter?: boolean;
|
|
13
|
+
suffix?: string;
|
|
14
|
+
};
|
|
15
|
+
export type PromptOptions = {
|
|
16
|
+
schema?: any;
|
|
17
|
+
title?: string;
|
|
18
|
+
titleColor?: ColorName;
|
|
19
|
+
titleTypography?: TypographyName;
|
|
20
|
+
titleVariant?: VariantName;
|
|
21
|
+
titleAnimation?: AnimationName;
|
|
22
|
+
titleAnimationDelay?: number;
|
|
23
|
+
content?: string;
|
|
24
|
+
contentColor?: ColorName;
|
|
25
|
+
contentTypography?: TypographyName;
|
|
26
|
+
contentVariant?: VariantName;
|
|
27
|
+
hint?: string;
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
validate?: (value: any) => boolean | string | Promise<boolean | string>;
|
|
30
|
+
defaultColor?: ColorName;
|
|
31
|
+
defaultTypography?: TypographyName;
|
|
32
|
+
choices?: ChoiceOptions[];
|
|
33
|
+
variantOptions?: {
|
|
34
|
+
box?: {
|
|
35
|
+
limit?: number;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
action?: () => Promise<void>;
|
|
39
|
+
border?: boolean;
|
|
40
|
+
borderColor?: BorderColorName;
|
|
41
|
+
additionalLinesToDelete?: number;
|
|
42
|
+
hintPlaceholderColor?: ColorName;
|
|
43
|
+
hints?: string[];
|
|
44
|
+
required?: boolean;
|
|
45
|
+
initial?: any[];
|
|
46
|
+
endTitle?: string;
|
|
47
|
+
endTitleColor?: ColorName;
|
|
48
|
+
horizontalLine?: boolean;
|
|
49
|
+
horizontalLineLength?: number;
|
|
50
|
+
symbol?: string;
|
|
51
|
+
customSymbol?: string;
|
|
52
|
+
};
|
|
53
|
+
export type ChoiceRequiredOptions = {
|
|
54
|
+
id: string;
|
|
55
|
+
title: string;
|
|
56
|
+
};
|
|
57
|
+
export type ChoiceOptionalOptions = {
|
|
58
|
+
description?: string;
|
|
59
|
+
titleTypography?: TypographyName;
|
|
60
|
+
action?: () => Promise<void>;
|
|
61
|
+
};
|
|
62
|
+
export type ChoiceOptions = ChoiceRequiredOptions & ChoiceOptionalOptions;
|
|
63
|
+
export type SelectOption<T> = {
|
|
64
|
+
value: T;
|
|
65
|
+
label: string;
|
|
66
|
+
hint?: string;
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Standard terminal colors supported by most terminals
|
|
71
|
+
*/
|
|
72
|
+
export type StandardColor = "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray";
|
|
73
|
+
/**
|
|
74
|
+
* All possible output colors including special colors
|
|
75
|
+
*/
|
|
76
|
+
export type OutputColor = StandardColor | "dim";
|
|
77
|
+
export type EditorExitResult = {
|
|
78
|
+
saved: boolean;
|
|
79
|
+
content: string | null;
|
|
80
|
+
filename: string | null;
|
|
81
|
+
};
|
|
82
|
+
export type ArgType = "boolean" | "string" | "number" | "enum" | "positional" | undefined;
|
|
83
|
+
export type _ArgDef<T extends ArgType, VT extends boolean | number | string> = {
|
|
84
|
+
type?: T;
|
|
85
|
+
description?: string;
|
|
86
|
+
valueHint?: string;
|
|
87
|
+
alias?: string | string[];
|
|
88
|
+
default?: VT;
|
|
89
|
+
required?: boolean;
|
|
90
|
+
options?: (string | number)[];
|
|
91
|
+
};
|
|
92
|
+
export type BooleanArgDef = Omit<_ArgDef<"boolean", boolean>, "options"> & {
|
|
93
|
+
negativeDescription?: string;
|
|
94
|
+
};
|
|
95
|
+
export type StringArgDef = Omit<_ArgDef<"string", string>, "options">;
|
|
96
|
+
export type NumberArgDef = Omit<_ArgDef<"number", number>, "options">;
|
|
97
|
+
export type EnumArgDef = _ArgDef<"enum", string>;
|
|
98
|
+
export type PositionalArgDef = Omit<_ArgDef<"positional", string>, "alias" | "options">;
|
|
99
|
+
export type ArgDef = BooleanArgDef | StringArgDef | NumberArgDef | PositionalArgDef | EnumArgDef;
|
|
100
|
+
export type ArgsDef = Record<string, ArgDef>;
|
|
101
|
+
export type Arg = ArgDef & {
|
|
102
|
+
name: string;
|
|
103
|
+
alias: string[];
|
|
104
|
+
};
|
|
105
|
+
export type Dict<T> = Record<string, T>;
|
|
106
|
+
export type Arrayable<T> = T | T[];
|
|
107
|
+
export type Default = Dict<any>;
|
|
108
|
+
export type ParserOptions = {
|
|
109
|
+
boolean?: Arrayable<string>;
|
|
110
|
+
string?: Arrayable<string>;
|
|
111
|
+
alias?: Dict<Arrayable<string>>;
|
|
112
|
+
default?: Dict<any>;
|
|
113
|
+
unknown?(flag: string): void;
|
|
114
|
+
};
|
|
115
|
+
export type ParserArgv<T = Default> = T & {
|
|
116
|
+
_: string[];
|
|
117
|
+
};
|
|
118
|
+
type ResolveParsedArgType<T extends ArgDef, VT> = T extends {
|
|
119
|
+
default?: any;
|
|
120
|
+
required?: boolean;
|
|
121
|
+
} ? T["default"] extends NonNullable<VT> ? VT : T["required"] extends true ? VT : VT | undefined : VT | undefined;
|
|
122
|
+
type ParsedPositionalArg<T extends ArgDef> = T extends {
|
|
123
|
+
type: "positional";
|
|
124
|
+
} ? ResolveParsedArgType<T, string> : never;
|
|
125
|
+
type ParsedStringArg<T extends ArgDef> = T extends {
|
|
126
|
+
type: "string";
|
|
127
|
+
} ? ResolveParsedArgType<T, string> : never;
|
|
128
|
+
type ParsedNumberArg<T extends ArgDef> = T extends {
|
|
129
|
+
type: "number";
|
|
130
|
+
} ? ResolveParsedArgType<T, number> : never;
|
|
131
|
+
type ParsedBooleanArg<T extends ArgDef> = T extends {
|
|
132
|
+
type: "boolean";
|
|
133
|
+
} ? ResolveParsedArgType<T, boolean> : never;
|
|
134
|
+
type ParsedEnumArg<T extends ArgDef> = T extends {
|
|
135
|
+
type: "enum";
|
|
136
|
+
options: infer U;
|
|
137
|
+
} ? U extends any[] ? ResolveParsedArgType<T, U[number]> : never : never;
|
|
138
|
+
type RawArgs = {
|
|
139
|
+
_: string[];
|
|
140
|
+
};
|
|
141
|
+
type ParsedArg<T extends ArgDef> = T["type"] extends "positional" ? ParsedPositionalArg<T> : T["type"] extends "boolean" ? ParsedBooleanArg<T> : T["type"] extends "string" ? ParsedStringArg<T> : T["type"] extends "number" ? ParsedNumberArg<T> : T["type"] extends "enum" ? ParsedEnumArg<T> : never;
|
|
142
|
+
export type ParsedArgs<T extends ArgsDef = ArgsDef> = RawArgs & {
|
|
143
|
+
[K in keyof T]: ParsedArg<T[K]>;
|
|
144
|
+
} & {
|
|
145
|
+
[K in keyof T as T[K] extends {
|
|
146
|
+
alias: string;
|
|
147
|
+
} ? T[K]["alias"] : never]: ParsedArg<T[K]>;
|
|
148
|
+
} & {
|
|
149
|
+
[K in keyof T as T[K] extends {
|
|
150
|
+
alias: string[];
|
|
151
|
+
} ? T[K]["alias"][number] : never]: ParsedArg<T[K]>;
|
|
152
|
+
} & Record<string, string | number | boolean | string[]>;
|
|
153
|
+
export type RunCommandOptions = {
|
|
154
|
+
rawArgs: string[];
|
|
155
|
+
data?: any;
|
|
156
|
+
showUsage?: boolean;
|
|
157
|
+
};
|
|
158
|
+
export type CommandMeta = {
|
|
159
|
+
name?: string;
|
|
160
|
+
version?: string;
|
|
161
|
+
description?: string;
|
|
162
|
+
hidden?: boolean;
|
|
163
|
+
};
|
|
164
|
+
export type SubCommandsDef = Record<string, Resolvable<CommandDef<any>>>;
|
|
165
|
+
export type CommandDef<T extends ArgsDef = ArgsDef> = {
|
|
166
|
+
meta?: Resolvable<CommandMeta>;
|
|
167
|
+
args?: Resolvable<T>;
|
|
168
|
+
subCommands?: Resolvable<SubCommandsDef>;
|
|
169
|
+
setup?: (context: CommandContext<T>) => any | Promise<any>;
|
|
170
|
+
cleanup?: (context: CommandContext<T>) => any | Promise<any>;
|
|
171
|
+
run?: (context: CommandContext<T>) => any | Promise<any>;
|
|
172
|
+
};
|
|
173
|
+
export type CommandContext<T extends ArgsDef = ArgsDef> = {
|
|
174
|
+
rawArgs: string[];
|
|
175
|
+
args: ParsedArgs<T>;
|
|
176
|
+
cmd: CommandDef<T>;
|
|
177
|
+
subCommand?: CommandDef<T>;
|
|
178
|
+
data?: any;
|
|
179
|
+
};
|
|
180
|
+
export type Awaitable<T> = () => T | Promise<T>;
|
|
181
|
+
export type Resolvable<T> = T | Promise<T> | (() => T) | (() => Promise<T>);
|
|
182
|
+
export type MessageKind = "log" | "info" | "warn" | "error" | "success";
|
|
183
|
+
export type VerboseKind = `${MessageKind}-verbose`;
|
|
184
|
+
export type AllKinds = MessageKind | VerboseKind;
|
|
185
|
+
export type MessageConfig = {
|
|
186
|
+
type: "M_INFO" | "M_ERROR";
|
|
187
|
+
titleColor?: "retroGradient" | "viceGradient" | "yellowBright";
|
|
188
|
+
titleTypography?: "bold";
|
|
189
|
+
contentColor?: "dim";
|
|
190
|
+
contentTypography?: "italic";
|
|
191
|
+
};
|
|
192
|
+
export type StreamOptions = {
|
|
193
|
+
delay?: number;
|
|
194
|
+
useSpinner?: boolean;
|
|
195
|
+
spinnerFrames?: string[];
|
|
196
|
+
spinnerDelay?: number;
|
|
197
|
+
};
|
|
198
|
+
export type ProgressBarOptions = {
|
|
199
|
+
total: number;
|
|
200
|
+
width?: number;
|
|
201
|
+
completeChar?: string;
|
|
202
|
+
incompleteChar?: string;
|
|
203
|
+
format?: string;
|
|
204
|
+
colorize?: boolean;
|
|
205
|
+
increment?: number;
|
|
206
|
+
desiredTotalTime?: number;
|
|
207
|
+
};
|
|
208
|
+
export type ProgressBar = {
|
|
209
|
+
update: (value: number) => Promise<void>;
|
|
210
|
+
increment: (amount?: number) => Promise<void>;
|
|
211
|
+
render: () => Promise<void>;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Union type for available prompt types.
|
|
215
|
+
*/
|
|
216
|
+
export type PromptType = "input" | "inputmasked" | "select" | "multiselect" | "nummultiselect" | "numselect" | "toggle" | "confirm" | "spinner" | "progressbar" | "results" | "nextsteps" | "animatedtext" | "date" | "end";
|
|
217
|
+
export type ConfirmPromptOptions = {
|
|
218
|
+
title: string;
|
|
219
|
+
defaultValue?: boolean;
|
|
220
|
+
content?: string;
|
|
221
|
+
titleColor?: ColorName;
|
|
222
|
+
titleTypography?: TypographyName;
|
|
223
|
+
titleVariant?: VariantName;
|
|
224
|
+
contentColor?: ColorName;
|
|
225
|
+
contentTypography?: TypographyName;
|
|
226
|
+
contentVariant?: VariantName;
|
|
227
|
+
borderColor?: BorderColorName;
|
|
228
|
+
hintPlaceholderColor?: ColorName;
|
|
229
|
+
variantOptions?: any;
|
|
230
|
+
action?: () => Promise<void>;
|
|
231
|
+
displayInstructions?: boolean;
|
|
232
|
+
debug?: boolean;
|
|
233
|
+
endTitle?: string;
|
|
234
|
+
endTitleColor?: ColorName;
|
|
235
|
+
border?: boolean;
|
|
236
|
+
terminalWidth?: number;
|
|
237
|
+
};
|
|
238
|
+
export type StreamTextOptions = {
|
|
239
|
+
/**
|
|
240
|
+
* Text to stream
|
|
241
|
+
*/
|
|
242
|
+
text: string;
|
|
243
|
+
/**
|
|
244
|
+
* Delay between each character in milliseconds
|
|
245
|
+
* @default 50
|
|
246
|
+
*/
|
|
247
|
+
delay?: number;
|
|
248
|
+
/**
|
|
249
|
+
* Whether to show cursor while streaming
|
|
250
|
+
* @default false
|
|
251
|
+
*/
|
|
252
|
+
showCursor?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Color to use for the text
|
|
255
|
+
* @default undefined (no color)
|
|
256
|
+
*/
|
|
257
|
+
color?: ColorName;
|
|
258
|
+
/**
|
|
259
|
+
* Whether to add a newline at the end
|
|
260
|
+
* @default true
|
|
261
|
+
*/
|
|
262
|
+
newline?: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Whether to clear the line before streaming
|
|
265
|
+
* @default false
|
|
266
|
+
*/
|
|
267
|
+
clearLine?: boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Callback function to update the spinner text
|
|
270
|
+
*/
|
|
271
|
+
onProgress?: (currentText: string) => void;
|
|
272
|
+
};
|
|
273
|
+
export type PreventWrongTerminalSizeOptions = {
|
|
274
|
+
isDev?: boolean;
|
|
275
|
+
shouldExit?: boolean;
|
|
276
|
+
minWidth?: number;
|
|
277
|
+
minHeight?: number;
|
|
278
|
+
sizeErrorDescription?: string;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* InputPromptOptions
|
|
282
|
+
*
|
|
283
|
+
* Extended options for handling user input prompts, including validation
|
|
284
|
+
* and UI styling. Inherits from PromptOptions.
|
|
285
|
+
*/
|
|
286
|
+
export type InputPromptOptions = {
|
|
287
|
+
border?: boolean;
|
|
288
|
+
borderColor?: BorderColorName;
|
|
289
|
+
content?: string;
|
|
290
|
+
contentColor?: ColorName;
|
|
291
|
+
contentTypography?: TypographyName;
|
|
292
|
+
contentVariant?: VariantName;
|
|
293
|
+
customSymbol?: string;
|
|
294
|
+
defaultValue?: string;
|
|
295
|
+
endTitle?: string;
|
|
296
|
+
endTitleColor?: ColorName;
|
|
297
|
+
hardcoded?: {
|
|
298
|
+
userInput?: string;
|
|
299
|
+
errorMessage?: string;
|
|
300
|
+
showPlaceholder?: boolean;
|
|
301
|
+
};
|
|
302
|
+
hint?: string;
|
|
303
|
+
hintPlaceholderColor?: ColorName;
|
|
304
|
+
mode?: "plain" | "password";
|
|
305
|
+
mask?: string;
|
|
306
|
+
placeholder?: string;
|
|
307
|
+
schema?: any;
|
|
308
|
+
shouldStream?: boolean;
|
|
309
|
+
streamDelay?: number;
|
|
310
|
+
symbol?: SymbolName;
|
|
311
|
+
symbolColor?: ColorName;
|
|
312
|
+
title: string;
|
|
313
|
+
titleColor?: ColorName;
|
|
314
|
+
titleTypography?: TypographyName;
|
|
315
|
+
titleVariant?: VariantName;
|
|
316
|
+
validate?: (value: string) => string | boolean | undefined | Promise<string | boolean | undefined>;
|
|
317
|
+
variantOptions?: unknown;
|
|
318
|
+
} & PromptOptions;
|
|
319
|
+
export type RenderParams = {
|
|
320
|
+
border: boolean;
|
|
321
|
+
borderColor?: BorderColorName;
|
|
322
|
+
content?: string;
|
|
323
|
+
contentColor?: ColorName;
|
|
324
|
+
contentTypography?: TypographyName;
|
|
325
|
+
contentVariant?: VariantName;
|
|
326
|
+
customSymbol?: string;
|
|
327
|
+
errorMessage: string;
|
|
328
|
+
hint?: string;
|
|
329
|
+
hintPlaceholderColor?: ColorName;
|
|
330
|
+
mask?: string;
|
|
331
|
+
placeholder?: string;
|
|
332
|
+
symbol?: SymbolName;
|
|
333
|
+
symbolColor?: ColorName;
|
|
334
|
+
title: string;
|
|
335
|
+
titleColor?: ColorName;
|
|
336
|
+
titleTypography?: TypographyName;
|
|
337
|
+
titleVariant?: VariantName;
|
|
338
|
+
userInput: string;
|
|
339
|
+
isRerender?: boolean;
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* Known symbol names that will have IntelliSense support
|
|
343
|
+
*/
|
|
344
|
+
export type SymbolName = "pointer" | "start" | "middle" | "end" | "line" | "corner_top_right" | "step_active" | "step_error" | "info" | "success";
|
|
345
|
+
export type Symbols = Record<SymbolName, string>;
|
|
346
|
+
export type FmtMsgOptions = {
|
|
347
|
+
type: MsgType;
|
|
348
|
+
title?: string;
|
|
349
|
+
titleAfterAnim?: string;
|
|
350
|
+
content?: string | undefined;
|
|
351
|
+
titleColor?: ColorName;
|
|
352
|
+
titleTypography?: TypographyName;
|
|
353
|
+
titleVariant?: VariantName;
|
|
354
|
+
contentColor?: ColorName;
|
|
355
|
+
contentTypography?: TypographyName;
|
|
356
|
+
contentVariant?: VariantName;
|
|
357
|
+
hint?: string;
|
|
358
|
+
hintPlaceholderColor?: ColorName;
|
|
359
|
+
hintTypography?: TypographyName;
|
|
360
|
+
border?: boolean;
|
|
361
|
+
borderColor?: ColorName;
|
|
362
|
+
dontRemoveBar?: boolean;
|
|
363
|
+
variantOptions?: {
|
|
364
|
+
box?: {
|
|
365
|
+
limit?: number;
|
|
366
|
+
};
|
|
367
|
+
};
|
|
368
|
+
errorMessage?: string;
|
|
369
|
+
addNewLineBefore?: boolean;
|
|
370
|
+
addNewLineAfter?: boolean;
|
|
371
|
+
placeholder?: string;
|
|
372
|
+
horizontalLine?: boolean;
|
|
373
|
+
horizontalLineLength?: number;
|
|
374
|
+
terminalWidth?: number;
|
|
375
|
+
instructions?: string;
|
|
376
|
+
wrapTitle?: boolean;
|
|
377
|
+
wrapContent?: boolean;
|
|
378
|
+
symbol?: SymbolName;
|
|
379
|
+
customSymbol?: string;
|
|
380
|
+
symbolColor?: ColorName;
|
|
381
|
+
noNewLine?: boolean;
|
|
382
|
+
};
|
|
383
|
+
export type TogglePromptParams<T extends string> = {
|
|
384
|
+
title: string;
|
|
385
|
+
content?: string;
|
|
386
|
+
options?: [T, T];
|
|
387
|
+
defaultValue?: T;
|
|
388
|
+
borderColor?: BorderColorName;
|
|
389
|
+
titleColor?: ColorName;
|
|
390
|
+
titleTypography?: TypographyName;
|
|
391
|
+
titleVariant?: VariantName;
|
|
392
|
+
contentColor?: ColorName;
|
|
393
|
+
contentTypography?: TypographyName;
|
|
394
|
+
border?: boolean;
|
|
395
|
+
endTitle?: string;
|
|
396
|
+
endTitleColor?: ColorName;
|
|
397
|
+
displayInstructions?: boolean;
|
|
398
|
+
debug?: boolean;
|
|
399
|
+
};
|
|
400
|
+
export type SeparatorOption = {
|
|
401
|
+
separator: true;
|
|
402
|
+
width?: number;
|
|
403
|
+
symbol?: SymbolName;
|
|
404
|
+
};
|
|
405
|
+
export type MultiselectPromptParams<T extends string> = {
|
|
406
|
+
title: string;
|
|
407
|
+
content?: string;
|
|
408
|
+
options: (SelectOption<T> | SeparatorOption)[];
|
|
409
|
+
defaultValue?: T[];
|
|
410
|
+
borderColor?: BorderColorName;
|
|
411
|
+
titleColor?: ColorName;
|
|
412
|
+
titleTypography?: TypographyName;
|
|
413
|
+
titleVariant?: VariantName;
|
|
414
|
+
contentColor?: ColorName;
|
|
415
|
+
contentTypography?: TypographyName;
|
|
416
|
+
border?: boolean;
|
|
417
|
+
endTitle?: string;
|
|
418
|
+
endTitleColor?: ColorName;
|
|
419
|
+
debug?: boolean;
|
|
420
|
+
terminalWidth?: number;
|
|
421
|
+
displayInstructions?: boolean;
|
|
422
|
+
minSelect?: number;
|
|
423
|
+
maxSelect?: number;
|
|
424
|
+
selectAll?: boolean;
|
|
425
|
+
};
|
|
426
|
+
export type DatePromptOptions = PromptOptions & {
|
|
427
|
+
dateFormat: string;
|
|
428
|
+
dateKind: "birthday" | "other";
|
|
429
|
+
defaultValue?: string;
|
|
430
|
+
endTitle?: string;
|
|
431
|
+
endTitleColor?: ColorName;
|
|
432
|
+
border?: boolean;
|
|
433
|
+
};
|
|
434
|
+
export {};
|
|
File without changes
|
package/bin/main.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export { anykeyPrompt } from "./core-impl/anykey/anykey-mod.js";
|
|
2
|
+
export { datePrompt } from "./core-impl/date/date.js";
|
|
3
|
+
export { startEditor } from "./core-impl/editor/editor-mod.js";
|
|
4
|
+
export { mainSymbols, fallbackSymbols, } from "./core-impl/figures/figures-mod.js";
|
|
5
|
+
export { confirmPrompt } from "./core-impl/input/confirm-prompt.js";
|
|
6
|
+
export { inputPrompt } from "./core-impl/input/input-prompt.js";
|
|
7
|
+
export { parseArgs, resolveArgs } from "./core-impl/launcher/args.js";
|
|
8
|
+
export { defineCommand, runCommand, resolveSubCommand, } from "./core-impl/launcher/command.js";
|
|
9
|
+
export type { RunMainOptions } from "./core-impl/launcher/launcher-mod.js";
|
|
10
|
+
export { runMain, createMain } from "./core-impl/launcher/launcher-mod.js";
|
|
11
|
+
export { showUsage, renderUsage } from "./core-impl/launcher/usage.js";
|
|
12
|
+
export { parseRawArgs } from "./core-impl/launcher/_parser.js";
|
|
13
|
+
export { toArray, formatLineColumns, resolveValue, CLIError, } from "./core-impl/launcher/_utils.js";
|
|
14
|
+
export { toBaseColor, toSolidColor } from "./core-impl/msg-fmt/colors.js";
|
|
15
|
+
export { relinkaByRemptsDeprecated, relinkaAsyncByRemptsDeprecated, throwError, } from "./core-impl/msg-fmt/logger.js";
|
|
16
|
+
export { colorMap, typographyMap } from "./core-impl/msg-fmt/mapping.js";
|
|
17
|
+
export { symbols, bar, fmt, msg, msgUndo, msgUndoAll, printLineBar, } from "./core-impl/msg-fmt/messages.js";
|
|
18
|
+
export { getTerminalHeight, getExactTerminalWidth, getTerminalWidth, breakLines, removeCursor, restoreCursor, deleteLastLine, deleteLastLines, countLines, } from "./core-impl/msg-fmt/terminal.js";
|
|
19
|
+
export { variantMap, isValidVariant, applyVariant, } from "./core-impl/msg-fmt/variants.js";
|
|
20
|
+
export { nextStepsPrompt } from "./core-impl/next-steps/next-steps.js";
|
|
21
|
+
export { numberPrompt } from "./core-impl/number/number-mod.js";
|
|
22
|
+
export type { ResultsType } from "./core-impl/results/results.js";
|
|
23
|
+
export { resultPrompt } from "./core-impl/results/results.js";
|
|
24
|
+
export { multiselectPrompt } from "./core-impl/select/multiselect-prompt.js";
|
|
25
|
+
export { numMultiSelectPrompt } from "./core-impl/select/nummultiselect-prompt.js";
|
|
26
|
+
export { numSelectPrompt } from "./core-impl/select/numselect-prompt.js";
|
|
27
|
+
export { selectPrompt } from "./core-impl/select/select-prompt.js";
|
|
28
|
+
export { togglePrompt } from "./core-impl/select/toggle-prompt.js";
|
|
29
|
+
export { endPrompt } from "./core-impl/st-end/end.js";
|
|
30
|
+
export { startPrompt } from "./core-impl/st-end/start.js";
|
|
31
|
+
export { progressTaskPrompt } from "./core-impl/task/progress.js";
|
|
32
|
+
export { spinnerTaskPrompt } from "./core-impl/task/spinner.js";
|
|
33
|
+
export { colorize } from "./core-impl/utils/colorize.js";
|
|
34
|
+
export { errorHandler } from "./core-impl/utils/errors.js";
|
|
35
|
+
export { preventUnsupportedTTY, preventWindowsHomeDirRoot, preventWrongTerminalSize, } from "./core-impl/utils/prevent.js";
|
|
36
|
+
export { completePrompt, renderEndLine, renderEndLineInput, } from "./core-impl/utils/prompt-end.js";
|
|
37
|
+
export { streamText, streamTextBox, streamTextWithSpinner, } from "./core-impl/utils/stream-text.js";
|
|
38
|
+
export { pm, reliversePrompts } from "./core-impl/utils/system.js";
|
|
39
|
+
export { isTerminalInteractive, isValidName, normalizeName, } from "./core-impl/utils/validate.js";
|
|
40
|
+
export { animationMap, animateText, } from "./core-impl/visual/animate/animate.js";
|
|
41
|
+
export { createAsciiArt } from "./core-impl/visual/ascii-art/ascii-art.js";
|
package/bin/main.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export { anykeyPrompt } from "./core-impl/anykey/anykey-mod.js";
|
|
2
|
+
export { datePrompt } from "./core-impl/date/date.js";
|
|
3
|
+
export { startEditor } from "./core-impl/editor/editor-mod.js";
|
|
4
|
+
export {
|
|
5
|
+
mainSymbols,
|
|
6
|
+
fallbackSymbols
|
|
7
|
+
} from "./core-impl/figures/figures-mod.js";
|
|
8
|
+
export { confirmPrompt } from "./core-impl/input/confirm-prompt.js";
|
|
9
|
+
export { inputPrompt } from "./core-impl/input/input-prompt.js";
|
|
10
|
+
export { parseArgs, resolveArgs } from "./core-impl/launcher/args.js";
|
|
11
|
+
export {
|
|
12
|
+
defineCommand,
|
|
13
|
+
runCommand,
|
|
14
|
+
resolveSubCommand
|
|
15
|
+
} from "./core-impl/launcher/command.js";
|
|
16
|
+
export { runMain, createMain } from "./core-impl/launcher/launcher-mod.js";
|
|
17
|
+
export { showUsage, renderUsage } from "./core-impl/launcher/usage.js";
|
|
18
|
+
export { parseRawArgs } from "./core-impl/launcher/_parser.js";
|
|
19
|
+
export {
|
|
20
|
+
toArray,
|
|
21
|
+
formatLineColumns,
|
|
22
|
+
resolveValue,
|
|
23
|
+
CLIError
|
|
24
|
+
} from "./core-impl/launcher/_utils.js";
|
|
25
|
+
export { toBaseColor, toSolidColor } from "./core-impl/msg-fmt/colors.js";
|
|
26
|
+
export {
|
|
27
|
+
relinkaByRemptsDeprecated,
|
|
28
|
+
relinkaAsyncByRemptsDeprecated,
|
|
29
|
+
throwError
|
|
30
|
+
} from "./core-impl/msg-fmt/logger.js";
|
|
31
|
+
export { colorMap, typographyMap } from "./core-impl/msg-fmt/mapping.js";
|
|
32
|
+
export {
|
|
33
|
+
symbols,
|
|
34
|
+
bar,
|
|
35
|
+
fmt,
|
|
36
|
+
msg,
|
|
37
|
+
msgUndo,
|
|
38
|
+
msgUndoAll,
|
|
39
|
+
printLineBar
|
|
40
|
+
} from "./core-impl/msg-fmt/messages.js";
|
|
41
|
+
export {
|
|
42
|
+
getTerminalHeight,
|
|
43
|
+
getExactTerminalWidth,
|
|
44
|
+
getTerminalWidth,
|
|
45
|
+
breakLines,
|
|
46
|
+
removeCursor,
|
|
47
|
+
restoreCursor,
|
|
48
|
+
deleteLastLine,
|
|
49
|
+
deleteLastLines,
|
|
50
|
+
countLines
|
|
51
|
+
} from "./core-impl/msg-fmt/terminal.js";
|
|
52
|
+
export {
|
|
53
|
+
variantMap,
|
|
54
|
+
isValidVariant,
|
|
55
|
+
applyVariant
|
|
56
|
+
} from "./core-impl/msg-fmt/variants.js";
|
|
57
|
+
export { nextStepsPrompt } from "./core-impl/next-steps/next-steps.js";
|
|
58
|
+
export { numberPrompt } from "./core-impl/number/number-mod.js";
|
|
59
|
+
export { resultPrompt } from "./core-impl/results/results.js";
|
|
60
|
+
export { multiselectPrompt } from "./core-impl/select/multiselect-prompt.js";
|
|
61
|
+
export { numMultiSelectPrompt } from "./core-impl/select/nummultiselect-prompt.js";
|
|
62
|
+
export { numSelectPrompt } from "./core-impl/select/numselect-prompt.js";
|
|
63
|
+
export { selectPrompt } from "./core-impl/select/select-prompt.js";
|
|
64
|
+
export { togglePrompt } from "./core-impl/select/toggle-prompt.js";
|
|
65
|
+
export { endPrompt } from "./core-impl/st-end/end.js";
|
|
66
|
+
export { startPrompt } from "./core-impl/st-end/start.js";
|
|
67
|
+
export { progressTaskPrompt } from "./core-impl/task/progress.js";
|
|
68
|
+
export { spinnerTaskPrompt } from "./core-impl/task/spinner.js";
|
|
69
|
+
export { colorize } from "./core-impl/utils/colorize.js";
|
|
70
|
+
export { errorHandler } from "./core-impl/utils/errors.js";
|
|
71
|
+
export {
|
|
72
|
+
preventUnsupportedTTY,
|
|
73
|
+
preventWindowsHomeDirRoot,
|
|
74
|
+
preventWrongTerminalSize
|
|
75
|
+
} from "./core-impl/utils/prevent.js";
|
|
76
|
+
export {
|
|
77
|
+
completePrompt,
|
|
78
|
+
renderEndLine,
|
|
79
|
+
renderEndLineInput
|
|
80
|
+
} from "./core-impl/utils/prompt-end.js";
|
|
81
|
+
export {
|
|
82
|
+
streamText,
|
|
83
|
+
streamTextBox,
|
|
84
|
+
streamTextWithSpinner
|
|
85
|
+
} from "./core-impl/utils/stream-text.js";
|
|
86
|
+
export { pm, reliversePrompts } from "./core-impl/utils/system.js";
|
|
87
|
+
export {
|
|
88
|
+
isTerminalInteractive,
|
|
89
|
+
isValidName,
|
|
90
|
+
normalizeName
|
|
91
|
+
} from "./core-impl/utils/validate.js";
|
|
92
|
+
export {
|
|
93
|
+
animationMap,
|
|
94
|
+
animateText
|
|
95
|
+
} from "./core-impl/visual/animate/animate.js";
|
|
96
|
+
export { createAsciiArt } from "./core-impl/visual/ascii-art/ascii-art.js";
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "@reliverse/prompts is your modern, type-safe toolkit for building delightful CLI experiences. It's fast, flexible, and built with developer joy in mind. Forget the clutter — this is how CLI should feel.",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"name": "@reliverse/rempts-core",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"version": "1.6.1",
|
|
7
|
+
"author": "reliverse",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"email": "blefnk@gmail.com",
|
|
10
|
+
"url": "https://github.com/reliverse/prompts/issues"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"reliverse",
|
|
14
|
+
"prompts"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/reliverse/prompts.git"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@figliolia/chalk-animation": "^1.0.4",
|
|
22
|
+
"@reliverse/relico": "^1.1.0",
|
|
23
|
+
"@reliverse/relinka": "^1.3.7",
|
|
24
|
+
"@reliverse/runtime": "^1.0.3",
|
|
25
|
+
"ansi-escapes": "^7.0.0",
|
|
26
|
+
"c12": "^3.0.2",
|
|
27
|
+
"cli-spinners": "^3.2.0",
|
|
28
|
+
"detect-package-manager": "^3.0.2",
|
|
29
|
+
"figlet": "^1.8.0",
|
|
30
|
+
"fs-extra": "^11.3.0",
|
|
31
|
+
"gradient-string": "^3.0.0",
|
|
32
|
+
"log-update": "^6.1.0",
|
|
33
|
+
"node-emoji": "^2.2.0",
|
|
34
|
+
"ora": "^8.2.0",
|
|
35
|
+
"pathe": "^2.0.3",
|
|
36
|
+
"scule": "^1.3.0",
|
|
37
|
+
"sisteransi": "^1.0.5",
|
|
38
|
+
"terminal-kit": "^3.1.2",
|
|
39
|
+
"terminal-size": "^4.0.0",
|
|
40
|
+
"ts-regex-builder": "^1.8.2",
|
|
41
|
+
"wrap-ansi": "^9.0.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {},
|
|
44
|
+
"exports": {
|
|
45
|
+
".": "./bin/main.js"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"bin",
|
|
49
|
+
"package.json",
|
|
50
|
+
"README.md",
|
|
51
|
+
"LICENSE"
|
|
52
|
+
],
|
|
53
|
+
"main": "./bin/main.js",
|
|
54
|
+
"module": "./bin/main.js",
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
}
|
|
58
|
+
}
|