@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 27 lines 1.03 KB
Raw
1 import type { AcpRegistrySettings } from "../settings.ts";
2
3 // AcpRegistrySupport.validateLocalExecutable refuses .cmd/.bat on Windows, so only native
4 // executables are launchable.
5 const COMMAND_CODE_EXECUTABLES = /^(?:cmdc|command-code|commandcode)(?:\.exe)?$/iu;
6 const COMMAND_CODE_ENTRY_POINTS = [
7 /(?:^|[\\/])node_modules[\\/]command-code[\\/]/iu,
8 /(?:^|[\\/])command-code[\\/]dist[\\/](?:index|cli)\.mjs$/iu,
9 ];
10
11 /**
12 * Agents that take T3's MCP endpoint over ACP HTTP: Command Code cannot start the stdio
13 * bridge on Windows, where it spawns MCP commands through cmd.exe and the unquoted T3
14 * executable path splits at the space.
15 */
16 export function prefersHttpMcpTransport(settings: AcpRegistrySettings): boolean {
17 if (settings.source !== "local") {
18 return false;
19 }
20 const executable = settings.commandPath.split(/[\\/]/u).pop() ?? "";
21 return (
22 COMMAND_CODE_EXECUTABLES.test(executable) ||
23 settings.commandArgs.some((argument) =>
24 COMMAND_CODE_ENTRY_POINTS.some((pattern) => pattern.test(argument)),
25 )
26 );
27 }