/** * Key Transition * * The single owner of "what does this key press do?". A pure function of * (state, key) that settles into the next state plus the effects the shell * should perform. Nothing here touches the terminal, the network, or the * clock, so every key path is reachable from a test through this one * interface, the same one the shell uses. * * Effects are data, never callbacks. The shell performs them; this module * decides them. */ import type { InitTemplate } from "../commands/init/types.js"; import { type AppState, type ProjectInfo } from "./state.js"; export declare const KEY_UP = "\u001B[A"; export declare const KEY_DOWN = "\u001B[B"; export declare const KEY_ESCAPE = "\u001B"; export declare const KEY_ENTER = "\r"; export declare const KEY_NEWLINE = "\n"; export declare const KEY_CTRL_C = "\u0003"; export declare const KEY_TAB = "\t"; export type AuthProvider = "google" | "github" | "microsoft"; export declare const AUTH_PROVIDERS: AuthProvider[]; /** Work the shell performs on the reducer's behalf. */ export type Effect = { kind: "exit"; } | { kind: "open-browser"; project: ProjectInfo; } | { kind: "open-studio"; project: ProjectInfo; } | { kind: "open-ide"; project: ProjectInfo; } | { kind: "pull"; project: ProjectInfo; } | { kind: "push"; project: ProjectInfo; } | { kind: "login"; provider: AuthProvider; } | { kind: "logout"; } | { kind: "open-mcp-settings"; } | { kind: "create-project"; template: InitTemplate; name: string; }; export interface KeyResult { state: AppState; effects: Effect[]; } /** * The impure facts the transition needs. Injected rather than reached for, so * the reducer stays a pure function and tests can pin the suggestion. */ export interface KeyEnv { /** Pre-filled value for the project-name prompt. */ suggestProjectName: () => string; } /** * Reduce one key press against the current state. * * The returned state is always the state to adopt, there is no second write * path. Callers assign it and run the effects; they never mutate state * themselves. */ export declare function reduceKey(state: AppState, key: string, env: KeyEnv): KeyResult; //# sourceMappingURL=key-reducer.d.ts.map