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

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 (93) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/binx.js +2 -2
  4. package/dist/config/index.d.ts +18 -0
  5. package/dist/packem_chunks/bin.js +202 -202
  6. package/dist/packem_chunks/handler10.js +1 -1
  7. package/dist/packem_chunks/handler12.js +1 -1
  8. package/dist/packem_chunks/handler13.js +1 -1
  9. package/dist/packem_chunks/handler14.js +1 -1
  10. package/dist/packem_chunks/handler15.js +1 -1
  11. package/dist/packem_chunks/handler16.js +1 -1
  12. package/dist/packem_chunks/handler17.js +1 -1
  13. package/dist/packem_chunks/handler18.js +1 -1
  14. package/dist/packem_chunks/handler19.js +1 -1
  15. package/dist/packem_chunks/handler21.js +1 -1
  16. package/dist/packem_chunks/handler27.js +1 -1
  17. package/dist/packem_chunks/handler28.js +1 -1
  18. package/dist/packem_chunks/handler29.js +1 -1
  19. package/dist/packem_chunks/handler30.js +1 -2
  20. package/dist/packem_chunks/handler31.js +2 -2
  21. package/dist/packem_chunks/handler32.js +2 -2
  22. package/dist/packem_chunks/handler33.js +2 -3
  23. package/dist/packem_chunks/handler34.js +3 -6
  24. package/dist/packem_chunks/handler35.js +6 -1
  25. package/dist/packem_chunks/handler36.js +1 -42
  26. package/dist/packem_chunks/handler37.js +42 -8
  27. package/dist/packem_chunks/handler38.js +8 -9
  28. package/dist/packem_chunks/handler39.js +9 -75
  29. package/dist/packem_chunks/handler4.js +1 -1
  30. package/dist/packem_chunks/handler40.js +75 -5
  31. package/dist/packem_chunks/handler41.js +5 -4
  32. package/dist/packem_chunks/handler42.js +4 -3
  33. package/dist/packem_chunks/handler43.js +3 -2
  34. package/dist/packem_chunks/handler44.js +2 -1
  35. package/dist/packem_chunks/handler45.js +1 -1
  36. package/dist/packem_chunks/handler46.js +1 -1
  37. package/dist/packem_chunks/handler47.js +1 -3
  38. package/dist/packem_chunks/handler48.js +3 -1
  39. package/dist/packem_chunks/handler49.js +1 -7
  40. package/dist/packem_chunks/handler5.js +1 -1
  41. package/dist/packem_chunks/handler50.js +6 -32
  42. package/dist/packem_chunks/handler51.js +33 -3
  43. package/dist/packem_chunks/handler52.js +3 -8
  44. package/dist/packem_chunks/handler53.js +6 -2
  45. package/dist/packem_chunks/handler54.js +4 -1
  46. package/dist/packem_chunks/handler55.js +1 -12
  47. package/dist/packem_chunks/handler56.js +11 -6
  48. package/dist/packem_chunks/handler57.js +7 -5
  49. package/dist/packem_chunks/handler58.js +5 -11
  50. package/dist/packem_chunks/handler59.js +11 -3
  51. package/dist/packem_chunks/handler60.js +3 -22
  52. package/dist/packem_chunks/handler61.js +21 -60
  53. package/dist/packem_chunks/handler62.js +61 -3
  54. package/dist/packem_chunks/handler63.js +3 -6
  55. package/dist/packem_chunks/handler64.js +6 -708
  56. package/dist/packem_chunks/handler65.js +708 -24
  57. package/dist/packem_chunks/handler66.js +24 -25
  58. package/dist/packem_chunks/handler67.js +25 -153
  59. package/dist/packem_chunks/handler68.js +153 -10
  60. package/dist/packem_chunks/handler69.js +10 -24
  61. package/dist/packem_chunks/handler70.js +24 -322
  62. package/dist/packem_chunks/handler71.js +322 -48
  63. package/dist/packem_chunks/handler72.js +48 -27
  64. package/dist/packem_chunks/handler73.js +27 -3
  65. package/dist/packem_chunks/handler74.js +3 -190
  66. package/dist/packem_chunks/handler75.js +189 -37
  67. package/dist/packem_chunks/handler76.js +38 -0
  68. package/dist/packem_chunks/handler8.js +1 -1
  69. package/dist/packem_chunks/handler9.js +1 -1
  70. package/dist/packem_chunks/heal-accept.js +1 -1
  71. package/dist/packem_chunks/help-command.js +1 -1
  72. package/dist/packem_chunks/list.js +1 -1
  73. package/dist/packem_chunks/loader.js +1 -1
  74. package/dist/packem_chunks/orchestrator.js +1 -1
  75. package/dist/packem_chunks/sync2.js +1 -1
  76. package/dist/packem_chunks/tripwire.js +1 -1
  77. package/dist/packem_chunks/verify-lockfile.js +1 -1
  78. package/dist/packem_chunks/version-resolver.js +1 -1
  79. package/dist/packem_shared/command-runtime-CR70qSUM.js +1 -0
  80. package/dist/packem_shared/{cyclonedx-kYozDyxp.js → cyclonedx-Cadls41z.js} +1 -1
  81. package/dist/packem_shared/{index-Du8RWawQ.js → index-3jMNqQom.js} +1 -1
  82. package/dist/packem_shared/index-Bt521H5J.js +30 -0
  83. package/dist/packem_shared/{index-CgcF6_wo.js → index-DGSsjmpV.js} +1 -1
  84. package/dist/packem_shared/{pm-runner-OGResYrA.js → pm-runner-BKZQo7Ts.js} +1 -1
  85. package/dist/packem_shared/{provenance-_CJjMKwu.js → provenance-BFEwKgI3.js} +1 -1
  86. package/dist/packem_shared/{resolve-explicit-CMDl55Nz.js → resolve-explicit-C6WM-I2u.js} +1 -1
  87. package/dist/packem_shared/{s1ngularity-Dhr3bPk0.js → s1ngularity-DCPmPE5M.js} +1 -1
  88. package/dist/packem_shared/{signatures-C730vkyK.js → signatures-Xpd6HjG_.js} +1 -1
  89. package/index.d.ts +201 -201
  90. package/index.js +26 -26
  91. package/package.json +13 -13
  92. package/schemas/vis-config.schema.json +12 -0
  93. package/dist/packem_shared/index-yBikBkHT.js +0 -30
