@visulima/vis 1.0.0-alpha.9 → 1.0.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 (278) hide show
  1. package/CHANGELOG.md +1854 -3
  2. package/LICENSE.md +13515 -10
  3. package/README.md +215 -39
  4. package/bin/resolve-binary.mjs +85 -0
  5. package/bin/vis.mjs +76 -0
  6. package/dashboard/dist/index.html +152 -0
  7. package/dist/bin.d.ts +1 -0
  8. package/dist/bin.js +1 -2
  9. package/dist/binx.js +3 -0
  10. package/dist/config/index.d.ts +3276 -0
  11. package/dist/config/index.js +1 -0
  12. package/dist/generate/index.d.ts +1 -1
  13. package/dist/generate/index.js +1 -1
  14. package/dist/packem_chunks/CONFIG_FILES.js +8 -0
  15. package/dist/packem_chunks/DEFAULT_CLEAN_KEEP.js +1 -0
  16. package/dist/packem_chunks/agent-instructions.js +11 -0
  17. package/dist/packem_chunks/bloom-status.js +2 -0
  18. package/dist/packem_chunks/bloom-sync.js +2 -0
  19. package/dist/packem_chunks/cache-attestation.js +1 -0
  20. package/dist/packem_chunks/catalog-detector.js +1 -0
  21. package/dist/packem_chunks/catalog.js +114 -0
  22. package/dist/packem_chunks/cli-exec.js +1 -0
  23. package/dist/packem_chunks/cli-main.js +268 -0
  24. package/dist/packem_chunks/defineReleasePlugin.js +3 -0
  25. package/dist/packem_chunks/detect.js +3 -0
  26. package/dist/packem_chunks/detect2.js +8 -0
  27. package/dist/packem_chunks/devtools.js +4 -0
  28. package/dist/packem_chunks/discord.js +4 -0
  29. package/dist/packem_chunks/dispatch.js +4 -0
  30. package/dist/packem_chunks/doctor-probe.js +2 -0
  31. package/dist/packem_chunks/dynamic-import.js +1 -0
  32. package/dist/packem_chunks/extra-files.js +3 -0
  33. package/dist/packem_chunks/fix.js +11 -0
  34. package/dist/packem_chunks/git.js +3 -0
  35. package/dist/packem_chunks/group-tags.js +1 -0
  36. package/dist/packem_chunks/handler.js +1 -1
  37. package/dist/packem_chunks/handler10.js +5 -1
  38. package/dist/packem_chunks/handler11.js +1 -1
  39. package/dist/packem_chunks/handler12.js +26 -152
  40. package/dist/packem_chunks/handler13.js +5 -1
  41. package/dist/packem_chunks/handler14.js +1 -3
  42. package/dist/packem_chunks/handler15.js +1 -1
  43. package/dist/packem_chunks/handler16.js +1 -2
  44. package/dist/packem_chunks/handler17.js +1 -7
  45. package/dist/packem_chunks/handler18.js +1 -1
  46. package/dist/packem_chunks/handler19.js +5 -19
  47. package/dist/packem_chunks/handler2.js +1 -1
  48. package/dist/packem_chunks/handler20.js +2 -428
  49. package/dist/packem_chunks/handler21.js +2 -22
  50. package/dist/packem_chunks/handler22.js +14 -3
  51. package/dist/packem_chunks/handler23.js +1 -5
  52. package/dist/packem_chunks/handler24.js +1 -1
  53. package/dist/packem_chunks/handler25.js +1 -20
  54. package/dist/packem_chunks/handler26.js +5 -1
  55. package/dist/packem_chunks/handler27.js +1 -1
  56. package/dist/packem_chunks/handler28.js +3 -1
  57. package/dist/packem_chunks/handler29.js +1 -2
  58. package/dist/packem_chunks/handler3.js +4 -2
  59. package/dist/packem_chunks/handler30.js +1 -22
  60. package/dist/packem_chunks/handler31.js +2 -1
  61. package/dist/packem_chunks/handler32.js +2 -1
  62. package/dist/packem_chunks/handler33.js +2 -37
  63. package/dist/packem_chunks/handler34.js +3 -3
  64. package/dist/packem_chunks/handler35.js +6 -23
  65. package/dist/packem_chunks/handler36.js +1 -5
  66. package/dist/packem_chunks/handler37.js +36 -21
  67. package/dist/packem_chunks/handler38.js +8 -1
  68. package/dist/packem_chunks/handler39.js +9 -2
  69. package/dist/packem_chunks/handler4.js +4 -5
  70. package/dist/packem_chunks/handler40.js +75 -1
  71. package/dist/packem_chunks/handler41.js +5 -5
  72. package/dist/packem_chunks/handler42.js +4 -1
  73. package/dist/packem_chunks/handler43.js +3 -24
  74. package/dist/packem_chunks/handler44.js +2 -3
  75. package/dist/packem_chunks/handler45.js +1 -1
  76. package/dist/packem_chunks/handler46.js +1 -0
  77. package/dist/packem_chunks/handler47.js +1 -0
  78. package/dist/packem_chunks/handler48.js +3 -0
  79. package/dist/packem_chunks/handler49.js +1 -0
  80. package/dist/packem_chunks/handler5.js +6 -4
  81. package/dist/packem_chunks/handler50.js +7 -0
  82. package/dist/packem_chunks/handler51.js +33 -0
  83. package/dist/packem_chunks/handler52.js +3 -0
  84. package/dist/packem_chunks/handler53.js +8 -0
  85. package/dist/packem_chunks/handler54.js +4 -0
  86. package/dist/packem_chunks/handler55.js +1 -0
  87. package/dist/packem_chunks/handler56.js +12 -0
  88. package/dist/packem_chunks/handler57.js +11 -0
  89. package/dist/packem_chunks/handler58.js +5 -0
  90. package/dist/packem_chunks/handler59.js +11 -0
  91. package/dist/packem_chunks/handler6.js +8 -2
  92. package/dist/packem_chunks/handler60.js +3 -0
  93. package/dist/packem_chunks/handler61.js +22 -0
  94. package/dist/packem_chunks/handler62.js +61 -0
  95. package/dist/packem_chunks/handler63.js +3 -0
  96. package/dist/packem_chunks/handler64.js +6 -0
  97. package/dist/packem_chunks/handler65.js +9 -0
  98. package/dist/packem_chunks/handler66.js +2 -0
  99. package/dist/packem_chunks/handler67.js +24 -0
  100. package/dist/packem_chunks/handler68.js +25 -0
  101. package/dist/packem_chunks/handler69.js +153 -0
  102. package/dist/packem_chunks/handler7.js +1 -24
  103. package/dist/packem_chunks/handler70.js +10 -0
  104. package/dist/packem_chunks/handler71.js +23 -0
  105. package/dist/packem_chunks/handler72.js +322 -0
  106. package/dist/packem_chunks/handler73.js +708 -0
  107. package/dist/packem_chunks/handler74.js +48 -0
  108. package/dist/packem_chunks/handler75.js +27 -0
  109. package/dist/packem_chunks/handler76.js +3 -0
  110. package/dist/packem_chunks/handler77.js +190 -0
  111. package/dist/packem_chunks/handler78.js +38 -0
  112. package/dist/packem_chunks/handler8.js +1 -6
  113. package/dist/packem_chunks/handler9.js +1 -8
  114. package/dist/packem_chunks/heal-accept.js +10 -0
  115. package/dist/packem_chunks/heal.js +14 -0
  116. package/dist/packem_chunks/help-command.js +31 -0
  117. package/dist/packem_chunks/index.js +1 -7
  118. package/dist/packem_chunks/index2.js +802 -0
  119. package/dist/packem_chunks/index3.js +7 -0
  120. package/dist/packem_chunks/index4.js +135 -0
  121. package/dist/packem_chunks/index5.js +73 -0
  122. package/dist/packem_chunks/interface.js +2 -0
  123. package/dist/packem_chunks/keys-refresh.js +4 -0
  124. package/dist/packem_chunks/lean.js +4 -0
  125. package/dist/packem_chunks/list.js +3 -0
  126. package/dist/packem_chunks/loader.js +4 -1
  127. package/dist/packem_chunks/loader2.js +1 -0
  128. package/dist/packem_chunks/orchestrator.js +42 -0
  129. package/dist/packem_chunks/pre-mode.js +2 -0
  130. package/dist/packem_chunks/print-config.js +2 -0
  131. package/dist/packem_chunks/prompts.js +7 -0
  132. package/dist/packem_chunks/prune.js +3 -0
  133. package/dist/packem_chunks/publish-guards.js +1 -0
  134. package/dist/packem_chunks/registry.js +48 -0
  135. package/dist/packem_chunks/resolveFormatter.js +9 -0
  136. package/dist/packem_chunks/run.js +1 -0
  137. package/dist/packem_chunks/security.js +1 -0
  138. package/dist/packem_chunks/shell-runner.js +1 -0
  139. package/dist/packem_chunks/slack.js +2 -0
  140. package/dist/packem_chunks/snapshot.js +2 -0
  141. package/dist/packem_chunks/stage-publisher.js +1 -0
  142. package/dist/packem_chunks/staged-registry.js +2 -0
  143. package/dist/packem_chunks/state.js +3 -0
  144. package/dist/packem_chunks/status.js +2 -0
  145. package/dist/packem_chunks/success-walk.js +8 -0
  146. package/dist/packem_chunks/sync.js +2 -0
  147. package/dist/packem_chunks/sync2.js +2 -0
  148. package/dist/packem_chunks/tar.js +3 -0
  149. package/dist/packem_chunks/tripwire.js +2 -0
  150. package/dist/packem_chunks/ts-loader.js +22 -0
  151. package/dist/packem_chunks/verify-lockfile.js +2 -0
  152. package/dist/packem_chunks/version-resolver.js +2 -0
  153. package/dist/packem_chunks/webhook.js +1 -0
  154. package/dist/packem_chunks/workflow-templates.js +167 -0
  155. package/dist/packem_chunks/workspace.js +2 -0
  156. package/dist/packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js +1 -0
  157. package/dist/packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js +3 -0
  158. package/dist/packem_shared/ReleaseClient-BY4OZNCK.js +1 -0
  159. package/dist/packem_shared/Table-BGIHvenQ-D2oJtNQj.js +34 -0
  160. package/dist/packem_shared/VisReleaseError-DMGRBTNO.js +1 -0
  161. package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +1 -0
  162. package/dist/packem_shared/advisories-CaP4uNhD.js +1 -0
  163. package/dist/packem_shared/affected-shas-BfO3PDJq.js +1 -0
  164. package/dist/packem_shared/ai-analysis-CO7No4rt.js +68 -0
  165. package/dist/packem_shared/ai-fix-B4u2zlVG.js +43 -0
  166. package/dist/packem_shared/anolilab-text-CAM_E6uK.js +13 -0
  167. package/dist/packem_shared/api.d-BPftyU9r.d.ts +27 -0
  168. package/dist/packem_shared/augment-8z86AwtF.js +4 -0
  169. package/dist/packem_shared/bin-Cv8vsMEo.js +1 -0
  170. package/dist/packem_shared/build-scripts-D477Ou-x.js +1 -0
  171. package/dist/packem_shared/command-runtime-EWjmSxPj.js +1 -0
  172. package/dist/packem_shared/compile-cache-B_Vf_WxT.js +3 -0
  173. package/dist/packem_shared/createAdapter-bU4DIP3F.js +1 -0
  174. package/dist/packem_shared/createVersionActions-BK43SNDH.js +1 -0
  175. package/dist/packem_shared/cyclonedx-CDWHbD9s.js +4 -0
  176. package/dist/packem_shared/defineFormatter-D5dCp6Kv.js +1 -0
  177. package/dist/packem_shared/definePlugin-DoUcoYSy.js +1 -0
  178. package/dist/packem_shared/dependency-scan-P52jY0pU.js +1 -0
  179. package/dist/packem_shared/docker-CD7o1D1o.js +59 -0
  180. package/dist/packem_shared/env-Cpxa_7UE.js +27 -0
  181. package/dist/packem_shared/failure-log-MOhz-TBv.js +2 -0
  182. package/dist/packem_shared/giget-DVTFJlbR.js +2 -0
  183. package/dist/packem_shared/glob-DMbPwGSj-uzODoE-1.js +1 -0
  184. package/dist/packem_shared/index-B0EsgdzO.js +1 -0
  185. package/dist/packem_shared/index-BAUIIRZJ.js +1 -0
  186. package/dist/packem_shared/index-BVuCxe14.js +22 -0
  187. package/dist/packem_shared/index-CdTXvj-V.js +1 -0
  188. package/dist/packem_shared/index-CgXLAAVI.js +28 -0
  189. package/dist/packem_shared/index-DjTWo3sH.js +1 -0
  190. package/dist/packem_shared/index.server-J83sowC4.js +2 -0
  191. package/dist/packem_shared/interface.d-B7VK2rcH.d.ts +148 -0
  192. package/dist/packem_shared/interface.d-Cezzifoh.d.ts +106 -0
  193. package/dist/packem_shared/license-t5KnNX6v.js +1 -0
  194. package/dist/packem_shared/lifecycle-hzwghh5a.js +2 -0
  195. package/dist/packem_shared/lockfile-CWcVTdRc.js +1 -0
  196. package/dist/packem_shared/main-B3juSU5z.js +1 -0
  197. package/dist/packem_shared/manifests-CaPqgQxW.js +1 -0
  198. package/dist/packem_shared/min-release-age-skpcnlpk.js +34 -0
  199. package/dist/packem_shared/missing-package-json-_hOp4AW5.js +1 -0
  200. package/dist/packem_shared/native-config-sync-CFi1iQNG.js +21 -0
  201. package/dist/packem_shared/osv-bloom-BAyJUnRx.js +2 -0
  202. package/dist/packem_shared/otelPlugin-DmKDBaPo.js +1 -0
  203. package/dist/packem_shared/packument-CYxvm590.js +1 -0
  204. package/dist/packem_shared/peer-warnings-BXAzXqY3.js +1 -0
  205. package/dist/packem_shared/plugins.d-ND23R9I3.d.ts +4 -0
  206. package/dist/packem_shared/pm-runner-mVFjedM6.js +1 -0
  207. package/dist/packem_shared/prompt-DjXHVgYU.js +1 -0
  208. package/dist/packem_shared/provenance-CI_WQx7G.js +1 -0
  209. package/dist/packem_shared/public-api-WqUCiyIe.js +131 -0
  210. package/dist/packem_shared/readJsonSync-DuMMeB3s-Cx08VBQg.js +1 -0
  211. package/dist/packem_shared/registry-keys-AGlSEY6R.js +1 -0
  212. package/dist/packem_shared/resolve-explicit-DVE9cfkm.js +5 -0
  213. package/dist/packem_shared/resolve-runtime-CGHf-wHz.js +1 -0
  214. package/dist/packem_shared/run-file-Bs_E9O6O.js +1 -0
  215. package/dist/packem_shared/runtime-check-pS2XH4BO.js +1 -0
  216. package/dist/packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js +1 -0
  217. package/dist/packem_shared/s1ngularity-xmrq5T5r.js +1 -0
  218. package/dist/packem_shared/scan-progress-DQ4TMXcb.js +2 -0
  219. package/dist/packem_shared/selectors-CRgS4bU9.js +3 -0
  220. package/dist/packem_shared/signatures-Dp3th1DB.js +2 -0
  221. package/dist/packem_shared/slug-DoueYuLo.js +1 -0
  222. package/dist/packem_shared/spinner-DuJJvFTl.js +1 -0
  223. package/dist/packem_shared/sticky-comment-D6_7-w8T.js +1 -0
  224. package/dist/packem_shared/subtree-C7bZuiSQ.js +2 -0
  225. package/dist/packem_shared/symbols-DPTlrJ3B.js +1 -0
  226. package/dist/packem_shared/tabs-CgxCvjCY.js +1 -0
  227. package/dist/packem_shared/target-merge-D2eTghgd.js +11 -0
  228. package/dist/packem_shared/target-options-TM6ETDAS.js +1 -0
  229. package/dist/packem_shared/toolchain-B5KwUZfq.js +5 -0
  230. package/dist/packem_shared/typosquats-C0layQsP.js +1 -0
  231. package/dist/packem_shared/use-measured-height-Drobr4fe.js +1 -0
  232. package/dist/packem_shared/utils-CRueU43T.js +1 -0
  233. package/dist/packem_shared/verify-Cjo4EBFZ.js +1 -0
  234. package/dist/packem_shared/vis-update-app-qIkyvrd1.js +1 -0
  235. package/dist/packem_shared/watch-BnE1TzYn.js +1 -0
  236. package/dist/packem_shared/watch-loop-Irf3Pm-1.js +11 -0
  237. package/dist/release/core/changelog/index.d.ts +5 -0
  238. package/dist/release/core/changelog/index.js +1 -0
  239. package/dist/release/core/package-managers/index.d.ts +6 -0
  240. package/dist/release/core/package-managers/index.js +1 -0
  241. package/dist/release/core/version-actions/index.d.ts +14 -0
  242. package/dist/release/core/version-actions/index.js +1 -0
  243. package/dist/release/index.d.ts +233 -0
  244. package/dist/release/index.js +1 -0
  245. package/dist/release/plugin-sdk.d.ts +128 -0
  246. package/dist/release/plugin-sdk.js +1 -0
  247. package/dist/release/presets.d.ts +225 -0
  248. package/dist/release/presets.js +1 -0
  249. package/dist/release/types.d.ts +1493 -0
  250. package/dist/release/types.js +1 -0
  251. package/dist/runtime/preload.d.ts +1 -0
  252. package/dist/runtime/preload.js +1 -0
  253. package/index.d.ts +450 -0
  254. package/index.js +663 -556
  255. package/package.json +105 -62
  256. package/schemas/project.schema.json +872 -225
  257. package/schemas/vis-config.schema.json +6309 -264
  258. package/schemas/vis-release-config.schema.json +1423 -0
  259. package/skills/vis/SKILL.md +96 -0
  260. package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
  261. package/templates/buildkite-ci/template.yml +20 -0
  262. package/dist/config.d.ts +0 -1087
  263. package/dist/config.js +0 -1
  264. package/dist/packem_shared/VisUpdateApp-BBx3idMI.js +0 -1
  265. package/dist/packem_shared/ai-analysis-DDqXRFxY.js +0 -67
  266. package/dist/packem_shared/bin-BaZZ32BK.js +0 -93
  267. package/dist/packem_shared/cache-directory-DL8hfXeG.js +0 -1
  268. package/dist/packem_shared/catalog-CuSpuB_R.js +0 -12
  269. package/dist/packem_shared/dependency-scan-BoLG2Fez.js +0 -1
  270. package/dist/packem_shared/docker-BcfqH4Av.js +0 -2
  271. package/dist/packem_shared/flakiness-DSIHZGBT.js +0 -1
  272. package/dist/packem_shared/otelPlugin-DxyvBcXO.js +0 -1
  273. package/dist/packem_shared/runtime-check-CGHal8SO.js +0 -1
  274. package/dist/packem_shared/selectors-CfH9ZY08.js +0 -3
  275. package/dist/packem_shared/symbols-CIMw60-G.js +0 -1
  276. package/dist/packem_shared/toolchain-C3ZG0o_X.js +0 -5
  277. package/dist/packem_shared/typosquats-Bpq4zcWL.js +0 -1
  278. package/dist/packem_shared/utils-DrNg0XTR.js +0 -1
