everything-dev 1.49.0 → 1.50.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 (142) hide show
  1. package/dist/app.cjs +66 -86
  2. package/dist/app.cjs.map +1 -1
  3. package/dist/app.mjs +66 -87
  4. package/dist/app.mjs.map +1 -1
  5. package/dist/cli/db-doctor.cjs +6 -23
  6. package/dist/cli/db-doctor.cjs.map +1 -1
  7. package/dist/cli/db-doctor.mjs +7 -24
  8. package/dist/cli/db-doctor.mjs.map +1 -1
  9. package/dist/cli/db-repair.cjs +25 -20
  10. package/dist/cli/db-repair.cjs.map +1 -1
  11. package/dist/cli/db-repair.mjs +25 -20
  12. package/dist/cli/db-repair.mjs.map +1 -1
  13. package/dist/cli/db-studio.cjs +4 -2
  14. package/dist/cli/db-studio.cjs.map +1 -1
  15. package/dist/cli/db-studio.mjs +5 -3
  16. package/dist/cli/db-studio.mjs.map +1 -1
  17. package/dist/cli/framework-version.cjs +45 -9
  18. package/dist/cli/framework-version.cjs.map +1 -1
  19. package/dist/cli/framework-version.mjs +45 -10
  20. package/dist/cli/framework-version.mjs.map +1 -1
  21. package/dist/cli/infra.cjs +89 -3
  22. package/dist/cli/infra.cjs.map +1 -1
  23. package/dist/cli/infra.mjs +83 -4
  24. package/dist/cli/infra.mjs.map +1 -1
  25. package/dist/cli/init.cjs +39 -15
  26. package/dist/cli/init.cjs.map +1 -1
  27. package/dist/cli/init.d.cts +8 -3
  28. package/dist/cli/init.d.cts.map +1 -1
  29. package/dist/cli/init.d.mts +8 -3
  30. package/dist/cli/init.d.mts.map +1 -1
  31. package/dist/cli/init.mjs +39 -16
  32. package/dist/cli/init.mjs.map +1 -1
  33. package/dist/cli/status.cjs +6 -2
  34. package/dist/cli/status.cjs.map +1 -1
  35. package/dist/cli/status.mjs +7 -3
  36. package/dist/cli/status.mjs.map +1 -1
  37. package/dist/cli/sync.cjs +1 -3
  38. package/dist/cli/sync.cjs.map +1 -1
  39. package/dist/cli/sync.mjs +1 -3
  40. package/dist/cli/sync.mjs.map +1 -1
  41. package/dist/cli/upgrade.cjs +8 -4
  42. package/dist/cli/upgrade.cjs.map +1 -1
  43. package/dist/cli/upgrade.mjs +8 -4
  44. package/dist/cli/upgrade.mjs.map +1 -1
  45. package/dist/cli.cjs +73 -9
  46. package/dist/cli.cjs.map +1 -1
  47. package/dist/cli.mjs +74 -10
  48. package/dist/cli.mjs.map +1 -1
  49. package/dist/config.cjs +7 -3
  50. package/dist/config.cjs.map +1 -1
  51. package/dist/config.d.cts.map +1 -1
  52. package/dist/config.d.mts.map +1 -1
  53. package/dist/config.mjs +7 -3
  54. package/dist/config.mjs.map +1 -1
  55. package/dist/contract.cjs +76 -4
  56. package/dist/contract.cjs.map +1 -1
  57. package/dist/contract.d.cts +164 -19
  58. package/dist/contract.d.cts.map +1 -1
  59. package/dist/contract.d.mts +164 -19
  60. package/dist/contract.d.mts.map +1 -1
  61. package/dist/contract.meta.cjs +17 -2
  62. package/dist/contract.meta.cjs.map +1 -1
  63. package/dist/contract.meta.d.cts +23 -2
  64. package/dist/contract.meta.d.mts +23 -2
  65. package/dist/contract.meta.mjs +17 -2
  66. package/dist/contract.meta.mjs.map +1 -1
  67. package/dist/contract.mjs +72 -5
  68. package/dist/contract.mjs.map +1 -1
  69. package/dist/db.cjs +32 -24
  70. package/dist/db.cjs.map +1 -1
  71. package/dist/db.d.cts +16 -9
  72. package/dist/db.d.cts.map +1 -1
  73. package/dist/db.d.mts +16 -9
  74. package/dist/db.d.mts.map +1 -1
  75. package/dist/db.mjs +32 -23
  76. package/dist/db.mjs.map +1 -1
  77. package/dist/dev-session.cjs +28 -0
  78. package/dist/dev-session.cjs.map +1 -1
  79. package/dist/dev-session.mjs +29 -1
  80. package/dist/dev-session.mjs.map +1 -1
  81. package/dist/index.cjs +5 -0
  82. package/dist/index.d.cts +2 -2
  83. package/dist/index.d.mts +2 -2
  84. package/dist/index.mjs +2 -2
  85. package/dist/infra/planner.cjs +337 -0
  86. package/dist/infra/planner.cjs.map +1 -0
  87. package/dist/infra/planner.mjs +336 -0
  88. package/dist/infra/planner.mjs.map +1 -0
  89. package/dist/infra/preflight.cjs +131 -0
  90. package/dist/infra/preflight.cjs.map +1 -0
  91. package/dist/infra/preflight.mjs +130 -0
  92. package/dist/infra/preflight.mjs.map +1 -0
  93. package/dist/infra/types.cjs +9 -0
  94. package/dist/infra/types.cjs.map +1 -0
  95. package/dist/infra/types.mjs +8 -0
  96. package/dist/infra/types.mjs.map +1 -0
  97. package/dist/near-cli.cjs +37 -0
  98. package/dist/near-cli.cjs.map +1 -1
  99. package/dist/near-cli.mjs +36 -1
  100. package/dist/near-cli.mjs.map +1 -1
  101. package/dist/orchestrator.cjs +10 -2
  102. package/dist/orchestrator.cjs.map +1 -1
  103. package/dist/orchestrator.mjs +10 -2
  104. package/dist/orchestrator.mjs.map +1 -1
  105. package/dist/plugin.cjs +160 -43
  106. package/dist/plugin.cjs.map +1 -1
  107. package/dist/plugin.d.cts +64 -8
  108. package/dist/plugin.d.cts.map +1 -1
  109. package/dist/plugin.d.mts +64 -8
  110. package/dist/plugin.d.mts.map +1 -1
  111. package/dist/plugin.mjs +164 -47
  112. package/dist/plugin.mjs.map +1 -1
  113. package/dist/process-registry.cjs +88 -0
  114. package/dist/process-registry.cjs.map +1 -0
  115. package/dist/process-registry.mjs +83 -0
  116. package/dist/process-registry.mjs.map +1 -0
  117. package/dist/publish.cjs +4 -0
  118. package/dist/publish.cjs.map +1 -1
  119. package/dist/publish.mjs +4 -0
  120. package/dist/publish.mjs.map +1 -1
  121. package/dist/service-descriptor.cjs +4 -0
  122. package/dist/service-descriptor.cjs.map +1 -1
  123. package/dist/service-descriptor.mjs +4 -1
  124. package/dist/service-descriptor.mjs.map +1 -1
  125. package/dist/types.d.cts +2 -2
  126. package/dist/types.d.mts +2 -2
  127. package/dist/ui/index.cjs +2 -1
  128. package/dist/ui/index.d.cts +2 -2
  129. package/dist/ui/index.d.mts +2 -2
  130. package/dist/ui/index.mjs +2 -2
  131. package/dist/ui/router.cjs +40 -0
  132. package/dist/ui/router.cjs.map +1 -1
  133. package/dist/ui/router.d.cts +6 -1
  134. package/dist/ui/router.d.cts.map +1 -1
  135. package/dist/ui/router.d.mts +6 -1
  136. package/dist/ui/router.d.mts.map +1 -1
  137. package/dist/ui/router.mjs +40 -1
  138. package/dist/ui/router.mjs.map +1 -1
  139. package/package.json +4 -1
  140. package/skills/cli-reference/SKILL.md +5 -4
  141. package/skills/dev-workflow/SKILL.md +40 -11
  142. package/skills/plugin-development/SKILL.md +9 -2
