Cell API
    Preparing search index...

    Interface CellAPI

    What a toolchain module gets (docs/design/modules.md §3.1). The factory only registers: it does not start processes, servers, watchers or timers (those belong after dev:ready, closed on close), because factories also run for cell info.

    interface CellAPI {
        ci: boolean;
        command: string;
        components: readonly CellComponent[];
        dev: boolean;
        events: {
            emit(name: string, payload?: unknown): Promise<void>;
            on(name: string, handler: (payload: unknown) => unknown): () => void;
        };
        logger: CellLogger;
        mode: readonly string[];
        preset: string
        | undefined;
        root: string;
        addCheck(check: CheckDefinition): void;
        addConfigSchema(key: string, schema: StandardSchema): void;
        addDevHandler(path: string, handler: DevHandler): void;
        addDocs(dir: string): void;
        addMcpTool(tool: McpToolDefinition): void;
        addOutputFile(
            path: string,
            content: string | Uint8Array<ArrayBufferLike>,
        ): void;
        addPreset(preset: Preset): void;
        addRuntimeModule(
            path: string,
            options: { static?: boolean; target: Target },
        ): void;
        addVirtualModule(id: string, code: string | (() => string)): void;
        addVitePlugin(
            plugin: VitePluginLike,
            options?: { env?: "client" | "server" },
        ): void;
        addWatchFile(path: string): void;
        exec(
            command: string,
            args?: string[],
            options?: { cwd?: string; signal?: AbortSignal; timeout?: number },
        ): Promise<{ code: number; stderr: string; stdout: string }>;
        on(
            event:
                | "modules:done"
                | "config:resolved"
                | "dev:ready"
                | "dev:reload"
                | "build:before"
                | "build:done"
                | "output:done"
                | "deploy:before"
                | "deploy:plan"
                | "deploy:done"
                | "close",
            handler: (event: any) => unknown,
        ): () => void;
        options<T extends object>(key: string, defaults?: T): T;
        resolve(specifier: string): string;
        setEntry(target: Target, path: string): void;
        updateConfig(
            partial: {
                build?: { external?: string[] };
                vite?: Record<string, unknown>;
            },
        ): void;
    }
    Index
    ci: boolean
    command: string

    The command: dev, build, info, ...

    components: readonly CellComponent[]
    dev: boolean
    events: {
        emit(name: string, payload?: unknown): Promise<void>;
        on(name: string, handler: (payload: unknown) => unknown): () => void;
    }

    A bus between modules, for events of their own.

    logger: CellLogger
    mode: readonly string[]
    preset: string | undefined

    Name of the preset chosen by flag, cell.config.ts or CELL_PRESET; the resolved preset is in config:resolved.

    root: string
    • Writes a file into the output directory after the build (path relative to it).

      Parameters

      • path: string
      • content: string | Uint8Array<ArrayBufferLike>

      Returns void

    • Adds a DI module (a file path or package specifier) to a target, after the components' own.

      Parameters

      • path: string
      • options: { static?: boolean; target: Target }

      Returns void

    • Serves code as the module id (e.g. virtual:my-module) in both environments.

      Parameters

      • id: string
      • code: string | (() => string)

      Returns void

    • Adds a Vite plugin to every environment, or only to client (frontend) or server (backend).

      Parameters

      • plugin: VitePluginLike
      • Optionaloptions: { env?: "client" | "server" }

      Returns void

    • Runs a program without a shell.

      Parameters

      • command: string
      • Optionalargs: string[]
      • Optionaloptions: { cwd?: string; signal?: AbortSignal; timeout?: number }

      Returns Promise<{ code: number; stderr: string; stdout: string }>

    • Subscribes to a toolchain event; returns the function that unsubscribes.

      Parameters

      • event:
            | "modules:done"
            | "config:resolved"
            | "dev:ready"
            | "dev:reload"
            | "build:before"
            | "build:done"
            | "output:done"
            | "deploy:before"
            | "deploy:plan"
            | "deploy:done"
            | "close"
      • handler: (event: any) => unknown

      Returns () => void

    • The key field of cell.config.ts merged over defaults; claims the field. Only during the factory.

      Type Parameters

      • T extends object

      Parameters

      • key: string
      • Optionaldefaults: T

      Returns T

    • Resolves a module specifier from the project root.

      Parameters

      • specifier: string

      Returns string

    • Adds to the toolchain configuration, only during the factory: external packages join the project's, vite is merged under the project's vite field (the project wins). Application configuration stays in cell.yml (docs/design/agent-first.md R1): a component ships its defaults in its own cell.yml.

      Parameters

      • partial: { build?: { external?: string[] }; vite?: Record<string, unknown> }

      Returns void