@visulima/vis 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/LICENSE.md +89 -152
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/CONFIG_FILES.js +4 -4
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +52 -61
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +150 -152
- package/dist/packem_chunks/dart-plan.js +1 -1
- package/dist/packem_chunks/dart-projects.js +1 -1
- package/dist/packem_chunks/dispatch.js +1 -1
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +4 -4
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +4 -4
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +2 -2
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler26.js +4 -4
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +2 -2
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler58.js +1 -1
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler60.js +7 -7
- package/dist/packem_chunks/handler61.js +3 -3
- package/dist/packem_chunks/handler62.js +2 -2
- package/dist/packem_chunks/handler63.js +1 -1
- package/dist/packem_chunks/handler64.js +2 -2
- package/dist/packem_chunks/handler65.js +4 -4
- package/dist/packem_chunks/handler66.js +1 -1
- package/dist/packem_chunks/handler67.js +20 -31
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +6 -6
- package/dist/packem_chunks/handler71.js +26 -46
- package/dist/packem_chunks/handler72.js +1 -1
- package/dist/packem_chunks/handler73.js +1 -1
- package/dist/packem_chunks/handler74.js +1 -1
- package/dist/packem_chunks/handler75.js +17 -17
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +2 -2
- package/dist/packem_chunks/handler78.js +31 -31
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +7 -40
- package/dist/packem_chunks/index2.js +11 -11
- package/dist/packem_chunks/index6.js +1 -1
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/orchestrator.js +1 -1
- package/dist/packem_chunks/prompts.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +5 -5
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/Table-Bo1JKNCN-CGGet8ES.js +34 -0
- package/dist/packem_shared/{affected-selection-DDxwjwM4.js → affected-selection-DGb6Xu5K.js} +1 -1
- package/dist/packem_shared/{affected-shas-BuaWvmsG.js → affected-shas-B_kfSKss.js} +1 -1
- package/dist/packem_shared/{ai-fix-C2BhFFhi.js → ai-fix-D9MxigBQ.js} +5 -5
- package/dist/packem_shared/{augment-CxUPE8KX.js → augment-B9kSZuvW.js} +1 -1
- package/dist/packem_shared/{bin-Be7_QhQK.js → bin-AZQv95jh.js} +1 -1
- package/dist/packem_shared/{build-scripts-DxyVSkgM.js → build-scripts-CEDx_nJp.js} +1 -1
- package/dist/packem_shared/{command-runtime-BXvH5EC0.js → command-runtime-HSsYGCQd.js} +1 -1
- package/dist/packem_shared/{dart-pubspec-DvmyleIr.js → dart-pubspec-BK_cK2EP.js} +2 -2
- package/dist/packem_shared/dependency-scan-CawAKoU_.js +1 -0
- package/dist/packem_shared/detect-CbMRSXkM.js +1 -0
- package/dist/packem_shared/{docker-BTuwdXaC.js → docker-DXqV-07f.js} +1 -1
- package/dist/packem_shared/{ecosystem-gate-BpQNUJzN.js → ecosystem-gate-DiqQj0LJ.js} +1 -1
- package/dist/packem_shared/env-consistency-B4rU4MQb.js +1 -0
- package/dist/packem_shared/{failure-log-kp0n2rbD.js → failure-log-BP-gCUb5.js} +1 -1
- package/dist/packem_shared/{formatBytes-BHAzNIrn-DRcKvqnb.js → formatBytes-_HvjOy8a-B_qQr4Hw.js} +3 -3
- package/dist/packem_shared/{getRandomSpinner-4ZEcbTYv-DCyIuj19.js → getRandomSpinner-DX11qCB2-CoIsn7ZU.js} +1 -1
- package/dist/packem_shared/index-BisalDCf.js +39 -0
- package/dist/packem_shared/{index-BdMIfGVZ.js → index-BzhrR_iC.js} +15 -15
- package/dist/packem_shared/{index-DQfNpt2u.js → index-CDHP1kby.js} +1 -1
- package/dist/packem_shared/{index-DsSWb5XH.js → index-JRb5wabN.js} +1 -1
- package/dist/packem_shared/index.server-Ca_EEVfw.js +2 -0
- package/dist/packem_shared/{isAccessibleSync-DYKTrrvc-BwaMhQs0.js → isAccessibleSync-DYKTrrvc-C-_5cgwu.js} +1 -1
- package/dist/packem_shared/{lifecycle-BAhkhE2L.js → lifecycle-DvmDIRbb.js} +1 -1
- package/dist/packem_shared/{lockfile-DHmlPGk1.js → lockfile-CiUtEbnt.js} +1 -1
- package/dist/packem_shared/{manifests-Dd4Hoztt.js → manifests-Du4yKlf_.js} +1 -1
- package/dist/packem_shared/{min-release-age-BJnOQaoF.js → min-release-age-JViyQuBM.js} +1 -1
- package/dist/packem_shared/{missing-package-json-DfzrGwe1.js → missing-package-json-Cu5YVAot.js} +1 -1
- package/dist/packem_shared/{multi-eco-lockfiles-BIa6xvJc.js → multi-eco-lockfiles-B2X3yhyo.js} +1 -1
- package/dist/packem_shared/{native-config-sync-Dr9XvxOf.js → native-config-sync-TdTWjVgI.js} +1 -1
- package/dist/packem_shared/osv-bloom-BCAX5ARR.js +2 -0
- package/dist/packem_shared/package-version-KLwH0Ivy.js +4 -0
- package/dist/packem_shared/{packument-C9nRiBJf.js → packument-zb18Jnlw.js} +1 -1
- package/dist/packem_shared/{pm-runner-ImwtpnWY.js → pm-runner-RM72mDZg.js} +1 -1
- package/dist/packem_shared/{project-name-filter-C2rkW-Vn.js → project-name-filter-B1ZCsbOW.js} +1 -1
- package/dist/packem_shared/{provenance-DF-ypZj3.js → provenance-L1M2FPy_.js} +1 -1
- package/dist/packem_shared/{readJsonSync-CbryXYxN-Bm5i10UW.js → readJsonSync-CbryXYxN-EWl7_7KX.js} +1 -1
- package/dist/packem_shared/{registry-keys-BLuHOyZu.js → registry-keys-DxdqMzyp.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-BDaQRR6o.js → resolve-explicit-CQa37JSq.js} +1 -1
- package/dist/packem_shared/{resolve-runtime-Cr19Pk6L.js → resolve-runtime-DNukUjIr.js} +1 -1
- package/dist/packem_shared/{run-file-XbRCF6Mp.js → run-file-UBukWaha.js} +1 -1
- package/dist/packem_shared/runtime-check-D3cRDuoi.js +1 -0
- package/dist/packem_shared/{s1ngularity-UCZN7skW.js → s1ngularity-CO5GkkqX.js} +1 -1
- package/dist/packem_shared/scaffold-files-DVyfB0yz.js +28 -0
- package/dist/packem_shared/{scan-progress-DcYI76zE.js → scan-progress-RwCRxJdX.js} +1 -1
- package/dist/packem_shared/{selectors-DCiEU0iv.js → selectors-edwcgNl3.js} +2 -2
- package/dist/packem_shared/{signatures-CicxPHN4.js → signatures-DIqFUOfs.js} +1 -1
- package/dist/packem_shared/spinner-BJjbNl1F.js +1 -0
- package/dist/packem_shared/target-merge-DVJl-7Qz.js +4 -0
- package/dist/packem_shared/{target-options-PgWIuJnb.js → target-options-DsHFmRZH.js} +1 -1
- package/dist/packem_shared/{task-env-Dl08aklA.js → task-env-DzR4RkOj.js} +1 -1
- package/dist/packem_shared/toolchain-CP79HNVy.js +5 -0
- package/dist/packem_shared/{typosquats-DxPzyK7u.js → typosquats-D4DEHhFy.js} +1 -1
- package/dist/packem_shared/{verify-CadR9PUk.js → verify-B_MblU_Q.js} +1 -1
- package/dist/packem_shared/{vis-update-app-DrFWQyPn.js → vis-update-app-9b2kSk9f.js} +1 -1
- package/dist/packem_shared/{vis-user-error-k7CLTpA4.js → vis-user-error-CRmrBaD1.js} +15 -15
- package/dist/packem_shared/{watch-Dr_6yz3o.js → watch-CcTketln.js} +1 -1
- package/dist/packem_shared/watch-loop-D1_e-qIl.js +11 -0
- package/dist/packem_shared/{writeFileSync-DJoHk3Ks-Dhem3Uof.js → writeFileSync-DJoHk3Ks-BPRoepNw.js} +1 -1
- package/dist/runtime/preload.js +1 -1
- package/index.js +26 -26
- package/package.json +12 -12
- package/dist/packem_shared/dependency-scan-DKK3ZEZI.js +0 -1
- package/dist/packem_shared/env-consistency-CUBJHENL.js +0 -1
- package/dist/packem_shared/index-C9ENZqH9.js +0 -39
- package/dist/packem_shared/index.server-D8BLnYZO.js +0 -2
- package/dist/packem_shared/osv-bloom-t40ra5U5.js +0 -2
- package/dist/packem_shared/package-version-CFuNUWDG.js +0 -4
- package/dist/packem_shared/runtime-check-Bh5q9IrT.js +0 -1
- package/dist/packem_shared/spinner-ukDEdGvp.js +0 -1
- package/dist/packem_shared/target-merge-BClIXg2k.js +0 -14
- package/dist/packem_shared/toolchain-DvUxlbDz.js +0 -5
- package/dist/packem_shared/watch-loop-BId9vT7Q.js +0 -11
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import{createRequire as hr}from"node:module";import{e as le,$ as Rs,m as gr,b as wr,a as vr}from"../packem_shared/index-BdMIfGVZ.js";import{expandAffected as yr,getChangedFiles as xr,buildEnhancedPath as jr,enforceProjectConstraints as kr,expandTokensInString as Zt,parsePartition as br,TaskScheduler as Sr,createTaskGraph as Tr,reverseTaskGraph as $r,splitCompoundTasks as Cr,resolveTurboEnvCompat as Ir,CompositeLifeCycle as es,defaultTaskRunner as ts,TerminalBuffer as Tt,runConcurrently as it,createLogReporter as Er,generateRunSummary as ss,writeRunSummary as Rr,readLastRunSummary as Pr,getLastRunSummaryPath as Mr,pickChildParentEnv as Fr,writeChromeTrace as Or}from"@visulima/task-runner";import{i as Ke}from"../packem_shared/index-BjdW45xX.js";import{U as Ps,W as Ar,T as Lr,C as rs,X as Dr,Y as Br,q as _r,Z as Nr,ap as Gr,aq as qr,ar as Hr,as as Wr,j as Ur,at as Vr}from"./cli-main.js";import{x as K,F as n,X as w,o as l,O as me,R as Q,C as zr,d as Yr,b as Kr,a4 as Xr}from"./catalog.js";import{V as Fe}from"../packem_shared/vis-user-error-k7CLTpA4.js";import{d as Jr,r as Qr}from"../packem_shared/lockfile-DHmlPGk1.js";import{x as Ms}from"../packem_shared/index-C9ENZqH9.js";import{F as cn}from"../packem_shared/failure-log-kp0n2rbD.js";import{r as an}from"../packem_shared/command-runtime-BXvH5EC0.js";import{r as ln}from"../packem_shared/toolchain-DvUxlbDz.js";import{i as dn,r as un,s as fn,a as hn,b as pn,c as mn,d as gn,e as wn,H as vn,f as yn}from"../packem_shared/lifecycle-BAhkhE2L.js";import{s as xn}from"../packem_shared/affected-selection-DDxwjwM4.js";import{c as is,p as jn,a as kn,b as bn,r as Sn,f as Tn,s as $n}from"../packem_shared/project-name-filter-C2rkW-Vn.js";import{p as Cn,r as In,f as En,a as Rn}from"../packem_shared/selectors-DCiEU0iv.js";import{r as Ct,l as Pn,d as Fs,s as Mn,m as Fn,a as Os}from"../packem_shared/target-options-PgWIuJnb.js";import{T as As,C as Ls,D as ft,E as Ds}from"../packem_shared/symbols-BXDZ_sKt.js";import{q as Bn,j as _n,X as wt,F as cs}from"../packem_shared/index.server-D8BLnYZO.js";import{parseStacktrace as Nn,codeFrame as Gn}from"@visulima/error";import{originalPositionFor as qn,sourceContentFor as Hn,loadSourceMap as Wn}from"@visulima/source-map";import{l as Bs}from"../packem_shared/spinner-ukDEdGvp.js";import{Q as Kn,c as ot}from"../packem_shared/formatBytes-BHAzNIrn-DRcKvqnb.js";import{c as as,a as Xn,s as ls}from"../packem_shared/watch-Dr_6yz3o.js";import xt from"./index.js";import{U as _s}from"../packem_shared/writeFileSync-DJoHk3Ks-Dhem3Uof.js";import{A as Qn,T as Zn,g as Je,b as ei,r as Qe,d as ti,e as si}from"../packem_shared/task-env-Dl08aklA.js";let pr;const mr=s=>(pr??=hr(import.meta.url))(s),Ye=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pe=s=>{if(typeof Ye<"u"&&Ye.versions&&Ye.versions.node){const[e,t]=Ye.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return Ye.getBuiltinModule(s)}return mr(s)},{existsSync:Oe,mkdirSync:Zr,writeFileSync:$t,readFileSync:Ne,openSync:en,statSync:ns,readSync:tn,closeSync:sn,mkdtempSync:rn}=Pe("node:fs"),{createInterface:nn,emitKeypressEvents:on}=Pe("node:readline"),{isAbsolute:On,resolve:os,dirname:An,relative:Ln}=Pe("node:path"),{fileURLToPath:Dn}=Pe("node:url"),{createHash:Un}=Pe("node:crypto"),{mkdir:Vn,appendFile:ht}=Pe("node:fs/promises"),{platform:zn,homedir:It,tmpdir:Yn}=Pe("node:os"),{spawn:Jn}=Pe("node:child_process"),ri=27,ni={95:"apc",80:"dcs",94:"pm",88:"sos"},ii={159:"apc",144:"dcs",158:"pm",152:"sos"},Ns=s=>s===155||s===157||s===144||s===152||s===158||s===159,Gs=(s,e)=>{for(let t=e;t<s.length;t+=1){const r=s.codePointAt(t);if(r>=64&&r<=126)return t}return-1},ct=(s,e,t)=>{for(let r=e;r<s.length;r+=1){const c=s.codePointAt(r);if(c===156||t&&c===7)return r;if(c===27&&s.codePointAt(r+1)===92)return r+1}return-1},oi=(s,e)=>{const t=s.codePointAt(e+1);if(t===91){const r=Gs(s,e+2);return r===-1?void 0:{end:r,kind:"csi"}}if(t===93){const r=ct(s,e+2,!0);return r===-1?void 0:{end:r,kind:"osc"}}if(t===80||t===88||t===94||t===95){const r=ct(s,e+2,!1),c=ni[t];return r===-1?void 0:{end:r,kind:c}}return t===void 0?void 0:{end:e+1,kind:"escape"}},ci=(s,e)=>{const t=s.codePointAt(e);if(t===155){const r=Gs(s,e+1);return r===-1?void 0:{end:r,kind:"csi"}}if(t===157){const r=ct(s,e+1,!0);return r===-1?void 0:{end:r,kind:"osc"}}if(t===144||t===152||t===158||t===159){const r=ct(s,e+1,!1),c=ii[t];return r===-1?void 0:{end:r,kind:c}}},ai=s=>{if(s.includes(String.fromCodePoint(27)))return!0;for(let e=0;e<s.length;e+=1)if(Ns(s.codePointAt(e)))return!0;return!1},li=s=>{if(!ai(s))return s;let e="",t=0,r=0;const{length:c}=s;for(;r<c;){const o=s.codePointAt(r);let i;if(o===ri)i=oi(s,r);else if(Ns(o))i=ci(s,r);else{r+=1;continue}const d=i===void 0?c-1:i.end;e+=s.slice(t,r),t=d+1,r=d+1}return e+=s.slice(t),e},di=(s,e,t,r,c,o,i,d,u,p,f,m,a,k)=>{const S={d:r,h:c,m:o,mo:e,ms:d,s:i,w:t,y:s};return S.future=u,S.past=p,S.decimal=f,m!==void 0&&(S.unitMap=m),S.groupSeparator=a,S.placeholderSeparator=k,S},ui={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"},fi=di(s=>`year${s===1?"":"s"}`,s=>`month${s===1?"":"s"}`,s=>`week${s===1?"":"s"}`,s=>`day${s===1?"":"s"}`,s=>`hour${s===1?"":"s"}`,s=>`minute${s===1?"":"s"}`,s=>`second${s===1?"":"s"}`,s=>`millisecond${s===1?"":"s"}`,"in %s","%s ago",".",ui,",","_"),ds=new WeakSet,hi=s=>{if(ds.has(s))return;const e=["y","mo","w","d","h","m","s","ms"];for(const r of e)if(!Object.hasOwn(s,r))throw new TypeError(`Missing required property: ${r}`);if(s.future!==void 0&&typeof s.future!="string")throw new TypeError("Properties future and past must be of type string");if(s.past!==void 0&&typeof s.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const r of t)if(typeof s[r]!="string"&&typeof s[r]!="function")throw new TypeError(`Property ${r} must be of type string or function`);if(s.decimal&&typeof s.decimal!="string")throw new TypeError("Property decimal must be of type string");if(s.delimiter&&typeof s.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(s._digitReplacements&&!Array.isArray(s._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(s._numberFirst&&typeof s._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(s.unitMap&&typeof s.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(s.unitMap&&Object.values(s.unitMap).some(r=>typeof r!="string"))throw new TypeError("All values in unitMap must be of type string");ds.add(s)},qs=(s,e)=>{if(!Number.isFinite(s)||e<0||Number.isInteger(s))return s;const t=10**e,r=Number((s*t).toPrecision(15));return Math.trunc(r)/t},us=({unitCount:s,unitName:e},t,r)=>{let{spacer:c}=r;const{maxDecimalPoints:o}=r;let i=".";r.decimal!==void 0?i=r.decimal:t.decimal!==void 0&&(i=t.decimal);let d;"digitReplacements"in r?d=r.digitReplacements:"_digitReplacements"in t&&(d=t._digitReplacements);let u,p=s;o!==void 0&&(p=qs(s,o));const f=p.toString();if(!t._hideCountIf2||s!==2)if(d){u="";for(const k of f)u+=k==="."?i:d[k]}else u=f.replace(".",i);else u="";const m=t[e];let a=m;return typeof m=="function"&&(a=m(s)),t._hideCountIf2&&s===2&&(c=""),t._numberFirst?a+c+u:u+c+a},pi=(s,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:r}=e,c=e.largest??Number.POSITIVE_INFINITY,o={};let i,d,u,p=s;for(d=0;d<t.length;d++){i=t[d];const m=r[i];u=d===t.length-1?p/m:Math.floor(p/m),o[i]=u,p-=u*m}if(e.round){let m=c;for(d=0;d<t.length;d++)if(i=t[d],u=o[i],u!==0&&(m--,m===0)){for(let a=d+1;a<t.length;a++){const k=t[a],S=o[k];o[i]=(o[i]??0)+S*r[k]/r[i],o[k]=0}break}for(d=t.length-1;d>=0;d--){if(i=t[d],u=o[i],u===0)continue;const a=Math.round(u);if(o[i]=a,d===0)break;const k=t[d-1],S=r[k],M=Math.floor(a*r[i]/S);if(M)o[k]=(o[k]??0)+M,o[i]=0;else break}}const f=[];for(d=0;d<t.length&&f.length<c;d++){if(i=t[d],u=o[i],u&&!e.round&&f.length===c-1){let m,a=0;for(m=d+1,t.length;m<t.length;m++){const k=t[m];a+=o[k]*(e.unitMeasures[k]/e.unitMeasures[i])}u+=a,e.maxDecimalPoints!==void 0&&(u=qs(u,e.maxDecimalPoints))}u&&f.push({unitCount:u,unitName:i})}return f},mi=(s,e,t)=>{const{language:r,units:c}=e;if(s.length===0){const m=c.at(-1);return us({unitCount:0,unitName:m},r,e)}const{conjunction:o,serialComma:i}=e;let d=", ";e.delimiter!==void 0?d=e.delimiter:r.delimiter!==void 0&&(d=r.delimiter);let u="";e.timeAdverb&&t!==0&&(u=r.future??"",t<0&&(u=r.past??""));const p=s.map(m=>us(m,r,e));let f;return!o||s.length===1?f=p.join(d):s.length===2?f=p.join(o):f=p.slice(0,-1).join(d)+(i?",":"")+o+(p.at(-1)??""),u&&(f=u.replace("%s",f)),f},gi=(s,e)=>{if(Number.isNaN(s))throw new TypeError("Expected a valid number");if(typeof s!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:fi,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};hi(t.language);const r=Math.abs(s),c=pi(r,t);return mi(c,t,s)},xe="@voidzero-dev/vite-task-client",Et="@visulima/task-runner-client",at=`npm:${Et}@^1`,Hs=le(".vis",".vite-client-override-declined"),lt="pnpm-workspace.yaml",wi=["dependencies","devDependencies","optionalDependencies","peerDependencies"],Ws=s=>{try{return JSON.parse(Ne(s,"utf8"))}catch{return}},vi=s=>{const e=le(s,lt);if(Oe(e))try{return Ms(Ne(e,"utf8")).toJS()?.overrides}catch{return}},yi=s=>s==="pnpm"||s==="aube"?"pnpm.overrides":s==="yarn"?"resolutions":"overrides",xi=s=>{const e=le(s,lt);try{const t=Ms(Ne(e,"utf8"));return t.setIn(["overrides",xe],at),$t(e,t.toString()),!0}catch{return!1}},fs=s=>s!==void 0&&wi.some(e=>s[e]?.[xe]!==void 0),ji=(s,e)=>s!==void 0&&(s.pnpm?.overrides?.[xe]!==void 0||s.overrides?.[xe]!==void 0||s.resolutions?.[xe]!==void 0)||e?.[xe]!==void 0,ki=(s,e=[])=>{const t=Ws(le(s,"package.json")),r=Oe(le(s,"node_modules","@voidzero-dev","vite-task-client"));return{alreadyOverridden:ji(t,vi(s)),declined:Oe(le(s,Hs)),manager:Jr(s)?.manager,present:fs(t)||r||e.some(c=>fs(c))}},bi=s=>{try{const e=le(s,Hs);Zr(Rs(e),{recursive:!0}),$t(e,`Declined adding the ${xe} → ${Et} override.
|
|
1
|
+
import{createRequire as hr}from"node:module";import{e as le,m as Rs,$ as gr,a as wr,z as vr}from"../packem_shared/index-BzhrR_iC.js";import{expandAffected as yr,getChangedFiles as xr,buildEnhancedPath as jr,enforceProjectConstraints as kr,expandTokensInString as Zt,parsePartition as br,TaskScheduler as Sr,createTaskGraph as Tr,reverseTaskGraph as $r,splitCompoundTasks as Cr,resolveTurboEnvCompat as Ir,CompositeLifeCycle as es,defaultTaskRunner as ts,TerminalBuffer as Tt,runConcurrently as it,createLogReporter as Er,generateRunSummary as ss,writeRunSummary as Rr,readLastRunSummary as Pr,getLastRunSummaryPath as Mr,pickChildParentEnv as Fr,writeChromeTrace as Or}from"@visulima/task-runner";import{i as Ke}from"../packem_shared/index-BjdW45xX.js";import{U as Ps,W as Ar,T as Lr,C as rs,X as Dr,Y as Br,q as _r,Z as Nr,ar as Gr,as as Hr,at as Wr,au as qr,j as Vr,av as Ur}from"./cli-main.js";import{x as K,F as n,X as w,o as l,O as me,R as Q,C as zr,d as Yr,b as Kr,a4 as Xr}from"./catalog.js";import{V as Fe}from"../packem_shared/vis-user-error-CRmrBaD1.js";import{d as Jr,r as Qr}from"../packem_shared/lockfile-CiUtEbnt.js";import{y as Ms}from"../packem_shared/index-BisalDCf.js";import{F as cn}from"../packem_shared/failure-log-BP-gCUb5.js";import{r as an}from"../packem_shared/command-runtime-HSsYGCQd.js";import{r as ln}from"../packem_shared/toolchain-CP79HNVy.js";import{i as dn,r as un,s as fn,a as hn,b as pn,c as mn,d as gn,e as wn,H as vn,f as yn}from"../packem_shared/lifecycle-DvmDIRbb.js";import{s as xn}from"../packem_shared/affected-selection-DGb6Xu5K.js";import{c as is,p as jn,a as kn,b as bn,r as Sn,f as Tn,s as $n}from"../packem_shared/project-name-filter-B1ZCsbOW.js";import{p as Cn,r as In,f as En,a as Rn}from"../packem_shared/selectors-edwcgNl3.js";import{r as Ct,l as Pn,d as Fs,s as Mn,m as Fn,a as Os}from"../packem_shared/target-options-DsHFmRZH.js";import{T as As,C as Ls,D as ft,E as Ds}from"../packem_shared/symbols-BXDZ_sKt.js";import{q as Bn,j as _n,X as wt,F as cs}from"../packem_shared/index.server-Ca_EEVfw.js";import{parseStacktrace as Nn,codeFrame as Gn}from"@visulima/error";import{originalPositionFor as Hn,sourceContentFor as Wn,loadSourceMap as qn}from"@visulima/source-map";import{l as Bs}from"../packem_shared/spinner-BJjbNl1F.js";import{Q as Kn,c as ot}from"../packem_shared/formatBytes-_HvjOy8a-B_qQr4Hw.js";import{c as as,a as Xn,s as ls}from"../packem_shared/watch-CcTketln.js";import xt from"./index.js";import{U as _s}from"../packem_shared/writeFileSync-DJoHk3Ks-BPRoepNw.js";import{A as Qn,T as Zn,g as Je,b as ei,r as Qe,d as ti,e as si}from"../packem_shared/task-env-DzR4RkOj.js";let pr;const mr=s=>(pr??=hr(import.meta.url))(s),Ye=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pe=s=>{if(typeof Ye<"u"&&Ye.versions&&Ye.versions.node){const[e,t]=Ye.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return Ye.getBuiltinModule(s)}return mr(s)},{existsSync:Oe,mkdirSync:Zr,writeFileSync:$t,readFileSync:Ne,openSync:en,statSync:ns,readSync:tn,closeSync:sn,mkdtempSync:rn}=Pe("node:fs"),{createInterface:nn,emitKeypressEvents:on}=Pe("node:readline"),{isAbsolute:On,resolve:os,dirname:An,relative:Ln}=Pe("node:path"),{fileURLToPath:Dn}=Pe("node:url"),{createHash:Vn}=Pe("node:crypto"),{mkdir:Un,appendFile:ht}=Pe("node:fs/promises"),{platform:zn,homedir:It,tmpdir:Yn}=Pe("node:os"),{spawn:Jn}=Pe("node:child_process"),ri=(s,e,t,r,c,o,i,d,u,p,f,m,a,k)=>{const S={d:r,h:c,m:o,mo:e,ms:d,s:i,w:t,y:s};return S.future=u,S.past=p,S.decimal=f,m!==void 0&&(S.unitMap=m),S.groupSeparator=a,S.placeholderSeparator=k,S},ni={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"},ii=ri(s=>`year${s===1?"":"s"}`,s=>`month${s===1?"":"s"}`,s=>`week${s===1?"":"s"}`,s=>`day${s===1?"":"s"}`,s=>`hour${s===1?"":"s"}`,s=>`minute${s===1?"":"s"}`,s=>`second${s===1?"":"s"}`,s=>`millisecond${s===1?"":"s"}`,"in %s","%s ago",".",ni,",","_"),ds=new WeakSet,oi=s=>{if(ds.has(s))return;const e=["y","mo","w","d","h","m","s","ms"];for(const r of e)if(!Object.hasOwn(s,r))throw new TypeError(`Missing required property: ${r}`);if(s.future!==void 0&&typeof s.future!="string")throw new TypeError("Properties future and past must be of type string");if(s.past!==void 0&&typeof s.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const r of t)if(typeof s[r]!="string"&&typeof s[r]!="function")throw new TypeError(`Property ${r} must be of type string or function`);if(s.decimal&&typeof s.decimal!="string")throw new TypeError("Property decimal must be of type string");if(s.delimiter&&typeof s.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(s._digitReplacements&&!Array.isArray(s._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(s._numberFirst&&typeof s._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(s.unitMap&&typeof s.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(s.unitMap&&Object.values(s.unitMap).some(r=>typeof r!="string"))throw new TypeError("All values in unitMap must be of type string");ds.add(s)},Ns=(s,e)=>{if(!Number.isFinite(s)||e<0||Number.isInteger(s))return s;const t=10**e,r=Number((s*t).toPrecision(15));return Math.trunc(r)/t},us=({unitCount:s,unitName:e},t,r)=>{let{spacer:c}=r;const{maxDecimalPoints:o}=r;let i=".";r.decimal!==void 0?i=r.decimal:t.decimal!==void 0&&(i=t.decimal);let d;"digitReplacements"in r?d=r.digitReplacements:"_digitReplacements"in t&&(d=t._digitReplacements);let u,p=s;o!==void 0&&(p=Ns(s,o));const f=p.toString();if(!t._hideCountIf2||s!==2)if(d){u="";for(const k of f)u+=k==="."?i:d[k]}else u=f.replace(".",i);else u="";const m=t[e];let a=m;return typeof m=="function"&&(a=m(s)),t._hideCountIf2&&s===2&&(c=""),t._numberFirst?a+c+u:u+c+a},ci=(s,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:r}=e,c=e.largest??Number.POSITIVE_INFINITY,o={};let i,d,u,p=s;for(d=0;d<t.length;d++){i=t[d];const m=r[i];u=d===t.length-1?p/m:Math.floor(p/m),o[i]=u,p-=u*m}if(e.round){let m=c;for(d=0;d<t.length;d++)if(i=t[d],u=o[i],u!==0&&(m--,m===0)){for(let a=d+1;a<t.length;a++){const k=t[a],S=o[k];o[i]=(o[i]??0)+S*r[k]/r[i],o[k]=0}break}for(d=t.length-1;d>=0;d--){if(i=t[d],u=o[i],u===0)continue;const a=Math.round(u);if(o[i]=a,d===0)break;const k=t[d-1],S=r[k],M=Math.floor(a*r[i]/S);if(M)o[k]=(o[k]??0)+M,o[i]=0;else break}}const f=[];for(d=0;d<t.length&&f.length<c;d++){if(i=t[d],u=o[i],u&&!e.round&&f.length===c-1){let m,a=0;for(m=d+1,t.length;m<t.length;m++){const k=t[m];a+=o[k]*(e.unitMeasures[k]/e.unitMeasures[i])}u+=a,e.maxDecimalPoints!==void 0&&(u=Ns(u,e.maxDecimalPoints))}u&&f.push({unitCount:u,unitName:i})}return f},ai=(s,e,t)=>{const{language:r,units:c}=e;if(s.length===0){const m=c.at(-1);return us({unitCount:0,unitName:m},r,e)}const{conjunction:o,serialComma:i}=e;let d=", ";e.delimiter!==void 0?d=e.delimiter:r.delimiter!==void 0&&(d=r.delimiter);let u="";e.timeAdverb&&t!==0&&(u=r.future??"",t<0&&(u=r.past??""));const p=s.map(m=>us(m,r,e));let f;return!o||s.length===1?f=p.join(d):s.length===2?f=p.join(o):f=p.slice(0,-1).join(d)+(i?",":"")+o+(p.at(-1)??""),u&&(f=u.replace("%s",f)),f},li=(s,e)=>{if(Number.isNaN(s))throw new TypeError("Expected a valid number");if(typeof s!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:ii,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};oi(t.language);const r=Math.abs(s),c=ci(r,t);return ai(c,t,s)},xe="@voidzero-dev/vite-task-client",Et="@visulima/task-runner-client",ct=`npm:${Et}@^1`,Gs=le(".vis",".vite-client-override-declined"),at="pnpm-workspace.yaml",di=["dependencies","devDependencies","optionalDependencies","peerDependencies"],Hs=s=>{try{return JSON.parse(Ne(s,"utf8"))}catch{return}},ui=s=>{const e=le(s,at);if(Oe(e))try{return Ms(Ne(e,"utf8")).toJS()?.overrides}catch{return}},fi=s=>s==="pnpm"||s==="aube"?"pnpm.overrides":s==="yarn"?"resolutions":"overrides",hi=s=>{const e=le(s,at);try{const t=Ms(Ne(e,"utf8"));return t.setIn(["overrides",xe],ct),$t(e,t.toString()),!0}catch{return!1}},fs=s=>s!==void 0&&di.some(e=>s[e]?.[xe]!==void 0),pi=(s,e)=>s!==void 0&&(s.pnpm?.overrides?.[xe]!==void 0||s.overrides?.[xe]!==void 0||s.resolutions?.[xe]!==void 0)||e?.[xe]!==void 0,mi=(s,e=[])=>{const t=Hs(le(s,"package.json")),r=Oe(le(s,"node_modules","@voidzero-dev","vite-task-client"));return{alreadyOverridden:pi(t,ui(s)),declined:Oe(le(s,Gs)),manager:Jr(s)?.manager,present:fs(t)||r||e.some(c=>fs(c))}},gi=s=>{try{const e=le(s,Gs);Zr(Rs(e),{recursive:!0}),$t(e,`Declined adding the ${xe} → ${Et} override.
|
|
2
2
|
Delete this file to be asked again.
|
|
3
|
-
`)}catch{}},
|
|
4
|
-
`)}catch{return}return{file:"package.json",installCommand:t}},
|
|
5
|
-
`).map(c=>vt(c)).filter(c=>c.length>0);r.length!==0&&this.#t(e,c=>{const o=[...c.tailLines,...r];for(;o.length>hs;)o.shift();let i=0;for(let d=o.length-1;d>=0;d--)if(i+=o[d].length+1,i>
|
|
6
|
-
`);let t;for(let r=0;r<e.length;r++){const c=
|
|
3
|
+
`)}catch{}},wi=(s,e="npm")=>{const t=`${e} install`;if((e==="pnpm"||e==="aube")&&Oe(le(s,at))&&hi(s))return{file:at,installCommand:t};const r=le(s,"package.json"),c=Hs(r);if(!c)return;const o=fi(e);o==="pnpm.overrides"?(c.pnpm??={},c.pnpm.overrides??={},c.pnpm.overrides[xe]=ct):(c[o]??={},c[o][xe]=ct);try{$t(r,`${JSON.stringify(c,void 0,4)}
|
|
4
|
+
`)}catch{return}return{file:"package.json",installCommand:t}},vi=async(s,e)=>{const t=mi(s,e.projectManifests);if(!t.present||t.alreadyOverridden||t.declined)return!1;const r=nn({input:process.stdin,output:process.stdout});try{e.logger.info(`Detected ${xe}. Its cache hints no-op under @visulima/task-runner unless aliased to ${Et} (a drop-in replacement).`);const c=await new Promise(i=>{r.question("Add the override now? [y/N] ",i)});if(!/^y(?:es)?$/i.test(c.trim()))return gi(s),e.logger.info("Skipped. Delete .vis/.vite-client-override-declined to be asked again."),!1;const o=wi(s,t.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 "${xe}": "${ct}" to ${o.file}. Run \`${o.installCommand}\` to apply it.`),!0)}finally{r.close()}},yi=new Set(["cache","command","dependsOn","fingerprintEnv","hashMode","inputs","outputs","parallelism","splitCompound","untrackedEnv"]),xi=s=>s?Object.keys(s).filter(e=>yi.has(e)).toSorted():[],ji=(s,e)=>`${s}: ${e.map(t=>`"${t}"`).join(", ")} ${e.length===1?"is a target property, not an option":"are target properties, not options"}, so ${e.length===1?"it is":"they are"} ignored under "options". Move ${e.length===1?"it":"them"} next to "command".`,ki=({interactive:s,taskPty:e,workspacePty:t})=>e===!0?!0:e===!1?!1:s&&t!==!1,bi=s=>s.split(",").map(e=>e.trim()).filter(e=>e!==""),Si=(s,e,t)=>{const r=new Set,c=[];if(s===void 0||s.trim()==="")return{skipTaskIds:r,unmatchedPatterns:c};const o=[...t],i=new Set(o),d=new Map;for(const u of o){const p=u.lastIndexOf(":");if(p===-1)continue;const f=u.slice(p+1),m=d.get(f);m===void 0?d.set(f,[u]):m.push(u)}for(const u of bi(s)){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(i.has(u)){r.add(u);continue}const p=Cn(u);if(!p){c.push(u);continue}let f=!1;switch(p.kind){case"all":{const m=d.get(p.target)??[];for(const a of m)r.add(a),f=!0;break}case"project":{const m=p.projects?.[0];if(m!==void 0){const a=`${m}:${p.target}`;i.has(a)&&(r.add(a),f=!0)}break}case"tag":{const{tag:m}=p;if(m!==void 0){const a=d.get(p.target)??[];for(const k of a){const S=k.slice(0,k.lastIndexOf(":"));e.projects[S]?.tags?.includes(m)===!0&&(r.add(k),f=!0)}}break}}f||c.push(u)}return{skipTaskIds:r,unmatchedPatterns:c}},Ti=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,$i=new Set(["0","!","#","$","*","-","?","@","_"]),Ci=s=>{const e=new Map;for(const t of s.matchAll(Ti)){const r=t[1],c=t[3],o=t[2],i=r??c;if(i===void 0||$i.has(i))continue;const d=o!==void 0,u=e.get(i);u===void 0?e.set(i,d):u&&!d&&e.set(i,!1)}return[...e.entries()].map(([t,r])=>({hasDefault:r,name:t}))},Ii=s=>{const{command:e,processEnv:t,taskEnv:r,taskId:c}=s,o=Ci(e);if(o.length===0)return;const i=[];for(const{hasDefault:d,name:u}of o){if(d)continue;const p=r[u],f=t[u];p===void 0&&f===void 0&&i.push(u)}if(i.length!==0)return{missing:i.toSorted(),taskId:c}},Ei=s=>{const e=s.missing.map(t=>`$${t}`).join(", ");return`Strict env: ${s.taskId} references unset variable${s.missing.length===1?"":"s"} ${e}. Set ${s.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},Ri=64*1024,hs=256,Pi=new RegExp("[\x1B]\\[[0-?]*[ -/]*[@-~]","g"),vt=s=>s.replaceAll(Pi,"").replaceAll("\r","");class ps{#e=[];#r=new Set;#s=new Map;#n=new Map;constructor(e=[]){for(const t of e)this.#n.set(t,{id:t,status:"pending",tailLines:[]});this.#e=[...e],this.#i()}getSnapshot=()=>this.#s;subscribe=e=>(this.#r.add(e),()=>{this.#r.delete(e)});getIds(){return this.#e}getState(e){return this.#n.get(e)}getDockState(){let e=!1,t=!1;for(const r of this.#n.values())r.status==="crashed"||r.status==="failed"?e=!0:(r.status==="pending"||r.status==="starting")&&(t=!0);return e?"crash":t?"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,t=>({...t,errorMessage:void 0,startedAt:t.startedAt??Date.now(),status:"starting"}))}markStarted(e,t){this.#t(e,r=>({...r,startedAt:r.startedAt??Date.now(),status:r.status==="ready"?"ready":"starting"}))}markReady(e,t){this.#t(e,r=>({...r,errorMessage:void 0,port:t.port,readyAt:Date.now(),status:"ready"}))}markFailed(e,t,r){const c=r?.message;this.#t(e,o=>({...o,errorMessage:vt(c??t),status:"failed"}))}markCrashed(e,t){const r=t.slice(-hs).map(c=>vt(c));this.#t(e,c=>({...c,errorMessage:r.length>0?r[r.length-1]:"process exited",status:"crashed",tailLines:r}))}appendLog(e,t){const r=t.split(`
|
|
5
|
+
`).map(c=>vt(c)).filter(c=>c.length>0);r.length!==0&&this.#t(e,c=>{const o=[...c.tailLines,...r];for(;o.length>hs;)o.shift();let i=0;for(let d=o.length-1;d>=0;d--)if(i+=o[d].length+1,i>Ri){o.splice(0,d+1);break}return{...c,lastLine:r[r.length-1],tailLines:o}})}abortBoot(e){let t=!1;const r=new Map(this.#n);for(const[c,o]of r)(o.status==="pending"||o.status==="starting")&&(r.set(c,{...o,errorMessage:e,status:"failed"}),t=!0);t&&(this.#n=r,this.#i(),this.#o())}#t(e,t){const r=this.#n.get(e);r&&(this.#n.set(e,t(r)),this.#i(),this.#o())}#i(){this.#s=new Map(this.#n)}#o(){for(const e of this.#r)try{e()}catch{}}}const Mi=(s,e)=>{if(s===e)return!0;if(!s||!e||s.length!==e.length)return!1;for(const[t,r]of s.entries())if(!Object.is(r,e[t]))return!1;return!0},ms=({children:s,deps:e,onRender:t,style:r,width:c})=>{const o=K.useRef(null),i=K.useRef(!1),d=K.useRef(e),u=K.useRef(s),p=K.useRef(t);p.current=t;let f=!1;e!==void 0?Mi(d.current,e)||(f=!0,d.current=e):s!==u.current&&(f=!0,u.current=s),f&&(i.current=!1,o.current&&(o.current.cachedRender=void 0)),K.useLayoutEffect(()=>{const a=o.current;a&&(a.internal_onRendered=()=>{i.current=!0,p.current?.(a)})}),K.useEffect(()=>()=>{const a=o.current;a&&(a.cachedRender=void 0,a.internal_onRendered=void 0)},[]);const m=K.useMemo(()=>({...r,width:c}),[r,c]);return n.jsx("ink-static-render",{ref:o,style:m,children:i.current?null:s()})},Fi=s=>Array.isArray(s)?`[${s.join(",")}]`:typeof s=="object"&&s!==null?JSON.stringify(s):String(s),Oi=(s,e,t)=>e==="_"?`${s}${Array.isArray(t)?t.join(" "):String(t)}`:`${s}--${e}=${Fi(t)}`,Rt=(s,e,t)=>{const r=new Set(new Set(t.map(a=>a.target.target))),c=new Set(new Set(t.map(a=>a.target.project))),o=e.filter(a=>r.has(a)),i=s.filter(a=>c.has(a)),d=t.length-i.length*o.length,u=o.length===1?"target":"targets",p=o.join(", "),f=i.length===1?`project ${i[0]}`:`${i.length} projects`;let m=`${u} ${p} for ${f}`;return d>0&&(m+=` and ${d} ${d===1?"task":"tasks"} ${d===1?"it depends":"they depend"} on`),m},Ai={error:"red",info:"white",success:"green"},jt=({children:s,title:e,variant:t})=>{const r=Ai[t];return n.jsxs(w,{flexDirection:"column",children:[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,inverse:!0,children:" VIS "}),n.jsx(l,{bold:!0,color:r,children:"•"}),n.jsx(l,{children:e})]}),s]})},Ws=({cached:s,failed:e,failedIds:t,projectNames:r,retriedIds:c,skippedIds:o,succeeded:i,targets:d,tasks:u,took:p})=>{const f=Rt(r,d,u),m=c??[];if(e===0&&(!o||o.length===0)){const a=s>0?` (${s} read from cache)`:"";return n.jsx(ms,{children:()=>n.jsx(jt,{title:`Successfully ran ${f}`,variant:"success",children:n.jsxs(w,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[n.jsxs(l,{children:[n.jsx(l,{color:"green",children:As})," ",i+s," tasks completed",a?n.jsx(l,{dimColor:!0,children:a}):null,n.jsx(l,{dimColor:!0,children:` · Took ${p}`})]}),m.length>0&&n.jsxs(w,{flexDirection:"column",marginTop:1,children:[n.jsxs(l,{children:[n.jsx(l,{color:"yellow",children:"↻"})," ",n.jsx(l,{color:"yellow",children:String(m.length)})," task",m.length===1?"":"s"," succeeded after retry:"]}),m.map(k=>n.jsxs(l,{children:[" ",n.jsx(l,{color:"yellow",children:"↻"})," ",k]},k))]})]})})})}return n.jsx(ms,{children:()=>n.jsx(jt,{title:`Ran ${f}`,variant:"error",children:n.jsxs(w,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[o&&o.length>0&&n.jsxs(w,{flexDirection:"column",children:[n.jsxs(l,{dimColor:!0,children:[o.length," ","task",o.length===1?"":"s"," ","skipped (dependency failed or --bail)"]}),o.map(a=>n.jsxs(l,{dimColor:!0,children:[" - ",a]},a)),n.jsx(l,{})]}),e>0&&n.jsxs(w,{flexDirection:"column",children:[n.jsxs(l,{children:[n.jsx(l,{color:"red",children:String(e)})," ","task",e===1?"":"s"," ","failed:"]}),t.map(a=>n.jsxs(l,{children:[" ",n.jsx(l,{color:"red",children:Ls})," ",a]},a)),n.jsx(l,{})]}),m.length>0&&n.jsxs(w,{flexDirection:"column",children:[n.jsxs(l,{children:[n.jsx(l,{color:"yellow",children:String(m.length)})," ","task",m.length===1?"":"s"," ","finished after retry:"]}),m.map(a=>n.jsxs(l,{children:[" ",n.jsx(l,{color:"yellow",children:"↻"})," ",a]},a)),n.jsx(l,{})]}),n.jsx(l,{dimColor:!0,children:` Took ${p}`})]})})})};class lt{#e;#r=new Set;#s=new Map;constructor(e,t){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})),running:0,selectedIndex:0,startTime:Date.now(),statusFilter:"all",succeeded:0,totalTasks:t??e.length,viewMode:"list"}}getSnapshot=()=>this.#e;subscribe=e=>(this.#r.add(e),()=>{this.#r.delete(e)});startTasks(e){const t=[...this.#e.rows];for(const r of e){const c=t.findIndex(o=>o.taskId===r.id);c!==-1&&(t[c]={...t[c],elapsed:0,status:"running"},this.#s.set(r.id,process.hrtime()))}this.#t({...this.#e,rows:t,running:this.#e.running+e.length})}endTasks(e){const t=[...this.#e.rows];let{cached:r,completed:c,failed:o,succeeded:i}=this.#e;const d=new Map(this.#e.outputs),u=[...this.#e.retriedIds];for(const m of e){const a=t.findIndex(k=>k.taskId===m.task.id);switch(a!==-1&&(t[a]={...t[a],duration:m.startTime&&m.endTime?m.endTime-m.startTime:void 0,retryAttempts:m.retryAttempts,status:m.status}),m.retryAttempts&&m.retryAttempts>0&&u.push(m.task.id),c++,m.status){case"failure":{o++;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{r++;break}case"success":{i++;break}}m.terminalOutput&&!d.has(m.task.id)&&d.set(m.task.id,m.terminalOutput),this.#s.delete(m.task.id)}let{selectedIndex:p}=this.#e;if(o>this.#e.failed){const m=t.findIndex(a=>a.status==="failure");m!==-1&&(p=m)}const f=Math.max(0,this.#e.running-e.length);this.#t({...this.#e,cached:r,completed:c,failed:o,outputs:d,retriedIds:u,rows:t,running:f,selectedIndex:p,succeeded:i})}static#n=256*1024;addOutput(e,t){if(!t.trim())return;let r=(this.#e.outputs.get(e)??"")+t;r.length>lt.#n&&(r=r.slice(-lt.#n)),this.#e.outputs.set(e,r),this.#t({...this.#e})}setOutput(e,t){this.#e.outputs.set(e,t),this.#t({...this.#e})}markDone(){this.#t({...this.#e,done:!0,endTime:Date.now()})}unmarkDone(){this.#t({...this.#e,autoExitCountdown:null,done:!1,endTime:null})}tick(){if(this.#s.size===0)return;let e=!1;const t=[...this.#e.rows];for(let r=0;r<t.length;r++){const c=t[r];if(c.status==="running"){const o=this.#s.get(c.taskId);if(o){const i=process.hrtime(o),d=i[0]*1e3+i[1]/1e6;t[r]={...c,elapsed:d},e=!0}}}e&&this.#t({...this.#e,rows:t})}setSelectedIndex(e){e!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:e})}setFocusedPanel(e){e!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:e})}setFilter(e){this.#t({...this.#e,filterText:e,selectedIndex:0})}setFilterActive(e){e!==this.#e.filterActive&&this.#t({...this.#e,filterActive:e,filterText:e?this.#e.filterText:"",selectedIndex:0})}pinTask(e,t){const r=[...this.#e.pinnedTaskIds];r[e]=t,this.#t({...this.#e,pinnedTaskIds:r})}clearPins(){this.#t({...this.#e,pinnedTaskIds:[null,null]})}requestRetry(e){const t=[...this.#e.rows],r=t.findIndex(d=>d.taskId===e);let{completed:c,failed:o,succeeded:i}=this.#e;if(r!==-1){const d=t[r].status;d==="failure"?(o=Math.max(0,o-1),c=Math.max(0,c-1)):d==="success"&&(i=Math.max(0,i-1),c=Math.max(0,c-1)),t[r]={...t[r],elapsed:0,retryAttempts:void 0,status:"running"},this.#s.set(e,process.hrtime())}this.#t({...this.#e,completed:c,done:!1,endTime:null,failed:o,interactiveMode:!1,retriedIds:this.#e.retriedIds.filter(d=>d!==e),retryTaskId:e,rows:t,succeeded:i})}acknowledgeRetry(){const e=this.#e.retryTaskId;return e&&this.#t({...this.#e,retryTaskId:null}),e}setInteractiveMode(e){e!==this.#e.interactiveMode&&this.#t({...this.#e,interactiveMode:e})}setViewMode(e){e!==this.#e.viewMode&&this.#t({...this.#e,viewMode:e})}setStatusFilter(e){this.#t({...this.#e,selectedIndex:0,statusFilter:e})}requestRerun(){this.#s.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})),running:0,startTime:Date.now(),succeeded:0,viewMode:"list"})}acknowledgeRerun(){this.#e.rerunRequested&&this.#t({...this.#e,rerunRequested:!1})}#t(e){this.#e=e;for(const t of this.#r)try{t()}catch{}}}const Li=27,Di={95:"apc",80:"dcs",94:"pm",88:"sos"},Bi={159:"apc",144:"dcs",158:"pm",152:"sos"},qs=s=>s===155||s===157||s===144||s===152||s===158||s===159,Vs=(s,e)=>{for(let t=e;t<s.length;t+=1){const r=s.codePointAt(t);if(r>=64&&r<=126)return t}return-1},dt=(s,e,t)=>{for(let r=e;r<s.length;r+=1){const c=s.codePointAt(r);if(c===156||t&&c===7)return r;if(c===27&&s.codePointAt(r+1)===92)return r+1}return-1},_i=(s,e)=>{const t=s.codePointAt(e+1);if(t===91){const r=Vs(s,e+2);return r===-1?void 0:{end:r,kind:"csi"}}if(t===93){const r=dt(s,e+2,!0);return r===-1?void 0:{end:r,kind:"osc"}}if(t===80||t===88||t===94||t===95){const r=dt(s,e+2,!1),c=Di[t];return r===-1?void 0:{end:r,kind:c}}return t===void 0?void 0:{end:e+1,kind:"escape"}},Ni=(s,e)=>{const t=s.codePointAt(e);if(t===155){const r=Vs(s,e+1);return r===-1?void 0:{end:r,kind:"csi"}}if(t===157){const r=dt(s,e+1,!0);return r===-1?void 0:{end:r,kind:"osc"}}if(t===144||t===152||t===158||t===159){const r=dt(s,e+1,!1),c=Bi[t];return r===-1?void 0:{end:r,kind:c}}},Gi=s=>{if(s.includes(String.fromCodePoint(27)))return!0;for(let e=0;e<s.length;e+=1)if(qs(s.codePointAt(e)))return!0;return!1},Hi=s=>{if(!Gi(s))return s;let e="",t=0,r=0;const{length:c}=s;for(;r<c;){const o=s.codePointAt(r);let i;if(o===Li)i=_i(s,r);else if(qs(o))i=Ni(s,r);else{r+=1;continue}const d=i===void 0?c-1:i.end;e+=s.slice(t,r),t=d+1,r=d+1}return e+=s.slice(t),e},Wi=s=>Hi(s),qi=/^(?<name>(?:[A-Z][\w$]*)?(?:Error|Exception))(?::[ \t](?<message>.*))?$/,Vi=/^\s*at\s+/,Ui=s=>{const e=s.split(`
|
|
6
|
+
`);let t;for(let r=0;r<e.length;r++){const c=qi.exec(e[r].trim());if(!c)continue;const o=[];for(let i=r+1;i<e.length&&i<=r+200;i++){const d=e[i];if(Vi.test(d))o.push(d.trim());else{if(o.length>0)break;if(d.trim()!=="")break}}if(o.length>0){const i=c.groups?.name??"Error",d=c.groups?.message??"";t={message:d,name:i,stack:`${i}: ${d}
|
|
7
7
|
${o.map(u=>` ${u}`).join(`
|
|
8
|
-
`)}`}}}return t},
|
|
8
|
+
`)}`}}}return t},Us=s=>{if(s.startsWith("file://"))try{return Dn(s)}catch{return s}return s},zi=s=>!s.includes("node_modules")&&!s.startsWith("node:")&&!s.startsWith("internal/"),Yi=s=>{try{return qn(s)}catch{return}},Ki=(s,e)=>{if(!s.file||s.line===void 0)return;const t=Us(s.file),r=On(t)?t:os(e,t);if(!zi(r)||!Oe(r))return;const c=Yi(r);if(c){const o=Hn(c,{column:s.column===void 0?0:Math.max(0,s.column-1),line:s.line});if(o.source&&o.line!=null){const i=os(An(r),o.source),u=Wn(c,o.source)??(Oe(i)?Ne(i,"utf8"):void 0);if(u!==void 0)return{column:o.column==null?void 0:o.column+1,file:i,line:o.line,source:u}}}return{column:s.column,file:r,line:s.line,source:Ne(r,"utf8")}},gs=(s,e)=>{const t=Ln(e,s);return t&&!t.startsWith("..")?t:s},zs=(s,e)=>{if(!s?.trim())return s;try{const t=Ui(Wi(s));if(!t)return s;const r=new Error(t.message);r.name=t.name,r.stack=t.stack;const c=Nn(r);if(c.length===0)return s;const o=e.color,i={dim:a=>o?cs(a):a,head:a=>o?_n(wt(a)):a,loc:a=>o?Bn(a):a};let d,u;for(const a of c){const k=Ki(a,e.cwd);if(k){d=k,u=a;break}}const p=[i.head(`✖ ${t.name}${t.message?`: ${t.message}`:""}`)];if(d){const a=`${gs(d.file,e.cwd)}:${d.line}${d.column?`:${d.column}`:""}`;p.push(` ${i.loc(a)}`,""),p.push(Gn(d.source,{start:{column:d.column,line:d.line}},{color:o?{gutter:cs,marker:wt,message:wt}:void 0,linesAbove:2,linesBelow:3}))}const f=c.filter(a=>a!==u).slice(0,8).map(a=>{const k=a.methodName??"<anonymous>",S=a.file?`${gs(Us(a.file),e.cwd)}${a.line?`:${a.line}`:""}`:"";return i.dim(` at ${k}${S?` (${S})`:""}`)});f.length>0&&p.push("",...f);const m=i.dim("─".repeat(40));return`${p.join(`
|
|
9
9
|
`)}
|
|
10
10
|
${m}
|
|
11
|
-
${s}`}catch{return s}},Xi={delimiter:" ",language:{d:()=>" d",future:"in %s",h:()=>" h",m:()=>" m",mo:()=>" mo",ms:()=>" ms",past:"%s ago",s:()=>" s",w:()=>" w",y:()=>" y"},largest:2,round:!0,spacer:"",units:["h","m","s","ms"]},Ae=s=>
|
|
11
|
+
${s}`}catch{return s}},Xi={delimiter:" ",language:{d:()=>" d",future:"in %s",h:()=>" h",m:()=>" m",mo:()=>" mo",ms:()=>" ms",past:"%s ago",s:()=>" s",w:()=>" w",y:()=>" y"},largest:2,round:!0,spacer:"",units:["h","m","s","ms"]},Ae=s=>li(s,Xi),_e=s=>s==="local-cache"||s==="local-cache-kept-existing"||s==="remote-cache",Ge=s=>{switch(s){case"failure":return{color:"red",icon:Ls};case"local-cache":case"local-cache-kept-existing":case"remote-cache":case"success":return{color:"green",icon:As};case"skipped":return{color:"gray",icon:ft};default:return{color:"gray",icon:"?"}}},Xe=s=>{const{color:e,icon:t}=Ge(s);return me(Q.createElement(l,{color:e},t),{columns:10}).trim()},Ji=s=>{const{color:e,icon:t}=Ge(s);switch(s){case"local-cache":case"local-cache-kept-existing":case"remote-cache":return me(Q.createElement(l,null,Q.createElement(l,{color:e},t)," ",Q.createElement(l,{color:"cyan"},"[cache]")),{columns:30}).trim();case"skipped":return me(Q.createElement(l,null,Q.createElement(l,{dimColor:!0},t)," ",Q.createElement(l,{dimColor:!0},"[skipped]")),{columns:30}).trim();default:return me(Q.createElement(l,{color:e},t),{columns:10}).trim()}},Qi=s=>s==="azure"||s==="buildkite"||s==="github"||s==="gitlab"||s==="off"?s: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",Zi=s=>{const e=s.replaceAll(/\W+/g,"_"),t=Vn("sha256").update(s).digest("hex").slice(0,6);return`${e}_${t}`},eo=(s,e,t,r="auto")=>{const c=t.trim();if(!c)return;const o=`
|
|
12
12
|
`,i=Qi(r);if(i==="github"){process.stdout.write(`::group::${Xe(e)} ${s}${o}`),process.stdout.write(c+o),process.stdout.write(`::endgroup::${o}`);return}if(i==="gitlab"){const m=Math.floor(Date.now()/1e3),a=Zi(s),k=e==="failure"?"":"[collapsed=true]",S="\x1B[0K";process.stdout.write(`${S}section_start:${String(m)}:${a}${k}\r${S}${Xe(e)} ${s}${o}`),process.stdout.write(c+o);const M=Math.floor(Date.now()/1e3);process.stdout.write(`${S}section_end:${String(M)}:${a}\r${S}${o}`);return}if(i==="buildkite"){const m=e==="failure"?"+++":"---";process.stdout.write(`${m} ${Xe(e)} ${s}${o}`),process.stdout.write(c+o);return}if(i==="azure"){process.stdout.write(`##[group]${Xe(e)} ${s}${o}`),process.stdout.write(c+o),process.stdout.write(`##[endgroup]${o}`);return}const d=process.stdout.columns||80,u=me(Q.createElement(l,{dimColor:!0},ft.repeat(d)),{columns:d}).trim(),p=Ji(e),f=me(Q.createElement(l,{bold:!0},s),{columns:d}).trim();process.stdout.write(`${u}${o}`),process.stdout.write(`${p} ${f}${o}`),process.stdout.write(c+o),process.stdout.write(`${u}${o}`)},to=s=>s==="running"?{color:"white",icon:"•"}:s==="pending"?{color:"gray",icon:"·"}:Ge(s),so=({autoScroll:s,focused:e,interactiveMode:t,showFullscreenHint:r,statusValue:c,supportsInteractive:o,taskId:i})=>{if(!i)return;if(t)return"Esc cancel | Enter send";const d=s?"":" PAUSED (f resume)",u=o?" i INPUT":"";return e&&c==="running"&&r?`⏎ FULLSCREEN${u} f FOLLOW${d}`:e&&c==="running"?`f FOLLOW${u}${d}`:e&&r?`<enter> full screen${d}`:e?d||void 0:"<tab> or <enter> to focus"},ws=({autoScroll:s=!0,duration:e,focused:t,interactiveMode:r,output:c,scrollRef:o,showFullscreenHint:i,status:d,supportsInteractive:u=!0,taskId:p})=>{const f=d??"pending",{icon:m}=to(f),a=t?"bold":"single",k=f==="failure"?"red":f==="success"||_e(f)?t?"green":"gray":f==="running"?t?"white":"cyan":t?"white":"gray",S=p?`${m} ${p}`:void 0,M=e===void 0?void 0:Ae(e),Z=so({autoScroll:s,focused:t,interactiveMode:r??!1,showFullscreenHint:i??!1,statusValue:f,supportsInteractive:u,taskId:p});if(!p)return n.jsxs(w,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",paddingX:2,paddingY:1,children:[n.jsx(l,{dimColor:!0,children:"Select a task to view output"}),n.jsx(l,{dimColor:!0,children:"Press Enter or 1/2 to pin"})]});const b=[];if(c)for(const g of c.split(`
|
|
13
13
|
`))b.push(g.endsWith("\r")?g.slice(0,-1):g);return!c&&(f==="running"||f==="pending")?n.jsx(w,{borderBottomTitle:Z,borderColor:k,borderStyle:a,borderTopRightTitle:M,borderTopTitle:S,flexDirection:"column",flexGrow:1,paddingX:2,paddingY:1,children:n.jsx(w,{alignItems:"center",flexGrow:1,justifyContent:"center",children:n.jsx(l,{dimColor:!0,children:"Waiting for task output…"})})}):n.jsxs(w,{borderBottomTitle:Z,borderColor:r?"yellow":k,borderStyle:a,borderTopRightTitle:M,borderTopTitle:S,flexDirection:"column",flexGrow:1,children:[n.jsx(w,{flexGrow:1,flexShrink:1,paddingY:1,children:n.jsx(Ps,{flexGrow:1,followOutput:s,paddingX:2,ref:o,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:n.jsx(l,{children:b.join(`
|
|
14
|
-
`)})})}),r&&n.jsx(w,{flexShrink:0,justifyContent:"center",paddingX:1,children:n.jsx(l,{bold:!0,color:"yellow",children:"INTERACTIVE | keystrokes forwarded to task | Esc to exit"})})]})},ro={crashed:"✖",failed:"✖",pending:"·",ready:"●",starting:"•"},Ys=s=>s==="ready"?"green":s==="crashed"||s==="failed"?"red":s==="starting"?"cyan":"gray",no=({status:s})=>s==="starting"?n.jsx(l,{color:"cyan",children:n.jsx(Bs,{type:"dots"})}):n.jsx(l,{bold:!0,color:Ys(s),children:ro[s]}),io=({active:s,focused:e,state:t})=>{const r=e&&s,c=r?">":" ",o=t.status==="ready"?t.port?`running, port ${String(t.port)}`:"running":t.status==="failed"||t.status==="crashed"?t.errorMessage??"exited":t.lastLine??"booting…";return n.jsxs(w,{flexDirection:"row",flexShrink:0,overflow:"hidden",children:[n.jsx(l,{children:c}),n.jsx(l,{children:" "}),n.jsx(w,{flexShrink:0,width:3,children:n.jsx(no,{status:t.status})}),n.jsx(w,{flexGrow:0,flexShrink:0,width:28,children:n.jsx(l,{bold:r,inverse:r,children:t.id})}),n.jsx(w,{flexGrow:1,flexShrink:1,overflow:"hidden",children:n.jsxs(l,{color:Ys(t.status),dimColor:t.status!=="crashed"&&t.status!=="failed",wrap:"truncate-end",children:[" ",o]})})]})},oo=({states:s})=>{const e=[];for(const r of s)r.status==="ready"&&e.push(r.id);const t=e.join(", ");return n.jsxs(w,{paddingX:1,children:[n.jsxs(l,{bold:!0,color:"green",children:["● ","Services"]}),n.jsxs(l,{children:[" ",String(e.length)," / ",String(s.length)," running"]}),t.length>0&&n.jsxs(l,{dimColor:!0,children:[" ",t]}),n.jsx(l,{dimColor:!0,children:" [Tab ↓]"})]})},co=({states:s})=>{const e=s.find(t=>t.status==="crashed"||t.status==="failed");return e?n.jsxs(w,{flexDirection:"column",paddingX:1,children:[n.jsxs(l,{bold:!0,color:"red",children:["✖ ","Service crashed:"," ",e.id]}),e.tailLines.slice(-3).map((t,r)=>n.jsxs(l,{color:"red",dimColor:!0,children:[" ",t]},`crash-${String(r)}`))]}):n.jsx(n.Fragment,{})},ao=({activeIndex:s,focused:e,store:t})=>{const r=K.useSyncExternalStore(t.subscribe,t.getSnapshot),c=t.getIds();if(c.length===0)return n.jsx(n.Fragment,{});const o=c.map(f=>r.get(f)).filter(f=>f!==void 0),i=t.getDockState(),d=i==="crash"?"red":i==="ready"?"gray":e?"white":"cyan",u=i==="crash"?"Services (crashed)":i==="ready"?"Services":"Services (starting)",p=e?i==="crash"?"↑↓ select Enter logs R retry Esc back":"↑↓ select Enter logs Esc back":"Tab to focus services";return i==="ready"&&!e?n.jsx(w,{borderColor:d,borderStyle:"single",flexDirection:"row",flexShrink:0,children:n.jsx(oo,{states:o})}):n.jsxs(w,{borderBottomTitle:p,borderColor:d,borderStyle:e?"bold":"single",borderTopTitle:u,flexDirection:"column",flexGrow:2,flexShrink:0,minHeight:6,paddingX:1,children:[i==="crash"&&n.jsx(co,{states:o}),o.map((f,m)=>n.jsx(io,{active:m===s,focused:e,state:f},f.id))]})},Ks=6,Xs=8,Js=12,lo=s=>s==="running"||s==="pending"?Ds:s==="local-cache"||s==="local-cache-kept-existing"?"Local":s==="remote-cache"?"Remote":ft,vs=(s,e)=>e[0]===s?"[1]":e[1]===s?"[2]":"",ys=({compact:s,focused:e,isSelected:t,pinLabel:r,row:c})=>{const{persistent:o,status:i,taskId:d}=c,u=e&&t,p=u?">":" ",f=i==="running"&&o===!0;let m;if(f)m=n.jsx(l,{bold:!0,color:"green",children:" ● "});else if(i==="running")m=n.jsxs(l,{bold:!0,color:"white",children:[" ",n.jsx(Bs,{type:"dots"})," "]});else if(i==="pending")m=n.jsx(l,{bold:!0,color:"gray",children:" · "});else{const{color:k,icon:S}=Ge(i);m=n.jsxs(l,{bold:!0,color:k,children:[" ",S," "]})}let a=Ds;return f?a="running":i!=="running"&&i!=="pending"?a=c.duration===void 0?ft:Ae(c.duration):i==="running"&&c.elapsed!==void 0&&(a=Ae(c.elapsed)),n.jsxs(w,{children:[n.jsx(l,{children:p}),n.jsx(w,{width:Ks,children:m}),n.jsxs(w,{flexGrow:1,children:[n.jsx(l,{bold:u,inverse:u,children:d}),r?n.jsx(l,{dimColor:!0,children:` ${r}`}):null]}),!s&&n.jsx(w,{justifyContent:"flex-end",width:Xs,children:n.jsx(l,{dimColor:!_e(i),children:lo(i)})}),!s&&n.jsx(w,{justifyContent:"flex-end",width:Js,children:n.jsx(l,{color:f?"green":void 0,dimColor:i==="pending"||f,children:a})})]})},xs=({compact:s,filterActive:e,filterText:t,focused:r,headerStatus:c,parallelSlots:o=3,pinnedTaskIds:i,rows:d,scrollRef:u,selectedIndex:p,title:f})=>{const m=c==="error"?"red":c==="success"?"green":r?"white":"gray",a=d[p]?.taskId,k=[];let S=0;for(const g of d)g.status==="running"?k.push(g):g.status==="pending"&&(S+=1);const M=Math.min(o,k.length+S),Z=M>1,b=[];if(Z)for(let g=0;g<M;g++){const $=k[g];$?b.push(n.jsx(ys,{compact:s,focused:r,isSelected:$.taskId===a,pinLabel:vs($.taskId,i),row:$},`par-${$.taskId}`)):b.push(n.jsxs(w,{children:[n.jsx(l,{children:" "}),n.jsx(w,{width:Ks,children:n.jsx(l,{bold:!0,color:"gray",children:" · "})}),n.jsx(l,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(g)}`))}return n.jsxs(w,{borderColor:m,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[n.jsxs(w,{flexShrink:0,paddingX:1,children:[n.jsx(l,{bold:!0,inverse:!0,children:" VIS "}),n.jsx(l,{children:` ${f}`}),!s&&n.jsxs(w,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[n.jsx(w,{justifyContent:"flex-end",width:Xs,children:n.jsx(l,{dimColor:!0,children:"Cache"})}),n.jsx(w,{justifyContent:"flex-end",width:Js,children:n.jsx(l,{dimColor:!0,children:"Duration"})})]})]}),n.jsx(Ps,{flexGrow:1,flexShrink:1,paddingX:1,paddingY:1,ref:u,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:d.map(g=>n.jsx(ys,{compact:s,focused:r,isSelected:g.taskId===a,pinLabel:vs(g.taskId,i),row:g},g.taskId))}),Z&&n.jsx(w,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingX:1,paddingY:1,children:b}),e&&n.jsxs(w,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexShrink:0,paddingX:1,children:[n.jsx(l,{bold:!0,color:"white",children:"/ "}),n.jsx(l,{children:t}),n.jsx(l,{inverse:!0,children:" "})]})]})},js=40,ks=10,bs=100,uo=Object.freeze([]),fo=({autoExitSeconds:s,onRetryService:e,parallelSlots:t,projectNames:r,serviceDockStore:c,stdinRegistry:o,store:i,targets:d,tasks:u})=>{const{exit:p}=Ar(),{columns:f,rows:m}=Lr(),a=K.useSyncExternalStore(i.subscribe,i.getSnapshot),k=K.useCallback(I=>c?c.subscribe(I):()=>{},[c]);K.useSyncExternalStore(k,()=>c?c.getDockState():"ready");const S=c?c.getIds():uo,M=S.length>0,[Z,b]=K.useState(0),[g,$]=K.useState(null),_=K.useSyncExternalStore(k,()=>g&&c?c.getState(g):void 0),[
|
|
15
|
-
`):G?a.outputs.get(G)??"":"",be=K.useMemo(()=>H?.status==="failure"&&ae?zs(ae,{color:!process.env.NO_COLOR,cwd:process.cwd()}):ae,[H?.status,ae]),W=g??G,qe=g?fe?.status==="crashed"||fe?.status==="failed"?"failure":"running":H?.status,He=Rt(r,d,u),Ze=a.done?`Completed ${He} (${Ae((a.endTime??Date.now())-a.startTime)})`:`Running ${He}...`,et=a.done?a.failed>0?"error":"success":"running",tt=K.useCallback(I=>{F.current?.scrollTo(Math.max(0,I-2))},[]);if(K.useEffect(()=>{a.interactiveMode&&H?.status!=="running"&&i.setInteractiveMode(!1)},[a.interactiveMode,H?.status,i]),K.useEffect(()=>{if(!G)return;let I=f;a.viewMode==="split"&&f>=bs?I=f-Math.floor(f*.4)-2:(a.viewMode==="split"||a.viewMode==="fullscreen")&&(I=f-2);const j=Math.max(1,m-4);o.get(G)?.resize?.(I,j)},[f,m,a.viewMode,G]),rs((I,j)=>{if(j.escape){i.setInteractiveMode(!1);return}if(!G)return;const E=o.get(G);if(!E){i.setInteractiveMode(!1);return}if(j.return)E.write("\r");else if(j.upArrow)E.write("\x1B[A");else if(j.downArrow)E.write("\x1B[B");else if(j.rightArrow)E.write("\x1B[C");else if(j.leftArrow)E.write("\x1B[D");else if(j.backspace)E.write("");else if(j.delete)E.write("\x1B[3~");else if(j.tab)E.write(" ");else if(j.home)E.write("\x1B[H");else if(j.end)E.write("\x1B[F");else if(j.pageUp)E.write("\x1B[5~");else if(j.pageDown)E.write("\x1B[6~");else if(j.ctrl&&I){const X=I.toUpperCase().codePointAt(0);X!==void 0&&X>=65&&X<=90&&E.write(String.fromCodePoint(X-64))}else I&&E.write(I)},{isActive:a.interactiveMode}),rs((I,j)=>{if(I==="c"&&j.ctrl){p();return}if(!re){if(q){j.escape||I==="?"?x(!1):I==="q"?(x(!1),C(!0)):j.downArrow||I==="j"?D.current?.scrollBy(1):j.upArrow||I==="k"?D.current?.scrollBy(-1):j.pageDown?D.current?.scrollBy(5):j.pageUp?D.current?.scrollBy(-5):j.home?D.current?.scrollToTop():j.end&&D.current?.scrollToBottom();return}if(I==="?"){x(!0);return}if(I==="q"){C(!0);return}if(I==="r"&&a.done){i.requestRerun();return}if(I==="R"&&a.done){const E=ee[a.selectedIndex];E?.status==="failure"&&i.requestRetry(E.taskId);return}if(I==="F"&&!a.filterActive){const E=["all","failed","running","passed"],X=E.indexOf(a.statusFilter);i.setStatusFilter(E[(X+1)%E.length]);return}if(a.filterActive){if(j.escape){i.setFilterActive(!1);return}if(j.return){i.setFilterActive(!1);return}if(j.backspace){i.setFilter(a.filterText.slice(0,-1));return}if(I&&!j.ctrl&&!j.meta){i.setFilter(a.filterText+I);return}return}if(I==="i"&&H?.status==="running"&&(a.viewMode==="fullscreen"||a.viewMode==="split"&&a.focusedPanel==="output")){i.setInteractiveMode(!0);return}if(a.viewMode==="fullscreen"){if(j.escape){i.setViewMode("split"),ie("split");return}if(I==="f"){const E=!P;U(E),E&&N.current?.scrollToBottom();return}if(j.downArrow||I==="j"){U(!1),N.current?.scrollBy(1);return}if(j.upArrow||I==="k"){U(!1),N.current?.scrollBy(-1);return}if(j.pageDown||j.ctrl&&I==="d"){U(!1),N.current?.scrollBy(12);return}if(j.pageUp||j.ctrl&&I==="u"){U(!1),N.current?.scrollBy(-12);return}if(j.home){U(!1),N.current?.scrollToTop();return}if(j.end){U(!0),N.current?.scrollToBottom();return}return}if(a.focusedPanel==="dock"&&M&&c){if(j.tab){$(null),i.setFocusedPanel("tasks");return}if(j.escape){i.setFocusedPanel("tasks"),$(null),a.viewMode==="split"&&(i.setViewMode("list"),ie("list"));return}if(j.downArrow||I==="j"){b(E=>Math.min(E+1,S.length-1));return}if(j.upArrow||I==="k"){b(E=>Math.max(E-1,0));return}if(j.return){const E=S[Z];E&&($(E),U(!0),ge(),te.current.splitList=0,te.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),ie("split"));return}if((I==="r"||I==="R")&&e){const E=S[Z],X=E?c.getState(E)?.status:void 0;if(E&&(X==="crashed"||X==="failed")){const Le=e(E);Le instanceof Promise&&Le.catch(()=>{})}return}return}if(a.viewMode==="split"){if(j.tab){a.focusedPanel==="tasks"?i.setFocusedPanel("output"):M?i.setFocusedPanel("dock"):($(null),i.setFocusedPanel("tasks"));return}if(a.focusedPanel==="output"){if(j.escape){if(g&&M){$(null),i.setViewMode("list"),i.setFocusedPanel("dock"),ie("list");return}$(null),i.setFocusedPanel("tasks");return}if(j.return){ge(),i.setViewMode("fullscreen");return}if(I==="f"){const E=!P;U(E),E&&N.current?.scrollToBottom();return}if(j.downArrow||I==="j"){U(!1),N.current?.scrollBy(1);return}if(j.upArrow||I==="k"){U(!1),N.current?.scrollBy(-1);return}if(j.pageDown||j.ctrl&&I==="d"){U(!1),N.current?.scrollBy(12);return}if(j.pageUp||j.ctrl&&I==="u"){U(!1),N.current?.scrollBy(-12);return}if(j.home){U(!1),N.current?.scrollToTop();return}if(j.end){U(!0),N.current?.scrollToBottom();return}return}if(j.escape){i.setViewMode("list"),ie("list");return}if(j.return){i.setFocusedPanel("output");return}}if(a.viewMode==="list"||a.viewMode==="split"&&a.focusedPanel==="tasks"){if(j.tab&&a.viewMode==="list"&&M){i.setFocusedPanel("dock");return}if(j.downArrow||I==="j"){const E=Math.min(a.selectedIndex+1,Math.max(0,ee.length-1));i.setSelectedIndex(E),tt(E);return}if(j.upArrow||I==="k"){const E=Math.max(a.selectedIndex-1,0);i.setSelectedIndex(E),tt(E);return}if(j.return&&a.viewMode==="list"){U(!0),ge(),te.current.splitList=0,te.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),ie("split");return}if(I==="/"){i.setFilterActive(!0);return}if(I==="1"&&de){i.pinTask(0,de);return}if(I==="2"&&de){i.pinTask(1,de);return}if(I==="0"){i.clearPins();return}j.escape&&a.filterText&&i.setFilter("")}}},{isActive:!a.interactiveMode}),f<js||m<ks)return n.jsx(w,{alignItems:"center",height:m,justifyContent:"center",width:f,children:n.jsxs(l,{color:"yellow",children:["Terminal too small (",f,"x",m,"). Minimum:"," ",js,"x",ks]})});const oe=n.jsxs(w,{gap:1,children:[a.succeeded>0&&n.jsxs(l,{bold:!0,color:"green",children:["✓"," ",a.succeeded]}),a.cached>0&&n.jsxs(l,{dimColor:!0,children:["✓"," ",a.cached]}),a.failed>0&&n.jsxs(l,{bold:!0,color:"red",children:["✗"," ",a.failed]}),a.running>0&&n.jsxs(l,{color:"cyan",children:["◷"," ",a.running]}),n.jsxs(l,{dimColor:!0,children:[a.totalTasks," ","total"]}),a.statusFilter!=="all"&&n.jsxs(l,{color:"yellow",children:["[",a.statusFilter,"]"]})]});let Se;if(a.viewMode==="fullscreen")Se=[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"Esc"}),n.jsx(l,{dimColor:!0,children:"BACK"})]},"esc"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"↑↓"}),n.jsx(l,{dimColor:!0,children:"SCROLL"})]},"scroll"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"^u ^d"}),n.jsx(l,{dimColor:!0,children:"PAGE"})]},"page"),...H?.status==="running"?[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"i"}),n.jsx(l,{dimColor:!0,children:"INPUT"})]},"i")]:[],n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"q"}),n.jsx(l,{dimColor:!0,children:"QUIT"})]},"q")];else if(a.done){const I=ee[a.selectedIndex]?.status==="failure";Se=[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"q"}),n.jsx(l,{dimColor:!0,children:"QUIT"})]},"q"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"r"}),n.jsx(l,{dimColor:!0,children:"RERUN"})]},"r"),...I?[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"R"}),n.jsx(l,{dimColor:!0,children:"RETRY"})]},"R")]:[],n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"?"}),n.jsx(l,{dimColor:!0,children:"HELP"})]},"?"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"↑↓"}),n.jsx(l,{dimColor:!0,children:"NAV"})]},"nav"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"F"}),n.jsx(l,{dimColor:!0,children:"FILTER"})]},"F"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"⏎"}),n.jsx(l,{dimColor:!0,children:a.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter")]}else a.viewMode==="split"&&a.focusedPanel==="output"?Se=[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"q"}),n.jsx(l,{dimColor:!0,children:"QUIT"})]},"q"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"Esc"}),n.jsx(l,{dimColor:!0,children:"BACK"})]},"esc"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"↑↓"}),n.jsx(l,{dimColor:!0,children:"SCROLL"})]},"scroll"),...H?.status==="running"?[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"i"}),n.jsx(l,{dimColor:!0,children:"INPUT"})]},"i")]:[],n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"⏎"}),n.jsx(l,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"Tab"}),n.jsx(l,{dimColor:!0,children:"PANEL"})]},"tab"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"?"}),n.jsx(l,{dimColor:!0,children:"HELP"})]},"?")]:Se=[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"q"}),n.jsx(l,{dimColor:!0,children:"QUIT"})]},"q"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"?"}),n.jsx(l,{dimColor:!0,children:"HELP"})]},"?"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"↑↓"}),n.jsx(l,{dimColor:!0,children:"NAV"})]},"nav"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"/"}),n.jsx(l,{dimColor:!0,children:"FILTER"})]},"/"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"F"}),n.jsx(l,{dimColor:!0,children:"STATUS"})]},"F"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"⏎"}),n.jsx(l,{dimColor:!0,children:a.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...a.viewMode==="split"?[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"Tab"}),n.jsx(l,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const Ce=n.jsxs(w,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[n.jsx(w,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:Se}),n.jsx(w,{flexShrink:0,paddingX:1,children:oe})]}),we=n.jsxs(Dr,{backgroundColor:"#1e1e1e",footer:n.jsxs(l,{dimColor:!0,children:[n.jsx(l,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",n.jsx(l,{bold:!0,color:"white",children:"?"}),"/",n.jsx(l,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:D,title:"KEYBOARD SHORTCUTS",visible:q,width:52,children:[n.jsxs(w,{flexDirection:"column",marginBottom:1,children:[n.jsxs(w,{marginBottom:1,children:[n.jsx(l,{dimColor:!0,children:"── "}),n.jsx(l,{bold:!0,color:"white",children:"NAVIGATION"})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","↑","/k"]}),n.jsx(l,{dimColor:!0,children:" Move up"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","↓","/j"]}),n.jsx(l,{dimColor:!0,children:" Move down"})]})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","Tab"]}),n.jsx(l,{dimColor:!0,children:" Switch panel (split)"})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","Esc"]}),n.jsx(l,{dimColor:!0,children:" Back / close"})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","Enter"]}),n.jsx(l,{dimColor:!0,children:" Show output / fullscreen"})]})]}),n.jsxs(w,{flexDirection:"column",marginBottom:1,children:[n.jsxs(w,{marginBottom:1,children:[n.jsx(l,{dimColor:!0,children:"── "}),n.jsx(l,{bold:!0,color:"white",children:"VIEWS"})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","Enter"]}),n.jsxs(l,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","Esc"]}),n.jsxs(l,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),n.jsxs(w,{flexDirection:"column",marginBottom:1,children:[n.jsxs(w,{marginBottom:1,children:[n.jsx(l,{dimColor:!0,children:"── "}),n.jsx(l,{bold:!0,color:"white",children:"ACTIONS"})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","/"]}),n.jsx(l,{dimColor:!0,children:" Filter by text"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","F"]}),n.jsx(l,{dimColor:!0,children:" Filter by status"})]})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","1"]}),n.jsx(l,{dimColor:!0,children:"/"}),n.jsx(l,{bold:!0,color:"white",children:"2"}),n.jsx(l,{dimColor:!0,children:" Pin to output pane"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","0"]}),n.jsx(l,{dimColor:!0,children:" Clear pins"})]})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","r"]}),n.jsx(l,{dimColor:!0,children:" Rerun all (done)"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","R"]}),n.jsx(l,{dimColor:!0,children:" Retry failed task"})]})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","i"]}),n.jsx(l,{dimColor:!0,children:" Interactive input (running task)"})]})]}),n.jsxs(w,{flexDirection:"column",marginBottom:1,children:[n.jsxs(w,{marginBottom:1,children:[n.jsx(l,{dimColor:!0,children:"── "}),n.jsx(l,{bold:!0,color:"white",children:"SCROLLING"}),n.jsx(l,{dimColor:!0,children:" (output panel)"})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","↑","/k"]}),n.jsx(l,{dimColor:!0,children:" Scroll up"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","↓","/j"]}),n.jsx(l,{dimColor:!0,children:" Scroll down"})]})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","^u"]}),n.jsx(l,{dimColor:!0,children:" Page up"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","^d"]}),n.jsx(l,{dimColor:!0,children:" Page down"})]})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","Home"]}),n.jsx(l,{dimColor:!0,children:" Top"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","End"]}),n.jsx(l,{dimColor:!0,children:" Bottom (resume follow)"})]})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","f"]}),n.jsx(l,{dimColor:!0,children:" Toggle auto-scroll (tail mode)"})]})]}),n.jsxs(w,{flexDirection:"column",children:[n.jsxs(w,{marginBottom:1,children:[n.jsx(l,{dimColor:!0,children:"── "}),n.jsx(l,{bold:!0,color:"white",children:"GENERAL"})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","q"]}),n.jsx(l,{dimColor:!0,children:" Quit"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","?"]}),n.jsx(l,{dimColor:!0,children:" Toggle help"})]})]})]})]}),Te=n.jsx(Br,{autoExitSeconds:s>0?s:3,onCancel:()=>{C(!1)},visible:re}),Me=M&&c?n.jsx(ao,{activeIndex:Z,focused:a.focusedPanel==="dock",store:c}):null;if(a.viewMode==="fullscreen")return n.jsxs(w,{flexDirection:"column",height:m,width:f,children:[n.jsx(w,{flexGrow:1,children:n.jsx(ws,{autoScroll:P,duration:H?.duration??H?.elapsed,focused:!0,interactiveMode:a.interactiveMode,output:be,scrollRef:N,status:qe,supportsInteractive:!g,taskId:W})}),Me,Ce,Te,we]});if(a.viewMode==="split"){const I=f>=bs,j=n.jsx(xs,{compact:!0,filterActive:a.filterActive,filterText:a.filterText,focused:a.focusedPanel==="tasks",headerStatus:et,parallelSlots:t,pinnedTaskIds:a.pinnedTaskIds,rows:ee,scrollRef:F,selectedIndex:a.selectedIndex,title:Ze}),E=n.jsx(ws,{autoScroll:P,duration:H?.duration??H?.elapsed,focused:a.focusedPanel==="output",interactiveMode:a.interactiveMode,output:be,scrollRef:N,showFullscreenHint:!0,status:qe,supportsInteractive:!g,taskId:W});if(I){const Le=Math.floor(f*.4);return n.jsxs(w,{flexDirection:"column",height:m,width:f,children:[n.jsxs(w,{flexDirection:"row",flexGrow:1,children:[n.jsx(w,{width:Le,children:j}),n.jsx(w,{flexGrow:1,children:E})]}),Me,Ce,Te,we]})}const X=Math.floor(m*.45);return n.jsxs(w,{flexDirection:"column",height:m,width:f,children:[n.jsx(w,{height:X,children:j}),n.jsx(w,{flexGrow:1,children:E}),Me,Ce,Te,we]})}return n.jsxs(w,{flexDirection:"column",height:m,width:f,children:[n.jsx(w,{flexGrow:1,children:n.jsx(xs,{filterActive:a.filterActive,filterText:a.filterText,focused:a.focusedPanel!=="dock",headerStatus:et,parallelSlots:t,pinnedTaskIds:a.pinnedTaskIds,rows:ee,scrollRef:F,selectedIndex:a.selectedIndex,title:Ze})}),Me,Ce,Te,we]})},ho=s=>s==="quiet"?"quiet":"normal",po=(s,e)=>typeof s=="string"?ho(s.toLowerCase()):e===!0?"quiet":"normal",kt=(s,e)=>{const t=s.overrides.visOptions;return t?.outputStyle==="normal"||t?.outputStyle==="quiet"?t.outputStyle:e},Qs=s=>`${s.id}: tracker saw no workspace access; cached on declared inputs`;class mo{#e;#r;#s;#n=[];#t=[];#i=[];#o=new Map;#c;#a;#d;#u=0;constructor(e){this.#e=e.projectNames,this.#r=e.args.targets,this.#s=e.tasks,this.#c=e.logReporter,this.#a=e.outputStyle??"normal",this.#d=e.ciGrouping??"auto"}startCommand(){this.#u=Date.now();const e=process.stdout.columns||80,t=`Running ${Rt(this.#e,this.#r,this.#s)}`,r=me(Q.createElement(jt,{title:t,variant:"info"}),{columns:e});process.stdout.write(r);const c=this.#s[0],o=c?.overrides?Object.entries(c.overrides).filter(([i])=>i!=="command"):[];if(o.length>0){process.stdout.write(`
|
|
14
|
+
`)})})}),r&&n.jsx(w,{flexShrink:0,justifyContent:"center",paddingX:1,children:n.jsx(l,{bold:!0,color:"yellow",children:"INTERACTIVE | keystrokes forwarded to task | Esc to exit"})})]})},ro={crashed:"✖",failed:"✖",pending:"·",ready:"●",starting:"•"},Ys=s=>s==="ready"?"green":s==="crashed"||s==="failed"?"red":s==="starting"?"cyan":"gray",no=({status:s})=>s==="starting"?n.jsx(l,{color:"cyan",children:n.jsx(Bs,{type:"dots"})}):n.jsx(l,{bold:!0,color:Ys(s),children:ro[s]}),io=({active:s,focused:e,state:t})=>{const r=e&&s,c=r?">":" ",o=t.status==="ready"?t.port?`running, port ${String(t.port)}`:"running":t.status==="failed"||t.status==="crashed"?t.errorMessage??"exited":t.lastLine??"booting…";return n.jsxs(w,{flexDirection:"row",flexShrink:0,overflow:"hidden",children:[n.jsx(l,{children:c}),n.jsx(l,{children:" "}),n.jsx(w,{flexShrink:0,width:3,children:n.jsx(no,{status:t.status})}),n.jsx(w,{flexGrow:0,flexShrink:0,width:28,children:n.jsx(l,{bold:r,inverse:r,children:t.id})}),n.jsx(w,{flexGrow:1,flexShrink:1,overflow:"hidden",children:n.jsxs(l,{color:Ys(t.status),dimColor:t.status!=="crashed"&&t.status!=="failed",wrap:"truncate-end",children:[" ",o]})})]})},oo=({states:s})=>{const e=[];for(const r of s)r.status==="ready"&&e.push(r.id);const t=e.join(", ");return n.jsxs(w,{paddingX:1,children:[n.jsxs(l,{bold:!0,color:"green",children:["● ","Services"]}),n.jsxs(l,{children:[" ",String(e.length)," / ",String(s.length)," running"]}),t.length>0&&n.jsxs(l,{dimColor:!0,children:[" ",t]}),n.jsx(l,{dimColor:!0,children:" [Tab ↓]"})]})},co=({states:s})=>{const e=s.find(t=>t.status==="crashed"||t.status==="failed");return e?n.jsxs(w,{flexDirection:"column",paddingX:1,children:[n.jsxs(l,{bold:!0,color:"red",children:["✖ ","Service crashed:"," ",e.id]}),e.tailLines.slice(-3).map((t,r)=>n.jsxs(l,{color:"red",dimColor:!0,children:[" ",t]},`crash-${String(r)}`))]}):n.jsx(n.Fragment,{})},ao=({activeIndex:s,focused:e,store:t})=>{const r=K.useSyncExternalStore(t.subscribe,t.getSnapshot),c=t.getIds();if(c.length===0)return n.jsx(n.Fragment,{});const o=c.map(f=>r.get(f)).filter(f=>f!==void 0),i=t.getDockState(),d=i==="crash"?"red":i==="ready"?"gray":e?"white":"cyan",u=i==="crash"?"Services (crashed)":i==="ready"?"Services":"Services (starting)",p=e?i==="crash"?"↑↓ select Enter logs R retry Esc back":"↑↓ select Enter logs Esc back":"Tab to focus services";return i==="ready"&&!e?n.jsx(w,{borderColor:d,borderStyle:"single",flexDirection:"row",flexShrink:0,children:n.jsx(oo,{states:o})}):n.jsxs(w,{borderBottomTitle:p,borderColor:d,borderStyle:e?"bold":"single",borderTopTitle:u,flexDirection:"column",flexGrow:2,flexShrink:0,minHeight:6,paddingX:1,children:[i==="crash"&&n.jsx(co,{states:o}),o.map((f,m)=>n.jsx(io,{active:m===s,focused:e,state:f},f.id))]})},Ks=6,Xs=8,Js=12,lo=s=>s==="running"||s==="pending"?Ds:s==="local-cache"||s==="local-cache-kept-existing"?"Local":s==="remote-cache"?"Remote":ft,vs=(s,e)=>e[0]===s?"[1]":e[1]===s?"[2]":"",ys=({compact:s,focused:e,isSelected:t,pinLabel:r,row:c})=>{const{persistent:o,status:i,taskId:d}=c,u=e&&t,p=u?">":" ",f=i==="running"&&o===!0;let m;if(f)m=n.jsx(l,{bold:!0,color:"green",children:" ● "});else if(i==="running")m=n.jsxs(l,{bold:!0,color:"white",children:[" ",n.jsx(Bs,{type:"dots"})," "]});else if(i==="pending")m=n.jsx(l,{bold:!0,color:"gray",children:" · "});else{const{color:k,icon:S}=Ge(i);m=n.jsxs(l,{bold:!0,color:k,children:[" ",S," "]})}let a=Ds;return f?a="running":i!=="running"&&i!=="pending"?a=c.duration===void 0?ft:Ae(c.duration):i==="running"&&c.elapsed!==void 0&&(a=Ae(c.elapsed)),n.jsxs(w,{children:[n.jsx(l,{children:p}),n.jsx(w,{width:Ks,children:m}),n.jsxs(w,{flexGrow:1,children:[n.jsx(l,{bold:u,inverse:u,children:d}),r?n.jsx(l,{dimColor:!0,children:` ${r}`}):null]}),!s&&n.jsx(w,{justifyContent:"flex-end",width:Xs,children:n.jsx(l,{dimColor:!_e(i),children:lo(i)})}),!s&&n.jsx(w,{justifyContent:"flex-end",width:Js,children:n.jsx(l,{color:f?"green":void 0,dimColor:i==="pending"||f,children:a})})]})},xs=({compact:s,filterActive:e,filterText:t,focused:r,headerStatus:c,parallelSlots:o=3,pinnedTaskIds:i,rows:d,scrollRef:u,selectedIndex:p,title:f})=>{const m=c==="error"?"red":c==="success"?"green":r?"white":"gray",a=d[p]?.taskId,k=[];let S=0;for(const g of d)g.status==="running"?k.push(g):g.status==="pending"&&(S+=1);const M=Math.min(o,k.length+S),Z=M>1,b=[];if(Z)for(let g=0;g<M;g++){const $=k[g];$?b.push(n.jsx(ys,{compact:s,focused:r,isSelected:$.taskId===a,pinLabel:vs($.taskId,i),row:$},`par-${$.taskId}`)):b.push(n.jsxs(w,{children:[n.jsx(l,{children:" "}),n.jsx(w,{width:Ks,children:n.jsx(l,{bold:!0,color:"gray",children:" · "})}),n.jsx(l,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(g)}`))}return n.jsxs(w,{borderColor:m,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[n.jsxs(w,{flexShrink:0,paddingX:1,children:[n.jsx(l,{bold:!0,inverse:!0,children:" VIS "}),n.jsx(l,{children:` ${f}`}),!s&&n.jsxs(w,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[n.jsx(w,{justifyContent:"flex-end",width:Xs,children:n.jsx(l,{dimColor:!0,children:"Cache"})}),n.jsx(w,{justifyContent:"flex-end",width:Js,children:n.jsx(l,{dimColor:!0,children:"Duration"})})]})]}),n.jsx(Ps,{flexGrow:1,flexShrink:1,paddingX:1,paddingY:1,ref:u,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:d.map(g=>n.jsx(ys,{compact:s,focused:r,isSelected:g.taskId===a,pinLabel:vs(g.taskId,i),row:g},g.taskId))}),Z&&n.jsx(w,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingX:1,paddingY:1,children:b}),e&&n.jsxs(w,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexShrink:0,paddingX:1,children:[n.jsx(l,{bold:!0,color:"white",children:"/ "}),n.jsx(l,{children:t}),n.jsx(l,{inverse:!0,children:" "})]})]})},js=40,ks=10,bs=100,uo=Object.freeze([]),fo=({autoExitSeconds:s,onRetryService:e,parallelSlots:t,projectNames:r,serviceDockStore:c,stdinRegistry:o,store:i,targets:d,tasks:u})=>{const{exit:p}=Ar(),{columns:f,rows:m}=Lr(),a=K.useSyncExternalStore(i.subscribe,i.getSnapshot),k=K.useCallback(I=>c?c.subscribe(I):()=>{},[c]);K.useSyncExternalStore(k,()=>c?c.getDockState():"ready");const S=c?c.getIds():uo,M=S.length>0,[Z,b]=K.useState(0),[g,$]=K.useState(null),_=K.useSyncExternalStore(k,()=>g&&c?c.getState(g):void 0),[H,x]=K.useState(!1),D=K.useRef(null),F=K.useRef(null),N=K.useRef(null),[re,C]=K.useState(!1),[P,V]=K.useState(!0),te=K.useRef({list:0,splitList:0,splitOutput:0}),ge=K.useCallback(()=>{a.viewMode==="list"?te.current.list=F.current?.getScrollOffset()??0:a.viewMode==="split"&&(te.current.splitList=F.current?.getScrollOffset()??0,te.current.splitOutput=N.current?.getScrollOffset()??0)},[a.viewMode]),ie=K.useCallback(I=>{setTimeout(()=>{if(I==="list"){const j=te.current.list;F.current?.scrollTo(j)}else if(I==="split"){const j=te.current.splitList;j>0?F.current?.scrollTo(j):F.current?.scrollTo(Math.max(0,i.getSnapshot().selectedIndex-2)),N.current?.scrollTo(te.current.splitOutput)}},0)},[i]),se=K.useRef(!1);K.useEffect(()=>{a.done&&!se.current&&(se.current=!0,s>0&&a.failed===0&&C(!0)),!a.done&&se.current&&(se.current=!1,C(!1))},[a.done,a.failed,s]);const ee=K.useMemo(()=>{const I=S.length>0?new Set(S):null,j=a.filterText?a.filterText.toLowerCase():null,E=[];for(const X of a.rows)I?.has(X.taskId)||a.statusFilter==="failed"&&X.status!=="failure"||a.statusFilter==="running"&&X.status!=="running"&&X.status!=="pending"||a.statusFilter==="passed"&&X.status!=="success"&&!_e(X.status)||j&&!X.taskId.toLowerCase().includes(j)||E.push(X);return E},[a.rows,a.filterText,a.statusFilter,S]),de=(ee[a.selectedIndex]??null)?.taskId??null,G=g?null:a.pinnedTaskIds[0]??de,W=G?a.rows.find(I=>I.taskId===G):null,fe=_??null,ae=g?(fe?.tailLines??[]).join(`
|
|
15
|
+
`):G?a.outputs.get(G)??"":"",be=K.useMemo(()=>W?.status==="failure"&&ae?zs(ae,{color:!process.env.NO_COLOR,cwd:process.cwd()}):ae,[W?.status,ae]),q=g??G,He=g?fe?.status==="crashed"||fe?.status==="failed"?"failure":"running":W?.status,We=Rt(r,d,u),Ze=a.done?`Completed ${We} (${Ae((a.endTime??Date.now())-a.startTime)})`:`Running ${We}...`,et=a.done?a.failed>0?"error":"success":"running",tt=K.useCallback(I=>{F.current?.scrollTo(Math.max(0,I-2))},[]);if(K.useEffect(()=>{a.interactiveMode&&W?.status!=="running"&&i.setInteractiveMode(!1)},[a.interactiveMode,W?.status,i]),K.useEffect(()=>{if(!G)return;let I=f;a.viewMode==="split"&&f>=bs?I=f-Math.floor(f*.4)-2:(a.viewMode==="split"||a.viewMode==="fullscreen")&&(I=f-2);const j=Math.max(1,m-4);o.get(G)?.resize?.(I,j)},[f,m,a.viewMode,G]),rs((I,j)=>{if(j.escape){i.setInteractiveMode(!1);return}if(!G)return;const E=o.get(G);if(!E){i.setInteractiveMode(!1);return}if(j.return)E.write("\r");else if(j.upArrow)E.write("\x1B[A");else if(j.downArrow)E.write("\x1B[B");else if(j.rightArrow)E.write("\x1B[C");else if(j.leftArrow)E.write("\x1B[D");else if(j.backspace)E.write("");else if(j.delete)E.write("\x1B[3~");else if(j.tab)E.write(" ");else if(j.home)E.write("\x1B[H");else if(j.end)E.write("\x1B[F");else if(j.pageUp)E.write("\x1B[5~");else if(j.pageDown)E.write("\x1B[6~");else if(j.ctrl&&I){const X=I.toUpperCase().codePointAt(0);X!==void 0&&X>=65&&X<=90&&E.write(String.fromCodePoint(X-64))}else I&&E.write(I)},{isActive:a.interactiveMode}),rs((I,j)=>{if(I==="c"&&j.ctrl){p();return}if(!re){if(H){j.escape||I==="?"?x(!1):I==="q"?(x(!1),C(!0)):j.downArrow||I==="j"?D.current?.scrollBy(1):j.upArrow||I==="k"?D.current?.scrollBy(-1):j.pageDown?D.current?.scrollBy(5):j.pageUp?D.current?.scrollBy(-5):j.home?D.current?.scrollToTop():j.end&&D.current?.scrollToBottom();return}if(I==="?"){x(!0);return}if(I==="q"){C(!0);return}if(I==="r"&&a.done){i.requestRerun();return}if(I==="R"&&a.done){const E=ee[a.selectedIndex];E?.status==="failure"&&i.requestRetry(E.taskId);return}if(I==="F"&&!a.filterActive){const E=["all","failed","running","passed"],X=E.indexOf(a.statusFilter);i.setStatusFilter(E[(X+1)%E.length]);return}if(a.filterActive){if(j.escape){i.setFilterActive(!1);return}if(j.return){i.setFilterActive(!1);return}if(j.backspace){i.setFilter(a.filterText.slice(0,-1));return}if(I&&!j.ctrl&&!j.meta){i.setFilter(a.filterText+I);return}return}if(I==="i"&&W?.status==="running"&&(a.viewMode==="fullscreen"||a.viewMode==="split"&&a.focusedPanel==="output")){i.setInteractiveMode(!0);return}if(a.viewMode==="fullscreen"){if(j.escape){i.setViewMode("split"),ie("split");return}if(I==="f"){const E=!P;V(E),E&&N.current?.scrollToBottom();return}if(j.downArrow||I==="j"){V(!1),N.current?.scrollBy(1);return}if(j.upArrow||I==="k"){V(!1),N.current?.scrollBy(-1);return}if(j.pageDown||j.ctrl&&I==="d"){V(!1),N.current?.scrollBy(12);return}if(j.pageUp||j.ctrl&&I==="u"){V(!1),N.current?.scrollBy(-12);return}if(j.home){V(!1),N.current?.scrollToTop();return}if(j.end){V(!0),N.current?.scrollToBottom();return}return}if(a.focusedPanel==="dock"&&M&&c){if(j.tab){$(null),i.setFocusedPanel("tasks");return}if(j.escape){i.setFocusedPanel("tasks"),$(null),a.viewMode==="split"&&(i.setViewMode("list"),ie("list"));return}if(j.downArrow||I==="j"){b(E=>Math.min(E+1,S.length-1));return}if(j.upArrow||I==="k"){b(E=>Math.max(E-1,0));return}if(j.return){const E=S[Z];E&&($(E),V(!0),ge(),te.current.splitList=0,te.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),ie("split"));return}if((I==="r"||I==="R")&&e){const E=S[Z],X=E?c.getState(E)?.status:void 0;if(E&&(X==="crashed"||X==="failed")){const Le=e(E);Le instanceof Promise&&Le.catch(()=>{})}return}return}if(a.viewMode==="split"){if(j.tab){a.focusedPanel==="tasks"?i.setFocusedPanel("output"):M?i.setFocusedPanel("dock"):($(null),i.setFocusedPanel("tasks"));return}if(a.focusedPanel==="output"){if(j.escape){if(g&&M){$(null),i.setViewMode("list"),i.setFocusedPanel("dock"),ie("list");return}$(null),i.setFocusedPanel("tasks");return}if(j.return){ge(),i.setViewMode("fullscreen");return}if(I==="f"){const E=!P;V(E),E&&N.current?.scrollToBottom();return}if(j.downArrow||I==="j"){V(!1),N.current?.scrollBy(1);return}if(j.upArrow||I==="k"){V(!1),N.current?.scrollBy(-1);return}if(j.pageDown||j.ctrl&&I==="d"){V(!1),N.current?.scrollBy(12);return}if(j.pageUp||j.ctrl&&I==="u"){V(!1),N.current?.scrollBy(-12);return}if(j.home){V(!1),N.current?.scrollToTop();return}if(j.end){V(!0),N.current?.scrollToBottom();return}return}if(j.escape){i.setViewMode("list"),ie("list");return}if(j.return){i.setFocusedPanel("output");return}}if(a.viewMode==="list"||a.viewMode==="split"&&a.focusedPanel==="tasks"){if(j.tab&&a.viewMode==="list"&&M){i.setFocusedPanel("dock");return}if(j.downArrow||I==="j"){const E=Math.min(a.selectedIndex+1,Math.max(0,ee.length-1));i.setSelectedIndex(E),tt(E);return}if(j.upArrow||I==="k"){const E=Math.max(a.selectedIndex-1,0);i.setSelectedIndex(E),tt(E);return}if(j.return&&a.viewMode==="list"){V(!0),ge(),te.current.splitList=0,te.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),ie("split");return}if(I==="/"){i.setFilterActive(!0);return}if(I==="1"&&de){i.pinTask(0,de);return}if(I==="2"&&de){i.pinTask(1,de);return}if(I==="0"){i.clearPins();return}j.escape&&a.filterText&&i.setFilter("")}}},{isActive:!a.interactiveMode}),f<js||m<ks)return n.jsx(w,{alignItems:"center",height:m,justifyContent:"center",width:f,children:n.jsxs(l,{color:"yellow",children:["Terminal too small (",f,"x",m,"). Minimum:"," ",js,"x",ks]})});const oe=n.jsxs(w,{gap:1,children:[a.succeeded>0&&n.jsxs(l,{bold:!0,color:"green",children:["✓"," ",a.succeeded]}),a.cached>0&&n.jsxs(l,{dimColor:!0,children:["✓"," ",a.cached]}),a.failed>0&&n.jsxs(l,{bold:!0,color:"red",children:["✗"," ",a.failed]}),a.running>0&&n.jsxs(l,{color:"cyan",children:["◷"," ",a.running]}),n.jsxs(l,{dimColor:!0,children:[a.totalTasks," ","total"]}),a.statusFilter!=="all"&&n.jsxs(l,{color:"yellow",children:["[",a.statusFilter,"]"]})]});let Se;if(a.viewMode==="fullscreen")Se=[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"Esc"}),n.jsx(l,{dimColor:!0,children:"BACK"})]},"esc"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"↑↓"}),n.jsx(l,{dimColor:!0,children:"SCROLL"})]},"scroll"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"^u ^d"}),n.jsx(l,{dimColor:!0,children:"PAGE"})]},"page"),...W?.status==="running"?[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"i"}),n.jsx(l,{dimColor:!0,children:"INPUT"})]},"i")]:[],n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"q"}),n.jsx(l,{dimColor:!0,children:"QUIT"})]},"q")];else if(a.done){const I=ee[a.selectedIndex]?.status==="failure";Se=[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"q"}),n.jsx(l,{dimColor:!0,children:"QUIT"})]},"q"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"r"}),n.jsx(l,{dimColor:!0,children:"RERUN"})]},"r"),...I?[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"R"}),n.jsx(l,{dimColor:!0,children:"RETRY"})]},"R")]:[],n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"?"}),n.jsx(l,{dimColor:!0,children:"HELP"})]},"?"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"↑↓"}),n.jsx(l,{dimColor:!0,children:"NAV"})]},"nav"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"F"}),n.jsx(l,{dimColor:!0,children:"FILTER"})]},"F"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"⏎"}),n.jsx(l,{dimColor:!0,children:a.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter")]}else a.viewMode==="split"&&a.focusedPanel==="output"?Se=[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"q"}),n.jsx(l,{dimColor:!0,children:"QUIT"})]},"q"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"Esc"}),n.jsx(l,{dimColor:!0,children:"BACK"})]},"esc"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"↑↓"}),n.jsx(l,{dimColor:!0,children:"SCROLL"})]},"scroll"),...W?.status==="running"?[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"i"}),n.jsx(l,{dimColor:!0,children:"INPUT"})]},"i")]:[],n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"⏎"}),n.jsx(l,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"Tab"}),n.jsx(l,{dimColor:!0,children:"PANEL"})]},"tab"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"?"}),n.jsx(l,{dimColor:!0,children:"HELP"})]},"?")]:Se=[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"q"}),n.jsx(l,{dimColor:!0,children:"QUIT"})]},"q"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"?"}),n.jsx(l,{dimColor:!0,children:"HELP"})]},"?"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"↑↓"}),n.jsx(l,{dimColor:!0,children:"NAV"})]},"nav"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"/"}),n.jsx(l,{dimColor:!0,children:"FILTER"})]},"/"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"F"}),n.jsx(l,{dimColor:!0,children:"STATUS"})]},"F"),n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"⏎"}),n.jsx(l,{dimColor:!0,children:a.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...a.viewMode==="split"?[n.jsxs(w,{gap:1,children:[n.jsx(l,{bold:!0,color:"white",children:"Tab"}),n.jsx(l,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const Ce=n.jsxs(w,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[n.jsx(w,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:Se}),n.jsx(w,{flexShrink:0,paddingX:1,children:oe})]}),we=n.jsxs(Dr,{backgroundColor:"#1e1e1e",footer:n.jsxs(l,{dimColor:!0,children:[n.jsx(l,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",n.jsx(l,{bold:!0,color:"white",children:"?"}),"/",n.jsx(l,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:D,title:"KEYBOARD SHORTCUTS",visible:H,width:52,children:[n.jsxs(w,{flexDirection:"column",marginBottom:1,children:[n.jsxs(w,{marginBottom:1,children:[n.jsx(l,{dimColor:!0,children:"── "}),n.jsx(l,{bold:!0,color:"white",children:"NAVIGATION"})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","↑","/k"]}),n.jsx(l,{dimColor:!0,children:" Move up"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","↓","/j"]}),n.jsx(l,{dimColor:!0,children:" Move down"})]})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","Tab"]}),n.jsx(l,{dimColor:!0,children:" Switch panel (split)"})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","Esc"]}),n.jsx(l,{dimColor:!0,children:" Back / close"})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","Enter"]}),n.jsx(l,{dimColor:!0,children:" Show output / fullscreen"})]})]}),n.jsxs(w,{flexDirection:"column",marginBottom:1,children:[n.jsxs(w,{marginBottom:1,children:[n.jsx(l,{dimColor:!0,children:"── "}),n.jsx(l,{bold:!0,color:"white",children:"VIEWS"})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","Enter"]}),n.jsxs(l,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","Esc"]}),n.jsxs(l,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),n.jsxs(w,{flexDirection:"column",marginBottom:1,children:[n.jsxs(w,{marginBottom:1,children:[n.jsx(l,{dimColor:!0,children:"── "}),n.jsx(l,{bold:!0,color:"white",children:"ACTIONS"})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","/"]}),n.jsx(l,{dimColor:!0,children:" Filter by text"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","F"]}),n.jsx(l,{dimColor:!0,children:" Filter by status"})]})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","1"]}),n.jsx(l,{dimColor:!0,children:"/"}),n.jsx(l,{bold:!0,color:"white",children:"2"}),n.jsx(l,{dimColor:!0,children:" Pin to output pane"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","0"]}),n.jsx(l,{dimColor:!0,children:" Clear pins"})]})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","r"]}),n.jsx(l,{dimColor:!0,children:" Rerun all (done)"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","R"]}),n.jsx(l,{dimColor:!0,children:" Retry failed task"})]})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","i"]}),n.jsx(l,{dimColor:!0,children:" Interactive input (running task)"})]})]}),n.jsxs(w,{flexDirection:"column",marginBottom:1,children:[n.jsxs(w,{marginBottom:1,children:[n.jsx(l,{dimColor:!0,children:"── "}),n.jsx(l,{bold:!0,color:"white",children:"SCROLLING"}),n.jsx(l,{dimColor:!0,children:" (output panel)"})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","↑","/k"]}),n.jsx(l,{dimColor:!0,children:" Scroll up"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","↓","/j"]}),n.jsx(l,{dimColor:!0,children:" Scroll down"})]})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","^u"]}),n.jsx(l,{dimColor:!0,children:" Page up"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","^d"]}),n.jsx(l,{dimColor:!0,children:" Page down"})]})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","Home"]}),n.jsx(l,{dimColor:!0,children:" Top"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","End"]}),n.jsx(l,{dimColor:!0,children:" Bottom (resume follow)"})]})]}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","f"]}),n.jsx(l,{dimColor:!0,children:" Toggle auto-scroll (tail mode)"})]})]}),n.jsxs(w,{flexDirection:"column",children:[n.jsxs(w,{marginBottom:1,children:[n.jsx(l,{dimColor:!0,children:"── "}),n.jsx(l,{bold:!0,color:"white",children:"GENERAL"})]}),n.jsxs(w,{children:[n.jsx(w,{width:24,children:n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","q"]}),n.jsx(l,{dimColor:!0,children:" Quit"})]})}),n.jsxs(l,{children:[n.jsxs(l,{bold:!0,color:"white",children:[" ","?"]}),n.jsx(l,{dimColor:!0,children:" Toggle help"})]})]})]})]}),Te=n.jsx(Br,{autoExitSeconds:s>0?s:3,onCancel:()=>{C(!1)},visible:re}),Me=M&&c?n.jsx(ao,{activeIndex:Z,focused:a.focusedPanel==="dock",store:c}):null;if(a.viewMode==="fullscreen")return n.jsxs(w,{flexDirection:"column",height:m,width:f,children:[n.jsx(w,{flexGrow:1,children:n.jsx(ws,{autoScroll:P,duration:W?.duration??W?.elapsed,focused:!0,interactiveMode:a.interactiveMode,output:be,scrollRef:N,status:He,supportsInteractive:!g,taskId:q})}),Me,Ce,Te,we]});if(a.viewMode==="split"){const I=f>=bs,j=n.jsx(xs,{compact:!0,filterActive:a.filterActive,filterText:a.filterText,focused:a.focusedPanel==="tasks",headerStatus:et,parallelSlots:t,pinnedTaskIds:a.pinnedTaskIds,rows:ee,scrollRef:F,selectedIndex:a.selectedIndex,title:Ze}),E=n.jsx(ws,{autoScroll:P,duration:W?.duration??W?.elapsed,focused:a.focusedPanel==="output",interactiveMode:a.interactiveMode,output:be,scrollRef:N,showFullscreenHint:!0,status:He,supportsInteractive:!g,taskId:q});if(I){const Le=Math.floor(f*.4);return n.jsxs(w,{flexDirection:"column",height:m,width:f,children:[n.jsxs(w,{flexDirection:"row",flexGrow:1,children:[n.jsx(w,{width:Le,children:j}),n.jsx(w,{flexGrow:1,children:E})]}),Me,Ce,Te,we]})}const X=Math.floor(m*.45);return n.jsxs(w,{flexDirection:"column",height:m,width:f,children:[n.jsx(w,{height:X,children:j}),n.jsx(w,{flexGrow:1,children:E}),Me,Ce,Te,we]})}return n.jsxs(w,{flexDirection:"column",height:m,width:f,children:[n.jsx(w,{flexGrow:1,children:n.jsx(xs,{filterActive:a.filterActive,filterText:a.filterText,focused:a.focusedPanel!=="dock",headerStatus:et,parallelSlots:t,pinnedTaskIds:a.pinnedTaskIds,rows:ee,scrollRef:F,selectedIndex:a.selectedIndex,title:Ze})}),Me,Ce,Te,we]})},ho=s=>s==="quiet"?"quiet":"normal",po=(s,e)=>typeof s=="string"?ho(s.toLowerCase()):e===!0?"quiet":"normal",kt=(s,e)=>{const t=s.overrides.visOptions;return t?.outputStyle==="normal"||t?.outputStyle==="quiet"?t.outputStyle:e},Qs=s=>`${s.id}: tracker saw no workspace access; cached on declared inputs`;class mo{#e;#r;#s;#n=[];#t=[];#i=[];#o=new Map;#c;#a;#d;#u=0;constructor(e){this.#e=e.projectNames,this.#r=e.args.targets,this.#s=e.tasks,this.#c=e.logReporter,this.#a=e.outputStyle??"normal",this.#d=e.ciGrouping??"auto"}startCommand(){this.#u=Date.now();const e=process.stdout.columns||80,t=`Running ${Rt(this.#e,this.#r,this.#s)}`,r=me(Q.createElement(jt,{title:t,variant:"info"}),{columns:e});process.stdout.write(r);const c=this.#s[0],o=c?.overrides?Object.entries(c.overrides).filter(([i])=>i!=="command"):[];if(o.length>0){process.stdout.write(`
|
|
16
16
|
With additional flags:
|
|
17
|
-
`);for(const[i,d]of o)process.stdout.write(`${
|
|
17
|
+
`);for(const[i,d]of o)process.stdout.write(`${Oi(" ",i,d)}
|
|
18
18
|
`)}process.stdout.write(`
|
|
19
19
|
`)}startTasks(e){const t=process.stdout.columns||80;for(const r of e){const c=me(Q.createElement(l,null,Q.createElement(l,{dimColor:!0},">"),` ${r.id}`),{columns:t});process.stdout.write(`${c}
|
|
20
20
|
`)}}endTasks(e){const t=process.stdout.columns||80;for(const r of e){this.#o.set(r.task.id,r),r.status==="failure"?this.#n.push(r):_e(r.status)&&this.#t.push(r),r.retryAttempts&&r.retryAttempts>0&&this.#i.push(r);const c=Xe(r.status),o=r.startTime&&r.endTime?` (${Ae(r.endTime-r.startTime)})`:"",i=_e(r.status)?" [cache]":"",d=r.retryAttempts&&r.retryAttempts>0?` [retried ${r.retryAttempts}x]`:"",u=me(Q.createElement(l,null,c,` ${r.task.id}`,i?Q.createElement(l,{color:"cyan"},i):null,d?Q.createElement(l,{color:"yellow"},d):null,o?Q.createElement(l,{dimColor:!0},o):null),{columns:t});process.stdout.write(`${u}
|
|
21
21
|
`)}}#l(e){const t=process.stdout.columns||80,r=me(Q.createElement(l,{dimColor:!0},` ⓘ ${e}`),{columns:t});process.stdout.write(`${r}
|
|
22
22
|
`)}printCacheDisabledByTask(e){this.#l(`${e.id}: caching disabled by task via disableCache()`)}printSelfModifyingSkip(e,t){this.#l(`${e.id}: caching skipped — task modified its own input${t.length===1?"":"s"} (${t.join(", ")})`)}printDeclaredFallback(e){kt(e,this.#a)!=="quiet"&&this.#l(Qs(e))}printEmptyFingerprintWarning(e,t){this.#l(`${e.id}: caching skipped — ${t}`)}printTaskTerminalOutput(e,t,r){if(kt(e,this.#a)==="quiet"&&(t==="success"||_e(t)))return;const c=t==="failure"?zs(r,{color:!process.env.NO_COLOR,cwd:process.cwd()}):r;if(this.#c){this.#c.printTaskTerminalOutput(e,t,c);return}eo(e.id,t,c,this.#d)}endCommand(){const e=Ae(Date.now()-this.#u),t=this.#s.filter(o=>!this.#o.has(o.id)).map(o=>o.id);process.stdout.write(`
|
|
23
|
-
`);const r=process.stdout.columns||80,c=me(Q.createElement(
|
|
24
|
-
`)}}const go=s=>{const{args:e,autoExit:t=!1,onRetryService:r,outputStyle:c="normal",projectNames:o,serviceDockStore:i,stdinRegistry:d,tasks:u,totalTaskCount:p}=s,f=new
|
|
25
|
-
`);for(const ie of C.rows){const{persistent:se,status:ee,taskId:ke}=ie,de=ee==="running"||ee==="pending",G=Ge(ee),
|
|
23
|
+
`);const r=process.stdout.columns||80,c=me(Q.createElement(Ws,{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:t.length>0?t:void 0,succeeded:this.#o.size-this.#n.length-this.#t.length,targets:this.#r,tasks:this.#s,took:e}),{columns:r});process.stdout.write(`${c}
|
|
24
|
+
`)}}const go=s=>{const{args:e,autoExit:t=!1,onRetryService:r,outputStyle:c="normal",projectNames:o,serviceDockStore:i,stdinRegistry:d,tasks:u,totalTaskCount:p}=s,f=new lt(u,p),m=typeof e.parallel=="number"?e.parallel:3,a=t===!0?3:typeof t=="number"?t:0,k=new Map,S=(C,P)=>{const V=k.get(C);V?V.push(P):k.set(C,[P])};let M,Z;const b=new Promise(C=>{Z=C});let g;const $=()=>{g&&(clearInterval(g),g=void 0)},_=()=>{if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),process.stdin.unref()},H=()=>{if(d){for(const C of d.values())C.kill?.();d.clear()}},x=()=>{$(),N(),H(),_(),process.stdout.write("\x1B[?1049l\x1B[?25h"),M?.cleanup(),process.exit(1)},D=()=>{const C=f.getSnapshot(),P=Ae(Date.now()-C.startTime),V=C.rows.filter(ie=>ie.status==="failure").map(ie=>ie.taskId),te=process.stdout.columns||80;process.stdout.write(`
|
|
25
|
+
`);for(const ie of C.rows){const{persistent:se,status:ee,taskId:ke}=ie,de=ee==="running"||ee==="pending",G=Ge(ee),W=de&&se?"■":G.icon,fe=de&&se?"gray":G.color;let ae="";switch(ee){case"local-cache":case"local-cache-kept-existing":{ae=" [local cache]";break}case"remote-cache":{ae=" [remote cache]";break}case"skipped":{ae=" [skipped]";break}default:{de&&se?ae=" [stopped]":de&&(ae=" [skipped]");break}}const be=ie.retryAttempts&&ie.retryAttempts>0?` [retried ${ie.retryAttempts}x]`:"",q=me(Q.createElement(l,null," ",Q.createElement(l,{color:fe},W),` vis run ${ke}`,ae?Q.createElement(l,{dimColor:!0},` ${ae}`):null,be?Q.createElement(l,{color:"yellow"},be):null),{columns:te});process.stdout.write(`${q}
|
|
26
26
|
`)}process.stdout.write(`
|
|
27
|
-
`);const ge=me(Q.createElement(
|
|
27
|
+
`);const ge=me(Q.createElement(Ws,{cached:C.cached,failed:C.failed,failedIds:V,projectNames:o,retriedIds:C.retriedIds.length>0?C.retriedIds:void 0,succeeded:C.succeeded,targets:e.targets,tasks:u,took:P}),{columns:te});if(process.stdout.write(`${ge}
|
|
28
28
|
`),c!=="quiet"){const ie=[...C.rows.filter(se=>se.status!=="failure"),...C.rows.filter(se=>se.status==="failure")];for(const se of ie){if(se.status==="running"||se.status==="pending")continue;const ee=C.outputs.get(se.taskId);if(!ee?.trim())continue;const{color:ke,icon:de}=Ge(se.status),G=me(Q.createElement(l,null,`
|
|
29
29
|
`,Q.createElement(l,{bold:!0,color:ke},` ${de} vis run ${se.taskId}`)),{columns:te});process.stdout.write(`${G}
|
|
30
30
|
|
|
31
|
-
`);const
|
|
31
|
+
`);const W=ee.trim().split(`
|
|
32
32
|
`).map(fe=>` ${fe}`).join(`
|
|
33
|
-
`);process.stdout.write(`${
|
|
34
|
-
`)}}};let F;const N=()=>{F&&(clearInterval(F),F=void 0)};return{lifeCycle:{endCommand(){$(),f.markDone(),F||(F=setInterval(()=>{},1e3))},endTasks(C){f.endTasks(C);for(const P of C){const
|
|
33
|
+
`);process.stdout.write(`${W}
|
|
34
|
+
`)}}};let F;const N=()=>{F&&(clearInterval(F),F=void 0)};return{lifeCycle:{endCommand(){$(),f.markDone(),F||(F=setInterval(()=>{},1e3))},endTasks(C){f.endTasks(C);for(const P of C){const V=k.get(P.task.id);if(V){k.delete(P.task.id);for(const te of V)f.addOutput(P.task.id,te)}}},printCacheDisabledByTask(C){S(C.id,`ⓘ caching disabled by task via disableCache()
|
|
35
35
|
`)},printDeclaredFallback(C){kt(C,c)!=="quiet"&&S(C.id,`ⓘ ${Qs(C)}
|
|
36
36
|
`)},printEmptyFingerprintWarning(C,P){S(C.id,`ⓘ caching skipped — ${P}
|
|
37
37
|
`)},printSelfModifyingSkip(C,P){S(C.id,`ⓘ caching skipped — task modified its own input${P.length===1?"":"s"} (${P.join(", ")})
|
|
38
|
-
`)},printTaskTerminalOutput(C,P,
|
|
38
|
+
`)},printTaskTerminalOutput(C,P,V){f.getSnapshot().outputs.has(C.id)||f.addOutput(C.id,V)},startCommand(){process.on("SIGINT",x),process.on("SIGTERM",x),F||(F=setInterval(()=>{},1e3)),M=_r(Q.createElement(fo,{autoExitSeconds:a,onRetryService:r,parallelSlots:m,projectNames:o,serviceDockStore:i,stdinRegistry:d??new Map,store:f,targets:e.targets,tasks:u}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}),M.waitUntilExit().then(()=>{N(),H(),_(),process.removeListener("SIGINT",x),process.removeListener("SIGTERM",x),D(),Z()}).catch(()=>{N(),H(),_(),process.removeListener("SIGINT",x),process.removeListener("SIGTERM",x),Z()})},startTasks(C){f.startTasks(C),g||(g=setInterval(()=>{f.tick()},100))}},renderIsDone:b,store:f}},wo=async s=>{if(process.env.VIS_NO_SHELL_HISTORY)return;if(zn()==="win32"){try{await xo(s)}catch{}return}const e=process.env.SHELL;if(!e)return;const t=gr(e);try{if(t==="zsh"){await vo(s);return}if(t==="bash"){await yo(s);return}t==="fish"&&await jo(s)}catch{}},Pt=s=>s.replaceAll(/[\u0000-\u001F\u007F]/gu," ").trimEnd(),vo=async s=>{const e=process.env.HISTFILE??le(process.env.ZDOTDIR??It(),".zsh_history"),t=`: ${Math.floor(Date.now()/1e3)}:0;${Pt(s)}
|
|
39
39
|
`;await ht(e,t)},yo=async s=>{const e=process.env.HISTFILE??le(It(),".bash_history");await ht(e,`${Pt(s)}
|
|
40
|
-
`)},xo=async s=>{const e=process.env.VIS_PSREADLINE_HISTORY,t=process.env.APPDATA;if(e===void 0&&(t===void 0||t===""))return;const r=e??le(t,"Microsoft","Windows","PowerShell","PSReadLine","ConsoleHost_history.txt");await
|
|
40
|
+
`)},xo=async s=>{const e=process.env.VIS_PSREADLINE_HISTORY,t=process.env.APPDATA;if(e===void 0&&(t===void 0||t===""))return;const r=e??le(t,"Microsoft","Windows","PowerShell","PSReadLine","ConsoleHost_history.txt");await Un(Rs(r),{recursive:!0}),await ht(r,`${Pt(s)}\r
|
|
41
41
|
`)},jo=async s=>{const e=le(It(),".local","share","fish","fish_history"),r=`- cmd: ${s.replaceAll("\\","\\\\").replaceAll(`
|
|
42
42
|
`,String.raw`\n`).replaceAll("\r",String.raw`\r`)}
|
|
43
43
|
when: ${Math.floor(Date.now()/1e3)}
|
|
@@ -46,13 +46,13 @@ ${s}`}catch{return s}},Xi={delimiter:" ",language:{d:()=>" d",future:"in %s",h:(
|
|
|
46
46
|
`)},$o=async(s,e)=>{e.write("filter projects (empty to cancel) > ");const t=s,r=t.isRaw===!0;if(r)try{t.setRawMode?.(!1)}catch{}return await new Promise(c=>{let o="";const i=d=>{o+=typeof d=="string"?d:d.toString("utf8");const u=o.indexOf(`
|
|
47
47
|
`);if(u===-1)return;const p=o.slice(0,u).replace(/\r$/,"").trim();if(s.off("data",i),r)try{t.setRawMode?.(!0)}catch{}c(p.length>0?p:void 0)};s.on("data",i)})},Co=s=>{const{handlers:e}=s,t=s.input??process.stdin,r=s.output??process.stdout,c=s.promptFilter??$o;if(!t||t.isTTY===!1)return{close:()=>{}};on(t);const o=t.isRaw===!0;try{t.setRawMode?.(!0)}catch{return{close:()=>{}}}typeof t.resume=="function"&&t.resume();let i=!1;const d=async f=>{if(f.ctrl===!0&&f.name==="c"){await e.onQuit();return}if(!i)switch(f.name){case"?":case"h":{await e.onHelp();break}case"a":{await e.onClearFilter();break}case"p":{i=!0;try{const m=await c(t,r);m===void 0?r.write(`filter cancelled.
|
|
48
48
|
`):await e.onFilter(m)}finally{i=!1}break}case"q":{await e.onQuit();break}case"r":{await e.onRerun();break}case"return":{await e.onRerun();break}}},u=(f,m)=>{d(m).catch(a=>{r.write(`[vis watch] keybind handler failed: ${a.message}
|
|
49
|
-
`)})},p=t;return p.on("keypress",u),{close:()=>{if(p.off("keypress",u),!o)try{t.setRawMode?.(!1)}catch{}const f=t;if(typeof f.pause=="function")try{f.pause()}catch{}}}},Io=s=>{const e=s.overrides.visOptions;return e&&typeof e=="object"?e:void 0},Eo=async s=>{const{initialTasks:e,probe:t,registeredEntries:r,taskGraph:c,visVersion:o}=s,i=new Map,d=new Map,u=new Map;for(const x of r)if(dn(x.pid)){if(x.visVersion!==o){d.set(x.id,x);continue}i.set(x.id,x)}if(t){const x=[...i.values()],D=await Promise.all(x.map(async F=>{try{return[F.id,await t(F)]}catch{return[F.id,!1]}}));for(const[F,N]of D)if(!N){const re=i.get(F);i.delete(F),re&&u.set(F,re)}}const p=new Set(e.map(x=>x.id)),f=new Set,m=[],a=[],k=new Set;for(const x of Object.values(c.dependencies))for(const D of x)k.add(D);for(const[x,D]of Object.entries(c.tasks)){if(!Io(D)?.service)continue;if(i.has(x)){f.add(x),a.push(i.get(x));continue}if(p.has(x)||!k.has(x))continue;const re=d.get(x),C=u.get(x);let P;re?P=`Service ${x} is registered with vis ${re.visVersion}, but this invocation is vis ${o}. Restart with \`vis service restart ${x}\` to pick up the new version.`:C?P=`Service ${x} is registered (PID ${String(C.pid)}) but failed its readiness probe — the wrapper process is alive but the underlying server is not responding. Run \`vis service restart ${x}\` to recover.`:P=`Target depends on the service ${x}, which is not running. Run \`vis service start ${x}\` first, or invoke \`${x}\` directly.`,m.push({message:P,targetId:x})}if(f.size===0)return{diagnostics:m,initialTasks:e,satisfiedServices:a,serviceDependentsByServiceId:new Map,serviceEnvByTaskId:new Map,taskGraph:c};const S=new Map,M=x=>{const D=new Set,F=[...c.dependencies[x]??[]],N=new Set;for(;F.length>0;){const re=F.pop();if(!N.has(re)){N.add(re),f.has(re)&&D.add(re);for(const C of c.dependencies[re]??[])N.has(C)||F.push(C)}}return[...D].sort()},Z=new Map;for(const x of Object.keys(c.dependencies)){if(f.has(x))continue;const D=M(x);if(D.length===0)continue;const F={};for(const N of D){const re=i.get(N);if(!re)continue;Object.assign(F,re.env);const C=Z.get(N);C?C.push(x):Z.set(N,[x])}Object.keys(F).length>0&&S.set(x,F)}for(const x of Z.values())x.sort();const b={};for(const[x,D]of Object.entries(c.tasks))f.has(x)||(b[x]=D);const g={};for(const[x,D]of Object.entries(c.dependencies))f.has(x)||(g[x]=D.filter(F=>!f.has(F)));const $=new Map;for(const x of Object.keys(b))$.set(x,0);for(const x of Object.values(g))for(const D of x)$.has(D)&&$.set(D,($.get(D)??0)+1);const _=[];for(const x of c.roots)!f.has(x)&&b[x]&&_.push(x);for(const[x,D]of $)D===0&&!_.includes(x)&&b[x]&&_.push(x);const
|
|
49
|
+
`)})},p=t;return p.on("keypress",u),{close:()=>{if(p.off("keypress",u),!o)try{t.setRawMode?.(!1)}catch{}const f=t;if(typeof f.pause=="function")try{f.pause()}catch{}}}},Io=s=>{const e=s.overrides.visOptions;return e&&typeof e=="object"?e:void 0},Eo=async s=>{const{initialTasks:e,probe:t,registeredEntries:r,taskGraph:c,visVersion:o}=s,i=new Map,d=new Map,u=new Map;for(const x of r)if(dn(x.pid)){if(x.visVersion!==o){d.set(x.id,x);continue}i.set(x.id,x)}if(t){const x=[...i.values()],D=await Promise.all(x.map(async F=>{try{return[F.id,await t(F)]}catch{return[F.id,!1]}}));for(const[F,N]of D)if(!N){const re=i.get(F);i.delete(F),re&&u.set(F,re)}}const p=new Set(e.map(x=>x.id)),f=new Set,m=[],a=[],k=new Set;for(const x of Object.values(c.dependencies))for(const D of x)k.add(D);for(const[x,D]of Object.entries(c.tasks)){if(!Io(D)?.service)continue;if(i.has(x)){f.add(x),a.push(i.get(x));continue}if(p.has(x)||!k.has(x))continue;const re=d.get(x),C=u.get(x);let P;re?P=`Service ${x} is registered with vis ${re.visVersion}, but this invocation is vis ${o}. Restart with \`vis service restart ${x}\` to pick up the new version.`:C?P=`Service ${x} is registered (PID ${String(C.pid)}) but failed its readiness probe — the wrapper process is alive but the underlying server is not responding. Run \`vis service restart ${x}\` to recover.`:P=`Target depends on the service ${x}, which is not running. Run \`vis service start ${x}\` first, or invoke \`${x}\` directly.`,m.push({message:P,targetId:x})}if(f.size===0)return{diagnostics:m,initialTasks:e,satisfiedServices:a,serviceDependentsByServiceId:new Map,serviceEnvByTaskId:new Map,taskGraph:c};const S=new Map,M=x=>{const D=new Set,F=[...c.dependencies[x]??[]],N=new Set;for(;F.length>0;){const re=F.pop();if(!N.has(re)){N.add(re),f.has(re)&&D.add(re);for(const C of c.dependencies[re]??[])N.has(C)||F.push(C)}}return[...D].sort()},Z=new Map;for(const x of Object.keys(c.dependencies)){if(f.has(x))continue;const D=M(x);if(D.length===0)continue;const F={};for(const N of D){const re=i.get(N);if(!re)continue;Object.assign(F,re.env);const C=Z.get(N);C?C.push(x):Z.set(N,[x])}Object.keys(F).length>0&&S.set(x,F)}for(const x of Z.values())x.sort();const b={};for(const[x,D]of Object.entries(c.tasks))f.has(x)||(b[x]=D);const g={};for(const[x,D]of Object.entries(c.dependencies))f.has(x)||(g[x]=D.filter(F=>!f.has(F)));const $=new Map;for(const x of Object.keys(b))$.set(x,0);for(const x of Object.values(g))for(const D of x)$.has(D)&&$.set(D,($.get(D)??0)+1);const _=[];for(const x of c.roots)!f.has(x)&&b[x]&&_.push(x);for(const[x,D]of $)D===0&&!_.includes(x)&&b[x]&&_.push(x);const H=e.filter(x=>!f.has(x.id));return{diagnostics:m,initialTasks:H,satisfiedServices:a,serviceDependentsByServiceId:Z,serviceEnvByTaskId:S,taskGraph:{dependencies:g,roots:_,tasks:b}}},Ro=s=>s.startsWith("./")||s.startsWith("../")||s.startsWith("/")||s.startsWith("**"),Po=s=>{let e=s.trim();if(e==="")return;let t=!1,r=!1,c=!1;e.startsWith("...")&&(t=!0,e=e.slice(3),e.startsWith("^")&&(c=!0,e=e.slice(1))),e.endsWith("...")&&(r=!0,e=e.slice(0,-3),e.endsWith("^")&&(c=!0,e=e.slice(0,-1)));let o;const i=/\[([^\]]*)\]$/.exec(e);i&&(o=i[1]??"",e=e.slice(0,i.index));let d=e.trim(),u=!1;return d.startsWith("{")&&d.endsWith("}")&&d.length>=2?(d=d.slice(1,-1),u=!0):Ro(d)&&(u=!0),{changedSince:o,excludeSelf:c,includeDependencies:r,includeDependents:t,isPath:u,pattern:d}},bt=s=>{let e=s.replaceAll("\\","/");return e.startsWith("./")&&(e=e.slice(2)),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e},Mo=(s,e,t)=>s===""?!1:xt(s,e)?!0:t!==void 0&&xt(s,t),Fo=(s,e)=>{if(e===void 0||e==="")return!1;const t=bt(s),r=bt(e);return xt(t,r)},Oo=(s,e,t)=>{const{affected:r,downstream:c,upstream:o}=yr(s,t,{downstream:e.includeDependents?"deep":"none",upstream:e.includeDependencies?"deep":"none"});if(!e.excludeSelf)return r;const i=new Set([...c,...o]);for(const d of s)i.delete(d);return i},Ao=async(s,e)=>{const{packageNameByProject:t,projectGraph:r}=e,c=Object.keys(r.nodes);let o=new Set;if(s.pattern!=="")for(const i of c)s.isPath?Fo(s.pattern,r.nodes[i]?.data.root)&&o.add(i):Mo(s.pattern,i,t?.get(i))&&o.add(i);if(s.changedSince!==void 0){const i=s.changedSince===""?e.defaultBase??"main":s.changedSince,d=e.changedProjectsForRef??Lo(e),u=new Set(await d(i));o=s.pattern===""?u:new Set([...o].filter(p=>u.has(p)))}return!s.includeDependents&&!s.includeDependencies?o:Oo(o,s,r)},Lo=s=>async e=>{const{projectGraph:t,workspaceRoot:r}=s;if(!r)return[];let c;try{c=await xr(r,e,"HEAD")}catch(i){const d=i instanceof Error?i.message:String(i);throw new Error(`vis run --filter: invalid changed-since ref "${e}" (${d})`,{cause:i})}const o=new Set;for(const[i,d]of Object.entries(t.nodes)){const u=bt(d.data.root??i);if(!(u===""||u==="."))for(const p of c){const f=wr(r,p).replaceAll("\\","/");if(f===u||f.startsWith(`${u}/`)){o.add(i);break}}}return[...o]},Do=async(s,e)=>{const t=new Set;for(const r of s)for(const c of await Ao(r,e))t.add(c);return[...t]},Bo=async(s,e)=>{const t=[];for(const r of s){const c=Po(r);c&&t.push(c)}return Do(t,e)},nt="[[VIS_BOOT]]",_o=250,No=1e3,Ss=3,Go=s=>{try{return process.kill(s,0),!0}catch{return!1}},Ts=s=>{try{const e=Ne(s,"utf8").trim(),t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:null}catch{return null}};class Ho{#e;#r;#s;#n;#t=new Map;#i=new Map;#o=new Map;#c=new Map;#a=new Set;constructor(e){this.#e=e.indexToId,this.#r=new Map(e.services),this.#s=e.sink,this.#n=e.workspaceRoot}onProcessEvent=e=>{if(e.kind!=="stdout"&&e.kind!=="stderr")return;const t=this.#e.get(e.index);t===void 0||e.text===void 0||this.onTaskOutput(t,e.text)};onTaskOutput(e,t){if(!this.#r.has(e))return;const o=((this.#t.get(e)??"")+t).split(`
|
|
50
50
|
`),i=o.pop()??"";this.#t.set(e,i);for(const d of o)this.#d(e,d)}notifyRegistryStarting(e){this.#s.starting(e)}notifyRegistryStarted(e,t){this.#s.started(e,t)}onRegistryTaskStarted(e){this.#r.get(e)?.mode==="registry"&&this.notifyRegistryStarting(e)}async onRegistryTaskClosed(e,t,r){if(this.#r.get(e)?.mode!=="registry")return;if(r||t!==0){this.notifyRegistryFailed(e,"exit-code",{exitCode:t,killed:r});return}const o=await un(this.#n,e);if(!o){this.notifyRegistryFailed(e,"missing-registry-entry");return}const{config:i}=o,d=i.readiness?.tcp?.port??i.port??0,u=i.readiness?.tcp?.host??"127.0.0.1";this.notifyRegistryReady(e,{host:u,logFile:o.logFile,pid:o.pid,port:d})}notifyRegistryReady(e,t){this.#s.ready(e,{host:t.host,port:t.port}),this.#h(e,t.logFile),t.pid!==null&&this.#p(e,t.pid)}notifyRegistryFailed(e,t,r){this.#s.failed(e,t,r)}async retry(e){const t=this.#r.get(e);if(t){if(this.#f(e),this.#t.delete(e),this.#i.delete(e),this.#s.starting(e),t.mode==="registry"){await this.#y(e,t.registry);return}t.mode==="ephemeral"&&this.#v(e,t.ephemeral)}}async dispose(){for(const e of[...this.#o.keys(),...this.#c.keys()])this.#f(e);this.#a.size>0&&(await Promise.race([Promise.all(this.#a),new Promise(e=>{setTimeout(e,2e3)})]),this.#a.clear()),this.#t.clear(),this.#i.clear()}#d(e,t){if(t.startsWith(nt)){this.#u(e,t.slice(nt.length));return}const r=this.#i.get(e)??[];r.push(t),r.length>Ss&&r.shift(),this.#i.set(e,r),this.#s.log(e,`${t}
|
|
51
51
|
`)}#u(e,t){let r;try{r=JSON.parse(t)}catch{this.#s.log(e,`${nt+t}
|
|
52
52
|
`);return}switch(r.event){case"failed":{const c=typeof r.reason=="string"?r.reason:"unknown",o={};for(const[i,d]of Object.entries(r))i!=="event"&&i!=="id"&&i!=="reason"&&(o[i]=d);this.#s.failed(e,c,o);break}case"ready":{const c=typeof r.host=="string"?r.host:"127.0.0.1",o=typeof r.port=="number"?r.port:0;this.#s.ready(e,{host:c,port:o}),this.#l(e);break}case"started":{const c=typeof r.pid=="number"?r.pid:null;this.#s.started(e,c);break}default:this.#s.log(e,`${nt+t}
|
|
53
53
|
`)}}#l(e){const t=this.#r.get(e);if(t?.ephemeral===void 0)return;this.#h(e,t.ephemeral.logFile);const r=Ts(t.ephemeral.pidFile);r!==null&&this.#p(e,r)}#h(e,t){if(this.#o.has(e)||!Oe(t))return;const r=en(t,"r"),c=(()=>{try{return ns(t).size}catch{return 0}})(),o={fd:r,logFile:t,pollTimer:setInterval(()=>{this.#g(e)},_o),position:c};this.#o.set(e,o)}#g(e){const t=this.#o.get(e);if(t)try{const r=ns(t.logFile);if(r.size<=t.position)return;const c=Buffer.alloc(r.size-t.position),o=tn(t.fd,c,0,c.length,t.position);if(o>0){t.position+=o;const i=c.subarray(0,o).toString("utf8");for(const d of i.split(`
|
|
54
54
|
`))d.length!==0&&this.#w(e,d);this.#s.log(e,i)}}catch{}}#w(e,t){const r=this.#i.get(e)??[];for(r.push(t);r.length>Ss;)r.shift();this.#i.set(e,r)}#p(e,t){if(this.#c.has(e))return;const r={pid:t,timer:setInterval(()=>{if(!Go(t)){const c=[...this.#i.get(e)??[]];this.#f(e),this.#s.crashed(e,c)}},No)};this.#c.set(e,r)}#f(e){const t=this.#o.get(e);if(t){clearInterval(t.pollTimer);try{sn(t.fd)}catch{}this.#o.delete(e)}const r=this.#c.get(e);r&&(clearInterval(r.timer),this.#c.delete(e))}#v(e,t){if(t===void 0)return;const r=Ts(t.pidFile);if(r!==null)try{process.kill(-r,"SIGTERM")}catch{}const c=Jn("node",[t.scriptPath,t.configFile],{cwd:t.cwd,stdio:["ignore","pipe","pipe"]});c.stdout.on("data",i=>{this.#m(e,i)}),c.stderr.on("data",i=>{this.#m(e,i)}),c.on("error",i=>{this.#s.failed(e,"respawn-error",{message:i.message})});const o=new Promise(i=>{const d=()=>{this.#a.delete(o),i()};c.once("exit",d),c.once("error",d)});this.#a.add(o)}#m(e,t){const o=((this.#t.get(e)??"")+t.toString("utf8")).split(`
|
|
55
|
-
`),i=o.pop()??"";this.#t.set(e,i);for(const d of o)this.#d(e,d)}async#y(e,t){if(t!==void 0){try{await fn({id:e,workspaceRoot:this.#n})}catch{}try{const r=await hn({command:t.command,config:t.config,cwd:t.cwd,env:t.env,id:e,workspaceRoot:this.#n}),c=t.config.readiness?.tcp?.port??t.config.port??0,o=t.config.readiness?.tcp?.host??"127.0.0.1";this.#s.started(e,r.entry.pid),this.notifyRegistryReady(e,{host:o,logFile:r.entry.logFile,pid:r.entry.pid,port:c})}catch(r){const c=r instanceof Error?r.message:String(r);this.#s.failed(e,"retry-failed",{message:c})}}}}const
|
|
55
|
+
`),i=o.pop()??"";this.#t.set(e,i);for(const d of o)this.#d(e,d)}async#y(e,t){if(t!==void 0){try{await fn({id:e,workspaceRoot:this.#n})}catch{}try{const r=await hn({command:t.command,config:t.config,cwd:t.cwd,env:t.env,id:e,workspaceRoot:this.#n}),c=t.config.readiness?.tcp?.port??t.config.port??0,o=t.config.readiness?.tcp?.host??"127.0.0.1";this.#s.started(e,r.entry.pid),this.notifyRegistryReady(e,{host:o,logFile:r.entry.logFile,pid:r.entry.pid,port:c})}catch(r){const c=r instanceof Error?r.message:String(r);this.#s.failed(e,"retry-failed",{message:c})}}}}const Wo=s=>{const e=s.overrides.visOptions;return e&&typeof e=="object"?e:void 0},Zs=(s,e,t)=>{const r=[],c=[];for(const o of e){const i=t.tasks[o];if(!i){c.push({id:o,reason:"task not in graph"});continue}const d=i.overrides.command;if(!d){c.push({id:o,reason:"no command resolved"});continue}const u=Wo(i);if(!u?.service){c.push({id:o,reason:"no service config"});continue}const p=Ct(s,i.projectRoot,!!u.runFromWorkspaceRoot),{envFile:f}=u,m=f===void 0||f===!1?{}:Pn(p,f),a=u.service.env??{};r.push({command:d,config:u.service,cwd:p,env:{...m,...a},id:o})}return{services:r,skipped:c}},qo=(s,e)=>{const t=new Set(s),r=new Map;for(const i of s){const d=(e.dependencies[i]??[]).filter(u=>t.has(u));r.set(i,new Set(d))}const c=[],o=new Set;for(;r.size>0;){const i=[];for(const[d,u]of r){for(const p of u)o.has(p)&&u.delete(p);u.size===0&&i.push(d)}i.length===0&&i.push(...r.keys());for(const d of i)o.add(d),r.delete(d);i.sort(),c.push({ids:i})}return c},Vo=(s,e)=>{const t=[];for(const r of qo(s,e))t.push(...r.ids);return t},Uo=String.raw`import { spawn } from "node:child_process";
|
|
56
56
|
import { closeSync, openSync, readFileSync, readSync, statSync, writeFileSync } from "node:fs";
|
|
57
57
|
import { createConnection } from "node:net";
|
|
58
58
|
|
|
@@ -166,26 +166,26 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
|
166
166
|
try { process.kill(-child.pid, "SIGTERM"); } catch {}
|
|
167
167
|
process.exit(1);
|
|
168
168
|
})();
|
|
169
|
-
`,zo=()=>{const s=rn(le(Yn(),"vis-services-")),e=le(s,"bootstrap.mjs");return _s(e,
|
|
169
|
+
`,zo=()=>{const s=rn(le(Yn(),"vis-services-")),e=le(s,"bootstrap.mjs");return _s(e,Uo),{runDir:s,scriptPath:e}},er=(s,e,t)=>{const r=t.replaceAll(/[^\w-]/g,"_");return{configFile:le(s,`${r}.json`),logFile:le(s,`${r}.log`),pidFile:le(s,`${r}.pid`),scriptPath:e}},Yo=s=>{const{paths:e,service:t}=s,r=t.config.readiness?.tcp?.port??t.config.port;if(typeof r!="number")throw new TypeError(`Service ${t.id} has no TCP readiness port — declare \`service.port\` or \`service.readiness.tcp.port\`.`);const c={...t.env,PATH:jr(t.cwd,t.env)};return{command:t.command,cwd:t.cwd,env:c,host:t.config.readiness?.tcp?.host??"127.0.0.1",id:t.id,logFile:e.logFile,pidFile:e.pidFile,port:r,timeoutMs:t.config.readiness?.tcp?.timeoutMs??3e4}},Ko=s=>`node ${JSON.stringify(s.scriptPath)} ${JSON.stringify(s.configFile)}`,Xo=s=>{const{id:e,visBin:t,workspaceRoot:r}=s;return`node ${JSON.stringify(t)} service start ${JSON.stringify(e)} --cwd ${JSON.stringify(r)}`},Jo=s=>{const{missingServiceIds:e,mode:t,taskGraph:r,visBin:c,workspaceRoot:o}=s,{services:i,skipped:d}=Zs(o,e,r);if(i.length===0)return{chain:[],ephemeralPidFiles:[],runDir:void 0,serviceEnvByTaskId:new Map,skipped:d};const u=Vo(i.map(b=>b.id),r),p=new Map(i.map(b=>[b.id,b])),f=[],m=[];if(t==="ephemeral")for(const b of u){const g=p.get(b);g&&m.push({id:b,payload:Yo({paths:{logFile:"",pidFile:""},service:g})})}let a;t==="ephemeral"&&(a=zo());let k;for(const b of u){const g=p.get(b),$=r.tasks[b];if(!g||!$)continue;let _;if(t==="ephemeral"){const H=er(a.runDir,a.scriptPath,b),D={...m.find(F=>F.id===b).payload,logFile:H.logFile,pidFile:H.pidFile};_s(H.configFile,JSON.stringify(D)),_=Ko(H),f.push(H.pidFile)}else _=Xo({id:b,visBin:c,workspaceRoot:o});if($.overrides={...$.overrides,command:_},$.cache=!1,r.tasks[b]=$,k!==void 0){const H=r.dependencies[b]??[];H.includes(k)||(r.dependencies[b]=[...H,k])}k=b}const S=new Set(u),M=new Map,Z=b=>{const g=new Set,$=[...r.dependencies[b]??[]],_=new Set;for(;$.length>0;){const H=$.pop();if(!_.has(H)){_.add(H),S.has(H)&&g.add(H);for(const x of r.dependencies[H]??[])_.has(x)||$.push(x)}}return[...g].sort()};for(const b of Object.keys(r.dependencies)){if(S.has(b))continue;const g=Z(b);if(g.length===0)continue;const $={};for(const _ of g){const H=p.get(_);H?.config.env&&Object.assign($,H.config.env)}Object.keys($).length>0&&M.set(b,$)}return{chain:u,ephemeralPidFiles:f,runDir:a?.runDir,serviceEnvByTaskId:M,skipped:d}},Qo=new Set(["auto","ephemeral","off","persistent"]),Zo=s=>s.cli!==void 0?"cli":s.config===void 0?"default":"config",ec=s=>{const{cli:e,config:t,isCi:r,isPersistentTarget:c,isTty:o,target:i}=s;if(e!==void 0&&!Qo.has(e))throw new Error(`--services: expected one of auto|ephemeral|persistent|off, got "${e}"`);const d=e??t??(o&&!r?"auto":"off");return d==="off"?"off":d==="ephemeral"?"ephemeral":d==="persistent"?"registry":c||i==="dev"?"ephemeral":"registry"},tr=s=>s.replace(/^--?/u,""),tc=new Set(["0","1","false","no","true","yes"]),sc=s=>!s.startsWith("-")||/^-(?:\d|\.\d)/u.test(s),$s=(s,e,t,r,c,o)=>{if(r!==void 0)return s.set(e,r),0;const i=c[o+1];return(t?.type??"string")==="boolean"?i!==void 0&&tc.has(i.toLowerCase())?(s.set(e,i.toLowerCase()),1):(s.set(e,"true"),0):i!==void 0&&sc(i)?(s.set(e,i),1):(s.set(e,"true"),0)},rc=(s,e)=>{const t=s.type??"string";if(t==="number"){const r=e.trim(),c=Number(r);return r===""||!Number.isFinite(c)?{error:`--${s.name} expects a number, got "${e}"`}:{value:c}}if(t==="boolean")return["1","true","yes"].includes(e.toLowerCase())?{value:!0}:["0","false","no"].includes(e.toLowerCase())?{value:!1}:{error:`--${s.name} expects a boolean, got "${e}"`};if(t==="enum"){const r=s.choices??[];return r.includes(e)?{value:e}:{error:`--${s.name} must be one of [${r.join(", ")}], got "${e}"`}}return{value:e}},nc=s=>{const e=[],t=new Set;for(const r of s){const c=r.name||"<unnamed>";(!r.name||!/^[a-zA-Z][\w-]*$/u.test(r.name))&&e.push(`argument name "${c}" is empty or invalid (start with a letter; use letters, digits, '-', '_')`),t.has(r.name)&&e.push(`duplicate argument name "${c}"`),t.add(r.name),r.alias!==void 0&&r.alias.length!==1&&e.push(`argument "${c}" alias "${r.alias}" must be a single character`);const o=r.type??"string";if(o==="enum"&&(r.choices===void 0||r.choices.length===0)&&e.push(`argument "${c}" has type "enum" but declares no choices`),r.default!==void 0){const i=typeof r.default;o==="number"&&i==="number"||o==="boolean"&&i==="boolean"||(o==="string"||o==="enum")&&i==="string"?o==="enum"&&r.choices&&!r.choices.includes(r.default)&&e.push(`argument "${c}" default "${String(r.default)}" is not one of its choices`):e.push(`argument "${c}" default ${JSON.stringify(r.default)} does not match type "${o}"`)}}return e},ic=(s,e)=>{const t=new Map,r=new Map;for(const p of s)t.set(p.name,p),p.alias&&r.set(p.alias,p);const c=new Map,o=[];for(let p=0;p<e.length;p+=1){const f=e[p];if(f==="--"){o.push(...e.slice(p+1));break}if(f.startsWith("--no-")){c.set(tr(f.slice(5)),"false");continue}const m=/^--([^=]+)(?:=(.*))?$/su.exec(f);if(m){const S=m[1];p+=$s(c,S,t.get(S),m[2],e,p);continue}const a=/^-([^=-])(?:=(.*))?$/su.exec(f),k=a?.[1];if(a&&k!==void 0){const S=r.get(k);p+=$s(c,S?.name??k,S,a[2],e,p);continue}o.push(f)}const i={},d=[];let u=0;for(const p of s){let f=c.get(p.name);if(f===void 0&&p.positional&&u<o.length&&(f=o[u],u+=1),f===void 0){p.default!==void 0?i[p.name]=p.default:p.required&&d.push(`missing required argument --${p.name}`);continue}const{error:m,value:a}=rc(p,f);m?d.push(m):a!==void 0&&(i[p.name]=a)}return{errors:d,values:i}},oc=s=>`VIS_ARG_${tr(s).replaceAll(/[^a-zA-Z0-9]+/gu,"_").toUpperCase()}`,cc=s=>{const e={};for(const[t,r]of Object.entries(s))e[oc(t)]=String(r);return e},yt=(s,e,t)=>{const r=[`Usage: vis run ${s} [-- <args>]`];if(e&&r.push("",e),t.length===0)return r.join(`
|
|
170
170
|
`);r.push("","Arguments:");const c=t.map(i=>{const d=i.positional?`<${i.name}>`:`--${i.name}`,u=i.alias?`, -${i.alias}`:"";return{left:`${d}${u}`,right:i}}),o=Math.max(...c.map(i=>i.left.length));for(const{left:i,right:d}of c){const u=[],p=d.type??"string";u.push(p==="enum"?`enum(${(d.choices??[]).join("|")})`:p),d.required&&u.push("required"),d.default!==void 0&&u.push(`default: ${String(d.default)}`);const f=`${d.description??""}${d.description?" ":""}[${u.join(", ")}]`;r.push(` ${i.padEnd(o)} ${f}`)}return r.join(`
|
|
171
|
-
`)},ac=(s,e,t,r)=>{if(!t||t.length===0)return{env:{},kind:"ok"};const c=nc(t);if(c.length>0)return{errors:c.map(i=>`invalid \`arguments\` schema for "${s}": ${i}`),help:yt(s,e,t),kind:"invalid"};if(r.includes("--help")||r.includes("-h"))return{kind:"help",text:yt(s,e,t)};const o=ic(t,r);return o.errors.length>0?{errors:o.errors,help:yt(s,e,t),kind:"invalid"}:{env:cc(o.values),kind:"ok"}},lc=2e3,Cs=async(s,e,t)=>{const{workspaceRoot:r}=e,c=s.map(g=>{const $=St(g,e.affectedFiles,Fs());if(!$)return;const _=g.overrides.visOptions,
|
|
171
|
+
`)},ac=(s,e,t,r)=>{if(!t||t.length===0)return{env:{},kind:"ok"};const c=nc(t);if(c.length>0)return{errors:c.map(i=>`invalid \`arguments\` schema for "${s}": ${i}`),help:yt(s,e,t),kind:"invalid"};if(r.includes("--help")||r.includes("-h"))return{kind:"help",text:yt(s,e,t)};const o=ic(t,r);return o.errors.length>0?{errors:o.errors,help:yt(s,e,t),kind:"invalid"}:{env:cc(o.values),kind:"ok"}},lc=2e3,Cs=async(s,e,t)=>{const{workspaceRoot:r}=e,c=s.map(g=>{const $=St(g,e.affectedFiles,Fs());if(!$)return;const _=g.overrides.visOptions,H=Ct(r,g.projectRoot,!!_?.runFromWorkspaceRoot),x=ki({interactive:!!t,taskPty:g.pty,workspacePty:_?.pty}),D=Qe(e,g);return{command:$,cwd:H,env:D.env,inheritEnv:D.inheritEnv,name:g.id,...x?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}}).filter(g=>g!==void 0);if(c.length===0)return;if(!t){await it(c,{killOthers:["failure"],onEvent:()=>{}});return}const{abortSignal:o,lifeCycle:i,stdinRegistry:d,store:u}=t,p=c.map(g=>s.find($=>$.id===g.name)).filter(Boolean),f=g=>c[g]?.stdin==="pty",m=new Map,a=g=>{if(!f(g))return;let $=m.get(g);return $||($=new Tt(ut),m.set(g,$)),$};u.unmarkDone(),i.startTasks?.(p);const k=new Map,S=new Map;let M;const Z=()=>{for(const g of S.values())try{g("SIGTERM")}catch{}M||(M=setTimeout(()=>{for(const g of S.values())try{g("SIGKILL")}catch{}S.clear()},2e3),M.unref?.())};let b;o&&(b=()=>{Z()},o.then(()=>{b?.()}).catch(()=>{b?.()}));try{await it(c,{killOthers:["failure"],onEvent:g=>{const $=p[g.index];if($)switch(g.kind){case"close":{const _=k.get($.id)??Date.now(),H=g.killed||g.exitCode===0?"success":"failure";i.endTasks?.([{code:g.exitCode??0,endTime:Date.now(),startTime:_,status:H,task:$,terminalOutput:u.getSnapshot().outputs.get($.id)??""}]),S.delete(g.index),d?.delete($.id);break}case"error":{if(g.message){const _=a(g.index);_?(_.write(`${g.message}
|
|
172
172
|
`),u.setOutput($.id,_.toString())):u.addOutput($.id,`${g.message}
|
|
173
173
|
`)}break}case"started":{k.set($.id,Date.now()),g.kill&&S.set(g.index,g.kill),g.write&&d&&d.set($.id,{kill:g.kill,resize:g.resize,write:g.write});break}case"stderr":case"stdout":{if(g.text){const _=a(g.index);_?(_.write(g.text),u.setOutput($.id,_.toString())):u.addOutput($.id,`${g.text}
|
|
174
174
|
`)}break}default:}}})}finally{M&&(clearTimeout(M),M=void 0),u.markDone()}},Is=s=>{try{return process.kill(-s,0),!0}catch{try{return process.kill(s,0),!0}catch{return!1}}},dc=s=>{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,s)},uc=s=>{const{extraPids:e=[],pidFiles:t,runDir:r}=s,c=[],o=i=>{try{process.kill(-i,"SIGTERM")}catch{try{process.kill(i,"SIGTERM")}catch{}}};for(const i of t){let d;try{const u=vr(i),p=Number.parseInt(u.trim(),10);d=Number.isFinite(p)&&p>0?p:void 0}catch{continue}d!==void 0&&(c.push(d),o(d))}for(const i of e)!Number.isFinite(i)||i<=0||(c.push(i),o(i));if(c.length>0){const u=Date.now()+1500;for(;Date.now()<u;){let p=!0;for(const f of c)if(Is(f)){p=!1;break}if(p)break;dc(100)}for(const p of c)if(Is(p))try{process.kill(-p,"SIGKILL")}catch{try{process.kill(p,"SIGKILL")}catch{}}}r&&Xr(r)},ut=256*1024;class fc{#e;#r="";#s=!1;constructor(e){this.#e=e}append(e){this.#r+=e,this.#r.length>this.#e&&(this.#r=this.#r.slice(-this.#e),this.#s=!0)}toString(){return this.#s?`[...output truncated, showing last ${Math.round(this.#e/1024)}KB...]
|
|
175
|
-
${this.#r}`:this.#r}}const hc=s=>`'${s.replaceAll("'",String.raw`'\''`)}'`,Mt=s=>process.platform==="win32"?s.length>0&&!/[\s"&|<>^()%!]/.test(s)?s:`"${s.replaceAll('"','""')}"`:hc(s),pc=(s,e,t)=>{if(!e||e.length===0||t===!1||t===void 0)return s;if(t==="args"||t==="both"){const r=e.map(c=>Mt(c)).join(" ");return`${s} ${r}`}return s},sr="visForwardedArgs",mc=(s,e)=>{const t=e.overrides[sr];if(!Array.isArray(t)||t.length===0)return s;const r=t.map(c=>Mt(c)).join(" ");return`${s} ${r}`},St=(s,e,t)=>{const r=s.overrides.command;if(!r)return;const c=Je(s),o=s.segment!==void 0&&s.segment.index<s.segment.count,i=o?r:mc(r,s),d=o?i:pc(i,e,c?.affectedFiles),u=Os(c,t),p=c?.shellArgs,f=p&&p.length>0?p.join(" "):"-c";return u?`${u} ${f} ${Mt(d)}`:d},gc=async(s,e,t)=>{if(!e)return t();const r=s.get(e)??Promise.resolve();let c;const o=new Promise(d=>{c=d}),i=r.then(()=>o);s.set(e,i),await r;try{return await t()}finally{c(),s.get(e)===i&&s.delete(e)}},wc=s=>{let e=Math.max(0,Math.floor(s));return{claim(t){const r=Math.max(0,Math.min(t,e));return e-=r,r},get remaining(){return e}}},Es=s=>async(e,t)=>{const{hooks:r,lifeCycle:c,mutexPool:o,onOutput:i,onOutputReplace:d,resolveCommand:u,retryBudget:p,serviceEventBridge:f,spawnContext:m,stdinRegistry:a,strictEnvFailure:k,workspaceRoot:S}=s,M=Je(e),Z=Ct(S,t.cwd??e.projectRoot,M?.runFromWorkspaceRoot===!0),b=u(e);if(!b)return{code:0,terminalOutput:`No command configured for ${e.target.project}:${e.target.target}`};const g=Qe(m,e,t),$=k(e,b,t);if($!==void 0)return c?.onTaskStderr?.(e,$),{code:1,terminalOutput:$};const _=M?.pty===!0,
|
|
176
|
-
`;D.append(
|
|
175
|
+
${this.#r}`:this.#r}}const hc=s=>`'${s.replaceAll("'",String.raw`'\''`)}'`,Mt=s=>process.platform==="win32"?s.length>0&&!/[\s"&|<>^()%!]/.test(s)?s:`"${s.replaceAll('"','""')}"`:hc(s),pc=(s,e,t)=>{if(!e||e.length===0||t===!1||t===void 0)return s;if(t==="args"||t==="both"){const r=e.map(c=>Mt(c)).join(" ");return`${s} ${r}`}return s},sr="visForwardedArgs",mc=(s,e)=>{const t=e.overrides[sr];if(!Array.isArray(t)||t.length===0)return s;const r=t.map(c=>Mt(c)).join(" ");return`${s} ${r}`},St=(s,e,t)=>{const r=s.overrides.command;if(!r)return;const c=Je(s),o=s.segment!==void 0&&s.segment.index<s.segment.count,i=o?r:mc(r,s),d=o?i:pc(i,e,c?.affectedFiles),u=Os(c,t),p=c?.shellArgs,f=p&&p.length>0?p.join(" "):"-c";return u?`${u} ${f} ${Mt(d)}`:d},gc=async(s,e,t)=>{if(!e)return t();const r=s.get(e)??Promise.resolve();let c;const o=new Promise(d=>{c=d}),i=r.then(()=>o);s.set(e,i),await r;try{return await t()}finally{c(),s.get(e)===i&&s.delete(e)}},wc=s=>{let e=Math.max(0,Math.floor(s));return{claim(t){const r=Math.max(0,Math.min(t,e));return e-=r,r},get remaining(){return e}}},Es=s=>async(e,t)=>{const{hooks:r,lifeCycle:c,mutexPool:o,onOutput:i,onOutputReplace:d,resolveCommand:u,retryBudget:p,serviceEventBridge:f,spawnContext:m,stdinRegistry:a,strictEnvFailure:k,workspaceRoot:S}=s,M=Je(e),Z=Ct(S,t.cwd??e.projectRoot,M?.runFromWorkspaceRoot===!0),b=u(e);if(!b)return{code:0,terminalOutput:`No command configured for ${e.target.project}:${e.target.target}`};const g=Qe(m,e,t),$=k(e,b,t);if($!==void 0)return c?.onTaskStderr?.(e,$),{code:1,terminalOutput:$};const _=M?.pty===!0,H=!!a,x=e.pty===!0?!0:e.pty===!1?!1:H||_;x&&(e.cache=!1);const D=x?void 0:new fc(ut),F=x?new Tt(ut):void 0;let N;const re=P=>{if(P.kind==="started"&&(N=P.kill,P.write&&a&&a.set(e.id,{kill:P.kill,resize:P.resize,write:P.write}),f?.onRegistryTaskStarted(e.id)),(P.kind==="stdout"||P.kind==="stderr")&&P.text!==void 0)if(P.kind==="stdout"?c?.onTaskStdout?.(e,P.text):c?.onTaskStderr?.(e,P.text),F)F.write(P.text),H&&d?.(e.id,F.toString()),f&&f.onTaskOutput(e.id,P.text);else{const V=`${P.text}
|
|
176
|
+
`;D.append(V),i?.(e.id,V)}P.kind==="close"&&(a&&a.delete(e.id),f&&f.onRegistryTaskClosed(e.id,P.exitCode??0,!!P.killed).catch(()=>{}))},C=async()=>{const P=M?.retryCount??0,V=M?.retryDelay,te=p?p.claim(P):P,ge=typeof M?.timeout=="number"&&M.timeout>0?M.timeout:0,ie=typeof M?.killGracePeriodMs=="number"&&M.killGracePeriodMs>=0?M.killGracePeriodMs:5e3;let se=!1,ee=0;const ke=ko({killGracePeriodMs:ie,onTimeout:()=>{se=!0},sendSignal:fe=>{N?.(fe)},timeoutMs:ge});let de;try{de=await it([{command:b,cwd:Z,env:g.env,inheritEnv:g.inheritEnv,name:e.id,...x?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:re,...te>0?{restart:{delay:V??"exponential",onRetry:async(fe,ae,be)=>{ee=fe,r&&await r.callHook("task:retry",e,fe,be)},tries:te}}:{}})}finally{ke.cancel()}const G=de.closeEvents[0],W=F?F.toString():D.toString();return se?{code:124,retryAttempts:ee,terminalOutput:`${W}
|
|
177
177
|
[timeout] Task "${e.id}" exceeded ${ge}ms budget.
|
|
178
|
-
`}:{code:G?.exitCode??1,retryAttempts:ee,terminalOutput:
|
|
178
|
+
`}:{code:G?.exitCode??1,retryAttempts:ee,terminalOutput:W}};return o?gc(o,M?.mutex,C):C()},vc=s=>{if(!s||s.trim().length===0)return;const e=Number.parseFloat(s);return!Number.isFinite(e)||e<=0?{invalid:s}:{value:Math.floor(e)}},yc=async(s,e)=>{const t=await Pr(s,{dataDirectory:ot(s)});if(!t){e.warn(`No previous run recorded yet. Run a task at least once to populate ${Mr(s,{dataDirectory:ot(s)})}.`);return}const r=(t.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${t.startTime} (${r}s)`),e.info(""),e.info(` Total: ${String(t.stats.total)}`),e.info(` Succeeded: ${String(t.stats.succeeded)}`),e.info(` Cached: ${String(t.stats.cached)}`),e.info(` Failed: ${String(t.stats.failed)}`),e.info(` Skipped: ${String(t.stats.skipped)}`),e.info(""),t.stats.failed>0){const o=t.tasks.filter(i=>i.exitCode!==void 0&&i.exitCode!==0);e.info("Failed tasks:");for(const i of o){const d=i.duration??0;e.info(` × ${i.taskId} (exit ${String(i.exitCode??-1)}, ${d}ms)`)}e.info("")}const c=[...t.tasks].filter(o=>typeof o.duration=="number").sort((o,i)=>(i.duration??0)-(o.duration??0)).slice(0,5);if(c.length>0){e.info("Slowest tasks:");for(const o of c)e.info(` ${o.taskId.padEnd(40)} ${String(o.duration??0).padStart(6)}ms [${o.cacheStatus}]`);e.info("")}},xc=s=>{if(!(s===void 0||s==="")){if(s!=="read"&&s!=="write"&&s!=="readwrite")throw new Error(`--cache-mode must be one of: read, write, readwrite (received "${s}")`);return s}},jc=s=>{if(!(s===void 0||s==="")){if(s!=="http"&&s!=="reapi")throw new Error(`--cache-backend must be one of: http, reapi (received "${s}")`);return s}},kc=s=>{if(!(s===void 0||s==="")){if(s!=="declared"&&s!=="trace")throw new Error(`--hash-mode must be one of: declared, trace (received "${s}")`);return s}},Xc=async({argument:s,logger:e,options:t,visConfig:r,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const o=c;if(an({options:t,visConfig:r},o),Kn(o),t.lastDetails){await yc(o,e);return}const i=process.cwd(),d=await zr(o,r),{config:u,fileOwners:p,packageJsons:f,projectOptions:m,workspace:a}=Yr(o,r,d),k=Kr(o,a,f);let S=s[0];if(!S){const h=is(a);if(process.stdout.isTTY&&process.stdin.isTTY){const v=await jn(h);if(!v){e.info("No target selected.");return}S=v,await wo(`vis run ${v}`)}else throw e.info("Available targets:"),e.info(""),e.info(kn(h)),e.info(""),new Fe("Missing target. Usage: vis run <target>")}if(u.constraints&&!t.skipConstraints){const h=kr(k,u.constraints);if(h.length>0){for(const v of h)e.error(`[${v.rule}] ${v.message}`);throw new Error(`${h.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(!t.affected){const h=t.uncommitted?"--uncommitted":"--no-uncommitted",v=[["--base",t.base],["--head",t.head],["--downstream",t.downstream],["--upstream",t.upstream],[h,t.uncommitted]].filter(([,y])=>y!==void 0).map(([y])=>y);if(v.length>0)throw new Fe(`${v.join(", ")} ${v.length===1?"requires":"require"} --affected.
|
|
179
179
|
Did you mean: vis run ${S} --affected ${v.map(y=>y.includes("uncommitted")?y:`${y}=…`).join(" ")}
|
|
180
180
|
Or use the dedicated command: vis affected ${S} …`)}const M=await In(S,a,process.cwd(),o),Z=bn(m),b=Sn(M.target,Z);b!==M.target&&e.debug?.(`Resolved alias "${M.target}" → "${b}"`);let g=M.projects;const $=s.slice(1).map(String);t.projects!==void 0&&(g=Tn(g,String(t.projects),Object.keys(a.projects)));const _=h=>{if(t.ifPresent){e.info(`${h}; skipping (--if-present).`);return}throw new Fe(`${h}.
|
|
181
181
|
|
|
182
|
-
Pass --if-present to skip quietly when nothing matches.`)};if(t.filter&&t.filter.length>0){const h=new Map;for(const[T,B]of f)h.set(T,B.name);const v=await Bo(t.filter,{defaultBase:r?.defaultBase,packageNameByProject:h,projectGraph:k,workspaceRoot:o}),y=new Set(v);if(g=g.filter(T=>y.has(T)),g.length===0){_(`Filter ${t.filter.map(T=>`"${T}"`).join(", ")} matched no projects`);return}}if(t.query&&(g=En(g,a,t.query),g.length===0)){_(`Query "${String(t.query)}" matched no projects`);return}if(t.tag&&t.tag.length>0&&(g=Rn(g,a,t.tag),g.length===0)){_(`Tag filter ${t.tag.map(h=>`"${h}"`).join(", ")} matched no projects`);return}let
|
|
182
|
+
Pass --if-present to skip quietly when nothing matches.`)};if(t.filter&&t.filter.length>0){const h=new Map;for(const[T,B]of f)h.set(T,B.name);const v=await Bo(t.filter,{defaultBase:r?.defaultBase,packageNameByProject:h,projectGraph:k,workspaceRoot:o}),y=new Set(v);if(g=g.filter(T=>y.has(T)),g.length===0){_(`Filter ${t.filter.map(T=>`"${T}"`).join(", ")} matched no projects`);return}}if(t.query&&(g=En(g,a,t.query),g.length===0)){_(`Query "${String(t.query)}" matched no projects`);return}if(t.tag&&t.tag.length>0&&(g=Rn(g,a,t.tag),g.length===0)){_(`Tag filter ${t.tag.map(h=>`"${h}"`).join(", ")} matched no projects`);return}let H;if(t.affected){const h=await xn({base:t.base,downstream:t.downstream,head:t.head,uncommitted:t.uncommitted,upstream:t.upstream},{fileOwners:p,projectGraph:k,projects:a.projects,workspaceRoot:o},{affectedIgnore:r?.affectedIgnore,defaultBase:r?.defaultBase});for(const T of h.notes)e.info(`▸ ${T}`);if(h.changedFiles.length===0){e.info("No files changed. Nothing to run.");return}const v=new Set(h.affectedProjects);if(g=g.filter(T=>v.has(T)),g.length===0){e.info("No projects affected by the changes.");return}const y=new Set(h.ignoredFiles);H=h.changedFiles.filter(T=>!y.has(T)),e.info(`Affected projects: ${g.join(", ")}`)}const x=Fs(),D=process.env[Qn],F=H??(D?D.split(`
|
|
183
183
|
`).filter(Boolean):void 0),N=(typeof t.runnerTags=="string"?t.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,re=N?new Set(N.split(",").map(h=>h.trim()).filter(Boolean)):void 0,C=[],P=new Map;for(const h of g){const y=m.get(h)?.[b];if(!y)continue;const T=y.options;if(!T?.internal){if(!Mn(T,!!Ke)){e.debug?.(`Skipping ${h}:${b} — runInCI filter`);continue}if(!Fn(T,re)){e.debug?.(`Skipping ${h}:${b} — runner-tags filter`);continue}C.push(h),P.set(h,y)}}if(C.length===0){if(t.ifPresent){e.info(`No projects have the "${b}" target; skipping (--if-present).`);return}const h=is(a),v=Object.entries(a.projects).filter(([,T])=>T.targets?.[b]!==void 0).map(([T])=>T),y=[`No projects have the "${b}" target.`];if(v.length>0)y.push("",`Target "${b}" exists in these projects but was filtered out:`,...v.slice(0,5).map(T=>` - ${T}`)),v.length>5&&y.push(` …and ${v.length-5} more`);else{const T=$n(b,h,3);T.length>0&&y.push("",T.length===1?`Did you mean "${T[0]}"?`:`Did you mean one of: ${T.map(B=>`"${B}"`).join(", ")}?`),y.push("","Run `vis run` without arguments to see all available targets, or pass --if-present to skip when no project has the target.")}throw new Fe(y.join(`
|
|
184
|
-
`))}const
|
|
185
|
-
`))}const y=oe.diagnostics.map(A=>A.targetId),T=v,B=T==="registry"?Zs(o,y,
|
|
186
|
-
${J(o)}`);const{buildCacheAttestationHooks:A}=await import("./cache-attestation.js");Ie.remoteCache.attestation=A({expectedIdentity:y,onReject:(z,Y)=>{e.warn(`[vis run] remote cache entry ${z.slice(0,12)} rejected: attestation ${Y}. Treating as a cache miss.`)},onVerifyFailure:z=>{e.warn(`[vis run] attestation verification failed: ${z}`)},requireOnDownload:T,workspaceRoot:o})}}else(t.cacheMode||t.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts (or TURBO_API env); ignoring.");const ar=process.stdout.isTTY&&!Ke,lr=r?.run?.quietOnSuccess===!0,dr=u.tui?.autoExit??(lr?3:!1),Nt={args:{parallel:Ie.parallel,targets:[b]},autoExit:dr,projectNames:C,tasks:[...G,...
|
|
184
|
+
`))}const V=t.pty,te=C.map(h=>({project:h,schema:P.get(h)?.arguments})).filter(h=>Array.isArray(h.schema)&&h.schema.length>0),ge=new Map;for(const{project:h,schema:v}of te){const y=JSON.stringify(v),T=ge.get(y)??[];T.push(h),ge.set(y,T)}if(ge.size>1){const h=[...ge.values()].map(v=>v.join(", ")).join(" | ");throw new Error(`Target "${b}" declares conflicting \`arguments\` schemas across projects (${h}). Run a single project (e.g. \`vis run ${te[0]?.project}:${b}\` or --projects=<name>) so the argument contract is unambiguous.`)}const ie=te[0]?.schema,se=P.get(te[0]?.project??C[0])?.description,ee=ac(b,se,ie,$);if(ee.kind==="help"){e.info(ee.text);return}if(ee.kind==="invalid"){e.info(`Invalid arguments for "${b}":`);for(const h of ee.errors)e.info(` ✖ ${h}`);throw e.info(""),e.info(ee.help),new Error(`Invalid arguments for target "${b}"`)}const ke=ee.env,de=kc(t.hashMode);let G=C.map(h=>{const v=a.projects[h],y=P.get(h),T={project:h,target:b},B=`${h}:${b}`,J=V?{...y.options,pty:y.options?.pty??!0}:y.options,O=y.command?Zt(y.command,{affectedFiles:F,projectRoot:v?.root}):y.command,A=v?.root&&v.root.length>0?v.root:".",z=(y.outputs??[]).map(R=>typeof R!="string"?R:R.replaceAll("{projectRoot}",A).replaceAll("{projectName}",h)),Y=xi(y.options);return Y.length>0&&e.warn(ji(B,Y)),{cache:y.cache,declaresInputs:y.inputs!==void 0,fingerprintEnv:y.fingerprintEnv,hashMode:de??y.hashMode,id:B,outputs:z,overrides:{command:O,...$.length>0?{[sr]:$}:{},...Object.keys(ke).length>0?{[Zn]:ke}:{},...J?{visOptions:J}:{}},parallelism:y.parallelism,projectRoot:v?.root,splitCompound:y.splitCompound,target:T,untrackedEnv:y.untrackedEnv}});const W=[],fe=[];for(const h of G)Je(h)?.persistent?(h.cache=!1,W.push(h)):fe.push(h);G=fe;const ae=br(t.partition);if(ae&&(G=Sr.partitionTasks(G,ae),e.info(`Partition ${ae.index}/${ae.total}: running ${G.length} task(s)`),G.length===0)){e.info("No tasks assigned to this partition.");return}const be=new Set([...G,...W].map(h=>h.id));let q=Tr([...G,...W],{onCycleBroken:h=>{e.warn(`Ignoring dev-only dependency cycle (build order is ambiguous): ${h.join(" → ")}`)},onUnmatchedProjectSelector:h=>{e.warn(`dependsOn.projects entry "${h}" matched no project — that dependency edge was not created.`)},projectGraph:k,targetDefaults:u.tasks,workspace:a});for(const[h,v]of Object.entries(q.tasks)){const y=v.target.project,T=v.target.target,B=m.get(y)?.[T];if(!B){be.has(h)||e.warn(`${T} required via dependsOn but no command is configured for ${y} — skipping (no-op).`);continue}const J=a.projects[y];let O=!1;const A={...v.overrides};A.visOptions===void 0&&B.options&&(A.visOptions=B.options,O=!0),A.command===void 0&&B.command&&(A.command=Zt(B.command,{affectedFiles:F,projectRoot:J?.root}),O=!0),O&&(v.overrides=A,q.tasks[h]=v)}if(typeof t.skipCache=="string"&&t.skipCache.trim()!=="")if(t.cache){const h=Si(t.skipCache,a,Object.keys(q.tasks));for(const v of h.skipTaskIds){const y=q.tasks[v];y!==void 0&&(y.cache=!1)}h.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${h.unmatchedPatterns.map(v=>`"${v}"`).join(", ")}`),h.skipTaskIds.size>0&&e.debug?.(`--skip-cache: bypassing cache for ${String(h.skipTaskIds.size)} task(s)`)}else e.debug?.("--skip-cache ignored: --no-cache already disables caching for the whole run");await ln(o,u.toolchain,{error:h=>{e.error(h)},info:h=>{e.info(h)},warn:h=>{e.warn(h)}},!!t.skipToolchain);const He=t.preflight!==!1&&u.preflight?.lockfile!==!1,We=Qr(o,Ke,{warn:h=>{e.warn(h)}},{skip:!He});if(!We.shouldContinue)throw new Error(`${We.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);He&&!Ke&&process.stdin.isTTY&&process.stdout.isTTY&&await vi(o,{interactive:!0,logger:{info:h=>{e.info(h)},warn:h=>{e.warn(h)}},projectManifests:[...f.values()]});const Ze=process.env.VIS_VERSION??"0.0.0",et=t.dryRun?void 0:async h=>{try{return await pn(h.config,{timeoutMs:lc}),!0}catch{return!1}},tt=await mn(o),oe=await Eo({initialTasks:[...G,...W],probe:et,registeredEntries:tt,taskGraph:q,visVersion:Ze}),Se=[];let Ce,we=0;const Te=[],Me=new Map;let I=[];const j=new Set;let E=null,X=null;if(oe.diagnostics.length>0){const h=!!(process.stdout.isTTY&&process.stdin.isTTY),v=t.dryRun?"off":ec({cli:t.services,config:u.run?.services,isCi:!!Ke,isPersistentTarget:W.length>0,isTty:h,target:b});if(v==="off"){for(const Y of oe.diagnostics)e.error(Y.message);const A=Zo({cli:t.services,config:u.run?.services}),z=[];throw t.dryRun?z.push("`--dry-run` never starts services; drop it to let vis boot them."):A==="default"?z.push("vis only auto-starts service deps in an interactive terminal by default (this run is CI or non-TTY).","Pass `--services=ephemeral` to boot them for this run, or set `run.services` in vis.config.ts."):A==="cli"?z.push("`--services=off` was passed; use `--services=ephemeral` to boot them for this run."):z.push('`run.services: "off"` is set in vis.config.ts; override it with `--services=ephemeral`.'),new Fe([`${oe.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`,...z].join(`
|
|
185
|
+
`))}const y=oe.diagnostics.map(A=>A.targetId),T=v,B=T==="registry"?Zs(o,y,q):void 0,J=process.argv[1]??"vis",O=Jo({missingServiceIds:y,mode:T,taskGraph:q,visBin:J,workspaceRoot:o});if(O.skipped.length>0){for(const{id:A,reason:z}of O.skipped)e.error(`Cannot auto-start ${A}: ${z}`);throw new Fe(`${O.skipped.length} service(s) cannot be auto-started — invoke them directly or add a service config.`)}Se.push(...O.ephemeralPidFiles),Ce=O.runDir,I=O.chain;for(const A of O.chain)j.add(A);if(T==="registry"&&(we=O.chain.length,Te.push(...O.chain)),O.chain.length>0){const A=new ps(O.chain),z=new Map;if(T==="ephemeral"&&O.runDir)for(const Y of O.chain){const R=er(O.runDir,`${O.runDir}/bootstrap.mjs`,Y);z.set(Y,{ephemeral:{configFile:R.configFile,cwd:o,logFile:R.logFile,pidFile:R.pidFile,scriptPath:R.scriptPath},mode:"ephemeral"})}else if(T==="registry"&&B)for(const Y of B.services)z.set(Y.id,{mode:"registry",registry:{command:Y.command,config:Y.config,cwd:Y.cwd,env:Y.env}});if(z.size>0){const Y=new Ho({indexToId:new Map,services:z,sink:{crashed:(R,L)=>{A.markCrashed(R,L)},failed:(R,L,U)=>{A.markFailed(R,L,U)},log:(R,L)=>{A.appendLog(R,L)},ready:(R,L)=>{A.markReady(R,L)},started:(R,L)=>{A.markStarted(R,L),T==="registry"&&L!==null&&Me.set(R,L)},starting:R=>{A.markStarting(R)}},workspaceRoot:o});E=A,X=Y}}for(const[A,z]of O.serviceEnvByTaskId){const Y=oe.serviceEnvByTaskId.get(A)??{};oe.serviceEnvByTaskId.set(A,{...Y,...z})}}const Le=new Set(W.map(h=>h.id));if(G=oe.initialTasks.filter(h=>!Le.has(h.id)),q=oe.taskGraph,I.length>0&&(G=[...I.map(v=>q.tasks[v]).filter(v=>v!==void 0),...G]),W.length>0){const h=new Set(W.map(J=>J.id)),v={};for(const[J,O]of Object.entries(q.tasks))h.has(J)||(v[J]=O);const y={};for(const[J,O]of Object.entries(q.dependencies))h.has(J)||(y[J]=O.filter(A=>!h.has(A)));const T=new Set;for(const J of Object.values(y))for(const O of J)T.add(O);const B=Object.keys(v).filter(J=>!T.has(J));q={dependencies:y,roots:B,tasks:v}}const{serviceEnvByTaskId:rr}=oe;if(oe.satisfiedServices.length>0){const h=oe.satisfiedServices.map(v=>v.id).join(", ");if(e.debug?.(`Auto-attached to running services: ${h}`),E)for(const v of oe.satisfiedServices)E.registerService(v.id);else E=new ps(oe.satisfiedServices.map(v=>v.id));for(const v of oe.satisfiedServices){const y=v.config.readiness?.tcp?.port??v.config.port??0,T=v.config.readiness?.tcp?.host??"127.0.0.1";E.markReady(v.id,{host:T,port:y})}}t.reverse&&(q=$r(q),e.debug?.(`Reversed task graph: ${String(q.roots.length)} new root(s) (originally leaves)`));for(const h of Object.values(q.tasks)){const v=m.get(h.target.project)?.[h.target.target]?.options;h.splitCompound&&Os(v)!==void 0&&(e.warn(`splitCompound ignored for ${h.id}: it uses a custom shell. Running the command as one unit.`),h.splitCompound=void 0)}if(q=Cr(q,{commandOf:h=>h.overrides.command,onDiagnostic:(h,v)=>{e.warn(v)}}),t.dryRun){const h=Object.keys(q.tasks).length,v=q.roots.length;e.info(`Execution plan (${String(h)} task(s), ${String(v)} root(s)):`),e.info("");const y=new Set,T=(B,J)=>{if(y.has(B))return;y.add(B);for(const L of q.dependencies[B]??[])T(L,J+1);const O=q.tasks[B],A=" ".repeat(J+1),z=O?.segment?` (segment ${String(O.segment.index)}/${String(O.segment.count)}: ${String(O.overrides.command)})`:"",Y=O?.hashMode==="trace"||u.taskRunner?.autoFingerprint===!0,R=`${O?.cache===!1?" (no-cache)":""}${Y?" (trace)":""}${z}`;e.info(`${A}${B}${R}`)};for(const B of q.roots)T(B,0);for(const B of Object.keys(q.tasks))T(B,0);W.length>0&&(e.info(""),e.info(` + ${String(W.length)} persistent task(s) (run after graph completes)`)),e.info("");return}const Ft=Date.now(),$e=gn(),Ot=(h,v)=>{const y=v instanceof Error?v.message:String(v);e.warn(`Plugin error in ${h}: ${y}`)};await wn($e,u.plugins);const qe=typeof t.profile=="string"?t.profile:void 0,At=async h=>{if(!qe)return;const v=ss(h,q,Ft),y=qe.startsWith("/")?qe:`${o}/${qe}`;await Or(v,y),e.info(`Profile written to ${qe}`)},st=u.taskRunner??{},nr=Nr(o,t.cacheDir,st.cacheDirectory,u.sharedWorktreeCache),ir=Gr(nr,o,u.branchScopedCache),De=vc(process.env.VIS_RUN_CONCURRENCY_LIMIT);De&&"invalid"in De&&e.warn(`VIS_RUN_CONCURRENCY_LIMIT=${De.invalid} is not a positive number; falling back to default concurrency.`);const or=De&&"value"in De?De.value:void 0,Lt=t.parallel??or??3,cr=t.strictEnv??u.strictEnv??!1,Dt=new Set,Ie={dryRun:t.dryRun??!1,parallel:Lt,skipNxCache:!t.cache,summarize:t.summarize??!1,...st,cacheDirectory:ir,dataDirectory:st.dataDirectory??ot(o),namedInputs:u.namedInputs,onDiagnostic:(h,v)=>{Dt.has(h)||(Dt.add(h),e.warn(v))},onFingerprint:async(h,v)=>{await $e.callHook("task:fingerprint",h,v)}},pt=h=>si(Ie.env,Je(h)?.env),je=ei({affectedFiles:F,childEnvPolicy:pt,initCwd:i,serviceEnvByTaskId:rr,taskSlots:Lt,workspaceRoot:o}),Ve=h=>St(h,F,x),mt=(h,v,y)=>{if(!(Je(h)?.strictEnv??cr))return;const B=Qe(je,h,y),J=je.childEnvPolicy(h),O=Ii({command:v,processEnv:J.mode==="clean"?Fr(process.env,J):process.env,taskEnv:B.env,taskId:h.id});return O?Ei(O):void 0},Bt=(h,v)=>{const y=Ve(h);return y===void 0?void 0:mt(h,y,v)},_t=Ir(st.remoteCache);if(_t){const h=xc(t.cacheMode),v=jc(t.cacheBackend);if(Ie.remoteCache={..._t,...h?{mode:h}:{},...v?{backend:v}:{}},Ie.remoteCache.attestation){const{expectedIdentity:y,requireOnDownload:T}=Ie.remoteCache.attestation;if(!(y!==void 0&&("github"in y&&typeof y.github?.ref=="string"&&typeof y.github.repo=="string"&&typeof y.github.workflow=="string"||"oidcIssuer"in y&&typeof y.oidcIssuer=="string"&&(typeof y.san=="string"||typeof y.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 y&&(!y.sanRegex.startsWith("^")||!y.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:J,isSigstoreInstalled:O}=await import("./loader.js");O()||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:
|
|
186
|
+
${J(o)}`);const{buildCacheAttestationHooks:A}=await import("./cache-attestation.js");Ie.remoteCache.attestation=A({expectedIdentity:y,onReject:(z,Y)=>{e.warn(`[vis run] remote cache entry ${z.slice(0,12)} rejected: attestation ${Y}. Treating as a cache miss.`)},onVerifyFailure:z=>{e.warn(`[vis run] attestation verification failed: ${z}`)},requireOnDownload:T,workspaceRoot:o})}}else(t.cacheMode||t.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts (or TURBO_API env); ignoring.");const ar=process.stdout.isTTY&&!Ke,lr=r?.run?.quietOnSuccess===!0,dr=u.tui?.autoExit??(lr?3:!1),Nt={args:{parallel:Ie.parallel,targets:[b]},autoExit:dr,projectNames:C,tasks:[...G,...W].flatMap(h=>{const v=Object.values(q.tasks).filter(y=>y.segment!==void 0&&y.id.startsWith(`${h.id}#`));return v.length>0?v:[h]}),totalTaskCount:Object.keys(q.tasks).length+W.length},Gt=typeof t.retryBudget=="number"?t.retryBudget:void 0,Ht=Gt===void 0?void 0:wc(Gt),Wt=new vn($e,Ot),qt=new cn(o),Vt=po(t.outputStyle,r?.run?.quietOnSuccess);if(oe.satisfiedServices.length>0)for(const h of oe.satisfiedServices){const v=oe.serviceDependentsByServiceId.get(h.id)??[];try{await $e.callHook("service:attach",h,v)}catch(y){Ot("service:attach",y)}}await $e.callHook("run:before",{tasks:G,workspaceRoot:o});const Ue=t.stopServices;let Ut=!1;const zt=()=>{if(Ut)return;Ut=!0,X&&X.dispose().catch(()=>{});const h=Ue?[...Me.values()]:void 0;uc({extraPids:h,pidFiles:Se,runDir:Ce})},rt=()=>{zt()},Yt=Se.length>0||Ce!==void 0||Ue&&Te.length>0;Yt&&(process.on("SIGINT",rt),process.on("SIGTERM",rt));try{if(ar){const h=new Map,v=go({...Nt,onRetryService:X?R=>X.retry(R):void 0,outputStyle:Vt,serviceDockStore:E,stdinRegistry:h}),{lifeCycle:y,store:T}=v,B=new es([y,Wt,qt]),O=Es({hooks:$e,lifeCycle:B,mutexPool:new Map,onOutput:(R,L)=>{X&&j.has(R)?X.onTaskOutput(R,L):T.addOutput(R,L)},onOutputReplace:(R,L)=>{T.setOutput(R,L)},resolveCommand:Ve,retryBudget:Ht,serviceEventBridge:X??void 0,spawnContext:je,stdinRegistry:h,strictEnvFailure:mt,workspaceRoot:o});let A="rerun",z=null,Y=new Map;for(;A!=="quit";){if(A==="rerun"){if(Y=await ts(G,Ie,{childEnvPolicy:pt,lifeCycle:B,preTraceCheck:Bt,projectGraph:k,resolveChildEnv:(R,L)=>Qe(je,R,L),resolveCommand:Ve,taskExecutor:O,taskGraph:q,workspaceRoot:o}),W.length>0&&!t.failFast){const R=new Promise(L=>{const U=T.subscribe(()=>{const ce=T.getSnapshot();(ce.rerunRequested||ce.retryTaskId)&&(U(),L())});v.renderIsDone.then(()=>{U(),L()}).catch(()=>{U(),L()})});await Cs(W,je,{abortSignal:R,lifeCycle:B,stdinRegistry:h,store:T})}}else if(A==="retry"&&z){const R=q.tasks[z]??G.find(U=>U.id===z),L=R?St(R,je.affectedFiles,x):void 0;if(R&&L){B.startTasks?.([R]);const U=new Tt(ut),ce=ti(je,R),he=(await it([{command:L,cwd:ce.cwd,env:ce.env,inheritEnv:ce.inheritEnv,name:R.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:ne=>{ne.kind==="started"&&ne.write&&h.set(R.id,{kill:ne.kill,resize:ne.resize,write:ne.write}),(ne.kind==="stdout"||ne.kind==="stderr")&&ne.text&&(U.write(ne.text),T.setOutput(R.id,U.toString())),ne.kind==="close"&&h.delete(R.id)}})).closeEvents[0];B.endTasks?.([{code:he?.exitCode??1,status:he?.exitCode===0?"success":"failure",task:R,terminalOutput:T.getSnapshot().outputs.get(R.id)}])}else R&&B.endTasks?.([{code:1,status:"failure",task:R,terminalOutput:`No command configured for ${R.id}`}]);z=null,T.markDone()}A=await new Promise(R=>{const L=T.subscribe(()=>{const U=T.getSnapshot();U.rerunRequested&&(T.acknowledgeRerun(),L(),R("rerun")),U.retryTaskId&&(z=T.acknowledgeRetry(),L(),R("retry"))});v.renderIsDone.then(()=>{L(),R("quit")}).catch(()=>{L(),R("quit")})})}await v.renderIsDone,await $e.callHook("run:after",Y),await At(Y),we>0&&(e.info(""),Ue?e.info(`${String(we)} service(s) stopped (--stop-services).`):e.info(`${String(we)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}else{const h=new Map,v=typeof t.log=="string"?t.log.toLowerCase():"",y=v==="labeled"||v==="grouped"||v==="interleaved"?v:void 0,T=y?Er(y):void 0,B=new es([new mo({...Nt,ciGrouping:r?.run?.ciGrouping??"auto",logReporter:T,outputStyle:Vt}),Wt,qt]),J=Es({hooks:$e,lifeCycle:B,mutexPool:h,resolveCommand:Ve,retryBudget:Ht,serviceEventBridge:X??void 0,spawnContext:je,strictEnvFailure:mt,workspaceRoot:o}),O=async()=>{const L=Date.now(),U=await ts(G,Ie,{childEnvPolicy:pt,lifeCycle:B,preTraceCheck:Bt,projectGraph:k,resolveChildEnv:(pe,Be)=>Qe(je,pe,Be),resolveCommand:Ve,taskExecutor:J,taskGraph:q,workspaceRoot:o}),ce=Date.now()-L;if(t.summarize){const pe=ss(U,q,Ft);await Rr(pe,o,{dataDirectory:ot(o)})}let ve=!1;for(const[,pe]of U)pe.status==="failure"&&(ve=!0);const he=Hr(U,ce),ne=Wr(o),Ee=qr(o,ce,ne);return e.info(""),e.info(` ${he}${Ee?` ${Ee}`:""}`),{hasFailure:ve,results:U,runHistory:ne}},A=await O();await $e.callHook("run:after",A.results),await At(A.results);const{hasFailure:z}=A;if(t.watch){const L=C.map(ue=>{const Re=a.projects[ue]?.root;if(Re)return Re.startsWith("/")?Re:`${o}/${Re}`}).filter(ue=>ue!==void 0),U=G;let ce;const ve=ue=>{const ye=bo(U,ue);return ce=ye.filter,G=ye.tasks,ye.tasks.length};let he=!1,ne=A.results;const Ee=()=>{const ue=as(ne,o);if(ue.directories.length>0&&ue.files.size>0){const ye=Xn(ue.files,o,ue.directories);return{handle:ls({filter:ye,onChange:Be,paths:ue.directories}),mode:"tracked"}}return{handle:ls({onChange:Be,paths:L}),mode:"roots"}};let pe;const Be=async ue=>{if(!he){he=!0;try{e.info(`Change detected in ${ue.length} file(s), rerunning…`),ne=(await O()).results,pe?.close(),pe=Ee().handle}finally{he=!1}}},Kt=Ee();pe=Kt.handle;const ur=Kt.mode==="tracked"?`Watching ${String(as(ne,o).files.size)} tracked file(s)`:`Watching ${String(L.length)} project root(s)`;e.info(`${ur} — edit a file to rerun, press h for keybinds, q to quit.`);const gt=async()=>{if(!he){he=!0;try{if(G.length===0){e.info("No tasks match the active filter — press a to clear it.");return}ne=(await O()).results,pe?.close(),pe=Ee().handle}finally{he=!1}}};await new Promise(ue=>{let ye=!1,Re;const Xt=()=>{Jt()},Jt=()=>{ye||(ye=!0,Re?.close(),process.off("SIGINT",Xt),pe?.close(),ue())};process.on("SIGINT",Xt),Re=Co({handlers:{onClearFilter:async()=>{const ze=ve(void 0);e.info(`Filter cleared — running ${String(ze)} task(s).`),await gt()},onFilter:async ze=>{const fr=ce,Qt=ve(ze);if(Qt===0){e.info(`Filter "${ze}" matched no projects — keeping previous filter.`),ve(fr);return}e.info(`Filter "${ze}" matched ${String(Qt)} task(s).`),await gt()},onHelp:()=>{To(process.stdout)},onQuit:()=>{Jt()},onRerun:gt}})});return}if(t.flaky){const L=Vr(o,{minRuns:2},A.runHistory);if(L.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const U of Ur(L))e.info(` ${U}`);e.info("")}}const Y=[];for(const[L,U]of A.results)U.retryAttempts&&U.retryAttempts>0&&Y.push(L);const R=t.failOnRetry&&Y.length>0;if(R){const U=Y.slice(0,5),ce=Y.length-U.length,ve=ce>0?`${U.join(", ")}, and ${String(ce)} more`:U.join(", ");e.warn(""),e.warn(`--fail-on-retry: ${String(Y.length)} task(s) succeeded only after retry: ${ve}`)}if(z||R){const L=R&&!z?"Some tasks succeeded only after retry (--fail-on-retry).":"Some tasks failed.",U=2e3,ce=[];for(const[ve,he]of A.results){if(he.status!=="failure")continue;const ne=he.terminalOutput??"",Ee=ne.length>U?`…${ne.slice(-U)}`:ne,pe=he.code??"?";ce.push(` ${ve} (exit ${String(pe)}):
|
|
187
187
|
${Ee.split(`
|
|
188
188
|
`).map(Be=>` ${Be}`).join(`
|
|
189
189
|
`)}`)}throw new Fe(ce.length>0?`${L}
|
|
190
190
|
${ce.join(`
|
|
191
|
-
`)}`:L)}
|
|
191
|
+
`)}`:L)}W.length>0&&!t.failFast&&await Cs(W,je,void 0),we>0&&(e.info(""),Ue?e.info(`${String(we)} service(s) stopped (--stop-services).`):e.info(`${String(we)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}}finally{zt(),Yt&&(process.off("SIGINT",rt),process.off("SIGTERM",rt)),Ue&&Te.length>0&&await Promise.all(Te.map(async h=>{try{await yn(o,h)}catch{}}))}};export{wc as createRetryBudget,Xc as default};
|