{"id":10497,"library":"amplify-prompts","title":"Amplify Prompts Utility","description":"amplify-prompts is an internal utility package within the AWS Amplify CLI monorepo, providing standardized terminal I/O functions for interactive command-line experiences. It is currently at version 2.6.8, with the broader Amplify CLI ecosystem seeing frequent releases (e.g., v14.x.x). This package is not typically intended for direct consumption by end-user applications but is crucial for developers extending or building upon the Amplify CLI itself. It offers a consistent API for various prompting needs like text input, confirmations, and selections, ensuring a uniform user experience across different Amplify CLI commands and custom categories. It ships with TypeScript types, facilitating robust development for CLI contributors. Its release cadence is tied to the broader Amplify CLI releases, making it a stable component within that ecosystem.","status":"maintenance","version":"2.6.8","language":"javascript","source_language":"en","source_url":"https://github.com/aws-amplify/amplify-cli","tags":["javascript","amplify","cli","prompts","typescript"],"install":[{"cmd":"npm install amplify-prompts","lang":"bash","label":"npm"},{"cmd":"yarn add amplify-prompts","lang":"bash","label":"yarn"},{"cmd":"pnpm add amplify-prompts","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"CommonJS require style might work for older Node.js environments or specific build configurations, but ESM import is preferred in modern Amplify CLI development.","wrong":"const { input } = require('amplify-prompts');","symbol":"input","correct":"import { input } from 'amplify-prompts';"},{"note":"Functions are named exports; there is no default export for this utility.","wrong":"import confirm from 'amplify-prompts';","symbol":"confirm","correct":"import { confirm } from 'amplify-prompts';"},{"note":"Ensure correct casing for named exports, as most prompts are lowercase function names.","wrong":"import { Select } from 'amplify-prompts';","symbol":"select","correct":"import { select } from 'amplify-prompts';"}],"quickstart":{"code":"import { input, confirm, select } from 'amplify-prompts';\n\nasync function runAmplifyPromptsDemo() {\n  console.log('Starting Amplify Prompts Demo...');\n\n  const projectName = await input('Enter your project name:');\n  console.log(`Project name entered: ${projectName}`);\n\n  const needsAuth = await confirm('Does your project require authentication?');\n  console.log(`Authentication required: ${needsAuth ? 'Yes' : 'No'}`);\n\n  if (needsAuth) {\n    const authType = await select(\n      'Select an authentication type:',\n      [\n        { name: 'Email/Password', value: 'email_password' },\n        { name: 'Social Login', value: 'social_login' },\n        { name: 'API Key', value: 'api_key' }\n      ]\n    );\n    console.log(`Authentication type selected: ${authType}`);\n  }\n\n  console.log('Amplify Prompts Demo finished.');\n}\n\nrunAmplifyPromptsDemo().catch(console.error);\n","lang":"typescript","description":"Demonstrates basic interactive terminal input, confirmation, and selection using amplify-prompts utilities."},"warnings":[{"fix":"Consider if you truly need to use this package directly. For application-level prompts, a general-purpose library like `inquirer` or `prompts` might be more appropriate and stable. If extending the Amplify CLI, follow official contribution guidelines.","message":"The `amplify-prompts` package is primarily an internal utility of the AWS Amplify CLI. While it's published, direct consumption by end-user applications is generally not the intended use case. Its API might change more fluidly with CLI internal refactors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure your Node.js environment matches the recommended version for the Amplify CLI you are targeting. Regularly update your Node.js and npm versions. Verify behavior in a controlled environment before deployment.","message":"Changes in underlying Node.js versions supported by the Amplify CLI can lead to unexpected behavior or incompatibilities with prompt rendering, especially concerning `stdin`/`stdout` handling.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"For automation, ensure all prompts are either bypassed with CLI flags (if available in the calling Amplify command) or pre-configured with answers. When testing, use mocking libraries to simulate user input.","message":"Running `amplify-prompts` in non-interactive environments (e.g., CI/CD pipelines) without providing default answers or mocking inputs will cause processes to hang indefinitely, awaiting user input.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"For new development within the Amplify CLI ecosystem, prefer ES Module imports (`import { ... } from 'pkg';`). Ensure your project's `tsconfig.json` and `package.json` are configured for ESM if necessary.","message":"Older versions of the Amplify CLI or internal utilities might have relied on CommonJS (`require`) for module loading. Modern Amplify CLI development primarily uses ESM (`import`).","severity":"deprecated","affected_versions":"<2.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure you are using named imports with curly braces: `import { input } from 'amplify-prompts';`. Verify your bundler configuration correctly handles module resolution.","cause":"Incorrectly importing named exports, often due to a default import when none exists, or incorrect pathing in a bundler context.","error":"TypeError: (0, amplify_prompts__WEBPACK_IMPORTED_MODULE_0__.input) is not a function"},{"fix":"Review the calling Amplify CLI command for options to provide non-interactive answers (e.g., `--yes`, `--force`). If directly using `amplify-prompts`, ensure logic bypasses interactive prompts when `process.stdout.isTTY` is false or use a mocking library for tests.","cause":"An interactive prompt function (e.g., `input`, `confirm`, `select`) was invoked in a non-interactive environment without a mechanism to provide input.","error":"Process hangs, waiting for input indefinitely in CI/CD pipeline."},{"fix":"This is often an environmental issue when running in a debugger or an IDE's output window that doesn't fully simulate a TTY. Try running the script directly from your system's terminal.","cause":"The prompt library detects that `process.stdout` is not connected to a terminal, which is necessary for interactive prompts to function correctly.","error":"Error: stdout is not a TTY"}],"ecosystem":"npm"}