Amplify Prompts Utility

2.6.8 · maintenance · verified Sun Apr 19

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.

Common errors

Warnings

Install

Imports

Quickstart

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);

view raw JSON →