fix(cli): restore arguments on the desktop executable (#11363)

The bundled CLI build stopped emitting the runCli module that Electron imports for direct CLI calls. Build that module alongside the standalone CLI and include it in the Nix desktop trace.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
This commit is contained in:
paseo-bot[bot]
2026-11-30 00:42:52 +00:00
committed by GitHub
parent d059fcfd10
commit 95a90f5259
3 changed files with 22 additions and 2 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
// Bundles @getpaseo/cli into a thin ESM entrypoint plus lazy code-split command chunks.
// Bundles @getpaseo/cli into thin ESM entrypoints plus lazy code-split command chunks.
// Keeps @getpaseo/server/daemon-files bundled for zero-Zod thin RPC startup while leaving
// @getpaseo/server and its heavy subpaths external so daemon spawning and heavy commands
// resolve from the installed @getpaseo/server package.
@@ -29,6 +29,8 @@ await rm(outDir, { recursive: true, force: true });
await build({
entryPoints: {
index: path.join(packageRoot, "src/index.ts"),
// Electron imports runCli to supply its own argv and handle the exit code.
run: path.join(packageRoot, "src/run.ts"),
},
outdir: outDir,
bundle: true,
+18 -1
View File
@@ -1,7 +1,7 @@
import { existsSync, readFileSync } from "node:fs";
import { spawnSync } from "node:child_process";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { fileURLToPath, pathToFileURL } from "node:url";
import { build, type Metafile } from "esbuild";
import { describe, expect, it } from "vitest";
@@ -110,6 +110,23 @@ describe("CLI startup import boundary", () => {
const distEntry = path.join(packageRoot, "dist/index.js");
it.skipIf(!existsSync(distEntry))(
"bundled CLI exposes a programmatic entry for desktop passthrough",
() => {
const runnerUrl = pathToFileURL(path.join(packageRoot, "dist/run.js")).href;
const script = `
import { runCli } from ${JSON.stringify(runnerUrl)};
process.exitCode = await runCli(["--help"]);
`;
const run = spawnSync(process.execPath, ["--input-type=module", "-e", script], {
encoding: "utf8",
});
expect(run.status, run.stderr).toBe(0);
expect(run.stdout).toContain("Usage: paseo");
},
);
it.skipIf(!existsSync(distEntry))(
"bundled dist/index.js serves --version without loading heavy modules at runtime",
() => {
+1
View File
@@ -164,6 +164,7 @@ async function main() {
...(traceDesktop
? [
["packages/desktop/dist/daemon/runtime-paths.js", ["@getpaseo/server"]],
["packages/desktop/dist/daemon/cli/entrypoints.js", ["@getpaseo/cli/dist/run.js"]],
["packages/desktop/dist/integrations/cli-install/paths.js", ["@getpaseo/cli/bin/paseo"]],
]
: []),