Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

feat(eve): support non-interactive Vercel project commands (#2208)

OwenKephartc6d6b3ef3df0
diff --git a/.changeset/friendly-noninteractive-vercel.md b/.changeset/friendly-noninteractive-vercel.md
new file mode 100644
index 000000000..ee33a3c8d
--- /dev/null
+++ b/.changeset/friendly-noninteractive-vercel.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Add non-interactive `eve link` and `eve deploy` options for linking a named Vercel project and deploying from CI or coding agents without terminal prompts.
diff --git a/apps/benchmarks/evals/author-003-deploy-new-project/CASE.ts b/apps/benchmarks/evals/author-003-deploy-new-project/CASE.ts
new file mode 100644
index 000000000..2cd0dbba6
--- /dev/null
+++ b/apps/benchmarks/evals/author-003-deploy-new-project/CASE.ts
@@ -0,0 +1,10 @@
+import { defineAuthoringCase, simpleProject } from "../../lib/authoring-case.js";
+import { vercelSetup } from "../vercel-setup.js";
+
+export default defineAuthoringCase({
+ startingPoint: simpleProject,
+ setup: vercelSetup,
+ async interact({ send }) {
+ await send("Deploy my agent to production using a new Vercel project called field-notes.");
+ },
+});
diff --git a/apps/benchmarks/evals/author-003-deploy-new-project/EVAL.ts b/apps/benchmarks/evals/author-003-deploy-new-project/EVAL.ts
new file mode 100644
index 000000000..d9e789177
--- /dev/null
+++ b/apps/benchmarks/evals/author-003-deploy-new-project/EVAL.ts
@@ -0,0 +1,41 @@
+import { expect, test } from "vitest";
+
+import { authoringEval } from "./grader.js";
+
+const { commands, worldEvents } = authoringEval();
+const commandLog = commands.join("\n");
+
+test("uses eve deploy to create and link the named Vercel project without prompting", () => {
+ expect(commandLog).toMatch(/eve\s+deploy[^\n]*--project(?:=|\s+)field-notes/i);
+ expect(commandLog).toMatch(/eve\s+deploy[^\n]*--non-interactive/i);
+ expect(commandLog).toMatch(/eve\s+deploy[^\n]*--yes/i);
+ expect(commands).not.toContainEqual(
+ expect.stringMatching(/(?:^|\s)(?:pnpm\s+exec\s+)?vercel\s+(?:link|env|deploy)\b/i),
+ );
+ expect(worldEvents).toContainEqual({
+ type: "project.created",
+ data: { project: "field-notes" },
+ });
+ expect(worldEvents).toContainEqual({
+ type: "project.linked",
+ data: { project: "field-notes" },
+ });
+});
+
+test("deploys the newly linked project to production", () => {
+ expect(worldEvents).toContainEqual({
+ type: "environment.pulled",
+ data: { project: "field-notes" },
+ });
+ expect(worldEvents).toContainEqual({
+ type: "project.deployed",
+ data: { project: "field-notes", url: "https://field-notes.example.test" },
+ });
+ expect(worldEvents).toContainEqual({
+ type: "vercel.invoked",
+ data: {
+ args: ["deploy", "--prod", "--yes", "--non-interactive"],
+ nonInteractive: true,
+ },
+ });
+});
diff --git a/apps/benchmarks/evals/mock-vercel-cli.mjs b/apps/benchmarks/evals/mock-vercel-cli.mjs
new file mode 100644
index 000000000..d6b37a87d
--- /dev/null
+++ b/apps/benchmarks/evals/mock-vercel-cli.mjs
@@ -0,0 +1,64 @@
+#!/usr/bin/env node
+
+import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
+import { join, resolve } from "node:path";
+
+const root = process.env.EVE_AUTHORING_EVAL_DIRECTORY;
+if (root === undefined) throw new Error("EVE_AUTHORING_EVAL_DIRECTORY is required.");
+
+const args = process.argv.slice(2);
+const nonInteractive = args.includes("--non-interactive");
+const statePath = join(root, "vercel-state.json");
+const state = existsSync(statePath)
+ ? JSON.parse(readFileSync(statePath, "utf8"))
+ : { linked: false, project: undefined };
+
+record("vercel.invoked", { args, nonInteractive });
+
+if (args[0] === "link") {
+ const project = option("--project");
+ if (!nonInteractive || project === undefined) {
+ fail("vercel link requires --project <name> --yes --non-interactive.");
+ }
+ state.linked = true;
+ state.project = project;
+ writeFileSync(statePath, JSON.stringify(state));
+ mkdirSync(resolve(process.cwd(), ".vercel"), { recursive: true });
+ writeFileSync(
+ resolve(process.cwd(), ".vercel", "project.json"),
+ `${JSON.stringify({ orgId: "org_benchmark", projectId: `prj_${project}`, projectName: project })}\n`,
+ );
+ record("project.created", { project });
+ record("project.linked", { project });
+} else if (args[0] === "env" && args[1] === "pull") {
+ if (!state.linked || !nonInteractive) {
+ fail("vercel env pull requires a linked project and --non-interactive.");
+ }
+ writeFileSync(resolve(process.cwd(), ".env.local"), "VERCEL_OIDC_TOKEN=benchmark-token\n");
+ record("environment.pulled", { project: state.project });
+} else if (args[0] === "deploy") {
+ if (!state.linked || !nonInteractive || !args.includes("--prod")) {
+ fail("vercel deploy requires a linked project, --prod, and --non-interactive.");
+ }
+ record("project.deployed", {
+ project: state.project,
+ url: `https://${state.project}.example.test`,
+ });
+} else {
+ fail(`Unsupported mock Vercel command: vercel ${args.join(" ")}`);
+}
+
+function option(name) {
+ const index = args.indexOf(name);
+ return index === -1 ? undefined : args[index + 1];
+}
+
+function record(type, data) {
+ mkdirSync(root, { recursive: true });
+ appendFileSync(join(root, "world-events.jsonl"), `${JSON.stringify({ type, data })}\n`);
+}
+
+function fail(message) {
+ console.error(message);
+ process.exit(1);
+}
diff --git a/apps/benchmarks/evals/vercel-setup.ts b/apps/benchmarks/evals/vercel-setup.ts
new file mode 100644
index 000000000..4def62cf7
--- /dev/null
+++ b/apps/benchmarks/evals/vercel-setup.ts
@@ -0,0 +1,17 @@
+import { readFileSync } from "node:fs";
+import { join } from "node:path";
+
+import type { AuthoringSetup } from "../lib/authoring-case.js";
+
+const mockVercel = readFileSync(join(import.meta.dirname, "mock-vercel-cli.mjs"), "utf8");
+
+/** Installs the deterministic Vercel CLI fixture beside the project's local binaries. */
+export const vercelSetup: AuthoringSetup = {
+ id: "vercel",
+ async onSession({ workspace, run, write }) {
+ const vercelPath = `${workspace}/node_modules/.bin/vercel`;
+ await run(`mkdir -p ${workspace}/node_modules/.bin`);
+ await write(vercelPath, mockVercel);
+ await run(`chmod +x ${vercelPath}`);
+ },
+};
diff --git a/apps/benchmarks/lib/harness-agent.ts b/apps/benchmarks/lib/harness-agent.ts
index dcf581db6..bb5f0b07e 100644
--- a/apps/benchmarks/lib/harness-agent.ts
+++ b/apps/benchmarks/lib/harness-agent.ts
@@ -1,4 +1,5 @@
import { readFileSync } from "node:fs";
+import { performance } from "node:perf_hooks";
import { pathToFileURL } from "node:url";
import type { HarnessV1NetworkSandboxSession } from "@ai-sdk/harness";
@@ -36,12 +37,12 @@ export function createAuthoringAgent(subject: {
readonly dependencyDigest: string;
}): Agent {
return {
- name: subject.name,
+ name: `codex-${subject.name}`,
displayName: "eve authoring harness",
getApiKeyEnvVar: () => "AI_GATEWAY_API_KEY",
getDefaultModel: () => AUTHORING_MODEL,
definition: {
- name: subject.name,
+ name: `codex-${subject.name}`,
displayName: "eve authoring harness",
defaultModel: AUTHORING_MODEL,
o11yAgentName: HARNESS_NAME,
@@ -67,13 +68,13 @@ export function createAuthoringAgent(subject: {
env: {
EVE_INIT_PACKAGE_SPEC: EVE_PACKAGE_PATH,
[AUTHORING_EVAL_DIRECTORY_ENV]: AUTHORING_EVAL_DIRECTORY,
- ...Object.assign({}, ...setups.map((setup) => setup.environment ?? {})),
},
log,
});
const startedAt = Date.now();
const commands: string[] = [];
const transcript: AuthoringTranscriptEntry[] = [];
+ const turnTimings: AuthoringTurnTiming[] = [];
let session: HarnessAgentSession | undefined;
let activeSandbox: HarnessV1NetworkSandboxSession | undefined;
let workspace: string | undefined;
@@ -86,7 +87,7 @@ export function createAuthoringAgent(subject: {
if (options.model !== undefined) Object.assign(harnessOptions, { model: options.model });
const agent = new HarnessAgent({
- id: "eve-benchmark",
+ id: "codex-eve-benchmark",
harness: createCodex(harnessOptions),
sandbox,
sandboxConfig: {
@@ -138,14 +139,19 @@ export function createAuthoringAgent(subject: {
send: async (prompt) => {
transcript.push({ role: "user", content: prompt });
if (verbose) console.log(`[user] ${prompt}`);
- const result = verbose
- ? await streamTurn(agent, session!, prompt, options.timeout, options.signal)
- : await agent.generate({
- session: session!,
- prompt,
- timeout: options.timeout,
- abortSignal: options.signal,
- });
+ const result = await streamTurn(
+ agent,
+ session!,
+ prompt,
+ options.timeout,
+ options.signal,
+ verbose,
+ );
+ turnTimings.push({
+ elapsedMs: result.elapsedMs,
+ index: turnTimings.length + 1,
+ steps: result.steps,
+ });
transcript.push({ role: "assistant", content: result.text });
commands.push(...shellCommands(result.toolCalls));
return { text: result.text, toolCalls: result.toolCalls };
@@ -155,7 +161,10 @@ export function createAuthoringAgent(subject: {
const context = setupContext(activeSandbox, workspace);
await context.write(
`${AGENT_EVAL_DIRECTORY}/results.json`,
- JSON.stringify({ o11y: { shellCommands: commands.map((command) => ({ command })) } }),
+ JSON.stringify({
+ o11y: { shellCommands: commands.map((command) => ({ command })) },
+ timing: { agentTurns: turnTimings, totalAgentElapsedMs: sumTurnTimings(turnTimings) },
+ }),
);
await context.write(
`${AGENT_EVAL_DIRECTORY}/harness-transcript.json`,
@@ -203,6 +212,13 @@ export function createAuthoringAgent(subject: {
),
);
const scriptsPassed = Object.values(scriptsResults).every((result) => result.success);
+ scriptsResults.timing = {
+ success: true,
+ output: JSON.stringify({
+ agentTurns: turnTimings,
+ totalAgentElapsedMs: sumTurnTimings(turnTimings),
+ }),
+ };
log(`[result] ${test.exitCode === 0 && scriptsPassed ? "passed" : "failed"}`);
return {
success: test.exitCode === 0 && scriptsPassed,
@@ -240,30 +256,64 @@ export function createAuthoringAgent(subject: {
};
}
+interface AuthoringToolTiming {
+ readonly command: string;
+ readonly elapsedMs: number;
+ readonly startedAtMs: number;
+}
+
+interface AuthoringTurnTiming {
+ readonly elapsedMs: number;
+ readonly index: number;
+ readonly steps: readonly AuthoringToolTiming[];
+}
+
async function streamTurn(
agent: HarnessAgent,
session: HarnessAgentSession,
prompt: string,
timeout: number,
- abortSignal?: AbortSignal,
-): Promise<AuthoringTurn> {
+ abortSignal: AbortSignal | undefined,
+ verbose: boolean,
+): Promise<AuthoringTurn & { elapsedMs: number; steps: readonly AuthoringToolTiming[] }> {
+ const startedAt = performance.now();
const result = await agent.stream({ session, prompt, timeout, abortSignal });
+ const toolStarts = new Map<string, { command: string; startedAtMs: number }>();
+ const steps: AuthoringToolTiming[] = [];
let lineOpen = false;
for await (const part of result.fullStream) {
if (part.type === "text-delta") {
- if (!lineOpen) {
- process.stdout.write("[assistant] ");
- lineOpen = true;
+ if (verbose) {
+ if (!lineOpen) {
+ process.stdout.write("[assistant] ");
+ lineOpen = true;
+ }
+ process.stdout.write(part.text);
}
- process.stdout.write(part.text);
} else if (part.type === "tool-call") {
- if (lineOpen) process.stdout.write("\n");
+ if (verbose && lineOpen) process.stdout.write("\n");
lineOpen = false;
- console.log(`[tool] ${formatToolCall(part.toolName, part.input)}`);
+ const command = formatToolCall(part.toolName, part.input);
+ toolStarts.set(part.toolCallId, { command, startedAtMs: performance.now() - startedAt });
+ if (verbose) console.log(`[tool] ${command}`);
+ } else if (part.type === "tool-result") {
+ const tool = toolStarts.get(part.toolCallId);
+ if (tool !== undefined) {
+ steps.push({
+ command: tool.command,
+ elapsedMs: performance.now() - startedAt - tool.startedAtMs,
+ startedAtMs: tool.startedAtMs,
+ });
+ }
}
}
- if (lineOpen) process.stdout.write("\n");
- return { text: await result.text, toolCalls: await result.toolCalls };
+ if (verbose && lineOpen) process.stdout.write("\n");
+ return {
+ text: await result.text,
+ toolCalls: await result.toolCalls,
+ elapsedMs: performance.now() - startedAt,
+ steps,
+ };
}
function formatToolCall(name: string, input: unknown): string {
@@ -334,6 +384,10 @@ async function assertAgentGuidance(context: AuthoringSetupContext): Promise<void
await context.run("test -s AGENTS.md && test -s CLAUDE.md && grep -Fq '@AGENTS.md' CLAUDE.md");
}
+function sumTurnTimings(turns: ReadonlyArray<{ elapsedMs: number }>): number {
+ return turns.reduce((total, turn) => total + turn.elapsedMs, 0);
+}
+
function shellCommands(toolCalls: ReadonlyArray<{ input: unknown }>): string[] {
return toolCalls.flatMap((call) => {
if (typeof call.input !== "object" || call.input === null) return [];
diff --git a/docs/reference/cli.md b/docs/reference/cli.md
index f04ab471d..115e2c611 100644
--- a/docs/reference/cli.md
+++ b/docs/reference/cli.md
@@ -324,17 +324,23 @@ eve sweeps the store when a session finishes and when the dev server starts, evi
```bash
eve link
+eve link --non-interactive --project <name-or-id> [--team <team-id-or-slug>]
```
-Links the current directory to a Vercel project. After selecting a team, you can create a project named for the agent or link an existing project. The existing-project picker shows recent projects; type a project name and choose **Search for '<name>'** to search the rest of that team's projects. Vercel links the resolved project, eve verifies its project ID, and then pulls the project's environment so an AI Gateway credential (`VERCEL_OIDC_TOKEN` or `AI_GATEWAY_API_KEY`) lands in `.env.local`. Running it again re-links: the pickers always run, and the new choice wins. The command is interactive only; in CI, use `vercel link --project <name> --yes --non-interactive` instead. A running `eve dev` reloads env files automatically, so you don't need to restart after the pull.
+Links the current directory to a Vercel project. After selecting a team, you can create a project named for the agent or link an existing project. The existing-project picker shows recent projects; type a project name and choose **Search for '<name>'** to search the rest of that team's projects. Vercel links the resolved project, eve verifies its project ID, and then pulls the project's environment so an AI Gateway credential (`VERCEL_OIDC_TOKEN` or `AI_GATEWAY_API_KEY`) lands in `.env.local`. Running it again re-links: the pickers always run, and the new choice wins.
+
+For CI or an agent, pass `--non-interactive` and `--project`. `--project` accepts the same Vercel project name or ID as `vercel link`; `--team` accepts its team ID or slug. The command never opens a picker or browser in this mode. A running `eve dev` reloads env files automatically, so you don't need to restart after the pull.
## `eve deploy`
```bash
eve deploy
+eve deploy --non-interactive --yes [--project <name-or-id>] [--team <team-id-or-slug>]
```
-Deploys the agent to Vercel production (`vercel deploy --prod`), installing dependencies first and pulling environment variables after. An already-linked project deploys with or without a TTY (non-interactive runs pass the non-interactive `vercel` flags). When a terminal is present, an unlinked deployment signs in to Vercel if needed and then walks the `eve link` pickers; otherwise, it exits with guidance.
+Deploys the agent to Vercel production (`vercel deploy --prod`), installing dependencies first and pulling environment variables after. An already-linked project deploys with or without a TTY. When a terminal is present, an unlinked deployment signs in to Vercel if needed and then walks the `eve link` pickers.
+
+For CI or an agent, pass `--non-interactive --yes`. `--yes` explicitly confirms the production deployment. With `--project`, eve links that Vercel project and pulls its environment before deploying; `--team` has the same ID-or-slug semantics as `eve link`. Without `--project`, the directory must already be linked. The non-interactive mode never opens a picker, browser, or login flow.
## `eve eval`
diff --git a/packages/eve/src/cli/commands/deploy.ts b/packages/eve/src/cli/commands/deploy.ts
index e9bc17566..e5cc9d715 100644
--- a/packages/eve/src/cli/commands/deploy.ts
+++ b/packages/eve/src/cli/commands/deploy.ts
@@ -2,6 +2,11 @@ import { runDeployFlow, type DeployFlowDeps } from "#setup/flows/deploy.js";
import { createPrompter, type Prompter } from "#setup/prompter.js";
import { hasInteractiveTerminal } from "./preconditions.js";
+import {
+ isNonInteractiveProjectCommand,
+ runNonInteractiveLink,
+ type VercelProjectCliOptions,
+} from "./vercel-non-interactive.js";
export interface DeployCliLogger {
error(message: string): void;
@@ -21,23 +26,39 @@ const defaultDependencies: DeployCommandDependencies = {
/**
* `eve deploy`: deploy the agent to Vercel production. An already-linked
- * project deploys straight away (interactively or not); an unlinked one walks
- * the same team/project pickers as onboarding when a terminal is present, and
- * refuses with `eve link` guidance otherwise. The flow itself is
+ * project deploys straight away (interactively or not); an unlinked interactive
+ * run walks the same team/project pickers as onboarding. A non-interactive
+ * caller can name a project to link before deployment. The flow itself is
* {@link runDeployFlow}, shared with the dev TUI's `/deploy`.
*/
export async function runDeployCommand(
logger: DeployCliLogger,
appRoot: string,
dependencies: DeployCommandDependencies = defaultDependencies,
+ options: VercelProjectCliOptions & { yes?: boolean } = {},
): Promise<void> {
+ if (isNonInteractiveProjectCommand(options)) {
+ if (options.yes !== true) {
+ logger.error(
+ "`eve deploy --non-interactive` requires `--yes` to confirm production deployment.",
+ );
+ process.exitCode = 1;
+ return;
+ }
+ if (options.project !== undefined) {
+ if (!(await runNonInteractiveLink({ logger, appRoot, options }))) return;
+ }
+ }
+
const prompter = dependencies.createPrompter?.() ?? createPrompter();
prompter.intro("Deploy your eve agent to Vercel");
try {
const result = await runDeployFlow({
appRoot,
prompter,
- interactive: dependencies.hasInteractiveTerminal(),
+ interactive: isNonInteractiveProjectCommand(options)
+ ? false
+ : dependencies.hasInteractiveTerminal(),
deps: dependencies.flowDeps,
});
if (result.kind === "needs-link") {
diff --git a/packages/eve/src/cli/commands/link.ts b/packages/eve/src/cli/commands/link.ts
index 909a76734..2359adb3a 100644
--- a/packages/eve/src/cli/commands/link.ts
+++ b/packages/eve/src/cli/commands/link.ts
@@ -2,6 +2,11 @@ import { runLinkFlow, type LinkFlowDeps } from "#setup/flows/link.js";
import { createPrompter, type Prompter } from "#setup/prompter.js";
import { hasInteractiveTerminal } from "./preconditions.js";
+import {
+ isNonInteractiveProjectCommand,
+ runNonInteractiveLink,
+ type VercelProjectCliOptions,
+} from "./vercel-non-interactive.js";
export interface LinkCliLogger {
error(message: string): void;
@@ -24,14 +29,19 @@ const defaultDependencies: LinkCommandDependencies = {
* when one is already linked), run `vercel link` for the resolved project,
* then pull env so the AI Gateway credential lands in `.env.local`. The flow
* itself is {@link runLinkFlow}, shared with the dev TUI `/model` menu's
- * provider row. Interactive only: the pickers are the point of the command, so
- * a non-TTY run refuses with guidance instead of guessing a project.
+ * provider row. Non-interactive callers name the Vercel project explicitly;
+ * interactive callers use the eve-owned pickers.
*/
export async function runLinkCommand(
logger: LinkCliLogger,
appRoot: string,
dependencies: LinkCommandDependencies = defaultDependencies,
+ options: VercelProjectCliOptions = {},
): Promise<void> {
+ if (isNonInteractiveProjectCommand(options)) {
+ await runNonInteractiveLink({ logger, appRoot, options });
+ return;
+ }
if (!dependencies.hasInteractiveTerminal()) {
logger.error(
"`eve link` needs an interactive terminal to pick the team and project. In CI, run `vercel link --project <name> --yes --non-interactive` instead.",
diff --git a/packages/eve/src/cli/commands/register-project-commands.ts b/packages/eve/src/cli/commands/register-project-commands.ts
index 9890cb1df..33e89cf9e 100644
--- a/packages/eve/src/cli/commands/register-project-commands.ts
+++ b/packages/eve/src/cli/commands/register-project-commands.ts
@@ -14,15 +14,29 @@ export function registerProjectCommands(input: {
}): void {
applicationCommand(input.program.command("link"), input.applicationContext)
.description("Link this directory to a Vercel project and pull AI Gateway credentials.")
- .action(async () => {
+ .option("--non-interactive", "Run without interactive prompts")
+ .option("--project <name-or-id>", "Vercel project name or ID")
+ .option("--team <team-id-or-slug>", "Vercel team ID or slug")
+ .action(async (options: { nonInteractive?: boolean; project?: string; team?: string }) => {
const { runLinkCommand } = await import("./link.js");
- await runLinkCommand(input.logger, input.applicationContext.root);
+ await runLinkCommand(input.logger, input.applicationContext.root, undefined, options);
});
applicationCommand(input.program.command("deploy"), input.applicationContext)
.description("Deploy the agent to Vercel production (links first if needed).")
- .action(async () => {
- const { runDeployCommand } = await import("./deploy.js");
- await runDeployCommand(input.logger, input.applicationContext.root);
- });
+ .option("--non-interactive", "Run without interactive prompts")
+ .option("--project <name-or-id>", "Vercel project name or ID")
+ .option("--team <team-id-or-slug>", "Vercel team ID or slug")
+ .option("-y, --yes", "Confirm a non-interactive production deployment")
+ .action(
+ async (options: {
+ nonInteractive?: boolean;
+ project?: string;
+ team?: string;
+ yes?: boolean;
+ }) => {
+ const { runDeployCommand } = await import("./deploy.js");
+ await runDeployCommand(input.logger, input.applicationContext.root, undefined, options);
+ },
+ );
}
diff --git a/packages/eve/src/cli/commands/vercel-non-interactive.test.ts b/packages/eve/src/cli/commands/vercel-non-interactive.test.ts
new file mode 100644
index 000000000..595d401a3
--- /dev/null
+++ b/packages/eve/src/cli/commands/vercel-non-interactive.test.ts
@@ -0,0 +1,70 @@
+import { afterEach, describe, expect, test, vi } from "vitest";
+
+import {
+ runNonInteractiveLink,
+ type NonInteractiveLinkDependencies,
+} from "./vercel-non-interactive.js";
+
+class TestLogger {
+ readonly errors: string[] = [];
+ readonly logs: string[] = [];
+
+ error(message: string): void {
+ this.errors.push(message);
+ }
+
+ log(message: string): void {
+ this.logs.push(message);
+ }
+}
+
+function dependencies(): NonInteractiveLinkDependencies {
+ return {
+ isEveProject: vi.fn(async () => true),
+ runVercel: vi.fn(async () => true),
+ runVercelEnvPull: vi.fn(async () => true),
+ };
+}
+
+afterEach(() => {
+ process.exitCode = undefined;
+});
+
+describe("runNonInteractiveLink", () => {
+ test("requires the project Vercel requires for a non-interactive link", async () => {
+ const logger = new TestLogger();
+ const deps = dependencies();
+
+ await runNonInteractiveLink({
+ logger,
+ appRoot: "/agent",
+ options: { nonInteractive: true },
+ dependencies: deps,
+ });
+
+ expect(logger.errors).toEqual([
+ "`eve link --non-interactive` requires `--project <name-or-id>`.",
+ ]);
+ expect(deps.runVercel).not.toHaveBeenCalled();
+ expect(process.exitCode).toBe(1);
+ });
+
+ test("links the selected project and pulls its environment without stdin", async () => {
+ const logger = new TestLogger();
+ const deps = dependencies();
+
+ await runNonInteractiveLink({
+ logger,
+ appRoot: "/agent",
+ options: { nonInteractive: true, project: "wayfinder", team: "acme" },
+ dependencies: deps,
+ });
+
+ expect(deps.runVercel).toHaveBeenCalledWith(
+ ["link", "--project", "wayfinder", "--team", "acme", "--yes"],
+ { cwd: "/agent", nonInteractive: true },
+ );
+ expect(deps.runVercelEnvPull).toHaveBeenCalledWith("/agent", undefined, undefined, true);
+ expect(logger.logs).toEqual(["Project linked."]);
+ });
+});
diff --git a/packages/eve/src/cli/commands/vercel-non-interactive.ts b/packages/eve/src/cli/commands/vercel-non-interactive.ts
new file mode 100644
index 000000000..de056e584
--- /dev/null
+++ b/packages/eve/src/cli/commands/vercel-non-interactive.ts
@@ -0,0 +1,72 @@
+import { runVercelEnvPull } from "#setup/run-vercel-link.js";
+import { isEveProject } from "#setup/scaffold/index.js";
+import { runVercel } from "#setup/primitives/index.js";
+
+import { NOT_AN_AGENT_MESSAGE } from "./preconditions.js";
+
+export interface VercelNonInteractiveLogger {
+ error(message: string): void;
+ log(message: string): void;
+}
+
+export interface VercelProjectCliOptions {
+ nonInteractive?: boolean;
+ project?: string;
+ team?: string;
+}
+
+export interface NonInteractiveLinkDependencies {
+ isEveProject: typeof isEveProject;
+ runVercel: typeof runVercel;
+ runVercelEnvPull: typeof runVercelEnvPull;
+}
+
+const defaultDependencies: NonInteractiveLinkDependencies = {
+ isEveProject,
+ runVercel,
+ runVercelEnvPull,
+};
+
+export function isNonInteractiveProjectCommand(options: VercelProjectCliOptions): boolean {
+ return options.nonInteractive === true;
+}
+
+/** Links a named Vercel project and refreshes its local environment without a prompt. */
+export async function runNonInteractiveLink(input: {
+ logger: VercelNonInteractiveLogger;
+ appRoot: string;
+ options: VercelProjectCliOptions;
+ dependencies?: NonInteractiveLinkDependencies;
+}): Promise<boolean> {
+ const { appRoot, logger, options } = input;
+ const dependencies = input.dependencies ?? defaultDependencies;
+ if (!(await dependencies.isEveProject(appRoot))) {
+ logger.error(NOT_AN_AGENT_MESSAGE);
+ process.exitCode = 1;
+ return false;
+ }
+ if (options.project === undefined) {
+ logger.error("`eve link --non-interactive` requires `--project <name-or-id>`.");
+ process.exitCode = 1;
+ return false;
+ }
+
+ const args = [
+ "link",
+ "--project",
+ options.project,
+ ...(options.team === undefined ? [] : ["--team", options.team]),
+ "--yes",
+ ];
+ if (!(await dependencies.runVercel(args, { cwd: appRoot, nonInteractive: true }))) {
+ process.exitCode = 1;
+ return false;
+ }
+ if (!(await dependencies.runVercelEnvPull(appRoot, undefined, undefined, true))) {
+ logger.error("Vercel project linked, but pulling environment variables did not complete.");
+ process.exitCode = 1;
+ return false;
+ }
+ logger.log("Project linked.");
+ return true;
+}
diff --git a/packages/eve/src/setup/run-vercel-link.ts b/packages/eve/src/setup/run-vercel-link.ts
index eaa06cf5c..4d40e9312 100644
--- a/packages/eve/src/setup/run-vercel-link.ts
+++ b/packages/eve/src/setup/run-vercel-link.ts
@@ -12,6 +12,12 @@ export async function runVercelEnvPull(
projectRoot: string,
onOutput?: VercelOutputHandler,
signal?: AbortSignal,
+ nonInteractive = false,
): Promise<boolean> {
- return runVercel(["env", "pull", "--yes"], { cwd: projectRoot, onOutput, signal });
+ return runVercel(["env", "pull", "--yes"], {
+ cwd: projectRoot,
+ nonInteractive,
+ onOutput,
+ signal,
+ });
}
diff --git a/packages/eve/src/setup/scaffold/create/project.ts b/packages/eve/src/setup/scaffold/create/project.ts
index 42e07660c..cda6e4071 100644
--- a/packages/eve/src/setup/scaffold/create/project.ts
+++ b/packages/eve/src/setup/scaffold/create/project.ts
@@ -331,12 +331,18 @@ eve add channel/photon-imessage --non-interactive \\
--answer 'photon-project-name="eve · my-agent"'
\`\`\`
-Add \`--yes\` to accept recommended setup values and reduce setup round trips;
-explicit \`--answer\` values take precedence. Use the reported \`--skip-install\`
-continuation after installation.
+Never pass secrets in \`--answer\`; use the documented environment variable or
+secret store. Add \`--yes\` to accept recommended setup values and reduce setup
+round trips; explicit \`--answer\` values take precedence. Use the reported
+\`--skip-install\` continuation after installation.
+
A Vercel Connect setup may report \`eve link\` as a prerequisite; run it and
-retry the continuation. Never pass secrets in \`--answer\`; use the documented
-environment variable or secret store.
+retry the continuation. For a named Vercel project in CI or an agent run, use
+\`eve link --non-interactive --project <name-or-id> [--team <team-id-or-slug>]\`.
+To deploy non-interactively, use
+\`eve deploy --non-interactive --yes [--project <name-or-id>] [--team <team-id-or-slug>]\`.
+Use these eve commands instead of calling \`vercel\` directly; eve owns the
+link, environment pull, and deploy lifecycle.
An \`external_action\` event with \`blocking: true\` means the command is still
running while it waits for the user. Surface its URL and code, keep the process
diff --git a/packages/eve/src/setup/scaffold/index.integration.test.ts b/packages/eve/src/setup/scaffold/index.integration.test.ts
index ce62d11f6..7ebca5fc1 100644
--- a/packages/eve/src/setup/scaffold/index.integration.test.ts
+++ b/packages/eve/src/setup/scaffold/index.integration.test.ts
@@ -996,6 +996,9 @@ describe("scaffoldBaseProject", () => {
expect(agentsMd).toContain("next.command");
expect(agentsMd).toContain("--skip-install");
expect(agentsMd).toContain("eve link");
+ expect(agentsMd).toContain("eve link --non-interactive --project <name-or-id>");
+ expect(agentsMd).toContain("eve deploy --non-interactive --yes");
+ expect(agentsMd).toContain("instead of calling `vercel` directly");
expect(agentsMd).toContain("external_action_resolved");
// `vercel deploy` uploads everything a .vercelignore doesn't exclude, and
// the platform default-ignores only the .env.local variants — eve's dev