MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / resolveSidecarCommand

Function resolveSidecarCommand

apps/desktop/src/main/sidecar.ts:175–208  ·  view source on GitHub ↗
(input: {
  readonly port: number;
  readonly hostname: string;
  readonly authToken: string;
})

Source from the content-addressed store, hash-verified

173};
174
175const resolveSidecarCommand = (input: {
176 readonly port: number;
177 readonly hostname: string;
178 readonly authToken: string;
179}): { command: string; args: string[]; cwd: string; cliManagedManifest: boolean } => {
180 if (app.isPackaged) {
181 const binaryName = process.platform === "win32" ? "executor.exe" : "executor";
182 const binaryPath = join(process.resourcesPath, "executor", binaryName);
183 return {
184 command: binaryPath,
185 args: [
186 "daemon",
187 "run",
188 "--foreground",
189 "--port",
190 String(input.port),
191 "--hostname",
192 input.hostname,
193 // Combined `--flag=value` form: the auth token is base64url and can
194 // start with "-", which the space-separated form makes the CLI parser
195 // read as an unknown flag, so the daemon prints help and exits and the
196 // desktop reports a fatal "server crashed during startup". Persistent
197 // until the token rotates, and cross-platform (~1 in 64 fresh installs).
198 `--auth-token=${input.authToken}`,
199 ],
200 cwd: process.resourcesPath,
201 cliManagedManifest: true,
202 };
203 }
204 // Dev: run the TS source directly via bun on PATH.
205 const repoRoot = resolve(import.meta.dirname, "..", "..", "..", "..");
206 const sidecarSource = resolve(repoRoot, "apps/desktop/src/sidecar/server.ts");
207 return { command: "bun", args: ["run", sidecarSource], cwd: repoRoot, cliManagedManifest: false };
208};
209
210const resolveClientDir = (): string => {
211 const repoRoot = resolve(import.meta.dirname, "..", "..", "..", "..");

Callers 1

startSidecarFunction · 0.85

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected