@visulima/vis 6.0.1 → 6.1.1

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.
Files changed (185) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/binx.js +1 -1
  4. package/dist/config/index.d.ts +1226 -1216
  5. package/dist/packem_chunks/bloom-sync.js +1 -1
  6. package/dist/packem_chunks/cargo-lock.js +5 -0
  7. package/dist/packem_chunks/cargo-plan.js +3 -3
  8. package/dist/packem_chunks/catalog-detector.js +1 -1
  9. package/dist/packem_chunks/catalog.js +1 -94
  10. package/dist/packem_chunks/catalog2.js +11 -0
  11. package/dist/packem_chunks/cli-exec.js +1 -1
  12. package/dist/packem_chunks/cli-main.js +156 -174
  13. package/dist/packem_chunks/context.js +8 -0
  14. package/dist/packem_chunks/fix.js +1 -1
  15. package/dist/packem_chunks/handler10.js +1 -1
  16. package/dist/packem_chunks/handler12.js +4 -4
  17. package/dist/packem_chunks/handler13.js +1 -1
  18. package/dist/packem_chunks/handler14.js +1 -1
  19. package/dist/packem_chunks/handler15.js +1 -1
  20. package/dist/packem_chunks/handler19.js +5 -5
  21. package/dist/packem_chunks/handler2.js +1 -1
  22. package/dist/packem_chunks/handler20.js +1 -1
  23. package/dist/packem_chunks/handler21.js +1 -1
  24. package/dist/packem_chunks/handler23.js +1 -1
  25. package/dist/packem_chunks/handler24.js +1 -1
  26. package/dist/packem_chunks/handler25.js +1 -1
  27. package/dist/packem_chunks/handler26.js +4 -4
  28. package/dist/packem_chunks/handler28.js +1 -1
  29. package/dist/packem_chunks/handler3.js +1 -1
  30. package/dist/packem_chunks/handler31.js +1 -1
  31. package/dist/packem_chunks/handler32.js +1 -1
  32. package/dist/packem_chunks/handler33.js +1 -1
  33. package/dist/packem_chunks/handler34.js +3 -3
  34. package/dist/packem_chunks/handler35.js +1 -1
  35. package/dist/packem_chunks/handler36.js +1 -1
  36. package/dist/packem_chunks/handler38.js +2 -2
  37. package/dist/packem_chunks/handler39.js +5 -5
  38. package/dist/packem_chunks/handler4.js +4 -4
  39. package/dist/packem_chunks/handler40.js +1 -1
  40. package/dist/packem_chunks/handler41.js +1 -1
  41. package/dist/packem_chunks/handler42.js +1 -1
  42. package/dist/packem_chunks/handler43.js +1 -1
  43. package/dist/packem_chunks/handler44.js +1 -1
  44. package/dist/packem_chunks/handler45.js +1 -1
  45. package/dist/packem_chunks/handler46.js +1 -1
  46. package/dist/packem_chunks/handler47.js +1 -1
  47. package/dist/packem_chunks/handler48.js +1 -1
  48. package/dist/packem_chunks/handler49.js +1 -1
  49. package/dist/packem_chunks/handler5.js +4 -4
  50. package/dist/packem_chunks/handler50.js +5 -5
  51. package/dist/packem_chunks/handler52.js +1 -1
  52. package/dist/packem_chunks/handler54.js +2 -2
  53. package/dist/packem_chunks/handler55.js +1 -1
  54. package/dist/packem_chunks/handler56.js +3 -3
  55. package/dist/packem_chunks/handler57.js +4 -4
  56. package/dist/packem_chunks/handler58.js +4 -4
  57. package/dist/packem_chunks/handler59.js +2 -2
  58. package/dist/packem_chunks/handler6.js +7 -7
  59. package/dist/packem_chunks/handler60.js +1 -1
  60. package/dist/packem_chunks/handler61.js +3 -3
  61. package/dist/packem_chunks/handler62.js +1 -1
  62. package/dist/packem_chunks/handler63.js +3 -3
  63. package/dist/packem_chunks/handler64.js +3 -3
  64. package/dist/packem_chunks/handler65.js +4 -4
  65. package/dist/packem_chunks/handler66.js +2 -2
  66. package/dist/packem_chunks/handler67.js +5 -5
  67. package/dist/packem_chunks/handler68.js +12 -25
  68. package/dist/packem_chunks/handler69.js +25 -22
  69. package/dist/packem_chunks/handler7.js +1 -1
  70. package/dist/packem_chunks/handler70.js +22 -10
  71. package/dist/packem_chunks/handler71.js +10 -153
  72. package/dist/packem_chunks/handler72.js +133 -23
  73. package/dist/packem_chunks/handler73.js +23 -323
  74. package/dist/packem_chunks/handler74.js +274 -659
  75. package/dist/packem_chunks/handler75.js +708 -48
  76. package/dist/packem_chunks/handler76.js +48 -27
  77. package/dist/packem_chunks/handler77.js +27 -3
  78. package/dist/packem_chunks/handler78.js +3 -191
  79. package/dist/packem_chunks/handler79.js +191 -0
  80. package/dist/packem_chunks/handler8.js +1 -1
  81. package/dist/packem_chunks/heal.js +2 -2
  82. package/dist/packem_chunks/help-command.js +1 -1
  83. package/dist/packem_chunks/index2.js +3 -58
  84. package/dist/packem_chunks/index3.js +40 -3
  85. package/dist/packem_chunks/index6.js +135 -7
  86. package/dist/packem_chunks/index7.js +7 -135
  87. package/dist/packem_chunks/keys-refresh.js +1 -1
  88. package/dist/packem_chunks/list.js +2 -2
  89. package/dist/packem_chunks/prune.js +1 -1
  90. package/dist/packem_chunks/python-plan.js +3 -3
  91. package/dist/packem_chunks/python-projects.js +1 -1
  92. package/dist/packem_chunks/python.js +1 -0
  93. package/dist/packem_chunks/run.js +1 -1
  94. package/dist/packem_chunks/snapshot.js +2 -2
  95. package/dist/packem_chunks/state.js +2 -2
  96. package/dist/packem_chunks/status.js +1 -1
  97. package/dist/packem_chunks/sync.js +1 -1
  98. package/dist/packem_chunks/verify-lockfile.js +1 -1
  99. package/dist/packem_chunks/version-resolver.js +1 -1
  100. package/dist/packem_chunks/workspace.js +2 -2
  101. package/dist/packem_shared/ReleaseClient-CWD9BC5w.js +1 -0
  102. package/dist/packem_shared/advisories-BodWQ5DQ.js +1 -0
  103. package/dist/packem_shared/{affected-selection-CrW7fWEd.js → affected-selection-QaMUnFqe.js} +1 -1
  104. package/dist/packem_shared/{ai-analysis-pldoS_N4.js → ai-analysis-D7jlbJky.js} +3 -3
  105. package/dist/packem_shared/ai-cache-iSIyY3So.js +1 -0
  106. package/dist/packem_shared/{ai-fix-D9MxigBQ.js → ai-fix-CgCyO65Q.js} +6 -6
  107. package/dist/packem_shared/apply-DoeQAAGm.js +6 -0
  108. package/dist/packem_shared/apply-release-plan-BalHtK-g.js +15 -0
  109. package/dist/packem_shared/{bin-D3TtXgz6.js → bin-LyW9KY0i.js} +1 -1
  110. package/dist/packem_shared/clean-package-json-rutwkKl-.js +1 -0
  111. package/dist/packem_shared/createAdapter-DMK4bBET.js +1 -0
  112. package/dist/packem_shared/createVersionActions-DXo4z8VN.js +1 -0
  113. package/dist/packem_shared/dependency-scan-DFnt1mni.js +1 -0
  114. package/dist/packem_shared/detect-CbMRSXkM.js +1 -0
  115. package/dist/packem_shared/{ecosystem-gate-ByxWtzPE.js → ecosystem-gate-Bdz-gK_Y.js} +1 -1
  116. package/dist/packem_shared/env-BSXG3QKH.js +4 -0
  117. package/dist/packem_shared/env-consistency-B4rU4MQb.js +1 -0
  118. package/dist/packem_shared/failure-log-DIsKBKaI.js +2 -0
  119. package/dist/packem_shared/formatBytes-_HvjOy8a-iHCer6uX.js +1 -0
  120. package/dist/packem_shared/glob-Cyk1H9ZL-DRlUeuow.js +1 -0
  121. package/dist/packem_shared/{index-BKbMnn8K.js → index-B1ZsG3oa.js} +1 -1
  122. package/dist/packem_shared/index-CgNfNk12.js +1 -0
  123. package/dist/packem_shared/lifecycle-CQjeMPY0.js +2 -0
  124. package/dist/packem_shared/missing-package-json-dtwl6w-S.js +1 -0
  125. package/dist/packem_shared/multi-eco-lockfiles-CyIfYw4u.js +1 -0
  126. package/dist/packem_shared/npmrc-CHsOyMvA.js +2 -0
  127. package/dist/packem_shared/osv-C53WUoSW.js +1 -0
  128. package/dist/packem_shared/{package-version-QFmE9anh.js → package-version-DqYSd_ia.js} +1 -1
  129. package/dist/packem_shared/packument-CbTmbHU4.js +1 -0
  130. package/dist/packem_shared/{project-name-filter-DIqpdsvP.js → project-name-filter-mwTJC1IK.js} +1 -1
  131. package/dist/packem_shared/{provenance-L1M2FPy_.js → provenance-SX1MxPUZ.js} +1 -1
  132. package/dist/packem_shared/publish-Dc0XGH3K.js +34 -0
  133. package/dist/packem_shared/registry-CkoaWkjP.js +81 -0
  134. package/dist/packem_shared/registry-keys-z038Ecb4.js +1 -0
  135. package/dist/packem_shared/removeSync-g1D5kONg-LbjATA8v.js +1 -0
  136. package/dist/packem_shared/renderToString-DR0zDUjh-C7p-L6AO.js +3 -0
  137. package/dist/packem_shared/{resolve-explicit-CQa37JSq.js → resolve-explicit-D9kdTNvl.js} +1 -1
  138. package/dist/packem_shared/{run-D-uVGHQ4.js → run-DLvd3RIZ.js} +1 -1
  139. package/dist/packem_shared/run-summary-utils-CMeURYtS.js +1 -0
  140. package/dist/packem_shared/runtime-check-D3cRDuoi.js +1 -0
  141. package/dist/packem_shared/s1ngularity-BuU9Cxpy.js +1 -0
  142. package/dist/packem_shared/scaffold-files-Bje3_Ixv.js +28 -0
  143. package/dist/packem_shared/scan-progress-D8ojNcKt.js +2 -0
  144. package/dist/packem_shared/{signatures-DIqFUOfs.js → signatures-CeL0bOEo.js} +1 -1
  145. package/dist/packem_shared/spinner-Bqjpz3i4.js +1 -0
  146. package/dist/packem_shared/table-DDAJalPF.js +1 -0
  147. package/dist/packem_shared/tabs-CC0GJLww.js +1 -0
  148. package/dist/packem_shared/{task-env-DzR4RkOj.js → task-env-C2lmxvzA.js} +1 -1
  149. package/dist/packem_shared/toolchain-CP79HNVy.js +5 -0
  150. package/dist/packem_shared/typosquats-BFKus_aM.js +1 -0
  151. package/dist/packem_shared/use-measured-height-_nYuZ-Au.js +1 -0
  152. package/dist/packem_shared/vis-update-app-Ba5ce8Jd.js +1 -0
  153. package/dist/packem_shared/{vis-user-error-S0Fesz5y.js → vis-user-error-D_ekz9rF.js} +1 -1
  154. package/dist/packem_shared/watch-loop-DWr41vHM.js +11 -0
  155. package/dist/packem_shared/xxh3-BLHlvhgT.js +1 -0
  156. package/dist/release/core/package-managers/index.js +1 -1
  157. package/dist/release/core/version-actions/index.js +1 -1
  158. package/dist/release/index.js +1 -1
  159. package/index.js +26 -26
  160. package/package.json +9 -9
  161. package/dist/packem_chunks/orchestrator.js +0 -46
  162. package/dist/packem_shared/ReleaseClient-DAvbxCdo.js +0 -1
  163. package/dist/packem_shared/createAdapter-F7GidOzU.js +0 -1
  164. package/dist/packem_shared/createVersionActions-ByaJ1Nbv.js +0 -1
  165. package/dist/packem_shared/dependency-scan-B8jroa1D.js +0 -1
  166. package/dist/packem_shared/env-consistency-Dt_uDbSP.js +0 -1
  167. package/dist/packem_shared/failure-log-BP-gCUb5.js +0 -2
  168. package/dist/packem_shared/formatBytes-_HvjOy8a-B_qQr4Hw.js +0 -4
  169. package/dist/packem_shared/glob-Cyk1H9ZL-Dxlf9Swz.js +0 -1
  170. package/dist/packem_shared/index-DGdD4w-b.js +0 -1
  171. package/dist/packem_shared/lifecycle-DvmDIRbb.js +0 -2
  172. package/dist/packem_shared/missing-package-json-Cu5YVAot.js +0 -1
  173. package/dist/packem_shared/multi-eco-lockfiles-B2X3yhyo.js +0 -1
  174. package/dist/packem_shared/packument-zb18Jnlw.js +0 -1
  175. package/dist/packem_shared/registry-keys-DxdqMzyp.js +0 -1
  176. package/dist/packem_shared/runtime-check-1U8HrQd9.js +0 -1
  177. package/dist/packem_shared/s1ngularity-CO5GkkqX.js +0 -1
  178. package/dist/packem_shared/scan-progress-RwCRxJdX.js +0 -2
  179. package/dist/packem_shared/spinner-BJjbNl1F.js +0 -1
  180. package/dist/packem_shared/tabs--uxJGL8N.js +0 -1
  181. package/dist/packem_shared/toolchain-Bz70UIcp.js +0 -5
  182. package/dist/packem_shared/typosquats-D4DEHhFy.js +0 -1
  183. package/dist/packem_shared/use-measured-height-DUZyyias.js +0 -1
  184. package/dist/packem_shared/vis-update-app-9b2kSk9f.js +0 -1
  185. package/dist/packem_shared/watch-loop-BEnGuMBn.js +0 -11
