everything-dev 1.51.7 → 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 (87) hide show
  1. package/dist/api-contract.cjs +61 -16
  2. package/dist/api-contract.cjs.map +1 -1
  3. package/dist/api-contract.mjs +60 -17
  4. package/dist/api-contract.mjs.map +1 -1
  5. package/dist/app.cjs +1 -1
  6. package/dist/app.cjs.map +1 -1
  7. package/dist/app.mjs +1 -1
  8. package/dist/app.mjs.map +1 -1
  9. package/dist/cli/init.cjs +76 -52
  10. package/dist/cli/init.cjs.map +1 -1
  11. package/dist/cli/init.d.cts +15 -7
  12. package/dist/cli/init.d.cts.map +1 -1
  13. package/dist/cli/init.d.mts +15 -7
  14. package/dist/cli/init.d.mts.map +1 -1
  15. package/dist/cli/init.mjs +70 -47
  16. package/dist/cli/init.mjs.map +1 -1
  17. package/dist/cli/sync.cjs +34 -5
  18. package/dist/cli/sync.cjs.map +1 -1
  19. package/dist/cli/sync.mjs +35 -6
  20. package/dist/cli/sync.mjs.map +1 -1
  21. package/dist/cli/upgrade.cjs +151 -93
  22. package/dist/cli/upgrade.cjs.map +1 -1
  23. package/dist/cli/upgrade.mjs +138 -80
  24. package/dist/cli/upgrade.mjs.map +1 -1
  25. package/dist/cli/utils/helpers.cjs +25 -0
  26. package/dist/cli/utils/helpers.cjs.map +1 -0
  27. package/dist/cli/utils/helpers.mjs +23 -0
  28. package/dist/cli/utils/helpers.mjs.map +1 -0
  29. package/dist/cli.cjs +84 -72
  30. package/dist/cli.cjs.map +1 -1
  31. package/dist/cli.mjs +84 -72
  32. package/dist/cli.mjs.map +1 -1
  33. package/dist/code-artifacts.cjs +1 -1
  34. package/dist/code-artifacts.mjs +1 -1
  35. package/dist/config.cjs +44 -4
  36. package/dist/config.cjs.map +1 -1
  37. package/dist/config.d.cts +1 -1
  38. package/dist/config.d.cts.map +1 -1
  39. package/dist/config.d.mts +1 -1
  40. package/dist/config.d.mts.map +1 -1
  41. package/dist/config.mjs +44 -4
  42. package/dist/config.mjs.map +1 -1
  43. package/dist/contract.cjs +9 -4
  44. package/dist/contract.cjs.map +1 -1
  45. package/dist/contract.d.cts +34 -24
  46. package/dist/contract.d.cts.map +1 -1
  47. package/dist/contract.d.mts +34 -24
  48. package/dist/contract.d.mts.map +1 -1
  49. package/dist/contract.meta.cjs +2 -1
  50. package/dist/contract.meta.cjs.map +1 -1
  51. package/dist/contract.meta.d.cts +3 -0
  52. package/dist/contract.meta.d.mts +3 -0
  53. package/dist/contract.meta.mjs +2 -1
  54. package/dist/contract.meta.mjs.map +1 -1
  55. package/dist/contract.mjs +9 -4
  56. package/dist/contract.mjs.map +1 -1
  57. package/dist/dag.cjs +176 -0
  58. package/dist/dag.cjs.map +1 -0
  59. package/dist/dag.d.cts +24 -0
  60. package/dist/dag.d.cts.map +1 -0
  61. package/dist/dag.d.mts +24 -0
  62. package/dist/dag.d.mts.map +1 -0
  63. package/dist/dag.mjs +167 -0
  64. package/dist/dag.mjs.map +1 -0
  65. package/dist/index.cjs +2 -0
  66. package/dist/index.d.cts +2 -2
  67. package/dist/index.d.mts +2 -2
  68. package/dist/index.mjs +2 -2
  69. package/dist/infra/planner.cjs +1 -1
  70. package/dist/infra/planner.mjs +1 -1
  71. package/dist/near-cli.cjs +1 -1
  72. package/dist/near-cli.mjs +1 -1
  73. package/dist/plugin.cjs +27 -18
  74. package/dist/plugin.cjs.map +1 -1
  75. package/dist/plugin.d.cts +57 -11
  76. package/dist/plugin.d.mts +57 -11
  77. package/dist/plugin.mjs +28 -19
  78. package/dist/plugin.mjs.map +1 -1
  79. package/dist/types.cjs +41 -6
  80. package/dist/types.cjs.map +1 -1
  81. package/dist/types.d.cts +118 -3
  82. package/dist/types.d.cts.map +1 -1
  83. package/dist/types.d.mts +118 -3
  84. package/dist/types.d.mts.map +1 -1
  85. package/dist/types.mjs +40 -7
  86. package/dist/types.mjs.map +1 -1
  87. package/package.json +6 -1
