@topcli/prompts 2.4.1 → 3.1.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/LICENSE +13 -13
- package/README.md +387 -275
- package/dist/index.cjs +1166 -1042
- package/dist/index.d.cts +105 -68
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +139 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1175 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +68 -55
- package/dist/index.d.ts +0 -99
- package/dist/index.js +0 -1039
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["#this","#signalHandler","process","#validators","#transformer","#secure","#securePlaceholder","#getQuestionQuery","#runTransformer","#getValidatingQuery","#onQuestionAnswer","#setQuestionSuffixError","#question","#transformedAnswer","#writeAnswer","#getQuestionQuery","#render","#boundKeyPressEvent","#getHint","#onQuestionAnswer","#onKeypress","#boundExitEvent","#onProcessExit","kRequiredChoiceProperties","#filterChoice","#filterMultipleWords","#isChoiceDisabled","#validators","#findFirstEnabledIndex","#getVisibleChoices","#getFormattedChoice","#handleReturn","#isValidating","#showAnsweredQuestion","#onProcessExit","#boundExitEvent","#boundKeyPressEvent","#findNextEnabledIndex","#showQuestion","#showChoices","#onKeypress","#filterChoice","#filterMultipleWords","#isChoiceDisabled","#validators","#showHint","#findFirstEnabledIndex","#getVisibleChoices","#getFormattedChoice","#handleReturn","#isValidating","#selectedChoices","#showAnsweredQuestion","#onProcessExit","#boundExitEvent","#boundKeyPressEvent","#findNextEnabledIndex","#showQuestion","#showChoices","#onKeypress"],"sources":["../src/validators.ts","../src/prompt-agent.ts","../src/transformers.ts","../src/errors/abort.ts","../src/prompts/abstract.ts","../src/utils.ts","../src/constants.ts","../src/prompts/question.ts","../src/prompts/confirm.ts","../src/prompts/select.ts","../src/prompts/multiselect.ts","../src/index.ts"],"sourcesContent":["export type ValidResponseObject = {\n isValid?: true;\n};\nexport type InvalidResponseObject = {\n isValid: false;\n error: string;\n};\nexport type ValidationResponseObject = ValidResponseObject | InvalidResponseObject;\nexport type ValidationResponse = InvalidResponse | ValidResponse;\nexport type InvalidResponse = string | InvalidResponseObject;\nexport type ValidResponse = null | undefined | true | ValidResponseObject;\n\nexport type ValidTransformationResponse<T> = {\n isValid: true;\n transformed: T;\n};\nexport type TransformationResponse<T> = InvalidResponse | ValidTransformationResponse<T>;\n\nexport interface PromptValidator<T extends string | string[]> {\n validate: (input: T) => ValidationResponse | Promise<ValidationResponse>;\n}\n\nexport interface PromptTransformer<T> {\n transform: (input: string) => TransformationResponse<T> | Promise<TransformationResponse<T>>;\n}\n\nexport function required(): PromptValidator<any> {\n return {\n validate: (input) => {\n const isValid = (Array.isArray(input) ? input.length > 0 : Boolean(input));\n\n return isValid ? null : { isValid, error: \"required\" };\n }\n };\n}\n\nexport function isValid(result: ValidationResponse): result is ValidResponse {\n if (typeof result === \"object\") {\n return result?.isValid !== false;\n }\n\n if (typeof result === \"string\") {\n return result.length === 0;\n }\n\n return true;\n}\n\nexport function isValidTransformation<T>(result: TransformationResponse<T>): result is ValidTransformationResponse<T> {\n return typeof result === \"object\" && result.isValid === true;\n}\n\nexport function resultError(result: InvalidResponse) {\n if (typeof result === \"object\") {\n return result.error;\n }\n\n return result;\n}\n","// CONSTANTS\nconst kPrivateInstancier = Symbol(\"instancier\");\n\nexport class PromptAgent<T = string> {\n /**\n * The prompts answers queue.\n * When not empty, any prompt will be answered by the first answer in this list.\n */\n nextAnswers: T[] = [];\n\n /**\n * The shared PromptAgent.\n */\n static #this: PromptAgent;\n\n static agent<T>() {\n // eslint-disable-next-line no-return-assign\n return (this.#this as PromptAgent<T>) ??= new PromptAgent<T>(kPrivateInstancier);\n }\n\n constructor(instancier: symbol) {\n if (instancier !== kPrivateInstancier) {\n throw new Error(\"Cannot instanciate PromptAgent, use PromptAgent.agent() instead\");\n }\n }\n\n /**\n * Programmatically set the next answer for any prompt (`question()`, `confirm()`, `select()`)\n *\n * This is useful for testing.\n *\n * @example\n * ```js\n * const promptAgent = PromptAgent.agent();\n * promptAgent.nextAnswer(\"toto\");\n *\n * const input = await question(\"what is your name?\");\n * assert.equal(input, \"toto\");\n * ```\n */\n nextAnswer(value: T) {\n if (Array.isArray(value)) {\n this.nextAnswers.push(...value);\n\n return;\n }\n\n this.nextAnswers.push(value);\n }\n}\n","// Import Internal Dependencies\nimport type { PromptTransformer } from \"./validators.ts\";\n\nexport function number(): PromptTransformer<number> {\n return {\n transform(input) {\n if (input.trim() === \"\") {\n return { isValid: false, error: \"not a number\" };\n }\n\n const parsed = Number(input.replace(\",\", \".\"));\n if (Number.isNaN(parsed)) {\n return { isValid: false, error: \"not a number\" };\n }\n\n return { isValid: true, transformed: parsed };\n }\n };\n}\n\nexport function integer(): PromptTransformer<number> {\n return {\n transform(input) {\n if (input.trim() === \"\") {\n return { isValid: false, error: \"not an integer\" };\n }\n\n const parsed = Number(input);\n if (Number.isNaN(parsed) || !Number.isInteger(parsed)) {\n return { isValid: false, error: \"not an integer\" };\n }\n\n return { isValid: true, transformed: parsed };\n }\n };\n}\n\nexport function url(): PromptTransformer<URL> {\n return {\n transform(input) {\n try {\n return { isValid: true, transformed: new URL(input) };\n }\n catch {\n try {\n const parsed = new URL(`https://${input}`);\n // new URL() accepts any string as hostname (e.g. \"https://foo\" is valid).\n // For this use case, the user must explicitly type the protocol.\n if (!parsed.hostname.includes(\".\") && parsed.hostname !== \"localhost\") {\n return { isValid: false, error: \"invalid URL\" };\n }\n\n return { isValid: true, transformed: parsed };\n }\n catch {\n return { isValid: false, error: \"invalid URL\" };\n }\n }\n }\n };\n}\n","export class AbortError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"AbortError\";\n }\n}\n","// Import Node.js Dependencies\nimport { EOL } from \"node:os\";\nimport readline from \"node:readline\";\nimport { Writable } from \"node:stream\";\nimport EventEmitter from \"node:events\";\nimport { stripVTControlCharacters } from \"node:util\";\n\n// Import Internal Dependencies\nimport { PromptAgent } from \"../prompt-agent.ts\";\nimport { AbortError } from \"../errors/abort.ts\";\n\n// CONSTANTS\nfunction kNoopTransformer(input: Buffer) {\n return input;\n}\n\ntype Stdin = NodeJS.ReadStream & {\n fd: 0;\n};\n\ntype Stdout = NodeJS.WriteStream & {\n fd: 1;\n};\n\nexport interface AbstractPromptOptions {\n stdin?: Stdin;\n stdout?: Stdout;\n message: string;\n skip?: boolean;\n signal?: AbortSignal;\n}\n\nexport class AbstractPrompt<T extends string | boolean> extends EventEmitter {\n stdin: Stdin;\n stdout: Stdout;\n message: string;\n signal?: AbortSignal;\n skip: boolean;\n history: string[];\n agent: PromptAgent<T>;\n transformer: (input: Buffer) => Buffer | null = kNoopTransformer;\n rl: readline.Interface;\n #signalHandler: () => void;\n\n constructor(options: AbstractPromptOptions) {\n super();\n\n if (this.constructor === AbstractPrompt) {\n throw new Error(\"AbstractPrompt can't be instantiated.\");\n }\n\n const {\n stdin: input = process.stdin,\n stdout: output = process.stdout,\n message,\n signal,\n skip = false\n } = options;\n\n if (typeof message !== \"string\") {\n throw new TypeError(`message must be string, ${typeof message} given.`);\n }\n\n if (!output.isTTY) {\n // when process.stdout is not TTY (i.e within IDEs) theses methods does not exists and make the lib crashing\n Object.assign(output, {\n moveCursor: () => void 0,\n clearScreenDown: () => void 0\n });\n }\n\n this.stdin = input;\n this.stdout = output;\n this.message = message;\n this.signal = signal;\n this.skip = skip;\n this.history = [];\n this.agent = PromptAgent.agent<T>();\n\n if (this.stdout.isTTY) {\n this.stdin.setRawMode(true);\n }\n\n this.rl = readline.createInterface({\n input,\n output: new Writable({\n write: (chunk: Buffer | string, encoding: BufferEncoding, callback) => {\n if (chunk) {\n const transformed = this.transformer(\n Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)\n );\n if (transformed !== null) {\n this.stdout.write(transformed, encoding);\n }\n }\n callback();\n }\n }),\n terminal: true\n });\n\n if (this.signal) {\n this.#signalHandler = () => {\n this.rl.close();\n for (let i = 0; i < this.history.length; i++) {\n this.clearLastLine();\n }\n this.emit(\"error\", new AbortError(\"Prompt aborted\"));\n };\n\n if (this.signal.aborted) {\n this.#signalHandler();\n }\n this.signal.addEventListener(\"abort\", this.#signalHandler, { once: true });\n }\n }\n\n reset() {\n this.transformer = kNoopTransformer;\n }\n\n write(data: string) {\n const formattedData = stripVTControlCharacters(data).replace(EOL, \"\");\n if (formattedData) {\n this.history.push(formattedData);\n }\n\n return this.stdout.write(data);\n }\n\n clearLastLine() {\n const lastLine = this.history.pop();\n if (!lastLine) {\n return;\n }\n\n const lastLineRows = Math.ceil(stripVTControlCharacters(lastLine).length / this.stdout.columns);\n\n this.stdout.moveCursor(-this.stdout.columns, -lastLineRows);\n this.stdout.clearScreenDown();\n }\n\n destroy() {\n this.rl.close();\n\n if (this.signal) {\n this.signal.removeEventListener(\"abort\", this.#signalHandler);\n }\n }\n}\n","// Import Node.js Dependencies\nimport process from \"node:process\";\nimport { stripVTControlCharacters } from \"node:util\";\n\n// Import Internal Dependencies\nimport type { Separator } from \"./types.ts\";\n\nexport function isSeparator(choice: unknown): choice is Separator {\n return typeof choice === \"object\" && choice !== null && (choice as Separator).type === \"separator\";\n}\n\n// CONSTANTS\nconst kLenSegmenter = new Intl.Segmenter();\n\n/**\n * @see https://github.com/sindresorhus/is-unicode-supported\n */\nexport function isUnicodeSupported() {\n if (process.platform !== \"win32\") {\n // Linux console (kernel)\n return process.env.TERM !== \"linux\";\n }\n\n // Windows Terminal\n return Boolean(process.env.WT_SESSION)\n // Terminus (<0.2.27)\n || Boolean(process.env.TERMINUS_SUBLIME)\n // ConEmu and cmder\n || process.env.ConEmuTask === \"{cmd::Cmder}\"\n || process.env.TERM_PROGRAM === \"Terminus-Sublime\"\n || process.env.TERM_PROGRAM === \"vscode\"\n || process.env.TERM === \"xterm-256color\"\n || process.env.TERM === \"alacritty\"\n || process.env.TERMINAL_EMULATOR === \"JetBrains-JediTerm\";\n}\n\nexport function nextSelectableIndex(\n choices: unknown[],\n currentIndex: number,\n direction: \"up\" | \"down\"\n): number {\n const length = choices.length;\n let index = currentIndex;\n for (let step = 0; step < length; step++) {\n if (direction === \"up\") {\n index = index === 0 ? length - 1 : index - 1;\n }\n else {\n index = index === length - 1 ? 0 : index + 1;\n }\n\n if (isSeparator(choices[index])) {\n continue;\n }\n\n return index;\n }\n\n return currentIndex;\n}\n\nexport function stringLength(\n string: string\n): number {\n if (string === \"\") {\n return 0;\n }\n\n let length = 0;\n for (const _ of kLenSegmenter.segment(\n stripVTControlCharacters(string)\n )) {\n length++;\n }\n\n return length;\n}\n\n","// Import Node.js Dependencies\nimport { styleText } from \"node:util\";\n\n// Import Internal Dependencies\nimport { isUnicodeSupported } from \"./utils.ts\";\n\nconst kMainSymbols = {\n tick: \"✔\",\n cross: \"✖\",\n pointer: \"›\",\n previous: \"⭡\",\n next: \"⭣\",\n active: \"●\",\n inactive: \"○\",\n separator: \"─\"\n};\nconst kFallbackSymbols = {\n tick: \"√\",\n cross: \"×\",\n pointer: \">\",\n previous: \"↑\",\n next: \"↓\",\n active: \"(+)\",\n inactive: \"(-)\",\n separator: \"-\"\n};\nconst kSymbols = isUnicodeSupported() || process.env.CI ? kMainSymbols : kFallbackSymbols;\nconst kPointer = styleText(\"gray\", kSymbols.pointer);\n\nexport const SYMBOLS = {\n QuestionMark: styleText([\"blue\", \"bold\"], \"?\"),\n Tick: styleText([\"green\", \"bold\"], kSymbols.tick),\n Cross: styleText([\"red\", \"bold\"], kSymbols.cross),\n Pointer: kPointer,\n Previous: kSymbols.previous,\n Next: kSymbols.next,\n ShowCursor: \"\\x1B[?25h\",\n HideCursor: \"\\x1B[?25l\",\n Active: styleText(\"cyan\", kSymbols.active),\n Inactive: styleText(\"gray\", kSymbols.inactive),\n SeparatorLine: kSymbols.separator\n};\n\nexport const VALIDATION_SPINNER_INTERVAL = 300;\n","// Import Node.js Dependencies\nimport { EOL } from \"node:os\";\nimport { styleText } from \"node:util\";\n\n// Import Internal Dependencies\nimport { AbstractPrompt, type AbstractPromptOptions } from \"./abstract.ts\";\nimport { stringLength } from \"../utils.ts\";\nimport { SYMBOLS, VALIDATION_SPINNER_INTERVAL } from \"../constants.ts\";\nimport {\n isValid,\n isValidTransformation,\n resultError,\n type PromptValidator,\n type PromptTransformer,\n type TransformationResponse,\n type ValidationResponse\n} from \"../validators.ts\";\n\nexport interface QuestionOptions<T = string> extends AbstractPromptOptions {\n defaultValue?: string;\n validators?: PromptValidator<string>[];\n transformer?: PromptTransformer<T>;\n secure?: boolean | {\n placeholder: string;\n };\n}\n\nexport class QuestionPrompt<T = string> extends AbstractPrompt<string> {\n defaultValue?: string;\n tip: string;\n questionSuffixError: string;\n answer?: string;\n answerBuffer?: Promise<string>;\n #validators: PromptValidator<string>[];\n #transformer?: PromptTransformer<T>;\n #transformedAnswer?: T;\n #secure: boolean;\n #securePlaceholder: string | null = null;\n\n constructor(options: QuestionOptions<T>) {\n const {\n defaultValue,\n validators = [],\n transformer,\n secure = false,\n ...baseOptions\n } = options;\n\n super({ ...baseOptions });\n\n if (validators.length > 0 && transformer !== void 0) {\n throw new Error(\"validators and transformer are mutually exclusive\");\n }\n\n if (defaultValue && typeof defaultValue !== \"string\") {\n throw new TypeError(\"defaultValue must be a string\");\n }\n\n this.defaultValue = defaultValue;\n this.tip = this.defaultValue ? ` (${this.defaultValue})` : \"\";\n this.#validators = validators;\n this.#transformer = transformer;\n\n if (typeof secure === \"object\") {\n this.#secure = true;\n this.#securePlaceholder = secure.placeholder;\n }\n else {\n this.#secure = Boolean(secure);\n }\n this.questionSuffixError = \"\";\n }\n\n #question(): Promise<string> {\n const { resolve, promise } = Promise.withResolvers<string>();\n\n const questionQuery = this.#getQuestionQuery();\n\n this.history.push(questionQuery);\n this.rl.question(questionQuery, (answer) => {\n this.history.push(questionQuery + answer);\n this.reset();\n\n resolve(answer);\n });\n\n if (this.#securePlaceholder !== null) {\n this.transformer = (input) => Buffer.from(this.#securePlaceholder!.repeat(input.length), \"utf-8\");\n }\n\n return promise;\n }\n\n #getQuestionQuery() {\n return `${styleText(\"bold\", `${SYMBOLS.QuestionMark} ${this.message}${this.tip}`)} ${this.questionSuffixError}`;\n }\n\n #setQuestionSuffixError(error: string) {\n const suffix = styleText(\"red\", `[${error}] `);\n this.questionSuffixError = suffix;\n }\n\n #writeAnswer() {\n const prefix = this.answer ? SYMBOLS.Tick : SYMBOLS.Cross;\n const answer = this.answer ?? \"\";\n const maskedAnswer = this.#securePlaceholder ?\n this.#securePlaceholder.repeat(answer.length) :\n answer;\n\n const stylizedAnswer = styleText(\n \"yellow\",\n this.#secure && this.#securePlaceholder === null ?\n \"CONFIDENTIAL\" : maskedAnswer\n );\n this.write(`${prefix} ${styleText(\"bold\", this.message)} ${SYMBOLS.Pointer} ${stylizedAnswer}${EOL}`);\n }\n\n #getValidatingQuery(dotCount: number) {\n const question = styleText(\"bold\", `${SYMBOLS.QuestionMark} ${this.message}${this.tip}`);\n const hint = styleText(\"yellow\", `[validating${\".\".repeat(dotCount)}]`);\n\n return `${question} ${hint}${EOL}`;\n }\n\n async #runTransformer(): Promise<TransformationResponse<T>> {\n const result = this.#transformer!.transform(this.answer!);\n\n if (result instanceof Promise) {\n let dotCount = 1;\n this.write(this.#getValidatingQuery(dotCount));\n\n const spinnerInterval = setInterval(() => {\n dotCount = (dotCount % 3) + 1;\n this.clearLastLine();\n this.write(this.#getValidatingQuery(dotCount));\n }, VALIDATION_SPINNER_INTERVAL);\n\n try {\n return await result;\n }\n finally {\n clearInterval(spinnerInterval);\n this.clearLastLine();\n }\n }\n\n return result;\n }\n\n async #onQuestionAnswer() {\n const questionLineCount = Math.ceil(\n stringLength(this.#getQuestionQuery() + this.answer) / this.stdout.columns\n );\n\n this.stdout.moveCursor(-this.stdout.columns, -questionLineCount);\n this.stdout.clearScreenDown();\n\n if (this.#transformer) {\n const result = await this.#runTransformer();\n\n if (isValidTransformation(result) === false) {\n this.#setQuestionSuffixError(resultError(result));\n this.answerBuffer = this.#question();\n\n return;\n }\n\n this.#transformedAnswer = result.transformed;\n this.answerBuffer = void 0;\n this.#writeAnswer();\n\n return;\n }\n\n for (const validator of this.#validators) {\n let validationResult: ValidationResponse;\n const result = validator.validate(this.answer!);\n\n if (result instanceof Promise) {\n let dotCount = 1;\n\n this.write(this.#getValidatingQuery(dotCount));\n\n const spinnerInterval = setInterval(() => {\n dotCount = (dotCount % 3) + 1;\n this.clearLastLine();\n this.write(this.#getValidatingQuery(dotCount));\n }, VALIDATION_SPINNER_INTERVAL);\n\n try {\n validationResult = await result;\n }\n finally {\n clearInterval(spinnerInterval);\n this.clearLastLine();\n }\n }\n else {\n validationResult = result;\n }\n\n if (isValid(validationResult) === false) {\n this.#setQuestionSuffixError(resultError(validationResult));\n this.answerBuffer = this.#question();\n\n return;\n }\n }\n\n this.answerBuffer = void 0;\n this.#writeAnswer();\n }\n\n async listen(): Promise<T> {\n if (this.skip) {\n this.destroy();\n\n if (this.#transformer) {\n const rawValue = this.defaultValue ?? \"\";\n const result = await this.#transformer.transform(rawValue);\n if (isValidTransformation(result) === false) {\n throw new Error(`Transformer failed for default value \"${rawValue}\": ${resultError(result)}`);\n }\n\n return result.transformed;\n }\n\n return (this.defaultValue ?? \"\") as T;\n }\n\n const agentAnswer = this.agent.nextAnswers.shift();\n if (agentAnswer !== undefined) {\n this.answer = agentAnswer;\n this.#writeAnswer();\n this.destroy();\n\n if (this.#transformer) {\n const result = await this.#transformer.transform(agentAnswer);\n if (isValidTransformation(result) === false) {\n throw new Error(`(PromptAgent) transformer failed for answer \"${agentAnswer}\": ${resultError(result)}`);\n }\n\n return result.transformed;\n }\n\n return this.answer as T;\n }\n\n this.answer = await this.#question();\n\n if (this.answer === \"\" && this.defaultValue) {\n this.answer = this.defaultValue;\n }\n\n await this.#onQuestionAnswer();\n\n while (this.answerBuffer !== undefined) {\n this.answer = await this.answerBuffer;\n await this.#onQuestionAnswer();\n }\n\n this.destroy();\n\n return (this.#transformedAnswer ?? this.answer) as T;\n }\n}\n","// Import Node.js Dependencies\nimport { EOL } from \"node:os\";\nimport type { Key } from \"node:readline\";\nimport { styleText } from \"node:util\";\n\n// Import Internal Dependencies\nimport { AbstractPrompt, type AbstractPromptOptions } from \"./abstract.ts\";\nimport { stringLength } from \"../utils.ts\";\nimport { SYMBOLS } from \"../constants.ts\";\n\nexport interface ConfirmOptions extends AbstractPromptOptions {\n initial?: boolean;\n}\n\n// CONSTANTS\nconst kToggleKeys = new Set([\n \"left\",\n \"right\",\n \"tab\",\n \"q\",\n \"a\",\n \"d\",\n \"h\",\n \"j\",\n \"k\",\n \"l\",\n \"space\"\n]);\n\nexport class ConfirmPrompt extends AbstractPrompt<boolean> {\n initial: boolean;\n selectedValue: boolean;\n fastAnswer: boolean;\n #boundKeyPressEvent: (...args: any) => void;\n #boundExitEvent: (...args: any) => void;\n\n constructor(options: ConfirmOptions) {\n const {\n initial = false,\n ...baseOptions\n } = options;\n super({ ...baseOptions });\n\n this.initial = initial;\n this.selectedValue = initial;\n }\n\n #getHint() {\n const Yes = styleText([\"cyan\", \"bold\", \"underline\"], \"Yes\");\n const No = styleText([\"cyan\", \"bold\", \"underline\"], \"No\");\n\n return this.selectedValue ? `${Yes}/No` : `Yes/${No}`;\n }\n\n #render() {\n this.write(this.#getQuestionQuery());\n }\n\n #onKeypress(resolve: (value: boolean) => void, _value: any, key: Key) {\n this.stdout.moveCursor(\n -this.stdout.columns,\n -Math.floor(stringLength(this.#getQuestionQuery()) / this.stdout.columns)\n );\n this.stdout.clearScreenDown();\n\n if (key.name === \"return\") {\n resolve(this.selectedValue);\n\n return;\n }\n\n if (kToggleKeys.has(key.name ?? \"\")) {\n this.selectedValue = !this.selectedValue;\n }\n\n if (key.name === \"y\") {\n this.selectedValue = true;\n resolve(true);\n this.fastAnswer = true;\n }\n else if (key.name === \"n\") {\n this.selectedValue = false;\n resolve(false);\n this.fastAnswer = true;\n }\n\n if (!this.fastAnswer) {\n this.#render();\n }\n }\n\n #onProcessExit() {\n this.stdin.off(\"keypress\", this.#boundKeyPressEvent);\n }\n\n #getQuestionQuery() {\n const query = styleText(\"bold\", `${SYMBOLS.QuestionMark} ${this.message}`);\n\n return `${query} ${this.#getHint()}`;\n }\n\n #onQuestionAnswer() {\n this.clearLastLine();\n this.stdout.moveCursor(\n -this.stdout.columns,\n -Math.floor(stringLength(this.#getQuestionQuery()) / this.stdout.columns)\n );\n this.stdout.clearScreenDown();\n this.write(`${this.selectedValue ? SYMBOLS.Tick : SYMBOLS.Cross} ${styleText(\"bold\", this.message)}${EOL}`);\n }\n\n async listen(): Promise<boolean> {\n if (this.skip) {\n this.destroy();\n\n return this.initial;\n }\n\n const answer = this.agent.nextAnswers.shift();\n if (answer !== undefined) {\n this.selectedValue = answer;\n this.#onQuestionAnswer();\n this.destroy();\n\n return answer;\n }\n\n this.write(SYMBOLS.HideCursor);\n\n try {\n const { resolve, promise } = Promise.withResolvers<boolean>();\n const questionQuery = this.#getQuestionQuery();\n\n this.write(questionQuery);\n\n this.#boundKeyPressEvent = this.#onKeypress.bind(this, resolve);\n this.stdin.on(\"keypress\", this.#boundKeyPressEvent);\n\n this.#boundExitEvent = this.#onProcessExit.bind(this);\n process.once(\"exit\", this.#boundExitEvent);\n\n await promise;\n\n this.#onQuestionAnswer();\n }\n finally {\n this.write(SYMBOLS.ShowCursor);\n\n this.#onProcessExit();\n process.off(\"exit\", this.#boundExitEvent);\n\n this.destroy();\n }\n\n return this.selectedValue;\n }\n}\n","// Import Node.js Dependencies\nimport { EOL } from \"node:os\";\nimport { styleText, type InspectColor } from \"node:util\";\n\n// Import Internal Dependencies\nimport { AbstractPrompt, type AbstractPromptOptions } from \"./abstract.ts\";\nimport { stringLength, isSeparator } from \"../utils.ts\";\nimport { SYMBOLS, VALIDATION_SPINNER_INTERVAL } from \"../constants.ts\";\nimport { isValid, type PromptValidator, resultError } from \"../validators.ts\";\nimport { type ValidationResponse } from \"./../validators.ts\";\nimport { type Choice, type Separator } from \"../types.ts\";\n\n// CONSTANTS\nconst kRequiredChoiceProperties = [\"label\", \"value\"];\n\nexport interface SelectOptions<T extends string> extends AbstractPromptOptions {\n choices: (Choice<T> | T | Separator)[];\n maxVisible?: number;\n ignoreValues?: (T | number | boolean)[];\n validators?: PromptValidator<string>[];\n autocomplete?: boolean;\n caseSensitive?: boolean;\n}\n\ntype VoidFn = () => void;\ntype RenderOptions = {\n initialRender?: boolean;\n clearRender?: boolean;\n error?: string;\n validating?: string;\n};\n\nexport class SelectPrompt<T extends string> extends AbstractPrompt<T> {\n #boundExitEvent: VoidFn = () => void 0;\n #boundKeyPressEvent: VoidFn = () => void 0;\n #validators: PromptValidator<string>[];\n #isValidating = false;\n activeIndex = 0;\n questionMessage: string;\n autocompleteValue = \"\";\n options: SelectOptions<T>;\n lastRender: { startIndex: number; endIndex: number; };\n\n get choices() {\n return this.options.choices;\n }\n\n get filteredChoices() {\n if (!(this.options.autocomplete && this.autocompleteValue.length > 0)) {\n return this.choices;\n }\n\n const isCaseSensitive = this.options.caseSensitive;\n const autocompleteValue = isCaseSensitive ? this.autocompleteValue : this.autocompleteValue.toLowerCase();\n\n return this.choices.filter(\n (choice) => !isSeparator(choice) && this.#filterChoice(choice, autocompleteValue, isCaseSensitive)\n );\n }\n\n #filterChoice(\n choice: Choice<T> | string,\n autocompleteValue: string,\n isCaseSensitive = false\n ) {\n // eslint-disable-next-line no-nested-ternary\n const choiceValue = typeof choice === \"string\" ?\n (isCaseSensitive ? choice : choice.toLowerCase()) :\n (isCaseSensitive ? choice.label : choice.label.toLowerCase());\n\n if (autocompleteValue.includes(\" \")) {\n return this.#filterMultipleWords(choiceValue, autocompleteValue, isCaseSensitive);\n }\n\n return choiceValue.includes(autocompleteValue);\n }\n\n #filterMultipleWords(choiceValue: string, autocompleteValue: string, isCaseSensitive: boolean) {\n return autocompleteValue.split(\" \").every((word) => {\n const wordValue = isCaseSensitive ? word : word.toLowerCase();\n\n return choiceValue.includes(wordValue) || choiceValue.includes(autocompleteValue);\n });\n }\n\n #isChoiceDisabled(choice: Choice<T> | T): boolean {\n return typeof choice !== \"string\" && Boolean(choice.disabled);\n }\n\n #findNextEnabledIndex(from: number, direction: 1 | -1): number {\n const total = this.filteredChoices.length;\n if (total === 0) {\n return from;\n }\n\n let index = (from + direction + total) % total;\n\n while (index !== from) {\n const choice = this.filteredChoices[index];\n if (!isSeparator(choice) && !this.#isChoiceDisabled(choice)) {\n return index;\n }\n index = (index + direction + total) % total;\n }\n\n return from;\n }\n\n #findFirstEnabledIndex(): number {\n const index = this.filteredChoices.findIndex(\n (choice) => !isSeparator(choice) && !this.#isChoiceDisabled(choice as Choice<T> | T)\n );\n\n return index === -1 ? 0 : index;\n }\n\n get longestChoice() {\n const selectableChoices = this.filteredChoices.filter(\n (choice): choice is Choice<T> | T => !isSeparator(choice)\n );\n if (selectableChoices.length === 0) {\n return 0;\n }\n\n return Math.max(...selectableChoices.map((choice) => {\n if (typeof choice === \"string\") {\n return choice.length;\n }\n\n return choice.label.length;\n }));\n }\n\n constructor(options: SelectOptions<T>) {\n const {\n choices,\n validators = [],\n ...baseOptions\n } = options;\n\n super({ ...baseOptions });\n\n this.options = options;\n\n if (!choices?.length) {\n this.destroy();\n throw new TypeError(\"Missing required param: choices\");\n }\n\n this.#validators = validators;\n\n for (const choice of choices) {\n if (typeof choice === \"string\" || isSeparator(choice)) {\n continue;\n }\n\n for (const prop of kRequiredChoiceProperties) {\n if (!choice[prop]) {\n this.destroy();\n throw new TypeError(`Missing ${prop} for choice ${JSON.stringify(choice)}`);\n }\n }\n }\n\n const firstSelectableIndex = choices.findIndex((choice) => !isSeparator(choice));\n if (firstSelectableIndex === -1) {\n this.destroy();\n throw new TypeError(\"choices must contain at least one non-separator item\");\n }\n this.activeIndex = this.#findFirstEnabledIndex();\n }\n\n #getFormattedChoice(choiceIndex: number) {\n const choice = this.filteredChoices[choiceIndex] as Choice<T> | T;\n\n if (typeof choice === \"string\") {\n return { value: choice, label: choice };\n }\n\n return choice;\n }\n\n #getVisibleChoices() {\n const maxVisible = this.options.maxVisible || 8;\n let startIndex = Math.min(this.filteredChoices.length - maxVisible, this.activeIndex - Math.floor(maxVisible / 2));\n if (startIndex < 0) {\n startIndex = 0;\n }\n\n const endIndex = Math.min(startIndex + maxVisible, this.filteredChoices.length);\n\n return { startIndex, endIndex };\n }\n\n #showChoices() {\n const { startIndex, endIndex } = this.#getVisibleChoices();\n this.lastRender = { startIndex, endIndex };\n\n if (this.options.autocomplete) {\n this.write(`${SYMBOLS.Pointer} ${this.autocompleteValue}${EOL}`);\n }\n for (let choiceIndex = startIndex; choiceIndex < endIndex; choiceIndex++) {\n const rawChoice = this.filteredChoices[choiceIndex];\n\n if (isSeparator(rawChoice)) {\n const separatorLabel = rawChoice.label ? ` ${rawChoice.label} ` : \"\";\n // eslint-disable-next-line @stylistic/max-len\n this.write(` ${styleText(\"gray\", `${SYMBOLS.SeparatorLine}${SYMBOLS.SeparatorLine}${separatorLabel}${SYMBOLS.SeparatorLine}${SYMBOLS.SeparatorLine}`)}${EOL}`);\n continue;\n }\n\n const formattedChoice = this.#getFormattedChoice(choiceIndex);\n const isChoiceSelected = choiceIndex === this.activeIndex;\n const isChoiceDisabled = this.#isChoiceDisabled(rawChoice);\n const showPreviousChoicesArrow = startIndex > 0 && choiceIndex === startIndex;\n const showNextChoicesArrow = endIndex < this.filteredChoices.length && choiceIndex === endIndex - 1;\n\n let prefixArrow = \" \";\n if (showPreviousChoicesArrow) {\n prefixArrow = SYMBOLS.Previous;\n }\n else if (showNextChoicesArrow) {\n prefixArrow = SYMBOLS.Next;\n }\n\n const prefix = isChoiceDisabled\n ? `${prefixArrow} `\n : `${prefixArrow}${isChoiceSelected ? `${SYMBOLS.Pointer} ` : \" \"}`;\n const formattedLabel = formattedChoice.label.padEnd(\n this.longestChoice < 10 ? this.longestChoice : 0\n );\n const formattedDescription = formattedChoice.description ? ` - ${formattedChoice.description}` : \"\";\n const disabledMessage = isChoiceDisabled && typeof rawChoice !== \"string\" && typeof rawChoice.disabled === \"string\"\n ? ` [${rawChoice.disabled}]`\n : \"\";\n\n let textStyles: InspectColor[];\n if (isChoiceDisabled) {\n textStyles = [\"gray\", \"dim\"];\n }\n else if (isChoiceSelected) {\n textStyles = [\"white\", \"bold\"];\n }\n else {\n textStyles = [\"gray\"];\n }\n\n const str = `${prefix}${styleText(textStyles, `${formattedLabel}${formattedDescription}${disabledMessage}`)}${EOL}`;\n\n this.write(str);\n }\n }\n\n async #handleReturn(resolve: (value: T) => void, render: (options: RenderOptions) => void) {\n const activeChoice: Choice<T> | T | Separator | undefined = this.filteredChoices[this.activeIndex];\n if (isSeparator(activeChoice)) {\n return;\n }\n if (activeChoice !== void 0 && this.#isChoiceDisabled(activeChoice)) {\n return;\n }\n\n this.#isValidating = true;\n\n try {\n // When autocomplete produces no results, activeChoice is undefined — fall back to empty string\n const choice = activeChoice ?? (\"\" as T);\n const label = typeof choice === \"string\" ? choice : choice.label;\n const value = typeof choice === \"string\" ? choice : choice.value;\n\n for (const validator of this.#validators) {\n let validationResult: ValidationResponse;\n const result = validator.validate(value as string);\n\n if (result instanceof Promise) {\n let dotCount = 1;\n\n render({ validating: `validating${\".\".repeat(dotCount)}` });\n\n const spinnerInterval = setInterval(() => {\n dotCount = (dotCount % 3) + 1;\n render({ validating: `validating${\".\".repeat(dotCount)}` });\n }, VALIDATION_SPINNER_INTERVAL);\n\n try {\n validationResult = await result;\n }\n finally {\n clearInterval(spinnerInterval);\n }\n }\n else {\n validationResult = result;\n }\n\n if (isValid(validationResult) === false) {\n render({ error: resultError(validationResult) });\n\n return;\n }\n }\n\n render({ clearRender: true });\n\n if (!this.options.ignoreValues?.includes(value as T)) {\n this.#showAnsweredQuestion(label);\n }\n\n this.write(SYMBOLS.ShowCursor);\n this.destroy();\n\n this.#onProcessExit();\n process.off(\"exit\", this.#boundExitEvent);\n\n resolve(value as T);\n }\n finally {\n this.#isValidating = false;\n }\n }\n\n #showAnsweredQuestion(label: string) {\n const symbolPrefix = label === \"\" ? SYMBOLS.Cross : SYMBOLS.Tick;\n const prefix = `${symbolPrefix} ${styleText(\"bold\", this.message)} ${SYMBOLS.Pointer}`;\n const formattedChoice = styleText(\"yellow\", label);\n\n this.write(`${prefix} ${formattedChoice}${EOL}`);\n }\n\n #onProcessExit() {\n this.stdin.off(\"keypress\", this.#boundKeyPressEvent);\n this.stdout.moveCursor(-this.stdout.columns, 0);\n this.stdout.clearScreenDown();\n this.write(SYMBOLS.ShowCursor);\n }\n\n #onKeypress(...args) {\n const [resolve, render, , key] = args;\n if (this.#isValidating) {\n return;\n }\n if (key.name === \"up\") {\n this.activeIndex = this.#findNextEnabledIndex(this.activeIndex, -1);\n render();\n }\n else if (key.name === \"down\") {\n this.activeIndex = this.#findNextEnabledIndex(this.activeIndex, 1);\n render();\n }\n else if (key.name === \"return\") {\n void this.#handleReturn(resolve, render);\n }\n else {\n if (!key.ctrl && this.options.autocomplete) {\n // reset selected choices when user type\n this.activeIndex = this.#findFirstEnabledIndex();\n if (key.name === \"backspace\" && this.autocompleteValue.length > 0) {\n this.autocompleteValue = this.autocompleteValue.slice(0, -1);\n }\n else if (key.name !== \"backspace\") {\n this.autocompleteValue += key.sequence;\n }\n }\n render();\n }\n }\n\n async listen(): Promise<T> {\n if (this.skip) {\n this.destroy();\n const firstSelectable = this.filteredChoices.find((choice) => !isSeparator(choice)) as Choice<T> | T | undefined;\n\n return (typeof firstSelectable === \"string\" ? firstSelectable : firstSelectable?.value ?? \"\") as T;\n }\n\n const answer = this.agent.nextAnswers.shift();\n if (answer !== undefined) {\n this.#showAnsweredQuestion(answer);\n this.destroy();\n\n return answer;\n }\n\n this.transformer = () => null;\n this.write(SYMBOLS.HideCursor);\n this.#showQuestion();\n\n const render = (\n options: RenderOptions = {}\n ) => {\n const {\n initialRender = false,\n clearRender = false,\n error = null,\n validating = null\n } = options;\n\n if (!initialRender) {\n let linesToClear = this.lastRender.endIndex - this.lastRender.startIndex;\n while (linesToClear > 0) {\n this.clearLastLine();\n linesToClear--;\n }\n if (this.options.autocomplete) {\n let linesToClear = Math.ceil(\n stringLength(`${SYMBOLS.Pointer} ${this.autocompleteValue}`) / this.stdout.columns\n );\n while (linesToClear > 0) {\n this.clearLastLine();\n linesToClear--;\n }\n }\n }\n\n if (clearRender) {\n this.clearLastLine();\n\n return;\n }\n\n if (error || validating) {\n this.clearLastLine();\n this.#showQuestion(error, validating);\n }\n\n this.#showChoices();\n };\n\n render({ initialRender: true });\n\n this.#boundExitEvent = this.#onProcessExit.bind(this);\n process.once(\"exit\", this.#boundExitEvent);\n\n const { resolve, promise } = Promise.withResolvers<T>();\n this.#boundKeyPressEvent = this.#onKeypress.bind(this, resolve, render);\n this.stdin.on(\"keypress\", this.#boundKeyPressEvent);\n\n return promise;\n }\n\n #showQuestion(error: string | null = null, validating: string | null = null) {\n let hint = \"\";\n if (validating) {\n hint = styleText(\"yellow\", `[${validating}]`);\n }\n else if (error) {\n hint += `${hint.length > 0 ? \" \" : \"\"}${styleText([\"red\", \"bold\"], `[${error}]`)}`;\n }\n\n this.questionMessage = `${SYMBOLS.QuestionMark} ${styleText(\"bold\", this.message)}${hint.length > 0 ? ` ${hint}` : \"\"}`;\n\n this.write(`${this.questionMessage}${EOL}`);\n }\n}\n","// Import Node.js Dependencies\nimport { EOL } from \"node:os\";\nimport { styleText, type InspectColor } from \"node:util\";\n\n// Import Internal Dependencies\nimport { AbstractPrompt, type AbstractPromptOptions } from \"./abstract.ts\";\nimport { stringLength, isSeparator } from \"../utils.ts\";\nimport { SYMBOLS, VALIDATION_SPINNER_INTERVAL } from \"../constants.ts\";\nimport { isValid, type PromptValidator, resultError, type ValidationResponse } from \"../validators.ts\";\nimport { type Choice, type Separator } from \"../types.ts\";\n\n// CONSTANTS\nconst kRequiredChoiceProperties = [\"label\", \"value\"];\n\nexport interface MultiselectOptions<T extends string> extends AbstractPromptOptions {\n choices: (Choice<T> | T | Separator)[];\n maxVisible?: number;\n preSelectedChoices?: (Choice<T> | T)[];\n validators?: PromptValidator<string[]>[];\n autocomplete?: boolean;\n caseSensitive?: boolean;\n showHint?: boolean;\n}\n\ntype VoidFn = () => void;\ntype RenderOptions = {\n initialRender?: boolean;\n clearRender?: boolean;\n error?: string;\n validating?: string;\n};\n\nexport class MultiselectPrompt<T extends string> extends AbstractPrompt<T> {\n #boundExitEvent: VoidFn = () => void 0;\n #boundKeyPressEvent: VoidFn = () => void 0;\n #validators: PromptValidator<string[]>[];\n #showHint: boolean;\n #isValidating = false;\n\n activeIndex = 0;\n selectedIndexes: Set<number> = new Set();\n questionMessage: string;\n autocompleteValue = \"\";\n options: MultiselectOptions<T>;\n lastRender: { startIndex: number; endIndex: number; };\n\n get choices() {\n return this.options.choices;\n }\n\n get filteredChoices() {\n if (!(this.options.autocomplete && this.autocompleteValue.length > 0)) {\n return this.choices;\n }\n\n const isCaseSensitive = this.options.caseSensitive;\n const autocompleteValue = isCaseSensitive ? this.autocompleteValue : this.autocompleteValue.toLowerCase();\n\n return this.choices.filter(\n (choice) => !isSeparator(choice) && this.#filterChoice(choice, autocompleteValue, isCaseSensitive)\n );\n }\n\n #filterChoice(\n choice: T | Choice<T> | string,\n autocompleteValue: string,\n isCaseSensitive = false\n ) {\n // eslint-disable-next-line no-nested-ternary\n const choiceValue = typeof choice === \"string\" ?\n (isCaseSensitive ? choice : choice.toLowerCase()) :\n (isCaseSensitive ? choice.label : choice.label.toLowerCase());\n\n if (autocompleteValue.includes(\" \")) {\n return this.#filterMultipleWords(choiceValue, autocompleteValue, isCaseSensitive);\n }\n\n return choiceValue.includes(autocompleteValue);\n }\n\n #filterMultipleWords(choiceValue: string, autocompleteValue: string, isCaseSensitive: boolean) {\n return autocompleteValue.split(\" \").every((word) => {\n const wordValue = isCaseSensitive ? word : word.toLowerCase();\n\n return choiceValue.includes(wordValue) || choiceValue.includes(autocompleteValue);\n });\n }\n\n #isChoiceDisabled(choice: Choice<T> | T): boolean {\n return typeof choice !== \"string\" && Boolean(choice.disabled);\n }\n\n #findNextEnabledIndex(from: number, direction: 1 | -1): number {\n const total = this.filteredChoices.length;\n if (total === 0) {\n return from;\n }\n\n let index = (from + direction + total) % total;\n\n while (index !== from) {\n const choice = this.filteredChoices[index];\n if (!isSeparator(choice) && !this.#isChoiceDisabled(choice)) {\n return index;\n }\n index = (index + direction + total) % total;\n }\n\n return from;\n }\n\n #findFirstEnabledIndex(): number {\n const index = this.filteredChoices.findIndex(\n (choice) => !isSeparator(choice) && !this.#isChoiceDisabled(choice as Choice<T> | T)\n );\n\n return index === -1 ? 0 : index;\n }\n\n get longestChoice() {\n const selectableChoices = this.filteredChoices.filter(\n (choice): choice is Choice<T> | T => !isSeparator(choice)\n );\n if (selectableChoices.length === 0) {\n return 0;\n }\n\n return Math.max(...selectableChoices.map((choice) => {\n if (typeof choice === \"string\") {\n return choice.length;\n }\n\n return choice.label.length;\n }));\n }\n\n constructor(options: MultiselectOptions<T>) {\n const {\n choices,\n preSelectedChoices = [],\n validators = [],\n showHint = true,\n ...baseOptions\n } = options;\n\n super({ ...baseOptions });\n\n this.options = options;\n\n if (!choices?.length) {\n this.destroy();\n throw new TypeError(\"Missing required param: choices\");\n }\n\n this.#validators = validators;\n this.#showHint = showHint;\n\n for (const choice of choices) {\n if (typeof choice === \"string\" || isSeparator(choice)) {\n continue;\n }\n\n for (const prop of kRequiredChoiceProperties) {\n if (!choice[prop]) {\n this.destroy();\n throw new TypeError(`Missing ${prop} for choice ${JSON.stringify(choice)}`);\n }\n }\n }\n\n const firstSelectableIndex = choices.findIndex((choice) => !isSeparator(choice));\n if (firstSelectableIndex === -1) {\n this.destroy();\n throw new TypeError(\"choices must contain at least one non-separator item\");\n }\n this.activeIndex = this.#findFirstEnabledIndex();\n\n for (const choice of preSelectedChoices) {\n const choiceIndex = this.filteredChoices.findIndex((item) => {\n if (typeof item === \"string\") {\n return item === choice;\n }\n if (isSeparator(item)) {\n return false;\n }\n\n return item.value === (typeof choice === \"string\" ? choice : choice.value);\n });\n\n if (choiceIndex === -1) {\n this.destroy();\n throw new Error(`Invalid pre-selected choice: ${typeof choice === \"string\" ? choice : choice.value}`);\n }\n\n if (this.#isChoiceDisabled(this.filteredChoices[choiceIndex] as Choice<T> | T)) {\n this.destroy();\n throw new Error(`Cannot pre-select a disabled choice: ${typeof choice === \"string\" ? choice : choice.value}`);\n }\n\n this.selectedIndexes.add(choiceIndex);\n }\n }\n\n #getFormattedChoice(choiceIndex: number) {\n const choice = this.filteredChoices[choiceIndex] as Choice<T> | T;\n\n if (typeof choice === \"string\") {\n return { value: choice, label: choice };\n }\n\n return choice;\n }\n\n #getVisibleChoices() {\n const maxVisible = this.options.maxVisible || 8;\n let startIndex = Math.min(this.filteredChoices.length - maxVisible, this.activeIndex - Math.floor(maxVisible / 2));\n if (startIndex < 0) {\n startIndex = 0;\n }\n\n const endIndex = Math.min(startIndex + maxVisible, this.filteredChoices.length);\n\n return { startIndex, endIndex };\n }\n\n #showChoices() {\n const { startIndex, endIndex } = this.#getVisibleChoices();\n this.lastRender = { startIndex, endIndex };\n\n if (this.options.autocomplete) {\n this.write(`${SYMBOLS.Pointer} ${this.autocompleteValue}${EOL}`);\n }\n for (let choiceIndex = startIndex; choiceIndex < endIndex; choiceIndex++) {\n const rawChoice = this.filteredChoices[choiceIndex];\n\n if (isSeparator(rawChoice)) {\n const separatorLabel = rawChoice.label ? ` ${rawChoice.label} ` : \"\";\n // eslint-disable-next-line @stylistic/max-len\n this.write(` ${styleText(\"gray\", `${SYMBOLS.SeparatorLine}${SYMBOLS.SeparatorLine}${separatorLabel}${SYMBOLS.SeparatorLine}${SYMBOLS.SeparatorLine}`)}${EOL}`);\n continue;\n }\n\n const formattedChoice = this.#getFormattedChoice(choiceIndex);\n const isChoiceActive = choiceIndex === this.activeIndex;\n const isChoiceSelected = this.selectedIndexes.has(choiceIndex);\n const isChoiceDisabled = this.#isChoiceDisabled(rawChoice);\n const showPreviousChoicesArrow = startIndex > 0 && choiceIndex === startIndex;\n const showNextChoicesArrow = endIndex < this.filteredChoices.length && choiceIndex === endIndex - 1;\n\n let prefixArrow = \" \";\n if (showPreviousChoicesArrow) {\n prefixArrow = SYMBOLS.Previous + \" \";\n }\n else if (showNextChoicesArrow) {\n prefixArrow = SYMBOLS.Next + \" \";\n }\n\n const prefix = `${prefixArrow}${isChoiceSelected ? SYMBOLS.Active : SYMBOLS.Inactive}`;\n const formattedLabel = formattedChoice.label.padEnd(\n this.longestChoice < 10 ? this.longestChoice : 0\n );\n const formattedDescription = formattedChoice.description ? ` - ${formattedChoice.description}` : \"\";\n const disabledMessage = isChoiceDisabled && typeof rawChoice !== \"string\" && typeof rawChoice.disabled === \"string\"\n ? ` [${rawChoice.disabled}]`\n : \"\";\n\n let textStyles: InspectColor[];\n if (isChoiceDisabled) {\n textStyles = [\"gray\", \"dim\"];\n }\n else if (isChoiceActive) {\n textStyles = [\"white\", \"bold\"];\n }\n else {\n textStyles = [\"gray\"];\n }\n\n const str = `${prefix} ${styleText(textStyles, `${formattedLabel}${formattedDescription}${disabledMessage}`)}${EOL}`;\n\n this.write(str);\n }\n }\n\n async #handleReturn(resolve: (values: T[]) => void, render: (options?: RenderOptions) => void) {\n this.#isValidating = true;\n\n try {\n const { values, labels } = this.#selectedChoices();\n\n for (const validator of this.#validators) {\n let validationResult: ValidationResponse;\n const result = validator.validate(values);\n\n if (result instanceof Promise) {\n let dotCount = 1;\n\n render({ validating: `validating${\".\".repeat(dotCount)}` });\n\n const spinnerInterval = setInterval(() => {\n dotCount = (dotCount % 3) + 1;\n render({ validating: `validating${\".\".repeat(dotCount)}` });\n }, VALIDATION_SPINNER_INTERVAL);\n\n try {\n validationResult = await result;\n }\n finally {\n clearInterval(spinnerInterval);\n }\n }\n else {\n validationResult = result;\n }\n\n if (isValid(validationResult) === false) {\n render({ error: resultError(validationResult) });\n\n return;\n }\n }\n\n render({ clearRender: true });\n\n this.#showAnsweredQuestion(labels.join(\", \"));\n\n this.write(SYMBOLS.ShowCursor);\n this.destroy();\n\n this.#onProcessExit();\n process.off(\"exit\", this.#boundExitEvent);\n\n resolve(values);\n }\n finally {\n this.#isValidating = false;\n }\n }\n\n #showAnsweredQuestion(choices: string, isAgentAnswer = false) {\n const prefixSymbol = this.selectedIndexes.size === 0 && !isAgentAnswer ? SYMBOLS.Cross : SYMBOLS.Tick;\n const prefix = `${prefixSymbol} ${styleText(\"bold\", this.message)} ${SYMBOLS.Pointer}`;\n const formattedChoice = styleText(\"yellow\", choices);\n\n this.write(`${prefix}${choices ? ` ${formattedChoice}` : \"\"}${EOL}`);\n }\n\n #selectedChoices() {\n return [...this.selectedIndexes].reduce(\n (acc, index) => {\n const choice = this.filteredChoices[index];\n\n if (typeof choice === \"string\") {\n acc.values.push(choice);\n acc.labels.push(choice);\n }\n else if (!isSeparator(choice)) {\n acc.values.push(choice.value);\n acc.labels.push(choice.label as T);\n }\n\n return acc;\n },\n {\n values: [] as T[],\n labels: [] as T[]\n }\n );\n }\n\n #onProcessExit() {\n this.stdin.off(\"keypress\", this.#boundKeyPressEvent);\n this.stdout.moveCursor(-this.stdout.columns, 0);\n this.stdout.clearScreenDown();\n this.write(SYMBOLS.ShowCursor);\n }\n\n #onKeypress(...args) {\n const [resolve, render, , key] = args;\n if (this.#isValidating) {\n return;\n }\n if (key.name === \"up\") {\n this.activeIndex = this.#findNextEnabledIndex(this.activeIndex, -1);\n render();\n }\n else if (key.name === \"down\") {\n this.activeIndex = this.#findNextEnabledIndex(this.activeIndex, 1);\n render();\n }\n else if (key.ctrl && key.name === \"a\") {\n const enabledIndexes = this.filteredChoices\n .flatMap((choice, index) => {\n if (isSeparator(choice)) {\n return [];\n }\n\n return this.#isChoiceDisabled(choice) ? [] : [index];\n });\n this.selectedIndexes = this.selectedIndexes.size === enabledIndexes.length ?\n new Set() :\n new Set(enabledIndexes);\n render();\n }\n else if (key.name === \"right\") {\n const activeChoice = this.filteredChoices[this.activeIndex];\n if (!isSeparator(activeChoice) && !this.#isChoiceDisabled(activeChoice)) {\n this.selectedIndexes.add(this.activeIndex);\n render();\n }\n }\n else if (key.name === \"left\") {\n const activeChoice = this.filteredChoices[this.activeIndex];\n if (!isSeparator(activeChoice) && !this.#isChoiceDisabled(activeChoice)) {\n this.selectedIndexes = new Set([...this.selectedIndexes].filter((index) => index !== this.activeIndex));\n render();\n }\n }\n else if (key.name === \"return\") {\n void this.#handleReturn(resolve, render);\n }\n else {\n if (!key.ctrl && this.options.autocomplete) {\n // reset selected choices when user type\n this.selectedIndexes.clear();\n this.activeIndex = this.#findFirstEnabledIndex();\n if (key.name === \"backspace\" && this.autocompleteValue.length > 0) {\n this.autocompleteValue = this.autocompleteValue.slice(0, -1);\n }\n else if (key.name !== \"backspace\") {\n this.autocompleteValue += key.sequence;\n }\n }\n render();\n }\n }\n\n async listen(): Promise<T[]> {\n if (this.skip) {\n this.destroy();\n const { values } = this.#selectedChoices();\n\n return values;\n }\n\n const answer = this.agent.nextAnswers.shift();\n if (answer !== undefined) {\n const formatedAnser = Array.isArray(answer) ? answer.join(\", \") : answer;\n this.#showAnsweredQuestion(formatedAnser, true);\n this.destroy();\n\n return Array.isArray(answer) ? answer : [answer];\n }\n\n this.transformer = () => null;\n this.write(SYMBOLS.HideCursor);\n this.#showQuestion();\n\n const render = (\n options: RenderOptions = {}\n ) => {\n const {\n initialRender = false,\n clearRender = false,\n error = null,\n validating = null\n } = options;\n\n if (!initialRender) {\n let linesToClear = this.lastRender.endIndex - this.lastRender.startIndex;\n while (linesToClear > 0) {\n this.clearLastLine();\n linesToClear--;\n }\n if (this.options.autocomplete) {\n let linesToClear = Math.ceil(\n stringLength(`${SYMBOLS.Pointer} ${this.autocompleteValue}`) / this.stdout.columns\n );\n while (linesToClear > 0) {\n this.clearLastLine();\n linesToClear--;\n }\n }\n }\n\n if (clearRender) {\n this.clearLastLine();\n\n return;\n }\n\n if (error || validating) {\n this.clearLastLine();\n this.#showQuestion(error, validating);\n }\n\n this.#showChoices();\n };\n\n render({ initialRender: true });\n\n this.#boundExitEvent = this.#onProcessExit.bind(this);\n process.once(\"exit\", this.#boundExitEvent);\n\n const { promise, resolve } = Promise.withResolvers<T[]>();\n this.#boundKeyPressEvent = this.#onKeypress.bind(this, resolve, render);\n this.stdin.on(\"keypress\", this.#boundKeyPressEvent);\n\n return promise;\n }\n\n #showQuestion(error: string | null = null, validating: string | null = null) {\n let hint = this.#showHint ? styleText(\"gray\",\n // eslint-disable-next-line @stylistic/max-len\n `(Press ${styleText(\"bold\", \"<Ctrl+A>\")} to toggle all, ${styleText(\"bold\", \"<Left/Right>\")} to toggle, ${styleText(\"bold\", \"<Return>\")} to submit)`\n ) : \"\";\n if (validating) {\n hint += `${hint.length > 0 ? \" \" : \"\"}${styleText(\"yellow\", `[${validating}]`)}`;\n }\n else if (error) {\n hint += `${hint.length > 0 ? \" \" : \"\"}${styleText([\"red\", \"bold\"], `[${error}]`)}`;\n }\n\n this.questionMessage = `${SYMBOLS.QuestionMark} ${styleText(\"bold\", this.message)}${hint.length > 0 ? ` ${hint}` : \"\"}`;\n\n this.write(`${this.questionMessage}${EOL}`);\n }\n}\n","// Import Node.js Dependencies\nimport { once } from \"node:events\";\n\n// Import Internal Dependencies\nimport {\n required,\n type PromptValidator,\n type PromptTransformer,\n type ValidResponseObject,\n type InvalidResponseObject,\n type ValidationResponseObject,\n type ValidationResponse,\n type InvalidResponse,\n type ValidResponse,\n type ValidTransformationResponse,\n type TransformationResponse\n} from \"./validators.ts\";\nimport { PromptAgent } from \"./prompt-agent.ts\";\nimport { number, integer, url } from \"./transformers.ts\";\nimport type { Choice, Separator } from \"./types.ts\";\n\nimport {\n QuestionPrompt,\n ConfirmPrompt,\n SelectPrompt,\n MultiselectPrompt,\n\n type AbstractPromptOptions,\n type SelectOptions,\n type QuestionOptions,\n type ConfirmOptions,\n type MultiselectOptions\n} from \"./prompts/index.ts\";\nimport type { AbortError } from \"./errors/abort.ts\";\n\nexport async function question<T = string>(\n message: string,\n options: Omit<QuestionOptions<T>, \"message\"> = {}\n): Promise<T> {\n const prompt = new QuestionPrompt<T>(\n { ...options, message }\n );\n\n const onErrorSignal = new AbortController();\n const onError = once(\n prompt, \"error\", { signal: onErrorSignal.signal }\n ) as Promise<[AbortError]>;\n const result = await Promise.race([\n prompt.listen(),\n onError\n ]);\n if (isAbortError(result)) {\n prompt.destroy();\n\n throw result[0];\n }\n onErrorSignal.abort();\n\n return result as T;\n}\n\nexport async function select<T extends string>(\n message: string,\n options: Omit<SelectOptions<T>, \"message\">\n): Promise<T> {\n const prompt = new SelectPrompt<T>(\n { ...options, message }\n );\n\n const onErrorSignal = new AbortController();\n const onError = once(\n prompt, \"error\", { signal: onErrorSignal.signal }\n ) as Promise<[AbortError]>;\n const result = await Promise.race([\n prompt.listen(),\n onError\n ]);\n if (isAbortError(result)) {\n prompt.destroy();\n\n throw result[0];\n }\n onErrorSignal.abort();\n\n return result;\n}\n\nexport async function confirm(\n message: string,\n options: Omit<ConfirmOptions, \"message\"> = {}\n): Promise<boolean> {\n const prompt = new ConfirmPrompt(\n { ...options, message }\n );\n\n const onErrorSignal = new AbortController();\n const onError = once(\n prompt, \"error\", { signal: onErrorSignal.signal }\n ) as Promise<[AbortError]>;\n const result = await Promise.race([\n prompt.listen(),\n onError\n ]);\n if (isAbortError(result)) {\n prompt.destroy();\n\n throw result[0];\n }\n onErrorSignal.abort();\n\n return result;\n}\n\nexport async function multiselect<T extends string>(\n message: string,\n options: Omit<MultiselectOptions<T>, \"message\">\n): Promise<T[]> {\n const prompt = new MultiselectPrompt<T>(\n { ...options, message }\n );\n\n const onErrorSignal = new AbortController();\n const onError = once(\n prompt, \"error\", { signal: onErrorSignal.signal }\n ) as Promise<[AbortError]>;\n const result = await Promise.race([\n prompt.listen(),\n onError\n ]);\n if (isAbortError(result)) {\n prompt.destroy();\n\n throw result[0];\n }\n onErrorSignal.abort();\n\n return result;\n}\n\nfunction isAbortError(\n error: unknown\n): error is [AbortError] {\n return Array.isArray(error) && error.length > 0 && error[0] instanceof Error;\n}\n\nexport type {\n PromptValidator,\n PromptTransformer,\n AbstractPromptOptions,\n QuestionOptions,\n ConfirmOptions,\n Choice,\n Separator,\n MultiselectOptions,\n SelectOptions,\n ValidResponseObject,\n InvalidResponseObject,\n ValidationResponseObject,\n ValidationResponse,\n InvalidResponse,\n ValidResponse,\n ValidTransformationResponse,\n TransformationResponse\n};\n\nexport const validators = { required };\nexport const transformers = { number, integer, url };\n\nexport { PromptAgent };\n"],"mappings":";;;;;;;AA0BA,SAAgB,WAAiC;AAC/C,QAAO,EACL,WAAW,UAAU;EACnB,MAAM,UAAW,MAAM,QAAQ,MAAM,GAAG,MAAM,SAAS,IAAI,QAAQ,MAAM;AAEzE,SAAO,UAAU,OAAO;GAAE;GAAS,OAAO;GAAY;IAEzD;;AAGH,SAAgB,QAAQ,QAAqD;AAC3E,KAAI,OAAO,WAAW,SACpB,QAAO,QAAQ,YAAY;AAG7B,KAAI,OAAO,WAAW,SACpB,QAAO,OAAO,WAAW;AAG3B,QAAO;;AAGT,SAAgB,sBAAyB,QAA6E;AACpH,QAAO,OAAO,WAAW,YAAY,OAAO,YAAY;;AAG1D,SAAgB,YAAY,QAAyB;AACnD,KAAI,OAAO,WAAW,SACpB,QAAO,OAAO;AAGhB,QAAO;;;;ACxDT,MAAM,qBAAqB,OAAO,aAAa;AAE/C,IAAa,cAAb,MAAa,YAAwB;;;;;CAKnC,cAAmB,EAAE;;;;CAKrB,QAAA;CAEA,OAAO,QAAW;AAEhB,SAAO,MAAC,SAAkC,IAAI,YAAe,mBAAmB;;CAGlF,YAAY,YAAoB;AAC9B,MAAI,eAAe,mBACjB,OAAM,IAAI,MAAM,kEAAkE;;;;;;;;;;;;;;;;CAkBtF,WAAW,OAAU;AACnB,MAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,QAAK,YAAY,KAAK,GAAG,MAAM;AAE/B;;AAGF,OAAK,YAAY,KAAK,MAAM;;;;;AC5ChC,SAAgB,SAAoC;AAClD,QAAO,EACL,UAAU,OAAO;AACf,MAAI,MAAM,MAAM,KAAK,GACnB,QAAO;GAAE,SAAS;GAAO,OAAO;GAAgB;EAGlD,MAAM,SAAS,OAAO,MA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": "@topcli/prompts",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Node.js user input library for command-line interfaces.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "
|
|
8
|
-
"prepublishOnly": "npm run build",
|
|
9
|
-
"test-only": "
|
|
10
|
-
"test-types": "npm run build && tsd && attw --pack .",
|
|
11
|
-
"test": "c8 -r html npm run test-only && npm run test-types",
|
|
12
|
-
"lint": "eslint src test",
|
|
13
|
-
"lint:fix": "eslint . --fix"
|
|
14
|
-
},
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@topcli/prompts",
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "Node.js user input library for command-line interfaces.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsdown src/index.ts --format cjs,esm --dts --clean",
|
|
8
|
+
"prepublishOnly": "npm run build",
|
|
9
|
+
"test-only": "node --test ./test/**/*.test.ts",
|
|
10
|
+
"test-types": "npm run build && tsd && attw --pack .",
|
|
11
|
+
"test": "c8 -r html npm run test-only && npm run test-types",
|
|
12
|
+
"lint": "eslint src test",
|
|
13
|
+
"lint:fix": "eslint . --fix"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"registry": "https://registry.npmjs.org",
|
|
17
|
+
"access": "public",
|
|
18
|
+
"provenance": true
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/index.mjs",
|
|
21
|
+
"types": "./dist/index.d.mts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"import": {
|
|
25
|
+
"types": "./dist/index.d.mts",
|
|
26
|
+
"default": "./dist/index.mjs"
|
|
27
|
+
},
|
|
28
|
+
"require": {
|
|
29
|
+
"types": "./dist/index.d.cts",
|
|
30
|
+
"default": "./dist/index.cjs"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"node.js",
|
|
36
|
+
"cli",
|
|
37
|
+
"prompt"
|
|
38
|
+
],
|
|
39
|
+
"files": [
|
|
40
|
+
"dist"
|
|
41
|
+
],
|
|
42
|
+
"author": "PierreDemailly <pierredemailly.pro@gmail.com>",
|
|
43
|
+
"license": "ISC",
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@arethetypeswrong/cli": "^0.18.2",
|
|
46
|
+
"@openally/config.eslint": "^2.2.0",
|
|
47
|
+
"@openally/config.typescript": "^1.2.1",
|
|
48
|
+
"@types/node": "^25.0.3",
|
|
49
|
+
"c8": "^11.0.0",
|
|
50
|
+
"tsd": "^0.33.0",
|
|
51
|
+
"tsdown": "0.21.7",
|
|
52
|
+
"typescript": "^6.0.2"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=22.0.0"
|
|
56
|
+
},
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "git+https://github.com/TopCli/prompts.git"
|
|
60
|
+
},
|
|
61
|
+
"bugs": {
|
|
62
|
+
"url": "https://github.com/TopCli/prompts/issues"
|
|
63
|
+
},
|
|
64
|
+
"homepage": "https://github.com/TopCli/prompts#readme",
|
|
65
|
+
"tsd": {
|
|
66
|
+
"directory": "test/types"
|
|
67
|
+
}
|
|
68
|
+
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
type ValidResponseObject = {
|
|
2
|
-
isValid?: true;
|
|
3
|
-
};
|
|
4
|
-
type InvalidResponseObject = {
|
|
5
|
-
isValid: false;
|
|
6
|
-
error: string;
|
|
7
|
-
};
|
|
8
|
-
type ValidationResponseObject = ValidResponseObject | InvalidResponseObject;
|
|
9
|
-
type ValidationResponse = InvalidResponse | ValidResponse;
|
|
10
|
-
type InvalidResponse = string | InvalidResponseObject;
|
|
11
|
-
type ValidResponse = null | undefined | true | ValidResponseObject;
|
|
12
|
-
interface PromptValidator<T extends string | string[]> {
|
|
13
|
-
validate: (input: T) => ValidationResponse;
|
|
14
|
-
}
|
|
15
|
-
declare function required(): PromptValidator<any>;
|
|
16
|
-
|
|
17
|
-
declare class PromptAgent<T = string> {
|
|
18
|
-
#private;
|
|
19
|
-
/**
|
|
20
|
-
* The prompts answers queue.
|
|
21
|
-
* When not empty, any prompt will be answered by the first answer in this list.
|
|
22
|
-
*/
|
|
23
|
-
nextAnswers: T[];
|
|
24
|
-
static agent<T>(): PromptAgent<T>;
|
|
25
|
-
constructor(instancier: symbol);
|
|
26
|
-
/**
|
|
27
|
-
* Programmatically set the next answer for any prompt (`question()`, `confirm()`, `select()`)
|
|
28
|
-
*
|
|
29
|
-
* This is useful for testing.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```js
|
|
33
|
-
* const promptAgent = PromptAgent.agent();
|
|
34
|
-
* promptAgent.nextAnswer("toto");
|
|
35
|
-
*
|
|
36
|
-
* const input = await question("what is your name?");
|
|
37
|
-
* assert.equal(input, "toto");
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
nextAnswer(value: T): void;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
interface Choice<T extends string> {
|
|
44
|
-
value: T;
|
|
45
|
-
label: string;
|
|
46
|
-
description?: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
type Stdin = NodeJS.ReadStream & {
|
|
50
|
-
fd: 0;
|
|
51
|
-
};
|
|
52
|
-
type Stdout = NodeJS.WriteStream & {
|
|
53
|
-
fd: 1;
|
|
54
|
-
};
|
|
55
|
-
interface AbstractPromptOptions {
|
|
56
|
-
stdin?: Stdin;
|
|
57
|
-
stdout?: Stdout;
|
|
58
|
-
message: string;
|
|
59
|
-
skip?: boolean;
|
|
60
|
-
signal?: AbortSignal;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
interface QuestionOptions extends AbstractPromptOptions {
|
|
64
|
-
defaultValue?: string;
|
|
65
|
-
validators?: PromptValidator<string>[];
|
|
66
|
-
secure?: boolean | {
|
|
67
|
-
placeholder: string;
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
interface ConfirmOptions extends AbstractPromptOptions {
|
|
72
|
-
initial?: boolean;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
interface SelectOptions<T extends string> extends AbstractPromptOptions {
|
|
76
|
-
choices: (Choice<T> | T)[];
|
|
77
|
-
maxVisible?: number;
|
|
78
|
-
ignoreValues?: (T | number | boolean)[];
|
|
79
|
-
validators?: PromptValidator<string>[];
|
|
80
|
-
autocomplete?: boolean;
|
|
81
|
-
caseSensitive?: boolean;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
interface MultiselectOptions<T extends string> extends AbstractPromptOptions {
|
|
85
|
-
choices: (Choice<T> | T)[];
|
|
86
|
-
maxVisible?: number;
|
|
87
|
-
preSelectedChoices?: (Choice<T> | T)[];
|
|
88
|
-
validators?: PromptValidator<string[]>[];
|
|
89
|
-
autocomplete?: boolean;
|
|
90
|
-
caseSensitive?: boolean;
|
|
91
|
-
showHint?: boolean;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
declare function question(message: string, options?: Omit<QuestionOptions, "message">): Promise<string>;
|
|
95
|
-
declare function select<T extends string>(message: string, options: Omit<SelectOptions<T>, "message">): Promise<T>;
|
|
96
|
-
declare function confirm(message: string, options?: Omit<ConfirmOptions, "message">): Promise<boolean>;
|
|
97
|
-
declare function multiselect<T extends string>(message: string, options: Omit<MultiselectOptions<T>, "message">): Promise<T[]>;
|
|
98
|
-
|
|
99
|
-
export { type AbstractPromptOptions, type Choice, type ConfirmOptions, type InvalidResponse, type InvalidResponseObject, type MultiselectOptions, PromptAgent, type PromptValidator, type QuestionOptions, type SelectOptions, type ValidResponse, type ValidResponseObject, type ValidationResponse, type ValidationResponseObject, confirm, multiselect, question, required, select };
|