@wildo-ai/wildo-cli 1.1.3 → 1.1.4

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.
Files changed (141) hide show
  1. package/dist/src/commands/context/__tests__/assurance-basis.command.test.d.ts +2 -0
  2. package/dist/src/commands/context/__tests__/assurance-basis.command.test.d.ts.map +1 -0
  3. package/dist/src/commands/context/__tests__/assurance-basis.command.test.js +63 -0
  4. package/dist/src/commands/context/__tests__/assurance-basis.command.test.js.map +1 -0
  5. package/dist/src/commands/context/assurance-basis.command.d.ts +61 -0
  6. package/dist/src/commands/context/assurance-basis.command.d.ts.map +1 -0
  7. package/dist/src/commands/context/assurance-basis.command.js +166 -0
  8. package/dist/src/commands/context/assurance-basis.command.js.map +1 -0
  9. package/dist/src/commands/dev/charts-audit.command.d.ts +5 -3
  10. package/dist/src/commands/dev/charts-audit.command.d.ts.map +1 -1
  11. package/dist/src/commands/dev/charts-audit.command.js +35 -6
  12. package/dist/src/commands/dev/charts-audit.command.js.map +1 -1
  13. package/dist/src/commands/fwk/generate-providers.command.d.ts.map +1 -1
  14. package/dist/src/commands/fwk/generate-providers.command.js +18 -2
  15. package/dist/src/commands/fwk/generate-providers.command.js.map +1 -1
  16. package/dist/src/commands/generate/email-preview.command.d.ts +8 -0
  17. package/dist/src/commands/generate/email-preview.command.d.ts.map +1 -1
  18. package/dist/src/commands/generate/email-preview.command.js +57 -0
  19. package/dist/src/commands/generate/email-preview.command.js.map +1 -1
  20. package/dist/src/commands/init.command.d.ts.map +1 -1
  21. package/dist/src/commands/init.command.js +32 -0
  22. package/dist/src/commands/init.command.js.map +1 -1
  23. package/dist/src/commands/lock/check.command.d.ts.map +1 -1
  24. package/dist/src/commands/lock/check.command.js +3 -2
  25. package/dist/src/commands/lock/check.command.js.map +1 -1
  26. package/dist/src/commands/registry/login.command.d.ts.map +1 -1
  27. package/dist/src/commands/registry/login.command.js +2 -0
  28. package/dist/src/commands/registry/login.command.js.map +1 -1
  29. package/dist/src/commands/registry/publish.command.d.ts.map +1 -1
  30. package/dist/src/commands/registry/publish.command.js +2 -0
  31. package/dist/src/commands/registry/publish.command.js.map +1 -1
  32. package/dist/src/commands/registry/registry-transport.constants.d.ts +33 -0
  33. package/dist/src/commands/registry/registry-transport.constants.d.ts.map +1 -0
  34. package/dist/src/commands/registry/registry-transport.constants.js +33 -0
  35. package/dist/src/commands/registry/registry-transport.constants.js.map +1 -0
  36. package/dist/src/commands/registry/whoami.command.d.ts.map +1 -1
  37. package/dist/src/commands/registry/whoami.command.js +2 -0
  38. package/dist/src/commands/registry/whoami.command.js.map +1 -1
  39. package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.d.ts +2 -0
  40. package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.d.ts.map +1 -0
  41. package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.js +146 -0
  42. package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.js.map +1 -0
  43. package/dist/src/modules/domain/credentials/approver-user.module.d.ts +85 -0
  44. package/dist/src/modules/domain/credentials/approver-user.module.d.ts.map +1 -0
  45. package/dist/src/modules/domain/credentials/approver-user.module.js +92 -0
  46. package/dist/src/modules/domain/credentials/approver-user.module.js.map +1 -0
  47. package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.d.ts +2 -0
  48. package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.d.ts.map +1 -0
  49. package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.js +111 -0
  50. package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.js.map +1 -0
  51. package/dist/src/services/application/__tests__/provider-package-links.service.test.js +68 -0
  52. package/dist/src/services/application/__tests__/provider-package-links.service.test.js.map +1 -1
  53. package/dist/src/services/application/app-bootstrap.service.d.ts +9 -0
  54. package/dist/src/services/application/app-bootstrap.service.d.ts.map +1 -1
  55. package/dist/src/services/application/app-bootstrap.service.js +30 -1
  56. package/dist/src/services/application/app-bootstrap.service.js.map +1 -1
  57. package/dist/src/services/application/application-runtime-bootstrap.service.d.ts +6 -0
  58. package/dist/src/services/application/application-runtime-bootstrap.service.d.ts.map +1 -1
  59. package/dist/src/services/application/application-runtime-bootstrap.service.js +41 -0
  60. package/dist/src/services/application/application-runtime-bootstrap.service.js.map +1 -1
  61. package/dist/src/services/application/provider-package-links.service.d.ts +30 -0
  62. package/dist/src/services/application/provider-package-links.service.d.ts.map +1 -1
  63. package/dist/src/services/application/provider-package-links.service.js +35 -3
  64. package/dist/src/services/application/provider-package-links.service.js.map +1 -1
  65. package/dist/src/services/application/provider-runtime-sync.service.d.ts.map +1 -1
  66. package/dist/src/services/application/provider-runtime-sync.service.js +4 -3
  67. package/dist/src/services/application/provider-runtime-sync.service.js.map +1 -1
  68. package/dist/src/services/application/saas-skeleton.service.d.ts.map +1 -1
  69. package/dist/src/services/application/saas-skeleton.service.js +22 -2
  70. package/dist/src/services/application/saas-skeleton.service.js.map +1 -1
  71. package/dist/src/services/companion/workbench-cli.service.js +10 -1
  72. package/dist/src/services/companion/workbench-cli.service.js.map +1 -1
  73. package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.d.ts +2 -0
  74. package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.d.ts.map +1 -0
  75. package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.js +94 -0
  76. package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.js.map +1 -0
  77. package/dist/src/services/credentials/ci-secrets-adapter.service.d.ts.map +1 -1
  78. package/dist/src/services/credentials/ci-secrets-adapter.service.js +16 -0
  79. package/dist/src/services/credentials/ci-secrets-adapter.service.js.map +1 -1
  80. package/dist/src/services/credentials/composed-provider-catalogue.d.ts +34 -0
  81. package/dist/src/services/credentials/composed-provider-catalogue.d.ts.map +1 -1
  82. package/dist/src/services/credentials/composed-provider-catalogue.js +35 -0
  83. package/dist/src/services/credentials/composed-provider-catalogue.js.map +1 -1
  84. package/dist/src/services/credentials/credentials.schemas.d.ts +27 -0
  85. package/dist/src/services/credentials/credentials.schemas.d.ts.map +1 -1
  86. package/dist/src/services/credentials/credentials.schemas.js +50 -0
  87. package/dist/src/services/credentials/credentials.schemas.js.map +1 -1
  88. package/dist/src/services/credentials/framework-managed-secrets.d.ts +1 -1
  89. package/dist/src/services/credentials/framework-managed-secrets.d.ts.map +1 -1
  90. package/dist/src/services/credentials/framework-managed-secrets.js +49 -8
  91. package/dist/src/services/credentials/framework-managed-secrets.js.map +1 -1
  92. package/dist/src/services/deployment/infra-writer.service.d.ts.map +1 -1
  93. package/dist/src/services/deployment/infra-writer.service.js +23 -4
  94. package/dist/src/services/deployment/infra-writer.service.js.map +1 -1
  95. package/dist/src/services/deployment/k8s/__tests__/k8s-bootstrap.service.test.js +45 -2
  96. package/dist/src/services/deployment/k8s/__tests__/k8s-bootstrap.service.test.js.map +1 -1
  97. package/dist/src/services/deployment/k8s/k8s-bootstrap.service.d.ts +23 -0
  98. package/dist/src/services/deployment/k8s/k8s-bootstrap.service.d.ts.map +1 -1
  99. package/dist/src/services/deployment/k8s/k8s-bootstrap.service.js +49 -6
  100. package/dist/src/services/deployment/k8s/k8s-bootstrap.service.js.map +1 -1
  101. package/dist/src/services/environment/env-vars-builder.service.d.ts.map +1 -1
  102. package/dist/src/services/environment/env-vars-builder.service.js +19 -0
  103. package/dist/src/services/environment/env-vars-builder.service.js.map +1 -1
  104. package/dist/src/services/framework/__tests__/engine-provider-specifications.reconciliation.test.js +8 -0
  105. package/dist/src/services/framework/__tests__/engine-provider-specifications.reconciliation.test.js.map +1 -1
  106. package/dist/src/services/framework/__tests__/framework-knowledge-audit.live.contract.test.js +17 -0
  107. package/dist/src/services/framework/__tests__/framework-knowledge-audit.live.contract.test.js.map +1 -1
  108. package/dist/src/services/framework/__tests__/framework-knowledge-audit.service.test.js +51 -0
  109. package/dist/src/services/framework/__tests__/framework-knowledge-audit.service.test.js.map +1 -1
  110. package/dist/src/services/framework/framework-knowledge-audit.service.d.ts +41 -1
  111. package/dist/src/services/framework/framework-knowledge-audit.service.d.ts.map +1 -1
  112. package/dist/src/services/framework/framework-knowledge-audit.service.js +90 -0
  113. package/dist/src/services/framework/framework-knowledge-audit.service.js.map +1 -1
  114. package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.d.ts +2 -0
  115. package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.d.ts.map +1 -0
  116. package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.js +100 -0
  117. package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.js.map +1 -0
  118. package/dist/src/services/framework/provider-transposition/__tests__/plan-matches-emit.test.js +55 -2
  119. package/dist/src/services/framework/provider-transposition/__tests__/plan-matches-emit.test.js.map +1 -1
  120. package/dist/src/services/framework/provider-transposition/provider-package.emitter.d.ts +9 -0
  121. package/dist/src/services/framework/provider-transposition/provider-package.emitter.d.ts.map +1 -1
  122. package/dist/src/services/framework/provider-transposition/provider-package.emitter.js +139 -19
  123. package/dist/src/services/framework/provider-transposition/provider-package.emitter.js.map +1 -1
  124. package/dist/src/services/frontend/cloudflare-cdn.service.d.ts.map +1 -1
  125. package/dist/src/services/frontend/cloudflare-cdn.service.js +33 -2
  126. package/dist/src/services/frontend/cloudflare-cdn.service.js.map +1 -1
  127. package/dist/tsconfig.build.tsbuildinfo +1 -1
  128. package/dist/tsconfig.tsbuildinfo +1 -1
  129. package/package.json +17 -17
  130. package/scripts/app-dependency-alignment/propagated-engine-overrides.json +13 -0
  131. package/templates/infra/docker-compose/docker-compose.wildo-platform.yml.hbs +64 -16
  132. package/templates/saas/engine-peer-closure.json +12 -0
  133. package/templates/saas/scenarios/add-provider/scenario.json +11 -11
  134. package/templates/saas/scenarios/add-technical-doc/files/technical-doc/docusaurus.config.ts.hbs +34 -0
  135. package/templates/saas/scenarios/add-technical-doc/files/technical-doc/src/pages/auth/exchange.tsx +24 -1
  136. package/templates/saas/scenarios/add-technical-doc/files/technical-doc/src/theme/Root.tsx +22 -2
  137. package/templates/saas/skeleton/backend-api/package.json.hbs +1 -1
  138. package/templates/saas/skeleton/backend-api/src/companion-exports.ts +13 -2
  139. package/wildo-framework.info.json +1 -1
  140. package/templates/saas/scenarios/add-backend-provider/scenario.json +0 -17
  141. package/templates/saas/skeleton/backend-api/src/provider-contributions.ts +0 -44
