import{CURRENT_DIRECTORY_PROJECT_NAME,requireProjectPath}from"../state.js";import{isEveProject,scaffoldBaseProject}from"#setup/scaffold/index.js";function scaffold(i){let a=i.deps??{scaffoldBaseProject,isEveProject};return{id:`scaffold`,async gather(){return{headless:i.headless??!1}},async perform({state:n,input:r}){let{prompter:o}=i,s=n.projectPath.inPlace?CURRENT_DIRECTORY_PROJECT_NAME:n.agentName,c=requireProjectPath(n);if(r.headless&&!i.overwriteExisting&&await a.isEveProject(c))return o.log.message(`Existing Eve project detected; continuing setup...`),c;o.log.message(`Scaffolding project files...`);let l=await a.scaffoldBaseProject({projectName:s,model:n.modelId,byokProvider:n.modelWiring===`self`,targetDirectory:i.targetDirectory,overwriteExisting:i.overwriteExisting,onOverwriteFile:e=>o.log.warning(`Overwrote ${e}`),evePackageVersion:i.evePackageVersion});return o.log.success(`Scaffolded project at ${l}`),l},apply(e,t){return{...e,projectPath:{kind:`resolved`,inPlace:e.projectPath.inPlace,path:t}}}}}export{scaffold};