UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

1 lines 1.34 kB
import{hasInteractiveTerminal,validateWorkspaceProjectCommand}from"./preconditions.js";import{isNonInteractiveProjectCommand,runNonInteractiveLink}from"./vercel-non-interactive.js";import{isEveProject}from"#setup/scaffold/index.js";import{createPrompter}from"#setup/prompter.js";import{runLinkFlow}from"#setup/flows/link.js";const defaultDependencies={hasInteractiveTerminal,isEveProject};async function runLinkCommand(e,t,n=defaultDependencies,r={}){if(!await validateWorkspaceProjectCommand({appRoot:t,isEveProject:n.isEveProject,logger:e,workspaceMemberMessage:e=>`This agent belongs to the workspace at ${e.root}. Run \`eve link\` from the workspace root.`}))return;if(isNonInteractiveProjectCommand(r)){await runNonInteractiveLink({logger:e,appRoot:t,options:r});return}if(!n.hasInteractiveTerminal()){e.error("`eve link` needs an interactive terminal to pick the team and project. Name the project instead: `eve link --project <name-or-id> --non-interactive`."),process.exitCode=1;return}let i=n.createPrompter?.()??createPrompter();i.intro(`Link your eve agent to Vercel`);try{let e=await runLinkFlow({appRoot:t,prompter:i,projectSelection:`create-or-link`,deps:n.flowDeps});i.outro(e.kind===`cancelled`?`Cancelled.`:`Project linked.`)}catch(t){e.error(t instanceof Error?t.message:String(t)),process.exitCode=1}}export{runLinkCommand};