diff --git a/src/cli/gateway.sigterm.test.ts b/src/cli/gateway.sigterm.test.ts index cd89b691d..9ec5d929c 100644 --- a/src/cli/gateway.sigterm.test.ts +++ b/src/cli/gateway.sigterm.test.ts @@ -98,13 +98,7 @@ describe("gateway SIGTERM", () => { child.stdout?.on("data", (d) => out.push(String(d))); child.stderr?.on("data", (d) => err.push(String(d))); - await waitForPortOpen( - proc, - out, - err, - port, - 20_000, - ); + await waitForPortOpen(proc, out, err, port, 20_000); proc.kill("SIGTERM"); diff --git a/src/cli/program.ts b/src/cli/program.ts index 25d577305..a0084284c 100644 --- a/src/cli/program.ts +++ b/src/cli/program.ts @@ -11,13 +11,13 @@ import { browserTabs, resolveBrowserControlUrl, } from "../browser/client.js"; -import { runClawdisMac } from "../infra/clawdis-mac.js"; import { agentCommand } from "../commands/agent.js"; import { healthCommand } from "../commands/health.js"; import { sendCommand } from "../commands/send.js"; import { sessionsCommand } from "../commands/sessions.js"; import { statusCommand } from "../commands/status.js"; import { danger, info, setVerbose } from "../globals.js"; +import { runClawdisMac } from "../infra/clawdis-mac.js"; import { loginWeb, logoutWeb } from "../provider-web.js"; import { defaultRuntime } from "../runtime.js"; import { VERSION } from "../version.js"; @@ -230,9 +230,8 @@ Examples: .description("macOS UI automation via Clawdis.app (PeekabooBridge)") .option("--json", "Output JSON (passthrough from clawdis-mac)", false) .allowUnknownOption(true) - .passThroughOptions() .argument( - "", + "[uiArgs...]", "Args passed through to: clawdis-mac ui ...", ) .addHelpText( @@ -247,9 +246,15 @@ Examples: clawdis ui --json see --bundle-id com.apple.Safari `, ) - .action(async (uiArgs: string[], opts) => { + .action(async (_unused: string[], opts, cmd) => { try { - const res = await runClawdisMac(["ui", ...uiArgs], { + const raw = (cmd.parent?.rawArgs ?? []).map((a: unknown) => String(a)); + const idx = raw.indexOf("ui"); + const tail = idx >= 0 ? raw.slice(idx + 1) : []; + const forwarded = + tail.length > 0 && tail[0] === "--json" ? tail.slice(1) : tail; + + const res = await runClawdisMac(["ui", ...forwarded], { json: Boolean(opts.json), timeoutMs: 45_000, }); diff --git a/src/infra/clawdis-mac.ts b/src/infra/clawdis-mac.ts index 76a8895c7..4417efc8f 100644 --- a/src/infra/clawdis-mac.ts +++ b/src/infra/clawdis-mac.ts @@ -63,4 +63,3 @@ export async function runClawdisMac( const res = await runCommandWithTimeout(argv, opts?.timeoutMs ?? 30_000); return { stdout: res.stdout, stderr: res.stderr, code: res.code }; } -