@visulima/vis 1.0.0-alpha.3 → 1.0.0-alpha.30
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 +1117 -24
- package/LICENSE.md +11958 -0
- package/README.md +344 -20
- package/dashboard/dist/index.html +152 -0
- package/dist/bin.js +1 -146
- package/dist/binx.js +3 -0
- package/dist/config/index.d.ts +3154 -0
- package/dist/config/index.js +1 -0
- package/dist/generate/index.d.ts +157 -0
- package/dist/generate/index.js +1 -0
- package/dist/packem_chunks/bin.js +1415 -0
- package/dist/packem_chunks/bloom-status.js +2 -0
- package/dist/packem_chunks/bloom-sync.js +2 -0
- package/dist/packem_chunks/cache-attestation.js +1 -0
- package/dist/packem_chunks/config.js +19 -0
- package/dist/packem_chunks/devtools.js +82 -0
- package/dist/packem_chunks/doctor-probe.js +2 -0
- package/dist/packem_chunks/fix.js +11 -0
- package/dist/packem_chunks/handler.js +1 -0
- package/dist/packem_chunks/handler10.js +1 -0
- package/dist/packem_chunks/handler11.js +5 -0
- package/dist/packem_chunks/handler12.js +1 -0
- package/dist/packem_chunks/handler13.js +27 -0
- package/dist/packem_chunks/handler14.js +5 -0
- package/dist/packem_chunks/handler15.js +1 -0
- package/dist/packem_chunks/handler16.js +1 -0
- package/dist/packem_chunks/handler17.js +1 -0
- package/dist/packem_chunks/handler18.js +1 -0
- package/dist/packem_chunks/handler19.js +1 -0
- package/dist/packem_chunks/handler2.js +4 -0
- package/dist/packem_chunks/handler20.js +5 -0
- package/dist/packem_chunks/handler21.js +2 -0
- package/dist/packem_chunks/handler22.js +2 -0
- package/dist/packem_chunks/handler23.js +1 -0
- package/dist/packem_chunks/handler24.js +1 -0
- package/dist/packem_chunks/handler25.js +5 -0
- package/dist/packem_chunks/handler26.js +1 -0
- package/dist/packem_chunks/handler27.js +3 -0
- package/dist/packem_chunks/handler28.js +1 -0
- package/dist/packem_chunks/handler29.js +7 -0
- package/dist/packem_chunks/handler3.js +4 -0
- package/dist/packem_chunks/handler30.js +33 -0
- package/dist/packem_chunks/handler31.js +3 -0
- package/dist/packem_chunks/handler32.js +8 -0
- package/dist/packem_chunks/handler33.js +1 -0
- package/dist/packem_chunks/handler34.js +5 -0
- package/dist/packem_chunks/handler35.js +11 -0
- package/dist/packem_chunks/handler36.js +3 -0
- package/dist/packem_chunks/handler37.js +22 -0
- package/dist/packem_chunks/handler38.js +61 -0
- package/dist/packem_chunks/handler39.js +3 -0
- package/dist/packem_chunks/handler4.js +6 -0
- package/dist/packem_chunks/handler40.js +6 -0
- package/dist/packem_chunks/handler41.js +24 -0
- package/dist/packem_chunks/handler42.js +153 -0
- package/dist/packem_chunks/handler43.js +25 -0
- package/dist/packem_chunks/handler44.js +10 -0
- package/dist/packem_chunks/handler45.js +708 -0
- package/dist/packem_chunks/handler46.js +24 -0
- package/dist/packem_chunks/handler47.js +322 -0
- package/dist/packem_chunks/handler48.js +48 -0
- package/dist/packem_chunks/handler49.js +3 -0
- package/dist/packem_chunks/handler5.js +8 -0
- package/dist/packem_chunks/handler50.js +27 -0
- package/dist/packem_chunks/handler51.js +195 -0
- package/dist/packem_chunks/handler52.js +34 -0
- package/dist/packem_chunks/handler6.js +1 -0
- package/dist/packem_chunks/handler7.js +1 -0
- package/dist/packem_chunks/handler8.js +1 -0
- package/dist/packem_chunks/handler9.js +1 -0
- package/dist/packem_chunks/heal-accept.js +10 -0
- package/dist/packem_chunks/heal.js +14 -0
- package/dist/packem_chunks/help-command.js +8 -0
- package/dist/packem_chunks/index.js +7 -0
- package/dist/packem_chunks/keys-refresh.js +4 -0
- package/dist/packem_chunks/list.js +3 -0
- package/dist/packem_chunks/loader.js +4 -0
- package/dist/packem_chunks/loader2.js +1 -0
- package/dist/packem_chunks/prune.js +3 -0
- package/dist/packem_chunks/run.js +1 -0
- package/dist/packem_chunks/status.js +2 -0
- package/dist/packem_chunks/sync.js +2 -0
- package/dist/packem_chunks/sync2.js +2 -0
- package/dist/packem_chunks/tar.js +3 -0
- package/dist/packem_chunks/tripwire.js +2 -0
- package/dist/packem_chunks/verify-lockfile.js +2 -0
- package/dist/packem_shared/Table-DoSoazT6-DwnyTUsA.js +12 -0
- package/dist/packem_shared/_commonjsHelpers-CLblCigl.js +1 -0
- package/dist/packem_shared/advisories-BxXiKFbL.js +1 -0
- package/dist/packem_shared/affected-shas-BdnlfiV1.js +1 -0
- package/dist/packem_shared/ai-analysis-KP8b5lc0.js +68 -0
- package/dist/packem_shared/ai-fix-BkPUHA0z.js +43 -0
- package/dist/packem_shared/anolilab-text-CAM_E6uK.js +13 -0
- package/dist/packem_shared/applyDefaults-BogleaFi.js +1 -0
- package/dist/packem_shared/build-scripts-DE6U8jVq.js +1 -0
- package/dist/packem_shared/cyclonedx-BpGVHqSW.js +4 -0
- package/dist/packem_shared/definePlugin-CWm4Dv_t.js +1 -0
- package/dist/packem_shared/dependency-scan-BUbOcMwX.js +1 -0
- package/dist/packem_shared/docker-CTE3s4LW.js +60 -0
- package/dist/packem_shared/failure-log-34Wl3npC.js +2 -0
- package/dist/packem_shared/giget-CcEy_Elm.js +2 -0
- package/dist/packem_shared/glob-D_7bct6p-D8itOHsr.js +1 -0
- package/dist/packem_shared/index-D1xC1Y_R.js +1 -0
- package/dist/packem_shared/index-DH-5hsrC.js +1 -0
- package/dist/packem_shared/index-hoWfZmNo.js +30 -0
- package/dist/packem_shared/license-zZU7aavK.js +1 -0
- package/dist/packem_shared/lifecycle-CXaqPGAQ.js +2 -0
- package/dist/packem_shared/lockfile-CrT86D6d.js +1 -0
- package/dist/packem_shared/lockfile-Cu2BH6bl.js +1 -0
- package/dist/packem_shared/manifests-BzWpKW8F.js +1 -0
- package/dist/packem_shared/min-release-age-BPVXwPUg.js +34 -0
- package/dist/packem_shared/native-config-sync-BRZZetn3.js +21 -0
- package/dist/packem_shared/osv-bloom-DSZcHLsM.js +2 -0
- package/dist/packem_shared/otelPlugin-CJR2T_lk.js +1 -0
- package/dist/packem_shared/peer-warnings-EvSJ18gE.js +1 -0
- package/dist/packem_shared/pm-runner-DmKT2FqF.js +1 -0
- package/dist/packem_shared/provenance-DkCA8BrN.js +1 -0
- package/dist/packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js +1 -0
- package/dist/packem_shared/registry-keys-Mixm4eAY.js +1 -0
- package/dist/packem_shared/resolve-explicit-D5E72FfN.js +5 -0
- package/dist/packem_shared/runtime-check-CilFOqUU.js +1 -0
- package/dist/packem_shared/s1ngularity-Qxc6tRRI.js +1 -0
- package/dist/packem_shared/scan-progress-DVtCtI2z.js +2 -0
- package/dist/packem_shared/selectors-DkgYFzdq.js +3 -0
- package/dist/packem_shared/signatures-byuFrtAH.js +2 -0
- package/dist/packem_shared/spinner-C8xs6QZv.js +1 -0
- package/dist/packem_shared/spinners-f91Rbo99-Bjf3NcO0.js +1 -0
- package/dist/packem_shared/symbols-CQmER5MT.js +1 -0
- package/dist/packem_shared/tabs-xZkm6Y_J.js +1 -0
- package/dist/packem_shared/toolchain-DoG6b_G_.js +5 -0
- package/dist/packem_shared/typosquats-BiDxQj7R.js +1 -0
- package/dist/packem_shared/use-measured-height-Lea6TCVD.js +1 -0
- package/dist/packem_shared/utils-DrNg0XTR.js +1 -0
- package/dist/packem_shared/verify-cLcZwKqe.js +1 -0
- package/dist/packem_shared/vis-update-app-BCKzlqj8.js +1 -0
- package/dist/packem_shared/watch-DEL0yol9.js +1 -0
- package/dist/packem_shared/watch-loop-C31Ar7BX.js +11 -0
- package/index.d.ts +436 -0
- package/index.js +613 -0
- package/package.json +71 -26
- package/schemas/project.schema.json +991 -0
- package/schemas/vis-config.schema.json +4958 -0
- package/skills/vis/SKILL.md +96 -0
- package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
- package/templates/buildkite-ci/template.yml +20 -0
- package/dist/ai-analysis.d.ts +0 -40
- package/dist/ai-cache.d.ts +0 -21
- package/dist/bin.d.ts +0 -1
- package/dist/catalog.d.ts +0 -110
- package/dist/commands/affected.d.ts +0 -3
- package/dist/commands/ai.d.ts +0 -3
- package/dist/commands/analyze.d.ts +0 -3
- package/dist/commands/check.d.ts +0 -3
- package/dist/commands/graph.d.ts +0 -3
- package/dist/commands/hook/constants.d.ts +0 -8
- package/dist/commands/hook/index.d.ts +0 -3
- package/dist/commands/hook/install.d.ts +0 -7
- package/dist/commands/hook/migrate.d.ts +0 -27
- package/dist/commands/hook/uninstall.d.ts +0 -3
- package/dist/commands/migrate/constants.d.ts +0 -12
- package/dist/commands/migrate/deps.d.ts +0 -32
- package/dist/commands/migrate/index.d.ts +0 -3
- package/dist/commands/migrate/json.d.ts +0 -20
- package/dist/commands/migrate/lint-staged.d.ts +0 -62
- package/dist/commands/migrate/types.d.ts +0 -20
- package/dist/commands/run.d.ts +0 -3
- package/dist/commands/staged.d.ts +0 -3
- package/dist/commands/update.d.ts +0 -3
- package/dist/config.d.ts +0 -40
- package/dist/config.js +0 -1
- package/dist/package-manager.d.ts +0 -23
- package/dist/workspace.d.ts +0 -58
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
var oi=Object.defineProperty;var m=(t,e)=>oi(t,"name",{value:e,configurable:!0});import{createRequire as ai}from"node:module";import{M as he,K as li,Q as di,B as ui}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{bR as _s,w as K,a5 as a,a6 as $,n as d,bS as fi,d as $e,R as te,aG as Gs,aI as hi,aF as pi,af as is,aJ as gi,aK as mi,k as vi,O as Bt,P as or,bT as wi,bU as yi,E as Et,bV as $i,M as xi,C as bi,S as ki,bW as ji,bX as Si,s as pt,bY as Ti,aM as Ci,bZ as Ii,b_ as Ri,b$ as Oi,c0 as Ei,W as Mi,c1 as Pi}from"./bin.js";import{buildEnhancedPath as Fi,runConcurrently as Mt,TerminalBuffer as ar,readLastRunSummary as Ai,getLastRunSummaryPath as Li,enforceProjectConstraints as Di,expandTokensInString as os,parsePartition as Bi,TaskScheduler as Ni,createTaskGraph as _i,reverseTaskGraph as Gi,generateRunSummary as as,writeChromeTrace as qi,resolveTurboEnvCompat as Ui,CompositeLifeCycle as cs,defaultTaskRunner as ls,createLogReporter as Wi,writeRunSummary as Hi}from"@visulima/task-runner";import{d as zi,r as Vi}from"../packem_shared/lockfile-Cu2BH6bl.js";import{F as eo}from"../packem_shared/failure-log-34Wl3npC.js";import{r as to}from"../packem_shared/toolchain-DoG6b_G_.js";import{i as ro,a as so,b as no,s as io,d as oo,c as ao,r as co,H as lo,f as uo,e as fo}from"../packem_shared/lifecycle-CXaqPGAQ.js";import{p as ho,r as po,f as go}from"../packem_shared/selectors-DkgYFzdq.js";import{T as Us,C as lr,D as Nt,E as Ws}from"../packem_shared/symbols-CQmER5MT.js";import{q as $o,j as xo,T as Vt,E as fs}from"../packem_shared/Table-DoSoazT6-DwnyTUsA.js";import{n as Hs}from"../packem_shared/spinner-C8xs6QZv.js";import{c as hs,a as To,s as ps}from"../packem_shared/watch-DEL0yol9.js";import{E as zs}from"./config.js";const ci=ai(import.meta.url),ht=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=m(t=>{if(typeof ht<"u"&&ht.versions&&ht.versions.node){const[e,r]=ht.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return ht.getBuiltinModule(t)}return ci(t)},"__cjs_getBuiltinModule"),{readFileSync:at,existsSync:Ze,writeFileSync:cr,mkdirSync:Ki,openSync:Yi,statSync:ds,readSync:Ji,closeSync:Xi,mkdtempSync:Qi}=_e("node:fs"),{createInterface:qs,emitKeypressEvents:Zi}=_e("node:readline"),{isAbsolute:mo,resolve:us,dirname:vo,relative:wo}=_e("node:path"),{fileURLToPath:yo}=_e("node:url"),{createRequire:bo}=_e("node:module"),{createHash:ko}=_e("node:crypto"),{appendFile:dr}=_e("node:fs/promises"),{platform:jo,homedir:ur,tmpdir:So}=_e("node:os"),{spawn:Co}=_e("node:child_process");var Io=Object.defineProperty,Ro=m((t,e)=>Io(t,"name",{value:e,configurable:!0}),"u$5"),Oo=Object.defineProperty,Eo=Ro((t,e)=>Oo(t,"name",{value:e,configurable:!0}),"v"),Mo=Object.defineProperty,Po=Eo((t,e)=>Mo(t,"name",{value:e,configurable:!0}),"D");const Fo=Po((t,e,r,s,i,o,n,c,u,h,f,p,l,g)=>{const w={d:s,h:i,m:o,mo:e,ms:c,s:n,w:r,y:t};return u!==void 0&&(w.future=u),h!==void 0&&(w.past=h),f!==void 0&&(w.decimal=f),p!==void 0&&(w.unitMap=p),l!==void 0&&(w.groupSeparator=l),g!==void 0&&(w.placeholderSeparator=g),w},"createDurationLanguage"),Ao={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"},Lo=Fo(t=>`year${t===1?"":"s"}`,t=>`month${t===1?"":"s"}`,t=>`week${t===1?"":"s"}`,t=>`day${t===1?"":"s"}`,t=>`hour${t===1?"":"s"}`,t=>`minute${t===1?"":"s"}`,t=>`second${t===1?"":"s"}`,t=>`millisecond${t===1?"":"s"}`,"in %s","%s ago",".",Ao,",","_");var Do=Object.defineProperty,Bo=m((t,e)=>Do(t,"name",{value:e,configurable:!0}),"o$4"),No=Object.defineProperty,_o=Bo((t,e)=>No(t,"name",{value:e,configurable:!0}),"o"),Go=Object.defineProperty,qo=_o((t,e)=>Go(t,"name",{value:e,configurable:!0}),"o");const Uo=qo(t=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const s of e)if(!Object.hasOwn(t,s))throw new TypeError(`Missing required property: ${s}`);if(typeof t.future!="string"||typeof t.past!="string")throw new TypeError("Properties future and past must be of type string");const r=["y","mo","w","d","h","m","s","ms"];for(const s of r)if(typeof t[s]!="string"&&typeof t[s]!="function")throw new TypeError(`Property ${s} must be of type string or function`);if(t.decimal&&typeof t.decimal!="string")throw new TypeError("Property decimal must be of type string");if(t.delimiter&&typeof t.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(t._digitReplacements&&!Array.isArray(t._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(t._numberFirst&&typeof t._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(t.unitMap&&typeof t.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(t.unitMap&&Object.values(t.unitMap).some(s=>typeof s!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var Wo=Object.defineProperty,Ho=m((t,e)=>Wo(t,"name",{value:e,configurable:!0}),"b$5"),zo=Object.defineProperty,Vo=Ho((t,e)=>zo(t,"name",{value:e,configurable:!0}),"b"),Ko=Object.defineProperty,$t=Vo((t,e)=>Ko(t,"name",{value:e,configurable:!0}),"g");const Vs=$t((t,e)=>{e=e||-1;const r=new RegExp(String.raw`^-?\d+(?:\.\d{0,${String(e)}})?`).exec(t.toString());return r===null?t:Number.parseFloat(r[0])},"toFixed"),gs=$t(({unitCount:t,unitName:e},r,s)=>{let{spacer:i}=s;const{maxDecimalPoints:o}=s;let n=".";s.decimal!==void 0?n=s.decimal:r.decimal!==void 0&&(n=r.decimal);let c;"digitReplacements"in s?c=s.digitReplacements:"_digitReplacements"in r&&(c=r._digitReplacements);let u,h=t;o!==void 0&&(h=Vs(t,o));const f=h.toString();if(!r._hideCountIf2||t!==2)if(c){u="";for(const g of f)u+=g==="."?n:c[g]}else u=f.replace(".",n);else u="";const p=r[e];let l=p;return typeof p=="function"&&(l=p(t)),r._hideCountIf2&&t===2&&(i=""),r._numberFirst?l+i+u:u+i+l},"renderPiece"),Yo=$t((t,e)=>{const{units:r}=e;if(r.length===0)return[];const{unitMeasures:s}=e,i=e.largest??Number.POSITIVE_INFINITY,o={};let n,c,u,h=t;for(c=0;c<r.length;c++){n=r[c];const p=s[n];u=c===r.length-1?h/p:Math.floor(h/p),o[n]=u,h-=u*p}if(e.round){let p=i;for(c=0;c<r.length;c++)if(n=r[c],u=o[n],u!==0&&(p--,p===0)){for(let l=c+1;l<r.length;l++){const g=r[l],w=o[g];o[n]=(o[n]??0)+w*s[g]/s[n],o[g]=0}break}for(c=r.length-1;c>=0;c--){if(n=r[c],u=o[n],u===0)continue;const l=Math.round(u);if(o[n]=l,c===0)break;const g=r[c-1],w=s[g],I=Math.floor(l*s[n]/w);if(I)o[g]=(o[g]??0)+I,o[n]=0;else break}}const f=[];for(c=0;c<r.length&&f.length<i;c++){if(n=r[c],u=o[n],u&&!e.round&&f.length===i-1){let p,l=0;for(p=c+1,r.length;p<r.length;p++){const g=r[p];l+=o[g]*(e.unitMeasures[g]/e.unitMeasures[n])}u+=l,e.maxDecimalPoints!==void 0&&(u=Vs(u,e.maxDecimalPoints))}u&&f.push({unitCount:u,unitName:n})}return f},"getPieces"),Jo=$t((t,e,r)=>{const{language:s,units:i}=e;if(t.length===0){const p=i.at(-1);return gs({unitCount:0,unitName:p},s,e)}const{conjunction:o,serialComma:n}=e;let c=", ";e.delimiter!==void 0?c=e.delimiter:s.delimiter!==void 0&&(c=s.delimiter);let u="";e.timeAdverb&&r!==0&&(u=s.future??"",r<0&&(u=s.past??""));const h=t.map(p=>gs(p,s,e));let f;return!o||t.length===1?f=h.join(c):t.length===2?f=h.join(o):f=h.slice(0,-1).join(c)+(n?",":"")+o+(h.at(-1)??""),u&&(f=u.replace("%s",f)),f},"formatPieces"),Ks=$t((t,e)=>{if(Number.isNaN(t))throw new TypeError("Expected a valid number");if(typeof t!="number")throw new TypeError("Expected a number for milliseconds input");const r={conjunction:"",language:Lo,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};Uo(r.language);const s=Math.abs(t),i=Yo(s,r);return Jo(i,r,t)},"duration");var Xo=Object.defineProperty,Ys=m((t,e)=>Xo(t,"name",{value:e,configurable:!0}),"a$4"),Qo=Object.defineProperty,fr=Ys((t,e)=>Qo(t,"name",{value:e,configurable:!0}),"u"),Zo=Object.defineProperty,ea=fr((t,e)=>Zo(t,"name",{value:e,configurable:!0}),"e");function _t({onlyFirst:t=!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,t?void 0:"g")}m(_t,"u$4");Ys(_t,"a");fr(_t,"t");ea(_t,"ansiRegex");var ta=Object.defineProperty,ra=fr((t,e)=>ta(t,"name",{value:e,configurable:!0}),"r");const sa=_t(),na=/\]0;[\s\S]*?/g,ia=ra(t=>t.replace(na,"").replace(sa,""),"strip");var oa=Object.defineProperty,De=m((t,e)=>oa(t,"name",{value:e,configurable:!0}),"t$2");const Me="@voidzero-dev/vite-task-client",hr="@visulima/task-runner-client",Pt=`npm:${hr}@^1`,Js=he(".vis",".vite-client-override-declined"),Ft="pnpm-workspace.yaml",aa=["dependencies","devDependencies","optionalDependencies","peerDependencies"],Xs=De(t=>{try{return JSON.parse(at(t,"utf8"))}catch{return}},"readPackageJson"),ca=De(t=>{const e=he(t,Ft);if(Ze(e))try{return _s(at(e,"utf8")).toJS()?.overrides}catch{return}},"readPnpmWorkspaceOverrides"),la=De(t=>t==="pnpm"||t==="aube"?"pnpm.overrides":t==="yarn"?"resolutions":"overrides","overrideFieldFor"),da=De(t=>{const e=he(t,Ft);try{const r=_s(at(e,"utf8"));return r.setIn(["overrides",Me],Pt),cr(e,r.toString()),!0}catch{return!1}},"writeToPnpmWorkspaceYaml"),ms=De(t=>t!==void 0&&aa.some(e=>t[e]?.[Me]!==void 0),"isDependency"),ua=De((t,e)=>t!==void 0&&(t.pnpm?.overrides?.[Me]!==void 0||t.overrides?.[Me]!==void 0||t.resolutions?.[Me]!==void 0)||e?.[Me]!==void 0,"isAlreadyOverridden"),fa=De((t,e=[])=>{const r=Xs(he(t,"package.json")),s=Ze(he(t,"node_modules","@voidzero-dev","vite-task-client"));return{alreadyOverridden:ua(r,ca(t)),declined:Ze(he(t,Js)),manager:zi(t)?.manager,present:ms(r)||s||e.some(i=>ms(i))}},"detectViteClientOverride"),ha=De(t=>{try{const e=he(t,Js);Ki(li(e),{recursive:!0}),cr(e,`Declined adding the ${Me} → ${hr} override.
|
|
2
|
+
Delete this file to be asked again.
|
|
3
|
+
`)}catch{}},"recordDecline"),pa=De((t,e="npm")=>{const r=`${e} install`;if((e==="pnpm"||e==="aube")&&Ze(he(t,Ft))&&da(t))return{file:Ft,installCommand:r};const s=he(t,"package.json"),i=Xs(s);if(!i)return;const o=la(e);o==="pnpm.overrides"?(i.pnpm??={},i.pnpm.overrides??={},i.pnpm.overrides[Me]=Pt):(i[o]??={},i[o][Me]=Pt);try{cr(s,`${JSON.stringify(i,void 0,4)}
|
|
4
|
+
`)}catch{return}return{file:"package.json",installCommand:r}},"applyViteClientOverride"),ga=De(async(t,e)=>{const r=fa(t,e.projectManifests);if(!r.present||r.alreadyOverridden||r.declined||!e.interactive)return!1;const s=qs({input:process.stdin,output:process.stdout});try{e.logger.info(`Detected ${Me}. Its cache hints no-op under @visulima/task-runner unless aliased to ${hr} (a drop-in replacement).`);const i=await new Promise(n=>{s.question("Add the override now? [y/N] ",n)});if(!/^y(?:es)?$/i.test(i.trim()))return ha(t),e.logger.info("Skipped. Delete .vis/.vite-client-override-declined to be asked again."),!1;const o=pa(t,r.manager);return o===void 0?(e.logger.warn("Could not write the override automatically — add it manually (see @visulima/task-runner-client README)."),!1):(e.logger.info(`Added "${Me}": "${Pt}" to ${o.file}. Run \`${o.installCommand}\` to apply it.`),!0)}finally{s.close()}},"maybePromptViteClientOverride");var ma=Object.defineProperty,va=m((t,e)=>ma(t,"name",{value:e,configurable:!0}),"t$1");const wa=va(({interactive:t,taskPty:e,workspacePty:r})=>e===!0?!0:e===!1?!1:t&&r!==!1,"decidePty");var ya=Object.defineProperty,Qs=m((t,e)=>ya(t,"name",{value:e,configurable:!0}),"f$8");const $a=Qs(t=>t.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),xa=Qs((t,e,r)=>{const s=new Set,i=[];if(t===void 0||t.trim()==="")return{skipTaskIds:s,unmatchedPatterns:i};const o=[...r],n=new Set(o),c=new Map;for(const u of o){const h=u.lastIndexOf(":");if(h===-1)continue;const f=u.slice(h+1),p=c.get(f);p===void 0?c.set(f,[u]):p.push(u)}for(const u of $a(t)){if(u.startsWith("~:"))throw new Error(`--skip-cache does not support the closest-project selector "~:" (received "${u}"). Use \`pkg:target\`, \`:target\`, or \`#tag:target\`.`);if(n.has(u)){s.add(u);continue}const h=ho(u);if(!h){i.push(u);continue}let f=!1;switch(h.kind){case"all":{const p=c.get(h.target)??[];for(const l of p)s.add(l),f=!0;break}case"project":{const p=h.projects?.[0];if(p!==void 0){const l=`${p}:${h.target}`;n.has(l)&&(s.add(l),f=!0)}break}case"tag":{const{tag:p}=h;if(p!==void 0){const l=c.get(h.target)??[];for(const g of l){const w=g.slice(0,g.lastIndexOf(":"));e.projects[w]?.tags?.includes(p)===!0&&(s.add(g),f=!0)}}break}}f||i.push(u)}return{skipTaskIds:s,unmatchedPatterns:i}},"resolveSkipCachePatterns");var ba=Object.defineProperty,pr=m((t,e)=>ba(t,"name",{value:e,configurable:!0}),"a$3");const ka=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,ja=new Set(["0","!","#","$","*","-","?","@","_"]),Sa=pr(t=>{const e=new Map;for(const r of t.matchAll(ka)){const s=r[1],i=r[3],o=r[2],n=s??i;if(n===void 0||ja.has(n))continue;const c=o!==void 0,u=e.get(n);u===void 0?e.set(n,c):u&&!c&&e.set(n,!1)}return[...e.entries()].map(([r,s])=>({hasDefault:s,name:r}))},"extractEnvReferences"),Ta=pr(t=>{const{command:e,processEnv:r,taskEnv:s,taskId:i}=t,o=Sa(e);if(o.length===0)return;const n=[];for(const{hasDefault:c,name:u}of o){if(c)continue;const h=s[u],f=r[u];h===void 0&&f===void 0&&n.push(u)}if(n.length!==0)return{missing:n.toSorted(),taskId:i}},"checkStrictEnv"),Ca=pr(t=>{const e=t.missing.map(r=>`$${r}`).join(", ");return`Strict env: ${t.taskId} references unset variable${t.missing.length===1?"":"s"} ${e}. Set ${t.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},"formatStrictEnvError");var Ia=Object.defineProperty,ze=m((t,e)=>Ia(t,"name",{value:e,configurable:!0}),"i$5");const vs=ze(t=>{const e=new Set;for(const r of Object.values(t.projects))for(const s of Object.keys(r.targets??{}))e.add(s);return[...e].sort()},"collectAvailableTargets"),Ra=ze(t=>{const e=new Map;for(const r of t.values())for(const[s,i]of Object.entries(r))for(const o of i.aliases??[])e.has(o)||e.set(o,s);return e},"buildAliasMap"),Oa=ze((t,e)=>e.get(t)??t,"resolveTargetAlias"),Ea=ze((t,e)=>{if(t.length===0)return e.length;if(e.length===0)return t.length;const r=[];for(let s=0;s<=e.length;s++)r[s]=[s];for(let s=0;s<=t.length;s++)r[0][s]=s;for(let s=1;s<=e.length;s++)for(let i=1;i<=t.length;i++){const o=e[s-1]===t[i-1]?0:1;r[s][i]=Math.min(r[s-1][i]+1,r[s][i-1]+1,r[s-1][i-1]+o)}return r[e.length][t.length]},"levenshtein"),Ma=ze((t,e,r=3)=>Zs(t,e,1,r)[0],"suggestTarget"),Zs=ze((t,e,r=3,s=3)=>{const i=[];for(const o of e){const n=Ea(t.toLowerCase(),o.toLowerCase());n<=s&&i.push({distance:n,name:o})}return i.sort((o,n)=>o.distance-n.distance||o.name.localeCompare(n.name)),i.slice(0,r).map(o=>o.name)},"suggestTargets"),Pa=ze(t=>t.length===0?" (no targets found)":t.map(e=>` - ${e}`).join(`
|
|
5
|
+
`),"formatTargetList"),Fa=ze(async t=>{if(t.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const e=qs({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
|
|
6
|
+
`);for(const[i,o]of t.entries())process.stdout.write(` ${String(i+1).padStart(2," ")}. ${o}
|
|
7
|
+
`);process.stdout.write(`
|
|
8
|
+
`);const r=(await new Promise(i=>{e.question("Select a target (number or name, blank to cancel): ",i)})).trim();if(r.length===0)return;const s=Number.parseInt(r,10);return Number.isFinite(s)&&s>=1&&s<=t.length?t[s-1]:t.includes(r)?r:Ma(r,t)}finally{e.close()}},"promptTargetInteractively");var Aa=Object.defineProperty,Rt=m((t,e)=>Aa(t,"name",{value:e,configurable:!0}),"n$1");const La=new RegExp("[\x1B]\\[[0-?]*[ -/]*[@-~]","g"),Kt=Rt(t=>t.replaceAll(La,"").replaceAll("\r",""),"sanitizeLogLine");class ws{static{m(this,"ServiceDockStore")}static{Rt(this,"ServiceDockStore")}#e=[];#s=new Set;#r=new Map;#n=new Map;constructor(e=[]){for(const r of e)this.#n.set(r,{id:r,status:"pending",tailLines:[]});this.#e=[...e],this.#i()}getSnapshot=Rt(()=>this.#r,"getSnapshot");subscribe=Rt(e=>(this.#s.add(e),()=>{this.#s.delete(e)}),"subscribe");getIds(){return this.#e}getState(e){return this.#n.get(e)}getDockState(){let e=!1,r=!1;for(const s of this.#n.values())s.status==="crashed"||s.status==="failed"?e=!0:(s.status==="pending"||s.status==="starting")&&(r=!0);return e?"crash":r?"boot":"ready"}registerService(e){this.#n.has(e)||(this.#n.set(e,{id:e,status:"pending",tailLines:[]}),this.#e=[...this.#e,e],this.#o())}markStarting(e){this.#t(e,r=>({...r,errorMessage:void 0,startedAt:r.startedAt??Date.now(),status:"starting"}))}markStarted(e,r){this.#t(e,s=>({...s,startedAt:s.startedAt??Date.now(),status:s.status==="ready"?"ready":"starting"}))}markReady(e,r){this.#t(e,s=>({...s,errorMessage:void 0,port:r.port,readyAt:Date.now(),status:"ready"}))}markFailed(e,r,s){const i=s?.message;this.#t(e,o=>({...o,errorMessage:Kt(i??r),status:"failed"}))}markCrashed(e,r){const s=r.slice(-256).map(i=>Kt(i));this.#t(e,i=>({...i,errorMessage:s.length>0?s[s.length-1]:"process exited",status:"crashed",tailLines:s}))}appendLog(e,r){const s=r.split(`
|
|
9
|
+
`).map(i=>Kt(i)).filter(i=>i.length>0);s.length!==0&&this.#t(e,i=>{const o=[...i.tailLines,...s];for(;o.length>256;)o.shift();let n=0;for(let c=o.length-1;c>=0;c--)if(n+=o[c].length+1,n>65536){o.splice(0,c+1);break}return{...i,lastLine:s[s.length-1],tailLines:o}})}abortBoot(e){let r=!1;const s=new Map(this.#n);for(const[i,o]of s)(o.status==="pending"||o.status==="starting")&&(s.set(i,{...o,errorMessage:e,status:"failed"}),r=!0);r&&(this.#n=s,this.#i(),this.#o())}#t(e,r){const s=this.#n.get(e);s&&(this.#n.set(e,r(s)),this.#i(),this.#o())}#i(){this.#r=new Map(this.#n)}#o(){for(const e of this.#s)try{e()}catch{}}}var Da=Object.defineProperty,Ba=m((t,e)=>Da(t,"name",{value:e,configurable:!0}),"v$5"),Na=Object.defineProperty,_a=Ba((t,e)=>Na(t,"name",{value:e,configurable:!0}),"R"),Ga=Object.defineProperty,en=_a((t,e)=>Ga(t,"name",{value:e,configurable:!0}),"u");const qa=en((t,e)=>{if(t===e)return!0;if(!t||!e||t.length!==e.length)return!1;for(const[r,s]of t.entries())if(!Object.is(s,e[r]))return!1;return!0},"areDepsEqual"),ys=en(({children:t,deps:e,onRender:r,style:s,width:i})=>{const o=K.useRef(null),n=K.useRef(!1),c=K.useRef(e),u=K.useRef(t),h=K.useRef(r);h.current=r;let f=!1;e!==void 0?qa(c.current,e)||(f=!0,c.current=e):t!==u.current&&(f=!0,u.current=t),f&&(n.current=!1,o.current&&(o.current.cachedRender=void 0)),K.useLayoutEffect(()=>{const l=o.current;l&&(l.internal_onRendered=()=>{n.current=!0,h.current?.(l)})}),K.useEffect(()=>()=>{const l=o.current;l&&(l.cachedRender=void 0,l.internal_onRendered=void 0)},[]);const p=K.useMemo(()=>({...s,width:i}),[s,i]);return a.jsx("ink-static-render",{ref:o,style:p,children:n.current?null:t()})},"StaticRender");var Ua=Object.defineProperty,gr=m((t,e)=>Ua(t,"name",{value:e,configurable:!0}),"i$4");const Wa=gr(t=>Array.isArray(t)?`[${t.join(",")}]`:typeof t=="object"&&t!==null?JSON.stringify(t):String(t),"formatValue"),Ha=gr((t,e,r)=>e==="_"?`${t}${Array.isArray(r)?r.join(" "):String(r)}`:`${t}--${e}=${Wa(r)}`,"formatFlags"),mr=gr((t,e,r)=>{const s=new Set(new Set(r.map(l=>l.target.target))),i=new Set(new Set(r.map(l=>l.target.project))),o=e.filter(l=>s.has(l)),n=t.filter(l=>i.has(l)),c=r.length-n.length*o.length,u=o.length===1?"target":"targets",h=o.join(", "),f=n.length===1?`project ${n[0]}`:`${n.length} projects`;let p=`${u} ${h} for ${f}`;return c>0&&(p+=` and ${c} ${c===1?"task":"tasks"} ${c===1?"it depends":"they depend"} on`),p},"formatTargetsAndProjects");var za=Object.defineProperty,Va=m((t,e)=>za(t,"name",{value:e,configurable:!0}),"c$4");const Ka={error:"red",info:"white",success:"green"},er=Va(({children:t,title:e,variant:r})=>{const s=Ka[r];return a.jsxs($,{flexDirection:"column",children:[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,inverse:!0,children:" VIS "}),a.jsx(d,{bold:!0,color:s,children:"•"}),a.jsx(d,{children:e})]}),t]})},"Header");var Ya=Object.defineProperty,Ja=m((t,e)=>Ya(t,"name",{value:e,configurable:!0}),"T$7");const tn=Ja(({cached:t,failed:e,failedIds:r,projectNames:s,retriedIds:i,skippedIds:o,succeeded:n,targets:c,tasks:u,took:h})=>{const f=mr(s,c,u),p=i??[];if(e===0&&(!o||o.length===0)){const l=t>0?` (${t} read from cache)`:"";return a.jsx(ys,{children:m(()=>a.jsx(er,{title:`Successfully ran ${f}`,variant:"success",children:a.jsxs($,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[a.jsxs(d,{children:[a.jsx(d,{color:"green",children:Us})," ",n+t," tasks completed",l?a.jsx(d,{dimColor:!0,children:l}):null,a.jsx(d,{dimColor:!0,children:` · Took ${h}`})]}),p.length>0&&a.jsxs($,{flexDirection:"column",marginTop:1,children:[a.jsxs(d,{children:[a.jsx(d,{color:"yellow",children:"↻"})," ",a.jsx(d,{color:"yellow",children:String(p.length)})," task",p.length===1?"":"s"," succeeded after retry:"]}),p.map(g=>a.jsxs(d,{children:[" ",a.jsx(d,{color:"yellow",children:"↻"})," ",g]},g))]})]})}),"children")})}return a.jsx(ys,{children:m(()=>a.jsx(er,{title:`Ran ${f}`,variant:"error",children:a.jsxs($,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[o&&o.length>0&&a.jsxs($,{flexDirection:"column",children:[a.jsxs(d,{dimColor:!0,children:[o.length," ","task",o.length===1?"":"s"," ","skipped (dependency failed or --bail)"]}),o.map(l=>a.jsxs(d,{dimColor:!0,children:[" - ",l]},l)),a.jsx(d,{})]}),e>0&&a.jsxs($,{flexDirection:"column",children:[a.jsxs(d,{children:[a.jsx(d,{color:"red",children:String(e)})," ","task",e===1?"":"s"," ","failed:"]}),r.map(l=>a.jsxs(d,{children:[" ",a.jsx(d,{color:"red",children:lr})," ",l]},l)),a.jsx(d,{})]}),p.length>0&&a.jsxs($,{flexDirection:"column",children:[a.jsxs(d,{children:[a.jsx(d,{color:"yellow",children:String(p.length)})," ","task",p.length===1?"":"s"," ","finished after retry:"]}),p.map(l=>a.jsxs(d,{children:[" ",a.jsx(d,{color:"yellow",children:"↻"})," ",l]},l)),a.jsx(d,{})]}),a.jsx(d,{dimColor:!0,children:` Took ${h}`})]})}),"children")})},"CommandSummary");var Xa=Object.defineProperty,Yt=m((t,e)=>Xa(t,"name",{value:e,configurable:!0}),"o$2");class At{static{m(this,"TaskStore")}static{Yt(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(r=>({persistent:!!r.overrides.visOptions?.persistent,status:"pending",taskId:r.id})),selectedIndex:0,startTime:Date.now(),statusFilter:"all",succeeded:0,viewMode:"list"}}getSnapshot=Yt(()=>this.#e,"getSnapshot");subscribe=Yt(e=>(this.#s.add(e),()=>{this.#s.delete(e)}),"subscribe");startTasks(e){const r=[...this.#e.rows];for(const s of e){const i=r.findIndex(o=>o.taskId===s.id);i!==-1&&(r[i]={...r[i],elapsed:0,status:"running"},this.#r.set(s.id,process.hrtime()))}this.#t({...this.#e,rows:r})}endTasks(e){const r=[...this.#e.rows];let{cached:s,completed:i,failed:o,succeeded:n}=this.#e;const c=new Map(this.#e.outputs),u=[...this.#e.retriedIds];for(const f of e){const p=r.findIndex(l=>l.taskId===f.task.id);switch(p!==-1&&(r[p]={...r[p],duration:f.startTime&&f.endTime?f.endTime-f.startTime:void 0,retryAttempts:f.retryAttempts,status:f.status}),f.retryAttempts&&f.retryAttempts>0&&u.push(f.task.id),i++,f.status){case"failure":{o++;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{s++;break}case"success":{n++;break}}f.terminalOutput&&!c.has(f.task.id)&&c.set(f.task.id,f.terminalOutput),this.#r.delete(f.task.id)}let{selectedIndex:h}=this.#e;if(o>this.#e.failed){const f=r.findIndex(p=>p.status==="failure");f!==-1&&(h=f)}this.#t({...this.#e,cached:s,completed:i,failed:o,outputs:c,retriedIds:u,rows:r,selectedIndex:h,succeeded:n})}static#n=256*1024;addOutput(e,r){if(!r.trim())return;let s=(this.#e.outputs.get(e)??"")+r;s.length>At.#n&&(s=s.slice(-At.#n)),this.#e.outputs.set(e,s),this.#t({...this.#e})}setOutput(e,r){this.#e.outputs.set(e,r),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 r=[...this.#e.rows];for(let s=0;s<r.length;s++){const i=r[s];if(i.status==="running"){const o=this.#r.get(i.taskId);if(o){const n=process.hrtime(o),c=n[0]*1e3+n[1]/1e6;r[s]={...i,elapsed:c},e=!0}}}e&&this.#t({...this.#e,rows:r})}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,r){const s=[...this.#e.pinnedTaskIds];s[e]=r,this.#t({...this.#e,pinnedTaskIds:s})}clearPins(){this.#t({...this.#e,pinnedTaskIds:[null,null]})}requestRetry(e){const r=[...this.#e.rows],s=r.findIndex(c=>c.taskId===e);let{completed:i,failed:o,succeeded:n}=this.#e;if(s!==-1){const c=r[s].status;c==="failure"?(o=Math.max(0,o-1),i=Math.max(0,i-1)):c==="success"&&(n=Math.max(0,n-1),i=Math.max(0,i-1)),r[s]={...r[s],elapsed:0,retryAttempts:void 0,status:"running"},this.#r.set(e,process.hrtime())}this.#t({...this.#e,completed:i,done:!1,endTime:null,failed:o,interactiveMode:!1,retriedIds:this.#e.retriedIds.filter(c=>c!==e),retryTaskId:e,rows:r,succeeded:n})}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 r of this.#s)try{r()}catch{}}}var Qa=Object.defineProperty,Za=m((t,e)=>Qa(t,"name",{value:e,configurable:!0}),"A$3"),ec=Object.defineProperty,vr=Za((t,e)=>ec(t,"name",{value:e,configurable:!0}),"$"),tc=Object.defineProperty,rc=vr((t,e)=>tc(t,"name",{value:e,configurable:!0}),"r$1");const sc=rc(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
10
|
+
`),"normalizeLF"),nc=globalThis.process??Object.create(null),$s={versions:{}},xs=new Proxy(nc,{get(t,e){if(e in t)return t[e];if(e in $s)return $s[e]}});var ic=Object.defineProperty,oc=vr((t,e)=>ic(t,"name",{value:e,configurable:!0}),"b");const ac=oc((t,e,r,s)=>{const i={column:0,line:-1,...t.start},o={...i,...t.end},n=i.line,c=i.column,u=o.line,h=o.column;let f=Math.max(n-(r+1),0),p=Math.min(e.length,u+s);n===-1&&(f=0),u===-1&&(p=e.length);const l=u-n,g={};if(l)for(let w=0;w<=l;w++){const I=w+n;if(!c)g[I]=!0;else if(w===0){const L=e[I-1]?.length;g[I]=[c,(L??0)-c+1]}else if(w===l)g[I]=[0,h];else{const L=e[I-w]?.length;g[I]=[0,L]}}else c===h?g[n]=c?[c,0]:!0:g[n]=[c,(h??0)-(c??0)];return{end:p,markerLines:g,start:f}},"getMarkerLines");var cc=Object.defineProperty,Ct=vr((t,e)=>cc(t,"name",{value:e,configurable:!0}),"t");const lc=xs.platform==="win32"&&!xs.env?.WT_SESSION?">":"❯",dc=Ct((t,e,r)=>{const s={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...r,color:{gutter:Ct(w=>w,"gutter"),marker:Ct(w=>w,"marker"),message:Ct(w=>w,"message"),...r?.color}},i=typeof e.start.column=="number";let o=sc(t).split(`
|
|
11
|
+
`);typeof s.tabWidth=="number"&&(o=o.map(w=>w.replaceAll(" "," ".repeat(s.tabWidth))));const{end:n,markerLines:c,start:u}=ac(e,o,s.linesAbove,s.linesBelow),h=String(n).length,{gutter:f,marker:p,message:l}=s.color;let g=o.slice(u,n).map((w,I)=>{const L=u+1+I,x=c[L],b=String(L).padStart(h),O=!c[L+1],j=` ${b}${s.showGutter?" |":""}`;if(x){let C="";if(Array.isArray(x)){const v=w.replaceAll(/[^\t]/g," ").slice(0,Math.max(x[0]-1,0)),k=x[1]||1;C=[`
|
|
12
|
+
`,s.prefix+f(j.replaceAll(/\d/g," "))," ",v,p("^").repeat(k)].join(""),O&&s.message&&(C+=` ${l(s.message)}`)}return[s.prefix+p(lc),f(j),w.length>0?` ${w}`:"",C].join("")}return`${s.prefix} ${f(j)}${w.length>0?` ${w}`:""}`}).join(`
|
|
13
|
+
`);return s.message&&!i&&(g=`${s.prefix+" ".repeat(h+1)+s.message}
|
|
14
|
+
${g}`),g},"codeFrame");var uc=Object.defineProperty,pe=m((t,e)=>uc(t,"name",{value:e,configurable:!0}),"C$3"),ct=44,rn=59,bs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",sn=new Uint8Array(64),nn=new Uint8Array(128);for(let t=0;t<bs.length;t++){const e=bs.charCodeAt(t);sn[t]=e,nn[e]=t}function ne(t,e){let r=0,s=0,i=0;do{const n=t.next();i=nn[n],r|=(i&31)<<s,s+=5}while(i&32);const o=r&1;return r>>>=1,o&&(r=-2147483648|-r),e+r}m(ne,"h$4");pe(ne,"decodeInteger");function ee(t,e,r){let s=e-r;s=s<0?-s<<1|1:s<<1;do{let i=s&31;s>>>=5,s>0&&(i|=32),t.write(sn[i])}while(s>0);return e}m(ee,"i$3");pe(ee,"encodeInteger");function Ne(t,e){return t.pos>=e?!1:t.peek()!==ct}m(Ne,"S$3");pe(Ne,"hasMoreVlq");var ks=1024*16,js=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(t){return Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString()}}:{decode(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}},wr=class{static{m(this,"T")}static{pe(this,"StringWriter")}constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(ks)}write(e){const{buffer:r}=this;r[this.pos++]=e,this.pos===ks&&(this.out+=js.decode(r),this.pos=0)}flush(){const{buffer:e,out:r,pos:s}=this;return s>0?r+js.decode(e.subarray(0,s)):r}},yr=class{static{m(this,"w")}static{pe(this,"StringReader")}constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){const{buffer:r,pos:s}=this,i=r.indexOf(e,s);return i===-1?r.length:i}},on=[];function fc(t){const{length:e}=t,r=new yr(t),s=[],i=[];let o=0;for(;r.pos<e;r.pos++){o=ne(r,o);const n=ne(r,0);if(!Ne(r,e)){const f=i.pop();f[2]=o,f[3]=n;continue}const c=ne(r,0),u=ne(r,0)&1?[o,n,0,0,c,ne(r,0)]:[o,n,0,0,c];let h=on;if(Ne(r,e)){h=[];do{const f=ne(r,0);h.push(f)}while(Ne(r,e))}u.vars=h,s.push(u),i.push(u)}return s}m(fc,"z$1");pe(fc,"decodeOriginalScopes");function hc(t){const e=new wr;for(let r=0;r<t.length;)r=$r(t,r,e,[0]);return e.flush()}m(hc,"F$3");pe(hc,"encodeOriginalScopes");function $r(t,e,r,s){const i=t[e],{0:o,1:n,2:c,3:u,4:h,vars:f}=i;e>0&&r.write(ct),s[0]=ee(r,o,s[0]),ee(r,n,0),ee(r,h,0);const p=i.length===6?1:0;ee(r,p,0),i.length===6&&ee(r,i[5],0);for(const l of f)ee(r,l,0);for(e++;e<t.length;){const l=t[e],{0:g,1:w}=l;if(g>c||g===c&&w>=u)break;e=$r(t,e,r,s)}return r.write(ct),s[0]=ee(r,c,s[0]),ee(r,u,0),e}m($r,"P$4");pe($r,"_encodeOriginalScopes");function pc(t){const{length:e}=t,r=new yr(t),s=[],i=[];let o=0,n=0,c=0,u=0,h=0,f=0,p=0,l=0;do{const g=r.indexOf(";");let w=0;for(;r.pos<g;r.pos++){if(w=ne(r,w),!Ne(r,g)){const v=i.pop();v[2]=o,v[3]=w;continue}const I=ne(r,0),L=I&1,x=I&2,b=I&4;let O=null,j=on,C;if(L){const v=ne(r,n);c=ne(r,n===v?c:0),n=v,C=[o,w,0,0,v,c]}else C=[o,w,0,0];if(C.isScope=!!b,x){const v=u,k=h;u=ne(r,u);const F=v===u;h=ne(r,F?h:0),f=ne(r,F&&k===h?f:0),O=[u,h,f]}if(C.callsite=O,Ne(r,g)){j=[];do{p=o,l=w;const v=ne(r,0);let k;if(v<-1){k=[[ne(r,0)]];for(let F=-1;F>v;F--){const P=p;p=ne(r,p),l=ne(r,p===P?l:0);const q=ne(r,0);k.push([q,p,l])}}else k=[[v]];j.push(k)}while(Ne(r,g))}C.bindings=j,s.push(C),i.push(C)}o++,r.pos=g+1}while(r.pos<e);return s}m(pc,"H$1");pe(pc,"decodeGeneratedRanges");function gc(t){if(t.length===0)return"";const e=new wr;for(let r=0;r<t.length;)r=xr(t,r,e,[0,0,0,0,0,0,0]);return e.flush()}m(gc,"J");pe(gc,"encodeGeneratedRanges");function xr(t,e,r,s){const i=t[e],{0:o,1:n,2:c,3:u,isScope:h,callsite:f,bindings:p}=i;s[0]<o?(tr(r,s[0],o),s[0]=o,s[1]=0):e>0&&r.write(ct),s[1]=ee(r,i[1],s[1]);const l=(i.length===6?1:0)|(f?2:0)|(h?4:0);if(ee(r,l,0),i.length===6){const{4:g,5:w}=i;g!==s[2]&&(s[3]=0),s[2]=ee(r,g,s[2]),s[3]=ee(r,w,s[3])}if(f){const{0:g,1:w,2:I}=i.callsite;g!==s[4]?(s[5]=0,s[6]=0):w!==s[5]&&(s[6]=0),s[4]=ee(r,g,s[4]),s[5]=ee(r,w,s[5]),s[6]=ee(r,I,s[6])}if(p)for(const g of p){g.length>1&&ee(r,-g.length,0);const w=g[0][0];ee(r,w,0);let I=o,L=n;for(let x=1;x<g.length;x++){const b=g[x];I=ee(r,b[1],I),L=ee(r,b[2],L),ee(r,b[0],0)}}for(e++;e<t.length;){const g=t[e],{0:w,1:I}=g;if(w>c||w===c&&I>=u)break;e=xr(t,e,r,s)}return s[0]<c?(tr(r,s[0],c),s[0]=c,s[1]=0):r.write(ct),s[1]=ee(r,u,s[1]),e}m(xr,"V$1");pe(xr,"_encodeGeneratedRanges");function tr(t,e,r){do t.write(rn);while(++e<r)}m(tr,"U$4");pe(tr,"catchupLine");function an(t){const{length:e}=t,r=new yr(t),s=[];let i=0,o=0,n=0,c=0,u=0;do{const h=r.indexOf(";"),f=[];let p=!0,l=0;for(i=0;r.pos<h;){let g;i=ne(r,i),i<l&&(p=!1),l=i,Ne(r,h)?(o=ne(r,o),n=ne(r,n),c=ne(r,c),Ne(r,h)?(u=ne(r,u),g=[i,o,n,c,u]):g=[i,o,n,c]):g=[i],f.push(g),r.pos++}p||cn(f),s.push(f),r.pos=h+1}while(r.pos<=e);return s}m(an,"K");pe(an,"decode");function cn(t){t.sort(ln)}m(cn,"Q$1");pe(cn,"sort");function ln(t,e){return t[0]-e[0]}m(ln,"X$3");pe(ln,"sortComparator");function dn(t){const e=new wr;let r=0,s=0,i=0,o=0;for(let n=0;n<t.length;n++){const c=t[n];if(n>0&&e.write(rn),c.length===0)continue;let u=0;for(let h=0;h<c.length;h++){const f=c[h];h>0&&e.write(ct),u=ee(e,f[0],u),f.length!==1&&(r=ee(e,f[1],r),s=ee(e,f[2],s),i=ee(e,f[3],i),f.length!==4&&(o=ee(e,f[4],o)))}}return e.flush()}m(dn,"Z$1");pe(dn,"encode");var mc=Object.defineProperty,Se=m((t,e)=>mc(t,"name",{value:e,configurable:!0}),"c$3");const vc=/^[\w+.-]+:\/\//,wc=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,yc=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function un(t){return vc.test(t)}m(un,"R$3");Se(un,"isAbsoluteUrl");function fn(t){return t.startsWith("//")}m(fn,"q$1");Se(fn,"isSchemeRelativeUrl");function br(t){return t.startsWith("/")}m(br,"m$1");Se(br,"isAbsolutePath");function hn(t){return t.startsWith("file:")}m(hn,"v$3");Se(hn,"isFileUrl");function rr(t){return/^[.?#]/.test(t)}m(rr,"u$1");Se(rr,"isRelative");function mt(t){const e=wc.exec(t);return kr(e[1],e[2]||"",e[3],e[4]||"",e[5]||"/",e[6]||"",e[7]||"")}m(mt,"f$5");Se(mt,"parseAbsoluteUrl");function pn(t){const e=yc.exec(t),r=e[2];return kr("file:","",e[1]||"","",br(r)?r:"/"+r,e[3]||"",e[4]||"")}m(pn,"w$4");Se(pn,"parseFileUrl");function kr(t,e,r,s,i,o,n){return{scheme:t,user:e,host:r,port:s,path:i,query:o,hash:n,type:7}}m(kr,"y$5");Se(kr,"makeUrl");function sr(t){if(fn(t)){const r=mt("http:"+t);return r.scheme="",r.type=6,r}if(br(t)){const r=mt("http://foo.com"+t);return r.scheme="",r.host="",r.type=5,r}if(hn(t))return pn(t);if(un(t))return mt(t);const e=mt("http://foo.com/"+t);return e.scheme="",e.host="",e.type=t?t.startsWith("?")?3:t.startsWith("#")?2:4:1,e}m(sr,"p$4");Se(sr,"parseUrl");function gn(t){if(t.endsWith("/.."))return t;const e=t.lastIndexOf("/");return t.slice(0,e+1)}m(gn,"P$3");Se(gn,"stripPathFilename");function mn(t,e){jr(e,e.type),t.path==="/"?t.path=e.path:t.path=gn(e.path)+t.path}m(mn,"A$2");Se(mn,"mergePaths");function jr(t,e){const r=e<=4,s=t.path.split("/");let i=1,o=0,n=!1;for(let u=1;u<s.length;u++){const h=s[u];if(!h){n=!0;continue}if(n=!1,h!=="."){if(h===".."){o?(n=!0,o--,i--):r&&(s[i++]=h);continue}s[i++]=h,o++}}let c="";for(let u=1;u<i;u++)c+="/"+s[u];(!c||n&&!c.endsWith("/.."))&&(c+="/"),t.path=c}m(jr,"d$3");Se(jr,"normalizePath");function vn(t,e){if(!t&&!e)return"";const r=sr(t);let s=r.type;if(e&&s!==7){const o=sr(e),n=o.type;switch(s){case 1:r.hash=o.hash;case 2:r.query=o.query;case 3:case 4:mn(r,o);case 5:r.user=o.user,r.host=o.host,r.port=o.port;case 6:r.scheme=o.scheme}n>s&&(s=n)}jr(r,s);const i=r.query+r.hash;switch(s){case 2:case 3:return i;case 4:{const o=r.path.slice(1);return o?rr(e||t)&&!rr(o)?"./"+o+i:o+i:i||"."}case 5:return r.path+i;default:return r.scheme+"//"+r.user+r.host+r.port+r.path+i}}m(vn,"F$2");Se(vn,"resolve");var $c=Object.defineProperty,W=m((t,e)=>$c(t,"name",{value:e,configurable:!0}),"i$2");function wn(t){if(!t)return"";const e=t.lastIndexOf("/");return t.slice(0,e+1)}m(wn,"ae");W(wn,"stripFilename");function yn(t,e){const r=wn(t),s=e?e+"/":"";return i=>vn(s+(i||""),r)}m(yn,"ge");W(yn,"resolver");var Fe=0,Sr=1,Tr=2,Cr=3,$n=4,xn=1,bn=2;function kn(t,e){const r=nr(t,0);if(r===t.length)return t;e||(t=t.slice());for(let s=r;s<t.length;s=nr(t,s+1))t[s]=Sn(t[s],e);return t}m(kn,"he");W(kn,"maybeSort");function nr(t,e){for(let r=e;r<t.length;r++)if(!jn(t[r]))return r;return t.length}m(nr,"X$2");W(nr,"nextUnsortedSegmentLine");function jn(t){for(let e=1;e<t.length;e++)if(t[e][Fe]<t[e-1][Fe])return!1;return!0}m(jn,"_e$1");W(jn,"isSorted");function Sn(t,e){return e||(t=t.slice()),t.sort(Ir)}m(Sn,"ve");W(Sn,"sortSegments");function Ir(t,e){return t[Fe]-e[Fe]}m(Ir,"$$4");W(Ir,"sortComparator");function Tn(t,e){const r=e.map(()=>[]);for(let s=0;s<t.length;s++){const i=t[s];for(let o=0;o<i.length;o++){const n=i[o];if(n.length===1)continue;const c=n[Sr],u=n[Tr],h=n[Cr],f=r[c];(f[u]||(f[u]=[])).push([h,s,n[Fe]])}}for(let s=0;s<r.length;s++){const i=r[s];for(let o=0;o<i.length;o++){const n=i[o];n&&n.sort(Ir)}}return r}m(Tn,"Se");W(Tn,"buildBySources");var Qe=!1;function Cn(t,e,r,s){for(;r<=s;){const i=r+(s-r>>1),o=t[i][Fe]-e;if(o===0)return Qe=!0,i;o<0?r=i+1:s=i-1}return Qe=!1,r-1}m(Cn,"Ee");W(Cn,"binarySearch");function Rr(t,e,r){for(let s=r+1;s<t.length&&t[s][Fe]===e;r=s++);return r}m(Rr,"H");W(Rr,"upperBound");function Or(t,e,r){for(let s=r-1;s>=0&&t[s][Fe]===e;r=s--);return r}m(Or,"Y");W(Or,"lowerBound");function Er(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}m(Er,"k$4");W(Er,"memoizedState");function In(t,e,r,s){const{lastKey:i,lastNeedle:o,lastIndex:n}=r;let c=0,u=t.length-1;if(s===i){if(e===o)return Qe=n!==-1&&t[n][Fe]===e,n;e>=o?c=n===-1?0:n:u=n}return r.lastKey=s,r.lastNeedle=e,r.lastIndex=Cn(t,e,c,u)}m(In,"Me$1");W(In,"memoizedBinarySearch");function Gt(t){return typeof t=="string"?JSON.parse(t):t}m(Gt,"j$3");W(Gt,"parse");var xc=W(function(t,e){const r=Gt(t);if(!("sections"in r))return new Pr(r,e);const s=[],i=[],o=[],n=[],c=[];Mr(r,e,s,i,o,n,c,0,0,1/0,1/0);const u={version:3,file:r.file,names:n,sources:i,sourcesContent:o,mappings:s,ignoreList:c};return Ln(u)},"FlattenMap");function Mr(t,e,r,s,i,o,n,c,u,h,f){const{sections:p}=t;for(let l=0;l<p.length;l++){const{map:g,offset:w}=p[l];let I=h,L=f;if(l+1<p.length){const x=p[l+1].offset;I=Math.min(h,c+x.line),I===h?L=Math.min(f,u+x.column):I<h&&(L=u+x.column)}Rn(g,e,r,s,i,o,n,c+w.line,u+w.column,I,L)}}m(Mr,"ee");W(Mr,"recurse");function Rn(t,e,r,s,i,o,n,c,u,h,f){const p=Gt(t);if("sections"in p)return Mr(...arguments);const l=new Pr(p,e),g=s.length,w=o.length,I=tt(l),{resolvedSources:L,sourcesContent:x,ignoreList:b}=l;if(Ot(s,L),Ot(o,l.names),x)Ot(i,x);else for(let O=0;O<L.length;O++)i.push(null);if(b)for(let O=0;O<b.length;O++)n.push(b[O]+g);for(let O=0;O<I.length;O++){const j=c+O;if(j>h)return;const C=On(r,j),v=O===0?u:0,k=I[O];for(let F=0;F<k.length;F++){const P=k[F],q=v+P[Fe];if(j===h&&q>=f)return;if(P.length===1){C.push([q]);continue}const ae=g+P[Sr],Q=P[Tr],V=P[Cr];C.push(P.length===4?[q,ae,Q,V]:[q,ae,Q,V,w+P[$n]])}}}m(Rn,"me");W(Rn,"addSection");function Ot(t,e){for(let r=0;r<e.length;r++)t.push(e[r])}m(Ot,"G$1");W(Ot,"append");function On(t,e){for(let r=t.length;r<=e;r++)t[r]=[];return t[e]}m(On,"xe$1");W(On,"getLine");var En="`line` must be greater than 0 (lines start at line 1)",Mn="`column` must be greater than or equal to 0 (columns start at column 0)",Lt=-1,qt=1,Pr=class{static{m(this,"R")}static{W(this,"TraceMap")}constructor(e,r){const s=typeof e=="string";if(!s&&e._decodedMemo)return e;const i=Gt(e),{version:o,file:n,names:c,sourceRoot:u,sources:h,sourcesContent:f}=i;this.version=o,this.file=n,this.names=c||[],this.sourceRoot=u,this.sources=h,this.sourcesContent=f,this.ignoreList=i.ignoreList||i.x_google_ignoreList||void 0;const p=yn(r,u);this.resolvedSources=h.map(p);const{mappings:l}=i;if(typeof l=="string")this._encoded=l,this._decoded=void 0;else if(Array.isArray(l))this._encoded=void 0,this._decoded=kn(l,s);else throw i.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error(`invalid source map: ${JSON.stringify(i)}`);this._decodedMemo=Er(),this._bySources=void 0,this._bySourceMemos=void 0}};function Pn(t){var e,r;return(r=(e=t)._encoded)!=null?r:e._encoded=dn(t._decoded)}m(Pn,"oe");W(Pn,"encodedMappings");function tt(t){var e;return(e=t)._decoded||(e._decoded=an(t._encoded))}m(tt,"O$2");W(tt,"decodedMappings");function bc(t,e,r){const s=tt(t);if(e>=s.length)return null;const i=s[e],o=xt(i,t._decodedMemo,e,r,qt);return o===-1?null:i[o]}m(bc,"Oe$1");W(bc,"traceSegment");function Fn(t,e){let{line:r,column:s,bias:i}=e;if(r--,r<0)throw new Error(En);if(s<0)throw new Error(Mn);const o=tt(t);if(r>=o.length)return vt(null,null,null,null);const n=o[r],c=xt(n,t._decodedMemo,r,s,i||qt);if(c===-1)return vt(null,null,null,null);const u=n[c];if(u.length===1)return vt(null,null,null,null);const{names:h,resolvedSources:f}=t;return vt(f[u[Sr]],u[Tr]+1,u[Cr],u.length===5?h[u[$n]]:null)}m(Fn,"Le$1");W(Fn,"originalPositionFor");function kc(t,e){const{source:r,line:s,column:i,bias:o}=e;return Ar(t,r,s,i,o||qt,!1)}m(kc,"ye");W(kc,"generatedPositionFor");function jc(t,e){const{source:r,line:s,column:i,bias:o}=e;return Ar(t,r,s,i,o||Lt,!0)}m(jc,"Ce$1");W(jc,"allGeneratedPositionsFor");function Sc(t,e){const r=tt(t),{names:s,resolvedSources:i}=t;for(let o=0;o<r.length;o++){const n=r[o];for(let c=0;c<n.length;c++){const u=n[c],h=o+1,f=u[0];let p=null,l=null,g=null,w=null;u.length!==1&&(p=i[u[1]],l=u[2]+1,g=u[3]),u.length===5&&(w=s[u[4]]),e({generatedLine:h,generatedColumn:f,source:p,originalLine:l,originalColumn:g,name:w})}}}m(Sc,"Ie");W(Sc,"eachMapping");function Fr(t,e){const{sources:r,resolvedSources:s}=t;let i=r.indexOf(e);return i===-1&&(i=s.indexOf(e)),i}m(Fr,"re");W(Fr,"sourceIndex");function An(t,e){const{sourcesContent:r}=t;if(r==null)return null;const s=Fr(t,e);return s===-1?null:r[s]}m(An,"Ne$1");W(An,"sourceContentFor");function Tc(t,e){const{ignoreList:r}=t;if(r==null)return!1;const s=Fr(t,e);return s===-1?!1:r.includes(s)}m(Tc,"be");W(Tc,"isIgnored");function Ln(t,e){const r=new Pr(Ut(t,[]),e);return r._decoded=t.mappings,r}m(Ln,"se");W(Ln,"presortedDecodedMap");function Cc(t){return Ut(t,tt(t))}m(Cc,"Re");W(Cc,"decodedMap");function Ic(t){return Ut(t,Pn(t))}m(Ic,"we$1");W(Ic,"encodedMap");function Ut(t,e){return{version:t.version,file:t.file,names:t.names,sourceRoot:t.sourceRoot,sources:t.sources,sourcesContent:t.sourcesContent,mappings:e,ignoreList:t.ignoreList||t.x_google_ignoreList}}m(Ut,"B$2");W(Ut,"clone");function vt(t,e,r,s){return{source:t,line:e,column:r,name:s}}m(vt,"b$2");W(vt,"OMapping");function it(t,e){return{line:t,column:e}}m(it,"y$4");W(it,"GMapping");function xt(t,e,r,s,i){let o=In(t,s,e,r);return Qe?o=(i===Lt?Rr:Or)(t,s,o):i===Lt&&o++,o===-1||o===t.length?-1:o}m(xt,"w$3");W(xt,"traceSegmentInternal");function Dn(t,e,r,s,i){let o=xt(t,e,r,s,qt);if(!Qe&&i===Lt&&o++,o===-1||o===t.length)return[];const n=Qe?s:t[o][Fe];Qe||(o=Or(t,n,o));const c=Rr(t,n,o),u=[];for(;o<=c;o++){const h=t[o];u.push(it(h[xn]+1,h[bn]))}return u}m(Dn,"Ue");W(Dn,"sliceGeneratedPositions");function Ar(t,e,r,s,i,o){var n,c;if(r--,r<0)throw new Error(En);if(s<0)throw new Error(Mn);const{sources:u,resolvedSources:h}=t;let f=u.indexOf(e);if(f===-1&&(f=h.indexOf(e)),f===-1)return o?[]:it(null,null);const p=(n=t)._bySourceMemos||(n._bySourceMemos=u.map(Er)),l=((c=t)._bySources||(c._bySources=Tn(tt(t),p)))[f][r];if(l==null)return o?[]:it(null,null);const g=p[f];if(o)return Dn(l,g,r,s,i);const w=xt(l,g,r,s,i);if(w===-1)return it(null,null);const I=l[w];return it(I[xn]+1,I[bn])}m(Ar,"ie");W(Ar,"generatedPosition");var Rc=Object.defineProperty,Oc=m((t,e)=>Rc(t,"name",{value:e,configurable:!0}),"u"),Ec=Object.defineProperty,Bn=Oc((t,e)=>Ec(t,"name",{value:e,configurable:!0}),"c");const Mc=bo(import.meta.url),gt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Lr=Bn(t=>{if(typeof gt<"u"&>.versions&>.versions.node){const[e,r]=gt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return gt.getBuiltinModule(t)}return Mc(t)},"__cjs_getBuiltinModule"),{readFileSync:Ss}=Lr("node:fs"),{resolve:Pc,toNamespacedPath:Jt,dirname:Fc}=Lr("node:path"),{pathToFileURL:Ac}=Lr("node:url");var Lc=Object.defineProperty,bt=Bn((t,e)=>Lc(t,"name",{value:e,configurable:!0}),"s");const Dc=/^data:application\/json[^,]+base64,/,Bc=/^[a-z][a-z0-9+.-]*:\/\//i,Nc=/\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+)[ \t]*$|\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*\*\/[ \t]*$/,_c=/\r?\n/,Nn=bt(t=>Dc.test(t),"isInlineMap"),Xt=bt((t,e)=>{const r=t instanceof Error?t.message:String(t),s=`${e}:
|
|
15
|
+
${r}`;throw new Error(s)},"enhanceError"),Gc=bt((t,e)=>{const r=t.split(_c);let s;for(let o=r.length-1;o>=0&&!s;o--)s=Nc.exec(r[o])??void 0;if(!s)return;const i=s[1]??s[2];if(i){if(Nn(i))return i;if(!/^data:/i.test(i)&&!(Bc.test(i)&&!i.startsWith("file:")))return Pc(e,i)}},"resolveSourceMapUrl"),qc=bt(t=>{const e=t.slice(t.indexOf(",")+1);return Buffer.from(e,"base64").toString()},"decodeInlineMap"),Uc=bt(t=>{let e;try{e=Ss(t,{encoding:"utf8"})}catch(o){Xt(o,`Error reading sourcemap for file "${Jt(t)}"`)}const r=Gc(e,Fc(t));if(!r)return;let s;const i=Nn(r);if(i)s=qc(r);else try{s=Ss(r,{encoding:"utf8"})}catch(o){Xt(o,`Error reading sourcemap for file "${Jt(t)}"`)}try{const o=i?r:Ac(r).href;return new xc(s,o)}catch(o){Xt(o,`Error parsing sourcemap for file "${Jt(t)}"`)}},"loadSourceMap");var Wc=Object.defineProperty,Pe=m((t,e)=>Wc(t,"name",{value:e,configurable:!0}),"l$3");const Hc=Pe(t=>ia(t),"stripAnsi"),zc=/^(?<name>(?:[A-Z][\w$]*)?(?:Error|Exception))(?::[ \t](?<message>.*))?$/,Vc=/^\s*at\s+/,Kc=Pe(t=>{const e=t.split(`
|
|
16
|
+
`);let r;for(let s=0;s<e.length;s++){const i=zc.exec(e[s].trim());if(!i)continue;const o=[];for(let n=s+1;n<e.length&&n<=s+200;n++){const c=e[n];if(Vc.test(c))o.push(c.trim());else if(o.length>0||c.trim()!=="")break}if(o.length>0){const n=i.groups?.name??"Error",c=i.groups?.message??"";r={message:c,name:n,stack:`${n}: ${c}
|
|
17
|
+
${o.map(u=>` ${u}`).join(`
|
|
18
|
+
`)}`}}}return r},"extractErrorBlock"),_n=Pe(t=>{if(t.startsWith("file://"))try{return yo(t)}catch{return t}return t},"normalizeFramePath"),Yc=Pe(t=>!t.includes("node_modules")&&!t.startsWith("node:")&&!t.startsWith("internal/"),"isUserFrame"),Jc=Pe(t=>{try{return Uc(t)}catch{return}},"tryLoadSourceMap"),Xc=Pe((t,e)=>{if(!t.file||t.line===void 0)return;const r=_n(t.file),s=mo(r)?r:us(e,r);if(!Yc(s)||!Ze(s))return;const i=Jc(s);if(i){const o=Fn(i,{column:t.column===void 0?0:Math.max(0,t.column-1),line:t.line});if(o.source&&o.line!=null){const n=us(vo(s),o.source),c=An(i,o.source)??(Ze(n)?at(n,"utf8"):void 0);if(c!==void 0)return{column:o.column==null?void 0:o.column+1,file:n,line:o.line,source:c}}}return{column:t.column,file:s,line:t.line,source:at(s,"utf8")}},"resolveFrame"),Ts=Pe((t,e)=>{const r=wo(e,t);return r&&!r.startsWith("..")?r:t},"shortPath"),Gn=Pe((t,e)=>{if(!t?.trim())return t;try{const r=Kc(Hc(t));if(!r)return t;const s=new Error(r.message);s.name=r.name,s.stack=r.stack;const i=fi(s);if(i.length===0)return t;const o=e.color,n={dim:Pe(l=>o?fs(l):l,"dim"),head:Pe(l=>o?xo(Vt(l)):l,"head"),loc:Pe(l=>o?$o(l):l,"loc")};let c,u;for(const l of i){const g=Xc(l,e.cwd);if(g){c=g,u=l;break}}const h=[n.head(`✖ ${r.name}${r.message?`: ${r.message}`:""}`)];if(c){const l=`${Ts(c.file,e.cwd)}:${c.line}${c.column?`:${c.column}`:""}`;h.push(` ${n.loc(l)}`,""),h.push(dc(c.source,{start:{column:c.column,line:c.line}},{color:o?{gutter:fs,marker:Vt,message:Vt}:void 0,linesAbove:2,linesBelow:3}))}const f=i.filter(l=>l!==u).slice(0,8).map(l=>{const g=l.methodName??"<anonymous>",w=l.file?`${Ts(_n(l.file),e.cwd)}${l.line?`:${l.line}`:""}`:"";return n.dim(` at ${g}${w?` (${w})`:""}`)});f.length>0&&h.push("",...f);const p=n.dim("─".repeat(40));return`${h.join(`
|
|
19
|
+
`)}
|
|
20
|
+
${p}
|
|
21
|
+
${t}`}catch{return t}},"renderFailureOutput");var Qc=Object.defineProperty,Le=m((t,e)=>Qc(t,"name",{value:e,configurable:!0}),"t");const qn={delimiter:" ",language:{d:Le(()=>" d","d"),future:"in %s",h:Le(()=>" h","h"),m:Le(()=>" m","m"),mo:Le(()=>" mo","mo"),ms:Le(()=>" ms","ms"),past:"%s ago",s:Le(()=>" s","s"),w:Le(()=>" w","w"),y:Le(()=>" y","y")},largest:2,round:!0,spacer:"",units:["h","m","s","ms"]};Le(t=>{const e=t[0]*1e3+t[1]/1e6;return Ks(e,qn)},"formatHrtime");const et=Le(t=>Ks(t,qn),"formatMs");var Zc=Object.defineProperty,rt=m((t,e)=>Zc(t,"name",{value:e,configurable:!0}),"s$1");const ot=rt(t=>t==="local-cache"||t==="local-cache-kept-existing"||t==="remote-cache","isCacheStatus"),kt=rt(t=>{switch(t){case"failure":return{color:"red",icon:lr};case"local-cache":case"local-cache-kept-existing":case"remote-cache":case"success":return{color:"green",icon:Us};case"skipped":return{color:"gray",icon:Nt};default:return{color:"gray",icon:"?"}}},"getStatusInfo"),wt=rt(t=>{const{color:e,icon:r}=kt(t);return $e(te.createElement(d,{color:e},r),{columns:10}).trim()},"getStatusIcon"),el=rt(t=>{const{color:e,icon:r}=kt(t);switch(t){case"local-cache":case"local-cache-kept-existing":case"remote-cache":return $e(te.createElement(d,null,te.createElement(d,{color:e},r)," ",te.createElement(d,{color:"cyan"},"[cache]")),{columns:30}).trim();case"skipped":return $e(te.createElement(d,null,te.createElement(d,{dimColor:!0},r)," ",te.createElement(d,{dimColor:!0},"[skipped]")),{columns:30}).trim();default:return $e(te.createElement(d,{color:e},r),{columns:10}).trim()}},"getStatusPrefix"),tl=rt(t=>t==="azure"||t==="buildkite"||t==="github"||t==="gitlab"||t==="off"?t: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"),rl=rt(t=>{const e=t.replaceAll(/\W+/g,"_"),r=ko("sha256").update(t).digest("hex").slice(0,6);return`${e}_${r}`},"toGitLabSectionKey"),sl=rt((t,e,r,s="auto")=>{const i=r.trim();if(!i)return;const o=`
|
|
22
|
+
`,n=tl(s);if(n==="github"&&e!=="failure"){process.stdout.write(`::group::${wt(e)} ${t}${o}`),process.stdout.write(i+o),process.stdout.write(`::endgroup::${o}`);return}if(n==="gitlab"&&e!=="failure"){const p=Math.floor(Date.now()/1e3),l=rl(t),g="\x1B[0K";process.stdout.write(`${g}section_start:${String(p)}:${l}[collapsed=true]\r${g}${wt(e)} ${t}${o}`),process.stdout.write(i+o);const w=Math.floor(Date.now()/1e3);process.stdout.write(`${g}section_end:${String(w)}:${l}\r${g}${o}`);return}if(n==="buildkite"&&e!=="failure"){process.stdout.write(`--- ${wt(e)} ${t}${o}`),process.stdout.write(i+o);return}if(n==="azure"&&e!=="failure"){process.stdout.write(`##[group]${wt(e)} ${t}${o}`),process.stdout.write(i+o),process.stdout.write(`##[endgroup]${o}`);return}const c=process.stdout.columns||80,u=$e(te.createElement(d,{dimColor:!0},Nt.repeat(c)),{columns:c}).trim(),h=el(e),f=$e(te.createElement(d,{bold:!0},t),{columns:c}).trim();process.stdout.write(`${u}${o}`),process.stdout.write(`${h} ${f}${o}`),process.stdout.write(i+o),process.stdout.write(`${u}${o}`)},"logCommandOutputCI");var nl=Object.defineProperty,Dr=m((t,e)=>nl(t,"name",{value:e,configurable:!0}),"d$1");const il=Dr(t=>t==="running"?{color:"white",icon:"•"}:t==="pending"?{color:"gray",icon:"·"}:kt(t),"getDisplayInfo"),ol=Dr(({autoScroll:t,focused:e,interactiveMode:r,showFullscreenHint:s,statusValue:i,supportsInteractive:o,taskId:n})=>{if(!n)return;if(r)return"Esc cancel | Enter send";const c=t?"":" PAUSED (f resume)",u=o?" i INPUT":"";return e&&i==="running"&&s?`⏎ FULLSCREEN${u} f FOLLOW${c}`:e&&i==="running"?`f FOLLOW${u}${c}`:e&&s?`<enter> full screen${c}`:e?c||void 0:"<tab> or <enter> to focus"},"deriveBottomTitle"),Cs=Dr(({autoScroll:t=!0,duration:e,focused:r,interactiveMode:s,output:i,scrollRef:o,showFullscreenHint:n,status:c,supportsInteractive:u=!0,taskId:h})=>{const f=c??"pending",{icon:p}=il(f),l=r?"bold":"single",g=f==="failure"?"red":f==="success"||ot(f)?r?"green":"gray":f==="running"?r?"white":"cyan":r?"white":"gray",w=h?`${p} ${h}`:void 0,I=e===void 0?void 0:et(e),L=ol({autoScroll:t,focused:r,interactiveMode:s??!1,showFullscreenHint:n??!1,statusValue:f,supportsInteractive:u,taskId:h});if(!h)return a.jsxs($,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",paddingX:2,paddingY:1,children:[a.jsx(d,{dimColor:!0,children:"Select a task to view output"}),a.jsx(d,{dimColor:!0,children:"Press Enter or 1/2 to pin"})]});const x=[];if(i)for(const b of i.split(`
|
|
23
|
+
`))x.push(b.endsWith("\r")?b.slice(0,-1):b);return!i&&(f==="running"||f==="pending")?a.jsx($,{borderBottomTitle:L,borderColor:g,borderStyle:l,borderTopRightTitle:I,borderTopTitle:w,flexDirection:"column",flexGrow:1,paddingX:2,paddingY:1,children:a.jsx($,{alignItems:"center",flexGrow:1,justifyContent:"center",children:a.jsx(d,{dimColor:!0,children:"Waiting for task output…"})})}):a.jsxs($,{borderBottomTitle:L,borderColor:s?"yellow":g,borderStyle:l,borderTopRightTitle:I,borderTopTitle:w,flexDirection:"column",flexGrow:1,children:[a.jsx($,{flexGrow:1,flexShrink:1,paddingY:1,children:a.jsx(Gs,{flexGrow:1,followOutput:t,paddingX:2,ref:o,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:a.jsx(d,{children:x.join(`
|
|
24
|
+
`)})})}),s&&a.jsx($,{flexShrink:0,justifyContent:"center",paddingX:1,children:a.jsx(d,{bold:!0,color:"yellow",children:"INTERACTIVE | keystrokes forwarded to task | Esc to exit"})})]})},"OutputPanel");var al=Object.defineProperty,lt=m((t,e)=>al(t,"name",{value:e,configurable:!0}),"d");const cl={crashed:"✖",failed:"✖",pending:"·",ready:"●",starting:"•"},Un=lt(t=>t==="ready"?"green":t==="crashed"||t==="failed"?"red":t==="starting"?"cyan":"gray","statusColor"),ll=lt(({status:t})=>t==="starting"?a.jsx(d,{color:"cyan",children:a.jsx(Hs,{type:"dots"})}):a.jsx(d,{bold:!0,color:Un(t),children:cl[t]}),"StatusGlyph"),dl=lt(({active:t,focused:e,state:r})=>{const s=e&&t,i=s?">":" ",o=r.status==="ready"?r.port?`running, port ${String(r.port)}`:"running":r.status==="failed"||r.status==="crashed"?r.errorMessage??"exited":r.lastLine??"booting…";return a.jsxs($,{flexDirection:"row",flexShrink:0,overflow:"hidden",children:[a.jsx(d,{children:i}),a.jsx(d,{children:" "}),a.jsx($,{flexShrink:0,width:3,children:a.jsx(ll,{status:r.status})}),a.jsx($,{flexGrow:0,flexShrink:0,width:28,children:a.jsx(d,{bold:s,inverse:s,children:r.id})}),a.jsx($,{flexGrow:1,flexShrink:1,overflow:"hidden",children:a.jsxs(d,{color:Un(r.status),dimColor:r.status!=="crashed"&&r.status!=="failed",wrap:"truncate-end",children:[" ",o]})})]})},"ServiceRow"),ul=lt(({states:t})=>{const e=[];for(const s of t)s.status==="ready"&&e.push(s.id);const r=e.join(", ");return a.jsxs($,{paddingX:1,children:[a.jsxs(d,{bold:!0,color:"green",children:["● ","Services"]}),a.jsxs(d,{children:[" ",String(e.length)," / ",String(t.length)," running"]}),r.length>0&&a.jsxs(d,{dimColor:!0,children:[" ",r]}),a.jsx(d,{dimColor:!0,children:" [Tab ↓]"})]})},"StatusPill"),fl=lt(({states:t})=>{const e=t.find(r=>r.status==="crashed"||r.status==="failed");return e?a.jsxs($,{flexDirection:"column",paddingX:1,children:[a.jsxs(d,{bold:!0,color:"red",children:["✖ ","Service crashed:"," ",e.id]}),e.tailLines.slice(-3).map((r,s)=>a.jsxs(d,{color:"red",dimColor:!0,children:[" ",r]},`crash-${String(s)}`))]}):a.jsx(a.Fragment,{})},"CrashHeader"),hl=lt(({activeIndex:t,focused:e,store:r})=>{const s=K.useSyncExternalStore(r.subscribe,r.getSnapshot),i=r.getIds();if(i.length===0)return a.jsx(a.Fragment,{});const o=i.map(f=>s.get(f)).filter(f=>f!==void 0),n=r.getDockState(),c=n==="crash"?"red":n==="ready"?"gray":e?"white":"cyan",u=n==="crash"?"Services (crashed)":n==="ready"?"Services":"Services (starting)",h=e?n==="crash"?"↑↓ select Enter logs R retry Esc back":"↑↓ select Enter logs Esc back":"Tab to focus services";return n==="ready"&&!e?a.jsx($,{borderColor:c,borderStyle:"single",flexDirection:"row",flexShrink:0,children:a.jsx(ul,{states:o})}):a.jsxs($,{borderBottomTitle:h,borderColor:c,borderStyle:e?"bold":"single",borderTopTitle:u,flexDirection:"column",flexGrow:2,flexShrink:0,minHeight:6,paddingX:1,children:[n==="crash"&&a.jsx(fl,{states:o}),o.map((f,p)=>a.jsx(dl,{active:p===t,focused:e,state:f},f.id))]})},"ServiceDock");var pl=Object.defineProperty,Wt=m((t,e)=>pl(t,"name",{value:e,configurable:!0}),"T$2");const Wn=6,Hn=8,zn=12,gl=Wt(t=>t==="running"||t==="pending"?Ws:t==="local-cache"||t==="local-cache-kept-existing"?"Local":t==="remote-cache"?"Remote":Nt,"getCacheLabel"),Is=Wt((t,e)=>e[0]===t?"[1]":e[1]===t?"[2]":"","getPinLabel"),Rs=Wt(({compact:t,focused:e,isSelected:r,pinLabel:s,row:i})=>{const{persistent:o,status:n,taskId:c}=i,u=e&&r,h=u?">":" ",f=n==="running"&&o===!0;let p;if(f)p=a.jsx(d,{bold:!0,color:"green",children:" ● "});else if(n==="running")p=a.jsxs(d,{bold:!0,color:"white",children:[" ",a.jsx(Hs,{type:"dots"})," "]});else if(n==="pending")p=a.jsx(d,{bold:!0,color:"gray",children:" · "});else{const{color:g,icon:w}=kt(n);p=a.jsxs(d,{bold:!0,color:g,children:[" ",w," "]})}let l=Ws;return f?l="running":n!=="running"&&n!=="pending"?l=i.duration===void 0?Nt:et(i.duration):n==="running"&&i.elapsed!==void 0&&(l=et(i.elapsed)),a.jsxs($,{children:[a.jsx(d,{children:h}),a.jsx($,{width:Wn,children:p}),a.jsxs($,{flexGrow:1,children:[a.jsx(d,{bold:u,inverse:u,children:c}),s?a.jsx(d,{dimColor:!0,children:` ${s}`}):null]}),!t&&a.jsx($,{justifyContent:"flex-end",width:Hn,children:a.jsx(d,{dimColor:!ot(n),children:gl(n)})}),!t&&a.jsx($,{justifyContent:"flex-end",width:zn,children:a.jsx(d,{color:f?"green":void 0,dimColor:n==="pending"||f,children:l})})]})},"TaskListRow"),Os=Wt(({compact:t,filterActive:e,filterText:r,focused:s,headerStatus:i,parallelSlots:o=3,pinnedTaskIds:n,rows:c,scrollRef:u,selectedIndex:h,title:f})=>{const p=i==="error"?"red":i==="success"?"green":s?"white":"gray",l=c[h]?.taskId,g=[];let w=0;for(const b of c)b.status==="running"?g.push(b):b.status==="pending"&&(w+=1);const I=Math.min(o,g.length+w),L=I>1,x=[];if(L)for(let b=0;b<I;b++){const O=g[b];O?x.push(a.jsx(Rs,{compact:t,focused:s,isSelected:O.taskId===l,pinLabel:Is(O.taskId,n),row:O},`par-${O.taskId}`)):x.push(a.jsxs($,{children:[a.jsx(d,{children:" "}),a.jsx($,{width:Wn,children:a.jsx(d,{bold:!0,color:"gray",children:" · "})}),a.jsx(d,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(b)}`))}return a.jsxs($,{borderColor:p,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[a.jsxs($,{flexShrink:0,paddingX:1,children:[a.jsx(d,{bold:!0,inverse:!0,children:" VIS "}),a.jsx(d,{children:` ${f}`}),!t&&a.jsxs($,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[a.jsx($,{justifyContent:"flex-end",width:Hn,children:a.jsx(d,{dimColor:!0,children:"Cache"})}),a.jsx($,{justifyContent:"flex-end",width:zn,children:a.jsx(d,{dimColor:!0,children:"Duration"})})]})]}),a.jsx(Gs,{flexGrow:1,flexShrink:1,paddingX:1,paddingY:1,ref:u,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:c.map(b=>a.jsx(Rs,{compact:t,focused:s,isSelected:b.taskId===l,pinLabel:Is(b.taskId,n),row:b},b.taskId))}),L&&a.jsx($,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingX:1,paddingY:1,children:x}),e&&a.jsxs($,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexShrink:0,paddingX:1,children:[a.jsx(d,{bold:!0,color:"white",children:"/ "}),a.jsx(d,{children:r}),a.jsx(d,{inverse:!0,children:" "})]})]})},"TaskListPanel");var ml=Object.defineProperty,vl=m((t,e)=>ml(t,"name",{value:e,configurable:!0}),"ue");const Es=40,Ms=10,Ps=100,wl=Object.freeze([]),yl=vl(({autoExitSeconds:t,onRetryService:e,parallelSlots:r,projectNames:s,serviceDockStore:i,stdinRegistry:o,store:n,targets:c,tasks:u})=>{const{exit:h}=hi(),{columns:f,rows:p}=pi(),l=K.useSyncExternalStore(n.subscribe,n.getSnapshot),g=K.useCallback(M=>i?i.subscribe(M):()=>{},[i]);K.useSyncExternalStore(g,()=>i?i.getDockState():"ready");const w=i?i.getIds():wl,I=w.length>0,[L,x]=K.useState(0),[b,O]=K.useState(null),j=K.useSyncExternalStore(g,()=>b&&i?i.getState(b):void 0),[C,v]=K.useState(!1),k=K.useRef(null),F=K.useRef(null),P=K.useRef(null),[q,ae]=K.useState(!1),[Q,V]=K.useState(!0),ce=K.useRef({list:0,splitList:0,splitOutput:0}),Re=K.useCallback(()=>{l.viewMode==="list"?ce.current.list=F.current?.getScrollOffset()??0:l.viewMode==="split"&&(ce.current.splitList=F.current?.getScrollOffset()??0,ce.current.splitOutput=P.current?.getScrollOffset()??0)},[l.viewMode]),ie=K.useCallback(M=>{setTimeout(()=>{if(M==="list"){const S=ce.current.list;F.current?.scrollTo(S)}else if(M==="split"){const S=ce.current.splitList;S>0?F.current?.scrollTo(S):F.current?.scrollTo(Math.max(0,n.getSnapshot().selectedIndex-2)),P.current?.scrollTo(ce.current.splitOutput)}},0)},[n]),ge=K.useRef(!1);K.useEffect(()=>{l.done&&!ge.current&&(ge.current=!0,t>0&&ae(!0)),!l.done&&ge.current&&(ge.current=!1,ae(!1))},[l.done,t]);const Y=K.useMemo(()=>{const M=w.length>0?new Set(w):null,S=l.filterText?l.filterText.toLowerCase():null,A=[];for(const X of l.rows)M?.has(X.taskId)||l.statusFilter==="failed"&&X.status!=="failure"||l.statusFilter==="running"&&X.status!=="running"&&X.status!=="pending"||l.statusFilter==="passed"&&X.status!=="success"&&!ot(X.status)||S&&!X.taskId.toLowerCase().includes(S)||A.push(X);return A},[l.rows,l.filterText,l.statusFilter,w]),re=K.useMemo(()=>{let M=0;for(const S of l.rows)S.status==="running"&&(M+=1);return M},[l.rows]),de=(Y[l.selectedIndex]??null)?.taskId??null,le=b?null:l.pinnedTaskIds[0]??de,N=le?l.rows.find(M=>M.taskId===le):null,J=j??null,me=b?(J?.tailLines??[]).join(`
|
|
25
|
+
`):le?l.outputs.get(le)??"":"",Ve=K.useMemo(()=>N?.status==="failure"&&me?Gn(me,{color:!process.env.NO_COLOR,cwd:process.cwd()}):me,[N?.status,me]),Ke=b??le,st=b?J?.status==="crashed"||J?.status==="failed"?"failure":"running":N?.status,oe=mr(s,c,u),Ae=l.done?`Completed ${oe} (${et((l.endTime??Date.now())-l.startTime)})`:`Running ${oe}...`,qe=l.done?l.failed>0?"error":"success":"running",xe=K.useCallback(M=>{F.current?.scrollTo(Math.max(0,M-2))},[]);if(K.useEffect(()=>{l.interactiveMode&&N?.status!=="running"&&n.setInteractiveMode(!1)},[l.interactiveMode,N?.status,n]),K.useEffect(()=>{if(!le)return;let M=f;l.viewMode==="split"&&f>=Ps?M=f-Math.floor(f*.4)-2:(l.viewMode==="split"||l.viewMode==="fullscreen")&&(M=f-2);const S=Math.max(1,p-4);o.get(le)?.resize?.(M,S)},[f,p,l.viewMode,le]),is((M,S)=>{if(S.escape){n.setInteractiveMode(!1);return}if(!le)return;const A=o.get(le);if(!A){n.setInteractiveMode(!1);return}if(S.return)A.write("\r");else if(S.upArrow)A.write("\x1B[A");else if(S.downArrow)A.write("\x1B[B");else if(S.rightArrow)A.write("\x1B[C");else if(S.leftArrow)A.write("\x1B[D");else if(S.backspace)A.write("");else if(S.delete)A.write("\x1B[3~");else if(S.tab)A.write(" ");else if(S.home)A.write("\x1B[H");else if(S.end)A.write("\x1B[F");else if(S.pageUp)A.write("\x1B[5~");else if(S.pageDown)A.write("\x1B[6~");else if(S.ctrl&&M){const X=M.toUpperCase().codePointAt(0);X!==void 0&&X>=65&&X<=90&&A.write(String.fromCodePoint(X-64))}else M&&A.write(M)},{isActive:l.interactiveMode}),is((M,S)=>{if(M==="c"&&S.ctrl){h();return}if(!q){if(C){S.escape||M==="?"?v(!1):M==="q"?(v(!1),ae(!0)):S.downArrow||M==="j"?k.current?.scrollBy(1):S.upArrow||M==="k"?k.current?.scrollBy(-1):S.pageDown?k.current?.scrollBy(5):S.pageUp?k.current?.scrollBy(-5):S.home?k.current?.scrollToTop():S.end&&k.current?.scrollToBottom();return}if(M==="?"){v(!0);return}if(M==="q"){ae(!0);return}if(M==="r"&&l.done){n.requestRerun();return}if(M==="R"&&l.done){const A=Y[l.selectedIndex];A?.status==="failure"&&n.requestRetry(A.taskId);return}if(M==="F"&&!l.filterActive){const A=["all","failed","running","passed"],X=A.indexOf(l.statusFilter);n.setStatusFilter(A[(X+1)%A.length]);return}if(l.filterActive){if(S.escape){n.setFilterActive(!1);return}if(S.return){n.setFilterActive(!1);return}if(S.backspace){n.setFilter(l.filterText.slice(0,-1));return}if(M&&!S.ctrl&&!S.meta){n.setFilter(l.filterText+M);return}return}if(M==="i"&&N?.status==="running"&&(l.viewMode==="fullscreen"||l.viewMode==="split"&&l.focusedPanel==="output")){n.setInteractiveMode(!0);return}if(l.viewMode==="fullscreen"){if(S.escape){n.setViewMode("split"),ie("split");return}if(M==="f"){const A=!Q;V(A),A&&P.current?.scrollToBottom();return}if(S.downArrow||M==="j"){V(!1),P.current?.scrollBy(1);return}if(S.upArrow||M==="k"){V(!1),P.current?.scrollBy(-1);return}if(S.pageDown||S.ctrl&&M==="d"){V(!1),P.current?.scrollBy(12);return}if(S.pageUp||S.ctrl&&M==="u"){V(!1),P.current?.scrollBy(-12);return}if(S.home){V(!1),P.current?.scrollToTop();return}if(S.end){V(!0),P.current?.scrollToBottom();return}return}if(l.focusedPanel==="dock"&&I&&i){if(S.tab){O(null),n.setFocusedPanel("tasks");return}if(S.escape){n.setFocusedPanel("tasks"),O(null),l.viewMode==="split"&&(n.setViewMode("list"),ie("list"));return}if(S.downArrow||M==="j"){x(A=>Math.min(A+1,w.length-1));return}if(S.upArrow||M==="k"){x(A=>Math.max(A-1,0));return}if(S.return){const A=w[L];A&&(O(A),V(!0),Re(),ce.current.splitList=0,ce.current.splitOutput=0,n.setViewMode("split"),n.setFocusedPanel("output"),ie("split"));return}if((M==="r"||M==="R")&&e){const A=w[L],X=A?i.getState(A)?.status:void 0;if(A&&(X==="crashed"||X==="failed")){const Ye=e(A);Ye instanceof Promise&&Ye.catch(()=>{})}return}return}if(l.viewMode==="split"){if(S.tab){l.focusedPanel==="tasks"?n.setFocusedPanel("output"):I?n.setFocusedPanel("dock"):(O(null),n.setFocusedPanel("tasks"));return}if(l.focusedPanel==="output"){if(S.escape){if(b&&I){O(null),n.setViewMode("list"),n.setFocusedPanel("dock"),ie("list");return}O(null),n.setFocusedPanel("tasks");return}if(S.return){Re(),n.setViewMode("fullscreen");return}if(M==="f"){const A=!Q;V(A),A&&P.current?.scrollToBottom();return}if(S.downArrow||M==="j"){V(!1),P.current?.scrollBy(1);return}if(S.upArrow||M==="k"){V(!1),P.current?.scrollBy(-1);return}if(S.pageDown||S.ctrl&&M==="d"){V(!1),P.current?.scrollBy(12);return}if(S.pageUp||S.ctrl&&M==="u"){V(!1),P.current?.scrollBy(-12);return}if(S.home){V(!1),P.current?.scrollToTop();return}if(S.end){V(!0),P.current?.scrollToBottom();return}return}if(S.escape){n.setViewMode("list"),ie("list");return}if(S.return){n.setFocusedPanel("output");return}}if(l.viewMode==="list"||l.viewMode==="split"&&l.focusedPanel==="tasks"){if(S.tab&&l.viewMode==="list"&&I){n.setFocusedPanel("dock");return}if(S.downArrow||M==="j"){const A=Math.min(l.selectedIndex+1,Math.max(0,Y.length-1));n.setSelectedIndex(A),xe(A);return}if(S.upArrow||M==="k"){const A=Math.max(l.selectedIndex-1,0);n.setSelectedIndex(A),xe(A);return}if(S.return&&l.viewMode==="list"){V(!0),Re(),ce.current.splitList=0,ce.current.splitOutput=0,n.setViewMode("split"),n.setFocusedPanel("output"),ie("split");return}if(M==="/"){n.setFilterActive(!0);return}if(M==="1"&&de){n.pinTask(0,de);return}if(M==="2"&&de){n.pinTask(1,de);return}if(M==="0"){n.clearPins();return}S.escape&&l.filterText&&n.setFilter("")}}},{isActive:!l.interactiveMode}),f<Es||p<Ms)return a.jsx($,{alignItems:"center",height:p,justifyContent:"center",width:f,children:a.jsxs(d,{color:"yellow",children:["Terminal too small (",f,"x",p,"). Minimum:"," ",Es,"x",Ms]})});const Ue=a.jsxs($,{gap:1,children:[l.succeeded>0&&a.jsxs(d,{bold:!0,color:"green",children:["✓"," ",l.succeeded]}),l.failed>0&&a.jsxs(d,{bold:!0,color:"red",children:["✗"," ",l.failed]}),re>0&&a.jsxs(d,{color:"cyan",children:["◷"," ",re]}),a.jsxs(d,{dimColor:!0,children:[l.rows.length," ","total"]}),l.statusFilter!=="all"&&a.jsxs(d,{color:"yellow",children:["[",l.statusFilter,"]"]})]});let Oe;if(l.viewMode==="fullscreen")Oe=[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"Esc"}),a.jsx(d,{dimColor:!0,children:"BACK"})]},"esc"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"}),a.jsx(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"^u ^d"}),a.jsx(d,{dimColor:!0,children:"PAGE"})]},"page"),...N?.status==="running"?[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"i"}),a.jsx(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"q"}),a.jsx(d,{dimColor:!0,children:"QUIT"})]},"q")];else if(l.done){const M=Y[l.selectedIndex]?.status==="failure";Oe=[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"q"}),a.jsx(d,{dimColor:!0,children:"QUIT"})]},"q"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"r"}),a.jsx(d,{dimColor:!0,children:"RERUN"})]},"r"),...M?[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"R"}),a.jsx(d,{dimColor:!0,children:"RETRY"})]},"R")]:[],a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"?"}),a.jsx(d,{dimColor:!0,children:"HELP"})]},"?"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"}),a.jsx(d,{dimColor:!0,children:"NAV"})]},"nav"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"F"}),a.jsx(d,{dimColor:!0,children:"FILTER"})]},"F"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"⏎"}),a.jsx(d,{dimColor:!0,children:l.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter")]}else l.viewMode==="split"&&l.focusedPanel==="output"?Oe=[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"q"}),a.jsx(d,{dimColor:!0,children:"QUIT"})]},"q"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"Esc"}),a.jsx(d,{dimColor:!0,children:"BACK"})]},"esc"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"}),a.jsx(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),...N?.status==="running"?[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"i"}),a.jsx(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"⏎"}),a.jsx(d,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"Tab"}),a.jsx(d,{dimColor:!0,children:"PANEL"})]},"tab"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"?"}),a.jsx(d,{dimColor:!0,children:"HELP"})]},"?")]:Oe=[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"q"}),a.jsx(d,{dimColor:!0,children:"QUIT"})]},"q"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"?"}),a.jsx(d,{dimColor:!0,children:"HELP"})]},"?"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"}),a.jsx(d,{dimColor:!0,children:"NAV"})]},"nav"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"/"}),a.jsx(d,{dimColor:!0,children:"FILTER"})]},"/"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"F"}),a.jsx(d,{dimColor:!0,children:"STATUS"})]},"F"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"⏎"}),a.jsx(d,{dimColor:!0,children:l.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...l.viewMode==="split"?[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"Tab"}),a.jsx(d,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const be=a.jsxs($,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[a.jsx($,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:Oe}),a.jsx($,{flexShrink:0,paddingX:1,children:Ue})]}),We=a.jsxs(gi,{backgroundColor:"#1e1e1e",footer:a.jsxs(d,{dimColor:!0,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",a.jsx(d,{bold:!0,color:"white",children:"?"}),"/",a.jsx(d,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:k,title:"KEYBOARD SHORTCUTS",visible:C,width:52,children:[a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"NAVIGATION"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","↑","/k"]}),a.jsx(d,{dimColor:!0,children:" Move up"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","↓","/j"]}),a.jsx(d,{dimColor:!0,children:" Move down"})]})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Tab"]}),a.jsx(d,{dimColor:!0,children:" Switch panel (split)"})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Esc"]}),a.jsx(d,{dimColor:!0,children:" Back / close"})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Enter"]}),a.jsx(d,{dimColor:!0,children:" Show output / fullscreen"})]})]}),a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"VIEWS"})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Enter"]}),a.jsxs(d,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Esc"]}),a.jsxs(d,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"ACTIONS"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","/"]}),a.jsx(d,{dimColor:!0,children:" Filter by text"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","F"]}),a.jsx(d,{dimColor:!0,children:" Filter by status"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","1"]}),a.jsx(d,{dimColor:!0,children:"/"}),a.jsx(d,{bold:!0,color:"white",children:"2"}),a.jsx(d,{dimColor:!0,children:" Pin to output pane"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","0"]}),a.jsx(d,{dimColor:!0,children:" Clear pins"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","r"]}),a.jsx(d,{dimColor:!0,children:" Rerun all (done)"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","R"]}),a.jsx(d,{dimColor:!0,children:" Retry failed task"})]})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","i"]}),a.jsx(d,{dimColor:!0,children:" Interactive input (running task)"})]})]}),a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"SCROLLING"}),a.jsx(d,{dimColor:!0,children:" (output panel)"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","↑","/k"]}),a.jsx(d,{dimColor:!0,children:" Scroll up"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","↓","/j"]}),a.jsx(d,{dimColor:!0,children:" Scroll down"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","^u"]}),a.jsx(d,{dimColor:!0,children:" Page up"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","^d"]}),a.jsx(d,{dimColor:!0,children:" Page down"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Home"]}),a.jsx(d,{dimColor:!0,children:" Top"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","End"]}),a.jsx(d,{dimColor:!0,children:" Bottom (resume follow)"})]})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","f"]}),a.jsx(d,{dimColor:!0,children:" Toggle auto-scroll (tail mode)"})]})]}),a.jsxs($,{flexDirection:"column",children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"GENERAL"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","q"]}),a.jsx(d,{dimColor:!0,children:" Quit"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","?"]}),a.jsx(d,{dimColor:!0,children:" Toggle help"})]})]})]})]}),ke=a.jsx(mi,{autoExitSeconds:t>0?t:3,onCancel:m(()=>{ae(!1)},"onCancel"),visible:q}),we=I&&i?a.jsx(hl,{activeIndex:L,focused:l.focusedPanel==="dock",store:i}):null;if(l.viewMode==="fullscreen")return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsx($,{flexGrow:1,children:a.jsx(Cs,{autoScroll:Q,duration:N?.duration??N?.elapsed,focused:!0,interactiveMode:l.interactiveMode,output:Ve,scrollRef:P,status:st,supportsInteractive:!b,taskId:Ke})}),we,be,ke,We]});if(l.viewMode==="split"){const M=f>=Ps,S=a.jsx(Os,{compact:!0,filterActive:l.filterActive,filterText:l.filterText,focused:l.focusedPanel==="tasks",headerStatus:qe,parallelSlots:r,pinnedTaskIds:l.pinnedTaskIds,rows:Y,scrollRef:F,selectedIndex:l.selectedIndex,title:Ae}),A=a.jsx(Cs,{autoScroll:Q,duration:N?.duration??N?.elapsed,focused:l.focusedPanel==="output",interactiveMode:l.interactiveMode,output:Ve,scrollRef:P,showFullscreenHint:!0,status:st,supportsInteractive:!b,taskId:Ke});if(M){const Ye=Math.floor(f*.4);return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsxs($,{flexDirection:"row",flexGrow:1,children:[a.jsx($,{width:Ye,children:S}),a.jsx($,{flexGrow:1,children:A})]}),we,be,ke,We]})}const X=Math.floor(p*.45);return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsx($,{height:X,children:S}),a.jsx($,{flexGrow:1,children:A}),we,be,ke,We]})}return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsx($,{flexGrow:1,children:a.jsx(Os,{filterActive:l.filterActive,filterText:l.filterText,focused:l.focusedPanel!=="dock",headerStatus:qe,parallelSlots:r,pinnedTaskIds:l.pinnedTaskIds,rows:Y,scrollRef:F,selectedIndex:l.selectedIndex,title:Ae})}),we,be,ke,We]})},"VisTaskRunnerApp");var $l=Object.defineProperty,Xe=m((t,e)=>$l(t,"name",{value:e,configurable:!0}),"r$1");const xl=Xe(t=>{const{args:e,autoExit:r=!1,onRetryService:s,outputStyle:i="normal",projectNames:o,serviceDockStore:n,stdinRegistry:c,tasks:u}=t,h=new At(u),f=typeof e.parallel=="number"?e.parallel:3,p=r===!0?3:typeof r=="number"?r:0;let l,g;const w=new Promise(k=>{g=k});let I;const L=Xe(()=>{I&&(clearInterval(I),I=void 0)},"cleanup"),x=Xe(()=>{if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),process.stdin.unref()},"releaseStdin"),b=Xe(()=>{if(c){for(const k of c.values())k.kill?.();c.clear()}},"killAllPtyProcesses"),O=Xe(()=>{L(),v(),b(),x(),process.stdout.write("\x1B[?1049l\x1B[?25h"),l?.cleanup(),process.exit(1)},"onSignal"),j=Xe(()=>{const k=h.getSnapshot(),F=et(Date.now()-k.startTime),P=k.rows.filter(Q=>Q.status==="failure").map(Q=>Q.taskId),q=process.stdout.columns||80;process.stdout.write(`
|
|
26
|
+
`);for(const Q of k.rows){const{persistent:V,status:ce,taskId:Re}=Q,ie=ce==="running"||ce==="pending",ge=kt(ce),Y=ie&&V?"■":ge.icon,re=ie&&V?"gray":ge.color;let de="";switch(ce){case"local-cache":case"local-cache-kept-existing":{de=" [local cache]";break}case"remote-cache":{de=" [remote cache]";break}case"skipped":{de=" [skipped]";break}default:{ie&&V?de=" [stopped]":ie&&(de=" [skipped]");break}}const le=Q.retryAttempts&&Q.retryAttempts>0?` [retried ${Q.retryAttempts}x]`:"",N=$e(te.createElement(d,null," ",te.createElement(d,{color:re},Y),` vis run ${Re}`,de?te.createElement(d,{dimColor:!0},` ${de}`):null,le?te.createElement(d,{color:"yellow"},le):null),{columns:q});process.stdout.write(`${N}
|
|
27
|
+
`)}process.stdout.write(`
|
|
28
|
+
`);const ae=$e(te.createElement(tn,{cached:k.cached,failed:k.failed,failedIds:P,projectNames:o,retriedIds:k.retriedIds.length>0?k.retriedIds:void 0,succeeded:k.succeeded,targets:e.targets,tasks:u,took:F}),{columns:q});if(process.stdout.write(`${ae}
|
|
29
|
+
`),P.length>0&&i!=="quiet")for(const Q of P){const V=k.outputs.get(Q);if(V?.trim()){const ce=$e(te.createElement(d,null,`
|
|
30
|
+
`,te.createElement(d,{bold:!0,color:"red"},` ${lr} vis run ${Q}`)),{columns:q});process.stdout.write(`${ce}
|
|
31
|
+
|
|
32
|
+
`);const Re=V.trim().split(`
|
|
33
|
+
`).map(ie=>` ${ie}`).join(`
|
|
34
|
+
`);process.stdout.write(`${Re}
|
|
35
|
+
`)}}},"printExitSummary");let C;const v=Xe(()=>{C&&(clearInterval(C),C=void 0)},"clearKeepAlive");return{lifeCycle:{endCommand(){L(),h.markDone(),C||(C=setInterval(()=>{},1e3))},endTasks(k){h.endTasks(k)},printCacheDisabledByTask(k){h.addOutput(k.id,`ⓘ caching disabled by task via disableCache()
|
|
36
|
+
`)},printEmptyFingerprintWarning(k,F){h.addOutput(k.id,`ⓘ caching skipped — ${F}
|
|
37
|
+
`)},printSelfModifyingSkip(k,F){h.addOutput(k.id,`ⓘ caching skipped — task modified its own input${F.length===1?"":"s"} (${F.join(", ")})
|
|
38
|
+
`)},printTaskTerminalOutput(k,F,P){h.getSnapshot().outputs.has(k.id)||h.addOutput(k.id,P)},startCommand(){process.on("SIGINT",O),process.on("SIGTERM",O),C||(C=setInterval(()=>{},1e3)),l=vi(te.createElement(yl,{autoExitSeconds:p,onRetryService:s,parallelSlots:f,projectNames:o,serviceDockStore:n,stdinRegistry:c??new Map,store:h,targets:e.targets,tasks:u}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}),l.waitUntilExit().then(()=>{v(),b(),x(),process.removeListener("SIGINT",O),process.removeListener("SIGTERM",O),j(),g()}).catch(()=>{v(),b(),x(),process.removeListener("SIGINT",O),process.removeListener("SIGTERM",O),g()})},startTasks(k){h.startTasks(k),I||(I=setInterval(()=>{h.tick()},100))}},renderIsDone:w,store:h}},"createDynamicOutputRenderer");var bl=Object.defineProperty,Br=m((t,e)=>bl(t,"name",{value:e,configurable:!0}),"p$1");const kl=Br(t=>t==="quiet"?"quiet":"normal","parseOutputStyle"),jl=Br((t,e)=>{const r=t.overrides.visOptions;return r?.outputStyle==="normal"||r?.outputStyle==="quiet"?r.outputStyle:e},"resolveTaskOutputStyle");class Sl{static{m(this,"StaticOutputLifeCycle")}static{Br(this,"StaticOutputLifeCycle")}#e;#s;#r;#n=[];#t=[];#i=[];#o=new Map;#a;#c;#l;#u=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.#u=Date.now();const e=process.stdout.columns||80,r=`Running ${mr(this.#e,this.#s,this.#r)}`,s=$e(te.createElement(er,{title:r,variant:"info"}),{columns:e});process.stdout.write(s);const i=this.#r[0],o=i?.overrides?Object.entries(i.overrides).filter(([n])=>n!=="command"):[];if(o.length>0){process.stdout.write(`
|
|
39
|
+
With additional flags:
|
|
40
|
+
`);for(const[n,c]of o)process.stdout.write(`${Ha(" ",n,c)}
|
|
41
|
+
`)}process.stdout.write(`
|
|
42
|
+
`)}startTasks(e){const r=process.stdout.columns||80;for(const s of e){const i=$e(te.createElement(d,null,te.createElement(d,{dimColor:!0},">"),` ${s.id}`),{columns:r});process.stdout.write(`${i}
|
|
43
|
+
`)}}endTasks(e){const r=process.stdout.columns||80;for(const s of e){this.#o.set(s.task.id,s),s.status==="failure"?this.#n.push(s):ot(s.status)&&this.#t.push(s),s.retryAttempts&&s.retryAttempts>0&&this.#i.push(s);const i=wt(s.status),o=s.startTime&&s.endTime?` (${et(s.endTime-s.startTime)})`:"",n=ot(s.status)?" [cache]":"",c=s.retryAttempts&&s.retryAttempts>0?` [retried ${s.retryAttempts}x]`:"",u=$e(te.createElement(d,null,i,` ${s.task.id}`,n?te.createElement(d,{color:"cyan"},n):null,c?te.createElement(d,{color:"yellow"},c):null,o?te.createElement(d,{dimColor:!0},o):null),{columns:r});process.stdout.write(`${u}
|
|
44
|
+
`)}}#d(e){const r=process.stdout.columns||80,s=$e(te.createElement(d,{dimColor:!0},` ⓘ ${e}`),{columns:r});process.stdout.write(`${s}
|
|
45
|
+
`)}printCacheDisabledByTask(e){this.#d(`${e.id}: caching disabled by task via disableCache()`)}printSelfModifyingSkip(e,r){this.#d(`${e.id}: caching skipped — task modified its own input${r.length===1?"":"s"} (${r.join(", ")})`)}printEmptyFingerprintWarning(e,r){this.#d(`${e.id}: caching skipped — ${r}`)}printTaskTerminalOutput(e,r,s){if(jl(e,this.#c)==="quiet"&&(r==="success"||ot(r)))return;const i=r==="failure"?Gn(s,{color:!process.env.NO_COLOR,cwd:process.cwd()}):s;if(this.#a){this.#a.printTaskTerminalOutput(e,r,i);return}sl(e.id,r,i,this.#l)}endCommand(){const e=et(Date.now()-this.#u),r=this.#r.filter(o=>!this.#o.has(o.id)).map(o=>o.id);process.stdout.write(`
|
|
46
|
+
`);const s=process.stdout.columns||80,i=$e(te.createElement(tn,{cached:this.#t.length,failed:this.#n.length,failedIds:this.#n.map(o=>o.task.id),projectNames:this.#e,retriedIds:this.#i.length>0?this.#i.map(o=>o.task.id):void 0,skippedIds:r.length>0?r:void 0,succeeded:this.#o.size-this.#n.length-this.#t.length,targets:this.#s,tasks:this.#r,took:e}),{columns:s});process.stdout.write(`${i}
|
|
47
|
+
`)}}var Tl=Object.defineProperty,Ht=m((t,e)=>Tl(t,"name",{value:e,configurable:!0}),"o");const Cl=Ht(async t=>{if(process.env.VIS_NO_SHELL_HISTORY||jo()==="win32")return;const e=process.env.SHELL;if(!e)return;const r=di(e);try{if(r==="zsh"){await Il(t);return}if(r==="bash"){await Rl(t);return}r==="fish"&&await Ol(t)}catch{}},"appendToShellHistory"),Il=Ht(async t=>{const e=process.env.HISTFILE??he(process.env.ZDOTDIR??ur(),".zsh_history"),r=`: ${Math.floor(Date.now()/1e3)}:0;${t}
|
|
48
|
+
`;await dr(e,r)},"writeZshHistory"),Rl=Ht(async t=>{const e=process.env.HISTFILE??he(ur(),".bash_history");await dr(e,`${t}
|
|
49
|
+
`)},"writeBashHistory"),Ol=Ht(async t=>{const e=he(ur(),".local","share","fish","fish_history"),r=`- cmd: ${t.replaceAll("\\","\\\\").replaceAll(`
|
|
50
|
+
`,String.raw`\n`)}
|
|
51
|
+
when: ${Math.floor(Date.now()/1e3)}
|
|
52
|
+
`;await dr(e,r)},"writeFishHistory");var El=Object.defineProperty,Qt=m((t,e)=>El(t,"name",{value:e,configurable:!0}),"e");const Ml=Qt(t=>{const{killGracePeriodMs:e=5e3,onTimeout:r,sendSignal:s,timeoutMs:i}=t;if(i<=0)return{cancel:Qt(()=>{},"cancel")};const o=Math.max(e,0);let n;const c=setTimeout(()=>{r?.(),s("SIGTERM"),o>0&&(n=setTimeout(()=>{s("SIGKILL")},o))},i);return{cancel:Qt(()=>{clearTimeout(c),n&&clearTimeout(n)},"cancel")}},"scheduleTimeoutKill");var Pl=Object.defineProperty,Fl=m((t,e)=>Pl(t,"name",{value:e,configurable:!0}),"n");const Al=Fl((t,e)=>{const r=e?.trim();if(!r)return{filter:void 0,tasks:[...t]};const s=r.toLowerCase();return{filter:r,tasks:t.filter(i=>i.target.project.toLowerCase().includes(s))}},"applyProjectFilter");var Ll=Object.defineProperty,Be=m((t,e)=>Ll(t,"name",{value:e,configurable:!0}),"a$1");const Dl=[""," Watch keybinds:"," r, Enter rerun"," a rerun all (clear filter)"," p filter by project name"," q, Ctrl+C quit"," h, ? show this help",""].join(`
|
|
53
|
+
`),Bl=Be(t=>{t.write(`${Dl}
|
|
54
|
+
`)},"writeHelp"),Nl=Be(async(t,e)=>{e.write("filter projects (empty to cancel) > ");const r=t,s=r.isRaw===!0;if(s)try{r.setRawMode?.(!1)}catch{}return await new Promise(i=>{let o="";const n=Be(c=>{o+=typeof c=="string"?c:c.toString("utf8");const u=o.indexOf(`
|
|
55
|
+
`);if(u===-1)return;const h=o.slice(0,u).replace(/\r$/,"").trim();if(t.off("data",n),s)try{r.setRawMode?.(!0)}catch{}i(h.length>0?h:void 0)},"onData");t.on("data",n)})},"defaultPromptFilter"),_l=Be(t=>{const{handlers:e}=t,r=t.input??process.stdin,s=t.output??process.stdout,i=t.promptFilter??Nl;if(!r||r.isTTY===!1)return{close:Be(()=>{},"close")};Zi(r);const o=r.isRaw===!0;try{r.setRawMode?.(!0)}catch{return{close:Be(()=>{},"close")}}typeof r.resume=="function"&&r.resume();let n=!1;const c=Be(async f=>{if(f.ctrl===!0&&f.name==="c"){await e.onQuit();return}if(!n)switch(f.name){case"?":case"h":{await e.onHelp();break}case"a":{await e.onClearFilter();break}case"p":{n=!0;try{const p=await i(r,s);p===void 0?s.write(`filter cancelled.
|
|
56
|
+
`):await e.onFilter(p)}finally{n=!1}break}case"q":{await e.onQuit();break}case"r":{await e.onRerun();break}case"return":{await e.onRerun();break}}},"dispatch"),u=Be((f,p)=>{c(p).catch(l=>{s.write(`[vis watch] keybind handler failed: ${l.message}
|
|
57
|
+
`)})},"onKeypress"),h=r;return h.on("keypress",u),{close:Be(()=>{if(h.off("keypress",u),!o)try{r.setRawMode?.(!1)}catch{}const f=r;if(typeof f.pause=="function")try{f.pause()}catch{}},"close")}},"installKeybinds");var Gl=Object.defineProperty,ir=m((t,e)=>Gl(t,"name",{value:e,configurable:!0}),"y");const ql=ir(t=>{const e=t.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),Ul=ir(async t=>{const{initialTasks:e,probe:r,registeredEntries:s,taskGraph:i,visVersion:o}=t,n=new Map,c=new Map,u=new Map;for(const v of s)if(ro(v.pid)){if(v.visVersion!==o){c.set(v.id,v);continue}n.set(v.id,v)}if(r){const v=[...n.values()],k=await Promise.all(v.map(async F=>{try{return[F.id,await r(F)]}catch{return[F.id,!1]}}));for(const[F,P]of k)if(!P){const q=n.get(F);n.delete(F),q&&u.set(F,q)}}const h=new Set(e.map(v=>v.id)),f=new Set,p=[],l=[],g=new Set;for(const v of Object.values(i.dependencies))for(const k of v)g.add(k);for(const[v,k]of Object.entries(i.tasks)){if(!ql(k)?.service)continue;if(n.has(v)){f.add(v),l.push(n.get(v));continue}if(h.has(v)||!g.has(v))continue;const F=c.get(v),P=u.get(v);let q;F?q=`Service ${v} is registered with vis ${F.visVersion}, but this invocation is vis ${o}. Restart with \`vis service restart ${v}\` to pick up the new version.`:P?q=`Service ${v} is registered (PID ${String(P.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.`:q=`Target depends on the service ${v}, which is not running. Run \`vis service start ${v}\` first, or invoke \`${v}\` directly.`,p.push({message:q,targetId:v})}if(f.size===0)return{diagnostics:p,initialTasks:e,satisfiedServices:l,serviceDependentsByServiceId:new Map,serviceEnvByTaskId:new Map,taskGraph:i};const w=new Map,I=ir(v=>{const k=new Set,F=[...i.dependencies[v]??[]],P=new Set;for(;F.length>0;){const q=F.pop();if(!P.has(q)){P.add(q),f.has(q)&&k.add(q);for(const ae of i.dependencies[q]??[])P.has(ae)||F.push(ae)}}return[...k].sort()},"collectTransitiveServices"),L=new Map;for(const v of Object.keys(i.dependencies)){if(f.has(v))continue;const k=I(v);if(k.length===0)continue;const F={};for(const P of k){const q=n.get(P);if(!q)continue;Object.assign(F,q.env);const ae=L.get(P);ae?ae.push(v):L.set(P,[v])}Object.keys(F).length>0&&w.set(v,F)}for(const v of L.values())v.sort();const x={};for(const[v,k]of Object.entries(i.tasks))f.has(v)||(x[v]=k);const b={};for(const[v,k]of Object.entries(i.dependencies))f.has(v)||(b[v]=k.filter(F=>!f.has(F)));const O=new Map;for(const v of Object.keys(x))O.set(v,0);for(const v of Object.values(b))for(const k of v)O.has(k)&&O.set(k,(O.get(k)??0)+1);const j=[];for(const v of i.roots)!f.has(v)&&x[v]&&j.push(v);for(const[v,k]of O)k===0&&!j.includes(v)&&x[v]&&j.push(v);const C=e.filter(v=>!f.has(v.id));return{diagnostics:p,initialTasks:C,satisfiedServices:l,serviceDependentsByServiceId:L,serviceEnvByTaskId:w,taskGraph:{dependencies:b,roots:j,tasks:x}}},"applyServiceRegistry");var Wl=Object.defineProperty,yt=m((t,e)=>Wl(t,"name",{value:e,configurable:!0}),"c");const It="[[VIS_BOOT]]",Hl=250,zl=1e3,Fs=3,Vl=yt(t=>{try{return process.kill(t,0),!0}catch{return!1}},"isAlive"),As=yt(t=>{try{const e=at(t,"utf8").trim(),r=Number.parseInt(e,10);return Number.isFinite(r)&&r>0?r:null}catch{return null}},"readPidFile");class Kl{static{m(this,"ServiceEventBridge")}static{yt(this,"ServiceEventBridge")}#e;#s;#r;#n;#t=new Map;#i=new Map;#o=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.#n=e.workspaceRoot}onProcessEvent=yt(e=>{if(e.kind!=="stdout"&&e.kind!=="stderr")return;const r=this.#e.get(e.index);r===void 0||e.text===void 0||this.onTaskOutput(r,e.text)},"onProcessEvent");onTaskOutput(e,r){if(!this.#s.has(e))return;const s=((this.#t.get(e)??"")+r).split(`
|
|
58
|
+
`),i=s.pop()??"";this.#t.set(e,i);for(const o of s)this.#l(e,o)}notifyRegistryStarting(e){this.#r.starting(e)}notifyRegistryStarted(e,r){this.#r.started(e,r)}onRegistryTaskStarted(e){this.#s.get(e)?.mode==="registry"&&this.notifyRegistryStarting(e)}async onRegistryTaskClosed(e,r,s){if(this.#s.get(e)?.mode!=="registry")return;if(s||r!==0){this.notifyRegistryFailed(e,"exit-code",{exitCode:r,killed:s});return}const i=await so(this.#n,e);if(!i){this.notifyRegistryFailed(e,"missing-registry-entry");return}const{config:o}=i,n=o.readiness?.tcp?.port??o.port??0,c=o.readiness?.tcp?.host??"127.0.0.1";this.notifyRegistryReady(e,{host:c,logFile:i.logFile,pid:i.pid,port:n})}notifyRegistryReady(e,r){this.#r.ready(e,{host:r.host,port:r.port}),this.#h(e,r.logFile),r.pid!==null&&this.#p(e,r.pid)}notifyRegistryFailed(e,r,s){this.#r.failed(e,r,s)}async retry(e){const r=this.#s.get(e);if(r){if(this.#f(e),this.#t.delete(e),this.#i.delete(e),this.#r.starting(e),r.mode==="registry"){await this.#y(e,r.registry);return}r.mode==="ephemeral"&&this.#w(e,r.ephemeral)}}async dispose(){for(const e of[...this.#o.keys(),...this.#a.keys()])this.#f(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.#i.clear()}#l(e,r){if(r.startsWith(It)){this.#u(e,r.slice(It.length));return}const s=this.#i.get(e)??[];s.push(r),s.length>Fs&&s.shift(),this.#i.set(e,s),this.#r.log(e,`${r}
|
|
59
|
+
`)}#u(e,r){let s;try{s=JSON.parse(r)}catch{this.#r.log(e,`${It+r}
|
|
60
|
+
`);return}switch(s.event){case"failed":{const i=typeof s.reason=="string"?s.reason:"unknown",o={};for(const[n,c]of Object.entries(s))n!=="event"&&n!=="id"&&n!=="reason"&&(o[n]=c);this.#r.failed(e,i,o);break}case"ready":{const i=typeof s.host=="string"?s.host:"127.0.0.1",o=typeof s.port=="number"?s.port:0;this.#r.ready(e,{host:i,port:o}),this.#d(e);break}case"started":{const i=typeof s.pid=="number"?s.pid:null;this.#r.started(e,i);break}default:this.#r.log(e,`${It+r}
|
|
61
|
+
`)}}#d(e){const r=this.#s.get(e);if(r?.ephemeral===void 0)return;this.#h(e,r.ephemeral.logFile);const s=As(r.ephemeral.pidFile);s!==null&&this.#p(e,s)}#h(e,r){if(this.#o.has(e)||!Ze(r))return;const s=Yi(r,"r"),i=(()=>{try{return ds(r).size}catch{return 0}})(),o={fd:s,logFile:r,pollTimer:setInterval(()=>{this.#m(e)},Hl),position:i};this.#o.set(e,o)}#m(e){const r=this.#o.get(e);if(r)try{const s=ds(r.logFile);if(s.size<=r.position)return;const i=Buffer.alloc(s.size-r.position),o=Ji(r.fd,i,0,i.length,r.position);if(o>0){r.position+=o;const n=i.subarray(0,o).toString("utf8");for(const c of n.split(`
|
|
62
|
+
`))c.length!==0&&this.#v(e,c);this.#r.log(e,n)}}catch{}}#v(e,r){const s=this.#i.get(e)??[];for(s.push(r);s.length>Fs;)s.shift();this.#i.set(e,s)}#p(e,r){if(this.#a.has(e))return;const s={pid:r,timer:setInterval(()=>{if(!Vl(r)){const i=[...this.#i.get(e)??[]];this.#f(e),this.#r.crashed(e,i)}},zl)};this.#a.set(e,s)}#f(e){const r=this.#o.get(e);if(r){clearInterval(r.pollTimer);try{Xi(r.fd)}catch{}this.#o.delete(e)}const s=this.#a.get(e);s&&(clearInterval(s.timer),this.#a.delete(e))}#w(e,r){if(r===void 0)return;const s=As(r.pidFile);if(s!==null)try{process.kill(-s,"SIGTERM")}catch{}const i=Co("node",[r.scriptPath,r.configFile],{cwd:r.cwd,stdio:["ignore","pipe","pipe"]});i.stdout.on("data",n=>{this.#g(e,n)}),i.stderr.on("data",n=>{this.#g(e,n)}),i.on("error",n=>{this.#r.failed(e,"respawn-error",{message:n.message})});const o=new Promise(n=>{const c=yt(()=>{this.#c.delete(o),n()},"settle");i.once("exit",c),i.once("error",c)});this.#c.add(o)}#g(e,r){const s=((this.#t.get(e)??"")+r.toString("utf8")).split(`
|
|
63
|
+
`),i=s.pop()??"";this.#t.set(e,i);for(const o of s)this.#l(e,o)}async#y(e,r){if(r!==void 0){try{await no({id:e,workspaceRoot:this.#n})}catch{}try{const s=await io({command:r.command,config:r.config,cwd:r.cwd,env:r.env,id:e,workspaceRoot:this.#n}),i=r.config.readiness?.tcp?.port??r.config.port??0,o=r.config.readiness?.tcp?.host??"127.0.0.1";this.#r.started(e,s.entry.pid),this.notifyRegistryReady(e,{host:o,logFile:s.entry.logFile,pid:s.entry.pid,port:i})}catch(s){const i=s instanceof Error?s.message:String(s);this.#r.failed(e,"retry-failed",{message:i})}}}}var Yl=Object.defineProperty,Ie=m((t,e)=>Yl(t,"name",{value:e,configurable:!0}),"f");const Jl=Ie(t=>{const e=t.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),Vn=Ie((t,e,r)=>{const s=[],i=[];for(const o of e){const n=r.tasks[o];if(!n){i.push({id:o,reason:"task not in graph"});continue}const c=n.overrides.command;if(!c){i.push({id:o,reason:"no command resolved"});continue}const u=Jl(n);if(!u?.service){i.push({id:o,reason:"no service config"});continue}const h=Bt(t,n.projectRoot,!!u.runFromWorkspaceRoot),{envFile:f}=u,p=f===void 0||f===!1?{}:or(h,f),l=u.service.env??{};s.push({command:c,config:u.service,cwd:h,env:{...p,...l},id:o})}return{services:s,skipped:i}},"extractPreflightTasks"),Xl=Ie((t,e)=>{const r=new Set(t),s=new Map;for(const n of t){const c=(e.dependencies[n]??[]).filter(u=>r.has(u));s.set(n,new Set(c))}const i=[],o=new Set;for(;s.size>0;){const n=[];for(const[c,u]of s){for(const h of u)o.has(h)&&u.delete(h);u.size===0&&n.push(c)}n.length===0&&n.push(...s.keys());for(const c of n)o.add(c),s.delete(c);n.sort(),i.push({ids:n})}return i},"planTopoLevels"),Ql=Ie((t,e)=>{const r=[];for(const s of Xl(t,e))r.push(...s.ids);return r},"linearize"),Zl=String.raw`import { spawn } from "node:child_process";
|
|
64
|
+
import { closeSync, openSync, readFileSync, readSync, statSync, writeFileSync } from "node:fs";
|
|
65
|
+
import { createConnection } from "node:net";
|
|
66
|
+
|
|
67
|
+
const cfgPath = process.argv[2];
|
|
68
|
+
|
|
69
|
+
if (!cfgPath) {
|
|
70
|
+
console.error("[vis-service-bootstrap] missing config path");
|
|
71
|
+
process.exit(2);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const cfg = JSON.parse(readFileSync(cfgPath, "utf8"));
|
|
75
|
+
|
|
76
|
+
// Structured marker for service-event-bridge.ts to consume. Plain
|
|
77
|
+
// process.stdout.write keeps the line atomic and on the same stream
|
|
78
|
+
// as the tailed child log, so the parser sees one stream.
|
|
79
|
+
const emit = (event) => {
|
|
80
|
+
process.stdout.write("[[VIS_BOOT]]" + JSON.stringify({ ...event, id: cfg.id }) + "\n");
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Spawn the child with its stdio bound to a real file descriptor on
|
|
84
|
+
// disk — NOT inherited from the bootstrap. If the child inherited
|
|
85
|
+
// our stdio, it would inherit vis run's task pipes, and vis run would
|
|
86
|
+
// block waiting for those pipes to close even after this bootstrap
|
|
87
|
+
// exits. The logfile gives the grandchild a stable target it can keep
|
|
88
|
+
// writing to long after this bootstrap is gone.
|
|
89
|
+
const childLogFd = openSync(cfg.logFile, "a");
|
|
90
|
+
|
|
91
|
+
const child = spawn(cfg.command, {
|
|
92
|
+
cwd: cfg.cwd,
|
|
93
|
+
detached: true,
|
|
94
|
+
env: { ...process.env, ...cfg.env },
|
|
95
|
+
shell: true,
|
|
96
|
+
stdio: ["ignore", childLogFd, childLogFd],
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Close the bootstrap's copy of the fd; the child kept its own.
|
|
100
|
+
closeSync(childLogFd);
|
|
101
|
+
|
|
102
|
+
if (child.pid !== undefined) {
|
|
103
|
+
try {
|
|
104
|
+
writeFileSync(cfg.pidFile, String(child.pid));
|
|
105
|
+
} catch (error) {
|
|
106
|
+
console.error("[vis] failed to write pid file: " + (error?.message ?? String(error)));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
emit({ event: "started", pid: child.pid ?? null });
|
|
111
|
+
|
|
112
|
+
let exitedEarly = false;
|
|
113
|
+
|
|
114
|
+
child.once("exit", (code, signal) => {
|
|
115
|
+
exitedEarly = true;
|
|
116
|
+
emit({ code, event: "failed", reason: "exited-before-ready", signal });
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// Forward new bytes from the logfile to our stdout while we're alive.
|
|
120
|
+
// Polling-based tail; preflight is short, ~200ms per cycle is fine.
|
|
121
|
+
let tailPos = 0;
|
|
122
|
+
const tailFd = openSync(cfg.logFile, "r");
|
|
123
|
+
|
|
124
|
+
const flushTail = () => {
|
|
125
|
+
try {
|
|
126
|
+
const stat = statSync(cfg.logFile);
|
|
127
|
+
if (stat.size <= tailPos) return;
|
|
128
|
+
const remaining = stat.size - tailPos;
|
|
129
|
+
const buf = Buffer.alloc(remaining);
|
|
130
|
+
const n = readSync(tailFd, buf, 0, remaining, tailPos);
|
|
131
|
+
if (n > 0) {
|
|
132
|
+
process.stdout.write(buf.subarray(0, n));
|
|
133
|
+
tailPos += n;
|
|
134
|
+
}
|
|
135
|
+
} catch {}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const probeOnce = () => new Promise((resolve) => {
|
|
139
|
+
const socket = createConnection({ host: cfg.host || "127.0.0.1", port: cfg.port });
|
|
140
|
+
let settled = false;
|
|
141
|
+
const finish = (ok) => {
|
|
142
|
+
if (settled) return;
|
|
143
|
+
settled = true;
|
|
144
|
+
try { socket.destroy(); } catch {}
|
|
145
|
+
resolve(ok);
|
|
146
|
+
};
|
|
147
|
+
socket.once("connect", () => finish(true));
|
|
148
|
+
socket.once("error", () => finish(false));
|
|
149
|
+
socket.setTimeout(1000, () => finish(false));
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
153
|
+
|
|
154
|
+
(async () => {
|
|
155
|
+
const deadline = Date.now() + (cfg.timeoutMs ?? 30000);
|
|
156
|
+
while (Date.now() < deadline) {
|
|
157
|
+
flushTail();
|
|
158
|
+
if (exitedEarly) {
|
|
159
|
+
try { closeSync(tailFd); } catch {}
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
if (await probeOnce()) {
|
|
163
|
+
flushTail();
|
|
164
|
+
emit({ event: "ready", host: cfg.host || "127.0.0.1", port: cfg.port });
|
|
165
|
+
try { closeSync(tailFd); } catch {}
|
|
166
|
+
child.unref();
|
|
167
|
+
process.exit(0);
|
|
168
|
+
}
|
|
169
|
+
await sleep(200);
|
|
170
|
+
}
|
|
171
|
+
flushTail();
|
|
172
|
+
emit({ event: "failed", reason: "timeout", timeoutMs: cfg.timeoutMs ?? 30000 });
|
|
173
|
+
try { closeSync(tailFd); } catch {}
|
|
174
|
+
try { process.kill(-child.pid, "SIGTERM"); } catch {}
|
|
175
|
+
process.exit(1);
|
|
176
|
+
})();
|
|
177
|
+
`,ed=Ie(()=>{const t=Qi(he(So(),"vis-services-")),e=he(t,"bootstrap.mjs");return zs(e,Zl),{runDir:t,scriptPath:e}},"prepareBootstrap"),Kn=Ie((t,e,r)=>{const s=r.replaceAll(/[^\w-]/g,"_");return{configFile:he(t,`${s}.json`),logFile:he(t,`${s}.log`),pidFile:he(t,`${s}.pid`),scriptPath:e}},"buildBootstrapPaths"),td=Ie(t=>{const{paths:e,service:r}=t,s=r.config.readiness?.tcp?.port??r.config.port;if(typeof s!="number")throw new TypeError(`Service ${r.id} has no TCP readiness port — declare \`service.port\` or \`service.readiness.tcp.port\`.`);const i={...r.env,PATH:Fi(r.cwd,r.env)};return{command:r.command,cwd:r.cwd,env:i,host:r.config.readiness?.tcp?.host??"127.0.0.1",id:r.id,logFile:e.logFile,pidFile:e.pidFile,port:s,timeoutMs:r.config.readiness?.tcp?.timeoutMs??3e4}},"buildEphemeralConfig"),rd=Ie(t=>`node ${JSON.stringify(t.scriptPath)} ${JSON.stringify(t.configFile)}`,"buildEphemeralCommand"),sd=Ie(t=>{const{id:e,visBin:r,workspaceRoot:s}=t;return`node ${JSON.stringify(r)} service start ${JSON.stringify(e)} --cwd ${JSON.stringify(s)}`},"buildRegistryCommand"),nd=Ie(t=>{const{missingServiceIds:e,mode:r,taskGraph:s,visBin:i,workspaceRoot:o}=t,{services:n,skipped:c}=Vn(o,e,s);if(n.length===0)return{chain:[],ephemeralPidFiles:[],runDir:void 0,serviceEnvByTaskId:new Map,skipped:c};const u=Ql(n.map(x=>x.id),s),h=new Map(n.map(x=>[x.id,x])),f=[],p=[];if(r==="ephemeral")for(const x of u){const b=h.get(x);b&&p.push({id:x,payload:td({paths:{logFile:"",pidFile:""},service:b})})}let l;r==="ephemeral"&&(l=ed());let g;for(const x of u){const b=h.get(x),O=s.tasks[x];if(!b||!O)continue;let j;if(r==="ephemeral"){const C=Kn(l.runDir,l.scriptPath,x),v={...p.find(k=>k.id===x).payload,logFile:C.logFile,pidFile:C.pidFile};zs(C.configFile,JSON.stringify(v)),j=rd(C),f.push(C.pidFile)}else j=sd({id:x,visBin:i,workspaceRoot:o});if(O.overrides={...O.overrides,command:j},O.cache=!1,s.tasks[x]=O,g!==void 0){const C=s.dependencies[x]??[];C.includes(g)||(s.dependencies[x]=[...C,g])}g=x}const w=new Set(u),I=new Map,L=Ie(x=>{const b=new Set,O=[...s.dependencies[x]??[]],j=new Set;for(;O.length>0;){const C=O.pop();if(!j.has(C)){j.add(C),w.has(C)&&b.add(C);for(const v of s.dependencies[C]??[])j.has(v)||O.push(v)}}return[...b].sort()},"collectTransitive");for(const x of Object.keys(s.dependencies)){if(w.has(x))continue;const b=L(x);if(b.length===0)continue;const O={};for(const j of b){const C=h.get(j);C?.config.env&&Object.assign(O,C.config.env)}Object.keys(O).length>0&&I.set(x,O)}return{chain:u,ephemeralPidFiles:f,runDir:l?.runDir,serviceEnvByTaskId:I,skipped:c}},"injectServiceTasks"),id=new Set(["auto","ephemeral","off","persistent"]),od=Ie(t=>{const{cli:e,config:r,isCi:s,isPersistentTarget:i,isTty:o,target:n}=t;if(e!==void 0&&!id.has(e))throw new Error(`--services: expected one of auto|ephemeral|persistent|off, got "${e}"`);const c=e??r??(o&&!s?"auto":"off");return c==="off"?"off":c==="ephemeral"?"ephemeral":c==="persistent"?"registry":i||n==="dev"?"ephemeral":"registry"},"resolveServicesPolicy");var ad=Object.defineProperty,Ge=m((t,e)=>ad(t,"name",{value:e,configurable:!0}),"l$1");const Yn=Ge(t=>t.replace(/^--?/u,""),"asKebab"),cd=new Set(["0","1","false","no","true","yes"]),ld=Ge(t=>!t.startsWith("-")||/^-(?:\d|\.\d)/u.test(t),"isValueToken"),Ls=Ge((t,e,r,s,i,o)=>{if(s!==void 0)return t.set(e,s),0;const n=i[o+1];return(r?.type??"string")==="boolean"?n!==void 0&&cd.has(n.toLowerCase())?(t.set(e,n.toLowerCase()),1):(t.set(e,"true"),0):n!==void 0&&ld(n)?(t.set(e,n),1):(t.set(e,"true"),0)},"captureValue"),dd=Ge((t,e)=>{const r=t.type??"string";if(r==="number"){const s=e.trim(),i=Number(s);return s===""||!Number.isFinite(i)?{error:`--${t.name} expects a number, got "${e}"`}:{value:i}}if(r==="boolean")return["1","true","yes"].includes(e.toLowerCase())?{value:!0}:["0","false","no"].includes(e.toLowerCase())?{value:!1}:{error:`--${t.name} expects a boolean, got "${e}"`};if(r==="enum"){const s=t.choices??[];return s.includes(e)?{value:e}:{error:`--${t.name} must be one of [${s.join(", ")}], got "${e}"`}}return{value:e}},"coerce"),ud=Ge(t=>{const e=[],r=new Set;for(const s of t){const i=s.name||"<unnamed>";(!s.name||!/^[a-zA-Z][\w-]*$/u.test(s.name))&&e.push(`argument name "${i}" is empty or invalid (start with a letter; use letters, digits, '-', '_')`),r.has(s.name)&&e.push(`duplicate argument name "${i}"`),r.add(s.name),s.alias!==void 0&&s.alias.length!==1&&e.push(`argument "${i}" alias "${s.alias}" must be a single character`);const o=s.type??"string";if(o==="enum"&&(s.choices===void 0||s.choices.length===0)&&e.push(`argument "${i}" has type "enum" but declares no choices`),s.default!==void 0){const n=typeof s.default;o==="number"&&n==="number"||o==="boolean"&&n==="boolean"||(o==="string"||o==="enum")&&n==="string"?o==="enum"&&s.choices&&!s.choices.includes(s.default)&&e.push(`argument "${i}" default "${String(s.default)}" is not one of its choices`):e.push(`argument "${i}" default ${JSON.stringify(s.default)} does not match type "${o}"`)}}return e},"validateArgumentSchema"),fd=Ge((t,e)=>{const r=new Map,s=new Map;for(const h of t)r.set(h.name,h),h.alias&&s.set(h.alias,h);const i=new Map,o=[];for(let h=0;h<e.length;h+=1){const f=e[h];if(f==="--"){o.push(...e.slice(h+1));break}if(f.startsWith("--no-")){i.set(Yn(f.slice(5)),"false");continue}const p=/^--([^=]+)(?:=(.*))?$/su.exec(f);if(p){const w=p[1];h+=Ls(i,w,r.get(w),p[2],e,h);continue}const l=/^-([^=-])(?:=(.*))?$/su.exec(f),g=l?.[1];if(l&&g!==void 0){const w=s.get(g);h+=Ls(i,w?.name??g,w,l[2],e,h);continue}o.push(f)}const n={},c=[];let u=0;for(const h of t){let f=i.get(h.name);if(f===void 0&&h.positional&&u<o.length&&(f=o[u],u+=1),f===void 0){h.default!==void 0?n[h.name]=h.default:h.required&&c.push(`missing required argument --${h.name}`);continue}const{error:p,value:l}=dd(h,f);p?c.push(p):l!==void 0&&(n[h.name]=l)}return{errors:c,values:n}},"parseTaskArguments"),hd=Ge(t=>`VIS_ARG_${Yn(t).replaceAll(/[^a-zA-Z0-9]+/gu,"_").toUpperCase()}`,"taskArgumentEnvName"),pd=Ge(t=>{const e={};for(const[r,s]of Object.entries(t))e[hd(r)]=String(s);return e},"taskArgumentEnv"),Zt=Ge((t,e,r)=>{const s=[`Usage: vis run ${t} [-- <args>]`];if(e&&s.push("",e),r.length===0)return s.join(`
|
|
178
|
+
`);s.push("","Arguments:");const i=r.map(n=>{const c=n.positional?`<${n.name}>`:`--${n.name}`,u=n.alias?`, -${n.alias}`:"";return{left:`${c}${u}`,right:n}}),o=Math.max(...i.map(n=>n.left.length));for(const{left:n,right:c}of i){const u=[],h=c.type??"string";u.push(h==="enum"?`enum(${(c.choices??[]).join("|")})`:h),c.required&&u.push("required"),c.default!==void 0&&u.push(`default: ${String(c.default)}`);const f=`${c.description??""}${c.description?" ":""}[${u.join(", ")}]`;s.push(` ${n.padEnd(o)} ${f}`)}return s.join(`
|
|
179
|
+
`)},"renderTaskArgumentsHelp");var gd=Object.defineProperty,md=m((t,e)=>gd(t,"name",{value:e,configurable:!0}),"l");const vd=md((t,e,r,s)=>{if(!r||r.length===0)return{env:{},kind:"ok"};const i=ud(r);if(i.length>0)return{errors:i.map(n=>`invalid \`arguments\` schema for "${t}": ${n}`),help:Zt(t,e,r),kind:"invalid"};if(s.includes("--help")||s.includes("-h"))return{kind:"help",text:Zt(t,e,r)};const o=fd(r,s);return o.errors.length>0?{errors:o.errors,help:Zt(t,e,r),kind:"invalid"}:{env:pd(o.values),kind:"ok"}},"resolveTaskArguments");var wd=Object.defineProperty,E=m((t,e)=>wd(t,"name",{value:e,configurable:!0}),"a");const Nr="VIS_AFFECTED_FILES",yd=2e3,Ds=E(async(t,e,r,s,i,o)=>{const n=t.map(j=>{const C=j.overrides.command;if(!C)return;const v=j.overrides.visOptions,k=Bt(e,j.projectRoot,!!v?.runFromWorkspaceRoot),F=v?.envFile?or(k,v.envFile):{},P=r&&(v?.affectedFiles==="env"||v?.affectedFiles==="both")?{[Nr]:r.join(`
|
|
180
|
+
`)}:{},q=o?.get(j.id)??{},ae=wa({interactive:!!i,taskPty:j.pty,workspacePty:v?.pty});return{command:C,cwd:k,env:{INIT_CWD:s,...F,...q,...P,...j.overrides[Gr]},name:j.id,...ae?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}}).filter(j=>j!==void 0);if(n.length===0)return;if(!i){await Mt(n,{killOthers:["failure"],onEvent:E(()=>{},"onEvent")});return}const{abortSignal:c,lifeCycle:u,stdinRegistry:h,store:f}=i,p=n.map(j=>t.find(C=>C.id===j.name)).filter(Boolean),l=E(j=>n[j]?.stdin==="pty","isPtyIndex"),g=new Map,w=E(j=>{if(!l(j))return;let C=g.get(j);return C||(C=new ar(Dt),g.set(j,C)),C},"getTermBuffer");f.unmarkDone(),u.startTasks?.(p);const I=new Map,L=new Map;let x;const b=E(()=>{for(const j of L.values())try{j("SIGTERM")}catch{}x||(x=setTimeout(()=>{for(const j of L.values())try{j("SIGKILL")}catch{}L.clear()},2e3),x.unref?.())},"killAll");let O;c&&(O=E(()=>{b()},"abortListener"),c.then(()=>{O?.()}).catch(()=>{O?.()}));try{await Mt(n,{killOthers:["failure"],onEvent:E(j=>{const C=p[j.index];if(C)switch(j.kind){case"close":{const v=I.get(C.id)??Date.now(),k=j.killed||j.exitCode===0?"success":"failure";u.endTasks?.([{code:j.exitCode??0,endTime:Date.now(),startTime:v,status:k,task:C,terminalOutput:f.getSnapshot().outputs.get(C.id)??""}]),L.delete(j.index),h?.delete(C.id);break}case"error":{if(j.message){const v=w(j.index);v?(v.write(`${j.message}
|
|
181
|
+
`),f.setOutput(C.id,v.toString())):f.addOutput(C.id,`${j.message}
|
|
182
|
+
`)}break}case"started":{I.set(C.id,Date.now()),j.kill&&L.set(j.index,j.kill),j.write&&h&&h.set(C.id,{kill:j.kill,resize:j.resize,write:j.write});break}case"stderr":case"stdout":{if(j.text){const v=w(j.index);v?(v.write(j.text),f.setOutput(C.id,v.toString())):f.addOutput(C.id,`${j.text}
|
|
183
|
+
`)}break}}},"onEvent")})}finally{x&&(clearTimeout(x),x=void 0),f.markDone()}},"runPersistentTasks"),Bs=E(t=>{try{return process.kill(-t,0),!0}catch{try{return process.kill(t,0),!0}catch{return!1}}},"isPidAlive"),$d=E(t=>{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,t)},"sleepSyncMs"),xd=E(t=>{const{extraPids:e=[],pidFiles:r,runDir:s}=t,i=[],o=E(n=>{try{process.kill(-n,"SIGTERM")}catch{try{process.kill(n,"SIGTERM")}catch{}}},"sendSigterm");for(const n of r){let c;try{const u=ui(n),h=Number.parseInt(u.trim(),10);c=Number.isFinite(h)&&h>0?h:void 0}catch{continue}c!==void 0&&(i.push(c),o(c))}for(const n of e)!Number.isFinite(n)||n<=0||(i.push(n),o(n));if(i.length>0){const n=Date.now()+1500;for(;Date.now()<n;){let c=!0;for(const u of i)if(Bs(u)){c=!1;break}if(c)break;$d(100)}for(const c of i)if(Bs(c))try{process.kill(-c,"SIGKILL")}catch{try{process.kill(c,"SIGKILL")}catch{}}}s&&wi(s)},"cleanupEphemeralServices"),Dt=256*1024;class bd{static{m(this,"zn")}static{E(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...]
|
|
184
|
+
${this.#s}`:this.#s}}const Jn=E(t=>{const e=t.overrides.visOptions;if(e&&typeof e=="object")return e},"getTaskOptions"),kd=E(t=>`'${t.replaceAll("'",String.raw`'\''`)}'`,"singleQuoteEscape"),_r=E(t=>process.platform==="win32"?t.length>0&&!/[\s"&|<>^()%!]/.test(t)?t:`"${t.replaceAll('"','""')}"`:kd(t),"shellQuote"),jd=E((t,e,r)=>{if(!e||e.length===0||r===!1||r===void 0)return t;if(r==="args"||r==="both"){const s=e.map(i=>_r(i)).join(" ");return`${t} ${s}`}return t},"buildAffectedFilesArgs"),Xn="visForwardedArgs",Gr="visTaskArgEnv",Sd=E((t,e)=>{const r=e.overrides[Xn];if(!Array.isArray(r)||r.length===0)return t;const s=r.map(i=>_r(i)).join(" ");return`${t} ${s}`},"appendForwardedArgs"),Td=E(async(t,e,r)=>{if(!e)return r();const s=t.get(e)??Promise.resolve();let i;const o=new Promise(c=>{i=c}),n=s.then(()=>o);t.set(e,n),await s;try{return await r()}finally{i(),t.get(e)===n&&t.delete(e)}},"withMutex"),Cd=E(t=>{let e=Math.max(0,Math.floor(t));return{claim(r){const s=Math.max(0,Math.min(r,e));return e-=s,s},get remaining(){return e}}},"createRetryBudget"),Id=E((t,e,r)=>{const s=`${e}\0${typeof r=="string"?r:String(r)}`,i=t.get(s);if(i)return i;const o=or(e,r);return t.set(s,o),o},"loadEnvFileCached"),Ns=E(t=>{const e=new Map;return async(r,s)=>{const{affectedFiles:i,currentOs:o,hooks:n,initCwd:c,lifeCycle:u,mutexPool:h,onOutput:f,onOutputReplace:p,retryBudget:l,serviceEnvByTaskId:g,serviceEventBridge:w,stdinRegistry:I,strictEnv:L,workspaceRoot:x}=t,b=Jn(r),O=Bt(x,s.cwd??r.projectRoot,b?.runFromWorkspaceRoot===!0),j=r.overrides.command;if(!j)return{code:0,terminalOutput:`No command configured for ${r.target.project}:${r.target.target}`};const C=Sd(j,r),v=jd(C,i,b?.affectedFiles),k=yi(b,o),F=b?.shellArgs,P=F&&F.length>0?F.join(" "):"-c",q=k?`${k} ${P} ${_r(v)}`:v,ae=b?.envFile?Id(e,O,b.envFile):void 0,Q={};i&&i.length>0&&(b?.affectedFiles==="env"||b?.affectedFiles==="both")&&(Q[Nr]=i.join(`
|
|
185
|
+
`));const V=g?.get(r.id),ce={INIT_CWD:c,...ae,...V,...s.env,...Q,...r.overrides[Gr]};if(b?.strictEnv??L??!1){const J=Ta({command:v,processEnv:process.env,taskEnv:ce,taskId:r.id});if(J){const me=Ca(J);return u?.onTaskStderr?.(r,me),{code:1,terminalOutput:me}}}const Re=b?.pty===!0,ie=!!I,ge=r.pty===!0?!0:r.pty===!1?!1:ie||Re;ge&&(r.cache=!1);const Y=ge?void 0:new bd(Dt),re=ge?new ar(Dt):void 0;let de;const le=E(J=>{if(J.kind==="started"&&(de=J.kill,J.write&&I&&I.set(r.id,{kill:J.kill,resize:J.resize,write:J.write}),w?.onRegistryTaskStarted(r.id)),(J.kind==="stdout"||J.kind==="stderr")&&J.text!==void 0)if(J.kind==="stdout"?u?.onTaskStdout?.(r,J.text):u?.onTaskStderr?.(r,J.text),re)re.write(J.text),ie&&p?.(r.id,re.toString()),w&&w.onTaskOutput(r.id,J.text);else{const me=`${J.text}
|
|
186
|
+
`;Y.append(me),f?.(r.id,me)}J.kind==="close"&&(I&&I.delete(r.id),w&&w.onRegistryTaskClosed(r.id,J.exitCode??0,!!J.killed).catch(()=>{}))},"onEvent"),N=E(async()=>{const J=b?.retryCount??0,me=b?.retryDelay,Ve=l?l.claim(J):J,Ke=typeof b?.timeout=="number"&&b.timeout>0?b.timeout:0,st=typeof b?.killGracePeriodMs=="number"&&b.killGracePeriodMs>=0?b.killGracePeriodMs:5e3;let oe=!1,Ae=0;const qe=Ml({killGracePeriodMs:st,onTimeout:E(()=>{oe=!0},"onTimeout"),sendSignal:E(be=>{de?.(be)},"sendSignal"),timeoutMs:Ke});let xe;try{xe=await Mt([{command:q,cwd:O,env:ce,name:r.id,...ge?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:le,...Ve>0?{restart:{delay:me??"exponential",onRetry:E(async(be,We,ke)=>{Ae=be,n&&await n.callHook("task:retry",r,be,ke)},"onRetry"),tries:Ve}}:{}})}finally{qe.cancel()}const Ue=xe.closeEvents[0],Oe=re?re.toString():Y.toString();return oe?{code:124,retryAttempts:Ae,terminalOutput:`${Oe}
|
|
187
|
+
[timeout] Task "${r.id}" exceeded ${Ke}ms budget.
|
|
188
|
+
`}:{code:Ue?.exitCode??1,retryAttempts:Ae,terminalOutput:Oe}},"runOnce");return h?Td(h,b?.mutex,N):N()}},"createConcurrentExecutor"),Rd=E(t=>{if(!t||t.trim().length===0)return;const e=Number.parseFloat(t);return!Number.isFinite(e)||e<=0?{invalid:t}:{value:Math.floor(e)}},"parseEnvConcurrency"),Od=E(async(t,e)=>{const r=await Ai(t,{dataDirectory:Et(t)});if(!r){e.warn(`No previous run recorded yet. Run a task at least once to populate ${Li(t,{dataDirectory:Et(t)})}.`);return}const s=(r.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${r.startTime} (${s}s)`),e.info(""),e.info(` Total: ${String(r.stats.total)}`),e.info(` Succeeded: ${String(r.stats.succeeded)}`),e.info(` Cached: ${String(r.stats.cached)}`),e.info(` Failed: ${String(r.stats.failed)}`),e.info(` Skipped: ${String(r.stats.skipped)}`),e.info(""),r.stats.failed>0){const o=r.tasks.filter(n=>n.exitCode!==void 0&&n.exitCode!==0);e.info("Failed tasks:");for(const n of o){const c=n.duration??0;e.info(` × ${n.taskId} (exit ${String(n.exitCode??-1)}, ${c}ms)`)}e.info("")}const i=[...r.tasks].filter(o=>typeof o.duration=="number").sort((o,n)=>(n.duration??0)-(o.duration??0)).slice(0,5);if(i.length>0){e.info("Slowest tasks:");for(const o of i)e.info(` ${o.taskId.padEnd(40)} ${String(o.duration??0).padStart(6)}ms [${o.cacheStatus}]`);e.info("")}},"renderLastRunSummary"),Ed=E(t=>{if(!(t===void 0||t==="")){if(t!=="read"&&t!=="write"&&t!=="readwrite")throw new Error(`--cache-mode must be one of: read, write, readwrite (received "${t}")`);return t}},"parseCacheMode"),Md=E(t=>{if(!(t===void 0||t==="")){if(t!=="http"&&t!=="reapi")throw new Error(`--cache-backend must be one of: http, reapi (received "${t}")`);return t}},"parseCacheBackend"),Xd=E(async({argument:t,logger:e,options:r,runtime:s,visConfig:i,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const n=o;if($i(n),r.lastDetails===!0){await Od(n,e);return}const c=process.cwd(),u=await xi(n),{config:h,packageJsons:f,projectOptions:p,workspace:l}=bi(n,i,u),g=ki(n,l,f);let w=t[0];if(!w){const y=vs(l);if(process.stdout.isTTY&&process.stdin.isTTY){const T=await Fa(y);if(!T){e.info("No target selected.");return}w=T,await Cl(`vis run ${T}`)}else{e.info("Available targets:"),e.info(""),e.info(Pa(y)),e.info(""),e.info("Usage: vis run <target>");return}}if(h.constraints&&!r.skipConstraints){const y=Di(g,h.constraints);if(y.length>0){for(const T of y)e.error(`[${T.rule}] ${T.message}`);throw new Error(`${y.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(r.affected){const y=[w];r.parallel!==void 0&&y.push(`--parallel=${String(r.parallel)}`),r.cache||y.push("--no-cache"),r.query&&y.push(`--query=${String(r.query)}`),r.reverse&&y.push("--reverse"),typeof r.runnerTags=="string"&&r.runnerTags!==""&&y.push(`--runner-tags=${r.runnerTags}`),await s.runCommand("affected",{argv:y});return}const I=await po(w,l,process.cwd(),n),L=Ra(p),x=Oa(I.target,L);x!==I.target&&e.debug?.(`Resolved alias "${I.target}" → "${x}"`);let b=I.projects;const O=t.slice(1).map(String);if(r.projects){const y=new Set(r.projects.split(",").map(T=>T.trim()));if(b=b.filter(T=>y.has(T)),b.length===0)throw new Error(`No matching projects found for: ${String(r.projects)}`)}if(r.query&&(b=go(b,l,r.query),b.length===0)){e.info(`Query "${String(r.query)}" matched no projects.`);return}const j=ji(),C=process.env[Nr],v=C?C.split(`
|
|
189
|
+
`).filter(Boolean):void 0,k=(typeof r.runnerTags=="string"?r.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,F=k?new Set(k.split(",").map(y=>y.trim()).filter(Boolean)):void 0,P=[],q=new Map;for(const y of b){const T=p.get(y)?.[x];if(!T)continue;const R=T.options;if(!R?.internal){if(!Si(R,!!pt)){e.debug?.(`Skipping ${y}:${x} — runInCI filter`);continue}if(!Ti(R,F)){e.debug?.(`Skipping ${y}:${x} — runner-tags filter`);continue}P.push(y),q.set(y,T)}}if(P.length===0){const y=vs(l),T=Object.entries(l.projects).filter(([,R])=>R.targets?.[x]!==void 0).map(([R])=>R);if(e.error(`No projects have the "${x}" target.`),T.length>0){e.info(""),e.info(`Target "${x}" exists in these projects but was filtered out:`);for(const R of T.slice(0,5))e.info(` - ${R}`);T.length>5&&e.info(` …and ${T.length-5} more`)}else{const R=Zs(x,y,3);R.length>0&&(e.info(""),e.info(R.length===1?`Did you mean "${R[0]}"?`:`Did you mean one of: ${R.map(_=>`"${_}"`).join(", ")}?`)),e.info(""),e.info("Run `vis run` without arguments to see all available targets.")}return}const ae=r.pty===!0,Q=P.map(y=>({project:y,schema:q.get(y)?.arguments})).filter(y=>Array.isArray(y.schema)&&y.schema.length>0),V=new Map;for(const{project:y,schema:T}of Q){const R=JSON.stringify(T),_=V.get(R)??[];_.push(y),V.set(R,_)}if(V.size>1){const y=[...V.values()].map(T=>T.join(", ")).join(" | ");throw new Error(`Target "${x}" declares conflicting \`arguments\` schemas across projects (${y}). Run a single project (e.g. \`vis run ${Q[0]?.project}:${x}\` or --projects=<name>) so the argument contract is unambiguous.`)}const ce=Q[0]?.schema,Re=q.get(Q[0]?.project??P[0])?.description,ie=vd(x,Re,ce,O);if(ie.kind==="help"){e.info(ie.text);return}if(ie.kind==="invalid"){e.info(`Invalid arguments for "${x}":`);for(const y of ie.errors)e.info(` ✖ ${y}`);throw e.info(""),e.info(ie.help),new Error(`Invalid arguments for target "${x}"`)}const ge=ie.env;let Y=P.map(y=>{const T=l.projects[y],R=q.get(y),_={project:y,target:x},z=`${y}:${x}`,Z=ae?{...R.options,pty:R.options?.pty??!0}:R.options,G=R.command?os(R.command,{affectedFiles:v,projectRoot:T?.root}):R.command;return{cache:R.cache,id:z,outputs:R.outputs??[],overrides:{command:G,...O.length>0?{[Xn]:O}:{},...Object.keys(ge).length>0?{[Gr]:ge}:{},...Z?{visOptions:Z}:{}},parallelism:R.parallelism,projectRoot:T?.root,target:_}});const re=[],de=[];for(const y of Y)Jn(y)?.persistent?(y.cache=!1,re.push(y)):de.push(y);Y=de;const le=Bi(r.partition);if(le&&(Y=Ni.partitionTasks(Y,le),e.info(`Partition ${le.index}/${le.total}: running ${Y.length} task(s)`),Y.length===0)){e.info("No tasks assigned to this partition.");return}let N=_i([...Y,...re],{onCycleBroken:E(y=>{e.warn(`Ignoring dev-only dependency cycle (build order is ambiguous): ${y.join(" → ")}`)},"onCycleBroken"),projectGraph:g,targetDefaults:h.tasks,workspace:l});for(const[y,T]of Object.entries(N.tasks)){const R=T.target.project,_=T.target.target,z=p.get(R)?.[_];if(!z)continue;const Z=l.projects[R];let G=!1;const B={...T.overrides};B.visOptions===void 0&&z.options&&(B.visOptions=z.options,G=!0),B.command===void 0&&z.command&&(B.command=os(z.command,{affectedFiles:v,projectRoot:Z?.root}),G=!0),G&&(T.overrides=B,N.tasks[y]=T)}if(typeof r.skipCache=="string"&&r.skipCache.trim()!=="")if(r.cache){const y=xa(r.skipCache,l,Object.keys(N.tasks));for(const T of y.skipTaskIds){const R=N.tasks[T];R!==void 0&&(R.cache=!1)}y.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${y.unmatchedPatterns.map(T=>`"${T}"`).join(", ")}`),y.skipTaskIds.size>0&&e.debug?.(`--skip-cache: bypassing cache for ${String(y.skipTaskIds.size)} task(s)`)}else e.debug?.("--skip-cache ignored: --no-cache already disables caching for the whole run");await to(n,h.toolchain,{error:E(y=>{e.error(y)},"error"),info:E(y=>{e.info(y)},"info"),warn:E(y=>{e.warn(y)},"warn")},!!r.skipToolchain);const J=r.preflight!==!1&&h.preflight?.lockfile!==!1,me=Vi(n,pt,{warn:E(y=>{e.warn(y)},"warn")},{skip:!J});if(!me.shouldContinue)throw new Error(`${me.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);J&&!pt&&process.stdin.isTTY&&process.stdout.isTTY&&await ga(n,{interactive:!0,logger:{info:E(y=>{e.info(y)},"info"),warn:E(y=>{e.warn(y)},"warn")},projectManifests:[...f.values()]});const Ve=process.env.VIS_VERSION??"0.0.0",Ke=r.dryRun?void 0:async y=>{try{return await fo(y.config,{timeoutMs:yd}),!0}catch{return!1}},st=await oo(n),oe=await Ul({initialTasks:[...Y,...re],probe:Ke,registeredEntries:st,taskGraph:N,visVersion:Ve}),Ae=[];let qe,xe=0;const Ue=[],Oe=new Map;let be=[];const We=new Set;let ke=null,we=null;if(oe.diagnostics.length>0){const y=!!(process.stdout.isTTY&&process.stdin.isTTY),T=r.dryRun?"off":od({cli:r.services,config:h.run?.services,isCi:!!pt,isPersistentTarget:re.length>0,isTty:y,target:x});if(T==="off"){for(const B of oe.diagnostics)e.error(B.message);throw new Error(`${oe.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`)}const R=oe.diagnostics.map(B=>B.targetId),_=T,z=_==="registry"?Vn(n,R,N):void 0,Z=process.argv[1]??"vis",G=nd({missingServiceIds:R,mode:_,taskGraph:N,visBin:Z,workspaceRoot:n});if(G.skipped.length>0){for(const{id:B,reason:ue}of G.skipped)e.error(`Cannot auto-start ${B}: ${ue}`);throw new Error(`${G.skipped.length} service(s) cannot be auto-started — invoke them directly or add a service config.`)}Ae.push(...G.ephemeralPidFiles),qe=G.runDir,be=G.chain;for(const B of G.chain)We.add(B);if(_==="registry"&&(xe=G.chain.length,Ue.push(...G.chain)),G.chain.length>0){const B=new ws(G.chain),ue=new Map;if(_==="ephemeral"&&G.runDir)for(const D of G.chain){const H=Kn(G.runDir,`${G.runDir}/bootstrap.mjs`,D);ue.set(D,{ephemeral:{configFile:H.configFile,cwd:n,logFile:H.logFile,pidFile:H.pidFile,scriptPath:H.scriptPath},mode:"ephemeral"})}else if(_==="registry"&&z)for(const D of z.services)ue.set(D.id,{mode:"registry",registry:{command:D.command,config:D.config,cwd:D.cwd,env:D.env}});if(ue.size>0){const D=new Kl({indexToId:new Map,services:ue,sink:{crashed:E((H,U)=>{B.markCrashed(H,U)},"crashed"),failed:E((H,U,se)=>{B.markFailed(H,U,se)},"failed"),log:E((H,U)=>{B.appendLog(H,U)},"log"),ready:E((H,U)=>{B.markReady(H,U)},"ready"),started:E((H,U)=>{B.markStarted(H,U),_==="registry"&&U!==null&&Oe.set(H,U)},"started"),starting:E(H=>{B.markStarting(H)},"starting")},workspaceRoot:n});ke=B,we=D}}for(const[B,ue]of G.serviceEnvByTaskId){const D=oe.serviceEnvByTaskId.get(B)??{};oe.serviceEnvByTaskId.set(B,{...D,...ue})}}const M=new Set(re.map(y=>y.id));if(Y=oe.initialTasks.filter(y=>!M.has(y.id)),N=oe.taskGraph,be.length>0&&(Y=[...be.map(y=>N.tasks[y]).filter(y=>y!==void 0),...Y]),re.length>0){const y=new Set(re.map(Z=>Z.id)),T={};for(const[Z,G]of Object.entries(N.tasks))y.has(Z)||(T[Z]=G);const R={};for(const[Z,G]of Object.entries(N.dependencies))y.has(Z)||(R[Z]=G.filter(B=>!y.has(B)));const _=new Set;for(const Z of Object.values(R))for(const G of Z)_.add(G);const z=Object.keys(T).filter(Z=>!_.has(Z));N={dependencies:R,roots:z,tasks:T}}const{serviceEnvByTaskId:S}=oe;if(oe.satisfiedServices.length>0){const y=oe.satisfiedServices.map(T=>T.id).join(", ");if(e.debug?.(`Auto-attached to running services: ${y}`),ke)for(const T of oe.satisfiedServices)ke.registerService(T.id);else ke=new ws(oe.satisfiedServices.map(T=>T.id));for(const T of oe.satisfiedServices){const R=T.config.readiness?.tcp?.port??T.config.port??0,_=T.config.readiness?.tcp?.host??"127.0.0.1";ke.markReady(T.id,{host:_,port:R})}}if(r.reverse&&(N=Gi(N),e.debug?.(`Reversed task graph: ${String(N.roots.length)} new root(s) (originally leaves)`)),r.dryRun){const y=Object.keys(N.tasks).length,T=N.roots.length;e.info(`Execution plan (${String(y)} task(s), ${String(T)} root(s)):`),e.info("");const R=new Set,_=E((z,Z)=>{if(R.has(z))return;R.add(z);for(const ue of N.dependencies[z]??[])_(ue,Z+1);const G=N.tasks[z],B=" ".repeat(Z+1);e.info(`${B}${z}${G?.cache===!1?" (no-cache)":""}`)},"walkPlan");for(const z of N.roots)_(z,0);for(const z of Object.keys(N.tasks))_(z,0);re.length>0&&(e.info(""),e.info(` + ${String(re.length)} persistent task(s) (run after graph completes)`)),e.info("");return}const A=Date.now(),X=ao(),Ye=E((y,T)=>{const R=T instanceof Error?T.message:String(T);e.warn(`Plugin error in ${y}: ${R}`)},"onHookError");await co(X,h.plugins);const dt=typeof r.profile=="string"?r.profile:void 0,qr=E(async y=>{if(!dt)return;const T=as(y,N,A),R=dt.startsWith("/")?dt:`${n}/${dt}`;await qi(T,R),e.info(`Profile written to ${dt}`)},"maybeWriteProfile"),jt=h.taskRunner??{},Qn=Ci(n,r.cacheDir,jt.cacheDirectory,h.sharedWorktreeCache),Zn=Ii(Qn,n,h.branchScopedCache),nt=Rd(process.env.VIS_RUN_CONCURRENCY_LIMIT);nt&&"invalid"in nt&&e.warn(`VIS_RUN_CONCURRENCY_LIMIT=${nt.invalid} is not a positive number; falling back to default concurrency.`);const ei=nt&&"value"in nt?nt.value:void 0,ti=r.parallel??ei??3,Ur=r.strictEnv??h.strictEnv??!1,Je={dryRun:r.dryRun??!1,parallel:ti,skipNxCache:!r.cache,summarize:r.summarize??!1,...jt,cacheDirectory:Zn,dataDirectory:jt.dataDirectory??Et(n),onFingerprint:E(async(y,T)=>{await X.callHook("task:fingerprint",y,T)},"onFingerprint")},Wr=Ui(jt.remoteCache);if(Wr){const y=Ed(r.cacheMode),T=Md(r.cacheBackend);if(Je.remoteCache={...Wr,...y?{mode:y}:{},...T?{backend:T}:{}},Je.remoteCache.attestation){const{expectedIdentity:R,requireOnDownload:_}=Je.remoteCache.attestation;if(!(R!==void 0&&("github"in R&&typeof R.github?.ref=="string"&&typeof R.github.repo=="string"&&typeof R.github.workflow=="string"||"oidcIssuer"in R&&typeof R.oidcIssuer=="string"&&(typeof R.san=="string"||typeof R.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 R&&(!R.sanRegex.startsWith("^")||!R.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:z,isSigstoreInstalled:Z}=await import("./loader.js");Z()||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:
|
|
190
|
+
${z(n)}`);const{buildCacheAttestationHooks:G}=await import("./cache-attestation.js");Je.remoteCache.attestation=G({expectedIdentity:R,onReject:E((B,ue)=>{e.warn(`[vis run] remote cache entry ${B.slice(0,12)} rejected: attestation ${ue}. Treating as a cache miss.`)},"onReject"),onVerifyFailure:E(B=>{e.warn(`[vis run] attestation verification failed: ${B}`)},"onVerifyFailure"),requireOnDownload:_,workspaceRoot:n})}}else(r.cacheMode||r.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts (or TURBO_API env); ignoring.");const ri=process.stdout.isTTY&&!pt,si=h.tui?.autoExit??!1,Hr={args:{parallel:Je.parallel,targets:[x]},autoExit:si,projectNames:P,tasks:[...Y,...re]},zr=typeof r.retryBudget=="number"?r.retryBudget:void 0,Vr=zr===void 0?void 0:Cd(zr),Kr=new lo(X,Ye),Yr=new eo(n),Jr=kl(typeof r.outputStyle=="string"?r.outputStyle.toLowerCase():void 0);if(oe.satisfiedServices.length>0)for(const y of oe.satisfiedServices){const T=oe.serviceDependentsByServiceId.get(y.id)??[];try{await X.callHook("service:attach",y,T)}catch(R){Ye("service:attach",R)}}await X.callHook("run:before",{tasks:Y,workspaceRoot:n});const ut=r.stopServices===!0;let Xr=!1;const Qr=E(()=>{if(Xr)return;Xr=!0,we&&we.dispose().catch(()=>{});const y=ut?[...Oe.values()]:void 0;xd({extraPids:y,pidFiles:Ae,runDir:qe})},"runCleanupOnce"),St=E(()=>{Qr()},"onCleanupSignal"),Zr=Ae.length>0||qe!==void 0||ut&&Ue.length>0;Zr&&(process.on("SIGINT",St),process.on("SIGTERM",St));try{if(ri){const y=new Map,T=xl({...Hr,onRetryService:we?D=>we.retry(D):void 0,outputStyle:Jr,serviceDockStore:ke,stdinRegistry:y}),{lifeCycle:R,store:_}=T,z=new cs([R,Kr,Yr]),Z=Ns({affectedFiles:v,currentOs:j,hooks:X,initCwd:c,lifeCycle:z,mutexPool:new Map,onOutput:E((D,H)=>{we&&We.has(D)?we.onTaskOutput(D,H):_.addOutput(D,H)},"onOutput"),onOutputReplace:E((D,H)=>{_.setOutput(D,H)},"onOutputReplace"),retryBudget:Vr,serviceEnvByTaskId:S,serviceEventBridge:we??void 0,stdinRegistry:y,strictEnv:Ur,workspaceRoot:n});let G="rerun",B=null,ue=new Map;for(;G!=="quit";){if(G==="rerun"){if(ue=await ls(Y,Je,{lifeCycle:z,projectGraph:g,taskExecutor:Z,taskGraph:N,workspaceRoot:n}),re.length>0&&!r.failFast){const D=new Promise(H=>{const U=_.subscribe(()=>{const se=_.getSnapshot();(se.rerunRequested||se.retryTaskId)&&(U(),H())});T.renderIsDone.then(()=>{U(),H()}).catch(()=>{U(),H()})});await Ds(re,n,v,c,{abortSignal:D,lifeCycle:z,stdinRegistry:y,store:_},S)}}else if(G==="retry"&&B){const D=Y.find(U=>U.id===B),H=D?.overrides.command;if(D&&H){const U=Bt(n,D.projectRoot,!1);z.startTasks?.([D]);const se=new ar(Dt),ye=(await Mt([{command:H,cwd:U,name:D.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:E(fe=>{fe.kind==="started"&&fe.write&&y.set(D.id,{kill:fe.kill,resize:fe.resize,write:fe.write}),(fe.kind==="stdout"||fe.kind==="stderr")&&fe.text&&(se.write(fe.text),_.setOutput(D.id,se.toString())),fe.kind==="close"&&y.delete(D.id)},"onEvent")})).closeEvents[0];z.endTasks?.([{code:ye?.exitCode??1,status:ye?.exitCode===0?"success":"failure",task:D,terminalOutput:_.getSnapshot().outputs.get(D.id)}])}else D&&z.endTasks?.([{code:1,status:"failure",task:D,terminalOutput:`No command configured for ${D.id}`}]);B=null,_.markDone()}G=await new Promise(D=>{const H=_.subscribe(()=>{const U=_.getSnapshot();U.rerunRequested&&(_.acknowledgeRerun(),H(),D("rerun")),U.retryTaskId&&(B=_.acknowledgeRetry(),H(),D("retry"))});T.renderIsDone.then(()=>{H(),D("quit")}).catch(()=>{H(),D("quit")})})}await T.renderIsDone,await X.callHook("run:after",ue),await qr(ue),xe>0&&(e.info(""),ut?e.info(`${String(xe)} service(s) stopped (--stop-services).`):e.info(`${String(xe)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}else{const y=new Map,T=typeof r.log=="string"?r.log.toLowerCase():"",R=T==="labeled"||T==="grouped"||T==="interleaved"?T:void 0,_=R?Wi(R):void 0,z=new cs([new Sl({...Hr,ciGrouping:i?.run?.ciGrouping??"auto",logReporter:_,outputStyle:Jr}),Kr,Yr]),Z=Ns({affectedFiles:v,currentOs:j,hooks:X,initCwd:c,lifeCycle:z,mutexPool:y,retryBudget:Vr,serviceEnvByTaskId:S,serviceEventBridge:we??void 0,strictEnv:Ur,workspaceRoot:n}),G=E(async()=>{const U=Date.now(),se=await ls(Y,Je,{lifeCycle:z,projectGraph:g,taskExecutor:Z,taskGraph:N,workspaceRoot:n}),ye=Date.now()-U;if(r.summarize){const Ce=as(se,N,A);await Hi(Ce,n,{dataDirectory:Et(n)})}let fe=!1;for(const[,Ce]of se)Ce.status==="failure"&&(fe=!0);const Te=Ri(se,ye),Ee=Oi(n),He=Ei(n,ye,Ee);return e.info(""),e.info(` ${Te}${He?` ${He}`:""}`),{hasFailure:fe,results:se,runHistory:Ee}},"runOnce"),B=await G();await X.callHook("run:after",B.results),await qr(B.results);const{hasFailure:ue}=B;if(r.watch){const U=P.map(ve=>{const je=l.projects[ve]?.root;if(je)return je.startsWith("/")?je:`${n}/${je}`}).filter(ve=>ve!==void 0),se=Y;let ye;const fe=E(ve=>{const je=Al(se,ve);return ye=je.filter,Y=je.tasks,je.tasks.length},"applyFilter");let Te=!1,Ee=B.results;const He=E(()=>{const ve=hs(Ee,n);if(ve.directories.length>0&&ve.files.size>0){const je=To(ve.files,n,ve.directories);return{handle:ps({filter:je,onChange:Tt,paths:ve.directories}),mode:"tracked"}}return{handle:ps({onChange:Tt,paths:U}),mode:"roots"}},"buildHandle");let Ce;const Tt=E(async ve=>{if(!Te){Te=!0;try{e.info(`Change detected in ${ve.length} file(s), rerunning…`),Ee=(await G()).results,Ce?.close(),Ce=He().handle}finally{Te=!1}}},"onChangeHandler"),es=He();Ce=es.handle;const ni=es.mode==="tracked"?`Watching ${String(hs(Ee,n).files.size)} tracked file(s)`:`Watching ${String(U.length)} project root(s)`;e.info(`${ni} — edit a file to rerun, press h for keybinds, q to quit.`);const zt=E(async()=>{if(!Te){Te=!0;try{if(Y.length===0){e.info("No tasks match the active filter — press a to clear it.");return}Ee=(await G()).results,Ce?.close(),Ce=He().handle}finally{Te=!1}}},"triggerRerun");await new Promise(ve=>{let je=!1,ts;const rs=E(()=>{ss()},"onSigint"),ss=E(()=>{je||(je=!0,ts?.close(),process.off("SIGINT",rs),Ce?.close(),ve())},"exit");process.on("SIGINT",rs),ts=_l({handlers:{onClearFilter:E(async()=>{const ft=fe(void 0);e.info(`Filter cleared — running ${String(ft)} task(s).`),await zt()},"onClearFilter"),onFilter:E(async ft=>{const ii=ye,ns=fe(ft);if(ns===0){e.info(`Filter "${ft}" matched no projects — keeping previous filter.`),fe(ii);return}e.info(`Filter "${ft}" matched ${String(ns)} task(s).`),await zt()},"onFilter"),onHelp:E(()=>{Bl(process.stdout)},"onHelp"),onQuit:E(()=>{ss()},"onQuit"),onRerun:zt}})});return}if(r.flaky!==!1){const U=Mi(n,{minRuns:2},B.runHistory);if(U.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const se of Pi(U))e.info(` ${se}`);e.info("")}}const D=[];for(const[U,se]of B.results)se.retryAttempts&&se.retryAttempts>0&&D.push(U);const H=r.failOnRetry===!0&&D.length>0;if(H){const U=D.slice(0,5),se=D.length-U.length,ye=se>0?`${U.join(", ")}, and ${String(se)} more`:U.join(", ");e.warn(""),e.warn(`--fail-on-retry: ${String(D.length)} task(s) succeeded only after retry: ${ye}`)}if(ue||H){const U=H&&!ue?"Some tasks succeeded only after retry (--fail-on-retry).":"Some tasks failed.",se=2e3,ye=[];for(const[fe,Te]of B.results){if(Te.status!=="failure")continue;const Ee=Te.terminalOutput??"",He=Ee.length>se?`…${Ee.slice(-se)}`:Ee,Ce=Te.code??"?";ye.push(` ${fe} (exit ${String(Ce)}):
|
|
191
|
+
${He.split(`
|
|
192
|
+
`).map(Tt=>` ${Tt}`).join(`
|
|
193
|
+
`)}`)}throw new Error(ye.length>0?`${U}
|
|
194
|
+
${ye.join(`
|
|
195
|
+
`)}`:U)}re.length>0&&!r.failFast&&await Ds(re,n,v,c,void 0,S),xe>0&&(e.info(""),ut?e.info(`${String(xe)} service(s) stopped (--stop-services).`):e.info(`${String(xe)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}}finally{Qr(),Zr&&(process.off("SIGINT",St),process.off("SIGTERM",St)),ut&&Ue.length>0&&await Promise.all(Ue.map(async y=>{try{await uo(n,y)}catch{}}))}},"execute");export{Cd as createRetryBudget,Xd as default};
|