@visulima/vis 1.0.0-alpha.23 → 1.0.0-alpha.24
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/CHANGELOG.md +27 -0
- package/LICENSE.md +3 -0
- package/dashboard/dist/index.html +29 -29
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +8 -8
- package/dist/packem_chunks/bin.js +198 -198
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler22.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler31.js +1 -1
- package/dist/packem_chunks/handler34.js +26 -24
- package/dist/packem_chunks/handler39.js +1 -1
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +1 -1
- package/dist/packem_chunks/handler41.js +12 -12
- package/dist/packem_chunks/handler42.js +7 -7
- package/dist/packem_chunks/handler43.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler47.js +7 -7
- package/dist/packem_chunks/handler48.js +57 -52
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +2 -2
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/{cyclonedx-B293T7R0.js → cyclonedx-DPEW0nwS.js} +1 -1
- package/dist/packem_shared/{docker-BhBBfWfc.js → docker-_pBC9Loj.js} +1 -1
- package/dist/packem_shared/{index-CZX_II5N.js → index-B8Ko8mwG.js} +8 -8
- package/dist/packem_shared/index-D_tAc2nS.js +1 -0
- package/dist/packem_shared/lifecycle-DJDsjoic.js +2 -0
- package/dist/packem_shared/peer-warnings-EvSJ18gE.js +1 -0
- package/dist/packem_shared/pm-runner-Dnj9J3KF.js +1 -0
- package/dist/packem_shared/{provenance-BcldGs02.js → provenance-yESbF7Vs.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-2G-2HWtR.js → resolve-explicit-BpxcFRuk.js} +1 -1
- package/dist/packem_shared/{s1ngularity-Boxkax0D.js → s1ngularity-B_xjP4lC.js} +1 -1
- package/dist/packem_shared/{signatures-SO-fyExV.js → signatures-DBwSnMBB.js} +1 -1
- package/dist/packem_shared/{typosquats-CioMnpnb.js → typosquats-Citu7BRY.js} +1 -1
- package/index.js +52 -52
- package/package.json +11 -11
- package/schemas/vis-config.schema.json +13 -13
- package/dist/packem_shared/index-C1w1GXdS.js +0 -1
- package/dist/packem_shared/lifecycle-wRE7ymVc.js +0 -2
- package/dist/packem_shared/pm-runner-CVliR6Ie.js +0 -1
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
var hs=Object.defineProperty;var D=(r,e)=>hs(r,"name",{value:e,configurable:!0});import{createRequire as ps}from"node:module";import{M as be,Q as gs,C as jt,K as ws,z as vs,$ as ys}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{aE as ks,p as ze,v as Ot,w as Dt,b3 as bs,b4 as Ss,n as ut,b5 as $s,u as Ts,C as Cs,O as Is,b6 as xs,b7 as Rs,s as ot,b8 as Ms,b9 as Es,ba as Fs,bb as Ps,bc as js,bd as Os,I as Ds,be as As}from"./bin.js";import{runConcurrently as ft,TerminalBuffer as Ar,readLastRunSummary as Bs,getLastRunSummaryPath as Ls,enforceProjectConstraints as Ns,expandTokensInString as dr,parsePartition as _s,TaskScheduler as Gs,createTaskGraph as qs,reverseTaskGraph as Hs,generateRunSummary as ur,writeChromeTrace as Ws,resolveTurboEnvCompat as Vs,CompositeLifeCycle as fr,defaultTaskRunner as hr,createLogReporter as zs,writeRunSummary as Us}from"@visulima/task-runner";import{F as Zs}from"../packem_shared/failure-log-B0Uh-65U.js";import{r as ei}from"../packem_shared/toolchain-Jx2lkAYy.js";import{i as ti,a as ri,b as si,s as ii,d as ni,c as oi,r as ai,H as ci,f as li,e as di}from"../packem_shared/lifecycle-wRE7ymVc.js";import{p as ui,r as fi,f as hi}from"../packem_shared/selectors-BE2BCnTR.js";import{renderToString as he,render as gi}from"@visulima/tui";import{Text as a}from"@visulima/tui/components/text";import Q,{useSyncExternalStore as lt,useCallback as at,useState as Qe,useRef as Ze,useEffect as St,useMemo as $t}from"react";import{jsxs as u,jsx as d,Fragment as Br}from"react/jsx-runtime";import{Box as g}from"@visulima/tui/components/box";import{StaticRender as pr}from"@visulima/tui/components/static-render";import{T as Lr,C as At,D as gt,E as Nr}from"../packem_shared/symbols-CQmER5MT.js";import{Dialog as wi}from"@visulima/tui/components/dialog";import{useApp as vi}from"@visulima/tui/hooks/use-app";import{useInput as mr}from"@visulima/tui/hooks/use-input";import{useWindowSize as yi}from"@visulima/tui/hooks/use-window-size";import{q as Ti,j as Ci,T as Tt,E as wr}from"../packem_shared/index.server-B7ETiT4C.js";import{parseStacktrace as Ii,codeFrame as xi}from"@visulima/error";import{loadSourceMap as Ri,originalPositionFor as Mi,sourceContentFor as Ei}from"@visulima/source-map";import{ScrollView as _r}from"@visulima/tui/components/scroll-view";import{Spinner as Gr}from"@visulima/tui/components/spinner";import{B as qr}from"./config.js";const ms=ps(import.meta.url),Je=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pe=D(r=>{if(typeof Je<"u"&&Je.versions&&Je.versions.node){const[e,t]=Je.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return Je.getBuiltinModule(r)}return ms(r)},"__cjs_getBuiltinModule"),{existsSync:rt,statSync:ht,readFileSync:Rt,watch:Ks,openSync:Xs,readSync:Ys,closeSync:Js,mkdtempSync:Qs}=Pe("node:fs"),{createInterface:pi,emitKeypressEvents:mi}=Pe("node:readline"),{isAbsolute:ki,resolve:gr,dirname:bi,relative:Si}=Pe("node:path"),{fileURLToPath:$i}=Pe("node:url"),{createHash:Fi}=Pe("node:crypto"),{appendFile:Bt}=Pe("node:fs/promises"),{platform:Pi,homedir:Lt,tmpdir:ji}=Pe("node:os"),{execFileSync:Oi,spawn:Di}=Pe("node:child_process"),{createRequire:Ai}=Pe("node:module");var Bi=Object.defineProperty,Li=D((r,e)=>Bi(r,"name",{value:e,configurable:!0}),"u$2"),Ni=Object.defineProperty,_i=Li((r,e)=>Ni(r,"name",{value:e,configurable:!0}),"v"),Gi=Object.defineProperty,qi=_i((r,e)=>Gi(r,"name",{value:e,configurable:!0}),"D");const Hi=qi((r,e,t,s,n,o,i,l,f,m,h,p,c,S)=>{const x={d:s,h:n,m:o,mo:e,ms:l,s:i,w:t,y:r};return f!==void 0&&(x.future=f),m!==void 0&&(x.past=m),h!==void 0&&(x.decimal=h),p!==void 0&&(x.unitMap=p),c!==void 0&&(x.groupSeparator=c),S!==void 0&&(x.placeholderSeparator=S),x},"createDurationLanguage"),Wi={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Vi=Hi(r=>`year${r===1?"":"s"}`,r=>`month${r===1?"":"s"}`,r=>`week${r===1?"":"s"}`,r=>`day${r===1?"":"s"}`,r=>`hour${r===1?"":"s"}`,r=>`minute${r===1?"":"s"}`,r=>`second${r===1?"":"s"}`,r=>`millisecond${r===1?"":"s"}`,"in %s","%s ago",".",Wi,",","_");var zi=Object.defineProperty,Ui=D((r,e)=>zi(r,"name",{value:e,configurable:!0}),"o$4"),Ki=Object.defineProperty,Xi=Ui((r,e)=>Ki(r,"name",{value:e,configurable:!0}),"o"),Yi=Object.defineProperty,Ji=Xi((r,e)=>Yi(r,"name",{value:e,configurable:!0}),"o");const Qi=Ji(r=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const s of e)if(!Object.hasOwn(r,s))throw new TypeError(`Missing required property: ${s}`);if(typeof r.future!="string"||typeof r.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const s of t)if(typeof r[s]!="string"&&typeof r[s]!="function")throw new TypeError(`Property ${s} must be of type string or function`);if(r.decimal&&typeof r.decimal!="string")throw new TypeError("Property decimal must be of type string");if(r.delimiter&&typeof r.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(r._digitReplacements&&!Array.isArray(r._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(r._numberFirst&&typeof r._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(r.unitMap&&typeof r.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(r.unitMap&&Object.values(r.unitMap).some(s=>typeof s!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var Zi=Object.defineProperty,en=D((r,e)=>Zi(r,"name",{value:e,configurable:!0}),"b$3"),tn=Object.defineProperty,rn=en((r,e)=>tn(r,"name",{value:e,configurable:!0}),"b"),sn=Object.defineProperty,st=rn((r,e)=>sn(r,"name",{value:e,configurable:!0}),"g");const Hr=st((r,e)=>{e=e||-1;const t=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(e)}})?`).exec(r.toString());return t===null?r:Number.parseFloat(t[0])},"toFixed"),vr=st(({unitCount:r,unitName:e},t,s)=>{let{spacer:n}=s;const{maxDecimalPoints:o}=s;let i=".";s.decimal!==void 0?i=s.decimal:t.decimal!==void 0&&(i=t.decimal);let l;"digitReplacements"in s?l=s.digitReplacements:"_digitReplacements"in t&&(l=t._digitReplacements);let f,m=r;o!==void 0&&(m=Hr(r,o));const h=m.toString();if(!t._hideCountIf2||r!==2)if(l){f="";for(const S of h)f+=S==="."?i:l[S]}else f=h.replace(".",i);else f="";const p=t[e];let c=p;return typeof p=="function"&&(c=p(r)),t._hideCountIf2&&r===2&&(n=""),t._numberFirst?c+n+f:f+n+c},"renderPiece"),nn=st((r,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:s}=e,n=e.largest??Number.POSITIVE_INFINITY,o={};let i,l,f,m=r;for(l=0;l<t.length;l++){i=t[l];const p=s[i];f=l===t.length-1?m/p:Math.floor(m/p),o[i]=f,m-=f*p}if(e.round){let p=n;for(l=0;l<t.length;l++)if(i=t[l],f=o[i],f!==0&&(p--,p===0)){for(let c=l+1;c<t.length;c++){const S=t[c],x=o[S];o[i]=(o[i]??0)+x*s[S]/s[i],o[S]=0}break}for(l=t.length-1;l>=0;l--){if(i=t[l],f=o[i],f===0)continue;const c=Math.round(f);if(o[i]=c,l===0)break;const S=t[l-1],x=s[S],L=Math.floor(c*s[i]/x);if(L)o[S]=(o[S]??0)+L,o[i]=0;else break}}const h=[];for(l=0;l<t.length&&h.length<n;l++){if(i=t[l],f=o[i],f&&!e.round&&h.length===n-1){let p,c=0;for(p=l+1,t.length;p<t.length;p++){const S=t[p];c+=o[S]*(e.unitMeasures[S]/e.unitMeasures[i])}f+=c,e.maxDecimalPoints!==void 0&&(f=Hr(f,e.maxDecimalPoints))}f&&h.push({unitCount:f,unitName:i})}return h},"getPieces"),on=st((r,e,t)=>{const{language:s,units:n}=e;if(r.length===0){const p=n.at(-1);return vr({unitCount:0,unitName:p},s,e)}const{conjunction:o,serialComma:i}=e;let l=", ";e.delimiter!==void 0?l=e.delimiter:s.delimiter!==void 0&&(l=s.delimiter);let f="";e.timeAdverb&&t!==0&&(f=s.future??"",t<0&&(f=s.past??""));const m=r.map(p=>vr(p,s,e));let h;return!o||r.length===1?h=m.join(l):r.length===2?h=m.join(o):h=m.slice(0,-1).join(l)+(i?",":"")+o+(m.at(-1)??""),f&&(h=f.replace("%s",h)),h},"formatPieces"),Wr=st((r,e)=>{if(Number.isNaN(r))throw new TypeError("Expected a valid number");if(typeof r!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:Vi,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...e};Qi(t.language);const s=Math.abs(r),n=nn(s,t);return on(n,t,r)},"duration");var an=Object.defineProperty,Vr=D((r,e)=>an(r,"name",{value:e,configurable:!0}),"u$1"),cn=Object.defineProperty,Nt=Vr((r,e)=>cn(r,"name",{value:e,configurable:!0}),"u"),ln=Object.defineProperty,dn=Nt((r,e)=>ln(r,"name",{value:e,configurable:!0}),"e");function wt({onlyFirst:r=!1}={}){const e="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,r?void 0:"g")}D(wt,"n$2");Vr(wt,"a");Nt(wt,"t");dn(wt,"ansiRegex");var un=Object.defineProperty,fn=Nt((r,e)=>un(r,"name",{value:e,configurable:!0}),"r");const hn=wt(),pn=/\u001B\]0;.*\u0007/,mn=fn(r=>r.replace(pn,"").replace(hn,""),"strip");var gn=Object.defineProperty,vt=D((r,e)=>gn(r,"name",{value:e,configurable:!0}),"s$2");const wn={aube:["aube-lock.yaml"],bun:["bun.lock","bun.lockb"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},vn={aube:["node_modules/.aube-state","node_modules/.modules.yaml"],bun:["node_modules/.bun-tag"],npm:["node_modules/.package-lock.json"],pnpm:["node_modules/.modules.yaml","node_modules/.pnpm/lock.yaml"],yarn:["node_modules/.yarn-integrity","node_modules/.yarn-state.yml",".yarn/install-state.gz"]},yn={ci:{aube:"aube ci",bun:"bun install --frozen-lockfile",npm:"npm ci",pnpm:"pnpm install --frozen-lockfile",yarn:"yarn install --immutable"},tty:{aube:"aube install",bun:"bun install",npm:"npm install",pnpm:"pnpm install",yarn:"yarn install"}},kn=1e3,bn=vt(r=>{for(const[e,t]of Object.entries(wn))for(const s of t)if(rt(be(r,s)))return{lockfileFile:s,manager:e}},"detectPackageManager"),Sn=vt((r,e)=>{let t;for(const s of vn[e]){const n=be(r,s);if(!rt(n))continue;const{mtimeMs:o}=ht(n);(!t||o>t.mtimeMs)&&(t={mtimeMs:o,path:s})}return t},"findFreshestMarker"),$n=vt((r,e={})=>{const t=bn(r);if(!t)return{checked:!1};const{lockfileFile:s,manager:n}=t,o=ht(be(r,s)).mtimeMs,i=Sn(r,n),l=yn[e.inCi?"ci":"tty"][n],f={installMarkerMtimeMs:i?.mtimeMs,lockfileMtimeMs:o,lockfilePath:s,marker:i?.path,packageManager:n};return i?o>i.mtimeMs+kn?{checked:!0,detail:f,failure:"stale-install",message:`${s} is newer than node_modules (${i.path}) — run \`${l}\` to sync.`}:{checked:!0,detail:f}:{checked:!0,detail:f,failure:"missing-install",message:`lockfile detected but node_modules looks uninitialised — run \`${l}\` before \`vis run\`.`}},"checkLockfileFreshness"),Tn=vt((r,e,t,s={})=>{if(s.skip)return{checked:!1,shouldContinue:!0};const n=$n(r,{inCi:e});if(!n.failure)return{...n,shouldContinue:!0};const o=`preflight: ${n.message??"lockfile drift detected"}`;return e&&!s.ciAsWarning?{...n,formattedMessage:o,shouldContinue:!1}:(t.warn(o),{...n,formattedMessage:o,shouldContinue:!0})},"runLockfilePreflight");var Cn=Object.defineProperty,zr=D((r,e)=>Cn(r,"name",{value:e,configurable:!0}),"f$6");const In=zr(r=>r.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),xn=zr((r,e,t)=>{const s=new Set,n=[];if(r===void 0||r.trim()==="")return{skipTaskIds:s,unmatchedPatterns:n};const o=[...t],i=new Set(o),l=new Map;for(const f of o){const m=f.lastIndexOf(":");if(m===-1)continue;const h=f.slice(m+1),p=l.get(h);p===void 0?l.set(h,[f]):p.push(f)}for(const f of In(r)){if(f.startsWith("~:"))throw new Error(`--skip-cache does not support the closest-project selector "~:" (received "${f}"). Use \`pkg:target\`, \`:target\`, or \`#tag:target\`.`);if(i.has(f)){s.add(f);continue}const m=ui(f);if(!m){n.push(f);continue}let h=!1;switch(m.kind){case"all":{const p=l.get(m.target)??[];for(const c of p)s.add(c),h=!0;break}case"project":{const p=m.projects?.[0];if(p!==void 0){const c=`${p}:${m.target}`;i.has(c)&&(s.add(c),h=!0)}break}case"tag":{const{tag:p}=m;if(p!==void 0){const c=l.get(m.target)??[];for(const S of c){const x=S.slice(0,S.lastIndexOf(":"));e.projects[x]?.tags?.includes(p)===!0&&(s.add(S),h=!0)}}break}}h||n.push(f)}return{skipTaskIds:s,unmatchedPatterns:n}},"resolveSkipCachePatterns");var Rn=Object.defineProperty,_t=D((r,e)=>Rn(r,"name",{value:e,configurable:!0}),"a$3");const Mn=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,En=new Set(["0","!","#","$","*","-","?","@","_"]),Fn=_t(r=>{const e=new Map;for(const t of r.matchAll(Mn)){const s=t[1],n=t[3],o=t[2],i=s??n;if(i===void 0||En.has(i))continue;const l=o!==void 0,f=e.get(i);f===void 0?e.set(i,l):f&&!l&&e.set(i,!1)}return[...e.entries()].map(([t,s])=>({hasDefault:s,name:t}))},"extractEnvReferences"),Pn=_t(r=>{const{command:e,processEnv:t,taskEnv:s,taskId:n}=r,o=Fn(e);if(o.length===0)return;const i=[];for(const{hasDefault:l,name:f}of o){if(l)continue;const m=s[f],h=t[f];m===void 0&&h===void 0&&i.push(f)}if(i.length!==0)return{missing:i.toSorted(),taskId:n}},"checkStrictEnv"),jn=_t(r=>{const e=r.missing.map(t=>`$${t}`).join(", ");return`Strict env: ${r.taskId} references unset variable${r.missing.length===1?"":"s"} ${e}. Set ${r.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},"formatStrictEnvError");var On=Object.defineProperty,Le=D((r,e)=>On(r,"name",{value:e,configurable:!0}),"i$2");const yr=Le(r=>{const e=new Set;for(const t of Object.values(r.projects))for(const s of Object.keys(t.targets??{}))e.add(s);return[...e].sort()},"collectAvailableTargets"),Dn=Le(r=>{const e=new Map;for(const t of r.values())for(const[s,n]of Object.entries(t))for(const o of n.aliases??[])e.has(o)||e.set(o,s);return e},"buildAliasMap"),An=Le((r,e)=>e.get(r)??r,"resolveTargetAlias"),Bn=Le((r,e)=>{if(r.length===0)return e.length;if(e.length===0)return r.length;const t=[];for(let s=0;s<=e.length;s++)t[s]=[s];for(let s=0;s<=r.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let n=1;n<=r.length;n++){const o=e[s-1]===r[n-1]?0:1;t[s][n]=Math.min(t[s-1][n]+1,t[s][n-1]+1,t[s-1][n-1]+o)}return t[e.length][r.length]},"levenshtein"),Ln=Le((r,e,t=3)=>Ur(r,e,1,t)[0],"suggestTarget"),Ur=Le((r,e,t=3,s=3)=>{const n=[];for(const o of e){const i=Bn(r.toLowerCase(),o.toLowerCase());i<=s&&n.push({distance:i,name:o})}return n.sort((o,i)=>o.distance-i.distance||o.name.localeCompare(i.name)),n.slice(0,t).map(o=>o.name)},"suggestTargets"),Nn=Le(r=>r.length===0?" (no targets found)":r.map(e=>` - ${e}`).join(`
|
|
2
|
-
`),"formatTargetList"),
|
|
3
|
-
`);for(const[n
|
|
1
|
+
var ps=Object.defineProperty;var A=(r,e)=>ps(r,"name",{value:e,configurable:!0});import{createRequire as ms}from"node:module";import{M as Ce,Q as ws,C as At,K as vs,z as ys,$ as ks}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{aE as bs,p as Ue,v as wt,w as Dt,b3 as Ss,b4 as $s,n as ft,b5 as Ts,u as Cs,C as Is,O as xs,b6 as Rs,b7 as Ms,s as ct,b8 as Es,b9 as Ps,ba as Fs,bb as Os,bc as js,bd as As,I as Ds,be as Ls}from"./bin.js";import{runConcurrently as pt,TerminalBuffer as Ar,readLastRunSummary as Bs,getLastRunSummaryPath as Ns,enforceProjectConstraints as Gs,expandTokensInString as lr,parsePartition as _s,TaskScheduler as qs,createTaskGraph as Hs,reverseTaskGraph as Ws,generateRunSummary as dr,writeChromeTrace as zs,resolveTurboEnvCompat as Us,CompositeLifeCycle as ur,defaultTaskRunner as hr,createLogReporter as Vs,writeRunSummary as Ys}from"@visulima/task-runner";import{F as ei}from"../packem_shared/failure-log-B0Uh-65U.js";import{r as ti}from"../packem_shared/toolchain-Jx2lkAYy.js";import{i as ri,a as si,b as ii,s as oi,d as ni,c as ai,r as ci,H as li,f as di,e as ui}from"../packem_shared/lifecycle-DJDsjoic.js";import{p as hi,r as fi,f as pi}from"../packem_shared/selectors-BE2BCnTR.js";import{renderToString as pe,render as wi}from"@visulima/tui";import{Text as a}from"@visulima/tui/components/text";import J,{useSyncExternalStore as ut,useCallback as lt,useState as Je,useRef as Ze,useEffect as Tt,useMemo as Ct}from"react";import{jsxs as u,jsx as d,Fragment as Dr}from"react/jsx-runtime";import{Box as g}from"@visulima/tui/components/box";import{StaticRender as fr}from"@visulima/tui/components/static-render";import{T as Lr,C as Lt,D as vt,E as Br}from"../packem_shared/symbols-CQmER5MT.js";import{Dialog as vi}from"@visulima/tui/components/dialog";import{useApp as yi}from"@visulima/tui/hooks/use-app";import{useInput as pr}from"@visulima/tui/hooks/use-input";import{useWindowSize as ki}from"@visulima/tui/hooks/use-window-size";import{q as Ci,j as Ii,T as It,E as gr}from"../packem_shared/index.server-B7ETiT4C.js";import{parseStacktrace as xi,codeFrame as Ri}from"@visulima/error";import{loadSourceMap as Mi,originalPositionFor as Ei,sourceContentFor as Pi}from"@visulima/source-map";import{ScrollView as Nr}from"@visulima/tui/components/scroll-view";import{Spinner as Gr}from"@visulima/tui/components/spinner";import{B as _r}from"./config.js";const gs=ms(import.meta.url),Xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Oe=A(r=>{if(typeof Xe<"u"&&Xe.versions&&Xe.versions.node){const[e,t]=Xe.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return Xe.getBuiltinModule(r)}return gs(r)},"__cjs_getBuiltinModule"),{existsSync:st,statSync:mt,readFileSync:Et,watch:Ks,openSync:Qs,readSync:Xs,closeSync:Js,mkdtempSync:Zs}=Oe("node:fs"),{createInterface:mi,emitKeypressEvents:gi}=Oe("node:readline"),{isAbsolute:bi,resolve:mr,dirname:Si,relative:$i}=Oe("node:path"),{fileURLToPath:Ti}=Oe("node:url"),{createHash:Fi}=Oe("node:crypto"),{appendFile:Bt}=Oe("node:fs/promises"),{platform:Oi,homedir:Nt,tmpdir:ji}=Oe("node:os"),{execFileSync:Ai,spawn:Di}=Oe("node:child_process"),{createRequire:Li}=Oe("node:module");var Bi=Object.defineProperty,Ni=A((r,e)=>Bi(r,"name",{value:e,configurable:!0}),"u$2"),Gi=Object.defineProperty,_i=Ni((r,e)=>Gi(r,"name",{value:e,configurable:!0}),"v"),qi=Object.defineProperty,Hi=_i((r,e)=>qi(r,"name",{value:e,configurable:!0}),"D");const Wi=Hi((r,e,t,s,o,n,i,l,h,m,f,p,c,S)=>{const x={d:s,h:o,m:n,mo:e,ms:l,s:i,w:t,y:r};return h!==void 0&&(x.future=h),m!==void 0&&(x.past=m),f!==void 0&&(x.decimal=f),p!==void 0&&(x.unitMap=p),c!==void 0&&(x.groupSeparator=c),S!==void 0&&(x.placeholderSeparator=S),x},"createDurationLanguage"),zi={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Ui=Wi(r=>`year${r===1?"":"s"}`,r=>`month${r===1?"":"s"}`,r=>`week${r===1?"":"s"}`,r=>`day${r===1?"":"s"}`,r=>`hour${r===1?"":"s"}`,r=>`minute${r===1?"":"s"}`,r=>`second${r===1?"":"s"}`,r=>`millisecond${r===1?"":"s"}`,"in %s","%s ago",".",zi,",","_");var Vi=Object.defineProperty,Yi=A((r,e)=>Vi(r,"name",{value:e,configurable:!0}),"o$4"),Ki=Object.defineProperty,Qi=Yi((r,e)=>Ki(r,"name",{value:e,configurable:!0}),"o"),Xi=Object.defineProperty,Ji=Qi((r,e)=>Xi(r,"name",{value:e,configurable:!0}),"o");const Zi=Ji(r=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const s of e)if(!Object.hasOwn(r,s))throw new TypeError(`Missing required property: ${s}`);if(typeof r.future!="string"||typeof r.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const s of t)if(typeof r[s]!="string"&&typeof r[s]!="function")throw new TypeError(`Property ${s} must be of type string or function`);if(r.decimal&&typeof r.decimal!="string")throw new TypeError("Property decimal must be of type string");if(r.delimiter&&typeof r.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(r._digitReplacements&&!Array.isArray(r._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(r._numberFirst&&typeof r._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(r.unitMap&&typeof r.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(r.unitMap&&Object.values(r.unitMap).some(s=>typeof s!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var eo=Object.defineProperty,to=A((r,e)=>eo(r,"name",{value:e,configurable:!0}),"b$3"),ro=Object.defineProperty,so=to((r,e)=>ro(r,"name",{value:e,configurable:!0}),"b"),io=Object.defineProperty,it=so((r,e)=>io(r,"name",{value:e,configurable:!0}),"g");const qr=it((r,e)=>{e=e||-1;const t=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(e)}})?`).exec(r.toString());return t===null?r:Number.parseFloat(t[0])},"toFixed"),wr=it(({unitCount:r,unitName:e},t,s)=>{let{spacer:o}=s;const{maxDecimalPoints:n}=s;let i=".";s.decimal!==void 0?i=s.decimal:t.decimal!==void 0&&(i=t.decimal);let l;"digitReplacements"in s?l=s.digitReplacements:"_digitReplacements"in t&&(l=t._digitReplacements);let h,m=r;n!==void 0&&(m=qr(r,n));const f=m.toString();if(!t._hideCountIf2||r!==2)if(l){h="";for(const S of f)h+=S==="."?i:l[S]}else h=f.replace(".",i);else h="";const p=t[e];let c=p;return typeof p=="function"&&(c=p(r)),t._hideCountIf2&&r===2&&(o=""),t._numberFirst?c+o+h:h+o+c},"renderPiece"),oo=it((r,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:s}=e,o=e.largest??Number.POSITIVE_INFINITY,n={};let i,l,h,m=r;for(l=0;l<t.length;l++){i=t[l];const p=s[i];h=l===t.length-1?m/p:Math.floor(m/p),n[i]=h,m-=h*p}if(e.round){let p=o;for(l=0;l<t.length;l++)if(i=t[l],h=n[i],h!==0&&(p--,p===0)){for(let c=l+1;c<t.length;c++){const S=t[c],x=n[S];n[i]=(n[i]??0)+x*s[S]/s[i],n[S]=0}break}for(l=t.length-1;l>=0;l--){if(i=t[l],h=n[i],h===0)continue;const c=Math.round(h);if(n[i]=c,l===0)break;const S=t[l-1],x=s[S],B=Math.floor(c*s[i]/x);if(B)n[S]=(n[S]??0)+B,n[i]=0;else break}}const f=[];for(l=0;l<t.length&&f.length<o;l++){if(i=t[l],h=n[i],h&&!e.round&&f.length===o-1){let p,c=0;for(p=l+1,t.length;p<t.length;p++){const S=t[p];c+=n[S]*(e.unitMeasures[S]/e.unitMeasures[i])}h+=c,e.maxDecimalPoints!==void 0&&(h=qr(h,e.maxDecimalPoints))}h&&f.push({unitCount:h,unitName:i})}return f},"getPieces"),no=it((r,e,t)=>{const{language:s,units:o}=e;if(r.length===0){const p=o.at(-1);return wr({unitCount:0,unitName:p},s,e)}const{conjunction:n,serialComma:i}=e;let l=", ";e.delimiter!==void 0?l=e.delimiter:s.delimiter!==void 0&&(l=s.delimiter);let h="";e.timeAdverb&&t!==0&&(h=s.future??"",t<0&&(h=s.past??""));const m=r.map(p=>wr(p,s,e));let f;return!n||r.length===1?f=m.join(l):r.length===2?f=m.join(n):f=m.slice(0,-1).join(l)+(i?",":"")+n+(m.at(-1)??""),h&&(f=h.replace("%s",f)),f},"formatPieces"),Hr=it((r,e)=>{if(Number.isNaN(r))throw new TypeError("Expected a valid number");if(typeof r!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:Ui,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...e};Zi(t.language);const s=Math.abs(r),o=oo(s,t);return no(o,t,r)},"duration");var ao=Object.defineProperty,Wr=A((r,e)=>ao(r,"name",{value:e,configurable:!0}),"u$1"),co=Object.defineProperty,Gt=Wr((r,e)=>co(r,"name",{value:e,configurable:!0}),"u"),lo=Object.defineProperty,uo=Gt((r,e)=>lo(r,"name",{value:e,configurable:!0}),"e");function yt({onlyFirst:r=!1}={}){const e="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,r?void 0:"g")}A(yt,"n$2");Wr(yt,"a");Gt(yt,"t");uo(yt,"ansiRegex");var ho=Object.defineProperty,fo=Gt((r,e)=>ho(r,"name",{value:e,configurable:!0}),"r");const po=yt(),mo=/\u001B\]0;.*\u0007/,go=fo(r=>r.replace(mo,"").replace(po,""),"strip");var wo=Object.defineProperty,kt=A((r,e)=>wo(r,"name",{value:e,configurable:!0}),"s$2");const vo={aube:["aube-lock.yaml"],bun:["bun.lock","bun.lockb"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},yo={aube:["node_modules/.aube-state","node_modules/.modules.yaml"],bun:["node_modules/.bun-tag"],npm:["node_modules/.package-lock.json"],pnpm:["node_modules/.modules.yaml","node_modules/.pnpm/lock.yaml"],yarn:["node_modules/.yarn-integrity","node_modules/.yarn-state.yml",".yarn/install-state.gz"]},ko={ci:{aube:"aube ci",bun:"bun install --frozen-lockfile",npm:"npm ci",pnpm:"pnpm install --frozen-lockfile",yarn:"yarn install --immutable"},tty:{aube:"aube install",bun:"bun install",npm:"npm install",pnpm:"pnpm install",yarn:"yarn install"}},bo=1e3,So=kt(r=>{for(const[e,t]of Object.entries(vo))for(const s of t)if(st(Ce(r,s)))return{lockfileFile:s,manager:e}},"detectPackageManager"),$o=kt((r,e)=>{let t;for(const s of yo[e]){const o=Ce(r,s);if(!st(o))continue;const{mtimeMs:n}=mt(o);(!t||n>t.mtimeMs)&&(t={mtimeMs:n,path:s})}return t},"findFreshestMarker"),To=kt((r,e={})=>{const t=So(r);if(!t)return{checked:!1};const{lockfileFile:s,manager:o}=t,n=mt(Ce(r,s)).mtimeMs,i=$o(r,o),l=ko[e.inCi?"ci":"tty"][o],h={installMarkerMtimeMs:i?.mtimeMs,lockfileMtimeMs:n,lockfilePath:s,marker:i?.path,packageManager:o};return i?n>i.mtimeMs+bo?{checked:!0,detail:h,failure:"stale-install",message:`${s} is newer than node_modules (${i.path}) — run \`${l}\` to sync.`}:{checked:!0,detail:h}:{checked:!0,detail:h,failure:"missing-install",message:`lockfile detected but node_modules looks uninitialised — run \`${l}\` before \`vis run\`.`}},"checkLockfileFreshness"),Co=kt((r,e,t,s={})=>{if(s.skip)return{checked:!1,shouldContinue:!0};const o=To(r,{inCi:e});if(!o.failure)return{...o,shouldContinue:!0};const n=`preflight: ${o.message??"lockfile drift detected"}`;return e&&!s.ciAsWarning?{...o,formattedMessage:n,shouldContinue:!1}:(t.warn(n),{...o,formattedMessage:n,shouldContinue:!0})},"runLockfilePreflight");var Io=Object.defineProperty,zr=A((r,e)=>Io(r,"name",{value:e,configurable:!0}),"f$6");const xo=zr(r=>r.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),Ro=zr((r,e,t)=>{const s=new Set,o=[];if(r===void 0||r.trim()==="")return{skipTaskIds:s,unmatchedPatterns:o};const n=[...t],i=new Set(n),l=new Map;for(const h of n){const m=h.lastIndexOf(":");if(m===-1)continue;const f=h.slice(m+1),p=l.get(f);p===void 0?l.set(f,[h]):p.push(h)}for(const h of xo(r)){if(h.startsWith("~:"))throw new Error(`--skip-cache does not support the closest-project selector "~:" (received "${h}"). Use \`pkg:target\`, \`:target\`, or \`#tag:target\`.`);if(i.has(h)){s.add(h);continue}const m=hi(h);if(!m){o.push(h);continue}let f=!1;switch(m.kind){case"all":{const p=l.get(m.target)??[];for(const c of p)s.add(c),f=!0;break}case"project":{const p=m.projects?.[0];if(p!==void 0){const c=`${p}:${m.target}`;i.has(c)&&(s.add(c),f=!0)}break}case"tag":{const{tag:p}=m;if(p!==void 0){const c=l.get(m.target)??[];for(const S of c){const x=S.slice(0,S.lastIndexOf(":"));e.projects[x]?.tags?.includes(p)===!0&&(s.add(S),f=!0)}}break}}f||o.push(h)}return{skipTaskIds:s,unmatchedPatterns:o}},"resolveSkipCachePatterns");var Mo=Object.defineProperty,_t=A((r,e)=>Mo(r,"name",{value:e,configurable:!0}),"a$3");const Eo=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,Po=new Set(["0","!","#","$","*","-","?","@","_"]),Fo=_t(r=>{const e=new Map;for(const t of r.matchAll(Eo)){const s=t[1],o=t[3],n=t[2],i=s??o;if(i===void 0||Po.has(i))continue;const l=n!==void 0,h=e.get(i);h===void 0?e.set(i,l):h&&!l&&e.set(i,!1)}return[...e.entries()].map(([t,s])=>({hasDefault:s,name:t}))},"extractEnvReferences"),Oo=_t(r=>{const{command:e,processEnv:t,taskEnv:s,taskId:o}=r,n=Fo(e);if(n.length===0)return;const i=[];for(const{hasDefault:l,name:h}of n){if(l)continue;const m=s[h],f=t[h];m===void 0&&f===void 0&&i.push(h)}if(i.length!==0)return{missing:i.toSorted(),taskId:o}},"checkStrictEnv"),jo=_t(r=>{const e=r.missing.map(t=>`$${t}`).join(", ");return`Strict env: ${r.taskId} references unset variable${r.missing.length===1?"":"s"} ${e}. Set ${r.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},"formatStrictEnvError");var Ao=Object.defineProperty,Ge=A((r,e)=>Ao(r,"name",{value:e,configurable:!0}),"i$2");const vr=Ge(r=>{const e=new Set;for(const t of Object.values(r.projects))for(const s of Object.keys(t.targets??{}))e.add(s);return[...e].sort()},"collectAvailableTargets"),Do=Ge(r=>{const e=new Map;for(const t of r.values())for(const[s,o]of Object.entries(t))for(const n of o.aliases??[])e.has(n)||e.set(n,s);return e},"buildAliasMap"),Lo=Ge((r,e)=>e.get(r)??r,"resolveTargetAlias"),Bo=Ge((r,e)=>{if(r.length===0)return e.length;if(e.length===0)return r.length;const t=[];for(let s=0;s<=e.length;s++)t[s]=[s];for(let s=0;s<=r.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let o=1;o<=r.length;o++){const n=e[s-1]===r[o-1]?0:1;t[s][o]=Math.min(t[s-1][o]+1,t[s][o-1]+1,t[s-1][o-1]+n)}return t[e.length][r.length]},"levenshtein"),No=Ge((r,e,t=3)=>Ur(r,e,1,t)[0],"suggestTarget"),Ur=Ge((r,e,t=3,s=3)=>{const o=[];for(const n of e){const i=Bo(r.toLowerCase(),n.toLowerCase());i<=s&&o.push({distance:i,name:n})}return o.sort((n,i)=>n.distance-i.distance||n.name.localeCompare(i.name)),o.slice(0,t).map(n=>n.name)},"suggestTargets"),Go=Ge(r=>r.length===0?" (no targets found)":r.map(e=>` - ${e}`).join(`
|
|
2
|
+
`),"formatTargetList"),_o=Ge(async r=>{if(r.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const e=mi({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
|
|
3
|
+
`);for(const[o,n]of r.entries())process.stdout.write(` ${String(o+1).padStart(2," ")}. ${n}
|
|
4
4
|
`);process.stdout.write(`
|
|
5
|
-
`);const t=(await new Promise(
|
|
6
|
-
`).map(
|
|
7
|
-
`);let t;for(let s=0;s<e.length;s++){const
|
|
8
|
-
${
|
|
9
|
-
`)}`}}}return t},"extractErrorBlock"),
|
|
5
|
+
`);const t=(await new Promise(o=>{e.question("Select a target (number or name, blank to cancel): ",o)})).trim();if(t.length===0)return;const s=Number.parseInt(t,10);return Number.isFinite(s)&&s>=1&&s<=r.length?r[s-1]:r.includes(t)?t:No(t,r)}finally{e.close()}},"promptTargetInteractively");var qo=Object.defineProperty,ht=A((r,e)=>qo(r,"name",{value:e,configurable:!0}),"n$1");const Ho=new RegExp("[\x1B]\\[[0-?]*[ -/]*[@-~]","g"),xt=ht(r=>r.replaceAll(Ho,"").replaceAll("\r",""),"sanitizeLogLine");class yr{static{A(this,"ServiceDockStore")}static{ht(this,"ServiceDockStore")}#e=[];#s=new Set;#r=new Map;#i=new Map;constructor(e=[]){for(const t of e)this.#i.set(t,{id:t,status:"pending",tailLines:[]});this.#e=[...e],this.#o()}getSnapshot=ht(()=>this.#r,"getSnapshot");subscribe=ht(e=>(this.#s.add(e),()=>{this.#s.delete(e)}),"subscribe");getIds(){return this.#e}getState(e){return this.#i.get(e)}getDockState(){let e=!1,t=!1;for(const s of this.#i.values())s.status==="crashed"||s.status==="failed"?e=!0:(s.status==="pending"||s.status==="starting")&&(t=!0);return e?"crash":t?"boot":"ready"}registerService(e){this.#i.has(e)||(this.#i.set(e,{id:e,status:"pending",tailLines:[]}),this.#e=[...this.#e,e],this.#n())}markStarting(e){this.#t(e,t=>({...t,errorMessage:void 0,startedAt:t.startedAt??Date.now(),status:"starting"}))}markStarted(e,t){this.#t(e,s=>({...s,startedAt:s.startedAt??Date.now(),status:s.status==="ready"?"ready":"starting"}))}markReady(e,t){this.#t(e,s=>({...s,errorMessage:void 0,port:t.port,readyAt:Date.now(),status:"ready"}))}markFailed(e,t,s){const o=s?.message;this.#t(e,n=>({...n,errorMessage:xt(o??t),status:"failed"}))}markCrashed(e,t){const s=t.slice(-256).map(o=>xt(o));this.#t(e,o=>({...o,errorMessage:s.length>0?s[s.length-1]:"process exited",status:"crashed",tailLines:s}))}appendLog(e,t){const s=t.split(`
|
|
6
|
+
`).map(o=>xt(o)).filter(o=>o.length>0);s.length!==0&&this.#t(e,o=>{const n=[...o.tailLines,...s];for(;n.length>256;)n.shift();let i=0;for(let l=n.length-1;l>=0;l--)if(i+=n[l].length+1,i>65536){n.splice(0,l+1);break}return{...o,lastLine:s[s.length-1],tailLines:n}})}abortBoot(e){let t=!1;const s=new Map(this.#i);for(const[o,n]of s)(n.status==="pending"||n.status==="starting")&&(s.set(o,{...n,errorMessage:e,status:"failed"}),t=!0);t&&(this.#i=s,this.#o(),this.#n())}#t(e,t){const s=this.#i.get(e);s&&(this.#i.set(e,t(s)),this.#o(),this.#n())}#o(){this.#r=new Map(this.#i)}#n(){for(const e of this.#s)try{e()}catch{}}}var Wo=Object.defineProperty,qt=A((r,e)=>Wo(r,"name",{value:e,configurable:!0}),"i$1");const zo=qt(r=>Array.isArray(r)?`[${r.join(",")}]`:typeof r=="object"&&r!==null?JSON.stringify(r):String(r),"formatValue"),Uo=qt((r,e,t)=>e==="_"?`${r}${Array.isArray(t)?t.join(" "):String(t)}`:`${r}--${e}=${zo(t)}`,"formatFlags"),Ht=qt((r,e,t)=>{const s=new Set(new Set(t.map(c=>c.target.target))),o=new Set(new Set(t.map(c=>c.target.project))),n=e.filter(c=>s.has(c)),i=r.filter(c=>o.has(c)),l=t.length-i.length*n.length,h=n.length===1?"target":"targets",m=n.join(", "),f=i.length===1?`project ${i[0]}`:`${i.length} projects`;let p=`${h} ${m} for ${f}`;return l>0&&(p+=` and ${l} ${l===1?"task":"tasks"} ${l===1?"it depends":"they depend"} on`),p},"formatTargetsAndProjects");var Vo=Object.defineProperty,Yo=A((r,e)=>Vo(r,"name",{value:e,configurable:!0}),"c$4");const Ko={error:"red",info:"white",success:"green"},Pt=Yo(({children:r,title:e,variant:t})=>{const s=Ko[t];return u(g,{flexDirection:"column",children:[u(g,{gap:1,children:[d(a,{bold:!0,inverse:!0,children:" VIS "}),d(a,{bold:!0,color:s,children:"•"}),d(a,{children:e})]}),r]})},"Header");var Qo=Object.defineProperty,Xo=A((r,e)=>Qo(r,"name",{value:e,configurable:!0}),"T$4");const Vr=Xo(({cached:r,failed:e,failedIds:t,projectNames:s,retriedIds:o,skippedIds:n,succeeded:i,targets:l,tasks:h,took:m})=>{const f=Ht(s,l,h),p=o??[];if(e===0&&(!n||n.length===0)){const c=r>0?` (${r} read from cache)`:"";return d(fr,{children:A(()=>d(Pt,{title:`Successfully ran ${f}`,variant:"success",children:u(g,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[u(a,{children:[d(a,{color:"green",children:Lr})," ",i+r," tasks completed",c?d(a,{dimColor:!0,children:c}):null,d(a,{dimColor:!0,children:` · Took ${m}`})]}),p.length>0&&u(g,{flexDirection:"column",marginTop:1,children:[u(a,{children:[d(a,{color:"yellow",children:"↻"})," ",d(a,{color:"yellow",children:String(p.length)})," task",p.length===1?"":"s"," succeeded after retry:"]}),p.map(S=>u(a,{children:[" ",d(a,{color:"yellow",children:"↻"})," ",S]},S))]})]})}),"children")})}return d(fr,{children:A(()=>d(Pt,{title:`Ran ${f}`,variant:"error",children:u(g,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[n&&n.length>0&&u(g,{flexDirection:"column",children:[u(a,{dimColor:!0,children:[n.length," ","task",n.length===1?"":"s"," ","skipped (dependency failed or --bail)"]}),n.map(c=>u(a,{dimColor:!0,children:[" - ",c]},c)),d(a,{})]}),e>0&&u(g,{flexDirection:"column",children:[u(a,{children:[d(a,{color:"red",children:String(e)})," ","task",e===1?"":"s"," ","failed:"]}),t.map(c=>u(a,{children:[" ",d(a,{color:"red",children:Lt})," ",c]},c)),d(a,{})]}),p.length>0&&u(g,{flexDirection:"column",children:[u(a,{children:[d(a,{color:"yellow",children:String(p.length)})," ","task",p.length===1?"":"s"," ","finished after retry:"]}),p.map(c=>u(a,{children:[" ",d(a,{color:"yellow",children:"↻"})," ",c]},c)),d(a,{})]}),d(a,{dimColor:!0,children:` Took ${m}`})]})}),"children")})},"CommandSummary");var Jo=Object.defineProperty,Rt=A((r,e)=>Jo(r,"name",{value:e,configurable:!0}),"o$2");class gt{static{A(this,"TaskStore")}static{Rt(this,"TaskStore")}#e;#s=new Set;#r=new Map;constructor(e){this.#e={autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,filterActive:!1,filterText:"",focusedPanel:"tasks",interactiveMode:!1,outputs:new Map,pinnedTaskIds:[null,null],rerunRequested:!1,retriedIds:[],retryTaskId:null,rows:e.map(t=>({persistent:!!t.overrides.visOptions?.persistent,status:"pending",taskId:t.id})),selectedIndex:0,startTime:Date.now(),statusFilter:"all",succeeded:0,viewMode:"list"}}getSnapshot=Rt(()=>this.#e,"getSnapshot");subscribe=Rt(e=>(this.#s.add(e),()=>{this.#s.delete(e)}),"subscribe");startTasks(e){const t=[...this.#e.rows];for(const s of e){const o=t.findIndex(n=>n.taskId===s.id);o!==-1&&(t[o]={...t[o],elapsed:0,status:"running"},this.#r.set(s.id,process.hrtime()))}this.#t({...this.#e,rows:t})}endTasks(e){const t=[...this.#e.rows];let{cached:s,completed:o,failed:n,succeeded:i}=this.#e;const l=new Map(this.#e.outputs),h=[...this.#e.retriedIds];for(const f of e){const p=t.findIndex(c=>c.taskId===f.task.id);switch(p!==-1&&(t[p]={...t[p],duration:f.startTime&&f.endTime?f.endTime-f.startTime:void 0,retryAttempts:f.retryAttempts,status:f.status}),f.retryAttempts&&f.retryAttempts>0&&h.push(f.task.id),o++,f.status){case"failure":{n++;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{s++;break}case"success":{i++;break}}f.terminalOutput&&!l.has(f.task.id)&&l.set(f.task.id,f.terminalOutput),this.#r.delete(f.task.id)}let{selectedIndex:m}=this.#e;if(n>this.#e.failed){const f=t.findIndex(p=>p.status==="failure");f!==-1&&(m=f)}this.#t({...this.#e,cached:s,completed:o,failed:n,outputs:l,retriedIds:h,rows:t,selectedIndex:m,succeeded:i})}static#i=256*1024;addOutput(e,t){if(!t.trim())return;let s=(this.#e.outputs.get(e)??"")+t;s.length>gt.#i&&(s=s.slice(-gt.#i)),this.#e.outputs.set(e,s),this.#t({...this.#e})}setOutput(e,t){this.#e.outputs.set(e,t),this.#t({...this.#e})}markDone(){this.#t({...this.#e,done:!0,endTime:Date.now()})}unmarkDone(){this.#t({...this.#e,autoExitCountdown:null,done:!1,endTime:null})}tick(){if(this.#r.size===0)return;let e=!1;const t=[...this.#e.rows];for(let s=0;s<t.length;s++){const o=t[s];if(o.status==="running"){const n=this.#r.get(o.taskId);if(n){const i=process.hrtime(n),l=i[0]*1e3+i[1]/1e6;t[s]={...o,elapsed:l},e=!0}}}e&&this.#t({...this.#e,rows:t})}setSelectedIndex(e){e!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:e})}setFocusedPanel(e){e!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:e})}setFilter(e){this.#t({...this.#e,filterText:e,selectedIndex:0})}setFilterActive(e){e!==this.#e.filterActive&&this.#t({...this.#e,filterActive:e,filterText:e?this.#e.filterText:"",selectedIndex:0})}pinTask(e,t){const s=[...this.#e.pinnedTaskIds];s[e]=t,this.#t({...this.#e,pinnedTaskIds:s})}clearPins(){this.#t({...this.#e,pinnedTaskIds:[null,null]})}requestRetry(e){const t=[...this.#e.rows],s=t.findIndex(l=>l.taskId===e);let{completed:o,failed:n,succeeded:i}=this.#e;if(s!==-1){const l=t[s].status;l==="failure"?(n=Math.max(0,n-1),o=Math.max(0,o-1)):l==="success"&&(i=Math.max(0,i-1),o=Math.max(0,o-1)),t[s]={...t[s],elapsed:0,retryAttempts:void 0,status:"running"},this.#r.set(e,process.hrtime())}this.#t({...this.#e,completed:o,done:!1,endTime:null,failed:n,interactiveMode:!1,retriedIds:this.#e.retriedIds.filter(l=>l!==e),retryTaskId:e,rows:t,succeeded:i})}acknowledgeRetry(){const e=this.#e.retryTaskId;return e&&this.#t({...this.#e,retryTaskId:null}),e}setInteractiveMode(e){e!==this.#e.interactiveMode&&this.#t({...this.#e,interactiveMode:e})}setViewMode(e){e!==this.#e.viewMode&&this.#t({...this.#e,viewMode:e})}setStatusFilter(e){this.#t({...this.#e,selectedIndex:0,statusFilter:e})}requestRerun(){this.#r.clear(),this.#t({...this.#e,autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,interactiveMode:!1,outputs:new Map,rerunRequested:!0,retriedIds:[],rows:this.#e.rows.map(e=>({persistent:e.persistent,status:"pending",taskId:e.taskId})),startTime:Date.now(),succeeded:0,viewMode:"list"})}acknowledgeRerun(){this.#e.rerunRequested&&this.#t({...this.#e,rerunRequested:!1})}#t(e){this.#e=e;for(const t of this.#s)try{t()}catch{}}}var Zo=Object.defineProperty,Te=A((r,e)=>Zo(r,"name",{value:e,configurable:!0}),"l$1");const en=Te(r=>go(r),"stripAnsi"),tn=/^(?<name>(?:[A-Z][\w$]*)?(?:Error|Exception))(?::[ \t](?<message>.*))?$/,rn=/^\s*at\s+/,sn=Te(r=>{const e=r.split(`
|
|
7
|
+
`);let t;for(let s=0;s<e.length;s++){const o=tn.exec(e[s].trim());if(!o)continue;const n=[];for(let i=s+1;i<e.length&&i<=s+200;i++){const l=e[i];if(rn.test(l))n.push(l.trim());else if(n.length>0||l.trim()!=="")break}if(n.length>0){const i=o.groups?.name??"Error",l=o.groups?.message??"";t={message:l,name:i,stack:`${i}: ${l}
|
|
8
|
+
${n.map(h=>` ${h}`).join(`
|
|
9
|
+
`)}`}}}return t},"extractErrorBlock"),Yr=Te(r=>{if(r.startsWith("file://"))try{return Ti(r)}catch{return r}return r},"normalizeFramePath"),on=Te(r=>!r.includes("node_modules")&&!r.startsWith("node:")&&!r.startsWith("internal/"),"isUserFrame"),nn=Te(r=>{try{return Mi(r)}catch{return}},"tryLoadSourceMap"),an=Te((r,e)=>{if(!r.file||r.line===void 0)return;const t=Yr(r.file),s=bi(t)?t:mr(e,t);if(!on(s)||!st(s))return;const o=nn(s);if(o){const n=Ei(o,{column:r.column===void 0?0:Math.max(0,r.column-1),line:r.line});if(n.source&&n.line!=null){const i=mr(Si(s),n.source),l=Pi(o,n.source)??(st(i)?Et(i,"utf8"):void 0);if(l!==void 0)return{column:n.column==null?void 0:n.column+1,file:i,line:n.line,source:l}}}return{column:r.column,file:s,line:r.line,source:Et(s,"utf8")}},"resolveFrame"),kr=Te((r,e)=>{const t=$i(e,r);return t&&!t.startsWith("..")?t:r},"shortPath"),Kr=Te((r,e)=>{if(!r?.trim())return r;try{const t=sn(en(r));if(!t)return r;const s=new Error(t.message);s.name=t.name,s.stack=t.stack;const o=xi(s);if(o.length===0)return r;const n=e.color,i={dim:Te(c=>n?gr(c):c,"dim"),head:Te(c=>n?Ii(It(c)):c,"head"),loc:Te(c=>n?Ci(c):c,"loc")};let l,h;for(const c of o){const S=an(c,e.cwd);if(S){l=S,h=c;break}}const m=[i.head(`✖ ${t.name}${t.message?`: ${t.message}`:""}`)];if(l){const c=`${kr(l.file,e.cwd)}:${l.line}${l.column?`:${l.column}`:""}`;m.push(` ${i.loc(c)}`,""),m.push(Ri(l.source,{start:{column:l.column,line:l.line}},{color:n?{gutter:gr,marker:It,message:It}:void 0,linesAbove:2,linesBelow:3}))}const f=o.filter(c=>c!==h).slice(0,8).map(c=>{const S=c.methodName??"<anonymous>",x=c.file?`${kr(Yr(c.file),e.cwd)}${c.line?`:${c.line}`:""}`:"";return i.dim(` at ${S}${x?` (${x})`:""}`)});f.length>0&&m.push("",...f);const p=i.dim("─".repeat(40));return`${m.join(`
|
|
10
10
|
`)}
|
|
11
11
|
${p}
|
|
12
|
-
${r}`}catch{return r}},"renderFailureOutput");var
|
|
13
|
-
`,i=
|
|
14
|
-
`))$.push(y.endsWith("\r")?y.slice(0,-1):y);return!
|
|
15
|
-
`)})})}),s&&d(g,{flexShrink:0,justifyContent:"center",paddingX:1,children:d(a,{bold:!0,color:"yellow",children:"INTERACTIVE | keystrokes forwarded to task | Esc to exit"})})]})},"OutputPanel");var
|
|
16
|
-
`):_?c.outputs.get(_)??"":"",pe=$t(()=>G?.status==="failure"&&ge?Yr(ge,{color:!process.env.NO_COLOR,cwd:process.cwd()}):ge,[G?.status,ge]),$e=y??_,Re=y?Se?.status==="crashed"||Se?.status==="failed"?"failure":"running":G?.status,Oe=qt(s,l,f),De=c.done?`Completed ${Oe} (${He((c.endTime??Date.now())-c.startTime)})`:`Running ${Oe}...`,we=c.done?c.failed>0?"error":"success":"running",ce=at(C=>{U.current?.scrollTo(Math.max(0,C-2))},[]);if(St(()=>{c.interactiveMode&&G?.status!=="running"&&i.setInteractiveMode(!1)},[c.interactiveMode,G?.status,i]),St(()=>{if(!_)return;let C=h;c.viewMode==="split"&&h>=Rr?C=h-Math.floor(h*.4)-2:(c.viewMode==="split"||c.viewMode==="fullscreen")&&(C=h-2);const k=Math.max(1,p-4);o.get(_)?.resize?.(C,k)},[h,p,c.viewMode,_]),mr((C,k)=>{if(k.escape){i.setInteractiveMode(!1);return}if(!_)return;const M=o.get(_);if(!M){i.setInteractiveMode(!1);return}if(k.return)M.write("\r");else if(k.upArrow)M.write("\x1B[A");else if(k.downArrow)M.write("\x1B[B");else if(k.rightArrow)M.write("\x1B[C");else if(k.leftArrow)M.write("\x1B[D");else if(k.backspace)M.write("");else if(k.delete)M.write("\x1B[3~");else if(k.tab)M.write(" ");else if(k.home)M.write("\x1B[H");else if(k.end)M.write("\x1B[F");else if(k.pageUp)M.write("\x1B[5~");else if(k.pageDown)M.write("\x1B[6~");else if(k.ctrl&&C){const ee=C.toUpperCase().codePointAt(0);ee!==void 0&&ee>=65&&ee<=90&&M.write(String.fromCodePoint(ee-64))}else C&&M.write(C)},{isActive:c.interactiveMode}),mr((C,k)=>{if(C==="c"&&k.ctrl){m();return}if(!X){if(z){k.escape||C==="?"?v(!1):C==="q"?(v(!1),ne(!0)):k.downArrow||C==="j"?R.current?.scrollBy(1):k.upArrow||C==="k"?R.current?.scrollBy(-1):k.pageDown?R.current?.scrollBy(5):k.pageUp?R.current?.scrollBy(-5):k.home?R.current?.scrollToTop():k.end&&R.current?.scrollToBottom();return}if(C==="?"){v(!0);return}if(C==="q"){ne(!0);return}if(C==="r"&&c.done){i.requestRerun();return}if(C==="R"&&c.done){const M=de[c.selectedIndex];M?.status==="failure"&&i.requestRetry(M.taskId);return}if(C==="F"&&!c.filterActive){const M=["all","failed","running","passed"],ee=M.indexOf(c.statusFilter);i.setStatusFilter(M[(ee+1)%M.length]);return}if(c.filterActive){if(k.escape){i.setFilterActive(!1);return}if(k.return){i.setFilterActive(!1);return}if(k.backspace){i.setFilter(c.filterText.slice(0,-1));return}if(C&&!k.ctrl&&!k.meta){i.setFilter(c.filterText+C);return}return}if(C==="i"&&G?.status==="running"&&(c.viewMode==="fullscreen"||c.viewMode==="split"&&c.focusedPanel==="output")){i.setInteractiveMode(!0);return}if(c.viewMode==="fullscreen"){if(k.escape){i.setViewMode("split"),A("split");return}if(C==="f"){const M=!q;N(M),M&&j.current?.scrollToBottom();return}if(k.downArrow||C==="j"){N(!1),j.current?.scrollBy(1);return}if(k.upArrow||C==="k"){N(!1),j.current?.scrollBy(-1);return}if(k.pageDown||k.ctrl&&C==="d"){N(!1),j.current?.scrollBy(12);return}if(k.pageUp||k.ctrl&&C==="u"){N(!1),j.current?.scrollBy(-12);return}if(k.home){N(!1),j.current?.scrollToTop();return}if(k.end){N(!0),j.current?.scrollToBottom();return}return}if(c.focusedPanel==="dock"&&L&&n){if(k.tab){F(null),i.setFocusedPanel("tasks");return}if(k.escape){i.setFocusedPanel("tasks"),F(null),c.viewMode==="split"&&(i.setViewMode("list"),A("list"));return}if(k.downArrow||C==="j"){$(M=>Math.min(M+1,x.length-1));return}if(k.upArrow||C==="k"){$(M=>Math.max(M-1,0));return}if(k.return){const M=x[E];M&&(F(M),N(!0),oe(),Z.current.splitList=0,Z.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),A("split"));return}if((C==="r"||C==="R")&&e){const M=x[E],ee=M?n.getState(M)?.status:void 0;if(M&&(ee==="crashed"||ee==="failed")){const ye=e(M);ye instanceof Promise&&ye.catch(()=>{})}return}return}if(c.viewMode==="split"){if(k.tab){c.focusedPanel==="tasks"?i.setFocusedPanel("output"):L?i.setFocusedPanel("dock"):(F(null),i.setFocusedPanel("tasks"));return}if(c.focusedPanel==="output"){if(k.escape){if(y&&L){F(null),i.setViewMode("list"),i.setFocusedPanel("dock"),A("list");return}F(null),i.setFocusedPanel("tasks");return}if(k.return){oe(),i.setViewMode("fullscreen");return}if(C==="f"){const M=!q;N(M),M&&j.current?.scrollToBottom();return}if(k.downArrow||C==="j"){N(!1),j.current?.scrollBy(1);return}if(k.upArrow||C==="k"){N(!1),j.current?.scrollBy(-1);return}if(k.pageDown||k.ctrl&&C==="d"){N(!1),j.current?.scrollBy(12);return}if(k.pageUp||k.ctrl&&C==="u"){N(!1),j.current?.scrollBy(-12);return}if(k.home){N(!1),j.current?.scrollToTop();return}if(k.end){N(!0),j.current?.scrollToBottom();return}return}if(k.escape){i.setViewMode("list"),A("list");return}if(k.return){i.setFocusedPanel("output");return}}if(c.viewMode==="list"||c.viewMode==="split"&&c.focusedPanel==="tasks"){if(k.tab&&c.viewMode==="list"&&L){i.setFocusedPanel("dock");return}if(k.downArrow||C==="j"){const M=Math.min(c.selectedIndex+1,Math.max(0,de.length-1));i.setSelectedIndex(M),ce(M);return}if(k.upArrow||C==="k"){const M=Math.max(c.selectedIndex-1,0);i.setSelectedIndex(M),ce(M);return}if(k.return&&c.viewMode==="list"){N(!0),oe(),Z.current.splitList=0,Z.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),A("split");return}if(C==="/"){i.setFilterActive(!0);return}if(C==="1"&&ie){i.pinTask(0,ie);return}if(C==="2"&&ie){i.pinTask(1,ie);return}if(C==="0"){i.clearPins();return}k.escape&&c.filterText&&i.setFilter("")}}},{isActive:!c.interactiveMode}),h<Ir||p<xr)return d(g,{alignItems:"center",height:p,justifyContent:"center",width:h,children:u(a,{color:"yellow",children:["Terminal too small (",h,"x",p,"). Minimum:"," ",Ir,"x",xr]})});const Ae=u(g,{gap:1,children:[c.succeeded>0&&u(a,{bold:!0,color:"green",children:["✓"," ",c.succeeded]}),c.failed>0&&u(a,{bold:!0,color:"red",children:["✗"," ",c.failed]}),je>0&&u(a,{color:"cyan",children:["◷"," ",je]}),u(a,{dimColor:!0,children:[c.rows.length," ","total"]}),c.statusFilter!=="all"&&u(a,{color:"yellow",children:["[",c.statusFilter,"]"]})]});let ve;if(c.viewMode==="fullscreen")ve=[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"Esc"}),d(a,{dimColor:!0,children:"BACK"})]},"esc"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"↑↓"}),d(a,{dimColor:!0,children:"SCROLL"})]},"scroll"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"^u ^d"}),d(a,{dimColor:!0,children:"PAGE"})]},"page"),...G?.status==="running"?[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"i"}),d(a,{dimColor:!0,children:"INPUT"})]},"i")]:[],u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"q"}),d(a,{dimColor:!0,children:"QUIT"})]},"q")];else if(c.done){const C=de[c.selectedIndex]?.status==="failure";ve=[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"q"}),d(a,{dimColor:!0,children:"QUIT"})]},"q"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"r"}),d(a,{dimColor:!0,children:"RERUN"})]},"r"),...C?[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"R"}),d(a,{dimColor:!0,children:"RETRY"})]},"R")]:[],u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"?"}),d(a,{dimColor:!0,children:"HELP"})]},"?"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"↑↓"}),d(a,{dimColor:!0,children:"NAV"})]},"nav"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"F"}),d(a,{dimColor:!0,children:"FILTER"})]},"F"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"⏎"}),d(a,{dimColor:!0,children:c.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter")]}else c.viewMode==="split"&&c.focusedPanel==="output"?ve=[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"q"}),d(a,{dimColor:!0,children:"QUIT"})]},"q"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"Esc"}),d(a,{dimColor:!0,children:"BACK"})]},"esc"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"↑↓"}),d(a,{dimColor:!0,children:"SCROLL"})]},"scroll"),...G?.status==="running"?[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"i"}),d(a,{dimColor:!0,children:"INPUT"})]},"i")]:[],u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"⏎"}),d(a,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"Tab"}),d(a,{dimColor:!0,children:"PANEL"})]},"tab"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"?"}),d(a,{dimColor:!0,children:"HELP"})]},"?")]:ve=[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"q"}),d(a,{dimColor:!0,children:"QUIT"})]},"q"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"?"}),d(a,{dimColor:!0,children:"HELP"})]},"?"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"↑↓"}),d(a,{dimColor:!0,children:"NAV"})]},"nav"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"/"}),d(a,{dimColor:!0,children:"FILTER"})]},"/"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"F"}),d(a,{dimColor:!0,children:"STATUS"})]},"F"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"⏎"}),d(a,{dimColor:!0,children:c.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...c.viewMode==="split"?[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"Tab"}),d(a,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const Me=u(g,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[d(g,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:ve}),d(g,{flexShrink:0,paddingX:1,children:Ae})]}),ue=u(wi,{backgroundColor:"#1e1e1e",footer:u(a,{dimColor:!0,children:[d(a,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",d(a,{bold:!0,color:"white",children:"?"}),"/",d(a,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:R,title:"KEYBOARD SHORTCUTS",visible:z,width:52,children:[u(g,{flexDirection:"column",marginBottom:1,children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"NAVIGATION"})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","↑","/k"]}),d(a,{dimColor:!0,children:" Move up"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","↓","/j"]}),d(a,{dimColor:!0,children:" Move down"})]})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Tab"]}),d(a,{dimColor:!0,children:" Switch panel (split)"})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Esc"]}),d(a,{dimColor:!0,children:" Back / close"})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Enter"]}),d(a,{dimColor:!0,children:" Show output / fullscreen"})]})]}),u(g,{flexDirection:"column",marginBottom:1,children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"VIEWS"})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Enter"]}),u(a,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Esc"]}),u(a,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),u(g,{flexDirection:"column",marginBottom:1,children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"ACTIONS"})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","/"]}),d(a,{dimColor:!0,children:" Filter by text"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","F"]}),d(a,{dimColor:!0,children:" Filter by status"})]})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","1"]}),d(a,{dimColor:!0,children:"/"}),d(a,{bold:!0,color:"white",children:"2"}),d(a,{dimColor:!0,children:" Pin to output pane"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","0"]}),d(a,{dimColor:!0,children:" Clear pins"})]})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","r"]}),d(a,{dimColor:!0,children:" Rerun all (done)"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","R"]}),d(a,{dimColor:!0,children:" Retry failed task"})]})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","i"]}),d(a,{dimColor:!0,children:" Interactive input (running task)"})]})]}),u(g,{flexDirection:"column",marginBottom:1,children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"SCROLLING"}),d(a,{dimColor:!0,children:" (output panel)"})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","↑","/k"]}),d(a,{dimColor:!0,children:" Scroll up"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","↓","/j"]}),d(a,{dimColor:!0,children:" Scroll down"})]})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","^u"]}),d(a,{dimColor:!0,children:" Page up"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","^d"]}),d(a,{dimColor:!0,children:" Page down"})]})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Home"]}),d(a,{dimColor:!0,children:" Top"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","End"]}),d(a,{dimColor:!0,children:" Bottom (resume follow)"})]})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","f"]}),d(a,{dimColor:!0,children:" Toggle auto-scroll (tail mode)"})]})]}),u(g,{flexDirection:"column",children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"GENERAL"})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","q"]}),d(a,{dimColor:!0,children:" Quit"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","?"]}),d(a,{dimColor:!0,children:" Toggle help"})]})]})]})]}),Ne=d(ks,{autoExitSeconds:r>0?r:3,onCancel:D(()=>{ne(!1)},"onCancel"),visible:X}),Te=L&&n?d(So,{activeIndex:E,focused:c.focusedPanel==="dock",store:n}):null;if(c.viewMode==="fullscreen")return u(g,{flexDirection:"column",height:p,width:h,children:[d(g,{flexGrow:1,children:d(Sr,{autoScroll:q,duration:G?.duration??G?.elapsed,focused:!0,interactiveMode:c.interactiveMode,output:pe,scrollRef:j,status:Re,supportsInteractive:!y,taskId:$e})}),Te,Me,Ne,ue]});if(c.viewMode==="split"){const C=h>=Rr,k=d(Cr,{compact:!0,filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel==="tasks",headerStatus:we,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:de,scrollRef:U,selectedIndex:c.selectedIndex,title:De}),M=d(Sr,{autoScroll:q,duration:G?.duration??G?.elapsed,focused:c.focusedPanel==="output",interactiveMode:c.interactiveMode,output:pe,scrollRef:j,showFullscreenHint:!0,status:Re,supportsInteractive:!y,taskId:$e});if(C){const ye=Math.floor(h*.4);return u(g,{flexDirection:"column",height:p,width:h,children:[u(g,{flexDirection:"row",flexGrow:1,children:[d(g,{width:ye,children:k}),d(g,{flexGrow:1,children:M})]}),Te,Me,Ne,ue]})}const ee=Math.floor(p*.45);return u(g,{flexDirection:"column",height:p,width:h,children:[d(g,{height:ee,children:k}),d(g,{flexGrow:1,children:M}),Te,Me,Ne,ue]})}return u(g,{flexDirection:"column",height:p,width:h,children:[d(g,{flexGrow:1,children:d(Cr,{filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel!=="dock",headerStatus:we,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:de,scrollRef:U,selectedIndex:c.selectedIndex,title:De})}),Te,Me,Ne,ue]})},"VisTaskRunnerApp");var Mo=Object.defineProperty,qe=D((r,e)=>Mo(r,"name",{value:e,configurable:!0}),"r$2");const Eo=qe(r=>{const{args:e,autoExit:t=!1,onRetryService:s,outputStyle:n="normal",projectNames:o,serviceDockStore:i,stdinRegistry:l,tasks:f}=r,m=new pt(f),h=typeof e.parallel=="number"?e.parallel:3,p=t===!0?3:typeof t=="number"?t:0;let c,S;const x=new Promise(R=>{S=R});let L;const E=qe(()=>{L&&(clearInterval(L),L=void 0)},"cleanup"),$=qe(()=>{if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),process.stdin.unref()},"releaseStdin"),y=qe(()=>{if(l){for(const R of l.values())R.kill?.();l.clear()}},"killAllPtyProcesses"),F=qe(()=>{E(),v(),y(),$(),process.stdout.write("\x1B[?1049l\x1B[?25h"),c?.cleanup(),process.exit(1)},"onSignal"),J=qe(()=>{const R=m.getSnapshot(),U=He(Date.now()-R.startTime),j=R.rows.filter(q=>q.status==="failure").map(q=>q.taskId),X=process.stdout.columns||80;process.stdout.write(`
|
|
17
|
-
`);for(const q of R.rows){const{persistent:N,status:
|
|
12
|
+
${r}`}catch{return r}},"renderFailureOutput");var cn=Object.defineProperty,Me=A((r,e)=>cn(r,"name",{value:e,configurable:!0}),"t");const Qr={delimiter:" ",language:{d:Me(()=>" d","d"),future:"in %s",h:Me(()=>" h","h"),m:Me(()=>" m","m"),mo:Me(()=>" mo","mo"),ms:Me(()=>" ms","ms"),past:"%s ago",s:Me(()=>" s","s"),w:Me(()=>" w","w"),y:Me(()=>" y","y")},largest:2,round:!0,spacer:"",units:["h","m","s","ms"]};Me(r=>{const e=r[0]*1e3+r[1]/1e6;return Hr(e,Qr)},"formatHrtime");const We=Me(r=>Hr(r,Qr),"formatMs");var ln=Object.defineProperty,ze=A((r,e)=>ln(r,"name",{value:e,configurable:!0}),"s$1");const Ve=ze(r=>r==="local-cache"||r==="local-cache-kept-existing"||r==="remote-cache","isCacheStatus"),ot=ze(r=>{switch(r){case"failure":return{color:"red",icon:Lt};case"local-cache":case"local-cache-kept-existing":case"remote-cache":case"success":return{color:"green",icon:Lr};case"skipped":return{color:"gray",icon:vt};default:return{color:"gray",icon:"?"}}},"getStatusInfo"),tt=ze(r=>{const{color:e,icon:t}=ot(r);return pe(J.createElement(a,{color:e},t),{columns:10}).trim()},"getStatusIcon"),dn=ze(r=>{const{color:e,icon:t}=ot(r);switch(r){case"local-cache":case"local-cache-kept-existing":case"remote-cache":return pe(J.createElement(a,null,J.createElement(a,{color:e},t)," ",J.createElement(a,{color:"cyan"},"[cache]")),{columns:30}).trim();case"skipped":return pe(J.createElement(a,null,J.createElement(a,{dimColor:!0},t)," ",J.createElement(a,{dimColor:!0},"[skipped]")),{columns:30}).trim();default:return pe(J.createElement(a,{color:e},t),{columns:10}).trim()}},"getStatusPrefix"),un=ze(r=>r==="azure"||r==="buildkite"||r==="github"||r==="gitlab"||r==="off"?r:process.env.GITHUB_ACTIONS==="true"?"github":process.env.GITLAB_CI==="true"?"gitlab":process.env.BUILDKITE==="true"?"buildkite":process.env.TF_BUILD?.toLowerCase()==="true"?"azure":"off","resolveCiGroupingMode"),hn=ze(r=>{const e=r.replaceAll(/\W+/g,"_"),t=Fi("sha256").update(r).digest("hex").slice(0,6);return`${e}_${t}`},"toGitLabSectionKey"),fn=ze((r,e,t,s="auto")=>{const o=t.trim();if(!o)return;const n=`
|
|
13
|
+
`,i=un(s);if(i==="github"&&e!=="failure"){process.stdout.write(`::group::${tt(e)} ${r}${n}`),process.stdout.write(o+n),process.stdout.write(`::endgroup::${n}`);return}if(i==="gitlab"&&e!=="failure"){const p=Math.floor(Date.now()/1e3),c=hn(r),S="\x1B[0K";process.stdout.write(`${S}section_start:${String(p)}:${c}[collapsed=true]\r${S}${tt(e)} ${r}${n}`),process.stdout.write(o+n);const x=Math.floor(Date.now()/1e3);process.stdout.write(`${S}section_end:${String(x)}:${c}\r${S}${n}`);return}if(i==="buildkite"&&e!=="failure"){process.stdout.write(`--- ${tt(e)} ${r}${n}`),process.stdout.write(o+n);return}if(i==="azure"&&e!=="failure"){process.stdout.write(`##[group]${tt(e)} ${r}${n}`),process.stdout.write(o+n),process.stdout.write(`##[endgroup]${n}`);return}const l=process.stdout.columns||80,h=pe(J.createElement(a,{dimColor:!0},vt.repeat(l)),{columns:l}).trim(),m=dn(e),f=pe(J.createElement(a,{bold:!0},r),{columns:l}).trim();process.stdout.write(`${h}${n}`),process.stdout.write(`${m} ${f}${n}`),process.stdout.write(o+n),process.stdout.write(`${h}${n}`)},"logCommandOutputCI");var pn=Object.defineProperty,Wt=A((r,e)=>pn(r,"name",{value:e,configurable:!0}),"d$2");const mn=Wt(r=>r==="running"?{color:"white",icon:"•"}:r==="pending"?{color:"gray",icon:"·"}:ot(r),"getDisplayInfo"),gn=Wt(({autoScroll:r,focused:e,interactiveMode:t,showFullscreenHint:s,statusValue:o,supportsInteractive:n,taskId:i})=>{if(!i)return;if(t)return"Esc cancel | Enter send";const l=r?"":" PAUSED (f resume)",h=n?" i INPUT":"";return e&&o==="running"&&s?`⏎ FULLSCREEN${h} f FOLLOW${l}`:e&&o==="running"?`f FOLLOW${h}${l}`:e&&s?`<enter> full screen${l}`:e?l||void 0:"<tab> or <enter> to focus"},"deriveBottomTitle"),br=Wt(({autoScroll:r=!0,duration:e,focused:t,interactiveMode:s,output:o,scrollRef:n,showFullscreenHint:i,status:l,supportsInteractive:h=!0,taskId:m})=>{const f=l??"pending",{icon:p}=mn(f),c=t?"bold":"single",S=f==="failure"?"red":f==="success"||Ve(f)?t?"green":"gray":f==="running"?t?"white":"cyan":t?"white":"gray",x=m?`${p} ${m}`:void 0,B=e===void 0?void 0:We(e),E=gn({autoScroll:r,focused:t,interactiveMode:s??!1,showFullscreenHint:i??!1,statusValue:f,supportsInteractive:h,taskId:m});if(!m)return u(g,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",paddingX:2,paddingY:1,children:[d(a,{dimColor:!0,children:"Select a task to view output"}),d(a,{dimColor:!0,children:"Press Enter or 1/2 to pin"})]});const $=[];if(o)for(const y of o.split(`
|
|
14
|
+
`))$.push(y.endsWith("\r")?y.slice(0,-1):y);return!o&&(f==="running"||f==="pending")?d(g,{borderBottomTitle:E,borderColor:S,borderStyle:c,borderTopRightTitle:B,borderTopTitle:x,flexDirection:"column",flexGrow:1,paddingX:2,paddingY:1,children:d(g,{alignItems:"center",flexGrow:1,justifyContent:"center",children:d(a,{dimColor:!0,children:"Waiting for task output…"})})}):u(g,{borderBottomTitle:E,borderColor:s?"yellow":S,borderStyle:c,borderTopRightTitle:B,borderTopTitle:x,flexDirection:"column",flexGrow:1,children:[d(g,{flexGrow:1,flexShrink:1,paddingY:1,children:d(Nr,{flexGrow:1,followOutput:r,paddingX:2,ref:n,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:d(a,{children:$.join(`
|
|
15
|
+
`)})})}),s&&d(g,{flexShrink:0,justifyContent:"center",paddingX:1,children:d(a,{bold:!0,color:"yellow",children:"INTERACTIVE | keystrokes forwarded to task | Esc to exit"})})]})},"OutputPanel");var wn=Object.defineProperty,Ye=A((r,e)=>wn(r,"name",{value:e,configurable:!0}),"d$1");const vn={crashed:"✖",failed:"✖",pending:"·",ready:"●",starting:"•"},Xr=Ye(r=>r==="ready"?"green":r==="crashed"||r==="failed"?"red":r==="starting"?"cyan":"gray","statusColor"),yn=Ye(({status:r})=>r==="starting"?d(a,{color:"cyan",children:d(Gr,{type:"dots"})}):d(a,{bold:!0,color:Xr(r),children:vn[r]}),"StatusGlyph"),kn=Ye(({active:r,focused:e,state:t})=>{const s=e&&r,o=s?">":" ",n=t.status==="ready"?t.port?`running, port ${String(t.port)}`:"running":t.status==="failed"||t.status==="crashed"?t.errorMessage??"exited":t.lastLine??"booting…";return u(g,{flexDirection:"row",flexShrink:0,overflow:"hidden",children:[d(a,{children:o}),d(a,{children:" "}),d(g,{flexShrink:0,width:3,children:d(yn,{status:t.status})}),d(g,{flexGrow:0,flexShrink:0,width:28,children:d(a,{bold:s,inverse:s,children:t.id})}),d(g,{flexGrow:1,flexShrink:1,overflow:"hidden",children:u(a,{color:Xr(t.status),dimColor:t.status!=="crashed"&&t.status!=="failed",wrap:"truncate-end",children:[" ",n]})})]})},"ServiceRow"),bn=Ye(({states:r})=>{const e=[];for(const s of r)s.status==="ready"&&e.push(s.id);const t=e.join(", ");return u(g,{paddingX:1,children:[u(a,{bold:!0,color:"green",children:["● ","Services"]}),u(a,{children:[" ",String(e.length)," / ",String(r.length)," running"]}),t.length>0&&u(a,{dimColor:!0,children:[" ",t]}),d(a,{dimColor:!0,children:" [Tab ↓]"})]})},"StatusPill"),Sn=Ye(({states:r})=>{const e=r.find(t=>t.status==="crashed"||t.status==="failed");return e?u(g,{flexDirection:"column",paddingX:1,children:[u(a,{bold:!0,color:"red",children:["✖ ","Service crashed:"," ",e.id]}),e.tailLines.slice(-3).map((t,s)=>u(a,{color:"red",dimColor:!0,children:[" ",t]},`crash-${String(s)}`))]}):d(Dr,{})},"CrashHeader"),$n=Ye(({activeIndex:r,focused:e,store:t})=>{const s=ut(t.subscribe,t.getSnapshot),o=t.getIds();if(o.length===0)return d(Dr,{});const n=o.map(f=>s.get(f)).filter(f=>f!==void 0),i=t.getDockState(),l=i==="crash"?"red":i==="ready"?"gray":e?"white":"cyan";return i==="ready"&&!e?d(g,{borderColor:l,borderStyle:"single",flexDirection:"row",flexShrink:0,children:d(bn,{states:n})}):u(g,{borderBottomTitle:e?i==="crash"?"↑↓ select Enter logs R retry Esc back":"↑↓ select Enter logs Esc back":"Tab to focus services",borderColor:l,borderStyle:e?"bold":"single",borderTopTitle:i==="crash"?"Services (crashed)":i==="ready"?"Services":"Services (starting)",flexDirection:"column",flexGrow:2,flexShrink:0,minHeight:6,paddingX:1,children:[i==="crash"&&d(Sn,{states:n}),n.map((f,p)=>d(kn,{active:p===r,focused:e,state:f},f.id))]})},"ServiceDock");var Tn=Object.defineProperty,bt=A((r,e)=>Tn(r,"name",{value:e,configurable:!0}),"T$2");const Jr=6,Zr=8,es=12,Cn=bt(r=>r==="running"||r==="pending"?Br:r==="local-cache"||r==="local-cache-kept-existing"?"Local":r==="remote-cache"?"Remote":vt,"getCacheLabel"),Sr=bt((r,e)=>e[0]===r?"[1]":e[1]===r?"[2]":"","getPinLabel"),$r=bt(({compact:r,focused:e,isSelected:t,pinLabel:s,row:o})=>{const{persistent:n,status:i,taskId:l}=o,h=e&&t,m=h?">":" ",f=i==="running"&&n===!0;let p;if(f)p=d(a,{bold:!0,color:"green",children:" ● "});else if(i==="running")p=u(a,{bold:!0,color:"white",children:[" ",d(Gr,{type:"dots"})," "]});else if(i==="pending")p=d(a,{bold:!0,color:"gray",children:" · "});else{const{color:S,icon:x}=ot(i);p=u(a,{bold:!0,color:S,children:[" ",x," "]})}let c=Br;return f?c="running":i!=="running"&&i!=="pending"?c=o.duration===void 0?vt:We(o.duration):i==="running"&&o.elapsed!==void 0&&(c=We(o.elapsed)),u(g,{children:[d(a,{children:m}),d(g,{width:Jr,children:p}),u(g,{flexGrow:1,children:[d(a,{bold:h,inverse:h,children:l}),s?d(a,{dimColor:!0,children:` ${s}`}):null]}),!r&&d(g,{justifyContent:"flex-end",width:Zr,children:d(a,{dimColor:!Ve(i),children:Cn(i)})}),!r&&d(g,{justifyContent:"flex-end",width:es,children:d(a,{color:f?"green":void 0,dimColor:i==="pending"||f,children:c})})]})},"TaskListRow"),Tr=bt(({compact:r,filterActive:e,filterText:t,focused:s,headerStatus:o,parallelSlots:n=3,pinnedTaskIds:i,rows:l,scrollRef:h,selectedIndex:m,title:f})=>{const p=o==="error"?"red":o==="success"?"green":s?"white":"gray",c=l[m]?.taskId,S=[];let x=0;for(const y of l)y.status==="running"?S.push(y):y.status==="pending"&&(x+=1);const B=Math.min(n,S.length+x),E=B>1,$=[];if(E)for(let y=0;y<B;y++){const P=S[y];P?$.push(d($r,{compact:r,focused:s,isSelected:P.taskId===c,pinLabel:Sr(P.taskId,i),row:P},`par-${P.taskId}`)):$.push(u(g,{children:[d(a,{children:" "}),d(g,{width:Jr,children:d(a,{bold:!0,color:"gray",children:" · "})}),d(a,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(y)}`))}return u(g,{borderColor:p,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[u(g,{flexShrink:0,paddingX:1,children:[d(a,{bold:!0,inverse:!0,children:" VIS "}),d(a,{children:` ${f}`}),!r&&u(g,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[d(g,{justifyContent:"flex-end",width:Zr,children:d(a,{dimColor:!0,children:"Cache"})}),d(g,{justifyContent:"flex-end",width:es,children:d(a,{dimColor:!0,children:"Duration"})})]})]}),d(Nr,{flexGrow:1,flexShrink:1,paddingX:1,paddingY:1,ref:h,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:l.map(y=>d($r,{compact:r,focused:s,isSelected:y.taskId===c,pinLabel:Sr(y.taskId,i),row:y},y.taskId))}),E&&d(g,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingX:1,paddingY:1,children:$}),e&&u(g,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexShrink:0,paddingX:1,children:[d(a,{bold:!0,color:"white",children:"/ "}),d(a,{children:t}),d(a,{inverse:!0,children:" "})]})]})},"TaskListPanel");var In=Object.defineProperty,xn=A((r,e)=>In(r,"name",{value:e,configurable:!0}),"ue");const Cr=40,Ir=10,xr=100,Rn=Object.freeze([]),Mn=xn(({autoExitSeconds:r,onRetryService:e,parallelSlots:t,projectNames:s,serviceDockStore:o,stdinRegistry:n,store:i,targets:l,tasks:h})=>{const{exit:m}=yi(),{columns:f,rows:p}=ki(),c=ut(i.subscribe,i.getSnapshot),S=lt(C=>o?o.subscribe(C):()=>{},[o]);ut(S,()=>o?o.getDockState():"ready");const x=o?o.getIds():Rn,B=x.length>0,[E,$]=Je(0),[y,P]=Je(null),X=ut(S,()=>y&&o?o.getState(y):void 0),[U,v]=Je(!1),R=Ze(null),V=Ze(null),O=Ze(null),[K,oe]=Je(!1),[q,N]=Je(!0),ee=Ze({list:0,splitList:0,splitOutput:0}),ne=lt(()=>{c.viewMode==="list"?ee.current.list=V.current?.getScrollOffset()??0:c.viewMode==="split"&&(ee.current.splitList=V.current?.getScrollOffset()??0,ee.current.splitOutput=O.current?.getScrollOffset()??0)},[c.viewMode]),D=lt(C=>{setTimeout(()=>{if(C==="list"){const k=ee.current.list;V.current?.scrollTo(k)}else if(C==="split"){const k=ee.current.splitList;k>0?V.current?.scrollTo(k):V.current?.scrollTo(Math.max(0,i.getSnapshot().selectedIndex-2)),O.current?.scrollTo(ee.current.splitOutput)}},0)},[i]),ae=Ze(!1);Tt(()=>{c.done&&!ae.current&&(ae.current=!0,r>0&&oe(!0)),!c.done&&ae.current&&(ae.current=!1,oe(!1))},[c.done,r]);const de=Ct(()=>{const C=x.length>0?new Set(x):null,k=c.filterText?c.filterText.toLowerCase():null,M=[];for(const te of c.rows)C?.has(te.taskId)||c.statusFilter==="failed"&&te.status!=="failure"||c.statusFilter==="running"&&te.status!=="running"&&te.status!=="pending"||c.statusFilter==="passed"&&te.status!=="success"&&!Ve(te.status)||k&&!te.taskId.toLowerCase().includes(k)||M.push(te);return M},[c.rows,c.filterText,c.statusFilter,x]),je=Ct(()=>{let C=0;for(const k of c.rows)k.status==="running"&&(C+=1);return C},[c.rows]),ie=(de[c.selectedIndex]??null)?.taskId??null,G=y?null:c.pinnedTaskIds[0]??ie,_=G?c.rows.find(C=>C.taskId===G):null,Ie=X??null,ye=y?(Ie?.tailLines??[]).join(`
|
|
16
|
+
`):G?c.outputs.get(G)??"":"",me=Ct(()=>_?.status==="failure"&&ye?Kr(ye,{color:!process.env.NO_COLOR,cwd:process.cwd()}):ye,[_?.status,ye]),xe=y??G,Ee=y?Ie?.status==="crashed"||Ie?.status==="failed"?"failure":"running":_?.status,Ae=Ht(s,l,h),De=c.done?`Completed ${Ae} (${We((c.endTime??Date.now())-c.startTime)})`:`Running ${Ae}...`,ke=c.done?c.failed>0?"error":"success":"running",ce=lt(C=>{V.current?.scrollTo(Math.max(0,C-2))},[]);if(Tt(()=>{c.interactiveMode&&_?.status!=="running"&&i.setInteractiveMode(!1)},[c.interactiveMode,_?.status,i]),Tt(()=>{if(!G)return;let C=f;c.viewMode==="split"&&f>=xr?C=f-Math.floor(f*.4)-2:(c.viewMode==="split"||c.viewMode==="fullscreen")&&(C=f-2);const k=Math.max(1,p-4);n.get(G)?.resize?.(C,k)},[f,p,c.viewMode,G]),pr((C,k)=>{if(k.escape){i.setInteractiveMode(!1);return}if(!G)return;const M=n.get(G);if(!M){i.setInteractiveMode(!1);return}if(k.return)M.write("\r");else if(k.upArrow)M.write("\x1B[A");else if(k.downArrow)M.write("\x1B[B");else if(k.rightArrow)M.write("\x1B[C");else if(k.leftArrow)M.write("\x1B[D");else if(k.backspace)M.write("");else if(k.delete)M.write("\x1B[3~");else if(k.tab)M.write(" ");else if(k.home)M.write("\x1B[H");else if(k.end)M.write("\x1B[F");else if(k.pageUp)M.write("\x1B[5~");else if(k.pageDown)M.write("\x1B[6~");else if(k.ctrl&&C){const te=C.toUpperCase().codePointAt(0);te!==void 0&&te>=65&&te<=90&&M.write(String.fromCodePoint(te-64))}else C&&M.write(C)},{isActive:c.interactiveMode}),pr((C,k)=>{if(C==="c"&&k.ctrl){m();return}if(!K){if(U){k.escape||C==="?"?v(!1):C==="q"?(v(!1),oe(!0)):k.downArrow||C==="j"?R.current?.scrollBy(1):k.upArrow||C==="k"?R.current?.scrollBy(-1):k.pageDown?R.current?.scrollBy(5):k.pageUp?R.current?.scrollBy(-5):k.home?R.current?.scrollToTop():k.end&&R.current?.scrollToBottom();return}if(C==="?"){v(!0);return}if(C==="q"){oe(!0);return}if(C==="r"&&c.done){i.requestRerun();return}if(C==="R"&&c.done){const M=de[c.selectedIndex];M?.status==="failure"&&i.requestRetry(M.taskId);return}if(C==="F"&&!c.filterActive){const M=["all","failed","running","passed"],te=M.indexOf(c.statusFilter);i.setStatusFilter(M[(te+1)%M.length]);return}if(c.filterActive){if(k.escape){i.setFilterActive(!1);return}if(k.return){i.setFilterActive(!1);return}if(k.backspace){i.setFilter(c.filterText.slice(0,-1));return}if(C&&!k.ctrl&&!k.meta){i.setFilter(c.filterText+C);return}return}if(C==="i"&&_?.status==="running"&&(c.viewMode==="fullscreen"||c.viewMode==="split"&&c.focusedPanel==="output")){i.setInteractiveMode(!0);return}if(c.viewMode==="fullscreen"){if(k.escape){i.setViewMode("split"),D("split");return}if(C==="f"){const M=!q;N(M),M&&O.current?.scrollToBottom();return}if(k.downArrow||C==="j"){N(!1),O.current?.scrollBy(1);return}if(k.upArrow||C==="k"){N(!1),O.current?.scrollBy(-1);return}if(k.pageDown||k.ctrl&&C==="d"){N(!1),O.current?.scrollBy(12);return}if(k.pageUp||k.ctrl&&C==="u"){N(!1),O.current?.scrollBy(-12);return}if(k.home){N(!1),O.current?.scrollToTop();return}if(k.end){N(!0),O.current?.scrollToBottom();return}return}if(c.focusedPanel==="dock"&&B&&o){if(k.tab){P(null),i.setFocusedPanel("tasks");return}if(k.escape){i.setFocusedPanel("tasks"),P(null),c.viewMode==="split"&&(i.setViewMode("list"),D("list"));return}if(k.downArrow||C==="j"){$(M=>Math.min(M+1,x.length-1));return}if(k.upArrow||C==="k"){$(M=>Math.max(M-1,0));return}if(k.return){const M=x[E];M&&(P(M),N(!0),ne(),ee.current.splitList=0,ee.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),D("split"));return}if((C==="r"||C==="R")&&e){const M=x[E],te=M?o.getState(M)?.status:void 0;if(M&&(te==="crashed"||te==="failed")){const Se=e(M);Se instanceof Promise&&Se.catch(()=>{})}return}return}if(c.viewMode==="split"){if(k.tab){c.focusedPanel==="tasks"?i.setFocusedPanel("output"):B?i.setFocusedPanel("dock"):(P(null),i.setFocusedPanel("tasks"));return}if(c.focusedPanel==="output"){if(k.escape){if(y&&B){P(null),i.setViewMode("list"),i.setFocusedPanel("dock"),D("list");return}P(null),i.setFocusedPanel("tasks");return}if(k.return){ne(),i.setViewMode("fullscreen");return}if(C==="f"){const M=!q;N(M),M&&O.current?.scrollToBottom();return}if(k.downArrow||C==="j"){N(!1),O.current?.scrollBy(1);return}if(k.upArrow||C==="k"){N(!1),O.current?.scrollBy(-1);return}if(k.pageDown||k.ctrl&&C==="d"){N(!1),O.current?.scrollBy(12);return}if(k.pageUp||k.ctrl&&C==="u"){N(!1),O.current?.scrollBy(-12);return}if(k.home){N(!1),O.current?.scrollToTop();return}if(k.end){N(!0),O.current?.scrollToBottom();return}return}if(k.escape){i.setViewMode("list"),D("list");return}if(k.return){i.setFocusedPanel("output");return}}if(c.viewMode==="list"||c.viewMode==="split"&&c.focusedPanel==="tasks"){if(k.tab&&c.viewMode==="list"&&B){i.setFocusedPanel("dock");return}if(k.downArrow||C==="j"){const M=Math.min(c.selectedIndex+1,Math.max(0,de.length-1));i.setSelectedIndex(M),ce(M);return}if(k.upArrow||C==="k"){const M=Math.max(c.selectedIndex-1,0);i.setSelectedIndex(M),ce(M);return}if(k.return&&c.viewMode==="list"){N(!0),ne(),ee.current.splitList=0,ee.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),D("split");return}if(C==="/"){i.setFilterActive(!0);return}if(C==="1"&&ie){i.pinTask(0,ie);return}if(C==="2"&&ie){i.pinTask(1,ie);return}if(C==="0"){i.clearPins();return}k.escape&&c.filterText&&i.setFilter("")}}},{isActive:!c.interactiveMode}),f<Cr||p<Ir)return d(g,{alignItems:"center",height:p,justifyContent:"center",width:f,children:u(a,{color:"yellow",children:["Terminal too small (",f,"x",p,"). Minimum:"," ",Cr,"x",Ir]})});const Le=u(g,{gap:1,children:[c.succeeded>0&&u(a,{bold:!0,color:"green",children:["✓"," ",c.succeeded]}),c.failed>0&&u(a,{bold:!0,color:"red",children:["✗"," ",c.failed]}),je>0&&u(a,{color:"cyan",children:["◷"," ",je]}),u(a,{dimColor:!0,children:[c.rows.length," ","total"]}),c.statusFilter!=="all"&&u(a,{color:"yellow",children:["[",c.statusFilter,"]"]})]});let be;if(c.viewMode==="fullscreen")be=[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"Esc"}),d(a,{dimColor:!0,children:"BACK"})]},"esc"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"↑↓"}),d(a,{dimColor:!0,children:"SCROLL"})]},"scroll"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"^u ^d"}),d(a,{dimColor:!0,children:"PAGE"})]},"page"),..._?.status==="running"?[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"i"}),d(a,{dimColor:!0,children:"INPUT"})]},"i")]:[],u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"q"}),d(a,{dimColor:!0,children:"QUIT"})]},"q")];else if(c.done){const C=de[c.selectedIndex]?.status==="failure";be=[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"q"}),d(a,{dimColor:!0,children:"QUIT"})]},"q"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"r"}),d(a,{dimColor:!0,children:"RERUN"})]},"r"),...C?[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"R"}),d(a,{dimColor:!0,children:"RETRY"})]},"R")]:[],u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"?"}),d(a,{dimColor:!0,children:"HELP"})]},"?"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"↑↓"}),d(a,{dimColor:!0,children:"NAV"})]},"nav"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"F"}),d(a,{dimColor:!0,children:"FILTER"})]},"F"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"⏎"}),d(a,{dimColor:!0,children:c.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter")]}else c.viewMode==="split"&&c.focusedPanel==="output"?be=[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"q"}),d(a,{dimColor:!0,children:"QUIT"})]},"q"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"Esc"}),d(a,{dimColor:!0,children:"BACK"})]},"esc"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"↑↓"}),d(a,{dimColor:!0,children:"SCROLL"})]},"scroll"),..._?.status==="running"?[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"i"}),d(a,{dimColor:!0,children:"INPUT"})]},"i")]:[],u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"⏎"}),d(a,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"Tab"}),d(a,{dimColor:!0,children:"PANEL"})]},"tab"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"?"}),d(a,{dimColor:!0,children:"HELP"})]},"?")]:be=[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"q"}),d(a,{dimColor:!0,children:"QUIT"})]},"q"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"?"}),d(a,{dimColor:!0,children:"HELP"})]},"?"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"↑↓"}),d(a,{dimColor:!0,children:"NAV"})]},"nav"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"/"}),d(a,{dimColor:!0,children:"FILTER"})]},"/"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"F"}),d(a,{dimColor:!0,children:"STATUS"})]},"F"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"⏎"}),d(a,{dimColor:!0,children:c.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...c.viewMode==="split"?[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"Tab"}),d(a,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const Pe=u(g,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[d(g,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:be}),d(g,{flexShrink:0,paddingX:1,children:Le})]}),ue=u(vi,{backgroundColor:"#1e1e1e",footer:u(a,{dimColor:!0,children:[d(a,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",d(a,{bold:!0,color:"white",children:"?"}),"/",d(a,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:R,title:"KEYBOARD SHORTCUTS",visible:U,width:52,children:[u(g,{flexDirection:"column",marginBottom:1,children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"NAVIGATION"})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","↑","/k"]}),d(a,{dimColor:!0,children:" Move up"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","↓","/j"]}),d(a,{dimColor:!0,children:" Move down"})]})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Tab"]}),d(a,{dimColor:!0,children:" Switch panel (split)"})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Esc"]}),d(a,{dimColor:!0,children:" Back / close"})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Enter"]}),d(a,{dimColor:!0,children:" Show output / fullscreen"})]})]}),u(g,{flexDirection:"column",marginBottom:1,children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"VIEWS"})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Enter"]}),u(a,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Esc"]}),u(a,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),u(g,{flexDirection:"column",marginBottom:1,children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"ACTIONS"})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","/"]}),d(a,{dimColor:!0,children:" Filter by text"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","F"]}),d(a,{dimColor:!0,children:" Filter by status"})]})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","1"]}),d(a,{dimColor:!0,children:"/"}),d(a,{bold:!0,color:"white",children:"2"}),d(a,{dimColor:!0,children:" Pin to output pane"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","0"]}),d(a,{dimColor:!0,children:" Clear pins"})]})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","r"]}),d(a,{dimColor:!0,children:" Rerun all (done)"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","R"]}),d(a,{dimColor:!0,children:" Retry failed task"})]})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","i"]}),d(a,{dimColor:!0,children:" Interactive input (running task)"})]})]}),u(g,{flexDirection:"column",marginBottom:1,children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"SCROLLING"}),d(a,{dimColor:!0,children:" (output panel)"})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","↑","/k"]}),d(a,{dimColor:!0,children:" Scroll up"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","↓","/j"]}),d(a,{dimColor:!0,children:" Scroll down"})]})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","^u"]}),d(a,{dimColor:!0,children:" Page up"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","^d"]}),d(a,{dimColor:!0,children:" Page down"})]})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Home"]}),d(a,{dimColor:!0,children:" Top"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","End"]}),d(a,{dimColor:!0,children:" Bottom (resume follow)"})]})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","f"]}),d(a,{dimColor:!0,children:" Toggle auto-scroll (tail mode)"})]})]}),u(g,{flexDirection:"column",children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"GENERAL"})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","q"]}),d(a,{dimColor:!0,children:" Quit"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","?"]}),d(a,{dimColor:!0,children:" Toggle help"})]})]})]})]}),_e=d(bs,{autoExitSeconds:r>0?r:3,onCancel:A(()=>{oe(!1)},"onCancel"),visible:K}),Re=B&&o?d($n,{activeIndex:E,focused:c.focusedPanel==="dock",store:o}):null;if(c.viewMode==="fullscreen")return u(g,{flexDirection:"column",height:p,width:f,children:[d(g,{flexGrow:1,children:d(br,{autoScroll:q,duration:_?.duration??_?.elapsed,focused:!0,interactiveMode:c.interactiveMode,output:me,scrollRef:O,status:Ee,supportsInteractive:!y,taskId:xe})}),Re,Pe,_e,ue]});if(c.viewMode==="split"){const C=f>=xr,k=d(Tr,{compact:!0,filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel==="tasks",headerStatus:ke,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:de,scrollRef:V,selectedIndex:c.selectedIndex,title:De}),M=d(br,{autoScroll:q,duration:_?.duration??_?.elapsed,focused:c.focusedPanel==="output",interactiveMode:c.interactiveMode,output:me,scrollRef:O,showFullscreenHint:!0,status:Ee,supportsInteractive:!y,taskId:xe});if(C){const Se=Math.floor(f*.4);return u(g,{flexDirection:"column",height:p,width:f,children:[u(g,{flexDirection:"row",flexGrow:1,children:[d(g,{width:Se,children:k}),d(g,{flexGrow:1,children:M})]}),Re,Pe,_e,ue]})}const te=Math.floor(p*.45);return u(g,{flexDirection:"column",height:p,width:f,children:[d(g,{height:te,children:k}),d(g,{flexGrow:1,children:M}),Re,Pe,_e,ue]})}return u(g,{flexDirection:"column",height:p,width:f,children:[d(g,{flexGrow:1,children:d(Tr,{filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel!=="dock",headerStatus:ke,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:de,scrollRef:V,selectedIndex:c.selectedIndex,title:De})}),Re,Pe,_e,ue]})},"VisTaskRunnerApp");var En=Object.defineProperty,He=A((r,e)=>En(r,"name",{value:e,configurable:!0}),"r$2");const Pn=He(r=>{const{args:e,autoExit:t=!1,onRetryService:s,outputStyle:o="normal",projectNames:n,serviceDockStore:i,stdinRegistry:l,tasks:h}=r,m=new gt(h),f=typeof e.parallel=="number"?e.parallel:3,p=t===!0?3:typeof t=="number"?t:0;let c,S;const x=new Promise(R=>{S=R});let B;const E=He(()=>{B&&(clearInterval(B),B=void 0)},"cleanup"),$=He(()=>{if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),process.stdin.unref()},"releaseStdin"),y=He(()=>{if(l){for(const R of l.values())R.kill?.();l.clear()}},"killAllPtyProcesses"),P=He(()=>{E(),v(),y(),$(),process.stdout.write("\x1B[?1049l\x1B[?25h"),c?.cleanup(),process.exit(1)},"onSignal"),X=He(()=>{const R=m.getSnapshot(),V=We(Date.now()-R.startTime),O=R.rows.filter(q=>q.status==="failure").map(q=>q.taskId),K=process.stdout.columns||80;process.stdout.write(`
|
|
17
|
+
`);for(const q of R.rows){const{persistent:N,status:ee,taskId:ne}=q,D=ee==="running"||ee==="pending",ae=ot(ee),de=D&&N?"■":ae.icon,je=D&&N?"gray":ae.color;let ie="";switch(ee){case"local-cache":case"local-cache-kept-existing":{ie=" [local cache]";break}case"remote-cache":{ie=" [remote cache]";break}case"skipped":{ie=" [skipped]";break}default:{D&&N?ie=" [stopped]":D&&(ie=" [skipped]");break}}const G=q.retryAttempts&&q.retryAttempts>0?` [retried ${q.retryAttempts}x]`:"",_=pe(J.createElement(a,null," ",J.createElement(a,{color:je},de),` vis run ${ne}`,ie?J.createElement(a,{dimColor:!0},` ${ie}`):null,G?J.createElement(a,{color:"yellow"},G):null),{columns:K});process.stdout.write(`${_}
|
|
18
18
|
`)}process.stdout.write(`
|
|
19
|
-
`);const
|
|
20
|
-
`),
|
|
21
|
-
`,
|
|
22
|
-
|
|
23
|
-
`);const
|
|
24
|
-
`).map(
|
|
25
|
-
`);process.stdout.write(`${
|
|
26
|
-
`)}}},"printExitSummary");let
|
|
19
|
+
`);const oe=pe(J.createElement(Vr,{cached:R.cached,failed:R.failed,failedIds:O,projectNames:n,retriedIds:R.retriedIds.length>0?R.retriedIds:void 0,succeeded:R.succeeded,targets:e.targets,tasks:h,took:V}),{columns:K});if(process.stdout.write(`${oe}
|
|
20
|
+
`),O.length>0&&o!=="quiet")for(const q of O){const N=R.outputs.get(q);if(N?.trim()){const ee=pe(J.createElement(a,null,`
|
|
21
|
+
`,J.createElement(a,{bold:!0,color:"red"},` ${Lt} vis run ${q}`)),{columns:K});process.stdout.write(`${ee}
|
|
22
|
+
|
|
23
|
+
`);const ne=N.trim().split(`
|
|
24
|
+
`).map(D=>` ${D}`).join(`
|
|
25
|
+
`);process.stdout.write(`${ne}
|
|
26
|
+
`)}}},"printExitSummary");let U;const v=He(()=>{U&&(clearInterval(U),U=void 0)},"clearKeepAlive");return{lifeCycle:{endCommand(){E(),m.markDone(),U||(U=setInterval(()=>{},1e3))},endTasks(R){m.endTasks(R)},printTaskTerminalOutput(R,V,O){m.getSnapshot().outputs.has(R.id)||m.addOutput(R.id,O)},startCommand(){process.on("SIGINT",P),process.on("SIGTERM",P),U||(U=setInterval(()=>{},1e3)),c=wi(J.createElement(Mn,{autoExitSeconds:p,onRetryService:s,parallelSlots:f,projectNames:n,serviceDockStore:i,stdinRegistry:l??new Map,store:m,targets:e.targets,tasks:h}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}),c.waitUntilExit().then(()=>{v(),y(),$(),process.removeListener("SIGINT",P),process.removeListener("SIGTERM",P),X(),S()}).catch(()=>{v(),y(),$(),process.removeListener("SIGINT",P),process.removeListener("SIGTERM",P),S()})},startTasks(R){m.startTasks(R),B||(B=setInterval(()=>{m.tick()},100))}},renderIsDone:x,store:m}},"createDynamicOutputRenderer");var Fn=Object.defineProperty,zt=A((r,e)=>Fn(r,"name",{value:e,configurable:!0}),"c$3");const On=zt(r=>r==="quiet"?"quiet":"normal","parseOutputStyle"),jn=zt((r,e)=>{const t=r.overrides.visOptions;return t?.outputStyle==="normal"||t?.outputStyle==="quiet"?t.outputStyle:e},"resolveTaskOutputStyle");class An{static{A(this,"StaticOutputLifeCycle")}static{zt(this,"StaticOutputLifeCycle")}#e;#s;#r;#i=[];#t=[];#o=[];#n=new Map;#a;#c;#l;#d=0;constructor(e){this.#e=e.projectNames,this.#s=e.args.targets,this.#r=e.tasks,this.#a=e.logReporter,this.#c=e.outputStyle??"normal",this.#l=e.ciGrouping??"auto"}startCommand(){this.#d=Date.now();const e=process.stdout.columns||80,t=`Running ${Ht(this.#e,this.#s,this.#r)}`,s=pe(J.createElement(Pt,{title:t,variant:"info"}),{columns:e});process.stdout.write(s);const o=this.#r[0],n=o?.overrides?Object.entries(o.overrides).filter(([i])=>i!=="command"):[];if(n.length>0){process.stdout.write(`
|
|
27
27
|
With additional flags:
|
|
28
|
-
`);for(const[i,l]of
|
|
28
|
+
`);for(const[i,l]of n)process.stdout.write(`${Uo(" ",i,l)}
|
|
29
29
|
`)}process.stdout.write(`
|
|
30
|
-
`)}startTasks(e){const t=process.stdout.columns||80;for(const s of e){const
|
|
31
|
-
`)}}endTasks(e){const t=process.stdout.columns||80;for(const s of e){this.#
|
|
32
|
-
`)}}printTaskTerminalOutput(e,t,s){if(
|
|
33
|
-
`);const s=process.stdout.columns||80,
|
|
34
|
-
`)}}var
|
|
35
|
-
`;await Bt(e,t)},"writeZshHistory"),
|
|
36
|
-
`)},"writeBashHistory"),
|
|
30
|
+
`)}startTasks(e){const t=process.stdout.columns||80;for(const s of e){const o=pe(J.createElement(a,null,J.createElement(a,{dimColor:!0},">"),` ${s.id}`),{columns:t});process.stdout.write(`${o}
|
|
31
|
+
`)}}endTasks(e){const t=process.stdout.columns||80;for(const s of e){this.#n.set(s.task.id,s),s.status==="failure"?this.#i.push(s):Ve(s.status)&&this.#t.push(s),s.retryAttempts&&s.retryAttempts>0&&this.#o.push(s);const o=tt(s.status),n=s.startTime&&s.endTime?` (${We(s.endTime-s.startTime)})`:"",i=Ve(s.status)?" [cache]":"",l=s.retryAttempts&&s.retryAttempts>0?` [retried ${s.retryAttempts}x]`:"",h=pe(J.createElement(a,null,o,` ${s.task.id}`,i?J.createElement(a,{color:"cyan"},i):null,l?J.createElement(a,{color:"yellow"},l):null,n?J.createElement(a,{dimColor:!0},n):null),{columns:t});process.stdout.write(`${h}
|
|
32
|
+
`)}}printTaskTerminalOutput(e,t,s){if(jn(e,this.#c)==="quiet"&&(t==="success"||Ve(t)))return;const o=t==="failure"?Kr(s,{color:!process.env.NO_COLOR,cwd:process.cwd()}):s;if(this.#a){this.#a.printTaskTerminalOutput(e,t,o);return}fn(e.id,t,o,this.#l)}endCommand(){const e=We(Date.now()-this.#d),t=this.#r.filter(n=>!this.#n.has(n.id)).map(n=>n.id);process.stdout.write(`
|
|
33
|
+
`);const s=process.stdout.columns||80,o=pe(J.createElement(Vr,{cached:this.#t.length,failed:this.#i.length,failedIds:this.#i.map(n=>n.task.id),projectNames:this.#e,retriedIds:this.#o.length>0?this.#o.map(n=>n.task.id):void 0,skippedIds:t.length>0?t:void 0,succeeded:this.#n.size-this.#i.length-this.#t.length,targets:this.#s,tasks:this.#r,took:e}),{columns:s});process.stdout.write(`${o}
|
|
34
|
+
`)}}var Dn=Object.defineProperty,St=A((r,e)=>Dn(r,"name",{value:e,configurable:!0}),"o");const Ln=St(async r=>{if(process.env.VIS_NO_SHELL_HISTORY||Oi()==="win32")return;const e=process.env.SHELL;if(!e)return;const t=ws(e);try{if(t==="zsh"){await Bn(r);return}if(t==="bash"){await Nn(r);return}t==="fish"&&await Gn(r)}catch{}},"appendToShellHistory"),Bn=St(async r=>{const e=process.env.HISTFILE??Ce(process.env.ZDOTDIR??Nt(),".zsh_history"),t=`: ${Math.floor(Date.now()/1e3)}:0;${r}
|
|
35
|
+
`;await Bt(e,t)},"writeZshHistory"),Nn=St(async r=>{const e=process.env.HISTFILE??Ce(Nt(),".bash_history");await Bt(e,`${r}
|
|
36
|
+
`)},"writeBashHistory"),Gn=St(async r=>{const e=Ce(Nt(),".local","share","fish","fish_history"),t=`- cmd: ${r.replaceAll("\\","\\\\").replaceAll(`
|
|
37
37
|
`,String.raw`\n`)}
|
|
38
38
|
when: ${Math.floor(Date.now()/1e3)}
|
|
39
|
-
`;await Bt(e,t)},"writeFishHistory");var
|
|
40
|
-
`),
|
|
41
|
-
`)},"writeHelp"),
|
|
42
|
-
`);if(
|
|
43
|
-
`):await e.onFilter(p)}finally{i=!1}break}case"q":{await e.onQuit();break}case"r":{await e.onRerun();break}case"return":{await e.onRerun();break}}},"dispatch"),
|
|
44
|
-
`)})},"onKeypress"),m=t;return m.on("keypress",
|
|
45
|
-
`),
|
|
46
|
-
`)}#
|
|
47
|
-
`);return}switch(s.event){case"failed":{const
|
|
48
|
-
`)}}#
|
|
49
|
-
`))l.length!==0&&this.#
|
|
50
|
-
`),
|
|
39
|
+
`;await Bt(e,t)},"writeFishHistory");var _n=Object.defineProperty,Mt=A((r,e)=>_n(r,"name",{value:e,configurable:!0}),"e");const qn=Mt(r=>{const{killGracePeriodMs:e=5e3,onTimeout:t,sendSignal:s,timeoutMs:o}=r;if(o<=0)return{cancel:Mt(()=>{},"cancel")};const n=Math.max(e,0);let i;const l=setTimeout(()=>{t?.(),s("SIGTERM"),n>0&&(i=setTimeout(()=>{s("SIGKILL")},n))},o);return{cancel:Mt(()=>{clearTimeout(l),i&&clearTimeout(i)},"cancel")}},"scheduleTimeoutKill");var Hn=Object.defineProperty,Ft=A((r,e)=>Hn(r,"name",{value:e,configurable:!0}),"r");const ts=Li(import.meta.url);let et;const Wn=Ft(()=>{if(et!==void 0)return et;try{ts.resolve("fb-watchman")}catch{return et=!1,!1}try{Ai("watchman",["--version"],{stdio:"ignore",timeout:2e3})}catch{return et=!1,!1}return et=!0,!0},"isWatchmanAvailable"),zn=Ft((r,e)=>{if(!Wn())return;let t;try{t=ts("fb-watchman")}catch(o){Ue.warn(`[vis watch] fb-watchman failed to load, using native watcher: ${o.message}`);return}const s=new t.Client;s.on("error",o=>{Ue.warn(`[vis watch] watchman error: ${o.message}`)}),s.on("subscription",o=>{const n=o;if(!n.is_fresh_instance)for(const i of n.files??[])e(i)});for(const[o,n]of r.entries()){const i=At(n),l=`vis-watch-${o}-${process.pid}`;s.command(["watch-project",i],(h,m)=>{if(h){Ue.warn(`[vis watch] watchman could not watch ${n}: ${h.message}`);return}const f={expression:["allof",["type","f"]],fields:["name"]};m.relative_path&&(f.relative_root=m.relative_path),s.command(["subscribe",m.watch,l,f],p=>{p&&Ue.warn(`[vis watch] watchman subscribe failed for ${n}: ${p.message}`)})})}return{close:Ft(()=>{try{s.end()}catch{}},"close")}},"startWatchmanWatcher");var Un=Object.defineProperty,Ne=A((r,e)=>Un(r,"name",{value:e,configurable:!0}),"c$1");const Vn=[/node_modules(?:\/|$)/,/\.git(?:\/|$)/,/\.vis(?:\/|$)/],Rr=Ne((r,e)=>{const t=new Set,s=new Set;for(const[,i]of r){const l=i.task.hashDetails?.nodes;if(l)for(const h of Object.keys(l))t.add(h),s.add(vs(At(e,h)))}const o=[...s].sort(),n=[];for(const i of o)n.some(l=>i===l||i.startsWith(`${l}/`))||n.push(i);return{directories:n,files:t}},"collectTrackedWatchTargets"),Yn=Ne((r,e,t)=>{const s=new Set;for(const o of r){const n=At(e,o);for(const i of t)if(n===i||n.startsWith(`${i}/`)){const l=ys(i,n);l.length>0&&s.add(l)}}return o=>{const n=o.replaceAll("\\","/");return s.has(n)}},"createTrackedFileFilter"),Kn=Ne(r=>{const e=r.replaceAll("\\","/");return Vn.some(t=>t.test(e))},"shouldIgnore"),Mr=Ne(r=>{const{debounceMs:e=150,filter:t,onChange:s,paths:o}=r;let n=new Set,i;const l=Ne(()=>{i=void 0;const p=[...n];n=new Set,p.length!==0&&Promise.resolve(s(p)).catch(c=>{Ue.error("[vis watch] onChange handler failed:",c)})},"flush"),h=Ne(p=>{Kn(p)||t&&!t(p)||(n.add(p),i&&clearTimeout(i),i=setTimeout(l,e))},"emit"),m=zn(o,h);if(m)return{close:Ne(()=>{i&&clearTimeout(i),m.close()},"close")};const f=[];for(const p of o)try{const c=Ks(p,{recursive:!0},(S,x)=>{x&&h(x)});f.push(c)}catch(c){Ue.warn(`[vis watch] unable to watch ${p}: ${c.message}`)}return{close:Ne(()=>{i&&clearTimeout(i);for(const p of f)try{p.close()}catch{}},"close")}},"startWatcher");var Qn=Object.defineProperty,Xn=A((r,e)=>Qn(r,"name",{value:e,configurable:!0}),"n");const Jn=Xn((r,e)=>{const t=e?.trim();if(!t)return{filter:void 0,tasks:[...r]};const s=t.toLowerCase();return{filter:t,tasks:r.filter(o=>o.target.project.toLowerCase().includes(s))}},"applyProjectFilter");var Zn=Object.defineProperty,Fe=A((r,e)=>Zn(r,"name",{value:e,configurable:!0}),"a$1");const ea=[""," Watch keybinds:"," r, Enter rerun"," a rerun all (clear filter)"," p filter by project name"," q, Ctrl+C quit"," h, ? show this help",""].join(`
|
|
40
|
+
`),ta=Fe(r=>{r.write(`${ea}
|
|
41
|
+
`)},"writeHelp"),ra=Fe(async(r,e)=>{e.write("filter projects (empty to cancel) > ");const t=r,s=t.isRaw===!0;if(s)try{t.setRawMode?.(!1)}catch{}return await new Promise(o=>{let n="";const i=Fe(l=>{n+=typeof l=="string"?l:l.toString("utf8");const h=n.indexOf(`
|
|
42
|
+
`);if(h===-1)return;const m=n.slice(0,h).replace(/\r$/,"").trim();if(r.off("data",i),s)try{t.setRawMode?.(!0)}catch{}o(m.length>0?m:void 0)},"onData");r.on("data",i)})},"defaultPromptFilter"),sa=Fe(r=>{const{handlers:e}=r,t=r.input??process.stdin,s=r.output??process.stdout,o=r.promptFilter??ra;if(!t||t.isTTY===!1)return{close:Fe(()=>{},"close")};gi(t);const n=t.isRaw===!0;try{t.setRawMode?.(!0)}catch{return{close:Fe(()=>{},"close")}}typeof t.resume=="function"&&t.resume();let i=!1;const l=Fe(async f=>{if(f.ctrl===!0&&f.name==="c"){await e.onQuit();return}if(!i)switch(f.name){case"?":case"h":{await e.onHelp();break}case"a":{await e.onClearFilter();break}case"p":{i=!0;try{const p=await o(t,s);p===void 0?s.write(`filter cancelled.
|
|
43
|
+
`):await e.onFilter(p)}finally{i=!1}break}case"q":{await e.onQuit();break}case"r":{await e.onRerun();break}case"return":{await e.onRerun();break}}},"dispatch"),h=Fe((f,p)=>{l(p).catch(c=>{s.write(`[vis watch] keybind handler failed: ${c.message}
|
|
44
|
+
`)})},"onKeypress"),m=t;return m.on("keypress",h),{close:Fe(()=>{if(m.off("keypress",h),!n)try{t.setRawMode?.(!1)}catch{}const f=t;if(typeof f.pause=="function")try{f.pause()}catch{}},"close")}},"installKeybinds");var ia=Object.defineProperty,Ot=A((r,e)=>ia(r,"name",{value:e,configurable:!0}),"y");const oa=Ot(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),na=Ot(async r=>{const{initialTasks:e,probe:t,registeredEntries:s,taskGraph:o,visVersion:n}=r,i=new Map,l=new Map,h=new Map;for(const v of s)if(ri(v.pid)){if(v.visVersion!==n){l.set(v.id,v);continue}i.set(v.id,v)}if(t){const v=[...i.values()],R=await Promise.all(v.map(async V=>{try{return[V.id,await t(V)]}catch{return[V.id,!1]}}));for(const[V,O]of R)if(!O){const K=i.get(V);i.delete(V),K&&h.set(V,K)}}const m=new Set(e.map(v=>v.id)),f=new Set,p=[],c=[],S=new Set;for(const v of Object.values(o.dependencies))for(const R of v)S.add(R);for(const[v,R]of Object.entries(o.tasks)){if(!oa(R)?.service)continue;if(i.has(v)){f.add(v),c.push(i.get(v));continue}if(m.has(v)||!S.has(v))continue;const V=l.get(v),O=h.get(v);let K;V?K=`Service ${v} is registered with vis ${V.visVersion}, but this invocation is vis ${n}. Restart with \`vis service restart ${v}\` to pick up the new version.`:O?K=`Service ${v} is registered (PID ${String(O.pid)}) but failed its readiness probe — the wrapper process is alive but the underlying server is not responding. Run \`vis service restart ${v}\` to recover.`:K=`Target depends on the service ${v}, which is not running. Run \`vis service start ${v}\` first, or invoke \`${v}\` directly.`,p.push({message:K,targetId:v})}if(f.size===0)return{diagnostics:p,initialTasks:e,satisfiedServices:c,serviceDependentsByServiceId:new Map,serviceEnvByTaskId:new Map,taskGraph:o};const x=new Map,B=Ot(v=>{const R=new Set,V=[...o.dependencies[v]??[]],O=new Set;for(;V.length>0;){const K=V.pop();if(!O.has(K)){O.add(K),f.has(K)&&R.add(K);for(const oe of o.dependencies[K]??[])O.has(oe)||V.push(oe)}}return[...R].sort()},"collectTransitiveServices"),E=new Map;for(const v of Object.keys(o.dependencies)){if(f.has(v))continue;const R=B(v);if(R.length===0)continue;const V={};for(const O of R){const K=i.get(O);if(!K)continue;Object.assign(V,K.env);const oe=E.get(O);oe?oe.push(v):E.set(O,[v])}Object.keys(V).length>0&&x.set(v,V)}for(const v of E.values())v.sort();const $={};for(const[v,R]of Object.entries(o.tasks))f.has(v)||($[v]=R);const y={};for(const[v,R]of Object.entries(o.dependencies))f.has(v)||(y[v]=R.filter(V=>!f.has(V)));const P=new Map;for(const v of Object.keys($))P.set(v,0);for(const v of Object.values(y))for(const R of v)P.has(R)&&P.set(R,(P.get(R)??0)+1);const X=[];for(const v of o.roots)!f.has(v)&&$[v]&&X.push(v);for(const[v,R]of P)R===0&&!X.includes(v)&&$[v]&&X.push(v);const U=e.filter(v=>!f.has(v.id));return{diagnostics:p,initialTasks:U,satisfiedServices:c,serviceDependentsByServiceId:E,serviceEnvByTaskId:x,taskGraph:{dependencies:y,roots:X,tasks:$}}},"applyServiceRegistry");var aa=Object.defineProperty,rt=A((r,e)=>aa(r,"name",{value:e,configurable:!0}),"c");const dt="[[VIS_BOOT]]",ca=250,la=1e3,Er=3,da=rt(r=>{try{return process.kill(r,0),!0}catch{return!1}},"isAlive"),Pr=rt(r=>{try{const e=Et(r,"utf8").trim(),t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:null}catch{return null}},"readPidFile");class ua{static{A(this,"ServiceEventBridge")}static{rt(this,"ServiceEventBridge")}#e;#s;#r;#i;#t=new Map;#o=new Map;#n=new Map;#a=new Map;#c=new Set;constructor(e){this.#e=e.indexToId,this.#s=new Map(e.services),this.#r=e.sink,this.#i=e.workspaceRoot}onProcessEvent=rt(e=>{if(e.kind!=="stdout"&&e.kind!=="stderr")return;const t=this.#e.get(e.index);t===void 0||e.text===void 0||this.onTaskOutput(t,e.text)},"onProcessEvent");onTaskOutput(e,t){if(!this.#s.has(e))return;const s=((this.#t.get(e)??"")+t).split(`
|
|
45
|
+
`),o=s.pop()??"";this.#t.set(e,o);for(const n of s)this.#l(e,n)}notifyRegistryStarting(e){this.#r.starting(e)}notifyRegistryStarted(e,t){this.#r.started(e,t)}onRegistryTaskStarted(e){this.#s.get(e)?.mode==="registry"&&this.notifyRegistryStarting(e)}async onRegistryTaskClosed(e,t,s){if(this.#s.get(e)?.mode!=="registry")return;if(s||t!==0){this.notifyRegistryFailed(e,"exit-code",{exitCode:t,killed:s});return}const o=await si(this.#i,e);if(!o){this.notifyRegistryFailed(e,"missing-registry-entry");return}const{config:n}=o,i=n.readiness?.tcp?.port??n.port??0,l=n.readiness?.tcp?.host??"127.0.0.1";this.notifyRegistryReady(e,{host:l,logFile:o.logFile,pid:o.pid,port:i})}notifyRegistryReady(e,t){this.#r.ready(e,{host:t.host,port:t.port}),this.#h(e,t.logFile),t.pid!==null&&this.#f(e,t.pid)}notifyRegistryFailed(e,t,s){this.#r.failed(e,t,s)}async retry(e){const t=this.#s.get(e);if(t){if(this.#u(e),this.#t.delete(e),this.#o.delete(e),this.#r.starting(e),t.mode==="registry"){await this.#y(e,t.registry);return}t.mode==="ephemeral"&&this.#v(e,t.ephemeral)}}async dispose(){for(const e of[...this.#n.keys(),...this.#a.keys()])this.#u(e);this.#c.size>0&&(await Promise.race([Promise.all(this.#c),new Promise(e=>{setTimeout(e,2e3)})]),this.#c.clear()),this.#t.clear(),this.#o.clear()}#l(e,t){if(t.startsWith(dt)){this.#d(e,t.slice(dt.length));return}const s=this.#o.get(e)??[];s.push(t),s.length>Er&&s.shift(),this.#o.set(e,s),this.#r.log(e,`${t}
|
|
46
|
+
`)}#d(e,t){let s;try{s=JSON.parse(t)}catch{this.#r.log(e,`${dt+t}
|
|
47
|
+
`);return}switch(s.event){case"failed":{const o=typeof s.reason=="string"?s.reason:"unknown",n={};for(const[i,l]of Object.entries(s))i!=="event"&&i!=="id"&&i!=="reason"&&(n[i]=l);this.#r.failed(e,o,n);break}case"ready":{const o=typeof s.host=="string"?s.host:"127.0.0.1",n=typeof s.port=="number"?s.port:0;this.#r.ready(e,{host:o,port:n}),this.#m(e);break}case"started":{const o=typeof s.pid=="number"?s.pid:null;this.#r.started(e,o);break}default:this.#r.log(e,`${dt+t}
|
|
48
|
+
`)}}#m(e){const t=this.#s.get(e);if(t?.ephemeral===void 0)return;this.#h(e,t.ephemeral.logFile);const s=Pr(t.ephemeral.pidFile);s!==null&&this.#f(e,s)}#h(e,t){if(this.#n.has(e)||!st(t))return;const s=Qs(t,"r"),o=(()=>{try{return mt(t).size}catch{return 0}})(),n={fd:s,logFile:t,pollTimer:setInterval(()=>{this.#g(e)},ca),position:o};this.#n.set(e,n)}#g(e){const t=this.#n.get(e);if(t)try{const s=mt(t.logFile);if(s.size<=t.position)return;const o=Buffer.alloc(s.size-t.position),n=Xs(t.fd,o,0,o.length,t.position);if(n>0){t.position+=n;const i=o.subarray(0,n).toString("utf8");for(const l of i.split(`
|
|
49
|
+
`))l.length!==0&&this.#w(e,l);this.#r.log(e,i)}}catch{}}#w(e,t){const s=this.#o.get(e)??[];for(s.push(t);s.length>Er;)s.shift();this.#o.set(e,s)}#f(e,t){if(this.#a.has(e))return;const s={pid:t,timer:setInterval(()=>{if(!da(t)){const o=[...this.#o.get(e)??[]];this.#u(e),this.#r.crashed(e,o)}},la)};this.#a.set(e,s)}#u(e){const t=this.#n.get(e);if(t){clearInterval(t.pollTimer);try{Js(t.fd)}catch{}this.#n.delete(e)}const s=this.#a.get(e);s&&(clearInterval(s.timer),this.#a.delete(e))}#v(e,t){if(t===void 0)return;const s=Pr(t.pidFile);if(s!==null)try{process.kill(-s,"SIGTERM")}catch{}const o=Di("node",[t.scriptPath,t.configFile],{cwd:t.cwd,stdio:["ignore","pipe","pipe"]});o.stdout.on("data",i=>{this.#p(e,i)}),o.stderr.on("data",i=>{this.#p(e,i)}),o.on("error",i=>{this.#r.failed(e,"respawn-error",{message:i.message})});const n=new Promise(i=>{const l=rt(()=>{this.#c.delete(n),i()},"settle");o.once("exit",l),o.once("error",l)});this.#c.add(n)}#p(e,t){const s=((this.#t.get(e)??"")+t.toString("utf8")).split(`
|
|
50
|
+
`),o=s.pop()??"";this.#t.set(e,o);for(const n of s)this.#l(e,n)}async#y(e,t){if(t!==void 0){try{await ii({id:e,workspaceRoot:this.#i})}catch{}try{const s=await oi({command:t.command,config:t.config,cwd:t.cwd,env:t.env,id:e,workspaceRoot:this.#i}),o=t.config.readiness?.tcp?.port??t.config.port??0,n=t.config.readiness?.tcp?.host??"127.0.0.1";this.#r.started(e,s.entry.pid),this.notifyRegistryReady(e,{host:n,logFile:s.entry.logFile,pid:s.entry.pid,port:o})}catch(s){const o=s instanceof Error?s.message:String(s);this.#r.failed(e,"retry-failed",{message:o})}}}}var ha=Object.defineProperty,ve=A((r,e)=>ha(r,"name",{value:e,configurable:!0}),"p");const fa=ve(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),rs=ve((r,e,t)=>{const s=[],o=[];for(const n of e){const i=t.tasks[n];if(!i){o.push({id:n,reason:"task not in graph"});continue}const l=i.overrides.command;if(!l){o.push({id:n,reason:"no command resolved"});continue}const h=fa(i);if(!h?.service){o.push({id:n,reason:"no service config"});continue}const m=wt(r,i.projectRoot,!!h.runFromWorkspaceRoot),{envFile:f}=h,p=f===void 0||f===!1?{}:Dt(m,f),c=h.service.env??{};s.push({command:l,config:h.service,cwd:m,env:{...p,...c},id:n})}return{services:s,skipped:o}},"extractPreflightTasks"),pa=ve((r,e)=>{const t=new Set(r),s=new Map;for(const i of r){const l=(e.dependencies[i]??[]).filter(h=>t.has(h));s.set(i,new Set(l))}const o=[],n=new Set;for(;s.size>0;){const i=[];for(const[l,h]of s){for(const m of h)n.has(m)&&h.delete(m);h.size===0&&i.push(l)}i.length===0&&i.push(...s.keys());for(const l of i)n.add(l),s.delete(l);i.sort(),o.push({ids:i})}return o},"planTopoLevels"),ma=ve((r,e)=>{const t=[];for(const s of pa(r,e))t.push(...s.ids);return t},"linearize"),ga=String.raw`import { spawn } from "node:child_process";
|
|
51
51
|
import { closeSync, openSync, readFileSync, readSync, statSync, writeFileSync } from "node:fs";
|
|
52
52
|
import { createConnection } from "node:net";
|
|
53
53
|
|
|
@@ -161,14 +161,19 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
|
161
161
|
try { process.kill(-child.pid, "SIGTERM"); } catch {}
|
|
162
162
|
process.exit(1);
|
|
163
163
|
})();
|
|
164
|
-
`,
|
|
165
|
-
`)}:{},v=
|
|
164
|
+
`,wa=ve(()=>{const r=Zs(Ce(ji(),"vis-services-")),e=Ce(r,"bootstrap.mjs");return _r(e,ga),{runDir:r,scriptPath:e}},"prepareBootstrap"),ss=ve((r,e,t)=>{const s=t.replaceAll(/[^\w-]/g,"_");return{configFile:Ce(r,`${s}.json`),logFile:Ce(r,`${s}.log`),pidFile:Ce(r,`${s}.pid`),scriptPath:e}},"buildBootstrapPaths"),va=ve(r=>{const{paths:e,service:t}=r,s=t.config.readiness?.tcp?.port??t.config.port;if(typeof s!="number")throw new TypeError(`Service ${t.id} has no TCP readiness port — declare \`service.port\` or \`service.readiness.tcp.port\`.`);return{command:t.command,cwd:t.cwd,env:t.env,host:t.config.readiness?.tcp?.host??"127.0.0.1",id:t.id,logFile:e.logFile,pidFile:e.pidFile,port:s,timeoutMs:t.config.readiness?.tcp?.timeoutMs??3e4}},"buildEphemeralConfig"),ya=ve(r=>`node ${JSON.stringify(r.scriptPath)} ${JSON.stringify(r.configFile)}`,"buildEphemeralCommand"),ka=ve(r=>{const{id:e,visBin:t,workspaceRoot:s}=r;return`node ${JSON.stringify(t)} service start ${JSON.stringify(e)} --cwd ${JSON.stringify(s)}`},"buildRegistryCommand"),ba=ve(r=>{const{missingServiceIds:e,mode:t,taskGraph:s,visBin:o,workspaceRoot:n}=r,{services:i,skipped:l}=rs(n,e,s);if(i.length===0)return{chain:[],ephemeralPidFiles:[],runDir:void 0,serviceEnvByTaskId:new Map,skipped:l};const h=ma(i.map($=>$.id),s),m=new Map(i.map($=>[$.id,$])),f=[],p=[];if(t==="ephemeral")for(const $ of h){const y=m.get($);y&&p.push({id:$,payload:va({paths:{logFile:"",pidFile:""},service:y})})}let c;t==="ephemeral"&&(c=wa());let S;for(const $ of h){const y=m.get($),P=s.tasks[$];if(!y||!P)continue;let X;if(t==="ephemeral"){const U=ss(c.runDir,c.scriptPath,$),v={...p.find(R=>R.id===$).payload,logFile:U.logFile,pidFile:U.pidFile};_r(U.configFile,JSON.stringify(v)),X=ya(U),f.push(U.pidFile)}else X=ka({id:$,visBin:o,workspaceRoot:n});if(P.overrides={...P.overrides,command:X},P.cache=!1,s.tasks[$]=P,S!==void 0){const U=s.dependencies[$]??[];U.includes(S)||(s.dependencies[$]=[...U,S])}S=$}const x=new Set(h),B=new Map,E=ve($=>{const y=new Set,P=[...s.dependencies[$]??[]],X=new Set;for(;P.length>0;){const U=P.pop();if(!X.has(U)){X.add(U),x.has(U)&&y.add(U);for(const v of s.dependencies[U]??[])X.has(v)||P.push(v)}}return[...y].sort()},"collectTransitive");for(const $ of Object.keys(s.dependencies)){if(x.has($))continue;const y=E($);if(y.length===0)continue;const P={};for(const X of y){const U=m.get(X);U?.config.env&&Object.assign(P,U.config.env)}Object.keys(P).length>0&&B.set($,P)}return{chain:h,ephemeralPidFiles:f,runDir:c?.runDir,serviceEnvByTaskId:B,skipped:l}},"injectServiceTasks"),Sa=new Set(["auto","ephemeral","off","persistent"]),$a=ve(r=>{const{cli:e,config:t,isCi:s,isPersistentTarget:o,isTty:n,target:i}=r;if(e!==void 0&&!Sa.has(e))throw new Error(`--services: expected one of auto|ephemeral|persistent|off, got "${e}"`);const l=e??t??(n&&!s?"auto":"off");return l==="off"?"off":l==="ephemeral"?"ephemeral":l==="persistent"?"registry":o||i==="dev"?"ephemeral":"registry"},"resolveServicesPolicy");var Ta=Object.defineProperty,I=A((r,e)=>Ta(r,"name",{value:e,configurable:!0}),"a");const Ut="VIS_AFFECTED_FILES",Ca=2e3,Fr=I(async(r,e,t,s,o,n)=>{const i=r.map(E=>{const $=E.overrides.command;if(!$)return;const y=E.overrides.visOptions,P=wt(e,E.projectRoot,!!y?.runFromWorkspaceRoot),X=y?.envFile?Dt(P,y.envFile):{},U=t&&(y?.affectedFiles==="env"||y?.affectedFiles==="both")?{[Ut]:t.join(`
|
|
165
|
+
`)}:{},v=n?.get(E.id)??{};return{command:$,cwd:P,env:{INIT_CWD:s,...X,...v,...U},name:E.id}}).filter(E=>E!==void 0);if(i.length===0)return;if(!o){await pt(i,{killOthers:["failure"],onEvent:I(()=>{},"onEvent")});return}const{abortSignal:l,lifeCycle:h,store:m}=o,f=i.map(E=>r.find($=>$.id===E.name)).filter(Boolean);m.unmarkDone(),h.startTasks?.(f);const p=new Map,c=new Map;let S;const x=I(()=>{for(const E of c.values())try{E("SIGTERM")}catch{}S||(S=setTimeout(()=>{for(const E of c.values())try{E("SIGKILL")}catch{}c.clear()},2e3),S.unref?.())},"killAll");let B;l&&(B=I(()=>{x()},"abortListener"),l.then(()=>{B?.()}).catch(()=>{B?.()}));try{await pt(i,{killOthers:["failure"],onEvent:I(E=>{const $=f[E.index];if($)switch(E.kind){case"close":{const y=p.get($.id)??Date.now(),P=E.killed||E.exitCode===0?"success":"failure";h.endTasks?.([{code:E.exitCode??0,endTime:Date.now(),startTime:y,status:P,task:$,terminalOutput:m.getSnapshot().outputs.get($.id)??""}]),c.delete(E.index);break}case"error":{E.message&&m.addOutput($.id,`${E.message}
|
|
166
166
|
`);break}case"started":{p.set($.id,Date.now()),E.kill&&c.set(E.index,E.kill);break}case"stderr":case"stdout":{E.text&&m.addOutput($.id,`${E.text}
|
|
167
|
-
`);break}}},"onEvent")})}finally{S&&(clearTimeout(S),S=void 0),m.markDone()}},"runPersistentTasks"),Or=I(r=>{try{return process.kill(-r,0),!0}catch{try{return process.kill(r,0),!0}catch{return!1}}},"isPidAlive"),
|
|
168
|
-
${this.#s}`:this.#s}}const
|
|
169
|
-
`));const
|
|
170
|
-
`;
|
|
171
|
-
[timeout] Task "${t.id}" exceeded ${
|
|
172
|
-
`}:{code:
|
|
173
|
-
`).filter(Boolean):void 0,R=(typeof t.runnerTags=="string"?t.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,
|
|
174
|
-
${
|
|
167
|
+
`);break}}},"onEvent")})}finally{S&&(clearTimeout(S),S=void 0),m.markDone()}},"runPersistentTasks"),Or=I(r=>{try{return process.kill(-r,0),!0}catch{try{return process.kill(r,0),!0}catch{return!1}}},"isPidAlive"),Ia=I(r=>{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,r)},"sleepSyncMs"),xa=I(r=>{const{extraPids:e=[],pidFiles:t,runDir:s}=r,o=[],n=I(i=>{try{process.kill(-i,"SIGTERM")}catch{try{process.kill(i,"SIGTERM")}catch{}}},"sendSigterm");for(const i of t){let l;try{const h=ks(i),m=Number.parseInt(h.trim(),10);l=Number.isFinite(m)&&m>0?m:void 0}catch{continue}l!==void 0&&(o.push(l),n(l))}for(const i of e)!Number.isFinite(i)||i<=0||(o.push(i),n(i));if(o.length>0){const i=Date.now()+1500;for(;Date.now()<i;){let l=!0;for(const h of o)if(Or(h)){l=!1;break}if(l)break;Ia(100)}for(const l of o)if(Or(l))try{process.kill(-l,"SIGKILL")}catch{try{process.kill(l,"SIGKILL")}catch{}}}s&&Ss(s)},"cleanupEphemeralServices"),jt=256*1024;class Ra{static{A(this,"An")}static{I(this,"OutputRingBuffer")}#e;#s="";#r=!1;constructor(e){this.#e=e}append(e){this.#s+=e,this.#s.length>this.#e&&(this.#s=this.#s.slice(-this.#e),this.#r=!0)}toString(){return this.#r?`[...output truncated, showing last ${Math.round(this.#e/1024)}KB...]
|
|
168
|
+
${this.#s}`:this.#s}}const is=I(r=>{const e=r.overrides.visOptions;if(e&&typeof e=="object")return e},"getTaskOptions"),os=I(r=>`'${r.replaceAll("'",String.raw`'\''`)}'`,"singleQuoteEscape"),ns=I(r=>process.platform==="win32"?r.length>0&&!/[\s"&|<>^()%!]/.test(r)?r:`"${r.replaceAll('"','""')}"`:os(r),"shellQuote"),Ma=I((r,e,t)=>{if(!e||e.length===0||t===!1||t===void 0)return r;if(t==="args"||t==="both"){const s=e.map(o=>ns(o)).join(" ");return`${r} ${s}`}return r},"buildAffectedFilesArgs"),as="visForwardedArgs",Ea=I((r,e)=>{const t=e.overrides[as];if(!Array.isArray(t)||t.length===0)return r;const s=t.map(o=>ns(o)).join(" ");return`${r} ${s}`},"appendForwardedArgs"),Pa=I(async(r,e,t)=>{if(!e)return t();const s=r.get(e)??Promise.resolve();let o;const n=new Promise(l=>{o=l}),i=s.then(()=>n);r.set(e,i),await s;try{return await t()}finally{o(),r.get(e)===i&&r.delete(e)}},"withMutex"),Fa=I(r=>{let e=Math.max(0,Math.floor(r));return{claim(t){const s=Math.max(0,Math.min(t,e));return e-=s,s},get remaining(){return e}}},"createRetryBudget"),Oa=I((r,e,t)=>{const s=`${e}\0${typeof t=="string"?t:String(t)}`,o=r.get(s);if(o)return o;const n=Dt(e,t);return r.set(s,n),n},"loadEnvFileCached"),jr=I(r=>{const e=new Map;return async(t,s)=>{const{affectedFiles:o,currentOs:n,hooks:i,initCwd:l,lifeCycle:h,mutexPool:m,onOutput:f,onOutputReplace:p,retryBudget:c,serviceEnvByTaskId:S,serviceEventBridge:x,stdinRegistry:B,strictEnv:E,workspaceRoot:$}=r,y=is(t),P=wt($,s.cwd??t.projectRoot,y?.runFromWorkspaceRoot===!0),X=t.overrides.command;if(!X)return{code:0,terminalOutput:`No command configured for ${t.target.project}:${t.target.target}`};const U=Ea(X,t),v=Ma(U,o,y?.affectedFiles),R=$s(y,n),V=R?`${R} -c ${os(v)}`:v,O=y?.envFile?Oa(e,P,y.envFile):void 0,K={};o&&o.length>0&&(y?.affectedFiles==="env"||y?.affectedFiles==="both")&&(K[Ut]=o.join(`
|
|
169
|
+
`));const oe=S?.get(t.id),q={INIT_CWD:l,...O,...oe,...s.env,...K};if(y?.strictEnv??E??!1){const G=Oo({command:v,processEnv:process.env,taskEnv:q,taskId:t.id});if(G){const _=jo(G);return h?.onTaskStderr?.(t,_),{code:1,terminalOutput:_}}}const N=y?.pty===!0,ee=!!B,ne=ee||N;ne&&(t.cache=!1);const D=ne?void 0:new Ra(jt),ae=ne?new Ar(jt):void 0;let de;const je=I(G=>{if(G.kind==="started"&&(de=G.kill,G.write&&B&&B.set(t.id,{kill:G.kill,resize:G.resize,write:G.write}),x?.onRegistryTaskStarted(t.id)),(G.kind==="stdout"||G.kind==="stderr")&&G.text!==void 0)if(G.kind==="stdout"?h?.onTaskStdout?.(t,G.text):h?.onTaskStderr?.(t,G.text),ae)ae.write(G.text),ee&&p?.(t.id,ae.toString()),x&&x.onTaskOutput(t.id,G.text);else{const _=`${G.text}
|
|
170
|
+
`;D.append(_),f?.(t.id,_)}G.kind==="close"&&(B&&B.delete(t.id),x&&x.onRegistryTaskClosed(t.id,G.exitCode??0,!!G.killed).catch(()=>{}))},"onEvent"),ie=I(async()=>{const G=y?.retryCount??0,_=y?.retryDelay,Ie=c?c.claim(G):G,ye=typeof y?.timeout=="number"&&y.timeout>0?y.timeout:0,me=typeof y?.killGracePeriodMs=="number"&&y.killGracePeriodMs>=0?y.killGracePeriodMs:5e3;let xe=!1,Ee=0;const Ae=qn({killGracePeriodMs:me,onTimeout:I(()=>{xe=!0},"onTimeout"),sendSignal:I(Le=>{de?.(Le)},"sendSignal"),timeoutMs:ye});let De;try{De=await pt([{command:V,cwd:P,env:q,name:t.id,...ne?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:je,...Ie>0?{restart:{delay:_??"exponential",onRetry:I(async(Le,be,Pe)=>{Ee=Le,i&&await i.callHook("task:retry",t,Le,Pe)},"onRetry"),tries:Ie}}:{}})}finally{Ae.cancel()}const ke=De.closeEvents[0],ce=ae?ae.toString():D.toString();return xe?{code:124,retryAttempts:Ee,terminalOutput:`${ce}
|
|
171
|
+
[timeout] Task "${t.id}" exceeded ${ye}ms budget.
|
|
172
|
+
`}:{code:ke?.exitCode??1,retryAttempts:Ee,terminalOutput:ce}},"runOnce");return m?Pa(m,y?.mutex,ie):ie()}},"createConcurrentExecutor"),ja=I(r=>{if(!r||r.trim().length===0)return;const e=Number.parseFloat(r);return!Number.isFinite(e)||e<=0?{invalid:r}:{value:Math.floor(e)}},"parseEnvConcurrency"),Aa=I(async(r,e)=>{const t=await Bs(r,{dataDirectory:ft(r)});if(!t){e.warn(`No previous run recorded yet. Run a task at least once to populate ${Ns(r,{dataDirectory:ft(r)})}.`);return}const s=(t.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${t.startTime} (${s}s)`),e.info(""),e.info(` Total: ${String(t.stats.total)}`),e.info(` Succeeded: ${String(t.stats.succeeded)}`),e.info(` Cached: ${String(t.stats.cached)}`),e.info(` Failed: ${String(t.stats.failed)}`),e.info(` Skipped: ${String(t.stats.skipped)}`),e.info(""),t.stats.failed>0){const n=t.tasks.filter(i=>i.exitCode!==void 0&&i.exitCode!==0);e.info("Failed tasks:");for(const i of n){const l=i.duration??0;e.info(` × ${i.taskId} (exit ${String(i.exitCode??-1)}, ${l}ms)`)}e.info("")}const o=[...t.tasks].filter(n=>typeof n.duration=="number").sort((n,i)=>(i.duration??0)-(n.duration??0)).slice(0,5);if(o.length>0){e.info("Slowest tasks:");for(const n of o)e.info(` ${n.taskId.padEnd(40)} ${String(n.duration??0).padStart(6)}ms [${n.cacheStatus}]`);e.info("")}},"renderLastRunSummary"),Da=I(r=>{if(!(r===void 0||r==="")){if(r!=="read"&&r!=="write"&&r!=="readwrite")throw new Error(`--cache-mode must be one of: read, write, readwrite (received "${r}")`);return r}},"parseCacheMode"),La=I(r=>{if(!(r===void 0||r==="")){if(r!=="http"&&r!=="reapi")throw new Error(`--cache-backend must be one of: http, reapi (received "${r}")`);return r}},"parseCacheBackend"),dc=I(async({argument:r,logger:e,options:t,runtime:s,visConfig:o,workspaceRoot:n})=>{if(!n)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=n;if(Ts(i),t.lastDetails===!0){await Aa(i,e);return}const l=process.cwd(),h=await Cs(i),{config:m,packageJsons:f,projectOptions:p,workspace:c}=Is(i,o,h),S=xs(i,c,f);let x=r[0];if(!x){const w=vr(c);if(process.stdout.isTTY&&process.stdin.isTTY){const b=await _o(w);if(!b){e.info("No target selected.");return}x=b,await Ln(`vis run ${b}`)}else{e.info("Available targets:"),e.info(""),e.info(Go(w)),e.info(""),e.info("Usage: vis run <target>");return}}if(m.constraints&&!t.skipConstraints){const w=Gs(S,m.constraints);if(w.length>0){for(const b of w)e.error(`[${b.rule}] ${b.message}`);throw new Error(`${w.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(t.affected){const w=[x];t.parallel!==void 0&&w.push(`--parallel=${String(t.parallel)}`),t.cache||w.push("--no-cache"),t.query&&w.push(`--query=${String(t.query)}`),t.reverse&&w.push("--reverse"),typeof t.runnerTags=="string"&&t.runnerTags!==""&&w.push(`--runner-tags=${t.runnerTags}`),await s.runCommand("affected",{argv:w});return}const B=await fi(x,c,process.cwd(),i),E=Do(p),$=Lo(B.target,E);$!==B.target&&e.debug?.(`Resolved alias "${B.target}" → "${$}"`);let y=B.projects;const P=r.slice(1).map(String);if(t.projects){const w=new Set(t.projects.split(",").map(b=>b.trim()));if(y=y.filter(b=>w.has(b)),y.length===0)throw new Error(`No matching projects found for: ${String(t.projects)}`)}if(t.query&&(y=pi(y,c,t.query),y.length===0)){e.info(`Query "${String(t.query)}" matched no projects.`);return}const X=Rs(),U=process.env[Ut],v=U?U.split(`
|
|
173
|
+
`).filter(Boolean):void 0,R=(typeof t.runnerTags=="string"?t.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,V=R?new Set(R.split(",").map(w=>w.trim()).filter(Boolean)):void 0,O=[],K=new Map;for(const w of y){const b=p.get(w)?.[$];if(!b)continue;const T=b.options;if(!T?.internal){if(!Ms(T,!!ct)){e.debug?.(`Skipping ${w}:${$} — runInCI filter`);continue}if(!Es(T,V)){e.debug?.(`Skipping ${w}:${$} — runner-tags filter`);continue}O.push(w),K.set(w,b)}}if(O.length===0){const w=vr(c),b=Object.entries(c.projects).filter(([,T])=>T.targets?.[$]!==void 0).map(([T])=>T);if(e.error(`No projects have the "${$}" target.`),b.length>0){e.info(""),e.info(`Target "${$}" exists in these projects but was filtered out:`);for(const T of b.slice(0,5))e.info(` - ${T}`);b.length>5&&e.info(` …and ${b.length-5} more`)}else{const T=Ur($,w,3);T.length>0&&(e.info(""),e.info(T.length===1?`Did you mean "${T[0]}"?`:`Did you mean one of: ${T.map(W=>`"${W}"`).join(", ")}?`)),e.info(""),e.info("Run `vis run` without arguments to see all available targets.")}return}const oe=t.pty===!0;let q=O.map(w=>{const b=c.projects[w],T=K.get(w),W={project:w,target:$},Y=`${w}:${$}`,Q=oe?{...T.options,pty:T.options?.pty??!0}:T.options,L=T.command?lr(T.command,{affectedFiles:v,projectRoot:b?.root}):T.command;return{cache:T.cache,id:Y,outputs:T.outputs??[],overrides:{command:L,...P.length>0?{[as]:P}:{},...Q?{visOptions:Q}:{}},parallelism:T.parallelism,projectRoot:b?.root,target:W}});const N=[],ee=[];for(const w of q)is(w)?.persistent?(w.cache=!1,N.push(w)):ee.push(w);q=ee;const ne=_s(t.partition);if(ne&&(q=qs.partitionTasks(q,ne),e.info(`Partition ${ne.index}/${ne.total}: running ${q.length} task(s)`),q.length===0)){e.info("No tasks assigned to this partition.");return}let D=Hs([...q,...N],{projectGraph:S,targetDefaults:m.tasks,workspace:c});for(const[w,b]of Object.entries(D.tasks)){const T=b.target.project,W=b.target.target,Y=p.get(T)?.[W];if(!Y)continue;const Q=c.projects[T];let L=!1;const j={...b.overrides};j.visOptions===void 0&&Y.options&&(j.visOptions=Y.options,L=!0),j.command===void 0&&Y.command&&(j.command=lr(Y.command,{affectedFiles:v,projectRoot:Q?.root}),L=!0),L&&(b.overrides=j,D.tasks[w]=b)}if(typeof t.skipCache=="string"&&t.skipCache.trim()!=="")if(t.cache){const w=Ro(t.skipCache,c,Object.keys(D.tasks));for(const b of w.skipTaskIds){const T=D.tasks[b];T!==void 0&&(T.cache=!1)}w.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${w.unmatchedPatterns.map(b=>`"${b}"`).join(", ")}`),w.skipTaskIds.size>0&&e.debug?.(`--skip-cache: bypassing cache for ${String(w.skipTaskIds.size)} task(s)`)}else e.debug?.("--skip-cache ignored: --no-cache already disables caching for the whole run");await ti(i,m.toolchain,{error:I(w=>{e.error(w)},"error"),info:I(w=>{e.info(w)},"info"),warn:I(w=>{e.warn(w)},"warn")},!!t.skipToolchain);const ae=t.preflight!==!1&&m.preflight?.lockfile!==!1,de=Co(i,ct,{warn:I(w=>{e.warn(w)},"warn")},{skip:!ae});if(!de.shouldContinue)throw new Error(`${de.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);const je=process.env.VIS_VERSION??"0.0.0",ie=t.dryRun?void 0:async w=>{try{return await ui(w.config,{timeoutMs:Ca}),!0}catch{return!1}},G=await ni(i),_=await na({initialTasks:[...q,...N],probe:ie,registeredEntries:G,taskGraph:D,visVersion:je}),Ie=[];let ye,me=0;const xe=[],Ee=new Map;let Ae=[];const De=new Set;let ke=null,ce=null;if(_.diagnostics.length>0){const w=!!(process.stdout.isTTY&&process.stdin.isTTY),b=t.dryRun?"off":$a({cli:t.services,config:m.run?.services,isCi:!!ct,isPersistentTarget:N.length>0,isTty:w,target:$});if(b==="off"){for(const j of _.diagnostics)e.error(j.message);throw new Error(`${_.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`)}const T=_.diagnostics.map(j=>j.targetId),W=b,Y=W==="registry"?rs(i,T,D):void 0,Q=process.argv[1]??"vis",L=ba({missingServiceIds:T,mode:W,taskGraph:D,visBin:Q,workspaceRoot:i});if(L.skipped.length>0){for(const{id:j,reason:re}of L.skipped)e.error(`Cannot auto-start ${j}: ${re}`);throw new Error(`${L.skipped.length} service(s) cannot be auto-started — invoke them directly or add a service config.`)}Ie.push(...L.ephemeralPidFiles),ye=L.runDir,Ae=L.chain;for(const j of L.chain)De.add(j);if(W==="registry"&&(me=L.chain.length,xe.push(...L.chain)),L.chain.length>0){const j=new yr(L.chain),re=new Map;if(W==="ephemeral"&&L.runDir)for(const F of L.chain){const z=ss(L.runDir,`${L.runDir}/bootstrap.mjs`,F);re.set(F,{ephemeral:{configFile:z.configFile,cwd:i,logFile:z.logFile,pidFile:z.pidFile,scriptPath:z.scriptPath},mode:"ephemeral"})}else if(W==="registry"&&Y)for(const F of Y.services)re.set(F.id,{mode:"registry",registry:{command:F.command,config:F.config,cwd:F.cwd,env:F.env}});if(re.size>0){const F=new ua({indexToId:new Map,services:re,sink:{crashed:I((z,H)=>{j.markCrashed(z,H)},"crashed"),failed:I((z,H,Z)=>{j.markFailed(z,H,Z)},"failed"),log:I((z,H)=>{j.appendLog(z,H)},"log"),ready:I((z,H)=>{j.markReady(z,H)},"ready"),started:I((z,H)=>{j.markStarted(z,H),W==="registry"&&H!==null&&Ee.set(z,H)},"started"),starting:I(z=>{j.markStarting(z)},"starting")},workspaceRoot:i});ke=j,ce=F}}for(const[j,re]of L.serviceEnvByTaskId){const F=_.serviceEnvByTaskId.get(j)??{};_.serviceEnvByTaskId.set(j,{...F,...re})}}const Le=new Set(N.map(w=>w.id));if(q=_.initialTasks.filter(w=>!Le.has(w.id)),D=_.taskGraph,Ae.length>0&&(q=[...Ae.map(w=>D.tasks[w]).filter(w=>w!==void 0),...q]),N.length>0){const w=new Set(N.map(Q=>Q.id)),b={};for(const[Q,L]of Object.entries(D.tasks))w.has(Q)||(b[Q]=L);const T={};for(const[Q,L]of Object.entries(D.dependencies))w.has(Q)||(T[Q]=L.filter(j=>!w.has(j)));const W=new Set;for(const Q of Object.values(T))for(const L of Q)W.add(L);const Y=Object.keys(b).filter(Q=>!W.has(Q));D={dependencies:T,roots:Y,tasks:b}}const{serviceEnvByTaskId:be}=_;if(_.satisfiedServices.length>0){const w=_.satisfiedServices.map(b=>b.id).join(", ");if(e.debug?.(`Auto-attached to running services: ${w}`),ke)for(const b of _.satisfiedServices)ke.registerService(b.id);else ke=new yr(_.satisfiedServices.map(b=>b.id));for(const b of _.satisfiedServices){const T=b.config.readiness?.tcp?.port??b.config.port??0,W=b.config.readiness?.tcp?.host??"127.0.0.1";ke.markReady(b.id,{host:W,port:T})}}if(t.reverse&&(D=Ws(D),e.debug?.(`Reversed task graph: ${String(D.roots.length)} new root(s) (originally leaves)`)),t.dryRun){const w=Object.keys(D.tasks).length,b=D.roots.length;e.info(`Execution plan (${String(w)} task(s), ${String(b)} root(s)):`),e.info("");const T=new Set,W=I((Y,Q)=>{if(T.has(Y))return;T.add(Y);for(const re of D.dependencies[Y]??[])W(re,Q+1);const L=D.tasks[Y],j=" ".repeat(Q+1);e.info(`${j}${Y}${L?.cache===!1?" (no-cache)":""}`)},"walkPlan");for(const Y of D.roots)W(Y,0);for(const Y of Object.keys(D.tasks))W(Y,0);N.length>0&&(e.info(""),e.info(` + ${String(N.length)} persistent task(s) (run after graph completes)`)),e.info("");return}const Pe=Date.now(),ue=ai(),_e=I((w,b)=>{const T=b instanceof Error?b.message:String(b);e.warn(`Plugin error in ${w}: ${T}`)},"onHookError");await ci(ue,m.plugins);const Re=typeof t.profile=="string"?t.profile:void 0,C=I(async w=>{if(!Re)return;const b=dr(w,D,Pe),T=Re.startsWith("/")?Re:`${i}/${Re}`;await zs(b,T),e.info(`Profile written to ${Re}`)},"maybeWriteProfile"),k=m.taskRunner??{},M=Ps(i,t.cacheDir,k.cacheDirectory,m.sharedWorktreeCache),te=Fs(M,i,m.branchScopedCache),Se=ja(process.env.VIS_RUN_CONCURRENCY_LIMIT);Se&&"invalid"in Se&&e.warn(`VIS_RUN_CONCURRENCY_LIMIT=${Se.invalid} is not a positive number; falling back to default concurrency.`);const cs=Se&&"value"in Se?Se.value:void 0,ls=t.parallel??cs??3,Vt=t.strictEnv??m.strictEnv??!1,qe={dryRun:t.dryRun??!1,parallel:ls,skipNxCache:!t.cache,summarize:t.summarize??!1,...k,cacheDirectory:te,dataDirectory:k.dataDirectory??ft(i),onFingerprint:I(async(w,b)=>{await ue.callHook("task:fingerprint",w,b)},"onFingerprint")},Yt=Us(k.remoteCache);if(Yt){const w=Da(t.cacheMode),b=La(t.cacheBackend);if(qe.remoteCache={...Yt,...w?{mode:w}:{},...b?{backend:b}:{}},qe.remoteCache.attestation){const{expectedIdentity:T,requireOnDownload:W}=qe.remoteCache.attestation;if(!(T!==void 0&&("github"in T&&typeof T.github?.ref=="string"&&typeof T.github.repo=="string"&&typeof T.github.workflow=="string"||"oidcIssuer"in T&&typeof T.oidcIssuer=="string"&&(typeof T.san=="string"||typeof T.sanRegex=="string"))))throw new Error("[vis run] remoteCache.attestation requires a pinned keyless signer via `expectedIdentity`. Use one of:\n • { github: { repo, workflow, ref } } (GitHub Actions — recommended)\n • { oidcIssuer, san } (literal identity; vis regex-escapes + anchors it)\n • { oidcIssuer, sanRegex } (advanced: raw regex, you own anchoring)\nWithout it, verification is integrity-only — use `remoteCache.signing` (HMAC) for that instead.");"sanRegex"in T&&(!T.sanRegex.startsWith("^")||!T.sanRegex.endsWith("$"))&&e.warn("[vis run] remoteCache.attestation.expectedIdentity.sanRegex is not anchored (^…$). sigstore matches it as a regex; an unanchored value is substring-matched and weakens the identity pin. Prefer the literal `san` form unless you need a pattern.");const{installCommandFor:Y,isSigstoreInstalled:Q}=await import("./loader.js");Q()||e.warn(`[vis run] remoteCache.attestation is configured but the optional \`sigstore\` package is not installed. Cache uploads will be unsigned and signed entries can't be verified until you install it:
|
|
174
|
+
${Y(i)}`);const{buildCacheAttestationHooks:L}=await import("./cache-attestation.js");qe.remoteCache.attestation=L({expectedIdentity:T,onReject:I((j,re)=>{e.warn(`[vis run] remote cache entry ${j.slice(0,12)} rejected: attestation ${re}. Treating as a cache miss.`)},"onReject"),onVerifyFailure:I(j=>{e.warn(`[vis run] attestation verification failed: ${j}`)},"onVerifyFailure"),requireOnDownload:W,workspaceRoot:i})}}else(t.cacheMode||t.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts (or TURBO_API env); ignoring.");const ds=process.stdout.isTTY&&!ct,us=m.tui?.autoExit??!1,Kt={args:{parallel:qe.parallel,targets:[$]},autoExit:us,projectNames:O,tasks:[...q,...N]},Qt=typeof t.retryBudget=="number"?t.retryBudget:void 0,Xt=Qt===void 0?void 0:Fa(Qt),Jt=new li(ue,_e),Zt=new ei(i),er=On(typeof t.outputStyle=="string"?t.outputStyle.toLowerCase():void 0);if(_.satisfiedServices.length>0)for(const w of _.satisfiedServices){const b=_.serviceDependentsByServiceId.get(w.id)??[];try{await ue.callHook("service:attach",w,b)}catch(T){_e("service:attach",T)}}await ue.callHook("run:before",{tasks:q,workspaceRoot:i});const Ke=t.stopServices===!0;let tr=!1;const rr=I(()=>{if(tr)return;tr=!0,ce&&ce.dispose().catch(()=>{});const w=Ke?[...Ee.values()]:void 0;xa({extraPids:w,pidFiles:Ie,runDir:ye})},"runCleanupOnce"),nt=I(()=>{rr()},"onCleanupSignal"),sr=Ie.length>0||ye!==void 0||Ke&&xe.length>0;sr&&(process.on("SIGINT",nt),process.on("SIGTERM",nt));try{if(ds){const w=new Map,b=Pn({...Kt,onRetryService:ce?F=>ce.retry(F):void 0,outputStyle:er,serviceDockStore:ke,stdinRegistry:w}),{lifeCycle:T,store:W}=b,Y=new ur([T,Jt,Zt]),Q=jr({affectedFiles:v,currentOs:X,hooks:ue,initCwd:l,lifeCycle:Y,mutexPool:new Map,onOutput:I((F,z)=>{ce&&De.has(F)?ce.onTaskOutput(F,z):W.addOutput(F,z)},"onOutput"),onOutputReplace:I((F,z)=>{W.setOutput(F,z)},"onOutputReplace"),retryBudget:Xt,serviceEnvByTaskId:be,serviceEventBridge:ce??void 0,stdinRegistry:w,strictEnv:Vt,workspaceRoot:i});let L="rerun",j=null,re=new Map;for(;L!=="quit";){if(L==="rerun"){if(re=await hr(q,qe,{lifeCycle:Y,projectGraph:S,taskExecutor:Q,taskGraph:D,workspaceRoot:i}),N.length>0&&!t.failFast){const F=new Promise(z=>{const H=W.subscribe(()=>{const Z=W.getSnapshot();(Z.rerunRequested||Z.retryTaskId)&&(H(),z())});b.renderIsDone.then(()=>{H(),z()}).catch(()=>{H(),z()})});await Fr(N,i,v,l,{abortSignal:F,lifeCycle:Y,store:W},be)}}else if(L==="retry"&&j){const F=q.find(H=>H.id===j),z=F?.overrides.command;if(F&&z){const H=wt(i,F.projectRoot,!1);Y.startTasks?.([F]);const Z=new Ar(jt),he=(await pt([{command:z,cwd:H,name:F.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:I(se=>{se.kind==="started"&&se.write&&w.set(F.id,{kill:se.kill,resize:se.resize,write:se.write}),(se.kind==="stdout"||se.kind==="stderr")&&se.text&&(Z.write(se.text),W.setOutput(F.id,Z.toString())),se.kind==="close"&&w.delete(F.id)},"onEvent")})).closeEvents[0];Y.endTasks?.([{code:he?.exitCode??1,status:he?.exitCode===0?"success":"failure",task:F,terminalOutput:W.getSnapshot().outputs.get(F.id)}])}else F&&Y.endTasks?.([{code:1,status:"failure",task:F,terminalOutput:`No command configured for ${F.id}`}]);j=null,W.markDone()}L=await new Promise(F=>{const z=W.subscribe(()=>{const H=W.getSnapshot();H.rerunRequested&&(W.acknowledgeRerun(),z(),F("rerun")),H.retryTaskId&&(j=W.acknowledgeRetry(),z(),F("retry"))});b.renderIsDone.then(()=>{z(),F("quit")}).catch(()=>{z(),F("quit")})})}await b.renderIsDone,await ue.callHook("run:after",re),await C(re),me>0&&(e.info(""),Ke?e.info(`${String(me)} service(s) stopped (--stop-services).`):e.info(`${String(me)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}else{const w=new Map,b=typeof t.log=="string"?t.log.toLowerCase():"",T=b==="labeled"||b==="grouped"||b==="interleaved"?b:void 0,W=T?Vs(T):void 0,Y=new ur([new An({...Kt,ciGrouping:o?.run?.ciGrouping??"auto",logReporter:W,outputStyle:er}),Jt,Zt]),Q=jr({affectedFiles:v,currentOs:X,hooks:ue,initCwd:l,lifeCycle:Y,mutexPool:w,retryBudget:Xt,serviceEnvByTaskId:be,serviceEventBridge:ce??void 0,strictEnv:Vt,workspaceRoot:i}),L=I(async()=>{const H=Date.now(),Z=await hr(q,qe,{lifeCycle:Y,projectGraph:S,taskExecutor:Q,taskGraph:D,workspaceRoot:i}),he=Date.now()-H;if(t.summarize){const we=dr(Z,D,Pe);await Ys(we,i,{dataDirectory:ft(i)})}let se=!1;for(const[,we]of Z)we.status==="failure"&&(se=!0);const ge=Os(Z,he),$e=js(i),Be=As(i,he,$e);return e.info(""),e.info(` ${ge}${Be?` ${Be}`:""}`),{hasFailure:se,results:Z,runHistory:$e}},"runOnce"),j=await L();await ue.callHook("run:after",j.results),await C(j.results);const{hasFailure:re}=j;if(t.watch){const H=O.map(le=>{const fe=c.projects[le]?.root;if(fe)return fe.startsWith("/")?fe:`${i}/${fe}`}).filter(le=>le!==void 0),Z=q;let he;const se=I(le=>{const fe=Jn(Z,le);return he=fe.filter,q=fe.tasks,fe.tasks.length},"applyFilter");let ge=!1,$e=j.results;const Be=I(()=>{const le=Rr($e,i);if(le.directories.length>0&&le.files.size>0){const fe=Yn(le.files,i,le.directories);return{handle:Mr({filter:fe,onChange:at,paths:le.directories}),mode:"tracked"}}return{handle:Mr({onChange:at,paths:H}),mode:"roots"}},"buildHandle");let we;const at=I(async le=>{if(!ge){ge=!0;try{e.info(`Change detected in ${le.length} file(s), rerunning…`),$e=(await L()).results,we?.close(),we=Be().handle}finally{ge=!1}}},"onChangeHandler"),ir=Be();we=ir.handle;const hs=ir.mode==="tracked"?`Watching ${String(Rr($e,i).files.size)} tracked file(s)`:`Watching ${String(H.length)} project root(s)`;e.info(`${hs} — edit a file to rerun, press h for keybinds, q to quit.`);const $t=I(async()=>{if(!ge){ge=!0;try{if(q.length===0){e.info("No tasks match the active filter — press a to clear it.");return}$e=(await L()).results,we?.close(),we=Be().handle}finally{ge=!1}}},"triggerRerun");await new Promise(le=>{let fe=!1,or;const nr=I(()=>{ar()},"onSigint"),ar=I(()=>{fe||(fe=!0,or?.close(),process.off("SIGINT",nr),we?.close(),le())},"exit");process.on("SIGINT",nr),or=sa({handlers:{onClearFilter:I(async()=>{const Qe=se(void 0);e.info(`Filter cleared — running ${String(Qe)} task(s).`),await $t()},"onClearFilter"),onFilter:I(async Qe=>{const fs=he,cr=se(Qe);if(cr===0){e.info(`Filter "${Qe}" matched no projects — keeping previous filter.`),se(fs);return}e.info(`Filter "${Qe}" matched ${String(cr)} task(s).`),await $t()},"onFilter"),onHelp:I(()=>{ta(process.stdout)},"onHelp"),onQuit:I(()=>{ar()},"onQuit"),onRerun:$t}})});return}if(t.flaky!==!1){const H=Ds(i,{minRuns:2},j.runHistory);if(H.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const Z of Ls(H))e.info(` ${Z}`);e.info("")}}const F=[];for(const[H,Z]of j.results)Z.retryAttempts&&Z.retryAttempts>0&&F.push(H);const z=t.failOnRetry===!0&&F.length>0;if(z){const H=F.slice(0,5),Z=F.length-H.length,he=Z>0?`${H.join(", ")}, and ${String(Z)} more`:H.join(", ");e.warn(""),e.warn(`--fail-on-retry: ${String(F.length)} task(s) succeeded only after retry: ${he}`)}if(re||z){const H=z&&!re?"Some tasks succeeded only after retry (--fail-on-retry).":"Some tasks failed.",Z=2e3,he=[];for(const[se,ge]of j.results){if(ge.status!=="failure")continue;const $e=ge.terminalOutput??"",Be=$e.length>Z?`…${$e.slice(-Z)}`:$e,we=ge.code??"?";he.push(` ${se} (exit ${String(we)}):
|
|
175
|
+
${Be.split(`
|
|
176
|
+
`).map(at=>` ${at}`).join(`
|
|
177
|
+
`)}`)}throw new Error(he.length>0?`${H}
|
|
178
|
+
${he.join(`
|
|
179
|
+
`)}`:H)}N.length>0&&!t.failFast&&await Fr(N,i,v,l,void 0,be),me>0&&(e.info(""),Ke?e.info(`${String(me)} service(s) stopped (--stop-services).`):e.info(`${String(me)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}}finally{rr(),sr&&(process.off("SIGINT",nt),process.off("SIGTERM",nt)),Ke&&xe.length>0&&await Promise.all(xe.map(async w=>{try{await di(i,w)}catch{}}))}},"execute");export{Fa as createRetryBudget,dc as default};
|