package/dist/cli.cjs CHANGED
@@ -5,6 +5,7 @@ const require_timing = require('./cli/timing.cjs');
5
5
  const require_theme = require('./utils/theme.cjs');
6
6
  const require_infra = require('./cli/infra.cjs');
7
7
  const require_cli_init = require('./cli/init.cjs');
8
+ const require_framework_version = require('./cli/framework-version.cjs');
8
9
  const require_plugin = require('./plugin.cjs');
9
10
  const require_catalog = require('./cli/catalog.cjs');
10
11
  const require_help = require('./cli/help.cjs');
@@ -80,7 +81,9 @@ async function warnIfOutdated(client, command) {
80
81
  const status = await client.status();
81
82
  if (status.status === "error" || !status.packages) return;
82
83
  const frameworkPackages = ["everything-dev", "every-plugin"];
83
- const outdated = status.packages.filter((p) => p.installed && p.latest && normalizeVersion(p.installed) !== normalizeVersion(p.latest) && frameworkPackages.includes(p.name));
84
+ const linked = status.packages.filter((p) => p.isLinked);
85
+ const outdated = status.packages.filter((p) => !p.isLinked && p.installed && p.latest && normalizeVersion(p.installed) !== normalizeVersion(p.latest) && frameworkPackages.includes(p.name));
86
+ if (linked.length > 0) for (const pkg of linked) console.log(require_theme.colors.dim(` ${pkg.name} is linked locally (v${pkg.installed})`));
84
87
  if (outdated.length === 0) return;
85
88
  console.log();
86
89
  console.log(require_theme.colors.yellow(` ! Outdated packages detected:`));
@@ -105,7 +108,9 @@ async function main() {
105
108
  }
106
109
  const { descriptor, consumed } = commandMatch;
107
110
  const commandArgs = invocationArgs.slice(consumed);
108
- require_banner.printBanner();
111
+ const projectDir = configPath ? (0, node_path.dirname)(configPath) : void 0;
112
+ const edResolved = projectDir ? require_framework_version.resolveFrameworkPackage(projectDir, "everything-dev") : void 0;
113
+ require_banner.printBanner("everything-dev", edResolved?.installedVersion ? `${edResolved.installedVersion}${edResolved.isLinked ? " (linked)" : ""}` : void 0);
109
114
  const pluginRuntime = (0, every_plugin.createPluginRuntime)({
110
115
  registry: { bos: { module: require_plugin.default } },
111
116
  secrets: {}
@@ -343,7 +348,7 @@ async function main() {
343
348
  case "healthy": return "✓";
344
349
  case "empty": return "○";
345
350
  case "unapplied": return "○";
346
- case "legacy-importable": return "";
351
+ case "untracked-existing-schema": return "";
347
352
  case "drift-safe-repair": return "⚠";
348
353
  case "drift-manual": return "✗";
349
354
  default: return "?";
@@ -353,7 +358,6 @@ async function main() {
353
358
  console.log(` ${require_theme.colors.dim(`Journal:`)} ${result.journalSchema}.${result.journalTable}`);
354
359
  console.log(` ${require_theme.colors.dim(`Local migrations:`)} ${result.localMigrationCount}`);
355
360
  console.log(` ${require_theme.colors.dim(`Applied hashes:`)} ${result.appliedHashCount}`);
356
- if (result.legacyCount > 0) console.log(` ${require_theme.colors.dim(`Legacy rows (matching):`)} ${result.legacyCount}`);
357
361
  if (result.expectedTables.length > 0) console.log(` ${require_theme.colors.dim(`Expected tables:`)} ${result.expectedTables.join(", ")}`);
358
362
  if (result.missingTables.length > 0) console.log(` ${require_theme.colors.yellow(`Missing tables:`)} ${result.missingTables.join(", ")}`);
359
363
  console.log(` ${require_theme.colors.dim(`Diagnosis:`)} ${result.diagnosis}`);
@@ -515,6 +519,68 @@ async function main() {
515
519
  console.log();
516
520
  return;
517
521
  }
522
+ if (descriptor.key === "ps") {
523
+ const psResult = result;
524
+ console.log();
525
+ if (psResult.status === "error") {
526
+ console.error(`[CLI] ${psResult.error || "Unknown error"}`);
527
+ process.exit(1);
528
+ }
529
+ const entries = psResult.entries ?? [];
530
+ if (entries.length === 0) {
531
+ console.log(require_theme.colors.dim(" No tracked development processes running."));
532
+ console.log();
533
+ console.log(require_theme.colors.dim(` Start one with ${require_theme.colors.cyan("bos dev")} and it will appear here.`));
534
+ console.log();
535
+ return;
536
+ }
537
+ console.log(require_theme.colors.cyan(require_theme.frames.top(60)));
538
+ console.log(` ${require_theme.icons.app} ${require_theme.gradients.cyber("PROCESSES")}`);
539
+ console.log(require_theme.colors.cyan(require_theme.frames.bottom(60)));
540
+ console.log();
541
+ for (const entry of entries) {
542
+ const ageMs = Date.now() - entry.startedAt;
543
+ const ageStr = ageMs < 6e4 ? `${Math.floor(ageMs / 1e3)}s` : ageMs < 36e5 ? `${Math.floor(ageMs / 6e4)}m` : `${Math.floor(ageMs / 36e5)}h`;
544
+ const roleTag = entry.role === "workspace-parent" ? require_theme.colors.magenta("parent") : entry.role === "workspace-child" ? require_theme.colors.blue("child") : require_theme.colors.dim("dev");
545
+ console.log(` ${require_theme.colors.green(`pid ${entry.pid}`)} ${roleTag} ${require_theme.colors.dim(ageStr)}`);
546
+ console.log(` ${require_theme.colors.dim("dir:")} ${entry.configDir}`);
547
+ if (entry.parentPid !== void 0) console.log(` ${require_theme.colors.dim("parent:")} ${entry.parentPid}`);
548
+ const portPairs = Object.entries(entry.ports ?? {}).filter(([, p]) => typeof p === "number").map(([k, v]) => `${k}=${v}`);
549
+ if (portPairs.length > 0) console.log(` ${require_theme.colors.dim("ports:")} ${portPairs.join(" ")}`);
550
+ if (entry.budget) console.log(` ${require_theme.colors.dim("budget:")} [${entry.budget.min}, ${entry.budget.max}]`);
551
+ console.log(` ${require_theme.colors.dim("desc:")} ${entry.description}`);
552
+ console.log();
553
+ }
554
+ return;
555
+ }
556
+ if (descriptor.key === "kill") {
557
+ const killResult = result;
558
+ console.log();
559
+ if (killResult.status === "error") {
560
+ console.error(`[CLI] ${killResult.error || "Unknown error"}`);
561
+ process.exit(1);
562
+ }
563
+ if (killResult.killed.length > 0) {
564
+ console.log(require_theme.colors.green(`${require_theme.icons.ok} Sent ${killResult.killed.length} kill signal(s)`));
565
+ for (const k of killResult.killed) console.log(` ${require_theme.colors.dim("pid")} ${k.pid} ${require_theme.colors.dim(k.configDir)}`);
566
+ }
567
+ if (killResult.skipped.length > 0) {
568
+ console.log(require_theme.colors.yellow(`${require_theme.icons.err} ${killResult.skipped.length} skipped`));
569
+ for (const s of killResult.skipped) console.log(` ${require_theme.colors.dim("pid")} ${s.pid} ${require_theme.colors.dim(s.reason)}`);
570
+ }
571
+ if (killResult.killed.length === 0 && killResult.skipped.length === 0) {
572
+ const opts = input;
573
+ if (opts.all) console.log(require_theme.colors.dim(" No tracked processes to kill."));
574
+ else {
575
+ const configPath = require_config.findConfigPath();
576
+ const dir = opts.configDir ?? (configPath ? (0, node_path.resolve)((0, node_path.dirname)(configPath)) : process.cwd());
577
+ console.log(require_theme.colors.dim(` No tracked processes for ${dir}`));
578
+ console.log(require_theme.colors.dim(` Use ${require_theme.colors.cyan("--all")} to kill across all directories.`));
579
+ }
580
+ }
581
+ console.log();
582
+ return;
583
+ }
518
584
  if (descriptor.key === "typesGen") {
519
585
  console.log();
520
586
  if (result.status === "error") {
@@ -549,12 +615,10 @@ async function main() {
549
615
  if (descriptor.key === "keyPublish") {
550
616
  process.stdout.write(`Generated publish key for ${result.account}\n`);
551
617
  process.stdout.write(` Network: ${result.network}\n`);
552
- process.stdout.write(` Contract: ${result.contract}\n`);
553
618
  process.stdout.write(` Allowance: ${result.allowance}\n`);
554
- process.stdout.write(` Functions: ${result.functionNames.join(", ")}\n`);
555
- process.stdout.write(` Public key: ${result.publicKey}\n`);
556
- process.stdout.write(` Private key: ${result.privateKey}\n`);
557
- process.stdout.write(` Copy: NEAR_PRIVATE_KEY=${result.privateKey}\n`);
619
+ process.stdout.write(`\n`);
620
+ process.stdout.write(` Set this as NEAR_PRIVATE_KEY in GitHub Actions or before calling publish:\n`);
621
+ process.stdout.write(` NEAR_PRIVATE_KEY=${result.privateKey}\n`);
558
622
  }
559
623
  if (descriptor.key === "pluginAdd") {
560
624
  console.log();
package/dist/cli.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.cjs","names":["colors","frames","icons","gradients","formatDuration","sumPhaseDurations","findConfigPath","findCommandDescriptor","bosPlugin","parseCommandInput","p","consumeDevSession","promptInitBasic","fetchParentConfig","promptInitOverrides","runDockerComposeUp"],"sources":["../src/cli.ts"],"sourcesContent":["import { dirname } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport { findCommandDescriptor } from \"./cli/catalog\";\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 OverrideSection,\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 outdated = status.packages.filter(\n (p: { name: string; installed?: string; latest?: string }) =>\n p.installed &&\n p.latest &&\n normalizeVersion(p.installed) !== normalizeVersion(p.latest) &&\n frameworkPackages.includes(p.name),\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 printBanner();\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 \"legacy-importable\":\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.legacyCount > 0) {\n console.log(` ${colors.dim(`Legacy rows (matching):`)} ${result.legacyCount}`);\n }\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 === \"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(` Contract: ${result.contract}\\n`);\n process.stdout.write(` Allowance: ${result.allowance}\\n`);\n process.stdout.write(` Functions: ${result.functionNames.join(\", \")}\\n`);\n process.stdout.write(` Public key: ${result.publicKey}\\n`);\n process.stdout.write(` Private key: ${result.privateKey}\\n`);\n process.stdout.write(` Copy: 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":";;;;;;;;;;;;;;;;;;AAyBA,SAAS,gBAAgB,QAStB;AACD,SAAQ,KAAK;AACb,SAAQ,IAAIA,qBAAO,KAAKC,qBAAO,IAAI,GAAG,CAAC,CAAC;AACxC,SAAQ,IAAI,KAAKC,oBAAM,IAAI,GAAGC,wBAAU,MAAM,SAAS,GAAG;AAC1D,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IAAI,KAAKA,qBAAO,IAAI,WAAW,CAAC,GAAG,aAAa,QAAQ;AAElE,YAAQ,KAAK;AACb,YAAQ,KAAK,EAAE;;;UAGZ,OAAO;AACd,UAAQ,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GAAG;AAChF,UAAQ,KAAK,EAAE;;;AAId,MAAM,CAAC,OAAO,UAAU;AAC3B,SAAQ,MAAM,sBAAsB,MAAM;AAC1C,SAAQ,KAAK,EAAE;EACf"}
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;AACD,SAAQ,KAAK;AACb,SAAQ,IAAIA,qBAAO,KAAKC,qBAAO,IAAI,GAAG,CAAC,CAAC;AACxC,SAAQ,IAAI,KAAKC,oBAAM,IAAI,GAAGC,wBAAU,MAAM,SAAS,GAAG;AAC1D,SAAQ,IAAIH,qBAAO,KAAKC,qBAAO,OAAO,GAAG,CAAC,CAAC;AAC3C,SAAQ,KAAK;AAEb,SAAQ,IAAI,KAAKD,qBAAO,IAAI,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YACnE;aACQ,CAAC,QAAQ,IAAI,cACtB,SAAQ,IAAI,KAAKA,qBAAO,OAAO,WAAW,CAAC,kCAAkC;AAE/E,YAAQ,KAAK;AACb;;AAGF,OAAI,aAAa,WAAW,aAAa;AACvC,YAAQ,KAAK;AACb,YAAQ,IAAIA,qBAAO,OAAO,GAAGE,oBAAM,IAAI,gDAAgD,CAAC;AACxF,YAAQ,IAAI,KAAKF,qBAAO,IAAI,gBAAgB,CAAC,GAAG,aAAa,cAAc;AAC3E,QAAI,aAAa,OACf,SAAQ,IAAI,KAAKA,qBAAO,IAAI,eAAe,CAAC,GAAG,aAAa,SAAS;AAEvE,QAAI,aAAa,MACf,SAAQ,IAAI,KAAKA,qBAAO,IAAI,WAAW,CAAC,GAAG,aAAa,QAAQ;AAElE,YAAQ,KAAK;AACb,YAAQ,KAAK,EAAE;;;UAGZ,OAAO;AACd,UAAQ,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GAAG;AAChF,UAAQ,KAAK,EAAE;;;AAId,MAAM,CAAC,OAAO,UAAU;AAC3B,SAAQ,MAAM,sBAAsB,MAAM;AAC1C,SAAQ,KAAK,EAAE;EACf"}
package/dist/cli.mjs CHANGED
@@ -5,13 +5,14 @@ import { formatDuration, sumPhaseDurations } from "./cli/timing.mjs";
5
5
  import { colors, frames, gradients, icons } from "./utils/theme.mjs";
6
6
  import { loadProjectEnv } from "./cli/infra.mjs";
7
7
  import { fetchParentConfig, runDockerComposeUp } from "./cli/init.mjs";
8
+ import { resolveFrameworkPackage } from "./cli/framework-version.mjs";
8
9
  import plugin_default, { consumeDevSession, pluginEvents } from "./plugin.mjs";
9
10
  import { findCommandDescriptor } from "./cli/catalog.mjs";
10
11
  import { printHelp } from "./cli/help.mjs";
11
12
  import { parseCommandInput } from "./cli/parse.mjs";
12
13
  import { promptInitBasic, promptInitOverrides } from "./cli/prompts.mjs";
13
14
  import { printBanner } from "./utils/banner.mjs";
14
- import { dirname } from "node:path";
15
+ import { dirname, resolve } from "node:path";
15
16
  import * as p from "@clack/prompts";
16
17
 
17
18
  //#region src/cli.ts
@@ -78,7 +79,9 @@ async function warnIfOutdated(client, command) {
78
79
  const status = await client.status();
79
80
  if (status.status === "error" || !status.packages) return;
80
81
  const frameworkPackages = ["everything-dev", "every-plugin"];
81
- const outdated = status.packages.filter((p) => p.installed && p.latest && normalizeVersion(p.installed) !== normalizeVersion(p.latest) && frameworkPackages.includes(p.name));
82
+ const linked = status.packages.filter((p) => p.isLinked);
83
+ const outdated = status.packages.filter((p) => !p.isLinked && p.installed && p.latest && normalizeVersion(p.installed) !== normalizeVersion(p.latest) && frameworkPackages.includes(p.name));
84
+ if (linked.length > 0) for (const pkg of linked) console.log(colors.dim(` ${pkg.name} is linked locally (v${pkg.installed})`));
82
85
  if (outdated.length === 0) return;
83
86
  console.log();
84
87
  console.log(colors.yellow(` ! Outdated packages detected:`));
@@ -103,7 +106,9 @@ async function main() {
103
106
  }
104
107
  const { descriptor, consumed } = commandMatch;
105
108
  const commandArgs = invocationArgs.slice(consumed);
106
- printBanner();
109
+ const projectDir = configPath ? dirname(configPath) : void 0;
110
+ const edResolved = projectDir ? resolveFrameworkPackage(projectDir, "everything-dev") : void 0;
111
+ printBanner("everything-dev", edResolved?.installedVersion ? `${edResolved.installedVersion}${edResolved.isLinked ? " (linked)" : ""}` : void 0);
107
112
  const pluginRuntime = createPluginRuntime({
108
113
  registry: { bos: { module: plugin_default } },
109
114
  secrets: {}
@@ -341,7 +346,7 @@ async function main() {
341
346
  case "healthy": return "✓";
342
347
  case "empty": return "○";
343
348
  case "unapplied": return "○";
344
- case "legacy-importable": return "";
349
+ case "untracked-existing-schema": return "";
345
350
  case "drift-safe-repair": return "⚠";
346
351
  case "drift-manual": return "✗";
347
352
  default: return "?";
@@ -351,7 +356,6 @@ async function main() {
351
356
  console.log(` ${colors.dim(`Journal:`)} ${result.journalSchema}.${result.journalTable}`);
352
357
  console.log(` ${colors.dim(`Local migrations:`)} ${result.localMigrationCount}`);
353
358
  console.log(` ${colors.dim(`Applied hashes:`)} ${result.appliedHashCount}`);
354
- if (result.legacyCount > 0) console.log(` ${colors.dim(`Legacy rows (matching):`)} ${result.legacyCount}`);
355
359
  if (result.expectedTables.length > 0) console.log(` ${colors.dim(`Expected tables:`)} ${result.expectedTables.join(", ")}`);
356
360
  if (result.missingTables.length > 0) console.log(` ${colors.yellow(`Missing tables:`)} ${result.missingTables.join(", ")}`);
357
361
  console.log(` ${colors.dim(`Diagnosis:`)} ${result.diagnosis}`);
@@ -513,6 +517,68 @@ async function main() {
513
517
  console.log();
514
518
  return;
515
519
  }
520
+ if (descriptor.key === "ps") {
521
+ const psResult = result;
522
+ console.log();
523
+ if (psResult.status === "error") {
524
+ console.error(`[CLI] ${psResult.error || "Unknown error"}`);
525
+ process.exit(1);
526
+ }
527
+ const entries = psResult.entries ?? [];
528
+ if (entries.length === 0) {
529
+ console.log(colors.dim(" No tracked development processes running."));
530
+ console.log();
531
+ console.log(colors.dim(` Start one with ${colors.cyan("bos dev")} and it will appear here.`));
532
+ console.log();
533
+ return;
534
+ }
535
+ console.log(colors.cyan(frames.top(60)));
536
+ console.log(` ${icons.app} ${gradients.cyber("PROCESSES")}`);
537
+ console.log(colors.cyan(frames.bottom(60)));
538
+ console.log();
539
+ for (const entry of entries) {
540
+ const ageMs = Date.now() - entry.startedAt;
541
+ const ageStr = ageMs < 6e4 ? `${Math.floor(ageMs / 1e3)}s` : ageMs < 36e5 ? `${Math.floor(ageMs / 6e4)}m` : `${Math.floor(ageMs / 36e5)}h`;
542
+ const roleTag = entry.role === "workspace-parent" ? colors.magenta("parent") : entry.role === "workspace-child" ? colors.blue("child") : colors.dim("dev");
543
+ console.log(` ${colors.green(`pid ${entry.pid}`)} ${roleTag} ${colors.dim(ageStr)}`);
544
+ console.log(` ${colors.dim("dir:")} ${entry.configDir}`);
545
+ if (entry.parentPid !== void 0) console.log(` ${colors.dim("parent:")} ${entry.parentPid}`);
546
+ const portPairs = Object.entries(entry.ports ?? {}).filter(([, p]) => typeof p === "number").map(([k, v]) => `${k}=${v}`);
547
+ if (portPairs.length > 0) console.log(` ${colors.dim("ports:")} ${portPairs.join(" ")}`);
548
+ if (entry.budget) console.log(` ${colors.dim("budget:")} [${entry.budget.min}, ${entry.budget.max}]`);
549
+ console.log(` ${colors.dim("desc:")} ${entry.description}`);
550
+ console.log();
551
+ }
552
+ return;
553
+ }
554
+ if (descriptor.key === "kill") {
555
+ const killResult = result;
556
+ console.log();
557
+ if (killResult.status === "error") {
558
+ console.error(`[CLI] ${killResult.error || "Unknown error"}`);
559
+ process.exit(1);
560
+ }
561
+ if (killResult.killed.length > 0) {
562
+ console.log(colors.green(`${icons.ok} Sent ${killResult.killed.length} kill signal(s)`));
563
+ for (const k of killResult.killed) console.log(` ${colors.dim("pid")} ${k.pid} ${colors.dim(k.configDir)}`);
564
+ }
565
+ if (killResult.skipped.length > 0) {
566
+ console.log(colors.yellow(`${icons.err} ${killResult.skipped.length} skipped`));
567
+ for (const s of killResult.skipped) console.log(` ${colors.dim("pid")} ${s.pid} ${colors.dim(s.reason)}`);
568
+ }
569
+ if (killResult.killed.length === 0 && killResult.skipped.length === 0) {
570
+ const opts = input;
571
+ if (opts.all) console.log(colors.dim(" No tracked processes to kill."));
572
+ else {
573
+ const configPath = findConfigPath();
574
+ const dir = opts.configDir ?? (configPath ? resolve(dirname(configPath)) : process.cwd());
575
+ console.log(colors.dim(` No tracked processes for ${dir}`));
576
+ console.log(colors.dim(` Use ${colors.cyan("--all")} to kill across all directories.`));
577
+ }
578
+ }
579
+ console.log();
580
+ return;
581
+ }
516
582
  if (descriptor.key === "typesGen") {
517
583
  console.log();
518
584
  if (result.status === "error") {
@@ -547,12 +613,10 @@ async function main() {
547
613
  if (descriptor.key === "keyPublish") {
548
614
  process.stdout.write(`Generated publish key for ${result.account}\n`);
549
615
  process.stdout.write(` Network: ${result.network}\n`);
550
- process.stdout.write(` Contract: ${result.contract}\n`);
551
616
  process.stdout.write(` Allowance: ${result.allowance}\n`);
552
- process.stdout.write(` Functions: ${result.functionNames.join(", ")}\n`);
553
- process.stdout.write(` Public key: ${result.publicKey}\n`);
554
- process.stdout.write(` Private key: ${result.privateKey}\n`);
555
- process.stdout.write(` Copy: NEAR_PRIVATE_KEY=${result.privateKey}\n`);
617
+ process.stdout.write(`\n`);
618
+ process.stdout.write(` Set this as NEAR_PRIVATE_KEY in GitHub Actions or before calling publish:\n`);
619
+ process.stdout.write(` NEAR_PRIVATE_KEY=${result.privateKey}\n`);
556
620
  }
557
621
  if (descriptor.key === "pluginAdd") {
558
622
  console.log();