@velajs/cli 1.26.1 → 1.28.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.
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { promisify } from "node:util";
14
14
  import { parse } from "jsonc-parser";
15
15
  import { parse as parse$1 } from "smol-toml";
16
16
  //#region package.json
17
- var version = "1.26.1";
17
+ var version = "1.28.0";
18
18
  //#endregion
19
19
  //#region src/with-app.ts
20
20
  /** Own one app for the whole command, including output and long-lived transports. */
@@ -957,6 +957,9 @@ function checkDeployment(rawConfig, environment, snapshot) {
957
957
  "cf:vela-cron",
958
958
  "schedule:cron",
959
959
  "cf:queue",
960
+ "cf:queue:module",
961
+ "cf:queue:producer",
962
+ "rpc:client",
960
963
  "websocket"
961
964
  ].includes(row.kind)) continue;
962
965
  const parsed = metadataSchema.safeParse(row.meta);
@@ -965,6 +968,17 @@ function checkDeployment(rawConfig, environment, snapshot) {
965
968
  continue;
966
969
  }
967
970
  const meta = parsed.data;
971
+ if (row.kind === "cf:queue:producer" || row.kind === "rpc:client") {
972
+ if (row.kind === "rpc:client" && meta.binding === void 0) continue;
973
+ const binding = meta.binding;
974
+ const kind = row.kind === "rpc:client" ? "services" : "queues";
975
+ if (typeof binding !== "string" || !binding || !target.bindings.some((b) => b.name === binding && b.kind === kind)) report(row.kind === "rpc:client" ? "missing-service-binding" : "missing-queue-producer", `A declared ${kind} binding is missing from the selected environment.`);
976
+ continue;
977
+ }
978
+ if (row.kind === "cf:queue:module" && (typeof meta.logicalQueue !== "string" || !meta.logicalQueue.trim())) {
979
+ report("invalid-queue-mapping", "A native consumer mapping requires a logical queue name.");
980
+ continue;
981
+ }
968
982
  if (row.kind === "cf:vela-cron" || row.kind === "schedule:cron") try {
969
983
  const cron = parseCronMetadata(meta);
970
984
  if (cron.dialect !== void 0 && cron.dialect !== "cloudflare" || cron.timeZone !== void 0 && cron.timeZone !== "UTC") report("incompatible-cron-options", "A cron handler explicitly requests options incompatible with Cloudflare UTC delivery.");
@@ -978,13 +992,13 @@ function checkDeployment(rawConfig, environment, snapshot) {
978
992
  if (typeof binding !== "string" || !target.bindings.some((b) => b.kind === "durable_objects" && b.name === binding)) report("missing-durable-binding", "A WebSocket gateway requires a Durable Object binding in the selected environment.");
979
993
  continue;
980
994
  }
981
- const key = row.kind === "cf:scheduled" ? "cron" : row.kind === "cf:queue" ? "queueName" : "expression";
995
+ const key = row.kind === "cf:scheduled" ? "cron" : row.kind.startsWith("cf:queue") ? "queueName" : "expression";
982
996
  const value = meta[key];
983
997
  if (typeof value !== "string" || value.trim().length === 0) {
984
998
  report("invalid-metadata", `Invalid ${row.kind}.${key} metadata.`);
985
999
  continue;
986
1000
  }
987
- if (row.kind === "cf:queue") handlerQueues.add(value);
1001
+ if (row.kind.startsWith("cf:queue")) handlerQueues.add(value);
988
1002
  else {
989
1003
  handlerCrons.add(value);
990
1004
  validateCron(value);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["describeToken","parseToml","manifest.version"],"sources":["../package.json","../src/with-app.ts","../src/format.ts","../src/introspect.ts","../src/commands/introspect.commands.ts","../src/commands/mcp.command.ts","../src/commands/seed.command.ts","../src/commands/studio.command.ts","../src/commands/client.command.ts","../src/new-project.ts","../src/commands/new.command.ts","../src/commands/doctor.command.ts","../src/commands/deploy-check.config.ts","../src/commands/deploy-check.plan.ts","../src/commands/deploy-check.command.ts","../src/index.ts"],"sourcesContent":["","import type { VelaApplication } from '@velajs/vela';\nimport type { VelaConfig } from './config.js';\n\n/** Own one app for the whole command, including output and long-lived transports. */\nexport async function withApp<Result>(\n config: VelaConfig,\n work: (app: VelaApplication) => Result | Promise<Result>,\n warn: (message: string) => void,\n): Promise<Result> {\n const app = await config.createApp();\n const report = (error: unknown): void => {\n try {\n warn(`Warning: teardown failed: ${String(error)}`);\n } catch {\n // A failed output stream must not replace the command's result/error.\n }\n };\n try {\n return await work(app);\n } finally {\n try {\n // Older 1.x apps may not implement full application disposal.\n if (typeof app.dispose === 'function') await app.dispose();\n else await app.getContainer().dispose();\n } catch (error) {\n report(error);\n // A throwing shutdown hook in older Vela versions can skip the container.\n // Disposal is idempotent; release constructed resources even in that case.\n try {\n await app.getContainer().dispose();\n } catch (cleanupError) {\n report(cleanupError);\n }\n }\n }\n}\n","import type { SeederResult } from '@velajs/vela/seeder';\n\n/**\n * Render seeder results to a logger and return a process exit code\n * (0 = all ran, 1 = at least one failed). Pure — no I/O beyond the logger.\n */\nexport function formatSeedResults(\n results: SeederResult[],\n log: (message: string) => void = (m) => console.log(m),\n): number {\n if (results.length === 0) {\n log('No seeders found.');\n return 0;\n }\n\n let failed = 0;\n for (const result of results) {\n if (result.ok) {\n log(` ✓ ${result.name}`);\n } else {\n failed++;\n log(` ✗ ${result.name}${result.error ? `: ${errorMessage(result.error)}` : ''}`);\n }\n }\n\n const total = results.length;\n log(`\\n${total - failed}/${total} seeders ran successfully.`);\n return failed > 0 ? 1 : 0;\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n/** Aligned plain-text table. Pure; returns lines. */\nexport function renderTable(headers: string[], rows: string[][]): string[] {\n const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] ?? '').length)));\n const line = (cells: string[]): string =>\n cells\n .map((c, i) => (c ?? '').padEnd(widths[i]!))\n .join(' ')\n .trimEnd();\n return [line(headers), line(widths.map((w) => '-'.repeat(w))), ...rows.map(line)];\n}\n","import type { VelaApplication } from '@velajs/vela';\nimport { describeToken, getEntrypointKinds } from '@velajs/vela';\nimport type { ModuleDescription, RouteDescription } from '@velajs/vela';\n\n/** One row of `vela route list`. */\nexport interface RouteRow {\n method: string;\n path: string;\n /** `Controller#handler`, or `(mounted)` for routes vela did not compose\n * itself (RouteContributor/CRUD, OpenAPI UI mounts, manual Hono routes). */\n handler: string;\n source: 'controller' | 'mounted';\n}\n\n/**\n * The app's route table: `describeRoutes()` rows (framework-composed truth)\n * plus everything else present on the Hono router, deduped and labeled\n * `(mounted)`. Returns null when the app never built HTTP routes.\n */\nexport function collectRoutes(app: VelaApplication): RouteRow[] | null {\n let described: RouteDescription[];\n try {\n described = app.describeRoutes();\n } catch {\n return null; // no HTTP routes built (slim/non-HTTP app)\n }\n\n const rows: RouteRow[] = described.map((r) => ({\n method: r.method,\n path: r.path,\n handler: `${r.controller}#${r.handler}`,\n source: 'controller',\n }));\n\n const covered = new Set(described.map((r) => `${r.method} ${r.path}`));\n for (const r of described) {\n // @Head handlers are served by Hono under GET — claim that row too so it\n // doesn't reappear as a mounted duplicate.\n if (r.method === 'HEAD') covered.add(`GET ${r.path}`);\n }\n\n const seenMounted = new Set<string>();\n for (const honoRoute of app.getHonoApp().routes) {\n // 'ALL' entries are middleware mounts (framework-internal disposal/context\n // wrappers, global + scoped middleware) — not endpoints.\n if (honoRoute.method === 'ALL') continue;\n const key = `${honoRoute.method} ${honoRoute.path}`;\n if (covered.has(key) || seenMounted.has(key)) continue;\n seenMounted.add(key);\n rows.push({\n method: honoRoute.method,\n path: honoRoute.path,\n handler: '(mounted)',\n source: 'mounted',\n });\n }\n\n return rows.sort((a, b) => a.path.localeCompare(b.path) || a.method.localeCompare(b.method));\n}\n\n/** `vela module graph` tree lines (or raw descriptions for --json). */\nexport function collectModules(app: VelaApplication): ModuleDescription[] {\n return app.getContainer().getModuleDescriptions();\n}\n\nexport function renderModuleTree(modules: ModuleDescription[]): string[] {\n const byId = new Map(modules.map((m) => [m.moduleId, m]));\n const imported = new Set(modules.flatMap((m) => m.imports));\n const roots = modules.filter((m) => !imported.has(m.moduleId));\n\n const lines: string[] = [];\n const render = (id: string, depth: number, trail: Set<string>): void => {\n const mod = byId.get(id);\n const flags = mod\n ? [mod.isGlobal ? 'global' : null, mod.lazy ? 'lazy' : null].filter(Boolean)\n : [];\n const suffix = flags.length > 0 ? ` (${flags.join(', ')})` : '';\n const providers = mod\n ? ` — ${mod.providers.length} provider${mod.providers.length === 1 ? '' : 's'}`\n : '';\n lines.push(`${' '.repeat(depth)}${id}${suffix}${providers}`);\n if (!mod || trail.has(id)) return;\n const nextTrail = new Set(trail).add(id);\n for (const child of mod.imports) render(child, depth + 1, nextTrail);\n };\n\n for (const root of roots) render(root.moduleId, 0, new Set());\n return lines;\n}\n\n/** One row of `vela entrypoint list`. */\nexport interface EntrypointRow {\n kind: string;\n target: string;\n meta: string;\n}\n\nfunction safeMeta(meta: unknown): string {\n try {\n return (\n JSON.stringify(meta, (_key, value: unknown) =>\n typeof value === 'function'\n ? '[function]'\n : typeof value === 'object' &&\n value !== null &&\n value.constructor !== Object &&\n !Array.isArray(value)\n ? `[${(value as object).constructor.name}]`\n : value,\n ) ?? 'undefined'\n );\n } catch {\n return '[unserializable]';\n }\n}\n\n/**\n * Every DECLARED entrypoint kind (from the global kind store — includes kinds\n * with zero entries) joined with the app's entries. Metadata-only entries of\n * lazy modules list fine; nothing materializes.\n */\nexport function collectEntrypoints(app: VelaApplication): EntrypointRow[] {\n const rows: EntrypointRow[] = [];\n const declared = getEntrypointKinds().map((k: { kind: string }) => k.kind);\n const populated = app.entrypoints.kinds();\n const kinds = [...new Set([...declared, ...populated])];\n\n for (const kind of kinds) {\n const entries = app.entrypoints.ofKind(kind);\n if (entries.length === 0) {\n rows.push({ kind, target: '(no entrypoints)', meta: '' });\n continue;\n }\n for (const ep of entries) {\n const method = ep.methodName !== undefined ? `#${String(ep.methodName)}` : '';\n rows.push({ kind, target: `${describeToken(ep.token)}${method}`, meta: safeMeta(ep.meta) });\n }\n }\n return rows;\n}\n","import { writeFile } from 'node:fs/promises';\nimport { createOpenApiDocument } from '@velajs/vela';\nimport type { VelaApplication } from '@velajs/vela';\nimport { Command, Option } from 'clipanion';\nimport { loadConfig } from '../config.js';\nimport { withApp } from '../with-app.js';\nimport { renderTable } from '../format.js';\nimport {\n collectEntrypoints,\n collectModules,\n collectRoutes,\n renderModuleTree,\n} from '../introspect.js';\n\n/** Shared shell: load config → createApp → run → best-effort dispose. */\nabstract class AppCommand extends Command {\n config = Option.String('--config', { description: 'Path to the vela config file.' });\n json = Option.Boolean('--json', false, { description: 'Emit machine-readable JSON.' });\n\n protected abstract run(app: VelaApplication): Promise<number>;\n\n async execute(): Promise<number> {\n const velaConfig = await loadConfig(process.cwd(), this.config);\n return withApp(\n velaConfig,\n (app) => this.run(app),\n (message) => {\n this.context.stderr.write(`${message}\\n`);\n },\n );\n }\n\n protected print(text: string): void {\n this.context.stdout.write(`${text}\\n`);\n }\n}\n\n/** `vela route list` — the app's HTTP route table. */\nexport class RouteListCommand extends AppCommand {\n static override paths = [['route', 'list']];\n static override usage = Command.Usage({\n category: 'Introspection',\n description: 'List the HTTP routes of the Vela app.',\n details:\n 'Framework-composed controller routes (method, full path, controller#handler) plus ' +\n 'everything else mounted on the router (CRUD/contributed routes, doc UIs) labeled (mounted).',\n examples: [\n ['List routes', 'vela route list'],\n ['As JSON', 'vela route list --json'],\n ],\n });\n\n protected async run(app: VelaApplication): Promise<number> {\n const rows = collectRoutes(app);\n if (rows === null) {\n this.print('This app builds no HTTP routes — nothing to list.');\n return 0;\n }\n if (this.json) {\n this.print(JSON.stringify(rows, null, 2));\n return 0;\n }\n for (const line of renderTable(\n ['METHOD', 'PATH', 'HANDLER'],\n rows.map((r) => [r.method, r.path, r.handler]),\n )) {\n this.print(line);\n }\n return 0;\n }\n}\n\n/** `vela module graph` — the loaded module graph. */\nexport class ModuleGraphCommand extends AppCommand {\n static override paths = [['module', 'graph']];\n static override usage = Command.Usage({\n category: 'Introspection',\n description: 'Print the module graph of the Vela app.',\n details:\n 'Module instances with their imports (indented tree), global/lazy flags, and provider ' +\n 'counts. --json emits the raw descriptions (providers, exports, imports per module).',\n examples: [\n ['Print the graph', 'vela module graph'],\n ['As JSON', 'vela module graph --json'],\n ],\n });\n\n protected async run(app: VelaApplication): Promise<number> {\n const modules = collectModules(app);\n if (this.json) {\n this.print(JSON.stringify(modules, null, 2));\n return 0;\n }\n for (const line of renderModuleTree(modules)) this.print(line);\n return 0;\n }\n}\n\n/** `vela entrypoint list` — declared entrypoint kinds and their entries. */\nexport class EntrypointListCommand extends AppCommand {\n static override paths = [['entrypoint', 'list']];\n static override usage = Command.Usage({\n category: 'Introspection',\n description: 'List entrypoint kinds and entries (websocket, queue, cron, …).',\n details:\n 'Every declared kind — including kinds with zero entries — with the contributing ' +\n 'class (and method for method-level kinds) and its metadata.',\n examples: [['List entrypoints', 'vela entrypoint list']],\n });\n\n protected async run(app: VelaApplication): Promise<number> {\n const rows = collectEntrypoints(app);\n if (this.json) {\n this.print(JSON.stringify(rows, null, 2));\n return 0;\n }\n for (const line of renderTable(\n ['KIND', 'TARGET', 'META'],\n rows.map((r) => [r.kind, r.target, r.meta]),\n )) {\n this.print(line);\n }\n return 0;\n }\n}\n\n/** `vela openapi dump` — emit the OpenAPI document. */\nexport class OpenApiDumpCommand extends Command {\n static override paths = [['openapi', 'dump']];\n static override usage = Command.Usage({\n category: 'Introspection',\n description: 'Emit the OpenAPI document for the Vela app.',\n details:\n 'Requires `rootModule` in vela.config (createOpenApiDocument works from the module ' +\n \"class). The app's global prefix is applied automatically; --global-prefix overrides.\",\n examples: [\n ['Print to stdout', 'vela openapi dump'],\n ['Write to a file', 'vela openapi dump --out openapi.json'],\n ],\n });\n\n config = Option.String('--config', { description: 'Path to the vela config file.' });\n out = Option.String('--out', {\n description: 'Write the document to this file instead of stdout.',\n });\n title = Option.String('--title', { description: 'info.title override.' });\n apiVersion = Option.String('--api-version', { description: 'info.version override.' });\n globalPrefix = Option.String('--global-prefix', {\n description: \"Path prefix override (defaults to the app's global prefix).\",\n });\n\n async execute(): Promise<number> {\n const velaConfig = await loadConfig(process.cwd(), this.config);\n if (!velaConfig.rootModule) {\n this.context.stderr.write(\n 'openapi dump needs the root module. Add it to your vela.config:\\n\\n' +\n ' export default defineVelaConfig({\\n' +\n ' rootModule: AppModule,\\n' +\n ' async createApp() { ... },\\n' +\n ' });\\n',\n );\n return 1;\n }\n\n const rootModule = velaConfig.rootModule;\n return withApp(\n velaConfig,\n async (app) => {\n const info: Record<string, string> = {};\n if (this.title) info.title = this.title;\n if (this.apiVersion) info.version = this.apiVersion;\n\n const document = createOpenApiDocument(rootModule, {\n globalPrefix: this.globalPrefix ?? app.getGlobalPrefix(),\n ...(Object.keys(info).length > 0 ? { info } : {}),\n });\n\n const text = JSON.stringify(document, null, 2);\n if (this.out) {\n await writeFile(this.out, `${text}\\n`, 'utf8');\n this.context.stdout.write(`Wrote ${this.out}\\n`);\n } else {\n this.context.stdout.write(`${text}\\n`);\n }\n return 0;\n },\n (message) => this.context.stderr.write(`${message}\\n`),\n );\n }\n}\n","import { readFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { createOpenApiDocument } from '@velajs/vela';\nimport type { Type, VelaApplication } from '@velajs/vela';\nimport { Command, Option } from 'clipanion';\nimport { z } from 'zod';\nimport { loadConfig } from '../config.js';\nimport { withApp } from '../with-app.js';\nimport {\n collectEntrypoints,\n collectModules,\n collectRoutes,\n renderModuleTree,\n} from '../introspect.js';\n\nconst OPENAPI_URI = 'vela://openapi';\n\n/** A single JSON text block — the shape every tool/resource result uses. */\nfunction jsonText(data: unknown): { content: { type: 'text'; text: string }[] } {\n return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };\n}\n\n/** An MCP tool error result (JSON-RPC stays 2.0; the failure is in-band). */\nfunction toolError(message: string): { isError: true; content: { type: 'text'; text: string }[] } {\n return { isError: true, content: [{ type: 'text', text: message }] };\n}\n\n/** Name + version for the MCP server handshake, read from the CLI's own package.json. */\nasync function readCliIdentity(): Promise<{ name: string; version: string }> {\n const here = dirname(fileURLToPath(import.meta.url));\n // tsdown bundles this module into dist/index.js; source-mode tests load it\n // from src/commands/mcp.command.ts. Support both locations without relying\n // on a fixed output depth.\n for (const pkgPath of [\n join(here, '..', 'package.json'),\n join(here, '..', '..', 'package.json'),\n ]) {\n try {\n const pkg = JSON.parse(await readFile(pkgPath, 'utf8')) as {\n name?: string;\n version?: string;\n };\n return { name: pkg.name ?? '@velajs/cli', version: pkg.version ?? '0.0.0' };\n } catch (error) {\n if ((error as { code?: string }).code !== 'ENOENT') throw error;\n }\n }\n return { name: '@velajs/cli', version: '0.0.0' };\n}\n\n/**\n * String-label lookup for a DI token across the module graph. Reads only the\n * serializable descriptions (`collectModules`) — never resolves the token or\n * constructs anything. Reports which modules provide/export it and their scope\n * flags, plus whether the string names a module itself.\n */\nfunction describeToken(app: VelaApplication, token: string): unknown {\n const modules = collectModules(app);\n const providedBy = modules\n .filter((m) => m.providers.includes(token))\n .map((m) => ({\n moduleId: m.moduleId,\n isGlobal: m.isGlobal,\n lazy: m.lazy,\n exported: m.exports.includes(token),\n }));\n const matchesModule = modules.find((m) => m.moduleId === token);\n return {\n token,\n found: providedBy.length > 0 || matchesModule !== undefined,\n providedBy,\n module: matchesModule\n ? {\n moduleId: matchesModule.moduleId,\n isGlobal: matchesModule.isGlobal,\n lazy: matchesModule.lazy,\n }\n : null,\n };\n}\n\n/**\n * `vela mcp serve` — an MCP stdio server exposing the same READ-ONLY\n * introspection as the `route`/`module`/`entrypoint`/`openapi` commands, so an\n * AI agent can query a Vela app's shape over the Model Context Protocol.\n *\n * The application lifetime includes the transport's close promise. stdout is\n * reserved for JSON-RPC framing; every human message goes to stderr.\n */\nexport class McpServeCommand extends Command {\n static override paths = [['mcp', 'serve']];\n static override usage = Command.Usage({\n category: 'Introspection',\n description: 'Serve Vela introspection as MCP tools over stdio (for AI agents).',\n details:\n 'Builds the app from vela.config and runs a Model Context Protocol stdio server. Exposes ' +\n 'read-only tools (route_list, module_graph, entrypoint_list, openapi_dump, token_describe) ' +\n 'and — when the config declares a rootModule — a `vela://openapi` resource. stdout carries ' +\n 'only JSON-RPC; all logging goes to stderr. The server runs until the client disconnects.',\n examples: [\n ['Serve over stdio', 'vela mcp serve'],\n ['Use a specific config', 'vela mcp serve --config ./config/vela.config.js'],\n ],\n });\n\n config = Option.String('--config', { description: 'Path to the vela config file.' });\n\n async execute(): Promise<number> {\n const { McpServer } = await import('@modelcontextprotocol/sdk/server/mcp.js');\n const { StdioServerTransport } = await import('@modelcontextprotocol/sdk/server/stdio.js');\n\n const log = (message: string): void => {\n this.context.stderr.write(`${message}\\n`);\n };\n\n const velaConfig = await loadConfig(process.cwd(), this.config);\n const rootModule: Type | undefined = velaConfig.rootModule;\n\n return withApp(\n velaConfig,\n async (app) => {\n const identity = await readCliIdentity();\n const server = new McpServer(identity);\n\n server.registerTool(\n 'route_list',\n {\n description:\n \"The app's HTTP route table: framework-composed controller routes (method, full \" +\n 'path, Controller#handler) plus everything else mounted on the router, labeled ' +\n '(mounted). Empty when the app builds no HTTP routes.',\n inputSchema: {},\n },\n () => jsonText(collectRoutes(app) ?? []),\n );\n\n server.registerTool(\n 'module_graph',\n {\n description:\n 'The loaded module graph as serializable descriptions (providers, exports, imports, ' +\n 'global/lazy flags). Pass tree=true to also get the rendered import tree lines.',\n inputSchema: { tree: z.boolean().optional() },\n },\n ({ tree }) => {\n const modules = collectModules(app);\n return jsonText(tree ? { modules, tree: renderModuleTree(modules) } : modules);\n },\n );\n\n server.registerTool(\n 'entrypoint_list',\n {\n description:\n 'Every declared entrypoint kind (websocket, queue, cron, …) with its entries and ' +\n 'metadata — including kinds with zero entries. Lazy modules stay unmaterialized.',\n inputSchema: {},\n },\n () => jsonText(collectEntrypoints(app)),\n );\n\n server.registerTool(\n 'openapi_dump',\n {\n description:\n 'The OpenAPI 3.1 document for the app. Requires a rootModule in vela.config. ' +\n 'globalPrefix/title/apiVersion override the defaults (the app global prefix and ' +\n 'the module-derived info).',\n inputSchema: {\n globalPrefix: z.string().optional(),\n title: z.string().optional(),\n apiVersion: z.string().optional(),\n },\n },\n ({ globalPrefix, title, apiVersion }) => {\n if (!rootModule) {\n return toolError(\n 'openapi_dump needs the root module. Add `rootModule: AppModule` to your vela.config.',\n );\n }\n const info: Record<string, string> = {};\n if (title) info.title = title;\n if (apiVersion) info.version = apiVersion;\n const document = createOpenApiDocument(rootModule, {\n globalPrefix: globalPrefix ?? app.getGlobalPrefix(),\n ...(Object.keys(info).length > 0 ? { info } : {}),\n });\n return jsonText(document);\n },\n );\n\n server.registerTool(\n 'token_describe',\n {\n description:\n 'Look a DI token STRING LABEL up across the module graph: which modules provide/export ' +\n 'it and their scope flags, plus whether the string names a module. Read-only string ' +\n 'match — does not resolve or construct the token.',\n inputSchema: { token: z.string() },\n },\n ({ token }) => jsonText(describeToken(app, token)),\n );\n\n if (rootModule) {\n server.registerResource(\n 'openapi',\n OPENAPI_URI,\n { description: 'The OpenAPI 3.1 document for the app.', mimeType: 'application/json' },\n () => ({\n contents: [\n {\n uri: OPENAPI_URI,\n mimeType: 'application/json',\n text: JSON.stringify(\n createOpenApiDocument(rootModule, { globalPrefix: app.getGlobalPrefix() }),\n null,\n 2,\n ),\n },\n ],\n }),\n );\n }\n\n const transport = new StdioServerTransport();\n const closed = new Promise<void>((resolvePromise) => {\n transport.onclose = resolvePromise;\n });\n await server.connect(transport);\n log(\n `vela mcp serve — ready (5 tools${rootModule ? ' + vela://openapi resource' : ''}). ` +\n 'Awaiting client on stdio; stdout is JSON-RPC only.',\n );\n\n // Keep the process alive until the client disconnects; only then dispose.\n await closed;\n return 0;\n },\n log,\n );\n }\n}\n","import { describeToken } from '@velajs/vela';\nimport { runSeeders, SeederRegistry } from '@velajs/vela/seeder';\nimport { Command, Option, UsageError } from 'clipanion';\nimport { loadConfig } from '../config.js';\nimport { formatSeedResults, renderTable } from '../format.js';\nimport { withApp } from '../with-app.js';\n\n/** `vela db seed` — build the app from vela.config and run its seeders. */\nexport class SeedCommand extends Command {\n static override paths = [['db', 'seed']];\n static override usage = Command.Usage({\n category: 'Database',\n description: 'Run database seeders for the Vela app.',\n details:\n 'Loads vela.config.{js,mjs,ts}, builds the app, and runs all @Seeder() classes in order.',\n examples: [\n ['Run all seeders', 'vela db seed'],\n ['Use a specific config', 'vela db seed --config ./config/vela.config.js'],\n ['List seeders and their module owners', 'vela db seed --list --json'],\n ],\n });\n\n config = Option.String('--config', { description: 'Path to the vela config file.' });\n continueOnError = Option.Boolean('--continue-on-error', false, {\n description: 'Run all seeders even if one fails.',\n });\n list = Option.Boolean('--list', false, {\n description: 'List registered seeders and their owners without running them.',\n });\n json = Option.Boolean('--json', false, { description: 'Emit --list inventory as JSON.' });\n\n async execute(): Promise<number> {\n if (this.json && !this.list) throw new UsageError('--json requires --list.');\n if (this.list && this.continueOnError)\n throw new UsageError('--list cannot be combined with --continue-on-error.');\n const config = await loadConfig(process.cwd(), this.config);\n return withApp(\n config,\n async (app) => {\n if (this.list) {\n const inventory = app\n .get(SeederRegistry)\n .list()\n .map((seeder) => ({\n name: seeder.name,\n order: seeder.order,\n target: describeToken(seeder.target),\n moduleId: seeder.moduleId ?? null,\n }));\n const output = this.json\n ? JSON.stringify(inventory, null, 2)\n : renderTable(\n ['ORDER', 'NAME', 'MODULE', 'TARGET'],\n inventory.map((entry) => [\n String(entry.order),\n entry.name,\n entry.moduleId ?? '(unknown)',\n entry.target,\n ]),\n ).join('\\n');\n this.context.stdout.write(`${output}\\n`);\n return 0;\n }\n this.context.stdout.write('Running seeders…\\n');\n const results = await runSeeders(app, { stopOnError: !this.continueOnError });\n return formatSeedResults(results, (message) => this.context.stdout.write(`${message}\\n`));\n },\n (message) => this.context.stderr.write(`${message}\\n`),\n );\n }\n}\n","import { Command, Option } from 'clipanion';\n\n/**\n * The optional peer that does the real work. It is Node-only and heavy, so it is\n * NOT a hard dependency of the CLI — it is lazily imported here and, when it\n * isn't installed, the command prints an install hint (mirroring how\n * `mcp.command` lazily loads its optional peer).\n */\nconst HOST_PACKAGE = '@velajs/studio-host';\n\n/** The slice of `@velajs/studio-host`'s surface this command uses. */\ninterface StudioHostModule {\n startStudioServer(options: {\n workerOrigin: string;\n adminToken?: string;\n port?: number;\n adminPath?: string;\n cwd?: string;\n }): Promise<{ readonly url: string; readonly port: number; close(): Promise<void> }>;\n}\n\n/** True for a failed dynamic `import()` of a missing module (ESM or CJS code). */\nfunction isModuleNotFound(error: unknown, specifier: string): boolean {\n const code =\n error !== null && typeof error === 'object' && 'code' in error ? error.code : undefined;\n if (code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND') {\n return true;\n }\n // Some resolvers surface only a message; match the specifier defensively.\n const message = error instanceof Error ? error.message : '';\n return message.includes(specifier);\n}\n\n/**\n * `vela studio` — start the loopback dev host that serves Vela Studio and proxies\n * the admin API to a running app.\n *\n * App-origin resolution (v1): the target app is taken from `--url <origin>`,\n * which is REQUIRED. The host proxies `{--path}/*` to that origin, injecting the\n * admin token as `Authorization: Bearer` server-side (the browser never holds\n * it). Booting the app in-process from `vela.config` (via `loadConfig`) is a\n * planned follow-up; requiring `--url` keeps v1 simple and adapter-agnostic.\n */\nexport class StudioCommand extends Command {\n static override paths = [['studio']];\n static override usage = Command.Usage({\n category: 'Studio',\n description: 'Serve Vela Studio locally and proxy the admin API to a running app.',\n details:\n 'Starts a loopback dev host (from the optional @velajs/studio-host peer) that serves the ' +\n 'prebuilt Studio SPA and proxies {--path}/* to the app at --url, injecting the admin token ' +\n 'as a Bearer server-side so the browser never receives it. The token comes from --token or ' +\n 'the VELA_STUDIO_TOKEN environment variable. Runs until interrupted (Ctrl+C).',\n examples: [\n ['Serve against a local worker', 'vela studio --url http://127.0.0.1:8787'],\n [\n 'With an explicit token + port',\n 'vela studio --url http://127.0.0.1:8787 --token $TOKEN --port 4000',\n ],\n ],\n });\n\n url = Option.String('--url', {\n description: 'Origin of the running app to proxy the admin API to (required).',\n });\n token = Option.String('--token', {\n description: 'Admin bearer token (falls back to VELA_STUDIO_TOKEN). Never sent to the browser.',\n });\n port = Option.String('--port', {\n description: 'Loopback port to bind (default: an ephemeral port).',\n });\n adminPath = Option.String('--path', {\n description: 'Server admin-mount prefix to proxy (default: /_vela/admin).',\n });\n\n async execute(): Promise<number> {\n const workerOrigin = this.url;\n if (workerOrigin === undefined || workerOrigin === '') {\n this.context.stderr.write(\n 'vela studio: --url <origin> is required — the running app to proxy the admin API to.\\n' +\n ' Example: vela studio --url http://127.0.0.1:8787\\n',\n );\n return 1;\n }\n if (!URL.canParse(workerOrigin)) {\n this.context.stderr.write(`vela studio: --url is not a valid origin: ${workerOrigin}\\n`);\n return 1;\n }\n\n let port: number | undefined;\n if (this.port !== undefined) {\n port = Number(this.port);\n if (!/^\\d+$/.test(this.port) || !Number.isInteger(port) || port < 0 || port > 65_535) {\n this.context.stderr.write(\n `vela studio: --port must be a decimal integer 0-65535, got: ${this.port}\\n`,\n );\n return 1;\n }\n }\n\n const adminToken = this.token ?? process.env.VELA_STUDIO_TOKEN;\n\n let host: StudioHostModule;\n try {\n host = (await import(HOST_PACKAGE)) as StudioHostModule;\n } catch (error) {\n if (isModuleNotFound(error, HOST_PACKAGE)) {\n this.context.stderr.write(\n `vela studio needs the optional \"${HOST_PACKAGE}\" package, which isn't installed.\\n` +\n ` Install it: pnpm add -D ${HOST_PACKAGE}\\n` +\n ` (it also needs the prebuilt UI: pnpm add -D @velajs/studio-ui)\\n`,\n );\n return 1;\n }\n throw error;\n }\n\n const server = await host.startStudioServer({\n workerOrigin,\n adminToken,\n port,\n adminPath: this.adminPath,\n cwd: process.cwd(),\n });\n\n this.context.stdout.write(\n `\\n Vela Studio ${server.url}\\n` +\n ` Proxying ${workerOrigin}${this.adminPath ?? '/_vela/admin'}/*\\n` +\n ` Admin token ${adminToken !== undefined ? 'set (injected server-side)' : 'none (app requires none)'}\\n\\n` +\n ' Press Ctrl+C to stop.\\n',\n );\n\n // Run until interrupted. The listener is removed on trigger so a second\n // Ctrl+C during shutdown falls through to Node's default (force-exit).\n await new Promise<void>((resolvePromise) => {\n const onSignal = (): void => {\n process.off('SIGINT', onSignal);\n process.off('SIGTERM', onSignal);\n resolvePromise();\n };\n process.on('SIGINT', onSignal);\n process.on('SIGTERM', onSignal);\n });\n\n await server.close();\n this.context.stdout.write('\\nVela Studio stopped.\\n');\n return 0;\n }\n}\n","import { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { dirname } from 'node:path';\nimport { createOpenApiDocument } from '@velajs/vela';\nimport type { OpenApiDocument } from '@velajs/vela';\nimport { Command, Option } from 'clipanion';\nimport { generateClientContract } from '../client-contract.js';\nimport { loadConfig } from '../config.js';\nimport { withApp } from '../with-app.js';\n\nexport class ClientGenerateCommand extends Command {\n static override paths = [['client', 'generate']];\n static override usage = Command.Usage({\n category: 'Client',\n description: \"Generate a typed HTTP contract for Hono's hc client.\",\n details:\n 'Uses rootModule and createApp from vela.config, or an OpenAPI JSON file with --input. Missing schemas emit unknown and a warning; --strict makes those warnings an error.',\n examples: [\n ['Generate from an app', 'vela client generate --out src/api.generated.ts'],\n [\n 'Generate from a document',\n 'vela client generate --input openapi.json --out src/api.generated.ts',\n ],\n ['Check a committed contract', 'vela client generate --out src/api.generated.ts --check'],\n ],\n });\n\n config = Option.String('--config', { description: 'Path to the vela config file.' });\n input = Option.String('--input', {\n description: 'Read an OpenAPI JSON file without bootstrapping the app.',\n });\n out = Option.String('--out', { description: 'Output TypeScript file (stdout when omitted).' });\n check = Option.Boolean('--check', false, {\n description: 'Fail if --out differs from the generated contract; do not write.',\n });\n strict = Option.Boolean('--strict', false, { description: 'Fail on missing or lossy schemas.' });\n\n async execute(): Promise<number> {\n if (this.input && this.config) throw new Error('Use either --input or --config, not both.');\n if (this.check && !this.out) throw new Error('--check requires --out.');\n const document = this.input ? await this.#readDocument(this.input) : await this.#fromApp();\n const { source, warnings } = generateClientContract(document);\n for (const warning of warnings) this.context.stderr.write(`Warning: ${warning}\\n`);\n if (this.strict && warnings.length) return 1;\n if (this.check) {\n let existing: string | undefined;\n try {\n existing = await readFile(this.out!, 'utf8');\n } catch (error) {\n if (!(error instanceof Error) || !('code' in error) || error.code !== 'ENOENT') throw error;\n }\n if (existing !== source) {\n this.context.stderr.write(\n `Client contract is missing or stale: ${this.out}. Run vela client generate without --check.\\n`,\n );\n return 1;\n }\n } else if (this.out) {\n await mkdir(dirname(this.out), { recursive: true });\n await writeFile(this.out, source, 'utf8');\n this.context.stdout.write(`Wrote ${this.out}\\n`);\n } else {\n this.context.stdout.write(source);\n }\n return 0;\n }\n\n async #readDocument(file: string): Promise<unknown> {\n const value: unknown = JSON.parse(await readFile(file, 'utf8'));\n // generateClientContract validates the complete consumed projection for\n // both file inputs and documents produced by the running application.\n return value;\n }\n\n async #fromApp(): Promise<OpenApiDocument> {\n const config = await loadConfig(process.cwd(), this.config);\n if (!config.rootModule)\n throw new Error(\n 'client generate needs rootModule in vela.config, or pass --input openapi.json.',\n );\n const rootModule = config.rootModule;\n return withApp(\n config,\n async (app) => {\n const document = createOpenApiDocument(rootModule, {\n globalPrefix: app.getGlobalPrefix(),\n });\n // Detect older Vela exporters which omit versioned controller routes.\n // Never silently ship a contract which points at a different endpoint.\n for (const route of app.describeRoutes()) {\n const path = route.path.replace(/:([A-Za-z_][A-Za-z0-9_]*)/g, '{$1}');\n const item = document.paths[path];\n if (!item || !Object.hasOwn(item, route.method.toLowerCase())) {\n throw new Error(\n `OpenAPI is missing ${route.method} ${route.path}. Update Vela or pass a complete document with --input.`,\n );\n }\n }\n return document;\n },\n (message) => this.context.stderr.write(`${message}\\n`),\n );\n }\n}\n","import { lstat, mkdir, open, readFile, readdir, rmdir, unlink, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { UsageError } from 'clipanion';\n\nconst template = new URL('../templates/worker/', import.meta.url);\nconst files = [\n 'package.json',\n 'pnpm-workspace.yaml',\n 'tsconfig.json',\n '.swcrc',\n 'wrangler.jsonc',\n 'vela.config.mjs',\n 'gitignore',\n 'README.md',\n 'src/worker.ts',\n 'src/app.module.ts',\n 'src/app.controller.ts',\n 'src/app.service.ts',\n] as const;\n\nfunction hasCode(error: unknown, code: string): boolean {\n return error instanceof Error && 'code' in error && error.code === code;\n}\n\nexport async function createProject(name: string, cwd: string): Promise<string> {\n if (\n name.length > 63 ||\n name !== name.trim() ||\n !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(name) ||\n /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/.test(name)\n ) {\n throw new UsageError(\n 'Use a project name of at most 63 lowercase letters, digits, and single hyphens, starting with a letter. Paths and reserved device names are not supported.',\n );\n }\n\n // Read the entire packaged template before touching the destination.\n const contents = await Promise.all(\n files.map(async (file) => ({\n file: file === 'gitignore' ? '.gitignore' : file,\n content: (await readFile(new URL(file, template), 'utf8')).replaceAll(\n '__PROJECT_NAME__',\n name,\n ),\n })),\n );\n const destination = join(cwd, name);\n const directories: string[] = [];\n const written: string[] = [];\n try {\n try {\n await mkdir(destination);\n directories.push(destination);\n } catch (error) {\n if (!hasCode(error, 'EEXIST')) throw error;\n const stat = await lstat(destination);\n if (stat.isSymbolicLink() || !stat.isDirectory()) {\n throw new UsageError(`Destination is not a regular directory: ${destination}`);\n }\n if ((await readdir(destination)).length) {\n throw new UsageError(\n `Destination is not empty: ${destination}. Choose a new project name.`,\n );\n }\n }\n const source = join(destination, 'src');\n await mkdir(source);\n directories.push(source);\n for (const { file, content } of contents) {\n const path = join(destination, file);\n // Never overwrite a file, even if it appeared after the initial check.\n const handle = await open(path, 'wx');\n written.push(path);\n try {\n await writeFile(handle, content, 'utf8');\n } finally {\n await handle.close();\n }\n }\n } catch (error) {\n // Only undo our own writes; rmdir leaves directories containing other files intact.\n for (const path of written.toReversed()) await unlink(path).catch(() => {});\n for (const path of directories.toReversed()) await rmdir(path).catch(() => {});\n throw error;\n }\n return destination;\n}\n","import { Command, Option } from 'clipanion';\nimport { createProject } from '../new-project.js';\n\nexport class NewCommand extends Command {\n static override paths = [['new']];\n static override usage = Command.Usage({\n category: 'Project',\n description: 'Create a minimal Vela application for Cloudflare Workers.',\n details:\n 'Creates a directory in the current working directory. An existing directory must be empty. Dependencies are installed separately with pnpm install.',\n examples: [['Create an API', 'vela new my-api']],\n });\n\n name = Option.String({ name: 'name', required: true });\n\n async execute(): Promise<number> {\n await createProject(this.name, process.cwd());\n this.context.stdout.write(\n `Created ${this.name}.\\n\\nNext steps:\\n cd ${this.name}\\n pnpm install\\n pnpm typecheck\\n pnpm build\\n pnpm dev\\n\\nThen visit http://localhost:8787 or run: curl http://localhost:8787\\n`,\n );\n return 0;\n }\n}\n","import { describeToken } from '@velajs/vela';\nimport type { VelaApplication } from '@velajs/vela';\nimport { Command, Option } from 'clipanion';\nimport { loadConfig, resolveConfig } from '../config.js';\nimport type { ConfigResolution } from '../config.js';\nimport { collectModules, collectRoutes } from '../introspect.js';\nimport { withApp } from '../with-app.js';\n\n/** Read only app-owned description APIs; never resolve providers or serialize their values. */\nfunction describeApplication(app: VelaApplication) {\n return {\n globalPrefix: app.getGlobalPrefix(),\n modules: collectModules(app),\n routes: collectRoutes(app),\n entrypoints: app.entrypoints.kinds().flatMap((kind) =>\n app.entrypoints.ofKind(kind).map((entry) => ({\n kind,\n target: `${describeToken(entry.token)}${entry.methodName === undefined ? '' : `#${String(entry.methodName)}`}`,\n ...('moduleId' in entry && typeof entry.moduleId === 'string'\n ? { moduleId: entry.moduleId }\n : {}),\n })),\n ),\n };\n}\n\ninterface DoctorReport {\n schemaVersion: 1;\n cwd: string;\n nodeVersion: string;\n config: ConfigResolution | null;\n application?: ReturnType<typeof describeApplication>;\n issues: string[];\n}\n\nexport class DoctorCommand extends Command {\n static override paths = [['doctor']];\n static override usage = Command.Usage({\n category: 'Introspection',\n description: 'Explain config resolution and optionally inspect the application graph.',\n details:\n 'Checks config file resolution without importing it. --app opts into config import and application bootstrap, ' +\n 'then reads app-local module, route and entrypoint snapshots and disposes the app. ' +\n 'No files are written, providers are not resolved by the snapshot, and entrypoint metadata is omitted.',\n examples: [\n ['Explain config selection', 'vela doctor --json'],\n ['Inspect a built app', 'vela doctor --app --config vela.config.mjs --json'],\n ],\n });\n\n config = Option.String('--config', { description: 'Path to the Vela config file.' });\n app = Option.Boolean('--app', false, {\n description: 'Import config, bootstrap the app and inspect its graph.',\n });\n json = Option.Boolean('--json', false, { description: 'Emit machine-readable diagnostics.' });\n\n async execute(): Promise<number> {\n const report: DoctorReport = {\n schemaVersion: 1,\n cwd: process.cwd(),\n nodeVersion: process.versions.node,\n config: null,\n issues: [],\n };\n try {\n report.config = await resolveConfig(report.cwd, this.config);\n if (this.app) {\n const config = await loadConfig(report.cwd, report.config.path);\n report.application = await withApp(config, describeApplication, (message) => {\n report.issues.push(message);\n });\n }\n } catch (error) {\n report.issues.push(error instanceof Error ? error.message : String(error));\n }\n\n if (this.json) {\n this.context.stdout.write(`${JSON.stringify(report, null, 2)}\\n`);\n } else {\n this.context.stdout.write(`Node ${report.nodeVersion}\\nWorking directory: ${report.cwd}\\n`);\n if (report.config) {\n this.context.stdout.write(`Config: ${report.config.path} (${report.config.source})\\n`);\n for (const candidate of report.config.candidates)\n this.context.stdout.write(` Checked: ${candidate}\\n`);\n }\n if (report.application) {\n const { modules, routes, entrypoints } = report.application;\n this.context.stdout.write(\n `Application: ${modules.length} modules, ${routes?.length ?? 0} routes, ${entrypoints.length} entrypoints\\n`,\n );\n this.context.stdout.write('Use --json for the full graph.\\n');\n } else if (!this.app) {\n this.context.stdout.write(\n 'Config was not imported. Use --app to bootstrap and inspect a built application.\\n',\n );\n }\n for (const issue of report.issues) this.context.stderr.write(`${issue}\\n`);\n }\n return report.issues.length ? 1 : 0;\n }\n}\n","import { extname } from 'node:path';\nimport { parse, type ParseError } from 'jsonc-parser';\nimport { parse as parseToml } from 'smol-toml';\nimport { z } from 'zod';\n\nconst record = z.record(z.string(), z.unknown());\nconst text = z\n .string()\n .min(1)\n .refine((value) => value.trim() === value && !/\\p{Cc}/u.test(value));\nconst bindingName = text.regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/u);\nconst workerName = text.max(255).regex(/^[a-zA-Z0-9-]+$/u);\nconst date = z\n .string()\n .regex(/^\\d{4}-\\d{2}-\\d{2}$/u)\n .refine((value) => {\n const parsed = new Date(value);\n return Number.isFinite(parsed.getTime()) && parsed.toISOString().slice(0, 10) === value;\n });\n\n/** Decode only data; parser errors deliberately omit configuration values. */\nexport function parseDeploymentConfig(source: string, path: string): unknown {\n const extension = extname(path).toLowerCase();\n if (extension === '.toml') {\n try {\n return parseToml(source);\n } catch {\n throw new Error('Invalid Wrangler TOML configuration.');\n }\n }\n if (extension !== '.json' && extension !== '.jsonc') {\n throw new Error('Wrangler configuration must be a .json, .jsonc or .toml file.');\n }\n const errors: ParseError[] = [];\n const result: unknown = parse(source, errors, {\n allowTrailingComma: extension === '.jsonc',\n disallowComments: extension === '.json',\n });\n if (errors.length > 0) throw new Error('Invalid Wrangler JSON configuration.');\n return result;\n}\n\nfunction checked<T>(schema: z.ZodType<T>, value: unknown, field: string): T {\n const result = schema.safeParse(value);\n if (!result.success) throw new Error(`Invalid Wrangler field: ${field}.`);\n return result.data;\n}\n\nexport interface DeploymentBinding {\n readonly name: string;\n readonly kind: string;\n}\n\nexport interface DeploymentTarget {\n readonly environment: string;\n readonly worker: string;\n readonly main: string | null;\n readonly compatibilityDate: string;\n readonly compatibilityFlags: readonly string[];\n readonly crons: readonly string[];\n readonly bindings: readonly DeploymentBinding[];\n readonly queueConsumers: readonly string[];\n readonly customBuild: boolean;\n}\n\n/** A projection, not a replacement for Wrangler's full configuration validator. */\nexport function selectDeploymentTarget(raw: unknown, environment: string): DeploymentTarget {\n if (!/^[A-Za-z0-9][A-Za-z0-9_-]*$/u.test(environment)) {\n throw new Error(\n 'An explicit environment name using letters, digits, underscores or dashes is required.',\n );\n }\n const root = checked(record, raw, 'configuration');\n const environments = checked(record, root.env, 'env');\n if (!Object.hasOwn(environments, environment))\n throw new Error('The requested environment is not declared in Wrangler configuration.');\n const selected = checked(record, environments[environment], `env.${environment}`);\n const inherit = (key: string): unknown =>\n Object.hasOwn(selected, key) ? selected[key] : root[key];\n // Wrangler appends the environment when the named environment omits name.\n const worker = checked(\n workerName,\n Object.hasOwn(selected, 'name')\n ? selected.name\n : `${checked(workerName, root.name, 'name')}-${environment}`,\n 'name',\n );\n const main = checked(text.optional(), inherit('main'), 'main') ?? null;\n if (main === null) {\n const assets = checked(record, inherit('assets'), 'assets (required without main)');\n checked(text, assets.directory, 'assets.directory');\n }\n const compatibilityDate = checked(date, inherit('compatibility_date'), 'compatibility_date');\n const compatibilityFlags =\n checked(z.array(text).optional(), inherit('compatibility_flags'), 'compatibility_flags') ?? [];\n const triggers = checked(\n z.object({ crons: z.array(text) }).optional(),\n inherit('triggers'),\n 'triggers',\n );\n const build = checked(\n z.object({ command: text.optional() }).optional(),\n inherit('build'),\n 'build',\n );\n const bindings: DeploymentBinding[] = [];\n const names = new Set<string>();\n const add = (name: string, kind: string): void => {\n if (names.has(name)) throw new Error(`Duplicate Worker binding name: ${name}.`);\n names.add(name);\n bindings.push({ name, kind });\n };\n // Resource bindings and vars are NOT inherited by a named environment.\n const variables = checked(record.optional(), selected.vars, 'vars') ?? {};\n for (const name of Object.keys(variables))\n add(checked(bindingName, name, 'vars binding name'), 'var');\n for (const kind of [\n 'kv_namespaces',\n 'd1_databases',\n 'r2_buckets',\n 'services',\n 'hyperdrive',\n 'vectorize',\n 'workflows',\n 'analytics_engine_datasets',\n ]) {\n const rows = checked(z.array(record).optional(), selected[kind], kind) ?? [];\n for (const row of rows) {\n add(checked(bindingName, row.binding, `${kind}.binding`), kind);\n // Omitted IDs are supported by Wrangler auto-provisioning. Never print IDs/values.\n for (const field of ['id', 'database_id', 'database_name', 'bucket_name']) {\n if (Object.hasOwn(row, field)) checked(text, row[field], `${kind}.${field}`);\n }\n if (kind === 'services') checked(workerName, row.service, 'services.service');\n if (kind === 'workflows') checked(text, row.class_name, 'workflows.class_name');\n }\n }\n const durable = checked(\n z\n .object({\n bindings: z.array(\n z.object({\n name: bindingName,\n class_name: text,\n script_name: workerName.optional(),\n }),\n ),\n })\n .optional(),\n selected.durable_objects,\n 'durable_objects',\n );\n for (const row of durable?.bindings ?? []) add(row.name, 'durable_objects');\n const queues = checked(\n z\n .object({\n producers: z.array(z.object({ binding: bindingName, queue: text.optional() })).optional(),\n consumers: z.array(z.object({ queue: text })).optional(),\n })\n .optional(),\n selected.queues,\n 'queues',\n );\n for (const producer of queues?.producers ?? []) add(producer.binding, 'queues');\n const queueConsumers = queues?.consumers?.map((row) => row.queue) ?? [];\n if (new Set(queueConsumers).size !== queueConsumers.length)\n throw new Error('Duplicate queue consumer configuration.');\n return {\n environment,\n worker,\n main,\n compatibilityDate,\n compatibilityFlags,\n crons: triggers?.crons ?? [],\n bindings,\n queueConsumers,\n customBuild: build?.command !== undefined,\n };\n}\n","import { parseCron, parseCronMetadata } from '@velajs/vela';\nimport { z } from 'zod';\nimport { selectDeploymentTarget, type DeploymentTarget } from './deploy-check.config.js';\n\nexport interface DeploymentIssue {\n readonly code: string;\n readonly message: string;\n}\n\nconst rowsSchema = z.array(\n z.object({ kind: z.string().min(1), target: z.string().min(1), meta: z.unknown() }),\n);\nconst metadataSchema = z.record(z.string(), z.unknown());\n\n/** Accept existing `vela entrypoint list --json` output without loading an application. */\nfunction entrypoints(value: unknown) {\n const parsed = rowsSchema.safeParse(value);\n if (!parsed.success)\n throw new Error('Entrypoint snapshot must be an array of { kind, target, meta } rows.');\n return parsed.data\n .filter((row) => !(row.target === '(no entrypoints)' && row.meta === ''))\n .map((row) => {\n let meta: unknown = row.meta;\n if (typeof meta === 'string') {\n try {\n meta = JSON.parse(meta);\n } catch {\n throw new Error('Invalid JSON metadata in entrypoint snapshot.');\n }\n }\n // Unknown kinds can contain arbitrary metadata; known ones validate below.\n return { kind: row.kind, meta };\n });\n}\n\nexport interface DeploymentPlan {\n readonly status: 'passed' | 'failed';\n readonly target: DeploymentTarget;\n readonly errors: readonly DeploymentIssue[];\n readonly warnings: readonly DeploymentIssue[];\n}\n\n/** Compare literal dispatch keys; equivalent cron expressions are not interchangeable. */\nexport function checkDeployment(\n rawConfig: unknown,\n environment: string,\n snapshot: unknown,\n): DeploymentPlan {\n const target = selectDeploymentTarget(rawConfig, environment);\n const errors: DeploymentIssue[] = [];\n const warnings: DeploymentIssue[] = [];\n const report = (code: string, message: string) => errors.push({ code, message });\n const validateCron = (cron: string): void => {\n if (!parseCron(cron, { dialect: 'cloudflare', timeZone: 'UTC' })) {\n report('invalid-cron', 'A trigger or handler has an invalid Cloudflare cron expression.');\n }\n };\n const crons = new Set(target.crons);\n if (crons.size !== target.crons.length)\n report('duplicate-cron', 'Duplicate cron trigger configuration.');\n for (const cron of crons) validateCron(cron);\n const handlerCrons = new Set<string>();\n const handlerQueues = new Set<string>();\n for (const row of entrypoints(snapshot)) {\n if (row.kind === 'schedule:interval') {\n report(\n 'unsupported-interval',\n 'Workers cannot drive @Interval handlers; use a scheduled trigger or a separate Node adapter.',\n );\n continue;\n }\n if (\n !['cf:scheduled', 'cf:vela-cron', 'schedule:cron', 'cf:queue', 'websocket'].includes(row.kind)\n )\n continue;\n const parsed = metadataSchema.safeParse(row.meta);\n if (!parsed.success) {\n report('invalid-metadata', `Invalid ${row.kind} metadata.`);\n continue;\n }\n const meta = parsed.data;\n if (row.kind === 'cf:vela-cron' || row.kind === 'schedule:cron') {\n try {\n const cron = parseCronMetadata(meta);\n if (\n (cron.dialect !== undefined && cron.dialect !== 'cloudflare') ||\n (cron.timeZone !== undefined && cron.timeZone !== 'UTC')\n ) {\n report(\n 'incompatible-cron-options',\n 'A cron handler explicitly requests options incompatible with Cloudflare UTC delivery.',\n );\n }\n } catch {\n report('invalid-metadata', `Invalid ${row.kind} metadata.`);\n continue;\n }\n }\n if (row.kind === 'websocket') {\n // WsDispatcher contributes { options, ... }; raw class metadata is options itself.\n const options = Object.hasOwn(meta, 'options')\n ? metadataSchema.safeParse(meta.options)\n : parsed;\n const binding = options.success ? options.data.binding : undefined;\n if (\n typeof binding !== 'string' ||\n !target.bindings.some((b) => b.kind === 'durable_objects' && b.name === binding)\n ) {\n report(\n 'missing-durable-binding',\n 'A WebSocket gateway requires a Durable Object binding in the selected environment.',\n );\n }\n continue;\n }\n const key =\n row.kind === 'cf:scheduled' ? 'cron' : row.kind === 'cf:queue' ? 'queueName' : 'expression';\n const value = meta[key];\n if (typeof value !== 'string' || value.trim().length === 0) {\n report('invalid-metadata', `Invalid ${row.kind}.${key} metadata.`);\n continue;\n }\n if (row.kind === 'cf:queue') handlerQueues.add(value);\n else {\n handlerCrons.add(value);\n validateCron(value);\n }\n }\n for (const cron of handlerCrons)\n if (!crons.has(cron))\n report(\n 'missing-cron-trigger',\n `No exact Wrangler trigger for handler cron ${JSON.stringify(cron)}.`,\n );\n for (const cron of crons)\n if (!handlerCrons.has(cron))\n report(\n 'unhandled-cron-trigger',\n `No metadata handler for Wrangler cron ${JSON.stringify(cron)}.`,\n );\n for (const queue of handlerQueues)\n if (!target.queueConsumers.includes(queue))\n report(\n 'missing-queue-consumer',\n `No selected queue consumer for handler queue ${JSON.stringify(queue)}.`,\n );\n for (const queue of target.queueConsumers)\n if (!handlerQueues.has(queue))\n report(\n 'unhandled-queue-consumer',\n `No metadata handler for selected queue ${JSON.stringify(queue)}.`,\n );\n warnings.push({\n code: 'static-only',\n message:\n 'Snapshot freshness, custom platform handlers, deployed resources, secrets and bundle/runtime behavior are not verified. Run Wrangler and native tests separately.',\n });\n if (target.customBuild)\n warnings.push({\n code: 'custom-build',\n message: 'Wrangler has a custom build command. It was not executed by this check.',\n });\n return { status: errors.length ? 'failed' : 'passed', target, errors, warnings };\n}\n","import { execFile } from 'node:child_process';\nimport { createHash } from 'node:crypto';\nimport { open } from 'node:fs/promises';\nimport { dirname, resolve } from 'node:path';\nimport { promisify } from 'node:util';\nimport { Command, Option } from 'clipanion';\nimport { parseDeploymentConfig } from './deploy-check.config.js';\nimport { checkDeployment } from './deploy-check.plan.js';\n\nconst exec = promisify(execFile);\nconst MAX_INPUT_BYTES = 1024 * 1024;\n\nasync function readInput(path: string): Promise<string> {\n const file = await open(path, 'r');\n try {\n if (!(await file.stat()).isFile()) throw new Error('Input must be a regular file.');\n const buffer = Buffer.alloc(MAX_INPUT_BYTES + 1);\n let length = 0;\n while (length < buffer.length) {\n // eslint-disable-next-line no-await-in-loop -- Each offset depends on the preceding partial read.\n const { bytesRead } = await file.read(buffer, length, buffer.length - length, length);\n if (bytesRead === 0) break;\n length += bytesRead;\n }\n if (length > MAX_INPUT_BYTES) throw new Error('Deployment inputs must not exceed 1 MiB.');\n return buffer.subarray(0, length).toString('utf8');\n } finally {\n await file.close();\n }\n}\n\nasync function gitProvenance(cwd: string) {\n try {\n const options = { cwd, timeout: 5000, maxBuffer: 1024 * 1024 };\n const [head, status] = await Promise.all([\n exec('git', ['rev-parse', '--verify', 'HEAD'], options),\n exec(\n 'git',\n [\n '--no-optional-locks',\n '-c',\n 'core.fsmonitor=false',\n 'status',\n '--porcelain=v1',\n '--untracked-files=normal',\n ],\n options,\n ),\n ]);\n const commit = head.stdout.trim();\n if (!/^[a-f0-9]{40,64}$/u.test(commit)) throw new Error('Invalid git commit.');\n return { commit, dirty: status.stdout.length > 0 };\n } catch {\n return { commit: null, dirty: null };\n }\n}\n\nconst digest = (text: string): string => createHash('sha256').update(text).digest('hex');\n\n/** Static application deployment preflight; never invokes Wrangler or application code. */\nexport class DeployCheckCommand extends Command {\n static override paths = [['deploy', 'check']];\n static override usage = Command.Usage({\n category: 'Deployment',\n description: 'Check an explicit Wrangler target against a saved entrypoint snapshot.',\n details:\n 'Read-only: no app bootstrap, custom build, credential loading or upload. Compares cron/queue dispatch keys and WebSocket Durable Object bindings. Wrangler remains the deployment tool.',\n examples: [\n [\n 'Check staging',\n 'vela deploy check --config wrangler.jsonc --env staging --entrypoints entrypoints.json',\n ],\n ],\n });\n\n config = Option.String('--config', {\n required: true,\n description: 'Explicit Wrangler .json/.jsonc/.toml file.',\n });\n environment = Option.String('--env', {\n required: true,\n description: 'Exact named environment in the Wrangler file.',\n });\n entrypoints = Option.String('--entrypoints', {\n required: true,\n description: 'Saved vela entrypoint list --json array.',\n });\n json = Option.Boolean('--json', false, { description: 'Emit the redacted report as JSON.' });\n\n async execute(): Promise<number> {\n try {\n if (!this.config.trim() || !this.entrypoints.trim())\n throw new Error('Explicit configuration and snapshot paths are required.');\n const configPath = resolve(this.config);\n const snapshotPath = resolve(this.entrypoints);\n const [config, snapshot] = await Promise.all([\n readInput(configPath),\n readInput(snapshotPath),\n ]);\n let rows: unknown;\n try {\n rows = JSON.parse(snapshot);\n } catch {\n throw new Error('Invalid entrypoint snapshot JSON.');\n }\n const plan = checkDeployment(\n parseDeploymentConfig(config, configPath),\n this.environment,\n rows,\n );\n const provenance = {\n ...(await gitProvenance(dirname(configPath))),\n checkedAt: new Date().toISOString(),\n config: { path: configPath, sha256: digest(config) },\n entrypoints: { path: snapshotPath, sha256: digest(snapshot) },\n };\n const wrangler = {\n command: 'pnpm',\n args: [\n 'exec',\n 'wrangler',\n 'deploy',\n '--config',\n configPath,\n '--env',\n this.environment,\n '--dry-run',\n ],\n };\n const result = { ...plan, provenance, nextStep: wrangler };\n if (this.json) this.context.stdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n else {\n this.context.stdout.write(\n `Deployment check: ${plan.status}\\nWorker: ${plan.target.worker}\\nEnvironment: ${plan.target.environment}\\nConfig: ${configPath}\\nCommit: ${provenance.commit ?? 'unavailable'} (${provenance.dirty === null ? 'cleanliness unknown' : provenance.dirty ? 'dirty' : 'clean'})\\nConfig SHA-256: ${provenance.config.sha256}\\nSnapshot SHA-256: ${provenance.entrypoints.sha256}\\nBindings: ${plan.target.bindings.map((binding) => `${binding.name} (${binding.kind})`).join(', ') || '(none)'}\\n`,\n );\n for (const issue of plan.errors)\n this.context.stdout.write(`Error [${issue.code}]: ${issue.message}\\n`);\n for (const issue of plan.warnings)\n this.context.stdout.write(`Warning [${issue.code}]: ${issue.message}\\n`);\n this.context.stdout.write(\n `Next step (not executed): ${[wrangler.command, ...wrangler.args].map((arg) => `'${arg.replaceAll(\"'\", \"'\\\\''\")}'`).join(' ')}\\n`,\n );\n }\n return plan.status === 'passed' ? 0 : 1;\n } catch (error) {\n // Filesystem errors contain paths, not file contents; parser/schema errors are sanitized above.\n const message = error instanceof Error ? error.message : 'Deployment check failed.';\n if (this.json)\n this.context.stdout.write(`${JSON.stringify({ status: 'failed', error: message })}\\n`);\n else this.context.stderr.write(`${message}\\n`);\n return 1;\n }\n }\n}\n","#!/usr/bin/env node\nimport { Builtins, Cli } from 'clipanion';\nimport manifest from '../package.json' with { type: 'json' };\nimport {\n EntrypointListCommand,\n ModuleGraphCommand,\n OpenApiDumpCommand,\n RouteListCommand,\n} from './commands/introspect.commands.js';\nimport { McpServeCommand } from './commands/mcp.command.js';\nimport { SeedCommand } from './commands/seed.command.js';\nimport { StudioCommand } from './commands/studio.command.js';\nimport { ClientGenerateCommand } from './commands/client.command.js';\nimport { NewCommand } from './commands/new.command.js';\nimport { DoctorCommand } from './commands/doctor.command.js';\nimport { DeployCheckCommand } from './commands/deploy-check.command.js';\n\nconst cli = new Cli({\n binaryName: 'vela',\n binaryLabel: 'Vela CLI',\n binaryVersion: manifest.version,\n});\n\ncli.register(Builtins.HelpCommand);\ncli.register(Builtins.VersionCommand);\ncli.register(NewCommand);\ncli.register(SeedCommand);\ncli.register(RouteListCommand);\ncli.register(ModuleGraphCommand);\ncli.register(EntrypointListCommand);\ncli.register(OpenApiDumpCommand);\ncli.register(McpServeCommand);\ncli.register(StudioCommand);\ncli.register(ClientGenerateCommand);\ncli.register(DoctorCommand);\ncli.register(DeployCheckCommand);\n\nvoid cli.runExit(process.argv.slice(2));\n\nexport { SeedCommand } from './commands/seed.command.js';\nexport { NewCommand } from './commands/new.command.js';\nexport {\n EntrypointListCommand,\n ModuleGraphCommand,\n OpenApiDumpCommand,\n RouteListCommand,\n} from './commands/introspect.commands.js';\nexport { McpServeCommand } from './commands/mcp.command.js';\nexport { StudioCommand } from './commands/studio.command.js';\nexport { ClientGenerateCommand } from './commands/client.command.js';\nexport { DoctorCommand } from './commands/doctor.command.js';\nexport { DeployCheckCommand } from './commands/deploy-check.command.js';\nexport { generateClientContract } from './client-contract.js';\nexport type { GeneratedClientContract } from './client-contract.js';\nexport {\n collectRoutes,\n collectModules,\n collectEntrypoints,\n renderModuleTree,\n} from './introspect.js';\nexport type { RouteRow, EntrypointRow } from './introspect.js';\nexport { renderTable } from './format.js';\nexport { loadConfig, defineVelaConfig, resolveConfig } from './config.js';\nexport type { VelaConfig, ConfigResolution } from './config.js';\nexport { formatSeedResults } from './format.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;ACIA,eAAsB,QACpB,QACA,MACA,MACiB;CACjB,MAAM,MAAM,MAAM,OAAO,UAAU;CACnC,MAAM,UAAU,UAAyB;EACvC,IAAI;GACF,KAAK,6BAA6B,OAAO,KAAK,GAAG;EACnD,QAAQ,CAER;CACF;CACA,IAAI;EACF,OAAO,MAAM,KAAK,GAAG;CACvB,UAAU;EACR,IAAI;GAEF,IAAI,OAAO,IAAI,YAAY,YAAY,MAAM,IAAI,QAAQ;QACpD,MAAM,IAAI,aAAa,CAAC,CAAC,QAAQ;EACxC,SAAS,OAAO;GACd,OAAO,KAAK;GAGZ,IAAI;IACF,MAAM,IAAI,aAAa,CAAC,CAAC,QAAQ;GACnC,SAAS,cAAc;IACrB,OAAO,YAAY;GACrB;EACF;CACF;AACF;;;;;;;AC7BA,SAAgB,kBACd,SACA,OAAkC,MAAM,QAAQ,IAAI,CAAC,GAC7C;CACR,IAAI,QAAQ,WAAW,GAAG;EACxB,IAAI,mBAAmB;EACvB,OAAO;CACT;CAEA,IAAI,SAAS;CACb,KAAK,MAAM,UAAU,SACnB,IAAI,OAAO,IACT,IAAI,OAAO,OAAO,MAAM;MACnB;EACL;EACA,IAAI,OAAO,OAAO,OAAO,OAAO,QAAQ,KAAK,aAAa,OAAO,KAAK,MAAM,IAAI;CAClF;CAGF,MAAM,QAAQ,QAAQ;CACtB,IAAI,KAAK,QAAQ,OAAO,GAAG,MAAM,2BAA2B;CAC5D,OAAO,SAAS,IAAI,IAAI;AAC1B;AAEA,SAAS,aAAa,OAAwB;CAC5C,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;;AAG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O,MAAM,GAAG,KAAK,UAAU;IAAE,QAAQ;IAAU,OAAO;GAAQ,CAAC,EAAE,GAAG;QAClF,KAAK,QAAQ,OAAO,MAAM,GAAG,QAAQ,GAAG;GAC7C,OAAO;EACT;CACF;AACF;;;ACxIA,MAAM,MAAM,IAAI,IAAI;CAClB,YAAY;CACZ,aAAa;CACb,eAAeC;AACjB,CAAC;AAED,IAAI,SAAS,SAAS,WAAW;AACjC,IAAI,SAAS,SAAS,cAAc;AACpC,IAAI,SAAS,UAAU;AACvB,IAAI,SAAS,WAAW;AACxB,IAAI,SAAS,gBAAgB;AAC7B,IAAI,SAAS,kBAAkB;AAC/B,IAAI,SAAS,qBAAqB;AAClC,IAAI,SAAS,kBAAkB;AAC/B,IAAI,SAAS,eAAe;AAC5B,IAAI,SAAS,aAAa;AAC1B,IAAI,SAAS,qBAAqB;AAClC,IAAI,SAAS,aAAa;AAC1B,IAAI,SAAS,kBAAkB;AAE1B,IAAI,QAAQ,QAAQ,KAAK,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","names":["describeToken","parseToml","manifest.version"],"sources":["../package.json","../src/with-app.ts","../src/format.ts","../src/introspect.ts","../src/commands/introspect.commands.ts","../src/commands/mcp.command.ts","../src/commands/seed.command.ts","../src/commands/studio.command.ts","../src/commands/client.command.ts","../src/new-project.ts","../src/commands/new.command.ts","../src/commands/doctor.command.ts","../src/commands/deploy-check.config.ts","../src/commands/deploy-check.plan.ts","../src/commands/deploy-check.command.ts","../src/index.ts"],"sourcesContent":["","import type { VelaApplication } from '@velajs/vela';\nimport type { VelaConfig } from './config.js';\n\n/** Own one app for the whole command, including output and long-lived transports. */\nexport async function withApp<Result>(\n config: VelaConfig,\n work: (app: VelaApplication) => Result | Promise<Result>,\n warn: (message: string) => void,\n): Promise<Result> {\n const app = await config.createApp();\n const report = (error: unknown): void => {\n try {\n warn(`Warning: teardown failed: ${String(error)}`);\n } catch {\n // A failed output stream must not replace the command's result/error.\n }\n };\n try {\n return await work(app);\n } finally {\n try {\n // Older 1.x apps may not implement full application disposal.\n if (typeof app.dispose === 'function') await app.dispose();\n else await app.getContainer().dispose();\n } catch (error) {\n report(error);\n // A throwing shutdown hook in older Vela versions can skip the container.\n // Disposal is idempotent; release constructed resources even in that case.\n try {\n await app.getContainer().dispose();\n } catch (cleanupError) {\n report(cleanupError);\n }\n }\n }\n}\n","import type { SeederResult } from '@velajs/vela/seeder';\n\n/**\n * Render seeder results to a logger and return a process exit code\n * (0 = all ran, 1 = at least one failed). Pure — no I/O beyond the logger.\n */\nexport function formatSeedResults(\n results: SeederResult[],\n log: (message: string) => void = (m) => console.log(m),\n): number {\n if (results.length === 0) {\n log('No seeders found.');\n return 0;\n }\n\n let failed = 0;\n for (const result of results) {\n if (result.ok) {\n log(` ✓ ${result.name}`);\n } else {\n failed++;\n log(` ✗ ${result.name}${result.error ? `: ${errorMessage(result.error)}` : ''}`);\n }\n }\n\n const total = results.length;\n log(`\\n${total - failed}/${total} seeders ran successfully.`);\n return failed > 0 ? 1 : 0;\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n/** Aligned plain-text table. Pure; returns lines. */\nexport function renderTable(headers: string[], rows: string[][]): string[] {\n const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] ?? '').length)));\n const line = (cells: string[]): string =>\n cells\n .map((c, i) => (c ?? '').padEnd(widths[i]!))\n .join(' ')\n .trimEnd();\n return [line(headers), line(widths.map((w) => '-'.repeat(w))), ...rows.map(line)];\n}\n","import type { VelaApplication } from '@velajs/vela';\nimport { describeToken, getEntrypointKinds } from '@velajs/vela';\nimport type { ModuleDescription, RouteDescription } from '@velajs/vela';\n\n/** One row of `vela route list`. */\nexport interface RouteRow {\n method: string;\n path: string;\n /** `Controller#handler`, or `(mounted)` for routes vela did not compose\n * itself (RouteContributor/CRUD, OpenAPI UI mounts, manual Hono routes). */\n handler: string;\n source: 'controller' | 'mounted';\n}\n\n/**\n * The app's route table: `describeRoutes()` rows (framework-composed truth)\n * plus everything else present on the Hono router, deduped and labeled\n * `(mounted)`. Returns null when the app never built HTTP routes.\n */\nexport function collectRoutes(app: VelaApplication): RouteRow[] | null {\n let described: RouteDescription[];\n try {\n described = app.describeRoutes();\n } catch {\n return null; // no HTTP routes built (slim/non-HTTP app)\n }\n\n const rows: RouteRow[] = described.map((r) => ({\n method: r.method,\n path: r.path,\n handler: `${r.controller}#${r.handler}`,\n source: 'controller',\n }));\n\n const covered = new Set(described.map((r) => `${r.method} ${r.path}`));\n for (const r of described) {\n // @Head handlers are served by Hono under GET — claim that row too so it\n // doesn't reappear as a mounted duplicate.\n if (r.method === 'HEAD') covered.add(`GET ${r.path}`);\n }\n\n const seenMounted = new Set<string>();\n for (const honoRoute of app.getHonoApp().routes) {\n // 'ALL' entries are middleware mounts (framework-internal disposal/context\n // wrappers, global + scoped middleware) — not endpoints.\n if (honoRoute.method === 'ALL') continue;\n const key = `${honoRoute.method} ${honoRoute.path}`;\n if (covered.has(key) || seenMounted.has(key)) continue;\n seenMounted.add(key);\n rows.push({\n method: honoRoute.method,\n path: honoRoute.path,\n handler: '(mounted)',\n source: 'mounted',\n });\n }\n\n return rows.sort((a, b) => a.path.localeCompare(b.path) || a.method.localeCompare(b.method));\n}\n\n/** `vela module graph` tree lines (or raw descriptions for --json). */\nexport function collectModules(app: VelaApplication): ModuleDescription[] {\n return app.getContainer().getModuleDescriptions();\n}\n\nexport function renderModuleTree(modules: ModuleDescription[]): string[] {\n const byId = new Map(modules.map((m) => [m.moduleId, m]));\n const imported = new Set(modules.flatMap((m) => m.imports));\n const roots = modules.filter((m) => !imported.has(m.moduleId));\n\n const lines: string[] = [];\n const render = (id: string, depth: number, trail: Set<string>): void => {\n const mod = byId.get(id);\n const flags = mod\n ? [mod.isGlobal ? 'global' : null, mod.lazy ? 'lazy' : null].filter(Boolean)\n : [];\n const suffix = flags.length > 0 ? ` (${flags.join(', ')})` : '';\n const providers = mod\n ? ` — ${mod.providers.length} provider${mod.providers.length === 1 ? '' : 's'}`\n : '';\n lines.push(`${' '.repeat(depth)}${id}${suffix}${providers}`);\n if (!mod || trail.has(id)) return;\n const nextTrail = new Set(trail).add(id);\n for (const child of mod.imports) render(child, depth + 1, nextTrail);\n };\n\n for (const root of roots) render(root.moduleId, 0, new Set());\n return lines;\n}\n\n/** One row of `vela entrypoint list`. */\nexport interface EntrypointRow {\n kind: string;\n target: string;\n meta: string;\n}\n\nfunction safeMeta(meta: unknown): string {\n try {\n return (\n JSON.stringify(meta, (_key, value: unknown) =>\n typeof value === 'function'\n ? '[function]'\n : typeof value === 'object' &&\n value !== null &&\n value.constructor !== Object &&\n !Array.isArray(value)\n ? `[${(value as object).constructor.name}]`\n : value,\n ) ?? 'undefined'\n );\n } catch {\n return '[unserializable]';\n }\n}\n\n/**\n * Every DECLARED entrypoint kind (from the global kind store — includes kinds\n * with zero entries) joined with the app's entries. Metadata-only entries of\n * lazy modules list fine; nothing materializes.\n */\nexport function collectEntrypoints(app: VelaApplication): EntrypointRow[] {\n const rows: EntrypointRow[] = [];\n const declared = getEntrypointKinds().map((k: { kind: string }) => k.kind);\n const populated = app.entrypoints.kinds();\n const kinds = [...new Set([...declared, ...populated])];\n\n for (const kind of kinds) {\n const entries = app.entrypoints.ofKind(kind);\n if (entries.length === 0) {\n rows.push({ kind, target: '(no entrypoints)', meta: '' });\n continue;\n }\n for (const ep of entries) {\n const method = ep.methodName !== undefined ? `#${String(ep.methodName)}` : '';\n rows.push({ kind, target: `${describeToken(ep.token)}${method}`, meta: safeMeta(ep.meta) });\n }\n }\n return rows;\n}\n","import { writeFile } from 'node:fs/promises';\nimport { createOpenApiDocument } from '@velajs/vela';\nimport type { VelaApplication } from '@velajs/vela';\nimport { Command, Option } from 'clipanion';\nimport { loadConfig } from '../config.js';\nimport { withApp } from '../with-app.js';\nimport { renderTable } from '../format.js';\nimport {\n collectEntrypoints,\n collectModules,\n collectRoutes,\n renderModuleTree,\n} from '../introspect.js';\n\n/** Shared shell: load config → createApp → run → best-effort dispose. */\nabstract class AppCommand extends Command {\n config = Option.String('--config', { description: 'Path to the vela config file.' });\n json = Option.Boolean('--json', false, { description: 'Emit machine-readable JSON.' });\n\n protected abstract run(app: VelaApplication): Promise<number>;\n\n async execute(): Promise<number> {\n const velaConfig = await loadConfig(process.cwd(), this.config);\n return withApp(\n velaConfig,\n (app) => this.run(app),\n (message) => {\n this.context.stderr.write(`${message}\\n`);\n },\n );\n }\n\n protected print(text: string): void {\n this.context.stdout.write(`${text}\\n`);\n }\n}\n\n/** `vela route list` — the app's HTTP route table. */\nexport class RouteListCommand extends AppCommand {\n static override paths = [['route', 'list']];\n static override usage = Command.Usage({\n category: 'Introspection',\n description: 'List the HTTP routes of the Vela app.',\n details:\n 'Framework-composed controller routes (method, full path, controller#handler) plus ' +\n 'everything else mounted on the router (CRUD/contributed routes, doc UIs) labeled (mounted).',\n examples: [\n ['List routes', 'vela route list'],\n ['As JSON', 'vela route list --json'],\n ],\n });\n\n protected async run(app: VelaApplication): Promise<number> {\n const rows = collectRoutes(app);\n if (rows === null) {\n this.print('This app builds no HTTP routes — nothing to list.');\n return 0;\n }\n if (this.json) {\n this.print(JSON.stringify(rows, null, 2));\n return 0;\n }\n for (const line of renderTable(\n ['METHOD', 'PATH', 'HANDLER'],\n rows.map((r) => [r.method, r.path, r.handler]),\n )) {\n this.print(line);\n }\n return 0;\n }\n}\n\n/** `vela module graph` — the loaded module graph. */\nexport class ModuleGraphCommand extends AppCommand {\n static override paths = [['module', 'graph']];\n static override usage = Command.Usage({\n category: 'Introspection',\n description: 'Print the module graph of the Vela app.',\n details:\n 'Module instances with their imports (indented tree), global/lazy flags, and provider ' +\n 'counts. --json emits the raw descriptions (providers, exports, imports per module).',\n examples: [\n ['Print the graph', 'vela module graph'],\n ['As JSON', 'vela module graph --json'],\n ],\n });\n\n protected async run(app: VelaApplication): Promise<number> {\n const modules = collectModules(app);\n if (this.json) {\n this.print(JSON.stringify(modules, null, 2));\n return 0;\n }\n for (const line of renderModuleTree(modules)) this.print(line);\n return 0;\n }\n}\n\n/** `vela entrypoint list` — declared entrypoint kinds and their entries. */\nexport class EntrypointListCommand extends AppCommand {\n static override paths = [['entrypoint', 'list']];\n static override usage = Command.Usage({\n category: 'Introspection',\n description: 'List entrypoint kinds and entries (websocket, queue, cron, …).',\n details:\n 'Every declared kind — including kinds with zero entries — with the contributing ' +\n 'class (and method for method-level kinds) and its metadata.',\n examples: [['List entrypoints', 'vela entrypoint list']],\n });\n\n protected async run(app: VelaApplication): Promise<number> {\n const rows = collectEntrypoints(app);\n if (this.json) {\n this.print(JSON.stringify(rows, null, 2));\n return 0;\n }\n for (const line of renderTable(\n ['KIND', 'TARGET', 'META'],\n rows.map((r) => [r.kind, r.target, r.meta]),\n )) {\n this.print(line);\n }\n return 0;\n }\n}\n\n/** `vela openapi dump` — emit the OpenAPI document. */\nexport class OpenApiDumpCommand extends Command {\n static override paths = [['openapi', 'dump']];\n static override usage = Command.Usage({\n category: 'Introspection',\n description: 'Emit the OpenAPI document for the Vela app.',\n details:\n 'Requires `rootModule` in vela.config (createOpenApiDocument works from the module ' +\n \"class). The app's global prefix is applied automatically; --global-prefix overrides.\",\n examples: [\n ['Print to stdout', 'vela openapi dump'],\n ['Write to a file', 'vela openapi dump --out openapi.json'],\n ],\n });\n\n config = Option.String('--config', { description: 'Path to the vela config file.' });\n out = Option.String('--out', {\n description: 'Write the document to this file instead of stdout.',\n });\n title = Option.String('--title', { description: 'info.title override.' });\n apiVersion = Option.String('--api-version', { description: 'info.version override.' });\n globalPrefix = Option.String('--global-prefix', {\n description: \"Path prefix override (defaults to the app's global prefix).\",\n });\n\n async execute(): Promise<number> {\n const velaConfig = await loadConfig(process.cwd(), this.config);\n if (!velaConfig.rootModule) {\n this.context.stderr.write(\n 'openapi dump needs the root module. Add it to your vela.config:\\n\\n' +\n ' export default defineVelaConfig({\\n' +\n ' rootModule: AppModule,\\n' +\n ' async createApp() { ... },\\n' +\n ' });\\n',\n );\n return 1;\n }\n\n const rootModule = velaConfig.rootModule;\n return withApp(\n velaConfig,\n async (app) => {\n const info: Record<string, string> = {};\n if (this.title) info.title = this.title;\n if (this.apiVersion) info.version = this.apiVersion;\n\n const document = createOpenApiDocument(rootModule, {\n globalPrefix: this.globalPrefix ?? app.getGlobalPrefix(),\n ...(Object.keys(info).length > 0 ? { info } : {}),\n });\n\n const text = JSON.stringify(document, null, 2);\n if (this.out) {\n await writeFile(this.out, `${text}\\n`, 'utf8');\n this.context.stdout.write(`Wrote ${this.out}\\n`);\n } else {\n this.context.stdout.write(`${text}\\n`);\n }\n return 0;\n },\n (message) => this.context.stderr.write(`${message}\\n`),\n );\n }\n}\n","import { readFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { createOpenApiDocument } from '@velajs/vela';\nimport type { Type, VelaApplication } from '@velajs/vela';\nimport { Command, Option } from 'clipanion';\nimport { z } from 'zod';\nimport { loadConfig } from '../config.js';\nimport { withApp } from '../with-app.js';\nimport {\n collectEntrypoints,\n collectModules,\n collectRoutes,\n renderModuleTree,\n} from '../introspect.js';\n\nconst OPENAPI_URI = 'vela://openapi';\n\n/** A single JSON text block — the shape every tool/resource result uses. */\nfunction jsonText(data: unknown): { content: { type: 'text'; text: string }[] } {\n return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };\n}\n\n/** An MCP tool error result (JSON-RPC stays 2.0; the failure is in-band). */\nfunction toolError(message: string): { isError: true; content: { type: 'text'; text: string }[] } {\n return { isError: true, content: [{ type: 'text', text: message }] };\n}\n\n/** Name + version for the MCP server handshake, read from the CLI's own package.json. */\nasync function readCliIdentity(): Promise<{ name: string; version: string }> {\n const here = dirname(fileURLToPath(import.meta.url));\n // tsdown bundles this module into dist/index.js; source-mode tests load it\n // from src/commands/mcp.command.ts. Support both locations without relying\n // on a fixed output depth.\n for (const pkgPath of [\n join(here, '..', 'package.json'),\n join(here, '..', '..', 'package.json'),\n ]) {\n try {\n const pkg = JSON.parse(await readFile(pkgPath, 'utf8')) as {\n name?: string;\n version?: string;\n };\n return { name: pkg.name ?? '@velajs/cli', version: pkg.version ?? '0.0.0' };\n } catch (error) {\n if ((error as { code?: string }).code !== 'ENOENT') throw error;\n }\n }\n return { name: '@velajs/cli', version: '0.0.0' };\n}\n\n/**\n * String-label lookup for a DI token across the module graph. Reads only the\n * serializable descriptions (`collectModules`) — never resolves the token or\n * constructs anything. Reports which modules provide/export it and their scope\n * flags, plus whether the string names a module itself.\n */\nfunction describeToken(app: VelaApplication, token: string): unknown {\n const modules = collectModules(app);\n const providedBy = modules\n .filter((m) => m.providers.includes(token))\n .map((m) => ({\n moduleId: m.moduleId,\n isGlobal: m.isGlobal,\n lazy: m.lazy,\n exported: m.exports.includes(token),\n }));\n const matchesModule = modules.find((m) => m.moduleId === token);\n return {\n token,\n found: providedBy.length > 0 || matchesModule !== undefined,\n providedBy,\n module: matchesModule\n ? {\n moduleId: matchesModule.moduleId,\n isGlobal: matchesModule.isGlobal,\n lazy: matchesModule.lazy,\n }\n : null,\n };\n}\n\n/**\n * `vela mcp serve` — an MCP stdio server exposing the same READ-ONLY\n * introspection as the `route`/`module`/`entrypoint`/`openapi` commands, so an\n * AI agent can query a Vela app's shape over the Model Context Protocol.\n *\n * The application lifetime includes the transport's close promise. stdout is\n * reserved for JSON-RPC framing; every human message goes to stderr.\n */\nexport class McpServeCommand extends Command {\n static override paths = [['mcp', 'serve']];\n static override usage = Command.Usage({\n category: 'Introspection',\n description: 'Serve Vela introspection as MCP tools over stdio (for AI agents).',\n details:\n 'Builds the app from vela.config and runs a Model Context Protocol stdio server. Exposes ' +\n 'read-only tools (route_list, module_graph, entrypoint_list, openapi_dump, token_describe) ' +\n 'and — when the config declares a rootModule — a `vela://openapi` resource. stdout carries ' +\n 'only JSON-RPC; all logging goes to stderr. The server runs until the client disconnects.',\n examples: [\n ['Serve over stdio', 'vela mcp serve'],\n ['Use a specific config', 'vela mcp serve --config ./config/vela.config.js'],\n ],\n });\n\n config = Option.String('--config', { description: 'Path to the vela config file.' });\n\n async execute(): Promise<number> {\n const { McpServer } = await import('@modelcontextprotocol/sdk/server/mcp.js');\n const { StdioServerTransport } = await import('@modelcontextprotocol/sdk/server/stdio.js');\n\n const log = (message: string): void => {\n this.context.stderr.write(`${message}\\n`);\n };\n\n const velaConfig = await loadConfig(process.cwd(), this.config);\n const rootModule: Type | undefined = velaConfig.rootModule;\n\n return withApp(\n velaConfig,\n async (app) => {\n const identity = await readCliIdentity();\n const server = new McpServer(identity);\n\n server.registerTool(\n 'route_list',\n {\n description:\n \"The app's HTTP route table: framework-composed controller routes (method, full \" +\n 'path, Controller#handler) plus everything else mounted on the router, labeled ' +\n '(mounted). Empty when the app builds no HTTP routes.',\n inputSchema: {},\n },\n () => jsonText(collectRoutes(app) ?? []),\n );\n\n server.registerTool(\n 'module_graph',\n {\n description:\n 'The loaded module graph as serializable descriptions (providers, exports, imports, ' +\n 'global/lazy flags). Pass tree=true to also get the rendered import tree lines.',\n inputSchema: { tree: z.boolean().optional() },\n },\n ({ tree }) => {\n const modules = collectModules(app);\n return jsonText(tree ? { modules, tree: renderModuleTree(modules) } : modules);\n },\n );\n\n server.registerTool(\n 'entrypoint_list',\n {\n description:\n 'Every declared entrypoint kind (websocket, queue, cron, …) with its entries and ' +\n 'metadata — including kinds with zero entries. Lazy modules stay unmaterialized.',\n inputSchema: {},\n },\n () => jsonText(collectEntrypoints(app)),\n );\n\n server.registerTool(\n 'openapi_dump',\n {\n description:\n 'The OpenAPI 3.1 document for the app. Requires a rootModule in vela.config. ' +\n 'globalPrefix/title/apiVersion override the defaults (the app global prefix and ' +\n 'the module-derived info).',\n inputSchema: {\n globalPrefix: z.string().optional(),\n title: z.string().optional(),\n apiVersion: z.string().optional(),\n },\n },\n ({ globalPrefix, title, apiVersion }) => {\n if (!rootModule) {\n return toolError(\n 'openapi_dump needs the root module. Add `rootModule: AppModule` to your vela.config.',\n );\n }\n const info: Record<string, string> = {};\n if (title) info.title = title;\n if (apiVersion) info.version = apiVersion;\n const document = createOpenApiDocument(rootModule, {\n globalPrefix: globalPrefix ?? app.getGlobalPrefix(),\n ...(Object.keys(info).length > 0 ? { info } : {}),\n });\n return jsonText(document);\n },\n );\n\n server.registerTool(\n 'token_describe',\n {\n description:\n 'Look a DI token STRING LABEL up across the module graph: which modules provide/export ' +\n 'it and their scope flags, plus whether the string names a module. Read-only string ' +\n 'match — does not resolve or construct the token.',\n inputSchema: { token: z.string() },\n },\n ({ token }) => jsonText(describeToken(app, token)),\n );\n\n if (rootModule) {\n server.registerResource(\n 'openapi',\n OPENAPI_URI,\n { description: 'The OpenAPI 3.1 document for the app.', mimeType: 'application/json' },\n () => ({\n contents: [\n {\n uri: OPENAPI_URI,\n mimeType: 'application/json',\n text: JSON.stringify(\n createOpenApiDocument(rootModule, { globalPrefix: app.getGlobalPrefix() }),\n null,\n 2,\n ),\n },\n ],\n }),\n );\n }\n\n const transport = new StdioServerTransport();\n const closed = new Promise<void>((resolvePromise) => {\n transport.onclose = resolvePromise;\n });\n await server.connect(transport);\n log(\n `vela mcp serve — ready (5 tools${rootModule ? ' + vela://openapi resource' : ''}). ` +\n 'Awaiting client on stdio; stdout is JSON-RPC only.',\n );\n\n // Keep the process alive until the client disconnects; only then dispose.\n await closed;\n return 0;\n },\n log,\n );\n }\n}\n","import { describeToken } from '@velajs/vela';\nimport { runSeeders, SeederRegistry } from '@velajs/vela/seeder';\nimport { Command, Option, UsageError } from 'clipanion';\nimport { loadConfig } from '../config.js';\nimport { formatSeedResults, renderTable } from '../format.js';\nimport { withApp } from '../with-app.js';\n\n/** `vela db seed` — build the app from vela.config and run its seeders. */\nexport class SeedCommand extends Command {\n static override paths = [['db', 'seed']];\n static override usage = Command.Usage({\n category: 'Database',\n description: 'Run database seeders for the Vela app.',\n details:\n 'Loads vela.config.{js,mjs,ts}, builds the app, and runs all @Seeder() classes in order.',\n examples: [\n ['Run all seeders', 'vela db seed'],\n ['Use a specific config', 'vela db seed --config ./config/vela.config.js'],\n ['List seeders and their module owners', 'vela db seed --list --json'],\n ],\n });\n\n config = Option.String('--config', { description: 'Path to the vela config file.' });\n continueOnError = Option.Boolean('--continue-on-error', false, {\n description: 'Run all seeders even if one fails.',\n });\n list = Option.Boolean('--list', false, {\n description: 'List registered seeders and their owners without running them.',\n });\n json = Option.Boolean('--json', false, { description: 'Emit --list inventory as JSON.' });\n\n async execute(): Promise<number> {\n if (this.json && !this.list) throw new UsageError('--json requires --list.');\n if (this.list && this.continueOnError)\n throw new UsageError('--list cannot be combined with --continue-on-error.');\n const config = await loadConfig(process.cwd(), this.config);\n return withApp(\n config,\n async (app) => {\n if (this.list) {\n const inventory = app\n .get(SeederRegistry)\n .list()\n .map((seeder) => ({\n name: seeder.name,\n order: seeder.order,\n target: describeToken(seeder.target),\n moduleId: seeder.moduleId ?? null,\n }));\n const output = this.json\n ? JSON.stringify(inventory, null, 2)\n : renderTable(\n ['ORDER', 'NAME', 'MODULE', 'TARGET'],\n inventory.map((entry) => [\n String(entry.order),\n entry.name,\n entry.moduleId ?? '(unknown)',\n entry.target,\n ]),\n ).join('\\n');\n this.context.stdout.write(`${output}\\n`);\n return 0;\n }\n this.context.stdout.write('Running seeders…\\n');\n const results = await runSeeders(app, { stopOnError: !this.continueOnError });\n return formatSeedResults(results, (message) => this.context.stdout.write(`${message}\\n`));\n },\n (message) => this.context.stderr.write(`${message}\\n`),\n );\n }\n}\n","import { Command, Option } from 'clipanion';\n\n/**\n * The optional peer that does the real work. It is Node-only and heavy, so it is\n * NOT a hard dependency of the CLI — it is lazily imported here and, when it\n * isn't installed, the command prints an install hint (mirroring how\n * `mcp.command` lazily loads its optional peer).\n */\nconst HOST_PACKAGE = '@velajs/studio-host';\n\n/** The slice of `@velajs/studio-host`'s surface this command uses. */\ninterface StudioHostModule {\n startStudioServer(options: {\n workerOrigin: string;\n adminToken?: string;\n port?: number;\n adminPath?: string;\n cwd?: string;\n }): Promise<{ readonly url: string; readonly port: number; close(): Promise<void> }>;\n}\n\n/** True for a failed dynamic `import()` of a missing module (ESM or CJS code). */\nfunction isModuleNotFound(error: unknown, specifier: string): boolean {\n const code =\n error !== null && typeof error === 'object' && 'code' in error ? error.code : undefined;\n if (code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND') {\n return true;\n }\n // Some resolvers surface only a message; match the specifier defensively.\n const message = error instanceof Error ? error.message : '';\n return message.includes(specifier);\n}\n\n/**\n * `vela studio` — start the loopback dev host that serves Vela Studio and proxies\n * the admin API to a running app.\n *\n * App-origin resolution (v1): the target app is taken from `--url <origin>`,\n * which is REQUIRED. The host proxies `{--path}/*` to that origin, injecting the\n * admin token as `Authorization: Bearer` server-side (the browser never holds\n * it). Booting the app in-process from `vela.config` (via `loadConfig`) is a\n * planned follow-up; requiring `--url` keeps v1 simple and adapter-agnostic.\n */\nexport class StudioCommand extends Command {\n static override paths = [['studio']];\n static override usage = Command.Usage({\n category: 'Studio',\n description: 'Serve Vela Studio locally and proxy the admin API to a running app.',\n details:\n 'Starts a loopback dev host (from the optional @velajs/studio-host peer) that serves the ' +\n 'prebuilt Studio SPA and proxies {--path}/* to the app at --url, injecting the admin token ' +\n 'as a Bearer server-side so the browser never receives it. The token comes from --token or ' +\n 'the VELA_STUDIO_TOKEN environment variable. Runs until interrupted (Ctrl+C).',\n examples: [\n ['Serve against a local worker', 'vela studio --url http://127.0.0.1:8787'],\n [\n 'With an explicit token + port',\n 'vela studio --url http://127.0.0.1:8787 --token $TOKEN --port 4000',\n ],\n ],\n });\n\n url = Option.String('--url', {\n description: 'Origin of the running app to proxy the admin API to (required).',\n });\n token = Option.String('--token', {\n description: 'Admin bearer token (falls back to VELA_STUDIO_TOKEN). Never sent to the browser.',\n });\n port = Option.String('--port', {\n description: 'Loopback port to bind (default: an ephemeral port).',\n });\n adminPath = Option.String('--path', {\n description: 'Server admin-mount prefix to proxy (default: /_vela/admin).',\n });\n\n async execute(): Promise<number> {\n const workerOrigin = this.url;\n if (workerOrigin === undefined || workerOrigin === '') {\n this.context.stderr.write(\n 'vela studio: --url <origin> is required — the running app to proxy the admin API to.\\n' +\n ' Example: vela studio --url http://127.0.0.1:8787\\n',\n );\n return 1;\n }\n if (!URL.canParse(workerOrigin)) {\n this.context.stderr.write(`vela studio: --url is not a valid origin: ${workerOrigin}\\n`);\n return 1;\n }\n\n let port: number | undefined;\n if (this.port !== undefined) {\n port = Number(this.port);\n if (!/^\\d+$/.test(this.port) || !Number.isInteger(port) || port < 0 || port > 65_535) {\n this.context.stderr.write(\n `vela studio: --port must be a decimal integer 0-65535, got: ${this.port}\\n`,\n );\n return 1;\n }\n }\n\n const adminToken = this.token ?? process.env.VELA_STUDIO_TOKEN;\n\n let host: StudioHostModule;\n try {\n host = (await import(HOST_PACKAGE)) as StudioHostModule;\n } catch (error) {\n if (isModuleNotFound(error, HOST_PACKAGE)) {\n this.context.stderr.write(\n `vela studio needs the optional \"${HOST_PACKAGE}\" package, which isn't installed.\\n` +\n ` Install it: pnpm add -D ${HOST_PACKAGE}\\n` +\n ` (it also needs the prebuilt UI: pnpm add -D @velajs/studio-ui)\\n`,\n );\n return 1;\n }\n throw error;\n }\n\n const server = await host.startStudioServer({\n workerOrigin,\n adminToken,\n port,\n adminPath: this.adminPath,\n cwd: process.cwd(),\n });\n\n this.context.stdout.write(\n `\\n Vela Studio ${server.url}\\n` +\n ` Proxying ${workerOrigin}${this.adminPath ?? '/_vela/admin'}/*\\n` +\n ` Admin token ${adminToken !== undefined ? 'set (injected server-side)' : 'none (app requires none)'}\\n\\n` +\n ' Press Ctrl+C to stop.\\n',\n );\n\n // Run until interrupted. The listener is removed on trigger so a second\n // Ctrl+C during shutdown falls through to Node's default (force-exit).\n await new Promise<void>((resolvePromise) => {\n const onSignal = (): void => {\n process.off('SIGINT', onSignal);\n process.off('SIGTERM', onSignal);\n resolvePromise();\n };\n process.on('SIGINT', onSignal);\n process.on('SIGTERM', onSignal);\n });\n\n await server.close();\n this.context.stdout.write('\\nVela Studio stopped.\\n');\n return 0;\n }\n}\n","import { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { dirname } from 'node:path';\nimport { createOpenApiDocument } from '@velajs/vela';\nimport type { OpenApiDocument } from '@velajs/vela';\nimport { Command, Option } from 'clipanion';\nimport { generateClientContract } from '../client-contract.js';\nimport { loadConfig } from '../config.js';\nimport { withApp } from '../with-app.js';\n\nexport class ClientGenerateCommand extends Command {\n static override paths = [['client', 'generate']];\n static override usage = Command.Usage({\n category: 'Client',\n description: \"Generate a typed HTTP contract for Hono's hc client.\",\n details:\n 'Uses rootModule and createApp from vela.config, or an OpenAPI JSON file with --input. Missing schemas emit unknown and a warning; --strict makes those warnings an error.',\n examples: [\n ['Generate from an app', 'vela client generate --out src/api.generated.ts'],\n [\n 'Generate from a document',\n 'vela client generate --input openapi.json --out src/api.generated.ts',\n ],\n ['Check a committed contract', 'vela client generate --out src/api.generated.ts --check'],\n ],\n });\n\n config = Option.String('--config', { description: 'Path to the vela config file.' });\n input = Option.String('--input', {\n description: 'Read an OpenAPI JSON file without bootstrapping the app.',\n });\n out = Option.String('--out', { description: 'Output TypeScript file (stdout when omitted).' });\n check = Option.Boolean('--check', false, {\n description: 'Fail if --out differs from the generated contract; do not write.',\n });\n strict = Option.Boolean('--strict', false, { description: 'Fail on missing or lossy schemas.' });\n\n async execute(): Promise<number> {\n if (this.input && this.config) throw new Error('Use either --input or --config, not both.');\n if (this.check && !this.out) throw new Error('--check requires --out.');\n const document = this.input ? await this.#readDocument(this.input) : await this.#fromApp();\n const { source, warnings } = generateClientContract(document);\n for (const warning of warnings) this.context.stderr.write(`Warning: ${warning}\\n`);\n if (this.strict && warnings.length) return 1;\n if (this.check) {\n let existing: string | undefined;\n try {\n existing = await readFile(this.out!, 'utf8');\n } catch (error) {\n if (!(error instanceof Error) || !('code' in error) || error.code !== 'ENOENT') throw error;\n }\n if (existing !== source) {\n this.context.stderr.write(\n `Client contract is missing or stale: ${this.out}. Run vela client generate without --check.\\n`,\n );\n return 1;\n }\n } else if (this.out) {\n await mkdir(dirname(this.out), { recursive: true });\n await writeFile(this.out, source, 'utf8');\n this.context.stdout.write(`Wrote ${this.out}\\n`);\n } else {\n this.context.stdout.write(source);\n }\n return 0;\n }\n\n async #readDocument(file: string): Promise<unknown> {\n const value: unknown = JSON.parse(await readFile(file, 'utf8'));\n // generateClientContract validates the complete consumed projection for\n // both file inputs and documents produced by the running application.\n return value;\n }\n\n async #fromApp(): Promise<OpenApiDocument> {\n const config = await loadConfig(process.cwd(), this.config);\n if (!config.rootModule)\n throw new Error(\n 'client generate needs rootModule in vela.config, or pass --input openapi.json.',\n );\n const rootModule = config.rootModule;\n return withApp(\n config,\n async (app) => {\n const document = createOpenApiDocument(rootModule, {\n globalPrefix: app.getGlobalPrefix(),\n });\n // Detect older Vela exporters which omit versioned controller routes.\n // Never silently ship a contract which points at a different endpoint.\n for (const route of app.describeRoutes()) {\n const path = route.path.replace(/:([A-Za-z_][A-Za-z0-9_]*)/g, '{$1}');\n const item = document.paths[path];\n if (!item || !Object.hasOwn(item, route.method.toLowerCase())) {\n throw new Error(\n `OpenAPI is missing ${route.method} ${route.path}. Update Vela or pass a complete document with --input.`,\n );\n }\n }\n return document;\n },\n (message) => this.context.stderr.write(`${message}\\n`),\n );\n }\n}\n","import { lstat, mkdir, open, readFile, readdir, rmdir, unlink, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { UsageError } from 'clipanion';\n\nconst template = new URL('../templates/worker/', import.meta.url);\nconst files = [\n 'package.json',\n 'pnpm-workspace.yaml',\n 'tsconfig.json',\n '.swcrc',\n 'wrangler.jsonc',\n 'vela.config.mjs',\n 'gitignore',\n 'README.md',\n 'src/worker.ts',\n 'src/app.module.ts',\n 'src/app.controller.ts',\n 'src/app.service.ts',\n] as const;\n\nfunction hasCode(error: unknown, code: string): boolean {\n return error instanceof Error && 'code' in error && error.code === code;\n}\n\nexport async function createProject(name: string, cwd: string): Promise<string> {\n if (\n name.length > 63 ||\n name !== name.trim() ||\n !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(name) ||\n /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/.test(name)\n ) {\n throw new UsageError(\n 'Use a project name of at most 63 lowercase letters, digits, and single hyphens, starting with a letter. Paths and reserved device names are not supported.',\n );\n }\n\n // Read the entire packaged template before touching the destination.\n const contents = await Promise.all(\n files.map(async (file) => ({\n file: file === 'gitignore' ? '.gitignore' : file,\n content: (await readFile(new URL(file, template), 'utf8')).replaceAll(\n '__PROJECT_NAME__',\n name,\n ),\n })),\n );\n const destination = join(cwd, name);\n const directories: string[] = [];\n const written: string[] = [];\n try {\n try {\n await mkdir(destination);\n directories.push(destination);\n } catch (error) {\n if (!hasCode(error, 'EEXIST')) throw error;\n const stat = await lstat(destination);\n if (stat.isSymbolicLink() || !stat.isDirectory()) {\n throw new UsageError(`Destination is not a regular directory: ${destination}`);\n }\n if ((await readdir(destination)).length) {\n throw new UsageError(\n `Destination is not empty: ${destination}. Choose a new project name.`,\n );\n }\n }\n const source = join(destination, 'src');\n await mkdir(source);\n directories.push(source);\n for (const { file, content } of contents) {\n const path = join(destination, file);\n // Never overwrite a file, even if it appeared after the initial check.\n const handle = await open(path, 'wx');\n written.push(path);\n try {\n await writeFile(handle, content, 'utf8');\n } finally {\n await handle.close();\n }\n }\n } catch (error) {\n // Only undo our own writes; rmdir leaves directories containing other files intact.\n for (const path of written.toReversed()) await unlink(path).catch(() => {});\n for (const path of directories.toReversed()) await rmdir(path).catch(() => {});\n throw error;\n }\n return destination;\n}\n","import { Command, Option } from 'clipanion';\nimport { createProject } from '../new-project.js';\n\nexport class NewCommand extends Command {\n static override paths = [['new']];\n static override usage = Command.Usage({\n category: 'Project',\n description: 'Create a minimal Vela application for Cloudflare Workers.',\n details:\n 'Creates a directory in the current working directory. An existing directory must be empty. Dependencies are installed separately with pnpm install.',\n examples: [['Create an API', 'vela new my-api']],\n });\n\n name = Option.String({ name: 'name', required: true });\n\n async execute(): Promise<number> {\n await createProject(this.name, process.cwd());\n this.context.stdout.write(\n `Created ${this.name}.\\n\\nNext steps:\\n cd ${this.name}\\n pnpm install\\n pnpm typecheck\\n pnpm build\\n pnpm dev\\n\\nThen visit http://localhost:8787 or run: curl http://localhost:8787\\n`,\n );\n return 0;\n }\n}\n","import { describeToken } from '@velajs/vela';\nimport type { VelaApplication } from '@velajs/vela';\nimport { Command, Option } from 'clipanion';\nimport { loadConfig, resolveConfig } from '../config.js';\nimport type { ConfigResolution } from '../config.js';\nimport { collectModules, collectRoutes } from '../introspect.js';\nimport { withApp } from '../with-app.js';\n\n/** Read only app-owned description APIs; never resolve providers or serialize their values. */\nfunction describeApplication(app: VelaApplication) {\n return {\n globalPrefix: app.getGlobalPrefix(),\n modules: collectModules(app),\n routes: collectRoutes(app),\n entrypoints: app.entrypoints.kinds().flatMap((kind) =>\n app.entrypoints.ofKind(kind).map((entry) => ({\n kind,\n target: `${describeToken(entry.token)}${entry.methodName === undefined ? '' : `#${String(entry.methodName)}`}`,\n ...('moduleId' in entry && typeof entry.moduleId === 'string'\n ? { moduleId: entry.moduleId }\n : {}),\n })),\n ),\n };\n}\n\ninterface DoctorReport {\n schemaVersion: 1;\n cwd: string;\n nodeVersion: string;\n config: ConfigResolution | null;\n application?: ReturnType<typeof describeApplication>;\n issues: string[];\n}\n\nexport class DoctorCommand extends Command {\n static override paths = [['doctor']];\n static override usage = Command.Usage({\n category: 'Introspection',\n description: 'Explain config resolution and optionally inspect the application graph.',\n details:\n 'Checks config file resolution without importing it. --app opts into config import and application bootstrap, ' +\n 'then reads app-local module, route and entrypoint snapshots and disposes the app. ' +\n 'No files are written, providers are not resolved by the snapshot, and entrypoint metadata is omitted.',\n examples: [\n ['Explain config selection', 'vela doctor --json'],\n ['Inspect a built app', 'vela doctor --app --config vela.config.mjs --json'],\n ],\n });\n\n config = Option.String('--config', { description: 'Path to the Vela config file.' });\n app = Option.Boolean('--app', false, {\n description: 'Import config, bootstrap the app and inspect its graph.',\n });\n json = Option.Boolean('--json', false, { description: 'Emit machine-readable diagnostics.' });\n\n async execute(): Promise<number> {\n const report: DoctorReport = {\n schemaVersion: 1,\n cwd: process.cwd(),\n nodeVersion: process.versions.node,\n config: null,\n issues: [],\n };\n try {\n report.config = await resolveConfig(report.cwd, this.config);\n if (this.app) {\n const config = await loadConfig(report.cwd, report.config.path);\n report.application = await withApp(config, describeApplication, (message) => {\n report.issues.push(message);\n });\n }\n } catch (error) {\n report.issues.push(error instanceof Error ? error.message : String(error));\n }\n\n if (this.json) {\n this.context.stdout.write(`${JSON.stringify(report, null, 2)}\\n`);\n } else {\n this.context.stdout.write(`Node ${report.nodeVersion}\\nWorking directory: ${report.cwd}\\n`);\n if (report.config) {\n this.context.stdout.write(`Config: ${report.config.path} (${report.config.source})\\n`);\n for (const candidate of report.config.candidates)\n this.context.stdout.write(` Checked: ${candidate}\\n`);\n }\n if (report.application) {\n const { modules, routes, entrypoints } = report.application;\n this.context.stdout.write(\n `Application: ${modules.length} modules, ${routes?.length ?? 0} routes, ${entrypoints.length} entrypoints\\n`,\n );\n this.context.stdout.write('Use --json for the full graph.\\n');\n } else if (!this.app) {\n this.context.stdout.write(\n 'Config was not imported. Use --app to bootstrap and inspect a built application.\\n',\n );\n }\n for (const issue of report.issues) this.context.stderr.write(`${issue}\\n`);\n }\n return report.issues.length ? 1 : 0;\n }\n}\n","import { extname } from 'node:path';\nimport { parse, type ParseError } from 'jsonc-parser';\nimport { parse as parseToml } from 'smol-toml';\nimport { z } from 'zod';\n\nconst record = z.record(z.string(), z.unknown());\nconst text = z\n .string()\n .min(1)\n .refine((value) => value.trim() === value && !/\\p{Cc}/u.test(value));\nconst bindingName = text.regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/u);\nconst workerName = text.max(255).regex(/^[a-zA-Z0-9-]+$/u);\nconst date = z\n .string()\n .regex(/^\\d{4}-\\d{2}-\\d{2}$/u)\n .refine((value) => {\n const parsed = new Date(value);\n return Number.isFinite(parsed.getTime()) && parsed.toISOString().slice(0, 10) === value;\n });\n\n/** Decode only data; parser errors deliberately omit configuration values. */\nexport function parseDeploymentConfig(source: string, path: string): unknown {\n const extension = extname(path).toLowerCase();\n if (extension === '.toml') {\n try {\n return parseToml(source);\n } catch {\n throw new Error('Invalid Wrangler TOML configuration.');\n }\n }\n if (extension !== '.json' && extension !== '.jsonc') {\n throw new Error('Wrangler configuration must be a .json, .jsonc or .toml file.');\n }\n const errors: ParseError[] = [];\n const result: unknown = parse(source, errors, {\n allowTrailingComma: extension === '.jsonc',\n disallowComments: extension === '.json',\n });\n if (errors.length > 0) throw new Error('Invalid Wrangler JSON configuration.');\n return result;\n}\n\nfunction checked<T>(schema: z.ZodType<T>, value: unknown, field: string): T {\n const result = schema.safeParse(value);\n if (!result.success) throw new Error(`Invalid Wrangler field: ${field}.`);\n return result.data;\n}\n\nexport interface DeploymentBinding {\n readonly name: string;\n readonly kind: string;\n}\n\nexport interface DeploymentTarget {\n readonly environment: string;\n readonly worker: string;\n readonly main: string | null;\n readonly compatibilityDate: string;\n readonly compatibilityFlags: readonly string[];\n readonly crons: readonly string[];\n readonly bindings: readonly DeploymentBinding[];\n readonly queueConsumers: readonly string[];\n readonly customBuild: boolean;\n}\n\n/** A projection, not a replacement for Wrangler's full configuration validator. */\nexport function selectDeploymentTarget(raw: unknown, environment: string): DeploymentTarget {\n if (!/^[A-Za-z0-9][A-Za-z0-9_-]*$/u.test(environment)) {\n throw new Error(\n 'An explicit environment name using letters, digits, underscores or dashes is required.',\n );\n }\n const root = checked(record, raw, 'configuration');\n const environments = checked(record, root.env, 'env');\n if (!Object.hasOwn(environments, environment))\n throw new Error('The requested environment is not declared in Wrangler configuration.');\n const selected = checked(record, environments[environment], `env.${environment}`);\n const inherit = (key: string): unknown =>\n Object.hasOwn(selected, key) ? selected[key] : root[key];\n // Wrangler appends the environment when the named environment omits name.\n const worker = checked(\n workerName,\n Object.hasOwn(selected, 'name')\n ? selected.name\n : `${checked(workerName, root.name, 'name')}-${environment}`,\n 'name',\n );\n const main = checked(text.optional(), inherit('main'), 'main') ?? null;\n if (main === null) {\n const assets = checked(record, inherit('assets'), 'assets (required without main)');\n checked(text, assets.directory, 'assets.directory');\n }\n const compatibilityDate = checked(date, inherit('compatibility_date'), 'compatibility_date');\n const compatibilityFlags =\n checked(z.array(text).optional(), inherit('compatibility_flags'), 'compatibility_flags') ?? [];\n const triggers = checked(\n z.object({ crons: z.array(text) }).optional(),\n inherit('triggers'),\n 'triggers',\n );\n const build = checked(\n z.object({ command: text.optional() }).optional(),\n inherit('build'),\n 'build',\n );\n const bindings: DeploymentBinding[] = [];\n const names = new Set<string>();\n const add = (name: string, kind: string): void => {\n if (names.has(name)) throw new Error(`Duplicate Worker binding name: ${name}.`);\n names.add(name);\n bindings.push({ name, kind });\n };\n // Resource bindings and vars are NOT inherited by a named environment.\n const variables = checked(record.optional(), selected.vars, 'vars') ?? {};\n for (const name of Object.keys(variables))\n add(checked(bindingName, name, 'vars binding name'), 'var');\n for (const kind of [\n 'kv_namespaces',\n 'd1_databases',\n 'r2_buckets',\n 'services',\n 'hyperdrive',\n 'vectorize',\n 'workflows',\n 'analytics_engine_datasets',\n ]) {\n const rows = checked(z.array(record).optional(), selected[kind], kind) ?? [];\n for (const row of rows) {\n add(checked(bindingName, row.binding, `${kind}.binding`), kind);\n // Omitted IDs are supported by Wrangler auto-provisioning. Never print IDs/values.\n for (const field of ['id', 'database_id', 'database_name', 'bucket_name']) {\n if (Object.hasOwn(row, field)) checked(text, row[field], `${kind}.${field}`);\n }\n if (kind === 'services') checked(workerName, row.service, 'services.service');\n if (kind === 'workflows') checked(text, row.class_name, 'workflows.class_name');\n }\n }\n const durable = checked(\n z\n .object({\n bindings: z.array(\n z.object({\n name: bindingName,\n class_name: text,\n script_name: workerName.optional(),\n }),\n ),\n })\n .optional(),\n selected.durable_objects,\n 'durable_objects',\n );\n for (const row of durable?.bindings ?? []) add(row.name, 'durable_objects');\n const queues = checked(\n z\n .object({\n producers: z.array(z.object({ binding: bindingName, queue: text.optional() })).optional(),\n consumers: z.array(z.object({ queue: text })).optional(),\n })\n .optional(),\n selected.queues,\n 'queues',\n );\n for (const producer of queues?.producers ?? []) add(producer.binding, 'queues');\n const queueConsumers = queues?.consumers?.map((row) => row.queue) ?? [];\n if (new Set(queueConsumers).size !== queueConsumers.length)\n throw new Error('Duplicate queue consumer configuration.');\n return {\n environment,\n worker,\n main,\n compatibilityDate,\n compatibilityFlags,\n crons: triggers?.crons ?? [],\n bindings,\n queueConsumers,\n customBuild: build?.command !== undefined,\n };\n}\n","import { parseCron, parseCronMetadata } from '@velajs/vela';\nimport { z } from 'zod';\nimport { selectDeploymentTarget, type DeploymentTarget } from './deploy-check.config.js';\n\nexport interface DeploymentIssue {\n readonly code: string;\n readonly message: string;\n}\n\nconst rowsSchema = z.array(\n z.object({ kind: z.string().min(1), target: z.string().min(1), meta: z.unknown() }),\n);\nconst metadataSchema = z.record(z.string(), z.unknown());\n\n/** Accept existing `vela entrypoint list --json` output without loading an application. */\nfunction entrypoints(value: unknown) {\n const parsed = rowsSchema.safeParse(value);\n if (!parsed.success)\n throw new Error('Entrypoint snapshot must be an array of { kind, target, meta } rows.');\n return parsed.data\n .filter((row) => !(row.target === '(no entrypoints)' && row.meta === ''))\n .map((row) => {\n let meta: unknown = row.meta;\n if (typeof meta === 'string') {\n try {\n meta = JSON.parse(meta);\n } catch {\n throw new Error('Invalid JSON metadata in entrypoint snapshot.');\n }\n }\n // Unknown kinds can contain arbitrary metadata; known ones validate below.\n return { kind: row.kind, meta };\n });\n}\n\nexport interface DeploymentPlan {\n readonly status: 'passed' | 'failed';\n readonly target: DeploymentTarget;\n readonly errors: readonly DeploymentIssue[];\n readonly warnings: readonly DeploymentIssue[];\n}\n\n/** Compare literal dispatch keys; equivalent cron expressions are not interchangeable. */\nexport function checkDeployment(\n rawConfig: unknown,\n environment: string,\n snapshot: unknown,\n): DeploymentPlan {\n const target = selectDeploymentTarget(rawConfig, environment);\n const errors: DeploymentIssue[] = [];\n const warnings: DeploymentIssue[] = [];\n const report = (code: string, message: string) => errors.push({ code, message });\n const validateCron = (cron: string): void => {\n if (!parseCron(cron, { dialect: 'cloudflare', timeZone: 'UTC' })) {\n report('invalid-cron', 'A trigger or handler has an invalid Cloudflare cron expression.');\n }\n };\n const crons = new Set(target.crons);\n if (crons.size !== target.crons.length)\n report('duplicate-cron', 'Duplicate cron trigger configuration.');\n for (const cron of crons) validateCron(cron);\n const handlerCrons = new Set<string>();\n const handlerQueues = new Set<string>();\n for (const row of entrypoints(snapshot)) {\n if (row.kind === 'schedule:interval') {\n report(\n 'unsupported-interval',\n 'Workers cannot drive @Interval handlers; use a scheduled trigger or a separate Node adapter.',\n );\n continue;\n }\n if (\n ![\n 'cf:scheduled',\n 'cf:vela-cron',\n 'schedule:cron',\n 'cf:queue',\n 'cf:queue:module',\n 'cf:queue:producer',\n 'rpc:client',\n 'websocket',\n ].includes(row.kind)\n )\n continue;\n const parsed = metadataSchema.safeParse(row.meta);\n if (!parsed.success) {\n report('invalid-metadata', `Invalid ${row.kind} metadata.`);\n continue;\n }\n const meta = parsed.data;\n if (row.kind === 'cf:queue:producer' || row.kind === 'rpc:client') {\n // HTTP RPC clients need no Worker binding; declared bindings are mandatory.\n if (row.kind === 'rpc:client' && meta.binding === undefined) continue;\n const binding = meta.binding;\n const kind = row.kind === 'rpc:client' ? 'services' : 'queues';\n if (\n typeof binding !== 'string' ||\n !binding ||\n !target.bindings.some((b) => b.name === binding && b.kind === kind)\n ) {\n report(\n row.kind === 'rpc:client' ? 'missing-service-binding' : 'missing-queue-producer',\n `A declared ${kind} binding is missing from the selected environment.`,\n );\n }\n continue;\n }\n if (\n row.kind === 'cf:queue:module' &&\n (typeof meta.logicalQueue !== 'string' || !meta.logicalQueue.trim())\n ) {\n report('invalid-queue-mapping', 'A native consumer mapping requires a logical queue name.');\n continue;\n }\n if (row.kind === 'cf:vela-cron' || row.kind === 'schedule:cron') {\n try {\n const cron = parseCronMetadata(meta);\n if (\n (cron.dialect !== undefined && cron.dialect !== 'cloudflare') ||\n (cron.timeZone !== undefined && cron.timeZone !== 'UTC')\n ) {\n report(\n 'incompatible-cron-options',\n 'A cron handler explicitly requests options incompatible with Cloudflare UTC delivery.',\n );\n }\n } catch {\n report('invalid-metadata', `Invalid ${row.kind} metadata.`);\n continue;\n }\n }\n if (row.kind === 'websocket') {\n // WsDispatcher contributes { options, ... }; raw class metadata is options itself.\n const options = Object.hasOwn(meta, 'options')\n ? metadataSchema.safeParse(meta.options)\n : parsed;\n const binding = options.success ? options.data.binding : undefined;\n if (\n typeof binding !== 'string' ||\n !target.bindings.some((b) => b.kind === 'durable_objects' && b.name === binding)\n ) {\n report(\n 'missing-durable-binding',\n 'A WebSocket gateway requires a Durable Object binding in the selected environment.',\n );\n }\n continue;\n }\n const key =\n row.kind === 'cf:scheduled'\n ? 'cron'\n : row.kind.startsWith('cf:queue')\n ? 'queueName'\n : 'expression';\n const value = meta[key];\n if (typeof value !== 'string' || value.trim().length === 0) {\n report('invalid-metadata', `Invalid ${row.kind}.${key} metadata.`);\n continue;\n }\n if (row.kind.startsWith('cf:queue')) handlerQueues.add(value);\n else {\n handlerCrons.add(value);\n validateCron(value);\n }\n }\n for (const cron of handlerCrons)\n if (!crons.has(cron))\n report(\n 'missing-cron-trigger',\n `No exact Wrangler trigger for handler cron ${JSON.stringify(cron)}.`,\n );\n for (const cron of crons)\n if (!handlerCrons.has(cron))\n report(\n 'unhandled-cron-trigger',\n `No metadata handler for Wrangler cron ${JSON.stringify(cron)}.`,\n );\n for (const queue of handlerQueues)\n if (!target.queueConsumers.includes(queue))\n report(\n 'missing-queue-consumer',\n `No selected queue consumer for handler queue ${JSON.stringify(queue)}.`,\n );\n for (const queue of target.queueConsumers)\n if (!handlerQueues.has(queue))\n report(\n 'unhandled-queue-consumer',\n `No metadata handler for selected queue ${JSON.stringify(queue)}.`,\n );\n warnings.push({\n code: 'static-only',\n message:\n 'Snapshot freshness, custom platform handlers, deployed resources, secrets and bundle/runtime behavior are not verified. Run Wrangler and native tests separately.',\n });\n if (target.customBuild)\n warnings.push({\n code: 'custom-build',\n message: 'Wrangler has a custom build command. It was not executed by this check.',\n });\n return { status: errors.length ? 'failed' : 'passed', target, errors, warnings };\n}\n","import { execFile } from 'node:child_process';\nimport { createHash } from 'node:crypto';\nimport { open } from 'node:fs/promises';\nimport { dirname, resolve } from 'node:path';\nimport { promisify } from 'node:util';\nimport { Command, Option } from 'clipanion';\nimport { parseDeploymentConfig } from './deploy-check.config.js';\nimport { checkDeployment } from './deploy-check.plan.js';\n\nconst exec = promisify(execFile);\nconst MAX_INPUT_BYTES = 1024 * 1024;\n\nasync function readInput(path: string): Promise<string> {\n const file = await open(path, 'r');\n try {\n if (!(await file.stat()).isFile()) throw new Error('Input must be a regular file.');\n const buffer = Buffer.alloc(MAX_INPUT_BYTES + 1);\n let length = 0;\n while (length < buffer.length) {\n // eslint-disable-next-line no-await-in-loop -- Each offset depends on the preceding partial read.\n const { bytesRead } = await file.read(buffer, length, buffer.length - length, length);\n if (bytesRead === 0) break;\n length += bytesRead;\n }\n if (length > MAX_INPUT_BYTES) throw new Error('Deployment inputs must not exceed 1 MiB.');\n return buffer.subarray(0, length).toString('utf8');\n } finally {\n await file.close();\n }\n}\n\nasync function gitProvenance(cwd: string) {\n try {\n const options = { cwd, timeout: 5000, maxBuffer: 1024 * 1024 };\n const [head, status] = await Promise.all([\n exec('git', ['rev-parse', '--verify', 'HEAD'], options),\n exec(\n 'git',\n [\n '--no-optional-locks',\n '-c',\n 'core.fsmonitor=false',\n 'status',\n '--porcelain=v1',\n '--untracked-files=normal',\n ],\n options,\n ),\n ]);\n const commit = head.stdout.trim();\n if (!/^[a-f0-9]{40,64}$/u.test(commit)) throw new Error('Invalid git commit.');\n return { commit, dirty: status.stdout.length > 0 };\n } catch {\n return { commit: null, dirty: null };\n }\n}\n\nconst digest = (text: string): string => createHash('sha256').update(text).digest('hex');\n\n/** Static application deployment preflight; never invokes Wrangler or application code. */\nexport class DeployCheckCommand extends Command {\n static override paths = [['deploy', 'check']];\n static override usage = Command.Usage({\n category: 'Deployment',\n description: 'Check an explicit Wrangler target against a saved entrypoint snapshot.',\n details:\n 'Read-only: no app bootstrap, custom build, credential loading or upload. Compares cron/queue dispatch keys and WebSocket Durable Object bindings. Wrangler remains the deployment tool.',\n examples: [\n [\n 'Check staging',\n 'vela deploy check --config wrangler.jsonc --env staging --entrypoints entrypoints.json',\n ],\n ],\n });\n\n config = Option.String('--config', {\n required: true,\n description: 'Explicit Wrangler .json/.jsonc/.toml file.',\n });\n environment = Option.String('--env', {\n required: true,\n description: 'Exact named environment in the Wrangler file.',\n });\n entrypoints = Option.String('--entrypoints', {\n required: true,\n description: 'Saved vela entrypoint list --json array.',\n });\n json = Option.Boolean('--json', false, { description: 'Emit the redacted report as JSON.' });\n\n async execute(): Promise<number> {\n try {\n if (!this.config.trim() || !this.entrypoints.trim())\n throw new Error('Explicit configuration and snapshot paths are required.');\n const configPath = resolve(this.config);\n const snapshotPath = resolve(this.entrypoints);\n const [config, snapshot] = await Promise.all([\n readInput(configPath),\n readInput(snapshotPath),\n ]);\n let rows: unknown;\n try {\n rows = JSON.parse(snapshot);\n } catch {\n throw new Error('Invalid entrypoint snapshot JSON.');\n }\n const plan = checkDeployment(\n parseDeploymentConfig(config, configPath),\n this.environment,\n rows,\n );\n const provenance = {\n ...(await gitProvenance(dirname(configPath))),\n checkedAt: new Date().toISOString(),\n config: { path: configPath, sha256: digest(config) },\n entrypoints: { path: snapshotPath, sha256: digest(snapshot) },\n };\n const wrangler = {\n command: 'pnpm',\n args: [\n 'exec',\n 'wrangler',\n 'deploy',\n '--config',\n configPath,\n '--env',\n this.environment,\n '--dry-run',\n ],\n };\n const result = { ...plan, provenance, nextStep: wrangler };\n if (this.json) this.context.stdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n else {\n this.context.stdout.write(\n `Deployment check: ${plan.status}\\nWorker: ${plan.target.worker}\\nEnvironment: ${plan.target.environment}\\nConfig: ${configPath}\\nCommit: ${provenance.commit ?? 'unavailable'} (${provenance.dirty === null ? 'cleanliness unknown' : provenance.dirty ? 'dirty' : 'clean'})\\nConfig SHA-256: ${provenance.config.sha256}\\nSnapshot SHA-256: ${provenance.entrypoints.sha256}\\nBindings: ${plan.target.bindings.map((binding) => `${binding.name} (${binding.kind})`).join(', ') || '(none)'}\\n`,\n );\n for (const issue of plan.errors)\n this.context.stdout.write(`Error [${issue.code}]: ${issue.message}\\n`);\n for (const issue of plan.warnings)\n this.context.stdout.write(`Warning [${issue.code}]: ${issue.message}\\n`);\n this.context.stdout.write(\n `Next step (not executed): ${[wrangler.command, ...wrangler.args].map((arg) => `'${arg.replaceAll(\"'\", \"'\\\\''\")}'`).join(' ')}\\n`,\n );\n }\n return plan.status === 'passed' ? 0 : 1;\n } catch (error) {\n // Filesystem errors contain paths, not file contents; parser/schema errors are sanitized above.\n const message = error instanceof Error ? error.message : 'Deployment check failed.';\n if (this.json)\n this.context.stdout.write(`${JSON.stringify({ status: 'failed', error: message })}\\n`);\n else this.context.stderr.write(`${message}\\n`);\n return 1;\n }\n }\n}\n","#!/usr/bin/env node\nimport { Builtins, Cli } from 'clipanion';\nimport manifest from '../package.json' with { type: 'json' };\nimport {\n EntrypointListCommand,\n ModuleGraphCommand,\n OpenApiDumpCommand,\n RouteListCommand,\n} from './commands/introspect.commands.js';\nimport { McpServeCommand } from './commands/mcp.command.js';\nimport { SeedCommand } from './commands/seed.command.js';\nimport { StudioCommand } from './commands/studio.command.js';\nimport { ClientGenerateCommand } from './commands/client.command.js';\nimport { NewCommand } from './commands/new.command.js';\nimport { DoctorCommand } from './commands/doctor.command.js';\nimport { DeployCheckCommand } from './commands/deploy-check.command.js';\n\nconst cli = new Cli({\n binaryName: 'vela',\n binaryLabel: 'Vela CLI',\n binaryVersion: manifest.version,\n});\n\ncli.register(Builtins.HelpCommand);\ncli.register(Builtins.VersionCommand);\ncli.register(NewCommand);\ncli.register(SeedCommand);\ncli.register(RouteListCommand);\ncli.register(ModuleGraphCommand);\ncli.register(EntrypointListCommand);\ncli.register(OpenApiDumpCommand);\ncli.register(McpServeCommand);\ncli.register(StudioCommand);\ncli.register(ClientGenerateCommand);\ncli.register(DoctorCommand);\ncli.register(DeployCheckCommand);\n\nvoid cli.runExit(process.argv.slice(2));\n\nexport { SeedCommand } from './commands/seed.command.js';\nexport { NewCommand } from './commands/new.command.js';\nexport {\n EntrypointListCommand,\n ModuleGraphCommand,\n OpenApiDumpCommand,\n RouteListCommand,\n} from './commands/introspect.commands.js';\nexport { McpServeCommand } from './commands/mcp.command.js';\nexport { StudioCommand } from './commands/studio.command.js';\nexport { ClientGenerateCommand } from './commands/client.command.js';\nexport { DoctorCommand } from './commands/doctor.command.js';\nexport { DeployCheckCommand } from './commands/deploy-check.command.js';\nexport { generateClientContract } from './client-contract.js';\nexport type { GeneratedClientContract } from './client-contract.js';\nexport {\n collectRoutes,\n collectModules,\n collectEntrypoints,\n renderModuleTree,\n} from './introspect.js';\nexport type { RouteRow, EntrypointRow } from './introspect.js';\nexport { renderTable } from './format.js';\nexport { loadConfig, defineVelaConfig, resolveConfig } from './config.js';\nexport type { VelaConfig, ConfigResolution } from './config.js';\nexport { formatSeedResults } from './format.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;ACIA,eAAsB,QACpB,QACA,MACA,MACiB;CACjB,MAAM,MAAM,MAAM,OAAO,UAAU;CACnC,MAAM,UAAU,UAAyB;EACvC,IAAI;GACF,KAAK,6BAA6B,OAAO,KAAK,GAAG;EACnD,QAAQ,CAER;CACF;CACA,IAAI;EACF,OAAO,MAAM,KAAK,GAAG;CACvB,UAAU;EACR,IAAI;GAEF,IAAI,OAAO,IAAI,YAAY,YAAY,MAAM,IAAI,QAAQ;QACpD,MAAM,IAAI,aAAa,CAAC,CAAC,QAAQ;EACxC,SAAS,OAAO;GACd,OAAO,KAAK;GAGZ,IAAI;IACF,MAAM,IAAI,aAAa,CAAC,CAAC,QAAQ;GACnC,SAAS,cAAc;I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,MAAM,MAAM,IAAI,IAAI;CAClB,YAAY;CACZ,aAAa;CACb,eAAeC;AACjB,CAAC;AAED,IAAI,SAAS,SAAS,WAAW;AACjC,IAAI,SAAS,SAAS,cAAc;AACpC,IAAI,SAAS,UAAU;AACvB,IAAI,SAAS,WAAW;AACxB,IAAI,SAAS,gBAAgB;AAC7B,IAAI,SAAS,kBAAkB;AAC/B,IAAI,SAAS,qBAAqB;AAClC,IAAI,SAAS,kBAAkB;AAC/B,IAAI,SAAS,eAAe;AAC5B,IAAI,SAAS,aAAa;AAC1B,IAAI,SAAS,qBAAqB;AAClC,IAAI,SAAS,aAAa;AAC1B,IAAI,SAAS,kBAAkB;AAE1B,IAAI,QAAQ,QAAQ,KAAK,MAAM,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velajs/cli",
3
- "version": "1.26.1",
3
+ "version": "1.28.0",
4
4
  "description": "CLI for Vela apps — seeding and project tasks (Node-side; not bundled into the edge Worker)",
5
5
  "keywords": [
6
6
  "cli",
@@ -68,10 +68,10 @@
68
68
  "unplugin-swc": "1.5.9",
69
69
  "vitest": "4.1.10",
70
70
  "@velajs/client": "1.25.0",
71
- "@velajs/vela": "1.27.0"
71
+ "@velajs/vela": "1.28.0"
72
72
  },
73
73
  "peerDependencies": {
74
- "@velajs/vela": "^1.27.0"
74
+ "@velajs/vela": "^1.28.0"
75
75
  },
76
76
  "optionalDependencies": {
77
77
  "@velajs/studio-host": "1.22.2"