package/dist/cli.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.cjs","names":["colors","frames","icons","gradients","formatDuration","sumPhaseDurations","findConfigPath","findCommandDescriptor","resolveFrameworkPackage","bosPlugin","parseCommandInput","p","consumeDevSession","promptInitBasic","fetchParentConfig","promptInitOverrides","runDockerComposeUp"],"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,IAAIA,qBAAO,KAAKC,qBAAO,IAAI,EAAE,CAAC,CAAC;CACvC,QAAQ,IAAI,KAAKC,oBAAM,IAAI,GAAGC,wBAAU,MAAM,QAAQ,GAAG;CACzD,QAAQ,IAAIH,qBAAO,KAAKC,qBAAO,OAAO,EAAE,CAAC,CAAC;CAC1C,QAAQ,IAAI;CAEZ,QAAQ,IAAI,KAAKD,qBAAO,IAAI,SAAS,EAAE,IAAIA,qBAAO,KAAK,OAAO,OAAO,GAAG;CACxE,QAAQ,IAAI,KAAKA,qBAAO,IAAI,QAAQ,EAAE,KAAKA,qBAAO,MAAM,OAAO,UAAU,gBAAgB,GAAG;CAC5F,IAAI,OAAO,SACT,QAAQ,IAAI,KAAKA,qBAAO,IAAI,SAAS,EAAE,IAAIA,qBAAO,QAAQ,OAAO,QAAQ,MAAM,GAAG;CAEpF,QAAQ,IAAI;AAC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,QAAQ,IAAI;MACZ,QAAQ,IAAI,KAAKA,qBAAO,OAAO,GAAG,EAAE,iBAAiB;MACrD,KAAK,MAAM,KAAK,UACd,QAAQ,IAAI,OAAOA,qBAAO,IAAI,CAAC,GAAG;KAEtC;IACF;IACA,IAAI,aAAa,YACf,QAAQ,IACN,KAAKA,qBAAO,IAAI,UAAU,EAAE,cAAc,aAAa,WAAW,WACpE;SACK,IAAI,CAAC,QAAQ,IAAI,eACtB,QAAQ,IAAI,KAAKA,qBAAO,OAAO,UAAU,EAAE,iCAAiC;IAE9E,QAAQ,IAAI;IACZ;GACF;GAEA,IAAI,aAAa,WAAW,aAAa;IACvC,QAAQ,IAAI;IACZ,QAAQ,IAAIA,qBAAO,OAAO,GAAGE,oBAAM,IAAI,+CAA+C,CAAC;IACvF,QAAQ,IAAI,KAAKF,qBAAO,IAAI,eAAe,EAAE,GAAG,aAAa,aAAa;IAC1E,IAAI,aAAa,QACf,QAAQ,IAAI,KAAKA,qBAAO,IAAI,cAAc,EAAE,GAAG,aAAa,QAAQ;IAEtE,IAAI,aAAa,OACf,QAAQ,IAAI,KAAKA,qBAAO,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.cjs","names":["colors","frames","icons","gradients","formatDuration","sumPhaseDurations","findConfigPath","findCommandDescriptor","resolveFrameworkPackage","bosPlugin","parseCommandInput","p","consumeDevSession","promptInitBasic","fetchParentConfig","promptInitOverrides","runDockerComposeUp"],"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,IAAIA,qBAAO,KAAKC,qBAAO,IAAI,EAAE,CAAC,CAAC;CACvC,QAAQ,IAAI,KAAKC,oBAAM,IAAI,GAAGC,wBAAU,MAAM,QAAQ,GAAG;CACzD,QAAQ,IAAIH,qBAAO,KAAKC,qBAAO,OAAO,EAAE,CAAC,CAAC;CAC1C,QAAQ,IAAI;CAEZ,QAAQ,IAAI,KAAKD,qBAAO,IAAI,SAAS,EAAE,IAAIA,qBAAO,KAAK,OAAO,OAAO,GAAG;CACxE,QAAQ,IAAI,KA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QAAQ,IAAI;IACZ,QAAQ,IAAIA,qBAAO,OAAO,GAAGE,oBAAM,IAAI,+CAA+C,CAAC;IACvF,QAAQ,IAAI,KAAKF,qBAAO,IAAI,eAAe,EAAE,GAAG,aAAa,aAAa;IAC1E,IAAI,aAAa,QACf,QAAQ,IAAI,KAAKA,qBAAO,IAAI,cAAc,EAAE,GAAG,aAAa,QAAQ;IAEtE,IAAI,aAAa,OACf,QAAQ,IAAI,KAAKA,qBAAO,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"}
package/dist/cli.mjs CHANGED
@@ -108,7 +108,8 @@ async function main() {
108
108
  const commandArgs = invocationArgs.slice(consumed);
109
109
  const projectDir = configPath ? dirname(configPath) : void 0;
110
110
  const edResolved = projectDir ? resolveFrameworkPackage(projectDir, "everything-dev") : void 0;
111
- printBanner("everything-dev", edResolved?.installedVersion ? `${edResolved.installedVersion}${edResolved.isLinked ? " (linked)" : ""}` : void 0);
111
+ const displayVersion = edResolved?.installedVersion ? `${edResolved.installedVersion}${edResolved.isLinked ? " (linked)" : ""}` : void 0;
112
+ if (!process.env.BOS_NO_BANNER) printBanner("everything-dev", displayVersion);
112
113
  const pluginRuntime = createPluginRuntime({
113
114
  registry: { bos: { module: plugin_default } },
114
115
  secrets: {}
@@ -391,90 +392,83 @@ async function main() {
391
392
  return;
392
393
  }
393
394
  if (descriptor.key === "sync") {
395
+ if (input.json) {
396
+ console.log(JSON.stringify(result, null, 2));
397
+ return;
398
+ }
394
399
  console.log();
395
400
  if (result.status === "error") {
396
401
  console.error(`[CLI] ${result.error || "Unknown error"}`);
397
402
  process.exit(1);
398
403
  }
399
404
  if (result.status === "dry-run") console.log(colors.cyan(`${icons.ok} Dry run — no files written`));
400
- else console.log(colors.green(`${icons.ok} Template synced`));
401
- if (result.updated.length > 0) {
402
- console.log(` ${colors.dim("Updated:")} ${result.updated.length} file(s)`);
403
- for (const f of result.updated) console.log(` ${colors.dim(f)}`);
404
- }
405
- if (result.added.length > 0) {
406
- console.log(` ${colors.dim("Added:")} ${result.added.length} file(s)`);
407
- for (const f of result.added) console.log(` ${colors.dim(f)}`);
408
- }
409
- if (result.skipped.length > 0) {
410
- console.log(` ${colors.yellow("Skipped:")} ${result.skipped.length} file(s) (locally modified, use --force to overwrite)`);
411
- for (const f of result.skipped) console.log(` ${colors.dim(f)}`);
412
- }
413
- if (result.updated.length === 0 && result.added.length === 0 && result.skipped.length === 0) console.log(` ${colors.dim("Already up to date")}`);
414
- if (result.status !== "dry-run" && result.updated.length > 0) {
415
- console.log();
416
- console.log(colors.dim(" Review changes — your customizations take priority:"));
417
- console.log(colors.dim(" • api/src/contract.ts, api/src/index.ts, api/src/db/schema.ts — never overwritten"));
418
- console.log(colors.dim(" • ui/src/components/**, ui/src/styles.css — never overwritten"));
419
- console.log(colors.dim(" • Other updated files — accept framework improvements, then restore your changes"));
420
- console.log(colors.dim(" • Skipped files — yours already, only update with --force"));
405
+ else console.log(colors.green(`${icons.ok} Synced`));
406
+ if (result.updated.length > 0 || result.added.length > 0 || result.conflicted.length > 0) {
407
+ console.log(` ${colors.dim("Sync results:")} ${result.updated.length} updated, ${result.added.length} added, ${result.conflicted.length} conflicted`);
408
+ if (result.updated.length > 0) for (const f of result.updated) console.log(` ${colors.dim(f)}`);
409
+ if (result.added.length > 0) for (const f of result.added) console.log(` ${colors.dim(f)}`);
410
+ if (result.conflicted.length > 0) {
411
+ console.log(` ${colors.yellow("Conflicted")} (template applied, your changes backed up):`);
412
+ if (result.backupDir) console.log(` ${colors.dim(result.backupDir)}`);
413
+ for (const f of result.conflicted) console.log(` ${colors.dim(f)}`);
414
+ }
421
415
  }
416
+ if (result.updated.length === 0 && result.added.length === 0 && result.conflicted.length === 0) console.log(` ${colors.dim("Already up to date")}`);
422
417
  console.log();
423
418
  return;
424
419
  }
425
420
  if (descriptor.key === "upgrade") {
421
+ if (input.json) {
422
+ console.log(JSON.stringify(result, null, 2));
423
+ return;
424
+ }
426
425
  console.log();
427
426
  if (result.status === "error") {
428
427
  console.error(`[CLI] ${result.error || "Unknown error"}`);
429
428
  process.exit(1);
430
429
  }
431
430
  if (result.status === "dry-run") console.log(colors.cyan(`${icons.ok} Dry run — no changes applied`));
432
- else console.log(colors.green(`${icons.ok} Upgrade successful`));
433
- for (const pkg of result.packages) if (pkg.from && pkg.from !== pkg.to) console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.from} → ${pkg.to}`);
434
- else if (!pkg.from) console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.to} (new)`);
435
- else console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.to} (up to date)`);
436
- if (result.changelogUrl) console.log(` ${colors.dim("Changelog:")} ${result.changelogUrl}`);
437
- if (result.availablePlugins && result.availablePlugins.length > 0) console.log(` ${colors.dim("New parent plugins:")} ${result.availablePlugins.join(", ")}`);
438
- if (result.selectedPlugins && result.selectedPlugins.length > 0) console.log(` ${colors.dim("Added plugins:")} ${result.selectedPlugins.join(", ")}`);
439
- printTimingSummary(result.timings);
431
+ else console.log(colors.green(`${icons.ok} Upgrade complete`));
432
+ const mainPkg = result.packages.find((p) => p.name === "everything-dev");
433
+ const versionDelta = mainPkg?.from && mainPkg.from !== mainPkg.to ? `${mainPkg.from} → ${mainPkg.to}` : null;
434
+ if (versionDelta) console.log(` ${colors.dim(`Upgraded everything-dev ${versionDelta}`)}`);
435
+ for (const pkg of result.packages) {
436
+ if (pkg.name === "everything-dev") continue;
437
+ if (pkg.from && pkg.from !== pkg.to) console.log(` ${colors.dim(`${pkg.name} ${pkg.from} → ${pkg.to}`)}`);
438
+ else if (!pkg.from) console.log(` ${colors.dim(`${pkg.name} ${pkg.to} (new)`)}`);
439
+ else console.log(` ${colors.dim(`${pkg.name} ${pkg.to} (up to date)`)}`);
440
+ }
441
+ if (result.changelogUrl) console.log(` Changelog: ${result.changelogUrl}`);
442
+ if (result.selectedPlugins && result.selectedPlugins.length > 0) console.log(` Added plugins: ${result.selectedPlugins.join(", ")}`);
440
443
  if (result.sync) {
441
444
  const sync = result.sync;
442
- if (sync.updated.length > 0) {
443
- console.log(` ${colors.dim("Updated:")} ${sync.updated.length} file(s)`);
444
- for (const f of sync.updated) console.log(` ${colors.dim(f)}`);
445
- }
446
- if (sync.added.length > 0) {
447
- console.log(` ${colors.dim("Added:")} ${sync.added.length} file(s)`);
448
- for (const f of sync.added) console.log(` ${colors.dim(f)}`);
449
- }
450
- if (sync.skipped.length > 0) {
451
- console.log(` ${colors.yellow("Skipped:")} ${sync.skipped.length} file(s) (locally modified, use --force to overwrite)`);
452
- for (const f of sync.skipped) console.log(` ${colors.dim(f)}`);
453
- }
454
- if (result.status !== "dry-run" && (sync.updated.length > 0 || sync.added.length > 0 || sync.skipped.length > 0)) {
455
- console.log();
456
- console.log(colors.dim(" Resolve differences — your code takes priority:"));
457
- console.log();
458
- console.log(colors.dim(" Never overwritten (safe):"));
459
- console.log(colors.dim(" • api/src/contract.ts, api/src/index.ts, api/src/db/schema.ts"));
460
- console.log(colors.dim(" • ui/src/components/**, ui/src/styles.css"));
461
- console.log();
462
- console.log(colors.dim(" Replaced — review and keep your changes:"));
463
- console.log(colors.dim(" • api/drizzle.config.ts, api/tsconfig.json, api/tsconfig.contract.json"));
464
- console.log(colors.dim(" • api/plugin.dev.ts, api/rspack.config.js"));
465
- console.log(colors.dim(" • ui/src/routes/* (core routes only)"));
466
- console.log();
467
- console.log(colors.dim(" Merged — your deps preserved:"));
468
- console.log(colors.dim(" • package.json, api/package.json, ui/package.json"));
469
- console.log();
470
- console.log(colors.dim(" Skipped — already yours:"));
471
- console.log(colors.dim(" • Use --force only if you want framework updates"));
472
- }
445
+ console.log(` ${colors.dim("Sync results:")}`);
446
+ if (sync.updated.length > 0 || sync.added.length > 0 || sync.conflicted.length > 0) {
447
+ console.log(` ${sync.updated.length} updated, ${sync.added.length} added, ${sync.conflicted.length} conflicted`);
448
+ if (sync.conflicted.length > 0) {
449
+ console.log(` ${colors.yellow("Conflicted")} (template applied, your changes backed up):`);
450
+ if (sync.backupDir) console.log(` ${colors.dim(sync.backupDir)}`);
451
+ for (const f of sync.conflicted) console.log(` ${colors.dim(f)}`);
452
+ }
453
+ } else console.log(` ${colors.dim("Already up to date")}`);
473
454
  }
474
455
  if (result.migrated && result.migrated.length > 0) {
475
- console.log(` ${colors.yellow("Removed:")} ${result.migrated.length} obsolete file(s)`);
456
+ console.log(` Migrated: ${result.migrated.length} file(s)`);
476
457
  for (const f of result.migrated) console.log(` ${colors.dim(f)}`);
477
458
  }
459
+ if (versionDelta || result.sync && result.sync.conflicted.length > 0) {
460
+ console.log();
461
+ console.log(colors.dim(" For AI agents:"));
462
+ const parentRepo = "nearbuilders/everything-dev";
463
+ const somedelta = mainPkg?.from && mainPkg.to ? `v${mainPkg.from.replace(/^[\^~>=v]+/, "")}...v${mainPkg.to.replace(/^[\^~>=v]+/, "")}` : "";
464
+ console.log(colors.dim(` This upgrade applied template changes${somedelta ? ` (${somedelta})` : ""}.`));
465
+ if (result.sync && result.sync.conflicted.length > 0) {
466
+ console.log(colors.dim(` ${result.sync.conflicted.length} file(s) had local conflicts — template version applied, backups at ${result.sync.backupDir || ".bos/sync-backup/"}.`));
467
+ console.log(colors.dim(` If local changes should be preserved upstream, open a PR: https://github.com/${parentRepo}${somedelta ? `/compare/${somedelta}` : ""}`));
468
+ }
469
+ console.log(colors.dim(" Load matching intent skills: bunx @tanstack/intent@latest load everything-dev#..."));
470
+ console.log(colors.dim(" Review AGENTS.md — local updates may need merging."));
471
+ }
478
472
  console.log();
