@visulima/vis 6.0.1 → 6.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 +54 -0
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +1226 -1216
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/cargo-lock.js +5 -0
- package/dist/packem_chunks/cargo-plan.js +3 -3
- package/dist/packem_chunks/catalog-detector.js +1 -1
- package/dist/packem_chunks/catalog.js +1 -94
- package/dist/packem_chunks/catalog2.js +11 -0
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +156 -174
- package/dist/packem_chunks/context.js +8 -0
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler12.js +4 -4
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler19.js +5 -5
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +4 -4
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler31.js +1 -1
- package/dist/packem_chunks/handler32.js +1 -1
- package/dist/packem_chunks/handler33.js +1 -1
- package/dist/packem_chunks/handler34.js +3 -3
- package/dist/packem_chunks/handler35.js +1 -1
- package/dist/packem_chunks/handler36.js +1 -1
- package/dist/packem_chunks/handler38.js +2 -2
- package/dist/packem_chunks/handler39.js +5 -5
- package/dist/packem_chunks/handler4.js +4 -4
- package/dist/packem_chunks/handler40.js +1 -1
- package/dist/packem_chunks/handler41.js +1 -1
- package/dist/packem_chunks/handler42.js +1 -1
- package/dist/packem_chunks/handler43.js +1 -1
- package/dist/packem_chunks/handler44.js +1 -1
- package/dist/packem_chunks/handler45.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler47.js +1 -1
- package/dist/packem_chunks/handler48.js +1 -1
- package/dist/packem_chunks/handler49.js +1 -1
- package/dist/packem_chunks/handler5.js +4 -4
- package/dist/packem_chunks/handler50.js +5 -5
- package/dist/packem_chunks/handler52.js +1 -1
- package/dist/packem_chunks/handler54.js +2 -2
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler56.js +3 -3
- package/dist/packem_chunks/handler57.js +4 -4
- package/dist/packem_chunks/handler58.js +4 -4
- package/dist/packem_chunks/handler59.js +2 -2
- package/dist/packem_chunks/handler6.js +7 -7
- package/dist/packem_chunks/handler60.js +1 -1
- package/dist/packem_chunks/handler61.js +3 -3
- package/dist/packem_chunks/handler62.js +1 -1
- package/dist/packem_chunks/handler63.js +3 -3
- package/dist/packem_chunks/handler64.js +3 -3
- package/dist/packem_chunks/handler65.js +4 -4
- package/dist/packem_chunks/handler66.js +2 -2
- package/dist/packem_chunks/handler67.js +5 -5
- package/dist/packem_chunks/handler68.js +12 -25
- package/dist/packem_chunks/handler69.js +25 -22
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +22 -10
- package/dist/packem_chunks/handler71.js +10 -153
- package/dist/packem_chunks/handler72.js +133 -23
- package/dist/packem_chunks/handler73.js +23 -323
- package/dist/packem_chunks/handler74.js +274 -659
- package/dist/packem_chunks/handler75.js +708 -48
- package/dist/packem_chunks/handler76.js +48 -27
- package/dist/packem_chunks/handler77.js +27 -3
- package/dist/packem_chunks/handler78.js +3 -191
- package/dist/packem_chunks/handler79.js +191 -0
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/heal.js +2 -2
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index2.js +3 -58
- package/dist/packem_chunks/index3.js +40 -3
- package/dist/packem_chunks/index6.js +135 -7
- package/dist/packem_chunks/index7.js +7 -135
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +2 -2
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/python-plan.js +3 -3
- package/dist/packem_chunks/python-projects.js +1 -1
- package/dist/packem_chunks/python.js +1 -0
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/snapshot.js +2 -2
- package/dist/packem_chunks/state.js +2 -2
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_chunks/version-resolver.js +1 -1
- package/dist/packem_chunks/workspace.js +2 -2
- package/dist/packem_shared/ReleaseClient-CWD9BC5w.js +1 -0
- package/dist/packem_shared/advisories-BodWQ5DQ.js +1 -0
- package/dist/packem_shared/{affected-selection-CrW7fWEd.js → affected-selection-QaMUnFqe.js} +1 -1
- package/dist/packem_shared/{ai-analysis-pldoS_N4.js → ai-analysis-D7jlbJky.js} +3 -3
- package/dist/packem_shared/ai-cache-iSIyY3So.js +1 -0
- package/dist/packem_shared/{ai-fix-D9MxigBQ.js → ai-fix-CgCyO65Q.js} +6 -6
- package/dist/packem_shared/apply-DoeQAAGm.js +6 -0
- package/dist/packem_shared/apply-release-plan-BalHtK-g.js +15 -0
- package/dist/packem_shared/{bin-D3TtXgz6.js → bin-LyW9KY0i.js} +1 -1
- package/dist/packem_shared/clean-package-json-rutwkKl-.js +1 -0
- package/dist/packem_shared/createAdapter-DMK4bBET.js +1 -0
- package/dist/packem_shared/createVersionActions-DXo4z8VN.js +1 -0
- package/dist/packem_shared/dependency-scan-DFnt1mni.js +1 -0
- package/dist/packem_shared/detect-CbMRSXkM.js +1 -0
- package/dist/packem_shared/{ecosystem-gate-ByxWtzPE.js → ecosystem-gate-Bdz-gK_Y.js} +1 -1
- package/dist/packem_shared/env-BSXG3QKH.js +4 -0
- package/dist/packem_shared/env-consistency-B4rU4MQb.js +1 -0
- package/dist/packem_shared/failure-log-DIsKBKaI.js +2 -0
- package/dist/packem_shared/formatBytes-_HvjOy8a-iHCer6uX.js +1 -0
- package/dist/packem_shared/glob-Cyk1H9ZL-DRlUeuow.js +1 -0
- package/dist/packem_shared/{index-BKbMnn8K.js → index-B1ZsG3oa.js} +1 -1
- package/dist/packem_shared/index-CgNfNk12.js +1 -0
- package/dist/packem_shared/lifecycle-CQjeMPY0.js +2 -0
- package/dist/packem_shared/missing-package-json-dtwl6w-S.js +1 -0
- package/dist/packem_shared/multi-eco-lockfiles-CyIfYw4u.js +1 -0
- package/dist/packem_shared/npmrc-CHsOyMvA.js +2 -0
- package/dist/packem_shared/osv-C53WUoSW.js +1 -0
- package/dist/packem_shared/{package-version-QFmE9anh.js → package-version-DqYSd_ia.js} +1 -1
- package/dist/packem_shared/packument-CbTmbHU4.js +1 -0
- package/dist/packem_shared/{project-name-filter-DIqpdsvP.js → project-name-filter-mwTJC1IK.js} +1 -1
- package/dist/packem_shared/{provenance-L1M2FPy_.js → provenance-SX1MxPUZ.js} +1 -1
- package/dist/packem_shared/publish-Dc0XGH3K.js +34 -0
- package/dist/packem_shared/registry-CkoaWkjP.js +81 -0
- package/dist/packem_shared/registry-keys-z038Ecb4.js +1 -0
- package/dist/packem_shared/removeSync-g1D5kONg-LbjATA8v.js +1 -0
- package/dist/packem_shared/renderToString-DR0zDUjh-C7p-L6AO.js +3 -0
- package/dist/packem_shared/{resolve-explicit-CQa37JSq.js → resolve-explicit-D9kdTNvl.js} +1 -1
- package/dist/packem_shared/{run-D-uVGHQ4.js → run-DLvd3RIZ.js} +1 -1
- package/dist/packem_shared/run-summary-utils-CMeURYtS.js +1 -0
- package/dist/packem_shared/runtime-check-D3cRDuoi.js +1 -0
- package/dist/packem_shared/s1ngularity-BuU9Cxpy.js +1 -0
- package/dist/packem_shared/scaffold-files-Bje3_Ixv.js +28 -0
- package/dist/packem_shared/scan-progress-D8ojNcKt.js +2 -0
- package/dist/packem_shared/{signatures-DIqFUOfs.js → signatures-CeL0bOEo.js} +1 -1
- package/dist/packem_shared/spinner-Bqjpz3i4.js +1 -0
- package/dist/packem_shared/table-DDAJalPF.js +1 -0
- package/dist/packem_shared/tabs-CC0GJLww.js +1 -0
- package/dist/packem_shared/{task-env-DzR4RkOj.js → task-env-C2lmxvzA.js} +1 -1
- package/dist/packem_shared/toolchain-CP79HNVy.js +5 -0
- package/dist/packem_shared/typosquats-BFKus_aM.js +1 -0
- package/dist/packem_shared/use-measured-height-_nYuZ-Au.js +1 -0
- package/dist/packem_shared/vis-update-app-Ba5ce8Jd.js +1 -0
- package/dist/packem_shared/{vis-user-error-S0Fesz5y.js → vis-user-error-D_ekz9rF.js} +1 -1
- package/dist/packem_shared/watch-loop-DWr41vHM.js +11 -0
- package/dist/packem_shared/xxh3-BLHlvhgT.js +1 -0
- package/dist/release/core/package-managers/index.js +1 -1
- package/dist/release/core/version-actions/index.js +1 -1
- package/dist/release/index.js +1 -1
- package/index.js +26 -26
- package/package.json +9 -9
- package/dist/packem_chunks/orchestrator.js +0 -46
- package/dist/packem_shared/ReleaseClient-DAvbxCdo.js +0 -1
- package/dist/packem_shared/createAdapter-F7GidOzU.js +0 -1
- package/dist/packem_shared/createVersionActions-ByaJ1Nbv.js +0 -1
- package/dist/packem_shared/dependency-scan-B8jroa1D.js +0 -1
- package/dist/packem_shared/env-consistency-Dt_uDbSP.js +0 -1
- package/dist/packem_shared/failure-log-BP-gCUb5.js +0 -2
- package/dist/packem_shared/formatBytes-_HvjOy8a-B_qQr4Hw.js +0 -4
- package/dist/packem_shared/glob-Cyk1H9ZL-Dxlf9Swz.js +0 -1
- package/dist/packem_shared/index-DGdD4w-b.js +0 -1
- package/dist/packem_shared/lifecycle-DvmDIRbb.js +0 -2
- package/dist/packem_shared/missing-package-json-Cu5YVAot.js +0 -1
- package/dist/packem_shared/multi-eco-lockfiles-B2X3yhyo.js +0 -1
- package/dist/packem_shared/packument-zb18Jnlw.js +0 -1
- package/dist/packem_shared/registry-keys-DxdqMzyp.js +0 -1
- package/dist/packem_shared/runtime-check-1U8HrQd9.js +0 -1
- package/dist/packem_shared/s1ngularity-CO5GkkqX.js +0 -1
- package/dist/packem_shared/scan-progress-RwCRxJdX.js +0 -2
- package/dist/packem_shared/spinner-BJjbNl1F.js +0 -1
- package/dist/packem_shared/tabs--uxJGL8N.js +0 -1
- package/dist/packem_shared/toolchain-Bz70UIcp.js +0 -5
- package/dist/packem_shared/typosquats-D4DEHhFy.js +0 -1
- package/dist/packem_shared/use-measured-height-DUZyyias.js +0 -1
- package/dist/packem_shared/vis-update-app-9b2kSk9f.js +0 -1
- package/dist/packem_shared/watch-loop-BEnGuMBn.js +0 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as d}from"node:module";import{b as y}from"./
|
|
1
|
+
import{createRequire as d}from"node:module";import{b as y}from"./context.js";let m;const f=s=>(m??=d(import.meta.url))(s),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=s=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[o,r]=t.versions.node.split(".").map(Number);if(o>22||o===22&&r>=3||o===20&&r>=16)return t.getBuiltinModule(s)}return f(s)},{appendFileSync:h}=g("node:fs"),j=async({logger:s,options:o,workspaceRoot:r})=>{const u=r??process.cwd(),n=await y({cwd:u,skipRegistryLookup:!0}),{printConfigIfRequested:l}=await import("./print-config.js");if(l(o,n,s))return;const i=n.plan.releases.length===0?"nothing":n.channel?.mode==="version-pr"?"version-pr":"publish",a=n.plan.releases.map(e=>e.name),c={channel:n.channel?.tag,mode:i,packages:a,plan:n.plan.releases.map(e=>({isCascadeBump:e.isCascadeBump,isDependencyBump:e.isDependencyBump,isGroupBump:e.isGroupBump,name:e.name,newVersion:e.newVersion,oldVersion:e.oldVersion,type:e.type})),prerelease:n.channel?.prerelease,warnings:n.plan.warnings};process.stdout.write(`${JSON.stringify(c,null,2)}
|
|
2
2
|
`);const p=process.env.GITHUB_OUTPUT;if(p){const e=[`mode=${i}`,`packages=${a.join(",")}`,`json<<__VIS_RELEASE_EOF__
|
|
3
3
|
${JSON.stringify(c)}
|
|
4
4
|
__VIS_RELEASE_EOF__`];try{h(p,`${e.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolvePushAuthEnv as f}from"./git.js";import{b}from"./
|
|
1
|
+
import{resolvePushAuthEnv as f}from"./git.js";import{createShellRunner as b}from"./shell-runner.js";import{b as p}from"./context.js";const v=async({logger:r,options:n,workspaceRoot:d})=>{const t=d??process.cwd(),i=b(),o=await p({cwd:t}),e=n.branch??o.config.versionPr?.branch??"vis-release/version-packages",s=n.base??o.config.baseBranch??"main";r.info(`Rebasing ${e} onto ${s}...`);const a=await i.run("git",["fetch","origin",`${e}:${e}`,s],{cwd:t,silent:!0});if(a.exitCode!==0){r.info(`No remote branch ${e} to rebase (${a.stderr.trim()||"fetch failed"}). Skipping.`);return}const c=await i.run("git",["switch",e],{cwd:t,silent:!0});if(c.exitCode!==0){r.error(`Could not switch to ${e}: ${c.stderr.trim()}`),process.exitCode=1;return}if((await i.run("git",["rebase",`origin/${s}`],{cwd:t,silent:!0})).exitCode!==0){await i.run("git",["rebase","--abort"],{cwd:t,silent:!0}),r.error("Rebase produced conflicts; aborting. Resolve manually, or let the next `vis release ci release` recompute the version PR from scratch."),process.exitCode=1;return}const u=await i.run("git",["rev-list","--count",`origin/${e}..${e}`],{cwd:t,silent:!0});if(u.exitCode===0&&u.stdout.trim()==="0"){r.info(`${e} is already up to date with ${s}. Nothing to push.`);return}const l=await f({cwd:t,runner:i},"origin"),h=await i.run("git",["push","--force-with-lease","origin",`${e}:${e}`],{cwd:t,env:l,silent:!0});if(h.exitCode!==0){r.error(`Failed to force-push ${e}: ${h.stderr.trim()}`),process.exitCode=1;return}r.info(`Force-pushed ${e} after rebasing onto ${s}.`)};export{v as default};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{detectRemoteProvider as h,createRemoteClient as $}from"./detect.js";import{createShellRunner as w}from"./shell-runner.js";import{runSnapshot as C}from"./snapshot.js";import{b as R}from"./context.js";const P=(n,r)=>{if(n.length===0)return"_No packages were affected by this PR._";const o=["### 📦 Preview Packages",""];for(const e of n){const t=`${e.name}@${e.version}`;o.push(`- \`${e.name}\` → \`${e.version}\``),r?o.push(` \`\`\`sh
|
|
2
2
|
npm i ${t} --registry ${r}
|
|
3
3
|
\`\`\``):o.push(` \`\`\`sh
|
|
4
4
|
npm i ${t}
|
|
5
5
|
\`\`\``)}return o.join(`
|
|
6
|
-
`)},v=async({logger:n,options:r,workspaceRoot:o})=>{const e=o??process.cwd(),t=
|
|
6
|
+
`)},v=async({logger:n,options:r,workspaceRoot:o})=>{const e=o??process.cwd(),t=w(),l=await h(e,t,void 0),a=$(l),s=a.detectPullRequestNumber(process.env),p=r.tag??(s?`pr-${s}`:void 0);if(!p){n.error("Could not determine snapshot tag. Pass --tag or run in a PR context (GITHUB_REF=refs/pull/<n>/merge)."),process.exitCode=1;return}if(r.onClose){await b(e,t,a,s,n);return}let c,u;try{c=await R({cwd:e});const{printConfigIfRequested:i}=await import("./print-config.js");if(i(r,c,n))return;u=await C({context:c,runner:t,tag:p})}catch(i){n.error(`Snapshot failed: ${i.message}`),process.exitCode=1;return}if(n.info(`Snapshotted ${u.published.length} package(s) at version ${u.snapshotVersion} → tag "${u.tag}"`),!s)return;const d=await a.detectRepoSlug(e,t);if(!d){n.warn("Could not detect repo slug — skipping sticky PR comment.");return}const m="<!-- vis-release-snapshot-comment -->",f=`${m}
|
|
7
7
|
|
|
8
8
|
${P(u.published,c.config.snapshot?.registry)}`;try{const i=await a.upsertStickyComment(t,{body:f,cwd:e,issueNumber:s,marker:m,repo:d});i&&n.info(`${i.created?"Posted":"Updated"} snapshot comment on PR #${s}.`)}catch(i){n.warn(`upsertStickyComment failed (publish already succeeded): ${i.message}`)}},b=async(n,r,o,e,t)=>{if(!e){t.error("PR-close cleanup requires a PR context."),process.exitCode=1;return}const l=await o.detectRepoSlug(n,r);if(!l){t.warn("Could not detect repo slug — skipping cleanup.");return}const a=await r.run("gh",["api",`repos/${l}/pulls/${e}/commits`,"--paginate"],{cwd:n,silent:!0});if(a.exitCode!==0){t.warn(`gh api failed: ${a.stderr}`);return}let s;try{s=JSON.parse(a.stdout)}catch{t.warn("Could not parse gh api output.");return}const p=[`pr-${e}`];for(const c of s)p.push(c.sha,c.sha.slice(0,7));t.info(`Cleanup intent for PR #${e}: ${p.length} tag pattern(s) across ${s.length} commit(s)`),t.info("Default backend (pkg-pr-new) auto-cleans by TTL — no DELETE issued. Implement a custom backend's delete endpoint to enable real cleanup.")};export{v as default};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{b as P}from"./
|
|
2
|
-
${o.stderr}`,i=/Token scopes:\s*(.+)/.exec(s);if(o.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 k=await import("node:fs/promises"),b=await import("node:path");for(const e of n.packages){if(e.manifest.napi===void 0)continue;const t=b.join(e.dir,"npm");try{const s=(await k.readdir(t,{withFileTypes:!0})).filter(c=>c.isDirectory());if(s.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 i=[];for(const c of s){const l=b.join(t,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?a.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"}):a.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(t,c.name,"package.json"),"utf8"));Object.hasOwn(r,l.name)||g.push(l.name)}catch{}g.length>0&&a.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{a.push({message:`${e.name}: could not read npm/ subdir.`,name:`napi-${e.name}-platforms`,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{let e;n.plan.releases.length>0?e=`Plan resolves ${n.plan.releases.length} release(s).`:n.packages.length===0?e="No pending releases — no package is release-managed, so the plan is always empty.":e="No pending releases.",a.push({message:e,name:"plan-readable",severity:"info",status:"pass"})}const v=n.config.publish?.guards;if(v?.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"})}v?.audit&&v.audit!=="off"&&a.push({message:`Runtime npm audit gate active at "${v.audit}" severity.`,name:"publish-guards.audit",severity:"info",status:"pass"});const y=n.config.publish?.releaseAssets;if((y?.stampHashes||y?.uploadTarball)&&a.push({message:`Release-asset attestation: stampHashes=${y.stampHashes??!1}, uploadTarball=${y.uploadTarball??!1}.`,name:"publish-releaseAssets",severity:"info",status:"pass"}),n.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 e=n.config.publish?.registry??"https://registry.npmjs.org/",t=/(?:^|:\/\/)registry\.npmjs\.(?:org|com)\//.test(e);a.push({message:t?"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:t?"info":"warn",status:t?"pass":"fail"});const o=n.packages.filter(i=>i.manifest.publishConfig?.access==="restricted"),s=!!process.env.ACTIONS_ID_TOKEN_REQUEST_URL&&!process.env.NPM_TOKEN;o.length>0&&s&&a.push({message:`${o.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:t}=await import("./staged-registry.js"),o=await t(p,n.config.changesDir??e);if(o.pending.length>0){const s=o.pending.map(i=>`${i.name}@${i.version} (${i.reason})`).join(", ");a.push({message:`${o.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:t}=await import("node:fs/promises"),{join:o}=await import("node:path"),s=o(p,n.config.changesDir??e,".state.json"),i=await t(s,"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 e=n.packages.filter(t=>n.perPackageConfig.get(t.name)?.versionActions==="shell");for(const t of e){const o=n.perPackageConfig.get(t.name)??{},s=n.config.allowCustomCommands,i=s===!0||Array.isArray(s)&&s.includes(t.name),r=o.publishCommand!==void 0&&o.publishCommand!=="";i||a.push({message:`${t.name} uses versionActions: "shell" but release.allowCustomCommands does not permit it. Set allowCustomCommands: true or include "${t.name}" in the array.`,name:`shell-actions.${t.name}.trust-gate`,severity:"error",status:"fail"}),r?i&&a.push({message:`${t.name} → shell publish (${Array.isArray(o.publishCommand)?`${o.publishCommand.length} commands`:"1 command"}).`,name:`shell-actions.${t.name}`,severity:"info",status:"pass"}):a.push({message:`${t.name} uses versionActions: "shell" but no publishCommand is configured. Set release.packages["${t.name}"].publishCommand.`,name:`shell-actions.${t.name}.publish-command`,severity:"error",status:"fail"})}}if(!n.config.gitUser)try{const{createShellRunner:e}=await import("./shell-runner.js"),t=e(),o=await t.run("git",["config","user.name"],{cwd:p,silent:!0}),s=await t.run("git",["config","user.email"],{cwd:p,silent:!0}),i=o.exitCode===0&&o.stdout.trim().length>0,r=s.exitCode===0&&s.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: ${o.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:t}=await import("./shell-runner.js"),o=t(),s=await o.run("git",["config","user.signingkey"],{cwd:p,silent:!0}),i=await o.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?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(e.mode==="sigstore"){const{gitsignAvailable:l}=await import("./git.js");await l({cwd:p,runner:o})?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=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: ${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(t){a.push({message:`Could not verify git signing config: ${t.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"),o=await e().run("git",["tag","--list","v*"],{cwd:p,silent:!0});if(o.exitCode===0){const s=o.stdout.split(`
|
|
3
|
-
`).map(
|
|
1
|
+
import{b as P}from"./context.js";const N=async({logger:h,options:f,workspaceRoot:d})=>{const p=d??process.cwd(),a=[];let n;try{n=await P({cwd:p}),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 $(h,f,a),process.exitCode=1;return}let m;try{m=await n.pm.listWorkspacePackages(p)}catch{m=void 0}if(n.packages.length>0){const e=m===void 0?n.packages.length:Math.max(m.length,n.packages.length);a.push({message:`Discovered ${e} workspace package(s).`,name:"workspace-discovered",severity:"info",status:"pass"}),a.push({message:`${n.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)a.push({message:"No packages discovered. Ensure your package manager's workspace block resolves.",name:"workspace-discovered",severity:"error",status:"fail"}),a.push({message:"Skipped — no workspace packages to opt in.",name:"release-managed-packages",severity:"info",status:"skip"});else{const e=m.length,t=m.every(i=>i.private)?" Every discovered package is private — private packages additionally need release.privatePackages.version.":"";a.push({message:`Discovered ${e} workspace package(s).`,name:"workspace-discovered",severity:"info",status:"pass"}),a.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.${t}`,name:"release-managed-packages",severity:"warn",status:"fail"})}try{const e=await n.pm.detectVersion(p);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:t})=>{try{return t("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:p,silent:!0}),s=`${i.stdout}
|
|
2
|
+
${i.stderr}`,o=/Token scopes:\s*(.+)/.exec(s);if(i.exitCode!==0||!o)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=o[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 k=await import("node:fs/promises"),b=await import("node:path");for(const e of n.packages){if(e.manifest.napi===void 0)continue;const t=b.join(e.dir,"npm");try{const s=(await k.readdir(t,{withFileTypes:!0})).filter(c=>c.isDirectory());if(s.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 o=[];for(const c of s){const l=b.join(t,c.name,"package.json");try{const u=JSON.parse(await k.readFile(l,"utf8"));u.version!==e.version&&o.push(`${c.name} (${u.version} vs parent ${e.version})`)}catch{o.push(`${c.name} (unreadable manifest)`)}}o.length>0?a.push({message:`${e.name}: platform versions out of sync — ${o.join(", ")}. They'll be re-synced on next publish.`,name:`napi-${e.name}-versions`,severity:"warn",status:"fail"}):a.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(t,c.name,"package.json"),"utf8"));Object.hasOwn(r,l.name)||g.push(l.name)}catch{}g.length>0&&a.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{a.push({message:`${e.name}: could not read npm/ subdir.`,name:`napi-${e.name}-platforms`,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{let e;n.plan.releases.length>0?e=`Plan resolves ${n.plan.releases.length} release(s).`:n.packages.length===0?e="No pending releases — no package is release-managed, so the plan is always empty.":e="No pending releases.",a.push({message:e,name:"plan-readable",severity:"info",status:"pass"})}const v=n.config.publish?.guards;if(v?.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"})}v?.audit&&v.audit!=="off"&&a.push({message:`Runtime npm audit gate active at "${v.audit}" severity.`,name:"publish-guards.audit",severity:"info",status:"pass"});const y=n.config.publish?.releaseAssets;if((y?.stampHashes||y?.uploadTarball)&&a.push({message:`Release-asset attestation: stampHashes=${y.stampHashes??!1}, uploadTarball=${y.uploadTarball??!1}.`,name:"publish-releaseAssets",severity:"info",status:"pass"}),n.config.publish?.stage){try{const{execSync:o}=await import("node:child_process"),r=o("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 e=n.config.publish?.registry??"https://registry.npmjs.org/",t=/(?:^|:\/\/)registry\.npmjs\.(?:org|com)\//.test(e);a.push({message:t?"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:t?"info":"warn",status:t?"pass":"fail"});const i=n.packages.filter(o=>o.manifest.publishConfig?.access==="restricted"),s=!!process.env.ACTIONS_ID_TOKEN_REQUEST_URL&&!process.env.NPM_TOKEN;i.length>0&&s&&a.push({message:`${i.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:t}=await import("./staged-registry.js"),i=await t(p,n.config.changesDir??e);if(i.pending.length>0){const s=i.pending.map(o=>`${o.name}@${o.version} (${o.reason})`).join(", ");a.push({message:`${i.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:t}=await import("node:fs/promises"),{join:i}=await import("node:path"),s=i(p,n.config.changesDir??e,".state.json"),o=await t(s,"utf8"),r=JSON.parse(o);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 e=n.packages.filter(t=>n.perPackageConfig.get(t.name)?.versionActions==="shell");for(const t of e){const i=n.perPackageConfig.get(t.name)??{},s=n.config.allowCustomCommands,o=s===!0||Array.isArray(s)&&s.includes(t.name),r=i.publishCommand!==void 0&&i.publishCommand!=="";o||a.push({message:`${t.name} uses versionActions: "shell" but release.allowCustomCommands does not permit it. Set allowCustomCommands: true or include "${t.name}" in the array.`,name:`shell-actions.${t.name}.trust-gate`,severity:"error",status:"fail"}),r?o&&a.push({message:`${t.name} → shell publish (${Array.isArray(i.publishCommand)?`${i.publishCommand.length} commands`:"1 command"}).`,name:`shell-actions.${t.name}`,severity:"info",status:"pass"}):a.push({message:`${t.name} uses versionActions: "shell" but no publishCommand is configured. Set release.packages["${t.name}"].publishCommand.`,name:`shell-actions.${t.name}.publish-command`,severity:"error",status:"fail"})}}if(!n.config.gitUser)try{const{createShellRunner:e}=await import("./shell-runner.js"),t=e(),i=await t.run("git",["config","user.name"],{cwd:p,silent:!0}),s=await t.run("git",["config","user.email"],{cwd:p,silent:!0}),o=i.exitCode===0&&i.stdout.trim().length>0,r=s.exitCode===0&&s.stdout.trim().length>0;!o||!r?a.push({message:`git config user.name/user.email is not set (name=${o?"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: ${i.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:t}=await import("./shell-runner.js"),i=t(),s=await i.run("git",["config","user.signingkey"],{cwd:p,silent:!0}),o=await i.run("git",["config","gpg.format"],{cwd:p,silent:!0}),r=s.exitCode===0?s.stdout.trim():"",g=o.exitCode===0?o.stdout.trim():"",c=r.length>0||!!e.key;if(e.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(e.mode==="sigstore"){const{gitsignAvailable:l}=await import("./git.js");await l({cwd:p,runner:i})?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=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: ${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(t){a.push({message:`Could not verify git signing config: ${t.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:p,silent:!0});if(i.exitCode===0){const s=i.stdout.split(`
|
|
3
|
+
`).map(o=>o.trim()).filter(o=>/^v\d+$/.test(o));if(s.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 o=s.slice(0,5),r=s.length>5?` (+${s.length-5} more)`:"",g=s[0],c=g.slice(1);a.push({message:`Legacy floating-major tags detected (${o.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 a.push({message:`Skipped: \`git tag --list "v*"\` exited ${
|
|
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(t){e.push(`Could not scan git tags: ${t.message}.`)}try{const{resolveVersionActionsId:t}=await import("./
|
|
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(f.firstRelease===!0){const e=[];try{const{createShellRunner:t}=await import("./shell-runner.js"),i=t(),s=new Set,o=n.config.releaseTagPattern??"{name}@{version}";s.add(o);for(const r of n.packages){const c=n.perPackageConfig.get(r.name)?.releaseTagPattern??o;s.add(c)}for(const r of s){const g=r.replaceAll(/\{(?:name|unscopedName|version|major|minor|patch|date|channel)\}/g,()=>"*"),c=await i.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(t){e.push(`Could not scan git tags: ${t.message}.`)}try{const{resolveVersionActionsId:t}=await import("./context.js").then(s=>s.w),{createVersionActions:i}=await import("../packem_shared/createVersionActions-DXo4z8VN.js");for(const s of n.packages){const o=n.perPackageConfig.get(s.name),r=t(s,o??{});let g;try{g=i(r)}catch{continue}let c;try{c=await g.readPublishedVersion.call(g,{perPackageConfig:o,pkg:s,pm:n.pm})}catch{continue}c&&c.length>0&&e.push(`${s.name} is already published at version ${c}.`)}}catch(t){e.push(`Could not probe published versions: ${t.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("./detect.js"),{createShellRunner:t}=await import("./shell-runner.js"),i=await e(p,t(),n.config.provider);i==="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 "${i}". 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("./detect.js"),{createShellRunner:t}=await import("./shell-runner.js"),i=await e(p,t(),n.config.provider);i==="github"?await import("node:child_process").then(({execSync:o})=>{try{return o("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 "${i}". The host will be ignored. Either set release.provider: "github" or remove githubHost.`,name:"github-host",severity:"warn",status:"fail"})}{const{checkVersionFile:e}=await import("./cargo-lock.js").then(t=>t.v);for(const t of n.packages)for(const i of n.perPackageConfig.get(t.name)?.versionFiles??[])a.push(await e({entry:i,packageDir:t.dir,packageName:t.name,packageVersion:t.version}))}{const e=await import("node:fs/promises"),t=await import("node:path");let i;for(const s of n.packages){const o=n.perPackageConfig.get(s.name);if(o){if(o.uvLockPath){const r=t.isAbsolute(o.uvLockPath)?o.uvLockPath:t.join(s.dir,o.uvLockPath);try{await e.access(r),a.push({message:`uv.lock present at ${r}.`,name:`uv-lockfile/${s.name}`,severity:"info",status:"pass"})}catch{a.push({message:`${s.name}: configured uvLockPath "${o.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(o.uvWorkspace?.root){const r=t.resolve(s.dir,o.uvWorkspace.root),g=t.relative(r,s.dir).replaceAll("\\","/");switch(i||({checkUvWorkspaceMembership:i}=await import("./python.js").then(l=>l.p)),await i(r,g)){case"member":{a.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":{a.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":{a.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:a.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"),C=(e,t)=>{const i=e.split(".").map(o=>Number.parseInt(o,10)),s=t.split(".").map(o=>Number.parseInt(o,10));for(const[o,r]of s.entries()){const g=i[o]??0;if(g!==(r??0))return g>(r??0)}return!0};{const e=process.versions.node,[t=0,i=0]=e.split(".").map(o=>Number.parseInt(o,10)),s=t===22&&i>=14||t>=24||t===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,t,i]of[["git","2.31","git-version"],["gh","2.40","gh-version"]])try{const s=w(e,["--version"],{stdio:["ignore","pipe","ignore"]}).toString(),o=/(\d+\.\d+\.\d+)/.exec(s);if(!o)continue;const r=C(o[1],t);a.push({message:`${e}@${o[1]} (min: ${t})`,name:i,severity:r?"info":e==="git"?"error":"warn",status:r?"pass":"fail"})}catch{}{const e=new Set([n.config.publish?.registry??"https://registry.npmjs.org"]);for(const t of n.packages){const i=n.perPackageConfig.get(t.name)?.registry;i&&e.add(i)}for(const t of e)try{const i=t.replace(/\/+$/,""),s=await fetch(`${i}/-/ping`,{method:"HEAD",signal:AbortSignal.timeout(3e3)});a.push({message:`${t} reachable (HTTP ${s.status}).`,name:"registry-reachable",severity:s.ok||s.status===404?"info":"warn",status:"pass"})}catch(i){a.push({message:`${t} not reachable: ${i.message}. Publishing may fail (or you're offline — this is a warning).`,name:"registry-reachable",severity:"warn",status:"fail"})}}try{const t=w("git",["tag","--list"],{cwd:p,stdio:["ignore","pipe","ignore"]}).toString().split(/\r?\n/).map(o=>o.trim()).filter(Boolean),i=/(?:^|@)\d+\.\d+\.\d+(?:[-+].+)?$/,s=t.filter(o=>!i.test(o)&&!/^v?\d+\.\d+\.\d+/.test(o));a.push({message:t.length===0?"No git tags yet (fresh repo).":`${t.length-s.length}/${t.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"),t=await import("node:path");let i=0,s=0;for(const o of n.packages)try{const r=await e(t.join(o.dir,"CHANGELOG.md"),"utf8");s+=1,/^#{1,2}\s/m.test(r)&&(i+=1)}catch{}s>0&&a.push({message:`${i}/${s} existing CHANGELOG.md file(s) have a recognised heading structure.`,name:"changelog-format",severity:"info",status:i===s?"pass":"fail"})}try{const e=await n.pm.readCatalogYaml(p);if(e){const{parseCatalogs:t}=await import("./catalog.js"),i=t(e),s=[];for(const o of n.packages)for(const r of["dependencies","devDependencies","peerDependencies","optionalDependencies"]){const g=o.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"?i.default?.[c]:i.named?.[u]?.[c])||s.push(`${o.name} → ${c} (${l})`)}}n.packages.length===0?a.push({message:"Skipped — no release-managed packages to inspect.",name:"catalog-consistency",severity:"info",status:"skip"}):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 $(h,f,a);const j=a.some(e=>e.severity==="error"&&e.status==="fail");process.exitCode=j?1:0},$=async(h,f,d)=>{if(f.json){process.stdout.write(`${JSON.stringify({checks:d},null,2)}
|
|
9
9
|
`);return}for(const p of d){const n=`${p.status==="pass"?"✓":p.status==="fail"?"✗":"—"} [${p.severity}] ${p.name}: ${p.message}`;p.severity==="error"&&p.status==="fail"?h.error(n):p.severity==="warn"&&p.status==="fail"?h.warn(n):h.info(n)}};export{N as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{O as R}from"./cli-main.js";import{v as x,r as V,f as N}from"../packem_shared/ai-analysis-
|
|
2
|
-
`);const t=await
|
|
3
|
-
`);const t=
|
|
4
|
-
`):
|
|
1
|
+
import{O as R}from"./cli-main.js";import{v as x,r as V,f as N}from"../packem_shared/ai-analysis-D7jlbJky.js";import{p as $,g as T,e as M,a as C,f as O}from"../packem_shared/registry-CkoaWkjP.js";import{readCatalogs as S,fetchPackageVersions as j}from"./catalog2.js";import{f as z}from"../packem_shared/osv-C53WUoSW.js";const F=/^[\^~>=<]+/,B=async({argument:E,logger:s,options:i,visConfig:c,workspaceRoot:l})=>{if(!l)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const p=E,e=p[0];if(!e)throw new Error("Package name is required. Usage: vis analyze <package> [version]");const u=p[1],{packageManager:A}=R(l);let r,m="default";const b=S(l,A);for(const[t,h]of b){const n=h.get(e);if(n){r=n,m=t;break}}if(!r)throw new Error(`Package "${e}" not found in any catalog or package.json. Make sure it exists in your workspace dependencies.`);let a;if(u)a=u;else{s.info(`Fetching latest version for ${e}...
|
|
2
|
+
`);const t=await j(e);if(!t.latest)throw new Error(`Could not determine latest version for "${e}".`);a=t.latest}const d=$(r),g=$(a);if(!d||!g)throw new Error(`Could not parse versions: current="${r}", target="${a}".`);const y=T(d,g);if(y==="none"){s.info(`${e} is already at ${a}. Nothing to analyze.`);return}const P=M(r),f={catalogName:m,currentRange:r,newRange:`${P}${a}`,packageName:e,targetVersion:a,updateType:y},w=x(i.aiType??"impact");if(w==="security"||i.security){s.info(`Checking for known vulnerabilities...
|
|
3
|
+
`);const t=r.replace(F,""),n=(await z([{name:e,version:t}])).get(e);n&&n.length>0&&(f.vulnerabilities=n);const v=C(c?.security,{minimumScore:c?.security?.policies?.score?.minimum});if(v.length>0){const o=(await O(v,[{name:e,version:t}])).get(`${e}@${t}`);o&&(f.socketReport={alerts:o.alerts,license:o.license,score:o.score})}}const k=await V([f],s,c?.ai,w);(i.format??"table")==="json"?process.stdout.write(`${JSON.stringify(k,void 0,2)}
|
|
4
|
+
`):s.info(N(k))};export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as l}from"node:module";import{r as w}from"../packem_shared/run-
|
|
1
|
+
import{createRequire as l}from"node:module";import{r as w}from"../packem_shared/run-DLvd3RIZ.js";import{createShellRunner as y}from"./shell-runner.js";import{b as R}from"./context.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 R({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:y(),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,4 +1,4 @@
|
|
|
1
|
-
import{b as k}from"./
|
|
1
|
+
import{b as k}from"./context.js";const $=async({logger:i,options:n,workspaceRoot:l})=>{const p=l??process.cwd(),t=await k({channel:n.channel,cwd:p,firstRelease:n.firstRelease===!0,skipRegistryLookup:!0}),{printConfigIfRequested:f}=await import("./print-config.js");if(f(n,t,i))return;const s=n.package,c=s?t.plan.releases.filter(e=>e.name===s):t.plan.releases;if(c.length===0){if(s!==void 0&&s!==""){const a=new Set(t.plan.releases.map(r=>r.name)).has(s),u=t.packages.some(r=>r.name===s);let o;if(a)o=`release plan unexpectedly empty for "${s}"`;else if(u)o=`package "${s}" is in the workspace but has no pending release (no change file targets it).`;else{const r=t.packages.slice(0,5).map(w=>w.name).join(", "),d=r?` Known workspace packages: ${r}${t.packages.length>5?", …":""}.`:"";o=`package "${s}" is not in this workspace.${d}`}i.error(`--package filter matched no releases: ${o}`),n.json&&process.stdout.write(`${JSON.stringify({error:o},null,2)}
|
|
2
2
|
`),process.exitCode=1;return}n.json&&process.stdout.write(`{}
|
|
3
3
|
`);return}if(n.json){const e={};for(const a of c)e[a.name]={from:a.oldVersion,to:a.newVersion};process.stdout.write(`${JSON.stringify(e,null,2)}
|
|
4
4
|
`);return}const m=[...c].sort((e,a)=>e.name.localeCompare(a.name));for(const e of m)process.stdout.write(`${e.name} ${e.oldVersion} -> ${e.newVersion}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as A}from"node:module";import{
|
|
1
|
+
import{createRequire as A}from"node:module";import{createShellRunner as S}from"./shell-runner.js";import{b as _}from"./context.js";let C;const N=e=>(C??=A(import.meta.url))(e),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[t,o]=y.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return y.getBuiltinModule(e)}return N(e)},{resolve:v}=$("node:path"),j=["test"],O=e=>e===void 0||e===""?"test":j.includes(e)?e:void 0,x=e=>e==null?[]:Array.isArray(e)?e:[e],R=async(e,t)=>{const o=S();let i,r;try{const{createRemoteClient:s,detectRemoteProvider:p}=await import("./detect.js"),l=await p(t,o,void 0);i=await s(l,{}).detectRepoSlug(t,o)}catch{}try{r=JSON.parse(await e.readFile(`${t}/package.json`,"utf8")).name}catch{}const w=r?`${r.startsWith("@")?r:`@${r}`}/example`:"@scope/example",a=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(),...r===void 0?{}:{monorepoName:r},published:[{name:w,tag:"latest",url:a,version:"1.0.0"}],...i===void 0?{}:{repo:i},skipped:[]}},F=(e,t)=>t?t.includes(":")?e===t:e===t||e.startsWith(`${t}:`):!0,T=async e=>{const t=[],o=[];if(!e)return{channels:t,pluginFailures:o};const{SlackNotificationChannel:i}=await import("./slack.js");for(const a of x(e.slack))t.push(new i(a));const{DiscordNotificationChannel:r}=await import("./discord.js");for(const a of x(e.discord))t.push(new r(a));const{WebhookNotificationChannel:w}=await import("./webhook.js");for(const a of x(e.webhook))t.push(new w(a));if(e.plugins&&e.plugins.length>0){const{pathToFileURL:a}=await import("node:url"),{dynamicEsmImport:s}=await import("./dynamic-import.js");for(const p of e.plugins){const[l,f]=Array.isArray(p)?p:[p,void 0],h=l;try{const d=l.startsWith(".")?a(`${process.cwd()}/${l}`).href:l,m=await s(d),u=m.default??m;let c;typeof u=="function"?c=u(f):u&&typeof u=="object"&&typeof u.send=="function"&&(c=u),c&&typeof c=="object"&&typeof c.send=="function"?t.push(c):o.push({error:"did not export a NotificationChannel (object with .send) or a factory returning one",id:h})}catch(d){o.push({error:d.message,id:h})}}}return{channels:t,pluginFailures:o}},J=async(e,t)=>{try{return await e.send(t),{id:e.id,ok:!0}}catch(o){const i=o instanceof Error?o.message:String(o),{redactTokens:r}=await import("./security.js");return{error:r(i),id:e.id,ok:!1}}},M=async(e,t)=>{const o=v(process.cwd(),t),i=await e.readFile(o,"utf8"),r=JSON.parse(i);return{channel:r.channel,completedAt:r.completedAt??new Date().toISOString(),...r.monorepoName===void 0?{}:{monorepoName:r.monorepoName},published:Array.isArray(r.published)?r.published:[],...r.repo===void 0?{}:{repo:r.repo},skipped:Array.isArray(r.skipped)?r.skipped:[]}},E=async({fs:e,logger:t,options:o,workspaceRoot:i})=>{const r=i??process.cwd();if(O(o.action)===void 0){t.error(`Unknown action "${o.action}". Expected: test.`),process.exitCode=1;return}let a;try{a=await _({cwd:r,skipRegistryLookup:!0})}catch(n){t.error(`Failed to load release context: ${n instanceof Error?n.message:String(n)}`),process.exitCode=1;return}const s=a.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 n={channels:[],hint:"No notifications configured. Add `release.notifications.{slack,discord,webhook,plugins}` to vis.config.ts.",ok:!0};o.json?process.stdout.write(`${JSON.stringify(n,null,2)}
|
|
2
2
|
`):t.info(n.hint);return}let l;try{l=o.customContext?await M(e,o.customContext):await R(e,r)}catch(n){t.error(`Could not load NotificationContext: ${n.message}`),process.exitCode=1;return}const{channels:f,pluginFailures:h}=await T(s),d=o.channel,m=f.filter(n=>F(n.id,d));if(m.length===0&&h.length===0){const n=d?`No channels matched filter "${d}". Configured ids: ${f.map(b=>b.id).join(", ")||"(none)"}.`:"No channels could be materialised from the configured notifications block.";o.json?process.stdout.write(`${JSON.stringify({channels:[],hint:n,ok:!1},null,2)}
|
|
3
3
|
`):t.error(n),process.exitCode=1;return}const c=[...await Promise.all(m.map(n=>J(n,l))),...h.map(n=>({error:`plugin load failed: ${n.error}`,id:n.id,ok:!1}))],k=c.filter(n=>!n.ok);if(o.json)process.stdout.write(`${JSON.stringify({channels:c,ok:k.length===0},null,2)}
|
|
4
4
|
`);else{for(const g of c)g.ok?t.info(` ${g.id} OK`):t.error(` ${g.id} FAIL — ${g.error??"unknown error"}`);const n=c.length,b=n-k.length;t.info(""),t.info(`Dispatched ${b}/${n} channel${n===1?"":"s"}.`)}k.length>0&&(process.exitCode=1)};export{E as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createRequire as b}from"node:module";import{DEFAULT_CHANGES_DIR as C}from"./DEFAULT_CLEAN_KEEP.js";import{b as T,f as x}from"./
|
|
1
|
+
import{createRequire as b}from"node:module";import{DEFAULT_CHANGES_DIR as C}from"./DEFAULT_CLEAN_KEEP.js";import{b as T,f as x}from"./context.js";import{a as R}from"../packem_shared/slug-OBHcH7wV.js";import B from"./handler44.js";let _;const j=e=>(_??=b(import.meta.url))(e),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=e=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[n,t]=p.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return p.getBuiltinModule(e)}return j(e)},{join:h}=k("node:path"),d=["none","patch","minor","major"],g=(e,n)=>{const t=d.indexOf(e)+n;return d[Math.min(Math.max(t,0),d.length-1)]??e},v=e=>e.chosen!==e.release.type,P=(e,n)=>{const t=[];e.isCascadeBump&&t.push("cascade"),e.isGroupBump&&t.push("group"),e.isDependencyBump&&!e.isCascadeBump&&t.push("dep-bump");const i=t.length>0?` [${t.join(", ")}]`:"";return`${e.name}: ${e.oldVersion} → ${e.newVersion} (${n})${i}`},S=async e=>{const{selectPrompt:n}=await import("./prompts.js");process.stdout.write(`
|
|
2
2
|
${P(e,e.type)}
|
|
3
3
|
`);const t=await n("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 t==="promote"?g(e.type,1):t==="demote"?g(e.type,-1):t==="skip"?"none":t==="set"?n("Set bump level to?",[{label:"major",value:"major"},{label:"minor",value:"minor"},{label:"patch",value:"patch"},{label:"none (skip)",value:"none"}]):e.type},q=async e=>{const n=[];for(const t of e)n.push({chosen:await S(t),release:t});return n},L=async(e,n,t,i,l)=>{const a={};for(const r of i)r.chosen!=="none"&&(a[r.release.name]=r.chosen);const o=h(n,t,`${R("plan")}.md`),u={bumps:a};return await e.mkdir(h(n,t),{recursive:!0}),await e.writeFile(o,x(u,l)),o},D=async e=>{const{fs:n,logger:t,options:i,workspaceRoot:l}=e,a=l??process.cwd();if(!process.stdout.isTTY){t.error("--interactive requires a TTY. Drop the flag to get JSON output."),process.exitCode=1;return}const o=await T({channel:i.channel,cwd:a,skipRegistryLookup:!0}),{printConfigIfRequested:u}=await import("./print-config.js");if(u(i,o,t))return;const{releases:r}=o.plan;if(r.length===0){t.info("No pending releases.");return}o.channel&&t.info(`Channel: ${o.channel.tag}${o.channel.prerelease?` (preid: ${o.channel.prerelease})`:""} | mode: ${o.channel.mode}`),t.info(`Walking through ${r.length} pending release(s). Press Ctrl-C to abort.`);const c=await q(r),f=c.filter(s=>v(s)).length,w=c.filter(s=>s.chosen==="none").length;t.info(""),t.info("Summary:");for(const s of c){const m=v(s)?` (was ${s.release.type})`:"";t.info(` ${s.release.name}: ${s.chosen}${m}`)}if(t.info(""),t.info(`${f} overridden, ${w} skipped, ${c.length-f} accepted as-is.`),i.write){if(f===0){t.info("Nothing to write — every package was accepted as-is.");return}const{textPrompt:s}=await import("./prompts.js"),m=await s("Changelog body for the override change file:","Operator-driven plan adjustment via `vis release plan -i`."),$=o.config.changesDir??C,y=await L(n,a,$,c,m);t.info(`Wrote ${y}`)}},I=async e=>{if(e.options.interactive){await D(e);return}await B({...e,options:{...e.options,bump:void 0,json:!0}})};export{I as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as m}from"./
|
|
1
|
+
import{b as m}from"./context.js";const u=a=>a==="major"||a==="minor"||a==="patch"||a==="none",d=async({logger:a,options:i,workspaceRoot:p})=>{const c=p??process.cwd();let s;try{s=await m({channel:i.channel,cwd:c,skipRegistryLookup:!0})}catch(e){a.error(`Failed to load release context: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1;return}const{printConfigIfRequested:l}=await import("./print-config.js");if(l(i,s,a))return;let{releases:t}=s.plan;if(i.bump){const e=i.bump.split(",").map(n=>n.trim()).filter(u);e.length>0&&(t=t.filter(n=>e.includes(n.type)))}if(i.filter){const n=(await import("./index.js")).default;t=t.filter(r=>n(i.filter,r.name))}if(i.json){const e={branch:s.branch,channel:s.channel,consumedChangeFiles:s.plan.consumedChangeFiles.map(n=>n.path),releases:t.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:s.plan.warnings};process.stdout.write(`${JSON.stringify(e,null,2)}
|
|
2
2
|
`),t.length===0&&(process.exitCode=1);return}if(t.length===0){if(a.info("No pending releases."),s.plan.warnings.length>0){a.warn(`${s.plan.warnings.length} warning(s):`);for(const e of s.plan.warnings)a.warn(` - ${e}`)}process.exitCode=1;return}s.channel&&a.info(`Channel: ${s.channel.tag}${s.channel.prerelease?` (preid: ${s.channel.prerelease})`:""} | mode: ${s.channel.mode}`),a.info(`${t.length} package(s) pending release:`),a.info("");const o={major:[],minor:[],none:[],patch:[]};for(const e of t)o[e.type].push(e);for(const e of["major","minor","patch"])if(o[e].length!==0){a.info(` ${e.toUpperCase()}:`);for(const n of o[e]){const r=[];n.isCascadeBump&&r.push("cascade"),n.isGroupBump&&r.push("group"),n.isDependencyBump&&!n.isCascadeBump&&r.push("dep-bump");const f=r.length>0?` [${r.join(", ")}]`:"";a.info(` ${n.name}: ${n.oldVersion} → ${n.newVersion}${f}`)}}if(s.plan.warnings.length>0){a.info(""),a.warn(`${s.plan.warnings.length} warning(s):`);for(const e of s.plan.warnings)a.warn(` - ${e}`)}};export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_CHANGES_DIR as d}from"./DEFAULT_CLEAN_KEEP.js";import{stageAndCommitFile as l}from"./git.js";import{
|
|
1
|
+
import{DEFAULT_CHANGES_DIR as d}from"./DEFAULT_CLEAN_KEEP.js";import{stageAndCommitFile as l}from"./git.js";import{readPreMode as u,buildEnterFile as g,writePreMode as f,preModeFilePath as $}from"./pre-mode.js";import{createShellRunner as x}from"./shell-runner.js";import{VisReleaseError as w}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import{b as h}from"./context.js";const v=["enter","exit","status"],k=e=>e===void 0||e===""?"status":v.includes(e)?e:void 0,y=async(e,i,r)=>{const t=i.tag?.[0];if(!t){r.error("`pre enter` requires a tag, e.g.: vis release pre enter alpha"),process.exitCode=1;return}const n=await h({cwd:e,skipRegistryLookup:!0}),o=n.config.changesDir??d,m=await u(e,o);if(m){r.error(`Already in pre-mode (tag "${m.tag}", mode "${m.mode}"). Run \`vis release pre exit\` first if you want to switch tags.`),process.exitCode=1;return}const a=g(t,n.packages.map(s=>({name:s.name,version:s.version}))),c=await f(e,o,a);if(r.info(`Entered pre-mode with tag "${t}". ${Object.keys(a.initialVersions).length} package version(s) snapshot.`),i.commit){const s=x();try{const p=await l({cwd:e,runner:s},c,`chore(release): enter pre-mode (${t}) [skip ci]`,{author:n.config.gitUser,push:i.push,sign:n.config.gitSignCommits===!0});r.info(`${p.committed?"Committed":"No commit needed for"} ${c}${p.pushed?" + pushed":""}.`)}catch(p){r.warn(`Could not commit ${c}: ${p.message}`)}}else r.info(`Run \`git add ${c} && git commit -m 'chore(release): enter pre-mode (${t}) [skip ci]'\` so CI sees the state.`)},C=async(e,i,r)=>{const t=await h({cwd:e,skipRegistryLookup:!0}),n=t.config.changesDir??d,o=await u(e,n);if(!o){r.error("Not in pre-mode. Nothing to exit."),process.exitCode=1;return}if(o.mode==="exit-pending"){r.info("Pre-mode already in `exit-pending` state. Run `vis release version` to consolidate.");return}if(t.channel?.prerelease!==void 0)throw new w({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 "${t.channel.tag}" pins prerelease "${t.channel.prerelease}".`,message:`Refusing to exit pre-mode: the active channel "${t.channel.tag}" has its own prerelease identifier "${t.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 m={...o,mode:"exit-pending"},a=await f(e,n,m);if(r.info("Pre-mode flagged for exit. The next `vis release version` will consolidate the prereleases and delete pre.json."),i.commit){const c=x();try{const s=await l({cwd:e,runner:c},a,`chore(release): exit pre-mode (was ${o.tag}) [skip ci]`,{author:t.config.gitUser,push:i.push,sign:t.config.gitSignCommits===!0});r.info(`${s.committed?"Committed":"No commit needed for"} ${a}${s.pushed?" + pushed":""}.`)}catch(s){r.warn(`Could not commit ${a}: ${s.message}`)}}},E=async(e,i)=>{const t=(await h({cwd:e,skipRegistryLookup:!0})).config.changesDir??d,n=await u(e,t);if(!n){i.info("Pre-mode: off.");return}i.info(`Pre-mode: ${n.mode==="pre"?"ACTIVE":"EXIT-PENDING"} (tag "${n.tag}", entered ${n.enteredAt})`),i.info(` → ${$(e,t)}`),i.info(` → ${Object.keys(n.initialVersions).length} package version(s) snapshot at enter time.`)},P=async({logger:e,options:i,workspaceRoot:r})=>{const t=r??process.cwd(),n=k(i.action);if(n===void 0){e.error(`Unknown action "${i.action}". Expected one of: enter, exit, status.`),process.exitCode=1;return}if(n==="enter"){await y(t,i,e);return}if(n==="exit"){await C(t,i,e);return}await E(t,e)};export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{VisReleaseError as $}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import{b as m}from"./context.js";import{p as b}from"../packem_shared/publish-Dc0XGH3K.js";const C=async({logger:t,options:n,workspaceRoot:o})=>{const f=o??process.cwd(),r=n.dryRun===!0;let a;try{a=await m({channel:n.channel,cwd:f,firstRelease:n.firstRelease===!0,projects:n.filter?n.filter.split(",").map(e=>e.trim()).filter(Boolean):void 0})}catch(e){t.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(n,a,t))return;if(n.checkOnly===!0){if(t.info(`Preflight: ${a.plan.releases.length} pending publish(es)${a.channel?` to dist-tag "${a.channel.tag}"`:""}.`),a.plan.warnings.length>0)for(const e of a.plan.warnings)t.warn(` - ${e}`);process.exitCode=a.plan.releases.length===0?1:0;return}if(a.plan.releases.length===0){t.info("No pending releases — nothing to publish.");return}const i=n.tag??a.channel?.tag;i||t.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."),t.info(`${r?"[dry-run] would publish":"Publishing"} ${a.plan.releases.length} package(s) to dist-tag "${i??"latest"}"${r?"":"..."}`);let s;try{s=await b(a,{dryRun:r,noPush:!n.push,otp:n.otp,resume:n.resume===!0,tag:i})}catch(e){if(e instanceof $&&e.code==="STAGE_PENDING"){t.error(e.message),e.hint&&(t.info(""),t.info(`Next steps: ${e.hint}`)),process.exitCode=1;return}t.error(`Publish failed: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1;return}t.info("");for(const e of s.published)t.info(` [published] ${e.name}@${e.version}`);for(const e of s.skipped)e.reason.startsWith("stage-")?t.warn(` [stage] ${e.name} (${e.reason} — re-run \`vis release publish\` once approved)`):t.info(` [skipped] ${e.name} (${e.reason})`);for(const e of s.failed)t.error(` [failed] ${e.name}: ${e.reason}`);t.info(""),t.info(`Published: ${s.published.length} | Skipped: ${s.skipped.length} | Failed: ${s.failed.length}`),s.tags.length>0&&t.info(`Tags created: ${s.tags.length}${s.tagsPushed?" (pushed)":" (NOT pushed — re-run with --resume to retry)"}`),s.failed.length===0?process.exitCode=0:s.published.length===0&&s.skipped.length===0?process.exitCode=3:process.exitCode=2;const l=s.failed.filter(e=>/\bEOTP\b|one[- ]time password|otp/i.test(e.reason));if(l.length>0){t.info(""),t.warn("Publish failed because the registry required a 2FA OTP. Rerun with:");const e=l.map(p=>p.name).join(","),h=n.channel?` --channel=${n.channel}`:"",d=n.tag?` --tag=${n.tag}`:"",u=` --filter='${e}'`;t.info(` vis release publish --otp=REPLACE_WITH_NEW_OTP --resume${d}${h}${u}`)}};export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{runSnapshot as f}from"./snapshot.js";import{b as c}from"./context.js";const h=async({logger:r,options:i,workspaceRoot:a})=>{const o=a??process.cwd();if(!i.tag){r.error("--tag is required."),process.exitCode=1;return}const s=i.dryRun===!0,n=await c({cwd:o}),{printConfigIfRequested:d}=await import("./print-config.js");if(d(i,n,r))return;let e;try{e=await f({context:n,dryRun:s,filter:i.filter,registry:i.registry,tag:i.tag})}catch(t){r.error(`Snapshot failed: ${t.message}`),process.exitCode=1;return}r.info(`${s?"[dry-run] would snapshot":"Snapshotting"} at version ${e.snapshotVersion} → tag "${e.tag}"`);for(const t of e.published)r.info(` ${s?"[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{h as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{DEFAULT_CHANGES_DIR as m}from"./DEFAULT_CLEAN_KEEP.js";import{
|
|
1
|
+
import{DEFAULT_CHANGES_DIR as m}from"./DEFAULT_CLEAN_KEEP.js";import{createShellRunner as w}from"./shell-runner.js";import{readStagedRegistry as y,removePendingStages as x,writeStagedRegistry as C}from"./staged-registry.js";import{acquireLock as A,releaseLock as S}from"./state.js";import{b as g}from"./context.js";const j=["approve","list","reject"],N=t=>t===void 0||t===""?"list":j.includes(t)?t:void 0,k=async(t,o,a,n)=>{const s=["stage","list","--json"],d=a.stageIds?.[0],i=a.filter??d;i&&s.push(i);const p=await t.run("npm",s,{cwd:o,silent:!0}),c=await g({cwd:o}),r=await y(o,c.config.changesDir??m),u=i?{...r,pending:r.pending.filter(e=>e.name===i)}:r;let l=[];if(p.exitCode===0&&p.stdout.trim())try{l=JSON.parse(p.stdout)}catch{process.stdout.write(`${p.stdout}
|
|
2
2
|
`)}if(a.json){process.stdout.write(`${JSON.stringify({npm:l,registry:u.pending},null,2)}
|
|
3
3
|
`);return}if(l.length===0&&u.pending.length===0){n.info("No staged versions awaiting approval.");return}const h=new Set(l.map(e=>e.id).filter(Boolean)),f=new Set(u.pending.map(e=>e.id));for(const e of l){const v=f.has(e.id??"")?"":" [npm-only]";n.info(` ${e.id??"<no-id>"} ${e.package??"?"}@${e.version??"?"} → ${e.tag??"latest"}${v}`)}for(const e of u.pending)h.has(e.id)||n.info(` ${e.id} ${e.name}@${e.version} → ${e.tag??"latest"} [registry-only, ${e.reason}]`)},E=async(t,o,a)=>{if(o.all){const s=await g({cwd:t}),d=await y(t,s.config.changesDir??m);if(d.pending.length===0){a.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(i=>i.id)}const n=o.stageIds??[];if(n.length===0){a.error("Pass stage ids positionally, or use --all to approve every pending stage in .vis/release/staged.json.");return}return n},O=async(t,o,a,n,s)=>{const d=t==="approve"?await E(a,n,s):n.stageIds;if(!d||d.length===0){t==="reject"&&s.error("Pass stage ids positionally to reject."),process.exitCode=1;return}const i=[],p=[];for(const c of d){const r=await o.run("npm",["stage",t,c],{cwd:a,silent:!1});r.exitCode===0?i.push(c):p.push({id:c,reason:r.stderr.trim()||`exit ${r.exitCode}`})}if(s.info(""),i.length>0){s.info(`${t==="approve"?"Approved":"Rejected"} ${i.length} stage(s).`);let c=[];try{const r=await g({cwd:a}),u=r.config.changesDir??m,l=await y(a,u);if(t==="reject"){const f=new Set(i);c=l.pending.filter(e=>f.has(e.id)).map(e=>({name:e.name,version:e.version}))}const h=x(l,i);if(h!==l){const f=await C(a,u,h);if(f.changed&&n.commit){const{stageAndCommitFile:e}=await import("./git.js"),v=f.removed?"chore(release): clear pending stage registry [skip ci]":`chore(release): ${t} ${i.length} stage${i.length===1?"":"s"} [skip ci]`,$=await e({cwd:a,runner:o},f.path,v,{author:r.config.gitUser,push:n.push,sign:r.config.gitSignCommits===!0});s.info(`Updated ${f.path}${$.committed?" and committed":""}${$.pushed?" + pushed":""}.`)}else f.changed&&s.info(`Updated ${f.path}. Commit + push it so the next release wave sees the resolved state.`)}}catch(r){s.warn(`Could not update staged registry: ${r.message}`)}if(c.length>0){s.info(""),s.info("Orphan CHANGELOG sections to review:");for(const r of c)s.info(` Edit CHANGELOG.md for ${r.name} to remove the orphan ${r.version} section before the next wave`);s.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)s.error(` ${c.id}: ${c.reason}`);process.exitCode=1}},L=async({logger:t,options:o,workspaceRoot:a})=>{const n=a??process.cwd(),s=N(o.action);if(s===void 0){t.error(`Unknown action "${o.action}". Expected one of: list, approve, reject.`),process.exitCode=1;return}const d=w();if(s==="list"){await k(d,n,o,t);return}let i,p=!1;if(o.commit)try{i=(await g({cwd:n})).config.changesDir??m,await A(n,i),p=!0}catch(c){t.error(`Could not acquire release lock: ${c.message}`),process.exitCode=1;return}try{await O(s,d,n,o,t)}finally{p&&i&&await S(n,i)}};export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{VisReleaseError as o}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import{b as c}from"./context.js";import{a as d}from"../packem_shared/apply-DoeQAAGm.js";const u=async({logger:e,options:a,workspaceRoot:r})=>{const l=r??process.cwd(),s=a.dryRun===!0,t=await c({channel:a.channel,cwd:l,firstRelease:a.firstRelease===!0,projects:a.filter?a.filter.split(",").map(n=>n.trim()).filter(Boolean):void 0}),{printConfigIfRequested:f}=await import("./print-config.js");if(f(a,t,e))return;if(a.checkOnly===!0){if(e.info(`Preflight: ${t.plan.releases.length} pending release(s)${t.channel?` on channel "${t.channel.tag}"`:""}.`),t.plan.warnings.length>0)for(const n of t.plan.warnings)e.warn(` - ${n}`);process.exitCode=t.plan.releases.length===0?1:0;return}if(t.plan.releases.length===0){e.info("No pending releases — nothing to version."),process.exitCode=0;return}t.channel&&e.info(`Channel: ${t.channel.tag}${t.channel.prerelease?` (preid: ${t.channel.prerelease})`:""}`),e.info(`${s?"[dry-run] would version":"Versioning"} ${t.plan.releases.length} package(s)...`);for(const n of t.plan.releases)e.info(` ${n.name}: ${n.oldVersion} → ${n.newVersion}`);let i;try{i=await d(t,{commit:a.commit===!0,dryRun:s})}catch(n){if(n instanceof o&&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(s){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)}.`):a.commit&&e.warn("--commit was requested but no commit was made (likely no changes to commit).");if(t.plan.warnings.length>0){e.info(""),e.warn(`${t.plan.warnings.length} warning(s):`);for(const n of t.plan.warnings)e.warn(` - ${n}`)}};export{u as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{createRequire as $}from"node:module";import{O as j
|
|
1
|
+
import{createRequire as $}from"node:module";import{O as j}from"../packem_shared/renderToString-DR0zDUjh-C7p-L6AO.js";import{q as E}from"../packem_shared/table-DDAJalPF.js";import{R as I}from"../packem_shared/registry-CkoaWkjP.js";import{d as P}from"../packem_shared/pm-runner-RM72mDZg.js";import{l as C}from"../packem_shared/dependency-scan-DFnt1mni.js";import{r as T}from"../packem_shared/provenance-SX1MxPUZ.js";import{r as D}from"../packem_shared/signatures-CeL0bOEo.js";import{loadOptionalSigstore as R}from"./loader.js";let y;const O=r=>(y??=$(import.meta.url))(r),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=r=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[t,s]=m.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return m.getBuiltinModule(r)}return O(r)},{createHash:N}=_("node:crypto"),{isAbsolute:k,resolve:S,basename:v}=_("node:path"),q=r=>(r??"").split(",").map(t=>t.trim()).filter(t=>t.length>0),V=async({logger:r,options:t,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const n=t.format??"table",c=t.prodOnly??!1,u=t.failOn==="error"?"error":"warning",d=q(t.allowlist),a=P(s),l=C(s,a.name,{includeDev:!c}).map(({name:e,version:o})=>({name:e,version:o})),[f,p]=await Promise.all([T(l,{allowlist:d,workspaceRoot:s}),D(l,{allowlist:d,workspaceRoot:s})]),i=[...f.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})),...p.map(e=>({code:e.code,message:e.message,packageName:e.packageName,severity:e.severity,version:e.version}))],g=i.filter(e=>u==="error"?e.severity==="error":!0);if(n==="json")process.stdout.write(`${JSON.stringify({findings:i,ok:g.length===0},void 0,2)}
|
|
2
2
|
`);else if(n==="ndjson")for(const e of i)process.stdout.write(`${JSON.stringify(e)}
|
|
3
|
-
`);else if(i.length===0)
|
|
4
|
-
`);return}
|
|
3
|
+
`);else if(i.length===0)r.info(`No provenance regressions or signature problems across ${String(l.length)} locked packages.`);else{const e=process.stdout.columns||80;r.info(j(I.createElement(E,{data:i.map(o=>({code:o.code,package:`${o.packageName}@${o.version}`,severity:o.severity}))}),{columns:e}));for(const o of i)r.warn(`${o.packageName}@${o.version}: ${o.message}`)}g.length>0&&(process.exitCode=1)},x=()=>process.env.CI==="true"||typeof process.env.ACTIONS_ID_TOKEN_REQUEST_URL=="string"||typeof process.env.SIGSTORE_ID_TOKEN=="string",J=(r,t,s)=>({_type:"https://in-toto.io/Statement/v1",predicate:{buildDefinition:{buildType:"https://visulima.com/vis/attest/v1",externalParameters:{workspaceRoot:s},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:t},name:r}]}),Q=async({argument:r,fs:t,logger:s,options:n,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const u=r[0];if(!u)throw new Error("Missing subject. Usage: vis attest <path-to-artifact>");const d=n.predicate??"slsaProvenance";if(d!=="slsaProvenance")throw new Error(`Unsupported predicate '${d}'. Only 'slsaProvenance' is supported.`);const a=k(u)?u:S(c,u),w=n.requireSigning??!1,l=n.format??"table";let f;try{f=await t.readFile(a)}catch{throw new Error(`Cannot read subject artifact at ${a}.`)}const p=N("sha256").update(f).digest("hex");if(!x()){const b="No ambient OIDC token (not running in CI). Keyless signing needs a Fulcio identity from CI OIDC.";if(w)throw new Error(`${b} Re-run in CI or drop --require-signing.`);if(l==="json"){process.stdout.write(`${JSON.stringify({ok:!1,reason:"no-ambient-oidc",sha256:p,skipped:!0,subject:v(a)},void 0,2)}
|
|
4
|
+
`);return}s.warn(`${b} Skipping signing (subject sha256: ${p}). Pass --require-signing to make this fatal.`);return}const i=J(v(a),p,c),g=Buffer.from(JSON.stringify(i)),o=await(await R({workspaceRoot:c})).attest(g,"application/vnd.in-toto+json"),h=n.output?k(n.output)?n.output:S(c,n.output):`${a}.sigstore`;if(await t.writeFile(h,`${JSON.stringify(o,void 0,2)}
|
|
5
5
|
`,"utf8"),l==="json"){process.stdout.write(`${JSON.stringify({bundle:h,ok:!0,sha256:p,subject:v(a)},void 0,2)}
|
|
6
|
-
`);return}
|
|
6
|
+
`);return}s.info(`Signed SLSA v1 provenance for ${v(a)} (sha256 ${p.slice(0,16)}…).`),s.info(`Bundle written to ${h}.`)};export{Q as attestEmitExecute,V as attestVerifyExecute};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{c as $,a as l,D as d,T as y}from"../packem_shared/ai-analysis-
|
|
2
|
-
`,T=(e,t=p)=>{const
|
|
1
|
+
import{c as $,a as l,D as d,T as y}from"../packem_shared/ai-analysis-D7jlbJky.js";import{O as g}from"../packem_shared/renderToString-DR0zDUjh-C7p-L6AO.js";import{q as x}from"../packem_shared/table-DDAJalPF.js";import{R as S}from"../packem_shared/registry-CkoaWkjP.js";import{j as w,F as u,q as E,J as I,b as A}from"../packem_shared/index.server-Ca_EEVfw.js";const p={command:"ai",description:"AI-assisted commands: provider detection, cache management, and failure-fix proposals."},D=e=>{if(typeof e!="function")return String(e);const{name:t}=e;return t==="Boolean"?"boolean":t==="Number"?"number":t==="String"?"string":t??"unknown"},O=e=>e===void 0?[]:Array.isArray(e)?e.map(t=>[t.name,t]):Object.entries(e),R=e=>{const t=[...e.commandPath??[],e.name].join(" "),s=(e.examples??[]).map(([n,a])=>({command:n??"",description:a??""})),o=O(e.options).map(([n,a])=>({defaultValue:a.defaultValue,description:a.description,name:n,type:D(a.type)}));return{argument:e.argument?{description:e.argument.description,name:e.argument.name}:void 0,description:e.description??"",examples:s,name:e.name,options:o,path:t}},f=(e,t=p)=>({command:t.command,description:t.description,subcommands:e.map(s=>R(s))}),P=(e,t=p)=>`${JSON.stringify(f(e,t),void 0,2)}
|
|
2
|
+
`,T=(e,t=p)=>{const s=f(e,t),o=[w(`vis ${s.command} — ${s.description}`),"",u("Subcommands:")];for(const n of s.subcommands){const a=n.argument?` ${E(`<${n.argument.name}>`)}`:"";if(o.push(""),o.push(` ${I(`vis ${n.path}`)}${a}`),n.description&&o.push(` ${n.description}`),n.options.length>0){const i=n.options.map(c=>`--${c.name}${c.type==="boolean"?"":`=<${c.type}>`}`).join(", ");o.push(u(` options: ${i}`))}if(n.examples.length>0){o.push(u(" examples:"));for(const i of n.examples){const c=i.description?u(` — ${i.description}`):"";o.push(` ${A(i.command)}${c}`)}}}return o.push(""),o.push(u(`Run \`vis ${s.command} discover-help\` for the machine-readable JSON catalogue (designed for AI agents).`)),o.push(u(`Run \`vis ${s.command} <subcommand> --help\` for full usage of a specific subcommand.`)),`${o.join(`
|
|
3
3
|
`)}
|
|
4
|
-
`},h=async()=>{const{default:e}=await import("./cli-main.js").then(t=>t.
|
|
5
|
-
`);return}const c=
|
|
4
|
+
`},h=async()=>{const{default:e}=await import("./cli-main.js").then(t=>t.an);return e.filter(t=>t.name!=="ai")},M=async()=>{const e=await h();process.stderr.write(T(e))},q=async()=>{const e=await h();process.stdout.write(P(e))},L=async({logger:e,visConfig:t})=>{const s=t?.ai,o=l(s);if(!o){e.error("No AI provider available to test."),process.exitCode=1;return}e.info(`Testing ${o.name}...`);try{const n=await y(o,"Reply with exactly: OK",{timeoutMs:3e4});e.info(`Provider ${o.name} responded: ${n.stdout.trim().slice(0,200)}`)}catch(n){const a=n instanceof Error?n.message:String(n);e.error(`Provider ${o.name} failed: ${a}`),process.exitCode=1}},V=({logger:e,options:t,visConfig:s})=>{const o=t.format??"table",n=s?.ai,a=$(),i=l(n);if(o==="json"){const r=a.map(m=>({available:m.available,method:m.detectionMethod,name:m.name,path:m.path,priority:d[m.name]??0,selected:m.name===i?.name,version:m.version}));process.stdout.write(`${JSON.stringify(r,void 0,2)}
|
|
5
|
+
`);return}const c=a.map(r=>({method:r.detectionMethod??"-",path:r.path??"-",priority:String(d[r.name]??0),provider:r.name,selected:r.name===i?.name?">>>":"",status:r.available?"available":"not found",version:r.version??"-"})),v=process.stdout.columns||80,b=g(S.createElement(x,{data:c}),{columns:v});e.info(b),i?e.info(`
|
|
6
6
|
Selected provider: ${i.name} (priority ${String(d[i.name]??0)})`):e.info(`
|
|
7
|
-
No AI provider available. Install one of the supported AI CLI tools.`)},
|
|
7
|
+
No AI provider available. Install one of the supported AI CLI tools.`)},_=async e=>{const{aiFix:t}=await import("./fix.js");await t(e)};export{q as aiDiscoverHelpExecute,_ as aiFixExecute,V as aiProvidersExecute,M as aiRootExecute,L as aiTestExecute};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createRequire as M}from"node:module";import{getAffectedProjects as H}from"@visulima/task-runner";import{d as D,b as N}from"
|
|
1
|
+
import{createRequire as M}from"node:module";import{getAffectedProjects as H}from"@visulima/task-runner";import{d as D,b as N}from"../packem_shared/registry-CkoaWkjP.js";let C;const T=e=>(C??=M(import.meta.url))(e),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[t,r]=g.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return g.getBuiltinModule(e)}return T(e)},{execFile:G}=P("node:child_process"),{promisify:V}=P("node:util"),B=V(G),q=["[skip ci]","[ci skip]","[no ci]","[vis skip]","[nx skip]"],J=["[vis deploy]","[nx deploy]"],K=["vis","nx"],L=["CACHED_COMMIT_REF","VERCEL_GIT_PREVIOUS_SHA","GITHUB_BASE_REF","CI_COMMIT_BEFORE_SHA"],U=/^[\w./~^@{}][\w.\-/~^@{}]*$/,W=(e=process.env)=>{for(const t of L){const r=e[t];if(r&&r.trim().length>0)return r.trim()}},S=e=>{if(!U.test(e))throw new Error(`Invalid git ref: "${e}". Refs must start with an alphanumeric character or one of _ . / ~ ^ @ { } and may only contain letters, digits, dots, dashes, underscores, slashes, tildes, carets, @, and braces.`)},Z=async(e,t)=>{try{return await B("git",["rev-parse","--verify",`${t}^{commit}`],{cwd:e}),!0}catch{return!1}},z=async e=>{try{const{stdout:t}=await B("git",["log","-1","--pretty=%B"],{cwd:e});return t}catch{return""}},O=(e,t,r)=>K.some(i=>e.includes(`[${i} ${t} ${r}]`)),X=(e,t)=>q.some(r=>e.includes(r))||O(e,"skip",t),Q=(e,t)=>J.some(r=>e.includes(r))||O(e,"deploy",t),f=(e,t,r,i)=>({action:"build",message:r,project:e,reason:t,...i}),y=(e,t,r,i)=>({action:"skip",message:r,project:e,reason:t,...i}),Y=e=>`${e.action==="skip"?"🛑":"✅"} ${e.message}`,ee=(e,t)=>e.action==="skip"||t?0:1,k=new Set(["deep","direct","none"]),ne=async({argument:e,logger:t,options:r,visConfig:i,workspaceRoot:l})=>{const s=e[0]??"",E=!!r.json,A=!!r.verbose,R=!!(r["exit-zero-on-build"]??r.exitZeroOnBuild),u=n=>{A&&!E&&t.info(`❱ ${n}`)},o=n=>{E?process.stdout.write(`${JSON.stringify(n)}
|
|
2
2
|
`):t.info(Y(n)),process.exit(ee(n,R))};if(!s)return o(f("","missing-project-argument","Missing project argument. Usage: vis ci ignore <project>"));if(!l)return o(f(s,"workspace-error","Could not determine workspace root — building defensively"));const m=await z(l),_=m.trim().split(`
|
|
3
3
|
`)[0]??"";if(u(`commit: ${_}`),m&&Q(m,s))return o(f(s,"commit-force-deploy",`Force-deploy keyword in commit: "${_}"`));if(m&&X(m,s))return o(y(s,"commit-skip",`Skip keyword in commit: "${_}"`));let h,v,w;try{({fileOwners:w,packageJsons:v,workspace:h}=D(l,i))}catch(n){const a=n instanceof Error?n.message:String(n);return o(f(s,"workspace-error",`Workspace discovery failed (${a}) — building defensively`))}if(!Object.hasOwn(h.projects,s))return o(f(s,"project-unknown",`Project "${s}" not found in workspace — building defensively`));try{const n=r.base?.trim(),a=W();let c=n||a||"HEAD~1";const p=r.head?.trim()||"HEAD";S(c),S(p),u(`resolved base ref: ${c} (source: ${n?"flag":a?"ci-env":"default"})`);const x=Z(l,c),F=N(l,h,v);await x||(u(`base ref ${c} not reachable — falling back to HEAD~1`),c="HEAD~1"),u(`comparing ${c}...${p}`);const b=r.downstream??"deep",j=r.upstream??"none";if(!k.has(b))throw new Error(`Invalid --downstream value: "${b}". Must be "none", "direct", or "deep".`);if(!k.has(j))throw new Error(`Invalid --upstream value: "${j}". Must be "none", "direct", or "deep".`);const I={base:c,downstream:b,fileOwners:w,head:p,ignoredFiles:i?.affectedIgnore,projectGraph:F,projects:h.projects,upstream:j,workspaceRoot:l},d=await H(I);u(`changed files: ${d.changedFiles.length}`),u(`affected projects: ${d.affectedProjects.join(", ")||"(none)"}`);const $={base:c,head:p};return d.changedFiles.length===0?o(y(s,"no-changes",`No files changed between ${c}...${p}`,{...$,affectedProjects:[]})):d.affectedProjects.includes(s)?o(f(s,"project-affected",`Build ${s}: affected by ${d.changedFiles.length} changed file(s)`,{...$,affectedProjects:d.affectedProjects})):o(y(s,"project-not-affected",`Skip ${s}: not affected by changes between ${c}...${p}`,{...$,affectedProjects:d.affectedProjects}))}catch(n){const a=n instanceof Error?n.message:String(n);return t.error(`Affected detection failed: ${a}`),o(f(s,"workspace-error",`Affected detection failed (${a}) — building defensively`))}};export{ne as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{F as p}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as l,z as k}from"../packem_shared/index-BzhrR_iC.js";import{a as y,b as h,f as w}from"../packem_shared/subtree-DtmcKAJK.js";import{n as u}from"../packem_shared/utils-DQFHJn72.js";import{
|
|
1
|
+
import{F as p}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as l,z as k}from"../packem_shared/index-BzhrR_iC.js";import{a as y,b as h,f as w}from"../packem_shared/subtree-DtmcKAJK.js";import{n as u}from"../packem_shared/utils-DQFHJn72.js";import{l as $,i as x}from"../packem_shared/registry-CkoaWkjP.js";import{y as A}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{U as b}from"../packem_shared/writeFileSync-DJoHk3Ks-BPRoepNw.js";import{p as E}from"../packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js";import{T as m}from"../packem_shared/target-merge-DVJl-7Qz.js";const P=["aube-workspace.yaml","pnpm-workspace.yaml"],v=/^\s*packages\s*:\s*$/,I=/^(\s*)-\s/,j=(c,i)=>{const s=c.includes(`\r
|
|
2
2
|
`)?`\r
|
|
3
3
|
`:`
|
|
4
|
-
`,e=c.split(/\r?\n/),n=e.findIndex(r=>v.test(r));if(n===-1)return;let t=" ";for(let r=n+1;r<e.length;r++){const o=I.exec(e[r]);if(o){t=o[1];break}if(e[r].trim().length>0)break}return e.splice(n+1,0,`${t}- "${i}"`),e.join(s)},q=(c,i,s)=>{const e=l(c,"package.json");let n;try{n=E(e)}catch{return!1}const{workspaces:t}=n;return Array.isArray(t)?t.includes(i)?!1:(s||m(e,{...n,workspaces:[...t,i]},{detectIndent:!0}),!0):t&&typeof t=="object"&&Array.isArray(t.packages)?t.packages.includes(i)?!1:(s||m(e,{...n,workspaces:{...t,packages:[...t.packages,i]}},{detectIndent:!0}),!0):!1},M=({dryRun:c=!1,prefix:i,workspaceRoot:s})=>{const e=u(i),n=$(s);if(!n)return{status:"no-config"};if(x(s,n).some(r=>u(r)===e))return{status:"already-covered"};for(const r of P){const o=l(s,r);if(!A(o))continue;const a=j(k(o),e);if(a!==void 0)return c||b(o,a),{entry:e,file:r,status:"added"}}return q(s,e,c)?{entry:e,file:"package.json",status:"added"}:{status:"no-config"}},
|
|
4
|
+
`,e=c.split(/\r?\n/),n=e.findIndex(r=>v.test(r));if(n===-1)return;let t=" ";for(let r=n+1;r<e.length;r++){const o=I.exec(e[r]);if(o){t=o[1];break}if(e[r].trim().length>0)break}return e.splice(n+1,0,`${t}- "${i}"`),e.join(s)},q=(c,i,s)=>{const e=l(c,"package.json");let n;try{n=E(e)}catch{return!1}const{workspaces:t}=n;return Array.isArray(t)?t.includes(i)?!1:(s||m(e,{...n,workspaces:[...t,i]},{detectIndent:!0}),!0):t&&typeof t=="object"&&Array.isArray(t.packages)?t.packages.includes(i)?!1:(s||m(e,{...n,workspaces:{...t,packages:[...t.packages,i]}},{detectIndent:!0}),!0):!1},M=({dryRun:c=!1,prefix:i,workspaceRoot:s})=>{const e=u(i),n=$(s);if(!n)return{status:"no-config"};if(x(s,n).some(r=>u(r)===e))return{status:"already-covered"};for(const r of P){const o=l(s,r);if(!A(o))continue;const a=j(k(o),e);if(a!==void 0)return c||b(o,a),{entry:e,file:r,status:"added"}}return q(s,e,c)?{entry:e,file:"package.json",status:"added"}:{status:"no-config"}},z=async({argument:c,fs:i,logger:s,options:e,process:n,workspaceRoot:t})=>{const r=c[0];if(!r)throw new Error("Missing <source>. Pass a git repository URL or local path to import.");if(!e.prefix)throw new Error("Missing --prefix <dir>. Pass the target directory in the monorepo (e.g. packages/tooling/foo).");const o=t??n.cwd,a=u(e.prefix),d=e.ref??"HEAD";if(y(o),await(async f=>{try{return await i.access(f),!0}catch{return!1}})(l(o,a)))throw new Error(`Target "${a}" already exists. git subtree add requires a non-existent prefix.`);if(e.dryRun){const f=e.squash?" --squash":"",g=e.message?` -m "${e.message}"`:"";s.info("Dry run — no changes will be made. Planned steps:"),s.info(` git subtree add --prefix=${a}${f}${g} ${r} ${d}`),e.register&&s.info(` register ${a} into the workspace config (skipped if already covered by an existing glob)`);return}if(h(o),s.info(`Importing ${p(r)}@${d} → ${a} ...`),w({cwd:o,message:e.message,prefix:a,ref:d,repo:r,squash:e.squash}),s.info(`✓ Imported ${r} into ${a} (history preserved).`),e.register){const f=M({prefix:a,workspaceRoot:o});f.status==="already-covered"?s.info(`✓ ${a} is already covered by an existing workspace glob.`):f.status==="added"?s.info(`✓ Registered ${f.entry} in ${f.file}.`):s.warn(`Could not auto-register ${a}: no workspace config found. Add it to pnpm-workspace.yaml or package.json#workspaces manually.`)}else s.info(p(`Skipped workspace registration (--no-register). Add ${a} to your workspace config manually.`));s.info(p("Note: project.json / nx tags are not generated. Add them if your tooling needs them."))};export{z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as I}from"../packem_shared/index-BzhrR_iC.js";import{d as O}from"
|
|
1
|
+
import{a as I}from"../packem_shared/index-BzhrR_iC.js";import{d as O}from"../packem_shared/registry-CkoaWkjP.js";import{f as D,a as x}from"../packem_shared/selectors-edwcgNl3.js";import E from"./index.js";import{k as J}from"./cli-main.js";const S=(e,t)=>{for(const l of t)if(E(l,e))return!0;return!1},q=(e,t={})=>{const{depTypes:l,excludePatterns:f,externalOnly:h,includePatterns:m,internalOnly:g}=t;if(g&&h)return[];const d=l&&l.length>0?new Set(l):void 0,k=m&&m.length>0?m:void 0,w=f&&f.length>0?f:void 0,N=[];for(const y of e)g&&!y.isInternal||h&&y.isInternal||d&&!d.has(y.depType)||k&&(!y.packageName||!S(y.packageName,k))||w&&y.packageName&&S(y.packageName,w)||N.push(y);return N},C=new Set(["json","ndjson","table"]),M=e=>{if(e===void 0)return"table";const t=e.toLowerCase();if(!C.has(t))throw new Error(`--format must be one of: table, json, ndjson (got "${e}")`);return t},P=(e,t)=>({depName:e.depName,depType:e.depType,isInternal:e.isInternal,packageDir:e.packageDir,packageJsonPath:I(t,e.packageJsonPath),packageName:e.packageName,specifier:e.specifier}),$=new Set(["dependencies","devDependencies","optionalDependencies","overrides","peerDependencies","pnpm.overrides","resolutions"]),A=e=>{if(!e||e.length===0)return;const t=[],l=[];for(const f of e)for(const h of f.split(",")){const m=h.trim();m&&($.has(m)?t.push(m):l.push(m))}if(l.length>0)throw new Error(`Unknown --dep-type value(s): ${l.join(", ")}. Valid: ${[...$].join(", ")}`);return t.length>0?t:void 0},V=async({logger:e,options:t,visConfig:l,workspaceRoot:f})=>{if(!f)throw new Error("Could not determine workspace root.");const h=M(t.json&&t.format===void 0?"json":t.format);if(t.deps){if(t.internalOnly&&t.externalOnly)throw new Error("--internal-only and --external-only are mutually exclusive");const p=A(t.depType),c=J(f);let r=q(c,{depTypes:p,excludePatterns:t.exclude,externalOnly:t.externalOnly,includePatterns:t.include,internalOnly:t.internalOnly});if(t.query||t.tag&&t.tag.length>0){const{workspace:n}=O(f,l),i=D(Object.keys(n.projects),n,t.query),T=new Set(x(i,n,t.tag));r=r.filter(v=>v.packageName!==void 0&&T.has(v.packageName))}const u=[...r].sort((n,i)=>{const T=`${n.packageName??n.packageDir} ${n.depType} ${n.depName}`,v=`${i.packageName??i.packageDir} ${i.depType} ${i.depName}`;return T.localeCompare(v)});if(h==="ndjson"){for(const n of u)e.info(JSON.stringify(P(n,f)));return}if(h==="json"){const n=u.map(i=>P(i,f));e.info(JSON.stringify(n,null,t.pretty?2:void 0));return}if(u.length===0){e.info("No matching dep-instances.");return}const o=["Package","Block","Dep","Specifier","Internal","Path"],a=u.map(n=>[n.packageName??n.packageDir,n.depType,n.depName,n.specifier,n.isInternal?"yes":"no",I(f,n.packageJsonPath)]),s=o.map((n,i)=>Math.max(n.length,...a.map(T=>(T[i]??"").length))),j=(n,i)=>n.padEnd(i);e.info(o.map((n,i)=>j(n,s[i])).join(" ")),e.info(s.map(n=>"─".repeat(n)).join("──"));for(const n of a)e.info(n.map((i,T)=>j(i,s[T])).join(" "));e.info(""),e.info(`${String(u.length)} dep-instance(s)`);return}if(h==="ndjson")throw new Error("--format=ndjson is only supported with --deps");const{projectOptions:m,workspace:g}=O(f,l);let d=Object.keys(g.projects).sort();if(t.query&&(d=D(d,g,t.query)),d=x(d,g,t.tag),d.length===0){e.info("No projects found.");return}const k=t.inferred,w=t.targets||k;if(h==="json"){const p=d.map(c=>{const r=g.projects[c],u=m.get(c)??{},o=Object.entries(r.targets??{}).map(([a])=>{const s=u[a],j=s?.inferred===!0;return{aliases:s?.aliases??[],command:s?.command,description:s?.description,...j?{inferred:!0}:{},name:a,type:s?.type}}).filter(a=>!k||a.inferred===!0);return{language:r.language,layer:r.layer,name:c,root:r.root,stack:r.stack,tags:r.tags??[],targets:o,type:r.projectType??"library"}});e.info(JSON.stringify(p,null,2));return}const N=(p,c)=>{const r=p.map((o,a)=>{let s=0;for(const j of c)s=Math.max(s,(j[a]??"").length);return Math.max(o.length,s)}),u=(o,a)=>o.padEnd(a);e.info(p.map((o,a)=>u(o,r[a])).join(" ")),e.info(r.map(o=>"─".repeat(o)).join("──"));for(const o of c)e.info(o.map((a,s)=>u(a,r[s])).join(" "))};if(w){const p=[];for(const c of d){const r=g.projects[c],u=m.get(c)??{};for(const o of Object.keys(r.targets??{}).sort()){const a=u[o],s=a?.inferred===!0;if(k&&!s)continue;const j=r.targets?.[o],n=j?.cache===!1?"no":j?.cache===!0?"yes":"default";p.push([c,o,a?.type??"—",n,s?"yes":"no",a?.description??"—"])}}if(p.length===0){e.info(k?"No inferred targets found.":"No targets found.");return}N(["Project","Target","Type","Cache","Inferred","Description"],p),e.info(""),e.info(`${String(p.length)} target(s) across ${String(d.length)} project(s)`);return}const y=["Project","Type","Layer","Tags","Targets"],b=d.map(p=>{const c=g.projects[p],r=Object.keys(c.targets??{});return[p,c.projectType??"library",c.layer??"—",(c.tags??[]).join(", ")||"—",r.length>4?`${r.slice(0,4).join(", ")}… (${String(r.length)})`:r.join(", ")||"—"]});N(y,b),e.info(""),e.info(`${String(d.length)} project(s)`)};export{V as default};
|