@visulima/vis 1.0.0-alpha.37 → 1.0.0-alpha.38

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 (177) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE.md +1 -503
  3. package/dist/bin.js +1 -1
  4. package/dist/binx.js +1 -1
  5. package/dist/config/index.d.ts +7 -0
  6. package/dist/packem_chunks/DEFAULT_CLEAN_KEEP.js +1 -0
  7. package/dist/packem_chunks/bin.js +302 -515
  8. package/dist/packem_chunks/bloom-sync.js +1 -1
  9. package/dist/packem_chunks/catalog-detector.js +1 -0
  10. package/dist/packem_chunks/detect.js +3 -0
  11. package/dist/packem_chunks/detect2.js +8 -0
  12. package/dist/packem_chunks/discord.js +4 -0
  13. package/dist/packem_chunks/dynamic-import.js +1 -0
  14. package/dist/packem_chunks/extra-files.js +3 -0
  15. package/dist/packem_chunks/fix.js +1 -1
  16. package/dist/packem_chunks/git.js +3 -0
  17. package/dist/packem_chunks/handler10.js +1 -1
  18. package/dist/packem_chunks/handler12.js +1 -1
  19. package/dist/packem_chunks/handler13.js +1 -1
  20. package/dist/packem_chunks/handler14.js +1 -1
  21. package/dist/packem_chunks/handler15.js +1 -1
  22. package/dist/packem_chunks/handler16.js +1 -1
  23. package/dist/packem_chunks/handler17.js +1 -1
  24. package/dist/packem_chunks/handler18.js +1 -1
  25. package/dist/packem_chunks/handler19.js +1 -1
  26. package/dist/packem_chunks/handler21.js +1 -1
  27. package/dist/packem_chunks/handler27.js +1 -1
  28. package/dist/packem_chunks/handler28.js +1 -1
  29. package/dist/packem_chunks/handler29.js +1 -1
  30. package/dist/packem_chunks/handler3.js +4 -4
  31. package/dist/packem_chunks/handler30.js +2 -7
  32. package/dist/packem_chunks/handler31.js +2 -33
  33. package/dist/packem_chunks/handler32.js +2 -3
  34. package/dist/packem_chunks/handler33.js +3 -8
  35. package/dist/packem_chunks/handler34.js +6 -4
  36. package/dist/packem_chunks/handler35.js +1 -1
  37. package/dist/packem_chunks/handler36.js +42 -5
  38. package/dist/packem_chunks/handler37.js +8 -11
  39. package/dist/packem_chunks/handler38.js +9 -3
  40. package/dist/packem_chunks/handler39.js +74 -21
  41. package/dist/packem_chunks/handler4.js +1 -1
  42. package/dist/packem_chunks/handler40.js +5 -61
  43. package/dist/packem_chunks/handler41.js +4 -3
  44. package/dist/packem_chunks/handler42.js +3 -6
  45. package/dist/packem_chunks/handler43.js +2 -24
  46. package/dist/packem_chunks/handler44.js +1 -25
  47. package/dist/packem_chunks/handler45.js +1 -153
  48. package/dist/packem_chunks/handler46.js +1 -10
  49. package/dist/packem_chunks/handler47.js +3 -24
  50. package/dist/packem_chunks/handler48.js +1 -322
  51. package/dist/packem_chunks/handler49.js +7 -708
  52. package/dist/packem_chunks/handler5.js +6 -6
  53. package/dist/packem_chunks/handler50.js +33 -48
  54. package/dist/packem_chunks/handler51.js +3 -27
  55. package/dist/packem_chunks/handler52.js +8 -3
  56. package/dist/packem_chunks/handler53.js +4 -200
  57. package/dist/packem_chunks/handler54.js +1 -38
  58. package/dist/packem_chunks/handler55.js +12 -0
  59. package/dist/packem_chunks/handler56.js +7 -0
  60. package/dist/packem_chunks/handler57.js +5 -0
  61. package/dist/packem_chunks/handler58.js +11 -0
  62. package/dist/packem_chunks/handler59.js +3 -0
  63. package/dist/packem_chunks/handler60.js +22 -0
  64. package/dist/packem_chunks/handler61.js +61 -0
  65. package/dist/packem_chunks/handler62.js +3 -0
  66. package/dist/packem_chunks/handler63.js +6 -0
  67. package/dist/packem_chunks/handler64.js +708 -0
  68. package/dist/packem_chunks/handler65.js +24 -0
  69. package/dist/packem_chunks/handler66.js +25 -0
  70. package/dist/packem_chunks/handler67.js +153 -0
  71. package/dist/packem_chunks/handler68.js +10 -0
  72. package/dist/packem_chunks/handler69.js +24 -0
  73. package/dist/packem_chunks/handler7.js +1 -1
  74. package/dist/packem_chunks/handler70.js +322 -0
  75. package/dist/packem_chunks/handler71.js +48 -0
  76. package/dist/packem_chunks/handler72.js +27 -0
  77. package/dist/packem_chunks/handler73.js +3 -0
  78. package/dist/packem_chunks/handler74.js +190 -0
  79. package/dist/packem_chunks/handler75.js +38 -0
  80. package/dist/packem_chunks/handler8.js +1 -1
  81. package/dist/packem_chunks/handler9.js +1 -1
  82. package/dist/packem_chunks/heal-accept.js +1 -1
  83. package/dist/packem_chunks/heal.js +1 -1
  84. package/dist/packem_chunks/help-command.js +1 -1
  85. package/dist/packem_chunks/index.js +1 -7
  86. package/dist/packem_chunks/index2.js +7 -0
  87. package/dist/packem_chunks/interface.js +2 -0
  88. package/dist/packem_chunks/keys-refresh.js +1 -1
  89. package/dist/packem_chunks/list.js +1 -1
  90. package/dist/packem_chunks/loader.js +1 -1
  91. package/dist/packem_chunks/orchestrator.js +39 -0
  92. package/dist/packem_chunks/pre-mode.js +2 -0
  93. package/dist/packem_chunks/print-config.js +2 -0
  94. package/dist/packem_chunks/prompts.js +7 -0
  95. package/dist/packem_chunks/publish-guards.js +1 -0
  96. package/dist/packem_chunks/registry.js +48 -0
  97. package/dist/packem_chunks/resolveFormatter.js +9 -0
  98. package/dist/packem_chunks/security.js +1 -0
  99. package/dist/packem_chunks/shell-runner.js +1 -0
  100. package/dist/packem_chunks/slack.js +2 -0
  101. package/dist/packem_chunks/snapshot.js +2 -0
  102. package/dist/packem_chunks/stage-publisher.js +1 -0
  103. package/dist/packem_chunks/staged-registry.js +2 -0
  104. package/dist/packem_chunks/state.js +3 -0
  105. package/dist/packem_chunks/success-walk.js +8 -0
  106. package/dist/packem_chunks/sync.js +1 -1
  107. package/dist/packem_chunks/sync2.js +1 -1
  108. package/dist/packem_chunks/tripwire.js +1 -1
  109. package/dist/packem_chunks/verify-lockfile.js +2 -2
  110. package/dist/packem_chunks/version-resolver.js +2 -0
  111. package/dist/packem_chunks/webhook.js +1 -0
  112. package/dist/packem_chunks/workflow-templates.js +167 -0
  113. package/dist/packem_chunks/workspace.js +2 -0
  114. package/dist/packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js +1 -0
  115. package/dist/packem_shared/ReleaseClient-YHzBIxYS.js +1 -0
  116. package/dist/packem_shared/VisReleaseError-DMGRBTNO.js +1 -0
  117. package/dist/packem_shared/{ai-analysis-DT3bU-_M.js → ai-analysis-K-DKU3ZA.js} +1 -1
  118. package/dist/packem_shared/{ai-fix-BkNqd5nP.js → ai-fix-BPrYoCk8.js} +1 -1
  119. package/dist/packem_shared/api.d-BPftyU9r.d.ts +27 -0
  120. package/dist/packem_shared/createAdapter-bU4DIP3F.js +1 -0
  121. package/dist/packem_shared/createVersionActions-BK43SNDH.js +1 -0
  122. package/dist/packem_shared/{cyclonedx-86-DbHtf.js → cyclonedx-kYozDyxp.js} +3 -3
  123. package/dist/packem_shared/defineFormatter-D5dCp6Kv.js +1 -0
  124. package/dist/packem_shared/dependency-scan-anTuZB1t.js +1 -0
  125. package/dist/packem_shared/{docker-tNrDU3oK.js → docker-BMLrNtWm.js} +1 -1
  126. package/dist/packem_shared/{failure-log-Dwqt6_Ga.js → failure-log-CEWP3bP0.js} +1 -1
  127. package/dist/packem_shared/index-BJbpNthk.js +1 -0
  128. package/dist/packem_shared/index-CgcF6_wo.js +1 -0
  129. package/dist/packem_shared/{index-dQ37x8_P.js → index-D1_fbGbj.js} +1 -1
  130. package/dist/packem_shared/interface.d-B7VK2rcH.d.ts +148 -0
  131. package/dist/packem_shared/interface.d-Cezzifoh.d.ts +106 -0
  132. package/dist/packem_shared/{missing-package-json-41VUWFBY.js → missing-package-json-BfWUxTGv.js} +1 -1
  133. package/dist/packem_shared/{native-config-sync-BKAZ0NIs.js → native-config-sync-BEkJW7g3.js} +8 -8
  134. package/dist/packem_shared/pm-runner-OGResYrA.js +1 -0
  135. package/dist/packem_shared/provenance-_CJjMKwu.js +1 -0
  136. package/dist/packem_shared/public-api-WqUCiyIe.js +131 -0
  137. package/dist/packem_shared/{registry-keys-Bf2zzlcZ.js → registry-keys-BfFto6vI.js} +1 -1
  138. package/dist/packem_shared/{resolve-explicit-jH0RKyMJ.js → resolve-explicit-CMDl55Nz.js} +2 -2
  139. package/dist/packem_shared/s1ngularity-Dhr3bPk0.js +1 -0
  140. package/dist/packem_shared/{scan-progress-JBbd9QeT.js → scan-progress-DG7_JmTV.js} +1 -1
  141. package/dist/packem_shared/{signatures-D1H6h6GH.js → signatures-C730vkyK.js} +2 -2
  142. package/dist/packem_shared/slug-DoueYuLo.js +1 -0
  143. package/dist/packem_shared/spinner-CV3WVJLv.js +1 -0
  144. package/dist/packem_shared/sticky-comment-D6_7-w8T.js +1 -0
  145. package/dist/packem_shared/{tabs-BqUepRaD.js → tabs-BuTy5gPV.js} +1 -1
  146. package/dist/packem_shared/{typosquats-C8qg1neE.js → typosquats-DN78xx1x.js} +1 -1
  147. package/dist/packem_shared/use-measured-height-_eVGWtWt.js +1 -0
  148. package/dist/packem_shared/verify-6WCmFmy8.js +1 -0
  149. package/dist/packem_shared/{vis-update-app-CTwRkNgj.js → vis-update-app-k3fDxech.js} +1 -1
  150. package/dist/release/core/changelog/index.d.ts +5 -0
  151. package/dist/release/core/changelog/index.js +1 -0
  152. package/dist/release/core/package-managers/index.d.ts +6 -0
  153. package/dist/release/core/package-managers/index.js +1 -0
  154. package/dist/release/core/version-actions/index.d.ts +14 -0
  155. package/dist/release/core/version-actions/index.js +1 -0
  156. package/dist/release/index.d.ts +196 -0
  157. package/dist/release/index.js +1 -0
  158. package/dist/release/plugin-sdk.d.ts +127 -0
  159. package/dist/release/plugin-sdk.js +1 -0
  160. package/dist/release/presets.d.ts +225 -0
  161. package/dist/release/presets.js +1 -0
  162. package/dist/release/types.d.ts +1377 -0
  163. package/dist/release/types.js +1 -0
  164. package/index.d.ts +201 -201
  165. package/index.js +578 -752
  166. package/package.json +52 -10
  167. package/schemas/vis-config.schema.json +1394 -6
  168. package/schemas/vis-release-config.schema.json +1390 -0
  169. package/dist/packem_shared/dependency-scan-BDTH898x.js +0 -1
  170. package/dist/packem_shared/index-CB4p298r.js +0 -1
  171. package/dist/packem_shared/index-DMefdF51.js +0 -1
  172. package/dist/packem_shared/pm-runner-pVihAfxV.js +0 -1
  173. package/dist/packem_shared/provenance-DMuEftgc.js +0 -1
  174. package/dist/packem_shared/s1ngularity-BkfgC6NO.js +0 -1
  175. package/dist/packem_shared/spinner-BXSl864p.js +0 -1
  176. package/dist/packem_shared/use-measured-height-BBJ9intr.js +0 -1
  177. package/dist/packem_shared/verify-Du7xZ2BJ.js +0 -1