@@ -1,75 +1,9 @@
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-BfaR0jKT.js"),y=await m(e);y.release&&(h=y.release)}catch{}const b=r(h,{packageManager:p,provider:o});t.info(""),t.info(`Generating ${b.length} workflow file(s) for ${o}:`);for(const m of b){const y=l(e,m.path);if(await k(y)){t.warn(` ${m.path} — already exists, skipping`);continue}if(n){t.info(` ${m.path} — [dry-run] would write ${m.content.length} bytes`);continue}const x=await import("node:path");await J(x.dirname(y),{recursive:!0}),await w(y,m.content),t.info(` ${m.path} — wrote ${m.content.length} bytes`)}},V=e=>{e.info(""),e.info("Suggested vis.config.ts release block:"),e.info(""),e.info(` release: {
64
- baseBranch: "main",
65
- defaultManaged: true,
66
- channels: {
67
- main: { tag: "latest", mode: "version-pr" },
68
- },
69
- publish: {
70
- packManager: "auto",
71
- publishStrategy: "npm-publish-tarball",
72
- publishArgs: ["--provenance"],
73
- cleanPackageJson: true,
74
- },
75
- },`)};export{z as default};
1
+ import{b as j}from"./orchestrator.js";const A=async({logger:u,options:m,workspaceRoot:h})=>{const c=h??process.cwd(),a=[];let n;try{n=await j({cwd:c}),a.push({message:"vis.config.ts loaded; release block parsed.",name:"config-loads",severity:"error",status:"pass"})}catch(e){a.push({message:`Config failed to load: ${e.message}`,name:"config-loads",severity:"error",status:"fail"}),await $(u,m,a),process.exitCode=1;return}n.packages.length===0?a.push({message:"No packages discovered. Ensure your package manager's workspace block resolves.",name:"workspace-discovered",severity:"error",status:"fail"}):a.push({message:`Discovered ${n.packages.length} workspace package(s).`,name:"workspace-discovered",severity:"info",status:"pass"});try{const e=await n.pm.detectVersion(c);e?a.push({message:`${n.pm.id}@${e} (min required: ${n.pm.minVersion})`,name:"pm-version",severity:"info",status:"pass"}):a.push({message:`Could not detect ${n.pm.id} version.`,name:"pm-version",severity:"warn",status:"skip"})}catch(e){a.push({message:`Skipped: ${e.message}`,name:"pm-version",severity:"warn",status:"skip"})}n.branch&&n.channel?a.push({message:`Branch "${n.branch}" → channel ${n.channel.tag}${n.channel.prerelease?` (preid: ${n.channel.prerelease})`:""}, mode: ${n.channel.mode}`,name:"branch-channel",severity:"info",status:"pass"}):n.branch&&!n.channel?a.push({message:`Branch "${n.branch}" does not match any configured channel. Releases will use dist-tag "latest" by default.`,name:"branch-channel",severity:"warn",status:"fail"}):a.push({message:"No branch detected (detached HEAD or non-git workspace).",name:"branch-channel",severity:"warn",status:"skip"});try{await import("node:child_process").then(({execSync:e})=>{try{return e("gh --version",{stdio:"ignore"}),!0}catch{return!1}})?a.push({message:"gh CLI is on PATH.",name:"gh-cli-available",severity:"info",status:"pass"}):a.push({message:"gh CLI not found. GH releases / PR comments will be skipped.",name:"gh-cli-available",severity:"warn",status:"fail"})}catch{}if(process.env.CI==="true"||process.env.GITHUB_ACTIONS==="true")try{const{createShellRunner:e}=await import("./shell-runner.js"),i=await e().run("gh",["auth","status","--show-token"],{cwd:c,silent:!0}),t=`${i.stdout}
2
+ ${i.stderr}`,s=/Token scopes:\s*(.+)/.exec(t);if(i.exitCode!==0||!s)a.push({message:"Skipped: `gh auth status` did not return a parseable Token scopes line. (Fine-grained tokens / OIDC-only auth fall in this bucket.)",name:"github.token-scopes",severity:"info",status:"skip"});else{const r=s[1].split(",").map(l=>l.trim().replaceAll(/^['"]|['"]$/g,"")).filter(Boolean),o=new Set(["admin:org","admin:repo_hook","delete_repo","repo","site_admin"]),g=r.filter(l=>o.has(l));g.length>0?a.push({message:`Token carries broader scopes than vis needs: ${g.join(", ")}. The release flow needs only contents:write + pull-requests:write (+ optional id-token:write for OIDC). Consider provisioning a fine-grained PAT or scoping the workflow's permissions block.`,name:"github.token-scopes",severity:"warn",status:"fail"}):a.push({message:`Token scopes look appropriately narrow: ${r.join(", ")||"(none)"}.`,name:"github.token-scopes",severity:"info",status:"pass"})}}catch{a.push({message:"Skipped: gh auth status could not be invoked.",name:"github.token-scopes",severity:"info",status:"skip"})}(process.env.CI==="true"||process.env.GITHUB_ACTIONS==="true")&&(process.env.ACTIONS_ID_TOKEN_REQUEST_URL?a.push({message:"GitHub Actions OIDC env vars present.",name:"oidc-available",severity:"info",status:"pass"}):process.env.NPM_TOKEN?a.push({message:"OIDC env vars missing; falling back to NPM_TOKEN. Add `permissions: { id-token: write }` to the workflow to enable trusted publishing.",name:"oidc-available",severity:"warn",status:"fail"}):a.push({message:"Neither OIDC env vars nor NPM_TOKEN are set in CI. Publish will fail.",name:"oidc-available",severity:"error",status:"fail"}));const y=await import("node:fs/promises"),b=await import("node:path");for(const e of n.packages){if(e.manifest.napi===void 0)continue;const i=b.join(e.dir,"npm");try{const t=(await y.readdir(i,{withFileTypes:!0})).filter(g=>g.isDirectory());if(t.length===0){a.push({message:`${e.name} has a napi field but no npm/<platform>/ subdirs. Run pnpm exec napi artifacts before publishing.`,name:`napi-${e.name}-platforms`,severity:"warn",status:"fail"});continue}const s=[];for(const g of t){const l=b.join(i,g.name,"package.json");try{const p=JSON.parse(await y.readFile(l,"utf8"));p.version!==e.version&&s.push(`${g.name} (${p.version} vs parent ${e.version})`)}catch{s.push(`${g.name} (unreadable manifest)`)}}s.length>0?a.push({message:`${e.name}: platform versions out of sync — ${s.join(", ")}. They'll be re-synced on next publish.`,name:`napi-${e.name}-versions`,severity:"warn",status:"fail"}):a.push({message:`${e.name}: ${t.length} platform package(s), all versions in sync.`,name:`napi-${e.name}`,severity:"info",status:"pass"});const r=e.manifest.optionalDependencies??{},o=[];for(const g of t)try{const l=JSON.parse(await y.readFile(b.join(i,g.name,"package.json"),"utf8"));Object.hasOwn(r,l.name)||o.push(l.name)}catch{}o.length>0&&a.push({message:`${e.name}: missing optionalDependencies entries for: ${o.join(", ")}. Consumers won't get the right binary.`,name:`napi-${e.name}-optdeps`,severity:"error",status:"fail"})}catch{a.push({message:`${e.name}: could not read npm/ subdir.`,name:`napi-${e.name}-platforms`,severity:"warn",status:"skip"})}}{const{resolveVersionActionsId:e}=await import("./orchestrator.js").then(t=>t.w),i=n.packages.filter(t=>e(t,n.perPackageConfig.get(t.name)??{})==="jsr");for(const t of i){const s=n.perPackageConfig.get(t.name)??{},r=["jsr","publish","--dry-run","--allow-dirty"],o=s.jsrConfigPath;o!==void 0&&o!=="jsr.json"&&r.push("--config",o);for(const g of s.jsrPublishArgs??[])r.push(g);try{const g=await n.pm.runner.run("npx",r,{cwd:t.dir,silent:!0});g.exitCode===0?a.push({message:`${t.name}: \`jsr publish --dry-run\` passed.`,name:`jsr-dry-run/${t.name}`,severity:"info",status:"pass"}):a.push({message:`${t.name}: \`jsr publish --dry-run\` reported issues (slow types / exports / auth?): ${(g.stderr||g.stdout).trim().slice(0,300)}`,name:`jsr-dry-run/${t.name}`,severity:"warn",status:"fail"})}catch(g){a.push({message:`${t.name}: could not run \`npx jsr publish --dry-run\` (${g.message}). Install the jsr CLI / check network to enable this pre-flight.`,name:`jsr-dry-run/${t.name}`,severity:"warn",status:"skip"})}}}if(n.plan.warnings.length>0)for(const e of n.plan.warnings)a.push({message:e,name:"plan-warning",severity:"warn",status:"fail"});else a.push({message:n.plan.releases.length===0?"No pending releases.":`Plan resolves ${n.plan.releases.length} release(s).`,name:"plan-readable",severity:"info",status:"pass"});const d=n.config.publish?.guards;if(d?.packSecretScan)try{await import("@visulima/secret-scanner"),a.push({message:"@visulima/secret-scanner resolves; pack-set secret scanning will run.",name:"publish-guards.packSecretScan",severity:"info",status:"pass"})}catch{a.push({message:"publish.guards.packSecretScan is enabled but @visulima/secret-scanner is not installed. pnpm add -D @visulima/secret-scanner, or set the gate to false.",name:"publish-guards.packSecretScan",severity:"error",status:"fail"})}d?.audit&&d.audit!=="off"&&a.push({message:`Runtime npm audit gate active at "${d.audit}" severity.`,name:"publish-guards.audit",severity:"info",status:"pass"});const f=n.config.publish?.releaseAssets;if((f?.stampHashes||f?.uploadTarball)&&a.push({message:`Release-asset attestation: stampHashes=${f.stampHashes??!1}, uploadTarball=${f.uploadTarball??!1}.`,name:"publish-releaseAssets",severity:"info",status:"pass"}),n.config.publish?.stage){try{const{execSync:r}=await import("node:child_process"),o=r("npm --version",{stdio:["ignore","pipe","ignore"]}).toString().trim(),[g="0",l="0"]=o.split("."),p=Number.parseInt(g,10)>11||Number.parseInt(g,10)===11&&Number.parseInt(l,10)>=15;a.push({message:p?`npm ${o} supports \`npm stage publish\`.`:`npm ${o} is too old for staged publishing. Upgrade to npm ≥ 11.15.0.`,name:"publish-stage.npm-version",severity:p?"info":"error",status:p?"pass":"fail"})}catch{a.push({message:"publish.stage is enabled but npm is not on PATH.",name:"publish-stage.npm-version",severity:"error",status:"fail"})}const e=n.config.publish?.registry??"https://registry.npmjs.org/",i=/(?:^|:\/\/)registry\.npmjs\.(?:org|com)\//.test(e);a.push({message:i?"Registry is npmjs.com; staging is supported.":`publish.stage is enabled but registry "${e}" is not npmjs.com. Staging is npm Inc-specific; the request will be rejected.`,name:"publish-stage.registry",severity:i?"info":"warn",status:i?"pass":"fail"});const t=n.packages.filter(r=>r.manifest.publishConfig?.access==="restricted"),s=!!process.env.ACTIONS_ID_TOKEN_REQUEST_URL&&!process.env.NPM_TOKEN;t.length>0&&s&&a.push({message:`${t.length} package(s) have publishConfig.access: "restricted" and OIDC trusted publishing is active. Staging this combo is not supported in v1 (no static token for the post-decision read). Set NPM_TOKEN, or disable publish.stage for these packages.`,name:"publish-stage.oidc-restricted",severity:"error",status:"fail"})}try{const{DEFAULT_CHANGES_DIR:e}=await import("./DEFAULT_CLEAN_KEEP.js"),{readStagedRegistry:i}=await import("./staged-registry.js"),t=await i(c,n.config.changesDir??e);if(t.pending.length>0){const s=t.pending.map(r=>`${r.name}@${r.version} (${r.reason})`).join(", ");a.push({message:`${t.pending.length} pending stage(s) recorded in .vis/release/staged.json: ${s}. Approve / reject before the next release: vis release stage approve --all`,name:"publish-stage.pending",severity:"warn",status:"fail"})}}catch{}try{const{DEFAULT_CHANGES_DIR:e}=await import("./DEFAULT_CLEAN_KEEP.js"),{readFile:i}=await import("node:fs/promises"),{join:t}=await import("node:path"),s=t(c,n.config.changesDir??e,".state.json"),r=await i(s,"utf8"),o=JSON.parse(r);Array.isArray(o.stagedIds)&&o.stagedIds.length>0&&a.push({message:`Found ${o.stagedIds.length} legacy stage id(s) in .state.json#stagedIds: ${o.stagedIds.join(", ")}. The new registry lives in .vis/release/staged.json. Approve / reject these via npmjs.com or \`vis release stage approve <id>\` to avoid losing them.`,name:"publish-stage.legacy-stagedIds",severity:"warn",status:"fail"})}catch{}{const e=n.packages.filter(i=>n.perPackageConfig.get(i.name)?.versionActions==="shell");for(const i of e){const t=n.perPackageConfig.get(i.name)??{},s=n.config.allowCustomCommands,r=s===!0||Array.isArray(s)&&s.includes(i.name),o=t.publishCommand!==void 0&&t.publishCommand!=="";r||a.push({message:`${i.name} uses versionActions: "shell" but release.allowCustomCommands does not permit it. Set allowCustomCommands: true or include "${i.name}" in the array.`,name:`shell-actions.${i.name}.trust-gate`,severity:"error",status:"fail"}),o?r&&a.push({message:`${i.name} → shell publish (${Array.isArray(t.publishCommand)?`${t.publishCommand.length} commands`:"1 command"}).`,name:`shell-actions.${i.name}`,severity:"info",status:"pass"}):a.push({message:`${i.name} uses versionActions: "shell" but no publishCommand is configured. Set release.packages["${i.name}"].publishCommand.`,name:`shell-actions.${i.name}.publish-command`,severity:"error",status:"fail"})}}if(!n.config.gitUser)try{const{createShellRunner:e}=await import("./shell-runner.js"),i=e(),t=await i.run("git",["config","user.name"],{cwd:c,silent:!0}),s=await i.run("git",["config","user.email"],{cwd:c,silent:!0}),r=t.exitCode===0&&t.stdout.trim().length>0,o=s.exitCode===0&&s.stdout.trim().length>0;!r||!o?a.push({message:`git config user.name/user.email is not set (name=${r?"ok":"missing"}, email=${o?"ok":"missing"}). vis auto-commits staged.json and version bumps — these will fail without an identity. Set release.gitUser in vis.config.ts or configure git globally.`,name:"git.identity",severity:"warn",status:"fail"}):a.push({message:`git identity: ${t.stdout.trim()} <${s.stdout.trim()}>.`,name:"git.identity",severity:"info",status:"pass"})}catch{}if(n.config.signing){const{signing:e}=n.config;try{const{createShellRunner:i}=await import("./shell-runner.js"),t=i(),s=await t.run("git",["config","user.signingkey"],{cwd:c,silent:!0}),r=await t.run("git",["config","gpg.format"],{cwd:c,silent:!0}),o=s.exitCode===0?s.stdout.trim():"",g=r.exitCode===0?r.stdout.trim():"",l=o.length>0||!!e.key;if(e.mode==="ssh")g!=="ssh"||!l?a.push({message:`release.signing.mode is "ssh" but git config is incomplete (gpg.format=${g||"<unset>"}, user.signingkey=${l?"ok":"missing"}). Run \`git config gpg.format ssh\` and \`git config user.signingkey <path-to-key>\` before releasing.`,name:"git.signing",severity:"warn",status:"fail"}):a.push({message:"git signing: ssh mode active (gpg.format=ssh, signingkey configured).",name:"git.signing",severity:"info",status:"pass"});else if(e.mode==="sigstore"){const{gitsignAvailable:p}=await import("./git.js");await p({cwd:c,runner:t})?a.push({message:"git signing: sigstore mode (preview); gitsign is on PATH.",name:"git.signing",severity:"info",status:"pass"}):a.push({message:'release.signing.mode is "sigstore" (preview) but gitsign is not on PATH. Tags will fall back to GPG signing with a warning. Install gitsign: https://github.com/sigstore/gitsign',name:"git.signing",severity:"warn",status:"fail"})}else if(l){const p=e.key?/[\\/]/.test(e.key)||/\.(?:pem|gpg|key|asc|p12|pfx)$/i.test(e.key)||e.key.length<8?"configured":`…${e.key.slice(-4)}`:"from git config";a.push({message:`git signing: gpg mode active (key: ${p}).`,name:"git.signing",severity:"info",status:"pass"})}else a.push({message:'release.signing.mode is "gpg" but neither release.signing.key nor git config user.signingkey is set. Configure one before releasing.',name:"git.signing",severity:"warn",status:"fail"})}catch(i){a.push({message:`Could not verify git signing config: ${i.message}.`,name:"git.signing",severity:"warn",status:"skip"})}}if(n.config.floatingMajorTag===!0&&n.config.signing?.mode==="sigstore"&&a.push({message:`release.floatingMajorTag and release.signing.mode="sigstore" are both enabled. The floating-tag retarget force-pushes <unscoped-name>-v<major> (e.g. acme-action-v1) on every release, which appends a new sigstore transparency-log entry to Rekor each time (Rekor is append-only — entries are never removed). Over a long-lived major you'll accumulate one log entry per release. Consider either dropping floatingMajorTag (and pin consumers to a specific tag) or switching to gpg/ssh signing if the Rekor footprint matters for your project.`,name:"floating-major-tag.signing-risk",severity:"warn",status:"fail"}),n.config.floatingMajorTag===!0)try{const{createShellRunner:e}=await import("./shell-runner.js"),i=await e().run("git",["tag","--list","v*"],{cwd:c,silent:!0});if(i.exitCode===0){const t=i.stdout.split(`
3
+ `).map(s=>s.trim()).filter(s=>/^v\d+$/.test(s));if(t.length===0)a.push({message:"No legacy `v<major>` tags found; floating-tag migration is clean.",name:"floating-major-tag.legacy-tags",severity:"info",status:"pass"});else{const s=t.slice(0,5),r=t.length>5?` (+${t.length-5} more)`:"",o=t[0],g=o.slice(1);a.push({message:`Legacy floating-major tags detected (${s.join(", ")}${r}). After upgrading the floating-tag format to \`<safe-name>-v<major>\`, these legacy tags are no longer updated. Consumers pinning \`<repo>@${o}\` will silently freeze at the pre-upgrade commit. Migration:
4
+ 1. Re-tag the legacy tag to point at the new floating tag:
5
+ git tag -f ${o} <safe-name>-v${g}
6
+ git push --force origin ${o}
7
+ 2. Or sunset the legacy tag and announce the new pin to consumers.`,name:"floating-major-tag.legacy-tags",severity:"warn",status:"fail"})}}else a.push({message:`Skipped: \`git tag --list "v*"\` exited ${i.exitCode}.`,name:"floating-major-tag.legacy-tags",severity:"info",status:"skip"})}catch(e){a.push({message:`Skipped: could not list git tags: ${e.message}.`,name:"floating-major-tag.legacy-tags",severity:"info",status:"skip"})}if(m.firstRelease===!0){const e=[];try{const{createShellRunner:i}=await import("./shell-runner.js"),t=i(),s=new Set,r=n.config.releaseTagPattern??"{name}@{version}";s.add(r);for(const o of n.packages){const g=n.perPackageConfig.get(o.name)?.releaseTagPattern??r;s.add(g)}for(const o of s){const g=o.replaceAll(/\{(?:name|unscopedName|version|major|minor|patch|date|channel)\}/g,()=>"*"),l=await t.run("git",["tag","--list",g],{cwd:c,silent:!0});if(l.exitCode!==0)continue;const p=l.stdout.split(`
8
+ `).map(v=>v.trim()).filter(Boolean);p.length>0&&e.push(`Found ${p.length} git tag(s) matching "${o}": ${p.slice(0,5).join(", ")}${p.length>5?` (+${p.length-5} more)`:""}.`)}}catch(i){e.push(`Could not scan git tags: ${i.message}.`)}try{const{resolveVersionActionsId:i}=await import("./orchestrator.js").then(s=>s.w),{createVersionActions:t}=await import("../packem_shared/createVersionActions-BK43SNDH.js");for(const s of n.packages){const r=n.perPackageConfig.get(s.name),o=i(s,r??{});let g;try{g=t(o)}catch{continue}let l;try{l=await g.readPublishedVersion.call(g,{perPackageConfig:r,pkg:s,pm:n.pm})}catch{continue}l&&l.length>0&&e.push(`${s.name} is already published at version ${l}.`)}}catch(i){e.push(`Could not probe published versions: ${i.message}.`)}e.length>0?a.push({message:`--first-release is set but the workspace is NOT greenfield: ${e.join(" ")} Remove --first-release and run a normal release, or roll back the existing tags / unpublish before bootstrapping.`,name:"first-release.repo-not-greenfield",severity:"error",status:"fail"}):a.push({message:"Workspace looks greenfield (no matching release tags, no published versions detected). Safe to use --first-release.",name:"first-release.repo-not-greenfield",severity:"info",status:"pass"})}if(n.config.gitlabHost){const{detectRemoteProvider:e}=await import("./detect2.js"),{createShellRunner:i}=await import("./shell-runner.js"),t=await e(c,i(),n.config.provider);t==="gitlab"?a.push({message:`Self-hosted GitLab host configured: ${n.config.gitlabHost}.`,name:"gitlab-host",severity:"info",status:"pass"}):a.push({message:`release.gitlabHost is set ("${n.config.gitlabHost}") but the resolved provider is "${t}". The host will be ignored. Either set release.provider: "gitlab" or remove gitlabHost.`,name:"gitlab-host",severity:"warn",status:"fail"})}if(n.config.githubHost){const{detectRemoteProvider:e}=await import("./detect2.js"),{createShellRunner:i}=await import("./shell-runner.js"),t=await e(c,i(),n.config.provider);t==="github"?await import("node:child_process").then(({execSync:s})=>{try{return s("gh --version",{stdio:"ignore"}),!0}catch{return!1}})?a.push({message:`Self-hosted GitHub Enterprise host configured: ${n.config.githubHost}.`,name:"github-host",severity:"info",status:"pass"}):a.push({message:`release.githubHost is set ("${n.config.githubHost}") but the gh CLI is not on PATH. Install gh and run \`gh auth login --hostname ${n.config.githubHost}\` before releasing.`,name:"github-host",severity:"error",status:"fail"}):a.push({message:`release.githubHost is set ("${n.config.githubHost}") but the resolved provider is "${t}". The host will be ignored. Either set release.provider: "github" or remove githubHost.`,name:"github-host",severity:"warn",status:"fail"})}{const e=await import("node:fs/promises"),i=await import("node:path");let t;for(const s of n.packages){const r=n.perPackageConfig.get(s.name);if(r){if(r.uvLockPath){const o=i.isAbsolute(r.uvLockPath)?r.uvLockPath:i.join(s.dir,r.uvLockPath);try{await e.access(o),a.push({message:`uv.lock present at ${o}.`,name:`uv-lockfile/${s.name}`,severity:"info",status:"pass"})}catch{a.push({message:`${s.name}: configured uvLockPath "${r.uvLockPath}" doesn't exist (expected ${o}). Run \`uv lock\` to generate it, or remove uvLockPath if the lockfile lives elsewhere.`,name:`uv-lockfile/${s.name}`,severity:"warn",status:"fail"})}}if(r.uvWorkspace?.root){const o=i.resolve(s.dir,r.uvWorkspace.root),g=i.relative(o,s.dir).replaceAll("\\","/");switch(t||({checkUvWorkspaceMembership:t}=await import("./registry.js").then(l=>l.g)),await t(o,g)){case"member":{a.push({message:`${s.name} is a member of the uv workspace rooted at ${o}.`,name:`uv-workspace/${s.name}`,severity:"info",status:"pass"});break}case"no-root-pyproject":{a.push({message:`${s.name}: uvWorkspace.root points at ${o} but no pyproject.toml was found there. Verify the path is correct.`,name:`uv-workspace/${s.name}`,severity:"warn",status:"fail"});break}case"no-workspace":{a.push({message:`${s.name}: uvWorkspace.root points at ${o} but that pyproject.toml has no [tool.uv.workspace] block. Add one with a "members" list, or drop the uvWorkspace setting.`,name:`uv-workspace/${s.name}`,severity:"warn",status:"fail"});break}default:a.push({message:`${s.name}: uv workspace root at ${o} has [tool.uv.workspace] but its "members" list doesn't include "${g}". Add the package to members or correct uvWorkspace.root.`,name:`uv-workspace/${s.name}`,severity:"warn",status:"fail"})}}}}}const{execFileSync:w}=await import("node:child_process"),k=(e,i)=>{const t=e.split(".").map(r=>Number.parseInt(r,10)),s=i.split(".").map(r=>Number.parseInt(r,10));for(const[r,o]of s.entries()){const g=t[r]??0;if(g!==(o??0))return g>(o??0)}return!0};{const e=process.versions.node,[i=0,t=0]=e.split(".").map(r=>Number.parseInt(r,10)),s=i===22&&t>=14||i>=24||i===23;a.push({message:`node@${e} (min: 22.14.0 || >=24.10.0)`,name:"node-version",severity:s?"info":"error",status:s?"pass":"fail"})}for(const[e,i,t]of[["git","2.31","git-version"],["gh","2.40","gh-version"]])try{const s=w(e,["--version"],{stdio:["ignore","pipe","ignore"]}).toString(),r=/(\d+\.\d+\.\d+)/.exec(s);if(!r)continue;const o=k(r[1],i);a.push({message:`${e}@${r[1]} (min: ${i})`,name:t,severity:o?"info":e==="git"?"error":"warn",status:o?"pass":"fail"})}catch{}{const e=new Set([n.config.publish?.registry??"https://registry.npmjs.org"]);for(const i of n.packages){const t=n.perPackageConfig.get(i.name)?.registry;t&&e.add(t)}for(const i of e)try{const t=i.replace(/\/+$/,""),s=await fetch(`${t}/-/ping`,{method:"HEAD",signal:AbortSignal.timeout(3e3)});a.push({message:`${i} reachable (HTTP ${s.status}).`,name:"registry-reachable",severity:s.ok||s.status===404?"info":"warn",status:"pass"})}catch(t){a.push({message:`${i} not reachable: ${t.message}. Publishing may fail (or you're offline — this is a warning).`,name:"registry-reachable",severity:"warn",status:"fail"})}}try{const e=w("git",["tag","--list"],{cwd:c,stdio:["ignore","pipe","ignore"]}).toString().split(/\r?\n/).map(s=>s.trim()).filter(Boolean),i=/(?:^|@)\d+\.\d+\.\d+(?:[-+].+)?$/,t=e.filter(s=>!i.test(s)&&!/^v?\d+\.\d+\.\d+/.test(s));a.push({message:e.length===0?"No git tags yet (fresh repo).":`${e.length-t.length}/${e.length} tags parse as a release tag${t.length>0?` (unrecognised: ${t.slice(0,3).join(", ")}${t.length>3?"…":""})`:""}.`,name:"tags-parseable",severity:"warn",status:t.length>0?"fail":"pass"})}catch{}{const{readFile:e}=await import("node:fs/promises"),i=await import("node:path");let t=0,s=0;for(const r of n.packages)try{const o=await e(i.join(r.dir,"CHANGELOG.md"),"utf8");s+=1,/^#{1,2}\s/m.test(o)&&(t+=1)}catch{}s>0&&a.push({message:`${t}/${s} existing CHANGELOG.md file(s) have a recognised heading structure.`,name:"changelog-format",severity:"info",status:t===s?"pass":"fail"})}try{const e=await n.pm.readCatalogYaml(c);if(e){const{parseCatalogs:i}=await import("./registry.js").then(r=>r.f),t=i(e),s=[];for(const r of n.packages)for(const o of["dependencies","devDependencies","peerDependencies","optionalDependencies"]){const g=r.manifest[o];if(!(!g||typeof g!="object"))for(const[l,p]of Object.entries(g)){if(typeof p!="string"||!p.startsWith("catalog:"))continue;const v=p.slice(8)||"default";(v==="default"?t.default?.[l]:t.named?.[v]?.[l])||s.push(`${r.name} → ${l} (${p})`)}}a.push({message:s.length===0?"All catalog: references resolve against pnpm-workspace.yaml.":`${s.length} catalog: reference(s) don't resolve: ${s.slice(0,3).join("; ")}${s.length>3?"…":""}`,name:"catalog-consistency",severity:"warn",status:s.length===0?"pass":"fail"})}}catch{}await $(u,m,a);const C=a.some(e=>e.severity==="error"&&e.status==="fail");process.exitCode=C?1:0},$=async(u,m,h)=>{if(m.json){process.stdout.write(`${JSON.stringify({checks:h},null,2)}
9
+ `);return}for(const c of h){const a=`${c.status==="pass"?"✓":c.status==="fail"?"✗":"—"} [${c.severity}] ${c.name}: ${c.message}`;c.severity==="error"&&c.status==="fail"?u.error(a):c.severity==="warn"&&c.status==="fail"?u.warn(a):u.info(a)}};export{A as default};
@@ -1,4 +1,4 @@
1
- import{createRequire as b}from"node:module";import{h as _,d as O,e as j}from"./bin.js";import{w as R}from"../packem_shared/pm-runner-OGResYrA.js";import{l as E}from"../packem_shared/dependency-scan-DnTgYleU.js";import{r as I}from"../packem_shared/provenance-_CJjMKwu.js";import{r as P}from"../packem_shared/signatures-C730vkyK.js";import{loadOptionalSigstore as C}from"./loader.js";const N=b(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=r=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[o,t]=u.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return u.getBuiltinModule(r)}return N(r)},{createHash:S}=$("node:crypto"),{isAbsolute:y,resolve:k,basename:v}=$("node:path"),T=r=>(r??"").split(",").map(o=>o.trim()).filter(o=>o.length>0),K=async({logger:r,options:o,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=o.format??"table",c=o.prodOnly??!1,p=o.failOn==="error"?"error":"warning",l=T(o.allowlist),a=R(t),d=E(t,a.name,{includeDev:!c}).map(({name:e,version:n})=>({name:e,version:n})),[m,g]=await Promise.all([I(d,{allowlist:l,workspaceRoot:t}),P(d,{allowlist:l,workspaceRoot:t})]),s=[...m.map(e=>({code:"provenance-regression",message:`Resolved ${e.packageName}@${e.version} has no published provenance attestation, but ${e.packageName}@${e.priorVersionWithProvenance} did — a provenance regression.`,packageName:e.packageName,severity:"warning",version:e.version})),...g.map(e=>({code:e.code,message:e.message,packageName:e.packageName,severity:e.severity,version:e.version}))],f=s.filter(e=>p==="error"?e.severity==="error":!0);if(i==="json")process.stdout.write(`${JSON.stringify({findings:s,ok:f.length===0},void 0,2)}
1
+ import{createRequire as b}from"node:module";import{h as _,d as O,e as j}from"./bin.js";import{w as R}from"../packem_shared/pm-runner-BKZQo7Ts.js";import{l as E}from"../packem_shared/dependency-scan-DnTgYleU.js";import{r as I}from"../packem_shared/provenance-BFEwKgI3.js";import{r as P}from"../packem_shared/signatures-Xpd6HjG_.js";import{loadOptionalSigstore as C}from"./loader.js";const N=b(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=r=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[o,t]=u.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return u.getBuiltinModule(r)}return N(r)},{createHash:S}=$("node:crypto"),{isAbsolute:y,resolve:k,basename:v}=$("node:path"),T=r=>(r??"").split(",").map(o=>o.trim()).filter(o=>o.length>0),K=async({logger:r,options:o,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=o.format??"table",c=o.prodOnly??!1,p=o.failOn==="error"?"error":"warning",l=T(o.allowlist),a=R(t),d=E(t,a.name,{includeDev:!c}).map(({name:e,version:n})=>({name:e,version:n})),[m,g]=await Promise.all([I(d,{allowlist:l,workspaceRoot:t}),P(d,{allowlist:l,workspaceRoot:t})]),s=[...m.map(e=>({code:"provenance-regression",message:`Resolved ${e.packageName}@${e.version} has no published provenance attestation, but ${e.packageName}@${e.priorVersionWithProvenance} did — a provenance regression.`,packageName:e.packageName,severity:"warning",version:e.version})),...g.map(e=>({code:e.code,message:e.message,packageName:e.packageName,severity:e.severity,version:e.version}))],f=s.filter(e=>p==="error"?e.severity==="error":!0);if(i==="json")process.stdout.write(`${JSON.stringify({findings:s,ok:f.length===0},void 0,2)}
2
2
  `);else if(i==="ndjson")for(const e of s)process.stdout.write(`${JSON.stringify(e)}
3
3
  `);else if(s.length===0)r.info(`No provenance regressions or signature problems across ${String(d.length)} locked packages.`);else{const e=process.stdout.columns||80;r.info(_(O.createElement(j,{data:s.map(n=>({code:n.code,package:`${n.packageName}@${n.version}`,severity:n.severity}))}),{columns:e}));for(const n of s)r.warn(`${n.packageName}@${n.version}: ${n.message}`)}f.length>0&&(process.exitCode=1)},D=()=>process.env.CI==="true"||typeof process.env.ACTIONS_ID_TOKEN_REQUEST_URL=="string"||typeof process.env.SIGSTORE_ID_TOKEN=="string",q=(r,o,t)=>({_type:"https://in-toto.io/Statement/v1",predicate:{buildDefinition:{buildType:"https://visulima.com/vis/attest/v1",externalParameters:{workspaceRoot:t},internalParameters:{},resolvedDependencies:[]},runDetails:{builder:{id:"https://visulima.com/vis"},metadata:{invocationId:process.env.GITHUB_RUN_ID??"",startedOn:new Date().toISOString()}}},predicateType:"https://slsa.dev/provenance/v1",subject:[{digest:{sha256:o},name:r}]}),G=async({argument:r,fs:o,logger:t,options:i,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const p=r[0];if(!p)throw new Error("Missing subject. Usage: vis attest <path-to-artifact>");const l=i.predicate??"slsaProvenance";if(l!=="slsaProvenance")throw new Error(`Unsupported predicate '${l}'. Only 'slsaProvenance' is supported.`);const a=y(p)?p:k(c,p),d=i.requireSigning??!1,m=i.format??"table";let g;try{g=await o.readFile(a)}catch{throw new Error(`Cannot read subject artifact at ${a}.`)}const s=S("sha256").update(g).digest("hex");if(!D()){const h="No ambient OIDC token (not running in CI). Keyless signing needs a Fulcio identity from CI OIDC.";if(d)throw new Error(`${h} Re-run in CI or drop --require-signing.`);if(m==="json"){process.stdout.write(`${JSON.stringify({ok:!1,reason:"no-ambient-oidc",sha256:s,skipped:!0,subject:v(a)},void 0,2)}
4
4
  `);return}t.warn(`${h} Skipping signing (subject sha256: ${s}). Pass --require-signing to make this fatal.`);return}const f=q(v(a),s,c),e=Buffer.from(JSON.stringify(f)),n=await(await C({workspaceRoot:c})).attest(e,"application/vnd.in-toto+json"),w=i.output?y(i.output)?i.output:k(c,i.output):`${a}.sigstore`;if(await o.writeFile(w,`${JSON.stringify(n,void 0,2)}
@@ -1,5 +1,75 @@
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
+ 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-BfaR0jKT.js"),y=await m(e);y.release&&(h=y.release)}catch{}const b=r(h,{packageManager:p,provider:o});t.info(""),t.info(`Generating ${b.length} workflow file(s) for ${o}:`);for(const m of b){const y=l(e,m.path);if(await k(y)){t.warn(` ${m.path} — already exists, skipping`);continue}if(n){t.info(` ${m.path} — [dry-run] would write ${m.content.length} bytes`);continue}const x=await import("node:path");await J(x.dirname(y),{recursive:!0}),await w(y,m.content),t.info(` ${m.path} — wrote ${m.content.length} bytes`)}},V=e=>{e.info(""),e.info("Suggested vis.config.ts release block:"),e.info(""),e.info(` release: {
64
+ baseBranch: "main",
65
+ defaultManaged: true,
66
+ channels: {
67
+ main: { tag: "latest", mode: "version-pr" },
68
+ },
69
+ publish: {
70
+ packManager: "auto",
71
+ publishStrategy: "npm-publish-tarball",
72
+ publishArgs: ["--provenance"],
73
+ cleanPackageJson: true,
74
+ },
75
+ },`)};export{z as default};
@@ -1,4 +1,5 @@
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{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,3 +1,4 @@
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{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,2 +1,3 @@
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 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"./handler44.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{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{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 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{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 +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{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,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 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 +1,3 @@
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{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,7 +1 @@
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{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};