/**** * Dev Command - Development server with HMR */ import { type AuthIdentity } from "../../auth/login.js"; import { type RemoteProject } from "../../sync/index.js"; import { type PushOptions } from "../push/index.js"; export interface DevOptions { port: number; /** * True when the port was set explicitly by a `--port` / `-p` flag or by a * valid `PORT` / `VERYFRONT_PORT` env var. When false (or absent) the port * value fell through to the hardcoded default and `config.dev.port` should * take precedence. Defaults to `port !== DEFAULT_DEV_PORT` for callers that * do not set this field, preserving backward-compatible behaviour. */ portExplicit?: boolean; projectDir: string; hmr?: boolean; open?: boolean; /** Demo mode: don't exit process on shutdown, resolve done promise instead */ demoMode?: boolean; /** * Clear the shared on-disk ESM caches before starting. Only honoured once the * requested dev port is confirmed free, because the cache directory is shared * with any dev server already serving this project. */ clearLocalCaches?: boolean; } export type DevCommandOptions = DevOptions; export interface DevCommandResult { ready: Promise; done: Promise; /** * The port the server actually bound, which is not always the requested one: * a taken port falls forward. Embedded callers must use this rather than the * port they asked for, or they will point the user at the process that caused * the collision. */ port: number; /** Stop the dev server programmatically (for demo mode) */ stop: () => Promise; } export declare function preloadDevAuth(apiToken?: string): Promise<{ identity: AuthIdentity | null; projects: RemoteProject[]; }>; export declare function createSelectedProjectPushOptions(projectDir: string, project: RemoteProject): PushOptions; /** * Starts the dev server on the first free port at or after `requestedPort`. * * Port 3000 is the most contended port on a developer machine, and the docs * tell readers to run a bare `veryfront dev`, so a taken port scans forward * rather than killing the command. Everything downstream - the MCP port, the * printed URL, the browser the demo opens - must key off the returned `port` * rather than the requested one, or a fall-forward points the user at the * process that caused the collision. * * Takes `start` as a callback so the whole scan costs one `DevServer.start()`: * probing is a bare bind/release, and a failed `start()` has already registered * watchers and reload subscriptions that only `stop()` releases. */ export declare function startDevServerOnFreePort(requestedPort: number, start: (port: number) => Promise): Promise<{ server: T; port: number; }>; /** * Clears the shared on-disk ESM caches, but only if they are safe to remove. * * The caches live under the project's `.cache` directory, which every dev * server rooted at that project shares. A taken dev port is the signal that one * of them is already running and still serving modules it compiled, so the * clear is skipped rather than wiping that server's work out from under it - * the second `veryfront dev` falls forward to a free port and starts on a cache * it did not just destroy. * * The clear is also skipped when the project keeps a persistent local dev * cache. That cache stores compiled modules that reference these files, so * removing them makes every entry fail validation and turns each restart cold * again. Run `veryfront clean --cache` to reset both. * * Returns whether the clear ran. Takes `clear`, `probe`, and `persists` as * parameters so the decision can be tested without booting a dev server, the * same seam `startDevServerOnFreePort` uses. */ export declare function clearLocalCachesIfPortFree(requestedPort: number, clear?: () => Promise, probe?: (port: number) => Promise, persists?: () => boolean): Promise; export declare function devCommand(options: DevOptions): Promise; //# sourceMappingURL=command.d.ts.map