479
473
  return;
480
474
  }
@@ -586,22 +580,40 @@ async function main() {
586
580
  process.exit(1);
587
581
  }
588
582
  console.log(colors.green(`${icons.ok} Types generated`));
589
- if (result.source) console.log(` ${colors.dim("Mode:")} ${result.source === "remote" ? colors.cyan("remote") : colors.dim("local")}`);
590
583
  if (result.generated.length > 0) {
591
- console.log(` ${colors.dim("Generated:")}`);
584
+ console.log(` ${colors.dim("Written:")}`);
592
585
  for (const f of result.generated) console.log(` ${colors.dim(f)}`);
593
586
  }
594
- if (result.fetched.length > 0) {
595
- console.log(` ${colors.dim("Fetched (remote):")}`);
596
- for (const url of result.fetched) console.log(` ${colors.dim(url)}`);
597
- }
598
- if (result.skipped.length > 0) {
599
- console.log(` ${colors.dim("Skipped:")}`);
600
- for (const s of result.skipped) console.log(` ${colors.dim(s)}`);
587
+ if (result.fetched.length > 0 || result.skipped.length > 0 || result.failed.length > 0) {
588
+ console.log(` ${colors.dim("Contract sources:")}`);
589
+ for (const entry of result.fetched) {
590
+ const space = entry.indexOf(" ");
591
+ const key = space !== -1 ? entry.slice(0, space) : entry;
592
+ const rest = space !== -1 ? entry.slice(space + 1) : "";
593
+ const restSpace = rest.indexOf(" ");
594
+ const detail = restSpace !== -1 ? rest.slice(restSpace + 1) : "";
595
+ console.log(` ${key} ${colors.cyan("remote")}${detail ? ` ${colors.dim(detail)}` : ""}`);
596
+ }
597
+ for (const entry of result.skipped) {
598
+ const space = entry.indexOf(" ");
599
+ const key = space !== -1 ? entry.slice(0, space) : entry;
600
+ const rest = space !== -1 ? entry.slice(space + 1) : "";
601
+ if (rest === "no URL resolved") {
602
+ console.log(` ${key} ${colors.dim("no URL resolved")}`);
603
+ continue;
604
+ }
605
+ const restSpace = rest.indexOf(" ");
606
+ const detail = restSpace !== -1 ? rest.slice(restSpace + 1) : "";
607
+ console.log(` ${key} ${colors.dim("local")}${detail ? ` ${colors.dim(detail)}` : ""}`);
608
+ }
601
609
  }
602
610
  if (result.failed.length > 0) {
603
611
  console.log(` ${colors.yellow("Failed:")}`);
604
- for (const f of result.failed) console.log(` ${colors.error(f)}`);
612
+ for (const f of result.failed) {
613
+ const colon = f.indexOf(": ");
614
+ if (colon !== -1) console.log(` ${colors.error(f.slice(0, colon))}${colors.dim(f.slice(colon))}`);
615
+ else console.log(` ${colors.error(f)}`);
616
+ }
605
617
  }
606
618
  console.log();
607
619
  return;