[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-10160":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":33,"readmeContent":34,"aiSummary":35,"trendingCount":16,"starSnapshotCount":16,"syncStatus":36,"lastSyncTime":37,"discoverSource":38},10160,"prompts","terkelg\u002Fprompts","terkelg","❯ Lightweight, beautiful and user-friendly interactive prompts","",null,"JavaScript",9285,322,57,115,0,6,11,1,47.63,"MIT License",false,"master",true,[26,27,28,29,30,31,32,5],"choice","cli","command-line","interface","nodejs","prompt","prompter","2026-06-11 04:03:47","\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fprompts.png\" alt=\"Prompts\" width=\"500\" \u002F>\n\u003C\u002Fp>\n\n\u003Ch1 align=\"center\">❯ Prompts\u003C\u002Fh1>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fnpmjs.org\u002Fpackage\u002Fprompts\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Fprompts.svg\" alt=\"version\" \u002F>\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Factions\u002Fworkflows\u002Ftest.yml\">\n    \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Factions\u002Fworkflows\u002Ftest.yml\u002Fbadge.svg\" alt=\"test\" \u002F>\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fnpmjs.org\u002Fpackage\u002Fprompts\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fdm\u002Fprompts.svg\" alt=\"downloads\" \u002F>\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Flicenses.dev\u002Fnpm\u002Fprompts\">\n    \u003Cimg src=\"https:\u002F\u002Flicenses.dev\u002Fb\u002Fnpm\u002Fprompts\" alt=\"licenses\" \u002F>\n  \u003C\u002Fa>\n  \u003C!---\n   \u003Ca href=\"https:\u002F\u002Fpackagephobia.now.sh\u002Fresult?p=prompts\">\n    \u003Cimg src=\"https:\u002F\u002Fpackagephobia.now.sh\u002Fbadge?p=prompts\" alt=\"install size\" \u002F>\n  \u003C\u002Fa>\n  --->\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cb>Lightweight, beautiful and user-friendly interactive prompts\u003C\u002Fb>\u003Cbr \u002F>\n  \u003Csub>>_ Easy to use CLI prompts to enquire users for information▌\u003C\u002Fsub>\n\u003C\u002Fp>\n\n\u003Cbr \u002F>\n\n* **Simple**: prompts has [no big dependencies](http:\u002F\u002Fnpm.anvaka.com\u002F#\u002Fview\u002F2d\u002Fprompts) nor is it broken into a [dozen](http:\u002F\u002Fnpm.anvaka.com\u002F#\u002Fview\u002F2d\u002Finquirer) tiny modules that only work well together.\n* **User friendly**: prompt uses layout and colors to create beautiful cli interfaces.\n* **Promised**: uses promises and `async`\u002F`await`. No callback hell.\n* **Flexible**: all prompts are independent and can be used on their own.\n* **Testable**: provides a way to submit answers programmatically.\n* **Unified**: consistent experience across all [prompts](#-types).\n\n\n![split](https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fsplit.png)\n\n\n## ❯ Install\n\n```\n$ npm install --save prompts\n```\n\n> This package supports Node 14 and above\n\n![split](https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fsplit.png)\n\n## ❯ Usage\n\n\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fexample.gif\" alt=\"example prompt\" width=\"499\" height=\"103\" \u002F>\n\n```js\nconst prompts = require('prompts');\n\n(async () => {\n  const response = await prompts({\n    type: 'number',\n    name: 'age',\n    message: 'How old are you?',\n    validate: value => value \u003C 18 ? `Nightclub is 18+ only` : true\n  });\n\n  console.log(response); \u002F\u002F => { age: 24 }\n})();\n```\n\n> See [`example.js`](https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fblob\u002Fmaster\u002Fexample.js) for more options.\n\n\n![split](https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fsplit.png)\n\n\n## ❯ Examples\n\n### Single Prompt\n\nPrompt with a single prompt object. Returns an object with the response.\n\n```js\nconst prompts = require('prompts');\n\n(async () => {\n  const response = await prompts({\n    type: 'text',\n    name: 'meaning',\n    message: 'What is the meaning of life?'\n  });\n\n  console.log(response.meaning);\n})();\n```\n\n### Prompt Chain\n\nPrompt with a list of prompt objects. Returns an object with the responses.\nMake sure to give each prompt a unique `name` property to prevent overwriting values.\n\n```js\nconst prompts = require('prompts');\n\nconst questions = [\n  {\n    type: 'text',\n    name: 'username',\n    message: 'What is your GitHub username?'\n  },\n  {\n    type: 'number',\n    name: 'age',\n    message: 'How old are you?'\n  },\n  {\n    type: 'text',\n    name: 'about',\n    message: 'Tell something about yourself',\n    initial: 'Why should I?'\n  }\n];\n\n(async () => {\n  const response = await prompts(questions);\n\n  \u002F\u002F => response => { username, age, about }\n})();\n```\n\n### Dynamic Prompts\n\nPrompt properties can be functions too.\nPrompt Objects with `type` set to `falsy` values are skipped.\n\n```js\nconst prompts = require('prompts');\n\nconst questions = [\n  {\n    type: 'text',\n    name: 'dish',\n    message: 'Do you like pizza?'\n  },\n  {\n    type: prev => prev == 'pizza' ? 'text' : null,\n    name: 'topping',\n    message: 'Name a topping'\n  }\n];\n\n(async () => {\n  const response = await prompts(questions);\n})();\n```\n\n\n![split](https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fsplit.png)\n\n\n## ❯ API\n\n### prompts(prompts, options)\n\nType: `Function`\u003Cbr>\nReturns: `Object`\n\nPrompter function which takes your [prompt objects](#-prompt-objects) and returns an object with responses.\n\n\n#### prompts\n\nType: `Array|Object`\u003Cbr>\n\nArray of [prompt objects](#-prompt-objects).\n These are the questions the user will be prompted. You can see the list of supported [prompt types here](#-types).\n\nPrompts can be submitted (\u003Ckbd>return\u003C\u002Fkbd>, \u003Ckbd>enter\u003C\u002Fkbd>) or canceled (\u003Ckbd>esc\u003C\u002Fkbd>, \u003Ckbd>abort\u003C\u002Fkbd>, \u003Ckbd>ctrl\u003C\u002Fkbd>+\u003Ckbd>c\u003C\u002Fkbd>, \u003Ckbd>ctrl\u003C\u002Fkbd>+\u003Ckbd>d\u003C\u002Fkbd>). No property is being defined on the returned response object when a prompt is canceled.\n\n#### options.onSubmit\n\nType: `Function`\u003Cbr>\nDefault: `() => {}`\n\nCallback that's invoked after each prompt submission.\nIts signature is `(prompt, answer, answers)` where `prompt` is the current prompt object, `answer` the user answer to the current question and `answers` the user answers so far. Async functions are supported.\n\nReturn `true` to quit the prompt chain and return all collected responses so far, otherwise continue to iterate prompt objects.\n\n**Example:**\n```js\n(async () => {\n  const questions = [{ ... }];\n  const onSubmit = (prompt, answer) => console.log(`Thanks I got ${answer} from ${prompt.name}`);\n  const response = await prompts(questions, { onSubmit });\n})();\n```\n\n#### options.onCancel\n\nType: `Function`\u003Cbr>\nDefault: `() => {}`\n\nCallback that's invoked when the user cancels\u002Fexits the prompt.\nIts signature is `(prompt, answers)` where `prompt` is the current prompt object and `answers` the user answers so far. Async functions are supported.\n\nReturn `true` to continue and prevent the prompt loop from aborting.\nOn cancel responses collected so far are returned.\n\n**Example:**\n```js\n(async () => {\n  const questions = [{ ... }];\n  const onCancel = prompt => {\n    console.log('Never stop prompting!');\n    return true;\n  }\n  const response = await prompts(questions, { onCancel });\n})();\n```\n\n### override\n\nType: `Function`\n\nPreanswer questions by passing an object with answers to `prompts.override`.\nPowerful when combined with arguments of process.\n\n**Example**\n```js\nconst prompts = require('prompts');\nprompts.override(require('yargs').argv);\n\n(async () => {\n  const response = await prompts([\n    {\n      type: 'text',\n      name: 'twitter',\n      message: `What's your twitter handle?`\n    },\n    {\n      type: 'multiselect',\n      name: 'color',\n      message: 'Pick colors',\n      choices: [\n        { title: 'Red', value: '#ff0000' },\n        { title: 'Green', value: '#00ff00' },\n        { title: 'Blue', value: '#0000ff' }\n      ],\n    }\n  ]);\n\n  console.log(response);\n})();\n```\n\n### inject(values)\n\nType: `Function`\u003Cbr>\n\nProgrammatically inject responses. This enables you to prepare the responses ahead of time.\nIf any injected value is found the prompt is immediately resolved with the injected value.\nThis feature is intended for testing only.\n\n#### values\n\nType: `Array`\n\nArray with values to inject. Resolved values are removed from the internal inject array.\nEach value can be an array of values in order to provide answers for a question asked multiple times.\nIf a value is an instance of `Error` it will simulate the user cancelling\u002Fexiting the prompt.\n\n**Example:**\n```js\nconst prompts = require('prompts');\n\nprompts.inject([ '@terkelg', ['#ff0000', '#0000ff'] ]);\n\n(async () => {\n  const response = await prompts([\n    {\n      type: 'text',\n      name: 'twitter',\n      message: `What's your twitter handle?`\n    },\n    {\n      type: 'multiselect',\n      name: 'color',\n      message: 'Pick colors',\n      choices: [\n        { title: 'Red', value: '#ff0000' },\n        { title: 'Green', value: '#00ff00' },\n        { title: 'Blue', value: '#0000ff' }\n      ],\n    }\n  ]);\n\n  \u002F\u002F => { twitter: 'terkelg', color: [ '#ff0000', '#0000ff' ] }\n})();\n```\n\n![split](https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fsplit.png)\n\n\n## ❯ Prompt Objects\n\nPrompts Objects are JavaScript objects that define the \"questions\" and the [type of prompt](#-types).\nAlmost all prompt objects have the following properties:\n\n```js\n{\n  type: String | Function,\n  name: String | Function,\n  message: String | Function,\n  initial: String | Function | Async Function\n  format: Function | Async Function,\n  onRender: Function\n  onState: Function\n  stdin: Readable\n  stdout: Writeable\n}\n```\n\nEach property be of type `function` and will be invoked right before prompting the user.\n\nThe function signature is `(prev, values, prompt)`, where `prev` is the value from the previous prompt,\n`values` is the response object with all values collected so far and `prompt` is the previous prompt object.\n\n**Function example:**\n```js\n{\n  type: prev => prev > 3 ? 'confirm' : null,\n  name: 'confirm',\n  message: (prev, values) => `Please confirm that you eat ${values.dish} times ${prev} a day?`\n}\n```\n\nThe above prompt will be skipped if the value of the previous prompt is less than 3.\n\n### type\n\nType: `String|Function`\n\nDefines the type of prompt to display. See the list of [prompt types](#-types) for valid values.\n\nIf `type` is a falsy value the prompter will skip that question.\n```js\n{\n  type: null,\n  name: 'forgetme',\n  message: `I'll never be shown anyway`,\n}\n```\n\n### name\n\nType: `String|Function`\n\nThe response will be saved under this key\u002Fproperty in the returned response object.\nIn case you have multiple prompts with the same name only the latest response will be stored.\n\n> Make sure to give prompts unique names if you don't want to overwrite previous values.\n\n### message\n\nType: `String|Function`\n\nThe message to be displayed to the user.\n\n### initial\n\nType: `String|Function`\n\nOptional default prompt value. Async functions are supported too.\n\n### format\n\nType: `Function`\n\nReceive the user input and return the formatted value to be used inside the program.\nThe value returned will be added to the response object.\n\nThe function signature is `(val, values)`, where `val` is the value from the current prompt and\n`values` is the current response object in case you need to format based on previous responses.\n\n**Example:**\n```js\n{\n  type: 'number',\n  name: 'price',\n  message: 'Enter price',\n  format: val => Intl.NumberFormat(undefined, { style: 'currency', currency: 'USD' }).format(val);\n}\n```\n\n### onRender\n\nType: `Function`\n\nCallback for when the prompt is rendered.\nThe function receives [kleur](https:\u002F\u002Fgithub.com\u002Flukeed\u002Fkleur) as its first argument and `this` refers to the current prompt.\n\n**Example:**\n```js\n{\n  type: 'number',\n  message: 'This message will be overridden',\n  onRender(kleur) {\n    this.msg = kleur.cyan('Enter a number');\n  }\n}\n```\n\n### onState\n\nType: `Function`\n\nCallback for when the state of the current prompt changes.\nThe function signature is `(state)` where `state` is an object with a snapshot of the current state.\nThe state object has two properties `value` and `aborted`. E.g `{ value: 'This is ', aborted: false }`\n\n### stdin and stdout\n\nType: `Stream`\n\nBy default, prompts uses `process.stdin` for receiving input and `process.stdout` for writing output.\nIf you need to use different streams, for instance `process.stderr`, you can set these with the `stdin` and `stdout` properties.\n\n\n![split](https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fsplit.png)\n\n\n## ❯ Types\n\n* [text](#textmessage-initial-style)\n* [password](#passwordmessage-initial)\n* [invisible](#invisiblemessage-initial)\n* [number](#numbermessage-initial-max-min-style)\n* [confirm](#confirmmessage-initial)\n* [list](#listmessage-initial)\n* [toggle](#togglemessage-initial-active-inactive)\n* [select](#selectmessage-choices-initial-hint-warn)\n* [multiselect](#multiselectmessage-choices-initial-max-hint-warn)\n* [autocompleteMultiselect](#multiselectmessage-choices-initial-max-hint-warn)\n* [autocomplete](#autocompletemessage-choices-initial-suggest-limit-style)\n* [date](#datemessage-initial-warn)\n\n***\n\n### text(message, [initial], [style])\n> Text prompt for free text input.\n\nHit \u003Ckbd>tab\u003C\u002Fkbd> to autocomplete to `initial` value when provided.\n\n#### Example\n\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Ftext.gif\" alt=\"text prompt\" width=\"499\" height=\"103\" \u002F>\n\n```js\n{\n  type: 'text',\n  name: 'value',\n  message: `What's your twitter handle?`\n}\n```\n\n#### Options\n| Param | Type | Description |\n| ----- | :--: | ----------- |\n| message | `string` | Prompt message to display |\n| initial | `string` | Default string value |\n| style | `string` | Render style (`default`, `password`, `invisible`, `emoji`). Defaults to `default` |\n| format | `function` | Receive user input. The returned value will be added to the response object |\n| validate | `function` | Receive user input. Should return `true` if the value is valid, and an error message `String` otherwise. If `false` is returned, a default error message is shown |\n| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |\n| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |\n\n**↑ back to:** [Prompt types](#-types)\n\n***\n\n### password(message, [initial])\n> Password prompt with masked input.\n\nThis prompt is a similar to a prompt of type `'text'` with `style` set to `'password'`.\n\n#### Example\n\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fpassword.gif\" alt=\"password prompt\" width=\"499\" height=\"103\" \u002F>\n\n```js\n{\n  type: 'password',\n  name: 'value',\n  message: 'Tell me a secret'\n}\n```\n\n#### Options\n| Param | Type | Description |\n| ----- | :--: | ----------- |\n| message | `string` | Prompt message to display |\n| initial | `string` | Default string value |\n| format | `function` | Receive user input. The returned value will be added to the response object |\n| validate | `function` | Receive user input. Should return `true` if the value is valid, and an error message `String` otherwise. If `false` is returned, a default error message is shown |\n| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |\n| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |\n\n**↑ back to:** [Prompt types](#-types)\n\n***\n\n### invisible(message, [initial])\n> Prompts user for invisible text input.\n\nThis prompt is working like `sudo` where the input is invisible.\nThis prompt is a similar to a prompt of type `'text'` with style set to `'invisible'`.\n\n#### Example\n\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Finvisible.gif\" alt=\"invisible prompt\" width=\"499\" height=\"103\" \u002F>\n\n```js\n{\n  type: 'invisible',\n  name: 'value',\n  message: 'Enter password'\n}\n```\n\n#### Options\n| Param | Type | Description |\n| ----- | :--: | ----------- |\n| message | `string` | Prompt message to display |\n| initial | `string` | Default string value |\n| format | `function` | Receive user input. The returned value will be added to the response object |\n| validate | `function` | Receive user input. Should return `true` if the value is valid, and an error message `String` otherwise. If `false` is returned, a default error message is shown |\n| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |\n| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |\n\n**↑ back to:** [Prompt types](#-types)\n\n***\n\n### number(message, initial, [max], [min], [style])\n> Prompts user for number input.\n\nYou can type in numbers and use \u003Ckbd>up\u003C\u002Fkbd>\u002F\u003Ckbd>down\u003C\u002Fkbd> to increase\u002Fdecrease the value. Only numbers are allowed as input. Hit \u003Ckbd>tab\u003C\u002Fkbd> to autocomplete to `initial` value when provided.\n\n#### Example\n\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fnumber.gif\" alt=\"number prompt\" width=\"499\" height=\"103\" \u002F>\n\n```js\n{\n  type: 'number',\n  name: 'value',\n  message: 'How old are you?',\n  initial: 0,\n  style: 'default',\n  min: 2,\n  max: 10\n}\n```\n\n#### Options\n| Param | Type | Description |\n| ----- | :--: | ----------- |\n| message | `string` | Prompt message to display |\n| initial | `number` | Default number value |\n| format | `function` | Receive user input. The returned value will be added to the response object |\n| validate | `function` | Receive user input. Should return `true` if the value is valid, and an error message `String` otherwise. If `false` is returned, a default error message is shown |\n| max | `number` | Max value. Defaults to `Infinity` |\n| min | `number` | Min value. Defaults to `-infinity` |\n| float | `boolean` | Allow floating point inputs. Defaults to `false` |\n| round | `number` | Round `float` values to x decimals. Defaults to `2` |\n| increment | `number` | Increment step when using \u003Ckbd>arrow\u003C\u002Fkbd> keys. Defaults to `1` |\n| style | `string` | Render style (`default`, `password`, `invisible`, `emoji`). Defaults to `default` |\n| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |\n| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |\n\n**↑ back to:** [Prompt types](#-types)\n\n***\n\n### confirm(message, [initial])\n> Classic yes\u002Fno prompt.\n\nHit \u003Ckbd>y\u003C\u002Fkbd> or \u003Ckbd>n\u003C\u002Fkbd> to confirm\u002Freject.\n\n#### Example\n\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fconfirm.gif\" alt=\"confirm prompt\" width=\"499\" height=\"103\" \u002F>\n\n```js\n{\n  type: 'confirm',\n  name: 'value',\n  message: 'Can you confirm?',\n  initial: true\n}\n```\n\n\n#### Options\n| Param | Type | Description |\n| ----- | :--: | ----------- |\n| message | `string` | Prompt message to display |\n| initial | `boolean` | Default value. Default is `false` |\n| format | `function` | Receive user input. The returned value will be added to the response object |\n| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |\n| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |\n\n**↑ back to:** [Prompt types](#-types)\n\n***\n\n### list(message, [initial])\n> List prompt that return an array.\n\nSimilar to the `text` prompt, but the output is an `Array` containing the\nstring separated by `separator`.\n\n```js\n{\n  type: 'list',\n  name: 'value',\n  message: 'Enter keywords',\n  initial: '',\n  separator: ','\n}\n```\n\n\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Flist.gif\" alt=\"list prompt\" width=\"499\" height=\"103\" \u002F>\n\n\n| Param | Type | Description |\n| ----- | :--: | ----------- |\n| message | `string` | Prompt message to display |\n| initial | `boolean` | Default value |\n| format | `function` | Receive user input. The returned value will be added to the response object |\n| separator | `string` | String separator. Will trim all white-spaces from start and end of string. Defaults to `','`  |\n| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |\n| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |\n\n**↑ back to:** [Prompt types](#-types)\n\n***\n\n### toggle(message, [initial], [active], [inactive])\n> Interactive toggle\u002Fswitch prompt.\n\nUse tab or \u003Ckbd>arrow keys\u003C\u002Fkbd>\u002F\u003Ckbd>tab\u003C\u002Fkbd>\u002F\u003Ckbd>space\u003C\u002Fkbd> to switch between options.\n\n#### Example\n\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Ftoggle.gif\" alt=\"toggle prompt\" width=\"499\" height=\"103\" \u002F>\n\n```js\n{\n  type: 'toggle',\n  name: 'value',\n  message: 'Can you confirm?',\n  initial: true,\n  active: 'yes',\n  inactive: 'no'\n}\n```\n\n#### Options\n| Param | Type | Description |\n| ----- | :--: | ----------- |\n| message | `string` | Prompt message to display |\n| initial | `boolean` | Default value. Defaults to `false` |\n| format | `function` | Receive user input. The returned value will be added to the response object |\n| active | `string` | Text for `active` state. Defaults to `'on'` |\n| inactive | `string` | Text for `inactive` state. Defaults to `'off'` |\n| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |\n| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |\n\n**↑ back to:** [Prompt types](#-types)\n\n***\n\n### select(message, choices, [initial], [hint], [warn])\n> Interactive select prompt.\n\nUse \u003Ckbd>up\u003C\u002Fkbd>\u002F\u003Ckbd>down\u003C\u002Fkbd> to navigate. Use \u003Ckbd>tab\u003C\u002Fkbd> to cycle the list.\n\n#### Example\n\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fselect.gif\" alt=\"select prompt\" width=\"499\" height=\"130\" \u002F>\n\n```js\n{\n  type: 'select',\n  name: 'value',\n  message: 'Pick a color',\n  choices: [\n    { title: 'Red', description: 'This option has a description', value: '#ff0000' },\n    { title: 'Green', value: '#00ff00', disabled: true },\n    { title: 'Blue', value: '#0000ff' }\n  ],\n  initial: 1\n}\n```\n\n#### Options\n| Param | Type | Description |\n| ----- | :--: | ----------- |\n| message | `string` | Prompt message to display |\n| initial | `number` | Index of default value |\n| format | `function` | Receive user input. The returned value will be added to the response object |\n| hint | `string` | Hint to display to the user |\n| warn | `string` | Message to display when selecting a disabled option |\n| choices | `Array` | Array of strings or choices objects `[{ title, description, value, disabled }, ...]`. The choice's index in the array will be used as its value if it is not specified. |\n| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |\n| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |\n\n**↑ back to:** [Prompt types](#-types)\n\n***\n\n### multiselect(message, choices, [initial], [max], [hint], [warn])\n### autocompleteMultiselect(same)\n> Interactive multi-select prompt.\n> Autocomplete is a searchable multiselect prompt with the same options. Useful for long lists.\n\nUse \u003Ckbd>space\u003C\u002Fkbd> to toggle select\u002Funselect and \u003Ckbd>up\u003C\u002Fkbd>\u002F\u003Ckbd>down\u003C\u002Fkbd> to navigate. Use \u003Ckbd>tab\u003C\u002Fkbd> to cycle the list. You can also use \u003Ckbd>right\u003C\u002Fkbd> to select and \u003Ckbd>left\u003C\u002Fkbd> to deselect.\nBy default this prompt returns an `array` containing the **values** of the selected items - not their display title.\n\n#### Example\n\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fmultiselect.gif\" alt=\"multiselect prompt\" width=\"499\" height=\"130\" \u002F>\n\n```js\n{\n  type: 'multiselect',\n  name: 'value',\n  message: 'Pick colors',\n  choices: [\n    { title: 'Red', value: '#ff0000' },\n    { title: 'Green', value: '#00ff00', disabled: true },\n    { title: 'Blue', value: '#0000ff', selected: true }\n  ],\n  max: 2,\n  hint: '- Space to select. Return to submit'\n}\n```\n\n#### Options\n| Param | Type | Description |\n| ----- | :--: | ----------- |\n| message | `string` | Prompt message to display |\n| format | `function` | Receive user input. The returned value will be added to the response object |\n| instructions | `string` or `boolean` | Prompt instructions to display |\n| choices | `Array` | Array of strings or choices objects `[{ title, value, disabled }, ...]`. The choice's index in the array will be used as its value if it is not specified. |\n| optionsPerPage | `number` | Number of options displayed per page (default: 10) |\n| min | `number` | Min select - will display error |\n| max | `number` | Max select |\n| hint | `string` | Hint to display to the user |\n| warn | `string` | Message to display when selecting a disabled option |\n| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |\n| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |\n\nThis is one of the few prompts that don't take a initial value.\nIf you want to predefine selected values, give the choice object an `selected` property of `true`.\n\n**↑ back to:** [Prompt types](#-types)\n\n***\n\n### autocomplete(message, choices, [initial], [suggest], [limit], [style])\n> Interactive auto complete prompt.\n\nThe prompt will list options based on user input. Type to filter the list.\nUse \u003Ckbd>⇧\u003C\u002Fkbd>\u002F\u003Ckbd>⇩\u003C\u002Fkbd> to navigate. Use \u003Ckbd>tab\u003C\u002Fkbd> to cycle the result. Use \u003Ckbd>Page Up\u003C\u002Fkbd>\u002F\u003Ckbd>Page Down\u003C\u002Fkbd> (on Mac: \u003Ckbd>fn\u003C\u002Fkbd> + \u003Ckbd>⇧\u003C\u002Fkbd> \u002F \u003Ckbd>⇩\u003C\u002Fkbd>) to change page. Hit \u003Ckbd>enter\u003C\u002Fkbd> to select the highlighted item below the prompt.\n\nThe default suggests function is sorting based on the `title` property of the choices.\nYou can overwrite how choices are being filtered by passing your own suggest function.\n\n#### Example\n\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fautocomplete.gif\" alt=\"auto complete prompt\" width=\"499\" height=\"163\" \u002F>\n\n```js\n{\n  type: 'autocomplete',\n  name: 'value',\n  message: 'Pick your favorite actor',\n  choices: [\n    { title: 'Cage' },\n    { title: 'Clooney', value: 'silver-fox' },\n    { title: 'Gyllenhaal' },\n    { title: 'Gibson' },\n    { title: 'Grant' }\n  ]\n}\n```\n\n#### Options\n| Param | Type | Description |\n| ----- | :--: | ----------- |\n| message | `string` | Prompt message to display |\n| format | `function` | Receive user input. The returned value will be added to the response object |\n| choices | `Array` | Array of auto-complete choices objects `[{ title, value }, ...]` |\n| suggest | `function` | Filter function. Defaults to sort by `title` property. `suggest` should always return a promise. Filters using `title` by default  |\n| limit | `number` | Max number of results to show. Defaults to `10` |\n| style | `string` | Render style (`default`, `password`, `invisible`, `emoji`). Defaults to `'default'` |\n| initial | `string \\| number` | Default initial value |\n| clearFirst | `boolean` | The first ESCAPE keypress will clear the input |\n| fallback | `string` | Fallback message when no match is found. Defaults to `initial` value if provided |\n| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |\n| onState | `function` | On state change callback. Function signature is an `object` with three properties: `value`, `aborted` and `exited` |\n\nExample on what a `suggest` function might look like:\n```js\nconst suggestByTitle = (input, choices) =>\n    Promise.resolve(choices.filter(i => i.title.slice(0, input.length) === input))\n```\n\n**↑ back to:** [Prompt types](#-types)\n\n***\n\n### date(message, [initial], [warn])\n> Interactive date prompt.\n\nUse \u003Ckbd>left\u003C\u002Fkbd>\u002F\u003Ckbd>right\u003C\u002Fkbd>\u002F\u003Ckbd>tab\u003C\u002Fkbd> to navigate. Use \u003Ckbd>up\u003C\u002Fkbd>\u002F\u003Ckbd>down\u003C\u002Fkbd> to change date.\n\n#### Example\n\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fdate.gif\" alt=\"date prompt\" width=\"499\" height=\"103\" \u002F>\n\n```js\n{\n  type: 'date',\n  name: 'value',\n  message: 'Pick a date',\n  initial: new Date(1997, 09, 12),\n  validate: date => date > Date.now() ? 'Not in the future' : true\n}\n```\n\n#### Options\n| Param | Type | Description |\n| ----- | :--: | ----------- |\n| message | `string` | Prompt message to display |\n| initial | `date` | Default date |\n| locales | `object` | Use to define custom locales. See below for an example. |\n| mask | `string` | The format mask of the date. See below for more information.\u003Cbr \u002F>Default: `YYYY-MM-DD HH:mm:ss` |\n| validate | `function` | Receive user input. Should return `true` if the value is valid, and an error message `String` otherwise. If `false` is returned, a default error message is shown |\n| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |\n| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |\n\nDefault locales:\n\n```javascript\n{\n  months: [\n    'January', 'February', 'March', 'April',\n    'May', 'June', 'July', 'August',\n    'September', 'October', 'November', 'December'\n  ],\n  monthsShort: [\n    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',\n    'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'\n  ],\n  weekdays: [\n    'Sunday', 'Monday', 'Tuesday', 'Wednesday',\n    'Thursday', 'Friday', 'Saturday'\n  ],\n  weekdaysShort: [\n    'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'\n  ]\n}\n```\n>**Formatting**: See full list of formatting options in the [wiki](https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fwiki\u002FDate-Time-Formatting)\n\n![split](https:\u002F\u002Fgithub.com\u002Fterkelg\u002Fprompts\u002Fraw\u002Fmaster\u002Fmedia\u002Fsplit.png)\n\n**↑ back to:** [Prompt types](#-types)\n\n***\n\n## ❯ Credit\nMany of the prompts are based on the work of [derhuerst](https:\u002F\u002Fgithub.com\u002Fderhuerst).\n\n\n## ❯ License\n\nMIT © [Terkel Gjervig](https:\u002F\u002Fterkel.com)\n","Prompts 是一个轻量级、美观且用户友好的交互式命令行提示库。它使用 JavaScript 编写，支持 Node.js 14 及以上版本，通过简洁的 API 提供了多种类型的输入提示，如文本、数字等，并支持异步编程模型以避免回调地狱。该库设计注重用户体验，利用布局和颜色来创建吸引人的 CLI 界面，同时每个提示都是独立的，可以单独使用，也便于测试。适用于需要与用户进行简单交互的命令行工具或脚本开发场景，比如配置文件生成器、向导式安装程序等。",2,"2026-06-11 03:26:57","top_topic"]