everything-dev 1.26.0 → 1.27.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 (121) hide show
  1. package/dist/api-contract.cjs.map +1 -1
  2. package/dist/api-contract.mjs.map +1 -1
  3. package/dist/cli/catalog.cjs.map +1 -1
  4. package/dist/cli/catalog.mjs.map +1 -1
  5. package/dist/cli/framework-version.cjs.map +1 -1
  6. package/dist/cli/framework-version.mjs.map +1 -1
  7. package/dist/cli/infra.cjs.map +1 -1
  8. package/dist/cli/infra.mjs.map +1 -1
  9. package/dist/cli/init.cjs +127 -114
  10. package/dist/cli/init.cjs.map +1 -1
  11. package/dist/cli/init.d.cts +7 -6
  12. package/dist/cli/init.d.cts.map +1 -1
  13. package/dist/cli/init.d.mts +7 -6
  14. package/dist/cli/init.d.mts.map +1 -1
  15. package/dist/cli/init.mjs +124 -114
  16. package/dist/cli/init.mjs.map +1 -1
  17. package/dist/cli/parse.cjs.map +1 -1
  18. package/dist/cli/parse.mjs.map +1 -1
  19. package/dist/cli/prompts.cjs +3 -3
  20. package/dist/cli/prompts.cjs.map +1 -1
  21. package/dist/cli/prompts.mjs +2 -2
  22. package/dist/cli/prompts.mjs.map +1 -1
  23. package/dist/cli/status.cjs.map +1 -1
  24. package/dist/cli/status.mjs.map +1 -1
  25. package/dist/cli/sync.cjs +42 -92
  26. package/dist/cli/sync.cjs.map +1 -1
  27. package/dist/cli/sync.mjs +45 -95
  28. package/dist/cli/sync.mjs.map +1 -1
  29. package/dist/cli/timing.cjs.map +1 -1
  30. package/dist/cli/timing.mjs.map +1 -1
  31. package/dist/cli/upgrade.cjs +43 -22
  32. package/dist/cli/upgrade.cjs.map +1 -1
  33. package/dist/cli/upgrade.mjs +44 -23
  34. package/dist/cli/upgrade.mjs.map +1 -1
  35. package/dist/cli.cjs +1 -1
  36. package/dist/cli.cjs.map +1 -1
  37. package/dist/cli.mjs +1 -1
  38. package/dist/cli.mjs.map +1 -1
  39. package/dist/components/dev-view.cjs.map +1 -1
  40. package/dist/components/dev-view.mjs.map +1 -1
  41. package/dist/components/streaming-view.cjs.map +1 -1
  42. package/dist/components/streaming-view.mjs.map +1 -1
  43. package/dist/config.cjs.map +1 -1
  44. package/dist/config.mjs.map +1 -1
  45. package/dist/contract.cjs +174 -173
  46. package/dist/contract.cjs.map +1 -1
  47. package/dist/contract.d.cts +3 -3
  48. package/dist/contract.d.cts.map +1 -1
  49. package/dist/contract.d.mts +3 -3
  50. package/dist/contract.d.mts.map +1 -1
  51. package/dist/contract.meta.cjs +1 -1
  52. package/dist/contract.meta.cjs.map +1 -1
  53. package/dist/contract.meta.d.cts +1 -1
  54. package/dist/contract.meta.d.mts +1 -1
  55. package/dist/contract.meta.mjs +1 -1
  56. package/dist/contract.meta.mjs.map +1 -1
  57. package/dist/contract.mjs +2 -1
  58. package/dist/contract.mjs.map +1 -1
  59. package/dist/dev-logs.cjs.map +1 -1
  60. package/dist/dev-logs.mjs.map +1 -1
  61. package/dist/fastkv.cjs.map +1 -1
  62. package/dist/fastkv.mjs.map +1 -1
  63. package/dist/index.cjs +3 -3
  64. package/dist/index.d.cts +1 -1
  65. package/dist/index.d.mts +1 -1
  66. package/dist/index.mjs +1 -1
  67. package/dist/integrity.cjs.map +1 -1
  68. package/dist/integrity.mjs.map +1 -1
  69. package/dist/internal/manifest-normalizer.cjs.map +1 -1
  70. package/dist/internal/manifest-normalizer.mjs.map +1 -1
  71. package/dist/merge.cjs.map +1 -1
  72. package/dist/merge.mjs.map +1 -1
  73. package/dist/near-cli.cjs.map +1 -1
  74. package/dist/near-cli.mjs.map +1 -1
  75. package/dist/orchestrator.cjs.map +1 -1
  76. package/dist/orchestrator.mjs.map +1 -1
  77. package/dist/plugin.cjs +72 -50
  78. package/dist/plugin.cjs.map +1 -1
  79. package/dist/plugin.d.cts +2 -2
  80. package/dist/plugin.d.cts.map +1 -1
  81. package/dist/plugin.d.mts +2 -2
  82. package/dist/plugin.d.mts.map +1 -1
  83. package/dist/plugin.mjs +53 -32
  84. package/dist/plugin.mjs.map +1 -1
  85. package/dist/sdk.cjs +2 -2
  86. package/dist/sdk.d.cts +1 -1
  87. package/dist/sdk.d.mts +1 -1
  88. package/dist/sdk.mjs +1 -1
  89. package/dist/shared.cjs.map +1 -1
  90. package/dist/shared.mjs.map +1 -1
  91. package/dist/types.cjs +184 -184
  92. package/dist/types.cjs.map +1 -1
  93. package/dist/types.d.cts +3 -3
  94. package/dist/types.d.mts +3 -3
  95. package/dist/types.mjs +1 -1
  96. package/dist/types.mjs.map +1 -1
  97. package/dist/ui/types.d.cts +1 -0
  98. package/dist/ui/types.d.cts.map +1 -1
  99. package/dist/ui/types.d.mts +1 -0
  100. package/dist/ui/types.d.mts.map +1 -1
  101. package/dist/utils/banner.cjs.map +1 -1
  102. package/dist/utils/banner.mjs.map +1 -1
  103. package/dist/utils/run.cjs.map +1 -1
  104. package/dist/utils/run.mjs.map +1 -1
  105. package/package.json +2 -2
  106. package/skills/init-upgrade/SKILL.md +22 -16
  107. package/skills/publish-sync/SKILL.md +7 -18
  108. package/src/cli/init.ts +149 -195
  109. package/src/cli/prompts.ts +1 -1
  110. package/src/cli/sync.ts +48 -137
  111. package/src/cli/upgrade.ts +66 -25
  112. package/src/contract.meta.ts +1 -1
  113. package/src/contract.ts +2 -1
  114. package/src/plugin.ts +69 -34
  115. package/src/sdk.ts +1 -1
  116. package/src/types.ts +1 -1
  117. package/src/ui/types.ts +1 -0
  118. package/dist/utils/path-match.cjs +0 -18
  119. package/dist/utils/path-match.cjs.map +0 -1
  120. package/dist/utils/path-match.mjs +0 -17
  121. package/dist/utils/path-match.mjs.map +0 -1
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"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { findCommandDescriptor } from \"./cli/catalog\";\nimport { printHelp } from \"./cli/help\";\nimport { parseCommandInput } from \"./cli/parse\";\nimport { formatDuration, sumPhaseDurations } from \"./cli/timing\";\nimport { findConfigPath } from \"./config\";\nimport bosPlugin 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\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 await warnIfOutdated(client, command);\n\n try {\n const input = parseCommandInput(descriptor, commandArgs);\n const result = await (client as any)[descriptor.key](input);\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 === \"init\") {\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} Project initialized`));\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 (result.status === \"initialized\" && !(input as any)?.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 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 from 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 (local):\")}`);\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\") {\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 === \"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 console.log();\n return;\n }\n }\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n}\n\nmain().catch((error) => {\n console.error(\"[CLI] Fatal error:\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;AAWA,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,UAAU,CAAC,IAAIA,qBAAO,KAAK,OAAO,QAAQ,GAAG;AACzE,SAAQ,IAAI,KAAKA,qBAAO,IAAI,SAAS,CAAC,KAAKA,qBAAO,MAAM,OAAO,UAAU,iBAAiB,GAAG;AAC7F,KAAI,OAAO,QACT,SAAQ,IAAI,KAAKA,qBAAO,IAAI,UAAU,CAAC,IAAIA,qBAAO,QAAQ,OAAO,QAAQ,OAAO,GAAG;AAErF,SAAQ,KAAK;;AAGf,SAAS,cAAc,cAA8B;CAGnD,MAAM,SAFM,KAAK,KAAK,GACT,IAAI,KAAK,aAAa,CAAC,SAAS;CAE7C,MAAM,WAAW,KAAK,MAAM,SAAS,IAAO;AAC5C,KAAI,WAAW,EAAG,QAAO;AACzB,KAAI,WAAW,GAAI,QAAO,GAAG,SAAS,SAAS,WAAW,IAAI,MAAM,GAAG;CACvE,MAAM,YAAY,KAAK,MAAM,WAAW,GAAG;AAC3C,KAAI,YAAY,GAAI,QAAO,GAAG,UAAU,OAAO,YAAY,IAAI,MAAM,GAAG;CACxE,MAAM,WAAW,KAAK,MAAM,YAAY,GAAG;AAC3C,KAAI,WAAW,GAAI,QAAO,GAAG,SAAS,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SAAS,CAAC,GAAG,OAAO,MAAM,KAAK,KAAK,GAAG;AAErE,QAAI,OAAO,WAAW,OAAO,QAAQ,SAAS,EAC5C,SAAQ,IAAI,KAAKA,qBAAO,IAAI,WAAW,CAAC,GAAG,OAAO,QAAQ,KAAK,KAAK,GAAG;AAEzE,YAAQ,KAAK;AACb;;;UAGG,OAAO;AACd,UAAQ,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GAAG;AAChF,UAAQ,KAAK,EAAE;;;AAInB,MAAM,CAAC,OAAO,UAAU;AACtB,SAAQ,MAAM,sBAAsB,MAAM;AAC1C,SAAQ,KAAK,EAAE;EACf"}
1
+ {"version":3,"file":"cli.cjs","names":["colors","frames","icons","gradients","formatDuration","sumPhaseDurations","findConfigPath","findCommandDescriptor","bosPlugin","parseCommandInput"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { findCommandDescriptor } from \"./cli/catalog\";\nimport { printHelp } from \"./cli/help\";\nimport { parseCommandInput } from \"./cli/parse\";\nimport { formatDuration, sumPhaseDurations } from \"./cli/timing\";\nimport { findConfigPath } from \"./config\";\nimport bosPlugin 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\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 await warnIfOutdated(client, command);\n\n try {\n const input = parseCommandInput(descriptor, commandArgs);\n const result = await (client as any)[descriptor.key](input);\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 === \"init\") {\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} Project initialized`));\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 (result.status === \"initialized\" && !(input as any)?.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 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 from 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 (local):\")}`);\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\") {\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 === \"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 console.log();\n return;\n }\n }\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n}\n\nmain().catch((error) => {\n console.error(\"[CLI] Fatal error:\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;AAWA,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,UAAU,CAAC,IAAIA,qBAAO,KAAK,OAAO,QAAQ,GAAG;AACzE,SAAQ,IAAI,KAAKA,qBAAO,IAAI,SAAS,CAAC,KAAKA,qBAAO,MAAM,OAAO,UAAU,iBAAiB,G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AAW;AAChC,OAAI,OAAO,WAAW,WAAW;AAC/B,YAAQ,KAAK;AACb,YAAQ,IAAIA,qBAAO,KAAK,GAAGE,oBAAM,GAAG,mBAAmB,CAAC;AACxD,YAAQ,IAAI,KAAKF,qBAAO,IAAI,gBAAgB,CAAC,GAAG,OAAO,cAAc;AACrE,YAAQ,KAAK;AACb;;AAGF,OAAI,OAAO,WAAW,aAAa;AACjC,YAAQ,KAAK;AACb,YAAQ,IAAIA,qBAAO,MAAM,GAAGE,oBAAM,GAAG,yBAAyB,CAAC;AAC/D,YAAQ,IAAI,KAAKF,qBAAO,IAAI,gBAAgB,CAAC,GAAG,OAAO,cAAc;AACrE,QAAI,OAAO,OACT,SAAQ,IAAI,KAAKA,qBAAO,IAAI,eAAe,CAAC,GAAG,OAAO,SAAS;AAEjE,QAAI,OAAO,SAAS,OAAO,MAAM,SAAS,EACxC,SAAQ,IAAI,KAAKA,qBAAO,IAAI,SAAS,CAAC,GAAG,OAAO,MAAM,KAAK,KAAK,GAAG;AAErE,QAAI,OAAO,WAAW,OAAO,QAAQ,SAAS,EAC5C,SAAQ,IAAI,KAAKA,qBAAO,IAAI,WAAW,CAAC,GAAG,OAAO,QAAQ,KAAK,KAAK,GAAG;AAEzE,YAAQ,KAAK;AACb;;;UAGG,OAAO;AACd,UAAQ,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GAAG;AAChF,UAAQ,KAAK,EAAE;;;AAInB,MAAM,CAAC,OAAO,UAAU;AACtB,SAAQ,MAAM,sBAAsB,MAAM;AAC1C,SAAQ,KAAK,EAAE;EACf"}
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { createPluginRuntime } from "./sdk.mjs";
3
2
  import { findConfigPath } from "./config.mjs";
3
+ import { createPluginRuntime } from "./sdk.mjs";
4
4
  import { formatDuration, sumPhaseDurations } from "./cli/timing.mjs";
5
5
  import { colors, frames, gradients, icons } from "./utils/theme.mjs";
6
6
  import plugin_default from "./plugin.mjs";
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["bosPlugin"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { findCommandDescriptor } from \"./cli/catalog\";\nimport { printHelp } from \"./cli/help\";\nimport { parseCommandInput } from \"./cli/parse\";\nimport { formatDuration, sumPhaseDurations } from \"./cli/timing\";\nimport { findConfigPath } from \"./config\";\nimport bosPlugin 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\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 await warnIfOutdated(client, command);\n\n try {\n const input = parseCommandInput(descriptor, commandArgs);\n const result = await (client as any)[descriptor.key](input);\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 === \"init\") {\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} Project initialized`));\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 (result.status === \"initialized\" && !(input as any)?.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 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 from 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 (local):\")}`);\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\") {\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 === \"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 console.log();\n return;\n }\n }\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n}\n\nmain().catch((error) => {\n console.error(\"[CLI] Fatal error:\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;AAWA,SAAS,gBAAgB,QAStB;AACD,SAAQ,KAAK;AACb,SAAQ,IAAI,OAAO,KAAK,OAAO,IAAI,GAAG,CAAC,CAAC;AACxC,SAAQ,IAAI,KAAK,MAAM,IAAI,GAAG,UAAU,MAAM,SAAS,GAAG;AAC1D,SAAQ,IAAI,OAAO,KAAK,OAAO,OAAO,GAAG,CAAC,CAAC;AAC3C,SAAQ,KAAK;AAEb,SAAQ,IAAI,KAAK,OAAO,IAAI,UAAU,CAAC,IAAI,OAAO,KAAK,OAAO,QAAQ,GAAG;AACzE,SAAQ,IAAI,KAAK,OAAO,IAAI,SAAS,CAAC,KAAK,OAAO,MAAM,OAAO,UAAU,iBAAiB,GAAG;AAC7F,KAAI,OAAO,QACT,SAAQ,IAAI,KAAK,OAAO,IAAI,UAAU,CAAC,IAAI,OAAO,QAAQ,OAAO,QAAQ,OAAO,GAAG;AAErF,SAAQ,KAAK;;AAGf,SAAS,cAAc,cAA8B;CAGnD,MAAM,SAFM,KAAK,KAAK,GACT,IAAI,KAAK,aAAa,CAAC,SAAS;CAE7C,MAAM,WAAW,KAAK,MAAM,SAAS,IAAO;AAC5C,KAAI,WAAW,EAAG,QAAO;AACzB,KAAI,WAAW,GAAI,QAAO,GAAG,SAAS,SAAS,WAAW,IAAI,MAAM,GAAG;CACvE,MAAM,YAAY,KAAK,MAAM,WAAW,GAAG;AAC3C,KAAI,YAAY,GAAI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,KAAK;AACb;;;UAGG,OAAO;AACd,UAAQ,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GAAG;AAChF,UAAQ,KAAK,EAAE;;;AAInB,MAAM,CAAC,OAAO,UAAU;AACtB,SAAQ,MAAM,sBAAsB,MAAM;AAC1C,SAAQ,KAAK,EAAE;EACf"}
1
+ {"version":3,"file":"cli.mjs","names":["bosPlugin"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { findCommandDescriptor } from \"./cli/catalog\";\nimport { printHelp } from \"./cli/help\";\nimport { parseCommandInput } from \"./cli/parse\";\nimport { formatDuration, sumPhaseDurations } from \"./cli/timing\";\nimport { findConfigPath } from \"./config\";\nimport bosPlugin 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\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 await warnIfOutdated(client, command);\n\n try {\n const input = parseCommandInput(descriptor, commandArgs);\n const result = await (client as any)[descriptor.key](input);\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 === \"init\") {\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} Project initialized`));\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 (result.status === \"initialized\" && !(input as any)?.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 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 from 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 (local):\")}`);\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\") {\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 === \"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 console.log();\n return;\n }\n }\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n}\n\nmain().catch((error) => {\n console.error(\"[CLI] Fatal error:\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;AAWA,SAAS,gBAAgB,QAStB;AACD,SAAQ,KAAK;AACb,SAAQ,IAAI,OAAO,KAAK,OAAO,IAAI,GAAG,CAAC,CAAC;AACxC,SAAQ,IAAI,KAAK,MAAM,IAAI,GAAG,UAAU,MAAM,SAAS,GAAG;AAC1D,SAAQ,IAAI,OAAO,KAAK,OAAO,OAAO,GAAG,CAAC,CAAC;AAC3C,SAAQ,KAAK;AAEb,SAAQ,IAAI,KAAK,OAAO,IAAI,UAAU,CAAC,IAAI,OAAO,KAAK,OAAO,QAAQ,GAAG;AACzE,SAAQ,IAAI,KAAK,OAAO,IAAI,SAAS,CAAC,KAAK,OAAO,MAAM,OAAO,UAAU,iBAAiB,GAAG;AAC7F,KAAI,OAAO,QACT,SAAQ,IAAI,KAAK,OAAO,IAAI,UAAU,CAAC,IAAI,OAAO,QAAQ,OAAO,QAAQ,OAAO,GAAG;AAErF,SAAQ,KAAK;;AAGf,SAAS,cAAc,cAA8B;CAGnD,MAAM,SAFM,KAAK,KAEC,GADL,IAAI,KAAK,aAAa,CAAC,SACX;CACzB,MAAM,WAAW,KAAK,MAAM,SAAS,IAAO;AAC5C,KAAI,WAA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AK,GAAG;AAErE,QAAI,OAAO,WAAW,OAAO,QAAQ,SAAS,EAC5C,SAAQ,IAAI,KAAK,OAAO,IAAI,WAAW,CAAC,GAAG,OAAO,QAAQ,KAAK,KAAK,GAAG;AAEzE,YAAQ,KAAK;AACb;;;UAGG,OAAO;AACd,UAAQ,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GAAG;AAChF,UAAQ,KAAK,EAAE;;;AAInB,MAAM,CAAC,OAAO,UAAU;AACtB,SAAQ,MAAM,sBAAsB,MAAM;AAC1C,SAAQ,KAAK,EAAE;EACf"}
@@ -1 +1 @@
1
- {"version":3,"file":"dev-view.cjs","names":["Text","icons","Box","linkify","frames","gradients","colors","divider"],"sources":["../../src/components/dev-view.tsx"],"sourcesContent":["import { Box, render, Text, useApp, useInput } from \"ink\";\nimport { useEffect, useState } from \"react\";\nimport type { SourceMode } from \"../types\";\nimport { linkify } from \"../utils/linkify\";\nimport { colors, divider, frames, gradients, icons } from \"../utils/theme\";\n\nconst PLUGIN_PREFIX = \"plugin:\";\n\nexport type ProcessStatus = \"pending\" | \"starting\" | \"ready\" | \"error\";\n\nexport interface ProcessState {\n name: string;\n status: ProcessStatus;\n port: number;\n message?: string;\n source?: SourceMode;\n}\n\nexport interface LogEntry {\n id: string;\n source: string;\n line: string;\n timestamp: number;\n isError?: boolean;\n}\n\ninterface DevViewProps {\n processes: ProcessState[];\n logs: LogEntry[];\n description: string;\n proxyTarget?: string;\n onExit?: () => Promise<void> | void;\n onExportLogs?: () => Promise<void> | void;\n}\n\nfunction StatusIcon({ status }: { status: ProcessStatus }) {\n switch (status) {\n case \"pending\":\n return <Text color=\"gray\">{icons.pending}</Text>;\n case \"starting\":\n return <Text color=\"#00ffff\">{icons.scan}</Text>;\n case \"ready\":\n return <Text color=\"#00ff41\">{icons.ok}</Text>;\n case \"error\":\n return <Text color=\"#ff3366\">{icons.err}</Text>;\n }\n}\n\nfunction getServiceColor(name: string): string {\n if (name.startsWith(PLUGIN_PREFIX)) return \"#ffaa00\";\n return name === \"host\" ? \"#00ffff\" : name === \"ui\" ? \"#ff00ff\" : \"#0080ff\";\n}\n\nfunction getDisplayName(name: string): string {\n return name.startsWith(PLUGIN_PREFIX)\n ? name.slice(PLUGIN_PREFIX.length).toUpperCase()\n : name.toUpperCase();\n}\n\nfunction isPlugin(name: string): boolean {\n return name.startsWith(PLUGIN_PREFIX);\n}\n\nfunction getSectionedProcesses(processes: ProcessState[]): Array<{\n key: string;\n title: string;\n processes: ProcessState[];\n}> {\n const plugins = processes.filter((p) => isPlugin(p.name));\n const services = processes.filter((p) => !isPlugin(p.name));\n const sections: Array<{ key: string; title: string; processes: ProcessState[] }> = [];\n if (plugins.length > 0) sections.push({ key: \"plugins\", title: \"PLUGINS\", processes: plugins });\n if (services.length > 0)\n sections.push({ key: \"services\", title: \"SERVICES\", processes: services });\n return sections;\n}\n\nfunction getColumnWidths(processes: ProcessState[]): { name: number; source: number } {\n const name = Math.max(6, ...processes.map((p) => getDisplayName(p.name).length));\n const source = Math.max(10, ...processes.map((p) => (p.source ? `(${p.source})`.length : 0)));\n return { name, source };\n}\n\nfunction ProcessRow({\n proc,\n nameWidth,\n sourceWidth,\n}: {\n proc: ProcessState;\n nameWidth: number;\n sourceWidth: number;\n}) {\n const color = getServiceColor(proc.name);\n const isRemote = proc.source === \"remote\";\n const isHost = proc.name === \"host\";\n const showPort = proc.port > 0 && (isHost || !isRemote);\n const portStr = showPort ? `:${proc.port}` : \"\";\n const sourceLabel = proc.source ? ` (${proc.source})` : \"\";\n\n const statusText =\n proc.status === \"pending\"\n ? \"waiting\"\n : proc.status === \"starting\"\n ? \"starting\"\n : proc.status === \"ready\"\n ? isRemote && !isHost\n ? \"loaded\"\n : \"running\"\n : \"failed\";\n\n return (\n <Box>\n <Text>{\" \"}</Text>\n <StatusIcon status={proc.status} />\n <Text> </Text>\n <Text color={color} bold>\n {getDisplayName(proc.name).padEnd(nameWidth)}\n </Text>\n <Text color=\"gray\">{sourceLabel.padEnd(sourceWidth)}</Text>\n <Text color={proc.status === \"ready\" ? \"#00ff41\" : \"gray\"}>{statusText}</Text>\n {showPort && <Text color=\"#00ffff\"> {portStr}</Text>}\n </Box>\n );\n}\n\nfunction SectionHeader({ title }: { title: string }) {\n return (\n <Box marginBottom={0} marginTop={1}>\n <Text color=\"#00ffff\" bold>\n {title}\n </Text>\n </Box>\n );\n}\n\nfunction LogLine({ entry }: { entry: LogEntry }) {\n const color = getServiceColor(entry.source);\n\n return (\n <Box>\n <Text color={color}>[{entry.source}]</Text>\n <Text color={entry.isError ? \"#ff3366\" : undefined}> {linkify(entry.line)}</Text>\n </Box>\n );\n}\n\nfunction truncateUrl(url: string, maxLen: number): string {\n if (url.length <= maxLen) return url;\n try {\n const parsed = new URL(url);\n const host = parsed.host;\n if (host.length > maxLen - 10) {\n return `${host.slice(0, maxLen - 13)}...`;\n }\n return host;\n } catch {\n return `${url.slice(0, maxLen - 3)}...`;\n }\n}\n\nfunction DevView({\n processes,\n logs,\n description,\n proxyTarget,\n onExit,\n onExportLogs,\n}: DevViewProps) {\n const { exit } = useApp();\n const [isShuttingDown, setIsShuttingDown] = useState(false);\n\n useInput((input, key) => {\n if (isShuttingDown) return;\n\n if (input === \"q\" || (key.ctrl && input === \"c\")) {\n setIsShuttingDown(true);\n Promise.resolve(onExit?.()).then(() => {\n exit();\n });\n }\n if (input === \"l\") {\n setIsShuttingDown(true);\n Promise.resolve(onExportLogs?.()).then(() => {\n exit();\n });\n }\n });\n\n const readyCount = processes.filter((p) => p.status === \"ready\").length;\n const total = processes.length;\n const allReady = readyCount === total;\n const hostProcess = processes.find((p) => p.name === \"host\");\n const hostPort = hostProcess?.port || 3000;\n const recentLogs = logs.slice(-12);\n const sectionedProcesses = getSectionedProcesses(processes);\n const columnWidths = getColumnWidths(processes);\n\n return (\n <Box flexDirection=\"column\">\n <Box marginBottom={0}>\n <Text color=\"#00ffff\">{frames.top(52)}</Text>\n </Box>\n <Box>\n <Text>\n {\" \"}\n {icons.run} {gradients.cyber(description.toUpperCase())}\n </Text>\n </Box>\n <Box marginBottom={1}>\n <Text color=\"#00ffff\">{frames.bottom(52)}</Text>\n </Box>\n\n {allReady && (\n <Box marginBottom={1} flexDirection=\"column\">\n <Box>\n <Text color=\"#00ff41\">\n {\" \"}\n {icons.app} APP READY\n </Text>\n </Box>\n <Box>\n <Text color=\"#00ff41\" bold>\n {\" \"}\n {icons.arrow} http://localhost:{hostPort}\n </Text>\n </Box>\n </Box>\n )}\n\n {proxyTarget && (\n <Box marginBottom={1}>\n <Text color=\"#ffaa00\">\n {\" \"}\n {icons.arrow} API PROXY → {truncateUrl(proxyTarget, 38)}\n </Text>\n </Box>\n )}\n\n <Box marginTop={0} marginBottom={0}>\n <Text>{colors.dim(divider(52))}</Text>\n </Box>\n\n {sectionedProcesses.map((section) => (\n <Box key={section.key} flexDirection=\"column\">\n <SectionHeader title={section.title} />\n {section.processes.map((proc) => (\n <ProcessRow\n key={proc.name}\n proc={proc}\n nameWidth={columnWidths.name}\n sourceWidth={columnWidths.source}\n />\n ))}\n </Box>\n ))}\n\n <Box marginTop={1} marginBottom={0}>\n <Text>{colors.dim(divider(52))}</Text>\n </Box>\n\n <Box marginTop={0}>\n <Text color={allReady ? \"#00ff41\" : \"#00ffff\"}>\n {\" \"}\n {allReady\n ? `${icons.ok} All ${total} services running`\n : `${icons.scan} ${readyCount}/${total} ready`}\n </Text>\n <Text color=\"gray\">\n {\" \"}\n {icons.dot} q quit {icons.dot} l logs\n </Text>\n </Box>\n\n {recentLogs.length > 0 && (\n <>\n <Box marginTop={1} marginBottom={0}>\n <Text>{colors.dim(divider(52))}</Text>\n </Box>\n <Box flexDirection=\"column\" marginTop={0}>\n {recentLogs.map((entry) => (\n <LogLine key={entry.id} entry={entry} />\n ))}\n </Box>\n </>\n )}\n </Box>\n );\n}\n\nexport interface DevViewHandle {\n updateProcess: (name: string, status: ProcessStatus, message?: string) => void;\n addLog: (source: string, line: string, isError?: boolean) => void;\n unmount: () => void;\n}\n\nexport function renderDevView(\n initialProcesses: ProcessState[],\n description: string,\n env: Record<string, string>,\n onExit?: () => Promise<void> | void,\n onExportLogs?: () => Promise<void> | void,\n): DevViewHandle {\n let processes = [...initialProcesses];\n let logs: LogEntry[] = [];\n let rerender: (() => void) | null = null;\n const proxyTarget = env.API_PROXY;\n let logSeq = 0;\n let lastLogKey: string | null = null;\n\n const updateProcess = (name: string, status: ProcessStatus, message?: string) => {\n processes = processes.map((p) => (p.name === name ? { ...p, status, message } : p));\n rerender?.();\n };\n\n const addLog = (source: string, line: string, isError = false) => {\n const nextKey = `${source}:${isError ? \"1\" : \"0\"}:${line}`;\n if (nextKey === lastLogKey) return;\n lastLogKey = nextKey;\n\n logs = [\n ...logs,\n { id: `${Date.now()}-${++logSeq}`, source, line, timestamp: Date.now(), isError },\n ];\n if (logs.length > 100) logs = logs.slice(-100);\n rerender?.();\n };\n\n function DevViewWrapper() {\n const [, forceUpdate] = useState(0);\n\n useEffect(() => {\n rerender = () => forceUpdate((n: number) => n + 1);\n return () => {\n rerender = null;\n };\n }, []);\n\n return (\n <DevView\n processes={processes}\n logs={logs}\n description={description}\n proxyTarget={proxyTarget}\n onExit={onExit}\n onExportLogs={onExportLogs}\n />\n );\n }\n\n const { unmount } = render(<DevViewWrapper />);\n return { updateProcess, addLog, unmount };\n}\n"],"mappings":";;;;;;;;AAMA,MAAM,gBAAgB;AA6BtB,SAAS,WAAW,EAAE,UAAqC;AACzD,SAAQ,QAAR;EACE,KAAK,UACH,QAAO,2CAACA,UAAD;GAAM,OAAM;aAAQC,oBAAM;GAAe;EAClD,KAAK,WACH,QAAO,2CAACD,UAAD;GAAM,OAAM;aAAWC,oBAAM;GAAY;EAClD,KAAK,QACH,QAAO,2CAACD,UAAD;GAAM,OAAM;aAAWC,oBAAM;GAAU;EAChD,KAAK,QACH,QAAO,2CAACD,UAAD;GAAM,OAAM;aAAWC,oBAAM;GAAW;;;AAIrD,SAAS,gBAAgB,MAAsB;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YAAY,CAAC,GAAG,iBAAiB;CACrC,IAAI,OAAmB,EAAE;CACzB,IAAI,WAAgC;CACpC,MAAM,cAAc,IAAI;CACxB,IAAI,SAAS;CACb,IAAI,aAA4B;CAEhC,MAAM,iBAAiB,MAAc,QAAuB,YAAqB;AAC/E,cAAY,UAAU,KAAK,MAAO,EAAE,SAAS,OAAO;GAAE,GAAG;GAAG;GAAQ;GAAS,GAAG,EAAG;AACnF,cAAY;;CAGd,MAAM,UAAU,QAAgB,MAAc,UAAU,UAAU;EAChE,MAAM,UAAU,GAAG,OAAO,GAAG,UAAU,MAAM,IAAI,GAAG;AACpD,MAAI,YAAY,WAAY;AAC5B,eAAa;AAEb,SAAO,CACL,GAAG,MACH;GAAE,IAAI,GAAG,KAAK,KAAK,CAAC,GAAG,EAAE;GAAU;GAAQ;GAAM,WAAW,KAAK,KAAK;GAAE;GAAS,CAClF;AACD,MAAI,KAAK,SAAS,IAAK,QAAO,KAAK,MAAM,KAAK;AAC9C,cAAY;;CAGd,SAAS,iBAAiB;EACxB,MAAM,GAAG,mCAAwB,EAAE;AAEnC,6BAAgB;AACd,oBAAiB,aAAa,MAAc,IAAI,EAAE;AAClD,gBAAa;AACX,eAAW;;KAEZ,EAAE,CAAC;AAEN,SACE,2CAAC,SAAD;GACa;GACL;GACO;GACA;GACL;GACM;GACd;;CAIN,MAAM,EAAE,4BAAmB,2CAAC,gBAAD,EAAkB,EAAC;AAC9C,QAAO;EAAE;EAAe;EAAQ;EAAS"}
1
+ {"version":3,"file":"dev-view.cjs","names":["Text","icons","Box","linkify","frames","gradients","colors","divider"],"sources":["../../src/components/dev-view.tsx"],"sourcesContent":["import { Box, render, Text, useApp, useInput } from \"ink\";\nimport { useEffect, useState } from \"react\";\nimport type { SourceMode } from \"../types\";\nimport { linkify } from \"../utils/linkify\";\nimport { colors, divider, frames, gradients, icons } from \"../utils/theme\";\n\nconst PLUGIN_PREFIX = \"plugin:\";\n\nexport type ProcessStatus = \"pending\" | \"starting\" | \"ready\" | \"error\";\n\nexport interface ProcessState {\n name: string;\n status: ProcessStatus;\n port: number;\n message?: string;\n source?: SourceMode;\n}\n\nexport interface LogEntry {\n id: string;\n source: string;\n line: string;\n timestamp: number;\n isError?: boolean;\n}\n\ninterface DevViewProps {\n processes: ProcessState[];\n logs: LogEntry[];\n description: string;\n proxyTarget?: string;\n onExit?: () => Promise<void> | void;\n onExportLogs?: () => Promise<void> | void;\n}\n\nfunction StatusIcon({ status }: { status: ProcessStatus }) {\n switch (status) {\n case \"pending\":\n return <Text color=\"gray\">{icons.pending}</Text>;\n case \"starting\":\n return <Text color=\"#00ffff\">{icons.scan}</Text>;\n case \"ready\":\n return <Text color=\"#00ff41\">{icons.ok}</Text>;\n case \"error\":\n return <Text color=\"#ff3366\">{icons.err}</Text>;\n }\n}\n\nfunction getServiceColor(name: string): string {\n if (name.startsWith(PLUGIN_PREFIX)) return \"#ffaa00\";\n return name === \"host\" ? \"#00ffff\" : name === \"ui\" ? \"#ff00ff\" : \"#0080ff\";\n}\n\nfunction getDisplayName(name: string): string {\n return name.startsWith(PLUGIN_PREFIX)\n ? name.slice(PLUGIN_PREFIX.length).toUpperCase()\n : name.toUpperCase();\n}\n\nfunction isPlugin(name: string): boolean {\n return name.startsWith(PLUGIN_PREFIX);\n}\n\nfunction getSectionedProcesses(processes: ProcessState[]): Array<{\n key: string;\n title: string;\n processes: ProcessState[];\n}> {\n const plugins = processes.filter((p) => isPlugin(p.name));\n const services = processes.filter((p) => !isPlugin(p.name));\n const sections: Array<{ key: string; title: string; processes: ProcessState[] }> = [];\n if (plugins.length > 0) sections.push({ key: \"plugins\", title: \"PLUGINS\", processes: plugins });\n if (services.length > 0)\n sections.push({ key: \"services\", title: \"SERVICES\", processes: services });\n return sections;\n}\n\nfunction getColumnWidths(processes: ProcessState[]): { name: number; source: number } {\n const name = Math.max(6, ...processes.map((p) => getDisplayName(p.name).length));\n const source = Math.max(10, ...processes.map((p) => (p.source ? `(${p.source})`.length : 0)));\n return { name, source };\n}\n\nfunction ProcessRow({\n proc,\n nameWidth,\n sourceWidth,\n}: {\n proc: ProcessState;\n nameWidth: number;\n sourceWidth: number;\n}) {\n const color = getServiceColor(proc.name);\n const isRemote = proc.source === \"remote\";\n const isHost = proc.name === \"host\";\n const showPort = proc.port > 0 && (isHost || !isRemote);\n const portStr = showPort ? `:${proc.port}` : \"\";\n const sourceLabel = proc.source ? ` (${proc.source})` : \"\";\n\n const statusText =\n proc.status === \"pending\"\n ? \"waiting\"\n : proc.status === \"starting\"\n ? \"starting\"\n : proc.status === \"ready\"\n ? isRemote && !isHost\n ? \"loaded\"\n : \"running\"\n : \"failed\";\n\n return (\n <Box>\n <Text>{\" \"}</Text>\n <StatusIcon status={proc.status} />\n <Text> </Text>\n <Text color={color} bold>\n {getDisplayName(proc.name).padEnd(nameWidth)}\n </Text>\n <Text color=\"gray\">{sourceLabel.padEnd(sourceWidth)}</Text>\n <Text color={proc.status === \"ready\" ? \"#00ff41\" : \"gray\"}>{statusText}</Text>\n {showPort && <Text color=\"#00ffff\"> {portStr}</Text>}\n </Box>\n );\n}\n\nfunction SectionHeader({ title }: { title: string }) {\n return (\n <Box marginBottom={0} marginTop={1}>\n <Text color=\"#00ffff\" bold>\n {title}\n </Text>\n </Box>\n );\n}\n\nfunction LogLine({ entry }: { entry: LogEntry }) {\n const color = getServiceColor(entry.source);\n\n return (\n <Box>\n <Text color={color}>[{entry.source}]</Text>\n <Text color={entry.isError ? \"#ff3366\" : undefined}> {linkify(entry.line)}</Text>\n </Box>\n );\n}\n\nfunction truncateUrl(url: string, maxLen: number): string {\n if (url.length <= maxLen) return url;\n try {\n const parsed = new URL(url);\n const host = parsed.host;\n if (host.length > maxLen - 10) {\n return `${host.slice(0, maxLen - 13)}...`;\n }\n return host;\n } catch {\n return `${url.slice(0, maxLen - 3)}...`;\n }\n}\n\nfunction DevView({\n processes,\n logs,\n description,\n proxyTarget,\n onExit,\n onExportLogs,\n}: DevViewProps) {\n const { exit } = useApp();\n const [isShuttingDown, setIsShuttingDown] = useState(false);\n\n useInput((input, key) => {\n if (isShuttingDown) return;\n\n if (input === \"q\" || (key.ctrl && input === \"c\")) {\n setIsShuttingDown(true);\n Promise.resolve(onExit?.()).then(() => {\n exit();\n });\n }\n if (input === \"l\") {\n setIsShuttingDown(true);\n Promise.resolve(onExportLogs?.()).then(() => {\n exit();\n });\n }\n });\n\n const readyCount = processes.filter((p) => p.status === \"ready\").length;\n const total = processes.length;\n const allReady = readyCount === total;\n const hostProcess = processes.find((p) => p.name === \"host\");\n const hostPort = hostProcess?.port || 3000;\n const recentLogs = logs.slice(-12);\n const sectionedProcesses = getSectionedProcesses(processes);\n const columnWidths = getColumnWidths(processes);\n\n return (\n <Box flexDirection=\"column\">\n <Box marginBottom={0}>\n <Text color=\"#00ffff\">{frames.top(52)}</Text>\n </Box>\n <Box>\n <Text>\n {\" \"}\n {icons.run} {gradients.cyber(description.toUpperCase())}\n </Text>\n </Box>\n <Box marginBottom={1}>\n <Text color=\"#00ffff\">{frames.bottom(52)}</Text>\n </Box>\n\n {allReady && (\n <Box marginBottom={1} flexDirection=\"column\">\n <Box>\n <Text color=\"#00ff41\">\n {\" \"}\n {icons.app} APP READY\n </Text>\n </Box>\n <Box>\n <Text color=\"#00ff41\" bold>\n {\" \"}\n {icons.arrow} http://localhost:{hostPort}\n </Text>\n </Box>\n </Box>\n )}\n\n {proxyTarget && (\n <Box marginBottom={1}>\n <Text color=\"#ffaa00\">\n {\" \"}\n {icons.arrow} API PROXY → {truncateUrl(proxyTarget, 38)}\n </Text>\n </Box>\n )}\n\n <Box marginTop={0} marginBottom={0}>\n <Text>{colors.dim(divider(52))}</Text>\n </Box>\n\n {sectionedProcesses.map((section) => (\n <Box key={section.key} flexDirection=\"column\">\n <SectionHeader title={section.title} />\n {section.processes.map((proc) => (\n <ProcessRow\n key={proc.name}\n proc={proc}\n nameWidth={columnWidths.name}\n sourceWidth={columnWidths.source}\n />\n ))}\n </Box>\n ))}\n\n <Box marginTop={1} marginBottom={0}>\n <Text>{colors.dim(divider(52))}</Text>\n </Box>\n\n <Box marginTop={0}>\n <Text color={allReady ? \"#00ff41\" : \"#00ffff\"}>\n {\" \"}\n {allReady\n ? `${icons.ok} All ${total} services running`\n : `${icons.scan} ${readyCount}/${total} ready`}\n </Text>\n <Text color=\"gray\">\n {\" \"}\n {icons.dot} q quit {icons.dot} l logs\n </Text>\n </Box>\n\n {recentLogs.length > 0 && (\n <>\n <Box marginTop={1} marginBottom={0}>\n <Text>{colors.dim(divider(52))}</Text>\n </Box>\n <Box flexDirection=\"column\" marginTop={0}>\n {recentLogs.map((entry) => (\n <LogLine key={entry.id} entry={entry} />\n ))}\n </Box>\n </>\n )}\n </Box>\n );\n}\n\nexport interface DevViewHandle {\n updateProcess: (name: string, status: ProcessStatus, message?: string) => void;\n addLog: (source: string, line: string, isError?: boolean) => void;\n unmount: () => void;\n}\n\nexport function renderDevView(\n initialProcesses: ProcessState[],\n description: string,\n env: Record<string, string>,\n onExit?: () => Promise<void> | void,\n onExportLogs?: () => Promise<void> | void,\n): DevViewHandle {\n let processes = [...initialProcesses];\n let logs: LogEntry[] = [];\n let rerender: (() => void) | null = null;\n const proxyTarget = env.API_PROXY;\n let logSeq = 0;\n let lastLogKey: string | null = null;\n\n const updateProcess = (name: string, status: ProcessStatus, message?: string) => {\n processes = processes.map((p) => (p.name === name ? { ...p, status, message } : p));\n rerender?.();\n };\n\n const addLog = (source: string, line: string, isError = false) => {\n const nextKey = `${source}:${isError ? \"1\" : \"0\"}:${line}`;\n if (nextKey === lastLogKey) return;\n lastLogKey = nextKey;\n\n logs = [\n ...logs,\n { id: `${Date.now()}-${++logSeq}`, source, line, timestamp: Date.now(), isError },\n ];\n if (logs.length > 100) logs = logs.slice(-100);\n rerender?.();\n };\n\n function DevViewWrapper() {\n const [, forceUpdate] = useState(0);\n\n useEffect(() => {\n rerender = () => forceUpdate((n: number) => n + 1);\n return () => {\n rerender = null;\n };\n }, []);\n\n return (\n <DevView\n processes={processes}\n logs={logs}\n description={description}\n proxyTarget={proxyTarget}\n onExit={onExit}\n onExportLogs={onExportLogs}\n />\n );\n }\n\n const { unmount } = render(<DevViewWrapper />);\n return { updateProcess, addLog, unmount };\n}\n"],"mappings":";;;;;;;;AAMA,MAAM,gBAAgB;AA6BtB,SAAS,WAAW,EAAE,UAAqC;AACzD,SAAQ,QAAR;EACE,KAAK,UACH,QAAO,2CAACA,UAAD;GAAM,OAAM;aAAQC,oBAAM;GAAe;EAClD,KAAK,WACH,QAAO,2CAACD,UAAD;GAAM,OAAM;aAAWC,oBAAM;GAAY;EAClD,KAAK,QACH,QAAO,2CAACD,UAAD;GAAM,OAAM;aAAWC,oBAAM;GAAU;EAChD,KAAK,QACH,QAAO,2CAACD,UAAD;GAAM,OAAM;aAAWC,oBAAM;GAAW;;;AAIrD,SAAS,gBAAgB,MAAsB;AAC7C,KAAI,KAAK,WAAW,cAAc,CAAE,QAAO;AAC3C,QAAO,SAAS,SAAS,YAAY,SAAS,OAAO,YAAY;;AAGnE,SAAS,eAAe,MAAsB;AAC5C,QAAO,KAAK,WAAW,cAAc,GACjC,KAAK,MAAM,EAAqB,CAAC,aAAa,GAC9C,KAAK,aAAa;;AAGxB,SAAS,SAAS,MAAuB;AACvC,QAAO,KAAK,WAAW,cAAc;;AAGvC,SAAS,sBAAsB,WAI5B;CACD,MAAM,UAAU,UAAU,QAAQ,MAAM,SAAS,EAAE,KAAK,CAAC;CACzD,MAAM,WAAW,UAAU,QAAQ,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC;CAC3D,MAAM,WAA6E,EAAE;AACrF,KAAI,QAAQ,SAAS,EAAG,UAAS,KAAK;EAAE,KAAK;EAAW,OAAO;EAAW,WAAW;EAAS,CAAC;AAC/F,KAAI,SAAS,SAAS,EACpB,UAAS,KAAK;EAAE,KAAK;EAAY,OAAO;EAAY,WAAW;EAAU,CAAC;AAC5E,QAAO;;AAGT,SAAS,gBAAgB,WAA6D;AAGpF,QAAO;EAAE,MAF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aAAa,MAAc,IAAI,EAAE;AAClD,gBAAa;AACX,eAAW;;KAEZ,EAAE,CAAC;AAEN,SACE,2CAAC,SAAD;GACa;GACL;GACO;GACA;GACL;GACM;GACd;;CAIN,MAAM,EAAE,4BAAmB,2CAAC,gBAAD,EAAkB,EAAC;AAC9C,QAAO;EAAE;EAAe;EAAQ;EAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"dev-view.mjs","names":[],"sources":["../../src/components/dev-view.tsx"],"sourcesContent":["import { Box, render, Text, useApp, useInput } from \"ink\";\nimport { useEffect, useState } from \"react\";\nimport type { SourceMode } from \"../types\";\nimport { linkify } from \"../utils/linkify\";\nimport { colors, divider, frames, gradients, icons } from \"../utils/theme\";\n\nconst PLUGIN_PREFIX = \"plugin:\";\n\nexport type ProcessStatus = \"pending\" | \"starting\" | \"ready\" | \"error\";\n\nexport interface ProcessState {\n name: string;\n status: ProcessStatus;\n port: number;\n message?: string;\n source?: SourceMode;\n}\n\nexport interface LogEntry {\n id: string;\n source: string;\n line: string;\n timestamp: number;\n isError?: boolean;\n}\n\ninterface DevViewProps {\n processes: ProcessState[];\n logs: LogEntry[];\n description: string;\n proxyTarget?: string;\n onExit?: () => Promise<void> | void;\n onExportLogs?: () => Promise<void> | void;\n}\n\nfunction StatusIcon({ status }: { status: ProcessStatus }) {\n switch (status) {\n case \"pending\":\n return <Text color=\"gray\">{icons.pending}</Text>;\n case \"starting\":\n return <Text color=\"#00ffff\">{icons.scan}</Text>;\n case \"ready\":\n return <Text color=\"#00ff41\">{icons.ok}</Text>;\n case \"error\":\n return <Text color=\"#ff3366\">{icons.err}</Text>;\n }\n}\n\nfunction getServiceColor(name: string): string {\n if (name.startsWith(PLUGIN_PREFIX)) return \"#ffaa00\";\n return name === \"host\" ? \"#00ffff\" : name === \"ui\" ? \"#ff00ff\" : \"#0080ff\";\n}\n\nfunction getDisplayName(name: string): string {\n return name.startsWith(PLUGIN_PREFIX)\n ? name.slice(PLUGIN_PREFIX.length).toUpperCase()\n : name.toUpperCase();\n}\n\nfunction isPlugin(name: string): boolean {\n return name.startsWith(PLUGIN_PREFIX);\n}\n\nfunction getSectionedProcesses(processes: ProcessState[]): Array<{\n key: string;\n title: string;\n processes: ProcessState[];\n}> {\n const plugins = processes.filter((p) => isPlugin(p.name));\n const services = processes.filter((p) => !isPlugin(p.name));\n const sections: Array<{ key: string; title: string; processes: ProcessState[] }> = [];\n if (plugins.length > 0) sections.push({ key: \"plugins\", title: \"PLUGINS\", processes: plugins });\n if (services.length > 0)\n sections.push({ key: \"services\", title: \"SERVICES\", processes: services });\n return sections;\n}\n\nfunction getColumnWidths(processes: ProcessState[]): { name: number; source: number } {\n const name = Math.max(6, ...processes.map((p) => getDisplayName(p.name).length));\n const source = Math.max(10, ...processes.map((p) => (p.source ? `(${p.source})`.length : 0)));\n return { name, source };\n}\n\nfunction ProcessRow({\n proc,\n nameWidth,\n sourceWidth,\n}: {\n proc: ProcessState;\n nameWidth: number;\n sourceWidth: number;\n}) {\n const color = getServiceColor(proc.name);\n const isRemote = proc.source === \"remote\";\n const isHost = proc.name === \"host\";\n const showPort = proc.port > 0 && (isHost || !isRemote);\n const portStr = showPort ? `:${proc.port}` : \"\";\n const sourceLabel = proc.source ? ` (${proc.source})` : \"\";\n\n const statusText =\n proc.status === \"pending\"\n ? \"waiting\"\n : proc.status === \"starting\"\n ? \"starting\"\n : proc.status === \"ready\"\n ? isRemote && !isHost\n ? \"loaded\"\n : \"running\"\n : \"failed\";\n\n return (\n <Box>\n <Text>{\" \"}</Text>\n <StatusIcon status={proc.status} />\n <Text> </Text>\n <Text color={color} bold>\n {getDisplayName(proc.name).padEnd(nameWidth)}\n </Text>\n <Text color=\"gray\">{sourceLabel.padEnd(sourceWidth)}</Text>\n <Text color={proc.status === \"ready\" ? \"#00ff41\" : \"gray\"}>{statusText}</Text>\n {showPort && <Text color=\"#00ffff\"> {portStr}</Text>}\n </Box>\n );\n}\n\nfunction SectionHeader({ title }: { title: string }) {\n return (\n <Box marginBottom={0} marginTop={1}>\n <Text color=\"#00ffff\" bold>\n {title}\n </Text>\n </Box>\n );\n}\n\nfunction LogLine({ entry }: { entry: LogEntry }) {\n const color = getServiceColor(entry.source);\n\n return (\n <Box>\n <Text color={color}>[{entry.source}]</Text>\n <Text color={entry.isError ? \"#ff3366\" : undefined}> {linkify(entry.line)}</Text>\n </Box>\n );\n}\n\nfunction truncateUrl(url: string, maxLen: number): string {\n if (url.length <= maxLen) return url;\n try {\n const parsed = new URL(url);\n const host = parsed.host;\n if (host.length > maxLen - 10) {\n return `${host.slice(0, maxLen - 13)}...`;\n }\n return host;\n } catch {\n return `${url.slice(0, maxLen - 3)}...`;\n }\n}\n\nfunction DevView({\n processes,\n logs,\n description,\n proxyTarget,\n onExit,\n onExportLogs,\n}: DevViewProps) {\n const { exit } = useApp();\n const [isShuttingDown, setIsShuttingDown] = useState(false);\n\n useInput((input, key) => {\n if (isShuttingDown) return;\n\n if (input === \"q\" || (key.ctrl && input === \"c\")) {\n setIsShuttingDown(true);\n Promise.resolve(onExit?.()).then(() => {\n exit();\n });\n }\n if (input === \"l\") {\n setIsShuttingDown(true);\n Promise.resolve(onExportLogs?.()).then(() => {\n exit();\n });\n }\n });\n\n const readyCount = processes.filter((p) => p.status === \"ready\").length;\n const total = processes.length;\n const allReady = readyCount === total;\n const hostProcess = processes.find((p) => p.name === \"host\");\n const hostPort = hostProcess?.port || 3000;\n const recentLogs = logs.slice(-12);\n const sectionedProcesses = getSectionedProcesses(processes);\n const columnWidths = getColumnWidths(processes);\n\n return (\n <Box flexDirection=\"column\">\n <Box marginBottom={0}>\n <Text color=\"#00ffff\">{frames.top(52)}</Text>\n </Box>\n <Box>\n <Text>\n {\" \"}\n {icons.run} {gradients.cyber(description.toUpperCase())}\n </Text>\n </Box>\n <Box marginBottom={1}>\n <Text color=\"#00ffff\">{frames.bottom(52)}</Text>\n </Box>\n\n {allReady && (\n <Box marginBottom={1} flexDirection=\"column\">\n <Box>\n <Text color=\"#00ff41\">\n {\" \"}\n {icons.app} APP READY\n </Text>\n </Box>\n <Box>\n <Text color=\"#00ff41\" bold>\n {\" \"}\n {icons.arrow} http://localhost:{hostPort}\n </Text>\n </Box>\n </Box>\n )}\n\n {proxyTarget && (\n <Box marginBottom={1}>\n <Text color=\"#ffaa00\">\n {\" \"}\n {icons.arrow} API PROXY → {truncateUrl(proxyTarget, 38)}\n </Text>\n </Box>\n )}\n\n <Box marginTop={0} marginBottom={0}>\n <Text>{colors.dim(divider(52))}</Text>\n </Box>\n\n {sectionedProcesses.map((section) => (\n <Box key={section.key} flexDirection=\"column\">\n <SectionHeader title={section.title} />\n {section.processes.map((proc) => (\n <ProcessRow\n key={proc.name}\n proc={proc}\n nameWidth={columnWidths.name}\n sourceWidth={columnWidths.source}\n />\n ))}\n </Box>\n ))}\n\n <Box marginTop={1} marginBottom={0}>\n <Text>{colors.dim(divider(52))}</Text>\n </Box>\n\n <Box marginTop={0}>\n <Text color={allReady ? \"#00ff41\" : \"#00ffff\"}>\n {\" \"}\n {allReady\n ? `${icons.ok} All ${total} services running`\n : `${icons.scan} ${readyCount}/${total} ready`}\n </Text>\n <Text color=\"gray\">\n {\" \"}\n {icons.dot} q quit {icons.dot} l logs\n </Text>\n </Box>\n\n {recentLogs.length > 0 && (\n <>\n <Box marginTop={1} marginBottom={0}>\n <Text>{colors.dim(divider(52))}</Text>\n </Box>\n <Box flexDirection=\"column\" marginTop={0}>\n {recentLogs.map((entry) => (\n <LogLine key={entry.id} entry={entry} />\n ))}\n </Box>\n </>\n )}\n </Box>\n );\n}\n\nexport interface DevViewHandle {\n updateProcess: (name: string, status: ProcessStatus, message?: string) => void;\n addLog: (source: string, line: string, isError?: boolean) => void;\n unmount: () => void;\n}\n\nexport function renderDevView(\n initialProcesses: ProcessState[],\n description: string,\n env: Record<string, string>,\n onExit?: () => Promise<void> | void,\n onExportLogs?: () => Promise<void> | void,\n): DevViewHandle {\n let processes = [...initialProcesses];\n let logs: LogEntry[] = [];\n let rerender: (() => void) | null = null;\n const proxyTarget = env.API_PROXY;\n let logSeq = 0;\n let lastLogKey: string | null = null;\n\n const updateProcess = (name: string, status: ProcessStatus, message?: string) => {\n processes = processes.map((p) => (p.name === name ? { ...p, status, message } : p));\n rerender?.();\n };\n\n const addLog = (source: string, line: string, isError = false) => {\n const nextKey = `${source}:${isError ? \"1\" : \"0\"}:${line}`;\n if (nextKey === lastLogKey) return;\n lastLogKey = nextKey;\n\n logs = [\n ...logs,\n { id: `${Date.now()}-${++logSeq}`, source, line, timestamp: Date.now(), isError },\n ];\n if (logs.length > 100) logs = logs.slice(-100);\n rerender?.();\n };\n\n function DevViewWrapper() {\n const [, forceUpdate] = useState(0);\n\n useEffect(() => {\n rerender = () => forceUpdate((n: number) => n + 1);\n return () => {\n rerender = null;\n };\n }, []);\n\n return (\n <DevView\n processes={processes}\n logs={logs}\n description={description}\n proxyTarget={proxyTarget}\n onExit={onExit}\n onExportLogs={onExportLogs}\n />\n );\n }\n\n const { unmount } = render(<DevViewWrapper />);\n return { updateProcess, addLog, unmount };\n}\n"],"mappings":";;;;;;;AAMA,MAAM,gBAAgB;AA6BtB,SAAS,WAAW,EAAE,UAAqC;AACzD,SAAQ,QAAR;EACE,KAAK,UACH,QAAO,oBAAC,MAAD;GAAM,OAAM;aAAQ,MAAM;GAAe;EAClD,KAAK,WACH,QAAO,oBAAC,MAAD;GAAM,OAAM;aAAW,MAAM;GAAY;EAClD,KAAK,QACH,QAAO,oBAAC,MAAD;GAAM,OAAM;aAAW,MAAM;GAAU;EAChD,KAAK,QACH,QAAO,oBAAC,MAAD;GAAM,OAAM;aAAW,MAAM;GAAW;;;AAIrD,SAAS,gBAAgB,MAAsB;AAC7C,KAAI,KAAK,WAAW,cAAc,CAAE,QAAO;AAC3C,QAAO,SAAS,SAAS,YAAY,SAAS,OAAO,YAAY;;AAGnE,SAAS,eAAe,MAAsB;AAC5C,QAAO,KAAK,WAAW,cAAc,GACjC,KAAK,MAAM,EAAqB,CAAC,aAAa,GAC9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E,GAAG;GAAG;GAAQ;GAAS,GAAG,EAAG;AACnF,cAAY;;CAGd,MAAM,UAAU,QAAgB,MAAc,UAAU,UAAU;EAChE,MAAM,UAAU,GAAG,OAAO,GAAG,UAAU,MAAM,IAAI,GAAG;AACpD,MAAI,YAAY,WAAY;AAC5B,eAAa;AAEb,SAAO,CACL,GAAG,MACH;GAAE,IAAI,GAAG,KAAK,KAAK,CAAC,GAAG,EAAE;GAAU;GAAQ;GAAM,WAAW,KAAK,KAAK;GAAE;GAAS,CAClF;AACD,MAAI,KAAK,SAAS,IAAK,QAAO,KAAK,MAAM,KAAK;AAC9C,cAAY;;CAGd,SAAS,iBAAiB;EACxB,MAAM,GAAG,eAAe,SAAS,EAAE;AAEnC,kBAAgB;AACd,oBAAiB,aAAa,MAAc,IAAI,EAAE;AAClD,gBAAa;AACX,eAAW;;KAEZ,EAAE,CAAC;AAEN,SACE,oBAAC,SAAD;GACa;GACL;GACO;GACA;GACL;GACM;GACd;;CAIN,MAAM,EAAE,YAAY,OAAO,oBAAC,gBAAD,EAAkB,EAAC;AAC9C,QAAO;EAAE;EAAe;EAAQ;EAAS"}
1
+ {"version":3,"file":"dev-view.mjs","names":[],"sources":["../../src/components/dev-view.tsx"],"sourcesContent":["import { Box, render, Text, useApp, useInput } from \"ink\";\nimport { useEffect, useState } from \"react\";\nimport type { SourceMode } from \"../types\";\nimport { linkify } from \"../utils/linkify\";\nimport { colors, divider, frames, gradients, icons } from \"../utils/theme\";\n\nconst PLUGIN_PREFIX = \"plugin:\";\n\nexport type ProcessStatus = \"pending\" | \"starting\" | \"ready\" | \"error\";\n\nexport interface ProcessState {\n name: string;\n status: ProcessStatus;\n port: number;\n message?: string;\n source?: SourceMode;\n}\n\nexport interface LogEntry {\n id: string;\n source: string;\n line: string;\n timestamp: number;\n isError?: boolean;\n}\n\ninterface DevViewProps {\n processes: ProcessState[];\n logs: LogEntry[];\n description: string;\n proxyTarget?: string;\n onExit?: () => Promise<void> | void;\n onExportLogs?: () => Promise<void> | void;\n}\n\nfunction StatusIcon({ status }: { status: ProcessStatus }) {\n switch (status) {\n case \"pending\":\n return <Text color=\"gray\">{icons.pending}</Text>;\n case \"starting\":\n return <Text color=\"#00ffff\">{icons.scan}</Text>;\n case \"ready\":\n return <Text color=\"#00ff41\">{icons.ok}</Text>;\n case \"error\":\n return <Text color=\"#ff3366\">{icons.err}</Text>;\n }\n}\n\nfunction getServiceColor(name: string): string {\n if (name.startsWith(PLUGIN_PREFIX)) return \"#ffaa00\";\n return name === \"host\" ? \"#00ffff\" : name === \"ui\" ? \"#ff00ff\" : \"#0080ff\";\n}\n\nfunction getDisplayName(name: string): string {\n return name.startsWith(PLUGIN_PREFIX)\n ? name.slice(PLUGIN_PREFIX.length).toUpperCase()\n : name.toUpperCase();\n}\n\nfunction isPlugin(name: string): boolean {\n return name.startsWith(PLUGIN_PREFIX);\n}\n\nfunction getSectionedProcesses(processes: ProcessState[]): Array<{\n key: string;\n title: string;\n processes: ProcessState[];\n}> {\n const plugins = processes.filter((p) => isPlugin(p.name));\n const services = processes.filter((p) => !isPlugin(p.name));\n const sections: Array<{ key: string; title: string; processes: ProcessState[] }> = [];\n if (plugins.length > 0) sections.push({ key: \"plugins\", title: \"PLUGINS\", processes: plugins });\n if (services.length > 0)\n sections.push({ key: \"services\", title: \"SERVICES\", processes: services });\n return sections;\n}\n\nfunction getColumnWidths(processes: ProcessState[]): { name: number; source: number } {\n const name = Math.max(6, ...processes.map((p) => getDisplayName(p.name).length));\n const source = Math.max(10, ...processes.map((p) => (p.source ? `(${p.source})`.length : 0)));\n return { name, source };\n}\n\nfunction ProcessRow({\n proc,\n nameWidth,\n sourceWidth,\n}: {\n proc: ProcessState;\n nameWidth: number;\n sourceWidth: number;\n}) {\n const color = getServiceColor(proc.name);\n const isRemote = proc.source === \"remote\";\n const isHost = proc.name === \"host\";\n const showPort = proc.port > 0 && (isHost || !isRemote);\n const portStr = showPort ? `:${proc.port}` : \"\";\n const sourceLabel = proc.source ? ` (${proc.source})` : \"\";\n\n const statusText =\n proc.status === \"pending\"\n ? \"waiting\"\n : proc.status === \"starting\"\n ? \"starting\"\n : proc.status === \"ready\"\n ? isRemote && !isHost\n ? \"loaded\"\n : \"running\"\n : \"failed\";\n\n return (\n <Box>\n <Text>{\" \"}</Text>\n <StatusIcon status={proc.status} />\n <Text> </Text>\n <Text color={color} bold>\n {getDisplayName(proc.name).padEnd(nameWidth)}\n </Text>\n <Text color=\"gray\">{sourceLabel.padEnd(sourceWidth)}</Text>\n <Text color={proc.status === \"ready\" ? \"#00ff41\" : \"gray\"}>{statusText}</Text>\n {showPort && <Text color=\"#00ffff\"> {portStr}</Text>}\n </Box>\n );\n}\n\nfunction SectionHeader({ title }: { title: string }) {\n return (\n <Box marginBottom={0} marginTop={1}>\n <Text color=\"#00ffff\" bold>\n {title}\n </Text>\n </Box>\n );\n}\n\nfunction LogLine({ entry }: { entry: LogEntry }) {\n const color = getServiceColor(entry.source);\n\n return (\n <Box>\n <Text color={color}>[{entry.source}]</Text>\n <Text color={entry.isError ? \"#ff3366\" : undefined}> {linkify(entry.line)}</Text>\n </Box>\n );\n}\n\nfunction truncateUrl(url: string, maxLen: number): string {\n if (url.length <= maxLen) return url;\n try {\n const parsed = new URL(url);\n const host = parsed.host;\n if (host.length > maxLen - 10) {\n return `${host.slice(0, maxLen - 13)}...`;\n }\n return host;\n } catch {\n return `${url.slice(0, maxLen - 3)}...`;\n }\n}\n\nfunction DevView({\n processes,\n logs,\n description,\n proxyTarget,\n onExit,\n onExportLogs,\n}: DevViewProps) {\n const { exit } = useApp();\n const [isShuttingDown, setIsShuttingDown] = useState(false);\n\n useInput((input, key) => {\n if (isShuttingDown) return;\n\n if (input === \"q\" || (key.ctrl && input === \"c\")) {\n setIsShuttingDown(true);\n Promise.resolve(onExit?.()).then(() => {\n exit();\n });\n }\n if (input === \"l\") {\n setIsShuttingDown(true);\n Promise.resolve(onExportLogs?.()).then(() => {\n exit();\n });\n }\n });\n\n const readyCount = processes.filter((p) => p.status === \"ready\").length;\n const total = processes.length;\n const allReady = readyCount === total;\n const hostProcess = processes.find((p) => p.name === \"host\");\n const hostPort = hostProcess?.port || 3000;\n const recentLogs = logs.slice(-12);\n const sectionedProcesses = getSectionedProcesses(processes);\n const columnWidths = getColumnWidths(processes);\n\n return (\n <Box flexDirection=\"column\">\n <Box marginBottom={0}>\n <Text color=\"#00ffff\">{frames.top(52)}</Text>\n </Box>\n <Box>\n <Text>\n {\" \"}\n {icons.run} {gradients.cyber(description.toUpperCase())}\n </Text>\n </Box>\n <Box marginBottom={1}>\n <Text color=\"#00ffff\">{frames.bottom(52)}</Text>\n </Box>\n\n {allReady && (\n <Box marginBottom={1} flexDirection=\"column\">\n <Box>\n <Text color=\"#00ff41\">\n {\" \"}\n {icons.app} APP READY\n </Text>\n </Box>\n <Box>\n <Text color=\"#00ff41\" bold>\n {\" \"}\n {icons.arrow} http://localhost:{hostPort}\n </Text>\n </Box>\n </Box>\n )}\n\n {proxyTarget && (\n <Box marginBottom={1}>\n <Text color=\"#ffaa00\">\n {\" \"}\n {icons.arrow} API PROXY → {truncateUrl(proxyTarget, 38)}\n </Text>\n </Box>\n )}\n\n <Box marginTop={0} marginBottom={0}>\n <Text>{colors.dim(divider(52))}</Text>\n </Box>\n\n {sectionedProcesses.map((section) => (\n <Box key={section.key} flexDirection=\"column\">\n <SectionHeader title={section.title} />\n {section.processes.map((proc) => (\n <ProcessRow\n key={proc.name}\n proc={proc}\n nameWidth={columnWidths.name}\n sourceWidth={columnWidths.source}\n />\n ))}\n </Box>\n ))}\n\n <Box marginTop={1} marginBottom={0}>\n <Text>{colors.dim(divider(52))}</Text>\n </Box>\n\n <Box marginTop={0}>\n <Text color={allReady ? \"#00ff41\" : \"#00ffff\"}>\n {\" \"}\n {allReady\n ? `${icons.ok} All ${total} services running`\n : `${icons.scan} ${readyCount}/${total} ready`}\n </Text>\n <Text color=\"gray\">\n {\" \"}\n {icons.dot} q quit {icons.dot} l logs\n </Text>\n </Box>\n\n {recentLogs.length > 0 && (\n <>\n <Box marginTop={1} marginBottom={0}>\n <Text>{colors.dim(divider(52))}</Text>\n </Box>\n <Box flexDirection=\"column\" marginTop={0}>\n {recentLogs.map((entry) => (\n <LogLine key={entry.id} entry={entry} />\n ))}\n </Box>\n </>\n )}\n </Box>\n );\n}\n\nexport interface DevViewHandle {\n updateProcess: (name: string, status: ProcessStatus, message?: string) => void;\n addLog: (source: string, line: string, isError?: boolean) => void;\n unmount: () => void;\n}\n\nexport function renderDevView(\n initialProcesses: ProcessState[],\n description: string,\n env: Record<string, string>,\n onExit?: () => Promise<void> | void,\n onExportLogs?: () => Promise<void> | void,\n): DevViewHandle {\n let processes = [...initialProcesses];\n let logs: LogEntry[] = [];\n let rerender: (() => void) | null = null;\n const proxyTarget = env.API_PROXY;\n let logSeq = 0;\n let lastLogKey: string | null = null;\n\n const updateProcess = (name: string, status: ProcessStatus, message?: string) => {\n processes = processes.map((p) => (p.name === name ? { ...p, status, message } : p));\n rerender?.();\n };\n\n const addLog = (source: string, line: string, isError = false) => {\n const nextKey = `${source}:${isError ? \"1\" : \"0\"}:${line}`;\n if (nextKey === lastLogKey) return;\n lastLogKey = nextKey;\n\n logs = [\n ...logs,\n { id: `${Date.now()}-${++logSeq}`, source, line, timestamp: Date.now(), isError },\n ];\n if (logs.length > 100) logs = logs.slice(-100);\n rerender?.();\n };\n\n function DevViewWrapper() {\n const [, forceUpdate] = useState(0);\n\n useEffect(() => {\n rerender = () => forceUpdate((n: number) => n + 1);\n return () => {\n rerender = null;\n };\n }, []);\n\n return (\n <DevView\n processes={processes}\n logs={logs}\n description={description}\n proxyTarget={proxyTarget}\n onExit={onExit}\n onExportLogs={onExportLogs}\n />\n );\n }\n\n const { unmount } = render(<DevViewWrapper />);\n return { updateProcess, addLog, unmount };\n}\n"],"mappings":";;;;;;;AAMA,MAAM,gBAAgB;AA6BtB,SAAS,WAAW,EAAE,UAAqC;AACzD,SAAQ,QAAR;EACE,KAAK,UACH,QAAO,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":["../../src/components/streaming-view.ts"],"sourcesContent":["import chalk from \"chalk\";\nimport { linkify } from \"../utils/linkify\";\nimport { colors, icons } from \"../utils/theme\";\nimport type { ProcessState, ProcessStatus } from \"./dev-view\";\n\nconst orange = chalk.hex(\"#ffaa00\");\nconst PLUGIN_PREFIX = \"plugin:\";\n\nexport interface StreamingViewHandle {\n updateProcess: (name: string, status: ProcessStatus, message?: string) => void;\n addLog: (source: string, line: string, isError?: boolean) => void;\n unmount: () => Promise<void> | void;\n}\n\nconst getTimestamp = (): string => {\n const now = new Date();\n return `${now.getHours().toString().padStart(2, \"0\")}:${now.getMinutes().toString().padStart(2, \"0\")}:${now.getSeconds().toString().padStart(2, \"0\")}`;\n};\n\nconst write = (text: string) => process.stdout.write(`${text}\\n`);\n\nconst getServiceColor = (name: string): ((s: string) => string) => {\n if (name.startsWith(PLUGIN_PREFIX)) return orange;\n if (name === \"host\") return colors.cyan;\n if (name === \"ui\" || name === \"ui-ssr\") return colors.magenta;\n if (name === \"api\") return colors.blue;\n return colors.white;\n};\n\nconst getDisplayName = (name: string): string => {\n return name.startsWith(PLUGIN_PREFIX)\n ? name.slice(PLUGIN_PREFIX.length).toUpperCase()\n : name.toUpperCase();\n};\n\nconst isPlugin = (name: string): boolean => name.startsWith(PLUGIN_PREFIX);\n\nconst getSectionedProcesses = (processes: ProcessState[]) => {\n const plugins = processes.filter((p) => isPlugin(p.name));\n const services = processes.filter((p) => !isPlugin(p.name));\n const sections: Array<{ key: string; title: string; processes: ProcessState[] }> = [];\n if (plugins.length > 0) sections.push({ key: \"plugins\", title: \"PLUGINS\", processes: plugins });\n if (services.length > 0)\n sections.push({ key: \"services\", title: \"SERVICES\", processes: services });\n return sections;\n};\n\nconst getColumnWidths = (processes: ProcessState[]) => {\n const name = Math.max(6, ...processes.map((p) => getDisplayName(p.name).length));\n const source = Math.max(10, ...processes.map((p) => (p.source ? ` (${p.source})`.length : 0)));\n return { name, source };\n};\n\nconst getStatusIcon = (status: ProcessStatus): string => {\n switch (status) {\n case \"pending\":\n return icons.pending;\n case \"starting\":\n return icons.scan;\n case \"ready\":\n return icons.ok;\n case \"error\":\n return icons.err;\n }\n};\n\nexport function renderStreamingView(\n initialProcesses: ProcessState[],\n description: string,\n env: Record<string, string>,\n onExit?: () => Promise<void> | void,\n): StreamingViewHandle {\n const processes = new Map<string, ProcessState>();\n for (const p of initialProcesses) {\n processes.set(p.name, { ...p });\n }\n\n let allReadyPrinted = false;\n const hostProcess = initialProcesses.find((p) => p.name === \"host\");\n const hostPort = hostProcess?.port || 3000;\n const proxyTarget = env.API_PROXY;\n const sectionedProcesses = getSectionedProcesses(initialProcesses);\n const columnWidths = getColumnWidths(initialProcesses);\n const lastLogBySource = new Map<string, string>();\n\n const headerLines: string[] = [\n \"\",\n colors.cyan(`${\"─\".repeat(52)}`),\n ` ${icons.run} ${colors.cyan(description.toUpperCase())}`,\n colors.cyan(`${\"─\".repeat(52)}`),\n \"\",\n ];\n\n if (proxyTarget) {\n headerLines.push(orange(` ${icons.arrow} API PROXY → ${proxyTarget}`), \"\");\n }\n\n for (const section of sectionedProcesses) {\n headerLines.push(colors.cyan(` ${section.title}`));\n for (const proc of section.processes) {\n const color = getServiceColor(proc.name);\n const sourceLabel = proc.source ? ` (${proc.source})` : \"\";\n headerLines.push(\n `${colors.dim(`[${getTimestamp()}]`)} ${color(`[${getDisplayName(proc.name).padEnd(columnWidths.name)}]`)} ${icons.pending} waiting${sourceLabel.padEnd(columnWidths.source)}`,\n );\n }\n headerLines.push(\"\");\n }\n console.log(headerLines.join(\"\\n\"));\n\n const checkAllReady = () => {\n if (allReadyPrinted) return;\n const allReady = Array.from(processes.values()).every((p) => p.status === \"ready\");\n if (allReady) {\n allReadyPrinted = true;\n const readyLines = [\n \"\",\n colors.dim(`${\"─\".repeat(52)}`),\n colors.green(`${icons.ok} All ${processes.size} services ready`),\n colors.green(`${icons.arrow} http://localhost:${hostPort}`),\n colors.dim(`${\"─\".repeat(52)}`),\n \"\",\n ];\n console.log(readyLines.join(\"\\n\"));\n }\n };\n\n const updateProcess = (name: string, status: ProcessStatus, message?: string) => {\n const proc = processes.get(name);\n if (!proc) return;\n\n proc.status = status;\n if (message) proc.message = message;\n\n const color = getServiceColor(name);\n const icon = getStatusIcon(status);\n const displayName = getDisplayName(name).padEnd(columnWidths.name);\n const sourceLabel = proc?.source ? ` (${proc.source})` : \"\";\n const isRemote = proc?.source === \"remote\";\n const isHost = name === \"host\";\n const showPort = proc.port > 0 && (isHost || !isRemote) && status === \"ready\";\n const statusText =\n status === \"ready\"\n ? isRemote && !isHost\n ? \"loaded\"\n : \"running\"\n : status === \"starting\"\n ? \"starting\"\n : status === \"error\"\n ? \"failed\"\n : \"waiting\";\n const portStr = showPort ? ` :${proc.port}` : \"\";\n\n write(\n `${colors.dim(`[${getTimestamp()}]`)} ${color(`[${displayName}]`)} ${status === \"ready\" ? colors.green(icon) : status === \"error\" ? colors.error(icon) : icon} ${statusText}${sourceLabel.padEnd(columnWidths.source)}${portStr}`,\n );\n\n checkAllReady();\n };\n\n const addLog = (source: string, line: string, isError = false) => {\n const lastLine = lastLogBySource.get(source);\n const nextLine = `${isError ? \"ERR\" : \"OUT\"}:${line}`;\n if (lastLine === nextLine) return;\n lastLogBySource.set(source, nextLine);\n\n const color = getServiceColor(source);\n const logColor = isError ? colors.error : colors.dim;\n write(\n `${colors.dim(`[${getTimestamp()}]`)} ${color(`[${source.toUpperCase()}]`)} ${colors.dim(\"│\")} ${logColor(linkify(line))}`,\n );\n };\n\n const unmount = () => onExit?.();\n\n return { updateProcess, addLog, unmount };\n}\n"],"mappings":";;;;;;;AAKA,MAAM,SAAS,cAAM,IAAI,UAAU;AACnC,MAAM,gBAAgB;AAQtB,MAAM,qBAA6B;CACjC,MAAM,sBAAM,IAAI,MAAM;AACtB,QAAO,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,IAAI,YAAY,CAAC,UAAU,CAAC,SAAS,GAAG,IAA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AAa,OAAO,GAAG,UAC1N;AAED,iBAAe;;CAGjB,MAAM,UAAU,QAAgB,MAAc,UAAU,UAAU;EAChE,MAAM,WAAW,gBAAgB,IAAI,OAAO;EAC5C,MAAM,WAAW,GAAG,UAAU,QAAQ,MAAM,GAAG;AAC/C,MAAI,aAAa,SAAU;AAC3B,kBAAgB,IAAI,QAAQ,SAAS;EAErC,MAAM,QAAQ,gBAAgB,OAAO;EACrC,MAAM,WAAW,UAAUA,qBAAO,QAAQA,qBAAO;AACjD,QACE,GAAGA,qBAAO,IAAI,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,MAAM,IAAI,OAAO,aAAa,CAAC,GAAG,CAAC,IAAIA,qBAAO,IAAI,IAAI,CAAC,GAAG,SAASE,wBAAQ,KAAK,CAAC,GAC1H;;CAGH,MAAM,gBAAgB,UAAU;AAEhC,QAAO;EAAE;EAAe;EAAQ;EAAS"}
1
+ {"version":3,"file":"streaming-view.cjs","names":["colors","icons","linkify"],"sources":["../../src/components/streaming-view.ts"],"sourcesContent":["import chalk from \"chalk\";\nimport { linkify } from \"../utils/linkify\";\nimport { colors, icons } from \"../utils/theme\";\nimport type { ProcessState, ProcessStatus } from \"./dev-view\";\n\nconst orange = chalk.hex(\"#ffaa00\");\nconst PLUGIN_PREFIX = \"plugin:\";\n\nexport interface StreamingViewHandle {\n updateProcess: (name: string, status: ProcessStatus, message?: string) => void;\n addLog: (source: string, line: string, isError?: boolean) => void;\n unmount: () => Promise<void> | void;\n}\n\nconst getTimestamp = (): string => {\n const now = new Date();\n return `${now.getHours().toString().padStart(2, \"0\")}:${now.getMinutes().toString().padStart(2, \"0\")}:${now.getSeconds().toString().padStart(2, \"0\")}`;\n};\n\nconst write = (text: string) => process.stdout.write(`${text}\\n`);\n\nconst getServiceColor = (name: string): ((s: string) => string) => {\n if (name.startsWith(PLUGIN_PREFIX)) return orange;\n if (name === \"host\") return colors.cyan;\n if (name === \"ui\" || name === \"ui-ssr\") return colors.magenta;\n if (name === \"api\") return colors.blue;\n return colors.white;\n};\n\nconst getDisplayName = (name: string): string => {\n return name.startsWith(PLUGIN_PREFIX)\n ? name.slice(PLUGIN_PREFIX.length).toUpperCase()\n : name.toUpperCase();\n};\n\nconst isPlugin = (name: string): boolean => name.startsWith(PLUGIN_PREFIX);\n\nconst getSectionedProcesses = (processes: ProcessState[]) => {\n const plugins = processes.filter((p) => isPlugin(p.name));\n const services = processes.filter((p) => !isPlugin(p.name));\n const sections: Array<{ key: string; title: string; processes: ProcessState[] }> = [];\n if (plugins.length > 0) sections.push({ key: \"plugins\", title: \"PLUGINS\", processes: plugins });\n if (services.length > 0)\n sections.push({ key: \"services\", title: \"SERVICES\", processes: services });\n return sections;\n};\n\nconst getColumnWidths = (processes: ProcessState[]) => {\n const name = Math.max(6, ...processes.map((p) => getDisplayName(p.name).length));\n const source = Math.max(10, ...processes.map((p) => (p.source ? ` (${p.source})`.length : 0)));\n return { name, source };\n};\n\nconst getStatusIcon = (status: ProcessStatus): string => {\n switch (status) {\n case \"pending\":\n return icons.pending;\n case \"starting\":\n return icons.scan;\n case \"ready\":\n return icons.ok;\n case \"error\":\n return icons.err;\n }\n};\n\nexport function renderStreamingView(\n initialProcesses: ProcessState[],\n description: string,\n env: Record<string, string>,\n onExit?: () => Promise<void> | void,\n): StreamingViewHandle {\n const processes = new Map<string, ProcessState>();\n for (const p of initialProcesses) {\n processes.set(p.name, { ...p });\n }\n\n let allReadyPrinted = false;\n const hostProcess = initialProcesses.find((p) => p.name === \"host\");\n const hostPort = hostProcess?.port || 3000;\n const proxyTarget = env.API_PROXY;\n const sectionedProcesses = getSectionedProcesses(initialProcesses);\n const columnWidths = getColumnWidths(initialProcesses);\n const lastLogBySource = new Map<string, string>();\n\n const headerLines: string[] = [\n \"\",\n colors.cyan(`${\"─\".repeat(52)}`),\n ` ${icons.run} ${colors.cyan(description.toUpperCase())}`,\n colors.cyan(`${\"─\".repeat(52)}`),\n \"\",\n ];\n\n if (proxyTarget) {\n headerLines.push(orange(` ${icons.arrow} API PROXY → ${proxyTarget}`), \"\");\n }\n\n for (const section of sectionedProcesses) {\n headerLines.push(colors.cyan(` ${section.title}`));\n for (const proc of section.processes) {\n const color = getServiceColor(proc.name);\n const sourceLabel = proc.source ? ` (${proc.source})` : \"\";\n headerLines.push(\n `${colors.dim(`[${getTimestamp()}]`)} ${color(`[${getDisplayName(proc.name).padEnd(columnWidths.name)}]`)} ${icons.pending} waiting${sourceLabel.padEnd(columnWidths.source)}`,\n );\n }\n headerLines.push(\"\");\n }\n console.log(headerLines.join(\"\\n\"));\n\n const checkAllReady = () => {\n if (allReadyPrinted) return;\n const allReady = Array.from(processes.values()).every((p) => p.status === \"ready\");\n if (allReady) {\n allReadyPrinted = true;\n const readyLines = [\n \"\",\n colors.dim(`${\"─\".repeat(52)}`),\n colors.green(`${icons.ok} All ${processes.size} services ready`),\n colors.green(`${icons.arrow} http://localhost:${hostPort}`),\n colors.dim(`${\"─\".repeat(52)}`),\n \"\",\n ];\n console.log(readyLines.join(\"\\n\"));\n }\n };\n\n const updateProcess = (name: string, status: ProcessStatus, message?: string) => {\n const proc = processes.get(name);\n if (!proc) return;\n\n proc.status = status;\n if (message) proc.message = message;\n\n const color = getServiceColor(name);\n const icon = getStatusIcon(status);\n const displayName = getDisplayName(name).padEnd(columnWidths.name);\n const sourceLabel = proc?.source ? ` (${proc.source})` : \"\";\n const isRemote = proc?.source === \"remote\";\n const isHost = name === \"host\";\n const showPort = proc.port > 0 && (isHost || !isRemote) && status === \"ready\";\n const statusText =\n status === \"ready\"\n ? isRemote && !isHost\n ? \"loaded\"\n : \"running\"\n : status === \"starting\"\n ? \"starting\"\n : status === \"error\"\n ? \"failed\"\n : \"waiting\";\n const portStr = showPort ? ` :${proc.port}` : \"\";\n\n write(\n `${colors.dim(`[${getTimestamp()}]`)} ${color(`[${displayName}]`)} ${status === \"ready\" ? colors.green(icon) : status === \"error\" ? colors.error(icon) : icon} ${statusText}${sourceLabel.padEnd(columnWidths.source)}${portStr}`,\n );\n\n checkAllReady();\n };\n\n const addLog = (source: string, line: string, isError = false) => {\n const lastLine = lastLogBySource.get(source);\n const nextLine = `${isError ? \"ERR\" : \"OUT\"}:${line}`;\n if (lastLine === nextLine) return;\n lastLogBySource.set(source, nextLine);\n\n const color = getServiceColor(source);\n const logColor = isError ? colors.error : colors.dim;\n write(\n `${colors.dim(`[${getTimestamp()}]`)} ${color(`[${source.toUpperCase()}]`)} ${colors.dim(\"│\")} ${logColor(linkify(line))}`,\n );\n };\n\n const unmount = () => onExit?.();\n\n return { updateProcess, addLog, unmount };\n}\n"],"mappings":";;;;;;;AAKA,MAAM,SAAS,cAAM,IAAI,UAAU;AACnC,MAAM,gBAAgB;AAQtB,MAAM,qBAA6B;CACjC,MAAM,sBAAM,IAAI,MAAM;AACtB,QAAO,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,IAAI,YAAY,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,IAAI,YAAY,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI;;AAGtJ,MAAM,SAAS,SAAiB,QAAQ,OAAO,MAAM,GAAG,KAAK,IAAI;AAEjE,MAAM,mBAAmB,SAA0C;AACjE,KAAI,KAAK,WAAW,cAAc,CAAE,QAAO;AAC3C,KAAI,SAAS,OAAQ,QAAOA,qBAAO;AACnC,KAAI,SAAS,QAAQ,SAAS,SAAU,QAAOA,qBAAO;AACtD,KAAI,SAAS,MAAO,QAAOA,qBAAO;AAClC,QAAOA,qBAAO;;AAGhB,MAAM,kBAAkB,SAAyB;AAC/C,QAAO,KAAK,WAAW,cAAc,GACjC,KAAK,MAAM,EAAqB,CAAC,aAAa,GAC9C,KAAK,aAAa;;AAGxB,MAAM,YAAY,SAA0B,KAAK,WAAW,cAAc;AAE1E,MAAM,yBAAyB,cAA8B;CAC3D,MAAM,UAAU,UAAU,QAAQ,MAAM,SAAS,EAAE,KAAK,CAAC;CACzD,MAAM,WA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