@visulima/vis 4.2.0 → 4.3.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 (215) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/LICENSE.md +55 -129
  3. package/dist/bin.js +1 -1
  4. package/dist/binx.js +1 -1
  5. package/dist/config/index.d.ts +96 -0
  6. package/dist/packem_chunks/CONFIG_FILES.js +3 -3
  7. package/dist/packem_chunks/bloom-status.js +1 -1
  8. package/dist/packem_chunks/bloom-sync.js +1 -1
  9. package/dist/packem_chunks/cargo-plan.js +3 -0
  10. package/dist/packem_chunks/catalog.js +51 -48
  11. package/dist/packem_chunks/cli-exec.js +1 -1
  12. package/dist/packem_chunks/cli-main.js +164 -164
  13. package/dist/packem_chunks/composer-projects.js +2 -0
  14. package/dist/packem_chunks/dart-plan.js +1 -0
  15. package/dist/packem_chunks/dart-projects.js +1 -0
  16. package/dist/packem_chunks/dispatch.js +1 -1
  17. package/dist/packem_chunks/fix.js +8 -8
  18. package/dist/packem_chunks/gem-plan.js +2 -0
  19. package/dist/packem_chunks/gem-projects.js +1 -0
  20. package/dist/packem_chunks/git.js +5 -5
  21. package/dist/packem_chunks/go-plan.js +1 -0
  22. package/dist/packem_chunks/go-projects.js +2 -0
  23. package/dist/packem_chunks/gradle-plan.js +1 -0
  24. package/dist/packem_chunks/handler.js +1 -1
  25. package/dist/packem_chunks/handler10.js +3 -3
  26. package/dist/packem_chunks/handler11.js +1 -1
  27. package/dist/packem_chunks/handler12.js +2 -2
  28. package/dist/packem_chunks/handler13.js +1 -1
  29. package/dist/packem_chunks/handler14.js +1 -1
  30. package/dist/packem_chunks/handler15.js +1 -1
  31. package/dist/packem_chunks/handler16.js +1 -1
  32. package/dist/packem_chunks/handler17.js +1 -1
  33. package/dist/packem_chunks/handler18.js +1 -1
  34. package/dist/packem_chunks/handler19.js +1 -1
  35. package/dist/packem_chunks/handler2.js +1 -1
  36. package/dist/packem_chunks/handler20.js +2 -2
  37. package/dist/packem_chunks/handler21.js +1 -1
  38. package/dist/packem_chunks/handler22.js +1 -1
  39. package/dist/packem_chunks/handler23.js +1 -1
  40. package/dist/packem_chunks/handler24.js +1 -1
  41. package/dist/packem_chunks/handler26.js +1 -1
  42. package/dist/packem_chunks/handler27.js +1 -1
  43. package/dist/packem_chunks/handler28.js +1 -1
  44. package/dist/packem_chunks/handler29.js +1 -1
  45. package/dist/packem_chunks/handler3.js +1 -1
  46. package/dist/packem_chunks/handler30.js +1 -1
  47. package/dist/packem_chunks/handler39.js +6 -6
  48. package/dist/packem_chunks/handler4.js +3 -3
  49. package/dist/packem_chunks/handler5.js +2 -2
  50. package/dist/packem_chunks/handler50.js +1 -1
  51. package/dist/packem_chunks/handler51.js +1 -1
  52. package/dist/packem_chunks/handler53.js +1 -1
  53. package/dist/packem_chunks/handler54.js +2 -2
  54. package/dist/packem_chunks/handler55.js +1 -1
  55. package/dist/packem_chunks/handler58.js +2 -2
  56. package/dist/packem_chunks/handler59.js +1 -1
  57. package/dist/packem_chunks/handler6.js +7 -7
  58. package/dist/packem_chunks/handler60.js +8 -8
  59. package/dist/packem_chunks/handler61.js +1 -1
  60. package/dist/packem_chunks/handler62.js +16 -16
  61. package/dist/packem_chunks/handler63.js +2 -2
  62. package/dist/packem_chunks/handler64.js +1 -1
  63. package/dist/packem_chunks/handler65.js +3 -3
  64. package/dist/packem_chunks/handler66.js +2 -2
  65. package/dist/packem_chunks/handler67.js +3 -3
  66. package/dist/packem_chunks/handler68.js +4 -4
  67. package/dist/packem_chunks/handler69.js +3 -3
  68. package/dist/packem_chunks/handler7.js +1 -1
  69. package/dist/packem_chunks/handler70.js +5 -5
  70. package/dist/packem_chunks/handler71.js +5 -5
  71. package/dist/packem_chunks/handler72.js +2 -2
  72. package/dist/packem_chunks/handler73.js +87 -86
  73. package/dist/packem_chunks/handler74.js +1 -1
  74. package/dist/packem_chunks/handler75.js +23 -23
  75. package/dist/packem_chunks/handler76.js +6 -6
  76. package/dist/packem_chunks/handler77.js +2 -2
  77. package/dist/packem_chunks/handler78.js +19 -19
  78. package/dist/packem_chunks/handler8.js +1 -1
  79. package/dist/packem_chunks/handler9.js +1 -1
  80. package/dist/packem_chunks/heal-accept.js +1 -1
  81. package/dist/packem_chunks/heal.js +1 -1
  82. package/dist/packem_chunks/help-command.js +7 -7
  83. package/dist/packem_chunks/hex-plan.js +3 -0
  84. package/dist/packem_chunks/hex-projects.js +1 -0
  85. package/dist/packem_chunks/index2.js +52 -42
  86. package/dist/packem_chunks/index4.js +58 -802
  87. package/dist/packem_chunks/index5.js +802 -7
  88. package/dist/packem_chunks/index6.js +7 -58
  89. package/dist/packem_chunks/keys-refresh.js +1 -1
  90. package/dist/packem_chunks/lean.js +1 -1
  91. package/dist/packem_chunks/list.js +2 -2
  92. package/dist/packem_chunks/loader.js +1 -1
  93. package/dist/packem_chunks/maven-plan.js +1 -0
  94. package/dist/packem_chunks/maven-projects.js +1 -0
  95. package/dist/packem_chunks/nuget-plan.js +1 -0
  96. package/dist/packem_chunks/nuget-projects.js +1 -0
  97. package/dist/packem_chunks/orchestrator.js +33 -33
  98. package/dist/packem_chunks/prune.js +1 -1
  99. package/dist/packem_chunks/python-plan.js +3 -0
  100. package/dist/packem_chunks/python-projects.js +1 -0
  101. package/dist/packem_chunks/run.js +1 -1
  102. package/dist/packem_chunks/security.js +1 -1
  103. package/dist/packem_chunks/snapshot.js +2 -2
  104. package/dist/packem_chunks/status.js +1 -1
  105. package/dist/packem_chunks/swift-projects.js +1 -0
  106. package/dist/packem_chunks/sync.js +3 -2
  107. package/dist/packem_chunks/sync2.js +1 -1
  108. package/dist/packem_chunks/tripwire.js +2 -2
  109. package/dist/packem_chunks/ts-loader.js +5 -5
  110. package/dist/packem_chunks/verify-lockfile.js +2 -2
  111. package/dist/packem_chunks/version-resolver.js +3 -3
  112. package/dist/packem_chunks/zig-plan.js +1 -0
  113. package/dist/packem_chunks/zig-projects.js +1 -0
  114. package/dist/packem_shared/{affected-selection-M7riOi5-.js → affected-selection-D4giBK2X.js} +1 -1
  115. package/dist/packem_shared/{affected-shas-CAwpSPmP.js → affected-shas-B2V84O0g.js} +1 -1
  116. package/dist/packem_shared/{ai-analysis-DSQQDFU9.js → ai-analysis-pldoS_N4.js} +2 -2
  117. package/dist/packem_shared/{ai-fix-BTm1Z5og.js → ai-fix-BC6aIRJT.js} +4 -4
  118. package/dist/packem_shared/{augment-CBv1hwMR.js → augment-B9kSZuvW.js} +1 -1
  119. package/dist/packem_shared/{bin-Cbs_ix6l.js → bin-C1XKj-O-.js} +1 -1
  120. package/dist/packem_shared/build-scripts-CEDx_nJp.js +1 -0
  121. package/dist/packem_shared/{command-runtime-BD-4UmPB.js → command-runtime-p4IXiIf6.js} +1 -1
  122. package/dist/packem_shared/composer-DR3D-Psb.js +1 -0
  123. package/dist/packem_shared/dart-pubspec-BK_cK2EP.js +2 -0
  124. package/dist/packem_shared/dependency-scan-B8jroa1D.js +1 -0
  125. package/dist/packem_shared/{docker-1jgKW5Wd.js → docker-DXqV-07f.js} +3 -3
  126. package/dist/packem_shared/ecosystem-gate-ddru_hOg.js +6 -0
  127. package/dist/packem_shared/failure-log-D2x5BT8S.js +2 -0
  128. package/dist/packem_shared/formatBytes-BHAzNIrn-CrusHOew.js +4 -0
  129. package/dist/packem_shared/gemspec-K7N05xxc.js +3 -0
  130. package/dist/packem_shared/go-modules-BsVqtyeC.js +1 -0
  131. package/dist/packem_shared/gradle-build-CHZDHyjI.js +8 -0
  132. package/dist/packem_shared/index-BzhrR_iC.js +22 -0
  133. package/dist/packem_shared/index-Chje3u9v.js +1 -0
  134. package/dist/packem_shared/{index-Cq-J2MdB.js → index-DQ2GJzmy.js} +1 -1
  135. package/dist/packem_shared/{isAccessibleSync-DYKTrrvc-K2xhg6sV.js → isAccessibleSync-DYKTrrvc-C-_5cgwu.js} +1 -1
  136. package/dist/packem_shared/lifecycle-D6PMPor-.js +2 -0
  137. package/dist/packem_shared/lockfile-CiUtEbnt.js +1 -0
  138. package/dist/packem_shared/manifests-Du4yKlf_.js +1 -0
  139. package/dist/packem_shared/maven-pom-B0KG9kJQ.js +1 -0
  140. package/dist/packem_shared/{min-release-age-Da4V046o.js → min-release-age-JViyQuBM.js} +7 -7
  141. package/dist/packem_shared/missing-package-json-Cu5YVAot.js +1 -0
  142. package/dist/packem_shared/mix-project-RYvdZp3_.js +2 -0
  143. package/dist/packem_shared/multi-eco-lockfiles-B2X3yhyo.js +1 -0
  144. package/dist/packem_shared/{native-config-sync-CEB0rWlk.js → native-config-sync-TdTWjVgI.js} +1 -1
  145. package/dist/packem_shared/nuget-project-RApYSW_y.js +4 -0
  146. package/dist/packem_shared/{osv-bloom-BRacgzs7.js → osv-bloom-BCAX5ARR.js} +1 -1
  147. package/dist/packem_shared/package-version-Dxirp-UO.js +4 -0
  148. package/dist/packem_shared/packument-BQv4je9m.js +1 -0
  149. package/dist/packem_shared/pm-runner-CMSml1Bj.js +1 -0
  150. package/dist/packem_shared/{project-name-filter-zrdrEQbu.js → project-name-filter-D6tXD8gd.js} +1 -1
  151. package/dist/packem_shared/{provenance-CFPT_FQA.js → provenance-DNyVMxNv.js} +1 -1
  152. package/dist/packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js +1 -0
  153. package/dist/packem_shared/registry-keys-DwB3ZXS_.js +1 -0
  154. package/dist/packem_shared/{resolve-explicit-opfIkxoY.js → resolve-explicit-BPsdmuty.js} +1 -1
  155. package/dist/packem_shared/resolve-runtime-CNiHcVtx.js +1 -0
  156. package/dist/packem_shared/run-file-UBukWaha.js +1 -0
  157. package/dist/packem_shared/runtime-check-1U8HrQd9.js +1 -0
  158. package/dist/packem_shared/s1ngularity-QD2LD1sO.js +1 -0
  159. package/dist/packem_shared/{scan-progress-BGB9hIrD.js → scan-progress-CkumcBG-.js} +2 -2
  160. package/dist/packem_shared/{selectors-CjIZ3gy2.js → selectors-edwcgNl3.js} +1 -1
  161. package/dist/packem_shared/{signatures-DpqZVmmU.js → signatures-t8LbOaqr.js} +1 -1
  162. package/dist/packem_shared/spinner-ukDEdGvp.js +1 -0
  163. package/dist/packem_shared/swift-package-B6X5kzQE.js +1 -0
  164. package/dist/packem_shared/tabs--uxJGL8N.js +1 -0
  165. package/dist/packem_shared/{target-merge-hsawesT4.js → target-merge-DVJl-7Qz.js} +1 -1
  166. package/dist/packem_shared/target-options-DsHFmRZH.js +1 -0
  167. package/dist/packem_shared/toolchain-BRdpaAC4.js +5 -0
  168. package/dist/packem_shared/typosquats-8u0drCqQ.js +1 -0
  169. package/dist/packem_shared/use-measured-height-DUZyyias.js +1 -0
  170. package/dist/packem_shared/verify-B_MblU_Q.js +1 -0
  171. package/dist/packem_shared/{vis-update-app-D9KWJ9Ir.js → vis-update-app-BCIccZfA.js} +1 -1
  172. package/dist/packem_shared/{vis-user-error-Bdg9NRuJ.js → vis-user-error-75VtCwMv.js} +15 -15
  173. package/dist/packem_shared/watch-CcTketln.js +1 -0
  174. package/dist/packem_shared/watch-loop-qRn0IHPG.js +11 -0
  175. package/dist/packem_shared/{writeFileSync-DJoHk3Ks-O9zOKqeM.js → writeFileSync-DJoHk3Ks-BPRoepNw.js} +1 -1
  176. package/dist/packem_shared/zig-manifest-P7ydLEOa.js +7 -0
  177. package/dist/release/plugin-sdk.d.ts +1 -1
  178. package/dist/release/types.d.ts +133 -7
  179. package/dist/runtime/preload.js +1 -1
  180. package/index.d.ts +204 -204
  181. package/index.js +52 -52
  182. package/package.json +11 -11
  183. package/schemas/vis-config.schema.json +265 -5
  184. package/schemas/vis-release-config.schema.json +132 -5
  185. package/dist/packem_shared/advisories-BSpzRIXP.js +0 -1
  186. package/dist/packem_shared/build-scripts-BIgkWVgY.js +0 -1
  187. package/dist/packem_shared/cyclonedx-CT1rtKxV.js +0 -4
  188. package/dist/packem_shared/dependency-scan-W9b2X0a1.js +0 -1
  189. package/dist/packem_shared/failure-log-B91LvYWw.js +0 -2
  190. package/dist/packem_shared/formatBytes-BHAzNIrn-CLYsxlUj.js +0 -4
  191. package/dist/packem_shared/index-CVBR-Kit.js +0 -22
  192. package/dist/packem_shared/index-onibYJkv.js +0 -1
  193. package/dist/packem_shared/lifecycle-DDJzp-4H.js +0 -2
  194. package/dist/packem_shared/lockfile-Bi1mw9jJ.js +0 -1
  195. package/dist/packem_shared/manifests-D671Sb1T.js +0 -1
  196. package/dist/packem_shared/missing-package-json-CMoHdvmj.js +0 -1
  197. package/dist/packem_shared/package-version-C5EPMgRw.js +0 -4
  198. package/dist/packem_shared/packument-DuEV-qSE.js +0 -1
  199. package/dist/packem_shared/path-CxEa27Rz-pjheKk6v.js +0 -1
  200. package/dist/packem_shared/pm-runner-9L6ocnu2.js +0 -1
  201. package/dist/packem_shared/readJsonSync-CbryXYxN-BxKjDZnF.js +0 -1
  202. package/dist/packem_shared/registry-keys-C3EsP_s4.js +0 -1
  203. package/dist/packem_shared/resolve-runtime-lJ5L9gU4.js +0 -1
  204. package/dist/packem_shared/run-file-DZff6GqY.js +0 -1
  205. package/dist/packem_shared/runtime-check-DAbveBr_.js +0 -1
  206. package/dist/packem_shared/s1ngularity-DTvrfWIM.js +0 -1
  207. package/dist/packem_shared/spinner-BVCEMm3G.js +0 -1
  208. package/dist/packem_shared/tabs-Dz6xVpfX.js +0 -1
  209. package/dist/packem_shared/target-options-Bxb0Y5qa.js +0 -1
  210. package/dist/packem_shared/toolchain-887JoquG.js +0 -5
  211. package/dist/packem_shared/typosquats-Xv6dN4sr.js +0 -1
  212. package/dist/packem_shared/use-measured-height-BPQg2q_p.js +0 -1
  213. package/dist/packem_shared/verify-BLoaI7En.js +0 -1
  214. package/dist/packem_shared/watch-BTZw2Y8Q.js +0 -1
  215. package/dist/packem_shared/watch-loop-Cjh2wlUl.js +0 -11
