@visulima/vis 6.5.0 → 6.5.2

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 (148) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/binx.js +1 -1
  4. package/dist/packem_chunks/bloom-sync.js +1 -1
  5. package/dist/packem_chunks/cargo-plan.js +1 -1
  6. package/dist/packem_chunks/catalog-detector.js +1 -1
  7. package/dist/packem_chunks/catalog.js +11 -1
  8. package/dist/packem_chunks/cli-exec.js +1 -1
  9. package/dist/packem_chunks/cli-main.js +2 -2
  10. package/dist/packem_chunks/context.js +4 -4
  11. package/dist/packem_chunks/fix.js +1 -1
  12. package/dist/packem_chunks/handler10.js +1 -1
  13. package/dist/packem_chunks/handler12.js +1 -1
  14. package/dist/packem_chunks/handler13.js +1 -1
  15. package/dist/packem_chunks/handler14.js +1 -1
  16. package/dist/packem_chunks/handler15.js +1 -1
  17. package/dist/packem_chunks/handler19.js +1 -1
  18. package/dist/packem_chunks/handler2.js +1 -1
  19. package/dist/packem_chunks/handler20.js +1 -1
  20. package/dist/packem_chunks/handler21.js +1 -1
  21. package/dist/packem_chunks/handler23.js +1 -1
  22. package/dist/packem_chunks/handler24.js +1 -1
  23. package/dist/packem_chunks/handler25.js +1 -1
  24. package/dist/packem_chunks/handler26.js +1 -1
  25. package/dist/packem_chunks/handler28.js +1 -1
  26. package/dist/packem_chunks/handler3.js +1 -1
  27. package/dist/packem_chunks/handler32.js +1 -1
  28. package/dist/packem_chunks/handler39.js +5 -5
  29. package/dist/packem_chunks/handler4.js +1 -1
  30. package/dist/packem_chunks/handler46.js +1 -1
  31. package/dist/packem_chunks/handler49.js +1 -1
  32. package/dist/packem_chunks/handler5.js +1 -1
  33. package/dist/packem_chunks/handler50.js +1 -1
  34. package/dist/packem_chunks/handler51.js +1 -1
  35. package/dist/packem_chunks/handler52.js +1 -1
  36. package/dist/packem_chunks/handler54.js +1 -1
  37. package/dist/packem_chunks/handler55.js +1 -1
  38. package/dist/packem_chunks/handler56.js +5 -5
  39. package/dist/packem_chunks/handler58.js +1 -1
  40. package/dist/packem_chunks/handler59.js +1 -1
  41. package/dist/packem_chunks/handler6.js +1 -1
  42. package/dist/packem_chunks/handler60.js +1 -1
  43. package/dist/packem_chunks/handler61.js +1 -1
  44. package/dist/packem_chunks/handler62.js +1 -1
  45. package/dist/packem_chunks/handler63.js +1 -1
  46. package/dist/packem_chunks/handler64.js +1 -1
  47. package/dist/packem_chunks/handler65.js +1 -1
  48. package/dist/packem_chunks/handler66.js +1 -1
  49. package/dist/packem_chunks/handler67.js +1 -1
  50. package/dist/packem_chunks/handler68.js +1 -1
  51. package/dist/packem_chunks/handler69.js +1 -1
  52. package/dist/packem_chunks/handler7.js +1 -1
  53. package/dist/packem_chunks/handler70.js +1 -1
  54. package/dist/packem_chunks/handler71.js +1 -1
  55. package/dist/packem_chunks/handler72.js +1 -1
  56. package/dist/packem_chunks/handler73.js +1 -1
  57. package/dist/packem_chunks/handler74.js +1 -1
  58. package/dist/packem_chunks/handler75.js +1 -1
  59. package/dist/packem_chunks/handler76.js +1 -1
  60. package/dist/packem_chunks/handler77.js +1 -1
  61. package/dist/packem_chunks/handler78.js +1 -1
  62. package/dist/packem_chunks/handler79.js +1 -1
  63. package/dist/packem_chunks/handler8.js +1 -1
  64. package/dist/packem_chunks/heal.js +1 -1
  65. package/dist/packem_chunks/help-command.js +1 -1
  66. package/dist/packem_chunks/index3.js +28 -35
  67. package/dist/packem_chunks/index5.js +140 -801
  68. package/dist/packem_chunks/index6.js +801 -140
  69. package/dist/packem_chunks/index7.js +1 -1
  70. package/dist/packem_chunks/keys-refresh.js +1 -1
  71. package/dist/packem_chunks/list.js +1 -1
  72. package/dist/packem_chunks/native-addon.js +12 -0
  73. package/dist/packem_chunks/prune.js +1 -1
  74. package/dist/packem_chunks/python-plan.js +1 -1
  75. package/dist/packem_chunks/python-projects.js +1 -1
  76. package/dist/packem_chunks/python.js +1 -1
  77. package/dist/packem_chunks/snapshot.js +2 -2
  78. package/dist/packem_chunks/status.js +1 -1
  79. package/dist/packem_chunks/sync.js +1 -1
  80. package/dist/packem_chunks/sync2.js +1 -1
  81. package/dist/packem_chunks/tripwire.js +1 -1
  82. package/dist/packem_chunks/verify-lockfile.js +1 -1
  83. package/dist/packem_chunks/version-resolver.js +1 -1
  84. package/dist/packem_chunks/workspace.js +1 -1
  85. package/dist/packem_shared/{ReleaseClient-DaoIXjdn.js → ReleaseClient-PVB_2PkQ.js} +1 -1
  86. package/dist/packem_shared/{advisories-DPfjSK6L.js → advisories-D6O8_7q8.js} +1 -1
  87. package/dist/packem_shared/{affected-selection-CEH0nr7L.js → affected-selection-pzrz7Up4.js} +1 -1
  88. package/dist/packem_shared/{ai-analysis-_x1ObDrt.js → ai-analysis-BEP03Gjy.js} +1 -1
  89. package/dist/packem_shared/{ai-cache-CDnuFo2o.js → ai-cache-CMlW-WEd.js} +1 -1
  90. package/dist/packem_shared/{ai-fix-DFlK168W.js → ai-fix-CVwgqleW.js} +1 -1
  91. package/dist/packem_shared/apply-VwWv8q05.js +8 -0
  92. package/dist/packem_shared/apply-release-plan-DdhDICdO.js +16 -0
  93. package/dist/packem_shared/{bin-IOaJHdvM.js → bin-CJlwiuPF.js} +1 -1
  94. package/dist/packem_shared/{build-scripts-udyGO2o_.js → build-scripts-BwIDu1P_.js} +1 -1
  95. package/dist/packem_shared/createVersionActions-GD1Y4pNe.js +1 -0
  96. package/dist/packem_shared/{dependency-scan-BtbCm8-s.js → dependency-scan-DrHMLDiM.js} +1 -1
  97. package/dist/packem_shared/{detect-859xRNqW.js → detect-C5tXtm2Z.js} +1 -1
  98. package/dist/packem_shared/{docker-C6KwNzQN.js → docker-APhsTulj.js} +1 -1
  99. package/dist/packem_shared/{ecosystem-gate-DOQpvPpW.js → ecosystem-gate-3nxiOrV7.js} +1 -1
  100. package/dist/packem_shared/{env-consistency-CPPb-xcn.js → env-consistency-Ds8_I0jB.js} +1 -1
  101. package/dist/packem_shared/{env-CK7L59IV.js → env-s78xWj4f.js} +1 -1
  102. package/dist/packem_shared/{failure-log-DeV1UYXh.js → failure-log-BegnAuGN.js} +1 -1
  103. package/dist/packem_shared/glob-Cyk1H9ZL-DfmRDyDG.js +1 -0
  104. package/dist/packem_shared/{index-SMwaTj0E.js → index-Dd7nwlNK.js} +1 -1
  105. package/dist/packem_shared/{index-D4AA8lkJ.js → index-Dp8XCka-.js} +1 -1
  106. package/dist/packem_shared/{lifecycle-Bh4g1Nw5.js → lifecycle-hseoB2PD.js} +1 -1
  107. package/dist/packem_shared/{manifests-DwbazsLq.js → manifests-DOxbsC47.js} +1 -1
  108. package/dist/packem_shared/{min-release-age-CdwchJ9y.js → min-release-age-CZvwRysw.js} +1 -1
  109. package/dist/packem_shared/{missing-package-json-C1471EYw.js → missing-package-json-CRA6kB_n.js} +1 -1
  110. package/dist/packem_shared/{multi-eco-lockfiles-BLuR5c-0.js → multi-eco-lockfiles-B8LKE3Z3.js} +1 -1
  111. package/dist/packem_shared/{native-config-sync-DfJbQPjx.js → native-config-sync-g2U55rGC.js} +1 -1
  112. package/dist/packem_shared/{osv-BOHJQmTi.js → osv-CieXV1_R.js} +1 -1
  113. package/dist/packem_shared/{package-version-CKOVJRf5.js → package-version-C9FT1f_V.js} +1 -1
  114. package/dist/packem_shared/{packument-B9mRtyX_.js → packument-DqZjBn3G.js} +1 -1
  115. package/dist/packem_shared/{project-name-filter-D2BnruR3.js → project-name-filter-60HYlbnm.js} +1 -1
  116. package/dist/packem_shared/{provenance-0_jMjBFB.js → provenance-BgNSfq5T.js} +1 -1
  117. package/dist/packem_shared/publish-missing-BbE62Cqp.js +35 -0
  118. package/dist/packem_shared/{registry-qnmM5zts.js → registry-BC__sZgy.js} +1 -1
  119. package/dist/packem_shared/{registry-keys-B8v0maMC.js → registry-keys-DQttOEKV.js} +1 -1
  120. package/dist/packem_shared/{renderToString-DR0zDUjh-CXoq9r5t.js → renderToString-DR0zDUjh-D2XYc9RB.js} +1 -1
  121. package/dist/packem_shared/{resolve-explicit-h-OAowPZ.js → resolve-explicit-Bh0I2Eeh.js} +1 -1
  122. package/dist/packem_shared/{run-summary-utils-B9iTtwWX.js → run-summary-utils-CDfttQa9.js} +1 -1
  123. package/dist/packem_shared/{runtime-check-BAP6OdMD.js → runtime-check-DF6jeQlZ.js} +1 -1
  124. package/dist/packem_shared/{s1ngularity-BEgUeVZN.js → s1ngularity-Dm0eZv4j.js} +1 -1
  125. package/dist/packem_shared/{scaffold-files-Hxak1SJe.js → scaffold-files-Cwp0HYeD.js} +1 -1
  126. package/dist/packem_shared/{scan-progress-DWNXvT3O.js → scan-progress-DpjrzZsZ.js} +1 -1
  127. package/dist/packem_shared/{selectors-a5O0ZJuW.js → selectors-D3cD94dM.js} +1 -1
  128. package/dist/packem_shared/{signatures-WNCS80My.js → signatures-CVJYTORu.js} +1 -1
  129. package/dist/packem_shared/{spinner-D0API6jF.js → spinner-Kqk6UZwr.js} +1 -1
  130. package/dist/packem_shared/{table-Bl_qTZDf.js → table-BDPKuUgn.js} +1 -1
  131. package/dist/packem_shared/{tabs-ApX_AMUl.js → tabs-xU0YiQZD.js} +1 -1
  132. package/dist/packem_shared/{toolchain-De9sHJyE.js → toolchain-CCm1qaKl.js} +1 -1
  133. package/dist/packem_shared/{typosquats-DxV7JosT.js → typosquats-C0GLxAf9.js} +1 -1
  134. package/dist/packem_shared/{use-measured-height-T4XFSNby.js → use-measured-height-DbDsK33L.js} +1 -1
  135. package/dist/packem_shared/{vis-update-app-DabaMe5c.js → vis-update-app-Byt2SgRv.js} +1 -1
  136. package/dist/packem_shared/{vis-user-error-xjSn62_Z.js → vis-user-error-D8_nt9Ay.js} +1 -1
  137. package/dist/packem_shared/{watch-loop-B1eIlmKa.js → watch-loop-BccjAm0o.js} +1 -1
  138. package/dist/release/index.js +1 -1
  139. package/index.js +26 -26
  140. package/package.json +9 -9
  141. package/dist/packem_chunks/cargo-lock.js +0 -5
  142. package/dist/packem_chunks/catalog2.js +0 -11
  143. package/dist/packem_shared/apply-DA-Dv8Pq.js +0 -8
  144. package/dist/packem_shared/apply-release-plan-BZ_E8GXQ.js +0 -15
  145. package/dist/packem_shared/clean-package-json-rutwkKl-.js +0 -1
  146. package/dist/packem_shared/createVersionActions-DXo4z8VN.js +0 -1
  147. package/dist/packem_shared/glob-Cyk1H9ZL-Dl3N7_h2.js +0 -1
  148. package/dist/packem_shared/publish-missing-Df39xUBX.js +0 -35
