| @@ -538,8 +538,14 @@ type LocalServerStatus = { · 537 unmodified lines |
| 538 | accountId: string; | 538 | accountId: string; |
| 539 | workspaceId: string; | 539 | workspaceId: string; |
| 540 | } | null; | 540 | } | null; |
| | 541 | denoVersion: string | null; |
| 541 | }; | 542 | }; |
| 542 | | 543 | |
| | 544 | const renderDenoSandboxDetail = (denoVersion: string | null): string => |
| | 545 | denoVersion !== null |
| | 546 | ? `deno ${denoVersion}` |
| | 547 | : "deno not found (run `executor sandbox` to install)"; |
| | 548 | |
| 543 | const getServerStatus = (baseUrl: string): Effect.Effect<LocalServerStatus, Error, never> => | 549 | const getServerStatus = (baseUrl: string): Effect.Effect<LocalServerStatus, Error, never> => |
| 544 | Effect.gen(function* () { | 550 | Effect.gen(function* () { |
| 545 | const pidRecord = yield* readPidRecord(); | 551 | const pidRecord = yield* readPidRecord(); |
| @@ -554,6 +560,7 @@ const getServerStatus = (baseUrl: string): Effect.Effect<LocalServerStatus, Erro · 8 unmodified lines |
| 554 | const pid = typeof pidRecord?.pid === "number" ? pidRecord.pid : null; | 560 | const pid = typeof pidRecord?.pid === "number" ? pidRecord.pid : null; |
| 555 | const pidRunning = pid !== null ? isPidRunning(pid) : false; | 561 | const pidRunning = pid !== null ? isPidRunning(pid) : false; |
| 556 | const logFile = pidRecord?.logFile ?? DEFAULT_SERVER_LOG_FILE; | 562 | const logFile = pidRecord?.logFile ?? DEFAULT_SERVER_LOG_FILE; |
| | 563 | const denoVersion = yield* getDenoVersion(); |
| 557 | | 564 | |
| 558 | return { | 565 | return { |
| 559 | baseUrl, | 566 | baseUrl, |
| @@ -566,6 +573,7 @@ const getServerStatus = (baseUrl: string): Effect.Effect<LocalServerStatus, Erro · 6 unmodified lines |
| 566 | webAssetsDir: resolveRuntimeWebAssetsDir(), | 573 | webAssetsDir: resolveRuntimeWebAssetsDir(), |
| 567 | migrationsDir: resolveRuntimeMigrationsDir(), | 574 | migrationsDir: resolveRuntimeMigrationsDir(), |
| 568 | installation, | 575 | installation, |
| | 576 | denoVersion, |
| 569 | } satisfies LocalServerStatus; | 577 | } satisfies LocalServerStatus; |
| 570 | }); | 578 | }); |
| 571 | | 579 | |
| @@ -581,60 +589,55 @@ const renderStatus = (status: LocalServerStatus): string => · 9 unmodified lines |
| 581 | `webAssetsDir: ${status.webAssetsDir ?? "missing"}`, | 589 | `webAssetsDir: ${status.webAssetsDir ?? "missing"}`, |
| 582 | `migrationsDir: ${status.migrationsDir ?? "missing"}`, | 590 | `migrationsDir: ${status.migrationsDir ?? "missing"}`, |
| 583 | `workspaceId: ${status.installation?.workspaceId ?? "unavailable"}`, | 591 | `workspaceId: ${status.installation?.workspaceId ?? "unavailable"}`, |
| | 592 | `denoSandbox: ${renderDenoSandboxDetail(status.denoVersion)}`, |
| 584 | ].join("\n"); | 593 | ].join("\n"); |
| 585 | | 594 | |
| 586 | const getDoctorReport = (baseUrl: string) => | 595 | const getDoctorReport = (baseUrl: string) => |
| 587 | getServerStatus(baseUrl).pipe( | 596 | getServerStatus(baseUrl).pipe( |
| 588 | Effect.flatMap((status) => | 597 | Effect.map((status) => { |
| 589 | getDenoVersion().pipe( | 598 | const checks = { |
| 590 | Effect.map((denoVersion) => { | 599 | serverReachable: { |
| 591 | const checks = { | 600 | ok: status.reachable, |
| 592 | serverReachable: { | 601 | detail: status.reachable ? `reachable at ${status.baseUrl}` : `not reachable at ${status.baseUrl}`, |
| 593 | ok: status.reachable, | 602 | }, |
| 594 | detail: status.reachable ? `reachable at ${status.baseUrl}` : `not reachable at ${status.baseUrl}`, | 603 | pidFile: { |
| 595 | }, | 604 | ok: status.pid !== null, |
| 596 | pidFile: { | 605 | detail: status.pid !== null ? `pid ${status.pid}` : `missing pid file at ${status.pidFile}`, |
| 597 | ok: status.pid !== null, | 606 | }, |
| 598 | detail: status.pid !== null ? `pid ${status.pid}` : `missing pid file at ${status.pidFile}`, | 607 | process: { |
| 599 | }, | 608 | ok: status.pidRunning, |
| 600 | process: { | 609 | detail: status.pidRunning ? `pid ${status.pid}` : "no live daemon process recorded", |
| 601 | ok: status.pidRunning, | 610 | }, |
| 602 | detail: status.pidRunning ? `pid ${status.pid}` : "no live daemon process recorded", | 611 | database: { |
| 603 | }, | 612 | ok: status.localDataDir.length > 0, |
| 604 | database: { | 613 | detail: status.localDataDir, |
| 605 | ok: status.localDataDir.length > 0, | 614 | }, |
| 606 | detail: status.localDataDir, | 615 | webAssets: { |
| 607 | }, | 616 | ok: status.webAssetsDir !== null, |
| 608 | webAssets: { | 617 | detail: status.webAssetsDir ?? "missing bundled web assets", |
| 609 | ok: status.webAssetsDir !== null, | 618 | }, |
| 610 | detail: status.webAssetsDir ?? "missing bundled web assets", | 619 | migrations: { |
| 611 | }, | 620 | ok: status.migrationsDir !== null, |
| 612 | migrations: { | 621 | detail: status.migrationsDir ?? "missing migrations directory", |
| 613 | ok: status.migrationsDir !== null, | 622 | }, |
| 614 | detail: status.migrationsDir ?? "missing migrations directory", | 623 | installation: { |
| 615 | }, | 624 | ok: status.installation !== null, |
| 616 | installation: { | 625 | detail: status.installation |
| 617 | ok: status.installation !== null, | 626 | ? `workspace ${status.installation.workspaceId}` |
| 618 | detail: status.installation | 627 | : "local installation unavailable", |
| 619 | ? `workspace ${status.installation.workspaceId}` | 628 | }, |
| 620 | : "local installation unavailable", | 629 | denoSandbox: { |
| 621 | }, | 630 | ok: status.denoVersion !== null, |
| 622 | denoSandbox: { | 631 | detail: renderDenoSandboxDetail(status.denoVersion), |
| 623 | ok: denoVersion !== null, | 632 | }, |
| 624 | detail: denoVersion !== null | 633 | } as const; |
| 625 | ? `deno ${denoVersion}` | 634 | |
| 626 | : "deno not found (run `executor sandbox` to install)", | 635 | return { |
| 627 | }, | 636 | ok: Object.values(checks).every((check) => check.ok), |
| 628 | } as const; | 637 | status, |
| 629 | | 638 | checks, |
| 630 | return { | 639 | }; |
| 631 | ok: Object.values(checks).every((check) => check.ok), | 640 | }), |
| 632 | status, | | |
| 633 | checks, | | |
| 634 | }; | | |
| 635 | }), | | |
| 636 | ), | | |
| 637 | ), | | |
| 638 | ); | 641 | ); |
| 639 | | 642 | |
| 640 | const printJson = (value: unknown) => | 643 | const printJson = (value: unknown) => |