export interface MkdocsHandle { kill(): void; waitForExit(): Promise; } /** * Run `mkdocs --version` to detect if MkDocs is present on PATH. * Resolves true on exit-code 0, false for any failure (including ENOENT). * * Uses the same resolveMkdocsCommand() resolution as every other mkdocs * spawn so preflight and the actual serve/build invocation agree on exactly * which binary is being run. */ export declare function mkdocsPreflight(): Promise; export interface MkdocsWorkspaceOpts { siteName?: string; } export interface MkdocsWorkspaceResult { configPath: string; docsDir: string; } /** * Write a disposable `site-docs/mkdocs.yml` under `storeDir`. * The `docs_dir` key points at the resolved `artifacts/` directory. * * IMPORTANT: this function writes NOTHING under `artifacts/`. * A generated file there would break `acs validate` (schema + task-first * path checks walk every .md under artifacts/). */ export declare function generateMkdocsWorkspace(storeDir: string, opts?: MkdocsWorkspaceOpts): Promise; export interface HandleSiteDocsOptions { /** Generate the workspace and run `mkdocs build`, then exit (no server). */ buildOnly: boolean; /** Bind host for `mkdocs serve` (already validated by the caller). */ host: string; /** Port for `mkdocs serve` (already validated; never 0). */ port: number; /** Forward `--open` to `mkdocs serve` so it opens the browser (serve only). */ open: boolean; /** Resolved store directory (caller reads it from getStoreInfo). */ storeDir: string; } /** * Handle `acs site docs`. * * All flag parsing, host validation, port validation and store resolution are * done by the caller (index.ts) and passed in as a plain options object. This * keeps docs.ts free of any dependency on index.ts and ensures `--host` flows * through the shared `validateHost` guard before it reaches a shell spawn. * * Returns a Promise that resolves when the docs engine is done (either * `--build-only` finishes or `mkdocs serve` exits / SIGINT is received). * Rejects if `mkdocs serve` exits with a non-zero code that was NOT caused * by our own SIGINT-triggered kill (see runMkdocsServe). */ export declare function handleSiteDocs(opts: HandleSiteDocsOptions): Promise; /** * Spawn `mkdocs serve` (foreground) and forward output with a `[docs]` prefix. * Wires SIGINT to kill the child and removes the listener on the child's own * exit so no listener leaks (which would otherwise try to kill an already-dead * child on a later SIGINT). * * When `open` is set, `--open` is forwarded to mkdocs so it opens the browser. * * Returns a Promise that resolves when the child exits with code 0 OR when * our own SIGINT handler killed it intentionally (a Windows-killed shell * child commonly reports exit code 1, which must NOT be treated as a real * failure). Rejects (throws) when the child exits non-zero for any other * reason — e.g. the configured port is already bound, or a broken config — * mirroring runMkdocsBuild's behavior so main()'s catch sets exit code 1 * instead of silently exiting 0. */ export declare function runMkdocsServe(configPath: string, host: string, port: number, open: boolean): Promise; /** * Spawn `mkdocs build` and await completion. */ export declare function runMkdocsBuild(configPath: string, outputDir: string): Promise; /** * Start `mkdocs serve` in the background (for both-engines mode). * Returns a handle with `kill()` and `waitForExit()` so the caller can tear it * down and observe the child's liveness. * * The function does NOT await the child — it starts it and returns immediately * so the caller can print the combined banner and await SIGINT. The caller is * responsible for consuming `waitForExit()` to detect an immediate crash. */ export declare function startMkdocsServe(configPath: string, host: string, port: number): MkdocsHandle;