Registry / aws / amplify-prompts

amplify-prompts

JSON →
library2.6.8jsnpmunverified

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.

npm install amplify-prompts
INSTALL
IMPORT
SIG · AMPLIFY-PROMPTS
A
amplify-prompts
awsjavascriptv2.6.8
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

input
import { input } from 'amplify-prompts';
const { input } = require('amplify-prompts');
CommonJS require style might work for older Node.js environments or specific build configurations, but ESM import is preferred in modern Amplify CLI development.
confirm
import { confirm } from 'amplify-prompts';
import confirm from 'amplify-prompts';
Functions are named exports; there is no default export for this utility.
select
import { select } from 'amplify-prompts';
import { Select } from 'amplify-prompts';
Ensure correct casing for named exports, as most prompts are lowercase function names.

Demonstrates basic interactive terminal input, confirmation, and selection using amplify-prompts utilities.

import { input, confirm, select } from 'amplify-prompts'; async function runAmplifyPromptsDemo() { console.log('Starting Amplify Prompts Demo...'); const projectName = await input('Enter your project name:'); console.log(`Project name entered: ${projectName}`); const needsAuth = await confirm('Does your project require authentication?'); console.log(`Authentication required: ${needsAuth ? 'Yes' : 'No'}`); if (needsAuth) { const authType = await select( 'Select an authentication type:', [ { name: 'Email/Password', value: 'email_password' }, { name: 'Social Login', value: 'social_login' }, { name: 'API Key', value: 'api_key' } ] ); console.log(`Authentication type selected: ${authType}`); } console.log('Amplify Prompts Demo finished.'); } runAmplifyPromptsDemo().catch(console.error);
Debug
Known issues
gotchaThe `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.
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.
affects: >=1.0.0
breakingChanges 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.
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.
affects: >=2.0.0
gotchaRunning `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.
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.
affects: >=1.0.0
deprecatedOlder 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`).
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.
affects: <2.0.0
Errors
Common errors & fixes
TypeError: (0, amplify_prompts__WEBPACK_IMPORTED_MODULE_0__.input) is not a function
Incorrectly importing named exports, often due to a default import when none exists, or incorrect pathing in a bundler context.
fix
Ensure you are using named imports with curly braces: `import { input } from 'amplify-prompts';`. Verify your bundler configuration correctly handles module resolution.
Process hangs, waiting for input indefinitely in CI/CD pipeline.
An interactive prompt function (e.g., `input`, `confirm`, `select`) was invoked in a non-interactive environment without a mechanism to provide input.
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.
Error: stdout is not a TTY
The prompt library detects that `process.stdout` is not connected to a terminal, which is necessary for interactive prompts to function correctly.
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.
Upgrade
Version history
2.6.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
36 hits · last 30 days
node
32
OpenAI (training)
1
Resources
amplify-prompts — npm install amplify-prompts · libregistry