@@ -1 +1 @@
1
- import{createRequire as v}from"node:module";import"../packem_shared/index-CVBR-Kit.js";import{e as m}from"../packem_shared/path-CxEa27Rz-pjheKk6v.js";import{cleanWorkspace as E}from"#native";import{l as S}from"../packem_shared/missing-package-json-CMoHdvmj.js";import{p as c}from"./cli-main.js";import{e as p}from"../packem_shared/utils-DQFHJn72.js";import{y as P}from"../packem_shared/isAccessibleSync-DYKTrrvc-K2xhg6sV.js";let g;const _=e=>(g??=v(import.meta.url))(e),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[r,t]=u.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return u.getBuiltinModule(e)}return _(e)},{readdirSync:h,lstatSync:$,rmSync:b}=R("node:fs"),j=e=>{const r=[],t=[e];for(;t.length>0;){const o=t.pop();let i;try{i=h(o)}catch{continue}for(const l of i){const s=m(o,l);try{const n=$(s);if(n.isSymbolicLink()||!n.isDirectory())continue}catch{continue}l==="node_modules"?r.push(s):l!==".git"&&l!==".hg"&&t.push(s)}}return r},w=["pnpm-lock.yaml","package-lock.json","npm-shrinkwrap.json","yarn.lock","bun.lock","bun.lockb"],D=(e,r,t)=>{let o=0,i=!1;for(const l of w){const s=m(e,l);if(P(s)){t.info(` ${s}`),o++;continue}}return{hadError:i,removed:o}},L=new Set([".cache",".turbo","dist","node_modules"]),k=e=>{for(const r of h(e,{withFileTypes:!0})){const t=m(e,r.name);if(!r.isDirectory())return t;if(!L.has(r.name)){const o=k(t);if(o!==void 0)return o}}},y=(e,r,t)=>{let o=0,i=!1;for(const{packageDir:l}of S(e)){const s=m(e,l);let n;try{n=k(s)}catch(a){c.error(`${s}: ${p(a)}`),i=!0;continue}if(n!==void 0){c.warn(`Skipping ${s}: not empty (contains ${n})`);continue}if(r){t.info(` ${s}`),o++;continue}try{b(s,{force:!0,recursive:!0}),c.success(`Removed empty package ${s}`),o++}catch(a){c.error(`${s}: ${p(a)}`),i=!0}}return{hadError:i,removed:o}},B=async({logger:e,options:r,workspaceRoot:t})=>{const o=t??process.cwd(),i=r.lockfile||!1,l=r.emptyPackages||!1;if(r.dryRun||!1){const f=j(o);if(f.length>0){c.info("Would remove:");for(const d of f)e.info(` ${d}`)}else c.info("No node_modules directories found.");i&&D(o,!0,e),l&&(c.info("Would remove empty packages:"),y(o,!0,e));return}const n=E(o,i);for(const f of n.removed)c.success(`Removed ${f}`);for(const f of n.lockfilesRemoved)c.success(`Removed ${f}`);for(const f of n.errors)c.error(f);n.removed.length===0&&n.lockfilesRemoved.length===0?c.info("No node_modules directories found."):c.info(`Cleaned ${n.removed.length} node_modules director${n.removed.length===1?"y":"ies"}`);let a=!1;if(l){const{hadError:f,removed:d}=y(o,!1,e);a=f,d>0&&c.info(`Cleaned ${d} empty package director${d===1?"y":"ies"}`)}(n.errors.length>0||a)&&(process.exitCode=1)};export{B as default};
1
+ import{createRequire as v}from"node:module";import{e as m}from"../packem_shared/index-BzhrR_iC.js";import{cleanWorkspace as E}from"#native";import{l as S}from"../packem_shared/missing-package-json-Cu5YVAot.js";import{p as c}from"./cli-main.js";import{e as p}from"../packem_shared/utils-DQFHJn72.js";import{y as P}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";let g;const _=e=>(g??=v(import.meta.url))(e),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[r,t]=u.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return u.getBuiltinModule(e)}return _(e)},{readdirSync:h,lstatSync:$,rmSync:b}=R("node:fs"),j=e=>{const r=[],t=[e];for(;t.length>0;){const o=t.pop();let i;try{i=h(o)}catch{continue}for(const l of i){const s=m(o,l);try{const n=$(s);if(n.isSymbolicLink()||!n.isDirectory())continue}catch{continue}l==="node_modules"?r.push(s):l!==".git"&&l!==".hg"&&t.push(s)}}return r},w=["pnpm-lock.yaml","package-lock.json","npm-shrinkwrap.json","yarn.lock","bun.lock","bun.lockb"],D=(e,r,t)=>{let o=0,i=!1;for(const l of w){const s=m(e,l);if(P(s)){t.info(` ${s}`),o++;continue}}return{hadError:i,removed:o}},L=new Set([".cache",".turbo","dist","node_modules"]),k=e=>{for(const r of h(e,{withFileTypes:!0})){const t=m(e,r.name);if(!r.isDirectory())return t;if(!L.has(r.name)){const o=k(t);if(o!==void 0)return o}}},y=(e,r,t)=>{let o=0,i=!1;for(const{packageDir:l}of S(e)){const s=m(e,l);let n;try{n=k(s)}catch(a){c.error(`${s}: ${p(a)}`),i=!0;continue}if(n!==void 0){c.warn(`Skipping ${s}: not empty (contains ${n})`);continue}if(r){t.info(` ${s}`),o++;continue}try{b(s,{force:!0,recursive:!0}),c.success(`Removed empty package ${s}`),o++}catch(a){c.error(`${s}: ${p(a)}`),i=!0}}return{hadError:i,removed:o}},x=async({logger:e,options:r,workspaceRoot:t})=>{const o=t??process.cwd(),i=r.lockfile||!1,l=r.emptyPackages||!1;if(r.dryRun||!1){const f=j(o);if(f.length>0){c.info("Would remove:");for(const d of f)e.info(` ${d}`)}else c.info("No node_modules directories found.");i&&D(o,!0,e),l&&(c.info("Would remove empty packages:"),y(o,!0,e));return}const n=E(o,i);for(const f of n.removed)c.success(`Removed ${f}`);for(const f of n.lockfilesRemoved)c.success(`Removed ${f}`);for(const f of n.errors)c.error(f);n.removed.length===0&&n.lockfilesRemoved.length===0?c.info("No node_modules directories found."):c.info(`Cleaned ${n.removed.length} node_modules director${n.removed.length===1?"y":"ies"}`);let a=!1;if(l){const{hadError:f,removed:d}=y(o,!1,e);a=f,d>0&&c.info(`Cleaned ${d} empty package director${d===1?"y":"ies"}`)}(n.errors.length>0||a)&&(process.exitCode=1)};export{x as default};
@@ -1 +1 @@
1
- import{a as d,e as l}from"../packem_shared/pm-runner-9L6ocnu2.js";import{r as m,a as p}from"../packem_shared/command-runtime-BD-4UmPB.js";const i=async({logger:a,options:s,visConfig:e,workspaceRoot:n})=>{const c=n??process.cwd(),t=m({logger:a,options:s,visConfig:e},c),r=d(c,{backend:p(t),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),o=l(r,s.check||!1,c,a);o!==0&&(process.exitCode=o)};export{i as default};
1
+ import{a as d,e as l}from"../packem_shared/pm-runner-CMSml1Bj.js";import{r as m,a as p}from"../packem_shared/command-runtime-p4IXiIf6.js";const i=async({logger:a,options:s,visConfig:e,workspaceRoot:n})=>{const c=n??process.cwd(),t=m({logger:a,options:s,visConfig:e},c),r=d(c,{backend:p(t),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),o=l(r,s.check||!1,c,a);o!==0&&(process.exitCode=o)};export{i as default};
@@ -1,4 +1,4 @@
1
- import{createRequire as L}from"node:module";import{U as G,n as H}from"../packem_shared/path-CxEa27Rz-pjheKk6v.js";import{d as U,f as F,p as S,v as P,a as D}from"./heal.js";import{d as j,c as V}from"../packem_shared/pm-runner-9L6ocnu2.js";import{p as s}from"./cli-main.js";let N;const O=t=>(N??=L(import.meta.url))(t),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=t=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,o]=I.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return I.getBuiltinModule(t)}return O(t)},{readFile:x}=B("node:fs/promises"),{createInterface:K}=B("node:readline"),M=()=>!!process.stdout.isTTY&&process.env.CI!=="true",q=t=>new Promise(e=>{const o=K({input:process.stdin,output:process.stderr});o.question(`${t} (Y/n) `,a=>{o.close();const i=a.trim().toLowerCase();e(i===""||i==="y"||i==="yes")})}),Y=(t,e)=>{const o=j(e),a=V(o,{exact:!1,filter:[],global:!1,optional:!1,packages:[t],peer:!1,saveDev:!1,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:a})},$=t=>`pnpm add ${t}`,J=t=>t==="@gitbeaker/rest"?import("@gitbeaker/rest"):import("@octokit/rest"),A=async(t,e={})=>{const o=e.interactive??M(),a=e.prompt??q,i=e.runInstall??Y,c=e.importImpl??J,d=e.workspaceRoot??process.cwd();try{return await c(t)}catch(u){const{code:m}=u;if(m!=="ERR_MODULE_NOT_FOUND"&&m!=="MODULE_NOT_FOUND")throw u}if(!o)throw new Error(`${t} is not installed. \`vis ai heal accept\` needs it to talk to the host. Install it in your repo first:
1
+ import{createRequire as L}from"node:module";import{U as G,a as H}from"../packem_shared/index-BzhrR_iC.js";import{d as U,f as F,p as S,v as P,a as D}from"./heal.js";import{d as j,c as V}from"../packem_shared/pm-runner-CMSml1Bj.js";import{p as s}from"./cli-main.js";let N;const O=t=>(N??=L(import.meta.url))(t),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=t=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,o]=I.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return I.getBuiltinModule(t)}return O(t)},{readFile:x}=B("node:fs/promises"),{createInterface:K}=B("node:readline"),M=()=>!!process.stdout.isTTY&&process.env.CI!=="true",q=t=>new Promise(e=>{const o=K({input:process.stdin,output:process.stderr});o.question(`${t} (Y/n) `,a=>{o.close();const i=a.trim().toLowerCase();e(i===""||i==="y"||i==="yes")})}),Y=(t,e)=>{const o=j(e),a=V(o,{exact:!1,filter:[],global:!1,optional:!1,packages:[t],peer:!1,saveDev:!1,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:a})},$=t=>`pnpm add ${t}`,J=t=>t==="@gitbeaker/rest"?import("@gitbeaker/rest"):import("@octokit/rest"),A=async(t,e={})=>{const o=e.interactive??M(),a=e.prompt??q,i=e.runInstall??Y,c=e.importImpl??J,d=e.workspaceRoot??process.cwd();try{return await c(t)}catch(u){const{code:m}=u;if(m!=="ERR_MODULE_NOT_FOUND"&&m!=="MODULE_NOT_FOUND")throw u}if(!o)throw new Error(`${t} is not installed. \`vis ai heal accept\` needs it to talk to the host. Install it in your repo first:
2
2
  ${$(t)}`);if(!await a(`${t} isn't installed. Install it now?`))throw new Error(`${t} install declined. Re-run \`vis ai heal accept\` after installing manually:
3
3
  ${$(t)}`);const n=await i(t,d);if(n.exitCode!==0)throw new Error(`Install of ${t} failed (exit ${String(n.exitCode)}). Install manually and retry:
4
4
  ${$(t)}`);return await c(t)},W=t=>{const e=t.indexOf("/");if(e<=0||e===t.length-1)throw new Error(`Expected GITHUB_REPOSITORY in "owner/repo" form, got: ${t}`);return{owner:t.slice(0,e),repo:t.slice(e+1)}},z=async(t,e)=>{if(e.githubClient)return e.githubClient;const i=(await(e.loadSdk??A)("@octokit/rest")).Octokit;if(!i)throw new TypeError("Loaded `@octokit/rest` but no `Octokit` export was found. Reinstall the package or pin to a supported major.");return new i({auth:t})},X=async(t,e,o)=>{if(o.gitlabClient)return o.gitlabClient;const c=(await(o.loadSdk??A)("@gitbeaker/rest")).Gitlab;if(!c)throw new TypeError("Loaded `@gitbeaker/rest` but no `Gitlab` export was found. Reinstall the package or pin to a supported major.");return new c({host:e,token:t})},Q=t=>t.replace(/\/api\/v\d+\/?$/,""),Z=async t=>{const{branch:e,ciContext:o,files:a,message:i,workspaceRoot:c}=t,d=t.readFile??(_=>x(_,"utf8"));if(!o.repo)throw new Error("Cannot commit on GitHub: GITHUB_REPOSITORY (owner/repo) is not set.");if(!o.token)throw new Error("Cannot commit on GitHub: GITHUB_TOKEN is not set. Grant the workflow `contents: write` and pass the token through.");const{owner:r,repo:n}=W(o.repo),u=await z(o.token,t),f=(await u.rest.git.getRef({owner:r,ref:`heads/${e}`,repo:n})).data.object.sha,g=(await u.rest.git.getCommit({commit_sha:f,owner:r,repo:n})).data.tree.sha,h=await Promise.all(a.map(async _=>{const T=G(c,_),w=await d(T),R=await u.rest.git.createBlob({content:Buffer.from(w,"utf8").toString("base64"),encoding:"base64",owner:r,repo:n});return{mode:"100644",path:_,sha:R.data.sha,type:"blob"}})),C=await u.rest.git.createTree({base_tree:g,owner:r,repo:n,tree:h}),b=await u.rest.git.createCommit({message:i,owner:r,parents:[f],repo:n,tree:C.data.sha});return await u.rest.git.updateRef({owner:r,ref:`heads/${e}`,repo:n,sha:b.data.sha}),{sha:b.data.sha,url:b.data.html_url}},tt=async t=>{const{branch:e,ciContext:o,files:a,message:i,workspaceRoot:c}=t,d=t.readFile??(p=>x(p,"utf8"));if(!o.repo)throw new Error("Cannot commit on GitLab: CI_PROJECT_ID / CI_PROJECT_PATH is not set.");if(!o.token)throw new Error("Cannot commit on GitLab: no token. CI_JOB_TOKEN cannot push commits — set GITLAB_TOKEN to a PAT/project-token with `api` scope.");if(!o.apiBaseUrl)throw new Error("Cannot commit on GitLab: CI_API_V4_URL is not set.");const r=Q(o.apiBaseUrl),n=await X(o.token,r,t),u=await Promise.all(a.map(async p=>{const g=G(c,p);return{action:"update",content:await d(g),filePath:p}})),m=await n.Commits.create(o.repo,e,i,u),f=m.id??m.sha;if(!f)throw new Error("GitLab Commits.create returned no commit ID — cannot reference the new commit.");return{sha:f,url:m.web_url??m.webUrl}},et=async t=>{if(t.files.length===0)throw new Error("Cannot commit: no files to include.");if(t.ciContext.provider==="github-actions")return await Z(t);if(t.ciContext.provider==="gitlab-ci")return await tt(t);throw new Error(`Cannot commit: unsupported CI provider \`${t.ciContext.provider}\`. Run \`vis ai heal accept\` from a recognised CI environment.`)},y="/vis heal accept",ot=async t=>{if(!t)return;let e;try{e=await x(t,"utf8")}catch{return}const o=JSON.parse(e),a=o.comment?.body??"",i=o.comment?.user?.login??"",c=o.pull_request?.head?.repo?.full_name,d=o.pull_request?.base?.repo?.full_name??o.repository?.full_name,r=c!==void 0&&d!==void 0&&c!==d;return{actor:i,body:a,headRef:o.pull_request?.head?.ref,isFork:r}},rt=t=>{const e=t.VIS_HEAL_TRIGGER_BODY,o=t.VIS_HEAL_TRIGGER_ACTOR;if(!(!e||!o))return{actor:o,body:e,headRef:t.VIS_HEAL_HEAD_REF,isFork:!1}},it=t=>{const e=t.BUILDKITE_UNBLOCKER_EMAIL??t.BUILDKITE_UNBLOCKER;if(e)return{actor:e,body:y,headRef:t.BUILDKITE_BRANCH,isFork:!1}},at=async(t,e)=>{if(t.provider==="github-actions")return await ot(e.GITHUB_EVENT_PATH);if(t.provider==="gitlab-ci")return rt(e);if(t.provider==="buildkite")return it(e)},nt=(t,e)=>{const o=e.BUILDKITE_REPO;if(!o)return;const a=/(?:^|@|\/\/)github\.com[:/]([^/]+)\/([^/]+?)(?:\.git)?\/?$/i.exec(o);if(a&&e.GITHUB_TOKEN)return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:t.prNumber,provider:"github-actions",repo:`${a[1]}/${a[2]}`,sha:t.sha,token:e.GITHUB_TOKEN};const i=/\/\/([^/]*gitlab[^/]*)\/([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(o),c=i?null:/@([^/:]*gitlab[^/:]*):([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(o),d=i??c;if(d&&e.GITLAB_TOKEN){const r=d[1];return{apiBaseUrl:e.CI_API_V4_URL??`https://${r}/api/v4`,buildId:void 0,buildNumber:void 0,prNumber:t.prNumber,provider:"gitlab-ci",repo:`${d[2]}/${d[3]}`,sha:t.sha,token:e.GITLAB_TOKEN}}},st=async t=>{const e=t.fetchImpl??globalThis.fetch,a=`${(t.apiBaseUrl??"https://api.github.com").replace(/\/+$/,"")}/repos/${t.repo}/pulls/${String(t.prNumber)}`;try{const i=await e(a,{headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${t.token}`,"X-GitHub-Api-Version":"2022-11-28"}});return i.ok?(await i.json()).head?.ref:void 0}catch{return}},ct=(t,e,o,a)=>{const i=e.map(c=>`- \`${c}\``).join(`
@@ -1,4 +1,4 @@
1
- import{createRequire as E}from"node:module";import{b as U,j as x,F as g,X as A,J as L}from"../packem_shared/index.server-sXNQYpsl.js";import{n as O}from"../packem_shared/path-CxEa27Rz-pjheKk6v.js";import{readLastRunSummary as G}from"@visulima/task-runner";import{a as j,r as F,b as D,c as K}from"../packem_shared/ai-fix-BTm1Z5og.js";import{p,f as H}from"./cli-main.js";let B;const P=e=>(B??=E(import.meta.url))(e),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[t,o]=m.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return m.getBuiltinModule(e)}return P(e)},{spawn:h}=I("node:child_process"),{readFile:M}=I("node:fs/promises"),V=e=>{if(!e)return;const t=/^refs\/pull\/(\d+)\//.exec(e);return t?Number.parseInt(t[1],10):void 0},J=async e=>{if(!e)return{prNumber:void 0,sha:void 0};try{const t=await M(e,"utf8"),o=JSON.parse(t),r=o.pull_request?.number??o.issue?.number??o.number,s=o.pull_request?.head?.sha;return{prNumber:r,sha:s}}catch{return{prNumber:void 0,sha:void 0}}},q=async e=>{const t=V(e.GITHUB_REF),{prNumber:o,sha:r}=t===void 0?await J(e.GITHUB_EVENT_PATH):{prNumber:t,sha:void 0};return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:t??o,provider:"github-actions",repo:e.GITHUB_REPOSITORY,sha:r??e.GITHUB_SHA,token:e.GITHUB_TOKEN}},z=e=>{const t=e.CI_MERGE_REQUEST_IID,o=t!==void 0&&t!==""?Number.parseInt(t,10):void 0,r=e.CI_API_V4_URL,s=e.GITLAB_TOKEN??e.CI_TOKEN;return{apiBaseUrl:r,buildId:void 0,buildNumber:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"gitlab-ci",repo:e.CI_PROJECT_ID??e.CI_PROJECT_PATH,sha:e.CI_COMMIT_SHA,token:s}},X=e=>{const t=e.BUILDKITE_PULL_REQUEST,o=t!==void 0&&t!==""&&t!=="false"?Number.parseInt(t,10):void 0,r=e.BUILDKITE_BUILD_NUMBER,s=r!==void 0&&r!==""?Number.parseInt(r,10):void 0,n=e.BUILDKITE_ORGANIZATION_SLUG,i=e.BUILDKITE_PIPELINE_SLUG,a=n!==void 0&&n!==""&&i!==void 0&&i!==""?`${n}/${i}`:void 0;return{apiBaseUrl:(e.BUILDKITE_API_BASE_URL??"https://api.buildkite.com").replace(/\/+$/,""),buildId:e.BUILDKITE_BUILD_ID,buildNumber:Number.isFinite(s)?s:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"buildkite",repo:a,sha:e.BUILDKITE_COMMIT,token:e.BUILDKITE_API_TOKEN}},Y=async(e=process.env)=>e.GITHUB_ACTIONS==="true"?await q(e):e.GITLAB_CI==="true"?z(e):e.BUILDKITE==="true"?X(e):{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:void 0,provider:"unknown",repo:void 0,sha:void 0,token:void 0},Q=(e,t,o,r)=>new Promise(s=>{const n=["pr","comment",String(t),"--body-file","-"];r&&n.push("--repo",r);const i=h(e,n,{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(o)}),Z=async(e,t,o,r,s)=>{const n=`https://api.github.com/repos/${t}/issues/${String(o)}/comments`;try{const i=await e(n,{body:JSON.stringify({body:r}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${s}`,"Content-Type":"application/json","X-GitHub-Api-Version":"2022-11-28"},method:"POST"});if(!i.ok){const a=await i.text().catch(()=>"");return{error:`GitHub REST returned ${String(i.status)}: ${a.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(i){return{error:i instanceof Error?i.message:String(i),ok:!1}}},W=async(e,t,o,r,s,n)=>{const i=encodeURIComponent(o),a=`${t.replace(/\/+$/,"")}/projects/${i}/merge_requests/${String(r)}/notes`;try{const d=await e(a,{body:JSON.stringify({body:s}),headers:{"Content-Type":"application/json","PRIVATE-TOKEN":n},method:"POST"});if(!d.ok){const c=await d.text().catch(()=>"");return{error:`GitLab REST returned ${String(d.status)}: ${c.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(d){return{error:d instanceof Error?d.message:String(d),ok:!1}}},tt=(e,t,o,r)=>new Promise(s=>{const i=h(e,["annotate","--style",o,"--context",r],{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(t)}),et=async(e,t,o,r,s,n,i,a)=>{const[d,c]=o.split("/",2);if(!d||!c)return{error:`Buildkite repo identifier \`${o}\` is not in {org}/{pipeline} form.`,ok:!1};const f=`${t}/v2/organizations/${encodeURIComponent(d)}/pipelines/${encodeURIComponent(c)}/builds/${String(r)}/annotations`;try{const u=await e(f,{body:JSON.stringify({body:s,context:i,style:n}),headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json"},method:"POST"});if(!u.ok){const l=await u.text().catch(()=>"");return{error:`Buildkite REST returned ${String(u.status)}: ${l.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(u){return{error:u instanceof Error?u.message:String(u),ok:!1}}},ot=async(e,t,o,r)=>{const s=t.buildId?`vis-ai-heal-${t.buildId}`:"vis-ai-heal",n="info",i=await tt(o,e,n,s);if(i.exitCode===0)return{method:"buildkite-cli",posted:!0};if(!t.apiBaseUrl||!t.repo||t.buildNumber===void 0||!t.token){const d=[];return t.repo||d.push("BUILDKITE_ORGANIZATION_SLUG / BUILDKITE_PIPELINE_SLUG"),t.buildNumber===void 0&&d.push("BUILDKITE_BUILD_NUMBER"),t.token||d.push("BUILDKITE_API_TOKEN (with `write_build_annotations` scope)"),{error:`buildkite-agent annotate exited ${String(i.exitCode)} (${i.stderr.trim().slice(0,200)}); cannot fall back to REST without ${d.join(", ")}`,method:"buildkite-cli",posted:!1}}const a=await et(r,t.apiBaseUrl,t.repo,t.buildNumber,e,n,s,t.token);return a.ok?{method:"rest",posted:!0}:{error:`buildkite-agent annotate exited ${String(i.exitCode)}; REST fallback also failed: ${a.error??"unknown"}`,method:"rest",posted:!1}},rt=async(e,t,o,r)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};const s=await Q(o,t.prNumber,e,t.repo);if(s.exitCode===0)return{method:"gh-cli",posted:!0};if(!t.repo||!t.token)return{error:`gh exited ${String(s.exitCode)} (${s.stderr.trim().slice(0,200)}); cannot fall back to REST without GITHUB_REPOSITORY + GITHUB_TOKEN`,method:"gh-cli",posted:!1};const n=await Z(r,t.repo,t.prNumber,e,t.token);return n.ok?{method:"rest",posted:!0}:{error:`gh exited ${String(s.exitCode)}; REST fallback also failed: ${n.error??"unknown"}`,method:"rest",posted:!1}},it=async(e,t,o)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};if(!t.apiBaseUrl||!t.repo)return{error:"GitLab CI context is missing CI_API_V4_URL or CI_PROJECT_ID; cannot post note.",method:"rest",posted:!1};if(!t.token)return{error:"GitLab CI context has no token. CI_JOB_TOKEN cannot post MR notes — set GITLAB_TOKEN to a personal/project access token with `api` scope.",method:"rest",posted:!1};const r=await W(o,t.apiBaseUrl,t.repo,t.prNumber,e,t.token);return r.ok?{method:"rest",posted:!0}:{error:r.error,method:"rest",posted:!1}},nt=async e=>{const{body:t,buildkiteAgentBin:o="buildkite-agent",context:r,fetchImpl:s=globalThis.fetch,ghBin:n="gh"}=e;return r.provider==="github-actions"?await rt(t,r,n,s):r.provider==="gitlab-ci"?await it(t,r,s):r.provider==="buildkite"?await ot(t,r,o,s):{method:"skipped",posted:!1}},b=e=>{let t=0,o=0;for(const r of e)r.status==="applied"?t+=1:o+=1;return{applied:t,failed:o}},k=(e,t,o)=>{const r=K(e,t,o),s=O(e,r);return s===""||s.startsWith("..")?r:s},st=(e,t,o,r)=>new Promise(s=>{const n=process.argv[1];if(!n){s({exitCode:-1,stderr:"Cannot locate vis bin (process.argv[1] missing).",stdout:""});return}const i=[n,"run",o,"--projects",t,"--no-cache","--summarize","--fail-fast"],a=h(process.execPath,i,{cwd:e,env:{...process.env,NO_COLOR:"1"},stdio:["ignore","pipe","pipe"]});let d="",c="";const f=setTimeout(()=>{a.kill("SIGTERM"),setTimeout(()=>a.kill("SIGKILL"),2e3).unref()},r);a.stdout?.setEncoding("utf8"),a.stdout?.on("data",u=>{d+=u}),a.stderr?.setEncoding("utf8"),a.stderr?.on("data",u=>{c+=u}),a.once("error",u=>{clearTimeout(f),s({exitCode:-1,stderr:u.message,stdout:d})}),a.once("close",u=>{clearTimeout(f),s({exitCode:u??-1,stderr:c,stdout:d})})}),at=6e4,T=e=>{let t=0;const o=e.match(/`{3,}/g);if(o)for(const r of o)t=Math.max(t,r.length);return"`".repeat(Math.max(3,t+1))},_=(e,t,o)=>{if(e.patches.length===0)return"_No patches proposed._";const r=[];for(const[s,n]of e.patches.entries()){const i=k(t,o,n.file),a=[`**[${String(s+1)}] \`${i}\`**`];n.reason&&a.push(`_${n.reason}_`);const d=T(`${n.oldString}
1
+ import{createRequire as E}from"node:module";import{b as U,j as x,F as g,X as A,J as L}from"../packem_shared/index.server-sXNQYpsl.js";import{a as O}from"../packem_shared/index-BzhrR_iC.js";import{readLastRunSummary as G}from"@visulima/task-runner";import{a as j,r as F,b as D,c as K}from"../packem_shared/ai-fix-BC6aIRJT.js";import{p,d as H}from"./cli-main.js";let B;const P=e=>(B??=E(import.meta.url))(e),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[t,o]=m.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return m.getBuiltinModule(e)}return P(e)},{spawn:h}=I("node:child_process"),{readFile:M}=I("node:fs/promises"),V=e=>{if(!e)return;const t=/^refs\/pull\/(\d+)\//.exec(e);return t?Number.parseInt(t[1],10):void 0},J=async e=>{if(!e)return{prNumber:void 0,sha:void 0};try{const t=await M(e,"utf8"),o=JSON.parse(t),r=o.pull_request?.number??o.issue?.number??o.number,s=o.pull_request?.head?.sha;return{prNumber:r,sha:s}}catch{return{prNumber:void 0,sha:void 0}}},q=async e=>{const t=V(e.GITHUB_REF),{prNumber:o,sha:r}=t===void 0?await J(e.GITHUB_EVENT_PATH):{prNumber:t,sha:void 0};return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:t??o,provider:"github-actions",repo:e.GITHUB_REPOSITORY,sha:r??e.GITHUB_SHA,token:e.GITHUB_TOKEN}},z=e=>{const t=e.CI_MERGE_REQUEST_IID,o=t!==void 0&&t!==""?Number.parseInt(t,10):void 0,r=e.CI_API_V4_URL,s=e.GITLAB_TOKEN??e.CI_TOKEN;return{apiBaseUrl:r,buildId:void 0,buildNumber:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"gitlab-ci",repo:e.CI_PROJECT_ID??e.CI_PROJECT_PATH,sha:e.CI_COMMIT_SHA,token:s}},X=e=>{const t=e.BUILDKITE_PULL_REQUEST,o=t!==void 0&&t!==""&&t!=="false"?Number.parseInt(t,10):void 0,r=e.BUILDKITE_BUILD_NUMBER,s=r!==void 0&&r!==""?Number.parseInt(r,10):void 0,n=e.BUILDKITE_ORGANIZATION_SLUG,i=e.BUILDKITE_PIPELINE_SLUG,a=n!==void 0&&n!==""&&i!==void 0&&i!==""?`${n}/${i}`:void 0;return{apiBaseUrl:(e.BUILDKITE_API_BASE_URL??"https://api.buildkite.com").replace(/\/+$/,""),buildId:e.BUILDKITE_BUILD_ID,buildNumber:Number.isFinite(s)?s:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"buildkite",repo:a,sha:e.BUILDKITE_COMMIT,token:e.BUILDKITE_API_TOKEN}},Y=async(e=process.env)=>e.GITHUB_ACTIONS==="true"?await q(e):e.GITLAB_CI==="true"?z(e):e.BUILDKITE==="true"?X(e):{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:void 0,provider:"unknown",repo:void 0,sha:void 0,token:void 0},Q=(e,t,o,r)=>new Promise(s=>{const n=["pr","comment",String(t),"--body-file","-"];r&&n.push("--repo",r);const i=h(e,n,{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(o)}),Z=async(e,t,o,r,s)=>{const n=`https://api.github.com/repos/${t}/issues/${String(o)}/comments`;try{const i=await e(n,{body:JSON.stringify({body:r}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${s}`,"Content-Type":"application/json","X-GitHub-Api-Version":"2022-11-28"},method:"POST"});if(!i.ok){const a=await i.text().catch(()=>"");return{error:`GitHub REST returned ${String(i.status)}: ${a.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(i){return{error:i instanceof Error?i.message:String(i),ok:!1}}},W=async(e,t,o,r,s,n)=>{const i=encodeURIComponent(o),a=`${t.replace(/\/+$/,"")}/projects/${i}/merge_requests/${String(r)}/notes`;try{const d=await e(a,{body:JSON.stringify({body:s}),headers:{"Content-Type":"application/json","PRIVATE-TOKEN":n},method:"POST"});if(!d.ok){const c=await d.text().catch(()=>"");return{error:`GitLab REST returned ${String(d.status)}: ${c.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(d){return{error:d instanceof Error?d.message:String(d),ok:!1}}},tt=(e,t,o,r)=>new Promise(s=>{const i=h(e,["annotate","--style",o,"--context",r],{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(t)}),et=async(e,t,o,r,s,n,i,a)=>{const[d,c]=o.split("/",2);if(!d||!c)return{error:`Buildkite repo identifier \`${o}\` is not in {org}/{pipeline} form.`,ok:!1};const f=`${t}/v2/organizations/${encodeURIComponent(d)}/pipelines/${encodeURIComponent(c)}/builds/${String(r)}/annotations`;try{const u=await e(f,{body:JSON.stringify({body:s,context:i,style:n}),headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json"},method:"POST"});if(!u.ok){const l=await u.text().catch(()=>"");return{error:`Buildkite REST returned ${String(u.status)}: ${l.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(u){return{error:u instanceof Error?u.message:String(u),ok:!1}}},ot=async(e,t,o,r)=>{const s=t.buildId?`vis-ai-heal-${t.buildId}`:"vis-ai-heal",n="info",i=await tt(o,e,n,s);if(i.exitCode===0)return{method:"buildkite-cli",posted:!0};if(!t.apiBaseUrl||!t.repo||t.buildNumber===void 0||!t.token){const d=[];return t.repo||d.push("BUILDKITE_ORGANIZATION_SLUG / BUILDKITE_PIPELINE_SLUG"),t.buildNumber===void 0&&d.push("BUILDKITE_BUILD_NUMBER"),t.token||d.push("BUILDKITE_API_TOKEN (with `write_build_annotations` scope)"),{error:`buildkite-agent annotate exited ${String(i.exitCode)} (${i.stderr.trim().slice(0,200)}); cannot fall back to REST without ${d.join(", ")}`,method:"buildkite-cli",posted:!1}}const a=await et(r,t.apiBaseUrl,t.repo,t.buildNumber,e,n,s,t.token);return a.ok?{method:"rest",posted:!0}:{error:`buildkite-agent annotate exited ${String(i.exitCode)}; REST fallback also failed: ${a.error??"unknown"}`,method:"rest",posted:!1}},rt=async(e,t,o,r)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};const s=await Q(o,t.prNumber,e,t.repo);if(s.exitCode===0)return{method:"gh-cli",posted:!0};if(!t.repo||!t.token)return{error:`gh exited ${String(s.exitCode)} (${s.stderr.trim().slice(0,200)}); cannot fall back to REST without GITHUB_REPOSITORY + GITHUB_TOKEN`,method:"gh-cli",posted:!1};const n=await Z(r,t.repo,t.prNumber,e,t.token);return n.ok?{method:"rest",posted:!0}:{error:`gh exited ${String(s.exitCode)}; REST fallback also failed: ${n.error??"unknown"}`,method:"rest",posted:!1}},it=async(e,t,o)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};if(!t.apiBaseUrl||!t.repo)return{error:"GitLab CI context is missing CI_API_V4_URL or CI_PROJECT_ID; cannot post note.",method:"rest",posted:!1};if(!t.token)return{error:"GitLab CI context has no token. CI_JOB_TOKEN cannot post MR notes — set GITLAB_TOKEN to a personal/project access token with `api` scope.",method:"rest",posted:!1};const r=await W(o,t.apiBaseUrl,t.repo,t.prNumber,e,t.token);return r.ok?{method:"rest",posted:!0}:{error:r.error,method:"rest",posted:!1}},nt=async e=>{const{body:t,buildkiteAgentBin:o="buildkite-agent",context:r,fetchImpl:s=globalThis.fetch,ghBin:n="gh"}=e;return r.provider==="github-actions"?await rt(t,r,n,s):r.provider==="gitlab-ci"?await it(t,r,s):r.provider==="buildkite"?await ot(t,r,o,s):{method:"skipped",posted:!1}},b=e=>{let t=0,o=0;for(const r of e)r.status==="applied"?t+=1:o+=1;return{applied:t,failed:o}},k=(e,t,o)=>{const r=K(e,t,o),s=O(e,r);return s===""||s.startsWith("..")?r:s},st=(e,t,o,r)=>new Promise(s=>{const n=process.argv[1];if(!n){s({exitCode:-1,stderr:"Cannot locate vis bin (process.argv[1] missing).",stdout:""});return}const i=[n,"run",o,"--projects",t,"--no-cache","--summarize","--fail-fast"],a=h(process.execPath,i,{cwd:e,env:{...process.env,NO_COLOR:"1"},stdio:["ignore","pipe","pipe"]});let d="",c="";const f=setTimeout(()=>{a.kill("SIGTERM"),setTimeout(()=>a.kill("SIGKILL"),2e3).unref()},r);a.stdout?.setEncoding("utf8"),a.stdout?.on("data",u=>{d+=u}),a.stderr?.setEncoding("utf8"),a.stderr?.on("data",u=>{c+=u}),a.once("error",u=>{clearTimeout(f),s({exitCode:-1,stderr:u.message,stdout:d})}),a.once("close",u=>{clearTimeout(f),s({exitCode:u??-1,stderr:c,stdout:d})})}),at=6e4,T=e=>{let t=0;const o=e.match(/`{3,}/g);if(o)for(const r of o)t=Math.max(t,r.length);return"`".repeat(Math.max(3,t+1))},_=(e,t,o)=>{if(e.patches.length===0)return"_No patches proposed._";const r=[];for(const[s,n]of e.patches.entries()){const i=k(t,o,n.file),a=[`**[${String(s+1)}] \`${i}\`**`];n.reason&&a.push(`_${n.reason}_`);const d=T(`${n.oldString}
2
2
  ${n.newString}`);a.push(`${d}diff`);for(const c of n.oldString.split(`
3
3
  `))a.push(`- ${c}`);for(const c of n.newString.split(`
4
4
  `))a.push(`+ ${c}`);a.push(d),r.push(a.join(`
@@ -1,8 +1,8 @@
1
- import{createRequire as Ae}from"node:module";import{w as Ie,$ as We,e as ke,j,P as b,q as x,J as N,b as L}from"../packem_shared/index.server-sXNQYpsl.js";import{u as ue,c as B,e as Me}from"../packem_shared/vis-user-error-Bdg9NRuJ.js";import{N as R,a as _}from"../packem_shared/Table-BB8xHTU5-BLPS917D.js";import{b as Ce}from"../packem_shared/package-version-C5EPMgRw.js";let Oe;const xe=e=>(Oe??=Ae(import.meta.url))(e),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ee=e=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[t,n]=E.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return E.getBuiltinModule(e)}return xe(e)},{createRequire:Be}=Ee("node:module"),je=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,z=e=>{let[,t]=je.exec(e)??[];const n=t?t.length:0;if(n===3){const s=t.charAt(0),o=t.charAt(1),i=t.charAt(2);t=s+s+o+o+i+i}else if(n!==6)return globalThis.process?.env?.NODE_ENV!=="production"&&console.warn(`[@visulima/colorize] Invalid hex color "${e}"; expected a 3- or 6-digit hex string (e.g. "#96C" or "#E0115F"). Falling back to black.`),[0,0,0];const r=Number.parseInt(t,16);return[r>>16&255,r>>8&255,r&255]},de=(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/51)+6*Math.round(t/51)+Math.round(n/51),H=e=>{let t,n,r;if(e<8)return 30+e;if(e<16)return 90+(e-8);if(e>=232)t=n=r=((e-232)*10+8)/255;else{e-=16;const i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}const s=Math.max(t,n,r)*2;if(s===0)return 30;const o=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return s===2?o+60:o},Z=(e,t,n)=>H(de(e,t,n));function Re({onlyFirst:e=!1}={}){const t="(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(t,e?void 0:"g")}const S=(e,t,n)=>t>e?t:Math.min(e,n),m=39,f=49,X=10,ee={close:"",open:""},he=e=>{const t=e>0?(l,d)=>({close:`\x1B[${String(d)}m`,open:`\x1B[${String(l)}m`}):()=>ee,n=l=>(d,p,g)=>l(de(Number(d),Number(p),Number(g))),r=l=>d=>{const[p,g,w]=z(d);return l(p,g,w)};let s=l=>t(`38;5;${String(l)}`,m),o=l=>t(`48;5;${String(l)}`,f),i=(l,d,p)=>t(`38;2;${String(l)};${String(d)};${String(p)}`,m),a=(l,d,p)=>t(`48;2;${String(l)};${String(d)};${String(p)}`,f);e===1?(s=l=>t(H(Number(l)),m),o=l=>t(H(Number(l))+X,f),i=(l,d,p)=>t(Z(Number(l),Number(d),Number(p)),m),a=(l,d,p)=>t(Z(Number(l),Number(d),Number(p))+X,f)):e===2&&(i=n(s),a=n(o));const u={bold:t(1,22),dim:t(2,22),hidden:t(8,28),inverse:t(7,27),italic:t(3,23),overline:t(53,55),reset:t(0,0),strike:t(9,29),strikethrough:t(9,29),underline:t(4,24),underlineCurly:t("4:3",24),underlineDashed:t("4:5",24),underlineDotted:t("4:4",24),underlineDouble:t("4:2",24),visible:ee},c={bgBlack:t(40,f),bgBlackBright:t(100,f),bgBlue:t(44,f),bgBlueBright:t(104,f),bgCyan:t(46,f),bgCyanBright:t(106,f),bgGray:t(100,f),bgGreen:t(42,f),bgGreenBright:t(102,f),bgGrey:t(100,f),bgMagenta:t(45,f),bgMagentaBright:t(105,f),bgRed:t(41,f),bgRedBright:t(101,f),bgWhite:t(47,f),bgWhiteBright:t(107,f),bgYellow:t(43,f),bgYellowBright:t(103,f),black:t(30,m),blackBright:t(90,m),blue:t(34,m),blueBright:t(94,m),cyan:t(36,m),cyanBright:t(96,m),gray:t(90,m),green:t(32,m),greenBright:t(92,m),grey:t(90,m),magenta:t(35,m),magentaBright:t(95,m),red:t(31,m),redBright:t(91,m),white:t(37,m),whiteBright:t(97,m),yellow:t(33,m),yellowBright:t(93,m)},h={bg:l=>o(S(l,0,255)),bgHex:r(a),bgRgb:(l,d,p)=>a(S(l,0,255),S(d,0,255),S(p,0,255)),fg:l=>s(S(l,0,255)),hex:r(i),rgb:(l,d,p)=>i(S(l,0,255),S(d,0,255),S(p,0,255))};return{baseColors:c,baseStyles:u,styleMethods:h}},pe=Ie();We();he(pe);const _e=(e,t,n)=>{if(t==="")return e;let r=e.indexOf(t);if(r<0)return e;const s=t.length;let o=0,i="";for(;~r;)i+=e.slice(o,r)+n,o=r+s,r=e.indexOf(t,o);return i+e.slice(o)},Pe=(e,t,n)=>{if(e==null||e==="")return"";let r;if(e.raw===void 0?r=String(e):r=String.raw(e,...t),r.includes("\x1B"))for(let s=n;s;s=s.props)r=_e(r,s.close,s.open);return r.includes(`
2
- `)&&(r=r.replace(/(\r*\n)/g,`${n.closeStack}$1${n.openStack}`)),n.openStack+r+n.closeStack},Te=function(e){const t=e?.level??pe,{baseColors:n,baseStyles:r,styleMethods:s}=he(t),o={};let i=null;const a=({props:c},{close:h,open:l})=>{const d=(c?.openStack??"")+l,p=h+(c?.closeStack??""),g=(w,...y)=>Pe(w,y,g.props);return Object.setPrototypeOf(g,i),g.props={close:h,closeStack:p,open:l,openStack:d,props:c},g.open=d,g.close=p,g},u=c=>String(c);u.strip=c=>c.replaceAll(Re(),"");for(const c in n)o[c]={get(){const h=a(this,n[c]);return Object.defineProperty(this,c,{value:h}),h}};for(const c in r)o[c]={get(){const h=a(this,r[c]);return Object.defineProperty(this,c,{value:h}),h}};for(const c in s)o[c]={get(){return(...h)=>a(this,s[c](...h))}};return o.ansi256=o.fg,o.bgAnsi256=o.bg,i=Object.defineProperties({},o),Object.setPrototypeOf(u,i),u},Le=e=>(t,...n)=>{if(!Array.isArray(t)||!Array.isArray(t.raw))throw new TypeError("A tagged template literal must be provided");const r=[t.raw[0]];for(let s=1;s<t.raw.length;s+=1)r.push(String(n[s-1]).replaceAll(/[{}\\]/g,String.raw`\$&`),String(t.raw[s]));return e(r.join(""))},Fe=new Map([["0","\0"],["\\","\\"],["a","\x07"],["b","\b"],["e","\x1B"],["f","\f"],["n",`
3
- `],["r","\r"],["t"," "],["v","\v"]]),me=e=>{const t=e.startsWith("u"),n=e[1]==="{";return t&&!n&&e.length===5||e.startsWith("x")&&e.length===3?String.fromCodePoint(Number.parseInt(e.slice(1),16)):t&&n?String.fromCodePoint(Number.parseInt(e.slice(2,-1),16)):Fe.get(e)??e},De=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|\{(~)?(#?[\w:]+(?:\([^)]*\))?(?:\.#?[\w:]+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n))|(\})|((?:.|[\r\n\f])+?)/gi,te=/(?:^|\.)(?:(\w+)(?:\(([^)]*)\))?|#(?=[:a-f\d]{2,})([a-f\d]{6})?(?::([a-f\d]{6}))?)/gi,Ve=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,qe=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,Ue=/\s*,\s*/,Ge=(e,t)=>{const n=[],r=t.trim().split(Ue);let s;for(const o of r){const i=Number(o);if(!Number.isNaN(i))n.push(i);else if(s=Ve.exec(o))n.push(s[2].replaceAll(qe,(a,u,c)=>u?me(u):c));else throw new Error(`Invalid template style argument: ${o} (in style '${e}')`)}return n},ze=e=>{te.lastIndex=0;const t=[];let n;for(;(n=te.exec(e))!==null;){const r=n[1];n[2]?t.push([r,...Ge(r,n[2])]):n[3]||n[4]?(n[3]&&t.push(["rgb",...z(n[3])]),n[4]&&t.push(["bgRgb",...z(n[4])])):t.push([r])}return t},ne=(e,t)=>{const n={};for(const s of t)for(const o of s.styles)n[o[0]]=s.inverse?void 0:o.slice(1);let r=e;for(const[s,o]of Object.entries(n))if(Array.isArray(o)){if(!(s in r))throw new Error(`Unknown style: ${s}`);r=o.length>0?r[s](...o):r[s]}return r},He=e=>t=>{const n=[],r=[];let s=[];if(t.replaceAll(De,(o,i,a,u,c,h)=>{if(i)s.push(me(i));else if(u){const l=s.join("");s=[],r.push(n.length===0?l:ne(e,n)(l)),n.push({inverse:a,styles:ze(u)})}else if(c){if(n.length===0)throw new Error("Found extraneous } in template literal");r.push(ne(e,n)(s.join(""))),s=[],n.pop()}else s.push(h)}),r.push(s.join("")),n.length>0)throw new Error(`template literal is missing ${String(n.length)} closing bracket${n.length===1?"":"s"} (\`}\`)`);return r.join("")},Ye=new Te,Je=He(Ye),Ke=Le(Je);let Qe;const Ze=e=>(Qe??=Be(import.meta.url))(e),O=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:A,F=e=>{if(typeof O<"u"&&O.versions&&O.versions.node){const[t,n]=O.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return O.getBuiltinModule(e)}return Ze(e)},A=O,{execFileSync:Xe}=F("node:child_process"),W=F("node:fs"),et=F("node:tty"),tt=F("node:os"),nt=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],rt=12288,ot=65510,it=[12288,12288,65281,65376,65504,65510],st=8361,at=65518,lt=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],ct=32,ut=10630,dt=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],ht=4352,pt=262141,fe=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],k=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){const s=Math.floor((n+r)/2),o=s*2;if(t<e[o])r=s-1;else if(t>e[o+1])n=s+1;else return!0}return!1},re=19968,[mt,ft]=gt(fe);function gt(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){const s=e[r],o=e[r+1];if(re>=s&&re<=o)return[s,o];o-s>n-t&&(t=s,n=o)}return[t,n]}const wt=e=>e<161||e>1114109?!1:k(nt,e),bt=e=>e<rt||e>ot?!1:k(it,e),yt=e=>e<st||e>at?!1:k(lt,e),$t=e=>e<ct||e>ut?!1:k(dt,e),Nt=e=>e>=mt&&e<=ft?!0:e<ht||e>pt?!1:k(fe,e);function vt(e){return wt(e)?"ambiguous":bt(e)?"fullwidth":yt(e)?"halfwidth":$t(e)?"narrow":Nt(e)?"wide":"neutral"}function St(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function ge(e){return St(e),vt(e)}const oe=new Map,At=e=>[e.ambiguousIsNarrow?1:0,e.control,e.fullWidth,e.regular,e.wide].join("|"),Ot=e=>{const t=At(e.width);let n=oe.get(t);return n||(n=new Map,oe.set(t,n)),n},M=new RegExp(ue.source,"y"),U=new RegExp(Me.source,"uy"),C=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,we=e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other",xt=(e,t)=>{const n=Ot(t),r=Math.floor(e/65536),s=e%65536;let o=n.get(r);if(o||(o=new Map,n.set(r,o)),o.has(s))return o.get(s);let i;switch(we(e)){case"control":{i=t.width.control;break}case"latin":{i=t.width.regular;break}case"wide":{i=t.width.wide;break}case"zero":{i=0;break}default:switch(ge(e)){case"ambiguous":{i=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{i=t.width.fullWidth;break}case"wide":{i=t.width.wide;break}default:i=t.width.regular}}return o.set(s,i),i},Et=e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,Y=(e,t={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const n={truncation:{countAnsiEscapeCodes:t.countAnsiEscapeCodes??!1,ellipsis:t.ellipsis??"",ellipsisWidth:t.ellipsisWidth??(t.ellipsis?Y(t.ellipsis,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:t.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:t.ambiguousIsNarrow??!1,ansi:t.ansiWidth??0,control:t.controlWidth??0,emoji:t.emojiWidth??2,fullWidth:t.fullWidth??2,halfWidth:t.halfWidth??1,regular:t.regularWidth??1,tab:t.tabWidth??8,wide:t.wideWidth??2}},r=Math.max(0,n.truncation.limit-n.truncation.ellipsisWidth),{length:s}=e,o=s>1e4;let i=0,a=0,u=s,c=!1;const h=e.includes("\x1B")||e.includes("›");for(;i<s;){if(h&&(e[i]==="\x1B"||e[i]==="›")){if(e.startsWith("\x1B]8;;",i)){const y="\x1B]8;;\x07",v=y.length,D=e.indexOf("\x07",i+5);if(D!==-1){const V=e.indexOf(y,D+1);if(V!==-1){const ve=V+v,Se=e.slice(D+1,V).replace(ue,""),Q=Y(Se,{ambiguousIsNarrow:n.width.ambiguousIsNarrow,ansiWidth:n.width.ansi,controlWidth:n.width.control,countAnsiEscapeCodes:!1,ellipsis:n.truncation.ellipsis,ellipsisWidth:n.truncation.ellipsisWidth,emojiWidth:n.width.emoji,fullWidth:n.width.fullWidth,halfWidth:n.width.halfWidth,limit:Math.max(0,r-a),regularWidth:n.width.regular,tabWidth:n.width.tab,wideWidth:n.width.wide}),q=Q.width;if(Q.truncated)c=!0,u=Math.min(u,i);else if(a+q>r&&(u=Math.min(u,i),c=!0,a+q>n.truncation.limit))break;if(a+=q,i=ve,c&&a>=n.truncation.limit)break;continue}}}if(M.lastIndex=i,M.test(e)){const y=M.lastIndex-i,v=n.truncation.countAnsiEscapeCodes?y:n.width.ansi;if(a+v>r&&(u=Math.min(u,i),a+v>n.truncation.limit)){c=!0;break}a+=v,i=M.lastIndex;continue}}const p=e.codePointAt(i);if(p===8203||p===65279||p>=8288&&p<=8292){i+=1;continue}if(p===9){if(a+n.width.tab>r&&(u=Math.min(u,i),a+n.width.tab>n.truncation.limit)){c=!0;break}a+=n.width.tab,i+=1;continue}if(C.lastIndex=i,C.test(e)){const y=(C.lastIndex-i)*n.width.regular;if(a+y>r){const v=n.width.regular>0?Math.floor((r-a)/n.width.regular):0;if(u=Math.min(u,i+v),a+y>n.truncation.limit){c=!0;break}}a+=y,i=C.lastIndex;continue}if((p<=31||p>=127&&p<=159)&&(B.lastIndex=i,B.test(e))){const y=(B.lastIndex-i)*n.width.control;if(a+y>r){const v=n.width.control>0?Math.floor((r-a)/n.width.control):0;if(u=Math.min(u,i+v),a+y>n.truncation.limit){c=!0;break}}a+=y,i=B.lastIndex;continue}if(U.lastIndex=i,U.test(e)){if(a+n.width.emoji>r&&(u=Math.min(u,i),a+n.width.emoji>n.truncation.limit)){c=!0;break}a+=n.width.emoji,i=U.lastIndex;continue}const g=e.codePointAt(i)??0;if(Et(g)){i+=g>65535?2:1;continue}let w;if(o)w=xt(g,n);else switch(we(g)){case"control":{w=n.width.control;break}case"latin":{w=n.width.regular;break}case"wide":{w=n.width.wide;break}case"zero":{w=0;break}default:switch(ge(g)){case"ambiguous":{w=n.width.ambiguousIsNarrow?n.width.regular:n.width.wide;break}case"fullwidth":{w=n.width.fullWidth;break}case"wide":{w=n.width.wide;break}default:w=n.width.regular}}if(a+w>r&&(u=Math.min(u,i),a+w>n.truncation.limit)){c=!0;break}a+=w,i+=g>65535?2:1}let l=a,d=!1;return c&&n.truncation.limit>=n.truncation.ellipsisWidth&&(l=n.truncation.limit,d=!0),{ellipsed:d,index:c?u:s,truncated:c,width:l}},It=(e,t={})=>Y(e,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,be=80,ye=24,J=(e,t,{shell:n,env:r}={})=>Xe(e,t,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:n,env:r}).trim(),P=(e,t)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(t,10)}),$e=(e,t)=>{const{columns:n,rows:r}=P(e,t);if(!(Number.isNaN(n)||Number.isNaN(r))&&!(n===be&&r===ye))return{columns:n,rows:r}},Wt=()=>{if(A.platform!=="linux")return!0;try{const e=W.readFileSync("/proc/self/stat","utf8"),t=e.lastIndexOf(") ");if(t===-1)return!1;const n=e.slice(t+2).trim().split(/\s+/),r=Number.parseInt(n[2],10),s=Number.parseInt(n[5],10);return Number.isNaN(r)||Number.isNaN(s)||s<=0?!1:r===s}catch{return!1}};function kt(){const{env:e,stdout:t,stderr:n}=A;if(t?.columns&&t?.rows)return P(t.columns,t.rows);if(n?.columns&&n?.rows)return P(n.columns,n.rows);if(e.COLUMNS&&e.LINES)return P(e.COLUMNS,e.LINES);const r={columns:be,rows:ye};return A.platform==="win32"?G()??r:A.platform==="darwin"?ie()??G()??r:ie()??G()??Bt()??r}const ie=()=>{try{const e=A.platform==="darwin"?W.constants.O_EVTONLY|W.constants.O_NONBLOCK:W.constants.O_NONBLOCK,{columns:t,rows:n}=et.WriteStream(W.openSync("/dev/tty",e));return{columns:t,rows:n}}catch{}},G=()=>{try{const e=J("tput",["cols"],{env:{TERM:"dumb",...A.env}}),t=J("tput",["lines"],{env:{TERM:"dumb",...A.env}});if(e&&t)return $e(e,t)}catch{}},Bt=()=>{try{if(!Wt())return;const e=J("resize",["-u"]).match(/\d+/g);if(e.length===2)return $e(e[0],e[1])}catch{}},I=new Map,Mt=500,$=e=>{if(!e||e==="")return"";const t=I.get(e);if(t!==void 0)return t;let n;try{n=Ke(Object.assign([],{raw:[e]}))}catch{n=e}if(I.size>=Mt){const r=I.keys().next().value;r!==void 0&&I.delete(r)}return I.set(e,n),n},T=()=>{const e=Ce().CEREBRO_TERMINAL_WIDTH;if(e===void 0)return;const t=Number.parseInt(e,10);if(!(Number.isNaN(t)||t<=0))return t};class Ne{lines;constructor(){this.lines=[]}add(t){this.lines.push(t)}toString(){return this.lines.join(tt.EOL)}header(t){this.add(j(t)),this.lines.push("")}}const Ct=e=>e!==void 0&&e>0?e:kt().columns,jt=(e,t,n,r)=>{if(e.length===0||e.some(c=>c.length!==2))return;let s=0;for(const c of e){const h=c[0];if(h===void 0)continue;const l=It(h);l>s&&(s=l)}if(s===0)return;const o=n+r,i=s+o,a=20+o;if(i+a>t)return;const u=t-i;return[i,u]};class Rt extends Ne{constructor(t){if(super(),t.header&&this.header($(t.header)),t.content){if(t.raw)if(Array.isArray(t.content)&&t.content.every(n=>typeof n=="string"))t.content.forEach(n=>{Array.isArray(n)?n.forEach(r=>{this.add($(r))}):this.add($(n))});else if(typeof t.content=="string")this.add($(t.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(t.content));this.add("")}}getContentLines(t){if(typeof t=="string"){const n=R({showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:T(),truncateOverflow:!1,wordWrap:!0});return n.addRow([$(t)]),n.toString()}if(Array.isArray(t)&&t.every(n=>typeof n=="string"||Array.isArray(n)&&n.every(r=>typeof r=="string"))){const n=Ct(T()),r=a=>Array.isArray(a)?a.map(u=>$(u)):[$(a)],s=t.map(a=>r(a)),o=jt(s,n,4,1),i=R({columnWidths:o,showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:n,truncateOverflow:!1,wordWrap:!0});return s.forEach(a=>{o!==void 0&&a.length===2?i.addRow([{content:a[0],wordWrap:!1},a[1]]):i.addRow(a)}),i.toString()}if(typeof t=="object"){const n=t;if(!n.options||!n.data)throw new Error(`Must have an "options" or "data" property
4
- ${JSON.stringify(t)}`);const r=R({showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:T(),truncateOverflow:!1,wordWrap:!0});return n.data.forEach(s=>{Array.isArray(s)?r.addRow(s.map(o=>$(o))):r.addRow([$(s)])}),r.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
1
+ import{createRequire as At}from"node:module";import{w as It,$ as Wt,e as kt,j,P as b,q as x,J as N,b as L}from"../packem_shared/index.server-sXNQYpsl.js";import{u as ut,c as B,e as Mt}from"../packem_shared/vis-user-error-75VtCwMv.js";import{N as R,a as _}from"../packem_shared/Table-BB8xHTU5-BLPS917D.js";import{b as Ct}from"../packem_shared/package-version-Dxirp-UO.js";let Ot;const xt=t=>(Ot??=At(import.meta.url))(t),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Et=t=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[e,n]=E.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return E.getBuiltinModule(t)}return xt(t)},{createRequire:Bt}=Et("node:module"),jt=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,z=t=>{let[,e]=jt.exec(t)??[];const n=e?e.length:0;if(n===3){const s=e.charAt(0),o=e.charAt(1),i=e.charAt(2);e=s+s+o+o+i+i}else if(n!==6)return globalThis.process?.env?.NODE_ENV!=="production"&&console.warn(`[@visulima/colorize] Invalid hex color "${t}"; expected a 3- or 6-digit hex string (e.g. "#96C" or "#E0115F"). Falling back to black.`),[0,0,0];const r=Number.parseInt(e,16);return[r>>16&255,r>>8&255,r&255]},dt=(t,e,n)=>t===e&&e===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/51)+6*Math.round(e/51)+Math.round(n/51),H=t=>{let e,n,r;if(t<8)return 30+t;if(t<16)return 90+(t-8);if(t>=232)e=n=r=((t-232)*10+8)/255;else{t-=16;const i=t%36;e=Math.floor(t/36)/5,n=Math.floor(i/6)/5,r=i%6/5}const s=Math.max(e,n,r)*2;if(s===0)return 30;const o=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(e));return s===2?o+60:o},Z=(t,e,n)=>H(dt(t,e,n));function Rt({onlyFirst:t=!1}={}){const e="(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,t?void 0:"g")}const S=(t,e,n)=>e>t?e:Math.min(t,n),m=39,f=49,X=10,tt={close:"",open:""},ht=t=>{const e=t>0?(l,d)=>({close:`\x1B[${String(d)}m`,open:`\x1B[${String(l)}m`}):()=>tt,n=l=>(d,p,g)=>l(dt(Number(d),Number(p),Number(g))),r=l=>d=>{const[p,g,w]=z(d);return l(p,g,w)};let s=l=>e(`38;5;${String(l)}`,m),o=l=>e(`48;5;${String(l)}`,f),i=(l,d,p)=>e(`38;2;${String(l)};${String(d)};${String(p)}`,m),a=(l,d,p)=>e(`48;2;${String(l)};${String(d)};${String(p)}`,f);t===1?(s=l=>e(H(Number(l)),m),o=l=>e(H(Number(l))+X,f),i=(l,d,p)=>e(Z(Number(l),Number(d),Number(p)),m),a=(l,d,p)=>e(Z(Number(l),Number(d),Number(p))+X,f)):t===2&&(i=n(s),a=n(o));const u={bold:e(1,22),dim:e(2,22),hidden:e(8,28),inverse:e(7,27),italic:e(3,23),overline:e(53,55),reset:e(0,0),strike:e(9,29),strikethrough:e(9,29),underline:e(4,24),underlineCurly:e("4:3",24),underlineDashed:e("4:5",24),underlineDotted:e("4:4",24),underlineDouble:e("4:2",24),visible:tt},c={bgBlack:e(40,f),bgBlackBright:e(100,f),bgBlue:e(44,f),bgBlueBright:e(104,f),bgCyan:e(46,f),bgCyanBright:e(106,f),bgGray:e(100,f),bgGreen:e(42,f),bgGreenBright:e(102,f),bgGrey:e(100,f),bgMagenta:e(45,f),bgMagentaBright:e(105,f),bgRed:e(41,f),bgRedBright:e(101,f),bgWhite:e(47,f),bgWhiteBright:e(107,f),bgYellow:e(43,f),bgYellowBright:e(103,f),black:e(30,m),blackBright:e(90,m),blue:e(34,m),blueBright:e(94,m),cyan:e(36,m),cyanBright:e(96,m),gray:e(90,m),green:e(32,m),greenBright:e(92,m),grey:e(90,m),magenta:e(35,m),magentaBright:e(95,m),red:e(31,m),redBright:e(91,m),white:e(37,m),whiteBright:e(97,m),yellow:e(33,m),yellowBright:e(93,m)},h={bg:l=>o(S(l,0,255)),bgHex:r(a),bgRgb:(l,d,p)=>a(S(l,0,255),S(d,0,255),S(p,0,255)),fg:l=>s(S(l,0,255)),hex:r(i),rgb:(l,d,p)=>i(S(l,0,255),S(d,0,255),S(p,0,255))};return{baseColors:c,baseStyles:u,styleMethods:h}},pt=It();Wt();ht(pt);const _t=(t,e,n)=>{if(e==="")return t;let r=t.indexOf(e);if(r<0)return t;const s=e.length;let o=0,i="";for(;~r;)i+=t.slice(o,r)+n,o=r+s,r=t.indexOf(e,o);return i+t.slice(o)},Pt=(t,e,n)=>{if(t==null||t==="")return"";let r;if(t.raw===void 0?r=String(t):r=String.raw(t,...e),r.includes("\x1B"))for(let s=n;s;s=s.props)r=_t(r,s.close,s.open);return r.includes(`
2
+ `)&&(r=r.replace(/(\r*\n)/g,`${n.closeStack}$1${n.openStack}`)),n.openStack+r+n.closeStack},Tt=function(t){const e=t?.level??pt,{baseColors:n,baseStyles:r,styleMethods:s}=ht(e),o={};let i=null;const a=({props:c},{close:h,open:l})=>{const d=(c?.openStack??"")+l,p=h+(c?.closeStack??""),g=(w,...y)=>Pt(w,y,g.props);return Object.setPrototypeOf(g,i),g.props={close:h,closeStack:p,open:l,openStack:d,props:c},g.open=d,g.close=p,g},u=c=>String(c);u.strip=c=>c.replaceAll(Rt(),"");for(const c in n)o[c]={get(){const h=a(this,n[c]);return Object.defineProperty(this,c,{value:h}),h}};for(const c in r)o[c]={get(){const h=a(this,r[c]);return Object.defineProperty(this,c,{value:h}),h}};for(const c in s)o[c]={get(){return(...h)=>a(this,s[c](...h))}};return o.ansi256=o.fg,o.bgAnsi256=o.bg,i=Object.defineProperties({},o),Object.setPrototypeOf(u,i),u},Lt=t=>(e,...n)=>{if(!Array.isArray(e)||!Array.isArray(e.raw))throw new TypeError("A tagged template literal must be provided");const r=[e.raw[0]];for(let s=1;s<e.raw.length;s+=1)r.push(String(n[s-1]).replaceAll(/[{}\\]/g,String.raw`\$&`),String(e.raw[s]));return t(r.join(""))},Ft=new Map([["0","\0"],["\\","\\"],["a","\x07"],["b","\b"],["e","\x1B"],["f","\f"],["n",`
3
+ `],["r","\r"],["t"," "],["v","\v"]]),mt=t=>{const e=t.startsWith("u"),n=t[1]==="{";return e&&!n&&t.length===5||t.startsWith("x")&&t.length===3?String.fromCodePoint(Number.parseInt(t.slice(1),16)):e&&n?String.fromCodePoint(Number.parseInt(t.slice(2,-1),16)):Ft.get(t)??t},Dt=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|\{(~)?(#?[\w:]+(?:\([^)]*\))?(?:\.#?[\w:]+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n))|(\})|((?:.|[\r\n\f])+?)/gi,et=/(?:^|\.)(?:(\w+)(?:\(([^)]*)\))?|#(?=[:a-f\d]{2,})([a-f\d]{6})?(?::([a-f\d]{6}))?)/gi,Vt=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,qt=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,Ut=/\s*,\s*/,Gt=(t,e)=>{const n=[],r=e.trim().split(Ut);let s;for(const o of r){const i=Number(o);if(!Number.isNaN(i))n.push(i);else if(s=Vt.exec(o))n.push(s[2].replaceAll(qt,(a,u,c)=>u?mt(u):c));else throw new Error(`Invalid template style argument: ${o} (in style '${t}')`)}return n},zt=t=>{et.lastIndex=0;const e=[];let n;for(;(n=et.exec(t))!==null;){const r=n[1];n[2]?e.push([r,...Gt(r,n[2])]):n[3]||n[4]?(n[3]&&e.push(["rgb",...z(n[3])]),n[4]&&e.push(["bgRgb",...z(n[4])])):e.push([r])}return e},nt=(t,e)=>{const n={};for(const s of e)for(const o of s.styles)n[o[0]]=s.inverse?void 0:o.slice(1);let r=t;for(const[s,o]of Object.entries(n))if(Array.isArray(o)){if(!(s in r))throw new Error(`Unknown style: ${s}`);r=o.length>0?r[s](...o):r[s]}return r},Ht=t=>e=>{const n=[],r=[];let s=[];if(e.replaceAll(Dt,(o,i,a,u,c,h)=>{if(i)s.push(mt(i));else if(u){const l=s.join("");s=[],r.push(n.length===0?l:nt(t,n)(l)),n.push({inverse:a,styles:zt(u)})}else if(c){if(n.length===0)throw new Error("Found extraneous } in template literal");r.push(nt(t,n)(s.join(""))),s=[],n.pop()}else s.push(h)}),r.push(s.join("")),n.length>0)throw new Error(`template literal is missing ${String(n.length)} closing bracket${n.length===1?"":"s"} (\`}\`)`);return r.join("")},Yt=new Tt,Jt=Ht(Yt),Kt=Lt(Jt);let Qt;const Zt=t=>(Qt??=Bt(import.meta.url))(t),O=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:A,F=t=>{if(typeof O<"u"&&O.versions&&O.versions.node){const[e,n]=O.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return O.getBuiltinModule(t)}return Zt(t)},A=O,{execFileSync:Xt}=F("node:child_process"),W=F("node:fs"),te=F("node:tty"),ee=F("node:os"),ne=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],re=12288,oe=65510,ie=[12288,12288,65281,65376,65504,65510],se=8361,ae=65518,le=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],ce=32,ue=10630,de=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],he=4352,pe=262141,ft=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],k=(t,e)=>{let n=0,r=Math.floor(t.length/2)-1;for(;n<=r;){const s=Math.floor((n+r)/2),o=s*2;if(e<t[o])r=s-1;else if(e>t[o+1])n=s+1;else return!0}return!1},rt=19968,[me,fe]=ge(ft);function ge(t){let e=t[0],n=t[1];for(let r=0;r<t.length;r+=2){const s=t[r],o=t[r+1];if(rt>=s&&rt<=o)return[s,o];o-s>n-e&&(e=s,n=o)}return[e,n]}const we=t=>t<161||t>1114109?!1:k(ne,t),be=t=>t<re||t>oe?!1:k(ie,t),ye=t=>t<se||t>ae?!1:k(le,t),$e=t=>t<ce||t>ue?!1:k(de,t),Ne=t=>t>=me&&t<=fe?!0:t<he||t>pe?!1:k(ft,t);function ve(t){return we(t)?"ambiguous":be(t)?"fullwidth":ye(t)?"halfwidth":$e(t)?"narrow":Ne(t)?"wide":"neutral"}function Se(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function gt(t){return Se(t),ve(t)}const ot=new Map,Ae=t=>[t.ambiguousIsNarrow?1:0,t.control,t.fullWidth,t.regular,t.wide].join("|"),Oe=t=>{const e=Ae(t.width);let n=ot.get(e);return n||(n=new Map,ot.set(e,n)),n},M=new RegExp(ut.source,"y"),U=new RegExp(Mt.source,"uy"),C=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,wt=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",xe=(t,e)=>{const n=Oe(e),r=Math.floor(t/65536),s=t%65536;let o=n.get(r);if(o||(o=new Map,n.set(r,o)),o.has(s))return o.get(s);let i;switch(wt(t)){case"control":{i=e.width.control;break}case"latin":{i=e.width.regular;break}case"wide":{i=e.width.wide;break}case"zero":{i=0;break}default:switch(gt(t)){case"ambiguous":{i=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{i=e.width.fullWidth;break}case"wide":{i=e.width.wide;break}default:i=e.width.regular}}return o.set(s,i),i},Ee=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,Y=(t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const n={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?Y(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},r=Math.max(0,n.truncation.limit-n.truncation.ellipsisWidth),{length:s}=t,o=s>1e4;let i=0,a=0,u=s,c=!1;const h=t.includes("\x1B")||t.includes("›");for(;i<s;){if(h&&(t[i]==="\x1B"||t[i]==="›")){if(t.startsWith("\x1B]8;;",i)){const y="\x1B]8;;\x07",v=y.length,D=t.indexOf("\x07",i+5);if(D!==-1){const V=t.indexOf(y,D+1);if(V!==-1){const vt=V+v,St=t.slice(D+1,V).replace(ut,""),Q=Y(St,{ambiguousIsNarrow:n.width.ambiguousIsNarrow,ansiWidth:n.width.ansi,controlWidth:n.width.control,countAnsiEscapeCodes:!1,ellipsis:n.truncation.ellipsis,ellipsisWidth:n.truncation.ellipsisWidth,emojiWidth:n.width.emoji,fullWidth:n.width.fullWidth,halfWidth:n.width.halfWidth,limit:Math.max(0,r-a),regularWidth:n.width.regular,tabWidth:n.width.tab,wideWidth:n.width.wide}),q=Q.width;if(Q.truncated)c=!0,u=Math.min(u,i);else if(a+q>r&&(u=Math.min(u,i),c=!0,a+q>n.truncation.limit))break;if(a+=q,i=vt,c&&a>=n.truncation.limit)break;continue}}}if(M.lastIndex=i,M.test(t)){const y=M.lastIndex-i,v=n.truncation.countAnsiEscapeCodes?y:n.width.ansi;if(a+v>r&&(u=Math.min(u,i),a+v>n.truncation.limit)){c=!0;break}a+=v,i=M.lastIndex;continue}}const p=t.codePointAt(i);if(p===8203||p===65279||p>=8288&&p<=8292){i+=1;continue}if(p===9){if(a+n.width.tab>r&&(u=Math.min(u,i),a+n.width.tab>n.truncation.limit)){c=!0;break}a+=n.width.tab,i+=1;continue}if(C.lastIndex=i,C.test(t)){const y=(C.lastIndex-i)*n.width.regular;if(a+y>r){const v=n.width.regular>0?Math.floor((r-a)/n.width.regular):0;if(u=Math.min(u,i+v),a+y>n.truncation.limit){c=!0;break}}a+=y,i=C.lastIndex;continue}if((p<=31||p>=127&&p<=159)&&(B.lastIndex=i,B.test(t))){const y=(B.lastIndex-i)*n.width.control;if(a+y>r){const v=n.width.control>0?Math.floor((r-a)/n.width.control):0;if(u=Math.min(u,i+v),a+y>n.truncation.limit){c=!0;break}}a+=y,i=B.lastIndex;continue}if(U.lastIndex=i,U.test(t)){if(a+n.width.emoji>r&&(u=Math.min(u,i),a+n.width.emoji>n.truncation.limit)){c=!0;break}a+=n.width.emoji,i=U.lastIndex;continue}const g=t.codePointAt(i)??0;if(Ee(g)){i+=g>65535?2:1;continue}let w;if(o)w=xe(g,n);else switch(wt(g)){case"control":{w=n.width.control;break}case"latin":{w=n.width.regular;break}case"wide":{w=n.width.wide;break}case"zero":{w=0;break}default:switch(gt(g)){case"ambiguous":{w=n.width.ambiguousIsNarrow?n.width.regular:n.width.wide;break}case"fullwidth":{w=n.width.fullWidth;break}case"wide":{w=n.width.wide;break}default:w=n.width.regular}}if(a+w>r&&(u=Math.min(u,i),a+w>n.truncation.limit)){c=!0;break}a+=w,i+=g>65535?2:1}let l=a,d=!1;return c&&n.truncation.limit>=n.truncation.ellipsisWidth&&(l=n.truncation.limit,d=!0),{ellipsed:d,index:c?u:s,truncated:c,width:l}},Ie=(t,e={})=>Y(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,bt=80,yt=24,J=(t,e,{shell:n,env:r}={})=>Xt(t,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:n,env:r}).trim(),P=(t,e)=>({columns:Number.parseInt(t,10),rows:Number.parseInt(e,10)}),$t=(t,e)=>{const{columns:n,rows:r}=P(t,e);if(!(Number.isNaN(n)||Number.isNaN(r))&&!(n===bt&&r===yt))return{columns:n,rows:r}},We=()=>{if(A.platform!=="linux")return!0;try{const t=W.readFileSync("/proc/self/stat","utf8"),e=t.lastIndexOf(") ");if(e===-1)return!1;const n=t.slice(e+2).trim().split(/\s+/),r=Number.parseInt(n[2],10),s=Number.parseInt(n[5],10);return Number.isNaN(r)||Number.isNaN(s)||s<=0?!1:r===s}catch{return!1}};function ke(){const{env:t,stdout:e,stderr:n}=A;if(e?.columns&&e?.rows)return P(e.columns,e.rows);if(n?.columns&&n?.rows)return P(n.columns,n.rows);if(t.COLUMNS&&t.LINES)return P(t.COLUMNS,t.LINES);const r={columns:bt,rows:yt};return A.platform==="win32"?G()??r:A.platform==="darwin"?it()??G()??r:it()??G()??Be()??r}const it=()=>{try{const t=A.platform==="darwin"?W.constants.O_EVTONLY|W.constants.O_NONBLOCK:W.constants.O_NONBLOCK,{columns:e,rows:n}=te.WriteStream(W.openSync("/dev/tty",t));return{columns:e,rows:n}}catch{}},G=()=>{try{const t=J("tput",["cols"],{env:{TERM:"dumb",...A.env}}),e=J("tput",["lines"],{env:{TERM:"dumb",...A.env}});if(t&&e)return $t(t,e)}catch{}},Be=()=>{try{if(!We())return;const t=J("resize",["-u"]).match(/\d+/g);if(t.length===2)return $t(t[0],t[1])}catch{}},I=new Map,Me=500,$=t=>{if(!t||t==="")return"";const e=I.get(t);if(e!==void 0)return e;let n;try{n=Kt(Object.assign([],{raw:[t]}))}catch{n=t}if(I.size>=Me){const r=I.keys().next().value;r!==void 0&&I.delete(r)}return I.set(t,n),n},T=()=>{const t=Ct().CEREBRO_TERMINAL_WIDTH;if(t===void 0)return;const e=Number.parseInt(t,10);if(!(Number.isNaN(e)||e<=0))return e};class Nt{lines;constructor(){this.lines=[]}add(e){this.lines.push(e)}toString(){return this.lines.join(ee.EOL)}header(e){this.add(j(e)),this.lines.push("")}}const Ce=t=>t!==void 0&&t>0?t:ke().columns,je=(t,e,n,r)=>{if(t.length===0||t.some(c=>c.length!==2))return;let s=0;for(const c of t){const h=c[0];if(h===void 0)continue;const l=Ie(h);l>s&&(s=l)}if(s===0)return;const o=n+r,i=s+o,a=20+o;if(i+a>e)return;const u=e-i;return[i,u]};class Re extends Nt{constructor(e){if(super(),e.header&&this.header($(e.header)),e.content){if(e.raw)if(Array.isArray(e.content)&&e.content.every(n=>typeof n=="string"))e.content.forEach(n=>{Array.isArray(n)?n.forEach(r=>{this.add($(r))}):this.add($(n))});else if(typeof e.content=="string")this.add($(e.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(e.content));this.add("")}}getContentLines(e){if(typeof e=="string"){const n=R({showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:T(),truncateOverflow:!1,wordWrap:!0});return n.addRow([$(e)]),n.toString()}if(Array.isArray(e)&&e.every(n=>typeof n=="string"||Array.isArray(n)&&n.every(r=>typeof r=="string"))){const n=Ce(T()),r=a=>Array.isArray(a)?a.map(u=>$(u)):[$(a)],s=e.map(a=>r(a)),o=je(s,n,4,1),i=R({columnWidths:o,showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:n,truncateOverflow:!1,wordWrap:!0});return s.forEach(a=>{o!==void 0&&a.length===2?i.addRow([{content:a[0],wordWrap:!1},a[1]]):i.addRow(a)}),i.toString()}if(typeof e=="object"){const n=e;if(!n.options||!n.data)throw new Error(`Must have an "options" or "data" property
4
+ ${JSON.stringify(e)}`);const r=R({showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:T(),truncateOverflow:!1,wordWrap:!0});return n.data.forEach(s=>{Array.isArray(s)?r.addRow(s.map(o=>$(o))):r.addRow([$(s)])}),r.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
5
5
 
6
- ${JSON.stringify(t)}`)}}class _t extends Ne{constructor(t){super();let n=t.optionList??[];const r=Array.isArray(t.hide)?t.hide:[t.hide].filter(i=>typeof i=="string"),s=Array.isArray(t.group)?t.group:[t.group].filter(i=>typeof i=="string");r.length>0&&(n=n.filter(i=>!r.includes(i.name))),t.header&&this.header($(t.header)),s.length>0&&(n=n.filter(i=>{const a=i,u=s.includes("_none")&&!a.group,c=a.group,h=this.intersect(Array.isArray(c)?c:[c],s);return u||h?i:void 0}));const o=R({showHeader:!1,style:{border:_,paddingLeft:2,paddingRight:1,...t.tableOptions?.style},terminalWidth:T()??t.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:t.tableOptions?.wordWrap??!0,...t.tableOptions});n.forEach(i=>{const a=i;o.addRow([this.getOptionNames(a,t.reverseNameOrder??!1,t.isArgument??!1),$(a.description)])}),this.add(o.toString()),this.lines.push("")}getOptionNames(t,n,r){if(!t.name)throw new TypeError("Invalid option definition, name is required.");const s=t.type?t.type.name.toLowerCase():"string",{lazyMultiple:o}=t,i=t.multiple||o?"[]":"",a=t.typeLabel===void 0?ke(`${s}${i}`):$(t.typeLabel),u=r?j(t.name):j.yellow(`--${t.name}`),c=t.alias;if(c){const h=j(`-${c}`);return n?`${u}, ${h} ${a}`:`${h}, ${u} ${a}`}return`${u} ${a}`}intersect(t,n){return t.some(r=>n.includes(r))}}const K=e=>(Array.isArray(e)?e:[e]).length===0?"":`
7
- ${e.map(t=>t.optionList?new _t(t).toString():new Rt(t).toString()).join(`
8
- `)}`,se=(e,t)=>{const n=`${t==="readme"?e.name.toUpperCase():e.name}${e.multiple===!0?"...":""}`;return e.required===!0?t==="readme"?n:`<${n}>`:`[${n}]`},Pt=(e,t="help")=>e.argument?e.argument.hidden?"":t==="readme"?` ${se(e.argument,t)}`:" [positional arguments]":!e.arguments||e.arguments.length===0?"":e.arguments.filter(n=>!n.hidden).map(n=>` ${se(n,t)}`).join(""),Tt=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}],ae="__Other",le=e=>e.charAt(0).toUpperCase()+e.slice(1),Lt=(e,t,n,r)=>{e.debug("no command given, printing general help...");let s=[...new Set(n.values())].filter(a=>!a.hidden);r&&(s=s.filter(a=>a.group===r));const o=s.reduce((a,u)=>{const c=u.group??ae;return a[c]??=[],a[c].push(u),a},{}),i=a=>a.map(u=>{let c="";typeof u.alias=="string"?c=u.alias:Array.isArray(u.alias)&&(c=u.alias.join(", ")),c!==""&&(c=` [${c}]`);let h=u.name;return u.commandPath&&u.commandPath.length>0&&(h=`${u.commandPath.join(" ")} ${u.name}`),[`${N(h)}${c}`,u.description??""]});(e.raw??e.log)(K([{content:`${x(t.getCliName())} ${N("<command>")} [positional arguments] ${L("[options]")}`,header:b.cyan(" Usage ")},...Object.keys(o).map(a=>{const u=r?` ${le(r)}`:"";return{content:i(o[a]),header:a===ae||r?b.green(` Available${u} Commands `):` ${b.green(` ${le(a)} `)}`}}),n.has("help")?{header:b.yellow(" Command Options "),optionList:n.get("help").options?.filter(a=>!a.hidden)}:void 0,{header:b.yellow(" Global Options "),optionList:t.getGlobalOptions()},{content:Tt.filter(a=>!a.hidden).map(a=>[a.name,a.description??""]),header:b.magenta(" Environment Variables ")},{content:`Run "${x(t.getCliName())} ${N("help <command>")}" or "${x(t.getCliName())} ${N("<command>")} ${L("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},ce=(e,t)=>{const n=[];for(const r of e.values()){if(r.hidden)continue;const s=r.commandPath??[];if(s.length<t.length)continue;let o=!0;for(const[i,a]of t.entries())if(s[i]!==a){o=!1;break}o&&n.push(r)}return n},Ft=(e,t,n,r)=>{const s=n.join(" "),o=[{content:`${x(t.getCliName())} ${N(s)} ${N("<subcommand>")} [positional arguments] ${L("[options]")}`,header:b.cyan(" Usage ")},{content:r.map(i=>{const a=[...i.commandPath??[],i.name].join(" ");return[N(a),i.description??""]}),header:b.green(" Subcommands ")},{header:b.yellow(" Global Options "),optionList:t.getGlobalOptions()},{content:`Run "${x(t.getCliName())} ${N(`${s} <subcommand>`)} ${L("--help")}" for help with a specific subcommand.`,raw:!0}];(e.raw??e.log)(K(o))},Dt=(e,t,n,r,s)=>{let o=s??n.get(r);if(!o)for(const l of n.values()){const d=l.commandPath?[...l.commandPath,l.name]:[l.name];if(d.at(-1)===r||d.join(" ")===r){o=l;break}}if(!o){const l=r.split(" ").filter(Boolean),d=l.length>0?ce(n,l):[];if(d.length>0){Ft(e,t,l,d);return}e.error(`Command "${r}" not found`);return}const i=[],a=(o.commandPath?[...o.commandPath,o.name]:[o.name]).join(" ");i.push({content:`${x(t.getCliName())} ${N(a)}${Pt(o)}${o.options?" [options]":""}`,header:b.cyan(" Usage ")}),o.description&&i.push({content:o.description,header:b.green(" Description ")});const u=(o.argument?[o.argument]:o.arguments??[]).filter(l=>!l.hidden);if(u.length>0&&i.push({header:"Command Positional Arguments",isArgument:!0,optionList:u}),Array.isArray(o.options)&&o.options.length>0&&i.push({header:b.yellow(" Command Options "),optionList:o.options.filter(l=>!l.hidden)}),i.push({header:b.yellow(" Global Options "),optionList:t.getGlobalOptions()}),Array.isArray(o.env)&&o.env.length>0){const l=o.env.filter(d=>!d.hidden);l.length>0&&i.push({content:l.map(d=>[d.name,d.description??""]),header:b.magenta(" Environment Variables ")})}if(o.alias!==void 0&&o.alias.length>0){let l=o.alias;typeof o.alias=="string"&&(l=[o.alias]),i.splice(1,0,{content:l,header:"Alias(es)"})}Array.isArray(o.examples)&&o.examples.length>0&&i.push({content:o.examples,header:"Examples"});const c=[...o.commandPath??[],o.name],h=ce(n,c);h.length>0&&i.push({content:h.map(l=>{const d=[...l.commandPath??[],l.name].join(" ");return[N(d),l.description??""]}),header:b.green(" Subcommands ")}),(e.raw??e.log)(K(i))};class Ht{argument={description:"Command to show help for (subcommand path supported, e.g. `cli help docker build`)",name:"command",type:String};name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(t){this.commands=t}execute(t){const{argument:n,command:r,commandName:s,logger:o,options:i,runtime:a}=t,{footer:u,header:c}=a.getCommandSection();c&&(o.raw??o.log)($(c));const h=s==="help"&&Array.isArray(n)&&n.length>0?n.join(" "):void 0;if(s==="help"&&h===void 0)Lt(o,a,this.commands,typeof i?.group=="string"?i.group:void 0);else{const l=h!==void 0||r===void 0||r.name==="help"?void 0:r;Dt(o,a,this.commands,h??s,l)}u&&(o.raw??o.log)($(u))}}export{Ht as default};
6
+ ${JSON.stringify(e)}`)}}class _e extends Nt{constructor(e){super();let n=e.optionList??[];const r=Array.isArray(e.hide)?e.hide:[e.hide].filter(i=>typeof i=="string"),s=Array.isArray(e.group)?e.group:[e.group].filter(i=>typeof i=="string");r.length>0&&(n=n.filter(i=>!r.includes(i.name))),e.header&&this.header($(e.header)),s.length>0&&(n=n.filter(i=>{const a=i,u=s.includes("_none")&&!a.group,c=a.group,h=this.intersect(Array.isArray(c)?c:[c],s);return u||h?i:void 0}));const o=R({showHeader:!1,style:{border:_,paddingLeft:2,paddingRight:1,...e.tableOptions?.style},terminalWidth:T()??e.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:e.tableOptions?.wordWrap??!0,...e.tableOptions});n.forEach(i=>{const a=i;o.addRow([this.getOptionNames(a,e.reverseNameOrder??!1,e.isArgument??!1),$(a.description)])}),this.add(o.toString()),this.lines.push("")}getOptionNames(e,n,r){if(!e.name)throw new TypeError("Invalid option definition, name is required.");const s=e.type?e.type.name.toLowerCase():"string",{lazyMultiple:o}=e,i=e.multiple||o?"[]":"",a=e.typeLabel===void 0?kt(`${s}${i}`):$(e.typeLabel),u=r?j(e.name):j.yellow(`--${e.name}`),c=e.alias;if(c){const h=j(`-${c}`);return n?`${u}, ${h} ${a}`:`${h}, ${u} ${a}`}return`${u} ${a}`}intersect(e,n){return e.some(r=>n.includes(r))}}const K=t=>(Array.isArray(t)?t:[t]).length===0?"":`
7
+ ${t.map(e=>e.optionList?new _e(e).toString():new Re(e).toString()).join(`
8
+ `)}`,st=(t,e)=>{const n=`${e==="readme"?t.name.toUpperCase():t.name}${t.multiple===!0?"...":""}`;return t.required===!0?e==="readme"?n:`<${n}>`:`[${n}]`},Pe=(t,e="help")=>t.argument?t.argument.hidden?"":e==="readme"?` ${st(t.argument,e)}`:" [positional arguments]":!t.arguments||t.arguments.length===0?"":t.arguments.filter(n=>!n.hidden).map(n=>` ${st(n,e)}`).join(""),Te=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}],at="__Other",lt=t=>t.charAt(0).toUpperCase()+t.slice(1),Le=(t,e,n,r)=>{t.debug("no command given, printing general help...");let s=[...new Set(n.values())].filter(a=>!a.hidden);r&&(s=s.filter(a=>a.group===r));const o=s.reduce((a,u)=>{const c=u.group??at;return a[c]??=[],a[c].push(u),a},{}),i=a=>a.map(u=>{let c="";typeof u.alias=="string"?c=u.alias:Array.isArray(u.alias)&&(c=u.alias.join(", ")),c!==""&&(c=` [${c}]`);let h=u.name;return u.commandPath&&u.commandPath.length>0&&(h=`${u.commandPath.join(" ")} ${u.name}`),[`${N(h)}${c}`,u.description??""]});(t.raw??t.log)(K([{content:`${x(e.getCliName())} ${N("<command>")} [positional arguments] ${L("[options]")}`,header:b.cyan(" Usage ")},...Object.keys(o).map(a=>{const u=r?` ${lt(r)}`:"";return{content:i(o[a]),header:a===at||r?b.green(` Available${u} Commands `):` ${b.green(` ${lt(a)} `)}`}}),n.has("help")?{header:b.yellow(" Command Options "),optionList:n.get("help").options?.filter(a=>!a.hidden)}:void 0,{header:b.yellow(" Global Options "),optionList:e.getGlobalOptions()},{content:Te.filter(a=>!a.hidden).map(a=>[a.name,a.description??""]),header:b.magenta(" Environment Variables ")},{content:`Run "${x(e.getCliName())} ${N("help <command>")}" or "${x(e.getCliName())} ${N("<command>")} ${L("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},ct=(t,e)=>{const n=[];for(const r of t.values()){if(r.hidden)continue;const s=r.commandPath??[];if(s.length<e.length)continue;let o=!0;for(const[i,a]of e.entries())if(s[i]!==a){o=!1;break}o&&n.push(r)}return n},Fe=(t,e,n,r)=>{const s=n.join(" "),o=[{content:`${x(e.getCliName())} ${N(s)} ${N("<subcommand>")} [positional arguments] ${L("[options]")}`,header:b.cyan(" Usage ")},{content:r.map(i=>{const a=[...i.commandPath??[],i.name].join(" ");return[N(a),i.description??""]}),header:b.green(" Subcommands ")},{header:b.yellow(" Global Options "),optionList:e.getGlobalOptions()},{content:`Run "${x(e.getCliName())} ${N(`${s} <subcommand>`)} ${L("--help")}" for help with a specific subcommand.`,raw:!0}];(t.raw??t.log)(K(o))},De=(t,e,n,r,s)=>{let o=s??n.get(r);if(!o)for(const l of n.values()){const d=l.commandPath?[...l.commandPath,l.name]:[l.name];if(d.at(-1)===r||d.join(" ")===r){o=l;break}}if(!o){const l=r.split(" ").filter(Boolean),d=l.length>0?ct(n,l):[];if(d.length>0){Fe(t,e,l,d);return}t.error(`Command "${r}" not found`);return}const i=[],a=(o.commandPath?[...o.commandPath,o.name]:[o.name]).join(" ");i.push({content:`${x(e.getCliName())} ${N(a)}${Pe(o)}${o.options?" [options]":""}`,header:b.cyan(" Usage ")}),o.description&&i.push({content:o.description,header:b.green(" Description ")});const u=(o.argument?[o.argument]:o.arguments??[]).filter(l=>!l.hidden);if(u.length>0&&i.push({header:"Command Positional Arguments",isArgument:!0,optionList:u}),Array.isArray(o.options)&&o.options.length>0&&i.push({header:b.yellow(" Command Options "),optionList:o.options.filter(l=>!l.hidden)}),i.push({header:b.yellow(" Global Options "),optionList:e.getGlobalOptions()}),Array.isArray(o.env)&&o.env.length>0){const l=o.env.filter(d=>!d.hidden);l.length>0&&i.push({content:l.map(d=>[d.name,d.description??""]),header:b.magenta(" Environment Variables ")})}if(o.alias!==void 0&&o.alias.length>0){let l=o.alias;typeof o.alias=="string"&&(l=[o.alias]),i.splice(1,0,{content:l,header:"Alias(es)"})}Array.isArray(o.examples)&&o.examples.length>0&&i.push({content:o.examples,header:"Examples"});const c=[...o.commandPath??[],o.name],h=ct(n,c);h.length>0&&i.push({content:h.map(l=>{const d=[...l.commandPath??[],l.name].join(" ");return[N(d),l.description??""]}),header:b.green(" Subcommands ")}),(t.raw??t.log)(K(i))};class He{argument={description:"Command to show help for (subcommand path supported, e.g. `cli help docker build`)",name:"command",type:String};name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(e){this.commands=e}execute(e){const{argument:n,command:r,commandName:s,logger:o,options:i,runtime:a}=e,{footer:u,header:c}=a.getCommandSection();c&&(o.raw??o.log)($(c));const h=s==="help"&&Array.isArray(n)&&n.length>0?n.join(" "):void 0;if(s==="help"&&h===void 0)Le(o,a,this.commands,typeof i?.group=="string"?i.group:void 0);else{const l=h!==void 0||r===void 0||r.name==="help"?void 0:r;De(o,a,this.commands,h??s,l)}u&&(o.raw??o.log)($(u))}}export{He as default};
@@ -0,0 +1,3 @@
1
+ import{createRequire as u}from"node:module";import{VisReleaseError as i}from"../packem_shared/VisReleaseError-DZtgcKf8.js";let w;const _=o=>(w??=u(import.meta.url))(o),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=o=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[n,t]=r.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return r.getBuiltinModule(o)}return _(o)},{readFile:h}=g("node:fs/promises"),v=/^\d+\.\d+\.\d+(?:-[0-9A-Z.-]+)?(?:\+[0-9A-Z.-]+)?$/i,I=async(o,n)=>o.get(n)??h(n,"utf8"),j=async o=>{const{pending:n,projects:t,releases:c}=o,l=new Set,d=new Map(t.map(e=>[e.name,e]));for(const e of c){if(!d.has(e.name))throw new i({code:"CONFIG_INVALID",message:`${e.name} is planned as a Hex release, but no Hex package with that name was discovered. Re-run the release from a fresh context.`,packageName:e.name});if(!v.test(e.newVersion))throw new i({code:"CONFIG_INVALID",message:`${e.newVersion} cannot be written as a Hex version for ${e.name}. Hex versions are semver (1.2.3, 1.2.3-rc.1).`,packageName:e.name})}for(const e of c){const s=d.get(e.name),a=(await I(n,s.owner)).split(`
2
+ `),m=s.line-1,p=a[m]??"",f=s.kind==="attribute"?/^(\s*@version[ \t]+)"[^"]*"/:/(\bversion:[ \t]*)"[^"]*"/;if(!f.test(p))throw new i({code:"CONFIG_INVALID",file:s.owner,message:`${s.owner} has no version literal on line ${s.line} to bump for ${s.name}.`});a[m]=p.replace(f,`$1"${e.newVersion}"`),n.set(s.owner,a.join(`
3
+ `)),l.add(s.owner)}return l};export{j as planHexWorkspace};
@@ -0,0 +1 @@
1
+ import{r as v,M as h,l as k}from"../packem_shared/mix-project-RYvdZp3_.js";import{VisReleaseError as u}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import{isValidPackageName as w}from"./security.js";const c=(m,f,s)=>new u({code:"CONFIG_INVALID",file:m,message:f,packageName:s}),j=async m=>{const{claimedDirs:f,cwd:s}=m;let r;try{r=v(s)}catch(e){throw e instanceof h?c(e.file,e.message):e}if(r===void 0)return[];const g=[s,...r.project.appsPath===void 0?[]:k(s,r.project.appsPath)],p=[];for(const e of g){if(f.has(e))continue;let o;try{o=e===s?r:v(e)}catch(i){throw i instanceof h?c(i.file,i.message):i}if(o===void 0)continue;const{file:t,project:a}=o;if(a.version===void 0)continue;if(a.app===void 0&&a.packageName===void 0){if(a.isUmbrella)continue;throw c(t,`${t} sets a version but no app: atom. Declare app: :my_app in project/0.`)}const n=a.packageName??a.app;if(!w(n))throw c(t,`${t} names the package "${n}", which is not a valid Hex package name (lowercase letters, digits, "_", "." and "-").`,n);p.push({app:a.app,localDeps:a.localDeps,project:{kind:a.version.kind,line:a.version.line,name:n,owner:t,package:{dir:e,ecosystem:"hex",manifest:{dependencies:{},name:n,private:!1,version:a.version.value},manifestPath:t,name:n,private:!1,version:a.version.value}}})}const d=new Map;for(const{project:e}of p){const o=d.get(e.name);if(o!==void 0)throw c(e.package.manifestPath,`${e.name} is declared by both ${o} and ${e.package.manifestPath}. Hex package names must be unique to release them.`,e.name);d.set(e.name,e.package.manifestPath)}const l=new Map;for(const{app:e,project:o}of p)e!==void 0&&l.set(e,o.name);return p.map(({localDeps:e,project:o})=>{const t={};for(const n of e){const i=l.get(n);i!==void 0&&i!==o.name&&(t[i]="*")}const a={...o.package.manifest,dependencies:t};return{...o,package:{...o.package,manifest:a}}})};export{j as discoverHexProjects};