@@ -1,5 +1,42 @@
1
- import{createRequire as B}from"node:module";import{u as W,ai as M,aj as F,ak as P,al as p,am as z,an as G,ao as L,ap as Y,aq as Z,ar as H,as as K,at as Q,au as U,av as X,aw as tt,ax as V,ay as ot}from"./bin.js";import{f as k,m as f,v as j,T as O,I as nt,J as it}from"../packem_shared/index-BDmTbWX1.js";import{Z as rt}from"./config.js";import{v as ut}from"../packem_shared/verify-Du7xZ2BJ.js";const J=B(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=t=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[o,s]=$.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return $.getBuiltinModule(t)}return J(t)},{readdirSync:et,statSync:st}=I("node:fs"),{stdin:T,stdout:at}=$,{createInterface:ct}=I("node:readline/promises"),w="__global__",R=t=>[...new Set(t)].sort((o,s)=>o.localeCompare(s)),pt=t=>`{${Object.keys(t).sort().map(o=>`${o}=${JSON.stringify(t[o])}`).join(",")}}`,m=t=>{if(!Array.isArray(t))return[];const o=[];for(const s of t)typeof s=="string"?o.push(s):s&&typeof s=="object"&&o.push(pt(s));return R(o)},y=t=>({cache:void 0,dependsOn:[],env:[],id:t,inputs:[],outputs:[]}),h=(t,o,s)=>s?`^${o}`:t&&t!=="self"&&t!=="~"?`${t}#${o}`:o,ft=(t,o)=>{const s=t.trim();if(o==="moon"){if(s.startsWith("^:"))return h(void 0,s.slice(2),!0);if(s.startsWith("~:"))return h(void 0,s.slice(2),!1);if(s.includes(":")){const[n,e]=s.split(":");return h(n,e??"",!1)}return s}if(s.startsWith("^"))return h(void 0,s.slice(1),!0);if(s.includes("#")){const[n,e]=s.split("#");return h(n,e??"",!1)}return s},C=(t,o)=>{if(!Array.isArray(t))return[];const s=[];for(const n of t){if(typeof n=="string"){s.push(ft(n,o));continue}if(!n||typeof n!="object")continue;const e=n,{target:i}=e;if(!i)continue;if(e.dependencies===!0){s.push(h(void 0,i,!0));continue}if(e.projects===void 0){s.push(h(void 0,i,!1));continue}const r=Array.isArray(e.projects)?e.projects:[e.projects];for(const c of r)s.push(c==="^"?h(void 0,i,!0):h(c,i,!1))}return R(s)},E=t=>{if(k(t))try{return JSON.parse(j(t))}catch{return}},gt=t=>{const o=new Map,s=E(f(t,"turbo.json"));if(!s)return o;const n=s.tasks??s.pipeline??{};for(const[i,r]of Object.entries(n)){const c=i.includes("#")?i:`*#${i}`,a=y(c);a.dependsOn=C(r.dependsOn,"turbo"),a.inputs=m(r.inputs),a.outputs=m(r.outputs),a.env=R([...r.env??[],...r.passThroughEnv??[]]),a.cache=r.cache===!1?!1:void 0,o.set(c,a)}const e=y(w);return e.inputs=m(s.globalDependencies),e.env=R([...s.globalEnv??[],...s.globalPassThroughEnv??[]]),(e.inputs.length>0||e.env.length>0)&&o.set(w,e),o},dt=new Set([".git",".nx",".turbo",".vis","build","coverage","dist","node_modules"]),S=(t,o,s=8)=>{const n=[],e=(i,r)=>{if(r>s)return;let c;try{c=et(i)}catch{return}for(const a of c.toSorted()){if(a===o){n.push(f(i,a));continue}if(a.startsWith(".")&&a!==".moon"||dt.has(a))continue;const u=f(i,a);try{st(u).isDirectory()&&e(u,r+1)}catch{}}};return e(t,0),n},N=(t,o)=>{t.dependsOn=C(o.dependsOn,"nx"),t.inputs=m(o.inputs),t.outputs=m(o.outputs),t.cache=typeof o.cache=="boolean"?o.cache:void 0},lt=t=>{const o=new Map,s=E(f(t,"nx.json"));for(const[n,e]of Object.entries(s?.targetDefaults??{})){const i=`*#${n}`,r=y(i);N(r,e),o.set(i,r)}for(const n of S(t,"project.json")){const e=E(n);if(!(!e?.name||!e.targets))for(const[i,r]of Object.entries(e.targets)){const c=`${e.name}#${i}`,a=y(c);N(a,r),o.set(c,a)}}return o},_=(t,o)=>{t.dependsOn=C(o.deps,"moon"),t.inputs=m(o.inputs),t.outputs=m(o.outputs),t.cache=typeof o.options?.cache=="boolean"?o.options.cache:void 0},A=t=>{if(k(t))try{return W(t)}catch{return}},vt=t=>{const o=new Map,s=f(t,".moon"),n=[f(s,"tasks.yml"),f(s,"tasks.yaml")];for(const e of n){const i=A(e);if(i){for(const[r,c]of Object.entries(i.tasks??{})){const a=`*#${r}`,u=y(a);_(u,c),o.set(a,u)}if(i.implicitInputs&&i.implicitInputs.length>0){const r=y(w);r.inputs=m(i.implicitInputs),o.set(w,r)}}}for(const e of[...S(t,"moon.yml"),...S(t,"moon.yaml")]){const i=A(e);if(!i?.tasks)continue;const r=e.split(/[/\\]/).at(-2)??"*";for(const[c,a]of Object.entries(i.tasks)){const u=`${r}#${c}`,v=y(u);_(v,a),o.set(u,v)}}return o},mt=(t,o)=>{t.dependsOn=C(o.dependsOn,"vis"),t.inputs=m(o.inputs),t.outputs=m(o.outputs),t.env=R([...o.env??[],...o.passThroughEnv??[],...o.options?.passThroughEnv??[]]),t.cache=o.cache===!1?!1:typeof o.cache=="boolean"?o.cache:void 0},ht=async t=>{const o=new Map,s=await rt(t);for(const[i,r]of Object.entries(s.tasks??{})){const c=`*#${i}`,a=y(c);mt(a,r??{}),o.set(c,a)}const n=s.taskRunner??{},e=y(w);return e.inputs=m(n.globalInputs),e.env=R([...n.globalEnv??[],...n.globalPassThroughEnv??[]]),(e.inputs.length>0||e.env.length>0)&&o.set(w,e),o},yt=(t,o)=>{switch(o){case"moon":return vt(t);case"nx":return lt(t);default:return gt(t)}},kt=t=>{const o=[];return k(f(t,"turbo.json"))&&o.push("turbo"),k(f(t,"nx.json"))&&o.push("nx"),(k(f(t,".moon","tasks.yml"))||k(f(t,".moon","tasks.yaml")))&&o.push("moon"),o.length===1?o[0]:void 0},x=(t,o,s,n,e)=>{const i=n.filter(a=>!e.includes(a)),r=e.filter(a=>!n.includes(a));if(i.length===0&&r.length===0)return;const c=[];i.length>0&&c.push(`dropped [${i.join(", ")}]`),r.length>0&&c.push(`added [${r.join(", ")}]`),t.push({axis:s,detail:`${s} diverged: ${c.join("; ")}`,node:o,severity:i.length>0?"error":"warning"})},wt=(t,o,s)=>{const n=[],e=R([...t.keys(),...o.keys()]);for(const i of e){const r=t.get(i),c=o.get(i);if(r&&!c){const a=s==="turbo"&&i.includes("#")&&!i.startsWith("*#")&&i!==w;n.push({axis:"target-set",detail:a?`source target \`${i}\` was skipped by design (turbo project#task is migrated into per-project project.json — move it there and re-verify)`:`source target \`${i}\` has no equivalent in the migrated vis config`,node:i,severity:a?"warning":"error"});continue}if(!r&&c){n.push({axis:"target-set",detail:`migrated vis config defines \`${i}\` with no source equivalent (extra target — not a regression, but review)`,node:i,severity:"warning"});continue}!r||!c||(x(n,i,"dependsOn",r.dependsOn,c.dependsOn),x(n,i,"inputs",r.inputs,c.inputs),x(n,i,"outputs",r.outputs,c.outputs),x(n,i,"env",r.env,c.env),r.cache!==void 0&&c.cache!==void 0&&r.cache!==c.cache&&n.push({axis:"cache",detail:`cache flag diverged: source=${String(r.cache)} vis=${String(c.cache)} (changes what invalidates the cache)`,node:i,severity:"error"}))}return n.sort((i,r)=>i.node.localeCompare(r.node)||i.axis.localeCompare(r.axis)),{findings:n,source:s,sourceNodeCount:t.size,visNodeCount:o.size}},Rt=new Set(["json","ndjson","table"]),$t=t=>({equivalent:t.findings.every(o=>o.severity!=="error"),findings:t.findings,source:t.source,sourceNodeCount:t.sourceNodeCount,visNodeCount:t.visNodeCount}),bt=(t,o,s)=>{if(o==="json"){process.stdout.write(`${JSON.stringify($t(t),void 0,2)}
2
- `);return}if(o==="ndjson"){for(const n of t.findings)process.stdout.write(`${JSON.stringify(n)}
3
- `);return}if(s.info(`Migration equivalence: ${t.source} → vis`),s.info(` source nodes: ${String(t.sourceNodeCount)} vis nodes: ${String(t.visNodeCount)}`),t.findings.length===0){s.info(" ✓ task graph + cache-key surface preserved (no divergence).");return}for(const n of t.findings){const e=` [${n.severity}] ${n.node} (${n.axis}) — ${n.detail}`;n.severity==="error"?s.warn(e):s.info(e)}},xt=(t,o)=>t.findings.some(s=>o==="warning"?!0:s.severity==="error")?1:0,D=async t=>{if(!T.isTTY)return!0;const o=ct({input:T,output:at});try{const s=(await o.question(`${t} [Y/n] `)).trim().toLowerCase();return s===""||s==="y"||s==="yes"}finally{o.close()}},Ct=[{description:"VisConfig.targetDefaults → VisConfig.tasks",next:"tasks",previous:"targetDefaults"},{description:"VisConfig.taskDefaults → VisConfig.scopedTasks",next:"scopedTasks",previous:"taskDefaults"},{description:"VisConfig.taskRunnerOptions → VisConfig.taskRunner",next:"taskRunner",previous:"taskRunnerOptions"},{description:"ScopedTasksBlock.scope → ScopedTasksBlock.match",next:"match",previous:"scope"},{description:"ScopedTasksBlock.targets → ScopedTasksBlock.tasks",next:"tasks",previous:"targets"}],jt=[{description:"VisTaskConfig.targets → VisTaskConfig.tasks",next:"tasks",previous:"targets"}],Et=t=>new RegExp(String.raw`(^|[\s,{(\[])(["']?)${t}\2(\s*:)`,"gmu"),St=(t,o)=>{let s=t;const n=[];for(const e of o){const i=Et(e.previous);i.test(s)&&(i.lastIndex=0,s=s.replace(i,(r,c,a,u)=>`${c}${a}${e.next}${a}${u}`),n.push(e))}return{applied:n,output:s}},q=(t,o)=>St(t,o),Mt=["vis.config.ts","vis.config.mts","vis.config.cts","vis.config.js","vis.config.mjs","vis.config.cjs"],Ot=new Set(["vis.task.cjs","vis.task.cts","vis.task.js","vis.task.mjs","vis.task.mts","vis.task.ts"]),Tt=t=>{for(const o of Mt){const s=f(t,o);if(k(s))return s}},Nt=t=>{const o=[];try{for(const s of nt(t,{includeDirs:!1,includeFiles:!0,includeSymlinks:!1,skip:[/node_modules/,/\.git/,/\.vis\b/,/dist\b/,/\.next\b/,/\.nuxt\b/]}))Ot.has(it(s.path))&&o.push(s.path)}catch{}return o},_t=(t,o,s,n)=>{const e=Tt(t);if(e){const r=j(e),{applied:c,output:a}=q(r,Ct);if(c.length===0)s.info(`${e} already uses the current schema — no rewrite needed.`);else if(o.dryRun)s.info(`── ${e} (preview) ──`),s.info(a),s.info("── end preview ──"),s.info(`Would apply ${String(c.length)} rename(s): ${c.map(u=>u.description).join(", ")}`);else{M(e,n),O(e,a),s.info(`Rewrote ${e} (backup at ${e}.bak). Applied ${String(c.length)} rename(s).`);for(const u of c)n.manualSteps.push(`Renamed ${u.description} in ${e}`)}}else s.warn("No vis.config.ts found at workspace root — nothing to migrate."),n.warnings.push("No vis.config.{ts,mts,cts,js,mjs,cjs} at workspace root.");const i=o.taskConfigPaths??Nt(t);for(const r of i){if(!k(r))continue;const c=j(r),a=q(c,jt);if(a.applied.length!==0)if(o.dryRun)s.info(`── ${r} (preview) ──`),s.info(a.output),s.info("── end preview ──"),s.info(`Would apply ${String(a.applied.length)} rename(s): ${a.applied.map(u=>u.description).join(", ")}`);else{M(r,n),O(r,a.output),s.info(`Rewrote ${r} (backup at ${r}.bak). Applied ${String(a.applied.length)} rename(s).`);for(const u of a.applied)n.manualSteps.push(`Renamed ${u.description} in ${r}`)}}},g=t=>{const o=t.workspaceRoot??process.cwd(),s=t.visConfig??{};return{config:s,dryRun:!!t.options.dryRun,logger:t.logger,packageManager:ot(o),report:V(),root:o,useEditorconfig:typeof s.editorconfig=="boolean"?s.editorconfig:!0}},d=async(t,o,s)=>{if(o.yes||o.dryRun)return!0;const n=await D(`This will edit files, scripts, and hooks for "${t}". Backups (.bak) will be created. Continue?`);return n||s.info("Aborted."),n},l=t=>{t.dryRun&&t.logger.info(`Running in dry-run mode — no changes will be made.
4
- `)},At=async({logger:t,options:o,visConfig:s,workspaceRoot:n})=>{if(!await d("deps",o,t))return;const e=g({logger:t,options:o,visConfig:s,workspaceRoot:n});l(e),t.info("── Migrating dependencies and scripts ──"),z(e.root,e.packageManager,e.config,{dryRun:e.dryRun},t,e.report),t.info(""),p(e.report,t)},qt=async({logger:t,options:o,visConfig:s,workspaceRoot:n})=>{if(!await d("lint-staged",o,t))return;const e=g({logger:t,options:o,visConfig:s,workspaceRoot:n});l(e),t.info("── Migrating lint-staged ──"),G(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),p(e.report,t)},It=async({logger:t,options:o,visConfig:s,workspaceRoot:n})=>{if(!await d("nano-staged",o,t))return;const e=g({logger:t,options:o,visConfig:s,workspaceRoot:n});l(e),t.info("── Migrating nano-staged ──"),L(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),p(e.report,t)},Vt=async({logger:t,options:o,visConfig:s,workspaceRoot:n})=>{if(!await d("turborepo",o,t))return;const e=g({logger:t,options:o,visConfig:s,workspaceRoot:n});l(e),t.info("── Migrating turborepo ──"),Y(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),p(e.report,t)},Dt=async({logger:t,options:o,visConfig:s,workspaceRoot:n})=>{if(!await d("nx",o,t))return;const e=g({logger:t,options:o,visConfig:s,workspaceRoot:n});l(e),t.info("── Migrating nx ──");const i=!!o.aggressive;Z(e.root,{aggressive:i,dryRun:e.dryRun,force:i||!!o.force,rewriteSyncGenerators:i||!!o.rewriteSyncGenerators,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),p(e.report,t)},Bt=async({logger:t,options:o,visConfig:s,workspaceRoot:n})=>{if(!await d("moon",o,t))return;const e=g({logger:t,options:o,visConfig:s,workspaceRoot:n});l(e),t.info("── Migrating moon ──"),H(e.root,{copyTemplates:!!o.copyTemplates,dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),p(e.report,t)},Jt=async({logger:t,options:o,visConfig:s,workspaceRoot:n})=>{if(!await d("gitleaks",o,t))return;const e=g({logger:t,options:o,visConfig:s,workspaceRoot:n});l(e),t.info("── Migrating gitleaks ──"),K(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),p(e.report,t)},Wt=async({logger:t,options:o,visConfig:s,workspaceRoot:n})=>{if(!await d("kingfisher",o,t))return;const e=g({logger:t,options:o,visConfig:s,workspaceRoot:n});l(e),t.info("── Migrating Kingfisher ──"),Q(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),p(e.report,t)},Ft=async({logger:t,options:o,visConfig:s,workspaceRoot:n})=>{if(!await d("secretlint",o,t))return;const e=g({logger:t,options:o,visConfig:s,workspaceRoot:n});l(e),t.info("── Migrating secretlint ──"),U(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),p(e.report,t)},Pt=async({logger:t,options:o,visConfig:s,workspaceRoot:n})=>{if(!await d("syncpack",o,t))return;const e=g({logger:t,options:o,visConfig:s,workspaceRoot:n});l(e),t.info("── Migrating syncpack ──"),X(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),p(e.report,t)},zt=async({logger:t,options:o,visConfig:s,workspaceRoot:n})=>{if(!await d("sherif",o,t))return;const e=g({logger:t,options:o,visConfig:s,workspaceRoot:n});l(e),t.info("── Migrating sherif ──"),tt(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),p(e.report,t)},Gt=async({logger:t,options:o,visConfig:s,workspaceRoot:n})=>{if(!await d("self",o,t))return;const e=g({logger:t,options:o,visConfig:s,workspaceRoot:n});l(e),t.info("── Migrating vis.config.ts to current schema ──"),_t(e.root,{dryRun:e.dryRun},t,e.report),t.info(""),p(e.report,t)},Lt=({logger:t,workspaceRoot:o})=>{const s=o??process.cwd();ut(s,t).length>0&&(process.exitCode=1)},Yt=async({logger:t,options:o,workspaceRoot:s})=>{const n=s??process.cwd(),e=o.format??"table";if(!Rt.has(e)){t.warn(`Invalid --format: ${String(o.format)}. Expected table | json | ndjson.`),process.exitCode=1;return}const i=o.failOn==="warning"?"warning":"error";let r;if(o.from){if(o.from!=="turbo"&&o.from!=="nx"&&o.from!=="moon"){t.warn(`Invalid --from: ${o.from}. Expected turbo | nx | moon.`),process.exitCode=1;return}r=o.from}else if(r=kt(n),!r){t.warn("Could not auto-detect the source tool (need exactly one of turbo.json / nx.json / .moon/tasks.yml). Pass --from <turbo|nx|moon>."),process.exitCode=1;return}const c=yt(n,r);if(c.size===0){t.warn(`No ${r} task graph found at ${n} — nothing to verify.`),process.exitCode=1;return}const a=await ht(n);if(a.size===0){t.warn("No migrated vis task graph found (vis.config.ts has no tasks). Run the migrator first."),process.exitCode=1;return}const u=wt(c,a,r);bt(u,e,t),process.exitCode=xt(u,i)},Zt=async({logger:t,options:o,visConfig:s,workspaceRoot:n})=>{const e=n??process.cwd(),i=F(e,s??{}),r=P(i);if(r.length===0){t.info("No applicable migrations detected in this workspace.");return}const c=!!o.dryRun;t.info(`Detected ${String(r.length)} migration(s):`);for(const v of r)t.info(` • ${v.title} — ${v.description}`);if(t.info(""),!o.yes&&!c&&!await D("Apply all detected migrations? Backups (.bak) will be created.")){t.info("Aborted.");return}c&&t.info(`Running in dry-run mode — no changes will be made.
5
- `);const a=V(),u=[];for(const v of r)try{if(t.info(`── Applying ${v.title} ──`),c)for(const b of v.probe(i))t.info(b);else v.apply(i,a,t);t.info("")}catch(b){u.push({error:b,id:v.id}),t.warn(`Failed to apply ${v.title}: ${b.message}`)}p(a,t),u.length>0&&(t.warn(""),t.warn(`${String(u.length)} migration(s) failed — see messages above.`),process.exitCode=1)},to=At,oo=qt,eo=It,so=Vt,no=Dt,io=Bt,ro=Jt,ao=Wt,co=Ft,uo=Pt,po=zt,fo=Gt,go=Lt,lo=Yt,vo=Zt;export{vo as migrateAllExecute,to as migrateDepsExecute,ro as migrateGitleaksExecute,ao as migrateKingfisherExecute,oo as migrateLintStagedExecute,io as migrateMoonExecute,eo as migrateNanoStagedExecute,no as migrateNxExecute,co as migrateSecretlintExecute,fo as migrateSelfExecute,po as migrateSherifExecute,uo as migrateSyncpackExecute,so as migrateTurborepoExecute,go as migrateVerifyExecute,lo as migrateVerifyGraphExecute};
1
+ const i=`
2
+ 🔧 vis release CI setup
3
+
4
+ 1. Workflow permissions
5
+ Add to .github/workflows/vis-release.yml:
6
+ permissions:
7
+ contents: write
8
+ pull-requests: write
9
+ id-token: write # required for OIDC trusted publishing on npm
10
+
11
+ 2. Secrets
12
+ Required:
13
+ - VIS_GH_TOKEN — PAT or GitHub App token. Used to force-push the
14
+ version-PR branch and create/edit the version PR. The default
15
+ \${{ github.token }} is anti-recursion-locked and cannot trigger
16
+ downstream workflows on the version-PR.
17
+ - GH_TOKEN — \${{ github.token }} works for read-only / commenting.
18
+ Optional:
19
+ - NPM_TOKEN — fallback when OIDC is not available. Trusted Publishing
20
+ (id-token: write) is preferred.
21
+
22
+ 3. Trusted Publishing on npm
23
+ For each published package:
24
+ a. https://npmjs.com/package/<name>/access → Publishing access
25
+ b. Add a Trusted Publisher with provider=GitHub Actions
26
+ c. Repository: visulima/visulima
27
+ d. Workflow filename: vis-release.yml
28
+ e. Environment name: (leave blank unless you use one)
29
+
30
+ 4. Concurrency group (recommended)
31
+ concurrency:
32
+ group: vis-release-\${{ github.ref }}
33
+ cancel-in-progress: false
34
+
35
+ 5. Husky pre-commit gate (optional)
36
+ Add to .husky/pre-commit:
37
+ vis release check --hook pre-commit --no-fail
38
+ (Or run \`vis release init\` and confirm the prompt — it'll auto-wire
39
+ the hook if you say yes.)
40
+
41
+ 📚 RFC: packages/tooling/vis/rfc/design-release-manager.md (§16)
42
+ `,o=async({logger:e})=>{e.info(i)};export{o as default};
@@ -1,11 +1,8 @@
1
- import{createRequire as K}from"node:module";import{j as b,E as m,q as k,I as N,V as U,s as P}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{m as h,a as J,A,f as W}from"../packem_shared/index-BDmTbWX1.js";import{j as z,n as I,b as T,O as G}from"./bin.js";import{d as X}from"../packem_shared/lockfile-C8Q1_4KK.js";import{p as Q,s as Z}from"../packem_shared/docker-tNrDU3oK.js";const Y=K(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[o,t]=g.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return g.getBuiltinModule(e)}return Y(e)},{createInterface:_}=y("node:readline"),{spawn:ee}=y("node:child_process"),{createHash:oe}=y("node:crypto"),{existsSync:L,writeFileSync:te,chmodSync:ne}=y("node:fs"),D={aube:{base:["RUN corepack enable"],build:e=>e?`RUN aube run --filter ${e} build`:"RUN aube run build",install:"RUN aube install --frozen-lockfile"},bun:{base:["RUN npm install -g bun"],build:e=>e?`RUN bun run --filter ${e} build`:"RUN bun run build",install:"RUN --mount=type=cache,target=/root/.bun/install/cache bun install --frozen-lockfile"},npm:{base:[],build:e=>e?`RUN npm run build --workspace ${e}`:"RUN npm run build",install:"RUN --mount=type=cache,target=/root/.npm npm ci"},pnpm:{base:["ENV PNPM_HOME=/pnpm","ENV PATH=$PNPM_HOME:$PATH","RUN corepack enable"],build:e=>e?`RUN pnpm --filter ${e} build`:"RUN pnpm build",install:"RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile"},yarn:{base:["RUN corepack enable"],build:e=>e?`RUN yarn workspace ${e} build`:"RUN yarn build",install:"RUN --mount=type=cache,target=/usr/local/share/.cache/yarn yarn install --immutable"}},re=e=>{const{focus:o,manager:t,nodeVersion:r}=e,n=D[t]??D.npm;return["# syntax=docker/dockerfile:1","","# Generated by 'vis docker init'. Before building, scaffold the context:",`# vis docker scaffold${o?` --focus=${o}`:""} --include-sources`,"# then build with BuildKit enabled (DOCKER_BUILDKIT=1).","",`FROM node:${r}-slim AS base`,"WORKDIR /app",...n.base,"","# --- install dependencies from the scaffolded manifests only ---","FROM base AS deps","COPY .vis/docker/workspace/ ./",n.install,"","# --- build the focus project, then drop unfocused workspace projects ---","FROM deps AS build","COPY .vis/docker/sources/ ./",n.build(o),"RUN npx vis docker prune --context=.vis/docker","","# --- minimal runtime image ---",`FROM node:${r}-slim AS runtime`,"WORKDIR /app","ENV NODE_ENV=production","COPY --from=build /app ./","USER node","# TODO: point this at your app's entrypoint",'CMD ["node", "index.js"]',""].join(`
2
- `)},$="v2.14.0",S=`https://github.com/hadolint/hadolint/releases/download/${$}`,se={"hadolint-linux-arm64":"331f1d3511b84a4f1e3d18d52fec284723e4019552f4f47b19322a53ce9a40ed","hadolint-linux-x86_64":"6bf226944684f56c84dd014e8b979d27425c0148f61b3bd99bcc6f39e9dc5a47","hadolint-macos-arm64":"3625e2e9f43dcfe7bd38738a5f5520ed50ce39ed28485266e6803dd7bc197b10","hadolint-macos-x86_64":"2b69a853433f1eca522ffb921cd490bd1321424d03331fd8390f93b7fb4a02e9","hadolint-windows-x86_64.exe":"8e0ee174f88edb14f207a68430c7a53c2883ed509cdbde9a3a26fffa140fa5e4"},ie=e=>se[e],ae=(e=process.platform,o=process.arch)=>{const t=e==="darwin"?"macos":e==="linux"?"linux":e==="win32"?"windows":void 0;if(t===void 0)return;const r=o==="arm64"?"arm64":o==="x64"?"x86_64":void 0;if(t==="windows")return"hadolint-windows-x86_64.exe";if(r!==void 0)return`hadolint-${t}-${r}`},H=e=>h(I(),"hadolint",$,e.endsWith(".exe")?"hadolint.exe":"hadolint"),ce=()=>{const e=process.platform==="win32"?"hadolint.exe":"hadolint",o=(process.env.PATH??"").split(process.platform==="win32"?";":":");for(const t of o)if(t!==""&&L(h(t,e)))return e},le=e=>e.trim().split(/\s+/u)[0]??"",C=async e=>{const o=await fetch(e,{redirect:"follow"});if(!o.ok)throw new Error(`download failed (${String(o.status)} ${o.statusText}) for ${e}`);return Buffer.from(await o.arrayBuffer())},de=async e=>{const o=H(e),t=ie(e),r=await C(`${S}/${e}`),n=oe("sha256").update(r).digest("hex");if(t===void 0){const s=await C(`${S}/${e}.sha256`),i=le(s.toString("utf8")).toLowerCase();if(i==="")throw new Error("hadolint checksum sidecar was empty or unparseable. Refusing to use the download.");if(i!==n)throw new Error(`hadolint checksum mismatch (expected ${i}, got ${n}). Refusing to use the download.`)}else if(t.toLowerCase()!==n)throw new Error(`hadolint checksum mismatch (expected ${t.toLowerCase()}, got ${n}). Refusing to use the download.`);return J(h(I(),"hadolint",$)),te(o,r),process.platform!=="win32"&&ne(o,493),o},ue=async()=>{const e=_({input:process.stdin,output:process.stderr}),o=await new Promise(t=>{e.question(` Download hadolint ${k($)} now? ${m("[y/N]")} `,r=>{t(r.trim().toLowerCase())})});return e.close(),o==="y"||o==="yes"},fe=async e=>{const{autoInstall:o=!1,log:t}=e,r=ce();if(r!==void 0)return r;const n=ae();if(n===void 0){t(`hadolint has no prebuilt binary for ${process.platform}/${process.arch}. Install it manually: https://github.com/hadolint/hadolint`);return}const s=H(n);if(L(s))return s;if(!o){if(!(process.stdin.isTTY&&!z)){t(`hadolint is not installed. Re-run with ${b("--install")} (or install hadolint on PATH) to enable Dockerfile linting.`);return}if(t(`${b("hadolint")} is required to lint Dockerfiles but was not found on your PATH.`),!await ue()){t(`Skipped. Install it yourself or re-run with ${b("--install")}.`);return}}t(`Downloading hadolint ${$} (${n})…`);try{const i=await de(n);return t(`Installed hadolint to ${m(i)}`),i}catch(i){t(`Failed to download hadolint: ${i.message}`);return}},O=async(e,o,t)=>{if(o.length===0)return[];const r=["--format","json","--no-fail",...t!==void 0&&t!==""?["--config",t]:[],...o],n=await new Promise((i,l)=>{const a=ee(e,r,{stdio:["ignore","pipe","pipe"],windowsHide:!0});let d="",u="";a.stdout?.on("data",c=>{d+=c.toString("utf8")}),a.stderr?.on("data",c=>{u+=c.toString("utf8")}),a.on("error",l),a.on("close",()=>{if(d.trim()===""&&u.trim()!==""){l(new Error(u.trim()));return}i(d)})});if(n.trim()==="")return[];let s;try{s=JSON.parse(n)}catch{throw new Error("Could not parse hadolint JSON output.")}return Array.isArray(s)?s:[]},j=(e,o,t)=>{if(!(!/\bapt-get\b/u.test(e)||!/\binstall\b/u.test(e)||t.test(e)))return e.replace(/\binstall\b/u,`install ${o}`)},R={DL3014:e=>j(e,"-y",/(?:^|\s)(?:-y|--yes|--assume-yes|-qq?)\b/u),DL3015:e=>j(e,"--no-install-recommends",/--no-install-recommends\b/u),DL3020:e=>/^\s*ADD\b/u.test(e)?e.replace(/^(\s*)ADD\b/u,"$1COPY"):void 0,DL3027:e=>/(?:^|\s)apt\s/u.test(e)&&!/\bapt-get\b/u.test(e)?e.replace(/(^|\s)apt(\s)/u,"$1apt-get$2"):void 0},M=new Set(Object.keys(R)),pe=(e,o)=>{const t=e.includes(`\r
3
- `)?`\r
4
- `:`
5
- `,r=e.split(/\r?\n/u),n=new Set;let s=0;const i=new Map;for(const l of o){if(!R[l.code])continue;const a=i.get(l.line)??[];a.push(l),i.set(l.line,a)}for(const[l,a]of i){const d=l-1;if(!(d<0||d>=r.length))for(const u of a){const c=R[u.code],f=c?.(r[d]??"");f!==void 0&&f!==r[d]&&(r[d]=f,n.add(u.code),s+=1)}}return{content:s>0?r.join(t):e,fixedCodes:[...n],fixedCount:s}},E={error:0,info:2,style:3,warning:1},me=(e,o)=>{switch(e){case"error":return U(o);case"info":return k(o);case"warning":return P(o);default:return m(o)}},he=(e,o)=>(e.length>0?e:["Dockerfile"]).map(t=>A(t)?t:h(o,t)).filter(t=>W(t)),we=(e,o)=>{const t=[...e].sort((n,s)=>n.file.localeCompare(s.file)||n.line-s.line||n.column-s.column||E[n.level]-E[s.level]);let r="";for(const n of t){n.file!==r&&(r=n.file,o.info(`
6
- ${b(r)}`));const s=m(`${String(n.line)}:${String(n.column)}`),i=me(n.level,n.level.padEnd(7)),l=M.has(n.code)?m(" (fixable)"):"";o.info(` ${s} ${i} ${k(n.code)} ${n.message}${l}`)}},ge=e=>{const o={error:0,info:0,style:0,warning:0};for(const t of e)o[t.level]+=1;return o},be=async e=>{const{autoInstall:o,configPath:t,cwd:r,files:n,fix:s,fs:i,json:l,logger:a}=e,d=he(n,r);if(d.length===0)return a.error(`No Dockerfile found${n.length>0?` at: ${n.join(", ")}`:` in ${r}`}. Pass a path: vis docker lint <path>`),1;const u=await fe({autoInstall:o,log:p=>{a.info(p)}});if(u===void 0)return 0;let c=await O(u,d,t),f=0;if(s&&c.length>0){for(const p of d){const F=c.filter(V=>V.file===p),q=await i.readFile(p,"utf8"),x=pe(q,F);x.fixedCount>0&&(await i.writeFile(p,x.content),f+=x.fixedCount)}f>0&&(c=await O(u,d,t))}if(l)return process.stdout.write(`${JSON.stringify({findings:c,fixed:f},null,2)}
7
- `),c.some(p=>p.level==="error")?1:0;if(s&&f>0&&a.info(N(`✔ Auto-fixed ${String(f)} issue${f===1?"":"s"}.`)),c.length===0)return a.info(N("✔ No Dockerfile issues found.")),0;we(c,a);const w=ge(c),v=c.filter(p=>M.has(p.code)).length;return a.info(`
8
- ${b(String(c.length))} issue${c.length===1?"":"s"}: ${U(`${String(w.error)} error`)}, ${P(`${String(w.warning)} warning`)}, ${k(`${String(w.info)} info`)}, ${m(`${String(w.style)} style`)}`),!s&&v>0&&a.info(m(`Run 'vis docker lint --fix' to auto-fix ${String(v)} of them.`)),w.error>0?1:0},B=e=>{if(!e)throw new Error("Could not determine workspace root. Run inside a monorepo.");return e},Se=async({logger:e,options:o,visConfig:t,workspaceRoot:r})=>{const n=B(r),{packageJsons:s,workspace:i}=T(n,t),l=G(n,i,s),a=(o.focus??"").split(",").map(c=>c.trim()).filter(Boolean);if(a.length===0)throw new Error("Missing --focus. Pass one or more project names, comma-separated.");const d=h(n,o.out??".vis/docker"),{projects:u}=Z({focus:a,includeSources:!!o.includeSources,log:c=>{e.info(c)},outDir:d,projectGraph:l,pruneLockfile:o.pruneLockfile!==!1,workspace:i,workspaceRoot:n});e.info(`Scaffolded ${u.length} project(s) into ${d}`),e.info(`Focus closure: ${u.toSorted().join(", ")}`)},Ce=async({logger:e,options:o,visConfig:t,workspaceRoot:r})=>{const n=B(r),{workspace:s}=T(n,t),i=h(n,o.context??".vis/docker"),{removed:l}=Q({contextRoot:i,workspace:s,workspaceRoot:n});e.info(`Pruned ${l.length} unfocused project(s)`),l.length>0&&e.debug?.(l.join(`
9
- `))},Oe=async({argument:e,fs:o,logger:t,options:r,process:n,workspaceRoot:s})=>{const i=await be({autoInstall:!!r.install,configPath:r.config,cwd:s??n.cwd,files:e.filter(Boolean),fix:!!r.fix,fs:o,json:!!r.json,logger:t});i!==0&&(process.exitCode=i)},$e=async(e,o)=>{try{return await e.access(o),!0}catch{return!1}},ye=async e=>{const o=_({input:process.stdin,output:process.stderr}),t=await new Promise(r=>{o.question(` ${e} already exists. Overwrite? ${m("[y/N]")} `,n=>{r(n.trim().toLowerCase())})});return o.close(),t==="y"||t==="yes"},je=async({argument:e,fs:o,logger:t,options:r,process:n,workspaceRoot:s})=>{const i=s??n.cwd,l=e[0]??"Dockerfile",a=A(l)?l:h(i,l),d=X(i)?.manager??"npm",u=(r.focus??"").split(",").map(f=>f.trim()).find(Boolean),c=re({focus:u,manager:d,nodeVersion:r.node??"22"});if(r.dryRun){process.stdout.write(c.endsWith(`
10
- `)?c:`${c}
11
- `);return}if(await $e(o,a)&&!r.force){if(!process.stdin.isTTY){t.error(`${a} already exists. Re-run with --force to overwrite.`),process.exitCode=1;return}if(!await ye(a)){t.info("Aborted — existing Dockerfile left untouched.");return}}await o.writeFile(a,c),t.info(`Created ${a} (package manager: ${d}).`),t.info(m(`Next: vis docker scaffold${u?` --focus=${u}`:""} --include-sources, then DOCKER_BUILDKIT=1 docker build .`))};export{je as initExecute,Oe as lintExecute,Ce as pruneExecute,Se as scaffoldExecute};
1
+ import{b as g}from"./orchestrator.js";import{detectRemoteProvider as h,createRemoteClient as $}from"./detect2.js";import{createShellRunner as w}from"./shell-runner.js";import{runSnapshot as R}from"./snapshot.js";const y=(r,o)=>{if(r.length===0)return"_No packages were affected by this PR._";const n=["### 📦 Preview Packages",""];for(const e of r){const t=`${e.name}@${e.version}`;n.push(`- \`${e.name}\` \`${e.version}\``),o?n.push(` \`\`\`sh
2
+ npm i ${t} --registry ${o}
3
+ \`\`\``):n.push(` \`\`\`sh
4
+ npm i ${t}
5
+ \`\`\``)}return n.join(`
6
+ `)},S=async({logger:r,options:o,workspaceRoot:n})=>{const e=n??process.cwd(),t=w(),l=await h(e,t),a=$(l),s=a.detectPullRequestNumber(process.env),p=o.tag??(s?`pr-${s}`:void 0);if(!p){r.error("Could not determine snapshot tag. Pass --tag or run in a PR context (GITHUB_REF=refs/pull/<n>/merge)."),process.exitCode=1;return}if(o.onClose){await C(e,t,a,s,r);return}let c,u;try{c=await g({cwd:e});const{printConfigIfRequested:i}=await import("./print-config.js");if(i(o,c,r))return;u=await R({context:c,runner:t,tag:p})}catch(i){r.error(`Snapshot failed: ${i.message}`),process.exitCode=1;return}if(r.info(`Snapshotted ${u.published.length} package(s) at version ${u.snapshotVersion} tag "${u.tag}"`),!s)return;const d=await a.detectRepoSlug(e,t);if(!d){r.warn("Could not detect repo slug — skipping sticky PR comment.");return}const m="<!-- vis-release-snapshot-comment -->",f=`${m}
7
+
8
+ ${y(u.published,c.config.snapshot?.registry)}`;try{const i=await a.upsertStickyComment(t,{body:f,cwd:e,issueNumber:s,marker:m,repo:d});i&&r.info(`${i.created?"Posted":"Updated"} snapshot comment on PR #${s}.`)}catch(i){r.warn(`upsertStickyComment failed (publish already succeeded): ${i.message}`)}},C=async(r,o,n,e,t)=>{if(!e){t.error("PR-close cleanup requires a PR context."),process.exitCode=1;return}const l=await n.detectRepoSlug(r,o);if(!l){t.warn("Could not detect repo slug skipping cleanup.");return}const a=await o.run("gh",["api",`repos/${l}/pulls/${e}/commits`,"--paginate"],{cwd:r,silent:!0});if(a.exitCode!==0){t.warn(`gh api failed: ${a.stderr}`);return}let s;try{s=JSON.parse(a.stdout)}catch{t.warn("Could not parse gh api output.");return}const p=[`pr-${e}`];for(const c of s)p.push(c.sha,c.sha.slice(0,7));t.info(`Cleanup intent for PR #${e}: ${p.length} tag pattern(s) across ${s.length} commit(s)`),t.info("Default backend (pkg-pr-new) auto-cleans by TTL — no DELETE issued. Implement a custom backend's delete endpoint to enable real cleanup.")};export{S as default};
@@ -1,3 +1,9 @@
1
- import{createRequire as G}from"node:module";import{I as F,q as L,j as N,E as O}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{y as P}from"../packem_shared/index-BDmTbWX1.js";import{aJ as h,aK as U}from"./bin.js";import{d as A,f as C,r as D,a as Q,b as X,s as Y,c as Z,e as ee,g as te,h as se,i as ie,j as re,k as ne,l as oe,m as ae,n as de,o as ce,p as fe,q as le,t as pe}from"../packem_shared/watch-loop-DWkvv2tK.js";const H=G(import.meta.url),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=t=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[e,s]=k.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return k.getBuiltinModule(t)}return H(t)},{createHash:q}=I("node:crypto"),ue=t=>t.startsWith("/")||/^[a-z]:[\\/]/i.test(t),_=(t,e)=>ue(e)?e:`${t}/${e}`,ge={argsCheck:(t,e)=>T(t,e,"check"),argsFix:(t,e)=>T(t,e,"fix"),bin:()=>["pnpm","exec","dprint"],cacheKey:(t,e)=>{const s=["dprint",t.declaredVersion??"unknown",t.configFile??"no-config",e.quiet?"q":"",...e.extraArgs??[]];return q("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:(t,e)=>{const s=A(e,h.dprint.packageNames[0]),i=C(t,h.dprint.configFiles);if(!(!s&&!i))return{adapter:"dprint",configFile:i,declared:!!s,declaredVersion:s,root:t}},extensions:["cjs","css","cts","dockerfile","html","js","json","jsonc","jsx","md","mdx","mjs","mts","toml","ts","tsx","yaml","yml"],id:"dprint",kind:"fmt",parse:(t,e)=>{if(t.exitCode===0)return[];const s=[];for(const i of t.stdout.split(/\r?\n/)){const r=i.trim();!r||r.startsWith("[")||r.startsWith("Checked ")||r.startsWith("Error:")||s.push({adapter:"dprint",file:_(e.root,r),fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"})}return s}},T=(t,e,s)=>{const i=s==="fix"?["fmt"]:["check","--list-different"];return e.extraArgs?.length&&i.push(...e.extraArgs),i.push(...t),i},me={argsCheck:(t,e)=>B(t,e,"check"),argsFix:(t,e)=>B(t,e,"fix"),bin:()=>["pnpm","exec","oxfmt"],cacheKey:(t,e)=>{const s=["oxfmt",t.declaredVersion??"unknown",t.configFile??"no-config",e.quiet?"q":"",...e.extraArgs??[]];return q("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:(t,e)=>{const s=A(e,h.oxfmt.packageNames[0]),i=C(t,h.oxfmt.configFiles);if(!(!s&&!i))return{adapter:"oxfmt",configFile:i,declared:!!s,declaredVersion:s,root:t}},extensions:["cjs","cts","js","json","jsonc","jsx","mjs","mts","ts","tsx"],id:"oxfmt",kind:"fmt",parse:(t,e)=>{if(t.exitCode===0)return[];const s=[];for(const i of t.stdout.split(/\r?\n/)){const r=i.trim();!r||r.startsWith("[")||s.push({adapter:"oxfmt",file:_(e.root,r),fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"})}return s}},B=(t,e,s)=>{const i=s==="fix"?["--write"]:["--list-different"];return e.extraArgs?.length&&i.push(...e.extraArgs),i.push(...t),i},he={argsCheck:(t,e)=>K(t,e,"check"),argsFix:(t,e)=>K(t,e,"fix"),bin:()=>["pnpm","exec","prettier"],cacheKey:(t,e)=>{const s=["prettier",t.declaredVersion??"unknown",t.configFile??"no-config",e.quiet?"q":"",...e.extraArgs??[]];return q("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:(t,e)=>{const s=A(e,h.prettier.packageNames[0]),i=C(t,h.prettier.configFiles);if(!(!s&&!i))return{adapter:"prettier",configFile:i,declared:!!s,declaredVersion:s,root:t}},extensions:["cjs","css","cts","html","js","json","jsx","less","md","mdx","mjs","mts","scss","ts","tsx","vue","yaml","yml"],id:"prettier",kind:"fmt",parse:(t,e)=>{if(t.exitCode===0)return[];const s=[];for(const i of t.stdout.split(/\r?\n/)){const r=i.trim();r&&(r.startsWith("[")||s.push({adapter:"prettier",file:_(e.root,r),fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"}))}return s}},K=(t,e,s)=>{const i=s==="fix"?["--write"]:["--list-different"];return e.quiet&&i.push("--log-level","warn"),e.extraArgs?.length&&i.push(...e.extraArgs),i.push(...t),i},xe=[me,de,ge,he,ce,fe],Ce=async({logger:t,options:e,visConfig:s,workspaceRoot:i})=>{const r=i??process.cwd(),u=s?.fmt,w=D(xe,u?.order),E=Q(r,w),x=X(E,w,"fmt").filter(({adapter:l})=>u?.adapters?.[l.id]?.enabled!==!1);if(x.length===0){t.warn("vis fmt: no formatter detected in this workspace (looked for: oxfmt, biome, dprint, prettier, ruff, deno-fmt).");return}const $=l=>{const o=u?.adapters?.[l]?.extraArgs;return o&&o.length>0?[...o]:void 0},j={quiet:e.quiet??!1},R=ke(e),y=e.check?"check":"fix";let d;if(e.staged){if(d=Y(r),d===void 0)t.warn("vis fmt: could not resolve --staged (not a git repo or git unavailable). Falling back to a workspace-wide run.");else if(d.length===0){t.info(F("✓ fmt: no staged files"));return}}else if(typeof e.since=="string"&&e.since.length>0){if(d=Z(r,e.since),d===void 0)t.warn(`vis fmt: could not resolve --since ${e.since} (not a git repo or unknown ref). Falling back to a workspace-wide run.`);else if(d.length===0){t.info(F(`✓ fmt: no files changed since ${e.since}`));return}}const J=U(r,void 0,void 0,!0),v=e.format??"human";v==="human"&&e.output!==void 0&&t.warn("vis fmt: --output is ignored for the human format; pass --format json|minimal|sarif|junit|github to redirect findings to a file.");const M=async l=>{const o=R.length>0?R:l,g=[];if(o){const n=te(o,x,u?.extensionOverrides);for(const{adapter:a,presence:c}of x){const f=n.get(a.id);if(!f||f.length===0)continue;const W=$(a.id),V={adapter:a,files:f,presence:c};W&&(V.options={...j,extraArgs:W}),g.push(V)}}else for(const{adapter:n,presence:a}of x){const c=$(n.id),f={adapter:n,files:["."],presence:a};c&&(f.options={...j,extraArgs:c}),g.push(f)}if(g.length===0)return;const z=await se(g,j,y,{cacheRoot:J}),b=g.map((n,a)=>{const c=z[a],f=n.adapter.parse(c,n.presence);return{adapter:n.adapter,durationMs:c.durationMs,exitCode:c.exitCode,findings:f}}),p=ie(b.map(n=>({adapter:n.adapter.id,durationMs:n.durationMs,exitCode:n.exitCode,findingCount:n.findings.length,findings:n.findings}))),m=v==="human"?void 0:re({cwd:r,target:e.output});try{switch(v){case"github":{m.write(ae({runs:b.map(n=>({findings:n.findings})),workspaceRoot:r}));break}case"json":{m.write(`${JSON.stringify({findings:p.findings,mode:y,runs:p.runs},null,2)}
2
- `);break}case"junit":{m.write(oe({runs:b.map(n=>({adapter:n.adapter.id,durationMs:n.durationMs,findings:n.findings})),workspaceRoot:r}));break}case"minimal":{ye(p.findings,r,m);break}case"sarif":{m.write(ne({runs:b.map(n=>({adapter:n.adapter.id,findings:n.findings,presence:g.find(a=>a.adapter.id===n.adapter.id)?.presence})),workspaceRoot:r}));break}default:we(p.findings,r,y,t)}}finally{m?.close()}const S=y==="fix"?p.hadProcessFailure?1:0:pe({...p,maxSeverity:p.findings.length>0?"error":void 0});S!==0&&(process.exitCode=S)};if(e.watch){const l=[...new Set(x.flatMap(({adapter:o})=>o.extensions))];await ee({extensions:l,initialFiles:d,label:"fmt",log:o=>{t.info(o)},runCycle:M,workspaceRoot:r});return}await M(d)},ke=t=>{const e=t;return[...e._??e.args??[]]},we=(t,e,s,i)=>{if(t.length===0){i.info(F(s==="fix"?"✓ fmt: nothing to change":"✓ fmt: all files already formatted"));return}const r=le(t),u=s==="fix"?L(N("Formatted:")):N("Would change:");i.info(u);for(const w of r.keys())i.info(` ${O("·")} ${P(e,w)}`);s==="check"&&(i.info(""),i.info(O(`Run \`vis fmt\` to apply changes (${String(r.size)} file${r.size===1?"":"s"}).`)))},ye=(t,e,s)=>{for(const i of t)s.write(`${i.adapter} ${P(e,i.file)}
3
- `)};export{Ce as default};
1
+ import{b as j}from"./orchestrator.js";const A=async({logger:u,options:m,workspaceRoot:h})=>{const c=h??process.cwd(),a=[];let n;try{n=await j({cwd:c}),a.push({message:"vis.config.ts loaded; release block parsed.",name:"config-loads",severity:"error",status:"pass"})}catch(e){a.push({message:`Config failed to load: ${e.message}`,name:"config-loads",severity:"error",status:"fail"}),await $(u,m,a),process.exitCode=1;return}n.packages.length===0?a.push({message:"No packages discovered. Ensure your package manager's workspace block resolves.",name:"workspace-discovered",severity:"error",status:"fail"}):a.push({message:`Discovered ${n.packages.length} workspace package(s).`,name:"workspace-discovered",severity:"info",status:"pass"});try{const e=await n.pm.detectVersion(c);e?a.push({message:`${n.pm.id}@${e} (min required: ${n.pm.minVersion})`,name:"pm-version",severity:"info",status:"pass"}):a.push({message:`Could not detect ${n.pm.id} version.`,name:"pm-version",severity:"warn",status:"skip"})}catch(e){a.push({message:`Skipped: ${e.message}`,name:"pm-version",severity:"warn",status:"skip"})}n.branch&&n.channel?a.push({message:`Branch "${n.branch}" → channel ${n.channel.tag}${n.channel.prerelease?` (preid: ${n.channel.prerelease})`:""}, mode: ${n.channel.mode}`,name:"branch-channel",severity:"info",status:"pass"}):n.branch&&!n.channel?a.push({message:`Branch "${n.branch}" does not match any configured channel. Releases will use dist-tag "latest" by default.`,name:"branch-channel",severity:"warn",status:"fail"}):a.push({message:"No branch detected (detached HEAD or non-git workspace).",name:"branch-channel",severity:"warn",status:"skip"});try{await import("node:child_process").then(({execSync:e})=>{try{return e("gh --version",{stdio:"ignore"}),!0}catch{return!1}})?a.push({message:"gh CLI is on PATH.",name:"gh-cli-available",severity:"info",status:"pass"}):a.push({message:"gh CLI not found. GH releases / PR comments will be skipped.",name:"gh-cli-available",severity:"warn",status:"fail"})}catch{}if(process.env.CI==="true"||process.env.GITHUB_ACTIONS==="true")try{const{createShellRunner:e}=await import("./shell-runner.js"),i=await e().run("gh",["auth","status","--show-token"],{cwd:c,silent:!0}),t=`${i.stdout}
2
+ ${i.stderr}`,s=/Token scopes:\s*(.+)/.exec(t);if(i.exitCode!==0||!s)a.push({message:"Skipped: `gh auth status` did not return a parseable Token scopes line. (Fine-grained tokens / OIDC-only auth fall in this bucket.)",name:"github.token-scopes",severity:"info",status:"skip"});else{const r=s[1].split(",").map(l=>l.trim().replaceAll(/^['"]|['"]$/g,"")).filter(Boolean),o=new Set(["admin:org","admin:repo_hook","delete_repo","repo","site_admin"]),g=r.filter(l=>o.has(l));g.length>0?a.push({message:`Token carries broader scopes than vis needs: ${g.join(", ")}. The release flow needs only contents:write + pull-requests:write (+ optional id-token:write for OIDC). Consider provisioning a fine-grained PAT or scoping the workflow's permissions block.`,name:"github.token-scopes",severity:"warn",status:"fail"}):a.push({message:`Token scopes look appropriately narrow: ${r.join(", ")||"(none)"}.`,name:"github.token-scopes",severity:"info",status:"pass"})}}catch{a.push({message:"Skipped: gh auth status could not be invoked.",name:"github.token-scopes",severity:"info",status:"skip"})}(process.env.CI==="true"||process.env.GITHUB_ACTIONS==="true")&&(process.env.ACTIONS_ID_TOKEN_REQUEST_URL?a.push({message:"GitHub Actions OIDC env vars present.",name:"oidc-available",severity:"info",status:"pass"}):process.env.NPM_TOKEN?a.push({message:"OIDC env vars missing; falling back to NPM_TOKEN. Add `permissions: { id-token: write }` to the workflow to enable trusted publishing.",name:"oidc-available",severity:"warn",status:"fail"}):a.push({message:"Neither OIDC env vars nor NPM_TOKEN are set in CI. Publish will fail.",name:"oidc-available",severity:"error",status:"fail"}));const y=await import("node:fs/promises"),b=await import("node:path");for(const e of n.packages){if(e.manifest.napi===void 0)continue;const i=b.join(e.dir,"npm");try{const t=(await y.readdir(i,{withFileTypes:!0})).filter(g=>g.isDirectory());if(t.length===0){a.push({message:`${e.name} has a napi field but no npm/<platform>/ subdirs. Run pnpm exec napi artifacts before publishing.`,name:`napi-${e.name}-platforms`,severity:"warn",status:"fail"});continue}const s=[];for(const g of t){const l=b.join(i,g.name,"package.json");try{const p=JSON.parse(await y.readFile(l,"utf8"));p.version!==e.version&&s.push(`${g.name} (${p.version} vs parent ${e.version})`)}catch{s.push(`${g.name} (unreadable manifest)`)}}s.length>0?a.push({message:`${e.name}: platform versions out of sync — ${s.join(", ")}. They'll be re-synced on next publish.`,name:`napi-${e.name}-versions`,severity:"warn",status:"fail"}):a.push({message:`${e.name}: ${t.length} platform package(s), all versions in sync.`,name:`napi-${e.name}`,severity:"info",status:"pass"});const r=e.manifest.optionalDependencies??{},o=[];for(const g of t)try{const l=JSON.parse(await y.readFile(b.join(i,g.name,"package.json"),"utf8"));Object.hasOwn(r,l.name)||o.push(l.name)}catch{}o.length>0&&a.push({message:`${e.name}: missing optionalDependencies entries for: ${o.join(", ")}. Consumers won't get the right binary.`,name:`napi-${e.name}-optdeps`,severity:"error",status:"fail"})}catch{a.push({message:`${e.name}: could not read npm/ subdir.`,name:`napi-${e.name}-platforms`,severity:"warn",status:"skip"})}}{const{resolveVersionActionsId:e}=await import("./orchestrator.js").then(t=>t.w),i=n.packages.filter(t=>e(t,n.perPackageConfig.get(t.name)??{})==="jsr");for(const t of i){const s=n.perPackageConfig.get(t.name)??{},r=["jsr","publish","--dry-run","--allow-dirty"],o=s.jsrConfigPath;o!==void 0&&o!=="jsr.json"&&r.push("--config",o);for(const g of s.jsrPublishArgs??[])r.push(g);try{const g=await n.pm.runner.run("npx",r,{cwd:t.dir,silent:!0});g.exitCode===0?a.push({message:`${t.name}: \`jsr publish --dry-run\` passed.`,name:`jsr-dry-run/${t.name}`,severity:"info",status:"pass"}):a.push({message:`${t.name}: \`jsr publish --dry-run\` reported issues (slow types / exports / auth?): ${(g.stderr||g.stdout).trim().slice(0,300)}`,name:`jsr-dry-run/${t.name}`,severity:"warn",status:"fail"})}catch(g){a.push({message:`${t.name}: could not run \`npx jsr publish --dry-run\` (${g.message}). Install the jsr CLI / check network to enable this pre-flight.`,name:`jsr-dry-run/${t.name}`,severity:"warn",status:"skip"})}}}if(n.plan.warnings.length>0)for(const e of n.plan.warnings)a.push({message:e,name:"plan-warning",severity:"warn",status:"fail"});else a.push({message:n.plan.releases.length===0?"No pending releases.":`Plan resolves ${n.plan.releases.length} release(s).`,name:"plan-readable",severity:"info",status:"pass"});const d=n.config.publish?.guards;if(d?.packSecretScan)try{await import("@visulima/secret-scanner"),a.push({message:"@visulima/secret-scanner resolves; pack-set secret scanning will run.",name:"publish-guards.packSecretScan",severity:"info",status:"pass"})}catch{a.push({message:"publish.guards.packSecretScan is enabled but @visulima/secret-scanner is not installed. pnpm add -D @visulima/secret-scanner, or set the gate to false.",name:"publish-guards.packSecretScan",severity:"error",status:"fail"})}d?.audit&&d.audit!=="off"&&a.push({message:`Runtime npm audit gate active at "${d.audit}" severity.`,name:"publish-guards.audit",severity:"info",status:"pass"});const f=n.config.publish?.releaseAssets;if((f?.stampHashes||f?.uploadTarball)&&a.push({message:`Release-asset attestation: stampHashes=${f.stampHashes??!1}, uploadTarball=${f.uploadTarball??!1}.`,name:"publish-releaseAssets",severity:"info",status:"pass"}),n.config.publish?.stage){try{const{execSync:r}=await import("node:child_process"),o=r("npm --version",{stdio:["ignore","pipe","ignore"]}).toString().trim(),[g="0",l="0"]=o.split("."),p=Number.parseInt(g,10)>11||Number.parseInt(g,10)===11&&Number.parseInt(l,10)>=15;a.push({message:p?`npm ${o} supports \`npm stage publish\`.`:`npm ${o} is too old for staged publishing. Upgrade to npm ≥ 11.15.0.`,name:"publish-stage.npm-version",severity:p?"info":"error",status:p?"pass":"fail"})}catch{a.push({message:"publish.stage is enabled but npm is not on PATH.",name:"publish-stage.npm-version",severity:"error",status:"fail"})}const e=n.config.publish?.registry??"https://registry.npmjs.org/",i=/(?:^|:\/\/)registry\.npmjs\.(?:org|com)\//.test(e);a.push({message:i?"Registry is npmjs.com; staging is supported.":`publish.stage is enabled but registry "${e}" is not npmjs.com. Staging is npm Inc-specific; the request will be rejected.`,name:"publish-stage.registry",severity:i?"info":"warn",status:i?"pass":"fail"});const t=n.packages.filter(r=>r.manifest.publishConfig?.access==="restricted"),s=!!process.env.ACTIONS_ID_TOKEN_REQUEST_URL&&!process.env.NPM_TOKEN;t.length>0&&s&&a.push({message:`${t.length} package(s) have publishConfig.access: "restricted" and OIDC trusted publishing is active. Staging this combo is not supported in v1 (no static token for the post-decision read). Set NPM_TOKEN, or disable publish.stage for these packages.`,name:"publish-stage.oidc-restricted",severity:"error",status:"fail"})}try{const{DEFAULT_CHANGES_DIR:e}=await import("./DEFAULT_CLEAN_KEEP.js"),{readStagedRegistry:i}=await import("./staged-registry.js"),t=await i(c,n.config.changesDir??e);if(t.pending.length>0){const s=t.pending.map(r=>`${r.name}@${r.version} (${r.reason})`).join(", ");a.push({message:`${t.pending.length} pending stage(s) recorded in .vis/release/staged.json: ${s}. Approve / reject before the next release: vis release stage approve --all`,name:"publish-stage.pending",severity:"warn",status:"fail"})}}catch{}try{const{DEFAULT_CHANGES_DIR:e}=await import("./DEFAULT_CLEAN_KEEP.js"),{readFile:i}=await import("node:fs/promises"),{join:t}=await import("node:path"),s=t(c,n.config.changesDir??e,".state.json"),r=await i(s,"utf8"),o=JSON.parse(r);Array.isArray(o.stagedIds)&&o.stagedIds.length>0&&a.push({message:`Found ${o.stagedIds.length} legacy stage id(s) in .state.json#stagedIds: ${o.stagedIds.join(", ")}. The new registry lives in .vis/release/staged.json. Approve / reject these via npmjs.com or \`vis release stage approve <id>\` to avoid losing them.`,name:"publish-stage.legacy-stagedIds",severity:"warn",status:"fail"})}catch{}{const e=n.packages.filter(i=>n.perPackageConfig.get(i.name)?.versionActions==="shell");for(const i of e){const t=n.perPackageConfig.get(i.name)??{},s=n.config.allowCustomCommands,r=s===!0||Array.isArray(s)&&s.includes(i.name),o=t.publishCommand!==void 0&&t.publishCommand!=="";r||a.push({message:`${i.name} uses versionActions: "shell" but release.allowCustomCommands does not permit it. Set allowCustomCommands: true or include "${i.name}" in the array.`,name:`shell-actions.${i.name}.trust-gate`,severity:"error",status:"fail"}),o?r&&a.push({message:`${i.name} → shell publish (${Array.isArray(t.publishCommand)?`${t.publishCommand.length} commands`:"1 command"}).`,name:`shell-actions.${i.name}`,severity:"info",status:"pass"}):a.push({message:`${i.name} uses versionActions: "shell" but no publishCommand is configured. Set release.packages["${i.name}"].publishCommand.`,name:`shell-actions.${i.name}.publish-command`,severity:"error",status:"fail"})}}if(!n.config.gitUser)try{const{createShellRunner:e}=await import("./shell-runner.js"),i=e(),t=await i.run("git",["config","user.name"],{cwd:c,silent:!0}),s=await i.run("git",["config","user.email"],{cwd:c,silent:!0}),r=t.exitCode===0&&t.stdout.trim().length>0,o=s.exitCode===0&&s.stdout.trim().length>0;!r||!o?a.push({message:`git config user.name/user.email is not set (name=${r?"ok":"missing"}, email=${o?"ok":"missing"}). vis auto-commits staged.json and version bumps — these will fail without an identity. Set release.gitUser in vis.config.ts or configure git globally.`,name:"git.identity",severity:"warn",status:"fail"}):a.push({message:`git identity: ${t.stdout.trim()} <${s.stdout.trim()}>.`,name:"git.identity",severity:"info",status:"pass"})}catch{}if(n.config.signing){const{signing:e}=n.config;try{const{createShellRunner:i}=await import("./shell-runner.js"),t=i(),s=await t.run("git",["config","user.signingkey"],{cwd:c,silent:!0}),r=await t.run("git",["config","gpg.format"],{cwd:c,silent:!0}),o=s.exitCode===0?s.stdout.trim():"",g=r.exitCode===0?r.stdout.trim():"",l=o.length>0||!!e.key;if(e.mode==="ssh")g!=="ssh"||!l?a.push({message:`release.signing.mode is "ssh" but git config is incomplete (gpg.format=${g||"<unset>"}, user.signingkey=${l?"ok":"missing"}). Run \`git config gpg.format ssh\` and \`git config user.signingkey <path-to-key>\` before releasing.`,name:"git.signing",severity:"warn",status:"fail"}):a.push({message:"git signing: ssh mode active (gpg.format=ssh, signingkey configured).",name:"git.signing",severity:"info",status:"pass"});else if(e.mode==="sigstore"){const{gitsignAvailable:p}=await import("./git.js");await p({cwd:c,runner:t})?a.push({message:"git signing: sigstore mode (preview); gitsign is on PATH.",name:"git.signing",severity:"info",status:"pass"}):a.push({message:'release.signing.mode is "sigstore" (preview) but gitsign is not on PATH. Tags will fall back to GPG signing with a warning. Install gitsign: https://github.com/sigstore/gitsign',name:"git.signing",severity:"warn",status:"fail"})}else if(l){const p=e.key?/[\\/]/.test(e.key)||/\.(?:pem|gpg|key|asc|p12|pfx)$/i.test(e.key)||e.key.length<8?"configured":`…${e.key.slice(-4)}`:"from git config";a.push({message:`git signing: gpg mode active (key: ${p}).`,name:"git.signing",severity:"info",status:"pass"})}else a.push({message:'release.signing.mode is "gpg" but neither release.signing.key nor git config user.signingkey is set. Configure one before releasing.',name:"git.signing",severity:"warn",status:"fail"})}catch(i){a.push({message:`Could not verify git signing config: ${i.message}.`,name:"git.signing",severity:"warn",status:"skip"})}}if(n.config.floatingMajorTag===!0&&n.config.signing?.mode==="sigstore"&&a.push({message:`release.floatingMajorTag and release.signing.mode="sigstore" are both enabled. The floating-tag retarget force-pushes <unscoped-name>-v<major> (e.g. acme-action-v1) on every release, which appends a new sigstore transparency-log entry to Rekor each time (Rekor is append-only — entries are never removed). Over a long-lived major you'll accumulate one log entry per release. Consider either dropping floatingMajorTag (and pin consumers to a specific tag) or switching to gpg/ssh signing if the Rekor footprint matters for your project.`,name:"floating-major-tag.signing-risk",severity:"warn",status:"fail"}),n.config.floatingMajorTag===!0)try{const{createShellRunner:e}=await import("./shell-runner.js"),i=await e().run("git",["tag","--list","v*"],{cwd:c,silent:!0});if(i.exitCode===0){const t=i.stdout.split(`
3
+ `).map(s=>s.trim()).filter(s=>/^v\d+$/.test(s));if(t.length===0)a.push({message:"No legacy `v<major>` tags found; floating-tag migration is clean.",name:"floating-major-tag.legacy-tags",severity:"info",status:"pass"});else{const s=t.slice(0,5),r=t.length>5?` (+${t.length-5} more)`:"",o=t[0],g=o.slice(1);a.push({message:`Legacy floating-major tags detected (${s.join(", ")}${r}). After upgrading the floating-tag format to \`<safe-name>-v<major>\`, these legacy tags are no longer updated. Consumers pinning \`<repo>@${o}\` will silently freeze at the pre-upgrade commit. Migration:
4
+ 1. Re-tag the legacy tag to point at the new floating tag:
5
+ git tag -f ${o} <safe-name>-v${g}
6
+ git push --force origin ${o}
7
+ 2. Or sunset the legacy tag and announce the new pin to consumers.`,name:"floating-major-tag.legacy-tags",severity:"warn",status:"fail"})}}else a.push({message:`Skipped: \`git tag --list "v*"\` exited ${i.exitCode}.`,name:"floating-major-tag.legacy-tags",severity:"info",status:"skip"})}catch(e){a.push({message:`Skipped: could not list git tags: ${e.message}.`,name:"floating-major-tag.legacy-tags",severity:"info",status:"skip"})}if(m.firstRelease===!0){const e=[];try{const{createShellRunner:i}=await import("./shell-runner.js"),t=i(),s=new Set,r=n.config.releaseTagPattern??"{name}@{version}";s.add(r);for(const o of n.packages){const g=n.perPackageConfig.get(o.name)?.releaseTagPattern??r;s.add(g)}for(const o of s){const g=o.replaceAll(/\{(?:name|unscopedName|version|major|minor|patch|date|channel)\}/g,()=>"*"),l=await t.run("git",["tag","--list",g],{cwd:c,silent:!0});if(l.exitCode!==0)continue;const p=l.stdout.split(`
8
+ `).map(v=>v.trim()).filter(Boolean);p.length>0&&e.push(`Found ${p.length} git tag(s) matching "${o}": ${p.slice(0,5).join(", ")}${p.length>5?` (+${p.length-5} more)`:""}.`)}}catch(i){e.push(`Could not scan git tags: ${i.message}.`)}try{const{resolveVersionActionsId:i}=await import("./orchestrator.js").then(s=>s.w),{createVersionActions:t}=await import("../packem_shared/createVersionActions-BK43SNDH.js");for(const s of n.packages){const r=n.perPackageConfig.get(s.name),o=i(s,r??{});let g;try{g=t(o)}catch{continue}let l;try{l=await g.readPublishedVersion.call(g,{perPackageConfig:r,pkg:s,pm:n.pm})}catch{continue}l&&l.length>0&&e.push(`${s.name} is already published at version ${l}.`)}}catch(i){e.push(`Could not probe published versions: ${i.message}.`)}e.length>0?a.push({message:`--first-release is set but the workspace is NOT greenfield: ${e.join(" ")} Remove --first-release and run a normal release, or roll back the existing tags / unpublish before bootstrapping.`,name:"first-release.repo-not-greenfield",severity:"error",status:"fail"}):a.push({message:"Workspace looks greenfield (no matching release tags, no published versions detected). Safe to use --first-release.",name:"first-release.repo-not-greenfield",severity:"info",status:"pass"})}if(n.config.gitlabHost){const{detectRemoteProvider:e}=await import("./detect2.js"),{createShellRunner:i}=await import("./shell-runner.js"),t=await e(c,i(),n.config.provider);t==="gitlab"?a.push({message:`Self-hosted GitLab host configured: ${n.config.gitlabHost}.`,name:"gitlab-host",severity:"info",status:"pass"}):a.push({message:`release.gitlabHost is set ("${n.config.gitlabHost}") but the resolved provider is "${t}". The host will be ignored. Either set release.provider: "gitlab" or remove gitlabHost.`,name:"gitlab-host",severity:"warn",status:"fail"})}if(n.config.githubHost){const{detectRemoteProvider:e}=await import("./detect2.js"),{createShellRunner:i}=await import("./shell-runner.js"),t=await e(c,i(),n.config.provider);t==="github"?await import("node:child_process").then(({execSync:s})=>{try{return s("gh --version",{stdio:"ignore"}),!0}catch{return!1}})?a.push({message:`Self-hosted GitHub Enterprise host configured: ${n.config.githubHost}.`,name:"github-host",severity:"info",status:"pass"}):a.push({message:`release.githubHost is set ("${n.config.githubHost}") but the gh CLI is not on PATH. Install gh and run \`gh auth login --hostname ${n.config.githubHost}\` before releasing.`,name:"github-host",severity:"error",status:"fail"}):a.push({message:`release.githubHost is set ("${n.config.githubHost}") but the resolved provider is "${t}". The host will be ignored. Either set release.provider: "github" or remove githubHost.`,name:"github-host",severity:"warn",status:"fail"})}{const e=await import("node:fs/promises"),i=await import("node:path");let t;for(const s of n.packages){const r=n.perPackageConfig.get(s.name);if(r){if(r.uvLockPath){const o=i.isAbsolute(r.uvLockPath)?r.uvLockPath:i.join(s.dir,r.uvLockPath);try{await e.access(o),a.push({message:`uv.lock present at ${o}.`,name:`uv-lockfile/${s.name}`,severity:"info",status:"pass"})}catch{a.push({message:`${s.name}: configured uvLockPath "${r.uvLockPath}" doesn't exist (expected ${o}). Run \`uv lock\` to generate it, or remove uvLockPath if the lockfile lives elsewhere.`,name:`uv-lockfile/${s.name}`,severity:"warn",status:"fail"})}}if(r.uvWorkspace?.root){const o=i.resolve(s.dir,r.uvWorkspace.root),g=i.relative(o,s.dir).replaceAll("\\","/");switch(t||({checkUvWorkspaceMembership:t}=await import("./registry.js").then(l=>l.g)),await t(o,g)){case"member":{a.push({message:`${s.name} is a member of the uv workspace rooted at ${o}.`,name:`uv-workspace/${s.name}`,severity:"info",status:"pass"});break}case"no-root-pyproject":{a.push({message:`${s.name}: uvWorkspace.root points at ${o} but no pyproject.toml was found there. Verify the path is correct.`,name:`uv-workspace/${s.name}`,severity:"warn",status:"fail"});break}case"no-workspace":{a.push({message:`${s.name}: uvWorkspace.root points at ${o} but that pyproject.toml has no [tool.uv.workspace] block. Add one with a "members" list, or drop the uvWorkspace setting.`,name:`uv-workspace/${s.name}`,severity:"warn",status:"fail"});break}default:a.push({message:`${s.name}: uv workspace root at ${o} has [tool.uv.workspace] but its "members" list doesn't include "${g}". Add the package to members or correct uvWorkspace.root.`,name:`uv-workspace/${s.name}`,severity:"warn",status:"fail"})}}}}}const{execFileSync:w}=await import("node:child_process"),k=(e,i)=>{const t=e.split(".").map(r=>Number.parseInt(r,10)),s=i.split(".").map(r=>Number.parseInt(r,10));for(const[r,o]of s.entries()){const g=t[r]??0;if(g!==(o??0))return g>(o??0)}return!0};{const e=process.versions.node,[i=0,t=0]=e.split(".").map(r=>Number.parseInt(r,10)),s=i===22&&t>=14||i>=24||i===23;a.push({message:`node@${e} (min: 22.14.0 || >=24.10.0)`,name:"node-version",severity:s?"info":"error",status:s?"pass":"fail"})}for(const[e,i,t]of[["git","2.31","git-version"],["gh","2.40","gh-version"]])try{const s=w(e,["--version"],{stdio:["ignore","pipe","ignore"]}).toString(),r=/(\d+\.\d+\.\d+)/.exec(s);if(!r)continue;const o=k(r[1],i);a.push({message:`${e}@${r[1]} (min: ${i})`,name:t,severity:o?"info":e==="git"?"error":"warn",status:o?"pass":"fail"})}catch{}{const e=new Set([n.config.publish?.registry??"https://registry.npmjs.org"]);for(const i of n.packages){const t=n.perPackageConfig.get(i.name)?.registry;t&&e.add(t)}for(const i of e)try{const t=i.replace(/\/+$/,""),s=await fetch(`${t}/-/ping`,{method:"HEAD",signal:AbortSignal.timeout(3e3)});a.push({message:`${i} reachable (HTTP ${s.status}).`,name:"registry-reachable",severity:s.ok||s.status===404?"info":"warn",status:"pass"})}catch(t){a.push({message:`${i} not reachable: ${t.message}. Publishing may fail (or you're offline — this is a warning).`,name:"registry-reachable",severity:"warn",status:"fail"})}}try{const e=w("git",["tag","--list"],{cwd:c,stdio:["ignore","pipe","ignore"]}).toString().split(/\r?\n/).map(s=>s.trim()).filter(Boolean),i=/(?:^|@)\d+\.\d+\.\d+(?:[-+].+)?$/,t=e.filter(s=>!i.test(s)&&!/^v?\d+\.\d+\.\d+/.test(s));a.push({message:e.length===0?"No git tags yet (fresh repo).":`${e.length-t.length}/${e.length} tags parse as a release tag${t.length>0?` (unrecognised: ${t.slice(0,3).join(", ")}${t.length>3?"…":""})`:""}.`,name:"tags-parseable",severity:"warn",status:t.length>0?"fail":"pass"})}catch{}{const{readFile:e}=await import("node:fs/promises"),i=await import("node:path");let t=0,s=0;for(const r of n.packages)try{const o=await e(i.join(r.dir,"CHANGELOG.md"),"utf8");s+=1,/^#{1,2}\s/m.test(o)&&(t+=1)}catch{}s>0&&a.push({message:`${t}/${s} existing CHANGELOG.md file(s) have a recognised heading structure.`,name:"changelog-format",severity:"info",status:t===s?"pass":"fail"})}try{const e=await n.pm.readCatalogYaml(c);if(e){const{parseCatalogs:i}=await import("./registry.js").then(r=>r.f),t=i(e),s=[];for(const r of n.packages)for(const o of["dependencies","devDependencies","peerDependencies","optionalDependencies"]){const g=r.manifest[o];if(!(!g||typeof g!="object"))for(const[l,p]of Object.entries(g)){if(typeof p!="string"||!p.startsWith("catalog:"))continue;const v=p.slice(8)||"default";(v==="default"?t.default?.[l]:t.named?.[v]?.[l])||s.push(`${r.name} → ${l} (${p})`)}}a.push({message:s.length===0?"All catalog: references resolve against pnpm-workspace.yaml.":`${s.length} catalog: reference(s) don't resolve: ${s.slice(0,3).join("; ")}${s.length>3?"…":""}`,name:"catalog-consistency",severity:"warn",status:s.length===0?"pass":"fail"})}}catch{}await $(u,m,a);const C=a.some(e=>e.severity==="error"&&e.status==="fail");process.exitCode=C?1:0},$=async(u,m,h)=>{if(m.json){process.stdout.write(`${JSON.stringify({checks:h},null,2)}
9
+ `);return}for(const c of h){const a=`${c.status==="pass"?"✓":c.status==="fail"?"✗":"—"} [${c.severity}] ${c.name}: ${c.message}`;c.severity==="error"&&c.status==="fail"?u.error(a):c.severity==="warn"&&c.status==="fail"?u.warn(a):u.info(a)}};export{A as default};
@@ -1,22 +1,75 @@
1
- import{createRequire as te}from"node:module";import{E as f,j as g,q as y}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{m as T,f as R,I as V,H as G,y as K,a as L,A as P,o as se,T as oe,B as ne}from"../packem_shared/index-BDmTbWX1.js";import{f as pe}from"../packem_shared/giget-DHY1sQZC.js";import{p as l}from"./bin.js";const re=te(import.meta.url),N=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=t=>{if(typeof N<"u"&&N.versions&&N.versions.node){const[e,r]=N.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return N.getBuiltinModule(t)}return re(t)},{fileURLToPath:ie}=j("node:url"),{createInterface:ae}=j("node:readline"),{mkdtempSync:ce,rmSync:le}=j("node:fs"),{tmpdir:fe}=j("node:os"),{spawnSync:ue}=j("node:child_process"),J=[".ts",".mts",".cts",".js",".mjs",".cjs"],de="template.yml",me=[".d",".test",".spec",".config",".bench",".stories"],he=[".d.ts",".d.mts",".d.cts",".js.map",".mjs.map",".cjs.map",".ts.map"],Y=t=>{for(const e of J)if(t.endsWith(e))return t.slice(0,-e.length);return t},$e=t=>{if(he.some(r=>t.endsWith(r))||!J.some(r=>t.endsWith(r)))return!1;const e=Y(t);return!me.some(r=>e.endsWith(r))},H=(t,e)=>{const r=[];if(!R(t))return r;for(const s of V(t,{includeDirs:!1,includeSymlinks:!1,maxDepth:1})){if(!$e(s.name))continue;const n=Y(s.name);r.push({load:()=>ge(s.path),name:n,path:s.path,source:e})}return r},x=(t,e)=>{const r=[];if(!R(t))return r;for(const s of V(t,{includeFiles:!1,includeSymlinks:!1,maxDepth:1})){if(s.path===t)continue;const n=T(s.path,de);R(n)&&r.push({load:()=>ye(s.path,s.name),name:s.name,path:s.path,source:e})}return r},we=()=>{try{const t=ie(import.meta.url),e=T(G(t),"..","..","templates");return R(e)?e:void 0}catch{return}},I=t=>{const{extraDirectories:e=[],onWarning:r,workspaceRoot:s}=t,n=[...H(T(s,".vis","templates"),"native"),...x(T(s,".vis","templates"),"moon"),...x(T(s,".moon","templates"),"moon")];for(const o of e)n.push(...x(o,"config")),n.push(...H(o,"config"));const i=we();i&&n.push(...x(i,"builtin"));const a=new Map;for(const o of n){const c=a.get(o.name);if(!c){a.set(o.name,o);continue}r&&r(`Template "${o.name}" exists in multiple sources — using ${c.source} (${c.path}), ignoring ${o.source} (${o.path}).`)}return[...a.values()].sort((o,c)=>o.name.localeCompare(c.name))},ge=async t=>{const{loadNativeTemplate:e}=await import("./loader2.js");return e(t)},ye=async(t,e)=>{const{loadMoonTemplate:r}=await import("./index.js");return r(t,e)},q=(t,e)=>new Promise(r=>{t.question(e,s=>{r(s.trim())})}),ve=async(t,e,r)=>{const s=await q(t,` ${e} ${f(r?"[Y/n]":"[y/N]")} `);return s===""?r:s.toLowerCase()==="y"||s.toLowerCase()==="yes"},be=async(t,e,r,s)=>{process.stderr.write(` ${e}
2
- `);for(const[n,i]of r.entries()){const a=g(y(` ${String(n+1)}.`)),o=i===s?f(" (default)"):"";process.stderr.write(`${a} ${i}${o}
3
- `)}for(;;){const n=await q(t,`
4
- ${f(`Enter choice (1-${String(r.length)}):`)} `);if(n===""&&s!==void 0)return s;const i=Number.parseInt(n,10);if(Number.isInteger(i)&&i>=1&&i<=r.length)return r[i-1];const a=r.find(o=>o===n);if(a)return a;process.stderr.write(` ${f("Invalid choice. Try again.")}
5
- `)}},Te=async(t,e,r,s)=>{process.stderr.write(` ${e} ${f("(comma-separated numbers)")}
6
- `);for(const[n,i]of r.entries()){const a=g(y(` ${String(n+1)}.`)),o=s.includes(i)?f(" (default)"):"";process.stderr.write(`${a} ${i}${o}
7
- `)}for(;;){const n=await q(t,`
8
- ${f("Enter choices:")} `);if(n===""&&s.length>0)return s;const i=n.split(",").map(a=>Number.parseInt(a.trim(),10)).filter(a=>Number.isInteger(a)&&a>=1&&a<=r.length);if(i.length>0)return i.map(a=>r[a-1]);process.stderr.write(` ${f("Invalid choice. Try again.")}
9
- `)}},Se=t=>` ${f(`${t}:`)} `,Ee=(t,e)=>e.prompt??t,Ne=t=>Object.entries(t).sort(([e,r],[s,n])=>{const i=r.order??0,a=n.order??0;return i!==a?i-a:e.localeCompare(s)}),U=(t,e)=>{switch(t.type){case"array":return e.split(",").map(r=>r.trim()).filter(Boolean);case"boolean":return e==="true"||e==="1"||e==="yes"||e==="y";case"enum":return t.multiple?e.split(",").map(r=>r.trim()).filter(Boolean):e;case"number":{const r=Number(e);if(Number.isNaN(r))throw new TypeError(`Expected a number, got "${e}"`);return r}default:return e}},W=(t,e,r)=>{if(e.type==="enum"){const s=Array.isArray(r)?r:[r];for(const n of s)if(typeof n!="string"||!e.values.includes(n))throw new Error(`Variable "${t}" must be one of: ${e.values.join(", ")} (got "${String(n)}")`)}},Re=async t=>{const{defaults:e,interactive:r,overrides:s,variables:n}=t,i={},a=r?ae({input:process.stdin,output:process.stderr}):null;try{for(const[o,c]of Ne(n)){if(Object.hasOwn(s,o)){const w=U(c,s[o]??"");W(o,c,w),i[o]=w;continue}if(e||!r||c.internal){if(c.default!==void 0){W(o,c,c.default),i[o]=c.default;continue}if(c.required)throw new Error(`Required variable "${o}" not provided. Pass --${o}=<value> or remove --defaults.`);continue}const $=Ee(o,c);let m;if(c.type==="boolean")m=await ve(a,$,!!(c.default??!1));else if(c.type==="enum")if(c.multiple){const w=Array.isArray(c.default)?c.default:[];m=await Te(a,$,c.values,w)}else{const w=typeof c.default=="string"?c.default:void 0;m=await be(a,$,c.values,w)}else{const w=c.default===void 0?"":` (${String(c.default)})`,v=await q(a,Se(`${$}${w}`));if(v===""&&c.default!==void 0)m=c.default;else if(v===""){if(c.required)throw new Error(`Variable "${o}" is required`);continue}else m=U(c,v)}W(o,c,m),i[o]=m}return i}finally{a?.close()}},je=["git://","npm://","https://","github:","gitlab:","bitbucket:","sourcehut:"],ke=t=>je.some(e=>t.startsWith(e)),_e=async(t,e={})=>{const r=e.targetDirectory===void 0,s=e.targetDirectory??ce(T(fe(),"vis-generate-")),n=()=>{if(r)try{le(s,{force:!0,recursive:!0})}catch{}};l.info(`Downloading ${t}…`);try{const i=await pe(t,{auth:e.auth||process.env.GIGET_AUTH||process.env.GITHUB_TOKEN||process.env.GH_TOKEN||void 0,dir:s,force:!0,preferOffline:e.preferOffline});return{cleanup:n,directory:i.dir}}catch(i){n();const a=i instanceof Error?i.message:String(i);throw l.warn(`Failed to download template: ${a}`),i}},Q=(t,e="")=>{const r=[];for(const[s,n]of Object.entries(t)){const i=e?`${e}/${s}`:s;typeof n=="string"||Buffer.isBuffer(n)?r.push({content:n,path:i}):n&&typeof n=="object"&&r.push(...Q(n,i))}return r},Oe=t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,xe=(t,e)=>{if(P(e))throw new Error(`Refusing to write outside destination: template produced absolute path "${e}".`);const r=T(t,e),s=K(t,r);if(s===".."||s.startsWith(`..${se}`)||P(s))throw new Error(`Refusing to write outside destination: "${e}" resolves to "${r}" which escapes "${t}".`);return r},Ie=(t,e)=>{L(G(t)),oe(t,e)},qe=(t,e,r=!1)=>{const s=typeof t=="string"?[t]:t.commands,n=typeof t=="string"?r:t.silent??r;for(const i of s){n||l.info(`$ ${i}`);const a=ue(i,{cwd:e,shell:!0,stdio:n?"ignore":"inherit"});if(a.status!==0)return l.warn(`Script failed (exit ${String(a.status)}): ${i}`),!1}return!0},De=t=>{const e=new Map;for(const r of t){const s=typeof r=="string"?0:r.phase??0,n=e.get(s);n?n.push(r):e.set(s,[r])}return[...e.entries()].sort(([r],[s])=>r-s)},Be=async(t,e)=>{const r={builtins:{dest_dir:e.destination,dest_rel_dir:K(e.workspaceRoot,e.destination)||".",working_dir:e.cwd,workspace_root:e.workspaceRoot},options:e.options},s=await t.produce(r),n=s.files?Q(s.files):[],i=s.filesMeta??{},a=[];for(const o of n){const c=xe(e.destination,o.path);a.push({file:o,meta:i[o.path]??{},target:c})}if(e.dryRun){l.info(`${g(y("Plan"))} ${f("(dry-run, no files written)")}`);for(const o of a){const c=Buffer.isBuffer(o.file.content)?o.file.content.length:Buffer.byteLength(o.file.content,"utf8");process.stderr.write(` ${f("write")} ${o.file.path} ${f(`(${Oe(c)})`)}
10
- `)}}else{L(e.destination);let o=0,c=0;for(const $ of a){const{file:m,meta:w,target:v}=$,D=R(v),b=e.force||w.force===!0;if(D&&!b){l.warn(`Skipped existing file: ${m.path} (use --force or set frontmatter force: true to overwrite)`),c+=1;continue}Ie(v,m.content),o+=1}l.success(`Wrote ${String(o)} file${o===1?"":"s"}${c>0?`, skipped ${String(c)}`:""}`)}if(!e.dryRun&&!e.skipScripts&&s.scripts&&s.scripts.length>0){const o=De(s.scripts);l.info(`Running ${String(s.scripts.length)} script${s.scripts.length===1?"":"s"} across ${String(o.length)} phase${o.length===1?"":"s"}…`);for(const[,c]of o)if((await Promise.all(c.map($=>Promise.resolve(qe($,e.destination))))).includes(!1))throw new Error("Script failed — aborting.")}if(s.suggestions&&s.suggestions.length>0){process.stderr.write(`
11
- `),l.notice("Next steps:");for(const o of s.suggestions)process.stderr.write(` ${f("•")} ${o}
12
- `)}},We=async t=>{let e;try{e=(await t.load()).about?.description}catch{}return{description:e,name:t.name,path:t.path,source:t.source}},Pe=(t,e)=>{const r={default:e.default,name:t,order:e.order,prompt:e.prompt,required:e.required,type:e.type};return e.type==="enum"&&(r.multiple=e.multiple,r.values=e.values),r},Ae=async t=>{const e=await t.load(),r=Object.entries(e.options??{}).sort(([s,n],[i,a])=>{const o=n.order??0,c=a.order??0;return o===c?s.localeCompare(i):o-c}).map(([s,n])=>Pe(s,n));return{description:e.about?.description??"",destination:e.destination,name:t.name,path:t.path,source:t.source,variables:r}},Ce=t=>{if(t.length===0){l.info("No templates found."),l.notice("Create one at .vis/templates/<name>.ts (programmatic) or .vis/templates/<name>/ (moon-format with template.yml).");return}l.info("Available templates:");for(const e of t){const r=f(`(${e.source})`);process.stderr.write(` ${g(y(e.name))} ${r}
13
- `)}},Me=t=>{const e={},r=[];for(const s of t){if(!s.startsWith("--")){r.push(s);continue}const n=s.indexOf("=");if(n===-1){const o=s.slice(2);o.startsWith("no-")?e[o.slice(3)]="false":e[o]="true";continue}const i=s.slice(2,n),a=s.slice(n+1);e[i]=a}return{overrides:e,remaining:r}},Fe=async t=>{const{createInterface:e}=await import("node:readline"),r=e({input:process.stdin,output:process.stderr});try{process.stderr.write(` ${g(y("vis generate"))} ${f("— pick a template")}
1
+ import{createRequire as N}from"node:module";const R=N(import.meta.url),j=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=e=>{if(typeof j<"u"&&j.versions&&j.versions.node){const[n,a]=j.versions.node.split(".").map(Number);if(n>22||n===22&&a>=3||n===20&&a>=16)return j.getBuiltinModule(e)}return R(e)},{mkdir:J,readFile:$,writeFile:w,readdir:S,access:M,rm:O}=A("node:fs/promises"),{join:l,relative:v,dirname:P}=A("node:path"),k=async e=>{try{return await M(e),!0}catch{return!1}},_=async e=>await k(l(e,".changeset"))?"changesets":await k(l(e,".bumpy"))?"bumpy":await(async()=>{for(const a of[".releaserc.json",".releaserc.cjs",".releaserc.js"])if(await k(l(e,a)))return!0;const n=[l(e,"packages"),l(e,"apps")];for(;n.length>0;){const a=n.shift();let t;try{t=await S(a,{withFileTypes:!0})}catch{continue}for(const s of t)if(s.isDirectory()){if(s.name==="node_modules"||s.name.startsWith("."))continue;n.push(l(a,s.name))}else if(s.name===".releaserc.json"||s.name===".releaserc.cjs"||s.name===".releaserc.js")return!0;if(n.length>200)break}return!1})()?"semantic-release":"fresh",C=async e=>{const n=[];for(const s of[".releaserc.json",".releaserc.cjs",".releaserc.js"]){const f=l(e,s);await k(f)&&n.push(f)}const a=[l(e,"packages"),l(e,"apps")];let t=0;for(;a.length>0&&t<5e3;){const s=a.shift();t+=1;let f;try{f=await S(s,{withFileTypes:!0})}catch{continue}for(const i of f){const r=l(s,i.name);if(i.isDirectory()){if(i.name==="node_modules"||i.name.startsWith("."))continue;a.push(r)}else(i.name===".releaserc.json"||i.name===".releaserc.cjs"||i.name===".releaserc.js")&&n.push(r)}}return n},F=async e=>{if(!e.endsWith(".json"))return{path:e};try{const n=await $(e,"utf8"),a=JSON.parse(n);return{branches:a.branches,extends:typeof a.extends=="string"?a.extends:void 0,path:e,plugins:Array.isArray(a.plugins)?a.plugins:void 0}}catch{return}},B=e=>Array.isArray(e)?e.map(n=>{if(typeof n=="string")return{name:n};if(typeof n=="object"&&n!==null&&typeof n.name=="string"){const a=n;return{channel:a.channel,name:a.name,prerelease:a.prerelease}}}).filter(n=>n!==void 0):[],T=e=>{const n={};for(const a of e){const t={tag:"latest"};typeof a.prerelease=="string"?(t.prerelease=a.prerelease,t.tag=a.prerelease,t.mode="auto-publish"):a.prerelease===!0?(t.prerelease=a.name,t.tag=a.name,t.mode="auto-publish"):(t.tag=a.channel??(a.name==="main"||a.name==="master"?"latest":a.name),t.mode="version-pr"),n[a.name]=t}return n},z=async({logger:e,options:n,workspaceRoot:a})=>{const t=a??process.cwd(),s=n.dryRun===!0;let f=n.apply===!0;s&&f&&(e.warn("--apply is ignored because --dry-run is set (dry-run takes precedence)."),f=!1);let i;n.fromSemanticRelease?i="semantic-release":n.fromChangesets?i="changesets":n.fromBumpy?i="bumpy":n.fresh?i="fresh":i=await _(t),e.info(`Detected source: ${i}`),e.info("");const r=l(t,".vis","release"),c=".vis/release/.state.json",g=".vis/release/.lock",u=l(t,".gitignore");if(s)e.info(`[dry-run] would create directory: ${r}`),e.info(`[dry-run] would append to .gitignore:
2
+ ${c}
3
+ ${g}`);else{await J(r,{recursive:!0}),e.info(`Created ${v(t,r)}/`);try{const p=await $(u,"utf8"),h=[];p.includes(c)||h.push(c),p.includes(g)||h.push(g),h.length>0&&(await w(u,`${p.replace(/\n*$/,`
4
+ `)}
5
+ # vis release subsystem
6
+ ${h.join(`
7
+ `)}
8
+ `),e.info("Updated .gitignore."))}catch{await w(u,`# vis release subsystem
9
+ ${c}
10
+ ${g}
11
+ `),e.info("Created .gitignore.")}}const o=".vis/release/**",d=l(t,".secretlintignore");if(s)e.info(`[dry-run] would add to .secretlintignore:
12
+ ${o}`);else try{const p=await $(d,"utf8");p.includes(o)||(await w(d,`${p.replace(/\n*$/,`
13
+ `)}
14
+ # vis release change files (author handles false-positive secretlint)
15
+ ${o}
16
+ `),e.info("Updated .secretlintignore."))}catch{await w(d,`# vis release change files (author handles false-positive secretlint)
17
+ ${o}
18
+ `),e.info("Created .secretlintignore.")}switch(i){case"bumpy":{await U(t,s,e);break}case"changesets":{await E(t,s,e);break}case"semantic-release":{await D(t,s,f,e);break}default:V(e)}await q(t,s,n.yes===!0,e),await G(t,s,n,e),e.info(""),e.info("Next steps:"),e.info(" 1. Add the `release: { ... }` block above to your vis.config.ts"),e.info(" 2. Author your first change file: vis release add"),e.info(" 3. Preview the plan: vis release status"),e.info(" 4. Apply: vis release version --dry-run")},D=async(e,n,a,t)=>{const s=await C(e);if(t.info(`Found ${s.length} .releaserc file(s).`),s.length===0)return;let f=[],i=0;for(const o of s){const d=await F(o);d&&(d.branches&&(f=[...f,...B(d.branches)]),d.plugins?.some(p=>typeof p=="string"&&p.includes("native-addons"))&&(i+=1),d.plugins?.some(p=>Array.isArray(p)&&typeof p[0]=="string"&&p[0].includes("native-addons"))&&(i+=1))}const r=new Set,c=f.filter(o=>r.has(o.name)?!1:(r.add(o.name),!0)),g=c.length>0?T(c):{alpha:{mode:"auto-publish",prerelease:"alpha",tag:"alpha"},main:{mode:"version-pr",tag:"latest"}};t.info(""),t.info("Suggested vis.config.ts release block (paste into your existing config):"),t.info("");const u=` release: {
19
+ baseBranch: "main",
20
+ defaultManaged: false, // flip to true after Phase 6
21
+ channels: {
22
+ ${Object.entries(g).map(([o,d])=>` ${JSON.stringify(o)}: ${JSON.stringify(d)},`).join(`
23
+ `)}
24
+ },
25
+ publish: {
26
+ packManager: "auto",
27
+ publishStrategy: "npm-publish-tarball",
28
+ publishArgs: ["--provenance"],
29
+ protocolResolution: "pack",
30
+ catalogResolution: "auto",
31
+ cleanPackageJson: true,
32
+ },
33
+ gitUser: { name: "release-bot", email: "release-bot@example.com" },
34
+ },`;if(t.info(u),t.info(""),i>0&&(t.info(`Found ${i} package(s) using a NAPI native-addons plugin.`),t.info("These will auto-detect via the `napi` field in package.json — no config needed."),t.info("")),t.info("Migration is per-package opt-in (RFC §17.1). For each package you want to migrate:"),t.info(' 1. Add to its package.json: "vis-release": { "managed": true }'),t.info(" 2. Backfill any missing git tags so already-published detection works."),t.info(" 3. Add to multi-semantic-release's --ignore-packages list in your release workflow."),t.info(""),!a){t.info("Existing .releaserc.json files are kept in place during transition (deleted in Phase 6)."),t.info("Re-run with `--apply` to perform the writes automatically.");return}t.info(""),t.info("Applying migration writes (--apply set)…"),await I(e,s,u,t),t.info(""),t.info("Migration writes complete. Follow-up steps you still need to do manually:"),t.info(" - Update your CI workflow: remove `multi-semantic-release` step, add `vis release ci/release` step (see `.github/workflows/vis-release.yml` example in the vis package)"),t.info(" - Run `pnpm install` to drop semantic-release deps once you remove them from root package.json"),t.info(" - Run `vis release doctor` to verify the migration")},I=async(e,n,a,t)=>{const s=l(e,"vis.config.ts"),f=await $(s,"utf8").catch(()=>{});if(f===void 0){const i=`import { defineConfig } from "@visulima/vis/config";
14
35
 
15
- `);for(const[s,n]of t.entries()){const i=g(y(` ${String(s+1)}.`));process.stderr.write(`${i} ${n.name} ${f(`(${n.source})`)}
16
- `)}return new Promise((s,n)=>{r.question(`
17
- ${f(`Enter choice (1-${String(t.length)}):`)} `,i=>{const a=Number.parseInt(i.trim(),10);Number.isInteger(a)&&a>=1&&a<=t.length?s(t[a-1].name):n(new Error("Invalid choice."))})})}finally{r.close()}},Le=async({argument:t,options:e,rawUnknown:r,visConfig:s,workspaceRoot:n})=>{const i=e.cwd||n||process.cwd(),a=n??i,o=s?.generator,c=Array.isArray(t)?t:t?[t]:[];if(e.list){const u=I({extraDirectories:o?.templates??[],onWarning:p=>{l.warn(p)},workspaceRoot:a});if(e.json){const p=await Promise.all(u.map(d=>We(d)));process.stdout.write(`${JSON.stringify(p,null,2)}
18
- `);return}Ce(u);return}if(e.describe){const u=c[0];if(!u)throw new Error("`--describe` requires a template name. Run `vis generate --list` to see available templates.");const p=I({extraDirectories:o?.templates??[],onWarning:h=>{l.warn(h)},workspaceRoot:a}).find(h=>h.name===u);if(!p)throw new Error(`Template "${u}" not found. Run \`vis generate --list\` to see available templates.`);const d=await Ae(p);if(e.json){process.stdout.write(`${JSON.stringify(d,null,2)}
19
- `);return}if(l.info(`Template: ${g(y(d.name))} ${f(`(${d.source})`)}`),d.description&&l.info(d.description),d.destination&&l.info(`Destination: ${f(d.destination)}`),d.variables.length===0)l.info("No variables.");else{l.info("Variables:");for(const h of d.variables){const O=[h.type];h.required&&O.push("required"),h.default!==void 0&&O.push(`default=${JSON.stringify(h.default)}`),h.values&&O.push(`values=${h.values.join("|")}`),process.stderr.write(` ${g(y(h.name))} ${f(`(${O.join(", ")})`)}
20
- `)}}return}let $=[...r??[]];if($.length===0){const u=process.argv.slice(2),p=u.indexOf("--");p!==-1&&($=u.slice(p+1))}const m=c.indexOf("--"),w=m===-1?[]:c.slice(m+1),v=m===-1?c:c.slice(0,m),{overrides:D}=Me([...w,...$]);let b,k,_;const E=v[0];let B;if(E&&ke(E)){const u=await _e(E,{auth:o?.auth,preferOffline:!!e.preferOffline||o?.preferOffline});B=u.cleanup;try{const p=I({extraDirectories:[u.directory],workspaceRoot:a}).find(d=>d.path.startsWith(u.directory));if(!p)throw new Error(`Downloaded template at ${u.directory} contains no template.yml or *.ts entrypoint.`);b=await p.load(),k=p.name,_=b.destination}catch(p){throw B(),p}}else{const u=I({extraDirectories:o?.templates??[],onWarning:h=>{l.warn(h)},workspaceRoot:a});if(u.length===0)throw new Error("No templates found. Create one at .vis/templates/<name>.ts or .vis/templates/<name>/template.yml.");let p;if(E)p=E;else{if(e.interactive===!1||!process.stdin.isTTY)throw new Error("No template specified. Pass a template name (see `vis generate --list`) or run interactively in a terminal.");p=await Fe(u)}const d=u.find(h=>h.name===p);if(!d)throw new Error(`Template "${p}" not found. Run 'vis generate --list' to see available templates.`);b=await d.load(),k=d.name,_=b.destination}const A=e.to,C=!!e.dryRun,X=!!e.force,M=!!e.defaults,z=!!e.skipScripts,Z=e.interactive!==!1&&!!process.stdin.isTTY&&!M;let S;A?S=A:_?S=_:S=".";const F=P(S)?S:ne(i,S);l.info(`Template: ${g(y(k))}`),l.info(`Target: ${f(F)}`),process.stderr.write(`
21
- `);const ee=await Re({defaults:M,interactive:Z,overrides:D,variables:b.options??{}});try{await Be(b,{cwd:i,destination:F,dryRun:C,force:X,options:ee,skipScripts:z,workspaceRoot:a}),C||(process.stderr.write(`
22
- `),l.success(`Template '${k}' applied.`))}finally{B?.()}};export{Le as default};
36
+ export default defineConfig({
37
+ ${a}
38
+ });
39
+ `;await w(s,i),t.info(` wrote ${v(e,s)}`)}else if(/\brelease\s*:/.test(f))t.warn(` skipped ${v(e,s)} — already has a \`release\` key; merge the suggested block manually.`);else{const i=W(f,a);i===void 0?t.warn(` skipped ${v(e,s)} could not locate \`defineConfig({\` or \`export default {\` to inject into; merge the suggested block manually.`):(await w(s,i),t.info(` updated ${v(e,s)} (injected release block)`))}for(const i of n){const r=P(i),c=l(r,"package.json");if(!await k(c))continue;const g=await $(c,"utf8");let u;try{u=JSON.parse(g)}catch{t.warn(` skipped ${v(e,c)} invalid JSON.`);continue}const o=u["vis-release"];if(o!==null&&typeof o=="object"&&o.managed===!0)continue;const d=o!==null&&typeof o=="object"?{...o,managed:!0}:{managed:!0};u["vis-release"]=d,await w(c,`${JSON.stringify(u,void 0,4)}
40
+ `),t.info(` updated ${v(e,c)} (added vis-release.managed = true)`)}for(const i of n)await O(i,{force:!0}),t.info(` deleted ${v(e,i)}`)},W=(e,n)=>{const a=/defineConfig\s*\(\s*\{/.exec(e);if(a!==null){const s=a.index+a[0].length;return`${e.slice(0,s)}
41
+ ${n}
42
+ ${e.slice(s)}`}const t=/export\s+default\s+\{/.exec(e);if(t!==null){const s=t.index+t[0].length;return`${e.slice(0,s)}
43
+ ${n}
44
+ ${e.slice(s)}`}},E=async(e,n,a)=>{const t=l(e,".changeset"),s=l(t,"config.json"),f=l(t,"pre.json");if(await k(f)){a.error("Pre-release mode is active in changesets (.changeset/pre.json exists)."),a.error("Run `changeset pre exit && changeset version` to consume pending changes, then re-run `vis release init`."),process.exitCode=1;return}let i={};try{i=JSON.parse(await $(s,"utf8"))}catch{a.warn(".changeset/config.json missing or unreadable; using defaults.")}const r={access:i.access==="restricted"?"restricted":"public",baseBranch:typeof i.baseBranch=="string"?i.baseBranch:"main",defaultManaged:!0,fixed:Array.isArray(i.fixed)?i.fixed:[],ignore:Array.isArray(i.ignore)?i.ignore:[],linked:Array.isArray(i.linked)?i.linked:[],privatePackages:i.privatePackages??{tag:!1,version:!1},updateInternalDependencies:i.updateInternalDependencies??"out-of-range"},c=i.changelog,g=typeof c=="string"?c:Array.isArray(c)&&typeof c[0]=="string"?c[0]:void 0;let u;c===!1?u="false":g?.includes("@changesets/changelog-github")?u='"github"':(g?.includes("@changesets/cli"),u='"default"');const o=[];let d=0;try{const p=await S(t);for(const h of p)!h.endsWith(".md")||h==="README.md"||o.push(h)}catch{}if(o.length>0){const p=l(e,".vis","release");let h=0;for(const b of o){const m=l(t,b),y=l(p,b);if(n){a.info(`[dry-run] would copy ${m} → ${y}`);continue}if(await k(y)){a.info(`Skipping existing ${v(e,y)}.`),h+=1;continue}const x=await $(m,"utf8");await w(y,x),d+=1}h>0&&a.info(`Skipped ${h} file(s) that already exist in .vis/release/.`)}a.info(`Found ${o.length} pending .changeset/*.md file(s); ${d>0?`copied ${d} to .vis/release/`:"(dry-run — would copy)"}.`),a.info(""),a.info("Suggested vis.config.ts release block:"),a.info(""),a.info(` release: {
45
+ baseBranch: ${JSON.stringify(r.baseBranch)},
46
+ access: ${JSON.stringify(r.access)},
47
+ defaultManaged: ${r.defaultManaged},
48
+ updateInternalDependencies: ${JSON.stringify(r.updateInternalDependencies)},
49
+ fixed: ${JSON.stringify(r.fixed)},
50
+ linked: ${JSON.stringify(r.linked)},
51
+ ignore: ${JSON.stringify(r.ignore)},
52
+ privatePackages: ${JSON.stringify(r.privatePackages)},
53
+ changelog: ${u},
54
+ publish: {
55
+ packManager: "auto",
56
+ publishStrategy: "npm-publish-tarball",
57
+ cleanPackageJson: true,
58
+ },
59
+ },`),a.info(""),a.info("After confirming the config, you can delete `.changeset/` (or run `vis release init --remove-changesets`).")},U=async(e,n,a)=>{const t=l(e,".bumpy"),s=l(t,"_config.json");let f={};try{f=JSON.parse(await $(s,"utf8"))}catch{a.warn(".bumpy/_config.json missing or unreadable; using defaults.")}const i=JSON.stringify(f,null,4).split(`
60
+ `).map(g=>` ${g}`).join(`
61
+ `),r=[];let c=0;try{const g=await S(t);for(const u of g)!u.endsWith(".md")||u==="README.md"||r.push(u)}catch{}if(r.length>0){const g=l(e,".vis","release");let u=0;for(const o of r){const d=l(t,o),p=l(g,o);if(n){a.info(`[dry-run] would copy ${d} → ${p}`);continue}if(await k(p)){a.info(`Skipping existing ${v(e,p)}.`),u+=1;continue}const h=await $(d,"utf8");await w(p,h),c+=1}u>0&&a.info(`Skipped ${u} file(s) that already exist in .vis/release/.`)}a.info(`Found ${r.length} pending .bumpy/*.md file(s); ${c>0?`copied ${c} to .vis/release/`:"(dry-run)"}.`),a.info(""),a.info("Suggested vis.config.ts release block (bumpy config translates 1:1):"),a.info(""),a.info(` release: ${i.trimStart()},`),a.info(""),a.info("After confirming, delete `.bumpy/`.")},q=async(e,n,a,t)=>{const s=l(e,".husky","pre-commit");if(!await k(s))return;const f=await $(s,"utf8").catch(()=>"");if(f.includes("vis release check"))return;const i="vis release check --hook pre-commit --no-fail";if(!await(async()=>{if(!process.stdout.isTTY||process.env.CI==="true")return!1;if(a)return!0;try{const{confirmPrompt:c}=await import("./prompts.js");return await c(`Wire \`${i}\` into your .husky/pre-commit hook?`,!0)}catch{return!1}})()){t.info(""),t.info("Optional: add this line to .husky/pre-commit:"),t.info(` ${i}`);return}if(n){t.info(`[dry-run] would append \`${i}\` to .husky/pre-commit`);return}const r=`${f.replace(/\n*$/,`
62
+ `)}${i}
63
+ `;await w(s,r),t.info("Wired vis release check into .husky/pre-commit.")},G=async(e,n,a,t)=>{const s=a.workflows===!0,f=a.yes===!0;if(!s&&(!process.stdout.isTTY||process.env.CI==="true"))return;if(!(s||f||await(async()=>{try{const{confirmPrompt:m}=await import("./prompts.js");return await m("Generate CI workflow files for the active provider?",!0)}catch{return!1}})())){t.info(""),t.info("Skipped workflow generation. Re-run with `vis release init --workflows` later.");return}const{detectRemoteProvider:i}=await import("./detect2.js"),{generateWorkflowFiles:r}=await import("./workflow-templates.js"),{detectPackageManager:c}=await import("../packem_shared/createAdapter-bU4DIP3F.js"),{createShellRunner:g}=await import("./shell-runner.js"),u=g(),o=await i(e,u,void 0),d=await c(e,u),p=a.packageManager??d;let h={};try{const{loadVisConfig:m}=await import("../packem_shared/CONFIG_FILES-BfaR0jKT.js"),y=await m(e);y.release&&(h=y.release)}catch{}const b=r(h,{packageManager:p,provider:o});t.info(""),t.info(`Generating ${b.length} workflow file(s) for ${o}:`);for(const m of b){const y=l(e,m.path);if(await k(y)){t.warn(` ${m.path} — already exists, skipping`);continue}if(n){t.info(` ${m.path} — [dry-run] would write ${m.content.length} bytes`);continue}const x=await import("node:path");await J(x.dirname(y),{recursive:!0}),await w(y,m.content),t.info(` ${m.path} — wrote ${m.content.length} bytes`)}},V=e=>{e.info(""),e.info("Suggested vis.config.ts release block:"),e.info(""),e.info(` release: {
64
+ baseBranch: "main",
65
+ defaultManaged: true,
66
+ channels: {
67
+ main: { tag: "latest", mode: "version-pr" },
68
+ },
69
+ publish: {
70
+ packManager: "auto",
71
+ publishStrategy: "npm-publish-tarball",
72
+ publishArgs: ["--provenance"],
73
+ cleanPackageJson: true,
74
+ },
75
+ },`)};export{z as default};
@@ -1,4 +1,4 @@
1
- import{createRequire as b}from"node:module";import{h as _,k as O,c as j}from"./bin.js";import{w as E}from"../packem_shared/pm-runner-pVihAfxV.js";import{l as R}from"../packem_shared/dependency-scan-BDTH898x.js";import{r as I}from"../packem_shared/provenance-DMuEftgc.js";import{r as P}from"../packem_shared/signatures-D1H6h6GH.js";import{loadOptionalSigstore as C}from"./loader.js";const N=b(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=r=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[o,t]=u.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return u.getBuiltinModule(r)}return N(r)},{createHash:S}=$("node:crypto"),{isAbsolute:k,resolve:y,basename:v}=$("node:path"),T=r=>(r??"").split(",").map(o=>o.trim()).filter(o=>o.length>0),K=async({logger:r,options:o,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=o.format??"table",c=o.prodOnly??!1,p=o.failOn==="error"?"error":"warning",l=T(o.allowlist),a=E(t),d=R(t,a.name,{includeDev:!c}).map(({name:e,version:n})=>({name:e,version:n})),[m,g]=await Promise.all([I(d,{allowlist:l,workspaceRoot:t}),P(d,{allowlist:l,workspaceRoot:t})]),s=[...m.map(e=>({code:"provenance-regression",message:`Resolved ${e.packageName}@${e.version} has no published provenance attestation, but ${e.packageName}@${e.priorVersionWithProvenance} did — a provenance regression.`,packageName:e.packageName,severity:"warning",version:e.version})),...g.map(e=>({code:e.code,message:e.message,packageName:e.packageName,severity:e.severity,version:e.version}))],f=s.filter(e=>p==="error"?e.severity==="error":!0);if(i==="json")process.stdout.write(`${JSON.stringify({findings:s,ok:f.length===0},void 0,2)}
1
+ import{createRequire as b}from"node:module";import{h as _,k as O,d as j}from"./bin.js";import{w as E}from"../packem_shared/pm-runner-OGResYrA.js";import{l as R}from"../packem_shared/dependency-scan-anTuZB1t.js";import{r as I}from"../packem_shared/provenance-_CJjMKwu.js";import{r as P}from"../packem_shared/signatures-C730vkyK.js";import{loadOptionalSigstore as C}from"./loader.js";const N=b(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=r=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[o,t]=u.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return u.getBuiltinModule(r)}return N(r)},{createHash:S}=$("node:crypto"),{isAbsolute:k,resolve:y,basename:v}=$("node:path"),T=r=>(r??"").split(",").map(o=>o.trim()).filter(o=>o.length>0),K=async({logger:r,options:o,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=o.format??"table",c=o.prodOnly??!1,p=o.failOn==="error"?"error":"warning",l=T(o.allowlist),a=E(t),d=R(t,a.name,{includeDev:!c}).map(({name:e,version:n})=>({name:e,version:n})),[m,g]=await Promise.all([I(d,{allowlist:l,workspaceRoot:t}),P(d,{allowlist:l,workspaceRoot:t})]),s=[...m.map(e=>({code:"provenance-regression",message:`Resolved ${e.packageName}@${e.version} has no published provenance attestation, but ${e.packageName}@${e.priorVersionWithProvenance} did — a provenance regression.`,packageName:e.packageName,severity:"warning",version:e.version})),...g.map(e=>({code:e.code,message:e.message,packageName:e.packageName,severity:e.severity,version:e.version}))],f=s.filter(e=>p==="error"?e.severity==="error":!0);if(i==="json")process.stdout.write(`${JSON.stringify({findings:s,ok:f.length===0},void 0,2)}
2
2
  `);else if(i==="ndjson")for(const e of s)process.stdout.write(`${JSON.stringify(e)}
3
3
  `);else if(s.length===0)r.info(`No provenance regressions or signature problems across ${String(d.length)} locked packages.`);else{const e=process.stdout.columns||80;r.info(_(O.createElement(j,{data:s.map(n=>({code:n.code,package:`${n.packageName}@${n.version}`,severity:n.severity}))}),{columns:e}));for(const n of s)r.warn(`${n.packageName}@${n.version}: ${n.message}`)}f.length>0&&(process.exitCode=1)},D=()=>process.env.CI==="true"||typeof process.env.ACTIONS_ID_TOKEN_REQUEST_URL=="string"||typeof process.env.SIGSTORE_ID_TOKEN=="string",q=(r,o,t)=>({_type:"https://in-toto.io/Statement/v1",predicate:{buildDefinition:{buildType:"https://visulima.com/vis/attest/v1",externalParameters:{workspaceRoot:t},internalParameters:{},resolvedDependencies:[]},runDetails:{builder:{id:"https://visulima.com/vis"},metadata:{invocationId:process.env.GITHUB_RUN_ID??"",startedOn:new Date().toISOString()}}},predicateType:"https://slsa.dev/provenance/v1",subject:[{digest:{sha256:o},name:r}]}),G=async({argument:r,fs:o,logger:t,options:i,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const p=r[0];if(!p)throw new Error("Missing subject. Usage: vis attest <path-to-artifact>");const l=i.predicate??"slsaProvenance";if(l!=="slsaProvenance")throw new Error(`Unsupported predicate '${l}'. Only 'slsaProvenance' is supported.`);const a=k(p)?p:y(c,p),d=i.requireSigning??!1,m=i.format??"table";let g;try{g=await o.readFile(a)}catch{throw new Error(`Cannot read subject artifact at ${a}.`)}const s=S("sha256").update(g).digest("hex");if(!D()){const h="No ambient OIDC token (not running in CI). Keyless signing needs a Fulcio identity from CI OIDC.";if(d)throw new Error(`${h} Re-run in CI or drop --require-signing.`);if(m==="json"){process.stdout.write(`${JSON.stringify({ok:!1,reason:"no-ambient-oidc",sha256:s,skipped:!0,subject:v(a)},void 0,2)}
4
4
  `);return}t.warn(`${h} Skipping signing (subject sha256: ${s}). Pass --require-signing to make this fatal.`);return}const f=q(v(a),s,c),e=Buffer.from(JSON.stringify(f)),n=await(await C({workspaceRoot:c})).attest(e,"application/vnd.in-toto+json"),w=i.output?k(i.output)?i.output:y(c,i.output):`${a}.sigstore`;if(await o.writeFile(w,`${JSON.stringify(n,void 0,2)}
@@ -1,61 +1,5 @@
1
- import{v as F,H as P,y as S,m as b,T as I,O as U,a as T}from"../packem_shared/index-BDmTbWX1.js";import{o as _}from"../packem_shared/index-CB4p298r.js";import{aL as C,b as M,aM as J,Y as q}from"./bin.js";import{n as B}from"../packem_shared/manifests-Dj3pRKBT.js";import{s as H}from"../packem_shared/glob-fqg4KepW-B7EjLRvw.js";const K=(e,t)=>{const o=t.replace(/^\.?\//,"");return o===""||o==="."?`/${e}/`:e===""||e==="."?`/${o}`:`/${e}/${o}`},v=(e,t,o=[])=>{const s=[],n=new Set;for(const[r,i]of Object.entries(t?.globalPaths??{}))s.push({owners:i,path:r,source:"project-json"}),n.add(r);for(const[r,i]of Object.entries(e.projects)){const a=i.owners??[];for(const c of a){const f=K(i.root??r,c.path);s.push({channel:c.channel,owners:c.owners,path:f,projectId:r,source:"project-json"}),n.add(f)}}for(const r of o)n.has(r.path)||(s.push(r),n.add(r.path));return(t?.orderBy??"file-source")==="project-id"?s.sort((r,i)=>(r.projectId??"").localeCompare(i.projectId??"")||r.path.localeCompare(i.path)):s.sort((r,i)=>r.path.localeCompare(i.path)),s},Y="Update each project's project.json `owners` field and re-run the command.",z=e=>["# CODEOWNERS generated by `vis sync codeowners`. Do not edit by hand.",e?`# Re-run with: ${e}`:`# ${Y}`,""],W=e=>{const t=[];for(const o of e){const s=o.owners.join(" "),n=o.channel?` # notify: ${o.channel}`:"";t.push(`${o.path} ${s}${n}`)}return t},Q=(e,t={})=>[...z(t.regenerationCommand),...W(e),""].join(`
2
- `),O={begin:"# BEGIN vis-codeowners",end:"# END vis-codeowners"},V=(e,t=O,o={})=>{const s=o.regenerationCommand?`# Generated by vis sync codeowners — re-run with: ${o.regenerationCommand}`:"# Generated by `vis sync codeowners` — do not edit by hand.";return[t.begin,s,...W(e),t.end].join(`
3
- `)},X=(e,t,o=O)=>{const s=e.indexOf(o.begin),n=e.indexOf(o.end);if(s!==-1&&n!==-1&&n>s){const i=e.slice(0,s),a=n+o.end.length,c=e.slice(a);return`${i}${t}${c}`}const r=e.replace(/\s+$/u,"");return`${r.length===0?"":`${r}
4
-
5
- `}${t}
6
- `},Z=["**/CODEOWNERS"],ee=["**/node_modules/**","**/dist/**","**/build/**","**/coverage/**","**/.git/**","**/.next/**","**/.nuxt/**"],te=e=>{const t=[];for(const o of e.split(/\r?\n/u)){const s=o.indexOf("#"),n=(s===-1?o:o.slice(0,s)).trim();if(n.length===0)continue;const r=n.split(/\s+/u);if(r.length<2)continue;const[i,...a]=r,c=a.filter(f=>f.length>0);!i||c.length===0||t.push({owners:c,path:i})}return t},oe=(e,t)=>{const o=t.replace(/^\.\/?/,"").replace(/\/$/,"");return e.startsWith("/")?o===""?e:`/${o}${e}`:o===""?`/${e}`:`/${o}/${e}`},ne=async(e,t,o)=>{const s=t&&t.length>0?[...t]:[...Z],n=[...ee];if(o){const a=o.replace(/^\.\/?/,"").replace(/^\/+/,"");a.length>0&&n.push(a)}const r=await H(s,{absolute:!0,cwd:e,ignore:n}),i=[];for(const a of r){let c;try{c=F(a)}catch{continue}const f=P(a),h=S(e,f);for(const p of te(c))i.push({owners:p.owners,path:oe(p.path,h)})}return i},re=/^(?:https?:\/\/)?(?:www\.)?github\.com\/([^/?#]+)/iu,se=e=>{if(!e)return;const t=e.match(re);if(!t?.[1])return;const o=t[1].trim();if(!(o===""||o.includes(" ")))return`@${o.replace(/^@/,"")}`},ae=(e,t)=>{const o=[];for(const[s,n]of Object.entries(e.projects)){if(n.owners&&n.owners.length>0)continue;const r=n.root??s,i=b(t,r,"package.json"),a=C(i);if(!a)continue;const c=B(a.maintainers);if(!c||c.length===0)continue;const f=[],h=new Set;for(const p of c){const $=se(p.url);$&&!h.has($)&&(h.add($),f.push($))}f.length!==0&&o.push({owners:f,path:r===""||r==="."?"/":`/${r}/`,projectId:s})}return o},ie=["author","bugs","homepage","license","repository","engines"],N=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),E=(e,t)=>{if(e===t)return!0;if(typeof e!=typeof t||e===null||t===null)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(const[o,s]of e.entries())if(!E(s,t[o]))return!1;return!0}if(typeof e=="object"&&typeof t=="object"){const o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(const n of o)if(!E(e[n],t[n]))return!1;return!0}return!1},R=e=>e===void 0?e:structuredClone(e),ce=(e,t,o)=>{if(e==="repository"&&N(t)&&N(o)){const s={};for(const[n,r]of Object.entries(t))n!=="directory"&&(s[n]=R(r));return typeof o.directory=="string"&&(s.directory=o.directory),s}return R(t)},de=(e,t,o)=>{const s=[];for(const n of o.fields){if(!Object.hasOwn(e,n))continue;const r=e[n],i=t[n],a=ce(n,r,i);E(a,i)||s.push({after:a,before:i,field:n,packageJsonPath:""})}return s},fe=(e,t)=>{for(const o of t)e[o.field]=o.after},x="Generated by `vis sync codeowners --write-guard`. Do not edit by hand.",le=e=>{const t=e.replace(/^\.?\/+/u,"").replace(/\/+$/u,"");return t===""||t==="."?"**":`${t}/**`},L=e=>{const t=new Set,o=[];for(const s of[...e].sort((n,r)=>n.name.localeCompare(r.name))){const n=le(s.root);t.has(n)||(t.add(n),o.push(n))}return o},pe=e=>{const t=L(e),o=t.map(n=>` - "${n}"`).join(`
7
- `),s=t.map(n=>` ${n}`).join(`
8
- `);return`# ${x}
9
- name: Write Guard
10
-
11
- on:
12
- pull_request:
13
- paths:
14
- ${o}
15
-
16
- permissions:
17
- contents: read
18
- pull-requests: read
19
-
20
- jobs:
21
- write-guard:
22
- runs-on: ubuntu-latest
23
- steps:
24
- - uses: actions/checkout@v4
25
- with:
26
- fetch-depth: 0
27
- - uses: geritol/write-guard@v1
28
- with:
29
- codeowners: CODEOWNERS
30
- paths: |
31
- ${s}
32
- `},ue=e=>{const t=L(e).map(o=>` - "${o}/*"`).join(`
33
- `);return`# ${x}
34
- #
35
- # SOFT GUARD ONLY — this job does NOT block a merge by itself.
36
- # It verifies the generated CODEOWNERS is in sync and flags that a
37
- # restricted path changed. GitLab CI cannot portably gate a merge on
38
- # code-owner *approval* from a job, so REAL ENFORCEMENT REQUIRES the
39
- # native GitLab setting:
40
- # Settings -> Repository -> Protected branches ->
41
- # "Require approval from Code Owners" (GitLab Premium / Ultimate)
42
- # https://docs.gitlab.com/ee/user/project/codeowners/
43
- # Without that setting enabled, this job is advisory only.
44
- write-guard:
45
- stage: test
46
- image: node:22-alpine
47
- rules:
48
- - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
49
- changes:
50
- ${t}
51
- script:
52
- - corepack enable
53
- - pnpm install --frozen-lockfile
54
- - pnpm vis sync codeowners --check
55
- - >-
56
- echo "SOFT GUARD: a restricted path changed. This job does NOT enforce
57
- code-owner approval. Enable 'Require approval from Code Owners' on the
58
- protected branch (GitLab Premium/Ultimate) for a real merge gate:
59
- https://docs.gitlab.com/ee/user/project/codeowners/"
60
- `},he=e=>e.length===0?[]:[{content:pe(e),path:".github/workflows/write-guard.yml"},{content:ue(e),path:".gitlab/write-guard.gitlab-ci.yml"}],D=new Set(["nested-codeowners","package-json-maintainers","project-json"]),A=(e,t,o)=>{const s=new Set,n=[];for(const r of e??[])for(const i of r.split(",")){const a=i.trim();if(a.length===0)continue;if(o&&!o(a))throw new Error(`Unknown codeowners source: "${a}". Known: ${[...D].join(", ")}.`);const c=a;s.has(c)||(s.add(c),n.push(c))}return n.length>0?n:[...t]},ge=e=>D.has(e),G=["codeowners","package-json-fields"],me=(e,t)=>t.some(o=>_(o,e)),we=async(e,t,o,s,n)=>{const r=Object.entries(s.projects).filter(([,a])=>a.restricted===!0).map(([a,c])=>({name:a,root:c.root??a})),i=he(r);if(i.length===0){t.info("No projects flagged `restricted: true` in project.json. Skipping Write Guard.");return}if(n){let a=!1;for(const c of i){const f=b(o,c.path);let h="";try{h=await e.readFile(f,"utf8")}catch(p){if(p.code!=="ENOENT")throw p}h.trim()!==c.content.trim()&&(t.error(`${c.path} is out of date. Run \`vis sync codeowners --write-guard\` to update it.`),a=!0)}a?process.exitCode=1:t.info(`Write Guard CI is up to date (${i.length} files, ${r.length} restricted projects).`);return}for(const a of i){const c=b(o,a.path);T(P(c)),I(c,a.content),t.info(`Wrote ${a.path}`)}t.info(`Write Guard CI scoped to ${r.length} restricted project${r.length===1?"":"s"}.`)},$e=async({fs:e,logger:t,options:o,visConfig:s,workspaceRoot:n})=>{const r=n,{workspace:i}=M(r,s),a=s?.codeowners;o.writeGuard===!0&&await we(e,t,r,i,o.check===!0);const c=A(o.from,a?.sources??["project-json"],ge),f=o.regenerationCommand??a?.regenerationCommand,h=o.preserveBlock===!0||a?.preserveBlock===!0,p=a?.blockMarker??O,$=o.nestedIncludes??a?.nestedIncludes,g=o.out??"CODEOWNERS",w=[];if(c.includes("nested-codeowners")){const m=await ne(r,$,g);for(const j of m)w.push({...j,source:"nested"})}if(c.includes("package-json-maintainers")){const m=ae(i,r);for(const j of m)w.push({...j,source:"maintainers"})}const l=c.includes("project-json")?v(i,a,w):v({projects:{}},a,w);if(l.length===0){t.info("No `owners` entries found in any source. Nothing to sync.");return}const y=b(r,g);let d="";try{d=await e.readFile(y,"utf8")}catch(m){if(m.code!=="ENOENT")throw m}const u={regenerationCommand:f},k=h?X(d,V(l,p,u),p):Q(l,u);if(o.check){if(d.trim()!==k.trim()){t.error(`${y} is out of date. Run \`vis sync codeowners\` to update it.`),process.exitCode=1;return}t.info(`${y} is up to date.`);return}I(y,k),t.info(`Wrote ${l.length} entries to ${y}`)},ke=({logger:e,options:t,visConfig:o,workspaceRoot:s})=>{const n=s,r=o?.editorconfig??!0,i=C(b(n,"package.json"));if(!i){e.error("Could not read root package.json. Nothing to sync."),process.exitCode=1;return}const a=A(t.fields,ie),c=t.ignorePackageName??[],f=t.check===!0,h=(t.format??"human").toLowerCase(),p=t.quiet===!0,$=J(n).filter(d=>d!=="."),g=[];let w=0;for(const d of $){const u=b(n,d,"package.json"),k=C(u);if(!k)continue;const m=typeof k.name=="string"?k.name:void 0;if(m!==void 0&&c.length>0&&me(m,c))continue;w+=1;const j=de(i,k,{fields:a});j.length!==0&&g.push({filePath:u,packageJsonPath:S(n,u),packageName:m,pkg:k,pkgChanges:j})}if(!f)for(const d of g)fe(d.pkg,d.pkgChanges),U(d.filePath,d.pkg,{indent:q(d.filePath,{useEditorconfig:r}),overwrite:!0});const l=g.flatMap(d=>d.pkgChanges.map(u=>({after:u.after,before:u.before,field:u.field,packageJsonPath:d.packageJsonPath,packageName:d.packageName}))),y={changes:l,fields:a,kind:"package-json-fields",mode:f?"check":"write",totalChanges:l.length,totalPackages:w};if(h==="json")process.stdout.write(`${JSON.stringify(y,null,4)}
61
- `);else if(l.length===0)e.info(`All ${w} package${w===1?"":"s"} in sync (fields: ${a.join(", ")}).`);else if(f){if(!p)for(const d of l)e.error(`${d.packageJsonPath}: ${d.field} drifts from root`);e.error(`Found ${l.length} field drift${l.length===1?"":"s"} across ${g.length} package${g.length===1?"":"s"}. Run \`vis sync package-json-fields\` to fix.`)}else{if(!p)for(const d of g)e.info(`${d.packageJsonPath}: synced ${d.pkgChanges.map(u=>u.field).join(", ")}`);e.info(`Synced ${l.length} field${l.length===1?"":"s"} across ${g.length} package${g.length===1?"":"s"}.`)}f&&l.length>0&&(process.exitCode=1)},Oe=async e=>{const t=e.argument[0];if(!t)throw new Error(`Missing sync kind. Usage: vis sync <kind> (known kinds: ${G.join(", ")})`);if(!e.workspaceRoot)throw new Error("Could not determine workspace root. Run inside a monorepo.");if(t==="codeowners"){await $e(e);return}if(t==="package-json-fields"){ke(e);return}throw new Error(`Unknown sync kind: "${t}". Known kinds: ${G.join(", ")}.`)};export{Oe as default};
1
+ import{b as d}from"./orchestrator.js";const k=async({logger:c,options:o,workspaceRoot:p})=>{const l=p??process.cwd(),t=await d({channel:o.channel,cwd:l,firstRelease:o.firstRelease===!0,skipRegistryLookup:!0}),{printConfigIfRequested:f}=await import("./print-config.js");if(f(o,t,c))return;const s=o.package,i=s?t.plan.releases.filter(e=>e.name===s):t.plan.releases;if(i.length===0){if(s!==void 0&&s!==""){const e=new Set(t.plan.releases.map(a=>a.name)).has(s),r=t.packages.some(a=>a.name===s);let n;if(e)n=`release plan unexpectedly empty for "${s}"`;else if(r)n=`package "${s}" is in the workspace but has no pending release (no change file targets it).`;else{const a=t.packages.slice(0,5).map(u=>u.name).join(", "),m=a?` Known workspace packages: ${a}${t.packages.length>5?", …":""}.`:"";n=`package "${s}" is not in this workspace.${m}`}c.error(`--package filter matched no releases: ${n}`),o.json&&process.stdout.write(`${JSON.stringify({error:n},null,2)}
2
+ `),process.exitCode=1;return}o.json&&process.stdout.write(`{}
3
+ `);return}if(o.json){const e={};for(const r of i)e[r.name]={from:r.oldVersion,to:r.newVersion};process.stdout.write(`${JSON.stringify(e,null,2)}
4
+ `);return}const g=[...i].sort((e,r)=>e.name.localeCompare(r.name));for(const e of g)process.stdout.write(`${e.name} ${e.oldVersion} -> ${e.newVersion}
5
+ `)};export{k as default};