fix(desktop): restore packaged terminal hooks

The desktop daemon resolved the CLI through a packaged module entrypoint that is not an executable outside the archive. Publish the existing bundled shim as the daemon's authoritative CLI path so terminal hooks use a callable command.
This commit is contained in:
Mohamed Boudra
2026-07-21 17:55:13 +02:00
parent 0707092131
commit ee431bb340
9 changed files with 39 additions and 17 deletions
@@ -3,6 +3,7 @@ import { mkdirSync, rmSync, writeFileSync } from "node:fs";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { DEFAULT_DESKTOP_SETTINGS } from "../settings/desktop-settings";
import { getBundledCliShimPath } from "../integrations/cli-install";
import { createDaemonCommandHandlers } from "./daemon-manager";
const mocks = vi.hoisted(() => ({
@@ -451,7 +452,10 @@ describe("daemon-manager commands", () => {
expect.objectContaining({
detached: true,
stdio: ["ignore", "ignore", "ignore"],
envOverlay: expect.objectContaining({ PASEO_WEB_UI_ENABLED: "false" }),
envOverlay: expect.objectContaining({
PASEO_CLI: getBundledCliShimPath(),
PASEO_WEB_UI_ENABLED: "false",
}),
}),
);
});
+10 -2
View File
@@ -18,7 +18,11 @@ import {
type AppUpdateCheckIntent,
type AppReleaseChannel,
} from "../features/auto-updater.js";
import { getCliInstallStatus, installCli } from "../integrations/cli-install/index.js";
import {
getBundledCliShimPath,
getCliInstallStatus,
installCli,
} from "../integrations/cli-install/index.js";
import {
getSkillsStatus,
installSkills,
@@ -413,7 +417,11 @@ async function startDaemon(): Promise<DesktopDaemonStatus> {
detached: true,
envMode: "internal",
env: invocation.env,
envOverlay: { PASEO_DESKTOP_MANAGED: "1", PASEO_WEB_UI_ENABLED: "false" },
envOverlay: {
PASEO_DESKTOP_MANAGED: "1",
PASEO_CLI: getBundledCliShimPath(),
PASEO_WEB_UI_ENABLED: "false",
},
stdio: ["ignore", "ignore", "ignore"],
});
@@ -52,7 +52,7 @@ function createFakeMacBundle(options: { includeHelper: boolean }): {
helperPath,
[
"#!/bin/sh",
'printf "helper env=%s/%s\\n" "$ELECTRON_RUN_AS_NODE" "$PASEO_NODE_ENV"',
'printf "helper env=%s/%s cli=%s\\n" "$ELECTRON_RUN_AS_NODE" "$PASEO_NODE_ENV" "$PASEO_CLI"',
'printf "args=%s\\n" "$*"',
"",
].join("\n"),
@@ -114,7 +114,7 @@ describe("desktop packaging", () => {
const result = spawnSync(bundle.shimPath, ["--version"], { encoding: "utf8" });
expect(result.status).toBe(0);
expect(result.stdout).toContain("helper env=1/production");
expect(result.stdout).toContain(`helper env=1/production cli=${bundle.shimPath}`);
expect(result.stdout).toContain("node-entrypoint-runner.js");
expect(result.stdout).toContain("node-script");
expect(result.stdout).toContain("@getpaseo/cli/dist/index.js");
@@ -1 +1,2 @@
export { getCliInstallStatus, installCli } from "./install.js";
export { getBundledCliShimPath } from "./paths.js";