@visulima/vis 1.0.0-alpha.41 → 1.0.0-alpha.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/LICENSE.md +265 -35
- package/dist/bin.js +1 -1
- package/dist/binx.js +2 -2
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.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/cli-exec.js +1 -0
- package/dist/packem_chunks/{bin.js → cli-main.js} +282 -274
- package/dist/packem_chunks/config.js +8 -11
- package/dist/packem_chunks/devtools.js +1 -78
- package/dist/packem_chunks/dispatch.js +4 -0
- package/dist/packem_chunks/doctor-probe.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 +1 -1
- package/dist/packem_chunks/handler13.js +3 -3
- 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/handler2.js +1 -4
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +5 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -5
- package/dist/packem_chunks/handler27.js +5 -1
- package/dist/packem_chunks/handler28.js +1 -3
- package/dist/packem_chunks/handler29.js +3 -1
- package/dist/packem_chunks/handler3.js +1 -4
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler31.js +1 -2
- package/dist/packem_chunks/handler32.js +2 -2
- package/dist/packem_chunks/handler33.js +2 -2
- package/dist/packem_chunks/handler34.js +2 -3
- package/dist/packem_chunks/handler35.js +3 -6
- package/dist/packem_chunks/handler36.js +6 -1
- package/dist/packem_chunks/handler37.js +1 -42
- package/dist/packem_chunks/handler38.js +42 -8
- package/dist/packem_chunks/handler39.js +8 -9
- package/dist/packem_chunks/handler4.js +4 -6
- package/dist/packem_chunks/handler40.js +9 -75
- package/dist/packem_chunks/handler41.js +75 -5
- package/dist/packem_chunks/handler42.js +5 -4
- package/dist/packem_chunks/handler43.js +4 -3
- package/dist/packem_chunks/handler44.js +3 -2
- package/dist/packem_chunks/handler45.js +2 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler47.js +1 -1
- package/dist/packem_chunks/handler48.js +1 -3
- package/dist/packem_chunks/handler49.js +3 -1
- package/dist/packem_chunks/handler5.js +4 -8
- package/dist/packem_chunks/handler50.js +1 -7
- package/dist/packem_chunks/handler51.js +6 -32
- package/dist/packem_chunks/handler52.js +33 -3
- package/dist/packem_chunks/handler53.js +3 -8
- package/dist/packem_chunks/handler54.js +6 -2
- package/dist/packem_chunks/handler55.js +4 -1
- package/dist/packem_chunks/handler56.js +1 -12
- package/dist/packem_chunks/handler57.js +11 -6
- package/dist/packem_chunks/handler58.js +3 -3
- package/dist/packem_chunks/handler59.js +5 -5
- package/dist/packem_chunks/handler6.js +6 -1
- package/dist/packem_chunks/handler60.js +2 -2
- package/dist/packem_chunks/handler61.js +1 -1
- package/dist/packem_chunks/handler62.js +4 -4
- package/dist/packem_chunks/handler63.js +3 -3
- package/dist/packem_chunks/handler64.js +4 -4
- package/dist/packem_chunks/handler65.js +9 -708
- package/dist/packem_chunks/handler66.js +6 -6
- package/dist/packem_chunks/handler67.js +4 -4
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +5 -5
- package/dist/packem_chunks/handler7.js +8 -1
- package/dist/packem_chunks/handler70.js +6 -6
- package/dist/packem_chunks/handler71.js +9 -9
- package/dist/packem_chunks/handler72.js +708 -48
- package/dist/packem_chunks/handler73.js +48 -27
- package/dist/packem_chunks/handler74.js +27 -3
- package/dist/packem_chunks/handler75.js +3 -190
- package/dist/packem_chunks/handler76.js +189 -37
- package/dist/packem_chunks/handler77.js +38 -0
- package/dist/packem_chunks/handler8.js +1 -1
- 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 +4 -4
- package/dist/packem_chunks/index2.js +1 -1
- package/dist/packem_chunks/index3.js +135 -0
- package/dist/packem_chunks/index4.js +74 -0
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +4 -0
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/orchestrator.js +3 -3
- package/dist/packem_chunks/prompts.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/registry.js +2 -2
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/shell-runner.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tar.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +2 -0
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_chunks/version-resolver.js +2 -2
- package/dist/packem_shared/CONFIG_FILES-MsOntfYT.js +1 -0
- package/dist/packem_shared/{Table-CcVkyULl-B_ef6zfS.js → Table-CcVkyULl-DLWu6XHL.js} +25 -26
- package/dist/packem_shared/{advisories-DLeO5KMN.js → advisories-aiDtubZQ.js} +1 -1
- package/dist/packem_shared/{affected-shas-cVnX8-zs.js → affected-shas-C1XuRlvo.js} +1 -1
- package/dist/packem_shared/{ai-analysis-BUeX2J2H.js → ai-analysis-CubpCxZJ.js} +4 -4
- package/dist/packem_shared/{ai-fix-9Vzlp6XU.js → ai-fix-Btd5AnSr.js} +2 -2
- package/dist/packem_shared/augment-8fIWWGSc.js +3 -0
- package/dist/packem_shared/bin-CnDBuLh3.js +2 -0
- package/dist/packem_shared/build-scripts-Doxce2VM.js +1 -0
- package/dist/packem_shared/command-runtime-RiCMa2C8.js +1 -0
- package/dist/packem_shared/compile-cache-B_Vf_WxT.js +3 -0
- package/dist/packem_shared/{cyclonedx-Cadls41z.js → cyclonedx-NUJ9R2GQ.js} +1 -1
- package/dist/packem_shared/dependency-scan-B0HV_qeB.js +1 -0
- package/dist/packem_shared/{docker-BMLrNtWm.js → docker-DKlF-gk3.js} +1 -1
- package/dist/packem_shared/failure-log-C7r6UZLP.js +2 -0
- package/dist/packem_shared/{giget-DHY1sQZC.js → giget-DVTFJlbR.js} +2 -2
- package/dist/packem_shared/glob-fqg4KepW-7Bs2kZuM.js +1 -0
- package/dist/packem_shared/index-BKFEWXU_.js +1 -0
- package/dist/packem_shared/index-CPhv-r4c.js +28 -0
- package/dist/packem_shared/{index-DGSsjmpV.js → index-Cb4x6lWY.js} +1 -1
- package/dist/packem_shared/index-DjTWo3sH.js +1 -0
- package/dist/packem_shared/{index-BDmTbWX1.js → index-OQZQyN5R.js} +1 -1
- package/dist/packem_shared/index.server-J83sowC4.js +2 -0
- package/dist/packem_shared/{lifecycle-4z9hHE5b.js → lifecycle-D5roTh0a.js} +2 -2
- package/dist/packem_shared/{lockfile-C8Q1_4KK.js → lockfile-DIGyLfmF.js} +1 -1
- package/dist/packem_shared/main-B3juSU5z.js +1 -0
- package/dist/packem_shared/manifests-pLwnVmCN.js +1 -0
- package/dist/packem_shared/{min-release-age-D1alDE3K.js → min-release-age-pUAqTiv3.js} +3 -3
- package/dist/packem_shared/missing-package-json-DhYzuKhD.js +1 -0
- package/dist/packem_shared/{native-config-sync-BEkJW7g3.js → native-config-sync-4K9wWTj5.js} +1 -1
- package/dist/packem_shared/{osv-bloom-B03tUWf3.js → osv-bloom-OuTfu_LE.js} +1 -1
- package/dist/packem_shared/{pm-runner-BKZQo7Ts.js → pm-runner-Dws_Bw1y.js} +1 -1
- package/dist/packem_shared/provenance-C0P-UYOM.js +1 -0
- package/dist/packem_shared/readJsonSync-CvkZyKmL-CY7PZob_.js +4 -0
- package/dist/packem_shared/registry-keys-D4chF-Wj.js +1 -0
- package/dist/packem_shared/{resolve-explicit-C6WM-I2u.js → resolve-explicit-Cgheka3B.js} +3 -3
- package/dist/packem_shared/resolve-runtime-CJSWV-K8.js +1 -0
- package/dist/packem_shared/run-file-B4TqKa0X.js +1 -0
- package/dist/packem_shared/runtime-check-0lUJvgKt.js +1 -0
- package/dist/packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js +1 -0
- package/dist/packem_shared/s1ngularity-Du1NnSFP.js +1 -0
- package/dist/packem_shared/scan-progress-CN9ONR0y.js +2 -0
- package/dist/packem_shared/{selectors-GCJIe342.js → selectors-UmnAuc26.js} +1 -1
- package/dist/packem_shared/{signatures-Xpd6HjG_.js → signatures-BOUhghTv.js} +1 -1
- package/dist/packem_shared/{spinner-CV3WVJLv.js → spinner-lhXugSx3.js} +1 -1
- package/dist/packem_shared/tabs-DTiU3usb.js +1 -0
- package/dist/packem_shared/target-options-ChWcK60i.js +1 -0
- package/dist/packem_shared/toolchain-DyCKnGch.js +5 -0
- package/dist/packem_shared/typosquats-DBOvXwph.js +1 -0
- package/dist/packem_shared/use-measured-height-CK2Co3XI.js +1 -0
- package/dist/packem_shared/verify-CVPYlUrF.js +1 -0
- package/dist/packem_shared/vis-update-app-DtHkwBca.js +1 -0
- package/dist/packem_shared/watch-Bkp_AAbc.js +1 -0
- package/dist/packem_shared/watch-loop-D9zbXzRd.js +11 -0
- package/dist/runtime/preload.d.ts +1 -0
- package/dist/runtime/preload.js +1 -0
- package/index.d.ts +215 -201
- package/index.js +28 -27
- package/package.json +17 -26
- package/dist/packem_shared/CONFIG_FILES-BfaR0jKT.js +0 -1
- package/dist/packem_shared/build-scripts-CCCi8U66.js +0 -1
- package/dist/packem_shared/command-runtime-CR70qSUM.js +0 -1
- package/dist/packem_shared/dependency-scan-DnTgYleU.js +0 -1
- package/dist/packem_shared/failure-log-CEWP3bP0.js +0 -2
- package/dist/packem_shared/glob-fqg4KepW-B7EjLRvw.js +0 -1
- package/dist/packem_shared/index-3jMNqQom.js +0 -1
- package/dist/packem_shared/index-Bt521H5J.js +0 -30
- package/dist/packem_shared/manifests-Dj3pRKBT.js +0 -1
- package/dist/packem_shared/missing-package-json-8vNHwbqw.js +0 -1
- package/dist/packem_shared/provenance-BFEwKgI3.js +0 -1
- package/dist/packem_shared/registry-keys-BfFto6vI.js +0 -1
- package/dist/packem_shared/runtime-check-Stc9AI78.js +0 -1
- package/dist/packem_shared/s1ngularity-DCPmPE5M.js +0 -1
- package/dist/packem_shared/scan-progress-CFhc0CMj.js +0 -2
- package/dist/packem_shared/tabs-BuTy5gPV.js +0 -1
- package/dist/packem_shared/toolchain-pR7AJ-tB.js +0 -5
- package/dist/packem_shared/typosquats-DN78xx1x.js +0 -1
- package/dist/packem_shared/use-measured-height-_eVGWtWt.js +0 -1
- package/dist/packem_shared/verify-6WCmFmy8.js +0 -1
- package/dist/packem_shared/vis-update-app-k3fDxech.js +0 -1
- package/dist/packem_shared/watch-BvIwLG4N.js +0 -1
- package/dist/packem_shared/watch-loop-DWkvv2tK.js +0 -11
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as d}from"node:module";import{m as p,H as v}from"../packem_shared/index-OQZQyN5R.js";const f=d(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[r,s]=i.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return i.getBuiltinModule(e)}return f(e)},{spawnSync:l}=u("node:child_process"),{readFileSync:h,statSync:g}=u("node:fs"),m={npm:{pm:"npm",runner:!1},npx:{pm:"npm",runner:!0},pnpm:{pm:"pnpm",runner:!1},pnpx:{pm:"pnpm",runner:!0},yarn:{pm:"yarn",runner:!1},yarnpkg:{pm:"yarn",runner:!1}},y=new Set(["create","dlx","exec","init"]),a=e=>{try{return g(e).isFile()}catch{return!1}},_=e=>e==="npm"||e==="pnpm"||e==="yarn"?e:void 0,w=e=>{const r=[["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"],["npm-shrinkwrap.json","npm"]];let s=e;for(;;){const t=p(s,"package.json");if(a(t))try{const o=JSON.parse(h(t,"utf8")).packageManager;if(typeof o=="string"&&o.length>0){const c=_(o.split("@")[0]);if(c!==void 0)return c}}catch{}for(const[o,c]of r)if(a(p(s,o)))return c;const n=v(s);if(n===s)return;s=n}},x=()=>process.env.npm_config_user_agent!==void 0||process.env.npm_execpath!==void 0,k=(e,r,s,t)=>{const n=m[e];if(n===void 0)return"dispatch";const o=n.runner||s!==void 0&&y.has(s);return r!==void 0&&n.pm!==r&&!o&&!t?"refuse":"dispatch"},S=e=>{const r=process.platform==="win32"?[`${e}.cmd`,`${e}.exe`,e]:[e];for(const s of(process.env.PATH??"").split(process.platform==="win32"?";":":"))if(!(s===""||s.replace(/[/\\]+$/u,"").endsWith(p(".vis","shims"))))for(const t of r){const n=p(s,t);if(a(n))return n}},b=(e,r)=>{m[e]===void 0&&(process.stderr.write(`vis: ${e} is not a known package-manager shim.
|
|
2
|
+
`),process.exit(1));const s=w(process.cwd());k(e,s,r[0],x())==="refuse"&&(process.stderr.write(`vis: this project uses ${String(s)}, but \`${e}\` was run. Use \`${String(s)}\` instead, or run \`vis shim uninstall\` to disable the PM guard.
|
|
3
|
+
`),process.exit(1));const t=S(e);t===void 0&&(process.stderr.write(`vis: \`${e}\` was not found on PATH (outside the shim dir).
|
|
4
|
+
`),process.exit(1));const n=l(t,r,{stdio:"inherit"});process.exit(n.status??(n.signal===null?0:1))};export{k as decideShim,b as dispatchShim};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I as p,V as u,j as l,E as i,q as h,s as g}from"../packem_shared/
|
|
1
|
+
import{I as p,V as u,j as l,E as i,q as h,s as g}from"../packem_shared/index.server-J83sowC4.js";import{resolveTurboEnvCompat as d,ReapiRemoteCache as m}from"@visulima/task-runner";import{p as b}from"./cli-main.js";const f=(t,r)=>r==="http"||r==="reapi"?r:t.startsWith("grpc://")||t.startsWith("grpcs://")?"reapi":"http",$=async(t,r)=>{const o=Date.now(),a=new AbortController,e=setTimeout(()=>{a.abort()},r);try{const s=await fetch(t,{method:"HEAD",signal:a.signal});return{backend:"http",durationMs:Date.now()-o,httpStatus:s.status,ok:!0,url:t}}catch(s){return{backend:"http",durationMs:Date.now()-o,error:s instanceof Error?s.message:String(s),ok:!1,url:t}}finally{clearTimeout(e)}},k=async(t,r)=>{const o=Date.now(),a=new m({...t,timeout:r});try{return{backend:"reapi",capabilities:await a.probeCapabilities(),durationMs:Date.now()-o,ok:!0,url:t.url}}catch(e){return{backend:"reapi",durationMs:Date.now()-o,error:e instanceof Error?e.message:String(e),ok:!1,url:t.url}}finally{try{await a.close()}catch{}}},w=t=>{const r=[],o=t.ok?p("OK"):u("FAIL");if(r.push(`${l("Remote cache")} ${o}`),r.push(` ${i("URL:")} ${h(t.url)}`),r.push(` ${i("Backend:")} ${t.backend}`),r.push(` ${i("Latency:")} ${String(t.durationMs)}ms`),t.httpStatus!==void 0&&r.push(` ${i("Status:")} ${String(t.httpStatus)}`),t.capabilities){const a=t.capabilities.digestFunctions.length>0?t.capabilities.digestFunctions.join(", "):g("(none advertised)");r.push(` ${i("Digests:")} ${a}`),r.push(` ${i("Batch:")} ${String(t.capabilities.maxBatchTotalSizeBytes)} bytes`)}return t.error&&r.push(` ${i("Error:")} ${u(t.error)}`),r.join(`
|
|
2
2
|
`)},D=async({logger:t,options:r,visConfig:o})=>{const a=d((o??{}).taskRunner?.remoteCache),e=r.url??a?.url,s=r.format??"table",c=r.timeout??5e3;if(!e){b.error("No remote cache configured. Set taskRunner.remoteCache.url in vis.config.ts, pass --url=..., or export TURBO_API."),process.exitCode=1;return}const n=f(e,r.backend)==="reapi"?await k({...a??{url:e},backend:"reapi",url:e},c):await $(e,c);s==="json"?t.log(JSON.stringify(n,null,2)):t.log(w(n)),n.ok||(process.exitCode=1)};export{D as cacheDoctorExecute};
|
|
@@ -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/
|
|
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-OQZQyN5R.js";import{a as J,r as D,b as m,c as E}from"../packem_shared/ai-fix-Btd5AnSr.js";import{p}from"./cli-main.js";import{l as N}from"../packem_shared/failure-log-C7r6UZLP.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{I as p,W as d}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{r as g,a as k}from"../packem_shared/command-runtime-RiCMa2C8.js";import{i as v}from"../packem_shared/utils-Cxree603.js";const h=async({argument:l,logger:a,options:e,visConfig:o,workspaceRoot:c})=>{const s=l;if(!s||s.length===0)throw new Error("No command specified. Usage: vis exec <command> [args...]");const[i,...t]=s,r=c??process.cwd(),m=g({logger:a,options:e,visConfig:o},r),f=p(r,{backend:k(m),configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),n=d(f,{args:t,command:i,filter:v(e.filter),parallel:e.parallel||!1,recursive:e.recursive||!1,reverse:e.reverse||!1,shellMode:e.shellMode||!1,workspaceRoot:e.workspaceRoot||!1},r,a);n!==0&&(process.exitCode=n)};export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as
|
|
1
|
+
import{I as t,x as l}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{r as p,a as m}from"../packem_shared/command-runtime-RiCMa2C8.js";const g=async({logger:n,options:a,visConfig:o,workspaceRoot:c})=>{const s=c??process.cwd(),i=p({logger:n,options:a,visConfig:o},s),r=t(s,{backend:m(i),configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),e=l(r,a.check||!1,s,n);e!==0&&(process.exitCode=e)};export{g as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as
|
|
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-OQZQyN5R.js";import{t as y}from"./cli-main.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{I as f,P as d}from"../packem_shared/pm-runner-
|
|
1
|
+
import{I as f,P as d}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{r as k,a as m}from"../packem_shared/command-runtime-RiCMa2C8.js";const v=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{v as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as A}from"node:module";import{m,y as
|
|
1
|
+
import{createRequire as A}from"node:module";import{m,y as M,f as $,T as S}from"../packem_shared/index-OQZQyN5R.js";import{N as F,U as h}from"./config.js";import{p as e}from"./cli-main.js";import{w as I}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{w as P}from"../packem_shared/build-scripts-Doxce2VM.js";import{O as R}from"../packem_shared/native-config-sync-4K9wWTj5.js";import{S as T}from"../packem_shared/min-release-age-pUAqTiv3.js";const B=A(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=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 B(t)},{execFileSync:E}=x("node:child_process"),{createInterface:N}=x("node:readline"),q=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},C=(t,s)=>new Promise(o=>{t.question(s,i=>{o(i.trim())})}),u=async(t,s,o=!0)=>{const i=await C(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}
|
|
@@ -21,7 +21,7 @@ ${o.join(`
|
|
|
21
21
|
|
|
22
22
|
`)}
|
|
23
23
|
});
|
|
24
|
-
`},G=async(t,s,o)=>{const i=
|
|
24
|
+
`},G=async(t,s,o)=>{const i=N({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 D=await u(i," Enforce a minimum release age (block freshly-published versions)?");let d;if(D){const c=await C(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
|
|
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 D=await u(i," Enforce a minimum release age (block freshly-published versions)?");let d;if(D){const c=await C(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 b=!1;(s.name==="pnpm"||s.name==="yarn"||s.name==="npm"||s.name==="bun")&&(e.info(""),b=await u(i,` Sync security settings to ${s.name} config?`));const v=q(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{E(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});S(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 O=w(s.name,{allowBuilds:p,enableDepsDev:n,enableSocket:a,minimumReleaseAge:d,staged:y});if(S(o,O),e.success(`Created ${o}`),b){const c=Object.fromEntries(Object.entries(p).filter(([,r])=>r));for(const r of R(s.name,t,c))e.success(` ${r}`);for(const r of T(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: ${b?"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(S(i,a),e.success(`Created ${i}`),e.info(" Secure defaults are applied automatically by defineConfig()."),o.syncNative){for(const n of R(s.name,t,{}))e.success(` ${n}`);for(const n of T(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=M(i,a),l=n===""?`./${o}`:n.split(/[/\\]/u).join("/");return l.startsWith(".")?l:`./${l}`},Y=(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){Y(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 G(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/
|
|
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-Du1NnSFP.js";import{g as P,a as j,r as B}from"../packem_shared/provenance-C0P-UYOM.js";import{r as D}from"../packem_shared/signatures-BOUhghTv.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,H=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 w,f as _,H as B,j as A}from"../packem_shared/index-
|
|
1
|
+
import{m as w,f as _,H as B,j as A}from"../packem_shared/index-OQZQyN5R.js";import{p as t}from"./cli-main.js";import{w as F,I as h,p as H,h as T}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{a as M,r as N}from"../packem_shared/command-runtime-RiCMa2C8.js";import{s as Q}from"../packem_shared/typosquats-DBOvXwph.js";import{h as U,P as V}from"../packem_shared/peer-warnings-BXAzXqY3.js";import{i as W}from"../packem_shared/utils-Cxree603.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(_(w(r,l)))return!0;const n=B(r);if(n===r||A(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:C}=a,s=C??process.cwd();if(r&&r.length>0){const o=e,{default:q}=await import("./handler16.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,$=e.dev===!0,L={autoInstallPeers:!1,exact:o.exact===!0,filter:e.filter,global:!1,marshallCheck:I,runScripts:P,saveDev:$,saveOptional:D,savePeer:!1,socketCheck:z,to:void 0,typosquatCheck:E,workspace:!1,workspaceRoot:j};await q({...a,argument:r,options:L});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(w(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 E}from"node:module";import{I as x,E as j,V as T,s as A}from"../packem_shared/
|
|
1
|
+
import{createRequire as E}from"node:module";import{I as x,E as j,V as T,s as A}from"../packem_shared/index.server-J83sowC4.js";import{m as L,O as B}from"../packem_shared/index-OQZQyN5R.js";import{l as b,c as N,p as f,f as F,b as z,P as U,R as V,Q as Y,S as H,X as C,Y as J,Z as Q,_ as $,B as W,a0 as X}from"./cli-main.js";import"../packem_shared/public-api-WqUCiyIe.js";import{I as Z,M as G,R as K}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{r as ee,a as se}from"../packem_shared/command-runtime-RiCMa2C8.js";import{r as P,a as oe,p as te,b as ne}from"../packem_shared/resolve-explicit-Cgheka3B.js";import{r as re}from"../packem_shared/typosquats-DBOvXwph.js";import{f as _,i as R}from"../packem_shared/utils-Cxree603.js";import{a as ae}from"../packem_shared/readJsonSync-CvkZyKmL-CY7PZob_.js";const q=E(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=o=>{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(o)}return q(o)},{createInterface:O}=I("node:readline"),S=o=>o==="default"?"catalog:":`catalog:${o}`,v=o=>o==="default"?"default catalog":`catalog "${o}"`,ie=(o,c)=>{const e=[];for(const[s,t]of c)s.includes(":")||t.has(o)&&e.push(s);if(e.length===0)return;if(e.length===1){const[s]=e;return{source:v(s),spec:S(s)}}const r=e.find(s=>s==="default")??e[0],a=e.filter(s=>s!==r);return{candidates:[...e],conflict:!0,source:`${v(r)} (also in: ${a.map(s=>v(s)).join(", ")})`,spec:S(r)}},ce=(o,c)=>{const e=new Map;for(const[i,u]of c){if(!i.includes(":"))continue;const p=u.get(o);p!==void 0&&e.set(p,(e.get(p)??0)+1)}if(e.size===0)return;const r=[...e.entries()],a=r.reduce((i,[,u])=>i+u,0);if(r.length===1){const[[i]]=r;return{source:`siblings (${String(a)} pkg${a===1?"":"s"} on ${i})`,spec:i}}const s=[...r].sort((i,u)=>u[1]-i[1]),[t,n]=s[0],l=s.slice(1).map(([i,u])=>`${i} (×${String(u)})`);return{candidates:s.map(([i])=>i),conflict:!0,source:`siblings (most common: ${t} ×${String(n)}; conflicts: ${l.join(", ")})`,spec:t}},le=(o,c)=>ie(o,c)||ce(o,c),pe=(o,c,e)=>{const r=[];for(const a of o.values()){const{overall:s}=a.score,t=W(s),n=`${String(Math.round(s*100))}%`,l=a.alerts.length,i=$(a),u=H(i,a.version,e),p=t==="red"?T:t==="yellow"?A:x;if(u?f.info(` ${p(n)} ${C(a)} ${j(`[accepted: ${u.reason}]`)}`):f.info(` ${p(n)} ${C(a)}`),l>0){const g=a.alerts.filter(d=>d.severity==="critical"||d.severity==="high").length;g>0&&f.warn(` ${String(g)} critical/high alert${g===1?"":"s"}`)}s<c&&!u&&r.push(a)}return r},fe=async(o,c)=>{const e=O({input:process.stdin,output:process.stdout}),r=n=>new Promise(l=>{e.question(n,i=>{l(i.trim())})}),a=String(Math.round(c*100));f.warn(""),f.warn(`${String(o.length)} package${o.length===1?"":"s"} scored below the minimum threshold (${a}%):`);for(const n of o){const l=$(n),i=`${String(Math.round(n.score.overall*100))}%`;f.warn(` • ${l}@${n.version} — score: ${i} (${J(n.score.overall)})`)}f.warn("");const s=await r("Continue adding these packages? [y/N] ");if(s.toLowerCase()!=="y"&&s.toLowerCase()!=="yes")return e.close(),!1;const t=await r("Remember this decision? (prints config snippet) [y/N] ");if(e.close(),t.toLowerCase()==="y"||t.toLowerCase()==="yes"){f.notice(""),f.notice("Add the following to security.acceptedRisks in vis.config.ts:"),f.notice("");for(const n of o){const l=$(n),i=Q(l,n.version,n.score.overall,"Reviewed and accepted");f.notice(i)}f.notice("")}return!0},ue=async(o,c,e,r)=>{const a=await P(o);if(a.length===0)return!0;f.info(""),f.info(`${c.map(n=>n.displayName).join(" + ")} security check:`);const s=await F(c,a);if(s.size===0)return f.info(" Could not fetch security data. Proceeding."),!0;const t=pe(s,e,r);return t.length===0?(f.info(""),!0):process.stdin.isTTY?fe(t,e):(f.warn(`Aborting: ${String(t.length)} package${t.length===1?"":"s"} below minimum score. Use --no-socket-check to skip.`),!1)},de=["dependencies","devDependencies","peerDependencies","optionalDependencies"],ge=o=>o.savePeer?"peerDependencies":o.saveOptional?"optionalDependencies":o.saveDev?"devDependencies":"dependencies",D=(o,c)=>o.startsWith("catalog:")||!c?o:o.replace(/^[\^~]/,""),me=async(o,c)=>{const e=[];for(const s of o){const{name:t,versionSpec:n}=_(s);if(!t)continue;if(n!==void 0){e.push({explicit:n,name:t});continue}const l=le(t,c);if(l){l.conflict&&f.warn(`${t}: ambiguous constraint — picking ${l.spec} (${l.source}). Pass ${t}@<version> to override.`),e.push({entry:{name:t,source:l.source,spec:l.spec},kind:"resolved",name:t});continue}e.push({kind:"missing",name:t})}const r=e.filter(s=>"kind"in s&&s.kind==="missing").map(s=>s.name),a=r.length>0?await ne(r):new Map;return e.map(s=>{if("explicit"in s)return{name:s.name,source:"explicit",spec:s.explicit};if(s.kind==="resolved")return s.entry;const t=a.get(s.name);if(t===void 0)throw new Error(`--to: cannot resolve a version for "${s.name}" (not in any catalog or sibling, and registry lookup failed). Pass ${s.name}@<version> explicitly.`);const n=`^${t}`;return f.info(`${s.name}: no existing constraint — using registry latest (${n}). Add to a catalog to share this version across workspace packages.`),{name:s.name,source:"registry latest",spec:n}})},he=(o,c,e,r)=>{for(const{name:a,spec:s}of c){const t=D(s,r);for(const l of de){if(l===e)continue;const i=o[l];i?.[a]!==void 0&&(delete i[a],Object.keys(i).length===0&&delete o[l])}let n=o[e];n===void 0&&(n={},o[e]=n),n[a]=t}},ke=async({ignoreScripts:o,logger:c,options:e,packages:r,pm:a,target:s,visConfig:t,workspaceRoot:n})=>{const{workspace:l}=z(n,t??{}),i=l.projects[s];if(!i){const m=Object.keys(l.projects).sort();throw new Error(`--to: workspace package "${s}" not found. Available: ${m.length>0?m.slice(0,10).join(", "):"(none)"}${m.length>10?`, ... (${String(m.length-10)} more)`:""}.`)}const u=L(n,i.root,"package.json"),{packageManager:p}=U(n),g=V(n,p),d=ge(e),k=e.exact??!1,h=await me(r,g);if(h.length===0)return 0;const y=ae(u);he(y,h,d,k),B(u,y,{indent:Y(u,{useEditorconfig:t?.editorconfig??!0}),overwrite:!0});for(const m of h){const M=D(m.spec,k);f.info(`${x("+")} ${m.name}@${M} → ${s}/${d} (${j(m.source)})`)}return K(a,{dev:!1,filter:[],force:!1,frozenLockfile:!1,ignoreScripts:o,lockfileOnly:!1,noOptional:!1,offline:!1,prod:!1,recursive:!1,silent:!1,workspaceRoot:!1},n,c)},_e=async({argument:o,logger:c,options:e,visConfig:r,workspaceRoot:a})=>{let s=o;if(!s||s.length===0)throw new Error("No packages specified. Usage: vis add <packages...>");if(e.typosquatCheck!==!1){const p=s.map(d=>_(d)),g=await re(p.map(d=>d.name),r?.security?.typosquatAllowlist);if(!g.ok){process.exitCode=1;return}s=p.map((d,k)=>{const h=g.packages[k];return h!==d.name?d.versionSpec?`${h}@${d.versionSpec}`:h??"":s[k]??""})}if(e.marshallCheck!==!1){const p=await P(s);if(p.length>0){const g=await oe(p,{config:r?.security?.marshalls,workspaceRoot:a});if(!await te(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=N(r?.security,{disabled:p,minimumScore:r?.security?.policies?.score?.minimum});if(g.length>0){const d=r?.security?.policies?.score?.minimum??X;if(!await ue(s,g,d,r?.security?.acceptedRisks)){process.exitCode=1;return}}}const t=process.cwd(),n=ee({logger:c,options:e,visConfig:r},a??t),l=Z(a??t,{backend:se(n),configBackend:r?.install?.backend,configCorepack:r?.install?.corepack}),i=!e.runScripts;if(e.to){if(e.global||e.workspaceRoot)throw new Error("--to is incompatible with --global / --workspace-root.");if(e.filter&&R(e.filter).length>0)throw new Error("--to and --filter are mutually exclusive — --to already targets one package.");if(!a)throw new Error("--to requires a monorepo workspace. Run from inside a pnpm/bun/yarn/npm workspace.");const p=await ke({ignoreScripts:i,logger:c,options:e,packages:s,pm:l,target:e.to,visConfig:r,workspaceRoot:a});p!==0&&(process.exitCode=p);return}const u=G(l,{exact:e.exact||!1,filter:R(e.filter),global:e.global||!1,optional:e.saveOptional||!1,packages:s,peer:e.savePeer||!1,saveDev:e.saveDev||!1,workspace:e.workspace||!1,workspaceRoot:e.workspaceRoot||!1},t,c,{autoInstallPeers:e.autoInstallPeers||!1,ignoreScripts:i});u!==0&&(process.exitCode=u)};export{_e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as m,j as p}from"../packem_shared/pm-runner-
|
|
1
|
+
import{I as m,j as p}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{r as g,a as d}from"../packem_shared/command-runtime-RiCMa2C8.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{I as g,B as m}from"../packem_shared/pm-runner-
|
|
1
|
+
import{I as g,B as m}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{r as u,a as f}from"../packem_shared/command-runtime-RiCMa2C8.js";const b=async({argument:s,logger:i,options:t,visConfig:e,workspaceRoot:c})=>{const o=s;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[r,...l]=o,n=c??process.cwd(),p=u({logger:i,options:t,visConfig:e},n),d=g(n,{backend:f(p),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),a=m(d,r,l,n,i);a!==0&&(process.exitCode=a)};export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as p,D as f}from"../packem_shared/pm-runner-
|
|
1
|
+
import{I as p,D as f}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{r as g,a as k}from"../packem_shared/command-runtime-RiCMa2C8.js";import{i as m}from"../packem_shared/utils-Cxree603.js";const w=async({argument:t,logger:r,options:e,visConfig:o,workspaceRoot:n})=>{const a=t;if(!a||a.length===0)throw new Error("No packages specified. Usage: vis remove <packages...>");const s=process.cwd(),c=g({logger:r,options:e,visConfig:o},n??s),l=p(n??s,{backend:k(c),configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),i=f(l,{filter:m(e.filter),global:e.global||!1,packages:a,recursive:e.recursive||!1,saveDev:e.saveDev||!1,workspaceRoot:e.workspaceRoot||!1},s,r);i!==0&&(process.exitCode=i)};export{w as default};
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)}
|
|
3
|
-
`);return}s.info(`Affected projects: ${t.join(", ")}`),n.changedFiles.length>0&&(process.env.VIS_AFFECTED_FILES=n.changedFiles.join(`
|
|
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
|
+
import{I as k,$ as d}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{r as m,a as u}from"../packem_shared/command-runtime-RiCMa2C8.js";const h=async({argument:c,logger:n,options:a,visConfig:e,workspaceRoot:r})=>{const o=c;if(!o||o.length===0)throw new Error("No package specified. Usage: vis dlx <package[@version]> [args...]");const[l,...t]=o,s=r??process.cwd(),g=m({logger:n,options:a,visConfig:e},s),p=k(s,{backend:u(g),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),f=a.package?Array.isArray(a.package)?a.package:[a.package]:[],i=d(p,{additionalPackages:f,args:t,package:l,shellMode:a.shellMode||!1,silent:a.silent||!1},s,n,{offline:a.offline||!1});i!==0&&(process.exitCode=i)};export{h as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{readLastRunSummary as k,getLastRunSummaryPath as g}from"@visulima/task-runner";import{p as m,
|
|
1
|
+
import{readLastRunSummary as k,getLastRunSummaryPath as g}from"@visulima/task-runner";import{p as m,x as S,y as h,z as x,A as p}from"./cli-main.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)})`,o=(t,a)=>t.length>=a?t:t+" ".repeat(a-t.length),y=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("")},w=(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(` ${o("task",i.taskId)} ${o("status",i.status)} ${o("duration",i.duration)} ${o("hash",i.hash)}`),a.info(` ${"-".repeat(i.taskId)} ${"-".repeat(i.status)} ${"-".repeat(i.duration)} ${"-".repeat(i.hash)}`);for(const s of e)a.info(` ${o(s.taskId,i.taskId)} ${o(s.status,i.status)} ${o(s.duration,i.duration)} ${o(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(` ${o("id",i.id)} ${o("mtime",i.mtime)}`),e.info(` ${"-".repeat(i.id)} ${"-".repeat(i.mtime)}`);for(const s of t)e.info(` ${o(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=>y(i))),e},M=async(t,a)=>{const{failed:e,format:i,runId:s,task:r,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:r});if(r!==void 0&&f.length===0){if(i==="json"){process.stdout.write(`${JSON.stringify({error:"task-not-in-summary",runId:n.id,taskId:r},void 0,2)}
|
|
4
4
|
`),process.exitCode=1;return}m.error(`Task "${r}" 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{B as k,a as B,H as g}from"../packem_shared/index-
|
|
1
|
+
import{B as k,a as B,H as g}from"../packem_shared/index-OQZQyN5R.js";import{b as h,O as j,p as m}from"./cli-main.js";import{b as v,s as y}from"../packem_shared/cyclonedx-NUJ9R2GQ.js";const l=["json","xml"],C=n=>l.includes(n),R=async({fs:n,options:e,visConfig:d,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run inside a monorepo.");const{packageJsons:f,workspace:i}=h(o,d),u=j(o,i,f),c=e.focus,w=c?c.split(",").map(b=>b.trim()).filter(Boolean):void 0,s=(e.format??"json").toLowerCase();if(!C(s))throw new Error(`Unknown --format: "${s}". Expected one of: ${l.join(", ")}.`);const t=v({focus:w,includeDev:!!e.includeDev,projectGraph:u,workspace:i,workspaceRoot:o}),a=s==="xml"?y(t):`${JSON.stringify(t,void 0,2)}
|
|
2
2
|
`,p=e.output??(s==="xml"?"sbom.cdx.xml":"sbom.cdx.json");if(p==="-"){process.stdout.write(a);return}const r=k(o,p);B(g(r)),await n.writeFile(r,a,"utf8");const x=t.components?.length??0,$=t.dependencies?.length??0;m.success(`SBOM written to ${r}`),m.notice(`${x} components, ${$} dependency edges`)};export{R as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as
|
|
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)?N(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}`)},
|
|
1
|
+
import{createRequire as M}from"node:module";import{b as _}from"../packem_shared/index-OQZQyN5R.js";import{p as c,K as N,L as I,b 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 L,d as P,e as z}from"../packem_shared/lifecycle-D5roTh0a.js";import{r as G,l as q}from"../packem_shared/target-options-ChWcK60i.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=P();return await z(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 I(s),{projectOptions:t,workspace:n}=A(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=G(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},ee=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)},te=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 L(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"]),re=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
|
+
`);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)?N(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}`)},oe=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}},se=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)},ie=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{re as serviceListExecute,ie as serviceLogsExecute,se as serviceRestartExecute,ee as serviceStartExecute,oe as serviceStatusExecute,te as serviceStopExecute};
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createRequire as h}from"node:module";import{m as a}from"../packem_shared/index-OQZQyN5R.js";const u=h(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[o,s]=i.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return i.getBuiltinModule(e)}return u(e)},{chmodSync:d}=p("node:fs"),l=["npm","npx","pnpm","pnpx","yarn","yarnpkg"],r=process.platform==="win32",m=e=>a(e.process.cwd,".vis","shims"),f=(e,o,s)=>r?`@echo off\r
|
|
2
|
+
"${e}" "${o}" __pm-shim ${s} %*\r
|
|
3
|
+
`:`#!/bin/sh
|
|
4
|
+
exec "${e}" "${o}" __pm-shim ${s} "$@"
|
|
5
|
+
`,$=async e=>{const o=process.argv[1];if(o===void 0){e.console.error("vis shim install: could not resolve the vis entry path."),e.process.exit(1);return}const s=process.execPath,n=m(e);await e.fs.mkdir(n,{recursive:!0});for(const t of l){const c=a(n,r?`${t}.cmd`:t);await e.fs.writeFile(c,f(s,o,t)),r||d(c,493)}e.console.log(`Installed ${String(l.length)} PM shims in ${n}`),e.console.log(""),e.console.log("Add the shim dir to PATH (project-local) to activate the PM guard, e.g. in .envrc:"),e.console.log(` export PATH="${n}:$PATH"`),e.console.log("Remove with `vis shim uninstall`.")},_=async e=>{const o=m(e);await e.fs.rm(o,{force:!0,recursive:!0}),e.console.log(`Removed ${o}.`),e.console.log("If you added it to PATH (e.g. .envrc), remove that line too.")},P=async e=>{const o=m(e);if(!await e.fs.stat(o).then(t=>t.isDirectory()).catch(()=>!1)){e.console.log("PM shims: not installed. Run `vis shim install`.");return}const s=[];for(const t of l){const c=a(o,r?`${t}.cmd`:t);await e.fs.stat(c).then(()=>!0).catch(()=>!1)||s.push(t)}const n=(e.process.env.PATH??"").split(r?";":":").includes(o);e.console.log(`PM shims: installed in ${o}`),s.length>0&&e.console.log(`WARNING: ${String(s.length)} shim(s) missing (${s.join(", ")}). Re-run \`vis shim install\`.`),e.console.log(n?"PATH: active (shim dir is on PATH).":"PATH: NOT on PATH — the guard is inactive until you add it.")};export{$ as shimInstallExecute,P as shimStatusExecute,_ as shimUninstallExecute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as
|
|
1
|
+
import{E as w}from"../packem_shared/index.server-J83sowC4.js";import{A as b,m as y}from"../packem_shared/index-OQZQyN5R.js";import{b as C}from"./cli-main.js";import{a as R,b as j,s as E,i as x,c as B,p as D,d as P,r as N,e as A}from"../packem_shared/subtree-C7bZuiSQ.js";import{l as M,o as v}from"../packem_shared/utils-Cxree603.js";const S=async(p,m,r)=>{const o=m[p];if(o?.root)return{pkgName:p,relativeDir:v(o.root)};const i=v(p);if(i.length>0&&await r(i))return{pkgName:i.split("/").pop()??i,relativeDir:i}},U=async({argument:p,fs:m,logger:r,options:o,process:i,visConfig:g,workspaceRoot:k})=>{const d=p[0];if(!d)throw new Error("Missing <package>. Pass a project name or a workspace-relative path.");if(!o.dryRun&&!o.output)throw new Error("Missing --output <dir>. Pass the destination directory for the new repo (or use --dry-run).");const t=k??i.cwd;R(t);const{workspace:h}=C(t,g),l=async a=>{try{return await m.access(a),!0}catch{return!1}},$=await S(d,h.projects,a=>l(y(t,a,"package.json")));if(!$){const a=Object.keys(h.projects).sort().join(", ");throw new Error(`Unknown package "${d}". Known projects: ${a||"(none)"}.`)}const{pkgName:f,relativeDir:n}=$,s=o.branch??g?.defaultBase??"main",u=`vis/split/${M(n.replaceAll("/","-"))}`,c=o.output?b(o.output)?o.output:y(t,o.output):void 0;if(o.dryRun){r.info("Dry run — no changes will be made. Planned git commands:"),r.info(` git subtree split --prefix=${n}${o.annotate?` --annotate=(${f}) `:""} -b ${u}`),c&&(r.info(` git -C ${c} init -b ${s}`),r.info(` git -C ${c} pull ${t} ${u}`)),o.remote&&r.info(` git -C ${c??"<output>"} remote add origin ${o.remote}`),o.push&&r.info(` git -C ${c??"<output>"} push -u origin ${s}`),o.remove&&r.info(` git rm -r ${n} && git commit (in ${t})`);return}const e=c;if(await l(e)){if((await m.readdir(e)).length>0&&!o.force)throw new Error(`${e} is not empty. Re-run with --force to use it anyway.`)}else await m.mkdir(e,{recursive:!0});o.remove&&j(t),r.info(`Splitting ${w(n)} → ${e} ...`);try{E({annotate:o.annotate?`(${f}) `:void 0,branch:u,cwd:t,prefix:n}),x({branch:s,source:t,sourceBranch:u,target:e}),o.remote?(B("origin",o.remote,e),o.push&&D("origin",s,e)):o.push&&r.warn("--push ignored: no --remote provided.");const a=P(s,e);r.info(`✓ Extracted ${f} with ${a} commit(s) to ${e}`),o.remove&&(N(n,`chore(${f}): split out to standalone repo`,t),r.info(`✓ Removed ${n} from the monorepo (committed).`)),o.remote||r.info(w(`Next: cd ${e} && git remote add origin <url> && git push -u origin ${s}`))}finally{try{A(u,t)}catch{}}};export{U as default,S as resolvePackageDirectory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{E as R,I as a,s as S,V as d}from"../packem_shared/index.server-J83sowC4.js";import{f as b,m as V}from"../packem_shared/index-OQZQyN5R.js";import{enforceProjectConstraints as v}from"@visulima/task-runner";import{b as x,O as F,M as I,A as T}from"./cli-main.js";import{c as z}from"../packem_shared/runtime-check-0lUJvgKt.js";import{a as A}from"../packem_shared/readJsonSync-CvkZyKmL-CY7PZob_.js";const o=c=>c?a("✓"):d("✗"),H=async({fs:c,logger:t,options:O,visConfig:y,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root.");const{config:p,packageJsons:w,workspace:l}=x(s,y),C=F(s,l,w),$=Object.keys(l.projects).length,k=new Set(Object.values(l.projects).flatMap(g=>Object.keys(g.targets??{}))).size,n=z(s);let e=0;p.constraints&&(e=v(C,p.constraints).length);const i=I(s,{minRuns:2});let r;const f=T(s);if(b(f)){const g=(await c.readdir(f)).filter(u=>u.endsWith(".json")).sort();let m=0,j=0;for(const u of g.slice(-20))try{const h=A(V(f,u));h.stats&&(m+=h.stats.total??0,j+=h.stats.cached??0)}catch{continue}m>0&&(r=`${(j/m*100).toFixed(0)}%`)}if(O.json){t.info(JSON.stringify({cacheHitRate:r??null,constraintViolations:e,flakyTasks:i.length,projects:$,runtimeIssues:n.length,targets:k},null,2));return}t.info(""),t.info(` ${R("VIS STATUS")}`),t.info(""),t.info(` ${o(!0)} ${String($)} projects · ${String(k)} unique targets`),t.info(` ${o(n.length===0)} Runtime: ${n.length===0?a("OK"):S(`${String(n.length)} issue(s)`)}`),t.info(` ${o(e===0)} Constraints: ${e===0?a("OK"):d(`${String(e)} violation(s)`)}`),t.info(` ${o(i.length===0)} Flaky tasks: ${i.length===0?a("none"):S(String(i.length))}`),r&&t.info(` ${o(!0)} Cache hit rate: ${r} (last 20 runs)`),t.info("")};export{H as default};
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`);return}J(a);const c=a.tools.filter(o=>!o.matches);c.length>0&&(t.info(""),t.notice(" Run `vis toolchain install` to install pinned versions.")),i.exitCode&&c.length>0&&(process.exitCode=1)},L=e=>{const n=new Map;for(const i of e){const a=n.get(i.manager.name);a?a.push(i):n.set(i.manager.name,[i])}return n},R=(e,n,i)=>P(e,n,{cwd:i,stdio:"inherit"}).status??1,z=(e,n,i)=>{const a=C(e,n),c=a.tools.filter(u=>!u.matches);if(c.length===0){t.success("Everything already matches — nothing to install.");return}const o=c.some(u=>u.manager.name!=="self-activate"&&u.manager.name!=="none");if(a.detected.length===0&&o){t.error(`No version manager detected. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}const g=L(c);let l=!1,r=0;for(const[u,f]of g){if(u==="self-activate"){for(const{expected:s}of f){if(s.source==="packageManager")t.info(`${d("$")} (${s.tool} will self-activate from packageManager on next invocation)`);else if(t.info(`${d("$")} Writing packageManager=${s.tool}@${s.version}`),i.dryRun)l=!0;else try{b(e,s),l=!0}catch(h){t.error(h.message),r=1}t.notice(` ${s.tool} ${s.version} — no install needed`)}continue}if(u==="none"){for(const{expected:s}of f)t.warn(`Cannot install ${s.tool} ${s.version} — no manager can handle it.`);r=1;continue}if(!a.detected.find(s=>s.name===u)?.installed){t.error(`${u} is referenced but not on PATH — install it first, then rerun \`vis toolchain install\`.`),r=1;continue}const m=f.map(s=>S(u,s.expected)).filter(Boolean);for(const s of m){if(!s)continue;if(s.bin==="nvm"&&s.args.length===0){t.error("nvm is a shell function — run `nvm install` in your shell, then rerun `vis toolchain install`."),s.hint&&t.notice(` ${s.hint}`),r=1;continue}if(t.info(`${d("$")} ${s.bin} ${s.args.join(" ")}`),s.hint&&t.notice(` ${s.hint}`),i.dryRun){l=!0;continue}const h=R(s.bin,s.args,e);if(l=!0,h!==0){r=h;break}}}if(r!==0){process.exitCode=r;return}l&&t.success("Toolchain installed.")},Q=async(e,n,i,a,c)=>{if(!a)throw new Error("Usage: vis toolchain use <tool>@<version> (e.g. vis toolchain use node@22.13.0)");const o=W(a);if(!o)throw new Error(`Could not parse "${a}". Expected "<tool>@<version>" where <tool> is one of ${x.join(", ")}.`);const g=k(n),l=E(o,g,i);if(l.name==="none"){t.error(`No manager can pin ${o.tool}. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}if(!l.installed){t.error(`The best manager for ${o.tool} (${l.name}) is not on PATH. ${l.note??""}`),process.exitCode=1;return}const r=B(l.name,o);if(!r){t.error(`${l.name} cannot pin ${o.tool}. Use a different manager, or set \`toolchain.tools.${o.tool}\` in vis.config.ts.`),process.exitCode=1;return}if(l.name==="self-activate"){if(t.info(`${d("→")} Writing packageManager field to package.json...`),c.dryRun){t.notice(` Would set packageManager: "${o.tool}@${o.version}"`);return}try{const f=b(n,o);if(!f){t.error(`Refusing to pin non-package-manager tool ${o.tool} via the packageManager field.`),process.exitCode=1;return}if(t.success(`Set packageManager: "${f}" — ${o.tool} will activate this version on next invocation.`),c.engines!==!1){const m=y(n,o);m&&t.success(`Updated package.json engines.${o.tool} → ${m}.`)}}catch(f){t.error(f.message),process.exitCode=1}return}if(r.args.length===0&&l.name==="nvm"&&o.tool==="node"){const f=A(n,".nvmrc");if(t.info(`${d("→")} Writing ${f}...`),c.dryRun){t.notice(` Would write ${o.version} to .nvmrc`);return}try{await e.writeFile(f,`${o.version}
|
|
3
|
-
`)}catch(m){t.error(`Failed to write .nvmrc: ${m.message}`),process.exitCode=1;return}t.success(`Wrote ${o.version} to .nvmrc.`),t.notice(" nvm is a shell function — run `nvm use` to activate it in this shell.");return}if(r.args.length===0){t.error(`${l.name} cannot pin ${o.tool} from a subprocess. ${r.configChange?.hint??""}`),r.configChange&&t.notice(` Edit ${r.configChange.file} by hand and rerun \`vis toolchain status\` to verify.`),process.exitCode=1;return}if(t.info(`${d("$")} ${r.bin} ${r.args.join(" ")}`),r.configChange&&t.notice(` Will update ${r.configChange.file} — ${r.configChange.hint}`),c.dryRun)return;const u=R(r.bin,r.args,n);if(u!==0){process.exitCode=u;return}if(t.success(`Pinned ${o.tool} to ${o.version}.`),c.engines!==!1)try{const f=y(n,o);f&&t.success(`Updated package.json engines.${o.tool} → ${f}.`)}catch(f){t.warn(`Could not update engines.${o.tool}: ${f.message}`)}},X=(e,n,i)=>{if(!i)throw new Error("Usage: vis toolchain which <tool> (e.g. vis toolchain which node)");const a=i.toLowerCase();if(!O(a))throw new Error(`Unknown tool "${i}". Known: ${x.join(", ")}.`);const c=k(e),o=E({source:"vis.config.ts",tool:a,version:"*"},c,n),g=o.installed&&o.name!=="self-activate"&&o.name!=="none"?c.find(r=>r.name===o.name):void 0,l=g?q(g,a):H(a);if(!l){t.error(`${i} not found in PATH${g?` or via ${g.name}`:""}.`),process.exitCode=1;return}process.stdout.write(`${l}
|
|
4
|
-
`)},Y=(e,n)=>{const i=N(e,n);process.stdout.write(`${i.name}
|
|
5
|
-
`)},p=e=>{if(!e)throw new Error("Could not determine workspace root. Run inside a monorepo.");return e},ie=async({options:e,visConfig:n,workspaceRoot:i})=>{K(p(i),n?.toolchain,e)},se=async({visConfig:e,workspaceRoot:n})=>{Y(p(n),e?.toolchain)},ae=async({options:e,visConfig:n,workspaceRoot:i})=>{z(p(i),n?.toolchain,e)},re=async({argument:e,fs:n,options:i,visConfig:a,workspaceRoot:c})=>{await Q(n,p(c),a?.toolchain,e[0],i)},ce=async({argument:e,visConfig:n,workspaceRoot:i})=>{X(p(i),n?.toolchain,e[0])};export{se as detectExecute,ae as installExecute,ie as statusExecute,re as useExecute,ce as whichExecute};
|
|
1
|
+
import{createTaskGraph as j}from"@visulima/task-runner";import{b as m,O as b}from"./cli-main.js";const y=(a,e)=>{const r=new Map;for(const[i,t]of Object.entries(a.dependencies))for(const c of t){const f=r.get(c)??[];f.push(i),r.set(c,f)}if(!a.tasks[e])return;const s=new Set([e]),o=[{node:e,path:[e]}];for(;o.length>0;){const i=o.shift();if(a.roots.includes(i.node))return i.path;for(const t of r.get(i.node)??[])s.has(t)||(s.add(t),o.push({node:t,path:[t,...i.path]}))}return[e]},E=(a,e)=>{const r=[];for(const[s,o]of Object.entries(a.dependencies))o.includes(e)&&r.push(s);return r.sort()},T=async({argument:a,logger:e,visConfig:r,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root.");const o=a[0];if(!o)throw new Error("No task ID specified. Usage: vis task-why <project>:<target>");if(!o.includes(":"))throw new Error(`Invalid task ID "${o}" — expected format "project:target".`);const{packageJsons:i,workspace:t}=m(s,r),c=b(s,t,i),[f,l]=o.split(":",2),u=t.projects[f];if(!u)throw new Error(`Unknown project "${f}".`);if(!u.targets?.[l])throw new Error(`Project "${f}" has no target "${l}".`);const $=Object.entries(t.projects).flatMap(([n,k])=>Object.keys(k.targets??{}).map(h=>({id:`${n}:${h}`,outputs:[],overrides:{},target:{project:n,target:h}}))),p=j($,{projectGraph:c,workspace:t});if(!p.tasks[o])throw new Error(`Task "${o}" is not reachable in the graph.`);const d=y(p,o),g=E(p,o);if(e.info(""),e.info(`Why ${o}?`),e.info(""),d&&d.length>1){e.info("Shortest path from a root to this task:");for(const[n,k]of d.entries()){const h=n===0?" ":`${" ".repeat(n+1)}└─ `;e.info(`${h}${k}`)}e.info("")}else e.info(" This task is itself a root — nothing upstream depends on it."),e.info("");if(g.length>0){e.info(`Directly depended on by ${g.length} task(s):`);for(const n of g)e.info(` - ${n}`);e.info("")}const w=p.dependencies[o]??[];if(w.length>0){e.info(`This task depends on ${w.length} task(s):`);for(const n of[...w].sort())e.info(` - ${n}`);e.info("")}};export{T as default};
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import{I as
|
|
1
|
+
import{createRequire as M}from"node:module";import{E as d,I as F,V as I,s as U}from"../packem_shared/index.server-J83sowC4.js";import{m as A}from"../packem_shared/index-OQZQyN5R.js";import{p as t}from"./cli-main.js";import{p as N,g as C,S as w,w as b,b as S,a as W,f as k,c as E,d as B,u as y,e as q,h as H}from"../packem_shared/toolchain-DyCKnGch.js";const _=M(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=e=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[n,i]=$.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return $.getBuiltinModule(e)}return _(e)},{spawnSync:P}=T("node:child_process"),x=["aube","bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],O=e=>x.includes(e),v=e=>e?F("✓"):I("✗"),j=U("⚠"),V=e=>{if(e.installed){const n=e.version?` v${e.version}`:"",i=e.configFiles.length>0?` (${e.configFiles.join(", ")})`:"";return`${v(!0)} ${e.name}${n}${i}`}return`${j} ${e.name} — referenced by ${e.configFiles.join(", ")} but not installed`},D=e=>{if(e.matches)return"";const{manager:n}=e;return n.name==="none"?d("→ (no manager)"):n.name==="self-activate"?"":n.installed?d(`→ ${n.name}`):d(`→ ${n.name} (missing)`)},G=e=>e.matches?v(!0):e.actual?j:v(!1),J=e=>{if(t.info(""),t.info(d("── Toolchain ───────────────────────")),e.detected.length===0)t.info(` ${v(!1)} No version manager detected`),t.notice(` Install one of: ${w.join(", ")}`);else for(const n of e.detected)t.info(` ${V(n)}`);if(t.info(""),e.tools.length===0){t.info(` ${d("No tool pins found — add engines.node, .nvmrc, or a manager config file.")}`);return}t.info(d("── Tools ───────────────────────────"));for(const n of e.tools){const i=`${n.expected.tool} ${n.expected.version}`,a=n.actual?`actual ${n.actual}`:"not installed",c=n.matches?"":d(` [${n.expected.source}]`),o=D(n),g=o===""?"":` ${o}`;t.info(` ${G(n)} ${i} — ${a}${c}${g}`),n.manager.note&&t.notice(` ${n.manager.note}`)}},K=(e,n,i)=>{const a=C(e,n);if(i.json){process.stdout.write(`${JSON.stringify({detected:a.detected.map(o=>({binPath:o.binPath??null,configFiles:o.configFiles,installed:o.installed,name:o.name,version:o.version??null})),tools:a.tools.map(o=>({actual:o.actual??null,expected:o.expected.version,manager:o.manager.name,managerInstalled:o.manager.installed,matches:o.matches,note:o.manager.note??null,source:o.expected.source,tool:o.expected.tool}))},void 0,2)}
|
|
2
|
+
`);return}J(a);const c=a.tools.filter(o=>!o.matches);c.length>0&&(t.info(""),t.notice(" Run `vis toolchain install` to install pinned versions.")),i.exitCode&&c.length>0&&(process.exitCode=1)},L=e=>{const n=new Map;for(const i of e){const a=n.get(i.manager.name);a?a.push(i):n.set(i.manager.name,[i])}return n},R=(e,n,i)=>P(e,n,{cwd:i,stdio:"inherit"}).status??1,z=(e,n,i)=>{const a=C(e,n),c=a.tools.filter(u=>!u.matches);if(c.length===0){t.success("Everything already matches — nothing to install.");return}const o=c.some(u=>u.manager.name!=="self-activate"&&u.manager.name!=="none");if(a.detected.length===0&&o){t.error(`No version manager detected. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}const g=L(c);let l=!1,r=0;for(const[u,f]of g){if(u==="self-activate"){for(const{expected:s}of f){if(s.source==="packageManager")t.info(`${d("$")} (${s.tool} will self-activate from packageManager on next invocation)`);else if(t.info(`${d("$")} Writing packageManager=${s.tool}@${s.version}`),i.dryRun)l=!0;else try{b(e,s),l=!0}catch(h){t.error(h.message),r=1}t.notice(` ${s.tool} ${s.version} — no install needed`)}continue}if(u==="none"){for(const{expected:s}of f)t.warn(`Cannot install ${s.tool} ${s.version} — no manager can handle it.`);r=1;continue}if(!a.detected.find(s=>s.name===u)?.installed){t.error(`${u} is referenced but not on PATH — install it first, then rerun \`vis toolchain install\`.`),r=1;continue}const m=f.map(s=>S(u,s.expected)).filter(Boolean);for(const s of m){if(!s)continue;if(s.bin==="nvm"&&s.args.length===0){t.error("nvm is a shell function — run `nvm install` in your shell, then rerun `vis toolchain install`."),s.hint&&t.notice(` ${s.hint}`),r=1;continue}if(t.info(`${d("$")} ${s.bin} ${s.args.join(" ")}`),s.hint&&t.notice(` ${s.hint}`),i.dryRun){l=!0;continue}const h=R(s.bin,s.args,e);if(l=!0,h!==0){r=h;break}}}if(r!==0){process.exitCode=r;return}l&&t.success("Toolchain installed.")},Q=async(e,n,i,a,c)=>{if(!a)throw new Error("Usage: vis toolchain use <tool>@<version> (e.g. vis toolchain use node@22.13.0)");const o=W(a);if(!o)throw new Error(`Could not parse "${a}". Expected "<tool>@<version>" where <tool> is one of ${x.join(", ")}.`);const g=k(n),l=E(o,g,i);if(l.name==="none"){t.error(`No manager can pin ${o.tool}. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}if(!l.installed){t.error(`The best manager for ${o.tool} (${l.name}) is not on PATH. ${l.note??""}`),process.exitCode=1;return}const r=B(l.name,o);if(!r){t.error(`${l.name} cannot pin ${o.tool}. Use a different manager, or set \`toolchain.tools.${o.tool}\` in vis.config.ts.`),process.exitCode=1;return}if(l.name==="self-activate"){if(t.info(`${d("→")} Writing packageManager field to package.json...`),c.dryRun){t.notice(` Would set packageManager: "${o.tool}@${o.version}"`);return}try{const f=b(n,o);if(!f){t.error(`Refusing to pin non-package-manager tool ${o.tool} via the packageManager field.`),process.exitCode=1;return}if(t.success(`Set packageManager: "${f}" — ${o.tool} will activate this version on next invocation.`),c.engines!==!1){const m=y(n,o);m&&t.success(`Updated package.json engines.${o.tool} → ${m}.`)}}catch(f){t.error(f.message),process.exitCode=1}return}if(r.args.length===0&&l.name==="nvm"&&o.tool==="node"){const f=A(n,".nvmrc");if(t.info(`${d("→")} Writing ${f}...`),c.dryRun){t.notice(` Would write ${o.version} to .nvmrc`);return}try{await e.writeFile(f,`${o.version}
|
|
3
|
+
`)}catch(m){t.error(`Failed to write .nvmrc: ${m.message}`),process.exitCode=1;return}t.success(`Wrote ${o.version} to .nvmrc.`),t.notice(" nvm is a shell function — run `nvm use` to activate it in this shell.");return}if(r.args.length===0){t.error(`${l.name} cannot pin ${o.tool} from a subprocess. ${r.configChange?.hint??""}`),r.configChange&&t.notice(` Edit ${r.configChange.file} by hand and rerun \`vis toolchain status\` to verify.`),process.exitCode=1;return}if(t.info(`${d("$")} ${r.bin} ${r.args.join(" ")}`),r.configChange&&t.notice(` Will update ${r.configChange.file} — ${r.configChange.hint}`),c.dryRun)return;const u=R(r.bin,r.args,n);if(u!==0){process.exitCode=u;return}if(t.success(`Pinned ${o.tool} to ${o.version}.`),c.engines!==!1)try{const f=y(n,o);f&&t.success(`Updated package.json engines.${o.tool} → ${f}.`)}catch(f){t.warn(`Could not update engines.${o.tool}: ${f.message}`)}},X=(e,n,i)=>{if(!i)throw new Error("Usage: vis toolchain which <tool> (e.g. vis toolchain which node)");const a=i.toLowerCase();if(!O(a))throw new Error(`Unknown tool "${i}". Known: ${x.join(", ")}.`);const c=k(e),o=E({source:"vis.config.ts",tool:a,version:"*"},c,n),g=o.installed&&o.name!=="self-activate"&&o.name!=="none"?c.find(r=>r.name===o.name):void 0,l=g?q(g,a):H(a);if(!l){t.error(`${i} not found in PATH${g?` or via ${g.name}`:""}.`),process.exitCode=1;return}process.stdout.write(`${l}
|
|
4
|
+
`)},Y=(e,n)=>{const i=N(e,n);process.stdout.write(`${i.name}
|
|
5
|
+
`)},p=e=>{if(!e)throw new Error("Could not determine workspace root. Run inside a monorepo.");return e},ie=async({options:e,visConfig:n,workspaceRoot:i})=>{K(p(i),n?.toolchain,e)},se=async({visConfig:e,workspaceRoot:n})=>{Y(p(n),e?.toolchain)},ae=async({options:e,visConfig:n,workspaceRoot:i})=>{z(p(i),n?.toolchain,e)},re=async({argument:e,fs:n,options:i,visConfig:a,workspaceRoot:c})=>{await Q(n,p(c),a?.toolchain,e[0],i)},ce=async({argument:e,visConfig:n,workspaceRoot:i})=>{X(p(i),n?.toolchain,e[0])};export{se as detectExecute,ae as installExecute,ie as statusExecute,re as useExecute,ce as whichExecute};
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import{
|
|
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
|
-
✓ Updated @visulima/vis from ${n} → ${o}`)};export{v as default};
|
|
1
|
+
import{I as m,S as p}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{r as g,a as d}from"../packem_shared/command-runtime-RiCMa2C8.js";const u=async({argument:r,logger:s,options:a,visConfig:e,workspaceRoot:i})=>{const t=r||[],o=i??process.cwd(),c=g({logger:s,options:a,visConfig:e},o),l=m(o,{backend:d(c),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),n=p(l,t,a.recursive||!1,o,s);n!==0&&(process.exitCode=n)};export{u as default};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createRequire as u}from"node:module";import{c as p}from"../packem_shared/index-CPhv-r4c.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
|
+
✓ 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
|
+
✓ Updated @visulima/vis from ${n} → ${o}`)};export{v as default};
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`);const t=await P(e);if(!t.latest)throw new Error(`Could not determine latest version for "${e}".`);r=t.latest}const d=h(o),w=h(r);if(!d||!w)throw new Error(`Could not parse versions: current="${o}", target="${r}".`);const k=q(d,w);if(k==="none"){n.info(`${e} is already at ${r}. Nothing to analyze.`);return}const E=x(o),g={catalogName:u,currentRange:o,newRange:`${E}${r}`,packageName:e,targetVersion:r,updateType:k},y=z(c.aiType??"impact");if(y==="security"||c.security){n.info(`Checking for known vulnerabilities...
|
|
3
|
-
`);const t=o.replace(M,""),i=(await T([{name:e,version:t}])).get(e);i&&i.length>0&&(g.vulnerabilities=i);const a=I(l?.security,{minimumScore:l?.security?.policies?.score?.minimum});if(a.length>0){const s=(await j(a,[{name:e,version:t}])).get(`${e}@${t}`);s&&(g.socketReport={alerts:s.alerts,license:s.license,score:s.score})}}const $=await A([g],n,l?.ai,y);(c.format??"table")==="json"?process.stdout.write(`${JSON.stringify($,void 0,2)}
|
|
4
|
-
`):n.info(F($))};export{U as default};
|
|
1
|
+
import{createTaskGraph as v}from"@visulima/task-runner";import{b as y,O as b}from"./cli-main.js";import{r as E,f as R}from"../packem_shared/selectors-UmnAuc26.js";const C=(p,o,a)=>{const n=[],t=new Set,c=(e,l)=>{if(t.has(e))return;t.add(e);const m=o[e]??[];for(const g of m)c(g,l+1);const r=a[e],d=" ".repeat(l);n.push(`${d}${e}${r?.cache===!1?" (no-cache)":""}`)};for(const e of p)c(e,0);return n},S=(p,o,a)=>({roots:p,tasks:Object.fromEntries(Object.entries(a).map(([n,t])=>[n,{cache:t.cache,dependsOn:o[n]??[],outputs:t.outputs,parallelism:t.parallelism,projectRoot:t.projectRoot,target:t.target}]))}),J=async({argument:p,logger:o,options:a,process:n,visConfig:t,workspaceRoot:c})=>{const e=p[0];if(!e)throw new Error("Missing selector. Usage: vis action-graph <selector>");if(!c)throw new Error("Could not determine workspace root. Run inside a monorepo.");const{config:l,packageJsons:m,workspace:r}=y(c,t),d=b(c,r,m),g=await E(e,r,n.cwd,c),{target:f}=g;let h=g.projects;a.query&&(h=R(h,r,a.query));const j=h.filter(i=>r.projects[i]?.targets?.[f]!==void 0);if(j.length===0){o.info(`No projects have a "${f}" target.`);return}const w=j.map(i=>{const k=r.projects[i],u=k.targets?.[f],$={project:i,target:f};return{cache:u?.cache,id:`${i}:${f}`,outputs:u?.outputs??[],overrides:{command:u?.command},parallelism:u?.parallelism,projectRoot:k.root,target:$}}),s=v(w,{projectGraph:d,targetDefaults:l.tasks,workspace:r});if(a.json){o.info(JSON.stringify(S(s.roots,s.dependencies,s.tasks),null,2));return}const O=C(s.roots,s.dependencies,s.tasks);o.info(`Execution plan (${Object.keys(s.tasks).length} task(s), ${s.roots.length} root(s)):`),o.info("");for(const i of O)o.info(i)};export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{I as f,E as d}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{r as g,a as m}from"../packem_shared/command-runtime-RiCMa2C8.js";import{i as k}from"../packem_shared/utils-Cxree603.js";const h=async({argument:r,logger:n,options:o,process:i,visConfig:a,workspaceRoot:t})=>{const e=r;if(!e||e.length===0)throw new Error("No packages specified. Usage: vis why <package...>");const s=t??i.cwd,p=g({logger:n,options:o,visConfig:a},s),c=f(s,{backend:m(p),configBackend:a?.install?.backend,configCorepack:a?.install?.corepack}),l=d(c,{depth:o.depth===void 0?void 0:Number(o.depth),dev:o.dev||!1,filter:k(o.filter),global:o.global||!1,json:o.json||!1,long:o.long||!1,noOptional:o.optional===!1,packages:e,parseable:o.parseable||!1,prod:o.prod||!1,recursive:o.recursive||!1},s,n);l!==0&&l!==1&&(process.exitCode=l)};export{h as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)[0]?.slice(0,80)??""}`))};export{W as __setBotPrRunnerForTests,Y as default,D as parseBotPrTitle};
|
|
1
|
+
import{A as d,B as w}from"../packem_shared/index-OQZQyN5R.js";import{r as v}from"../packem_shared/command-runtime-RiCMa2C8.js";import{r as u}from"../packem_shared/run-file-B4TqKa0X.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};
|