@visulima/vis 4.0.2 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/README.md +2 -2
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/catalog.js +1 -1
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +155 -155
- package/dist/packem_chunks/git.js +4 -3
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler39.js +6 -6
- package/dist/packem_chunks/handler40.js +1 -75
- package/dist/packem_chunks/handler56.js +6 -6
- package/dist/packem_chunks/handler59.js +73 -9
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler60.js +11 -3
- package/dist/packem_chunks/handler61.js +3 -22
- package/dist/packem_chunks/handler62.js +21 -60
- package/dist/packem_chunks/handler63.js +61 -3
- package/dist/packem_chunks/handler64.js +3 -6
- package/dist/packem_chunks/handler65.js +6 -9
- package/dist/packem_chunks/handler72.js +1 -1
- package/dist/packem_chunks/handler78.js +1 -1
- package/dist/packem_chunks/help-command.js +2 -2
- package/dist/packem_chunks/resolveFormatter.js +7 -5
- package/dist/packem_chunks/root-handler.js +1 -0
- package/dist/packem_chunks/version-resolver.js +3 -2
- package/dist/packem_shared/DEFAULT_BREAKING_SECTION-DUAcKVLD.js +1 -0
- package/dist/packem_shared/DEFAULT_CONVENTIONAL_HEADING-D7oNGUcP.js +1 -0
- package/dist/packem_shared/{affected-selection-BdFnUyQZ.js → affected-selection-D3rosWKF.js} +1 -1
- package/dist/packem_shared/{api.d-BPftyU9r.d.ts → api.d-C10vHKJZ.d.ts} +1 -1
- package/dist/packem_shared/{bin-BieNPL6n.js → bin-Bc5j8Cdm.js} +1 -1
- package/dist/packem_shared/buildCompareUrl-BLaukjgu.js +1 -0
- package/dist/packem_shared/conventional-CGiOOEq1.js +4 -0
- package/dist/packem_shared/hasBulletMarker-BX2KwzI5.js +1 -0
- package/dist/packem_shared/{index-BPeT7L7t.js → index-B0ahNAKR.js} +1 -1
- package/dist/packem_shared/{package-version-DqNoc-rP.js → package-version-BhrkMRQ2.js} +1 -1
- package/dist/packem_shared/{project-name-filter-B0y95mKx.js → project-name-filter-jDQpaOkI.js} +1 -1
- package/dist/packem_shared/release-heading-DRpkhETz.js +1 -0
- package/dist/packem_shared/run-D-uVGHQ4.js +10 -0
- package/dist/packem_shared/{vis-user-error-4RgO8nMw.js → vis-user-error-CEc_asoq.js} +1 -1
- package/dist/release/core/changelog/index.d.ts +274 -31
- package/dist/release/core/changelog/index.js +1 -1
- package/dist/release/plugin-sdk.d.ts +2 -2
- package/dist/release/types.d.ts +44 -2
- package/index.js +52 -52
- package/package.json +11 -11
- package/schemas/vis-config.schema.json +19 -1
- package/schemas/vis-release-config.schema.json +19 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import{VisReleaseError as
|
|
2
|
-
`)}const
|
|
3
|
-
`)}const
|
|
1
|
+
import{createRequire as _}from"node:module";import{VisReleaseError as o}from"../packem_shared/VisReleaseError-DZtgcKf8.js";let T;const I=t=>(T??=_(import.meta.url))(t),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=t=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[e,r]=m.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return m.getBuiltinModule(t)}return I(t)},{realpathSync:E}=A("node:fs"),{relative:h,isAbsolute:v,resolve:C,join:y,dirname:R,basename:$}=A("node:path"),c=async(t,e,r=!0)=>t.runner.run("git",e,{cwd:t.cwd,silent:r}),O=async t=>{const e=await c(t,["rev-parse","--abbrev-ref","HEAD"]);if(e.exitCode!==0)return;const r=e.stdout.trim();return r==="HEAD"||r===""?void 0:r},G=async t=>{const e=await c(t,["rev-parse","HEAD"]);return e.exitCode===0?e.stdout.trim():void 0},H=async t=>{const e=await c(t,["rev-parse","--short","HEAD"]);return e.exitCode===0?e.stdout.trim():void 0},S=async t=>{const e=await c(t,["status","--porcelain","--untracked-files=all"]);if(e.exitCode!==0)return[];const r=s=>{if(!s.startsWith(String.raw`"`)||!s.endsWith(String.raw`"`)||s.length<2)return s;const i=s.slice(1,-1);try{return JSON.parse(`"${i}"`)}catch{return i}};return e.stdout.split(`
|
|
2
|
+
`).map(s=>s.replace(/\r$/,"")).filter(s=>s.trim()!=="").map(s=>{const i=s.length>3?s.slice(3):s.trim(),a=i.lastIndexOf(" -> "),n=a===-1?i:i.slice(a+4);return r(n.trim())}).filter(Boolean)},b=async(t,e)=>(await c(t,["rev-parse","--verify","--quiet",`refs/tags/${e}`])).exitCode===0,D=async(t,e,r="origin")=>{const s=await c(t,["ls-remote","--tags",r,e]);return s.exitCode===0&&s.stdout.trim()!==""},U=async(t,e)=>{const r=await c(t,["rev-parse","--show-toplevel"]),s=r.exitCode===0&&r.stdout.trim()?r.stdout.trim():t.cwd,i=h(s,e);return i.startsWith("..")?h(w(s),w(e)).replaceAll("\\","/"):i.replaceAll("\\","/")},w=t=>{const e=v(t)?t:C(t),r=[];let s=e;for(;;)try{const i=E.native(s);return r.length===0?i:y(i,...r.toReversed())}catch{const i=R(s);if(i===s)return e;r.push($(s)),s=i}},j=async(t,e,r,s={})=>{if(e.length===0&&!s.allowEmpty)throw new o({code:"CONFIG_INVALID",message:"stageAndCommit called with no files (and allowEmpty=false)."});if(e.length>0){const u=await t.runner.run("git",["add","--",...e],{cwd:t.cwd,silent:!0});if(u.exitCode!==0)throw new o({code:"GIT_OPERATION_FAILED",message:`git add failed: ${u.stderr||u.stdout}`})}const i={...process.env};s.author&&(i.GIT_AUTHOR_NAME=s.author.name,i.GIT_AUTHOR_EMAIL=s.author.email,i.GIT_COMMITTER_NAME=s.author.name,i.GIT_COMMITTER_EMAIL=s.author.email);const a=["commit","-m",r];s.allowEmpty&&a.push("--allow-empty");const n=await t.runner.run("git",a,{cwd:t.cwd,env:i,silent:!0});if(n.exitCode!==0)throw new o({code:"GIT_OPERATION_FAILED",message:`git commit failed: ${n.stderr||n.stdout}`});const d=await G(t);if(!d)throw new o({code:"GIT_OPERATION_FAILED",message:"git commit succeeded but HEAD is not resolvable."});return d},L=6e4;let g;const p=async t=>{const e=Date.now();if(g!==void 0&&e-g.cachedAtMs<L)return g.value;const r=await t.runner.run("gitsign",["--version"],{cwd:t.cwd,silent:!0});return g={cachedAtMs:e,value:r.exitCode===0},g.value},N=()=>{g=void 0},q=N,B=async(t,e,r,s={})=>{if(await b(t,e))throw new o({code:"TAG_COLLISION",message:`Tag "${e}" already exists locally. Resolve manually before re-running.`});if(!s.skipRemoteCheck&&await D(t,e,s.remote??"origin"))throw new o({code:"TAG_COLLISION",message:`Tag "${e}" already exists on remote "${s.remote??"origin"}". A previous run may have pushed tags but failed mid-publish — inspect the remote and either re-use the existing tag or delete it before re-running.`});const{signing:i}=s;if(i?.mode==="sigstore"){if(await p(t)){const d=["tag","-a",e];r&&d.push("-m",r);const u=await t.runner.run("gitsign",d,{cwd:t.cwd,silent:!0});if(u.exitCode!==0)throw new o({code:"GIT_OPERATION_FAILED",message:`gitsign tag ${e} failed: ${u.stderr||u.stdout}`});return}process.stderr.write(`[vis release] Warning: signing.mode is "sigstore" but \`gitsign\` is not on PATH; falling back to GPG signing for tag ${e}.
|
|
3
|
+
`)}const a=["tag"];i&&(i.key&&i.mode==="gpg"?a.push("-u",i.key):a.push("-s")),r?a.push("-a",e,"-m",r):a.push(e);const n=await c(t,a);if(n.exitCode!==0)throw new o({code:"GIT_OPERATION_FAILED",message:`git tag ${e} failed: ${n.stderr||n.stdout}`})},W=async(t,e={})=>{const r=["push",e.remote??"origin","--tags"];e.atomic&&r.splice(1,0,"--atomic");const s=await c(t,r,!1);if(s.exitCode!==0)throw new o({code:"TAG_PUSH_FAILED",hint:"After resolving, re-run with --resume to retry the push.",message:`git push --tags failed: ${s.stderr||s.stdout}`})},k=async(t,e,r={})=>{const{signing:s}=r;if(s?.mode==="sigstore"){if(await p(t)){const u=["tag","-f","-a","-m",`Floating tag ${e}`,e],l=await t.runner.run("gitsign",u,{cwd:t.cwd,silent:!0});if(l.exitCode!==0)throw new o({code:"GIT_OPERATION_FAILED",message:`gitsign tag -f ${e} failed: ${l.stderr||l.stdout}`});if(r.push===!1)return;const f=await c(t,["push",r.remote??"origin","--force",`refs/tags/${e}:refs/tags/${e}`],!1);if(f.exitCode!==0)throw new o({code:"TAG_PUSH_FAILED",hint:"After resolving, re-run with --resume to retry the push.",message:`git push --force refs/tags/${e} failed: ${f.stderr||f.stdout}`});return}process.stderr.write(`[vis release] Warning: signing.mode is "sigstore" but \`gitsign\` is not on PATH; falling back to GPG signing for floating tag ${e}.
|
|
4
|
+
`)}const i=["tag","-f"];s&&(s.key&&s.mode==="gpg"?i.push("-u",s.key):i.push("-s")),i.push(e);const a=await c(t,i);if(a.exitCode!==0)throw new o({code:"GIT_OPERATION_FAILED",message:`git tag -f ${e} failed: ${a.stderr||a.stdout}`});if(r.push===!1)return;const n=await c(t,["push",r.remote??"origin","--force",`refs/tags/${e}:refs/tags/${e}`],!1);if(n.exitCode!==0)throw new o({code:"TAG_PUSH_FAILED",hint:"After resolving, re-run with --resume to retry the push.",message:`git push --force refs/tags/${e} failed: ${n.stderr||n.stdout}`})},x=async(t,e,r,s={})=>{const i=await t.runner.run("git",["add","-A","--",e],{cwd:t.cwd,silent:!0});if(i.exitCode!==0)throw new o({code:"GIT_OPERATION_FAILED",message:`git add ${e} failed: ${i.stderr||i.stdout}`});if((await t.runner.run("git",["diff","--cached","--quiet","--",e],{cwd:t.cwd,silent:!0})).exitCode===0)return{committed:!1,pushed:!1};const n={...process.env};s.author&&(n.GIT_AUTHOR_NAME=s.author.name,n.GIT_AUTHOR_EMAIL=s.author.email,n.GIT_COMMITTER_NAME=s.author.name,n.GIT_COMMITTER_EMAIL=s.author.email);const d=["commit","-m",r];s.sign&&d.push("-S");const u=await t.runner.run("git",d,{cwd:t.cwd,env:n,silent:!0});if(u.exitCode!==0)throw new o({code:"GIT_OPERATION_FAILED",message:`git commit failed: ${u.stderr||u.stdout}`});if(!s.push)return{committed:!0,pushed:!1};const l=s.branch??await O(t);return l?{committed:!0,pushed:(await t.runner.run("git",["push",s.remote??"origin",`HEAD:${l}`],{cwd:t.cwd,silent:!1})).exitCode===0}:{committed:!0,pushed:!1}},V=async(t,e,r={})=>{const s=["push",r.remote??"origin",`HEAD:${e}`];r.force&&s.push("--force-with-lease");const i=await c(t,s,!1);if(i.exitCode!==0)throw new o({code:"TAG_PUSH_FAILED",message:`git push ${e} failed: ${i.stderr||i.stdout}`})},J=(t,e)=>`${t}@${e}`,M=/\{(name|unscopedName|version|major|minor|patch|date|channel)\}/g,K=(t,e)=>{const r=e.version??"",[s="",i="",a=""]=r.split(/[-+]/,1)[0].split("."),n={channel:e.channel??"",date:e.date??new Date().toISOString().slice(0,10),major:s,minor:i,name:e.name??"",patch:a,unscopedName:e.name?e.name.replace(/^@[^/]+\//,""):"",version:r};return t.replaceAll(M,(d,u)=>n[u]??"")};export{k as createOrUpdateFloatingTag,B as createTag,J as defaultTagFor,O as getCurrentBranch,G as getCurrentSha,H as getShortSha,p as gitsignAvailable,S as listUncommittedPaths,V as pushBranch,W as pushTags,K as renderTagPattern,N as resetGitsignCache,q as resetGitsignCacheForTests,j as stageAndCommit,x as stageAndCommitFile,b as tagExists,D as tagExistsRemote,U as toRepoRelativePath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createTaskGraph as $}from"@visulima/task-runner";import{d as b,b as O}from"./catalog.js";import{f as P}from"../packem_shared/project-name-filter-
|
|
1
|
+
import{createTaskGraph as $}from"@visulima/task-runner";import{d as b,b as O}from"./catalog.js";import{f as P}from"../packem_shared/project-name-filter-jDQpaOkI.js";import{r as S,f as E,a as G}from"../packem_shared/selectors-B7lSFz7l.js";const T=(l,s,t)=>{const a=[],e=new Set,n=(r,u)=>{if(e.has(r))return;e.add(r);const m=s[r]??[];for(const d of m)n(d,u+1);const o=t[r],h=" ".repeat(u);a.push(`${h}${r}${o?.cache===!1?" (no-cache)":""}`)};for(const r of l)n(r,0);return a},x=(l,s,t)=>({roots:l,tasks:Object.fromEntries(Object.entries(t).map(([a,e])=>[a,{cache:e.cache,dependsOn:s[a]??[],outputs:e.outputs,parallelism:e.parallelism,projectRoot:e.projectRoot,target:e.target}]))}),C=async({argument:l,logger:s,options:t,process:a,visConfig:e,workspaceRoot:n})=>{const r=l[0];if(!r)throw new Error("Missing selector. Usage: vis action-graph <selector>");if(!n)throw new Error("Could not determine workspace root. Run inside a monorepo.");const{config:u,packageJsons:m,workspace:o}=b(n,e),h=O(n,o,m),d=await S(r,o,a.cwd,n),{target:f}=d;let i=d.projects;t.projects!==void 0&&(i=P(i,String(t.projects),Object.keys(o.projects))),t.query&&(i=E(i,o,t.query)),i=G(i,o,t.tag);const k=i.filter(p=>o.projects[p]?.targets?.[f]!==void 0);if(k.length===0){s.info(`No projects have a "${f}" target.`);return}const y=k.map(p=>{const g=o.projects[p],j=g.targets?.[f],v={project:p,target:f};return{cache:j?.cache,id:`${p}:${f}`,outputs:j?.outputs??[],overrides:{command:j?.command},parallelism:j?.parallelism,projectRoot:g.root,target:v}}),c=$(y,{projectGraph:h,targetDefaults:u.tasks,workspace:o});if(t.json){s.info(JSON.stringify(x(c.roots,c.dependencies,c.tasks),null,2));return}const w=T(c.roots,c.dependencies,c.tasks);s.info(`Execution plan (${Object.keys(c.tasks).length} task(s), ${c.roots.length} root(s)):`),s.info("");for(const p of w)s.info(p)};export{C as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createRequire as u}from"node:module";import{g as m}from"../packem_shared/package-version-
|
|
1
|
+
import{createRequire as u}from"node:module";import{g as m}from"../packem_shared/package-version-BhrkMRQ2.js";let a;const f=t=>(a??=u(import.meta.url))(t),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=t=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[e,s]=r.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return r.getBuiltinModule(t)}return f(t)},{execSync:l,spawnSync:p}=d("node:child_process"),y=async({argument:t,logger:e,options:s})=>{const o=t?.[0];e.info("info: checking for updates...");const i=m();let n;try{const c=l("npm view @visulima/vis version",{encoding:"utf8"}).trim();n=o??c}catch{throw new Error("Failed to query npm registry. Check your network connection.")}if(i===n&&!s.force){e.info(`
|
|
2
2
|
✓ Already up to date (${i})`);return}if(s.check){i===n?e.info(`✓ Already up to date (${i})`):e.info(`info: found @visulima/vis@${n} (current: ${i})`);return}if(e.info(`info: found @visulima/vis@${n} (current: ${i})`),e.info("info: installing..."),p("npm",["install","-g",`@visulima/vis@${n}`],{encoding:"utf8",stdio:"inherit"}).status!==0)throw new Error("Failed to update. Try running with sudo or fix npm permissions.");e.info(`
|
|
3
3
|
✓ Updated @visulima/vis from ${i} → ${n}`)};export{y as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{d as h,b as j}from"./catalog.js";import{V as n}from"../packem_shared/vis-user-error-
|
|
1
|
+
import{d as h,b as j}from"./catalog.js";import{V as n}from"../packem_shared/vis-user-error-CEc_asoq.js";import{s as k}from"../packem_shared/affected-selection-D3rosWKF.js";import{f as P,a as y}from"../packem_shared/selectors-B7lSFz7l.js";const b=(r,e)=>{if(r.length>0)return[...r];const s=e.indexOf("affected",2);return s===-1?[]:e.slice(s+1)},G=async({argument:r,options:e,process:s,rawArgv:u,runtime:g,visConfig:d,workspaceRoot:f})=>{if(!r[0])throw new n("Missing target. Usage: vis affected <target>");if(!f)throw new n("Could not determine workspace root. Run this command inside a monorepo.");if(e.sparseCheckout){const o=f,{packageJsons:p,workspace:t}=h(o,d),l=j(o,t,p),w=await k({base:e.base,downstream:e.downstream,head:e.head,uncommitted:e.uncommitted,upstream:e.upstream},{projectGraph:l,projects:t.projects,workspaceRoot:o},{defaultBase:d?.defaultBase});let c=P(w.affectedProjects,t,e.query);c=y(c,t,e.tag);const i=[...new Set(c.map(m=>t.projects[m]?.root??m))].sort();process.stdout.write(i.length>0?`${i.join(`
|
|
2
2
|
`)}
|
|
3
3
|
`:"");return}const a=b(u??[],s?.argv??[]);if(a.length===0)throw new n("Missing target. Usage: vis affected <target>");await g.runCommand("run",{argv:a.includes("--affected")?a:[...a,"--affected"]})};export{G as default,b as forwardedArgv};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{b as
|
|
2
|
-
${t.stderr}`,i=/Token scopes:\s*(.+)/.exec(e);if(t.exitCode!==0||!i)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=i[1].split(",").map(l=>l.trim().replaceAll(/^['"]|['"]$/g,"")).filter(Boolean),g=new Set(["admin:org","admin:repo_hook","delete_repo","repo","site_admin"]),c=r.filter(l=>g.has(l));c.length>0?a.push({message:`Token carries broader scopes than vis needs: ${c.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 s of o.packages){if(s.manifest.napi===void 0)continue;const n=b.join(s.dir,"npm");try{const e=(await y.readdir(n,{withFileTypes:!0})).filter(c=>c.isDirectory());if(e.length===0){a.push({message:`${s.name} has a napi field but no npm/<platform>/ subdirs. Run pnpm exec napi artifacts before publishing.`,name:`napi-${s.name}-platforms`,severity:"warn",status:"fail"});continue}const i=[];for(const c of e){const l=b.join(n,c.name,"package.json");try{const u=JSON.parse(await y.readFile(l,"utf8"));u.version!==s.version&&i.push(`${c.name} (${u.version} vs parent ${s.version})`)}catch{i.push(`${c.name} (unreadable manifest)`)}}i.length>0?a.push({message:`${s.name}: platform versions out of sync — ${i.join(", ")}. They'll be re-synced on next publish.`,name:`napi-${s.name}-versions`,severity:"warn",status:"fail"}):a.push({message:`${s.name}: ${e.length} platform package(s), all versions in sync.`,name:`napi-${s.name}`,severity:"info",status:"pass"});const r=s.manifest.optionalDependencies??{},g=[];for(const c of e)try{const l=JSON.parse(await y.readFile(b.join(n,c.name,"package.json"),"utf8"));Object.hasOwn(r,l.name)||g.push(l.name)}catch{}g.length>0&&a.push({message:`${s.name}: missing optionalDependencies entries for: ${g.join(", ")}. Consumers won't get the right binary.`,name:`napi-${s.name}-optdeps`,severity:"error",status:"fail"})}catch{a.push({message:`${s.name}: could not read npm/ subdir.`,name:`napi-${s.name}-platforms`,severity:"warn",status:"skip"})}}{const{resolveVersionActionsId:s}=await import("./orchestrator.js").then(t=>t.w),n=o.packages.filter(t=>s(t,o.perPackageConfig.get(t.name)??{})==="jsr");for(const t of n){const e=o.perPackageConfig.get(t.name)??{},i=["jsr","publish","--dry-run","--allow-dirty"],r=e.jsrConfigPath;r!==void 0&&r!=="jsr.json"&&i.push("--config",r);for(const g of e.jsrPublishArgs??[])i.push(g);try{const g=await o.pm.runner.run("npx",i,{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(o.plan.warnings.length>0)for(const s of o.plan.warnings)a.push({message:s,name:"plan-warning",severity:"warn",status:"fail"});else a.push({message:o.plan.releases.length===0?"No pending releases.":`Plan resolves ${o.plan.releases.length} release(s).`,name:"plan-readable",severity:"info",status:"pass"});const d=o.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 v=o.config.publish?.releaseAssets;if((v?.stampHashes||v?.uploadTarball)&&a.push({message:`Release-asset attestation: stampHashes=${v.stampHashes??!1}, uploadTarball=${v.uploadTarball??!1}.`,name:"publish-releaseAssets",severity:"info",status:"pass"}),o.config.publish?.stage){try{const{execSync:i}=await import("node:child_process"),r=i("npm --version",{stdio:["ignore","pipe","ignore"]}).toString().trim(),[g="0",c="0"]=r.split("."),l=Number.parseInt(g,10)>11||Number.parseInt(g,10)===11&&Number.parseInt(c,10)>=15;a.push({message:l?`npm ${r} supports \`npm stage publish\`.`:`npm ${r} is too old for staged publishing. Upgrade to npm ≥ 11.15.0.`,name:"publish-stage.npm-version",severity:l?"info":"error",status:l?"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 s=o.config.publish?.registry??"https://registry.npmjs.org/",n=/(?:^|:\/\/)registry\.npmjs\.(?:org|com)\//.test(s);a.push({message:n?"Registry is npmjs.com; staging is supported.":`publish.stage is enabled but registry "${s}" is not npmjs.com. Staging is npm Inc-specific; the request will be rejected.`,name:"publish-stage.registry",severity:n?"info":"warn",status:n?"pass":"fail"});const t=o.packages.filter(i=>i.manifest.publishConfig?.access==="restricted"),e=!!process.env.ACTIONS_ID_TOKEN_REQUEST_URL&&!process.env.NPM_TOKEN;t.length>0&&e&&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:s}=await import("./DEFAULT_CLEAN_KEEP.js"),{readStagedRegistry:n}=await import("./staged-registry.js"),t=await n(p,o.config.changesDir??s);if(t.pending.length>0){const e=t.pending.map(i=>`${i.name}@${i.version} (${i.reason})`).join(", ");a.push({message:`${t.pending.length} pending stage(s) recorded in .vis/release/staged.json: ${e}. 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:s}=await import("./DEFAULT_CLEAN_KEEP.js"),{readFile:n}=await import("node:fs/promises"),{join:t}=await import("node:path"),e=t(p,o.config.changesDir??s,".state.json"),i=await n(e,"utf8"),r=JSON.parse(i);Array.isArray(r.stagedIds)&&r.stagedIds.length>0&&a.push({message:`Found ${r.stagedIds.length} legacy stage id(s) in .state.json#stagedIds: ${r.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 s=o.packages.filter(n=>o.perPackageConfig.get(n.name)?.versionActions==="shell");for(const n of s){const t=o.perPackageConfig.get(n.name)??{},e=o.config.allowCustomCommands,i=e===!0||Array.isArray(e)&&e.includes(n.name),r=t.publishCommand!==void 0&&t.publishCommand!=="";i||a.push({message:`${n.name} uses versionActions: "shell" but release.allowCustomCommands does not permit it. Set allowCustomCommands: true or include "${n.name}" in the array.`,name:`shell-actions.${n.name}.trust-gate`,severity:"error",status:"fail"}),r?i&&a.push({message:`${n.name} → shell publish (${Array.isArray(t.publishCommand)?`${t.publishCommand.length} commands`:"1 command"}).`,name:`shell-actions.${n.name}`,severity:"info",status:"pass"}):a.push({message:`${n.name} uses versionActions: "shell" but no publishCommand is configured. Set release.packages["${n.name}"].publishCommand.`,name:`shell-actions.${n.name}.publish-command`,severity:"error",status:"fail"})}}if(!o.config.gitUser)try{const{createShellRunner:s}=await import("./shell-runner.js"),n=s(),t=await n.run("git",["config","user.name"],{cwd:p,silent:!0}),e=await n.run("git",["config","user.email"],{cwd:p,silent:!0}),i=t.exitCode===0&&t.stdout.trim().length>0,r=e.exitCode===0&&e.stdout.trim().length>0;!i||!r?a.push({message:`git config user.name/user.email is not set (name=${i?"ok":"missing"}, email=${r?"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()} <${e.stdout.trim()}>.`,name:"git.identity",severity:"info",status:"pass"})}catch{}if(o.config.signing){const{signing:s}=o.config;try{const{createShellRunner:n}=await import("./shell-runner.js"),t=n(),e=await t.run("git",["config","user.signingkey"],{cwd:p,silent:!0}),i=await t.run("git",["config","gpg.format"],{cwd:p,silent:!0}),r=e.exitCode===0?e.stdout.trim():"",g=i.exitCode===0?i.stdout.trim():"",c=r.length>0||!!s.key;if(s.mode==="ssh")g!=="ssh"||!c?a.push({message:`release.signing.mode is "ssh" but git config is incomplete (gpg.format=${g||"<unset>"}, user.signingkey=${c?"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(s.mode==="sigstore"){const{gitsignAvailable:l}=await import("./git.js");await l({cwd:p,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(c){const l=s.key?/[\\/]/.test(s.key)||/\.(?:pem|gpg|key|asc|p12|pfx)$/i.test(s.key)||s.key.length<8?"configured":`…${s.key.slice(-4)}`:"from git config";a.push({message:`git signing: gpg mode active (key: ${l}).`,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(n){a.push({message:`Could not verify git signing config: ${n.message}.`,name:"git.signing",severity:"warn",status:"skip"})}}if(o.config.floatingMajorTag===!0&&o.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"}),o.config.floatingMajorTag===!0)try{const{createShellRunner:s}=await import("./shell-runner.js"),t=await s().run("git",["tag","--list","v*"],{cwd:p,silent:!0});if(t.exitCode===0){const e=t.stdout.split(`
|
|
3
|
-
`).map(i=>i.trim()).filter(i=>/^v\d+$/.test(i));if(
|
|
1
|
+
import{b as P}from"./orchestrator.js";const N=async({logger:h,options:f,workspaceRoot:d})=>{const p=d??process.cwd(),t=[];let o;try{o=await P({cwd:p}),t.push({message:"vis.config.ts loaded; release block parsed.",name:"config-loads",severity:"error",status:"pass"})}catch(e){t.push({message:`Config failed to load: ${e.message}`,name:"config-loads",severity:"error",status:"fail"}),await $(h,f,t),process.exitCode=1;return}let m;try{m=await o.pm.listWorkspacePackages(p)}catch{m=void 0}if(o.packages.length>0){const e=m===void 0?o.packages.length:Math.max(m.length,o.packages.length);t.push({message:`Discovered ${e} workspace package(s).`,name:"workspace-discovered",severity:"info",status:"pass"}),t.push({message:`${o.packages.length} of ${e} package(s) are release-managed.`,name:"release-managed-packages",severity:"info",status:"pass"})}else if(m===void 0||m.length===0)t.push({message:"No packages discovered. Ensure your package manager's workspace block resolves.",name:"workspace-discovered",severity:"error",status:"fail"}),t.push({message:"Skipped — no workspace packages to opt in.",name:"release-managed-packages",severity:"info",status:"skip"});else{const e=m.length,n=m.every(a=>a.private)?" Every discovered package is private — private packages additionally need release.privatePackages.version.":"";t.push({message:`Discovered ${e} workspace package(s).`,name:"workspace-discovered",severity:"info",status:"pass"}),t.push({message:`No release-managed packages (${e} workspace package(s) discovered). Set release.defaultManaged: true in vis.config.ts, or add "vis-release": { "managed": true } to a package.json.${n}`,name:"release-managed-packages",severity:"warn",status:"fail"})}try{const e=await o.pm.detectVersion(p);e?t.push({message:`${o.pm.id}@${e} (min required: ${o.pm.minVersion})`,name:"pm-version",severity:"info",status:"pass"}):t.push({message:`Could not detect ${o.pm.id} version.`,name:"pm-version",severity:"warn",status:"skip"})}catch(e){t.push({message:`Skipped: ${e.message}`,name:"pm-version",severity:"warn",status:"skip"})}o.branch&&o.channel?t.push({message:`Branch "${o.branch}" → channel ${o.channel.tag}${o.channel.prerelease?` (preid: ${o.channel.prerelease})`:""}, mode: ${o.channel.mode}`,name:"branch-channel",severity:"info",status:"pass"}):o.branch&&!o.channel?t.push({message:`Branch "${o.branch}" does not match any configured channel. Releases will use dist-tag "latest" by default.`,name:"branch-channel",severity:"warn",status:"fail"}):t.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:n})=>{try{return n("gh --version",{stdio:"ignore"}),!0}catch{return!1}})?t.push({message:"gh CLI is on PATH.",name:"gh-cli-available",severity:"info",status:"pass"}):t.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"),a=await e().run("gh",["auth","status","--show-token"],{cwd:p,silent:!0}),s=`${a.stdout}
|
|
2
|
+
${a.stderr}`,i=/Token scopes:\s*(.+)/.exec(s);if(a.exitCode!==0||!i)t.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=i[1].split(",").map(l=>l.trim().replaceAll(/^['"]|['"]$/g,"")).filter(Boolean),g=new Set(["admin:org","admin:repo_hook","delete_repo","repo","site_admin"]),c=r.filter(l=>g.has(l));c.length>0?t.push({message:`Token carries broader scopes than vis needs: ${c.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"}):t.push({message:`Token scopes look appropriately narrow: ${r.join(", ")||"(none)"}.`,name:"github.token-scopes",severity:"info",status:"pass"})}}catch{t.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?t.push({message:"GitHub Actions OIDC env vars present.",name:"oidc-available",severity:"info",status:"pass"}):process.env.NPM_TOKEN?t.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"}):t.push({message:"Neither OIDC env vars nor NPM_TOKEN are set in CI. Publish will fail.",name:"oidc-available",severity:"error",status:"fail"}));const k=await import("node:fs/promises"),b=await import("node:path");for(const e of o.packages){if(e.manifest.napi===void 0)continue;const n=b.join(e.dir,"npm");try{const s=(await k.readdir(n,{withFileTypes:!0})).filter(c=>c.isDirectory());if(s.length===0){t.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 i=[];for(const c of s){const l=b.join(n,c.name,"package.json");try{const u=JSON.parse(await k.readFile(l,"utf8"));u.version!==e.version&&i.push(`${c.name} (${u.version} vs parent ${e.version})`)}catch{i.push(`${c.name} (unreadable manifest)`)}}i.length>0?t.push({message:`${e.name}: platform versions out of sync — ${i.join(", ")}. They'll be re-synced on next publish.`,name:`napi-${e.name}-versions`,severity:"warn",status:"fail"}):t.push({message:`${e.name}: ${s.length} platform package(s), all versions in sync.`,name:`napi-${e.name}`,severity:"info",status:"pass"});const r=e.manifest.optionalDependencies??{},g=[];for(const c of s)try{const l=JSON.parse(await k.readFile(b.join(n,c.name,"package.json"),"utf8"));Object.hasOwn(r,l.name)||g.push(l.name)}catch{}g.length>0&&t.push({message:`${e.name}: missing optionalDependencies entries for: ${g.join(", ")}. Consumers won't get the right binary.`,name:`napi-${e.name}-optdeps`,severity:"error",status:"fail"})}catch{t.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(a=>a.w),n=o.packages.filter(a=>e(a,o.perPackageConfig.get(a.name)??{})==="jsr");for(const a of n){const s=o.perPackageConfig.get(a.name)??{},i=["jsr","publish","--dry-run","--allow-dirty"],r=s.jsrConfigPath;r!==void 0&&r!=="jsr.json"&&i.push("--config",r);for(const g of s.jsrPublishArgs??[])i.push(g);try{const g=await o.pm.runner.run("npx",i,{cwd:a.dir,silent:!0});g.exitCode===0?t.push({message:`${a.name}: \`jsr publish --dry-run\` passed.`,name:`jsr-dry-run/${a.name}`,severity:"info",status:"pass"}):t.push({message:`${a.name}: \`jsr publish --dry-run\` reported issues (slow types / exports / auth?): ${(g.stderr||g.stdout).trim().slice(0,300)}`,name:`jsr-dry-run/${a.name}`,severity:"warn",status:"fail"})}catch(g){t.push({message:`${a.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/${a.name}`,severity:"warn",status:"skip"})}}}if(o.plan.warnings.length>0)for(const e of o.plan.warnings)t.push({message:e,name:"plan-warning",severity:"warn",status:"fail"});else{let e;o.plan.releases.length>0?e=`Plan resolves ${o.plan.releases.length} release(s).`:o.packages.length===0?e="No pending releases — no package is release-managed, so the plan is always empty.":e="No pending releases.",t.push({message:e,name:"plan-readable",severity:"info",status:"pass"})}const v=o.config.publish?.guards;if(v?.packSecretScan)try{await import("@visulima/secret-scanner"),t.push({message:"@visulima/secret-scanner resolves; pack-set secret scanning will run.",name:"publish-guards.packSecretScan",severity:"info",status:"pass"})}catch{t.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"})}v?.audit&&v.audit!=="off"&&t.push({message:`Runtime npm audit gate active at "${v.audit}" severity.`,name:"publish-guards.audit",severity:"info",status:"pass"});const y=o.config.publish?.releaseAssets;if((y?.stampHashes||y?.uploadTarball)&&t.push({message:`Release-asset attestation: stampHashes=${y.stampHashes??!1}, uploadTarball=${y.uploadTarball??!1}.`,name:"publish-releaseAssets",severity:"info",status:"pass"}),o.config.publish?.stage){try{const{execSync:i}=await import("node:child_process"),r=i("npm --version",{stdio:["ignore","pipe","ignore"]}).toString().trim(),[g="0",c="0"]=r.split("."),l=Number.parseInt(g,10)>11||Number.parseInt(g,10)===11&&Number.parseInt(c,10)>=15;t.push({message:l?`npm ${r} supports \`npm stage publish\`.`:`npm ${r} is too old for staged publishing. Upgrade to npm ≥ 11.15.0.`,name:"publish-stage.npm-version",severity:l?"info":"error",status:l?"pass":"fail"})}catch{t.push({message:"publish.stage is enabled but npm is not on PATH.",name:"publish-stage.npm-version",severity:"error",status:"fail"})}const e=o.config.publish?.registry??"https://registry.npmjs.org/",n=/(?:^|:\/\/)registry\.npmjs\.(?:org|com)\//.test(e);t.push({message:n?"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:n?"info":"warn",status:n?"pass":"fail"});const a=o.packages.filter(i=>i.manifest.publishConfig?.access==="restricted"),s=!!process.env.ACTIONS_ID_TOKEN_REQUEST_URL&&!process.env.NPM_TOKEN;a.length>0&&s&&t.push({message:`${a.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:n}=await import("./staged-registry.js"),a=await n(p,o.config.changesDir??e);if(a.pending.length>0){const s=a.pending.map(i=>`${i.name}@${i.version} (${i.reason})`).join(", ");t.push({message:`${a.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:n}=await import("node:fs/promises"),{join:a}=await import("node:path"),s=a(p,o.config.changesDir??e,".state.json"),i=await n(s,"utf8"),r=JSON.parse(i);Array.isArray(r.stagedIds)&&r.stagedIds.length>0&&t.push({message:`Found ${r.stagedIds.length} legacy stage id(s) in .state.json#stagedIds: ${r.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=o.packages.filter(n=>o.perPackageConfig.get(n.name)?.versionActions==="shell");for(const n of e){const a=o.perPackageConfig.get(n.name)??{},s=o.config.allowCustomCommands,i=s===!0||Array.isArray(s)&&s.includes(n.name),r=a.publishCommand!==void 0&&a.publishCommand!=="";i||t.push({message:`${n.name} uses versionActions: "shell" but release.allowCustomCommands does not permit it. Set allowCustomCommands: true or include "${n.name}" in the array.`,name:`shell-actions.${n.name}.trust-gate`,severity:"error",status:"fail"}),r?i&&t.push({message:`${n.name} → shell publish (${Array.isArray(a.publishCommand)?`${a.publishCommand.length} commands`:"1 command"}).`,name:`shell-actions.${n.name}`,severity:"info",status:"pass"}):t.push({message:`${n.name} uses versionActions: "shell" but no publishCommand is configured. Set release.packages["${n.name}"].publishCommand.`,name:`shell-actions.${n.name}.publish-command`,severity:"error",status:"fail"})}}if(!o.config.gitUser)try{const{createShellRunner:e}=await import("./shell-runner.js"),n=e(),a=await n.run("git",["config","user.name"],{cwd:p,silent:!0}),s=await n.run("git",["config","user.email"],{cwd:p,silent:!0}),i=a.exitCode===0&&a.stdout.trim().length>0,r=s.exitCode===0&&s.stdout.trim().length>0;!i||!r?t.push({message:`git config user.name/user.email is not set (name=${i?"ok":"missing"}, email=${r?"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"}):t.push({message:`git identity: ${a.stdout.trim()} <${s.stdout.trim()}>.`,name:"git.identity",severity:"info",status:"pass"})}catch{}if(o.config.signing){const{signing:e}=o.config;try{const{createShellRunner:n}=await import("./shell-runner.js"),a=n(),s=await a.run("git",["config","user.signingkey"],{cwd:p,silent:!0}),i=await a.run("git",["config","gpg.format"],{cwd:p,silent:!0}),r=s.exitCode===0?s.stdout.trim():"",g=i.exitCode===0?i.stdout.trim():"",c=r.length>0||!!e.key;if(e.mode==="ssh")g!=="ssh"||!c?t.push({message:`release.signing.mode is "ssh" but git config is incomplete (gpg.format=${g||"<unset>"}, user.signingkey=${c?"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"}):t.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:l}=await import("./git.js");await l({cwd:p,runner:a})?t.push({message:"git signing: sigstore mode (preview); gitsign is on PATH.",name:"git.signing",severity:"info",status:"pass"}):t.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(c){const l=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";t.push({message:`git signing: gpg mode active (key: ${l}).`,name:"git.signing",severity:"info",status:"pass"})}else t.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(n){t.push({message:`Could not verify git signing config: ${n.message}.`,name:"git.signing",severity:"warn",status:"skip"})}}if(o.config.floatingMajorTag===!0&&o.config.signing?.mode==="sigstore"&&t.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"}),o.config.floatingMajorTag===!0)try{const{createShellRunner:e}=await import("./shell-runner.js"),a=await e().run("git",["tag","--list","v*"],{cwd:p,silent:!0});if(a.exitCode===0){const s=a.stdout.split(`
|
|
3
|
+
`).map(i=>i.trim()).filter(i=>/^v\d+$/.test(i));if(s.length===0)t.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 i=s.slice(0,5),r=s.length>5?` (+${s.length-5} more)`:"",g=s[0],c=g.slice(1);t.push({message:`Legacy floating-major tags detected (${i.join(", ")}${r}). After upgrading the floating-tag format to \`<safe-name>-v<major>\`, these legacy tags are no longer updated. Consumers pinning \`<repo>@${g}\` will silently freeze at the pre-upgrade commit. Migration:
|
|
4
4
|
1. Re-tag the legacy tag to point at the new floating tag:
|
|
5
5
|
git tag -f ${g} <safe-name>-v${c}
|
|
6
6
|
git push --force origin ${g}
|
|
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
|
|
8
|
-
`).map(u=>u.trim()).filter(Boolean);l.length>0&&
|
|
9
|
-
`);return}for(const p of
|
|
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 t.push({message:`Skipped: \`git tag --list "v*"\` exited ${a.exitCode}.`,name:"floating-major-tag.legacy-tags",severity:"info",status:"skip"})}catch(e){t.push({message:`Skipped: could not list git tags: ${e.message}.`,name:"floating-major-tag.legacy-tags",severity:"info",status:"skip"})}if(f.firstRelease===!0){const e=[];try{const{createShellRunner:n}=await import("./shell-runner.js"),a=n(),s=new Set,i=o.config.releaseTagPattern??"{name}@{version}";s.add(i);for(const r of o.packages){const c=o.perPackageConfig.get(r.name)?.releaseTagPattern??i;s.add(c)}for(const r of s){const g=r.replaceAll(/\{(?:name|unscopedName|version|major|minor|patch|date|channel)\}/g,()=>"*"),c=await a.run("git",["tag","--list",g],{cwd:p,silent:!0});if(c.exitCode!==0)continue;const l=c.stdout.split(`
|
|
8
|
+
`).map(u=>u.trim()).filter(Boolean);l.length>0&&e.push(`Found ${l.length} git tag(s) matching "${r}": ${l.slice(0,5).join(", ")}${l.length>5?` (+${l.length-5} more)`:""}.`)}}catch(n){e.push(`Could not scan git tags: ${n.message}.`)}try{const{resolveVersionActionsId:n}=await import("./orchestrator.js").then(s=>s.w),{createVersionActions:a}=await import("../packem_shared/createVersionActions-ByaJ1Nbv.js");for(const s of o.packages){const i=o.perPackageConfig.get(s.name),r=n(s,i??{});let g;try{g=a(r)}catch{continue}let c;try{c=await g.readPublishedVersion.call(g,{perPackageConfig:i,pkg:s,pm:o.pm})}catch{continue}c&&c.length>0&&e.push(`${s.name} is already published at version ${c}.`)}}catch(n){e.push(`Could not probe published versions: ${n.message}.`)}e.length>0?t.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"}):t.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(o.config.gitlabHost){const{detectRemoteProvider:e}=await import("./detect.js"),{createShellRunner:n}=await import("./shell-runner.js"),a=await e(p,n(),o.config.provider);a==="gitlab"?t.push({message:`Self-hosted GitLab host configured: ${o.config.gitlabHost}.`,name:"gitlab-host",severity:"info",status:"pass"}):t.push({message:`release.gitlabHost is set ("${o.config.gitlabHost}") but the resolved provider is "${a}". The host will be ignored. Either set release.provider: "gitlab" or remove gitlabHost.`,name:"gitlab-host",severity:"warn",status:"fail"})}if(o.config.githubHost){const{detectRemoteProvider:e}=await import("./detect.js"),{createShellRunner:n}=await import("./shell-runner.js"),a=await e(p,n(),o.config.provider);a==="github"?await import("node:child_process").then(({execSync:i})=>{try{return i("gh --version",{stdio:"ignore"}),!0}catch{return!1}})?t.push({message:`Self-hosted GitHub Enterprise host configured: ${o.config.githubHost}.`,name:"github-host",severity:"info",status:"pass"}):t.push({message:`release.githubHost is set ("${o.config.githubHost}") but the gh CLI is not on PATH. Install gh and run \`gh auth login --hostname ${o.config.githubHost}\` before releasing.`,name:"github-host",severity:"error",status:"fail"}):t.push({message:`release.githubHost is set ("${o.config.githubHost}") but the resolved provider is "${a}". 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"),n=await import("node:path");let a;for(const s of o.packages){const i=o.perPackageConfig.get(s.name);if(i){if(i.uvLockPath){const r=n.isAbsolute(i.uvLockPath)?i.uvLockPath:n.join(s.dir,i.uvLockPath);try{await e.access(r),t.push({message:`uv.lock present at ${r}.`,name:`uv-lockfile/${s.name}`,severity:"info",status:"pass"})}catch{t.push({message:`${s.name}: configured uvLockPath "${i.uvLockPath}" doesn't exist (expected ${r}). Run \`uv lock\` to generate it, or remove uvLockPath if the lockfile lives elsewhere.`,name:`uv-lockfile/${s.name}`,severity:"warn",status:"fail"})}}if(i.uvWorkspace?.root){const r=n.resolve(s.dir,i.uvWorkspace.root),g=n.relative(r,s.dir).replaceAll("\\","/");switch(a||({checkUvWorkspaceMembership:a}=await import("./index2.js").then(l=>l.g)),await a(r,g)){case"member":{t.push({message:`${s.name} is a member of the uv workspace rooted at ${r}.`,name:`uv-workspace/${s.name}`,severity:"info",status:"pass"});break}case"no-root-pyproject":{t.push({message:`${s.name}: uvWorkspace.root points at ${r} 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":{t.push({message:`${s.name}: uvWorkspace.root points at ${r} 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:t.push({message:`${s.name}: uv workspace root at ${r} 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"),j=(e,n)=>{const a=e.split(".").map(i=>Number.parseInt(i,10)),s=n.split(".").map(i=>Number.parseInt(i,10));for(const[i,r]of s.entries()){const g=a[i]??0;if(g!==(r??0))return g>(r??0)}return!0};{const e=process.versions.node,[n=0,a=0]=e.split(".").map(i=>Number.parseInt(i,10)),s=n===22&&a>=14||n>=24||n===23;t.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,n,a]of[["git","2.31","git-version"],["gh","2.40","gh-version"]])try{const s=w(e,["--version"],{stdio:["ignore","pipe","ignore"]}).toString(),i=/(\d+\.\d+\.\d+)/.exec(s);if(!i)continue;const r=j(i[1],n);t.push({message:`${e}@${i[1]} (min: ${n})`,name:a,severity:r?"info":e==="git"?"error":"warn",status:r?"pass":"fail"})}catch{}{const e=new Set([o.config.publish?.registry??"https://registry.npmjs.org"]);for(const n of o.packages){const a=o.perPackageConfig.get(n.name)?.registry;a&&e.add(a)}for(const n of e)try{const a=n.replace(/\/+$/,""),s=await fetch(`${a}/-/ping`,{method:"HEAD",signal:AbortSignal.timeout(3e3)});t.push({message:`${n} reachable (HTTP ${s.status}).`,name:"registry-reachable",severity:s.ok||s.status===404?"info":"warn",status:"pass"})}catch(a){t.push({message:`${n} not reachable: ${a.message}. Publishing may fail (or you're offline — this is a warning).`,name:"registry-reachable",severity:"warn",status:"fail"})}}try{const n=w("git",["tag","--list"],{cwd:p,stdio:["ignore","pipe","ignore"]}).toString().split(/\r?\n/).map(i=>i.trim()).filter(Boolean),a=/(?:^|@)\d+\.\d+\.\d+(?:[-+].+)?$/,s=n.filter(i=>!a.test(i)&&!/^v?\d+\.\d+\.\d+/.test(i));t.push({message:n.length===0?"No git tags yet (fresh repo).":`${n.length-s.length}/${n.length} tags parse as a release tag${s.length>0?` (unrecognised: ${s.slice(0,3).join(", ")}${s.length>3?"…":""})`:""}.`,name:"tags-parseable",severity:"warn",status:s.length>0?"fail":"pass"})}catch{}{const{readFile:e}=await import("node:fs/promises"),n=await import("node:path");let a=0,s=0;for(const i of o.packages)try{const r=await e(n.join(i.dir,"CHANGELOG.md"),"utf8");s+=1,/^#{1,2}\s/m.test(r)&&(a+=1)}catch{}s>0&&t.push({message:`${a}/${s} existing CHANGELOG.md file(s) have a recognised heading structure.`,name:"changelog-format",severity:"info",status:a===s?"pass":"fail"})}try{const e=await o.pm.readCatalogYaml(p);if(e){const{parseCatalogs:n}=await import("./index2.js").then(i=>i.f),a=n(e),s=[];for(const i of o.packages)for(const r of["dependencies","devDependencies","peerDependencies","optionalDependencies"]){const g=i.manifest[r];if(!(!g||typeof g!="object"))for(const[c,l]of Object.entries(g)){if(typeof l!="string"||!l.startsWith("catalog:"))continue;const u=l.slice(8)||"default";(u==="default"?a.default?.[c]:a.named?.[u]?.[c])||s.push(`${i.name} → ${c} (${l})`)}}o.packages.length===0?t.push({message:"Skipped — no release-managed packages to inspect.",name:"catalog-consistency",severity:"info",status:"skip"}):t.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 $(h,f,t);const C=t.some(e=>e.severity==="error"&&e.status==="fail");process.exitCode=C?1:0},$=async(h,f,d)=>{if(f.json){process.stdout.write(`${JSON.stringify({checks:d},null,2)}
|
|
9
|
+
`);return}for(const p of d){const o=`${p.status==="pass"?"✓":p.status==="fail"?"✗":"—"} [${p.severity}] ${p.name}: ${p.message}`;p.severity==="error"&&p.status==="fail"?h.error(o):p.severity==="warn"&&p.status==="fail"?h.warn(o):h.info(o)}};export{N as default};
|
|
@@ -1,75 +1 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
${f}
|
|
3
|
-
${m}`);else{await P(c,{recursive:!0}),e.info(`Created ${g(t,c)}/`);try{const l=await v(u,"utf8"),p=[];l.includes(f)||p.push(f),l.includes(m)||p.push(m),p.length>0&&(await w(u,`${l.replace(/\n*$/,`
|
|
4
|
-
`)}
|
|
5
|
-
# vis release subsystem
|
|
6
|
-
${p.join(`
|
|
7
|
-
`)}
|
|
8
|
-
`),e.info("Updated .gitignore."))}catch{await w(u,`# vis release subsystem
|
|
9
|
-
${f}
|
|
10
|
-
${m}
|
|
11
|
-
`),e.info("Created .gitignore.")}}if(s.agent){const{upsertAgentSection:l}=await import("./agent-instructions.js"),p=o(t,"AGENTS.md");let k;try{k=await v(p,"utf8")}catch(y){if(y.code!=="ENOENT")throw y;k=void 0}const{changed:j,content:$}=l(k);j?a?e.info(`[dry-run] would ${k?"update":"create"} AGENTS.md with the 'Releasing with vis' section`):(await w(p,$),e.info(`${k?"Updated":"Created"} AGENTS.md.`)):e.info("AGENTS.md already up to date.")}const d=".vis/release/**",h=o(t,".secretlintignore");if(a)e.info(`[dry-run] would add to .secretlintignore:
|
|
12
|
-
${d}`);else try{const l=await v(h,"utf8");l.includes(d)||(await w(h,`${l.replace(/\n*$/,`
|
|
13
|
-
`)}
|
|
14
|
-
# vis release change files (author handles false-positive secretlint)
|
|
15
|
-
${d}
|
|
16
|
-
`),e.info("Updated .secretlintignore."))}catch{await w(h,`# vis release change files (author handles false-positive secretlint)
|
|
17
|
-
${d}
|
|
18
|
-
`),e.info("Created .secretlintignore.")}switch(i){case"bumpy":{await Y(t,a,e);break}case"changesets":{await U(t,a,e);break}case"semantic-release":{await G(t,a,r,e);break}default:z(e)}await H(t,a,s.yes===!0,e),await V(t,a,s,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")},G=async(e,s,n,t)=>{const a=await D(e);if(t.info(`Found ${a.length} .releaserc file(s).`),a.length===0)return;let r=[],i=0;for(const h of a){const l=await E(h);l&&(l.branches&&(r=[...r,...T(l.branches)]),l.plugins?.some(p=>typeof p=="string"&&p.includes("native-addons"))&&(i+=1),l.plugins?.some(p=>Array.isArray(p)&&typeof p[0]=="string"&&p[0].includes("native-addons"))&&(i+=1))}const c=new Set,f=r.filter(h=>c.has(h.name)?!1:(c.add(h.name),!0)),m=f.length>0?W(f):{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 d=` release: {
|
|
19
|
-
baseBranch: "main",
|
|
20
|
-
defaultManaged: false, // flip to true after Phase 6
|
|
21
|
-
channels: {
|
|
22
|
-
${Object.entries(m).map(([h,l])=>` ${JSON.stringify(h)}: ${JSON.stringify(l)},`).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(d),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(""),!n){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,a,d,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,s,n,t)=>{const a=o(e,"vis.config.ts"),r=await v(a,"utf8").catch(()=>{});if(r===void 0){const i=`import { defineConfig } from "@visulima/vis/config";
|
|
35
|
-
|
|
36
|
-
export default defineConfig({
|
|
37
|
-
${n}
|
|
38
|
-
});
|
|
39
|
-
`;await w(a,i),t.info(` wrote ${g(e,a)}`)}else if(/\brelease\s*:/.test(r))t.warn(` skipped ${g(e,a)} — already has a \`release\` key; merge the suggested block manually.`);else{const i=q(r,n);i===void 0?t.warn(` skipped ${g(e,a)} — could not locate \`defineConfig({\` or \`export default {\` to inject into; merge the suggested block manually.`):(await w(a,i),t.info(` updated ${g(e,a)} (injected release block)`))}for(const i of s){const c=_(i),f=o(c,"package.json");if(!await b(f))continue;const m=await v(f,"utf8");let u;try{u=JSON.parse(m)}catch{t.warn(` skipped ${g(e,f)} — invalid JSON.`);continue}const d=u["vis-release"];if(d!==null&&typeof d=="object"&&d.managed===!0)continue;const h=d!==null&&typeof d=="object"?{...d,managed:!0}:{managed:!0};u["vis-release"]=h,await w(f,`${JSON.stringify(u,void 0,4)}
|
|
40
|
-
`),t.info(` updated ${g(e,f)} (added vis-release.managed = true)`)}for(const i of s)await M(i,{force:!0}),t.info(` deleted ${g(e,i)}`)},q=(e,s)=>{const n=/defineConfig\s*\(\s*\{/.exec(e);if(n!==null){const a=n.index+n[0].length;return`${e.slice(0,a)}
|
|
41
|
-
${s}
|
|
42
|
-
${e.slice(a)}`}const t=/export\s+default\s+\{/.exec(e);if(t!==null){const a=t.index+t[0].length;return`${e.slice(0,a)}
|
|
43
|
-
${s}
|
|
44
|
-
${e.slice(a)}`}},U=async(e,s,n)=>{const t=o(e,".changeset"),a=o(t,"config.json"),r=o(t,"pre.json");if(await b(r)){n.error("Pre-release mode is active in changesets (.changeset/pre.json exists)."),n.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 v(a,"utf8"))}catch{n.warn(".changeset/config.json missing or unreadable; using defaults.")}const c={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"},f=i.changelog,m=typeof f=="string"?f:Array.isArray(f)&&typeof f[0]=="string"?f[0]:void 0;let u;f===!1?u="false":m?.includes("@changesets/changelog-github")?u='"github"':(m?.includes("@changesets/cli"),u='"default"');const d=[];let h=0;try{const l=await A(t);for(const p of l)!p.endsWith(".md")||p==="README.md"||d.push(p)}catch{}if(d.length>0){const l=o(e,".vis","release");let p=0;for(const k of d){const j=o(t,k),$=o(l,k);if(s){n.info(`[dry-run] would copy ${j} → ${$}`);continue}if(await b($)){n.info(`Skipping existing ${g(e,$)}.`),p+=1;continue}const y=await v(j,"utf8");await w($,y),h+=1}p>0&&n.info(`Skipped ${p} file(s) that already exist in .vis/release/.`)}n.info(`Found ${d.length} pending .changeset/*.md file(s); ${h>0?`copied ${h} to .vis/release/`:"(dry-run — would copy)"}.`),n.info(""),n.info("Suggested vis.config.ts release block:"),n.info(""),n.info(` release: {
|
|
45
|
-
baseBranch: ${JSON.stringify(c.baseBranch)},
|
|
46
|
-
access: ${JSON.stringify(c.access)},
|
|
47
|
-
defaultManaged: ${c.defaultManaged},
|
|
48
|
-
updateInternalDependencies: ${JSON.stringify(c.updateInternalDependencies)},
|
|
49
|
-
fixed: ${JSON.stringify(c.fixed)},
|
|
50
|
-
linked: ${JSON.stringify(c.linked)},
|
|
51
|
-
ignore: ${JSON.stringify(c.ignore)},
|
|
52
|
-
privatePackages: ${JSON.stringify(c.privatePackages)},
|
|
53
|
-
changelog: ${u},
|
|
54
|
-
publish: {
|
|
55
|
-
packManager: "auto",
|
|
56
|
-
publishStrategy: "npm-publish-tarball",
|
|
57
|
-
cleanPackageJson: true,
|
|
58
|
-
},
|
|
59
|
-
},`),n.info(""),n.info("After confirming the config, you can delete `.changeset/` (or run `vis release init --remove-changesets`).")},Y=async(e,s,n)=>{const t=o(e,".bumpy"),a=o(t,"_config.json");let r={};try{r=JSON.parse(await v(a,"utf8"))}catch{n.warn(".bumpy/_config.json missing or unreadable; using defaults.")}const i=JSON.stringify(r,null,4).split(`
|
|
60
|
-
`).map(m=>` ${m}`).join(`
|
|
61
|
-
`),c=[];let f=0;try{const m=await A(t);for(const u of m)!u.endsWith(".md")||u==="README.md"||c.push(u)}catch{}if(c.length>0){const m=o(e,".vis","release");let u=0;for(const d of c){const h=o(t,d),l=o(m,d);if(s){n.info(`[dry-run] would copy ${h} → ${l}`);continue}if(await b(l)){n.info(`Skipping existing ${g(e,l)}.`),u+=1;continue}const p=await v(h,"utf8");await w(l,p),f+=1}u>0&&n.info(`Skipped ${u} file(s) that already exist in .vis/release/.`)}n.info(`Found ${c.length} pending .bumpy/*.md file(s); ${f>0?`copied ${f} to .vis/release/`:"(dry-run)"}.`),n.info(""),n.info("Suggested vis.config.ts release block (bumpy config translates 1:1):"),n.info(""),n.info(` release: ${i.trimStart()},`),n.info(""),n.info("After confirming, delete `.bumpy/`.")},H=async(e,s,n,t)=>{const a=o(e,".husky","pre-commit");if(!await b(a))return;const r=await v(a,"utf8").catch(()=>"");if(r.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(n)return!0;try{const{confirmPrompt:m}=await import("./prompts.js");return await m(`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(s){t.info(`[dry-run] would append \`${i}\` to .husky/pre-commit`);return}const f=`${r.replace(/\n*$/,`
|
|
62
|
-
`)}${i}
|
|
63
|
-
`;await w(a,f),t.info("Wired vis release check into .husky/pre-commit.")},V=async(e,s,n,t)=>{const a=n.workflows===!0,r=n.yes===!0;if(!a&&(!process.stdout.isTTY||process.env.CI==="true"))return;if(!(a||r||await(async()=>{try{const{confirmPrompt:y}=await import("./prompts.js");return await y("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:c}=await import("./detect.js"),{generateWorkflowFiles:f}=await import("./workflow-templates.js"),{detectPackageManager:m}=await import("../packem_shared/createAdapter-F7GidOzU.js"),{createShellRunner:u}=await import("./shell-runner.js"),d=u(),h=await c(e,d,void 0),l=await m(e,d),k=n.packageManager??l;let j={};try{const{loadVisConfig:y}=await import("./CONFIG_FILES.js"),S=await y(e);S.release&&(j=S.release)}catch{}const $=f(j,{packageManager:k,provider:h});t.info(""),t.info(`Generating ${$.length} workflow file(s) for ${h}:`);for(const y of $){const S=o(e,y.path);if(await b(S)){t.warn(` ${y.path} — already exists, skipping`);continue}if(s){t.info(` ${y.path} — [dry-run] would write ${y.content.length} bytes`);continue}const N=await import("node:path");await P(N.dirname(S),{recursive:!0}),await w(S,y.content),t.info(` ${y.path} — wrote ${y.content.length} bytes`)}},z=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{L as default};
|
|
1
|
+
import{createRequire as l}from"node:module";import{r as w}from"../packem_shared/run-D-uVGHQ4.js";import{b as y}from"./orchestrator.js";import{createShellRunner as R}from"./shell-runner.js";let d;const p=n=>(d??=l(import.meta.url))(n),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,m=n=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[e,r]=o.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return o.getBuiltinModule(n)}return p(n)},{relative:_}=m("node:path"),C=async({fs:n,logger:e,options:r,workspaceRoot:c})=>{const a=c??process.cwd(),i=await y({cwd:a,skipRegistryLookup:!0}),{printConfigIfRequested:u}=await import("./print-config.js");if(u(r,i,e))return;const t=await w({allowFullHistory:r.allowFullHistory===!0,config:i.config,cwd:a,dryRun:r.dryRun===!0,from:r.from,fs:n,name:r.name,packages:i.packages,perPackageConfig:i.perPackageConfig,runner:R(),sinceLastRelease:r.sinceLastRelease===!0});for(const s of t.notes)e.info(s);for(const s of t.warnings)e.warn(s);if(t.status==="failed"){e.error(t.error),process.exitCode=1;return}if(t.status!=="no-changes"){if(t.status==="dry-run"){e.info("[dry-run] would write:"),e.info(t.content);return}e.info(`Created ${_(a,t.createdFile)}`);for(const[s,f]of t.bumps)e.info(` ${s}: ${f}`)}};export{C as default};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{DEFAULT_CHANGES_DIR as
|
|
1
|
+
import{createRequire as I}from"node:module";import{DEFAULT_CHANGES_DIR as T}from"./DEFAULT_CLEAN_KEEP.js";import{b as _,c as q,a as k,p as F}from"./orchestrator.js";import{r as V}from"../packem_shared/run-D-uVGHQ4.js";import{toRepoRelativePath as S,listUncommittedPaths as H,getShortSha as U,getCurrentBranch as K,pushBranch as E,stageAndCommit as W}from"./git.js";import{createShellRunner as B}from"./shell-runner.js";import{stateFilePath as z}from"./state.js";import{d as J}from"../packem_shared/sticky-comment-DjhyCIZt.js";import{VisReleaseError as A}from"../packem_shared/VisReleaseError-DZtgcKf8.js";let M;const O=r=>(M??=I(import.meta.url))(r),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,L=r=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[e,s]=$.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return $.getBuiltinModule(r)}return O(r)},{join:G}=L("node:path"),Q="<!-- vis:user-content -->",X="<!-- /vis:user-content -->",Y=/<!-- vis:user-content -->([\s\S]*?)<!-- \/vis:user-content -->/g,Z=/<!-- vis:user-content -->(?:(?!<!-- \/vis:user-content -->)[\s\S])*?<!-- vis:user-content -->/,ee=r=>`${Q}${r}${X}`,te=(r,e)=>{const s=[],c=/<!-- vis:user-content -->\s*<!-- \/vis:user-content -->/g;let n=c.exec(r);for(;n!==null;)s.push({end:n.index+n[0].length,start:n.index}),n=c.exec(r);if(s.length===0)return{body:r,remaining:e};let i=0;const t=[],u=Math.min(s.length,e.length);for(let d=0;d<u;d+=1){const h=s[d],l=e[d];t.push(r.slice(i,h.start)),t.push(l),i=h.end}return t.push(r.slice(i)),{body:t.join(""),remaining:e.slice(u)}},ne=(r,e)=>{if(r===void 0||r==="")return e;const s=r.replaceAll(/```[\s\S]*?```/g,"").replaceAll(/~~~[\s\S]*?~~~/g,""),c=(s.match(/<!-- vis:user-content -->/g)??[]).length,n=(s.match(/<!-- \/vis:user-content -->/g)??[]).length;if(c!==n)throw new A({code:"CONFIG_INVALID",hint:"Fix the marker pairs in the PR body and re-run.",message:`PR body has unbalanced <!-- vis:user-content --> markers (${c} opens, ${n} closes). Refusing to merge to prevent silent edit loss.`});if(Z.test(s))throw new A({code:"CONFIG_INVALID",hint:"Flatten the nesting in the PR body and re-run.",message:"Nested <!-- vis:user-content --> markers are not allowed in PR body. The merger refuses to operate to prevent silent edit loss."});const i=[];for(const l of r.matchAll(Y)){const g=l[1]??"";g.trim()!==""&&i.push(ee(g))}if(i.length===0)return e;const{body:t,remaining:u}=te(e,i);if(u.length===0)return t;const d=t.replace(/\s+$/u,""),h=u.join(`
|
|
2
2
|
|
|
3
|
-
`);return`${
|
|
3
|
+
`);return`${d}
|
|
4
4
|
|
|
5
|
-
${
|
|
6
|
-
`},
|
|
5
|
+
${h}
|
|
6
|
+
`},re=async(r,e,s)=>{try{return await r.access(z(e,s)),!0}catch{return!1}},se=async(r,e,s,c,n,i,t)=>{const u=await r.run("gh",["pr","list","--head",c,"--state","open","--json","number"],{cwd:s,silent:!0});if(u.exitCode===0&&u.stdout.trim()!==""&&u.stdout.trim()!=="[]")try{const l=JSON.parse(u.stdout);if(l[0]){let g=i,m=!1;try{const b=await r.run("gh",["pr","view",String(l[0].number),"--json","body","-q",".body"],{cwd:s,silent:!0});if(b.exitCode===0)try{g=ne(b.stdout.replace(/\n$/,""),i)}catch(w){m=!0,e.warn(`Skipping PR body update for #${l[0].number} — protected-content blocks are unbalanced, refusing to overwrite operator content. Please clean up markers manually. Cause: ${w.message}`)}}catch(b){e.warn(`Could not read existing body of PR #${l[0].number} for protected-edit merge: ${b.message}. Proceeding with the unmerged body.`)}const v=m?["pr","edit",String(l[0].number),"--title",n]:["pr","edit",String(l[0].number),"--title",n,"--body",g],C=await r.run("gh",v,{cwd:s,silent:!0});if(C.exitCode!==0)throw new Error(`gh pr edit #${l[0].number} failed: ${C.stderr.trim()}`);return{existing:!0,number:l[0].number}}}catch{}const d=await r.run("gh",["pr","create","--head",c,"--base",t,"--title",n,"--body",i],{cwd:s,silent:!0});if(d.exitCode!==0)return;const h=/\/pull\/(\d+)/.exec(d.stdout);return h?{existing:!1,number:Number.parseInt(h[1]??"0",10)}:void 0},ie=async(r,e,s,c)=>{const n=c.labels??["autorelease: pending"];n.length>0&&await r.run("gh",["pr","edit",String(s),...n.flatMap(i=>["--add-label",i])],{cwd:e,silent:!0}),c.reviewers&&c.reviewers.length>0&&await r.run("gh",["pr","edit",String(s),"--add-reviewer",c.reviewers.join(",")],{cwd:e,silent:!0}),c.assignees&&c.assignees.length>0&&await r.run("gh",["pr","edit",String(s),"--add-assignee",c.assignees.join(",")],{cwd:e,silent:!0})},ae=/^ci-(?:head|[\da-f]{4,40})\.md$/,oe=(r,e)=>{const s=e===""?"":`${e}/`;return r.startsWith(s)&&ae.test(r.slice(s.length))},we=async({fs:r,logger:e,options:s,workspaceRoot:c})=>{const n=c??process.cwd(),i=B();let t=await _({channel:s.channel,cwd:n});const{printConfigIfRequested:u}=await import("./print-config.js");if(u(s,t,e))return;const d=t.config.changesDir??T,h=s.generate===!0,l=h?await S({cwd:n,runner:i},G(n,d)):"",g=await H({cwd:n,runner:i}),m=h?g.filter(o=>oe(o,l)):[],v=g.filter(o=>!m.includes(o));if(v.length>0){const o=v.slice(0,5).join(", "),a=v.length>5?` (+${v.length-5} more)`:"";e.warn(`Working tree has uncommitted changes. CI mode requires a clean tree. Offending paths: ${o}${a}`),process.exitCode=1;return}if(m.length>0&&e.warn(`Keeping ${m.length} change file(s) left behind by an interrupted --generate run: ${m.join(", ")}.`),h){const o=await U({cwd:n,runner:i}),a=await V({allowFullHistory:s.allowFullHistory===!0,config:t.config,cwd:n,from:s.generateFrom,fs:r,name:`ci-${o??"head"}`,packages:t.packages,perPackageConfig:t.perPackageConfig,runner:i,sinceLastRelease:s.generateFrom===void 0});for(const f of a.notes)e.info(f);for(const f of a.warnings)e.warn(f);if(a.status==="failed"){e.error(a.error),process.exitCode=1;return}if(a.status==="written"){const f=await S({cwd:n,runner:i},a.createdFile),P=await i.run("git",["add","--",a.createdFile],{cwd:n,silent:!0});if(P.exitCode!==0){e.error(`Could not stage the generated change file ${f}: ${P.stderr.trim()||`exit ${P.exitCode}`}`);try{await r.rm(a.createdFile,{force:!0})}catch{e.warn(`Could not clean up ${f} after the staging failure — remove it before the next run.`)}process.exitCode=1;return}e.info(`Generated ${f} from ${a.fromRef}..HEAD (${a.bumps.size} package(s)).`),t=await _({channel:s.channel,cwd:n})}else e.info(`--generate derived no bumps from ${a.fromRef}..HEAD.`)}const C=s.autoPublish===!0?"auto-publish":t.channel?.mode??"auto-publish",{files:b}=await q({changesDir:t.config.changesDir,cwd:n});if(C==="auto-publish"){if(b.length===0){e.info("No pending change files. Nothing to release.");return}e.info(`Auto-publish mode — versioning + publishing ${t.plan.releases.length} package(s).`),await k(t,{commit:!0});const o=await F(t,{resume:!0,tag:t.channel?.tag}),a=await K({cwd:n,runner:i});if(a)try{await E({cwd:n,runner:i},a)}catch(f){e.error(`Failed to push branch: ${f.message}`)}e.info(`Published: ${o.published.length} | Skipped: ${o.skipped.length} | Failed: ${o.failed.length}`),process.exitCode=o.failed.length>0?2:0;return}if(b.length===0){const o=await re(r,n,d);o?e.info("No pending change files but `.state.json` is present — resuming the prior wave's publish."):e.info("No pending change files — assuming this push is a merged release PR. Publishing.");const a=await F(t,{resume:o,tag:t.channel?.tag});e.info(`Published: ${a.published.length} | Skipped: ${a.skipped.length} | Failed: ${a.failed.length}`),process.exitCode=a.failed.length>0?2:0;return}e.info(`Version-PR mode — maintaining release PR for ${t.plan.releases.length} package(s).`);const w=s.branch??t.config.versionPr?.branch??"vis-release/version-packages",j=t.config.versionPr?.title??"🚀 Versioned release";if(!await J(i,n)){e.error("Could not detect repository slug via gh CLI. Cannot maintain version PR."),process.exitCode=1;return}const R=await i.run("git",["switch","-C",w],{cwd:n,silent:!0});if(R.exitCode!==0){e.error(`Could not switch to ${w}: ${R.stderr}`),process.exitCode=1;return}const x=await k(t,{commit:!1}),y=[...x.changedFiles,...x.deletedFiles];if(y.length===0){e.warn("Apply produced no file changes. Aborting version PR.");return}await W({cwd:n,runner:i},y,t.config.gitUser?`release(${t.channel?.tag??"main"}): version packages [skip ci]`:"release: version packages [skip ci]",{author:t.config.gitUser});try{await E({cwd:n,runner:i},w,{force:!0})}catch(o){e.error(`Could not push ${w}: ${o.message}`),process.exitCode=1;return}const N=t.branch??t.config.baseBranch??"main",D=`${t.config.versionPr?.preamble??""}
|
|
7
7
|
|
|
8
8
|
## Pending releases
|
|
9
9
|
|
|
10
|
-
${t.plan.releases.map(
|
|
10
|
+
${t.plan.releases.map(o=>`- \`${o.name}\`: ${o.oldVersion} → **${o.newVersion}**`).join(`
|
|
11
11
|
`)}
|
|
12
|
-
`,
|
|
12
|
+
`,p=await se(i,e,n,w,j,D,N);if(p){if(e.info(`${p.existing?"Updated":"Opened"} version PR #${p.number}.`),await ie(i,n,p.number,{assignees:p.existing?void 0:t.config.versionPr?.assignees,labels:t.config.versionPr?.labels,reviewers:p.existing?void 0:t.config.versionPr?.reviewers}),t.config.versionPr?.autoMerge&&!p.existing){const o=t.config.versionPr.autoMergeMethod??"squash",a=await i.run("gh",["pr","merge",String(p.number),"--auto",`--${o}`],{cwd:n,silent:!0});a.exitCode===0?e.info(`Auto-merge enabled (${o}).`):e.warn(`Could not enable auto-merge on PR #${p.number}: ${a.stderr.trim()||`exit ${a.exitCode}`}`)}}else e.error("Failed to create / update version PR."),process.exitCode=1};export{we as default};
|