Skip to content

PromptEngine ​

Prompt engine interface.

Implementations present one prompt per promptOne() call and return the result. Engines may retain state across calls, such as an answer queue.

The resolution chain calls promptOne for each flag that needs interactive input. Engines do not need schema knowledge — all relevant context (message, choices, validation) is in the config.

Signatures ​

ts
interface PromptEngine {}

Members ​

Methods ​

promptOne ​

ts
promptOne(config: ResolvedPromptConfig): Promise<PromptResult>;

Examples ​

ts
// Custom engine (e.g. wrapping @clack/prompts)
const engine: PromptEngine = {
  async promptOne(config) {
    // ... render with your library
    return { answered: true, value: userInput };
  }
};

See Also ​

Released under the MIT License.