everything-dev 1.51.6 → 1.52.0

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 (99) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +0 -2
  2. package/dist/api-contract.cjs +61 -16
  3. package/dist/api-contract.cjs.map +1 -1
  4. package/dist/api-contract.mjs +60 -17
  5. package/dist/api-contract.mjs.map +1 -1
  6. package/dist/app.cjs +1 -1
  7. package/dist/app.cjs.map +1 -1
  8. package/dist/app.mjs +1 -1
  9. package/dist/app.mjs.map +1 -1
  10. package/dist/cli/db-doctor.cjs +1 -1
  11. package/dist/cli/db-doctor.cjs.map +1 -1
  12. package/dist/cli/db-doctor.mjs +1 -1
  13. package/dist/cli/db-repair.cjs +1 -1
  14. package/dist/cli/db-repair.cjs.map +1 -1
  15. package/dist/cli/db-repair.mjs +1 -1
  16. package/dist/cli/init.cjs +76 -52
  17. package/dist/cli/init.cjs.map +1 -1
  18. package/dist/cli/init.d.cts +15 -7
  19. package/dist/cli/init.d.cts.map +1 -1
  20. package/dist/cli/init.d.mts +15 -7
  21. package/dist/cli/init.d.mts.map +1 -1
  22. package/dist/cli/init.mjs +70 -47
  23. package/dist/cli/init.mjs.map +1 -1
  24. package/dist/cli/sync.cjs +34 -5
  25. package/dist/cli/sync.cjs.map +1 -1
  26. package/dist/cli/sync.mjs +35 -6
  27. package/dist/cli/sync.mjs.map +1 -1
  28. package/dist/cli/upgrade.cjs +151 -93
  29. package/dist/cli/upgrade.cjs.map +1 -1
  30. package/dist/cli/upgrade.mjs +138 -80
  31. package/dist/cli/upgrade.mjs.map +1 -1
  32. package/dist/cli/utils/helpers.cjs +25 -0
  33. package/dist/cli/utils/helpers.cjs.map +1 -0
  34. package/dist/cli/utils/helpers.mjs +23 -0
  35. package/dist/cli/utils/helpers.mjs.map +1 -0
  36. package/dist/cli.cjs +84 -72
  37. package/dist/cli.cjs.map +1 -1
  38. package/dist/cli.mjs +84 -72
  39. package/dist/cli.mjs.map +1 -1
  40. package/dist/code-artifacts.cjs +1 -1
  41. package/dist/code-artifacts.mjs +1 -1
  42. package/dist/config.cjs +44 -4
  43. package/dist/config.cjs.map +1 -1
  44. package/dist/config.d.cts +1 -1
  45. package/dist/config.d.cts.map +1 -1
  46. package/dist/config.d.mts +1 -1
  47. package/dist/config.d.mts.map +1 -1
  48. package/dist/config.mjs +44 -4
  49. package/dist/config.mjs.map +1 -1
  50. package/dist/contract.cjs +9 -4
  51. package/dist/contract.cjs.map +1 -1
  52. package/dist/contract.d.cts +23 -13
  53. package/dist/contract.d.cts.map +1 -1
  54. package/dist/contract.d.mts +23 -13
  55. package/dist/contract.d.mts.map +1 -1
  56. package/dist/contract.meta.cjs +2 -1
  57. package/dist/contract.meta.cjs.map +1 -1
  58. package/dist/contract.meta.d.cts +3 -0
  59. package/dist/contract.meta.d.mts +3 -0
  60. package/dist/contract.meta.mjs +2 -1
  61. package/dist/contract.meta.mjs.map +1 -1
  62. package/dist/contract.mjs +9 -4
  63. package/dist/contract.mjs.map +1 -1
  64. package/dist/dag.cjs +176 -0
  65. package/dist/dag.cjs.map +1 -0
  66. package/dist/dag.d.cts +24 -0
  67. package/dist/dag.d.cts.map +1 -0
  68. package/dist/dag.d.mts +24 -0
  69. package/dist/dag.d.mts.map +1 -0
  70. package/dist/dag.mjs +167 -0
  71. package/dist/dag.mjs.map +1 -0
  72. package/dist/index.cjs +2 -0
  73. package/dist/index.d.cts +2 -2
  74. package/dist/index.d.mts +2 -2
  75. package/dist/index.mjs +2 -2
  76. package/dist/infra/planner.cjs +1 -1
  77. package/dist/infra/planner.mjs +1 -1
  78. package/dist/infra/preflight.cjs +1 -1
  79. package/dist/infra/preflight.cjs.map +1 -1
  80. package/dist/infra/preflight.mjs +1 -1
  81. package/dist/infra/preflight.mjs.map +1 -1
  82. package/dist/near-cli.cjs +1 -1
  83. package/dist/near-cli.mjs +1 -1
  84. package/dist/plugin.cjs +27 -18
  85. package/dist/plugin.cjs.map +1 -1
  86. package/dist/plugin.d.cts +52 -6
  87. package/dist/plugin.d.mts +52 -6
  88. package/dist/plugin.mjs +28 -19
  89. package/dist/plugin.mjs.map +1 -1
  90. package/dist/types.cjs +41 -6
  91. package/dist/types.cjs.map +1 -1
  92. package/dist/types.d.cts +116 -1
  93. package/dist/types.d.cts.map +1 -1
  94. package/dist/types.d.mts +116 -1
  95. package/dist/types.d.mts.map +1 -1
  96. package/dist/types.mjs +40 -7
  97. package/dist/types.mjs.map +1 -1
  98. package/package.json +8 -2
  99. package/dist/_virtual/_rolldown/runtime.mjs +0 -32
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["bosPlugin"],"sources":["../src/cli.ts"],"sourcesContent":["import { 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 { loadProjectEnv } from \"./cli/infra\";\nimport { fetchParentConfig, runDockerComposeUp } from \"./cli/init\";\nimport { parseCommandInput } from \"./cli/parse\";\nimport { promptInitBasic, promptInitOverrides } from \"./cli/prompts\";\nimport { formatDuration, sumPhaseDurations } from \"./cli/timing\";\nimport { findConfigPath } from \"./config\";\nimport type {\n DevOptions,\n DevResult,\n InitOptions,\n InitResult,\n KillOptions,\n KillResult,\n OverrideSection,\n PsResult,\n StartOptions,\n StartResult,\n} from \"./contract\";\nimport type { ProgressEvent, StartSummary } from \"./plugin\";\nimport bosPlugin, { consumeDevSession, pluginEvents } from \"./plugin\";\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\nfunction normalizeVersion(v: string): string {\n return v.replace(/^[\\^~>=v]+/, \"\").trim();\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 normalizeVersion(p.installed) !== normalizeVersion(p.latest) &&\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 console.log();\n console.log(colors.yellow(` ! Outdated packages detected:`));\n for (const pkg of outdated) {\n console.log(colors.dim(` ${pkg.name} ${pkg.installed} → ${pkg.latest}`));\n }\n console.log(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n console.log();\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 const configPath = findConfigPath();\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 const projectDir = configPath ? dirname(configPath) : undefined;\n const edResolved = projectDir ? resolveFrameworkPackage(projectDir, \"everything-dev\") : undefined;\n const displayVersion = edResolved?.installedVersion\n ? `${edResolved.installedVersion}${edResolved.isLinked ? \" (linked)\" : \"\"}`\n : undefined;\n printBanner(\"everything-dev\", displayVersion);\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 },\n secrets: {},\n });\n\n const client = plugin.createClient();\n\n const outdatedWarning = warnIfOutdated(client, command);\n\n try {\n const input = parseCommandInput(descriptor, commandArgs);\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 \"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 = consumeDevSession();\n await outdatedWarning;\n if (session) {\n const { devApp } = await import(\"./dev-session\");\n devApp(session.orchestrator, session.services, session.runtimeConfig);\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 = consumeDevSession();\n await outdatedWarning;\n if (session) {\n const summary = session.summary;\n if (summary) {\n printStartSummary(summary);\n }\n const { startApp } = await import(\"./dev-session\");\n startApp(session.orchestrator, session.services, session.runtimeConfig);\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 parentConfig = await fetchParentConfig(basic.extendsAccount, basic.extendsGateway);\n if (parentConfig?.plugins && typeof parentConfig.plugins === \"object\") {\n parentPluginKeys = Object.keys(parentConfig.plugins);\n }\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 });\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 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(\" docker compose up -d --wait\"));\n console.log(colors.dim(\" bun run dev\"));\n } else {\n console.log(colors.dim(\" bun install\"));\n console.log(colors.dim(\" docker compose up -d --wait\"));\n console.log(colors.dim(\" bun 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 try {\n await runDockerComposeUp(result.targetDir);\n dockerSpinner.stop(\"Docker services ready\");\n } catch (error) {\n dockerSpinner.stop(\"Docker services not started\");\n p.log.warn(\n `docker compose up -d --wait failed: ${error instanceof Error ? error.message : error}`,\n );\n }\n }\n }\n\n return;\n }\n\n await outdatedWarning;\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 const configPath = findConfigPath();\n if (configPath) loadProjectEnv(dirname(configPath));\n\n const { runStudioLocal, runStudioRemote } = await import(\"./cli/db-studio\");\n const info = {\n key: result.plugin as string,\n source: result.source as \"local\" | \"remote\",\n section: result.section as \"app.api\" | \"app.auth\" | \"plugins\",\n databaseSecret: result.databaseSecret as string,\n databaseUrl: result.databaseUrl as string,\n workspaceDir: result.workspaceDir as string | undefined,\n projectDir: dirname(configPath ?? process.cwd()),\n };\n\n try {\n if (info.source === \"local\" && info.workspaceDir) {\n await runStudioLocal(info);\n } else {\n await runStudioRemote(info);\n }\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\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(\"No bos.config.json found\");\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 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} Template synced`));\n }\n if (result.updated.length > 0) {\n console.log(` ${colors.dim(\"Updated:\")} ${result.updated.length} file(s)`);\n for (const f of result.updated) console.log(` ${colors.dim(f)}`);\n }\n if (result.added.length > 0) {\n console.log(` ${colors.dim(\"Added:\")} ${result.added.length} file(s)`);\n for (const f of result.added) console.log(` ${colors.dim(f)}`);\n }\n if (result.skipped.length > 0) {\n console.log(\n ` ${colors.yellow(\"Skipped:\")} ${result.skipped.length} file(s) (locally modified, use --force to overwrite)`,\n );\n for (const f of result.skipped) console.log(` ${colors.dim(f)}`);\n }\n if (result.updated.length === 0 && result.added.length === 0 && result.skipped.length === 0) {\n console.log(` ${colors.dim(\"Already up to date\")}`);\n }\n if (result.status !== \"dry-run\" && result.updated.length > 0) {\n console.log();\n console.log(colors.dim(\" Review changes — your customizations take priority:\"));\n console.log(\n colors.dim(\n \" • api/src/contract.ts, api/src/index.ts, api/src/db/schema.ts — never overwritten\",\n ),\n );\n console.log(\n colors.dim(\" • ui/src/components/**, ui/src/styles.css — never overwritten\"),\n );\n console.log(\n colors.dim(\n \" • Other updated files — accept framework improvements, then restore your changes\",\n ),\n );\n console.log(colors.dim(\" • Skipped files — yours already, only update with --force\"));\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"upgrade\") {\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 successful`));\n }\n for (const pkg of result.packages) {\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(` ${colors.dim(\"Changelog:\")} ${result.changelogUrl}`);\n }\n if (result.availablePlugins && result.availablePlugins.length > 0) {\n console.log(` ${colors.dim(\"New parent plugins:\")} ${result.availablePlugins.join(\", \")}`);\n }\n if (result.selectedPlugins && result.selectedPlugins.length > 0) {\n console.log(` ${colors.dim(\"Added plugins:\")} ${result.selectedPlugins.join(\", \")}`);\n }\n printTimingSummary(result.timings);\n if (result.sync) {\n const sync = result.sync;\n if (sync.updated.length > 0) {\n console.log(` ${colors.dim(\"Updated:\")} ${sync.updated.length} file(s)`);\n for (const f of sync.updated) console.log(` ${colors.dim(f)}`);\n }\n if (sync.added.length > 0) {\n console.log(` ${colors.dim(\"Added:\")} ${sync.added.length} file(s)`);\n for (const f of sync.added) console.log(` ${colors.dim(f)}`);\n }\n if (sync.skipped.length > 0) {\n console.log(\n ` ${colors.yellow(\"Skipped:\")} ${sync.skipped.length} file(s) (locally modified, use --force to overwrite)`,\n );\n for (const f of sync.skipped) console.log(` ${colors.dim(f)}`);\n }\n if (\n result.status !== \"dry-run\" &&\n (sync.updated.length > 0 || sync.added.length > 0 || sync.skipped.length > 0)\n ) {\n console.log();\n console.log(colors.dim(\" Resolve differences — your code takes priority:\"));\n console.log();\n console.log(colors.dim(\" Never overwritten (safe):\"));\n console.log(\n colors.dim(\" • api/src/contract.ts, api/src/index.ts, api/src/db/schema.ts\"),\n );\n console.log(colors.dim(\" • ui/src/components/**, ui/src/styles.css\"));\n console.log();\n console.log(colors.dim(\" Replaced — review and keep your changes:\"));\n console.log(\n colors.dim(\n \" • api/drizzle.config.ts, api/tsconfig.json, api/tsconfig.contract.json\",\n ),\n );\n console.log(colors.dim(\" • api/plugin.dev.ts, api/rspack.config.js\"));\n console.log(colors.dim(\" • ui/src/routes/* (core routes only)\"));\n console.log();\n console.log(colors.dim(\" Merged — your deps preserved:\"));\n console.log(colors.dim(\" • package.json, api/package.json, ui/package.json\"));\n console.log();\n console.log(colors.dim(\" Skipped — already yours:\"));\n console.log(colors.dim(\" • Use --force only if you want framework updates\"));\n }\n }\n if (result.migrated && result.migrated.length > 0) {\n console.log(` ${colors.yellow(\"Removed:\")} ${result.migrated.length} obsolete file(s)`);\n for (const f of result.migrated) console.log(` ${colors.dim(f)}`);\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 &&\n pkg.latest &&\n normalizeVersion(pkg.installed) !== normalizeVersion(pkg.latest);\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 && normalizeVersion(p.installed) !== normalizeVersion(p.latest),\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 === \"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.source) {\n console.log(\n ` ${colors.dim(\"Mode:\")} ${result.source === \"remote\" ? colors.cyan(\"remote\") : colors.dim(\"local\")}`,\n );\n }\n if (result.generated.length > 0) {\n console.log(` ${colors.dim(\"Generated:\")}`);\n for (const f of result.generated) console.log(` ${colors.dim(f)}`);\n }\n if (result.fetched.length > 0) {\n console.log(` ${colors.dim(\"Fetched (remote):\")}`);\n for (const url of result.fetched) console.log(` ${colors.dim(url)}`);\n }\n if (result.skipped.length > 0) {\n console.log(` ${colors.dim(\"Skipped:\")}`);\n for (const s of result.skipped) console.log(` ${colors.dim(s)}`);\n }\n if (result.failed.length > 0) {\n console.log(` ${colors.yellow(\"Failed:\")}`);\n for (const f of result.failed) console.log(` ${colors.error(f)}`);\n }\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 === \"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 process.stdout.write(\n ` Set this as NEAR_PRIVATE_KEY in GitHub Actions or before calling publish:\\n`,\n );\n process.stdout.write(` NEAR_PRIVATE_KEY=${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.script) console.log(` ${colors.dim(\"Script:\")} bun run ${result.script}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\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 === \"deploy\") {\n const deployResult = result as any;\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.redeployed) {\n console.log(\n ` ${colors.dim(\"Railway:\")} redeployed ${deployResult.service ?? \"service\"}`,\n );\n } else if (!process.env.RAILWAY_TOKEN) {\n console.log(` ${colors.yellow(\"Railway:\")} skipped (RAILWAY_TOKEN not set)`);\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 Railway redeploy 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(\"Railway:\")} ${deployResult.error}`);\n }\n console.log();\n process.exit(1);\n }\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":";;;;;;;;;;;;;;;;;AA6BA,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,QAA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AI,eACtB,QAAQ,IAAI,KAAK,OAAO,OAAO,UAAU,EAAE,iCAAiC;IAE9E,QAAQ,IAAI;IACZ;GACF;GAEA,IAAI,aAAa,WAAW,aAAa;IACvC,QAAQ,IAAI;IACZ,QAAQ,IAAI,OAAO,OAAO,GAAG,MAAM,IAAI,+CAA+C,CAAC;IACvF,QAAQ,IAAI,KAAK,OAAO,IAAI,eAAe,EAAE,GAAG,aAAa,aAAa;IAC1E,IAAI,aAAa,QACf,QAAQ,IAAI,KAAK,OAAO,IAAI,cAAc,EAAE,GAAG,aAAa,QAAQ;IAEtE,IAAI,aAAa,OACf,QAAQ,IAAI,KAAK,OAAO,IAAI,UAAU,EAAE,GAAG,aAAa,OAAO;IAEjE,QAAQ,IAAI;IACZ,QAAQ,KAAK,CAAC;GAChB;EACF;CACF,SAAS,OAAO;EACd,QAAQ,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG;EAC/E,QAAQ,KAAK,CAAC;CAChB;AACF;AAEK,KAAK,CAAC,CAAC,OAAO,UAAU;CAC3B,QAAQ,MAAM,sBAAsB,KAAK;CACzC,QAAQ,KAAK,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"cli.mjs","names":["bosPlugin"],"sources":["../src/cli.ts"],"sourcesContent":["import { 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 { loadProjectEnv } from \"./cli/infra\";\nimport { fetchParentConfig, runDockerComposeUp } from \"./cli/init\";\nimport { parseCommandInput } from \"./cli/parse\";\nimport { promptInitBasic, promptInitOverrides } from \"./cli/prompts\";\nimport { formatDuration, sumPhaseDurations } from \"./cli/timing\";\nimport { findConfigPath } from \"./config\";\nimport type {\n DevOptions,\n DevResult,\n InitOptions,\n InitResult,\n KillOptions,\n KillResult,\n OverrideSection,\n PsResult,\n StartOptions,\n StartResult,\n} from \"./contract\";\nimport type { ProgressEvent, StartSummary } from \"./plugin\";\nimport bosPlugin, { consumeDevSession, pluginEvents } from \"./plugin\";\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\nfunction normalizeVersion(v: string): string {\n return v.replace(/^[\\^~>=v]+/, \"\").trim();\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 normalizeVersion(p.installed) !== normalizeVersion(p.latest) &&\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 console.log();\n console.log(colors.yellow(` ! Outdated packages detected:`));\n for (const pkg of outdated) {\n console.log(colors.dim(` ${pkg.name} ${pkg.installed} → ${pkg.latest}`));\n }\n console.log(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n console.log();\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 const configPath = findConfigPath();\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 const projectDir = configPath ? dirname(configPath) : 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 },\n secrets: {},\n });\n\n const client = plugin.createClient();\n\n const outdatedWarning = warnIfOutdated(client, command);\n\n try {\n const input = parseCommandInput(descriptor, commandArgs);\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 \"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 = consumeDevSession();\n await outdatedWarning;\n if (session) {\n const { devApp } = await import(\"./dev-session\");\n devApp(session.orchestrator, session.services, session.runtimeConfig);\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 = consumeDevSession();\n await outdatedWarning;\n if (session) {\n const summary = session.summary;\n if (summary) {\n printStartSummary(summary);\n }\n const { startApp } = await import(\"./dev-session\");\n startApp(session.orchestrator, session.services, session.runtimeConfig);\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 parentConfig = await fetchParentConfig(basic.extendsAccount, basic.extendsGateway);\n if (parentConfig?.plugins && typeof parentConfig.plugins === \"object\") {\n parentPluginKeys = Object.keys(parentConfig.plugins);\n }\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 });\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 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(\" docker compose up -d --wait\"));\n console.log(colors.dim(\" bun run dev\"));\n } else {\n console.log(colors.dim(\" bun install\"));\n console.log(colors.dim(\" docker compose up -d --wait\"));\n console.log(colors.dim(\" bun 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 try {\n await runDockerComposeUp(result.targetDir);\n dockerSpinner.stop(\"Docker services ready\");\n } catch (error) {\n dockerSpinner.stop(\"Docker services not started\");\n p.log.warn(\n `docker compose up -d --wait failed: ${error instanceof Error ? error.message : error}`,\n );\n }\n }\n }\n\n return;\n }\n\n await outdatedWarning;\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 const configPath = findConfigPath();\n if (configPath) loadProjectEnv(dirname(configPath));\n\n const { runStudioLocal, runStudioRemote } = await import(\"./cli/db-studio\");\n const info = {\n key: result.plugin as string,\n source: result.source as \"local\" | \"remote\",\n section: result.section as \"app.api\" | \"app.auth\" | \"plugins\",\n databaseSecret: result.databaseSecret as string,\n databaseUrl: result.databaseUrl as string,\n workspaceDir: result.workspaceDir as string | undefined,\n projectDir: dirname(configPath ?? process.cwd()),\n };\n\n try {\n if (info.source === \"local\" && info.workspaceDir) {\n await runStudioLocal(info);\n } else {\n await runStudioRemote(info);\n }\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\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(\"No bos.config.json found\");\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 if (result.updated.length > 0 || result.added.length > 0 || result.conflicted.length > 0) {\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 }\n if (\n result.updated.length === 0 &&\n result.added.length === 0 &&\n result.conflicted.length === 0\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 console.log(` ${colors.dim(\"Sync results:\")}`);\n if (sync.updated.length > 0 || sync.added.length > 0 || sync.conflicted.length > 0) {\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 } 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: bunx @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 &&\n pkg.latest &&\n normalizeVersion(pkg.installed) !== normalizeVersion(pkg.latest);\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 && normalizeVersion(p.installed) !== normalizeVersion(p.latest),\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 === \"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 (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 === \"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 process.stdout.write(\n ` Set this as NEAR_PRIVATE_KEY in GitHub Actions or before calling publish:\\n`,\n );\n process.stdout.write(` NEAR_PRIVATE_KEY=${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.script) console.log(` ${colors.dim(\"Script:\")} bun run ${result.script}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\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 === \"deploy\") {\n const deployResult = result as any;\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.redeployed) {\n console.log(\n ` ${colors.dim(\"Railway:\")} redeployed ${deployResult.service ?? \"service\"}`,\n );\n } else if (!process.env.RAILWAY_TOKEN) {\n console.log(` ${colors.yellow(\"Railway:\")} skipped (RAILWAY_TOKEN not set)`);\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 Railway redeploy 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(\"Railway:\")} ${deployResult.error}`);\n }\n console.log();\n process.exit(1);\n }\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":";;;;;;;;;;;;;;;;;AA6BA,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,MAAM,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AK,UACd,QAAQ,IAAI,OAAO,OAAO,IAAI,CAAC,GAAG;KAEtC;IACF;IACA,IAAI,aAAa,YACf,QAAQ,IACN,KAAK,OAAO,IAAI,UAAU,EAAE,cAAc,aAAa,WAAW,WACpE;SACK,IAAI,CAAC,QAAQ,IAAI,eACtB,QAAQ,IAAI,KAAK,OAAO,OAAO,UAAU,EAAE,iCAAiC;IAE9E,QAAQ,IAAI;IACZ;GACF;GAEA,IAAI,aAAa,WAAW,aAAa;IACvC,QAAQ,IAAI;IACZ,QAAQ,IAAI,OAAO,OAAO,GAAG,MAAM,IAAI,+CAA+C,CAAC;IACvF,QAAQ,IAAI,KAAK,OAAO,IAAI,eAAe,EAAE,GAAG,aAAa,aAAa;IAC1E,IAAI,aAAa,QACf,QAAQ,IAAI,KAAK,OAAO,IAAI,cAAc,EAAE,GAAG,aAAa,QAAQ;IAEtE,IAAI,aAAa,OACf,QAAQ,IAAI,KAAK,OAAO,IAAI,UAAU,EAAE,GAAG,aAAa,OAAO;IAEjE,QAAQ,IAAI;IACZ,QAAQ,KAAK,CAAC;GAChB;EACF;CACF,SAAS,OAAO;EACd,QAAQ,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG;EAC/E,QAAQ,KAAK,CAAC;CAChB;AACF;AAEK,KAAK,CAAC,CAAC,OAAO,UAAU;CAC3B,QAAQ,MAAM,sBAAsB,KAAK;CACzC,QAAQ,KAAK,CAAC;AAChB,CAAC"}
@@ -1,5 +1,5 @@
1
- const require_config = require('./config.cjs');
2
1
  const require_api_contract = require('./api-contract.cjs');
2
+ const require_config = require('./config.cjs');
3
3
  let node_path = require("node:path");
4
4
 
5
5
  //#region src/code-artifacts.ts
@@ -1,5 +1,5 @@
1
- import { loadResolvedConfig, writeResolvedConfig } from "./config.mjs";
2
1
  import { syncApiContractBridge } from "./api-contract.mjs";
2
+ import { loadResolvedConfig, writeResolvedConfig } from "./config.mjs";
3
3
  import { join } from "node:path";
4
4
 
5
5
  //#region src/code-artifacts.ts
package/dist/config.cjs CHANGED
@@ -1,5 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_http_client = require('./http-client.cjs');
3
+ const require_api_contract = require('./api-contract.cjs');
4
+ const require_dag = require('./dag.cjs');
3
5
  const require_fastkv = require('./fastkv.cjs');
4
6
  const require_merge = require('./merge.cjs');
5
7
  const require_network = require('./network.cjs');
@@ -89,7 +91,7 @@ async function loadResolvedConfig(options) {
89
91
  const config = await resolveConfigComposableEntries(require_types.BosConfigSchema.parse(parsed), baseDir, runtimeEnv);
90
92
  cachedConfig = config;
91
93
  projectRoot = baseDir;
92
- const runtime = buildRuntimeConfig(config, baseDir, runtimeEnv, { plugins: await resolveRuntimePlugins(config.plugins ?? {}, baseDir, runtimeEnv, options?.remotePlugins) });
94
+ const runtime = await buildRuntimeConfig(config, baseDir, runtimeEnv, { plugins: await resolveRuntimePlugins(config.plugins ?? {}, baseDir, runtimeEnv, options?.remotePlugins) });
93
95
  const warnings = drainConfigWarnings();
94
96
  resumeWarnings();
95
97
  return {
@@ -344,7 +346,7 @@ function resolveDevelopmentTarget(development, production, baseDir, forceSource,
344
346
  }
345
347
  return devTarget;
346
348
  }
347
- function buildRuntimeConfig(config, baseDir, env, options) {
349
+ async function buildRuntimeConfig(config, baseDir, env, options) {
348
350
  const uiConfig = config.app.ui;
349
351
  const apiConfig = config.app.api;
350
352
  const authConfig = config.app.auth;
@@ -359,7 +361,7 @@ function buildRuntimeConfig(config, baseDir, env, options) {
359
361
  const uiIsRemote = uiRuntime.source === "remote";
360
362
  const apiIsRemote = apiRuntime.source === "remote";
361
363
  const resolvedApiName = resolvePluginRuntimeName(apiConfig.name, apiRuntime.localPath, "api");
362
- return {
364
+ const result = {
363
365
  env,
364
366
  account: config.account,
365
367
  domain: config.domain,
@@ -422,6 +424,43 @@ function buildRuntimeConfig(config, baseDir, env, options) {
422
424
  })(),
423
425
  plugins: options?.plugins && Object.keys(options.plugins).length > 0 ? options.plugins : void 0
424
426
  };
427
+ let manifestNodes = [];
428
+ const manifestPluginEntries = [];
429
+ if (result.api.source === "remote" && result.api.url) try {
430
+ const manifest = await require_api_contract.fetchApiPluginManifest(result.api.url);
431
+ if (manifest.plugins?.length) {
432
+ manifestNodes = require_dag.manifestPluginsToNodes(manifest.plugins);
433
+ for (const node of manifestNodes) if (!result.plugins?.[node.key]) {
434
+ manifestPluginEntries.push({
435
+ key: node.key,
436
+ config: {
437
+ name: node.name,
438
+ url: node.url,
439
+ entry: node.entry,
440
+ source: "remote",
441
+ dependsOn: node.dependsOn,
442
+ secrets: node.secrets,
443
+ variables: node.variables
444
+ }
445
+ });
446
+ if (node.secrets) {
447
+ for (const secretName of node.secrets) if (!process.env[secretName]) console.warn(`[Config] Plugin "${node.key}" (discovered from manifest) expects secret "${secretName}" but it is not set in the environment.`);
448
+ }
449
+ }
450
+ }
451
+ if (manifest.dependsOn?.length) {
452
+ const existing = new Set(result.api.dependsOn ?? []);
453
+ for (const dep of manifest.dependsOn) if (!existing.has(dep)) result.api.dependsOn = [...result.api.dependsOn ?? [], dep];
454
+ }
455
+ } catch (error) {
456
+ const message = error instanceof Error ? error.message : String(error);
457
+ console.warn(`[Config] Failed to fetch API plugin manifest for discovery: ${message}`);
458
+ }
459
+ if (manifestPluginEntries.length > 0) {
460
+ if (!result.plugins) result.plugins = {};
461
+ for (const { key, config } of manifestPluginEntries) if (!result.plugins[key]) result.plugins[key] = config;
462
+ }
463
+ return result;
425
464
  }
426
465
  async function loadConfigFile(configPath, baseDir) {
427
466
  if (configPath.startsWith("bos://")) return require_fastkv.fetchBosConfigFromFastKv(configPath);
@@ -505,7 +544,8 @@ function buildRuntimePluginConfig(pluginId, env, resolved, forceSource) {
505
544
  port: uiRuntime.port,
506
545
  integrity: uiRuntime.source === "remote" && typeof uiConfig?.integrity === "string" ? uiConfig.integrity : void 0
507
546
  } : void 0,
508
- routes
547
+ routes,
548
+ dependsOn: source.dependsOn ? normalizeStringArray(source.dependsOn) : void 0
509
549
  };
510
550
  }
511
551
  function resolvePluginRuntimeName(explicitName, localPath, fallback) {