MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / buildAxsBridgeCommand

Function buildAxsBridgeCommand

src/cm/lsp/runtimes/axsBridge.ts:13–49  ·  view source on GitHub ↗
(
	bridge: BridgeConfig | undefined,
	commandOverride?: string | null,
	session?: string,
	axsBinary = DEFAULT_AXS_BINARY,
)

Source from the content-addressed store, hash-verified

11}
12
13export function buildAxsBridgeCommand(
14 bridge: BridgeConfig | undefined,
15 commandOverride?: string | null,
16 session?: string,
17 axsBinary = DEFAULT_AXS_BINARY,
18): string | null {
19 if (!bridge || bridge.kind !== "axs") return null;
20
21 const binary =
22 commandOverride || bridge.command
23 ? String(commandOverride || bridge.command)
24 : (() => {
25 throw new Error("Bridge requires a command to execute");
26 })();
27 const args: string[] = Array.isArray(bridge.args)
28 ? bridge.args.map((arg) => String(arg))
29 : [];
30 const effectiveSession = session || bridge.session || binary;
31 const parts = [axsBinary, "lsp", "--session", quoteArg(effectiveSession)];
32
33 if (
34 typeof bridge.port === "number" &&
35 bridge.port > 0 &&
36 bridge.port <= 65535
37 ) {
38 parts.push("--port", String(bridge.port));
39 }
40
41 parts.push(quoteArg(binary));
42
43 if (args.length) {
44 parts.push("--");
45 args.forEach((arg) => parts.push(quoteArg(arg)));
46 }
47
48 return parts.join(" ");
49}
50
51export function getAxsBridgeStatusUrl(webSocketUrl: string): string {
52 return webSocketUrl

Callers 1

resolveStartCommandFunction · 0.90

Calls 2

quoteArgFunction · 0.90
StringInterface · 0.85

Tested by

no test coverage detected