@@ -1 +1 @@
1
- {"version":3,"file":"init.command.js","sourceRoot":"","sources":["../../../src/commands/init.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,MAAM,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAE1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,uDAAuD,CAAC;AAE1G,OAAO,EAAE,yBAAyB,EAAE,MAAM,8DAA8D,CAAC;AACzG,OAAO,EAAE,4BAA4B,EAAE,MAAM,iEAAiE,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACjF,OAAO,EACL,yBAAyB,GAE1B,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EACtB,iBAAiB,GAClB,MAAM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C/F,mEAAmE,CACtE,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,yBAAyB,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;YAC9E,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,OAAO,aAAa,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC;YAC/D,CAAC;YACD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,EAAE,EAAE,CAAC,kCAAkC,CAAC;YACrF,CAAC;YACD,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,GAAG,CAAC,IAAI,CACV,iDAAiD,UAAU,CAAC,mBAAmB,CAAC,KAAK,CAAC,IAAI;kBACxF,gCAAgC,CACnC,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF","sourcesContent":["/**\n * init — Create a new Wildo targeted app (`wildo.saas.config.ts`).\n *\n * Uses prompt() for interactive flow with automatic flag resolution:\n * --name, --runtime, --database skip the corresponding prompts.\n *\n * Side effects:\n * 1. Writes `wildo.saas.config.ts` via `SaasScaffoldService`\n * 2. Registers a default 'local' environment in EnvironmentRegistry\n * with the chosen runtime + database\n * 3. Provisions that environment's `secrets.json` (issue #155)\n *\n * On (3): `secrets.json` is PER-APPLICATION, and before #155 nothing on the app-creator\n * path ever wrote one — `wildo setup` was the sole minter and it fail-closes without a\n * framework checkout, which an app created outside the monorepo does not have. The result\n * was `wildo config sync` failing its `env-files` phase with \"No secrets for 'local'. Run\n * 'wildo init' first.\" at the end of a run of `wildo init`, and the companion then dying on\n * a NaN `PORT`. Init now mints them, so that message is true.\n *\n * It is IDEMPOTENT, deliberately: minting routes through the same additive\n * `provisionFrameworkManagedSecrets` registry that the self-heal paths use, so re-running\n * `wildo init` over an existing app backfills any newly-declared material and rotates\n * NOTHING — re-minting a live credential would orphan the Mongo/Valkey data it protects.\n * A re-run also never re-asks for the administrator: the identity is already on disk.\n *\n * Supports --check to verify tools only (profile-aware: K8s tools\n * checked only when the active environment uses a K8s runtime).\n */\n\nimport chalk from 'chalk';\nimport { existsSync } from 'fs';\nimport { basename, dirname, relative, resolve as resolvePath } from 'path';\nimport { BaseCommand } from '~wildo-cli/kernel/base-command';\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 { WORKSPACE_CONFIG_NAMES } from '@wildo-ai/platform-config-lib';\nimport { SaasScaffoldService } from '~wildo-cli/services/application/saas-scaffold.service';\nimport { SaasSkeletonService, SkeletonMode } from '~wildo-cli/services/application/saas-skeleton.service';\nimport type { SaasSkeletonResult } from '~wildo-cli/services/application/saas-skeleton.service';\nimport { installValidationWorkflow } from '~wildo-cli/services/deployment/ci-workflow-generator.service';\nimport { SUPPORTED_NODE_MAJOR_VERSION } from '~wildo-cli/services/deployment/host-toolchain-readiness.service';\nimport { CspSyncService } from '~wildo-cli/services/security/csp-sync.service';\nimport { VersionChecker } from '~wildo-cli/services/tools/utility-tools.service';\nimport {\n PlatformEnv_Utility_Tools,\n ToolProfile,\n} from '~wildo-cli/services/environment/environment.schemas';\nimport {\n BackingServiceSource,\n DatabaseEngine,\n WildoDeploymentRuntime,\n WildoLocationType,\n} from '@wildo-ai/platform-config-lib';\nimport { EnvironmentLifecycle } from '~wildo-cli/services/environment/environment-lifecycle.service';\nimport { EnvironmentRegistry } from '~wildo-cli/services/environment/environment-registry.service';\nimport { EnvironmentUtils } from '~wildo-cli/services/environment/environment.service';\nimport { SetupStatus } from '~wildo-cli/services/environment/environment.schemas';\nimport {\n SecretsProvisioning,\n SecretsProvisioningStatus,\n} from '~wildo-cli/services/credentials/secrets-provisioning.service';\nimport type { SecretsProvisioningOutcome } from '~wildo-cli/services/credentials/secrets-provisioning.service';\nimport {\n platformAdminUserModule,\n resolveAdminUserFromEnvSeeds,\n} from '~wildo-cli/modules/domain/credentials/admin-user.module';\nimport type { AdminUserInput } from '~wildo-cli/services/credentials/credentials.schemas';\nimport { WildoCliInitAdminEnvKeys } from '~wildo-cli/services/credentials/credentials.schemas';\nimport { ApplicationAssetsDeliveryService, ApplicationAssetsLaneStatus } from '~wildo-cli/services/application/application-assets-delivery.service';\n\nconst MINIMUM_VERSIONS: Record<string, string> = {\n /*\n * DERIVED from the framework's named authority (#421). It was a literal `'20.0.0'`, which let a\n * developer start an application on a major two behind the one the framework supports — and it\n * disagreed with `engines.node`, with the generated CI workflows and with\n * `SUPPORTED_NODE_MAJOR_VERSION` itself, four declarations of one requirement. The floor for\n * STARTING an application is the major the framework is tested on; anything lower fails later,\n * further from the cause.\n */\n [PlatformEnv_Utility_Tools.NODE]: `${SUPPORTED_NODE_MAJOR_VERSION}.0.0`,\n [PlatformEnv_Utility_Tools.PNPM]: '9.0.0',\n [PlatformEnv_Utility_Tools.DOCKER]: '20.0.0',\n [PlatformEnv_Utility_Tools.DOCKER_COMPOSE]: '2.0.0',\n [PlatformEnv_Utility_Tools.KUBECTL]: '1.25.0',\n [PlatformEnv_Utility_Tools.KIND]: '0.17.0',\n [PlatformEnv_Utility_Tools.HELM]: '3.10.0',\n // Framework-dev only: redis-memory-server (engine real-Redis integration tests) compiles redis from\n // source and needs GNU Make ≥4 (macOS ships 3.81). Optional in every profile — reported, never blocking.\n [PlatformEnv_Utility_Tools.MAKE]: '4.0.0',\n};\n\n/**\n * Renders a single tool check result as a formatted console line.\n */\nfunction renderToolCheck(\n ctx: CommandContext,\n label: string,\n check: import('~wildo-cli/services/environment/environment.schemas').ToolCheck,\n isOptional: boolean,\n): boolean {\n const paddedLabel = label.padEnd(20);\n\n if (check.installed && check.meetsMinimum) {\n const suffix = check.running === false\n ? chalk.yellow(' (not running)')\n : '';\n ctx.log.info(` ${chalk.green('✓')} ${paddedLabel} ${chalk.dim(`v${check.version}`)}${suffix}`);\n return check.running !== false;\n }\n\n if (check.installed && !check.meetsMinimum) {\n ctx.log.info(\n ` ${chalk.yellow('⚠')} ${paddedLabel} ${chalk.yellow(`v${check.version} (minimum: ${check.minimumVersion})`)}`,\n );\n return false;\n }\n\n if (isOptional) {\n ctx.log.info(` ${chalk.dim('○')} ${paddedLabel} ${chalk.dim('not found (optional)')}`);\n return true;\n }\n\n const os = VersionChecker.detectOS();\n const installHint = VersionChecker.getInstallCommand(check.name, os);\n ctx.log.info(` ${chalk.red('✗')} ${paddedLabel} ${chalk.dim('not found')}`);\n ctx.log.info(` ${chalk.dim(`Install: ${installHint}`)}`);\n return false;\n}\n\n/**\n * Profile-aware tool check. Resolves the profile from:\n * 1. --runtime flag (if passed explicitly)\n * 2. Active environment's runtime (if one exists)\n * 3. Default: DOCKER_COMPOSE\n */\nfunction runToolsCheck(ctx: CommandContext): CommandResult {\n ctx.log.info('');\n ctx.log.info(chalk.bold(' Wildo Tools Check'));\n ctx.log.info(chalk.dim(' ──────────────────'));\n\n VersionChecker.registerBuiltinCheckers();\n\n const runtimeFlag = ctx.flags.runtime as string | undefined;\n if (runtimeFlag && !Object.values(WildoDeploymentRuntime).includes(runtimeFlag as WildoDeploymentRuntime)) {\n ctx.log.warn(`Unknown runtime \"${runtimeFlag}\", defaulting to docker-compose profile.`);\n }\n const effectiveRuntime = (runtimeFlag as WildoDeploymentRuntime | undefined) ?? ctx.activeEnv?.runtime;\n const effectiveLocationType = ctx.activeEnv?.locationType;\n const profile = VersionChecker.profileFromRuntime(effectiveRuntime, effectiveLocationType);\n const profileDef = VersionChecker.PROFILE_TOOLS[profile];\n\n ctx.log.info('');\n ctx.log.info(chalk.dim(` Profile: ${profile}`));\n ctx.log.info('');\n\n let allPassed = true;\n const requiredSet = new Set(profileDef.required);\n const allTools = [...profileDef.required, ...profileDef.optional];\n\n for (const tool of allTools) {\n const minVersion = MINIMUM_VERSIONS[tool] ?? '0.0.0';\n const check = VersionChecker.checkTool(tool, minVersion);\n const isOptional = !requiredSet.has(tool);\n const passed = renderToolCheck(ctx, tool, check, isOptional);\n if (!passed && !isOptional) {\n allPassed = false;\n }\n }\n\n ctx.log.info('');\n if (allPassed) {\n ctx.log.info(chalk.green(' All required tools OK.'));\n } else {\n ctx.log.info(chalk.red(' Some required tools missing or outdated. Fix the issues above and retry.'));\n }\n ctx.log.info('');\n\n return { success: allPassed };\n}\n\nexport default class InitCommand extends BaseCommand {\n readonly meta: CommandMeta = {\n name: 'init',\n description: 'Create a new Wildo targeted app',\n category: CommandCategory.Core,\n flags: {\n name: {\n type: 'string',\n description: 'App name',\n },\n runtime: {\n type: 'string',\n description: 'Infrastructure runtime (docker-compose | kubernetes)',\n },\n database: {\n type: 'string',\n description: 'Database engine (mongodb | postgresql)',\n },\n check: {\n type: 'boolean',\n description: 'Verify tools (Docker, Node, pnpm) without scaffolding',\n default: false,\n },\n 'config-only': {\n type: 'boolean',\n description: 'Write only wildo.saas.config.ts (the pre-#51 behavior) instead of the full application skeleton',\n default: false,\n },\n 'port-base': {\n type: 'string',\n description: 'Base port for the app\\'s allocated port block (backend=base, app=base+1, companion=base+100). Default: scan sibling apps and pick the next free block',\n },\n // Platform-administrator identity for the app's `local` secrets.json. Supplying all\n // three skips the prompt, which is what makes `wildo init` scriptable end to end.\n // `WILDO_INIT_ADMIN_*` env seeds are the equivalent; flags win over seeds.\n 'admin-email': {\n type: 'string',\n description: `Platform administrator email for the local environment (env: ${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_EMAIL})`,\n },\n 'admin-first-name': {\n type: 'string',\n description: `Platform administrator first name (env: ${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_FIRSTNAME})`,\n },\n 'admin-last-name': {\n type: 'string',\n description: `Platform administrator last name (env: ${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_LASTNAME})`,\n },\n 'admin-password': {\n type: 'string',\n description: `Initial platform administrator password (env: ${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_PASSWORD}). Auto-generated when omitted`,\n },\n 'skip-install': {\n type: 'boolean',\n description: 'Skip pnpm install and the initial specifications/backend builds after scaffolding',\n default: false,\n },\n },\n };\n\n async run(ctx: CommandContext): Promise<CommandResult> {\n if (ctx.flags.check === true) {\n return runToolsCheck(ctx);\n }\n\n // INTENTIONAL: `wildo init` scaffolds a brand-new SaaS app at the operator's\n // current working directory. Unlike every other command (which must trust\n // `ctx.cliContext.resolvedHomes.app.declarationRoot`), this one has no\n // existing app root to anchor against — the whole purpose is to create a\n // `wildo.saas.config.ts` where none exists. `process.cwd()` is the correct\n // source here; the resolved-homes snapshot is still consulted immediately\n // below to detect and refuse operation inside a pre-existing scope.\n const cwd = process.cwd();\n const existingConfigPath = ctx.cliContext.resolvedHomes.app.saasConfigPath;\n\n // Re-running `wildo init` IN THE APP IT CREATED is a repair, not a mistake, and the two\n // cases must not share a verdict:\n //\n // - the resolved scope is THIS directory -> RE-RUN. Skip the scaffold (the files are\n // already there and may carry operator edits) and re-assert everything that is safe to\n // assert: the environment registration, `secrets.json`, the CI workflow. Each of those\n // steps is idempotent, so this converges instead of churning.\n // - the resolved scope is a PARENT directory -> still REFUSE. Scaffolding an application\n // inside another application is the footgun this guard was written for, and it stays shut.\n //\n // Before this split the command refused BOTH, which made `wildo init` a strictly\n // once-per-app operation — so an app that missed a step (issue #155: no `secrets.json`)\n // had no way to acquire it, and the advice printed everywhere, \"Run 'wildo init' first\",\n // was unfollowable for the very apps that needed it most.\n const isReRunInOwnApp = Boolean(existingConfigPath)\n && resolvePath(dirname(existingConfigPath!)) === resolvePath(cwd);\n\n if (existingConfigPath && !isReRunInOwnApp) {\n ctx.log.error(\n `Already in a scoped Wildo workspace (${existingConfigPath}).`,\n );\n return { success: false };\n }\n\n if (isReRunInOwnApp) {\n return this.rerunInExistingApp(ctx, cwd);\n }\n\n const configPath = `${cwd}/${WORKSPACE_CONFIG_NAMES.SAAS}`;\n if (existsSync(configPath)) {\n ctx.log.error(`${WORKSPACE_CONFIG_NAMES.SAAS} already exists in current directory.`);\n return { success: false };\n }\n\n // ── Gather app options (flag → answer file → interactive → default) ──\n\n const name = await this.prompt<string>(ctx, {\n id: 'name',\n type: 'input',\n message: 'App name',\n default: basename(cwd) || 'app',\n });\n\n const runtime = await this.prompt<WildoDeploymentRuntime>(ctx, {\n id: 'runtime',\n type: 'select',\n message: 'Infrastructure runtime:',\n choices: [\n { value: WildoDeploymentRuntime.DOCKER_COMPOSE, label: 'Docker Compose (recommended)' },\n { value: WildoDeploymentRuntime.KUBERNETES, label: 'Kubernetes (local Kind cluster)' },\n ],\n default: WildoDeploymentRuntime.DOCKER_COMPOSE,\n });\n\n const requestedDatabase = await this.prompt<DatabaseEngine>(ctx, {\n id: 'database',\n type: 'select',\n message: 'Database:',\n choices: [\n { value: DatabaseEngine.MONGODB, label: 'MongoDB (stable, recommended)' },\n { value: DatabaseEngine.POSTGRESQL, label: 'PostgreSQL (experimental)' },\n ],\n default: DatabaseEngine.MONGODB,\n });\n\n /**\n * The operator's choice is honoured as authored.\n *\n * This used to silently rewrite a PostgreSQL answer to MongoDB whenever\n * `preferences.isFrameworkDeveloper` was set, warning only after the fact. That is the second\n * of the two sites that made a PostgreSQL platform unreachable in the framework repository —\n * see the JSDoc on `platformDatabaseInitializationModule.prompt` for the full reasoning. The\n * PostgreSQL option keeps its \"(experimental)\" label and MongoDB keeps the `default:` above,\n * which is where an experimental-ness signal belongs.\n */\n const database = requestedDatabase;\n\n const trimmedName = String(name).trim();\n if (!trimmedName) {\n ctx.log.error('App name is required.');\n return { success: false };\n }\n\n const validRuntimes = Object.values(WildoDeploymentRuntime);\n if (!validRuntimes.includes(runtime)) {\n ctx.log.error(`Invalid runtime \"${runtime}\". Valid: ${validRuntimes.join(', ')}`);\n return { success: false };\n }\n\n const validDatabases = Object.values(DatabaseEngine);\n if (!validDatabases.includes(database)) {\n ctx.log.error(`Invalid database \"${database}\". Valid: ${validDatabases.join(', ')}`);\n return { success: false };\n }\n\n // ── 1. Scaffold: full application skeleton by default (issue #51 D2);\n // `--config-only` keeps the historical one-file behavior. ──\n\n const frameworkPath = ctx.cliContext.resolvedHomes.framework.repositoryRoot ?? null;\n // The mode signal is CONTAINMENT, not the operator preference: `file:` framework links are\n // only valid when the app root lives INSIDE the framework checkout (and the env-projection\n // guard later enforces exactly that for the companion). A framework developer scaffolding an\n // app OUTSIDE the checkout gets — correctly — an app-creator skeleton; an in-checkout scaffold\n // is framework-dev regardless of the stored preference flag.\n const appInsideFramework = frameworkPath !== null && !relative(frameworkPath, cwd).startsWith('..');\n const skeletonMode: SkeletonMode = appInsideFramework ? SkeletonMode.FRAMEWORK_DEV : SkeletonMode.APP_CREATOR;\n const portBaseFlag = (ctx.flags.portBase ?? ctx.flags['port-base']) as string | undefined;\n const portBase = portBaseFlag !== undefined ? Number.parseInt(portBaseFlag, 10) : undefined;\n if (portBaseFlag !== undefined && (!Number.isInteger(portBase) || (portBase as number) < 1024 || (portBase as number) > 65000)) {\n ctx.log.error(`Invalid --port-base \"${portBaseFlag}\" — expected an integer port between 1024 and 65000.`);\n return { success: false };\n }\n\n let path: string;\n let skeletonResult: SaasSkeletonResult | null = null;\n if (ctx.flags.configOnly === true || ctx.flags['config-only'] === true) {\n path = SaasScaffoldService.scaffold(cwd, { name: trimmedName });\n } else {\n try {\n skeletonResult = SaasSkeletonService.scaffold(cwd, {\n name: trimmedName,\n frameworkPath,\n mode: skeletonMode,\n ...(portBase !== undefined ? { portBase } : {}),\n skipInstall: ctx.flags.skipInstall === true || ctx.flags['skip-install'] === true,\n log: ctx.log,\n });\n path = `${cwd}/${WORKSPACE_CONFIG_NAMES.SAAS}`;\n } catch (error) {\n ctx.log.error(`Skeleton scaffold failed: ${ErrorUtils.extractErrorMessage(error)}`);\n return { success: false };\n }\n }\n\n // ── 2. Register default local environment ──\n //\n // Under an explicit saas-root override: the CLI resolved its workspace scope at STARTUP, before\n // step 1 scaffolded `wildo.saas.config.ts`, so on the first run the registry sees no app root and\n // `EnvironmentPaths` throws \"No targeted app root detected\" — the command that CREATES the root\n // was the one command that could not register against it (measured on the first scratch-app\n // bootstrap, 2026-08-25). The scaffold just made `cwd` the app root; say so.\n await EnvironmentRegistry.withSaasRootOverride(cwd, () => {\n EnvironmentLifecycle.initializeLocal({\n runtime,\n database: {\n engine: database,\n source: BackingServiceSource.SELF,\n },\n });\n });\n\n // ── 2b. Provision that environment's `secrets.json` (issue #155) ──\n //\n // Runs under the SAME saas-root override as the registration above, and for the same\n // reason: `ConfigSecretsUtils.writeSecretsJson` resolves its directory through\n // `EnvironmentPaths.resolveSecretsDir`, which reads the registry's app root. Outside the\n // override that is still the pre-scaffold scope, so the file would land in the wrong app\n // (or nowhere).\n const secretsOutcome = await EnvironmentRegistry.withSaasRootOverride(\n cwd,\n () => this.provisionLocalSecrets(ctx),\n );\n\n // ── 3. Materialize the per-PR validation workflow (Slice 6.8 / F-48) ──\n //\n // Every freshly-scaffolded app gets `.github/workflows/wildo-config-validation.yml`\n // by default so a config drift, a broken K8s template render, or a\n // missing `wildo config validate --domain cicd` workflow itself\n // fails the PR before reaching a deploy branch. Best-effort —\n // installer failure must NOT block scaffold success because the\n // operator can re-run `wildo setup` to back-fill it.\n const validationWorkflowResult = this.materializeValidationWorkflow(\n ctx, cwd, trimmedName,\n );\n /*\n * App-creator mode delivers the framework-owned asset homes HERE, from the packages the\n * scaffold just installed (the framework-developer lane gets them from the checkout on every\n * orchestrator tick instead). With `--skip-install` the knowledge lanes wait for\n * `pnpm install` + `wildo assets sync`; the templates lane needs no install and lands now.\n */\n const assetsResult = skeletonResult && skeletonMode === SkeletonMode.APP_CREATOR\n ? ApplicationAssetsDeliveryService.deliver({\n applicationRoot: cwd,\n frameworkAssetsRoot: ctx.cliContext.resolvedHomes.framework.repositoryRoot,\n })\n : null;\n\n // Resolved here rather than left to the first `wildo dev start`, so the scaffold's generated\n // artifact is OUTPUT rather than a hand-written file that looks like output (#417).\n const cspResult = skeletonResult ? await this.resolveInitialCspArtifact(ctx, cwd, skeletonResult.installed) : null;\n\n // ── 4. Output summary and next steps ──\n\n ctx.log.info('');\n ctx.log.success(` Created ${path}`);\n ctx.log.info('');\n ctx.log.info(chalk.dim(` Runtime: ${runtime}`));\n ctx.log.info(chalk.dim(` Database: ${database}`));\n if (skeletonResult) {\n ctx.log.info(chalk.dim(` Skeleton: ${skeletonResult.filesWritten} files (mode: ${skeletonMode})`));\n ctx.log.info(chalk.dim(\n ` Ports: backend ${skeletonResult.ports.backend} · app ${skeletonResult.ports.app} · companion ${skeletonResult.ports.companion}`,\n ));\n ctx.log.info(chalk.dim(\n ` Companion: ${skeletonResult.companionDelivered ? 'dist delivered' : 'NOT delivered (see warning above)'}`,\n ));\n if (!skeletonResult.built && ctx.flags.skipInstall !== true && ctx.flags['skip-install'] !== true) {\n ctx.log.warn(' Initial build incomplete — run `pnpm install && pnpm build` in the app before `wildo setup`.');\n }\n }\n ctx.log.info(chalk.dim(` Environment 'local' registered under .wildo-saas`));\n this.reportSecretsOutcome(ctx, secretsOutcome);\n if (validationWorkflowResult) {\n ctx.log.info(chalk.dim(` CI gate: ${validationWorkflowResult}`));\n }\n if (cspResult) {\n ctx.log.info(chalk.dim(` CSP: ${cspResult}`));\n }\n if (assetsResult) {\n const describe = (lane: { status: string; detail: string }): string =>\n lane.status === ApplicationAssetsLaneStatus.DELIVERED ? lane.detail : `NOT delivered (${lane.detail})`;\n ctx.log.info(chalk.dim(` Templates: ${describe(assetsResult.templates)}`));\n ctx.log.info(chalk.dim(` Docs: ${describe(assetsResult.docs)}`));\n ctx.log.info(chalk.dim(` Skills: ${describe(assetsResult.skills)}`));\n if ([assetsResult.docs, assetsResult.skills].some((lane) => lane.status === ApplicationAssetsLaneStatus.SKIPPED)) {\n ctx.log.warn(' Run `pnpm install && wildo assets sync` to deliver the framework knowledge into .claude/ and .wildo-saas/docs.');\n }\n }\n ctx.log.info('');\n ctx.log.info(' Next steps:');\n ctx.log.info('');\n ctx.log.info(` ${chalk.bold('wildo init --check')} Verify your development tools`);\n // Named right after install because the pins written above come from the framework CHECKOUT,\n // while the application installs the PUBLISHED @wildo-ai/* version — the two disagree whenever\n // the checkout is ahead of the last release, which between releases is always. `align-deps`\n // reads what was actually installed and makes them exact (issue #222).\n ctx.log.info(` ${chalk.bold('wildo align-deps --write')} Align pins with the framework version you installed`);\n ctx.log.info(` ${chalk.bold('wildo assets sync')} Re-deliver templates, docs, skills and rules after a framework upgrade`);\n ctx.log.info(` ${chalk.bold('wildo config sync')} Generate environment configuration`);\n ctx.log.info(` ${chalk.bold('wildo dev start')} Start local development`);\n ctx.log.info('');\n // Said here because the order above is the one a first-time creator follows literally, and the\n // deploy-artifact half of `config sync` cannot succeed until a platform exists and knows this\n // application. It now SKIPS that half with a named reason rather than failing the command\n // (issue #279) — so this line explains a message they will see, not a failure they must avoid.\n ctx.log.info(chalk.dim(' CI deploy artifacts are produced once a platform is running and this'));\n ctx.log.info(chalk.dim(' application is registered; until then `config sync` writes the local'));\n ctx.log.info(chalk.dim(' artifacts and says which step it skipped.'));\n ctx.log.info('');\n\n return { success: true };\n }\n\n /**\n * `wildo init` re-run inside the application it already created.\n *\n * Deliberately does NOT re-scaffold. The 286 skeleton files are on disk and may carry\n * operator edits; `SaasSkeletonService` refuses a non-empty directory for exactly that\n * reason. What a re-run is FOR is re-asserting the machine-local, non-source state that a\n * scaffold alone does not guarantee — and every step here is idempotent, so running it\n * repeatedly converges rather than churning:\n *\n * - the `local` environment registration (`initializeEnvironment` returns an existing\n * registration untouched);\n * - `secrets.json` — created when absent, otherwise BACKFILLED with any framework-managed\n * material declared since the app was created, rotating nothing (issue #155);\n * - the per-PR validation workflow, which leaves an existing file in place.\n *\n * No prompts for name / runtime / database: those are already answered by the registration\n * and by `wildo.saas.config.ts`, and re-asking would invite an answer that contradicts what\n * is on disk. The administrator is asked for only when there is no `secrets.json` to read\n * one from.\n */\n private async rerunInExistingApp(ctx: CommandContext, cwd: string): Promise<CommandResult> {\n ctx.log.info('');\n ctx.log.info(chalk.dim(` Existing Wildo application detected at ${cwd}`));\n ctx.log.info(chalk.dim(' Re-running init: skeleton left untouched, machine-local state re-asserted.'));\n\n const secretsReport = await EnvironmentRegistry.withSaasRootOverride(\n cwd,\n () => this.provisionLocalSecrets(ctx),\n );\n\n const appName = basename(cwd) || 'app';\n const validationWorkflowResult = this.materializeValidationWorkflow(ctx, cwd, appName);\n\n ctx.log.info('');\n this.reportSecretsOutcome(ctx, secretsReport);\n if (validationWorkflowResult) {\n ctx.log.info(chalk.dim(` CI gate: ${validationWorkflowResult}`));\n }\n ctx.log.info('');\n ctx.log.info(' Next steps:');\n ctx.log.info('');\n ctx.log.info(` ${chalk.bold('wildo align-deps --write')} Align pins with the framework version you installed`);\n ctx.log.info(` ${chalk.bold('wildo assets sync')} Re-deliver templates, docs, skills and rules after a framework upgrade`);\n ctx.log.info(` ${chalk.bold('wildo config sync')} Generate environment configuration`);\n ctx.log.info(` ${chalk.bold('wildo dev start')} Start local development`);\n ctx.log.info('');\n\n // A re-run that could not resolve an administrator has NOT delivered secrets, and the\n // whole point of the re-run was to deliver them — so unlike the scaffold path (where a\n // warning rides alongside 286 files that were genuinely written), there is nothing else\n // to report success about.\n return { success: Boolean(secretsReport.outcome) };\n }\n\n /**\n * Ensure the freshly-registered `local` environment has a complete `secrets.json`.\n *\n * Two branches, and the split is what makes `wildo init` safe to re-run (issue #155):\n *\n * - **A file already exists** — the administrator identity is on disk, so we never\n * re-ask for it, and we hand the EXISTING secrets to the additive provisioner. That\n * backfills any material the framework has declared since the app was created and\n * rotates nothing. A credential a running deployment already holds is never rewritten;\n * re-minting one would orphan the Mongo/Valkey data it protects.\n * - **No file** — resolve the operator-typed half (the administrator) and CREATE it.\n *\n * Returns `blockedReason` instead of throwing when the administrator cannot be resolved.\n * The scaffold has already been written to disk at this point, so failing the whole\n * command would be a confusing lie about what happened; the summary reports the gap and\n * names the exact remedy instead, and a re-run is idempotent.\n */\n private async provisionLocalSecrets(\n ctx: CommandContext,\n ): Promise<{ outcome: SecretsProvisioningOutcome | null; blockedReason?: string }> {\n const envName = WildoLocationType.LOCAL;\n\n if (EnvironmentUtils.loadSecretsJson(envName)) {\n return { outcome: SecretsProvisioning.ensureForEnvironment(envName) };\n }\n\n let admin: AdminUserInput;\n try {\n admin = await this.resolveAdministratorIdentity(ctx);\n } catch (error) {\n return { outcome: null, blockedReason: ErrorUtils.extractErrorMessage(error) };\n }\n\n const outcome = SecretsProvisioning.ensureForEnvironment(envName, {\n createWith: {\n admin: {\n email: admin.email,\n firstName: admin.firstName,\n lastName: admin.lastName,\n // OMITTED rather than passed as `undefined` when the operator gave no password:\n // the ADMIN_PASSWORD framework-managed material mints a 16-char one, which keeps\n // the \"who minted this?\" answer in a single registry.\n ...(admin.password ? { password: admin.password } : {}),\n },\n },\n });\n\n // Mark the environment set up. This is not cosmetic: `runEnvSetup` treats a non-COMPLETED\n // environment as first-time and rebuilds `secrets.json` from a FRESH draft — so without\n // this, a later `wildo setup` would silently ROTATE the credentials just minted here and\n // orphan whatever data they already protect. With it, setup reports \"existing setup\n // detected\" and no-ops unless the operator asks for `--force`, which is the deliberate\n // re-author door.\n EnvironmentLifecycle.setSetupStatus(SetupStatus.COMPLETED, envName);\n\n return { outcome };\n }\n\n /**\n * Resolve the platform-administrator identity for the app's local `secrets.json`.\n *\n * Four doors, in order — flags, env seeds, prompt, refusal:\n *\n * 1. `--admin-email` + `--admin-first-name` + `--admin-last-name` (all three, together).\n * 2. `--non-interactive` -> the `WILDO_INIT_ADMIN_*` seeds, fail-closed when absent.\n * 3. interactive -> the shared `wildo setup` prompt, with the seeds as prefilled defaults.\n *\n * No door substitutes a placeholder, and that is deliberate rather than strict. A literal\n * 'Admin' / 'User' / `noreply@example.com` silently seeds the platform-admin USER RECORD\n * with non-meaningful identity, which regresses audit trails, password-reset email and the\n * bootstrap email-confirm flow — and apps-manager requires `ADMIN_FIRST_NAME` /\n * `ADMIN_LAST_NAME` fail-closed anyway. See `platformAdminUserModule`, which owns that\n * doctrine and which door 3 reuses rather than re-implementing.\n *\n * Only the PASSWORD may be omitted; the secrets writer generates one.\n */\n private async resolveAdministratorIdentity(ctx: CommandContext): Promise<AdminUserInput> {\n const email = this.readAdminFlag(ctx, 'admin-email', 'adminEmail');\n const firstName = this.readAdminFlag(ctx, 'admin-first-name', 'adminFirstName');\n const lastName = this.readAdminFlag(ctx, 'admin-last-name', 'adminLastName');\n const password = this.readAdminFlag(ctx, 'admin-password', 'adminPassword');\n\n const missing = [\n !email && '--admin-email',\n !firstName && '--admin-first-name',\n !lastName && '--admin-last-name',\n ].filter((flag): flag is string => Boolean(flag));\n\n if (missing.length === 0) {\n if (!(email!.includes('@') && email!.includes('.'))) {\n throw new Error(`--admin-email is not a valid email address: \"${email}\".`);\n }\n return { email: email!, firstName: firstName!, lastName: lastName!, password };\n }\n\n // A PARTIAL set of flags is an operator mistake, not a request to fall back. Falling\n // through to a prompt here would silently discard the values that WERE supplied.\n if (missing.length < 3) {\n throw new Error(\n 'Partial platform-administrator flags: --admin-email, --admin-first-name and '\n + `--admin-last-name must be supplied together. Missing: ${missing.join(', ')}.`,\n );\n }\n\n if (ctx.globalFlags.nonInteractive === true) {\n return resolveAdminUserFromEnvSeeds(ctx.log);\n }\n\n return platformAdminUserModule.prompt({ log: ctx.log });\n }\n\n /**\n * Read one administrator flag in both spellings the kernel may expose it under, mirroring\n * how `--config-only` / `--port-base` are read elsewhere in this command. Blank strings\n * are treated as absent so a stray `--admin-email=` cannot install an empty identity.\n */\n private readAdminFlag(ctx: CommandContext, kebab: string, camel: string): string | undefined {\n const raw = (ctx.flags[camel] ?? ctx.flags[kebab]) as string | undefined;\n if (typeof raw !== 'string') return undefined;\n const trimmed = raw.trim();\n return trimmed === '' ? undefined : trimmed;\n }\n\n /** Render the secrets step's result as one line of the scaffold summary. */\n private reportSecretsOutcome(\n ctx: CommandContext,\n report: { outcome: SecretsProvisioningOutcome | null; blockedReason?: string },\n ): void {\n if (!report.outcome) {\n ctx.log.warn(` Secrets: NOT provisioned — ${report.blockedReason}`);\n ctx.log.warn(\n \" `wildo config sync` will fail its env-files phase until they exist. \"\n + 'Re-run `wildo init` with --admin-email / --admin-first-name / --admin-last-name '\n + `(or set ${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_EMAIL}, `\n + `${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_FIRSTNAME}, `\n + `${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_LASTNAME}) — it is idempotent and `\n + 'leaves everything already scaffolded untouched.',\n );\n return;\n }\n\n switch (report.outcome.status) {\n case SecretsProvisioningStatus.CREATED:\n ctx.log.info(chalk.dim(\n ` Secrets: secrets.json minted (${report.outcome.mintedRefs.length} framework-managed materials)`,\n ));\n break;\n case SecretsProvisioningStatus.PROVISIONED:\n ctx.log.info(chalk.dim(\n ` Secrets: secrets.json backfilled (${report.outcome.mintedRefs.length} newly-declared material(s), nothing rotated)`,\n ));\n break;\n case SecretsProvisioningStatus.ALREADY_COMPLETE:\n ctx.log.info(chalk.dim(' Secrets: secrets.json already complete — nothing minted'));\n break;\n case SecretsProvisioningStatus.NO_SECRETS_FILE:\n // Unreachable: the create branch above always supplies `createWith`. Reported rather\n // than ignored so a future refactor that drops the draft cannot fail silently.\n ctx.log.warn(' Secrets: not provisioned — no operator draft reached the provisioner.');\n break;\n }\n }\n\n /**\n * Best-effort install of the per-PR validation workflow. Returns a\n * one-line human-readable status the caller can render in the\n * scaffold summary, or `null` if the framework path could not be\n * resolved (e.g. operator is running a globally-installed CLI without\n * the framework checkout — rare, but the scaffold must still succeed).\n *\n * Slice 6.8 / F-48 — kept in `init` so a brand-new app gets the gate\n * by default, and mirrored in `wildo setup` so existing pre-Slice-6.8\n * apps can back-fill it idempotently.\n */\n /**\n * Resolve `src/generated/csp.generated.json` FOR REAL, right after the scaffold installs (#417).\n *\n * The skeleton ships a hand-written `csp.generated.json.hbs` — a generated-LOOKING artifact that\n * no resolution produced. It exists because the frontend imports the file at build time, so\n * something has to be there before the first `wildo dev start` runs the sync. Keeping it is fine;\n * shipping it as the ONLY thing that ever wrote that path was not.\n *\n * BEST-EFFORT by design, the same posture this command already takes for the validation workflow\n * and the asset homes: a scaffold that produced 286 correct files must not fail because one\n * derived artifact could not be resolved. The next `wildo dev start` resolves it anyway, so the\n * cost of a miss is that the placeholder survives one step longer.\n *\n * Skipped without install, because resolving loads the application's own TypeScript config\n * through its `node_modules`.\n */\n private async resolveInitialCspArtifact(\n ctx: CommandContext,\n appRoot: string,\n installed: boolean,\n ): Promise<string | null> {\n if (!installed) {\n return null;\n }\n try {\n const result = await CspSyncService.sync({\n saasRoot: appRoot,\n envName: 'local',\n // No `serviceKey`: every CSP-capable frontend the scaffold produced is resolved, so a\n // scenario that added a website or a docs portal is covered without naming them here.\n env: process.env,\n });\n const written = result.services.filter((service) => service.wroteChanges).length;\n return written > 0 ? `resolved ${written} CSP artifact(s)` : null;\n } catch (error) {\n ctx.log.warn(\n `Could not resolve the initial CSP artifact: ${ErrorUtils.extractErrorMessage(error)}. `\n + 'The scaffold placeholder is still in place; `wildo dev start` resolves it.',\n );\n return null;\n }\n }\n\n private materializeValidationWorkflow(\n ctx: CommandContext,\n appRoot: string,\n appName: string,\n ): string | null {\n const frameworkPath = ctx.cliContext.resolvedHomes.framework.repositoryRoot;\n if (!frameworkPath) {\n ctx.log.warn(\n 'Skipping `.github/workflows/wildo-config-validation.yml` install: framework path not resolved. '\n + 'Re-run `wildo setup` from this app once the framework is on PATH.',\n );\n return null;\n }\n try {\n const result = installValidationWorkflow(appRoot, frameworkPath, { appName });\n if (result.created) {\n return `installed ${result.path.replace(`${appRoot}/`, '')}`;\n }\n if (result.skipped) {\n return `${result.path.replace(`${appRoot}/`, '')} already present (left in place)`;\n }\n return result.path;\n } catch (error) {\n ctx.log.warn(\n `Could not install per-PR validation workflow: ${ErrorUtils.extractErrorMessage(error)}. `\n + 'Re-run `wildo setup` to retry.',\n );\n return null;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"init.command.js","sourceRoot":"","sources":["../../../src/commands/init.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,MAAM,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAE1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,uDAAuD,CAAC;AAE1G,OAAO,EAAE,yBAAyB,EAAE,MAAM,8DAA8D,CAAC;AACzG,OAAO,EAAE,4BAA4B,EAAE,MAAM,iEAAiE,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACjF,OAAO,EACL,yBAAyB,GAE1B,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+DAA+D,CAAC;AACrG,OAAO,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,M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mB,CAAC,KAAK,CAAC,IAAI;kBACxF,gCAAgC,CACnC,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF","sourcesContent":["/**\n * init — Create a new Wildo targeted app (`wildo.saas.config.ts`).\n *\n * Uses prompt() for interactive flow with automatic flag resolution:\n * --name, --runtime, --database skip the corresponding prompts.\n *\n * Side effects:\n * 1. Writes `wildo.saas.config.ts` via `SaasScaffoldService`\n * 2. Registers a default 'local' environment in EnvironmentRegistry\n * with the chosen runtime + database\n * 3. Provisions that environment's `secrets.json` (issue #155)\n *\n * On (3): `secrets.json` is PER-APPLICATION, and before #155 nothing on the app-creator\n * path ever wrote one — `wildo setup` was the sole minter and it fail-closes without a\n * framework checkout, which an app created outside the monorepo does not have. The result\n * was `wildo config sync` failing its `env-files` phase with \"No secrets for 'local'. Run\n * 'wildo init' first.\" at the end of a run of `wildo init`, and the companion then dying on\n * a NaN `PORT`. Init now mints them, so that message is true.\n *\n * It is IDEMPOTENT, deliberately: minting routes through the same additive\n * `provisionFrameworkManagedSecrets` registry that the self-heal paths use, so re-running\n * `wildo init` over an existing app backfills any newly-declared material and rotates\n * NOTHING — re-minting a live credential would orphan the Mongo/Valkey data it protects.\n * A re-run also never re-asks for the administrator: the identity is already on disk.\n *\n * Supports --check to verify tools only (profile-aware: K8s tools\n * checked only when the active environment uses a K8s runtime).\n */\n\nimport chalk from 'chalk';\nimport { existsSync } from 'fs';\nimport { basename, dirname, relative, resolve as resolvePath } from 'path';\nimport { BaseCommand } from '~wildo-cli/kernel/base-command';\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 { WORKSPACE_CONFIG_NAMES } from '@wildo-ai/platform-config-lib';\nimport { SaasScaffoldService } from '~wildo-cli/services/application/saas-scaffold.service';\nimport { SaasSkeletonService, SkeletonMode } from '~wildo-cli/services/application/saas-skeleton.service';\nimport type { SaasSkeletonResult } from '~wildo-cli/services/application/saas-skeleton.service';\nimport { installValidationWorkflow } from '~wildo-cli/services/deployment/ci-workflow-generator.service';\nimport { SUPPORTED_NODE_MAJOR_VERSION } from '~wildo-cli/services/deployment/host-toolchain-readiness.service';\nimport { CspSyncService } from '~wildo-cli/services/security/csp-sync.service';\nimport { VersionChecker } from '~wildo-cli/services/tools/utility-tools.service';\nimport {\n PlatformEnv_Utility_Tools,\n ToolProfile,\n} from '~wildo-cli/services/environment/environment.schemas';\nimport {\n BackingServiceSource,\n DatabaseEngine,\n WildoDeploymentRuntime,\n WildoLocationType,\n} from '@wildo-ai/platform-config-lib';\nimport { EnvironmentLifecycle } from '~wildo-cli/services/environment/environment-lifecycle.service';\nimport { EnvironmentRegistry } from '~wildo-cli/services/environment/environment-registry.service';\nimport { EnvironmentUtils } from '~wildo-cli/services/environment/environment.service';\nimport { SetupStatus } from '~wildo-cli/services/environment/environment.schemas';\nimport {\n SecretsProvisioning,\n SecretsProvisioningStatus,\n} from '~wildo-cli/services/credentials/secrets-provisioning.service';\nimport type { SecretsProvisioningOutcome } from '~wildo-cli/services/credentials/secrets-provisioning.service';\nimport {\n platformAdminUserModule,\n resolveAdminUserFromEnvSeeds,\n} from '~wildo-cli/modules/domain/credentials/admin-user.module';\nimport { resolveApproverIdentity } from '~wildo-cli/modules/domain/credentials/approver-user.module';\nimport type { AdminUserInput } from '~wildo-cli/services/credentials/credentials.schemas';\nimport { WildoCliInitAdminEnvKeys } from '~wildo-cli/services/credentials/credentials.schemas';\nimport { ApplicationAssetsDeliveryService, ApplicationAssetsLaneStatus } from '~wildo-cli/services/application/application-assets-delivery.service';\n\nconst MINIMUM_VERSIONS: Record<string, string> = {\n /*\n * DERIVED from the framework's named authority (#421). It was a literal `'20.0.0'`, which let a\n * developer start an application on a major two behind the one the framework supports — and it\n * disagreed with `engines.node`, with the generated CI workflows and with\n * `SUPPORTED_NODE_MAJOR_VERSION` itself, four declarations of one requirement. The floor for\n * STARTING an application is the major the framework is tested on; anything lower fails later,\n * further from the cause.\n */\n [PlatformEnv_Utility_Tools.NODE]: `${SUPPORTED_NODE_MAJOR_VERSION}.0.0`,\n [PlatformEnv_Utility_Tools.PNPM]: '9.0.0',\n [PlatformEnv_Utility_Tools.DOCKER]: '20.0.0',\n [PlatformEnv_Utility_Tools.DOCKER_COMPOSE]: '2.0.0',\n [PlatformEnv_Utility_Tools.KUBECTL]: '1.25.0',\n [PlatformEnv_Utility_Tools.KIND]: '0.17.0',\n [PlatformEnv_Utility_Tools.HELM]: '3.10.0',\n // Framework-dev only: redis-memory-server (engine real-Redis integration tests) compiles redis from\n // source and needs GNU Make ≥4 (macOS ships 3.81). Optional in every profile — reported, never blocking.\n [PlatformEnv_Utility_Tools.MAKE]: '4.0.0',\n};\n\n/**\n * Renders a single tool check result as a formatted console line.\n */\nfunction renderToolCheck(\n ctx: CommandContext,\n label: string,\n check: import('~wildo-cli/services/environment/environment.schemas').ToolCheck,\n isOptional: boolean,\n): boolean {\n const paddedLabel = label.padEnd(20);\n\n if (check.installed && check.meetsMinimum) {\n const suffix = check.running === false\n ? chalk.yellow(' (not running)')\n : '';\n ctx.log.info(` ${chalk.green('✓')} ${paddedLabel} ${chalk.dim(`v${check.version}`)}${suffix}`);\n return check.running !== false;\n }\n\n if (check.installed && !check.meetsMinimum) {\n ctx.log.info(\n ` ${chalk.yellow('⚠')} ${paddedLabel} ${chalk.yellow(`v${check.version} (minimum: ${check.minimumVersion})`)}`,\n );\n return false;\n }\n\n if (isOptional) {\n ctx.log.info(` ${chalk.dim('○')} ${paddedLabel} ${chalk.dim('not found (optional)')}`);\n return true;\n }\n\n const os = VersionChecker.detectOS();\n const installHint = VersionChecker.getInstallCommand(check.name, os);\n ctx.log.info(` ${chalk.red('✗')} ${paddedLabel} ${chalk.dim('not found')}`);\n ctx.log.info(` ${chalk.dim(`Install: ${installHint}`)}`);\n return false;\n}\n\n/**\n * Profile-aware tool check. Resolves the profile from:\n * 1. --runtime flag (if passed explicitly)\n * 2. Active environment's runtime (if one exists)\n * 3. Default: DOCKER_COMPOSE\n */\nfunction runToolsCheck(ctx: CommandContext): CommandResult {\n ctx.log.info('');\n ctx.log.info(chalk.bold(' Wildo Tools Check'));\n ctx.log.info(chalk.dim(' ──────────────────'));\n\n VersionChecker.registerBuiltinCheckers();\n\n const runtimeFlag = ctx.flags.runtime as string | undefined;\n if (runtimeFlag && !Object.values(WildoDeploymentRuntime).includes(runtimeFlag as WildoDeploymentRuntime)) {\n ctx.log.warn(`Unknown runtime \"${runtimeFlag}\", defaulting to docker-compose profile.`);\n }\n const effectiveRuntime = (runtimeFlag as WildoDeploymentRuntime | undefined) ?? ctx.activeEnv?.runtime;\n const effectiveLocationType = ctx.activeEnv?.locationType;\n const profile = VersionChecker.profileFromRuntime(effectiveRuntime, effectiveLocationType);\n const profileDef = VersionChecker.PROFILE_TOOLS[profile];\n\n ctx.log.info('');\n ctx.log.info(chalk.dim(` Profile: ${profile}`));\n ctx.log.info('');\n\n let allPassed = true;\n const requiredSet = new Set(profileDef.required);\n const allTools = [...profileDef.required, ...profileDef.optional];\n\n for (const tool of allTools) {\n const minVersion = MINIMUM_VERSIONS[tool] ?? '0.0.0';\n const check = VersionChecker.checkTool(tool, minVersion);\n const isOptional = !requiredSet.has(tool);\n const passed = renderToolCheck(ctx, tool, check, isOptional);\n if (!passed && !isOptional) {\n allPassed = false;\n }\n }\n\n ctx.log.info('');\n if (allPassed) {\n ctx.log.info(chalk.green(' All required tools OK.'));\n } else {\n ctx.log.info(chalk.red(' Some required tools missing or outdated. Fix the issues above and retry.'));\n }\n ctx.log.info('');\n\n return { success: allPassed };\n}\n\nexport default class InitCommand extends BaseCommand {\n readonly meta: CommandMeta = {\n name: 'init',\n description: 'Create a new Wildo targeted app',\n category: CommandCategory.Core,\n flags: {\n name: {\n type: 'string',\n description: 'App name',\n },\n runtime: {\n type: 'string',\n description: 'Infrastructure runtime (docker-compose | kubernetes)',\n },\n database: {\n type: 'string',\n description: 'Database engine (mongodb | postgresql)',\n },\n check: {\n type: 'boolean',\n description: 'Verify tools (Docker, Node, pnpm) without scaffolding',\n default: false,\n },\n 'config-only': {\n type: 'boolean',\n description: 'Write only wildo.saas.config.ts (the pre-#51 behavior) instead of the full application skeleton',\n default: false,\n },\n 'port-base': {\n type: 'string',\n description: 'Base port for the app\\'s allocated port block (backend=base, app=base+1, companion=base+100). Default: scan sibling apps and pick the next free block',\n },\n // Platform-administrator identity for the app's `local` secrets.json. Supplying all\n // three skips the prompt, which is what makes `wildo init` scriptable end to end.\n // `WILDO_INIT_ADMIN_*` env seeds are the equivalent; flags win over seeds.\n 'admin-email': {\n type: 'string',\n description: `Platform administrator email for the local environment (env: ${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_EMAIL})`,\n },\n 'admin-first-name': {\n type: 'string',\n description: `Platform administrator first name (env: ${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_FIRSTNAME})`,\n },\n 'admin-last-name': {\n type: 'string',\n description: `Platform administrator last name (env: ${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_LASTNAME})`,\n },\n 'admin-password': {\n type: 'string',\n description: `Initial platform administrator password (env: ${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_PASSWORD}). Auto-generated when omitted`,\n },\n 'skip-install': {\n type: 'boolean',\n description: 'Skip pnpm install and the initial specifications/backend builds after scaffolding',\n default: false,\n },\n },\n };\n\n async run(ctx: CommandContext): Promise<CommandResult> {\n if (ctx.flags.check === true) {\n return runToolsCheck(ctx);\n }\n\n // INTENTIONAL: `wildo init` scaffolds a brand-new SaaS app at the operator's\n // current working directory. Unlike every other command (which must trust\n // `ctx.cliContext.resolvedHomes.app.declarationRoot`), this one has no\n // existing app root to anchor against — the whole purpose is to create a\n // `wildo.saas.config.ts` where none exists. `process.cwd()` is the correct\n // source here; the resolved-homes snapshot is still consulted immediately\n // below to detect and refuse operation inside a pre-existing scope.\n const cwd = process.cwd();\n const existingConfigPath = ctx.cliContext.resolvedHomes.app.saasConfigPath;\n\n // Re-running `wildo init` IN THE APP IT CREATED is a repair, not a mistake, and the two\n // cases must not share a verdict:\n //\n // - the resolved scope is THIS directory -> RE-RUN. Skip the scaffold (the files are\n // already there and may carry operator edits) and re-assert everything that is safe to\n // assert: the environment registration, `secrets.json`, the CI workflow. Each of those\n // steps is idempotent, so this converges instead of churning.\n // - the resolved scope is a PARENT directory -> still REFUSE. Scaffolding an application\n // inside another application is the footgun this guard was written for, and it stays shut.\n //\n // Before this split the command refused BOTH, which made `wildo init` a strictly\n // once-per-app operation — so an app that missed a step (issue #155: no `secrets.json`)\n // had no way to acquire it, and the advice printed everywhere, \"Run 'wildo init' first\",\n // was unfollowable for the very apps that needed it most.\n const isReRunInOwnApp = Boolean(existingConfigPath)\n && resolvePath(dirname(existingConfigPath!)) === resolvePath(cwd);\n\n if (existingConfigPath && !isReRunInOwnApp) {\n ctx.log.error(\n `Already in a scoped Wildo workspace (${existingConfigPath}).`,\n );\n return { success: false };\n }\n\n if (isReRunInOwnApp) {\n return this.rerunInExistingApp(ctx, cwd);\n }\n\n const configPath = `${cwd}/${WORKSPACE_CONFIG_NAMES.SAAS}`;\n if (existsSync(configPath)) {\n ctx.log.error(`${WORKSPACE_CONFIG_NAMES.SAAS} already exists in current directory.`);\n return { success: false };\n }\n\n // ── Gather app options (flag → answer file → interactive → default) ──\n\n const name = await this.prompt<string>(ctx, {\n id: 'name',\n type: 'input',\n message: 'App name',\n default: basename(cwd) || 'app',\n });\n\n const runtime = await this.prompt<WildoDeploymentRuntime>(ctx, {\n id: 'runtime',\n type: 'select',\n message: 'Infrastructure runtime:',\n choices: [\n { value: WildoDeploymentRuntime.DOCKER_COMPOSE, label: 'Docker Compose (recommended)' },\n { value: WildoDeploymentRuntime.KUBERNETES, label: 'Kubernetes (local Kind cluster)' },\n ],\n default: WildoDeploymentRuntime.DOCKER_COMPOSE,\n });\n\n const requestedDatabase = await this.prompt<DatabaseEngine>(ctx, {\n id: 'database',\n type: 'select',\n message: 'Database:',\n choices: [\n { value: DatabaseEngine.MONGODB, label: 'MongoDB (stable, recommended)' },\n { value: DatabaseEngine.POSTGRESQL, label: 'PostgreSQL (experimental)' },\n ],\n default: DatabaseEngine.MONGODB,\n });\n\n /**\n * The operator's choice is honoured as authored.\n *\n * This used to silently rewrite a PostgreSQL answer to MongoDB whenever\n * `preferences.isFrameworkDeveloper` was set, warning only after the fact. That is the second\n * of the two sites that made a PostgreSQL platform unreachable in the framework repository —\n * see the JSDoc on `platformDatabaseInitializationModule.prompt` for the full reasoning. The\n * PostgreSQL option keeps its \"(experimental)\" label and MongoDB keeps the `default:` above,\n * which is where an experimental-ness signal belongs.\n */\n const database = requestedDatabase;\n\n const trimmedName = String(name).trim();\n if (!trimmedName) {\n ctx.log.error('App name is required.');\n return { success: false };\n }\n\n const validRuntimes = Object.values(WildoDeploymentRuntime);\n if (!validRuntimes.includes(runtime)) {\n ctx.log.error(`Invalid runtime \"${runtime}\". Valid: ${validRuntimes.join(', ')}`);\n return { success: false };\n }\n\n const validDatabases = Object.values(DatabaseEngine);\n if (!validDatabases.includes(database)) {\n ctx.log.error(`Invalid database \"${database}\". Valid: ${validDatabases.join(', ')}`);\n return { success: false };\n }\n\n // ── 1. Scaffold: full application skeleton by default (issue #51 D2);\n // `--config-only` keeps the historical one-file behavior. ──\n\n const frameworkPath = ctx.cliContext.resolvedHomes.framework.repositoryRoot ?? null;\n // The mode signal is CONTAINMENT, not the operator preference: `file:` framework links are\n // only valid when the app root lives INSIDE the framework checkout (and the env-projection\n // guard later enforces exactly that for the companion). A framework developer scaffolding an\n // app OUTSIDE the checkout gets — correctly — an app-creator skeleton; an in-checkout scaffold\n // is framework-dev regardless of the stored preference flag.\n const appInsideFramework = frameworkPath !== null && !relative(frameworkPath, cwd).startsWith('..');\n const skeletonMode: SkeletonMode = appInsideFramework ? SkeletonMode.FRAMEWORK_DEV : SkeletonMode.APP_CREATOR;\n const portBaseFlag = (ctx.flags.portBase ?? ctx.flags['port-base']) as string | undefined;\n const portBase = portBaseFlag !== undefined ? Number.parseInt(portBaseFlag, 10) : undefined;\n if (portBaseFlag !== undefined && (!Number.isInteger(portBase) || (portBase as number) < 1024 || (portBase as number) > 65000)) {\n ctx.log.error(`Invalid --port-base \"${portBaseFlag}\" — expected an integer port between 1024 and 65000.`);\n return { success: false };\n }\n\n let path: string;\n let skeletonResult: SaasSkeletonResult | null = null;\n if (ctx.flags.configOnly === true || ctx.flags['config-only'] === true) {\n path = SaasScaffoldService.scaffold(cwd, { name: trimmedName });\n } else {\n try {\n skeletonResult = SaasSkeletonService.scaffold(cwd, {\n name: trimmedName,\n frameworkPath,\n mode: skeletonMode,\n ...(portBase !== undefined ? { portBase } : {}),\n skipInstall: ctx.flags.skipInstall === true || ctx.flags['skip-install'] === true,\n log: ctx.log,\n });\n path = `${cwd}/${WORKSPACE_CONFIG_NAMES.SAAS}`;\n } catch (error) {\n ctx.log.error(`Skeleton scaffold failed: ${ErrorUtils.extractErrorMessage(error)}`);\n return { success: false };\n }\n }\n\n // ── 2. Register default local environment ──\n //\n // Under an explicit saas-root override: the CLI resolved its workspace scope at STARTUP, before\n // step 1 scaffolded `wildo.saas.config.ts`, so on the first run the registry sees no app root and\n // `EnvironmentPaths` throws \"No targeted app root detected\" — the command that CREATES the root\n // was the one command that could not register against it (measured on the first scratch-app\n // bootstrap, 2026-08-25). The scaffold just made `cwd` the app root; say so.\n await EnvironmentRegistry.withSaasRootOverride(cwd, () => {\n EnvironmentLifecycle.initializeLocal({\n runtime,\n database: {\n engine: database,\n source: BackingServiceSource.SELF,\n },\n });\n });\n\n // ── 2b. Provision that environment's `secrets.json` (issue #155) ──\n //\n // Runs under the SAME saas-root override as the registration above, and for the same\n // reason: `ConfigSecretsUtils.writeSecretsJson` resolves its directory through\n // `EnvironmentPaths.resolveSecretsDir`, which reads the registry's app root. Outside the\n // override that is still the pre-scaffold scope, so the file would land in the wrong app\n // (or nowhere).\n const secretsOutcome = await EnvironmentRegistry.withSaasRootOverride(\n cwd,\n () => this.provisionLocalSecrets(ctx),\n );\n\n // ── 3. Materialize the per-PR validation workflow (Slice 6.8 / F-48) ──\n //\n // Every freshly-scaffolded app gets `.github/workflows/wildo-config-validation.yml`\n // by default so a config drift, a broken K8s template render, or a\n // missing `wildo config validate --domain cicd` workflow itself\n // fails the PR before reaching a deploy branch. Best-effort —\n // installer failure must NOT block scaffold success because the\n // operator can re-run `wildo setup` to back-fill it.\n const validationWorkflowResult = this.materializeValidationWorkflow(\n ctx, cwd, trimmedName,\n );\n /*\n * App-creator mode delivers the framework-owned asset homes HERE, from the packages the\n * scaffold just installed (the framework-developer lane gets them from the checkout on every\n * orchestrator tick instead). With `--skip-install` the knowledge lanes wait for\n * `pnpm install` + `wildo assets sync`; the templates lane needs no install and lands now.\n */\n const assetsResult = skeletonResult && skeletonMode === SkeletonMode.APP_CREATOR\n ? ApplicationAssetsDeliveryService.deliver({\n applicationRoot: cwd,\n frameworkAssetsRoot: ctx.cliContext.resolvedHomes.framework.repositoryRoot,\n })\n : null;\n\n // Resolved here rather than left to the first `wildo dev start`, so the scaffold's generated\n // artifact is OUTPUT rather than a hand-written file that looks like output (#417).\n const cspResult = skeletonResult ? await this.resolveInitialCspArtifact(ctx, cwd, skeletonResult.installed) : null;\n\n // ── 4. Output summary and next steps ──\n\n ctx.log.info('');\n ctx.log.success(` Created ${path}`);\n ctx.log.info('');\n ctx.log.info(chalk.dim(` Runtime: ${runtime}`));\n ctx.log.info(chalk.dim(` Database: ${database}`));\n if (skeletonResult) {\n ctx.log.info(chalk.dim(` Skeleton: ${skeletonResult.filesWritten} files (mode: ${skeletonMode})`));\n ctx.log.info(chalk.dim(\n ` Ports: backend ${skeletonResult.ports.backend} · app ${skeletonResult.ports.app} · companion ${skeletonResult.ports.companion}`,\n ));\n ctx.log.info(chalk.dim(\n ` Companion: ${skeletonResult.companionDelivered ? 'dist delivered' : 'NOT delivered (see warning above)'}`,\n ));\n if (!skeletonResult.built && ctx.flags.skipInstall !== true && ctx.flags['skip-install'] !== true) {\n ctx.log.warn(' Initial build incomplete — run `pnpm install && pnpm build` in the app before `wildo setup`.');\n }\n }\n ctx.log.info(chalk.dim(` Environment 'local' registered under .wildo-saas`));\n this.reportSecretsOutcome(ctx, secretsOutcome);\n if (validationWorkflowResult) {\n ctx.log.info(chalk.dim(` CI gate: ${validationWorkflowResult}`));\n }\n if (cspResult) {\n ctx.log.info(chalk.dim(` CSP: ${cspResult}`));\n }\n if (assetsResult) {\n const describe = (lane: { status: string; detail: string }): string =>\n lane.status === ApplicationAssetsLaneStatus.DELIVERED ? lane.detail : `NOT delivered (${lane.detail})`;\n ctx.log.info(chalk.dim(` Templates: ${describe(assetsResult.templates)}`));\n ctx.log.info(chalk.dim(` Docs: ${describe(assetsResult.docs)}`));\n ctx.log.info(chalk.dim(` Skills: ${describe(assetsResult.skills)}`));\n if ([assetsResult.docs, assetsResult.skills].some((lane) => lane.status === ApplicationAssetsLaneStatus.SKIPPED)) {\n ctx.log.warn(' Run `pnpm install && wildo assets sync` to deliver the framework knowledge into .claude/ and .wildo-saas/docs.');\n }\n }\n ctx.log.info('');\n ctx.log.info(' Next steps:');\n ctx.log.info('');\n ctx.log.info(` ${chalk.bold('wildo init --check')} Verify your development tools`);\n // Named right after install because the pins written above come from the framework CHECKOUT,\n // while the application installs the PUBLISHED @wildo-ai/* version — the two disagree whenever\n // the checkout is ahead of the last release, which between releases is always. `align-deps`\n // reads what was actually installed and makes them exact (issue #222).\n ctx.log.info(` ${chalk.bold('wildo align-deps --write')} Align pins with the framework version you installed`);\n ctx.log.info(` ${chalk.bold('wildo assets sync')} Re-deliver templates, docs, skills and rules after a framework upgrade`);\n ctx.log.info(` ${chalk.bold('wildo config sync')} Generate environment configuration`);\n ctx.log.info(` ${chalk.bold('wildo dev start')} Start local development`);\n ctx.log.info('');\n // Said here because the order above is the one a first-time creator follows literally, and the\n // deploy-artifact half of `config sync` cannot succeed until a platform exists and knows this\n // application. It now SKIPS that half with a named reason rather than failing the command\n // (issue #279) — so this line explains a message they will see, not a failure they must avoid.\n ctx.log.info(chalk.dim(' CI deploy artifacts are produced once a platform is running and this'));\n ctx.log.info(chalk.dim(' application is registered; until then `config sync` writes the local'));\n ctx.log.info(chalk.dim(' artifacts and says which step it skipped.'));\n ctx.log.info('');\n\n return { success: true };\n }\n\n /**\n * `wildo init` re-run inside the application it already created.\n *\n * Deliberately does NOT re-scaffold. The 286 skeleton files are on disk and may carry\n * operator edits; `SaasSkeletonService` refuses a non-empty directory for exactly that\n * reason. What a re-run is FOR is re-asserting the machine-local, non-source state that a\n * scaffold alone does not guarantee — and every step here is idempotent, so running it\n * repeatedly converges rather than churning:\n *\n * - the `local` environment registration (`initializeEnvironment` returns an existing\n * registration untouched);\n * - `secrets.json` — created when absent, otherwise BACKFILLED with any framework-managed\n * material declared since the app was created, rotating nothing (issue #155);\n * - the per-PR validation workflow, which leaves an existing file in place.\n *\n * No prompts for name / runtime / database: those are already answered by the registration\n * and by `wildo.saas.config.ts`, and re-asking would invite an answer that contradicts what\n * is on disk. The administrator is asked for only when there is no `secrets.json` to read\n * one from.\n */\n private async rerunInExistingApp(ctx: CommandContext, cwd: string): Promise<CommandResult> {\n ctx.log.info('');\n ctx.log.info(chalk.dim(` Existing Wildo application detected at ${cwd}`));\n ctx.log.info(chalk.dim(' Re-running init: skeleton left untouched, machine-local state re-asserted.'));\n\n const secretsReport = await EnvironmentRegistry.withSaasRootOverride(\n cwd,\n () => this.provisionLocalSecrets(ctx),\n );\n\n const appName = basename(cwd) || 'app';\n const validationWorkflowResult = this.materializeValidationWorkflow(ctx, cwd, appName);\n\n ctx.log.info('');\n this.reportSecretsOutcome(ctx, secretsReport);\n if (validationWorkflowResult) {\n ctx.log.info(chalk.dim(` CI gate: ${validationWorkflowResult}`));\n }\n ctx.log.info('');\n ctx.log.info(' Next steps:');\n ctx.log.info('');\n ctx.log.info(` ${chalk.bold('wildo align-deps --write')} Align pins with the framework version you installed`);\n ctx.log.info(` ${chalk.bold('wildo assets sync')} Re-deliver templates, docs, skills and rules after a framework upgrade`);\n ctx.log.info(` ${chalk.bold('wildo config sync')} Generate environment configuration`);\n ctx.log.info(` ${chalk.bold('wildo dev start')} Start local development`);\n ctx.log.info('');\n\n // A re-run that could not resolve an administrator has NOT delivered secrets, and the\n // whole point of the re-run was to deliver them — so unlike the scaffold path (where a\n // warning rides alongside 286 files that were genuinely written), there is nothing else\n // to report success about.\n return { success: Boolean(secretsReport.outcome) };\n }\n\n /**\n * Ensure the freshly-registered `local` environment has a complete `secrets.json`.\n *\n * Two branches, and the split is what makes `wildo init` safe to re-run (issue #155):\n *\n * - **A file already exists** — the administrator identity is on disk, so we never\n * re-ask for it, and we hand the EXISTING secrets to the additive provisioner. That\n * backfills any material the framework has declared since the app was created and\n * rotates nothing. A credential a running deployment already holds is never rewritten;\n * re-minting one would orphan the Mongo/Valkey data it protects.\n * - **No file** — resolve the operator-typed half (the administrator) and CREATE it.\n *\n * Returns `blockedReason` instead of throwing when the administrator cannot be resolved.\n * The scaffold has already been written to disk at this point, so failing the whole\n * command would be a confusing lie about what happened; the summary reports the gap and\n * names the exact remedy instead, and a re-run is idempotent.\n */\n private async provisionLocalSecrets(\n ctx: CommandContext,\n ): Promise<{ outcome: SecretsProvisioningOutcome | null; blockedReason?: string }> {\n const envName = WildoLocationType.LOCAL;\n\n if (EnvironmentUtils.loadSecretsJson(envName)) {\n return { outcome: SecretsProvisioning.ensureForEnvironment(envName) };\n }\n\n let admin: AdminUserInput;\n try {\n admin = await this.resolveAdministratorIdentity(ctx);\n } catch (error) {\n return { outcome: null, blockedReason: ErrorUtils.extractErrorMessage(error) };\n }\n\n /*\n * The SECOND administrator, minted in the same breath as the first (#575).\n *\n * `applicationAccessGrantApproverIsDistinct` refuses an approver who is the requester and\n * refuses an absent one, and the application-scoped grant has no auto-approval branch — so a\n * platform provisioned with one administrator cannot read any application-wide surface at all.\n * Provisioning one and leaving the second to a runbook is what makes that control unusable in\n * practice, so both are created here or neither is.\n *\n * `isLocalEnvironment: true` is a STATEMENT, not an inference: this function creates the app's\n * `local` secrets and nothing else (`envName` above is `WildoLocationType.LOCAL`). It is what\n * licenses the sub-addressed derivation, and it is the only thing that does — a remote\n * environment reaching `resolveApproverIdentity` without the seeds is refused.\n */\n let approver: AdminUserInput;\n try {\n approver = resolveApproverIdentity({ admin, isLocalEnvironment: true, log: ctx.log }).approver;\n } catch (error) {\n return { outcome: null, blockedReason: ErrorUtils.extractErrorMessage(error) };\n }\n\n const outcome = SecretsProvisioning.ensureForEnvironment(envName, {\n createWith: {\n admin: {\n email: admin.email,\n firstName: admin.firstName,\n lastName: admin.lastName,\n // OMITTED rather than passed as `undefined` when the operator gave no password:\n // the ADMIN_PASSWORD framework-managed material mints a 16-char one, which keeps\n // the \"who minted this?\" answer in a single registry.\n ...(admin.password ? { password: admin.password } : {}),\n },\n approver: {\n email: approver.email,\n firstName: approver.firstName,\n lastName: approver.lastName,\n // Same omission rule, and it is what makes \"the same password as the administrator\" true\n // rather than approximately true: when the operator typed none, BOTH are left for the\n // framework-managed materials to mint, and the APPROVER_PASSWORD material copies the\n // administrator's rather than generating a second one.\n ...(approver.password ? { password: approver.password } : {}),\n },\n },\n });\n\n // Mark the environment set up. This is not cosmetic: `runEnvSetup` treats a non-COMPLETED\n // environment as first-time and rebuilds `secrets.json` from a FRESH draft — so without\n // this, a later `wildo setup` would silently ROTATE the credentials just minted here and\n // orphan whatever data they already protect. With it, setup reports \"existing setup\n // detected\" and no-ops unless the operator asks for `--force`, which is the deliberate\n // re-author door.\n EnvironmentLifecycle.setSetupStatus(SetupStatus.COMPLETED, envName);\n\n return { outcome };\n }\n\n /**\n * Resolve the platform-administrator identity for the app's local `secrets.json`.\n *\n * Four doors, in order — flags, env seeds, prompt, refusal:\n *\n * 1. `--admin-email` + `--admin-first-name` + `--admin-last-name` (all three, together).\n * 2. `--non-interactive` -> the `WILDO_INIT_ADMIN_*` seeds, fail-closed when absent.\n * 3. interactive -> the shared `wildo setup` prompt, with the seeds as prefilled defaults.\n *\n * No door substitutes a placeholder, and that is deliberate rather than strict. A literal\n * 'Admin' / 'User' / `noreply@example.com` silently seeds the platform-admin USER RECORD\n * with non-meaningful identity, which regresses audit trails, password-reset email and the\n * bootstrap email-confirm flow — and apps-manager requires `ADMIN_FIRST_NAME` /\n * `ADMIN_LAST_NAME` fail-closed anyway. See `platformAdminUserModule`, which owns that\n * doctrine and which door 3 reuses rather than re-implementing.\n *\n * Only the PASSWORD may be omitted; the secrets writer generates one.\n */\n private async resolveAdministratorIdentity(ctx: CommandContext): Promise<AdminUserInput> {\n const email = this.readAdminFlag(ctx, 'admin-email', 'adminEmail');\n const firstName = this.readAdminFlag(ctx, 'admin-first-name', 'adminFirstName');\n const lastName = this.readAdminFlag(ctx, 'admin-last-name', 'adminLastName');\n const password = this.readAdminFlag(ctx, 'admin-password', 'adminPassword');\n\n const missing = [\n !email && '--admin-email',\n !firstName && '--admin-first-name',\n !lastName && '--admin-last-name',\n ].filter((flag): flag is string => Boolean(flag));\n\n if (missing.length === 0) {\n if (!(email!.includes('@') && email!.includes('.'))) {\n throw new Error(`--admin-email is not a valid email address: \"${email}\".`);\n }\n return { email: email!, firstName: firstName!, lastName: lastName!, password };\n }\n\n // A PARTIAL set of flags is an operator mistake, not a request to fall back. Falling\n // through to a prompt here would silently discard the values that WERE supplied.\n if (missing.length < 3) {\n throw new Error(\n 'Partial platform-administrator flags: --admin-email, --admin-first-name and '\n + `--admin-last-name must be supplied together. Missing: ${missing.join(', ')}.`,\n );\n }\n\n if (ctx.globalFlags.nonInteractive === true) {\n return resolveAdminUserFromEnvSeeds(ctx.log);\n }\n\n return platformAdminUserModule.prompt({ log: ctx.log });\n }\n\n /**\n * Read one administrator flag in both spellings the kernel may expose it under, mirroring\n * how `--config-only` / `--port-base` are read elsewhere in this command. Blank strings\n * are treated as absent so a stray `--admin-email=` cannot install an empty identity.\n */\n private readAdminFlag(ctx: CommandContext, kebab: string, camel: string): string | undefined {\n const raw = (ctx.flags[camel] ?? ctx.flags[kebab]) as string | undefined;\n if (typeof raw !== 'string') return undefined;\n const trimmed = raw.trim();\n return trimmed === '' ? undefined : trimmed;\n }\n\n /** Render the secrets step's result as one line of the scaffold summary. */\n private reportSecretsOutcome(\n ctx: CommandContext,\n report: { outcome: SecretsProvisioningOutcome | null; blockedReason?: string },\n ): void {\n if (!report.outcome) {\n ctx.log.warn(` Secrets: NOT provisioned — ${report.blockedReason}`);\n ctx.log.warn(\n \" `wildo config sync` will fail its env-files phase until they exist. \"\n + 'Re-run `wildo init` with --admin-email / --admin-first-name / --admin-last-name '\n + `(or set ${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_EMAIL}, `\n + `${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_FIRSTNAME}, `\n + `${WildoCliInitAdminEnvKeys.WILDO_INIT_ADMIN_LASTNAME}) — it is idempotent and `\n + 'leaves everything already scaffolded untouched.',\n );\n return;\n }\n\n switch (report.outcome.status) {\n case SecretsProvisioningStatus.CREATED:\n ctx.log.info(chalk.dim(\n ` Secrets: secrets.json minted (${report.outcome.mintedRefs.length} framework-managed materials)`,\n ));\n break;\n case SecretsProvisioningStatus.PROVISIONED:\n ctx.log.info(chalk.dim(\n ` Secrets: secrets.json backfilled (${report.outcome.mintedRefs.length} newly-declared material(s), nothing rotated)`,\n ));\n break;\n case SecretsProvisioningStatus.ALREADY_COMPLETE:\n ctx.log.info(chalk.dim(' Secrets: secrets.json already complete — nothing minted'));\n break;\n case SecretsProvisioningStatus.NO_SECRETS_FILE:\n // Unreachable: the create branch above always supplies `createWith`. Reported rather\n // than ignored so a future refactor that drops the draft cannot fail silently.\n ctx.log.warn(' Secrets: not provisioned — no operator draft reached the provisioner.');\n break;\n }\n }\n\n /**\n * Best-effort install of the per-PR validation workflow. Returns a\n * one-line human-readable status the caller can render in the\n * scaffold summary, or `null` if the framework path could not be\n * resolved (e.g. operator is running a globally-installed CLI without\n * the framework checkout — rare, but the scaffold must still succeed).\n *\n * Slice 6.8 / F-48 — kept in `init` so a brand-new app gets the gate\n * by default, and mirrored in `wildo setup` so existing pre-Slice-6.8\n * apps can back-fill it idempotently.\n */\n /**\n * Resolve `src/generated/csp.generated.json` FOR REAL, right after the scaffold installs (#417).\n *\n * The skeleton ships a hand-written `csp.generated.json.hbs` — a generated-LOOKING artifact that\n * no resolution produced. It exists because the frontend imports the file at build time, so\n * something has to be there before the first `wildo dev start` runs the sync. Keeping it is fine;\n * shipping it as the ONLY thing that ever wrote that path was not.\n *\n * BEST-EFFORT by design, the same posture this command already takes for the validation workflow\n * and the asset homes: a scaffold that produced 286 correct files must not fail because one\n * derived artifact could not be resolved. The next `wildo dev start` resolves it anyway, so the\n * cost of a miss is that the placeholder survives one step longer.\n *\n * Skipped without install, because resolving loads the application's own TypeScript config\n * through its `node_modules`.\n */\n private async resolveInitialCspArtifact(\n ctx: CommandContext,\n appRoot: string,\n installed: boolean,\n ): Promise<string | null> {\n if (!installed) {\n return null;\n }\n try {\n const result = await CspSyncService.sync({\n saasRoot: appRoot,\n envName: 'local',\n // No `serviceKey`: every CSP-capable frontend the scaffold produced is resolved, so a\n // scenario that added a website or a docs portal is covered without naming them here.\n env: process.env,\n });\n const written = result.services.filter((service) => service.wroteChanges).length;\n return written > 0 ? `resolved ${written} CSP artifact(s)` : null;\n } catch (error) {\n ctx.log.warn(\n `Could not resolve the initial CSP artifact: ${ErrorUtils.extractErrorMessage(error)}. `\n + 'The scaffold placeholder is still in place; `wildo dev start` resolves it.',\n );\n return null;\n }\n }\n\n private materializeValidationWorkflow(\n ctx: CommandContext,\n appRoot: string,\n appName: string,\n ): string | null {\n const frameworkPath = ctx.cliContext.resolvedHomes.framework.repositoryRoot;\n if (!frameworkPath) {\n ctx.log.warn(\n 'Skipping `.github/workflows/wildo-config-validation.yml` install: framework path not resolved. '\n + 'Re-run `wildo setup` from this app once the framework is on PATH.',\n );\n return null;\n }\n try {\n const result = installValidationWorkflow(appRoot, frameworkPath, { appName });\n if (result.created) {\n return `installed ${result.path.replace(`${appRoot}/`, '')}`;\n }\n if (result.skipped) {\n return `${result.path.replace(`${appRoot}/`, '')} already present (left in place)`;\n }\n return result.path;\n } catch (error) {\n ctx.log.warn(\n `Could not install per-PR validation workflow: ${ErrorUtils.extractErrorMessage(error)}. `\n + 'Re-run `wildo setup` to retry.',\n );\n return null;\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"check.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/lock/check.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAIH,OAAO,EASL,KAAK,oBAAoB,EAEzB,KAAK,yBAAyB,EAC/B,MAAM,+BAA+B,CAAC;AAUvC,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAM1F,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,WAAW;IACvD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAKxB;IAEI,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAqEvD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,8BAA8B,CAAC,KAAK,EAAE;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB;;;yDAGqD;IACrD,gBAAgB,EAAE,yBAAyB,CAAC;CAC7C,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA0BhC;AA8BD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,yBAAyB,EACjC,QAAQ,EAAE,yBAAyB,GAClC,MAAM,GAAG,IAAI,CAsBf"}
1
+ {"version":3,"file":"check.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/lock/check.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAIH,OAAO,EAQL,KAAK,oBAAoB,EAEzB,KAAK,yBAAyB,EAC/B,MAAM,+BAA+B,CAAC;AAWvC,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAM1F,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,WAAW;IACvD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAKxB;IAEI,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAqEvD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,8BAA8B,CAAC,KAAK,EAAE;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB;;;yDAGqD;IACrD,gBAAgB,EAAE,yBAAyB,CAAC;CAC7C,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA0BhC;AA8BD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,yBAAyB,EACjC,QAAQ,EAAE,yBAAyB,GAClC,MAAM,GAAG,IAAI,CAsBf"}
@@ -45,7 +45,8 @@
45
45
  */
46
46
  import chalk from 'chalk';
47
47
  import { join } from 'path';
48
- import { loadWorkerConfigs, materializeInfraSection, materializeSaasProviderRuntimeArtifacts, loadSaasConfig, resolveValidatedSaasProviderContributions, SaasLockfileEnvelopeSchema, stableJsonStringify, } from '@wildo-ai/platform-config-lib';
48
+ import { loadWorkerConfigs, materializeInfraSection, materializeSaasProviderRuntimeArtifacts, loadSaasConfig, SaasLockfileEnvelopeSchema, stableJsonStringify, } from '@wildo-ai/platform-config-lib';
49
+ import { resolveAndRegisterSaasProviderContributions } from '../../services/credentials/composed-provider-catalogue.js';
49
50
  // Slice 6 of `infra-provider-planner.md`: the lock-check
50
51
  // materialization MUST use the same `moduleMap` as the writer in
51
52
  // `provider-runtime-sync.service.ts`. Without this, the writer
@@ -147,7 +148,7 @@ export default class LockCheckCommand extends BaseCommand {
147
148
  export async function computeWouldBeLockfileEnvelope(input) {
148
149
  const { saasRoot, generatedAt, previousSections } = input;
149
150
  const saasConfig = await loadSaasConfig(join(saasRoot, 'wildo.saas.config.ts'));
150
- const discoveredProviderContributions = await resolveValidatedSaasProviderContributions({ saasRoot, saasConfig });
151
+ const discoveredProviderContributions = await resolveAndRegisterSaasProviderContributions({ saasRoot, saasConfig });
151
152
  const workerConfigs = await loadWorkerConfigs(saasRoot, saasConfig);
152
153
  const nodeWorkerKeys = workerConfigs
153
154
  .filter((entry) => isNodeWorkerRuntimeLanguage(entry.config.runtime.language))
@@ -1 +1 @@
1
- {"version":3,"file":"check.command.js","sourceRoot":"","sources":["../../../../src/commands/lock/check.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,uCAAuC,EACvC,cAAc,EACd,yCAAyC,EACzC,0BAA0B,EAC1B,mBAAmB,GAKpB,MAAM,+BAA+B,CAAC;AACvC,yDAAyD;AACzD,iEAAiE;AACjE,+DAA+D;AAC/D,oEAAoE;AACpE,4DAA4D;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6DAA6D,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,MAAM,gC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AAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,2BAA2B,CAAC,QAAgB;IACnD,OAAO,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,QAAQ,CACxE,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["/**\n * `wildo lock check` — verify that the **providers** and **infra**\n * sections of the on-disk\n * `<saasRoot>/.wildo-saas/wildo-saas.lock.json` are in sync with\n * what `wildo config sync` would produce against the current\n * authored config.\n *\n * Slice 2.5c-4 of `infra-provider-planner.md`. Read-only — never\n * writes the lockfile or any sync artifacts. Exit 0 on match; exit\n * non-zero with a sections-diff report on mismatch.\n *\n * Intended use: CI gate. Wire as a step in\n * `.github/workflows/engine-tests.yml` (or a dedicated lockfile\n * workflow) so a PR that forgot to commit a regenerated lockfile\n * fails loud at PR time instead of leaking through to the next dev\n * `wildo config sync`.\n *\n * **Scope of the check** (Slice 4.A.1 / H3 — important): this\n * command can only materialize `sections.providers` (via\n * `materializeSaasProviderRuntimeArtifacts`) and `sections.infra`\n * (via `materializeInfraSection`). Other lockfile sections (today:\n * `i18n`, `modules`, plus any future sections that other subsystems\n * add) are **NOT** verified — the comparison spreads them verbatim\n * from the on-disk lockfile, so they always match themselves. A PR\n * that mutates an i18n source file but forgets to commit a\n * regenerated lockfile will pass `wildo lock check` but be caught\n * by whichever sibling tool owns the i18n section's drift gate.\n *\n * Comparison policy: `sections.providers` and `sections.infra`\n * deep-equal. `generatedAt` and `schemaVersion` are NOT compared —\n * they're metadata, not pinned state. If two runs produce identical\n * `sections.{providers, infra}` content, those sections are \"in\n * sync\" regardless of when the lockfile was generated.\n *\n * Implementation note (Slice 2.5c-4 / 4.A.2 / M1): the\n * materialization compute (discovery + provider section + infra\n * section) is mostly duplicated from `provider-runtime-sync.service.ts`\n * rather than extracted into a shared helper. The duplication is\n * intentional for this slice — `lock check` runs the same primitives\n * via the same exported functions in `@wildo-ai/platform-config-lib`,\n * so behavior parity is structural. Future cleanup: extract a\n * `computeNextLockfileEnvelope` helper into\n * `provider-runtime-sync.service.ts` and have both\n * `syncProviderRuntimeArtifactsForApp` and this command consume it.\n */\n\nimport chalk from 'chalk';\nimport { join } from 'path';\nimport {\n loadWorkerConfigs,\n materializeInfraSection,\n materializeSaasProviderRuntimeArtifacts,\n loadSaasConfig,\n resolveValidatedSaasProviderContributions,\n SaasLockfileEnvelopeSchema,\n stableJsonStringify,\n type InfraEnvSelectionInput,\n type SaasLockfileEnvelope,\n type SaasLockfileInfraSection,\n type SaasLockfileKnownSections,\n} from '@wildo-ai/platform-config-lib';\n// Slice 6 of `infra-provider-planner.md`: the lock-check\n// materialization MUST use the same `moduleMap` as the writer in\n// `provider-runtime-sync.service.ts`. Without this, the writer\n// produces digests via `module.plan()` while the checker falls back\n// to authored-entry digests — guaranteed drift on every PR.\nimport { buildInfraProviderModuleMap } from '@wildo-ai/platform-infra-providers';\nimport { existsSync, readdirSync, readFileSync } from 'fs';\nimport { resolveAppLayout } from '@wildo-ai/platform-config-lib';\nimport { loadAuthoredInfraEnvConfig } from '~wildo-cli/services/environment/authored-infra-config.utils';\nimport { BaseCommand } from '~wildo-cli/kernel/base-command';\nimport { CommandCategory } from '~wildo-cli/kernel/types';\nimport type { CommandMeta, CommandContext, CommandResult } from '~wildo-cli/kernel/types';\nimport { ErrorUtils } from '~wildo-cli/infrastructure/errors/error.utils';\nimport { requireSaasRoot } from '~wildo-cli/services/registry/registry-command.utils';\n\nconst WILDO_SAAS_LOCK_RELATIVE_PATH = join('.wildo-saas', 'wildo-saas.lock.json');\n\nexport default class LockCheckCommand extends BaseCommand {\n readonly meta: CommandMeta = {\n name: 'lock check',\n description: 'Verify wildo-saas.lock.json is in sync with authored config (CI gate).',\n category: CommandCategory.Config,\n flags: {},\n };\n\n async run(ctx: CommandContext): Promise<CommandResult> {\n const saasRoot = requireSaasRoot(ctx, 'lock-check');\n if (!saasRoot) return { success: false };\n\n ctx.log.info(chalk.cyan(`\\n Lockfile drift check — ${saasRoot}\\n`));\n\n const lockPath = join(saasRoot, WILDO_SAAS_LOCK_RELATIVE_PATH);\n if (!existsSync(lockPath)) {\n ctx.log.error(`Lockfile not found at ${lockPath}. Run \\`wildo config sync\\` to generate it.`);\n return { success: false };\n }\n\n const onDiskRaw = readFileSync(lockPath, 'utf-8');\n let onDisk: SaasLockfileEnvelope;\n try {\n onDisk = SaasLockfileEnvelopeSchema.parse(JSON.parse(onDiskRaw));\n } catch (e) {\n ctx.log.error(\n `Lockfile at ${lockPath} fails schema validation — ` +\n `${ErrorUtils.extractErrorMessage(e)}. Run \\`wildo config sync\\` to regenerate.`,\n );\n return { success: false };\n }\n\n let computed: SaasLockfileEnvelope;\n try {\n // Slice 2.5c-4: compute the would-be next envelope using the\n // SAME `generatedAt` as the on-disk lockfile so the byte-level\n // diff (when we report it) doesn't include a timestamp delta.\n // The actual comparison ignores `generatedAt` regardless; this\n // just keeps the diff payload tidy.\n //\n // Slice 4.A.2 / M1: thread the already-parsed `previousSections`\n // from `run()` into the compute helper so the lockfile is read\n // exactly once. Eliminates a race window where the file could\n // change between the run() read and the compute helper's\n // re-read.\n computed = await computeWouldBeLockfileEnvelope({\n saasRoot,\n generatedAt: onDisk.generatedAt,\n previousSections: onDisk.sections,\n });\n } catch (e) {\n ctx.log.error(\n `Failed to materialize lockfile from authored config — ` +\n `${ErrorUtils.extractErrorMessage(e)}.`,\n );\n return { success: false };\n }\n\n const drift = describeSectionsDrift(onDisk.sections, computed.sections);\n if (!drift) {\n // Slice 4.A.1 / H3: scoped success message — the check only\n // covers providers + infra. i18n / modules / future sections\n // are NOT verified by this command (see command JSDoc).\n ctx.log.info(chalk.green(\n ' ✅ Providers + infra sections are in sync with authored config.\\n'\n + ' (Other lockfile sections are not verified by this command.)\\n',\n ));\n return { success: true };\n }\n\n ctx.log.error(chalk.red(' ❌ Lockfile drift detected.\\n'));\n ctx.log.error(chalk.yellow(drift));\n ctx.log.error(\n chalk.yellow('\\n Run `wildo config sync` and commit the updated lockfile.\\n'),\n );\n return { success: false };\n }\n}\n\n/**\n * Compute the lockfile envelope that `wildo config sync` would\n * write right now, using the same primitives the sync uses but\n * without any disk writes.\n *\n * Slice 4.A.2 / M1 fix: `previousSections` is now passed in from the\n * caller (which already parsed the on-disk lockfile in `run()`)\n * instead of re-read here. Eliminates the redundant read and the\n * race window where the file could change between the two reads.\n *\n * **Exported for the Slice 6 CI gate** (`infra-provider-planner.md`)\n * so a \"live contract\" test can re-materialize the lockfile against\n * `examples/wonder-todos/` and assert no drift, mirroring the\n * `framework-knowledge-audit.live.contract.test.ts` pattern. The\n * function is otherwise an internal helper of the `lock check`\n * command; the export contract is \"stable enough for the test, do\n * not consume from outside the lock-check pair\".\n */\nexport async function computeWouldBeLockfileEnvelope(input: {\n saasRoot: string;\n generatedAt: string;\n /** The on-disk lockfile's `sections`, already parsed by the\n * caller. Spread into the computed envelope so unknown / non-\n * materialized sections (i18n, modules, future) are preserved\n * verbatim — matches the sync writer's behavior. */\n previousSections: SaasLockfileKnownSections;\n}): Promise<SaasLockfileEnvelope> {\n const { saasRoot, generatedAt, previousSections } = input;\n const saasConfig = await loadSaasConfig(join(saasRoot, 'wildo.saas.config.ts'));\n const discoveredProviderContributions = await resolveValidatedSaasProviderContributions({ saasRoot, saasConfig });\n const workerConfigs = await loadWorkerConfigs(saasRoot, saasConfig);\n const nodeWorkerKeys = workerConfigs\n .filter((entry) => isNodeWorkerRuntimeLanguage(entry.config.runtime.language))\n .map((entry) => entry.key);\n const { lockSection: providersSection } = materializeSaasProviderRuntimeArtifacts(\n saasConfig,\n {\n discoveredContributions: discoveredProviderContributions,\n nodeWorkerKeys,\n },\n );\n const infraSection = await computeInfraSection(saasRoot, generatedAt, previousSections.infra);\n\n return SaasLockfileEnvelopeSchema.parse({\n schemaVersion: 2,\n generatedAt,\n sections: {\n ...previousSections,\n providers: providersSection,\n ...(infraSection ? { infra: infraSection } : {}),\n },\n });\n}\n\nasync function computeInfraSection(\n saasRoot: string,\n generatedAt: string,\n previousSection: SaasLockfileInfraSection | undefined,\n): Promise<SaasLockfileInfraSection | undefined> {\n const infraDir = resolveAppLayout(saasRoot).authoredInfrastructureHome;\n if (!existsSync(infraDir)) return undefined;\n const envDirs = readdirSync(infraDir, { withFileTypes: true }).filter((d) => d.isDirectory());\n if (envDirs.length === 0) return undefined;\n\n const envs: InfraEnvSelectionInput[] = [];\n for (const envDir of envDirs) {\n const loaded = await loadAuthoredInfraEnvConfig(envDir.name, saasRoot);\n if (!loaded) continue;\n envs.push({\n envName: envDir.name,\n backingServices: loaded.config.backingServices,\n });\n }\n // Slice 6: pass the canonical module catalog so `planContributionDigest`\n // is computed identically to `provider-runtime-sync.service.ts`'s\n // writer path. Module-less providers fall through to the authored-entry\n // digest in `materializeInfraSection` (preserves Slice 2.5b semantics\n // for uncovered providers).\n const moduleMap = buildInfraProviderModuleMap();\n return materializeInfraSection({ envs, generatedAt, moduleMap, previousSection });\n}\n\n/**\n * Deep-compare `sections` ignoring `generatedAt` / `schemaVersion`.\n * Returns `null` on match, or a multi-line human-readable diff\n * otherwise. Diff format prioritizes section/key paths over raw JSON\n * dumps.\n *\n * Exported for testing (Slice 4.A.3 / T4) — the command's drift\n * detection is the load-bearing contract; pin its output format so a\n * future formatting refactor doesn't silently break CI gate\n * messaging.\n */\nexport function describeSectionsDrift(\n onDisk: SaasLockfileKnownSections,\n computed: SaasLockfileKnownSections,\n): string | null {\n const onDiskJson = stableJsonStringify(onDisk);\n const computedJson = stableJsonStringify(computed);\n if (onDiskJson === computedJson) return null;\n\n const lines: string[] = [];\n const allSectionKeys = new Set([...Object.keys(onDisk), ...Object.keys(computed)]);\n for (const sectionKey of Array.from(allSectionKeys).sort()) {\n const a = stableJsonStringify((onDisk as Record<string, unknown>)[sectionKey]);\n const b = stableJsonStringify((computed as Record<string, unknown>)[sectionKey]);\n if (a === b) continue;\n if (a === undefined) {\n lines.push(` + sections.${sectionKey} (added by sync — not in lockfile yet)`);\n } else if (b === undefined) {\n lines.push(` - sections.${sectionKey} (removed by sync — still in lockfile)`);\n } else {\n lines.push(` ~ sections.${sectionKey} (drift)`);\n lines.push(` on-disk: ${a.slice(0, 200)}${a.length > 200 ? '…' : ''}`);\n lines.push(` computed: ${b.slice(0, 200)}${b.length > 200 ? '…' : ''}`);\n }\n }\n return lines.join('\\n');\n}\n\nfunction isNodeWorkerRuntimeLanguage(language: string): boolean {\n return ['javascript', 'js', 'node', 'nodejs', 'ts', 'typescript'].includes(\n language.trim().toLowerCase(),\n );\n}\n"]}
1
+ {"version":3,"file":"check.command.js","sourceRoot":"","sources":["../../../../src/commands/lock/check.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,uCAAuC,EACvC,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,GAKpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,2CAA2C,EAAE,MAAM,wDAAwD,CAAC;AACrH,yDAAyD;AACzD,iEAAiE;AACjE,+DAA+D;AAC/D,oEAAoE;AACpE,4DAA4D;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,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E,EAAE,CAAC,CAAC;YAC7E,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,2BAA2B,CAAC,QAAgB;IACnD,OAAO,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,QAAQ,CACxE,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["/**\n * `wildo lock check` — verify that the **providers** and **infra**\n * sections of the on-disk\n * `<saasRoot>/.wildo-saas/wildo-saas.lock.json` are in sync with\n * what `wildo config sync` would produce against the current\n * authored config.\n *\n * Slice 2.5c-4 of `infra-provider-planner.md`. Read-only — never\n * writes the lockfile or any sync artifacts. Exit 0 on match; exit\n * non-zero with a sections-diff report on mismatch.\n *\n * Intended use: CI gate. Wire as a step in\n * `.github/workflows/engine-tests.yml` (or a dedicated lockfile\n * workflow) so a PR that forgot to commit a regenerated lockfile\n * fails loud at PR time instead of leaking through to the next dev\n * `wildo config sync`.\n *\n * **Scope of the check** (Slice 4.A.1 / H3 — important): this\n * command can only materialize `sections.providers` (via\n * `materializeSaasProviderRuntimeArtifacts`) and `sections.infra`\n * (via `materializeInfraSection`). Other lockfile sections (today:\n * `i18n`, `modules`, plus any future sections that other subsystems\n * add) are **NOT** verified — the comparison spreads them verbatim\n * from the on-disk lockfile, so they always match themselves. A PR\n * that mutates an i18n source file but forgets to commit a\n * regenerated lockfile will pass `wildo lock check` but be caught\n * by whichever sibling tool owns the i18n section's drift gate.\n *\n * Comparison policy: `sections.providers` and `sections.infra`\n * deep-equal. `generatedAt` and `schemaVersion` are NOT compared —\n * they're metadata, not pinned state. If two runs produce identical\n * `sections.{providers, infra}` content, those sections are \"in\n * sync\" regardless of when the lockfile was generated.\n *\n * Implementation note (Slice 2.5c-4 / 4.A.2 / M1): the\n * materialization compute (discovery + provider section + infra\n * section) is mostly duplicated from `provider-runtime-sync.service.ts`\n * rather than extracted into a shared helper. The duplication is\n * intentional for this slice — `lock check` runs the same primitives\n * via the same exported functions in `@wildo-ai/platform-config-lib`,\n * so behavior parity is structural. Future cleanup: extract a\n * `computeNextLockfileEnvelope` helper into\n * `provider-runtime-sync.service.ts` and have both\n * `syncProviderRuntimeArtifactsForApp` and this command consume it.\n */\n\nimport chalk from 'chalk';\nimport { join } from 'path';\nimport {\n loadWorkerConfigs,\n materializeInfraSection,\n materializeSaasProviderRuntimeArtifacts,\n loadSaasConfig,\n SaasLockfileEnvelopeSchema,\n stableJsonStringify,\n type InfraEnvSelectionInput,\n type SaasLockfileEnvelope,\n type SaasLockfileInfraSection,\n type SaasLockfileKnownSections,\n} from '@wildo-ai/platform-config-lib';\nimport { resolveAndRegisterSaasProviderContributions } from '../../services/credentials/composed-provider-catalogue';\n// Slice 6 of `infra-provider-planner.md`: the lock-check\n// materialization MUST use the same `moduleMap` as the writer in\n// `provider-runtime-sync.service.ts`. Without this, the writer\n// produces digests via `module.plan()` while the checker falls back\n// to authored-entry digests — guaranteed drift on every PR.\nimport { buildInfraProviderModuleMap } from '@wildo-ai/platform-infra-providers';\nimport { existsSync, readdirSync, readFileSync } from 'fs';\nimport { resolveAppLayout } from '@wildo-ai/platform-config-lib';\nimport { loadAuthoredInfraEnvConfig } from '~wildo-cli/services/environment/authored-infra-config.utils';\nimport { BaseCommand } from '~wildo-cli/kernel/base-command';\nimport { CommandCategory } from '~wildo-cli/kernel/types';\nimport type { CommandMeta, CommandContext, CommandResult } from '~wildo-cli/kernel/types';\nimport { ErrorUtils } from '~wildo-cli/infrastructure/errors/error.utils';\nimport { requireSaasRoot } from '~wildo-cli/services/registry/registry-command.utils';\n\nconst WILDO_SAAS_LOCK_RELATIVE_PATH = join('.wildo-saas', 'wildo-saas.lock.json');\n\nexport default class LockCheckCommand extends BaseCommand {\n readonly meta: CommandMeta = {\n name: 'lock check',\n description: 'Verify wildo-saas.lock.json is in sync with authored config (CI gate).',\n category: CommandCategory.Config,\n flags: {},\n };\n\n async run(ctx: CommandContext): Promise<CommandResult> {\n const saasRoot = requireSaasRoot(ctx, 'lock-check');\n if (!saasRoot) return { success: false };\n\n ctx.log.info(chalk.cyan(`\\n Lockfile drift check — ${saasRoot}\\n`));\n\n const lockPath = join(saasRoot, WILDO_SAAS_LOCK_RELATIVE_PATH);\n if (!existsSync(lockPath)) {\n ctx.log.error(`Lockfile not found at ${lockPath}. Run \\`wildo config sync\\` to generate it.`);\n return { success: false };\n }\n\n const onDiskRaw = readFileSync(lockPath, 'utf-8');\n let onDisk: SaasLockfileEnvelope;\n try {\n onDisk = SaasLockfileEnvelopeSchema.parse(JSON.parse(onDiskRaw));\n } catch (e) {\n ctx.log.error(\n `Lockfile at ${lockPath} fails schema validation — ` +\n `${ErrorUtils.extractErrorMessage(e)}. Run \\`wildo config sync\\` to regenerate.`,\n );\n return { success: false };\n }\n\n let computed: SaasLockfileEnvelope;\n try {\n // Slice 2.5c-4: compute the would-be next envelope using the\n // SAME `generatedAt` as the on-disk lockfile so the byte-level\n // diff (when we report it) doesn't include a timestamp delta.\n // The actual comparison ignores `generatedAt` regardless; this\n // just keeps the diff payload tidy.\n //\n // Slice 4.A.2 / M1: thread the already-parsed `previousSections`\n // from `run()` into the compute helper so the lockfile is read\n // exactly once. Eliminates a race window where the file could\n // change between the run() read and the compute helper's\n // re-read.\n computed = await computeWouldBeLockfileEnvelope({\n saasRoot,\n generatedAt: onDisk.generatedAt,\n previousSections: onDisk.sections,\n });\n } catch (e) {\n ctx.log.error(\n `Failed to materialize lockfile from authored config — ` +\n `${ErrorUtils.extractErrorMessage(e)}.`,\n );\n return { success: false };\n }\n\n const drift = describeSectionsDrift(onDisk.sections, computed.sections);\n if (!drift) {\n // Slice 4.A.1 / H3: scoped success message — the check only\n // covers providers + infra. i18n / modules / future sections\n // are NOT verified by this command (see command JSDoc).\n ctx.log.info(chalk.green(\n ' ✅ Providers + infra sections are in sync with authored config.\\n'\n + ' (Other lockfile sections are not verified by this command.)\\n',\n ));\n return { success: true };\n }\n\n ctx.log.error(chalk.red(' ❌ Lockfile drift detected.\\n'));\n ctx.log.error(chalk.yellow(drift));\n ctx.log.error(\n chalk.yellow('\\n Run `wildo config sync` and commit the updated lockfile.\\n'),\n );\n return { success: false };\n }\n}\n\n/**\n * Compute the lockfile envelope that `wildo config sync` would\n * write right now, using the same primitives the sync uses but\n * without any disk writes.\n *\n * Slice 4.A.2 / M1 fix: `previousSections` is now passed in from the\n * caller (which already parsed the on-disk lockfile in `run()`)\n * instead of re-read here. Eliminates the redundant read and the\n * race window where the file could change between the two reads.\n *\n * **Exported for the Slice 6 CI gate** (`infra-provider-planner.md`)\n * so a \"live contract\" test can re-materialize the lockfile against\n * `examples/wonder-todos/` and assert no drift, mirroring the\n * `framework-knowledge-audit.live.contract.test.ts` pattern. The\n * function is otherwise an internal helper of the `lock check`\n * command; the export contract is \"stable enough for the test, do\n * not consume from outside the lock-check pair\".\n */\nexport async function computeWouldBeLockfileEnvelope(input: {\n saasRoot: string;\n generatedAt: string;\n /** The on-disk lockfile's `sections`, already parsed by the\n * caller. Spread into the computed envelope so unknown / non-\n * materialized sections (i18n, modules, future) are preserved\n * verbatim — matches the sync writer's behavior. */\n previousSections: SaasLockfileKnownSections;\n}): Promise<SaasLockfileEnvelope> {\n const { saasRoot, generatedAt, previousSections } = input;\n const saasConfig = await loadSaasConfig(join(saasRoot, 'wildo.saas.config.ts'));\n const discoveredProviderContributions = await resolveAndRegisterSaasProviderContributions({ saasRoot, saasConfig });\n const workerConfigs = await loadWorkerConfigs(saasRoot, saasConfig);\n const nodeWorkerKeys = workerConfigs\n .filter((entry) => isNodeWorkerRuntimeLanguage(entry.config.runtime.language))\n .map((entry) => entry.key);\n const { lockSection: providersSection } = materializeSaasProviderRuntimeArtifacts(\n saasConfig,\n {\n discoveredContributions: discoveredProviderContributions,\n nodeWorkerKeys,\n },\n );\n const infraSection = await computeInfraSection(saasRoot, generatedAt, previousSections.infra);\n\n return SaasLockfileEnvelopeSchema.parse({\n schemaVersion: 2,\n generatedAt,\n sections: {\n ...previousSections,\n providers: providersSection,\n ...(infraSection ? { infra: infraSection } : {}),\n },\n });\n}\n\nasync function computeInfraSection(\n saasRoot: string,\n generatedAt: string,\n previousSection: SaasLockfileInfraSection | undefined,\n): Promise<SaasLockfileInfraSection | undefined> {\n const infraDir = resolveAppLayout(saasRoot).authoredInfrastructureHome;\n if (!existsSync(infraDir)) return undefined;\n const envDirs = readdirSync(infraDir, { withFileTypes: true }).filter((d) => d.isDirectory());\n if (envDirs.length === 0) return undefined;\n\n const envs: InfraEnvSelectionInput[] = [];\n for (const envDir of envDirs) {\n const loaded = await loadAuthoredInfraEnvConfig(envDir.name, saasRoot);\n if (!loaded) continue;\n envs.push({\n envName: envDir.name,\n backingServices: loaded.config.backingServices,\n });\n }\n // Slice 6: pass the canonical module catalog so `planContributionDigest`\n // is computed identically to `provider-runtime-sync.service.ts`'s\n // writer path. Module-less providers fall through to the authored-entry\n // digest in `materializeInfraSection` (preserves Slice 2.5b semantics\n // for uncovered providers).\n const moduleMap = buildInfraProviderModuleMap();\n return materializeInfraSection({ envs, generatedAt, moduleMap, previousSection });\n}\n\n/**\n * Deep-compare `sections` ignoring `generatedAt` / `schemaVersion`.\n * Returns `null` on match, or a multi-line human-readable diff\n * otherwise. Diff format prioritizes section/key paths over raw JSON\n * dumps.\n *\n * Exported for testing (Slice 4.A.3 / T4) — the command's drift\n * detection is the load-bearing contract; pin its output format so a\n * future formatting refactor doesn't silently break CI gate\n * messaging.\n */\nexport function describeSectionsDrift(\n onDisk: SaasLockfileKnownSections,\n computed: SaasLockfileKnownSections,\n): string | null {\n const onDiskJson = stableJsonStringify(onDisk);\n const computedJson = stableJsonStringify(computed);\n if (onDiskJson === computedJson) return null;\n\n const lines: string[] = [];\n const allSectionKeys = new Set([...Object.keys(onDisk), ...Object.keys(computed)]);\n for (const sectionKey of Array.from(allSectionKeys).sort()) {\n const a = stableJsonStringify((onDisk as Record<string, unknown>)[sectionKey]);\n const b = stableJsonStringify((computed as Record<string, unknown>)[sectionKey]);\n if (a === b) continue;\n if (a === undefined) {\n lines.push(` + sections.${sectionKey} (added by sync — not in lockfile yet)`);\n } else if (b === undefined) {\n lines.push(` - sections.${sectionKey} (removed by sync — still in lockfile)`);\n } else {\n lines.push(` ~ sections.${sectionKey} (drift)`);\n lines.push(` on-disk: ${a.slice(0, 200)}${a.length > 200 ? '…' : ''}`);\n lines.push(` computed: ${b.slice(0, 200)}${b.length > 200 ? '…' : ''}`);\n }\n }\n return lines.join('\\n');\n}\n\nfunction isNodeWorkerRuntimeLanguage(language: string): boolean {\n return ['javascript', 'js', 'node', 'nodejs', 'ts', 'typescript'].includes(\n language.trim().toLowerCase(),\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"login.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/registry/login.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAQ1F,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,WAAW;IAC3D,QAAQ,CAAC,IAAI,EAAE,WAAW,CAkCxB;IAEI,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CA+DvD"}
1
+ {"version":3,"file":"login.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/registry/login.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAS1F,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,WAAW;IAC3D,QAAQ,CAAC,IAAI,EAAE,WAAW,CAkCxB;IAEI,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAgEvD"}
@@ -23,6 +23,7 @@ import { BaseCommand } from '../../kernel/base-command.js';
23
23
  import { CommandCategory } from '../../kernel/types.js';
24
24
  import { RegistryWhoamiResponseSchema, WorkspaceScope } from '@wildo-ai/platform-config-lib';
25
25
  import { RegistryCredentialsService } from '../../services/registry/registry-credentials.service.js';
26
+ import { REGISTRY_AUTH_REQUEST_TIMEOUT_MS } from './registry-transport.constants.js';
26
27
  import { getSaasRootIfAvailable, resolveRegistryUrlForCommand, } from '../../services/registry/registry-command.utils.js';
27
28
  export default class RegistryLoginCommand extends BaseCommand {
28
29
  meta = {
@@ -76,6 +77,7 @@ export default class RegistryLoginCommand extends BaseCommand {
76
77
  const res = await fetch(whoamiUrl, {
77
78
  method: 'GET',
78
79
  headers: { Authorization: `Bearer ${rawToken}` },
80
+ signal: AbortSignal.timeout(REGISTRY_AUTH_REQUEST_TIMEOUT_MS),
79
81
  });
80
82
  if (res.status === 401) {
81
83
  return { success: false, message: 'Token rejected by registry (401). Check the token and try again.' };
@@ -1 +1 @@
1
- {"version":3,"file":"login.command.js","sourceRoot":"","sources":["../../../../../../src/commands/registry/login.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,4BAA4B,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAA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OAAO,IAAI;oBACrG,iBAAiB;aACpB,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAE7B,MAAM,0BAA0B,CAAC,GAAG,CAAC;YACnC,WAAW,EAAE,QAAQ,CAAC,GAAG;YACzB,QAAQ;YACR,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC,CAAC;QAEH,GAAG,CAAC,GAAG,CAAC,OAAO,CACb,oBAAoB,IAAI,CAAC,cAAc,WAAW,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,GAAG;YACnF,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,GAAG,CACxD,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;QACzF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;IACzD,CAAC;CACF","sourcesContent":["/**\n * `wildo registry login` — authenticate the CLI against a registry.\n *\n * Verifies a bearer token against the registry's `/v1/auth/whoami`\n * endpoint, then persists it in the per-machine credentials store\n * (`$WILDO_HOME/registry-credentials.json`, chmod 0600).\n *\n * Wire flow:\n * 1. Resolve the registry URL via `resolveRegistryUrl` — accepts\n * `--registry <id|url|alias>` or falls back to the default-URL\n * policy.\n * 2. Prompt for the raw token (or accept it via `--token`).\n * 3. GET `/v1/auth/whoami` with `Authorization: Bearer <token>`.\n * A 200 confirms the token + returns the org context for\n * caching alongside the credential.\n * 4. Persist via `RegistryCredentialsService.set(...)`.\n *\n * Tokens are NEVER echoed back. The `--token` flag is supported for\n * non-interactive (CI) flows but the command refuses to print it\n * after persisting; only the org + apiKey labels surface.\n */\n\nimport { BaseCommand } from '~wildo-cli/kernel/base-command';\nimport { CommandCategory } from '~wildo-cli/kernel/types';\nimport type { CommandMeta, CommandContext, CommandResult } from '~wildo-cli/kernel/types';\nimport { RegistryWhoamiResponseSchema, WorkspaceScope } from '@wildo-ai/platform-config-lib';\nimport { RegistryCredentialsService } from '~wildo-cli/services/registry/registry-credentials.service';\nimport {\n getSaasRootIfAvailable,\n resolveRegistryUrlForCommand,\n} from '~wildo-cli/services/registry/registry-command.utils';\n\nexport default class RegistryLoginCommand extends BaseCommand {\n readonly meta: CommandMeta = {\n name: 'registry login',\n description: 'Authenticate the CLI against a registry; stores the bearer token per-machine.',\n category: CommandCategory.Registry,\n // 4th-pass H2 + 5th-pass H1: auth verb — workspace-independent.\n // `wildo registry login` is the bootstrap step that populates\n // `$WILDO_HOME/registry-credentials.json` for the first time.\n // It MUST run from a fresh install where `~/.wildo/preferences.json`\n // doesn't exist yet — i.e. `WorkspaceScope.UNINITIALIZED`. The\n // earlier `GLOBAL` floor blocked exactly the first-time-user\n // scenario it was meant to enable. Also covers the in-app case\n // (UNINITIALIZED is the loosest bound — every higher scope still\n // satisfies it).\n minimumScope: WorkspaceScope.UNINITIALIZED,\n flags: {\n registry: {\n type: 'string',\n description:\n 'Registry id (from `wildo.saas.config.ts > moduleRegistries`), full URL, ' +\n 'or alias (`local` / `public`). Default: framework-developer mode → local, else public.',\n },\n token: {\n type: 'string',\n description: 'Raw bearer token (`wks_...`). For non-interactive use; otherwise prompted.',\n },\n },\n prompts: [\n {\n id: 'token',\n type: 'password',\n message: 'Registry bearer token (wks_...)',\n when: (ctx) => !ctx.flags.token,\n },\n ],\n };\n\n async run(ctx: CommandContext): Promise<CommandResult> {\n const flag = ctx.flags.registry as string | undefined;\n const resolved = await resolveRegistryUrlForCommand(ctx, {\n flag,\n saasRoot: getSaasRootIfAvailable(ctx),\n });\n ctx.log.info(`[registry login] target → ${resolved.url} (source: ${resolved.source})`);\n\n const tokenFromFlag = ctx.flags.token as string | undefined;\n const tokenFromAnswer = ctx.answers.token as string | undefined;\n const rawToken = tokenFromFlag ?? tokenFromAnswer;\n if (!rawToken || typeof rawToken !== 'string') {\n return { success: false, message: 'No token supplied; aborted.' };\n }\n\n const whoamiUrl = `${resolved.url.replace(/\\/+$/, '')}/v1/auth/whoami`;\n const res = await fetch(whoamiUrl, {\n method: 'GET',\n headers: { Authorization: `Bearer ${rawToken}` },\n });\n\n if (res.status === 401) {\n return { success: false, message: 'Token rejected by registry (401). Check the token and try again.' };\n }\n if (!res.ok) {\n return {\n success: false,\n message: `Registry whoami failed (${res.status} ${res.statusText}) at ${whoamiUrl}.`,\n };\n }\n\n // M11: Zod-parse the response so we fail-closed on a\n // misconfigured registry returning 200 with no `organizationId`\n // (or a different shape entirely). Without this guard the\n // credential persists with `org=?` and every downstream\n // operation looks \"logged in\" while the auth context is\n // actually unidentifiable.\n const parsedBody = RegistryWhoamiResponseSchema.safeParse(await res.json());\n if (!parsedBody.success) {\n return {\n success: false,\n message:\n `Registry whoami at ${whoamiUrl} returned an unexpected payload shape: ${parsedBody.error.message}. ` +\n 'Aborting login.',\n };\n }\n const body = parsedBody.data;\n\n await RegistryCredentialsService.set({\n registryUrl: resolved.url,\n rawToken,\n organizationId: body.organizationId,\n apiKeyId: body.apiKeyId,\n apiKeyName: body.apiKeyName,\n });\n\n ctx.log.success(\n `Logged in as org=${body.organizationId} apiKey=${body.apiKeyName ?? body.apiKeyId} ` +\n `(roles: ${(body.roles ?? []).join(', ') || 'none'})`,\n );\n ctx.log.info('Credential stored in $WILDO_HOME/registry-credentials.json (chmod 0600).');\n return { success: true, message: 'Login successful.' };\n }\n}\n"]}
1
+ {"version":3,"file":"login.command.js","sourceRoot":"","sources":["../../../../src/commands/registry/login.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,4BAA4B,EAAE,cAAc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CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YACxB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,OAAO,EACL,sBAAsB,SAAS,0CAA0C,UAAU,CAAC,KAAK,CAAC,OAAO,IAAI;oBACrG,iBAAiB;aACpB,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAE7B,MAAM,0BAA0B,CAAC,GAAG,CAAC;YACnC,WAAW,EAAE,QAAQ,CAAC,GAAG;YACzB,QAAQ;YACR,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC,CAAC;QAEH,GAAG,CAAC,GAAG,CAAC,OAAO,CACb,oBAAoB,IAAI,CAAC,cAAc,WAAW,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,GAAG;YACnF,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,GAAG,CACxD,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;QACzF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;IACzD,CAAC;CACF","sourcesContent":["/**\n * `wildo registry login` — authenticate the CLI against a registry.\n *\n * Verifies a bearer token against the registry's `/v1/auth/whoami`\n * endpoint, then persists it in the per-machine credentials store\n * (`$WILDO_HOME/registry-credentials.json`, chmod 0600).\n *\n * Wire flow:\n * 1. Resolve the registry URL via `resolveRegistryUrl` — accepts\n * `--registry <id|url|alias>` or falls back to the default-URL\n * policy.\n * 2. Prompt for the raw token (or accept it via `--token`).\n * 3. GET `/v1/auth/whoami` with `Authorization: Bearer <token>`.\n * A 200 confirms the token + returns the org context for\n * caching alongside the credential.\n * 4. Persist via `RegistryCredentialsService.set(...)`.\n *\n * Tokens are NEVER echoed back. The `--token` flag is supported for\n * non-interactive (CI) flows but the command refuses to print it\n * after persisting; only the org + apiKey labels surface.\n */\n\nimport { BaseCommand } from '~wildo-cli/kernel/base-command';\nimport { CommandCategory } from '~wildo-cli/kernel/types';\nimport type { CommandMeta, CommandContext, CommandResult } from '~wildo-cli/kernel/types';\nimport { RegistryWhoamiResponseSchema, WorkspaceScope } from '@wildo-ai/platform-config-lib';\nimport { RegistryCredentialsService } from '~wildo-cli/services/registry/registry-credentials.service';\nimport { REGISTRY_AUTH_REQUEST_TIMEOUT_MS } from './registry-transport.constants';\nimport {\n getSaasRootIfAvailable,\n resolveRegistryUrlForCommand,\n} from '~wildo-cli/services/registry/registry-command.utils';\n\nexport default class RegistryLoginCommand extends BaseCommand {\n readonly meta: CommandMeta = {\n name: 'registry login',\n description: 'Authenticate the CLI against a registry; stores the bearer token per-machine.',\n category: CommandCategory.Registry,\n // 4th-pass H2 + 5th-pass H1: auth verb — workspace-independent.\n // `wildo registry login` is the bootstrap step that populates\n // `$WILDO_HOME/registry-credentials.json` for the first time.\n // It MUST run from a fresh install where `~/.wildo/preferences.json`\n // doesn't exist yet — i.e. `WorkspaceScope.UNINITIALIZED`. The\n // earlier `GLOBAL` floor blocked exactly the first-time-user\n // scenario it was meant to enable. Also covers the in-app case\n // (UNINITIALIZED is the loosest bound — every higher scope still\n // satisfies it).\n minimumScope: WorkspaceScope.UNINITIALIZED,\n flags: {\n registry: {\n type: 'string',\n description:\n 'Registry id (from `wildo.saas.config.ts > moduleRegistries`), full URL, ' +\n 'or alias (`local` / `public`). Default: framework-developer mode → local, else public.',\n },\n token: {\n type: 'string',\n description: 'Raw bearer token (`wks_...`). For non-interactive use; otherwise prompted.',\n },\n },\n prompts: [\n {\n id: 'token',\n type: 'password',\n message: 'Registry bearer token (wks_...)',\n when: (ctx) => !ctx.flags.token,\n },\n ],\n };\n\n async run(ctx: CommandContext): Promise<CommandResult> {\n const flag = ctx.flags.registry as string | undefined;\n const resolved = await resolveRegistryUrlForCommand(ctx, {\n flag,\n saasRoot: getSaasRootIfAvailable(ctx),\n });\n ctx.log.info(`[registry login] target → ${resolved.url} (source: ${resolved.source})`);\n\n const tokenFromFlag = ctx.flags.token as string | undefined;\n const tokenFromAnswer = ctx.answers.token as string | undefined;\n const rawToken = tokenFromFlag ?? tokenFromAnswer;\n if (!rawToken || typeof rawToken !== 'string') {\n return { success: false, message: 'No token supplied; aborted.' };\n }\n\n const whoamiUrl = `${resolved.url.replace(/\\/+$/, '')}/v1/auth/whoami`;\n const res = await fetch(whoamiUrl, {\n method: 'GET',\n headers: { Authorization: `Bearer ${rawToken}` },\n signal: AbortSignal.timeout(REGISTRY_AUTH_REQUEST_TIMEOUT_MS),\n });\n\n if (res.status === 401) {\n return { success: false, message: 'Token rejected by registry (401). Check the token and try again.' };\n }\n if (!res.ok) {\n return {\n success: false,\n message: `Registry whoami failed (${res.status} ${res.statusText}) at ${whoamiUrl}.`,\n };\n }\n\n // M11: Zod-parse the response so we fail-closed on a\n // misconfigured registry returning 200 with no `organizationId`\n // (or a different shape entirely). Without this guard the\n // credential persists with `org=?` and every downstream\n // operation looks \"logged in\" while the auth context is\n // actually unidentifiable.\n const parsedBody = RegistryWhoamiResponseSchema.safeParse(await res.json());\n if (!parsedBody.success) {\n return {\n success: false,\n message:\n `Registry whoami at ${whoamiUrl} returned an unexpected payload shape: ${parsedBody.error.message}. ` +\n 'Aborting login.',\n };\n }\n const body = parsedBody.data;\n\n await RegistryCredentialsService.set({\n registryUrl: resolved.url,\n rawToken,\n organizationId: body.organizationId,\n apiKeyId: body.apiKeyId,\n apiKeyName: body.apiKeyName,\n });\n\n ctx.log.success(\n `Logged in as org=${body.organizationId} apiKey=${body.apiKeyName ?? body.apiKeyId} ` +\n `(roles: ${(body.roles ?? []).join(', ') || 'none'})`,\n );\n ctx.log.info('Credential stored in $WILDO_HOME/registry-credentials.json (chmod 0600).');\n return { success: true, message: 'Login successful.' };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"publish.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/registry/publish.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAsE1F,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,WAAW;IAC7D,QAAQ,CAAC,IAAI,EAAE,WAAW,CAoBxB;IAEI,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAiHvD"}
1
+ {"version":3,"file":"publish.command.d.ts","sourceRoot":"","sources":["../../../../src/commands/registry/publish.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAuE1F,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,WAAW;IAC7D,QAAQ,CAAC,IAAI,EAAE,WAAW,CAoBxB;IAEI,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAkHvD"}
@@ -37,6 +37,7 @@ import { ModuleManifestSchema, } from '@wildo-ai/platform-config-lib';
37
37
  import { RegistryCredentialsService } from '../../services/registry/registry-credentials.service.js';
38
38
  import { requireSaasRoot, resolveRegistryUrlForCommand, } from '../../services/registry/registry-command.utils.js';
39
39
  import { createZipFromDir } from '../../services/registry/artifact-extractor.utils.js';
40
+ import { REGISTRY_PUBLISH_REQUEST_TIMEOUT_MS } from './registry-transport.constants.js';
40
41
  const DEFAULT_MANIFEST_FILE = 'wildo.module.json';
41
42
  async function readManifest(manifestPath) {
42
43
  const raw = await fs.readFile(manifestPath, 'utf8');
@@ -182,6 +183,7 @@ export default class RegistryPublishCommand extends BaseCommand {
182
183
  manifest,
183
184
  artifactBase64: Buffer.from(zipBytes).toString('base64'),
184
185
  }),
186
+ signal: AbortSignal.timeout(REGISTRY_PUBLISH_REQUEST_TIMEOUT_MS),
185
187
  });
186
188
  if (res.status === 201) {
187
189
  const body = (await res.json());