@visulima/vis 1.0.0-alpha.40 → 1.0.0-alpha.42

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 (199) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/LICENSE.md +265 -35
  3. package/dist/bin.js +1 -1
  4. package/dist/binx.js +2 -2
  5. package/dist/config/index.d.ts +19 -1
  6. package/dist/config/index.js +1 -1
  7. package/dist/packem_chunks/bloom-status.js +1 -1
  8. package/dist/packem_chunks/bloom-sync.js +1 -1
  9. package/dist/packem_chunks/cli-exec.js +1 -0
  10. package/dist/packem_chunks/{bin.js → cli-main.js} +282 -274
  11. package/dist/packem_chunks/config.js +8 -11
  12. package/dist/packem_chunks/devtools.js +1 -78
  13. package/dist/packem_chunks/dispatch.js +4 -0
  14. package/dist/packem_chunks/doctor-probe.js +1 -1
  15. package/dist/packem_chunks/fix.js +1 -1
  16. package/dist/packem_chunks/handler.js +1 -1
  17. package/dist/packem_chunks/handler10.js +1 -1
  18. package/dist/packem_chunks/handler11.js +1 -1
  19. package/dist/packem_chunks/handler12.js +1 -1
  20. package/dist/packem_chunks/handler13.js +3 -3
  21. package/dist/packem_chunks/handler14.js +1 -1
  22. package/dist/packem_chunks/handler15.js +1 -1
  23. package/dist/packem_chunks/handler16.js +1 -1
  24. package/dist/packem_chunks/handler17.js +1 -1
  25. package/dist/packem_chunks/handler18.js +1 -1
  26. package/dist/packem_chunks/handler19.js +1 -1
  27. package/dist/packem_chunks/handler2.js +1 -4
  28. package/dist/packem_chunks/handler20.js +1 -1
  29. package/dist/packem_chunks/handler21.js +1 -1
  30. package/dist/packem_chunks/handler22.js +2 -2
  31. package/dist/packem_chunks/handler23.js +5 -1
  32. package/dist/packem_chunks/handler24.js +1 -1
  33. package/dist/packem_chunks/handler25.js +1 -1
  34. package/dist/packem_chunks/handler26.js +1 -5
  35. package/dist/packem_chunks/handler27.js +5 -1
  36. package/dist/packem_chunks/handler28.js +1 -3
  37. package/dist/packem_chunks/handler29.js +3 -1
  38. package/dist/packem_chunks/handler3.js +1 -4
  39. package/dist/packem_chunks/handler30.js +1 -2
  40. package/dist/packem_chunks/handler31.js +1 -2
  41. package/dist/packem_chunks/handler32.js +2 -2
  42. package/dist/packem_chunks/handler33.js +2 -3
  43. package/dist/packem_chunks/handler34.js +2 -6
  44. package/dist/packem_chunks/handler35.js +3 -1
  45. package/dist/packem_chunks/handler36.js +6 -42
  46. package/dist/packem_chunks/handler37.js +1 -8
  47. package/dist/packem_chunks/handler38.js +42 -9
  48. package/dist/packem_chunks/handler39.js +7 -74
  49. package/dist/packem_chunks/handler4.js +4 -6
  50. package/dist/packem_chunks/handler40.js +9 -5
  51. package/dist/packem_chunks/handler41.js +75 -4
  52. package/dist/packem_chunks/handler42.js +5 -3
  53. package/dist/packem_chunks/handler43.js +4 -2
  54. package/dist/packem_chunks/handler44.js +3 -1
  55. package/dist/packem_chunks/handler45.js +2 -1
  56. package/dist/packem_chunks/handler46.js +1 -1
  57. package/dist/packem_chunks/handler47.js +1 -3
  58. package/dist/packem_chunks/handler48.js +1 -1
  59. package/dist/packem_chunks/handler49.js +3 -7
  60. package/dist/packem_chunks/handler5.js +4 -8
  61. package/dist/packem_chunks/handler50.js +1 -33
  62. package/dist/packem_chunks/handler51.js +7 -3
  63. package/dist/packem_chunks/handler52.js +33 -8
  64. package/dist/packem_chunks/handler53.js +3 -4
  65. package/dist/packem_chunks/handler54.js +8 -1
  66. package/dist/packem_chunks/handler55.js +4 -12
  67. package/dist/packem_chunks/handler56.js +1 -7
  68. package/dist/packem_chunks/handler57.js +12 -5
  69. package/dist/packem_chunks/handler58.js +5 -11
  70. package/dist/packem_chunks/handler59.js +11 -3
  71. package/dist/packem_chunks/handler6.js +6 -1
  72. package/dist/packem_chunks/handler60.js +3 -22
  73. package/dist/packem_chunks/handler61.js +21 -60
  74. package/dist/packem_chunks/handler62.js +61 -3
  75. package/dist/packem_chunks/handler63.js +3 -6
  76. package/dist/packem_chunks/handler64.js +6 -708
  77. package/dist/packem_chunks/handler65.js +8 -23
  78. package/dist/packem_chunks/handler66.js +24 -25
  79. package/dist/packem_chunks/handler67.js +25 -153
  80. package/dist/packem_chunks/handler68.js +153 -10
  81. package/dist/packem_chunks/handler69.js +10 -24
  82. package/dist/packem_chunks/handler7.js +8 -1
  83. package/dist/packem_chunks/handler70.js +24 -322
  84. package/dist/packem_chunks/handler71.js +322 -48
  85. package/dist/packem_chunks/handler72.js +700 -19
  86. package/dist/packem_chunks/handler73.js +48 -3
  87. package/dist/packem_chunks/handler74.js +21 -184
  88. package/dist/packem_chunks/handler75.js +3 -38
  89. package/dist/packem_chunks/handler76.js +190 -0
  90. package/dist/packem_chunks/handler77.js +38 -0
  91. package/dist/packem_chunks/handler8.js +1 -1
  92. package/dist/packem_chunks/handler9.js +1 -1
  93. package/dist/packem_chunks/heal-accept.js +1 -1
  94. package/dist/packem_chunks/heal.js +1 -1
  95. package/dist/packem_chunks/help-command.js +4 -4
  96. package/dist/packem_chunks/index2.js +1 -1
  97. package/dist/packem_chunks/index3.js +135 -0
  98. package/dist/packem_chunks/index4.js +74 -0
  99. package/dist/packem_chunks/keys-refresh.js +1 -1
  100. package/dist/packem_chunks/lean.js +4 -0
  101. package/dist/packem_chunks/list.js +1 -1
  102. package/dist/packem_chunks/loader.js +1 -1
  103. package/dist/packem_chunks/loader2.js +1 -1
  104. package/dist/packem_chunks/orchestrator.js +3 -3
  105. package/dist/packem_chunks/prompts.js +1 -1
  106. package/dist/packem_chunks/prune.js +1 -1
  107. package/dist/packem_chunks/registry.js +2 -2
  108. package/dist/packem_chunks/run.js +1 -1
  109. package/dist/packem_chunks/shell-runner.js +1 -1
  110. package/dist/packem_chunks/status.js +1 -1
  111. package/dist/packem_chunks/sync.js +1 -1
  112. package/dist/packem_chunks/sync2.js +1 -1
  113. package/dist/packem_chunks/tar.js +1 -1
  114. package/dist/packem_chunks/tripwire.js +1 -1
  115. package/dist/packem_chunks/ts-loader.js +2 -0
  116. package/dist/packem_chunks/verify-lockfile.js +1 -1
  117. package/dist/packem_chunks/version-resolver.js +2 -2
  118. package/dist/packem_shared/CONFIG_FILES-MsOntfYT.js +1 -0
  119. package/dist/packem_shared/{Table-CcVkyULl-B_ef6zfS.js → Table-CcVkyULl-DLWu6XHL.js} +25 -26
  120. package/dist/packem_shared/{advisories-DLeO5KMN.js → advisories-aiDtubZQ.js} +1 -1
  121. package/dist/packem_shared/{affected-shas-cVnX8-zs.js → affected-shas-C1XuRlvo.js} +1 -1
  122. package/dist/packem_shared/{ai-analysis-BUeX2J2H.js → ai-analysis-CubpCxZJ.js} +4 -4
  123. package/dist/packem_shared/{ai-fix-9Vzlp6XU.js → ai-fix-Btd5AnSr.js} +2 -2
  124. package/dist/packem_shared/augment-8fIWWGSc.js +3 -0
  125. package/dist/packem_shared/bin-CnDBuLh3.js +2 -0
  126. package/dist/packem_shared/build-scripts-Doxce2VM.js +1 -0
  127. package/dist/packem_shared/command-runtime-RiCMa2C8.js +1 -0
  128. package/dist/packem_shared/compile-cache-B_Vf_WxT.js +3 -0
  129. package/dist/packem_shared/{cyclonedx-kYozDyxp.js → cyclonedx-NUJ9R2GQ.js} +1 -1
  130. package/dist/packem_shared/dependency-scan-B0HV_qeB.js +1 -0
  131. package/dist/packem_shared/{docker-BMLrNtWm.js → docker-DKlF-gk3.js} +1 -1
  132. package/dist/packem_shared/failure-log-C7r6UZLP.js +2 -0
  133. package/dist/packem_shared/{giget-DHY1sQZC.js → giget-DVTFJlbR.js} +2 -2
  134. package/dist/packem_shared/glob-fqg4KepW-7Bs2kZuM.js +1 -0
  135. package/dist/packem_shared/index-BKFEWXU_.js +1 -0
  136. package/dist/packem_shared/index-CPhv-r4c.js +28 -0
  137. package/dist/packem_shared/{index-CgcF6_wo.js → index-Cb4x6lWY.js} +1 -1
  138. package/dist/packem_shared/index-DjTWo3sH.js +1 -0
  139. package/dist/packem_shared/{index-BDmTbWX1.js → index-OQZQyN5R.js} +1 -1
  140. package/dist/packem_shared/index.server-J83sowC4.js +2 -0
  141. package/dist/packem_shared/{lifecycle-4z9hHE5b.js → lifecycle-D5roTh0a.js} +2 -2
  142. package/dist/packem_shared/{lockfile-C8Q1_4KK.js → lockfile-DIGyLfmF.js} +1 -1
  143. package/dist/packem_shared/main-B3juSU5z.js +1 -0
  144. package/dist/packem_shared/manifests-pLwnVmCN.js +1 -0
  145. package/dist/packem_shared/{min-release-age-D1alDE3K.js → min-release-age-pUAqTiv3.js} +3 -3
  146. package/dist/packem_shared/missing-package-json-DhYzuKhD.js +1 -0
  147. package/dist/packem_shared/{native-config-sync-BEkJW7g3.js → native-config-sync-4K9wWTj5.js} +1 -1
  148. package/dist/packem_shared/{osv-bloom-B03tUWf3.js → osv-bloom-OuTfu_LE.js} +1 -1
  149. package/dist/packem_shared/{pm-runner-OGResYrA.js → pm-runner-Dws_Bw1y.js} +1 -1
  150. package/dist/packem_shared/provenance-C0P-UYOM.js +1 -0
  151. package/dist/packem_shared/readJsonSync-CvkZyKmL-CY7PZob_.js +4 -0
  152. package/dist/packem_shared/registry-keys-D4chF-Wj.js +1 -0
  153. package/dist/packem_shared/{resolve-explicit-CMDl55Nz.js → resolve-explicit-Cgheka3B.js} +3 -3
  154. package/dist/packem_shared/resolve-runtime-CJSWV-K8.js +1 -0
  155. package/dist/packem_shared/run-file-B4TqKa0X.js +1 -0
  156. package/dist/packem_shared/runtime-check-0lUJvgKt.js +1 -0
  157. package/dist/packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js +1 -0
  158. package/dist/packem_shared/s1ngularity-Du1NnSFP.js +1 -0
  159. package/dist/packem_shared/scan-progress-CN9ONR0y.js +2 -0
  160. package/dist/packem_shared/{selectors-GCJIe342.js → selectors-UmnAuc26.js} +1 -1
  161. package/dist/packem_shared/{signatures-C730vkyK.js → signatures-BOUhghTv.js} +1 -1
  162. package/dist/packem_shared/{spinner-CV3WVJLv.js → spinner-lhXugSx3.js} +1 -1
  163. package/dist/packem_shared/tabs-DTiU3usb.js +1 -0
  164. package/dist/packem_shared/target-options-ChWcK60i.js +1 -0
  165. package/dist/packem_shared/toolchain-DyCKnGch.js +5 -0
  166. package/dist/packem_shared/typosquats-DBOvXwph.js +1 -0
  167. package/dist/packem_shared/use-measured-height-CK2Co3XI.js +1 -0
  168. package/dist/packem_shared/verify-CVPYlUrF.js +1 -0
  169. package/dist/packem_shared/vis-update-app-DtHkwBca.js +1 -0
  170. package/dist/packem_shared/watch-Bkp_AAbc.js +1 -0
  171. package/dist/packem_shared/watch-loop-D9zbXzRd.js +11 -0
  172. package/dist/runtime/preload.d.ts +1 -0
  173. package/dist/runtime/preload.js +1 -0
  174. package/index.d.ts +14 -0
  175. package/index.js +28 -27
  176. package/package.json +18 -27
  177. package/schemas/vis-config.schema.json +12 -0
  178. package/dist/packem_shared/CONFIG_FILES-BfaR0jKT.js +0 -1
  179. package/dist/packem_shared/build-scripts-CCCi8U66.js +0 -1
  180. package/dist/packem_shared/dependency-scan-DnTgYleU.js +0 -1
  181. package/dist/packem_shared/failure-log-CEWP3bP0.js +0 -2
  182. package/dist/packem_shared/glob-fqg4KepW-B7EjLRvw.js +0 -1
  183. package/dist/packem_shared/index-Du8RWawQ.js +0 -1
  184. package/dist/packem_shared/index-yBikBkHT.js +0 -30
  185. package/dist/packem_shared/manifests-Dj3pRKBT.js +0 -1
  186. package/dist/packem_shared/missing-package-json-8vNHwbqw.js +0 -1
  187. package/dist/packem_shared/provenance-_CJjMKwu.js +0 -1
  188. package/dist/packem_shared/registry-keys-BfFto6vI.js +0 -1
  189. package/dist/packem_shared/runtime-check-Stc9AI78.js +0 -1
  190. package/dist/packem_shared/s1ngularity-Dhr3bPk0.js +0 -1
  191. package/dist/packem_shared/scan-progress-CFhc0CMj.js +0 -2
  192. package/dist/packem_shared/tabs-BuTy5gPV.js +0 -1
  193. package/dist/packem_shared/toolchain-pR7AJ-tB.js +0 -5
  194. package/dist/packem_shared/typosquats-DN78xx1x.js +0 -1
  195. package/dist/packem_shared/use-measured-height-_eVGWtWt.js +0 -1
  196. package/dist/packem_shared/verify-6WCmFmy8.js +0 -1
  197. package/dist/packem_shared/vis-update-app-k3fDxech.js +0 -1
  198. package/dist/packem_shared/watch-BvIwLG4N.js +0 -1
  199. package/dist/packem_shared/watch-loop-DWkvv2tK.js +0 -11
