@visulima/vis 1.0.0-alpha.13 → 1.0.0-alpha.14
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 +28 -0
- package/LICENSE.md +7242 -385
- package/dist/bin.js +1 -1
- package/dist/config/index.d.ts +493 -1
- package/dist/config/index.js +1 -1
- package/dist/packem_chunks/applyDefaults.js +2 -2
- package/dist/packem_chunks/bin.js +1134 -199
- package/dist/packem_chunks/doctor-probe.js +2 -2
- package/dist/packem_chunks/fix.js +11 -11
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +5 -5
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +20 -18
- package/dist/packem_chunks/handler15.js +1 -20
- 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 +5 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -5
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +5 -1
- package/dist/packem_chunks/handler23.js +1 -5
- package/dist/packem_chunks/handler24.js +3 -1
- package/dist/packem_chunks/handler25.js +1 -3
- package/dist/packem_chunks/handler26.js +1 -1
- package/dist/packem_chunks/handler27.js +7 -1
- package/dist/packem_chunks/handler28.js +22 -6
- package/dist/packem_chunks/handler29.js +3 -23
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +18 -3
- package/dist/packem_chunks/handler31.js +1 -1
- package/dist/packem_chunks/handler32.js +2 -2
- package/dist/packem_chunks/handler33.js +24 -24
- package/dist/packem_chunks/handler34.js +2 -2
- package/dist/packem_chunks/handler35.js +2 -2
- package/dist/packem_chunks/handler36.js +20 -20
- package/dist/packem_chunks/handler37.js +2 -2
- package/dist/packem_chunks/handler38.js +6 -22
- package/dist/packem_chunks/handler39.js +11 -11
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +5 -22
- package/dist/packem_chunks/handler41.js +24 -6
- package/dist/packem_chunks/handler42.js +10 -5
- package/dist/packem_chunks/handler43.js +153 -10
- package/dist/packem_chunks/handler44.js +25 -153
- package/dist/packem_chunks/handler45.js +3 -25
- package/dist/packem_chunks/handler46.js +27 -3
- package/dist/packem_chunks/handler47.js +41 -26
- package/dist/packem_chunks/handler48.js +32 -40
- package/dist/packem_chunks/handler5.js +7 -7
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +4 -4
- package/dist/packem_chunks/heal.js +3 -3
- package/dist/packem_chunks/help-command.js +18 -0
- package/dist/packem_chunks/index.js +4 -4
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/tar.js +1 -1
- package/dist/packem_shared/ai-analysis-Dzs_nUwM.js +68 -0
- package/dist/packem_shared/ai-cache-Dtvmbsru.js +1 -0
- package/dist/packem_shared/{ai-fix-nn4zOE95.js → ai-fix-BmLM72GS.js} +4 -4
- package/dist/packem_shared/cache-directory-xASJia6M.js +1 -0
- package/dist/packem_shared/dependency-scan-DmwPKwLy.js +2 -0
- package/dist/packem_shared/docker-CA-scYu0.js +2 -0
- package/dist/packem_shared/failure-log-fD4DiFb1.js +2 -0
- package/dist/packem_shared/flakiness-BIg1rwvp.js +1 -0
- package/dist/packem_shared/{giget-CcEy_Elm.js → giget-BX2ixMoa.js} +2 -2
- package/dist/packem_shared/index-OlP7U_t5.js +6 -0
- package/dist/packem_shared/lockfile-BXylopgH.js +1 -0
- package/dist/packem_shared/otelPlugin-y5hoCw4b.js +1 -0
- package/dist/packem_shared/registry-BHqKXiLb.js +2 -0
- package/dist/packem_shared/run-summary-utils-D39XBHWW.js +1 -0
- package/dist/packem_shared/runtime-check-BaKni2y1.js +1 -0
- package/dist/packem_shared/selectors-BvtUXWGY.js +3 -0
- package/dist/packem_shared/toolchain-B7sIiJxK.js +5 -0
- package/dist/packem_shared/typosquats-XkC1CnOa.js +1 -0
- package/dist/packem_shared/verify-BVTcVfoW.js +1 -0
- package/dist/packem_shared/{vis-update-app-D1jl0UZZ.js → vis-update-app-DR8c4OfG.js} +1 -1
- package/package.json +15 -30
- package/dist/packem_shared/ai-analysis-hm8d2W7z.js +0 -67
- package/dist/packem_shared/ai-cache-DoiF80AR.js +0 -1
- package/dist/packem_shared/cache-directory-CwHlJhgx.js +0 -1
- package/dist/packem_shared/dependency-scan-COr5n63B.js +0 -2
- package/dist/packem_shared/docker-D6OGr5_S.js +0 -2
- package/dist/packem_shared/failure-log-iUVLf6ts.js +0 -2
- package/dist/packem_shared/flakiness-D9wf0t56.js +0 -1
- package/dist/packem_shared/otel-DxDUPJJH.js +0 -6
- package/dist/packem_shared/otelPlugin-CQq6poq8.js +0 -1
- package/dist/packem_shared/registry-CkubDdiY.js +0 -2
- package/dist/packem_shared/run-summary-utils-BfBvjzhY.js +0 -1
- package/dist/packem_shared/runtime-check-BXZ43CBW.js +0 -1
- package/dist/packem_shared/selectors-BylODRiM.js +0 -3
- package/dist/packem_shared/toolchain-BgBOUHII.js +0 -5
- package/dist/packem_shared/typosquats-CcZl99B1.js +0 -1
- package/dist/packem_shared/verify-Baj5mFJ7.js +0 -1
|
@@ -1,27 +1,42 @@
|
|
|
1
|
-
var Ee=Object.defineProperty;var f=(e,t)=>Ee(e,"name",{value:t,configurable:!0});import{createRequire as Ae}from"node:module";import{isAccessibleSync as se,isFsCaseSensitive as je}from"@visulima/fs";import{isAbsolute as Fe,join as X,relative as D,basename as ve}from"@visulima/path";import{execa as ye}from"execa";import{o as ke}from"../packem_shared/index-DH-5hsrC.js";import{jsx as b,jsxs as C}from"react/jsx-runtime";import{Spinner as Ge,Text as $,Box as A,render as _e}from"@visulima/tui";import{C as be,D as B,T as Te}from"../packem_shared/symbols-CQmER5MT.js";import{dim as I,green as De,yellow as ne,cyan as K,red as Y}from"@visulima/colorize";const Me=Ae(import.meta.url),F=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ee=f(e=>{if(typeof F<"u"&&F.versions&&F.versions.node){const[t,r]=F.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return F.getBuiltinModule(e)}return Me(e)},"__cjs_getBuiltinModule"),{readFileSync:Oe,writeFileSync:Pe,unlinkSync:Re}=ee("node:fs"),{randomBytes:Ne}=ee("node:crypto"),{availableParallelism:ae}=ee("node:os");var He=Object.defineProperty,Le=f((e,t)=>He(e,"name",{value:t,configurable:!0}),"s$4");class O extends Error{static{f(this,"StagedError")}static{Le(this,"StagedError")}constructor(t,r){super(t,r),this.name=this.constructor.name}}var Be=Object.defineProperty,Ue=f((e,t)=>Be(e,"name",{value:t,configurable:!0}),"o$6");class qe extends O{static{f(this,"ApplyEmptyCommitError")}static{Ue(this,"ApplyEmptyCommitError")}}var Ve=Object.defineProperty,ze=f((e,t)=>Ve(e,"name",{value:t,configurable:!0}),"o$5");class T extends O{static{f(this,"ConfigError")}static{ze(this,"ConfigError")}}var We=Object.defineProperty,Ke=f((e,t)=>We(e,"name",{value:t,configurable:!0}),"t$1");class ie extends O{static{f(this,"GetBackupStashError")}static{Ke(this,"GetBackupStashError")}}var Ye=Object.defineProperty,Je=f((e,t)=>Ye(e,"name",{value:t,configurable:!0}),"s$3");class _ extends O{static{f(this,"GitError")}static{Je(this,"GitError")}stderr;constructor(t,r,n){super(t,n),this.stderr=r}}var Qe=Object.defineProperty,Xe=f((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"e");class oe extends O{static{f(this,"RestoreOriginalStateError")}static{Xe(this,"RestoreOriginalStateError")}}var Ze=Object.defineProperty,et=f((e,t)=>Ze(e,"name",{value:t,configurable:!0}),"o$2");class M extends O{static{f(this,"TaskError")}static{et(this,"TaskError")}commandTitle;constructor(t,r,n){super(r,n),this.commandTitle=t}}var tt=Object.defineProperty,q=f((e,t)=>tt(e,"name",{value:t,configurable:!0}),"i");const rt=q(async e=>{if(e.config!==void 0)return e.config;throw new T(`No staged config provided. Add \`staged\` to your vis.config.ts:
|
|
1
|
+
var Cr=Object.defineProperty;var S=(r,e)=>Cr(r,"name",{value:e,configurable:!0});import{createRequire as xr}from"node:module";import{runConcurrently as tt,TerminalBuffer as Vt,readLastRunSummary as Mr,enforceProjectConstraints as Er,expandTokensInString as jr,parsePartition as Rr,TaskScheduler as Or,createTaskGraph as Pr,reverseTaskGraph as _r,generateRunSummary as St,writeChromeTrace as Fr,CompositeLifeCycle as Ct,defaultTaskRunner as xt,createLogReporter as Ar,writeRunSummary as Lr}from"@visulima/task-runner";import{aA as Dr,p as It,aw as zt,b0 as Hr,av as Br,y as Nr,m as Gr,b1 as qr,b2 as Wr,s as ze,b3 as Ur}from"./bin.js";import{E as Vr,a as zr}from"../packem_shared/cache-directory-xASJia6M.js";import{M as Ce,Q as Kr,K as Qr,C as Qt,z as Xr}from"../packem_shared/index-OlP7U_t5.js";import{F as Zr}from"../packem_shared/failure-log-fD4DiFb1.js";import{f as Jr,l as eo,c as to,a as ro,b as oo}from"../packem_shared/flakiness-BIg1rwvp.js";import{r as so}from"../packem_shared/toolchain-B7sIiJxK.js";import{i as no,c as io,b as ao}from"../packem_shared/registry-BHqKXiLb.js";import{p as co,r as lo,f as uo}from"../packem_shared/selectors-BvtUXWGY.js";import{Box as p,Text as n,StaticRender as Mt,renderToString as re,ScrollView as Xt,Spinner as po,useApp as mo,useWindowSize as go,useInput as Et,Dialog as wo,render as ko}from"@visulima/tui";import N,{useSyncExternalStore as vo,useState as jt,useRef as Ee,useCallback as Ye,useEffect as Ke,useMemo as Rt}from"react";import{jsxs as u,jsx as l}from"react/jsx-runtime";import{T as Zt,C as rt,D as He,E as Jt}from"../packem_shared/symbols-CQmER5MT.js";const Ir=xr(import.meta.url),Me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,De=S(r=>{if(typeof Me<"u"&&Me.versions&&Me.versions.node){const[e,t]=Me.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return Me.getBuiltinModule(r)}return Ir(r)},"__cjs_getBuiltinModule"),{existsSync:Yt,statSync:Kt,watch:Yr}=De("node:fs"),{createInterface:ho,emitKeypressEvents:fo}=De("node:readline"),{appendFile:ot}=De("node:fs/promises"),{platform:yo,homedir:st}=De("node:os");var bo=Object.defineProperty,$o=S((r,e)=>bo(r,"name",{value:e,configurable:!0}),"u$3"),To=Object.defineProperty,So=$o((r,e)=>To(r,"name",{value:e,configurable:!0}),"v"),Co=Object.defineProperty,xo=So((r,e)=>Co(r,"name",{value:e,configurable:!0}),"D");const Io=xo((r,e,t,o,s,a,c,d,h,f,i,k,v,$)=>{const M={d:o,h:s,m:a,mo:e,ms:d,s:c,w:t,y:r};return h!==void 0&&(M.future=h),f!==void 0&&(M.past=f),i!==void 0&&(M.decimal=i),k!==void 0&&(M.unitMap=k),v!==void 0&&(M.groupSeparator=v),$!==void 0&&(M.placeholderSeparator=$),M},"createDurationLanguage"),Mo={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"},Eo=Io(r=>`year${r===1?"":"s"}`,r=>`month${r===1?"":"s"}`,r=>`week${r===1?"":"s"}`,r=>`day${r===1?"":"s"}`,r=>`hour${r===1?"":"s"}`,r=>`minute${r===1?"":"s"}`,r=>`second${r===1?"":"s"}`,r=>`millisecond${r===1?"":"s"}`,"in %s","%s ago",".",Mo,",","_");var jo=Object.defineProperty,Ro=S((r,e)=>jo(r,"name",{value:e,configurable:!0}),"o$3"),Oo=Object.defineProperty,Po=Ro((r,e)=>Oo(r,"name",{value:e,configurable:!0}),"o"),_o=Object.defineProperty,Fo=Po((r,e)=>_o(r,"name",{value:e,configurable:!0}),"o");const Ao=Fo(r=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const o of e)if(!Object.hasOwn(r,o))throw new TypeError(`Missing required property: ${o}`);if(typeof r.future!="string"||typeof r.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const o of t)if(typeof r[o]!="string"&&typeof r[o]!="function")throw new TypeError(`Property ${o} must be of type string or function`);if(r.decimal&&typeof r.decimal!="string")throw new TypeError("Property decimal must be of type string");if(r.delimiter&&typeof r.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(r._digitReplacements&&!Array.isArray(r._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(r._numberFirst&&typeof r._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(r.unitMap&&typeof r.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(r.unitMap&&Object.values(r.unitMap).some(o=>typeof o!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var Lo=Object.defineProperty,Do=S((r,e)=>Lo(r,"name",{value:e,configurable:!0}),"b$3"),Ho=Object.defineProperty,Bo=Do((r,e)=>Ho(r,"name",{value:e,configurable:!0}),"b"),No=Object.defineProperty,Re=Bo((r,e)=>No(r,"name",{value:e,configurable:!0}),"g");const er=Re((r,e)=>{e=e||-1;const t=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(e)}})?`).exec(r.toString());return t===null?r:Number.parseFloat(t[0])},"toFixed"),Ot=Re(({unitCount:r,unitName:e},t,o)=>{let{spacer:s}=o;const{maxDecimalPoints:a}=o;let c=".";o.decimal!==void 0?c=o.decimal:t.decimal!==void 0&&(c=t.decimal);let d;"digitReplacements"in o?d=o.digitReplacements:"_digitReplacements"in t&&(d=t._digitReplacements);let h,f=r;a!==void 0&&(f=er(r,a));const i=f.toString();if(!t._hideCountIf2||r!==2)if(d){h="";for(const $ of i)h+=$==="."?c:d[$]}else h=i.replace(".",c);else h="";const k=t[e];let v=k;return typeof k=="function"&&(v=k(r)),t._hideCountIf2&&r===2&&(s=""),t._numberFirst?v+s+h:h+s+v},"renderPiece"),Go=Re((r,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:o}=e,s=e.largest??Number.POSITIVE_INFINITY,a={};let c,d,h,f=r;for(d=0;d<t.length;d++){c=t[d];const k=o[c];h=d===t.length-1?f/k:Math.floor(f/k),a[c]=h,f-=h*k}if(e.round){let k=s;for(d=0;d<t.length;d++)if(c=t[d],h=a[c],h!==0&&(k--,k===0)){for(let v=d+1;v<t.length;v++){const $=t[v],M=a[$];a[c]=(a[c]??0)+M*o[$]/o[c],a[$]=0}break}for(d=t.length-1;d>=0;d--){if(c=t[d],h=a[c],h===0)continue;const v=Math.round(h);if(a[c]=v,d===0)break;const $=t[d-1],M=o[$],R=Math.floor(v*o[c]/M);if(R)a[$]=(a[$]??0)+R,a[c]=0;else break}}const i=[];for(d=0;d<t.length&&i.length<s;d++){if(c=t[d],h=a[c],h&&!e.round&&i.length===s-1){let k,v=0;for(k=d+1,t.length;k<t.length;k++){const $=t[k];v+=a[$]*(e.unitMeasures[$]/e.unitMeasures[c])}h+=v,e.maxDecimalPoints!==void 0&&(h=er(h,e.maxDecimalPoints))}h&&i.push({unitCount:h,unitName:c})}return i},"getPieces"),qo=Re((r,e,t)=>{const{language:o,units:s}=e;if(r.length===0){const k=s.at(-1);return Ot({unitCount:0,unitName:k},o,e)}const{conjunction:a,serialComma:c}=e;let d=", ";e.delimiter!==void 0?d=e.delimiter:o.delimiter!==void 0&&(d=o.delimiter);let h="";e.timeAdverb&&t!==0&&(h=o.future??"",t<0&&(h=o.past??""));const f=r.map(k=>Ot(k,o,e));let i;return!a||r.length===1?i=f.join(d):r.length===2?i=f.join(a):i=f.slice(0,-1).join(d)+(c?",":"")+a+(f.at(-1)??""),h&&(i=h.replace("%s",i)),i},"formatPieces"),tr=Re((r,e)=>{if(Number.isNaN(r))throw new TypeError("Expected a valid number");if(typeof r!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:Eo,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};Ao(t.language);const o=Math.abs(r),s=Go(o,t);return qo(s,t,r)},"duration");var Wo=Object.defineProperty,Be=S((r,e)=>Wo(r,"name",{value:e,configurable:!0}),"s$2");const Uo={bun:["bun.lock","bun.lockb"],npm:["package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},Vo={bun:["node_modules/.bun-tag"],npm:["node_modules/.package-lock.json"],pnpm:["node_modules/.modules.yaml","node_modules/.pnpm/lock.yaml"],yarn:["node_modules/.yarn-integrity","node_modules/.yarn-state.yml",".yarn/install-state.gz"]},zo={ci:{bun:"bun install --frozen-lockfile",npm:"npm ci",pnpm:"pnpm install --frozen-lockfile",yarn:"yarn install --immutable"},tty:{bun:"bun install",npm:"npm install",pnpm:"pnpm install",yarn:"yarn install"}},Yo=1e3,Ko=Be(r=>{for(const[e,t]of Object.entries(Uo))for(const o of t)if(Yt(Ce(r,o)))return{lockfileFile:o,manager:e}},"detectPackageManager"),Qo=Be((r,e)=>{let t;for(const o of Vo[e]){const s=Ce(r,o);if(!Yt(s))continue;const{mtimeMs:a}=Kt(s);(!t||a>t.mtimeMs)&&(t={mtimeMs:a,path:o})}return t},"findFreshestMarker"),Xo=Be((r,e={})=>{const t=Ko(r);if(!t)return{checked:!1};const{lockfileFile:o,manager:s}=t,a=Kt(Ce(r,o)).mtimeMs,c=Qo(r,s),d=zo[e.inCi?"ci":"tty"][s],h={installMarkerMtimeMs:c?.mtimeMs,lockfileMtimeMs:a,lockfilePath:o,marker:c?.path,packageManager:s};return c?a>c.mtimeMs+Yo?{checked:!0,detail:h,failure:"stale-install",message:`${o} is newer than node_modules (${c.path}) — run \`${d}\` to sync.`}:{checked:!0,detail:h}:{checked:!0,detail:h,failure:"missing-install",message:`lockfile detected but node_modules looks uninitialised — run \`${d}\` before \`vis run\`.`}},"checkLockfileFreshness"),Zo=Be((r,e,t,o={})=>{if(o.skip)return{checked:!1,shouldContinue:!0};const s=Xo(r,{inCi:e});if(!s.failure)return{...s,shouldContinue:!0};const a=`preflight: ${s.message??"lockfile drift detected"}`;return e&&!o.ciAsWarning?{...s,formattedMessage:a,shouldContinue:!1}:(t.warn(a),{...s,formattedMessage:a,shouldContinue:!0})},"runLockfilePreflight");var Jo=Object.defineProperty,rr=S((r,e)=>Jo(r,"name",{value:e,configurable:!0}),"p$5");const es=rr(r=>r.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),ts=rr((r,e,t)=>{const o=new Set,s=[];if(r===void 0||r.trim()==="")return{skipTaskIds:o,unmatchedPatterns:s};const a=[...t],c=new Set(a),d=new Map;for(const h of a){const f=h.lastIndexOf(":");if(f===-1)continue;const i=h.slice(f+1),k=d.get(i);k===void 0?d.set(i,[h]):k.push(h)}for(const h of es(r)){if(h.startsWith("~:"))throw new Error(`--skip-cache does not support the closest-project selector "~:" (received "${h}"). Use \`pkg:target\`, \`:target\`, or \`#tag:target\`.`);if(c.has(h)){o.add(h);continue}const f=co(h);if(!f){s.push(h);continue}let i=!1;if(f.kind==="all"){const k=d.get(f.target)??[];for(const v of k)o.add(v),i=!0}else if(f.kind==="project"){const k=f.projects?.[0];if(k!==void 0){const v=`${k}:${f.target}`;c.has(v)&&(o.add(v),i=!0)}}else if(f.kind==="tag"){const k=f.tag;if(k!==void 0){const v=d.get(f.target)??[];for(const $ of v){const M=$.slice(0,$.lastIndexOf(":"));e.projects[M]?.tags?.includes(k)===!0&&(o.add($),i=!0)}}}i||s.push(h)}return{skipTaskIds:o,unmatchedPatterns:s}},"resolveSkipCachePatterns");var rs=Object.defineProperty,nt=S((r,e)=>rs(r,"name",{value:e,configurable:!0}),"a$2");const os=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,ss=new Set(["0","!","#","$","*","-","?","@","_"]),ns=nt(r=>{const e=new Map;for(const t of r.matchAll(os)){const o=t[1],s=t[3],a=t[2],c=o??s;if(c===void 0||ss.has(c))continue;const d=a!==void 0,h=e.get(c);h===void 0?e.set(c,d):h&&!d&&e.set(c,!1)}return[...e.entries()].map(([t,o])=>({hasDefault:o,name:t}))},"extractEnvReferences"),is=nt(r=>{const{command:e,processEnv:t,taskEnv:o,taskId:s}=r,a=ns(e);if(a.length===0)return;const c=[];for(const{hasDefault:d,name:h}of a){if(d)continue;const f=o[h],i=t[h];f===void 0&&i===void 0&&c.push(h)}if(c.length!==0)return{missing:c.toSorted(),taskId:s}},"checkStrictEnv"),as=nt(r=>{const e=r.missing.map(t=>`$${t}`).join(", ");return`Strict env: ${r.taskId} references unset variable${r.missing.length===1?"":"s"} ${e}. Set ${r.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},"formatStrictEnvError");var cs=Object.defineProperty,we=S((r,e)=>cs(r,"name",{value:e,configurable:!0}),"i$2");const Pt=we(r=>{const e=new Set;for(const t of Object.values(r.projects))for(const o of Object.keys(t.targets??{}))e.add(o);return[...e].sort()},"collectAvailableTargets"),ls=we(r=>{const e=new Map;for(const t of r.values())for(const[o,s]of Object.entries(t))for(const a of s.aliases??[])e.has(a)||e.set(a,o);return e},"buildAliasMap"),ds=we((r,e)=>e.get(r)??r,"resolveTargetAlias"),us=we((r,e)=>{if(r.length===0)return e.length;if(e.length===0)return r.length;const t=[];for(let o=0;o<=e.length;o++)t[o]=[o];for(let o=0;o<=r.length;o++)t[0][o]=o;for(let o=1;o<=e.length;o++)for(let s=1;s<=r.length;s++){const a=e[o-1]===r[s-1]?0:1;t[o][s]=Math.min(t[o-1][s]+1,t[o][s-1]+1,t[o-1][s-1]+a)}return t[e.length][r.length]},"levenshtein"),hs=we((r,e,t=3)=>or(r,e,1,t)[0],"suggestTarget"),or=we((r,e,t=3,o=3)=>{const s=[];for(const a of e){const c=us(r.toLowerCase(),a.toLowerCase());c<=o&&s.push({distance:c,name:a})}return s.sort((a,c)=>a.distance-c.distance||a.name.localeCompare(c.name)),s.slice(0,t).map(a=>a.name)},"suggestTargets"),fs=we(r=>r.length===0?" (no targets found)":r.map(e=>` - ${e}`).join(`
|
|
2
|
+
`),"formatTargetList"),ps=we(async r=>{if(r.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const e=ho({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
|
|
3
|
+
`);for(const[s,a]of r.entries())process.stdout.write(` ${String(s+1).padStart(2," ")}. ${a}
|
|
4
|
+
`);process.stdout.write(`
|
|
5
|
+
`);const t=(await new Promise(s=>{e.question("Select a target (number or name, blank to cancel): ",s)})).trim();if(t.length===0)return;const o=Number.parseInt(t,10);return Number.isFinite(o)&&o>=1&&o<=r.length?r[o-1]:r.includes(t)?t:hs(t,r)}finally{e.close()}},"promptTargetInteractively");var ms=Object.defineProperty,it=S((r,e)=>ms(r,"name",{value:e,configurable:!0}),"i$1");const gs=it(r=>Array.isArray(r)?`[${r.join(",")}]`:typeof r=="object"&&r!==null?JSON.stringify(r):String(r),"formatValue"),ws=it((r,e,t)=>e==="_"?`${r}${Array.isArray(t)?t.join(" "):String(t)}`:`${r}--${e}=${gs(t)}`,"formatFlags"),at=it((r,e,t)=>{const o=new Set(new Set(t.map(v=>v.target.target))),s=new Set(new Set(t.map(v=>v.target.project))),a=e.filter(v=>o.has(v)),c=r.filter(v=>s.has(v)),d=t.length-c.length*a.length,h=a.length===1?"target":"targets",f=a.join(", "),i=c.length===1?`project ${c[0]}`:`${c.length} projects`;let k=`${h} ${f} for ${i}`;return d>0&&(k+=` and ${d} ${d===1?"task":"tasks"} ${d===1?"it depends":"they depend"} on`),k},"formatTargetsAndProjects");var ks=Object.defineProperty,vs=S((r,e)=>ks(r,"name",{value:e,configurable:!0}),"c$4");const ys={error:"red",info:"white",success:"green"},Ze=vs(({children:r,title:e,variant:t})=>{const o=ys[t];return u(p,{flexDirection:"column",children:[u(p,{gap:1,children:[l(n,{bold:!0,inverse:!0,children:" VIS "}),l(n,{bold:!0,color:o,children:"•"}),l(n,{children:e})]}),r]})},"Header");var bs=Object.defineProperty,$s=S((r,e)=>bs(r,"name",{value:e,configurable:!0}),"s$1");const sr=$s(({cached:r,failed:e,failedIds:t,projectNames:o,skippedIds:s,succeeded:a,targets:c,tasks:d,took:h})=>{const f=at(o,c,d);if(e===0&&(!s||s.length===0)){const i=r>0?` (${r} read from cache)`:"";return l(Mt,{children:S(()=>l(Ze,{title:`Successfully ran ${f}`,variant:"success",children:u(p,{flexDirection:"column",paddingLeft:2,children:[u(n,{children:[l(n,{color:"green",children:Zt})," ",a+r," ","tasks completed",i?l(n,{dimColor:!0,children:i}):null]}),u(n,{dimColor:!0,children:[" ","Took",h]})]})}),"children")})}return l(Mt,{children:S(()=>l(Ze,{title:`Ran ${f}`,variant:"error",children:u(p,{flexDirection:"column",paddingLeft:2,children:[s&&s.length>0&&u(p,{flexDirection:"column",children:[u(n,{dimColor:!0,children:[s.length," ","task",s.length===1?"":"s"," ","skipped (dependency failed or --bail)"]}),s.map(i=>u(n,{dimColor:!0,children:[" - ",i]},i)),l(n,{})]}),e>0&&u(p,{flexDirection:"column",children:[u(n,{children:[l(n,{color:"red",children:String(e)})," ","task",e===1?"":"s"," ","failed:"]}),t.map(i=>u(n,{children:[" ",l(n,{color:"red",children:rt})," ",i]},i)),l(n,{})]}),u(n,{dimColor:!0,children:[" ","Took",h]})]})}),"children")})},"CommandSummary");var Ts=Object.defineProperty,Qe=S((r,e)=>Ts(r,"name",{value:e,configurable:!0}),"u$2");class Le{static{S(this,"TaskStore")}static{Qe(this,"TaskStore")}#e;#r=new Set;#o=new Map;constructor(e){this.#e={autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,filterActive:!1,filterText:"",focusedPanel:"tasks",interactiveMode:!1,outputs:new Map,pinnedTaskIds:[null,null],rerunRequested:!1,retryTaskId:null,rows:e.map(t=>({status:"pending",taskId:t.id})),selectedIndex:0,startTime:Date.now(),statusFilter:"all",succeeded:0,viewMode:"list"}}getSnapshot=Qe(()=>this.#e,"getSnapshot");subscribe=Qe(e=>(this.#r.add(e),()=>{this.#r.delete(e)}),"subscribe");startTasks(e){const t=[...this.#e.rows];for(const o of e){const s=t.findIndex(a=>a.taskId===o.id);s!==-1&&(t[s]={...t[s],elapsed:0,status:"running"},this.#o.set(o.id,process.hrtime()))}this.#t({...this.#e,rows:t})}endTasks(e){const t=[...this.#e.rows];let{cached:o,completed:s,failed:a,succeeded:c}=this.#e;const d=new Map(this.#e.outputs);for(const f of e){const i=t.findIndex(k=>k.taskId===f.task.id);switch(i!==-1&&(t[i]={...t[i],duration:f.startTime&&f.endTime?f.endTime-f.startTime:void 0,status:f.status}),s++,f.status){case"failure":{a++;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{o++;break}case"success":{c++;break}}f.terminalOutput&&!d.has(f.task.id)&&d.set(f.task.id,f.terminalOutput),this.#o.delete(f.task.id)}let{selectedIndex:h}=this.#e;if(a>this.#e.failed){const f=t.findIndex(i=>i.status==="failure");f!==-1&&(h=f)}this.#t({...this.#e,cached:o,completed:s,failed:a,outputs:d,rows:t,selectedIndex:h,succeeded:c})}static#s=256*1024;addOutput(e,t){if(!t.trim())return;let o=(this.#e.outputs.get(e)??"")+t;o.length>Le.#s&&(o=o.slice(-Le.#s)),this.#e.outputs.set(e,o),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()})}tick(){if(this.#o.size===0)return;let e=!1;const t=[...this.#e.rows];for(let o=0;o<t.length;o++){const s=t[o];if(s.status==="running"){const a=this.#o.get(s.taskId);if(a){const c=process.hrtime(a),d=c[0]*1e3+c[1]/1e6;t[o]={...s,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 o=[...this.#e.pinnedTaskIds];o[e]=t,this.#t({...this.#e,pinnedTaskIds:o})}clearPins(){this.#t({...this.#e,pinnedTaskIds:[null,null]})}requestRetry(e){const t=[...this.#e.rows],o=t.findIndex(d=>d.taskId===e);let{completed:s,failed:a,succeeded:c}=this.#e;if(o!==-1){const d=t[o].status;d==="failure"?(a=Math.max(0,a-1),s=Math.max(0,s-1)):d==="success"&&(c=Math.max(0,c-1),s=Math.max(0,s-1)),t[o]={...t[o],elapsed:0,status:"running"},this.#o.set(e,process.hrtime())}this.#t({...this.#e,completed:s,done:!1,endTime:null,failed:a,interactiveMode:!1,retryTaskId:e,rows:t,succeeded:c})}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.#o.clear(),this.#t({...this.#e,autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,interactiveMode:!1,outputs:new Map,rerunRequested:!0,rows:this.#e.rows.map(e=>({status:"pending",taskId:e.taskId})),startTime:Date.now(),succeeded:0,viewMode:"list"})}acknowledgeRerun(){this.#e.rerunRequested&&this.#t({...this.#e,rerunRequested:!1})}#t(e){this.#e=e;for(const t of this.#r)try{t()}catch{}}}var Ss=Object.defineProperty,ue=S((r,e)=>Ss(r,"name",{value:e,configurable:!0}),"t$1");const nr={delimiter:" ",language:{d:ue(()=>" d","d"),future:"in %s",h:ue(()=>" h","h"),m:ue(()=>" m","m"),mo:ue(()=>" mo","mo"),ms:ue(()=>" ms","ms"),past:"%s ago",s:ue(()=>" s","s"),w:ue(()=>" w","w"),y:ue(()=>" y","y")},largest:2,round:!0,spacer:"",units:["h","m","s","ms"]};ue(r=>{const e=r[0]*1e3+r[1]/1e6;return tr(e,nr)},"formatHrtime");const ve=ue(r=>tr(r,nr),"formatMs");var Cs=Object.defineProperty,Oe=S((r,e)=>Cs(r,"name",{value:e,configurable:!0}),"n$3");const Te=Oe(r=>r==="local-cache"||r==="local-cache-kept-existing"||r==="remote-cache","isCacheStatus"),Pe=Oe(r=>{switch(r){case"failure":return{color:"red",icon:rt};case"local-cache":case"local-cache-kept-existing":case"remote-cache":case"success":return{color:"green",icon:Zt};case"skipped":return{color:"gray",icon:He};default:return{color:"gray",icon:"?"}}},"getStatusInfo"),ir=Oe(r=>{const{color:e,icon:t}=Pe(r);return re(N.createElement(n,{color:e},t),{columns:10}).trim()},"getStatusIcon"),xs=Oe(r=>{const{color:e,icon:t}=Pe(r);switch(r){case"local-cache":case"local-cache-kept-existing":case"remote-cache":return re(N.createElement(n,null,N.createElement(n,{color:e},t)," ",N.createElement(n,{color:"cyan"},"[cache]")),{columns:30}).trim();case"skipped":return re(N.createElement(n,null,N.createElement(n,{dimColor:!0},t)," ",N.createElement(n,{dimColor:!0},"[skipped]")),{columns:30}).trim();default:return re(N.createElement(n,{color:e},t),{columns:10}).trim()}},"getStatusPrefix"),Is=Oe((r,e,t)=>{const o=t.trim();if(!o)return;const s=`
|
|
6
|
+
`;if(process.env.GITHUB_ACTIONS==="true")process.stdout.write(`::group::${ir(e)} ${r}${s}`),process.stdout.write(o+s),process.stdout.write(`::endgroup::${s}`);else{const a=process.stdout.columns||80,c=re(N.createElement(n,{dimColor:!0},He.repeat(a)),{columns:a}).trim(),d=xs(e),h=re(N.createElement(n,{bold:!0},r),{columns:a}).trim();process.stdout.write(`${c}${s}`),process.stdout.write(`${d} ${h}${s}`),process.stdout.write(o+s),process.stdout.write(`${c}${s}`)}},"logCommandOutputCI");var Ms=Object.defineProperty,ar=S((r,e)=>Ms(r,"name",{value:e,configurable:!0}),"c$3");const Es=ar(r=>r==="running"?{color:"white",icon:"•"}:r==="pending"?{color:"gray",icon:"·"}:Pe(r),"getDisplayInfo"),_t=ar(({duration:r,focused:e,interactiveMode:t,output:o,scrollRef:s,showFullscreenHint:a,status:c,taskId:d})=>{const h=c??"pending",{icon:f}=Es(h),i=e?"bold":"single",k=h==="failure"?"red":h==="success"||Te(h)?e?"green":"gray":h==="running"?e?"white":"cyan":e?"white":"gray",v=d?`${f} ${d}`:void 0,$=r===void 0?void 0:ve(r),M=d?t?"Esc cancel | Enter send":e&&h==="running"&&a?"⏎ FULLSCREEN i INPUT":e&&h==="running"?"i INPUT":e&&a?"<enter> full screen":e?void 0:"<tab> or <enter> to focus":void 0;if(!d)return u(p,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",paddingX:2,paddingY:1,children:[l(n,{dimColor:!0,children:"Select a task to view output"}),l(n,{dimColor:!0,children:"Press Enter or 1/2 to pin"})]});const R=o?o.split(`
|
|
7
|
+
`).map(T=>T.replace(/\r$/,"")):[];return!o&&(h==="running"||h==="pending")?l(p,{borderBottomTitle:M,borderColor:k,borderStyle:i,borderTopRightTitle:$,borderTopTitle:v,flexDirection:"column",flexGrow:1,paddingX:2,paddingY:1,children:l(p,{alignItems:"center",flexGrow:1,justifyContent:"center",children:l(n,{dimColor:!0,children:"Waiting for task output..."})})}):u(p,{borderBottomTitle:M,borderColor:t?"yellow":k,borderStyle:i,borderTopRightTitle:$,borderTopTitle:v,flexDirection:"column",flexGrow:1,children:[l(p,{flexGrow:1,flexShrink:1,paddingY:1,children:l(Xt,{flexGrow:1,followOutput:!0,paddingX:2,ref:s,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:R.map((T,O)=>l(n,{children:T},String(O)))})}),t&&l(p,{flexShrink:0,justifyContent:"center",paddingX:1,children:l(n,{bold:!0,color:"yellow",children:"INTERACTIVE — keystrokes forwarded to task — Esc to exit"})})]})},"OutputPanel");var js=Object.defineProperty,Ne=S((r,e)=>js(r,"name",{value:e,configurable:!0}),"x$1");const cr=6,lr=8,dr=10,Rs=Ne(r=>r==="running"||r==="pending"?Jt:r==="local-cache"||r==="local-cache-kept-existing"?"Local":r==="remote-cache"?"Remote":He,"getCacheLabel"),Ft=Ne((r,e)=>e[0]===r?"[1]":e[1]===r?"[2]":"","getPinLabel"),At=Ne(({compact:r,isSelected:e,pinLabel:t,row:o})=>{const{status:s,taskId:a}=o,c=e?">":" ";let d;if(s==="running")d=u(n,{bold:!0,color:"white",children:[" ",l(po,{type:"dots"})," "]});else if(s==="pending")d=l(n,{bold:!0,color:"gray",children:" · "});else{const{color:f,icon:i}=Pe(s);d=u(n,{bold:!0,color:f,children:[" ",i," "]})}let h=Jt;return s!=="running"&&s!=="pending"?h=o.duration===void 0?He:ve(o.duration):s==="running"&&o.elapsed!==void 0&&(h=ve(o.elapsed)),u(p,{children:[l(n,{children:c}),l(p,{width:cr,children:d}),u(p,{flexGrow:1,children:[l(n,{bold:e,inverse:e,children:a}),t?l(n,{dimColor:!0,children:` ${t}`}):null]}),!r&&l(p,{justifyContent:"flex-end",width:lr,children:l(n,{dimColor:!Te(s),children:Rs(s)})}),!r&&l(p,{justifyContent:"flex-end",width:dr,children:l(n,{dimColor:s==="pending",children:h})})]})},"TaskListRow"),Lt=Ne(({compact:r,filterActive:e,filterText:t,focused:o,headerStatus:s,parallelSlots:a=3,pinnedTaskIds:c,rows:d,scrollRef:h,selectedIndex:f,title:i})=>{const k=s==="error"?"red":s==="success"?"green":o?"white":"gray",v=d[f]?.taskId,$=d.filter(T=>T.status==="running"),M=$.length>0||d.some(T=>T.status==="pending"),R=[];if(M)for(let T=0;T<a;T++){const O=$[T];O?R.push(l(At,{compact:r,isSelected:O.taskId===v,pinLabel:Ft(O.taskId,c),row:O},`par-${O.taskId}`)):R.push(u(p,{children:[l(n,{children:" "}),l(p,{width:cr,children:l(n,{bold:!0,color:"gray",children:" · "})}),l(n,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(T)}`))}return u(p,{borderColor:k,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[u(p,{flexShrink:0,gap:1,paddingX:1,children:[l(n,{bold:!0,inverse:!0,children:" VIS "}),l(n,{children:i}),!r&&u(p,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[l(p,{justifyContent:"flex-end",width:lr,children:l(n,{dimColor:!0,children:"Cache"})}),l(p,{justifyContent:"flex-end",width:dr,children:l(n,{dimColor:!0,children:"Duration"})})]})]}),l(Xt,{flexGrow:1,flexShrink:1,paddingLeft:1,paddingY:1,ref:h,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:d.map(T=>l(At,{compact:r,isSelected:T.taskId===v,pinLabel:Ft(T.taskId,c),row:T},T.taskId))}),M&&l(p,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingLeft:1,paddingY:1,children:R}),e&&u(p,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexShrink:0,paddingX:1,children:[l(n,{bold:!0,color:"white",children:"/ "}),l(n,{children:t}),l(n,{inverse:!0,children:" "})]})]})},"TaskListPanel");var Os=Object.defineProperty,Ps=S((r,e)=>Os(r,"name",{value:e,configurable:!0}),"y$2");const Dt=40,Ht=10,Bt=100,_s=Ps(({autoExitSeconds:r,parallelSlots:e,projectNames:t,stdinRegistry:o,store:s,targets:a,tasks:c})=>{const{exit:d}=mo(),{columns:h,rows:f}=go(),i=vo(s.subscribe,s.getSnapshot),[k,v]=jt(!1),$=Ee(null),M=Ee(null),R=Ee(null),[T,O]=jt(!1),P=Ee({list:0,splitList:0,splitOutput:0}),Q=Ye(()=>{i.viewMode==="list"?P.current.list=M.current?.getScrollOffset()??0:i.viewMode==="split"&&(P.current.splitList=M.current?.getScrollOffset()??0,P.current.splitOutput=R.current?.getScrollOffset()??0)},[i.viewMode]),F=Ye(y=>{setTimeout(()=>{if(y==="list"){const m=P.current.list;M.current?.scrollTo(m)}else if(y==="split"){const m=P.current.splitList;m>0?M.current?.scrollTo(m):M.current?.scrollTo(Math.max(0,s.getSnapshot().selectedIndex-2)),R.current?.scrollTo(P.current.splitOutput)}},0)},[s]),w=Ee(!1);Ke(()=>{i.done&&!w.current&&(w.current=!0,r>0&&O(!0)),!i.done&&w.current&&(w.current=!1,O(!1))},[i.done,r]);const I=Rt(()=>{let y=i.rows;if(i.statusFilter!=="all"&&(y=y.filter(m=>i.statusFilter==="failed"?m.status==="failure":i.statusFilter==="running"?m.status==="running"||m.status==="pending":i.statusFilter==="passed"?m.status==="success"||Te(m.status):!0)),i.filterText){const m=i.filterText.toLowerCase();y=y.filter(x=>x.taskId.toLowerCase().includes(m))}return y},[i.rows,i.filterText,i.statusFilter]),_=Rt(()=>i.rows.filter(y=>y.status==="running").length,[i.rows]),G=(I[i.selectedIndex]??null)?.taskId??null,C=i.pinnedTaskIds[0]??G,H=C?i.rows.find(y=>y.taskId===C):null,ie=C?i.outputs.get(C)??"":"",L=at(t,a,c),q=i.done?`Completed ${L} (${ve((i.endTime??Date.now())-i.startTime)})`:`Running ${L}...`,ae=i.done?i.failed>0?"error":"success":"running",J=Ye(y=>{M.current?.scrollTo(Math.max(0,y-2))},[]);if(Ke(()=>{i.interactiveMode&&H?.status!=="running"&&s.setInteractiveMode(!1)},[i.interactiveMode,H?.status,s]),Ke(()=>{if(!C)return;let y=h;i.viewMode==="split"&&h>=Bt?y=h-Math.floor(h*.4)-2:(i.viewMode==="split"||i.viewMode==="fullscreen")&&(y=h-2);const m=Math.max(1,f-4);o.get(C)?.resize?.(y,m)},[h,f,i.viewMode,C]),Et((y,m)=>{if(m.escape){s.setInteractiveMode(!1);return}if(!C)return;const x=o.get(C);if(!x){s.setInteractiveMode(!1);return}if(m.return)x.write("\r");else if(m.upArrow)x.write("\x1B[A");else if(m.downArrow)x.write("\x1B[B");else if(m.rightArrow)x.write("\x1B[C");else if(m.leftArrow)x.write("\x1B[D");else if(m.backspace)x.write("");else if(m.delete)x.write("\x1B[3~");else if(m.tab)x.write(" ");else if(m.home)x.write("\x1B[H");else if(m.end)x.write("\x1B[F");else if(m.pageUp)x.write("\x1B[5~");else if(m.pageDown)x.write("\x1B[6~");else if(m.ctrl&&y){const ee=y.toUpperCase().codePointAt(0);ee!==void 0&&ee>=65&&ee<=90&&x.write(String.fromCodePoint(ee-64))}else y&&x.write(y)},{isActive:i.interactiveMode}),Et((y,m)=>{if(y==="c"&&m.ctrl){d();return}if(!T){if(k){m.escape||y==="?"?v(!1):y==="q"?(v(!1),O(!0)):m.downArrow||y==="j"?$.current?.scrollBy(1):m.upArrow||y==="k"?$.current?.scrollBy(-1):m.pageDown?$.current?.scrollBy(5):m.pageUp?$.current?.scrollBy(-5):m.home?$.current?.scrollToTop():m.end&&$.current?.scrollToBottom();return}if(y==="?"){v(!0);return}if(y==="q"){O(!0);return}if(y==="r"&&i.done){s.requestRerun();return}if(y==="R"&&i.done){const x=I[i.selectedIndex];x?.status==="failure"&&s.requestRetry(x.taskId);return}if(y==="F"&&!i.filterActive){const x=["all","failed","running","passed"],ee=x.indexOf(i.statusFilter);s.setStatusFilter(x[(ee+1)%x.length]);return}if(i.filterActive){if(m.escape){s.setFilterActive(!1);return}if(m.return){s.setFilterActive(!1);return}if(m.backspace){s.setFilter(i.filterText.slice(0,-1));return}if(y&&!m.ctrl&&!m.meta){s.setFilter(i.filterText+y);return}return}if(y==="i"&&H?.status==="running"&&(i.viewMode==="fullscreen"||i.viewMode==="split"&&i.focusedPanel==="output")){s.setInteractiveMode(!0);return}if(i.viewMode==="fullscreen"){if(m.escape){s.setViewMode("split"),F("split");return}if(m.downArrow||y==="j"){R.current?.scrollBy(1);return}if(m.upArrow||y==="k"){R.current?.scrollBy(-1);return}if(m.pageDown||m.ctrl&&y==="d"){R.current?.scrollBy(12);return}if(m.pageUp||m.ctrl&&y==="u"){R.current?.scrollBy(-12);return}if(m.home){R.current?.scrollToTop();return}if(m.end){R.current?.scrollToBottom();return}return}if(i.viewMode==="split"){if(m.tab){const x=i.focusedPanel==="tasks"?"output":"tasks";s.setFocusedPanel(x);return}if(i.focusedPanel==="output"){if(m.escape){s.setFocusedPanel("tasks");return}if(m.return){Q(),s.setViewMode("fullscreen");return}if(m.downArrow||y==="j"){R.current?.scrollBy(1);return}if(m.upArrow||y==="k"){R.current?.scrollBy(-1);return}if(m.pageDown||m.ctrl&&y==="d"){R.current?.scrollBy(12);return}if(m.pageUp||m.ctrl&&y==="u"){R.current?.scrollBy(-12);return}if(m.home){R.current?.scrollToTop();return}if(m.end){R.current?.scrollToBottom();return}return}if(m.escape){s.setViewMode("list"),F("list");return}if(m.return){s.setFocusedPanel("output");return}}if(i.viewMode==="list"||i.viewMode==="split"&&i.focusedPanel==="tasks"){if(m.downArrow||y==="j"){const x=Math.min(i.selectedIndex+1,Math.max(0,I.length-1));s.setSelectedIndex(x),J(x);return}if(m.upArrow||y==="k"){const x=Math.max(i.selectedIndex-1,0);s.setSelectedIndex(x),J(x);return}if(m.return&&i.viewMode==="list"){Q(),P.current.splitList=0,P.current.splitOutput=0,s.setViewMode("split"),s.setFocusedPanel("output"),F("split");return}if(y==="/"){s.setFilterActive(!0);return}if(y==="1"&&G){s.pinTask(0,G);return}if(y==="2"&&G){s.pinTask(1,G);return}if(y==="0"){s.clearPins();return}m.escape&&i.filterText&&s.setFilter("")}}},{isActive:!i.interactiveMode}),h<Dt||f<Ht)return l(p,{alignItems:"center",height:f,justifyContent:"center",width:h,children:u(n,{color:"yellow",children:["Terminal too small (",h,"x",f,"). Minimum:"," ",Dt,"x",Ht]})});const B=u(p,{gap:1,children:[i.succeeded>0&&u(n,{bold:!0,color:"green",children:["✓"," ",i.succeeded]}),i.failed>0&&u(n,{bold:!0,color:"red",children:["✗"," ",i.failed]}),_>0&&u(n,{color:"cyan",children:["◷"," ",_]}),u(n,{dimColor:!0,children:[i.rows.length," ","total"]}),i.statusFilter!=="all"&&u(n,{color:"yellow",children:["[",i.statusFilter,"]"]})]});let he;if(i.viewMode==="fullscreen")he=[u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"Esc"}),l(n,{dimColor:!0,children:"BACK"})]},"esc"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"↑↓"}),l(n,{dimColor:!0,children:"SCROLL"})]},"scroll"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"^u ^d"}),l(n,{dimColor:!0,children:"PAGE"})]},"page"),...H?.status==="running"?[u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"i"}),l(n,{dimColor:!0,children:"INPUT"})]},"i")]:[],u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"q"}),l(n,{dimColor:!0,children:"QUIT"})]},"q")];else if(i.done){const y=I[i.selectedIndex]?.status==="failure";he=[u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"q"}),l(n,{dimColor:!0,children:"QUIT"})]},"q"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"r"}),l(n,{dimColor:!0,children:"RERUN"})]},"r"),...y?[u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"R"}),l(n,{dimColor:!0,children:"RETRY"})]},"R")]:[],u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"?"}),l(n,{dimColor:!0,children:"HELP"})]},"?"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"↑↓"}),l(n,{dimColor:!0,children:"NAV"})]},"nav"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"F"}),l(n,{dimColor:!0,children:"FILTER"})]},"F"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"⏎"}),l(n,{dimColor:!0,children:i.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter")]}else i.viewMode==="split"&&i.focusedPanel==="output"?he=[u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"q"}),l(n,{dimColor:!0,children:"QUIT"})]},"q"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"Esc"}),l(n,{dimColor:!0,children:"BACK"})]},"esc"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"↑↓"}),l(n,{dimColor:!0,children:"SCROLL"})]},"scroll"),...H?.status==="running"?[u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"i"}),l(n,{dimColor:!0,children:"INPUT"})]},"i")]:[],u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"⏎"}),l(n,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"Tab"}),l(n,{dimColor:!0,children:"PANEL"})]},"tab"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"?"}),l(n,{dimColor:!0,children:"HELP"})]},"?")]:he=[u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"q"}),l(n,{dimColor:!0,children:"QUIT"})]},"q"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"?"}),l(n,{dimColor:!0,children:"HELP"})]},"?"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"↑↓"}),l(n,{dimColor:!0,children:"NAV"})]},"nav"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"/"}),l(n,{dimColor:!0,children:"FILTER"})]},"/"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"F"}),l(n,{dimColor:!0,children:"STATUS"})]},"F"),u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"⏎"}),l(n,{dimColor:!0,children:i.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...i.viewMode==="split"?[u(p,{gap:1,children:[l(n,{bold:!0,color:"white",children:"Tab"}),l(n,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const ce=u(p,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[l(p,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:he}),l(p,{flexShrink:0,paddingX:1,children:B})]}),D=u(wo,{backgroundColor:"#1e1e1e",footer:u(n,{dimColor:!0,children:[l(n,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",l(n,{bold:!0,color:"white",children:"?"}),"/",l(n,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:$,title:"KEYBOARD SHORTCUTS",visible:k,width:52,children:[u(p,{flexDirection:"column",marginBottom:1,children:[u(p,{marginBottom:1,children:[l(n,{dimColor:!0,children:"── "}),l(n,{bold:!0,color:"white",children:"NAVIGATION"})]}),u(p,{children:[l(p,{width:24,children:u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","↑","/k"]}),l(n,{dimColor:!0,children:" Move up"})]})}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","↓","/j"]}),l(n,{dimColor:!0,children:" Move down"})]})]}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","Tab"]}),l(n,{dimColor:!0,children:" Switch panel (split)"})]}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","Esc"]}),l(n,{dimColor:!0,children:" Back / close"})]}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","Enter"]}),l(n,{dimColor:!0,children:" Show output / fullscreen"})]})]}),u(p,{flexDirection:"column",marginBottom:1,children:[u(p,{marginBottom:1,children:[l(n,{dimColor:!0,children:"── "}),l(n,{bold:!0,color:"white",children:"VIEWS"})]}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","Enter"]}),u(n,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","Esc"]}),u(n,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),u(p,{flexDirection:"column",marginBottom:1,children:[u(p,{marginBottom:1,children:[l(n,{dimColor:!0,children:"── "}),l(n,{bold:!0,color:"white",children:"ACTIONS"})]}),u(p,{children:[l(p,{width:24,children:u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","/"]}),l(n,{dimColor:!0,children:" Filter by text"})]})}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","F"]}),l(n,{dimColor:!0,children:" Filter by status"})]})]}),u(p,{children:[l(p,{width:24,children:u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","1"]}),l(n,{dimColor:!0,children:"/"}),l(n,{bold:!0,color:"white",children:"2"}),l(n,{dimColor:!0,children:" Pin to output pane"})]})}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","0"]}),l(n,{dimColor:!0,children:" Clear pins"})]})]}),u(p,{children:[l(p,{width:24,children:u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","r"]}),l(n,{dimColor:!0,children:" Rerun all (done)"})]})}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","R"]}),l(n,{dimColor:!0,children:" Retry failed task"})]})]}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","i"]}),l(n,{dimColor:!0,children:" Interactive input (running task)"})]})]}),u(p,{flexDirection:"column",marginBottom:1,children:[u(p,{marginBottom:1,children:[l(n,{dimColor:!0,children:"── "}),l(n,{bold:!0,color:"white",children:"SCROLLING"}),l(n,{dimColor:!0,children:" (output panel)"})]}),u(p,{children:[l(p,{width:24,children:u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","↑","/k"]}),l(n,{dimColor:!0,children:" Scroll up"})]})}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","↓","/j"]}),l(n,{dimColor:!0,children:" Scroll down"})]})]}),u(p,{children:[l(p,{width:24,children:u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","^u"]}),l(n,{dimColor:!0,children:" Page up"})]})}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","^d"]}),l(n,{dimColor:!0,children:" Page down"})]})]}),u(p,{children:[l(p,{width:24,children:u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","Home"]}),l(n,{dimColor:!0,children:" Top"})]})}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","End"]}),l(n,{dimColor:!0,children:" Bottom"})]})]})]}),u(p,{flexDirection:"column",children:[u(p,{marginBottom:1,children:[l(n,{dimColor:!0,children:"── "}),l(n,{bold:!0,color:"white",children:"GENERAL"})]}),u(p,{children:[l(p,{width:24,children:u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","q"]}),l(n,{dimColor:!0,children:" Quit"})]})}),u(n,{children:[u(n,{bold:!0,color:"white",children:[" ","?"]}),l(n,{dimColor:!0,children:" Toggle help"})]})]})]})]}),U=l(Dr,{autoExitSeconds:r>0?r:3,onCancel:S(()=>{O(!1)},"onCancel"),visible:T});if(i.viewMode==="fullscreen")return u(p,{flexDirection:"column",height:f,width:h,children:[l(p,{flexGrow:1,children:l(_t,{duration:H?.duration??H?.elapsed,focused:!0,interactiveMode:i.interactiveMode,output:ie,scrollRef:R,status:H?.status,taskId:C})}),ce,U,D]});if(i.viewMode==="split"){const y=h>=Bt,m=l(Lt,{compact:!0,filterActive:i.filterActive,filterText:i.filterText,focused:i.focusedPanel==="tasks",headerStatus:ae,parallelSlots:e,pinnedTaskIds:i.pinnedTaskIds,rows:I,scrollRef:M,selectedIndex:i.selectedIndex,title:q}),x=l(_t,{duration:H?.duration??H?.elapsed,focused:i.focusedPanel==="output",interactiveMode:i.interactiveMode,output:ie,scrollRef:R,showFullscreenHint:!0,status:H?.status,taskId:C});if(y){const fe=Math.floor(h*.4);return u(p,{flexDirection:"column",height:f,width:h,children:[u(p,{flexDirection:"row",flexGrow:1,children:[l(p,{width:fe,children:m}),l(p,{flexGrow:1,children:x})]}),ce,U,D]})}const ee=Math.floor(f*.45);return u(p,{flexDirection:"column",height:f,width:h,children:[l(p,{height:ee,children:m}),l(p,{flexGrow:1,children:x}),ce,U,D]})}return u(p,{flexDirection:"column",height:f,width:h,children:[l(p,{flexGrow:1,children:l(Lt,{filterActive:i.filterActive,filterText:i.filterText,focused:!0,headerStatus:ae,parallelSlots:e,pinnedTaskIds:i.pinnedTaskIds,rows:I,scrollRef:M,selectedIndex:i.selectedIndex,title:q})}),ce,U,D]})},"VisTaskRunnerApp");var Fs=Object.defineProperty,$e=S((r,e)=>Fs(r,"name",{value:e,configurable:!0}),"n$2");const As=$e(r=>{const{args:e,autoExit:t=!1,outputStyle:o="normal",projectNames:s,stdinRegistry:a,tasks:c}=r,d=new Le(c),h=typeof e.parallel=="number"?e.parallel:3,f=t===!0?3:typeof t=="number"?t:0;let i,k;const v=new Promise(F=>{k=F});let $;const M=$e(()=>{$&&(clearInterval($),$=void 0)},"cleanup"),R=$e(()=>{if(a){for(const F of a.values())F.kill?.();a.clear()}},"killAllPtyProcesses"),T=$e(()=>{M(),Q(),R(),process.stdout.write("\x1B[?1049l\x1B[?25h"),i?.cleanup(),process.exit(1)},"onSignal"),O=$e(()=>{const F=d.getSnapshot(),w=ve(Date.now()-F.startTime),I=F.rows.filter(C=>C.status==="failure").map(C=>C.taskId),_=process.stdout.columns||80;process.stdout.write(`
|
|
8
|
+
`);for(const C of F.rows){const{status:H,taskId:ie}=C,L=Pe(H);let q="";switch(H){case"local-cache":case"local-cache-kept-existing":{q=" [local cache]";break}case"remote-cache":{q=" [remote cache]";break}case"skipped":{q=" [skipped]";break}}const ae=re(N.createElement(n,null," ",N.createElement(n,{color:L.color},L.icon),` vis run ${ie}`,q?N.createElement(n,{dimColor:!0},` ${q}`):null),{columns:_});process.stdout.write(`${ae}
|
|
9
|
+
`)}process.stdout.write(`
|
|
10
|
+
`);const G=re(N.createElement(sr,{cached:F.cached,failed:F.failed,failedIds:I,projectNames:s,succeeded:F.succeeded,targets:e.targets,tasks:c,took:w}),{columns:_});if(process.stdout.write(`${G}
|
|
11
|
+
`),I.length>0&&o!=="quiet")for(const C of I){const H=F.outputs.get(C);if(H?.trim()){const ie=re(N.createElement(n,null,`
|
|
12
|
+
`,N.createElement(n,{bold:!0,color:"red"},` ${rt} vis run ${C}`)),{columns:_});process.stdout.write(`${ie}
|
|
2
13
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
`)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
`)},"
|
|
15
|
-
|
|
16
|
-
`)},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
`);const L=H.trim().split(`
|
|
15
|
+
`).map(q=>` ${q}`).join(`
|
|
16
|
+
`);process.stdout.write(`${L}
|
|
17
|
+
`)}}},"printExitSummary");let P;const Q=$e(()=>{P&&(clearInterval(P),P=void 0)},"clearKeepAlive");return{lifeCycle:{endCommand(){M(),d.markDone(),P||(P=setInterval(()=>{},1e3)),process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume())},endTasks(F){d.endTasks(F)},printTaskTerminalOutput(F,w,I){d.getSnapshot().outputs.has(F.id)||d.addOutput(F.id,I)},startCommand(){process.on("SIGINT",T),process.on("SIGTERM",T),P||(P=setInterval(()=>{},1e3)),process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume()),i=ko(N.createElement(_s,{autoExitSeconds:f,parallelSlots:h,projectNames:s,stdinRegistry:a??new Map,store:d,targets:e.targets,tasks:c}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}),i.waitUntilExit().then(()=>{Q(),R(),process.removeListener("SIGINT",T),process.removeListener("SIGTERM",T),O(),k()}).catch(()=>{Q(),R(),process.removeListener("SIGINT",T),process.removeListener("SIGTERM",T),k()})},startTasks(F){d.startTasks(F),$||($=setInterval(()=>{d.tick()},100))}},renderIsDone:v,store:d}},"createDynamicOutputRenderer");var Ls=Object.defineProperty,ct=S((r,e)=>Ls(r,"name",{value:e,configurable:!0}),"l$1");const Ds=ct(r=>r==="quiet"?"quiet":"normal","parseOutputStyle"),Hs=ct((r,e)=>{const t=r.overrides.visOptions;return t?.outputStyle==="normal"||t?.outputStyle==="quiet"?t.outputStyle:e},"resolveTaskOutputStyle");class Bs{static{S(this,"StaticOutputLifeCycle")}static{ct(this,"StaticOutputLifeCycle")}#e;#r;#o;#s=[];#t=[];#n=new Map;#i;#a;#c=0;constructor(e){this.#e=e.projectNames,this.#r=e.args.targets,this.#o=e.tasks,this.#i=e.logReporter,this.#a=e.outputStyle??"normal"}startCommand(){this.#c=Date.now();const e=process.stdout.columns||80,t=`Running ${at(this.#e,this.#r,this.#o)}`,o=re(N.createElement(Ze,{title:t,variant:"info"}),{columns:e});process.stdout.write(o);const s=this.#o[0],a=s?.overrides?Object.entries(s.overrides).filter(([c])=>c!=="command"):[];if(a.length>0){process.stdout.write(`
|
|
18
|
+
With additional flags:
|
|
19
|
+
`);for(const[c,d]of a)process.stdout.write(`${ws(" ",c,d)}
|
|
20
|
+
`)}process.stdout.write(`
|
|
21
|
+
`)}startTasks(e){const t=process.stdout.columns||80;for(const o of e){const s=re(N.createElement(n,null,N.createElement(n,{dimColor:!0},">"),` ${o.id}`),{columns:t});process.stdout.write(`${s}
|
|
22
|
+
`)}}endTasks(e){const t=process.stdout.columns||80;for(const o of e){this.#n.set(o.task.id,o),o.status==="failure"?this.#s.push(o):Te(o.status)&&this.#t.push(o);const s=ir(o.status),a=o.startTime&&o.endTime?` (${ve(o.endTime-o.startTime)})`:"",c=Te(o.status)?" [cache]":"",d=re(N.createElement(n,null,s,` ${o.task.id}`,c?N.createElement(n,{color:"cyan"},c):null,a?N.createElement(n,{dimColor:!0},a):null),{columns:t});process.stdout.write(`${d}
|
|
23
|
+
`)}}printTaskTerminalOutput(e,t,o){if(!(Hs(e,this.#a)==="quiet"&&(t==="success"||Te(t)))){if(this.#i){this.#i.printTaskTerminalOutput(e,t,o);return}Is(e.id,t,o)}}endCommand(){const e=ve(Date.now()-this.#c),t=this.#o.filter(a=>!this.#n.has(a.id)).map(a=>a.id);process.stdout.write(`
|
|
24
|
+
`);const o=process.stdout.columns||80,s=re(N.createElement(sr,{cached:this.#t.length,failed:this.#s.length,failedIds:this.#s.map(a=>a.task.id),projectNames:this.#e,skippedIds:t.length>0?t:void 0,succeeded:this.#n.size-this.#s.length-this.#t.length,targets:this.#r,tasks:this.#o,took:e}),{columns:o});process.stdout.write(`${s}
|
|
25
|
+
`)}}var Ns=Object.defineProperty,Y=S((r,e)=>Ns(r,"name",{value:e,configurable:!0}),"r$1");function je(r,e={},t){for(const o in r){const s=r[o],a=t?`${t}:${o}`:o;typeof s=="object"&&s!==null?je(s,e,a):typeof s=="function"&&(e[a]=s)}return e}S(je,"c$2");Y(je,"flatHooks");function Gs(...r){const e={};for(const t of r){const o=je(t);for(const s in o)e[s]?e[s].push(o[s]):e[s]=[o[s]]}for(const t in e)if(e[t].length>1){const o=e[t];e[t]=(...s)=>ur(o,a=>a(...s))}else e[t]=e[t][0];return e}S(Gs,"v$1");Y(Gs,"mergeHooks");function ur(r,e){return r.reduce((t,o)=>t.then(()=>e(o)),Promise.resolve())}S(ur,"d");Y(ur,"serial");const hr=(()=>{if(console.createTask)return console.createTask;const r={run:Y(e=>e(),"run")};return()=>r})();function Ge(r,e,t,o){for(let s=t;s<r.length;s+=1)try{const a=o?o.run(()=>r[s](...e)):r[s](...e);if(a&&typeof a.then=="function")return Promise.resolve(a).then(()=>Ge(r,e,s+1,o))}catch(a){return Promise.reject(a)}}S(Ge,"k$1");Y(Ge,"callHooks");function fr(r,e,t){if(r.length>0)return Ge(r,e,0,hr(t))}S(fr,"y$1");Y(fr,"serialTaskCaller");function pr(r,e,t){if(r.length>0){const o=hr(t);return Promise.all(r.map(s=>o.run(()=>s(...e))))}}S(pr,"m");Y(pr,"parallelTaskCaller");function qs(r,e){return r.reduce((t,o)=>t.then(()=>o(...e||[])),Promise.resolve())}S(qs,"x");Y(qs,"serialCaller");function Ws(r,e){return Promise.all(r.map(t=>t(...e||[])))}S(Ws,"P");Y(Ws,"parallelCaller");function Ae(r,e){for(const t of[...r])t(e)}S(Ae,"a$1");Y(Ae,"callEachWith");var Us=class{static{S(this,"p")}static{Y(this,"Hookable")}_hooks;_before;_after;_deprecatedHooks;_deprecatedMessages;constructor(){this._hooks={},this._before=void 0,this._after=void 0,this._deprecatedMessages=void 0,this._deprecatedHooks={},this.hook=this.hook.bind(this),this.callHook=this.callHook.bind(this),this.callHookWith=this.callHookWith.bind(this)}hook(e,t,o={}){if(!e||typeof t!="function")return()=>{};const s=e;let a;for(;this._deprecatedHooks[e];)a=this._deprecatedHooks[e],e=a.to;if(a&&!o.allowDeprecated){let c=a.message;c||(c=`${s} hook has been deprecated`+(a.to?`, please use ${a.to}`:"")),this._deprecatedMessages||(this._deprecatedMessages=new Set),this._deprecatedMessages.has(c)||(console.warn(c),this._deprecatedMessages.add(c))}if(!t.name)try{Object.defineProperty(t,"name",{get:Y(()=>"_"+e.replace(/\W+/g,"_")+"_hook_cb","get"),configurable:!0})}catch{}return this._hooks[e]=this._hooks[e]||[],this._hooks[e].push(t),()=>{t&&(this.removeHook(e,t),t=void 0)}}hookOnce(e,t){let o,s=Y((...a)=>(typeof o=="function"&&o(),o=void 0,s=void 0,t(...a)),"_function");return o=this.hook(e,s),o}removeHook(e,t){const o=this._hooks[e];if(o){const s=o.indexOf(t);s!==-1&&o.splice(s,1),o.length===0&&(this._hooks[e]=void 0)}}clearHook(e){this._hooks[e]=void 0}deprecateHook(e,t){this._deprecatedHooks[e]=typeof t=="string"?{to:t}:t;const o=this._hooks[e]||[];this._hooks[e]=void 0;for(const s of o)this.hook(e,s)}deprecateHooks(e){for(const t in e)this.deprecateHook(t,e[t])}addHooks(e){const t=je(e),o=Object.keys(t).map(s=>this.hook(s,t[s]));return()=>{for(const s of o)s();o.length=0}}removeHooks(e){const t=je(e);for(const o in t)this.removeHook(o,t[o])}removeAllHooks(){this._hooks={}}callHook(e,...t){return this.callHookWith(fr,e,t)}callHookParallel(e,...t){return this.callHookWith(pr,e,t)}callHookWith(e,t,o){const s=this._before||this._after?{name:t,args:o,context:{}}:void 0;this._before&&Ae(this._before,s);const a=e(this._hooks[t]?[...this._hooks[t]]:[],o,t);return a instanceof Promise?a.finally(()=>{this._after&&s&&Ae(this._after,s)}):(this._after&&s&&Ae(this._after,s),a)}beforeEach(e){return this._before=this._before||[],this._before.push(e),()=>{if(this._before!==void 0){const t=this._before.indexOf(e);t!==-1&&this._before.splice(t,1)}}}afterEach(e){return this._after=this._after||[],this._after.push(e),()=>{if(this._after!==void 0){const t=this._after.indexOf(e);t!==-1&&this._after.splice(t,1)}}}};function mr(){return new Us}S(mr,"w$1");Y(mr,"createHooks");(class{static{Y(this,"HookableCore")}_hooks;constructor(){this._hooks={}}hook(r,e){return!r||typeof e!="function"?()=>{}:(this._hooks[r]=this._hooks[r]||[],this._hooks[r].push(e),()=>{e&&(this.removeHook(r,e),e=void 0)})}removeHook(r,e){const t=this._hooks[r];if(t){const o=t.indexOf(e);o!==-1&&t.splice(o,1),t.length===0&&(this._hooks[r]=void 0)}}callHook(r,...e){const t=this._hooks[r];if(!(!t||t.length===0))return Ge(t,e,0)}});const Nt=typeof window<"u";function Vs(r,e={}){const t={inspect:Nt,group:Nt,filter:Y(()=>!0,"filter"),...e},o=t.filter,s=typeof o=="string"?i=>i.startsWith(o):o,a=t.tag?`[${t.tag}] `:"",c=Y(i=>a+i.name+"".padEnd(i._id,"\0"),"logPrefix"),d={},h=r.beforeEach(i=>{s!==void 0&&!s(i.name)||(d[i.name]=d[i.name]||0,i._id=d[i.name]++,console.time(c(i)))}),f=r.afterEach(i=>{s!==void 0&&!s(i.name)||(t.group&&console.groupCollapsed(i.name),t.inspect?console.timeLog(c(i),i.args):console.timeEnd(c(i)),t.group&&console.groupEnd(),d[i.name]--)});return{close:Y(()=>{h(),f()},"close")}}S(Vs,"W");Y(Vs,"createDebugger");var zs=Object.defineProperty,qe=S((r,e)=>zs(r,"name",{value:e,configurable:!0}),"t");const Ys=qe(()=>mr(),"createVisHooks"),Ks=qe(async(r,e)=>{if(!(!e||e.length===0))for(const t of e){if(t.hooks)for(const[o,s]of Object.entries(t.hooks)){const a=Array.isArray(s)?s:[s];for(const c of a)r.hook(o,c)}t.setup&&await t.setup(r)}},"registerPlugins");class Qs{static{S(this,"HookableLifeCycle")}static{qe(this,"HookableLifeCycle")}#e;#r;#o=new Map;constructor(e,t){this.#e=e,this.#r=t}startTasks(e){for(const t of e)this.#o.set(t.id,t),this.#s("task:before",t)}endTasks(e){for(const t of e)this.#o.delete(t.task.id),this.#s("task:after",t.task,t),t.status==="failure"?this.#s("task:failure",t.task,t):Xs(t.status)&&this.#s("task:cacheHit",t.task,t)}printCacheMiss(e,t){this.#s("task:cacheMiss",e,t)}onTaskStdout(e,t){this.#s("task:stdout",e,t)}onTaskStderr(e,t){this.#s("task:stderr",e,t)}#s(e,...t){Promise.resolve(this.#e.callHook(e,...t)).catch(o=>{if(this.#r)try{this.#r(e,o)}catch{}})}}const Xs=qe(r=>r==="local-cache"||r==="local-cache-kept-existing"||r==="remote-cache","isCacheStatus");var Zs=Object.defineProperty,We=S((r,e)=>Zs(r,"name",{value:e,configurable:!0}),"o$1");const Js=We(async r=>{if(process.env.VIS_NO_SHELL_HISTORY||yo()==="win32")return;const e=process.env.SHELL;if(!e)return;const t=Kr(e);try{if(t==="zsh"){await en(r);return}if(t==="bash"){await tn(r);return}t==="fish"&&await rn(r)}catch{}},"appendToShellHistory"),en=We(async r=>{const e=process.env.HISTFILE??Ce(process.env.ZDOTDIR??st(),".zsh_history"),t=`: ${Math.floor(Date.now()/1e3)}:0;${r}
|
|
26
|
+
`;await ot(e,t)},"writeZshHistory"),tn=We(async r=>{const e=process.env.HISTFILE??Ce(st(),".bash_history");await ot(e,`${r}
|
|
27
|
+
`)},"writeBashHistory"),rn=We(async r=>{const e=Ce(st(),".local","share","fish","fish_history"),t=`- cmd: ${r.replaceAll("\\","\\\\").replaceAll(`
|
|
28
|
+
`,String.raw`\n`)}
|
|
29
|
+
when: ${Math.floor(Date.now()/1e3)}
|
|
30
|
+
`;await ot(e,t)},"writeFishHistory");var on=Object.defineProperty,Xe=S((r,e)=>on(r,"name",{value:e,configurable:!0}),"e");const sn=Xe(r=>{const{killGracePeriodMs:e=5e3,onTimeout:t,sendSignal:o,timeoutMs:s}=r;if(s<=0)return{cancel:Xe(()=>{},"cancel")};const a=Math.max(e,0);let c;const d=setTimeout(()=>{t?.(),o("SIGTERM"),a>0&&(c=setTimeout(()=>{o("SIGKILL")},a))},s);return{cancel:Xe(()=>{clearTimeout(d),c&&clearTimeout(c)},"cancel")}},"scheduleTimeoutKill");var nn=Object.defineProperty,Se=S((r,e)=>nn(r,"name",{value:e,configurable:!0}),"l");const an=[/node_modules(?:\/|$)/,/\.git(?:\/|$)/,/\.vis(?:\/|$)/,/\.task-runner(?:\/|$)/],Gt=Se((r,e)=>{const t=new Set,o=new Set;for(const[,c]of r){const d=c.task.hashDetails?.nodes;if(d)for(const h of Object.keys(d))t.add(h),o.add(Qr(Qt(e,h)))}const s=[...o].sort(),a=[];for(const c of s)a.some(d=>c===d||c.startsWith(`${d}/`))||a.push(c);return{directories:a,files:t}},"collectTrackedWatchTargets"),cn=Se((r,e,t)=>{const o=new Set;for(const s of r){const a=Qt(e,s);for(const c of t)if(a===c||a.startsWith(`${c}/`)){const d=Xr(c,a);d.length>0&&o.add(d)}}return s=>{const a=s.replaceAll("\\","/");return o.has(a)}},"createTrackedFileFilter"),ln=Se(r=>{const e=r.replaceAll("\\","/");return an.some(t=>t.test(e))},"shouldIgnore"),qt=Se(r=>{const{debounceMs:e=150,filter:t,onChange:o,paths:s}=r,a=[];let c=new Set,d;const h=Se(()=>{d=void 0;const f=[...c];c=new Set,f.length!==0&&Promise.resolve(o(f)).catch(i=>{It.error("[vis watch] onChange handler failed:",i)})},"flush");for(const f of s)try{const i=Yr(f,{recursive:!0},(k,v)=>{v&&(ln(v)||t&&!t(v)||(c.add(v),d&&clearTimeout(d),d=setTimeout(h,e)))});a.push(i)}catch(i){It.warn(`[vis watch] unable to watch ${f}: ${i.message}`)}return{close:Se(()=>{d&&clearTimeout(d);for(const f of a)try{f.close()}catch{}},"close")}},"startWatcher");var dn=Object.defineProperty,un=S((r,e)=>dn(r,"name",{value:e,configurable:!0}),"n");const hn=un((r,e)=>{const t=e?.trim();if(!t)return{filter:void 0,tasks:[...r]};const o=t.toLowerCase();return{filter:t,tasks:r.filter(s=>s.target.project.toLowerCase().includes(o))}},"applyProjectFilter");var fn=Object.defineProperty,me=S((r,e)=>fn(r,"name",{value:e,configurable:!0}),"a");const pn=[""," Watch keybinds:"," r, Enter rerun"," a rerun all (clear filter)"," p filter by project name"," q, Ctrl+C quit"," h, ? show this help",""].join(`
|
|
31
|
+
`),mn=me(r=>{r.write(`${pn}
|
|
32
|
+
`)},"writeHelp"),gn=me(async(r,e)=>{e.write("filter projects (empty to cancel) > ");const t=r,o=t.isRaw===!0;if(o)try{t.setRawMode?.(!1)}catch{}return await new Promise(s=>{let a="";const c=me(d=>{a+=typeof d=="string"?d:d.toString("utf8");const h=a.indexOf(`
|
|
33
|
+
`);if(h===-1)return;const f=a.slice(0,h).replace(/\r$/,"").trim();if(r.off("data",c),o)try{t.setRawMode?.(!0)}catch{}s(f.length>0?f:void 0)},"onData");r.on("data",c)})},"defaultPromptFilter"),wn=me(r=>{const{handlers:e}=r,t=r.input??process.stdin,o=r.output??process.stdout,s=r.promptFilter??gn;if(!t||t.isTTY===!1)return{close:me(()=>{},"close")};fo(t);const a=t.isRaw===!0;try{t.setRawMode?.(!0)}catch{return{close:me(()=>{},"close")}}typeof t.resume=="function"&&t.resume();let c=!1;const d=me(async i=>{if(i.ctrl===!0&&i.name==="c"){await e.onQuit();return}if(!c)switch(i.name){case"?":case"h":{await e.onHelp();break}case"a":{await e.onClearFilter();break}case"p":{c=!0;try{const k=await s(t,o);k===void 0?o.write(`filter cancelled.
|
|
34
|
+
`):await e.onFilter(k)}finally{c=!1}break}case"q":{await e.onQuit();break}case"r":{await e.onRerun();break}case"return":{await e.onRerun();break}}},"dispatch"),h=me((i,k)=>{d(k).catch(v=>{o.write(`[vis watch] keybind handler failed: ${v.message}
|
|
35
|
+
`)})},"onKeypress"),f=t;return f.on("keypress",h),{close:me(()=>{if(f.off("keypress",h),!a)try{t.setRawMode?.(!1)}catch{}const i=t;if(typeof i.pause=="function")try{i.pause()}catch{}},"close")}},"installKeybinds");var kn=Object.defineProperty,Je=S((r,e)=>kn(r,"name",{value:e,configurable:!0}),"u");const vn=Je(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),yn=Je(async r=>{const{initialTasks:e,probe:t,registeredEntries:o,taskGraph:s,visVersion:a}=r,c=new Map,d=new Map,h=new Map;for(const w of o)if(no(w.pid)){if(w.visVersion!==a){d.set(w.id,w);continue}c.set(w.id,w)}if(t){const w=[...c.values()],I=await Promise.all(w.map(async _=>{try{return[_.id,await t(_)]}catch{return[_.id,!1]}}));for(const[_,G]of I)if(!G){const C=c.get(_);c.delete(_),C&&h.set(_,C)}}const f=new Set(e.map(w=>w.id)),i=new Set,k=[],v=[],$=new Set;for(const w of Object.values(s.dependencies))for(const I of w)$.add(I);for(const[w,I]of Object.entries(s.tasks)){if(!vn(I)?.service)continue;if(c.has(w)){i.add(w),v.push(c.get(w));continue}if(f.has(w)||!$.has(w))continue;const _=d.get(w),G=h.get(w);let C;_?C=`Service ${w} is registered with vis ${_.visVersion}, but this invocation is vis ${a}. Restart with \`vis service restart ${w}\` to pick up the new version.`:G?C=`Service ${w} is registered (PID ${String(G.pid)}) but failed its readiness probe — the wrapper process is alive but the underlying server is not responding. Run \`vis service restart ${w}\` to recover.`:C=`Target depends on the service ${w}, which is not running. Run \`vis service start ${w}\` first, or invoke \`${w}\` directly.`,k.push({message:C,targetId:w})}if(i.size===0)return{diagnostics:k,initialTasks:e,satisfiedServices:v,serviceEnvByTaskId:new Map,taskGraph:s};const M=new Map,R=Je(w=>{const I=new Set,_=[...s.dependencies[w]??[]],G=new Set;for(;_.length>0;){const C=_.pop();if(!G.has(C)){G.add(C),i.has(C)&&I.add(C);for(const H of s.dependencies[C]??[])G.has(H)||_.push(H)}}return[...I].sort()},"collectTransitiveServices");for(const w of Object.keys(s.dependencies)){if(i.has(w))continue;const I=R(w);if(I.length===0)continue;const _={};for(const G of I){const C=c.get(G);C&&Object.assign(_,C.env)}Object.keys(_).length>0&&M.set(w,_)}const T={};for(const[w,I]of Object.entries(s.tasks))i.has(w)||(T[w]=I);const O={};for(const[w,I]of Object.entries(s.dependencies))i.has(w)||(O[w]=I.filter(_=>!i.has(_)));const P=new Map;for(const w of Object.keys(T))P.set(w,0);for(const w of Object.values(O))for(const I of w)P.has(I)&&P.set(I,(P.get(I)??0)+1);const Q=[];for(const w of s.roots)!i.has(w)&&T[w]&&Q.push(w);for(const[w,I]of P)I===0&&!Q.includes(w)&&T[w]&&Q.push(w);const F=e.filter(w=>!i.has(w.id));return{diagnostics:k,initialTasks:F,satisfiedServices:v,serviceEnvByTaskId:M,taskGraph:{dependencies:O,roots:Q,tasks:T}}},"applyServiceRegistry");var bn=Object.defineProperty,j=S((r,e)=>bn(r,"name",{value:e,configurable:!0}),"o");const lt="VIS_AFFECTED_FILES",$n=2e3,gr=j((r,e,t)=>t||!e?r:e.startsWith("/")?e:`${r}/${e}`,"resolveCwd"),Wt=j(async(r,e,t,o)=>{const s=r.map(a=>{const c=a.overrides.command;if(!c)return;const d=a.overrides.visOptions,h=gr(e,a.projectRoot,!!d?.runFromWorkspaceRoot),f=d?.envFile?zt(h,d.envFile):{},i=t&&(d?.affectedFiles==="env"||d?.affectedFiles==="both")?{[lt]:t.join(`
|
|
36
|
+
`)}:{};return{command:c,cwd:h,env:{INIT_CWD:o,...f,...i},name:a.id}}).filter(a=>a!==void 0);s.length!==0&&await tt(s,{killOthers:["failure"]})},"runPersistentTasks"),et=256*1024;class Tn{static{S(this,"Ze")}static{j(this,"OutputRingBuffer")}#e;#r="";#o=!1;constructor(e){this.#e=e}append(e){this.#r+=e,this.#r.length>this.#e&&(this.#r=this.#r.slice(-this.#e),this.#o=!0)}toString(){return this.#o?`[...output truncated, showing last ${Math.round(this.#e/1024)}KB...]
|
|
37
|
+
${this.#r}`:this.#r}}const wr=j(r=>{const e=r.overrides.visOptions;if(e&&typeof e=="object")return e},"getTaskOptions"),dt=j(r=>`'${r.replaceAll("'",String.raw`'\''`)}'`,"singleQuoteEscape"),Sn=j((r,e,t)=>{if(!e||e.length===0||t===!1||t===void 0)return r;if(t==="args"||t==="both"){const o=e.map(s=>dt(s)).join(" ");return`${r} ${o}`}return r},"buildAffectedFilesArgs"),kr="visForwardedArgs",Cn=j((r,e)=>{const t=e.overrides[kr];if(!Array.isArray(t)||t.length===0)return r;const o=t.map(s=>dt(s)).join(" ");return`${r} ${o}`},"appendForwardedArgs"),xn=j(async(r,e,t)=>{if(!e)return t();const o=r.get(e)??Promise.resolve();let s;const a=new Promise(d=>{s=d}),c=o.then(()=>a);r.set(e,c),await o;try{return await t()}finally{s(),r.get(e)===c&&r.delete(e)}},"withMutex"),In=j(r=>{let e=Math.max(0,Math.floor(r));return{claim(t){const o=Math.max(0,Math.min(t,e));return e-=o,o},get remaining(){return e}}},"createRetryBudget"),Mn=j((r,e,t)=>{const o=`${e}\0${typeof t=="string"?t:String(t)}`,s=r.get(o);if(s)return s;const a=zt(e,t);return r.set(o,a),a},"loadEnvFileCached"),Ut=j(r=>{const e=new Map;return async(t,o)=>{const{affectedFiles:s,currentOs:a,initCwd:c,lifeCycle:d,mutexPool:h,onOutput:f,onOutputReplace:i,retryBudget:k,serviceEnvByTaskId:v,stdinRegistry:$,strictEnv:M,workspaceRoot:R}=r,T=wr(t),O=gr(R,o.cwd??t.projectRoot,T?.runFromWorkspaceRoot===!0),P=t.overrides.command;if(!P)return{code:0,terminalOutput:`No command configured for ${t.target.project}:${t.target.target}`};const Q=Cn(P,t),F=Sn(Q,s,T?.affectedFiles),w=Hr(T,a),I=w?`${w} -c ${dt(F)}`:F,_=T?.envFile?Mn(e,O,T.envFile):void 0,G={};s&&s.length>0&&(T?.affectedFiles==="env"||T?.affectedFiles==="both")&&(G[lt]=s.join(`
|
|
38
|
+
`));const C=v?.get(t.id),H={INIT_CWD:c,..._,...C,...o.env,...G};if(T?.strictEnv??M??!1){const D=is({command:F,processEnv:process.env,taskEnv:H,taskId:t.id});if(D){const U=as(D);return d?.onTaskStderr?.(t,U),{code:1,terminalOutput:U}}}const ie=T?.pty===!0,L=!!$,q=L||ie;q&&(t.cache=!1);const ae=q?void 0:new Tn(et),J=q?new Vt(et):void 0;let B;const he=j(D=>{if(D.kind==="started"&&(B=D.kill,D.write&&$&&$.set(t.id,{kill:D.kill,resize:D.resize,write:D.write})),(D.kind==="stdout"||D.kind==="stderr")&&D.text!==void 0)if(D.kind==="stdout"?d?.onTaskStdout?.(t,D.text):d?.onTaskStderr?.(t,D.text),J)J.write(D.text),L&&i?.(t.id,J.toString());else{const U=`${D.text}
|
|
39
|
+
`;ae.append(U),f?.(t.id,U)}D.kind==="close"&&$&&$.delete(t.id)},"onEvent"),ce=j(async()=>{const D=T?.retryCount??0,U=T?.retryDelay,y=k?k.claim(D):D,m=typeof T?.timeout=="number"&&T.timeout>0?T.timeout:0,x=typeof T?.killGracePeriodMs=="number"&&T.killGracePeriodMs>=0?T.killGracePeriodMs:5e3;let ee=!1;const fe=sn({killGracePeriodMs:x,onTimeout:j(()=>{ee=!0},"onTimeout"),sendSignal:j(Ue=>{B?.(Ue)},"sendSignal"),timeoutMs:m});let xe;try{xe=await tt([{command:I,cwd:O,env:H,name:t.id,...q?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:he,...y>0?{restart:{delay:U??"exponential",tries:y}}:{}})}finally{fe.cancel()}const ye=xe.closeEvents[0],_e=J?J.toString():ae.toString();return ee?{code:124,terminalOutput:`${_e}
|
|
40
|
+
[timeout] Task "${t.id}" exceeded ${m}ms budget.
|
|
41
|
+
`}:{code:ye?.exitCode??1,terminalOutput:_e}},"runOnce");return h?xn(h,T?.mutex,ce):ce()}},"createConcurrentExecutor"),En=j(r=>{if(!r||r.trim().length===0)return;const e=Number.parseFloat(r);return!Number.isFinite(e)||e<=0?{invalid:r}:{value:Math.floor(e)}},"parseEnvConcurrency"),jn=j(async(r,e)=>{const t=await Mr(r);if(!t){e.warn("No previous run recorded yet. Run a task at least once to populate .task-runner/last-summary.json.");return}const o=(t.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${t.startTime} (${o}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 a=t.tasks.filter(c=>c.exitCode!==void 0&&c.exitCode!==0);e.info("Failed tasks:");for(const c of a){const d=c.duration??0;e.info(` × ${c.taskId} (exit ${String(c.exitCode??-1)}, ${d}ms)`)}e.info("")}const s=[...t.tasks].filter(a=>typeof a.duration=="number").sort((a,c)=>(c.duration??0)-(a.duration??0)).slice(0,5);if(s.length>0){e.info("Slowest tasks:");for(const a of s)e.info(` ${a.taskId.padEnd(40)} ${String(a.duration??0).padStart(6)}ms [${a.cacheStatus}]`);e.info("")}},"renderLastRunSummary"),Rn=j(r=>{if(!(r===void 0||r==="")){if(r!=="read"&&r!=="write"&&r!=="readwrite")throw new Error(`--cache-mode must be one of: read, write, readwrite (received "${r}")`);return r}},"parseCacheMode"),On=j(r=>{if(!(r===void 0||r==="")){if(r!=="http"&&r!=="reapi")throw new Error(`--cache-backend must be one of: http, reapi (received "${r}")`);return r}},"parseCacheBackend"),Kn=j(async({argument:r,logger:e,options:t,runtime:o,visConfig:s,workspaceRoot:a})=>{if(!a)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const c=a;if(t.lastDetails===!0){await jn(c,e);return}const d=process.cwd(),h=await Br(c),{config:f,packageJsons:i,projectOptions:k,workspace:v}=Nr(c,s,h),$=Gr(c,v,i);let M=r[0];if(!M){const g=Pt(v);if(process.stdout.isTTY&&process.stdin.isTTY){const b=await ps(g);if(!b){e.info("No target selected.");return}M=b,await Js(`vis run ${b}`)}else{e.info("Available targets:"),e.info(""),e.info(fs(g)),e.info(""),e.info("Usage: vis run <target>");return}}if(f.constraints&&!t.skipConstraints){const g=Er($,f.constraints);if(g.length>0){for(const b of g)e.error(`[${b.rule}] ${b.message}`);throw new Error(`${g.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(t.affected){const g=[M];t.parallel!==void 0&&g.push(`--parallel=${String(t.parallel)}`),t.cache||g.push("--no-cache"),t.query&&g.push(`--query=${String(t.query)}`),t.reverse&&g.push("--reverse"),typeof t.runnerTags=="string"&&t.runnerTags!==""&&g.push(`--runner-tags=${t.runnerTags}`),await o.runCommand("affected",{argv:g});return}const R=await lo(M,v,process.cwd(),c),T=ls(k),O=ds(R.target,T);O!==R.target&&e.debug?.(`Resolved alias "${R.target}" → "${O}"`);let P=R.projects;const Q=r.slice(1).map(String);if(t.projects){const g=new Set(t.projects.split(",").map(b=>b.trim()));if(P=P.filter(b=>g.has(b)),P.length===0)throw new Error(`No matching projects found for: ${String(t.projects)}`)}if(t.query&&(P=uo(P,v,t.query),P.length===0)){e.info(`Query "${String(t.query)}" matched no projects.`);return}const F=qr(),w=process.env[lt],I=w?w.split(`
|
|
42
|
+
`).filter(Boolean):void 0,_=(typeof t.runnerTags=="string"?t.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,G=_?new Set(_.split(",").map(g=>g.trim()).filter(Boolean)):void 0,C=[],H=new Map;for(const g of P){const b=k.get(g)?.[O];if(!b)continue;const E=b.options;if(!E?.internal){if(!Wr(E,!!ze)){e.debug?.(`Skipping ${g}:${O} — runInCI filter`);continue}if(!Ur(E,G)){e.debug?.(`Skipping ${g}:${O} — runner-tags filter`);continue}C.push(g),H.set(g,b)}}if(C.length===0){const g=Pt(v),b=Object.entries(v.projects).filter(([,E])=>E.targets?.[O]!==void 0).map(([E])=>E);if(e.error(`No projects have the "${O}" target.`),b.length>0){e.info(""),e.info(`Target "${O}" exists in these projects but was filtered out:`);for(const E of b.slice(0,5))e.info(` - ${E}`);b.length>5&&e.info(` …and ${b.length-5} more`)}else{const E=or(O,g,3);E.length>0&&(e.info(""),e.info(E.length===1?`Did you mean "${E[0]}"?`:`Did you mean one of: ${E.map(V=>`"${V}"`).join(", ")}?`)),e.info(""),e.info("Run `vis run` without arguments to see all available targets.")}return}const ie=t.pty===!0;let L=C.map(g=>{const b=v.projects[g],E=H.get(g),V={project:g,target:O},W=`${g}:${O}`,pe=ie?{...E.options,pty:E.options?.pty??!0}:E.options,oe=E.command?jr(E.command,{affectedFiles:I,projectRoot:b?.root}):E.command;return{cache:E.cache,id:W,outputs:E.outputs??[],overrides:{command:oe,...Q.length>0?{[kr]:Q}:{},...pe?{visOptions:pe}:{}},parallelism:E.parallelism,projectRoot:b?.root,target:V}});const q=[],ae=[];for(const g of L)wr(g)?.persistent?(g.cache=!1,q.push(g)):ae.push(g);L=ae;const J=Rr(t.partition);if(J&&(L=Or.partitionTasks(L,J),e.info(`Partition ${J.index}/${J.total}: running ${L.length} task(s)`),L.length===0)){e.info("No tasks assigned to this partition.");return}let B=Pr(L,{projectGraph:$,targetDefaults:f.targetDefaults,workspace:v});for(const[g,b]of Object.entries(B.tasks)){if(b.overrides.visOptions!==void 0)continue;const E=b.target.project,V=b.target.target,W=k.get(E)?.[V];W?.options&&(b.overrides={...b.overrides,visOptions:W.options},B.tasks[g]=b)}if(typeof t.skipCache=="string"&&t.skipCache.trim()!=="")if(t.cache){const g=ts(t.skipCache,v,Object.keys(B.tasks));for(const b of g.skipTaskIds){const E=B.tasks[b];E!==void 0&&(E.cache=!1)}g.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${g.unmatchedPatterns.map(b=>`"${b}"`).join(", ")}`),g.skipTaskIds.size>0&&e.debug?.(`--skip-cache: bypassing cache for ${String(g.skipTaskIds.size)} task(s)`)}else e.debug?.("--skip-cache ignored: --no-cache already disables caching for the whole run");await so(c,f.toolchain,{error:j(g=>{e.error(g)},"error"),info:j(g=>{e.info(g)},"info"),warn:j(g=>{e.warn(g)},"warn")},!!t.skipToolchain);const he=t.preflight!==!1&&f.preflight?.lockfile!==!1,ce=Zo(c,ze,{warn:j(g=>{e.warn(g)},"warn")},{skip:!he});if(!ce.shouldContinue)throw new Error(`${ce.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);const D=await io(c),U=await yn({initialTasks:L,probe:t.dryRun?void 0:async g=>{try{return await ao(g.config,{timeoutMs:$n}),!0}catch{return!1}},registeredEntries:D,taskGraph:B,visVersion:process.env.VIS_VERSION??"0.0.0"});if(U.diagnostics.length>0){for(const g of U.diagnostics)e.error(g.message);throw new Error(`${U.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`)}L=U.initialTasks,B=U.taskGraph;const{serviceEnvByTaskId:y}=U;if(U.satisfiedServices.length>0){const g=U.satisfiedServices.map(b=>b.id).join(", ");e.debug?.(`Auto-attached to running services: ${g}`)}if(t.reverse&&(B=_r(B),e.debug?.(`Reversed task graph: ${String(B.roots.length)} new root(s) (originally leaves)`)),t.dryRun){const g=Object.keys(B.tasks).length,b=B.roots.length;e.info(`Execution plan (${String(g)} task(s), ${String(b)} root(s)):`),e.info("");const E=new Set,V=j((W,pe)=>{if(E.has(W))return;E.add(W);for(const ke of B.dependencies[W]??[])V(ke,pe+1);const oe=B.tasks[W],se=" ".repeat(pe+1);e.info(`${se}${W}${oe?.cache===!1?" (no-cache)":""}`)},"walkPlan");for(const W of B.roots)V(W,0);for(const W of Object.keys(B.tasks))V(W,0);q.length>0&&(e.info(""),e.info(` + ${String(q.length)} persistent task(s) (run after graph completes)`)),e.info("");return}const m=Date.now(),x=Ys(),ee=j((g,b)=>{const E=b instanceof Error?b.message:String(b);e.warn(`Plugin error in ${g}: ${E}`)},"onHookError");await Ks(x,f.plugins);const fe=typeof t.profile=="string"?t.profile:void 0,xe=j(async g=>{if(!fe)return;const b=St(g,B,m),E=fe.startsWith("/")?fe:`${c}/${fe}`;await Fr(b,E),e.info(`Profile written to ${fe}`)},"maybeWriteProfile"),ye=f.taskRunnerOptions??{},_e=Vr(c,t.cacheDir,ye.cacheDirectory,f.sharedWorktreeCache),Ue=zr(_e,c,f.branchScopedCache),be=En(process.env.VIS_RUN_CONCURRENCY_LIMIT);be&&"invalid"in be&&e.warn(`VIS_RUN_CONCURRENCY_LIMIT=${be.invalid} is not a positive number; falling back to default concurrency.`);const vr=be&&"value"in be?be.value:void 0,yr=t.parallel??vr??3,ut=t.strictEnv??f.strictEnv??!1,Fe={dryRun:t.dryRun??!1,parallel:yr,skipNxCache:!t.cache,summarize:t.summarize??!1,...ye,cacheDirectory:Ue};if(ye.remoteCache){const g=Rn(t.cacheMode),b=On(t.cacheBackend);(g||b)&&(Fe.remoteCache={...ye.remoteCache,...g?{mode:g}:{},...b?{backend:b}:{}})}else(t.cacheMode||t.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts; ignoring.");const br=process.stdout.isTTY&&!ze,$r=f.tui?.autoExit??!1,ht={args:{parallel:Fe.parallel,targets:[O]},autoExit:$r,projectNames:C,tasks:L},ft=typeof t.retryBudget=="number"?t.retryBudget:void 0,pt=ft===void 0?void 0:In(ft),mt=new Qs(x,ee),gt=new Zr(c),wt=Ds(typeof t.outputStyle=="string"?t.outputStyle.toLowerCase():void 0);if(await x.callHook("run:before",{tasks:L,workspaceRoot:c}),br){const g=new Map,b=As({...ht,outputStyle:wt,stdinRegistry:g}),{lifeCycle:E,store:V}=b,W=new Ct([E,mt,gt]),pe=Ut({affectedFiles:I,currentOs:F,initCwd:d,lifeCycle:W,mutexPool:new Map,onOutput:j((A,z)=>{V.addOutput(A,z)},"onOutput"),onOutputReplace:j((A,z)=>{V.setOutput(A,z)},"onOutputReplace"),retryBudget:pt,serviceEnvByTaskId:y,stdinRegistry:g,strictEnv:ut,workspaceRoot:c});let oe="rerun",se=null,ke=new Map;for(;oe!=="quit";){if(oe==="rerun")ke=await xt(L,Fe,{lifeCycle:W,projectGraph:$,taskExecutor:pe,taskGraph:B,workspaceRoot:c});else if(oe==="retry"&&se){const A=L.find(Z=>Z.id===se),z=A?.overrides.command;if(A&&z){const Z=A.projectRoot??c,ge=Z.startsWith("/")?Z:`${c}/${Z}`;W.startTasks?.([A]);const ne=new Vt(et),le=(await tt([{command:z,cwd:ge,name:A.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:j(K=>{K.kind==="started"&&K.write&&g.set(A.id,{kill:K.kill,resize:K.resize,write:K.write}),(K.kind==="stdout"||K.kind==="stderr")&&K.text&&(ne.write(K.text),V.setOutput(A.id,ne.toString())),K.kind==="close"&&g.delete(A.id)},"onEvent")})).closeEvents[0];W.endTasks?.([{code:le?.exitCode??1,status:le?.exitCode===0?"success":"failure",task:A,terminalOutput:V.getSnapshot().outputs.get(A.id)}])}else A&&W.endTasks?.([{code:1,status:"failure",task:A,terminalOutput:`No command configured for ${A.id}`}]);se=null,V.markDone()}oe=await new Promise(A=>{const z=V.subscribe(()=>{const Z=V.getSnapshot();Z.rerunRequested&&(V.acknowledgeRerun(),z(),A("rerun")),Z.retryTaskId&&(se=V.acknowledgeRetry(),z(),A("retry"))});b.renderIsDone.then(()=>{z(),A("quit")}).catch(()=>{z(),A("quit")})})}await b.renderIsDone,await x.callHook("run:after",ke),await xe(ke),q.length>0&&!t.failFast&&await Wt(q,c,I,d)}else{const g=new Map,b=typeof t.log=="string"?t.log.toLowerCase():"",E=b==="labeled"||b==="grouped"||b==="interleaved"?b:void 0,V=E?Ar(E):void 0,W=new Ct([new Bs({...ht,logReporter:V,outputStyle:wt}),mt,gt]),pe=Ut({affectedFiles:I,currentOs:F,initCwd:d,lifeCycle:W,mutexPool:g,retryBudget:pt,serviceEnvByTaskId:y,strictEnv:ut,workspaceRoot:c}),oe=j(async()=>{const A=Date.now(),z=await xt(L,Fe,{lifeCycle:W,projectGraph:$,taskExecutor:pe,taskGraph:B,workspaceRoot:c}),Z=Date.now()-A;if(t.summarize){const de=St(z,B,m);await Lr(de,c)}let ge=!1;for(const[,de]of z)de.status==="failure"&&(ge=!0);const ne=Jr(z,Z),le=eo(c),K=to(c,Z,le);return e.info(""),e.info(` ${ne}${K?` ${K}`:""}`),{hasFailure:ge,results:z,runHistory:le}},"runOnce"),se=await oe();await x.callHook("run:after",se.results),await xe(se.results);const{hasFailure:ke}=se;if(t.watch){const A=C.map(X=>{const te=v.projects[X]?.root;if(te)return te.startsWith("/")?te:`${c}/${te}`}).filter(X=>X!==void 0),z=L;let Z;const ge=j(X=>{const te=hn(z,X);return Z=te.filter,L=te.tasks,te.tasks.length},"applyFilter");let ne=!1,le=se.results;const K=j(()=>{const X=Gt(le,c);if(X.directories.length>0&&X.files.size>0){const te=cn(X.files,c,X.directories);return{handle:qt({filter:te,onChange:kt,paths:X.directories}),mode:"tracked"}}return{handle:qt({onChange:kt,paths:A}),mode:"roots"}},"buildHandle");let de;const kt=j(async X=>{if(!ne){ne=!0;try{e.info(`Change detected in ${X.length} file(s), rerunning…`),le=(await oe()).results,de?.close(),de=K().handle}finally{ne=!1}}},"onChangeHandler"),vt=K();de=vt.handle;const Tr=vt.mode==="tracked"?`Watching ${String(Gt(le,c).files.size)} tracked file(s)`:`Watching ${String(A.length)} project root(s)`;e.info(`${Tr} — edit a file to rerun, press h for keybinds, q to quit.`);const Ve=j(async()=>{if(!ne){ne=!0;try{if(L.length===0){e.info("No tasks match the active filter — press a to clear it.");return}le=(await oe()).results,de?.close(),de=K().handle}finally{ne=!1}}},"triggerRerun");await new Promise(X=>{let te=!1,yt;const bt=j(()=>{$t()},"onSigint"),$t=j(()=>{te||(te=!0,yt?.close(),process.off("SIGINT",bt),de?.close(),X())},"exit");process.on("SIGINT",bt),yt=wn({handlers:{onClearFilter:j(async()=>{const Ie=ge(void 0);e.info(`Filter cleared — running ${String(Ie)} task(s).`),await Ve()},"onClearFilter"),onFilter:j(async Ie=>{const Sr=Z,Tt=ge(Ie);if(Tt===0){e.info(`Filter "${Ie}" matched no projects — keeping previous filter.`),ge(Sr);return}e.info(`Filter "${Ie}" matched ${String(Tt)} task(s).`),await Ve()},"onFilter"),onHelp:j(()=>{mn(process.stdout)},"onHelp"),onQuit:j(()=>{$t()},"onQuit"),onRerun:Ve}})});return}if(ke){if(t.flaky!==!1){const A=ro(c,{minRuns:2},se.runHistory);if(A.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const z of oo(A))e.info(` ${z}`);e.info("")}}throw new Error("Some tasks failed.")}q.length>0&&!t.failFast&&await Wt(q,c,I,d)}},"execute");export{In as createRetryBudget,Kn as default};
|