Skip to content

Commit 33b2590

Browse files
ccdclaude
andcommitted
feat: a2a-bridge acp --url flag for daemon address
New --url / -u flag passes the daemon control-plane URL directly as a CLI argument, removing the need for env vars: a2a-bridge acp --url ws://1.2.3.4:4512/ws a2a-bridge acp --url ws://1.2.3.4:4512/ws -p "hi" Works with openclaw acp client: openclaw acp client --server "a2a-bridge" --server-args "acp --url ws://1.2.3.4:4512/ws" Precedence: --url flag > A2A_BRIDGE_CONTROL_URL env > default localhost. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 879defc commit 33b2590

1 file changed

Lines changed: 32 additions & 5 deletions

File tree

src/cli/acp.ts

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,21 @@ export async function runAcp(
4545
args: string[],
4646
options: RunAcpOptions = {},
4747
): Promise<AcpInboundService | void> {
48+
// Parse CLI flags from args
49+
const parsed = parseAcpArgs(args);
50+
51+
// --url flag overrides the control WS URL (takes precedence over env)
52+
if (parsed.url) {
53+
options = { ...options, controlWsUrl: parsed.url };
54+
}
55+
4856
// One-shot prompt mode: a2a-bridge acp -p "hello" / --prompt "hello"
49-
const promptIdx = args.findIndex((a) => a === "-p" || a === "--prompt");
50-
if (promptIdx !== -1) {
51-
const text = args[promptIdx + 1];
52-
if (!text) {
57+
if (parsed.prompt !== undefined) {
58+
if (!parsed.prompt) {
5359
console.error("Usage: a2a-bridge acp -p <prompt>");
5460
process.exit(1);
5561
}
56-
return runOneShotPrompt(text, options);
62+
return runOneShotPrompt(parsed.prompt, options);
5763
}
5864

5965
const stdio = options.stdio ?? defaultStdio();
@@ -64,6 +70,27 @@ export async function runAcp(
6470
return service;
6571
}
6672

73+
function parseAcpArgs(args: string[]): {
74+
prompt?: string;
75+
url?: string;
76+
} {
77+
let prompt: string | undefined;
78+
let url: string | undefined;
79+
80+
for (let i = 0; i < args.length; i++) {
81+
const arg = args[i];
82+
if ((arg === "-p" || arg === "--prompt") && i + 1 < args.length) {
83+
prompt = args[++i] ?? "";
84+
} else if ((arg === "--url" || arg === "-u") && i + 1 < args.length) {
85+
url = args[++i];
86+
} else if (arg?.startsWith("--url=")) {
87+
url = arg.slice(6);
88+
}
89+
}
90+
91+
return { prompt, url };
92+
}
93+
6794
/**
6895
* One-shot mode: connect to daemon, send one prompt, print the reply,
6996
* exit. Useful for smoke-testing the bridge from the command line.

0 commit comments

Comments
 (0)