| @@ -606,6 +606,26 @@ const renderStatus = (status: LocalServerStatus): string => · 605 unmodified lines |
| 606 | 606 | `workspaceId: ${status.installation?.workspaceId ?? "unavailable"}`, |
| 607 | 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 | 629 | const getDoctorReport = (baseUrl: string) => |
| 610 | 630 | getServerStatus(baseUrl).pipe( |
| 611 | 631 | Effect.map((status) => { |
| @@ -696,7 +716,9 @@ const ensureServer = (baseUrl: string = DEFAULT_SERVER_BASE_URL) => · 84 unmodified lines |
| 696 | 716 | Effect.gen(function* () { |
| 697 | 717 | const reachable = yield* isServerReachable(baseUrl); |
| 698 | 718 | if (reachable) { |
| 699 | | − return; |
| 719 | + return { |
| 720 | + started: false, |
| 721 | + } as const; |
| 700 | 722 | } |
| 701 | 723 | |
| 702 | 724 | const url = new URL(baseUrl); |
| @@ -704,6 +726,10 @@ const ensureServer = (baseUrl: string = DEFAULT_SERVER_BASE_URL) => · 1 unmodified line |
| 704 | 726 | yield* startServerInBackground(port); |
| 705 | 727 | |
| 706 | 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 | 1169 | ({ baseUrl }) => |
| 1144 | 1170 | ensureServer(baseUrl).pipe( |
| 1145 | | − Effect.zipRight(getServerStatus(baseUrl)), |
| 1146 | | − Effect.flatMap((status) => printText(renderStatus(status))), |
| 1171 | + Effect.flatMap(({ started }) => |
| 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 | 1179 | const downCommand = Command.make( |
| 1151 | 1180 | "down", |