askeroo
Version:
A modern CLI prompt library with flow control, history navigation, and conditional prompts
79 lines • 2.17 kB
TypeScript
import type { GroupMeta } from "../../types/index.js";
export type GroupOpts = {
flow?: "progressive";
enableArrowNavigation?: never;
hideOnCompletion?: boolean;
} | {
flow: "phased";
enableArrowNavigation?: never;
hideOnCompletion?: boolean;
} | {
flow: "static";
enableArrowNavigation?: boolean;
hideOnCompletion?: boolean;
} | {
flow?: undefined;
enableArrowNavigation?: never;
hideOnCompletion?: boolean;
};
export type { GroupMeta };
/**
* User-provided options for the group plugin
*/
export interface GroupOptions extends GroupMeta {
flow?: "progressive" | "phased" | "static";
enableArrowNavigation?: boolean;
body: () => Promise<any>;
depth?: number;
parentGroup?: string;
discoveredFields?: Array<{
id: string;
label: string;
type: string;
}>;
hideOnCompletion?: boolean;
}
/**
* Create a group of prompts
*
* Groups are container plugins that organize prompts into logical sections.
* They support different flow types and can be nested.
*
* @example Progressive group (default)
* ```typescript
* const answers = await group(
* async () => {
* const name = await text({ label: "Name" });
* const email = await text({ label: "Email" });
* return { name, email };
* },
* { label: "User Info" }
* );
* ```
*
* @example Static group with arrow navigation
* ```typescript
* const answers = await group(
* async () => {
* const name = await text({ label: "Name" });
* const email = await text({ label: "Email" });
* return { name, email };
* },
* { label: "User Info", flow: "static", enableArrowNavigation: true }
* );
* ```
*
* @example Group that hides after completion
* ```typescript
* const answers = await group(
* async () => {
* const name = await text({ label: "Name" });
* const email = await text({ label: "Email" });
* return { name, email };
* },
* { label: "User Info", hideOnCompletion: true }
* );
* ```
*/
export declare const group: (body: () => Promise<any>, opts?: GroupOpts & GroupMeta) => Promise<any>;
//# sourceMappingURL=index.d.ts.map