@visulima/vis 7.1.0-next.1 → 7.1.0-next.3
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 +22 -0
- package/bin/group-listing.mjs +40 -0
- package/bin/route.mjs +9 -0
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/CONFIG_FILES.js +5 -5
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +1 -1
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +134 -134
- package/dist/packem_chunks/emit.js +3 -0
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +1 -1
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler52.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler58.js +1 -1
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler60.js +1 -1
- package/dist/packem_chunks/handler61.js +1 -1
- package/dist/packem_chunks/handler62.js +1 -1
- package/dist/packem_chunks/handler63.js +1 -1
- package/dist/packem_chunks/handler64.js +1 -1
- package/dist/packem_chunks/handler65.js +1 -1
- package/dist/packem_chunks/handler66.js +1 -1
- package/dist/packem_chunks/handler67.js +1 -1
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +24 -24
- package/dist/packem_chunks/handler71.js +1 -1
- package/dist/packem_chunks/handler72.js +1 -1
- package/dist/packem_chunks/handler73.js +1 -1
- package/dist/packem_chunks/handler74.js +1 -1
- package/dist/packem_chunks/handler75.js +1 -1
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +1 -1
- package/dist/packem_chunks/handler78.js +1 -1
- package/dist/packem_chunks/handler79.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index5.js +20 -20
- package/dist/packem_chunks/index7.js +1 -1
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/prune.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/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +5 -5
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/{advisories-O7twgy1s.js → advisories-Dc10IYpK.js} +1 -1
- package/dist/packem_shared/{affected-selection-eR52q-oc.js → affected-selection-BIxezDlh.js} +1 -1
- package/dist/packem_shared/{ai-analysis-Doa-UG1c.js → ai-analysis-16c2sIVd.js} +1 -1
- package/dist/packem_shared/{ai-cache-BLz0YM15.js → ai-cache-BeP3Wk2e.js} +1 -1
- package/dist/packem_shared/{ai-fix-h4fgPlz8.js → ai-fix-jqni5zPh.js} +1 -1
- package/dist/packem_shared/bin-CFjwItIf.js +1 -0
- package/dist/packem_shared/{build-scripts-zlct5Ggj.js → build-scripts-Dnnfplkm.js} +1 -1
- package/dist/packem_shared/{dependency-scan-CpaMuJak.js → dependency-scan-nsAIchjl.js} +1 -1
- package/dist/packem_shared/{detect-CrdazHI6.js → detect-BmcX8xj2.js} +1 -1
- package/dist/packem_shared/{docker-ClRLF89f.js → docker-CHupOe_6.js} +1 -1
- package/dist/packem_shared/{ecosystem-gate-Be06KMgT.js → ecosystem-gate-21KYhUWm.js} +1 -1
- package/dist/packem_shared/{env-BZGqwX30.js → env-BNmRHLkv.js} +1 -1
- package/dist/packem_shared/{env-consistency-DZmwPw-C.js → env-consistency-BW7IQWj9.js} +1 -1
- package/dist/packem_shared/{failure-log-zDUnBhop.js → failure-log-CQrv_3B0.js} +1 -1
- package/dist/packem_shared/glob-Cyk1H9ZL-Dt41_ECv.js +1 -0
- package/dist/packem_shared/{index-Byxjshm-.js → index-BxCOKJpr.js} +1 -1
- package/dist/packem_shared/{index-BCMh-e5u.js → index-rfoytcrs.js} +1 -1
- package/dist/packem_shared/{lifecycle-DEgFG8Hl.js → lifecycle-BL1NHaZr.js} +1 -1
- package/dist/packem_shared/{manifests-BYQ08vX_.js → manifests-Dt4AxrbA.js} +1 -1
- package/dist/packem_shared/{min-release-age-CmziMU7E.js → min-release-age-C6LCfVPq.js} +1 -1
- package/dist/packem_shared/{missing-package-json-BzB16zXB.js → missing-package-json-DORfrGci.js} +1 -1
- package/dist/packem_shared/{multi-eco-lockfiles-BaEL_JYF.js → multi-eco-lockfiles-BBQ_himh.js} +1 -1
- package/dist/packem_shared/{native-config-sync-Dkg3TMPR.js → native-config-sync-16ioEuPe.js} +1 -1
- package/dist/packem_shared/{osv-D8S_X2KZ.js → osv-1_7KmJp_.js} +1 -1
- package/dist/packem_shared/{package-version-C7WbQEnJ.js → package-version-6zT7gOkz.js} +1 -1
- package/dist/packem_shared/{packument-DE9EI2oo.js → packument-BEO6bKIm.js} +1 -1
- package/dist/packem_shared/{project-name-filter-xCPw_fxK.js → project-name-filter-DhMfxZI5.js} +1 -1
- package/dist/packem_shared/{provenance-UZNpYcAR.js → provenance-s5G_nDYD.js} +1 -1
- package/dist/packem_shared/{registry-D65qizQE.js → registry-DCTL7aRA.js} +1 -1
- package/dist/packem_shared/{registry-keys-C66uhEbp.js → registry-keys-D1NIu_2G.js} +1 -1
- package/dist/packem_shared/{renderToString-DR0zDUjh-CS7RIyZE.js → renderToString-DR0zDUjh-vFELWw9k.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-BEsg7ZYh.js → resolve-explicit-DmlBdEFe.js} +1 -1
- package/dist/packem_shared/{run-summary-utils-BrgoXV-3.js → run-summary-utils-XwciqJBJ.js} +1 -1
- package/dist/packem_shared/{runtime-check-mhNpo3ah.js → runtime-check-Srsksjgg.js} +1 -1
- package/dist/packem_shared/{s1ngularity-DFKNfAgy.js → s1ngularity-C0QZ8Tdd.js} +1 -1
- package/dist/packem_shared/{scaffold-files-DAU7B6Cw.js → scaffold-files-bK-FCHfD.js} +1 -1
- package/dist/packem_shared/{scan-progress-CgzPrpwB.js → scan-progress-C9rA4YBY.js} +1 -1
- package/dist/packem_shared/{selectors-CUK5421Y.js → selectors-D6yIYIOZ.js} +1 -1
- package/dist/packem_shared/{signatures-DJcxx8KS.js → signatures-CdKyynFu.js} +1 -1
- package/dist/packem_shared/{spinner-DTKCtuC-.js → spinner-D_gE_AaM.js} +1 -1
- package/dist/packem_shared/{table-CCIzXSUF.js → table-DNd7V4pt.js} +1 -1
- package/dist/packem_shared/{tabs-B9LOpICc.js → tabs-CQAOC5V5.js} +1 -1
- package/dist/packem_shared/{toolchain-CX-0Plms.js → toolchain-CS4rN2CW.js} +1 -1
- package/dist/packem_shared/{typosquats-BKUa8NgB.js → typosquats-CUP2VqZF.js} +1 -1
- package/dist/packem_shared/{use-measured-height-BvUJvSnd.js → use-measured-height-VwlRyMbC.js} +1 -1
- package/dist/packem_shared/{vis-update-app-DxnZ8owK.js → vis-update-app-pVAXAuHo.js} +1 -1
- package/dist/packem_shared/{vis-user-error-BurzAV6b.js → vis-user-error-B1vMnNGb.js} +1 -1
- package/dist/packem_shared/{watch-loop-CatWMg-1.js → watch-loop-Dj8qZqJl.js} +1 -1
- package/index.d.ts +204 -213
- package/index.js +54 -54
- package/package.json +10 -10
- package/dist/packem_shared/bin-BlwqCNwJ.js +0 -1
- package/dist/packem_shared/glob-Cyk1H9ZL-DVdKvjft.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{createRequire as Ke}from"node:module";import{b as C,F as
|
|
2
|
-
`),this.#h=0}#
|
|
3
|
-
`))}#m(t,s){if(!this.#e||(this.#p(),this.#e=!1,this.#d=Date.now(),!this.#f))return;let n="";const r=this.#b[t];r&&(n=this.#c?this.#c(r):r),this.#i&&(n=`${this.#i} ${n}`),s&&(n=`${n} ${s}`),this.#
|
|
4
|
-
`,!0),i.length},Xt="********",Pe="<REDACTED>",Zt=Buffer.from(Pe,"utf8"),$e=(e,t)=>{const s=Ne(e,t);return s===".."||s.startsWith(`..${Lt}`)||Mt(s)},Qt=(e,t)=>{let s=1;for(let n=0;n<t;n++)e[n]===10&&s++;return s},es=(e,t,{gid:s,mode:n,uid:r})=>{const i=Tt(At(e),`.${jt(e)}.vis-fix-${process.pid}-${Ct()}`);try{const a=Ae(i,"wx",n);try{const c=bt(a);(c.uid!==r||c.gid!==s)&&St(a,r,s),je(a,n),X(a,t),kt(a)}finally{Le(a)}
|
|
1
|
+
import{createRequire as Ke}from"node:module";import{b as C,F as I,X as Xe,J as Ee,q as Ze}from"../packem_shared/index.server-Ca_EEVfw.js";import{m as Qe,v as E,U as x,a as M,e as V,z as et}from"../packem_shared/index-0dnGN3GP.js";import{wholeMatchFingerprint as tt,maskFinding as ee,fingerprint as H,legacyFingerprint as st,baselineKeys as ce,GIT_CONFIG_OVERRIDES as nt,DIFF_HARDENING_FLAGS as it,gitleaksIgnoreFingerprint as K,toSarifUri as rt,CONFIDENCE_LEVELS as le,DEFAULT_MAX_FILE_SIZE as O,MAX_ARCHIVE_DEPTH as ot,listRules as Te,listRequiredValidators as at,scan as ct,isPathExcluded as lt,scanStringDetailed as dt,scanGitHistoryDetailed as ut,scanDetailed as ht,scanGitStaged as pt,scanFilesDetailed as ft,inspectRuleset as mt}from"@visulima/secret-scanner";import{V as $}from"../packem_shared/vis-user-error-B1vMnNGb.js";import{a3 as gt,a4 as de,p as T}from"./cli-main.js";import{E as vt,A as wt}from"../packem_shared/getRandomSpinner-DX11qCB2-CoIsn7ZU.js";import{y as te}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{p as Rt}from"../packem_shared/package-version-6zT7gOkz.js";import{w as z}from"../packem_shared/github-workflow-command-Bn0MgB78.js";import{e as W,c as Dt}from"../packem_shared/junit-audit-CuJShWCH.js";let Ye;const Je=e=>(Ye??=Ke(import.meta.url))(e),N=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,L=e=>{if(typeof N<"u"&&N.versions&&N.versions.node){const[t,s]=N.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return N.getBuiltinModule(e)}return Je(e)},{createRequire:$t}=L("node:module"),{mkdirSync:yt,writeFileSync:X,openSync:Ae,fchmodSync:je,closeSync:Le,realpathSync:G,lstatSync:Me,fstatSync:bt,fchownSync:St,fsyncSync:kt,renameSync:It,rmSync:xt,readFileSync:Ft}=L("node:fs"),{randomUUID:Ct,createHash:Et}=L("node:crypto"),{resolve:ue,relative:Ne,join:Tt,dirname:At,basename:jt,sep:Lt,isAbsolute:Mt}=L("node:path"),{execFileSync:Nt}=L("node:child_process"),{pathToFileURL:De}=L("node:url");let Bt;const _t=e=>(Bt??=$t(import.meta.url))(e),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ut=e=>{if(typeof D<"u"&&D.versions&&D.versions.node){const[t,s]=D.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return D.getBuiltinModule(e)}return _t(e)},{styleText:Ot}=Ut("node:util"),qt={error:"✖",info:"ℹ",success:"✓",warning:"⚠"},Pt=()=>{const{env:e}=process;return!!e.CI||e.CONTINUOUS_INTEGRATION==="true"||"BUILD_NUMBER"in e||"RUN_ID"in e},zt=/\u001B\[[\d;]*[a-z]/gi,Wt=e=>[...e.replaceAll(zt,"")].length,Vt=e=>{const t=[];return e.bold&&t.push("bold"),e.dim&&t.push("dim"),e.italic&&t.push("italic"),e.underline&&t.push("underline"),e.strikethrough&&t.push("strikethrough"),e.color&&t.push(e.color),e.bgColor&&t.push(e.bgColor),t.length===0?s=>s:s=>Ot(t,s)};class Ht{#r=0;#l;#e=!1;#i="";#o="";#g=0;#d=0;#t;#s;#u="";#a;#f;#n;#y;#h=0;#c;#b;constructor(t={},s){if(t.frames)this.#a=t.frames;else{const n=t.name??"dots",r=wt(n);if(!r)throw new Error(`Unknown spinner "${n}". Pass a custom \`frames\` set or use one of: ${vt().join(", ")}.`);this.#a=r}this.#f=t.verbose!==!1,this.#i=t.prefixText??"",this.#t=s,this.#n=t.stream??process.stderr,this.#y=s?!0:this.#n.isTTY&&!Pt(),this.#b={...qt,...t.icons},typeof t.style=="function"?this.#c=t.style:t.style&&(this.#c=Vt(t.style))}get elapsedTime(){return this.#g===0?0:(this.#d||Date.now())-this.#g}get text(){return this.#o}set text(t){this.#o=t,this.#e&&this.#v()}get prefixText(){return this.#i}set prefixText(t){this.#i=t,this.#e&&this.#v()}get isRunning(){return this.#e}setInteractiveManager(t){this.#t=t}setMultiSpinner(t){this.#s=t}tick(){this.#e&&(this.#r=(this.#r+1)%this.#a.frames.length)}start(t,s){return this.#e?this:this.#f?(this.#e=!0,this.#g=Date.now(),this.#d=0,this.#r=0,this.#u="",t&&(this.#o=t),s?.prefixText&&(this.#i=s.prefixText),this.#s?(this.#s.renderAll(),this):(this.#t?(this.#t.hook(),this.#S(),this.#$()):(this.#k(),this.#$()),this)):this}stop(){if(this.#e){if(this.#p(),this.#e=!1,this.#d=Date.now(),this.#u="",this.#s){this.#s.renderAll();return}this.#t?(this.#t.erase("stdout"),this.#t.unhook(!1)):this.#w()}}stopAndPersist(t){if(!this.#e||(this.#p(),this.#e=!1,this.#d=Date.now(),!this.#f))return;const s=t?.prefixText??this.#i,n=t?.text??this.#o;let r=t?.symbol??"";s&&(r=r?`${s} ${r}`:s),n&&(r=r?`${r} ${n}`:n),this.#I(r)}succeed(t){this.#m("success",t)}failed(t){this.#m("error",t)}warn(t){this.#m("warning",t)}info(t){this.#m("info",t)}pause(){this.#p()}resume(){this.#e&&(this.#p(),this.#s||this.#$())}getFrameOutput(){if(!this.#e&&this.#u)return this.#u;const t=this.#a.frames[this.#r];let s=this.#c?this.#c(t):t;return this.#i&&(s=`${this.#i} ${s}`),this.#o&&(s=`${s} ${this.#o}`),s}#$(){this.#y&&(this.#l=setInterval(()=>{this.#e&&(this.#r=(this.#r+1)%this.#a.frames.length,this.#v())},this.#a.interval),this.#l.unref())}#p(){this.#l&&(clearInterval(this.#l),this.#l=void 0)}#v(){this.#s?this.#s.renderAll():this.#t?this.#S():this.#k()}#S(){this.#t&&this.#t.update("stdout",[this.getFrameOutput()])}#k(){const t=this.getFrameOutput();if(this.#w(),this.#n.isTTY){this.#n.write(t);const s=this.#n.columns||80;this.#h=Math.max(1,Math.ceil(Wt(t)/s))}else this.#n.write(`${t}
|
|
2
|
+
`),this.#h=0}#w(){if(this.#h>0&&this.#n.isTTY){for(let t=1;t<this.#h;t+=1)this.#n.write("\x1B[1A\x1B[2K");this.#n.write("\r\x1B[K")}this.#h=0}#I(t){this.#u=t,this.#s?this.#s.renderAll():this.#t?(this.#t.update("stdout",[t]),this.#t.unhook(!1)):(this.#w(),this.#n.write(`${t}
|
|
3
|
+
`))}#m(t,s){if(!this.#e||(this.#p(),this.#e=!1,this.#d=Date.now(),!this.#f))return;let n="";const r=this.#b[t];r&&(n=this.#c?this.#c(r):r),this.#i&&(n=`${this.#i} ${n}`),s&&(n=`${n} ${s}`),this.#I(n)}}const Be=(e={})=>{const t=new gt(new de(process.stdout),new de(process.stderr));return new Ht(e,t)},he=384,_e=(e,t,s)=>{if(yt(Qe(e),{recursive:!0}),!s){X(e,t);return}const n=Ae(e,"w",he);try{je(n,he),X(n,t)}finally{Le(n)}},Ue=(e,t)=>{if(!E(e))return e;const s=M(t,e);return s===""||s.startsWith("..")?e:s},Z=e=>{try{return G(e)}catch{return e}},Oe=(e,t)=>{const s=M(e,t);return s===""||s.startsWith("..")||E(s)?t:s},j=(e,t)=>{const s={...e,file:Ue(e.file,t)};return delete s.root,s},se=e=>{if(!te(e))return[];try{const t=Rt(e);return Array.isArray(t)?t:[]}catch{return[]}},ne=(e,t,s)=>{const n=E(e)?e:x(t,e);return Oe(Z(s),n)},pe=(e,t,s)=>{const n=ne(e.file,t,s);return n===e.file?e:{...e,file:n}},Gt=(e,t,s)=>{const n=e.files.map(r=>({...r,file:ne(r.file,t,s)}));return{...e,files:n}},Kt=(e,t,s)=>{const n=Z(t),r=Z(s);return se(e).flatMap(i=>{const a=Oe(r,E(i.file)?i.file:x(n,i.file));return a===i.file?[i]:[i,{...i,file:a}]})},fe=e=>[...ce(e),...ce(ee(e))],_=e=>typeof e=="string"?e:"",ie=e=>{const t={...e,match:_(e.match),secret:_(e.secret)};return Array.isArray(e.requiredFindings)?t.requiredFindings=e.requiredFindings.map(s=>({...s,match:_(s.match),secret:_(s.secret)})):delete t.requiredFindings,t},re=e=>ee(ie(e)),me=e=>[H(ie(e)),st(e),H(re(e))],Yt=(e,t,s)=>{const n=se(t).map(o=>j(o,s)),r=new Set(n.flatMap(o=>me(o))),i=e.map(o=>j(o,s)),a=new Set(i.flatMap(o=>fe(o))),c=o=>fe(o).some(d=>r.has(d));return{fresh:i.filter(o=>!c(o)),resolved:n.filter(o=>!me(o).some(d=>a.has(d))),surviving:i.filter(o=>c(o))}},ge=e=>H(re(e)),Jt=e=>{const t=_(e.secret);return re(e).secret===t},qe=(e,t,s,n={})=>{const r=e.map(a=>j(a,s));let i;if(n.replace)i=r;else{const a=new Set(r.filter(l=>l.secret!==l.match).map(l=>tt(ee(l)))),c=se(t).map(l=>j(l,s)).filter(l=>!a.has(ge(l))),o=new Set,d=new Set,f=new Set;i=[];for(const l of[...c,...r]){const b=H(ie(l)),h=ge(l),u=Jt(l);o.has(b)||(u?d.has(h):f.has(h))||(o.add(b),d.add(h),u&&f.add(h),i.push(l))}}return _e(t,`${JSON.stringify(i,null,4)}
|
|
4
|
+
`,!0),i.length},Xt="********",Pe="<REDACTED>",Zt=Buffer.from(Pe,"utf8"),$e=(e,t)=>{const s=Ne(e,t);return s===".."||s.startsWith(`..${Lt}`)||Mt(s)},Qt=(e,t)=>{let s=1;for(let n=0;n<t;n++)e[n]===10&&s++;return s},es=(e,t,{gid:s,mode:n,uid:r})=>{const i=Tt(At(e),`.${jt(e)}.vis-fix-${process.pid}-${Ct()}`);try{const a=Ae(i,"wx",n);try{const c=bt(a);(c.uid!==r||c.gid!==s)&&St(a,r,s),je(a,n),X(a,t),kt(a)}finally{Le(a)}It(i,e)}catch(a){throw xt(i,{force:!0}),a}},ve=(e,t)=>Ne(e,t)||t,ze=e=>{try{const t=Me(e);return t.isSymbolicLink()?{reason:"symbolic link"}:t.isFile()?t.nlink>1?{reason:"hard-linked file"}:(t.mode&146)===0?{reason:"read-only file"}:{bytes:Ft(e),dev:t.dev,gid:t.gid,ino:t.ino,mode:t.mode%4096,mtimeMs:t.mtimeMs,size:t.size,uid:t.uid}:{reason:"not a regular file"}}catch{return{reason:"file unavailable"}}},ts=(e,t)=>{try{const s=ze(e);return!("reason"in s)&&G(e)===e&&s.dev===t.dev&&s.ino===t.ino&&s.mode===t.mode&&s.uid===t.uid&&s.gid===t.gid&&s.size===t.size&&s.mtimeMs===t.mtimeMs&&s.bytes.equals(t.bytes)}catch{return!1}},ss=({matchEnd:e,matchStart:t,secretEnd:s,secretStart:n},r,i)=>Number.isInteger(t)&&Number.isInteger(e)&&Number.isInteger(n)&&Number.isInteger(s)&&t>=0&&n>=t&&s>n&&s<=e&&e<=r.length&&r.subarray(n,s).equals(i),ns=e=>{const t=[];for(const{end:s,ruleId:n,start:r}of[...e].sort((i,a)=>i.start-a.start||i.end-a.end)){const i=t.at(-1);i!==void 0&&r<i.end?(i.end=Math.max(i.end,s),i.ruleIds.add(n)):t.push({end:s,ruleIds:new Set([n]),start:r})}return t},is=(e,t)=>{const s=[];let n=0;for(const{end:r,start:i}of t)s.push(e.subarray(n,i),Zt),n=r;return s.push(e.subarray(n)),Buffer.concat(s)},rs=(e,t,s,n=t)=>{const r=[],i=new Map,a=new Map,c=ue(t,n);let o;try{o=G(t)}catch{o=t}const d=h=>{const u=ue(c,h),p=ve(t,u);if($e(t,u))return{display:p,reason:"outside workspace"};let w;try{if(Me(u).isSymbolicLink())return{display:p,reason:"symbolic link"};w=G(u)}catch{return{display:p,reason:"file unavailable"}}if($e(o,w))return{display:p,reason:"outside workspace"};let v=a.get(w);return v===void 0&&(v=ze(w),a.set(w,v)),"reason"in v?{display:p,reason:v.reason}:{display:p,file:v,path:w}};for(const h of e){if(h.sourceSpan===void 0){r.push({file:h.file,line:h.startLine,reason:h.spanUnavailableReason??"no trusted byte span",ruleId:h.ruleId});continue}const u=d(h.file);for(const p of[h,...h.requiredFindings??[]]){const w=(S,y)=>{r.push({file:y,line:p.startLine,reason:S,ruleId:p.ruleId})},{sourceSpan:v}=p;if(v===void 0){w(p.spanUnavailableReason??"no trusted byte span",h.file);continue}if(p.secret.length===0){w("empty secret",h.file);continue}if("reason"in u){w(u.reason,u.display);continue}if(!ss(v,u.file.bytes,Buffer.from(p.secret,"utf8"))){w("span does not match file",u.display);continue}const g=i.get(u.path)??{file:u.file,spans:[]};g.spans.push({end:v.secretEnd,ruleId:p.ruleId,start:v.secretStart}),i.set(u.path,g)}}const f=[];let l=0,b=0;for(const[h,{file:u,spans:p}]of i){const w=ns(p),v=ve(t,h),g=w.map(({ruleIds:y,start:m})=>({line:Qt(u.bytes,m),ruleIds:y}));if(!s){let y;if(ts(h,u))try{es(h,is(u.bytes,w),u)}catch{y="write failed"}else y="file changed during scan";if(y!==void 0){for(const{line:m,ruleIds:k}of g)r.push({file:v,line:m,reason:y,ruleId:[...k].sort().join(", ")});continue}}l++,b+=w.length;const S=new Map;for(const{line:y,ruleIds:m}of g)S.set(y,new Set([...S.get(y)??[],...m]));for(const[y,m]of S)f.push({file:v,line:y,ruleId:[...m].sort().join(", ")})}return f.sort((h,u)=>h.file.localeCompare(u.file)||h.line-u.line),r.sort((h,u)=>h.file.localeCompare(u.file)||h.line-u.line||h.reason.localeCompare(u.reason)),{changedFiles:l,edits:f,replacements:b,skipped:r}},Q=(e,t)=>{try{return Nt("git",[...nt,...t],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}catch{return""}},os=e=>e.split("\0").filter(Boolean),we=(e,t)=>{if(t.startsWith("-"))throw new $(`--since "${t}" looks like a flag, not a git ref.`);const s=x(e,Q(e,["rev-parse","--show-cdup"]).trim()),n=i=>os(Q(e,["diff","-z","--name-only","--diff-filter=ACMR",...it,i,"--"]));let r=n(`${t}...HEAD`);return r.length===0&&(r=n(t)),r.map(i=>E(i)?i:V(s,i))},ye=e=>Q(e,["rev-parse","--show-toplevel"]).trim().length>0,as=/^[\t\r+=@-]/,F=e=>{const t=as.test(e)?`'${e}`:e;return/[\n\r",]/.test(t)?`"${t.replaceAll('"','""')}"`:t},cs=["RuleID","Commit","File","Secret","Match","StartLine","EndLine","StartColumn","EndColumn","Author","Message","Date","Email","Fingerprint","Tags"],ls=e=>{const t=e.map(s=>[F(s.ruleId),F(s.commit?.sha??""),F(s.file),F(s.secret),F(s.match),String(s.startLine),String(s.endLine),String(s.startColumn),String(s.endColumn),F(s.commit?.authorName??""),F(s.commit?.message??""),F(s.commit?.date??""),F(s.commit?.authorEmail??""),F(K(s)),F(s.tags.join(" "))].join(","));return`${[cs.join(","),...t].join(`\r
|
|
5
5
|
`)}\r
|
|
6
6
|
`},ds=e=>{const t=[...e];return t.length<=6?"******":`${t.slice(0,3).join("")}${"*".repeat(t.length-6)}${t.slice(-3).join("")}`},us=(e,t={})=>{const s=(t.now??new Date).toISOString().replace(/\.\d{3}Z$/,""),n=String(e.length),r=e.map(i=>{const a=`${i.file}:${String(i.startLine)}:${String(i.startColumn)}`,c=[`Rule: ${i.ruleId}`,`File: ${a}`,...i.commit===void 0?[]:[`Commit: ${i.commit.sha}`,`Author: ${i.commit.authorName} <${i.commit.authorEmail}>`],`Secret: ${ds(i.secret)}`,`Fingerprint: ${K(i)}`].join(`
|
|
7
7
|
`),o=`<failure type="${W(i.ruleId)}" message="${W(i.description||i.ruleId)}">${Dt(c)}</failure>`;return[` <testcase classname="${W(i.file)}" name="${W(`${i.ruleId} at ${a}`)}">`,` ${o}`," </testcase>",""].join(`
|
|
@@ -10,23 +10,23 @@ import{createRequire as Ke}from"node:module";import{b as C,F as x,X as Xe,J as E
|
|
|
10
10
|
`},ps=/\.(?:zip|jar|war|ear|tar|tgz|gz)!/iu,fs=(e,t={})=>e.map(s=>{const n=s.description||s.ruleId,r=`${s.file}:${String(s.startLine)}`;return s.commit?z("error",{title:s.ruleId},`${n}
|
|
11
11
|
${r} in commit ${s.commit.sha.slice(0,7)}`):t.staged?z("error",{title:s.ruleId},`${n}
|
|
12
12
|
${r} (staged)`):ps.test(s.file)?z("error",{title:s.ruleId},`${n}
|
|
13
|
-
${r}`):z("error",{col:s.startColumn,endColumn:s.endColumn,endLine:s.endLine,file:s.file,line:s.startLine,title:s.ruleId},n)}).join(""),be=1,ms=e=>{const t=new Map;for(const s of e){const n=t.get(s.file);n?n.push(s):t.set(s.file,[s])}return t},gs=e=>{try{return et(e).split(/\r?\n/)}catch{return}},$s=(e,t,s)=>{const n=Math.max(1,t);return`${e.slice(0,n-1).replaceAll(/[^\t]/g," ")}${"^".repeat(Math.max(1,s))}`},B=e=>e,We=e=>e?{cyan:Ze,dim:
|
|
14
|
-
`).trimEnd()},
|
|
15
|
-
`).trimEnd()},ys=(e,t,s,n={})=>{const r=new Map;for(const o of e)r.set(o.reason,(r.get(o.reason)??0)+1);const i=[...r].map(([o,d])=>`${o}: ${String(d)}`).join(", "),a=`${String(e.length)} ${t}(s) not scanned (${i})${n.verbose?"":"; use --verbose to list them"}`,c=[s?C(a):a];if(n.verbose)for(const o of e){const d="sha"in o?` ${o.commit===void 0?"":`${o.commit.slice(0,10)} `}${o.sha.slice(0,10)}`:"",
|
|
16
|
-
`)},bs=(e,t,s)=>{const n=`${String(e.length)} allow marker(s) name unknown rule ids and still suppress every rule (rename or remove the ids):`,r=[s?C(n):n];for(const i of e){const a=` - ${Ue(i.file,t)}:${String(i.line)} unknown: ${i.unknownRuleIds.join(", ")}`;r.push(s?
|
|
17
|
-
`)},Ss=(e,t)=>{if(!E(e))return rt(e);try{return De(e).toString()}catch{return`file://${
|
|
18
|
-
`;case"junit":return us(n());case"sarif":return`${
|
|
19
|
-
`;default:return`${s.history?
|
|
20
|
-
`}},Fs=e=>e.kind==="secret"?"<secret-value entry>":e.raw,Rs=(e,t,s)=>{const n=`${String(e.length)} unused ${t} entr${e.length===1?"y":"ies"} (no finding matched; remove or update them):`,r=[s?C(n):n];for(const i of e){const a=` - line ${String(i.line)}: ${Fs(i)}`;r.push(s?
|
|
21
|
-
`)},Cs=(e,t,s)=>{const n=`${String(e.length)} finding(s) suppressed:`,r=[s?C(n):n];for(const i of e){const a=j(i,t),c=i.suppressedByEntry===void 0?"":` line ${String(i.suppressedByEntry.line)}`,o=`${i.suppressedBy}${c}`,d=` - [${i.ruleId}] ${K({...a,commit:i.commit})} (${o})`;r.push(s?
|
|
22
|
-
`)},Es=async(e,t)=>{try{return await e.access(t),!0}catch{return!1}},A=e=>e?Array.isArray(e)?e:[e]:[],Ts=e=>{if(e===void 0)return"text";if(!Ve(e))throw new $(`--format must be one of: ${oe.join(", ")} (got "${e}")`);return e},ke=(e,t,s)=>{if(e!==void 0){if(!Number.isInteger(e)||e<0||s!==void 0&&e>s){const n=s===void 0?"a non-negative integer":`an integer from 0 to ${String(s)}`;throw new $(`${t} must be ${n} (got ${String(e)}).`)}return e}},As=e=>{if(e!==void 0&&(!Number.isInteger(e)||e<1))throw new $(`--max-size must be a positive number of bytes (got ${String(e)}; default ${String(O)}).`);return e},js=e=>{if(e!==void 0){if(!le.includes(e))throw new $(`--min-confidence must be one of: ${le.join(", ")} (got "${e}")`);return e}},Ls=(e,t,s)=>{const n=t??{},r=m=>m?
|
|
13
|
+
${r}`):z("error",{col:s.startColumn,endColumn:s.endColumn,endLine:s.endLine,file:s.file,line:s.startLine,title:s.ruleId},n)}).join(""),be=1,ms=e=>{const t=new Map;for(const s of e){const n=t.get(s.file);n?n.push(s):t.set(s.file,[s])}return t},gs=(e,t)=>{if(t!==void 0)return t.split(/\r?\n/);try{return et(e).split(/\r?\n/)}catch{return}},$s=(e,t,s)=>{const n=Math.max(1,t);return`${e.slice(0,n-1).replaceAll(/[^\t]/g," ")}${"^".repeat(Math.max(1,s))}`},B=e=>e,We=e=>e?{cyan:Ze,dim:I,green:Ee,red:Xe,yellow:C}:{cyan:B,dim:B,green:B,red:B,yellow:B},vs=(e,t,s,n={})=>{if(e.length===0)return s?I("No secrets detected."):"No secrets detected.";const r=We(s),i=[],a=ms(e);for(const[c,o]of a){const d=M(t,c)||c;i.push(r.cyan(d));const f=n.redact?void 0:gs(c,n.virtualSource);for(const l of o){const b=[l.source,l.confidence].filter(Boolean).join(", "),h=b?` ${r.dim(`(${b})`)}`:"",u=l.alternateMatches&&l.alternateMatches.length>0?` ${r.dim(`also: ${l.alternateMatches.join(", ")}`)}`:"";let p="";switch(l.validation){case"error":{p=` ${r.yellow("! error")}`;break}case"rejected":{p=` ${r.red("✗ rejected")}`;break}case"skipped":{p=` ${r.dim("— unverifiable")}`;break}case"verified":{p=` ${r.green("✓ verified")}`;break}}if(i.push(` ${r.red("✖")} ${r.yellow(`[${l.ruleId}]`)}${h}${p} ${r.dim(`line ${String(l.startLine)}:${String(l.startColumn)}`)}${u}`),f){const w=Math.max(0,l.startLine-1-be),v=Math.min(f.length,l.startLine+be);for(let g=w;g<v;g+=1){const S=String(g+1).padStart(4," "),y=g+1===l.startLine,m=y?r.red("▶"):" ";if(i.push(` ${m} ${r.dim(S)} │ ${f[g]??""}`),y){const k=Math.max(1,(l.endColumn??l.startColumn+1)-l.startColumn),P=$s(f[g]??"",l.startColumn,k);i.push(` ${r.dim(" │ ")}${r.red(P)}`)}}}i.push("")}}return i.join(`
|
|
14
|
+
`).trimEnd()},ws=(e,t,s={})=>{if(e.length===0)return t?I("No secrets detected in git history."):"No secrets detected in git history.";const n=We(t),r=new Map;for(const a of e){const c=r.get(a.commit.sha);c?c.push(a):r.set(a.commit.sha,[a])}const i=[];for(const[a,c]of r){const{authorName:o,date:d,message:f}=c[0].commit;i.push(`${n.yellow(a.slice(0,10))} ${f}`),i.push(` ${n.dim(`${o} · ${d}`)}`);for(const l of c){const b=[l.source,l.confidence].filter(Boolean).join(", "),h=b?` ${n.dim(`(${b})`)}`:"",u=s.redact?"":` ${n.dim(l.match)}`;i.push(` ${n.red("✖")} ${n.yellow(`[${l.ruleId}]`)}${h} ${n.cyan(l.file)} ${n.dim(`line ${String(l.startLine)}:${String(l.startColumn)}`)}${u}`)}i.push("")}return i.join(`
|
|
15
|
+
`).trimEnd()},ys=(e,t,s,n={})=>{const r=new Map;for(const o of e)r.set(o.reason,(r.get(o.reason)??0)+1);const i=[...r].map(([o,d])=>`${o}: ${String(d)}`).join(", "),a=`${String(e.length)} ${t}(s) not scanned (${i})${n.verbose?"":"; use --verbose to list them"}`,c=[s?C(a):a];if(n.verbose)for(const o of e){const d="sha"in o?` ${o.commit===void 0?"":`${o.commit.slice(0,10)} `}${o.sha.slice(0,10)}`:"",f=` - ${o.path} [${o.reason}]${d}`;c.push(s?I(f):f)}return c.join(`
|
|
16
|
+
`)},bs=(e,t,s)=>{const n=`${String(e.length)} allow marker(s) name unknown rule ids and still suppress every rule (rename or remove the ids):`,r=[s?C(n):n];for(const i of e){const a=` - ${Ue(i.file,t)}:${String(i.line)} unknown: ${i.unknownRuleIds.join(", ")}`;r.push(s?I(a):a)}return r.join(`
|
|
17
|
+
`)},Ss=(e,t)=>{if(!E(e))return rt(e);try{return De(e).toString()}catch{return`file://${x(t,e).replaceAll("\\","/")}`}},ks=(e,t=100)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`,Is=(e,t,s=process.cwd(),n=[])=>{const r=new Map(n.map(o=>[o.id,o])),i=new Set;for(const o of e)i.add(o.ruleId);const a=[...new Set([...r.keys(),...i])].sort((o,d)=>o.localeCompare(d)),c=new Map(a.map((o,d)=>[o,d]));return JSON.stringify({$schema:"https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0.json",runs:[{originalUriBaseIds:{SRCROOT:{uri:De(s).toString()}},results:e.map(o=>{const d={};return o.source&&(d.source=o.source),o.confidence&&(d.confidence=o.confidence),o.alternateMatches&&o.alternateMatches.length>0&&(d.alternateRules=o.alternateMatches),o.validation&&(d.validation=o.validation),{level:"error",locations:[{physicalLocation:{artifactLocation:{uri:Ss(o.file,s),uriBaseId:E(o.file)?void 0:"SRCROOT"},region:{endColumn:o.endColumn,endLine:o.endLine,snippet:{text:o.match},startColumn:o.startColumn,startLine:o.startLine}}}],message:{text:o.description||o.ruleId},properties:Object.keys(d).length>0?d:void 0,ruleId:o.ruleId,ruleIndex:c.get(o.ruleId)??-1}}),tool:{driver:{informationUri:"https://visulima.com/packages/secret-scanner",name:"visulima-secret-scanner",rules:a.map(o=>{const d=r.get(o),f=d?.description??`Detected by rule \`${o}\``,l={};return d?.tags&&d.tags.length>0&&(l.tags=d.tags),d?.source&&(l.source=d.source),d?.confidence&&(l.confidence=d.confidence),{defaultConfiguration:{level:"error"},fullDescription:{text:f},helpUri:"https://visulima.com/packages/secret-scanner",id:o,name:o,properties:Object.keys(l).length>0?l:void 0,shortDescription:{text:ks(f)}}}),version:t}}}],version:"2.1.0"},void 0,2)},oe=["text","json","sarif","csv","junit","gitlab-code-quality","github"],Ve=e=>oe.includes(e),xs=e=>{const t=[],s=new Set;for(const n of e){const r=n.indexOf("="),i=r===-1?n:n.slice(0,r),a=r===-1?"":n.slice(r+1);if(!Ve(i))throw new $(`--report "${n}": format must be one of ${oe.join(", ")}, as <format>=<path> (e.g. sarif=secrets.sarif)`);if(a==="")throw new $(`--report "${n}" needs a file path: ${i}=<path>`);if(s.has(a))throw new $(`--report writes ${a} twice; give each report its own file.`);s.add(a),t.push({format:i,path:a})}return t},Se=(e,t,s)=>{const n=()=>t.map(r=>j(r,s.root));switch(e){case"csv":return ls(n());case"github":return fs(n(),{staged:s.staged});case"gitlab-code-quality":return hs(n());case"json":return`${JSON.stringify(n(),null,2)}
|
|
18
|
+
`;case"junit":return us(n());case"sarif":return`${Is(t,s.toolVersion,s.root,s.ruleMetadata)}
|
|
19
|
+
`;default:return`${s.history?ws(t,s.useColor,{redact:s.redact}):vs(t,s.root,s.useColor,{redact:s.redact,virtualSource:s.virtualSource})}
|
|
20
|
+
`}},Fs=e=>e.kind==="secret"?"<secret-value entry>":e.raw,Rs=(e,t,s)=>{const n=`${String(e.length)} unused ${t} entr${e.length===1?"y":"ies"} (no finding matched; remove or update them):`,r=[s?C(n):n];for(const i of e){const a=` - line ${String(i.line)}: ${Fs(i)}`;r.push(s?I(a):a)}return r.join(`
|
|
21
|
+
`)},Cs=(e,t,s)=>{const n=`${String(e.length)} finding(s) suppressed:`,r=[s?C(n):n];for(const i of e){const a=j(i,t),c=i.suppressedByEntry===void 0?"":` line ${String(i.suppressedByEntry.line)}`,o=`${i.suppressedBy}${c}`,d=` - [${i.ruleId}] ${K({...a,commit:i.commit})} (${o})`;r.push(s?I(d):d)}return r.join(`
|
|
22
|
+
`)},Es=async(e,t)=>{try{return await e.access(t),!0}catch{return!1}},A=e=>e?Array.isArray(e)?e:[e]:[],Ts=e=>{if(e===void 0)return"text";if(!Ve(e))throw new $(`--format must be one of: ${oe.join(", ")} (got "${e}")`);return e},ke=(e,t,s)=>{if(e!==void 0){if(!Number.isInteger(e)||e<0||s!==void 0&&e>s){const n=s===void 0?"a non-negative integer":`an integer from 0 to ${String(s)}`;throw new $(`${t} must be ${n} (got ${String(e)}).`)}return e}},As=e=>{if(e!==void 0&&(!Number.isInteger(e)||e<1))throw new $(`--max-size must be a positive number of bytes (got ${String(e)}; default ${String(O)}).`);return e},js=e=>{if(e!==void 0){if(!le.includes(e))throw new $(`--min-confidence must be one of: ${le.join(", ")} (got "${e}")`);return e}},Ls=(e,t,s)=>{const n=t??{},r=m=>m?x(s,m):void 0,i=(m,k)=>{const P=A(m);return P.length>0?P:k},a=(n.config?.presets??[]).map(m=>`tag:preset:${m}`),c=i(e.enableRule,n.rules?.enable)??[],o=[...c,...a.filter(m=>!c.includes(m))],d=o.length>0?o:void 0,f=i(e.excludeRule,n.rules?.exclude),l=i(e.includeRule,n.rules?.include),b=i(e.exclude,n.walk?.excludePatterns),h=A(e.excludeFrom).map(m=>x(s,m)),u=n.walk?.excludeFromFiles?.map(m=>x(s,m)),p=r(e.baseline)??r(n.baseline),w=r(e.config)??r(n.config?.path),v=js(e.minConfidence??n.config?.minConfidence),g=A(e.secretlintignore).map(m=>x(s,m));let S,y=h.length>0?h:u;if(e.secretlintignore===!1)S=!1;else if(g.length>0&&n.secretlintIgnore===!1)S=!1,y=[...y??[],...g];else if(g.length>0){const m=Array.isArray(n.secretlintIgnore)?n.secretlintIgnore.map(k=>x(s,k)):[];S=[...new Set([...m,...g])]}else n.secretlintIgnore===!1?S=!1:S=n.secretlintIgnore?.map(m=>x(s,m));return{baseline:p,concurrency:e.concurrency,config:{extendBundled:e.extendBundled===!1?!1:n.config?.extendBundled,inline:n.config?.inline,minConfidence:v,onlyVerified:e.onlyVerified??n.config?.onlyVerified??!1,path:w,validate:e.validate??n.config?.validate??!1},inlineAllow:e.inlineAllow,maxArchiveDepth:ke(e.maxArchiveDepth,"--max-archive-depth",ot),maxDecodeDepth:ke(e.maxDecodeDepth,"--max-decode-depth"),overrides:n.overrides,overridesRoot:s,profile:e.profile===!0,redact:e.redact??n.redact??!0,reportSuppressed:e.logIgnored===!0,rules:{enable:d,exclude:f,include:l},secretlintIgnore:S,verbose:e.verbose??!1,walk:{excludeFromFiles:y,excludePatterns:b,gitignore:e.gitignore===!1?!1:n.walk?.gitignore??!0,includeHidden:e.includeHidden??n.walk?.includeHidden,maxFileSize:As(e.maxSize)??n.walk?.maxFileSize}}},q=e=>{if(e.stdin!==void 0){if(e.stdin===null||e.stdin==="")throw new $("--stdin needs a filename used for rule and path matching, e.g. `cat .env | vis secrets --stdin .env`.");return e.stdin}},He=e=>[q(e)===void 0?void 0:"--stdin",e.history?"--history":void 0,e.staged?"--staged":void 0,e.since===void 0?void 0:"--since",e.affected?"--affected":void 0].filter(t=>t!==void 0),Ie=(e,t)=>[e.listRules?"--list-rules":void 0,e.listValidators?"--list-validators":void 0,e.init?"--init":void 0,t&&e.updateBaseline?"--update-baseline":void 0].find(s=>s!==void 0),Ms=e=>{const t=He(e);if(t.length>1)throw new $(`${t.join(", ")} each pick what to scan and can't be combined. Use one of them.`);if(!e.history){const s=[e.all?"--all":void 0,e.historyRange===void 0?void 0:"--history-range",e.maxCommits===void 0?void 0:"--max-commits"].filter(n=>n!==void 0);if(s.length>0)throw new $(`${s.join(", ")} only applies to git history scans. Did you mean \`vis secrets --history ${s.join(" ")}\`?`);return}if(e.all&&e.historyRange!==void 0)throw new $("--all walks every ref and can't be combined with --history-range. Use one or the other.");if(e.updateBaseline)throw new $("--update-baseline records working-tree findings and can't be combined with --history.");if(e.maxCommits!==void 0&&(!Number.isInteger(e.maxCommits)||e.maxCommits<1))throw new $(`--max-commits must be a positive integer (got ${String(e.maxCommits)}); omit it to walk every commit.`)},Ns=e=>{const t=e.history?"--history":e.staged?"--staged":void 0;if(e.maxArchiveDepth!==void 0&&t!==void 0)throw new $(`--max-archive-depth only applies to working-tree scans; ${t} scans git blobs as text and doesn't open archives. Drop --max-archive-depth or ${t}.`)},Ge=(e,t)=>[q(e)===void 0?void 0:"--stdin",e.staged?"--staged":void 0,e.since===void 0?void 0:"--since",e.affected?"--affected":void 0,e.historyRange===void 0?void 0:"--history-range",e.maxCommits===void 0?void 0:"--max-commits",t?"explicit paths":void 0].filter(s=>s!==void 0),Ds=(e,t)=>{if(q(e)!==void 0){if(t)throw new $("--stdin scans piped content and can't be combined with explicit paths.");const c=[e.updateBaseline?"--update-baseline":void 0,e.replaceBaseline?"--replace-baseline":void 0,e.logIgnored?"--log-ignored":void 0,e.maxSize===void 0?void 0:"--max-size",e.maxArchiveDepth===void 0?void 0:"--max-archive-depth",e.failOnUnreadable?"--fail-on-unreadable":void 0].filter(o=>o!==void 0);if(c.length>0)throw new $(`${c.join(", ")} can't be combined with --stdin: a single piped buffer can't seed a baseline, and there are no files to size-check, skip, list or open as archives.`)}const s=Ie(e,!0),n=[A(e.report).length>0?"--report":void 0,e.logIgnored?"--log-ignored":void 0,e.profile?"--profile":void 0,e.failOnUnreadable?"--fail-on-unreadable":void 0,e.failOnUnusedIgnores?"--fail-on-unused-ignores":void 0].filter(c=>c!==void 0);if(s!==void 0&&n.length>0)throw new $(`${n.join(", ")} only applies to a scan report and can't be combined with ${s}.`);const r=Ie(e,!1),i=[...He(e),...t?["explicit paths"]:[]];if(r!==void 0&&i.length>0)throw new $(`${i.join(", ")} picks what to scan and can't be combined with ${r}.`);if(!e.failOnUnusedIgnores)return;if(e.gitleaksIgnore===!1)throw new $("--fail-on-unused-ignores checks .gitleaksignore, which --no-gitleaks-ignore turns off. Drop one of them.");const a=Ge(e,t);if(a.length>0)throw new $(`--fail-on-unused-ignores needs a full scan: with ${a.join(", ")}, entries for files outside the scan would be reported as unused. Run it on a full \`vis secrets\` or \`vis secrets --history\` scan.`)},Bs=e=>{if(e.dryRun&&!e.fix&&!e.init)throw new $("--dry-run needs --fix (to preview rewrites) or --init (to preview a baseline).")},_s=(e,t,s)=>{if(!e.fix)return;const n=e.format??"text",r=[e.redact===!0?"--redact":void 0,e.history?"--history":void 0,e.staged?"--staged":void 0,e.init?"--init":void 0,q(e)===void 0?void 0:"--stdin",e.profile?"--profile":void 0,e.listRules?"--list-rules":void 0,e.listValidators?"--list-validators":void 0,e.updateBaseline?"--update-baseline":void 0,e.replaceBaseline?"--replace-baseline":void 0,A(e.report).length>0?"--report":void 0,e.logIgnored?"--log-ignored":void 0,e.failOnUnreadable?"--fail-on-unreadable":void 0,e.failOnUnusedIgnores?"--fail-on-unused-ignores":void 0,e.validate||t.config?.validate?"--validate":void 0,n==="text"?void 0:`--format ${n}`].filter(i=>i!==void 0);if(r.length>0)throw new $(`${r.join(", ")} cannot be combined with --fix. Fix mode rewrites working-tree files in place and prints only a masked summary.`);if(s>1)throw new $("--fix accepts at most one path; run one scan per path so rewrite targets stay unambiguous.")},ae=".gitleaksignore",R=T.child({stdout:process.stderr}),Us=(e,t)=>{const{flags:s,root:n,useColor:r}=t;s.quiet||(e.skipped.length>0&&process.stderr.write(`${ys(e.skipped,e.skippedUnit,r,{verbose:s.verbose})}
|
|
23
23
|
`),e.allowWarnings.length>0&&process.stderr.write(`${bs(e.allowWarnings,n,r)}
|
|
24
24
|
`),t.fullScan&&e.unusedIgnores.length>0&&process.stderr.write(`${Rs(e.unusedIgnores,ae,r)}
|
|
25
25
|
`)),s.logIgnored&&process.stderr.write(`${Cs(e.suppressed,n,r)}
|
|
26
|
-
`)},Y=44,J=(e,t,s="start")=>{const n=e.replaceAll(/\s+/gu," ").trim();return n.length<=t?n.padEnd(t):s==="end"?`…${n.slice(n.length-t+1)}`:`${n.slice(0,t-1)}…`},
|
|
26
|
+
`)},Y=44,J=(e,t,s="start")=>{const n=e.replaceAll(/\s+/gu," ").trim();return n.length<=t?n.padEnd(t):s==="end"?`…${n.slice(n.length-t+1)}`:`${n.slice(0,t-1)}…`},xe=(e,t,s,n="")=>` ${e} ${t.toFixed(1).padStart(7)} ms ×${String(s)}${n}`,Os=()=>({files:[],phases:[],rules:[],totalMs:0}),qs=(e,t=!1)=>{const s=i=>t?I(i):i,n=[`${s("profile:")} ${e.totalMs.toFixed(1)} ms total, ${String(e.files.length)} file(s)`],r=(i,a)=>{n.push(s(`${i}:`),...a.length>0?a:[" (none)"])};return r("phases",e.phases.slice(0,10).map(i=>xe(J(i.name,Y),i.ms,i.count))),r("rules",e.rules.slice(0,10).map(i=>xe(J(i.ruleId,Y),i.ms,i.count,` ${String(i.matches)} match(es)`))),r("files",e.files.slice(0,10).map(i=>` ${J(i.file,Y,"end")} ${i.ms.toFixed(1).padStart(7)} ms`)),n.join(`
|
|
27
27
|
`)},Fe=(e,t)=>{e!==void 0&&process.stderr.write(`${qs(e,t)}
|
|
28
|
-
`)},Ps=e=>{process.stderr.write(`${
|
|
29
|
-
`)},zs=async(e,t)=>{const{flags:s,format:n,history:r,reports:i,root:a,scanOptions:c,
|
|
28
|
+
`)},Ps=e=>{process.stderr.write(`${I("baseline diff: ")}${Ee(`+${String(e.fresh.length)} new`)} · ${C(`${String(e.surviving.length)} unchanged`)} · ${I(`-${String(e.resolved.length)} resolved`)}
|
|
29
|
+
`)},zs=async(e,t)=>{const{flags:s,format:n,history:r,reports:i,root:a,scanOptions:c,stdin:o,toolbox:d,toolVersion:f,useColor:l}=t,b=c.redact,u=n==="sarif"||i.some(v=>v.format==="sarif")?await Te(c).catch(()=>[]):[],p={history:r,redact:b,root:a,ruleMetadata:u,staged:s.staged===!0,toolVersion:f,virtualSource:o},w=!b||r;process.stdout.write(Se(n,e.findings,{...p,useColor:l}));for(const v of i){const g=x(d.process.cwd,v.path);_e(g,Se(v.format,e.findings,{...p,useColor:!1}),w),s.quiet||R.info(`Wrote ${v.format} report to ${M(d.process.cwd,g)||g}`)}},Ws=(e,t)=>{if(t.failOnUnreadable){const s=e.skipped.filter(n=>n.reason!=="too-large"&&n.reason!=="binary").length;s>0&&(R.error(`${String(s)} ${e.skippedUnit}(s) could not be read; the scan is incomplete (--fail-on-unreadable).`),process.exitCode=1)}t.failOnUnusedIgnores&&e.unusedIgnores.length>0&&(R.error(`${String(e.unusedIgnores.length)} unused ${ae} entr${e.unusedIgnores.length===1?"y":"ies"} (--fail-on-unused-ignores).`),process.exitCode=1)},Vs=(e,t,s,n)=>{if(e.replacements===0&&e.skipped.length===0){n||process.stderr.write(t>0?`No secrets detected, but ${String(t)} file(s) were not scanned.
|
|
30
30
|
`:`No secrets detected.
|
|
31
31
|
`);return}for(const r of e.edits)process.stderr.write(`${r.file}:${String(r.line)} ${r.ruleId}: ${Xt} -> ${Pe}${s?" (dry-run)":""}
|
|
32
32
|
`);for(const r of e.skipped)process.stderr.write(`Skipped ${r.file}:${String(r.line)} ${r.ruleId}: ${r.reason}
|
|
@@ -34,17 +34,17 @@ ${r}`):z("error",{col:s.startColumn,endColumn:s.endColumn,endLine:s.endLine,file
|
|
|
34
34
|
`),t>0&&process.stderr.write(`${String(t)} file(s) were not scanned.
|
|
35
35
|
`))},U=".secrets-baseline.json",Hs=async(e,t)=>{const s=await Te(e);process.stdout.write(`${String(s.length)} rules loaded
|
|
36
36
|
|
|
37
|
-
`);for(const n of s){const r=t?C(n.id):n.id,i=n.tags.length>0?` ${t?
|
|
37
|
+
`);for(const n of s){const r=t?C(n.id):n.id,i=n.tags.length>0?` ${t?I(`[${n.tags.join(", ")}]`):`[${n.tags.join(", ")}]`}`:"";if(process.stdout.write(`${r}${i}
|
|
38
38
|
${n.description}
|
|
39
|
-
`),n.keywords.length>0){const a=`keywords: ${n.keywords.slice(0,6).join(", ")}${n.keywords.length>6?", ...":""}`;process.stdout.write(` ${t?
|
|
39
|
+
`),n.keywords.length>0){const a=`keywords: ${n.keywords.slice(0,6).join(", ")}${n.keywords.length>6?", ...":""}`;process.stdout.write(` ${t?I(a):a}
|
|
40
40
|
`)}process.stdout.write(`
|
|
41
|
-
`)}},Gs=async(e,t)=>{const s=await at(e);if(s.length===0){process.stdout.write(t?`${
|
|
41
|
+
`)}},Gs=async(e,t)=>{const s=await at(e);if(s.length===0){process.stdout.write(t?`${I("No non-HTTP validators required by the current ruleset.")}
|
|
42
42
|
`:`No non-HTTP validators required by the current ruleset.
|
|
43
43
|
`);return}process.stdout.write(`${String(s.length)} non-HTTP validator type(s) referenced by the current ruleset:
|
|
44
44
|
|
|
45
|
-
`);for(const n of s){const r=t?C(n.displayName):n.displayName,i=`(${n.type}, ${String(n.ruleCount)} rule${n.ruleCount===1?"":"s"})`;process.stdout.write(`${r} ${t?
|
|
45
|
+
`);for(const n of s){const r=t?C(n.displayName):n.displayName,i=`(${n.type}, ${String(n.ruleCount)} rule${n.ruleCount===1?"":"s"})`;process.stdout.write(`${r} ${t?I(i):i}
|
|
46
46
|
`),process.stdout.write(` ${n.summary}
|
|
47
|
-
`);const a=n.packageName?`install: npm add ${n.packageName}`:"no driver — bespoke implementation required";process.stdout.write(` ${t?
|
|
47
|
+
`);const a=n.packageName?`install: npm add ${n.packageName}`:"no driver — bespoke implementation required";process.stdout.write(` ${t?I(a):a}
|
|
48
48
|
|
|
49
|
-
`)}},Ks=async(e,t,s)=>{const n=V(e,U);if(!s&&te(n)){T.warn(`Detected existing ${U} — refusing to overwrite. Delete it first to re-init.`),process.exitCode=1;return}T.info(s?"[dry-run] Previewing init — no files will be written.":"Scanning workspace to seed baseline…");const r=Be();r.start("scanning");let i;try{i=await ct([e],t),r.succeed()}catch(c){throw r.failed(),c}if(s){T.info(`[dry-run] Would create ${U} with ${String(i.length)} finding(s).`);return}const a=qe(i,n,e,{replace:!0});T.success(`Wrote ${U} (${String(a)} findings).`),T.notice("Commit it. Use `vis secrets --baseline .secrets-baseline.json` in CI. Add path patterns to .gitignore to exclude directories from scanning.")},Re={files:{failure:"secret scan",spinner:"scanning for secrets"},history:{failure:"git-history secret scan",spinner:"scanning git history for secrets"},paths:{failure:"secret scan",spinner:"scanning for secrets"},staged:{failure:"secret scan",spinner:"scanning for secrets"},stdin:{failure:"piped-input secret scan",spinner:"scanning piped input"}},Ce=(e,t,s)=>{const n=
|
|
50
|
-
`)}},un=async e=>{const{argument:t,options:s,visConfig:n,workspaceRoot:r}=e,i=s,a=t??[],c=r??e.process.cwd,o=!i.quiet&&process.stdout.isTTY,d=n?.secrets,
|
|
49
|
+
`)}},Ks=async(e,t,s)=>{const n=V(e,U);if(!s&&te(n)){T.warn(`Detected existing ${U} — refusing to overwrite. Delete it first to re-init.`),process.exitCode=1;return}T.info(s?"[dry-run] Previewing init — no files will be written.":"Scanning workspace to seed baseline…");const r=Be();r.start("scanning");let i;try{i=await ct([e],t),r.succeed()}catch(c){throw r.failed(),c}if(s){T.info(`[dry-run] Would create ${U} with ${String(i.length)} finding(s).`);return}const a=qe(i,n,e,{replace:!0});T.success(`Wrote ${U} (${String(a)} findings).`),T.notice("Commit it. Use `vis secrets --baseline .secrets-baseline.json` in CI. Add path patterns to .gitignore to exclude directories from scanning.")},Re={files:{failure:"secret scan",spinner:"scanning for secrets"},history:{failure:"git-history secret scan",spinner:"scanning git history for secrets"},paths:{failure:"secret scan",spinner:"scanning for secrets"},staged:{failure:"secret scan",spinner:"scanning for secrets"},stdin:{failure:"piped-input secret scan",spinner:"scanning piped input"}},Ce=(e,t,s)=>{const n=x(s,e),r=M(t,n);return r===""||r===".."||r.startsWith("../")||E(r)?n:r},Ys=async()=>{const e=[];let t=0;for await(const s of process.stdin){if(t+=s.length,t>O)throw new $(`--stdin input exceeds ${String(O)} bytes, the largest file the scanner reads. Scan it as a file instead.`);e.push(s)}return Buffer.concat(e).toString("utf8")},Js=async(e,t,s,n,r)=>{const i=q(e);if(i!==void 0){if(r!==""){if(Buffer.byteLength(r)>O)throw new $(`--stdin input exceeds ${String(O)} bytes, the largest file the scanner reads. Scan it as a file instead.`);return{content:r,filename:Ce(i,s,n),kind:"stdin"}}if(process.stdin.isTTY)throw new $("--stdin expects piped input, but stdin is a terminal. Pipe content in, e.g. `cat .env | vis secrets --stdin .env`.");return{content:await Ys(),filename:Ce(i,s,n),kind:"stdin"}}const a=t.length>0?t.map(o=>x(s,o)):[s],c=e.history?"--history":e.staged?"--staged":e.since===void 0?void 0:"--since";if(c!==void 0&&!ye(s))throw new $(`${c} requires a git working tree, and none was detected.`);return e.history?{kind:"history"}:e.staged?{kind:"staged"}:e.since!==void 0?{files:we(s,e.since),kind:"files"}:e.affected?ye(s)?{files:we(s,process.env.VIS_BASE??"HEAD~1"),kind:"files"}:(R.warn("--affected requires git; falling back to full scan"),{kind:"paths",paths:a}):{kind:"paths",paths:a}},Xs=async(e,t,s,n)=>{if(e.kind==="stdin"){const{allowWarnings:c,findings:o}=lt(e.filename,s,n)?{allowWarnings:[],findings:[]}:await dt(e.content,e.filename,s);return{allowWarnings:c,findings:o,skipped:[],skippedUnit:"file",suppressed:[],unusedIgnores:[]}}if(e.kind==="history")return{...await ut({...s,all:t.all,cwd:n,maxCommits:t.maxCommits,range:t.historyRange}),skippedUnit:"blob"};if(e.kind==="paths")return{...await ht(e.paths,s),skippedUnit:"file"};const r=process.cwd(),i={...s,baseline:typeof s.baseline=="string"?Kt(s.baseline,n,r):s.baseline},a=e.kind==="staged"?await pt({...i,cwd:n}):await ft(e.files,{...i,ignoreRoot:n});return{allowWarnings:a.allowWarnings.map(c=>({...c,file:ne(c.file,r,n)})),findings:a.findings.map(c=>pe(c,r,n)),profile:a.profile&&Gt(a.profile,r,n),skipped:a.skipped,skippedUnit:e.kind==="staged"?"blob":"file",suppressed:a.suppressed.map(c=>pe(c,r,n)),unusedIgnores:a.unusedIgnores}},Zs=async e=>{const t=await mt(e);if(t.length>0){R.warn(`${String(t.length)} rule(s) skipped due to invalid regex. First few:`);for(const s of t.slice(0,5))process.stderr.write(` - ${s.ruleId}: ${s.reason}
|
|
50
|
+
`)}},un=async e=>{const{argument:t,options:s,visConfig:n,workspaceRoot:r}=e,i=s,a=t??[],c=r??e.process.cwd,o=!i.quiet&&process.stdout.isTTY,d=n?.secrets,f=Ls(i,d,c),l="0.0.0-alpha";Ms(i),Ns(i),Ds(i,a.length>0),Bs(i),_s(i,f,a.length),i.fix&&(f.redact=!1);const b=Ts(i.format),h=xs(A(i.report)),u=V(c,ae);if(i.gitleaksIgnore!==!1&&await Es(e.fs,u)&&(f.gitleaksIgnore=u),i.listRules){await Hs(f,o);return}if(i.listValidators){await Gs(f,o);return}if(i.init){await Ks(c,f,i.dryRun??!1);return}const p=await Js(i,a,c,e.process.cwd,e.process.stdin),w=p.kind==="history";if(p.kind==="files"&&p.files.length===0){i.quiet||R.success("No files to scan."),i.profile&&Fe(Os(),o);return}const v=Be({verbose:!i.quiet&&b==="text"&&!i.fix});v.start(Re[p.kind].spinner);let g;try{g=await Xs(p,i,f,c),v.succeed()}catch(k){throw v.failed(),new $(`${Re[p.kind].failure} failed: ${k instanceof Error?k.message:String(k)}`,{cause:k})}if(i.fix){const k=rs(g.findings,c,i.dryRun===!0,p.kind==="paths"?p.paths[0]:c);Vs(k,g.skipped.length,i.dryRun===!0,i.quiet===!0),k.skipped.length>0&&(process.exitCode=1);return}const S={flags:i,format:b,fullScan:Ge(i,a.length>0).length===0,history:w,reports:h,root:c,scanOptions:f,stdin:p.kind==="stdin"?p.content:void 0,toolbox:e,toolVersion:l,useColor:o};Us(g,S),Fe(g.profile,o),i.verbose&&await Zs(f);const{findings:y}=g,m=typeof f.baseline=="string"?f.baseline:V(c,U);if(i.updateBaseline){const k=qe(y,m,c,{replace:i.replaceBaseline});R.success(`Baseline updated: ${M(c,m)||m} now contains ${String(k)} entries.`);return}await zs(g,S),b==="text"&&!w&&!i.quiet&&te(m)&&Ps(Yt(y,m,c)),y.length>0?(i.quiet||(R.warn(`${String(y.length)} potential secret(s) found${w?" across git history":""}`),R.notice(w?"Findings reference the commit that introduced them — rotate the credential and rewrite history (e.g. git filter-repo) if it is still reachable.":"Suppress individual lines with `gitleaks:allow` / `secret-scanner:allow`, or run `vis secrets --update-baseline`.")),process.exitCode=1):i.quiet||R.success(w?"No secrets detected in git history.":"No secrets detected."),Ws(g,i)};export{un as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as C,z as P,U as pe}from"../packem_shared/index-0dnGN3GP.js";import{M as ge,N as le,P as de,L as me,C as ye,R as ke,p as m,q as fe}from"./cli-main.js";import{i as ue}from"../packem_shared/index-BjdW45xX.js";import he from"module-replacements/manifests/micro-utilities.json"with{type:"json"};import je from"module-replacements/manifests/native.json"with{type:"json"};import ve from"module-replacements/manifests/preferred.json"with{type:"json"};import{K as be,j as t,X as g,O as c,r as O,R as xe,h as Te,i as W}from"../packem_shared/registry-
|
|
1
|
+
import{e as C,z as P,U as pe}from"../packem_shared/index-0dnGN3GP.js";import{M as ge,N as le,P as de,L as me,C as ye,R as ke,p as m,q as fe}from"./cli-main.js";import{i as ue}from"../packem_shared/index-BjdW45xX.js";import he from"module-replacements/manifests/micro-utilities.json"with{type:"json"};import je from"module-replacements/manifests/native.json"with{type:"json"};import ve from"module-replacements/manifests/preferred.json"with{type:"json"};import{K as be,j as t,X as g,O as c,r as O,R as xe,h as Te,i as W}from"../packem_shared/registry-DCTL7aRA.js";import{a as ee}from"../packem_shared/index--eV4qIz5.js";import{l as Ie}from"./ts-loader.js";import{y as V}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{U as D}from"../packem_shared/env-BNmRHLkv.js";import{d as we,n as Me}from"../packem_shared/pm-runner-BXRi4ZM9.js";import{p as re}from"../packem_shared/package-version-6zT7gOkz.js";import{l as Se}from"../packem_shared/glob-Cyk1H9ZL-Dt41_ECv.js";const Ce=["dependencies","devDependencies","peerDependencies","peerDependenciesMeta","optionalDependencies","bundleDependencies"],Ee=["overrides","pnpm","resolutions"],$e=["engines","files"],Oe=r=>{const e=ee.coerce(r)?.major;return e!==void 0&&e>=10},De=r=>{const e=C(r,"pnpm-workspace.yaml");if(!V(e))return{overrides:{},source:"pnpm-workspace.yaml"};try{return{overrides:Ie(e)?.overrides??{},source:"pnpm-workspace.yaml"}}catch{return{overrides:{},source:"pnpm-workspace.yaml"}}},Pe=(r,e)=>{let s={};return e==="pnpm"?s=r.pnpm?.overrides??{}:e==="yarn"||e==="bun"?s=r.resolutions??{}:s=r.overrides??{},{overrides:s,source:"package.json"}},Ne=(r,e,s)=>s.name==="pnpm"&&Oe(s.version)?De(r):Pe(e,s.name),Y=(r,e)=>{const s=e;for(const o of Ee){const n=r.indexOf(o);if(n!==-1&&o!==s)return s==="overrides"?n:n+1}let i=-1;for(const o of Ce){const n=r.indexOf(o);n>i&&(i=n)}if(i!==-1)return i+1;for(const o of $e){const n=r.indexOf(o);if(n!==-1)return n}return r.length},Ae=(r,e)=>{const s=C(r,"pnpm-workspace.yaml");if(!V(s))throw new Error(`pnpm-workspace.yaml not found at ${s}. Cannot write overrides for pnpm v10+.`);let i=P(s);const n=`overrides:
|
|
2
2
|
${Object.entries(e).map(([p,d])=>` '${p}': '${d}'`).join(`
|
|
3
3
|
`)}
|
|
4
4
|
`;i=/^overrides:\s*$/m.test(i)||/^overrides:\s*\n/m.test(i)?i.replace(/^overrides:\s*\n(?:(?:[ \t].*)?\n)*/m,n):`${i.trimEnd()}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as Dt}from"node:module";import{X as xe,F as I,b as ke,q as ut,T as mt}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as V,z as $e,U as Ft}from"../packem_shared/index-0dnGN3GP.js";import{i as Me}from"../packem_shared/index-BjdW45xX.js";import{whichBin as zt}from"#native";import{b as Bt,a as Wt,e as Ht}from"../packem_shared/ai-analysis-
|
|
1
|
+
import{createRequire as Dt}from"node:module";import{X as xe,F as I,b as ke,q as ut,T as mt}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as V,z as $e,U as Ft}from"../packem_shared/index-0dnGN3GP.js";import{i as Me}from"../packem_shared/index-BjdW45xX.js";import{whichBin as zt}from"#native";import{b as Bt,a as Wt,e as Ht}from"../packem_shared/ai-analysis-16c2sIVd.js";import{e as Gt,b as Kt,g as qt,s as Yt}from"../packem_shared/ai-cache-BeP3Wk2e.js";import{l as Fe}from"./ts-loader.js";import{y as X}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{U as et,e as Jt,i as tt,f as Xt,k as Zt}from"../packem_shared/env-BNmRHLkv.js";import{L as Qt,h as en,i as tn,K as nn,a as an,f as on,d as rn,b as sn}from"../packem_shared/registry-DCTL7aRA.js";import{p as f,c as nt}from"./cli-main.js";import{d as cn,c as ln}from"../packem_shared/pm-runner-BXRi4ZM9.js";import{a as T}from"../packem_shared/index--eV4qIz5.js";import{c as ht,s as ye,g as dn,p as pn,e as fn}from"../packem_shared/index-BxCOKJpr.js";import{d as gn}from"../packem_shared/anolilab-text-CAM_E6uK.js";import{S as un,a as M,b as vt,d as be,s as mn,f as hn,g as vn,h as wn}from"../packem_shared/junit-audit-CuJShWCH.js";import{t as yn,b as bn,G as xn}from"../packem_shared/ecosystem-gate-21KYhUWm.js";import{s as Sn}from"../packem_shared/scan-progress-C9rA4YBY.js";import{r as An,b as Nn,c as it,q as at,a as ot}from"../packem_shared/advisories-Dc10IYpK.js";import{p as yt}from"../packem_shared/package-version-6zT7gOkz.js";import{r as Cn,l as En,f as jn,a as Pn}from"../packem_shared/dependency-scan-nsAIchjl.js";import{r as Rn}from"../packem_shared/manifests-Dt4AxrbA.js";import{c as oe,h as On,i as In,l as Ln,m as Dn}from"../packem_shared/multi-eco-lockfiles-BBQ_himh.js";import{l as Tn,p as Mn,O as _n}from"../packem_shared/osv-bloom-DU6avR2k.js";import{f as Bn}from"../packem_shared/osv-1_7KmJp_.js";let Tt;const Mt=e=>(Tt??=Dt(import.meta.url))(e),te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Z=e=>{if(typeof te<"u"&&te.versions&&te.versions.node){const[t,n]=te.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return te.getBuiltinModule(e)}return Mt(e)},{spawnSync:_t}=Z("node:child_process"),{createInterface:Vt}=Z("node:readline"),{stripVTControlCharacters:Ut}=Z("node:util"),{createHash:kn}=Z("node:crypto"),{relative:wt,join:$n}=Z("node:path"),{readFileSync:Vn,writeFileSync:Fn,renameSync:zn,unlinkSync:Un}=Z("node:fs"),rt=(e,t={})=>{Array.isArray(t.extensions)||(t.extensions=["js","mjs","cjs","ts"]);const n=[];for(const i of Qt(e,t))n.push(i.path);return n},Se=e=>`${e.packageName}@${e.packageVersion}:${e.vulnerability.id}`,Wn=e=>e==null||e===!0||e===""||e==="true"||e.toString().toLowerCase()==="all",Hn=(e,t)=>{if(Wn(t))return e;const n=String(t).trim();if(/^\d+$/.test(n)){const a=Number.parseInt(n,10)-1,o=e[a];return o?[o]:[]}const i=n.toLowerCase();return e.filter(a=>{const{aliases:o,id:r}=a.vulnerability;return r.toLowerCase()===i||(o??[]).some(c=>c.toLowerCase()===i)})},Gn=e=>{const{packageName:t,packageVersion:n,vulnerability:i}=e,a=(i.aliases??[]).join(", ")||"none",o=(i.fixedVersions??[]).join(", ")||"no fixed version published";return`You are a security engineer. Explain this dependency vulnerability for a developer triaging it.
|
|
2
2
|
|
|
3
3
|
Package: ${t}@${n}
|
|
4
4
|
Advisory: ${i.id} (aliases: ${a})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as wt}from"node:module";import{F as j,j as ae,q as ve,X as ye,b as Ee,J as ge}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as W,z as yt,v as bt,U as Xe}from"../packem_shared/index-0dnGN3GP.js";import{M as jt,N as St,P as Ct,L as $t,C as Et,Q as Rt,R as Le,p as d,q as At,S as O}from"./cli-main.js";import{i as Tt}from"../packem_shared/index-BjdW45xX.js";import{j as i,X as u,O as r,r as L,d as It,o as Nt,a as Qe,R as Pt,f as Ot}from"../packem_shared/registry-
|
|
1
|
+
import{createRequire as wt}from"node:module";import{F as j,j as ae,q as ve,X as ye,b as Ee,J as ge}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as W,z as yt,v as bt,U as Xe}from"../packem_shared/index-0dnGN3GP.js";import{M as jt,N as St,P as Ct,L as $t,C as Et,Q as Rt,R as Le,p as d,q as At,S as O}from"./cli-main.js";import{i as Tt}from"../packem_shared/index-BjdW45xX.js";import{j as i,X as u,O as r,r as L,d as It,o as Nt,a as Qe,R as Pt,f as Ot}from"../packem_shared/registry-DCTL7aRA.js";import{x as Ft}from"../packem_shared/xxh3-BLHlvhgT.js";import{h as _t,g as Lt,s as Be,e as et}from"../packem_shared/env-BNmRHLkv.js";import{y as be}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{p as tt}from"../packem_shared/package-version-6zT7gOkz.js";import{findVisConfigFile as zt}from"./CONFIG_FILES.js";import{d as Ne,c as Ve,r as Bt,b as Vt,a as Ht,e as Ut,f as Wt,m as Yt}from"./handler71.js";import{d as st,n as Gt}from"../packem_shared/pm-runner-BXRi4ZM9.js";import{c as Kt}from"../packem_shared/env-consistency-BW7IQWj9.js";import{c as qt}from"../packem_shared/runtime-check-Srsksjgg.js";import{s as Jt}from"../packem_shared/scan-progress-C9rA4YBY.js";import{l as Xt,r as Qt,f as Zt}from"../packem_shared/dependency-scan-nsAIchjl.js";import{l as it}from"../packem_shared/spinner-D_gE_AaM.js";import{n as es,a as ts}from"../packem_shared/tabs-CQAOC5V5.js";import{u as ss}from"../packem_shared/use-measured-height-VwlRyMbC.js";import{readCatalogs as nt,checkOutdated as is}from"./catalog.js";import{DEFAULT_UNTRACKED_ENV_PATTERNS as ns,resolveChildEnvPolicy as rs,createEnvMatcher as Te,detectFrameworks as os,extractReferencedEnvVars as as,looksLikeInputUri as ls,parseInputUri as cs,CLEAN_ENV_BASE_NAMES as ds,CLEAN_ENV_POSIX_NAMES as us,CLEAN_ENV_WIN32_NAMES as hs}from"@visulima/task-runner";import{c as ps,V as fs,a as ms}from"../packem_shared/task-env-Cl4jNMCR.js";import{L as gs}from"../packem_shared/index-BisalDCf.js";import{l as xs}from"./ts-loader.js";import{s as ws}from"../packem_shared/verify-3WE9U_Bv.js";import{l as ks}from"../packem_shared/npmrc-CIvOb61L.js";import{f as vs}from"../packem_shared/osv-1_7KmJp_.js";let kt;const vt=e=>(kt??=wt(import.meta.url))(e),we=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Je=e=>{if(typeof we<"u"&&we.versions&&we.versions.node){const[t,s]=we.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return we.getBuiltinModule(e)}return vt(e)},{rmSync:ze,writeFileSync:Dt,statSync:Mt,readFileSync:Ze}=Je("node:fs"),{spawnSync:Re}=Je("node:child_process"),Ie=()=>W(Lt(),"doctor"),ys=1800*1e3,He=e=>{if(!e)return"";try{return String(Mt(e).mtimeMs)}catch{return""}},bs=3,js=e=>{const t=JSON.stringify({configMtime:He(e.configPath),launcher:process.env.VIS_LAUNCHER??null,lockfileMtime:He(e.lockfilePath),schema:bs,sections:[...e.sections].toSorted(),socketEnabled:e.socketEnabled,workspaceRoot:e.workspaceRoot});return Ft(Buffer.from(t))},Ss=e=>{const t=W(Ie(),`${e}.json`);if(be(t))try{const s=tt(t);if(Date.now()-s.createdAt>s.ttlMs){ze(t,{force:!0});return}return{...s.results,sections:new Set(s.results.sections)}}catch{ze(t,{force:!0});return}},Cs=(e,t,s=ys)=>{_t(Ie());const a={createdAt:Date.now(),results:{...t,sections:[...t.sections]},ttlMs:s};Dt(W(Ie(),`${e}.json`),JSON.stringify(a,void 0,2),"utf8")},Se="orphans",$s=()=>{if(process.platform!=="linux")return{id:"inotify",message:"inotify capacity check skipped (not Linux).",status:"skip"};let e;try{const t=Ze("/proc/sys/fs/inotify/max_user_watches","utf8").trim(),s=Number.parseInt(t,10);Number.isFinite(s)&&s>0&&(e=s)}catch{return{id:"inotify",message:"Could not read /proc/sys/fs/inotify/max_user_watches.",status:"warn"}}return e===void 0?{id:"inotify",message:"inotify max_user_watches reported a non-numeric value.",status:"warn"}:e<65536?{detail:{maxWatches:e},id:"inotify",message:`inotify watcher limit is ${String(e)} — large monorepos can exhaust this. Bump now with \`sudo sysctl fs.inotify.max_user_watches=524288\` and persist via \`/etc/sysctl.d/99-vis.conf\` so it survives reboot.`,status:"warn"}:{detail:{maxWatches:e},id:"inotify",message:`inotify capacity OK (${String(e)} watches).`,status:"ok"}},Es=()=>{const e=!!process.stdin.isTTY,t=!!process.stdout.isTTY;return e&&t?{id:"tty",message:"Interactive TTY available — watch keybinds enabled.",status:"ok"}:!e&&!t?{id:"tty",message:"No TTY on stdin/stdout — running in CI / piped mode (keybinds disabled).",status:"skip"}:{detail:{stdin:String(e),stdout:String(t)},id:"tty",message:e?"stdin is a TTY but stdout is not — output is being captured; keybinds still work.":"stdout is a TTY but stdin is not — keybinds disabled (input is piped).",status:"skip"}},Rs=()=>{const e=process.pid;try{return process.platform==="win32"?at(e):ot(e)}catch{return[]}},As=()=>{const e=process.pid;let t;try{t=process.platform==="win32"?at(e):ot(e)}catch{return{id:Se,message:"Could not enumerate processes (ps/tasklist failed).",status:"warn"}}if(t.length===0)return{id:Se,message:"No orphaned vis/task-runner processes detected.",status:"ok"};if(t.length<=2)return{detail:{count:t.length,pids:t.join(",")},id:Se,message:`${String(t.length)} possibly orphaned process(es) detected (PIDs: ${t.join(", ")}). Likely benign.`,status:"skip"};const s=process.platform==="win32"?t.map(a=>`taskkill /F /PID ${String(a)}`).join(" & "):`kill ${t.join(" ")}`;return{detail:{count:t.length,pids:t.join(",")},id:"orphans",message:`${String(t.length)} possibly orphaned vis/task-runner processes — run \`vis doctor --fix\` to clean them up, or kill them manually: ${s}`,status:"warn"}},Ts=(e={})=>{const t=e.enumerate??Rs,a=e.force===!0?"SIGKILL":"SIGTERM",n=e.kill??Ds,o=t(),c=[],h=[];for(const l of o)try{n(l,a),c.push(l)}catch(p){const g=p.code??p.message;if(g==="ESRCH"){c.push(l);continue}h.push({pid:l,reason:g})}return{failed:h,killed:c}},Is=e=>Re("taskkill",e,{encoding:"utf8",timeout:1e4}),Ns=(e,t)=>{process.kill(e,t)},Ps=(e,t,s=Is)=>{const a=t==="SIGKILL"?["/F","/PID",String(e)]:["/PID",String(e)],n=s(a);if(n.error)throw n.error;if(typeof n.status=="number"&&n.status!==0){const o=n.status===128?"ESRCH":`taskkill exited with code ${String(n.status)}`,c=new Error(o);throw c.code=o,c}},Os=(e,t,s=Ns)=>{s(e,t)},Ds=(e,t)=>{if(process.platform==="win32"){Ps(e,t);return}Os(e,t)},rt=(e,t)=>{const s=Re(e,t,{encoding:"utf8",timeout:1e4});if(s.error)throw s.error;if(typeof s.status=="number"&&s.status!==0)throw new Error(`${e} exited with code ${String(s.status)}`);return typeof s.stdout=="string"?s.stdout:""},ot=e=>{const t=rt("ps",["-Ao","pid=,command="]),s=[];for(const a of t.split(`
|
|
2
2
|
`)){if(a.length===0)continue;const n=/^\s*(\d+)\s+(.+)$/.exec(a);if(!n)continue;const o=Number.parseInt(n[1]??"",10),c=(n[2]??"").toLowerCase();!Number.isFinite(o)||o===e||(/(?:^|[ /])vis-native(?:\s|$|[-.])/.test(c)||/(?:^|[ /])vis\s+run\b/.test(c)||/(?:^|[ /])task-runner(?:\s|$|[-.])/.test(c))&&s.push(o)}return s},at=e=>{const t=rt("tasklist",["/FO","CSV","/NH"]),s=[];for(const a of t.split(/\r?\n/)){if(a.length===0)continue;const n=a.split(/","/).map(h=>h.replaceAll(/^"|"$/g,"")),o=(n[0]??"").toLowerCase(),c=Number.parseInt(n[1]??"",10);!Number.isFinite(c)||c===e||(o==="vis.exe"||o.startsWith("vis-native")||o.includes("task-runner"))&&s.push(c)}return s},Ms=()=>{let e;try{const t=Re("watchman",["--version"],{encoding:"utf8",timeout:2e3});if(t.error||typeof t.status=="number"&&t.status!==0)throw t.error??new Error("watchman exited non-zero");e=typeof t.stdout=="string"?t.stdout.trim():void 0}catch{return{id:"watchman",message:"Watchman not found — `vis` uses native fs.watch (fine for small repos). Install Watchman + `fb-watchman` to scale watch mode on large monorepos.",status:"skip"}}return{detail:e?{version:e}:void 0,id:"watchman",message:e?`Watchman available (${e}) — scalable watch backend in use.`:"Watchman available — scalable watch backend in use.",status:"ok"}},Fs=(e=process.cwd())=>{let t="";try{t=Ze(W(e,".gitattributes"),"utf8")}catch(s){if(s.code!=="ENOENT")return{id:"git-lfs",message:"Could not read .gitattributes.",status:"warn"}}if(!t.includes("filter=lfs"))return{id:"git-lfs",message:"No Git LFS tracking declared in .gitattributes.",status:"skip"};try{const s=Re("git",["lfs","version"],{encoding:"utf8",timeout:2e3});if(s.error||typeof s.status=="number"&&s.status!==0)throw s.error??new Error("git-lfs not available")}catch{return{id:"git-lfs",message:"Repo tracks files via Git LFS but `git-lfs` is not installed — checked-out LFS files are pointer stubs, not real content. Install git-lfs and run `git lfs pull`.",status:"warn"}}return{id:"git-lfs",message:"Git LFS tracking declared and `git-lfs` is installed.",status:"ok"}},_s=()=>{const e=process.env.VIS_LAUNCHER;return e==="native"?{id:"launcher",message:"Started by the native vis executable (fast path).",status:"ok"}:e==="node"&&process.platform==="win32"?{id:"launcher",message:"Started through the Node launcher on Windows (help and completion always run in Node there).",status:"skip"}:e==="node"?{id:"launcher",message:"Started through the Node launcher (slower path). If the native binary should be in use, allow install scripts for @visulima/vis (e.g. `pnpm approve-builds`, bun `trustedDependencies`) and reinstall from scratch to start commands without Node.",status:"skip"}:{id:"launcher",message:"Launcher check skipped (not started through the npm `vis` command).",status:"skip"}},Ls=e=>[$s(),Es(),Ms(),Fs(e),_s(),As()],me=[{id:"dependencies",label:"Deps"},{id:"security",label:"Security"},{id:"optimization",label:"Optimize"},{id:"runtime",label:"Runtime"}],$e=["dependencies","security","optimization","runtime"],pe=e=>{const t=new Map;for(const s of $e)t.set(s,[]);for(const s of e)t.get(s.section).push(s);for(const[s,a]of t)a.length===0&&t.delete(s);return t},fe=(e,t,s,a)=>{let n=e.filter(o=>o.section===t);if(a&&(n=n.filter(o=>o.severity===a)),s){const o=s.toLowerCase();n=n.filter(c=>c.title.toLowerCase().includes(o))}return[...n]},zs=e=>{const t={dependencies:"idle",optimization:"idle",runtime:"idle",security:"idle"};for(const s of $e)e.has(s)&&(t[s]="idle");return t};class Ue{#e;#s=new Set;constructor(t=[]){const s=Array.isArray(t)?{findings:t}:t,a=s.findings??[],n=s.activeSections??new Set($e),o=$e.find(l=>n.has(l))??"dependencies",c=fe(a,o,"",void 0),h=zs(n);if(a.length>0)for(const l of a)h[l.section]="done";this.#e={all:a,entries:c,filterActive:!1,filterText:"",filterType:o,focusedPanel:"list",grouped:pe(c),pendingAction:void 0,sectionError:{},sectionMessage:{},sectionStatus:h,selectedIndex:0,severityFilter:void 0}}getSnapshot=()=>this.#e;subscribe=t=>(this.#s.add(t),()=>{this.#s.delete(t)});setSelectedIndex(t){const s=Math.max(0,Math.min(t,this.#e.entries.length-1));s!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:s})}setFocusedPanel(t){t!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:t})}setFilterType(t){if(t===this.#e.filterType)return;const s=fe(this.#e.all,t,this.#e.filterText,this.#e.severityFilter);this.#t({...this.#e,entries:s,filterType:t,grouped:pe(s),selectedIndex:0})}setFilter(t){const s=fe(this.#e.all,this.#e.filterType,t,this.#e.severityFilter);this.#t({...this.#e,entries:s,filterText:t,grouped:pe(s),selectedIndex:0})}setFilterActive(t){if(t===this.#e.filterActive)return;if(t){this.#t({...this.#e,filterActive:!0});return}const s=fe(this.#e.all,this.#e.filterType,"",this.#e.severityFilter);this.#t({...this.#e,entries:s,filterActive:!1,filterText:"",grouped:pe(s),selectedIndex:0})}setPendingAction(t){this.#t({...this.#e,pendingAction:t})}setSeverityFilter(t){if(t===this.#e.severityFilter)return;const s=fe(this.#e.all,this.#e.filterType,this.#e.filterText,t);this.#t({...this.#e,entries:s,grouped:pe(s),selectedIndex:0,severityFilter:t})}startSection(t,s){this.#t({...this.#e,sectionMessage:{...this.#e.sectionMessage,[t]:s},sectionStatus:{...this.#e.sectionStatus,[t]:"running"}})}completeSection(t,s){const a=[...this.#e.all,...s],n=fe(a,this.#e.filterType,this.#e.filterText,this.#e.severityFilter),o={...this.#e.sectionMessage};delete o[t],this.#t({...this.#e,all:a,entries:n,grouped:pe(n),sectionMessage:o,sectionStatus:{...this.#e.sectionStatus,[t]:"done"}})}failSection(t,s){this.#t({...this.#e,sectionError:{...this.#e.sectionError,[t]:s},sectionStatus:{...this.#e.sectionStatus,[t]:"error"}})}#t(t){this.#e=t;for(const s of this.#s)try{s()}catch{}}}const We={error:0,warn:1},Bs=e=>!!e.acceptedRisk,lt=e=>{const t=[];if(e.sections.has("dependencies")){for(const s of e.outdated)t.push({entry:s,id:`outdated:${s.packageName}`,kind:"outdated",section:"dependencies",severity:"warn",subtitle:`${s.currentRange} → ${s.newRange} (${s.updateType})`,title:s.packageName});for(const s of e.duplicates)t.push({id:`duplicate:${s.name}`,kind:"duplicate",pkg:s,section:"dependencies",severity:"warn",subtitle:s.hint?`${String(s.versions.length)} versions installed — ${s.hint}`:`${String(s.versions.length)} versions installed`,title:s.name})}if(e.sections.has("security"))for(const s of e.outdated){if(s.vulnerabilities&&s.vulnerabilities.length>0){const a=s.vulnerabilities[0],n=Bs(s)?"warn":"error",o=s.vulnerabilities.length;t.push({entry:s,id:`vuln:${s.packageName}`,kind:"vulnerability",packageName:s.packageName,section:"security",severity:n,subtitle:o===1?`${a.severity} · ${a.id}`:`${String(o)} advisories · top: ${a.severity} ${a.id}`,title:s.packageName})}if(s.socketReport&&s.socketReport.alerts.length>0){const a=Math.round(s.socketReport.score.overall*100);t.push({entry:s,id:`socket:${s.packageName}`,kind:"socket",packageName:s.packageName,section:"security",severity:"warn",subtitle:`${String(s.socketReport.alerts.length)} alert${s.socketReport.alerts.length===1?"":"s"} · score ${String(a)}%`,title:s.packageName})}}if(e.sections.has("optimization"))for(const s of e.optimizations)t.push({entry:s,id:`opt:${s.packageName}`,kind:"optimization",section:"optimization",severity:"warn",subtitle:`${s.category} → ${s.replacement}`,title:s.packageName});if(e.sections.has("runtime"))for(const s of e.runtime)s.status==="warn"&&t.push({diagnostic:s,id:`runtime:${s.id}`,kind:"runtime",section:"runtime",severity:"warn",title:s.message});return t.sort((s,a)=>{if(s.section!==a.section){const n=["dependencies","security","optimization","runtime"];return n.indexOf(s.section)-n.indexOf(a.section)}return We[s.severity]-We[a.severity]}),t},ct={dependencies:"Dependencies",optimization:"Optimization",runtime:"Runtime",security:"Security"},Vs={error:"red",warn:"yellow"},Hs={error:"✖",warn:"⚠"},Us={error:" ERROR ",warn:" WARN "},Ws=({children:e,hint:t,message:s,severity:a,title:n})=>{const o=Vs[a];return i.jsxs(u,{borderColor:o,borderStyle:"single",flexDirection:"column",flexShrink:0,paddingX:1,children:[i.jsxs(u,{gap:1,children:[i.jsx(r,{backgroundColor:o,bold:!0,color:"black",children:Us[a]}),i.jsx(r,{bold:!0,color:o,children:Hs[a]}),i.jsx(r,{bold:!0,wrap:"truncate-end",children:n})]}),i.jsx(r,{wrap:"truncate-end",children:s}),t?i.jsx(r,{dimColor:!0,wrap:"truncate-end",children:t}):null,e]})},Ys={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},Gs={critical:"red",high:"red",low:"gray",medium:"yellow"},Ks={major:"red",minor:"yellow",patch:"green"},E=({children:e,label:t,width:s=14})=>i.jsxs(u,{children:[i.jsx(u,{width:s,children:i.jsxs(r,{dimColor:!0,children:[t,":"]})}),typeof e=="string"?i.jsx(r,{children:e}):e]}),ne=({children:e})=>i.jsx(u,{marginTop:1,children:i.jsx(r,{bold:!0,color:"white",children:e})}),qs=({finding:e})=>{const{entry:t}=e,s=Ks[t.updateType]??"white";return i.jsxs(u,{flexDirection:"column",children:[i.jsx(E,{label:"Current",children:t.currentRange}),i.jsxs(E,{label:"Target",children:[i.jsx(r,{children:t.newRange}),i.jsxs(r,{bold:!0,color:s,children:[" (",t.updateType,")"]})]}),i.jsx(E,{label:"Catalog",children:t.catalogName}),t.acceptedRisk?i.jsx(E,{label:"Risk ack",children:i.jsx(r,{dimColor:!0,children:t.acceptedRisk.reason??"(no reason recorded)"})}):null,i.jsx(ne,{children:"Action"}),i.jsxs(r,{dimColor:!0,children:["Run"," ",i.jsx(r,{bold:!0,color:"white",children:"vis update"})," ","to apply this change."]})]})},Js=({finding:e})=>i.jsxs(u,{flexDirection:"column",children:[i.jsx(E,{label:"Versions",children:i.jsx(r,{children:String(e.pkg.versions.length)})}),i.jsx(ne,{children:"Installed versions"}),e.pkg.versions.map(t=>i.jsxs(r,{children:[" · ",t]},t)),i.jsx(ne,{children:"Action"}),i.jsxs(r,{dimColor:!0,children:["Run"," ",i.jsx(r,{bold:!0,color:"white",children:"vis dedupe"})," ","to consolidate to a single resolution."]})]}),Xs=({finding:e})=>{const t=e.entry.vulnerabilities??[];return i.jsxs(u,{flexDirection:"column",children:[i.jsx(E,{label:"Package",children:e.packageName}),i.jsx(E,{label:"Current",children:e.entry.currentRange}),i.jsx(E,{label:"Advisories",children:String(t.length)}),e.entry.acceptedRisk?i.jsx(E,{label:"Risk ack",children:i.jsx(r,{dimColor:!0,children:e.entry.acceptedRisk.reason??"(no reason recorded)"})}):null,t.map(s=>{const a=Ys[s.severity]??"gray";return i.jsxs(u,{flexDirection:"column",marginTop:1,children:[i.jsxs(u,{children:[i.jsx(r,{bold:!0,color:a,children:s.severity}),i.jsx(r,{children:" "}),i.jsx(r,{children:s.id}),typeof s.cvssScore=="number"?i.jsxs(r,{dimColor:!0,children:[" · CVSS ",s.cvssScore.toFixed(1)]}):null]}),i.jsx(r,{wrap:"wrap",children:s.summary}),s.fixedVersions.length>0?i.jsxs(r,{dimColor:!0,children:["Fixed in: ",s.fixedVersions.join(", ")]}):null,s.aliases&&s.aliases.length>0?i.jsxs(r,{dimColor:!0,children:["Aliases: ",s.aliases.join(", ")]}):null]},s.id)})]})},Qs=({finding:e})=>{const t=e.entry.socketReport;if(!t)return i.jsx(r,{dimColor:!0,children:"No Socket report attached."});const s=Math.round(t.score.overall*100),a=Be(t.score.overall);return i.jsxs(u,{flexDirection:"column",children:[i.jsx(E,{label:"Package",children:e.packageName}),i.jsx(E,{label:"Overall",children:i.jsxs(r,{color:a,children:[String(s),"%"]})}),i.jsx(E,{label:"Alerts",children:String(t.alerts.length)}),e.entry.acceptedRisk?i.jsx(E,{label:"Risk ack",children:i.jsx(r,{dimColor:!0,children:e.entry.acceptedRisk.reason??"(no reason recorded)"})}):null,i.jsx(ne,{children:"Score breakdown"}),Object.entries(t.score).map(([n,o])=>{if(n==="overall")return null;const c=typeof o=="number"?o:0,h=Math.round(c*100),l=Be(c);return i.jsxs(u,{children:[i.jsx(u,{width:14,children:i.jsxs(r,{dimColor:!0,children:[n,":"]})}),i.jsxs(r,{color:l,children:[String(h),"%"]})]},n)}),i.jsx(ne,{children:"Alerts"}),t.alerts.map((n,o)=>{const c=Gs[n.severity]??"gray";return i.jsxs(u,{flexDirection:"column",marginBottom:1,children:[i.jsxs(u,{children:[i.jsx(r,{bold:!0,color:c,children:n.severity}),i.jsx(r,{children:" "}),i.jsx(r,{children:n.type})]}),n.props?i.jsx(r,{dimColor:!0,wrap:"wrap",children:JSON.stringify(n.props)}):null]},`${n.type}-${String(o)}`)})]})},Zs=({finding:e})=>{const{entry:t}=e;return i.jsxs(u,{flexDirection:"column",children:[i.jsx(E,{label:"Package",children:t.packageName}),i.jsx(E,{label:"Category",children:t.category}),i.jsx(E,{label:"Replacement",children:t.replacement}),t.overrideSpec?i.jsx(E,{label:"Override",children:t.overrideSpec}):null,i.jsx(E,{label:"Codemod",children:i.jsx(r,{color:t.hasCodemod?"green":"gray",children:t.hasCodemod?"available":"not available"})}),t.docUrl?i.jsx(E,{label:"Guide",children:i.jsx(r,{color:"cyan",underline:!0,children:t.docUrl})}):null,i.jsx(ne,{children:"Action"}),t.hasCodemod?i.jsxs(r,{dimColor:!0,children:["Run"," ",i.jsx(r,{bold:!0,color:"white",children:"vis optimize"})," ","to apply the codemod interactively."]}):t.overrideSpec?i.jsxs(r,{dimColor:!0,children:["Run"," ",i.jsx(r,{bold:!0,color:"white",children:"vis optimize"})," ","to install the package override."]}):t.docUrl?i.jsx(r,{dimColor:!0,children:"No automated codemod. Open the migration guide above for the recommended alternative and steps."}):i.jsx(r,{dimColor:!0,children:"No automated codemod. Consult the package's docs or the e18e module-replacements guide for an alternative."})]})},ei=({finding:e})=>{const{diagnostic:t}=e,s=t.status==="warn"?"yellow":t.status==="ok"?"green":"gray";return i.jsxs(u,{flexDirection:"column",children:[i.jsx(E,{label:"Check",children:t.id}),i.jsx(E,{label:"Status",children:i.jsx(r,{color:s,children:t.status})}),i.jsx(ne,{children:"Message"}),i.jsx(r,{wrap:"wrap",children:t.message}),t.detail&&Object.keys(t.detail).length>0?i.jsxs(i.Fragment,{children:[i.jsx(ne,{children:"Details"}),Object.entries(t.detail).map(([a,n])=>i.jsxs(u,{children:[i.jsx(u,{width:20,children:i.jsxs(r,{dimColor:!0,children:[a,":"]})}),i.jsx(r,{children:String(n)})]},a))]}):null]})},ti=({finding:e,focused:t,scrollRef:s})=>{const a=t?"white":"gray";if(!e)return i.jsx(u,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:i.jsx(r,{dimColor:!0,children:"No finding selected"})});let n;switch(e.kind){case"duplicate":{n=i.jsx(Js,{finding:e});break}case"optimization":{n=i.jsx(Zs,{finding:e});break}case"outdated":{n=i.jsx(qs,{finding:e});break}case"runtime":{n=i.jsx(ei,{finding:e});break}case"socket":{n=i.jsx(Qs,{finding:e});break}case"vulnerability":{n=i.jsx(Xs,{finding:e});break}default:{n=i.jsx(r,{dimColor:!0,children:"Unknown finding kind."});break}}return i.jsxs(u,{borderColor:a,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[i.jsxs(u,{flexShrink:0,paddingTop:1,paddingX:2,children:[i.jsx(r,{bold:!0,color:"white",children:e.title}),i.jsxs(r,{dimColor:!0,children:[" ",ct[e.section]]})]}),i.jsxs(jt,{flexGrow:1,flexShrink:1,paddingX:2,ref:s,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[i.jsx(r,{}),n]})]})},dt={error:"red",warn:"yellow"},si={error:"✖",warn:"⚠"},ii=e=>e.kind==="outdated"||e.kind==="vulnerability"||e.kind==="socket"?!!e.entry.acceptedRisk:!1,ni=({finding:e,isSelected:t})=>{const s=dt[e.severity],a=ii(e);return i.jsxs(u,{flexShrink:0,height:1,children:[i.jsx(r,{children:t?">":" "}),i.jsxs(r,{color:s,children:[" ",si[e.severity]," "]}),i.jsx(u,{flexGrow:1,children:i.jsx(r,{bold:t,inverse:t,wrap:"truncate",children:e.title})}),a?i.jsx(r,{color:"cyan",children:" ack"}):null,e.subtitle?i.jsxs(r,{dimColor:!0,wrap:"truncate",children:[" ",e.subtitle]}):null]})},ri=({count:e,section:t})=>i.jsxs(u,{flexShrink:0,height:1,marginTop:1,children:[i.jsx(r,{dimColor:!0,children:"▼ "}),i.jsx(r,{bold:!0,color:"white",children:ct[t].toUpperCase()}),i.jsxs(r,{dimColor:!0,children:[" (",e,")"]})]}),oi=({count:e,label:t,status:s})=>{const a=s==="running";return i.jsxs(r,{children:[t,a?i.jsxs(r,{children:[" ",i.jsx(it,{type:"dots"})]}):null,s==="error"?i.jsx(r,{bold:!0,color:"red",children:" ✖"}):i.jsxs(r,{dimColor:!0,children:[" (",String(e),")"]})]})},ai=({elapsedMs:e,entries:t,filterActive:s,filterText:a,filterType:n,focused:o,fromCache:c=!1,grouped:h,onViewportHeightChange:l,scrollOffset:p,sectionCounts:g,sectionMessage:S,sectionStatus:y,selectedIndex:R,severityFilter:v,totalAll:m,viewportHeight:A})=>{const T=o?"white":"gray",{measuredHeight:D,ref:I}=ss(A,l);let C=0,_=0;for(const b of t)b.severity==="error"?C+=1:b.severity==="warn"&&(_+=1);const Y=[];C>0&&Y.push(`${String(C)} error${C===1?"":"s"}`),_>0&&Y.push(`${String(_)} warn${_===1?"":"s"}`);const ee=Y.length>0?` (${Y.join(", ")})`:"",te=(e/1e3).toFixed(1),G=[];for(const[b,$]of h){G.push(i.jsx(ri,{count:$.length,section:b},`hdr-${b}`));for(const V of $){const N=t.indexOf(V);G.push(i.jsx(ni,{finding:V,isSelected:N===R},V.id))}}let J=0;for(const[,b]of h)J+=2+b.length;const B=J>D&&D>0;return i.jsxs(u,{borderColor:T,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[i.jsxs(u,{flexShrink:0,gap:1,paddingX:1,children:[i.jsx(r,{bold:!0,inverse:!0,children:" DOCTOR "}),i.jsxs(r,{wrap:"truncate",children:[t.length,t.length===m?"":`/${String(m)}`," finding",t.length===1?"":"s",ee]}),v?i.jsx(r,{bold:!0,color:dt[v],inverse:!0,children:` ${v.toUpperCase()} ONLY `}):null,c?i.jsx(r,{bold:!0,color:"cyan",inverse:!0,children:" CACHED "}):null,i.jsxs(r,{dimColor:!0,children:[" · ",te,"s"]})]}),i.jsx(u,{flexShrink:0,paddingX:1,paddingY:1,children:i.jsx(es,{isFocused:o,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:()=>{},showIndex:!1,value:n,children:me.map(({id:b,label:$})=>i.jsx(ts,{name:b,children:i.jsx(oi,{count:g[b],label:$,status:y[b]})},b))})}),(()=>{const b=Object.keys(y).filter($=>y[$]==="running"&&S[$]).map($=>S[$]);return b.length===0?null:i.jsx(u,{flexShrink:0,paddingX:1,children:i.jsxs(r,{dimColor:!0,wrap:"truncate",children:[i.jsx(it,{type:"dots"})," ",b.join(" · ")]})})})(),s&&i.jsxs(u,{flexShrink:0,paddingX:1,children:[i.jsx(r,{bold:!0,color:"white",children:"/ "}),i.jsx(r,{children:a}),i.jsx(r,{inverse:!0,children:" "})]}),i.jsxs(u,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:I,children:[i.jsx(u,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:i.jsx(u,{flexDirection:"column",marginTop:-p,children:G.length>0?G:i.jsx(u,{marginTop:1,children:i.jsx(r,{dimColor:!0,children:"No findings match the current filter."})})})}),B&&i.jsx(u,{flexShrink:0,marginLeft:1,marginRight:1,children:i.jsx(St,{contentHeight:J,placement:"inset",scrollOffset:p,style:"block",viewportHeight:D})})]},`list-${n}-${a}`)]})},li=e=>{if(e.kind==="outdated")return{command:`vis update ${e.entry.packageName}`,description:`Update ${e.entry.packageName} to ${e.entry.newRange}`};if(e.kind==="duplicate")return{command:`vis dedupe ${e.pkg.name}`,description:`Dedupe ${e.pkg.name} (${String(e.pkg.versions.length)} versions)`}},ci=e=>{if(e.kind==="optimization")return{command:`vis optimize ${e.entry.packageName}`,description:`Replace ${e.entry.packageName} with ${e.entry.replacement}`}},di=e=>{if(e.kind!=="outdated"&&e.kind!=="vulnerability"&&e.kind!=="socket")return;const t=e.kind==="outdated"?e.entry.packageName:e.packageName,s=["// Add to vis.config.ts:","security: {"," acceptedRisks: {",` "${t}": {`,' reason: "explain why this risk is acceptable",',' expiresAt: "YYYY-MM-DD",'," },"," },","},"].join(`
|
|
3
3
|
`);return{command:s,configSnippet:s,description:`Acknowledge risk for ${t}`}},ui=100,hi=40,pi=10,fi=({autoExitSeconds:e=0,banner:t,fromCache:s=!1,startedAt:a,store:n})=>{const{exit:o}=Ct(),{columns:c,rows:h}=$t(),l=L.useSyncExternalStore(n.subscribe,n.getSnapshot),[p,g]=L.useState(!1),[S,y]=L.useState(!1),[R,v]=L.useState(0),[m,A]=L.useState(()=>Date.now());L.useEffect(()=>{const w=setInterval(()=>{A(Date.now())},1e3);return()=>{clearInterval(w)}},[]);const T=m-a,D=L.useRef(null),I=L.useRef(null),C=l.entries[l.selectedIndex]??null,_=L.useMemo(()=>{const w={dependencies:0,optimization:0,runtime:0,security:0};for(const x of l.all)w[x.section]+=1;return w},[l.all]),Y=t?t.hint?5:4:0,ee=L.useMemo(()=>{for(const w of Object.keys(l.sectionStatus))if(l.sectionStatus[w]==="running"&&l.sectionMessage[w])return 1;return 0},[l.sectionStatus,l.sectionMessage]),te=c>=ui,G=te?Math.max(1,h-Y-2):Math.floor(h*.55),J=Math.max(1,G-6-ee-(l.filterActive?1:0)),[B,b]=L.useState(J),$=B>0?B:J,V=L.useMemo(()=>{let w=0;for(const[,x]of l.grouped)w+=2+x.length;return w},[l.grouped]),N=Math.max(0,V-$),oe=Math.min(R,N),z=L.useCallback(w=>{let x=0,k=0;for(const[,xe]of l.grouped){x+=2;for(let he=0;he<xe.length;he++){if(k===w)return x;x+=1,k+=1}}return x},[l.grouped]),X=L.useCallback(w=>{const x=z(w);v(k=>x>k+$-2?Math.min(N,Math.max(0,x-$+2)):x<k+1?Math.max(0,x-1):k)},[z,$,N]);if(L.useEffect(()=>{I.current?.scrollToTop()},[C?.id]),Et((w,x)=>{if(w==="c"&&x.ctrl){o();return}if(!S){if(p){x.escape||w==="?"?g(!1):w==="q"?(g(!1),y(!0)):x.downArrow||w==="j"?D.current?.scrollBy(1):(x.upArrow||w==="k")&&D.current?.scrollBy(-1);return}if(w==="?"){g(!0);return}if(w==="q"){y(!0);return}if(x.tab){n.setFocusedPanel(l.focusedPanel==="list"?"detail":"list");return}if(l.filterActive){if(x.escape||x.return){n.setFilterActive(!1);return}if(x.backspace){v(0),n.setFilter(l.filterText.slice(0,-1));return}w&&!x.ctrl&&!x.meta&&(v(0),n.setFilter(l.filterText+w));return}if(l.focusedPanel==="list"&&(x.leftArrow||x.rightArrow)){const k=me.findIndex(he=>he.id===l.filterType),xe=x.rightArrow?(k+1)%me.length:(k-1+me.length)%me.length;v(0),I.current?.scrollToTop(),n.setFilterType(me[xe].id);return}if(l.focusedPanel==="list"){if(x.downArrow||w==="j"){const k=Math.min(l.selectedIndex+1,l.entries.length-1);n.setSelectedIndex(k),X(k);return}if(x.upArrow||w==="k"){const k=Math.max(l.selectedIndex-1,0);n.setSelectedIndex(k),X(k);return}if(x.pageDown){const k=Math.min(l.selectedIndex+10,l.entries.length-1);n.setSelectedIndex(k),X(k);return}if(x.pageUp){const k=Math.max(l.selectedIndex-10,0);n.setSelectedIndex(k),X(k);return}if(x.home){n.setSelectedIndex(0),v(0);return}if(x.end){const k=l.entries.length-1;n.setSelectedIndex(k),X(k);return}if(w==="/"){n.setFilterActive(!0);return}if(w==="e"){n.setSeverityFilter(l.severityFilter==="error"?void 0:"error"),v(0);return}if(w==="w"){n.setSeverityFilter(l.severityFilter==="warn"?void 0:"warn"),v(0);return}if(w==="u"&&C){const k=li(C);k&&(n.setPendingAction(k),o());return}if(w==="o"&&C){const k=ci(C);k&&(n.setPendingAction(k),o());return}if(w==="a"&&C){const k=di(C);k&&(n.setPendingAction(k),o());return}if(w==="d"){n.setFocusedPanel("detail");return}return}if(x.escape||x.leftArrow){n.setFocusedPanel("list");return}if(x.downArrow||w==="j"){I.current?.scrollBy(1);return}if(x.upArrow||w==="k"){I.current?.scrollBy(-1);return}if(x.pageDown){I.current?.scrollBy(10);return}if(x.pageUp){I.current?.scrollBy(-10);return}if(x.home){I.current?.scrollToTop();return}x.end&&I.current?.scrollToBottom()}},{isActive:!0}),c<hi||h<pi)return i.jsx(u,{alignItems:"center",height:h,justifyContent:"center",width:c,children:i.jsxs(r,{color:"yellow",children:["Terminal too small (",c,"x",h,")"]})});const le=l.focusedPanel==="detail",P=[i.jsxs(u,{gap:1,children:[i.jsx(r,{bold:!0,color:"white",children:"q"}),i.jsx(r,{dimColor:!0,children:"QUIT"})]},"q"),i.jsxs(u,{gap:1,children:[i.jsx(r,{bold:!0,color:"white",children:"?"}),i.jsx(r,{dimColor:!0,children:"HELP"})]},"?"),i.jsxs(u,{gap:1,children:[i.jsx(r,{bold:!0,color:"white",children:"↑↓"}),i.jsx(r,{dimColor:!0,children:le?"SCROLL":"NAV"})]},"nav"),le?i.jsxs(u,{gap:1,children:[i.jsx(r,{bold:!0,color:"white",children:"←/Esc"}),i.jsx(r,{dimColor:!0,children:"LIST"})]},"lr"):i.jsxs(u,{gap:1,children:[i.jsx(r,{bold:!0,color:"white",children:"←→"}),i.jsx(r,{dimColor:!0,children:"SECTION"})]},"lr"),i.jsxs(u,{gap:1,children:[i.jsx(r,{bold:!0,color:"white",children:"/"}),i.jsx(r,{dimColor:!0,children:"SEARCH"})]},"search"),i.jsxs(u,{gap:1,children:[i.jsx(r,{bold:!0,color:"white",children:"e/w"}),i.jsx(r,{dimColor:!0,children:"SEVERITY"})]},"sev"),i.jsxs(u,{gap:1,children:[i.jsx(r,{bold:!0,color:"white",children:"u/o/a"}),i.jsx(r,{dimColor:!0,children:"ACTION"})]},"actions"),i.jsxs(u,{gap:1,children:[i.jsx(r,{bold:!0,color:"white",children:"Tab"}),i.jsx(r,{dimColor:!0,children:"PANEL"})]},"tab")],H=i.jsx(u,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:i.jsx(u,{gap:2,overflow:"hidden",paddingX:1,children:P})}),K=i.jsxs(Rt,{footer:i.jsxs(r,{dimColor:!0,children:[i.jsx(r,{bold:!0,color:"white",children:"↑↓"})," scroll ",i.jsx(r,{bold:!0,color:"white",children:"?"}),"/",i.jsx(r,{bold:!0,color:"white",children:"Esc"})," close"]}),scrollRef:D,title:"DOCTOR — KEYBOARD SHORTCUTS",visible:p,width:56,children:[i.jsxs(u,{flexDirection:"column",marginBottom:1,children:[i.jsxs(u,{marginBottom:1,children:[i.jsx(r,{dimColor:!0,children:"── "}),i.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),i.jsxs(u,{children:[i.jsx(u,{width:26,children:i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" ↑/k "}),i.jsx(r,{dimColor:!0,children:"Move up"})]})}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" ↓/j "}),i.jsx(r,{dimColor:!0,children:"Move down"})]})]}),i.jsxs(u,{children:[i.jsx(u,{width:26,children:i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" PgUp"}),i.jsx(r,{dimColor:!0,children:" Jump up 10"})]})}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" PgDn"}),i.jsx(r,{dimColor:!0,children:" Jump down 10"})]})]}),i.jsxs(u,{children:[i.jsx(u,{width:26,children:i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" Home"}),i.jsx(r,{dimColor:!0,children:" Jump to top"})]})}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" End"}),i.jsx(r,{dimColor:!0,children:" Jump to bottom"})]})]}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" Tab"}),i.jsx(r,{dimColor:!0,children:" Switch panel"})]}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" →/←"}),i.jsx(r,{dimColor:!0,children:" Section tabs (list) / Focus list (detail)"})]})]}),i.jsxs(u,{flexDirection:"column",marginBottom:1,children:[i.jsxs(u,{marginBottom:1,children:[i.jsx(r,{dimColor:!0,children:"── "}),i.jsx(r,{bold:!0,color:"white",children:"FILTER"})]}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" /"}),i.jsx(r,{dimColor:!0,children:" Open text filter (Esc/Enter to close)"})]}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" e"}),i.jsx(r,{dimColor:!0,children:" Toggle errors-only filter"})]}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" w"}),i.jsx(r,{dimColor:!0,children:" Toggle warns-only filter"})]})]}),i.jsxs(u,{flexDirection:"column",marginBottom:1,children:[i.jsxs(u,{marginBottom:1,children:[i.jsx(r,{dimColor:!0,children:"── "}),i.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" u"}),i.jsx(r,{dimColor:!0,children:" Exit + suggest update / dedupe command"})]}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" o"}),i.jsx(r,{dimColor:!0,children:" Exit + suggest optimize command"})]}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" a"}),i.jsx(r,{dimColor:!0,children:" Exit + print risk-ack snippet"})]}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" d"}),i.jsx(r,{dimColor:!0,children:" Focus detail panel"})]})]}),i.jsxs(u,{flexDirection:"column",children:[i.jsxs(u,{marginBottom:1,children:[i.jsx(r,{dimColor:!0,children:"── "}),i.jsx(r,{bold:!0,color:"white",children:"EXIT"})]}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" q"}),i.jsx(r,{dimColor:!0,children:" Quit (with countdown)"})]}),i.jsxs(r,{children:[i.jsx(r,{bold:!0,color:"white",children:" Ctrl+C"}),i.jsx(r,{dimColor:!0,children:" Quit immediately"})]})]})]}),ce=i.jsx(ai,{elapsedMs:T,entries:l.entries,filterActive:l.filterActive,filterText:l.filterText,filterType:l.filterType,focused:l.focusedPanel==="list",fromCache:s,grouped:l.grouped,onViewportHeightChange:b,scrollOffset:oe,sectionCounts:_,sectionMessage:l.sectionMessage,sectionStatus:l.sectionStatus,selectedIndex:l.selectedIndex,severityFilter:l.severityFilter,totalAll:l.all.length,viewportHeight:$}),de=t?i.jsx(Ws,{hint:t.hint,message:t.message,severity:t.severity,title:t.title}):null,ue=i.jsx(ti,{finding:C,focused:l.focusedPanel==="detail",scrollRef:I});if(te){const w=Math.floor(c*.4);return i.jsxs(u,{flexDirection:"column",height:h,width:c,children:[de,i.jsxs(u,{flexDirection:"row",flexGrow:1,children:[i.jsx(u,{flexGrow:1,children:ce}),i.jsx(u,{width:w,children:ue})]}),H,i.jsx(Le,{autoExitSeconds:e||3,onCancel:()=>{y(!1)},visible:S}),K]})}return i.jsxs(u,{flexDirection:"column",height:h,width:c,children:[de,i.jsx(u,{height:G,children:ce}),i.jsx(u,{flexGrow:1,children:ue}),H,i.jsx(Le,{autoExitSeconds:e||3,onCancel:()=>{y(!1)},visible:S}),K]})},mi=8,gi=Te([...ds,...us,...hs,...fs,...Object.keys(ms),"VIS_*"]),xi=/(?<![\w%])%([A-Z_]\w+)%(?![\w%])/gi,wi=e=>[...new Set([...e.matchAll(xi)].map(t=>t[1]))],ki=(e,t)=>{const s=new Set(as(e)),a=new Set(wi(e)),n=[];for(const o of new Set([...s,...a]))t.excluded(o)||!t.visible(o)||t.exact.has(o)||t.coveredByPattern(o)||(a.has(o)||s.has(o)&&!t.autoEnvVars)&&n.push({name:o,shellOnly:!a.has(o)});return n},ut=(e,t,s=new Set)=>{const a=[];for(const n of e)if(typeof n=="string")if(ls(n)){let o;try{o=cs(n)}catch{continue}o&&"env"in o&&a.push(o.env)}else t[n]&&!s.has(n)&&(s.add(n),a.push(...ut(t[n],t,s)));else typeof n=="object"&&n!==null&&"env"in n&&typeof n.env=="string"&&a.push(n.env);return a},vi=async e=>(await os(e)).flatMap(s=>s.envPrefixes.map(a=>`${a}*`)),yi=e=>e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`,bi=e=>{const t=e.total-e.variables.length,s=t>0?` (+${String(t)} more)`:"";return`${e.target}: ${e.variables.join(", ")}${s}. fix: ${yi(e.hints)}`},ji=e=>e.targets.map(t=>bi(t)),Si=(e,t)=>{const s=["fingerprintEnv"];return t.some(a=>a.shellOnly)&&s.push("autoEnvVars"),s.push("untrackedEnv"),{hints:s,target:e,total:t.length,variables:t.map(a=>a.name).toSorted().slice(0,mi)}},Ci=async(e,t)=>{const s=e.taskRunner??{},a=[];if(s.autoFingerprint===!0)return{status:"ok",targets:a};if(Ne(t).length===0)return{status:"ok",targets:a};const{projectOptions:n,workspace:o}=It(t,e,await Nt(t,e)),c=[...s.envVars??[],...s.globalEnv??[]],h=[...ns,...s.untrackedEnvVars??[]],l=e.namedInputs??{};for(const[p,g]of n){const S=o.projects[p];if(!S)continue;const y=s.frameworkInference?await vi(W(t,S.root,"package.json")):[];for(const[R,v]of Object.entries(g)){if(v.hashMode==="trace"||v.cache===!1||v.always===!0)continue;const m=v.command??s.targetDefaults?.[R]?.command;if(typeof m!="string"||m.length===0)continue;const A=v.inputs??s.targetDefaults?.[R]?.inputs??[],T=rs(s.env,v.options?.env),D=Te([...h,...v.untrackedEnv??[]]),I=ki(m,{autoEnvVars:s.autoEnvVars===!0,coveredByPattern:Te([...v.fingerprintEnv??[],...y]),exact:new Set([...c,...ut(A,l)]),excluded:C=>gi(C)||D(C),visible:T.mode==="clean"?ps(T.allow):()=>!0});I.length>0&&a.push(Si(`${p}:${R}`,I))}}return a.sort((p,g)=>p.target.localeCompare(g.target)),{status:a.length>0?"warn":"ok",targets:a}},$i=e=>e.replaceAll(/[$()+.?[\\\]^{|}]/g,String.raw`\$&`),Ei=e=>{const t=e.split("*").map(s=>$i(s));return new RegExp(`^${t.join(".*")}$`,"i")},Ri=e=>e?e.split(",").map(t=>t.trim()).filter(t=>t.length>0).map(t=>Ei(t)):[],Ce=(e,t)=>{for(const s of t)if(s.test(e))return!0;return!1},Ai=(e,t,s)=>{if(t.length===0)return e;const a=e.outdated.filter(p=>Ce(p.packageName,t)),n=e.duplicates.filter(p=>Ce(p.name,t)),o=e.optimizations.filter(p=>Ce(p.packageName,t));let c=0,h=0,l=0;for(const p of a)p.vulnerabilities&&(c+=p.vulnerabilities.length),p.socketReport&&(h+=p.socketReport.alerts.length,p.socketReport.score.overall<s&&(l+=1));return{...e,duplicates:n,optimizations:o,outdated:a,socketIssues:{alerts:h,lowScore:l},vulnCount:c}},ht=(e,t)=>t.length===0?[...e]:e.filter(s=>{if(s.kind==="runtime")return!0;const a=s.kind==="duplicate"?s.pkg.name:s.kind==="outdated"||s.kind==="optimization"?s.entry.packageName:s.packageName;return Ce(a,t)}),pt=["dependencies","security","optimization","runtime"],Ye=e=>{const t=new Set;if(!e)return t;for(const s of e.split(",")){const a=s.trim().toLowerCase();pt.includes(a)&&t.add(a)}return t},Ti=(e,t)=>{if(e!==void 0&&e!=="")return Ye(e);const s=Ye(t);return new Set(pt.filter(a=>!s.has(a)))},ft=e=>{const t={micro:0,native:0,preferred:0,socket:0,total:e.length};for(const s of e)switch(s.category){case"micro-utility":{t.micro+=1;break}case"native":{t.native+=1;break}case"preferred":{t.preferred+=1;break}case"socket":{t.socket+=1;break}}return t},ie=(e,t)=>{if(!e.sections.has(t))return"skip";switch(t){case"dependencies":return e.outdated.length>0||e.duplicates.length>0?"warn":"ok";case"optimization":return e.optimizations.length>0?"warn":"ok";case"runtime":return e.runtime.some(s=>s.status==="warn")?"warn":"ok";case"security":return e.vulnCount>0||e.socketIssues.alerts>0?"error":e.socketIssues.lowScore>0?"warn":"ok";default:return"ok"}},Ii=(e,t)=>{const s=ft(e.optimizations),a={dependencies:ie(e,"dependencies"),optimization:ie(e,"optimization"),runtime:ie(e,"runtime"),security:ie(e,"security")},n=new Set([...Object.values(a),e.envCoverage.status,e.supplyChain.status]),o=n.has("error")?"error":n.has("warn")?"warn":"ok";return{dependencies:{duplicates:e.duplicates.length,installed:e.installedCount,outdated:e.outdated.length,status:a.dependencies},elapsedMs:e.elapsedMs,...e.envCoverage.targets.length>0?{envCoverage:{status:e.envCoverage.status,targets:e.envCoverage.targets.map(c=>({hints:c.hints,target:c.target,total:c.total,variables:c.variables}))}}:{},optimizations:{microUtilities:s.micro,native:s.native,preferred:s.preferred,socket:s.socket,status:a.optimization,total:s.total},packageManager:t,runtime:e.runtime.map(c=>({detail:c.detail,id:c.id,message:c.message,status:c.status})),runtimeStatus:a.runtime,security:{alerts:e.socketIssues.alerts,lowScorePackages:e.socketIssues.lowScore,status:a.security,vulnerabilities:e.vulnCount},status:o,supplyChain:{findings:e.supplyChain.findings.map(c=>({detail:c.detail,label:c.label,severity:c.severity})),status:e.supplyChain.status},workspaces:e.workspaceCount}},Ge=(e,t)=>{const s=e.runtime.some(n=>n.status==="warn"),a=e.vulnCount>0||e.socketIssues.alerts>0;return t?a||e.outdated.length>0||e.duplicates.length>0||s||e.envCoverage.targets.length>0:a},Ni=["aube-workspace.yaml","pnpm-workspace.yaml"],ke=e=>typeof e=="boolean"?e:void 0,Pi=e=>{if(e==="no-downgrade"||e==="off")return e},Oi=e=>{const t={allowBuildsCount:0,blockExoticSubdeps:void 0,jailBuilds:void 0,minimumReleaseAge:void 0,minimumReleaseAgeStrict:void 0,paranoid:void 0,source:void 0,strictDepBuilds:void 0,trustPolicy:void 0};for(const s of Ni){const a=W(e,s);if(!be(a))continue;let n;try{n=gs(yt(a))}catch{continue}if(typeof n!="object"||n===null)continue;const o=n;return t.source=s,t.paranoid=ke(o.paranoid),t.trustPolicy=Pi(o.trustPolicy),t.blockExoticSubdeps=ke(o.blockExoticSubdeps),t.jailBuilds=ke(o.jailBuilds),t.strictDepBuilds=ke(o.strictDepBuilds),t.minimumReleaseAgeStrict=ke(o.minimumReleaseAgeStrict),typeof o.minimumReleaseAge=="number"&&Number.isFinite(o.minimumReleaseAge)&&(t.minimumReleaseAge=o.minimumReleaseAge),o.allowBuilds&&typeof o.allowBuilds=="object"&&!Array.isArray(o.allowBuilds)&&(t.allowBuildsCount=Object.keys(o.allowBuilds).length),t}return t},Di=e=>e.paranoid?{...e,jailBuilds:!0,minimumReleaseAgeStrict:!0,strictDepBuilds:!0,trustPolicy:"no-downgrade"}:e,Mi=/^(@[\w./-]+\/[\w./-]+|[\w.-]+)@(.+)$/,Fi=e=>{const t=Mi.exec(e);if(t)return{name:t[1],version:t[2]}},_i=(e,t)=>{let s;try{if(t==="pnpm"){const n=W(e,"pnpm-workspace.yaml");be(n)&&(s=xs(n)?.patchedDependencies)}else if(t==="bun"){const n=W(e,"package.json");be(n)&&(s=tt(n)?.patchedDependencies)}}catch{return[]}if(!s||typeof s!="object")return[];const a=[];for(const[n,o]of Object.entries(s)){if(typeof o!="string"||o.length===0)continue;const c=Fi(n);c&&a.push({name:c.name,patchFile:o,resolvedPatchFile:bt(o)?o:Xe(e,o),version:c.version})}return a},Li=e=>{const t=[];for(const s of e)be(s.resolvedPatchFile)||t.push({entry:s,kind:"missing-file"});return t},Ke=e=>e.some(t=>t.severity==="error")?"error":e.some(t=>t.severity==="warn")?"warn":"ok",zi=(e,t={})=>{const s=[],a=e?.security;if(!a)return s.push({detail:"Use defineConfig() from '@visulima/vis/config' to apply secure defaults.",label:"No security config — running with the PM's native defaults",severity:"warn"}),{findings:s,status:Ke(s)};const n=a.policies?.firstSeen?.minutes,o=a.policies?.publisherChange,c=a.policies?.installScripts;n===void 0?s.push({detail:"Set security.policies.firstSeen.minutes to block packages published in the last N minutes (mitigates supply-chain attacks).",label:"policies.firstSeen.minutes is not set",severity:"warn"}):n===0?s.push({detail:"New packages can be installed immediately after publishing. Consider setting a non-zero cooldown.",label:"policies.firstSeen.minutes is explicitly 0",severity:"warn"}):s.push({label:`policies.firstSeen.minutes: ${String(n)} minutes`,severity:"ok"}),o?.mode===void 0||o.mode==="off"?s.push({detail:"Packages whose trust level has decreased will not be blocked. Consider 'no-downgrade'.",label:`policies.publisherChange.mode: ${o?.mode??"not set"}`,severity:"warn"}):s.push({label:`policies.publisherChange.mode: ${o.mode}`,severity:"ok"}),a.blockExoticSubdeps===void 0||!a.blockExoticSubdeps?s.push({detail:"Transitive dependencies can pull code from git repos or tarball URLs. Set to true to block.",label:`blockExoticSubdeps: ${String(a.blockExoticSubdeps??!1)}`,severity:"warn"}):s.push({label:"blockExoticSubdeps: true",severity:"ok"});const h=c?.allow?Object.keys(c.allow).length:0;if(h===0?s.push({detail:"Lifecycle scripts are blocked by default. List trusted packages here to opt them back in (e.g. esbuild, @prisma/client).",label:"policies.installScripts.allow: not configured",severity:"warn"}):s.push({label:`policies.installScripts.allow: ${String(h)} ${h===1?"entry":"entries"}`,severity:"ok"}),c?.strict&&h===0&&s.push({detail:"All dependencies with build scripts will be blocked. Run 'vis approve-builds' to populate the allow list.",label:"policies.installScripts.strict is on but allow is empty",severity:"error"}),t.workspaceRoot){const l=ws(t.workspaceRoot);if(l.length>0){const p=[...new Set(l.map(g=>g.tool))].sort((g,S)=>g.localeCompare(S)).join(", ");s.push({detail:"Run `vis migrate verify` for the full list, then re-run `vis migrate <tool>` to clean up.",label:`${String(l.length)} leftover ${l.length===1?"reference":"references"} to ${p}`,severity:"warn"})}}if(t.workspaceRoot&&t.packageManager==="aube"){const l=Oi(t.workspaceRoot),p=Di(l),g=p.source?` (from ${p.source})`:"";p.paranoid===!0&&s.push({detail:"Forces jailBuilds, trustPolicy=no-downgrade, minimumReleaseAgeStrict, strictStoreIntegrity, and strictDepBuilds on.",label:`aube paranoid: true${g}`,severity:"ok"}),p.trustPolicy==="off"&&s.push({detail:"Trust downgrades between releases will not be blocked. Set trustPolicy: no-downgrade in aube-workspace.yaml.",label:`aube trustPolicy: off${g}`,severity:"warn"}),p.blockExoticSubdeps===!1&&s.push({detail:"Transitive deps from git+, file:, and tarball URLs will not be blocked. Re-enable with blockExoticSubdeps: true.",label:`aube blockExoticSubdeps: false${g}`,severity:"warn"}),p.minimumReleaseAge===0&&s.push({detail:"Newly published versions are not held in a cooling window. Restore with minimumReleaseAge: 1440 (24h) or higher.",label:`aube minimumReleaseAge: 0${g}`,severity:"warn"}),p.jailBuilds===!0&&s.push({label:`aube jailBuilds: true${g}`,severity:"ok"}),p.strictDepBuilds===!0&&s.push({label:`aube strictDepBuilds: true${g}`,severity:"ok"}),p.allowBuildsCount>0&&s.push({label:`aube allowBuilds: ${String(p.allowBuildsCount)} ${p.allowBuildsCount===1?"entry":"entries"}${g}`,severity:"ok"})}if(t.workspaceRoot&&t.packageManager){const l=_i(t.workspaceRoot,t.packageManager);if(l.length>0){const p=Li(l);if(p.length===0)s.push({label:`patchedDependencies: ${String(l.length)} ${l.length===1?"entry":"entries"} resolved`,severity:"ok"});else for(const g of p)s.push({detail:`Referenced from ${t.packageManager==="pnpm"?"pnpm-workspace.yaml":"package.json"} but the file is not present at ${g.entry.patchFile}.`,label:`patchedDependencies: missing patch file for ${g.entry.name}@${g.entry.version}`,severity:"error"})}}return{findings:s,status:Ke(s)}},U=e=>e>=1e3?`${(e/1e3).toFixed(1)}s`:`${String(Math.round(e))}ms`,je=async(e,t,s,a)=>{if(!e)return s();e.start(t);const n=Date.now();try{const o=await s(),c=Date.now()-n,{status:h,summary:l}=a(o,c);return e.finish(t,h,l),o}catch(o){const c=Date.now()-n,h=o instanceof Error?o.message:String(o);throw e.finish(t,"error",`${h} (${U(c)})`),o}},Bi=(e,t)=>{const s={duplicates:t.duplicates,optimizations:t.optimizations,outdated:t.outdated,runtime:t.runtime,sections:new Set([e])};return lt(s)},qe=async e=>{const{filterPatterns:t,installed:s,progress:a,resolveCodemods:n,sections:o,store:c,visConfig:h,workspaceRoot:l}=e,p=o.has("dependencies"),g=o.has("security"),S=o.has("optimization"),y=o.has("runtime"),R=(f,M)=>ht(Bi(f,M),t),v=st(l),m=v.name,A=Ve(W(l,"package.json"),!1),T=Ne(l),D=new Set(A);for(const f of T){const M=Ve(W(Xe(l,f),"package.json"),!1);for(const F of M)D.add(F)}const I=ks(l),C=nt(l,m),_=Qe(h?.security,{minimumScore:h?.security?.policies?.score?.minimum}),Y=h?.security?.policies?.score?.minimum??et,ee=h?.security?.acceptedRisks,te=Bt(l,v.name),G={exclude:[],ignore:[],include:[],includeLocked:!1,includePrerelease:!1,security:!0,target:"latest"},J=p?Zt(l,v.name):[],B=S?Vt(D):[],b=S?Ht(D,te,v,!1):[],$=new Set(B.map(f=>f.packageName)),V=b.filter(f=>!$.has(f.packageName)),N=[...B,...V],oe=y?[...Ls(l),...Kt(l)]:[];c&&(p&&c.startSection("dependencies",C.size>0?"checking outdated catalog dependencies":"scanning duplicates"),g&&c.startSection("security",s.length>0?`scanning ${String(s.length)} packages for advisories`:"no installed packages to scan"),S&&c.startSection("optimization","matching e18e + socket overrides"),y&&c.startSection("runtime","running runtime diagnostics")),c&&y&&c.completeSection("runtime",R("runtime",{duplicates:[],optimizations:[],outdated:[],runtime:oe}));const X=(p||g)&&C.size>0?je(a,"outdated",()=>is(C,G,I,void 0,l,_,ee),(f,M)=>{const F=f.outdated.length;return{status:F>0?"warn":"ok",summary:F>0?`${String(F)} outdated · ${U(M)}`:`up to date · ${U(M)}`}}):Promise.resolve({checkedCount:0,failed:[],filteredByTarget:[],ignored:[],outdated:[]}),le=g&&s.length>0?je(a,"vulnerabilities",()=>vs(s.map(f=>({name:f.name,version:f.version}))),(f,M)=>{let F=0;for(const se of f.values())F+=se.length;return{status:F>0?"error":"ok",summary:F>0?`${String(F)} found · ${U(M)}`:`none found · ${U(M)}`}}):Promise.resolve(new Map),P=g&&_.length>0&&s.length>0?je(a,"socket",()=>Ot(_,s.map(f=>({name:f.name,version:f.version}))),(f,M)=>{let F=0,se=0;for(const _e of f.values())F+=_e.alerts.length,_e.score.overall<Y&&(se+=1);const Fe=F+se;return{status:Fe>0?"warn":"ok",summary:Fe>0?`${String(F)} alert${F===1?"":"s"}, ${String(se)} low-score · ${U(M)}`:`clean · ${U(M)}`}}):Promise.resolve(new Map);let H,K,ce,de;const ue=X.catch(f=>(H=f instanceof Error?f.message:String(f),c||d.warn(`Outdated scan failed: ${H}`),{failed:[],ignored:[],outdated:[]})),w=le.catch(f=>(K=f instanceof Error?f.message:String(f),c||d.warn(`Vulnerability scan failed: ${K}`),new Map)),x=P.catch(f=>(ce=f instanceof Error?f.message:String(f),c||d.warn(`Socket scan failed: ${ce}`),new Map)),k=c&&p?ue.then(f=>{if(H){c.failSection("dependencies",H);return}c.completeSection("dependencies",R("dependencies",{duplicates:J,optimizations:[],outdated:f.outdated,runtime:[]}))}):void 0,xe=c&&g?Promise.all([ue,w,x]).then(([f])=>{const M=H??K??ce;if(M){c.failSection("security",M);return}c.completeSection("security",R("security",{duplicates:[],optimizations:[],outdated:f.outdated,runtime:[]}))}):void 0,he=(async()=>{if(n&&S&&N.length>0&&await je(a,"codemods",async()=>(await Yt(N),N),(f,M)=>{const F=f.filter(se=>se.hasCodemod||se.category==="socket").length;return{status:"ok",summary:`${String(F)} auto-fixable · ${U(M)}`}}).catch(f=>{de=f instanceof Error?f.message:String(f)}),c&&S){if(de){c.failSection("optimization",de);return}c.completeSection("optimization",R("optimization",{duplicates:[],optimizations:N,outdated:[],runtime:[]}))}})(),[Oe,gt,xt]=await Promise.all([ue,w,x]);await Promise.all([k,xe,he]);let De=0,Me=0;if(g&&_.length>0)for(const f of xt.values())De+=f.alerts.length,f.score.overall<Y&&(Me+=1);let Ae=0;if(g){for(const f of Oe.outdated)f.vulnerabilities&&f.vulnerabilities.length>0&&(Ae+=f.vulnerabilities.length);for(const f of gt.values())Ae+=f.length}return{duplicates:J,installedCount:s.length,optimizations:S?N:[],outdated:p?Oe.outdated:[],runtime:oe,sections:o,socketIssues:{alerts:De,lowScore:Me},supplyChain:zi(h,{packageManager:m,workspaceRoot:l}),vulnCount:Ae,workspaceCount:T.length}},Vi=e=>{switch(e){case"error":return ye(O.failure);case"skip":return j(O.dash);case"warn":return Ee(O.warning);default:return ge(O.success)}},re=(e,t)=>{const s=process.stderr.columns??80,a=Math.max(20,Math.min(s-2,60)),n=O.dash.repeat(2),o=`${Vi(t)} ${ae(e)}`,c=o.replaceAll(/\[[0-9;]*m/g,"").length,h=Math.max(0,a-c-n.length-2);return`${n} ${o} ${j(O.dash.repeat(h))}`},Z=e=>` ${ge(O.success)} ${e}`,q=e=>` ${Ee(O.warning)} ${e}`,Pe=e=>` ${ye(O.failure)} ${e}`,mt=e=>` ${j(O.dash)} ${j(e)}`,Q=(e,t,s)=>{const a=`${ae(String(e))} ${j(t)}`;return s?`${a} ${j(`(${s})`)}`:a},Hi=e=>{if(e.sections.has("dependencies")){if(d.log(""),d.log(re("Dependencies",ie(e,"dependencies"))),d.log(Z(Q(e.installedCount,"packages installed"))),e.outdated.length>0){const t=e.outdated.filter(o=>o.updateType==="major").length,s=e.outdated.filter(o=>o.updateType==="minor").length,a=e.outdated.filter(o=>o.updateType==="patch").length,n=[];t>0&&n.push(`${String(t)} major`),s>0&&n.push(`${String(s)} minor`),a>0&&n.push(`${String(a)} patch`),d.log(q(Q(e.outdated.length,"outdated",n.join(", "))))}else d.log(Z("All dependencies up to date"));if(e.duplicates.length>0){d.log(q(Q(e.duplicates.length,"packages with duplicate versions")));for(const t of e.duplicates)t.hint&&d.log(` ${j(O.arrow)} ${t.hint}`)}else d.log(Z("No duplicate dependencies"))}},Ui=e=>{e.sections.has("security")&&(d.log(""),d.log(re("Security",ie(e,"security"))),e.vulnCount>0?d.log(Pe(Q(e.vulnCount,`vulnerabilit${e.vulnCount===1?"y":"ies"} found`))):d.log(Z("No known vulnerabilities")),e.socketIssues.alerts>0&&d.log(q(Q(e.socketIssues.alerts,`Socket.dev security alert${e.socketIssues.alerts===1?"":"s"}`))),e.socketIssues.lowScore>0&&d.log(q(Q(e.socketIssues.lowScore,`package${e.socketIssues.lowScore===1?"":"s"} with low security score`))),e.socketIssues.alerts===0&&e.socketIssues.lowScore===0&&e.vulnCount===0&&d.log(Z("No security issues detected")))},Wi=e=>{if(!e.sections.has("optimization"))return;d.log(""),d.log(re("Optimization",ie(e,"optimization")));const t=ft(e.optimizations);if(t.total===0){d.log(Z("No optimizations available"));return}t.native>0&&d.log(q(Q(t.native,"replaceable with native APIs"))),t.preferred>0&&d.log(q(Q(t.preferred,"with lighter alternatives"))),t.micro>0&&d.log(q(Q(t.micro,"trivial micro-utilities"))),t.socket>0&&d.log(q(Q(t.socket,"@socketregistry overrides available")))},Yi=e=>{d.log(""),d.log(re("Supply Chain",e.supplyChain.status));for(const t of e.supplyChain.findings){const s=t.severity==="ok"?Z(t.label):t.severity==="error"?Pe(t.label):q(t.label);d.log(s),t.detail&&d.log(` ${j(O.arrow)} ${j(t.detail)}`)}e.supplyChain.status!=="ok"&&d.log(` ${j(O.arrow)} ${j("Configure with security.* in vis.config.ts. See `vis check --security-config` for details.")}`)},Gi=e=>{const t=ji(e.envCoverage);if(t.length!==0){d.log(""),d.log(re("Env Coverage","warn"));for(const s of t)d.log(q(s))}},Ki=e=>{if(e.sections.has("runtime")){d.log(""),d.log(re("Runtime",ie(e,"runtime")));for(const t of e.runtime)t.status==="ok"?d.log(Z(t.message)):t.status==="skip"?d.log(mt(t.message)):d.log(q(t.message))}},qi=(e,t)=>{const s=e.vulnCount,a=e.runtime.filter(o=>o.status==="warn").length,n=e.outdated.length+e.duplicates.length+e.optimizations.length+a;if(t){if(s===0&&n===0)d.success(`Everything looks good! ${j(`(${U(e.elapsedMs)})`)}`);else{const o=[];s>0&&o.push(ye(`${String(s)} security`)),n>0&&o.push(Ee(`${String(n)} improvement${n===1?"":"s"}`)),d.log(`${ye(O.failure)} ${o.join(", ")} ${j(`(${U(e.elapsedMs)})`)}`)}return}d.log(""),d.log(re("Summary","ok")),s===0&&n===0?d.success(`Everything looks good! ${j(`(${U(e.elapsedMs)})`)}`):(s>0&&d.error(`${String(s)} security issue${s===1?"":"s"}`),n>0&&d.log(` ${ve(O.arrow)} ${ae(String(n))} ${j(`improvement${n===1?"":"s"} available`)} ${j(`(${U(e.elapsedMs)})`)}`))},Ji=e=>{const t=[];if(e.outdated.length>0&&t.push("vis update — update outdated dependencies"),(e.vulnCount>0||e.socketIssues.alerts>0)&&t.push("vis audit — detailed security analysis"),e.optimizations.length>0&&t.push("vis optimize — apply optimizations interactively"),e.duplicates.length>0&&t.push("vis dedupe — reduce duplicate versions"),t.length>0){d.log(""),d.log(ae("Next steps:"));for(const s of t)d.log(` ${j(O.arrow)} ${s}`)}d.log("")},Xi=(e,t)=>{t||(Hi(e),Ui(e),Wi(e),Ki(e),Yi(e),Gi(e)),qi(e,t)},Qi=(e,t,s,a,n)=>{const o=[],c=e.has("dependencies"),h=e.has("security"),l=e.has("optimization");return(c||h)&&t>0&&o.push({id:"outdated",label:"Outdated catalog dependencies"}),h&&a>0&&o.push({id:"vulnerabilities",label:"Known vulnerabilities (OSV)"}),h&&s&&a>0&&o.push({id:"socket",label:"Socket.dev supply-chain reports"}),l&&n&&o.push({id:"codemods",label:"Codemod availability"}),o},Zi=e=>{if(d.log(""),d.log(`${ae(ve("vis doctor"))} ${j("— project health check")}`),d.log(Z(`Detected ${e.packageManagerName} v${e.packageManagerVersion}`)),e.runtimeFindings.length===0)d.log(Z(`Node.js ${e.nodeVersion}`));else{for(const t of e.runtimeFindings){const s=t.severity==="error"?ye:Ee;d.log(Pe(`Runtime: ${s(t.message)}`))}d.log(` ${j(O.arrow)} Run ${ge("vis toolchain install")} to install pinned versions, or ${ge("vis toolchain status")} for the per-tool breakdown.`)}d.log("")},Tn=async({fs:e,logger:t,options:s,visConfig:a,visConfigError:n,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root.");const c=s.format==="json"||s.json,h=Ti(s.only,s.skip),l=!!s.quiet,p=s.progress===!1,g=Ri(s.filter);if(h.size===0){d.error("No sections selected. Check your --only / --skip values."),process.exitCode=2;return}const S=Date.now(),y=st(o),R=qt(o),v=!!process.stdout.isTTY,m=!c&&v&&!Tt&&!l&&!p;!c&&!m&&Zi({nodeVersion:process.versions.node,packageManagerName:y.name,packageManagerVersion:y.version,runtimeFindings:R});const A=nt(o,y.name),T=Xt(o,y.name),D=T.length,I=Qe(a?.security).length>0,C=a?.security?.policies?.score?.minimum??et,_=Ne(o);if(!c&&!l&&!m){const P=_.length>0?j(` · ${String(_.length)} workspace package${_.length===1?"":"s"}`):"";d.log(`${j("·")} ${j("Found")} ${ae(String(D))} ${j(`installed package${D===1?"":"s"}`)}${P}`)}const Y=n?{hint:n.file?`Continuing with default settings — fix or regenerate ${n.file} (vis init --force).`:"Continuing with default settings.",message:n.message,severity:"error",title:n.file?`Failed to load ${n.file}`:"Failed to load vis.config"}:void 0,ee=Qt(o,y.name)?.file,te=ee?W(o,ee):void 0,G=zt(o),B=s.cache!==!1&&!s.fix?js({configPath:G,lockfilePath:te,sections:h,socketEnabled:I,workspaceRoot:o}):void 0,b=B?Ss(B):void 0,$=b!==void 0;let V,N;if(m){const P=b?new Ue({activeSections:h,findings:ht(lt(b),g)}):new Ue({activeSections:h}),H=At(Pt.createElement(fi,{banner:Y,fromCache:$,startedAt:S,store:P}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0});try{V=b??await qe({filterPatterns:g,installed:T,resolveCodemods:!!s.fix,sections:h,store:P,visConfig:a,workspaceRoot:o})}catch(K){throw H.unmount(),K}await H.waitUntilExit(),N=P.getSnapshot().pendingAction}else if(b)V=b;else{const P=Qi(h,A.size,I,D,!!s.fix),K=Jt(P,{live:!c&&!l&&!p});try{V=await qe({filterPatterns:g,installed:T,progress:K,resolveCodemods:!!s.fix,sections:h,visConfig:a,workspaceRoot:o})}finally{K.stop()}}const oe={...V,elapsedMs:Date.now()-S,envCoverage:await Ci(a??{},o).catch(P=>(d.warn(`Env coverage check failed: ${P instanceof Error?P.message:String(P)}`),{status:"ok",targets:[]}))};if(B&&!$)try{Cs(B,oe)}catch{}const z=Ai(oe,g,C);if(c){process.stdout.write(`${JSON.stringify(Ii(z,y.name),void 0,2)}
|
|
4
4
|
`),s.exitCode&&Ge(z,!!s.strict)&&(process.exitCode=1);return}$&&!l&&d.log(`${j("·")} Cached results (use --no-cache to refresh)`),g.length>0&&!l&&d.log(`${j("·")} Filter active: ${ve(s.filter??"")}`),Xi(z,l);const X=z.runtime.some(P=>P.id===Se&&P.status==="warn"),le=z.sections.has("optimization")&&z.optimizations.length>0;s.fix&&(le||X)?await en({force:!!s.fixForce,fs:e,logger:t,pm:y,recoverOrphans:X,results:z,useEditorconfig:a?.editorconfig??!0,workspaceRoot:o}):l||Ji(z),N&&(process.stdout.write(`
|