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

Function resolveSidecarCommand

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

Source from the content-addressed store, hash-verified

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

Callers 1

startSidecarFunction · 0.85

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected