@visulima/vis 1.0.0-alpha.13 → 1.0.0-alpha.14
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 +28 -0
- package/LICENSE.md +7242 -385
- package/dist/bin.js +1 -1
- package/dist/config/index.d.ts +493 -1
- package/dist/config/index.js +1 -1
- package/dist/packem_chunks/applyDefaults.js +2 -2
- package/dist/packem_chunks/bin.js +1134 -199
- package/dist/packem_chunks/doctor-probe.js +2 -2
- package/dist/packem_chunks/fix.js +11 -11
- 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 +5 -5
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +20 -18
- package/dist/packem_chunks/handler15.js +1 -20
- 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 +5 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -5
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +5 -1
- package/dist/packem_chunks/handler23.js +1 -5
- package/dist/packem_chunks/handler24.js +3 -1
- package/dist/packem_chunks/handler25.js +1 -3
- package/dist/packem_chunks/handler26.js +1 -1
- package/dist/packem_chunks/handler27.js +7 -1
- package/dist/packem_chunks/handler28.js +22 -6
- package/dist/packem_chunks/handler29.js +3 -23
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +18 -3
- package/dist/packem_chunks/handler31.js +1 -1
- package/dist/packem_chunks/handler32.js +2 -2
- package/dist/packem_chunks/handler33.js +24 -24
- package/dist/packem_chunks/handler34.js +2 -2
- package/dist/packem_chunks/handler35.js +2 -2
- package/dist/packem_chunks/handler36.js +20 -20
- package/dist/packem_chunks/handler37.js +2 -2
- package/dist/packem_chunks/handler38.js +6 -22
- package/dist/packem_chunks/handler39.js +11 -11
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +5 -22
- package/dist/packem_chunks/handler41.js +24 -6
- package/dist/packem_chunks/handler42.js +10 -5
- package/dist/packem_chunks/handler43.js +153 -10
- package/dist/packem_chunks/handler44.js +25 -153
- package/dist/packem_chunks/handler45.js +3 -25
- package/dist/packem_chunks/handler46.js +27 -3
- package/dist/packem_chunks/handler47.js +41 -26
- package/dist/packem_chunks/handler48.js +32 -40
- package/dist/packem_chunks/handler5.js +7 -7
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +4 -4
- package/dist/packem_chunks/heal.js +3 -3
- package/dist/packem_chunks/help-command.js +18 -0
- package/dist/packem_chunks/index.js +4 -4
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/tar.js +1 -1
- package/dist/packem_shared/ai-analysis-Dzs_nUwM.js +68 -0
- package/dist/packem_shared/ai-cache-Dtvmbsru.js +1 -0
- package/dist/packem_shared/{ai-fix-nn4zOE95.js → ai-fix-BmLM72GS.js} +4 -4
- package/dist/packem_shared/cache-directory-xASJia6M.js +1 -0
- package/dist/packem_shared/dependency-scan-DmwPKwLy.js +2 -0
- package/dist/packem_shared/docker-CA-scYu0.js +2 -0
- package/dist/packem_shared/failure-log-fD4DiFb1.js +2 -0
- package/dist/packem_shared/flakiness-BIg1rwvp.js +1 -0
- package/dist/packem_shared/{giget-CcEy_Elm.js → giget-BX2ixMoa.js} +2 -2
- package/dist/packem_shared/index-OlP7U_t5.js +6 -0
- package/dist/packem_shared/lockfile-BXylopgH.js +1 -0
- package/dist/packem_shared/otelPlugin-y5hoCw4b.js +1 -0
- package/dist/packem_shared/registry-BHqKXiLb.js +2 -0
- package/dist/packem_shared/run-summary-utils-D39XBHWW.js +1 -0
- package/dist/packem_shared/runtime-check-BaKni2y1.js +1 -0
- package/dist/packem_shared/selectors-BvtUXWGY.js +3 -0
- package/dist/packem_shared/toolchain-B7sIiJxK.js +5 -0
- package/dist/packem_shared/typosquats-XkC1CnOa.js +1 -0
- package/dist/packem_shared/verify-BVTcVfoW.js +1 -0
- package/dist/packem_shared/{vis-update-app-D1jl0UZZ.js → vis-update-app-DR8c4OfG.js} +1 -1
- package/package.json +15 -30
- package/dist/packem_shared/ai-analysis-hm8d2W7z.js +0 -67
- package/dist/packem_shared/ai-cache-DoiF80AR.js +0 -1
- package/dist/packem_shared/cache-directory-CwHlJhgx.js +0 -1
- package/dist/packem_shared/dependency-scan-COr5n63B.js +0 -2
- package/dist/packem_shared/docker-D6OGr5_S.js +0 -2
- package/dist/packem_shared/failure-log-iUVLf6ts.js +0 -2
- package/dist/packem_shared/flakiness-D9wf0t56.js +0 -1
- package/dist/packem_shared/otel-DxDUPJJH.js +0 -6
- package/dist/packem_shared/otelPlugin-CQq6poq8.js +0 -1
- package/dist/packem_shared/registry-CkubDdiY.js +0 -2
- package/dist/packem_shared/run-summary-utils-BfBvjzhY.js +0 -1
- package/dist/packem_shared/runtime-check-BXZ43CBW.js +0 -1
- package/dist/packem_shared/selectors-BylODRiM.js +0 -3
- package/dist/packem_shared/toolchain-BgBOUHII.js +0 -5
- package/dist/packem_shared/typosquats-CcZl99B1.js +0 -1
- package/dist/packem_shared/verify-Baj5mFJ7.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var h=Object.defineProperty;var p=(e
|
|
2
|
-
`)},"formatTable"),E=s(async({logger:
|
|
1
|
+
var h=Object.defineProperty;var p=(t,e)=>h(t,"name",{value:e,configurable:!0});import{c as d,d as l,j as g,E as n,q as b,e as m,p as f}from"./bin.js";import{ReapiRemoteCache as k}from"@visulima/task-runner";var $=Object.defineProperty,s=p((t,e)=>$(t,"name",{value:e,configurable:!0}),"s");const w=s((t,e)=>e==="http"||e==="reapi"?e:t.startsWith("grpc://")||t.startsWith("grpcs://")?"reapi":"http","inferBackend"),y=s(async(t,e)=>{const o=Date.now(),a=new AbortController,r=setTimeout(()=>{a.abort()},e);try{const i=await fetch(t,{method:"HEAD",signal:a.signal});return{backend:"http",durationMs:Date.now()-o,httpStatus:i.status,ok:!0,url:t}}catch(i){return{backend:"http",durationMs:Date.now()-o,error:i instanceof Error?i.message:String(i),ok:!1,url:t}}finally{clearTimeout(r)}},"probeHttp"),S=s(async(t,e)=>{const o=Date.now(),a=new k({...t,timeout:e});try{return{backend:"reapi",capabilities:await a.probeCapabilities(),durationMs:Date.now()-o,ok:!0,url:t.url}}catch(r){return{backend:"reapi",durationMs:Date.now()-o,error:r instanceof Error?r.message:String(r),ok:!1,url:t.url}}finally{try{await a.close()}catch{}}},"probeReapi"),D=s(t=>{const e=[],o=t.ok?d("OK"):l("FAIL");if(e.push(`${g("Remote cache")} ${o}`),e.push(` ${n("URL:")} ${b(t.url)}`),e.push(` ${n("Backend:")} ${t.backend}`),e.push(` ${n("Latency:")} ${String(t.durationMs)}ms`),t.httpStatus!==void 0&&e.push(` ${n("Status:")} ${String(t.httpStatus)}`),t.capabilities){const a=t.capabilities.digestFunctions.length>0?t.capabilities.digestFunctions.join(", "):m("(none advertised)");e.push(` ${n("Digests:")} ${a}`),e.push(` ${n("Batch:")} ${String(t.capabilities.maxBatchTotalSizeBytes)} bytes`)}return t.error&&e.push(` ${n("Error:")} ${l(t.error)}`),e.join(`
|
|
2
|
+
`)},"formatTable"),E=s(async({logger:t,options:e,visConfig:o})=>{const a=(o??{}).taskRunnerOptions?.remoteCache,r=e.url??a?.url,i=e.format??"table",u=e.timeout??5e3;if(!r){f.error("No remote cache configured. Set taskRunnerOptions.remoteCache.url in vis.config.ts or pass --url=..."),process.exitCode=1;return}const c=w(r,e.backend)==="reapi"?await S({...a??{url:r},backend:"reapi",url:r},u):await y(r,u);i==="json"?t.log(JSON.stringify(c,null,2)):t.log(D(c)),c.ok||(process.exitCode=1)},"cacheDoctorExecute");export{E as cacheDoctorExecute};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var T=Object.defineProperty;var v=(e,t)=>T(e,"name",{value:t,configurable:!0});import{createRequire as
|
|
2
|
-
`);if(e.patches.length===0)return o.push(""),o.push(
|
|
3
|
-
`);o.push(""),o.push(
|
|
4
|
-
`))o.push(
|
|
5
|
-
`))o.push(
|
|
6
|
-
`)},"formatProposalText"),
|
|
7
|
-
`)},"formatPatchResultsText"),x=l(e=>{let t=0,r=0;for(const o of e)o.status==="applied"?t+=1:r+=1;return{applied:t,failed:r}},"summarizePatchResults"),G=l(e=>new Promise(t=>{const r=
|
|
8
|
-
`)}else{p.error("No task ID specified. Usage: vis ai fix <project>:<target>");const d=N(a);if(d.length>0){p.info("Tasks with captured failure logs:");for(const h of d)p.info(` - ${h}`)}else p.notice("No failure logs found. Re-run a failing task with `vis run` to capture logs.")}process.exitCode=1;return}const n=await
|
|
9
|
-
`):(p.error(`No failure log or run summary found for task "${i}".`),p.notice("Re-run the task with `vis run` so its terminal output and run metadata are captured.")),process.exitCode=1;return}n.terminalOutputCaptured||p.warn(`No captured terminal output for "${i}". Re-run with \`vis run\` for a better fix proposal.`);const F=o?.ai,
|
|
10
|
-
`),process.exitCode=1;return}const g=r.apply===!0;if(
|
|
11
|
-
`),g&&h){const{failed:O}=x(h);O>0&&(process.exitCode=1)}return}if(t.info(E(
|
|
1
|
+
var T=Object.defineProperty;var v=(e,t)=>T(e,"name",{value:t,configurable:!0});import{createRequire as q}from"node:module";import{j as $,E as P,e as R,q as D,d as j,c as I,p}from"./bin.js";import{z as _}from"../packem_shared/index-OlP7U_t5.js";import{r as W,a as B,b as L,c as w}from"../packem_shared/ai-fix-BmLM72GS.js";import{l as N}from"../packem_shared/failure-log-fD4DiFb1.js";const A=q(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,J=v(e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[t,r]=m.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return m.getBuiltinModule(e)}return A(e)},"__cjs_getBuiltinModule"),{createInterface:z}=J("node:readline");var M=Object.defineProperty,l=v((e,t)=>M(e,"name",{value:t,configurable:!0}),"c");const U={"ambiguous-match":"ambiguous match",applied:"applied",error:"error","missing-file":"missing file","no-match":"no match","outside-workspace":"outside workspace"},S=l((e,t,r)=>{const o=W(e,t,r),s=_(e,o);return s===""||s.startsWith("..")?o:s},"formatDisplayPath"),E=l((e,t,r)=>{const o=[$(`Fix proposal (${e.provider}, confidence: ${e.confidence})`),"",e.explanation||P("<no explanation>")];if(e.cannotFix)return o.push(""),o.push(R(`Cannot fix automatically: ${e.cannotFix}`)),o.join(`
|
|
2
|
+
`);if(e.patches.length===0)return o.push(""),o.push(R("No patches were proposed.")),o.join(`
|
|
3
|
+
`);o.push(""),o.push($(`Patches (${String(e.patches.length)}):`));for(const[s,i]of e.patches.entries()){const a=S(t,r,i.file);o.push(""),o.push(D(`[${String(s+1)}] ${a}`)),i.reason&&o.push(P(` reason: ${i.reason}`));for(const u of i.oldString.split(`
|
|
4
|
+
`))o.push(j(` - ${u}`));for(const u of i.newString.split(`
|
|
5
|
+
`))o.push(I(` + ${u}`))}return o.join(`
|
|
6
|
+
`)},"formatProposalText"),C=l((e,t,r)=>{const o=[];for(const s of e){const i=s.absolutePath?_(t,s.absolutePath)||s.absolutePath:S(t,r,s.patch.file),a=U[s.status];s.status==="applied"?o.push(I(` ✓ ${i}: ${a}`)):o.push(j(` ✗ ${i}: ${a}${s.error?` (${s.error})`:""}`))}return o.join(`
|
|
7
|
+
`)},"formatPatchResultsText"),x=l(e=>{let t=0,r=0;for(const o of e)o.status==="applied"?t+=1:r+=1;return{applied:t,failed:r}},"summarizePatchResults"),G=l(e=>new Promise(t=>{const r=z({input:process.stdin,output:process.stderr});r.question(`${e} (y/N) `,o=>{r.close();const s=o.trim().toLowerCase();t(s==="y"||s==="yes")})}),"confirmPrompt"),H=l(e=>e??process.cwd(),"resolveWorkspaceRoot"),tt=l(async({argument:e,logger:t,options:r,visConfig:o,workspaceRoot:s})=>{const i=e[0],a=H(s),u=(r.format??"text")==="json";if(!i){if(u){const d=N(a);process.stdout.write(`${JSON.stringify({availableTasks:d,error:"No task ID specified"},void 0,2)}
|
|
8
|
+
`)}else{p.error("No task ID specified. Usage: vis ai fix <project>:<target>");const d=N(a);if(d.length>0){p.info("Tasks with captured failure logs:");for(const h of d)p.info(` - ${h}`)}else p.notice("No failure logs found. Re-run a failing task with `vis run` to capture logs.")}process.exitCode=1;return}const n=await B(a,i,{runId:r.run});if(!n){u?process.stdout.write(`${JSON.stringify({error:"No failure log or run summary found",taskId:i},void 0,2)}
|
|
9
|
+
`):(p.error(`No failure log or run summary found for task "${i}".`),p.notice("Re-run the task with `vis run` so its terminal output and run metadata are captured.")),process.exitCode=1;return}n.terminalOutputCaptured||p.warn(`No captured terminal output for "${i}". Re-run with \`vis run\` for a better fix proposal.`);const F=o?.ai,c=await L(n,t,{cache:r.cache!==!1,config:F});if(!c){u&&process.stdout.write(`${JSON.stringify({error:"AI fix proposal failed or no provider available",taskId:i},void 0,2)}
|
|
10
|
+
`),process.exitCode=1;return}const g=r.apply===!0;if(u){const d=g?void 0:await w(a,n.cwd,c,{dryRun:!0}),h=g?await w(a,n.cwd,c):void 0;if(process.stdout.write(`${JSON.stringify({appliedResults:h,dryRunResults:d,failureContext:{cwd:n.cwd,hash:n.hash,runId:n.runId,taskId:n.taskId,terminalOutputCaptured:n.terminalOutputCaptured},proposal:c},void 0,2)}
|
|
11
|
+
`),g&&h){const{failed:O}=x(h);O>0&&(process.exitCode=1)}return}if(t.info(E(c,a,n.cwd)),c.cannotFix||c.patches.length===0)return;const k=await w(a,n.cwd,c,{dryRun:!0}),y=x(k);if(t.info(""),t.info($("Patch validation:")),t.info(C(k,a,n.cwd)),!g){t.info(""),p.info("Re-run with --apply to write these patches to disk.");return}if(y.applied===0){p.error("No patches can be applied (every patch failed validation)."),process.exitCode=1;return}if(r.yes!==!0&&(t.info(""),!await G(`Apply ${String(y.applied)} patch${y.applied===1?"":"es"} to disk?`))){p.notice("Aborted. Nothing written.");return}const b=await w(a,n.cwd,c),f=x(b);t.info(""),t.info($("Apply results:")),t.info(C(b,a,n.cwd)),t.info(""),f.failed===0?p.success(`Applied ${String(f.applied)} patch${f.applied===1?"":"es"}.`):(p.warn(`${String(f.applied)} applied, ${String(f.failed)} failed.`),process.exitCode=1)},"aiFix");export{tt as aiFix};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var O=Object.defineProperty;var w=(o,e)=>O(o,"name",{value:e,configurable:!0});import{createTaskGraph as b}from"@visulima/task-runner";import{
|
|
1
|
+
var O=Object.defineProperty;var w=(o,e)=>O(o,"name",{value:e,configurable:!0});import{createTaskGraph as b}from"@visulima/task-runner";import{y as E,m as R}from"./bin.js";import{r as x,f as G}from"../packem_shared/selectors-BvtUXWGY.js";var J=Object.defineProperty,m=w((o,e)=>J(o,"name",{value:e,configurable:!0}),"u");const P=m((o,e,n)=>{const c=[],t=new Set,l=m((r,f)=>{if(t.has(r))return;t.add(r);const s=e[r]??[];for(const i of s)l(i,f+1);const d=n[r],u=" ".repeat(f);c.push(`${u}${r}${d?.cache===!1?" (no-cache)":""}`)},"walk");for(const r of o)l(r,0);return c},"renderPlan"),S=m((o,e,n)=>({roots:o,tasks:Object.fromEntries(Object.entries(n).map(([c,t])=>[c,{cache:t.cache,dependsOn:e[c]??[],outputs:t.outputs,parallelism:t.parallelism,projectRoot:t.projectRoot,target:t.target}]))}),"toJson"),T=m(async({argument:o,logger:e,options:n,visConfig:c,workspaceRoot:t})=>{const l=o[0];if(!l)throw new Error("Missing selector. Usage: vis action-graph <selector>");if(!t)throw new Error("Could not determine workspace root. Run inside a monorepo.");const{config:r,packageJsons:f,workspace:s}=E(t,c),d=R(t,s,f),u=await x(l,s,process.cwd(),t),{target:i}=u;let h=u.projects;n.query&&(h=G(h,s,n.query));const j=h.filter(p=>s.projects[p]?.targets?.[i]!==void 0);if(j.length===0){e.info(`No projects have a "${i}" target.`);return}const y=j.map(p=>{const k=s.projects[p],g=k.targets?.[i],$={project:p,target:i};return{cache:g?.cache,id:`${p}:${i}`,outputs:g?.outputs??[],overrides:{command:g?.command},parallelism:g?.parallelism,projectRoot:k.root,target:$}}),a=b(y,{projectGraph:d,targetDefaults:r.targetDefaults,workspace:s});if(n.json){e.info(JSON.stringify(S(a.roots,a.dependencies,a.tasks),null,2));return}const v=P(a.roots,a.dependencies,a.tasks);e.info(`Execution plan (${Object.keys(a.tasks).length} task(s), ${a.roots.length} root(s)):`),e.info("");for(const p of v)e.info(p)},"execute");export{T as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var g=Object.defineProperty;var p=(t,o)=>g(t,"name",{value:o,configurable:!0});import{M as d}from"../packem_shared/index-OlP7U_t5.js";import{y as k,m as v}from"./bin.js";import{s as h,p as j}from"../packem_shared/docker-CA-scYu0.js";var x=Object.defineProperty,E=p((t,o)=>x(t,"name",{value:o,configurable:!0}),"f");const C=E(async({argument:t,logger:o,options:s,visConfig:m,workspaceRoot:e})=>{const n=t[0];if(!n)throw new Error("Missing subcommand. Usage: vis docker <scaffold|prune>");if(!e)throw new Error("Could not determine workspace root. Run inside a monorepo.");const{packageJsons:l,workspace:c}=k(e,m);if(n==="scaffold"){const a=v(e,c,l),r=s.focus;if(!r)throw new Error("Missing --focus. Pass one or more project names, comma-separated.");const i=r.split(",").map(w=>w.trim()).filter(Boolean);if(i.length===0)throw new Error("--focus resolved to an empty list. Provide at least one project name.");const f=d(e,s.out??".vis/docker"),{projects:u}=h({focus:i,includeSources:!!s.includeSources,outDir:f,projectGraph:a,workspace:c,workspaceRoot:e});o.info(`Scaffolded ${u.length} project(s) into ${f}`),o.info(`Focus closure: ${u.toSorted().join(", ")}`);return}if(n==="prune"){const a=d(e,s.context??".vis/docker"),{removed:r}=j({contextRoot:a,workspace:c,workspaceRoot:e});o.info(`Pruned ${r.length} unfocused project(s)`),r.length>0&&o.debug?.(r.join(`
|
|
2
2
|
`));return}throw new Error(`Unknown subcommand: "${n}". Expected scaffold or prune.`)},"execute");export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var d=Object.defineProperty;var t=(o,r)=>d(o,"name",{value:r,configurable:!0});import{h as m,P as g}from"./bin.js";import{o as u}from"../packem_shared/utils-DrNg0XTR.js";var v=Object.defineProperty,k=t((o,r)=>v(o,"name",{value:r,configurable:!0}),"t");const b=k(async({argument:o,logger:r,options:e,visConfig:s,workspaceRoot:n})=>{const a=o;if(!a||a.length===0)throw new Error("No command specified. Usage: vis exec <command> [args...]");const[i,...f]=a,l=n??process.cwd(),p=m(l,{configBackend:s?.install?.backend,configCorepack:s?.install?.corepack}),c=g(p,{args:f,command:i,filter:u(e.filter),parallel:e.parallel||!1,recursive:e.recursive||!1,reverse:e.reverse||!1,shellMode:e.shellMode||!1,workspaceRoot:e.workspaceRoot||!1},l,r);c!==0&&(process.exitCode=c)},"execute");export{b as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var g=Object.defineProperty;var a=(e,i)=>g(e,"name",{value:i,configurable:!0});import{createRequire as y}from"node:module";import{isAccessibleSync as u,readFileSync as p,writeFileSync as
|
|
2
|
-
`),
|
|
3
|
-
`)),i.push(s))}catch{e.warn(`warning: could not clean ${s}`)}return i},"cleanShellProfiles"),
|
|
4
|
-
Type "uninstall" to confirm: `,v)});if(
|
|
5
|
-
✓ Removed ${f}`)}catch(
|
|
1
|
+
var g=Object.defineProperty;var a=(e,i)=>g(e,"name",{value:i,configurable:!0});import{createRequire as y}from"node:module";import{isAccessibleSync as u,readFileSync as p,writeFileSync as S}from"@visulima/fs";import{M as r}from"../packem_shared/index-OlP7U_t5.js";import{l as j}from"./bin.js";const _=y(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=a(e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[i,s]=c.versions.node.split(".").map(Number);if(i>22||i===22&&s>=3||i===20&&s>=16)return c.getBuiltinModule(e)}return _(e)},"__cjs_getBuiltinModule"),{rmSync:b}=d("node:fs"),{homedir:n}=d("node:os"),{createInterface:w}=d("node:readline");var T=Object.defineProperty,m=a((e,i)=>T(e,"name",{value:i,configurable:!0}),"l");const f=j(),h=[r(n(),".zshrc"),r(n(),".zshenv"),r(n(),".bashrc"),r(n(),".bash_profile"),r(n(),".profile"),r(n(),".config","fish","config.fish")],$=m(e=>{const i=[];for(const s of h)if(u(s))try{const l=p(s).split(`
|
|
2
|
+
`),o=l.filter(t=>!t.includes(".vis/bin")&&!t.includes("VIS_HOME")&&!t.includes("# vis "));o.length!==l.length&&(S(s,o.join(`
|
|
3
|
+
`)),i.push(s))}catch{e.warn(`warning: could not clean ${s}`)}return i},"cleanShellProfiles"),R=m(async({logger:e,options:i})=>{if(!u(f)){e.info("vis is not installed (no ~/.vis directory found).");return}e.info("This will remove:"),e.info(` ${f}/`);const s=h.filter(o=>u(o)&&p(o).includes(".vis"));for(const o of s)e.info(` Lines in ${o}`);if(!i.yes){if(!process.stdin.isTTY)throw new Error("Non-interactive terminal. Use --yes to confirm.");const o=w({input:process.stdin,output:process.stdout}),t=await new Promise(v=>{o.question(`
|
|
4
|
+
Type "uninstall" to confirm: `,v)});if(o.close(),t.trim()!=="uninstall"){e.info("Aborted.");return}}const l=$(e);for(const o of l)e.info(`Cleaned ${o}`);try{b(f,{force:!0,recursive:!0}),e.info(`
|
|
5
|
+
✓ Removed ${f}`)}catch(o){throw new Error(`Failed to remove ${f}: ${o instanceof Error?o.message:String(o)}`,{cause:o})}e.info("✓ vis has been uninstalled.")},"execute");export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var l=Object.defineProperty;var r=(e,a)=>l(e,"name",{value:a,configurable:!0});import{
|
|
1
|
+
var l=Object.defineProperty;var r=(e,a)=>l(e,"name",{value:a,configurable:!0});import{h as g,D as d}from"./bin.js";var k=Object.defineProperty,u=r((e,a)=>k(e,"name",{value:a,configurable:!0}),"t");const w=u(async({argument:e,logger:a,options:c,visConfig:s,workspaceRoot:i})=>{if(!e||e.length===0)throw new Error("No package specified. Usage: vis info <package> [field...]");const[t,...f]=e,n=i??process.cwd(),p=g(n,{configBackend:s?.install?.backend,configCorepack:s?.install?.corepack}),o=d(p,{fields:f,json:c.json||!1,package:t},n,a);o!==0&&o!==1&&(process.exitCode=o)},"execute");export{w as default};
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
`);
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
`)
|
|
16
|
-
|
|
17
|
-
`
|
|
18
|
-
|
|
1
|
+
var _=Object.defineProperty;var b=(s,e)=>_(s,"name",{value:e,configurable:!0});import{createRequire as C}from"node:module";import{isAccessibleSync as g,writeFileSync as $}from"@visulima/fs";import{M as h}from"../packem_shared/index-OlP7U_t5.js";import{findVisConfigFile as B}from"./applyDefaults.js";import{p as t,I as E,b as x,A as M}from"./bin.js";const T=C(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=b(s=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[e,o]=p.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return p.getBuiltinModule(s)}return T(s)},"__cjs_getBuiltinModule"),{execFileSync:I}=j("node:child_process"),{createInterface:O}=j("node:readline");var R=Object.defineProperty,u=b((s,e)=>R(s,"name",{value:e,configurable:!0}),"f");const N=u(s=>{const e=[];return g(h(s,"turbo.json"))&&e.push("turborepo"),g(h(s,"nx.json"))&&e.push("nx"),g(h(s,".moon"))&&e.push("moon"),e},"detectExistingTools"),P=u((s,e)=>new Promise(o=>{s.question(e,n=>{o(n.trim())})}),"ask"),d=u(async(s,e,o=!0)=>{const n=await P(s,`${e} ${o?"[Y/n]":"[y/N]"} `);return n===""?o:n.toLowerCase()==="y"||n.toLowerCase()==="yes"},"confirm"),w=u((s,e)=>{const o=[],n=Object.entries(e.allowBuilds).filter(([,r])=>r).map(([r])=>` "${r}": true,`).join(`
|
|
2
|
+
`);let i=` allowBuilds: ${n?`{
|
|
3
|
+
${n}
|
|
4
|
+
}`:"{}"},`;return e.enableSocket&&(i+=`
|
|
5
|
+
socket: { enabled: true },`),o.push(` security: {
|
|
6
|
+
${i}
|
|
7
|
+
},`),e.staged&&o.push(` staged: {
|
|
8
|
+
"*.{ts,tsx}": "eslint --fix",
|
|
9
|
+
"*.{ts,tsx,js,jsx,json,md}": "prettier --write",
|
|
10
|
+
},`),`import { defineConfig } from "@visulima/vis/config";
|
|
11
|
+
|
|
12
|
+
export default defineConfig({
|
|
13
|
+
${o.join(`
|
|
14
|
+
|
|
15
|
+
`)}
|
|
16
|
+
});
|
|
17
|
+
`},"generateConfigContent"),q=u(async(s,e,o)=>{const n=O({input:process.stdin,output:process.stdout});t.info(`
|
|
18
|
+
vis init — interactive setup
|
|
19
|
+
`);const i=await d(n," Enable Socket.dev security scanning?");i&&(t.success(" Socket.dev enabled — scores, alerts, and supply chain data active."),process.env.VIS_SOCKET_TOKEN||t.notice(" Set VIS_SOCKET_TOKEN for a custom API token (optional).")),t.info("");const r=await d(n," Scan for packages with build scripts?"),l={};if(r){t.info(" Scanning node_modules...");const c=E(s,{});if(c.length>0){t.info(` Found ${String(c.length)} package${c.length===1?"":"s"} with build scripts:
|
|
20
|
+
`);for(const f of c){const a=await d(n,` Allow ${f}?`,!1),S=f.split(" (")[0]??f;l[S]=a,a&&t.success(` ✓ ${S} approved`)}}else t.info(" No packages with build scripts found.")}t.info("");const y=await d(n," Set up pre-commit hooks (lint-staged)?",!1);let v=!1;(e.name==="pnpm"||e.name==="yarn"||e.name==="npm"||e.name==="bun")&&(t.info(""),v=await d(n,` Sync security settings to ${e.name} config?`));const m=N(s);if(m.length>0&&(t.info(""),t.info(` Detected existing tools: ${m.join(", ")}`),await d(n,` Run \`vis migrate\` for ${m.join(", ")}?`,!1))){n.close();const[c,...f]=e.name==="pnpm"?["pnpm","exec"]:e.name==="yarn"?["yarn","exec"]:e.name==="bun"?["bunx"]:["npx"];for(const a of m){t.info(` Migrating from ${a}...`);try{I(c,[...f,"vis","migrate",a],{cwd:s,stdio:"inherit"})}catch{t.warn(` Migration from ${a} had issues — run \`vis migrate ${a}\` manually.`)}}if(g(o))t.success(`Migrated config written to ${o}`);else{const a=w(e.name,{allowBuilds:l,enableSocket:i,staged:y});$(o,a),t.success(`Created ${o}`)}t.notice(" Run 'vis doctor' to see your project's full health status.");return}n.close(),t.info("");const k=w(e.name,{allowBuilds:l,enableSocket:i,staged:y});if($(o,k),t.success(`Created ${o}`),v){const c=Object.fromEntries(Object.entries(l).filter(([,a])=>a)),f=x(e.name,s,c);for(const a of f)t.success(` ${a}`)}t.info(""),t.info(" Setup complete. Your config:"),t.info(` Security: ${i?"Socket.dev enabled":"defaults only"}`),t.info(` Build scripts: ${Object.values(l).filter(Boolean).length} approved`),t.info(` Git hooks: ${y?"lint-staged configured":"not configured"}`),t.info(` PM sync: ${v?"done":"skipped"}`),t.info(""),t.notice(" Run 'vis doctor' to see your project's full health status."),t.info("")},"runInteractiveInit"),A=u((s,e,o,n)=>{const i=w(e.name,{allowBuilds:{},enableSocket:!1,staged:!1});if($(n,i),t.success(`Created ${n}`),t.info(" Secure defaults applied automatically by defineConfig()."),o.syncNative){const r=x(e.name,s,{});for(const l of r)t.success(` ${l}`)}t.info(""),t.notice("Run 'vis doctor' for a full health check, or 'vis init' in a terminal for guided setup.")},"runStaticInit"),G=u(async({options:s,workspaceRoot:e})=>{const o=e??process.cwd(),n=M(o),i=B(o);if(i&&!s.force){t.warn(`Config already exists: ${i}`),t.notice("Use --force to overwrite, or edit the existing file.");return}const r=i??h(o,"vis.config.ts");process.stdin.isTTY&&s.interactive!==!1?await q(o,n,r):A(o,n,s,r)},"execute");export{G as default};
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
`);let i=` allowBuilds: ${n?`{
|
|
3
|
-
${n}
|
|
4
|
-
}`:"{}"},`;return e.enableSocket&&(i+=`
|
|
5
|
-
socket: { enabled: true },`),o.push(` security: {
|
|
6
|
-
${i}
|
|
7
|
-
},`),e.staged&&o.push(` staged: {
|
|
8
|
-
"*.{ts,tsx}": "eslint --fix",
|
|
9
|
-
"*.{ts,tsx,js,jsx,json,md}": "prettier --write",
|
|
10
|
-
},`),`import { defineConfig } from "@visulima/vis/config";
|
|
11
|
-
|
|
12
|
-
export default defineConfig({
|
|
13
|
-
${o.join(`
|
|
14
|
-
|
|
15
|
-
`)}
|
|
16
|
-
});
|
|
17
|
-
`},"generateConfigContent"),q=u(async(s,e,o)=>{const n=O({input:process.stdin,output:process.stdout});t.info(`
|
|
18
|
-
vis init — interactive setup
|
|
19
|
-
`);const i=await d(n," Enable Socket.dev security scanning?");i&&(t.success(" Socket.dev enabled — scores, alerts, and supply chain data active."),process.env.VIS_SOCKET_TOKEN||t.notice(" Set VIS_SOCKET_TOKEN for a custom API token (optional).")),t.info("");const r=await d(n," Scan for packages with build scripts?"),l={};if(r){t.info(" Scanning node_modules...");const c=E(s,{});if(c.length>0){t.info(` Found ${String(c.length)} package${c.length===1?"":"s"} with build scripts:
|
|
20
|
-
`);for(const f of c){const a=await d(n,` Allow ${f}?`,!1),S=f.split(" (")[0]??f;l[S]=a,a&&t.success(` ✓ ${S} approved`)}}else t.info(" No packages with build scripts found.")}t.info("");const v=await d(n," Set up pre-commit hooks (lint-staged)?",!1);let y=!1;(e.name==="pnpm"||e.name==="yarn"||e.name==="npm"||e.name==="bun")&&(t.info(""),y=await d(n,` Sync security settings to ${e.name} config?`));const m=M(s);if(m.length>0&&(t.info(""),t.info(` Detected existing tools: ${m.join(", ")}`),await d(n,` Run \`vis migrate\` for ${m.join(", ")}?`,!1))){n.close();const[c,...f]=e.name==="pnpm"?["pnpm","exec"]:e.name==="yarn"?["yarn","exec"]:e.name==="bun"?["bunx"]:["npx"];for(const a of m){t.info(` Migrating from ${a}...`);try{T(c,[...f,"vis","migrate",a],{cwd:s,stdio:"inherit"})}catch{t.warn(` Migration from ${a} had issues — run \`vis migrate ${a}\` manually.`)}}if(g(o))t.success(`Migrated config written to ${o}`);else{const a=w(e.name,{allowBuilds:l,enableSocket:i,staged:v});b(o,a),t.success(`Created ${o}`)}t.notice(" Run 'vis doctor' to see your project's full health status.");return}n.close(),t.info("");const k=w(e.name,{allowBuilds:l,enableSocket:i,staged:v});if(b(o,k),t.success(`Created ${o}`),y){const c=Object.fromEntries(Object.entries(l).filter(([,a])=>a)),f=x(e.name,s,c);for(const a of f)t.success(` ${a}`)}t.info(""),t.info(" Setup complete. Your config:"),t.info(` Security: ${i?"Socket.dev enabled":"defaults only"}`),t.info(` Build scripts: ${Object.values(l).filter(Boolean).length} approved`),t.info(` Git hooks: ${v?"lint-staged configured":"not configured"}`),t.info(` PM sync: ${y?"done":"skipped"}`),t.info(""),t.notice(" Run 'vis doctor' to see your project's full health status."),t.info("")},"runInteractiveInit"),A=u((s,e,o,n)=>{const i=w(e.name,{allowBuilds:{},enableSocket:!1,staged:!1});if(b(n,i),t.success(`Created ${n}`),t.info(" Secure defaults applied automatically by defineConfig()."),o.syncNative){const r=x(e.name,s,{});for(const l of r)t.success(` ${l}`)}t.info(""),t.notice("Run 'vis doctor' for a full health check, or 'vis init' in a terminal for guided setup.")},"runStaticInit"),G=u(async({options:s,workspaceRoot:e})=>{const o=e??process.cwd(),n=R(o),i=B(o);if(i&&!s.force){t.warn(`Config already exists: ${i}`),t.notice("Use --force to overwrite, or edit the existing file.");return}const r=i??h(o,"vis.config.ts");process.stdin.isTTY&&s.interactive!==!1&&!s.noInteractive?await q(o,n,r):A(o,n,s,r)},"execute");export{G as default};
|
|
1
|
+
var j=Object.defineProperty;var f=(o,e)=>j(o,"name",{value:e,configurable:!0});import{createRequire as x}from"node:module";import{isAccessibleSync as z}from"@visulima/fs";import{M as y,K as R,c as L}from"../packem_shared/index-OlP7U_t5.js";import{p as t,A as M,h as T,o as $,r as A}from"./bin.js";import{s as B}from"../packem_shared/typosquats-XkC1CnOa.js";import{o as D}from"../packem_shared/utils-DrNg0XTR.js";const O=x(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,S=f(o=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[e,r]=i.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return i.getBuiltinModule(o)}return O(o)},"__cjs_getBuiltinModule"),{rmSync:q}=S("node:fs");var E=Object.defineProperty,b=f((o,e)=>E(o,"name",{value:e,configurable:!0}),"f");const F=["pnpm-lock.yaml","yarn.lock","package-lock.json","npm-shrinkwrap.json","bun.lock","bun.lockb"],P=b(o=>{let e=o;for(;;){for(const a of F)if(z(y(e,a)))return!0;const r=R(e);if(r===e||L(e).root===e)return!1;e=r}},"hasLockfile"),g=new Set(["aube","auto","bun","npm","pnpm","yarn"]),U=b(async({logger:o,options:e,visConfig:r,workspaceRoot:a})=>{const s=a??process.cwd();if(e.typosquatCheck!==!1&&!await B(s,r?.security?.typosquatAllowlist)){process.exitCode=1;return}const l=e.installer;if(l&&!g.has(l)){t.error(`Invalid --installer value: "${l}". Expected one of: ${[...g].join(", ")}.`),process.exitCode=1;return}const v=l,_=e.aube===!1;let c;try{c=_?M(s):T(s,{backend:v,configBackend:r?.install?.backend,configCorepack:r?.install?.corepack})}catch(n){t.error(n instanceof Error?n.message:String(n)),process.exitCode=1;return}const p=$(s,c);p&&t.warn(p);const w=D(e.filter),u=e.ci||!1,d=e.frozenLockfile||u,h=e.frozenLockfile===!1||e.force||e.lockfileOnly,C=P(s),m=d||!h&&C;if(!d&&m&&!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{q(y(s,"node_modules"),{force:!0,recursive:!0})}catch(n){t.error(`Failed to remove node_modules: ${n instanceof Error?n.message:String(n)}`),process.exitCode=1;return}}const k=A(c,{dev:e.dev||!1,filter:w,force:e.force||!1,frozenLockfile:m,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,o,{preferOffline:e.preferOffline||!1});k!==0&&(process.exitCode=k)},"execute");export{U as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var l=Object.defineProperty;var n=(e,a)=>l(e,"name",{value:a,configurable:!0});import{h as p,M as f}from"./bin.js";var g=Object.defineProperty,u=n((e,a)=>g(e,"name",{value:a,configurable:!0}),"s");const k=u(async({argument:e,logger:a,visConfig:o,workspaceRoot:s})=>{const t=e?.[0]??null,r=s??process.cwd(),i=p(r,{configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),c=f(i,t,r,a);c!==0&&(process.exitCode=c)},"execute");export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var d=Object.defineProperty;var t=(e,o)=>d(e,"name",{value:o,configurable:!0});import{h as g,x as u}from"./bin.js";var f=Object.defineProperty,b=t((e,o)=>f(e,"name",{value:o,configurable:!0}),"n");const k=b(async({argument:e,logger:o,visConfig:c,workspaceRoot:r})=>{const a=e;if(!a||a.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");const[s,...l]=a,n=r??process.cwd(),p=g(n,{configBackend:c?.install?.backend,configCorepack:c?.install?.corepack}),i=u(p,s,l,n,o);i!==0&&(process.exitCode=i)},"execute");export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var f=Object.defineProperty;var i=(e,o)=>f(e,"name",{value:o,configurable:!0});import{h as p,t as g}from"./bin.js";import{o as v}from"../packem_shared/utils-DrNg0XTR.js";var k=Object.defineProperty,m=i((e,o)=>k(e,"name",{value:o,configurable:!0}),"l");const b=m(async({argument:e,logger:o,options:a,visConfig:s,workspaceRoot:l})=>{const r=e;if(!r||r.length===0)throw new Error("No packages specified. Usage: vis remove <packages...>");const c=process.cwd(),n=p(l??c,{configBackend:s?.install?.backend,configCorepack:s?.install?.corepack}),t=g(n,{filter:v(a.filter),global:a.global||!1,packages:r,recursive:a.recursive||!1,saveDev:a.saveDev||!1,workspaceRoot:a.workspaceRoot||!1},c,o);t!==0&&(process.exitCode=t)},"execute");export{b as default};
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
var
|
|
1
|
+
var k=Object.defineProperty;var p=(t,e)=>k(t,"name",{value:e,configurable:!0});import{readLastRunSummary as S}from"@visulima/task-runner";import{p as m}from"./bin.js";import{r as g,l as v}from"../packem_shared/run-summary-utils-D39XBHWW.js";var x=Object.defineProperty,o=p((t,e)=>x(t,"name",{value:e,configurable:!0}),"s");const I=new Set(["json","table"]),y=o(t=>t??process.cwd(),"resolveWorkspaceRoot"),c=o(t=>t===void 0?"-":t<1e3?`${String(t)}ms`:`${(t/1e3).toFixed(2)}s`,"formatDuration"),l=o(t=>t.exitCode===void 0?t.cacheStatus:t.exitCode===0?t.cacheStatus==="MISS"?"OK":t.cacheStatus:`FAIL(${String(t.exitCode)})`,"formatStatus"),n=o((t,e)=>t.length>=e?t:t+" ".repeat(e-t.length),"padCell"),w=o(t=>t.exitCode!==void 0&&t.exitCode!==0,"isFailedTask"),$=o((t,e)=>{e.info(`Run ${t.id}`),e.info(` start: ${t.startTime}`),e.info(` end: ${t.endTime}`),e.info(` duration: ${c(t.duration)}`),e.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`),e.info(` env: node ${t.environment.nodeVersion} · ${t.environment.platform}/${t.environment.arch}`),e.info("")},"renderRunHeader"),T=o((t,e)=>{if(t.length===0){e.info("(no tasks match the current filter)");return}const a=t.map(r=>({duration:c(r.duration),hash:r.hash?r.hash.slice(0,12):"-",status:l(r),taskId:r.taskId})),s={duration:Math.max(8,...a.map(r=>r.duration.length)),hash:Math.max(4,...a.map(r=>r.hash.length)),status:Math.max(6,...a.map(r=>r.status.length)),taskId:Math.max(4,...a.map(r=>r.taskId.length))};e.info(` ${n("task",s.taskId)} ${n("status",s.status)} ${n("duration",s.duration)} ${n("hash",s.hash)}`),e.info(` ${"-".repeat(s.taskId)} ${"-".repeat(s.status)} ${"-".repeat(s.duration)} ${"-".repeat(s.hash)}`);for(const r of a)e.info(` ${n(r.taskId,s.taskId)} ${n(r.status,s.status)} ${n(r.duration,s.duration)} ${n(r.hash,s.hash)}`)},"renderTaskTable"),C=o((t,e,a)=>{$(t,a),a.info(`Task ${e.taskId}`),a.info(` status: ${l(e)}`),a.info(` cache: ${e.cacheStatus}`),a.info(` duration: ${c(e.duration)}`),a.info(` exit: ${e.exitCode===void 0?"-":String(e.exitCode)}`),a.info(` hash: ${e.hash??"(none)"}`),a.info(` start: ${e.startTime??"-"}`),a.info(` end: ${e.endTime??"-"}`),e.dependencies.length>0&&a.info(` deps: ${e.dependencies.join(", ")}`),a.info(""),m.info(`Drill into hash inputs with: vis cache why ${e.taskId} --run ${t.id}`)},"renderTaskDetail"),R=o(t=>{process.stdout.write(`${JSON.stringify(t.map(e=>({id:e.id,mtime:new Date(e.mtimeMs).toISOString(),path:e.path})),void 0,2)}
|
|
2
|
+
`)},"renderListJson"),j=o((t,e)=>{if(t.length===0){m.info("No recorded runs found in .task-runner/runs/. Run with --summarize to record a run.");return}const a={id:Math.max(2,...t.map(s=>s.id.length)),mtime:24};e.info(` ${n("id",a.id)} ${n("mtime",a.mtime)}`),e.info(` ${"-".repeat(a.id)} ${"-".repeat(a.mtime)}`);for(const s of t)e.info(` ${n(s.id,a.id)} ${new Date(s.mtimeMs).toISOString()}`)},"renderListTable"),O=o((t,e)=>{let{tasks:a}=t;return e.task!==void 0&&(a=a.filter(s=>s.taskId===e.task)),e.failed&&(a=a.filter(s=>w(s))),a},"filterTasks"),b=o(async(t,e)=>{const{failed:a,format:s,runId:r,task:d,workspaceRoot:h}=t,i=r===void 0?await S(h):await g(h,r);if(!i){if(s==="json"){process.stdout.write(`${JSON.stringify({error:"no-summary",runId:r??null},void 0,2)}
|
|
3
|
+
`),process.exitCode=1;return}r===void 0?m.error("No previous run summary found. Run a task first to populate `.task-runner/last-summary.json`."):m.error(`Run summary "${r}" not found in .task-runner/runs/.`),process.exitCode=1;return}const f=O(i,{failed:a,task:d});if(d!==void 0&&f.length===0){if(s==="json"){process.stdout.write(`${JSON.stringify({error:"task-not-in-summary",runId:i.id,taskId:d},void 0,2)}
|
|
4
|
+
`),process.exitCode=1;return}m.error(`Task "${d}" was not part of run ${i.id}.`),process.exitCode=1;return}if(i.stats.failed>0&&(process.exitCode=1),s==="json"){process.stdout.write(`${JSON.stringify({duration:i.duration,endTime:i.endTime,environment:i.environment,runId:i.id,startTime:i.startTime,stats:i.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)}
|
|
5
|
+
`);return}if(d!==void 0){C(i,f[0],e);return}$(i,e),T(f,e)},"runReplay"),L=o(async({logger:t,options:e,workspaceRoot:a})=>{const s=y(a),r=e.format??"table";if(!I.has(r)){m.error(`Invalid --format: ${r}. Expected "table" or "json".`),process.exitCode=1;return}if(e.list===!0){const d=await v(s);if(r==="json"){R(d);return}j(d,t);return}await b({failed:e.failed===!0,format:r,runId:e.run,task:e.task,workspaceRoot:s},t)},"replayExecute");export{L as default,L as replayExecute,b as runReplay};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var j=Object.defineProperty;var g=(n,r)=>j(n,"name",{value:r,configurable:!0});import{getAffectedProjects as v}from"@visulima/task-runner";import{
|
|
1
|
+
var j=Object.defineProperty;var g=(n,r)=>j(n,"name",{value:r,configurable:!0});import{getAffectedProjects as v}from"@visulima/task-runner";import{y as E,m as F}from"./bin.js";import{f as b}from"../packem_shared/selectors-BvtUXWGY.js";var S=Object.defineProperty,$=g((n,r)=>S(n,"name",{value:r,configurable:!0}),"m");const T=$(async({argument:n,logger:r,options:e,runtime:l,visConfig:h,workspaceRoot:u})=>{const f=n[0];if(!f)throw new Error("Missing target. Usage: vis affected <target>");if(!u)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const s=u,{packageJsons:m,workspace:i}=E(s,h),w=F(s,i,m),d=new Set(["deep","direct","none"]),c=e.downstream??"deep",p=e.upstream??"none";if(!d.has(c))throw new Error(`Invalid --downstream value: "${c}". Must be "none", "direct", or "deep".`);if(!d.has(p))throw new Error(`Invalid --upstream value: "${p}". Must be "none", "direct", or "deep".`);const y={base:e.base,downstream:c,head:e.head,projectGraph:w,projects:i.projects,upstream:p,workspaceRoot:s},o=await v(y);if(o.changedFiles.length===0){r.info("No files changed. Nothing to run.");return}if(o.affectedProjects.length===0){r.info("No projects affected by the changes.");return}let{affectedProjects:a}=o;if(e.query&&(a=b(a,i,e.query),a.length===0)){r.info(`Query "${String(e.query)}" matched no affected projects.`);return}r.info(`Affected projects: ${a.join(", ")}`),o.changedFiles.length>0&&(process.env.VIS_AFFECTED_FILES=o.changedFiles.join(`
|
|
2
2
|
`));const t=[f,`--projects=${a.join(",")}`];e.parallel!==void 0&&t.push(`--parallel=${String(e.parallel)}`),e.cache||t.push("--no-cache"),e.dryRun&&t.push("--dry-run"),e.partition&&t.push(`--partition=${String(e.partition)}`),e.reverse&&t.push("--reverse"),typeof e.runnerTags=="string"&&e.runnerTags!==""&&t.push(`--runner-tags=${e.runnerTags}`);try{await l.runCommand("run",{argv:t})}finally{delete process.env.VIS_AFFECTED_FILES}},"execute");export{T as default};
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)},"renderListJson"),j=o((t,e)=>{if(t.length===0){m.info("No recorded runs found in .task-runner/runs/. Run with --summarize to record a run.");return}const a={id:Math.max(2,...t.map(s=>s.id.length)),mtime:24};e.info(` ${n("id",a.id)} ${n("mtime",a.mtime)}`),e.info(` ${"-".repeat(a.id)} ${"-".repeat(a.mtime)}`);for(const s of t)e.info(` ${n(s.id,a.id)} ${new Date(s.mtimeMs).toISOString()}`)},"renderListTable"),O=o((t,e)=>{let{tasks:a}=t;return e.task!==void 0&&(a=a.filter(s=>s.taskId===e.task)),e.failed&&(a=a.filter(s=>w(s))),a},"filterTasks"),b=o(async(t,e)=>{const{failed:a,format:s,runId:r,task:d,workspaceRoot:h}=t,i=r===void 0?await S(h):await g(h,r);if(!i){if(s==="json"){process.stdout.write(`${JSON.stringify({error:"no-summary",runId:r??null},void 0,2)}
|
|
3
|
-
`),process.exitCode=1;return}r===void 0?m.error("No previous run summary found. Run a task first to populate `.task-runner/last-summary.json`."):m.error(`Run summary "${r}" not found in .task-runner/runs/.`),process.exitCode=1;return}const f=O(i,{failed:a,task:d});if(d!==void 0&&f.length===0){if(s==="json"){process.stdout.write(`${JSON.stringify({error:"task-not-in-summary",runId:i.id,taskId:d},void 0,2)}
|
|
4
|
-
`),process.exitCode=1;return}m.error(`Task "${d}" was not part of run ${i.id}.`),process.exitCode=1;return}if(i.stats.failed>0&&(process.exitCode=1),s==="json"){process.stdout.write(`${JSON.stringify({duration:i.duration,endTime:i.endTime,environment:i.environment,runId:i.id,startTime:i.startTime,stats:i.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)}
|
|
5
|
-
`);return}if(d!==void 0){C(i,f[0],e);return}$(i,e),T(f,e)},"runReplay"),L=o(async({logger:t,options:e,workspaceRoot:a})=>{const s=y(a),r=e.format??"table";if(!I.has(r)){m.error(`Invalid --format: ${r}. Expected "table" or "json".`),process.exitCode=1;return}if(e.list===!0){const d=await v(s);if(r==="json"){R(d);return}j(d,t);return}await b({failed:e.failed===!0,format:r,runId:e.run,task:e.task,workspaceRoot:s},t)},"replayExecute");export{L as default,L as replayExecute,b as runReplay};
|
|
1
|
+
var w=Object.defineProperty;var y=(e,t)=>w(e,"name",{value:t,configurable:!0});import{createRequire as C}from"node:module";import{c as f,d as v,y as F,m as I,E as J,e as _}from"./bin.js";import{isAccessibleSync as P,readJsonSync as V}from"@visulima/fs";import{M as b}from"../packem_shared/index-OlP7U_t5.js";import{enforceProjectConstraints as z}from"@visulima/task-runner";import{a as A}from"../packem_shared/flakiness-BIg1rwvp.js";import{c as B}from"../packem_shared/runtime-check-BaKni2y1.js";const M=C(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,q=y(e=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[t,i]=n.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return n.getBuiltinModule(e)}return M(e)},"__cjs_getBuiltinModule"),{readdirSync:x}=q("node:fs");var E=Object.defineProperty,O=y((e,t)=>E(e,"name",{value:t,configurable:!0}),"h");const r=O(e=>e?f("✓"):v("✗"),"icon"),Q=O(async({logger:e,options:t,visConfig:i,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root.");const{config:$,packageJsons:T,workspace:u}=F(s,i),R=I(s,u,T),j=Object.keys(u.projects).length,k=new Set(Object.values(u.projects).flatMap(p=>Object.keys(p.targets??{}))).size,a=B(s);let o=0;$.constraints&&(o=z(R,$.constraints).length);const c=A(s,{minRuns:2});let l;const g=b(s,".task-runner","runs");if(P(g)){const p=x(g).filter(d=>d.endsWith(".json")).sort();let m=0,S=0;for(const d of p.slice(-20))try{const h=V(b(g,d));h.stats&&(m+=h.stats.total??0,S+=h.stats.cached??0)}catch{continue}m>0&&(l=`${(S/m*100).toFixed(0)}%`)}if(t.json){e.info(JSON.stringify({cacheHitRate:l??null,constraintViolations:o,flakyTasks:c.length,projects:j,runtimeIssues:a.length,targets:k},null,2));return}e.info(""),e.info(` ${J("VIS STATUS")}`),e.info(""),e.info(` ${r(!0)} ${String(j)} projects · ${String(k)} unique targets`),e.info(` ${r(a.length===0)} Runtime: ${a.length===0?f("OK"):_(`${String(a.length)} issue(s)`)}`),e.info(` ${r(o===0)} Constraints: ${o===0?f("OK"):v(`${String(o)} violation(s)`)}`),e.info(` ${r(c.length===0)} Flaky tasks: ${c.length===0?f("none"):_(String(c.length))}`),l&&e.info(` ${r(!0)} Cache hit rate: ${l} (last 20 runs)`),e.info("")},"execute");export{Q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var y=Object.defineProperty;var j=(t,e)=>y(t,"name",{value:e,configurable:!0});import{createTaskGraph as b}from"@visulima/task-runner";import{y as v,m as E}from"./bin.js";var T=Object.defineProperty,w=j((t,e)=>T(t,"name",{value:e,configurable:!0}),"h");const O=w((t,e)=>{const s=new Map;for(const[i,r]of Object.entries(t.dependencies))for(const f of r){const c=s.get(f)??[];c.push(i),s.set(f,c)}if(!t.tasks[e])return;const a=new Set([e]),o=[{node:e,path:[e]}];for(;o.length>0;){const i=o.shift();if(t.roots.includes(i.node))return i.path;for(const r of s.get(i.node)??[])a.has(r)||(a.add(r),o.push({node:r,path:[r,...i.path]}))}return[e]},"findShortestPathToRoot"),x=w((t,e)=>{const s=[];for(const[a,o]of Object.entries(t.dependencies))o.includes(e)&&s.push(a);return s.sort()},"collectParents"),I=w(async({argument:t,logger:e,visConfig:s,workspaceRoot:a})=>{if(!a)throw new Error("Could not determine workspace root.");const o=t[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:r}=v(a,s),f=E(a,r,i),[c,k]=o.split(":",2),$=r.projects[c];if(!$)throw new Error(`Unknown project "${c}".`);if(!$.targets?.[k])throw new Error(`Project "${c}" has no target "${k}".`);const m=Object.entries(r.projects).flatMap(([n,u])=>Object.keys(u.targets??{}).map(h=>({id:`${n}:${h}`,outputs:[],overrides:{},target:{project:n,target:h}}))),p=b(m,{projectGraph:f,workspace:r});if(!p.tasks[o])throw new Error(`Task "${o}" is not reachable in the graph.`);const d=O(p,o),g=x(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,u]of d.entries()){const h=n===0?" ":`${" ".repeat(n+1)}└─ `;e.info(`${h}${u}`)}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 l=p.dependencies[o]??[];if(l.length>0){e.info(`This task depends on ${l.length} task(s):`);for(const n of[...l].sort())e.info(` - ${n}`);e.info("")}},"execute");export{I as default};
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
var
|
|
1
|
+
var P=Object.defineProperty;var v=(e,n)=>P(e,"name",{value:n,configurable:!0});import{createRequire as R}from"node:module";import{c as S,d as W,e as A,E as d,p as o}from"./bin.js";import{M as N}from"../packem_shared/index-OlP7U_t5.js";import{S as w,g as C,w as M,b as B,p as q,f as j,a as k,c as H,u as y,d as K,e as O,h as D}from"../packem_shared/toolchain-B7sIiJxK.js";const I=R(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=v(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 I(e)},"__cjs_getBuiltinModule"),{spawnSync:U}=b("node:child_process"),{writeFileSync:F}=b("node:fs");var L=Object.defineProperty,f=v((e,n)=>L(e,"name",{value:n,configurable:!0}),"d");const x=["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],G=f(e=>x.includes(e),"isKnownTool"),p=f(e=>e?S("✓"):W("✗"),"icon"),T=A("⚠"),J=f(e=>{if(e.installed){const n=e.version?` v${e.version}`:"",i=e.configFiles.length>0?` (${e.configFiles.join(", ")})`:"";return`${p(!0)} ${e.name}${n}${i}`}return`${T} ${e.name} — referenced by ${e.configFiles.join(", ")} but not installed`},"renderManagerLine"),z=f(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)`)},"renderToolManager"),Q=f(e=>e.matches?p(!0):e.actual?T:p(!1),"toolIcon"),V=f(e=>{if(o.info(""),o.info(d("── Toolchain ───────────────────────")),e.detected.length===0)o.info(` ${p(!1)} No version manager detected`),o.notice(` Install one of: ${w.join(", ")}`);else for(const n of e.detected)o.info(` ${J(n)}`);if(o.info(""),e.tools.length===0){o.info(` ${d("No tool pins found — add engines.node, .nvmrc, or a manager config file.")}`);return}o.info(d("── Tools ───────────────────────────"));for(const n of e.tools){const i=`${n.expected.tool} ${n.expected.version}`,r=n.actual?`actual ${n.actual}`:"not installed",t=n.matches?"":d(` [${n.expected.source}]`),s=z(n),u=s===""?"":` ${s}`;o.info(` ${Q(n)} ${i} — ${r}${t}${u}`),n.manager.note&&o.notice(` ${n.manager.note}`)}},"printStatus"),X=f((e,n,i)=>{const r=C(e,n);if(i.json){process.stdout.write(`${JSON.stringify({detected:r.detected.map(s=>({binPath:s.binPath??null,configFiles:s.configFiles,installed:s.installed,name:s.name,version:s.version??null})),tools:r.tools.map(s=>({actual:s.actual??null,expected:s.expected.version,manager:s.manager.name,managerInstalled:s.manager.installed,matches:s.matches,note:s.manager.note??null,source:s.expected.source,tool:s.expected.tool}))},void 0,2)}
|
|
2
|
+
`);return}V(r);const t=r.tools.filter(s=>!s.matches);t.length>0&&(o.info(""),o.notice(" Run `vis toolchain install` to install pinned versions.")),i.exitCode&&t.length>0&&(process.exitCode=1)},"executeStatus"),Y=f(e=>{const n=new Map;for(const i of e){const r=n.get(i.manager.name);r?r.push(i):n.set(i.manager.name,[i])}return n},"groupByManager"),E=f((e,n,i)=>U(e,n,{cwd:i,stdio:"inherit"}).status??1,"runInvocation"),Z=f((e,n,i)=>{const r=C(e,n),t=r.tools.filter(c=>!c.matches);if(t.length===0){o.success("Everything already matches — nothing to install.");return}const s=t.some(c=>c.manager.name!=="self-activate"&&c.manager.name!=="none");if(r.detected.length===0&&s){o.error(`No version manager detected. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}const u=Y(t);let l=!1,g=0;for(const[c,m]of u){if(c==="self-activate"){for(const{expected:a}of m){if(a.source==="packageManager")o.info(`${d("$")} (${a.tool} will self-activate from packageManager on next invocation)`);else if(o.info(`${d("$")} Writing packageManager=${a.tool}@${a.version}`),i.dryRun)l=!0;else try{M(e,a),l=!0}catch(h){o.error(h.message),g=1}o.notice(` ${a.tool} ${a.version} — no install needed`)}continue}if(c==="none"){for(const{expected:a}of m)o.warn(`Cannot install ${a.tool} ${a.version} — no manager can handle it.`);g=1;continue}if(!r.detected.find(a=>a.name===c)?.installed){o.error(`${c} is referenced but not on PATH — install it first, then rerun \`vis toolchain install\`.`),g=1;continue}const _=m.map(a=>B(c,a.expected)).filter(Boolean);for(const a of _){if(!a)continue;if(a.bin==="nvm"&&a.args.length===0){o.error("nvm is a shell function — run `nvm install` in your shell, then rerun `vis toolchain install`."),a.hint&&o.notice(` ${a.hint}`),g=1;continue}if(o.info(`${d("$")} ${a.bin} ${a.args.join(" ")}`),a.hint&&o.notice(` ${a.hint}`),i.dryRun){l=!0;continue}const h=E(a.bin,a.args,e);if(l=!0,h!==0){g=h;break}}}if(g!==0){process.exitCode=g;return}l&&o.success("Toolchain installed.")},"executeInstall"),ee=f((e,n,i,r)=>{if(!i)throw new Error("Usage: vis toolchain use <tool>@<version> (e.g. vis toolchain use node@22.13.0)");const t=q(i);if(!t)throw new Error(`Could not parse "${i}". Expected "<tool>@<version>" where <tool> is one of ${x.join(", ")}.`);const s=j(e),u=k(t,s,n);if(u.name==="none"){o.error(`No manager can pin ${t.tool}. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}if(!u.installed){o.error(`The best manager for ${t.tool} (${u.name}) is not on PATH. ${u.note??""}`),process.exitCode=1;return}const l=H(u.name,t);if(!l){o.error(`${u.name} cannot pin ${t.tool}. Use a different manager, or set \`toolchain.tools.${t.tool}\` in vis.config.ts.`),process.exitCode=1;return}if(u.name==="self-activate"){if(o.info(`${d("→")} Writing packageManager field to package.json...`),r.dryRun){o.notice(` Would set packageManager: "${t.tool}@${t.version}"`);return}try{const c=M(e,t);if(!c){o.error(`Refusing to pin non-package-manager tool ${t.tool} via the packageManager field.`),process.exitCode=1;return}if(o.success(`Set packageManager: "${c}" — ${t.tool} will activate this version on next invocation.`),r.engines!==!1){const m=y(e,t);m&&o.success(`Updated package.json engines.${t.tool} → ${m}.`)}}catch(c){o.error(c.message),process.exitCode=1}return}if(l.args.length===0&&u.name==="nvm"&&t.tool==="node"){const c=N(e,".nvmrc");if(o.info(`${d("→")} Writing ${c}...`),r.dryRun){o.notice(` Would write ${t.version} to .nvmrc`);return}try{F(c,`${t.version}
|
|
3
|
+
`)}catch(m){o.error(`Failed to write .nvmrc: ${m.message}`),process.exitCode=1;return}o.success(`Wrote ${t.version} to .nvmrc.`),o.notice(" nvm is a shell function — run `nvm use` to activate it in this shell.");return}if(l.args.length===0){o.error(`${u.name} cannot pin ${t.tool} from a subprocess. ${l.configChange?.hint??""}`),l.configChange&&o.notice(` Edit ${l.configChange.file} by hand and rerun \`vis toolchain status\` to verify.`),process.exitCode=1;return}if(o.info(`${d("$")} ${l.bin} ${l.args.join(" ")}`),l.configChange&&o.notice(` Will update ${l.configChange.file} — ${l.configChange.hint}`),r.dryRun)return;const g=E(l.bin,l.args,e);if(g!==0){process.exitCode=g;return}if(o.success(`Pinned ${t.tool} to ${t.version}.`),r.engines!==!1)try{const c=y(e,t);c&&o.success(`Updated package.json engines.${t.tool} → ${c}.`)}catch(c){o.warn(`Could not update engines.${t.tool}: ${c.message}`)}},"executeUse"),ne=f((e,n,i)=>{if(!i)throw new Error("Usage: vis toolchain which <tool> (e.g. vis toolchain which node)");const r=i.toLowerCase();if(!G(r))throw new Error(`Unknown tool "${i}". Known: ${x.join(", ")}.`);const t=j(e),s=k({source:"vis.config.ts",tool:r,version:"*"},t,n),u=s.installed&&s.name!=="self-activate"&&s.name!=="none"?t.find(g=>g.name===s.name):void 0,l=u?K(u,r):O(r);if(!l){o.error(`${i} not found in PATH${u?` or via ${u.name}`:""}.`),process.exitCode=1;return}process.stdout.write(`${l}
|
|
4
|
+
`)},"executeWhich"),oe=f((e,n)=>{const i=D(e,n);process.stdout.write(`${i.name}
|
|
5
|
+
`)},"executeDetect"),ce=f(async({argument:e,options:n,visConfig:i,workspaceRoot:r})=>{if(!r)throw new Error("Could not determine workspace root. Run inside a monorepo.");const t=e[0]??"status",s=i?.toolchain;switch(t){case"detect":{oe(r,s);return}case"install":{Z(r,s,n);return}case"status":{X(r,s,n);return}case"use":{ee(r,s,e[1],n);return}case"which":{ne(r,s,e[1]);return}default:throw new Error(`Unknown toolchain action "${t}". Known: status, detect, install, use, which.`)}},"execute");export{ce as default};
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
`);return}V(i);const t=i.tools.filter(s=>!s.matches);t.length>0&&(o.info(""),o.notice(" Run `vis toolchain install` to install pinned versions.")),r.exitCode&&t.length>0&&(process.exitCode=1)},"executeStatus"),Y=f(e=>{const n=new Map;for(const r of e){const i=n.get(r.manager.name);i?i.push(r):n.set(r.manager.name,[r])}return n},"groupByManager"),_=f((e,n,r)=>U(e,n,{cwd:r,stdio:"inherit"}).status??1,"runInvocation"),Z=f((e,n,r)=>{const i=C(e,n),t=i.tools.filter(c=>!c.matches);if(t.length===0){o.success("Everything already matches — nothing to install.");return}const s=t.some(c=>c.manager.name!=="self-activate"&&c.manager.name!=="none");if(i.detected.length===0&&s){o.error(`No version manager detected. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}const u=Y(t);let l=!1,g=0;for(const[c,m]of u){if(c==="self-activate"){for(const{expected:a}of m){if(a.source==="packageManager")o.info(`${d("$")} (${a.tool} will self-activate from packageManager on next invocation)`);else if(o.info(`${d("$")} Writing packageManager=${a.tool}@${a.version}`),r.dryRun)l=!0;else try{j(e,a),l=!0}catch(h){o.error(h.message),g=1}o.notice(` ${a.tool} ${a.version} — no install needed`)}continue}if(c==="none"){for(const{expected:a}of m)o.warn(`Cannot install ${a.tool} ${a.version} — no manager can handle it.`);g=1;continue}if(!i.detected.find(a=>a.name===c)?.installed){o.error(`${c} is referenced but not on PATH — install it first, then rerun \`vis toolchain install\`.`),g=1;continue}const E=m.map(a=>B(c,a.expected)).filter(Boolean);for(const a of E){if(!a)continue;if(a.bin==="nvm"&&a.args.length===0){o.error("nvm is a shell function — run `nvm install` in your shell, then rerun `vis toolchain install`."),a.hint&&o.notice(` ${a.hint}`),g=1;continue}if(o.info(`${d("$")} ${a.bin} ${a.args.join(" ")}`),a.hint&&o.notice(` ${a.hint}`),r.dryRun){l=!0;continue}const h=_(a.bin,a.args,e);if(l=!0,h!==0){g=h;break}}}if(g!==0){process.exitCode=g;return}l&&o.success("Toolchain installed.")},"executeInstall"),ee=f((e,n,r,i)=>{if(!r)throw new Error("Usage: vis toolchain use <tool>@<version> (e.g. vis toolchain use node@22.13.0)");const t=q(r);if(!t)throw new Error(`Could not parse "${r}". Expected "<tool>@<version>" where <tool> is one of ${x.join(", ")}.`);const s=k(e),u=M(t,s,n);if(u.name==="none"){o.error(`No manager can pin ${t.tool}. Install one of: ${w.join(", ")}.`),process.exitCode=1;return}if(!u.installed){o.error(`The best manager for ${t.tool} (${u.name}) is not on PATH. ${u.note??""}`),process.exitCode=1;return}const l=H(u.name,t);if(!l){o.error(`${u.name} cannot pin ${t.tool}. Use a different manager, or set \`toolchain.tools.${t.tool}\` in vis.config.ts.`),process.exitCode=1;return}if(u.name==="self-activate"){if(o.info(`${d("→")} Writing packageManager field to package.json...`),i.dryRun){o.notice(` Would set packageManager: "${t.tool}@${t.version}"`);return}try{const c=j(e,t);if(!c){o.error(`Refusing to pin non-package-manager tool ${t.tool} via the packageManager field.`),process.exitCode=1;return}if(o.success(`Set packageManager: "${c}" — ${t.tool} will activate this version on next invocation.`),i.engines!==!1){const m=y(e,t);m&&o.success(`Updated package.json engines.${t.tool} → ${m}.`)}}catch(c){o.error(c.message),process.exitCode=1}return}if(l.args.length===0&&u.name==="nvm"&&t.tool==="node"){const c=N(e,".nvmrc");if(o.info(`${d("→")} Writing ${c}...`),i.dryRun){o.notice(` Would write ${t.version} to .nvmrc`);return}try{F(c,`${t.version}
|
|
3
|
-
`)}catch(m){o.error(`Failed to write .nvmrc: ${m.message}`),process.exitCode=1;return}o.success(`Wrote ${t.version} to .nvmrc.`),o.notice(" nvm is a shell function — run `nvm use` to activate it in this shell.");return}if(l.args.length===0){o.error(`${u.name} cannot pin ${t.tool} from a subprocess. ${l.configChange?.hint??""}`),l.configChange&&o.notice(` Edit ${l.configChange.file} by hand and rerun \`vis toolchain status\` to verify.`),process.exitCode=1;return}if(o.info(`${d("$")} ${l.bin} ${l.args.join(" ")}`),l.configChange&&o.notice(` Will update ${l.configChange.file} — ${l.configChange.hint}`),i.dryRun)return;const g=_(l.bin,l.args,e);if(g!==0){process.exitCode=g;return}if(o.success(`Pinned ${t.tool} to ${t.version}.`),i.engines!==!1)try{const c=y(e,t);c&&o.success(`Updated package.json engines.${t.tool} → ${c}.`)}catch(c){o.warn(`Could not update engines.${t.tool}: ${c.message}`)}},"executeUse"),ne=f((e,n,r)=>{if(!r)throw new Error("Usage: vis toolchain which <tool> (e.g. vis toolchain which node)");const i=r.toLowerCase();if(!G(i))throw new Error(`Unknown tool "${r}". Known: ${x.join(", ")}.`);const t=k(e),s=M({source:"vis.config.ts",tool:i,version:"*"},t,n),u=s.installed&&s.name!=="self-activate"&&s.name!=="none"?t.find(g=>g.name===s.name):void 0,l=u?K(u,i):O(i);if(!l){o.error(`${r} not found in PATH${u?` or via ${u.name}`:""}.`),process.exitCode=1;return}process.stdout.write(`${l}
|
|
4
|
-
`)},"executeWhich"),oe=f((e,n)=>{const r=D(e,n);process.stdout.write(`${r.name}
|
|
5
|
-
`)},"executeDetect"),le=f(async({argument:e,options:n,visConfig:r,workspaceRoot:i})=>{if(!i)throw new Error("Could not determine workspace root. Run inside a monorepo.");const t=e[0]??"status",s=r?.toolchain;switch(t){case"detect":{oe(i,s);return}case"install":{Z(i,s,n);return}case"status":{X(i,s,n);return}case"use":{ee(i,s,e[1],n);return}case"which":{ne(i,s,e[1]);return}default:throw new Error(`Unknown toolchain action "${t}". Known: status, detect, install, use, which.`)}},"execute");export{le as default};
|
|
1
|
+
var p=Object.defineProperty;var c=(e,o)=>p(e,"name",{value:o,configurable:!0});import{h as f,u}from"./bin.js";var g=Object.defineProperty,d=c((e,o)=>g(e,"name",{value:o,configurable:!0}),"t");const v=d(async({argument:e,logger:o,options:n,visConfig:a,workspaceRoot:t})=>{const i=e||[],r=t??process.cwd(),l=f(r,{configBackend:a?.install?.backend,configCorepack:a?.install?.corepack}),s=u(l,i,n.recursive||!1,r,o);s!==0&&(process.exitCode=s)},"execute");export{v as default};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a=Object.defineProperty;var s=(n,e)=>a(n,"name",{value:e,configurable:!0});import{createRequire as f}from"node:module";import{v}from"./bin.js";const d=f(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=s(n=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,r]=t.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return t.getBuiltinModule(n)}return d(n)},"__cjs_getBuiltinModule"),{execSync:p,spawnSync:m}=l("node:child_process");var g=Object.defineProperty,y=s((n,e)=>g(n,"name",{value:e,configurable:!0}),"r");const w=y(async({argument:n,logger:e,options:r})=>{const c=n?.[0];e.info("info: checking for updates...");const o=v.version;let i;try{const u=p("npm view @visulima/vis version",{encoding:"utf8"}).trim();i=c??u}catch{throw new Error("Failed to query npm registry. Check your network connection.")}if(o===i&&!r.force){e.info(`
|
|
2
|
+
✓ Already up to date (${o})`);return}if(r.check){o===i?e.info(`✓ Already up to date (${o})`):e.info(`info: found @visulima/vis@${i} (current: ${o})`);return}if(e.info(`info: found @visulima/vis@${i} (current: ${o})`),e.info("info: installing..."),m("npm",["install","-g",`@visulima/vis@${i}`],{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 ${o} → ${i}`)},"execute");export{w as default};
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
✓ Already up to date (${o})`);return}if(r.check){o===i?e.info(`✓ Already up to date (${o})`):e.info(`info: found @visulima/vis@${i} (current: ${o})`);return}if(e.info(`info: found @visulima/vis@${i} (current: ${o})`),e.info("info: installing..."),m("npm",["install","-g",`@visulima/vis@${i}`],{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 ${o} → ${i}`)},"execute");export{w as default};
|
|
1
|
+
var p=Object.defineProperty;var t=(a,o)=>p(a,"name",{value:o,configurable:!0});import{h as f,C as d}from"./bin.js";import{o as g}from"../packem_shared/utils-DrNg0XTR.js";var v=Object.defineProperty,u=t((a,o)=>v(a,"name",{value:o,configurable:!0}),"n");const h=u(async({argument:a,logger:o,options:e,visConfig:l,workspaceRoot:c})=>{const s=a;if(!s||s.length===0)throw new Error("No packages specified. Usage: vis why <package...>");const n=c??process.cwd(),i=f(n,{configBackend:l?.install?.backend,configCorepack:l?.install?.corepack}),r=d(i,{depth:e.depth===void 0?void 0:Number(e.depth),dev:e.dev||!1,filter:g(e.filter),global:e.global||!1,json:e.json||!1,long:e.long||!1,noOptional:e.optional===!1,packages:s,parseable:e.parseable||!1,prod:e.prod||!1,recursive:e.recursive||!1},n,o);r!==0&&r!==1&&(process.exitCode=r)},"execute");export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var q=Object.defineProperty;var $=(t,r)=>q(t,"name",{value:r,configurable:!0});import{createRequire as A}from"node:module";import{B as I,w as b,K as N,p as g,L as R,E as M,d as U,e as B,c as E,Q as J,X as z,Y as Q,a as Y,y as Z,U as K,R as V,Z as W,r as X,J as G,$ as H,h as ee,a0 as oe}from"./bin.js";import{readJsonSync as te,writeJsonSync as se}from"@visulima/fs";import{M as ne}from"../packem_shared/index-OlP7U_t5.js";import{r as re}from"../packem_shared/typosquats-XkC1CnOa.js";import{d as C,o as j}from"../packem_shared/utils-DrNg0XTR.js";const L=A(import.meta.url),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=$(t=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[r,e]=k.versions.node.split(".").map(Number);if(r>22||r===22&&e>=3||r===20&&e>=16)return k.getBuiltinModule(t)}return L(t)},"__cjs_getBuiltinModule"),{createInterface:F}=O("node:readline");var ae=Object.defineProperty,h=$((t,r)=>ae(t,"name",{value:r,configurable:!0}),"c");const P=h(t=>t==="default"?"catalog:":`catalog:${t}`,"buildCatalogRef"),S=h(t=>t==="default"?"default catalog":`catalog "${t}"`,"labelForCatalog"),ie=h((t,r)=>{const e=[];for(const[o,n]of r)o.includes(":")||n.has(t)&&e.push(o);if(e.length===0)return;if(e.length===1){const[o]=e;return{source:S(o),spec:P(o)}}const a=e.find(o=>o==="default")??e[0],i=e.filter(o=>o!==a);return{candidates:[...e],conflict:!0,source:`${S(a)} (also in: ${i.map(o=>S(o)).join(", ")})`,spec:P(a)}},"resolveFromCatalogs"),ce=h((t,r)=>{const e=new Map;for(const[l,p]of r){if(!l.includes(":"))continue;const f=p.get(t);f!==void 0&&e.set(f,(e.get(f)??0)+1)}if(e.size===0)return;const a=[...e.entries()],i=a.reduce((l,[,p])=>l+p,0);if(a.length===1){const[[l]]=a;return{source:`siblings (${String(i)} pkg${i===1?"":"s"} on ${l})`,spec:l}}const o=[...a].sort((l,p)=>p[1]-l[1]),[n,s]=o[0],c=o.slice(1).map(([l,p])=>`${l} (×${String(p)})`);return{candidates:o.map(([l])=>l),conflict:!0,source:`siblings (most common: ${n} ×${String(s)}; conflicts: ${c.join(", ")})`,spec:n}},"resolveFromSiblings"),le=h((t,r)=>ie(t,r)||ce(t,r),"conformToCatalog");var pe=Object.defineProperty,d=$((t,r)=>pe(t,"name",{value:r,configurable:!0}),"m");const T=d(async(t,r=1e4)=>{const e=new Map,a=new AbortController,i=setTimeout(()=>{a.abort()},r);try{const o=t.map(async n=>{try{const s=await fetch(`https://registry.npmjs.org/${n}/latest`,{headers:{Accept:"application/json"},signal:a.signal});if(s.ok){const c=await s.json();c.version&&e.set(n,c.version)}}catch{}});await Promise.all(o)}finally{clearTimeout(i)}return e},"resolveLatestVersions"),fe=d((t,r,e)=>{const a=[];for(const i of t.values()){const{overall:o}=i.score,n=I(o),s=`${String(Math.round(o*100))}%`,c=i.alerts.length,l=b(i),p=N(l,i.version,e),f=n==="red"?U:n==="yellow"?B:E;if(p?g.info(` ${f(s)} ${R(i)} ${M(`[accepted: ${p.reason}]`)}`):g.info(` ${f(s)} ${R(i)}`),c>0){const u=i.alerts.filter(m=>m.severity==="critical"||m.severity==="high").length;u>0&&g.warn(` ${String(u)} critical/high alert${u===1?"":"s"}`)}o<r&&!p&&a.push(i)}return a},"displaySecurityReports"),ge=d(async(t,r)=>{const e=F({input:process.stdin,output:process.stdout}),a=d(s=>new Promise(c=>{e.question(s,l=>{c(l.trim())})}),"ask"),i=String(Math.round(r*100));g.warn(""),g.warn(`${String(t.length)} package${t.length===1?"":"s"} scored below the minimum threshold (${i}%):`);for(const s of t){const c=b(s),l=`${String(Math.round(s.score.overall*100))}%`;g.warn(` • ${c}@${s.version} — score: ${l} (${J(s.score.overall)})`)}g.warn("");const o=await a("Continue adding these packages? [y/N] ");if(o.toLowerCase()!=="y"&&o.toLowerCase()!=="yes")return e.close(),!1;const n=await a("Remember this decision? (prints config snippet) [y/N] ");if(e.close(),n.toLowerCase()==="y"||n.toLowerCase()==="yes"){g.notice(""),g.notice("Add the following to security.socket.acceptedRisks in vis.config.ts:"),g.notice("");for(const s of t){const c=b(s),l=z(c,s.version,s.score.overall,"Reviewed and accepted");g.notice(l)}g.notice("")}return!0},"confirmLowScorePackages"),ue=d(async(t,r,e,a)=>{const i=t.map(f=>C(f)),o=new Map;for(const f of i)if(f.versionSpec){const u=Q.coerce(f.versionSpec);u&&o.set(f.name,u.version)}const n=i.filter(f=>!o.has(f.name)).map(f=>f.name),s=n.length>0?await T(n):new Map,c=[];for(const f of i){const u=o.get(f.name)??s.get(f.name);u&&c.push({name:f.name,version:u})}if(c.length===0)return!0;g.info(""),g.info("Socket.dev security check:");const l=await Y(c,r);if(l.size===0)return g.info(" Could not fetch security data. Proceeding."),!0;const p=fe(l,e,a);return p.length===0?(g.info(""),!0):process.stdin.isTTY?ge(p,e):(g.warn(`Aborting: ${String(p.length)} package${p.length===1?"":"s"} below minimum score. Use --no-socket-check to skip.`),!1)},"runSocketPreCheck"),de=["dependencies","devDependencies","peerDependencies","optionalDependencies"],me=d(t=>t.savePeer?"peerDependencies":t.saveOptional?"optionalDependencies":t.saveDev?"devDependencies":"dependencies","pickDepSection"),_=d((t,r)=>t.startsWith("catalog:")||!r?t:t.replace(/^[\^~]/,""),"applyExactPrefix"),ve=d(async(t,r)=>{const e=[];for(const o of t){const{name:n,versionSpec:s}=C(o);if(!n)continue;if(s!==void 0){e.push({explicit:s,name:n});continue}const c=le(n,r);if(c){c.conflict&&g.warn(`${n}: ambiguous constraint — picking ${c.spec} (${c.source}). Pass ${n}@<version> to override.`),e.push({entry:{name:n,source:c.source,spec:c.spec},kind:"resolved",name:n});continue}e.push({kind:"missing",name:n})}const a=e.filter(o=>"kind"in o&&o.kind==="missing").map(o=>o.name),i=a.length>0?await T(a):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 n=i.get(o.name);if(n===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 s=`^${n}`;return g.info(`${o.name}: no existing constraint — using registry latest (${s}). Add to a catalog to share this version across workspace packages.`),{name:o.name,source:"registry latest",spec:s}})},"planConformedSpecs"),we=d((t,r,e,a)=>{for(const{name:i,spec:o}of r){const n=_(o,a);for(const c of de){if(c===e)continue;const l=t[c];l?.[i]!==void 0&&(delete l[i],Object.keys(l).length===0&&delete t[c])}let s=t[e];s===void 0&&(s={},t[e]=s),s[i]=n}},"applyPlannedSpecsToPackageJson"),ke=d(async({ignoreScripts:t,logger:r,options:e,packages:a,pm:i,target:o,visConfig:n,workspaceRoot:s})=>{const{workspace:c}=Z(s,n??{}),l=c.projects[o];if(!l){const v=Object.keys(c.projects).sort();throw new Error(`--to: workspace package "${o}" not found. Available: ${v.length>0?v.slice(0,10).join(", "):"(none)"}${v.length>10?`, ... (${String(v.length-10)} more)`:""}.`)}const p=ne(s,l.root,"package.json"),{packageManager:f}=K(s),u=V(s,f),m=me(e),w=e.exact??!1,y=await ve(a,u);if(y.length===0)return 0;const x=te(p);we(x,y,m,w),se(p,x,{indent:W(p,{useEditorconfig:n?.editorconfig??!0}),overwrite:!0});for(const v of y){const D=_(v.spec,w);g.info(`${E("+")} ${v.name}@${D} → ${o}/${m} (${M(v.source)})`)}return X(i,{dev:!1,filter:[],force:!1,frozenLockfile:!1,ignoreScripts:t,lockfileOnly:!1,noOptional:!1,offline:!1,prod:!1,recursive:!1,silent:!1,workspaceRoot:!1},s,r)},"applyConformedAdd"),Re=d(async({argument:t,logger:r,options:e,visConfig:a,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(u=>C(u)),f=await re(p.map(u=>u.name),a?.security?.typosquatAllowlist);if(!f.ok){process.exitCode=1;return}o=p.map((u,m)=>{const w=f.packages[m];return w!==u.name?u.versionSpec?`${w}@${u.versionSpec}`:w??"":o[m]??""})}if(e.socketCheck!==!1){const p=G(a?.security?.socket);if(p){const f=p.minimumScore??H;if(!await ue(o,p,f,a?.security?.socket?.acceptedRisks)){process.exitCode=1;return}}}const n=process.cwd(),s=ee(i??n,{configBackend:a?.install?.backend,configCorepack:a?.install?.corepack}),c=!e.runScripts;if(e.to){if(e.global||e.workspaceRoot)throw new Error("--to is incompatible with --global / --workspace-root.");if(e.filter&&j(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:c,logger:r,options:e,packages:o,pm:s,target:e.to,visConfig:a,workspaceRoot:i});p!==0&&(process.exitCode=p);return}const l=oe(s,{exact:e.exact||!1,filter:j(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},n,r,{autoInstallPeers:e.autoInstallPeers||!1,ignoreScripts:c});l!==0&&(process.exitCode=l)},"execute");export{Re as default};
|