FullStacked

run

import run from "fullstacked/run";

Starts another project in a new context: its own root directory, environment, working directory and streams. The caller then opens it in a window. This is how the FullStacked app’s shell launches projects, and how the CLI opens a project after bundling it.

run(directory?: string): Promise<number>
run(options?: { directory?: string; env?: Record<string, string>; safe?: boolean }): Promise<number>

It resolves with the new context id. run doesn’t bundle and doesn’t open a window. Do both yourself:

import bundle from "fullstacked/bundle";
import run from "fullstacked/run";

const result = await bundle.bundle("/projects/todo");
if (result.Errors.length === 0) {
    const ctx = await run({
        directory: "/projects/todo",
        env: { API_URL: "https://…" }
    });
    globalThis.fullstacked.open?.(ctx); // GET /open?ctx=<id>: the host opens a window
}

What open does depends on the host:

The window loads the new context’s index.html, which is out/index.html after a bundle.

A context lives until its window closes or it calls process.exit(). When it ends, the core closes all its streams (sockets, file reads, fetches).