@visulima/vis 1.0.0-alpha.11 → 1.0.0-alpha.13
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 +101 -0
- package/LICENSE.md +559 -186
- package/README.md +18 -0
- package/dist/bin.js +1 -9
- package/dist/config/index.d.ts +477 -556
- package/dist/config/index.js +1 -2
- package/dist/generate/index.js +1 -3
- package/dist/packem_chunks/applyDefaults.js +2 -336
- package/dist/packem_chunks/bin.js +234 -9552
- package/dist/packem_chunks/doctor-probe.js +2 -112
- package/dist/packem_chunks/fix.js +11 -234
- package/dist/packem_chunks/handler.js +1 -99
- package/dist/packem_chunks/handler10.js +2 -53
- package/dist/packem_chunks/handler11.js +1 -32
- package/dist/packem_chunks/handler12.js +5 -100
- package/dist/packem_chunks/handler13.js +1 -25
- package/dist/packem_chunks/handler14.js +18 -916
- package/dist/packem_chunks/handler15.js +15 -201
- package/dist/packem_chunks/handler16.js +1 -124
- package/dist/packem_chunks/handler17.js +1 -13
- package/dist/packem_chunks/handler18.js +1 -106
- package/dist/packem_chunks/handler19.js +1 -19
- package/dist/packem_chunks/handler2.js +2 -75
- package/dist/packem_chunks/handler20.js +5 -29
- package/dist/packem_chunks/handler21.js +1 -222
- package/dist/packem_chunks/handler22.js +1 -237
- package/dist/packem_chunks/handler23.js +5 -101
- package/dist/packem_chunks/handler24.js +1 -110
- package/dist/packem_chunks/handler25.js +3 -402
- package/dist/packem_chunks/handler26.js +1 -13
- package/dist/packem_chunks/handler27.js +1 -63
- package/dist/packem_chunks/handler28.js +7 -34
- package/dist/packem_chunks/handler29.js +21 -456
- package/dist/packem_chunks/handler3.js +4 -95
- package/dist/packem_chunks/handler30.js +3 -170
- package/dist/packem_chunks/handler31.js +1 -530
- package/dist/packem_chunks/handler32.js +2 -214
- package/dist/packem_chunks/handler33.js +25 -119
- package/dist/packem_chunks/handler34.js +2 -630
- package/dist/packem_chunks/handler35.js +3 -283
- package/dist/packem_chunks/handler36.js +22 -542
- package/dist/packem_chunks/handler37.js +410 -744
- package/dist/packem_chunks/handler38.js +22 -989
- package/dist/packem_chunks/handler39.js +22 -574
- package/dist/packem_chunks/handler4.js +2 -90
- package/dist/packem_chunks/handler40.js +22 -1685
- package/dist/packem_chunks/handler41.js +6 -1088
- package/dist/packem_chunks/handler42.js +5 -797
- package/dist/packem_chunks/handler43.js +10 -2658
- package/dist/packem_chunks/handler44.js +51 -3784
- package/dist/packem_chunks/handler45.js +25 -2574
- package/dist/packem_chunks/handler46.js +3 -3769
- package/dist/packem_chunks/handler47.js +21 -1485
- package/dist/packem_chunks/handler48.js +42 -0
- package/dist/packem_chunks/handler5.js +8 -174
- package/dist/packem_chunks/handler6.js +1 -95
- package/dist/packem_chunks/handler7.js +1 -115
- package/dist/packem_chunks/handler8.js +1 -12
- package/dist/packem_chunks/handler9.js +1 -29
- package/dist/packem_chunks/heal-accept.js +10 -522
- package/dist/packem_chunks/heal.js +14 -673
- package/dist/packem_chunks/index.js +7 -873
- package/dist/packem_chunks/loader.js +1 -23
- package/dist/packem_chunks/tar.js +3 -0
- package/dist/packem_shared/ai-analysis-hm8d2W7z.js +67 -0
- package/dist/packem_shared/ai-cache-DoiF80AR.js +1 -0
- package/dist/packem_shared/ai-fix-nn4zOE95.js +43 -0
- package/dist/packem_shared/cache-directory-CwHlJhgx.js +1 -0
- package/dist/packem_shared/dependency-scan-COr5n63B.js +2 -0
- package/dist/packem_shared/docker-D6OGr5_S.js +2 -0
- package/dist/packem_shared/failure-log-iUVLf6ts.js +2 -0
- package/dist/packem_shared/flakiness-D9wf0t56.js +1 -0
- package/dist/packem_shared/giget-CcEy_Elm.js +2 -0
- package/dist/packem_shared/index-DH-5hsrC.js +1 -0
- package/dist/packem_shared/otel-DxDUPJJH.js +6 -0
- package/dist/packem_shared/otelPlugin-CQq6poq8.js +1 -0
- package/dist/packem_shared/registry-CkubDdiY.js +2 -0
- package/dist/packem_shared/run-summary-utils-BfBvjzhY.js +1 -0
- package/dist/packem_shared/runtime-check-BXZ43CBW.js +1 -0
- package/dist/packem_shared/selectors-BylODRiM.js +3 -0
- package/dist/packem_shared/symbols-CQmER5MT.js +1 -0
- package/dist/packem_shared/toolchain-BgBOUHII.js +5 -0
- package/dist/packem_shared/typosquats-CcZl99B1.js +1 -0
- package/dist/packem_shared/use-measured-height-DjYgUOKk.js +1 -0
- package/dist/packem_shared/utils-DrNg0XTR.js +1 -0
- package/dist/packem_shared/verify-Baj5mFJ7.js +1 -0
- package/dist/packem_shared/vis-update-app-D1jl0UZZ.js +1 -0
- package/dist/packem_shared/xxh3-DrAUNq4n.js +1 -0
- package/index.js +556 -727
- package/package.json +19 -29
- package/schemas/project.schema.json +739 -297
- package/schemas/vis-config.schema.json +3365 -384
- package/templates/buildkite-ci/template.yml +20 -20
- package/dist/packem_shared/VisUpdateApp-D-Yz_wvg.js +0 -1316
- package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +0 -5
- package/dist/packem_shared/ai-analysis-CHeB1joD.js +0 -367
- package/dist/packem_shared/ai-cache-Be_jexe4.js +0 -142
- package/dist/packem_shared/ai-fix-B9iQVcD2.js +0 -379
- package/dist/packem_shared/cache-directory-2qvs4goY.js +0 -98
- package/dist/packem_shared/catalog-BJTtyi-O.js +0 -1371
- package/dist/packem_shared/dependency-scan-A0KSklpG.js +0 -188
- package/dist/packem_shared/docker-2iZzc280.js +0 -181
- package/dist/packem_shared/failure-log-Cz3Z4SKL.js +0 -100
- package/dist/packem_shared/flakiness-goTxXuCX.js +0 -180
- package/dist/packem_shared/otel-DCvqCTz_.js +0 -158
- package/dist/packem_shared/otelPlugin-DFaLDvJf.js +0 -3
- package/dist/packem_shared/registry-CbqXI0rc.js +0 -272
- package/dist/packem_shared/run-summary-utils-PVMl4aIh.js +0 -130
- package/dist/packem_shared/runtime-check-Cobi3p6l.js +0 -127
- package/dist/packem_shared/selectors-SM69TfqC.js +0 -194
- package/dist/packem_shared/symbols-Ta7g2nU-.js +0 -14
- package/dist/packem_shared/toolchain-BdZd9eBi.js +0 -975
- package/dist/packem_shared/typosquats-C-bCh3PX.js +0 -1210
- package/dist/packem_shared/use-measured-height-CNP0vT4M.js +0 -20
- package/dist/packem_shared/utils-CthVdBPS.js +0 -40
- package/dist/packem_shared/xxh3-Ck8mXNg1.js +0 -239
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var $r=Object.defineProperty;var T=(r,e)=>$r(r,"name",{value:e,configurable:!0});import{createRequire as Tr}from"node:module";import{runConcurrently as et,TerminalBuffer as Wt,readLastRunSummary as Cr,enforceProjectConstraints as xr,expandTokensInString as Ir,parsePartition as Mr,TaskScheduler as Er,createTaskGraph as Rr,reverseTaskGraph as jr,generateRunSummary as Tt,writeChromeTrace as Or,CompositeLifeCycle as St,defaultTaskRunner as Ct,createLogReporter as Pr,writeRunSummary as Fr}from"@visulima/task-runner";import{an as _r,p as xt,aj as Ut,aK as Ar,ai as Lr,k as Dr,y as Hr,aL as Br,aM as Nr,s as Ve,aN as Gr}from"./bin.js";import{E as qr,a as Wr}from"../packem_shared/cache-directory-CwHlJhgx.js";import{join as Ce,basename as Vr,dirname as zr,resolve as Yt,relative as Yr}from"@visulima/path";import{F as Kr}from"../packem_shared/failure-log-iUVLf6ts.js";import{f as Qr,l as Xr,c as Zr,a as Jr,b as eo}from"../packem_shared/flakiness-D9wf0t56.js";import{r as to}from"../packem_shared/toolchain-BgBOUHII.js";import{i as ro,c as oo,b as so}from"../packem_shared/registry-CkubDdiY.js";import{p as no,r as io,f as ao}from"../packem_shared/selectors-BylODRiM.js";import{Box as h,Text as n,StaticRender as It,renderToString as re,ScrollView as Kt,Spinner as uo,useApp as ho,useWindowSize as fo,useInput as Mt,Dialog as po,render as mo}from"@visulima/tui";import N,{useSyncExternalStore as go,useState as Et,useRef as Ee,useCallback as ze,useEffect as Ye,useMemo as Rt}from"react";import{jsxs as d,jsx as c}from"react/jsx-runtime";import{T as Qt,C as tt,D as De,E as Xt}from"../packem_shared/symbols-CQmER5MT.js";import{duration as Zt}from"@visulima/humanizer";const Sr=Tr(import.meta.url),Me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Le=T(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 Sr(r)},"__cjs_getBuiltinModule"),{existsSync:Vt,statSync:zt,watch:Ur}=Le("node:fs"),{createInterface:co,emitKeypressEvents:lo}=Le("node:readline"),{appendFile:rt}=Le("node:fs/promises"),{platform:wo,homedir:ot}=Le("node:os");var ko=Object.defineProperty,He=T((r,e)=>ko(r,"name",{value:e,configurable:!0}),"s$2");const vo={bun:["bun.lock","bun.lockb"],npm:["package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},yo={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"]},bo={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"}},$o=1e3,To=He(r=>{for(const[e,t]of Object.entries(vo))for(const s of t)if(Vt(Ce(r,s)))return{lockfileFile:s,manager:e}},"detectPackageManager"),So=He((r,e)=>{let t;for(const s of yo[e]){const o=Ce(r,s);if(!Vt(o))continue;const{mtimeMs:a}=zt(o);(!t||a>t.mtimeMs)&&(t={mtimeMs:a,path:s})}return t},"findFreshestMarker"),Co=He((r,e={})=>{const t=To(r);if(!t)return{checked:!1};const{lockfileFile:s,manager:o}=t,a=zt(Ce(r,s)).mtimeMs,l=So(r,o),u=bo[e.inCi?"ci":"tty"][o],f={installMarkerMtimeMs:l?.mtimeMs,lockfileMtimeMs:a,lockfilePath:s,marker:l?.path,packageManager:o};return l?a>l.mtimeMs+$o?{checked:!0,detail:f,failure:"stale-install",message:`${s} is newer than node_modules (${l.path}) — run \`${u}\` to sync.`}:{checked:!0,detail:f}:{checked:!0,detail:f,failure:"missing-install",message:`lockfile detected but node_modules looks uninitialised — run \`${u}\` before \`vis run\`.`}},"checkLockfileFreshness"),xo=He((r,e,t,s={})=>{if(s.skip)return{checked:!1,shouldContinue:!0};const o=Co(r,{inCi:e});if(!o.failure)return{...o,shouldContinue:!0};const a=`preflight: ${o.message??"lockfile drift detected"}`;return e&&!s.ciAsWarning?{...o,formattedMessage:a,shouldContinue:!1}:(t.warn(a),{...o,formattedMessage:a,shouldContinue:!0})},"runLockfilePreflight");var Io=Object.defineProperty,Jt=T((r,e)=>Io(r,"name",{value:e,configurable:!0}),"p$5");const Mo=Jt(r=>r.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),Eo=Jt((r,e,t)=>{const s=new Set,o=[];if(r===void 0||r.trim()==="")return{skipTaskIds:s,unmatchedPatterns:o};const a=[...t],l=new Set(a),u=new Map;for(const f of a){const p=f.lastIndexOf(":");if(p===-1)continue;const i=f.slice(p+1),S=u.get(i);S===void 0?u.set(i,[f]):S.push(f)}for(const f of Mo(r)){if(f.startsWith("~:"))throw new Error(`--skip-cache does not support the closest-project selector "~:" (received "${f}"). Use \`pkg:target\`, \`:target\`, or \`#tag:target\`.`);if(l.has(f)){s.add(f);continue}const p=no(f);if(!p){o.push(f);continue}let i=!1;if(p.kind==="all"){const S=u.get(p.target)??[];for(const b of S)s.add(b),i=!0}else if(p.kind==="project"){const S=p.projects?.[0];if(S!==void 0){const b=`${S}:${p.target}`;l.has(b)&&(s.add(b),i=!0)}}else if(p.kind==="tag"){const S=p.tag;if(S!==void 0){const b=u.get(p.target)??[];for(const E of b){const A=E.slice(0,E.lastIndexOf(":"));e.projects[A]?.tags?.includes(S)===!0&&(s.add(E),i=!0)}}}i||o.push(f)}return{skipTaskIds:s,unmatchedPatterns:o}},"resolveSkipCachePatterns");var Ro=Object.defineProperty,st=T((r,e)=>Ro(r,"name",{value:e,configurable:!0}),"a$2");const jo=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,Oo=new Set(["0","!","#","$","*","-","?","@","_"]),Po=st(r=>{const e=new Map;for(const t of r.matchAll(jo)){const s=t[1],o=t[3],a=t[2],l=s??o;if(l===void 0||Oo.has(l))continue;const u=a!==void 0,f=e.get(l);f===void 0?e.set(l,u):f&&!u&&e.set(l,!1)}return[...e.entries()].map(([t,s])=>({hasDefault:s,name:t}))},"extractEnvReferences"),Fo=st(r=>{const{command:e,processEnv:t,taskEnv:s,taskId:o}=r,a=Po(e);if(a.length===0)return;const l=[];for(const{hasDefault:u,name:f}of a){if(u)continue;const p=s[f],i=t[f];p===void 0&&i===void 0&&l.push(f)}if(l.length!==0)return{missing:l.toSorted(),taskId:o}},"checkStrictEnv"),_o=st(r=>{const e=r.missing.map(t=>`$${t}`).join(", ");return`Strict env: ${r.taskId} references unset variable${r.missing.length===1?"":"s"} ${e}. Set ${r.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},"formatStrictEnvError");var Ao=Object.defineProperty,we=T((r,e)=>Ao(r,"name",{value:e,configurable:!0}),"i$2");const jt=we(r=>{const e=new Set;for(const t of Object.values(r.projects))for(const s of Object.keys(t.targets??{}))e.add(s);return[...e].sort()},"collectAvailableTargets"),Lo=we(r=>{const e=new Map;for(const t of r.values())for(const[s,o]of Object.entries(t))for(const a of o.aliases??[])e.has(a)||e.set(a,s);return e},"buildAliasMap"),Do=we((r,e)=>e.get(r)??r,"resolveTargetAlias"),Ho=we((r,e)=>{if(r.length===0)return e.length;if(e.length===0)return r.length;const t=[];for(let s=0;s<=e.length;s++)t[s]=[s];for(let s=0;s<=r.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let o=1;o<=r.length;o++){const a=e[s-1]===r[o-1]?0:1;t[s][o]=Math.min(t[s-1][o]+1,t[s][o-1]+1,t[s-1][o-1]+a)}return t[e.length][r.length]},"levenshtein"),Bo=we((r,e,t=3)=>er(r,e,1,t)[0],"suggestTarget"),er=we((r,e,t=3,s=3)=>{const o=[];for(const a of e){const l=Ho(r.toLowerCase(),a.toLowerCase());l<=s&&o.push({distance:l,name:a})}return o.sort((a,l)=>a.distance-l.distance||a.name.localeCompare(l.name)),o.slice(0,t).map(a=>a.name)},"suggestTargets"),No=we(r=>r.length===0?" (no targets found)":r.map(e=>` - ${e}`).join(`
|
|
2
|
+
`),"formatTargetList"),Go=we(async r=>{if(r.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const e=co({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
|
|
3
|
+
`);for(const[o,a]of r.entries())process.stdout.write(` ${String(o+1).padStart(2," ")}. ${a}
|
|
4
|
+
`);process.stdout.write(`
|
|
5
|
+
`);const t=(await new Promise(o=>{e.question("Select a target (number or name, blank to cancel): ",o)})).trim();if(t.length===0)return;const s=Number.parseInt(t,10);return Number.isFinite(s)&&s>=1&&s<=r.length?r[s-1]:r.includes(t)?t:Bo(t,r)}finally{e.close()}},"promptTargetInteractively");var qo=Object.defineProperty,nt=T((r,e)=>qo(r,"name",{value:e,configurable:!0}),"i$1");const Wo=nt(r=>Array.isArray(r)?`[${r.join(",")}]`:typeof r=="object"&&r!==null?JSON.stringify(r):String(r),"formatValue"),Uo=nt((r,e,t)=>e==="_"?`${r}${Array.isArray(t)?t.join(" "):String(t)}`:`${r}--${e}=${Wo(t)}`,"formatFlags"),it=nt((r,e,t)=>{const s=new Set(new Set(t.map(b=>b.target.target))),o=new Set(new Set(t.map(b=>b.target.project))),a=e.filter(b=>s.has(b)),l=r.filter(b=>o.has(b)),u=t.length-l.length*a.length,f=a.length===1?"target":"targets",p=a.join(", "),i=l.length===1?`project ${l[0]}`:`${l.length} projects`;let S=`${f} ${p} for ${i}`;return u>0&&(S+=` and ${u} ${u===1?"task":"tasks"} ${u===1?"it depends":"they depend"} on`),S},"formatTargetsAndProjects");var Vo=Object.defineProperty,zo=T((r,e)=>Vo(r,"name",{value:e,configurable:!0}),"c$4");const Yo={error:"red",info:"white",success:"green"},Xe=zo(({children:r,title:e,variant:t})=>{const s=Yo[t];return d(h,{flexDirection:"column",children:[d(h,{gap:1,children:[c(n,{bold:!0,inverse:!0,children:" VIS "}),c(n,{bold:!0,color:s,children:"•"}),c(n,{children:e})]}),r]})},"Header");var Ko=Object.defineProperty,Qo=T((r,e)=>Ko(r,"name",{value:e,configurable:!0}),"s$1");const tr=Qo(({cached:r,failed:e,failedIds:t,projectNames:s,skippedIds:o,succeeded:a,targets:l,tasks:u,took:f})=>{const p=it(s,l,u);if(e===0&&(!o||o.length===0)){const i=r>0?` (${r} read from cache)`:"";return c(It,{children:T(()=>c(Xe,{title:`Successfully ran ${p}`,variant:"success",children:d(h,{flexDirection:"column",paddingLeft:2,children:[d(n,{children:[c(n,{color:"green",children:Qt})," ",a+r," ","tasks completed",i?c(n,{dimColor:!0,children:i}):null]}),d(n,{dimColor:!0,children:[" ","Took",f]})]})}),"children")})}return c(It,{children:T(()=>c(Xe,{title:`Ran ${p}`,variant:"error",children:d(h,{flexDirection:"column",paddingLeft:2,children:[o&&o.length>0&&d(h,{flexDirection:"column",children:[d(n,{dimColor:!0,children:[o.length," ","task",o.length===1?"":"s"," ","skipped (dependency failed or --bail)"]}),o.map(i=>d(n,{dimColor:!0,children:[" - ",i]},i)),c(n,{})]}),e>0&&d(h,{flexDirection:"column",children:[d(n,{children:[c(n,{color:"red",children:String(e)})," ","task",e===1?"":"s"," ","failed:"]}),t.map(i=>d(n,{children:[" ",c(n,{color:"red",children:tt})," ",i]},i)),c(n,{})]}),d(n,{dimColor:!0,children:[" ","Took",f]})]})}),"children")})},"CommandSummary");var Xo=Object.defineProperty,Ke=T((r,e)=>Xo(r,"name",{value:e,configurable:!0}),"u$2");class Ae{static{T(this,"TaskStore")}static{Ke(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=Ke(()=>this.#e,"getSnapshot");subscribe=Ke(e=>(this.#r.add(e),()=>{this.#r.delete(e)}),"subscribe");startTasks(e){const t=[...this.#e.rows];for(const s of e){const o=t.findIndex(a=>a.taskId===s.id);o!==-1&&(t[o]={...t[o],elapsed:0,status:"running"},this.#o.set(s.id,process.hrtime()))}this.#t({...this.#e,rows:t})}endTasks(e){const t=[...this.#e.rows];let{cached:s,completed:o,failed:a,succeeded:l}=this.#e;const u=new Map(this.#e.outputs);for(const p of e){const i=t.findIndex(S=>S.taskId===p.task.id);switch(i!==-1&&(t[i]={...t[i],duration:p.startTime&&p.endTime?p.endTime-p.startTime:void 0,status:p.status}),o++,p.status){case"failure":{a++;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{s++;break}case"success":{l++;break}}p.terminalOutput&&!u.has(p.task.id)&&u.set(p.task.id,p.terminalOutput),this.#o.delete(p.task.id)}let{selectedIndex:f}=this.#e;if(a>this.#e.failed){const p=t.findIndex(i=>i.status==="failure");p!==-1&&(f=p)}this.#t({...this.#e,cached:s,completed:o,failed:a,outputs:u,rows:t,selectedIndex:f,succeeded:l})}static#s=256*1024;addOutput(e,t){if(!t.trim())return;let s=(this.#e.outputs.get(e)??"")+t;s.length>Ae.#s&&(s=s.slice(-Ae.#s)),this.#e.outputs.set(e,s),this.#t({...this.#e})}setOutput(e,t){this.#e.outputs.set(e,t),this.#t({...this.#e})}markDone(){this.#t({...this.#e,done:!0,endTime:Date.now()})}tick(){if(this.#o.size===0)return;let e=!1;const t=[...this.#e.rows];for(let s=0;s<t.length;s++){const o=t[s];if(o.status==="running"){const a=this.#o.get(o.taskId);if(a){const l=process.hrtime(a),u=l[0]*1e3+l[1]/1e6;t[s]={...o,elapsed:u},e=!0}}}e&&this.#t({...this.#e,rows:t})}setSelectedIndex(e){e!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:e})}setFocusedPanel(e){e!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:e})}setFilter(e){this.#t({...this.#e,filterText:e,selectedIndex:0})}setFilterActive(e){e!==this.#e.filterActive&&this.#t({...this.#e,filterActive:e,filterText:e?this.#e.filterText:"",selectedIndex:0})}pinTask(e,t){const s=[...this.#e.pinnedTaskIds];s[e]=t,this.#t({...this.#e,pinnedTaskIds:s})}clearPins(){this.#t({...this.#e,pinnedTaskIds:[null,null]})}requestRetry(e){const t=[...this.#e.rows],s=t.findIndex(u=>u.taskId===e);let{completed:o,failed:a,succeeded:l}=this.#e;if(s!==-1){const u=t[s].status;u==="failure"?(a=Math.max(0,a-1),o=Math.max(0,o-1)):u==="success"&&(l=Math.max(0,l-1),o=Math.max(0,o-1)),t[s]={...t[s],elapsed:0,status:"running"},this.#o.set(e,process.hrtime())}this.#t({...this.#e,completed:o,done:!1,endTime:null,failed:a,interactiveMode:!1,retryTaskId:e,rows:t,succeeded:l})}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 Zo=Object.defineProperty,ue=T((r,e)=>Zo(r,"name",{value:e,configurable:!0}),"t$1");const rr={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 Zt(e,rr)},"formatHrtime");const ve=ue(r=>Zt(r,rr),"formatMs");var Jo=Object.defineProperty,je=T((r,e)=>Jo(r,"name",{value:e,configurable:!0}),"n$3");const Te=je(r=>r==="local-cache"||r==="local-cache-kept-existing"||r==="remote-cache","isCacheStatus"),Oe=je(r=>{switch(r){case"failure":return{color:"red",icon:tt};case"local-cache":case"local-cache-kept-existing":case"remote-cache":case"success":return{color:"green",icon:Qt};case"skipped":return{color:"gray",icon:De};default:return{color:"gray",icon:"?"}}},"getStatusInfo"),or=je(r=>{const{color:e,icon:t}=Oe(r);return re(N.createElement(n,{color:e},t),{columns:10}).trim()},"getStatusIcon"),es=je(r=>{const{color:e,icon:t}=Oe(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"),ts=je((r,e,t)=>{const s=t.trim();if(!s)return;const o=`
|
|
6
|
+
`;if(process.env.GITHUB_ACTIONS==="true")process.stdout.write(`::group::${or(e)} ${r}${o}`),process.stdout.write(s+o),process.stdout.write(`::endgroup::${o}`);else{const a=process.stdout.columns||80,l=re(N.createElement(n,{dimColor:!0},De.repeat(a)),{columns:a}).trim(),u=es(e),f=re(N.createElement(n,{bold:!0},r),{columns:a}).trim();process.stdout.write(`${l}${o}`),process.stdout.write(`${u} ${f}${o}`),process.stdout.write(s+o),process.stdout.write(`${l}${o}`)}},"logCommandOutputCI");var rs=Object.defineProperty,sr=T((r,e)=>rs(r,"name",{value:e,configurable:!0}),"c$3");const os=sr(r=>r==="running"?{color:"white",icon:"•"}:r==="pending"?{color:"gray",icon:"·"}:Oe(r),"getDisplayInfo"),Ot=sr(({duration:r,focused:e,interactiveMode:t,output:s,scrollRef:o,showFullscreenHint:a,status:l,taskId:u})=>{const f=l??"pending",{icon:p}=os(f),i=e?"bold":"single",S=f==="failure"?"red":f==="success"||Te(f)?e?"green":"gray":f==="running"?e?"white":"cyan":e?"white":"gray",b=u?`${p} ${u}`:void 0,E=r===void 0?void 0:ve(r),A=u?t?"Esc cancel | Enter send":e&&f==="running"&&a?"⏎ FULLSCREEN i INPUT":e&&f==="running"?"i INPUT":e&&a?"<enter> full screen":e?void 0:"<tab> or <enter> to focus":void 0;if(!u)return d(h,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",paddingX:2,paddingY:1,children:[c(n,{dimColor:!0,children:"Select a task to view output"}),c(n,{dimColor:!0,children:"Press Enter or 1/2 to pin"})]});const R=s?s.split(`
|
|
7
|
+
`).map(y=>y.replace(/\r$/,"")):[];return!s&&(f==="running"||f==="pending")?c(h,{borderBottomTitle:A,borderColor:S,borderStyle:i,borderTopRightTitle:E,borderTopTitle:b,flexDirection:"column",flexGrow:1,paddingX:2,paddingY:1,children:c(h,{alignItems:"center",flexGrow:1,justifyContent:"center",children:c(n,{dimColor:!0,children:"Waiting for task output..."})})}):d(h,{borderBottomTitle:A,borderColor:t?"yellow":S,borderStyle:i,borderTopRightTitle:E,borderTopTitle:b,flexDirection:"column",flexGrow:1,children:[c(h,{flexGrow:1,flexShrink:1,paddingY:1,children:c(Kt,{flexGrow:1,followOutput:!0,paddingX:2,ref:o,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:R.map((y,j)=>c(n,{children:y},String(j)))})}),t&&c(h,{flexShrink:0,justifyContent:"center",paddingX:1,children:c(n,{bold:!0,color:"yellow",children:"INTERACTIVE — keystrokes forwarded to task — Esc to exit"})})]})},"OutputPanel");var ss=Object.defineProperty,Be=T((r,e)=>ss(r,"name",{value:e,configurable:!0}),"x$1");const nr=6,ir=8,ar=10,ns=Be(r=>r==="running"||r==="pending"?Xt:r==="local-cache"||r==="local-cache-kept-existing"?"Local":r==="remote-cache"?"Remote":De,"getCacheLabel"),Pt=Be((r,e)=>e[0]===r?"[1]":e[1]===r?"[2]":"","getPinLabel"),Ft=Be(({compact:r,isSelected:e,pinLabel:t,row:s})=>{const{status:o,taskId:a}=s,l=e?">":" ";let u;if(o==="running")u=d(n,{bold:!0,color:"white",children:[" ",c(uo,{type:"dots"})," "]});else if(o==="pending")u=c(n,{bold:!0,color:"gray",children:" · "});else{const{color:p,icon:i}=Oe(o);u=d(n,{bold:!0,color:p,children:[" ",i," "]})}let f=Xt;return o!=="running"&&o!=="pending"?f=s.duration===void 0?De:ve(s.duration):o==="running"&&s.elapsed!==void 0&&(f=ve(s.elapsed)),d(h,{children:[c(n,{children:l}),c(h,{width:nr,children:u}),d(h,{flexGrow:1,children:[c(n,{bold:e,inverse:e,children:a}),t?c(n,{dimColor:!0,children:` ${t}`}):null]}),!r&&c(h,{justifyContent:"flex-end",width:ir,children:c(n,{dimColor:!Te(o),children:ns(o)})}),!r&&c(h,{justifyContent:"flex-end",width:ar,children:c(n,{dimColor:o==="pending",children:f})})]})},"TaskListRow"),_t=Be(({compact:r,filterActive:e,filterText:t,focused:s,headerStatus:o,parallelSlots:a=3,pinnedTaskIds:l,rows:u,scrollRef:f,selectedIndex:p,title:i})=>{const S=o==="error"?"red":o==="success"?"green":s?"white":"gray",b=u[p]?.taskId,E=u.filter(y=>y.status==="running"),A=E.length>0||u.some(y=>y.status==="pending"),R=[];if(A)for(let y=0;y<a;y++){const j=E[y];j?R.push(c(Ft,{compact:r,isSelected:j.taskId===b,pinLabel:Pt(j.taskId,l),row:j},`par-${j.taskId}`)):R.push(d(h,{children:[c(n,{children:" "}),c(h,{width:nr,children:c(n,{bold:!0,color:"gray",children:" · "})}),c(n,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(y)}`))}return d(h,{borderColor:S,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[d(h,{flexShrink:0,gap:1,paddingX:1,children:[c(n,{bold:!0,inverse:!0,children:" VIS "}),c(n,{children:i}),!r&&d(h,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[c(h,{justifyContent:"flex-end",width:ir,children:c(n,{dimColor:!0,children:"Cache"})}),c(h,{justifyContent:"flex-end",width:ar,children:c(n,{dimColor:!0,children:"Duration"})})]})]}),c(Kt,{flexGrow:1,flexShrink:1,paddingLeft:1,paddingY:1,ref:f,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:u.map(y=>c(Ft,{compact:r,isSelected:y.taskId===b,pinLabel:Pt(y.taskId,l),row:y},y.taskId))}),A&&c(h,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingLeft:1,paddingY:1,children:R}),e&&d(h,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexShrink:0,paddingX:1,children:[c(n,{bold:!0,color:"white",children:"/ "}),c(n,{children:t}),c(n,{inverse:!0,children:" "})]})]})},"TaskListPanel");var is=Object.defineProperty,as=T((r,e)=>is(r,"name",{value:e,configurable:!0}),"y$2");const At=40,Lt=10,Dt=100,cs=as(({autoExitSeconds:r,parallelSlots:e,projectNames:t,stdinRegistry:s,store:o,targets:a,tasks:l})=>{const{exit:u}=ho(),{columns:f,rows:p}=fo(),i=go(o.subscribe,o.getSnapshot),[S,b]=Et(!1),E=Ee(null),A=Ee(null),R=Ee(null),[y,j]=Et(!1),O=Ee({list:0,splitList:0,splitOutput:0}),Q=ze(()=>{i.viewMode==="list"?O.current.list=A.current?.getScrollOffset()??0:i.viewMode==="split"&&(O.current.splitList=A.current?.getScrollOffset()??0,O.current.splitOutput=R.current?.getScrollOffset()??0)},[i.viewMode]),F=ze(k=>{setTimeout(()=>{if(k==="list"){const m=O.current.list;A.current?.scrollTo(m)}else if(k==="split"){const m=O.current.splitList;m>0?A.current?.scrollTo(m):A.current?.scrollTo(Math.max(0,o.getSnapshot().selectedIndex-2)),R.current?.scrollTo(O.current.splitOutput)}},0)},[o]),w=Ee(!1);Ye(()=>{i.done&&!w.current&&(w.current=!0,r>0&&j(!0)),!i.done&&w.current&&(w.current=!1,j(!1))},[i.done,r]);const x=Rt(()=>{let k=i.rows;if(i.statusFilter!=="all"&&(k=k.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();k=k.filter(C=>C.taskId.toLowerCase().includes(m))}return k},[i.rows,i.filterText,i.statusFilter]),P=Rt(()=>i.rows.filter(k=>k.status==="running").length,[i.rows]),G=(x[i.selectedIndex]??null)?.taskId??null,$=i.pinnedTaskIds[0]??G,H=$?i.rows.find(k=>k.taskId===$):null,ie=$?i.outputs.get($)??"":"",L=it(t,a,l),q=i.done?`Completed ${L} (${ve((i.endTime??Date.now())-i.startTime)})`:`Running ${L}...`,ae=i.done?i.failed>0?"error":"success":"running",J=ze(k=>{A.current?.scrollTo(Math.max(0,k-2))},[]);if(Ye(()=>{i.interactiveMode&&H?.status!=="running"&&o.setInteractiveMode(!1)},[i.interactiveMode,H?.status,o]),Ye(()=>{if(!$)return;let k=f;i.viewMode==="split"&&f>=Dt?k=f-Math.floor(f*.4)-2:(i.viewMode==="split"||i.viewMode==="fullscreen")&&(k=f-2);const m=Math.max(1,p-4);s.get($)?.resize?.(k,m)},[f,p,i.viewMode,$]),Mt((k,m)=>{if(m.escape){o.setInteractiveMode(!1);return}if(!$)return;const C=s.get($);if(!C){o.setInteractiveMode(!1);return}if(m.return)C.write("\r");else if(m.upArrow)C.write("\x1B[A");else if(m.downArrow)C.write("\x1B[B");else if(m.rightArrow)C.write("\x1B[C");else if(m.leftArrow)C.write("\x1B[D");else if(m.backspace)C.write("");else if(m.delete)C.write("\x1B[3~");else if(m.tab)C.write(" ");else if(m.home)C.write("\x1B[H");else if(m.end)C.write("\x1B[F");else if(m.pageUp)C.write("\x1B[5~");else if(m.pageDown)C.write("\x1B[6~");else if(m.ctrl&&k){const ee=k.toUpperCase().codePointAt(0);ee!==void 0&&ee>=65&&ee<=90&&C.write(String.fromCodePoint(ee-64))}else k&&C.write(k)},{isActive:i.interactiveMode}),Mt((k,m)=>{if(k==="c"&&m.ctrl){u();return}if(!y){if(S){m.escape||k==="?"?b(!1):k==="q"?(b(!1),j(!0)):m.downArrow||k==="j"?E.current?.scrollBy(1):m.upArrow||k==="k"?E.current?.scrollBy(-1):m.pageDown?E.current?.scrollBy(5):m.pageUp?E.current?.scrollBy(-5):m.home?E.current?.scrollToTop():m.end&&E.current?.scrollToBottom();return}if(k==="?"){b(!0);return}if(k==="q"){j(!0);return}if(k==="r"&&i.done){o.requestRerun();return}if(k==="R"&&i.done){const C=x[i.selectedIndex];C?.status==="failure"&&o.requestRetry(C.taskId);return}if(k==="F"&&!i.filterActive){const C=["all","failed","running","passed"],ee=C.indexOf(i.statusFilter);o.setStatusFilter(C[(ee+1)%C.length]);return}if(i.filterActive){if(m.escape){o.setFilterActive(!1);return}if(m.return){o.setFilterActive(!1);return}if(m.backspace){o.setFilter(i.filterText.slice(0,-1));return}if(k&&!m.ctrl&&!m.meta){o.setFilter(i.filterText+k);return}return}if(k==="i"&&H?.status==="running"&&(i.viewMode==="fullscreen"||i.viewMode==="split"&&i.focusedPanel==="output")){o.setInteractiveMode(!0);return}if(i.viewMode==="fullscreen"){if(m.escape){o.setViewMode("split"),F("split");return}if(m.downArrow||k==="j"){R.current?.scrollBy(1);return}if(m.upArrow||k==="k"){R.current?.scrollBy(-1);return}if(m.pageDown||m.ctrl&&k==="d"){R.current?.scrollBy(12);return}if(m.pageUp||m.ctrl&&k==="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 C=i.focusedPanel==="tasks"?"output":"tasks";o.setFocusedPanel(C);return}if(i.focusedPanel==="output"){if(m.escape){o.setFocusedPanel("tasks");return}if(m.return){Q(),o.setViewMode("fullscreen");return}if(m.downArrow||k==="j"){R.current?.scrollBy(1);return}if(m.upArrow||k==="k"){R.current?.scrollBy(-1);return}if(m.pageDown||m.ctrl&&k==="d"){R.current?.scrollBy(12);return}if(m.pageUp||m.ctrl&&k==="u"){R.current?.scrollBy(-12);return}if(m.home){R.current?.scrollToTop();return}if(m.end){R.current?.scrollToBottom();return}return}if(m.escape){o.setViewMode("list"),F("list");return}if(m.return){o.setFocusedPanel("output");return}}if(i.viewMode==="list"||i.viewMode==="split"&&i.focusedPanel==="tasks"){if(m.downArrow||k==="j"){const C=Math.min(i.selectedIndex+1,Math.max(0,x.length-1));o.setSelectedIndex(C),J(C);return}if(m.upArrow||k==="k"){const C=Math.max(i.selectedIndex-1,0);o.setSelectedIndex(C),J(C);return}if(m.return&&i.viewMode==="list"){Q(),O.current.splitList=0,O.current.splitOutput=0,o.setViewMode("split"),o.setFocusedPanel("output"),F("split");return}if(k==="/"){o.setFilterActive(!0);return}if(k==="1"&&G){o.pinTask(0,G);return}if(k==="2"&&G){o.pinTask(1,G);return}if(k==="0"){o.clearPins();return}m.escape&&i.filterText&&o.setFilter("")}}},{isActive:!i.interactiveMode}),f<At||p<Lt)return c(h,{alignItems:"center",height:p,justifyContent:"center",width:f,children:d(n,{color:"yellow",children:["Terminal too small (",f,"x",p,"). Minimum:"," ",At,"x",Lt]})});const B=d(h,{gap:1,children:[i.succeeded>0&&d(n,{bold:!0,color:"green",children:["✓"," ",i.succeeded]}),i.failed>0&&d(n,{bold:!0,color:"red",children:["✗"," ",i.failed]}),P>0&&d(n,{color:"cyan",children:["◷"," ",P]}),d(n,{dimColor:!0,children:[i.rows.length," ","total"]}),i.statusFilter!=="all"&&d(n,{color:"yellow",children:["[",i.statusFilter,"]"]})]});let he;if(i.viewMode==="fullscreen")he=[d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"Esc"}),c(n,{dimColor:!0,children:"BACK"})]},"esc"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"↑↓"}),c(n,{dimColor:!0,children:"SCROLL"})]},"scroll"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"^u ^d"}),c(n,{dimColor:!0,children:"PAGE"})]},"page"),...H?.status==="running"?[d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"i"}),c(n,{dimColor:!0,children:"INPUT"})]},"i")]:[],d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"q"}),c(n,{dimColor:!0,children:"QUIT"})]},"q")];else if(i.done){const k=x[i.selectedIndex]?.status==="failure";he=[d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"q"}),c(n,{dimColor:!0,children:"QUIT"})]},"q"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"r"}),c(n,{dimColor:!0,children:"RERUN"})]},"r"),...k?[d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"R"}),c(n,{dimColor:!0,children:"RETRY"})]},"R")]:[],d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"?"}),c(n,{dimColor:!0,children:"HELP"})]},"?"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"↑↓"}),c(n,{dimColor:!0,children:"NAV"})]},"nav"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"F"}),c(n,{dimColor:!0,children:"FILTER"})]},"F"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"⏎"}),c(n,{dimColor:!0,children:i.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter")]}else i.viewMode==="split"&&i.focusedPanel==="output"?he=[d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"q"}),c(n,{dimColor:!0,children:"QUIT"})]},"q"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"Esc"}),c(n,{dimColor:!0,children:"BACK"})]},"esc"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"↑↓"}),c(n,{dimColor:!0,children:"SCROLL"})]},"scroll"),...H?.status==="running"?[d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"i"}),c(n,{dimColor:!0,children:"INPUT"})]},"i")]:[],d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"⏎"}),c(n,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"Tab"}),c(n,{dimColor:!0,children:"PANEL"})]},"tab"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"?"}),c(n,{dimColor:!0,children:"HELP"})]},"?")]:he=[d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"q"}),c(n,{dimColor:!0,children:"QUIT"})]},"q"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"?"}),c(n,{dimColor:!0,children:"HELP"})]},"?"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"↑↓"}),c(n,{dimColor:!0,children:"NAV"})]},"nav"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"/"}),c(n,{dimColor:!0,children:"FILTER"})]},"/"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"F"}),c(n,{dimColor:!0,children:"STATUS"})]},"F"),d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"⏎"}),c(n,{dimColor:!0,children:i.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...i.viewMode==="split"?[d(h,{gap:1,children:[c(n,{bold:!0,color:"white",children:"Tab"}),c(n,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const ce=d(h,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[c(h,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:he}),c(h,{flexShrink:0,paddingX:1,children:B})]}),D=d(po,{backgroundColor:"#1e1e1e",footer:d(n,{dimColor:!0,children:[c(n,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",c(n,{bold:!0,color:"white",children:"?"}),"/",c(n,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:E,title:"KEYBOARD SHORTCUTS",visible:S,width:52,children:[d(h,{flexDirection:"column",marginBottom:1,children:[d(h,{marginBottom:1,children:[c(n,{dimColor:!0,children:"── "}),c(n,{bold:!0,color:"white",children:"NAVIGATION"})]}),d(h,{children:[c(h,{width:24,children:d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","↑","/k"]}),c(n,{dimColor:!0,children:" Move up"})]})}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","↓","/j"]}),c(n,{dimColor:!0,children:" Move down"})]})]}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","Tab"]}),c(n,{dimColor:!0,children:" Switch panel (split)"})]}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","Esc"]}),c(n,{dimColor:!0,children:" Back / close"})]}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","Enter"]}),c(n,{dimColor:!0,children:" Show output / fullscreen"})]})]}),d(h,{flexDirection:"column",marginBottom:1,children:[d(h,{marginBottom:1,children:[c(n,{dimColor:!0,children:"── "}),c(n,{bold:!0,color:"white",children:"VIEWS"})]}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","Enter"]}),d(n,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","Esc"]}),d(n,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),d(h,{flexDirection:"column",marginBottom:1,children:[d(h,{marginBottom:1,children:[c(n,{dimColor:!0,children:"── "}),c(n,{bold:!0,color:"white",children:"ACTIONS"})]}),d(h,{children:[c(h,{width:24,children:d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","/"]}),c(n,{dimColor:!0,children:" Filter by text"})]})}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","F"]}),c(n,{dimColor:!0,children:" Filter by status"})]})]}),d(h,{children:[c(h,{width:24,children:d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","1"]}),c(n,{dimColor:!0,children:"/"}),c(n,{bold:!0,color:"white",children:"2"}),c(n,{dimColor:!0,children:" Pin to output pane"})]})}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","0"]}),c(n,{dimColor:!0,children:" Clear pins"})]})]}),d(h,{children:[c(h,{width:24,children:d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","r"]}),c(n,{dimColor:!0,children:" Rerun all (done)"})]})}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","R"]}),c(n,{dimColor:!0,children:" Retry failed task"})]})]}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","i"]}),c(n,{dimColor:!0,children:" Interactive input (running task)"})]})]}),d(h,{flexDirection:"column",marginBottom:1,children:[d(h,{marginBottom:1,children:[c(n,{dimColor:!0,children:"── "}),c(n,{bold:!0,color:"white",children:"SCROLLING"}),c(n,{dimColor:!0,children:" (output panel)"})]}),d(h,{children:[c(h,{width:24,children:d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","↑","/k"]}),c(n,{dimColor:!0,children:" Scroll up"})]})}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","↓","/j"]}),c(n,{dimColor:!0,children:" Scroll down"})]})]}),d(h,{children:[c(h,{width:24,children:d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","^u"]}),c(n,{dimColor:!0,children:" Page up"})]})}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","^d"]}),c(n,{dimColor:!0,children:" Page down"})]})]}),d(h,{children:[c(h,{width:24,children:d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","Home"]}),c(n,{dimColor:!0,children:" Top"})]})}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","End"]}),c(n,{dimColor:!0,children:" Bottom"})]})]})]}),d(h,{flexDirection:"column",children:[d(h,{marginBottom:1,children:[c(n,{dimColor:!0,children:"── "}),c(n,{bold:!0,color:"white",children:"GENERAL"})]}),d(h,{children:[c(h,{width:24,children:d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","q"]}),c(n,{dimColor:!0,children:" Quit"})]})}),d(n,{children:[d(n,{bold:!0,color:"white",children:[" ","?"]}),c(n,{dimColor:!0,children:" Toggle help"})]})]})]})]}),U=c(_r,{autoExitSeconds:r>0?r:3,onCancel:T(()=>{j(!1)},"onCancel"),visible:y});if(i.viewMode==="fullscreen")return d(h,{flexDirection:"column",height:p,width:f,children:[c(h,{flexGrow:1,children:c(Ot,{duration:H?.duration??H?.elapsed,focused:!0,interactiveMode:i.interactiveMode,output:ie,scrollRef:R,status:H?.status,taskId:$})}),ce,U,D]});if(i.viewMode==="split"){const k=f>=Dt,m=c(_t,{compact:!0,filterActive:i.filterActive,filterText:i.filterText,focused:i.focusedPanel==="tasks",headerStatus:ae,parallelSlots:e,pinnedTaskIds:i.pinnedTaskIds,rows:x,scrollRef:A,selectedIndex:i.selectedIndex,title:q}),C=c(Ot,{duration:H?.duration??H?.elapsed,focused:i.focusedPanel==="output",interactiveMode:i.interactiveMode,output:ie,scrollRef:R,showFullscreenHint:!0,status:H?.status,taskId:$});if(k){const fe=Math.floor(f*.4);return d(h,{flexDirection:"column",height:p,width:f,children:[d(h,{flexDirection:"row",flexGrow:1,children:[c(h,{width:fe,children:m}),c(h,{flexGrow:1,children:C})]}),ce,U,D]})}const ee=Math.floor(p*.45);return d(h,{flexDirection:"column",height:p,width:f,children:[c(h,{height:ee,children:m}),c(h,{flexGrow:1,children:C}),ce,U,D]})}return d(h,{flexDirection:"column",height:p,width:f,children:[c(h,{flexGrow:1,children:c(_t,{filterActive:i.filterActive,filterText:i.filterText,focused:!0,headerStatus:ae,parallelSlots:e,pinnedTaskIds:i.pinnedTaskIds,rows:x,scrollRef:A,selectedIndex:i.selectedIndex,title:q})}),ce,U,D]})},"VisTaskRunnerApp");var ls=Object.defineProperty,$e=T((r,e)=>ls(r,"name",{value:e,configurable:!0}),"n$2");const ds=$e(r=>{const{args:e,autoExit:t=!1,outputStyle:s="normal",projectNames:o,stdinRegistry:a,tasks:l}=r,u=new Ae(l),f=typeof e.parallel=="number"?e.parallel:3,p=t===!0?3:typeof t=="number"?t:0;let i,S;const b=new Promise(F=>{S=F});let E;const A=$e(()=>{E&&(clearInterval(E),E=void 0)},"cleanup"),R=$e(()=>{if(a){for(const F of a.values())F.kill?.();a.clear()}},"killAllPtyProcesses"),y=$e(()=>{A(),Q(),R(),process.stdout.write("\x1B[?1049l\x1B[?25h"),i?.cleanup(),process.exit(1)},"onSignal"),j=$e(()=>{const F=u.getSnapshot(),w=ve(Date.now()-F.startTime),x=F.rows.filter($=>$.status==="failure").map($=>$.taskId),P=process.stdout.columns||80;process.stdout.write(`
|
|
8
|
+
`);for(const $ of F.rows){const{status:H,taskId:ie}=$,L=Oe(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:P});process.stdout.write(`${ae}
|
|
9
|
+
`)}process.stdout.write(`
|
|
10
|
+
`);const G=re(N.createElement(tr,{cached:F.cached,failed:F.failed,failedIds:x,projectNames:o,succeeded:F.succeeded,targets:e.targets,tasks:l,took:w}),{columns:P});if(process.stdout.write(`${G}
|
|
11
|
+
`),x.length>0&&s!=="quiet")for(const $ of x){const H=F.outputs.get($);if(H?.trim()){const ie=re(N.createElement(n,null,`
|
|
12
|
+
`,N.createElement(n,{bold:!0,color:"red"},` ${tt} vis run ${$}`)),{columns:P});process.stdout.write(`${ie}
|
|
13
|
+
|
|
14
|
+
`);const L=H.trim().split(`
|
|
15
|
+
`).map(q=>` ${q}`).join(`
|
|
16
|
+
`);process.stdout.write(`${L}
|
|
17
|
+
`)}}},"printExitSummary");let O;const Q=$e(()=>{O&&(clearInterval(O),O=void 0)},"clearKeepAlive");return{lifeCycle:{endCommand(){A(),u.markDone(),O||(O=setInterval(()=>{},1e3)),process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume())},endTasks(F){u.endTasks(F)},printTaskTerminalOutput(F,w,x){u.getSnapshot().outputs.has(F.id)||u.addOutput(F.id,x)},startCommand(){process.on("SIGINT",y),process.on("SIGTERM",y),O||(O=setInterval(()=>{},1e3)),process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume()),i=mo(N.createElement(cs,{autoExitSeconds:p,parallelSlots:f,projectNames:o,stdinRegistry:a??new Map,store:u,targets:e.targets,tasks:l}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}),i.waitUntilExit().then(()=>{Q(),R(),process.removeListener("SIGINT",y),process.removeListener("SIGTERM",y),j(),S()}).catch(()=>{Q(),R(),process.removeListener("SIGINT",y),process.removeListener("SIGTERM",y),S()})},startTasks(F){u.startTasks(F),E||(E=setInterval(()=>{u.tick()},100))}},renderIsDone:b,store:u}},"createDynamicOutputRenderer");var us=Object.defineProperty,at=T((r,e)=>us(r,"name",{value:e,configurable:!0}),"l$1");const hs=at(r=>r==="quiet"?"quiet":"normal","parseOutputStyle"),fs=at((r,e)=>{const t=r.overrides.visOptions;return t?.outputStyle==="normal"||t?.outputStyle==="quiet"?t.outputStyle:e},"resolveTaskOutputStyle");class ps{static{T(this,"StaticOutputLifeCycle")}static{at(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 ${it(this.#e,this.#r,this.#o)}`,s=re(N.createElement(Xe,{title:t,variant:"info"}),{columns:e});process.stdout.write(s);const o=this.#o[0],a=o?.overrides?Object.entries(o.overrides).filter(([l])=>l!=="command"):[];if(a.length>0){process.stdout.write(`
|
|
18
|
+
With additional flags:
|
|
19
|
+
`);for(const[l,u]of a)process.stdout.write(`${Uo(" ",l,u)}
|
|
20
|
+
`)}process.stdout.write(`
|
|
21
|
+
`)}startTasks(e){const t=process.stdout.columns||80;for(const s of e){const o=re(N.createElement(n,null,N.createElement(n,{dimColor:!0},">"),` ${s.id}`),{columns:t});process.stdout.write(`${o}
|
|
22
|
+
`)}}endTasks(e){const t=process.stdout.columns||80;for(const s of e){this.#n.set(s.task.id,s),s.status==="failure"?this.#s.push(s):Te(s.status)&&this.#t.push(s);const o=or(s.status),a=s.startTime&&s.endTime?` (${ve(s.endTime-s.startTime)})`:"",l=Te(s.status)?" [cache]":"",u=re(N.createElement(n,null,o,` ${s.task.id}`,l?N.createElement(n,{color:"cyan"},l):null,a?N.createElement(n,{dimColor:!0},a):null),{columns:t});process.stdout.write(`${u}
|
|
23
|
+
`)}}printTaskTerminalOutput(e,t,s){if(!(fs(e,this.#a)==="quiet"&&(t==="success"||Te(t)))){if(this.#i){this.#i.printTaskTerminalOutput(e,t,s);return}ts(e.id,t,s)}}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 s=process.stdout.columns||80,o=re(N.createElement(tr,{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:s});process.stdout.write(`${o}
|
|
25
|
+
`)}}var ms=Object.defineProperty,Y=T((r,e)=>ms(r,"name",{value:e,configurable:!0}),"r$1");function Re(r,e={},t){for(const s in r){const o=r[s],a=t?`${t}:${s}`:s;typeof o=="object"&&o!==null?Re(o,e,a):typeof o=="function"&&(e[a]=o)}return e}T(Re,"c$2");Y(Re,"flatHooks");function gs(...r){const e={};for(const t of r){const s=Re(t);for(const o in s)e[o]?e[o].push(s[o]):e[o]=[s[o]]}for(const t in e)if(e[t].length>1){const s=e[t];e[t]=(...o)=>cr(s,a=>a(...o))}else e[t]=e[t][0];return e}T(gs,"v$1");Y(gs,"mergeHooks");function cr(r,e){return r.reduce((t,s)=>t.then(()=>e(s)),Promise.resolve())}T(cr,"d");Y(cr,"serial");const lr=(()=>{if(console.createTask)return console.createTask;const r={run:Y(e=>e(),"run")};return()=>r})();function Ne(r,e,t,s){for(let o=t;o<r.length;o+=1)try{const a=s?s.run(()=>r[o](...e)):r[o](...e);if(a&&typeof a.then=="function")return Promise.resolve(a).then(()=>Ne(r,e,o+1,s))}catch(a){return Promise.reject(a)}}T(Ne,"k$1");Y(Ne,"callHooks");function dr(r,e,t){if(r.length>0)return Ne(r,e,0,lr(t))}T(dr,"y$1");Y(dr,"serialTaskCaller");function ur(r,e,t){if(r.length>0){const s=lr(t);return Promise.all(r.map(o=>s.run(()=>o(...e))))}}T(ur,"m");Y(ur,"parallelTaskCaller");function ws(r,e){return r.reduce((t,s)=>t.then(()=>s(...e||[])),Promise.resolve())}T(ws,"x");Y(ws,"serialCaller");function ks(r,e){return Promise.all(r.map(t=>t(...e||[])))}T(ks,"P");Y(ks,"parallelCaller");function _e(r,e){for(const t of[...r])t(e)}T(_e,"a$1");Y(_e,"callEachWith");var vs=class{static{T(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,s={}){if(!e||typeof t!="function")return()=>{};const o=e;let a;for(;this._deprecatedHooks[e];)a=this._deprecatedHooks[e],e=a.to;if(a&&!s.allowDeprecated){let l=a.message;l||(l=`${o} hook has been deprecated`+(a.to?`, please use ${a.to}`:"")),this._deprecatedMessages||(this._deprecatedMessages=new Set),this._deprecatedMessages.has(l)||(console.warn(l),this._deprecatedMessages.add(l))}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 s,o=Y((...a)=>(typeof s=="function"&&s(),s=void 0,o=void 0,t(...a)),"_function");return s=this.hook(e,o),s}removeHook(e,t){const s=this._hooks[e];if(s){const o=s.indexOf(t);o!==-1&&s.splice(o,1),s.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 s=this._hooks[e]||[];this._hooks[e]=void 0;for(const o of s)this.hook(e,o)}deprecateHooks(e){for(const t in e)this.deprecateHook(t,e[t])}addHooks(e){const t=Re(e),s=Object.keys(t).map(o=>this.hook(o,t[o]));return()=>{for(const o of s)o();s.length=0}}removeHooks(e){const t=Re(e);for(const s in t)this.removeHook(s,t[s])}removeAllHooks(){this._hooks={}}callHook(e,...t){return this.callHookWith(dr,e,t)}callHookParallel(e,...t){return this.callHookWith(ur,e,t)}callHookWith(e,t,s){const o=this._before||this._after?{name:t,args:s,context:{}}:void 0;this._before&&_e(this._before,o);const a=e(this._hooks[t]?[...this._hooks[t]]:[],s,t);return a instanceof Promise?a.finally(()=>{this._after&&o&&_e(this._after,o)}):(this._after&&o&&_e(this._after,o),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 hr(){return new vs}T(hr,"w$1");Y(hr,"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 s=t.indexOf(e);s!==-1&&t.splice(s,1),t.length===0&&(this._hooks[r]=void 0)}}callHook(r,...e){const t=this._hooks[r];if(!(!t||t.length===0))return Ne(t,e,0)}});const Ht=typeof window<"u";function ys(r,e={}){const t={inspect:Ht,group:Ht,filter:Y(()=>!0,"filter"),...e},s=t.filter,o=typeof s=="string"?i=>i.startsWith(s):s,a=t.tag?`[${t.tag}] `:"",l=Y(i=>a+i.name+"".padEnd(i._id,"\0"),"logPrefix"),u={},f=r.beforeEach(i=>{o!==void 0&&!o(i.name)||(u[i.name]=u[i.name]||0,i._id=u[i.name]++,console.time(l(i)))}),p=r.afterEach(i=>{o!==void 0&&!o(i.name)||(t.group&&console.groupCollapsed(i.name),t.inspect?console.timeLog(l(i),i.args):console.timeEnd(l(i)),t.group&&console.groupEnd(),u[i.name]--)});return{close:Y(()=>{f(),p()},"close")}}T(ys,"W");Y(ys,"createDebugger");var bs=Object.defineProperty,Ge=T((r,e)=>bs(r,"name",{value:e,configurable:!0}),"t");const $s=Ge(()=>hr(),"createVisHooks"),Ts=Ge(async(r,e)=>{if(!(!e||e.length===0))for(const t of e){if(t.hooks)for(const[s,o]of Object.entries(t.hooks)){const a=Array.isArray(o)?o:[o];for(const l of a)r.hook(s,l)}t.setup&&await t.setup(r)}},"registerPlugins");class Ss{static{T(this,"HookableLifeCycle")}static{Ge(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):Cs(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(s=>{if(this.#r)try{this.#r(e,s)}catch{}})}}const Cs=Ge(r=>r==="local-cache"||r==="local-cache-kept-existing"||r==="remote-cache","isCacheStatus");var xs=Object.defineProperty,qe=T((r,e)=>xs(r,"name",{value:e,configurable:!0}),"o$1");const Is=qe(async r=>{if(process.env.VIS_NO_SHELL_HISTORY||wo()==="win32")return;const e=process.env.SHELL;if(!e)return;const t=Vr(e);try{if(t==="zsh"){await Ms(r);return}if(t==="bash"){await Es(r);return}t==="fish"&&await Rs(r)}catch{}},"appendToShellHistory"),Ms=qe(async r=>{const e=process.env.HISTFILE??Ce(process.env.ZDOTDIR??ot(),".zsh_history"),t=`: ${Math.floor(Date.now()/1e3)}:0;${r}
|
|
26
|
+
`;await rt(e,t)},"writeZshHistory"),Es=qe(async r=>{const e=process.env.HISTFILE??Ce(ot(),".bash_history");await rt(e,`${r}
|
|
27
|
+
`)},"writeBashHistory"),Rs=qe(async r=>{const e=Ce(ot(),".local","share","fish","fish_history"),t=`- cmd: ${r.replaceAll("\\","\\\\").replaceAll(`
|
|
28
|
+
`,String.raw`\n`)}
|
|
29
|
+
when: ${Math.floor(Date.now()/1e3)}
|
|
30
|
+
`;await rt(e,t)},"writeFishHistory");var js=Object.defineProperty,Qe=T((r,e)=>js(r,"name",{value:e,configurable:!0}),"e");const Os=Qe(r=>{const{killGracePeriodMs:e=5e3,onTimeout:t,sendSignal:s,timeoutMs:o}=r;if(o<=0)return{cancel:Qe(()=>{},"cancel")};const a=Math.max(e,0);let l;const u=setTimeout(()=>{t?.(),s("SIGTERM"),a>0&&(l=setTimeout(()=>{s("SIGKILL")},a))},o);return{cancel:Qe(()=>{clearTimeout(u),l&&clearTimeout(l)},"cancel")}},"scheduleTimeoutKill");var Ps=Object.defineProperty,Se=T((r,e)=>Ps(r,"name",{value:e,configurable:!0}),"l");const Fs=[/node_modules(?:\/|$)/,/\.git(?:\/|$)/,/\.vis(?:\/|$)/,/\.task-runner(?:\/|$)/],Bt=Se((r,e)=>{const t=new Set,s=new Set;for(const[,l]of r){const u=l.task.hashDetails?.nodes;if(u)for(const f of Object.keys(u))t.add(f),s.add(zr(Yt(e,f)))}const o=[...s].sort(),a=[];for(const l of o)a.some(u=>l===u||l.startsWith(`${u}/`))||a.push(l);return{directories:a,files:t}},"collectTrackedWatchTargets"),_s=Se((r,e,t)=>{const s=new Set;for(const o of r){const a=Yt(e,o);for(const l of t)if(a===l||a.startsWith(`${l}/`)){const u=Yr(l,a);u.length>0&&s.add(u)}}return o=>{const a=o.replaceAll("\\","/");return s.has(a)}},"createTrackedFileFilter"),As=Se(r=>{const e=r.replaceAll("\\","/");return Fs.some(t=>t.test(e))},"shouldIgnore"),Nt=Se(r=>{const{debounceMs:e=150,filter:t,onChange:s,paths:o}=r,a=[];let l=new Set,u;const f=Se(()=>{u=void 0;const p=[...l];l=new Set,p.length!==0&&Promise.resolve(s(p)).catch(i=>{xt.error("[vis watch] onChange handler failed:",i)})},"flush");for(const p of o)try{const i=Ur(p,{recursive:!0},(S,b)=>{b&&(As(b)||t&&!t(b)||(l.add(b),u&&clearTimeout(u),u=setTimeout(f,e)))});a.push(i)}catch(i){xt.warn(`[vis watch] unable to watch ${p}: ${i.message}`)}return{close:Se(()=>{u&&clearTimeout(u);for(const p of a)try{p.close()}catch{}},"close")}},"startWatcher");var Ls=Object.defineProperty,Ds=T((r,e)=>Ls(r,"name",{value:e,configurable:!0}),"n");const Hs=Ds((r,e)=>{const t=e?.trim();if(!t)return{filter:void 0,tasks:[...r]};const s=t.toLowerCase();return{filter:t,tasks:r.filter(o=>o.target.project.toLowerCase().includes(s))}},"applyProjectFilter");var Bs=Object.defineProperty,me=T((r,e)=>Bs(r,"name",{value:e,configurable:!0}),"a");const Ns=[""," 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
|
+
`),Gs=me(r=>{r.write(`${Ns}
|
|
32
|
+
`)},"writeHelp"),qs=me(async(r,e)=>{e.write("filter projects (empty to cancel) > ");const t=r,s=t.isRaw===!0;if(s)try{t.setRawMode?.(!1)}catch{}return await new Promise(o=>{let a="";const l=me(u=>{a+=typeof u=="string"?u:u.toString("utf8");const f=a.indexOf(`
|
|
33
|
+
`);if(f===-1)return;const p=a.slice(0,f).replace(/\r$/,"").trim();if(r.off("data",l),s)try{t.setRawMode?.(!0)}catch{}o(p.length>0?p:void 0)},"onData");r.on("data",l)})},"defaultPromptFilter"),Ws=me(r=>{const{handlers:e}=r,t=r.input??process.stdin,s=r.output??process.stdout,o=r.promptFilter??qs;if(!t||t.isTTY===!1)return{close:me(()=>{},"close")};lo(t);const a=t.isRaw===!0;try{t.setRawMode?.(!0)}catch{return{close:me(()=>{},"close")}}typeof t.resume=="function"&&t.resume();let l=!1;const u=me(async i=>{if(i.ctrl===!0&&i.name==="c"){await e.onQuit();return}if(!l)switch(i.name){case"?":case"h":{await e.onHelp();break}case"a":{await e.onClearFilter();break}case"p":{l=!0;try{const S=await o(t,s);S===void 0?s.write(`filter cancelled.
|
|
34
|
+
`):await e.onFilter(S)}finally{l=!1}break}case"q":{await e.onQuit();break}case"r":{await e.onRerun();break}case"return":{await e.onRerun();break}}},"dispatch"),f=me((i,S)=>{u(S).catch(b=>{s.write(`[vis watch] keybind handler failed: ${b.message}
|
|
35
|
+
`)})},"onKeypress"),p=t;return p.on("keypress",f),{close:me(()=>{if(p.off("keypress",f),!a)try{t.setRawMode?.(!1)}catch{}const i=t;if(typeof i.pause=="function")try{i.pause()}catch{}},"close")}},"installKeybinds");var Us=Object.defineProperty,Ze=T((r,e)=>Us(r,"name",{value:e,configurable:!0}),"u");const Vs=Ze(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),zs=Ze(async r=>{const{initialTasks:e,probe:t,registeredEntries:s,taskGraph:o,visVersion:a}=r,l=new Map,u=new Map,f=new Map;for(const w of s)if(ro(w.pid)){if(w.visVersion!==a){u.set(w.id,w);continue}l.set(w.id,w)}if(t){const w=[...l.values()],x=await Promise.all(w.map(async P=>{try{return[P.id,await t(P)]}catch{return[P.id,!1]}}));for(const[P,G]of x)if(!G){const $=l.get(P);l.delete(P),$&&f.set(P,$)}}const p=new Set(e.map(w=>w.id)),i=new Set,S=[],b=[],E=new Set;for(const w of Object.values(o.dependencies))for(const x of w)E.add(x);for(const[w,x]of Object.entries(o.tasks)){if(!Vs(x)?.service)continue;if(l.has(w)){i.add(w),b.push(l.get(w));continue}if(p.has(w)||!E.has(w))continue;const P=u.get(w),G=f.get(w);let $;P?$=`Service ${w} is registered with vis ${P.visVersion}, but this invocation is vis ${a}. Restart with \`vis service restart ${w}\` to pick up the new version.`:G?$=`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.`:$=`Target depends on the service ${w}, which is not running. Run \`vis service start ${w}\` first, or invoke \`${w}\` directly.`,S.push({message:$,targetId:w})}if(i.size===0)return{diagnostics:S,initialTasks:e,satisfiedServices:b,serviceEnvByTaskId:new Map,taskGraph:o};const A=new Map,R=Ze(w=>{const x=new Set,P=[...o.dependencies[w]??[]],G=new Set;for(;P.length>0;){const $=P.pop();if(!G.has($)){G.add($),i.has($)&&x.add($);for(const H of o.dependencies[$]??[])G.has(H)||P.push(H)}}return[...x].sort()},"collectTransitiveServices");for(const w of Object.keys(o.dependencies)){if(i.has(w))continue;const x=R(w);if(x.length===0)continue;const P={};for(const G of x){const $=l.get(G);$&&Object.assign(P,$.env)}Object.keys(P).length>0&&A.set(w,P)}const y={};for(const[w,x]of Object.entries(o.tasks))i.has(w)||(y[w]=x);const j={};for(const[w,x]of Object.entries(o.dependencies))i.has(w)||(j[w]=x.filter(P=>!i.has(P)));const O=new Map;for(const w of Object.keys(y))O.set(w,0);for(const w of Object.values(j))for(const x of w)O.has(x)&&O.set(x,(O.get(x)??0)+1);const Q=[];for(const w of o.roots)!i.has(w)&&y[w]&&Q.push(w);for(const[w,x]of O)x===0&&!Q.includes(w)&&y[w]&&Q.push(w);const F=e.filter(w=>!i.has(w.id));return{diagnostics:S,initialTasks:F,satisfiedServices:b,serviceEnvByTaskId:A,taskGraph:{dependencies:j,roots:Q,tasks:y}}},"applyServiceRegistry");var Ys=Object.defineProperty,M=T((r,e)=>Ys(r,"name",{value:e,configurable:!0}),"o");const ct="VIS_AFFECTED_FILES",Ks=2e3,fr=M((r,e,t)=>t||!e?r:e.startsWith("/")?e:`${r}/${e}`,"resolveCwd"),Gt=M(async(r,e,t,s)=>{const o=r.map(a=>{const l=a.overrides.command;if(!l)return;const u=a.overrides.visOptions,f=fr(e,a.projectRoot,!!u?.runFromWorkspaceRoot),p=u?.envFile?Ut(f,u.envFile):{},i=t&&(u?.affectedFiles==="env"||u?.affectedFiles==="both")?{[ct]:t.join(`
|
|
36
|
+
`)}:{};return{command:l,cwd:f,env:{INIT_CWD:s,...p,...i},name:a.id}}).filter(a=>a!==void 0);o.length!==0&&await et(o,{killOthers:["failure"]})},"runPersistentTasks"),Je=256*1024;class Qs{static{T(this,"Ze")}static{M(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 pr=M(r=>{const e=r.overrides.visOptions;if(e&&typeof e=="object")return e},"getTaskOptions"),lt=M(r=>`'${r.replaceAll("'",String.raw`'\''`)}'`,"singleQuoteEscape"),Xs=M((r,e,t)=>{if(!e||e.length===0||t===!1||t===void 0)return r;if(t==="args"||t==="both"){const s=e.map(o=>lt(o)).join(" ");return`${r} ${s}`}return r},"buildAffectedFilesArgs"),mr="visForwardedArgs",Zs=M((r,e)=>{const t=e.overrides[mr];if(!Array.isArray(t)||t.length===0)return r;const s=t.map(o=>lt(o)).join(" ");return`${r} ${s}`},"appendForwardedArgs"),Js=M(async(r,e,t)=>{if(!e)return t();const s=r.get(e)??Promise.resolve();let o;const a=new Promise(u=>{o=u}),l=s.then(()=>a);r.set(e,l),await s;try{return await t()}finally{o(),r.get(e)===l&&r.delete(e)}},"withMutex"),en=M(r=>{let e=Math.max(0,Math.floor(r));return{claim(t){const s=Math.max(0,Math.min(t,e));return e-=s,s},get remaining(){return e}}},"createRetryBudget"),tn=M((r,e,t)=>{const s=`${e}\0${typeof t=="string"?t:String(t)}`,o=r.get(s);if(o)return o;const a=Ut(e,t);return r.set(s,a),a},"loadEnvFileCached"),qt=M(r=>{const e=new Map;return async(t,s)=>{const{affectedFiles:o,currentOs:a,initCwd:l,lifeCycle:u,mutexPool:f,onOutput:p,onOutputReplace:i,retryBudget:S,serviceEnvByTaskId:b,stdinRegistry:E,strictEnv:A,workspaceRoot:R}=r,y=pr(t),j=fr(R,s.cwd??t.projectRoot,y?.runFromWorkspaceRoot===!0),O=t.overrides.command;if(!O)return{code:0,terminalOutput:`No command configured for ${t.target.project}:${t.target.target}`};const Q=Zs(O,t),F=Xs(Q,o,y?.affectedFiles),w=Ar(y,a),x=w?`${w} -c ${lt(F)}`:F,P=y?.envFile?tn(e,j,y.envFile):void 0,G={};o&&o.length>0&&(y?.affectedFiles==="env"||y?.affectedFiles==="both")&&(G[ct]=o.join(`
|
|
38
|
+
`));const $=b?.get(t.id),H={INIT_CWD:l,...P,...$,...s.env,...G};if(y?.strictEnv??A??!1){const D=Fo({command:F,processEnv:process.env,taskEnv:H,taskId:t.id});if(D){const U=_o(D);return u?.onTaskStderr?.(t,U),{code:1,terminalOutput:U}}}const ie=y?.pty===!0,L=!!E,q=L||ie;q&&(t.cache=!1);const ae=q?void 0:new Qs(Je),J=q?new Wt(Je):void 0;let B;const he=M(D=>{if(D.kind==="started"&&(B=D.kill,D.write&&E&&E.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"?u?.onTaskStdout?.(t,D.text):u?.onTaskStderr?.(t,D.text),J)J.write(D.text),L&&i?.(t.id,J.toString());else{const U=`${D.text}
|
|
39
|
+
`;ae.append(U),p?.(t.id,U)}D.kind==="close"&&E&&E.delete(t.id)},"onEvent"),ce=M(async()=>{const D=y?.retryCount??0,U=y?.retryDelay,k=S?S.claim(D):D,m=typeof y?.timeout=="number"&&y.timeout>0?y.timeout:0,C=typeof y?.killGracePeriodMs=="number"&&y.killGracePeriodMs>=0?y.killGracePeriodMs:5e3;let ee=!1;const fe=Os({killGracePeriodMs:C,onTimeout:M(()=>{ee=!0},"onTimeout"),sendSignal:M(We=>{B?.(We)},"sendSignal"),timeoutMs:m});let xe;try{xe=await et([{command:x,cwd:j,env:H,name:t.id,...q?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:he,...k>0?{restart:{delay:U??"exponential",tries:k}}:{}})}finally{fe.cancel()}const ye=xe.closeEvents[0],Pe=J?J.toString():ae.toString();return ee?{code:124,terminalOutput:`${Pe}
|
|
40
|
+
[timeout] Task "${t.id}" exceeded ${m}ms budget.
|
|
41
|
+
`}:{code:ye?.exitCode??1,terminalOutput:Pe}},"runOnce");return f?Js(f,y?.mutex,ce):ce()}},"createConcurrentExecutor"),rn=M(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"),on=M(async(r,e)=>{const t=await Cr(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 s=(t.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${t.startTime} (${s}s)`),e.info(""),e.info(` Total: ${String(t.stats.total)}`),e.info(` Succeeded: ${String(t.stats.succeeded)}`),e.info(` Cached: ${String(t.stats.cached)}`),e.info(` Failed: ${String(t.stats.failed)}`),e.info(` Skipped: ${String(t.stats.skipped)}`),e.info(""),t.stats.failed>0){const a=t.tasks.filter(l=>l.exitCode!==void 0&&l.exitCode!==0);e.info("Failed tasks:");for(const l of a){const u=l.duration??0;e.info(` × ${l.taskId} (exit ${String(l.exitCode??-1)}, ${u}ms)`)}e.info("")}const o=[...t.tasks].filter(a=>typeof a.duration=="number").sort((a,l)=>(l.duration??0)-(a.duration??0)).slice(0,5);if(o.length>0){e.info("Slowest tasks:");for(const a of o)e.info(` ${a.taskId.padEnd(40)} ${String(a.duration??0).padStart(6)}ms [${a.cacheStatus}]`);e.info("")}},"renderLastRunSummary"),sn=M(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"),nn=M(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"),Sn=M(async({argument:r,logger:e,options:t,runtime:s,visConfig:o,workspaceRoot:a})=>{if(!a)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const l=a;if(t.lastDetails===!0){await on(l,e);return}const u=process.cwd(),f=await Lr(l),{config:p,packageJsons:i,projectOptions:S,workspace:b}=Dr(l,o,f),E=Hr(l,b,i);let A=r[0];if(!A){const g=jt(b);if(process.stdout.isTTY&&process.stdin.isTTY){const v=await Go(g);if(!v){e.info("No target selected.");return}A=v,await Is(`vis run ${v}`)}else{e.info("Available targets:"),e.info(""),e.info(No(g)),e.info(""),e.info("Usage: vis run <target>");return}}if(p.constraints&&!t.skipConstraints){const g=xr(E,p.constraints);if(g.length>0){for(const v of g)e.error(`[${v.rule}] ${v.message}`);throw new Error(`${g.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(t.affected){const g=[A];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 s.runCommand("affected",{argv:g});return}const R=await io(A,b,process.cwd(),l),y=Lo(S),j=Do(R.target,y);j!==R.target&&e.debug?.(`Resolved alias "${R.target}" → "${j}"`);let O=R.projects;const Q=r.slice(1).map(String);if(t.projects){const g=new Set(t.projects.split(",").map(v=>v.trim()));if(O=O.filter(v=>g.has(v)),O.length===0)throw new Error(`No matching projects found for: ${String(t.projects)}`)}if(t.query&&(O=ao(O,b,t.query),O.length===0)){e.info(`Query "${String(t.query)}" matched no projects.`);return}const F=Br(),w=process.env[ct],x=w?w.split(`
|
|
42
|
+
`).filter(Boolean):void 0,P=(typeof t.runnerTags=="string"?t.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,G=P?new Set(P.split(",").map(g=>g.trim()).filter(Boolean)):void 0,$=[],H=new Map;for(const g of O){const v=S.get(g)?.[j];if(!v)continue;const I=v.options;if(!I?.internal){if(!Nr(I,!!Ve)){e.debug?.(`Skipping ${g}:${j} — runInCI filter`);continue}if(!Gr(I,G)){e.debug?.(`Skipping ${g}:${j} — runner-tags filter`);continue}$.push(g),H.set(g,v)}}if($.length===0){const g=jt(b),v=Object.entries(b.projects).filter(([,I])=>I.targets?.[j]!==void 0).map(([I])=>I);if(e.error(`No projects have the "${j}" target.`),v.length>0){e.info(""),e.info(`Target "${j}" exists in these projects but was filtered out:`);for(const I of v.slice(0,5))e.info(` - ${I}`);v.length>5&&e.info(` …and ${v.length-5} more`)}else{const I=er(j,g,3);I.length>0&&(e.info(""),e.info(I.length===1?`Did you mean "${I[0]}"?`:`Did you mean one of: ${I.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=$.map(g=>{const v=b.projects[g],I=H.get(g),V={project:g,target:j},W=`${g}:${j}`,pe=ie?{...I.options,pty:I.options?.pty??!0}:I.options,oe=I.command?Ir(I.command,{affectedFiles:x,projectRoot:v?.root}):I.command;return{cache:I.cache,id:W,outputs:I.outputs??[],overrides:{command:oe,...Q.length>0?{[mr]:Q}:{},...pe?{visOptions:pe}:{}},parallelism:I.parallelism,projectRoot:v?.root,target:V}});const q=[],ae=[];for(const g of L)pr(g)?.persistent?(g.cache=!1,q.push(g)):ae.push(g);L=ae;const J=Mr(t.partition);if(J&&(L=Er.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=Rr(L,{projectGraph:E,targetDefaults:p.targetDefaults,workspace:b});for(const[g,v]of Object.entries(B.tasks)){if(v.overrides.visOptions!==void 0)continue;const I=v.target.project,V=v.target.target,W=S.get(I)?.[V];W?.options&&(v.overrides={...v.overrides,visOptions:W.options},B.tasks[g]=v)}if(typeof t.skipCache=="string"&&t.skipCache.trim()!=="")if(t.cache){const g=Eo(t.skipCache,b,Object.keys(B.tasks));for(const v of g.skipTaskIds){const I=B.tasks[v];I!==void 0&&(I.cache=!1)}g.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${g.unmatchedPatterns.map(v=>`"${v}"`).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 to(l,p.toolchain,{error:M(g=>{e.error(g)},"error"),info:M(g=>{e.info(g)},"info"),warn:M(g=>{e.warn(g)},"warn")},!!t.skipToolchain);const he=t.preflight!==!1&&p.preflight?.lockfile!==!1,ce=xo(l,Ve,{warn:M(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 oo(l),U=await zs({initialTasks:L,probe:t.dryRun?void 0:async g=>{try{return await so(g.config,{timeoutMs:Ks}),!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:k}=U;if(U.satisfiedServices.length>0){const g=U.satisfiedServices.map(v=>v.id).join(", ");e.debug?.(`Auto-attached to running services: ${g}`)}if(t.reverse&&(B=jr(B),e.debug?.(`Reversed task graph: ${String(B.roots.length)} new root(s) (originally leaves)`)),t.dryRun){const g=Object.keys(B.tasks).length,v=B.roots.length;e.info(`Execution plan (${String(g)} task(s), ${String(v)} root(s)):`),e.info("");const I=new Set,V=M((W,pe)=>{if(I.has(W))return;I.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(),C=$s(),ee=M((g,v)=>{const I=v instanceof Error?v.message:String(v);e.warn(`Plugin error in ${g}: ${I}`)},"onHookError");await Ts(C,p.plugins);const fe=typeof t.profile=="string"?t.profile:void 0,xe=M(async g=>{if(!fe)return;const v=Tt(g,B,m),I=fe.startsWith("/")?fe:`${l}/${fe}`;await Or(v,I),e.info(`Profile written to ${fe}`)},"maybeWriteProfile"),ye=p.taskRunnerOptions??{},Pe=qr(l,t.cacheDir,ye.cacheDirectory,p.sharedWorktreeCache),We=Wr(Pe,l,p.branchScopedCache),be=rn(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 gr=be&&"value"in be?be.value:void 0,wr=t.parallel??gr??3,dt=t.strictEnv??p.strictEnv??!1,Fe={dryRun:t.dryRun??!1,parallel:wr,skipNxCache:!t.cache,summarize:t.summarize??!1,...ye,cacheDirectory:We};if(ye.remoteCache){const g=sn(t.cacheMode),v=nn(t.cacheBackend);(g||v)&&(Fe.remoteCache={...ye.remoteCache,...g?{mode:g}:{},...v?{backend:v}:{}})}else(t.cacheMode||t.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts; ignoring.");const kr=process.stdout.isTTY&&!Ve,vr=p.tui?.autoExit??!1,ut={args:{parallel:Fe.parallel,targets:[j]},autoExit:vr,projectNames:$,tasks:L},ht=typeof t.retryBudget=="number"?t.retryBudget:void 0,ft=ht===void 0?void 0:en(ht),pt=new Ss(C,ee),mt=new Kr(l),gt=hs(typeof t.outputStyle=="string"?t.outputStyle.toLowerCase():void 0);if(await C.callHook("run:before",{tasks:L,workspaceRoot:l}),kr){const g=new Map,v=ds({...ut,outputStyle:gt,stdinRegistry:g}),{lifeCycle:I,store:V}=v,W=new St([I,pt,mt]),pe=qt({affectedFiles:x,currentOs:F,initCwd:u,lifeCycle:W,mutexPool:new Map,onOutput:M((_,z)=>{V.addOutput(_,z)},"onOutput"),onOutputReplace:M((_,z)=>{V.setOutput(_,z)},"onOutputReplace"),retryBudget:ft,serviceEnvByTaskId:k,stdinRegistry:g,strictEnv:dt,workspaceRoot:l});let oe="rerun",se=null,ke=new Map;for(;oe!=="quit";){if(oe==="rerun")ke=await Ct(L,Fe,{lifeCycle:W,projectGraph:E,taskExecutor:pe,taskGraph:B,workspaceRoot:l});else if(oe==="retry"&&se){const _=L.find(Z=>Z.id===se),z=_?.overrides.command;if(_&&z){const Z=_.projectRoot??l,ge=Z.startsWith("/")?Z:`${l}/${Z}`;W.startTasks?.([_]);const ne=new Wt(Je),le=(await et([{command:z,cwd:ge,name:_.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:M(K=>{K.kind==="started"&&K.write&&g.set(_.id,{kill:K.kill,resize:K.resize,write:K.write}),(K.kind==="stdout"||K.kind==="stderr")&&K.text&&(ne.write(K.text),V.setOutput(_.id,ne.toString())),K.kind==="close"&&g.delete(_.id)},"onEvent")})).closeEvents[0];W.endTasks?.([{code:le?.exitCode??1,status:le?.exitCode===0?"success":"failure",task:_,terminalOutput:V.getSnapshot().outputs.get(_.id)}])}else _&&W.endTasks?.([{code:1,status:"failure",task:_,terminalOutput:`No command configured for ${_.id}`}]);se=null,V.markDone()}oe=await new Promise(_=>{const z=V.subscribe(()=>{const Z=V.getSnapshot();Z.rerunRequested&&(V.acknowledgeRerun(),z(),_("rerun")),Z.retryTaskId&&(se=V.acknowledgeRetry(),z(),_("retry"))});v.renderIsDone.then(()=>{z(),_("quit")}).catch(()=>{z(),_("quit")})})}await v.renderIsDone,await C.callHook("run:after",ke),await xe(ke),q.length>0&&!t.failFast&&await Gt(q,l,x,u)}else{const g=new Map,v=typeof t.log=="string"?t.log.toLowerCase():"",I=v==="labeled"||v==="grouped"||v==="interleaved"?v:void 0,V=I?Pr(I):void 0,W=new St([new ps({...ut,logReporter:V,outputStyle:gt}),pt,mt]),pe=qt({affectedFiles:x,currentOs:F,initCwd:u,lifeCycle:W,mutexPool:g,retryBudget:ft,serviceEnvByTaskId:k,strictEnv:dt,workspaceRoot:l}),oe=M(async()=>{const _=Date.now(),z=await Ct(L,Fe,{lifeCycle:W,projectGraph:E,taskExecutor:pe,taskGraph:B,workspaceRoot:l}),Z=Date.now()-_;if(t.summarize){const de=Tt(z,B,m);await Fr(de,l)}let ge=!1;for(const[,de]of z)de.status==="failure"&&(ge=!0);const ne=Qr(z,Z),le=Xr(l),K=Zr(l,Z,le);return e.info(""),e.info(` ${ne}${K?` ${K}`:""}`),{hasFailure:ge,results:z,runHistory:le}},"runOnce"),se=await oe();await C.callHook("run:after",se.results),await xe(se.results);const{hasFailure:ke}=se;if(t.watch){const _=$.map(X=>{const te=b.projects[X]?.root;if(te)return te.startsWith("/")?te:`${l}/${te}`}).filter(X=>X!==void 0),z=L;let Z;const ge=M(X=>{const te=Hs(z,X);return Z=te.filter,L=te.tasks,te.tasks.length},"applyFilter");let ne=!1,le=se.results;const K=M(()=>{const X=Bt(le,l);if(X.directories.length>0&&X.files.size>0){const te=_s(X.files,l,X.directories);return{handle:Nt({filter:te,onChange:wt,paths:X.directories}),mode:"tracked"}}return{handle:Nt({onChange:wt,paths:_}),mode:"roots"}},"buildHandle");let de;const wt=M(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"),kt=K();de=kt.handle;const yr=kt.mode==="tracked"?`Watching ${String(Bt(le,l).files.size)} tracked file(s)`:`Watching ${String(_.length)} project root(s)`;e.info(`${yr} — edit a file to rerun, press h for keybinds, q to quit.`);const Ue=M(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,vt;const yt=M(()=>{bt()},"onSigint"),bt=M(()=>{te||(te=!0,vt?.close(),process.off("SIGINT",yt),de?.close(),X())},"exit");process.on("SIGINT",yt),vt=Ws({handlers:{onClearFilter:M(async()=>{const Ie=ge(void 0);e.info(`Filter cleared — running ${String(Ie)} task(s).`),await Ue()},"onClearFilter"),onFilter:M(async Ie=>{const br=Z,$t=ge(Ie);if($t===0){e.info(`Filter "${Ie}" matched no projects — keeping previous filter.`),ge(br);return}e.info(`Filter "${Ie}" matched ${String($t)} task(s).`),await Ue()},"onFilter"),onHelp:M(()=>{Gs(process.stdout)},"onHelp"),onQuit:M(()=>{bt()},"onQuit"),onRerun:Ue}})});return}if(ke){if(t.flaky!==!1){const _=Jr(l,{minRuns:2},se.runHistory);if(_.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const z of eo(_))e.info(` ${z}`);e.info("")}}throw new Error("Some tasks failed.")}q.length>0&&!t.failFast&&await Gt(q,l,x,u)}},"execute");export{en as createRetryBudget,Sn as default};
|
|
@@ -1,174 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const execute = async ({ argument, logger, options, visConfig, workspaceRoot: wsRoot }) => {
|
|
10
|
-
if (!wsRoot) {
|
|
11
|
-
throw new Error("Could not determine workspace root. Run this command inside a monorepo.");
|
|
12
|
-
}
|
|
13
|
-
const workspaceRoot = wsRoot;
|
|
14
|
-
if (options.securityConfig) {
|
|
15
|
-
const pm = detectPm(workspaceRoot);
|
|
16
|
-
printSecurityReport(visConfig ?? {}, pm.name);
|
|
17
|
-
if (options.sync && pm.name === "pnpm") {
|
|
18
|
-
const synced = previewPnpmSync(visConfig ?? {});
|
|
19
|
-
if (synced.length > 0) {
|
|
20
|
-
pail.info("\nSettings that would sync to pnpm-workspace.yaml:");
|
|
21
|
-
for (const s of synced) {
|
|
22
|
-
pail.success(` ${s}`);
|
|
23
|
-
}
|
|
24
|
-
} else {
|
|
25
|
-
pail.info("No security settings to sync.");
|
|
26
|
-
}
|
|
27
|
-
} else if (options.sync && pm.name !== "pnpm") {
|
|
28
|
-
pail.info(`--sync is only available for pnpm projects. Your project uses ${pm.name}.`);
|
|
29
|
-
pail.info("vis enforces security settings at the vis layer for non-pnpm projects.");
|
|
30
|
-
}
|
|
31
|
-
if (!options.security && !argument?.length) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const { packageManager } = findPackageManagerSync(workspaceRoot);
|
|
36
|
-
const npmrcConfig = loadNpmrc(workspaceRoot);
|
|
37
|
-
const configDefaults = visConfig?.update ?? {};
|
|
38
|
-
const catalogs = readCatalogs(workspaceRoot, packageManager, {
|
|
39
|
-
dev: options.dev,
|
|
40
|
-
prod: options.prod
|
|
41
|
-
});
|
|
42
|
-
if (catalogs.size === 0) {
|
|
43
|
-
logger.info("No catalogs found.");
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const target = options.target ?? configDefaults.target ?? "latest";
|
|
47
|
-
if (!["latest", "minor", "patch"].includes(target)) {
|
|
48
|
-
throw new Error(`Invalid target "${target}". Use: latest, minor, or patch.`);
|
|
49
|
-
}
|
|
50
|
-
const checkOptions = {
|
|
51
|
-
exclude: [...toFilterArray(options.exclude), ...toFilterArray(configDefaults.exclude)],
|
|
52
|
-
ignore: toFilterArray(configDefaults.ignore),
|
|
53
|
-
include: [...toFilterArray(options.include), ...toFilterArray(configDefaults.include), ...argument],
|
|
54
|
-
includeLocked: Boolean(options.includeLocked),
|
|
55
|
-
includePrerelease: options.prerelease || configDefaults.prerelease || false,
|
|
56
|
-
security: !options.noSecurity,
|
|
57
|
-
target
|
|
58
|
-
};
|
|
59
|
-
let totalDeps = 0;
|
|
60
|
-
for (const deps of catalogs.values()) {
|
|
61
|
-
totalDeps += deps.size;
|
|
62
|
-
}
|
|
63
|
-
const isTTY = Boolean(process.stdout.isTTY) && !isInCi;
|
|
64
|
-
let progressInstance;
|
|
65
|
-
const onProgress = isTTY ? (current, total) => {
|
|
66
|
-
if (progressInstance) {
|
|
67
|
-
progressInstance.rerender(React.createElement(CheckProgressApp, { current, total }));
|
|
68
|
-
} else {
|
|
69
|
-
progressInstance = render(React.createElement(CheckProgressApp, { current, total }), {
|
|
70
|
-
interactive: true,
|
|
71
|
-
patchConsole: false
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
} : (current, total) => {
|
|
75
|
-
logger.info(`Checking ${String(current)}/${String(total)} dependencies...`);
|
|
76
|
-
};
|
|
77
|
-
if (!isTTY) {
|
|
78
|
-
logger.info(`Checking ${String(totalDeps)} catalog dependencies against npm registry...
|
|
79
|
-
`);
|
|
80
|
-
}
|
|
81
|
-
const socketOptions = buildSocketOptions(visConfig?.security?.socket);
|
|
82
|
-
const { failed, outdated } = await checkOutdated(
|
|
83
|
-
catalogs,
|
|
84
|
-
checkOptions,
|
|
85
|
-
npmrcConfig,
|
|
86
|
-
onProgress,
|
|
87
|
-
workspaceRoot,
|
|
88
|
-
socketOptions,
|
|
89
|
-
visConfig?.security?.socket?.acceptedRisks
|
|
90
|
-
);
|
|
91
|
-
if (progressInstance) {
|
|
92
|
-
progressInstance.clear();
|
|
93
|
-
progressInstance.unmount();
|
|
94
|
-
}
|
|
95
|
-
if (failed.length > 0) {
|
|
96
|
-
logger.warn(`Failed to fetch: ${failed.join(", ")}`);
|
|
97
|
-
}
|
|
98
|
-
if (outdated.length === 0) {
|
|
99
|
-
logger.info("All catalog dependencies are up to date.");
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const format = options.format ?? configDefaults.format ?? "table";
|
|
103
|
-
const analysisType = validateAnalysisType(options.aiType ?? "impact");
|
|
104
|
-
const aiResult = options.ai ? await runAiAnalysis(outdated, logger, visConfig?.ai, analysisType) : void 0;
|
|
105
|
-
if (isTTY && format === "table") {
|
|
106
|
-
const store = new UpdateStore(outdated, aiResult ?? null);
|
|
107
|
-
const autoExitConfig = visConfig?.tui?.autoExit ?? false;
|
|
108
|
-
const autoExitSeconds = autoExitConfig === true ? 3 : typeof autoExitConfig === "number" ? autoExitConfig : 0;
|
|
109
|
-
const instance = render(
|
|
110
|
-
React.createElement(VisUpdateApp, {
|
|
111
|
-
autoExitSeconds,
|
|
112
|
-
isDryRun: true,
|
|
113
|
-
store
|
|
114
|
-
}),
|
|
115
|
-
{
|
|
116
|
-
alternateScreen: true,
|
|
117
|
-
exitOnCtrlC: false,
|
|
118
|
-
interactive: true,
|
|
119
|
-
patchConsole: true
|
|
120
|
-
}
|
|
121
|
-
);
|
|
122
|
-
await instance.waitUntilExit();
|
|
123
|
-
const columns = process.stdout.columns || 80;
|
|
124
|
-
process.stdout.write("\n");
|
|
125
|
-
for (const entry of outdated) {
|
|
126
|
-
const hasSecurityIssue = entry.vulnerabilities?.length || entry.socketReport && entry.socketReport.alerts.length > 0;
|
|
127
|
-
const isAck = Boolean(entry.acceptedRisk);
|
|
128
|
-
const icon = hasSecurityIssue ? isAck ? "✓" : "⚠" : "✓";
|
|
129
|
-
const iconColor = isAck ? "gray" : entry.updateType === "major" ? "red" : entry.updateType === "minor" ? "yellow" : "green";
|
|
130
|
-
const socketOverall = entry.socketReport?.score.overall;
|
|
131
|
-
const scoreSuffix = socketOverall === void 0 ? "" : ` [${String(Math.round(socketOverall * 100))}%]`;
|
|
132
|
-
const socketColorName = socketOverall === void 0 ? void 0 : scoreColor(socketOverall);
|
|
133
|
-
process.stdout.write(
|
|
134
|
-
`${renderToString(
|
|
135
|
-
React.createElement(
|
|
136
|
-
Text,
|
|
137
|
-
null,
|
|
138
|
-
" ",
|
|
139
|
-
React.createElement(Text, { color: iconColor }, icon),
|
|
140
|
-
` ${entry.packageName} ${entry.currentRange} → ${entry.newRange}`,
|
|
141
|
-
React.createElement(Text, { dimColor: true }, ` ${entry.updateType}`),
|
|
142
|
-
socketColorName ? React.createElement(Text, { color: socketColorName }, scoreSuffix) : null
|
|
143
|
-
),
|
|
144
|
-
{ columns }
|
|
145
|
-
)}
|
|
146
|
-
`
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
process.stdout.write("\n");
|
|
150
|
-
logger.info(formatSummary(outdated));
|
|
151
|
-
} else if (format === "json") {
|
|
152
|
-
const output = { failed, outdated };
|
|
153
|
-
if (aiResult) {
|
|
154
|
-
output.aiAnalysis = aiResult;
|
|
155
|
-
}
|
|
156
|
-
process.stdout.write(`${JSON.stringify(output, void 0, 2)}
|
|
157
|
-
`);
|
|
158
|
-
} else if (format === "minimal") {
|
|
159
|
-
process.stdout.write(`${formatOutdatedMinimal(outdated)}
|
|
160
|
-
`);
|
|
161
|
-
} else {
|
|
162
|
-
formatOutdatedTable(outdated, logger);
|
|
163
|
-
logger.info(formatSummary(outdated));
|
|
164
|
-
if (aiResult) {
|
|
165
|
-
logger.info("");
|
|
166
|
-
logger.info(formatAiAnalysis(aiResult));
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
if (options.exitCode && outdated.length > 0) {
|
|
170
|
-
process.exitCode = 1;
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
export { execute as default };
|
|
1
|
+
var I=Object.defineProperty;var T=(c,r)=>I(c,"name",{value:r,configurable:!0});import{findPackageManagerSync as H}from"@visulima/package";import{render as j,renderToString as J,Text as y}from"@visulima/tui";import{A as V,O as W,W as Z,p as f,u as q,g as G,M as m,V as K,S as Q,B as X,c as b,v as _,j as ee,s as te}from"./bin.js";import a from"react";import{H as re,e as oe,Z as ne}from"../packem_shared/ai-analysis-hm8d2W7z.js";import{U as se,B as ie,T as M}from"../packem_shared/vis-update-app-D1jl0UZZ.js";var ae=Object.defineProperty,ce=T((c,r)=>ae(c,"name",{value:r,configurable:!0}),"$");const ye=ce(async({argument:c,logger:r,options:e,visConfig:i,workspaceRoot:C})=>{if(!C)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const d=C;if(e.securityConfig){const t=V(d);if(W(i??{},t.name),e.sync&&t.name==="pnpm"){const o=Z(i??{});if(o.length>0){f.info(`
|
|
2
|
+
Settings that would sync to pnpm-workspace.yaml:`);for(const x of o)f.success(` ${x}`)}else f.info("No security settings to sync.")}else e.sync&&t.name!=="pnpm"&&(f.info(`--sync is only available for pnpm projects. Your project uses ${t.name}.`),f.info("vis enforces security settings at the vis layer for non-pnpm projects."));if(!e.security&&!c?.length)return}const{packageManager:N}=H(d),U=q(d),l=i?.update??{},v=G(d,N,{dev:e.dev,prod:e.prod});if(v.size===0){r.info("No catalogs found.");return}const w=e.target??l.target??"latest";if(!["latest","minor","patch"].includes(w))throw new Error(`Invalid target "${w}". Use: latest, minor, or patch.`);const A={exclude:[...m(e.exclude),...m(l.exclude)],ignore:m(l.ignore),include:[...m(e.include),...m(l.include),...c],includeLocked:!!e.includeLocked,includePrerelease:e.prerelease||l.prerelease||!1,security:!e.noSecurity,target:w};let E=0;for(const t of v.values())E+=t.size;const h=!!process.stdout.isTTY&&!te;let u;const B=h?(t,o)=>{u?u.rerender(a.createElement(M,{current:t,total:o})):u=j(a.createElement(M,{current:t,total:o}),{interactive:!0,patchConsole:!1})}:(t,o)=>{r.info(`Checking ${String(t)}/${String(o)} dependencies...`)};h||r.info(`Checking ${String(E)} catalog dependencies against npm registry...
|
|
3
|
+
`);const O=K(i?.security?.socket),{failed:$,outdated:s}=await Q(v,A,U,B,d,O,i?.security?.socket?.acceptedRisks);if(u&&(u.clear(),u.unmount()),$.length>0&&r.warn(`Failed to fetch: ${$.join(", ")}`),s.length===0){r.info("All catalog dependencies are up to date.");return}const k=e.format??l.format??"table",P=re(e.aiType??"impact"),p=e.ai?await oe(s,r,i?.ai,P):void 0;if(h&&k==="table"){const t=new se(s,p??null),o=i?.tui?.autoExit??!1,x=o===!0?3:typeof o=="number"?o:0;await j(a.createElement(ie,{autoExitSeconds:x,isDryRun:!0,store:t}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit();const z=process.stdout.columns||80;process.stdout.write(`
|
|
4
|
+
`);for(const n of s){const L=n.vulnerabilities?.length||n.socketReport&&n.socketReport.alerts.length>0,S=!!n.acceptedRisk,Y=L?S?"✓":"⚠":"✓",D=S?"gray":n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",g=n.socketReport?.score.overall,F=g===void 0?"":` [${String(Math.round(g*100))}%]`,R=g===void 0?void 0:X(g);process.stdout.write(`${J(a.createElement(y,null," ",a.createElement(y,{color:D},Y),` ${n.packageName} ${n.currentRange} → ${n.newRange}`,a.createElement(y,{dimColor:!0},` ${n.updateType}`),R?a.createElement(y,{color:R},F):null),{columns:z})}
|
|
5
|
+
`)}process.stdout.write(`
|
|
6
|
+
`),r.info(b(s))}else if(k==="json"){const t={failed:$,outdated:s};p&&(t.aiAnalysis=p),process.stdout.write(`${JSON.stringify(t,void 0,2)}
|
|
7
|
+
`)}else k==="minimal"?process.stdout.write(`${_(s)}
|
|
8
|
+
`):(ee(s,r),r.info(b(s)),p&&(r.info(""),r.info(ne(p))));e.exitCode&&s.length>0&&(process.exitCode=1)},"execute");export{ye as default};
|
|
@@ -1,95 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const detectCiRefs = () => {
|
|
4
|
-
if (process.env["GITHUB_BASE_REF"]) {
|
|
5
|
-
return {
|
|
6
|
-
base: `origin/${process.env["GITHUB_BASE_REF"]}`,
|
|
7
|
-
head: process.env["GITHUB_SHA"] ?? "HEAD"
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
if (process.env["CI_MERGE_REQUEST_TARGET_BRANCH_NAME"]) {
|
|
11
|
-
return {
|
|
12
|
-
base: `origin/${process.env["CI_MERGE_REQUEST_TARGET_BRANCH_NAME"]}`,
|
|
13
|
-
head: process.env["CI_COMMIT_SHA"] ?? "HEAD"
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
if (process.env["BUILDKITE_PULL_REQUEST_BASE_BRANCH"]) {
|
|
17
|
-
return {
|
|
18
|
-
base: `origin/${process.env["BUILDKITE_PULL_REQUEST_BASE_BRANCH"]}`,
|
|
19
|
-
head: process.env["BUILDKITE_COMMIT"] ?? "HEAD"
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
if (process.env["CIRCLE_BRANCH"] && process.env["CIRCLE_SHA1"]) {
|
|
23
|
-
return {
|
|
24
|
-
base: "origin/main",
|
|
25
|
-
head: process.env["CIRCLE_SHA1"]
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
return { base: "origin/main", head: "HEAD" };
|
|
29
|
-
};
|
|
30
|
-
const execute = async ({ argument, logger, options, runtime, visConfig, workspaceRoot: wsRoot }) => {
|
|
31
|
-
const rawTargets = argument[0];
|
|
32
|
-
if (!rawTargets) {
|
|
33
|
-
throw new Error("Missing targets. Usage: vis ci <target>[,<target>…]");
|
|
34
|
-
}
|
|
35
|
-
const targets = rawTargets.split(",").map((t) => t.trim()).filter(Boolean);
|
|
36
|
-
if (targets.length === 0) {
|
|
37
|
-
throw new Error("Missing targets. Usage: vis ci <target>[,<target>…]");
|
|
38
|
-
}
|
|
39
|
-
if (!wsRoot) {
|
|
40
|
-
throw new Error("Could not determine workspace root. Run this command inside a monorepo.");
|
|
41
|
-
}
|
|
42
|
-
const { base: defaultBase, head: defaultHead } = detectCiRefs();
|
|
43
|
-
const base = options.base ?? defaultBase;
|
|
44
|
-
const head = options.head ?? defaultHead;
|
|
45
|
-
if (!options.skipToolchain) {
|
|
46
|
-
logger.info("▸ Toolchain pre-flight");
|
|
47
|
-
}
|
|
48
|
-
await runToolchainPreflight(
|
|
49
|
-
wsRoot,
|
|
50
|
-
visConfig?.toolchain,
|
|
51
|
-
{
|
|
52
|
-
error: (message) => {
|
|
53
|
-
logger.error(message);
|
|
54
|
-
},
|
|
55
|
-
info: (message) => {
|
|
56
|
-
logger.info(message);
|
|
57
|
-
},
|
|
58
|
-
warn: (message) => {
|
|
59
|
-
logger.warn(message);
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
Boolean(options.skipToolchain)
|
|
63
|
-
);
|
|
64
|
-
if (options.install === false) {
|
|
65
|
-
logger.info("▸ Skipping install (--no-install)");
|
|
66
|
-
} else {
|
|
67
|
-
logger.info("▸ Installing dependencies");
|
|
68
|
-
await runtime.runCommand("install", {
|
|
69
|
-
argv: ["--frozen-lockfile"]
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
for (const target of targets) {
|
|
73
|
-
logger.info(`▸ Running affected ${target} (base=${base}, head=${head})`);
|
|
74
|
-
const argv = [
|
|
75
|
-
target,
|
|
76
|
-
`--base=${base}`,
|
|
77
|
-
`--head=${head}`,
|
|
78
|
-
`--upstream=${String(options.upstream ?? "none")}`,
|
|
79
|
-
`--downstream=${String(options.downstream ?? "deep")}`
|
|
80
|
-
];
|
|
81
|
-
if (options.parallel !== void 0) {
|
|
82
|
-
argv.push(`--parallel=${String(options.parallel)}`);
|
|
83
|
-
}
|
|
84
|
-
if (options.partition) {
|
|
85
|
-
argv.push(`--partition=${String(options.partition)}`);
|
|
86
|
-
}
|
|
87
|
-
if (options.query) {
|
|
88
|
-
argv.push(`--query=${String(options.query)}`);
|
|
89
|
-
}
|
|
90
|
-
await runtime.runCommand("affected", { argv });
|
|
91
|
-
}
|
|
92
|
-
logger.info("▸ CI pipeline complete");
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
export { execute as default };
|
|
1
|
+
var h=Object.defineProperty;var g=(r,n)=>h(r,"name",{value:n,configurable:!0});import{r as m}from"../packem_shared/toolchain-BgBOUHII.js";var C=Object.defineProperty,a=g((r,n)=>C(r,"name",{value:n,configurable:!0}),"a");const u=a(()=>process.env.GITHUB_BASE_REF?{base:`origin/${process.env.GITHUB_BASE_REF}`,head:process.env.GITHUB_SHA??"HEAD"}:process.env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME?{base:`origin/${process.env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME}`,head:process.env.CI_COMMIT_SHA??"HEAD"}:process.env.BUILDKITE_PULL_REQUEST_BASE_BRANCH?{base:`origin/${process.env.BUILDKITE_PULL_REQUEST_BASE_BRANCH}`,head:process.env.BUILDKITE_COMMIT??"HEAD"}:process.env.CIRCLE_BRANCH&&process.env.CIRCLE_SHA1?{base:"origin/main",head:process.env.CIRCLE_SHA1}:{base:"origin/main",head:"HEAD"},"detectCiRefs"),A=a(async({argument:r,logger:n,options:e,runtime:s,visConfig:f,workspaceRoot:t})=>{const p=r[0];if(!p)throw new Error("Missing targets. Usage: vis ci <target>[,<target>…]");const l=p.split(",").map(o=>o.trim()).filter(Boolean);if(l.length===0)throw new Error("Missing targets. Usage: vis ci <target>[,<target>…]");if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const{base:_,head:d}=u(),c=e.base??_,E=e.head??d;e.skipToolchain||n.info("▸ Toolchain pre-flight"),await m(t,f?.toolchain,{error:a(o=>{n.error(o)},"error"),info:a(o=>{n.info(o)},"info"),warn:a(o=>{n.warn(o)},"warn")},!!e.skipToolchain),e.install===!1?n.info("▸ Skipping install (--no-install)"):(n.info("▸ Installing dependencies"),await s.runCommand("install",{argv:["--frozen-lockfile"]}));for(const o of l){n.info(`▸ Running affected ${o} (base=${c}, head=${E})`);const i=[o,`--base=${c}`,`--head=${E}`,`--upstream=${String(e.upstream??"none")}`,`--downstream=${String(e.downstream??"deep")}`];e.parallel!==void 0&&i.push(`--parallel=${String(e.parallel)}`),e.partition&&i.push(`--partition=${String(e.partition)}`),e.query&&i.push(`--query=${String(e.query)}`),await s.runCommand("affected",{argv:i})}n.info("▸ CI pipeline complete")},"execute");export{A as default};
|
|
@@ -1,115 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
4
|
-
|
|
5
|
-
const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
|
|
6
|
-
|
|
7
|
-
const __cjs_getBuiltinModule = (module) => {
|
|
8
|
-
// Check if we're in Node.js and version supports getBuiltinModule
|
|
9
|
-
if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
|
|
10
|
-
const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
|
|
11
|
-
// Node.js 20.16.0+ and 22.3.0+
|
|
12
|
-
if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
|
|
13
|
-
return __cjs_getProcess.getBuiltinModule(module);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
// Fallback to createRequire
|
|
17
|
-
return __cjs_require(module);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
readdirSync,
|
|
22
|
-
lstatSync
|
|
23
|
-
} = __cjs_getBuiltinModule("node:fs");
|
|
24
|
-
import { isAccessibleSync } from '@visulima/fs';
|
|
25
|
-
import { join } from '@visulima/path';
|
|
26
|
-
import { cleanWorkspace } from '#native';
|
|
27
|
-
import { p as pail } from './bin.js';
|
|
28
|
-
|
|
29
|
-
const findNodeModulesDirectories = (root) => {
|
|
30
|
-
const results = [];
|
|
31
|
-
const stack = [root];
|
|
32
|
-
while (stack.length > 0) {
|
|
33
|
-
const dir = stack.pop();
|
|
34
|
-
let entries;
|
|
35
|
-
try {
|
|
36
|
-
entries = readdirSync(dir);
|
|
37
|
-
} catch {
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
for (const entry of entries) {
|
|
41
|
-
const fullPath = join(dir, entry);
|
|
42
|
-
try {
|
|
43
|
-
const stat = lstatSync(fullPath);
|
|
44
|
-
if (stat.isSymbolicLink() || !stat.isDirectory()) {
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
} catch {
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (entry === "node_modules") {
|
|
51
|
-
results.push(fullPath);
|
|
52
|
-
} else if (entry !== ".git" && entry !== ".hg") {
|
|
53
|
-
stack.push(fullPath);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return results;
|
|
58
|
-
};
|
|
59
|
-
const LOCKFILE_NAMES = ["pnpm-lock.yaml", "package-lock.json", "npm-shrinkwrap.json", "yarn.lock", "bun.lock", "bun.lockb"];
|
|
60
|
-
const removeLockfiles = (cwd, dryRun, logger) => {
|
|
61
|
-
let removed = 0;
|
|
62
|
-
let hadError = false;
|
|
63
|
-
for (const name of LOCKFILE_NAMES) {
|
|
64
|
-
const lockfile = join(cwd, name);
|
|
65
|
-
if (!isAccessibleSync(lockfile)) {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
{
|
|
69
|
-
logger.info(` ${lockfile}`);
|
|
70
|
-
removed++;
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return { hadError, removed };
|
|
75
|
-
};
|
|
76
|
-
const execute = async ({ logger, options, workspaceRoot: wsRoot }) => {
|
|
77
|
-
const cwd = wsRoot ?? process.cwd();
|
|
78
|
-
const shouldRemoveLockfile = options.lockfile || false;
|
|
79
|
-
const dryRun = options.dryRun || false;
|
|
80
|
-
if (dryRun) {
|
|
81
|
-
const directories = findNodeModulesDirectories(cwd);
|
|
82
|
-
if (directories.length > 0) {
|
|
83
|
-
pail.info("Would remove:");
|
|
84
|
-
for (const dir of directories) {
|
|
85
|
-
logger.info(` ${dir}`);
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
pail.info("No node_modules directories found.");
|
|
89
|
-
}
|
|
90
|
-
if (shouldRemoveLockfile) {
|
|
91
|
-
removeLockfiles(cwd, true, logger);
|
|
92
|
-
}
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const result = cleanWorkspace(cwd, shouldRemoveLockfile);
|
|
96
|
-
for (const dir of result.removed) {
|
|
97
|
-
pail.success(`Removed ${dir}`);
|
|
98
|
-
}
|
|
99
|
-
for (const file of result.lockfilesRemoved) {
|
|
100
|
-
pail.success(`Removed ${file}`);
|
|
101
|
-
}
|
|
102
|
-
for (const error of result.errors) {
|
|
103
|
-
pail.error(error);
|
|
104
|
-
}
|
|
105
|
-
if (result.removed.length === 0 && result.lockfilesRemoved.length === 0) {
|
|
106
|
-
pail.info("No node_modules directories found.");
|
|
107
|
-
} else {
|
|
108
|
-
pail.info(`Cleaned ${result.removed.length} node_modules director${result.removed.length === 1 ? "y" : "ies"}`);
|
|
109
|
-
}
|
|
110
|
-
if (result.errors.length > 0) {
|
|
111
|
-
process.exitCode = 1;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export { execute as default };
|
|
1
|
+
var a=Object.defineProperty;var d=(s,o)=>a(s,"name",{value:o,configurable:!0});import{createRequire as p}from"node:module";import{isAccessibleSync as k}from"@visulima/fs";import{join as m}from"@visulima/path";import{cleanWorkspace as b}from"#native";import{p as c}from"./bin.js";import{f as R}from"../packem_shared/utils-DrNg0XTR.js";const g=p(import.meta.url),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=d(s=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[o,n]=f.versions.node.split(".").map(Number);if(o>22||o===22&&n>=3||o===20&&n>=16)return f.getBuiltinModule(s)}return g(s)},"__cjs_getBuiltinModule"),{readdirSync:v,lstatSync:y,unlinkSync:_}=h("node:fs");var $=Object.defineProperty,u=d((s,o)=>$(s,"name",{value:o,configurable:!0}),"f");const j=u(s=>{const o=[],n=[s];for(;n.length>0;){const t=n.pop();let i;try{i=v(t)}catch{continue}for(const r of i){const e=m(t,r);try{const l=y(e);if(l.isSymbolicLink()||!l.isDirectory())continue}catch{continue}r==="node_modules"?o.push(e):r!==".git"&&r!==".hg"&&n.push(e)}}return o},"findNodeModulesDirectories"),S=["pnpm-lock.yaml","package-lock.json","npm-shrinkwrap.json","yarn.lock","bun.lock","bun.lockb"],x=u((s,o,n)=>{let t=0,i=!1;for(const r of S){const e=m(s,r);if(k(e)){if(o){n.info(` ${e}`),t++;continue}try{_(e),c.success(`Removed ${e}`),t++}catch(l){c.error(`${e}: ${R(l)}`),i=!0}}}return{hadError:i,removed:t}},"removeLockfiles"),D=u(async({logger:s,options:o,workspaceRoot:n})=>{const t=n??process.cwd(),i=o.lockfile||!1;if(o.dryRun){const e=j(t);if(e.length>0){c.info("Would remove:");for(const l of e)s.info(` ${l}`)}else c.info("No node_modules directories found.");i&&x(t,!0,s);return}const r=b(t,i);for(const e of r.removed)c.success(`Removed ${e}`);for(const e of r.lockfilesRemoved)c.success(`Removed ${e}`);for(const e of r.errors)c.error(e);r.removed.length===0&&r.lockfilesRemoved.length===0?c.info("No node_modules directories found."):c.info(`Cleaned ${r.removed.length} node_modules director${r.removed.length===1?"y":"ies"}`),r.errors.length>0&&(process.exitCode=1)},"execute");export{D as default};
|