import type { ListItem, ListSelectState } from "./components/list-select.js"; import type { InitTemplate } from "../commands/init/types.js"; export type AppView = "dashboard" | "new-project" | "templates" | "auth" | "help"; export interface ProjectInfo { slug: string; path: string; type: "local" | "template" | "remote"; } export interface ServerStatus { running: boolean; url: string; port: number; errors: number; warnings: number; } export interface MCPStatus { enabled: boolean; transport: "stdio" | "http" | null; connected: boolean; clientName?: string; httpPort?: number; } export interface RemoteState { user: { email: string; name?: string; } | null; } /** * Why the app is asking for text. Declarative so the key transition stays a * pure function of state, a callback here would put behaviour back in state. */ export type InputPurpose = { kind: "create-project"; template: InitTemplate; }; export interface InputState { active: boolean; prompt: string; value: string; cursorPos: number; purpose: InputPurpose | null; } export interface LogMeta { method?: string; path?: string; status?: number; durationMs?: number; project?: string; env?: string; releaseId?: string; } export interface LogEntry { time: Date; level: "info" | "warn" | "error" | "debug"; message: string; meta?: LogMeta; } export interface AppState { view: AppView; previousView: AppView | null; server: ServerStatus; mcp: MCPStatus; remote: RemoteState; /** * Selectable lists. `activeList` indexes this state directly, so every list * it can name must be a ListSelectState living at the top level. */ projects: ListSelectState; remoteProjects: ListSelectState; templates: ListSelectState; activeList: "projects" | "remoteProjects"; input: InputState; logs: LogEntry[]; maxLogs: number; logsExpanded: boolean; logScroll: number; /** Auth provider selection index (0=Google, 1=GitHub, 2=Microsoft) */ authProviderIndex: number; /** New project option index (0=template, 1=example, 2=scratch) */ newProjectIndex: number; /** Show expanded help */ showHelp: boolean; } export declare function createInitialState(): AppState; export type StateUpdater = (state: AppState) => AppState; export declare function setProjects(projects: Array<{ slug: string; path: string; }>): StateUpdater; /** * Remote projects are the same concept as local ones and navigate through the * same list module. A remote project's path is where a pull would put it, * under `baseDir/projects/` (the working directory by default). */ export declare function setRemoteProjects(projects: Array<{ slug: string; }>, baseDir?: string): StateUpdater; /** Where `pull` places a remote project, and what the IDE opens. */ export declare function remoteProjectPath(slug: string, baseDir?: string): string; export declare function setTemplates(templates: Array<{ id: string; name: string; description: string; }>): StateUpdater; export declare function updateServer(update: Partial): StateUpdater; export declare function updateMCP(update: Partial): StateUpdater; export declare function setRemoteUser(user: RemoteState["user"]): StateUpdater; export declare function navigateTo(view: AppView): StateUpdater; export declare function goBack(): StateUpdater; export declare function setActiveList(list: "projects" | "remoteProjects"): StateUpdater; export declare function updateActiveList(updater: (list: ListSelectState) => ListSelectState): StateUpdater; export declare function startInput(prompt: string, purpose: InputPurpose, initialValue?: string): StateUpdater; export declare function updateInputValue(value: string, cursorPos: number): StateUpdater; export declare function endInput(): StateUpdater; export declare function addLog(level: LogEntry["level"], message: string, meta?: LogMeta): StateUpdater; export declare function toggleLogsExpanded(): StateUpdater; export declare function toggleHelp(): StateUpdater; export declare function scrollLogs(direction: "up" | "down"): StateUpdater; export declare function getActiveList(state: AppState): ListSelectState; export declare function getActiveSelection(state: AppState): ListItem | undefined; //# sourceMappingURL=state.d.ts.map