@@ -1,40 +1,33 @@
1
- import{createRequire as je}from"node:module";import{VersionActions as C}from"../packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js";import{VisReleaseError as d}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import Se from"./index.js";import{a as J}from"./cargo-lock.js";import{s as V,r as qe,P as Xe}from"./python.js";import{tagExists as ae,renderTagPattern as W,defaultTagFor as _e}from"./git.js";import{a as Ye,s as ne,o as ie,i as te}from"../packem_shared/gradle-build-CHZDHyjI.js";import{rewriteCatalogRefs as Ve}from"./catalog.js";import{c as Oe}from"../packem_shared/clean-package-json-rutwkKl-.js";import{assertValidPackageName as Y,resolveCustomCommands as Q,interpolateCommand as Z}from"./security.js";import{u as ze}from"../packem_shared/apply-release-plan-BZ_E8GXQ.js";let Ue;const Be=a=>(Ue??=je(import.meta.url))(a),F=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,K=a=>{if(typeof F<"u"&&F.versions&&F.versions.node){const[e,r]=F.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return F.getBuiltinModule(a)}return Be(a)},{readdir:re,readFile:_,rm:se,access:Ne,writeFile:E,mkdtemp:He}=K("node:fs/promises"),{join:w,sep:Ae,dirname:U,relative:Ke,resolve:We,basename:R}=K("node:path"),{mkdtempSync:z,writeFileSync:Je}=K("node:fs"),{tmpdir:B}=K("node:os"),Qe=async(a,e)=>{let r=[a];for(const s of e.split("/").filter(n=>n!==""&&n!==".")){if(s==="**")throw new d({code:"CONFIG_INVALID",message:`Unsupported [workspace].members pattern "${e}": "**" is not supported. List the crate directories explicitly or use "dir/*".`});const n=/[*?[{]/.test(s),i=[];for(const t of r){if(!n){i.push(w(t,s));continue}const o=await re(t,{withFileTypes:!0}).catch(()=>[]);for(const l of o)l.isDirectory()&&Se(s,l.name)&&i.push(w(t,l.name))}r=i}return r},Ze=(a,e)=>{for(const r of e)if(a===r||a.startsWith(`${r}${Ae}`))return!0;return!1},De=async a=>{let e=U(J(a));for(;;){const r=w(e,"Cargo.toml"),s=await x(r);if(s!==void 0){const t=(await H(s,r)).workspace?.package?.version;if(typeof t=="string")return t}const n=U(e);if(n===e)return;e=n}},x=async a=>{try{return await _(a,"utf8")}catch{return}},H=async(a,e)=>{const{parse:r}=await import("./index4.js");try{return r(a)}catch(s){throw new d({cause:s,code:"CONFIG_INVALID",file:e,message:`Failed to parse ${e}: ${s.message}`})}},oe=a=>Array.isArray(a)?a.filter(e=>typeof e=="string"):[],q=a=>typeof a=="object"&&a!==null&&a.workspace===!0,xe=(a,e)=>{const r=q(a.publish)?e.workspace?.package?.publish:a.publish;return r===!1||Array.isArray(r)&&r.length===0},er=(a,e,r,s)=>{const n=[];for(const[i,t]of Object.entries(a.dependencies??{})){const o=t,l=q(o),u=l?e.workspace?.dependencies?.[i]:o,k=l?s:r;u===void 0||typeof u!="object"||typeof u.path!="string"||n.push({dir:We(k,u.path),name:typeof u.package=="string"?u.package:i,requirement:typeof u.version=="string"?u.version:"*"})}return n},rr=async a=>{const{claimedDirs:e,cwd:r}=a,s=w(r,"Cargo.toml"),n=await x(s);if(n===void 0)return[];const i=await H(n,s),t=new Set;i.package&&t.add(r);const o=oe(i.workspace?.exclude);for(const g of oe(i.workspace?.members))for(const p of await Qe(r,g)){const h=Ke(r,p).split(Ae).join("/");h.split("/").includes("target")||o.some(c=>Se(c,h))||t.add(p)}const l=new Set([...e].map(g=>J(g))),u=[];for(const g of[...t].sort()){if(Ze(J(g),l))continue;const p=w(g,"Cargo.toml"),h=await x(p);if(h===void 0)continue;const c=await H(h,p);if(!c.package)continue;const{name:b}=c.package;if(typeof b!="string"||b==="")throw new d({code:"CONFIG_INVALID",file:p,message:`${p} has a [package] table without a name.`});const P=c.package.version,v=typeof P=="string"?P:q(P)?i.workspace?.package?.version:void 0;if(typeof v!="string")throw new d({code:"CONFIG_INVALID",file:p,message:`${p} has no resolvable [package].version.`});u.push({dir:g,manifestPath:p,name:b,pathDeps:er(c,i,g,r),private:xe(c.package,i),version:v})}const k=new Map(u.map(g=>[g.dir,g]));return u.map(g=>{const p={};for(const c of g.pathDeps){const b=k.get(c.dir);b&&(p[b.name]=c.requirement)}const h={dependencies:p,name:g.name,private:g.private,version:g.version};return{dir:g.dir,ecosystem:"cargo",manifest:h,manifestPath:g.manifestPath,name:g.name,private:g.private,version:g.version}})},ms=Object.defineProperty({__proto__:null,discoverCargoCrates:rr,findInheritedWorkspaceVersion:De,inheritsFromWorkspace:q,parseCargoDoc:H},Symbol.toStringTag,{value:"Module"}),sr="https://crates.io/api/v1/crates",ar="Cargo.toml",pe=async a=>{let e;try{e=await _(a,"utf8")}catch(o){throw new d({cause:o,code:"CONFIG_INVALID",file:a,message:`Failed to read Cargo.toml at ${a}: ${o.message}`})}const{parse:r}=await import("./index4.js");let s;try{s=r(e)}catch(o){throw new d({cause:o,code:"CONFIG_INVALID",file:a,message:`Failed to parse Cargo.toml at ${a}: ${o.message}`})}if(!s.package)throw new d({code:"CONFIG_INVALID",file:a,hint:"CargoVersionActions only supports publishable crates with a [package] table. For workspace roots, point per-package config at the member crate directory.",message:`Cargo.toml at ${a} has no [package] table.`});const{name:n}=s.package;if(typeof n!="string"||n.length===0)throw new d({code:"CONFIG_INVALID",file:a,message:`Cargo.toml at ${a} is missing [package].name.`});const i=s.package.version;let t;if(typeof i=="string"?t=i:i&&typeof i=="object"&&i.workspace===!0&&(t=await De(a)??s.workspace?.package?.version),typeof t!="string"||t.length===0)throw new d({code:"CONFIG_INVALID",file:a,hint:"Set [package].version explicitly, or — for workspace-inherited versions — ensure the root Cargo.toml carries [workspace.package].version and point per-package config at it.",message:`Cargo.toml at ${a} has no resolvable [package].version.`});return{name:n,version:t}},le=async(a,e)=>{const r=`${sr}/${encodeURIComponent(a)}`;try{const s=await V(r,{headers:{Accept:"application/json"},httpProxy:e});if(s.status===404||!s.ok)return;const n=await s.json();return n?.crate?.max_stable_version??n?.crate?.max_version??void 0}catch{return}},nr=(a,e)=>qe({env:a,staticTokenVar:"CARGO_REGISTRY_TOKEN",workspaceConfig:e})==="oidc",ir=async(a,e)=>{const r=await a.run("cargo",["package","--list","--allow-dirty"],{cwd:e,silent:!0});return r.exitCode!==0?[]:r.stdout.split(/\r?\n/).map(s=>s.trim()).filter(s=>s.length>0)};class tr extends C{id="cargo";async readPublishedVersion(e){const r=ee(e.pkg);try{const{name:s}=await pe(r);return await le(s)}catch{return}}async publish(e){if(e.dryRun)return{output:`[dry-run / cargo] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const r=ee(e.pkg,e.perPackageConfig),s=or(e.pkg,e.perPackageConfig),{name:n,version:i}=await pe(r);if(i!==e.release.newVersion)throw new d({code:"CONFIG_INVALID",file:r,hint:`Confirm the cargo() preset's crateDir points at the directory containing this Cargo.toml. Expected ${e.release.newVersion} on disk after the extra-files bump.`,message:`Cargo.toml version (${i}) does not match planned release version (${e.release.newVersion}) for ${e.pkg.name}.`,packageName:e.pkg.name});if(await le(n,e.workspaceConfig?.httpProxy)===e.release.newVersion)return{alreadyPublished:!0,output:`[cargo] ${n}@${e.release.newVersion} already on crates.io`,published:!1};const o=nr(process.env,e.workspaceConfig);if(!o&&!process.env.CARGO_REGISTRY_TOKEN)throw new d({code:"AUTH_MISSING",hint:"Set CARGO_REGISTRY_TOKEN, or run from a GH-Actions job with `permissions: id-token: write` for OIDC trusted publishing.",message:`Cannot publish ${n}@${e.release.newVersion}: neither CARGO_REGISTRY_TOKEN nor OIDC trusted publishing is available.`,packageName:e.pkg.name});const l=e.workspaceConfig?.publish?.guards;if(l?.packSecretScan){const g=await ir(e.pm.runner,s);if(g.length>0){const{runPackSecretScan:p}=await import("./publish-guards.js"),h=typeof l.packSecretScan=="object"?l.packSecretScan.ignore:void 0,c=await p({files:g,ignore:h,pkgDir:s});if(!c.passed){const{redactTokens:b}=await import("./security.js"),P=c.findings.map(v=>` • [packSecretScan] ${b(v.message)}${v.hint?`
2
- → ${b(v.hint)}`:""}`).join(`
3
- `);throw new d({code:"PUBLISH_FAILED",message:`Pre-publish secret scan failed for ${n}@${e.release.newVersion}:
4
- ${P}`,packageName:e.pkg.name})}}}const u=["publish","--allow-dirty"];e.registry&&e.registry!=="https://crates.io"&&u.push("--registry",e.registry);const k=await e.pm.runner.run("cargo",u,{cwd:s,silent:!1});if(k.exitCode!==0)throw new d({code:"PUBLISH_FAILED",hint:"Inspect the cargo output above. Common causes: missing CARGO_REGISTRY_TOKEN, OIDC permission misconfigured, version already published, crates.io rate limit. Re-runs are safe — the published-version probe short-circuits subsequent runs.",message:`cargo publish failed for ${n}@${e.release.newVersion}: exit ${k.exitCode}. stderr: ${k.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[cargo] published ${n}@${e.release.newVersion}${o?" (trusted publishing)":""}`,published:!0}}}const ee=(a,e)=>{const r=e?.cargoTomlPath??ar;return w(a.dir,r)},or=(a,e)=>U(ee(a,e)),pr=(a,e,r)=>W(a?.releaseTagPattern??"v{version}",{name:e,version:r});class lr extends C{id="composer";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=pr(e.perPackageConfig,r,s);if(e.dryRun)return{output:`[dry-run / composer] would tag ${n} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new d({code:"CONFIG_INVALID",message:`${r} cannot be released from Windows yet: the Composer tag path is not tested there. Release from a POSIX runner.`,packageName:r});if((await e.pm.runner.run("git",["--version"],{cwd:e.pkg.dir,silent:!0})).exitCode!==0)throw new d({code:"CONFIG_INVALID",message:`${r} needs git on PATH to release its tag, and git --version failed.`,packageName:r});return await ae({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[composer] ${r}@${s} is already tagged ${n}; skipped`,published:!1}:{output:`[composer] ${r}@${s} released by tag ${n}`,published:!0}}}const dr=["linux/amd64","linux/arm64"],ur=a=>{const e=a.indexOf("/");if(e===-1)return{registry:"docker.io",repository:`library/${a}`};const r=a.slice(0,e),s=a.slice(e+1);return r==="localhost"||r.includes(".")||r.includes(":")?{registry:r,repository:s}:s.includes("/")?{registry:"docker.io",repository:a}:{registry:"docker.io",repository:`${r}/${s}`}},de=(a,e)=>{const{registry:r,repository:s}=ur(a);return`https://${r==="docker.io"?"registry-1.docker.io":r}/v2/${s}/manifests/${encodeURIComponent(e)}`},Re=a=>{const e=a??{};return{buildContext:e.buildContext,containerBuildArgs:e.containerBuildArgs,containerImage:e.containerImage,containerPlatforms:e.containerPlatforms,containerSigning:e.containerSigning,containerSkipLatest:e.containerSkipLatest}},cr=(a,e)=>{const r=Re(a);if(typeof r.containerImage!="string"||r.containerImage.length===0)throw new d({code:"CONFIG_INVALID",hint:["Container packages must declare `containerImage` in their per-pkg release config:","",' release.packages["<pkg>"] = container({',' image: "ghcr.io/scope/foo",',' platforms: ["linux/amd64", "linux/arm64"],',' signing: "cosign", // optional'," })","",'Or set `versionActions: "container"` + `containerImage` directly.'].join(`
5
- `),message:`containerImage is required for versionActions: "container" on ${e}`,packageName:e});return{buildContext:r.buildContext,containerBuildArgs:r.containerBuildArgs,containerImage:r.containerImage,containerPlatforms:r.containerPlatforms,containerSigning:r.containerSigning,containerSkipLatest:r.containerSkipLatest}};class gr extends C{id="container";async readPublishedVersion(e){const r=Re(e.perPackageConfig);if(!r.containerImage)return;const s=e.pkg.version,n=de(r.containerImage,s);try{return(await V(n,{headers:{Accept:["application/vnd.oci.image.manifest.v1+json","application/vnd.oci.image.index.v1+json","application/vnd.docker.distribution.manifest.v2+json","application/vnd.docker.distribution.manifest.list.v2+json"].join(",")},httpProxy:e.workspaceConfig?.httpProxy,method:"HEAD"})).status===200?s:void 0}catch{return}}async publish(e){const r=cr(e.perPackageConfig,e.pkg.name);if(e.dryRun){const{command:i}=ue(e,r);return{output:`[dry-run / container] would run: ${i.join(" ")}`,published:!0}}try{const i=de(r.containerImage,e.release.newVersion);if((await V(i,{httpProxy:e.workspaceConfig?.httpProxy,method:"HEAD"})).status===200)return{alreadyPublished:!0,output:`[container] ${r.containerImage}:${e.release.newVersion} already published`,published:!1}}catch{}const{command:s}=ue(e,r),n=await e.pm.runner.run(s[0],s.slice(1),{cwd:e.pkg.dir,silent:!1});if(n.exitCode!==0)throw new d({code:"PUBLISH_FAILED",hint:["docker buildx build failed. Common causes:"," • Not authenticated to the registry — run `docker login <registry>` first."," For ECR: `aws ecr get-login-password --region <r> | docker login --username AWS --password-stdin <account>.dkr.ecr.<r>.amazonaws.com`"," For GCR/GAR: `gcloud auth configure-docker <region>-docker.pkg.dev`"," For GHCR: `echo $GITHUB_TOKEN | docker login ghcr.io -u <user> --password-stdin`"," • Buildx not installed / configured — `docker buildx create --use` (one-time setup)."," • Multi-arch build needs QEMU registered — `docker run --privileged --rm tonistiigi/binfmt --install all`."].join(`
6
- `),message:`docker buildx failed for ${e.pkg.name}@${e.release.newVersion}: exit ${n.exitCode}. stderr: ${n.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});if(r.containerSigning==="cosign"){const i=`${r.containerImage}:${e.release.newVersion}`,t=await e.pm.runner.run("cosign",["sign","--yes",i],{cwd:e.pkg.dir,silent:!1});if(t.exitCode!==0)throw new d({code:"PUBLISH_FAILED",hint:"cosign signing failed. For keyless cosign, ensure COSIGN_EXPERIMENTAL=1 (cosign <2.0) and the CI runner has the OIDC token (`id-token: write` permission on GH Actions).",message:`cosign sign failed for ${i}: exit ${t.exitCode}. stderr: ${t.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}return{output:`[container] published ${r.containerImage}:${e.release.newVersion}${r.containerSkipLatest?"":" + :latest"}${r.containerSigning==="cosign"?" (signed via cosign)":""}`,published:!0}}}const ue=(a,e)=>{if(!e.containerImage)throw new Error("buildBuildxCommand requires config.containerImage");const r=(e.containerPlatforms??dr).join(","),s=`${e.containerImage}:${a.release.newVersion}`,n=`${e.containerImage}:latest`,i=e.buildContext??".",t=["docker","buildx","build","--platform",r,"-t",s];e.containerSkipLatest||t.push("-t",n);for(const[o,l]of Object.entries(e.containerBuildArgs??{}))t.push("--build-arg",`${o}=${l}`);return t.push("--label",`org.opencontainers.image.version=${a.release.newVersion}`),t.push("--label",`org.opencontainers.image.title=${a.pkg.name}`),t.push("--push",i),{command:t}},mr=a=>`https://pub.dev/api/packages/${encodeURIComponent(a)}`,hr=async a=>{try{const e=await V(mr(a.pkg.name),{headers:{Accept:"application/vnd.pub.v2+json"},httpProxy:a.workspaceConfig?.httpProxy});if(!e.ok)return!1;const r=JSON.parse(await e.text());return Array.isArray(r.versions)&&r.versions.some(s=>s.version===a.release.newVersion)}catch{return!1}};class fr extends C{id="dart";async readPublishedVersion(e){}async publish(e){const{dir:r,name:s}=e.pkg,n=e.release.newVersion;if(e.dryRun)return{output:`[dry-run / dart] would run dart pub publish --force in ${r} for ${s}@${n}`,published:!0};if(process.platform==="win32")throw new d({code:"CONFIG_INVALID",message:`${s} cannot be published from Windows yet: the Dart path is only verified on POSIX. Publish from a POSIX runner.`,packageName:s});try{const t=await e.pm.runner.run("dart",["--version"],{cwd:r,silent:!0});if(t.exitCode!==0)throw new Error(`exit ${t.exitCode}`)}catch{throw new d({code:"CONFIG_INVALID",message:`${s} needs the Dart SDK to publish, and "dart" is not on PATH. Install the Dart SDK on the runner.`,packageName:s})}if(await hr(e))return{alreadyPublished:!0,output:`[dart] ${s}@${n} is already on pub.dev; skipped`,published:!1};const i=await e.pm.runner.run("dart",["pub","publish","--force"],{cwd:r,silent:!1});if(i.exitCode!==0)throw new d({code:"PUBLISH_FAILED",hint:`Failing command: dart pub publish --force in ${r}
7
- Check the output above. Authenticate with "dart pub token add https://pub.dev" on this runner, or configure automated publishing (OIDC) for the pub.dev package. Errors stop the upload; warnings do not.`,message:`dart pub publish failed for ${s}@${n}: exit ${i.exitCode}. stderr: ${i.stderr.trim().slice(0,500)}`,packageName:s});return{output:`[dart] published ${s}@${n} to pub.dev`,published:!0}}}const wr="https://rubygems.org",br=async(a,e,r)=>{const s=`${wr}/api/v1/versions/${encodeURIComponent(a)}.json`;try{const n=await V(s,{headers:{Accept:"application/json"},httpProxy:r.workspaceConfig?.httpProxy});if(!n.ok)return!1;const i=await n.json();return Array.isArray(i)&&i.some(t=>typeof t=="object"&&t!==null&&t.number===e)}catch{return!1}},kr=async(a,e)=>{try{return(await a.pm.runner.run("gem",["--version"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}};class vr extends C{id="gem";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=R(e.pkg.manifestPath),i=`${r}-${s}.gem`,t=e.pkg.dir;if(e.dryRun)return{output:`[dry-run / gem] would run gem build ${n} and gem push ${i} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new d({code:"CONFIG_INVALID",message:`${r} cannot be published from Windows yet: the gem path is only verified on POSIX. Publish from a POSIX runner.`,packageName:r});if(!await kr(e,t))throw new d({code:"CONFIG_INVALID",message:`${r} needs the gem command on PATH to publish, and "gem --version" failed. Install Ruby (which ships RubyGems) on the runner.`,packageName:r});if(await br(r,s,e))return{alreadyPublished:!0,output:`[gem] ${r}@${s} is already on RubyGems; skipped`,published:!1};const o=await e.pm.runner.run("gem",["build",n],{cwd:t,silent:!1});if(o.exitCode!==0)throw new d({code:"PUBLISH_FAILED",hint:`Failing step: gem build ${n} in ${t}
8
- Fix the gemspec validation error above.`,message:`gem build failed for ${r}@${s}: exit ${o.exitCode}. stderr: ${o.stderr.trim().slice(0,500)}`,packageName:r});try{const l=await e.pm.runner.run("gem",["push",i],{cwd:t,silent:!1});if(l.exitCode!==0)throw new d({code:"PUBLISH_FAILED",hint:`Failing step: gem push ${i}
9
- Check the output above. Credentials come from GEM_HOST_API_KEY in the environment; a gem push to an existing version is refused by RubyGems.`,message:`gem push failed for ${r}@${s}: exit ${l.exitCode}. stderr: ${l.stderr.trim().slice(0,500)}`,packageName:r})}finally{await se(w(t,i),{force:!0})}return{output:`[gem] published ${r}@${s} (${i})`,published:!0}}}const yr=(a,e,r)=>W(a?.releaseTagPattern??"v{version}",{name:e,version:r});class $r extends C{id="go";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=yr(e.perPackageConfig,r,s);if(e.dryRun)return{output:`[dry-run / go] would tag ${n} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new d({code:"CONFIG_INVALID",message:`${r} cannot be released from Windows yet: the Go tag path is not tested there. Release from a POSIX runner.`,packageName:r});if((await e.pm.runner.run("git",["--version"],{cwd:e.pkg.dir,silent:!0})).exitCode!==0)throw new d({code:"CONFIG_INVALID",message:`${r} needs git on PATH to release its tag, and git --version failed.`,packageName:r});return await ae({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[go] ${r}@${s} is already tagged ${n}; skipped`,published:!1}:{output:`[go] ${r}@${s} released by tag ${n}`,published:!0}}}const ce=["build.gradle.kts","build.gradle"],Fe=["settings.gradle.kts","settings.gradle"],D=(a,e)=>new d({code:"CONFIG_INVALID",file:a,message:e}),Ir=async(a,e)=>{for(const r of new Set([w(a,"gradle.properties"),w(e,"gradle.properties")])){let s;try{s=await _(r,"utf8")}catch{continue}if(/^\s*version\s*[=:]/m.test(s))return r}},Cr=a=>Ne(a).then(()=>!0,()=>!1),j=async(a,e)=>{for(const r of e){const s=w(a,r);try{return{path:s,raw:await _(s,"utf8")}}catch{}}},T=(a,e,r)=>{if(a.length===0)return;if(a.length>1)throw D(e,`${e} declares ${r} ${a.length} times on the path that reaches a module (lines ${a.map(n=>n.line).join(", ")}). vis cannot tell which one applies.`);const[s]=a;if(s.literal===void 0)throw D(e,`${e} sets ${r} to an expression on line ${s.line}. vis reads only a plain string literal, such as ${r} = "1.0.0".`);return{assignment:s,value:s.literal.value}},Pr=async a=>{const{claimedDirs:e,cwd:r}=a,s=await j(r,ce),n=await j(r,Fe);if(!s&&!n)return[];const i=n?Ye(n.raw):void 0;if(i?.unsupported.length)throw D(n.path,`${n.path} moves a project (${i.unsupported.join(", ")}). vis cannot follow that to a version; remove it or release the module with a shell publish.`);i?.dynamicIncludes&&process.stderr.write(`[vis release] ⚠ ${n.path} builds part of its include list from code; vis only reads literal include("…") entries.
10
- `);const t=s?ne(s.raw):void 0,o=t?.assignments??[],l=[];s&&l.push({build:s,dir:r,isRoot:!0,path:"",taskPath:""});for(const p of i?.includes??[]){const h=w(r,p),c=await j(h,ce);c&&l.push({build:c,dir:h,isRoot:!1,path:p,taskPath:`:${p.replaceAll("/",":")}`})}const u=[];for(const p of l){if(e.has(p.dir))continue;const h=p.isRoot&&t?t:ne(p.build.raw),c=T(ie(h.assignments,"version"),p.build.path,"version");if(p.isRoot&&c===void 0)continue;const b=c?void 0:T(te(o,"version",p.isRoot),s?.path??p.build.path,"version"),P=c??b;if(!P){const f=await Ir(p.dir,r);if(f!==void 0)throw D(f,`${f} sets version, and vis reads only a string literal in a build script. Move it to version = "…" in ${p.build.path}, or remove it.`);continue}const v=T(ie(h.assignments,"group"),p.build.path,"group")??T(te(o,"group",p.isRoot),s?.path??p.build.path,"group");if(v===void 0)throw D(p.build.path,`${p.build.path} has a version but no group. Declare group = "…" in its build script or in the root build script's allprojects block.`);if(h.usesArchiveName||t?.usesArchiveName)throw D(p.build.path,`${p.build.path} renames its archive (archivesName). vis cannot read the artifact name from that; remove it or release the module with a shell publish.`);const O=p.isRoot?i?.rootName??R(r):R(p.dir);u.push({kind:c?"literal":"inherited",line:P.assignment.line,module:p,name:`${v.value}:${O}`,owner:c?p.build.path:s.path,scan:h,version:P.value})}const k=new Map;for(const p of u){const h=k.get(p.name);if(h!==void 0)throw D(p.module.build.path,`${p.name} is declared by both ${h} and ${p.module.build.path}. Gradle coordinates must be unique to release them.`);k.set(p.name,p.module.build.path)}const g=new Map(u.map(p=>[p.module.path,p.name]));return u.map(({kind:p,line:h,module:c,name:b,owner:P,scan:v,version:O})=>{const f={};for(const y of v.projectRefs){const I=g.get(y.replace(/^:+/,"").split(":").filter($=>$!=="").join("/"));I!==void 0&&I!==b&&(f[I]="*")}const m={dependencies:f,name:b,private:!1,version:O};return{kind:p,line:h,name:b,owner:P,package:{dir:c.dir,ecosystem:"gradle",manifest:m,manifestPath:c.build.path,name:b,private:!1,version:O},taskPath:c.taskPath}})},Me=async a=>{let e=a;for(;;){if(await Cr(w(e,"gradlew"))||await j(e,Fe)!==void 0)return e;const r=U(e);if(r===e)return;e=r}},hs=Object.defineProperty({__proto__:null,discoverGradleProjects:Pr,findGradleRoot:Me},Symbol.toStringTag,{value:"Module"}),Nr=/<!--[\s\S]*?-->/g,Ar=/<project\b[^>]*>([\s\S]*)/i,ge=/<version>\s*([^<]+?)\s*<\/version>/i,me=/<groupId>\s*([^<]+?)\s*<\/groupId>/i,he=/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i,Sr=/<modules\b[^>]*>[\s\S]*?<module\b/i,fe=a=>{const e=a.replaceAll(Nr,""),s=Ar.exec(e)?.[1]??e,n=s.replaceAll(/<parent\b[\s\S]*?<\/parent>/gi,"").replaceAll(/<dependencyManagement\b[\s\S]*?<\/dependencyManagement>/gi,"").replaceAll(/<dependencies\b[\s\S]*?<\/dependencies>/gi,"").replaceAll(/<build\b[\s\S]*?<\/build>/gi,"").replaceAll(/<profiles\b[\s\S]*?<\/profiles>/gi,"").replaceAll(/<pluginRepositories\b[\s\S]*?<\/pluginRepositories>/gi,"").replaceAll(/<repositories\b[\s\S]*?<\/repositories>/gi,""),i=ge.exec(n)??ge.exec(s),t=me.exec(n)??me.exec(s),o=he.exec(n)??he.exec(s),l=Sr.test(s);return{artifactId:o?.[1],groupId:t?.[1],hasModules:l,version:i?.[1]}},_r=a=>{const e=/<latest>\s*([^<]+?)\s*<\/latest>/i.exec(a);if(e?.[1])return e[1];const r=/<versions>([\s\S]*?)<\/versions>/i.exec(a);return r?[...r[1].matchAll(/<version>\s*([^<]+?)\s*<\/version>/gi)].map(n=>n[1]).at(-1):void 0},Vr=a=>{const e=/<versions>([\s\S]*?)<\/versions>/i.exec(a);return e?[...e[1].matchAll(/<version>\s*([^<]+?)\s*<\/version>/gi)].map(r=>r[1]):[]},Le=(a,e)=>{const r=a.split(".").map(n=>encodeURIComponent(n)).join("/"),s=encodeURIComponent(e);return`https://repo1.maven.org/maven2/${r}/${s}/maven-metadata.xml`};class Or extends C{id="maven";warnedMultiModule=new WeakSet;warnIfMultiModule(e,r){!r.hasModules||this.warnedMultiModule.has(e)||(this.warnedMultiModule.add(e),process.stderr.write(`[vis release] ⚠ ${e.name} (${r.groupId??"?"}:${r.artifactId??"?"}) is a multi-module Maven project (<modules> present). vis treats it as a single artifact for version-read + already-published checks. For proper reactor handling, use \`versionActions: "shell"\` with \`mvn -B -ntp deploy\`.
11
- `))}async readPublishedVersion(e){const r=e.perPackageConfig??{},s=w(e.pkg.dir,r.pomPath??"pom.xml");let n;try{n=await _(s,"utf8")}catch{return}const i=fe(n);if(this.warnIfMultiModule(e.pkg,i),!i.groupId||!i.artifactId||r.mavenMetadataUrl==="")return;const t=r.mavenMetadataUrl??Le(i.groupId,i.artifactId);try{const o=await V(t,{headers:{Accept:"text/xml,application/xml;q=0.9,*/*;q=0.8"},httpProxy:e.workspaceConfig?.httpProxy});if(o.status===404||!o.ok)return;const l=await o.text();return _r(l)}catch{return}}async publish(e){const r=e.perPackageConfig??{},s=w(e.pkg.dir,r.pomPath??"pom.xml");let n;try{const o=await _(s,"utf8");n=fe(o)}catch{n=void 0}const i=n?.groupId&&n?.artifactId?`${n.groupId}:${n.artifactId}`:e.pkg.name;if(e.dryRun)return{output:`[dry-run / maven] would run mvn -B -N -f ${s} deploy for ${e.pkg.name}@${e.release.newVersion} (${i})`,published:!0};if(process.platform==="win32")throw new d({code:"CONFIG_INVALID",message:`${e.pkg.name} cannot be published from Windows yet: Maven publish is POSIX-only for now. Publish from a POSIX runner.`,packageName:e.pkg.name});const t=await e.pm.runner.run("mvn",["-B","-N","-f",s,"deploy"],{cwd:e.pkg.dir,silent:!1});if(t.exitCode!==0)throw new d({code:"PUBLISH_FAILED",hint:`Failing artifact: ${i}
1
+ import{createRequire as _e}from"node:module";import{VersionActions as v}from"../packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js";import{VisReleaseError as l}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import ke from"./index.js";import{d as H,e as Me,r as Ee,a as Ge,N as je}from"./native-addon.js";import{s as I,P as Te}from"./python.js";import{tagExists as Y,renderTagPattern as T,defaultTagFor as ve}from"./git.js";import{a as Ue,s as J,o as Z,i as Q}from"../packem_shared/gradle-build-CHZDHyjI.js";import{u as He}from"../packem_shared/apply-release-plan-DdhDICdO.js";import{resolveCustomCommands as W,interpolateCommand as K}from"./security.js";let De;const Re=a=>(De??=_e(import.meta.url))(a),_=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=a=>{if(typeof _<"u"&&_.versions&&_.versions.node){const[e,r]=_.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return _.getBuiltinModule(a)}return Re(a)},{readdir:he,readFile:S,rm:fe,access:we,mkdtemp:Oe}=j("node:fs/promises"),{join:b,sep:be,dirname:E,relative:Fe,resolve:Le,basename:V}=j("node:path"),{mkdtempSync:Be}=j("node:fs"),{tmpdir:$e}=j("node:os"),We=async(a,e)=>{let r=[a];for(const s of e.split("/").filter(n=>n!==""&&n!==".")){if(s==="**")throw new l({code:"CONFIG_INVALID",message:`Unsupported [workspace].members pattern "${e}": "**" is not supported. List the crate directories explicitly or use "dir/*".`});const n=/[*?[{]/.test(s),i=[];for(const t of r){if(!n){i.push(b(t,s));continue}const o=await he(t,{withFileTypes:!0}).catch(()=>[]);for(const p of o)p.isDirectory()&&ke(s,p.name)&&i.push(b(t,p.name))}r=i}return r},Ke=(a,e)=>{for(const r of e)if(a===r||a.startsWith(`${r}${be}`))return!0;return!1},ye=async a=>{let e=E(H(a));for(;;){const r=b(e,"Cargo.toml"),s=await q(r);if(s!==void 0){const t=(await G(s,r)).workspace?.package?.version;if(typeof t=="string")return t}const n=E(e);if(n===e)return;e=n}},q=async a=>{try{return await S(a,"utf8")}catch{return}},G=async(a,e)=>{const{parse:r}=await import("./index4.js");try{return r(a)}catch(s){throw new l({cause:s,code:"CONFIG_INVALID",file:e,message:`Failed to parse ${e}: ${s.message}`})}},x=a=>Array.isArray(a)?a.filter(e=>typeof e=="string"):[],U=a=>typeof a=="object"&&a!==null&&a.workspace===!0,qe=(a,e)=>{const r=U(a.publish)?e.workspace?.package?.publish:a.publish;return r===!1||Array.isArray(r)&&r.length===0},Xe=(a,e,r,s)=>{const n=[];for(const[i,t]of Object.entries(a.dependencies??{})){const o=t,p=U(o),u=p?e.workspace?.dependencies?.[i]:o,w=p?s:r;u===void 0||typeof u!="object"||typeof u.path!="string"||n.push({dir:Le(w,u.path),name:typeof u.package=="string"?u.package:i,requirement:typeof u.version=="string"?u.version:"*"})}return n},Ye=async a=>{const{claimedDirs:e,cwd:r}=a,s=b(r,"Cargo.toml"),n=await q(s);if(n===void 0)return[];const i=await G(n,s),t=new Set;i.package&&t.add(r);const o=x(i.workspace?.exclude);for(const g of x(i.workspace?.members))for(const d of await We(r,g)){const m=Fe(r,d).split(be).join("/");m.split("/").includes("target")||o.some(c=>ke(c,m))||t.add(d)}const p=new Set([...e].map(g=>H(g))),u=[];for(const g of[...t].sort()){if(Ke(H(g),p))continue;const d=b(g,"Cargo.toml"),m=await q(d);if(m===void 0)continue;const c=await G(m,d);if(!c.package)continue;const{name:f}=c.package;if(typeof f!="string"||f==="")throw new l({code:"CONFIG_INVALID",file:d,message:`${d} has a [package] table without a name.`});const $=c.package.version,h=typeof $=="string"?$:U($)?i.workspace?.package?.version:void 0;if(typeof h!="string")throw new l({code:"CONFIG_INVALID",file:d,message:`${d} has no resolvable [package].version.`});u.push({dir:g,manifestPath:d,name:f,pathDeps:Xe(c,i,g,r),private:qe(c.package,i),version:h})}const w=new Map(u.map(g=>[g.dir,g]));return u.map(g=>{const d={};for(const c of g.pathDeps){const f=w.get(c.dir);f&&(d[f.name]=c.requirement)}const m={dependencies:d,name:g.name,private:g.private,version:g.version};return{dir:g.dir,ecosystem:"cargo",manifest:m,manifestPath:g.manifestPath,name:g.name,private:g.private,version:g.version}})},es=Object.defineProperty({__proto__:null,discoverCargoCrates:Ye,findInheritedWorkspaceVersion:ye,inheritsFromWorkspace:U,parseCargoDoc:G},Symbol.toStringTag,{value:"Module"}),ze="https://crates.io/api/v1/crates",Je="Cargo.toml",ee=async a=>{let e;try{e=await S(a,"utf8")}catch(o){throw new l({cause:o,code:"CONFIG_INVALID",file:a,message:`Failed to read Cargo.toml at ${a}: ${o.message}`})}const{parse:r}=await import("./index4.js");let s;try{s=r(e)}catch(o){throw new l({cause:o,code:"CONFIG_INVALID",file:a,message:`Failed to parse Cargo.toml at ${a}: ${o.message}`})}if(!s.package)throw new l({code:"CONFIG_INVALID",file:a,hint:"CargoVersionActions only supports publishable crates with a [package] table. For workspace roots, point per-package config at the member crate directory.",message:`Cargo.toml at ${a} has no [package] table.`});const{name:n}=s.package;if(typeof n!="string"||n.length===0)throw new l({code:"CONFIG_INVALID",file:a,message:`Cargo.toml at ${a} is missing [package].name.`});const i=s.package.version;let t;if(typeof i=="string"?t=i:i&&typeof i=="object"&&i.workspace===!0&&(t=await ye(a)??s.workspace?.package?.version),typeof t!="string"||t.length===0)throw new l({code:"CONFIG_INVALID",file:a,hint:"Set [package].version explicitly, or — for workspace-inherited versions — ensure the root Cargo.toml carries [workspace.package].version and point per-package config at it.",message:`Cargo.toml at ${a} has no resolvable [package].version.`});return{name:n,version:t}},re=async(a,e)=>{const r=`${ze}/${encodeURIComponent(a)}`;try{const s=await I(r,{headers:{Accept:"application/json"},httpProxy:e});if(s.status===404||!s.ok)return;const n=await s.json();return n?.crate?.max_stable_version??n?.crate?.max_version??void 0}catch{return}},Ze=(a,e)=>Me({env:a,staticTokenVar:"CARGO_REGISTRY_TOKEN",workspaceConfig:e})==="oidc",Qe=async(a,e)=>{const r=await a.run("cargo",["package","--list","--allow-dirty"],{cwd:e,silent:!0});return r.exitCode!==0?[]:r.stdout.split(/\r?\n/).map(s=>s.trim()).filter(s=>s.length>0)};class xe extends v{id="cargo";async readPublishedVersion(e){const r=X(e.pkg);try{const{name:s}=await ee(r);return await re(s)}catch{return}}async publish(e){if(e.dryRun)return{output:`[dry-run / cargo] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const r=X(e.pkg,e.perPackageConfig),s=er(e.pkg,e.perPackageConfig),{name:n,version:i}=await ee(r);if(i!==e.release.newVersion)throw new l({code:"CONFIG_INVALID",file:r,hint:`Confirm the cargo() preset's crateDir points at the directory containing this Cargo.toml. Expected ${e.release.newVersion} on disk after the extra-files bump.`,message:`Cargo.toml version (${i}) does not match planned release version (${e.release.newVersion}) for ${e.pkg.name}.`,packageName:e.pkg.name});if(await re(n,e.workspaceConfig?.httpProxy)===e.release.newVersion)return{alreadyPublished:!0,output:`[cargo] ${n}@${e.release.newVersion} already on crates.io`,published:!1};const o=Ze(process.env,e.workspaceConfig);if(!o&&!process.env.CARGO_REGISTRY_TOKEN)throw new l({code:"AUTH_MISSING",hint:"Set CARGO_REGISTRY_TOKEN, or run from a GH-Actions job with `permissions: id-token: write` for OIDC trusted publishing.",message:`Cannot publish ${n}@${e.release.newVersion}: neither CARGO_REGISTRY_TOKEN nor OIDC trusted publishing is available.`,packageName:e.pkg.name});const p=e.workspaceConfig?.publish?.guards;if(p?.packSecretScan){const g=await Qe(e.pm.runner,s);if(g.length>0){const{runPackSecretScan:d}=await import("./publish-guards.js"),m=typeof p.packSecretScan=="object"?p.packSecretScan.ignore:void 0,c=await d({files:g,ignore:m,pkgDir:s});if(!c.passed){const{redactTokens:f}=await import("./security.js"),$=c.findings.map(h=>` • [packSecretScan] ${f(h.message)}${h.hint?`
2
+ → ${f(h.hint)}`:""}`).join(`
3
+ `);throw new l({code:"PUBLISH_FAILED",message:`Pre-publish secret scan failed for ${n}@${e.release.newVersion}:
4
+ ${$}`,packageName:e.pkg.name})}}}const u=["publish","--allow-dirty"];e.registry&&e.registry!=="https://crates.io"&&u.push("--registry",e.registry);const w=await e.pm.runner.run("cargo",u,{cwd:s,silent:!1});if(w.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:"Inspect the cargo output above. Common causes: missing CARGO_REGISTRY_TOKEN, OIDC permission misconfigured, version already published, crates.io rate limit. Re-runs are safe — the published-version probe short-circuits subsequent runs.",message:`cargo publish failed for ${n}@${e.release.newVersion}: exit ${w.exitCode}. stderr: ${w.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[cargo] published ${n}@${e.release.newVersion}${o?" (trusted publishing)":""}`,published:!0}}}const X=(a,e)=>{const r=e?.cargoTomlPath??Je;return b(a.dir,r)},er=(a,e)=>E(X(a,e)),rr=(a,e,r)=>T(a?.releaseTagPattern??"v{version}",{name:e,version:r});class sr extends v{id="composer";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=rr(e.perPackageConfig,r,s);if(e.dryRun)return{output:`[dry-run / composer] would tag ${n} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${r} cannot be released from Windows yet: the Composer tag path is not tested there. Release from a POSIX runner.`,packageName:r});if((await e.pm.runner.run("git",["--version"],{cwd:e.pkg.dir,silent:!0})).exitCode!==0)throw new l({code:"CONFIG_INVALID",message:`${r} needs git on PATH to release its tag, and git --version failed.`,packageName:r});return await Y({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[composer] ${r}@${s} is already tagged ${n}; skipped`,published:!1}:{output:`[composer] ${r}@${s} released by tag ${n}`,published:!0}}}const ar=["linux/amd64","linux/arm64"],nr=a=>{const e=a.indexOf("/");if(e===-1)return{registry:"docker.io",repository:`library/${a}`};const r=a.slice(0,e),s=a.slice(e+1);return r==="localhost"||r.includes(".")||r.includes(":")?{registry:r,repository:s}:s.includes("/")?{registry:"docker.io",repository:a}:{registry:"docker.io",repository:`${r}/${s}`}},se=(a,e)=>{const{registry:r,repository:s}=nr(a);return`https://${r==="docker.io"?"registry-1.docker.io":r}/v2/${s}/manifests/${encodeURIComponent(e)}`},Ie=a=>{const e=a??{};return{buildContext:e.buildContext,containerBuildArgs:e.containerBuildArgs,containerImage:e.containerImage,containerPlatforms:e.containerPlatforms,containerSigning:e.containerSigning,containerSkipLatest:e.containerSkipLatest}},ir=(a,e)=>{const r=Ie(a);if(typeof r.containerImage!="string"||r.containerImage.length===0)throw new l({code:"CONFIG_INVALID",hint:["Container packages must declare `containerImage` in their per-pkg release config:","",' release.packages["<pkg>"] = container({',' image: "ghcr.io/scope/foo",',' platforms: ["linux/amd64", "linux/arm64"],',' signing: "cosign", // optional'," })","",'Or set `versionActions: "container"` + `containerImage` directly.'].join(`
5
+ `),message:`containerImage is required for versionActions: "container" on ${e}`,packageName:e});return{buildContext:r.buildContext,containerBuildArgs:r.containerBuildArgs,containerImage:r.containerImage,containerPlatforms:r.containerPlatforms,containerSigning:r.containerSigning,containerSkipLatest:r.containerSkipLatest}};class tr extends v{id="container";async readPublishedVersion(e){const r=Ie(e.perPackageConfig);if(!r.containerImage)return;const s=e.pkg.version,n=se(r.containerImage,s);try{return(await I(n,{headers:{Accept:["application/vnd.oci.image.manifest.v1+json","application/vnd.oci.image.index.v1+json","application/vnd.docker.distribution.manifest.v2+json","application/vnd.docker.distribution.manifest.list.v2+json"].join(",")},httpProxy:e.workspaceConfig?.httpProxy,method:"HEAD"})).status===200?s:void 0}catch{return}}async publish(e){const r=ir(e.perPackageConfig,e.pkg.name);if(e.dryRun){const{command:i}=ae(e,r);return{output:`[dry-run / container] would run: ${i.join(" ")}`,published:!0}}try{const i=se(r.containerImage,e.release.newVersion);if((await I(i,{httpProxy:e.workspaceConfig?.httpProxy,method:"HEAD"})).status===200)return{alreadyPublished:!0,output:`[container] ${r.containerImage}:${e.release.newVersion} already published`,published:!1}}catch{}const{command:s}=ae(e,r),n=await e.pm.runner.run(s[0],s.slice(1),{cwd:e.pkg.dir,silent:!1});if(n.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:["docker buildx build failed. Common causes:"," • Not authenticated to the registry — run `docker login <registry>` first."," For ECR: `aws ecr get-login-password --region <r> | docker login --username AWS --password-stdin <account>.dkr.ecr.<r>.amazonaws.com`"," For GCR/GAR: `gcloud auth configure-docker <region>-docker.pkg.dev`"," For GHCR: `echo $GITHUB_TOKEN | docker login ghcr.io -u <user> --password-stdin`"," • Buildx not installed / configured — `docker buildx create --use` (one-time setup)."," • Multi-arch build needs QEMU registered — `docker run --privileged --rm tonistiigi/binfmt --install all`."].join(`
6
+ `),message:`docker buildx failed for ${e.pkg.name}@${e.release.newVersion}: exit ${n.exitCode}. stderr: ${n.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});if(r.containerSigning==="cosign"){const i=`${r.containerImage}:${e.release.newVersion}`,t=await e.pm.runner.run("cosign",["sign","--yes",i],{cwd:e.pkg.dir,silent:!1});if(t.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:"cosign signing failed. For keyless cosign, ensure COSIGN_EXPERIMENTAL=1 (cosign <2.0) and the CI runner has the OIDC token (`id-token: write` permission on GH Actions).",message:`cosign sign failed for ${i}: exit ${t.exitCode}. stderr: ${t.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}return{output:`[container] published ${r.containerImage}:${e.release.newVersion}${r.containerSkipLatest?"":" + :latest"}${r.containerSigning==="cosign"?" (signed via cosign)":""}`,published:!0}}}const ae=(a,e)=>{if(!e.containerImage)throw new Error("buildBuildxCommand requires config.containerImage");const r=(e.containerPlatforms??ar).join(","),s=`${e.containerImage}:${a.release.newVersion}`,n=`${e.containerImage}:latest`,i=e.buildContext??".",t=["docker","buildx","build","--platform",r,"-t",s];e.containerSkipLatest||t.push("-t",n);for(const[o,p]of Object.entries(e.containerBuildArgs??{}))t.push("--build-arg",`${o}=${p}`);return t.push("--label",`org.opencontainers.image.version=${a.release.newVersion}`),t.push("--label",`org.opencontainers.image.title=${a.pkg.name}`),t.push("--push",i),{command:t}},or=a=>`https://pub.dev/api/packages/${encodeURIComponent(a)}`,dr=async a=>{try{const e=await I(or(a.pkg.name),{headers:{Accept:"application/vnd.pub.v2+json"},httpProxy:a.workspaceConfig?.httpProxy});if(!e.ok)return!1;const r=JSON.parse(await e.text());return Array.isArray(r.versions)&&r.versions.some(s=>s.version===a.release.newVersion)}catch{return!1}};class lr extends v{id="dart";async readPublishedVersion(e){}async publish(e){const{dir:r,name:s}=e.pkg,n=e.release.newVersion;if(e.dryRun)return{output:`[dry-run / dart] would run dart pub publish --force in ${r} for ${s}@${n}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${s} cannot be published from Windows yet: the Dart path is only verified on POSIX. Publish from a POSIX runner.`,packageName:s});try{const t=await e.pm.runner.run("dart",["--version"],{cwd:r,silent:!0});if(t.exitCode!==0)throw new Error(`exit ${t.exitCode}`)}catch{throw new l({code:"CONFIG_INVALID",message:`${s} needs the Dart SDK to publish, and "dart" is not on PATH. Install the Dart SDK on the runner.`,packageName:s})}if(await dr(e))return{alreadyPublished:!0,output:`[dart] ${s}@${n} is already on pub.dev; skipped`,published:!1};const i=await e.pm.runner.run("dart",["pub","publish","--force"],{cwd:r,silent:!1});if(i.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing command: dart pub publish --force in ${r}
7
+ Check the output above. Authenticate with "dart pub token add https://pub.dev" on this runner, or configure automated publishing (OIDC) for the pub.dev package. Errors stop the upload; warnings do not.`,message:`dart pub publish failed for ${s}@${n}: exit ${i.exitCode}. stderr: ${i.stderr.trim().slice(0,500)}`,packageName:s});return{output:`[dart] published ${s}@${n} to pub.dev`,published:!0}}}const pr="https://rubygems.org",ur=async(a,e,r)=>{const s=`${pr}/api/v1/versions/${encodeURIComponent(a)}.json`;try{const n=await I(s,{headers:{Accept:"application/json"},httpProxy:r.workspaceConfig?.httpProxy});if(!n.ok)return!1;const i=await n.json();return Array.isArray(i)&&i.some(t=>typeof t=="object"&&t!==null&&t.number===e)}catch{return!1}},cr=async(a,e)=>{try{return(await a.pm.runner.run("gem",["--version"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}};class gr extends v{id="gem";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=V(e.pkg.manifestPath),i=`${r}-${s}.gem`,t=e.pkg.dir;if(e.dryRun)return{output:`[dry-run / gem] would run gem build ${n} and gem push ${i} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${r} cannot be published from Windows yet: the gem path is only verified on POSIX. Publish from a POSIX runner.`,packageName:r});if(!await cr(e,t))throw new l({code:"CONFIG_INVALID",message:`${r} needs the gem command on PATH to publish, and "gem --version" failed. Install Ruby (which ships RubyGems) on the runner.`,packageName:r});if(await ur(r,s,e))return{alreadyPublished:!0,output:`[gem] ${r}@${s} is already on RubyGems; skipped`,published:!1};const o=await e.pm.runner.run("gem",["build",n],{cwd:t,silent:!1});if(o.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing step: gem build ${n} in ${t}
8
+ Fix the gemspec validation error above.`,message:`gem build failed for ${r}@${s}: exit ${o.exitCode}. stderr: ${o.stderr.trim().slice(0,500)}`,packageName:r});try{const p=await e.pm.runner.run("gem",["push",i],{cwd:t,silent:!1});if(p.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing step: gem push ${i}
9
+ Check the output above. Credentials come from GEM_HOST_API_KEY in the environment; a gem push to an existing version is refused by RubyGems.`,message:`gem push failed for ${r}@${s}: exit ${p.exitCode}. stderr: ${p.stderr.trim().slice(0,500)}`,packageName:r})}finally{await fe(b(t,i),{force:!0})}return{output:`[gem] published ${r}@${s} (${i})`,published:!0}}}const mr=(a,e,r)=>T(a?.releaseTagPattern??"v{version}",{name:e,version:r});class hr extends v{id="go";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=mr(e.perPackageConfig,r,s);if(e.dryRun)return{output:`[dry-run / go] would tag ${n} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${r} cannot be released from Windows yet: the Go tag path is not tested there. Release from a POSIX runner.`,packageName:r});if((await e.pm.runner.run("git",["--version"],{cwd:e.pkg.dir,silent:!0})).exitCode!==0)throw new l({code:"CONFIG_INVALID",message:`${r} needs git on PATH to release its tag, and git --version failed.`,packageName:r});return await Y({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[go] ${r}@${s} is already tagged ${n}; skipped`,published:!1}:{output:`[go] ${r}@${s} released by tag ${n}`,published:!0}}}const ne=["build.gradle.kts","build.gradle"],Ce=["settings.gradle.kts","settings.gradle"],C=(a,e)=>new l({code:"CONFIG_INVALID",file:a,message:e}),fr=async(a,e)=>{for(const r of new Set([b(a,"gradle.properties"),b(e,"gradle.properties")])){let s;try{s=await S(r,"utf8")}catch{continue}if(/^\s*version\s*[=:]/m.test(s))return r}},wr=a=>we(a).then(()=>!0,()=>!1),M=async(a,e)=>{for(const r of e){const s=b(a,r);try{return{path:s,raw:await S(s,"utf8")}}catch{}}},F=(a,e,r)=>{if(a.length===0)return;if(a.length>1)throw C(e,`${e} declares ${r} ${a.length} times on the path that reaches a module (lines ${a.map(n=>n.line).join(", ")}). vis cannot tell which one applies.`);const[s]=a;if(s.literal===void 0)throw C(e,`${e} sets ${r} to an expression on line ${s.line}. vis reads only a plain string literal, such as ${r} = "1.0.0".`);return{assignment:s,value:s.literal.value}},br=async a=>{const{claimedDirs:e,cwd:r}=a,s=await M(r,ne),n=await M(r,Ce);if(!s&&!n)return[];const i=n?Ue(n.raw):void 0;if(i?.unsupported.length)throw C(n.path,`${n.path} moves a project (${i.unsupported.join(", ")}). vis cannot follow that to a version; remove it or release the module with a shell publish.`);i?.dynamicIncludes&&process.stderr.write(`[vis release] ⚠ ${n.path} builds part of its include list from code; vis only reads literal include("…") entries.
10
+ `);const t=s?J(s.raw):void 0,o=t?.assignments??[],p=[];s&&p.push({build:s,dir:r,isRoot:!0,path:"",taskPath:""});for(const d of i?.includes??[]){const m=b(r,d),c=await M(m,ne);c&&p.push({build:c,dir:m,isRoot:!1,path:d,taskPath:`:${d.replaceAll("/",":")}`})}const u=[];for(const d of p){if(e.has(d.dir))continue;const m=d.isRoot&&t?t:J(d.build.raw),c=F(Z(m.assignments,"version"),d.build.path,"version");if(d.isRoot&&c===void 0)continue;const f=c?void 0:F(Q(o,"version",d.isRoot),s?.path??d.build.path,"version"),$=c??f;if(!$){const y=await fr(d.dir,r);if(y!==void 0)throw C(y,`${y} sets version, and vis reads only a string literal in a build script. Move it to version = "…" in ${d.build.path}, or remove it.`);continue}const h=F(Z(m.assignments,"group"),d.build.path,"group")??F(Q(o,"group",d.isRoot),s?.path??d.build.path,"group");if(h===void 0)throw C(d.build.path,`${d.build.path} has a version but no group. Declare group = "…" in its build script or in the root build script's allprojects block.`);if(m.usesArchiveName||t?.usesArchiveName)throw C(d.build.path,`${d.build.path} renames its archive (archivesName). vis cannot read the artifact name from that; remove it or release the module with a shell publish.`);const P=d.isRoot?i?.rootName??V(r):V(d.dir);u.push({kind:c?"literal":"inherited",line:$.assignment.line,module:d,name:`${h.value}:${P}`,owner:c?d.build.path:s.path,scan:m,version:$.value})}const w=new Map;for(const d of u){const m=w.get(d.name);if(m!==void 0)throw C(d.module.build.path,`${d.name} is declared by both ${m} and ${d.module.build.path}. Gradle coordinates must be unique to release them.`);w.set(d.name,d.module.build.path)}const g=new Map(u.map(d=>[d.module.path,d.name]));return u.map(({kind:d,line:m,module:c,name:f,owner:$,scan:h,version:P})=>{const y={};for(const A of h.projectRefs){const N=g.get(A.replace(/^:+/,"").split(":").filter(O=>O!=="").join("/"));N!==void 0&&N!==f&&(y[N]="*")}const k={dependencies:y,name:f,private:!1,version:P};return{kind:d,line:m,name:f,owner:$,package:{dir:c.dir,ecosystem:"gradle",manifest:k,manifestPath:c.build.path,name:f,private:!1,version:P},taskPath:c.taskPath}})},Pe=async a=>{let e=a;for(;;){if(await wr(b(e,"gradlew"))||await M(e,Ce)!==void 0)return e;const r=E(e);if(r===e)return;e=r}},rs=Object.defineProperty({__proto__:null,discoverGradleProjects:br,findGradleRoot:Pe},Symbol.toStringTag,{value:"Module"}),kr=/<!--[\s\S]*?-->/g,vr=/<project\b[^>]*>([\s\S]*)/i,ie=/<version>\s*([^<]+?)\s*<\/version>/i,te=/<groupId>\s*([^<]+?)\s*<\/groupId>/i,oe=/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i,$r=/<modules\b[^>]*>[\s\S]*?<module\b/i,de=a=>{const e=a.replaceAll(kr,""),s=vr.exec(e)?.[1]??e,n=s.replaceAll(/<parent\b[\s\S]*?<\/parent>/gi,"").replaceAll(/<dependencyManagement\b[\s\S]*?<\/dependencyManagement>/gi,"").replaceAll(/<dependencies\b[\s\S]*?<\/dependencies>/gi,"").replaceAll(/<build\b[\s\S]*?<\/build>/gi,"").replaceAll(/<profiles\b[\s\S]*?<\/profiles>/gi,"").replaceAll(/<pluginRepositories\b[\s\S]*?<\/pluginRepositories>/gi,"").replaceAll(/<repositories\b[\s\S]*?<\/repositories>/gi,""),i=ie.exec(n)??ie.exec(s),t=te.exec(n)??te.exec(s),o=oe.exec(n)??oe.exec(s),p=$r.test(s);return{artifactId:o?.[1],groupId:t?.[1],hasModules:p,version:i?.[1]}},yr=a=>{const e=/<latest>\s*([^<]+?)\s*<\/latest>/i.exec(a);if(e?.[1])return e[1];const r=/<versions>([\s\S]*?)<\/versions>/i.exec(a);return r?[...r[1].matchAll(/<version>\s*([^<]+?)\s*<\/version>/gi)].map(n=>n[1]).at(-1):void 0},Ir=a=>{const e=/<versions>([\s\S]*?)<\/versions>/i.exec(a);return e?[...e[1].matchAll(/<version>\s*([^<]+?)\s*<\/version>/gi)].map(r=>r[1]):[]},Ae=(a,e)=>{const r=a.split(".").map(n=>encodeURIComponent(n)).join("/"),s=encodeURIComponent(e);return`https://repo1.maven.org/maven2/${r}/${s}/maven-metadata.xml`};class Cr extends v{id="maven";warnedMultiModule=new WeakSet;warnIfMultiModule(e,r){!r.hasModules||this.warnedMultiModule.has(e)||(this.warnedMultiModule.add(e),process.stderr.write(`[vis release] ⚠ ${e.name} (${r.groupId??"?"}:${r.artifactId??"?"}) is a multi-module Maven project (<modules> present). vis treats it as a single artifact for version-read + already-published checks. For proper reactor handling, use \`versionActions: "shell"\` with \`mvn -B -ntp deploy\`.
11
+ `))}async readPublishedVersion(e){const r=e.perPackageConfig??{},s=b(e.pkg.dir,r.pomPath??"pom.xml");let n;try{n=await S(s,"utf8")}catch{return}const i=de(n);if(this.warnIfMultiModule(e.pkg,i),!i.groupId||!i.artifactId||r.mavenMetadataUrl==="")return;const t=r.mavenMetadataUrl??Ae(i.groupId,i.artifactId);try{const o=await I(t,{headers:{Accept:"text/xml,application/xml;q=0.9,*/*;q=0.8"},httpProxy:e.workspaceConfig?.httpProxy});if(o.status===404||!o.ok)return;const p=await o.text();return yr(p)}catch{return}}async publish(e){const r=e.perPackageConfig??{},s=b(e.pkg.dir,r.pomPath??"pom.xml");let n;try{const o=await S(s,"utf8");n=de(o)}catch{n=void 0}const i=n?.groupId&&n?.artifactId?`${n.groupId}:${n.artifactId}`:e.pkg.name;if(e.dryRun)return{output:`[dry-run / maven] would run mvn -B -N -f ${s} deploy for ${e.pkg.name}@${e.release.newVersion} (${i})`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${e.pkg.name} cannot be published from Windows yet: Maven publish is POSIX-only for now. Publish from a POSIX runner.`,packageName:e.pkg.name});const t=await e.pm.runner.run("mvn",["-B","-N","-f",s,"deploy"],{cwd:e.pkg.dir,silent:!1});if(t.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing artifact: ${i}
12
12
  Pom: ${s}
13
- Check the mvn output above. Credentials come from ~/.m2/settings.xml, and the pom needs a deploy target (distributionManagement or central-publishing-maven-plugin). See docs/guides/release-maven.mdx.`,message:`mvn deploy failed for ${e.pkg.name}@${e.release.newVersion} (${i}): exit ${t.exitCode}. stderr: ${t.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[maven] deployed ${e.pkg.name}@${e.release.newVersion} (${i})`,published:!0}}}const Dr=a=>{const e=a.indexOf(":");return e===-1?void 0:{artifactId:a.slice(e+1),groupId:a.slice(0,e)}},Rr=async a=>{const e=a.perPackageConfig??{},r=Dr(a.pkg.name);if(e.mavenMetadataUrl===""||r===void 0)return!1;const s=e.mavenMetadataUrl??Le(r.groupId,r.artifactId);try{const n=await V(s,{headers:{Accept:"text/xml,application/xml;q=0.9,*/*;q=0.8"},httpProxy:a.workspaceConfig?.httpProxy});return n.ok&&Vr(await n.text()).includes(a.release.newVersion)}catch{return!1}};class Fr extends C{id="gradle";async readPublishedVersion(e){}async publish(e){const r=await Me(e.pkg.dir);if(r===void 0)throw new d({code:"CONFIG_INVALID",file:e.pkg.manifestPath,message:`${e.pkg.name} has no Gradle build root (no gradlew or settings.gradle above ${e.pkg.dir}).`,packageName:e.pkg.name});const s=e.pkg.dir===r?"":e.pkg.dir.slice(r.length+1).split("\\").join("/"),n=s===""?":publish":`:${s.replaceAll("/",":")}:publish`;if(e.dryRun)return{output:`[dry-run / gradle] would run ${w(r,"gradlew")} ${n} for ${e.pkg.name}@${e.release.newVersion}`,published:!0};if(process.platform==="win32")throw new d({code:"CONFIG_INVALID",message:`${e.pkg.name} cannot be published from Windows yet: vis runs ./gradlew without a shell, and gradlew.bat needs one. Publish from a POSIX runner.`,packageName:e.pkg.name});const i=w(r,"gradlew");try{await Ne(i)}catch{throw new d({code:"CONFIG_INVALID",message:`${e.pkg.name} needs ${i} to publish, and the build root has none. Add the Gradle wrapper (gradle wrapper) at the root.`,packageName:e.pkg.name})}if(await Rr(e))return{alreadyPublished:!0,output:`[gradle] ${e.pkg.name}@${e.release.newVersion} is already on the repository; skipped`,published:!1};const t=await e.pm.runner.run(i,[n],{cwd:r,silent:!1});if(t.exitCode!==0)throw new d({code:"PUBLISH_FAILED",hint:`Failing task: ${n} in ${r}
14
- Check the Gradle output above. The module needs a publishing plugin and repository (for example maven-publish). Credentials come from your Gradle properties or environment.`,message:`gradle ${n} failed for ${e.pkg.name}@${e.release.newVersion}: exit ${t.exitCode}. stderr: ${t.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[gradle] published ${e.pkg.name}@${e.release.newVersion} (${n})`,published:!0}}}const Mr="https://hex.pm",Lr=async(a,e,r)=>{const s=`${Mr}/api/packages/${encodeURIComponent(a)}`;try{const n=await V(s,{headers:{Accept:"application/json"},httpProxy:r.workspaceConfig?.httpProxy});if(!n.ok)return!1;const i=await n.json(),t=typeof i=="object"&&i!==null?i.releases:void 0;return Array.isArray(t)&&t.some(o=>typeof o=="object"&&o!==null&&o.version===e)}catch{return!1}},Er=async(a,e)=>{try{return(await a.pm.runner.run("mix",["help"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}};class Tr extends C{id="hex";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=e.pkg.dir;if(e.dryRun)return{output:`[dry-run / hex] would run mix hex.publish --yes in ${R(n)} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new d({code:"CONFIG_INVALID",message:`${r} cannot be published from Windows yet: the mix path is only verified on POSIX. Publish from a POSIX runner.`,packageName:r});if(!await Er(e,n))throw new d({code:"CONFIG_INVALID",message:`${r} needs the mix command on PATH to publish, and "mix help" failed. Install Elixir (which ships Mix) on the runner.`,packageName:r});if(await Lr(r,s,e))return{alreadyPublished:!0,output:`[hex] ${r}@${s} is already on hex.pm; skipped`,published:!1};const i=await e.pm.runner.run("mix",["hex.publish","--yes"],{cwd:n,silent:!1});if(i.exitCode!==0)throw new d({code:"PUBLISH_FAILED",hint:`Failing step: mix hex.publish --yes in ${n}
15
- Check the output above. Credentials come from HEX_API_KEY in the environment; Hex refuses to replace an existing version.`,message:`mix hex.publish failed for ${r}@${s}: exit ${i.exitCode}. stderr: ${i.stderr.trim().slice(0,500)}`,packageName:r});return{output:`[hex] published ${r}@${s}`,published:!0}}}const Ee="https://registry.npmjs.org/",Gr="npm:registry.npmjs.org",we=async a=>{const e=w(a,"npm");try{return(await re(e,{withFileTypes:!0})).filter(s=>s.isDirectory()).map(s=>s.name)}catch{return[]}},jr=async a=>{const e=a.ACTIONS_ID_TOKEN_REQUEST_URL,r=a.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!e||!r)return;const s=`${e}${e.includes("?")?"&":"?"}audience=${encodeURIComponent(Gr)}`,n=await fetch(s,{headers:{Authorization:`Bearer ${r}`}});if(!n.ok)return;const i=await n.json().catch(()=>({}));return typeof i.value=="string"?i.value:void 0},Ur=async(a,e)=>{const r=await fetch(`${Ee}-/npm/v1/oidc/token/exchange/package/${encodeURIComponent(a)}`,{headers:{Authorization:`Bearer ${e}`},method:"POST"});if(!r.ok)return;const s=await r.json().catch(()=>({}));return typeof s.token=="string"?s.token:void 0},be=async(a,e,r)=>{if(e){const n=await Ur(a,e);if(n)return{source:"oidc",token:n}}const s=r.NPM_TOKEN;if(s)return{source:"NPM_TOKEN",token:s};throw new d({code:"AUTH_MISSING",message:`Cannot publish ${a}: OIDC exchange did not succeed and NPM_TOKEN is not set.`,packageName:a})},ke=(a,e)=>{Je(a,`//registry.npmjs.org/:_authToken=${e}
16
- registry=${Ee}
17
- `)};class Br extends C{id="native-addon";async readPublishedVersion(e){try{Y(e.pkg.name);const{execFileSync:r}=await import("node:child_process");return r("npm",["view",e.pkg.name,"version"],{stdio:["ignore","pipe","ignore"]}).toString().trim()||void 0}catch{return}}async publish(e){if(e.dryRun){const l=await we(e.pkg.dir);return{output:`[dry-run] would publish ${e.pkg.name}@${e.release.newVersion} + ${l.length} platform package(s)`,published:!0}}const r=await we(e.pkg.dir);if(r.length===0){const{NpmVersionActions:l}=await Promise.resolve().then(()=>Wr);return new l().publish(e)}const{env:s}=process,n=await jr(s),i=e.release.newVersion,t=new Map,o=[];try{await Promise.all(r.map(async f=>{const m=w(e.pkg.dir,"npm",f,"package.json"),y=await _(m,"utf8");t.set(m,y);const I=JSON.parse(y);I.version=i,await E(m,`${JSON.stringify(I,null,4)}
18
- `)}));const{execFileSync:l}=await import("node:child_process"),u=await Promise.all(r.map(async f=>{const m=w(e.pkg.dir,"npm",f),y=w(m,"package.json"),I=await _(y,"utf8"),$=JSON.parse(I);Y($.name);const S=await be($.name,n,s),N=z(w(B(),"vis-release-napi-"));o.push(N);const A=w(N,".npmrc");return ke(A,S.token),{manifest:$,npmrcPath:A,platform:f,platformDir:m}})),k=e.workspaceConfig?.publish?.guards;if(k&&Object.values(k).some(f=>f!==void 0&&f!==!1&&f!=="off")){const{runPublishGuards:f}=await import("./publish-guards.js");for(const{manifest:m,platformDir:y}of u){const I=l("npm",["pack","--dry-run","--json"],{cwd:y,stdio:["ignore","pipe","ignore"]}).toString();let $=[];try{$=JSON.parse(I)[0]?.files?.map(A=>A.path)??[]}catch{}const S=await f({config:k,manifest:m,packFiles:$,pkgDir:y,runner:e.pm.runner,sourceManifest:m});if(S.blockers.length>0){const N=S.blockers.flatMap(A=>A.findings.map(X=>` • [${A.gate}] ${X.message}${X.hint?`
19
- → ${X.hint}`:""}`)).join(`
20
- `);throw new d({code:"PUBLISH_FAILED",message:`Pre-publish guards failed for ${m.name}@${i} (platform package):
21
- ${N}`,packageName:m.name})}}}const g=e.tag??"latest",p=(f,m)=>{const y=["publish",f,"--tag",g,"--access","public","--userconfig",m];return e.provenance&&y.push("--provenance"),y};for(const{manifest:f,npmrcPath:m,platformDir:y}of u)try{l("npm",p(y,m),{env:{...s,NPM_CONFIG_USERCONFIG:m},stdio:"inherit"})}catch(I){const $=I.message;if(!$.includes("EPUBLISHCONFLICT")&&!$.includes("cannot publish over"))throw new d({cause:I,code:"PUBLISH_FAILED",message:`Failed to publish platform package ${f.name}@${i}: ${$}`,packageName:f.name})}const h=e.versionedManifestByName.get(e.pkg.name)??e.pkg.manifest,c={...h},b={...h.optionalDependencies};for(const{manifest:f}of u)Object.hasOwn(b,f.name)&&(b[f.name]=i);c.optionalDependencies=b;const P=Ve(c,e.catalogs),v=Oe(P,e.cleanPackageJsonConfig),O=await _(e.pkg.manifestPath,"utf8");try{await E(e.pkg.manifestPath,`${JSON.stringify(v,null,4)}
22
- `),Y(e.pkg.name);const f=await be(e.pkg.name,n,s),m=z(w(B(),"vis-release-napi-parent-"));o.push(m);const y=w(m,".npmrc");ke(y,f.token);const I=l("npm",["pack","--pack-destination",m,"--json"],{cwd:e.pkg.dir,env:s,stdio:["ignore","pipe","ignore"]}).toString();let $;try{const N=JSON.parse(I);N[0]?.filename&&($=w(m,N[0].filename))}catch{}const S=["publish",$??e.pkg.dir,"--tag",g,"--access","public","--userconfig",y];if(e.provenance&&S.push("--provenance"),l("npm",S,{env:{...s,NPM_CONFIG_USERCONFIG:y},stdio:"inherit"}),$){const{hashTarball:N}=await import("./publish-guards.js");return{published:!0,tarball:await N($)}}return{published:!0}}finally{await E(e.pkg.manifestPath,O)}}finally{for(const[l,u]of t)try{await E(l,u)}catch{}for(const l of o)try{await se(l,{force:!0,recursive:!0})}catch{}}}}const Hr=async(a,e)=>{const{extractPackFilesFromRaw:r}=await import("./publish-guards.js"),s=r(e.raw);if(s!==void 0)return s;const n=await a.pm.runner.run("npm",["pack","--dry-run","--json"],{cwd:a.pkg.dir,silent:!0});if(n.exitCode!==0)return[];try{return r(JSON.parse(n.stdout))??[]}catch{return[]}},ve=1800*1e3,ye=15*1e3,$e=a=>{if(a===!0)return{enabled:!0,pollIntervalMs:ye,timeoutMs:ve};if(a&&typeof a=="object"){const e=a;return{enabled:!0,pollIntervalMs:e.pollIntervalMs??ye,timeoutMs:e.timeoutMs??ve}}return{enabled:!1,pollIntervalMs:0,timeoutMs:0}};class Te extends C{id="npm";async readPublishedVersion(e){try{const r=await e.pm.runner.run("npm",["view",e.pkg.name,"version","--silent"],{cwd:e.pkg.dir,silent:!0});return r.exitCode!==0?void 0:r.stdout.trim()||void 0}catch{return}}async publish(e){if(e.dryRun)return{output:`[dry-run] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};if(e.resumeStageId){const u=$e(e.workspaceConfig?.publish?.stage);if(!u.enabled)throw new d({code:"CONFIG_INVALID",message:`Cannot resume stage ${e.resumeStageId} for ${e.pkg.name}@${e.release.newVersion}: publish.stage is now disabled. Resolve the stage manually via \`vis release stage approve|reject ${e.resumeStageId}\`.`,packageName:e.pkg.name});return this.resumeStagedPublish(e,u)}const r=e.perPackageConfig&&e.workspaceConfig?Q(e.pkg.name,e.perPackageConfig,e.workspaceConfig):{};if(r.buildCommand){const u=Z(r.buildCommand,{name:e.pkg.name,version:e.release.newVersion}),k=await e.pm.runner.run(process.platform==="win32"?"cmd":"sh",process.platform==="win32"?["/c",u]:["-c",u],{cwd:e.pkg.dir,silent:!1});if(k.exitCode!==0)throw new Error(`buildCommand failed for ${e.pkg.name}: exit ${k.exitCode}`)}const s=e.versionedManifestByName.get(e.pkg.name)??e.pkg.manifest,n=Ge(s,e.versionedManifestByName,e.workspaceConfig?.internalDependencyRanges),i=Ve(n,e.catalogs),t=Oe(i,e.cleanPackageJsonConfig),o=await import("node:fs/promises"),l=await o.readFile(e.pkg.manifestPath,"utf8");try{if(await o.writeFile(e.pkg.manifestPath,`${JSON.stringify(t,null,4)}
23
- `),r.publishCommand){const k={name:e.pkg.name,version:e.release.newVersion},g=Array.isArray(r.publishCommand)?r.publishCommand:[r.publishCommand];for(const p of g){const h=Z(p,k),c=await e.pm.runner.run(process.platform==="win32"?"cmd":"sh",process.platform==="win32"?["/c",h]:["-c",h],{cwd:e.pkg.dir,silent:!1});if(c.exitCode!==0)throw new Error(`publishCommand failed for ${e.pkg.name}: exit ${c.exitCode}`)}return{output:`[custom] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}}const u=z(w(B(),"vis-release-pack-"));try{const k=await e.pm.pack({cwd:e.pkg.dir,destination:u}),g=e.workspaceConfig?.publish?.guards;if(g&&Object.values(g).some(m=>m!==void 0&&m!==!1&&m!=="off")){const{runPublishGuards:m}=await import("./publish-guards.js"),y=await Hr(e,k),I=await m({config:g,manifest:t,packFiles:y,pkgDir:e.pkg.dir,runner:e.pm.runner,sourceManifest:e.pkg.manifest});if(I.blockers.length>0){const{redactTokens:$}=await import("./security.js"),S=I.blockers.flatMap(N=>N.findings.map(A=>` • [${N.gate}] ${$(A.message)}${A.hint?`
24
- → ${$(A.hint)}`:""}`)).join(`
25
- `);throw new d({code:"PUBLISH_FAILED",message:`Pre-publish guards failed for ${e.pkg.name}@${e.release.newVersion}:
26
- ${S}`,packageName:e.pkg.name})}}const{hashTarball:p}=await import("./publish-guards.js"),h=await p(k.tarball);if((e.workspaceConfig?.publish?.publishStrategy??"npm-publish-tarball")==="native"){const m=e.pm.id;return e.provenance&&m==="bun"&&process.stderr.write(`[vis release] ⚠ publishStrategy "native": bun has no --provenance/OIDC support; ${e.pkg.name}@${e.release.newVersion} publishes without provenance.
27
- `),e.otp&&m==="yarn"&&process.stderr.write(`[vis release] ⚠ publishStrategy "native": \`yarn npm publish\` ignores --otp; configure 2FA via .yarnrc.yml for ${e.pkg.name}.
28
- `),{...await e.pm.publishNative({access:"public",cwd:e.pkg.dir,otp:e.otp,provenance:e.provenance,registry:e.registry,tag:e.tag}),tarball:h}}const c=$e(e.workspaceConfig?.publish?.stage);if(c.enabled){const{refuseRestrictedOidc:m}=await import("./stage-publisher.js"),y=e.pkg.manifest.publishConfig?.access;m(y)}const b=await e.pm.publish({access:"public",otp:e.otp,provenance:e.provenance,registry:e.registry,stage:c.enabled,tag:e.tag,tarball:k.tarball});if(!c.enabled||!b.stageId)return{...b,tarball:h};const{waitForStageDecision:P}=await import("./stage-publisher.js"),{stageId:v}=b,O=Date.now();process.stderr.write(`[vis release] ⏳ ${e.pkg.name}@${e.release.newVersion} staged (id ${v}). Waiting up to ${Math.round(c.timeoutMs/6e4)}m for a maintainer to approve via npmjs.com or \`npm stage approve ${v}\`...
29
- `);const f=await P({cwd:e.pkg.dir,onProgress:m=>{m>0&&m%3e5<c.pollIntervalMs&&process.stderr.write(`[vis release] still waiting for ${e.pkg.name} stage decision (${Math.round(m/6e4)}m elapsed)...
30
- `)},packageName:e.pkg.name,pollIntervalMs:c.pollIntervalMs,runner:e.pm.runner,stageId:v,timeoutMs:c.timeoutMs,version:e.release.newVersion});return f==="approved"?(process.stderr.write(`[vis release] ✓ ${e.pkg.name}@${e.release.newVersion} approved + promoted (${Math.round((Date.now()-O)/1e3)}s).
31
- `),{...b,stageId:void 0,tarball:h}):f==="rejected"?(process.stdout.write(`::warning::Stage rejected for ${e.pkg.name}@${e.release.newVersion} (id ${v}). Re-stage by re-running the release once the review feedback is addressed.
32
- `),{alreadyPublished:!1,output:`stage-rejected: ${v}`,published:!1,stageId:v}):(process.stdout.write(`::warning::Stage timeout for ${e.pkg.name}@${e.release.newVersion} (id ${v}) after ${Math.round(c.timeoutMs/6e4)}m. Re-run \`vis release publish\` once a maintainer can approve, or run \`vis release stage approve ${v}\` manually.
33
- `),{alreadyPublished:!1,output:`stage-timeout: ${v}`,published:!1,stageId:v})}finally{await o.rm(u,{force:!0,recursive:!0})}}finally{await o.writeFile(e.pkg.manifestPath,l)}}async resumeStagedPublish(e,r){const s=e.resumeStageId,n=Date.now();process.stderr.write(`[vis release] ↻ Resuming wait on staged ${e.pkg.name}@${e.release.newVersion} (id ${s}) — tarball already uploaded; not re-publishing.
13
+ Check the mvn output above. Credentials come from ~/.m2/settings.xml, and the pom needs a deploy target (distributionManagement or central-publishing-maven-plugin). See docs/guides/release-maven.mdx.`,message:`mvn deploy failed for ${e.pkg.name}@${e.release.newVersion} (${i}): exit ${t.exitCode}. stderr: ${t.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[maven] deployed ${e.pkg.name}@${e.release.newVersion} (${i})`,published:!0}}}const Pr=a=>{const e=a.indexOf(":");return e===-1?void 0:{artifactId:a.slice(e+1),groupId:a.slice(0,e)}},Ar=async a=>{const e=a.perPackageConfig??{},r=Pr(a.pkg.name);if(e.mavenMetadataUrl===""||r===void 0)return!1;const s=e.mavenMetadataUrl??Ae(r.groupId,r.artifactId);try{const n=await I(s,{headers:{Accept:"text/xml,application/xml;q=0.9,*/*;q=0.8"},httpProxy:a.workspaceConfig?.httpProxy});return n.ok&&Ir(await n.text()).includes(a.release.newVersion)}catch{return!1}};class Nr extends v{id="gradle";async readPublishedVersion(e){}async publish(e){const r=await Pe(e.pkg.dir);if(r===void 0)throw new l({code:"CONFIG_INVALID",file:e.pkg.manifestPath,message:`${e.pkg.name} has no Gradle build root (no gradlew or settings.gradle above ${e.pkg.dir}).`,packageName:e.pkg.name});const s=e.pkg.dir===r?"":e.pkg.dir.slice(r.length+1).split("\\").join("/"),n=s===""?":publish":`:${s.replaceAll("/",":")}:publish`;if(e.dryRun)return{output:`[dry-run / gradle] would run ${b(r,"gradlew")} ${n} for ${e.pkg.name}@${e.release.newVersion}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${e.pkg.name} cannot be published from Windows yet: vis runs ./gradlew without a shell, and gradlew.bat needs one. Publish from a POSIX runner.`,packageName:e.pkg.name});const i=b(r,"gradlew");try{await we(i)}catch{throw new l({code:"CONFIG_INVALID",message:`${e.pkg.name} needs ${i} to publish, and the build root has none. Add the Gradle wrapper (gradle wrapper) at the root.`,packageName:e.pkg.name})}if(await Ar(e))return{alreadyPublished:!0,output:`[gradle] ${e.pkg.name}@${e.release.newVersion} is already on the repository; skipped`,published:!1};const t=await e.pm.runner.run(i,[n],{cwd:r,silent:!1});if(t.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing task: ${n} in ${r}
14
+ Check the Gradle output above. The module needs a publishing plugin and repository (for example maven-publish). Credentials come from your Gradle properties or environment.`,message:`gradle ${n} failed for ${e.pkg.name}@${e.release.newVersion}: exit ${t.exitCode}. stderr: ${t.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[gradle] published ${e.pkg.name}@${e.release.newVersion} (${n})`,published:!0}}}const Sr="https://hex.pm",Vr=async(a,e,r)=>{const s=`${Sr}/api/packages/${encodeURIComponent(a)}`;try{const n=await I(s,{headers:{Accept:"application/json"},httpProxy:r.workspaceConfig?.httpProxy});if(!n.ok)return!1;const i=await n.json(),t=typeof i=="object"&&i!==null?i.releases:void 0;return Array.isArray(t)&&t.some(o=>typeof o=="object"&&o!==null&&o.version===e)}catch{return!1}},_r=async(a,e)=>{try{return(await a.pm.runner.run("mix",["help"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}};class Dr extends v{id="hex";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=e.pkg.dir;if(e.dryRun)return{output:`[dry-run / hex] would run mix hex.publish --yes in ${V(n)} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${r} cannot be published from Windows yet: the mix path is only verified on POSIX. Publish from a POSIX runner.`,packageName:r});if(!await _r(e,n))throw new l({code:"CONFIG_INVALID",message:`${r} needs the mix command on PATH to publish, and "mix help" failed. Install Elixir (which ships Mix) on the runner.`,packageName:r});if(await Vr(r,s,e))return{alreadyPublished:!0,output:`[hex] ${r}@${s} is already on hex.pm; skipped`,published:!1};const i=await e.pm.runner.run("mix",["hex.publish","--yes"],{cwd:n,silent:!1});if(i.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing step: mix hex.publish --yes in ${n}
15
+ Check the output above. Credentials come from HEX_API_KEY in the environment; Hex refuses to replace an existing version.`,message:`mix hex.publish failed for ${r}@${s}: exit ${i.exitCode}. stderr: ${i.stderr.trim().slice(0,500)}`,packageName:r});return{output:`[hex] published ${r}@${s}`,published:!0}}}const Rr=async(a,e)=>{const{extractPackFilesFromRaw:r}=await import("./publish-guards.js"),s=r(e.raw);if(s!==void 0)return s;const n=await a.pm.runner.run("npm",["pack","--dry-run","--json"],{cwd:a.pkg.dir,silent:!0});if(n.exitCode!==0)return[];try{return r(JSON.parse(n.stdout))??[]}catch{return[]}},le=1800*1e3,pe=15*1e3,ue=a=>{if(a===!0)return{enabled:!0,pollIntervalMs:pe,timeoutMs:le};if(a&&typeof a=="object"){const e=a;return{enabled:!0,pollIntervalMs:e.pollIntervalMs??pe,timeoutMs:e.timeoutMs??le}}return{enabled:!1,pollIntervalMs:0,timeoutMs:0}};class Ne extends v{id="npm";async readPublishedVersion(e){try{const r=await e.pm.runner.run("npm",["view",e.pkg.name,"version","--silent"],{cwd:e.pkg.dir,silent:!0});return r.exitCode!==0?void 0:r.stdout.trim()||void 0}catch{return}}async publish(e){if(e.dryRun)return{output:`[dry-run] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};if(e.resumeStageId){const u=ue(e.workspaceConfig?.publish?.stage);if(!u.enabled)throw new l({code:"CONFIG_INVALID",message:`Cannot resume stage ${e.resumeStageId} for ${e.pkg.name}@${e.release.newVersion}: publish.stage is now disabled. Resolve the stage manually via \`vis release stage approve|reject ${e.resumeStageId}\`.`,packageName:e.pkg.name});return this.resumeStagedPublish(e,u)}const r=e.perPackageConfig&&e.workspaceConfig?W(e.pkg.name,e.perPackageConfig,e.workspaceConfig):{};if(r.buildCommand){const u=K(r.buildCommand,{name:e.pkg.name,version:e.release.newVersion}),w=await e.pm.runner.run(process.platform==="win32"?"cmd":"sh",process.platform==="win32"?["/c",u]:["-c",u],{cwd:e.pkg.dir,silent:!1});if(w.exitCode!==0)throw new Error(`buildCommand failed for ${e.pkg.name}: exit ${w.exitCode}`)}const s=e.versionedManifestByName.get(e.pkg.name)??e.pkg.manifest,n=Se(s,e.versionedManifestByName,e.workspaceConfig?.internalDependencyRanges),i=Ee(n,e.catalogs),t=Ge(i,e.cleanPackageJsonConfig),o=await import("node:fs/promises"),p=await o.readFile(e.pkg.manifestPath,"utf8");try{if(await o.writeFile(e.pkg.manifestPath,`${JSON.stringify(t,null,4)}
16
+ `),r.publishCommand){const w={name:e.pkg.name,version:e.release.newVersion},g=Array.isArray(r.publishCommand)?r.publishCommand:[r.publishCommand];for(const d of g){const m=K(d,w),c=await e.pm.runner.run(process.platform==="win32"?"cmd":"sh",process.platform==="win32"?["/c",m]:["-c",m],{cwd:e.pkg.dir,silent:!1});if(c.exitCode!==0)throw new Error(`publishCommand failed for ${e.pkg.name}: exit ${c.exitCode}`)}return{output:`[custom] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}}const u=Be(b($e(),"vis-release-pack-"));try{const w=await e.pm.pack({cwd:e.pkg.dir,destination:u}),g=e.workspaceConfig?.publish?.guards;if(g&&Object.values(g).some(k=>k!==void 0&&k!==!1&&k!=="off")){const{runPublishGuards:k}=await import("./publish-guards.js"),A=await Rr(e,w),N=await k({config:g,manifest:t,packFiles:A,pkgDir:e.pkg.dir,runner:e.pm.runner,sourceManifest:e.pkg.manifest});if(N.blockers.length>0){const{redactTokens:O}=await import("./security.js"),Ve=N.blockers.flatMap(z=>z.findings.map(B=>` • [${z.gate}] ${O(B.message)}${B.hint?`
17
+ → ${O(B.hint)}`:""}`)).join(`
18
+ `);throw new l({code:"PUBLISH_FAILED",message:`Pre-publish guards failed for ${e.pkg.name}@${e.release.newVersion}:
19
+ ${Ve}`,packageName:e.pkg.name})}}const{hashTarball:d}=await import("./publish-guards.js"),m=await d(w.tarball);if((e.workspaceConfig?.publish?.publishStrategy??"npm-publish-tarball")==="native"){const k=e.pm.id;return e.provenance&&k==="bun"&&process.stderr.write(`[vis release] ⚠ publishStrategy "native": bun has no --provenance/OIDC support; ${e.pkg.name}@${e.release.newVersion} publishes without provenance.
20
+ `),e.otp&&k==="yarn"&&process.stderr.write(`[vis release] ⚠ publishStrategy "native": \`yarn npm publish\` ignores --otp; configure 2FA via .yarnrc.yml for ${e.pkg.name}.
21
+ `),{...await e.pm.publishNative({access:"public",cwd:e.pkg.dir,otp:e.otp,provenance:e.provenance,registry:e.registry,tag:e.tag}),tarball:m}}const c=ue(e.workspaceConfig?.publish?.stage);if(c.enabled){const{refuseRestrictedOidc:k}=await import("./stage-publisher.js"),A=e.pkg.manifest.publishConfig?.access;k(A)}const f=await e.pm.publish({access:"public",otp:e.otp,provenance:e.provenance,registry:e.registry,stage:c.enabled,tag:e.tag,tarball:w.tarball});if(!c.enabled||!f.stageId)return{...f,tarball:m};const{waitForStageDecision:$}=await import("./stage-publisher.js"),{stageId:h}=f,P=Date.now();process.stderr.write(`[vis release] ⏳ ${e.pkg.name}@${e.release.newVersion} staged (id ${h}). Waiting up to ${Math.round(c.timeoutMs/6e4)}m for a maintainer to approve via npmjs.com or \`npm stage approve ${h}\`...
22
+ `);const y=await $({cwd:e.pkg.dir,onProgress:k=>{k>0&&k%3e5<c.pollIntervalMs&&process.stderr.write(`[vis release] still waiting for ${e.pkg.name} stage decision (${Math.round(k/6e4)}m elapsed)...
23
+ `)},packageName:e.pkg.name,pollIntervalMs:c.pollIntervalMs,runner:e.pm.runner,stageId:h,timeoutMs:c.timeoutMs,version:e.release.newVersion});return y==="approved"?(process.stderr.write(`[vis release] ✓ ${e.pkg.name}@${e.release.newVersion} approved + promoted (${Math.round((Date.now()-P)/1e3)}s).
24
+ `),{...f,stageId:void 0,tarball:m}):y==="rejected"?(process.stdout.write(`::warning::Stage rejected for ${e.pkg.name}@${e.release.newVersion} (id ${h}). Re-stage by re-running the release once the review feedback is addressed.
25
+ `),{alreadyPublished:!1,output:`stage-rejected: ${h}`,published:!1,stageId:h}):(process.stdout.write(`::warning::Stage timeout for ${e.pkg.name}@${e.release.newVersion} (id ${h}) after ${Math.round(c.timeoutMs/6e4)}m. Re-run \`vis release publish\` once a maintainer can approve, or run \`vis release stage approve ${h}\` manually.
26
+ `),{alreadyPublished:!1,output:`stage-timeout: ${h}`,published:!1,stageId:h})}finally{await o.rm(u,{force:!0,recursive:!0})}}finally{await o.writeFile(e.pkg.manifestPath,p)}}async resumeStagedPublish(e,r){const s=e.resumeStageId,n=Date.now();process.stderr.write(`[vis release] ↻ Resuming wait on staged ${e.pkg.name}@${e.release.newVersion} (id ${s}) — tarball already uploaded; not re-publishing.
34
27
  `);const{waitForStageDecision:i}=await import("./stage-publisher.js"),t=await i({cwd:e.pkg.dir,onProgress:o=>{o>0&&o%3e5<r.pollIntervalMs&&process.stderr.write(`[vis release] still waiting for ${e.pkg.name} stage decision (resume, ${Math.round(o/6e4)}m elapsed)...
35
28
  `)},packageName:e.pkg.name,pollIntervalMs:r.pollIntervalMs,runner:e.pm.runner,stageId:s,timeoutMs:r.timeoutMs,version:e.release.newVersion});return t==="approved"?(process.stderr.write(`[vis release] ✓ ${e.pkg.name}@${e.release.newVersion} approved + promoted on resume (${Math.round((Date.now()-n)/1e3)}s).
36
29
  `),{output:`[resumed] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}):t==="rejected"?(process.stdout.write(`::warning::Stage rejected on resume for ${e.pkg.name}@${e.release.newVersion} (id ${s}).
37
30
  `),{alreadyPublished:!1,output:`stage-rejected: ${s}`,published:!1,stageId:s}):(process.stdout.write(`::warning::Stage timeout on resume for ${e.pkg.name}@${e.release.newVersion} (id ${s}) after ${Math.round(r.timeoutMs/6e4)}m.
38
- `),{alreadyPublished:!1,output:`stage-timeout: ${s}`,published:!1,stageId:s})}}const Kr=["dependencies","devDependencies","peerDependencies","optionalDependencies"],Ge=(a,e,r)=>{const s={...a};for(const n of Kr){const i=a[n];if(!i||typeof i!="object")continue;const t={...i};for(const[o,l]of Object.entries(i)){if(!l.startsWith("workspace:"))continue;const u=e.get(o);u&&(t[o]=ze(l.slice(10)==="*"?"*":l,u.version,r,{dependent:a.name,depName:o,kind:n}),t[o].startsWith("workspace:")&&(t[o]=t[o].slice(10)))}s[n]=t}return s},Wr=Object.defineProperty({__proto__:null,NpmVersionActions:Te,resolveWorkspaceRefs:Ge},Symbol.toStringTag,{value:"Module"}),Ie="https://api.nuget.org/v3/index.json",qr="https://api.nuget.org/v3-flatcontainer",M="NUGET_API_KEY",L=[10,0,300],Xr=a=>{const e=/^(\d+)\.(\d+)\.(\d+)(-[\w.-]+)?/.exec(a.trim());if(!e)return!1;const r=[Number(e[1]),Number(e[2]),Number(e[3])];for(const[s,n]of r.entries())if(n!==L[s])return n>L[s];return e[4]===void 0},Ce=a=>a.split("+")[0].toLowerCase(),Yr=async(a,e,r)=>{try{const s=await V(`${qr}/${encodeURIComponent(a)}/index.json`,{headers:{Accept:"application/json"},httpProxy:r.workspaceConfig?.httpProxy});if(!s.ok)return!1;const n=await s.json();return(typeof n=="object"&&n!==null&&Array.isArray(n.versions)?n.versions:[]).some(t=>typeof t=="string"&&Ce(t)===Ce(e))}catch{return!1}},Pe=(a,e)=>a.split(e).join("***").trim().slice(0,500);class Jr extends C{id="nuget";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=e.pkg.manifestPath,i=e.pkg.dir;if(e.dryRun)return{output:`[dry-run / nuget] would run dotnet pack ${R(n)} -c Release, then dotnet nuget push the package to ${Ie} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new d({code:"CONFIG_INVALID",message:`${r} cannot be published from Windows yet: the NuGet path is only verified on POSIX. Publish from a POSIX runner.`,packageName:r});const t=await e.pm.runner.run("dotnet",["--version"],{cwd:i,silent:!0}).then(u=>u.exitCode===0?u.stdout:void 0).catch(()=>{});if(t===void 0)throw new d({code:"CONFIG_INVALID",message:`${r} needs the dotnet CLI on PATH to publish, and "dotnet --version" failed. Install the .NET SDK on the runner.`,packageName:r});if(!Xr(t))throw new d({code:"CONFIG_INVALID",message:`${r} publishes with the ${M} environment variable, which dotnet nuget push reads from .NET SDK ${L.join(".")} (NuGet 7.6) on. This runner has dotnet ${t.trim()}. Install .NET SDK ${L.join(".")} or later on the runner.`,packageName:r});if(await Yr(r,s,e))return{alreadyPublished:!0,output:`[nuget] ${r}@${s} is already on nuget.org; skipped`,published:!1};const o=process.env[M];if(o===void 0||o==="")throw new d({code:"CONFIG_INVALID",message:`${r} needs the API key in the ${M} environment variable to push to nuget.org. Set it on the runner; vis never logs it.`,packageName:r});const l=await He(w(B(),"vis-nuget-"));try{const u=await e.pm.runner.run("dotnet",["pack",n,"-c","Release","-o",l],{cwd:i,silent:!1});if(u.exitCode!==0)throw new d({code:"PUBLISH_FAILED",hint:`Failing step: dotnet pack ${R(n)}
39
- Fix the build or packaging error above.`,message:`dotnet pack failed for ${r}@${s}: exit ${u.exitCode}. stderr: ${Pe(u.stderr,o)}`,packageName:r});const g=(await re(l)).filter(h=>h.endsWith(".nupkg")&&!h.endsWith(".symbols.nupkg"));if(g.length!==1)throw new d({code:"PUBLISH_FAILED",hint:`dotnet pack wrote ${g.length} packages to a temporary directory. vis pushes exactly one per project.`,message:`expected one .nupkg for ${r}@${s}, found ${g.length}`,packageName:r});const p=await e.pm.runner.run("dotnet",["nuget","push",w(l,g[0]),"--source",Ie],{cwd:i,env:{[M]:o},silent:!1});if(p.exitCode!==0)throw new d({code:"PUBLISH_FAILED",hint:`Failing step: dotnet nuget push
40
- Check the output above. A version nuget.org already has is refused. The key comes from ${M}, which dotnet nuget push reads on .NET SDK ${L.join(".")} or later.`,message:`dotnet nuget push failed for ${r}@${s}: exit ${p.exitCode}. stderr: ${Pe(p.stderr,o)}`,packageName:r})}finally{await se(l,{force:!0,recursive:!0})}return{output:`[nuget] published ${r}@${s} to nuget.org`,published:!0}}}class zr extends C{id="private";async readPublishedVersion(e){}async publish(e){return{output:`[private] skipped publish for ${e.pkg.name}@${e.release.newVersion}`,published:!1}}}const G=async(a,e,r,s)=>{const n=Z(r,s),i=process.platform==="win32",t=i?"cmd":"sh",o=i?["/c",n]:["-c",n];return a.run(t,o,{cwd:e,silent:!1})};class Qr extends C{id="shell";async readPublishedVersion(e){const r=e.perPackageConfig??{},{workspaceConfig:s}=e;if(!s)return;const n=Q(e.pkg.name,r,s);if(!n.checkPublished)return;const i=await G(e.pm.runner,e.pkg.dir,n.checkPublished,{name:e.pkg.name,version:e.pkg.version});if(i.exitCode!==0)return;const t=i.stdout.trim();return/\b\d+\.\d+\.\d+(?:[-+][\w.+-]+)?\b/.exec(t)?.[0]}async publish(e){if(e.dryRun)return{output:`[dry-run / shell] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const{workspaceConfig:r}=e,s=e.perPackageConfig??{};if(!r)throw new d({code:"CONFIG_INVALID",message:`Shell publish actions for ${e.pkg.name} require a workspace config (release.allowCustomCommands gate).`,packageName:e.pkg.name});const n=Q(e.pkg.name,s,r);if(!n.publishCommand)throw new d({code:"CONFIG_INVALID",hint:`Set release.allowCustomCommands (workspace-wide boolean or an allow-list including "${e.pkg.name}") and configure release.packages["${e.pkg.name}"].publishCommand.`,message:`Shell publish actions for ${e.pkg.name} require a publishCommand AND the trust gate to permit it.`,packageName:e.pkg.name});const i={name:e.pkg.name,registry:e.registry,tag:e.tag,version:e.release.newVersion};if(n.checkPublished){const o=await G(e.pm.runner,e.pkg.dir,n.checkPublished,i);if(o.exitCode===0&&/\b\d+\.\d+\.\d+(?:[-+][\w.+-]+)?\b/.exec(o.stdout.trim())?.[0]===e.release.newVersion)return{alreadyPublished:!0,output:`[shell] ${e.pkg.name}@${e.release.newVersion} already on the registry`,published:!1}}if(n.buildCommand){const o=await G(e.pm.runner,e.pkg.dir,n.buildCommand,i);if(o.exitCode!==0)throw new d({code:"PUBLISH_FAILED",message:`buildCommand failed for ${e.pkg.name}: exit ${o.exitCode}. stderr: ${o.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}const t=Array.isArray(n.publishCommand)?n.publishCommand:[n.publishCommand];for(const o of t){const l=await G(e.pm.runner,e.pkg.dir,o,i);if(l.exitCode!==0)throw new d({code:"PUBLISH_FAILED",hint:"Inspect the publishCommand output above. Common causes: missing auth token, registry unreachable, version already published (re-run safe — `checkPublished` short-circuits subsequent runs).",message:`publishCommand failed for ${e.pkg.name}@${e.release.newVersion}: exit ${l.exitCode}. stderr: ${l.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}return{output:`[shell] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}}}const Zr=async(a,e)=>{try{return(await a.pm.runner.run("git",["rev-parse","--quiet","--verify",`refs/tags/${e}`],{cwd:a.pkg.dir,silent:!0})).exitCode===0}catch{return!1}};class xr extends C{id="swift";async readPublishedVersion(e){}async publish(e){const r=e.release.newVersion,s=e.perPackageConfig?.releaseTagPattern??e.workspaceConfig?.releaseTagPattern,n=s===void 0?_e(e.pkg.name,r):W(s,{name:e.pkg.name,version:r});if(e.dryRun)return{output:`[dry-run / swift] would tag ${n} for ${e.pkg.name}@${r}`,published:!0};if(process.platform==="win32")throw new d({code:"CONFIG_INVALID",message:`${e.pkg.name} cannot be released from Windows yet: SwiftPM is not run on Windows here. Release from a POSIX runner.`,packageName:e.pkg.name});return await Zr(e,n)?{alreadyPublished:!0,output:`[swift] tag ${n} already exists; ${e.pkg.name}@${r} skipped`,published:!1}:{output:`[swift] ${e.pkg.name}@${r} is released by tag ${n}, created with the release`,published:!0}}}const es=(a,e,r)=>{const s=r.perPackageConfig?.releaseTagPattern??r.workspaceConfig?.releaseTagPattern;return s?W(s,{channel:r.channel,name:a,version:e}):_e(a,e)};class rs extends C{id="zig";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=es(r,s,{channel:e.tag,perPackageConfig:e.perPackageConfig,workspaceConfig:e.workspaceConfig});if(e.dryRun)return{output:`[dry-run / zig] would tag ${n} for ${r}@${s}; nothing is uploaded`,published:!0};if(process.platform==="win32")throw new d({code:"CONFIG_INVALID",message:`${r} cannot be released from Windows yet: the Zig path is only verified on POSIX. Release from a POSIX runner.`,packageName:r});return await ae({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[zig] tag ${n} already exists for ${r}@${s}; skipped`,published:!1}:{output:`[zig] ${r}@${s} has no registry; tag ${n} is created by the release`,published:!0}}}const fs=a=>{switch(a){case"cargo":return new tr;case"composer":return new lr;case"container":return new gr;case"dart":return new fr;case"gem":return new vr;case"go":return new $r;case"gradle":return new Fr;case"hex":return new Tr;case"maven":return new Or;case"native-addon":return new Br;case"nuget":return new Jr;case"private":return new zr;case"python":return new Xe;case"shell":return new Qr;case"swift":return new xr;case"zig":return new rs;default:return new Te}};export{Ze as a,ms as b,fs as c,Qe as e,hs as g,q as i,H as p};
31
+ `),{alreadyPublished:!1,output:`stage-timeout: ${s}`,published:!1,stageId:s})}}const Or=["dependencies","devDependencies","peerDependencies","optionalDependencies"],Se=(a,e,r)=>{const s={...a};for(const n of Or){const i=a[n];if(!i||typeof i!="object")continue;const t={...i};for(const[o,p]of Object.entries(i)){if(!p.startsWith("workspace:"))continue;const u=e.get(o);u&&(t[o]=He(p.slice(10)==="*"?"*":p,u.version,r,{dependent:a.name,depName:o,kind:n}),t[o].startsWith("workspace:")&&(t[o]=t[o].slice(10)))}s[n]=t}return s},ss=Object.defineProperty({__proto__:null,NpmVersionActions:Ne,resolveWorkspaceRefs:Se},Symbol.toStringTag,{value:"Module"}),ce="https://api.nuget.org/v3/index.json",Fr="https://api.nuget.org/v3-flatcontainer",D="NUGET_API_KEY",R=[10,0,300],Lr=a=>{const e=/^(\d+)\.(\d+)\.(\d+)(-[\w.-]+)?/.exec(a.trim());if(!e)return!1;const r=[Number(e[1]),Number(e[2]),Number(e[3])];for(const[s,n]of r.entries())if(n!==R[s])return n>R[s];return e[4]===void 0},ge=a=>a.split("+")[0].toLowerCase(),Mr=async(a,e,r)=>{try{const s=await I(`${Fr}/${encodeURIComponent(a)}/index.json`,{headers:{Accept:"application/json"},httpProxy:r.workspaceConfig?.httpProxy});if(!s.ok)return!1;const n=await s.json();return(typeof n=="object"&&n!==null&&Array.isArray(n.versions)?n.versions:[]).some(t=>typeof t=="string"&&ge(t)===ge(e))}catch{return!1}},me=(a,e)=>a.split(e).join("***").trim().slice(0,500);class Er extends v{id="nuget";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=e.pkg.manifestPath,i=e.pkg.dir;if(e.dryRun)return{output:`[dry-run / nuget] would run dotnet pack ${V(n)} -c Release, then dotnet nuget push the package to ${ce} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${r} cannot be published from Windows yet: the NuGet path is only verified on POSIX. Publish from a POSIX runner.`,packageName:r});const t=await e.pm.runner.run("dotnet",["--version"],{cwd:i,silent:!0}).then(u=>u.exitCode===0?u.stdout:void 0).catch(()=>{});if(t===void 0)throw new l({code:"CONFIG_INVALID",message:`${r} needs the dotnet CLI on PATH to publish, and "dotnet --version" failed. Install the .NET SDK on the runner.`,packageName:r});if(!Lr(t))throw new l({code:"CONFIG_INVALID",message:`${r} publishes with the ${D} environment variable, which dotnet nuget push reads from .NET SDK ${R.join(".")} (NuGet 7.6) on. This runner has dotnet ${t.trim()}. Install .NET SDK ${R.join(".")} or later on the runner.`,packageName:r});if(await Mr(r,s,e))return{alreadyPublished:!0,output:`[nuget] ${r}@${s} is already on nuget.org; skipped`,published:!1};const o=process.env[D];if(o===void 0||o==="")throw new l({code:"CONFIG_INVALID",message:`${r} needs the API key in the ${D} environment variable to push to nuget.org. Set it on the runner; vis never logs it.`,packageName:r});const p=await Oe(b($e(),"vis-nuget-"));try{const u=await e.pm.runner.run("dotnet",["pack",n,"-c","Release","-o",p],{cwd:i,silent:!1});if(u.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing step: dotnet pack ${V(n)}
32
+ Fix the build or packaging error above.`,message:`dotnet pack failed for ${r}@${s}: exit ${u.exitCode}. stderr: ${me(u.stderr,o)}`,packageName:r});const g=(await he(p)).filter(m=>m.endsWith(".nupkg")&&!m.endsWith(".symbols.nupkg"));if(g.length!==1)throw new l({code:"PUBLISH_FAILED",hint:`dotnet pack wrote ${g.length} packages to a temporary directory. vis pushes exactly one per project.`,message:`expected one .nupkg for ${r}@${s}, found ${g.length}`,packageName:r});const d=await e.pm.runner.run("dotnet",["nuget","push",b(p,g[0]),"--source",ce],{cwd:i,env:{[D]:o},silent:!1});if(d.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing step: dotnet nuget push
33
+ Check the output above. A version nuget.org already has is refused. The key comes from ${D}, which dotnet nuget push reads on .NET SDK ${R.join(".")} or later.`,message:`dotnet nuget push failed for ${r}@${s}: exit ${d.exitCode}. stderr: ${me(d.stderr,o)}`,packageName:r})}finally{await fe(p,{force:!0,recursive:!0})}return{output:`[nuget] published ${r}@${s} to nuget.org`,published:!0}}}class Gr extends v{id="private";async readPublishedVersion(e){}async publish(e){return{output:`[private] skipped publish for ${e.pkg.name}@${e.release.newVersion}`,published:!1}}}const L=async(a,e,r,s)=>{const n=K(r,s),i=process.platform==="win32",t=i?"cmd":"sh",o=i?["/c",n]:["-c",n];return a.run(t,o,{cwd:e,silent:!1})};class jr extends v{id="shell";async readPublishedVersion(e){const r=e.perPackageConfig??{},{workspaceConfig:s}=e;if(!s)return;const n=W(e.pkg.name,r,s);if(!n.checkPublished)return;const i=await L(e.pm.runner,e.pkg.dir,n.checkPublished,{name:e.pkg.name,version:e.pkg.version});if(i.exitCode!==0)return;const t=i.stdout.trim();return/\b\d+\.\d+\.\d+(?:[-+][\w.+-]+)?\b/.exec(t)?.[0]}async publish(e){if(e.dryRun)return{output:`[dry-run / shell] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const{workspaceConfig:r}=e,s=e.perPackageConfig??{};if(!r)throw new l({code:"CONFIG_INVALID",message:`Shell publish actions for ${e.pkg.name} require a workspace config (release.allowCustomCommands gate).`,packageName:e.pkg.name});const n=W(e.pkg.name,s,r);if(!n.publishCommand)throw new l({code:"CONFIG_INVALID",hint:`Set release.allowCustomCommands (workspace-wide boolean or an allow-list including "${e.pkg.name}") and configure release.packages["${e.pkg.name}"].publishCommand.`,message:`Shell publish actions for ${e.pkg.name} require a publishCommand AND the trust gate to permit it.`,packageName:e.pkg.name});const i={name:e.pkg.name,registry:e.registry,tag:e.tag,version:e.release.newVersion};if(n.checkPublished){const o=await L(e.pm.runner,e.pkg.dir,n.checkPublished,i);if(o.exitCode===0&&/\b\d+\.\d+\.\d+(?:[-+][\w.+-]+)?\b/.exec(o.stdout.trim())?.[0]===e.release.newVersion)return{alreadyPublished:!0,output:`[shell] ${e.pkg.name}@${e.release.newVersion} already on the registry`,published:!1}}if(n.buildCommand){const o=await L(e.pm.runner,e.pkg.dir,n.buildCommand,i);if(o.exitCode!==0)throw new l({code:"PUBLISH_FAILED",message:`buildCommand failed for ${e.pkg.name}: exit ${o.exitCode}. stderr: ${o.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}const t=Array.isArray(n.publishCommand)?n.publishCommand:[n.publishCommand];for(const o of t){const p=await L(e.pm.runner,e.pkg.dir,o,i);if(p.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:"Inspect the publishCommand output above. Common causes: missing auth token, registry unreachable, version already published (re-run safe — `checkPublished` short-circuits subsequent runs).",message:`publishCommand failed for ${e.pkg.name}@${e.release.newVersion}: exit ${p.exitCode}. stderr: ${p.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}return{output:`[shell] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}}}const Tr=async(a,e)=>{try{return(await a.pm.runner.run("git",["rev-parse","--quiet","--verify",`refs/tags/${e}`],{cwd:a.pkg.dir,silent:!0})).exitCode===0}catch{return!1}};class Ur extends v{id="swift";async readPublishedVersion(e){}async publish(e){const r=e.release.newVersion,s=e.perPackageConfig?.releaseTagPattern??e.workspaceConfig?.releaseTagPattern,n=s===void 0?ve(e.pkg.name,r):T(s,{name:e.pkg.name,version:r});if(e.dryRun)return{output:`[dry-run / swift] would tag ${n} for ${e.pkg.name}@${r}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${e.pkg.name} cannot be released from Windows yet: SwiftPM is not run on Windows here. Release from a POSIX runner.`,packageName:e.pkg.name});return await Tr(e,n)?{alreadyPublished:!0,output:`[swift] tag ${n} already exists; ${e.pkg.name}@${r} skipped`,published:!1}:{output:`[swift] ${e.pkg.name}@${r} is released by tag ${n}, created with the release`,published:!0}}}const Br=(a,e,r)=>{const s=r.perPackageConfig?.releaseTagPattern??r.workspaceConfig?.releaseTagPattern;return s?T(s,{channel:r.channel,name:a,version:e}):ve(a,e)};class Hr extends v{id="zig";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=Br(r,s,{channel:e.tag,perPackageConfig:e.perPackageConfig,workspaceConfig:e.workspaceConfig});if(e.dryRun)return{output:`[dry-run / zig] would tag ${n} for ${r}@${s}; nothing is uploaded`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${r} cannot be released from Windows yet: the Zig path is only verified on POSIX. Release from a POSIX runner.`,packageName:r});return await Y({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[zig] tag ${n} already exists for ${r}@${s}; skipped`,published:!1}:{output:`[zig] ${r}@${s} has no registry; tag ${n} is created by the release`,published:!0}}}const as=a=>{switch(a){case"cargo":return new xe;case"composer":return new sr;case"container":return new tr;case"dart":return new lr;case"gem":return new gr;case"go":return new hr;case"gradle":return new Nr;case"hex":return new Dr;case"maven":return new Cr;case"native-addon":return new je;case"nuget":return new Er;case"private":return new Gr;case"python":return new Te;case"shell":return new jr;case"swift":return new Ur;case"zig":return new Hr;default:return new Ne}};export{Ke as a,es as b,as as c,We as e,rs as g,U as i,ss as n,G as p};