@codions/portta 0.0.0-next.20260918170630.sha-a23723d → 0.1.0
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.
- package/dist/{chunk-XIN6JF3W.js → chunk-3EZNE4MC.js} +1 -1
- package/dist/{chunk-VH65BJRC.js → chunk-4YGEG6YX.js} +1 -1
- package/dist/{chunk-LPWOE63H.js → chunk-OPVZAG2C.js} +3 -3
- package/dist/cli.js +3 -3
- package/dist/{dispatch-BL46YM5L.js → dispatch-ZCNGHCNP.js} +5 -5
- package/dist/{doctor-LRAIQXUC.js → doctor-7F6ZXPZE.js} +1 -1
- package/dist/documentation.json.gz +0 -0
- package/dist/host.js +1 -1
- package/dist/{init-JLXOONUQ.js → init-HGEXUJP3.js} +1 -1
- package/dist/{linear-commands-XJXHZQBJ.js → linear-commands-XGHGICI7.js} +1 -1
- package/dist/{oneshot-SD5K5VQF.js → oneshot-DL57ZA55.js} +1 -1
- package/dist/{project-commands-7KXT7LBS.js → project-commands-2N44CRGM.js} +1 -1
- package/dist/{run-commands-456H2HQD.js → run-commands-TCBNFJOT.js} +1 -1
- package/dist/runtime/VERSION +1 -1
- package/dist/{worktree-commands-TLWOXQXN.js → worktree-commands-F7REOKFJ.js} +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{q as a,t as m,v as d}from"./chunk-
|
|
3
|
+
import{q as a,t as m,v as d}from"./chunk-OPVZAG2C.js";import{a as c}from"./chunk-4TGTGGMK.js";import{c as u}from"./chunk-UX7P3YHF.js";import{a as i}from"./chunk-T3TSZO4I.js";import{a as o}from"./chunk-6J5HN4ZN.js";import{realpathSync as v}from"node:fs";import{dirname as P,resolve as g}from"node:path";var s=class extends Error{static{o(this,"CommandUsageError")}};function B(t){if(!t||t.length===0)return;let e={};for(let r of t){let n=r.indexOf("=");if(n<=0)throw new s("--env must use KEY=VALUE");e[r.slice(0,n)]=r.slice(n+1)}return e}o(B,"parseEnvOverrides");function x(t,e){return t instanceof Error?t.message.startsWith("HTTP")?t.message:t.message.includes("fetch")||t.message.includes("Unable to connect")?d(e):t.message:String(t)}o(x,"formatServerError");async function H(t,e){try{return await e()}catch(r){
|
|
4
4
|
throw new Error(x(r,t))}}o(H,"withServerConnection");function y(t=process.cwd()){try{let e=c("git",["rev-parse","--git-common-dir"],{cwd:t});if(e.success){let n=e.stdout.toString().trim();if(n)return P(g(t,n))}let r=c("git",["rev-parse","--show-toplevel"],{cwd:t});return r.success?r.stdout.toString().trim():null}catch{return null}}o(y,"resolveProjectRoot");function p(t){try{return v(t)}catch{return g(t)}}o(p,"canonicalizePath");async function b(t,e=process.cwd()){let r=a(t),n=y(e);if(!n)throw new s(
|
|
5
5
|
`Not inside a git repository, so ${i} can't tell which project this command targets. cd into a project served by ${i} (\`${u()} project ls\` lists them) and try again.`);let{projects:l}=await m(r).fetchProjects(),h=p(n),f=l.find(w=>p(w.path)===h);if(!f)throw new s(`This project (${n}) isn't served by ${i} on port ${t}. Run \`${u()} project add\` in it first.`);return`${r}/${f.prefix}`}o(b,"resolveProjectBaseUrl");async function I(t,e=process.cwd()){try{return(await b(t,e)).slice(a(t).length).replace(
|
|
6
6
|
/^\/+|\/+$/g,"")||void 0}catch{return}}o(I,"resolveProjectPrefix");export{s as a,B as b,x as c,H as d,b as e,I as f};
|
|
@@ -1870,7 +1870,7 @@ n.attached=!0,g.debug(`[ws] first resize (attaching) branch=${o} cols=${a.cols}
|
|
|
1870
1870
|
attachId=${n.attachId}`)}),async()=>{n.attachId&&(ew(n.attachId),await oa(n.attachId))}}};function mb(t,e){return t.map(r=>({path:r.path,accepts:i(n=>e.projects.get(n.prefix??"")!==void 0,"accepts"),handle:i((n,o)=>{let s=o.prefix??"",a=e.projects.get(s);if(a===void 0){n.close(1011,"project removed");return}e.sockets.track(s,n,r.handle(n,{params:o,project:a}))},"handle")}))}i(mb,"projectSocketRoutes");function hb(t){let e=new Map,r=new aa({registry:t.registry,port:t.projectHost.port,resolveRoot:i(s=>he(gt(s)),"resolveRoot"),assertAllowed:i(s=>Eu(s,t.projectAllowlist),"assertAllowed"),createRuntime:i(({projectDir:s,port:a,prefix:l})=>dy({projectDir:s,port:a,prefix:l}),"createRuntime"),createLoops:i(s=>{let a=sb(s.runtime,s.prefix,t.projectHost);return e.set(s.prefix,a),{startLight:i(()=>a.startLight(),"startLight"),stopLight:i(()=>{a.stopLight(),e.delete(s.prefix)},"stopLight"),startHeavy:i(()=>{},
|
|
1871
1871
|
"startHeavy"),stopHeavy:i(()=>{},"stopHeavy")}},"createLoops")}),n=new Fa((s,a)=>r.setActive(s,a)),o=Kw({manager:r,apps:e,allowlist:t.projectAllowlist,initTracker:new ia,closeSockets:i(s=>n.closeProject(s),"closeSockets")});return{app:zw({projects:o,hasValidToken:t.hasValidToken}),sockets:mb([ub,pb],{projects:e,sockets:n}),projects:o,loadProjects(s){if(r.loadPersisted(),!qo(s))return;let a=he(gt(s)),l=ns(a);if(!(!fb(l.config)&&!fb(l.localConfig)))try{r.addEphemeral(a)}catch(u){g.error(`[serve] f\
|
|
1872
1872
|
ailed to auto-add project ${a}: ${String(u)}`)}},async shutdown(){n.closeAll();let s=[...e.values()];await Promise.allSettled(s.map(a=>a.shutdownRuns())),r.stopAll()}}}i(hb,"createTaskflowHost");var UM=`/ws/modules/${wn.id}`;async function BM(t){let e=qo(t)?gt(t):t,r=await Bd();if(os(e).multiplexer!=="tmux")return;r.path&&$v(r.path),gb("tmux",["list-sessions"],{stdio:"ignore"}).status!==0&&(gb("tmux",["new-session","-d","-s","0"],{stdio:"ignore"}),g.info("Started tmux session")),Gy()}i(BM,"bootstrapMultiplexer");async function HM(t,e){let r=e.env[L.projectDir]??process.cwd();await BM(r),t.loadProjects(r),g.info(`[taskflow] serving ${t.projects.list().length} project(s)`)}i(HM,"startTask\
|
|
1873
|
-
flowHost");function FM(t){return ht({env:{...t.env,[L.hostStateDir]:t.stateDir}})}i(FM,"statePaths");function qM(t){let e=t.env,r=FM(t),n=ci(ai(t.stateDir)),o=new ee;return hb({projectHost:{port:af(e).port,workflowBuiltinsDir:ev(e).workflowBuiltinsDir,version:e.PORTTA_VERSION||"0.0.0-local",buildDate:"2026-09-18T17:
|
|
1873
|
+
flowHost");function FM(t){return ht({env:{...t.env,[L.hostStateDir]:t.stateDir}})}i(FM,"statePaths");function qM(t){let e=t.env,r=FM(t),n=ci(ai(t.stateDir)),o=new ee;return hb({projectHost:{port:af(e).port,workflowBuiltinsDir:ev(e).workflowBuiltinsDir,version:e.PORTTA_VERSION||"0.0.0-local",buildDate:"2026-09-18T17:59:56Z",environmentStore:Uy(r.database),hostEnvironmentProvider:new Jn,devContainerProvider:new ea,dockerfileEnvironmentProvider:new ra,processRunner:o,dockerServiceDiscovery:new La(o),
|
|
1874
1874
|
endpointExposure:Ly},registry:Zg(r.projectsRegistry),projectAllowlist:rw({spec:e[L.projectAllowlist],fallbackRoots:[jM()]}),hasValidToken:i(async s=>Mn(Nn(s.headers.get("authorization")),n),"hasValidToken")})}i(qM,"createDaemonTaskflowHost");function zM(t={}){let e=t.createHost??qM,r=t.start??HM,n=null,o=null,s=i(a=>{if(n)return n;a.env===process.env&&(process.env[L.hostStateDir]=a.stateDir),n=e(a);let l=n;return o=r(l,a).catch(u=>{g.error(`[taskflow] failed to start: ${u instanceof Error?u.message:
|
|
1875
1875
|
String(u)}`)}),l},"hostFor");return{manifest:wn,routes:i(a=>s(a).app,"routes"),ws:i(a=>s(a).sockets.map(l=>({path:`${UM}${l.path}`,accepts:l.accepts,handle:i((u,{params:d})=>l.handle(u,d),"handle")})),"ws"),close:i(async()=>{n&&(await o,await n.shutdown(),n=null,o=null)},"close")}}i(zM,"createTaskflowHostModule");var vb=zM();var bQ=[vb];export{wn as a,VU as b,ZU as c,Wn as d,HE as e,oB as f,sB as g,iB as h,PD as i,at as j,UD as k,BD as l,nS as m,oS as n,sS as o,iS as p,gp as q,VD as r,qE as s,zE as t,yt as u,VE as v,JE as w,YE as x,gl as y,XE as z,jh as A,uB as B,eC as C,dB as D,nC as E,vB as F,yB as G,bB as H,K as I,RB as J,PB as K,EB as L,CB as M,AB as N,IB as O,Js as P,iC as Q,Bh as R,_B as S,TB as T,WB as U,$B as V,OB as W,NB as X,MB as Y,DB as Z,LB as _,jB as $,UB as aa,BB as ba,_D as ca,TD as da,WD as ea,ND as fa,MD as ga,
|
|
1876
1876
|
DD as ha,Ro as ia,qh as ja,gC as ka,JB as la,YB as ma,XB as na,cL as oa,t1 as pa,r1 as qa,n1 as ra,o1 as sa,s1 as ta,i1 as ua,a1 as va,c1 as wa,wC as xa,p1 as ya,ac as za,dL as Aa,fL as Ba,hL as Ca,gL as Da,vL as Ea,yL as Fa,wL as Ga,kL as Ha,bL as Ia,SL as Ja,xL as Ka,b1 as La,c as Ma,Cp as Na,no as Oa,Ap as Pa,TL as Qa,WL as Ra,$L as Sa,C1 as Ta,A1 as Ua,I1 as Va,EC as Wa,_1 as Xa,Sl as Ya,M1 as Za,D1 as _a,L1 as $a,j1 as ab,U1 as bb,z1 as cb,G1 as db,BC as eb,K1 as fb,V1 as gb,HC as hb,FC as ib,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{B as g,D as E,F as w,Sb as S,Yb as T,_b as h,ia as b,na as A}from"./chunk-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import{B as g,D as E,F as w,Sb as S,Yb as T,_b as h,ia as b,na as A}from"./chunk-4YGEG6YX.js";import{a as k}from"./chunk-TA2XHP5D.js";import{k as u}from"./chunk-T3TSZO4I.js";import{a as n}from"./chunk-6J5HN4ZN.js";var f={success:0,failure:1,usage:2,precondition:3,refused:4},d=class extends Error{static{n(this,"CliError")}exitCode;hint;constructor(e,o=f.failure,r){super(e),this.name="CliError",this.exitCode=o,this.hint=r}},p=class extends d{static{n(this,"PreconditionError")}constructor(e,o){super(e,f.precondition,o)}},D=class extends d{static{n(this,"RefusedError")}constructor(e,o){super(e,f.refused,o)}},I=class extends d{static{n(this,"UsageError")}constructor(e,o){super(e,f.usage,o)}};var C={name:"@codions/portta",version:"0.1.0",description:"Machine-first CLI for a shared Docker development gateway",keywords:["docker","docker-compose","traefik","development","gateway","devcontainer","reverse-proxy","mcp"],license:"MIT",type:"module",bin:{portta:"dist/cli.js"},files:["dist"],publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},scripts:{build:"node --import tsx scripts/build.mjs",typecheck:"tsc -p tsconfig.json --noEmit",test:"vitest run",prepack:"npm run bui\
|
|
4
|
+
ld",prepublishOnly:"npm run typecheck && npm test"},engines:{node:">=24"},repository:{type:"git",url:"git+https://github.com/codions-labs/portta.git",directory:"packages/cli"},homepage:"https://github.com/codions-labs/portta#readme",bugs:"https://github.com/codions-labs/portta/issues",dependencies:{"@agentclientprotocol/claude-agent-acp":"^0.76.0","@agentclientprotocol/codex-acp":"^1.11.0","@anthropic-ai/claude-agent-sdk":"^0.3.163","@clack/prompts":"^1.1.0","@devcontainers/cli":"0.89.0","@model\
|
|
5
|
+
contextprotocol/sdk":"^1.30.0","better-sqlite3":"^12.11.1",commander:"14.0.2",execa:"9.6.1","pi-acp":"^0.0.33",systeminformation:"^5.33.8",ws:"8.19.0",yaml:"^2.8.2",zod:"4.5.4"},devDependencies:{"@types/node":"24.13.3",esbuild:"0.28.2","portta-contracts":"0.1.0","portta-core":"0.1.0","portta-host":"0.1.0","portta-mcp":"0.1.0",typescript:"7.0.2",vitest:"4.1.11",tsx:"4.23.13"}};var y=C.version,L="2026-09-18T17:59:56Z";function Q(){return`portta ${y}${L?` (built ${L})`:""}`}n(Q,"cliVersionLine");import{existsSync as j,readFileSync as B}from"node:fs";import{existsSync as c,readFileSync as P}from"node:fs";import{dirname as N,join as s,resolve as l}from"node:path";var $="0.0.0-local";function O(t){return c(s(t,"docker","compose","compose.yaml"))?c(s(t,"VERSION"))||c(s(t,"packages","cli","package.json")):!1}n(O,"isGatewayRoot");function M(t){let e=s(t,"VERSION");if(c(e))return P(e,"utf8").trim();let o=s(t,"packages","cli","package.json");if(c(o))return $;throw new p(`missing generated VERSION in ${t}`,"reinstall the @codions/portta npm package")}n(M,"versionForRoot");function U(){let t=process.env.HOME;return[process.env.PORTTA_HOME,t?s(t,"portta"):void 0,
|
|
6
6
|
"/opt/portta",t?s(t,".portta"):void 0,"/var/lib/portta"].filter(e=>!!e)}n(U,"wellKnownRoots");function v(t=process.cwd()){let e=process.env.PORTTA_ROOT;if(e&&O(l(e)))return l(e);let o=l(t);for(;;){if(O(o))return o;let r=N(o);if(r===o)break;o=r}for(let r of U())if(O(l(r)))return l(r);return null}n(v,"findGatewayRoot");function wt(t={}){let e=t.root?l(t.root):v();if(!e){if(t.required===!1){let i={...process.env,PORTTA_PROFILE:t.profile??process.env.PORTTA_PROFILE},m=g(i);return{root:process.cwd(),
|
|
7
7
|
env:i,config:m,composeFiles:[],version:y}}throw new p("no Portta installation found","run `portta setup`, set PORTTA_HOME, or run this inside the gateway directory")}let o=c(s(e,".env"))?b(P(s(e,".env"),"utf8")):new Map,r=A(o,process.env);for(let[i,m]of Object.entries(t.overrides??{}))r[i]=m;t.profile&&(r.PORTTA_PROFILE=t.profile),r.PORTTA_ROOT=e,w(r);let a=g(r);r.PORTTA_DOMAIN=a.domain,r.PORTTA_BIND_ADDRESS=a.bindAddress;let x=E(a);for(let i of x)if(!c(s(e,i)))throw new p(`missing compose file:\
|
|
8
8
|
${i}`);let R=M(e);return r.PORTTA_VERSION=R,{root:e,env:r,config:a,composeFiles:x,version:R}}n(wt,"gatewayContext");function bt(t){return["--project-directory",t.root,...t.composeFiles.flatMap(e=>["-f",s(t.root,e)])]}n(bt,"composeArguments");var _="/api/modules/taskflow",V="/ws/modules/taskflow";function G(t=process.env){let e=t[u.hostStateDir]?.trim();return e||T(v()??k({env:{...t}}))}n(G,"flowStateDir");function H(t,e=process.env){let o=e[u.host]?.trim()||"127.0.0.1",r=o==="0.0.0.0"||o==="::"?"127.0.0.1":o;return`http://${r.includes(":")?`[${r}]`:r}:${t}`}n(H,"daemonOrigin");function Ht(t,e=process.env){return`${H(t,e)}${_}`}n(Ht,"daemonBaseUrl");function K(t=process.env){let e=h(G(t));if(j(e))try{let o=B(e,"utf8").trim();if(o)return o}catch{}
|
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as od,b as w,c as _n,d as vo}from"./chunk-PTKKSRMI.js";import{a as wd,b as yd}from"./chunk-HB5T7XDN.js";import{a as Vr}from"./chunk-6TV2V7RR.js";import{a as je,b as le,c as R,d as N,e as _,f as yo,g as Qu,h as Sn,i as ed,j as td,k as Hr,l as k,m as ie,n as ba,o as dd,p as md,r as fd}from"./chunk-
|
|
3
|
+
import{a as od,b as w,c as _n,d as vo}from"./chunk-PTKKSRMI.js";import{a as wd,b as yd}from"./chunk-HB5T7XDN.js";import{a as Vr}from"./chunk-6TV2V7RR.js";import{a as je,b as le,c as R,d as N,e as _,f as yo,g as Qu,h as Sn,i as ed,j as td,k as Hr,l as k,m as ie,n as ba,o as dd,p as md,r as fd}from"./chunk-OPVZAG2C.js";import"./chunk-4TGTGGMK.js";import{a as hd,b as wa,d as gd,e as bd}from"./chunk-UX7P3YHF.js";import{R as ld,i as cd}from"./chunk-WNZR7VOO.js";
|
|
4
4
|
import{$ as Mp,$a as Tu,$b as ga,A as Kt,Aa as go,Ab as Wu,Ba as eu,Bb as ua,C as _p,Ca as tu,Cb as Zu,Da as ou,Db as Ku,E as vt,Ea as nu,Eb as da,Fa as ru,Fb as ma,G as Jt,Ga as su,Gb as Ju,H as Rt,Ha as iu,Hb as Yu,I as b,Ia as au,Ib as Xu,J as Cp,Ja as cu,Jb as nd,K as Or,Ka as lu,Kb as rd,L as Le,La as pu,Lb as sd,M as hn,Ma as s,N as Pp,Na as bo,O as Tp,Oa as vu,P as Ki,Pa as ku,Q as Ji,Qa as xu,R as Rp,Ra as Su,S as $p,Sa as aa,T as Ep,Ta as _u,U as jp,Ua as Dr,V as Op,Va as Cu,Vb as qr,W as Ap,
|
|
5
5
|
Wa as ca,X as zp,Xa as Pu,Y as Ip,Ya as Mr,Yb as ad,Z as Dp,Za as Et,Zb as Ur,_ as Yi,_a as wo,_b as Fr,a as lp,aa as Np,ab as Ru,b as fo,ba as Lp,bb as vn,c as pp,ca as Ar,cb as kn,d as _e,da as Hp,db as Nr,e as Rr,ea as qp,eb as $u,f as up,fa as Up,fb as Eu,g as dp,ga as Fp,gb as ju,h as mp,ha as Vp,hb as Ou,i as fp,ia as $t,ib as Au,j as $r,ja as Gp,jb as zu,k as ho,ka as Yt,kb as Iu,l as Er,la as xe,lb as Du,m as Zi,ma as Ze,mb as Mu,n as hp,na as zr,nb as Nu,o as gp,oa as Bp,ob as Lu,p as bp,
|
|
6
|
-
pa as Ir,pb as Hu,q as wp,qa as Xi,qb as qu,r as yp,ra as Wp,rb as la,s as vp,sa as Zp,sb as Uu,t as kp,ta as Kp,tb as Fu,u as Ce,ua as Jp,ub as Vu,v as xp,va as Yp,vb as xn,w as jr,wa as Xp,wb as pa,x as mn,xa as gn,xb as Lr,y as fn,ya as bn,yb as Gu,z as Sp,za as Qp,zb as Bu}from"./chunk-
|
|
6
|
+
pa as Ir,pb as Hu,q as wp,qa as Xi,qb as qu,r as yp,ra as Wp,rb as la,s as vp,sa as Zp,sb as Uu,t as kp,ta as Kp,tb as Fu,u as Ce,ua as Jp,ub as Vu,v as xp,va as Yp,vb as xn,w as jr,wa as Xp,wb as pa,x as mn,xa as gn,xb as Lr,y as fn,ya as bn,yb as Gu,z as Sp,za as Qp,zb as Bu}from"./chunk-4YGEG6YX.js";import"./chunk-VDSWNWUY.js";import"./chunk-5SBYE3YH.js";import"./chunk-CFWGQ7VJ.js";import{a as pd,b as ud}from"./chunk-QS5PHDYT.js";import"./chunk-IILMQFWO.js";
|
|
7
7
|
import"./chunk-GI2EUNAK.js";import"./chunk-EYT7VTYA.js";import"./chunk-MH5YJA5O.js";import"./chunk-QBKADN76.js";import"./chunk-EFZZFIRZ.js";import{A as ia,B as yu,b as y,f as J,h as ge,i as gu,j as ce,k as Z,m as j,o as Pe,p as ee,q as ra,r as sa,t as Q,u as Ae,v as A,w as bu,x as se,z as wu}from"./chunk-SBVO6RXF.js";import"./chunk-EH7H7D7J.js";import{B as oa,D as wn,F as yn,f as Qi,g as uu,h as du,i as mu,l as ea,uf as na,va as fu,xb as hu,z as ta}from"./chunk-O6U47HHQ.js";
|
|
8
8
|
import{a as ny}from"./chunk-FRQCKCCK.js";import"./chunk-TA2XHP5D.js";import{a as fa,h as Cn,i as id,j as ha,k as rt,n as Te}from"./chunk-T3TSZO4I.js";import"./chunk-UUSUJUAD.js";import{a as c,b as dn,c as nt,e as Tr}from"./chunk-6J5HN4ZN.js";var Pn=nt(va=>{var Gr=class extends Error{static{c(this,"CommanderError")}constructor(e,o,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=o,this.exitCode=e,this.nestedError=void 0}},ya=class extends Gr{static{c(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};va.CommanderError=Gr;va.InvalidArgumentError=ya});var Br=nt(xa=>{var{InvalidArgumentError:ry}=Pn(),ka=class{static{c(this,"Argument")}constructor(e,o){switch(this.description=o||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){
|
|
9
9
|
return this._name}_collectValue(e,o){return o===this.defaultValue||!Array.isArray(o)?[e]:(o.push(e),o)}default(e,o){return this.defaultValue=e,this.defaultValueDescription=o,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(o,n)=>{if(!this.argChoices.includes(o))throw new ry(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(o,n):o},this}argRequired(){return this.required=!0,this}argOptional(){return this.
|
|
@@ -537,7 +537,7 @@ name)));return o}c(Oh,"newestSourceMtime");function NS(t){if(!MS(t))return!1;let
|
|
|
537
537
|
process.exit(e.exitCode)}c(zh,"reexecBuiltCli");import{existsSync as Lo}from"node:fs";import{join as Ho}from"node:path";import{existsSync as KS,readFileSync as JS}from"node:fs";import{join as YS}from"node:path";var LS=[["run","Run a workflow file or registered workflow with the standalone engine"],["validate","Validate a workflow file or registered workflow"],["save","Save a workflow file into the registry"],["doctor","Check the standalone workflow engine"],["guide","Print the workflow authoring guide"]],HS="(run with --help for usage)";function qS(t){let e=Number.parseInt(t,10);if(Number.isNaN(e))throw new zd("requires a numeric value");return e}c(qS,"parsePort");function Dc(t,e){return[...e??[],t]}c(
|
|
538
538
|
Dc,"collect");function dt(t,e){return t.addHelpText("after",o=>`
|
|
539
539
|
${e(wa(o.command))}`)}c(dt,"helpAfter");function Ih(t){return t.addOption(new jt("--input <text>","Run input text").conflicts("inputJson")).option("--input-json <json>","Run input as a JSON object").option("--profile <name>",`Profile from ${Cn}`).addOption(new jt("--workspace <strategy>","Execution workspace (default: workflow policy or worktree)").choices(["worktree","branch","current"])).option("--branch <name>","Optional generated branch override").option("--base <branch>","Base branch for wo\
|
|
540
|
-
rktree/new branch").addOption(new jt("--transport <transport>","Agent transport (default: native)").choices(["native","acp"])).addOption(new jt("--permission-mode <mode>","Agent permission mode").choices(["interactive","workspace","deny"])).option("--mcp-json <json>","ACP stdio MCP server array")}c(Ih,"runOptions");function Dh(t={}){let e=t.run??(async $=>(await import("./dispatch-
|
|
540
|
+
rktree/new branch").addOption(new jt("--transport <transport>","Agent transport (default: native)").choices(["native","acp"])).addOption(new jt("--permission-mode <mode>","Agent permission mode").choices(["interactive","workspace","deny"])).option("--mcp-json <json>","ACP stdio MCP server array")}c(Ih,"runOptions");function Dh(t={}){let e=t.run??(async $=>(await import("./dispatch-ZCNGHCNP.js")).runFlowAction($)),o=new Zr(t.name??"flow");o.description(`${fa} \u2014 parallel AI development in Git w\
|
|
541
541
|
orktrees`).helpOption("-h, --help","Show this help message").showHelpAfterError(HS).enablePositionalOptions().option("--port <n>",`Host daemon port (default: ${Vr} or ${ha.port})`,qS);let n=c($=>async(...M)=>{gd(wa(o)),process.exitCode=await e({path:bd(o,$),args:M.slice(0,-2),options:$.opts(),globals:o.opts(),command:$,root:o})},"action"),r=c(($,M,T)=>{let D=$.command(M).description(T);return D.action(n(D))},"leaf"),i=c($=>$.allowExcessArguments().action((M,T)=>{let[D]=T.args;D!==void 0&&T.error(
|
|
542
542
|
`error: unknown command '${D}'`),T.help()}),"group"),a=c(($,M)=>$.allowExcessArguments().action(async(T,D)=>{let[q]=D.args;q!==void 0&&D.error(`error: unknown command '${q}'`),await n(M)()}),"defaultTo"),l=[[Vr,"Host daemon port (--port takes precedence)"],[rt.host,"Address the host daemon listens on"],[rt.hostStateDir,"Host daemon state directory (default: $PORTTA_HOME/state/host)"],[rt.projectAllowlist,"Canonical project roots (colon-separated; default $HOME)"]],p=Math.max(...l.map(([$=""])=>$.
|
|
543
543
|
length));dt(o,()=>`Commands that need the host daemon reach it with its token; start it with
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as f}from"./chunk-
|
|
3
|
+
import{a as f}from"./chunk-3EZNE4MC.js";import{b as d}from"./chunk-6TV2V7RR.js";import"./chunk-OPVZAG2C.js";import"./chunk-4TGTGGMK.js";import"./chunk-UX7P3YHF.js";import{dc as w}from"./chunk-4YGEG6YX.js";import"./chunk-VDSWNWUY.js";import"./chunk-5SBYE3YH.js";import"./chunk-CFWGQ7VJ.js";import"./chunk-QS5PHDYT.js";import"./chunk-IILMQFWO.js";import"./chunk-GI2EUNAK.js";import"./chunk-EYT7VTYA.js";import"./chunk-MH5YJA5O.js";
|
|
4
4
|
import"./chunk-QBKADN76.js";import"./chunk-EFZZFIRZ.js";import"./chunk-SBVO6RXF.js";import{a as l}from"./chunk-EH7H7D7J.js";import"./chunk-O6U47HHQ.js";import"./chunk-FRQCKCCK.js";import"./chunk-TA2XHP5D.js";import"./chunk-T3TSZO4I.js";import"./chunk-UUSUJUAD.js";import{a as p}from"./chunk-6J5HN4ZN.js";function a(r,i){try{return i()}catch(n){if(!(n instanceof f))throw n;return r.command.error(`error: ${n.message}`)}}p(a,"validate");async function s(r){await l();let{loadProjectEnv:i}=await import("./project-env-NWBVITHM.js");return{projectEnvKeys:await i(),port:d(r.options.port??r.globals.port),projectDir:process.cwd()}}p(s,"prepare");async function b(r){let[i,n]=r.path;switch(i){case"__complete":{let{handleCompletions:o}=await import("./completions-F4476JAU.js");return o(String(r.args[0]))}case"\
|
|
5
|
-
completion":{let{runCompletionCommand:o}=await import("./completions-F4476JAU.js");return o(r.args[0],r.root)}case"init":{let{initOptionsFromCli:o,runInit:t}=await import("./init-
|
|
6
|
-
{port:t,projectDir:e}=await s(r);return o({json:!!r.options.json},t,e)}case"linear":{let{linearPostFromCli:o,runLinearCommand:t}=await import("./linear-commands-
|
|
7
|
-
e=a(r,()=>o(r)),{port:m,projectDir:D}=await s(r);return t(e,m,D)}case"workflows":if(n!=="list"){await s(r),globalThis.__PORTTA_FLOW_EMBEDDED_WORKFLOW_CLI__=!0;let o=w(),{main:t}=await import("./cli-O2MMC25H.js");return await t([n??"",...r.args[0]??[]],{registryRoots:{builtinDir:o.workflowBuiltinsDir},skillPath:o.workflowSkill}),Number(process.exitCode??0)}return C(r);case"run":case"runs":return C(r)}let{runWorktreeCommand:u,worktreeRequestFromCli:c}=await import("./worktree-commands-
|
|
8
|
-
g=a(r,()=>c(r)),{port:_,projectDir:F}=await s(r);return u({request:g,projectDir:F,port:_})}p(b,"runFlowAction");async function C(r){let{runCommandFromCli:i,runRunCommand:n}=await import("./run-commands-
|
|
5
|
+
completion":{let{runCompletionCommand:o}=await import("./completions-F4476JAU.js");return o(r.args[0],r.root)}case"init":{let{initOptionsFromCli:o,runInit:t}=await import("./init-HGEXUJP3.js"),e=a(r,()=>o(r.options));return await l(),await t(e),Number(process.exitCode??0)}case"oneshot":{let{oneshotFromCli:o,runOneshot:t}=await import("./oneshot-DL57ZA55.js"),e=a(r,()=>o(r.args[0],r.options)),{port:m}=await s(r);return t(e,m)}case"doctor":{let{runDoctorCommand:o}=await import("./doctor-7F6ZXPZE.js"),
|
|
6
|
+
{port:t,projectDir:e}=await s(r);return o({json:!!r.options.json},t,e)}case"linear":{let{linearPostFromCli:o,runLinearCommand:t}=await import("./linear-commands-XGHGICI7.js"),e=a(r,()=>o(String(r.args[0]),String(r.args[1]),r.options)),{port:m}=await s(r);return t(e,m)}case"project":{let{projectFromCli:o,runProjectCommand:t}=await import("./project-commands-2N44CRGM.js"),{port:e}=await s(r);return t(o(r),e)}case"environment":{let{environmentFromCli:o,runEnvironmentCommand:t}=await import("./worktree-commands-F7REOKFJ.js"),
|
|
7
|
+
e=a(r,()=>o(r)),{port:m,projectDir:D}=await s(r);return t(e,m,D)}case"workflows":if(n!=="list"){await s(r),globalThis.__PORTTA_FLOW_EMBEDDED_WORKFLOW_CLI__=!0;let o=w(),{main:t}=await import("./cli-O2MMC25H.js");return await t([n??"",...r.args[0]??[]],{registryRoots:{builtinDir:o.workflowBuiltinsDir},skillPath:o.workflowSkill}),Number(process.exitCode??0)}return C(r);case"run":case"runs":return C(r)}let{runWorktreeCommand:u,worktreeRequestFromCli:c}=await import("./worktree-commands-F7REOKFJ.js"),
|
|
8
|
+
g=a(r,()=>c(r)),{port:_,projectDir:F}=await s(r);return u({request:g,projectDir:F,port:_})}p(b,"runFlowAction");async function C(r){let{runCommandFromCli:i,runRunCommand:n}=await import("./run-commands-TCBNFJOT.js"),u=a(r,()=>i(r)),{port:c}=await s(r);return n(u,c)}p(C,"runRuns");export{b as runFlowAction};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{c as m,d as l,e as u}from"./chunk-
|
|
3
|
+
import{c as m,d as l,e as u}from"./chunk-3EZNE4MC.js";import{t as c}from"./chunk-OPVZAG2C.js";import"./chunk-4TGTGGMK.js";import"./chunk-UX7P3YHF.js";import"./chunk-4YGEG6YX.js";import"./chunk-VDSWNWUY.js";import"./chunk-5SBYE3YH.js";import"./chunk-CFWGQ7VJ.js";import"./chunk-QS5PHDYT.js";import"./chunk-IILMQFWO.js";import"./chunk-GI2EUNAK.js";import"./chunk-EYT7VTYA.js";import"./chunk-MH5YJA5O.js";import"./chunk-QBKADN76.js";
|
|
4
4
|
import"./chunk-EFZZFIRZ.js";import"./chunk-SBVO6RXF.js";import"./chunk-EH7H7D7J.js";import"./chunk-O6U47HHQ.js";import"./chunk-FRQCKCCK.js";import"./chunk-TA2XHP5D.js";import"./chunk-T3TSZO4I.js";import"./chunk-UUSUJUAD.js";import{a}from"./chunk-6J5HN4ZN.js";async function y(f,s,g=process.cwd(),e={}){try{let{json:n}=f,i=await(e.resolveBaseUrl??u)(s,g),o=await l(s,()=>e.fetchDiagnostics?e.fetchDiagnostics(i):c(i).fetchDiagnostics()),t=e.stdout??console.log;if(n)return t(JSON.stringify(o,null,2)),o.ready?0:1;t(`Environment diagnostics (${o.ready?"ready":"action required"})`);for(let r of o.checks){let d=r.status==="ok"?"\u2713":r.status==="skipped"?"\u2013":r.status==="warning"?"!":"\u2717";t(`${d} ${r.label}: ${r.summary}`),r.remediation&&t(` ${r.remediation}`)}
|
|
5
5
|
return o.ready?0:1}catch(n){return(e.stderr??console.error)(`Error: ${m(n,s)}`),1}}a(y,"runDoctorCommand");export{y as runDoctorCommand};
|
|
Binary file
|
package/dist/host.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{$b as p,Vb as r,Xb as i,Zb as c,_b as s,pc as m}from"./chunk-
|
|
3
|
+
import{$b as p,Vb as r,Xb as i,Zb as c,_b as s,pc as m}from"./chunk-4YGEG6YX.js";import"./chunk-VDSWNWUY.js";import"./chunk-5SBYE3YH.js";import"./chunk-CFWGQ7VJ.js";import"./chunk-QS5PHDYT.js";import"./chunk-IILMQFWO.js";import"./chunk-GI2EUNAK.js";import"./chunk-EYT7VTYA.js";import"./chunk-MH5YJA5O.js";import"./chunk-QBKADN76.js";import"./chunk-EFZZFIRZ.js";import"./chunk-SBVO6RXF.js";import"./chunk-EH7H7D7J.js";import"./chunk-O6U47HHQ.js";
|
|
4
4
|
import"./chunk-FRQCKCCK.js";import"./chunk-TA2XHP5D.js";import"./chunk-T3TSZO4I.js";import"./chunk-UUSUJUAD.js";import{a as n}from"./chunk-6J5HN4ZN.js";var o=process.env,e=c(o.PORTTA_ROOT||process.cwd(),o),T=p(s(e)),d=m,a=await i({...r(o),token:T,modules:d,context:{stateDir:e,env:o}});process.stdout.write(`portta host daemon listening on ${a.url}
|
|
5
5
|
`);process.stdout.write(`token: ${s(e)}
|
|
6
6
|
`);process.stdout.write(`modules: ${d.map(t=>t.manifest.id).join(", ")||"none"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as Z,c as a,d as ee,e as w,f as C,g as te}from"./chunk-LAYNTFDR.js";import{a as F}from"./chunk-
|
|
3
|
+
import{a as Z,c as a,d as ee,e as w,f as C,g as te}from"./chunk-LAYNTFDR.js";import{a as F}from"./chunk-3EZNE4MC.js";import{c as ne,d as re,e as oe}from"./chunk-HB5T7XDN.js";import{b as X}from"./chunk-6TV2V7RR.js";import{q as W,t as V}from"./chunk-OPVZAG2C.js";import{a as I,d as Q,e as D}from"./chunk-4TGTGGMK.js";import{c as R}from"./chunk-UX7P3YHF.js";import{ac as K}from"./chunk-4YGEG6YX.js";import"./chunk-VDSWNWUY.js";import"./chunk-5SBYE3YH.js";
|
|
4
4
|
import"./chunk-CFWGQ7VJ.js";import"./chunk-QS5PHDYT.js";import"./chunk-IILMQFWO.js";import"./chunk-GI2EUNAK.js";import"./chunk-EYT7VTYA.js";import"./chunk-MH5YJA5O.js";import"./chunk-QBKADN76.js";import"./chunk-EFZZFIRZ.js";import{E as J}from"./chunk-SBVO6RXF.js";import{d as Y}from"./chunk-EH7H7D7J.js";import"./chunk-O6U47HHQ.js";import{b as y}from"./chunk-FRQCKCCK.js";import{c as q}from"./chunk-TA2XHP5D.js";import{a as h,
|
|
5
5
|
b as G,h as p,j as S,k as O,o as M}from"./chunk-T3TSZO4I.js";import"./chunk-UUSUJUAD.js";import{a as i}from"./chunk-6J5HN4ZN.js";import{existsSync as he}from"node:fs";import{mkdir as Fe,readFile as Le,writeFile as ye}from"node:fs/promises";import{dirname as Ue}from"node:path";import{existsSync as k,readFileSync as Ae,rmSync as be}from"node:fs";import{tmpdir as Se}from"node:os";import{join as v}from"node:path";var Ie="haiku",we="low",Pe="low";function m(e){return typeof e=="string"&&e.trim().length>0?e:null}i(m,"readString");function $e(e){return k(v(e,"bun.lock"))||k(v(e,"bun.lockb"))?"bun":k(v(e,"pnpm-lock.yaml"))?"pnpm":k(v(e,"yarn.lock"))?"yarn":"npm"}i($e,"detectPackageManager");function Ce(e){let t=I("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e});if(t.success){let s=t.stdout.toString().trim();if(s&&s!=="HEAD")return s}let n=I("git",["symbolic-ref","--quiet","--short","refs/remotes/origin/HEA\
|
|
6
6
|
D"],{cwd:e});if(n.success){let s=n.stdout.toString().trim().split("/").pop();if(s)return s}let o=I("git",["branch","--list","main"],{cwd:e});if(o.success&&o.stdout.toString().trim())return"main";let r=I("git",["branch","--list","master"],{cwd:e});return r.success&&r.stdout.toString().trim()?"master":S.mainBranch}i(Ce,"detectMainBranch");function Ee(e,t){return e==="bun"?`bun run ${t}`:e==="pnpm"?`pnpm ${t}`:e==="yarn"?`yarn ${t}`:`npm run ${t}`}i(Ee,"buildRunScriptCommand");function ce(e,t){return{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as s,c as l,e as c}from"./chunk-
|
|
3
|
+
import{a as s,c as l,e as c}from"./chunk-3EZNE4MC.js";import{t as m}from"./chunk-OPVZAG2C.js";import"./chunk-4TGTGGMK.js";import"./chunk-UX7P3YHF.js";import{Pb as i}from"./chunk-4YGEG6YX.js";import"./chunk-VDSWNWUY.js";import"./chunk-5SBYE3YH.js";import"./chunk-CFWGQ7VJ.js";import"./chunk-QS5PHDYT.js";import"./chunk-IILMQFWO.js";import"./chunk-GI2EUNAK.js";import"./chunk-EYT7VTYA.js";import"./chunk-MH5YJA5O.js";import"./chunk-QBKADN76.js";
|
|
4
4
|
import"./chunk-EFZZFIRZ.js";import"./chunk-SBVO6RXF.js";import"./chunk-EH7H7D7J.js";import"./chunk-O6U47HHQ.js";import"./chunk-FRQCKCCK.js";import"./chunk-TA2XHP5D.js";import"./chunk-T3TSZO4I.js";import"./chunk-UUSUJUAD.js";import{a}from"./chunk-6J5HN4ZN.js";function g(r){let e=i(r);if(e.kind==="team")return{kind:"team",teamKey:e.teamKey};throw e.kind==="issue"?new s(`Post target must be a team key (e.g. ENG). To post to issue ${e.issueId} as part of a session, use --linear ${e.issueId} on the oneshot/add command (loads issue context and posts back to it).`):new s(`Invalid Linear team key "${e.raw}". Use a team key like ENG.`)}a(g,"parseLinearTargetArg");function P(r,e,o){let t=o.title??null,n=g(e),d=n.kind==="team"&&t?{kind:"team",teamKey:n.teamKey,
|
|
5
5
|
title:t}:n;return{branch:r,target:d,titleOverride:t}}a(P,"linearPostFromCli");async function f(r,e){try{let t=await m(await c(e)).postWorktreeToLinear({params:{name:r.branch},body:{target:r.target}});return console.log(`Posted to Linear issue: ${t.issueUrl}`),t.commentUrl&&console.log(`Comment: ${t.commentUrl}`),console.log(`Attachment: ${t.attachmentUrl}`),0}catch(o){return console.error(l(o,e)),1}}a(f,"runLinearCommand");export{P as linearPostFromCli,g as parseLinearTargetArg,f as runLinearCommand};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as Q,f as Z,g as ee}from"./chunk-LAYNTFDR.js";import{a as w,b as V,c as E,e as X}from"./chunk-
|
|
3
|
+
import{a as Q,f as Z,g as ee}from"./chunk-LAYNTFDR.js";import{a as w,b as V,c as E,e as X}from"./chunk-3EZNE4MC.js";import{q as L,s as F,t as z,u as Y}from"./chunk-OPVZAG2C.js";import"./chunk-4TGTGGMK.js";import{c as J}from"./chunk-UX7P3YHF.js";import{Pb as M,Qb as _,Rb as D,Tb as q,Ub as j,Wb as P,kc as H,lc as K,mc as B,nc as G}from"./chunk-4YGEG6YX.js";import"./chunk-VDSWNWUY.js";import"./chunk-5SBYE3YH.js";import"./chunk-CFWGQ7VJ.js";import"./chunk-QS5PHDYT.js";
|
|
4
4
|
import"./chunk-IILMQFWO.js";import"./chunk-GI2EUNAK.js";import"./chunk-EYT7VTYA.js";import"./chunk-MH5YJA5O.js";import"./chunk-QBKADN76.js";import"./chunk-EFZZFIRZ.js";import"./chunk-SBVO6RXF.js";import"./chunk-EH7H7D7J.js";import"./chunk-O6U47HHQ.js";import"./chunk-FRQCKCCK.js";import"./chunk-TA2XHP5D.js";import{a as I}from"./chunk-T3TSZO4I.js";import"./chunk-UUSUJUAD.js";import{a as o}from"./chunk-6J5HN4ZN.js";var W=null;function R(e){return z(W??L(e))}o(R,"oneshotApi");function Oe(e,r){let t={},n=e??null,m=r.branch!==void 0,i=r.prompt??null,a=r.resume!==void 0,l=r.resume?.trim()??null,u=null,h=null;if(r.agent!==void 0&&(t.agent=r.agent.trim()),r.base!==void 0&&(t.baseBranch=r.base),r.profile!==void 0&&(t.profile=r.profile),r.linear!==void 0){let d=M(r.linear);if(d.kind==="issue")u=d.issueId,h={kind:"issue",issueId:d.issueId};else if(d.kind==="team")h={kind:"team",teamKey:d.teamKey};else throw new w(`\
|
|
5
5
|
--linear expects either an issue id (ENG-123) or a team key (ENG); got "${d.raw}"`)}if(r.branch!==void 0){if(n&&n!==r.branch)throw new w(`Conflicting branch values: "${n}" and "${r.branch}"`);n=r.branch.trim()}if(a){if(u)throw new w("Cannot use --resume with --linear <issue-id>");if(m)throw new w("Cannot use --branch with --resume; --resume already names the branch");if(!l)throw new w("--resume requires a branch name");if(n&&n!==l)throw new w("Cannot pass both a positional branch and --resume");
|
|
6
6
|
if(!i)throw new w("--resume requires --prompt; use the dashboard to re-attach without re-prompting");n=l}if(m&&!u)throw new w("--branch only applies with --linear; pass the branch as a positional argument otherwise");if(!a&&!u&&!i)throw new w("oneshot requires --prompt (or use --linear)");n&&(t.branch=n),i&&(t.prompt=i);let f=V(r.env);return f&&(t.envOverrides=f),{branch:n,prompt:i,resume:a,body:t,keepOpen:!!r.keepOpen,fromLinearIssueId:u,postToLinearTarget:h}}o(Oe,"oneshotFromCli");function s(){
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{c as d}from"./chunk-
|
|
3
|
+
import{c as d}from"./chunk-3EZNE4MC.js";import{q as p,t as l}from"./chunk-OPVZAG2C.js";import"./chunk-4TGTGGMK.js";import{c as m}from"./chunk-UX7P3YHF.js";import"./chunk-4YGEG6YX.js";import"./chunk-VDSWNWUY.js";import"./chunk-5SBYE3YH.js";import"./chunk-CFWGQ7VJ.js";import"./chunk-QS5PHDYT.js";import"./chunk-IILMQFWO.js";import"./chunk-GI2EUNAK.js";import"./chunk-EYT7VTYA.js";import"./chunk-MH5YJA5O.js";import"./chunk-QBKADN76.js";
|
|
4
4
|
import"./chunk-EFZZFIRZ.js";import"./chunk-SBVO6RXF.js";import"./chunk-EH7H7D7J.js";import"./chunk-O6U47HHQ.js";import"./chunk-FRQCKCCK.js";import"./chunk-TA2XHP5D.js";import{h as s}from"./chunk-T3TSZO4I.js";import"./chunk-UUSUJUAD.js";import{a as i}from"./chunk-6J5HN4ZN.js";import{resolve as f}from"node:path";import{setTimeout as P}from"node:timers/promises";var h=700,j=5*6e4;function g(r){switch(r){case"creating_config":return`Creating ${s}`;case"analyzing":return"Analyzing project structure";case"ready":return"Project ready";case"failed":return"Setup failed"}}i(g,"projectSetupPhaseLabel");async function w(r,o){let c=o.log??(e=>console.log(e)),n=o.now??Date.now,t=n()+(o.timeoutMs??j),a=null;for(;n()<t;){let e;try{e=(await o.poll()).find(u=>u.path===r)}catch{e=void 0}if(e&&e.phase!==a&&(a=e.phase,e.phase!=="ready"&&e.phase!=="failed"&&c(` ${g(e.phase)}\
|
|
5
5
|
\u2026`)),e?.phase==="ready")return e;if(e?.phase==="failed")throw new Error(e.error??"Project setup failed.");await o.sleep(h)}throw new Error("Project setup timed out.")}i(w,"awaitProjectSetup");function _(r){let[o]=r.path.slice(1);return o==="add"?{subcommand:o,path:r.args[0]??"."}:o==="rm"?{subcommand:o,prefix:String(r.args[0])}:{subcommand:"ls"}}i(_,"projectFromCli");async function v(r,o){let c=l(p(o));try{if(r.subcommand==="ls"){let{projects:n}=await c.fetchProjects();if(n.length===0)return console.
|
|
6
6
|
log(`No projects. Add one with: ${m()} project add [path]`),0;for(let t of n){let a=t.active?"\u25CF":"\u25CB";console.log(`${a} ${t.prefix} ${t.name} ${t.path}`)}return 0}if(r.subcommand==="add"){let n=f(process.cwd(),r.path),t=await c.addProject({body:{path:n}});if(!t.initializing)return t.project?(console.log(`Added ${t.project.name} (${t.project.prefix}) \u2014 ${t.project.path}`),0):(console.error("Server accepted the project but returned nothing to open."),1);let a=await w(t.path,{poll:i(async()=>(await c.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as s,c as v,d as u,e as S}from"./chunk-
|
|
3
|
+
import{a as s,c as v,d as u,e as S}from"./chunk-3EZNE4MC.js";import{t as I}from"./chunk-OPVZAG2C.js";import"./chunk-4TGTGGMK.js";import"./chunk-UX7P3YHF.js";import{Ob as k}from"./chunk-4YGEG6YX.js";import"./chunk-VDSWNWUY.js";import"./chunk-5SBYE3YH.js";import"./chunk-CFWGQ7VJ.js";import"./chunk-QS5PHDYT.js";import"./chunk-IILMQFWO.js";import"./chunk-GI2EUNAK.js";import"./chunk-EYT7VTYA.js";import"./chunk-MH5YJA5O.js";
|
|
4
4
|
import"./chunk-QBKADN76.js";import"./chunk-EFZZFIRZ.js";import"./chunk-SBVO6RXF.js";import"./chunk-EH7H7D7J.js";import"./chunk-O6U47HHQ.js";import"./chunk-FRQCKCCK.js";import"./chunk-TA2XHP5D.js";import"./chunk-T3TSZO4I.js";import"./chunk-UUSUJUAD.js";import{a as f}from"./chunk-6J5HN4ZN.js";function b(r){try{let n=JSON.parse(r);if(typeof n!="object"||n===null||Array.isArray(n))throw new Error("not an object");return n}catch{throw new s("--input-json must be a JSON object")}}f(b,"parseJson");function J(r,n){if(n.input!==void 0&&n.inputJson!==void 0)throw new s("Use only one of --input or --input-json");let t=n.inputJson!==void 0?b(n.inputJson):n.input??"",{profile:e,harness:d,provider:i,model:c,branch:p,base:o}=n,w;if(n.transport!==void 0){if(n.transport!=="native"&&n.transport!=="a\
|
|
5
5
|
cp")throw new s("--transport must be native or acp");w=n.transport}let l;if(n.permissionMode!==void 0){let a=n.permissionMode;if(a!=="interactive"&&a!=="workspace"&&a!=="deny")throw new s("--permission-mode must be interactive, workspace, or deny");l=a}let g;if(n.mcpJson!==void 0)try{g=k.array().parse(JSON.parse(n.mcpJson))}catch{throw new s("--mcp-json must be a valid stdio MCP server array")}let m;if(n.workspace!==void 0){let a=n.workspace;if(a!=="worktree"&&a!=="branch"&&a!=="current")throw new s(
|
|
6
6
|
"--workspace must be worktree, branch, or current");m=a==="worktree"?"isolated_worktree":a==="branch"?"new_branch":"current_branch"}if(m==="current_branch"&&(p||o))throw new s("--branch and --base do not apply to --workspace current");m===void 0&&(p||o)&&(m="isolated_worktree");let y=m===void 0?void 0:m==="current_branch"?{strategy:"current_branch"}:{strategy:m,...p?{branch:p}:{},...o?{baseBranch:o}:{}};if(r!=="direct"&&l==="interactive")throw new s("--permission-mode interactive is only availab\
|
package/dist/runtime/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.1.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as me,b as ue}from"./chunk-LAYNTFDR.js";import{a as g,b as le,d as x,e as G,f as de}from"./chunk-
|
|
3
|
+
import{a as me,b as ue}from"./chunk-LAYNTFDR.js";import{a as g,b as le,d as x,e as G,f as de}from"./chunk-3EZNE4MC.js";import{b as I}from"./chunk-PTKKSRMI.js";import{t as O}from"./chunk-OPVZAG2C.js";import"./chunk-4TGTGGMK.js";import{a as ce,c as K}from"./chunk-UX7P3YHF.js";import{Mb as z,Nb as J,bc as j,cc as D,ec as Y,fc as ee,gc as re,hc as ne,ic as te,jc as ie,kc as oe,lc as se,oc as ae}from"./chunk-4YGEG6YX.js";import"./chunk-VDSWNWUY.js";import"./chunk-5SBYE3YH.js";
|
|
4
4
|
import"./chunk-CFWGQ7VJ.js";import"./chunk-QS5PHDYT.js";import"./chunk-IILMQFWO.js";import"./chunk-GI2EUNAK.js";import"./chunk-EYT7VTYA.js";import"./chunk-MH5YJA5O.js";import"./chunk-QBKADN76.js";import"./chunk-EFZZFIRZ.js";import"./chunk-SBVO6RXF.js";import"./chunk-EH7H7D7J.js";import"./chunk-O6U47HHQ.js";import{j as Q}from"./chunk-FRQCKCCK.js";import"./chunk-TA2XHP5D.js";import{k as Z}from"./chunk-T3TSZO4I.js";
|
|
5
5
|
import"./chunk-UUSUJUAD.js";import{a as m}from"./chunk-6J5HN4ZN.js";import{basename as X,resolve as R}from"node:path";import{setTimeout as L}from"node:timers/promises";function B(r){return r instanceof Error?r.message:String(r)}m(B,"toMessage");async function pe(r,e,i){if(r===e)return{ok:!0,changed:!1,multiplexer:e};if(await i.hasActiveRuns?.())return{ok:!1,error:"cannot switch multiplexer while a Run is active",failures:[]};let t;try{t=await i.listOpenBranches()}catch(l){return{ok:!1,error:`could not list open worktrees: ${B(l)}`,failures:[]}}let u=[],w=[];for(let l of t){i.onProgress?.({stage:"close",branch:l});try{await i.closeWorktree(l),u.push(l)}catch(y){
|
|
6
6
|
w.push({branch:l,stage:"close",message:B(y)})}}if(w.length>0)return{ok:!1,error:`left the project on ${r}: ${w.length} worktree(s) could not be closed`,failures:w};i.onProgress?.({stage:"persist"});try{await i.persistMultiplexer(e)}catch(l){return{ok:!1,error:`could not write the config: ${B(l)}`,failures:[]}}let k=[],S=[];for(let l of u){i.onProgress?.({stage:"restore",branch:l});try{await i.openWorktree(l),k.push(l)}catch(y){S.push({branch:l,stage:"restore",message:B(y)})}}return{ok:!0,changed:!0,
|