Skip to content

The Open Standard for Generative UI

cli: add openui deploy for Vercel (#1154)

ABb9d863275444
diff --git a/docs/content/docs/api-reference/cli.mdx b/docs/content/docs/api-reference/cli.mdx
index 12efba446..6ce29b169 100644
--- a/docs/content/docs/api-reference/cli.mdx
+++ b/docs/content/docs/api-reference/cli.mdx
@@ -1,9 +1,9 @@
---
title: "@openuidev/cli"
-description: API reference for the OpenUI CLI to scaffold apps, mint Gateway API keys, and generate system prompts or library specs.
+description: API reference for the OpenUI CLI to scaffold apps, mint Gateway API keys, and generate system prompts or library specs, and deploy projects.
---
-A command-line tool for scaffolding OpenUI chat apps, minting OpenUI Gateway API keys, and generating system prompts, JSON schemas, or serialized library specs from library definitions.
+A command-line tool for scaffolding OpenUI chat apps, minting OpenUI Gateway API key, and generating system prompts, JSON schemas, or serialized library specs from library definitions, and deploying those apps.
## Installation
@@ -212,6 +212,77 @@ npx @openuidev/cli@latest create --name my-app --skill
npx @openuidev/cli@latest create --name my-app --no-skill
```
+## `deploy`
+
+Deploys an OpenUI project. The default supported platform is **Vercel**.
+
+```
+openui deploy [dir] [options]
+```
+
+**Arguments**
+
+| Argument | Description |
+| -------- | ---------------------------------------------- |
+| `[dir]` | Project directory (default: current directory) |
+
+**Options**
+
+| Flag | Description |
+| --------------------- | --------------------------------------------------------------------------- |
+| `-y, --yes` | Skip confirmation prompts (also saves missing env keys to the Vercel project) |
+| `--skip-env` | Do not pass or save local `.env` / `.env.local` values |
+| `--no-interactive` | Skip prompts (implies `--yes`) |
+| `--verbose` | Stream full Vercel build logs (hidden by default; failures print a log tail) |
+
+Extra flags after `deploy` are forwarded as-is to the target deployment platform, which validates them. `--skip-env` is OpenUI-specific so it does not collide with the target platform's env specific args.
+
+Unlinked projects are linked to the platform first. Allowlisted keys from `.env` / `.env.local` that are missing on different deployment environments can be saved to the project (auto-accepted with `--yes`). Build logs are quiet by default; use `--verbose` to stream them.
+
+```bash tab="pnpm" tab-group="pkg"
+# Preview deploy from the project directory
+pnpx @openuidev/cli@latest deploy
+
+# Production deploy
+pnpx @openuidev/cli@latest deploy --prod --yes
+
+# Deploy a specific directory without forwarding local env
+pnpx @openuidev/cli@latest deploy ./my-app --skip-env
+```
+
+```bash tab="bun" tab-group="pkg"
+# Preview deploy from the project directory
+bunx @openuidev/cli@latest deploy
+
+# Production deploy
+bunx @openuidev/cli@latest deploy --prod --yes
+
+# Deploy a specific directory without forwarding local env
+bunx @openuidev/cli@latest deploy ./my-app --skip-env
+```
+
+```bash tab="yarn" tab-group="pkg"
+# Preview deploy from the project directory
+yarn dlx @openuidev/cli@latest deploy
+
+# Production deploy
+yarn dlx @openuidev/cli@latest deploy --prod --yes
+
+# Deploy a specific directory without forwarding local env
+yarn dlx @openuidev/cli@latest deploy ./my-app --skip-env
+```
+
+```bash tab="npm" tab-group="pkg"
+# Preview deploy from the project directory
+npx @openuidev/cli@latest deploy
+
+# Production deploy
+npx @openuidev/cli@latest deploy --prod --yes
+
+# Deploy a specific directory without forwarding local env
+npx @openuidev/cli@latest deploy ./my-app --skip-env
+```
+
## `generate-api-key`
Signs in with Thesys in the browser, mints an OpenUI Gateway API key, and writes it to a project env file.
@@ -430,7 +501,10 @@ and `detected_agent_name`, inferred best-effort from known product environment m
value can be spoofed, inherited, missing, or ambiguous, so neither should be treated as an
authentication or security signal. Every invocation gets an ephemeral, unpersisted `cli_run_id` so
its events can be correlated. For `create`, analytics also include `package_manager`, the
-immediate-start selection, and best-effort dev-command start and result events. Failure events use
+immediate-start selection, and best-effort dev-command start and result events. For `deploy`, analytics include the target (currently `vercel`), production vs preview, whether
+local env was passed (true/false), CLI resolution source, and process status — not env
+values, project paths, or command output.
+Failure events use
bounded `failure_stage`, `error_class`, and `error_code` values instead of raw error messages.
Dependency failures distinguish peer, registry, network, install-script, workspace, and
package-compatibility errors. Process failures include duration, exit code, and signal; Gateway-auth
diff --git a/docs/content/docs/api-reference/index.mdx b/docs/content/docs/api-reference/index.mdx
index 2ec8c19b9..4ce62f74e 100644
--- a/docs/content/docs/api-reference/index.mdx
+++ b/docs/content/docs/api-reference/index.mdx
@@ -27,7 +27,7 @@ The OpenUI SDK is split into packages that build on each other:
- **`@openuidev/devtools`** — Development-only floating widget that surfaces the events captured by `@openuidev/observability`, with error messages and stack traces.
-- **`@openuidev/cli`** — Command-line tool for scaffolding new OpenUI chat apps and generating system prompts or JSON schemas from library definitions.
+- **`@openuidev/cli`** — Command-line tool for scaffolding new OpenUI chat apps, generating system prompts or JSON schemas from library definitions, and deploying projects.
## Choosing a package
@@ -44,7 +44,7 @@ The OpenUI SDK is split into packages that build on each other:
| Svelte integration | [`@openuidev/svelte-lang`](https://github.com/thesysdev/openui/tree/main/packages/svelte-lang) |
| Script-tag, CDN, or iframe embeds | [`@openuidev/browser-bundle`](https://github.com/thesysdev/openui/tree/main/packages/browser-bundle) |
| An in-app panel showing captured errors during development | [`@openuidev/devtools`](/docs/api-reference/devtools) |
-| App scaffolding and prompt/schema generation from the command line | [`@openuidev/cli`](/docs/api-reference/cli) |
+| App scaffolding, prompt/schema generation, and deploy from the command line | [`@openuidev/cli`](/docs/api-reference/cli) |
## Packages
@@ -100,7 +100,7 @@ The OpenUI SDK is split into packages that build on each other:
Development-only floating widget surfacing captured events with error messages and stack traces.
</Card>
<Card title="@openuidev/cli" href="/docs/api-reference/cli">
- openui create (scaffold a Next.js app), openui generate-api-key (mint a Gateway key), and openui generate (system prompt + library spec from a library
+ openui create (scaffold a Next.js app), openui generate-api-key (mint a Gateway key), openui deploy, and openui generate (system prompt + library spec from a library
definition).
</Card>
</Cards>
diff --git a/packages/openui-cli/README.md b/packages/openui-cli/README.md
index 3c27fec24..2d6231a57 100644
--- a/packages/openui-cli/README.md
+++ b/packages/openui-cli/README.md
@@ -1,6 +1,6 @@
# @openuidev/cli
-Command-line tools for starting OpenUI projects, minting OpenUI Cloud API keys, and generating model instructions from component libraries.
+Command-line tools for starting OpenUI projects, minting OpenUI Cloud API keys, and generating model instructions from component libraries, and deploying apps to Vercel.
[![npm](https://img.shields.io/npm/v/@openuidev/cli)](https://www.npmjs.com/package/@openuidev/cli)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/thesysdev/openui/blob/main/LICENSE)
@@ -15,6 +15,7 @@ It currently supports:
- keeping the default minimal SDK route or adding a LangGraph, Vercel AI SDK, or Vercel Eve backend to either template
- minting an OpenUI Cloud API key into an existing project's env file
- generating a system prompt or JSON Schema from a `createLibrary()` export
+- deploying a project with `openui deploy`
## Install
@@ -71,6 +72,13 @@ Generate JSON Schema instead:
npx @openuidev/cli@latest generate ./src/library.ts --json-schema
```
+Deploy the current project:
+
+```bash
+npx @openuidev/cli@latest deploy
+npx @openuidev/cli@latest deploy --prod
+```
+
## Commands
### `openui create`
@@ -172,6 +180,37 @@ openui create --name my-app --no-skill --no-install
openui create --no-interactive --name my-app --template openui-cloud --api-key tk_your_key
```
+### `openui deploy`
+
+Deploys an OpenUI project. The default platform supported is **Vercel**.
+
+```bash
+openui deploy [dir] [options]
+```
+
+Arguments:
+
+- `dir`: Project directory (default: current directory)
+
+Options:
+
+- `-y, --yes`: Skip confirmation prompts (also saves missing env keys to the Vercel project)
+- `--skip-env`: Do not pass or save local `.env` / `.env.local` values
+- `--no-interactive`: Skip prompts (implies `--yes`)
+- `--verbose`: Stream full Vercel build logs (hidden by default; failure still prints a log tail)
+
+Extra flags after `deploy` are forwarded as-is to the target deployment platform, which validates them. `--skip-env` is OpenUI-specific so it does not collide with the target platform's env specific args.
+
+Unlinked projects are linked to the platform first. Allowlisted keys from `.env` / `.env.local` that are missing on different deployment environments can be saved to the project (auto-accepted with `--yes`). Build logs are quiet by default; use `--verbose` to stream them.
+
+
+```bash
+openui deploy
+openui deploy ./my-app
+openui deploy ./my-app --prod
+openui deploy --skip-env -- --force
+```
+
### `openui generate-api-key`
Signs in with Thesys in the browser, mints an OpenUI Cloud API key, and writes it to a project env file.
@@ -270,6 +309,7 @@ Run the built CLI:
```bash
node dist/index.js --help
node dist/index.js create --help
+node dist/index.js deploy --help
node dist/index.js generate-api-key --help
node dist/index.js generate --help
```
@@ -280,7 +320,7 @@ The CLI sends usage analytics; OAuth sign-ins may link usage to your OIDC accoun
When a coding agent invokes the CLI, it should pass `--agent-name` using its stable, lowercase kebab-case product slug—for example, `codex`, `claude-code`, `cline`, `factory-droid`, or `pi`. Do not pass a model/version, user name, session ID, or other unique value. Humans can omit the flag; it defaults to `unknown`.
-Telemetry includes both `agent_name` (the CLI declaration) and `detected_agent_name` (best-effort environment detection). Either can be spoofed, inherited, missing, or ambiguous; neither is an authentication signal. Every invocation gets an ephemeral, unpersisted `cli_run_id` so its events can be correlated. Failure events include bounded `failure_stage`, `error_class`, and `error_code` values, never raw error messages. Dependency failures distinguish peer, registry, network, install-script, workspace, and package-compatibility errors. Process failures include duration, exit code, and signal; Cloud-auth failures include a bounded auth substage and HTTP status when known; cancellations use separate events. For `create`, telemetry also includes `package_manager`, the immediate-start selection, and best-effort dev-command start and result events. Dev-command events contain status, duration, exit code, and signal—not project paths, command output, code, or environment values. Disable telemetry with `--no-telemetry` or `DO_NOT_TRACK=1`.
+Telemetry includes both `agent_name` (the CLI declaration) and `detected_agent_name` (best-effort environment detection). Either can be spoofed, inherited, missing, or ambiguous; neither is an authentication signal. Every invocation gets an ephemeral, unpersisted `cli_run_id` so its events can be correlated. Failure events include bounded `failure_stage`, `error_class`, and `error_code` values, never raw error messages. Dependency failures distinguish peer, registry, network, install-script, workspace, and package-compatibility errors. Process failures include duration, exit code, and signal; Cloud-auth failures include a bounded auth substage and HTTP status when known; cancellations use separate events. For `create`, telemetry also includes `package_manager`, the immediate-start selection, and best-effort dev-command start and result events. Dev-command events contain status, duration, exit code, and signal—not project paths, command output, code, or environment values. For `deploy`, telemetry includes the target (currently `vercel`), production vs preview, whether the Vercel CLI was logged in, whether local env was passed, CLI resolution source, and process status; not env values, project paths, or command output. Disable telemetry with `--no-telemetry` or `DO_NOT_TRACK=1`.
```bash
openui create --no-telemetry
@@ -291,6 +331,7 @@ openui create --no-telemetry
- interactive prompts can be cancelled without creating output
- `create` fetches `templates/templates.json` and the selected template from GitHub (`thesysdev/openui@main`)
- `generate` exits with a non-zero code if the file is missing or no valid library export is found
+- `deploy` exits with a non-zero code if the directory has no `package.json` or the Vercel CLI fails
## Documentation
diff --git a/packages/openui-cli/package.json b/packages/openui-cli/package.json
index e35327a9d..1f4db09c0 100644
--- a/packages/openui-cli/package.json
+++ b/packages/openui-cli/package.json
@@ -1,7 +1,7 @@
{
"name": "@openuidev/cli",
- "version": "0.2.13",
- "description": "CLI for OpenUI — scaffold generative UI chat apps, mint Cloud API keys, and generate LLM system prompts from component libraries",
+ "version": "0.3.0",
+ "description": "CLI for OpenUI — scaffold generative UI chat apps, mint Gateway API keys, and generate LLM system prompts from component libraries, and deploy projects",
"bin": {
"openui": "dist/index.js"
},
@@ -53,6 +53,7 @@
"@inquirer/prompts": "^8.3.0",
"commander": "^14.0.3",
"cross-spawn": "^7.0.6",
+ "dotenv": "^17.2.2",
"esbuild": "^0.25.10",
"get-port": "^7.2.0",
"open": "^10.1.0",
diff --git a/packages/openui-cli/src/commands/create-app.ts b/packages/openui-cli/src/commands/create-app.ts
index 1e1a027e2..812f7db62 100644
--- a/packages/openui-cli/src/commands/create-app.ts
+++ b/packages/openui-cli/src/commands/create-app.ts
@@ -19,7 +19,7 @@ import {
type OverlayManifest,
type TemplateOverlay,
} from "../lib/overlays";
-import { runCommand } from "../lib/process-runner";
+import { mutedNpmEnv, runCommand } from "../lib/process-runner";
import { resolveArgs } from "../lib/resolve-args";
import { resolveTemplateSource } from "../lib/scaffold-template";
import { withSpinner } from "../lib/spinner";
@@ -393,11 +393,7 @@ export async function runCreateApp(options: CreateAppOptions): Promise<void> {
echo: false,
stdin: "ignore",
captureLimit: QUIET_COMMAND_CAPTURE_LIMIT,
- env: {
- ...process.env,
- npm_config_loglevel: "error",
- NPM_CONFIG_LOGLEVEL: "error",
- },
+ env: mutedNpmEnv(),
});
if (options.verbose) {
diff --git a/packages/openui-cli/src/commands/deploy.ts b/packages/openui-cli/src/commands/deploy.ts
new file mode 100644
index 000000000..3d618bd5e
--- /dev/null
+++ b/packages/openui-cli/src/commands/deploy.ts
@@ -0,0 +1,124 @@
+import * as fs from "node:fs";
+import * as path from "node:path";
+
+import {
+ assertOpenUiProject,
+ DEFAULT_DEPLOY_TARGET,
+ type DeployTargetOptions,
+} from "../lib/deploy";
+import { deployToTarget } from "../lib/deploy-targets";
+import { resolveInstallPackageManager } from "../lib/detect-package-manager";
+import { CreateError, telemetry } from "../lib/telemetry";
+
+/** OpenUI-only flags. Everything else is forwarded for the target CLI to validate. */
+const OWN_FLAGS = new Set(["--skip-env", "--no-interactive", "--verbose"]);
+
+export type DeployOptions = {
+ dir?: string;
+ yes?: boolean;
+ skipEnv?: boolean;
+ noInteractive?: boolean;
+ verbose?: boolean;
+ extraArgs?: string[];
+};
+
+type ResolvedDeploy = {
+ projectDir?: string;
+ extraArgs: string[];
+};
+
+/** Resolve flags, validate the project dir, then hand off to the deploy target. */
+export async function runDeploy(options: DeployOptions): Promise<void> {
+ const resolved = resolveDeployInvocation(options);
+ const projectDir = resolveProjectDir(resolved.projectDir);
+ const extraArgs = resolved.extraArgs.filter((arg) => arg !== "--verbose");
+ const prod = extraArgs.includes("--prod");
+ const yes =
+ Boolean(options.yes) ||
+ Boolean(options.noInteractive) ||
+ extraArgs.includes("--yes") ||
+ extraArgs.includes("-y");
+ const skipEnv = Boolean(options.skipEnv);
+ const verbose = Boolean(options.verbose) || (options.extraArgs ?? []).includes("--verbose");
+
+ const targetOpts: DeployTargetOptions = {
+ projectDir,
+ extraArgs,
+ prod,
+ yes,
+ skipEnv,
+ noInteractive: Boolean(options.noInteractive),
+ verbose,
+ };
+
+ telemetry.register({ package_manager: resolveInstallPackageManager().name });
+ telemetry.capture("cli_deploy_started", {
+ target: DEFAULT_DEPLOY_TARGET,
+ prod,
+ yes,
+ skip_env: skipEnv,
+ verbose,
+ has_dir_arg: Boolean(resolved.projectDir),
+ });
+
+ await deployToTarget(DEFAULT_DEPLOY_TARGET, targetOpts);
+}
+
+/** Split `[dir]` from extra args when Commander treats a flag as the dir. */
+function resolveDeployInvocation(options: DeployOptions): ResolvedDeploy {
+ const projectDir = unsetIfFlag(options.dir);
+ const extraArgs = extraDeployArgs(options.extraArgs ?? [], { dir: projectDir });
+ if (options.dir?.startsWith("-") && !extraArgs.includes(options.dir)) {
+ extraArgs.unshift(options.dir);
+ }
+ return { projectDir, extraArgs };
+}
+
+/** Drop OpenUI-owned flags and the consumed dir so the rest can go to Vercel. */
+function extraDeployArgs(args: string[], consumed: { dir?: string }): string[] {
+ const skip = new Set(
+ [consumed.dir].filter((value): value is string => Boolean(value && !value.startsWith("-"))),
+ );
+ const out: string[] = [];
+ for (const arg of args) {
+ if (skip.has(arg) || OWN_FLAGS.has(arg)) continue;
+ out.push(arg);
+ }
+ return out;
+}
+
+/** Treat a leading-dash value as a flag, not a project directory. */
+function unsetIfFlag(value?: string): string | undefined {
+ return value?.startsWith("-") ? undefined : value;
+}
+
+/** Resolve and require a directory that contains package.json. */
+function resolveProjectDir(dir?: string): string {
+ const projectDir = path.resolve(process.cwd(), dir ?? ".");
+ if (!fs.existsSync(projectDir)) {
+ throw new CreateError(
+ "args_resolution",
+ `Directory not found: ${projectDir}`,
+ "invalid_input",
+ "NOT_FOUND",
+ );
+ }
+ if (!fs.statSync(projectDir).isDirectory()) {
+ throw new CreateError(
+ "args_resolution",
+ `Not a directory: ${projectDir}`,
+ "invalid_input",
+ "NOT_A_DIRECTORY",
+ );
+ }
+ if (!fs.existsSync(path.join(projectDir, "package.json"))) {
+ throw new CreateError(
+ "args_resolution",
+ `No package.json in ${projectDir}. Run this from an OpenUI project, or pass its directory.`,
+ "invalid_input",
+ "PROJECT_NOT_FOUND",
+ );
+ }
+ assertOpenUiProject(projectDir);
+ return projectDir;
+}
diff --git a/packages/openui-cli/src/commands/generate-api-key.ts b/packages/openui-cli/src/commands/generate-api-key.ts
index 4b699434b..07c2b0aec 100644
--- a/packages/openui-cli/src/commands/generate-api-key.ts
+++ b/packages/openui-cli/src/commands/generate-api-key.ts
@@ -2,7 +2,7 @@ import * as fs from "node:fs";
import * as path from "node:path";
import { assertValidApiKeyName, mintCloudApiKey } from "../auth/mint";
-import { assertValidEnvVarName, upsertEnvVar } from "../lib/env";
+import { assertValidEnvVarName, DEFAULT_ENV_FILE, upsertEnvVar } from "../lib/env";
import { telemetry } from "../lib/telemetry";
export interface GenerateApiKeyOptions {
@@ -11,7 +11,6 @@ export interface GenerateApiKeyOptions {
name?: string;
}
-const DEFAULT_ENV_FILE = ".env";
const DEFAULT_ENV_KEY = "THESYS_API_KEY";
function resolveProjectName(explicit?: string): string {
diff --git a/packages/openui-cli/src/index.ts b/packages/openui-cli/src/index.ts
index ce925bbba..ee3d0609f 100644
--- a/packages/openui-cli/src/index.ts
+++ b/packages/openui-cli/src/index.ts
@@ -7,9 +7,11 @@ import * as path from "node:path";
import { Command } from "commander";
import { runCreateApp } from "./commands/create-app";
+import { runDeploy } from "./commands/deploy";
import { GenerateOptions, runGenerate } from "./commands/generate";
import { runGenerateApiKey } from "./commands/generate-api-key";
import { detectAgent, UNKNOWN_AGENT_NAME } from "./lib/detect-agent";
+import { DEFAULT_ENV_FILE } from "./lib/env";
import { rejectConflictingImmediateFlags, resolveArgs } from "./lib/resolve-args";
import { telemetry } from "./lib/telemetry";
import {
@@ -130,10 +132,64 @@ Backend frameworks:
},
);
+program
+ .command("deploy")
+ .description("Deploy an OpenUI project")
+ .usage("[dir] [options]")
+ .argument("[dir]", "Project directory (default: current directory)")
+ .option("-y, --yes", "Skip confirmation prompts")
+ .option("--skip-env", "Do not pass or save local .env values")
+ .option("--no-interactive", "Skip prompts (implies --yes)")
+ .option("--verbose", "Stream full deployment build logs")
+ .allowUnknownOption()
+ .allowExcessArguments()
+ .addHelpText(
+ "after",
+ `
+Default supported platform is Vercel. If you are not logged in to the platform,
+opens vercel login first. Links the project when needed, then offers to save
+missing allowlisted keys from .env / .env.local to the project on the platform
+(auto-accepted with --yes). Build logs are hidden by default; pass --verbose
+to stream them. On failure the log tail is printed. Extra flags after deploy
+are forwarded as-is to the target platform, which validates them.
+
+Examples:
+ openui deploy
+ openui deploy --verbose
+`,
+ )
+ .action(
+ async (
+ dir: string | undefined,
+ options: {
+ yes?: boolean;
+ skipEnv?: boolean;
+ interactive: boolean;
+ verbose?: boolean;
+ },
+ command: Command,
+ ) => {
+ try {
+ await runDeploy({
+ dir,
+ yes: options.yes,
+ skipEnv: options.skipEnv,
+ noInteractive: !options.interactive,
+ verbose: options.verbose,
+ extraArgs: command.args,
+ });
+ } catch (e) {
+ handleCliError(e, "cli_deploy_failed");
+ } finally {
+ await telemetry.shutdown();
+ }
+ },
+ );
+
program
.command("generate-api-key")
- .description("Mint an OpenUI Cloud API key and write it to a project env file")
- .option("-f, --file <path>", "Env file to write", ".env")
+ .description("Mint an OpenUI Gateway API key and write it to a project env file")
+ .option("-f, --file <path>", "Env file to write", DEFAULT_ENV_FILE)
.option(
"-k, --key <name>",
"Environment variable name (letters, digits, underscores)",
@@ -144,7 +200,7 @@ program
"after",
`
Run this inside an existing project. It uses the same browser sign-in as
-openui create, mints an OpenUI Cloud API key, and writes it to the env file.
+openui create, mints an OpenUI Gateway API key, and writes it to the env file.
Examples:
openui generate-api-key
diff --git a/packages/openui-cli/src/lib/cli-bin.ts b/packages/openui-cli/src/lib/cli-bin.ts
new file mode 100644
index 000000000..678fb97d4
--- /dev/null
+++ b/packages/openui-cli/src/lib/cli-bin.ts
@@ -0,0 +1,70 @@
+import * as fs from "node:fs";
+import * as path from "node:path";
+
+import { resolveDlxInvocation } from "./detect-package-manager";
+
+/** How a third-party CLI binary was resolved for spawn. */
+export type CliInvocation = {
+ command: string;
+ prefixArgs: string[];
+ /** Prefer for non-interactive spawns — suppresses package-manager noise. */
+ quietPrefixArgs: string[];
+ source: "local" | "path" | "dlx";
+};
+
+/** Resolve `bin` from local node_modules, PATH, or a pinned npm package fallback. */
+export function resolveCliInvocation(
+ projectDir: string,
+ bin: string,
+ fallbackPackage = bin,
+): CliInvocation {
+ const localUnix = path.join(projectDir, "node_modules", ".bin", bin);
+ const localWin = `${localUnix}.cmd`;
+ if (fs.existsSync(localWin)) {
+ return { command: localWin, prefixArgs: [], quietPrefixArgs: [], source: "local" };
+ }
+ if (fs.existsSync(localUnix)) {
+ return { command: localUnix, prefixArgs: [], quietPrefixArgs: [], source: "local" };
+ }
+
+ const fromPath = findExecutableOnPath(bin);
+ if (fromPath) {
+ return { command: fromPath, prefixArgs: [], quietPrefixArgs: [], source: "path" };
+ }
+
+ const dlx = resolveDlxInvocation(fallbackPackage);
+
+ return {
+ command: dlx.command,
+ prefixArgs: dlx.args,
+ quietPrefixArgs: dlx.quietArgs,
+ source: "dlx",
+ };
+}
+
+/** Format a spawn invocation as a single command string for verbose logs. */
+export function formatCliCommand(invocation: CliInvocation, args: string[]): string {
+ const binName = path.basename(invocation.command).replace(/\.cmd$/i, "");
+ const head =
+ invocation.source === "dlx" ? [invocation.command, ...invocation.prefixArgs] : [binName];
+ return [...head, ...args].join(" ");
+}
+
+/** Find an executable named `bin` on PATH. */
+function findExecutableOnPath(bin: string): string | undefined {
+ const pathEnv = process.env["PATH"] ?? "";
+ const extensions = process.platform === "win32" ? [".cmd", ".exe", ".bat", ""] : [""];
+ for (const dir of pathEnv.split(path.delimiter)) {
+ if (!dir) continue;
+ for (const ext of extensions) {
+ const candidate = path.join(dir, bin + ext);
+ try {
+ fs.accessSync(candidate, fs.constants.X_OK);
+ return candidate;
+ } catch {
+ /* not executable / missing */
+ }
+ }
+ }
+ return undefined;
+}
diff --git a/packages/openui-cli/src/lib/deploy-targets/index.ts b/packages/openui-cli/src/lib/deploy-targets/index.ts
new file mode 100644
index 000000000..d34fb2f15
--- /dev/null
+++ b/packages/openui-cli/src/lib/deploy-targets/index.ts
@@ -0,0 +1,23 @@
+import type { DeployTarget, DeployTargetOptions } from "../deploy";
+import { CreateError } from "../telemetry";
+import { deployToVercel } from "./vercel";
+
+/** Dispatch to a platform adapter (Vercel today). */
+export async function deployToTarget(
+ target: DeployTarget,
+ opts: DeployTargetOptions,
+): Promise<void> {
+ switch (target) {
+ case "vercel":
+ return deployToVercel(opts);
+ default: {
+ const _exhaustive: never = target;
+ throw new CreateError(
+ "deploy_target",
+ `Unsupported deploy target: ${String(_exhaustive)}`,
+ "invalid_input",
+ "UNSUPPORTED_TARGET",
+ );
+ }
+ }
+}
diff --git a/packages/openui-cli/src/lib/deploy-targets/vercel/args.ts b/packages/openui-cli/src/lib/deploy-targets/vercel/args.ts
new file mode 100644
index 000000000..c03bafa2d
--- /dev/null
+++ b/packages/openui-cli/src/lib/deploy-targets/vercel/args.ts
@@ -0,0 +1,89 @@
+import type { CliInvocation } from "../../cli-bin";
+
+const ENV_FLAGS = ["--env", "-e"] as const;
+const BUILD_ENV_FLAGS = ["--build-env", "-b"] as const;
+const ALL_ENV_FLAGS = [...ENV_FLAGS, ...BUILD_ENV_FLAGS] as const;
+const LINK_SCOPE_FLAGS = ["--scope", "-S", "--team"] as const;
+
+/** Build `vercel` args: `--yes`, forwarded extras, and allowlisted `--env`/`--build-env`. */
+export function buildVercelDeployArgs(opts: {
+ extraArgs: string[];
+ yes: boolean;
+ localEnv: Record<string, string>;
+}): string[] {
+ const args = [...opts.extraArgs];
+ if (opts.yes && !args.includes("--yes") && !args.includes("-y")) args.unshift("--yes");
+
+ const envKeys = envKeysInArgs(args, ENV_FLAGS);
+ const buildEnvKeys = envKeysInArgs(args, BUILD_ENV_FLAGS);
+ for (const key of Object.keys(opts.localEnv).sort()) {
+ const value = opts.localEnv[key];
+ if (value === undefined) continue;
+ const assignment = `${key}=${value}`;
+ // Next.js inlines process.env at `next build`. Runtime `--env` alone is
+ // not enough — the remote build also needs `--build-env`.
+ if (!envKeys.has(key)) args.push("--env", assignment);
+ if (!buildEnvKeys.has(key)) args.push("--build-env", assignment);
+ }
+ return args;
+}
+
+/** Strip env assignments so verbose logs never print secret values. */
+export function publicVercelArgs(args: string[]): string[] {
+ return args.filter((_, index) => !isVercelEnvFlag(args, index));
+}
+
+/** Keep only team/scope flags that are valid during the link step. */
+export function vercelLinkScopeArgs(args: string[]): string[] {
+ const out: string[] = [];
+ for (let index = 0; index < args.length; index++) {
+ const arg = args[index]!;
+ if (LINK_SCOPE_FLAGS.some((flag) => arg.startsWith(`${flag}=`))) {
+ out.push(arg);
+ continue;
+ }
+ if (!(LINK_SCOPE_FLAGS as readonly string[]).includes(arg)) continue;
+ const value = args[index + 1];
+ if (value !== undefined) {
+ out.push(arg, value);
+ index += 1;
+ }
+ }
+ return out;
+}
+
+/** True if this argv slot is an `--env` / `--build-env` flag or its value. */
+export function isVercelEnvFlag(args: string[], index: number): boolean {
+ const arg = args[index]!;
+ if ((ALL_ENV_FLAGS as readonly string[]).includes(arg)) return true;
+ if (/^(?:--env|-e|--build-env|-b)=/.test(arg)) return true;
+ const prev = args[index - 1];
+ return prev !== undefined && (ALL_ENV_FLAGS as readonly string[]).includes(prev);
+}
+
+/** Collect env keys already present on the given flags so we do not duplicate them. */
+function envKeysInArgs(args: string[], flags: readonly string[]): Set<string> {
+ const keys = new Set<string>();
+ const flagSet = new Set(flags);
+ const prefixed = new RegExp(
+ `^(?:${flags.map((flag) => flag.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})=(.+)$`,
+ );
+ for (let i = 0; i < args.length; i++) {
+ const arg = args[i]!;
+ if (flagSet.has(arg)) {
+ const assignment = args[i + 1];
+ const key = assignment?.split("=")[0];
+ if (key) keys.add(key);
+ i += 1;
+ continue;
+ }
+ const match = arg.match(prefixed);
+ if (match?.[1]) keys.add(match[1].split("=")[0]!);
+ }
+ return keys;
+}
+
+/** Prefix Vercel args with the quiet package-manager invocation (dlx/npx). */
+export function vercelSpawnArgs(invocation: CliInvocation, args: string[]): string[] {
+ return [...invocation.quietPrefixArgs, ...args];
+}
diff --git a/packages/openui-cli/src/lib/deploy-targets/vercel/connect.ts b/packages/openui-cli/src/lib/deploy-targets/vercel/connect.ts
new file mode 100644
index 000000000..c868c9302
--- /dev/null
+++ b/packages/openui-cli/src/lib/deploy-targets/vercel/connect.ts
@@ -0,0 +1,183 @@
+import * as fs from "node:fs";
+import * as path from "node:path";
+
+import type { CliInvocation } from "../../cli-bin";
+import { readProjectPackageJson } from "../../deploy/project";
+import { canPromptInteractive } from "../../deploy/prompt";
+import type { DeployTargetOptions } from "../../deploy/types";
+import { adoptVercelEnvVars, loadAllowlistedProjectEnv } from "../../env";
+import { mutedNpmEnv, runCommand } from "../../process-runner";
+import { withSpinner } from "../../spinner";
+import { CreateError } from "../../telemetry";
+import { throwCommandFailure } from "../../utils";
+import { vercelLinkScopeArgs, vercelSpawnArgs } from "./args";
+
+/** Auth vars Vercel CLI reads. OpenUI apps keep these in `.env`; Vercel often writes `.env.local`. */
+const VERCEL_CLI_ENV_KEYS = ["VERCEL_TOKEN", "VERCEL_ORG_ID", "VERCEL_PROJECT_ID"] as const;
+
+/** Spawn env for Vercel CLI: process env wins, then `.env` / `.env.local`. */
+export function vercelCliEnv(projectDir: string): NodeJS.ProcessEnv {
+ const fromFiles = loadAllowlistedProjectEnv(projectDir, VERCEL_CLI_ENV_KEYS);
+ const env = mutedNpmEnv();
+ for (const key of VERCEL_CLI_ENV_KEYS) {
+ const fromFile = fromFiles[key];
+ if (fromFile && !env[key]?.trim()) env[key] = fromFile;
+ }
+ const hasOrgId = Boolean(env["VERCEL_ORG_ID"]?.trim());
+ const hasProjectId = Boolean(env["VERCEL_PROJECT_ID"]?.trim());
+ if (hasOrgId !== hasProjectId) {
+ throw new CreateError(
+ "vercel_auth_env",
+ "Set both VERCEL_ORG_ID and VERCEL_PROJECT_ID, or remove both and use --scope.",
+ "invalid_input",
+ "INCOMPLETE_VERCEL_PROJECT_ID_PAIR",
+ );
+ }
+ return env;
+}
+
+/** True when `.vercel/project.json` exists in the project. */
+export function isVercelLinked(projectDir: string): boolean {
+ return fs.existsSync(path.join(projectDir, ".vercel", "project.json"));
+}
+
+/**
+ * Vercel project names are lowercase alphanumeric + hyphens, max 100 chars.
+ * Prefer `package.json` `name` over the folder.
+ */
+export function toVercelProjectName(projectDir: string): string {
+ const resolved = path.resolve(projectDir);
+ const slug =
+ vercelSlug(readPackageName(resolved)) || vercelSlug(path.basename(resolved)) || "openui-app";
+ return slug;
+}
+
+function readPackageName(projectDir: string): string | undefined {
+ try {
+ const name = readProjectPackageJson(projectDir).name;
+ return typeof name === "string" && name.trim() ? name.trim() : undefined;
+ } catch {
+ return undefined;
+ }
+}
+
+function vercelSlug(value?: string): string {
+ if (!value) return "";
+ const unscoped = value.includes("/") ? value.slice(value.lastIndexOf("/") + 1) : value;
+ return unscoped
+ .toLowerCase()
+ .replace(/_/g, "-")
+ .replace(/[^a-z0-9-]+/g, "-")
+ .replace(/-+/g, "-")
+ .replace(/^-|-$/g, "")
+ .slice(0, 100)
+ .replace(/-$/, "");
+}
+
+/** Ensure the Vercel CLI is runnable, installing via dlx when needed. */
+export async function prepareVercelCli(invocation: CliInvocation, cwd: string): Promise<void> {
+ const preparing = invocation.source === "dlx";
+ const runVersion = () =>
+ runCommand(invocation.command, vercelSpawnArgs(invocation, ["--version"]), cwd, {
+ echo: false,
+ stdin: "ignore",
+ env: vercelCliEnv(cwd),
+ });
+
+ const result = preparing
+ ? await withSpinner("Preparing Vercel CLI...", runVersion)
+ : await runVersion();
+
+ if (!result.error && result.status === 0) {
+ if (preparing) console.info("✓ Vercel CLI ready\n");
+ return;
+ }
+
+ if (result.diagnosticTail) process.stderr.write(result.diagnosticTail);
+ throwCommandFailure(
+ result,
+ preparing ? "vercel_cli_install" : "vercel_cli_version",
+ preparing ? "Failed to install Vercel CLI" : "Failed to run Vercel CLI",
+ );
+}
+
+/** Probe login with a non-interactive `vercel whoami`. */
+export async function isVercelLoggedIn(invocation: CliInvocation, cwd: string): Promise<boolean> {
+ const result = await runCommand(
+ invocation.command,
+ vercelSpawnArgs(invocation, ["--non-interactive", "whoami"]),
+ cwd,
+ { echo: false, stdin: "ignore", env: vercelCliEnv(cwd) },
+ );
+ return !result.error && result.status === 0;
+}
+
+/** Run interactive `vercel login`, or fail if there is no TTY. */
+export async function loginToVercel(
+ invocation: CliInvocation,
+ opts: Pick<DeployTargetOptions, "projectDir" | "noInteractive">,
+): Promise<void> {
+ if (!canPromptInteractive(opts.noInteractive)) {
+ throw new CreateError(
+ "vercel_login",
+ "Not logged into Vercel. Run `vercel login` or set VERCEL_TOKEN, then retry.",
+ "authentication",
+ "NOT_LOGGED_IN",
+ );
+ }
+
+ console.info("Not logged into Vercel. Starting login...\n");
+ const result = await runCommand(
+ invocation.command,
+ vercelSpawnArgs(invocation, ["login"]),
+ opts.projectDir,
+ { inheritOutput: true, env: vercelCliEnv(opts.projectDir) },
+ );
+ if (!result.error && result.status === 0) return;
+ throwCommandFailure(result, "vercel_login", "Vercel login failed");
+}
+
+/** Link the directory to a Vercel project (`vercel link`, `--yes` when skipping prompts). */
+export async function linkVercelProject(
+ invocation: CliInvocation,
+ opts: Pick<DeployTargetOptions, "projectDir" | "yes" | "noInteractive" | "extraArgs">,
+): Promise<void> {
+ const skipPrompts = opts.yes || opts.noInteractive;
+ if (!skipPrompts && !canPromptInteractive(opts.noInteractive)) {
+ throw new CreateError(
+ "vercel_link",
+ "Vercel project is not linked. Run `vercel link` or re-run with a TTY / --yes.",
+ "invalid_input",
+ "NOT_LINKED",
+ );
+ }
+
+ console.info(
+ skipPrompts
+ ? "Linking Vercel project...\n"
+ : "Linking Vercel project (choose team / project)...\n",
+ );
+ const args = [
+ "link",
+ "--project",
+ toVercelProjectName(opts.projectDir),
+ ...vercelLinkScopeArgs(opts.extraArgs),
+ ];
+ if (skipPrompts) args.push("--yes");
+ const result = await runCommand(
+ invocation.command,
+ vercelSpawnArgs(invocation, args),
+ opts.projectDir,
+ {
+ inheritOutput: true,
+ // --yes + no stdin TTY skips Vercel's post-link env pull into `.env.local`.
+ stdin: skipPrompts ? "ignore" : "inherit",
+ env: vercelCliEnv(opts.projectDir),
+ },
+ );
+ if (!result.error && result.status === 0 && isVercelLinked(opts.projectDir)) {
+ adoptVercelEnvVars(opts.projectDir);
+ return;
+ }
+ throwCommandFailure(result, "vercel_link", "Vercel link failed");
+}
diff --git a/packages/openui-cli/src/lib/deploy-targets/vercel/index.ts b/packages/openui-cli/src/lib/deploy-targets/vercel/index.ts
new file mode 100644
index 000000000..b3ef11b70
--- /dev/null
+++ b/packages/openui-cli/src/lib/deploy-targets/vercel/index.ts
@@ -0,0 +1,129 @@
+import { formatCliCommand, resolveCliInvocation } from "../../cli-bin";
+import { printLogTail } from "../../command-output";
+import {
+ loadProjectDeployEnv,
+ loadProjectDeployFileEnv,
+ printQuietDeploySuccess,
+ warnMissingRequiredDeployEnv,
+ type DeployTargetOptions,
+} from "../../deploy";
+import { adoptVercelEnvVars } from "../../env";
+import { runCommand, runQuietCommand } from "../../process-runner";
+import { telemetry } from "../../telemetry";
+import { throwCommandFailure } from "../../utils";
+import { buildVercelDeployArgs, publicVercelArgs, vercelSpawnArgs } from "./args";
+import {
+ isVercelLinked,
+ isVercelLoggedIn,
+ linkVercelProject,
+ loginToVercel,
+ prepareVercelCli,
+ vercelCliEnv,
+} from "./connect";
+import { syncLocalEnvToVercelProject } from "./project-env";
+import { extractVercelDeploymentSummary } from "./summary";
+
+/** Keep deploy parsing and flags stable until deliberately upgraded and re-tested. */
+const VERCEL_CLI_PACKAGE = "[email protected]";
+
+/** Login, link, optionally save env, then run `vercel` deploy. */
+export async function deployToVercel(opts: DeployTargetOptions): Promise<void> {
+ const t0 = Date.now();
+ adoptVercelEnvVars(opts.projectDir);
+ const projectEnv = loadProjectDeployFileEnv(opts.projectDir);
+ const availableEnv = loadProjectDeployEnv(opts.projectDir);
+ const localEnv = opts.skipEnv ? {} : availableEnv;
+ const projectEnvToSave = opts.skipEnv ? {} : projectEnv;
+ warnMissingRequiredDeployEnv(opts.projectDir, availableEnv, "Vercel");
+
+ const vercel = resolveCliInvocation(opts.projectDir, "vercel", VERCEL_CLI_PACKAGE);
+ await prepareVercelCli(vercel, opts.projectDir);
+
+ let loggedIn = await isVercelLoggedIn(vercel, opts.projectDir);
+ if (!loggedIn) {
+ await loginToVercel(vercel, opts);
+ loggedIn = true;
+ }
+
+ // Link before env sync / deploy so new projects can save env and run a
+ // non-interactive (quiet) deploy without mid-build prompts.
+ if (!isVercelLinked(opts.projectDir)) {
+ await linkVercelProject(vercel, opts);
+ }
+
+ let envSavedKeyCount = 0;
+ if (Object.keys(projectEnvToSave).length > 0) {
+ envSavedKeyCount = await syncLocalEnvToVercelProject({
+ invocation: vercel,
+ projectDir: opts.projectDir,
+ localEnv: projectEnvToSave,
+ yes: opts.yes,
+ noInteractive: opts.noInteractive,
+ });
+ }
+
+ const linkedNow = isVercelLinked(opts.projectDir);
+ const quiet = !opts.verbose;
+ const noWait = opts.extraArgs.includes("--no-wait");
+ // Quiet mode needs a non-interactive Vercel deploy (piped stdio).
+ const deployYes = opts.yes || (quiet && linkedNow);
+ const vercelArgs = buildVercelDeployArgs({
+ extraArgs: opts.extraArgs,
+ yes: deployYes,
+ localEnv,
+ });
+
+ if (opts.verbose) {
+ console.info(
+ `Deploying to Vercel (${vercel.source}): ${formatCliCommand(vercel, publicVercelArgs(vercelArgs))}`,
+ );
+ if (Object.keys(localEnv).length > 0) {
+ console.info(
+ envSavedKeyCount > 0
+ ? `Also attaching local env on this deployment: ${Object.keys(localEnv).sort().join(", ")}`
+ : `Passing local env on this deployment: ${Object.keys(localEnv).sort().join(", ")}`,
+ );
+ }
+ console.info("");
+ }
+
+ const deployEnv = vercelCliEnv(opts.projectDir);
+ const result = quiet
+ ? await runQuietCommand({
+ command: vercel.command,
+ args: vercelSpawnArgs(vercel, vercelArgs),
+ cwd: opts.projectDir,
+ label: "Uploading and building on Vercel...",
+ env: deployEnv,
+ })
+ : await runCommand(vercel.command, vercelSpawnArgs(vercel, vercelArgs), opts.projectDir, {
+ inheritOutput: true,
+ env: deployEnv,
+ });
+
+ if (!result.error && result.status === 0) {
+ if (quiet) {
+ printQuietDeploySuccess(
+ extractVercelDeploymentSummary(result.diagnosticTail),
+ result.durationMs,
+ noWait,
+ );
+ }
+ telemetry.capture("cli_deploy_succeeded", {
+ target: "vercel",
+ prod: opts.prod,
+ yes: opts.yes,
+ skip_env: opts.skipEnv,
+ verbose: opts.verbose,
+ cli_source: vercel.source,
+ logged_in: loggedIn,
+ env_key_count: Object.keys(localEnv).length,
+ env_saved_key_count: envSavedKeyCount,
+ duration_ms: Date.now() - t0,
+ });
+ return;
+ }
+
+ if (quiet) printLogTail(result.diagnosticTail, "Vercel log (tail)");
+ throwCommandFailure(result, "vercel_deploy", "Vercel deploy failed");
+}
diff --git a/packages/openui-cli/src/lib/deploy-targets/vercel/project-env.ts b/packages/openui-cli/src/lib/deploy-targets/vercel/project-env.ts
new file mode 100644
index 000000000..7b3b517e5
--- /dev/null
+++ b/packages/openui-cli/src/lib/deploy-targets/vercel/project-env.ts
@@ -0,0 +1,183 @@
+import type { CliInvocation } from "../../cli-bin";
+import { SENSITIVE_DEPLOY_ENV_KEYS } from "../../deploy/project-env";
+import { canPromptInteractive, confirmOrDefault } from "../../deploy/prompt";
+import { runCommand } from "../../process-runner";
+import { vercelSpawnArgs } from "./args";
+import { isVercelLinked, vercelCliEnv } from "./connect";
+
+/** Environments we keep in sync for template deploys. */
+const PROJECT_ENV_TARGETS = ["production", "preview", "development"] as const;
+
+type VercelEnvEntry = {
+ key: string;
+ target?: string[];
+};
+
+/** Save missing allowlisted keys to the Vercel project without overwriting existing ones. */
+export async function syncLocalEnvToVercelProject(opts: {
+ invocation: CliInvocation;
+ projectDir: string;
+ localEnv: Record<string, string>;
+ yes: boolean;
+ noInteractive: boolean;
+}): Promise<number> {
+ if (!isVercelLinked(opts.projectDir)) {
+ console.info(
+ "Vercel project not linked yet — env is attached to this deployment only. After the first deploy, missing keys can be saved to the project.\n",
+ );
+ return 0;
+ }
+
+ const existing = await listVercelProjectEnv(opts.invocation, opts.projectDir);
+ if (!existing) {
+ console.info("Could not read Vercel project env — continuing with deployment-only env.\n");
+ return 0;
+ }
+
+ const pending: { key: string; targets: string[]; value: string }[] = [];
+ for (const key of Object.keys(opts.localEnv).sort()) {
+ const value = opts.localEnv[key];
+ if (value === undefined) continue;
+ const targets = missingTargetsForKey(existing, key);
+ if (targets.length === 0) continue;
+ pending.push({ key, targets, value });
+ }
+
+ if (pending.length === 0) {
+ console.info(
+ `Vercel project already has ${Object.keys(opts.localEnv).sort().join(", ")} — leaving project env unchanged.\n`,
+ );
+ return 0;
+ }
+
+ const keyList = pending.map((item) => item.key).join(", ");
+ const shouldSave = await confirmOrDefault(
+ `Save ${keyList} to this Vercel project where missing (production / preview / development)?`,
+ {
+ yes: opts.yes,
+ noInteractive: opts.noInteractive,
+ cancelStage: "vercel_env_prompt",
+ },
+ );
+ if (!shouldSave) {
+ console.info(
+ opts.yes || canPromptInteractive(opts.noInteractive)
+ ? "Skipping project env save — using deployment-only env for this run.\n"
+ : "No TTY — not saving env to the Vercel project (pass --yes to save).\n",
+ );
+ return 0;
+ }
+
+ const savedKeyNames: string[] = [];
+ for (const item of pending) {
+ const ok = await addVercelProjectEnv({
+ invocation: opts.invocation,
+ projectDir: opts.projectDir,
+ key: item.key,
+ value: item.value,
+ targets: item.targets,
+ });
+ if (ok) {
+ savedKeyNames.push(item.key);
+ existing.push({ key: item.key, target: [...item.targets] });
+ }
+ }
+
+ if (savedKeyNames.length > 0) {
+ console.info(`Saved ${savedKeyNames.join(", ")} to the Vercel project.\n`);
+ }
+ return savedKeyNames.length;
+}
+
+/** Read project env via `vercel env list --json`, or null if that fails. */
+async function listVercelProjectEnv(
+ invocation: CliInvocation,
+ projectDir: string,
+): Promise<VercelEnvEntry[] | null> {
+ const result = await runCommand(
+ invocation.command,
+ vercelSpawnArgs(invocation, ["env", "list", "--json", "--non-interactive"]),
+ projectDir,
+ { echo: false, stdin: "ignore", env: vercelCliEnv(projectDir) },
+ );
+ if (result.error || result.status !== 0) return null;
+ const parsed = extractJsonObject(result.diagnosticTail) as { envs?: VercelEnvEntry[] } | null;
+ if (!parsed || !Array.isArray(parsed.envs)) return null;
+ return parsed.envs;
+}
+
+/** Parse the first JSON object out of mixed CLI stdout/stderr. */
+function extractJsonObject(text: string): unknown | null {
+ const start = text.indexOf("{");
+ const end = text.lastIndexOf("}");
+ if (start < 0 || end < start) return null;
+ try {
+ return JSON.parse(text.slice(start, end + 1));
+ } catch {
+ return null;
+ }
+}
+
+/** Production/preview/development targets that do not already have this key. */
+function missingTargetsForKey(entries: VercelEnvEntry[], key: string): string[] {
+ const present = new Set<string>();
+ for (const entry of entries) {
+ if (entry.key !== key) continue;
+ for (const target of entry.target ?? []) present.add(target);
+ }
+ return PROJECT_ENV_TARGETS.filter((target) => !present.has(target));
+}
+
+/** Add one key to the given Vercel env targets; returns false if `vercel env add` fails. */
+async function addVercelProjectEnv(opts: {
+ invocation: CliInvocation;
+ projectDir: string;
+ key: string;
+ value: string;
+ targets: string[];
+}): Promise<boolean> {
+ const args = [
+ "env",
+ "add",
+ opts.key,
+ opts.targets.join(","),
+ "--value",
+ opts.value,
+ "--yes",
+ "--non-interactive",
+ "--type",
+ SENSITIVE_DEPLOY_ENV_KEYS.has(opts.key) ? "secret" : "config",
+ ];
+
+ const result = await runCommand(
+ opts.invocation.command,
+ vercelSpawnArgs(opts.invocation, args),
+ opts.projectDir,
+ { echo: false, stdin: "ignore", env: vercelCliEnv(opts.projectDir) },
+ );
+ if (!result.error && result.status === 0) return true;
+
+ console.info(
+ `[!] Could not save ${opts.key} to the Vercel project — it will still be passed on this deployment.`,
+ );
+ if (result.diagnosticTail.trim()) {
+ const hint = redactEnvFailure(result.diagnosticTail, opts.value)
+ .trim()
+ .split(/\r?\n/)
+ .slice(-3)
+ .join("\n");
+ console.info(hint);
+ }
+ console.info("");
+ return false;
+}
+
+/** Remove the submitted value and common token forms from Vercel diagnostics. */
+function redactEnvFailure(text: string, value: string): string {
+ let redacted = value ? text.split(value).join("[REDACTED]") : text;
+ redacted = redacted.replace(
+ /((?:VERCEL_(?:TOKEN|OIDC_TOKEN)|THESYS_API_KEY|OPENAI_API_KEY|LANGSMITH_API_KEY)\s*[=:]\s*)\S+/gi,
+ "$1[REDACTED]",
+ );
+ return redacted.replace(/\b(?:sk|tk|vcp)[_-][A-Za-z0-9._-]{12,}\b/g, "[REDACTED]");
+}
diff --git a/packages/openui-cli/src/lib/deploy-targets/vercel/summary.ts b/packages/openui-cli/src/lib/deploy-targets/vercel/summary.ts
new file mode 100644
index 000000000..cde41aa93
--- /dev/null
+++ b/packages/openui-cli/src/lib/deploy-targets/vercel/summary.ts
@@ -0,0 +1,39 @@
+import type { DeploySuccessSummary } from "../../deploy/quiet";
+
+/** Parse the stable alias, unique deployment URL, and inspect link from `vercel` output. */
+export function extractVercelDeploymentSummary(log: string): DeploySuccessSummary {
+ const text = stripAnsi(log).replace(/\r/g, "\n");
+ const aliased = labeledUrl(text, "Aliased");
+ const production = labeledUrl(text, "Production");
+ const preview = labeledUrl(text, "Preview");
+ const unique = production ?? preview ?? bareDeploymentUrl(text);
+ const url = aliased ?? unique;
+ return {
+ url,
+ deploymentUrl: unique && unique !== url ? unique : undefined,
+ inspect: labeledUrl(text, "Inspect"),
+ };
+}
+
+/** Latest Vercel CLI */
+function labeledUrl(text: string, label: string): string | undefined {
+ const pattern = new RegExp(`^[^\\n]*?\\b${label}\\s*:?\\s+(https://\\S+)`, "gim");
+ const matches = [...text.matchAll(pattern)];
+ const last = matches.at(-1)?.[1];
+ return last ? cleanUrl(last) : undefined;
+}
+
+/** Last https URL on its own line — `vercel` writes the unique deployment URL to stdout. */
+function bareDeploymentUrl(text: string): string | undefined {
+ const matches = [...text.matchAll(/^\s*(https:\/\/[a-z0-9.-]+\.vercel\.app\/?)\s*$/gim)];
+ const last = matches.at(-1)?.[1];
+ return last ? cleanUrl(last) : undefined;
+}
+
+function cleanUrl(value: string): string {
+ return value.replace(/[)\],.;]+$/g, "");
+}
+
+function stripAnsi(value: string): string {
+ return value.replace(/\x1B\[[0-9;]*[mK]/g, "");
+}
diff --git a/packages/openui-cli/src/lib/deploy/index.ts b/packages/openui-cli/src/lib/deploy/index.ts
new file mode 100644
index 000000000..ac8a763f0
--- /dev/null
+++ b/packages/openui-cli/src/lib/deploy/index.ts
@@ -0,0 +1,5 @@
+export * from "./project";
+export * from "./project-env";
+export * from "./prompt";
+export * from "./quiet";
+export * from "./types";
diff --git a/packages/openui-cli/src/lib/deploy/project-env.ts b/packages/openui-cli/src/lib/deploy/project-env.ts
new file mode 100644
index 000000000..f58dc1e8c
--- /dev/null
+++ b/packages/openui-cli/src/lib/deploy/project-env.ts
@@ -0,0 +1,61 @@
+import { loadAllowlistedProjectEnv } from "../env";
+import { readProjectDependencies } from "./project";
+
+/** Known OpenUI template env keys. Values must never be logged or sent to telemetry. */
+export const DEPLOY_ENV_ALLOWLIST = [
+ "THESYS_API_KEY",
+ "THESYS_API_BASE_URL",
+ "OPENAI_API_KEY",
+ "OPENAI_BASE_URL",
+ "OPENAI_MODEL",
+ "OPENUI_MODEL",
+ "APP_ID",
+ "DEMO_USER_ID",
+ "LANGGRAPH_API_URL",
+ "LANGGRAPH_ASSISTANT_ID",
+ "LANGSMITH_API_KEY",
+] as const;
+
+/** Prefer secret storage on platforms that distinguish secret vs config. */
+export const SENSITIVE_DEPLOY_ENV_KEYS = new Set([
+ "THESYS_API_KEY",
+ "OPENAI_API_KEY",
+ "LANGSMITH_API_KEY",
+]);
+
+/** Load allowlisted keys explicitly stored in the project's env files. */
+export function loadProjectDeployFileEnv(projectDir: string): Record<string, string> {
+ return loadAllowlistedProjectEnv(projectDir, DEPLOY_ENV_ALLOWLIST);
+}
+
+/** Load effective deploy env; shell values override `.env.local`, then `.env`. */
+export function loadProjectDeployEnv(projectDir: string): Record<string, string> {
+ const env = loadProjectDeployFileEnv(projectDir);
+ for (const key of DEPLOY_ENV_ALLOWLIST) {
+ const value = process.env[key]?.trim();
+ if (value) env[key] = value;
+ }
+ return env;
+}
+
+/** Infer required API-key names from the project's dependencies. */
+export function detectRequiredDeployEnvNames(projectDir: string): string[] {
+ const deps = readProjectDependencies(projectDir);
+ if (deps["@openuidev/thesys-server"] || deps["@openuidev/thesys"]) return ["THESYS_API_KEY"];
+ if (deps["openai"] || deps["ai"] || deps["@ai-sdk/openai"]) return ["OPENAI_API_KEY"];
+ return [];
+}
+
+/** Warn when a required key is missing locally and may also be missing on the platform. */
+export function warnMissingRequiredDeployEnv(
+ projectDir: string,
+ localEnv: Record<string, string>,
+ platformLabel: string,
+): void {
+ for (const key of detectRequiredDeployEnvNames(projectDir)) {
+ if (localEnv[key]) continue;
+ console.info(
+ `[!] ${key} is not set locally. This deployment will fail at runtime unless ${key} is already configured on ${platformLabel}.\n`,
+ );
+ }
+}
diff --git a/packages/openui-cli/src/lib/deploy/project.ts b/packages/openui-cli/src/lib/deploy/project.ts
new file mode 100644
index 000000000..8c88486b8
--- /dev/null
+++ b/packages/openui-cli/src/lib/deploy/project.ts
@@ -0,0 +1,47 @@
+import * as fs from "node:fs";
+import * as path from "node:path";
+
+import { CreateError } from "../telemetry";
+
+type ProjectPackageJson = {
+ name?: string;
+ dependencies?: Record<string, string>;
+ devDependencies?: Record<string, string>;
+};
+
+/** Parse the project's package.json. */
+export function readProjectPackageJson(projectDir: string): ProjectPackageJson {
+ const pkgPath = path.join(projectDir, "package.json");
+ try {
+ return JSON.parse(fs.readFileSync(pkgPath, "utf8")) as ProjectPackageJson;
+ } catch {
+ throw new CreateError(
+ "args_resolution",
+ `Invalid package.json in ${projectDir}.`,
+ "invalid_input",
+ "INVALID_PACKAGE_JSON",
+ );
+ }
+}
+
+/** Read dependencies and devDependencies from package.json. */
+export function readProjectDependencies(projectDir: string): Record<string, string> {
+ const pkg = readProjectPackageJson(projectDir);
+ return { ...pkg.dependencies, ...pkg.devDependencies };
+}
+
+/** True when the project depends on at least one `@openuidev/*` package. */
+export function hasOpenUiPackages(deps: Record<string, string>): boolean {
+ return Object.keys(deps).some((name) => name.startsWith("@openuidev/"));
+}
+
+/** Require an OpenUI app (any `@openuidev/*` dependency). */
+export function assertOpenUiProject(projectDir: string): void {
+ if (hasOpenUiPackages(readProjectDependencies(projectDir))) return;
+ throw new CreateError(
+ "args_resolution",
+ "Not an OpenUI project. Run this from an OpenUI app, or pass its directory.",
+ "invalid_input",
+ "NOT_OPENUI_PROJECT",
+ );
+}
diff --git a/packages/openui-cli/src/lib/deploy/prompt.ts b/packages/openui-cli/src/lib/deploy/prompt.ts
new file mode 100644
index 000000000..7a72d3486
--- /dev/null
+++ b/packages/openui-cli/src/lib/deploy/prompt.ts
@@ -0,0 +1,29 @@
+import { CliCancelledError } from "../telemetry";
+
+/** True when stdin/stdout are TTYs and `--no-interactive` was not passed. */
+export function canPromptInteractive(noInteractive = false): boolean {
+ return Boolean(process.stdin.isTTY && process.stdout.isTTY) && !noInteractive;
+}
+
+/**
+ * Confirm with default yes when a TTY is available. `--yes` accepts without
+ * asking. No TTY and no `--yes` returns false so secrets are not written remotely.
+ */
+export async function confirmOrDefault(
+ message: string,
+ opts: { yes?: boolean; noInteractive?: boolean; cancelStage: string },
+): Promise<boolean> {
+ if (opts.yes) return true;
+ if (!canPromptInteractive(opts.noInteractive)) return false;
+
+ try {
+ const { confirm } = await import("@inquirer/prompts");
+ return await confirm({ message, default: true });
+ } catch (err) {
+ const { ExitPromptError } = await import("@inquirer/core");
+ if (err instanceof ExitPromptError) {
+ throw new CliCancelledError(opts.cancelStage);
+ }
+ throw err;
+ }
+}
diff --git a/packages/openui-cli/src/lib/deploy/quiet.ts b/packages/openui-cli/src/lib/deploy/quiet.ts
new file mode 100644
index 000000000..a965febb9
--- /dev/null
+++ b/packages/openui-cli/src/lib/deploy/quiet.ts
@@ -0,0 +1,22 @@
+export type DeploySuccessSummary = {
+ url?: string;
+ /** Unique `*.vercel.app` deployment URL when it differs from the alias. */
+ deploymentUrl?: string;
+ inspect?: string;
+};
+
+/** Print the deployment URL and inspect link after a quiet success/start. */
+export function printQuietDeploySuccess(
+ summary: DeploySuccessSummary,
+ durationMs: number,
+ noWait = false,
+): void {
+ const seconds = Math.max(1, Math.round(durationMs / 1000));
+ console.info(noWait ? `✓ Deployment started in ${seconds}s` : `✓ Deployed in ${seconds}s`);
+ if (summary.url) console.info(` ${summary.url}`);
+ if (summary.deploymentUrl && summary.deploymentUrl !== summary.url) {
+ console.info(` ${summary.deploymentUrl}`);
+ }
+ if (summary.inspect) console.info(` Inspect ${summary.inspect}`);
+ console.info("");
+}
diff --git a/packages/openui-cli/src/lib/deploy/types.ts b/packages/openui-cli/src/lib/deploy/types.ts
new file mode 100644
index 000000000..8342eb4f4
--- /dev/null
+++ b/packages/openui-cli/src/lib/deploy/types.ts
@@ -0,0 +1,14 @@
+/** Shared options every deploy target receives from `openui deploy`. */
+export type DeployTargetOptions = {
+ projectDir: string;
+ extraArgs: string[];
+ prod: boolean;
+ yes: boolean;
+ skipEnv: boolean;
+ noInteractive: boolean;
+ verbose: boolean;
+};
+
+export const DEPLOY_TARGETS = ["vercel"] as const;
+export type DeployTarget = (typeof DEPLOY_TARGETS)[number];
+export const DEFAULT_DEPLOY_TARGET: DeployTarget = "vercel";
diff --git a/packages/openui-cli/src/lib/detect-package-manager.ts b/packages/openui-cli/src/lib/detect-package-manager.ts
index 73f07963c..222f91c7b 100644
--- a/packages/openui-cli/src/lib/detect-package-manager.ts
+++ b/packages/openui-cli/src/lib/detect-package-manager.ts
@@ -8,9 +8,24 @@ export interface PackageManager {
}
const PACKAGE_MANAGERS: Record<PackageManagerName, PackageManager> = {
- pnpm: { name: "pnpm", installCmd: "pnpm install", installArgs: ["install"], runCmd: "pnpm" },
- yarn: { name: "yarn", installCmd: "yarn", installArgs: [], runCmd: "yarn" },
- bun: { name: "bun", installCmd: "bun install", installArgs: ["install"], runCmd: "bun" },
+ pnpm: {
+ name: "pnpm",
+ installCmd: "pnpm install",
+ installArgs: ["install"],
+ runCmd: "pnpm",
+ },
+ yarn: {
+ name: "yarn",
+ installCmd: "yarn",
+ installArgs: [],
+ runCmd: "yarn",
+ },
+ bun: {
+ name: "bun",
+ installCmd: "bun install",
+ installArgs: ["install"],
+ runCmd: "bun",
+ },
npm: {
name: "npm",
installCmd: "npm ci --prefer-offline --no-audit --no-fund --progress=false",
@@ -32,3 +47,16 @@ export function resolveInstallPackageManager(): PackageManager {
const invoking = detectInvokingPackageManager();
return PACKAGE_MANAGERS[invoking ?? "npm"];
}
+
+/** Run a published CLI through npm's Node-compatible executor. */
+export function resolveDlxInvocation(pkg: string): {
+ command: string;
+ args: string[];
+ quietArgs: string[];
+} {
+ return {
+ command: "npx",
+ args: ["--yes", pkg],
+ quietArgs: ["--yes", "--quiet", pkg],
+ };
+}
diff --git a/packages/openui-cli/src/lib/env.ts b/packages/openui-cli/src/lib/env.ts
index ac9395aaf..f297ad2a9 100644
--- a/packages/openui-cli/src/lib/env.ts
+++ b/packages/openui-cli/src/lib/env.ts
@@ -1,11 +1,89 @@
import * as fs from "node:fs";
import * as path from "node:path";
+import { parse as parseDotenv } from "dotenv";
+
import { CreateError } from "./telemetry";
/** True for `"1"` or `"true"` (any case). */
export const isTruthyEnv = (value?: string) => value === "1" || value?.toLowerCase() === "true";
+export const DEFAULT_ENV_FILE = ".env";
+export const PROJECT_ENV_FILES = [".env", ".env.local"] as const;
+
+/** `.env` when it already exists (OpenUI default); otherwise `.env.local`. */
+export function resolveProjectEnvFileName(projectDir: string): string {
+ return fs.existsSync(path.join(projectDir, DEFAULT_ENV_FILE)) ? DEFAULT_ENV_FILE : ".env.local";
+}
+
+const VERCEL_WRITTEN_ENV_KEYS = [
+ "VERCEL_TOKEN",
+ "VERCEL_OIDC_TOKEN",
+ "VERCEL_ORG_ID",
+ "VERCEL_PROJECT_ID",
+] as const;
+
+/**
+ * Vercel always writes `.env.local`. If the project already has `.env`, move
+ * those Vercel keys there and drop an emptied `.env.local`.
+ */
+export function adoptVercelEnvVars(projectDir: string): void {
+ const targetName = resolveProjectEnvFileName(projectDir);
+ if (targetName === ".env.local") return;
+ const localPath = path.join(projectDir, ".env.local");
+ if (!fs.existsSync(localPath)) return;
+
+ const fromLocal = parseEnvFile(localPath);
+ const targetPath = path.join(projectDir, targetName);
+ for (const key of VERCEL_WRITTEN_ENV_KEYS) {
+ const value = fromLocal[key]?.trim();
+ if (!value || /[\r\n]/.test(value)) continue;
+ upsertEnvVar(targetPath, key, value);
+ removeEnvVar(localPath, key);
+ }
+ if (fs.existsSync(localPath) && fs.readFileSync(localPath, "utf8").trim() === "") {
+ fs.unlinkSync(localPath);
+ }
+}
+
+/** Parse a dotenv-style file into key/value pairs (no `$VAR` expansion). */
+export function parseEnvFile(filePath: string): Record<string, string> {
+ if (!fs.existsSync(filePath)) return {};
+ return parseDotenv(fs.readFileSync(filePath, "utf8"));
+}
+
+/**
+ * Merge env files (later files win) and keep only allowlisted keys with
+ * non-empty values. Values are never logged by this helper.
+ */
+export function loadAllowlistedEnvFiles(
+ filePaths: string[],
+ allowlist: readonly string[],
+): Record<string, string> {
+ const merged: Record<string, string> = {};
+ for (const filePath of filePaths) {
+ Object.assign(merged, parseEnvFile(filePath));
+ }
+ const allowlisted: Record<string, string> = {};
+ for (const key of allowlist) {
+ const value = merged[key]?.trim();
+ if (value) allowlisted[key] = value;
+ }
+ return allowlisted;
+}
+
+/** Load allowlisted keys from the usual project env files (`.env`, `.env.local`). */
+export function loadAllowlistedProjectEnv(
+ projectDir: string,
+ allowlist: readonly string[],
+ fileNames: readonly string[] = PROJECT_ENV_FILES,
+): Record<string, string> {
+ return loadAllowlistedEnvFiles(
+ fileNames.map((name) => path.join(projectDir, name)),
+ allowlist,
+ );
+}
+
const ENV_VAR_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
function isKeyLine(line: string, name: string): boolean {
@@ -59,3 +137,22 @@ export function upsertEnvVar(filePath: string, name: string, value: string): voi
fs.mkdirSync(path.dirname(resolved), { recursive: true });
fs.writeFileSync(resolved, lines.join(newline) + newline);
}
+
+/** Remove every assignment for `name`, including a commented one. */
+export function removeEnvVar(filePath: string, name: string): void {
+ assertValidEnvVarName(name);
+ const resolved = path.resolve(filePath);
+ if (!fs.existsSync(resolved)) return;
+
+ const content = fs.readFileSync(resolved, "utf8");
+ const newline = content.includes("\r\n") ? "\r\n" : "\n";
+ const lines = content.length === 0 ? [] : content.split(/\r?\n/);
+ if (lines.length > 0 && lines[lines.length - 1] === "") lines.pop();
+
+ const next = lines.filter((line) => !isKeyLine(line, name));
+ if (next.length === 0) {
+ fs.unlinkSync(resolved);
+ return;
+ }
+ fs.writeFileSync(resolved, next.join(newline) + newline);
+}
diff --git a/packages/openui-cli/src/lib/process-runner.ts b/packages/openui-cli/src/lib/process-runner.ts
index 8e7417825..fa1984435 100644
--- a/packages/openui-cli/src/lib/process-runner.ts
+++ b/packages/openui-cli/src/lib/process-runner.ts
@@ -1,5 +1,8 @@
import spawn from "cross-spawn";
+import { QUIET_COMMAND_CAPTURE_LIMIT } from "./command-output";
+import { withSpinner } from "./spinner";
+
const DIAGNOSTIC_TAIL_LIMIT = 16 * 1024;
export type CommandResult = {
@@ -10,6 +13,15 @@ export type CommandResult = {
diagnosticTail: string;
};
+/** Quiet npm/npx progress when we spawn a nested package-manager CLI. */
+export function mutedNpmEnv(base: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEnv {
+ return {
+ ...base,
+ npm_config_loglevel: "error",
+ NPM_CONFIG_LOGLEVEL: "error",
+ };
+}
+
export type RunCommandOptions = {
env?: NodeJS.ProcessEnv;
/** When false, capture stdout/stderr without writing them to the parent. Default true. */
@@ -104,3 +116,24 @@ export function runCommand(
child.once("close", (status, signal) => finish({ status, signal: forwardedSignal ?? signal }));
});
}
+
+export type QuietCommandOptions = {
+ command: string;
+ args: string[];
+ cwd: string;
+ label: string;
+ env?: NodeJS.ProcessEnv;
+ captureLimit?: number;
+};
+
+/** Run a command with output captured and a spinner in the terminal. */
+export async function runQuietCommand(opts: QuietCommandOptions): Promise<CommandResult> {
+ return withSpinner(opts.label, () =>
+ runCommand(opts.command, opts.args, opts.cwd, {
+ echo: false,
+ stdin: "ignore",
+ captureLimit: opts.captureLimit ?? QUIET_COMMAND_CAPTURE_LIMIT,
+ env: opts.env,
+ }),
+ );
+}
diff --git a/packages/openui-cli/src/lib/utils.ts b/packages/openui-cli/src/lib/utils.ts
index e3f0dbd8b..0d07e62e4 100644
--- a/packages/openui-cli/src/lib/utils.ts
+++ b/packages/openui-cli/src/lib/utils.ts
@@ -198,6 +198,26 @@ export function processErrorProperties(
return { failure_stage: failureStage, ...fallback, ...metadata };
}
+const DEFAULT_PROCESS_FALLBACK: Pick<CliErrorProperties, "error_class" | "error_code"> = {
+ error_class: "process",
+ error_code: "NONZERO_EXIT",
+};
+
+/** Throw a typed CLI error (or cancellation) from a failed child process. */
+export function throwCommandFailure(
+ result: CommandResult,
+ stage: string,
+ message: string,
+ fallback: Pick<CliErrorProperties, "error_class" | "error_code"> = DEFAULT_PROCESS_FALLBACK,
+): never {
+ const properties = processErrorProperties(result, stage, fallback);
+ if (properties.error_class === "user_cancelled") {
+ throw new CliCancelledError(stage, properties.cancellation_exit_code ?? 0, properties);
+ }
+ const { failure_stage, error_class, error_code, ...metadata } = properties;
+ throw new CreateError(failure_stage, message, error_class, error_code, metadata);
+}
+
export function handleCliError(
e: unknown,
event: string,
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 3f01338e0..9abb627d0 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -430,6 +430,9 @@ importers:
cross-spawn:
specifier: ^7.0.6
version: 7.0.6
+ dotenv:
+ specifier: ^17.2.2
+ version: 17.4.2
esbuild:
specifier: ^0.25.10
version: 0.25.12
@@ -501,7 +504,7 @@ importers:
version: 6.0.236([email protected])
eve:
specifier: ^0.11.7
openai:
specifier: ^6.22.0
@@ -6414,6 +6417,10 @@ packages:
resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==}
+ resolution: {integrity: sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==}
+ engines: {node: '>=12'}
+
resolution: {integrity: sha512-bihc7jPC90VrosXNzK0LTE2cuLP6jr0Ro8jk+kMugHReJVLIpHz/xadeq3MhuwyO4TD4OA3L1Q8pBBFRc08Tsw==}
engines: {node: '>=20.19.0'}
@@ -15973,6 +15980,8 @@ snapshots:
domelementtype: 2.3.0
domhandler: 5.0.3
+
optionalDependencies:
oxc-resolver: 11.24.2
@@ -16611,10 +16620,10 @@ snapshots:
dependencies:
ai: 6.0.236([email protected])
optionalDependencies:
'@opentelemetry/api': 1.9.1
@@ -18483,7 +18492,7 @@ snapshots:
dependencies:
consola: 3.4.2
crossws: 0.4.12([email protected])
@@ -18500,6 +18509,7 @@ snapshots:
unenv: 2.0.0-rc.24
optionalDependencies:
+ dotenv: 17.4.2
jiti: 2.7.0
rollup: 4.62.3
diff --git a/templates/openui-cloud/README.md b/templates/openui-cloud/README.md
index c8b1c6b81..6566ab738 100644
--- a/templates/openui-cloud/README.md
+++ b/templates/openui-cloud/README.md
@@ -20,6 +20,19 @@ You can start editing the page by modifying `src/app/api/chat/route.ts` and impr
by adding system prompts or tools. A LangGraph scaffold puts the implementation in
`src/agent/agent.ts` instead.
+## Deploy
+
+From the project directory:
+
+```bash
+npx @openuidev/cli@latest deploy
+npx @openuidev/cli@latest deploy --prod
+```
+
+Deploys to Vercel. Allowlisted keys from `.env` / `.env.local` (including `THESYS_API_KEY`) are
+passed to that deployment unless you use `--skip-env`. Persist them on the Vercel project for later
+deploys.
+
## Framework deployments
The Vercel AI SDK scaffold is a standard Next.js app: `streamText()` owns the
diff --git a/templates/openui-cloud/package-lock.json b/templates/openui-cloud/package-lock.json
index aaffccd06..b577785ea 100644
--- a/templates/openui-cloud/package-lock.json
+++ b/templates/openui-cloud/package-lock.json
@@ -13110,9 +13110,9 @@
}
},
"node_modules/zod": {
- "version": "4.6.1",
- "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.1.tgz",
- "integrity": "sha512-341aRWQsve0rvronKNTqZpjmzdbUDlFuzHaI/XLg/Ej82qffDJRRfBTCuv7+9q/rMjB6LSLyEBnW4InJeMtt/Q==",
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.2.tgz",
+ "integrity": "sha512-lh5RCAGFa1Cm2hjtNwLQhSs/AsqdWnTQaBER9fEwN/88pSh7KOtJavtBx/0VlkN/uFd61SwYmljLMDAsHlvzBQ==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
diff --git a/templates/openui-self-hosted/README.md b/templates/openui-self-hosted/README.md
index dad0a500a..9f15c0d46 100644
--- a/templates/openui-self-hosted/README.md
+++ b/templates/openui-self-hosted/README.md
@@ -27,6 +27,19 @@ implementation in `src/agent/agent.ts` instead.
If you selected LangGraph, the Vercel AI SDK, or Vercel Eve, the generated app includes a `get_weather`
example. Ask “What’s the weather in Berlin?” to exercise its native tool loop.
+## Deploy
+
+From the project directory:
+
+```bash
+npx @openuidev/cli@latest deploy
+npx @openuidev/cli@latest deploy --prod
+```
+
+Deploys to Vercel. Allowlisted keys from `.env` / `.env.local` (including `OPENAI_API_KEY`) are
+passed to that deployment unless you use `--skip-env`. Persist them on the Vercel project for later
+deploys.
+
## Framework deployments
The Vercel AI SDK scaffold runs its backend inside the Next.js API route, so the