eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 2.08 kB
JavaScript
import{resolve}from"node:path";import{resolveInternalVercelServiceOutput}from"#cli/vercel-service-output.js";import{createCliTheme,renderCliTaggedLine}from"#cli/ui/output.js";import{EVE_INTERNAL_AGENT_WORKSPACE_MEMBER_ENV}from"#internal/application/build-output-environment.js";import{EVE_PUBLIC_ROUTE_PREFIX_ENV,normalizePublicRoutePrefix}from"#shared/public-route-prefix.js";function registerBuildCommand(e){let t=createCliTheme();e.program.command(`build`).hook(`preAction`,async()=>{(await e.applicationContext.resolveAgent()).kind!==`workspace`&&await e.applicationContext.resolve()}).description(`Build the current eve application.`).option(`--profile <path>`,`Write best-effort timing and output-size profile JSON to a file`).option(`--skip-sandbox-prewarm`,`Skip sandbox preparation; output may not be deployable`).action(async n=>{let{loadDevelopmentEnvironmentFiles:r}=await import(`#cli/dev/environment.js`);await r(e.applicationContext.root);let i=await e.applicationContext.resolveAgent();if(i.kind===`workspace`){if(n.profile!==void 0)throw Error(`Workspace builds do not support --profile. Run it from an individual agent directory.`);let{buildAgentWorkspace:r}=await import(`#internal/vercel/build-agent-workspace.js`),a=await r(i.workspace,{skipSandboxPrewarm:n.skipSandboxPrewarm});e.logger.log(renderCliTaggedLine(t,{message:`built output at ${a}`,tag:`build`,tone:`success`}));return}let a=e.buildHost??(await import(`#internal/nitro/host.js`)).buildApplication,o=n.profile===void 0?void 0:resolve(e.applicationContext.root,n.profile),s={publicRoutePrefix:normalizePublicRoutePrefix(process.env[EVE_PUBLIC_ROUTE_PREFIX_ENV]),skipSandboxPrewarm:n.skipSandboxPrewarm===!0,vercelServiceOutput:resolveInternalVercelServiceOutput(e.applicationContext.root),workspaceMember:i.kind===`workspace-member`||process.env[EVE_INTERNAL_AGENT_WORKSPACE_MEMBER_ENV]===`1`};o!==void 0&&(s.profileOutputPath=o);let c=await a(e.applicationContext.root,s);e.logger.log(renderCliTaggedLine(t,{message:`built output at ${c}`,tag:`build`,tone:`success`}))})}export{registerBuildCommand};