Files
cline/apps/cli/script/dashboard-runtime.ts
T
2377a20973 fix(core): load embedded plugin and dashboard resources (#15080)
* fix(core): load embedded plugin and dashboard resources

* fix(core): isolate subprocess Bun mode and retain system CA trust

* fix(core): load compiled plugin resources directly from bunfs

* test(desktop): compare native paths and tolerate Hub cleanup on Windows

The standalone plugin test compared the child's process.execPath to
realpathSync(cli), which keeps Windows 8.3 short names (RUNNER~1) while the
child reports the long path. Use realpathSync.native. The dashboard test's
cleanup could hit EBUSY while the stopped Hub released its cwd; retry it like
the startup scenario cleanup does.

Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>

* fix(core): package every declared SDK runtime export

---------

Co-authored-by: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com>
Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>
2026-10-19 15:37:08 -07:00

21 lines
728 B
TypeScript

import { existsSync } from "node:fs";
import { join, resolve } from "node:path";
import { $ } from "bun";
let directory: Promise<string> | undefined;
/** Build once per platform-build invocation; the compiler embeds this tree unchanged. */
export function buildDashboardRuntimeDirectory(): Promise<string> {
directory ??= buildDirectory();
return directory;
}
async function buildDirectory(): Promise<string> {
const root = resolve(import.meta.dir, "../../..");
await $`bun -F @cline/cline-hub build:webview`.cwd(root).quiet();
const directory = join(root, "apps/cline-hub/dist/webview");
if (!existsSync(join(directory, "index.html")))
throw new Error("Dashboard build produced no index.html");
return directory;
}