@@ -1,4 +1,75 @@
1
- import{createRequire as k}from"node:module";import{b as N}from"./orchestrator.js";import{createShellRunner as v}from"./shell-runner.js";const b=k(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[o,r]=g.versions.node.split(".").map(Number);if(o>22||o===22&&r>=3||o===20&&r>=16)return g.getBuiltinModule(e)}return b(e)},{resolve:A}=$("node:path"),x=["test"],C=e=>e===void 0||e===""?"test":x.includes(e)?e:void 0,w=e=>e==null?[]:Array.isArray(e)?e:[e],S=async(e,o)=>{const r=v();let i,n;try{const{createRemoteClient:u,detectRemoteProvider:l}=await import("./detect2.js"),c=await l(o,r,void 0);i=await u(c,{}).detectRepoSlug(o,r)}catch{}try{n=JSON.parse(await e.readFile(`${o}/package.json`,"utf8")).name}catch{}const p=n?`${n.startsWith("@")?n:`@${n}`}/example`:"@scope/example",s=i?`https://github.com/${i}/releases/tag/v1.0.0`:"https://github.com/example/example/releases/tag/v1.0.0";return{channel:"latest",completedAt:new Date().toISOString(),...n===void 0?{}:{monorepoName:n},published:[{name:p,tag:"latest",url:s,version:"1.0.0"}],...i===void 0?{}:{repo:i},skipped:[]}},j=(e,o)=>o?o.includes(":")?e===o:e===o||e.startsWith(`${o}:`):!0,_=async e=>{const o=[],r=[];if(!e)return{channels:o,pluginFailures:r};const{SlackNotificationChannel:i}=await import("./slack.js");for(const s of w(e.slack))o.push(new i(s));const{DiscordNotificationChannel:n}=await import("./discord.js");for(const s of w(e.discord))o.push(new n(s));const{WebhookNotificationChannel:p}=await import("./webhook.js");for(const s of w(e.webhook))o.push(new p(s));if(e.plugins&&e.plugins.length>0){const{pathToFileURL:s}=await import("node:url"),{dynamicEsmImport:u}=await import("./dynamic-import.js");for(const l of e.plugins){const[c,h]=Array.isArray(l)?l:[l,void 0],m=c;try{const d=c.startsWith(".")?s(`${process.cwd()}/${c}`).href:c,f=await u(d),t=f.default??f;let a;typeof t=="function"?a=t(h):t&&typeof t=="object"&&typeof t.send=="function"&&(a=t),a&&typeof a=="object"&&typeof a.send=="function"?o.push(a):r.push({error:"did not export a NotificationChannel (object with .send) or a factory returning one",id:m})}catch(d){r.push({error:d.message,id:m})}}}return{channels:o,pluginFailures:r}},R=async(e,o)=>{try{return await e.send(o),{id:e.id,ok:!0}}catch(r){const i=r instanceof Error?r.message:String(r),{redactTokens:n}=await import("./security.js");return{error:n(i),id:e.id,ok:!1}}},F=async(e,o)=>{const r=A(process.cwd(),o),i=await e.readFile(r,"utf8"),n=JSON.parse(i);return{channel:n.channel,completedAt:n.completedAt??new Date().toISOString(),...n.monorepoName===void 0?{}:{monorepoName:n.monorepoName},published:Array.isArray(n.published)?n.published:[],...n.repo===void 0?{}:{repo:n.repo},skipped:Array.isArray(n.skipped)?n.skipped:[]}},D=async({fs:e,logger:o,options:r,workspaceRoot:i})=>{const n=i??process.cwd();if(C(r.action)===void 0){o.error(`Unknown action "${r.action}". Expected: test.`),process.exitCode=1;return}let p;try{p=await N({cwd:n,skipRegistryLookup:!0})}catch(t){o.error(`Failed to load release context: ${t instanceof Error?t.message:String(t)}`),process.exitCode=1;return}const s=p.config.notifications;if(!(s&&(s.slack&&(!Array.isArray(s.slack)||s.slack.length>0)||s.discord&&(!Array.isArray(s.discord)||s.discord.length>0)||s.webhook&&(!Array.isArray(s.webhook)||s.webhook.length>0)||s.plugins&&s.plugins.length>0))){const t={channels:[],hint:"No notifications configured. Add `release.notifications.{slack,discord,webhook,plugins}` to vis.config.ts.",ok:!0};r.json?process.stdout.write(`${JSON.stringify(t,null,2)}
2
- `):o.info(t.hint);return}let u;try{u=r.customContext?await F(e,r.customContext):await S(e,n)}catch(t){o.error(`Could not load NotificationContext: ${t.message}`),process.exitCode=1;return}const{channels:l,pluginFailures:c}=await _(s),h=r.channel,m=l.filter(t=>j(t.id,h));if(m.length===0&&c.length===0){const t=h?`No channels matched filter "${h}". Configured ids: ${l.map(a=>a.id).join(", ")||"(none)"}.`:"No channels could be materialised from the configured notifications block.";r.json?process.stdout.write(`${JSON.stringify({channels:[],hint:t,ok:!1},null,2)}
3
- `):o.error(t),process.exitCode=1;return}const d=[...await Promise.all(m.map(t=>R(t,u))),...c.map(t=>({error:`plugin load failed: ${t.error}`,id:t.id,ok:!1}))],f=d.filter(t=>!t.ok);if(r.json)process.stdout.write(`${JSON.stringify({channels:d,ok:f.length===0},null,2)}
4
- `);else{for(const y of d)y.ok?o.info(` ${y.id} OK`):o.error(` ${y.id} FAIL — ${y.error??"unknown error"}`);const t=d.length,a=t-f.length;o.info(""),o.info(`Dispatched ${a}/${t} channel${t===1?"":"s"}.`)}f.length>0&&(process.exitCode=1)};export{D as default};
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";
35
+
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-MsOntfYT.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,3 +1,5 @@
1
- import{createRequire as y}from"node:module";import{DEFAULT_CHANGES_DIR as j}from"./DEFAULT_CLEAN_KEEP.js";import{b as C,f as T}from"./orchestrator.js";import{a as x}from"../packem_shared/slug-DoueYuLo.js";import B from"./handler43.js";const k=y(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[t,o]=l.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return l.getBuiltinModule(e)}return k(e)},{join:h}=_("node:path"),f=["none","patch","minor","major"],g=(e,t)=>{const o=f.indexOf(e)+t;return f[Math.min(Math.max(o,0),f.length-1)]??e},v=e=>e.chosen!==e.release.type,R=(e,t)=>{const o=[];e.isCascadeBump&&o.push("cascade"),e.isGroupBump&&o.push("group"),e.isDependencyBump&&!e.isCascadeBump&&o.push("dep-bump");const r=o.length>0?` [${o.join(", ")}]`:"";return`${e.name}: ${e.oldVersion} ${e.newVersion} (${t})${r}`},q=async e=>{const{selectPrompt:t}=await import("./prompts.js");process.stdout.write(`
2
- ${R(e,e.type)}
3
- `);const o=await t("Action?",[{label:"accept (keep as-is)",value:"accept"},{label:"promote (bump up one level)",value:"promote"},{label:"demote (bump down one level)",value:"demote"},{label:"set explicitly (major | minor | patch | none)",value:"set"},{label:"skip this package",value:"skip"}]);return o==="promote"?g(e.type,1):o==="demote"?g(e.type,-1):o==="skip"?"none":o==="set"?t("Set bump level to?",[{label:"major",value:"major"},{label:"minor",value:"minor"},{label:"patch",value:"patch"},{label:"none (skip)",value:"none"}]):e.type},D=async e=>{const t=[];for(const o of e)t.push({chosen:await q(o),release:o});return t},N=async(e,t,o,r,c)=>{const i={};for(const s of r)s.chosen!=="none"&&(i[s.release.name]=s.chosen);const n=h(t,o,`${x("plan")}.md`),u={bumps:i};return await e.mkdir(h(t,o),{recursive:!0}),await e.writeFile(n,T(u,c)),n},S=async e=>{const{fs:t,logger:o,options:r,workspaceRoot:c}=e,i=c??process.cwd();if(!process.stdout.isTTY){o.error("--interactive requires a TTY. Drop the flag to get JSON output."),process.exitCode=1;return}const n=await C({channel:r.channel,cwd:i,skipRegistryLookup:!0}),{printConfigIfRequested:u}=await import("./print-config.js");if(u(r,n,o))return;const{releases:s}=n.plan;if(s.length===0){o.info("No pending releases.");return}n.channel&&o.info(`Channel: ${n.channel.tag}${n.channel.prerelease?` (preid: ${n.channel.prerelease})`:""} | mode: ${n.channel.mode}`),o.info(`Walking through ${s.length} pending release(s). Press Ctrl-C to abort.`);const p=await D(s),m=p.filter(a=>v(a)).length,w=p.filter(a=>a.chosen==="none").length;o.info(""),o.info("Summary:");for(const a of p){const d=v(a)?` (was ${a.release.type})`:"";o.info(` ${a.release.name}: ${a.chosen}${d}`)}if(o.info(""),o.info(`${m} overridden, ${w} skipped, ${p.length-m} accepted as-is.`),r.write){if(m===0){o.info("Nothing to write — every package was accepted as-is.");return}const{textPrompt:a}=await import("./prompts.js"),d=await a("Changelog body for the override change file:","Operator-driven plan adjustment via `vis release plan -i`."),b=n.config.changesDir??j,$=await N(t,i,b,p,d);o.info(`Wrote ${$}`)}},L=async e=>{if(e.options.interactive){await S(e);return}await B({...e,options:{...e.options,bump:void 0,json:!0}})};export{L 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};
@@ -1,2 +1,4 @@
1
- import{b as m}from"./orchestrator.js";const u=a=>a==="major"||a==="minor"||a==="patch"||a==="none",d=async({logger:a,options:i,workspaceRoot:p})=>{const l=p??process.cwd();let r;try{r=await m({channel:i.channel,cwd:l,skipRegistryLookup:!0})}catch(e){a.error(`Failed to load release context: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1;return}const{printConfigIfRequested:c}=await import("./print-config.js");if(c(i,r,a))return;let{releases:o}=r.plan;if(i.bump){const e=i.bump.split(",").map(n=>n.trim()).filter(u);e.length>0&&(o=o.filter(n=>e.includes(n.type)))}if(i.filter){const e=(await import("./index.js")).default;o=o.filter(n=>e(i.filter,n.name))}if(i.json){const e={branch:r.branch,channel:r.channel,consumedChangeFiles:r.plan.consumedChangeFiles.map(n=>n.path),releases:o.map(n=>({isCascadeBump:n.isCascadeBump,isDependencyBump:n.isDependencyBump,isGroupBump:n.isGroupBump,name:n.name,newVersion:n.newVersion,oldVersion:n.oldVersion,reasons:n.reasons,type:n.type})),warnings:r.plan.warnings};process.stdout.write(`${JSON.stringify(e,null,2)}
2
- `),o.length===0&&(process.exitCode=1);return}if(o.length===0){if(a.info("No pending releases."),r.plan.warnings.length>0){a.warn(`${r.plan.warnings.length} warning(s):`);for(const e of r.plan.warnings)a.warn(` - ${e}`)}process.exitCode=1;return}r.channel&&a.info(`Channel: ${r.channel.tag}${r.channel.prerelease?` (preid: ${r.channel.prerelease})`:""} | mode: ${r.channel.mode}`),a.info(`${o.length} package(s) pending release:`),a.info("");const t={major:[],minor:[],none:[],patch:[]};for(const e of o)t[e.type].push(e);for(const e of["major","minor","patch"])if(t[e].length!==0){a.info(` ${e.toUpperCase()}:`);for(const n of t[e]){const s=[];n.isCascadeBump&&s.push("cascade"),n.isGroupBump&&s.push("group"),n.isDependencyBump&&!n.isCascadeBump&&s.push("dep-bump");const f=s.length>0?` [${s.join(", ")}]`:"";a.info(` ${n.name}: ${n.oldVersion} ${n.newVersion}${f}`)}}if(r.plan.warnings.length>0){a.info(""),a.warn(`${r.plan.warnings.length} warning(s):`);for(const e of r.plan.warnings)a.warn(` - ${e}`)}};export{d as default};
1
+ import{createRequire as k}from"node:module";import{b as N}from"./orchestrator.js";import{createShellRunner as v}from"./shell-runner.js";const b=k(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[o,r]=g.versions.node.split(".").map(Number);if(o>22||o===22&&r>=3||o===20&&r>=16)return g.getBuiltinModule(e)}return b(e)},{resolve:A}=$("node:path"),x=["test"],C=e=>e===void 0||e===""?"test":x.includes(e)?e:void 0,w=e=>e==null?[]:Array.isArray(e)?e:[e],S=async(e,o)=>{const r=v();let i,n;try{const{createRemoteClient:u,detectRemoteProvider:l}=await import("./detect2.js"),c=await l(o,r,void 0);i=await u(c,{}).detectRepoSlug(o,r)}catch{}try{n=JSON.parse(await e.readFile(`${o}/package.json`,"utf8")).name}catch{}const p=n?`${n.startsWith("@")?n:`@${n}`}/example`:"@scope/example",s=i?`https://github.com/${i}/releases/tag/v1.0.0`:"https://github.com/example/example/releases/tag/v1.0.0";return{channel:"latest",completedAt:new Date().toISOString(),...n===void 0?{}:{monorepoName:n},published:[{name:p,tag:"latest",url:s,version:"1.0.0"}],...i===void 0?{}:{repo:i},skipped:[]}},j=(e,o)=>o?o.includes(":")?e===o:e===o||e.startsWith(`${o}:`):!0,_=async e=>{const o=[],r=[];if(!e)return{channels:o,pluginFailures:r};const{SlackNotificationChannel:i}=await import("./slack.js");for(const s of w(e.slack))o.push(new i(s));const{DiscordNotificationChannel:n}=await import("./discord.js");for(const s of w(e.discord))o.push(new n(s));const{WebhookNotificationChannel:p}=await import("./webhook.js");for(const s of w(e.webhook))o.push(new p(s));if(e.plugins&&e.plugins.length>0){const{pathToFileURL:s}=await import("node:url"),{dynamicEsmImport:u}=await import("./dynamic-import.js");for(const l of e.plugins){const[c,h]=Array.isArray(l)?l:[l,void 0],m=c;try{const d=c.startsWith(".")?s(`${process.cwd()}/${c}`).href:c,f=await u(d),t=f.default??f;let a;typeof t=="function"?a=t(h):t&&typeof t=="object"&&typeof t.send=="function"&&(a=t),a&&typeof a=="object"&&typeof a.send=="function"?o.push(a):r.push({error:"did not export a NotificationChannel (object with .send) or a factory returning one",id:m})}catch(d){r.push({error:d.message,id:m})}}}return{channels:o,pluginFailures:r}},R=async(e,o)=>{try{return await e.send(o),{id:e.id,ok:!0}}catch(r){const i=r instanceof Error?r.message:String(r),{redactTokens:n}=await import("./security.js");return{error:n(i),id:e.id,ok:!1}}},F=async(e,o)=>{const r=A(process.cwd(),o),i=await e.readFile(r,"utf8"),n=JSON.parse(i);return{channel:n.channel,completedAt:n.completedAt??new Date().toISOString(),...n.monorepoName===void 0?{}:{monorepoName:n.monorepoName},published:Array.isArray(n.published)?n.published:[],...n.repo===void 0?{}:{repo:n.repo},skipped:Array.isArray(n.skipped)?n.skipped:[]}},D=async({fs:e,logger:o,options:r,workspaceRoot:i})=>{const n=i??process.cwd();if(C(r.action)===void 0){o.error(`Unknown action "${r.action}". Expected: test.`),process.exitCode=1;return}let p;try{p=await N({cwd:n,skipRegistryLookup:!0})}catch(t){o.error(`Failed to load release context: ${t instanceof Error?t.message:String(t)}`),process.exitCode=1;return}const s=p.config.notifications;if(!(s&&(s.slack&&(!Array.isArray(s.slack)||s.slack.length>0)||s.discord&&(!Array.isArray(s.discord)||s.discord.length>0)||s.webhook&&(!Array.isArray(s.webhook)||s.webhook.length>0)||s.plugins&&s.plugins.length>0))){const t={channels:[],hint:"No notifications configured. Add `release.notifications.{slack,discord,webhook,plugins}` to vis.config.ts.",ok:!0};r.json?process.stdout.write(`${JSON.stringify(t,null,2)}
2
+ `):o.info(t.hint);return}let u;try{u=r.customContext?await F(e,r.customContext):await S(e,n)}catch(t){o.error(`Could not load NotificationContext: ${t.message}`),process.exitCode=1;return}const{channels:l,pluginFailures:c}=await _(s),h=r.channel,m=l.filter(t=>j(t.id,h));if(m.length===0&&c.length===0){const t=h?`No channels matched filter "${h}". Configured ids: ${l.map(a=>a.id).join(", ")||"(none)"}.`:"No channels could be materialised from the configured notifications block.";r.json?process.stdout.write(`${JSON.stringify({channels:[],hint:t,ok:!1},null,2)}
3
+ `):o.error(t),process.exitCode=1;return}const d=[...await Promise.all(m.map(t=>R(t,u))),...c.map(t=>({error:`plugin load failed: ${t.error}`,id:t.id,ok:!1}))],f=d.filter(t=>!t.ok);if(r.json)process.stdout.write(`${JSON.stringify({channels:d,ok:f.length===0},null,2)}
4
+ `);else{for(const y of d)y.ok?o.info(` ${y.id} OK`):o.error(` ${y.id} FAIL — ${y.error??"unknown error"}`);const t=d.length,a=t-f.length;o.info(""),o.info(`Dispatched ${a}/${t} channel${t===1?"":"s"}.`)}f.length>0&&(process.exitCode=1)};export{D as default};
@@ -1 +1,3 @@
1
- import{DEFAULT_CHANGES_DIR as l}from"./DEFAULT_CLEAN_KEEP.js";import{stageAndCommitFile as g}from"./git.js";import{b as d}from"./orchestrator.js";import{readPreMode as m,buildEnterFile as w,writePreMode as u,preModeFilePath as $}from"./pre-mode.js";import{createShellRunner as h}from"./shell-runner.js";import{VisReleaseError as x}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const v=["enter","exit","status"],k=t=>t===void 0||t===""?"status":v.includes(t)?t:void 0,C=async(t,i,r)=>{const e=i.tag?.[0];if(!e){r.error("`pre enter` requires a tag, e.g.: vis release pre enter alpha"),process.exitCode=1;return}const o=await d({cwd:t,skipRegistryLookup:!0}),s=o.config.changesDir??l,p=await m(t,s);if(p){r.error(`Already in pre-mode (tag "${p.tag}", mode "${p.mode}"). Run \`vis release pre exit\` first if you want to switch tags.`),process.exitCode=1;return}const a=w(e,o.packages.map(c=>({name:c.name,version:c.version}))),n=await u(t,s,a);if(r.info(`Entered pre-mode with tag "${e}". ${Object.keys(a.initialVersions).length} package version(s) snapshot.`),i.commit===!1)r.info(`Run \`git add ${n} && git commit -m 'chore(release): enter pre-mode (${e}) [skip ci]'\` so CI sees the state.`);else{const c=h();try{await g({cwd:t,runner:c},n,`chore(release): enter pre-mode (${e}) [skip ci]`,{author:o.config.gitUser,push:i.push!==!1,sign:o.config.gitSignCommits===!0}),r.info(`Committed ${n}${i.push===!1?"":" + pushed"}.`)}catch(f){r.warn(`Could not commit ${n}: ${f.message}`)}}},y=async(t,i,r)=>{const e=await d({cwd:t,skipRegistryLookup:!0}),o=e.config.changesDir??l,s=await m(t,o);if(!s){r.error("Not in pre-mode. Nothing to exit."),process.exitCode=1;return}if(s.mode==="exit-pending"){r.info("Pre-mode already in `exit-pending` state. Run `vis release version` to consolidate.");return}if(e.channel?.prerelease!==void 0)throw new x({code:"CONFIG_INVALID",hint:`Switch to a non-prerelease branch (one whose channel has no \`prerelease\` set) before running \`vis release pre exit\`, or stay in pre-mode by skipping the exit. Current channel "${e.channel.tag}" pins prerelease "${e.channel.prerelease}".`,message:`Refusing to exit pre-mode: the active channel "${e.channel.tag}" has its own prerelease identifier "${e.channel.prerelease}". Exiting would create an unrecoverable state — the next \`vis release version\` would still produce a prerelease via the channel, but the cleanup would delete pre.json making retry impossible.`});const p={...s,mode:"exit-pending"},a=await u(t,o,p);if(r.info("Pre-mode flagged for exit. The next `vis release version` will consolidate the prereleases and delete pre.json."),i.commit!==!1){const n=h();try{await g({cwd:t,runner:n},a,`chore(release): exit pre-mode (was ${s.tag}) [skip ci]`,{author:e.config.gitUser,push:i.push!==!1,sign:e.config.gitSignCommits===!0}),r.info(`Committed ${a}${i.push===!1?"":" + pushed"}.`)}catch(c){r.warn(`Could not commit ${a}: ${c.message}`)}}},b=async(t,i)=>{const r=(await d({cwd:t,skipRegistryLookup:!0})).config.changesDir??l,e=await m(t,r);if(!e){i.info("Pre-mode: off.");return}i.info(`Pre-mode: ${e.mode==="pre"?"ACTIVE":"EXIT-PENDING"} (tag "${e.tag}", entered ${e.enteredAt})`),i.info(` → ${$(t,r)}`),i.info(` → ${Object.keys(e.initialVersions).length} package version(s) snapshot at enter time.`)},N=async({logger:t,options:i,workspaceRoot:r})=>{const e=r??process.cwd(),o=k(i.action);if(o===void 0){t.error(`Unknown action "${i.action}". Expected one of: enter, exit, status.`),process.exitCode=1;return}if(o==="enter"){await C(e,i,t);return}if(o==="exit"){await y(e,i,t);return}await b(e,t)};export{N as default};
1
+ import{createRequire as y}from"node:module";import{DEFAULT_CHANGES_DIR as j}from"./DEFAULT_CLEAN_KEEP.js";import{b as C,f as T}from"./orchestrator.js";import{a as x}from"../packem_shared/slug-DoueYuLo.js";import B from"./handler45.js";const k=y(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[t,o]=l.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return l.getBuiltinModule(e)}return k(e)},{join:h}=_("node:path"),f=["none","patch","minor","major"],g=(e,t)=>{const o=f.indexOf(e)+t;return f[Math.min(Math.max(o,0),f.length-1)]??e},v=e=>e.chosen!==e.release.type,R=(e,t)=>{const o=[];e.isCascadeBump&&o.push("cascade"),e.isGroupBump&&o.push("group"),e.isDependencyBump&&!e.isCascadeBump&&o.push("dep-bump");const r=o.length>0?` [${o.join(", ")}]`:"";return`${e.name}: ${e.oldVersion} ${e.newVersion} (${t})${r}`},q=async e=>{const{selectPrompt:t}=await import("./prompts.js");process.stdout.write(`
2
+ ${R(e,e.type)}
3
+ `);const o=await t("Action?",[{label:"accept (keep as-is)",value:"accept"},{label:"promote (bump up one level)",value:"promote"},{label:"demote (bump down one level)",value:"demote"},{label:"set explicitly (major | minor | patch | none)",value:"set"},{label:"skip this package",value:"skip"}]);return o==="promote"?g(e.type,1):o==="demote"?g(e.type,-1):o==="skip"?"none":o==="set"?t("Set bump level to?",[{label:"major",value:"major"},{label:"minor",value:"minor"},{label:"patch",value:"patch"},{label:"none (skip)",value:"none"}]):e.type},D=async e=>{const t=[];for(const o of e)t.push({chosen:await q(o),release:o});return t},N=async(e,t,o,r,c)=>{const i={};for(const s of r)s.chosen!=="none"&&(i[s.release.name]=s.chosen);const n=h(t,o,`${x("plan")}.md`),u={bumps:i};return await e.mkdir(h(t,o),{recursive:!0}),await e.writeFile(n,T(u,c)),n},S=async e=>{const{fs:t,logger:o,options:r,workspaceRoot:c}=e,i=c??process.cwd();if(!process.stdout.isTTY){o.error("--interactive requires a TTY. Drop the flag to get JSON output."),process.exitCode=1;return}const n=await C({channel:r.channel,cwd:i,skipRegistryLookup:!0}),{printConfigIfRequested:u}=await import("./print-config.js");if(u(r,n,o))return;const{releases:s}=n.plan;if(s.length===0){o.info("No pending releases.");return}n.channel&&o.info(`Channel: ${n.channel.tag}${n.channel.prerelease?` (preid: ${n.channel.prerelease})`:""} | mode: ${n.channel.mode}`),o.info(`Walking through ${s.length} pending release(s). Press Ctrl-C to abort.`);const p=await D(s),m=p.filter(a=>v(a)).length,w=p.filter(a=>a.chosen==="none").length;o.info(""),o.info("Summary:");for(const a of p){const d=v(a)?` (was ${a.release.type})`:"";o.info(` ${a.release.name}: ${a.chosen}${d}`)}if(o.info(""),o.info(`${m} overridden, ${w} skipped, ${p.length-m} accepted as-is.`),r.write){if(m===0){o.info("Nothing to write — every package was accepted as-is.");return}const{textPrompt:a}=await import("./prompts.js"),d=await a("Changelog body for the override change file:","Operator-driven plan adjustment via `vis release plan -i`."),b=n.config.changesDir??j,$=await N(t,i,b,p,d);o.info(`Wrote ${$}`)}},L=async e=>{if(e.options.interactive){await S(e);return}await B({...e,options:{...e.options,bump:void 0,json:!0}})};export{L as default};
@@ -1 +1,2 @@
1
- import{b as u,p as $}from"./orchestrator.js";import{VisReleaseError as m}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const x=async({logger:s,options:r,workspaceRoot:l})=>{const p=l??process.cwd(),o=r.dryRun===!0;let n;try{n=await u({channel:r.channel,cwd:p,firstRelease:r.firstRelease===!0,projects:r.filter?r.filter.split(",").map(e=>e.trim()).filter(Boolean):void 0})}catch(e){s.error(`Failed to load release context: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1;return}const{printConfigIfRequested:h}=await import("./print-config.js");if(h(r,n,s))return;if(r.checkOnly===!0){if(s.info(`Preflight: ${n.plan.releases.length} pending publish(es)${n.channel?` to dist-tag "${n.channel.tag}"`:""}.`),n.plan.warnings.length>0)for(const e of n.plan.warnings)s.warn(` - ${e}`);process.exitCode=n.plan.releases.length===0?1:0;return}if(n.plan.releases.length===0){s.info("No pending releases — nothing to publish.");return}const i=r.tag??n.channel?.tag;i||s.warn("No --tag provided and no channel matched the current branch. Defaulting to dist-tag 'latest'. Set channels in vis.config.ts to control this."),s.info(`${o?"[dry-run] would publish":"Publishing"} ${n.plan.releases.length} package(s) to dist-tag "${i??"latest"}"${o?"":"..."}`);let t;try{t=await $(n,{dryRun:o,noPush:r.noPush===!0,otp:r.otp,resume:r.resume===!0,tag:i})}catch(e){if(e instanceof m&&e.code==="STAGE_PENDING"){s.error(e.message),e.hint&&(s.info(""),s.info(`Next steps: ${e.hint}`)),process.exitCode=1;return}s.error(`Publish failed: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1;return}s.info("");for(const e of t.published)s.info(` [published] ${e.name}@${e.version}`);for(const e of t.skipped)e.reason.startsWith("stage-")?s.warn(` [stage] ${e.name} (${e.reason} — re-run \`vis release publish\` once approved)`):s.info(` [skipped] ${e.name} (${e.reason})`);for(const e of t.failed)s.error(` [failed] ${e.name}: ${e.reason}`);s.info(""),s.info(`Published: ${t.published.length} | Skipped: ${t.skipped.length} | Failed: ${t.failed.length}`),t.tags.length>0&&s.info(`Tags created: ${t.tags.length}${t.tagsPushed?" (pushed)":" (NOT pushed — re-run with --resume to retry)"}`),t.failed.length===0?process.exitCode=0:t.published.length===0&&t.skipped.length===0?process.exitCode=3:process.exitCode=2;const a=t.failed.filter(e=>/\bEOTP\b|one[- ]time password|otp/i.test(e.reason));if(a.length>0){s.info(""),s.warn("Publish failed because the registry required a 2FA OTP. Rerun with:");const e=a.map(g=>g.name).join(","),d=r.channel?` --channel=${r.channel}`:"",c=r.tag?` --tag=${r.tag}`:"",f=` --filter='${e}'`;s.info(` vis release publish --otp=REPLACE_WITH_NEW_OTP --resume${c}${d}${f}`)}};export{x as default};
1
+ import{b as m}from"./orchestrator.js";const u=a=>a==="major"||a==="minor"||a==="patch"||a==="none",d=async({logger:a,options:i,workspaceRoot:p})=>{const l=p??process.cwd();let r;try{r=await m({channel:i.channel,cwd:l,skipRegistryLookup:!0})}catch(e){a.error(`Failed to load release context: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1;return}const{printConfigIfRequested:c}=await import("./print-config.js");if(c(i,r,a))return;let{releases:o}=r.plan;if(i.bump){const e=i.bump.split(",").map(n=>n.trim()).filter(u);e.length>0&&(o=o.filter(n=>e.includes(n.type)))}if(i.filter){const e=(await import("./index.js")).default;o=o.filter(n=>e(i.filter,n.name))}if(i.json){const e={branch:r.branch,channel:r.channel,consumedChangeFiles:r.plan.consumedChangeFiles.map(n=>n.path),releases:o.map(n=>({isCascadeBump:n.isCascadeBump,isDependencyBump:n.isDependencyBump,isGroupBump:n.isGroupBump,name:n.name,newVersion:n.newVersion,oldVersion:n.oldVersion,reasons:n.reasons,type:n.type})),warnings:r.plan.warnings};process.stdout.write(`${JSON.stringify(e,null,2)}
2
+ `),o.length===0&&(process.exitCode=1);return}if(o.length===0){if(a.info("No pending releases."),r.plan.warnings.length>0){a.warn(`${r.plan.warnings.length} warning(s):`);for(const e of r.plan.warnings)a.warn(` - ${e}`)}process.exitCode=1;return}r.channel&&a.info(`Channel: ${r.channel.tag}${r.channel.prerelease?` (preid: ${r.channel.prerelease})`:""} | mode: ${r.channel.mode}`),a.info(`${o.length} package(s) pending release:`),a.info("");const t={major:[],minor:[],none:[],patch:[]};for(const e of o)t[e.type].push(e);for(const e of["major","minor","patch"])if(t[e].length!==0){a.info(` ${e.toUpperCase()}:`);for(const n of t[e]){const s=[];n.isCascadeBump&&s.push("cascade"),n.isGroupBump&&s.push("group"),n.isDependencyBump&&!n.isCascadeBump&&s.push("dep-bump");const f=s.length>0?` [${s.join(", ")}]`:"";a.info(` ${n.name}: ${n.oldVersion} → ${n.newVersion}${f}`)}}if(r.plan.warnings.length>0){a.info(""),a.warn(`${r.plan.warnings.length} warning(s):`);for(const e of r.plan.warnings)a.warn(` - ${e}`)}};export{d as default};
@@ -1 +1 @@
1
- import{b as p}from"./orchestrator.js";import{runSnapshot as f}from"./snapshot.js";const u=async({logger:r,options:i,workspaceRoot:n})=>{const a=n??process.cwd();if(!i.tag){r.error("--tag is required."),process.exitCode=1;return}const o=i.dryRun===!0,s=await p({cwd:a}),{printConfigIfRequested:d}=await import("./print-config.js");if(d(i,s,r))return;let e;try{e=await f({context:s,dryRun:o,filter:i.filter,registry:i.registry,tag:i.tag})}catch(t){r.error(`Snapshot failed: ${t.message}`),process.exitCode=1;return}r.info(`${o?"[dry-run] would snapshot":"Snapshotting"} at version ${e.snapshotVersion} tag "${e.tag}"`);for(const t of e.published)r.info(` ${o?"[dry-run] ":"[published]"} ${t.name}@${t.version}`);for(const t of e.skipped)r.info(` [skipped] ${t.name} (${t.reason})`);for(const t of e.failed)r.error(` [failed] ${t.name}: ${t.reason}`);r.info(""),r.info(`Published: ${e.published.length} | Skipped: ${e.skipped.length} | Failed: ${e.failed.length}`),process.exitCode=e.failed.length>0?2:0};export{u as default};
1
+ import{DEFAULT_CHANGES_DIR as l}from"./DEFAULT_CLEAN_KEEP.js";import{stageAndCommitFile as g}from"./git.js";import{b as d}from"./orchestrator.js";import{readPreMode as m,buildEnterFile as w,writePreMode as u,preModeFilePath as $}from"./pre-mode.js";import{createShellRunner as h}from"./shell-runner.js";import{VisReleaseError as x}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const v=["enter","exit","status"],k=t=>t===void 0||t===""?"status":v.includes(t)?t:void 0,C=async(t,i,r)=>{const e=i.tag?.[0];if(!e){r.error("`pre enter` requires a tag, e.g.: vis release pre enter alpha"),process.exitCode=1;return}const o=await d({cwd:t,skipRegistryLookup:!0}),s=o.config.changesDir??l,p=await m(t,s);if(p){r.error(`Already in pre-mode (tag "${p.tag}", mode "${p.mode}"). Run \`vis release pre exit\` first if you want to switch tags.`),process.exitCode=1;return}const a=w(e,o.packages.map(c=>({name:c.name,version:c.version}))),n=await u(t,s,a);if(r.info(`Entered pre-mode with tag "${e}". ${Object.keys(a.initialVersions).length} package version(s) snapshot.`),i.commit===!1)r.info(`Run \`git add ${n} && git commit -m 'chore(release): enter pre-mode (${e}) [skip ci]'\` so CI sees the state.`);else{const c=h();try{await g({cwd:t,runner:c},n,`chore(release): enter pre-mode (${e}) [skip ci]`,{author:o.config.gitUser,push:i.push!==!1,sign:o.config.gitSignCommits===!0}),r.info(`Committed ${n}${i.push===!1?"":" + pushed"}.`)}catch(f){r.warn(`Could not commit ${n}: ${f.message}`)}}},y=async(t,i,r)=>{const e=await d({cwd:t,skipRegistryLookup:!0}),o=e.config.changesDir??l,s=await m(t,o);if(!s){r.error("Not in pre-mode. Nothing to exit."),process.exitCode=1;return}if(s.mode==="exit-pending"){r.info("Pre-mode already in `exit-pending` state. Run `vis release version` to consolidate.");return}if(e.channel?.prerelease!==void 0)throw new x({code:"CONFIG_INVALID",hint:`Switch to a non-prerelease branch (one whose channel has no \`prerelease\` set) before running \`vis release pre exit\`, or stay in pre-mode by skipping the exit. Current channel "${e.channel.tag}" pins prerelease "${e.channel.prerelease}".`,message:`Refusing to exit pre-mode: the active channel "${e.channel.tag}" has its own prerelease identifier "${e.channel.prerelease}". Exiting would create an unrecoverable state — the next \`vis release version\` would still produce a prerelease via the channel, but the cleanup would delete pre.json making retry impossible.`});const p={...s,mode:"exit-pending"},a=await u(t,o,p);if(r.info("Pre-mode flagged for exit. The next `vis release version` will consolidate the prereleases and delete pre.json."),i.commit!==!1){const n=h();try{await g({cwd:t,runner:n},a,`chore(release): exit pre-mode (was ${s.tag}) [skip ci]`,{author:e.config.gitUser,push:i.push!==!1,sign:e.config.gitSignCommits===!0}),r.info(`Committed ${a}${i.push===!1?"":" + pushed"}.`)}catch(c){r.warn(`Could not commit ${a}: ${c.message}`)}}},b=async(t,i)=>{const r=(await d({cwd:t,skipRegistryLookup:!0})).config.changesDir??l,e=await m(t,r);if(!e){i.info("Pre-mode: off.");return}i.info(`Pre-mode: ${e.mode==="pre"?"ACTIVE":"EXIT-PENDING"} (tag "${e.tag}", entered ${e.enteredAt})`),i.info(` ${$(t,r)}`),i.info(` ${Object.keys(e.initialVersions).length} package version(s) snapshot at enter time.`)},N=async({logger:t,options:i,workspaceRoot:r})=>{const e=r??process.cwd(),o=k(i.action);if(o===void 0){t.error(`Unknown action "${i.action}". Expected one of: enter, exit, status.`),process.exitCode=1;return}if(o==="enter"){await C(e,i,t);return}if(o==="exit"){await y(e,i,t);return}await b(e,t)};export{N as default};
@@ -1,3 +1 @@
1
- import{DEFAULT_CHANGES_DIR as u}from"./DEFAULT_CLEAN_KEEP.js";import{b as m}from"./orchestrator.js";import{createShellRunner as $}from"./shell-runner.js";import{readStagedRegistry as v,removePendingStages as y,writeStagedRegistry as C}from"./staged-registry.js";import{acquireLock as x,releaseLock as S}from"./state.js";const j=["approve","list","reject"],k=t=>t===void 0||t===""?"list":j.includes(t)?t:void 0,A=async(t,r,o,s)=>{const i=["stage","list","--json"],d=o.stageIds?.[0],n=o.filter??d;n&&i.push(n);const p=await t.run("npm",i,{cwd:r,silent:!0}),c=await m({cwd:r}),a=await v(r,c.config.changesDir??u),f=n?{pending:a.pending.filter(e=>e.name===n)}:a;let g=[];if(p.exitCode===0&&p.stdout.trim())try{g=JSON.parse(p.stdout)}catch{process.stdout.write(`${p.stdout}
2
- `)}if(o.json){process.stdout.write(`${JSON.stringify({npm:g,registry:f.pending},null,2)}
3
- `);return}if(g.length===0&&f.pending.length===0){s.info("No staged versions awaiting approval.");return}const h=new Set(g.map(e=>e.id).filter(Boolean)),l=new Set(f.pending.map(e=>e.id));for(const e of g){const w=l.has(e.id??"")?"":" [npm-only]";s.info(` ${e.id??"<no-id>"} ${e.package??"?"}@${e.version??"?"} → ${e.tag??"latest"}${w}`)}for(const e of f.pending)h.has(e.id)||s.info(` ${e.id} ${e.name}@${e.version} → ${e.tag??"latest"} [registry-only, ${e.reason}]`)},b=async(t,r,o)=>{if(r.all){const i=await m({cwd:t}),d=await v(t,i.config.changesDir??u);if(d.pending.length===0){o.error("No pending stages in .vis/release/staged.json. Approve manually with explicit ids, or rerun `vis release publish` with publish.stage: true.");return}return d.pending.map(n=>n.id)}const s=r.stageIds??[];if(s.length===0){o.error("Pass stage ids positionally, or use --all to approve every pending stage in .vis/release/staged.json.");return}return s},E=async(t,r,o,s,i)=>{const d=t==="approve"?await b(o,s,i):s.stageIds;if(!d||d.length===0){t==="reject"&&i.error("Pass stage ids positionally to reject."),process.exitCode=1;return}const n=[],p=[];for(const c of d){const a=await r.run("npm",["stage",t,c],{cwd:o,silent:!1});a.exitCode===0?n.push(c):p.push({id:c,reason:a.stderr.trim()||`exit ${a.exitCode}`})}if(i.info(""),n.length>0){i.info(`${t==="approve"?"Approved":"Rejected"} ${n.length} stage(s).`);let c=[];try{const a=await m({cwd:o}),f=a.config.changesDir??u,g=await v(o,f);if(t==="reject"){const l=new Set(n);c=g.pending.filter(e=>l.has(e.id)).map(e=>({name:e.name,version:e.version}))}const h=y(g,n);if(h!==g){const l=await C(o,f,h);if(l.changed&&s.commit!==!1){const{stageAndCommitFile:e}=await import("./git.js"),w=l.removed?"chore(release): clear pending stage registry [skip ci]":`chore(release): ${t} ${n.length} stage${n.length===1?"":"s"} [skip ci]`;await e({cwd:o,runner:r},l.path,w,{author:a.config.gitUser,push:s.push!==!1,sign:a.config.gitSignCommits===!0}),i.info(`Updated ${l.path} and committed${s.push===!1?"":" + pushed"}.`)}else l.changed&&i.info(`Updated ${l.path}. Commit + push it so the next release wave sees the resolved state.`)}}catch(a){i.warn(`Could not update staged registry: ${a.message}`)}if(c.length>0){i.info(""),i.info("Orphan CHANGELOG sections to review:");for(const a of c)i.info(` Edit CHANGELOG.md for ${a.name} to remove the orphan ${a.version} section before the next wave`);i.info("(Workspace CHANGELOG.md is unaffected — its wave entry is written from the publish phase against actually-published versions.)")}}if(p.length>0){for(const c of p)i.error(` ${c.id}: ${c.reason}`);process.exitCode=1}},R=async({logger:t,options:r,workspaceRoot:o})=>{const s=o??process.cwd(),i=k(r.action);if(i===void 0){t.error(`Unknown action "${r.action}". Expected one of: list, approve, reject.`),process.exitCode=1;return}const d=$();if(i==="list"){await A(d,s,r,t);return}let n,p=!1;if(r.commit!==!1)try{n=(await m({cwd:s})).config.changesDir??u,await x(s,n),p=!0}catch(c){t.error(`Could not acquire release lock: ${c.message}`),process.exitCode=1;return}try{await E(i,d,s,r,t)}finally{p&&n&&await S(s,n)}};export{R as default};
1
+ import{b as u,p as $}from"./orchestrator.js";import{VisReleaseError as m}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const x=async({logger:s,options:r,workspaceRoot:l})=>{const p=l??process.cwd(),o=r.dryRun===!0;let n;try{n=await u({channel:r.channel,cwd:p,firstRelease:r.firstRelease===!0,projects:r.filter?r.filter.split(",").map(e=>e.trim()).filter(Boolean):void 0})}catch(e){s.error(`Failed to load release context: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1;return}const{printConfigIfRequested:h}=await import("./print-config.js");if(h(r,n,s))return;if(r.checkOnly===!0){if(s.info(`Preflight: ${n.plan.releases.length} pending publish(es)${n.channel?` to dist-tag "${n.channel.tag}"`:""}.`),n.plan.warnings.length>0)for(const e of n.plan.warnings)s.warn(` - ${e}`);process.exitCode=n.plan.releases.length===0?1:0;return}if(n.plan.releases.length===0){s.info("No pending releases nothing to publish.");return}const i=r.tag??n.channel?.tag;i||s.warn("No --tag provided and no channel matched the current branch. Defaulting to dist-tag 'latest'. Set channels in vis.config.ts to control this."),s.info(`${o?"[dry-run] would publish":"Publishing"} ${n.plan.releases.length} package(s) to dist-tag "${i??"latest"}"${o?"":"..."}`);let t;try{t=await $(n,{dryRun:o,noPush:r.noPush===!0,otp:r.otp,resume:r.resume===!0,tag:i})}catch(e){if(e instanceof m&&e.code==="STAGE_PENDING"){s.error(e.message),e.hint&&(s.info(""),s.info(`Next steps: ${e.hint}`)),process.exitCode=1;return}s.error(`Publish failed: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1;return}s.info("");for(const e of t.published)s.info(` [published] ${e.name}@${e.version}`);for(const e of t.skipped)e.reason.startsWith("stage-")?s.warn(` [stage] ${e.name} (${e.reason} — re-run \`vis release publish\` once approved)`):s.info(` [skipped] ${e.name} (${e.reason})`);for(const e of t.failed)s.error(` [failed] ${e.name}: ${e.reason}`);s.info(""),s.info(`Published: ${t.published.length} | Skipped: ${t.skipped.length} | Failed: ${t.failed.length}`),t.tags.length>0&&s.info(`Tags created: ${t.tags.length}${t.tagsPushed?" (pushed)":" (NOT pushed — re-run with --resume to retry)"}`),t.failed.length===0?process.exitCode=0:t.published.length===0&&t.skipped.length===0?process.exitCode=3:process.exitCode=2;const a=t.failed.filter(e=>/\bEOTP\b|one[- ]time password|otp/i.test(e.reason));if(a.length>0){s.info(""),s.warn("Publish failed because the registry required a 2FA OTP. Rerun with:");const e=a.map(g=>g.name).join(","),d=r.channel?` --channel=${r.channel}`:"",c=r.tag?` --tag=${r.tag}`:"",f=` --filter='${e}'`;s.info(` vis release publish --otp=REPLACE_WITH_NEW_OTP --resume${c}${d}${f}`)}};export{x as default};
@@ -1 +1 @@
1
- import{b as f,a as c}from"./orchestrator.js";import{VisReleaseError as d}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const p=async({logger:e,options:t,workspaceRoot:l})=>{const a=l??process.cwd(),r=t.dryRun===!0,o=await f({channel:t.channel,cwd:a,firstRelease:t.firstRelease===!0,projects:t.filter?t.filter.split(",").map(n=>n.trim()).filter(Boolean):void 0}),{printConfigIfRequested:s}=await import("./print-config.js");if(s(t,o,e))return;if(t.checkOnly===!0){if(e.info(`Preflight: ${o.plan.releases.length} pending release(s)${o.channel?` on channel "${o.channel.tag}"`:""}.`),o.plan.warnings.length>0)for(const n of o.plan.warnings)e.warn(` - ${n}`);process.exitCode=o.plan.releases.length===0?1:0;return}if(o.plan.releases.length===0){e.info("No pending releases — nothing to version."),process.exitCode=0;return}o.channel&&e.info(`Channel: ${o.channel.tag}${o.channel.prerelease?` (preid: ${o.channel.prerelease})`:""}`),e.info(`${r?"[dry-run] would version":"Versioning"} ${o.plan.releases.length} package(s)...`);for(const n of o.plan.releases)e.info(` ${n.name}: ${n.oldVersion} → ${n.newVersion}`);let i;try{i=await c(o,{commit:t.commit===!0,dryRun:r})}catch(n){if(n instanceof d&&n.code==="STAGE_PENDING"){e.error(n.message),n.hint&&(e.info(""),e.info(`Next steps: ${n.hint}`)),process.exitCode=1;return}throw n}if(r){e.info(""),e.info(`[dry-run] would write ${i.changedFiles.length} file(s):`);for(const n of i.changedFiles)e.info(` ${n}`);if(i.deletedFiles.length>0){e.info(`[dry-run] would delete ${i.deletedFiles.length} change file(s):`);for(const n of i.deletedFiles)e.info(` ${n}`)}e.info(""),e.info("Dry run complete. No changes made.")}else e.info(""),e.info(`Wrote ${i.changedFiles.length} file(s); deleted ${i.deletedFiles.length} consumed change file(s).`),i.commitSha?e.info(`Committed as ${i.commitSha.slice(0,7)}.`):t.commit&&e.warn("--commit was requested but no commit was made (likely no changes to commit).");if(o.plan.warnings.length>0){e.info(""),e.warn(`${o.plan.warnings.length} warning(s):`);for(const n of o.plan.warnings)e.warn(` - ${n}`)}};export{p as default};
1
+ import{b as p}from"./orchestrator.js";import{runSnapshot as f}from"./snapshot.js";const u=async({logger:r,options:i,workspaceRoot:n})=>{const a=n??process.cwd();if(!i.tag){r.error("--tag is required."),process.exitCode=1;return}const o=i.dryRun===!0,s=await p({cwd:a}),{printConfigIfRequested:d}=await import("./print-config.js");if(d(i,s,r))return;let e;try{e=await f({context:s,dryRun:o,filter:i.filter,registry:i.registry,tag:i.tag})}catch(t){r.error(`Snapshot failed: ${t.message}`),process.exitCode=1;return}r.info(`${o?"[dry-run] would snapshot":"Snapshotting"} at version ${e.snapshotVersion} → tag "${e.tag}"`);for(const t of e.published)r.info(` ${o?"[dry-run] ":"[published]"} ${t.name}@${t.version}`);for(const t of e.skipped)r.info(` [skipped] ${t.name} (${t.reason})`);for(const t of e.failed)r.error(` [failed] ${t.name}: ${t.reason}`);r.info(""),r.info(`Published: ${e.published.length} | Skipped: ${e.skipped.length} | Failed: ${e.failed.length}`),process.exitCode=e.failed.length>0?2:0};export{u as default};
@@ -1,7 +1,3 @@
1
- import{createRequire as $}from"node:module";import{N as y,R as l,S as d,h as b}from"../packem_shared/ai-analysis-BUeX2J2H.js";import{h as x,d as w,e as _}from"./bin.js";import{j as S,E as p,q as j,I as E,s as I}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";const C=$(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const u={command:"ai",description:"AI-assisted commands: provider detection, cache management, and failure-fix proposals."},N=e=>{if(typeof e!="function")return String(e);const{name:t}=e;return t==="Boolean"?"boolean":t==="Number"?"number":t==="String"?"string":t??"unknown"},R=e=>{const t=[...e.commandPath??[],e.name].join(" "),i=(e.examples??[]).map(([o,r])=>({command:o??"",description:r??""})),n=(e.options??[]).map(o=>({defaultValue:o.defaultValue,description:o.description,name:o.name,type:N(o.type)}));return{argument:e.argument?{description:e.argument.description,name:e.argument.name}:void 0,description:e.description??"",examples:i,name:e.name,options:n,path:t}},f=(e,t=u)=>({command:t.command,description:t.description,subcommands:e.map(i=>R(i))}),P=(e,t=u)=>`${JSON.stringify(f(e,t),void 0,2)}
2
- `,T=(e,t=u)=>{const i=f(e,t),n=[S(`vis ${i.command} — ${i.description}`),"",p("Subcommands:")];for(const o of i.subcommands){const r=o.argument?` ${j(`<${o.argument.name}>`)}`:"";if(n.push(""),n.push(` ${E(`vis ${o.path}`)}${r}`),o.description&&n.push(` ${o.description}`),o.options.length>0){const s=o.options.map(c=>`--${c.name}${c.type==="boolean"?"":`=<${c.type}>`}`).join(", ");n.push(p(` options: ${s}`))}if(o.examples.length>0){n.push(p(" examples:"));for(const s of o.examples){const c=s.description?p(` — ${s.description}`):"";n.push(` ${I(s.command)}${c}`)}}}return n.push(""),n.push(p(`Run \`vis ${i.command} discover-help\` for the machine-readable JSON catalogue (designed for AI agents).`)),n.push(p(`Run \`vis ${i.command} <subcommand> --help\` for full usage of a specific subcommand.`)),`${n.join(`
3
- `)}
4
- `},h=async()=>{const{default:e}=await import("./bin.js").then(t=>t.bw);return e.filter(t=>t.name!=="ai")},O=async()=>{const e=await h();process.stderr.write(T(e))},B=async()=>{const e=await h();process.stdout.write(P(e))},F=async({logger:e,visConfig:t})=>{const i=t?.ai,n=l(i);if(!n){e.error("No AI provider available to test."),process.exitCode=1;return}e.info(`Testing ${n.name}...`);try{const o=await b(n,"Reply with exactly: OK",{timeoutMs:3e4});e.info(`Provider ${n.name} responded: ${o.stdout.trim().slice(0,200)}`)}catch(o){const r=o instanceof Error?o.message:String(o);e.error(`Provider ${n.name} failed: ${r}`),process.exitCode=1}},V=({logger:e,options:t,visConfig:i})=>{const n=t.format??"table",o=i?.ai,r=y(),s=l(o);if(n==="json"){const a=r.map(m=>({available:m.available,method:m.detectionMethod,name:m.name,path:m.path,priority:d[m.name]??0,selected:m.name===s?.name,version:m.version}));process.stdout.write(`${JSON.stringify(a,void 0,2)}
5
- `);return}const c=r.map(a=>({method:a.detectionMethod??"-",path:a.path??"-",priority:String(d[a.name]??0),provider:a.name,selected:a.name===s?.name?">>>":"",status:a.available?"available":"not found",version:a.version??"-"})),g=process.stdout.columns||80,v=x(w.createElement(_,{data:c}),{columns:g});e.info(v),s?e.info(`
6
- Selected provider: ${s.name} (priority ${String(d[s.name]??0)})`):e.info(`
7
- No AI provider available. Install one of the supported AI CLI tools.`)},k=async e=>{const{aiFix:t}=await import("./fix.js");await t(e)};export{B as aiDiscoverHelpExecute,k as aiFixExecute,V as aiProvidersExecute,O as aiRootExecute,F as aiTestExecute};
1
+ import{DEFAULT_CHANGES_DIR as u}from"./DEFAULT_CLEAN_KEEP.js";import{b as m}from"./orchestrator.js";import{createShellRunner as $}from"./shell-runner.js";import{readStagedRegistry as v,removePendingStages as y,writeStagedRegistry as C}from"./staged-registry.js";import{acquireLock as x,releaseLock as S}from"./state.js";const j=["approve","list","reject"],k=t=>t===void 0||t===""?"list":j.includes(t)?t:void 0,A=async(t,r,o,s)=>{const i=["stage","list","--json"],d=o.stageIds?.[0],n=o.filter??d;n&&i.push(n);const p=await t.run("npm",i,{cwd:r,silent:!0}),c=await m({cwd:r}),a=await v(r,c.config.changesDir??u),f=n?{pending:a.pending.filter(e=>e.name===n)}:a;let g=[];if(p.exitCode===0&&p.stdout.trim())try{g=JSON.parse(p.stdout)}catch{process.stdout.write(`${p.stdout}
2
+ `)}if(o.json){process.stdout.write(`${JSON.stringify({npm:g,registry:f.pending},null,2)}
3
+ `);return}if(g.length===0&&f.pending.length===0){s.info("No staged versions awaiting approval.");return}const h=new Set(g.map(e=>e.id).filter(Boolean)),l=new Set(f.pending.map(e=>e.id));for(const e of g){const w=l.has(e.id??"")?"":" [npm-only]";s.info(` ${e.id??"<no-id>"} ${e.package??"?"}@${e.version??"?"} → ${e.tag??"latest"}${w}`)}for(const e of f.pending)h.has(e.id)||s.info(` ${e.id} ${e.name}@${e.version} → ${e.tag??"latest"} [registry-only, ${e.reason}]`)},b=async(t,r,o)=>{if(r.all){const i=await m({cwd:t}),d=await v(t,i.config.changesDir??u);if(d.pending.length===0){o.error("No pending stages in .vis/release/staged.json. Approve manually with explicit ids, or rerun `vis release publish` with publish.stage: true.");return}return d.pending.map(n=>n.id)}const s=r.stageIds??[];if(s.length===0){o.error("Pass stage ids positionally, or use --all to approve every pending stage in .vis/release/staged.json.");return}return s},E=async(t,r,o,s,i)=>{const d=t==="approve"?await b(o,s,i):s.stageIds;if(!d||d.length===0){t==="reject"&&i.error("Pass stage ids positionally to reject."),process.exitCode=1;return}const n=[],p=[];for(const c of d){const a=await r.run("npm",["stage",t,c],{cwd:o,silent:!1});a.exitCode===0?n.push(c):p.push({id:c,reason:a.stderr.trim()||`exit ${a.exitCode}`})}if(i.info(""),n.length>0){i.info(`${t==="approve"?"Approved":"Rejected"} ${n.length} stage(s).`);let c=[];try{const a=await m({cwd:o}),f=a.config.changesDir??u,g=await v(o,f);if(t==="reject"){const l=new Set(n);c=g.pending.filter(e=>l.has(e.id)).map(e=>({name:e.name,version:e.version}))}const h=y(g,n);if(h!==g){const l=await C(o,f,h);if(l.changed&&s.commit!==!1){const{stageAndCommitFile:e}=await import("./git.js"),w=l.removed?"chore(release): clear pending stage registry [skip ci]":`chore(release): ${t} ${n.length} stage${n.length===1?"":"s"} [skip ci]`;await e({cwd:o,runner:r},l.path,w,{author:a.config.gitUser,push:s.push!==!1,sign:a.config.gitSignCommits===!0}),i.info(`Updated ${l.path} and committed${s.push===!1?"":" + pushed"}.`)}else l.changed&&i.info(`Updated ${l.path}. Commit + push it so the next release wave sees the resolved state.`)}}catch(a){i.warn(`Could not update staged registry: ${a.message}`)}if(c.length>0){i.info(""),i.info("Orphan CHANGELOG sections to review:");for(const a of c)i.info(` Edit CHANGELOG.md for ${a.name} to remove the orphan ${a.version} section before the next wave`);i.info("(Workspace CHANGELOG.md is unaffected — its wave entry is written from the publish phase against actually-published versions.)")}}if(p.length>0){for(const c of p)i.error(` ${c.id}: ${c.reason}`);process.exitCode=1}},R=async({logger:t,options:r,workspaceRoot:o})=>{const s=o??process.cwd(),i=k(r.action);if(i===void 0){t.error(`Unknown action "${r.action}". Expected one of: list, approve, reject.`),process.exitCode=1;return}const d=$();if(i==="list"){await A(d,s,r,t);return}let n,p=!1;if(r.commit!==!1)try{n=(await m({cwd:s})).config.changesDir??u,await x(s,n),p=!0}catch(c){t.error(`Could not acquire release lock: ${c.message}`),process.exitCode=1;return}try{await E(i,d,s,r,t)}finally{p&&n&&await S(s,n)}};export{R as default};
@@ -1,8 +1,4 @@
1
- import{createRequire as A}from"node:module";import{w as G,k as H,p,P as J,j as V,R as W,l as S,c as K,V as Z,$ as T,d as a,h as Q,m as g,H as M,o as X,G as ee,r as te,B as oe,F as m}from"./bin.js";import"../packem_shared/index-BDmTbWX1.js";import"../packem_shared/public-api-WqUCiyIe.js";import{K as se,Z as re,W as ne}from"../packem_shared/ai-analysis-BUeX2J2H.js";import{w as ie}from"../packem_shared/pm-runner-OGResYrA.js";import{U as ae,b as ce,u as N}from"../packem_shared/vis-update-app-k3fDxech.js";const de=A(import.meta.url),ue=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const $e=async({argument:E,logger:o,options:e,visConfig:i,workspaceRoot:C})=>{if(!C)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const d=C;if(e.securityConfig){const t=ie(d);if(G(i??{},t.name),e.sync&&t.name==="pnpm"){const s=H(i??{});if(s.length>0){p.info(`
2
- Settings that would sync to pnpm-workspace.yaml:`);for(const b of s)p.success(` ${b}`)}else p.info("No security settings to sync.")}else e.sync&&t.name!=="pnpm"&&(p.info(`--sync is only available for pnpm projects. Your project uses ${t.name}.`),p.info("vis enforces security settings at the vis layer for non-pnpm projects."));if(!e.security&&!E?.length)return}const{packageManager:U}=J(d),B=V(d),c=i?.update??{},y=W(d,U,{dev:e.dev,includeInternal:e["include-internal"],peer:e.peer,prod:e.prod});if(y.size===0){o.info("No catalogs found.");return}const h=e.target??c.target??"latest";if(!["latest","minor","patch"].includes(h))throw new Error(`Invalid target "${h}". Use: latest, minor, or patch.`);const D={exclude:[...m(e.exclude),...m(c.exclude)],ignore:m(c.ignore),include:[...m(e.include),...m(c.include),...E],includeLocked:!!e.includeLocked,includePrerelease:e.prerelease||c.prerelease||!1,security:e.security!==!1,target:h};let j=0;for(const t of y.values())j+=t.size;const $=!!process.stdout.isTTY&&!te;let l;const F=$?(t,s)=>{l?l.rerender(a.createElement(N,{current:t,total:s})):l=T(a.createElement(N,{current:t,total:s}),{interactive:!0,patchConsole:!1})}:(t,s)=>{o.info(`Checking ${String(t)}/${String(s)} dependencies...`)};$||o.info(`Checking ${String(j)} catalog dependencies against npm registry...
3
- `);const w=new Set;S("socket")&&w.add("socket"),S("depsDev")&&w.add("deps-dev");const v=i?.security?.policies?.score?.minimum,I=K(i?.security,{disabled:w,minimumScore:v}),{failed:k,outdated:n}=await Z(y,D,B,F,d,I,i?.security?.acceptedRisks);if(l&&(l.clear(),l.unmount()),k.length>0&&o.warn(`Failed to fetch: ${k.join(", ")}`),n.length===0){o.info("All catalog dependencies are up to date.");return}const R=e.format??c.format??"table",P=se(e.aiType??"impact"),u=e.ai?await re(n,o,i?.ai,P):void 0;if($&&R==="table"){const t=new ae(n,u??null),s=i?.tui?.autoExit??!1,b=s===!0?3:typeof s=="number"?s:0;await T(a.createElement(ce,{autoExitSeconds:b,isDryRun:!0,store:t}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit();const q=process.stdout.columns||80;process.stdout.write(`
4
- `);for(const r of n){const z=r.vulnerabilities?.length||r.socketReport&&r.socketReport.alerts.length>0,_=!!r.acceptedRisk,L=z?_?"✓":"⚠":"✓",O=_?"gray":r.updateType==="major"?"red":r.updateType==="minor"?"yellow":"green",f=r.socketReport?.score.overall,Y=f===void 0?"":` [${String(Math.round(f*100))}%]`,x=f===void 0?void 0:oe(f);process.stdout.write(`${Q(a.createElement(g,null," ",a.createElement(g,{color:O},L),` ${r.packageName} ${r.currentRange} ${r.newRange}`,a.createElement(g,{dimColor:!0},` ${r.updateType}`),x?a.createElement(g,{color:x},Y):null),{columns:q})}
5
- `)}process.stdout.write(`
6
- `),o.info(M(n,v))}else if(R==="json"){const t={failed:k,outdated:n};u&&(t.aiAnalysis=u),process.stdout.write(`${JSON.stringify(t,void 0,2)}
7
- `)}else R==="minimal"?process.stdout.write(`${X(n)}
8
- `):(ee(n,o),o.info(M(n,v)),u&&(o.info(""),o.info(ne(u))));e.exitCode&&n.length>0&&(process.exitCode=1)};export{$e as default};
1
+ import{P as N,R as C,T as P,E as h,N as T,c as I,f as j,q,I as x}from"./cli-main.js";import"../packem_shared/index-OQZQyN5R.js";import"../packem_shared/public-api-WqUCiyIe.js";import{K as z,Z as A,W as F}from"../packem_shared/ai-analysis-CubpCxZJ.js";const M=/^[\^~>=<]+/,U=async({argument:v,logger:n,options:c,visConfig:l,workspaceRoot:f})=>{if(!f)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const m=v,e=m[0];if(!e)throw new Error("Package name is required. Usage: vis analyze <package> [version]");const p=m[1],{packageManager:R}=N(f);let o,u="default";const b=C(f,R);for(const[t,i]of b){const a=i.get(e);if(a){o=a,u=t;break}}if(!o)throw new Error(`Package "${e}" not found in any catalog or package.json. Make sure it exists in your workspace dependencies.`);let r;if(p)r=p;else{n.info(`Fetching latest version for ${e}...
2
+ `);const t=await P(e);if(!t.latest)throw new Error(`Could not determine latest version for "${e}".`);r=t.latest}const d=h(o),w=h(r);if(!d||!w)throw new Error(`Could not parse versions: current="${o}", target="${r}".`);const k=q(d,w);if(k==="none"){n.info(`${e} is already at ${r}. Nothing to analyze.`);return}const E=x(o),g={catalogName:u,currentRange:o,newRange:`${E}${r}`,packageName:e,targetVersion:r,updateType:k},y=z(c.aiType??"impact");if(y==="security"||c.security){n.info(`Checking for known vulnerabilities...
3
+ `);const t=o.replace(M,""),i=(await T([{name:e,version:t}])).get(e);i&&i.length>0&&(g.vulnerabilities=i);const a=I(l?.security,{minimumScore:l?.security?.policies?.score?.minimum});if(a.length>0){const s=(await j(a,[{name:e,version:t}])).get(`${e}@${t}`);s&&(g.socketReport={alerts:s.alerts,license:s.license,score:s.score})}}const $=await A([g],n,l?.ai,y);(c.format??"table")==="json"?process.stdout.write(`${JSON.stringify($,void 0,2)}
4
+ `):n.info(F($))};export{U as default};
@@ -1,33 +1 @@
1
- import{createRequire as N}from"node:module";import{f as D,v as O,T as w}from"../packem_shared/index-BDmTbWX1.js";import{b as V}from"./config.js";import{p as e}from"./bin.js";import{w as q}from"../packem_shared/pm-runner-OGResYrA.js";import{W as A}from"../packem_shared/build-scripts-CCCi8U66.js";import{O as F}from"../packem_shared/native-config-sync-BEkJW7g3.js";const R=N(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,C=l=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[t,s]=$.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return $.getBuiltinModule(l)}return R(l)},{spawnSync:T}=C("node:child_process"),M=/(defineConfig\s*\(\s*\{)/,W=/(export\s+default\s+\{)/,v=(l,t)=>`${t}${JSON.stringify(l)}: true,`,B=(l,t)=>{if(t.length===0)return{added:[],skipped:[],status:"noop"};const s=V(l);if(!s)return{added:[],skipped:t,status:"no-config"};if(!D(s))return{added:[],skipped:t,status:"no-config"};const i=O(s),h=i.search(/installScripts\s*:\s*\{/);let a=null,r=0;if(h!==-1){const c=i.slice(h),d=/(allow\s*:\s*\{)([^}]*)(\})/.exec(c);d?.index!==void 0&&(a=d,r=h+d.index)}if(a){const c=a[2]??"",d=new Set;for(const g of c.matchAll(/["']([^"']+)["']\s*:/g))d.add(g[1]);for(const g of c.matchAll(/(?:^|,|\{)\s*([a-z_$][\w-]*)\s*:/gi))d.add(g[1]);const u=[],k=[];for(const g of t)d.has(g)?k.push(g):u.push(g);if(u.length===0)return{added:[],configPath:s,skipped:k,status:"noop"};const x=/\n([ \t]+)\S/.exec(c)?.[1]??" ",_=`
2
- ${u.map(g=>v(g,x)).join(`
3
- `)}`,y=c.replace(/\s+$/,""),S=c.slice(y.length),j=`${y}${y.endsWith(",")||y===""?"":","}${_}${S.length>0?S:`
4
- `}`,P=`${i.slice(0,r)}${a[1]}${j}${a[3]}${i.slice(r+a[0].length)}`;return w(s,P),{added:u,configPath:s,skipped:k,status:"updated"}}const n=/(installScripts\s*:\s*\{)/;if(n.test(i)){const c=`
5
- allow: {
6
- ${t.map(u=>v(u," ")).join(`
7
- `)}
8
- },`,d=i.replace(n,`$1${c}`);return w(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const o=/(policies\s*:\s*\{)/;if(o.test(i)){const c=`
9
- installScripts: {
10
- allow: {
11
- ${t.map(u=>v(u," ")).join(`
12
- `)}
13
- },
14
- },`,d=i.replace(o,`$1${c}`);return w(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const f=/(security\s*:\s*\{)/;if(f.test(i)){const c=`
15
- policies: {
16
- installScripts: {
17
- allow: {
18
- ${t.map(u=>v(u," ")).join(`
19
- `)}
20
- },
21
- },
22
- },`,d=i.replace(f,`$1${c}`);return w(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const p=M.exec(i)??W.exec(i);if(!p)return{added:[],configPath:s,skipped:t,status:"missing-anchor"};const m=`
23
- security: {
24
- policies: {
25
- installScripts: {
26
- allow: {
27
- ${t.map(c=>v(c," ")).join(`
28
- `)}
29
- },
30
- },
31
- },
32
- },`,b=`${i.slice(0,p.index+p[0].length)}${m}${i.slice(p.index+p[0].length)}`;return w(s,b),{added:t,configPath:s,skipped:[],status:"updated"}},L=async({options:l,visConfig:t,workspaceRoot:s})=>{const i=s??process.cwd(),h=q(i);if(h.name==="pnpm"&&!l.scan){e.info("Delegating to pnpm approve-builds...");const a=["approve-builds"];l.all&&a.push("--all");const r=T("pnpm",a,{cwd:i,stdio:"inherit"});if(r.error)throw new Error(`Failed to run pnpm approve-builds: ${r.error.message}`);if(r.status!==0&&r.status!==null&&(e.error(`pnpm approve-builds exited with code ${r.status}`),process.exitCode=r.status),!l.syncNative){e.notice(""),e.notice("Tip: vis.config.ts security.policies.installScripts.allow may now be out of sync with pnpm-workspace.yaml."),e.notice("Run 'vis check --security-config' to compare, or copy the new entries into vis.config.ts.");return}}else{const a=t?.security?.policies?.installScripts?.allow??{},r=t?.security?.pinVersions===!0,n=A(i,a,{pinVersions:r});if(n.unapproved.length===0)e.success("No unapproved build scripts found."),l.write&&(e.info(""),e.info("Nothing to write — there are no unapproved build scripts."));else{e.warn(`Found ${n.unapproved.length} package${n.unapproved.length===1?"":"s"} with unapproved build scripts:
33
- `);for(const o of n.unapproved)e.info(` ${o.name} (${o.hooks.join(", ")})`);e.notice(""),e.notice("To approve these packages, add them to vis.config.ts:"),e.notice(""),e.notice(" security: {"),e.notice(" policies: {"),e.notice(" installScripts: {"),e.notice(" allow: {");for(const o of n.unapproved){const f=r&&o.version?`${o.name}@${o.version}`:o.name;e.notice(` "${f}": true,`)}if(e.notice(" },"),e.notice(" },"),e.notice(" },"),e.notice(" },"),h.name==="pnpm"&&(e.notice(""),e.notice("Or run 'pnpm approve-builds' to update pnpm-workspace.yaml directly.")),l.write){const o=t?.security?.pinVersions===!0,f=n.unapproved.map(m=>o&&m.version?`${m.name}@${m.version}`:m.name),p=B(i,f);switch(e.info(""),p.status){case"missing-anchor":{e.warn(`Could not locate 'defineConfig({' or 'export default {' in ${String(p.configPath)} — please add entries manually.`);break}case"no-config":{e.warn("No vis.config.ts found. Run 'vis init' first, then re-run with --write.");break}case"noop":{e.info(`All ${String(f.length)} entr${f.length===1?"y":"ies"} were already present in vis.config.ts security.policies.installScripts.allow.`);break}default:e.success(`Wrote ${String(p.added.length)} entr${p.added.length===1?"y":"ies"} to ${String(p.configPath)}.`),p.skipped.length>0&&e.info(`Skipped ${String(p.skipped.length)} already-present entr${p.skipped.length===1?"y":"ies"}.`)}}}if(n.excess.length>0){e.notice(""),e.warn(`Stale installScripts.allow entries — ${String(n.excess.length)} pattern${n.excess.length===1?"":"s"} no longer match any installed package:`);for(const o of n.excess)e.info(` ${o}`);e.notice("Consider removing these entries from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){e.notice(""),e.warn(`Version drift — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} pinned to an outdated version:`);for(const{from:o,to:f}of n.versionDrift)e.info(` ${o} → ${f}`);e.notice("Rename the keys in vis.config.ts security.policies.installScripts.allow to migrate.")}}if(l.syncNative){const a=t?.security?.policies?.installScripts?.allow??{};if(Object.keys(a).length===0)e.warn("No security.policies.installScripts.allow configured in vis.config.ts. Nothing to sync.");else{const r=F(h.name,i,a);e.info("");for(const n of r)e.success(n)}}};export{L as default};
1
+ import{b as f,a as c}from"./orchestrator.js";import{VisReleaseError as d}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const p=async({logger:e,options:t,workspaceRoot:l})=>{const a=l??process.cwd(),r=t.dryRun===!0,o=await f({channel:t.channel,cwd:a,firstRelease:t.firstRelease===!0,projects:t.filter?t.filter.split(",").map(n=>n.trim()).filter(Boolean):void 0}),{printConfigIfRequested:s}=await import("./print-config.js");if(s(t,o,e))return;if(t.checkOnly===!0){if(e.info(`Preflight: ${o.plan.releases.length} pending release(s)${o.channel?` on channel "${o.channel.tag}"`:""}.`),o.plan.warnings.length>0)for(const n of o.plan.warnings)e.warn(` - ${n}`);process.exitCode=o.plan.releases.length===0?1:0;return}if(o.plan.releases.length===0){e.info("No pending releases — nothing to version."),process.exitCode=0;return}o.channel&&e.info(`Channel: ${o.channel.tag}${o.channel.prerelease?` (preid: ${o.channel.prerelease})`:""}`),e.info(`${r?"[dry-run] would version":"Versioning"} ${o.plan.releases.length} package(s)...`);for(const n of o.plan.releases)e.info(` ${n.name}: ${n.oldVersion} → ${n.newVersion}`);let i;try{i=await c(o,{commit:t.commit===!0,dryRun:r})}catch(n){if(n instanceof d&&n.code==="STAGE_PENDING"){e.error(n.message),n.hint&&(e.info(""),e.info(`Next steps: ${n.hint}`)),process.exitCode=1;return}throw n}if(r){e.info(""),e.info(`[dry-run] would write ${i.changedFiles.length} file(s):`);for(const n of i.changedFiles)e.info(` ${n}`);if(i.deletedFiles.length>0){e.info(`[dry-run] would delete ${i.deletedFiles.length} change file(s):`);for(const n of i.deletedFiles)e.info(` ${n}`)}e.info(""),e.info("Dry run complete. No changes made.")}else e.info(""),e.info(`Wrote ${i.changedFiles.length} file(s); deleted ${i.deletedFiles.length} consumed change file(s).`),i.commitSha?e.info(`Committed as ${i.commitSha.slice(0,7)}.`):t.commit&&e.warn("--commit was requested but no commit was made (likely no changes to commit).");if(o.plan.warnings.length>0){e.info(""),e.warn(`${o.plan.warnings.length} warning(s):`);for(const n of o.plan.warnings)e.warn(` - ${n}`)}};export{p as default};
@@ -1,3 +1,7 @@
1
- import{createRequire as B}from"node:module";import{getAffectedProjects as F}from"@visulima/task-runner";import{b as H,O as T}from"./bin.js";const C=B(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[t,r]=g.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return g.getBuiltinModule(e)}return C(e)},{execFile:D}=A("node:child_process"),{promisify:q}=A("node:util"),P=q(D),G=["[skip ci]","[ci skip]","[no ci]","[vis skip]","[nx skip]"],N=["[vis deploy]","[nx deploy]"],U=["vis","nx"],J=["CACHED_COMMIT_REF","VERCEL_GIT_PREVIOUS_SHA","GITHUB_BASE_REF","CI_COMMIT_BEFORE_SHA"],V=/^[\w./~^@{}][\w.\-/~^@{}]*$/,z=(e=process.env)=>{for(const t of J){const r=e[t];if(r&&r.trim().length>0)return r.trim()}},_=e=>{if(!V.test(e))throw new Error(`Invalid git ref: "${e}". Refs must start with an alphanumeric character or one of _ . / ~ ^ @ { } and may only contain letters, digits, dots, dashes, underscores, slashes, tildes, carets, @, and braces.`)},L=async(e,t)=>{try{return await P("git",["rev-parse","--verify",`${t}^{commit}`],{cwd:e}),!0}catch{return!1}},W=async e=>{try{const{stdout:t}=await P("git",["log","-1","--pretty=%B"],{cwd:e});return t}catch{return""}},O=(e,t,r)=>U.some(c=>e.includes(`[${c} ${t} ${r}]`)),Z=(e,t)=>G.some(r=>e.includes(r))||O(e,"skip",t),K=(e,t)=>N.some(r=>e.includes(r))||O(e,"deploy",t),f=(e,t,r,c)=>({action:"build",message:r,project:e,reason:t,...c}),b=(e,t,r,c)=>({action:"skip",message:r,project:e,reason:t,...c}),Q=e=>`${e.action==="skip"?"🛑":"✅"} ${e.message}`,X=(e,t)=>e.action==="skip"||t?0:1,E=new Set(["deep","direct","none"]),re=async({argument:e,logger:t,options:r,visConfig:c,workspaceRoot:l})=>{const o=e[0]??"",k=!!r.json,R=!!r.verbose,I=!!(r["exit-zero-on-build"]??r.exitZeroOnBuild),p=s=>{R&&!k&&t.info(`❱ ${s}`)},n=s=>{k?process.stdout.write(`${JSON.stringify(s)}
2
- `):t.info(Q(s)),process.exit(X(s,I))};if(!o)return n(f("","missing-project-argument","Missing project argument. Usage: vis ci ignore <project>"));if(!l)return n(f(o,"workspace-error","Could not determine workspace root building defensively"));const m=await W(l),$=m.trim().split(`
3
- `)[0]??"";if(p(`commit: ${$}`),m&&K(m,o))return n(f(o,"commit-force-deploy",`Force-deploy keyword in commit: "${$}"`));if(m&&Z(m,o))return n(b(o,"commit-skip",`Skip keyword in commit: "${$}"`));let h,v;try{({packageJsons:v,workspace:h}=H(l,c))}catch(s){const a=s instanceof Error?s.message:String(s);return n(f(o,"workspace-error",`Workspace discovery failed (${a}) — building defensively`))}if(!Object.hasOwn(h.projects,o))return n(f(o,"project-unknown",`Project "${o}" not found in workspace — building defensively`));try{const s=r.base?.trim(),a=z();let i=s||a||"HEAD~1";const u=r.head?.trim()||"HEAD";_(i),_(u),p(`resolved base ref: ${i} (source: ${s?"flag":a?"ci-env":"default"})`);const S=L(l,i),x=T(l,h,v);await S||(p(`base ref ${i} not reachable — falling back to HEAD~1`),i="HEAD~1"),p(`comparing ${i}...${u}`);const w=r.downstream??"deep",y=r.upstream??"none";if(!E.has(w))throw new Error(`Invalid --downstream value: "${w}". Must be "none", "direct", or "deep".`);if(!E.has(y))throw new Error(`Invalid --upstream value: "${y}". Must be "none", "direct", or "deep".`);const M={base:i,downstream:w,head:u,projectGraph:x,projects:h.projects,upstream:y,workspaceRoot:l},d=await F(M);p(`changed files: ${d.changedFiles.length}`),p(`affected projects: ${d.affectedProjects.join(", ")||"(none)"}`);const j={base:i,head:u};return d.changedFiles.length===0?n(b(o,"no-changes",`No files changed between ${i}...${u}`,{...j,affectedProjects:[]})):d.affectedProjects.includes(o)?n(f(o,"project-affected",`Build ${o}: affected by ${d.changedFiles.length} changed file(s)`,{...j,affectedProjects:d.affectedProjects})):n(b(o,"project-not-affected",`Skip ${o}: not affected by changes between ${i}...${u}`,{...j,affectedProjects:d.affectedProjects}))}catch(s){const a=s instanceof Error?s.message:String(s);return t.error(`Affected detection failed: ${a}`),n(f(o,"workspace-error",`Affected detection failed (${a}) — building defensively`))}};export{re as default};
1
+ import{createRequire as $}from"node:module";import{N as y,R as l,S as d,h as b}from"../packem_shared/ai-analysis-CubpCxZJ.js";import{h as x,d as _,e as w}from"./cli-main.js";import"../packem_shared/bin-CnDBuLh3.js";import{j as S,E as p,q as j,I as E,s as I}from"../packem_shared/index.server-J83sowC4.js";const C=$(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const u={command:"ai",description:"AI-assisted commands: provider detection, cache management, and failure-fix proposals."},N=e=>{if(typeof e!="function")return String(e);const{name:t}=e;return t==="Boolean"?"boolean":t==="Number"?"number":t==="String"?"string":t??"unknown"},R=e=>{const t=[...e.commandPath??[],e.name].join(" "),i=(e.examples??[]).map(([o,r])=>({command:o??"",description:r??""})),n=(e.options??[]).map(o=>({defaultValue:o.defaultValue,description:o.description,name:o.name,type:N(o.type)}));return{argument:e.argument?{description:e.argument.description,name:e.argument.name}:void 0,description:e.description??"",examples:i,name:e.name,options:n,path:t}},f=(e,t=u)=>({command:t.command,description:t.description,subcommands:e.map(i=>R(i))}),P=(e,t=u)=>`${JSON.stringify(f(e,t),void 0,2)}
2
+ `,T=(e,t=u)=>{const i=f(e,t),n=[S(`vis ${i.command} — ${i.description}`),"",p("Subcommands:")];for(const o of i.subcommands){const r=o.argument?` ${j(`<${o.argument.name}>`)}`:"";if(n.push(""),n.push(` ${E(`vis ${o.path}`)}${r}`),o.description&&n.push(` ${o.description}`),o.options.length>0){const s=o.options.map(c=>`--${c.name}${c.type==="boolean"?"":`=<${c.type}>`}`).join(", ");n.push(p(` options: ${s}`))}if(o.examples.length>0){n.push(p(" examples:"));for(const s of o.examples){const c=s.description?p(` ${s.description}`):"";n.push(` ${I(s.command)}${c}`)}}}return n.push(""),n.push(p(`Run \`vis ${i.command} discover-help\` for the machine-readable JSON catalogue (designed for AI agents).`)),n.push(p(`Run \`vis ${i.command} <subcommand> --help\` for full usage of a specific subcommand.`)),`${n.join(`
3
+ `)}
4
+ `},h=async()=>{const{default:e}=await import("./cli-main.js").then(t=>t.bp);return e.filter(t=>t.name!=="ai")},B=async()=>{const e=await h();process.stderr.write(T(e))},F=async()=>{const e=await h();process.stdout.write(P(e))},V=async({logger:e,visConfig:t})=>{const i=t?.ai,n=l(i);if(!n){e.error("No AI provider available to test."),process.exitCode=1;return}e.info(`Testing ${n.name}...`);try{const o=await b(n,"Reply with exactly: OK",{timeoutMs:3e4});e.info(`Provider ${n.name} responded: ${o.stdout.trim().slice(0,200)}`)}catch(o){const r=o instanceof Error?o.message:String(o);e.error(`Provider ${n.name} failed: ${r}`),process.exitCode=1}},k=({logger:e,options:t,visConfig:i})=>{const n=t.format??"table",o=i?.ai,r=y(),s=l(o);if(n==="json"){const a=r.map(m=>({available:m.available,method:m.detectionMethod,name:m.name,path:m.path,priority:d[m.name]??0,selected:m.name===s?.name,version:m.version}));process.stdout.write(`${JSON.stringify(a,void 0,2)}
5
+ `);return}const c=r.map(a=>({method:a.detectionMethod??"-",path:a.path??"-",priority:String(d[a.name]??0),provider:a.name,selected:a.name===s?.name?">>>":"",status:a.available?"available":"not found",version:a.version??"-"})),g=process.stdout.columns||80,v=x(_.createElement(w,{data:c}),{columns:g});e.info(v),s?e.info(`
6
+ Selected provider: ${s.name} (priority ${String(d[s.name]??0)})`):e.info(`
7
+ No AI provider available. Install one of the supported AI CLI tools.`)},H=async e=>{const{aiFix:t}=await import("./fix.js");await t(e)};export{F as aiDiscoverHelpExecute,H as aiFixExecute,k as aiProvidersExecute,B as aiRootExecute,V as aiTestExecute};
@@ -1,8 +1,33 @@
1
- import{E as u}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{m as p}from"../packem_shared/index-BDmTbWX1.js";const f={docker:".dockerignore",npm:".npmignore",slug:".slugignore",vercel:".vercelignore"},m=[".git",".gitattributes",".gitignore",".editorconfig",".vscode/",".idea/",".DS_Store","*.md","LICENSE*","LICENCE*","CHANGELOG*","CONTRIBUTING*","AUTHORS*","docs/","doc/","examples/","example/",".github/",".gitlab-ci.yml",".circleci/","appveyor.yml",".eslintrc*","eslint.config.*",".prettierrc*","prettier.config.*","*.log","npm-debug.log*","*.d.ts","*.map","*.flow","tsconfig*.json","__tests__/","__mocks__/","test/","tests/","*.test.*","*.spec.*","coverage/",".nyc_output/"],w={docker:["node_modules",".vis/","Dockerfile*",".dockerignore"],npm:[],slug:["node_modules"],vercel:["node_modules",".vercel/"]},$=e=>{const r=new Set,n=[];for(const t of[...m,...w[e]])r.has(t)||(r.add(t),n.push(t));return n},h=e=>e.trim(),_="# Added by vis ignore",v=(e,r)=>{const n=new Set;for(const o of e.split(/\r?\n/u)){const c=h(o);c!==""&&!c.startsWith("#")&&n.add(c)}const t=[];for(const o of r)n.has(o)||(n.add(o),t.push(o));if(t.length===0)return{added:t,content:e};const s=e.includes(`\r
2
- `)?`\r
3
- `:`
4
- `,d=[_,...t].join(s);if(e.trim()==="")return{added:t,content:`${d}${s}`};const i=e.endsWith(`
5
- `)?s:`${s}${s}`;return{added:t,content:`${e}${i}${d}${s}`}},E=e=>e==="docker"||e==="npm"||e==="slug"||e==="vercel",k=async(e,r)=>{try{return await e.readFile(r,"utf8")}catch{return""}},N=async({fs:e,logger:r,options:n,process:t,workspaceRoot:s})=>{const d=s??t.cwd,i=n.target??"docker";if(!E(i))throw new Error(`Invalid --target "${i}". Expected one of: docker, vercel, npm, slug.`);const o=f[i],c=p(d,o),g=await k(e,c),{added:a,content:l}=v(g,$(i));if(n.json){process.stdout.write(`${JSON.stringify({added:a,file:o,target:i},null,2)}
6
- `);return}if(n.write){if(a.length===0){r.info(`${o} is already up to date (no new patterns).`);return}await e.writeFile(c,l),r.info(`Added ${a.length} pattern(s) to ${o}.`);return}process.stdout.write(l.endsWith(`
7
- `)?l:`${l}
8
- `),r.info(u(`(${a.length} new pattern(s); re-run with --write to save ${o})`))};export{N as default};
1
+ import{createRequire as P}from"node:module";import{f as D,v as O,T as w}from"../packem_shared/index-OQZQyN5R.js";import{N as V}from"./config.js";import{p as e}from"./cli-main.js";import{w as q}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{W as A}from"../packem_shared/build-scripts-Doxce2VM.js";import{O as F}from"../packem_shared/native-config-sync-4K9wWTj5.js";const R=P(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,C=l=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[t,s]=$.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return $.getBuiltinModule(l)}return R(l)},{spawnSync:T}=C("node:child_process"),M=/(defineConfig\s*\(\s*\{)/,W=/(export\s+default\s+\{)/,v=(l,t)=>`${t}${JSON.stringify(l)}: true,`,B=(l,t)=>{if(t.length===0)return{added:[],skipped:[],status:"noop"};const s=V(l);if(!s)return{added:[],skipped:t,status:"no-config"};if(!D(s))return{added:[],skipped:t,status:"no-config"};const i=O(s),h=i.search(/installScripts\s*:\s*\{/);let a=null,r=0;if(h!==-1){const c=i.slice(h),d=/(allow\s*:\s*\{)([^}]*)(\})/.exec(c);d?.index!==void 0&&(a=d,r=h+d.index)}if(a){const c=a[2]??"",d=new Set;for(const g of c.matchAll(/["']([^"']+)["']\s*:/g))d.add(g[1]);for(const g of c.matchAll(/(?:^|,|\{)\s*([a-z_$][\w-]*)\s*:/gi))d.add(g[1]);const u=[],k=[];for(const g of t)d.has(g)?k.push(g):u.push(g);if(u.length===0)return{added:[],configPath:s,skipped:k,status:"noop"};const b=/\n([ \t]+)\S/.exec(c)?.[1]??" ",_=`
2
+ ${u.map(g=>v(g,b)).join(`
3
+ `)}`,y=c.replace(/\s+$/,""),S=c.slice(y.length),j=`${y}${y.endsWith(",")||y===""?"":","}${_}${S.length>0?S:`
4
+ `}`,N=`${i.slice(0,r)}${a[1]}${j}${a[3]}${i.slice(r+a[0].length)}`;return w(s,N),{added:u,configPath:s,skipped:k,status:"updated"}}const n=/(installScripts\s*:\s*\{)/;if(n.test(i)){const c=`
5
+ allow: {
6
+ ${t.map(u=>v(u," ")).join(`
7
+ `)}
8
+ },`,d=i.replace(n,`$1${c}`);return w(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const o=/(policies\s*:\s*\{)/;if(o.test(i)){const c=`
9
+ installScripts: {
10
+ allow: {
11
+ ${t.map(u=>v(u," ")).join(`
12
+ `)}
13
+ },
14
+ },`,d=i.replace(o,`$1${c}`);return w(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const f=/(security\s*:\s*\{)/;if(f.test(i)){const c=`
15
+ policies: {
16
+ installScripts: {
17
+ allow: {
18
+ ${t.map(u=>v(u," ")).join(`
19
+ `)}
20
+ },
21
+ },
22
+ },`,d=i.replace(f,`$1${c}`);return w(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const p=M.exec(i)??W.exec(i);if(!p)return{added:[],configPath:s,skipped:t,status:"missing-anchor"};const m=`
23
+ security: {
24
+ policies: {
25
+ installScripts: {
26
+ allow: {
27
+ ${t.map(c=>v(c," ")).join(`
28
+ `)}
29
+ },
30
+ },
31
+ },
32
+ },`,x=`${i.slice(0,p.index+p[0].length)}${m}${i.slice(p.index+p[0].length)}`;return w(s,x),{added:t,configPath:s,skipped:[],status:"updated"}},L=async({options:l,visConfig:t,workspaceRoot:s})=>{const i=s??process.cwd(),h=q(i);if(h.name==="pnpm"&&!l.scan){e.info("Delegating to pnpm approve-builds...");const a=["approve-builds"];l.all&&a.push("--all");const r=T("pnpm",a,{cwd:i,stdio:"inherit"});if(r.error)throw new Error(`Failed to run pnpm approve-builds: ${r.error.message}`);if(r.status!==0&&r.status!==null&&(e.error(`pnpm approve-builds exited with code ${r.status}`),process.exitCode=r.status),!l.syncNative){e.notice(""),e.notice("Tip: vis.config.ts security.policies.installScripts.allow may now be out of sync with pnpm-workspace.yaml."),e.notice("Run 'vis check --security-config' to compare, or copy the new entries into vis.config.ts.");return}}else{const a=t?.security?.policies?.installScripts?.allow??{},r=t?.security?.pinVersions===!0,n=A(i,a,{pinVersions:r});if(n.unapproved.length===0)e.success("No unapproved build scripts found."),l.write&&(e.info(""),e.info("Nothing to write — there are no unapproved build scripts."));else{e.warn(`Found ${n.unapproved.length} package${n.unapproved.length===1?"":"s"} with unapproved build scripts:
33
+ `);for(const o of n.unapproved)e.info(` ${o.name} (${o.hooks.join(", ")})`);e.notice(""),e.notice("To approve these packages, add them to vis.config.ts:"),e.notice(""),e.notice(" security: {"),e.notice(" policies: {"),e.notice(" installScripts: {"),e.notice(" allow: {");for(const o of n.unapproved){const f=r&&o.version?`${o.name}@${o.version}`:o.name;e.notice(` "${f}": true,`)}if(e.notice(" },"),e.notice(" },"),e.notice(" },"),e.notice(" },"),h.name==="pnpm"&&(e.notice(""),e.notice("Or run 'pnpm approve-builds' to update pnpm-workspace.yaml directly.")),l.write){const o=t?.security?.pinVersions===!0,f=n.unapproved.map(m=>o&&m.version?`${m.name}@${m.version}`:m.name),p=B(i,f);switch(e.info(""),p.status){case"missing-anchor":{e.warn(`Could not locate 'defineConfig({' or 'export default {' in ${String(p.configPath)} — please add entries manually.`);break}case"no-config":{e.warn("No vis.config.ts found. Run 'vis init' first, then re-run with --write.");break}case"noop":{e.info(`All ${String(f.length)} entr${f.length===1?"y":"ies"} were already present in vis.config.ts security.policies.installScripts.allow.`);break}default:e.success(`Wrote ${String(p.added.length)} entr${p.added.length===1?"y":"ies"} to ${String(p.configPath)}.`),p.skipped.length>0&&e.info(`Skipped ${String(p.skipped.length)} already-present entr${p.skipped.length===1?"y":"ies"}.`)}}}if(n.excess.length>0){e.notice(""),e.warn(`Stale installScripts.allow entries — ${String(n.excess.length)} pattern${n.excess.length===1?"":"s"} no longer match any installed package:`);for(const o of n.excess)e.info(` ${o}`);e.notice("Consider removing these entries from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){e.notice(""),e.warn(`Version drift — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} pinned to an outdated version:`);for(const{from:o,to:f}of n.versionDrift)e.info(` ${o} → ${f}`);e.notice("Rename the keys in vis.config.ts security.policies.installScripts.allow to migrate.")}}if(l.syncNative){const a=t?.security?.policies?.installScripts?.allow??{};if(Object.keys(a).length===0)e.warn("No security.policies.installScripts.allow configured in vis.config.ts. Nothing to sync.");else{const r=F(h.name,i,a);e.info("");for(const n of r)e.success(n)}}};export{L as default};
@@ -1,4 +1,3 @@
1
- import{E as d}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{m as g,f as y,v as k,T as w,O as l}from"../packem_shared/index-BDmTbWX1.js";import{a as h,b as x,f as b}from"../packem_shared/subtree-C7bZuiSQ.js";import{o as u}from"../packem_shared/utils-Cxree603.js";import{t as A,W as R}from"./bin.js";import{a as $}from"./config.js";const j=["aube-workspace.yaml","pnpm-workspace.yaml"],v=/^\s*packages\s*:\s*$/,E=/^(\s*)-\s/,q=(c,i)=>{const r=c.includes(`\r
2
- `)?`\r
3
- `:`
4
- `,e=c.split(/\r?\n/),o=e.findIndex(t=>v.test(t));if(o===-1)return;let s=" ";for(let t=o+1;t<e.length;t++){const a=E.exec(e[t]);if(a){s=a[1];break}if(e[t].trim().length>0)break}return e.splice(o+1,0,`${s}- "${i}"`),e.join(r)},I=(c,i,r)=>{const e=g(c,"package.json");let o;try{o=$(e)}catch{return!1}const{workspaces:s}=o;return Array.isArray(s)?s.includes(i)?!1:(r||l(e,{...o,workspaces:[...s,i]},{detectIndent:!0}),!0):s&&typeof s=="object"&&Array.isArray(s.packages)?s.packages.includes(i)?!1:(r||l(e,{...o,workspaces:{...s,packages:[...s.packages,i]}},{detectIndent:!0}),!0):!1},P=({dryRun:c=!1,prefix:i,workspaceRoot:r})=>{const e=u(i),o=A(r);if(!o)return{status:"no-config"};if(R(r,o).some(s=>u(s)===e))return{status:"already-covered"};for(const s of j){const t=g(r,s);if(!y(t))continue;const a=q(k(t),e);if(a!==void 0)return c||w(t,a),{entry:e,file:s,status:"added"}}return I(r,e,c)?{entry:e,file:"package.json",status:"added"}:{status:"no-config"}},H=async({argument:c,fs:i,logger:r,options:e,process:o,workspaceRoot:s})=>{const t=c[0];if(!t)throw new Error("Missing <source>. Pass a git repository URL or local path to import.");if(!e.prefix)throw new Error("Missing --prefix <dir>. Pass the target directory in the monorepo (e.g. packages/tooling/foo).");const a=s??o.cwd,n=u(e.prefix),f=e.ref??"HEAD";if(h(a),await(async p=>{try{return await i.access(p),!0}catch{return!1}})(g(a,n)))throw new Error(`Target "${n}" already exists. git subtree add requires a non-existent prefix.`);if(e.dryRun){const p=e.squash?" --squash":"",m=e.message?` -m "${e.message}"`:"";r.info("Dry run — no changes will be made. Planned steps:"),r.info(` git subtree add --prefix=${n}${p}${m} ${t} ${f}`),e.noRegister||r.info(` register ${n} into the workspace config (skipped if already covered by an existing glob)`);return}if(x(a),r.info(`Importing ${d(t)}@${f} → ${n} ...`),b({cwd:a,message:e.message,prefix:n,ref:f,repo:t,squash:e.squash}),r.info(`✓ Imported ${t} into ${n} (history preserved).`),e.noRegister)r.info(d(`Skipped workspace registration (--no-register). Add ${n} to your workspace config manually.`));else{const p=P({prefix:n,workspaceRoot:a});p.status==="already-covered"?r.info(`✓ ${n} is already covered by an existing workspace glob.`):p.status==="added"?r.info(`✓ Registered ${p.entry} in ${p.file}.`):r.warn(`Could not auto-register ${n}: no workspace config found. Add it to pnpm-workspace.yaml or package.json#workspaces manually.`)}r.info(d("Note: project.json / nx tags are not generated. Add them if your tooling needs them."))};export{H as default};
1
+ import{createRequire as B}from"node:module";import{getAffectedProjects as F}from"@visulima/task-runner";import{b as H,O as T}from"./cli-main.js";const C=B(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[t,r]=g.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return g.getBuiltinModule(e)}return C(e)},{execFile:D}=A("node:child_process"),{promisify:q}=A("node:util"),P=q(D),G=["[skip ci]","[ci skip]","[no ci]","[vis skip]","[nx skip]"],N=["[vis deploy]","[nx deploy]"],U=["vis","nx"],J=["CACHED_COMMIT_REF","VERCEL_GIT_PREVIOUS_SHA","GITHUB_BASE_REF","CI_COMMIT_BEFORE_SHA"],V=/^[\w./~^@{}][\w.\-/~^@{}]*$/,z=(e=process.env)=>{for(const t of J){const r=e[t];if(r&&r.trim().length>0)return r.trim()}},_=e=>{if(!V.test(e))throw new Error(`Invalid git ref: "${e}". Refs must start with an alphanumeric character or one of _ . / ~ ^ @ { } and may only contain letters, digits, dots, dashes, underscores, slashes, tildes, carets, @, and braces.`)},L=async(e,t)=>{try{return await P("git",["rev-parse","--verify",`${t}^{commit}`],{cwd:e}),!0}catch{return!1}},W=async e=>{try{const{stdout:t}=await P("git",["log","-1","--pretty=%B"],{cwd:e});return t}catch{return""}},O=(e,t,r)=>U.some(c=>e.includes(`[${c} ${t} ${r}]`)),Z=(e,t)=>G.some(r=>e.includes(r))||O(e,"skip",t),K=(e,t)=>N.some(r=>e.includes(r))||O(e,"deploy",t),f=(e,t,r,c)=>({action:"build",message:r,project:e,reason:t,...c}),b=(e,t,r,c)=>({action:"skip",message:r,project:e,reason:t,...c}),Q=e=>`${e.action==="skip"?"🛑":"✅"} ${e.message}`,X=(e,t)=>e.action==="skip"||t?0:1,E=new Set(["deep","direct","none"]),re=async({argument:e,logger:t,options:r,visConfig:c,workspaceRoot:l})=>{const o=e[0]??"",k=!!r.json,R=!!r.verbose,I=!!(r["exit-zero-on-build"]??r.exitZeroOnBuild),p=s=>{R&&!k&&t.info(`❱ ${s}`)},n=s=>{k?process.stdout.write(`${JSON.stringify(s)}
2
+ `):t.info(Q(s)),process.exit(X(s,I))};if(!o)return n(f("","missing-project-argument","Missing project argument. Usage: vis ci ignore <project>"));if(!l)return n(f(o,"workspace-error","Could not determine workspace root — building defensively"));const m=await W(l),$=m.trim().split(`
3
+ `)[0]??"";if(p(`commit: ${$}`),m&&K(m,o))return n(f(o,"commit-force-deploy",`Force-deploy keyword in commit: "${$}"`));if(m&&Z(m,o))return n(b(o,"commit-skip",`Skip keyword in commit: "${$}"`));let h,v;try{({packageJsons:v,workspace:h}=H(l,c))}catch(s){const a=s instanceof Error?s.message:String(s);return n(f(o,"workspace-error",`Workspace discovery failed (${a}) — building defensively`))}if(!Object.hasOwn(h.projects,o))return n(f(o,"project-unknown",`Project "${o}" not found in workspace — building defensively`));try{const s=r.base?.trim(),a=z();let i=s||a||"HEAD~1";const u=r.head?.trim()||"HEAD";_(i),_(u),p(`resolved base ref: ${i} (source: ${s?"flag":a?"ci-env":"default"})`);const S=L(l,i),x=T(l,h,v);await S||(p(`base ref ${i} not reachable — falling back to HEAD~1`),i="HEAD~1"),p(`comparing ${i}...${u}`);const w=r.downstream??"deep",y=r.upstream??"none";if(!E.has(w))throw new Error(`Invalid --downstream value: "${w}". Must be "none", "direct", or "deep".`);if(!E.has(y))throw new Error(`Invalid --upstream value: "${y}". Must be "none", "direct", or "deep".`);const M={base:i,downstream:w,head:u,projectGraph:x,projects:h.projects,upstream:y,workspaceRoot:l},d=await F(M);p(`changed files: ${d.changedFiles.length}`),p(`affected projects: ${d.affectedProjects.join(", ")||"(none)"}`);const j={base:i,head:u};return d.changedFiles.length===0?n(b(o,"no-changes",`No files changed between ${i}...${u}`,{...j,affectedProjects:[]})):d.affectedProjects.includes(o)?n(f(o,"project-affected",`Build ${o}: affected by ${d.changedFiles.length} changed file(s)`,{...j,affectedProjects:d.affectedProjects})):n(b(o,"project-not-affected",`Skip ${o}: not affected by changes between ${i}...${u}`,{...j,affectedProjects:d.affectedProjects}))}catch(s){const a=s instanceof Error?s.message:String(s);return t.error(`Affected detection failed: ${a}`),n(f(o,"workspace-error",`Affected detection failed (${a}) — building defensively`))}};export{re as default};