@visulima/vis 1.0.0-alpha.44 → 1.0.0-alpha.45
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 +51 -0
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +63 -62
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +172 -973
- package/dist/packem_chunks/detect.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +2 -2
- 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/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler5.js +3 -3
- package/dist/packem_chunks/handler50.js +4 -4
- package/dist/packem_chunks/handler51.js +3 -3
- package/dist/packem_chunks/handler57.js +4 -4
- package/dist/packem_chunks/handler58.js +1 -1
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +6 -6
- package/dist/packem_chunks/handler60.js +1 -1
- package/dist/packem_chunks/handler61.js +1 -1
- package/dist/packem_chunks/handler62.js +2 -2
- package/dist/packem_chunks/handler63.js +4 -4
- package/dist/packem_chunks/handler65.js +2 -2
- package/dist/packem_chunks/handler66.js +13 -13
- package/dist/packem_chunks/handler67.js +5 -5
- package/dist/packem_chunks/handler68.js +16 -16
- package/dist/packem_chunks/handler69.js +5 -5
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler71.js +1 -1
- package/dist/packem_chunks/handler72.js +2 -2
- package/dist/packem_chunks/handler73.js +13 -13
- package/dist/packem_chunks/handler74.js +3 -3
- package/dist/packem_chunks/handler75.js +3 -3
- package/dist/packem_chunks/handler76.js +5 -5
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index2.js +802 -7
- package/dist/packem_chunks/index3.js +7 -135
- package/dist/packem_chunks/index4.js +134 -73
- package/dist/packem_chunks/index5.js +74 -0
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/print-config.js +1 -1
- package/dist/packem_chunks/registry.js +2 -2
- package/dist/packem_chunks/shell-runner.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +2 -2
- package/dist/packem_chunks/ts-loader.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_chunks/version-resolver.js +2 -2
- package/dist/packem_shared/{Table-CcVkyULl-DLWu6XHL.js → Table-BGIHvenQ-D2oJtNQj.js} +1 -1
- package/dist/packem_shared/affected-shas-CCxG4tvm.js +1 -0
- package/dist/packem_shared/{ai-analysis-CO6S0afy.js → ai-analysis-rC48NLfB.js} +4 -4
- package/dist/packem_shared/{ai-fix-CI0Vvqld.js → ai-fix-D_ijV3Rn.js} +3 -3
- package/dist/packem_shared/bin-CPMo34SM.js +1 -0
- package/dist/packem_shared/{command-runtime-BE-vKsGH.js → command-runtime-3FTGuUsK.js} +1 -1
- package/dist/packem_shared/{env-C2ZCnfP_.js → env-Ct3hMEYB.js} +1 -1
- package/dist/packem_shared/{failure-log-jFfZRJK9.js → failure-log-Dy2G-rKi.js} +1 -1
- package/dist/packem_shared/{index-CQjzW7m8.js → index-Cntyu-w8.js} +1 -1
- package/dist/packem_shared/{index-D7EZ612R.js → index-XAb0QGqA.js} +1 -1
- package/dist/packem_shared/{lifecycle-Dyb47wbD.js → lifecycle-CHcFuWf_.js} +1 -1
- package/dist/packem_shared/{osv-bloom-BsQ-aFiM.js → osv-bloom-DVMlkcAO.js} +2 -2
- package/dist/packem_shared/{packument-DquNPIq9.js → packument-C-A3Uhhx.js} +1 -1
- package/dist/packem_shared/pm-runner-CQcraCcu.js +1 -0
- package/dist/packem_shared/{provenance-DIq8KyBV.js → provenance-R2csDSNg.js} +1 -1
- package/dist/packem_shared/{registry-keys-C8K11ets.js → registry-keys-CMnS_Qt_.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-Dr4kIybR.js → resolve-explicit-C4oQMyoB.js} +1 -1
- package/dist/packem_shared/resolve-runtime-QRaQucfL.js +1 -0
- package/dist/packem_shared/{s1ngularity-CtMmtXJo.js → s1ngularity-BCDt28u0.js} +1 -1
- package/dist/packem_shared/scan-progress-YRpDs90j.js +2 -0
- package/dist/packem_shared/{signatures-CE8OAK-i.js → signatures-B3srzCEv.js} +1 -1
- package/dist/packem_shared/use-measured-height-DHi0xOPO.js +1 -0
- package/dist/packem_shared/{vis-update-app-Cpme_3Du.js → vis-update-app-B3I14Vfy.js} +1 -1
- package/index.js +52 -52
- package/package.json +11 -11
- package/dist/packem_shared/affected-shas-CwRY5aoc.js +0 -1
- package/dist/packem_shared/bin-P6Q5tKrP.js +0 -1
- package/dist/packem_shared/pm-runner-D4jM58Oz.js +0 -1
- package/dist/packem_shared/resolve-runtime-Tx0bvg0h.js +0 -1
- package/dist/packem_shared/scan-progress-D4yywI6P.js +0 -2
- package/dist/packem_shared/use-measured-height-XK9YSwtv.js +0 -1
- package/dist/packem_shared/window-ops-DDePlWLV.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{createRequire as N}from"node:module";import S from"./index.js";import{VisReleaseError as u}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const A=N(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=c=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,s]=h.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return h.getBuiltinModule(c)}return A(c)},{readFile:b,rename:x,readdir:L}=v("node:fs/promises"),{isAbsolute:k,join:o,basename:C}=v("node:path");class m{constructor(t){this.runner=t}runner;async publishNative(t){throw new u({code:"CONFIG_INVALID",hint:'Set publish.publishStrategy back to "npm-publish-tarball" (the default), or use a package manager whose adapter implements native publish.',message:`publishStrategy "native" is not supported by the "${this.id}" adapter.`})}async readCatalogYaml(t){}}const f=(c,t)=>{if(c.exitCode===0)return{output:c.stdout,published:!0};const s=`${c.stdout}
|
|
2
2
|
${c.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(s))return{alreadyPublished:!0,output:s,published:!1};throw new u({code:"PUBLISH_FAILED",message:`${t} failed: ${s}`})};class g extends m{id="npm";minVersion="11.5.1";async pack(t){const s=["pack","--json"];t.destination&&s.push("--pack-destination",t.destination);const e=await this.runner.run("npm",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`npm pack failed: ${e.stderr||e.stdout}`});const a=JSON.parse(e.stdout),n=a[0]?.filename;if(!n)throw new u({code:"PUBLISH_FAILED",hint:"Upgrade npm to a version that emits --json output, or report this with the raw stdout.",message:`npm pack: could not parse output: ${e.stdout}`});const r=t.destination??t.cwd;let i=k(n)?n:o(r,n);return t.filename&&(await(await import("node:fs/promises")).rename(i,o(r,t.filename)),i=o(r,t.filename)),{raw:a,tarball:i}}async installLockfileOnly(t){const s=await this.runner.run("npm",["install","--package-lock-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`npm install --package-lock-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("npm",["query",".workspace","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];try{return JSON.parse(s.stdout).filter(e=>typeof e.name=="string").map(e=>({name:e.name,path:e.path??e.location??t,private:e.private??!1,version:e.version??"0.0.0"}))}catch{return[]}}async publish(t){const s=t.stage?["stage","publish",t.tarball]:["publish",t.tarball];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance"),t.stage&&s.push("--json");for(const n of t.extraArgs??[])s.push(n);const e=await this.runner.run("npm",s,{cwd:process.cwd(),silent:!0});if(e.exitCode===0){const n={output:e.stdout,published:!0};if(t.stage)try{const r=JSON.parse(e.stdout);n.stageId=r.id??r.stageId}catch{}return n}const a=`${e.stdout}
|
|
3
|
-
${e.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(a))return{alreadyPublished:!0,output:a,published:!1};throw new u({code:"PUBLISH_FAILED",message:`npm publish failed: ${a}`})}async publishNative(t){const s=["publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("npm",s,{cwd:t.cwd,silent:!0});return f(e,"npm publish")}async detectVersion(t){const s=await this.runner.run("npm",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}class _ extends m{id="bun";minVersion="1.1.36";async pack(t){const s=["pm","pack"];t.destination&&s.push("--destination",t.destination);const e=await this.runner.run("bun",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`bun pm pack failed: ${e.stderr||e.stdout}`});const a=/(?:^|["'\s])([^\s"']*\.tgz)/m.exec(e.stdout),n=t.destination??t.cwd;let r;if(a?.[1]){const i=a[1];r=k(i)?i:o(n,i)}else{const i=JSON.parse(await b(o(t.cwd,"package.json"),"utf8")),d=(i.name??"package").replaceAll("/","-").replace(/^@/,"");r=o(n,`${d}-${i.version??"0.0.0"}.tgz`)}if(t.filename&&C(r)!==t.filename){const i=o(n,t.filename);await x(r,i),r=i}return{raw:e.stdout,tarball:r}}async installLockfileOnly(t){const s=await this.runner.run("bun",["install","--lockfile-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`bun install --lockfile-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){try{const s=JSON.parse(await b(o(t,"package.json"),"utf8")),e=Array.isArray(s.workspaces)?s.workspaces:s.workspaces?.packages??[];if(e.length===0)return[];const a=new Set,n=["."],r=5,i=new Set;for(;n.length>0;){const p=n.shift();if(i.has(p)||(i.add(p),(p==="."?0:p.split("/").length)>r))continue;let w;try{w=await L(o(t,p),{withFileTypes:!0})}catch{continue}for(const l of w){if(!l.isDirectory()||l.name==="node_modules"||l.name.startsWith("."))continue;const y=p==="."?l.name:`${p}/${l.name}`;e.some(I=>S(I,y))&&a.add(y),n.push(y)}}const d=[];for(const p of a){const w=o(t,p,"package.json");try{const l=JSON.parse(await b(w,"utf8"));if(typeof l.name!="string")continue;d.push({name:l.name,path:o(t,p),private:l.private??!1,version:l.version??"0.0.0"})}catch{}}return d}catch{return[]}}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry);for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("bun",s,{cwd:t.cwd,silent:!0});return f(e,"bun publish")}async detectVersion(t){const s=await this.runner.run("bun",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}class O extends m{id="pnpm";minVersion="9.5.0";async pack(t){const s=["pack","--json"];t.destination&&s.push("--pack-destination",t.destination);const e=await this.runner.run("pnpm",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`pnpm pack failed: ${e.stderr||e.stdout}`});const a=JSON.parse(e.stdout),{filename:n}=a;if(!n)throw new u({code:"PUBLISH_FAILED",message:`pnpm pack: could not parse output: ${e.stdout}`});const r=t.destination??t.cwd;let i=k(n)?n:o(r,n);return t.filename&&(await(await import("node:fs/promises")).rename(i,o(r,t.filename)),i=o(r,t.filename)),{raw:a,tarball:i}}async installLockfileOnly(t){const s=await this.runner.run("pnpm",["install","--lockfile-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`pnpm install --lockfile-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("pnpm",["-r","ls","--depth","-1","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];try{return JSON.parse(s.stdout).filter(e=>typeof e.name=="string").map(e=>({name:e.name,path:e.path??t,private:e.private??!1,version:e.version??"0.0.0"}))}catch{return[]}}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["publish","--no-git-checks"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("pnpm",s,{cwd:t.cwd,silent:!0});return f(e,"pnpm publish")}async detectVersion(t){const s=await this.runner.run("pnpm",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}async readCatalogYaml(t){const s=await import("node:fs/promises");try{return await s.readFile(o(t,"pnpm-workspace.yaml"),"utf8")}catch{return}}}class $ extends m{id="yarn";minVersion="4.0.0";async pack(t){const s=t.destination??t.cwd,e=t.filename??"%s-%v.tgz",a=["pack","--out",o(s,e)],n=await this.runner.run("yarn",a,{cwd:t.cwd,silent:!0});if(n.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`yarn pack failed: ${n.stderr||n.stdout}`});const r=await import("node:fs/promises"),i=await import("node:path"),d=JSON.parse(await r.readFile(i.join(t.cwd,"package.json"),"utf8")),p=e.replaceAll("%s",(d.name??"package").replaceAll("/","-").replace(/^@/,"")).replaceAll("%v",d.version??"0.0.0");return{raw:n.stdout,tarball:o(s,p)}}async installLockfileOnly(t){const s=await this.runner.run("yarn",["install","--mode","update-lockfile"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`yarn install --mode update-lockfile failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("yarn",["workspaces","list","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];const e=[];for(const a of s.stdout.split(/\r?\n/)){const n=a.trim();if(n)try{const r=JSON.parse(n);if(typeof r.name!="string"||r.name==="")continue;e.push({name:r.name,path:r.location?o(t,r.location):t,private:!1,version:"0.0.0"})}catch{}}return e}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["npm","publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("yarn",s,{cwd:t.cwd,silent:!0});return f(e,"yarn npm publish")}async detectVersion(t){const s=await this.runner.run("yarn",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}const D=async(c,t)=>{const s=await import("node:fs/promises"),e=await import("node:path");try{const n=JSON.parse(await s.readFile(e.join(c,"package.json"),"utf8"));if(typeof n.packageManager=="string"){const r=n.packageManager.indexOf("@"),i=r>0?n.packageManager.slice(0,r):n.packageManager;if(i==="pnpm"||i==="yarn"||i==="bun"||i==="npm")return i}}catch{}const a=async n=>{try{return await s.access(e.join(c,n)),!0}catch{return!1}};return await a("bun.lock")||await a("bun.lockb")?"bun":await a("pnpm-lock.yaml")?"pnpm":await a("yarn.lock")?"yarn":"npm"},V=(c,t)=>{switch(c){case"bun":return new _(t);case"pnpm":return new O(t);case"yarn":return new $(t);default:return new g(t)}};export{g as N,V as c,D as d};
|
|
3
|
+
${e.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(a))return{alreadyPublished:!0,output:a,published:!1};throw new u({code:"PUBLISH_FAILED",message:`npm publish failed: ${a}`})}async publishNative(t){const s=["publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("npm",s,{cwd:t.cwd,silent:!0});return f(e,"npm publish")}async detectVersion(t){const s=await this.runner.run("npm",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}class _ extends m{id="bun";minVersion="1.1.36";async pack(t){const s=["pm","pack"];t.destination&&s.push("--destination",t.destination);const e=await this.runner.run("bun",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`bun pm pack failed: ${e.stderr||e.stdout}`});const a=/(?:^|["'\s])([^\s"']*\.tgz)/m.exec(e.stdout),n=t.destination??t.cwd;let r;if(a?.[1]){const i=a[1];r=k(i)?i:o(n,i)}else{const i=JSON.parse(await b(o(t.cwd,"package.json"),"utf8")),d=(i.name??"package").replaceAll("/","-").replace(/^@/,"");r=o(n,`${d}-${i.version??"0.0.0"}.tgz`)}if(t.filename&&C(r)!==t.filename){const i=o(n,t.filename);await x(r,i),r=i}return{raw:e.stdout,tarball:r}}async installLockfileOnly(t){const s=await this.runner.run("bun",["install","--lockfile-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`bun install --lockfile-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){try{const s=JSON.parse(await b(o(t,"package.json"),"utf8")),e=Array.isArray(s.workspaces)?s.workspaces:s.workspaces?.packages??[];if(e.length===0)return[];const a=new Set,n=["."],r=5,i=new Set;for(;n.length>0;){const p=n.shift();if(i.has(p)||(i.add(p),(p==="."?0:p.split("/").length)>r))continue;let w;try{w=await L(o(t,p),{withFileTypes:!0})}catch{continue}for(const l of w){if(!l.isDirectory()||l.name==="node_modules"||l.name.startsWith("."))continue;const y=p==="."?l.name:`${p}/${l.name}`;e.some(I=>S(I,y))&&a.add(y),n.push(y)}}const d=[];for(const p of a){const w=o(t,p,"package.json");try{const l=JSON.parse(await b(w,"utf8"));if(typeof l.name!="string")continue;d.push({name:l.name,path:o(t,p),private:l.private??!1,version:l.version??"0.0.0"})}catch{}}return d}catch{return[]}}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry);for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("bun",s,{cwd:t.cwd,silent:!0});return f(e,"bun publish")}async detectVersion(t){const s=await this.runner.run("bun",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}class O extends m{id="pnpm";minVersion="9.5.0";async pack(t){const s=["pack","--json"];t.destination&&s.push("--pack-destination",t.destination);const e=await this.runner.run("pnpm",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`pnpm pack failed: ${e.stderr||e.stdout}`});const a=JSON.parse(e.stdout),{filename:n}=a;if(!n)throw new u({code:"PUBLISH_FAILED",message:`pnpm pack: could not parse output: ${e.stdout}`});const r=t.destination??t.cwd;let i=k(n)?n:o(r,n);return t.filename&&(await(await import("node:fs/promises")).rename(i,o(r,t.filename)),i=o(r,t.filename)),{raw:a,tarball:i}}async installLockfileOnly(t){const s=await this.runner.run("pnpm",["install","--lockfile-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`pnpm install --lockfile-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("pnpm",["-r","ls","--depth","-1","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];try{return JSON.parse(s.stdout).filter(e=>typeof e.name=="string").map(e=>({name:e.name,path:e.path??t,private:e.private??!1,version:e.version??"0.0.0"}))}catch{return[]}}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["publish","--no-git-checks"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("pnpm",s,{cwd:t.cwd,silent:!0});return f(e,"pnpm publish")}async detectVersion(t){const s=await this.runner.run("pnpm",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}async readCatalogYaml(t){const s=await import("node:fs/promises");try{return await s.readFile(o(t,"pnpm-workspace.yaml"),"utf8")}catch{return}}}class $ extends m{id="yarn";minVersion="4.0.0";async pack(t){const s=t.destination??t.cwd,e=t.filename??"%s-%v.tgz",a=["pack","--out",o(s,e)],n=await this.runner.run("yarn",a,{cwd:t.cwd,silent:!0});if(n.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`yarn pack failed: ${n.stderr||n.stdout}`});const r=await import("node:fs/promises"),i=await import("node:path"),d=JSON.parse(await r.readFile(i.join(t.cwd,"package.json"),"utf8")),p=e.replaceAll("%s",(d.name??"package").replaceAll("/","-").replace(/^@/,"")).replaceAll("%v",d.version??"0.0.0");return{raw:n.stdout,tarball:o(s,p)}}async installLockfileOnly(t){const s=await this.runner.run("yarn",["install","--mode","update-lockfile"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`yarn install --mode update-lockfile failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("yarn",["workspaces","list","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];const e=[];for(const a of s.stdout.split(/\r?\n/)){const n=a.trim();if(n)try{const r=JSON.parse(n);if(typeof r.name!="string"||r.name==="")continue;e.push({name:r.name,path:r.location?o(t,r.location):t,private:!1,version:"0.0.0"})}catch{}}return e}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["npm","publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("yarn",s,{cwd:t.cwd,silent:!0});return f(e,"yarn npm publish")}async detectVersion(t){const s=await this.runner.run("yarn",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}const D=async(c,t)=>{const s=await import("node:fs/promises"),e=await import("node:path");try{const n=JSON.parse(await s.readFile(e.join(c,"package.json"),"utf8"));if(typeof n.packageManager=="string"){const r=n.packageManager.indexOf("@"),i=r>0?n.packageManager.slice(0,r):n.packageManager;if(i==="pnpm"||i==="yarn"||i==="bun"||i==="npm")return i}}catch{}const a=async n=>{try{return await s.access(e.join(c,n)),!0}catch{return!1}};return await a("bun.lock")||await a("bun.lockb")?"bun":await a("pnpm-lock.yaml")||await a("pnpm-workspace.yaml")?"pnpm":await a("yarn.lock")?"yarn":"npm"},V=(c,t)=>{switch(c){case"bun":return new _(t);case"pnpm":return new O(t);case"yarn":return new $(t);default:return new g(t)}};export{g as N,V as c,D as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as F}from"node:module";import{j as w,E as k,s as b,q as T,V as I,I as j}from"../packem_shared/index.server-J83sowC4.js";import{y as R}from"../packem_shared/index-CE6MsgcV.js";import{a as J,r as D,b as m,c as E}from"../packem_shared/ai-fix-
|
|
1
|
+
import{createRequire as F}from"node:module";import{j as w,E as k,s as b,q as T,V as I,I as j}from"../packem_shared/index.server-J83sowC4.js";import{y as R}from"../packem_shared/index-CE6MsgcV.js";import{a as J,r as D,b as m,c as E}from"../packem_shared/ai-fix-D_ijV3Rn.js";import{p}from"./cli-main.js";import{l as N}from"../packem_shared/failure-log-Dy2G-rKi.js";const A=F(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=o=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,r]=h.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return h.getBuiltinModule(o)}return A(o)},{createInterface:q}=O("node:readline"),B={"ambiguous-match":"ambiguous match",applied:"applied",error:"error","missing-file":"missing file","no-match":"no match","outside-workspace":"outside workspace"},S=(o,t,r)=>{const e=E(o,t,r),s=R(o,e);return s===""||s.startsWith("..")?e:s},L=(o,t,r)=>{const e=[w(`Fix proposal (${o.provider}, confidence: ${o.confidence})`),"",o.explanation||k("<no explanation>")];if(o.cannotFix)return e.push(""),e.push(b(`Cannot fix automatically: ${o.cannotFix}`)),e.join(`
|
|
2
2
|
`);if(o.patches.length===0)return e.push(""),e.push(b("No patches were proposed.")),e.join(`
|
|
3
3
|
`);e.push(""),e.push(w(`Patches (${String(o.patches.length)}):`));for(const[s,i]of o.patches.entries()){const a=S(t,r,i.file);e.push(""),e.push(T(`[${String(s+1)}] ${a}`)),i.reason&&e.push(k(` reason: ${i.reason}`));for(const u of i.oldString.split(`
|
|
4
4
|
`))e.push(I(` - ${u}`));for(const u of i.newString.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{L as v,h,N as u}from"../packem_shared/pm-runner-CQcraCcu.js";import{r as w,a as C}from"../packem_shared/command-runtime-3FTGuUsK.js";import{i as R}from"../packem_shared/utils-CRueU43T.js";const b=async({argument:f,logger:l,options:e,rawUnknown:m,visConfig:s,workspaceRoot:d})=>{const a=f;if(!a||a.length===0)throw new Error("No command specified. Usage: vis exec <command> [args...]");const[n,...c]=a,t=m??[],i=t[0]==="--"?c:[...c,...t],o=d??process.cwd(),p=R(e.filter);let r=!e.recursive&&!e.workspaceRoot&&!e.parallel&&!e.reverse&&!e.shellMode&&p.length===0?v(n,i,o):null;if(r===null){const g=w({logger:l,options:e,visConfig:s},o),k=h(o,{backend:C(g),configBackend:s?.install?.backend,configCorepack:s?.install?.corepack});r=u(k,{args:i,command:n,filter:p,parallel:e.parallel||!1,recursive:e.recursive||!1,reverse:e.reverse||!1,shellMode:e.shellMode||!1,workspaceRoot:e.workspaceRoot||!1},o,l)}r!==0&&(process.exitCode=r)};export{b as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as g}from"node:module";import{f as l,v as d,m as r,T as w}from"../packem_shared/index-CE6MsgcV.js";import{b as y}from"../packem_shared/env-
|
|
1
|
+
import{createRequire as g}from"node:module";import{f as l,v as d,m as r,T as w}from"../packem_shared/index-CE6MsgcV.js";import{b as y}from"../packem_shared/env-Ct3hMEYB.js";const v=g(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=o=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[n,i]=t.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return t.getBuiltinModule(o)}return v(o)},{homedir:s}=u("node:os"),{createInterface:_}=u("node:readline"),c=y(),m=[r(s(),".zshrc"),r(s(),".zshenv"),r(s(),".bashrc"),r(s(),".bash_profile"),r(s(),".profile"),r(s(),".config","fish","config.fish")],b=o=>{const n=[];for(const i of m)if(l(i))try{const f=d(i).split(`
|
|
2
2
|
`),a=f.filter(e=>!e.includes(".vis/bin")&&!e.includes("VIS_HOME")&&!e.includes("# vis "));a.length!==f.length&&(w(i,a.join(`
|
|
3
3
|
`)),n.push(i))}catch{o.warn(`warning: could not clean ${i}`)}return n},q=async({fs:o,logger:n,options:i})=>{if(!l(c)){n.info("vis is not installed (no ~/.vis directory found).");return}n.info("This will remove:"),n.info(` ${c}/`);const f=m.filter(e=>l(e)&&d(e).includes(".vis"));for(const e of f)n.info(` Lines in ${e}`);if(!i.yes){if(!process.stdin.isTTY)throw new Error("Non-interactive terminal. Use --yes to confirm.");const e=_({input:process.stdin,output:process.stdout}),p=await new Promise(h=>{e.question(`
|
|
4
4
|
Type "uninstall" to confirm: `,h)});if(e.close(),p.trim()!=="uninstall"){n.info("Aborted.");return}}const a=b(n);for(const e of a)n.info(`Cleaned ${e}`);try{await o.rm(c,{force:!0,recursive:!0}),n.info(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as f,a as d}from"../packem_shared/pm-runner-CQcraCcu.js";import{r as k,a as m}from"../packem_shared/command-runtime-3FTGuUsK.js";const h=async({argument:o,logger:s,options:i,process:c,visConfig:e,workspaceRoot:r})=>{if(!o||o.length===0)throw new Error("No package specified. Usage: vis info <package> [field...]");const[t,...l]=o,a=r??c.cwd,p=k({logger:s,options:i,visConfig:e},a),g=f(a,{backend:m(p),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),n=d(g,{fields:l,json:i.json||!1,package:t},a,s);n!==0&&n!==1&&(process.exitCode=n)};export{h as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as D}from"node:module";import{m,y as B,f as $,T as b}from"../packem_shared/index-CE6MsgcV.js";import{findVisConfigFile as F,DEFAULT_MIN_RELEASE_AGE_MINUTES as h}from"./CONFIG_FILES.js";import{p as e}from"./cli-main.js";import{
|
|
1
|
+
import{createRequire as D}from"node:module";import{m,y as B,f as $,T as b}from"../packem_shared/index-CE6MsgcV.js";import{findVisConfigFile as F,DEFAULT_MIN_RELEASE_AGE_MINUTES as h}from"./CONFIG_FILES.js";import{p as e}from"./cli-main.js";import{A as I}from"../packem_shared/pm-runner-CQcraCcu.js";import{w as P}from"../packem_shared/build-scripts-MTSK6TNr.js";import{O as E}from"../packem_shared/native-config-sync-BFDVK9LH.js";import{S as R}from"../packem_shared/min-release-age-C71MO72F.js";const N=D(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=t=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[s,o]=g.versions.node.split(".").map(Number);if(s>22||s===22&&o>=3||s===20&&o>=16)return g.getBuiltinModule(t)}return N(t)},{execFileSync:M}=T("node:child_process"),{createInterface:O}=T("node:readline"),G=t=>{const s=[];return $(m(t,"turbo.json"))&&s.push("turborepo"),$(m(t,"nx.json"))&&s.push("nx"),$(m(t,".moon"))&&s.push("moon"),s},x=(t,s)=>new Promise(o=>{t.question(s,i=>{o(i.trim())})}),u=async(t,s,o=!0)=>{const i=await x(t,`${s} ${o?"[Y/n]":"[y/N]"} `);return i===""?o:i.toLowerCase()==="y"||i.toLowerCase()==="yes"},w=(t,s)=>{const o=[],i=Object.entries(s.allowBuilds).filter(([,l])=>l).map(([l])=>` "${l}": true,`).join(`
|
|
2
2
|
`),a=[` installScripts: {
|
|
3
3
|
allow: ${i?`{
|
|
4
4
|
${i}
|
|
@@ -24,4 +24,4 @@ ${o.join(`
|
|
|
24
24
|
`},q=async(t,s,o)=>{const i=O({input:process.stdin,output:process.stdout});e.info(`
|
|
25
25
|
vis init — interactive setup
|
|
26
26
|
`);const a=await u(i," Enable Socket.dev security scanning?");a&&(e.success(" Socket.dev enabled — scores, alerts, and supply chain data active."),process.env.VIS_SOCKET_TOKEN||e.notice(" Set VIS_SOCKET_TOKEN for a custom API token (optional).")),e.info("");const n=await u(i," Enable Google deps.dev (OpenSSF Scorecard + GHSA advisories)?");n&&e.success(" deps.dev enabled — Scorecard signals and advisories merged into the security report."),e.info("");const l=await u(i," Scan for packages with build scripts?"),p={};if(l){e.info(" Scanning node_modules...");const c=P(t,{});if(c.length>0){e.info(` Found ${String(c.length)} package${c.length===1?"":"s"} with build scripts:
|
|
27
|
-
`);for(const r of c){const f=await u(i,` Allow ${r}?`,!1),_=r.split(" (")[0]??r;p[_]=f,f&&e.success(` ✓ ${_} approved`)}}else e.info(" No packages with build scripts found.")}e.info("");const
|
|
27
|
+
`);for(const r of c){const f=await u(i,` Allow ${r}?`,!1),_=r.split(" (")[0]??r;p[_]=f,f&&e.success(` ✓ ${_} approved`)}}else e.info(" No packages with build scripts found.")}e.info("");const A=await u(i," Enforce a minimum release age (block freshly-published versions)?");let d;if(A){const c=await x(i,` Minimum age in minutes (default ${String(h)} = 2 days): `),r=c===""?h:Number.parseInt(c,10);d=Number.isFinite(r)&&r>0?r:h,e.success(` minimumReleaseAge: ${String(d)} minutes`)}e.info("");const y=await u(i," Set up pre-commit hooks (lint-staged)?",!1);let S=!1;(s.name==="pnpm"||s.name==="yarn"||s.name==="npm"||s.name==="bun")&&(e.info(""),S=await u(i,` Sync security settings to ${s.name} config?`));const v=G(t);if(v.length>0&&(e.info(""),e.info(` Detected existing tools: ${v.join(", ")}`),await u(i,` Run \`vis migrate\` for ${v.join(", ")}?`,!1))){i.close();const[c,...r]=s.name==="pnpm"?["pnpm","exec"]:s.name==="yarn"?["yarn","exec"]:s.name==="bun"?["bunx"]:["npx"];for(const f of v){e.info(` Migrating from ${f}...`);try{M(c,[...r,"vis","migrate",f],{cwd:t,stdio:"inherit"})}catch{e.warn(` Migration from ${f} had issues — run \`vis migrate ${f}\` manually.`)}}if($(o))e.success(`Migrated config written to ${o}`);else{const f=w(s.name,{allowBuilds:p,enableDepsDev:n,enableSocket:a,minimumReleaseAge:d,staged:y});b(o,f),e.success(`Created ${o}`)}e.notice(" Run 'vis doctor' to see your project's full health status.");return}i.close(),e.info("");const C=w(s.name,{allowBuilds:p,enableDepsDev:n,enableSocket:a,minimumReleaseAge:d,staged:y});if(b(o,C),e.success(`Created ${o}`),S){const c=Object.fromEntries(Object.entries(p).filter(([,r])=>r));for(const r of E(s.name,t,c))e.success(` ${r}`);for(const r of R(s.name,t,d))e.success(` ${r}`)}e.info(""),e.info(" Setup complete. Your config:");const j=[a&&"Socket.dev",n&&"deps.dev"].filter(Boolean);e.info(` Security: ${j.length>0?`${j.join(" + ")} enabled`:"defaults only"}`),e.info(` Build scripts: ${Object.values(p).filter(Boolean).length} approved`),e.info(` Min age: ${d===void 0?"not enforced":`${String(d)} minutes`}`),e.info(` Git hooks: ${y?"lint-staged configured":"not configured"}`),e.info(` PM sync: ${S?"done":"skipped"}`),e.info(""),e.notice(" Run 'vis doctor' to see your project's full health status."),e.info("")},K=(t,s,o,i)=>{const a=w(s.name,{allowBuilds:{},enableDepsDev:!1,enableSocket:!1,minimumReleaseAge:h,staged:!1});if(b(i,a),e.success(`Created ${i}`),e.info(" Secure defaults are applied automatically by defineConfig()."),o.syncNative){for(const n of E(s.name,t,{}))e.success(` ${n}`);for(const n of R(s.name,t,h))e.success(` ${n}`)}e.info(""),e.notice("Run 'vis doctor' for a full health check, or 'vis init' in a terminal for guided setup.")},k=(t,s,o)=>{const i=m(t,".."),a=m(s,"node_modules","@visulima","vis","schemas",o),n=B(i,a),l=n===""?`./${o}`:n.split(/[/\\]/u).join("/");return l.startsWith(".")?l:`./${l}`},L=(t,s)=>{const o=k(m(t,"project.json"),s,"project.schema.json"),i=k(m(t,"vis.config.ts"),s,"vis-config.schema.json");e.info(""),e.info("Paste these into your config files to get editor IntelliSense:"),e.info(""),e.info(` project.json → "$schema": "${o}"`),e.info(` vis.config.ts → see ${i} (vis.config.ts is TypeScript; use the import path directly)`),e.info(""),e.notice("For nested project.json files, the `..` depth changes — run `vis migrate nx` to auto-rewrite all of them.")},X=async({options:t,workspaceRoot:s})=>{const o=s??process.cwd();if(t.schema){L(o,o);return}const i=I(o),a=F(o);if(a&&!t.force){e.warn(`Config already exists: ${a}`),e.notice("Use --force to overwrite, or edit the existing file.");return}const n=a??m(o,"vis.config.ts");process.stdin.isTTY&&t.interactive!==!1?await q(o,i,n):K(o,i,t,n)};export{k as buildSchemaRefForTesting,X as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{I as $,E as u,V as k,s as y}from"../packem_shared/index.server-J83sowC4.js";import{p}from"./cli-main.js";import{r as N,M,a as R,b as S,c as x,d as A,e as V,f as b,g as C,h as E}from"../packem_shared/s1ngularity-
|
|
1
|
+
import{I as $,E as u,V as k,s as y}from"../packem_shared/index.server-J83sowC4.js";import{p}from"./cli-main.js";import{r as N,M,a as R,b as S,c as x,d as A,e as V,f as b,g as C,h as E}from"../packem_shared/s1ngularity-BCDt28u0.js";import{g as P,r as j}from"../packem_shared/packument-C-A3Uhhx.js";import{r as B}from"../packem_shared/provenance-R2csDSNg.js";import{r as D}from"../packem_shared/signatures-B3srzCEv.js";const v=new Set(["archivedRepo","author","downloads","expiredDomains","metadata","newBin","provenance","s1ngularity","signatures"]),I=r=>{const s=r.trim();if(s==="")return;if(s.startsWith("@")){const o=s.indexOf("@",1);return o===-1?{name:s,spec:void 0}:{name:s.slice(0,o),spec:s.slice(o+1)||void 0}}const i=s.indexOf("@");return i===-1?{name:s,spec:void 0}:{name:s.slice(0,i),spec:s.slice(i+1)||void 0}},O=r=>{if(r===void 0||r.trim()==="")return;const s=new Set;for(const i of r.split(",")){const o=i.trim();if(!v.has(o))throw new Error(`Unknown marshall in --only: ${o}. Known: ${[...v].sort().join(", ")}.`);s.add(o)}return s},m=(r,s)=>r===void 0||r.has(s),F=r=>r?.has("signatures")??!1,K=async({argument:r,options:s,workspaceRoot:i})=>{if(!r||r.length===0)throw new Error("No package specified. Usage: vis inspect <package>[@<spec>]");const o=I(r[0]);if(o===void 0)throw new Error(`Invalid package argument: "${String(r[0])}". Usage: vis inspect <package>[@<spec>]`);const t=O(s.only),f=await P(o.name,{workspaceRoot:i});if(f===void 0){p.error(`Package ${o.name} not found in the registry.`),process.exitCode=2;return}const g=j(f,o.spec);if(g===void 0){p.error(`Could not resolve ${o.name}@${o.spec??"latest"} to a published version.`),process.exitCode=2;return}const c=[{name:o.name,version:g}],n=new M;if(m(t,"author")){const e=await N(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"author",message:a.message,packageName:a.packageName,severity:a.severity})}if(m(t,"provenance")){const e=await B(c);for(const a of e)n.add({marshall:"provenance",message:`Prior version ${a.priorVersionWithProvenance} had provenance but ${a.version} does not.`,packageName:a.packageName,severity:"error"})}if(m(t,"s1ngularity")){const e=await R(c,{workspaceRoot:i});for(const a of e){const d=a.hookChanges.map(w=>`${w.hook} (${w.kind})`).join(", "),l=a.hookChanges.length===1;n.add({marshall:"s1ngularity",message:`${a.version} ${l?"has an":"has"} install-script ${l?"change":"changes"} [${d}] AND dropped the provenance attestation that ${a.priorVersion} carried — this is the s1ngularity compromised-publish shape.`,packageName:a.packageName,severity:"error"})}}if(m(t,"newBin")){const e=await S(c);for(const a of e){const d=a.newBins.map(l=>l.command).join(", ");n.add({marshall:"newBin",message:`${a.toVersion} adds new bin script${a.newBins.length===1?"":"s"}: ${d} (prior: ${a.fromVersion}).`,packageName:a.packageName,severity:"warning"})}}if(m(t,"metadata")){const e=await x(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"metadata",message:`Missing/invalid metadata: ${a.issues.join(", ")}.`,packageName:a.packageName,severity:"warning"})}if(m(t,"downloads")){const e=await A([o.name]);for(const a of e){const d=a.downloadsLastMonth===void 0?"unknown":String(a.downloadsLastMonth);n.add({marshall:"downloads",message:a.kind==="no-data"?"npm stats API returned no monthly download data.":`Only ${d} downloads in the past month.`,packageName:a.packageName,severity:a.severity})}}if(m(t,"expiredDomains")){const e=await V(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"expiredDomains",message:a.kind==="expired"?`Maintainer email domain ${a.domain} (${a.maintainer}) is unregistered — potential hijack risk.`:`Could not verify maintainer email domain ${a.domain} (${a.maintainer}).`,packageName:a.packageName,severity:a.severity})}if(F(t)){const e=await D(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"signatures",message:a.message,packageName:a.packageName,severity:a.severity})}if(m(t,"archivedRepo")){const e=await b(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"archivedRepo",message:a.kind==="archived"?`Source repo ${a.owner}/${a.repo} is archived${a.archivedAt===void 0?"":` (since ${a.archivedAt})`}.`:`Source repo ${a.owner}/${a.repo} returned 404 from GitHub.`,packageName:a.packageName,severity:"warning"})}const h=n.all();if(s.json===!0)process.stdout.write(`${JSON.stringify(C(h),void 0,2)}
|
|
2
2
|
`);else{const e=`${o.name}@${g}`;if(h.length===0)p.info(`${$("✓")} ${e} — no findings.`);else{p.info(`${u("Inspecting")} ${e}`);for(const l of E(h))process.stdout.write(`${l}
|
|
3
3
|
`);const a=n.errors().length,d=n.warnings().length;process.stdout.write(`
|
|
4
4
|
${u("Summary:")} ${k(`${String(a)} error${a===1?"":"s"}`)}, ${y(`${String(d)} warning${d===1?"":"s"}`)}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as
|
|
1
|
+
import{m as C,f as $,H as A,j as B}from"../packem_shared/index-CE6MsgcV.js";import{p as t}from"./cli-main.js";import{A as F,h,I as H,C as T}from"../packem_shared/pm-runner-CQcraCcu.js";import{a as M,r as N}from"../packem_shared/command-runtime-3FTGuUsK.js";import{s as Q}from"../packem_shared/typosquats-CQz-1Y6K.js";import{h as U,P as V}from"../packem_shared/peer-warnings-BXAzXqY3.js";import{i as W}from"../packem_shared/utils-CRueU43T.js";const G=["pnpm-lock.yaml","yarn.lock","package-lock.json","npm-shrinkwrap.json","bun.lock","bun.lockb"],J=a=>{let r=a;for(;;){for(const l of G)if($(C(r,l)))return!0;const n=A(r);if(n===r||B(r).root===r)return!1;r=n}},g=new Set(["aube","auto","bun","npm","pnpm","yarn"]),se=async a=>{const{argument:r,fs:n,logger:l,options:e,visConfig:i,workspaceRoot:w}=a,s=w??process.cwd();if(r&&r.length>0){const o=e,{default:q}=await import("./handler15.js"),I=o.marshallCheck===!1||o["no-marshall-check"]===!0?!1:void 0,z=o.socketCheck===!1||o["no-socket-check"]===!0?!1:void 0,E=o.typosquatCheck===!1||o["no-typosquat-check"]===!0?!1:void 0,P=o.runScripts===!0||o["run-scripts"]===!0,j=o.workspaceRoot===!0||o["workspace-root"]===!0,D=o.saveOptional===!0||o["save-optional"]===!0,L=e.dev===!0,_={autoInstallPeers:!1,exact:o.exact===!0,filter:e.filter,global:!1,marshallCheck:I,runScripts:P,saveDev:L,saveOptional:D,savePeer:!1,socketCheck:z,to:void 0,typosquatCheck:E,workspace:!1,workspaceRoot:j};await q({...a,argument:r,options:_});return}if(e.typosquatCheck!==!1&&!await Q(s,i?.security?.typosquatAllowlist)){process.exitCode=1;return}const c=e.installer;if(c&&!g.has(c)){t.error(`Invalid --installer value: "${c}". Expected one of: ${[...g].join(", ")}.`),process.exitCode=1;return}const y=c,b=e.aube===!1,f=M(N({logger:l,options:e,visConfig:i},s));let p;try{p=b?f===void 0?F(s):h(s,{backend:f}):h(s,{backend:y??f,configBackend:i?.install?.backend,configCorepack:i?.install?.corepack})}catch(o){t.error(o instanceof Error?o.message:String(o)),process.exitCode=1;return}const m=H(s,p);m&&t.warn(m);const x=W(e.filter),u=e.ci||!1,d=e.frozenLockfile||u,O=e.frozenLockfile===!1||e.force||e.lockfileOnly,R=J(s),v=d||!O&&R;if(!d&&v&&!e.silent&&t.info("Defaulting to frozen lockfile (pass --no-frozen-lockfile to allow lockfile updates)."),u){t.info("Clean install: removing node_modules...");try{await n.rm(C(s,"node_modules"),{force:!0,recursive:!0})}catch(o){t.error(`Failed to remove node_modules: ${o instanceof Error?o.message:String(o)}`),process.exitCode=1;return}}const{code:k,output:S}=await T(p,{dev:e.dev||!1,filter:x,force:e.force||!1,frozenLockfile:v,ignoreScripts:!e.runScripts,lockfileOnly:e.lockfileOnly||!1,noOptional:e.optional===!1,offline:e.offline||!1,prod:e.prod||!1,recursive:e.recursive||!1,silent:e.silent||!1,workspaceRoot:e.workspaceRoot||!1},s,l,{ciMode:u,preferOffline:e.preferOffline||!1});k!==0&&(process.exitCode=k),k===0&&!e.silent&&U(S)&&t.info(V)};export{se as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as
|
|
1
|
+
import{createRequire as M}from"node:module";import{I as R,E as j,V as A,s as I}from"../packem_shared/index.server-J83sowC4.js";import{m as L,O as B}from"../packem_shared/index-CE6MsgcV.js";import{i as b,p as f,P as N}from"./cli-main.js";import"../packem_shared/public-api-WqUCiyIe.js";import{c as F,f as z,b as U,R as V,l as H}from"./catalog.js";import{h as J,j as W,y as Y}from"../packem_shared/pm-runner-CQcraCcu.js";import{r as G,a as K}from"../packem_shared/command-runtime-3FTGuUsK.js";import{r as P,a as Q,p as X,b as Z}from"../packem_shared/resolve-explicit-C4oQMyoB.js";import{H as ee,F as C,D as oe,J as te,y,B as se,h as ne}from"../packem_shared/env-Ct3hMEYB.js";import{r as re}from"../packem_shared/typosquats-CQz-1Y6K.js";import{f as D,i as S}from"../packem_shared/utils-CRueU43T.js";import{a as ie}from"../packem_shared/readJsonSync-CvkZyKmL-ihoybKvs.js";const q=M(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=t=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[c,e]=w.versions.node.split(".").map(Number);if(c>22||c===22&&e>=3||c===20&&e>=16)return w.getBuiltinModule(t)}return q(t)},{createInterface:T}=O("node:readline"),x=t=>t==="default"?"catalog:":`catalog:${t}`,v=t=>t==="default"?"default catalog":`catalog "${t}"`,ae=(t,c)=>{const e=[];for(const[o,s]of c)o.includes(":")||s.has(t)&&e.push(o);if(e.length===0)return;if(e.length===1){const[o]=e;return{source:v(o),spec:x(o)}}const r=e.find(o=>o==="default")??e[0],i=e.filter(o=>o!==r);return{candidates:[...e],conflict:!0,source:`${v(r)} (also in: ${i.map(o=>v(o)).join(", ")})`,spec:x(r)}},ce=(t,c)=>{const e=new Map;for(const[a,u]of c){if(!a.includes(":"))continue;const p=u.get(t);p!==void 0&&e.set(p,(e.get(p)??0)+1)}if(e.size===0)return;const r=[...e.entries()],i=r.reduce((a,[,u])=>a+u,0);if(r.length===1){const[[a]]=r;return{source:`siblings (${String(i)} pkg${i===1?"":"s"} on ${a})`,spec:a}}const o=[...r].sort((a,u)=>u[1]-a[1]),[s,n]=o[0],l=o.slice(1).map(([a,u])=>`${a} (×${String(u)})`);return{candidates:o.map(([a])=>a),conflict:!0,source:`siblings (most common: ${s} ×${String(n)}; conflicts: ${l.join(", ")})`,spec:s}},le=(t,c)=>ae(t,c)||ce(t,c),pe=(t,c,e)=>{const r=[];for(const i of t.values()){const{overall:o}=i.score,s=se(o),n=`${String(Math.round(o*100))}%`,l=i.alerts.length,a=y(i),u=ee(a,i.version,e),p=s==="red"?A:s==="yellow"?I:R;if(u?f.info(` ${p(n)} ${C(i)} ${j(`[accepted: ${u.reason}]`)}`):f.info(` ${p(n)} ${C(i)}`),l>0){const g=i.alerts.filter(d=>d.severity==="critical"||d.severity==="high").length;g>0&&f.warn(` ${String(g)} critical/high alert${g===1?"":"s"}`)}o<c&&!u&&r.push(i)}return r},fe=async(t,c)=>{const e=T({input:process.stdin,output:process.stdout}),r=n=>new Promise(l=>{e.question(n,a=>{l(a.trim())})}),i=String(Math.round(c*100));f.warn(""),f.warn(`${String(t.length)} package${t.length===1?"":"s"} scored below the minimum threshold (${i}%):`);for(const n of t){const l=y(n),a=`${String(Math.round(n.score.overall*100))}%`;f.warn(` • ${l}@${n.version} — score: ${a} (${oe(n.score.overall)})`)}f.warn("");const o=await r("Continue adding these packages? [y/N] ");if(o.toLowerCase()!=="y"&&o.toLowerCase()!=="yes")return e.close(),!1;const s=await r("Remember this decision? (prints config snippet) [y/N] ");if(e.close(),s.toLowerCase()==="y"||s.toLowerCase()==="yes"){f.notice(""),f.notice("Add the following to security.acceptedRisks in vis.config.ts:"),f.notice("");for(const n of t){const l=y(n),a=te(l,n.version,n.score.overall,"Reviewed and accepted");f.notice(a)}f.notice("")}return!0},ue=async(t,c,e,r)=>{const i=await P(t);if(i.length===0)return!0;f.info(""),f.info(`${c.map(n=>n.displayName).join(" + ")} security check:`);const o=await z(c,i);if(o.size===0)return f.info(" Could not fetch security data. Proceeding."),!0;const s=pe(o,e,r);return s.length===0?(f.info(""),!0):process.stdin.isTTY?fe(s,e):(f.warn(`Aborting: ${String(s.length)} package${s.length===1?"":"s"} below minimum score. Use --no-socket-check to skip.`),!1)},de=["dependencies","devDependencies","peerDependencies","optionalDependencies"],ge=t=>t.savePeer?"peerDependencies":t.saveOptional?"optionalDependencies":t.saveDev?"devDependencies":"dependencies",_=(t,c)=>t.startsWith("catalog:")||!c?t:t.replace(/^[\^~]/,""),me=async(t,c)=>{const e=[];for(const o of t){const{name:s,versionSpec:n}=D(o);if(!s)continue;if(n!==void 0){e.push({explicit:n,name:s});continue}const l=le(s,c);if(l){l.conflict&&f.warn(`${s}: ambiguous constraint — picking ${l.spec} (${l.source}). Pass ${s}@<version> to override.`),e.push({entry:{name:s,source:l.source,spec:l.spec},kind:"resolved",name:s});continue}e.push({kind:"missing",name:s})}const r=e.filter(o=>"kind"in o&&o.kind==="missing").map(o=>o.name),i=r.length>0?await Z(r):new Map;return e.map(o=>{if("explicit"in o)return{name:o.name,source:"explicit",spec:o.explicit};if(o.kind==="resolved")return o.entry;const s=i.get(o.name);if(s===void 0)throw new Error(`--to: cannot resolve a version for "${o.name}" (not in any catalog or sibling, and registry lookup failed). Pass ${o.name}@<version> explicitly.`);const n=`^${s}`;return f.info(`${o.name}: no existing constraint — using registry latest (${n}). Add to a catalog to share this version across workspace packages.`),{name:o.name,source:"registry latest",spec:n}})},he=(t,c,e,r)=>{for(const{name:i,spec:o}of c){const s=_(o,r);for(const l of de){if(l===e)continue;const a=t[l];a?.[i]!==void 0&&(delete a[i],Object.keys(a).length===0&&delete t[l])}let n=t[e];n===void 0&&(n={},t[e]=n),n[i]=s}},ke=async({ignoreScripts:t,logger:c,options:e,packages:r,pm:i,target:o,visConfig:s,workspaceRoot:n})=>{const{workspace:l}=U(n,s??{}),a=l.projects[o];if(!a){const m=Object.keys(l.projects).sort();throw new Error(`--to: workspace package "${o}" not found. Available: ${m.length>0?m.slice(0,10).join(", "):"(none)"}${m.length>10?`, ... (${String(m.length-10)} more)`:""}.`)}const u=L(n,a.root,"package.json"),{packageManager:p}=N(n),g=V(n,p),d=ge(e),k=e.exact??!1,h=await me(r,g);if(h.length===0)return 0;const $=ie(u);he($,h,d,k),B(u,$,{indent:H(u,{useEditorconfig:s?.editorconfig??!0}),overwrite:!0});for(const m of h){const E=_(m.spec,k);f.info(`${R("+")} ${m.name}@${E} → ${o}/${d} (${j(m.source)})`)}return Y(i,{dev:!1,filter:[],force:!1,frozenLockfile:!1,ignoreScripts:t,lockfileOnly:!1,noOptional:!1,offline:!1,prod:!1,recursive:!1,silent:!1,workspaceRoot:!1},n,c)},Ee=async({argument:t,logger:c,options:e,visConfig:r,workspaceRoot:i})=>{let o=t;if(!o||o.length===0)throw new Error("No packages specified. Usage: vis add <packages...>");if(e.typosquatCheck!==!1){const p=o.map(d=>D(d)),g=await re(p.map(d=>d.name),r?.security?.typosquatAllowlist);if(!g.ok){process.exitCode=1;return}o=p.map((d,k)=>{const h=g.packages[k];return h!==d.name?d.versionSpec?`${h}@${d.versionSpec}`:h??"":o[k]??""})}if(e.marshallCheck!==!1){const p=await P(o);if(p.length>0){const g=await Q(p,{config:r?.security?.marshalls,workspaceRoot:i});if(!await X(g)){process.exitCode=1;return}}}if(e.socketCheck!==!1){const p=new Set;b("socket")&&p.add("socket"),b("depsDev")&&p.add("deps-dev");const g=F(r?.security,{disabled:p,minimumScore:r?.security?.policies?.score?.minimum});if(g.length>0){const d=r?.security?.policies?.score?.minimum??ne;if(!await ue(o,g,d,r?.security?.acceptedRisks)){process.exitCode=1;return}}}const s=process.cwd(),n=G({logger:c,options:e,visConfig:r},i??s),l=J(i??s,{backend:K(n),configBackend:r?.install?.backend,configCorepack:r?.install?.corepack}),a=!e.runScripts;if(e.to){if(e.global||e.workspaceRoot)throw new Error("--to is incompatible with --global / --workspace-root.");if(e.filter&&S(e.filter).length>0)throw new Error("--to and --filter are mutually exclusive — --to already targets one package.");if(!i)throw new Error("--to requires a monorepo workspace. Run from inside a pnpm/bun/yarn/npm workspace.");const p=await ke({ignoreScripts:a,logger:c,options:e,packages:o,pm:l,target:e.to,visConfig:r,workspaceRoot:i});p!==0&&(process.exitCode=p);return}const u=W(l,{exact:e.exact||!1,filter:S(e.filter),global:e.global||!1,optional:e.saveOptional||!1,packages:o,peer:e.savePeer||!1,saveDev:e.saveDev||!1,workspace:e.workspace||!1,workspaceRoot:e.workspaceRoot||!1},s,c,{autoInstallPeers:e.autoInstallPeers||!1,ignoreScripts:a});u!==0&&(process.exitCode=u)};export{Ee as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as m,S as p}from"../packem_shared/pm-runner-CQcraCcu.js";import{r as g,a as d}from"../packem_shared/command-runtime-3FTGuUsK.js";const u=async({argument:s,logger:e,options:r,visConfig:o,workspaceRoot:t})=>{const c=s?.[0]??null,n=t??process.cwd(),i=g({logger:e,options:r,visConfig:o},n),l=m(n,{backend:d(i),configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),a=p(l,c,n,e);a!==0&&(process.exitCode=a)};export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as f,U as k}from"../packem_shared/pm-runner-CQcraCcu.js";import{r as h,a as w}from"../packem_shared/command-runtime-3FTGuUsK.js";const C=async({argument:c,logger:a,options:t,rawUnknown:l,visConfig:n,workspaceRoot:p})=>{const o=c;if(!o||o.length===0)throw new Error("No subcommand specified. Available: cache, publish, audit, list, view, config, whoami, login, logout, pack, owner, dist-tag, search, fund, ping, token, deprecate, rebuild, prune, plugin");const[d,...i]=o,s=l??[],g=s[0]==="--"?i:[...i,...s],e=p??process.cwd(),u=h({logger:a,options:t,visConfig:n},e),m=f(e,{backend:w(u),configBackend:n?.install?.backend,configCorepack:n?.install?.corepack}),r=k(m,d,g,e,a);r!==0&&(process.exitCode=r)};export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as f,E as g}from"../packem_shared/pm-runner-CQcraCcu.js";import{r as k,a as m}from"../packem_shared/command-runtime-3FTGuUsK.js";import{c as v,i as d}from"../packem_shared/utils-CRueU43T.js";const b=async({argument:c,logger:a,options:e,rawUnknown:t,visConfig:o,workspaceRoot:r})=>{const n=v(c,t);if(n.length===0)throw new Error("No packages specified. Usage: vis remove <packages...>");const s=process.cwd(),l=k({logger:a,options:e,visConfig:o},r??s),p=f(r??s,{backend:m(l),configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),i=g(p,{filter:d(e.filter),global:e.global||!1,packages:n,recursive:e.recursive||!1,saveDev:e.saveDev||!1,workspaceRoot:e.workspaceRoot||!1},s,a);i!==0&&(process.exitCode=i)};export{b as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{readLastRunSummary as k,getLastRunSummaryPath as g}from"@visulima/task-runner";import{p as m,l as S,r as x}from"./cli-main.js";import{c as h,d as p}from"../packem_shared/env-
|
|
1
|
+
import{readLastRunSummary as k,getLastRunSummaryPath as g}from"@visulima/task-runner";import{p as m,l as S,r as x}from"./cli-main.js";import{c as h,d as p}from"../packem_shared/env-Ct3hMEYB.js";const I=new Set(["json","table"]),v=(t,a)=>t??a,c=t=>t===void 0?"-":t<1e3?`${String(t)}ms`:`${(t/1e3).toFixed(2)}s`,$=t=>t.exitCode===void 0?t.cacheStatus:t.exitCode===0?t.cacheStatus==="MISS"?"OK":t.cacheStatus:`FAIL(${String(t.exitCode)})`,r=(t,a)=>t.length>=a?t:t+" ".repeat(a-t.length),w=t=>t.exitCode!==void 0&&t.exitCode!==0,l=(t,a)=>{a.info(`Run ${t.id}`),a.info(` start: ${t.startTime}`),a.info(` end: ${t.endTime}`),a.info(` duration: ${c(t.duration)}`),a.info(` totals: ${String(t.stats.total)} total · ${String(t.stats.succeeded)} ok · ${String(t.stats.cached)} cached · ${String(t.stats.skipped)} skipped · ${String(t.stats.failed)} failed`),a.info(` env: node ${t.environment.nodeVersion} · ${t.environment.platform}/${t.environment.arch}`),a.info("")},y=(t,a)=>{if(t.length===0){a.info("(no tasks match the current filter)");return}const e=t.map(s=>({duration:c(s.duration),hash:s.hash?s.hash.slice(0,12):"-",status:$(s),taskId:s.taskId})),i={duration:Math.max(8,...e.map(s=>s.duration.length)),hash:Math.max(4,...e.map(s=>s.hash.length)),status:Math.max(6,...e.map(s=>s.status.length)),taskId:Math.max(4,...e.map(s=>s.taskId.length))};a.info(` ${r("task",i.taskId)} ${r("status",i.status)} ${r("duration",i.duration)} ${r("hash",i.hash)}`),a.info(` ${"-".repeat(i.taskId)} ${"-".repeat(i.status)} ${"-".repeat(i.duration)} ${"-".repeat(i.hash)}`);for(const s of e)a.info(` ${r(s.taskId,i.taskId)} ${r(s.status,i.status)} ${r(s.duration,i.duration)} ${r(s.hash,i.hash)}`)},C=(t,a,e)=>{l(t,e),e.info(`Task ${a.taskId}`),e.info(` status: ${$(a)}`),e.info(` cache: ${a.cacheStatus}`),e.info(` duration: ${c(a.duration)}`),e.info(` exit: ${a.exitCode===void 0?"-":String(a.exitCode)}`),e.info(` hash: ${a.hash??"(none)"}`),e.info(` start: ${a.startTime??"-"}`),e.info(` end: ${a.endTime??"-"}`),a.dependencies.length>0&&e.info(` deps: ${a.dependencies.join(", ")}`),e.info(""),m.info(`Drill into hash inputs with: vis cache why ${a.taskId} --run ${t.id}`)},R=t=>{process.stdout.write(`${JSON.stringify(t.map(a=>({id:a.id,mtime:new Date(a.mtimeMs).toISOString(),path:a.path})),void 0,2)}
|
|
2
2
|
`)},T=(t,a,e)=>{if(t.length===0){m.info(`No recorded runs found in ${p(a)}/. Run with --summarize to record a run.`);return}const i={id:Math.max(2,...t.map(s=>s.id.length)),mtime:24};e.info(` ${r("id",i.id)} ${r("mtime",i.mtime)}`),e.info(` ${"-".repeat(i.id)} ${"-".repeat(i.mtime)}`);for(const s of t)e.info(` ${r(s.id,i.id)} ${new Date(s.mtimeMs).toISOString()}`)},D=(t,a)=>{let{tasks:e}=t;return a.task!==void 0&&(e=e.filter(i=>i.taskId===a.task)),a.failed&&(e=e.filter(i=>w(i))),e},M=async(t,a)=>{const{failed:e,format:i,runId:s,task:o,workspaceRoot:d}=t,n=s===void 0?await k(d,{dataDirectory:h(d)}):await x(d,s);if(!n){if(i==="json"){process.stdout.write(`${JSON.stringify({error:"no-summary",runId:s??null},void 0,2)}
|
|
3
3
|
`),process.exitCode=1;return}s===void 0?m.error(`No previous run summary found. Run a task first to populate \`${g(d,{dataDirectory:h(d)})}\`.`):m.error(`Run summary "${s}" not found in ${p(d)}/.`),process.exitCode=1;return}const f=D(n,{failed:e,task:o});if(o!==void 0&&f.length===0){if(i==="json"){process.stdout.write(`${JSON.stringify({error:"task-not-in-summary",runId:n.id,taskId:o},void 0,2)}
|
|
4
4
|
`),process.exitCode=1;return}m.error(`Task "${o}" was not part of run ${n.id}.`),process.exitCode=1;return}if(n.stats.failed>0&&(process.exitCode=1),i==="json"){process.stdout.write(`${JSON.stringify({duration:n.duration,endTime:n.endTime,environment:n.environment,runId:n.id,startTime:n.startTime,stats:n.stats,tasks:f.map(u=>({cacheStatus:u.cacheStatus,dependencies:u.dependencies,duration:u.duration,endTime:u.endTime,exitCode:u.exitCode,hash:u.hash??null,startTime:u.startTime,taskId:u.taskId}))},void 0,2)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as M}from"node:module";import{b as _}from"../packem_shared/index-CE6MsgcV.js";import{C as N,b as I}from"./catalog.js";import{p as c,f as A}from"./cli-main.js";import{p as H,i as E,r as v,s as R,a as C,S as U,b as D,c as P,d as z,e as G}from"../packem_shared/lifecycle-
|
|
1
|
+
import{createRequire as M}from"node:module";import{b as _}from"../packem_shared/index-CE6MsgcV.js";import{C as N,b as I}from"./catalog.js";import{p as c,f as A}from"./cli-main.js";import{p as H,i as E,r as v,s as R,a as C,S as U,b as D,c as P,d as z,e as G}from"../packem_shared/lifecycle-CHcFuWf_.js";import{r as L,l as q}from"../packem_shared/target-options-CR0OuYJr.js";const j=M(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,F=s=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[e,r]=w.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return w.getBuiltinModule(s)}return j(s)},{open:S,stat:k,watch:T}=F("node:fs/promises"),$=async s=>{const e=s?.plugins;if(!e||e.length===0)return;const r=z();return await G(r,e),{callHook:async(d,...o)=>{try{await r.callHook(d,...o)}catch(t){const n=t instanceof Error?t.message:String(t);c.warn(`Plugin error in ${d}: ${n}`)}}}},B=s=>{const e=s.trim(),r=e.lastIndexOf(":");if(!(r<=0||r===e.length-1))return{project:e.slice(0,r),target:e.slice(r+1)}},b=async(s,e,r)=>{const d=B(r);if(!d){c.error(`Invalid target id "${r}". Expected "<project>:<target>", e.g. "@my/api:db".`);return}const o=await N(s),{projectOptions:t,workspace:n}=I(s,e,o),i=n.projects[d.project],a=t.get(d.project)?.[d.target];if(!i||!a){c.error(`Target "${r}" not found in this workspace.`);return}const p=a.options?.service;if(!p){c.error(`Target "${r}" is not a service. Add an \`options.service\` block to make it eligible for \`vis service\`.`);return}if(!a.command){c.error(`Target "${r}" has no command — services must be runnable.`);return}const u=L(s,i.root,a.options?.runFromWorkspaceRoot===!0),f=a.options?.envFile?q(u,a.options.envFile):{};return{command:a.command,cwd:u,env:{...f,...p.env},service:p,target:a,targetId:r}},m=s=>{if(!s)throw new Error("Could not determine workspace root. Run `vis service` inside a workspace.");return s},te=async({argument:s,options:e,visConfig:r,workspaceRoot:d})=>{const o=m(d),t=s[0]?.trim();if(!t){c.error("Missing target id. Usage: vis service start <project>:<target>"),process.exitCode=1;return}const n=await b(o,r,t);if(!n){process.exitCode=1;return}try{const{entry:i}=await C({command:n.command,config:n.service,cwd:n.cwd,env:n.env,id:t,readinessTimeoutMs:e.timeout,skipReadiness:e.readiness===!1,workspaceRoot:o});await(await $(r))?.callHook("service:start",i),c.success(`Started ${t} (pid ${String(i.pid)})`),c.info(` log: ${i.logFile}`)}catch(i){const a=i instanceof Error?i.message:String(i);i instanceof U?c.error(`Readiness probe failed for ${t}: ${a}`):c.error(`Failed to start ${t}: ${a}`),process.exitCode=1}},y=async({graceMs:s,hookSink:e,id:r,workspaceRoot:d})=>{const o=await v(d,r),{stopped:t}=await R({graceMs:s,id:r,workspaceRoot:d});return t?(o&&await e?.callHook("service:stop",o),c.success(`Stopped ${r}`),!0):(c.info(`No running service registered for ${r}`),!1)},re=async({argument:s,options:e,visConfig:r,workspaceRoot:d})=>{const o=m(d),{graceMs:t}=e,n=s[0]?.trim(),i=await $(r);if(e.all===!0){if(n){c.error("Cannot combine --all with a target id. Use one or the other."),process.exitCode=1;return}const a=await P(o);if(a.length===0){c.info("No running services registered for this workspace.");return}for(const p of a)await y({graceMs:t,hookSink:i,id:p.id,workspaceRoot:o});return}if(!n){c.error("Missing target id. Usage: vis service stop <project>:<target> | --all"),process.exitCode=1;return}await y({graceMs:t,hookSink:i,id:n,workspaceRoot:o})||(process.exitCode=1)},O=s=>{const e=s.config.readiness?.tcp.port??s.config.port;return e===void 0?"—":String(e)},x=new Set(["json","table"]),oe=async({logger:s,options:e,workspaceRoot:r})=>{const d=m(r),o=e.format??"table";if(!x.has(o)){c.error(`Invalid --format "${o}". Expected one of: ${[...x].sort().join(", ")}.`),process.exitCode=1;return}const{surviving:t}=await H(d);if(o==="json"){const l=Date.now();process.stdout.write(`${JSON.stringify(t.map(g=>{const h=Date.parse(g.startedAt);return{ageMs:Number.isFinite(h)?l-h:null,alive:E(g.pid),command:g.command,cwd:g.cwd,env:g.env,id:g.id,logFile:g.logFile,pid:g.pid,port:g.config.readiness?.tcp.port??g.config.port??null,startedAt:g.startedAt,visVersion:g.visVersion}}),void 0,2)}
|
|
2
2
|
`);return}if(t.length===0){c.info("No running services registered for this workspace.");return}const n=Date.now(),i=t.map(l=>{const g=Date.parse(l.startedAt);return{age:Number.isFinite(g)?A(g,n):"?",id:l.id,log:l.logFile,pid:String(l.pid),port:O(l)}}),a=Math.max(2,...i.map(l=>l.id.length)),p=Math.max(3,...i.map(l=>l.pid.length)),u=Math.max(4,...i.map(l=>l.port.length)),f=Math.max(3,...i.map(l=>l.age.length));s.info(` ${"id".padEnd(a)} ${"pid".padEnd(p)} ${"port".padEnd(u)} ${"age".padEnd(f)} log`),s.info(` ${"-".repeat(a)} ${"-".repeat(p)} ${"-".repeat(u)} ${"-".repeat(f)} ---`);for(const l of i)s.info(` ${l.id.padEnd(a)} ${l.pid.padEnd(p)} ${l.port.padEnd(u)} ${l.age.padEnd(f)} ${l.log}`)},se=async({argument:s,options:e,workspaceRoot:r})=>{const d=m(r),o=s[0]?.trim();if(!o){c.error("Missing target id. Usage: vis service status <project>:<target>"),process.exitCode=1;return}const t=await v(d,o);if(!t){c.error(`No service registered for ${o}.`),process.exitCode=1;return}if(!E(t.pid)){c.error(`Service ${o} is not running (pid ${String(t.pid)} is dead). Run \`vis service start ${o}\` to recover.`),process.exitCode=1;return}try{await D(t.config,{timeoutMs:e.timeout}),c.success(`${o} healthy (pid ${String(t.pid)})`)}catch(n){const i=n instanceof Error?n.message:String(n);c.error(`${o} probe failed: ${i}`),process.exitCode=1}},ie=async({argument:s,options:e,visConfig:r,workspaceRoot:d})=>{const o=m(d),t=s[0]?.trim();if(!t){c.error("Missing target id. Usage: vis service restart <project>:<target>"),process.exitCode=1;return}const n=await $(r),i=await v(o,t);(await R({graceMs:e.graceMs,id:t,workspaceRoot:o})).stopped&&i&&await n?.callHook("service:stop",i);const a=await b(o,r,t);if(!a){process.exitCode=1;return}try{const{entry:p}=await C({command:a.command,config:a.service,cwd:a.cwd,env:a.env,id:t,readinessTimeoutMs:e.timeout,skipReadiness:e.readiness===!1,workspaceRoot:o});await n?.callHook("service:start",p),c.success(`Restarted ${t} (pid ${String(p.pid)})`)}catch(p){const u=p instanceof Error?p.message:String(p);c.error(`Failed to restart ${t}: ${u}`),process.exitCode=1}},V=200,W=1024*1024,J=async s=>{let e=0;try{e=(await k(s)).size}catch{e=0}const r=new AbortController;let d=!1;const o=()=>{d=!0,r.abort()},t=()=>{r.abort()};process.on("SIGINT",o),process.on("SIGTERM",t);let n=!1;const i=async()=>{if(!n){n=!0;try{const a=await k(s).catch(()=>{});if(!a||(a.size<e&&(e=0),a.size===e))return;const p=a.size-e,u=Math.min(p,W),f=await S(s,"r");try{const l=Buffer.alloc(u);await f.read(l,0,u,e),process.stdout.write(l),e+=u}finally{await f.close().catch(()=>{})}}finally{n=!1}}};try{const a=(async()=>{try{const p=T(s,{signal:r.signal});for(;!(await p.next()).done;)await i()}catch{}})();for(;!r.signal.aborted;)await i(),await new Promise(p=>{const u=setTimeout(p,V);r.signal.addEventListener("abort",()=>{clearTimeout(u),p()},{once:!0})});await a.catch(()=>{}),await i().catch(()=>{})}finally{process.off("SIGINT",o),process.off("SIGTERM",t)}d&&(process.exitCode=130)},ae=async({argument:s,options:e,workspaceRoot:r})=>{const d=m(r),o=s[0]?.trim();if(!o){c.error("Missing target id. Usage: vis service logs <project>:<target>"),process.exitCode=1;return}const t=await v(d,o);if(!t){c.error(`No service registered for ${o}.`),process.exitCode=1;return}if(!await _(t.logFile)){c.warn(`Log file is missing for ${o}: ${t.logFile}`),process.exitCode=1;return}if(e.follow===!0){await J(t.logFile);return}const n=await S(t.logFile,"r");try{const i=n.createReadStream();await new Promise((a,p)=>{i.on("end",a),i.on("error",p),i.pipe(process.stdout,{end:!1})})}finally{await n.close().catch(()=>{})}};export{oe as serviceListExecute,ae as serviceLogsExecute,ie as serviceRestartExecute,te as serviceStartExecute,se as serviceStatusExecute,re as serviceStopExecute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as C,I as a,s as j,V as S}from"../packem_shared/index.server-J83sowC4.js";import{f as R,m as V}from"../packem_shared/index-CE6MsgcV.js";import{enforceProjectConstraints as v}from"@visulima/task-runner";import{b as x,O as F}from"./catalog.js";import{b as I}from"./cli-main.js";import{c as T}from"../packem_shared/runtime-check-BXehSP06.js";import{d as z}from"../packem_shared/env-
|
|
1
|
+
import{E as C,I as a,s as j,V as S}from"../packem_shared/index.server-J83sowC4.js";import{f as R,m as V}from"../packem_shared/index-CE6MsgcV.js";import{enforceProjectConstraints as v}from"@visulima/task-runner";import{b as x,O as F}from"./catalog.js";import{b as I}from"./cli-main.js";import{c as T}from"../packem_shared/runtime-check-BXehSP06.js";import{d as z}from"../packem_shared/env-Ct3hMEYB.js";import{a as D}from"../packem_shared/readJsonSync-CvkZyKmL-ihoybKvs.js";const e=c=>c?a("✓"):S("✗"),P=async({fs:c,logger:t,options:O,visConfig:y,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root.");const{config:h,packageJsons:w,workspace:f}=x(s,y),b=F(s,f,w),$=Object.keys(f.projects).length,k=new Set(Object.values(f.projects).flatMap(g=>Object.keys(g.targets??{}))).size,n=T(s);let o=0;h.constraints&&(o=v(b,h.constraints).length);const i=I(s,{minRuns:2});let r;const l=z(s);if(R(l)){const g=(await c.readdir(l)).filter(p=>p.endsWith(".json")).sort();let m=0,d=0;for(const p of g.slice(-20))try{const u=D(V(l,p));u.stats&&(m+=u.stats.total??0,d+=u.stats.cached??0)}catch{continue}m>0&&(r=`${(d/m*100).toFixed(0)}%`)}if(O.json){t.info(JSON.stringify({cacheHitRate:r??null,constraintViolations:o,flakyTasks:i.length,projects:$,runtimeIssues:n.length,targets:k},null,2));return}t.info(""),t.info(` ${C("VIS STATUS")}`),t.info(""),t.info(` ${e(!0)} ${String($)} projects · ${String(k)} unique targets`),t.info(` ${e(n.length===0)} Runtime: ${n.length===0?a("OK"):j(`${String(n.length)} issue(s)`)}`),t.info(` ${e(o===0)} Constraints: ${o===0?a("OK"):S(`${String(o)} violation(s)`)}`),t.info(` ${e(i.length===0)} Flaky tasks: ${i.length===0?a("none"):j(String(i.length))}`),r&&t.info(` ${e(!0)} Cache hit rate: ${r} (last 20 runs)`),t.info("")};export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as p,$ as f}from"../packem_shared/pm-runner-CQcraCcu.js";import{r as g,a as d}from"../packem_shared/command-runtime-3FTGuUsK.js";import{c as k}from"../packem_shared/utils-CRueU43T.js";const w=async({argument:r,logger:n,options:s,rawUnknown:c,visConfig:o,workspaceRoot:i})=>{const t=k(r,c),e=i??process.cwd(),l=g({logger:n,options:s,visConfig:o},e),m=p(e,{backend:d(l),configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),a=f(m,t,s.recursive||!1,e,n);a!==0&&(process.exitCode=a)};export{w as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createRequire as u}from"node:module";import{c as p}from"../packem_shared/index-
|
|
1
|
+
import{createRequire as u}from"node:module";import{c as p}from"../packem_shared/index-XAb0QGqA.js";const f=u(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,a=s=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[e,i]=r.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return r.getBuiltinModule(s)}return f(s)},{execSync:d,spawnSync:l}=a("node:child_process"),v=async({argument:s,logger:e,options:i})=>{const t=s?.[0];e.info("info: checking for updates...");const n=p.version;let o;try{const c=d("npm view @visulima/vis version",{encoding:"utf8"}).trim();o=t??c}catch{throw new Error("Failed to query npm registry. Check your network connection.")}if(n===o&&!i.force){e.info(`
|
|
2
2
|
✓ Already up to date (${n})`);return}if(i.check){n===o?e.info(`✓ Already up to date (${n})`):e.info(`info: found @visulima/vis@${o} (current: ${n})`);return}if(e.info(`info: found @visulima/vis@${o} (current: ${n})`),e.info("info: installing..."),l("npm",["install","-g",`@visulima/vis@${o}`],{encoding:"utf8",stdio:"inherit"}).status!==0)throw new Error("Failed to update. Try running with sudo or fix npm permissions.");e.info(`
|
|
3
3
|
✓ Updated @visulima/vis from ${n} → ${o}`)};export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as d,P as g}from"../packem_shared/pm-runner-CQcraCcu.js";import{r as m,a as k}from"../packem_shared/command-runtime-3FTGuUsK.js";import{c as v,i as h}from"../packem_shared/utils-CRueU43T.js";const C=async({argument:l,logger:n,options:o,process:i,rawUnknown:t,visConfig:a,workspaceRoot:c})=>{const r=v(l,t);if(r.length===0)throw new Error("No packages specified. Usage: vis why <package...>");const e=c??i.cwd,p=m({logger:n,options:o,visConfig:a},e),f=d(e,{backend:k(p),configBackend:a?.install?.backend,configCorepack:a?.install?.corepack}),s=g(f,{depth:o.depth===void 0?void 0:Number(o.depth),dev:o.dev||!1,filter:h(o.filter),global:o.global||!1,json:o.json||!1,long:o.long||!1,noOptional:o.optional===!1,packages:r,parseable:o.parseable||!1,prod:o.prod||!1,recursive:o.recursive||!1},e,n);s!==0&&s!==1&&(process.exitCode=s)};export{C as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{getAffectedProjects as $}from"@visulima/task-runner";import{b as E,O as F}from"./catalog.js";import{r as b}from"../packem_shared/affected-shas-
|
|
1
|
+
import{getAffectedProjects as $}from"@visulima/task-runner";import{b as E,O as F}from"./catalog.js";import{r as b}from"../packem_shared/affected-shas-CCxG4tvm.js";import{f as k}from"../packem_shared/selectors-D4iCvITE.js";const T=async({argument:w,logger:s,options:e,runtime:j,visConfig:u,workspaceRoot:h})=>{const l=w[0];if(!l)throw new Error("Missing target. Usage: vis affected <target>");if(!h)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const a=h,{packageJsons:v,workspace:i}=E(a,u),y=F(a,i,v),g=new Set(["deep","direct","none"]),p=e.downstream??"deep",d=e.upstream??"none";if(!g.has(p))throw new Error(`Invalid --downstream value: "${p}". Must be "none", "direct", or "deep".`);if(!g.has(d))throw new Error(`Invalid --upstream value: "${d}". Must be "none", "direct", or "deep".`);let{base:c}=e,{head:f}=e;if(!c||!f){const o=b({defaultBase:u?.defaultBase,workspaceRoot:a});c=c??o.base,f=f??o.head,s.info(`▸ Resolved affected refs from ${o.provider} (${o.notes.join("; ")})`)}const S={base:c,downstream:p,head:f,projectGraph:y,projects:i.projects,upstream:d,workspaceRoot:a},n=await $(S);if(n.changedFiles.length===0){s.info("No files changed. Nothing to run.");return}if(n.affectedProjects.length===0){s.info("No projects affected by the changes.");return}let{affectedProjects:t}=n;if(e.query&&(t=k(t,i,e.query),t.length===0)){s.info(`Query "${String(e.query)}" matched no affected projects.`);return}if(e.sparseCheckout){const o=[...new Set(t.map(m=>i.projects[m]?.root??m))].sort();process.stdout.write(`${o.join(`
|
|
2
2
|
`)}
|
|
3
3
|
`);return}s.info(`Affected projects: ${t.join(", ")}`),n.changedFiles.length>0&&(process.env.VIS_AFFECTED_FILES=n.changedFiles.join(`
|
|
4
4
|
`));const r=[l,`--projects=${t.join(",")}`];e.parallel!==void 0&&r.push(`--parallel=${String(e.parallel)}`),e.cache||r.push("--no-cache"),e.dryRun&&r.push("--dry-run"),e.partition&&r.push(`--partition=${String(e.partition)}`),e.reverse&&r.push("--reverse"),typeof e.runnerTags=="string"&&e.runnerTags!==""&&r.push(`--runner-tags=${e.runnerTags}`);try{await j.runCommand("run",{argv:r})}finally{delete process.env.VIS_AFFECTED_FILES}};export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as d,B as w}from"../packem_shared/index-CE6MsgcV.js";import{r as v}from"../packem_shared/command-runtime-
|
|
1
|
+
import{A as d,B as w}from"../packem_shared/index-CE6MsgcV.js";import{r as v}from"../packem_shared/command-runtime-3FTGuUsK.js";import{r as u}from"../packem_shared/run-file-DD7Ne23Z.js";const R=async({argument:s,logger:i,options:n,rawUnknown:t,visConfig:a,workspaceRoot:f})=>{const m=s??[],[o,...p]=m;if(o===void 0)throw new Error("No file specified. Usage: vis x <file> [args...]");const r=process.cwd(),c=d(o)?o:w(r,o),g=[...p,...t??[]],{runtime:l}=v({logger:i,options:n,visConfig:a},f??r),e=await u(c,g,l,r);e!==0&&(process.exitCode=e)};export{R as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{P as N}from"./cli-main.js";import"../packem_shared/index-CE6MsgcV.js";import"../packem_shared/public-api-WqUCiyIe.js";import{K as C,Z as P,W as T}from"../packem_shared/ai-analysis-
|
|
1
|
+
import{P as N}from"./cli-main.js";import"../packem_shared/index-CE6MsgcV.js";import"../packem_shared/public-api-WqUCiyIe.js";import{K as C,Z as P,W as T}from"../packem_shared/ai-analysis-rC48NLfB.js";import{R as I,T as j,a as h,N as q,c as x,f as z,q as A,I as F}from"./catalog.js";const M=/^[\^~>=<]+/,V=async({argument:v,logger:n,options:c,visConfig:l,workspaceRoot:f})=>{if(!f)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const m=v,e=m[0];if(!e)throw new Error("Package name is required. Usage: vis analyze <package> [version]");const p=m[1],{packageManager:R}=N(f);let t,u="default";const b=I(f,R);for(const[o,i]of b){const a=i.get(e);if(a){t=a,u=o;break}}if(!t)throw new Error(`Package "${e}" not found in any catalog or package.json. Make sure it exists in your workspace dependencies.`);let r;if(p)r=p;else{n.info(`Fetching latest version for ${e}...
|
|
2
2
|
`);const o=await j(e);if(!o.latest)throw new Error(`Could not determine latest version for "${e}".`);r=o.latest}const d=h(t),w=h(r);if(!d||!w)throw new Error(`Could not parse versions: current="${t}", target="${r}".`);const k=A(d,w);if(k==="none"){n.info(`${e} is already at ${r}. Nothing to analyze.`);return}const E=F(t),g={catalogName:u,currentRange:t,newRange:`${E}${r}`,packageName:e,targetVersion:r,updateType:k},y=C(c.aiType??"impact");if(y==="security"||c.security){n.info(`Checking for known vulnerabilities...
|
|
3
3
|
`);const o=t.replace(M,""),i=(await q([{name:e,version:o}])).get(e);i&&i.length>0&&(g.vulnerabilities=i);const a=x(l?.security,{minimumScore:l?.security?.policies?.score?.minimum});if(a.length>0){const s=(await z(a,[{name:e,version:o}])).get(`${e}@${o}`);s&&(g.socketReport={alerts:s.alerts,license:s.license,score:s.score})}}const $=await P([g],n,l?.ai,y);(c.format??"table")==="json"?process.stdout.write(`${JSON.stringify($,void 0,2)}
|
|
4
4
|
`):n.info(T($))};export{V as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{createRequire as b}from"node:module";import{h as _,
|
|
1
|
+
import{createRequire as b}from"node:module";import{h as _,d as O,E as j}from"./catalog.js";import"../packem_shared/env-Ct3hMEYB.js";import{A as R}from"../packem_shared/pm-runner-CQcraCcu.js";import{l as E}from"../packem_shared/dependency-scan-DpOFiZuI.js";import{r as I}from"../packem_shared/provenance-R2csDSNg.js";import{r as P}from"../packem_shared/signatures-B3srzCEv.js";import{loadOptionalSigstore as C}from"./loader.js";const N=b(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=r=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[o,t]=u.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return u.getBuiltinModule(r)}return N(r)},{createHash:S}=$("node:crypto"),{isAbsolute:y,resolve:k,basename:v}=$("node:path"),T=r=>(r??"").split(",").map(o=>o.trim()).filter(o=>o.length>0),G=async({logger:r,options:o,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const n=o.format??"table",c=o.prodOnly??!1,p=o.failOn==="error"?"error":"warning",l=T(o.allowlist),a=R(t),d=E(t,a.name,{includeDev:!c}).map(({name:e,version:i})=>({name:e,version:i})),[m,g]=await Promise.all([I(d,{allowlist:l,workspaceRoot:t}),P(d,{allowlist:l,workspaceRoot:t})]),s=[...m.map(e=>({code:"provenance-regression",message:`Resolved ${e.packageName}@${e.version} has no published provenance attestation, but ${e.packageName}@${e.priorVersionWithProvenance} did — a provenance regression.`,packageName:e.packageName,severity:"warning",version:e.version})),...g.map(e=>({code:e.code,message:e.message,packageName:e.packageName,severity:e.severity,version:e.version}))],f=s.filter(e=>p==="error"?e.severity==="error":!0);if(n==="json")process.stdout.write(`${JSON.stringify({findings:s,ok:f.length===0},void 0,2)}
|
|
2
2
|
`);else if(n==="ndjson")for(const e of s)process.stdout.write(`${JSON.stringify(e)}
|
|
3
|
-
`);else if(s.length===0)r.info(`No provenance regressions or signature problems across ${String(d.length)} locked packages.`);else{const e=process.stdout.columns||80;r.info(_(O.createElement(j,{data:s.map(i=>({code:i.code,package:`${i.packageName}@${i.version}`,severity:i.severity}))}),{columns:e}));for(const i of s)r.warn(`${i.packageName}@${i.version}: ${i.message}`)}f.length>0&&(process.exitCode=1)},D=()=>process.env.CI==="true"||typeof process.env.ACTIONS_ID_TOKEN_REQUEST_URL=="string"||typeof process.env.SIGSTORE_ID_TOKEN=="string",q=(r,o,t)=>({_type:"https://in-toto.io/Statement/v1",predicate:{buildDefinition:{buildType:"https://visulima.com/vis/attest/v1",externalParameters:{workspaceRoot:t},internalParameters:{},resolvedDependencies:[]},runDetails:{builder:{id:"https://visulima.com/vis"},metadata:{invocationId:process.env.GITHUB_RUN_ID??"",startedOn:new Date().toISOString()}}},predicateType:"https://slsa.dev/provenance/v1",subject:[{digest:{sha256:o},name:r}]}),
|
|
3
|
+
`);else if(s.length===0)r.info(`No provenance regressions or signature problems across ${String(d.length)} locked packages.`);else{const e=process.stdout.columns||80;r.info(_(O.createElement(j,{data:s.map(i=>({code:i.code,package:`${i.packageName}@${i.version}`,severity:i.severity}))}),{columns:e}));for(const i of s)r.warn(`${i.packageName}@${i.version}: ${i.message}`)}f.length>0&&(process.exitCode=1)},D=()=>process.env.CI==="true"||typeof process.env.ACTIONS_ID_TOKEN_REQUEST_URL=="string"||typeof process.env.SIGSTORE_ID_TOKEN=="string",q=(r,o,t)=>({_type:"https://in-toto.io/Statement/v1",predicate:{buildDefinition:{buildType:"https://visulima.com/vis/attest/v1",externalParameters:{workspaceRoot:t},internalParameters:{},resolvedDependencies:[]},runDetails:{builder:{id:"https://visulima.com/vis"},metadata:{invocationId:process.env.GITHUB_RUN_ID??"",startedOn:new Date().toISOString()}}},predicateType:"https://slsa.dev/provenance/v1",subject:[{digest:{sha256:o},name:r}]}),H=async({argument:r,fs:o,logger:t,options:n,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const p=r[0];if(!p)throw new Error("Missing subject. Usage: vis attest <path-to-artifact>");const l=n.predicate??"slsaProvenance";if(l!=="slsaProvenance")throw new Error(`Unsupported predicate '${l}'. Only 'slsaProvenance' is supported.`);const a=y(p)?p:k(c,p),d=n.requireSigning??!1,m=n.format??"table";let g;try{g=await o.readFile(a)}catch{throw new Error(`Cannot read subject artifact at ${a}.`)}const s=S("sha256").update(g).digest("hex");if(!D()){const h="No ambient OIDC token (not running in CI). Keyless signing needs a Fulcio identity from CI OIDC.";if(d)throw new Error(`${h} Re-run in CI or drop --require-signing.`);if(m==="json"){process.stdout.write(`${JSON.stringify({ok:!1,reason:"no-ambient-oidc",sha256:s,skipped:!0,subject:v(a)},void 0,2)}
|
|
4
4
|
`);return}t.warn(`${h} Skipping signing (subject sha256: ${s}). Pass --require-signing to make this fatal.`);return}const f=q(v(a),s,c),e=Buffer.from(JSON.stringify(f)),i=await(await C({workspaceRoot:c})).attest(e,"application/vnd.in-toto+json"),w=n.output?y(n.output)?n.output:k(c,n.output):`${a}.sigstore`;if(await o.writeFile(w,`${JSON.stringify(i,void 0,2)}
|
|
5
5
|
`,"utf8"),m==="json"){process.stdout.write(`${JSON.stringify({bundle:w,ok:!0,sha256:s,subject:v(a)},void 0,2)}
|
|
6
|
-
`);return}t.info(`Signed SLSA v1 provenance for ${v(a)} (sha256 ${s.slice(0,16)}…).`),t.info(`Bundle written to ${w}.`)};export{
|
|
6
|
+
`);return}t.info(`Signed SLSA v1 provenance for ${v(a)} (sha256 ${s.slice(0,16)}…).`),t.info(`Bundle written to ${w}.`)};export{H as attestEmitExecute,G as attestVerifyExecute};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{createRequire as $}from"node:module";import{N as y,R as l,S as d,h as b}from"../packem_shared/ai-analysis-
|
|
2
|
-
`,T=(e,t=u)=>{const
|
|
1
|
+
import{createRequire as $}from"node:module";import{N as y,R as l,S as d,h as b}from"../packem_shared/ai-analysis-rC48NLfB.js";import{h as x,d as _,E as w}from"./catalog.js";import"../packem_shared/env-Ct3hMEYB.js";import{j as S,E as p,q as j,I as E,s as I}from"../packem_shared/index.server-J83sowC4.js";const C=$(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const u={command:"ai",description:"AI-assisted commands: provider detection, cache management, and failure-fix proposals."},N=e=>{if(typeof e!="function")return String(e);const{name:t}=e;return t==="Boolean"?"boolean":t==="Number"?"number":t==="String"?"string":t??"unknown"},R=e=>{const t=[...e.commandPath??[],e.name].join(" "),i=(e.examples??[]).map(([o,r])=>({command:o??"",description:r??""})),n=(e.options??[]).map(o=>({defaultValue:o.defaultValue,description:o.description,name:o.name,type:N(o.type)}));return{argument:e.argument?{description:e.argument.description,name:e.argument.name}:void 0,description:e.description??"",examples:i,name:e.name,options:n,path:t}},f=(e,t=u)=>({command:t.command,description:t.description,subcommands:e.map(i=>R(i))}),P=(e,t=u)=>`${JSON.stringify(f(e,t),void 0,2)}
|
|
2
|
+
`,T=(e,t=u)=>{const i=f(e,t),n=[S(`vis ${i.command} — ${i.description}`),"",p("Subcommands:")];for(const o of i.subcommands){const r=o.argument?` ${j(`<${o.argument.name}>`)}`:"";if(n.push(""),n.push(` ${E(`vis ${o.path}`)}${r}`),o.description&&n.push(` ${o.description}`),o.options.length>0){const s=o.options.map(c=>`--${c.name}${c.type==="boolean"?"":`=<${c.type}>`}`).join(", ");n.push(p(` options: ${s}`))}if(o.examples.length>0){n.push(p(" examples:"));for(const s of o.examples){const c=s.description?p(` — ${s.description}`):"";n.push(` ${I(s.command)}${c}`)}}}return n.push(""),n.push(p(`Run \`vis ${i.command} discover-help\` for the machine-readable JSON catalogue (designed for AI agents).`)),n.push(p(`Run \`vis ${i.command} <subcommand> --help\` for full usage of a specific subcommand.`)),`${n.join(`
|
|
3
3
|
`)}
|
|
4
|
-
`},h=async()=>{const{default:e}=await import("./cli-main.js").then(t=>t.as);return e.filter(t=>t.name!=="ai")},
|
|
4
|
+
`},h=async()=>{const{default:e}=await import("./cli-main.js").then(t=>t.as);return e.filter(t=>t.name!=="ai")},B=async()=>{const e=await h();process.stderr.write(T(e))},F=async()=>{const e=await h();process.stdout.write(P(e))},V=async({logger:e,visConfig:t})=>{const i=t?.ai,n=l(i);if(!n){e.error("No AI provider available to test."),process.exitCode=1;return}e.info(`Testing ${n.name}...`);try{const o=await b(n,"Reply with exactly: OK",{timeoutMs:3e4});e.info(`Provider ${n.name} responded: ${o.stdout.trim().slice(0,200)}`)}catch(o){const r=o instanceof Error?o.message:String(o);e.error(`Provider ${n.name} failed: ${r}`),process.exitCode=1}},k=({logger:e,options:t,visConfig:i})=>{const n=t.format??"table",o=i?.ai,r=y(),s=l(o);if(n==="json"){const a=r.map(m=>({available:m.available,method:m.detectionMethod,name:m.name,path:m.path,priority:d[m.name]??0,selected:m.name===s?.name,version:m.version}));process.stdout.write(`${JSON.stringify(a,void 0,2)}
|
|
5
5
|
`);return}const c=r.map(a=>({method:a.detectionMethod??"-",path:a.path??"-",priority:String(d[a.name]??0),provider:a.name,selected:a.name===s?.name?">>>":"",status:a.available?"available":"not found",version:a.version??"-"})),g=process.stdout.columns||80,v=x(_.createElement(w,{data:c}),{columns:g});e.info(v),s?e.info(`
|
|
6
6
|
Selected provider: ${s.name} (priority ${String(d[s.name]??0)})`):e.info(`
|
|
7
|
-
No AI provider available. Install one of the supported AI CLI tools.`)},
|
|
7
|
+
No AI provider available. Install one of the supported AI CLI tools.`)},H=async e=>{const{aiFix:t}=await import("./fix.js");await t(e)};export{F as aiDiscoverHelpExecute,H as aiFixExecute,k as aiProvidersExecute,B as aiRootExecute,V as aiTestExecute};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as P}from"node:module";import{f as D,v as V,T as w}from"../packem_shared/index-CE6MsgcV.js";import{findVisConfigFile as
|
|
1
|
+
import{createRequire as P}from"node:module";import{f as D,v as V,T as w}from"../packem_shared/index-CE6MsgcV.js";import{findVisConfigFile as A}from"./CONFIG_FILES.js";import{p as e}from"./cli-main.js";import{A as F}from"../packem_shared/pm-runner-CQcraCcu.js";import{W as O}from"../packem_shared/build-scripts-MTSK6TNr.js";import{O as q}from"../packem_shared/native-config-sync-BFDVK9LH.js";const C=P(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=l=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[t,s]=$.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return $.getBuiltinModule(l)}return C(l)},{spawnSync:T}=R("node:child_process"),M=/(defineConfig\s*\(\s*\{)/,W=/(export\s+default\s+\{)/,v=(l,t)=>`${t}${JSON.stringify(l)}: true,`,B=(l,t)=>{if(t.length===0)return{added:[],skipped:[],status:"noop"};const s=A(l);if(!s)return{added:[],skipped:t,status:"no-config"};if(!D(s))return{added:[],skipped:t,status:"no-config"};const i=V(s),h=i.search(/installScripts\s*:\s*\{/);let a=null,r=0;if(h!==-1){const c=i.slice(h),d=/(allow\s*:\s*\{)([^}]*)(\})/.exec(c);d?.index!==void 0&&(a=d,r=h+d.index)}if(a){const c=a[2]??"",d=new Set;for(const g of c.matchAll(/["']([^"']+)["']\s*:/g))d.add(g[1]);for(const g of c.matchAll(/(?:^|,|\{)\s*([a-z_$][\w-]*)\s*:/gi))d.add(g[1]);const u=[],k=[];for(const g of t)d.has(g)?k.push(g):u.push(g);if(u.length===0)return{added:[],configPath:s,skipped:k,status:"noop"};const b=/\n([ \t]+)\S/.exec(c)?.[1]??" ",_=`
|
|
2
2
|
${u.map(g=>v(g,b)).join(`
|
|
3
3
|
`)}`,y=c.replace(/\s+$/,""),S=c.slice(y.length),j=`${y}${y.endsWith(",")||y===""?"":","}${_}${S.length>0?S:`
|
|
4
4
|
`}`,N=`${i.slice(0,r)}${a[1]}${j}${a[3]}${i.slice(r+a[0].length)}`;return w(s,N),{added:u,configPath:s,skipped:k,status:"updated"}}const n=/(installScripts\s*:\s*\{)/;if(n.test(i)){const c=`
|
|
@@ -29,5 +29,5 @@ ${t.map(c=>v(c," ")).join(`
|
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
|
-
},`,x=`${i.slice(0,p.index+p[0].length)}${m}${i.slice(p.index+p[0].length)}`;return w(s,x),{added:t,configPath:s,skipped:[],status:"updated"}},L=async({options:l,visConfig:t,workspaceRoot:s})=>{const i=s??process.cwd(),h=
|
|
33
|
-
`);for(const o of n.unapproved)e.info(` ${o.name} (${o.hooks.join(", ")})`);e.notice(""),e.notice("To approve these packages, add them to vis.config.ts:"),e.notice(""),e.notice(" security: {"),e.notice(" policies: {"),e.notice(" installScripts: {"),e.notice(" allow: {");for(const o of n.unapproved){const f=r&&o.version?`${o.name}@${o.version}`:o.name;e.notice(` "${f}": true,`)}if(e.notice(" },"),e.notice(" },"),e.notice(" },"),e.notice(" },"),h.name==="pnpm"&&(e.notice(""),e.notice("Or run 'pnpm approve-builds' to update pnpm-workspace.yaml directly.")),l.write){const o=t?.security?.pinVersions===!0,f=n.unapproved.map(m=>o&&m.version?`${m.name}@${m.version}`:m.name),p=B(i,f);switch(e.info(""),p.status){case"missing-anchor":{e.warn(`Could not locate 'defineConfig({' or 'export default {' in ${String(p.configPath)} — please add entries manually.`);break}case"no-config":{e.warn("No vis.config.ts found. Run 'vis init' first, then re-run with --write.");break}case"noop":{e.info(`All ${String(f.length)} entr${f.length===1?"y":"ies"} were already present in vis.config.ts security.policies.installScripts.allow.`);break}default:e.success(`Wrote ${String(p.added.length)} entr${p.added.length===1?"y":"ies"} to ${String(p.configPath)}.`),p.skipped.length>0&&e.info(`Skipped ${String(p.skipped.length)} already-present entr${p.skipped.length===1?"y":"ies"}.`)}}}if(n.excess.length>0){e.notice(""),e.warn(`Stale installScripts.allow entries — ${String(n.excess.length)} pattern${n.excess.length===1?"":"s"} no longer match any installed package:`);for(const o of n.excess)e.info(` ${o}`);e.notice("Consider removing these entries from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){e.notice(""),e.warn(`Version drift — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} pinned to an outdated version:`);for(const{from:o,to:f}of n.versionDrift)e.info(` ${o} → ${f}`);e.notice("Rename the keys in vis.config.ts security.policies.installScripts.allow to migrate.")}}if(l.syncNative){const a=t?.security?.policies?.installScripts?.allow??{};if(Object.keys(a).length===0)e.warn("No security.policies.installScripts.allow configured in vis.config.ts. Nothing to sync.");else{const r=
|
|
32
|
+
},`,x=`${i.slice(0,p.index+p[0].length)}${m}${i.slice(p.index+p[0].length)}`;return w(s,x),{added:t,configPath:s,skipped:[],status:"updated"}},L=async({options:l,visConfig:t,workspaceRoot:s})=>{const i=s??process.cwd(),h=F(i);if(h.name==="pnpm"&&!l.scan){e.info("Delegating to pnpm approve-builds...");const a=["approve-builds"];l.all&&a.push("--all");const r=T("pnpm",a,{cwd:i,stdio:"inherit"});if(r.error)throw new Error(`Failed to run pnpm approve-builds: ${r.error.message}`);if(r.status!==0&&r.status!==null&&(e.error(`pnpm approve-builds exited with code ${r.status}`),process.exitCode=r.status),!l.syncNative){e.notice(""),e.notice("Tip: vis.config.ts security.policies.installScripts.allow may now be out of sync with pnpm-workspace.yaml."),e.notice("Run 'vis check --security-config' to compare, or copy the new entries into vis.config.ts.");return}}else{const a=t?.security?.policies?.installScripts?.allow??{},r=t?.security?.pinVersions===!0,n=O(i,a,{pinVersions:r});if(n.unapproved.length===0)e.success("No unapproved build scripts found."),l.write&&(e.info(""),e.info("Nothing to write — there are no unapproved build scripts."));else{e.warn(`Found ${n.unapproved.length} package${n.unapproved.length===1?"":"s"} with unapproved build scripts:
|
|
33
|
+
`);for(const o of n.unapproved)e.info(` ${o.name} (${o.hooks.join(", ")})`);e.notice(""),e.notice("To approve these packages, add them to vis.config.ts:"),e.notice(""),e.notice(" security: {"),e.notice(" policies: {"),e.notice(" installScripts: {"),e.notice(" allow: {");for(const o of n.unapproved){const f=r&&o.version?`${o.name}@${o.version}`:o.name;e.notice(` "${f}": true,`)}if(e.notice(" },"),e.notice(" },"),e.notice(" },"),e.notice(" },"),h.name==="pnpm"&&(e.notice(""),e.notice("Or run 'pnpm approve-builds' to update pnpm-workspace.yaml directly.")),l.write){const o=t?.security?.pinVersions===!0,f=n.unapproved.map(m=>o&&m.version?`${m.name}@${m.version}`:m.name),p=B(i,f);switch(e.info(""),p.status){case"missing-anchor":{e.warn(`Could not locate 'defineConfig({' or 'export default {' in ${String(p.configPath)} — please add entries manually.`);break}case"no-config":{e.warn("No vis.config.ts found. Run 'vis init' first, then re-run with --write.");break}case"noop":{e.info(`All ${String(f.length)} entr${f.length===1?"y":"ies"} were already present in vis.config.ts security.policies.installScripts.allow.`);break}default:e.success(`Wrote ${String(p.added.length)} entr${p.added.length===1?"y":"ies"} to ${String(p.configPath)}.`),p.skipped.length>0&&e.info(`Skipped ${String(p.skipped.length)} already-present entr${p.skipped.length===1?"y":"ies"}.`)}}}if(n.excess.length>0){e.notice(""),e.warn(`Stale installScripts.allow entries — ${String(n.excess.length)} pattern${n.excess.length===1?"":"s"} no longer match any installed package:`);for(const o of n.excess)e.info(` ${o}`);e.notice("Consider removing these entries from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){e.notice(""),e.warn(`Version drift — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} pinned to an outdated version:`);for(const{from:o,to:f}of n.versionDrift)e.info(` ${o} → ${f}`);e.notice("Rename the keys in vis.config.ts security.policies.installScripts.allow to migrate.")}}if(l.syncNative){const a=t?.security?.policies?.installScripts?.allow??{};if(Object.keys(a).length===0)e.warn("No security.policies.installScripts.allow configured in vis.config.ts. Nothing to sync.");else{const r=q(h.name,i,a);e.info("");for(const n of r)e.success(n)}}};export{L as default};
|