import type { Repository } from "@lix-js/client"; /** * One step in a CLI chain. * Defines which types the context needs to extend and how it extends the context * * Cli Steps can be chained to slowly build up the context over time * * @example * ```ts * const step1: CliStep = async (ctx) => { * return {...ctx, foo: "hello" } * } * * const step2: CliStep<{ foo: string }, { bar: number }> = async (ctx) => { * return { ...ctx, bar: 42 } * } * * const initial = { baz: "baz" } as const; * const ctx1 = await step1(initial); * const ctx2 = await step2(ctx1); * * ctx2 // Has type { foo: string, bar: number, baz: "baz" } * ``` */ export type CliStep = (ctx: Ctx) => Promise; type CliStepIn> = Step extends CliStep ? In : never; type CliStepOut> = Step extends CliStep ? Out : never; type Pair, Step2 extends CliStep, any>> = CliStep, CliStepOut & CliStepOut>; export declare function pair, Step2 extends CliStep, any>>(step1: Step1, step2: Step2): Pair; export declare function succeedOrElse, U>(promise: T, orElse: U): Promise; export declare function normalizePath(id: string): string; export declare function findFile(args: { candidates: string[]; base: string; fs: Repository["nodeishFs"]; }): Promise; export declare function fileExists(fs: Repository["nodeishFs"], path: string): Promise; export {}; //# sourceMappingURL=utils.d.ts.map