@wildo-ai/wildo-cli 1.1.12 → 1.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/commands/config/sync.command.d.ts.map +1 -1
- package/dist/src/commands/config/sync.command.js +1 -0
- package/dist/src/commands/config/sync.command.js.map +1 -1
- package/dist/src/commands/context/journey.command.d.ts.map +1 -1
- package/dist/src/commands/context/journey.command.js +8 -0
- package/dist/src/commands/context/journey.command.js.map +1 -1
- package/dist/src/commands/creation/drive.command.d.ts.map +1 -1
- package/dist/src/commands/creation/drive.command.js +2 -0
- package/dist/src/commands/creation/drive.command.js.map +1 -1
- package/dist/src/commands/fwk/publish-all.command.d.ts.map +1 -1
- package/dist/src/commands/fwk/publish-all.command.js +8 -0
- package/dist/src/commands/fwk/publish-all.command.js.map +1 -1
- package/dist/src/commands/local/dev.command.d.ts +68 -0
- package/dist/src/commands/local/dev.command.d.ts.map +1 -1
- package/dist/src/commands/local/dev.command.js +216 -8
- package/dist/src/commands/local/dev.command.js.map +1 -1
- package/dist/src/commands/local/doctor.command.d.ts +22 -9
- package/dist/src/commands/local/doctor.command.d.ts.map +1 -1
- package/dist/src/commands/local/doctor.command.js +45 -42
- package/dist/src/commands/local/doctor.command.js.map +1 -1
- package/dist/src/commands/providers/connect.command.d.ts.map +1 -1
- package/dist/src/commands/providers/connect.command.js +11 -1
- package/dist/src/commands/providers/connect.command.js.map +1 -1
- package/dist/src/commands/seal/currency.command.d.ts +13 -0
- package/dist/src/commands/seal/currency.command.d.ts.map +1 -0
- package/dist/src/commands/seal/currency.command.js +52 -0
- package/dist/src/commands/seal/currency.command.js.map +1 -0
- package/dist/src/commands/seal/seal-admin-door.utils.d.ts.map +1 -1
- package/dist/src/commands/seal/seal-admin-door.utils.js +2 -0
- package/dist/src/commands/seal/seal-admin-door.utils.js.map +1 -1
- package/dist/src/commands/seal/verify.command.d.ts +5 -0
- package/dist/src/commands/seal/verify.command.d.ts.map +1 -1
- package/dist/src/commands/seal/verify.command.js +26 -2
- package/dist/src/commands/seal/verify.command.js.map +1 -1
- package/dist/src/services/application/content-guardrail-classifier.service.d.ts +19 -0
- package/dist/src/services/application/content-guardrail-classifier.service.d.ts.map +1 -1
- package/dist/src/services/application/content-guardrail-classifier.service.js +75 -11
- package/dist/src/services/application/content-guardrail-classifier.service.js.map +1 -1
- package/dist/src/services/application/local-provider-doubles.service.d.ts +98 -0
- package/dist/src/services/application/local-provider-doubles.service.d.ts.map +1 -0
- package/dist/src/services/application/local-provider-doubles.service.js +214 -0
- package/dist/src/services/application/local-provider-doubles.service.js.map +1 -0
- package/dist/src/services/application/system-of-record-simulators.service.d.ts +21 -2
- package/dist/src/services/application/system-of-record-simulators.service.d.ts.map +1 -1
- package/dist/src/services/application/system-of-record-simulators.service.js +21 -12
- package/dist/src/services/application/system-of-record-simulators.service.js.map +1 -1
- package/dist/src/services/companion/creation-drive.service.d.ts +32 -2
- package/dist/src/services/companion/creation-drive.service.d.ts.map +1 -1
- package/dist/src/services/companion/creation-drive.service.js +61 -4
- package/dist/src/services/companion/creation-drive.service.js.map +1 -1
- package/dist/src/services/credentials/credentials.schemas.d.ts +6 -0
- package/dist/src/services/credentials/credentials.schemas.d.ts.map +1 -1
- package/dist/src/services/credentials/credentials.schemas.js +7 -1
- package/dist/src/services/credentials/credentials.schemas.js.map +1 -1
- package/dist/src/services/credentials/provider-env-vars.utils.d.ts.map +1 -1
- package/dist/src/services/credentials/provider-env-vars.utils.js +11 -3
- package/dist/src/services/credentials/provider-env-vars.utils.js.map +1 -1
- package/dist/src/services/data-services/data-services.schemas.d.ts +9 -0
- package/dist/src/services/data-services/data-services.schemas.d.ts.map +1 -1
- package/dist/src/services/data-services/data-services.schemas.js +9 -0
- package/dist/src/services/data-services/data-services.schemas.js.map +1 -1
- package/dist/src/services/deployment/docker/docker-compose-generator.service.d.ts.map +1 -1
- package/dist/src/services/deployment/docker/docker-compose-generator.service.js +7 -2
- package/dist/src/services/deployment/docker/docker-compose-generator.service.js.map +1 -1
- package/dist/src/services/deployment/local-dev-session-lease.service.d.ts.map +1 -1
- package/dist/src/services/deployment/local-dev-session-lease.service.js +22 -1
- package/dist/src/services/deployment/local-dev-session-lease.service.js.map +1 -1
- package/dist/src/services/environment/authored-infra-config.utils.d.ts.map +1 -1
- package/dist/src/services/environment/authored-infra-config.utils.js +1 -0
- package/dist/src/services/environment/authored-infra-config.utils.js.map +1 -1
- package/dist/src/services/environment/authored-infra-member-authority.d.ts.map +1 -1
- package/dist/src/services/environment/authored-infra-member-authority.js +5 -0
- package/dist/src/services/environment/authored-infra-member-authority.js.map +1 -1
- package/dist/src/services/environment/env-configuration-generator.service.d.ts.map +1 -1
- package/dist/src/services/environment/env-configuration-generator.service.js +6 -3
- package/dist/src/services/environment/env-configuration-generator.service.js.map +1 -1
- package/dist/src/services/environment/env-vars-builder.service.d.ts +6 -0
- package/dist/src/services/environment/env-vars-builder.service.d.ts.map +1 -1
- package/dist/src/services/environment/env-vars-builder.service.js +24 -1
- package/dist/src/services/environment/env-vars-builder.service.js.map +1 -1
- package/dist/src/services/environment/environment-hydration.utils.d.ts.map +1 -1
- package/dist/src/services/environment/environment-hydration.utils.js +1 -0
- package/dist/src/services/environment/environment-hydration.utils.js.map +1 -1
- package/dist/src/services/environment/environment.schemas.d.ts +7 -1
- package/dist/src/services/environment/environment.schemas.d.ts.map +1 -1
- package/dist/src/services/environment/environment.schemas.js.map +1 -1
- package/dist/src/services/environment/runtime-bootstrap.service.d.ts +2 -0
- package/dist/src/services/environment/runtime-bootstrap.service.d.ts.map +1 -1
- package/dist/src/services/environment/runtime-bootstrap.service.js +4 -0
- package/dist/src/services/environment/runtime-bootstrap.service.js.map +1 -1
- package/dist/src/services/framework/framework-docker-publish.service.d.ts +13 -0
- package/dist/src/services/framework/framework-docker-publish.service.d.ts.map +1 -1
- package/dist/src/services/framework/framework-docker-publish.service.js +24 -7
- package/dist/src/services/framework/framework-docker-publish.service.js.map +1 -1
- package/dist/src/services/registry/provider-connect.service.d.ts +57 -1
- package/dist/src/services/registry/provider-connect.service.d.ts.map +1 -1
- package/dist/src/services/registry/provider-connect.service.js +63 -2
- package/dist/src/services/registry/provider-connect.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/scripts/app-dependency-alignment/propagated-engine-overrides.json +1 -1
- package/wildo-framework.info.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.command.js","sourceRoot":"","sources":["../../../../src/commands/local/doctor.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAE1E,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EACL,sBAAsB,EACtB,kCAAkC,EAClC,uCAAuC,GACxC,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,wCAAwC,EAAE,MAAM,8DAA8D,CAAC;AACxH,OAAO,EAAE,mCAAmC,EAAE,MAAM,2EAA2E,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AG,CAAC,OAAO,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;QAClC,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC;CACF","sourcesContent":["/**\n * `wildo local doctor` — read-only infrastructure diagnostic.\n *\n * Diagnoses the recurring failure modes that have historically forced\n * developers to either reach for `wildo local reset` (destructive, wipes\n * all data) or debug by hand with `nc`/`mongosh`/`valkey-cli`. Each\n * check emits a single-line status + a one-line fix suggestion when it\n * fails, so the operator can self-serve without searching plan files\n * or pinging the framework owners.\n *\n * Coverage splits into PRECONDITIONS (checks 1–1c: can this machine run the\n * stack at all?) and RUNTIME PROBES (checks 2 onwards: is the running stack\n * healthy?). The preconditions are shared verbatim with the `wildo local dev`\n * preflight — see `services/deployment/local-precondition-checks.service.ts`\n * for why each exists and which real fresh-install failure it closes — and\n * they run BEFORE the Docker-daemon early-return, because none of them needs a\n * daemon and an operator whose Docker is merely not launched should still\n * learn that their Compose is too old and their artifacts unmaterialized.\n *\n * 1. Docker daemon — `docker info` exits 0.\n * 1a. **Docker Compose version** — the plugin must accept `start_interval`\n * (>= 2.24 / Docker Desktop >= 25) or the generated compose project is\n * rejected wholesale, LATE, mid-`local dev`. FAIL.\n * 1b. **Generated provider-runtime modules** — every runtime host a\n * `wildo config sync` would give a\n * `src/generated/wildo-provider-runtime.generated.ts` must have it; the\n * host imports it, so absence is an endlessly repeating `TS2307`. FAIL.\n * 1b'. **Generated provider-runtime artifact content** — a PRESENT artifact its reader would refuse\n * (#2254): a framework release can change what the readers require while no input changes, so a\n * file can exist and still stop its process. Applies what each reader applies — see\n * `findRefusedProviderRuntimeArtifacts`. FAIL; `wildo local dev` regenerates such a file at start.\n * 1c. **Orphaned dev watchers** — `tsc-watch` single-writers reparented to\n * init still hold `dist/esm/.builder.pid`, so every new watcher refuses\n * to become a second writer and readiness blocks forever. WARN\n * (recoverable with `wildo dev force-stop`), and detected only — this\n * command never kills anything.\n * 1d. **Derived-artifact currency** — the one question nothing here asked:\n * *is what I am RUNNING current?* Dists against source, injected `file:`\n * snapshots against framework dist (by FILE SET), accepted-generation\n * manifests against the paths they name, virtual-store keys against the\n * links that reach them, the config-loader cache against its inputs, and\n * each supervised process's START against the build it loads. Eight\n * development-stack failures over 2026-08-27/28 were this and nothing else\n * (issue #86); three were misdiagnosed as semantic defects in committed\n * code. WARN, never fatal — every remedy is \"delete this generated thing\n * and let it rebuild\", which needs the stack a hard stop would have taken\n * down. `doctor` only, never the `dev` preflight.\n * 2. Container state — every wildo backing-service container is up +\n * healthy, and is not crash-looping (restart count, with its last failure line).\n * 3. **Loopback binding** — `net.connect` to each container's exposed\n * port on **127.0.0.1** (NOT 0.0.0.0). Catches the Docker Desktop\n * port-table corruption we hit on 2026-05-19: container says\n * \"0.0.0.0:27017 -> 27017/tcp\" but `127.0.0.1` source-port\n * allocation fails with `EADDRNOTAVAIL`.\n * 4. Mongo admin auth — round-trip with the root credentials emitted\n * into the platform `.env` files; confirms creds match what the\n * container actually has.\n * 5. Valkey admin auth — same.\n * 6. **Stale per-app users** — enumerate Mongo `admin.system.users`\n * and Valkey ACL entries; flag every non-canonical-admin entry.\n * These persist across `local up`/`local down` cycles and across\n * `wildo_platform` database drops; when the apps-manager generates\n * new derived passwords, the stale entries cause `WRONGPASS` on\n * Redis or `MongoServerError: Authentication failed` on Mongo.\n * `wildo local reset` would wipe them along with all data; this\n * diagnostic merely surfaces them with a surgical-fix command\n * string.\n * 7. Platform services HTTP — apps-manager (5151), crontabs-batches-\n * manager (5152) `/health` responses.\n * 8. Companion semantic readiness — companion (4341) `/health/ready` if the active\n * workspace declares one.\n * 9. **Emulated containers** — every running wildo container whose image\n * architecture differs from the host's runs under Rosetta/QEMU, a\n * several-fold CPU multiplier billed to the Docker VM, invisible in\n * `docker stats`. Measured 2026-08-10: an amd64-only immudb pin kept\n * the audit store permanently emulated on Apple Silicon. Declared\n * amd64-only images (clamav — Cisco publishes no arm64) are excepted.\n * 10. **Leaked integration-test containers** — `wildo-shared-pg-*`\n * servers are provisioned per Vitest run by saas-backend-lib's\n * shared-postgres global setup and self-reap on the NEXT run; one\n * older than the 3 h TTL with no run happening means the fleet is\n * accumulating idle PostgreSQL daemons in the VM (sixteen were found\n * the day this check was written).\n *\n * Zero side effects. Safe to run at any time.\n */\n\nimport chalk from 'chalk';\nimport { execSync } from 'child_process';\nimport { existsSync, readFileSync } from 'fs';\nimport { connect } from 'net';\nimport { join } from 'path';\nimport { BaseCommand } from '~wildo-cli/kernel/base-command';\nimport { DockerUtils } from '~wildo-cli/services/deployment/docker/docker.service';\nimport { CommandCategory } from '~wildo-cli/kernel/types';\nimport { ErrorUtils } from '~wildo-cli/infrastructure/errors/error.utils';\nimport type { CommandMeta, CommandContext, CommandResult } from '~wildo-cli/kernel/types';\nimport { WildoDeploymentRuntime, WildoLocationType } from '@wildo-ai/platform-config-lib';\nimport { collectCreationPreflightChecks } from '~wildo-cli/services/application/creation-preflight.service';\nimport {\n aiUseDeclarationsCheck,\n assessApplicationAiUseDeclarations,\n readAgentAiUseDeclarationsFromCompanion,\n} from '~wildo-cli/services/application/ai-use-declarations.service';\nimport { resolveCompanionClientOptionsFromContext } from '~wildo-cli/services/companion/companion-client-options.utils';\nimport { readFrontendProviderKeyReportOnDisk } from '~wildo-cli/services/application/frontend-providers-not-configured.service';\nimport { describeFrontendProviderNotConfigured } from '@wildo-ai/saas-models';\nimport {\n checkSpecificationFindings,\n collectLocalPreconditionChecks,\n readSpecificationFindingsFromCompanion,\n} from '~wildo-cli/services/deployment/local-precondition-checks.service';\nimport {\n CONTENT_GUARDRAIL_CLASSIFIER_CHECK_NAME,\n EnvironmentProviderEnvReadingKind,\n contentGuardrailClassifierCheck,\n guardedAgentRefs,\n readEnvironmentClassifiers,\n readEnvironmentProviderEnv,\n} from '~wildo-cli/services/application/content-guardrail-classifier.service';\nimport { getComposedProviderSecretsCatalogue, resolveAndRegisterSaasProviderContributions } from '~wildo-cli/services/credentials/composed-provider-catalogue';\nimport { collectProviderConfigurationChecks } from '~wildo-cli/services/registry/provider-configuration-checks.service';\nimport { settleAllAuthoredInfraEnvConfigs } from '~wildo-cli/services/environment/authored-infra-config.utils';\nimport { EnvironmentUtils } from '~wildo-cli/services/environment/environment.service';\nimport { loadSaasConfig, WORKSPACE_CONFIG_NAMES } from '@wildo-ai/platform-config-lib';\nimport {\n LocalPreconditionCheckStatus,\n type LocalPreconditionCheckResult,\n} from '~wildo-cli/services/deployment/local-precondition-checks.schemas';\nimport { InfrastructureHost } from '~wildo-cli/services/environment/infrastructure-host.service';\nimport { collectHostedInfrastructureLeftovers } from '~wildo-cli/services/environment/hosted-infrastructure-leftovers.service';\nimport { JsonDocumentLayout, writeJsonDocument } from '~wildo-cli/kernel/json-document-output';\nimport {\n StoredDeclarationCurrency,\n StoredDeclarationCurrencyService,\n} from '~wildo-cli/services/application/stored-declaration-currency.service';\n\n// Canonical admin user names baked into the framework's container images.\n// Anything else in the user/ACL list is a per-app (or scoped) entry\n// that's a candidate for the stale-credentials class of failure.\nconst CANONICAL_MONGO_ADMINS = new Set(['wildo']);\nconst CANONICAL_VALKEY_ACL_USERS = new Set(['default']);\n\n/**\n * Containers ALLOWED to run non-native, because no native image exists upstream.\n * Keep in lockstep with the `platform: linux/amd64` pins in\n * `templates/infra/docker-compose/docker-compose.wildo-platform.yml.hbs` — a\n * container listed here without a template pin (or vice-versa) is drift.\n * clamav: Cisco publishes no arm64 manifests (re-verified 2026-08-10).\n */\nconst DECLARED_NON_NATIVE_CONTAINERS = new Set(['wildo-clamav']);\n\n/**\n * TTL after which a `wildo-shared-pg-*` integration-test container counts as leaked.\n * Mirrors `MAX_CONTAINER_AGE_MS` in saas-backend-lib's\n * `src/__tests__/shared-postgres.global-setup.mjs` (the reaping side of the same\n * contract); the doctor only OBSERVES, because reaping belongs to the test harness.\n */\nconst SHARED_PG_LEAK_TTL_MS = 3 * 3_600_000;\n\n/**\n * One diagnostic line. Aliased to the shared precondition result so the\n * precondition checks and this command's own runtime probes render through the\n * same path — a precondition line without a `fix:` would be indistinguishable\n * from a probe line that has one.\n */\ntype CheckResult = LocalPreconditionCheckResult;\n\n/** The agents' declarations as the companion answered them, or why they could not be read. */\ntype AgentDeclarationsRead = Awaited<ReturnType<typeof readAgentAiUseDeclarationsFromCompanion>>;\n\n/**\n * How long doctor waits for the dev companion to answer the agents' AI-use declarations (#2848). The introspection\n * imports the application's compiled backend in a subprocess, which takes seconds; past this the agent half of the\n * line is reported as not probed rather than holding the whole diagnostic.\n */\nconst AI_USE_DECLARATIONS_COMPANION_TIMEOUT_MS = 30_000;\n\nexport default class LocalDoctorCommand extends BaseCommand {\n readonly meta: CommandMeta = {\n name: 'local doctor',\n description: 'Read-only infrastructure diagnostic — Docker, container ports, backing-service auth, stale credentials, platform/companion health',\n category: CommandCategory.Local,\n flags: {\n json: {\n type: 'boolean',\n description: 'Emit structured JSON (one object per check) instead of the formatted table — useful for piping into other tools.',\n default: false,\n },\n },\n };\n\n async run(ctx: CommandContext): Promise<CommandResult> {\n const env = ctx.activeEnv;\n if (!env) {\n ctx.log.error('No active environment. Run `wildo init` first.');\n return { success: false };\n }\n if (env.locationType === WildoLocationType.REMOTE) {\n ctx.log.error('`wildo local doctor` is for LOCAL environments only.');\n return { success: false };\n }\n if (env.runtime === WildoDeploymentRuntime.KUBERNETES) {\n ctx.log.warn('K8s local-doctor coverage is not implemented yet — running Docker-Compose checks only.');\n }\n\n const asJson = ctx.flags.json === true;\n const results: CheckResult[] = [];\n\n // ─── 1. Docker daemon ──────────────────────────────────────────────\n const dockerDaemon = this.checkDockerDaemon();\n results.push(dockerDaemon);\n const dockerUp = dockerDaemon.status === LocalPreconditionCheckStatus.PASS;\n\n // ─── 1a–1c. Preconditions (shared with the `local dev` preflight) ──\n // Ordered before the daemon early-return on purpose: none of these needs a\n // running daemon, and a fresh-install operator who simply has not launched\n // Docker Desktop yet should still learn about an old Compose plugin, an\n // unsynced app, and orphaned watchers in the SAME run rather than one per\n // relaunch.\n results.push(...(await collectLocalPreconditionChecks({\n saasRoot: ctx.cliContext.resolvedHomes.app.declarationRoot,\n frameworkPath: ctx.cliContext.resolvedHomes.framework.repositoryRoot,\n isFrameworkDeveloper: ctx.preferences?.isFrameworkDeveloper ?? false,\n codingAgentPreference: ctx.preferences?.defaults?.codingAgent,\n // `doctor` is the diagnostic surface a human asked for, so it pays the\n // cost of actually starting the coding agent to see whether it answers.\n includeCodingAgentProbe: true,\n // Same trade for the currency sweep: several seconds of I/O across every dist\n // tree, injected snapshot and virtual-store key, which is what a human running\n // `doctor` wants and what the `dev` preflight must not pay on every start.\n includeDerivedArtifactCurrencySweep: true,\n})));\n\n // ─── 1d. Infrastructure owner ──────────────────────────────────────\n // Stated before the runtime probes because it changes what they describe: for a HOSTED environment\n // every container and platform check below reads the HOST's substrate, and every repair they suggest\n // (`wildo local up`, `wildo local reset`, `wildo config sync` of shared files) is run from the host.\n try {\n const hostedBy = await InfrastructureHost.resolveForCommand(ctx.cliContext.resolvedHomes.app.declarationRoot, env);\n if (hostedBy !== null) {\n results.push({\n name: 'Infrastructure host',\n status: LocalPreconditionCheckStatus.PASS,\n detail: `Runs on the infrastructure of ${hostedBy.applicationRoot}. The container and platform checks below describe `\n + 'the host\\'s substrate; run any repair they suggest from the host application.',\n });\n\n /*\n * The artifacts this application wrote while it OWNED its infrastructure are still on disk and are\n * now inert (#1194). Reported rather than removed: the stale compose render claims the host's own\n * container names, so it is worth seeing, and its data directory may still hold the only copy of\n * something the operator wants.\n */\n const hostedSaasRoot = ctx.cliContext.resolvedHomes.app.declarationRoot;\n const leftovers = hostedSaasRoot\n ? collectHostedInfrastructureLeftovers({ saasRoot: hostedSaasRoot, envName: env.name })\n : [];\n if (leftovers.length > 0) {\n results.push({\n name: 'Pre-hosting infrastructure artifacts',\n status: LocalPreconditionCheckStatus.WARN,\n detail: `${leftovers.length} artifact(s) predating this environment's move onto ${hostedBy.applicationRoot} are `\n + 'still on disk. They are INERT — this environment reads its host\\'s compose project and shared credentials — '\n + `but they read as live configuration: ${leftovers.map((leftover) => `${leftover.what} → ${leftover.path}`).join('; ')}`,\n fix: 'Read each path first, then remove what you no longer want; a hosted application needs none of them. '\n + 'The shared credential sections disappear on their own at the next `wildo config sync --domain secrets`.',\n });\n }\n }\n } catch (error) {\n results.push({\n name: 'Infrastructure host',\n status: LocalPreconditionCheckStatus.FAIL,\n detail: ErrorUtils.extractErrorMessage(error),\n fix: 'Check the host application out at the path infrastructureHost.applicationRoot names, or remove infrastructureHost to run on this application\\'s own infrastructure.',\n });\n }\n\n if (!dockerUp) {\n this.render(ctx, results, asJson);\n return { success: false };\n }\n\n // ─── 2. Container state ────────────────────────────────────────────\n const containers = this.listWildoContainers();\n for (const containerName of containers) {\n results.push(this.checkContainerHealthy(containerName));\n }\n\n // ─── 3. Loopback binding (127.0.0.1) ───────────────────────────────\n const ports = this.collectContainerPorts(containers);\n for (const [serviceLabel, port] of ports) {\n results.push(await this.checkLoopbackBinding(serviceLabel, port));\n }\n\n // ─── 4 + 5. Mongo + Valkey admin auth + stale users ───────────────\n if (containers.includes('wildo-mongodb')) {\n results.push(...this.checkMongo());\n }\n if (containers.includes('wildo-valkey')) {\n results.push(...this.checkValkey());\n }\n if (containers.includes('wildo-postgresql')) {\n results.push(this.checkPostgres());\n }\n\n // ─── 7. Platform service HTTP /health ─────────────────────────────\n const isFrameworkDeveloper = ctx.preferences?.isFrameworkDeveloper ?? false;\n results.push(await this.checkHttp('apps-manager', 'http://localhost:5151/health', isFrameworkDeveloper));\n results.push(await this.checkHttp('crontabs-batches-manager', 'http://localhost:5152/health', isFrameworkDeveloper));\n\n // ─── 8. Companion HTTP semantic readiness (best-effort) ──────────\n const saasRoot = ctx.cliContext.resolvedHomes.app.declarationRoot;\n if (saasRoot) {\n const companionPort = this.detectCompanionPort(saasRoot);\n if (companionPort) {\n results.push(await this.checkHttp('dev-companion', `http://localhost:${companionPort}/health/ready`, isFrameworkDeveloper));\n }\n }\n\n // ─── 9. Emulated containers (image arch vs host arch) ─────────────\n results.push(...this.checkContainerArchitectures(containers));\n\n // ─── 10. Leaked integration-test containers ───────────────────────\n results.push(this.checkLeakedTestContainers());\n\n // ─── 11. Authored declaration vs stored managed config ────────────\n // Placed after the apps-manager health probe on purpose: the question can\n // only be answered by a running apps-manager, and asking a dead one would\n // produce a \"cannot compare\" line beside the health line that already said\n // why.\n results.push(await this.checkDeclarationCurrency(ctx));\n\n // ─── 11b. Declared frontend providers have their keys ─────────────\n // Read from the artifacts the last `wildo config sync` wrote: a provider declared without the key its module\n // requires is absent from every page, and until this check a browser was the only place that said so.\n if (saasRoot) {\n results.push(this.checkFrontendProviderKeys(saasRoot));\n }\n\n // ─── 12. Can the application-creation journey START? ──────────────\n //\n // A different question from every check above, which ask whether the STACK is up. These ask\n // whether the journey will run, and each corresponds to a refusal that exists in the runtime —\n // measured on a freshly created application, where all of them were discovered by hitting them,\n // one of them only after an operator had answered a fifteen-question interview (#1302).\n //\n // Last on purpose: they read the application's declared configuration and its discovered provider\n // contributions, neither of which is worth reporting while the stack itself is broken.\n //\n // The SAME collector `wildo creation preflight` prints and `wildo creation run` refuses on (#2229), so the\n // two surfaces cannot disagree about whether a run can finish.\n if (saasRoot) {\n results.push(...await collectCreationPreflightChecks({\n saasRoot,\n envName: env.name,\n frameworkRoot: ctx.cliContext.resolvedHomes.framework.repositoryRoot,\n }));\n }\n\n // ─── 13. Which AI uses still owe a declaration (#2848) ────────────\n //\n // A WARN, never a FAIL, and not a creation-readiness check: the runtime refuses nothing for an undeclared use,\n // and the privacy notice lists it as outstanding. The agents are read from the running companion; without one,\n // the agent half is reported as not probed rather than guessed.\n if (saasRoot) {\n // One companion read for both agent lines: the AI-use declarations and the content-guardrail classifier.\n const agentsRead = this.detectCompanionPort(saasRoot)\n ? await readAgentAiUseDeclarationsFromCompanion(await resolveCompanionClientOptionsFromContext(ctx, AI_USE_DECLARATIONS_COMPANION_TIMEOUT_MS))\n : { notReadBecause: 'the dev companion is not running' };\n results.push(await this.checkAiUseDeclarations(saasRoot, agentsRead));\n\n // ─── 14. Which environments can serve the agents' content guardrails (#2292) ────\n //\n // A WARN, never a FAIL: an agent declaring prompt-injection screening or output moderation refuses every turn in\n // an environment where no AI_CONTENT_SAFETY classifier can serve it, and the backend says so only when it boots\n // THERE. This reads every authored environment, offline, by the provider registry's own ordering rule.\n results.push(await this.checkContentGuardrailClassifier(saasRoot, agentsRead));\n\n // ─── 15. Specifications the companion refused to serve (#3211) ────\n //\n // Only the running companion can answer: it evaluates the package through the loader that collects refusals.\n results.push(checkSpecificationFindings(this.detectCompanionPort(saasRoot)\n ? await readSpecificationFindingsFromCompanion(await resolveCompanionClientOptionsFromContext(ctx, AI_USE_DECLARATIONS_COMPANION_TIMEOUT_MS))\n : { notReadBecause: 'the dev companion is not running' }));\n\n // ─── 16. The providers' own configuration checks (#2711) ────\n //\n // A WARN, never a FAIL: the backend runs the same checks at boot and does not refuse to start on one. A provider\n // module that declares `configurationCheck` (Slack: does SLACK_APPLICATION_WORKSPACE_ID name the workspace of\n // SLACK_ACCESS_TOKEN?) is run against this environment's values; a variable set in the shell wins over the stored one.\n results.push(...await collectProviderConfigurationChecks({ saasRoot, envName: env.name }));\n }\n\n this.render(ctx, results, asJson);\n\n const hasFailure = results.some((r) => r.status === LocalPreconditionCheckStatus.FAIL);\n return { success: !hasFailure };\n }\n\n // ────────────────────────────────────────────────────────────────────\n // Individual checks\n // ────────────────────────────────────────────────────────────────────\n\n /**\n * The AI uses of the application's service that owe a declaration (`aiUse` on an agent, `aiUsePosture` for a\n * use no agent carries), from the same derivation the compliance brief uses. See `ai-use-declarations.service.ts`.\n */\n private async checkAiUseDeclarations(saasRoot: string, read: AgentDeclarationsRead): Promise<CheckResult> {\n const agents = 'agents' in read ? read.agents : undefined;\n const report = await assessApplicationAiUseDeclarations({ saasRoot, agents });\n return aiUseDeclarationsCheck(report, 'notReadBecause' in read ? read.notReadBecause : undefined);\n }\n\n /**\n * Whether each authored environment can serve the classifier-backed content guardrails the agents declare. See\n * `content-guardrail-classifier.service.ts`. The configuration, the environments and the provider catalogue are read\n * from disk; the agents come from the companion read above.\n */\n private async checkContentGuardrailClassifier(saasRoot: string, read: AgentDeclarationsRead): Promise<CheckResult> {\n const guardedAgents = 'agents' in read ? guardedAgentRefs(read.agents) : undefined;\n const notReadBecause = 'notReadBecause' in read\n ? read.notReadBecause\n : guardedAgents === undefined ? 'the dev companion\\'s agent reading predates the guardrail fields; redeliver the companion' : undefined;\n if (guardedAgents !== undefined && guardedAgents.length === 0) return contentGuardrailClassifierCheck({ readings: [], guardedAgents });\n try {\n const saasConfig = await loadSaasConfig(join(saasRoot, WORKSPACE_CONFIG_NAMES.SAAS));\n await resolveAndRegisterSaasProviderContributions({ saasRoot, saasConfig });\n const readings = readEnvironmentClassifiers({\n saasConfig,\n environments: await settleAllAuthoredInfraEnvConfigs(saasRoot),\n catalogue: getComposedProviderSecretsCatalogue(),\n // Only `providerEnv` is read, unvalidated: a file in an older shape still says which keys it holds, and a file\n // that cannot be read is reported with its path, never as absent.\n providerEnvOf: (envName) => {\n let path: string;\n try {\n path = join(EnvironmentUtils.resolveSecretsDir(envName), 'secrets.json');\n } catch (error) {\n return { kind: EnvironmentProviderEnvReadingKind.UNREADABLE, path: `the ${envName} secrets directory`, reason: ErrorUtils.extractErrorMessage(error) };\n }\n return readEnvironmentProviderEnv(path);\n },\n });\n return contentGuardrailClassifierCheck({ readings, guardedAgents, ...(notReadBecause ? { agentsNotReadBecause: notReadBecause } : {}) });\n } catch (error) {\n return {\n name: CONTENT_GUARDRAIL_CLASSIFIER_CHECK_NAME,\n status: LocalPreconditionCheckStatus.WARN,\n detail: `not probed: the configuration or the provider catalogue could not be read (${ErrorUtils.extractErrorMessage(error)})`,\n fix: 'Run `wildo config sync` to see why the configuration does not load.',\n };\n }\n }\n\n /**\n * Does the stored managed application config still match `wildo.saas.config.ts`?\n *\n * The visibility half of issue #97. Every app-authored value under `providerConfigurations`,\n * `engineCapabilities`, `providers`, `frontendServices`, `minions` and `workers` is materialized\n * into the stored platform document, and before this check nothing on any surface compared the two.\n * The only symptom of a divergence was behaviour that silently matched the OLD value — which cost\n * four restarts, three dispatched agent runs and roughly $8 of model time to diagnose once, because\n * the wrong conclusion (\"the change did not take, so the feature is broken\") was available at every\n * step and the right one required inspecting a database document by hand.\n *\n * WARNS rather than fails, on every host. Drift is a legitimate intermediate state — an operator\n * mid-edit has it by definition — and `doctor` returning non-zero for an unsaved thought would make\n * the command useless during exactly the work it is meant to support. The remedy is also one\n * command away and destroys nothing, which is the shape a warning is for.\n *\n * `not probed` (a PASS with an explicit detail, the idiom `checkCxx20Toolchain` uses for Windows)\n * covers every honest reason the comparison cannot be made: no app root, no secrets yet, the app\n * not registered, apps-manager down. Reporting those as drift would be a false positive on a fresh\n * machine, and a check that cries wolf on first run is a check operators learn to skim.\n *\n * The comparison itself is NOT implemented here — `StoredDeclarationCurrencyService` asks\n * apps-manager for a dry-run declaration reapply, so the answer comes from the one component that\n * owns the projection, and `wildo config validate` reads the same function.\n */\n private async checkDeclarationCurrency(ctx: CommandContext): Promise<CheckResult> {\n const name = 'declaration vs stored app config';\n // One comparison, shared with `wildo config validate` — see `StoredDeclarationCurrencyService`.\n const result = await StoredDeclarationCurrencyService.assess({\n saasRoot: ctx.cliContext.resolvedHomes.app.declarationRoot,\n env: ctx.activeEnv,\n });\n\n switch (result.currency) {\n case StoredDeclarationCurrency.CURRENT:\n return {\n name,\n status: LocalPreconditionCheckStatus.PASS,\n detail: `'${result.appSlug}' stored config matches wildo.saas.config.ts`,\n };\n case StoredDeclarationCurrency.STALE:\n return {\n name,\n status: LocalPreconditionCheckStatus.WARN,\n detail:\n `'${result.appSlug}' stored config is behind wildo.saas.config.ts on `\n + `${result.staleSlices.length} slice(s): ${result.staleSlices.join(', ')}. `\n + 'The runtime uses the STORED value, not the authored file.',\n fix: result.remedy,\n };\n case StoredDeclarationCurrency.NOT_PROBED:\n // Deliberately not a WARN — see the service: an unanswerable comparison is not drift.\n return { name, status: LocalPreconditionCheckStatus.PASS, detail: `not probed — ${result.reason}` };\n }\n }\n\n private checkDockerDaemon(): CheckResult {\n try {\n execSync('docker info', { stdio: 'pipe' });\n return { name: 'Docker daemon', status: LocalPreconditionCheckStatus.PASS };\n } catch {\n return {\n name: 'Docker daemon',\n status: LocalPreconditionCheckStatus.FAIL,\n detail: 'docker info exited non-zero — daemon not reachable',\n fix: 'Launch Docker Desktop: `open -a Docker`. Then re-run `wildo local doctor`.',\n };\n }\n }\n\n private listWildoContainers(): string[] {\n // `docker ps` only — we deliberately don't include `-a` so a\n // STOPPED container surfaces as \"missing\", which is more useful\n // than \"stopped\" for the local-doctor narrative.\n try {\n const out = execSync('docker ps --format \"{{.Names}}\"', { encoding: 'utf-8', stdio: 'pipe' });\n return out\n .split('\\n')\n .map((s) => s.trim())\n .filter((s) => s.startsWith('wildo-'));\n } catch {\n return [];\n }\n }\n\n private checkContainerHealthy(name: string): CheckResult {\n try {\n // `{{with .State.Health}}` (not `.State.Health.Status` directly): a container\n // whose image defines NO healthcheck has no `Health` key at all, and the\n // direct access is a template hard-error (\"map has no entry for key\"), which\n // used to report such containers (e.g. the distroless otel-collector) as\n // failed. The nil-safe form renders `running/` and we treat absent health\n // as pass, matching the previous `<no value>` intent.\n const status = execSync(\n `docker inspect --format '{{.State.Status}}/{{with .State.Health}}{{.Status}}{{end}}' \"${name}\"`,\n { encoding: 'utf-8', stdio: 'pipe' },\n ).trim();\n const [state, health] = status.split('/');\n /*\n * A crash loop reads `running/starting` for most of each cycle, so state alone reported mongod on\n * 2026-09-24 as a container still booting, 243 restarts in. The restart count is the signal, and\n * the failure line is captured now because a later re-render that removes the container removes\n * its log with it. Threshold 3: one or two restarts can be a Docker Desktop restart; a loop is not.\n */\n const restarts = DockerUtils.readRestartCounts([name]).get(name) ?? 0;\n if (state === 'restarting' || restarts >= 3) {\n const failure = DockerUtils.readLastFailureLine(name);\n return {\n name: `container ${name}`,\n status: LocalPreconditionCheckStatus.FAIL,\n detail: `${status}, restarted ${restarts} time(s)${failure ? ` — last failure: ${failure}` : ''}`,\n fix: `Read \\`docker logs ${name} --tail 100\\` before anything removes the container; a fault that survives a restart is not repaired by one.`,\n };\n }\n if (state === 'running' && (health === 'healthy' || health === '' || health === '<no value>')) {\n return { name: `container ${name}`, status: LocalPreconditionCheckStatus.PASS, detail: status };\n }\n return {\n name: `container ${name}`,\n status: LocalPreconditionCheckStatus.WARN,\n detail: status,\n fix: `Inspect: \\`docker logs ${name} --tail 50\\``,\n };\n } catch (err) {\n return {\n name: `container ${name}`,\n status: LocalPreconditionCheckStatus.FAIL,\n detail: ErrorUtils.extractErrorMessage(err),\n fix: `Start infra: \\`wildo local up\\``,\n };\n }\n }\n\n private collectContainerPorts(containers: string[]): Array<[string, number]> {\n const out: Array<[string, number]> = [];\n for (const name of containers) {\n try {\n const ports = execSync(\n `docker port \"${name}\"`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n // Output lines look like: \"27017/tcp -> 0.0.0.0:27017\"\n // We only want host-side ports actually exposed on 0.0.0.0/127.0.0.1.\n const seen = new Set<number>();\n for (const line of ports.split('\\n')) {\n const match = line.match(/->\\s*(?:0\\.0\\.0\\.0|127\\.0\\.0\\.1):(\\d+)/);\n if (match) {\n const port = Number.parseInt(match[1], 10);\n if (!seen.has(port)) {\n seen.add(port);\n out.push([name, port]);\n }\n }\n }\n } catch {\n // skip containers we can't inspect\n }\n }\n return out;\n }\n\n private checkLoopbackBinding(serviceLabel: string, port: number): Promise<CheckResult> {\n return new Promise((resolve) => {\n const socket = connect({ host: '127.0.0.1', port });\n const timeout = setTimeout(() => {\n socket.destroy();\n resolve({\n name: `loopback ${serviceLabel}:${port}`,\n status: LocalPreconditionCheckStatus.FAIL,\n detail: 'connect timed out after 2000ms',\n fix: 'Restart Docker Desktop (port table likely corrupted): `osascript -e \\'quit app \"Docker\"\\' && open -a Docker`',\n });\n }, 2_000);\n\n socket.once('connect', () => {\n clearTimeout(timeout);\n socket.end();\n resolve({ name: `loopback ${serviceLabel}:${port}`, status: LocalPreconditionCheckStatus.PASS });\n });\n socket.once('error', (err) => {\n clearTimeout(timeout);\n const code = (err as NodeJS.ErrnoException).code ?? 'unknown';\n const isLoopbackBindingBug = code === 'EADDRNOTAVAIL';\n resolve({\n name: `loopback ${serviceLabel}:${port}`,\n status: LocalPreconditionCheckStatus.FAIL,\n detail: `${code}: ${err.message}`,\n fix: isLoopbackBindingBug\n ? 'Docker Desktop port table is corrupted on this host. Quit and relaunch Docker: `osascript -e \\'quit app \"Docker\"\\' && open -a Docker`'\n : `Service likely not listening. Check: \\`docker logs ${serviceLabel} --tail 50\\``,\n });\n });\n });\n }\n\n private checkMongo(): CheckResult[] {\n const creds = this.readMongoCreds();\n if (!creds) {\n return [{\n name: 'mongo admin auth',\n status: LocalPreconditionCheckStatus.WARN,\n detail: 'could not locate platform-apps-manager .env to extract admin creds',\n fix: 'Run `wildo config sync` to (re-)emit the platform-apps-manager .env file.',\n }];\n }\n\n const results: CheckResult[] = [];\n\n // Admin auth round-trip.\n try {\n execSync(\n `docker exec wildo-mongodb mongosh \"mongodb://${creds.user}:${creds.pass}@localhost:27017/admin?directConnection=true\" --quiet --eval \"db.runCommand({ping:1}).ok\"`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n results.push({ name: 'mongo admin auth', status: LocalPreconditionCheckStatus.PASS });\n } catch (err) {\n const msg = ErrorUtils.extractErrorMessage(err);\n results.push({\n name: 'mongo admin auth',\n status: LocalPreconditionCheckStatus.FAIL,\n detail: msg.includes('Authentication failed') ? 'Authentication failed' : 'connection failed',\n fix: 'Verify `MONGO_INITDB_ROOT_PASSWORD` in the container env matches `MONGO_CONNECT_URL` in the apps-manager `.env`. If they drifted, the cleanest path is `wildo local reset` (destructive — wipes data).',\n });\n return results;\n }\n\n // Stale per-app users.\n try {\n const out = execSync(\n `docker exec wildo-mongodb mongosh \"mongodb://${creds.user}:${creds.pass}@localhost:27017/admin?directConnection=true\" --quiet --eval 'JSON.stringify(db.getSiblingDB(\"admin\").system.users.find({}, {user:1, _id:0}).toArray())'`,\n { encoding: 'utf-8', stdio: 'pipe' },\n ).trim();\n const users: Array<{ user: string }> = JSON.parse(out);\n const stale = users.map((u) => u.user).filter((u) => !CANONICAL_MONGO_ADMINS.has(u));\n if (stale.length === 0) {\n results.push({ name: 'mongo per-app users', status: LocalPreconditionCheckStatus.PASS, detail: '(no stale entries)' });\n } else {\n results.push({\n name: 'mongo per-app users',\n status: LocalPreconditionCheckStatus.WARN,\n detail: `${stale.length} non-canonical user(s): ${stale.join(', ')}`,\n fix: stale\n .map((u) => `docker exec wildo-mongodb mongosh \"mongodb://${creds.user}:${creds.pass}@localhost:27017/admin?directConnection=true\" --quiet --eval 'db.getSiblingDB(\"admin\").dropUser(\"${u}\")'`)\n .join(' && '),\n });\n }\n } catch {\n // best-effort\n }\n\n return results;\n }\n\n /**\n * PostgreSQL admin-auth round-trip — the PG mirror of `checkMongo`'s drift probe (5.3 review).\n * The drift class is identical: the container's initdb password is frozen at first `up` while\n * the `.env` rotates with `wildo config sync`, and the platform's own `PG_CONNECT_URL` embeds\n * the same credential.\n *\n * The probe connects via the container's NON-LOOPBACK address, and that is the entire trick: the\n * postgres image's initdb-generated `pg_hba.conf` TRUSTS both the local socket AND loopback TCP\n * (`host all all 127.0.0.1/32 trust` — measured on the live container, where a wrong-password\n * probe against 127.0.0.1 returned rows happily). Only the appended\n * `host all all all scram-sha-256` rule actually checks the password, and only a non-loopback\n * source address reaches it. A probe that cannot fail is not a probe (review round 3, F1).\n *\n * ## `hostname -i` returns a LIST, and taking it whole broke the probe\n *\n * It prints one address per attached docker network, space-separated. The platform's postgres is\n * on two (its own compose network and the shared infra one), so the interpolation produced\n * `postgresql://user:pass@172.29.0.2 172.19.0.7:5432/postgres` and psql refused it with\n * `unexpected spaces found`. That surfaced as `connection failed` — indistinguishable from a real\n * outage, and its remediation recommends `wildo local reset`, which WIPES DATA. So a\n * one-container-network machine passed while a two-network machine was told to destroy its\n * database to fix a working credential. Measured 2026-08-28 against a healthy server whose\n * password authenticated correctly from three other paths.\n *\n * `awk '{print $1}'` takes the first address. Any of them reaches the scram rule, so which one is\n * immaterial — what matters is that exactly one is used. The power of the probe is unchanged: a\n * wrong password against the first address still fails `password authentication failed`.\n */\n private checkPostgres(): CheckResult {\n const creds = this.readPostgresCreds();\n if (!creds) {\n return {\n name: 'postgres admin auth',\n status: LocalPreconditionCheckStatus.WARN,\n // `appsManagerEnvPath()` returns '' when no .env exists, so a non-empty path here means\n // the FILE was found and the KEYS are what is missing — two different remedies, and the\n // old single message sent operators hunting a path problem they did not have.\n detail: this.appsManagerEnvPath()\n ? 'apps-manager .env found but PG_ADMIN_USER/PG_ADMIN_PASSWORD/PG_ADMIN_DATABASE are not all present'\n : 'could not locate platform-apps-manager .env to extract PG admin creds',\n fix: 'Run `wildo config sync` to (re-)emit the platform-apps-manager .env file with the PG admin keys.',\n };\n }\n\n try {\n // Credentials are framework-minted over [A-Za-z0-9_+-] (see CredentialGenerator), so raw\n // interpolation into the single-quoted shell string and the URL is safe; the database name\n // is authored, so it gets the same percent-encoding as the emitted PG_CONNECT_URL.\n execSync(\n `docker exec wildo-postgresql sh -c 'psql \"postgresql://${creds.user}:${creds.pass}@$(hostname -i | awk \"{print \\\\$1}\"):5432/${encodeURIComponent(creds.database)}\" -tAc \"select 1\"'`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n return { name: 'postgres admin auth', status: LocalPreconditionCheckStatus.PASS };\n } catch (err) {\n const msg = ErrorUtils.extractErrorMessage(err);\n return {\n name: 'postgres admin auth',\n status: LocalPreconditionCheckStatus.FAIL,\n detail: msg.includes('password authentication failed') ? 'Authentication failed' : 'connection failed',\n fix: 'Verify `POSTGRES_PASSWORD` in the container env matches `PG_ADMIN_PASSWORD` (and the embedded '\n + 'password in `PG_CONNECT_URL`, when present) in the apps-manager `.env`. If they drifted, the '\n + 'cleanest path is `wildo local reset` (destructive — wipes data).',\n };\n }\n }\n\n private checkValkey(): CheckResult[] {\n const password = this.readValkeyPassword();\n if (!password) {\n return [{\n name: 'valkey admin auth',\n status: LocalPreconditionCheckStatus.WARN,\n detail: 'could not locate platform-apps-manager .env to extract VALKEY/REDIS admin password',\n fix: 'Run `wildo config sync` to (re-)emit the platform-apps-manager .env file.',\n }];\n }\n\n const results: CheckResult[] = [];\n\n try {\n const ping = execSync(\n `docker exec wildo-valkey valkey-cli -a '${password.replace(/'/g, \"'\\\\''\")}' PING`,\n { encoding: 'utf-8', stdio: 'pipe' },\n ).trim();\n if (!ping.includes('PONG')) {\n results.push({\n name: 'valkey admin auth',\n status: LocalPreconditionCheckStatus.FAIL,\n detail: `unexpected PING response: ${ping}`,\n });\n return results;\n }\n results.push({ name: 'valkey admin auth', status: LocalPreconditionCheckStatus.PASS });\n } catch (err) {\n const msg = ErrorUtils.extractErrorMessage(err);\n results.push({\n name: 'valkey admin auth',\n status: LocalPreconditionCheckStatus.FAIL,\n detail: msg.includes('WRONGPASS') ? 'WRONGPASS' : 'auth failed',\n fix: 'Verify `VALKEY_PASSWORD` in the container env matches `REDIS_ADMIN_PASSWORD` in the apps-manager `.env`. If drift is recent, `wildo local reset` (destructive — wipes data) is the cleanest path.',\n });\n return results;\n }\n\n // Stale per-app ACL entries.\n try {\n const out = execSync(\n `docker exec wildo-valkey valkey-cli -a '${password.replace(/'/g, \"'\\\\''\")}' ACL LIST`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n const names = out\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line.startsWith('user '))\n .map((line) => line.split(/\\s+/)[1])\n .filter((n): n is string => Boolean(n));\n const stale = names.filter((n) => !CANONICAL_VALKEY_ACL_USERS.has(n));\n if (stale.length === 0) {\n results.push({ name: 'valkey per-app ACLs', status: LocalPreconditionCheckStatus.PASS, detail: '(no stale entries)' });\n } else {\n results.push({\n name: 'valkey per-app ACLs',\n status: LocalPreconditionCheckStatus.WARN,\n detail: `${stale.length} non-canonical ACL(s): ${stale.join(', ')}`,\n fix: stale\n .map((u) => `docker exec wildo-valkey valkey-cli -a '<VALKEY_PASSWORD>' ACL DELUSER ${u}`)\n .join(' && '),\n });\n }\n } catch {\n // best-effort\n }\n\n return results;\n }\n\n /**\n * @param isFrameworkDeveloper decides WHOSE remedy is printed. Both strings below used to be the\n * framework-developer one unconditionally, so an application creator — who has no monorepo and no\n * `examples/wonder-todos/` — was told to \"Start the platform with `pnpm dev` from the monorepo\n * root\". Observed on the first real app-creator `local doctor` run (2026-09-09): three failing\n * checks, three remedies naming paths that do not exist on that machine. A diagnostic that names\n * an unreachable remedy is worse than one that names none: it sends the operator looking for a\n * checkout they were never supposed to have.\n */\n private async checkHttp(label: string, url: string, isFrameworkDeveloper: boolean): Promise<CheckResult> {\n const endpointPath = new URL(url).pathname;\n const resultName = `${label} ${endpointPath}`;\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), 2_000);\n try {\n const res = await fetch(url, { signal: controller.signal, redirect: 'manual' });\n if (res.ok) {\n return { name: resultName, status: LocalPreconditionCheckStatus.PASS, detail: `HTTP ${res.status}` };\n }\n return {\n name: resultName,\n status: LocalPreconditionCheckStatus.FAIL,\n detail: `HTTP ${res.status}`,\n fix: isFrameworkDeveloper\n ? 'Tail logs to diagnose. apps-manager + crontabs-batches-manager are started by `pnpm dev` from the monorepo root; companion by the WT `pnpm dev`.'\n : 'Tail logs to diagnose (`wildo local logs`). The platform services run as containers started by `wildo local up`; the companion by `wildo local dev`.',\n };\n } catch (err) {\n const isAbort = err instanceof Error && (err.name === 'AbortError' || err.name === 'TimeoutError');\n const code = (err as Error & { cause?: { code?: string } }).cause?.code;\n return {\n name: resultName,\n status: LocalPreconditionCheckStatus.FAIL,\n detail: isAbort ? 'request timed out' : (code ?? ErrorUtils.extractErrorMessage(err)),\n fix: code === 'ECONNREFUSED'\n ? `Service is not running. ${\n isFrameworkDeveloper\n ? (label === 'dev-companion'\n ? 'Start the WT stack from `examples/wonder-todos/`.'\n : 'Start the platform with `pnpm dev` from the monorepo root.')\n : (label === 'dev-companion'\n ? 'Start this application\\'s companion with `wildo local dev` (`wildo dev start` does not start it).'\n : 'Start the platform with `wildo local up` from this application root.')\n }`\n : 'Inspect logs for the failing service.',\n };\n } finally {\n clearTimeout(timer);\n }\n }\n\n /**\n * Flag every running wildo container whose IMAGE architecture differs from the\n * host's — those run under Rosetta (macOS) or QEMU (Linux), a several-fold CPU\n * multiplier that `docker stats` attributes to nothing (the emulation cost is\n * billed to the VM process, outside every container cgroup). Containers in\n * `DECLARED_NON_NATIVE_CONTAINERS` pass with an explanatory detail; one of them\n * running NATIVE is also surfaced, because it means the upstream image gained a\n * native build and the exception (plus its template `platform:` pin) is stale.\n */\n private checkContainerArchitectures(containers: string[]): CheckResult[] {\n if (containers.length === 0) return [];\n // Node arch vocabulary → Docker image arch vocabulary. Only the two hosts the\n // framework actually targets; an exotic host arch degrades to a single warn.\n const hostArch = process.arch === 'arm64' ? 'arm64' : process.arch === 'x64' ? 'amd64' : null;\n if (hostArch === null) {\n return [{\n name: 'container architecture',\n status: LocalPreconditionCheckStatus.WARN,\n detail: `unrecognized host arch '${process.arch}' — emulation check skipped`,\n }];\n }\n let inspected: string;\n try {\n // Container inspect exposes the image ID, not its architecture — resolve in\n // two batch calls instead of 2×N single ones.\n inspected = execSync(\n `docker inspect --format '{{.Name}}\\t{{.Image}}' ${containers.map((c) => `\"${c}\"`).join(' ')}`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n } catch (err) {\n return [{\n name: 'container architecture',\n status: LocalPreconditionCheckStatus.WARN,\n detail: `docker inspect failed: ${ErrorUtils.extractErrorMessage(err)}`,\n }];\n }\n const imageByContainer = new Map<string, string>();\n for (const line of inspected.split('\\n')) {\n const [rawName, imageId] = line.trim().split('\\t');\n if (rawName && imageId) imageByContainer.set(rawName.replace(/^\\//, ''), imageId);\n }\n const archByImage = new Map<string, string>();\n try {\n const imageIds = [...new Set(imageByContainer.values())];\n const archOut = execSync(\n `docker image inspect --format '{{.Id}}\\t{{.Architecture}}' ${imageIds.map((i) => `\"${i}\"`).join(' ')}`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n for (const line of archOut.split('\\n')) {\n const [id, arch] = line.trim().split('\\t');\n if (id && arch) archByImage.set(id, arch);\n }\n } catch {\n // fall through — unknown arches are reported as such below\n }\n\n const results: CheckResult[] = [];\n let emulatedCount = 0;\n for (const [name, imageId] of imageByContainer) {\n const imageArch = archByImage.get(imageId);\n if (!imageArch || imageArch === hostArch) {\n if (DECLARED_NON_NATIVE_CONTAINERS.has(name) && imageArch === hostArch) {\n results.push({\n name: `native image for ${name}`,\n status: LocalPreconditionCheckStatus.WARN,\n detail: `runs NATIVE (${imageArch}) but is declared amd64-only`,\n fix: 'Upstream apparently gained a native build — remove it from DECLARED_NON_NATIVE_CONTAINERS and drop the `platform:` pin in docker-compose.wildo-platform.yml.hbs.',\n });\n }\n continue;\n }\n emulatedCount += 1;\n if (DECLARED_NON_NATIVE_CONTAINERS.has(name)) {\n results.push({\n name: `emulated container ${name}`,\n status: LocalPreconditionCheckStatus.PASS,\n detail: `${imageArch} on ${hostArch} — declared exception (no native image upstream)`,\n });\n continue;\n }\n results.push({\n name: `emulated container ${name}`,\n status: LocalPreconditionCheckStatus.WARN,\n detail: `image is ${imageArch}, host is ${hostArch} — running under ${process.platform === 'darwin' ? 'Rosetta' : 'QEMU'}`,\n fix: 'Pin a native tag in templates/infra/docker-compose/docker-compose.wildo-platform.yml.hbs, then `wildo config sync` + recreate. If no native image exists, declare it in DECLARED_NON_NATIVE_CONTAINERS.',\n });\n }\n if (emulatedCount === 0) {\n results.push({ name: 'container architecture', status: LocalPreconditionCheckStatus.PASS, detail: `all native ${hostArch}` });\n }\n return results;\n }\n\n /**\n * Declared frontend providers missing a key their module requires (#2658 context), read from the artifacts the\n * last `wildo config sync` wrote. A WARN, never a FAIL: an application without a vendor account still runs, and\n * the provider is simply absent. An artifact written before the required-key list existed is named as such,\n * never reported as \"configured\".\n */\n private checkFrontendProviderKeys(saasRoot: string): CheckResult {\n const name = 'frontend provider keys';\n const report = readFrontendProviderKeyReportOnDisk(saasRoot);\n if (report === null) {\n return { name, status: LocalPreconditionCheckStatus.PASS, detail: 'no generated provider configuration yet (run `wildo config sync`)' };\n }\n const lines = report.notConfigured.map((entry) => describeFrontendProviderNotConfigured(entry));\n if (report.predatingEntries.length > 0) {\n const named = report.predatingEntries.map((entry) => `\"${entry.providerRef}\" on service \"${entry.serviceKey}\"`).join(', ');\n lines.push(`The generated provider configuration predates the required-key check, so it cannot say whether ${named} ${report.predatingEntries.length > 1 ? 'are' : 'is'} configured: run \\`wildo config sync\\`.`);\n }\n if (lines.length === 0) {\n return { name, status: LocalPreconditionCheckStatus.PASS, detail: 'every declared frontend provider has the keys it requires' };\n }\n return { name, status: LocalPreconditionCheckStatus.WARN, detail: lines.join('\\n') };\n }\n\n /**\n * Surface `wildo-shared-pg-*` integration-test servers older than the harness TTL.\n * Observation only — the authoritative reaper lives in the test harness's global\n * setup and fires on the next Vitest run; the doctor exists for the window where\n * nobody runs tests and the leak would otherwise accumulate silently.\n */\n private checkLeakedTestContainers(): CheckResult {\n let listing: string;\n try {\n listing = execSync(\n 'docker ps --filter name=wildo-shared-pg- --format \"{{.Names}}\\t{{.CreatedAt}}\"',\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n } catch (err) {\n return { name: 'leaked test containers', status: LocalPreconditionCheckStatus.WARN, detail: ErrorUtils.extractErrorMessage(err) };\n }\n const names = listing.split('\\n').map((l) => l.trim()).filter(Boolean).map((l) => l.split('\\t')[0]);\n if (names.length === 0) {\n return { name: 'leaked test containers', status: LocalPreconditionCheckStatus.PASS, detail: 'no wildo-shared-pg-* containers' };\n }\n const leaked: string[] = [];\n try {\n // `.Created` is ISO 8601 (parseable), unlike `docker ps`'s locale-shaped column.\n const inspected = execSync(\n `docker inspect --format '{{.Name}}\\t{{.Created}}' ${names.map((n) => `\"${n}\"`).join(' ')}`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n const now = Date.now();\n for (const line of inspected.split('\\n')) {\n const [rawName, created] = line.trim().split('\\t');\n if (!rawName || !created) continue;\n const ageMs = now - Date.parse(created);\n if (Number.isFinite(ageMs) && ageMs > SHARED_PG_LEAK_TTL_MS) {\n leaked.push(`${rawName.replace(/^\\//, '')} (${Math.round(ageMs / 3_600_000)}h)`);\n }\n }\n } catch (err) {\n return { name: 'leaked test containers', status: LocalPreconditionCheckStatus.WARN, detail: ErrorUtils.extractErrorMessage(err) };\n }\n if (leaked.length === 0) {\n return {\n name: 'leaked test containers',\n status: LocalPreconditionCheckStatus.PASS,\n detail: `${names.length} test container${names.length === 1 ? '' : 's'} within TTL (likely live Vitest runs)`,\n };\n }\n return {\n name: 'leaked test containers',\n status: LocalPreconditionCheckStatus.WARN,\n detail: leaked.join(', '),\n fix: 'They self-reap on the next saas-backend-lib test run; to sweep now: `docker ps --filter name=wildo-shared-pg -q | xargs docker rm -fv` (only when no Vitest run is active).',\n };\n }\n\n // ────────────────────────────────────────────────────────────────────\n // Credential extraction (read-only — never writes anything)\n // ────────────────────────────────────────────────────────────────────\n\n private appsManagerEnvPath(): string {\n // Resolve from `process.cwd()` is unreliable (CLI may run from anywhere\n // in the monorepo). The canonical path is anchored at the framework\n // repo root, which we infer by walking up from this file.\n // For doctor's purposes, walking from CWD upward to find the\n // `platform/` sibling is enough — the worst case is we return null\n // and the auth check warns instead of failing loud.\n let dir = process.cwd();\n for (let i = 0; i < 8; i++) {\n const candidate = join(dir, 'platform', 'platform-back-office', 'platform-apps-manager', '.env');\n if (existsSync(candidate)) return candidate;\n const parent = join(dir, '..');\n if (parent === dir) break;\n dir = parent;\n }\n return '';\n }\n\n private readMongoCreds(): { user: string; pass: string } | null {\n const envPath = this.appsManagerEnvPath();\n if (!envPath || !existsSync(envPath)) return null;\n const raw = readFileSync(envPath, 'utf-8');\n // Parse mongo://user:pass@host from MONGO_CONNECT_URL line.\n const match = raw.match(/^MONGO_CONNECT_URL=mongodb:\\/\\/([^:]+):([^@]+)@/m);\n if (!match) return null;\n return { user: match[1], pass: match[2] };\n }\n\n /** The PG mirror of `readMongoCreds` — the admin trio from the same apps-manager `.env`. */\n private readPostgresCreds(): { user: string; pass: string; database: string } | null {\n const envPath = this.appsManagerEnvPath();\n if (!envPath || !existsSync(envPath)) return null;\n const raw = readFileSync(envPath, 'utf-8');\n const user = raw.match(/^PG_ADMIN_USER=(.+)$/m)?.[1]?.trim();\n const pass = raw.match(/^PG_ADMIN_PASSWORD=(.+)$/m)?.[1]?.trim();\n const database = raw.match(/^PG_ADMIN_DATABASE=(.+)$/m)?.[1]?.trim();\n if (!user || !pass || !database) return null;\n return { user, pass, database };\n }\n\n private readValkeyPassword(): string | null {\n const envPath = this.appsManagerEnvPath();\n if (!envPath || !existsSync(envPath)) return null;\n const raw = readFileSync(envPath, 'utf-8');\n const match = raw.match(/^REDIS_ADMIN_PASSWORD=(.+)$/m);\n return match ? match[1].trim() : null;\n }\n\n private detectCompanionPort(saasRoot: string): number | null {\n // Best-effort: read the local infra config for `devCompanion.port`.\n // We don't parse the TS — just grep for the port literal, which is\n // good enough for a diagnostic.\n const candidate = join(saasRoot, 'infrastructure', 'local', 'wildo.infra.local.config.ts');\n if (!existsSync(candidate)) return null;\n const raw = readFileSync(candidate, 'utf-8');\n const match = raw.match(/devCompanion\\s*:\\s*\\{[^}]*port\\s*:\\s*(\\d+)/);\n return match ? Number.parseInt(match[1], 10) : null;\n }\n\n // ────────────────────────────────────────────────────────────────────\n // Output\n // ────────────────────────────────────────────────────────────────────\n\n private render(ctx: CommandContext, results: CheckResult[], asJson: boolean): void {\n if (asJson) {\n writeJsonDocument(results, JsonDocumentLayout.INDENTED);\n return;\n }\n\n const passCount = results.filter((r) => r.status === LocalPreconditionCheckStatus.PASS).length;\n const warnCount = results.filter((r) => r.status === LocalPreconditionCheckStatus.WARN).length;\n const failCount = results.filter((r) => r.status === LocalPreconditionCheckStatus.FAIL).length;\n\n ctx.log.info(chalk.cyan('\\n Local infrastructure diagnostic\\n'));\n for (const r of results) {\n const icon = r.status === LocalPreconditionCheckStatus.PASS ? chalk.green('✓')\n : r.status === LocalPreconditionCheckStatus.WARN ? chalk.yellow('⚠')\n : chalk.red('✗');\n const detail = r.detail ? chalk.dim(` (${r.detail})`) : '';\n ctx.log.info(` ${icon} ${r.name}${detail}`);\n if (r.fix && r.status !== LocalPreconditionCheckStatus.PASS) {\n ctx.log.info(` ${chalk.dim('fix:')} ${r.fix}`);\n }\n }\n\n ctx.log.info('');\n const summary = `${passCount} passing`\n + (warnCount > 0 ? `, ${warnCount} warning${warnCount === 1 ? '' : 's'}` : '')\n + (failCount > 0 ? `, ${failCount} failure${failCount === 1 ? '' : 's'}` : '');\n if (failCount > 0) {\n ctx.log.error(` ${summary}`);\n } else if (warnCount > 0) {\n ctx.log.warn(` ${summary}`);\n } else {\n ctx.log.success(` ${summary}`);\n }\n ctx.log.info('');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"doctor.command.js","sourceRoot":"","sources":["../../../../src/commands/local/doctor.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAA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C,CAAC;IACnB,CAAC;CACF","sourcesContent":["/**\n * `wildo local doctor` — read-only infrastructure diagnostic.\n *\n * Diagnoses the recurring failure modes that have historically forced\n * developers to either reach for `wildo local reset` (destructive, wipes\n * all data) or debug by hand with `nc`/`mongosh`/`valkey-cli`. Each\n * check emits a single-line status + a one-line fix suggestion when it\n * fails, so the operator can self-serve without searching plan files\n * or pinging the framework owners.\n *\n * Coverage splits into PRECONDITIONS (checks 1–1c: can this machine run the\n * stack at all?) and RUNTIME PROBES (checks 2 onwards: is the running stack\n * healthy?). The preconditions are shared verbatim with the `wildo local dev`\n * preflight — see `services/deployment/local-precondition-checks.service.ts`\n * for why each exists and which real fresh-install failure it closes — and\n * they run BEFORE the Docker-daemon early-return, because none of them needs a\n * daemon and an operator whose Docker is merely not launched should still\n * learn that their Compose is too old and their artifacts unmaterialized.\n *\n * 1. Docker daemon — `docker info` exits 0.\n * 1a. **Docker Compose version** — the plugin must accept `start_interval`\n * (>= 2.24 / Docker Desktop >= 25) or the generated compose project is\n * rejected wholesale, LATE, mid-`local dev`. FAIL.\n * 1b. **Generated provider-runtime modules** — every runtime host a\n * `wildo config sync` would give a\n * `src/generated/wildo-provider-runtime.generated.ts` must have it; the\n * host imports it, so absence is an endlessly repeating `TS2307`. FAIL.\n * 1b'. **Generated provider-runtime artifact content** — a PRESENT artifact its reader would refuse\n * (#2254): a framework release can change what the readers require while no input changes, so a\n * file can exist and still stop its process. Applies what each reader applies — see\n * `findRefusedProviderRuntimeArtifacts`. FAIL; `wildo local dev` regenerates such a file at start.\n * 1c. **Orphaned dev watchers** — `tsc-watch` single-writers reparented to\n * init still hold `dist/esm/.builder.pid`, so every new watcher refuses\n * to become a second writer and readiness blocks forever. WARN\n * (recoverable with `wildo dev force-stop`), and detected only — this\n * command never kills anything.\n * 1d. **Derived-artifact currency** — the one question nothing here asked:\n * *is what I am RUNNING current?* Dists against source, injected `file:`\n * snapshots against framework dist (by FILE SET), accepted-generation\n * manifests against the paths they name, virtual-store keys against the\n * links that reach them, the config-loader cache against its inputs, and\n * each supervised process's START against the build it loads. Eight\n * development-stack failures over 2026-08-27/28 were this and nothing else\n * (issue #86); three were misdiagnosed as semantic defects in committed\n * code. WARN, never fatal — every remedy is \"delete this generated thing\n * and let it rebuild\", which needs the stack a hard stop would have taken\n * down. `doctor` only, never the `dev` preflight.\n * 2. Container state — every wildo backing-service container is up +\n * healthy, and is not crash-looping (restart count, with its last failure line).\n * 3. **Loopback binding** — `net.connect` to each container's exposed\n * port on **127.0.0.1** (NOT 0.0.0.0). Catches the Docker Desktop\n * port-table corruption we hit on 2026-05-19: container says\n * \"0.0.0.0:27017 -> 27017/tcp\" but `127.0.0.1` source-port\n * allocation fails with `EADDRNOTAVAIL`.\n * 4. Mongo admin auth — round-trip with the root credentials emitted\n * into the platform `.env` files; confirms creds match what the\n * container actually has.\n * 5. Valkey admin auth — same.\n * 6. **Application users** — enumerate Mongo `admin.system.users`\n * and Valkey ACL entries that the platform does not own, and LIST them.\n * Leftovers of a removed application persist across `local up`/`local\n * down` cycles and across `wildo_platform` database drops, and can\n * surface as `WRONGPASS` or `Authentication failed`. But every\n * registered application has users of its own here too, and the\n * doctor reads no registration, so it cannot tell a leftover from a\n * live one: the check is informational and suggests no deletion\n * (#3704 — it used to WARN on every healthy stack and print a command\n * that would drop the running application's own user and the mongot\n * sync user).\n * 7. Platform services HTTP — apps-manager (5151), crontabs-batches-\n * manager (5152) `/health` responses.\n * 8. Companion semantic readiness — companion (4341) `/health/ready` if the active\n * workspace declares one.\n * 9. **Emulated containers** — every running wildo container whose image\n * architecture differs from the host's runs under Rosetta/QEMU, a\n * several-fold CPU multiplier billed to the Docker VM, invisible in\n * `docker stats`. Measured 2026-08-10: an amd64-only immudb pin kept\n * the audit store permanently emulated on Apple Silicon. Declared\n * amd64-only images (clamav — Cisco publishes no arm64) are excepted.\n * 10. **Leaked integration-test containers** — `wildo-shared-pg-*`\n * servers are provisioned per Vitest run by saas-backend-lib's\n * shared-postgres global setup and self-reap on the NEXT run; one\n * older than the 3 h TTL with no run happening means the fleet is\n * accumulating idle PostgreSQL daemons in the VM (sixteen were found\n * the day this check was written).\n *\n * Zero side effects. Safe to run at any time.\n */\n\nimport chalk from 'chalk';\nimport { execSync } from 'child_process';\nimport { existsSync, readFileSync } from 'fs';\nimport { connect } from 'net';\nimport { join } from 'path';\nimport { BaseCommand } from '~wildo-cli/kernel/base-command';\nimport { DockerUtils } from '~wildo-cli/services/deployment/docker/docker.service';\nimport { CommandCategory } from '~wildo-cli/kernel/types';\nimport { ErrorUtils } from '~wildo-cli/infrastructure/errors/error.utils';\nimport { MONGOT_SYNC_SOURCE } from '~wildo-cli/services/data-services/data-services.schemas';\nimport type { CommandMeta, CommandContext, CommandResult } from '~wildo-cli/kernel/types';\nimport { WildoDeploymentRuntime, WildoLocationType } from '@wildo-ai/platform-config-lib';\nimport { collectCreationPreflightChecks } from '~wildo-cli/services/application/creation-preflight.service';\nimport {\n aiUseDeclarationsCheck,\n assessApplicationAiUseDeclarations,\n readAgentAiUseDeclarationsFromCompanion,\n} from '~wildo-cli/services/application/ai-use-declarations.service';\nimport { resolveCompanionClientOptionsFromContext } from '~wildo-cli/services/companion/companion-client-options.utils';\nimport { readFrontendProviderKeyReportOnDisk } from '~wildo-cli/services/application/frontend-providers-not-configured.service';\nimport { describeFrontendProviderNotConfigured } from '@wildo-ai/saas-models';\nimport {\n checkSpecificationFindings,\n collectLocalPreconditionChecks,\n readSpecificationFindingsFromCompanion,\n} from '~wildo-cli/services/deployment/local-precondition-checks.service';\nimport {\n CONTENT_GUARDRAIL_CLASSIFIER_CHECK_NAME,\n EnvironmentProviderEnvReadingKind,\n contentGuardrailClassifierCheck,\n guardedAgentRefs,\n guardrailsDeclaredBy,\n readEnvironmentClassifiers,\n readEnvironmentProviderEnv,\n} from '~wildo-cli/services/application/content-guardrail-classifier.service';\nimport { getComposedProviderSecretsCatalogue, resolveAndRegisterSaasProviderContributions } from '~wildo-cli/services/credentials/composed-provider-catalogue';\nimport { collectProviderConfigurationChecks } from '~wildo-cli/services/registry/provider-configuration-checks.service';\nimport { settleAllAuthoredInfraEnvConfigs } from '~wildo-cli/services/environment/authored-infra-config.utils';\nimport { EnvironmentUtils } from '~wildo-cli/services/environment/environment.service';\nimport { loadSaasConfig, WORKSPACE_CONFIG_NAMES } from '@wildo-ai/platform-config-lib';\nimport {\n LocalPreconditionCheckStatus,\n type LocalPreconditionCheckResult,\n} from '~wildo-cli/services/deployment/local-precondition-checks.schemas';\nimport { InfrastructureHost } from '~wildo-cli/services/environment/infrastructure-host.service';\nimport { collectHostedInfrastructureLeftovers } from '~wildo-cli/services/environment/hosted-infrastructure-leftovers.service';\nimport { JsonDocumentLayout, writeJsonDocument } from '~wildo-cli/kernel/json-document-output';\nimport {\n StoredDeclarationCurrency,\n StoredDeclarationCurrencyService,\n} from '~wildo-cli/services/application/stored-declaration-currency.service';\n\n// Canonical admin user names baked into the framework's container images.\n// Anything else in the user/ACL list is a per-app (or scoped) entry\n// that's a candidate for the stale-credentials class of failure.\n/** MongoDB users the PLATFORM owns: its root, and the identity mongot syncs as (#3704). */\nconst CANONICAL_MONGO_ADMINS = new Set(['wildo', MONGOT_SYNC_SOURCE.USERNAME]);\n\n/**\n * The doctor's report of the users in a platform data service that the platform does not own (#3704).\n *\n * Informational on purpose. Each registered application has users of its own in these services, and the doctor reads no\n * registration, so it cannot tell a live application's user from a leftover of a removed one. It used to WARN on every\n * healthy stack and print a command dropping each user — including the running application's own and the mongot sync\n * user, which would have broken the application and search — with the platform admin password inline, which `--json`\n * output then carried into a CI artifact. So: no status above PASS, no suggested deletion, no credential.\n */\nexport function describeApplicationDataServiceUsers(name: string, users: readonly string[]): LocalPreconditionCheckResult {\n return {\n name,\n status: LocalPreconditionCheckStatus.PASS,\n detail: users.length === 0\n ? '(none besides the platform\\'s own)'\n : `${users.length} not owned by the platform: ${users.join(', ')} — each belongs to a registered application or is `\n + 'left over from a removed one; check the registration before removing any',\n };\n}\nconst CANONICAL_VALKEY_ACL_USERS = new Set(['default']);\n\n/**\n * Containers ALLOWED to run non-native, because no native image exists upstream.\n * Keep in lockstep with the `platform: linux/amd64` pins in\n * `templates/infra/docker-compose/docker-compose.wildo-platform.yml.hbs` — a\n * container listed here without a template pin (or vice-versa) is drift.\n * clamav: Cisco publishes no arm64 manifests (re-verified 2026-08-10).\n */\nconst DECLARED_NON_NATIVE_CONTAINERS = new Set(['wildo-clamav']);\n\n/**\n * TTL after which a `wildo-shared-pg-*` integration-test container counts as leaked.\n * Mirrors `MAX_CONTAINER_AGE_MS` in saas-backend-lib's\n * `src/__tests__/shared-postgres.global-setup.mjs` (the reaping side of the same\n * contract); the doctor only OBSERVES, because reaping belongs to the test harness.\n */\nconst SHARED_PG_LEAK_TTL_MS = 3 * 3_600_000;\n\n/**\n * One diagnostic line. Aliased to the shared precondition result so the\n * precondition checks and this command's own runtime probes render through the\n * same path — a precondition line without a `fix:` would be indistinguishable\n * from a probe line that has one.\n */\ntype CheckResult = LocalPreconditionCheckResult;\n\n/** The agents' declarations as the companion answered them, or why they could not be read. */\ntype AgentDeclarationsRead = Awaited<ReturnType<typeof readAgentAiUseDeclarationsFromCompanion>>;\n\n/**\n * How long doctor waits for the dev companion to answer the agents' AI-use declarations (#2848). The introspection\n * imports the application's compiled backend in a subprocess, which takes seconds; past this the agent half of the\n * line is reported as not probed rather than holding the whole diagnostic.\n */\nconst AI_USE_DECLARATIONS_COMPANION_TIMEOUT_MS = 30_000;\n\nexport default class LocalDoctorCommand extends BaseCommand {\n readonly meta: CommandMeta = {\n name: 'local doctor',\n description: 'Read-only infrastructure diagnostic — Docker, container ports, backing-service auth, stale credentials, platform/companion health',\n category: CommandCategory.Local,\n flags: {\n json: {\n type: 'boolean',\n description: 'Emit structured JSON (one object per check) instead of the formatted table — useful for piping into other tools.',\n default: false,\n },\n },\n };\n\n async run(ctx: CommandContext): Promise<CommandResult> {\n const env = ctx.activeEnv;\n if (!env) {\n ctx.log.error('No active environment. Run `wildo init` first.');\n return { success: false };\n }\n if (env.locationType === WildoLocationType.REMOTE) {\n ctx.log.error('`wildo local doctor` is for LOCAL environments only.');\n return { success: false };\n }\n if (env.runtime === WildoDeploymentRuntime.KUBERNETES) {\n ctx.log.warn('K8s local-doctor coverage is not implemented yet — running Docker-Compose checks only.');\n }\n\n const asJson = ctx.flags.json === true;\n const results: CheckResult[] = [];\n\n // ─── 1. Docker daemon ──────────────────────────────────────────────\n const dockerDaemon = this.checkDockerDaemon();\n results.push(dockerDaemon);\n const dockerUp = dockerDaemon.status === LocalPreconditionCheckStatus.PASS;\n\n // ─── 1a–1c. Preconditions (shared with the `local dev` preflight) ──\n // Ordered before the daemon early-return on purpose: none of these needs a\n // running daemon, and a fresh-install operator who simply has not launched\n // Docker Desktop yet should still learn about an old Compose plugin, an\n // unsynced app, and orphaned watchers in the SAME run rather than one per\n // relaunch.\n results.push(...(await collectLocalPreconditionChecks({\n saasRoot: ctx.cliContext.resolvedHomes.app.declarationRoot,\n frameworkPath: ctx.cliContext.resolvedHomes.framework.repositoryRoot,\n isFrameworkDeveloper: ctx.preferences?.isFrameworkDeveloper ?? false,\n codingAgentPreference: ctx.preferences?.defaults?.codingAgent,\n // `doctor` is the diagnostic surface a human asked for, so it pays the\n // cost of actually starting the coding agent to see whether it answers.\n includeCodingAgentProbe: true,\n // Same trade for the currency sweep: several seconds of I/O across every dist\n // tree, injected snapshot and virtual-store key, which is what a human running\n // `doctor` wants and what the `dev` preflight must not pay on every start.\n includeDerivedArtifactCurrencySweep: true,\n})));\n\n // ─── 1d. Infrastructure owner ──────────────────────────────────────\n // Stated before the runtime probes because it changes what they describe: for a HOSTED environment\n // every container and platform check below reads the HOST's substrate, and every repair they suggest\n // (`wildo local up`, `wildo local reset`, `wildo config sync` of shared files) is run from the host.\n try {\n const hostedBy = await InfrastructureHost.resolveForCommand(ctx.cliContext.resolvedHomes.app.declarationRoot, env);\n if (hostedBy !== null) {\n results.push({\n name: 'Infrastructure host',\n status: LocalPreconditionCheckStatus.PASS,\n detail: `Runs on the infrastructure of ${hostedBy.applicationRoot}. The container and platform checks below describe `\n + 'the host\\'s substrate; run any repair they suggest from the host application.',\n });\n\n /*\n * The artifacts this application wrote while it OWNED its infrastructure are still on disk and are\n * now inert (#1194). Reported rather than removed: the stale compose render claims the host's own\n * container names, so it is worth seeing, and its data directory may still hold the only copy of\n * something the operator wants.\n */\n const hostedSaasRoot = ctx.cliContext.resolvedHomes.app.declarationRoot;\n const leftovers = hostedSaasRoot\n ? collectHostedInfrastructureLeftovers({ saasRoot: hostedSaasRoot, envName: env.name })\n : [];\n if (leftovers.length > 0) {\n results.push({\n name: 'Pre-hosting infrastructure artifacts',\n status: LocalPreconditionCheckStatus.WARN,\n detail: `${leftovers.length} artifact(s) predating this environment's move onto ${hostedBy.applicationRoot} are `\n + 'still on disk. They are INERT — this environment reads its host\\'s compose project and shared credentials — '\n + `but they read as live configuration: ${leftovers.map((leftover) => `${leftover.what} → ${leftover.path}`).join('; ')}`,\n fix: 'Read each path first, then remove what you no longer want; a hosted application needs none of them. '\n + 'The shared credential sections disappear on their own at the next `wildo config sync --domain secrets`.',\n });\n }\n }\n } catch (error) {\n results.push({\n name: 'Infrastructure host',\n status: LocalPreconditionCheckStatus.FAIL,\n detail: ErrorUtils.extractErrorMessage(error),\n fix: 'Check the host application out at the path infrastructureHost.applicationRoot names, or remove infrastructureHost to run on this application\\'s own infrastructure.',\n });\n }\n\n if (!dockerUp) {\n this.render(ctx, results, asJson);\n return { success: false };\n }\n\n // ─── 2. Container state ────────────────────────────────────────────\n const containers = this.listWildoContainers();\n for (const containerName of containers) {\n results.push(this.checkContainerHealthy(containerName));\n }\n\n // ─── 3. Loopback binding (127.0.0.1) ───────────────────────────────\n const ports = this.collectContainerPorts(containers);\n for (const [serviceLabel, port] of ports) {\n results.push(await this.checkLoopbackBinding(serviceLabel, port));\n }\n\n // ─── 4 + 5. Mongo + Valkey admin auth + stale users ───────────────\n if (containers.includes('wildo-mongodb')) {\n results.push(...this.checkMongo());\n }\n if (containers.includes('wildo-valkey')) {\n results.push(...this.checkValkey());\n }\n if (containers.includes('wildo-postgresql')) {\n results.push(this.checkPostgres());\n }\n\n // ─── 7. Platform service HTTP /health ─────────────────────────────\n const isFrameworkDeveloper = ctx.preferences?.isFrameworkDeveloper ?? false;\n results.push(await this.checkHttp('apps-manager', 'http://localhost:5151/health', isFrameworkDeveloper));\n results.push(await this.checkHttp('crontabs-batches-manager', 'http://localhost:5152/health', isFrameworkDeveloper));\n\n // ─── 8. Companion HTTP semantic readiness (best-effort) ──────────\n const saasRoot = ctx.cliContext.resolvedHomes.app.declarationRoot;\n if (saasRoot) {\n const companionPort = this.detectCompanionPort(saasRoot);\n if (companionPort) {\n results.push(await this.checkHttp('dev-companion', `http://localhost:${companionPort}/health/ready`, isFrameworkDeveloper));\n }\n }\n\n // ─── 9. Emulated containers (image arch vs host arch) ─────────────\n results.push(...this.checkContainerArchitectures(containers));\n\n // ─── 10. Leaked integration-test containers ───────────────────────\n results.push(this.checkLeakedTestContainers());\n\n // ─── 11. Authored declaration vs stored managed config ────────────\n // Placed after the apps-manager health probe on purpose: the question can\n // only be answered by a running apps-manager, and asking a dead one would\n // produce a \"cannot compare\" line beside the health line that already said\n // why.\n results.push(await this.checkDeclarationCurrency(ctx));\n\n // ─── 11b. Declared frontend providers have their keys ─────────────\n // Read from the artifacts the last `wildo config sync` wrote: a provider declared without the key its module\n // requires is absent from every page, and until this check a browser was the only place that said so.\n if (saasRoot) {\n results.push(this.checkFrontendProviderKeys(saasRoot));\n }\n\n // ─── 12. Can the application-creation journey START? ──────────────\n //\n // A different question from every check above, which ask whether the STACK is up. These ask\n // whether the journey will run, and each corresponds to a refusal that exists in the runtime —\n // measured on a freshly created application, where all of them were discovered by hitting them,\n // one of them only after an operator had answered a fifteen-question interview (#1302).\n //\n // Last on purpose: they read the application's declared configuration and its discovered provider\n // contributions, neither of which is worth reporting while the stack itself is broken.\n //\n // The SAME collector `wildo creation preflight` prints and `wildo creation run` refuses on (#2229), so the\n // two surfaces cannot disagree about whether a run can finish.\n if (saasRoot) {\n results.push(...await collectCreationPreflightChecks({\n saasRoot,\n envName: env.name,\n frameworkRoot: ctx.cliContext.resolvedHomes.framework.repositoryRoot,\n }));\n }\n\n // ─── 13. Which AI uses still owe a declaration (#2848) ────────────\n //\n // A WARN, never a FAIL, and not a creation-readiness check: the runtime refuses nothing for an undeclared use,\n // and the privacy notice lists it as outstanding. The agents are read from the running companion; without one,\n // the agent half is reported as not probed rather than guessed.\n if (saasRoot) {\n // One companion read for both agent lines: the AI-use declarations and the content-guardrail classifier.\n const agentsRead = this.detectCompanionPort(saasRoot)\n ? await readAgentAiUseDeclarationsFromCompanion(await resolveCompanionClientOptionsFromContext(ctx, AI_USE_DECLARATIONS_COMPANION_TIMEOUT_MS))\n : { notReadBecause: 'the dev companion is not running' };\n results.push(await this.checkAiUseDeclarations(saasRoot, agentsRead));\n\n // ─── 14. Which environments can serve the agents' content guardrails (#2292) ────\n //\n // A WARN, never a FAIL: an agent declaring prompt-injection screening or output moderation refuses every turn in\n // an environment where no AI_CONTENT_SAFETY classifier can serve it, and the backend says so only when it boots\n // THERE. This reads every authored environment, offline, by the provider registry's own ordering rule.\n results.push(await this.checkContentGuardrailClassifier(saasRoot, agentsRead));\n\n // ─── 15. Specifications the companion refused to serve (#3211) ────\n //\n // Only the running companion can answer: it evaluates the package through the loader that collects refusals.\n results.push(checkSpecificationFindings(this.detectCompanionPort(saasRoot)\n ? await readSpecificationFindingsFromCompanion(await resolveCompanionClientOptionsFromContext(ctx, AI_USE_DECLARATIONS_COMPANION_TIMEOUT_MS))\n : { notReadBecause: 'the dev companion is not running' }));\n\n // ─── 16. The providers' own configuration checks (#2711) ────\n //\n // A WARN, never a FAIL: the backend runs the same checks at boot and does not refuse to start on one. A provider\n // module that declares `configurationCheck` (Slack: does SLACK_APPLICATION_WORKSPACE_ID name the workspace of\n // SLACK_ACCESS_TOKEN?) is run against this environment's values; a variable set in the shell wins over the stored one.\n results.push(...await collectProviderConfigurationChecks({ saasRoot, envName: env.name }));\n }\n\n this.render(ctx, results, asJson);\n\n const hasFailure = results.some((r) => r.status === LocalPreconditionCheckStatus.FAIL);\n return { success: !hasFailure };\n }\n\n // ────────────────────────────────────────────────────────────────────\n // Individual checks\n // ────────────────────────────────────────────────────────────────────\n\n /**\n * The AI uses of the application's service that owe a declaration (`aiUse` on an agent, `aiUsePosture` for a\n * use no agent carries), from the same derivation the compliance brief uses. See `ai-use-declarations.service.ts`.\n */\n private async checkAiUseDeclarations(saasRoot: string, read: AgentDeclarationsRead): Promise<CheckResult> {\n const agents = 'agents' in read ? read.agents : undefined;\n const report = await assessApplicationAiUseDeclarations({ saasRoot, agents });\n return aiUseDeclarationsCheck(report, 'notReadBecause' in read ? read.notReadBecause : undefined);\n }\n\n /**\n * Whether each authored environment can serve the classifier-backed content guardrails the agents declare. See\n * `content-guardrail-classifier.service.ts`. The configuration, the environments and the provider catalogue are read\n * from disk; the agents come from the companion read above.\n */\n private async checkContentGuardrailClassifier(saasRoot: string, read: AgentDeclarationsRead): Promise<CheckResult> {\n const guardedAgents = 'agents' in read ? guardedAgentRefs(read.agents) : undefined;\n const guardrailsNeeded = 'agents' in read ? guardrailsDeclaredBy(read.agents) : undefined;\n const notReadBecause = 'notReadBecause' in read\n ? read.notReadBecause\n : guardedAgents === undefined ? 'the dev companion\\'s agent reading predates the guardrail fields; redeliver the companion' : undefined;\n if (guardedAgents !== undefined && guardedAgents.length === 0) return contentGuardrailClassifierCheck({ readings: [], guardedAgents });\n try {\n const saasConfig = await loadSaasConfig(join(saasRoot, WORKSPACE_CONFIG_NAMES.SAAS));\n await resolveAndRegisterSaasProviderContributions({ saasRoot, saasConfig });\n const readings = readEnvironmentClassifiers({\n saasConfig,\n environments: await settleAllAuthoredInfraEnvConfigs(saasRoot),\n catalogue: getComposedProviderSecretsCatalogue(),\n // Only `providerEnv` is read, unvalidated: a file in an older shape still says which keys it holds, and a file\n // that cannot be read is reported with its path, never as absent.\n providerEnvOf: (envName) => {\n let path: string;\n try {\n path = join(EnvironmentUtils.resolveSecretsDir(envName), 'secrets.json');\n } catch (error) {\n return { kind: EnvironmentProviderEnvReadingKind.UNREADABLE, path: `the ${envName} secrets directory`, reason: ErrorUtils.extractErrorMessage(error) };\n }\n return readEnvironmentProviderEnv(path);\n },\n });\n return contentGuardrailClassifierCheck({\n readings,\n guardedAgents,\n ...(guardrailsNeeded ? { guardrailsNeeded } : {}),\n ...(notReadBecause ? { agentsNotReadBecause: notReadBecause } : {}),\n });\n } catch (error) {\n return {\n name: CONTENT_GUARDRAIL_CLASSIFIER_CHECK_NAME,\n status: LocalPreconditionCheckStatus.WARN,\n detail: `not probed: the configuration or the provider catalogue could not be read (${ErrorUtils.extractErrorMessage(error)})`,\n fix: 'Run `wildo config sync` to see why the configuration does not load.',\n };\n }\n }\n\n /**\n * Does the stored managed application config still match `wildo.saas.config.ts`?\n *\n * The visibility half of issue #97. Every app-authored value under `providerConfigurations`,\n * `engineCapabilities`, `providers`, `frontendServices`, `minions` and `workers` is materialized\n * into the stored platform document, and before this check nothing on any surface compared the two.\n * The only symptom of a divergence was behaviour that silently matched the OLD value — which cost\n * four restarts, three dispatched agent runs and roughly $8 of model time to diagnose once, because\n * the wrong conclusion (\"the change did not take, so the feature is broken\") was available at every\n * step and the right one required inspecting a database document by hand.\n *\n * WARNS rather than fails, on every host. Drift is a legitimate intermediate state — an operator\n * mid-edit has it by definition — and `doctor` returning non-zero for an unsaved thought would make\n * the command useless during exactly the work it is meant to support. The remedy is also one\n * command away and destroys nothing, which is the shape a warning is for.\n *\n * `not probed` (a PASS with an explicit detail, the idiom `checkCxx20Toolchain` uses for Windows)\n * covers every honest reason the comparison cannot be made: no app root, no secrets yet, the app\n * not registered, apps-manager down. Reporting those as drift would be a false positive on a fresh\n * machine, and a check that cries wolf on first run is a check operators learn to skim.\n *\n * The comparison itself is NOT implemented here — `StoredDeclarationCurrencyService` asks\n * apps-manager for a dry-run declaration reapply, so the answer comes from the one component that\n * owns the projection, and `wildo config validate` reads the same function.\n */\n private async checkDeclarationCurrency(ctx: CommandContext): Promise<CheckResult> {\n const name = 'declaration vs stored app config';\n // One comparison, shared with `wildo config validate` — see `StoredDeclarationCurrencyService`.\n const result = await StoredDeclarationCurrencyService.assess({\n saasRoot: ctx.cliContext.resolvedHomes.app.declarationRoot,\n env: ctx.activeEnv,\n });\n\n switch (result.currency) {\n case StoredDeclarationCurrency.CURRENT:\n return {\n name,\n status: LocalPreconditionCheckStatus.PASS,\n detail: `'${result.appSlug}' stored config matches wildo.saas.config.ts`,\n };\n case StoredDeclarationCurrency.STALE:\n return {\n name,\n status: LocalPreconditionCheckStatus.WARN,\n detail:\n `'${result.appSlug}' stored config is behind wildo.saas.config.ts on `\n + `${result.staleSlices.length} slice(s): ${result.staleSlices.join(', ')}. `\n + 'The runtime uses the STORED value, not the authored file.',\n fix: result.remedy,\n };\n case StoredDeclarationCurrency.NOT_PROBED:\n // Deliberately not a WARN — see the service: an unanswerable comparison is not drift.\n return { name, status: LocalPreconditionCheckStatus.PASS, detail: `not probed — ${result.reason}` };\n }\n }\n\n private checkDockerDaemon(): CheckResult {\n try {\n execSync('docker info', { stdio: 'pipe' });\n return { name: 'Docker daemon', status: LocalPreconditionCheckStatus.PASS };\n } catch {\n return {\n name: 'Docker daemon',\n status: LocalPreconditionCheckStatus.FAIL,\n detail: 'docker info exited non-zero — daemon not reachable',\n fix: 'Launch Docker Desktop: `open -a Docker`. Then re-run `wildo local doctor`.',\n };\n }\n }\n\n private listWildoContainers(): string[] {\n // `docker ps` only — we deliberately don't include `-a` so a\n // STOPPED container surfaces as \"missing\", which is more useful\n // than \"stopped\" for the local-doctor narrative.\n try {\n const out = execSync('docker ps --format \"{{.Names}}\"', { encoding: 'utf-8', stdio: 'pipe' });\n return out\n .split('\\n')\n .map((s) => s.trim())\n .filter((s) => s.startsWith('wildo-'));\n } catch {\n return [];\n }\n }\n\n private checkContainerHealthy(name: string): CheckResult {\n try {\n // `{{with .State.Health}}` (not `.State.Health.Status` directly): a container\n // whose image defines NO healthcheck has no `Health` key at all, and the\n // direct access is a template hard-error (\"map has no entry for key\"), which\n // used to report such containers (e.g. the distroless otel-collector) as\n // failed. The nil-safe form renders `running/` and we treat absent health\n // as pass, matching the previous `<no value>` intent.\n const status = execSync(\n `docker inspect --format '{{.State.Status}}/{{with .State.Health}}{{.Status}}{{end}}' \"${name}\"`,\n { encoding: 'utf-8', stdio: 'pipe' },\n ).trim();\n const [state, health] = status.split('/');\n /*\n * A crash loop reads `running/starting` for most of each cycle, so state alone reported mongod on\n * 2026-09-24 as a container still booting, 243 restarts in. The restart count is the signal, and\n * the failure line is captured now because a later re-render that removes the container removes\n * its log with it. Threshold 3: one or two restarts can be a Docker Desktop restart; a loop is not.\n */\n const restarts = DockerUtils.readRestartCounts([name]).get(name) ?? 0;\n if (state === 'restarting' || restarts >= 3) {\n const failure = DockerUtils.readLastFailureLine(name);\n return {\n name: `container ${name}`,\n status: LocalPreconditionCheckStatus.FAIL,\n detail: `${status}, restarted ${restarts} time(s)${failure ? ` — last failure: ${failure}` : ''}`,\n fix: `Read \\`docker logs ${name} --tail 100\\` before anything removes the container; a fault that survives a restart is not repaired by one.`,\n };\n }\n if (state === 'running' && (health === 'healthy' || health === '' || health === '<no value>')) {\n return { name: `container ${name}`, status: LocalPreconditionCheckStatus.PASS, detail: status };\n }\n return {\n name: `container ${name}`,\n status: LocalPreconditionCheckStatus.WARN,\n detail: status,\n fix: `Inspect: \\`docker logs ${name} --tail 50\\``,\n };\n } catch (err) {\n return {\n name: `container ${name}`,\n status: LocalPreconditionCheckStatus.FAIL,\n detail: ErrorUtils.extractErrorMessage(err),\n fix: `Start infra: \\`wildo local up\\``,\n };\n }\n }\n\n private collectContainerPorts(containers: string[]): Array<[string, number]> {\n const out: Array<[string, number]> = [];\n for (const name of containers) {\n try {\n const ports = execSync(\n `docker port \"${name}\"`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n // Output lines look like: \"27017/tcp -> 0.0.0.0:27017\"\n // We only want host-side ports actually exposed on 0.0.0.0/127.0.0.1.\n const seen = new Set<number>();\n for (const line of ports.split('\\n')) {\n const match = line.match(/->\\s*(?:0\\.0\\.0\\.0|127\\.0\\.0\\.1):(\\d+)/);\n if (match) {\n const port = Number.parseInt(match[1], 10);\n if (!seen.has(port)) {\n seen.add(port);\n out.push([name, port]);\n }\n }\n }\n } catch {\n // skip containers we can't inspect\n }\n }\n return out;\n }\n\n private checkLoopbackBinding(serviceLabel: string, port: number): Promise<CheckResult> {\n return new Promise((resolve) => {\n const socket = connect({ host: '127.0.0.1', port });\n const timeout = setTimeout(() => {\n socket.destroy();\n resolve({\n name: `loopback ${serviceLabel}:${port}`,\n status: LocalPreconditionCheckStatus.FAIL,\n detail: 'connect timed out after 2000ms',\n fix: 'Restart Docker Desktop (port table likely corrupted): `osascript -e \\'quit app \"Docker\"\\' && open -a Docker`',\n });\n }, 2_000);\n\n socket.once('connect', () => {\n clearTimeout(timeout);\n socket.end();\n resolve({ name: `loopback ${serviceLabel}:${port}`, status: LocalPreconditionCheckStatus.PASS });\n });\n socket.once('error', (err) => {\n clearTimeout(timeout);\n const code = (err as NodeJS.ErrnoException).code ?? 'unknown';\n const isLoopbackBindingBug = code === 'EADDRNOTAVAIL';\n resolve({\n name: `loopback ${serviceLabel}:${port}`,\n status: LocalPreconditionCheckStatus.FAIL,\n detail: `${code}: ${err.message}`,\n fix: isLoopbackBindingBug\n ? 'Docker Desktop port table is corrupted on this host. Quit and relaunch Docker: `osascript -e \\'quit app \"Docker\"\\' && open -a Docker`'\n : `Service likely not listening. Check: \\`docker logs ${serviceLabel} --tail 50\\``,\n });\n });\n });\n }\n\n private checkMongo(): CheckResult[] {\n const creds = this.readMongoCreds();\n if (!creds) {\n return [{\n name: 'mongo admin auth',\n status: LocalPreconditionCheckStatus.WARN,\n detail: 'could not locate platform-apps-manager .env to extract admin creds',\n fix: 'Run `wildo config sync` to (re-)emit the platform-apps-manager .env file.',\n }];\n }\n\n const results: CheckResult[] = [];\n\n // Admin auth round-trip.\n try {\n execSync(\n `docker exec wildo-mongodb mongosh \"mongodb://${creds.user}:${creds.pass}@localhost:27017/admin?directConnection=true\" --quiet --eval \"db.runCommand({ping:1}).ok\"`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n results.push({ name: 'mongo admin auth', status: LocalPreconditionCheckStatus.PASS });\n } catch (err) {\n const msg = ErrorUtils.extractErrorMessage(err);\n results.push({\n name: 'mongo admin auth',\n status: LocalPreconditionCheckStatus.FAIL,\n detail: msg.includes('Authentication failed') ? 'Authentication failed' : 'connection failed',\n fix: 'Verify `MONGO_INITDB_ROOT_PASSWORD` in the container env matches `MONGO_CONNECT_URL` in the apps-manager `.env`. If they drifted, the cleanest path is `wildo local reset` (destructive — wipes data).',\n });\n return results;\n }\n\n // Users the platform does not own: listed, never judged (#3704).\n try {\n const out = execSync(\n `docker exec wildo-mongodb mongosh \"mongodb://${creds.user}:${creds.pass}@localhost:27017/admin?directConnection=true\" --quiet --eval 'JSON.stringify(db.getSiblingDB(\"admin\").system.users.find({}, {user:1, _id:0}).toArray())'`,\n { encoding: 'utf-8', stdio: 'pipe' },\n ).trim();\n const users: Array<{ user: string }> = JSON.parse(out);\n results.push(describeApplicationDataServiceUsers('mongo application users', users.map((u) => u.user).filter((u) => !CANONICAL_MONGO_ADMINS.has(u))));\n } catch {\n // best-effort\n }\n\n return results;\n }\n\n /**\n * PostgreSQL admin-auth round-trip — the PG mirror of `checkMongo`'s drift probe (5.3 review).\n * The drift class is identical: the container's initdb password is frozen at first `up` while\n * the `.env` rotates with `wildo config sync`, and the platform's own `PG_CONNECT_URL` embeds\n * the same credential.\n *\n * The probe connects via the container's NON-LOOPBACK address, and that is the entire trick: the\n * postgres image's initdb-generated `pg_hba.conf` TRUSTS both the local socket AND loopback TCP\n * (`host all all 127.0.0.1/32 trust` — measured on the live container, where a wrong-password\n * probe against 127.0.0.1 returned rows happily). Only the appended\n * `host all all all scram-sha-256` rule actually checks the password, and only a non-loopback\n * source address reaches it. A probe that cannot fail is not a probe (review round 3, F1).\n *\n * ## `hostname -i` returns a LIST, and taking it whole broke the probe\n *\n * It prints one address per attached docker network, space-separated. The platform's postgres is\n * on two (its own compose network and the shared infra one), so the interpolation produced\n * `postgresql://user:pass@172.29.0.2 172.19.0.7:5432/postgres` and psql refused it with\n * `unexpected spaces found`. That surfaced as `connection failed` — indistinguishable from a real\n * outage, and its remediation recommends `wildo local reset`, which WIPES DATA. So a\n * one-container-network machine passed while a two-network machine was told to destroy its\n * database to fix a working credential. Measured 2026-08-28 against a healthy server whose\n * password authenticated correctly from three other paths.\n *\n * `awk '{print $1}'` takes the first address. Any of them reaches the scram rule, so which one is\n * immaterial — what matters is that exactly one is used. The power of the probe is unchanged: a\n * wrong password against the first address still fails `password authentication failed`.\n */\n private checkPostgres(): CheckResult {\n const creds = this.readPostgresCreds();\n if (!creds) {\n return {\n name: 'postgres admin auth',\n status: LocalPreconditionCheckStatus.WARN,\n // `appsManagerEnvPath()` returns '' when no .env exists, so a non-empty path here means\n // the FILE was found and the KEYS are what is missing — two different remedies, and the\n // old single message sent operators hunting a path problem they did not have.\n detail: this.appsManagerEnvPath()\n ? 'apps-manager .env found but PG_ADMIN_USER/PG_ADMIN_PASSWORD/PG_ADMIN_DATABASE are not all present'\n : 'could not locate platform-apps-manager .env to extract PG admin creds',\n fix: 'Run `wildo config sync` to (re-)emit the platform-apps-manager .env file with the PG admin keys.',\n };\n }\n\n try {\n // Credentials are framework-minted over [A-Za-z0-9_+-] (see CredentialGenerator), so raw\n // interpolation into the single-quoted shell string and the URL is safe; the database name\n // is authored, so it gets the same percent-encoding as the emitted PG_CONNECT_URL.\n execSync(\n `docker exec wildo-postgresql sh -c 'psql \"postgresql://${creds.user}:${creds.pass}@$(hostname -i | awk \"{print \\\\$1}\"):5432/${encodeURIComponent(creds.database)}\" -tAc \"select 1\"'`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n return { name: 'postgres admin auth', status: LocalPreconditionCheckStatus.PASS };\n } catch (err) {\n const msg = ErrorUtils.extractErrorMessage(err);\n return {\n name: 'postgres admin auth',\n status: LocalPreconditionCheckStatus.FAIL,\n detail: msg.includes('password authentication failed') ? 'Authentication failed' : 'connection failed',\n fix: 'Verify `POSTGRES_PASSWORD` in the container env matches `PG_ADMIN_PASSWORD` (and the embedded '\n + 'password in `PG_CONNECT_URL`, when present) in the apps-manager `.env`. If they drifted, the '\n + 'cleanest path is `wildo local reset` (destructive — wipes data).',\n };\n }\n }\n\n private checkValkey(): CheckResult[] {\n const password = this.readValkeyPassword();\n if (!password) {\n return [{\n name: 'valkey admin auth',\n status: LocalPreconditionCheckStatus.WARN,\n detail: 'could not locate platform-apps-manager .env to extract VALKEY/REDIS admin password',\n fix: 'Run `wildo config sync` to (re-)emit the platform-apps-manager .env file.',\n }];\n }\n\n const results: CheckResult[] = [];\n\n try {\n const ping = execSync(\n `docker exec wildo-valkey valkey-cli -a '${password.replace(/'/g, \"'\\\\''\")}' PING`,\n { encoding: 'utf-8', stdio: 'pipe' },\n ).trim();\n if (!ping.includes('PONG')) {\n results.push({\n name: 'valkey admin auth',\n status: LocalPreconditionCheckStatus.FAIL,\n detail: `unexpected PING response: ${ping}`,\n });\n return results;\n }\n results.push({ name: 'valkey admin auth', status: LocalPreconditionCheckStatus.PASS });\n } catch (err) {\n const msg = ErrorUtils.extractErrorMessage(err);\n results.push({\n name: 'valkey admin auth',\n status: LocalPreconditionCheckStatus.FAIL,\n detail: msg.includes('WRONGPASS') ? 'WRONGPASS' : 'auth failed',\n fix: 'Verify `VALKEY_PASSWORD` in the container env matches `REDIS_ADMIN_PASSWORD` in the apps-manager `.env`. If drift is recent, `wildo local reset` (destructive — wipes data) is the cleanest path.',\n });\n return results;\n }\n\n // ACL users the platform does not own: listed, never judged (#3704).\n try {\n const out = execSync(\n `docker exec wildo-valkey valkey-cli -a '${password.replace(/'/g, \"'\\\\''\")}' ACL LIST`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n const names = out\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line.startsWith('user '))\n .map((line) => line.split(/\\s+/)[1])\n .filter((n): n is string => Boolean(n));\n results.push(describeApplicationDataServiceUsers('valkey application ACLs', names.filter((n) => !CANONICAL_VALKEY_ACL_USERS.has(n))));\n } catch {\n // best-effort\n }\n\n return results;\n }\n\n /**\n * @param isFrameworkDeveloper decides WHOSE remedy is printed. Both strings below used to be the\n * framework-developer one unconditionally, so an application creator — who has no monorepo and no\n * `examples/wonder-todos/` — was told to \"Start the platform with `pnpm dev` from the monorepo\n * root\". Observed on the first real app-creator `local doctor` run (2026-09-09): three failing\n * checks, three remedies naming paths that do not exist on that machine. A diagnostic that names\n * an unreachable remedy is worse than one that names none: it sends the operator looking for a\n * checkout they were never supposed to have.\n */\n private async checkHttp(label: string, url: string, isFrameworkDeveloper: boolean): Promise<CheckResult> {\n const endpointPath = new URL(url).pathname;\n const resultName = `${label} ${endpointPath}`;\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), 2_000);\n try {\n const res = await fetch(url, { signal: controller.signal, redirect: 'manual' });\n if (res.ok) {\n return { name: resultName, status: LocalPreconditionCheckStatus.PASS, detail: `HTTP ${res.status}` };\n }\n return {\n name: resultName,\n status: LocalPreconditionCheckStatus.FAIL,\n detail: `HTTP ${res.status}`,\n fix: isFrameworkDeveloper\n ? 'Tail logs to diagnose. apps-manager + crontabs-batches-manager are started by `pnpm dev` from the monorepo root; companion by the WT `pnpm dev`.'\n : 'Tail logs to diagnose (`wildo local logs`). The platform services run as containers started by `wildo local up`; the companion by `wildo local dev`.',\n };\n } catch (err) {\n const isAbort = err instanceof Error && (err.name === 'AbortError' || err.name === 'TimeoutError');\n const code = (err as Error & { cause?: { code?: string } }).cause?.code;\n return {\n name: resultName,\n status: LocalPreconditionCheckStatus.FAIL,\n detail: isAbort ? 'request timed out' : (code ?? ErrorUtils.extractErrorMessage(err)),\n fix: code === 'ECONNREFUSED'\n ? `Service is not running. ${\n isFrameworkDeveloper\n ? (label === 'dev-companion'\n ? 'Start the WT stack from `examples/wonder-todos/`.'\n : 'Start the platform with `pnpm dev` from the monorepo root.')\n : (label === 'dev-companion'\n ? 'Start this application\\'s companion with `wildo local dev` (`wildo dev start` does not start it).'\n : 'Start the platform with `wildo local up` from this application root.')\n }`\n : 'Inspect logs for the failing service.',\n };\n } finally {\n clearTimeout(timer);\n }\n }\n\n /**\n * Flag every running wildo container whose IMAGE architecture differs from the\n * host's — those run under Rosetta (macOS) or QEMU (Linux), a several-fold CPU\n * multiplier that `docker stats` attributes to nothing (the emulation cost is\n * billed to the VM process, outside every container cgroup). Containers in\n * `DECLARED_NON_NATIVE_CONTAINERS` pass with an explanatory detail; one of them\n * running NATIVE is also surfaced, because it means the upstream image gained a\n * native build and the exception (plus its template `platform:` pin) is stale.\n */\n private checkContainerArchitectures(containers: string[]): CheckResult[] {\n if (containers.length === 0) return [];\n // Node arch vocabulary → Docker image arch vocabulary. Only the two hosts the\n // framework actually targets; an exotic host arch degrades to a single warn.\n const hostArch = process.arch === 'arm64' ? 'arm64' : process.arch === 'x64' ? 'amd64' : null;\n if (hostArch === null) {\n return [{\n name: 'container architecture',\n status: LocalPreconditionCheckStatus.WARN,\n detail: `unrecognized host arch '${process.arch}' — emulation check skipped`,\n }];\n }\n let inspected: string;\n try {\n // Container inspect exposes the image ID, not its architecture — resolve in\n // two batch calls instead of 2×N single ones.\n inspected = execSync(\n `docker inspect --format '{{.Name}}\\t{{.Image}}' ${containers.map((c) => `\"${c}\"`).join(' ')}`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n } catch (err) {\n return [{\n name: 'container architecture',\n status: LocalPreconditionCheckStatus.WARN,\n detail: `docker inspect failed: ${ErrorUtils.extractErrorMessage(err)}`,\n }];\n }\n const imageByContainer = new Map<string, string>();\n for (const line of inspected.split('\\n')) {\n const [rawName, imageId] = line.trim().split('\\t');\n if (rawName && imageId) imageByContainer.set(rawName.replace(/^\\//, ''), imageId);\n }\n const archByImage = new Map<string, string>();\n try {\n const imageIds = [...new Set(imageByContainer.values())];\n const archOut = execSync(\n `docker image inspect --format '{{.Id}}\\t{{.Architecture}}' ${imageIds.map((i) => `\"${i}\"`).join(' ')}`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n for (const line of archOut.split('\\n')) {\n const [id, arch] = line.trim().split('\\t');\n if (id && arch) archByImage.set(id, arch);\n }\n } catch {\n // fall through — unknown arches are reported as such below\n }\n\n const results: CheckResult[] = [];\n let emulatedCount = 0;\n for (const [name, imageId] of imageByContainer) {\n const imageArch = archByImage.get(imageId);\n if (!imageArch || imageArch === hostArch) {\n if (DECLARED_NON_NATIVE_CONTAINERS.has(name) && imageArch === hostArch) {\n results.push({\n name: `native image for ${name}`,\n status: LocalPreconditionCheckStatus.WARN,\n detail: `runs NATIVE (${imageArch}) but is declared amd64-only`,\n fix: 'Upstream apparently gained a native build — remove it from DECLARED_NON_NATIVE_CONTAINERS and drop the `platform:` pin in docker-compose.wildo-platform.yml.hbs.',\n });\n }\n continue;\n }\n emulatedCount += 1;\n if (DECLARED_NON_NATIVE_CONTAINERS.has(name)) {\n results.push({\n name: `emulated container ${name}`,\n status: LocalPreconditionCheckStatus.PASS,\n detail: `${imageArch} on ${hostArch} — declared exception (no native image upstream)`,\n });\n continue;\n }\n results.push({\n name: `emulated container ${name}`,\n status: LocalPreconditionCheckStatus.WARN,\n detail: `image is ${imageArch}, host is ${hostArch} — running under ${process.platform === 'darwin' ? 'Rosetta' : 'QEMU'}`,\n fix: 'Pin a native tag in templates/infra/docker-compose/docker-compose.wildo-platform.yml.hbs, then `wildo config sync` + recreate. If no native image exists, declare it in DECLARED_NON_NATIVE_CONTAINERS.',\n });\n }\n if (emulatedCount === 0) {\n results.push({ name: 'container architecture', status: LocalPreconditionCheckStatus.PASS, detail: `all native ${hostArch}` });\n }\n return results;\n }\n\n /**\n * Declared frontend providers missing a key their module requires (#2658 context), read from the artifacts the\n * last `wildo config sync` wrote. A WARN, never a FAIL: an application without a vendor account still runs, and\n * the provider is simply absent. An artifact written before the required-key list existed is named as such,\n * never reported as \"configured\".\n */\n private checkFrontendProviderKeys(saasRoot: string): CheckResult {\n const name = 'frontend provider keys';\n const report = readFrontendProviderKeyReportOnDisk(saasRoot);\n if (report === null) {\n return { name, status: LocalPreconditionCheckStatus.PASS, detail: 'no generated provider configuration yet (run `wildo config sync`)' };\n }\n const lines = report.notConfigured.map((entry) => describeFrontendProviderNotConfigured(entry));\n if (report.predatingEntries.length > 0) {\n const named = report.predatingEntries.map((entry) => `\"${entry.providerRef}\" on service \"${entry.serviceKey}\"`).join(', ');\n lines.push(`The generated provider configuration predates the required-key check, so it cannot say whether ${named} ${report.predatingEntries.length > 1 ? 'are' : 'is'} configured: run \\`wildo config sync\\`.`);\n }\n if (lines.length === 0) {\n return { name, status: LocalPreconditionCheckStatus.PASS, detail: 'every declared frontend provider has the keys it requires' };\n }\n return { name, status: LocalPreconditionCheckStatus.WARN, detail: lines.join('\\n') };\n }\n\n /**\n * Surface `wildo-shared-pg-*` integration-test servers older than the harness TTL.\n * Observation only — the authoritative reaper lives in the test harness's global\n * setup and fires on the next Vitest run; the doctor exists for the window where\n * nobody runs tests and the leak would otherwise accumulate silently.\n */\n private checkLeakedTestContainers(): CheckResult {\n let listing: string;\n try {\n listing = execSync(\n 'docker ps --filter name=wildo-shared-pg- --format \"{{.Names}}\\t{{.CreatedAt}}\"',\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n } catch (err) {\n return { name: 'leaked test containers', status: LocalPreconditionCheckStatus.WARN, detail: ErrorUtils.extractErrorMessage(err) };\n }\n const names = listing.split('\\n').map((l) => l.trim()).filter(Boolean).map((l) => l.split('\\t')[0]);\n if (names.length === 0) {\n return { name: 'leaked test containers', status: LocalPreconditionCheckStatus.PASS, detail: 'no wildo-shared-pg-* containers' };\n }\n const leaked: string[] = [];\n try {\n // `.Created` is ISO 8601 (parseable), unlike `docker ps`'s locale-shaped column.\n const inspected = execSync(\n `docker inspect --format '{{.Name}}\\t{{.Created}}' ${names.map((n) => `\"${n}\"`).join(' ')}`,\n { encoding: 'utf-8', stdio: 'pipe' },\n );\n const now = Date.now();\n for (const line of inspected.split('\\n')) {\n const [rawName, created] = line.trim().split('\\t');\n if (!rawName || !created) continue;\n const ageMs = now - Date.parse(created);\n if (Number.isFinite(ageMs) && ageMs > SHARED_PG_LEAK_TTL_MS) {\n leaked.push(`${rawName.replace(/^\\//, '')} (${Math.round(ageMs / 3_600_000)}h)`);\n }\n }\n } catch (err) {\n return { name: 'leaked test containers', status: LocalPreconditionCheckStatus.WARN, detail: ErrorUtils.extractErrorMessage(err) };\n }\n if (leaked.length === 0) {\n return {\n name: 'leaked test containers',\n status: LocalPreconditionCheckStatus.PASS,\n detail: `${names.length} test container${names.length === 1 ? '' : 's'} within TTL (likely live Vitest runs)`,\n };\n }\n return {\n name: 'leaked test containers',\n status: LocalPreconditionCheckStatus.WARN,\n detail: leaked.join(', '),\n fix: 'They self-reap on the next saas-backend-lib test run; to sweep now: `docker ps --filter name=wildo-shared-pg -q | xargs docker rm -fv` (only when no Vitest run is active).',\n };\n }\n\n // ────────────────────────────────────────────────────────────────────\n // Credential extraction (read-only — never writes anything)\n // ────────────────────────────────────────────────────────────────────\n\n private appsManagerEnvPath(): string {\n // Resolve from `process.cwd()` is unreliable (CLI may run from anywhere\n // in the monorepo). The canonical path is anchored at the framework\n // repo root, which we infer by walking up from this file.\n // For doctor's purposes, walking from CWD upward to find the\n // `platform/` sibling is enough — the worst case is we return null\n // and the auth check warns instead of failing loud.\n let dir = process.cwd();\n for (let i = 0; i < 8; i++) {\n const candidate = join(dir, 'platform', 'platform-back-office', 'platform-apps-manager', '.env');\n if (existsSync(candidate)) return candidate;\n const parent = join(dir, '..');\n if (parent === dir) break;\n dir = parent;\n }\n return '';\n }\n\n private readMongoCreds(): { user: string; pass: string } | null {\n const envPath = this.appsManagerEnvPath();\n if (!envPath || !existsSync(envPath)) return null;\n const raw = readFileSync(envPath, 'utf-8');\n // Parse mongo://user:pass@host from MONGO_CONNECT_URL line.\n const match = raw.match(/^MONGO_CONNECT_URL=mongodb:\\/\\/([^:]+):([^@]+)@/m);\n if (!match) return null;\n return { user: match[1], pass: match[2] };\n }\n\n /** The PG mirror of `readMongoCreds` — the admin trio from the same apps-manager `.env`. */\n private readPostgresCreds(): { user: string; pass: string; database: string } | null {\n const envPath = this.appsManagerEnvPath();\n if (!envPath || !existsSync(envPath)) return null;\n const raw = readFileSync(envPath, 'utf-8');\n const user = raw.match(/^PG_ADMIN_USER=(.+)$/m)?.[1]?.trim();\n const pass = raw.match(/^PG_ADMIN_PASSWORD=(.+)$/m)?.[1]?.trim();\n const database = raw.match(/^PG_ADMIN_DATABASE=(.+)$/m)?.[1]?.trim();\n if (!user || !pass || !database) return null;\n return { user, pass, database };\n }\n\n private readValkeyPassword(): string | null {\n const envPath = this.appsManagerEnvPath();\n if (!envPath || !existsSync(envPath)) return null;\n const raw = readFileSync(envPath, 'utf-8');\n const match = raw.match(/^REDIS_ADMIN_PASSWORD=(.+)$/m);\n return match ? match[1].trim() : null;\n }\n\n private detectCompanionPort(saasRoot: string): number | null {\n // Best-effort: read the local infra config for `devCompanion.port`.\n // We don't parse the TS — just grep for the port literal, which is\n // good enough for a diagnostic.\n const candidate = join(saasRoot, 'infrastructure', 'local', 'wildo.infra.local.config.ts');\n if (!existsSync(candidate)) return null;\n const raw = readFileSync(candidate, 'utf-8');\n const match = raw.match(/devCompanion\\s*:\\s*\\{[^}]*port\\s*:\\s*(\\d+)/);\n return match ? Number.parseInt(match[1], 10) : null;\n }\n\n // ────────────────────────────────────────────────────────────────────\n // Output\n // ────────────────────────────────────────────────────────────────────\n\n private render(ctx: CommandContext, results: CheckResult[], asJson: boolean): void {\n if (asJson) {\n writeJsonDocument(results, JsonDocumentLayout.INDENTED);\n return;\n }\n\n const passCount = results.filter((r) => r.status === LocalPreconditionCheckStatus.PASS).length;\n const warnCount = results.filter((r) => r.status === LocalPreconditionCheckStatus.WARN).length;\n const failCount = results.filter((r) => r.status === LocalPreconditionCheckStatus.FAIL).length;\n\n ctx.log.info(chalk.cyan('\\n Local infrastructure diagnostic\\n'));\n for (const r of results) {\n const icon = r.status === LocalPreconditionCheckStatus.PASS ? chalk.green('✓')\n : r.status === LocalPreconditionCheckStatus.WARN ? chalk.yellow('⚠')\n : chalk.red('✗');\n const detail = r.detail ? chalk.dim(` (${r.detail})`) : '';\n ctx.log.info(` ${icon} ${r.name}${detail}`);\n if (r.fix && r.status !== LocalPreconditionCheckStatus.PASS) {\n ctx.log.info(` ${chalk.dim('fix:')} ${r.fix}`);\n }\n }\n\n ctx.log.info('');\n const summary = `${passCount} passing`\n + (warnCount > 0 ? `, ${warnCount} warning${warnCount === 1 ? '' : 's'}` : '')\n + (failCount > 0 ? `, ${failCount} failure${failCount === 1 ? '' : 's'}` : '');\n if (failCount > 0) {\n ctx.log.error(` ${summary}`);\n } else if (warnCount > 0) {\n ctx.log.warn(` ${summary}`);\n } else {\n ctx.log.success(` ${summary}`);\n }\n ctx.log.info('');\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/providers/connect.command.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAI7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAkB,MAAM,yBAAyB,CAAC;AAsG1G;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,WAAW;IAC9D,QAAQ,CAAC,IAAI,EAAE,WAAW,CAUxB;IAEI,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"connect.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/providers/connect.command.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAI7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAkB,MAAM,yBAAyB,CAAC;AAsG1G;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,WAAW;IAC9D,QAAQ,CAAC,IAAI,EAAE,WAAW,CAUxB;IAEI,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAoHtD;;;OAGG;YACW,kBAAkB;CA0BjC"}
|
|
@@ -182,9 +182,19 @@ export default class ProvidersConnectCommand extends BaseCommand {
|
|
|
182
182
|
ctx.log.success(`Connected. Stored in ${storePath}: ${result.storedNames.join(', ')}.`);
|
|
183
183
|
if (result.accountRef !== undefined)
|
|
184
184
|
ctx.log.info(`Account: ${result.accountRef}`);
|
|
185
|
-
ctx.log.info(`Granted (${result.grantedScopes.length}): ${result.grantedScopes.join(' ') || '(the vendor reported none)'}`);
|
|
185
|
+
ctx.log.info(`Granted to '${ref}' (${result.grantedScopes.length}): ${result.grantedScopes.join(' ') || '(the vendor reported none)'}`);
|
|
186
|
+
// The store keys a grant by MODULE ref, so an augmentation's consent never replaces its base's or a sibling's: each
|
|
187
|
+
// keeps its own token, read by `probe <ref>`. Said here because the line above was read as the base's whole grant.
|
|
188
|
+
if (subject.probed.augments !== undefined) {
|
|
189
|
+
ctx.log.info(`This grant is '${ref}'s own record. Other modules connected through ${subject.probed.augments}'s client keep theirs; \`providers probe ${ref}\` reads this one.`);
|
|
190
|
+
}
|
|
186
191
|
if (result.missingScopes.length > 0)
|
|
187
192
|
ctx.log.warn(`Requested and not reported as granted: ${result.missingScopes.join(' ')}. An operation needing one may be refused.`);
|
|
193
|
+
// Static consent grants what the app registration lists, so these are the registration's gaps (or a granted answer
|
|
194
|
+
// spelled differently from the operation's declaration, which an application's scope check would refuse too).
|
|
195
|
+
if (result.staticConsentScopesNotGranted.length > 0) {
|
|
196
|
+
ctx.log.warn(`Needed by an operation, registered for static consent, and not reported as granted: ${result.staticConsentScopesNotGranted.join(' ')}. Add them to the app registration (with admin consent where required) and connect again.`);
|
|
197
|
+
}
|
|
188
198
|
ctx.log.info(result.refreshable
|
|
189
199
|
? `The token renews itself when a probe finds it expired${result.accessTokenExpiresAt === undefined ? '' : ` (it expires ${result.accessTokenExpiresAt})`}.`
|
|
190
200
|
: `The vendor issued no refresh token${result.accessTokenExpiresAt === undefined ? '' : `; the token expires ${result.accessTokenExpiresAt}, then connect again`}.`);
|