@@ -0,0 +1,3 @@
1
+ const e=s=>s.config.plugins??[],i=async(s,a)=>{for(const l of e(s))l.applyDraft&&await l.applyDraft({...s,plan:a})},t=async(s,a)=>{for(const l of e(s))if(l.willPublish&&await l.willPublish({...s,package:a})===!1)return{by:l.name,skip:!0};return{skip:!1}},n=async(s,a)=>{for(const l of e(s))if(l.afterPublish)try{await l.afterPublish({...s,package:a})}catch(r){process.stderr.write(`[vis release] plugin "${l.name}" afterPublish(${a.name}) failed: ${r.message}
2
+ `)}},f=async(s,a)=>{for(const l of e(s))if(l.afterPublishAll)try{await l.afterPublishAll({...s,result:a})}catch(r){process.stderr.write(`[vis release] plugin "${l.name}" afterPublishAll failed: ${r.message}
3
+ `)}},o=s=>s;export{o as defineReleasePlugin,f as runAfterPublishAllHooks,n as runAfterPublishHooks,i as runApplyDraftHooks,t as runWillPublishHooks};
@@ -0,0 +1,3 @@
1
+ import{createRequire as N}from"node:module";import S from"./index.js";import{VisReleaseError as u}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const A=N(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=c=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,s]=h.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return h.getBuiltinModule(c)}return A(c)},{readFile:b,rename:x,readdir:L}=v("node:fs/promises"),{isAbsolute:k,join:o,basename:C}=v("node:path");class m{constructor(t){this.runner=t}runner;async publishNative(t){throw new u({code:"CONFIG_INVALID",hint:'Set publish.publishStrategy back to "npm-publish-tarball" (the default), or use a package manager whose adapter implements native publish.',message:`publishStrategy "native" is not supported by the "${this.id}" adapter.`})}async readCatalogYaml(t){}}const f=(c,t)=>{if(c.exitCode===0)return{output:c.stdout,published:!0};const s=`${c.stdout}
2
+ ${c.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(s))return{alreadyPublished:!0,output:s,published:!1};throw new u({code:"PUBLISH_FAILED",message:`${t} failed: ${s}`})};class g extends m{id="npm";minVersion="11.5.1";async pack(t){const s=["pack","--json"];t.destination&&s.push("--pack-destination",t.destination);const e=await this.runner.run("npm",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`npm pack failed: ${e.stderr||e.stdout}`});const a=JSON.parse(e.stdout),n=a[0]?.filename;if(!n)throw new u({code:"PUBLISH_FAILED",hint:"Upgrade npm to a version that emits --json output, or report this with the raw stdout.",message:`npm pack: could not parse output: ${e.stdout}`});const r=t.destination??t.cwd;let i=k(n)?n:o(r,n);return t.filename&&(await(await import("node:fs/promises")).rename(i,o(r,t.filename)),i=o(r,t.filename)),{raw:a,tarball:i}}async installLockfileOnly(t){const s=await this.runner.run("npm",["install","--package-lock-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`npm install --package-lock-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("npm",["query",".workspace","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];try{return JSON.parse(s.stdout).filter(e=>typeof e.name=="string").map(e=>({name:e.name,path:e.path??e.location??t,private:e.private??!1,version:e.version??"0.0.0"}))}catch{return[]}}async publish(t){const s=t.stage?["stage","publish",t.tarball]:["publish",t.tarball];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance"),t.stage&&s.push("--json");for(const n of t.extraArgs??[])s.push(n);const e=await this.runner.run("npm",s,{cwd:process.cwd(),silent:!0});if(e.exitCode===0){const n={output:e.stdout,published:!0};if(t.stage)try{const r=JSON.parse(e.stdout);n.stageId=r.id??r.stageId}catch{}return n}const a=`${e.stdout}
3
+ ${e.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(a))return{alreadyPublished:!0,output:a,published:!1};throw new u({code:"PUBLISH_FAILED",message:`npm publish failed: ${a}`})}async publishNative(t){const s=["publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("npm",s,{cwd:t.cwd,silent:!0});return f(e,"npm publish")}async detectVersion(t){const s=await this.runner.run("npm",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}class _ extends m{id="bun";minVersion="1.1.36";async pack(t){const s=["pm","pack"];t.destination&&s.push("--destination",t.destination);const e=await this.runner.run("bun",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`bun pm pack failed: ${e.stderr||e.stdout}`});const a=/(?:^|["'\s])([^\s"']*\.tgz)/m.exec(e.stdout),n=t.destination??t.cwd;let r;if(a?.[1]){const i=a[1];r=k(i)?i:o(n,i)}else{const i=JSON.parse(await b(o(t.cwd,"package.json"),"utf8")),d=(i.name??"package").replaceAll("/","-").replace(/^@/,"");r=o(n,`${d}-${i.version??"0.0.0"}.tgz`)}if(t.filename&&C(r)!==t.filename){const i=o(n,t.filename);await x(r,i),r=i}return{raw:e.stdout,tarball:r}}async installLockfileOnly(t){const s=await this.runner.run("bun",["install","--lockfile-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`bun install --lockfile-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){try{const s=JSON.parse(await b(o(t,"package.json"),"utf8")),e=Array.isArray(s.workspaces)?s.workspaces:s.workspaces?.packages??[];if(e.length===0)return[];const a=new Set,n=["."],r=5,i=new Set;for(;n.length>0;){const p=n.shift();if(i.has(p)||(i.add(p),(p==="."?0:p.split("/").length)>r))continue;let w;try{w=await L(o(t,p),{withFileTypes:!0})}catch{continue}for(const l of w){if(!l.isDirectory()||l.name==="node_modules"||l.name.startsWith("."))continue;const y=p==="."?l.name:`${p}/${l.name}`;e.some(I=>S(I,y))&&a.add(y),n.push(y)}}const d=[];for(const p of a){const w=o(t,p,"package.json");try{const l=JSON.parse(await b(w,"utf8"));if(typeof l.name!="string")continue;d.push({name:l.name,path:o(t,p),private:l.private??!1,version:l.version??"0.0.0"})}catch{}}return d}catch{return[]}}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry);for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("bun",s,{cwd:t.cwd,silent:!0});return f(e,"bun publish")}async detectVersion(t){const s=await this.runner.run("bun",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}class O extends m{id="pnpm";minVersion="9.5.0";async pack(t){const s=["pack","--json"];t.destination&&s.push("--pack-destination",t.destination);const e=await this.runner.run("pnpm",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`pnpm pack failed: ${e.stderr||e.stdout}`});const a=JSON.parse(e.stdout),{filename:n}=a;if(!n)throw new u({code:"PUBLISH_FAILED",message:`pnpm pack: could not parse output: ${e.stdout}`});const r=t.destination??t.cwd;let i=k(n)?n:o(r,n);return t.filename&&(await(await import("node:fs/promises")).rename(i,o(r,t.filename)),i=o(r,t.filename)),{raw:a,tarball:i}}async installLockfileOnly(t){const s=await this.runner.run("pnpm",["install","--lockfile-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`pnpm install --lockfile-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("pnpm",["-r","ls","--depth","-1","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];try{return JSON.parse(s.stdout).filter(e=>typeof e.name=="string").map(e=>({name:e.name,path:e.path??t,private:e.private??!1,version:e.version??"0.0.0"}))}catch{return[]}}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["publish","--no-git-checks"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("pnpm",s,{cwd:t.cwd,silent:!0});return f(e,"pnpm publish")}async detectVersion(t){const s=await this.runner.run("pnpm",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}async readCatalogYaml(t){const s=await import("node:fs/promises");try{return await s.readFile(o(t,"pnpm-workspace.yaml"),"utf8")}catch{return}}}class $ extends m{id="yarn";minVersion="4.0.0";async pack(t){const s=t.destination??t.cwd,e=t.filename??"%s-%v.tgz",a=["pack","--out",o(s,e)],n=await this.runner.run("yarn",a,{cwd:t.cwd,silent:!0});if(n.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`yarn pack failed: ${n.stderr||n.stdout}`});const r=await import("node:fs/promises"),i=await import("node:path"),d=JSON.parse(await r.readFile(i.join(t.cwd,"package.json"),"utf8")),p=e.replaceAll("%s",(d.name??"package").replaceAll("/","-").replace(/^@/,"")).replaceAll("%v",d.version??"0.0.0");return{raw:n.stdout,tarball:o(s,p)}}async installLockfileOnly(t){const s=await this.runner.run("yarn",["install","--mode","update-lockfile"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`yarn install --mode update-lockfile failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("yarn",["workspaces","list","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];const e=[];for(const a of s.stdout.split(/\r?\n/)){const n=a.trim();if(n)try{const r=JSON.parse(n);if(typeof r.name!="string"||r.name==="")continue;e.push({name:r.name,path:r.location?o(t,r.location):t,private:!1,version:"0.0.0"})}catch{}}return e}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["npm","publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("yarn",s,{cwd:t.cwd,silent:!0});return f(e,"yarn npm publish")}async detectVersion(t){const s=await this.runner.run("yarn",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}const D=async(c,t)=>{const s=await import("node:fs/promises"),e=await import("node:path");try{const n=JSON.parse(await s.readFile(e.join(c,"package.json"),"utf8"));if(typeof n.packageManager=="string"){const r=n.packageManager.indexOf("@"),i=r>0?n.packageManager.slice(0,r):n.packageManager;if(i==="pnpm"||i==="yarn"||i==="bun"||i==="npm")return i}}catch{}const a=async n=>{try{return await s.access(e.join(c,n)),!0}catch{return!1}};return await a("bun.lock")||await a("bun.lockb")?"bun":await a("pnpm-lock.yaml")||await a("pnpm-workspace.yaml")?"pnpm":await a("yarn.lock")?"yarn":"npm"},V=(c,t)=>{switch(c){case"bun":return new _(t);case"pnpm":return new O(t);case"yarn":return new $(t);default:return new g(t)}};export{g as N,V as c,D as d};
@@ -0,0 +1,8 @@
1
+ import{createRequire as f}from"node:module";const y=f(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=o=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[e,t]=d.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return d.getBuiltinModule(o)}return y(o)},{basename:$}=w("node:path"),O=o=>{const e=[],t=[];for(const s of o??[]){if(typeof s=="string"){e.push(s);continue}if(s.path){const r=s.label??s.name;e.push(r?`${s.path}#${r}`:s.path)}else if(s.linkUrl){const r=s.label??s.name??s.linkUrl;t.push(`- [${r}](${s.linkUrl})`)}}return{linkAppendix:t.length>0?`
2
+
3
+ ### Additional links
4
+
5
+ ${t.join(`
6
+ `)}`:"",paths:e}},x=(o,e)=>{if(o!==0)return[];try{return JSON.parse(e).filter(t=>typeof t.body=="string").map(t=>({body:t.body??"",id:t.id}))}catch{return[]}};class C{id="github";host;httpProxy;constructor(e={}){this.host=e.host,this.httpProxy=e.httpProxy}runOpts(e){if(!this.host&&!this.httpProxy)return{cwd:e,silent:!0};const t={...process.env};return this.host&&(t.GH_HOST=this.host),this.httpProxy&&(t.HTTPS_PROXY=this.httpProxy,t.HTTP_PROXY=this.httpProxy),{cwd:e,env:t,silent:!0}}async listRecentReleases(e,t){const s=Math.max(1,t.limit),r=t.tagPrefix?Math.min(100,s*4):s,n=await e.run("gh",["release","list","--repo",t.repo,"--limit",String(r),"--json","tagName,url,name"],this.runOpts(t.cwd));if(n.exitCode!==0)return[];let i;try{i=JSON.parse(n.stdout)}catch{return[]}const a=[];for(const u of i)if(!(typeof u.tagName!="string"||typeof u.url!="string")&&!(t.tagPrefix&&!u.tagName.startsWith(t.tagPrefix))&&!(t.excludeTag&&u.tagName===t.excludeTag)&&(a.push({name:u.name??u.tagName,tag:u.tagName,url:u.url}),a.length>=s))break;return a}async detectRepoSlug(e,t){const s=await t.run("gh",["repo","view","--json","nameWithOwner","-q",".nameWithOwner"],this.runOpts(e));if(s.exitCode===0)return s.stdout.trim()||void 0}detectPullRequestNumber(e){const t=e.GITHUB_REF;if(t){const r=/^refs\/pull\/(\d+)\/(?:merge|head)$/.exec(t);if(r?.[1])return Number.parseInt(r[1],10)}const s=e.PR_NUMBER??e.VIS_PR_NUMBER;if(s){const r=Number.parseInt(s,10);return Number.isNaN(r)?void 0:r}}async upsertStickyComment(e,t){const s=await e.run("gh",["api",`repos/${t.repo}/issues/${t.issueNumber}/comments`,"--paginate"],this.runOpts(t.cwd)),r=x(s.exitCode,s.stdout).find(a=>a.body.includes(t.marker)),n=t.body.includes(t.marker)?t.body:`${t.marker}
7
+ ${t.body}`;if(r)return(await e.run("gh",["api","-X","PATCH",`repos/${t.repo}/issues/comments/${r.id}`,"-f",`body=${n}`],this.runOpts(t.cwd))).exitCode===0?{created:!1,id:r.id}:void 0;const i=await e.run("gh",["api","-X","POST",`repos/${t.repo}/issues/${t.issueNumber}/comments`,"-f",`body=${n}`],this.runOpts(t.cwd));if(i.exitCode===0)try{return{created:!0,id:JSON.parse(i.stdout).id}}catch{return}}async createRelease(e,t){const{linkAppendix:s,paths:r}=O(t.assets),n=s?`${t.body}${s}`:t.body,i=["release","create",t.tag,"--repo",t.repo,"--title",t.title,"--notes",n];t.draft&&i.push("--draft"),t.prerelease&&i.push("--prerelease"),t.discussionCategory&&i.push("--discussion-category",t.discussionCategory),r.length>0&&i.push(...r);const a=await e.run("gh",i,this.runOpts(t.cwd));if(a.exitCode===0)return{url:a.stdout.trim()||void 0}}async addLabels(e,t){if(t.labels.length===0)return!0;const s=["api","-X","POST",`repos/${t.repo}/issues/${t.issueNumber}/labels`];for(const r of t.labels)s.push("-f",`labels[]=${r}`);return(await e.run("gh",s,this.runOpts(t.cwd))).exitCode===0}async upsertIssue(e,t){const s=await e.run("gh",["issue","list","--repo",t.repo,"--state","open","--search",t.marker,"--json","number,title,url","--limit","20"],this.runOpts(t.cwd));if(s.exitCode===0&&s.stdout.trim()&&s.stdout.trim()!=="[]")try{const u=JSON.parse(s.stdout).find(c=>c.title.includes(t.marker));if(u){const c=["issue","edit",String(u.number),"--repo",t.repo,"--title",t.title,"--body",t.body];return t.labels&&t.labels.length>0&&c.push("--add-label",t.labels.join(",")),t.assignees&&t.assignees.length>0&&c.push("--add-assignee",t.assignees.join(",")),(await e.run("gh",c,this.runOpts(t.cwd))).exitCode===0?{created:!1,number:u.number,url:u.url}:void 0}}catch{}const r=["issue","create","--repo",t.repo,"--title",t.title,"--body",t.body];t.labels&&t.labels.length>0&&r.push("--label",t.labels.join(",")),t.assignees&&t.assignees.length>0&&r.push("--assignee",t.assignees.join(","));const n=await e.run("gh",r,this.runOpts(t.cwd));if(n.exitCode!==0)return;const i=n.stdout.trim(),a=/\/issues\/(\d+)/.exec(i);return a?{created:!0,number:Number.parseInt(a[1]??"0",10),url:i}:void 0}async closeIssue(e,t){return t.closingComment&&await e.run("gh",["issue","comment",String(t.issueNumber),"--repo",t.repo,"--body",t.closingComment],this.runOpts(t.cwd)),(await e.run("gh",["issue","close",String(t.issueNumber),"--repo",t.repo],this.runOpts(t.cwd))).exitCode===0}async upsertPullRequest(e,t){const s=await e.run("gh",["pr","list","--repo",t.repo,"--head",t.head,"--state","open","--json","number,url"],this.runOpts(t.cwd));if(s.exitCode===0&&s.stdout.trim()&&s.stdout.trim()!=="[]")try{const i=JSON.parse(s.stdout);if(i[0])return await e.run("gh",["pr","edit",String(i[0].number),"--repo",t.repo,"--title",t.title,"--body",t.body],this.runOpts(t.cwd)),{existing:!0,number:i[0].number,url:i[0].url}}catch{}const r=await e.run("gh",["pr","create","--repo",t.repo,"--head",t.head,"--base",t.base,"--title",t.title,"--body",t.body],this.runOpts(t.cwd));if(r.exitCode!==0)return;const n=/\/pull\/(\d+)/.exec(r.stdout);return n?{existing:!1,number:Number.parseInt(n[1]??"0",10),url:r.stdout.trim()}:void 0}}const p=o=>encodeURIComponent(o),P=o=>o.replace(/^v(?=\d)/,""),N=o=>{const e=[],t=[],s=[];for(const r of o??[]){if(typeof r=="string"){e.push(r);continue}r.path?r.target==="generic_package"?s.push({label:r.label,linkType:r.type,name:r.name,packageName:r.packageName,packageVersion:r.packageVersion,path:r.path}):e.push(r.path):r.linkUrl&&t.push({linkType:r.type,name:r.label??r.name??r.linkUrl,url:r.linkUrl})}return{genericPackages:s,links:t,uploads:e}};class b{id="gitlab";static recentReleasesWarned=!1;async listRecentReleases(e,t){return b.recentReleasesWarned||(b.recentReleasesWarned=!0,console.warn("[vis release] addReleases is not yet supported on GitLab — skipping the Related releases block.")),[]}host;httpProxy;constructor(e={}){this.host=e.host,this.httpProxy=e.httpProxy}runOpts(e){if(!this.host&&!this.httpProxy)return{cwd:e,silent:!0};const t={...process.env};return this.host&&(t.GITLAB_HOST=this.host),this.httpProxy&&(t.HTTPS_PROXY=this.httpProxy,t.HTTP_PROXY=this.httpProxy),{cwd:e,env:t,silent:!0}}async listMrNotes(e,t,s,r){const n=await e.run("glab",["api",`projects/${p(s)}/merge_requests/${r}/notes`,"--paginate"],this.runOpts(t));if(n.exitCode!==0)return[];try{return JSON.parse(n.stdout).filter(i=>typeof i.body=="string"&&i.system!==!0).map(i=>({body:i.body??"",id:i.id}))}catch{return[]}}async uploadGenericPackage(e,t,s,r,n){const i=p(s),a=$(n.path),u=n.packageName??s.split("/").pop()??"release",c=n.packageVersion??P(r),l=`projects/${i}/packages/generic/${encodeURIComponent(u)}/${encodeURIComponent(c)}/${encodeURIComponent(a)}`;if((await e.run("glab",["api","-X","PUT",l,"--input",n.path],this.runOpts(t))).exitCode!==0)return;const h=this.host?.replace(/^https?:\/\//i,"").replace(/\/+$/,""),g=`${h?`https://${h}`:"https://gitlab.com"}/api/v4/${l}`,m=["api","-X","POST",`projects/${i}/releases/${encodeURIComponent(r)}/assets/links`,"-f",`name=${n.label??n.name??a}`,"-f",`url=${g}`];n.linkType&&m.push("-f",`link_type=${n.linkType}`),await e.run("glab",m,this.runOpts(t))}async detectRepoSlug(e,t){const s=process.env.CI_PROJECT_PATH;if(s)return s;const r=await t.run("git",["config","--get","remote.origin.url"],{cwd:e,silent:!0});if(r.exitCode!==0)return;const n=r.stdout.trim();return/gitlab\.[\w.-]+[/:]([^/].*?)(?:\.git)?$/.exec(n)?.[1]}detectPullRequestNumber(e){const t=e.CI_MERGE_REQUEST_IID??e.VIS_MR_NUMBER;if(!t)return;const s=Number.parseInt(t,10);return Number.isNaN(s)?void 0:s}async upsertStickyComment(e,t){const s=(await this.listMrNotes(e,t.cwd,t.repo,t.issueNumber)).find(a=>a.body.includes(t.marker)),r=t.body.includes(t.marker)?t.body:`${t.marker}
8
+ ${t.body}`,n=p(t.repo);if(s)return(await e.run("glab",["api","-X","PUT",`projects/${n}/merge_requests/${t.issueNumber}/notes/${s.id}`,"-f",`body=${r}`],this.runOpts(t.cwd))).exitCode===0?{created:!1,id:s.id}:void 0;const i=await e.run("glab",["api","-X","POST",`projects/${n}/merge_requests/${t.issueNumber}/notes`,"-f",`body=${r}`],this.runOpts(t.cwd));if(i.exitCode===0)try{return{created:!0,id:JSON.parse(i.stdout).id}}catch{return}}async createRelease(e,t){const{genericPackages:s,links:r,uploads:n}=N(t.assets),i=["release","create",t.tag,"--repo",t.repo,"--name",t.title,"--notes",t.body];if(t.milestones&&t.milestones.length>0)for(const c of t.milestones)i.push("--milestone",c);if((await e.run("glab",i,this.runOpts(t.cwd))).exitCode!==0)return;n.length>0&&await e.run("glab",["release","upload",t.tag,"--repo",t.repo,...n],this.runOpts(t.cwd));const a=p(t.repo);for(const c of r){const l=["api","-X","POST",`projects/${a}/releases/${encodeURIComponent(t.tag)}/assets/links`,"-f",`name=${c.name}`,"-f",`url=${c.url}`];c.linkType&&l.push("-f",`link_type=${c.linkType}`),await e.run("glab",l,this.runOpts(t.cwd))}for(const c of s)await this.uploadGenericPackage(e,t.cwd,t.repo,t.tag,c);const u=await e.run("glab",["api",`projects/${a}/releases/${encodeURIComponent(t.tag)}`],this.runOpts(t.cwd));try{return{url:JSON.parse(u.stdout)._links?.self}}catch{return{url:void 0}}}async addLabels(e,t){if(t.labels.length===0)return!0;const s=p(t.repo);return(await e.run("glab",["api","-X","PUT",`projects/${s}/issues/${t.issueNumber}`,"-f",`add_labels=${t.labels.join(",")}`],this.runOpts(t.cwd))).exitCode===0}async upsertIssue(e,t){const s=p(t.repo),r=await e.run("glab",["api",`projects/${s}/issues?state=opened&search=${encodeURIComponent(t.marker)}&in=title`],this.runOpts(t.cwd));if(r.exitCode===0)try{const c=JSON.parse(r.stdout).find(l=>l.title.includes(t.marker));if(c){const l=["api","-X","PUT",`projects/${s}/issues/${c.iid}`,"-f",`title=${t.title}`,"-f",`description=${t.body}`];if(t.labels&&t.labels.length>0&&l.push("-f",`add_labels=${t.labels.join(",")}`),t.assignees?.[0]){const h=await e.run("glab",["api",`users?username=${encodeURIComponent(t.assignees[0])}`],this.runOpts(t.cwd));try{const g=JSON.parse(h.stdout);g[0]&&l.push("-f",`assignee_id=${g[0].id}`)}catch{}}return(await e.run("glab",l,this.runOpts(t.cwd))).exitCode===0?{created:!1,number:c.iid,url:c.web_url}:void 0}}catch{}const n=["issue","create","--repo",t.repo,"--title",t.title,"--description",t.body,"--yes"];t.labels&&t.labels.length>0&&n.push("--label",t.labels.join(",")),t.assignees?.[0]&&n.push("--assignee",t.assignees[0]);const i=await e.run("glab",n,this.runOpts(t.cwd));if(i.exitCode!==0)return;const a=i.stdout.trim(),u=/\/issues\/(\d+)/.exec(a);return u?{created:!0,number:Number.parseInt(u[1]??"0",10),url:a}:void 0}async closeIssue(e,t){if(t.closingComment){const s=p(t.repo);await e.run("glab",["api","-X","POST",`projects/${s}/issues/${t.issueNumber}/notes`,"-f",`body=${t.closingComment}`],this.runOpts(t.cwd))}return(await e.run("glab",["issue","close",String(t.issueNumber),"--repo",t.repo],this.runOpts(t.cwd))).exitCode===0}async upsertPullRequest(e,t){const s=p(t.repo),r=await e.run("glab",["api",`projects/${s}/merge_requests?state=opened&source_branch=${encodeURIComponent(t.head)}&target_branch=${encodeURIComponent(t.base)}`],this.runOpts(t.cwd));if(r.exitCode===0)try{const u=JSON.parse(r.stdout);if(u[0])return(await e.run("glab",["api","-X","PUT",`projects/${s}/merge_requests/${u[0].iid}`,"-f",`title=${t.title}`,"-f",`description=${t.body}`],this.runOpts(t.cwd))).exitCode===0?{existing:!0,number:u[0].iid,url:u[0].web_url}:void 0}catch{}const n=await e.run("glab",["mr","create","--repo",t.repo,"--source-branch",t.head,"--target-branch",t.base,"--title",t.title,"--description",t.body,"--yes"],this.runOpts(t.cwd));if(n.exitCode!==0)return;const i=n.stdout.trim(),a=/\/merge_requests\/(\d+)/.exec(i);return a?{existing:!1,number:Number.parseInt(a[1]??"0",10),url:i}:void 0}}const R=o=>{if(o.GITHUB_ACTIONS==="true"||o.GITHUB_REPOSITORY)return"github";if(o.GITLAB_CI==="true"||o.CI_PROJECT_PATH)return"gitlab"},k=o=>{const e=o.trim();if(e!==""){if(!e.includes("://")){const t=e.indexOf(":"),s=e.indexOf("/");if(t>0&&(s===-1||t<s)){const r=e.slice(0,t),n=r.lastIndexOf("@");return(n===-1?r:r.slice(n+1)).toLowerCase()||void 0}return}try{return new URL(e).hostname.toLowerCase()||void 0}catch{return}}},_=async(o,e)=>{const t=await e.run("git",["config","--get","remote.origin.url"],{cwd:o,silent:!0});if(t.exitCode!==0)return;const s=k(t.stdout);if(s){if(s==="github.com"||s.endsWith(".github.com"))return"github";if(s==="gitlab.com"||s.startsWith("gitlab."))return"gitlab"}},I=async(o,e,t,s=process.env)=>R(s)??await _(o,e)??"github",S=(o,e={})=>o==="gitlab"?new b({host:e.gitlabHost,httpProxy:e.httpProxy}):new C({host:e.githubHost,httpProxy:e.httpProxy});export{S as createRemoteClient,I as detectRemoteProvider};
@@ -0,0 +1,4 @@
1
+ import n from"react-devtools-core";import r from"ws";const i=async()=>new Promise(t=>{const e=new r("ws://localhost:8097"),o=setTimeout(()=>{e.terminate(),t(!1)},2e3);o.unref(),e.on("open",()=>{clearTimeout(o),e.terminate(),t(!0)}),e.on("error",()=>{clearTimeout(o),e.terminate(),t(!1)})});await i()?(n.initialize(),n.connectToDevTools()):console.warn(`DEV is set to true, but the React DevTools server is not running. Start it with:
2
+
3
+ $ npx react-devtools
4
+ `);
@@ -0,0 +1,4 @@
1
+ import{expandNotificationTemplate as h}from"./interface.js";const p=4096,l=3800,d=i=>i.url?`• [\`${i.name}@${i.version}\`](${i.url})`:`• \`${i.name}@${i.version}\``,f=i=>{const t=i.published.map(n=>d(n));let s=t.join(`
2
+ `);if(s.length>l){let n=0;const e=[];for(const r of t){if(n+r.length+1>l){e.push(`*… +${t.length-e.length} more*`);break}e.push(r),n+=r.length+1}s=e.join(`
3
+ `)}return s.slice(0,p)};class g{constructor(t){this.config=t,this.id=t.id?`discord:${t.id}`:"discord"}config;id;async send(t){const s=this.config.title?h(this.config.title,t):`🚀 Released ${t.published.length} package${t.published.length===1?"":"s"}`,n={color:this.config.color??3900150,description:f(t),fields:[],timestamp:t.completedAt,title:s},e=[];if(t.channel&&e.push({inline:!0,name:"Channel",value:`\`${t.channel}\``}),t.repo&&e.push({inline:!0,name:"Repository",value:`[${t.repo}](https://github.com/${t.repo})`}),t.skipped.length>0&&this.config.includeSkipped!==!1){const o=t.skipped.map(c=>`\`${c.name}\` — ${c.reason}`).join(`
4
+ `).slice(0,1024);e.push({inline:!1,name:`Skipped (${t.skipped.length})`,value:o})}e.length>0&&(n.fields=e);const r={...this.config.username?{username:this.config.username}:{},...this.config.avatarUrl?{avatar_url:this.config.avatarUrl}:{},embeds:[n]};let a;try{a=await fetch(this.config.webhook,{body:JSON.stringify(r),headers:{"Content-Type":"application/json"},method:"POST"})}catch(o){const c=o instanceof Error?o.name:"NetworkError";throw new Error(`Discord webhook fetch failed (${c})`,{cause:o})}if(!a.ok){const o=await a.text().catch(()=>"");throw new Error(`Discord webhook returned ${a.status} ${a.statusText}${o?`: ${o.slice(0,200)}`:""}`)}}}export{g as DiscordNotificationChannel};
@@ -0,0 +1,4 @@
1
+ import{createRequire as d}from"node:module";import{m as p,H as v}from"../packem_shared/index-BVuCxe14.js";const f=d(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[r,s]=i.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return i.getBuiltinModule(e)}return f(e)},{spawnSync:l}=u("node:child_process"),{readFileSync:h,statSync:g}=u("node:fs"),m={npm:{pm:"npm",runner:!1},npx:{pm:"npm",runner:!0},pnpm:{pm:"pnpm",runner:!1},pnpx:{pm:"pnpm",runner:!0},yarn:{pm:"yarn",runner:!1},yarnpkg:{pm:"yarn",runner:!1}},y=new Set(["create","dlx","exec","init"]),a=e=>{try{return g(e).isFile()}catch{return!1}},_=e=>e==="npm"||e==="pnpm"||e==="yarn"?e:void 0,w=e=>{const r=[["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"],["npm-shrinkwrap.json","npm"]];let s=e;for(;;){const t=p(s,"package.json");if(a(t))try{const o=JSON.parse(h(t,"utf8")).packageManager;if(typeof o=="string"&&o.length>0){const c=_(o.split("@")[0]);if(c!==void 0)return c}}catch{}for(const[o,c]of r)if(a(p(s,o)))return c;const n=v(s);if(n===s)return;s=n}},x=()=>process.env.npm_config_user_agent!==void 0||process.env.npm_execpath!==void 0,k=(e,r,s,t)=>{const n=m[e];if(n===void 0)return"dispatch";const o=n.runner||s!==void 0&&y.has(s);return r!==void 0&&n.pm!==r&&!o&&!t?"refuse":"dispatch"},S=e=>{const r=process.platform==="win32"?[`${e}.cmd`,`${e}.exe`,e]:[e];for(const s of(process.env.PATH??"").split(process.platform==="win32"?";":":"))if(!(s===""||s.replace(/[/\\]+$/u,"").endsWith(p(".vis","shims"))))for(const t of r){const n=p(s,t);if(a(n))return n}},b=(e,r)=>{m[e]===void 0&&(process.stderr.write(`vis: ${e} is not a known package-manager shim.
2
+ `),process.exit(1));const s=w(process.cwd());k(e,s,r[0],x())==="refuse"&&(process.stderr.write(`vis: this project uses ${String(s)}, but \`${e}\` was run. Use \`${String(s)}\` instead, or run \`vis shim uninstall\` to disable the PM guard.
3
+ `),process.exit(1));const t=S(e);t===void 0&&(process.stderr.write(`vis: \`${e}\` was not found on PATH (outside the shim dir).
4
+ `),process.exit(1));const n=l(t,r,{stdio:"inherit"});process.exit(n.status??(n.signal===null?0:1))};export{k as decideShim,b as dispatchShim};
@@ -0,0 +1,2 @@
1
+ import{I as p,V as u,j as l,E as i,q as h,s as g}from"../packem_shared/index.server-J83sowC4.js";import{resolveTurboEnvCompat as d,ReapiRemoteCache as m}from"@visulima/task-runner";import{p as b}from"./cli-main.js";const f=(t,r)=>r==="http"||r==="reapi"?r:t.startsWith("grpc://")||t.startsWith("grpcs://")?"reapi":"http",$=async(t,r)=>{const o=Date.now(),a=new AbortController,e=setTimeout(()=>{a.abort()},r);try{const s=await fetch(t,{method:"HEAD",signal:a.signal});return{backend:"http",durationMs:Date.now()-o,httpStatus:s.status,ok:!0,url:t}}catch(s){return{backend:"http",durationMs:Date.now()-o,error:s instanceof Error?s.message:String(s),ok:!1,url:t}}finally{clearTimeout(e)}},k=async(t,r)=>{const o=Date.now(),a=new m({...t,timeout:r});try{return{backend:"reapi",capabilities:await a.probeCapabilities(),durationMs:Date.now()-o,ok:!0,url:t.url}}catch(e){return{backend:"reapi",durationMs:Date.now()-o,error:e instanceof Error?e.message:String(e),ok:!1,url:t.url}}finally{try{await a.close()}catch{}}},w=t=>{const r=[],o=t.ok?p("OK"):u("FAIL");if(r.push(`${l("Remote cache")} ${o}`),r.push(` ${i("URL:")} ${h(t.url)}`),r.push(` ${i("Backend:")} ${t.backend}`),r.push(` ${i("Latency:")} ${String(t.durationMs)}ms`),t.httpStatus!==void 0&&r.push(` ${i("Status:")} ${String(t.httpStatus)}`),t.capabilities){const a=t.capabilities.digestFunctions.length>0?t.capabilities.digestFunctions.join(", "):g("(none advertised)");r.push(` ${i("Digests:")} ${a}`),r.push(` ${i("Batch:")} ${String(t.capabilities.maxBatchTotalSizeBytes)} bytes`)}return t.error&&r.push(` ${i("Error:")} ${u(t.error)}`),r.join(`
2
+ `)},D=async({logger:t,options:r,visConfig:o})=>{const a=d((o??{}).taskRunner?.remoteCache),e=r.url??a?.url,s=r.format??"table",c=r.timeout??5e3;if(!e){b.error("No remote cache configured. Set taskRunner.remoteCache.url in vis.config.ts, pass --url=..., or export TURBO_API."),process.exitCode=1;return}const n=f(e,r.backend)==="reapi"?await k({...a??{url:e},backend:"reapi",url:e},c):await $(e,c);s==="json"?t.log(JSON.stringify(n,null,2)):t.log(w(n)),n.ok||(process.exitCode=1)};export{D as cacheDoctorExecute};
@@ -0,0 +1 @@
1
+ const o=async m=>import(m);export{o as dynamicEsmImport};
@@ -0,0 +1,3 @@
1
+ import{createRequire as N}from"node:module";import{VisReleaseError as b}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const A=N(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[o,s]=d.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return d.getBuiltinModule(e)}return A(e)},{readFile:I}=y("node:fs/promises"),{isAbsolute:x,join:w}=y("node:path"),R="x-release-please-version",_=e=>e.type==="annotation",O=e=>!_(e),j=(e,o)=>{if(!O(e))throw new b({code:"CONFIG_INVALID",message:`extra-files rule at ${o} has type="${e.type}" — compileRule is regex-only.`});try{return new RegExp(e.search,e.flags??"g")}catch(s){throw new b({cause:s,code:"CONFIG_INVALID",message:`Invalid extra-files regex at ${o}.search: ${s.message}`})}},E=(e,o,s)=>e.replaceAll("{version}",o).replaceAll("{name}",s).replaceAll("{packageName}",s),F=/\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?/,v=(e,o)=>{let s=0;if(o!==void 0){const h=e.indexOf(o);if(h===-1)return;s=h+o.length}const u=e.slice(s),r=F.exec(u);if(r)return{index:s+r.index,match:r[0]}},T=(e,o,s,u,r)=>{const h=e.marker??R,i=[],c=o.split(`
2
+ `);let n=!1,a=!1;for(let t=0;t<c.length;t++){const l=c[t];if(l.includes(h))if(n=!0,l.slice(0,l.indexOf(h)).replace(/^\s*(?:#|\/\/|\/\*|--|<!--)\s*$/,"").trim()===""){const p=t+1,f=c[p];if(f===void 0){i.push(`extra-files: ${u}[${e.path}] annotation marker on the last line of ${r} (no following line to update).`);continue}const g=v(f,e.anchor);if(!g){i.push(e.anchor===void 0?`extra-files: ${u}[${e.path}] annotation marker at ${r}:${t+1} but no semver-shaped substring on the following line.`:`extra-files: ${u}[${e.path}] annotation marker at ${r}:${t+1} but anchor "${e.anchor}" / no semver-shaped substring after it on the following line.`);continue}c[p]=f.slice(0,g.index)+s+f.slice(g.index+g.match.length),a=!0}else{const p=v(l,e.anchor);if(!p){i.push(e.anchor===void 0?`extra-files: ${u}[${e.path}] annotation marker at ${r}:${t+1} but no semver-shaped substring on the marked line.`:`extra-files: ${u}[${e.path}] annotation marker at ${r}:${t+1} but anchor "${e.anchor}" / no semver-shaped substring after it on the marked line.`);continue}c[t]=l.slice(0,p.index)+s+l.slice(p.index+p.match.length),a=!0}}return n?a?{content:c.join(`
3
+ `),warnings:i}:{warnings:i}:(i.push(`extra-files: ${u}[${e.path}] annotation marker "${h}" not found in ${r}; rule may be stale.`),{warnings:i})},M=async(e,o,s,u,r)=>{let h;try{h=await I(e,"utf8")}catch(n){return n.code==="ENOENT"?{warnings:[`extra-files: ${r} → ${e} does not exist; skipping ${o.length} rule(s).`]}:{warnings:[`extra-files: ${r} → could not read ${e}: ${n.message}`]}}let i=h;const c=[];for(const n of o){if(_(n)){const f=T(n,i,s,r,e);c.push(...f.warnings),f.content!==void 0&&(i=f.content);continue}const a=j(n,`${r}[${n.path}]`),t=n.replace===void 0?s:E(n.replace,s,u);let l=!1;const p=i.replace(a,(f,...g)=>(l=!0,n.replace===void 0?t:t.replaceAll(/\$([&$1-9])/g,(q,$)=>{if($==="&")return f;if($==="$")return"$";const k=Number.parseInt($,10)-1,m=g[k];return typeof m=="string"?m:""})));if(!l){c.push(`extra-files: ${r}[${n.path}] regex /${n.search}/${n.flags??"g"} matched nothing in ${e}; rule may be stale.`);continue}i=p}return i===h?{warnings:c}:{content:i,warnings:c}},V=async(e,o,s,u,r=[],h=[])=>{const i=[],c=[],n=new Map;for(const a of r){const t=x(a.path)?a.path:w(e,a.path),l=n.get(t)??{label:"workspace",rules:[]};l.rules.push(a),n.set(t,l)}for(const a of h){const t=x(a.path)?a.path:w(o,a.path),l=n.get(t)??{label:"per-package",rules:[]};l.rules.push(a),n.set(t,l)}for(const[a,t]of n){const l=t.rules[0],p=await M(a,t.rules,s,u,t.label);c.push(...p.warnings),p.content!==void 0&&i.push({content:p.content,path:a,rule:l})}return{warnings:c,writes:i}};export{R as DEFAULT_ANNOTATION_MARKER,V as applyExtraFilesForRelease,j as compileRule};
@@ -0,0 +1,11 @@
1
+ import{createRequire as F}from"node:module";import{j as w,E as k,s as b,q as T,V as I,I as j}from"../packem_shared/index.server-J83sowC4.js";import{y as R}from"../packem_shared/index-BVuCxe14.js";import{a as J,r as D,b as m,c as E}from"../packem_shared/ai-fix-B4u2zlVG.js";import{p}from"./cli-main.js";import{l as N}from"../packem_shared/failure-log-MOhz-TBv.js";const A=F(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=o=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,r]=h.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return h.getBuiltinModule(o)}return A(o)},{createInterface:q}=O("node:readline"),B={"ambiguous-match":"ambiguous match",applied:"applied",error:"error","missing-file":"missing file","no-match":"no match","outside-workspace":"outside workspace"},S=(o,t,r)=>{const e=E(o,t,r),s=R(o,e);return s===""||s.startsWith("..")?e:s},L=(o,t,r)=>{const e=[w(`Fix proposal (${o.provider}, confidence: ${o.confidence})`),"",o.explanation||k("<no explanation>")];if(o.cannotFix)return e.push(""),e.push(b(`Cannot fix automatically: ${o.cannotFix}`)),e.join(`
2
+ `);if(o.patches.length===0)return e.push(""),e.push(b("No patches were proposed.")),e.join(`
3
+ `);e.push(""),e.push(w(`Patches (${String(o.patches.length)}):`));for(const[s,i]of o.patches.entries()){const a=S(t,r,i.file);e.push(""),e.push(T(`[${String(s+1)}] ${a}`)),i.reason&&e.push(k(` reason: ${i.reason}`));for(const u of i.oldString.split(`
4
+ `))e.push(I(` - ${u}`));for(const u of i.newString.split(`
5
+ `))e.push(j(` + ${u}`))}return e.join(`
6
+ `)},C=(o,t,r)=>{const e=[];for(const s of o){const i=s.absolutePath?R(t,s.absolutePath)||s.absolutePath:S(t,r,s.patch.file),a=B[s.status];s.status==="applied"?e.push(j(` ✓ ${i}: ${a}`)):e.push(I(` ✗ ${i}: ${a}${s.error?` (${s.error})`:""}`))}return e.join(`
7
+ `)},y=o=>{let t=0,r=0;for(const e of o)e.status==="applied"?t+=1:r+=1;return{applied:t,failed:r}},M=o=>new Promise(t=>{const r=q({input:process.stdin,output:process.stderr});r.question(`${o} (y/N) `,e=>{r.close();const s=e.trim().toLowerCase();t(s==="y"||s==="yes")})}),U=o=>o??process.cwd(),Q=async({argument:o,logger:t,options:r,visConfig:e,workspaceRoot:s})=>{const i=o[0],a=U(s),u=(r.format??"text")==="json";if(!i){if(u){const l=N(a);process.stdout.write(`${JSON.stringify({availableTasks:l,error:"No task ID specified"},void 0,2)}
8
+ `)}else{p.error("No task ID specified. Usage: vis ai fix <project>:<target>");const l=N(a);if(l.length>0){p.info("Tasks with captured failure logs:");for(const f of l)p.info(` - ${f}`)}else p.notice("No failure logs found. Re-run a failing task with `vis run` to capture logs.")}process.exitCode=1;return}const n=await J(a,i,{runId:r.run});if(!n){u?process.stdout.write(`${JSON.stringify({error:"No failure log or run summary found",taskId:i},void 0,2)}
9
+ `):(p.error(`No failure log or run summary found for task "${i}".`),p.notice("Re-run the task with `vis run` so its terminal output and run metadata are captured.")),process.exitCode=1;return}n.terminalOutputCaptured||p.warn(`No captured terminal output for "${i}". Re-run with \`vis run\` for a better fix proposal.`);const _=e?.ai,c=await D(n,t,{cache:r.cache!==!1,config:_});if(!c){u&&process.stdout.write(`${JSON.stringify({error:"AI fix proposal failed or no provider available",taskId:i},void 0,2)}
10
+ `),process.exitCode=1;return}const g=r.apply===!0;if(u){const l=g?void 0:await m(a,n.cwd,c,{dryRun:!0}),f=g?await m(a,n.cwd,c):void 0;if(process.stdout.write(`${JSON.stringify({appliedResults:f,dryRunResults:l,failureContext:{cwd:n.cwd,hash:n.hash,runId:n.runId,taskId:n.taskId,terminalOutputCaptured:n.terminalOutputCaptured},proposal:c},void 0,2)}
11
+ `),g&&f){const{failed:P}=y(f);P>0&&(process.exitCode=1)}return}if(t.info(L(c,a,n.cwd)),c.cannotFix||c.patches.length===0)return;const x=await m(a,n.cwd,c,{dryRun:!0}),$=y(x);if(t.info(""),t.info(w("Patch validation:")),t.info(C(x,a,n.cwd)),!g){t.info(""),p.info("Re-run with --apply to write these patches to disk.");return}if($.applied===0){p.error("No patches can be applied (every patch failed validation)."),process.exitCode=1;return}if(r.yes!==!0&&(t.info(""),!await M(`Apply ${String($.applied)} patch${$.applied===1?"":"es"} to disk?`))){p.notice("Aborted. Nothing written.");return}const v=await m(a,n.cwd,c),d=y(v);t.info(""),t.info(w("Apply results:")),t.info(C(v,a,n.cwd)),t.info(""),d.failed===0?p.success(`Applied ${String(d.applied)} patch${d.applied===1?"":"es"}.`):(p.warn(`${String(d.applied)} applied, ${String(d.failed)} failed.`),process.exitCode=1)};export{Q as aiFix};
@@ -0,0 +1,3 @@
1
+ import{VisReleaseError as d}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const u=async(t,e,i=!0)=>t.runner.run("git",e,{cwd:t.cwd,silent:i}),h=async t=>{const e=await u(t,["rev-parse","--abbrev-ref","HEAD"]);if(e.exitCode!==0)return;const i=e.stdout.trim();return i==="HEAD"||i===""?void 0:i},w=async t=>{const e=await u(t,["rev-parse","HEAD"]);return e.exitCode===0?e.stdout.trim():void 0},E=async t=>{const e=await u(t,["rev-parse","--short","HEAD"]);return e.exitCode===0?e.stdout.trim():void 0},_=async t=>{const e=await u(t,["status","--porcelain"]);return e.exitCode===0&&e.stdout.trim()!==""},f=async(t,e)=>(await u(t,["rev-parse","--verify","--quiet",`refs/tags/${e}`])).exitCode===0,p=async(t,e,i="origin")=>{const s=await u(t,["ls-remote","--tags",i,e]);return s.exitCode===0&&s.stdout.trim()!==""},C=async(t,e,i,s={})=>{if(e.length===0&&!s.allowEmpty)throw new d({code:"CONFIG_INVALID",message:"stageAndCommit called with no files (and allowEmpty=false)."});if(e.length>0){const o=await t.runner.run("git",["add","--",...e],{cwd:t.cwd,silent:!0});if(o.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git add failed: ${o.stderr||o.stdout}`})}const a={...process.env};s.author&&(a.GIT_AUTHOR_NAME=s.author.name,a.GIT_AUTHOR_EMAIL=s.author.email,a.GIT_COMMITTER_NAME=s.author.name,a.GIT_COMMITTER_EMAIL=s.author.email);const r=["commit","-m",i];s.allowEmpty&&r.push("--allow-empty");const n=await t.runner.run("git",r,{cwd:t.cwd,env:a,silent:!0});if(n.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git commit failed: ${n.stderr||n.stdout}`});const c=await w(t);if(!c)throw new d({code:"GIT_OPERATION_FAILED",message:"git commit succeeded but HEAD is not resolvable."});return c},A=6e4;let g;const l=async t=>{const e=Date.now();if(g!==void 0&&e-g.cachedAtMs<A)return g.value;const i=await t.runner.run("gitsign",["--version"],{cwd:t.cwd,silent:!0});return g={cachedAtMs:e,value:i.exitCode===0},g.value},$=async(t,e,i,s={})=>{if(await f(t,e))throw new d({code:"TAG_COLLISION",message:`Tag "${e}" already exists locally. Resolve manually before re-running.`});if(!s.skipRemoteCheck&&await p(t,e,s.remote??"origin"))throw new d({code:"TAG_COLLISION",message:`Tag "${e}" already exists on remote "${s.remote??"origin"}". A previous run may have pushed tags but failed mid-publish — inspect the remote and either re-use the existing tag or delete it before re-running.`});const{signing:a}=s;if(a?.mode==="sigstore"){if(await l(t)){const c=["tag","-a",e];i&&c.push("-m",i);const o=await t.runner.run("gitsign",c,{cwd:t.cwd,silent:!0});if(o.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`gitsign tag ${e} failed: ${o.stderr||o.stdout}`});return}process.stderr.write(`[vis release] Warning: signing.mode is "sigstore" but \`gitsign\` is not on PATH; falling back to GPG signing for tag ${e}.
2
+ `)}const r=["tag"];a&&(a.key&&a.mode==="gpg"?r.push("-u",a.key):r.push("-s")),i?r.push("-a",e,"-m",i):r.push(e);const n=await u(t,r);if(n.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git tag ${e} failed: ${n.stderr||n.stdout}`})},O=async(t,e={})=>{const i=["push",e.remote??"origin","--tags"];e.atomic&&i.splice(1,0,"--atomic");const s=await u(t,i,!1);if(s.exitCode!==0)throw new d({code:"TAG_PUSH_FAILED",hint:"After resolving, re-run with --resume to retry the push.",message:`git push --tags failed: ${s.stderr||s.stdout}`})},v=async(t,e,i={})=>{const{signing:s}=i;if(s?.mode==="sigstore"){if(await l(t)){const c=["tag","-f","-a","-m",`Floating tag ${e}`,e],o=await t.runner.run("gitsign",c,{cwd:t.cwd,silent:!0});if(o.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`gitsign tag -f ${e} failed: ${o.stderr||o.stdout}`});if(i.push===!1)return;const m=await u(t,["push",i.remote??"origin","--force",`refs/tags/${e}:refs/tags/${e}`],!1);if(m.exitCode!==0)throw new d({code:"TAG_PUSH_FAILED",hint:"After resolving, re-run with --resume to retry the push.",message:`git push --force refs/tags/${e} failed: ${m.stderr||m.stdout}`});return}process.stderr.write(`[vis release] Warning: signing.mode is "sigstore" but \`gitsign\` is not on PATH; falling back to GPG signing for floating tag ${e}.
3
+ `)}const a=["tag","-f"];s&&(s.key&&s.mode==="gpg"?a.push("-u",s.key):a.push("-s")),a.push(e);const r=await u(t,a);if(r.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git tag -f ${e} failed: ${r.stderr||r.stdout}`});if(i.push===!1)return;const n=await u(t,["push",i.remote??"origin","--force",`refs/tags/${e}:refs/tags/${e}`],!1);if(n.exitCode!==0)throw new d({code:"TAG_PUSH_FAILED",hint:"After resolving, re-run with --resume to retry the push.",message:`git push --force refs/tags/${e} failed: ${n.stderr||n.stdout}`})},y=async(t,e,i,s={})=>{const a=await t.runner.run("git",["add","-A","--",e],{cwd:t.cwd,silent:!0});if(a.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git add ${e} failed: ${a.stderr||a.stdout}`});if((await t.runner.run("git",["diff","--cached","--quiet","--",e],{cwd:t.cwd,silent:!0})).exitCode===0)return{committed:!1,pushed:!1};const r={...process.env};s.author&&(r.GIT_AUTHOR_NAME=s.author.name,r.GIT_AUTHOR_EMAIL=s.author.email,r.GIT_COMMITTER_NAME=s.author.name,r.GIT_COMMITTER_EMAIL=s.author.email);const n=["commit","-m",i];s.sign&&n.push("-S");const c=await t.runner.run("git",n,{cwd:t.cwd,env:r,silent:!0});if(c.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git commit failed: ${c.stderr||c.stdout}`});if(!s.push)return{committed:!0,pushed:!1};const o=s.branch??await h(t);return o?{committed:!0,pushed:(await t.runner.run("git",["push",s.remote??"origin",`HEAD:${o}`],{cwd:t.cwd,silent:!1})).exitCode===0}:{committed:!0,pushed:!1}},G=async(t,e,i={})=>{const s=["push",i.remote??"origin",`HEAD:${e}`];i.force&&s.push("--force-with-lease");const a=await u(t,s,!1);if(a.exitCode!==0)throw new d({code:"TAG_PUSH_FAILED",message:`git push ${e} failed: ${a.stderr||a.stdout}`})},x=(t,e)=>`${t}@${e}`,I=/\{(name|unscopedName|version|major|minor|patch|date|channel)\}/g,D=(t,e)=>{const i=e.version??"",[s="",a="",r=""]=i.split(/[-+]/,1)[0].split("."),n={channel:e.channel??"",date:e.date??new Date().toISOString().slice(0,10),major:s,minor:a,name:e.name??"",patch:r,unscopedName:e.name?e.name.replace(/^@[^/]+\//,""):"",version:i};return t.replaceAll(I,(c,o)=>n[o]??"")};export{v as createOrUpdateFloatingTag,$ as createTag,x as defaultTagFor,h as getCurrentBranch,w as getCurrentSha,E as getShortSha,l as gitsignAvailable,_ as hasUncommittedChanges,G as pushBranch,O as pushTags,D as renderTagPattern,C as stageAndCommit,y as stageAndCommitFile,f as tagExists,p as tagExistsRemote};
@@ -0,0 +1 @@
1
+ import{s as l}from"../packem_shared/index-BAUIIRZJ.js";import g from"./index.js";import{normaliseGroup as d}from"../release/types.js";const v=(n,e,r)=>(n??"{name}@{version}").replaceAll("{name}",e).replaceAll("{version}",r),h=n=>{let e=n[0]??"0.0.0";for(const r of n){const s=l.valid(r)!==null,t=l.valid(e)!==null;s&&(!t||l.gt(r,e))&&(e=r)}return e},k=(n,e)=>{const r=[...n.fixed??[],...n.linked??[]].map(a=>d(a)),s=[],t=new Set;return r.forEach((a,f)=>{if(!a.syncGitTag)return;const m=e.filter(o=>!t.has(o.name)&&a.packages.some(i=>o.name===i||g(i,o.name))).map(o=>o.name);if(m.length===0)return;for(const o of m)t.add(o);const u=m.map(o=>e.find(i=>i.name===o)?.version??"0.0.0"),p=h(u),c=a.name??`group-${f}`;s.push({members:m,name:c,tag:v(a.tagPattern,c,p),version:p})}),{grouped:t,groups:s}};export{k as resolveSyncTagGroups};
@@ -1 +1 @@
1
- var O=Object.defineProperty;var w=(o,e)=>O(o,"name",{value:e,configurable:!0});import{createTaskGraph as b}from"@visulima/task-runner";import{r as E,f as R}from"../packem_shared/selectors-CfH9ZY08.js";import{Z as x,e as G}from"../packem_shared/bin-BaZZ32BK.js";var J=Object.defineProperty,m=w((o,e)=>J(o,"name",{value:e,configurable:!0}),"u");const P=m((o,e,n)=>{const c=[],t=new Set,l=m((r,f)=>{if(t.has(r))return;t.add(r);const s=e[r]??[];for(const i of s)l(i,f+1);const d=n[r],u=" ".repeat(f);c.push(`${u}${r}${d?.cache===!1?" (no-cache)":""}`)},"walk");for(const r of o)l(r,0);return c},"renderPlan"),S=m((o,e,n)=>({roots:o,tasks:Object.fromEntries(Object.entries(n).map(([c,t])=>[c,{cache:t.cache,dependsOn:e[c]??[],outputs:t.outputs,parallelism:t.parallelism,projectRoot:t.projectRoot,target:t.target}]))}),"toJson"),T=m(async({argument:o,logger:e,options:n,visConfig:c,workspaceRoot:t})=>{const l=o[0];if(!l)throw new Error("Missing selector. Usage: vis action-graph <selector>");if(!t)throw new Error("Could not determine workspace root. Run inside a monorepo.");const{config:r,packageJsons:f,workspace:s}=x(t,c),d=G(t,s,f),u=await E(l,s,process.cwd(),t),{target:i}=u;let h=u.projects;n.query&&(h=R(h,s,n.query));const j=h.filter(p=>s.projects[p]?.targets?.[i]!==void 0);if(j.length===0){e.info(`No projects have a "${i}" target.`);return}const v=j.map(p=>{const k=s.projects[p],g=k.targets?.[i],$={project:p,target:i};return{cache:g?.cache,id:`${p}:${i}`,outputs:g?.outputs??[],overrides:{command:g?.command},parallelism:g?.parallelism,projectRoot:k.root,target:$}}),a=b(v,{projectGraph:d,targetDefaults:r.targetDefaults,workspace:s});if(n.json){e.info(JSON.stringify(S(a.roots,a.dependencies,a.tasks),null,2));return}const y=P(a.roots,a.dependencies,a.tasks);e.info(`Execution plan (${Object.keys(a.tasks).length} task(s), ${a.roots.length} root(s)):`),e.info("");for(const p of y)e.info(p)},"execute");export{T as default};
1
+ import{L as v,h,N as u}from"../packem_shared/pm-runner-mVFjedM6.js";import{r as w,a as C}from"../packem_shared/command-runtime-EWjmSxPj.js";import{i as R}from"../packem_shared/utils-CRueU43T.js";const b=async({argument:f,logger:l,options:e,rawUnknown:m,visConfig:s,workspaceRoot:d})=>{const a=f;if(!a||a.length===0)throw new Error("No command specified. Usage: vis exec <command> [args...]");const[n,...c]=a,t=m??[],i=t[0]==="--"?c:[...c,...t],o=d??process.cwd(),p=R(e.filter);let r=!e.recursive&&!e.workspaceRoot&&!e.parallel&&!e.reverse&&!e.shellMode&&p.length===0?v(n,i,o):null;if(r===null){const g=w({logger:l,options:e,visConfig:s},o),k=h(o,{backend:C(g),configBackend:s?.install?.backend,configCorepack:s?.install?.corepack});r=u(k,{args:i,command:n,filter:p,parallel:e.parallel||!1,recursive:e.recursive||!1,reverse:e.reverse||!1,shellMode:e.shellMode||!1,workspaceRoot:e.workspaceRoot||!1},o,l)}r!==0&&(process.exitCode=r)};export{b as default};
@@ -1 +1,5 @@
1
- var m=Object.defineProperty;var f=(r,n)=>m(r,"name",{value:n,configurable:!0});import{r as u}from"../packem_shared/toolchain-C3ZG0o_X.js";var _=Object.defineProperty,a=f((r,n)=>_(r,"name",{value:n,configurable:!0}),"n");const C=a(()=>process.env.GITHUB_BASE_REF?{base:`origin/${process.env.GITHUB_BASE_REF}`,head:process.env.GITHUB_SHA??"HEAD"}:process.env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME?{base:`origin/${process.env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME}`,head:process.env.CI_COMMIT_SHA??"HEAD"}:process.env.CIRCLE_BRANCH&&process.env.CIRCLE_SHA1?{base:"origin/main",head:process.env.CIRCLE_SHA1}:{base:"origin/main",head:"HEAD"},"detectCiRefs"),w=a(async({argument:r,logger:n,options:e,runtime:t,visConfig:d,workspaceRoot:s})=>{const l=r[0];if(!l)throw new Error("Missing targets. Usage: vis ci <target>[,<target>…]");const p=l.split(",").map(o=>o.trim()).filter(Boolean);if(p.length===0)throw new Error("Missing targets. Usage: vis ci <target>[,<target>…]");if(!s)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const{base:E,head:h}=C(),c=e.base??E,g=e.head??h;e.skipToolchain||n.info("▸ Toolchain pre-flight"),await u(s,d?.toolchain,{error:a(o=>n.error(o),"error"),info:a(o=>n.info(o),"info"),warn:a(o=>n.warn(o),"warn")},!!e.skipToolchain),e.install===!1?n.info("▸ Skipping install (--no-install)"):(n.info("▸ Installing dependencies"),await t.runCommand("install",{argv:["--frozen-lockfile"]}));for(const o of p){n.info(`▸ Running affected ${o} (base=${c}, head=${g})`);const i=[o,`--base=${c}`,`--head=${g}`,`--upstream=${String(e.upstream??"none")}`,`--downstream=${String(e.downstream??"deep")}`];e.parallel!==void 0&&i.push(`--parallel=${String(e.parallel)}`),e.partition&&i.push(`--partition=${String(e.partition)}`),e.query&&i.push(`--query=${String(e.query)}`),await t.runCommand("affected",{argv:i})}n.info("▸ CI pipeline complete")},"execute");export{w as default};
1
+ import{createRequire as g}from"node:module";import{f as l,v as d,m as r,T as w}from"../packem_shared/index-BVuCxe14.js";import{b as y}from"../packem_shared/env-Cpxa_7UE.js";const v=g(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=o=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[n,i]=t.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return t.getBuiltinModule(o)}return v(o)},{homedir:s}=u("node:os"),{createInterface:_}=u("node:readline"),c=y(),m=[r(s(),".zshrc"),r(s(),".zshenv"),r(s(),".bashrc"),r(s(),".bash_profile"),r(s(),".profile"),r(s(),".config","fish","config.fish")],b=o=>{const n=[];for(const i of m)if(l(i))try{const f=d(i).split(`
2
+ `),a=f.filter(e=>!e.includes(".vis/bin")&&!e.includes("VIS_HOME")&&!e.includes("# vis "));a.length!==f.length&&(w(i,a.join(`
3
+ `)),n.push(i))}catch{o.warn(`warning: could not clean ${i}`)}return n},q=async({fs:o,logger:n,options:i})=>{if(!l(c)){n.info("vis is not installed (no ~/.vis directory found).");return}n.info("This will remove:"),n.info(` ${c}/`);const f=m.filter(e=>l(e)&&d(e).includes(".vis"));for(const e of f)n.info(` Lines in ${e}`);if(!i.yes){if(!process.stdin.isTTY)throw new Error("Non-interactive terminal. Use --yes to confirm.");const e=_({input:process.stdin,output:process.stdout}),p=await new Promise(h=>{e.question(`
4
+ Type "uninstall" to confirm: `,h)});if(e.close(),p.trim()!=="uninstall"){n.info("Aborted.");return}}const a=b(n);for(const e of a)n.info(`Cleaned ${e}`);try{await o.rm(c,{force:!0,recursive:!0}),n.info(`
5
+ ✓ Removed ${c}`)}catch(e){throw new Error(`Failed to remove ${c}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}n.info("✓ vis has been uninstalled.")};export{q as default};
@@ -1 +1 @@
1
- var g=Object.defineProperty;var d=(n,o)=>g(n,"name",{value:o,configurable:!0});import{createRequire as h}from"node:module";import{isAccessibleSync as R}from"@visulima/fs";import{join as m}from"@visulima/path";import{cleanWorkspace as $}from"#native";import{c as u,d as p,O as f}from"../packem_shared/bin-BaZZ32BK.js";import{f as j}from"../packem_shared/utils-DrNg0XTR.js";const v=h(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=d(n=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[o,s]=l.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return l.getBuiltinModule(n)}return v(n)},"__cjs_getBuiltinModule"),{readdirSync:_,lstatSync:k,unlinkSync:b}=y("node:fs");var S=Object.defineProperty,a=d((n,o)=>S(n,"name",{value:o,configurable:!0}),"l");const x=a(n=>{const o=[],s=[n];for(;s.length>0;){const t=s.pop();let c;try{c=_(t)}catch{continue}for(const r of c){const e=m(t,r);try{const i=k(e);if(i.isSymbolicLink()||!i.isDirectory())continue}catch{continue}r==="node_modules"?o.push(e):r!==".git"&&r!==".hg"&&s.push(e)}}return o},"findNodeModulesDirectories"),N=["pnpm-lock.yaml","package-lock.json","npm-shrinkwrap.json","yarn.lock","bun.lock","bun.lockb"],q=a((n,o,s)=>{let t=0,c=!1;for(const r of N){const e=m(n,r);if(R(e)){if(o){s.info(` ${e}`),t++;continue}try{b(e),u(`Removed ${e}`),t++}catch(i){p(`${e}: ${j(i)}`),c=!0}}}return{hadError:c,removed:t}},"removeLockfiles"),O=a(async({logger:n,options:o,workspaceRoot:s})=>{const t=s??process.cwd(),c=o.lockfile||!1;if(o.dryRun){const e=x(t);if(e.length>0){f("Would remove:");for(const i of e)n.info(` ${i}`)}else f("No node_modules directories found.");c&&q(t,!0,n);return}const r=$(t,c);for(const e of r.removed)u(`Removed ${e}`);for(const e of r.lockfilesRemoved)u(`Removed ${e}`);for(const e of r.errors)p(e);r.removed.length===0&&r.lockfilesRemoved.length===0?f("No node_modules directories found."):f(`Cleaned ${r.removed.length} node_modules director${r.removed.length===1?"y":"ies"}`),r.errors.length>0&&(process.exitCode=1)},"execute");export{O as default};
1
+ import{h as f,a as d}from"../packem_shared/pm-runner-mVFjedM6.js";import{r as k,a as m}from"../packem_shared/command-runtime-EWjmSxPj.js";const h=async({argument:o,logger:s,options:i,process:c,visConfig:e,workspaceRoot:r})=>{if(!o||o.length===0)throw new Error("No package specified. Usage: vis info <package> [field...]");const[t,...l]=o,a=r??c.cwd,p=k({logger:s,options:i,visConfig:e},a),g=f(a,{backend:m(p),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),n=d(g,{fields:l,json:i.json||!1,package:t},a,s);n!==0&&n!==1&&(process.exitCode=n)};export{h as default};