| @@ -606,6 +606,26 @@ const renderStatus = (status: LocalServerStatus): string => · 605 unmodified lines |
| 606 | `workspaceId: ${status.installation?.workspaceId ?? "unavailable"}`, | 606 | `workspaceId: ${status.installation?.workspaceId ?? "unavailable"}`, |
| 607 | ].join("\n"); | 607 | ].join("\n"); |
| 608 | | 608 | |
| | 609 | const appendUrlPath = (baseUrl: string, pathname: string): string => |
| | 610 | new URL(pathname, baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`).toString(); |
| | 611 | |
| | 612 | const renderUpSummary = (input: { |
| | 613 | started: boolean; |
| | 614 | status: LocalServerStatus; |
| | 615 | }): string => |
| | 616 | [ |
| | 617 | input.started ? "Executor is ready." : "Executor is already running.", |
| | 618 | `API: ${input.status.baseUrl}`, |
| | 619 | `MCP: ${appendUrlPath(input.status.baseUrl, "mcp")}`, |
| | 620 | `OpenAPI: ${appendUrlPath(input.status.baseUrl, "v1/openapi.json")}`, |
| | 621 | `Workspace: ${input.status.installation?.workspaceId ?? "unavailable"}`, |
| | 622 | "", |
| | 623 | "Try next:", |
| | 624 | ` ${CLI_NAME} call 'return 1 + 1'`, |
| | 625 | ` ${CLI_NAME} status`, |
| | 626 | ` ${CLI_NAME} down`, |
| | 627 | ].join("\n"); |
| | 628 | |
| 609 | const getDoctorReport = (baseUrl: string) => | 629 | const getDoctorReport = (baseUrl: string) => |
| 610 | getServerStatus(baseUrl).pipe( | 630 | getServerStatus(baseUrl).pipe( |
| 611 | Effect.map((status) => { | 631 | Effect.map((status) => { |
| @@ -696,7 +716,9 @@ const ensureServer = (baseUrl: string = DEFAULT_SERVER_BASE_URL) => · 84 unmodified lines |
| 696 | Effect.gen(function* () { | 716 | Effect.gen(function* () { |
| 697 | const reachable = yield* isServerReachable(baseUrl); | 717 | const reachable = yield* isServerReachable(baseUrl); |
| 698 | if (reachable) { | 718 | if (reachable) { |
| 699 | return; | 719 | return { |
| | 720 | started: false, |
| | 721 | } as const; |
| 700 | } | 722 | } |
| 701 | | 723 | |
| 702 | const url = new URL(baseUrl); | 724 | const url = new URL(baseUrl); |
| @@ -704,6 +726,10 @@ const ensureServer = (baseUrl: string = DEFAULT_SERVER_BASE_URL) => · 1 unmodified line |
| 704 | yield* startServerInBackground(port); | 726 | yield* startServerInBackground(port); |
| 705 | | 727 | |
| 706 | yield* waitForReachability(baseUrl, true); | 728 | yield* waitForReachability(baseUrl, true); |
| | 729 | |
| | 730 | return { |
| | 731 | started: true, |
| | 732 | } as const; |
| 707 | }); | 733 | }); |
| 708 | | 734 | |
| 709 | | 735 | |
| @@ -1142,10 +1168,13 @@ const upCommand = Command.make( · 432 unmodified lines |
| 1142 | }, | 1168 | }, |
| 1143 | ({ baseUrl }) => | 1169 | ({ baseUrl }) => |
| 1144 | ensureServer(baseUrl).pipe( | 1170 | ensureServer(baseUrl).pipe( |
| 1145 | Effect.zipRight(getServerStatus(baseUrl)), | 1171 | Effect.flatMap(({ started }) => |
| 1146 | Effect.flatMap((status) => printText(renderStatus(status))), | 1172 | getServerStatus(baseUrl).pipe( |
| | 1173 | Effect.flatMap((status) => printText(renderUpSummary({ started, status }))), |
| | 1174 | ) |
| | 1175 | ), |
| 1147 | ), | 1176 | ), |
| 1148 | ).pipe(Command.withDescription("Ensure the local executor server is running")); | 1177 | ).pipe(Command.withDescription("Start the local executor server if needed and show how to use it")); |
| 1149 | | 1178 | |
| 1150 | const downCommand = Command.make( | 1179 | const downCommand = Command.make( |
| 1151 | "down", | 1180 | "down", |