@oxgeneral/orch 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/{App-Q6LOPAZT.js → App-TTMII4MJ.js} +1 -1
  2. package/dist/{chunk-4MMHVHA6.js → chunk-LY3X2UHQ.js} +7 -3
  3. package/dist/{chunk-5YSW77VI.js → chunk-OLKQBQ4I.js} +20 -7
  4. package/dist/chunk-OLKQBQ4I.js.map +1 -0
  5. package/dist/{chunk-VG4465AG.js → chunk-XUZZJCKG.js} +6 -2
  6. package/dist/chunk-XUZZJCKG.js.map +1 -0
  7. package/dist/cli.js +1 -1
  8. package/dist/{container-LV3WOPMS.js → container-NS3YS47A.js} +1 -1
  9. package/dist/index.d.ts +6 -0
  10. package/dist/index.js +6 -6
  11. package/dist/{init-D4356W7G.js → init-6OVZBN6B.js} +1 -1
  12. package/dist/orchestrator-47LRXS6X.js +6 -0
  13. package/dist/{orchestrator-WLWIAFXH.js.map → orchestrator-47LRXS6X.js.map} +1 -1
  14. package/dist/orchestrator-R23BOZDZ.js +17 -0
  15. package/dist/run-PX7O3ILN.js +3 -0
  16. package/dist/{serve-4RT4HERL.js → serve-FTXAEZE4.js} +1 -1
  17. package/dist/{structured-logger-EXMGTUDB.js → structured-logger-RJ6VF35J.js} +2 -2
  18. package/dist/{task-6Z5P7ODZ.js → task-HEPJYY7D.js} +1 -1
  19. package/dist/{template-engine-42PKL5KD.js → template-engine-VLIOJ3WX.js} +1 -1
  20. package/dist/template-engine-XOH3FZPU.js +3 -0
  21. package/dist/{template-engine-5ZKVJMYA.js.map → template-engine-XOH3FZPU.js.map} +1 -1
  22. package/dist/{tui-GH3Z5CO4.js → tui-P6ZOPUMZ.js} +1 -1
  23. package/dist/workspace-manager-DG4IFFG3.js +4 -0
  24. package/dist/{workspace-manager-RH24FSNT.js → workspace-manager-KUU7UMMC.js} +84 -74
  25. package/dist/workspace-manager-KUU7UMMC.js.map +1 -0
  26. package/package.json +1 -1
  27. package/dist/chunk-5YSW77VI.js.map +0 -1
  28. package/dist/chunk-VG4465AG.js.map +0 -1
  29. package/dist/orchestrator-PSXVHP2L.js +0 -17
  30. package/dist/orchestrator-WLWIAFXH.js +0 -6
  31. package/dist/run-NE5E4JPW.js +0 -3
  32. package/dist/template-engine-5ZKVJMYA.js +0 -3
  33. package/dist/workspace-manager-RH24FSNT.js.map +0 -1
  34. package/dist/workspace-manager-VJ4FN5PJ.js +0 -3
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import {c,d}from'./chunk-3AXNSYCM.js';import {j}from'./chunk-ZMLF5HI5.js';import {l as l$1}from'./chunk-IKNBPOQL.js';import n from'path';import u from'fs/promises';var l=class{constructor(r,e){this.projectRoot=r;this.processManager=e;}async mergeBack(r){return new Promise(e=>{let{process:t}=this.processManager.spawn("git",["merge","--no-ff",r,"-m",`Merge ${r}`],{cwd:this.projectRoot}),o="",a=2e3,i=s=>{o.length<a&&(o+=s.toString());};t.stdout?.on("data",i),t.stderr?.on("data",i),t.on("close",s=>{if(s===0){e({success:true});return}let c=o.slice(0,1e3);if(!(c.includes("CONFLICT")||c.includes("Merge conflict"))){e({success:false,conflictInfo:c});return}try{let{process:f}=this.processManager.spawn("git",["merge","--abort"],{cwd:this.projectRoot});f.on("close",()=>{e({success:!1,conflictInfo:c});}),f.on("error",()=>{e({success:!1,conflictInfo:c});});}catch{e({success:false,conflictInfo:c});}}),t.on("error",s=>{e({success:false,conflictInfo:s.message});});})}};var y=class{constructor(r,e,t){this.projectRoot=r;this.orchestryDir=e;this.processManager=t;this.mergeStrategy=new l(r,t);}mergeStrategy;gitRepoChecked=false;isGitRepo=false;async prepare(r,e,t){let o=this.resolveMode(r,e,t);switch(o!=="shared"&&await this.requireGitRepo(o),o){case "shared":return {path:this.projectRoot};case "worktree":return this.prepareWorktree(r);case "isolated":return {path:await this.prepareIsolated(r)};default:return {path:this.projectRoot}}}async requireGitRepo(r){if(!this.gitRepoChecked){try{let{process:e}=this.processManager.spawn("git",["rev-parse","--is-inside-work-tree"],{cwd:this.projectRoot}),t=await new Promise(o=>{e.on("close",o),e.on("error",()=>o(1));});this.isGitRepo=t===0;}catch{this.isGitRepo=false;}this.isGitRepo&&(this.gitRepoChecked=true);}if(!this.isGitRepo)throw new l$1(`workspace_mode "${r}" requires a git repository`,`Run: git init && git add -A && git commit -m "Initial commit"
3
- Or set workspace_mode: shared in .orchestry/config.yml`)}async mergeBack(r){return this.mergeStrategy.mergeBack(r)}async cleanup(r,e){let t=n.join(this.orchestryDir,"workspaces",c(r));try{let{process:i}=this.processManager.spawn("git",["worktree","remove","--force",t],{cwd:this.projectRoot});await new Promise(s=>{i.on("close",()=>s()),i.on("error",()=>s());});}catch{}let o=e?(async()=>{try{let{process:i}=this.processManager.spawn("git",["branch","-D",e],{cwd:this.projectRoot});await new Promise(s=>{i.on("close",()=>s()),i.on("error",()=>s());});}catch{}})():Promise.resolve(),a=u.rm(t,{recursive:true,force:true}).catch(()=>{});await Promise.all([o,a]);}validate(r,e){d(r,e);}resolveMode(r,e,t){return r.workspace_mode??e.config.workspace_mode??t.defaults.agent.workspace_mode??"worktree"}async prepareWorktree(r){let e=n.join(this.orchestryDir,"workspaces",c(r.id));await j(n.dirname(e));let t=k(r.title)||c(r.id),o=`orchestry/${c(r.id)}/${t}`,{process:a}=this.processManager.spawn("git",["worktree","add",e,"-b",o],{cwd:this.projectRoot});await new Promise((s,c)=>{a.on("close",p=>{p===0?s():c(new l$1(`git worktree add failed with code ${p}`,"Run: git worktree prune && git branch | grep orchestry | xargs -r git branch -D"));}),a.on("error",c);});let i=n.join(e,".orchestry");return await u.rm(i,{recursive:true,force:true}).catch(()=>{}),{path:e,branch:o}}async prepareIsolated(r){let e=n.join(this.orchestryDir,"workspaces",c(r.id));await j(n.dirname(e));try{let{process:o}=this.processManager.spawn("git",["clone","--local","--no-hardlinks",".",e],{cwd:this.projectRoot});await new Promise((a,i)=>{o.on("close",s=>{s===0?a():i(new Error("git clone failed"));}),o.on("error",i);});}catch{let a=["-a",`--exclude-from=${n.join(this.orchestryDir,"workspace-exclude")}`,"./",`${e}/`],{process:i}=this.processManager.spawn("rsync",a,{cwd:this.projectRoot});await new Promise((s,c)=>{i.on("close",p=>{p===0?s():c(new Error(`rsync failed with code ${p}`));}),i.on("error",c);});}let t=n.join(e,".orchestry");return await u.rm(t,{recursive:true,force:true}).catch(()=>{}),e}};function k(d){return d.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40)}export{y as WorkspaceManager};