( bridge: BridgeConfig | undefined, commandOverride?: string | null, session?: string, axsBinary = DEFAULT_AXS_BINARY, )
| 11 | } |
| 12 | |
| 13 | export 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 | |
| 51 | export function getAxsBridgeStatusUrl(webSocketUrl: string): string { |
| 52 | return webSocketUrl |
no test coverage detected