( args: Record<string, any>, options: Record<string, any>, )
| 12 | * @param options Command options |
| 13 | */ |
| 14 | export async function apiCommand( |
| 15 | args: Record<string, any>, |
| 16 | options: Record<string, any>, |
| 17 | ): Promise<void> { |
| 18 | try { |
| 19 | const port = options.port ? parseInt(options.port, 10) : 3001; |
| 20 | |
| 21 | // Server startup will be logged in the mcpServer module |
| 22 | |
| 23 | // Start the MCP HTTP API server |
| 24 | await startMCPServer({ |
| 25 | port, |
| 26 | model: options.model, |
| 27 | mode: options.mode as "automatic" | "semi" | "manual" | "custom" | "interactive", |
| 28 | diffMode: options.diffMode as "file" | "function", |
| 29 | processing: options.processing as "sequential" | "parallel" | "concurrent" | "swarm", |
| 30 | configPath: options.config, |
| 31 | }); |
| 32 | |
| 33 | // Keep the process running |
| 34 | await new Promise(() => { |
| 35 | // This promise never resolves, keeping the process alive |
| 36 | console.log(`SPARC2 API server running on http://localhost:${port}`); |
| 37 | console.log("Press Ctrl+C to stop the server"); |
| 38 | }); |
| 39 | } catch (error: unknown) { |
| 40 | const errorMessage = error instanceof Error ? error.message : String(error); |
| 41 | console.error(`Error starting API server: ${errorMessage}`); |
| 42 | Deno.exit(1); |
| 43 | } |
| 44 | } |
nothing calls this directly
no test coverage detected