@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 28 lines 1.1 KB
Raw
1 import { type LauncherOptions, main as runServiceLauncher } from "../serviceLauncher.ts";
2
3 /** The flags a Windows task passes, parsed here so the launcher starts without the full CLI. */
4 export function parseServiceLauncherArgs(args: ReadonlyArray<string>): LauncherOptions | undefined {
5 let baseDir: string | undefined;
6 let logFile: string | undefined;
7 let serviceUnit: string | undefined;
8 for (let index = 0; index < args.length; index += 2) {
9 const flag = args[index];
10 const value = args[index + 1];
11 if (value === undefined) return undefined;
12 if (flag === "--base-dir") baseDir = value;
13 else if (flag === "--log-file") logFile = value;
14 else if (flag === "--service-unit") serviceUnit = value;
15 else return undefined;
16 }
17 return { baseDir, logFile, serviceUnit };
18 }
19
20 export async function runServiceLauncherCli(options?: LauncherOptions): Promise<void> {
21 try {
22 await runServiceLauncher(options);
23 } catch (cause) {
24 const message = cause instanceof Error ? cause.message : String(cause);
25 process.stderr.write(`[service-launcher] ${message}\n`);
26 process.exitCode = 1;
27 }
28 }