@@ -1,27 +1,48 @@
1
- import{createRequire as wt}from"node:module";import{a as x,$ as nt,U as yt,v as it,e as P,q as Tt}from"../packem_shared/index-BzhrR_iC.js";import{F as m,X as E,o as b,z as vt,l as St}from"./catalog.js";import at from"./index.js";import{x as ot}from"../packem_shared/main-CgDAlZkm.js";import{y as B}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{q as $t}from"./cli-main.js";import{l as At}from"../packem_shared/spinner-BJjbNl1F.js";import{C as ct,D as F,T as dt}from"../packem_shared/symbols-BXDZ_sKt.js";import{b as z,F as C,q as D,X as L,J as It}from"../packem_shared/index.server-Ca_EEVfw.js";import{withEnhancedPath as Mt}from"@visulima/task-runner";let mt;const kt=t=>(mt??=wt(import.meta.url))(t),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,G=t=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,s]=I.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return I.getBuiltinModule(t)}return kt(t)},{readFileSync:bt,writeFileSync:xt,unlinkSync:Ct}=G("node:fs"),{randomBytes:Et}=G("node:crypto"),{availableParallelism:V}=G("node:os");class A extends Error{constructor(e,s){super(e,s),this.name=this.constructor.name}}class Rt extends A{}class T extends A{}class W extends A{}class R extends A{stderr;constructor(e,s,r){super(e,r),this.stderr=s}}class X extends A{}class $ extends A{commandTitle;constructor(e,s,r){super(s,r),this.commandTitle=e}}const lt=t=>t.includes("/"),O=(t,e)=>e?t.toLowerCase():t,jt=(t,e,s,r={})=>{const n=lt(t),i=r.caseInsensitive===!0,c=O(t,i),a=[];for(const o of e){const l=n?x(s,o):nt(o);at(c,O(l,i))&&a.push(o)}return a},_t=(t,e,s,r={})=>{if(!e||e.length===0)return[...t];const n=r.caseInsensitive===!0;return t.filter(i=>{for(const c of e){const a=lt(c)?x(s,i):nt(i),o=O(c,n);if(at(o,O(a,n)))return!1}return!0})},q=t=>typeof t=="object"&&t!==null&&typeof t.title=="string"&&typeof t.task=="function",_=t=>typeof t=="object"&&t!==null&&typeof t.command=="string"&&typeof t.task!="function",Pt=(t,e)=>{const s=x(t,e);return s===""||!s.startsWith("..")&&!it(s)},Ft=(t,e)=>{let s;for(const r of e)Pt(r,t)&&(s===void 0||r.length>s.length)&&(s=r);return s},Ot=async t=>{let e=0,s=0;const r=()=>(e+=1,`pattern-${e}`),n=()=>(s+=1,`cmd-${s}`),i=(o,l,f,d)=>{if(o.perPackage===!0){const u=t.workspacePackages??[],g=new Map;for(const h of f){const w=Ft(h,u)??t.cwd,k=g.get(w)??[];k.push(x(w,h)),g.set(w,k)}for(const h of[...g.keys()].sort()){const w=x(t.cwd,h)||".";d.push({command:o.command,cwd:h,files:g.get(h)??[],id:n(),source:"string",title:`${o.command} — ${w}`})}return}if(o.cwd!==void 0){const u=yt(t.cwd,o.cwd);d.push({command:o.command,cwd:u,files:f,id:n(),source:"string",title:`${o.command} — ${x(t.cwd,u)||"."}`});return}d.push({command:o.command,files:l,id:n(),source:"string",title:o.command})},c=async(o,l,f,d)=>{if(typeof o=="string"){d.push({command:o,files:l,id:n(),source:"string",title:o});return}if(Array.isArray(o)){for(const u of o)await c(u,l,f,d);return}if(_(o)){i(o,l,f,d);return}if(typeof o=="function"){const u=await o([...l]);if(typeof u=="string"){d.push({command:u,files:l,id:n(),source:"function",title:u});return}if(Array.isArray(u)){for(const g of u)if(typeof g=="string")d.push({command:g,files:l,id:n(),source:"function",title:g});else if(_(g))i(g,l,f,d);else if(q(g))d.push({files:l,id:n(),run:g.task,source:"custom",title:g.title});else throw new T("Task function returned an array with an unsupported entry — expected strings, { command, … }, or { title, task }.");return}if(_(u)){i(u,l,f,d);return}if(q(u)){d.push({files:l,id:n(),run:u.task,source:"custom",title:u.title});return}throw new T("Task function returned an unsupported value — expected string, string[], { command, … }, or { title, task }.")}if(q(o)){d.push({files:l,id:n(),run:o.task,source:"custom",title:o.title});return}throw new T("Unsupported task value — expected string, string[], function, { command, … }, or { title, task }.")},a=[];for(const[o,l]of Object.entries(t.config)){const f=jt(o,t.files,t.cwd,{caseInsensitive:t.caseInsensitive===!0});if(f.length===0)continue;const d=t.relative?f.map(g=>x(t.cwd,g)):f,u=[];await c(l,d,f,u),u.length!==0&&a.push({commands:u,files:d,id:r(),pattern:o,title:`${o} — ${f.length} file${f.length===1?"":"s"}`})}return a},Nt=async t=>{if(t.config!==void 0)return t.config;throw new T(`No staged config provided. Add \`staged\` to your vis.config.ts:
2
-
3
- import { defineConfig } from "@visulima/vis/config";
4
-
5
- export default defineConfig({
6
- staged: { "*.ts": "eslint --fix" },
7
- });
8
-
9
- Coming from lint-staged or nano-staged? Run \`vis migrate lint-staged\` (or \`vis migrate nano-staged\`) to move the config in and remove the legacy files.`)},K=t=>{if(typeof t!="object"||t===null)throw new T("Staged config must be an object mapping glob patterns to tasks.");const e=Object.entries(t);if(e.length===0)throw new T("Staged config is empty — at least one glob pattern is required.");for(const[s,r]of e){if(!s||s.trim()==="")throw new T("Staged config keys must be non-empty glob patterns.");ut(s,r)}return t},ut=(t,e)=>{if(typeof e=="string"){if(e.trim()==="")throw new T(`Task for "${t}" is an empty string.`);return}if(Array.isArray(e)){if(e.length===0)throw new T(`Task array for "${t}" is empty.`);for(const s of e)ut(t,s);return}if(typeof e!="function"){if(typeof e=="object"&&e!==null&&typeof e.command=="string"&&typeof e.task=="function")throw new T(`Task for "${t}" sets both \`command\` and \`task\` — use one or the other.`);if(_(e)){if(e.command.trim()==="")throw new T(`Command task for "${t}" has an empty \`command\`.`);return}if(!Dt(e))throw new T(`Invalid task for "${t}" — expected string, string[], function, { command, … }, or { title, task } object.`)}},Dt=t=>typeof t=="object"&&t!==null&&typeof t.title=="string"&&typeof t.task=="function",Y=2048,p=async(t,e)=>{const s=e.input===void 0?void 0:typeof e.input=="string"?e.input:e.input.toString("utf8"),r=await ot("git",[...t],{nodeOptions:{cwd:e.cwd,env:e.env?{...process.env,...e.env}:void 0,stdio:s===void 0?["ignore","pipe","pipe"]:["pipe","pipe","pipe"]},stdin:s}),n=typeof r.exitCode=="number"?r.exitCode:1;if(n!==0&&!e.lenient){const{stderr:i}=r,c=i.length>Y?`${i.slice(0,Y)}…`:i;throw new R(`git ${t.join(" ")} failed with exit code ${n}: ${c.trim()}`,i)}return{exitCode:n,stderr:r.stderr,stdout:r.stdout}},j=async(t,e)=>{const{stdout:s}=await p(t,e);return s.trim()},Lt=async t=>{const e=await p(["rev-parse","--is-inside-work-tree"],{cwd:t,lenient:!0});return e.exitCode===0&&e.stdout.trim()==="true"},qt=async t=>j(["rev-parse","--absolute-git-dir"],{cwd:t}),ft=async t=>j(["rev-parse","--show-toplevel"],{cwd:t}),J=async t=>j(["write-tree"],{cwd:t}),Ut=async t=>{const e=await p(["rev-parse","HEAD^{tree}"],{cwd:t,lenient:!0});return e.exitCode===0?e.stdout.trim():""},M={major:2,minor:32},Gt=t=>{const e=/git version (\d+)\.(\d+)/.exec(t);if(!e)return null;const s=Number.parseInt(e[1]??"",10),r=Number.parseInt(e[2]??"",10);return Number.isNaN(s)||Number.isNaN(r)?null:{major:s,minor:r}},Ht=async t=>{const e=Gt(await j(["--version"],{cwd:t}));if(e===null)return;if(e.major<M.major||e.major===M.major&&e.minor<M.minor)throw new R(`Git ${M.major}.${M.minor} or newer is required; found ${e.major}.${e.minor}.`)},Bt="ACMR",Z=500,zt=async t=>{const{stdout:e}=await p(["diff-files","--raw","-z"],{cwd:t}),s=e.split("\0").filter(n=>n.length>0),r=[];for(let n=0;n<s.length;n+=1){const i=s[n];if(!i?.startsWith(":"))continue;const c=i.slice(1).split(" "),a=c[3],o=c[4],l=s[n+1];n+=1,o==="A"&&a!==void 0&&/^0+$/.test(a)&&l!==void 0&&r.push(l)}return r},Q=async t=>{const{stdout:e}=await p(["ls-files","--others","--exclude-standard","-z"],{cwd:t});return e.split("\0").filter(s=>s.length>0)},Vt=async(t,e)=>{if(t.length===0)return;const s=`${t.join("\0")}\0`;await p(["rm","--cached","--quiet","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:e.cwd,input:s})},Wt=async t=>{const e=t.diffFilter??Bt,s=t.diff===void 0?["diff","--name-only","-z",`--diff-filter=${e}`,"--staged"]:["diff","--name-only","-z",`--diff-filter=${e}`,...t.diff.split(/\s+/).filter(Boolean)],{stdout:r}=await p(s,{cwd:t.cwd}),n=r.split("\0").filter(c=>c.length>0);if(n.length===0)return[];const i=t.workTree??await ft(t.cwd);return n.map(c=>it(c)?c:P(i,c))},Xt=async(t,e)=>{if(t.length===0)return null;const s=[];for(let i=0;i<t.length;i+=Z){const c=t.slice(i,i+Z),{stdout:a}=await p(["diff","--binary","--unified=0","--no-color","--no-ext-diff","--src-prefix=a/","--dst-prefix=b/","--patch","--submodule=short","--",...c],{cwd:e.cwd});a.length>0&&s.push(a)}if(s.length===0)return null;const r=s.join(""),n=r.endsWith(`
10
- `)?r:`${r}
11
- `;return Buffer.from(n,"utf8")},Kt=async t=>{const{stdout:e}=await p(["status","--porcelain=v1","-z"],{cwd:t}),s=e.split("\0"),r=[];for(let n=0;n<s.length;n+=1){const i=s[n];if(i===void 0||i.length<4)continue;const c=i.charAt(0),a=i.charAt(1),o=i.slice(3),l=c==="R"||c==="C"||a==="R"||a==="C";c!==" "&&c!=="?"&&a!==" "&&a!=="?"&&r.push(o),l&&(n+=1)}return r},Yt=async(t,e)=>{if(t.length===0)return;const s=`${t.join("\0")}\0`;await p(["checkout","--force","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:e.cwd,input:s})},Jt=async(t,e)=>{if(await p(["update-index","--again"],{cwd:e.cwd,lenient:!0}),t.length===0)return;const s=`${t.join("\0")}\0`;await p(["add","-u","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:e.cwd,input:s})},Zt="vis_staged_automatic_backup",ht=()=>`${Zt}-${process.pid}-${Date.now()}-${Et(3).toString("hex")}`,Qt=async t=>{const e=await j(["stash","create"],{cwd:t});return e.length===0?null:(await p(["stash","store","-m",ht(),e],{cwd:t}),e)},te=async(t,e)=>{const{exitCode:s,stdout:r}=await p(["reflog","--format=%H %gs","refs/stash"],{cwd:t,lenient:!0});if(s!==0)return null;for(const n of r.split(/\r?\n/)){const i=n.indexOf(" ");if(i!==-1&&n.slice(i+1).includes(e))return n.slice(0,i)}return null},ee=async t=>{const e=ht(),{exitCode:s,stdout:r}=await p(["stash","push","--keep-index","--include-untracked","--quiet","-m",e],{cwd:t,lenient:!0});if(s!==0)return null;const n=r.trim();return n.length>0&&/no local changes/i.test(n)?null:te(t,e)},se=async(t,e)=>{const{exitCode:s,stdout:r}=await p(["reflog","--format=%H %gd","refs/stash"],{cwd:t,lenient:!0});if(s!==0)return null;for(const n of r.split(/\r?\n/)){const[i,c]=n.split(/\s+/,2);if(i===e&&c!==void 0)return c}return null},gt=async(t,e)=>{const{exitCode:s}=await p(["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,lenient:!0});return s===0},re=async(t,e)=>{const s=await se(t,e);if(s===null)return null;const{exitCode:r,stdout:n}=await p(["rev-parse","--verify","--quiet",s],{cwd:t,lenient:!0});return r===0&&n.trim()===e?s:null},U=async(t,e)=>{if(e===null)return;const s=await re(t,e);s!==null&&await p(["stash","drop","--quiet",s],{cwd:t})},ne=async(t,e)=>{if(e===null)throw new W("Backup stash was not found — can't revert working tree.");if(!await gt(t,e))throw new W(`Backup stash ${e} is no longer reachable — can't revert working tree.`);await p(["reset","--hard","HEAD"],{cwd:t}),await p(["stash","apply","--index","--quiet",e],{cwd:t})},ie=async(t,e)=>{e!==null&&await gt(t,e)&&(await p(["stash","apply","--quiet",e],{cwd:t}),await U(t,e))};class ae{stagedFiles=[];partiallyStaged=[];workTree="";gitDir="";preTaskIndexTree="";postTaskIndexTree="";headTree="";revertApplied=!1;warnings=[];cwd;options;patch=null;backupStashSha=null;merge=[];shouldStash;shouldHidePartial;shouldHideUnstaged;shouldHideAll;hideAllStashSha=null;intentToAddPaths=[];preTaskUntracked=new Set;constructor(e){this.cwd=e.cwd??process.cwd(),this.options=e,this.shouldStash=e.stash!==!1&&e.diff===void 0,this.shouldHidePartial=e.hidePartiallyStaged!==!1,this.shouldHideUnstaged=e.hideUnstaged===!0,this.shouldHideAll=e.hideAll===!0}async prepare(){if(!await Lt(this.cwd))throw new R(`Not a git repository: ${this.cwd}`);await Ht(this.cwd),this.workTree=await ft(this.cwd),this.gitDir=await qt(this.cwd),this.stagedFiles=await Wt({cwd:this.workTree,diff:this.options.diff,diffFilter:this.options.diffFilter,workTree:this.workTree}),this.partiallyStaged=this.stagedFiles.length===0?[]:await Kt(this.workTree),this.snapshotMergeState(),this.intentToAddPaths=await zt(this.workTree),this.intentToAddPaths.length>0&&await Vt(this.intentToAddPaths,{cwd:this.workTree}),this.shouldStash?this.backupStashSha=await Qt(this.workTree):this.partiallyStaged.length>0&&this.warnings.push("Running with --no-stash on partially-staged files — unstaged deltas will be captured to a patch, but if re-applying the patch fails after tasks run the changes cannot be recovered."),this.shouldHideAll?this.hideAllStashSha=await ee(this.workTree):await this.hideUnstagedChanges(),this.preTaskIndexTree=this.stagedFiles.length===0?"":await J(this.workTree),this.postTaskIndexTree=this.preTaskIndexTree,this.headTree=await Ut(this.workTree),this.preTaskUntracked=new Set(await Q(this.workTree))}async applyModifications({autoStage:e=!1}={}){if(this.stagedFiles.length===0)return;const s=this.stagedFiles.map(r=>x(this.workTree,r));if(await Jt(s,{cwd:this.workTree}),e){const n=(await Q(this.workTree)).filter(i=>!this.preTaskUntracked.has(i));if(n.length>0){const i=`${n.join("\0")}\0`;await p(["add","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:this.workTree,input:i})}}if(this.intentToAddPaths.length>0)try{await p(["add","--intent-to-add","--",...this.intentToAddPaths],{cwd:this.workTree})}catch{}this.postTaskIndexTree=await J(this.workTree)}indexTreeChanged(){return this.preTaskIndexTree.length>0&&this.postTaskIndexTree.length>0&&this.preTaskIndexTree!==this.postTaskIndexTree}postTaskIndexMatchesHead(){return this.postTaskIndexTree.length>0&&this.headTree.length>0&&this.postTaskIndexTree===this.headTree}async restoreUnstagedChanges(){if(this.revertApplied||this.patch===null||this.shouldHideAll)return;const e=["apply","--whitespace=nowarn","--recount","--unidiff-zero"];let s;try{await p(e,{cwd:this.workTree,input:this.patch});return}catch(r){s=r instanceof R?r.stderr:String(r)}try{await p([...e,"--3way"],{cwd:this.workTree,input:this.patch})}catch(r){const n=r instanceof R&&r.stderr?r.stderr:String(r);throw new X(`Failed to re-apply unstaged changes after running tasks. Original changes remain in the backup stash — recover with \`git stash list\` and \`git stash apply\`.
12
- First attempt: ${s??"(no stderr)"}
13
- Second attempt: ${n}`,{cause:r})}}async revert(){if(this.backupStashSha!==null){try{await ne(this.workTree,this.backupStashSha)}catch(e){throw new X("Revert failed while restoring the backup stash. Use `git stash list` to recover manually.",{cause:e})}if(await U(this.workTree,this.backupStashSha),this.intentToAddPaths.length>0)try{await p(["add","--intent-to-add","--",...this.intentToAddPaths],{cwd:this.workTree})}catch{}this.revertApplied=!0}}async cleanup(e){if(this.restoreMergeState(),this.hideAllStashSha!==null)try{await ie(this.workTree,this.hideAllStashSha)}catch{}e&&this.backupStashSha!==null&&!this.revertApplied&&await U(this.workTree,this.backupStashSha)}recoveryHint(){return this.backupStashSha===null?null:`Backup stash is preserved (sha ${this.backupStashSha.slice(0,7)}) — restore with: git stash apply --index ${this.backupStashSha}`}async hideUnstagedChanges(){const e=new Set(this.stagedFiles.map(r=>x(this.workTree,r))),s=this.shouldHideUnstaged?[...e]:this.shouldHidePartial?this.partiallyStaged.filter(r=>e.has(r)):[];s.length!==0&&(this.patch=await Xt(s,{cwd:this.workTree}),this.patch!==null&&await Yt(s,{cwd:this.workTree}))}snapshotMergeState(){this.gitDir.length!==0&&(this.merge=["MERGE_HEAD","MERGE_MODE","MERGE_MSG"].map(e=>{const s=P(this.gitDir,e);return B(s)?{body:bt(s),existed:!0,name:e}:{body:null,existed:!1,name:e}}))}restoreMergeState(){if(!(this.gitDir.length===0||this.merge.length===0))for(const e of this.merge){const s=P(this.gitDir,e.name);try{e.existed&&e.body!==null?xt(s,e.body):B(s)&&Ct(s)}catch{}}}}const oe=t=>{switch(t){case"failed":return"red";case"running":return"cyan";case"skipped":return"yellow";case"success":return"green";default:return"gray"}},tt=t=>{if(t==="running")return m.jsx(At,{type:"dots"});const e=t==="failed"?ct:t==="skipped"?F:t==="success"?dt:F;return m.jsx(b,{color:oe(t),children:e})},et=({state:t,tick:e,verbose:s})=>m.jsxs(E,{flexDirection:"column",children:[[...t.patterns.values()].map(r=>m.jsxs(E,{flexDirection:"column",children:[m.jsxs(E,{children:[tt(r.status),m.jsxs(b,{children:[" ",r.title]})]}),[...r.commands.values()].map(n=>m.jsxs(E,{flexDirection:"column",marginLeft:2,children:[m.jsxs(E,{children:[tt(n.status),m.jsxs(b,{children:[" ",n.title," "]}),n.status!=="pending"&&n.status!=="running"?m.jsxs(b,{color:"gray",children:["(",n.durationMs,"ms)"]}):null]}),s&&n.output?m.jsx(E,{flexDirection:"column",marginLeft:2,children:n.output.split(/\r?\n/).slice(0,20).map((i,c)=>m.jsx(b,{color:"gray",children:i},`${n.id}-line-${c}`))}):null,n.status==="failed"&&n.error?m.jsx(E,{marginLeft:2,children:m.jsx(b,{color:"red",children:n.error.message})}):null]},n.id))]},r.id)),t.infoMessages.map((r,n)=>m.jsx(b,{color:"gray",children:r},`info-${n}`)),t.warnMessages.map((r,n)=>m.jsx(b,{color:"yellow",children:r},`warn-${n}`)),t.errorMessages.map(({message:r},n)=>m.jsx(b,{color:"red",children:r},`err-${n}`))]}),ce=(t={})=>{const e=t.verbose===!0,s={errorMessages:[],infoMessages:[],patterns:new Map,started:!1,warnMessages:[]};let r=0;const n=$t(m.jsx(et,{state:s,tick:r,verbose:e}),{exitOnCtrlC:!1,stdout:process.stderr}),i=()=>{r+=1,n.rerender(m.jsx(et,{state:s,tick:r,verbose:e}))};return{commandEnd({commandId:c,durationMs:a,error:o,output:l,patternId:f,status:d}){const u=s.patterns.get(f)?.commands.get(c);u&&(u.status=d,u.durationMs=a,u.output=l,u.error=o,i())},commandStart({commandId:c,patternId:a}){const o=s.patterns.get(a)?.commands.get(c);o&&(o.status="running",i())},error({error:c,message:a}){s.errorMessages.push({error:c,message:a}),i()},info({message:c}){s.infoMessages.push(c),i()},patternEnd({patternId:c,status:a}){const o=s.patterns.get(c);o&&(o.status=a,i())},patternStart({patternId:c}){const a=s.patterns.get(c);a&&(a.status="running",i())},start({patterns:c}){s.started=!0;for(const a of c){const o=new Map;for(const l of a.commands)o.set(l.id,{durationMs:0,id:l.id,status:"pending",title:l.title});s.patterns.set(a.id,{commands:o,id:a.id,status:"pending",title:a.title})}i()},async stop(){n.unmount(),await n.waitUntilExit()},warn({message:c}){s.warnMessages.push(c),i()}}},st=(t={})=>{const{quiet:e=!1,verbose:s=!1}=t,r=new Map,n=new Map,i=a=>{e||process.stderr.write(`${a}
14
- `)},c=a=>{switch(a){case"failed":return L(ct);case"running":return D(">");case"skipped":return z(F);case"success":return It(dt);default:return C(F)}};return{commandEnd({commandId:a,durationMs:o,error:l,output:f,status:d}){const u=n.get(a)??a,g=C(`(${o}ms)`);if(i(` ${c(d)} ${u} ${g}`),d==="failed"&&l&&i(C(l.message)),(d==="failed"||s)&&f&&f.trim().length>0)for(const h of f.split(/\r?\n/))i(` ${C(h)}`)},commandStart({commandId:a}){if(!s)return;const o=n.get(a)??a;i(` ${C("…")} ${o}`)},error({error:a,message:o}){e?process.stderr.write(`${L(o)}
15
- `):i(L(o)),a?.stack&&(s||!e)&&process.stderr.write(`${C(a.stack)}
16
- `)},info({message:a}){i(C(a))},patternEnd({patternId:a,status:o}){const l=r.get(a)??a;i(`${c(o)} ${l}`)},patternStart({patternId:a}){const o=r.get(a)??a;i(`${D(">")} ${o}`)},start({patterns:a}){if(a.length===0){i(C("No staged files matched any pattern."));return}const o=new Set(a.flatMap(l=>l.files)).size;i(`${D(">")} Running staged tasks on ${o} file${o===1?"":"s"} across ${a.length} pattern${a.length===1?"":"s"}`);for(const l of a){r.set(l.id,l.title);for(const f of l.commands)n.set(f.id,f.title)}},stop(){},warn({message:a}){i(z(a))}}},de=async t=>{const{env:e}=process;if(t.debug===!0||t.quiet===!0||e.NODE_ENV==="test"||e.TERM==="dumb"||e.CI!==void 0||!process.stderr.isTTY)return st({quiet:t.quiet,verbose:t.verbose});try{return ce({verbose:t.verbose})}catch{return st({quiet:t.quiet,verbose:t.verbose})}},le=t=>{const e=[];let s="",r=!1,n=!1;for(let i=0;i<t.length;i+=1){const c=t[i];if(c===void 0)break;if(c==="\\"&&!r&&i+1<t.length){const a=t[i+1];if(a!==void 0){n&&a!=='"'&&a!=="\\"&&(s+=c),s+=a,i+=1;continue}}if(c==='"'&&!r){n=!n;continue}if(c==="'"&&!n){r=!r;continue}if(!r&&!n&&/\s/.test(c)){s.length>0&&(e.push(s),s="");continue}s+=c}if(r||n)throw new T(`Unterminated ${r?"single":"double"} quote in command: ${t}`);return s.length>0&&e.push(s),e},pt=process.platform==="win32"?28e3:131072,ue=(t,e,s)=>{const r=[];let n=[],i=e;const c=s<=0?pt:s;for(const a of t){const o=Buffer.byteLength(a)+1;n.length>0&&i+o>c&&(r.push(n),n=[],i=e),n.push(a),i+=o}return n.length>0&&r.push(n),r},fe=async(t,e,s)=>{const r=le(t);if(r.length===0)throw new $(t,"Empty command for staged task.");const[n,...i]=r;if(n===void 0)throw new $(t,"Empty command for staged task.");const c=Buffer.byteLength(n)+i.reduce((f,d)=>f+Buffer.byteLength(d)+1,0),a=ue(e,c,s.maxArgLength??pt),o=Date.now(),l=[];for(const f of a){if(s.signal?.aborted===!0)throw new $(t,"Task aborted by earlier failure.");const d=ot(n,[...i,...f],{nodeOptions:{cwd:s.cwd,env:he(s.env,s.cwd),killSignal:s.killSignal??"SIGTERM",stdio:["ignore","pipe","pipe"]},...s.signal===void 0?{}:{signal:s.signal}}),u=await d,g=[u.stdout,u.stderr].filter(w=>w.length>0).join(`
17
- `);g.length>0&&l.push(g);const h=d.process?.signalCode??null;if(d.aborted||h!==null||u.exitCode===void 0){const w=d.aborted?"Task aborted by earlier failure.":h===null?g.trim()||"Task exited without a numeric status code.":`Task killed by signal ${h}.`;throw new $(t,w)}if(u.exitCode!==0)throw new $(t,g.trim()||`Exit code ${u.exitCode} from ${n}`)}return{durationMs:Date.now()-o,output:l.join(`
18
- `)}},he=(t,e)=>{const s={...process.env};process.stderr.isTTY&&s.FORCE_COLOR===void 0&&s.NO_COLOR===void 0&&(s.FORCE_COLOR="1");const r=t?{...s,...t}:s;return Mt(r,e)},ge=async(t,e,s)=>{const r=we(s.concurrent,t.length),n=[],i=new AbortController;let c=!1,a=0;const o=()=>{c||(c=!0,s.continueOnError||i.abort())};s.externalSignal&&(s.externalSignal.aborted?o():s.externalSignal.addEventListener("abort",()=>{o()},{once:!0}));const l=h=>{for(const w of h.commands)e.commandEnd({commandId:w.id,durationMs:0,patternId:h.id,status:"skipped"})},f=async h=>{if(c){l(h),e.patternEnd({patternId:h.id,status:"skipped"});return}e.patternStart({patternId:h.id});let w="success";for(const k of h.commands){if(c){e.commandEnd({commandId:k.id,durationMs:0,patternId:h.id,status:"skipped"}),w=w==="success"?"skipped":w;continue}e.commandStart({commandId:k.id,patternId:h.id});const v=await pe(k,s,i.signal),S=v.status==="failed"&&i.signal.aborted?{...v,status:"skipped"}:v;if(e.commandEnd({commandId:k.id,durationMs:S.durationMs,error:S.error,output:S.output,patternId:h.id,status:S.status}),S.status==="failed"){n.push(k.title),w="failed",o();break}if(S.status==="skipped"){w=w==="success"?"skipped":w;break}}e.patternEnd({patternId:h.id,status:w})},d=async()=>{for(;a<t.length;){const h=t[a];a+=1,h&&await f(h)}},u=[];for(let h=0;h<Math.min(r,t.length);h+=1)u.push(d());await Promise.all(u);const g=s.externalSignal?.aborted===!0;return{failedCommands:n,success:n.length===0&&!g}},pe=async(t,e,s)=>{const r=Date.now();try{if(t.source==="custom"&&t.run)return await t.run([...t.files]),{durationMs:Date.now()-r,status:"success"};if(t.command){const n=await fe(t.command,t.files,{cwd:t.cwd??e.cwd,killSignal:e.killSignal,maxArgLength:e.maxArgLength,signal:s});return{durationMs:n.durationMs,output:e.verbose?n.output:void 0,status:"success"}}return{durationMs:Date.now()-r,error:new $(t.title,"Command has no invocation target."),status:"failed"}}catch(n){const i=n instanceof Error?n:new Error(String(n));return{durationMs:Date.now()-r,error:i,output:i instanceof $?i.message:void 0,status:"failed"}}},we=(t,e)=>{if(t===!1)return 1;if(t===!0){const r=Math.max(1,typeof V=="function"?V():4);return Math.min(Math.max(1,e),r)}const s=Math.floor(t);return s>0?s:1},me=!0,ke=t=>{try{return!Tt(t)}catch{return!1}},ye=t=>{try{const e=vt(t);return e?St(t,e).map(s=>P(t,s)):[]}catch{return[]}},Te=async(t={})=>{const e=t.cwd??process.cwd(),s=await de(t),r=await Nt(t);typeof r!="function"&&K(r);const n=new ae({...t,cwd:e}),i=new AbortController;let c=!1;const a=d=>{if(c){process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),process.kill(process.pid,d);return}c=!0,s.warn({message:`Received ${d} — cancelling staged tasks and restoring state. Press Ctrl+C again to abort.`}),i.abort()};process.on("SIGINT",a),process.on("SIGTERM",a);let o={failedCommands:[],ranTasks:!1,success:!0},l=!1,f=!1;try{await n.prepare(),l=!0;for(const v of n.warnings)s.warn({message:v});if(n.stagedFiles.length===0)return t.allowEmpty!==!0&&s.info({message:"No staged files found."}),f=!0,{failedCommands:[],ranTasks:!1,success:!0};const d=ke(e),u=_t(n.stagedFiles,t.ignore,e,{caseInsensitive:d});if(u.length===0&&n.stagedFiles.length>0)return s.info({message:"Every staged file was excluded by the `ignore` list."}),f=!0,{failedCommands:[],ranTasks:!1,success:!0};const g=typeof r=="function"?K(await r([...u])):r,h=await Ot({caseInsensitive:d,config:g,cwd:e,files:u,relative:t.relative,workspacePackages:ye(e)});if(s.start({patterns:h}),h.length===0)return s.info({message:"No staged files matched any pattern."}),f=!0,{failedCommands:[],ranTasks:!1,success:!0};const{failedCommands:w,success:k}=await ge(h,s,{concurrent:t.concurrent??me,continueOnError:t.continueOnError===!0,cwd:e,externalSignal:i.signal,killSignal:t.killSignal,maxArgLength:t.maxArgLength,verbose:t.verbose});if(o={failedCommands:w,ranTasks:!0,success:k},k){if(t.diff===void 0&&(await n.applyModifications({autoStage:t.autoStage===!0}),t.failOnChanges===!0&&n.indexTreeChanged()&&(s.warn({message:"Tasks modified staged content — failing because --fail-on-changes is set."}),o={failedCommands:[...w],ranTasks:!0,success:!1}),t.allowEmpty!==!0&&n.postTaskIndexMatchesHead()))throw new Rt("All staged changes were reverted by tasks. Re-stage changes or rerun with --allow-empty.")}else if(t.revert===!0)s.info({message:"Reverting working tree from backup stash."}),await n.revert();else{const v=n.recoveryHint();v&&s.warn({message:v})}return await n.restoreUnstagedChanges(),f=o.success,o}catch(d){const u=d instanceof Error?d.message:String(d),g=d instanceof Error?d:new Error(u);if(s.error({error:g,message:u}),d instanceof A)return{failedCommands:o.failedCommands,ranTasks:o.ranTasks,success:!1};throw d}finally{if(process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),l)try{await n.cleanup(f)}catch(d){s.error({error:d,message:"Cleanup failed."})}await s.stop()}},ve="VIS_STAGED_CONCURRENT",rt=t=>{const e=t.trim();if(e==="true"||e==="")return!0;if(e==="false")return!1;const s=Number(e);return Number.isNaN(s)?!0:s},Se=(t,e)=>{const s={};e!==void 0&&(s.config=e);const r=y=>t[y]===void 0?void 0:!!t[y],n=y=>{const N=t[y];return typeof N=="string"&&N.length>0?N:void 0},i=r("allow-empty");i!==void 0&&(s.allowEmpty=i);const c=r("auto-stage");c!==void 0&&(s.autoStage=c);const a=r("continue-on-error");a!==void 0&&(s.continueOnError=a);const o=r("debug");o!==void 0&&(s.debug=o);const l=r("fail-on-changes");l!==void 0&&(s.failOnChanges=l);const f=r("hide-partially-staged");f!==void 0&&(s.hidePartiallyStaged=f);const d=r("hide-unstaged");d!==void 0&&(s.hideUnstaged=d);const u=r("quiet");u!==void 0&&(s.quiet=u);const g=r("relative");g!==void 0&&(s.relative=g);const h=r("revert");h!==void 0&&(s.revert=h);const w=r("stash");w!==void 0&&(s.stash=w);const k=r("verbose");k!==void 0&&(s.verbose=k);const v=n("cwd");v!==void 0&&(s.cwd=v);const S=n("diff");S!==void 0&&(s.diff=S);const H=n("diff-filter");if(H!==void 0&&(s.diffFilter=H),r("force-kill")===!0&&(s.killSignal="SIGKILL"),t.concurrent===void 0){const y=process.env[ve];y!==void 0&&(s.concurrent=rt(y.trim()))}else{const{concurrent:y}=t;s.concurrent=rt(typeof y=="string"?y:typeof y=="number"||typeof y=="boolean"?String(y):"")}return s},Fe=async({options:t,visConfig:e})=>{const r=(e??{}).staged;if(!r)throw new Error(`No "staged" config found in vis.config.ts. Add one:
19
-
20
- // vis.config.ts
21
- import { defineConfig } from "@visulima/vis/config";
22
-
23
- export default defineConfig({
24
- staged: { '*': 'vis check --fix' },
25
- });
26
-
27
- Migrating from lint-staged or nano-staged? Run \`vis migrate lint-staged\` (or \`vis migrate nano-staged\`) to move the config in and remove the legacy files.`);(await Te(Se(t,r))).success||(process.exitCode=1)};export{Se as buildRunOptions,Fe as default};
1
+ import{createRequire as gt}from"node:module";import{J as We,b as _,F as M,q as Ke,X as K,j as wt}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as L,z,v as vt}from"../packem_shared/index-BzhrR_iC.js";import{l as Ce,f as kt}from"./ts-loader.js";import{O as bt,ai as Rt,c as me,q as Te}from"./cli-main.js";import{O as he}from"../packem_shared/renderToString-DR0zDUjh-C7p-L6AO.js";import{L as X,a as Et,R as V,O as H}from"../packem_shared/registry-CkoaWkjP.js";import{i as le}from"../packem_shared/index-BjdW45xX.js";import{v as xt,r as At,f as Ie}from"../packem_shared/ai-analysis-D7jlbJky.js";import{p as St,a as Ct,s as ze}from"../packem_shared/pm-runner-RM72mDZg.js";import{a as Tt,r as It}from"../packem_shared/command-runtime-HSsYGCQd.js";import{r as Ot,a as _t,p as Nt}from"../packem_shared/resolve-explicit-D9kdTNvl.js";import{s as jt}from"../packem_shared/min-release-age-JViyQuBM.js";import{s as Ut}from"../packem_shared/env-BSXG3QKH.js";import{r as Dt,s as Bt}from"../packem_shared/typosquats-BFKus_aM.js";import{U as Lt,V as Pt,C as Oe,e as Vt}from"../packem_shared/vis-update-app-Ba5ce8Jd.js";import{hasBackup as Mt,restoreFromBackup as Ft,hasCatalogs as Gt,readCatalogs as Ht,checkOutdated as qt,collectInternalOutdated as Wt,fetchChangelogInfo as Ye,formatSummary as Je,promptPackageSelection as Kt,toFilterArray as F,applyCatalogUpdates as zt,formatOutdatedJson as Yt,formatOutdatedMinimal as Jt,formatOutdatedTable as Xt}from"./catalog2.js";import{h as Xe,P as Qe}from"../packem_shared/peer-warnings-CmYSxvql.js";import{p as Ze}from"../packem_shared/utils-DQFHJn72.js";import{L as Qt}from"../packem_shared/index-BisalDCf.js";import{y as D}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{s as ne}from"../packem_shared/index-B4AjSxHU.js";import{r as tn,a as ge,q as nn}from"../packem_shared/advisories-BodWQ5DQ.js";import{U as sn}from"../packem_shared/writeFileSync-DJoHk3Ks-BPRoepNw.js";import{l as rn}from"../packem_shared/npmrc-CHsOyMvA.js";let yt;const $t=e=>(yt??=gt(import.meta.url))(e),ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,He=e=>{if(typeof ee<"u"&&ee.versions&&ee.versions.node){const[t,n]=ee.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return ee.getBuiltinModule(e)}return $t(e)},{createInterface:qe}=He("node:readline"),{existsSync:Zt,realpathSync:en}=He("node:fs"),on=e=>{const t=[];for(const n of e.filters)t.push("--filter",n);return e.workspaceRoot&&t.push("--filter","."),t.push("update"),e.latest&&t.push("--latest"),e.recursive&&t.push("--recursive"),e.interactive&&t.push("--interactive"),e.dev&&t.push("--dev"),e.prod&&t.push("--prod"),e.noOptional&&t.push("--no-optional"),e.noSave&&t.push("--no-save"),t.push(...e.packages),{args:t,bin:"pnpm"}},an=e=>{const t=[];return e.filters.length>0&&t.push("workspace",e.filters[0]),t.push("upgrade"),e.latest&&t.push("--latest"),t.push(...e.packages),{args:t,bin:"yarn"}},cn=e=>{const t=[];if(e.filters.length>0||e.recursive){t.push("workspaces","foreach","--all");for(const n of e.filters)t.push("--include",n)}return t.push("up"),e.interactive&&t.push("--interactive"),t.push(...e.packages),{args:t,bin:"yarn"}},ln=(e,t)=>{const n=["update"];e.latest&&t.push("npm does not support --latest flag. Packages will be updated within their semver range."),e.interactive&&t.push("npm does not support --interactive mode.");for(const s of e.filters)n.push("--workspace",s);return e.recursive&&n.push("--workspaces"),e.workspaceRoot&&n.push("--include-workspace-root"),e.dev&&n.push("--dev"),e.prod&&n.push("--production"),e.noOptional&&n.push("--no-optional"),e.noSave&&n.push("--no-save"),n.push(...e.packages),{args:n,bin:"npm"}},dn=e=>{const t=["update"];e.latest&&t.push("--latest");for(const n of e.filters)t.push("--filter",n);return t.push(...e.packages),{args:t,bin:"bun"}},un=(e,t,n)=>{const s=[];if(n.global&&e!=="aube")return{command:{args:["update","--global",...n.packages],bin:"npm"},warnings:s};let i;switch(e){case"aube":{const r=St(n);i={args:r.args,bin:r.bin},s.push(...r.warnings);break}case"bun":{i=dn(n);break}case"npm":{i=ln(n,s);break}case"pnpm":{i=on(n);break}case"yarn":{i=t.startsWith("1.")?an(n):cn(n);break}default:{const r=e;throw new Error(`Unsupported package manager: ${String(r)}`)}}return{command:i,warnings:s}},et=e=>{const t=e.indexOf("@");return t<=0?e:e.slice(0,t)},fn=e=>{switch(e){case"docker":case"docker-compose":return"docker";case"github-actions":return"actions";case"gitlab-ci":return"gitlab";default:return}},pn=(e,t)=>{const n=[".github/dependabot.yml",".github/dependabot.yaml"];for(const s of n){const i=L(e,s);if(!D(i))continue;let r;try{r=Qt(z(i))}catch{continue}if(r?.updates){for(const o of r.updates){const a=fn(o["package-ecosystem"]);if(!(!a||!Array.isArray(o.ignore)))for(const p of o.ignore){const c=p["dependency-name"];typeof c=="string"&&c.length>0&&t[a].add(et(c))}}return}}},mn=Object.freeze({"docker-compose":"docker",dockerfile:"docker","github-actions":"actions",gitlabci:"gitlab","gitlabci-include":"gitlab"}),hn=Object.freeze({docker:"docker","github-tags":"actions"}),ye=(e,t)=>{if(t)for(const n of t)typeof n=="string"&&n.length>0&&e.add(et(n))},gn=e=>{let t="",n=0;const{length:s}=e;let i=!1,r="";for(;n<s;){const o=e[n]??"";if(i){if(t+=o,o==="\\"&&n+1<s){t+=e[n+1]??"",n+=2;continue}o===r&&(i=!1),n+=1;continue}if(o==='"'||o==="'"){i=!0,r=o,t+=o,n+=1;continue}if(o==="/"&&e[n+1]==="/"){for(;n<s&&e[n]!==`
2
+ `;)n+=1;continue}if(o==="/"&&e[n+1]==="*"){for(n+=2;n<s&&!(e[n]==="*"&&e[n+1]==="/");)n+=1;n+=2;continue}if(o===","){let a=n+1;for(;a<s&&/\s/.test(e[a]??"");)a+=1;const p=e[a];if(p==="}"||p==="]"){n+=1;continue}}t+=o,n+=1}return t},yn=(e,t)=>{const n=["renovate.json","renovate.json5",".renovaterc",".renovaterc.json"];for(const s of n){const i=L(e,s);if(!D(i))continue;let r;try{const a=z(i);r=JSON.parse(gn(a))}catch{continue}if(!r)continue;if(Array.isArray(r.ignoreDeps))for(const a of["actions","docker","gitlab"])ye(t[a],r.ignoreDeps);const o=[["github-actions","actions"],["dockerfile","docker"],["docker-compose","docker"],["gitlabci","gitlab"],["gitlabci-include","gitlab"]];for(const[a,p]of o){const c=r[a];ye(t[p],c?.ignoreDeps)}if(!Array.isArray(r.packageRules))return;for(const a of r.packageRules){if(a.enabled!==!1)continue;const p=new Set;for(const d of a.matchManagers??[]){const f=mn[d];f&&p.add(f)}for(const d of a.matchDatasources??[]){const f=hn[d];f&&p.add(f)}p.size===0&&(p.add("actions"),p.add("docker"),p.add("gitlab"));const c=[...a.matchPackageNames??[],...a.matchDepNames??[],...a.matchPackagePatterns??[]];for(const d of p)ye(t[d],c)}return}},$n=e=>{const t={actions:new Set,docker:new Set,gitlab:new Set};return pn(e,t),yn(e,t),t},ve=(e,t,n)=>{const s=n[t];if(s.size===0)return!1;if(s.has(e))return!0;for(const i of s)if(/[*?[\]/.+]/.test(i))try{const r=i.replaceAll(/[.+^${}()|]/g,String.raw`\$&`).replaceAll("*",".*").replaceAll("?",".");if(new RegExp(`^${r}$`).test(e))return!0}catch{}return!1},q=e=>{const t=e.trim();if(t==="")return;const n=t.startsWith("v")||t.startsWith("V")?t.slice(1):t,i=(ne.valid(n)?ne.parse(n):void 0)??ne.coerce(n,{includePrerelease:!0});if(i)return{major:i.major,minor:i.minor,normalized:`${String(i.major)}.${String(i.minor)}.${String(i.patch)}${i.prerelease.length>0?`-${i.prerelease.join(".")}`:""}`,patch:i.patch,prerelease:i.prerelease.length>0,raw:t}},wn=(e,t)=>ne.rcompare(e.normalized,t.normalized),ke=(e,t,n,s)=>{if(!t&&n!=="latest")return;const i=e.filter(r=>r.prerelease?!1:t?n==="patch"&&(r.major!==t.major||r.minor!==t.minor)||n==="minor"&&r.major!==t.major?!1:ne.gt(r.normalized,t.normalized):!0);if(i.length!==0)return i.toSorted(wn)[0]},be=(e,t)=>!e||!t?"unknown":t.major!==e.major?"major":t.minor!==e.minor?"minor":t.patch!==e.patch?"patch":"unknown",vn="GitHub Actions",kn=e=>({fixedVersions:e.fixedVersions,id:e.id,severity:e.severity,summary:e.summary}),bn=(e,t)=>{if(t.length===0)return t;const n=tn(e);if(!Zt(n))return t;const s=new Map;for(const r of t){const o=r.currentVersion??r.currentRef;o&&s.set(ge(r.name,o),{name:r.name,version:o})}if(s.size===0)return t;const i=new Map;try{for(const[r,o]of s){const p=nn([o],{ecosystem:vn,workspaceRoot:e}).get(ge(o.name,o.version));p&&p.length>0&&i.set(r,p)}}catch{return t}return i.size===0?t:t.map(r=>{const o=r.currentVersion??r.currentRef;if(!o)return r;const a=i.get(ge(r.name,o));return a?{...r,advisories:a.map(p=>kn(p))}:r})},tt=e=>{if(!e)return{};const t={};for(const n of e.split(",")){const s=/^\s*<([^>]+)>\s*;\s*(.+)$/.exec(n);if(!s)continue;const i=s[1]??"",r=s[2]??"";switch(/rel\s*=\s*"?([^";\s]+)"?/i.exec(r)?.[1]?.toLowerCase()){case"first":{t.first=i;break}case"last":{t.last=i;break}case"next":{t.next=i;break}case"prev":case"previous":{t.previous=i;break}}}return t};class Rn{token;apiBase;fetchImpl;tagsCache=new Map;commitCache=new Map;constructor(t){this.token=t.token??process.env.GITHUB_TOKEN??process.env.GH_TOKEN,this.apiBase=t.apiBase??"https://api.github.com",this.fetchImpl=t.fetch??fetch}async listTags(t,n){const s=`${t}/${n}`,i=this.tagsCache.get(s);if(i)return i;const r=this.fetchTags(t,n);return this.tagsCache.set(s,r),r}async resolveRef(t,n,s){const i=`${t}/${n}@${s}`,r=this.commitCache.get(i);if(r)return r;const o=this.fetchCommit(t,n,s);return this.commitCache.set(i,o),o}buildHeaders(){const t={Accept:"application/vnd.github+json","User-Agent":"vis-update-actions","X-GitHub-Api-Version":"2022-11-28"};return this.token&&(t.Authorization=`Bearer ${this.token}`),t}async fetchTags(t,n){const s=`${this.apiBase}/repos/${encodeURIComponent(t)}/${encodeURIComponent(n)}/tags?per_page=100`,i={parsed:[],tags:[]},r=[];let o=s,a=0;for(;o&&a<5;){const c=o;let d;try{d=await this.fetchImpl(c,{headers:this.buildHeaders()})}catch{return i}if(!d.ok)return i;let f;try{f=await d.json()}catch{return i}if(!Array.isArray(f))return i;for(const m of f){const g=typeof m.name=="string"?m.name:"",h=typeof m.commit?.sha=="string"?m.commit.sha:"";g!==""&&h!==""&&r.push({name:g,sha:h})}o=tt(d.headers.get("link")).next,a+=1}const p=[];for(const c of r){const d=q(c.name);d&&p.push({...d,sha:c.sha})}return{parsed:p,tags:r}}async fetchCommit(t,n,s){const i=`${this.apiBase}/repos/${encodeURIComponent(t)}/${encodeURIComponent(n)}/commits/${encodeURIComponent(s)}`;try{const r=await this.fetchImpl(i,{headers:this.buildHeaders()});if(!r.ok)return;const o=await r.json();return typeof o.sha!="string"?void 0:{committedAt:o.commit?.committer?.date,sha:o.sha}}catch{return}}}const En=".github/workflows",xn=".github/actions",An=/^\s*-?\s*uses:\s*(['"]?)([^'"\s#]+)\1(?:\s*#\s*(.+))?\s*$/,Sn=/^[a-f0-9]{40}$/i,Cn=/actions-up-ignore-next-line(?::\s*(.+))?/i,Tn=/actions-up-ignore-start/i,In=/actions-up-ignore-end/i,On=e=>{const t=e.split("/");if(t.length<2)return;const[n,s,...i]=t;if(!(!n||!s))return{owner:n,repo:s,subpath:i.length>0?i.join("/"):void 0}},_n=(e,t)=>{const n=t.split(/\r?\n/),s=[];let i,r=!1;for(const[o,a]of n.entries()){const p=a??"";if(Tn.test(p)&&(r=!0),In.test(p)){r=!1;continue}const c=p.trim(),f=c===""||c.startsWith("#")?Cn.exec(p):void 0;if(f){i=f[1]??"actions-up-ignore-next-line";continue}const m=An.exec(p);if(!m){i=void 0;continue}const g=m[1]??"",h=g==="'"||g==='"'?g:"",b=m[2]??"",k=m[3]?.trim();if(b.startsWith("./")||b.startsWith("../")||b.startsWith("docker://")){i=void 0;continue}const y=b.lastIndexOf("@");if(y<=0){i=void 0;continue}const A=b.slice(0,y),v=b.slice(y+1),u=On(A);if(!u){i=void 0;continue}let $=i??(r?"actions-up-ignore-block":void 0);if(k){const l=/^actions-up-ignore(?:-next-line)?(?::\s*(.+))?(?:\s|$)/i.exec(k);l&&($=$??l[1]??"actions-up-ignore")}i=void 0,s.push({file:e,ignoreReason:$,isSha:Sn.test(v),line:o+1,original:`${h}${b}${h}`,owner:u.owner,quote:h,ref:v,repo:u.repo,slug:A,subpath:u.subpath,trailingComment:k&&!$?k:void 0})}return s},_e=e=>e.endsWith(".yml")||e.endsWith(".yaml"),Nn=(e,t=[])=>{const n=[],s=new Set,i=a=>{if(s.has(a))return;s.add(a);let p;try{p=z(a)}catch{return}const c=_n(a,p);n.push(...c)},r=L(e,En);if(D(r))for(const a of X(r,{includeDirs:!1,includeSymlinks:!1,maxDepth:1}))_e(a.name)&&i(a.path);const o=L(e,xn);if(D(o))for(const a of X(o,{includeDirs:!1,includeSymlinks:!1,maxDepth:3}))(a.name==="action.yml"||a.name==="action.yaml")&&i(a.path);for(const a of["action.yml","action.yaml"]){const p=L(e,a);D(p)&&i(p)}for(const a of t){const p=vt(a)?a:L(e,a);if(D(p))for(const c of X(p,{includeDirs:!1,includeSymlinks:!1}))_e(c.name)&&i(c.path)}return n},jn=40,Un=1440*60*1e3,Dn=new Set(["develop","edge","main","master","stable","trunk"]),Bn=e=>e.length===jn&&/^[a-f0-9]{40}$/i.test(e)?!1:Dn.has(e.toLowerCase())?!0:q(e)===void 0,Ne=(e,t)=>{for(const n of t)try{if(new RegExp(n).test(e))return!0}catch{if(e.includes(n))return!0}return!1},Ln=(e,t,n,s)=>{const i=s==="sha"||e.isSha,{quote:r}=e;return i?`${r}${e.slug}@${t}${r} # ${n}`:`${r}${e.slug}@${n}${r}`},Pn=async(e,t)=>{const{ignoreRules:n,options:s,references:i,resolverOptions:r}=t,o=[],a=[],p=[];if(i.length===0)return{failed:p,ignored:a,updates:o};const c=new Rn({apiBase:r?.apiBase,fetch:r?.fetch,token:s.githubToken??r?.token}),d=new Map;for(const y of i){const A=`${y.owner}/${y.repo}`,v=d.get(A)??[];v.push(y),d.set(A,v)}const f=Math.max(1,s.maxConcurrentRequests),m=[...d.keys()];let g=0;const h=async y=>{const A=d.get(y)??[],[v,u]=y.split("/");if(!v||!u)return;let $;try{$=await c.listTags(v,u)}catch{for(const l of A)p.push({file:l.file,reason:`failed to list tags for ${y}`});return}for(const l of A){const S=l.slug;let w;if(l.ignoreReason?w=l.ignoreReason:Ne(S,s.exclude)?w="matched --exclude":s.include.length>0&&!Ne(S,s.include)?w="not matched by --include":s.respectDependabotConfig&&n&&ve(S,"actions",n)&&(w="ignored by dependabot/renovate config"),w){a.push({currentRef:l.ref,currentVersion:l.isSha?l.trailingComment?.replace(/^#\s*/,""):l.ref,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:S,newRef:l.ref,newVersion:void 0,original:l.original,reason:w,replacement:l.original,updateType:"unknown"});continue}if(!s.includeBranches&&!l.isSha&&Bn(l.ref)){a.push({currentRef:l.ref,currentVersion:l.ref,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:S,newRef:l.ref,newVersion:void 0,original:l.original,reason:"branch reference (use --include-branches)",replacement:l.original,updateType:"unknown"});continue}const C=l.isSha?l.trailingComment?.replace(/^#\s*/,"").split(/\s+/)[0]??"":l.ref,T=q(C);if(l.isSha&&!T&&s.mode!=="latest"){a.push({currentRef:l.ref,currentVersion:void 0,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:S,newRef:l.ref,newVersion:void 0,original:l.original,reason:`SHA pin has no version-hint comment; cannot apply --target=${s.mode}`,replacement:l.original,updateType:"unknown"});continue}const E=ke($.parsed,T,s.mode);if(!E)continue;if(s.minAgeDays!==void 0){const P=await c.resolveRef(v,u,E.sha),N=P?.committedAt?new Date(P.committedAt).getTime():void 0;if(N&&(Date.now()-N)/Un<s.minAgeDays){a.push({currentRef:l.ref,currentVersion:T?.raw,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:S,newRef:l.ref,newVersion:E.raw,original:l.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:l.original,updateType:"unknown"});continue}}const I=s.style==="sha"||l.isSha?E.sha:E.raw,O=Ln(l,E.sha,E.raw,s.style);o.push({currentRef:l.ref,currentVersion:T?.raw??l.trailingComment?.replace(/^#\s*/,""),ecosystem:"actions",file:l.file,line:l.line,name:S,newRef:I,newVersion:E.raw,original:l.original,replacement:O,updateType:be(T,E),url:`https://github.com/${v}/${u}/releases/tag/${E.raw}`})}},b=[];for(let y=0;y<Math.min(f,m.length);y++)b.push((async()=>{for(;g<m.length;){const A=m[g];g+=1,A!==void 0&&await h(A)}})());await Promise.all(b);const k=bn(e,o);return{failed:p,ignored:a,updates:k}},Vn=e=>e.toSorted((t,n)=>t.file!==n.file?t.file<n.file?-1:1:t.line-n.line),nt=e=>{const t=[],n=[];if(e.length===0)return{applied:t,skipped:n};const s=Vn(e),i=new Map;for(const r of s){const o=i.get(r.file)??[];o.push(r),i.set(r.file,o)}for(const[r,o]of i){let a;try{a=z(r)}catch(m){for(const g of o)n.push({reason:`read failed: ${m.message}`,update:g});continue}const p=a.includes(`\r
3
+ `)?`\r
4
+ `:`
5
+ `,c=a.split(/\r?\n/),d=[];for(const m of o){const g=m.line-1,h=c[g];if(h===void 0){n.push({reason:`line ${String(m.line)} out of range`,update:m});continue}const b=h.indexOf(m.original);if(b===-1){n.push({reason:"original token not found on expected line",update:m});continue}const k=h.slice(0,b),y=h.slice(b+m.original.length),u=/#\s*v?\d/.test(m.replacement)&&/^\s*#\s*v?\d[\w.+-]*\s*$/i.test(y)?"":y;c[g]=`${k}${m.replacement}${u}`,d.push(m)}if(d.length===0)continue;const f=c.join(p);try{sn(r,f),t.push(...d)}catch(m){for(const g of d)n.push({reason:`write failed: ${m.message}`,update:g})}}return{applied:t,skipped:n}};class Mn{tokens;fetchImpl;tagCache=new Map;constructor(t={}){this.tokens=t.tokens??{},this.fetchImpl=t.fetch??fetch}async listTags(t,n,s){const i=`${t}/${n}/${s}`,r=this.tagCache.get(i);if(r)return r;const o=t==="docker.io"?this.listDockerHubTags(n,s):this.listV2Tags(t,n,s);return this.tagCache.set(i,o),o}async listDockerHubTags(t,n){const s={parsed:[],raw:[]},i=[],r=new Map;let o=`https://hub.docker.com/v2/repositories/${encodeURIComponent(t)}/${encodeURIComponent(n)}/tags?page_size=100`,a=0;for(;o&&a<5;){try{const c=await this.fetchImpl(o,{headers:{Accept:"application/json"}});if(!c.ok)break;const d=await c.json();if(Array.isArray(d.results)){for(const f of d.results)if(typeof f.name=="string"&&(i.push(f.name),typeof f.last_updated=="string")){const m=Date.parse(f.last_updated);Number.isNaN(m)||r.set(f.name,m)}}o=typeof d.next=="string"?d.next:void 0}catch{break}a+=1}return i.length===0?s:{parsed:i.map(c=>{const d=q(c);if(d)return{...d,lastUpdated:r.get(c)}}).filter(c=>c!==void 0),raw:i}}async listV2Tags(t,n,s){const i={parsed:[],raw:[]},r=n==="library"?s:`${n}/${s}`,o={Accept:"application/json"},a=this.tokens[t]??process.env[`DOCKER_REGISTRY_TOKEN_${t.toUpperCase().replaceAll(/[^A-Z0-9]/g,"_")}`];a&&(o.Authorization=`Bearer ${a}`);const p=`https://${t}`,c=[];let d=`${p}/v2/${r}/tags/list?n=100`,f=o,m=0;const g=()=>{const h=[];for(const b of c){const k=q(b);k&&h.push({...k,lastUpdated:void 0})}return{parsed:h,raw:c}};for(;d&&m<5;){try{let h=await this.fetchImpl(d,{headers:f});if(h.status===401&&f===o){const y=Gn(h.headers.get("www-authenticate"));if(y){const A=await this.fetchBearerToken(y);A&&(f={...o,Authorization:`Bearer ${A}`},h=await this.fetchImpl(d,{headers:f}))}}if(!h.ok)return m===0?i:g();const b=await h.json();if(!Array.isArray(b.tags))return m===0?i:g();for(const y of b.tags)typeof y=="string"&&c.push(y);const k=tt(h.headers.get("link"));d=k.next?new URL(k.next,p).toString():void 0}catch{return m===0?i:g()}m+=1}return c.length===0?i:g()}async fetchBearerToken(t){const n=new URLSearchParams({scope:t.scope,service:t.service}),s=`${t.realm}?${n.toString()}`;try{const i=await this.fetchImpl(s,{headers:{Accept:"application/json"}});if(!i.ok)return;const r=await i.json();return r.token??r.access_token}catch{return}}}const Fn=e=>{const t=[];let n=0;const{length:s}=e;for(;n<s;){for(;n<s&&/\s/.test(e[n]??"");)n+=1;const i=n;for(;n<s&&e[n]!=="="&&e[n]!==",";)n+=1;const r=e.slice(i,n).trim();if(e[n]!=="="){for(;n<s&&e[n]!==",";)n+=1;n+=1;continue}n+=1;let o="";if(e[n]==='"'){for(n+=1;n<s&&e[n]!=='"';){if(e[n]==="\\"&&n+1<s){o+=e[n+1]??"",n+=2;continue}o+=e[n]??"",n+=1}n+=1}else{for(;n<s&&e[n]!==",";)o+=e[n]??"",n+=1;o=o.trim()}for(r.length>0&&t.push({key:r,value:o});n<s&&(/\s/.test(e[n]??"")||e[n]===",");)n+=1}return t},Gn=e=>{if(!e)return;const t=/^Bearer\s+(.*)$/i.exec(e);if(!t)return;const n=new Map;for(const{key:r,value:o}of Fn(t[1]??""))n.set(r.toLowerCase(),o);const s=n.get("realm"),i=n.get("service");if(s)return{realm:s,scope:n.get("scope")??"",service:i??""}},Hn="docker.io",qn="sha256:",ae=e=>{const t=e.trim();if(t===""||t.startsWith("$")||t.includes("${")||t.includes("$("))return;let n=t,s;const i=n.indexOf(`@${qn}`);i!==-1&&(s=n.slice(i+1),n=n.slice(0,i));let r=Hn,o=n;const a=n.indexOf("/");if(a>0){const h=n.slice(0,a);(h==="localhost"||h.includes(".")||h.includes(":"))&&(r=h,o=n.slice(a+1))}let p="latest",c=o;const d=o.lastIndexOf(":");d!==-1&&!o.slice(d).includes("/")&&(p=o.slice(d+1),c=o.slice(0,d));let f="library",m=c;const g=c.indexOf("/");if(g!==-1&&(f=c.slice(0,g),m=c.slice(g+1)),m!=="")return{digest:s,name:m,namespace:f,original:t,registry:r,tag:p}},ce=/vis-update-ignore-next-line/i,st=/vis-update-ignore(?:\s|$|:)/i,rt=e=>{const t=e.trim();return t===""||t.startsWith("#")},Wn=/^\s*FROM\s+(?:--\S+\s+)*([^\s#]+)(?:\s[^#]*)?(#.*)?$/i,Kn=(e,t)=>{const n=t.split(/\r?\n/),s=[];let i=!1;for(const[r,o]of n.entries()){if(ce.test(o)&&rt(o)){i=!0;continue}const a=Wn.exec(o);if(!a){o.trim()!==""&&!o.trim().startsWith("#")&&(i=!1);continue}const p=a[1]??"";if(p==="scratch"){i=!1;continue}const c=a[2]?.trim();let d=i?"vis-update-ignore-next-line":void 0;c&&ce.test(c)?d=d??"vis-update-ignore-next-line":c&&st.test(c)&&(d=d??"vis-update-ignore");const f=ae(p);i=!1,f&&s.push({...f,file:e,ignoreReason:d,kind:"dockerfile",line:r+1})}return s},zn=/^\s*image:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,Yn=(e,t)=>{const n=t.split(/\r?\n/),s=[];let i=!1;for(const[r,o]of n.entries()){if(ce.test(o)&&rt(o)){i=!0;continue}const a=zn.exec(o);if(!a){o.trim()!==""&&!o.trim().startsWith("#")&&(i=!1);continue}const p=a[2]??"",c=a[3]?.trim();let d=i?"vis-update-ignore-next-line":void 0;c&&ce.test(c)?d=d??"vis-update-ignore-next-line":c&&st.test(c)&&(d=d??"vis-update-ignore");const f=ae(p);i=!1,f&&s.push({...f,file:e,ignoreReason:d,kind:"compose",line:r+1})}return s},je=e=>{const t=e.toLowerCase();return t==="dockerfile"||t.startsWith("dockerfile.")?!0:t.endsWith(".dockerfile")},Jn=e=>{const t=e.toLowerCase();return/^(?:docker-)?compose(?:\..+)?\.ya?ml$/.test(t)},Xn=new Set([".cache",".git",".nx",".pnpm-store",".turbo","build","dist","node_modules"]),Qn=/(?:^|\/)(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)(?:\/|$)/,Zn=e=>{const t=[];if(!D(e))return t;const n=new Set,s=(i,r)=>{let o;try{o=en.native(i)}catch{o=i}if(n.has(o))return;n.add(o);let a;try{a=z(i)}catch{return}t.push(...r==="dockerfile"?Kn(i,a):Yn(i,a))};for(const i of X(e,{includeDirs:!1,includeSymlinks:!1,skip:[Qn]})){const{name:r}=i;Xn.has(r)||(je(r)?s(i.path,"dockerfile"):Jn(r)&&s(i.path,"compose"))}for(const i of["Dockerfile","dockerfile","compose.yml","compose.yaml","docker-compose.yml","docker-compose.yaml"]){const r=L(e,i);D(r)&&s(r,je(i)?"dockerfile":"compose")}return t},es=864e5,Ue=(e,t)=>{for(const n of t)try{if(new RegExp(n).test(e))return!0}catch{if(e.includes(n))return!0}return!1},De=e=>{const t=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return e.registry==="docker.io"?t:`${e.registry}/${t}`},ts=e=>e.digest!==void 0&&e.digest.length>0,ns=e=>{if(e.registry==="docker.io")return`https://hub.docker.com/${e.namespace==="library"?`_/${e.name}`:`r/${e.namespace}/${e.name}`}/tags`;const t=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return`https://${e.registry}/${t}`},ss=(e,t)=>{const n=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return`${e.registry==="docker.io"?n:`${e.registry}/${n}`}:${t}`},it=async(e,t)=>{const{ignoreRules:n,options:s,references:i,registryOptions:r}=t,o=[],a=[],p=[];if(i.length===0)return{failed:p,ignored:a,updates:o};const c=new Mn({fetch:r?.fetch,tokens:r?.tokens}),d=new Map;for(const k of i){const y=`${k.registry}|${k.namespace}|${k.name}`,A=d.get(y)??[];A.push(k),d.set(y,A)}const f=Math.max(1,s.maxConcurrentRequests),m=[...d.keys()];let g=0;const h=async k=>{const y=d.get(k)??[],A=y[0];if(!A)return;let v;try{v=await c.listTags(A.registry,A.namespace,A.name)}catch{for(const u of y)p.push({file:u.file,reason:`failed to list tags for ${De(u)}`});return}for(const u of y){const $=De(u);let l;if(u.ignoreReason?l=u.ignoreReason:Ue($,s.exclude)?l="matched --exclude":s.include.length>0&&!Ue($,s.include)?l="not matched by --include":s.respectDependabotConfig&&n&&ve($,"docker",n)&&(l="ignored by dependabot/renovate config"),l){a.push({currentRef:u.tag,currentVersion:u.tag,ecosystem:"docker",file:u.file,ignored:!0,line:u.line,name:$,newRef:u.tag,newVersion:void 0,original:u.original,reason:l,replacement:u.original,updateType:"unknown"});continue}if(ts(u)){a.push({currentRef:u.tag,currentVersion:u.tag,ecosystem:"docker",file:u.file,ignored:!0,line:u.line,name:$,newRef:u.tag,newVersion:void 0,original:u.original,reason:"digest-pinned image (refresh the pin manually to update)",replacement:u.original,updateType:"digest"});continue}const S=q(u.tag);if(!S&&!s.includeBranches){a.push({currentRef:u.tag,currentVersion:u.tag,ecosystem:"docker",file:u.file,ignored:!0,line:u.line,name:$,newRef:u.tag,newVersion:void 0,original:u.original,reason:"non-semver tag (use --include-branches)",replacement:u.original,updateType:"unknown"});continue}if(!S&&s.mode!=="latest"){a.push({currentRef:u.tag,currentVersion:u.tag,ecosystem:"docker",file:u.file,ignored:!0,line:u.line,name:$,newRef:u.tag,newVersion:void 0,original:u.original,reason:`branch ref has no version baseline for --target=${s.mode}`,replacement:u.original,updateType:"unknown"});continue}const w=ke(v.parsed,S,s.mode);if(!w)continue;if(s.minAgeDays!==void 0&&w.lastUpdated!==void 0&&(Date.now()-w.lastUpdated)/es<s.minAgeDays){a.push({currentRef:u.tag,currentVersion:u.tag,ecosystem:"docker",file:u.file,ignored:!0,line:u.line,name:$,newRef:w.raw,newVersion:w.raw,original:u.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:u.original,updateType:"unknown"});continue}const C=w.raw,T=ss(u,C);o.push({currentRef:u.tag,currentVersion:u.tag,ecosystem:"docker",file:u.file,line:u.line,name:$,newRef:C,newVersion:C,original:u.original,replacement:T,updateType:be(S,w),url:ns(u)})}},b=[];for(let k=0;k<Math.min(f,m.length);k++)b.push((async()=>{for(;g<m.length;){const y=m[g];g+=1,y!==void 0&&await h(y)}})());return await Promise.all(b),{failed:p,ignored:a,updates:o}};class rs{token;tokenHeader;defaultApiBase;fetchImpl;tagCache=new Map;constructor(t){const n=t.token??process.env.GITLAB_TOKEN;n?(this.token=n,this.tokenHeader="PRIVATE-TOKEN"):process.env.CI_JOB_TOKEN?(this.token=process.env.CI_JOB_TOKEN,this.tokenHeader="JOB-TOKEN"):(this.token=void 0,this.tokenHeader="PRIVATE-TOKEN"),this.defaultApiBase=t.apiBase??"https://gitlab.com",this.fetchImpl=t.fetch??fetch}async listTags(t){const n=this.tagCache.get(t);if(n)return n;const s=this.fetchTags(t);return this.tagCache.set(t,s),s}resolveHostAndPath(t){const n=t.indexOf("/");if(n>0){const s=t.slice(0,n);if(s.includes("."))return{host:`https://${s}`,path:t.slice(n+1)}}return{host:this.defaultApiBase,path:t}}async fetchTags(t){const{host:n,path:s}=this.resolveHostAndPath(t),i=encodeURIComponent(s),r=`${n}/api/v4/projects/${i}/repository/tags?per_page=100`,o={Accept:"application/json","User-Agent":"vis-update-gitlab"};this.token&&(o[this.tokenHeader]=this.token);try{const a=await this.fetchImpl(r,{headers:o});if(!a.ok)return{error:`HTTP ${String(a.status)} from ${n}`,parsed:[],tags:[]};const p=await a.json();if(!Array.isArray(p))return{error:`unexpected response shape from ${n}`,parsed:[],tags:[]};const c=p.map(f=>({name:typeof f.name=="string"?f.name:"",sha:typeof f.commit?.id=="string"?f.commit.id:""})).filter(f=>f.name!==""),d=[];for(const f of c){const m=q(f.name);m&&d.push({...m,sha:f.sha})}return{parsed:d,tags:c}}catch(a){return{error:a instanceof Error?a.message:"fetch failed",parsed:[],tags:[]}}}}const is=/vis-update-ignore-next-line/i,te=/vis-update-ignore(?:\s|$|:)/i,os=new Set([".gitlab-ci.yaml",".gitlab-ci.yml"]),as=e=>os.has(e)||e.endsWith(".gitlab-ci.yml")||e.endsWith(".gitlab-ci.yaml"),cs=/^\s*-?\s*project:\s*(['"]?)([^'"\s#]+)\1(?:\s*#.*)?$/,ls=/^\s*ref:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,ds=/^\s*-?\s*component:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,us=/^\s*image:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,fs=/^\s*(?:-\s*)?(?:include:\s*)?\{([^}]*)\}\s*(?:#.*)?$/,ps=/project:\s*(['"]?)([^'"\s,}]+)\1/,ms=/ref:\s*(['"]?)([^'"\s,}]+)\1/,hs=/component:\s*(['"]?)([^'"\s,}]+)\1/,gs=/^(\s*-\s*name:\s*)(['"]?)([^'"\s#]+)\2(\s*#.*)?$/,ys=/^(\s*-\s*)(['"]?)([^'"\s#:]+:[^'"\s#]+)\2(\s*#.*)?$/,$s=/^\s*-?\s*[a-z_][\w-]*:\s*(?:#.*)?$/i,ws=(e,t)=>{const n=t.split(/\r?\n/),s=[],i=[];let r,o=!1,a=!1,p=-1;for(const[c,d]of n.entries()){const f=d??"",m=f.trim(),g=m===""||m.startsWith("#");if(is.test(f)&&g){o=!0;continue}const h=/^(\s*)services:\s*(?:#.*)?$/.exec(f);if(h){a=!0,p=h[1]?.length??0;continue}a&&m!==""&&!m.startsWith("-")&&!m.startsWith("#")&&f.search(/\S/)<=p&&(a=!1,p=-1);const b=us.exec(f);if(b){const u=b[2]??"",$=ae(u);if($){const l=b[3]?.trim();let S=o?"vis-update-ignore-next-line":void 0;l&&te.test(l)&&(S=S??"vis-update-ignore"),i.push({...$,file:e,ignoreReason:S,kind:"compose",line:c+1})}o=!1;continue}if(a){const u=gs.exec(f),$=u?void 0:ys.exec(f),l=u??$;if(l){const S=l[3]??"",w=ae(S);if(w){const C=l[4]?.trim();let T=o?"vis-update-ignore-next-line":void 0;C&&te.test(C)&&(T=T??"vis-update-ignore"),i.push({...w,file:e,ignoreReason:T,kind:"compose",line:c+1})}}}const k=cs.exec(f);if(k){r={line:c+1,project:k[2]??""};continue}const y=ls.exec(f);if(y&&r){const u=y[3]?.trim();let $=o?"vis-update-ignore-next-line":void 0;u&&te.test(u)&&($=$??"vis-update-ignore"),s.push({file:e,ignoreReason:$,kind:"project",line:c+1,original:y[2]??"",project:r.project,ref:y[2]??""}),r=void 0,o=!1;continue}const A=ds.exec(f);if(A){const u=A[2]??"",$=u.lastIndexOf("@");if($>0){const l=u.slice(0,$),S=u.slice($+1),w=l.lastIndexOf("/"),C=w>0?l.slice(0,w):l,T=w>0?l.slice(w+1):void 0,E=A[3]?.trim();let I=o?"vis-update-ignore-next-line":void 0;E&&te.test(E)&&(I=I??"vis-update-ignore"),s.push({componentName:T,file:e,ignoreReason:I,kind:"component",line:c+1,original:u,project:C,ref:S})}o=!1;continue}const v=fs.exec(f);if(v){const u=v[1]??"",$=/#(.*)$/.exec(f)?.[1]?.trim();let l=o?"vis-update-ignore-next-line":void 0;$&&te.test($)&&(l=l??"vis-update-ignore");const S=hs.exec(u);if(S){const w=S[2]??"",C=w.lastIndexOf("@");if(C>0){const T=w.slice(0,C),E=w.slice(C+1),I=T.lastIndexOf("/"),O=I>0?T.slice(0,I):T,P=I>0?T.slice(I+1):void 0;s.push({componentName:P,file:e,ignoreReason:l,kind:"component",line:c+1,original:w,project:O,ref:E})}}else{const w=ps.exec(u),C=ms.exec(u);w&&C&&s.push({file:e,ignoreReason:l,kind:"project",line:c+1,original:C[2]??"",project:w[2]??"",ref:C[2]??""})}o=!1;continue}m!==""&&!m.startsWith("#")&&!$s.test(f)&&(o=!1)}return{images:i,includes:s}},Be=/^(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)$/,vs=e=>{const t=[],n=[];if(!D(e))return{images:n,includes:t};const s=r=>{let o;try{o=z(r)}catch{return}const{images:a,includes:p}=ws(r,o);t.push(...p),n.push(...a)};for(const r of[".gitlab-ci.yml",".gitlab-ci.yaml"]){const o=L(e,r);D(o)&&s(o)}const i=L(e,".gitlab");if(D(i))for(const r of X(i,{includeDirs:!1,includeSymlinks:!1,skip:[Be]}))(r.name.endsWith(".yml")||r.name.endsWith(".yaml"))&&s(r.path);for(const r of X(e,{includeDirs:!1,includeSymlinks:!1,maxDepth:2,skip:[Be]}))as(r.name)&&!n.some(o=>o.file===r.path)&&!t.some(o=>o.file===r.path)&&s(r.path);return{images:n,includes:t}},Le=(e,t)=>{for(const n of t)try{if(new RegExp(n).test(e))return!0}catch{if(e.includes(n))return!0}return!1},ks=(e,t,n)=>{const s=e.indexOf("/");return s>0&&e.slice(0,s).includes(".")?`https://${e.slice(0,s)}/${e.slice(s+1)}/-/releases/${t}`:`${n}/${e}/-/releases/${t}`},bs=async(e,t)=>{const{ignoreRules:n,imageReferences:s,includes:i,options:r,registryOptions:o,resolverOptions:a}=t,p=[],c=[],d=[];if(s.length>0){const v=await it(e,{ignoreRules:n,options:r,references:s,registryOptions:o});for(const u of v.updates)p.push({...u,ecosystem:"gitlab"});for(const u of v.ignored)c.push({...u,ecosystem:"gitlab"});d.push(...v.failed)}if(i.length===0)return{failed:d,ignored:c,updates:p};const f=new rs({apiBase:a?.apiBase,fetch:a?.fetch,token:r.gitlabToken??a?.token}),m=a?.apiBase??"https://gitlab.com",g=new Map;for(const v of i){const u=g.get(v.project)??[];u.push(v),g.set(v.project,u)}const h=Math.max(1,r.maxConcurrentRequests),b=[...g.keys()];let k=0;const y=async v=>{const u=g.get(v)??[];let $;try{$=await f.listTags(v)}catch{for(const l of u)d.push({file:l.file,reason:`failed to list tags for ${v}`});return}if($.error){for(const l of u)d.push({file:l.file,reason:`failed to list tags for ${v}: ${$.error}`});return}for(const l of u){const S=l.kind==="component"&&l.componentName?`${l.project}/${l.componentName}`:l.project;let w;l.ignoreReason?w=l.ignoreReason:Le(S,r.exclude)?w="matched --exclude":r.include.length>0&&!Le(S,r.include)?w="not matched by --include":r.respectDependabotConfig&&n&&ve(S,"gitlab",n)&&(w="ignored by dependabot/renovate config");const C=O=>({currentRef:l.ref,currentVersion:l.ref,ecosystem:"gitlab",file:l.file,ignored:!0,line:l.line,name:S,newRef:l.ref,newVersion:void 0,original:l.original,reason:O,replacement:l.original,updateType:"unknown"});if(w){c.push(C(w));continue}const T=q(l.ref);if(!T&&!r.includeBranches){c.push(C("branch reference (use --include-branches)"));continue}if(!T&&r.mode!=="latest"){c.push(C(`branch ref has no version baseline for --target=${r.mode}`));continue}const E=ke($.parsed,T,r.mode);if(!E)continue;let I;l.kind==="component"?I=`${l.componentName?`${l.project}/${l.componentName}`:l.project}@${E.raw}`:I=E.raw,p.push({currentRef:l.ref,currentVersion:T?.raw??l.ref,ecosystem:"gitlab",file:l.file,line:l.line,name:S,newRef:E.raw,newVersion:E.raw,original:l.original,replacement:I,updateType:be(T,E),url:ks(l.project,E.raw,m)})}},A=[];for(let v=0;v<Math.min(h,b.length);v++)A.push((async()=>{for(;k<b.length;){const u=b[k];k+=1,u!==void 0&&await y(u)}})());return await Promise.all(A),{failed:d,ignored:c,updates:p}},Rs={disabled:new Set,exclude:[],githubToken:void 0,gitlabToken:void 0,include:[],includeBranches:!1,maxConcurrentRequests:8,minAgeDays:void 0,mode:"latest",respectDependabotConfig:!0,style:"sha"},ot=async e=>{const t={...Rs,...e.options,disabled:e.options?.disabled??new Set},n=t.respectDependabotConfig?$n(e.workspaceRoot):void 0,s={actions:{failed:[],ignored:[],updates:[]},docker:{failed:[],ignored:[],updates:[]},gitlab:{failed:[],ignored:[],updates:[]}},i=[];let r=0;if(!t.disabled.has("actions")){const c=Nn(e.workspaceRoot);c.length>0&&(r+=1,i.push(Pn(e.workspaceRoot,{ignoreRules:n,options:t,references:c}).then(d=>{s.actions=d})))}if(!t.disabled.has("docker")){const c=Zn(e.workspaceRoot);c.length>0&&(r+=1,i.push(it(e.workspaceRoot,{ignoreRules:n,options:t,references:c}).then(d=>{s.docker=d})))}if(!t.disabled.has("gitlab")){const{images:c,includes:d}=vs(e.workspaceRoot);c.length+d.length>0&&(r+=1,i.push(bs(e.workspaceRoot,{ignoreRules:n,imageReferences:c,includes:d,options:t}).then(f=>{s.gitlab=f})))}await Promise.all(i);const o=[...s.actions.updates,...s.docker.updates,...s.gitlab.updates],a=[...s.actions.ignored,...s.docker.ignored,...s.gitlab.ignored];return{failed:[...s.actions.failed,...s.docker.failed,...s.gitlab.failed],ignored:a,perEcosystem:s,scanned:r,updates:o}},Es={actions:"GitHub Actions",docker:"Docker",gitlab:"GitLab CI"},$e=e=>e.updateType==="major",xs=e=>{switch(e){case"major":return K;case"minor":return _;case"patch":return We;default:return Ke}},Pe=e=>{const t=xs(e.updateType),n=e.currentVersion??e.currentRef,s=e.newVersion??e.newRef,i=e.url?` ${M(e.url)}`:"",r=e.advisories&&e.advisories.length>0?` ${K(`⚠ ${String(e.advisories.length)} advisor${e.advisories.length===1?"y":"ies"}`)}`:"";return` ${t(e.updateType.padEnd(7))} ${e.name} ${M(n)} → ${s}${r}${i}`},Ve=e=>!e.advisories||e.advisories.length===0?[]:e.advisories.map(t=>` ${t.severity==="CRITICAL"||t.severity==="HIGH"?K(t.severity):_(t.severity)} ${t.id} ${M(t.summary)}`),As=(e,t)=>{const n=[],s=e.updates.length;if(s===0&&e.scanned===0)return"";if(s===0){if(e.failed.length===0&&e.ignored.length===0)return n.push(`${We("✓")} All ecosystem references up to date.`),n.join(`
6
+ `);if(n.push(`${_("⚠")} No actionable updates found.`),e.failed.length>0){n.push(`
7
+ ${_("Failed lookups:")}`);for(const r of e.failed)n.push(` ${r.file}: ${r.reason}`)}if(t.showIgnored&&e.ignored.length>0){n.push(`
8
+ ${M("Ignored:")}`);for(const r of e.ignored)n.push(` ${M(r.name)} ${M(r.reason??"")}`)}return n.join(`
9
+ `)}n.push(`
10
+ ${Ke("Ecosystem updates")} — ${String(s)} reference${s===1?"":"s"} can be bumped:`);const i=e.updates.filter(r=>$e(r));if(i.length>0){n.push(`
11
+ ${K(wt(`⚠ Breaking changes (${String(i.length)})`))}`),n.push(` ${M("Review release notes before applying — these cross a major-version boundary.")}`);for(const r of i)n.push(Pe(r)),n.push(...Ve(r))}for(const r of Object.keys(e.perEcosystem)){const o=e.perEcosystem[r];if(o.updates.length!==0){n.push(`
12
+ ${Es[r]} (${String(o.updates.length)})`);for(const a of o.updates)n.push(Pe(a)),n.push(...Ve(a))}}if(t.showIgnored&&e.ignored.length>0){n.push(`
13
+ ${M("Ignored:")}`);for(const r of e.ignored)n.push(` ${M(r.name)} ${M(r.reason??"")}`)}if(e.failed.length>0){n.push(`
14
+ ${_("Failed lookups:")}`);for(const r of e.failed)n.push(` ${r.file}: ${r.reason}`)}return t.previewOnly&&n.push(`
15
+ ${_("ℹ")} ${M("Not applied automatically — re-run with `--interactive` to choose which to apply, or `--yes` to apply all.")}`),n.join(`
16
+ `)},Ss=e=>JSON.stringify({ecosystems:{failed:e.failed,ignored:e.ignored,perEcosystem:e.perEcosystem,scanned:e.scanned,updates:e.updates}},void 0,2),Cs=()=>{const e=qe({input:process.stdin,output:process.stdout});return{ask:t=>new Promise(n=>{e.question(t,s=>{n(s.trim())})}),close:()=>{e.close()},write:t=>{process.stdout.write(`${t}
17
+ `)}}},Ts=(e,t)=>e.split(",").map(n=>Number.parseInt(n.trim(),10)-1).filter(n=>Number.isInteger(n)&&n>=0&&n<t),Is=async(e,t=Cs())=>{if(e.length===0)return t.close(),[];t.write(""),t.write("Outdated ecosystem references:");for(const[i,r]of e.entries()){const o=r.currentVersion??r.currentRef,a=r.newVersion??r.newRef,p=$e(r)?" [BREAKING]":"";t.write(` ${String(i+1)}. [${r.ecosystem}] ${r.name}: ${o} → ${a} (${r.updateType})${p}`)}t.write("");const s=(await t.ask("Apply updates? [a]ll / [s]afe / [n]one / numbers: ")).toLowerCase();if(s==="a"||s==="all")return t.close(),e;if(s==="s"||s==="safe")return t.close(),e.filter(i=>!$e(i));if(s==="n"||s==="none"||s==="")return t.close(),[];if(/^[\d ,]+$/.test(s)){const i=Ts(s,e.length);return t.close(),i.map(r=>e[r]).filter(r=>r!==void 0)}return t.close(),[]},at=e=>{const t=e.trim();if(t==="")return;const n=/^(\d+(?:\.\d+)?)\s*([mhdw])?$/i.exec(t);if(!n)return;const s=Number.parseFloat(n[1]);if(!(!Number.isFinite(s)||s<0))switch((n[2]??"m").toLowerCase()){case"d":return s*60*24;case"h":return s*60;case"m":return s;case"w":return s*60*24*7;default:return}},Os=e=>{const t=e.trim();return/^\d+(?:\.\d+)?$/.test(t)?Number.parseFloat(t)*1440:at(t)},hr=e=>!Number.isFinite(e)||e<=0?"0m":e%1440===0?`${String(e/1440)}d`:e%60===0?`${String(e/60)}h`:`${String(e)}m`,Re=(e,t)=>{try{switch(t){case"bun":{const n=L(e,"bunfig.toml");if(D(n)){const s=kt(n),i=s?.install?.minimumReleaseAge;return{excludes:Array.isArray(s?.install?.minimumReleaseAgeExcludes)?s.install.minimumReleaseAgeExcludes:void 0,minutes:typeof i=="number"?Math.round(i/60):void 0}}break}case"npm":{const n=L(e,".npmrc");if(D(n)){const s=z(n),i=/^\s*min-release-age\s*=\s*([^\s#;]+)/m.exec(s);return{minutes:i?Os(i[1]):void 0}}break}case"pnpm":{const n=L(e,"pnpm-workspace.yaml");if(D(n)){const s=Ce(n);return{excludes:Array.isArray(s?.minimumReleaseAgeExclude)?s.minimumReleaseAgeExclude:void 0,minutes:typeof s?.minimumReleaseAge=="number"?s.minimumReleaseAge:void 0}}break}case"yarn":{const n=L(e,".yarnrc.yml");if(D(n)){const s=Ce(n),i=s?.npmMinimalAgeGate,r=Array.isArray(s?.npmPreapprovedPackages)?s.npmPreapprovedPackages:void 0;if(typeof i=="string")return{excludes:r,minutes:at(i)};if(typeof i=="number")return{excludes:r,minutes:i}}break}default:break}}catch{}return{}},_s={bun:"minimumReleaseAgeExcludes",pnpm:"minimumReleaseAgeExclude",yarn:"npmPreapprovedPackages"},ct={bun:"bunfig.toml minimumReleaseAgeExcludes",npm:".npmrc",pnpm:"pnpm-workspace.yaml minimumReleaseAgeExclude",yarn:".yarnrc.yml npmPreapprovedPackages"},lt=(e,t,n)=>{const s=Re(t,e);if(typeof s.minutes!="number"||s.minutes<=0)return{added:[],unsupported:!1};if(!(e in _s))return{added:[],unsupported:!0};const i=s.excludes??[],r=[...new Set(n)].filter(o=>!i.includes(o));return r.length===0?{added:[],unsupported:!1}:(jt(e,t,s.minutes,[...i,...r]),{added:r,unsupported:!1})},dt=(e,t,n)=>{n.added.length>0?e.info(`Added ${String(n.added.length)} package${n.added.length===1?"":"s"} to ${ct[t]??"the package manager config"} so --ignore-release-age versions install: ${n.added.join(", ")}`):n.unsupported&&e.warn(`${_("⚠")} npm has no per-package release-age exclude list, so vis can't exempt just the selected packages. Lower min-release-age in .npmrc or pass --min-release-age=0 to the install.`)},Ns=(e,t,n)=>{const s=e.latest?"latest":e.target??t.target??"latest";if(!["latest","minor","patch"].includes(s))throw new Error(`Invalid target "${s}". Use: latest, minor, or patch.`);const i=e.maxConcurrentRequests,r=typeof i=="number"&&i>0?i:t.maxConcurrentRequests,o=typeof e.releaseChannel=="string"?e.releaseChannel.toLowerCase():void 0;if(o!==void 0&&!["any","same","stable"].includes(o))throw new Error(`Invalid --release-channel "${String(e.releaseChannel)}". Use: any, same, or stable.`);const a=o??t.releaseChannel;return{exclude:[...F(e.exclude),...F(t.exclude)],ignore:F(t.ignore),include:[...F(e.include),...F(t.include),...n],includeLocked:e.includeLocked||t.includeLocked||!1,includePrerelease:e.prerelease||t.prerelease||!1,maxConcurrentRequests:r,minimumReleaseAge:t.minimumReleaseAge,minimumReleaseAgeExclude:t.minimumReleaseAgeExclude,packageMode:t.packageMode,releaseChannel:a,security:e.security===!1?!1:e.ai||(t.security??!0),target:s}},Me=(e,t)=>{if(e.length!==0){t.info(`
18
+ ${_("⚠")} ${String(e.length)} package${e.length===1?"":"s"} skipped by target constraint (use --target latest to include):`);for(const n of e)t.info(` ${n.packageName} ${n.currentRange} → ${n.newRange} (${n.updateType})`)}},Fe=(e,t,n,s,i)=>{n==="json"?process.stdout.write(`${Yt({checkedCount:0,failed:t,filteredByTarget:[],ignored:[],outdated:e})}
19
+ `):n==="minimal"?process.stdout.write(`${Jt(e)}
20
+ `):(Xt(e,s),s.info(Je(e,i)))},Ge=async(e,t,n,s,i,r,o)=>{const a=zt(e,n,t,!0,{useEditorconfig:o}),p=t==="pnpm"?"pnpm-workspace.yaml":"package.json";if(i.info(`
21
+ Updated ${p}`),a&&i.info(`Backup saved to ${a}`),s.changelog){i.info(`
22
+ Fetching changelogs...`);const c=await Ye(n,void 0,r);for(const d of c){const f=d.releaseUrl??d.repoUrl??d.npmUrl;i.info(` ${d.packageName}: ${f}`)}}if(s["ignore-release-age"]===!0&&n.length>0&&dt(i,t,lt(t,e,n.map(c=>c.packageName))),s.install??!0){const c=t,d=["install"];i.info(`Running ${c} ${d.join(" ")}...
23
+ `);try{const{code:f,output:m}=await ze(c,d,{cwd:e,env:process.env});f!==0?i.warn(`${c} ${d.join(" ")} failed. You may need to run it manually.`):s.peer!==!0&&Xe(m)&&i.info(Qe)}catch{i.warn(`${c} ${d.join(" ")} failed. You may need to run it manually.`)}}},we={applied:!1,canceled:!1,jsonEmitted:!1},js={actions:"GitHub Actions",docker:"Docker",gitlab:"GitLab CI"},Us={digest:"patch",major:"major",minor:"minor",patch:"patch",pin:"patch",unknown:"patch"},Ds=e=>({catalogName:js[e.ecosystem],currentRange:e.currentVersion??e.currentRef,detailUrl:e.url,displayName:e.name,kind:"ecosystem",newRange:e.newVersion??e.newRef,packageName:Vt(e),targetVersion:e.newVersion??e.newRef,updateType:Us[e.updateType]??"patch"}),Bs=async(e,t,n,s,i,r)=>{const o=n.update??{},a=[["global","--global is not supported in catalog mode"],["recursive","--recursive is not needed in catalog mode (catalogs are workspace-level)"],["filter","--filter is not supported in catalog mode (use --include/--exclude instead)"],["no-save","--no-save is not supported in catalog mode"],["workspace-root","--workspace-root is not needed in catalog mode"],["no-optional","--no-optional is not supported in catalog mode"]];for(const[x,j]of a)s[x]&&r.warn(`${_("⚠")} ${j}, ignoring.`);const p=s["ignore-release-age"]===!0,c=me("minReleaseAge")||p,{excludes:d,minutes:f}=c?{excludes:void 0,minutes:void 0}:Re(e,t),m=c?void 0:o.minimumReleaseAge??f,g=c?void 0:o.minimumReleaseAgeExclude??d;if(p?r.info(`${_("⚠")} --ignore-release-age: selecting the latest versions regardless of minimumReleaseAge.`):c&&(o.minimumReleaseAge!==void 0||f!==void 0)&&r.info("minimumReleaseAge gate disabled via MARSHALL_DISABLE_MIN_RELEASE_AGE."),!c&&o.minimumReleaseAge!==void 0&&f!==void 0&&o.minimumReleaseAge!==f){const x=t==="pnpm"?"pnpm-workspace.yaml":"bunfig.toml";r.warn(`${_("⚠")} minimumReleaseAge mismatch: vis config = ${String(o.minimumReleaseAge)} min, ${x} = ${String(f)} min. Consider keeping them in sync.`)}const h=rn(e),b=s["include-internal"],k=s.peer,y=Ht(e,t,{depFields:o.depFields,dev:s.dev,includeInternal:b,peer:k,prod:s.prod});if(y.size===0)return r.info("No catalogs found."),we;const A={...o,minimumReleaseAge:m,minimumReleaseAgeExclude:g},v=Ns(s,A,i);let u=0;for(const x of y.values())u+=x.size;const $=!!process.stdout.isTTY&&!le;let l;const S=$?(x,j)=>{l?l.rerender(V.createElement(Oe,{current:x,total:j})):(process.stdout.write(`
24
+ `),l=Te(V.createElement(Oe,{current:x,total:j}),{interactive:!0,patchConsole:!1}))}:(x,j)=>{r.info(`Checking ${String(x)}/${String(j)} dependencies...`)};$||r.info(`Checking ${String(u)} catalog dependencies...
25
+ `);const w=new Set;me("socket")&&w.add("socket"),me("depsDev")&&w.add("deps-dev");const C=n.security?.policies?.score?.minimum,T=Et(n.security,{disabled:w,minimumScore:C}),{checkedCount:E,failed:I,filteredByTarget:O,ignored:P,outdated:N}=await qt(y,v,h,S,e,T,n.security?.acceptedRisks);l&&(l.clear(),l.unmount());const Q=b?{ignored:[],outdated:[]}:Wt(e,{depFields:o.depFields,dev:s.dev,exclude:v.exclude,ignore:v.ignore,include:v.include,packageMode:v.packageMode,peer:k,prod:s.prod,target:v.target});if(Q.outdated.length>0){const x=new Set(N.map(j=>`${j.catalogName}|${j.packageName}`));for(const j of Q.outdated)x.has(`${j.catalogName}|${j.packageName}`)||N.push(j)}if(Q.ignored.length>0)for(const x of Q.ignored)P.includes(x)||P.push(x);const Ee=E-N.length-I.length;if(I.length>0&&r.warn(`Failed to fetch: ${I.join(", ")}`),P.length>0&&r.info(`Skipped ${String(P.length)} ignored package${P.length===1?"":"s"}: ${P.join(", ")}`),!$&&E>N.length){const x=[...y.values()].reduce((Y,de)=>Y+de.size,0),j=x>E?` (${String(x)} catalog entries, ${String(x-E)} duplicates)`:"";r.info(`Checked ${String(E)} unique packages${j}: ${String(N.length)} outdated, ${String(Ee)} up-to-date${I.length>0?`, ${String(I.length)} failed`:""}${O.length>0?`, ${String(O.length)} skipped by target`:""}`)}if(N.length===0)return O.length>0?r.info(`All catalog dependencies are up to date within the current target.
26
+ ${String(O.length)} package${O.length===1?" has":"s have"} newer versions available with --target latest:
27
+ ${O.map(x=>` ${x.packageName} ${x.currentRange} → ${x.newRange} (${x.updateType})`).join(`
28
+ `)}`):r.info("All catalog dependencies are up to date."),we;const W=s.format??o.format??"table";let G;if(s.ai){const x=xt(s.aiType??"impact");G=await At(N,r,n.ai,x)}const se=!!s.dryRun;if(!se&&i.length>0&&s.marshallCheck!==!1){const x=await Ot(i);if(x.length>0){const j=await _t(x,{config:n?.security?.marshalls,workspaceRoot:e});if(!await Nt(j))return process.exitCode=1,{applied:!1,canceled:!0,jsonEmitted:!1}}}if($&&W==="table"){const x=new Map,j=[];let Y=!1;if(i.length===0){const R=ut(s,n);if(R.disabled.size<3)try{const U=await ot({options:R,workspaceRoot:e});Y=U.scanned>0;for(const B of U.updates){const J=Ds(B);x.set(J.packageName,B),j.push(J)}}catch(U){r.warn(`${_("⚠")} Ecosystem update scan failed: ${U.message}`)}}const de=new Lt([...N,...j],G??null);let ue;if(s.changelog){r.info("Fetching changelogs...");const R=await Ye(N,void 0,h);ue=new Map;for(const U of R){const B=U.releaseUrl??U.repoUrl??U.npmUrl;B&&ue.set(U.packageName,B)}}const fe=n.tui?.autoExit??!1,pt=fe===!0?3:typeof fe=="number"?fe:0,xe=await Te(V.createElement(Pt,{autoExitSeconds:pt,changelogUrls:ue,checkedCount:E,filteredOutEntries:O,isDryRun:se,store:de,totalCatalogEntries:u}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),pe=process.stdout.columns||80;process.stdout.write(`
29
+ `);for(const R of N){const U=R.vulnerabilities?.length||R.socketReport&&R.socketReport.alerts.length>0,B=!!R.acceptedRisk,J=U?B?"✓":"⚠":"✓",mt=B?"gray":R.updateType==="major"?"red":R.updateType==="minor"?"yellow":"green",oe=R.socketReport?.score.overall,ht=oe===void 0?"":` [${String(Math.round(oe*100))}%]`,Se=oe===void 0?void 0:Ut(oe);process.stdout.write(`${he(V.createElement(H,null," ",V.createElement(H,{color:mt},J),` ${R.packageName} ${R.currentRange} → ${R.newRange}`,V.createElement(H,{dimColor:!0},` ${R.updateType}`),Se?V.createElement(H,{color:Se},ht):null),{columns:pe})}
30
+ `)}if(process.stdout.write(`
31
+ `),r.info(Je(N,C)),E>N.length){const R=[...y.values()].reduce((B,J)=>B+J.size,0),U=R>E?` (${String(R)} catalog entries, ${String(R-E)} duplicates)`:"";r.log(),r.info(`Checked ${String(E)} unique packages${U}: ${String(Ee)} up-to-date${I.length>0?`, ${String(I.length)} failed`:""}`)}if(O.length>0){process.stdout.write(`
32
+ `);const R=`${String(O.length)} package${O.length===1?"":"s"} skipped by target constraint (use --target latest to include):`;process.stdout.write(`${he(V.createElement(H,{color:"yellow"},` ${R}`),{columns:pe})}
33
+ `);for(const U of O)process.stdout.write(`${he(V.createElement(H,null," ",V.createElement(H,{dimColor:!0},U.packageName),` ${U.currentRange} → ${U.newRange}`,V.createElement(H,{dimColor:!0},` ${U.updateType}`)),{columns:pe})}
34
+ `)}const re=Array.isArray(xe)?xe:[],ie=re.filter(R=>R.kind!=="ecosystem"),Ae=re.filter(R=>R.kind==="ecosystem").map(R=>x.get(R.packageName)).filter(R=>R!==void 0);if(!se&&re.length>0){if(ie.length>0){r.info(`
35
+ Applying ${String(ie.length)} catalog update${ie.length===1?"":"s"}...
36
+ `);const R={...s,install:s.install??o.install};await Ge(e,t,ie,R,r,h,n.editorconfig??!0)}if(Ae.length>0){const{applied:R,skipped:U}=nt(Ae);R.length>0&&r.info(`${String(R.length)} ecosystem reference${R.length===1?"":"s"} updated.`);for(const B of U)r.warn(`${_("⚠")} Skipped ${B.update.name} (${B.update.file}): ${B.reason}`)}return{applied:!0,canceled:!1,ecosystemHandled:Y,jsonEmitted:!1}}return{applied:!1,canceled:re.length===0,ecosystemHandled:Y,jsonEmitted:!1}}if(se){if(W==="json"){const x={failed:I,filteredByTarget:O,ignored:P,outdated:N};G&&(x.aiAnalysis=G),process.stdout.write(`${JSON.stringify(x,void 0,2)}
37
+ `)}else r.info(`Would update ${String(N.length)} dependencies:
38
+ `),Fe(N,I,W,r,C),G&&(r.info(""),r.info(Ie(G))),Me(O,r);return{applied:!1,canceled:!1,jsonEmitted:W==="json"}}G&&W!=="json"&&(r.info(Ie(G)),r.info(""));let Z=N;if(s.interactive&&(Z=await Kt(N),Z.length===0))return r.info("No updates selected."),{applied:!1,canceled:!0,jsonEmitted:!1};r.info(`Updating ${String(Z.length)} catalog dependencies...
39
+ `),Fe(Z,[],W,r,C),Me(O,r);const ft={...s,install:s.install??o.install};return await Ge(e,t,Z,ft,r,h),{applied:!0,canceled:!1,jsonEmitted:W==="json"}},Ls=async(e,t,n,s,i,r)=>{if(s["ignore-release-age"]===!0){const d=Re(e,t),f=typeof d.minutes=="number"&&d.minutes>0;if(f&&i.length>0){const m=i.map(g=>Ze(g).name);dt(r,t,lt(t,e,m))}else f&&r.warn(`${_("⚠")} --ignore-release-age without package names can't pre-exempt packages in pm-wrapper mode (vis doesn't know which will change). Pass explicit package names, use catalog mode, or lower the gate in ${ct[t]??"your package manager config"}.`)}const o={dev:s.dev,filters:F(s.filter),global:s.global,interactive:s.interactive,latest:s.latest||s.target==="latest",noOptional:s.optional===!1,noSave:s.save===!1,packages:i,prod:s.prod,recursive:s.recursive,workspaceRoot:s.workspaceRoot},{command:a,warnings:p}=un(t,n,o);for(const d of p)r.warn(d);const c=`${a.bin} ${a.args.join(" ")}`.trim();if(s.dryRun)return r.info(`Would run: ${c}`),we;r.info(`Running: ${c}`);try{const{code:d,output:f}=await ze(a.bin,a.args,{cwd:e,env:process.env});if(d!==0)return r.error(`
40
+ ${K("✖")} Update failed (exit code ${String(d)})`),r.error(` Command: ${c}`),r.error(` Directory: ${e}
41
+ `),process.exitCode=d,{applied:!1,canceled:!1,jsonEmitted:!1};s.peer!==!0&&Xe(f)&&r.info(Qe)}catch(d){const m=d.status??1;return r.error(`
42
+ ${K("✖")} Update failed (exit code ${String(m)})`),r.error(` Command: ${c}`),r.error(` Directory: ${e}
43
+ `),process.exitCode=m,{applied:!1,canceled:!1,jsonEmitted:!1}}return{applied:!0,canceled:!1,jsonEmitted:!1}},Ps=async(e,t,n)=>{const s=e.latest===!0||e.target==="latest";if(t||!s||e.dryRun===!0||e.yes===!0||e.interactive===!0)return!0;if(!(!!process.stdout.isTTY&&!le))return n.error(`${K("✖")} Refusing to run blanket --latest update in a non-interactive context.`),n.error(" Re-run with --yes to confirm, --dry-run to preview, or pass explicit package names."),process.exitCode=1,!1;const r=qe({input:process.stdin,output:process.stdout});try{const a=(await new Promise(c=>{r.question(`${_("⚠")} About to upgrade ALL dependencies to their latest versions. This may include breaking changes.
44
+ Continue? [y/N] `,c)})).trim().toLowerCase();return a==="y"||a==="yes"?!0:(n.info("Aborted."),!1)}finally{r.close()}},ut=(e,t)=>{const n=new Set;e.actions===!1&&n.add("actions"),e.docker===!1&&n.add("docker"),e.gitlab===!1&&n.add("gitlab");const s=e.style??"sha";if(s!=="sha"&&s!=="preserve")throw new Error(`Invalid --style "${s}". Use: sha or preserve.`);const i=e.latest===!0?"latest":e.target??"latest";if(i!=="latest"&&i!=="minor"&&i!=="patch")throw new Error(`Invalid target "${i}". Use: latest, minor, or patch.`);const r=i,o=t.update??{};return{disabled:n,exclude:[...F(e.exclude),...F(o.exclude)],githubToken:e.actionsToken??void 0,gitlabToken:e.gitlabToken??void 0,include:F(e.include),includeBranches:e.includeBranches===!0,maxConcurrentRequests:typeof e.maxConcurrentRequests=="number"&&e.maxConcurrentRequests>0?e.maxConcurrentRequests:8,minAgeDays:typeof o.minimumReleaseAge=="number"&&o.minimumReleaseAge>0?o.minimumReleaseAge/1440:void 0,mode:r,respectDependabotConfig:!0,style:s}},Vs=(e,t)=>e.dryRun===!0||process.exitCode!==void 0&&process.exitCode!==0||t.canceled?!1:e.yes===!0?!0:e.interactive===!0&&!!process.stdout.isTTY&&!le,Ms=async(e,t,n,s,i)=>{const r=ut(t,n);if(r.disabled.size===3)return;let a;try{a=await ot({options:r,workspaceRoot:e})}catch(h){s.warn(`${_("⚠")} Ecosystem update scan failed: ${h.message}`);return}if(a.scanned===0)return a;const p=t.format??"table",c=!!t.dryRun,d=Vs(t,i);if(p==="json")i.jsonEmitted?s.warn(`${_("⚠")} ${String(a.updates.length)} ecosystem update${a.updates.length===1?"":"s"} available but not emitted in --format=json (catalog already wrote one JSON document). Rerun with --format=table or --no-catalog to see them.`):process.stdout.write(`${Ss(a)}
45
+ `);else if(p!=="minimal"){const h=As(a,{previewOnly:!d&&!c,showIgnored:t.interactive===!0});h&&s.info(h)}if(a.updates.length===0)return a;if(c)return p==="minimal"&&s.info(`
46
+ ${_("ℹ")} ${String(a.updates.length)} ecosystem reference${a.updates.length===1?"":"s"} can be bumped — not applied (--dry-run). Re-run without --dry-run and with \`--interactive\` or \`--yes\` to apply.`),a;if(!d)return p==="minimal"&&s.info(`
47
+ ${_("ℹ")} ${String(a.updates.length)} ecosystem reference${a.updates.length===1?"":"s"} can be bumped — not applied automatically. Re-run with \`--interactive\` to choose, or \`--yes\` to apply all (or \`--no-actions\` / \`--no-docker\` / \`--no-gitlab\` to silence by ecosystem).`),a;let f=a.updates;if(t.interactive===!0&&process.stdout.isTTY&&!le&&(f=await Is(a.updates),f.length===0))return s.info(`${_("ℹ")} No ecosystem updates selected.`),a;const{applied:m,skipped:g}=nt(f);if(m.length>0&&s.info(`
48
+ ${String(m.length)} ecosystem reference${m.length===1?"":"s"} updated.`),g.length>0){s.warn(`${_("⚠")} ${String(g.length)} ecosystem update${g.length===1?"":"s"} skipped:`);for(const h of g)s.warn(` ${h.update.name} (${h.update.file}:${String(h.update.line)}): ${h.reason}`)}return a},Fs=e=>{const t=e.style;if(t!==void 0&&t!=="sha"&&t!=="preserve")throw new Error(`Invalid --style "${t}". Use: sha or preserve.`);const n=e.target;if(n!==void 0&&n!=="latest"&&n!=="minor"&&n!=="patch")throw new Error(`Invalid --target "${n}". Use: latest, minor, or patch.`)},gr=async({argument:e,logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!i)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");Fs(n);let r=e;const o=i,{packageManager:a}=bt(o);if(n.typosquatCheck!==!1){if(r.length>0){const f=r.map(h=>Ze(h)),m=s?.security?.typosquatAllowlist,g=await Dt(f.map(h=>h.name),m);if(!g.ok){process.exitCode=1;return}r=f.map((h,b)=>{const k=g.packages[b];return k!==h.name?h.versionSpec?`${k}@${h.versionSpec}`:k??"":r[b]??""})}else if(!await Bt(o,s?.security?.typosquatAllowlist)){process.exitCode=1;return}}if(n.rollback){if(!Mt(o,a)){t.info("No backup found. Run 'vis update' first to create a backup.");return}if(Ft(o,a))t.info("Restored from backup.");else throw new Error("Failed to restore from backup.");return}if(!await Ps(n,r.length>0,t))return;const c=n.catalog!==!1&&Gt(o,a);let d;if(c)d=await Bs(o,a,s??{},n,r,t);else{const f=Ct(o,{backend:Tt(It({options:n,visConfig:s},o)),configBackend:s?.install?.backend,configCorepack:s?.install?.corepack}),m=f.name==="aube"?"":Rt(f.name);d=await Ls(o,f.name,m,n,r,t)}r.length===0&&d.ecosystemHandled!==!0&&await Ms(o,n,s??{},t,d)};export{lt as addReleaseAgeExcludesForInstall,gr as default,hr as formatMinutesAsTimeString,Os as parseNpmReleaseAgeValue,at as parseTimeStringToMinutes,Re as readPmNativeMinimumReleaseAge,Ps as requireBlanketUpdateConfirmation,Ms as runEcosystemUpdate,Vs as shouldApplyEcosystem};