(context)
| 89 | } |
| 90 | |
| 91 | async function startProjectService(context) { |
| 92 | const config = vscode.workspace.getConfiguration("simdeck"); |
| 93 | const cliPath = resolveCliPath(context, config.get("cliPath", "")); |
| 94 | const port = String(config.get("port", 4311)); |
| 95 | const bindAddress = config.get("bindAddress", "127.0.0.1"); |
| 96 | const args = ["service", "start", "--port", port, "--bind", bindAddress]; |
| 97 | |
| 98 | outputChannel.appendLine(`Starting SimDeck project service using ${cliPath}`); |
| 99 | const result = await runCli(context, cliPath, args); |
| 100 | outputChannel.append(result.stderr); |
| 101 | |
| 102 | const deadline = Date.now() + 15000; |
| 103 | const metadata = parseJsonOutput(result.stdout, "simdeck service start"); |
| 104 | const serviceUrl = metadata.url; |
| 105 | if (typeof serviceUrl !== "string" || serviceUrl.length === 0) { |
| 106 | throw new Error("simdeck service start did not return a service URL."); |
| 107 | } |
| 108 | |
| 109 | while (Date.now() < deadline) { |
| 110 | if (await isServerHealthy(serviceUrl)) { |
| 111 | outputChannel.appendLine(`SimDeck service ready at ${serviceUrl}`); |
| 112 | return serviceUrl; |
| 113 | } |
| 114 | await delay(250); |
| 115 | } |
| 116 | |
| 117 | throw new Error(`Timed out waiting for SimDeck at ${serviceUrl}.`); |
| 118 | } |
| 119 | |
| 120 | async function stopProjectService(context) { |
| 121 | const config = vscode.workspace.getConfiguration("simdeck"); |
no test coverage detected