everything-dev 2.0.0-rc.5 → 2.0.0-rc.7

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 (120) hide show
  1. package/README.md +2 -2
  2. package/dist/build.cjs +1 -1
  3. package/dist/build.mjs +1 -1
  4. package/dist/bundle-cache.cjs +1 -1
  5. package/dist/bundle-cache.cjs.map +1 -1
  6. package/dist/bundle-cache.mjs +1 -1
  7. package/dist/bundle-cache.mjs.map +1 -1
  8. package/dist/cli/infra.cjs +4 -2
  9. package/dist/cli/infra.cjs.map +1 -1
  10. package/dist/cli/infra.mjs +4 -2
  11. package/dist/cli/infra.mjs.map +1 -1
  12. package/dist/cli.cjs +2 -2
  13. package/dist/cli.cjs.map +1 -1
  14. package/dist/cli.mjs +1 -1
  15. package/dist/cli.mjs.map +1 -1
  16. package/dist/commands/deploy.cjs +111 -1
  17. package/dist/commands/deploy.cjs.map +1 -1
  18. package/dist/commands/deploy.mjs +112 -2
  19. package/dist/commands/deploy.mjs.map +1 -1
  20. package/dist/commands/smoke.cjs +41 -0
  21. package/dist/commands/smoke.cjs.map +1 -0
  22. package/dist/commands/smoke.mjs +41 -0
  23. package/dist/commands/smoke.mjs.map +1 -0
  24. package/dist/commands/upgrade.cjs +2 -2
  25. package/dist/commands/upgrade.cjs.map +1 -1
  26. package/dist/commands/upgrade.mjs +1 -1
  27. package/dist/commands/upgrade.mjs.map +1 -1
  28. package/dist/contract.cjs +27 -1
  29. package/dist/contract.cjs.map +1 -1
  30. package/dist/contract.d.cts +65 -1
  31. package/dist/contract.d.mts +65 -1
  32. package/dist/contract.meta.cjs +13 -1
  33. package/dist/contract.meta.cjs.map +1 -1
  34. package/dist/contract.meta.d.cts +23 -1
  35. package/dist/contract.meta.d.mts +23 -1
  36. package/dist/contract.meta.mjs +13 -1
  37. package/dist/contract.meta.mjs.map +1 -1
  38. package/dist/contract.mjs +26 -2
  39. package/dist/contract.mjs.map +1 -1
  40. package/dist/dev-log-pipeline.cjs +6 -0
  41. package/dist/dev-log-pipeline.cjs.map +1 -1
  42. package/dist/dev-log-pipeline.mjs +6 -0
  43. package/dist/dev-log-pipeline.mjs.map +1 -1
  44. package/dist/dev-program.cjs +21 -5
  45. package/dist/dev-program.cjs.map +1 -1
  46. package/dist/dev-program.mjs +21 -6
  47. package/dist/dev-program.mjs.map +1 -1
  48. package/dist/dev-session.cjs +1 -0
  49. package/dist/dev-session.cjs.map +1 -1
  50. package/dist/dev-session.mjs +1 -0
  51. package/dist/dev-session.mjs.map +1 -1
  52. package/dist/fastkv.cjs +21 -3
  53. package/dist/fastkv.cjs.map +1 -1
  54. package/dist/fastkv.d.cts +14 -1
  55. package/dist/fastkv.d.mts +14 -1
  56. package/dist/fastkv.mjs +21 -5
  57. package/dist/fastkv.mjs.map +1 -1
  58. package/dist/{mf.cjs → federation.cjs} +6 -13
  59. package/dist/federation.cjs.map +1 -0
  60. package/dist/{mf.d.cts → federation.d.cts} +2 -2
  61. package/dist/{mf.d.mts → federation.d.mts} +2 -2
  62. package/dist/{mf.mjs → federation.mjs} +6 -13
  63. package/dist/federation.mjs.map +1 -0
  64. package/dist/http-client.cjs +70 -53
  65. package/dist/http-client.cjs.map +1 -1
  66. package/dist/http-client.mjs +70 -54
  67. package/dist/http-client.mjs.map +1 -1
  68. package/dist/image-deploy.cjs +9 -0
  69. package/dist/image-deploy.cjs.map +1 -1
  70. package/dist/image-deploy.mjs +9 -1
  71. package/dist/image-deploy.mjs.map +1 -1
  72. package/dist/index.cjs +4 -0
  73. package/dist/index.d.cts +3 -3
  74. package/dist/index.d.mts +3 -3
  75. package/dist/index.mjs +3 -3
  76. package/dist/orchestrator.cjs +60 -52
  77. package/dist/orchestrator.cjs.map +1 -1
  78. package/dist/orchestrator.mjs +60 -52
  79. package/dist/orchestrator.mjs.map +1 -1
  80. package/dist/plugin.cjs +2 -0
  81. package/dist/plugin.cjs.map +1 -1
  82. package/dist/plugin.d.cts +24 -0
  83. package/dist/plugin.d.mts +24 -0
  84. package/dist/plugin.mjs +2 -0
  85. package/dist/plugin.mjs.map +1 -1
  86. package/dist/process-registry.cjs +1 -1
  87. package/dist/process-registry.mjs +1 -1
  88. package/dist/publish.cjs +3 -3
  89. package/dist/publish.cjs.map +1 -1
  90. package/dist/publish.mjs +4 -4
  91. package/dist/publish.mjs.map +1 -1
  92. package/dist/resolver.cjs +293 -0
  93. package/dist/resolver.cjs.map +1 -0
  94. package/dist/resolver.d.cts +99 -0
  95. package/dist/resolver.d.mts +99 -0
  96. package/dist/resolver.mjs +284 -0
  97. package/dist/resolver.mjs.map +1 -0
  98. package/dist/smoke.cjs +262 -0
  99. package/dist/smoke.cjs.map +1 -0
  100. package/dist/smoke.mjs +260 -0
  101. package/dist/smoke.mjs.map +1 -0
  102. package/dist/version-manifest-resolve.cjs +3 -3
  103. package/dist/version-manifest-resolve.cjs.map +1 -1
  104. package/dist/version-manifest-resolve.mjs +1 -1
  105. package/dist/version-manifest-resolve.mjs.map +1 -1
  106. package/dist/workspace.cjs +1 -1
  107. package/dist/workspace.mjs +1 -1
  108. package/package.json +9 -9
  109. package/dist/bundle-fs-resolve.cjs +0 -201
  110. package/dist/bundle-fs-resolve.cjs.map +0 -1
  111. package/dist/bundle-fs-resolve.d.cts +0 -82
  112. package/dist/bundle-fs-resolve.d.mts +0 -82
  113. package/dist/bundle-fs-resolve.mjs +0 -194
  114. package/dist/bundle-fs-resolve.mjs.map +0 -1
  115. package/dist/bundle-path.cjs +0 -48
  116. package/dist/bundle-path.cjs.map +0 -1
  117. package/dist/bundle-path.mjs +0 -45
  118. package/dist/bundle-path.mjs.map +0 -1
  119. package/dist/mf.cjs.map +0 -1
  120. package/dist/mf.mjs.map +0 -1
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["bosPlugin"],"sources":["../src/cli.ts"],"sourcesContent":["import { existsSync, watch } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { dirname, resolve } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport { installBundleFetchFromEnv } from \"./bundle-fs-resolve\";\nimport { findCommandDescriptor } from \"./cli/catalog\";\nimport { resolveFrameworkPackage } from \"./cli/framework-version\";\nimport { printHelp } from \"./cli/help\";\nimport { runDockerComposeUp } from \"./cli/init\";\nimport { parseCommandInput } from \"./cli/parse\";\nimport { promptInitBasic, promptInitOverrides } from \"./cli/prompts\";\nimport { compareSemver } from \"./cli/status\";\nimport { formatDuration, sumPhaseDurations } from \"./cli/timing\";\nimport { fetchInitParent } from \"./commands/init\";\nimport { findConfigPath, MISSING_CONFIG_MESSAGE, readAuthoredConfigInput } from \"./config\";\nimport type {\n DevOptions,\n DevResult,\n InitOptions,\n InitResult,\n KeyPublishOptions,\n KillOptions,\n KillResult,\n LogsOptions,\n LogsResult,\n OverrideSection,\n PsResult,\n StartOptions,\n StartResult,\n TypecheckWorkspaceResult,\n} from \"./contract\";\nimport type { StartSummary } from \"./dev-program\";\nimport { getRegistryNamespaceForAccount } from \"./fastkv\";\nimport { listPublishKeys } from \"./near-cli\";\nimport { getNetworkIdForAccount } from \"./network\";\nimport bosPlugin from \"./plugin\";\nimport { type ProgressEvent, pluginEvents } from \"./progress\";\nimport { createPluginRuntime } from \"./sdk\";\nimport { printBanner } from \"./utils/banner\";\nimport { colors, frames, gradients, icons } from \"./utils/theme\";\n\nfunction printConfigView(result: {\n account: string;\n domain?: string;\n staging?: { domain: string };\n app?: {\n host: { name?: string; development: string; production?: string };\n ui: { name?: string; development?: string; production?: string; ssr?: string };\n api: { name?: string; development?: string; production?: string; proxy?: string };\n };\n}) {\n console.log();\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"CONFIG\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n\n console.log(` ${colors.dim(\"Account\")} ${colors.cyan(result.account)}`);\n console.log(` ${colors.dim(\"Domain\")} ${colors.white(result.domain ?? \"not configured\")}`);\n if (result.staging) {\n console.log(` ${colors.dim(\"Staging\")} ${colors.magenta(result.staging.domain)}`);\n }\n console.log();\n}\n\nfunction formatTimeAgo(isoTimestamp: string): string {\n const now = Date.now();\n const then = new Date(isoTimestamp).getTime();\n const diffMs = now - then;\n const diffMins = Math.floor(diffMs / 60_000);\n if (diffMins < 1) return \"just now\";\n if (diffMins < 60) return `${diffMins} minute${diffMins > 1 ? \"s\" : \"\"} ago`;\n const diffHours = Math.floor(diffMins / 60);\n if (diffHours < 24) return `${diffHours} hour${diffHours > 1 ? \"s\" : \"\"} ago`;\n const diffDays = Math.floor(diffHours / 24);\n if (diffDays < 30) return `${diffDays} day${diffDays > 1 ? \"s\" : \"\"} ago`;\n return isoTimestamp.split(\"T\")[0] ?? isoTimestamp;\n}\n\nconst RETIRED_BOOTSTRAP_STUBS = [\n \"ui/src/entry.ts\",\n \"ui/src/hydrate.tsx\",\n \"ui/src/router.server.tsx\",\n \"ui/src/compose.ts\",\n];\n\n/**\n * Hand-modified bootstrap stubs retire as conflicted (backed up, then\n * deleted) — print the mechanical port into the authored seams (ADR 0023).\n */\nfunction printStubMigrationGuide(retiredConflicted: string[] | undefined) {\n const handModified = (retiredConflicted ?? []).filter((f) => RETIRED_BOOTSTRAP_STUBS.includes(f));\n if (handModified.length === 0) return;\n console.log(` ${colors.yellow(\"Port your stub customizations into the authored seams:\")}`);\n console.log(\n ` ${colors.dim(\"- defaultErrorComponent / defaultPendingComponent / defaultNotFoundComponent\")}`,\n );\n console.log(\n ` ${colors.dim(\" → set them inside the createRouter factory in ui/src/router.tsx (after ...opts)\")}`,\n );\n console.log(\n ` ${colors.dim(\"- apiConnectionError copy + SSR locale config (locales, defaultLocale, cookieName)\")}`,\n );\n console.log(\n ` ${colors.dim(\" → export apiConnectionError / appLocale from ui/src/app.ts (see the scaffold template)\")}`,\n );\n console.log(` ${colors.dim(\" backed-up originals: .bos/sync-backup/<timestamp>/\")}`);\n}\n\nfunction printTimingSummary(timings: Array<{ name: string; durationMs: number }> | undefined) {\n if (!timings || timings.length === 0) return;\n\n console.log(` ${colors.dim(\"Timings:\")}`);\n for (const timing of timings) {\n console.log(` ${colors.dim(timing.name.padEnd(22))} ${formatDuration(timing.durationMs)}`);\n }\n console.log(\n ` ${colors.dim(\"total\".padEnd(22))} ${formatDuration(sumPhaseDurations(timings))}`,\n );\n}\n\nfunction printStartSummary(summary: StartSummary) {\n console.log();\n console.log(` ${colors.dim(\"Config Source:\")} ${summary.configSource}`);\n if (summary.configSourceHttp) {\n console.log(` ${colors.dim(summary.configSourceHttp)}`);\n }\n console.log(` ${colors.dim(\"Account:\")} ${summary.account}`);\n console.log(` ${colors.dim(\"Domain:\")} ${summary.domain ?? \"not configured\"}`);\n console.log();\n console.log(` ${colors.dim(\"Modules:\")}`);\n console.log(` ${colors.dim(\"HOST\")} → ${summary.modules.host ?? \"local\"}`);\n console.log(` ${colors.dim(\"UI\")} → ${summary.modules.ui ?? \"local\"}`);\n console.log(` ${colors.dim(\"API\")} → ${summary.modules.api ?? \"local\"}`);\n if (summary.modules.auth) {\n console.log(` ${colors.dim(\"AUTH\")} → ${summary.modules.auth}`);\n }\n if (summary.warnings.length > 0) {\n console.log();\n for (const w of summary.warnings) {\n console.log(` ${colors.yellow(w)}`);\n }\n }\n console.log();\n}\n\nfunction clearSpinnerStopLine() {\n if (!process.stdout.isTTY) return;\n process.stdout.write(\"\\u001B[1A\\u001B[2K\\u001B[1G\");\n}\n\nasync function warnIfOutdated(client: any, command: string): Promise<void> {\n if (![\"dev\", \"build\", \"start\"].includes(command)) return;\n\n try {\n const status = await client.status();\n if (status.status === \"error\" || !status.packages) return;\n\n const frameworkPackages = [\"everything-dev\", \"every-plugin\"];\n\n const linked = status.packages.filter((p: { isLinked?: boolean }) => p.isLinked);\n const outdated = status.packages.filter(\n (p: { name: string; installed?: string; latest?: string; isLinked?: boolean }) =>\n !p.isLinked &&\n p.installed &&\n p.latest &&\n compareSemver(p.installed, p.latest) < 0 &&\n frameworkPackages.includes(p.name),\n );\n\n if (linked.length > 0) {\n for (const pkg of linked) {\n console.log(colors.dim(` ${pkg.name} is linked locally (v${pkg.installed})`));\n }\n }\n\n if (outdated.length === 0) return;\n\n const warn = (line: string) => {\n if (command === \"dev\" || command === \"start\") process.stderr.write(`${line}\\n`);\n else console.log(line);\n };\n warn(\"\");\n warn(colors.yellow(` ! Outdated packages detected:`));\n for (const pkg of outdated) {\n warn(colors.dim(` ${pkg.name} ${pkg.installed} → ${pkg.latest}`));\n }\n warn(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n warn(\"\");\n } catch {\n // silently ignore if status check fails\n }\n}\n\nasync function main() {\n const args = process.argv.slice(2);\n\n if (args.includes(\"--help\") || args.includes(\"-h\")) {\n printHelp();\n return;\n }\n\n const invocationArgs = args.length > 0 ? args : [\"dev\"];\n const command = invocationArgs[0] ?? \"dev\";\n\n const commandMatch = findCommandDescriptor(invocationArgs);\n if (!commandMatch) {\n console.error(`Unknown command: ${command}`);\n process.exit(1);\n }\n\n const { descriptor, consumed } = commandMatch;\n const commandArgs = invocationArgs.slice(consumed);\n\n // Parse before the plugin boot: `start --config-path` steers the whole CLI,\n // not just the stack — the plugin initialize resolves and pin-validates the\n // boot config, so it must be the config the command will actually run.\n let parsedInput: unknown;\n try {\n parsedInput = parseCommandInput(descriptor, commandArgs);\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n const bootInput = parsedInput as { configPath?: string };\n\n const cwdConfigPath = findConfigPath();\n const configPath = bootInput.configPath ?? cwdConfigPath;\n installBundleFetchFromEnv({ configPath });\n\n const projectDir = cwdConfigPath ? dirname(cwdConfigPath) : undefined;\n const edResolved = projectDir ? resolveFrameworkPackage(projectDir, \"everything-dev\") : undefined;\n const displayVersion = edResolved?.installedVersion\n ? `${edResolved.installedVersion}${edResolved.isLinked ? \" (linked)\" : \"\"}`\n : undefined;\n if (!process.env.BOS_NO_BANNER) {\n printBanner(\"everything-dev\", displayVersion);\n }\n\n const runtime = createPluginRuntime({\n registry: {\n bos: { module: bosPlugin },\n },\n secrets: {},\n });\n\n const pluginRuntime: any = runtime;\n const loadPlugin = pluginRuntime.usePlugin.bind(pluginRuntime);\n const plugin = await loadPlugin(\"bos\", {\n variables: {\n configPath: configPath ?? undefined,\n configDir: cwdConfigPath ? dirname(cwdConfigPath) : undefined,\n },\n secrets: {},\n });\n\n const client = plugin.createClient();\n\n const outdatedWarning = warnIfOutdated(client, command);\n\n try {\n const input = parsedInput;\n\n const rollbackInput = input as {\n listOnly?: boolean;\n version?: string;\n previous?: boolean;\n [key: string]: unknown;\n };\n if (\n descriptor.key === \"rollback\" &&\n !rollbackInput.listOnly &&\n !rollbackInput.version &&\n !rollbackInput.previous\n ) {\n const listing = await (client as any).rollback({ ...rollbackInput, listOnly: true });\n if (listing.status !== \"list\" || !listing.history?.length) {\n console.error(listing.error ?? \"No publish history found\");\n process.exit(1);\n }\n console.log();\n const selection = await p.select({\n message: \"Roll back to which publish?\",\n options: listing.history.map(\n (entry: {\n blockHeight: number;\n blockTimestamp: string;\n txHash?: string;\n summary: string;\n }) => ({\n value: String(entry.blockHeight),\n label: `${entry.blockTimestamp} (block ${entry.blockHeight})`,\n hint: entry.summary,\n }),\n ),\n });\n if (p.isCancel(selection)) {\n return;\n }\n rollbackInput.version = selection as string;\n }\n\n if (descriptor.key === \"keyPublish\") {\n const keyPublishInput = input as KeyPublishOptions;\n if (keyPublishInput.removeOldKeys === undefined) {\n if (process.stdin.isTTY) {\n const authored = configPath ? await readAuthoredConfigInput(dirname(configPath)) : null;\n const account =\n keyPublishInput.env === \"staging\"\n ? (authored?.staging?.account ?? authored?.account)\n : authored?.account;\n let listed: string[] | null = null;\n if (account) {\n const network = getNetworkIdForAccount(account);\n const contract = getRegistryNamespaceForAccount(account, keyPublishInput.registry);\n try {\n listed = await listPublishKeys({ account, contract, network });\n } catch {\n listed = null;\n }\n }\n if (listed?.length) {\n const removeOldKeys = await p.confirm({\n message: `Remove ${listed.length} existing publish key${listed.length > 1 ? \"s\" : \"\"}?`,\n initialValue: true,\n });\n if (p.isCancel(removeOldKeys)) {\n return;\n }\n keyPublishInput.removeOldKeys = removeOldKeys;\n } else {\n keyPublishInput.removeOldKeys = true;\n }\n } else {\n keyPublishInput.removeOldKeys = true;\n }\n }\n }\n\n if (descriptor.key === \"dev\") {\n const devSpinner = p.spinner();\n devSpinner.start(\"Starting dev environment\");\n\n const devPhaseLabels: Record<string, string> = {\n \"shared deps\": \"Preparing config...\",\n install: \"Installing dependencies...\",\n build: \"Building...\",\n \"resolve config\": \"Resolving config...\",\n ports: \"Finding available ports...\",\n \"docker compose up\": \"Starting local Postgres...\",\n \"generate artifacts\": \"Generating code artifacts...\",\n };\n\n const onDevProgress = (event: ProgressEvent) => {\n const label = devPhaseLabels[event.phase] ?? event.phase;\n if (event.status === \"running\") {\n devSpinner.message(label);\n }\n };\n pluginEvents.on(\"progress\", onDevProgress);\n\n let result: DevResult;\n try {\n result = await client.dev(input as DevOptions);\n } finally {\n pluginEvents.off(\"progress\", onDevProgress);\n }\n\n if (result.status === \"error\") {\n devSpinner.stop(\"Failed\");\n console.error(`[CLI] ${result.description}`);\n process.exit(1);\n }\n\n devSpinner.stop();\n clearSpinnerStopLine();\n\n const session = result.session;\n void outdatedWarning;\n if (session) {\n const { devApp } = await import(\"./dev-session\");\n devApp(\n projectDir ?? process.cwd(),\n session.orchestrator,\n session.services,\n session.runtimeConfig,\n session.envGenerated,\n session.shellEnv,\n );\n }\n return;\n }\n\n if (descriptor.key === \"start\") {\n const startSpinner = p.spinner();\n startSpinner.start(\"Starting production environment\");\n\n const startPhaseLabels: Record<string, string> = {\n config: \"Preparing config...\",\n \"generate artifacts\": \"Generating code artifacts...\",\n };\n\n const onStartProgress = (event: ProgressEvent) => {\n const label = startPhaseLabels[event.phase] ?? event.phase;\n if (event.status === \"running\") {\n startSpinner.message(label);\n }\n };\n pluginEvents.on(\"progress\", onStartProgress);\n\n let result: StartResult;\n try {\n result = await client.start(input as StartOptions);\n } finally {\n pluginEvents.off(\"progress\", onStartProgress);\n }\n\n if (result.status === \"error\") {\n startSpinner.stop(\"Failed\");\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n\n startSpinner.stop(\"Ready\");\n\n const session = result.session;\n const summary = result.summary;\n void outdatedWarning;\n if (session) {\n if (summary) {\n printStartSummary(summary);\n }\n const { startApp } = await import(\"./dev-session\");\n startApp(\n projectDir ?? process.cwd(),\n session.orchestrator,\n session.services,\n session.runtimeConfig,\n session.envGenerated,\n session.shellEnv,\n );\n }\n return;\n }\n\n if (descriptor.key === \"init\") {\n let initInput: InitOptions = { ...(input as InitOptions) };\n\n if (!initInput.noInteractive) {\n const basic = await promptInitBasic({\n extends: initInput.extends,\n account: initInput.account,\n domain: initInput.domain,\n });\n\n let parentPluginKeys: string[] = [];\n let parentConfig: {\n title?: string;\n description?: string;\n plugins?: Record<string, unknown>;\n } | null = null;\n\n const fetchSpinner = p.spinner();\n fetchSpinner.start(\"Fetching parent config\");\n try {\n const parent = await fetchInitParent(basic.extendsAccount, basic.extendsGateway);\n parentConfig = parent.parentConfig;\n parentPluginKeys = parent.parentPluginKeys;\n } catch {\n fetchSpinner.stop(\"Config not found\");\n console.error(\n `[CLI] No config found at bos://${basic.extendsAccount}/${basic.extendsGateway}`,\n );\n process.exit(1);\n }\n fetchSpinner.stop(\"Config fetched\");\n\n if (\n typeof parentConfig?.title === \"string\" &&\n parentConfig.title.trim() &&\n typeof parentConfig?.description === \"string\" &&\n parentConfig.description.trim()\n ) {\n const shouldContinue = await p.confirm({\n message: `You will be extending ${parentConfig.title} - ${parentConfig.description}. Continue?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldContinue) || !shouldContinue) {\n process.exit(0);\n }\n }\n\n const overrides = await promptInitOverrides({\n parentPluginKeys,\n plugins: initInput.plugins,\n overrides: initInput.overrides as OverrideSection[] | undefined,\n level: initInput.level,\n });\n\n const directory = initInput.directory || basic.domain || basic.extendsGateway;\n\n initInput = {\n ...initInput,\n extends: `bos://${basic.extendsAccount}/${basic.extendsGateway}`,\n directory,\n account: basic.account,\n domain: basic.domain || undefined,\n plugins: overrides.plugins,\n overrides: overrides.overrides,\n level: overrides.level ?? initInput.level,\n noInteractive: true,\n };\n }\n\n const initSpinner = p.spinner();\n initSpinner.start(\"Initializing project\");\n\n const phaseLabels: Record<string, string> = {\n \"parent config\": \"Fetching parent config...\",\n \"template source\": \"Resolving template source...\",\n \"scaffold project\": \"Creating project scaffold...\",\n \"copy files\": \"Copying template files...\",\n \"personalize config\": \"Personalizing config...\",\n \"write snapshot\": \"Writing snapshot...\",\n \"resolve config\": \"Resolving config...\",\n \"generate env/docker\": \"Generating environment config...\",\n \"create env file\": \"Creating .env file...\",\n \"install dependencies\": \"Installing dependencies...\",\n \"generate types\": \"Generating types...\",\n \"generate migrations\": \"Generating database migrations...\",\n \"generate code artifacts\": \"Generating code artifacts...\",\n };\n\n const onProgress = (event: ProgressEvent) => {\n const label = phaseLabels[event.phase] ?? event.phase;\n if (event.status === \"running\") {\n initSpinner.message(label);\n }\n };\n pluginEvents.on(\"progress\", onProgress);\n\n let result: InitResult;\n try {\n result = await client.init(initInput);\n } finally {\n pluginEvents.off(\"progress\", onProgress);\n }\n\n if (result.status === \"error\") {\n initSpinner.stop(\"Failed\");\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n\n initSpinner.stop(\"Project initialized\");\n\n console.log(` ${colors.dim(\"Extends:\")} ${result.extends}`);\n console.log(` ${colors.dim(\"Directory:\")} ${result.directory}`);\n if (result.account) console.log(` ${colors.dim(\"Account:\")} ${result.account}`);\n if (result.domain) console.log(` ${colors.dim(\"Domain:\")} ${result.domain}`);\n if (result.overrides && result.overrides.length > 0)\n console.log(` ${colors.dim(\"Overrides:\")} ${result.overrides.join(\", \")}`);\n if (result.plugins && result.plugins.length > 0)\n console.log(` ${colors.dim(\"Plugins:\")} ${result.plugins.join(\", \")}`);\n console.log(` ${colors.dim(\"Files copied:\")} ${result.filesCopied}`);\n printTimingSummary(result.timings);\n console.log();\n console.log(colors.dim(\" Next steps:\"));\n console.log(colors.dim(` cd ${result.directory}`));\n if (!initInput.noInstall) {\n console.log(colors.dim(\" pnpm run dev\"));\n } else {\n console.log(colors.dim(\" pnpm install\"));\n console.log(colors.dim(\" pnpm run dev\"));\n }\n console.log();\n\n if (initInput.noInteractive !== true && !initInput.noInstall && result.targetDir) {\n const shouldStartDocker = await p.confirm({\n message: \"Run docker compose up -d --wait?\",\n initialValue: true,\n });\n\n if (shouldStartDocker === true) {\n const dockerSpinner = p.spinner();\n dockerSpinner.start(\"Starting Docker services\");\n const compose = await runDockerComposeUp(result.targetDir);\n if (compose.ok) {\n dockerSpinner.stop(\"Docker services ready\");\n } else {\n dockerSpinner.stop(\"Docker services not started\");\n p.log.warn(\n `docker compose up -d --wait failed${compose.tail ? `:\\n${compose.tail}` : \"\"}`,\n );\n }\n }\n }\n\n return;\n }\n\n const result = await (client as any)[descriptor.key](input);\n\n if (descriptor.key === \"dbStudio\") {\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n\n return;\n }\n\n if (descriptor.key === \"dbDoctor\") {\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Diagnosis failed\"}`);\n process.exit(1);\n }\n\n const statusIcon = (() => {\n switch (result.diagnosis) {\n case \"healthy\":\n return \"✓\";\n case \"empty\":\n return \"○\";\n case \"unapplied\":\n return \"○\";\n case \"untracked-existing-schema\":\n return \"○\";\n case \"drift-safe-repair\":\n return \"⚠\";\n case \"drift-manual\":\n return \"✗\";\n default:\n return \"?\";\n }\n })();\n\n console.log(`\\n${statusIcon} ${result.plugin}`);\n console.log(` ${colors.dim(`Journal:`)} ${result.journalSchema}.${result.journalTable}`);\n console.log(` ${colors.dim(`Local migrations:`)} ${result.localMigrationCount}`);\n console.log(` ${colors.dim(`Applied hashes:`)} ${result.appliedHashCount}`);\n if (result.expectedTables.length > 0) {\n console.log(` ${colors.dim(`Expected tables:`)} ${result.expectedTables.join(\", \")}`);\n }\n if (result.missingTables.length > 0) {\n console.log(` ${colors.yellow(`Missing tables:`)} ${result.missingTables.join(\", \")}`);\n }\n console.log(` ${colors.dim(`Diagnosis:`)} ${result.diagnosis}`);\n if (result.workspaceDir) {\n console.log(` ${colors.dim(`Workspace:`)} ${result.workspaceDir}`);\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"dbRepair\") {\n if (result.status === \"refused\") {\n console.log(\n `\\n${colors.yellow(\"!\")} Repair refused for ${result.diagnosis?.plugin ?? result.message}`,\n );\n console.log(` ${result.message}`);\n console.log();\n process.exit(0);\n }\n\n if (result.status === \"error\") {\n console.error(`\\n${colors.error(\"✗\")} Repair failed`);\n console.error(` ${result.message}`);\n console.error();\n process.exit(1);\n }\n\n console.log(`\\n${colors.green(\"✓\")} Repair complete`);\n console.log(` ${result.message}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"config\") {\n if (!result.config) {\n console.error(MISSING_CONFIG_MESSAGE);\n process.exit(1);\n }\n\n printConfigView(result.config);\n process.stdout.write(`${JSON.stringify(result.config, null, 2)}\\n`);\n return;\n }\n\n if (descriptor.key === \"sync\") {\n if ((input as any).json) {\n console.log(JSON.stringify(result, null, 2));\n return;\n }\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (result.status === \"dry-run\") {\n console.log(colors.cyan(`${icons.ok} Dry run — no files written`));\n } else {\n console.log(colors.green(`${icons.ok} Synced`));\n }\n const hasRetirement =\n (result.retired?.length ?? 0) > 0 || (result.retiredConflicted?.length ?? 0) > 0;\n if (\n result.updated.length > 0 ||\n result.added.length > 0 ||\n result.conflicted.length > 0 ||\n hasRetirement\n ) {\n console.log(\n ` ${colors.dim(\"Sync results:\")} ${result.updated.length} updated, ${result.added.length} added, ${result.conflicted.length} conflicted`,\n );\n if (result.updated.length > 0) {\n for (const f of result.updated) console.log(` ${colors.dim(f)}`);\n }\n if (result.added.length > 0) {\n for (const f of result.added) console.log(` ${colors.dim(f)}`);\n }\n if (result.conflicted.length > 0) {\n console.log(\n ` ${colors.yellow(\"Conflicted\")} (template applied, your changes backed up):`,\n );\n if (result.backupDir) console.log(` ${colors.dim(result.backupDir)}`);\n for (const f of result.conflicted) console.log(` ${colors.dim(f)}`);\n }\n if (hasRetirement) {\n console.log(` ${colors.yellow(\"Retired\")} (replaced by generated stubs — ADR 0023):`);\n if (result.retiredBackupDir) console.log(` ${colors.dim(result.retiredBackupDir)}`);\n for (const f of result.retiredConflicted ?? []) {\n console.log(` ${colors.dim(`${f} (backed up)`)}`);\n }\n for (const f of result.retired ?? []) console.log(` ${colors.dim(f)}`);\n printStubMigrationGuide(result.retiredConflicted);\n }\n }\n if (\n result.updated.length === 0 &&\n result.added.length === 0 &&\n result.conflicted.length === 0 &&\n !hasRetirement\n ) {\n console.log(` ${colors.dim(\"Already up to date\")}`);\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"upgrade\") {\n if ((input as any).json) {\n console.log(JSON.stringify(result, null, 2));\n return;\n }\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (result.status === \"dry-run\") {\n console.log(colors.cyan(`${icons.ok} Dry run — no changes applied`));\n } else {\n console.log(colors.green(`${icons.ok} Upgrade complete`));\n }\n const mainPkg = result.packages.find(\n (p: { name: string; from?: string; to: string }) => p.name === \"everything-dev\",\n );\n const versionDelta =\n mainPkg?.from && mainPkg.from !== mainPkg.to ? `${mainPkg.from} → ${mainPkg.to}` : null;\n if (versionDelta) {\n console.log(` ${colors.dim(`Upgraded everything-dev ${versionDelta}`)}`);\n }\n for (const pkg of result.packages) {\n if (pkg.name === \"everything-dev\") continue;\n if (pkg.from && pkg.from !== pkg.to) {\n console.log(` ${colors.dim(`${pkg.name} ${pkg.from} → ${pkg.to}`)}`);\n } else if (!pkg.from) {\n console.log(` ${colors.dim(`${pkg.name} ${pkg.to} (new)`)}`);\n } else {\n console.log(` ${colors.dim(`${pkg.name} ${pkg.to} (up to date)`)}`);\n }\n }\n if (result.changelogUrl) {\n console.log(` Changelog: ${result.changelogUrl}`);\n }\n if (result.selectedPlugins && result.selectedPlugins.length > 0) {\n console.log(` Added plugins: ${result.selectedPlugins.join(\", \")}`);\n }\n if (result.sync) {\n const sync = result.sync;\n const hasRetirement =\n (sync.retired?.length ?? 0) > 0 || (sync.retiredConflicted?.length ?? 0) > 0;\n console.log(` ${colors.dim(\"Sync results:\")}`);\n if (\n sync.updated.length > 0 ||\n sync.added.length > 0 ||\n sync.conflicted.length > 0 ||\n hasRetirement\n ) {\n console.log(\n ` ${sync.updated.length} updated, ${sync.added.length} added, ${sync.conflicted.length} conflicted`,\n );\n if (sync.conflicted.length > 0) {\n console.log(\n ` ${colors.yellow(\"Conflicted\")} (template applied, your changes backed up):`,\n );\n if (sync.backupDir) console.log(` ${colors.dim(sync.backupDir)}`);\n for (const f of sync.conflicted) console.log(` ${colors.dim(f)}`);\n }\n if (hasRetirement) {\n console.log(` ${colors.yellow(\"Retired\")} (replaced by generated stubs — ADR 0023):`);\n if (sync.retiredBackupDir) console.log(` ${colors.dim(sync.retiredBackupDir)}`);\n for (const f of sync.retiredConflicted ?? []) {\n console.log(` ${colors.dim(`${f} (backed up)`)}`);\n }\n for (const f of sync.retired ?? []) console.log(` ${colors.dim(f)}`);\n printStubMigrationGuide(sync.retiredConflicted);\n }\n } else {\n console.log(` ${colors.dim(\"Already up to date\")}`);\n }\n }\n if (result.migrated && result.migrated.length > 0) {\n console.log(` Migrated: ${result.migrated.length} file(s)`);\n for (const f of result.migrated) console.log(` ${colors.dim(f)}`);\n }\n if (versionDelta || (result.sync && result.sync.conflicted.length > 0)) {\n console.log();\n console.log(colors.dim(\" For AI agents:\"));\n const parentRepo = \"nearbuilders/everything-dev\";\n const somedelta =\n mainPkg?.from && mainPkg.to\n ? `v${mainPkg.from.replace(/^[\\^~>=v]+/, \"\")}...v${mainPkg.to.replace(/^[\\^~>=v]+/, \"\")}`\n : \"\";\n console.log(\n colors.dim(\n ` This upgrade applied template changes${somedelta ? ` (${somedelta})` : \"\"}.`,\n ),\n );\n if (result.sync && result.sync.conflicted.length > 0) {\n console.log(\n colors.dim(\n ` ${result.sync.conflicted.length} file(s) had local conflicts — template version applied, backups at ${result.sync.backupDir || \".bos/sync-backup/\"}.`,\n ),\n );\n console.log(\n colors.dim(\n ` If local changes should be preserved upstream, open a PR: https://github.com/${parentRepo}${somedelta ? `/compare/${somedelta}` : \"\"}`,\n ),\n );\n }\n console.log(\n colors.dim(\n \" Load matching intent skills: pnpm dlx @tanstack/intent@latest load everything-dev#...\",\n ),\n );\n console.log(colors.dim(\" Review AGENTS.md — local updates may need merging.\"));\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"status\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"STATUS\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n if (result.extends) console.log(` ${colors.dim(\"Extends:\")} ${result.extends}`);\n if (result.account) console.log(` ${colors.dim(\"Account:\")} ${result.account}`);\n if (result.domain) console.log(` ${colors.dim(\"Domain:\")} ${result.domain}`);\n console.log();\n console.log(` ${colors.dim(\"Packages:\")}`);\n for (const pkg of result.packages) {\n const hasUpdate =\n pkg.installed && pkg.latest && compareSemver(pkg.installed, pkg.latest) < 0;\n const versionStr = hasUpdate\n ? `${pkg.installed} → ${pkg.latest}`\n : pkg.installed || \"not installed\";\n const label = hasUpdate ? colors.yellow(versionStr) : colors.dim(versionStr);\n console.log(` ${colors.dim(`${pkg.name}`)} ${label}`);\n }\n console.log();\n if (result.lastSync) {\n const ago = formatTimeAgo(result.lastSync);\n console.log(` ${colors.dim(\"Last sync:\")} ${ago}`);\n } else {\n console.log(` ${colors.dim(\"Last sync:\")} never`);\n }\n const envLabel =\n result.envFile === \"found\"\n ? colors.green(\"found\")\n : result.envFile === \"example-only\"\n ? colors.yellow(\"missing (only .env.example found)\")\n : colors.error(\"missing\");\n console.log(` ${colors.dim(\".env:\")} ${envLabel}`);\n if (result.parentReachable !== undefined) {\n const parentLabel = result.parentReachable\n ? colors.green(\"reachable\")\n : colors.error(\"unreachable\");\n console.log(` ${colors.dim(\"Parent:\")} ${parentLabel}`);\n }\n const hasUpdates = result.packages.some(\n (p: { installed?: string; latest?: string }) =>\n p.installed && p.latest && compareSemver(p.installed, p.latest) < 0,\n );\n if (hasUpdates) {\n console.log();\n console.log(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"ps\") {\n const psResult = result as PsResult;\n console.log();\n if (psResult.status === \"error\") {\n console.error(`[CLI] ${psResult.error || \"Unknown error\"}`);\n process.exit(1);\n }\n const entries = psResult.entries ?? [];\n if (entries.length === 0) {\n console.log(colors.dim(\" No tracked development processes running.\"));\n console.log();\n console.log(\n colors.dim(` Start one with ${colors.cyan(\"bos dev\")} and it will appear here.`),\n );\n console.log();\n return;\n }\n console.log(colors.cyan(frames.top(60)));\n console.log(` ${icons.app} ${gradients.cyber(\"PROCESSES\")}`);\n console.log(colors.cyan(frames.bottom(60)));\n console.log();\n for (const entry of entries) {\n const ageMs = Date.now() - entry.startedAt;\n const ageStr =\n ageMs < 60_000\n ? `${Math.floor(ageMs / 1000)}s`\n : ageMs < 3_600_000\n ? `${Math.floor(ageMs / 60_000)}m`\n : `${Math.floor(ageMs / 3_600_000)}h`;\n const roleTag =\n entry.role === \"workspace-parent\"\n ? colors.magenta(\"parent\")\n : entry.role === \"workspace-child\"\n ? colors.blue(\"child\")\n : colors.dim(\"dev\");\n console.log(` ${colors.green(`pid ${entry.pid}`)} ${roleTag} ${colors.dim(ageStr)}`);\n console.log(` ${colors.dim(\"dir:\")} ${entry.configDir}`);\n if (entry.parentPid !== undefined) {\n console.log(` ${colors.dim(\"parent:\")} ${entry.parentPid}`);\n }\n const portPairs = Object.entries(entry.ports ?? {})\n .filter(([, p]) => typeof p === \"number\")\n .map(([k, v]) => `${k}=${v}`);\n if (portPairs.length > 0) {\n console.log(` ${colors.dim(\"ports:\")} ${portPairs.join(\" \")}`);\n }\n if (entry.budget) {\n console.log(` ${colors.dim(\"budget:\")} [${entry.budget.min}, ${entry.budget.max}]`);\n }\n console.log(` ${colors.dim(\"desc:\")} ${entry.description}`);\n console.log();\n }\n return;\n }\n\n if (descriptor.key === \"logs\") {\n const logsResult = result as LogsResult;\n const opts = input as LogsOptions;\n for (const line of logsResult.lines) {\n console.log(line);\n }\n if (logsResult.lines.length === 0) {\n console.log(colors.dim(` No matching log lines in ${logsResult.logFile}.`));\n }\n if (opts.follow) {\n if (logsResult.logFile === \"unknown\" || !existsSync(logsResult.logFile)) {\n console.log(colors.dim(\" No log file to follow — nothing was found on disk.\"));\n } else {\n const filter = opts.service;\n let byteOffset = 0;\n for (const line of logsResult.lines) byteOffset += Buffer.byteLength(line, \"utf8\") + 1;\n const followMatch = (line: string): boolean => {\n if (!filter) return true;\n const source = /\\] \\[([^\\]]+)\\] \\[(?:OUT|ERR)\\] /.exec(line)?.[1];\n return source === filter || source === `plugin:${filter}`;\n };\n const watcher = watch(logsResult.logFile, (event) => {\n if (event !== \"change\") return;\n void readFile(logsResult.logFile, \"utf8\")\n .then((text) => {\n const newLines = text\n .slice(byteOffset)\n .split(\"\\n\")\n .filter((line) => line.length > 0 && followMatch(line));\n byteOffset = Buffer.byteLength(text, \"utf8\");\n for (const line of newLines) {\n console.log(line);\n }\n })\n .catch(() => {\n // the followed file was rotated or deleted — stop following\n watcher.close();\n });\n });\n console.log(colors.dim(\" Following — Ctrl+C to stop.\"));\n process.on(\"SIGINT\", () => {\n watcher.close();\n process.exit(0);\n });\n }\n }\n return;\n }\n\n if (descriptor.key === \"kill\") {\n const killResult = result as KillResult;\n console.log();\n if (killResult.status === \"error\") {\n console.error(`[CLI] ${killResult.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (killResult.killed.length > 0) {\n console.log(colors.green(`${icons.ok} Sent ${killResult.killed.length} kill signal(s)`));\n for (const k of killResult.killed) {\n console.log(` ${colors.dim(\"pid\")} ${k.pid} ${colors.dim(k.configDir)}`);\n }\n }\n if (killResult.skipped.length > 0) {\n console.log(colors.yellow(`${icons.err} ${killResult.skipped.length} skipped`));\n for (const s of killResult.skipped) {\n console.log(` ${colors.dim(\"pid\")} ${s.pid} ${colors.dim(s.reason)}`);\n }\n }\n if (killResult.killed.length === 0 && killResult.skipped.length === 0) {\n const opts = input as KillOptions;\n if (opts.all) {\n console.log(colors.dim(\" No tracked processes to kill.\"));\n } else {\n const configPath = findConfigPath();\n const dir = opts.configDir ?? (configPath ? resolve(dirname(configPath)) : process.cwd());\n console.log(colors.dim(` No tracked processes for ${dir}`));\n console.log(colors.dim(` Use ${colors.cyan(\"--all\")} to kill across all directories.`));\n }\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"typesGen\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.green(`${icons.ok} Types generated`));\n if (result.generated.length > 0) {\n console.log(` ${colors.dim(\"Written:\")}`);\n for (const f of result.generated) console.log(` ${colors.dim(f)}`);\n }\n if (result.fetched.length > 0 || result.skipped.length > 0 || result.failed.length > 0) {\n console.log(` ${colors.dim(\"Contract sources:\")}`);\n for (const entry of result.fetched) {\n const space = entry.indexOf(\" \");\n const key = space !== -1 ? entry.slice(0, space) : entry;\n const rest = space !== -1 ? entry.slice(space + 1) : \"\";\n const restSpace = rest.indexOf(\" \");\n const detail = restSpace !== -1 ? rest.slice(restSpace + 1) : \"\";\n console.log(\n ` ${key} ${colors.cyan(\"remote\")}${detail ? ` ${colors.dim(detail)}` : \"\"}`,\n );\n }\n for (const entry of result.skipped) {\n const space = entry.indexOf(\" \");\n const key = space !== -1 ? entry.slice(0, space) : entry;\n const rest = space !== -1 ? entry.slice(space + 1) : \"\";\n if (rest === \"no URL resolved\") {\n console.log(` ${key} ${colors.dim(\"no URL resolved\")}`);\n continue;\n }\n const restSpace = rest.indexOf(\" \");\n const detail = restSpace !== -1 ? rest.slice(restSpace + 1) : \"\";\n console.log(` ${key} ${colors.dim(\"local\")}${detail ? ` ${colors.dim(detail)}` : \"\"}`);\n }\n }\n if (result.failed.length > 0) {\n console.log(` ${colors.yellow(\"Failed:\")}`);\n for (const f of result.failed) {\n const colon = f.indexOf(\": \");\n if (colon !== -1) {\n console.log(` ${colors.error(f.slice(0, colon))}${colors.dim(f.slice(colon))}`);\n } else {\n console.log(` ${colors.error(f)}`);\n }\n }\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"typecheck\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n const failed = result.results.filter((r: TypecheckWorkspaceResult) => !r.passed);\n const passed = result.results.filter((r: TypecheckWorkspaceResult) => r.passed);\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"TYPECHECK\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n for (const r of result.results) {\n const icon = r.passed ? colors.green(\"✓\") : colors.error(\"✗\");\n console.log(` ${icon} ${r.workspace}`);\n }\n if (result.skipped.length > 0) {\n console.log(` ${colors.dim(`Skipped: ${result.skipped.join(\", \")}`)}`);\n }\n console.log();\n if (failed.length > 0) {\n console.log(` ${colors.error(`${failed.length} failed`)}`);\n for (const f of failed) {\n if (f.error) console.log(` ${colors.dim(f.error)}`);\n }\n console.log();\n process.exit(1);\n }\n console.log(` ${colors.green(`${passed.length} passed`)}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"mfCheck\") {\n console.log();\n console.log(\n ` ${colors.dim(\"Host\")} ${result.hostReachable ? colors.green(\"OK \") : colors.error(\"FAIL\")} ${\n result.hostVersion ?? \"unreachable\"\n }${result.hostReason ? ` (${result.hostReason})` : \"\"}`,\n );\n for (const r of result.remotes) {\n const tag = r.ok ? colors.green(\"OK \") : colors.error(\"FAIL\");\n console.log(\n ` ${colors.dim(r.role.padEnd(10))} ${tag} ${r.url} pluginVersion=${r.pluginVersion ?? \"?\"}${\n r.reason ? ` ↳ ${r.reason}` : \"\"\n }`,\n );\n }\n console.log();\n if (result.status !== \"ok\") {\n console.log(\n colors.error(\n \" mf-compat: ✗ federation manifests NOT compatible — redeploy affected plugin(s) so pluginVersion and shared versions match host\",\n ),\n );\n console.log();\n process.exit(1);\n }\n console.log(colors.green(\" mf-compat: ✓ all federation manifests compatible\"));\n console.log();\n return;\n }\n\n if (result?.status === \"error\" && descriptor.key !== \"publish\" && descriptor.key !== \"deploy\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n\n if (descriptor.key === \"login\") {\n console.log();\n console.log(colors.green(`${icons.ok} Logged in to ${result.siteUrl}`));\n if (result.accountId) console.log(` ${colors.dim(\"Account:\")} ${result.accountId}`);\n if (result.expiresAt) console.log(` ${colors.dim(\"Expires:\")} ${result.expiresAt}`);\n if (result.warning) console.log(` ${colors.yellow(\"⚠\")} ${result.warning}`);\n if (result.publishKey) {\n console.log(\n ` ${colors.dim(\"Publish key:\")} ${result.publishKey.publicKey} ${colors.dim(\n `(${result.publishKey.network}, exported to ${result.publishKey.exportedTo})`,\n )}`,\n );\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"logout\") {\n console.log();\n console.log(colors.green(`${icons.ok} Logged out`));\n if (result.revokedApiKey) console.log(` ${colors.dim(\"Revoked API key\")}`);\n if (result.removedPublishKey) console.log(` ${colors.dim(\"Removed exported publish key\")}`);\n if (result.warning) console.log(` ${colors.yellow(\"⚠\")} ${result.warning}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"keyPublish\") {\n process.stdout.write(`Generated publish key for ${result.account}\\n`);\n process.stdout.write(` Network: ${result.network}\\n`);\n process.stdout.write(` Allowance: ${result.allowance}\\n`);\n process.stdout.write(`\\n`);\n const secretName = result.env === \"staging\" ? \"NEAR_TESTNET_PRIVATE_KEY\" : \"NEAR_PRIVATE_KEY\";\n if (!process.stdout.isTTY) {\n process.stderr.write(\n ` ⚠ Non-interactive stdout: this private key will be captured in any log or pipe (GitHub Actions logs persist stdout).\\n`,\n );\n }\n process.stdout.write(\n ` Set this as ${secretName} in GitHub Actions or before calling publish:\\n`,\n );\n process.stdout.write(`${secretName}=${result.privateKey}\\n`);\n }\n\n if (descriptor.key === \"pluginAdd\") {\n console.log();\n console.log(colors.green(`${icons.ok} Added plugin ${result.key}`));\n if (result.development) console.log(` ${colors.dim(\"Development:\")} ${result.development}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginRemove\") {\n console.log();\n console.log(colors.green(`${icons.ok} Removed plugin ${result.key}`));\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginList\") {\n console.log();\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.config} ${gradients.cyber(\"PLUGINS\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n if (result.plugins.length === 0) {\n console.log(colors.dim(\" No plugins configured\"));\n } else {\n for (const pluginItem of result.plugins) {\n console.log(` ${colors.cyan(pluginItem.key)}`);\n if (pluginItem.development)\n console.log(` ${colors.dim(\"Development:\")} ${pluginItem.development}`);\n if (pluginItem.production)\n console.log(` ${colors.dim(\"Production:\")} ${pluginItem.production}`);\n }\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginPublish\") {\n console.log();\n console.log(colors.green(`${icons.ok} Published plugin ${result.key}`));\n if (result.path) console.log(` ${colors.dim(\"Path:\")} ${result.path}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\n if (result.version) console.log(` ${colors.dim(\"Version:\")} ${result.version}`);\n if (result.fingerprint) console.log(` ${colors.dim(\"Fingerprint:\")} ${result.fingerprint}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"registryUse\") {\n console.log();\n if (result.status === \"error\") {\n console.error(colors.error(`${icons.err} ${result.error || \"Unknown error\"}`));\n process.exit(1);\n }\n console.log(\n colors.green(\n `${icons.ok} ${result.status === \"dry-run\" ? \"Dry run\" : \"Composed\"} from ${result.from}`,\n ),\n );\n for (const section of result.applied) {\n console.log(` ${colors.green(\"+\")} ${section}`);\n }\n if (result.configPath) {\n console.log(` ${colors.dim(\"Config:\")} ${result.configPath}`);\n }\n if (result.status === \"updated\") {\n console.log(colors.dim(\" Run bos types gen to refresh generated types.\"));\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"publish\") {\n if (result.status === \"dry-run\") {\n console.log();\n console.log(colors.cyan(`${icons.ok} Dry run complete`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${result.registryUrl}`);\n console.log();\n return;\n }\n\n if (result.status === \"error\") {\n console.log();\n console.log(colors.error(`${icons.err} Publish failed`));\n if (result.error) {\n console.log(` ${colors.dim(\"Error:\")} ${result.error}`);\n }\n if (result.deployResults && result.deployResults.length > 0) {\n const failures = result.deployResults.filter((r: any) => !r.success);\n if (failures.length > 0) {\n console.log();\n for (const f of failures) {\n const errorLine = (f.error ?? \"Failed\").split(\"\\n\")[0];\n console.log(` ${colors.error(icons.err)} ${f.key}: ${errorLine}`);\n }\n }\n }\n console.log();\n process.exit(1);\n }\n\n if (result.status === \"published\") {\n console.log();\n console.log(colors.green(`${icons.ok} Published successfully`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${result.registryUrl}`);\n if (result.txHash) {\n console.log(` ${colors.dim(\"Transaction:\")} ${result.txHash}`);\n }\n if (result.built && result.built.length > 0) {\n console.log(` ${colors.dim(\"Built:\")} ${result.built.join(\", \")}`);\n }\n if (result.skipped && result.skipped.length > 0) {\n console.log(` ${colors.dim(\"Skipped:\")} ${result.skipped.join(\", \")}`);\n }\n if (result.deployResults) {\n const warnings = result.deployResults.flatMap((r: any) => r.warnings ?? []);\n if (warnings.length > 0) {\n console.log();\n console.log(` ${colors.yellow(\"⚠\")} Build warnings:`);\n for (const w of warnings) {\n console.log(` ${colors.dim(w)}`);\n }\n }\n }\n console.log();\n return;\n }\n }\n\n if (descriptor.key === \"rollback\") {\n const rollbackResult = result as any;\n if (rollbackResult.status === \"error\") {\n console.log();\n console.log(colors.error(`${icons.err} Roll back failed`));\n if (rollbackResult.error) {\n console.log(` ${colors.dim(\"Error:\")} ${rollbackResult.error}`);\n }\n if (rollbackResult.verification) {\n console.log();\n for (const check of rollbackResult.verification) {\n const mark = check.ok ? colors.green(icons.ok) : colors.error(icons.err);\n const reason = check.reason ? colors.dim(` — ${check.reason}`) : \"\";\n console.log(` ${mark} ${check.slot}${reason}`);\n }\n }\n console.log();\n process.exit(1);\n }\n\n if (rollbackResult.status === \"dry-run\") {\n console.log();\n console.log(colors.cyan(`${icons.ok} Rollback dry run complete`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${rollbackResult.registryUrl}`);\n console.log();\n return;\n }\n\n console.log();\n console.log(colors.green(`${icons.ok} Rolled back`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${rollbackResult.registryUrl}`);\n if (rollbackResult.txHash) {\n console.log(` ${colors.dim(\"Transaction:\")} ${rollbackResult.txHash}`);\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"deploy\") {\n const deployResult = result as any;\n if (deployResult.status === \"list\") {\n console.log();\n console.log(colors.cyan(\"Recent publishes (audit trail)\"));\n for (const entry of deployResult.history ?? []) {\n console.log(\n ` ${entry.blockTimestamp} ${colors.dim(`block ${entry.blockHeight}`)}${entry.publishedAt ? colors.dim(` ${entry.publishedAt}`) : \"\"}`,\n );\n }\n console.log();\n return;\n }\n if (deployResult.fingerprint) {\n console.log(` ${colors.dim(\"Fingerprint:\")} ${deployResult.fingerprint}`);\n }\n if (deployResult.status === \"dry-run\") {\n console.log();\n console.log(colors.cyan(`${icons.ok} Dry run complete`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${deployResult.registryUrl}`);\n console.log();\n return;\n }\n\n if (deployResult.status === \"error\") {\n console.log();\n console.log(colors.error(`${icons.err} Deploy failed`));\n if (deployResult.error) {\n console.log(` ${colors.dim(\"Error:\")} ${deployResult.error}`);\n }\n if (deployResult.deployResults && deployResult.deployResults.length > 0) {\n const failures = deployResult.deployResults.filter((r: any) => !r.success);\n if (failures.length > 0) {\n console.log();\n for (const f of failures) {\n const errorLine = (f.error ?? \"Failed\").split(\"\\n\")[0];\n console.log(` ${colors.error(icons.err)} ${f.key}: ${errorLine}`);\n }\n }\n }\n console.log();\n process.exit(1);\n }\n\n if (deployResult.status === \"deployed\") {\n console.log();\n console.log(colors.green(`${icons.ok} Deployed successfully`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${deployResult.registryUrl}`);\n if (deployResult.txHash) {\n console.log(` ${colors.dim(\"Transaction:\")} ${deployResult.txHash}`);\n }\n if (deployResult.built && deployResult.built.length > 0) {\n console.log(` ${colors.dim(\"Built:\")} ${deployResult.built.join(\", \")}`);\n }\n if (deployResult.skipped && deployResult.skipped.length > 0) {\n console.log(` ${colors.dim(\"Skipped:\")} ${deployResult.skipped.join(\", \")}`);\n }\n if (deployResult.deployResults) {\n const warnings = deployResult.deployResults.flatMap((r: any) => r.warnings ?? []);\n if (warnings.length > 0) {\n console.log();\n console.log(` ${colors.yellow(\"⚠\")} Build warnings:`);\n for (const w of warnings) {\n console.log(` ${colors.dim(w)}`);\n }\n }\n }\n if (deployResult.image) {\n console.log(` ${colors.dim(\"Image:\")} ${deployResult.image}`);\n }\n if (deployResult.service) {\n console.log(` ${colors.dim(\"Railway:\")} deployed ${deployResult.service}`);\n }\n console.log();\n return;\n }\n\n if (deployResult.status === \"published\") {\n console.log();\n console.log(colors.yellow(`${icons.err} Config published, but a deploy leg failed`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${deployResult.registryUrl}`);\n if (deployResult.txHash) {\n console.log(` ${colors.dim(\"Transaction:\")} ${deployResult.txHash}`);\n }\n if (deployResult.error) {\n console.log(` ${colors.dim(\"Error:\")} ${deployResult.error}`);\n }\n console.log();\n process.exit(1);\n }\n }\n\n if (descriptor.key === \"infraExport\") {\n process.stdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n return;\n }\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n}\n\nvoid main().catch((error) => {\n console.error(\"[CLI] Fatal error:\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAS,gBAAgB,QAStB;CACD,QAAQ,IAAI;CACZ,QAAQ,IAAI,OAAO,KAAK,OAAO,IAAI,EAAE,CAAC,CAAC;CACvC,QAAQ,IAAI,KAAK,MAAM,IAAI,GAAG,UAAU,MAAM,QAAQ,GAAG;CACzD,QAAQ,IAAI,OAAO,KAAK,OAAO,OAAO,EAAE,CAAC,CAAC;CAC1C,QAAQ,IAAI;CAEZ,QAAQ,IAAI,KAAK,OAAO,IAAI,SAAS,EAAE,IAAI,OAAO,KAAK,OAAO,OAAO,GAAG;CACxE,QAAQ,IAAI,KAAK,OAAO,IAAI,QAAQ,EAAE,KAAK,OAAO,MAAM,OAAO,UAAU,gBAAgB,GAAG;CAC5F,IAAI,OAAO,SACT,QAAQ,IAAI,KAAK,OAAO,IAAI,SAAS,EAAE,IAAI,OAAO,QAAQ,OAAO,QAAQ,MAAM,GAAG;CAEpF,QAAQ,IAAI;AACd;AAEA,SAAS,cAAc,cAA8B;CAGnD,MAAM,SAFM,KAAK,IAEA,IADJ,IAAI,KAAK,YAAY,CAAC,CAAC,QACZ;CACxB,MAAM,WAAW,KAAK,MAAM,SAAS,GAAM;CAC3C,IAAI,WAAW,GAAG,OAAO;CACzB,IAAI,WAAW,IAAI,OAAO,GAAG,SAAS,SAAS,WAAW,IAAI,MA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ts"],"sourcesContent":["import { existsSync, watch } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { dirname, resolve } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport { findCommandDescriptor } from \"./cli/catalog\";\nimport { resolveFrameworkPackage } from \"./cli/framework-version\";\nimport { printHelp } from \"./cli/help\";\nimport { runDockerComposeUp } from \"./cli/init\";\nimport { parseCommandInput } from \"./cli/parse\";\nimport { promptInitBasic, promptInitOverrides } from \"./cli/prompts\";\nimport { compareSemver } from \"./cli/status\";\nimport { formatDuration, sumPhaseDurations } from \"./cli/timing\";\nimport { fetchInitParent } from \"./commands/init\";\nimport { findConfigPath, MISSING_CONFIG_MESSAGE, readAuthoredConfigInput } from \"./config\";\nimport type {\n DevOptions,\n DevResult,\n InitOptions,\n InitResult,\n KeyPublishOptions,\n KillOptions,\n KillResult,\n LogsOptions,\n LogsResult,\n OverrideSection,\n PsResult,\n StartOptions,\n StartResult,\n TypecheckWorkspaceResult,\n} from \"./contract\";\nimport type { StartSummary } from \"./dev-program\";\nimport { getRegistryNamespaceForAccount } from \"./fastkv\";\nimport { listPublishKeys } from \"./near-cli\";\nimport { getNetworkIdForAccount } from \"./network\";\nimport bosPlugin from \"./plugin\";\nimport { type ProgressEvent, pluginEvents } from \"./progress\";\nimport { installBundleFetchFromEnv } from \"./resolver\";\nimport { createPluginRuntime } from \"./sdk\";\nimport { printBanner } from \"./utils/banner\";\nimport { colors, frames, gradients, icons } from \"./utils/theme\";\n\nfunction printConfigView(result: {\n account: string;\n domain?: string;\n staging?: { domain: string };\n app?: {\n host: { name?: string; development: string; production?: string };\n ui: { name?: string; development?: string; production?: string; ssr?: string };\n api: { name?: string; development?: string; production?: string; proxy?: string };\n };\n}) {\n console.log();\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"CONFIG\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n\n console.log(` ${colors.dim(\"Account\")} ${colors.cyan(result.account)}`);\n console.log(` ${colors.dim(\"Domain\")} ${colors.white(result.domain ?? \"not configured\")}`);\n if (result.staging) {\n console.log(` ${colors.dim(\"Staging\")} ${colors.magenta(result.staging.domain)}`);\n }\n console.log();\n}\n\nfunction formatTimeAgo(isoTimestamp: string): string {\n const now = Date.now();\n const then = new Date(isoTimestamp).getTime();\n const diffMs = now - then;\n const diffMins = Math.floor(diffMs / 60_000);\n if (diffMins < 1) return \"just now\";\n if (diffMins < 60) return `${diffMins} minute${diffMins > 1 ? \"s\" : \"\"} ago`;\n const diffHours = Math.floor(diffMins / 60);\n if (diffHours < 24) return `${diffHours} hour${diffHours > 1 ? \"s\" : \"\"} ago`;\n const diffDays = Math.floor(diffHours / 24);\n if (diffDays < 30) return `${diffDays} day${diffDays > 1 ? \"s\" : \"\"} ago`;\n return isoTimestamp.split(\"T\")[0] ?? isoTimestamp;\n}\n\nconst RETIRED_BOOTSTRAP_STUBS = [\n \"ui/src/entry.ts\",\n \"ui/src/hydrate.tsx\",\n \"ui/src/router.server.tsx\",\n \"ui/src/compose.ts\",\n];\n\n/**\n * Hand-modified bootstrap stubs retire as conflicted (backed up, then\n * deleted) — print the mechanical port into the authored seams (ADR 0023).\n */\nfunction printStubMigrationGuide(retiredConflicted: string[] | undefined) {\n const handModified = (retiredConflicted ?? []).filter((f) => RETIRED_BOOTSTRAP_STUBS.includes(f));\n if (handModified.length === 0) return;\n console.log(` ${colors.yellow(\"Port your stub customizations into the authored seams:\")}`);\n console.log(\n ` ${colors.dim(\"- defaultErrorComponent / defaultPendingComponent / defaultNotFoundComponent\")}`,\n );\n console.log(\n ` ${colors.dim(\" → set them inside the createRouter factory in ui/src/router.tsx (after ...opts)\")}`,\n );\n console.log(\n ` ${colors.dim(\"- apiConnectionError copy + SSR locale config (locales, defaultLocale, cookieName)\")}`,\n );\n console.log(\n ` ${colors.dim(\" → export apiConnectionError / appLocale from ui/src/app.ts (see the scaffold template)\")}`,\n );\n console.log(` ${colors.dim(\" backed-up originals: .bos/sync-backup/<timestamp>/\")}`);\n}\n\nfunction printTimingSummary(timings: Array<{ name: string; durationMs: number }> | undefined) {\n if (!timings || timings.length === 0) return;\n\n console.log(` ${colors.dim(\"Timings:\")}`);\n for (const timing of timings) {\n console.log(` ${colors.dim(timing.name.padEnd(22))} ${formatDuration(timing.durationMs)}`);\n }\n console.log(\n ` ${colors.dim(\"total\".padEnd(22))} ${formatDuration(sumPhaseDurations(timings))}`,\n );\n}\n\nfunction printStartSummary(summary: StartSummary) {\n console.log();\n console.log(` ${colors.dim(\"Config Source:\")} ${summary.configSource}`);\n if (summary.configSourceHttp) {\n console.log(` ${colors.dim(summary.configSourceHttp)}`);\n }\n console.log(` ${colors.dim(\"Account:\")} ${summary.account}`);\n console.log(` ${colors.dim(\"Domain:\")} ${summary.domain ?? \"not configured\"}`);\n console.log();\n console.log(` ${colors.dim(\"Modules:\")}`);\n console.log(` ${colors.dim(\"HOST\")} → ${summary.modules.host ?? \"local\"}`);\n console.log(` ${colors.dim(\"UI\")} → ${summary.modules.ui ?? \"local\"}`);\n console.log(` ${colors.dim(\"API\")} → ${summary.modules.api ?? \"local\"}`);\n if (summary.modules.auth) {\n console.log(` ${colors.dim(\"AUTH\")} → ${summary.modules.auth}`);\n }\n if (summary.warnings.length > 0) {\n console.log();\n for (const w of summary.warnings) {\n console.log(` ${colors.yellow(w)}`);\n }\n }\n console.log();\n}\n\nfunction clearSpinnerStopLine() {\n if (!process.stdout.isTTY) return;\n process.stdout.write(\"\\u001B[1A\\u001B[2K\\u001B[1G\");\n}\n\nasync function warnIfOutdated(client: any, command: string): Promise<void> {\n if (![\"dev\", \"build\", \"start\"].includes(command)) return;\n\n try {\n const status = await client.status();\n if (status.status === \"error\" || !status.packages) return;\n\n const frameworkPackages = [\"everything-dev\", \"every-plugin\"];\n\n const linked = status.packages.filter((p: { isLinked?: boolean }) => p.isLinked);\n const outdated = status.packages.filter(\n (p: { name: string; installed?: string; latest?: string; isLinked?: boolean }) =>\n !p.isLinked &&\n p.installed &&\n p.latest &&\n compareSemver(p.installed, p.latest) < 0 &&\n frameworkPackages.includes(p.name),\n );\n\n if (linked.length > 0) {\n for (const pkg of linked) {\n console.log(colors.dim(` ${pkg.name} is linked locally (v${pkg.installed})`));\n }\n }\n\n if (outdated.length === 0) return;\n\n const warn = (line: string) => {\n if (command === \"dev\" || command === \"start\") process.stderr.write(`${line}\\n`);\n else console.log(line);\n };\n warn(\"\");\n warn(colors.yellow(` ! Outdated packages detected:`));\n for (const pkg of outdated) {\n warn(colors.dim(` ${pkg.name} ${pkg.installed} → ${pkg.latest}`));\n }\n warn(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n warn(\"\");\n } catch {\n // silently ignore if status check fails\n }\n}\n\nasync function main() {\n const args = process.argv.slice(2);\n\n if (args.includes(\"--help\") || args.includes(\"-h\")) {\n printHelp();\n return;\n }\n\n const invocationArgs = args.length > 0 ? args : [\"dev\"];\n const command = invocationArgs[0] ?? \"dev\";\n\n const commandMatch = findCommandDescriptor(invocationArgs);\n if (!commandMatch) {\n console.error(`Unknown command: ${command}`);\n process.exit(1);\n }\n\n const { descriptor, consumed } = commandMatch;\n const commandArgs = invocationArgs.slice(consumed);\n\n // Parse before the plugin boot: `start --config-path` steers the whole CLI,\n // not just the stack — the plugin initialize resolves and pin-validates the\n // boot config, so it must be the config the command will actually run.\n let parsedInput: unknown;\n try {\n parsedInput = parseCommandInput(descriptor, commandArgs);\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n const bootInput = parsedInput as { configPath?: string };\n\n const cwdConfigPath = findConfigPath();\n const configPath = bootInput.configPath ?? cwdConfigPath;\n installBundleFetchFromEnv({ configPath });\n\n const projectDir = cwdConfigPath ? dirname(cwdConfigPath) : undefined;\n const edResolved = projectDir ? resolveFrameworkPackage(projectDir, \"everything-dev\") : undefined;\n const displayVersion = edResolved?.installedVersion\n ? `${edResolved.installedVersion}${edResolved.isLinked ? \" (linked)\" : \"\"}`\n : undefined;\n if (!process.env.BOS_NO_BANNER) {\n printBanner(\"everything-dev\", displayVersion);\n }\n\n const runtime = createPluginRuntime({\n registry: {\n bos: { module: bosPlugin },\n },\n secrets: {},\n });\n\n const pluginRuntime: any = runtime;\n const loadPlugin = pluginRuntime.usePlugin.bind(pluginRuntime);\n const plugin = await loadPlugin(\"bos\", {\n variables: {\n configPath: configPath ?? undefined,\n configDir: cwdConfigPath ? dirname(cwdConfigPath) : undefined,\n },\n secrets: {},\n });\n\n const client = plugin.createClient();\n\n const outdatedWarning = warnIfOutdated(client, command);\n\n try {\n const input = parsedInput;\n\n const rollbackInput = input as {\n listOnly?: boolean;\n version?: string;\n previous?: boolean;\n [key: string]: unknown;\n };\n if (\n descriptor.key === \"rollback\" &&\n !rollbackInput.listOnly &&\n !rollbackInput.version &&\n !rollbackInput.previous\n ) {\n const listing = await (client as any).rollback({ ...rollbackInput, listOnly: true });\n if (listing.status !== \"list\" || !listing.history?.length) {\n console.error(listing.error ?? \"No publish history found\");\n process.exit(1);\n }\n console.log();\n const selection = await p.select({\n message: \"Roll back to which publish?\",\n options: listing.history.map(\n (entry: {\n blockHeight: number;\n blockTimestamp: string;\n txHash?: string;\n summary: string;\n }) => ({\n value: String(entry.blockHeight),\n label: `${entry.blockTimestamp} (block ${entry.blockHeight})`,\n hint: entry.summary,\n }),\n ),\n });\n if (p.isCancel(selection)) {\n return;\n }\n rollbackInput.version = selection as string;\n }\n\n if (descriptor.key === \"keyPublish\") {\n const keyPublishInput = input as KeyPublishOptions;\n if (keyPublishInput.removeOldKeys === undefined) {\n if (process.stdin.isTTY) {\n const authored = configPath ? await readAuthoredConfigInput(dirname(configPath)) : null;\n const account =\n keyPublishInput.env === \"staging\"\n ? (authored?.staging?.account ?? authored?.account)\n : authored?.account;\n let listed: string[] | null = null;\n if (account) {\n const network = getNetworkIdForAccount(account);\n const contract = getRegistryNamespaceForAccount(account, keyPublishInput.registry);\n try {\n listed = await listPublishKeys({ account, contract, network });\n } catch {\n listed = null;\n }\n }\n if (listed?.length) {\n const removeOldKeys = await p.confirm({\n message: `Remove ${listed.length} existing publish key${listed.length > 1 ? \"s\" : \"\"}?`,\n initialValue: true,\n });\n if (p.isCancel(removeOldKeys)) {\n return;\n }\n keyPublishInput.removeOldKeys = removeOldKeys;\n } else {\n keyPublishInput.removeOldKeys = true;\n }\n } else {\n keyPublishInput.removeOldKeys = true;\n }\n }\n }\n\n if (descriptor.key === \"dev\") {\n const devSpinner = p.spinner();\n devSpinner.start(\"Starting dev environment\");\n\n const devPhaseLabels: Record<string, string> = {\n \"shared deps\": \"Preparing config...\",\n install: \"Installing dependencies...\",\n build: \"Building...\",\n \"resolve config\": \"Resolving config...\",\n ports: \"Finding available ports...\",\n \"docker compose up\": \"Starting local Postgres...\",\n \"generate artifacts\": \"Generating code artifacts...\",\n };\n\n const onDevProgress = (event: ProgressEvent) => {\n const label = devPhaseLabels[event.phase] ?? event.phase;\n if (event.status === \"running\") {\n devSpinner.message(label);\n }\n };\n pluginEvents.on(\"progress\", onDevProgress);\n\n let result: DevResult;\n try {\n result = await client.dev(input as DevOptions);\n } finally {\n pluginEvents.off(\"progress\", onDevProgress);\n }\n\n if (result.status === \"error\") {\n devSpinner.stop(\"Failed\");\n console.error(`[CLI] ${result.description}`);\n process.exit(1);\n }\n\n devSpinner.stop();\n clearSpinnerStopLine();\n\n const session = result.session;\n void outdatedWarning;\n if (session) {\n const { devApp } = await import(\"./dev-session\");\n devApp(\n projectDir ?? process.cwd(),\n session.orchestrator,\n session.services,\n session.runtimeConfig,\n session.envGenerated,\n session.shellEnv,\n );\n }\n return;\n }\n\n if (descriptor.key === \"start\") {\n const startSpinner = p.spinner();\n startSpinner.start(\"Starting production environment\");\n\n const startPhaseLabels: Record<string, string> = {\n config: \"Preparing config...\",\n \"generate artifacts\": \"Generating code artifacts...\",\n };\n\n const onStartProgress = (event: ProgressEvent) => {\n const label = startPhaseLabels[event.phase] ?? event.phase;\n if (event.status === \"running\") {\n startSpinner.message(label);\n }\n };\n pluginEvents.on(\"progress\", onStartProgress);\n\n let result: StartResult;\n try {\n result = await client.start(input as StartOptions);\n } finally {\n pluginEvents.off(\"progress\", onStartProgress);\n }\n\n if (result.status === \"error\") {\n startSpinner.stop(\"Failed\");\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n\n startSpinner.stop(\"Ready\");\n\n const session = result.session;\n const summary = result.summary;\n void outdatedWarning;\n if (session) {\n if (summary) {\n printStartSummary(summary);\n }\n const { startApp } = await import(\"./dev-session\");\n startApp(\n projectDir ?? process.cwd(),\n session.orchestrator,\n session.services,\n session.runtimeConfig,\n session.envGenerated,\n session.shellEnv,\n );\n }\n return;\n }\n\n if (descriptor.key === \"init\") {\n let initInput: InitOptions = { ...(input as InitOptions) };\n\n if (!initInput.noInteractive) {\n const basic = await promptInitBasic({\n extends: initInput.extends,\n account: initInput.account,\n domain: initInput.domain,\n });\n\n let parentPluginKeys: string[] = [];\n let parentConfig: {\n title?: string;\n description?: string;\n plugins?: Record<string, unknown>;\n } | null = null;\n\n const fetchSpinner = p.spinner();\n fetchSpinner.start(\"Fetching parent config\");\n try {\n const parent = await fetchInitParent(basic.extendsAccount, basic.extendsGateway);\n parentConfig = parent.parentConfig;\n parentPluginKeys = parent.parentPluginKeys;\n } catch {\n fetchSpinner.stop(\"Config not found\");\n console.error(\n `[CLI] No config found at bos://${basic.extendsAccount}/${basic.extendsGateway}`,\n );\n process.exit(1);\n }\n fetchSpinner.stop(\"Config fetched\");\n\n if (\n typeof parentConfig?.title === \"string\" &&\n parentConfig.title.trim() &&\n typeof parentConfig?.description === \"string\" &&\n parentConfig.description.trim()\n ) {\n const shouldContinue = await p.confirm({\n message: `You will be extending ${parentConfig.title} - ${parentConfig.description}. Continue?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldContinue) || !shouldContinue) {\n process.exit(0);\n }\n }\n\n const overrides = await promptInitOverrides({\n parentPluginKeys,\n plugins: initInput.plugins,\n overrides: initInput.overrides as OverrideSection[] | undefined,\n level: initInput.level,\n });\n\n const directory = initInput.directory || basic.domain || basic.extendsGateway;\n\n initInput = {\n ...initInput,\n extends: `bos://${basic.extendsAccount}/${basic.extendsGateway}`,\n directory,\n account: basic.account,\n domain: basic.domain || undefined,\n plugins: overrides.plugins,\n overrides: overrides.overrides,\n level: overrides.level ?? initInput.level,\n noInteractive: true,\n };\n }\n\n const initSpinner = p.spinner();\n initSpinner.start(\"Initializing project\");\n\n const phaseLabels: Record<string, string> = {\n \"parent config\": \"Fetching parent config...\",\n \"template source\": \"Resolving template source...\",\n \"scaffold project\": \"Creating project scaffold...\",\n \"copy files\": \"Copying template files...\",\n \"personalize config\": \"Personalizing config...\",\n \"write snapshot\": \"Writing snapshot...\",\n \"resolve config\": \"Resolving config...\",\n \"generate env/docker\": \"Generating environment config...\",\n \"create env file\": \"Creating .env file...\",\n \"install dependencies\": \"Installing dependencies...\",\n \"generate types\": \"Generating types...\",\n \"generate migrations\": \"Generating database migrations...\",\n \"generate code artifacts\": \"Generating code artifacts...\",\n };\n\n const onProgress = (event: ProgressEvent) => {\n const label = phaseLabels[event.phase] ?? event.phase;\n if (event.status === \"running\") {\n initSpinner.message(label);\n }\n };\n pluginEvents.on(\"progress\", onProgress);\n\n let result: InitResult;\n try {\n result = await client.init(initInput);\n } finally {\n pluginEvents.off(\"progress\", onProgress);\n }\n\n if (result.status === \"error\") {\n initSpinner.stop(\"Failed\");\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n\n initSpinner.stop(\"Project initialized\");\n\n console.log(` ${colors.dim(\"Extends:\")} ${result.extends}`);\n console.log(` ${colors.dim(\"Directory:\")} ${result.directory}`);\n if (result.account) console.log(` ${colors.dim(\"Account:\")} ${result.account}`);\n if (result.domain) console.log(` ${colors.dim(\"Domain:\")} ${result.domain}`);\n if (result.overrides && result.overrides.length > 0)\n console.log(` ${colors.dim(\"Overrides:\")} ${result.overrides.join(\", \")}`);\n if (result.plugins && result.plugins.length > 0)\n console.log(` ${colors.dim(\"Plugins:\")} ${result.plugins.join(\", \")}`);\n console.log(` ${colors.dim(\"Files copied:\")} ${result.filesCopied}`);\n printTimingSummary(result.timings);\n console.log();\n console.log(colors.dim(\" Next steps:\"));\n console.log(colors.dim(` cd ${result.directory}`));\n if (!initInput.noInstall) {\n console.log(colors.dim(\" pnpm run dev\"));\n } else {\n console.log(colors.dim(\" pnpm install\"));\n console.log(colors.dim(\" pnpm run dev\"));\n }\n console.log();\n\n if (initInput.noInteractive !== true && !initInput.noInstall && result.targetDir) {\n const shouldStartDocker = await p.confirm({\n message: \"Run docker compose up -d --wait?\",\n initialValue: true,\n });\n\n if (shouldStartDocker === true) {\n const dockerSpinner = p.spinner();\n dockerSpinner.start(\"Starting Docker services\");\n const compose = await runDockerComposeUp(result.targetDir);\n if (compose.ok) {\n dockerSpinner.stop(\"Docker services ready\");\n } else {\n dockerSpinner.stop(\"Docker services not started\");\n p.log.warn(\n `docker compose up -d --wait failed${compose.tail ? `:\\n${compose.tail}` : \"\"}`,\n );\n }\n }\n }\n\n return;\n }\n\n const result = await (client as any)[descriptor.key](input);\n\n if (descriptor.key === \"dbStudio\") {\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n\n return;\n }\n\n if (descriptor.key === \"dbDoctor\") {\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Diagnosis failed\"}`);\n process.exit(1);\n }\n\n const statusIcon = (() => {\n switch (result.diagnosis) {\n case \"healthy\":\n return \"✓\";\n case \"empty\":\n return \"○\";\n case \"unapplied\":\n return \"○\";\n case \"untracked-existing-schema\":\n return \"○\";\n case \"drift-safe-repair\":\n return \"⚠\";\n case \"drift-manual\":\n return \"✗\";\n default:\n return \"?\";\n }\n })();\n\n console.log(`\\n${statusIcon} ${result.plugin}`);\n console.log(` ${colors.dim(`Journal:`)} ${result.journalSchema}.${result.journalTable}`);\n console.log(` ${colors.dim(`Local migrations:`)} ${result.localMigrationCount}`);\n console.log(` ${colors.dim(`Applied hashes:`)} ${result.appliedHashCount}`);\n if (result.expectedTables.length > 0) {\n console.log(` ${colors.dim(`Expected tables:`)} ${result.expectedTables.join(\", \")}`);\n }\n if (result.missingTables.length > 0) {\n console.log(` ${colors.yellow(`Missing tables:`)} ${result.missingTables.join(\", \")}`);\n }\n console.log(` ${colors.dim(`Diagnosis:`)} ${result.diagnosis}`);\n if (result.workspaceDir) {\n console.log(` ${colors.dim(`Workspace:`)} ${result.workspaceDir}`);\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"dbRepair\") {\n if (result.status === \"refused\") {\n console.log(\n `\\n${colors.yellow(\"!\")} Repair refused for ${result.diagnosis?.plugin ?? result.message}`,\n );\n console.log(` ${result.message}`);\n console.log();\n process.exit(0);\n }\n\n if (result.status === \"error\") {\n console.error(`\\n${colors.error(\"✗\")} Repair failed`);\n console.error(` ${result.message}`);\n console.error();\n process.exit(1);\n }\n\n console.log(`\\n${colors.green(\"✓\")} Repair complete`);\n console.log(` ${result.message}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"config\") {\n if (!result.config) {\n console.error(MISSING_CONFIG_MESSAGE);\n process.exit(1);\n }\n\n printConfigView(result.config);\n process.stdout.write(`${JSON.stringify(result.config, null, 2)}\\n`);\n return;\n }\n\n if (descriptor.key === \"sync\") {\n if ((input as any).json) {\n console.log(JSON.stringify(result, null, 2));\n return;\n }\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (result.status === \"dry-run\") {\n console.log(colors.cyan(`${icons.ok} Dry run — no files written`));\n } else {\n console.log(colors.green(`${icons.ok} Synced`));\n }\n const hasRetirement =\n (result.retired?.length ?? 0) > 0 || (result.retiredConflicted?.length ?? 0) > 0;\n if (\n result.updated.length > 0 ||\n result.added.length > 0 ||\n result.conflicted.length > 0 ||\n hasRetirement\n ) {\n console.log(\n ` ${colors.dim(\"Sync results:\")} ${result.updated.length} updated, ${result.added.length} added, ${result.conflicted.length} conflicted`,\n );\n if (result.updated.length > 0) {\n for (const f of result.updated) console.log(` ${colors.dim(f)}`);\n }\n if (result.added.length > 0) {\n for (const f of result.added) console.log(` ${colors.dim(f)}`);\n }\n if (result.conflicted.length > 0) {\n console.log(\n ` ${colors.yellow(\"Conflicted\")} (template applied, your changes backed up):`,\n );\n if (result.backupDir) console.log(` ${colors.dim(result.backupDir)}`);\n for (const f of result.conflicted) console.log(` ${colors.dim(f)}`);\n }\n if (hasRetirement) {\n console.log(` ${colors.yellow(\"Retired\")} (replaced by generated stubs — ADR 0023):`);\n if (result.retiredBackupDir) console.log(` ${colors.dim(result.retiredBackupDir)}`);\n for (const f of result.retiredConflicted ?? []) {\n console.log(` ${colors.dim(`${f} (backed up)`)}`);\n }\n for (const f of result.retired ?? []) console.log(` ${colors.dim(f)}`);\n printStubMigrationGuide(result.retiredConflicted);\n }\n }\n if (\n result.updated.length === 0 &&\n result.added.length === 0 &&\n result.conflicted.length === 0 &&\n !hasRetirement\n ) {\n console.log(` ${colors.dim(\"Already up to date\")}`);\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"upgrade\") {\n if ((input as any).json) {\n console.log(JSON.stringify(result, null, 2));\n return;\n }\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (result.status === \"dry-run\") {\n console.log(colors.cyan(`${icons.ok} Dry run — no changes applied`));\n } else {\n console.log(colors.green(`${icons.ok} Upgrade complete`));\n }\n const mainPkg = result.packages.find(\n (p: { name: string; from?: string; to: string }) => p.name === \"everything-dev\",\n );\n const versionDelta =\n mainPkg?.from && mainPkg.from !== mainPkg.to ? `${mainPkg.from} → ${mainPkg.to}` : null;\n if (versionDelta) {\n console.log(` ${colors.dim(`Upgraded everything-dev ${versionDelta}`)}`);\n }\n for (const pkg of result.packages) {\n if (pkg.name === \"everything-dev\") continue;\n if (pkg.from && pkg.from !== pkg.to) {\n console.log(` ${colors.dim(`${pkg.name} ${pkg.from} → ${pkg.to}`)}`);\n } else if (!pkg.from) {\n console.log(` ${colors.dim(`${pkg.name} ${pkg.to} (new)`)}`);\n } else {\n console.log(` ${colors.dim(`${pkg.name} ${pkg.to} (up to date)`)}`);\n }\n }\n if (result.changelogUrl) {\n console.log(` Changelog: ${result.changelogUrl}`);\n }\n if (result.selectedPlugins && result.selectedPlugins.length > 0) {\n console.log(` Added plugins: ${result.selectedPlugins.join(\", \")}`);\n }\n if (result.sync) {\n const sync = result.sync;\n const hasRetirement =\n (sync.retired?.length ?? 0) > 0 || (sync.retiredConflicted?.length ?? 0) > 0;\n console.log(` ${colors.dim(\"Sync results:\")}`);\n if (\n sync.updated.length > 0 ||\n sync.added.length > 0 ||\n sync.conflicted.length > 0 ||\n hasRetirement\n ) {\n console.log(\n ` ${sync.updated.length} updated, ${sync.added.length} added, ${sync.conflicted.length} conflicted`,\n );\n if (sync.conflicted.length > 0) {\n console.log(\n ` ${colors.yellow(\"Conflicted\")} (template applied, your changes backed up):`,\n );\n if (sync.backupDir) console.log(` ${colors.dim(sync.backupDir)}`);\n for (const f of sync.conflicted) console.log(` ${colors.dim(f)}`);\n }\n if (hasRetirement) {\n console.log(` ${colors.yellow(\"Retired\")} (replaced by generated stubs — ADR 0023):`);\n if (sync.retiredBackupDir) console.log(` ${colors.dim(sync.retiredBackupDir)}`);\n for (const f of sync.retiredConflicted ?? []) {\n console.log(` ${colors.dim(`${f} (backed up)`)}`);\n }\n for (const f of sync.retired ?? []) console.log(` ${colors.dim(f)}`);\n printStubMigrationGuide(sync.retiredConflicted);\n }\n } else {\n console.log(` ${colors.dim(\"Already up to date\")}`);\n }\n }\n if (result.migrated && result.migrated.length > 0) {\n console.log(` Migrated: ${result.migrated.length} file(s)`);\n for (const f of result.migrated) console.log(` ${colors.dim(f)}`);\n }\n if (versionDelta || (result.sync && result.sync.conflicted.length > 0)) {\n console.log();\n console.log(colors.dim(\" For AI agents:\"));\n const parentRepo = \"nearbuilders/everything-dev\";\n const somedelta =\n mainPkg?.from && mainPkg.to\n ? `v${mainPkg.from.replace(/^[\\^~>=v]+/, \"\")}...v${mainPkg.to.replace(/^[\\^~>=v]+/, \"\")}`\n : \"\";\n console.log(\n colors.dim(\n ` This upgrade applied template changes${somedelta ? ` (${somedelta})` : \"\"}.`,\n ),\n );\n if (result.sync && result.sync.conflicted.length > 0) {\n console.log(\n colors.dim(\n ` ${result.sync.conflicted.length} file(s) had local conflicts — template version applied, backups at ${result.sync.backupDir || \".bos/sync-backup/\"}.`,\n ),\n );\n console.log(\n colors.dim(\n ` If local changes should be preserved upstream, open a PR: https://github.com/${parentRepo}${somedelta ? `/compare/${somedelta}` : \"\"}`,\n ),\n );\n }\n console.log(\n colors.dim(\n \" Load matching intent skills: pnpm dlx @tanstack/intent@latest load everything-dev#...\",\n ),\n );\n console.log(colors.dim(\" Review AGENTS.md — local updates may need merging.\"));\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"status\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"STATUS\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n if (result.extends) console.log(` ${colors.dim(\"Extends:\")} ${result.extends}`);\n if (result.account) console.log(` ${colors.dim(\"Account:\")} ${result.account}`);\n if (result.domain) console.log(` ${colors.dim(\"Domain:\")} ${result.domain}`);\n console.log();\n console.log(` ${colors.dim(\"Packages:\")}`);\n for (const pkg of result.packages) {\n const hasUpdate =\n pkg.installed && pkg.latest && compareSemver(pkg.installed, pkg.latest) < 0;\n const versionStr = hasUpdate\n ? `${pkg.installed} → ${pkg.latest}`\n : pkg.installed || \"not installed\";\n const label = hasUpdate ? colors.yellow(versionStr) : colors.dim(versionStr);\n console.log(` ${colors.dim(`${pkg.name}`)} ${label}`);\n }\n console.log();\n if (result.lastSync) {\n const ago = formatTimeAgo(result.lastSync);\n console.log(` ${colors.dim(\"Last sync:\")} ${ago}`);\n } else {\n console.log(` ${colors.dim(\"Last sync:\")} never`);\n }\n const envLabel =\n result.envFile === \"found\"\n ? colors.green(\"found\")\n : result.envFile === \"example-only\"\n ? colors.yellow(\"missing (only .env.example found)\")\n : colors.error(\"missing\");\n console.log(` ${colors.dim(\".env:\")} ${envLabel}`);\n if (result.parentReachable !== undefined) {\n const parentLabel = result.parentReachable\n ? colors.green(\"reachable\")\n : colors.error(\"unreachable\");\n console.log(` ${colors.dim(\"Parent:\")} ${parentLabel}`);\n }\n const hasUpdates = result.packages.some(\n (p: { installed?: string; latest?: string }) =>\n p.installed && p.latest && compareSemver(p.installed, p.latest) < 0,\n );\n if (hasUpdates) {\n console.log();\n console.log(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"ps\") {\n const psResult = result as PsResult;\n console.log();\n if (psResult.status === \"error\") {\n console.error(`[CLI] ${psResult.error || \"Unknown error\"}`);\n process.exit(1);\n }\n const entries = psResult.entries ?? [];\n if (entries.length === 0) {\n console.log(colors.dim(\" No tracked development processes running.\"));\n console.log();\n console.log(\n colors.dim(` Start one with ${colors.cyan(\"bos dev\")} and it will appear here.`),\n );\n console.log();\n return;\n }\n console.log(colors.cyan(frames.top(60)));\n console.log(` ${icons.app} ${gradients.cyber(\"PROCESSES\")}`);\n console.log(colors.cyan(frames.bottom(60)));\n console.log();\n for (const entry of entries) {\n const ageMs = Date.now() - entry.startedAt;\n const ageStr =\n ageMs < 60_000\n ? `${Math.floor(ageMs / 1000)}s`\n : ageMs < 3_600_000\n ? `${Math.floor(ageMs / 60_000)}m`\n : `${Math.floor(ageMs / 3_600_000)}h`;\n const roleTag =\n entry.role === \"workspace-parent\"\n ? colors.magenta(\"parent\")\n : entry.role === \"workspace-child\"\n ? colors.blue(\"child\")\n : colors.dim(\"dev\");\n console.log(` ${colors.green(`pid ${entry.pid}`)} ${roleTag} ${colors.dim(ageStr)}`);\n console.log(` ${colors.dim(\"dir:\")} ${entry.configDir}`);\n if (entry.parentPid !== undefined) {\n console.log(` ${colors.dim(\"parent:\")} ${entry.parentPid}`);\n }\n const portPairs = Object.entries(entry.ports ?? {})\n .filter(([, p]) => typeof p === \"number\")\n .map(([k, v]) => `${k}=${v}`);\n if (portPairs.length > 0) {\n console.log(` ${colors.dim(\"ports:\")} ${portPairs.join(\" \")}`);\n }\n if (entry.budget) {\n console.log(` ${colors.dim(\"budget:\")} [${entry.budget.min}, ${entry.budget.max}]`);\n }\n console.log(` ${colors.dim(\"desc:\")} ${entry.description}`);\n console.log();\n }\n return;\n }\n\n if (descriptor.key === \"logs\") {\n const logsResult = result as LogsResult;\n const opts = input as LogsOptions;\n for (const line of logsResult.lines) {\n console.log(line);\n }\n if (logsResult.lines.length === 0) {\n console.log(colors.dim(` No matching log lines in ${logsResult.logFile}.`));\n }\n if (opts.follow) {\n if (logsResult.logFile === \"unknown\" || !existsSync(logsResult.logFile)) {\n console.log(colors.dim(\" No log file to follow — nothing was found on disk.\"));\n } else {\n const filter = opts.service;\n let byteOffset = 0;\n for (const line of logsResult.lines) byteOffset += Buffer.byteLength(line, \"utf8\") + 1;\n const followMatch = (line: string): boolean => {\n if (!filter) return true;\n const source = /\\] \\[([^\\]]+)\\] \\[(?:OUT|ERR)\\] /.exec(line)?.[1];\n return source === filter || source === `plugin:${filter}`;\n };\n const watcher = watch(logsResult.logFile, (event) => {\n if (event !== \"change\") return;\n void readFile(logsResult.logFile, \"utf8\")\n .then((text) => {\n const newLines = text\n .slice(byteOffset)\n .split(\"\\n\")\n .filter((line) => line.length > 0 && followMatch(line));\n byteOffset = Buffer.byteLength(text, \"utf8\");\n for (const line of newLines) {\n console.log(line);\n }\n })\n .catch(() => {\n // the followed file was rotated or deleted — stop following\n watcher.close();\n });\n });\n console.log(colors.dim(\" Following — Ctrl+C to stop.\"));\n process.on(\"SIGINT\", () => {\n watcher.close();\n process.exit(0);\n });\n }\n }\n return;\n }\n\n if (descriptor.key === \"kill\") {\n const killResult = result as KillResult;\n console.log();\n if (killResult.status === \"error\") {\n console.error(`[CLI] ${killResult.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (killResult.killed.length > 0) {\n console.log(colors.green(`${icons.ok} Sent ${killResult.killed.length} kill signal(s)`));\n for (const k of killResult.killed) {\n console.log(` ${colors.dim(\"pid\")} ${k.pid} ${colors.dim(k.configDir)}`);\n }\n }\n if (killResult.skipped.length > 0) {\n console.log(colors.yellow(`${icons.err} ${killResult.skipped.length} skipped`));\n for (const s of killResult.skipped) {\n console.log(` ${colors.dim(\"pid\")} ${s.pid} ${colors.dim(s.reason)}`);\n }\n }\n if (killResult.killed.length === 0 && killResult.skipped.length === 0) {\n const opts = input as KillOptions;\n if (opts.all) {\n console.log(colors.dim(\" No tracked processes to kill.\"));\n } else {\n const configPath = findConfigPath();\n const dir = opts.configDir ?? (configPath ? resolve(dirname(configPath)) : process.cwd());\n console.log(colors.dim(` No tracked processes for ${dir}`));\n console.log(colors.dim(` Use ${colors.cyan(\"--all\")} to kill across all directories.`));\n }\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"typesGen\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.green(`${icons.ok} Types generated`));\n if (result.generated.length > 0) {\n console.log(` ${colors.dim(\"Written:\")}`);\n for (const f of result.generated) console.log(` ${colors.dim(f)}`);\n }\n if (result.fetched.length > 0 || result.skipped.length > 0 || result.failed.length > 0) {\n console.log(` ${colors.dim(\"Contract sources:\")}`);\n for (const entry of result.fetched) {\n const space = entry.indexOf(\" \");\n const key = space !== -1 ? entry.slice(0, space) : entry;\n const rest = space !== -1 ? entry.slice(space + 1) : \"\";\n const restSpace = rest.indexOf(\" \");\n const detail = restSpace !== -1 ? rest.slice(restSpace + 1) : \"\";\n console.log(\n ` ${key} ${colors.cyan(\"remote\")}${detail ? ` ${colors.dim(detail)}` : \"\"}`,\n );\n }\n for (const entry of result.skipped) {\n const space = entry.indexOf(\" \");\n const key = space !== -1 ? entry.slice(0, space) : entry;\n const rest = space !== -1 ? entry.slice(space + 1) : \"\";\n if (rest === \"no URL resolved\") {\n console.log(` ${key} ${colors.dim(\"no URL resolved\")}`);\n continue;\n }\n const restSpace = rest.indexOf(\" \");\n const detail = restSpace !== -1 ? rest.slice(restSpace + 1) : \"\";\n console.log(` ${key} ${colors.dim(\"local\")}${detail ? ` ${colors.dim(detail)}` : \"\"}`);\n }\n }\n if (result.failed.length > 0) {\n console.log(` ${colors.yellow(\"Failed:\")}`);\n for (const f of result.failed) {\n const colon = f.indexOf(\": \");\n if (colon !== -1) {\n console.log(` ${colors.error(f.slice(0, colon))}${colors.dim(f.slice(colon))}`);\n } else {\n console.log(` ${colors.error(f)}`);\n }\n }\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"typecheck\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n const failed = result.results.filter((r: TypecheckWorkspaceResult) => !r.passed);\n const passed = result.results.filter((r: TypecheckWorkspaceResult) => r.passed);\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"TYPECHECK\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n for (const r of result.results) {\n const icon = r.passed ? colors.green(\"✓\") : colors.error(\"✗\");\n console.log(` ${icon} ${r.workspace}`);\n }\n if (result.skipped.length > 0) {\n console.log(` ${colors.dim(`Skipped: ${result.skipped.join(\", \")}`)}`);\n }\n console.log();\n if (failed.length > 0) {\n console.log(` ${colors.error(`${failed.length} failed`)}`);\n for (const f of failed) {\n if (f.error) console.log(` ${colors.dim(f.error)}`);\n }\n console.log();\n process.exit(1);\n }\n console.log(` ${colors.green(`${passed.length} passed`)}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"mfCheck\") {\n console.log();\n console.log(\n ` ${colors.dim(\"Host\")} ${result.hostReachable ? colors.green(\"OK \") : colors.error(\"FAIL\")} ${\n result.hostVersion ?? \"unreachable\"\n }${result.hostReason ? ` (${result.hostReason})` : \"\"}`,\n );\n for (const r of result.remotes) {\n const tag = r.ok ? colors.green(\"OK \") : colors.error(\"FAIL\");\n console.log(\n ` ${colors.dim(r.role.padEnd(10))} ${tag} ${r.url} pluginVersion=${r.pluginVersion ?? \"?\"}${\n r.reason ? ` ↳ ${r.reason}` : \"\"\n }`,\n );\n }\n console.log();\n if (result.status !== \"ok\") {\n console.log(\n colors.error(\n \" mf-compat: ✗ federation manifests NOT compatible — redeploy affected plugin(s) so pluginVersion and shared versions match host\",\n ),\n );\n console.log();\n process.exit(1);\n }\n console.log(colors.green(\" mf-compat: ✓ all federation manifests compatible\"));\n console.log();\n return;\n }\n\n if (result?.status === \"error\" && descriptor.key !== \"publish\" && descriptor.key !== \"deploy\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n\n if (descriptor.key === \"login\") {\n console.log();\n console.log(colors.green(`${icons.ok} Logged in to ${result.siteUrl}`));\n if (result.accountId) console.log(` ${colors.dim(\"Account:\")} ${result.accountId}`);\n if (result.expiresAt) console.log(` ${colors.dim(\"Expires:\")} ${result.expiresAt}`);\n if (result.warning) console.log(` ${colors.yellow(\"⚠\")} ${result.warning}`);\n if (result.publishKey) {\n console.log(\n ` ${colors.dim(\"Publish key:\")} ${result.publishKey.publicKey} ${colors.dim(\n `(${result.publishKey.network}, exported to ${result.publishKey.exportedTo})`,\n )}`,\n );\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"logout\") {\n console.log();\n console.log(colors.green(`${icons.ok} Logged out`));\n if (result.revokedApiKey) console.log(` ${colors.dim(\"Revoked API key\")}`);\n if (result.removedPublishKey) console.log(` ${colors.dim(\"Removed exported publish key\")}`);\n if (result.warning) console.log(` ${colors.yellow(\"⚠\")} ${result.warning}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"keyPublish\") {\n process.stdout.write(`Generated publish key for ${result.account}\\n`);\n process.stdout.write(` Network: ${result.network}\\n`);\n process.stdout.write(` Allowance: ${result.allowance}\\n`);\n process.stdout.write(`\\n`);\n const secretName = result.env === \"staging\" ? \"NEAR_TESTNET_PRIVATE_KEY\" : \"NEAR_PRIVATE_KEY\";\n if (!process.stdout.isTTY) {\n process.stderr.write(\n ` ⚠ Non-interactive stdout: this private key will be captured in any log or pipe (GitHub Actions logs persist stdout).\\n`,\n );\n }\n process.stdout.write(\n ` Set this as ${secretName} in GitHub Actions or before calling publish:\\n`,\n );\n process.stdout.write(`${secretName}=${result.privateKey}\\n`);\n }\n\n if (descriptor.key === \"pluginAdd\") {\n console.log();\n console.log(colors.green(`${icons.ok} Added plugin ${result.key}`));\n if (result.development) console.log(` ${colors.dim(\"Development:\")} ${result.development}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginRemove\") {\n console.log();\n console.log(colors.green(`${icons.ok} Removed plugin ${result.key}`));\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginList\") {\n console.log();\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.config} ${gradients.cyber(\"PLUGINS\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n if (result.plugins.length === 0) {\n console.log(colors.dim(\" No plugins configured\"));\n } else {\n for (const pluginItem of result.plugins) {\n console.log(` ${colors.cyan(pluginItem.key)}`);\n if (pluginItem.development)\n console.log(` ${colors.dim(\"Development:\")} ${pluginItem.development}`);\n if (pluginItem.production)\n console.log(` ${colors.dim(\"Production:\")} ${pluginItem.production}`);\n }\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginPublish\") {\n console.log();\n console.log(colors.green(`${icons.ok} Published plugin ${result.key}`));\n if (result.path) console.log(` ${colors.dim(\"Path:\")} ${result.path}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\n if (result.version) console.log(` ${colors.dim(\"Version:\")} ${result.version}`);\n if (result.fingerprint) console.log(` ${colors.dim(\"Fingerprint:\")} ${result.fingerprint}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"registryUse\") {\n console.log();\n if (result.status === \"error\") {\n console.error(colors.error(`${icons.err} ${result.error || \"Unknown error\"}`));\n process.exit(1);\n }\n console.log(\n colors.green(\n `${icons.ok} ${result.status === \"dry-run\" ? \"Dry run\" : \"Composed\"} from ${result.from}`,\n ),\n );\n for (const section of result.applied) {\n console.log(` ${colors.green(\"+\")} ${section}`);\n }\n if (result.configPath) {\n console.log(` ${colors.dim(\"Config:\")} ${result.configPath}`);\n }\n if (result.status === \"updated\") {\n console.log(colors.dim(\" Run bos types gen to refresh generated types.\"));\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"publish\") {\n if (result.status === \"dry-run\") {\n console.log();\n console.log(colors.cyan(`${icons.ok} Dry run complete`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${result.registryUrl}`);\n console.log();\n return;\n }\n\n if (result.status === \"error\") {\n console.log();\n console.log(colors.error(`${icons.err} Publish failed`));\n if (result.error) {\n console.log(` ${colors.dim(\"Error:\")} ${result.error}`);\n }\n if (result.deployResults && result.deployResults.length > 0) {\n const failures = result.deployResults.filter((r: any) => !r.success);\n if (failures.length > 0) {\n console.log();\n for (const f of failures) {\n const errorLine = (f.error ?? \"Failed\").split(\"\\n\")[0];\n console.log(` ${colors.error(icons.err)} ${f.key}: ${errorLine}`);\n }\n }\n }\n console.log();\n process.exit(1);\n }\n\n if (result.status === \"published\") {\n console.log();\n console.log(colors.green(`${icons.ok} Published successfully`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${result.registryUrl}`);\n if (result.txHash) {\n console.log(` ${colors.dim(\"Transaction:\")} ${result.txHash}`);\n }\n if (result.built && result.built.length > 0) {\n console.log(` ${colors.dim(\"Built:\")} ${result.built.join(\", \")}`);\n }\n if (result.skipped && result.skipped.length > 0) {\n console.log(` ${colors.dim(\"Skipped:\")} ${result.skipped.join(\", \")}`);\n }\n if (result.deployResults) {\n const warnings = result.deployResults.flatMap((r: any) => r.warnings ?? []);\n if (warnings.length > 0) {\n console.log();\n console.log(` ${colors.yellow(\"⚠\")} Build warnings:`);\n for (const w of warnings) {\n console.log(` ${colors.dim(w)}`);\n }\n }\n }\n console.log();\n return;\n }\n }\n\n if (descriptor.key === \"rollback\") {\n const rollbackResult = result as any;\n if (rollbackResult.status === \"error\") {\n console.log();\n console.log(colors.error(`${icons.err} Roll back failed`));\n if (rollbackResult.error) {\n console.log(` ${colors.dim(\"Error:\")} ${rollbackResult.error}`);\n }\n if (rollbackResult.verification) {\n console.log();\n for (const check of rollbackResult.verification) {\n const mark = check.ok ? colors.green(icons.ok) : colors.error(icons.err);\n const reason = check.reason ? colors.dim(` — ${check.reason}`) : \"\";\n console.log(` ${mark} ${check.slot}${reason}`);\n }\n }\n console.log();\n process.exit(1);\n }\n\n if (rollbackResult.status === \"dry-run\") {\n console.log();\n console.log(colors.cyan(`${icons.ok} Rollback dry run complete`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${rollbackResult.registryUrl}`);\n console.log();\n return;\n }\n\n console.log();\n console.log(colors.green(`${icons.ok} Rolled back`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${rollbackResult.registryUrl}`);\n if (rollbackResult.txHash) {\n console.log(` ${colors.dim(\"Transaction:\")} ${rollbackResult.txHash}`);\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"deploy\") {\n const deployResult = result as any;\n if (deployResult.status === \"list\") {\n console.log();\n console.log(colors.cyan(\"Recent publishes (audit trail)\"));\n for (const entry of deployResult.history ?? []) {\n console.log(\n ` ${entry.blockTimestamp} ${colors.dim(`block ${entry.blockHeight}`)}${entry.publishedAt ? colors.dim(` ${entry.publishedAt}`) : \"\"}`,\n );\n }\n console.log();\n return;\n }\n if (deployResult.fingerprint) {\n console.log(` ${colors.dim(\"Fingerprint:\")} ${deployResult.fingerprint}`);\n }\n if (deployResult.status === \"dry-run\") {\n console.log();\n console.log(colors.cyan(`${icons.ok} Dry run complete`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${deployResult.registryUrl}`);\n console.log();\n return;\n }\n\n if (deployResult.status === \"error\") {\n console.log();\n console.log(colors.error(`${icons.err} Deploy failed`));\n if (deployResult.error) {\n console.log(` ${colors.dim(\"Error:\")} ${deployResult.error}`);\n }\n if (deployResult.deployResults && deployResult.deployResults.length > 0) {\n const failures = deployResult.deployResults.filter((r: any) => !r.success);\n if (failures.length > 0) {\n console.log();\n for (const f of failures) {\n const errorLine = (f.error ?? \"Failed\").split(\"\\n\")[0];\n console.log(` ${colors.error(icons.err)} ${f.key}: ${errorLine}`);\n }\n }\n }\n console.log();\n process.exit(1);\n }\n\n if (deployResult.status === \"deployed\") {\n console.log();\n console.log(colors.green(`${icons.ok} Deployed successfully`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${deployResult.registryUrl}`);\n if (deployResult.txHash) {\n console.log(` ${colors.dim(\"Transaction:\")} ${deployResult.txHash}`);\n }\n if (deployResult.built && deployResult.built.length > 0) {\n console.log(` ${colors.dim(\"Built:\")} ${deployResult.built.join(\", \")}`);\n }\n if (deployResult.skipped && deployResult.skipped.length > 0) {\n console.log(` ${colors.dim(\"Skipped:\")} ${deployResult.skipped.join(\", \")}`);\n }\n if (deployResult.deployResults) {\n const warnings = deployResult.deployResults.flatMap((r: any) => r.warnings ?? []);\n if (warnings.length > 0) {\n console.log();\n console.log(` ${colors.yellow(\"⚠\")} Build warnings:`);\n for (const w of warnings) {\n console.log(` ${colors.dim(w)}`);\n }\n }\n }\n if (deployResult.image) {\n console.log(` ${colors.dim(\"Image:\")} ${deployResult.image}`);\n }\n if (deployResult.service) {\n console.log(` ${colors.dim(\"Railway:\")} deployed ${deployResult.service}`);\n }\n console.log();\n return;\n }\n\n if (deployResult.status === \"published\") {\n console.log();\n console.log(colors.yellow(`${icons.err} Config published, but a deploy leg failed`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${deployResult.registryUrl}`);\n if (deployResult.txHash) {\n console.log(` ${colors.dim(\"Transaction:\")} ${deployResult.txHash}`);\n }\n if (deployResult.error) {\n console.log(` ${colors.dim(\"Error:\")} ${deployResult.error}`);\n }\n console.log();\n process.exit(1);\n }\n }\n\n if (descriptor.key === \"infraExport\") {\n process.stdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n return;\n }\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n}\n\nvoid main().catch((error) => {\n console.error(\"[CLI] Fatal error:\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAS,gBAAgB,QAStB;CACD,QAAQ,IAAI;CACZ,QAAQ,IAAI,OAAO,KAAK,OAAO,IAAI,EAAE,CAAC,CAAC;CACvC,QAAQ,IAAI,KAAK,MAAM,IAAI,GAAG,UAAU,MAAM,QAAQ,GAAG;CACzD,QAAQ,IAAI,OAAO,KAAK,OAAO,OAAO,EAAE,CAAC,CAAC;CAC1C,QAAQ,IAAI;CAEZ,QAAQ,IAAI,KAAK,OAAO,IAAI,SAAS,EAAE,IAAI,OAAO,KAAK,OAAO,OAAO,GAAG;CACxE,QAAQ,IAAI,KAAK,OAAO,IAAI,QAAQ,EAAE,KAAK,OAAO,MAAM,OAAO,UAAU,gBAAgB,GAAG;CAC5F,IAAI,OAAO,SACT,QAAQ,IAAI,KAAK,OAAO,IAAI,SAAS,EAAE,IAAI,OAAO,QAAQ,OAAO,QAAQ,MAAM,GAAG;CAEpF,QAAQ,IAAI;AACd;AAEA,SAAS,cAAc,cAA8B;CAGnD,MAAM,SAFM,KAAK,IAEA,IADJ,IAAI,KAAK,YAAY,CAAC,CAAC,QACZ;CACxB,MAAM,WAAW,KAAK,MAAM,SAAS,GAAM;CAC3C,IAAI,WAAW,GAAG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AC;AAChB,CAAC"}
@@ -8,6 +8,7 @@ const require_resolution_session = require('../resolution/session.cjs');
8
8
  const require_shared = require('./shared.cjs');
9
9
  const require_rollback = require('../rollback.cjs');
10
10
  const require_publish = require('../publish.cjs');
11
+ const require_smoke = require('../smoke.cjs');
11
12
  let node_fs = require("node:fs");
12
13
  let node_path = require("node:path");
13
14
  let effect = require("effect");
@@ -15,6 +16,61 @@ let node_process = require("node:process");
15
16
  node_process = require_runtime.__toESM(node_process, 1);
16
17
 
17
18
  //#region src/commands/deploy.ts
19
+ /** Roll the registry config back to the previous snapshot in the FastKV
20
+ * publish history — the post-publish smoke failure protocol (ADR 0021):
21
+ * a red boot gate must never leave a new config live against an old image,
22
+ * so the promotion is halted and the config reverts to the last known-good
23
+ * snapshot within seconds. */
24
+ async function rollbackToPreviousSnapshot(input) {
25
+ let history;
26
+ try {
27
+ history = await require_fastkv.fetchConfigHistory({
28
+ accountId: input.account,
29
+ gatewayId: input.domain,
30
+ registry: input.registry,
31
+ limit: 20
32
+ });
33
+ } catch (error) {
34
+ return {
35
+ ok: false,
36
+ error: `fetching publish history failed: ${error instanceof Error ? error.message : String(error)}`
37
+ };
38
+ }
39
+ const previous = history[1];
40
+ if (!previous) return {
41
+ ok: false,
42
+ error: "no previous snapshot in the publish history — nothing to roll back to"
43
+ };
44
+ const verification = await require_rollback.verifyRollbackSnapshot(previous.value);
45
+ if (!verification.ok && verification.verifiable) return {
46
+ ok: false,
47
+ error: "rollback refused — a pinned slot's bytes are gone or no longer match their SRI"
48
+ };
49
+ const payload = require_rollback.buildRollbackPayload(require_types.BosConfigSchema.parse(previous.value), (/* @__PURE__ */ new Date()).toISOString());
50
+ const result = await require_publish.publishToFastKv({
51
+ bosConfig: payload,
52
+ runtimeConfig: input.runtimeConfig,
53
+ configDir: input.configDir,
54
+ env: input.env,
55
+ build: false,
56
+ dryRun: false,
57
+ verbose: input.verbose,
58
+ packages: "all",
59
+ network: input.network,
60
+ privateKey: input.privateKey,
61
+ wallet: input.wallet,
62
+ registry: input.registry,
63
+ exactPayload: true
64
+ });
65
+ if (result.status !== "published") return {
66
+ ok: false,
67
+ error: `rollback publish failed: ${result.error ?? result.status}`
68
+ };
69
+ return {
70
+ ok: true,
71
+ blockHeight: String(previous.blockHeight)
72
+ };
73
+ }
18
74
  function registerDeploy(builder) {
19
75
  return {
20
76
  publish: builder.publish.handler(async ({ input, context }) => {
@@ -144,7 +200,8 @@ function registerDeploy(builder) {
144
200
  network: input.network,
145
201
  privateKey: input.privateKey,
146
202
  wallet: input.wallet,
147
- registry: input.registry
203
+ registry: input.registry,
204
+ exactPayload: true
148
205
  });
149
206
  return {
150
207
  status: result.status,
@@ -284,6 +341,59 @@ function registerDeploy(builder) {
284
341
  };
285
342
  }
286
343
  }
344
+ if (input.smoke) {
345
+ if (!image || !imageDigest) {
346
+ console.log();
347
+ console.log(require_theme.colors.yellow(" Post-publish smoke skipped: no runtime image digest — set ci.image (or pass BOS_IMAGE_DIGEST)"));
348
+ } else {
349
+ console.log();
350
+ console.log(require_theme.colors.cyan(" ▶ Post-publish smoke (boot gate)"));
351
+ const smokeResult = await require_smoke.runSmoke({
352
+ image: require_image_deploy.imageRefWithDigest(image, imageDigest),
353
+ account: nextSession.config?.account,
354
+ gateway: nextSession.config?.domain
355
+ });
356
+ if (!smokeResult.ok) {
357
+ const cause = smokeResult.error ?? "unknown failure";
358
+ console.log();
359
+ console.log(require_theme.colors.error(` ${require_theme.icons.err} Post-publish smoke failed: ${cause}`));
360
+ if (smokeResult.diagnosis) console.log(require_theme.colors.yellow(` ${smokeResult.diagnosis}`));
361
+ const account = nextSession.config?.account;
362
+ const domain = nextSession.config?.domain;
363
+ if (!account || !domain) {
364
+ console.log(require_theme.colors.yellow(" Rollback skipped: no registry identity in the session"));
365
+ return {
366
+ status: "published",
367
+ ...configPublished,
368
+ image,
369
+ error: `Post-publish smoke failed (${cause}) — config NOT rolled back: no registry identity`
370
+ };
371
+ }
372
+ console.log(require_theme.colors.yellow(" Rolling the published config back…"));
373
+ const rollback = await rollbackToPreviousSnapshot({
374
+ account,
375
+ domain,
376
+ env: input.env,
377
+ runtimeConfig: nextSession.runtime,
378
+ configDir: nextSession.root,
379
+ registry: input.registry,
380
+ network: input.network,
381
+ privateKey: input.privateKey,
382
+ wallet: input.wallet,
383
+ verbose: input.verbose
384
+ });
385
+ const rollbackNote = rollback.ok ? `config rolled back to block ${rollback.blockHeight}` : `config NOT rolled back: ${rollback.error ?? "unknown"}`;
386
+ console.log(require_theme.colors.yellow(` ${rollbackNote}`));
387
+ return {
388
+ status: "published",
389
+ ...configPublished,
390
+ image,
391
+ error: `Post-publish smoke failed (${cause}) — ${rollbackNote}`
392
+ };
393
+ }
394
+ console.log(require_theme.colors.green(` ${require_theme.icons.ok} Post-publish smoke passed: ${smokeResult.summary ?? ""}`));
395
+ }
396
+ }
287
397
  if (node_process.default.env.RAILWAY_TOKEN) {
288
398
  const railwayService = input.service ?? nextSession.config?.ci?.railway?.service;
289
399
  if (!railwayService) {