The Open Framework for Building Agents
fix(eve): offer Vercel CLI upgrade for Linq setup (#2423)
Colton Padden7c99773905e0
diff --git a/.changeset/bright-linq-vercel-cli.md b/.changeset/bright-linq-vercel-cli.mdnew file mode 100644index 000000000..39cf21794--- /dev/null+++ b/.changeset/bright-linq-vercel-cli.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Linq setup now recognizes Vercel CLI versions that lack required trigger options and offers to upgrade the CLI from the `/add` flow instead of reporting a generic connector failure.diff --git a/packages/eve/src/cli/dev/tui/setup-commands.test.ts b/packages/eve/src/cli/dev/tui/setup-commands.test.tsindex fa8dbcc7d..4ac42bdcd 100644--- a/packages/eve/src/cli/dev/tui/setup-commands.test.ts+++ b/packages/eve/src/cli/dev/tui/setup-commands.test.ts@@ -302,6 +302,34 @@ describe("runTuiSetupCommand", () => {);});+ it("prompts to upgrade when an installed registry item's setup needs a newer CLI", async () => {+ const flows = fakeFlows({+ runRegistryFlow: vi.fn<TuiSetupFlows["runRegistryFlow"]>(async () => {+ throw new RegistryFlowFailedError(+ new HumanActionRequiredError({+ kind: "vercel-cli-upgrade",+ command: "vercel upgrade",+ reason: "The installed Vercel CLI does not support Linq trigger options.",+ }),+ {+ kind: "done",+ addedItems: ["channel/linq"],+ items: [{ address: "channel/linq", title: "Linq", facts: [], output: [] }],+ facts: [],+ },+ );+ }),+ runInstallVercelCliFlow: vi.fn<TuiSetupFlows["runInstallVercelCliFlow"]>(async () => ({+ kind: "installed",+ })),+ });++ await expect(run({ command: "add", flows, upgradeChoice: "upgrade" })).resolves.toEqual({+ message: "Upgraded the Vercel CLI. Retry /add.",+ preserveFlowDiagnostics: false,+ });+ });+it("gives the manual upgrade command when the old-CLI prompt is declined", async () => {const flows = fakeFlows({runModelFlow: vi.fn<TuiSetupFlows["runModelFlow"]>(async () => {diff --git a/packages/eve/src/cli/dev/tui/setup-commands.ts b/packages/eve/src/cli/dev/tui/setup-commands.tsindex a86aa6582..ac3ddb674 100644--- a/packages/eve/src/cli/dev/tui/setup-commands.ts+++ b/packages/eve/src/cli/dev/tui/setup-commands.ts@@ -300,6 +300,13 @@ async function executeSetupCommand(}}} catch (error) {+ const actionableError = error instanceof RegistryFlowFailedError ? error.cause : error;+ const upgrade = await vercelCliUpgradeOutcome(actionableError, command, flows, {+ appRoot,+ prompter,+ signal,+ });+ if (upgrade !== undefined) return upgrade;if (error instanceof RegistryFlowFailedError) {const completed = error.completed;return {@@ -314,12 +321,6 @@ async function executeSetupCommand(preserveFlowDiagnostics: command !== "model",};}- const upgrade = await vercelCliUpgradeOutcome(error, command, flows, {- appRoot,- prompter,- signal,- });- if (upgrade !== undefined) return upgrade;// Provisioning steps (link, deploy, Slack) throw a Vercel human action when// `whoami` fails or a scope is denied. Route it to the in-TUI fix instead of// dumping the raw "Human action required" message.@@ -352,7 +353,7 @@ async function vercelCliUpgradeOutcome(let choice: "upgrade" | "later";try {choice = await input.prompter.select({- message: "Your Vercel CLI needs an update to list your teams. Upgrade now?",+ message: "Your Vercel CLI needs an update to continue setup. Upgrade now?",options: [{value: "upgrade",diff --git a/packages/eve/src/setup/integrations/linq/connect.test.ts b/packages/eve/src/setup/integrations/linq/connect.test.tsindex ff43f08e6..4c67c3d02 100644--- a/packages/eve/src/setup/integrations/linq/connect.test.ts+++ b/packages/eve/src/setup/integrations/linq/connect.test.ts@@ -1,6 +1,7 @@import { describe, expect, it, vi } from "vitest";import type { ChannelSetupLog } from "#setup/cli/index.js";+import { HumanActionRequiredError } from "#setup/human-action.js";import { parseCreatedLinqConnector, provisionLinqConnector } from "./connect.js";@@ -30,6 +31,32 @@ describe("Linq Connect provisioning", () => {).toEqual({ id: "scl_linq", uid: "linq/agent", phoneNumber: "+14155550123" });});+ it("requests a Vercel CLI upgrade when trigger options are unsupported", async () => {+ const runVercelCaptureStdout = vi.fn(async () => ({+ ok: false as const,+ stdout: "",+ stderr:+ "Vercel CLI 56.4.1 (Node.js 24.18.0)\nError: unknown or unexpected option: --trigger-event",+ }));++ await expect(+ provisionLinqConnector({+ log: log(),+ project: { orgId: "team_123", projectId: "prj_123" },+ projectRoot: "/project",+ slug: "agent",+ deps: { runVercel: vi.fn(), runVercelCaptureStdout },+ }),+ ).rejects.toEqual(+ new HumanActionRequiredError({+ kind: "vercel-cli-upgrade",+ command: "vercel upgrade",+ reason:+ "The installed Vercel CLI does not support the trigger options Linq setup needs. Upgrade it and retry.",+ }),+ );+ });+it("creates a connector for an existing Linq account without exposing its token in argv", async () => {const runVercelCaptureStdout = vi.fn()diff --git a/packages/eve/src/setup/integrations/linq/connect.ts b/packages/eve/src/setup/integrations/linq/connect.tsindex d05b8a0ef..5085f69a4 100644--- a/packages/eve/src/setup/integrations/linq/connect.ts+++ b/packages/eve/src/setup/integrations/linq/connect.ts@@ -1,6 +1,7 @@import type { ChannelSetupLog } from "#setup/cli/index.js";import { createPromptCommandOutput, withPhase } from "#setup/cli/index.js";import type { ProcessOutputHandler } from "#setup/primitives/process-output.js";+import { HumanActionRequiredError } from "#setup/human-action.js";import { replaceConnectTrigger } from "#setup/connect-provisioning.js";import type { VercelProjectReference } from "#setup/project-resolution.js";import {@@ -53,6 +54,15 @@ export function parseCreatedLinqConnector(stdout: string): LinqConnectorRef | unfunction requireCreatedConnector(result: RunVercelCaptureResult): LinqConnectorRef {if (!result.ok) {+ const output = `${result.stderr ?? ""}\n${result.stdout}`;+ if (/(?:unknown|unexpected|invalid).*--trigger-event/iu.test(output)) {+ throw new HumanActionRequiredError({+ kind: "vercel-cli-upgrade",+ command: "vercel upgrade",+ reason:+ "The installed Vercel CLI does not support the trigger options Linq setup needs. Upgrade it and retry.",+ });+ }const detail = [result.stderr, result.stdout].find((value): value is string => value !== undefined && value.trim().length > 0,);