docuvia 1.13.1 → 1.13.2
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/dist/ast-worker.js +1 -1
- package/dist/{chunk-GU4I66OE.js → chunk-BMDPUIOC.js} +2 -2
- package/dist/{chunk-4UDWMAD3.js → chunk-N4A7IONA.js} +2 -2
- package/dist/{chunk-K32TIHIS.js → chunk-TFGHINEH.js} +1 -1
- package/dist/{chunk-K32TIHIS.js.map → chunk-TFGHINEH.js.map} +1 -1
- package/dist/{chunk-WNLHEJM7.js → chunk-UNIVCYR6.js} +2 -2
- package/dist/cli.js +5 -5
- package/dist/cli.js.map +1 -1
- package/dist/fs-utils-UY4EYC7B.js +3 -0
- package/dist/{init-templates-54CLZQRT.js → init-templates-CC5QOU4T.js} +2 -2
- package/package.json +1 -1
- package/dist/fs-utils-EHBLZOPT.js +0 -3
- /package/dist/{chunk-GU4I66OE.js.map → chunk-BMDPUIOC.js.map} +0 -0
- /package/dist/{chunk-4UDWMAD3.js.map → chunk-N4A7IONA.js.map} +0 -0
- /package/dist/{chunk-WNLHEJM7.js.map → chunk-UNIVCYR6.js.map} +0 -0
- /package/dist/{fs-utils-EHBLZOPT.js.map → fs-utils-UY4EYC7B.js.map} +0 -0
- /package/dist/{init-templates-54CLZQRT.js.map → init-templates-CC5QOU4T.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{O as e,Q as o,Ua as t,ha as n}from"./chunk-
|
|
2
|
+
import{O as e,Q as o,Ua as t,ha as n}from"./chunk-TFGHINEH.js";var _=".github",u=".claude",d="hooks.json",O="settings.json",E=".cursor/mcp.json",h="claude_desktop_config.json",x="docuvia-local",A="copilot-instructions.md",N="CLAUDE.md",R=".cursorrules",r="docuvia:start",g="docuvia:end",S=".windsurfrules",I="llms.txt",L="AGENTS.md",C=".hermes.md",m=".continue/rules",f="docuvia.md",T="Cursor",U="Claude",M="GitHub Copilot",D="Codex",y="Continue",F="Hermes Agent",b="cursor",v="claude",P="copilot",G="codex",w="continue",H="hermes",K="${CLAUDE_PLUGIN_ROOT}/hooks",k="${CURSOR_PLUGIN_ROOT}/hooks",J="${CLAUDE_PROJECT_DIR}/"+t,q="npx",V="-y",$="--no-install",j=["docuvia","mcp"],X="DOCUVIA_WORKSPACE_ROOT",B=`#!/usr/bin/env node
|
|
3
3
|
/**
|
|
4
4
|
* Docuvia Agent Hook
|
|
5
5
|
* Intercepts AI searches and augments with high-density AST context from local SQLite.
|
|
@@ -79,4 +79,4 @@ Run: \`npx --no-install docuvia analyze <file> --agent-authored --stage\`
|
|
|
79
79
|
Pipe a JSON payload on stdin (default) \u2014 \`{"decisions":[{"title":string,"content":string,"nodeType":"change"|"rule"|"decision"|"context","confidence":number}]}\` \u2014 or pass \`--decisions-file=<path>\` instead. Put \`--agent-authored\`/\`--stage\` after the positional \`<file>\`, not before \u2014 a flag preceding the path silently swallows it as the flag's own value. Staged decisions flush into the knowledge graph automatically the next time you commit a change touching that file \u2014 nothing else to run.
|
|
80
80
|
<!-- docuvia:end -->
|
|
81
81
|
`;export{_ as a,u as b,d as c,O as d,E as e,h as f,x as g,A as h,N as i,R as j,r as k,g as l,S as m,I as n,L as o,C as p,m as q,f as r,T as s,U as t,M as u,D as v,y as w,F as x,b as y,v as z,P as A,G as B,w as C,H as D,K as E,k as F,J as G,q as H,V as I,$ as J,j as K,X as L,B as M,s as N,W as O,z as P};
|
|
82
|
-
//# sourceMappingURL=chunk-
|
|
82
|
+
//# sourceMappingURL=chunk-UNIVCYR6.js.map
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
3
|
-
import{a as ug,b as dg,d as We,f as pg,g as gg,h as fg}from"./chunk-GU4I66OE.js";import{A as bg,B as wg,C as Fg,D as Mg,E as hc,F as Ec,G as kg,H as Xs,I as Gg,J as xg,K as Zs,L as Ug,M as eo,N as Ht,O as fn,P as kr,a as hg,b as pc,c as qn,d as Qs,e as gc,f as fc,g as Qn,h as Eg,i as _g,j as Sg,k as At,l as Mr,m as Tg,n as Ag,o as Rg,p as yg,q as Og,r as mc,s as Ig,t as ji,u as Lg,v as Cg,w as Ng,x as Pg,y as Dg,z as vg}from"./chunk-WNLHEJM7.js";import{a as mg,b as dc,c as h,d as g,e as Nt,g as Gr}from"./chunk-4UDWMAD3.js";import{$ as Zp,A as dn,B as Te,C as Kp,D as Xt,Da as cc,E as ac,Ea as Vs,F as Ye,Fa as zs,G as Ws,Ga as uc,H as Pr,Ha as Yn,I as $p,Ia as Wn,J as $n,Ja as Js,K as pn,Ka as gn,L as Ut,La as jn,M as lc,Ma as Vn,N as Yp,Na as vr,O as dr,Oa as qs,P as Ki,Pa as gr,Q as Ee,Qa as Wi,R as Dr,Ra as br,S as Wp,Sa as cg,T as jp,Ta as K,U as Vp,Ua as zn,V as zp,Va as Jn,W as $i,Wa as wr,X as Jp,Xa as Fr,Y as qp,Z as Qp,_ as Xp,a as Oe,aa as eg,b as Up,ba as tg,c as he,ca as ct,da as Yi,e as Hp,ea as rg,f as T,fa as ng,g as E,ga as ig,h as O,ha as sg,i as R,ia as og,j as y,ja as pr,k as A,ka as Tt,l as Ct,la as ag,m as ic,ma as se,n as B,na as H,o as sc,oa as Zt,p as un,pa as js,q as Bp,qa as S,r as Kn,ra as lg,s as Bi,t as oc,u as Ys,v as qe,w as Nr,x as de,y as ur,z as xt}from"./chunk-K32TIHIS.js";import{a as be,b as U,c as nc}from"./chunk-KVOCOCYJ.js";var xf=U(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.splitWhen=si.flatten=void 0;function gO(t){return t.reduce((e,r)=>[].concat(e,r),[])}si.flatten=gO;function fO(t,e){let r=[[]],n=0;for(let i of t)e(i)?(n++,r[n]=[]):r[n].push(i);return r}si.splitWhen=fO});var Uf=U(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.isEnoentCodeError=void 0;function mO(t){return t.code==="ENOENT"}Ao.isEnoentCodeError=mO});var Hf=U(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.createDirentFromStats=void 0;var Gc=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function hO(t,e){return new Gc(t,e)}Ro.createDirentFromStats=hO});var Yf=U(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.convertPosixPathToPattern=ke.convertWindowsPathToPattern=ke.convertPathToPattern=ke.escapePosixPath=ke.escapeWindowsPath=ke.escape=ke.removeLeadingDotSegment=ke.makeAbsolute=ke.unixify=void 0;var EO=be("os"),_O=be("path"),Bf=EO.platform()==="win32",SO=2,TO=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,AO=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,RO=/^\\\\([.?])/,yO=/\\(?![!()+@[\]{}])/g;function OO(t){return t.replace(/\\/g,"/")}ke.unixify=OO;function IO(t,e){return _O.resolve(t,e)}ke.makeAbsolute=IO;function LO(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(SO)}return t}ke.removeLeadingDotSegment=LO;ke.escape=Bf?xc:Uc;function xc(t){return t.replace(AO,"\\$2")}ke.escapeWindowsPath=xc;function Uc(t){return t.replace(TO,"\\$2")}ke.escapePosixPath=Uc;ke.convertPathToPattern=Bf?Kf:$f;function Kf(t){return xc(t).replace(RO,"//$1").replace(yO,"/")}ke.convertWindowsPathToPattern=Kf;function $f(t){return Uc(t)}ke.convertPosixPathToPattern=$f});var jf=U((kB,Wf)=>{"use strict";Wf.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var Jf=U((GB,zf)=>{"use strict";var CO=jf(),Vf={"{":"}","(":")","[":"]"},NO=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,n=-2,i=-2,s=-2,o=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||n!==-1&&t[e]==="["&&t[e+1]!=="]"&&(n<e&&(n=t.indexOf("]",e)),n>e&&(o===-1||o>n||(o=t.indexOf("\\",e),o===-1||o>n)))||i!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(i=t.indexOf("}",e),i>e&&(o=t.indexOf("\\",e),o===-1||o>i))||s!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(s=t.indexOf(")",e),s>e&&(o=t.indexOf("\\",e),o===-1||o>s))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(r<e&&(r=t.indexOf("|",e)),r!==-1&&t[r+1]!==")"&&(s=t.indexOf(")",r),s>r&&(o=t.indexOf("\\",r),o===-1||o>s))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var l=Vf[a];if(l){var c=t.indexOf(l,e);c!==-1&&(e=c+1)}if(t[e]==="!")return!0}else e++}return!1},PO=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var r=t[e+1];e+=2;var n=Vf[r];if(n){var i=t.indexOf(n,e);i!==-1&&(e=i+1)}if(t[e]==="!")return!0}else e++}return!1};zf.exports=function(e,r){if(typeof e!="string"||e==="")return!1;if(CO(e))return!0;var n=NO;return r&&r.strict===!1&&(n=PO),n(e)}});var Qf=U((xB,qf)=>{"use strict";var DO=Jf(),vO=be("path").posix.dirname,bO=be("os").platform()==="win32",Hc="/",wO=/\\/g,FO=/[\{\[].*[\}\]]$/,MO=/(^|[^\\])([\{\[]|\([^\)]+$)/,kO=/\\([\!\*\?\|\[\]\(\)\{\}])/g;qf.exports=function(e,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&bO&&e.indexOf(Hc)<0&&(e=e.replace(wO,Hc)),FO.test(e)&&(e+=Hc),e+="a";do e=vO(e);while(DO(e)||MO.test(e));return e.replace(kO,"$1")}});var yo=U(Dt=>{"use strict";Dt.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Dt.find=(t,e)=>t.nodes.find(r=>r.type===e);Dt.exceedsLimit=(t,e,r=1,n)=>n===!1||!Dt.isInteger(t)||!Dt.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;Dt.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};Dt.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;Dt.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Dt.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Dt.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Dt.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let s=n[i];if(Array.isArray(s)){r(s);continue}s!==void 0&&e.push(s)}return e};return r(t),e}});var Oo=U((HB,Zf)=>{"use strict";var Xf=yo();Zf.exports=(t,e={})=>{let r=(n,i={})=>{let s=e.escapeInvalid&&Xf.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(s||o)&&Xf.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let l of n.nodes)a+=r(l);return a};return r(t)}});var tm=U((BB,em)=>{"use strict";em.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var um=U((KB,cm)=>{"use strict";var rm=tm(),An=(t,e,r)=>{if(rm(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(rm(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),s=String(n.shorthand),o=String(n.capture),a=String(n.wrap),l=t+":"+e+"="+i+s+o+a;if(An.cache.hasOwnProperty(l))return An.cache[l].result;let c=Math.min(t,e),u=Math.max(t,e);if(Math.abs(c-u)===1){let _=t+"|"+e;return n.capture?`(${_})`:n.wrap===!1?_:`(?:${_})`}let p=lm(t)||lm(e),d={min:t,max:e,a:c,b:u},f=[],m=[];if(p&&(d.isPadded=p,d.maxLen=String(d.max).length),c<0){let _=u<0?Math.abs(u):1;m=nm(_,Math.abs(c),d,n),c=d.a=0}return u>=0&&(f=nm(c,u,d,n)),d.negatives=m,d.positives=f,d.result=GO(m,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+m.length>1&&(d.result=`(?:${d.result})`),An.cache[l]=d,d.result};function GO(t,e,r){let n=Bc(t,e,"-",!1,r)||[],i=Bc(e,t,"",!1,r)||[],s=Bc(t,e,"-?",!0,r)||[];return n.concat(s).concat(i).join("|")}function xO(t,e){let r=1,n=1,i=sm(t,r),s=new Set([e]);for(;t<=i&&i<=e;)s.add(i),r+=1,i=sm(t,r);for(i=om(e+1,n)-1;t<i&&i<=e;)s.add(i),n+=1,i=om(e+1,n)-1;return s=[...s],s.sort(BO),s}function UO(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=HO(t,e),i=n.length,s="",o=0;for(let a=0;a<i;a++){let[l,c]=n[a];l===c?s+=l:l!=="0"||c!=="9"?s+=KO(l,c,r):o++}return o&&(s+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:i}}function nm(t,e,r,n){let i=xO(t,e),s=[],o=t,a;for(let l=0;l<i.length;l++){let c=i[l],u=UO(String(o),String(c),n),p="";if(!r.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+am(a.count),o=c+1;continue}r.isPadded&&(p=$O(c,r,n)),u.string=p+u.pattern+am(u.count),s.push(u),o=c+1,a=u}return s}function Bc(t,e,r,n,i){let s=[];for(let o of t){let{string:a}=o;!n&&!im(e,"string",a)&&s.push(r+a),n&&im(e,"string",a)&&s.push(r+a)}return s}function HO(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function BO(t,e){return t>e?1:e>t?-1:0}function im(t,e,r){return t.some(n=>n[e]===r)}function sm(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function om(t,e){return t-t%Math.pow(10,e)}function am(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function KO(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function lm(t){return/^-?(0+)\d/.test(t)}function $O(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}An.cache={};An.clearCache=()=>An.cache={};cm.exports=An});var Yc=U(($B,Em)=>{"use strict";var YO=be("util"),pm=um(),dm=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),WO=t=>e=>t===!0?Number(e):String(e),Kc=t=>typeof t=="number"||typeof t=="string"&&t!=="",as=t=>Number.isInteger(+t),$c=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},jO=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,VO=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},Lo=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},zO=(t,e,r)=>{t.negatives.sort((a,l)=>a<l?-1:a>l?1:0),t.positives.sort((a,l)=>a<l?-1:a>l?1:0);let n=e.capture?"":"?:",i="",s="",o;return t.positives.length&&(i=t.positives.map(a=>Lo(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>Lo(String(a),r)).join("|")})`),i&&s?o=`${i}|${s}`:o=i||s,e.wrap?`(${n}${o})`:o},gm=(t,e,r,n)=>{if(r)return pm(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let s=String.fromCharCode(e);return`[${i}-${s}]`},fm=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return pm(t,e,r)},mm=(...t)=>new RangeError("Invalid range arguments: "+YO.inspect(...t)),hm=(t,e,r)=>{if(r.strictRanges===!0)throw mm([t,e]);return[]},JO=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},qO=(t,e,r=1,n={})=>{let i=Number(t),s=Number(e);if(!Number.isInteger(i)||!Number.isInteger(s)){if(n.strictRanges===!0)throw mm([t,e]);return[]}i===0&&(i=0),s===0&&(s=0);let o=i>s,a=String(t),l=String(e),c=String(r);r=Math.max(Math.abs(r),1);let u=$c(a)||$c(l)||$c(c),p=u?Math.max(a.length,l.length,c.length):0,d=u===!1&&jO(t,e,n)===!1,f=n.transform||WO(d);if(n.toRegex&&r===1)return gm(Lo(t,p),Lo(e,p),!0,n);let m={negatives:[],positives:[]},_=F=>m[F<0?"negatives":"positives"].push(Math.abs(F)),L=[],C=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?_(i):L.push(VO(f(i,C),p,d)),i=o?i-r:i+r,C++;return n.toRegex===!0?r>1?zO(m,n,p):fm(L,null,{wrap:!1,...n}):L},QO=(t,e,r=1,n={})=>{if(!as(t)&&t.length>1||!as(e)&&e.length>1)return hm(t,e,n);let i=n.transform||(d=>String.fromCharCode(d)),s=`${t}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=s>o,l=Math.min(s,o),c=Math.max(s,o);if(n.toRegex&&r===1)return gm(l,c,!1,n);let u=[],p=0;for(;a?s>=o:s<=o;)u.push(i(s,p)),s=a?s-r:s+r,p++;return n.toRegex===!0?fm(u,null,{wrap:!1,options:n}):u},Io=(t,e,r,n={})=>{if(e==null&&Kc(t))return[t];if(!Kc(t)||!Kc(e))return hm(t,e,n);if(typeof r=="function")return Io(t,e,1,{transform:r});if(dm(r))return Io(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,as(r)?as(t)&&as(e)?qO(t,e,r,i):QO(t,e,Math.max(Math.abs(r),1),i):r!=null&&!dm(r)?JO(r,i):Io(t,e,1,r)};Em.exports=Io});var Tm=U((YB,Sm)=>{"use strict";var XO=Yc(),_m=yo(),ZO=(t,e={})=>{let r=(n,i={})=>{let s=_m.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a=s===!0||o===!0,l=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return l+n.value;if(n.isClose===!0)return console.log("node.isClose",l,n.value),l+n.value;if(n.type==="open")return a?l+n.value:"(";if(n.type==="close")return a?l+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let u=_m.reduce(n.nodes),p=XO(...u,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(p.length!==0)return u.length>1&&p.length>1?`(${p})`:p}if(n.nodes)for(let u of n.nodes)c+=r(u,n);return c};return r(t)};Sm.exports=ZO});var ym=U((WB,Rm)=>{"use strict";var eI=Yc(),Am=Oo(),oi=yo(),Rn=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?oi.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(Rn(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?Rn(i,s,r):i+s);return oi.flatten(n)},tI=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,s={})=>{i.queue=[];let o=s,a=s.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(i.invalid||i.dollar){a.push(Rn(a.pop(),Am(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(Rn(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let p=oi.reduce(i.nodes);if(oi.exceedsLimit(...p,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=eI(...p,e);d.length===0&&(d=Am(i,e)),a.push(Rn(a.pop(),d)),i.nodes=[];return}let l=oi.encloseBrace(i),c=i.queue,u=i;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,c=u.queue;for(let p=0;p<i.nodes.length;p++){let d=i.nodes[p];if(d.type==="comma"&&i.type==="brace"){p===1&&c.push(""),c.push("");continue}if(d.type==="close"){a.push(Rn(a.pop(),c,l));continue}if(d.value&&d.type!=="open"){c.push(Rn(c.pop(),d.value));continue}d.nodes&&n(d,i)}return c};return oi.flatten(n(t))};Rm.exports=tI});var Im=U((jB,Om)=>{"use strict";Om.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
3
|
+
import{a as ug,b as dg,d as We,f as pg,g as gg,h as fg}from"./chunk-BMDPUIOC.js";import{A as bg,B as wg,C as Fg,D as Mg,E as hc,F as Ec,G as kg,H as Xs,I as Gg,J as xg,K as Zs,L as Ug,M as eo,N as Ht,O as fn,P as kr,a as hg,b as pc,c as qn,d as Qs,e as gc,f as fc,g as Qn,h as Eg,i as _g,j as Sg,k as At,l as Mr,m as Tg,n as Ag,o as Rg,p as yg,q as Og,r as mc,s as Ig,t as ji,u as Lg,v as Cg,w as Ng,x as Pg,y as Dg,z as vg}from"./chunk-UNIVCYR6.js";import{a as mg,b as dc,c as h,d as g,e as Nt,g as Gr}from"./chunk-N4A7IONA.js";import{$ as Zp,A as dn,B as Te,C as Kp,D as Xt,Da as cc,E as ac,Ea as Vs,F as Ye,Fa as zs,G as Ws,Ga as uc,H as Pr,Ha as Yn,I as $p,Ia as Wn,J as $n,Ja as Js,K as pn,Ka as gn,L as Ut,La as jn,M as lc,Ma as Vn,N as Yp,Na as vr,O as dr,Oa as qs,P as Ki,Pa as gr,Q as Ee,Qa as Wi,R as Dr,Ra as br,S as Wp,Sa as cg,T as jp,Ta as K,U as Vp,Ua as zn,V as zp,Va as Jn,W as $i,Wa as wr,X as Jp,Xa as Fr,Y as qp,Z as Qp,_ as Xp,a as Oe,aa as eg,b as Up,ba as tg,c as he,ca as ct,da as Yi,e as Hp,ea as rg,f as T,fa as ng,g as E,ga as ig,h as O,ha as sg,i as R,ia as og,j as y,ja as pr,k as A,ka as Tt,l as Ct,la as ag,m as ic,ma as se,n as B,na as H,o as sc,oa as Zt,p as un,pa as js,q as Bp,qa as S,r as Kn,ra as lg,s as Bi,t as oc,u as Ys,v as qe,w as Nr,x as de,y as ur,z as xt}from"./chunk-TFGHINEH.js";import{a as be,b as U,c as nc}from"./chunk-KVOCOCYJ.js";var xf=U(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.splitWhen=si.flatten=void 0;function gO(t){return t.reduce((e,r)=>[].concat(e,r),[])}si.flatten=gO;function fO(t,e){let r=[[]],n=0;for(let i of t)e(i)?(n++,r[n]=[]):r[n].push(i);return r}si.splitWhen=fO});var Uf=U(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.isEnoentCodeError=void 0;function mO(t){return t.code==="ENOENT"}Ao.isEnoentCodeError=mO});var Hf=U(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.createDirentFromStats=void 0;var Gc=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function hO(t,e){return new Gc(t,e)}Ro.createDirentFromStats=hO});var Yf=U(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.convertPosixPathToPattern=ke.convertWindowsPathToPattern=ke.convertPathToPattern=ke.escapePosixPath=ke.escapeWindowsPath=ke.escape=ke.removeLeadingDotSegment=ke.makeAbsolute=ke.unixify=void 0;var EO=be("os"),_O=be("path"),Bf=EO.platform()==="win32",SO=2,TO=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,AO=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,RO=/^\\\\([.?])/,yO=/\\(?![!()+@[\]{}])/g;function OO(t){return t.replace(/\\/g,"/")}ke.unixify=OO;function IO(t,e){return _O.resolve(t,e)}ke.makeAbsolute=IO;function LO(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(SO)}return t}ke.removeLeadingDotSegment=LO;ke.escape=Bf?xc:Uc;function xc(t){return t.replace(AO,"\\$2")}ke.escapeWindowsPath=xc;function Uc(t){return t.replace(TO,"\\$2")}ke.escapePosixPath=Uc;ke.convertPathToPattern=Bf?Kf:$f;function Kf(t){return xc(t).replace(RO,"//$1").replace(yO,"/")}ke.convertWindowsPathToPattern=Kf;function $f(t){return Uc(t)}ke.convertPosixPathToPattern=$f});var jf=U((kB,Wf)=>{"use strict";Wf.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var Jf=U((GB,zf)=>{"use strict";var CO=jf(),Vf={"{":"}","(":")","[":"]"},NO=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,n=-2,i=-2,s=-2,o=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||n!==-1&&t[e]==="["&&t[e+1]!=="]"&&(n<e&&(n=t.indexOf("]",e)),n>e&&(o===-1||o>n||(o=t.indexOf("\\",e),o===-1||o>n)))||i!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(i=t.indexOf("}",e),i>e&&(o=t.indexOf("\\",e),o===-1||o>i))||s!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(s=t.indexOf(")",e),s>e&&(o=t.indexOf("\\",e),o===-1||o>s))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(r<e&&(r=t.indexOf("|",e)),r!==-1&&t[r+1]!==")"&&(s=t.indexOf(")",r),s>r&&(o=t.indexOf("\\",r),o===-1||o>s))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var l=Vf[a];if(l){var c=t.indexOf(l,e);c!==-1&&(e=c+1)}if(t[e]==="!")return!0}else e++}return!1},PO=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var r=t[e+1];e+=2;var n=Vf[r];if(n){var i=t.indexOf(n,e);i!==-1&&(e=i+1)}if(t[e]==="!")return!0}else e++}return!1};zf.exports=function(e,r){if(typeof e!="string"||e==="")return!1;if(CO(e))return!0;var n=NO;return r&&r.strict===!1&&(n=PO),n(e)}});var Qf=U((xB,qf)=>{"use strict";var DO=Jf(),vO=be("path").posix.dirname,bO=be("os").platform()==="win32",Hc="/",wO=/\\/g,FO=/[\{\[].*[\}\]]$/,MO=/(^|[^\\])([\{\[]|\([^\)]+$)/,kO=/\\([\!\*\?\|\[\]\(\)\{\}])/g;qf.exports=function(e,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&bO&&e.indexOf(Hc)<0&&(e=e.replace(wO,Hc)),FO.test(e)&&(e+=Hc),e+="a";do e=vO(e);while(DO(e)||MO.test(e));return e.replace(kO,"$1")}});var yo=U(Dt=>{"use strict";Dt.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Dt.find=(t,e)=>t.nodes.find(r=>r.type===e);Dt.exceedsLimit=(t,e,r=1,n)=>n===!1||!Dt.isInteger(t)||!Dt.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;Dt.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};Dt.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;Dt.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Dt.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Dt.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Dt.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let s=n[i];if(Array.isArray(s)){r(s);continue}s!==void 0&&e.push(s)}return e};return r(t),e}});var Oo=U((HB,Zf)=>{"use strict";var Xf=yo();Zf.exports=(t,e={})=>{let r=(n,i={})=>{let s=e.escapeInvalid&&Xf.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(s||o)&&Xf.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let l of n.nodes)a+=r(l);return a};return r(t)}});var tm=U((BB,em)=>{"use strict";em.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var um=U((KB,cm)=>{"use strict";var rm=tm(),An=(t,e,r)=>{if(rm(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(rm(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),s=String(n.shorthand),o=String(n.capture),a=String(n.wrap),l=t+":"+e+"="+i+s+o+a;if(An.cache.hasOwnProperty(l))return An.cache[l].result;let c=Math.min(t,e),u=Math.max(t,e);if(Math.abs(c-u)===1){let _=t+"|"+e;return n.capture?`(${_})`:n.wrap===!1?_:`(?:${_})`}let p=lm(t)||lm(e),d={min:t,max:e,a:c,b:u},f=[],m=[];if(p&&(d.isPadded=p,d.maxLen=String(d.max).length),c<0){let _=u<0?Math.abs(u):1;m=nm(_,Math.abs(c),d,n),c=d.a=0}return u>=0&&(f=nm(c,u,d,n)),d.negatives=m,d.positives=f,d.result=GO(m,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+m.length>1&&(d.result=`(?:${d.result})`),An.cache[l]=d,d.result};function GO(t,e,r){let n=Bc(t,e,"-",!1,r)||[],i=Bc(e,t,"",!1,r)||[],s=Bc(t,e,"-?",!0,r)||[];return n.concat(s).concat(i).join("|")}function xO(t,e){let r=1,n=1,i=sm(t,r),s=new Set([e]);for(;t<=i&&i<=e;)s.add(i),r+=1,i=sm(t,r);for(i=om(e+1,n)-1;t<i&&i<=e;)s.add(i),n+=1,i=om(e+1,n)-1;return s=[...s],s.sort(BO),s}function UO(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=HO(t,e),i=n.length,s="",o=0;for(let a=0;a<i;a++){let[l,c]=n[a];l===c?s+=l:l!=="0"||c!=="9"?s+=KO(l,c,r):o++}return o&&(s+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:i}}function nm(t,e,r,n){let i=xO(t,e),s=[],o=t,a;for(let l=0;l<i.length;l++){let c=i[l],u=UO(String(o),String(c),n),p="";if(!r.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+am(a.count),o=c+1;continue}r.isPadded&&(p=$O(c,r,n)),u.string=p+u.pattern+am(u.count),s.push(u),o=c+1,a=u}return s}function Bc(t,e,r,n,i){let s=[];for(let o of t){let{string:a}=o;!n&&!im(e,"string",a)&&s.push(r+a),n&&im(e,"string",a)&&s.push(r+a)}return s}function HO(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function BO(t,e){return t>e?1:e>t?-1:0}function im(t,e,r){return t.some(n=>n[e]===r)}function sm(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function om(t,e){return t-t%Math.pow(10,e)}function am(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function KO(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function lm(t){return/^-?(0+)\d/.test(t)}function $O(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}An.cache={};An.clearCache=()=>An.cache={};cm.exports=An});var Yc=U(($B,Em)=>{"use strict";var YO=be("util"),pm=um(),dm=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),WO=t=>e=>t===!0?Number(e):String(e),Kc=t=>typeof t=="number"||typeof t=="string"&&t!=="",as=t=>Number.isInteger(+t),$c=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},jO=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,VO=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},Lo=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},zO=(t,e,r)=>{t.negatives.sort((a,l)=>a<l?-1:a>l?1:0),t.positives.sort((a,l)=>a<l?-1:a>l?1:0);let n=e.capture?"":"?:",i="",s="",o;return t.positives.length&&(i=t.positives.map(a=>Lo(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>Lo(String(a),r)).join("|")})`),i&&s?o=`${i}|${s}`:o=i||s,e.wrap?`(${n}${o})`:o},gm=(t,e,r,n)=>{if(r)return pm(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let s=String.fromCharCode(e);return`[${i}-${s}]`},fm=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return pm(t,e,r)},mm=(...t)=>new RangeError("Invalid range arguments: "+YO.inspect(...t)),hm=(t,e,r)=>{if(r.strictRanges===!0)throw mm([t,e]);return[]},JO=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},qO=(t,e,r=1,n={})=>{let i=Number(t),s=Number(e);if(!Number.isInteger(i)||!Number.isInteger(s)){if(n.strictRanges===!0)throw mm([t,e]);return[]}i===0&&(i=0),s===0&&(s=0);let o=i>s,a=String(t),l=String(e),c=String(r);r=Math.max(Math.abs(r),1);let u=$c(a)||$c(l)||$c(c),p=u?Math.max(a.length,l.length,c.length):0,d=u===!1&&jO(t,e,n)===!1,f=n.transform||WO(d);if(n.toRegex&&r===1)return gm(Lo(t,p),Lo(e,p),!0,n);let m={negatives:[],positives:[]},_=F=>m[F<0?"negatives":"positives"].push(Math.abs(F)),L=[],C=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?_(i):L.push(VO(f(i,C),p,d)),i=o?i-r:i+r,C++;return n.toRegex===!0?r>1?zO(m,n,p):fm(L,null,{wrap:!1,...n}):L},QO=(t,e,r=1,n={})=>{if(!as(t)&&t.length>1||!as(e)&&e.length>1)return hm(t,e,n);let i=n.transform||(d=>String.fromCharCode(d)),s=`${t}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=s>o,l=Math.min(s,o),c=Math.max(s,o);if(n.toRegex&&r===1)return gm(l,c,!1,n);let u=[],p=0;for(;a?s>=o:s<=o;)u.push(i(s,p)),s=a?s-r:s+r,p++;return n.toRegex===!0?fm(u,null,{wrap:!1,options:n}):u},Io=(t,e,r,n={})=>{if(e==null&&Kc(t))return[t];if(!Kc(t)||!Kc(e))return hm(t,e,n);if(typeof r=="function")return Io(t,e,1,{transform:r});if(dm(r))return Io(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,as(r)?as(t)&&as(e)?qO(t,e,r,i):QO(t,e,Math.max(Math.abs(r),1),i):r!=null&&!dm(r)?JO(r,i):Io(t,e,1,r)};Em.exports=Io});var Tm=U((YB,Sm)=>{"use strict";var XO=Yc(),_m=yo(),ZO=(t,e={})=>{let r=(n,i={})=>{let s=_m.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a=s===!0||o===!0,l=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return l+n.value;if(n.isClose===!0)return console.log("node.isClose",l,n.value),l+n.value;if(n.type==="open")return a?l+n.value:"(";if(n.type==="close")return a?l+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let u=_m.reduce(n.nodes),p=XO(...u,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(p.length!==0)return u.length>1&&p.length>1?`(${p})`:p}if(n.nodes)for(let u of n.nodes)c+=r(u,n);return c};return r(t)};Sm.exports=ZO});var ym=U((WB,Rm)=>{"use strict";var eI=Yc(),Am=Oo(),oi=yo(),Rn=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?oi.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(Rn(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?Rn(i,s,r):i+s);return oi.flatten(n)},tI=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,s={})=>{i.queue=[];let o=s,a=s.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(i.invalid||i.dollar){a.push(Rn(a.pop(),Am(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(Rn(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let p=oi.reduce(i.nodes);if(oi.exceedsLimit(...p,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=eI(...p,e);d.length===0&&(d=Am(i,e)),a.push(Rn(a.pop(),d)),i.nodes=[];return}let l=oi.encloseBrace(i),c=i.queue,u=i;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,c=u.queue;for(let p=0;p<i.nodes.length;p++){let d=i.nodes[p];if(d.type==="comma"&&i.type==="brace"){p===1&&c.push(""),c.push("");continue}if(d.type==="close"){a.push(Rn(a.pop(),c,l));continue}if(d.value&&d.type!=="open"){c.push(Rn(c.pop(),d.value));continue}d.nodes&&n(d,i)}return c};return oi.flatten(n(t))};Rm.exports=tI});var Im=U((jB,Om)=>{"use strict";Om.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
4
4
|
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Dm=U((VB,Pm)=>{"use strict";var rI=Oo(),{MAX_LENGTH:Lm,CHAR_BACKSLASH:Wc,CHAR_BACKTICK:nI,CHAR_COMMA:iI,CHAR_DOT:sI,CHAR_LEFT_PARENTHESES:oI,CHAR_RIGHT_PARENTHESES:aI,CHAR_LEFT_CURLY_BRACE:lI,CHAR_RIGHT_CURLY_BRACE:cI,CHAR_LEFT_SQUARE_BRACKET:Cm,CHAR_RIGHT_SQUARE_BRACKET:Nm,CHAR_DOUBLE_QUOTE:uI,CHAR_SINGLE_QUOTE:dI,CHAR_NO_BREAK_SPACE:pI,CHAR_ZERO_WIDTH_NOBREAK_SPACE:gI}=Im(),fI=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(Lm,r.maxLength):Lm;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},s=[i],o=i,a=i,l=0,c=t.length,u=0,p=0,d,f=()=>t[u++],m=_=>{if(_.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&_.type==="text"){a.value+=_.value;return}return o.nodes.push(_),_.parent=o,_.prev=a,a=_,_};for(m({type:"bos"});u<c;)if(o=s[s.length-1],d=f(),!(d===gI||d===pI)){if(d===Wc){m({type:"text",value:(e.keepEscaping?d:"")+f()});continue}if(d===Nm){m({type:"text",value:"\\"+d});continue}if(d===Cm){l++;let _;for(;u<c&&(_=f());){if(d+=_,_===Cm){l++;continue}if(_===Wc){d+=f();continue}if(_===Nm&&(l--,l===0))break}m({type:"text",value:d});continue}if(d===oI){o=m({type:"paren",nodes:[]}),s.push(o),m({type:"text",value:d});continue}if(d===aI){if(o.type!=="paren"){m({type:"text",value:d});continue}o=s.pop(),m({type:"text",value:d}),o=s[s.length-1];continue}if(d===uI||d===dI||d===nI){let _=d,L;for(e.keepQuotes!==!0&&(d="");u<c&&(L=f());){if(L===Wc){d+=L+f();continue}if(L===_){e.keepQuotes===!0&&(d+=L);break}d+=L}m({type:"text",value:d});continue}if(d===lI){p++;let L={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:p,commas:0,ranges:0,nodes:[]};o=m(L),s.push(o),m({type:"open",value:d});continue}if(d===cI){if(o.type!=="brace"){m({type:"text",value:d});continue}let _="close";o=s.pop(),o.close=!0,m({type:_,value:d}),p--,o=s[s.length-1];continue}if(d===iI&&p>0){if(o.ranges>0){o.ranges=0;let _=o.nodes.shift();o.nodes=[_,{type:"text",value:rI(o)}]}m({type:"comma",value:d}),o.commas++;continue}if(d===sI&&p>0&&o.commas===0){let _=o.nodes;if(p===0||_.length===0){m({type:"text",value:d});continue}if(a.type==="dot"){if(o.range=[],a.value+=d,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){_.pop();let L=_[_.length-1];L.value+=a.value+d,a=L,o.ranges--;continue}m({type:"dot",value:d});continue}m({type:"text",value:d})}do if(o=s.pop(),o.type!=="root"){o.nodes.forEach(C=>{C.nodes||(C.type==="open"&&(C.isOpen=!0),C.type==="close"&&(C.isClose=!0),C.nodes||(C.type="text"),C.invalid=!0)});let _=s[s.length-1],L=_.nodes.indexOf(o);_.nodes.splice(L,1,...o.nodes)}while(s.length>0);return m({type:"eos"}),i};Pm.exports=fI});var wm=U((zB,bm)=>{"use strict";var vm=Oo(),mI=Tm(),hI=ym(),EI=Dm(),yt=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=yt.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(yt.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};yt.parse=(t,e={})=>EI(t,e);yt.stringify=(t,e={})=>vm(typeof t=="string"?yt.parse(t,e):t,e);yt.compile=(t,e={})=>(typeof t=="string"&&(t=yt.parse(t,e)),mI(t,e));yt.expand=(t,e={})=>{typeof t=="string"&&(t=yt.parse(t,e));let r=hI(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};yt.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?yt.compile(t,e):yt.expand(t,e);bm.exports=yt});var ls=U((JB,xm)=>{"use strict";var _I=be("path"),tr="\\\\/",Fm=`[^${tr}]`,SI=0,_r="\\.",TI="\\+",AI="\\?",Co="\\/",RI="(?=.)",Mm="[^/]",jc=`(?:${Co}|$)`,km=`(?:^|${Co})`,Vc=`${_r}{1,2}${jc}`,yI=`(?!${_r})`,OI=`(?!${km}${Vc})`,II=`(?!${_r}{0,1}${jc})`,LI=`(?!${Vc})`,CI=`[^.${Co}]`,NI=`${Mm}*?`,Gm={DOT_LITERAL:_r,PLUS_LITERAL:TI,QMARK_LITERAL:AI,SLASH_LITERAL:Co,ONE_CHAR:RI,QMARK:Mm,END_ANCHOR:jc,DOTS_SLASH:Vc,NO_DOT:yI,NO_DOTS:OI,NO_DOT_SLASH:II,NO_DOTS_SLASH:LI,QMARK_NO_DOT:CI,STAR:NI,START_ANCHOR:km},PI={...Gm,SLASH_LITERAL:`[${tr}]`,QMARK:Fm,STAR:`${Fm}*?`,DOTS_SLASH:`${_r}{1,2}(?:[${tr}]|$)`,NO_DOT:`(?!${_r})`,NO_DOTS:`(?!(?:^|[${tr}])${_r}{1,2}(?:[${tr}]|$))`,NO_DOT_SLASH:`(?!${_r}{0,1}(?:[${tr}]|$))`,NO_DOTS_SLASH:`(?!${_r}{1,2}(?:[${tr}]|$))`,QMARK_NO_DOT:`[^.${tr}]`,START_ANCHOR:`(?:^|[${tr}])`,END_ANCHOR:`(?:[${tr}]|$)`},DI={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};xm.exports={DEFAULT_MAX_EXTGLOB_RECURSION:SI,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:DI,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:_I.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?PI:Gm}}});var cs=U(mt=>{"use strict";var vI=be("path"),bI=process.platform==="win32",{REGEX_BACKSLASH:wI,REGEX_REMOVE_BACKSLASH:FI,REGEX_SPECIAL_CHARS:MI,REGEX_SPECIAL_CHARS_GLOBAL:kI}=ls();mt.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);mt.hasRegexChars=t=>MI.test(t);mt.isRegexChar=t=>t.length===1&&mt.hasRegexChars(t);mt.escapeRegex=t=>t.replace(kI,"\\$1");mt.toPosixSlashes=t=>t.replace(wI,"/");mt.removeBackslashes=t=>t.replace(FI,e=>e==="\\"?"":e);mt.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};mt.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:bI===!0||vI.sep==="\\";mt.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?mt.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};mt.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};mt.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",s=`${n}(?:${t})${i}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var jm=U((QB,Wm)=>{"use strict";var Um=cs(),{CHAR_ASTERISK:zc,CHAR_AT:GI,CHAR_BACKWARD_SLASH:us,CHAR_COMMA:xI,CHAR_DOT:Jc,CHAR_EXCLAMATION_MARK:qc,CHAR_FORWARD_SLASH:Ym,CHAR_LEFT_CURLY_BRACE:Qc,CHAR_LEFT_PARENTHESES:Xc,CHAR_LEFT_SQUARE_BRACKET:UI,CHAR_PLUS:HI,CHAR_QUESTION_MARK:Hm,CHAR_RIGHT_CURLY_BRACE:BI,CHAR_RIGHT_PARENTHESES:Bm,CHAR_RIGHT_SQUARE_BRACKET:KI}=ls(),Km=t=>t===Ym||t===us,$m=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},$I=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,s=[],o=[],a=[],l=t,c=-1,u=0,p=0,d=!1,f=!1,m=!1,_=!1,L=!1,C=!1,F=!1,I=!1,$=!1,Q=!1,z=0,te,M,ne={value:"",depth:0,isGlob:!1},pe=()=>c>=n,N=()=>l.charCodeAt(c+1),Re=()=>(te=M,l.charCodeAt(++c));for(;c<n;){M=Re();let it;if(M===us){F=ne.backslashes=!0,M=Re(),M===Qc&&(C=!0);continue}if(C===!0||M===Qc){for(z++;pe()!==!0&&(M=Re());){if(M===us){F=ne.backslashes=!0,Re();continue}if(M===Qc){z++;continue}if(C!==!0&&M===Jc&&(M=Re())===Jc){if(d=ne.isBrace=!0,m=ne.isGlob=!0,Q=!0,i===!0)continue;break}if(C!==!0&&M===xI){if(d=ne.isBrace=!0,m=ne.isGlob=!0,Q=!0,i===!0)continue;break}if(M===BI&&(z--,z===0)){C=!1,d=ne.isBrace=!0,Q=!0;break}}if(i===!0)continue;break}if(M===Ym){if(s.push(c),o.push(ne),ne={value:"",depth:0,isGlob:!1},Q===!0)continue;if(te===Jc&&c===u+1){u+=2;continue}p=c+1;continue}if(r.noext!==!0&&(M===HI||M===GI||M===zc||M===Hm||M===qc)===!0&&N()===Xc){if(m=ne.isGlob=!0,_=ne.isExtglob=!0,Q=!0,M===qc&&c===u&&($=!0),i===!0){for(;pe()!==!0&&(M=Re());){if(M===us){F=ne.backslashes=!0,M=Re();continue}if(M===Bm){m=ne.isGlob=!0,Q=!0;break}}continue}break}if(M===zc){if(te===zc&&(L=ne.isGlobstar=!0),m=ne.isGlob=!0,Q=!0,i===!0)continue;break}if(M===Hm){if(m=ne.isGlob=!0,Q=!0,i===!0)continue;break}if(M===UI){for(;pe()!==!0&&(it=Re());){if(it===us){F=ne.backslashes=!0,Re();continue}if(it===KI){f=ne.isBracket=!0,m=ne.isGlob=!0,Q=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&M===qc&&c===u){I=ne.negated=!0,u++;continue}if(r.noparen!==!0&&M===Xc){if(m=ne.isGlob=!0,i===!0){for(;pe()!==!0&&(M=Re());){if(M===Xc){F=ne.backslashes=!0,M=Re();continue}if(M===Bm){Q=!0;break}}continue}break}if(m===!0){if(Q=!0,i===!0)continue;break}}r.noext===!0&&(_=!1,m=!1);let Ie=l,Lr="",D="";u>0&&(Lr=l.slice(0,u),l=l.slice(u),p-=u),Ie&&m===!0&&p>0?(Ie=l.slice(0,p),D=l.slice(p)):m===!0?(Ie="",D=l):Ie=l,Ie&&Ie!==""&&Ie!=="/"&&Ie!==l&&Km(Ie.charCodeAt(Ie.length-1))&&(Ie=Ie.slice(0,-1)),r.unescape===!0&&(D&&(D=Um.removeBackslashes(D)),Ie&&F===!0&&(Ie=Um.removeBackslashes(Ie)));let v={prefix:Lr,input:t,start:u,base:Ie,glob:D,isBrace:d,isBracket:f,isGlob:m,isExtglob:_,isGlobstar:L,negated:I,negatedExtglob:$};if(r.tokens===!0&&(v.maxDepth=0,Km(M)||o.push(ne),v.tokens=o),r.parts===!0||r.tokens===!0){let it;for(let me=0;me<s.length;me++){let zt=it?it+1:u,Jt=s[me],St=t.slice(zt,Jt);r.tokens&&(me===0&&u!==0?(o[me].isPrefix=!0,o[me].value=Lr):o[me].value=St,$m(o[me]),v.maxDepth+=o[me].depth),(me!==0||St!=="")&&a.push(St),it=Jt}if(it&&it+1<t.length){let me=t.slice(it+1);a.push(me),r.tokens&&(o[o.length-1].value=me,$m(o[o.length-1]),v.maxDepth+=o[o.length-1].depth)}v.slashes=s,v.parts=a}return v};Wm.exports=$I});var Qm=U((XB,qm)=>{"use strict";var ds=ls(),Xe=cs(),{MAX_LENGTH:No,POSIX_REGEX_SOURCE:YI,REGEX_NON_SPECIAL_CHARS:WI,REGEX_SPECIAL_CHARS_BACKREF:jI,REPLACEMENTS:Vm}=ds,VI=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Xe.escapeRegex(i)).join("..")}return r},ai=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,zm=t=>{let e=[],r=0,n=0,i=0,s="",o=!1;for(let a of t){if(o===!0){s+=a,o=!1;continue}if(a==="\\"){s+=a,o=!0;continue}if(a==='"'){i=i===1?0:1,s+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(s),s="";continue}}}s+=a}return e.push(s),e},zI=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},Jm=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(zI(e))return e.replace(/\\(.)/g,"$1")},JI=t=>{let e=t.map(Jm).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let i=e[r],s=e[n],o=i[0];if(!(!o||i!==o.repeat(i.length)||s!==o.repeat(s.length))&&(i===s||i.startsWith(s)||s.startsWith(i)))return!0}return!1},Zc=(t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,s=!1;for(let o=1;o<t.length;o++){let a=t[o];if(s===!0){s=!1;continue}if(a==="\\"){s=!0;continue}if(a==='"'){i=i===1?0:1;continue}if(i!==1){if(a==="["){r++;continue}if(a==="]"&&r>0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&o!==t.length-1?void 0:{type:t[0],body:t.slice(2,o),end:o}}}}},qI=t=>{let e=0,r=[];for(;e<t.length;){let i=Zc(t.slice(e),!1);if(!i||i.type!=="*")return;let s=zm(i.body).map(a=>a.trim());if(s.length!==1)return;let o=Jm(s[0]);if(!o||o.length!==1)return;r.push(o),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Xe.escapeRegex(r[0]):`[${r.map(i=>Xe.escapeRegex(i)).join("")}]`}*`},QI=t=>{let e=0,r=t.trim(),n=Zc(r);for(;n;)e++,r=n.body.trim(),n=Zc(r);return e},XI=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:ds.DEFAULT_MAX_EXTGLOB_RECURSION,n=zm(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||JI(n)))return{risky:!0};for(let i of n){let s=qI(i);if(s)return{risky:!0,safeOutput:s};if(QI(i)>r)return{risky:!0}}return{risky:!1}},eu=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Vm[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(No,r.maxLength):No,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let s={type:"bos",value:"",output:r.prepend||""},o=[s],a=r.capture?"":"?:",l=Xe.isWindows(e),c=ds.globChars(l),u=ds.extglobChars(c),{DOT_LITERAL:p,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:m,DOTS_SLASH:_,NO_DOT:L,NO_DOT_SLASH:C,NO_DOTS_SLASH:F,QMARK:I,QMARK_NO_DOT:$,STAR:Q,START_ANCHOR:z}=c,te=x=>`(${a}(?:(?!${z}${x.dot?_:p}).)*?)`,M=r.dot?"":L,ne=r.dot?I:$,pe=r.bash===!0?te(r):Q;r.capture&&(pe=`(${pe})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let N={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};t=Xe.removePrefix(t,N),i=t.length;let Re=[],Ie=[],Lr=[],D=s,v,it=()=>N.index===i-1,me=N.peek=(x=1)=>t[N.index+x],zt=N.advance=()=>t[++N.index]||"",Jt=()=>t.slice(N.index+1),St=(x="",Ne=0)=>{N.consumed+=x,N.index+=Ne},Bs=x=>{N.output+=x.output!=null?x.output:x.value,St(x.value)},ER=()=>{let x=1;for(;me()==="!"&&(me(2)!=="("||me(3)==="?");)zt(),N.start++,x++;return x%2===0?!1:(N.negated=!0,N.start++,!0)},Ks=x=>{N[x]++,Lr.push(x)},Cr=x=>{N[x]--,Lr.pop()},le=x=>{if(D.type==="globstar"){let Ne=N.braces>0&&(x.type==="comma"||x.type==="brace"),G=x.extglob===!0||Re.length&&(x.type==="pipe"||x.type==="paren");x.type!=="slash"&&x.type!=="paren"&&!Ne&&!G&&(N.output=N.output.slice(0,-D.output.length),D.type="star",D.value="*",D.output=pe,N.output+=D.output)}if(Re.length&&x.type!=="paren"&&(Re[Re.length-1].inner+=x.value),(x.value||x.output)&&Bs(x),D&&D.type==="text"&&x.type==="text"){D.value+=x.value,D.output=(D.output||"")+x.value;return}x.prev=D,o.push(x),D=x},$s=(x,Ne)=>{let G={...u[Ne],conditions:1,inner:""};G.prev=D,G.parens=N.parens,G.output=N.output,G.startIndex=N.index,G.tokensIndex=o.length;let ae=(r.capture?"(":"")+G.open;Ks("parens"),le({type:x,value:Ne,output:N.output?"":m}),le({type:"paren",extglob:!0,value:zt(),output:ae}),Re.push(G)},_R=x=>{let Ne=t.slice(x.startIndex,N.index+1),G=t.slice(x.startIndex+2,N.index),ae=XI(G,r);if((x.type==="plus"||x.type==="star")&&ae.risky){let ye=ae.safeOutput?(x.output?"":m)+(r.capture?`(${ae.safeOutput})`:ae.safeOutput):void 0,qt=o[x.tokensIndex];qt.type="text",qt.value=Ne,qt.output=ye||Xe.escapeRegex(Ne);for(let Qt=x.tokensIndex+1;Qt<o.length;Qt++)o[Qt].value="",o[Qt].output="",delete o[Qt].suffix;N.output=x.output+qt.output,N.backtrack=!0,le({type:"paren",extglob:!0,value:v,output:""}),Cr("parens");return}let Le=x.close+(r.capture?")":""),He;if(x.type==="negate"){let ye=pe;if(x.inner&&x.inner.length>1&&x.inner.includes("/")&&(ye=te(r)),(ye!==pe||it()||/^\)+$/.test(Jt()))&&(Le=x.close=`)$))${ye}`),x.inner.includes("*")&&(He=Jt())&&/^\.[^\\/.]+$/.test(He)){let qt=eu(He,{...e,fastpaths:!1}).output;Le=x.close=`)${qt})${ye})`}x.prev.type==="bos"&&(N.negatedExtglob=!0)}le({type:"paren",extglob:!0,value:v,output:Le}),Cr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let x=!1,Ne=t.replace(jI,(G,ae,Le,He,ye,qt)=>He==="\\"?(x=!0,G):He==="?"?ae?ae+He+(ye?I.repeat(ye.length):""):qt===0?ne+(ye?I.repeat(ye.length):""):I.repeat(Le.length):He==="."?p.repeat(Le.length):He==="*"?ae?ae+He+(ye?pe:""):pe:ae?G:`\\${G}`);return x===!0&&(r.unescape===!0?Ne=Ne.replace(/\\/g,""):Ne=Ne.replace(/\\+/g,G=>G.length%2===0?"\\\\":G?"\\":"")),Ne===t&&r.contains===!0?(N.output=t,N):(N.output=Xe.wrapOutput(Ne,N,e),N)}for(;!it();){if(v=zt(),v==="\0")continue;if(v==="\\"){let G=me();if(G==="/"&&r.bash!==!0||G==="."||G===";")continue;if(!G){v+="\\",le({type:"text",value:v});continue}let ae=/^\\+/.exec(Jt()),Le=0;if(ae&&ae[0].length>2&&(Le=ae[0].length,N.index+=Le,Le%2!==0&&(v+="\\")),r.unescape===!0?v=zt():v+=zt(),N.brackets===0){le({type:"text",value:v});continue}}if(N.brackets>0&&(v!=="]"||D.value==="["||D.value==="[^")){if(r.posix!==!1&&v===":"){let G=D.value.slice(1);if(G.includes("[")&&(D.posix=!0,G.includes(":"))){let ae=D.value.lastIndexOf("["),Le=D.value.slice(0,ae),He=D.value.slice(ae+2),ye=YI[He];if(ye){D.value=Le+ye,N.backtrack=!0,zt(),!s.output&&o.indexOf(D)===1&&(s.output=m);continue}}}(v==="["&&me()!==":"||v==="-"&&me()==="]")&&(v=`\\${v}`),v==="]"&&(D.value==="["||D.value==="[^")&&(v=`\\${v}`),r.posix===!0&&v==="!"&&D.value==="["&&(v="^"),D.value+=v,Bs({value:v});continue}if(N.quotes===1&&v!=='"'){v=Xe.escapeRegex(v),D.value+=v,Bs({value:v});continue}if(v==='"'){N.quotes=N.quotes===1?0:1,r.keepQuotes===!0&&le({type:"text",value:v});continue}if(v==="("){Ks("parens"),le({type:"paren",value:v});continue}if(v===")"){if(N.parens===0&&r.strictBrackets===!0)throw new SyntaxError(ai("opening","("));let G=Re[Re.length-1];if(G&&N.parens===G.parens+1){_R(Re.pop());continue}le({type:"paren",value:v,output:N.parens?")":"\\)"}),Cr("parens");continue}if(v==="["){if(r.nobracket===!0||!Jt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(ai("closing","]"));v=`\\${v}`}else Ks("brackets");le({type:"bracket",value:v});continue}if(v==="]"){if(r.nobracket===!0||D&&D.type==="bracket"&&D.value.length===1){le({type:"text",value:v,output:`\\${v}`});continue}if(N.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(ai("opening","["));le({type:"text",value:v,output:`\\${v}`});continue}Cr("brackets");let G=D.value.slice(1);if(D.posix!==!0&&G[0]==="^"&&!G.includes("/")&&(v=`/${v}`),D.value+=v,Bs({value:v}),r.literalBrackets===!1||Xe.hasRegexChars(G))continue;let ae=Xe.escapeRegex(D.value);if(N.output=N.output.slice(0,-D.value.length),r.literalBrackets===!0){N.output+=ae,D.value=ae;continue}D.value=`(${a}${ae}|${D.value})`,N.output+=D.value;continue}if(v==="{"&&r.nobrace!==!0){Ks("braces");let G={type:"brace",value:v,output:"(",outputIndex:N.output.length,tokensIndex:N.tokens.length};Ie.push(G),le(G);continue}if(v==="}"){let G=Ie[Ie.length-1];if(r.nobrace===!0||!G){le({type:"text",value:v,output:v});continue}let ae=")";if(G.dots===!0){let Le=o.slice(),He=[];for(let ye=Le.length-1;ye>=0&&(o.pop(),Le[ye].type!=="brace");ye--)Le[ye].type!=="dots"&&He.unshift(Le[ye].value);ae=VI(He,r),N.backtrack=!0}if(G.comma!==!0&&G.dots!==!0){let Le=N.output.slice(0,G.outputIndex),He=N.tokens.slice(G.tokensIndex);G.value=G.output="\\{",v=ae="\\}",N.output=Le;for(let ye of He)N.output+=ye.output||ye.value}le({type:"brace",value:v,output:ae}),Cr("braces"),Ie.pop();continue}if(v==="|"){Re.length>0&&Re[Re.length-1].conditions++,le({type:"text",value:v});continue}if(v===","){let G=v,ae=Ie[Ie.length-1];ae&&Lr[Lr.length-1]==="braces"&&(ae.comma=!0,G="|"),le({type:"comma",value:v,output:G});continue}if(v==="/"){if(D.type==="dot"&&N.index===N.start+1){N.start=N.index+1,N.consumed="",N.output="",o.pop(),D=s;continue}le({type:"slash",value:v,output:f});continue}if(v==="."){if(N.braces>0&&D.type==="dot"){D.value==="."&&(D.output=p);let G=Ie[Ie.length-1];D.type="dots",D.output+=v,D.value+=v,G.dots=!0;continue}if(N.braces+N.parens===0&&D.type!=="bos"&&D.type!=="slash"){le({type:"text",value:v,output:p});continue}le({type:"dot",value:v,output:p});continue}if(v==="?"){if(!(D&&D.value==="(")&&r.noextglob!==!0&&me()==="("&&me(2)!=="?"){$s("qmark",v);continue}if(D&&D.type==="paren"){let ae=me(),Le=v;if(ae==="<"&&!Xe.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(D.value==="("&&!/[!=<:]/.test(ae)||ae==="<"&&!/<([!=]|\w+>)/.test(Jt()))&&(Le=`\\${v}`),le({type:"text",value:v,output:Le});continue}if(r.dot!==!0&&(D.type==="slash"||D.type==="bos")){le({type:"qmark",value:v,output:$});continue}le({type:"qmark",value:v,output:I});continue}if(v==="!"){if(r.noextglob!==!0&&me()==="("&&(me(2)!=="?"||!/[!=<:]/.test(me(3)))){$s("negate",v);continue}if(r.nonegate!==!0&&N.index===0){ER();continue}}if(v==="+"){if(r.noextglob!==!0&&me()==="("&&me(2)!=="?"){$s("plus",v);continue}if(D&&D.value==="("||r.regex===!1){le({type:"plus",value:v,output:d});continue}if(D&&(D.type==="bracket"||D.type==="paren"||D.type==="brace")||N.parens>0){le({type:"plus",value:v});continue}le({type:"plus",value:d});continue}if(v==="@"){if(r.noextglob!==!0&&me()==="("&&me(2)!=="?"){le({type:"at",extglob:!0,value:v,output:""});continue}le({type:"text",value:v});continue}if(v!=="*"){(v==="$"||v==="^")&&(v=`\\${v}`);let G=WI.exec(Jt());G&&(v+=G[0],N.index+=G[0].length),le({type:"text",value:v});continue}if(D&&(D.type==="globstar"||D.star===!0)){D.type="star",D.star=!0,D.value+=v,D.output=pe,N.backtrack=!0,N.globstar=!0,St(v);continue}let x=Jt();if(r.noextglob!==!0&&/^\([^?]/.test(x)){$s("star",v);continue}if(D.type==="star"){if(r.noglobstar===!0){St(v);continue}let G=D.prev,ae=G.prev,Le=G.type==="slash"||G.type==="bos",He=ae&&(ae.type==="star"||ae.type==="globstar");if(r.bash===!0&&(!Le||x[0]&&x[0]!=="/")){le({type:"star",value:v,output:""});continue}let ye=N.braces>0&&(G.type==="comma"||G.type==="brace"),qt=Re.length&&(G.type==="pipe"||G.type==="paren");if(!Le&&G.type!=="paren"&&!ye&&!qt){le({type:"star",value:v,output:""});continue}for(;x.slice(0,3)==="/**";){let Qt=t[N.index+4];if(Qt&&Qt!=="/")break;x=x.slice(3),St("/**",3)}if(G.type==="bos"&&it()){D.type="globstar",D.value+=v,D.output=te(r),N.output=D.output,N.globstar=!0,St(v);continue}if(G.type==="slash"&&G.prev.type!=="bos"&&!He&&it()){N.output=N.output.slice(0,-(G.output+D.output).length),G.output=`(?:${G.output}`,D.type="globstar",D.output=te(r)+(r.strictSlashes?")":"|$)"),D.value+=v,N.globstar=!0,N.output+=G.output+D.output,St(v);continue}if(G.type==="slash"&&G.prev.type!=="bos"&&x[0]==="/"){let Qt=x[1]!==void 0?"|$":"";N.output=N.output.slice(0,-(G.output+D.output).length),G.output=`(?:${G.output}`,D.type="globstar",D.output=`${te(r)}${f}|${f}${Qt})`,D.value+=v,N.output+=G.output+D.output,N.globstar=!0,St(v+zt()),le({type:"slash",value:"/",output:""});continue}if(G.type==="bos"&&x[0]==="/"){D.type="globstar",D.value+=v,D.output=`(?:^|${f}|${te(r)}${f})`,N.output=D.output,N.globstar=!0,St(v+zt()),le({type:"slash",value:"/",output:""});continue}N.output=N.output.slice(0,-D.output.length),D.type="globstar",D.output=te(r),D.value+=v,N.output+=D.output,N.globstar=!0,St(v);continue}let Ne={type:"star",value:v,output:pe};if(r.bash===!0){Ne.output=".*?",(D.type==="bos"||D.type==="slash")&&(Ne.output=M+Ne.output),le(Ne);continue}if(D&&(D.type==="bracket"||D.type==="paren")&&r.regex===!0){Ne.output=v,le(Ne);continue}(N.index===N.start||D.type==="slash"||D.type==="dot")&&(D.type==="dot"?(N.output+=C,D.output+=C):r.dot===!0?(N.output+=F,D.output+=F):(N.output+=M,D.output+=M),me()!=="*"&&(N.output+=m,D.output+=m)),le(Ne)}for(;N.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(ai("closing","]"));N.output=Xe.escapeLast(N.output,"["),Cr("brackets")}for(;N.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(ai("closing",")"));N.output=Xe.escapeLast(N.output,"("),Cr("parens")}for(;N.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(ai("closing","}"));N.output=Xe.escapeLast(N.output,"{"),Cr("braces")}if(r.strictSlashes!==!0&&(D.type==="star"||D.type==="bracket")&&le({type:"maybe_slash",value:"",output:`${f}?`}),N.backtrack===!0){N.output="";for(let x of N.tokens)N.output+=x.output!=null?x.output:x.value,x.suffix&&(N.output+=x.suffix)}return N};eu.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(No,r.maxLength):No,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=Vm[t]||t;let s=Xe.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:l,DOTS_SLASH:c,NO_DOT:u,NO_DOTS:p,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:m}=ds.globChars(s),_=r.dot?p:u,L=r.dot?d:u,C=r.capture?"":"?:",F={negated:!1,prefix:""},I=r.bash===!0?".*?":f;r.capture&&(I=`(${I})`);let $=M=>M.noglobstar===!0?I:`(${C}(?:(?!${m}${M.dot?c:o}).)*?)`,Q=M=>{switch(M){case"*":return`${_}${l}${I}`;case".*":return`${o}${l}${I}`;case"*.*":return`${_}${I}${o}${l}${I}`;case"*/*":return`${_}${I}${a}${l}${L}${I}`;case"**":return _+$(r);case"**/*":return`(?:${_}${$(r)}${a})?${L}${l}${I}`;case"**/*.*":return`(?:${_}${$(r)}${a})?${L}${I}${o}${l}${I}`;case"**/.*":return`(?:${_}${$(r)}${a})?${o}${l}${I}`;default:{let ne=/^(.*?)\.(\w+)$/.exec(M);if(!ne)return;let pe=Q(ne[1]);return pe?pe+o+ne[2]:void 0}}},z=Xe.removePrefix(t,F),te=Q(z);return te&&r.strictSlashes!==!0&&(te+=`${a}?`),te};qm.exports=eu});var Zm=U((ZB,Xm)=>{"use strict";var ZI=be("path"),eL=jm(),tu=Qm(),ru=cs(),tL=ls(),rL=t=>t&&typeof t=="object"&&!Array.isArray(t),Me=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(d=>Me(d,e,r));return d=>{for(let f of u){let m=f(d);if(m)return m}return!1}}let n=rL(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},s=ru.isWindows(e),o=n?Me.compileRe(t,e):Me.makeRe(t,e,!1,!0),a=o.state;delete o.state;let l=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};l=Me(i.ignore,u,r)}let c=(u,p=!1)=>{let{isMatch:d,match:f,output:m}=Me.test(u,o,e,{glob:t,posix:s}),_={glob:t,state:a,regex:o,posix:s,input:u,output:m,match:f,isMatch:d};return typeof i.onResult=="function"&&i.onResult(_),d===!1?(_.isMatch=!1,p?_:!1):l(u)?(typeof i.onIgnore=="function"&&i.onIgnore(_),_.isMatch=!1,p?_:!1):(typeof i.onMatch=="function"&&i.onMatch(_),p?_:!0)};return r&&(c.state=a),c};Me.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let s=r||{},o=s.format||(i?ru.toPosixSlashes:null),a=t===n,l=a&&o?o(t):t;return a===!1&&(l=o?o(t):t,a=l===n),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=Me.matchBase(t,e,r,i):a=e.exec(l)),{isMatch:!!a,match:a,output:l}};Me.matchBase=(t,e,r,n=ru.isWindows(r))=>(e instanceof RegExp?e:Me.makeRe(e,r)).test(ZI.basename(t));Me.isMatch=(t,e,r)=>Me(e,r)(t);Me.parse=(t,e)=>Array.isArray(t)?t.map(r=>Me.parse(r,e)):tu(t,{...e,fastpaths:!1});Me.scan=(t,e)=>eL(t,e);Me.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},s=i.contains?"":"^",o=i.contains?"":"$",a=`${s}(?:${t.output})${o}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let l=Me.toRegex(a,e);return n===!0&&(l.state=t),l};Me.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=tu.fastpaths(t,e)),i.output||(i=tu(t,e)),Me.compileRe(i,e,r,n)};Me.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Me.constants=tL;Xm.exports=Me});var th=U((e0,eh)=>{"use strict";eh.exports=Zm()});var ah=U((t0,oh)=>{"use strict";var nh=be("util"),ih=wm(),rr=th(),nu=cs(),rh=t=>t===""||t==="./",sh=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Ce=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,s=new Set,o=0,a=u=>{s.add(u.output),r&&r.onResult&&r.onResult(u)};for(let u=0;u<e.length;u++){let p=rr(String(e[u]),{...r,onResult:a},!0),d=p.state.negated||p.state.negatedExtglob;d&&o++;for(let f of t){let m=p(f,!0);(d?!m.isMatch:m.isMatch)&&(d?n.add(m.output):(n.delete(m.output),i.add(m.output)))}}let c=(o===e.length?[...s]:[...i]).filter(u=>!n.has(u));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(u=>u.replace(/\\/g,"")):e}return c};Ce.match=Ce;Ce.matcher=(t,e)=>rr(t,e);Ce.isMatch=(t,e,r)=>rr(e,r)(t);Ce.any=Ce.isMatch;Ce.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],s=a=>{r.onResult&&r.onResult(a),i.push(a.output)},o=new Set(Ce(t,e,{...r,onResult:s}));for(let a of i)o.has(a)||n.add(a);return[...n]};Ce.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${nh.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Ce.contains(t,n,r));if(typeof e=="string"){if(rh(t)||rh(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Ce.isMatch(t,e,{...r,contains:!0})};Ce.matchKeys=(t,e,r)=>{if(!nu.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Ce(Object.keys(t),e,r),i={};for(let s of n)i[s]=t[s];return i};Ce.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=rr(String(i),r);if(n.some(o=>s(o)))return!0}return!1};Ce.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=rr(String(i),r);if(!n.every(o=>s(o)))return!1}return!0};Ce.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${nh.inspect(t)}"`);return[].concat(e).every(n=>rr(n,r)(t))};Ce.capture=(t,e,r)=>{let n=nu.isWindows(r),s=rr.makeRe(String(t),{...r,capture:!0}).exec(n?nu.toPosixSlashes(e):e);if(s)return s.slice(1).map(o=>o===void 0?"":o)};Ce.makeRe=(...t)=>rr.makeRe(...t);Ce.scan=(...t)=>rr.scan(...t);Ce.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of ih(String(n),e))r.push(rr.parse(i,e));return r};Ce.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!sh(t)?[t]:ih(t,e)};Ce.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Ce.braces(t,{...e,expand:!0})};Ce.hasBraces=sh;oh.exports=Ce});var Eh=U(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.isAbsolute=Z.partitionAbsoluteAndRelative=Z.removeDuplicateSlashes=Z.matchAny=Z.convertPatternsToRe=Z.makeRe=Z.getPatternParts=Z.expandBraceExpansion=Z.expandPatternsWithBraceExpansion=Z.isAffectDepthOfReadingPattern=Z.endsWithSlashGlobStar=Z.hasGlobStar=Z.getBaseDirectory=Z.isPatternRelatedToParentDirectory=Z.getPatternsOutsideCurrentDirectory=Z.getPatternsInsideCurrentDirectory=Z.getPositivePatterns=Z.getNegativePatterns=Z.isPositivePattern=Z.isNegativePattern=Z.convertToNegativePattern=Z.convertToPositivePattern=Z.isDynamicPattern=Z.isStaticPattern=void 0;var lh=be("path"),nL=Qf(),iu=ah(),ch="**",iL="\\",sL=/[*?]|^!/,oL=/\[[^[]*]/,aL=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,lL=/[!*+?@]\([^(]*\)/,cL=/,|\.\./,uL=/(?!^)\/{2,}/g;function uh(t,e={}){return!dh(t,e)}Z.isStaticPattern=uh;function dh(t,e={}){return t===""?!1:!!(e.caseSensitiveMatch===!1||t.includes(iL)||sL.test(t)||oL.test(t)||aL.test(t)||e.extglob!==!1&&lL.test(t)||e.braceExpansion!==!1&&dL(t))}Z.isDynamicPattern=dh;function dL(t){let e=t.indexOf("{");if(e===-1)return!1;let r=t.indexOf("}",e+1);if(r===-1)return!1;let n=t.slice(e,r);return cL.test(n)}function pL(t){return Po(t)?t.slice(1):t}Z.convertToPositivePattern=pL;function gL(t){return"!"+t}Z.convertToNegativePattern=gL;function Po(t){return t.startsWith("!")&&t[1]!=="("}Z.isNegativePattern=Po;function ph(t){return!Po(t)}Z.isPositivePattern=ph;function fL(t){return t.filter(Po)}Z.getNegativePatterns=fL;function mL(t){return t.filter(ph)}Z.getPositivePatterns=mL;function hL(t){return t.filter(e=>!su(e))}Z.getPatternsInsideCurrentDirectory=hL;function EL(t){return t.filter(su)}Z.getPatternsOutsideCurrentDirectory=EL;function su(t){return t.startsWith("..")||t.startsWith("./..")}Z.isPatternRelatedToParentDirectory=su;function _L(t){return nL(t,{flipBackslashes:!1})}Z.getBaseDirectory=_L;function SL(t){return t.includes(ch)}Z.hasGlobStar=SL;function gh(t){return t.endsWith("/"+ch)}Z.endsWithSlashGlobStar=gh;function TL(t){let e=lh.basename(t);return gh(t)||uh(e)}Z.isAffectDepthOfReadingPattern=TL;function AL(t){return t.reduce((e,r)=>e.concat(fh(r)),[])}Z.expandPatternsWithBraceExpansion=AL;function fh(t){let e=iu.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((r,n)=>r.length-n.length),e.filter(r=>r!=="")}Z.expandBraceExpansion=fh;function RL(t,e){let{parts:r}=iu.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return r.length===0&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}Z.getPatternParts=RL;function mh(t,e){return iu.makeRe(t,e)}Z.makeRe=mh;function yL(t,e){return t.map(r=>mh(r,e))}Z.convertPatternsToRe=yL;function OL(t,e){return e.some(r=>r.test(t))}Z.matchAny=OL;function IL(t){return t.replace(uL,"/")}Z.removeDuplicateSlashes=IL;function LL(t){let e=[],r=[];for(let n of t)hh(n)?e.push(n):r.push(n);return[e,r]}Z.partitionAbsoluteAndRelative=LL;function hh(t){return lh.isAbsolute(t)}Z.isAbsolute=hh});var Ah=U((n0,Th)=>{"use strict";var CL=be("stream"),_h=CL.PassThrough,NL=Array.prototype.slice;Th.exports=PL;function PL(){let t=[],e=NL.call(arguments),r=!1,n=e[e.length-1];n&&!Array.isArray(n)&&n.pipe==null?e.pop():n={};let i=n.end!==!1,s=n.pipeError===!0;n.objectMode==null&&(n.objectMode=!0),n.highWaterMark==null&&(n.highWaterMark=64*1024);let o=_h(n);function a(){for(let u=0,p=arguments.length;u<p;u++)t.push(Sh(arguments[u],n));return l(),this}function l(){if(r)return;r=!0;let u=t.shift();if(!u){process.nextTick(c);return}Array.isArray(u)||(u=[u]);let p=u.length+1;function d(){--p>0||(r=!1,l())}function f(m){function _(){m.removeListener("merge2UnpipeEnd",_),m.removeListener("end",_),s&&m.removeListener("error",L),d()}function L(C){o.emit("error",C)}if(m._readableState.endEmitted)return d();m.on("merge2UnpipeEnd",_),m.on("end",_),s&&m.on("error",L),m.pipe(o,{end:!1}),m.resume()}for(let m=0;m<u.length;m++)f(u[m]);d()}function c(){r=!1,o.emit("queueDrain"),i&&o.end()}return o.setMaxListeners(0),o.add=a,o.on("unpipe",function(u){u.emit("merge2UnpipeEnd")}),e.length&&a.apply(null,e),o}function Sh(t,e){if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++)t[r]=Sh(t[r],e);else{if(!t._readableState&&t.pipe&&(t=t.pipe(_h(e))),!t._readableState||!t.pause||!t.pipe)throw new Error("Only readable stream can be merged.");t.pause()}return t}});var yh=U(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.merge=void 0;var DL=Ah();function vL(t){let e=DL(t);return t.forEach(r=>{r.once("error",n=>e.emit("error",n))}),e.once("close",()=>Rh(t)),e.once("end",()=>Rh(t)),e}Do.merge=vL;function Rh(t){t.forEach(e=>e.emit("close"))}});var Oh=U(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.isEmpty=li.isString=void 0;function bL(t){return typeof t=="string"}li.isString=bL;function wL(t){return t===""}li.isEmpty=wL});var Sr=U(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.string=Ze.stream=Ze.pattern=Ze.path=Ze.fs=Ze.errno=Ze.array=void 0;var FL=xf();Ze.array=FL;var ML=Uf();Ze.errno=ML;var kL=Hf();Ze.fs=kL;var GL=Yf();Ze.path=GL;var xL=Eh();Ze.pattern=xL;var UL=yh();Ze.stream=UL;var HL=Oh();Ze.string=HL});var Nh=U(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.convertPatternGroupToTask=et.convertPatternGroupsToTasks=et.groupPatternsByBaseDirectory=et.getNegativePatternsAsPositive=et.getPositivePatterns=et.convertPatternsToTasks=et.generate=void 0;var Bt=Sr();function BL(t,e){let r=Ih(t,e),n=Ih(e.ignore,e),i=Lh(r),s=Ch(r,n),o=i.filter(u=>Bt.pattern.isStaticPattern(u,e)),a=i.filter(u=>Bt.pattern.isDynamicPattern(u,e)),l=ou(o,s,!1),c=ou(a,s,!0);return l.concat(c)}et.generate=BL;function Ih(t,e){let r=t;return e.braceExpansion&&(r=Bt.pattern.expandPatternsWithBraceExpansion(r)),e.baseNameMatch&&(r=r.map(n=>n.includes("/")?n:`**/${n}`)),r.map(n=>Bt.pattern.removeDuplicateSlashes(n))}function ou(t,e,r){let n=[],i=Bt.pattern.getPatternsOutsideCurrentDirectory(t),s=Bt.pattern.getPatternsInsideCurrentDirectory(t),o=au(i),a=au(s);return n.push(...lu(o,e,r)),"."in a?n.push(cu(".",s,e,r)):n.push(...lu(a,e,r)),n}et.convertPatternsToTasks=ou;function Lh(t){return Bt.pattern.getPositivePatterns(t)}et.getPositivePatterns=Lh;function Ch(t,e){return Bt.pattern.getNegativePatterns(t).concat(e).map(Bt.pattern.convertToPositivePattern)}et.getNegativePatternsAsPositive=Ch;function au(t){let e={};return t.reduce((r,n)=>{let i=Bt.pattern.getBaseDirectory(n);return i in r?r[i].push(n):r[i]=[n],r},e)}et.groupPatternsByBaseDirectory=au;function lu(t,e,r){return Object.keys(t).map(n=>cu(n,t[n],e,r))}et.convertPatternGroupsToTasks=lu;function cu(t,e,r,n){return{dynamic:n,positive:e,negative:r,base:t,patterns:[].concat(e,r.map(Bt.pattern.convertToNegativePattern))}}et.convertPatternGroupToTask=cu});var Dh=U(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.read=void 0;function KL(t,e,r){e.fs.lstat(t,(n,i)=>{if(n!==null){Ph(r,n);return}if(!i.isSymbolicLink()||!e.followSymbolicLink){uu(r,i);return}e.fs.stat(t,(s,o)=>{if(s!==null){if(e.throwErrorOnBrokenSymbolicLink){Ph(r,s);return}uu(r,i);return}e.markSymbolicLink&&(o.isSymbolicLink=()=>!0),uu(r,o)})})}vo.read=KL;function Ph(t,e){t(e)}function uu(t,e){t(null,e)}});var vh=U(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.read=void 0;function $L(t,e){let r=e.fs.lstatSync(t);if(!r.isSymbolicLink()||!e.followSymbolicLink)return r;try{let n=e.fs.statSync(t);return e.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(n){if(!e.throwErrorOnBrokenSymbolicLink)return r;throw n}}bo.read=$L});var bh=U(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.createFileSystemAdapter=Hr.FILE_SYSTEM_ADAPTER=void 0;var wo=be("fs");Hr.FILE_SYSTEM_ADAPTER={lstat:wo.lstat,stat:wo.stat,lstatSync:wo.lstatSync,statSync:wo.statSync};function YL(t){return t===void 0?Hr.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Hr.FILE_SYSTEM_ADAPTER),t)}Hr.createFileSystemAdapter=YL});var wh=U(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});var WL=bh(),du=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=WL.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,r){return e??r}};pu.default=du});var yn=U(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.statSync=Br.stat=Br.Settings=void 0;var Fh=Dh(),jL=vh(),gu=wh();Br.Settings=gu.default;function VL(t,e,r){if(typeof e=="function"){Fh.read(t,fu(),e);return}Fh.read(t,fu(e),r)}Br.stat=VL;function zL(t,e){let r=fu(e);return jL.read(t,r)}Br.statSync=zL;function fu(t={}){return t instanceof gu.default?t:new gu.default(t)}});var Gh=U((g0,kh)=>{"use strict";var Mh;kh.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):t=>(Mh||(Mh=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var Uh=U((f0,xh)=>{"use strict";xh.exports=qL;var JL=Gh();function qL(t,e){let r,n,i,s=!0;Array.isArray(t)?(r=[],n=t.length):(i=Object.keys(t),r={},n=i.length);function o(l){function c(){e&&e(l,r),e=null}s?JL(c):c()}function a(l,c,u){r[l]=u,(--n===0||c)&&o(c)}n?i?i.forEach(function(l){t[l](function(c,u){a(l,c,u)})}):t.forEach(function(l,c){l(function(u,p){a(c,u,p)})}):o(null),s=!1}});var mu=U(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var Fo=process.versions.node.split(".");if(Fo[0]===void 0||Fo[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var Hh=Number.parseInt(Fo[0],10),QL=Number.parseInt(Fo[1],10),Bh=10,XL=10,ZL=Hh>Bh,eC=Hh===Bh&&QL>=XL;Mo.IS_SUPPORT_READDIR_WITH_FILE_TYPES=ZL||eC});var Kh=U(ko=>{"use strict";Object.defineProperty(ko,"__esModule",{value:!0});ko.createDirentFromStats=void 0;var hu=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function tC(t,e){return new hu(t,e)}ko.createDirentFromStats=tC});var Eu=U(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.fs=void 0;var rC=Kh();Go.fs=rC});var _u=U(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.joinPathSegments=void 0;function nC(t,e,r){return t.endsWith(r)?t+e:t+r+e}xo.joinPathSegments=nC});var zh=U(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.readdir=Kr.readdirWithFileTypes=Kr.read=void 0;var iC=yn(),$h=Uh(),sC=mu(),Yh=Eu(),Wh=_u();function oC(t,e,r){if(!e.stats&&sC.IS_SUPPORT_READDIR_WITH_FILE_TYPES){jh(t,e,r);return}Vh(t,e,r)}Kr.read=oC;function jh(t,e,r){e.fs.readdir(t,{withFileTypes:!0},(n,i)=>{if(n!==null){Uo(r,n);return}let s=i.map(a=>({dirent:a,name:a.name,path:Wh.joinPathSegments(t,a.name,e.pathSegmentSeparator)}));if(!e.followSymbolicLinks){Su(r,s);return}let o=s.map(a=>aC(a,e));$h(o,(a,l)=>{if(a!==null){Uo(r,a);return}Su(r,l)})})}Kr.readdirWithFileTypes=jh;function aC(t,e){return r=>{if(!t.dirent.isSymbolicLink()){r(null,t);return}e.fs.stat(t.path,(n,i)=>{if(n!==null){if(e.throwErrorOnBrokenSymbolicLink){r(n);return}r(null,t);return}t.dirent=Yh.fs.createDirentFromStats(t.name,i),r(null,t)})}}function Vh(t,e,r){e.fs.readdir(t,(n,i)=>{if(n!==null){Uo(r,n);return}let s=i.map(o=>{let a=Wh.joinPathSegments(t,o,e.pathSegmentSeparator);return l=>{iC.stat(a,e.fsStatSettings,(c,u)=>{if(c!==null){l(c);return}let p={name:o,path:a,dirent:Yh.fs.createDirentFromStats(o,u)};e.stats&&(p.stats=u),l(null,p)})}});$h(s,(o,a)=>{if(o!==null){Uo(r,o);return}Su(r,a)})})}Kr.readdir=Vh;function Uo(t,e){t(e)}function Su(t,e){t(null,e)}});var Zh=U($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.readdir=$r.readdirWithFileTypes=$r.read=void 0;var lC=yn(),cC=mu(),Jh=Eu(),qh=_u();function uC(t,e){return!e.stats&&cC.IS_SUPPORT_READDIR_WITH_FILE_TYPES?Qh(t,e):Xh(t,e)}$r.read=uC;function Qh(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(n=>{let i={dirent:n,name:n.name,path:qh.joinPathSegments(t,n.name,e.pathSegmentSeparator)};if(i.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{let s=e.fs.statSync(i.path);i.dirent=Jh.fs.createDirentFromStats(i.name,s)}catch(s){if(e.throwErrorOnBrokenSymbolicLink)throw s}return i})}$r.readdirWithFileTypes=Qh;function Xh(t,e){return e.fs.readdirSync(t).map(n=>{let i=qh.joinPathSegments(t,n,e.pathSegmentSeparator),s=lC.statSync(i,e.fsStatSettings),o={name:n,path:i,dirent:Jh.fs.createDirentFromStats(n,s)};return e.stats&&(o.stats=s),o})}$r.readdir=Xh});var eE=U(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.createFileSystemAdapter=Yr.FILE_SYSTEM_ADAPTER=void 0;var ci=be("fs");Yr.FILE_SYSTEM_ADAPTER={lstat:ci.lstat,stat:ci.stat,lstatSync:ci.lstatSync,statSync:ci.statSync,readdir:ci.readdir,readdirSync:ci.readdirSync};function dC(t){return t===void 0?Yr.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Yr.FILE_SYSTEM_ADAPTER),t)}Yr.createFileSystemAdapter=dC});var tE=U(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});var pC=be("path"),gC=yn(),fC=eE(),Tu=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=fC.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,pC.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new gC.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};Au.default=Tu});var Ho=U(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.Settings=Wr.scandirSync=Wr.scandir=void 0;var rE=zh(),mC=Zh(),Ru=tE();Wr.Settings=Ru.default;function hC(t,e,r){if(typeof e=="function"){rE.read(t,yu(),e);return}rE.read(t,yu(e),r)}Wr.scandir=hC;function EC(t,e){let r=yu(e);return mC.read(t,r)}Wr.scandirSync=EC;function yu(t={}){return t instanceof Ru.default?t:new Ru.default(t)}});var iE=U((O0,nE)=>{"use strict";function _C(t){var e=new t,r=e;function n(){var s=e;return s.next?e=s.next:(e=new t,r=e),s.next=null,s}function i(s){r.next=s,r=s}return{get:n,release:i}}nE.exports=_C});var oE=U((I0,Ou)=>{"use strict";var SC=iE();function sE(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),!(r>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var n=SC(TC),i=null,s=null,o=0,a=null,l={push:_,drain:ht,saturated:ht,pause:u,paused:!1,get concurrency(){return r},set concurrency(z){if(!(z>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(r=z,!l.paused)for(;i&&o<r;)o++,C()},running:c,resume:f,idle:m,length:p,getQueue:d,unshift:L,empty:ht,kill:F,killAndDrain:I,error:Q,abort:$};return l;function c(){return o}function u(){l.paused=!0}function p(){for(var z=i,te=0;z;)z=z.next,te++;return te}function d(){for(var z=i,te=[];z;)te.push(z.value),z=z.next;return te}function f(){if(l.paused){if(l.paused=!1,i===null){o++,C();return}for(;i&&o<r;)o++,C()}}function m(){return o===0&&l.length()===0}function _(z,te){var M=n.get();M.context=t,M.release=C,M.value=z,M.callback=te||ht,M.errorHandler=a,o>=r||l.paused?s?(s.next=M,s=M):(i=M,s=M,l.saturated()):(o++,e.call(t,M.value,M.worked))}function L(z,te){var M=n.get();M.context=t,M.release=C,M.value=z,M.callback=te||ht,M.errorHandler=a,o>=r||l.paused?i?(M.next=i,i=M):(i=M,s=M,l.saturated()):(o++,e.call(t,M.value,M.worked))}function C(z){z&&n.release(z);var te=i;te&&o<=r?l.paused?o--:(s===i&&(s=null),i=te.next,te.next=null,e.call(t,te.value,te.worked),s===null&&l.empty()):--o===0&&l.drain()}function F(){i=null,s=null,l.drain=ht}function I(){i=null,s=null,l.drain(),l.drain=ht}function $(){var z=i;for(i=null,s=null;z;){var te=z.next,M=z.callback,ne=z.errorHandler,pe=z.value,N=z.context;z.value=null,z.callback=ht,z.errorHandler=null,ne&&ne(new Error("abort"),pe),M.call(N,new Error("abort")),z.release(z),z=te}l.drain=ht}function Q(z){a=z}}function ht(){}function TC(){this.value=null,this.callback=ht,this.next=null,this.release=ht,this.context=null,this.errorHandler=null;var t=this;this.worked=function(r,n){var i=t.callback,s=t.errorHandler,o=t.value;t.value=null,t.callback=ht,t.errorHandler&&s(r,o),i.call(t.context,r,n),t.release(t)}}function AC(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function n(u,p){e.call(this,u).then(function(d){p(null,d)},p)}var i=sE(t,n,r),s=i.push,o=i.unshift;return i.push=a,i.unshift=l,i.drained=c,i;function a(u){var p=new Promise(function(d,f){s(u,function(m,_){if(m){f(m);return}d(_)})});return p.catch(ht),p}function l(u){var p=new Promise(function(d,f){o(u,function(m,_){if(m){f(m);return}d(_)})});return p.catch(ht),p}function c(){var u=new Promise(function(p){process.nextTick(function(){if(i.idle())p();else{var d=i.drain;i.drain=function(){typeof d=="function"&&d(),p(),i.drain=d}}})});return u}}Ou.exports=sE;Ou.exports.promise=AC});var Bo=U(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.joinPathSegments=nr.replacePathSegmentSeparator=nr.isAppliedFilter=nr.isFatalError=void 0;function RC(t,e){return t.errorFilter===null?!0:!t.errorFilter(e)}nr.isFatalError=RC;function yC(t,e){return t===null||t(e)}nr.isAppliedFilter=yC;function OC(t,e){return t.split(/[/\\]/).join(e)}nr.replacePathSegmentSeparator=OC;function IC(t,e,r){return t===""?e:t.endsWith(r)?t+e:t+r+e}nr.joinPathSegments=IC});var Cu=U(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});var LC=Bo(),Iu=class{constructor(e,r){this._root=e,this._settings=r,this._root=LC.replacePathSegmentSeparator(e,r.pathSegmentSeparator)}};Lu.default=Iu});var Du=U(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});var CC=be("events"),NC=Ho(),PC=oE(),Ko=Bo(),DC=Cu(),Nu=class extends DC.default{constructor(e,r){super(e,r),this._settings=r,this._scandir=NC.scandir,this._emitter=new CC.EventEmitter,this._queue=PC(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,r){let n={directory:e,base:r};this._queue.push(n,i=>{i!==null&&this._handleError(i)})}_worker(e,r){this._scandir(e.directory,this._settings.fsScandirSettings,(n,i)=>{if(n!==null){r(n,void 0);return}for(let s of i)this._handleEntry(s,e.base);r(null,void 0)})}_handleError(e){this._isDestroyed||!Ko.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,r){if(this._isDestroyed||this._isFatalError)return;let n=e.path;r!==void 0&&(e.path=Ko.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),Ko.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&Ko.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}};Pu.default=Nu});var aE=U(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});var vC=Du(),vu=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new vC.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(r=>{bC(e,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{wC(e,this._storage)}),this._reader.read()}};bu.default=vu;function bC(t,e){t(e)}function wC(t,e){t(null,e)}});var lE=U(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});var FC=be("stream"),MC=Du(),wu=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new MC.default(this._root,this._settings),this._stream=new FC.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit("error",e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};Fu.default=wu});var cE=U(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});var kC=Ho(),$o=Bo(),GC=Cu(),Mu=class extends GC.default{constructor(){super(...arguments),this._scandir=kC.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,r){this._queue.add({directory:e,base:r})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,r){try{let n=this._scandir(e,this._settings.fsScandirSettings);for(let i of n)this._handleEntry(i,r)}catch(n){this._handleError(n)}}_handleError(e){if($o.isFatalError(this._settings,e))throw e}_handleEntry(e,r){let n=e.path;r!==void 0&&(e.path=$o.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),$o.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&$o.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}};ku.default=Mu});var uE=U(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});var xC=cE(),Gu=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new xC.default(this._root,this._settings)}read(){return this._reader.read()}};xu.default=Gu});var dE=U(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});var UC=be("path"),HC=Ho(),Uu=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,UC.sep),this.fsScandirSettings=new HC.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};Hu.default=Uu});var Wo=U(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.Settings=ir.walkStream=ir.walkSync=ir.walk=void 0;var pE=aE(),BC=lE(),KC=uE(),Bu=dE();ir.Settings=Bu.default;function $C(t,e,r){if(typeof e=="function"){new pE.default(t,Yo()).read(e);return}new pE.default(t,Yo(e)).read(r)}ir.walk=$C;function YC(t,e){let r=Yo(e);return new KC.default(t,r).read()}ir.walkSync=YC;function WC(t,e){let r=Yo(e);return new BC.default(t,r).read()}ir.walkStream=WC;function Yo(t={}){return t instanceof Bu.default?t:new Bu.default(t)}});var jo=U($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});var jC=be("path"),VC=yn(),gE=Sr(),Ku=class{constructor(e){this._settings=e,this._fsStatSettings=new VC.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return jC.resolve(this._settings.cwd,e)}_makeEntry(e,r){let n={name:r,path:r,dirent:gE.fs.createDirentFromStats(r,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!gE.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};$u.default=Ku});var ju=U(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});var zC=be("stream"),JC=yn(),qC=Wo(),QC=jo(),Yu=class extends QC.default{constructor(){super(...arguments),this._walkStream=qC.walkStream,this._stat=JC.stat}dynamic(e,r){return this._walkStream(e,r)}static(e,r){let n=e.map(this._getFullEntryPath,this),i=new zC.PassThrough({objectMode:!0});i._write=(s,o,a)=>this._getEntry(n[s],e[s],r).then(l=>{l!==null&&r.entryFilter(l)&&i.push(l),s===n.length-1&&i.end(),a()}).catch(a);for(let s=0;s<n.length;s++)i.write(s);return i}_getEntry(e,r,n){return this._getStat(e).then(i=>this._makeEntry(i,r)).catch(i=>{if(n.errorFilter(i))return null;throw i})}_getStat(e){return new Promise((r,n)=>{this._stat(e,this._fsStatSettings,(i,s)=>i===null?r(s):n(i))})}};Wu.default=Yu});var fE=U(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});var XC=Wo(),ZC=jo(),eN=ju(),Vu=class extends ZC.default{constructor(){super(...arguments),this._walkAsync=XC.walk,this._readerStream=new eN.default(this._settings)}dynamic(e,r){return new Promise((n,i)=>{this._walkAsync(e,r,(s,o)=>{s===null?n(o):i(s)})})}async static(e,r){let n=[],i=this._readerStream.static(e,r);return new Promise((s,o)=>{i.once("error",o),i.on("data",a=>n.push(a)),i.once("end",()=>s(n))})}};zu.default=Vu});var mE=U(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});var ps=Sr(),Ju=class{constructor(e,r,n){this._patterns=e,this._settings=r,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let r=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(r);this._storage.push({complete:n.length<=1,pattern:e,segments:r,sections:n})}}_getPatternSegments(e){return ps.pattern.getPatternParts(e,this._micromatchOptions).map(n=>ps.pattern.isDynamicPattern(n,this._settings)?{dynamic:!0,pattern:n,patternRe:ps.pattern.makeRe(n,this._micromatchOptions)}:{dynamic:!1,pattern:n})}_splitSegmentsIntoSections(e){return ps.array.splitWhen(e,r=>r.dynamic&&ps.pattern.hasGlobStar(r.pattern))}};qu.default=Ju});var hE=U(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});var tN=mE(),Qu=class extends tN.default{match(e){let r=e.split("/"),n=r.length,i=this._storage.filter(s=>!s.complete||s.segments.length>n);for(let s of i){let o=s.sections[0];if(!s.complete&&n>o.length||r.every((l,c)=>{let u=s.segments[c];return!!(u.dynamic&&u.patternRe.test(l)||!u.dynamic&&u.pattern===l)}))return!0}return!1}};Xu.default=Qu});var EE=U(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});var Vo=Sr(),rN=hE(),Zu=class{constructor(e,r){this._settings=e,this._micromatchOptions=r}getFilter(e,r,n){let i=this._getMatcher(r),s=this._getNegativePatternsRe(n);return o=>this._filter(e,o,i,s)}_getMatcher(e){return new rN.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let r=e.filter(Vo.pattern.isAffectDepthOfReadingPattern);return Vo.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(e,r,n,i){if(this._isSkippedByDeep(e,r.path)||this._isSkippedSymbolicLink(r))return!1;let s=Vo.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(s,n)?!1:this._isSkippedByNegativePatterns(s,i)}_isSkippedByDeep(e,r){return this._settings.deep===1/0?!1:this._getEntryLevel(e,r)>=this._settings.deep}_getEntryLevel(e,r){let n=r.split("/").length;if(e==="")return n;let i=e.split("/").length;return n-i}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,r){return!this._settings.baseNameMatch&&!r.match(e)}_isSkippedByNegativePatterns(e,r){return!Vo.pattern.matchAny(e,r)}};ed.default=Zu});var _E=U(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});var jr=Sr(),td=class{constructor(e,r){this._settings=e,this._micromatchOptions=r,this.index=new Map}getFilter(e,r){let[n,i]=jr.pattern.partitionAbsoluteAndRelative(r),s={positive:{all:jr.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:jr.pattern.convertPatternsToRe(n,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:jr.pattern.convertPatternsToRe(i,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return o=>this._filter(o,s)}_filter(e,r){let n=jr.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(n)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;let i=this._isMatchToPatternsSet(n,r,e.dirent.isDirectory());return this._settings.unique&&i&&this._createIndexRecord(n),i}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isMatchToPatternsSet(e,r,n){return!(!this._isMatchToPatterns(e,r.positive.all,n)||this._isMatchToPatterns(e,r.negative.relative,n)||this._isMatchToAbsoluteNegative(e,r.negative.absolute,n))}_isMatchToAbsoluteNegative(e,r,n){if(r.length===0)return!1;let i=jr.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(i,r,n)}_isMatchToPatterns(e,r,n){if(r.length===0)return!1;let i=jr.pattern.matchAny(e,r);return!i&&n?jr.pattern.matchAny(e+"/",r):i}};rd.default=td});var SE=U(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});var nN=Sr(),nd=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return nN.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};id.default=nd});var AE=U(od=>{"use strict";Object.defineProperty(od,"__esModule",{value:!0});var TE=Sr(),sd=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let r=e.path;return this._settings.absolute&&(r=TE.path.makeAbsolute(this._settings.cwd,r),r=TE.path.unixify(r)),this._settings.markDirectories&&e.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:r}):r}};od.default=sd});var zo=U(ld=>{"use strict";Object.defineProperty(ld,"__esModule",{value:!0});var iN=be("path"),sN=EE(),oN=_E(),aN=SE(),lN=AE(),ad=class{constructor(e){this._settings=e,this.errorFilter=new aN.default(this._settings),this.entryFilter=new oN.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new sN.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new lN.default(this._settings)}_getRootDirectory(e){return iN.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let r=e.base==="."?"":e.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};ld.default=ad});var RE=U(ud=>{"use strict";Object.defineProperty(ud,"__esModule",{value:!0});var cN=fE(),uN=zo(),cd=class extends uN.default{constructor(){super(...arguments),this._reader=new cN.default(this._settings)}async read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(r,e,n)).map(s=>n.transform(s))}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};ud.default=cd});var yE=U(pd=>{"use strict";Object.defineProperty(pd,"__esModule",{value:!0});var dN=be("stream"),pN=ju(),gN=zo(),dd=class extends gN.default{constructor(){super(...arguments),this._reader=new pN.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e),i=this.api(r,e,n),s=new dN.Readable({objectMode:!0,read:()=>{}});return i.once("error",o=>s.emit("error",o)).on("data",o=>s.emit("data",n.transform(o))).once("end",()=>s.emit("end")),s.once("close",()=>i.destroy()),s}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};pd.default=dd});var OE=U(fd=>{"use strict";Object.defineProperty(fd,"__esModule",{value:!0});var fN=yn(),mN=Wo(),hN=jo(),gd=class extends hN.default{constructor(){super(...arguments),this._walkSync=mN.walkSync,this._statSync=fN.statSync}dynamic(e,r){return this._walkSync(e,r)}static(e,r){let n=[];for(let i of e){let s=this._getFullEntryPath(i),o=this._getEntry(s,i,r);o===null||!r.entryFilter(o)||n.push(o)}return n}_getEntry(e,r,n){try{let i=this._getStat(e);return this._makeEntry(i,r)}catch(i){if(n.errorFilter(i))return null;throw i}}_getStat(e){return this._statSync(e,this._fsStatSettings)}};fd.default=gd});var IE=U(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});var EN=OE(),_N=zo(),md=class extends _N.default{constructor(){super(...arguments),this._reader=new EN.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(r,e,n).map(n.transform)}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};hd.default=md});var LE=U(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var ui=be("fs"),SN=be("os"),TN=Math.max(SN.cpus().length,1);di.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:ui.lstat,lstatSync:ui.lstatSync,stat:ui.stat,statSync:ui.statSync,readdir:ui.readdir,readdirSync:ui.readdirSync};var Ed=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,TN),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,r){return e===void 0?r:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},di.DEFAULT_FILE_SYSTEM_ADAPTER),e)}};di.default=Ed});var Ad=U((q0,NE)=>{"use strict";var CE=Nh(),AN=RE(),RN=yE(),yN=IE(),_d=LE(),vt=Sr();async function Sd(t,e){Kt(t);let r=Td(t,AN.default,e),n=await Promise.all(r);return vt.array.flatten(n)}(function(t){t.glob=t,t.globSync=e,t.globStream=r,t.async=t;function e(c,u){Kt(c);let p=Td(c,yN.default,u);return vt.array.flatten(p)}t.sync=e;function r(c,u){Kt(c);let p=Td(c,RN.default,u);return vt.stream.merge(p)}t.stream=r;function n(c,u){Kt(c);let p=[].concat(c),d=new _d.default(u);return CE.generate(p,d)}t.generateTasks=n;function i(c,u){Kt(c);let p=new _d.default(u);return vt.pattern.isDynamicPattern(c,p)}t.isDynamicPattern=i;function s(c){return Kt(c),vt.path.escape(c)}t.escapePath=s;function o(c){return Kt(c),vt.path.convertPathToPattern(c)}t.convertPathToPattern=o;let a;(function(c){function u(d){return Kt(d),vt.path.escapePosixPath(d)}c.escapePath=u;function p(d){return Kt(d),vt.path.convertPosixPathToPattern(d)}c.convertPathToPattern=p})(a=t.posix||(t.posix={}));let l;(function(c){function u(d){return Kt(d),vt.path.escapeWindowsPath(d)}c.escapePath=u;function p(d){return Kt(d),vt.path.convertWindowsPathToPattern(d)}c.convertPathToPattern=p})(l=t.win32||(t.win32={}))})(Sd||(Sd={}));function Td(t,e,r){let n=[].concat(t),i=new _d.default(r),s=CE.generate(n,i),o=new e(i);return s.map(o.read,o)}function Kt(t){if(![].concat(t).every(n=>vt.string.isString(n)&&!vt.string.isEmpty(n)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}NE.exports=Sd});var GE=U((Q0,Qo)=>{"use strict";function vE(t){return Array.isArray(t)?t:[t]}var ON=void 0,yd="",PE=" ",Rd="\\",IN=/^\s+$/,LN=/(?:[^\\]|^)\\$/,CN=/^\\!/,NN=/^\\#/,PN=/\r?\n/g,DN=/^\.{0,2}\/|^\.{1,2}$/,vN=/\/$/,pi="/",bE="node-ignore";typeof Symbol<"u"&&(bE=Symbol.for("node-ignore"));var wE=bE,gi=(t,e,r)=>(Object.defineProperty(t,e,{value:r}),r),bN=/([0-z])-([0-z])/g,FE=()=>!1,wN=t=>t.replace(bN,(e,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?e:yd),FN=t=>t.startsWith("!")||t.startsWith("\\^")?`^${t.slice(t[0]==="!"?1:2)}`:t,MN=t=>{let{length:e}=t;return t.slice(0,e-e%2)},kN=[[/^\uFEFF/,()=>yd],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?PE:yd)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+PE}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*(?:\\\*\\\*\\\/)+/,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let n=r.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Rd],[/\\\\/g,()=>Rd],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,n,i)=>e===Rd?`\\[${r}${MN(n)}${i}`:i==="]"&&n.length%2===0?`[${FN(wN(r))}${n}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`]],GN=/(^|\\\/)?\\\*$/,gs="regex",Jo="checkRegex",DE="_",xN={[gs](t,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[Jo](t,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},UN=t=>kN.reduce((e,[r,n])=>e.replace(r,n.bind(t)),t),qo=t=>typeof t=="string",HN=t=>t&&qo(t)&&!IN.test(t)&&!LN.test(t)&&t.indexOf("#")!==0,BN=t=>t.split(PN).filter(Boolean),Od=class{constructor(e,r,n,i,s,o){this.pattern=e,this.mark=r,this.negative=s,gi(this,"body",n),gi(this,"ignoreCase",i),gi(this,"regexPrefix",o)}get regex(){let e=DE+gs;return this[e]?this[e]:this._make(gs,e)}get checkRegex(){let e=DE+Jo;return this[e]?this[e]:this._make(Jo,e)}_make(e,r){let n=this.regexPrefix.replace(GN,xN[e]),i=this.ignoreCase?new RegExp(n,"i"):new RegExp(n);return gi(this,r,i)}},KN=({pattern:t,mark:e},r)=>{let n=!1,i=t;i.indexOf("!")===0&&(n=!0,i=i.substr(1)),i=i.replace(CN,"!").replace(NN,"#");let s=UN(i);return new Od(t,e,i,r,n,s)},Id=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[wE]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(qo(e)&&(e={pattern:e}),HN(e.pattern)){let r=KN(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,vE(qo(e)?BN(e):e).forEach(this._add,this),this._added}test(e,r,n){let i=!1,s=!1,o;this._rules.forEach(l=>{let{negative:c}=l;s===c&&i!==s||c&&!i&&!s&&!r||!l[n].test(e)||(i=!c,s=c,o=c?ON:l)});let a={ignored:i,unignored:s};return o&&(a.rule=o),a}},$N=(t,e)=>{throw new e(t)},Tr=(t,e,r)=>qo(t)?t?Tr.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),ME=t=>DN.test(t);Tr.isNotRelative=ME;Tr.convert=t=>t;var Ld=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:n=!1}={}){gi(this,wE,!0),this._rules=new Id(r),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,r,n,i){let s=e&&Tr.convert(e);return Tr(s,e,this._strictPathCheck?$N:FE),this._t(s,r,n,i)}checkIgnore(e){if(!vN.test(e))return this.test(e);let r=e.split(pi).filter(Boolean);if(r.pop(),r.length){let n=this._t(r.join(pi)+pi,this._testCache,!0,r);if(n.ignored)return n}return this._rules.test(e,!1,Jo)}_t(e,r,n,i){if(e in r)return r[e];if(i||(i=e.split(pi).filter(Boolean)),i.pop(),!i.length)return r[e]=this._rules.test(e,n,gs);let s=this._t(i.join(pi)+pi,r,n,i);return r[e]=s.ignored?s:this._rules.test(e,n,gs)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return vE(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},Cd=t=>new Ld(t),YN=t=>Tr(t&&Tr.convert(t),t,FE),kE=()=>{let t=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Tr.convert=t;let e=/^[a-z]:\//i;Tr.isNotRelative=r=>e.test(r)||ME(r)};typeof process<"u"&&process.platform==="win32"&&kE();Qo.exports=Cd;Cd.default=Cd;Qo.exports.isPathValid=YN;gi(Qo.exports,Symbol.for("setupWindows"),kE)});import*as fR from"dotenv";import Vt from"process";import{execFile as FR}from"child_process";import{promisify as MR}from"util";import fr from"fs/promises";import ut from"path";import{spawn as SR}from"child_process";import Bg from"fs/promises";import _n from"path";import TR from"os";var _c=class{value;next;constructor(e){this.value=e}},Vi=class{#t;#s;#c;constructor(){this.clear()}enqueue(e){let r=new _c(e);this.#t?(this.#s.next=r,this.#s=r):(this.#t=r,this.#s=r),this.#c++}dequeue(){let e=this.#t;if(e)return this.#t=this.#t.next,this.#c--,this.#t||(this.#s=void 0),e.value}peek(){if(this.#t)return this.#t.value}clear(){this.#t=void 0,this.#s=void 0,this.#c=0}get size(){return this.#c}*[Symbol.iterator](){let e=this.#t;for(;e;)yield e.value,e=e.next}*drain(){for(;this.#t;)yield this.dequeue()}};function mn(t){let e=!1;if(typeof t=="object"&&({concurrency:t,rejectOnClear:e=!1}=t),Hg(t),typeof e!="boolean")throw new TypeError("Expected `rejectOnClear` to be a boolean");let r=new Vi,n=0,i=()=>{n<t&&r.size>0&&(n++,r.dequeue().run())},s=()=>{n--,i()},o=async(c,u,p)=>{let d=(async()=>c(...p))();u(d);try{await d}catch{}s()},a=(c,u,p,d)=>{let f={reject:p};new Promise(m=>{f.run=m,r.enqueue(f)}).then(o.bind(void 0,c,u,d)),n<t&&i()},l=(c,...u)=>new Promise((p,d)=>{a(c,p,d,u)});return Object.defineProperties(l,{activeCount:{get:()=>n},pendingCount:{get:()=>r.size},clearQueue:{value(){if(!e){r.clear();return}let c=AbortSignal.abort().reason;for(;r.size>0;)r.dequeue().reject(c)}},concurrency:{get:()=>t,set(c){Hg(c),t=c,queueMicrotask(()=>{for(;n<t&&r.size>0;)i()})}},map:{async value(c,u){let p=Array.from(c,(d,f)=>this(u,d,f));return Promise.all(p)}}}),l}function Hg(t){if(!((Number.isInteger(t)||t===Number.POSITIVE_INFINITY)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}var xr={NAME:"Docuvia",EMAIL:"docuvia@localhost"};var hn="refs/heads/",Sc="HEAD";var AR="fast-import",RR="--quiet",Tc={PIPE:"pipe",IGNORE:"ignore"},to={DATA:"data",ERROR:"error",CLOSE:"close"},En={COMMIT:"commit",COMMITTER:"committer",DATA:"data",FROM:"from",DELETE_ALL:"deleteall",MODIFY:"M"},yR="100644",OR="inline",IR="+0000",LR="stdin write failed: ",CR=(t,e,r)=>{let n=[e,r?`${LR}${r.message}`:""].filter(Boolean).join("; ");return`git fast-import exited with code ${t}${n?": "+n:""}`},NR=300*1e3,Kg="SIGTERM",PR=t=>`git fast-import timed out after ${t}ms and was terminated`,DR=TR.cpus().length*4;async function $g(t,e){let r=_n.resolve(t),n=e?_n.resolve(e):r;if(!r.startsWith(n+_n.sep)&&r!==n)throw new E(T.FS_PATH_TRAVERSAL,`sourceDir "${t}" escapes allowed root "${n}"`);let i=new Map,s=mn(DR),o=async a=>{let l=await Bg.readdir(a,{withFileTypes:!0});await Promise.all(l.map(async c=>{let u=_n.join(a,c.name);if(c.isDirectory())await o(u);else if(c.isFile()){let p=_n.relative(t,u),d=await s(()=>Bg.readFile(u,H));i.set(p,d)}}))};return await o(t),i}function Yg(t,e,r,n,i){let s=[];s.push(`${En.COMMIT} ${hn}${t}`),s.push(`${En.COMMITTER} ${xr.NAME} <${xr.EMAIL}> ${r} ${IR}`),s.push(`${En.DATA} ${Buffer.byteLength(n,H)}`),s.push(n),i&&s.push(`${En.FROM} ${i}`),s.push(En.DELETE_ALL);for(let[o,a]of e){let l=Buffer.from(a,H),c=o.split(_n.sep).join(_n.posix.sep);s.push(`${En.MODIFY} ${yR} ${OR} ${c}`),s.push(`${En.DATA} ${l.length}`),s.push(a)}return s.push(""),s.join(`
|
|
5
5
|
`)}function Wg(t,e,r=NR){return new Promise((n,i)=>{let s=SR("git",[AR,RR],{cwd:t,stdio:[Tc.PIPE,Tc.IGNORE,Tc.PIPE]}),o=setTimeout(()=>{s.kill(Kg),i(new Error(PR(r)))},r);o.unref();let a=[],l;s.stderr.on(to.DATA,c=>a.push(c)),s.on(to.ERROR,i),s.on(to.CLOSE,c=>{if(clearTimeout(o),c===0)return n();let u=Buffer.concat(a).toString(H).trim();i(new Error(CR(c,u,l)))}),s.stdin.on(to.ERROR,c=>{l=c});try{s.stdin.end(e,H)}catch(c){s.kill(Kg),clearTimeout(o),i(c instanceof Error?c:new Error(String(c)));return}})}import Xn from"path";var vR="Git hook name must be a basename contained by the resolved hooks directory";function bR(t){return t.length===0||t==="."||t===".."||t.includes("/")||t.includes("\\")||Xn.isAbsolute(t)}function wR(t){return t.length===0||t===".."||t.startsWith(`..${Xn.sep}`)||Xn.isAbsolute(t)}function jg(){throw new E(T.FS_PATH_TRAVERSAL,vR)}function zi(t,e){bR(e)&&jg();let r=Xn.resolve(t),n=Xn.resolve(r,e),i=Xn.relative(r,n);return wR(i)&&jg(),n}var kR=MR(FR),GR={LC_ALL:"C",LANG:"C",LC_MESSAGES:"C"},ge=(t,e,r={})=>kR(t,e,{...r,encoding:"utf8",env:{...process.env,...r.env??{},...GR}}),fe={REV_PARSE:"rev-parse",BRANCH:"branch",COMMIT_TREE:"commit-tree",UPDATE_REF:"update-ref",LS_FILES:"ls-files",LS_TREE:"ls-tree",DIFF:"diff",DIFF_TREE:"diff-tree",CAT_FILE:"cat-file",SHOW:"show",LOG:"log",REV_LIST:"rev-list",REMOTE:"remote",STATUS:"status",FETCH:"fetch",PUSH:"push",MERGE_BASE:"merge-base",WORKTREE:"worktree",BLAME:"blame"},re={IS_INSIDE_WORK_TREE:"--is-inside-work-tree",LIST:"--list",DELETE_FORCE:"-D",MESSAGE_FLAG:"-m",STAGED:"-s",OTHERS:"--others",EXCLUDE_STANDARD:"--exclude-standard",NAME_ONLY:"--name-only",BLOB:"blob",MAX_COUNT_FLAG:"-n",LOG_FORMAT_SHA_AND_BODY:"--format=%H%x01%B%x00",GET_URL:"get-url",EMPTY_FORMAT:"--format=",WORKTREE_LIST:"list",PORCELAIN:"--porcelain",NAME_STATUS:"--name-status",END_OF_OPTIONS:"--end-of-options",NO_COMMIT_ID:"--no-commit-id",RECURSIVE:"-r",VERIFY:"--verify",QUIET:"--quiet",IS_ANCESTOR:"--is-ancestor",TREE_SUFFIX:"^{tree}",SUPPRESS_DIFF:"-s",COMMIT_TIMESTAMP_FORMAT:"--format=%ct",PARENT_FLAG:"-p",UNIFIED_ZERO:"--unified=0",NO_COLOR:"--no-color",PATHSPEC_SEPARATOR:"--",GIT_DIR_FLAG:"--git-dir",GIT_COMMON_DIR_FLAG:"--git-common-dir",GIT_PATH_FLAG:"--git-path",NO_VERIFY:"--no-verify"},ro={PATH:"worktree ",BRANCH:"branch "},xR="\0",UR="",Ac={RENAMED:"R",ADDED:"A",DELETED:"D"},HR="4b825dc642cb6eb9a060e54bf8d69288fbee4904",Vg=".git",zg="hooks",BR="_",Jg="docuvia-knowledge.lock",KR=1e4,$R=100,YR=6e4,qg="object",Qg="code",Fe={BRANCH_LIST_FAILED:"git branch --list failed",BRANCH_DELETE_FAILED:"git branch -D failed",COMMIT_TREE_FAILED:"git commit-tree failed",UPDATE_REF_FAILED:"git update-ref failed",HOOK_FILE_WRITE_FAILED:"Writing hook file failed",HOOK_FILE_CHMOD_FAILED:"chmod on hook file failed",LS_FILES_STAGED_FAILED:"git ls-files -s failed",LS_FILES_OTHERS_FAILED:"git ls-files --others failed",DIFF_NAME_ONLY_FAILED:"git diff --name-only failed",CAT_FILE_BLOB_FAILED:"git cat-file blob failed",STATUS_PORCELAIN_FAILED:"git status --porcelain failed",DIFF_TREE_FAILED:"git diff-tree failed",FAST_IMPORT_FAILED:"git fast-import failed",FETCH_FAILED:"git fetch failed",PUSH_FAILED:"git push failed",MERGE_BASE_IS_ANCESTOR_FAILED:"git merge-base --is-ancestor failed",REV_PARSE_TREE_FAILED:"git rev-parse ^{tree} failed",SHOW_COMMIT_TIMESTAMP_FAILED:"git show --format=%ct failed",COMMIT_TREE_MERGE_FAILED:"git commit-tree (merge) failed",KNOWLEDGE_LOCK_ACQUIRE_FAILED:"Failed to acquire knowledge lock",KNOWLEDGE_LOCK_TIMED_OUT:t=>`Timed out waiting for the knowledge branch lock at ${t} \u2014 another Docuvia process may be stuck`},Zn=class{async getGitDir(e){try{let{stdout:r}=await ge("git",[fe.REV_PARSE,re.GIT_DIR_FLAG],{cwd:e});return ut.resolve(e,r.trim())}catch{return ut.join(e,Vg)}}async getGitCommonDir(e){try{let{stdout:r}=await ge("git",[fe.REV_PARSE,re.GIT_COMMON_DIR_FLAG],{cwd:e});return ut.resolve(e,r.trim())}catch{return ut.join(e,Vg)}}async resolveHooksDir(e){let r;try{let{stdout:n}=await ge("git",[fe.REV_PARSE,re.GIT_PATH_FLAG,zg],{cwd:e});r=ut.resolve(e,n.trim())}catch{let n=await this.getGitCommonDir(e);r=ut.join(n,zg)}return ut.basename(r)===BR?ut.dirname(r):r}async isGitRepository(e){try{return await ge("git",[fe.REV_PARSE,re.IS_INSIDE_WORK_TREE],{cwd:e}),!0}catch{return!1}}async branchExists(e,r){try{let{stdout:n}=await ge("git",[fe.BRANCH,re.LIST,r],{cwd:e});return n.trim().length>0}catch(n){throw E.wrap(T.GIT_COMMAND_FAILED,Fe.BRANCH_LIST_FAILED,n)}}async deleteBranch(e,r){try{await ge("git",[fe.BRANCH,re.DELETE_FORCE,r],{cwd:e})}catch(n){throw E.wrap(T.GIT_COMMAND_FAILED,Fe.BRANCH_DELETE_FAILED,n)}}async commitEmptyTree(e,r){try{let{stdout:n}=await ge("git",[fe.COMMIT_TREE,HR,re.MESSAGE_FLAG,r],{cwd:e});return n.trim()}catch(n){throw E.wrap(T.GIT_BRANCH_CREATE_FAILED,Fe.COMMIT_TREE_FAILED,n)}}async updateBranchRef(e,r,n){try{await ge("git",[fe.UPDATE_REF,`${hn}${r}`,n],{cwd:e})}catch(i){throw E.wrap(T.GIT_BRANCH_CREATE_FAILED,Fe.UPDATE_REF_FAILED,i)}}async hooksDirExists(e){try{let r=await this.resolveHooksDir(e);return await fr.access(r),!0}catch{return!1}}async readHookFile(e,r){let n=await this.resolveHooksDir(e),i=zi(n,r);try{return await fr.readFile(i,H)}catch{return}}async appendHookFile(e,r,n){try{let i=await this.resolveHooksDir(e),s=zi(i,r);await fr.appendFile(s,n)}catch(i){throw E.wrap(T.GIT_HOOK_INSTALL_FAILED,Fe.HOOK_FILE_WRITE_FAILED,i)}}async writeHookFile(e,r,n){try{let i=await this.resolveHooksDir(e),s=zi(i,r);await fr.writeFile(s,n)}catch(i){throw E.wrap(T.GIT_HOOK_INSTALL_FAILED,Fe.HOOK_FILE_WRITE_FAILED,i)}}async makeHookExecutable(e,r){try{let n=await this.resolveHooksDir(e),i=zi(n,r);await fr.chmod(i,493)}catch(n){throw E.wrap(T.GIT_HOOK_INSTALL_FAILED,Fe.HOOK_FILE_CHMOD_FAILED,n)}}async listTrackedFilesWithBlobHash(e){let r=new Map;try{let{stdout:n}=await ge("git",[fe.LS_FILES,re.STAGED],{cwd:e,maxBuffer:67108864});for(let i of n.split(`
|
|
6
6
|
`)){if(!i.trim())continue;let[s,o]=i.split(" "),a=s.split(" ")[1];o&&a&&r.set(o,a)}return r}catch(n){throw E.wrap(T.GIT_COMMAND_FAILED,Fe.LS_FILES_STAGED_FAILED,n)}}async listUntrackedFiles(e){try{let{stdout:r}=await ge("git",[fe.LS_FILES,re.OTHERS,re.EXCLUDE_STANDARD],{cwd:e,maxBuffer:67108864});return r.split(`
|
|
@@ -80,7 +80,7 @@ ${r}`).digest("hex")}var es=class{constructor(e){this.db=e}db;getById(e){try{ret
|
|
|
80
80
|
(${P.L2_NODE_ID}, title, content, node_type, source_commits,
|
|
81
81
|
initial_source_commits, commit_hash, ai_generated, confidence, source,
|
|
82
82
|
${P.CONTENT_HASH}, extraction_model, source_files, anchor_ranges)
|
|
83
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?, ?, ?, ?)`).run(e.l2NodeId,e.title,e.content,e.nodeType,s,s,e.commitSha,e.confidence,e.source??xt.ANALYZE,r,e.extractionModel,JSON.stringify(e.sourceFiles),o);return this.db.prepare(`INSERT INTO ${b.DOCUVIA_META} (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value`).run("tierCProcessedThisRun","true"),{id:Number(a.lastInsertRowid),deduped:!1}})()}catch(r){throw E.wrap(T.DB_QUERY_FAILED,ri.UPSERT_DECISION_FAILED,r)}}importCard(e){try{return this.db.transaction(()=>{let n=this.db.prepare(`SELECT l3.* FROM ${b.L3_NODES} l3
|
|
83
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?, ?, ?, ?)`).run(e.l2NodeId,e.title,e.content,e.nodeType,s,s,e.commitSha,e.confidence,e.source??xt.ANALYZE,r,e.extractionModel,JSON.stringify(e.sourceFiles),o);return this.db.prepare(`INSERT INTO ${b.DOCUVIA_META} (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value`).run("tierCProcessedThisRun","true"),{id:Number(a.lastInsertRowid),deduped:!1}}).immediate()}catch(r){throw E.wrap(T.DB_QUERY_FAILED,ri.UPSERT_DECISION_FAILED,r)}}importCard(e){try{return this.db.transaction(()=>{let n=this.db.prepare(`SELECT l3.* FROM ${b.L3_NODES} l3
|
|
84
84
|
JOIN ${b.L2_NODES} l2 ON l2.id = l3.${P.L2_NODE_ID}
|
|
85
85
|
WHERE l2.${P.PROJECT_ID} = (
|
|
86
86
|
SELECT ${P.PROJECT_ID} FROM ${b.L2_NODES} WHERE id = ?
|
|
@@ -89,7 +89,7 @@ ${r}`).digest("hex")}var es=class{constructor(e){this.db=e}db;getById(e){try{ret
|
|
|
89
89
|
(${P.L2_NODE_ID}, title, content, node_type, source_commits,
|
|
90
90
|
initial_source_commits, ai_generated, source, ${P.CONTENT_HASH},
|
|
91
91
|
extraction_model, source_files, created_at)
|
|
92
|
-
VALUES (?, ?, ?, ?, ?, ?, 1, '${ay}', ?, ?, ?, ?)`).run(e.l2NodeId,e.title,e.content,e.nodeType,i,i,e.contentHash,e.extractionModel,JSON.stringify(e.sourceFiles),e.createdAt);return this.db.prepare(`INSERT INTO ${b.DOCUVIA_META} (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value`).run("tierCProcessedThisRun","true"),{id:Number(s.lastInsertRowid),imported:!0}})()}catch(r){throw E.wrap(T.DB_QUERY_FAILED,ri.IMPORT_CARD_FAILED,r)}}updateValidityStatus(e,r){try{this.db.prepare(`UPDATE ${b.L3_NODES} SET validity_status = ? WHERE id = ? AND validity_status != ?`).run(r,e,r)}catch(n){throw E.wrap(T.DB_QUERY_FAILED,ri.UPDATE_VALIDITY_STATUS_FAILED(e),n)}}};var of={SEARCH_L2_FAILED:"Failed to search l2 nodes via FTS",SEARCH_L3_FAILED:"Failed to search l3 nodes via FTS"},ts=class{constructor(e){this.db=e}db;searchL2Nodes(e,r){try{let n=oo(e,"AND");if(n){let s=this.runL2Match(n,r);if(s.length>0)return s}let i=oo(e,"OR");return i?this.runL2Match(i,r):[]}catch(n){throw E.wrap(T.DB_QUERY_FAILED,of.SEARCH_L2_FAILED,n)}}searchL3Nodes(e,r){try{let n=oo(e,"AND");if(n){let s=this.runL3Match(n,r);if(s.length>0)return s}let i=oo(e,"OR");return i?this.runL3Match(i,r):[]}catch(n){throw E.wrap(T.DB_QUERY_FAILED,of.SEARCH_L3_FAILED,n)}}runL2Match(e,r){return this.db.prepare(`SELECT n.*
|
|
92
|
+
VALUES (?, ?, ?, ?, ?, ?, 1, '${ay}', ?, ?, ?, ?)`).run(e.l2NodeId,e.title,e.content,e.nodeType,i,i,e.contentHash,e.extractionModel,JSON.stringify(e.sourceFiles),e.createdAt);return this.db.prepare(`INSERT INTO ${b.DOCUVIA_META} (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value`).run("tierCProcessedThisRun","true"),{id:Number(s.lastInsertRowid),imported:!0}}).immediate()}catch(r){throw E.wrap(T.DB_QUERY_FAILED,ri.IMPORT_CARD_FAILED,r)}}updateValidityStatus(e,r){try{this.db.prepare(`UPDATE ${b.L3_NODES} SET validity_status = ? WHERE id = ? AND validity_status != ?`).run(r,e,r)}catch(n){throw E.wrap(T.DB_QUERY_FAILED,ri.UPDATE_VALIDITY_STATUS_FAILED(e),n)}}};var of={SEARCH_L2_FAILED:"Failed to search l2 nodes via FTS",SEARCH_L3_FAILED:"Failed to search l3 nodes via FTS"},ts=class{constructor(e){this.db=e}db;searchL2Nodes(e,r){try{let n=oo(e,"AND");if(n){let s=this.runL2Match(n,r);if(s.length>0)return s}let i=oo(e,"OR");return i?this.runL2Match(i,r):[]}catch(n){throw E.wrap(T.DB_QUERY_FAILED,of.SEARCH_L2_FAILED,n)}}searchL3Nodes(e,r){try{let n=oo(e,"AND");if(n){let s=this.runL3Match(n,r);if(s.length>0)return s}let i=oo(e,"OR");return i?this.runL3Match(i,r):[]}catch(n){throw E.wrap(T.DB_QUERY_FAILED,of.SEARCH_L3_FAILED,n)}}runL2Match(e,r){return this.db.prepare(`SELECT n.*
|
|
93
93
|
FROM ${b.L2_NODES_FTS} f
|
|
94
94
|
JOIN ${b.L2_NODES} n ON n.id = f.rowid
|
|
95
95
|
WHERE ${b.L2_NODES_FTS} MATCH ?
|
|
@@ -104,7 +104,7 @@ ${r}`).digest("hex")}var es=class{constructor(e){this.db=e}db;getById(e){try{ret
|
|
|
104
104
|
FROM ${b.AST_CALL_SITES}
|
|
105
105
|
WHERE ${P.PROJECT_ID} = ? AND ${P.FILE_PATH} IN (${i})`).all(e,...r);for(let o of s){let a={targetFunction:o.target_function,startLine:o.start_line,startColumn:o.start_column},l=n.get(o.file_path);l?l.push(a):n.set(o.file_path,[a])}return n}getByTargetFunctions(e,r){let n=new Map;if(r.length===0)return n;let i=r.map(()=>"?").join(","),s=this.db.prepare(`SELECT ${P.FILE_PATH}, ${P.START_LINE}, ${P.START_COLUMN}
|
|
106
106
|
FROM ${b.AST_CALL_SITES}
|
|
107
|
-
WHERE ${P.PROJECT_ID} = ? AND (${P.TARGET_FUNCTION} IN (${i}) OR ${P.CALLEE_NAME} IN (${i}))`).all(e,...r,...r);for(let o of s){let a={startLine:o.start_line,startColumn:o.start_column},l=n.get(o.file_path);l?l.push(a):n.set(o.file_path,[a])}return n}};var uy=1e4,dy=100,py=6e4,gy=".init-lock",Ur={INIT_LOCK_ACQUIRE_FAILED:"Failed to acquire database init lock",INIT_LOCK_TIMED_OUT:t=>`Timed out waiting for the database init lock at ${t} \u2014 another Docuvia process may be stuck`,OPEN_FAILED:t=>`Failed to open database at ${t}`,INVALID_DB_PATH:"Invalid database path: dbPath must be a non-empty string without NUL bytes",NOT_FOUND:t=>`Local database not found at ${t}. Please run "docuvia init".`,MIGRATIONS_FAILED:"Failed to apply migrations",PRUNE_MISSING_FILES_FAILED:"Failed to prune missing files"};function fy(t){if(!(!(t instanceof Error)||!("code"in t)))return t.code}function my(t){if(typeof t!="string"||t.length===0||t.includes("\0"))throw new E(T.INVALID_INPUT,Ur.INVALID_DB_PATH)}async function hy(t){let e=`${t}${gy}`,r=Date.now()+uy;for(;;)try{return await(await lo.open(e,"wx")).close(),e}catch(n){let i=fy(n);if(i!==Wn&&i!==gn&&i!==jn&&i!==Vn)throw E.wrap(T.DB_LOCKED,Ur.INIT_LOCK_ACQUIRE_FAILED,n);let s=await lo.stat(e).catch(()=>{});if(s&&Date.now()-s.mtimeMs>py){await lo.rm(e,{force:!0});continue}if(Date.now()>r)throw new E(T.DB_LOCKED,Ur.INIT_LOCK_TIMED_OUT(e));await new Promise(o=>setTimeout(o,dy))}}async function Ey(t){await lo.rm(t,{force:!0})}var ns=class t{constructor(e){this.db=e;this.projectsRepo=new qi(e),this.filesRepo=new Qi(e),this.tagsRepo=new Xi(e),this.graphRepo=new Zi(e),this.l3Repo=new es(e),this.ftsRepo=new ts(e),this.metaRepo=new ao(e),this.callSitesRepo=new rs(e)}db;lock=new so;projectsRepo;filesRepo;tagsRepo;graphRepo;l3Repo;ftsRepo;metaRepo;callSitesRepo;static async open(e){if(my(e.dbPath),lf.mkdirSync(cy.dirname(e.dbPath),{recursive:!0}),e.readonly&&!lf.existsSync(e.dbPath))throw new E(T.DB_NOT_FOUND,Ur.NOT_FOUND(e.dbPath));let r=e.readonly?void 0:await hy(e.dbPath).catch(n=>{throw E.wrap(T.DB_OPEN_FAILED,Ur.OPEN_FAILED(e.dbPath),n)});try{let n=e.readonly?new cf(e.dbPath,{readonly:!0,fileMustExist:!0}):new cf(e.dbPath);if(n.pragma(`${ei.BUSY_TIMEOUT} = ${Sn.BUSY_TIMEOUT_MS}`),!e.readonly){n.pragma(`${ei.JOURNAL_MODE} = ${Sn.JOURNAL_MODE}`),n.pragma(`${ei.SYNCHRONOUS} = ${Sn.SYNCHRONOUS}`);try{Rc(n,yc)}catch(i){throw new E(T.DB_MIGRATION_FAILED,Ur.MIGRATIONS_FAILED,i)}}return new t(n)}catch(n){throw E.wrap(T.DB_OPEN_FAILED,Ur.OPEN_FAILED(e.dbPath),n)}finally{r&&await Ey(r)}}async close(){this.db.close()}get projects(){return this.projectsRepo}get files(){return this.filesRepo}get tags(){return this.tagsRepo}get graph(){return this.graphRepo}get l3(){return this.l3Repo}get fts(){return this.ftsRepo}get meta(){return this.metaRepo}get callSites(){return this.callSitesRepo}async withWriteLock(e){return this.lock.runWrite(e)}async withReadLock(e){return this.lock.runRead(e)}withTransaction(e){return this.db.transaction(e)()}pruneMissingFiles(e){try{let r=new Set(e),n=this.db.prepare(`SELECT id, ${P.PATH_PATTERNS} FROM ${b.L2_NODES}`).all().filter(o=>{let a;try{a=o.path_patterns?JSON.parse(o.path_patterns):[]}catch{a=[]}return a.length===0||a.every(l=>!r.has(l))}).map(o=>o.id);return{prunedFiles:this.db.transaction(o=>{if(o.length>0){let c=o.map(()=>"?").join(",");this.db.prepare(`DELETE FROM ${b.L2_NODE_L1_TAGS} WHERE ${P.L2_NODE_ID} IN (${c})`).run(...o),this.db.prepare(`DELETE FROM ${b.NODE_LINKS} WHERE ${P.SOURCE_NODE_ID} IN (${c}) OR ${P.TARGET_NODE_ID} IN (${c})`).run(...o,...o),this.db.prepare(`DELETE FROM ${b.L2_NODES} WHERE id IN (${c})`).run(...o)}let l=this.db.prepare(`SELECT ${P.FILE_PATH} FROM ${b.PROJECT_FILES}`).all().filter(c=>!r.has(c.file_path));for(let{file_path:c}of l)this.db.prepare(`DELETE FROM ${b.PROJECT_FILES} WHERE ${P.FILE_PATH} = ?`).run(c);return l.length})(n),prunedNodes:n.length}}catch(r){throw E.wrap(T.DB_QUERY_FAILED,Ur.PRUNE_MISSING_FILES_FAILED,r)}}};import _y from"fs/promises";import Sy from"better-sqlite3";var Tn={CONNECTION:"sqlite_connection",INTEGRITY:"sqlite_integrity",WAL_BLOAT:"sqlite_wal_bloat",ABI_MISMATCH:"sqlite_abi_mismatch"},Ty="NODE_MODULE_VERSION",uf="ok",pt={CONNECTION_FAILED:"Failed to open SQLite database",CONNECTION_SUGGESTION:"Ensure you have read/write permissions for the .docuvia directory, or try running 'docuvia init' again.",INTEGRITY_PASSED:"Database integrity check passed",INTEGRITY_FAILED:"Database integrity check failed",INTEGRITY_CHECK_ERRORED:"Error running integrity check",CORRUPTION_SUGGESTION:"The database file might be corrupted. Consider running 'docuvia clean' and 'docuvia hydrate' to rebuild it.",WAL_TOO_LARGE:"WAL file is too large (>100MB)",WAL_SIZE_DETAILS:t=>`Size: ${t} MB`,WAL_BLOAT_SUGGESTION:"SQLite Write-Ahead Log has bloated. You can run 'docuvia clean' and re-initialize, or restart the agent to force a checkpoint.",WAL_SIZE_NORMAL:"WAL file size is normal",ABI_MISMATCH:"The better-sqlite3 native module was compiled for a different Node.js version than the one running this command (NODE_MODULE_VERSION drift).",ABI_MISMATCH_SUGGESTION:"Run `pnpm install --force` (or `pnpm rebuild better-sqlite3`) using the SAME Node.js version the CLI will resolve at runtime, or switch to a single pinned Node.js version (e.g. via nvm) so the native binding is rebuilt against the version you actually use."},Ay=100*1024*1024,co=class{async checkHealth(e){let r={},n;try{n=new Sy(e,{readonly:!0,fileMustExist:!0})}catch(i){return this.failConnection(r,String(i)),r}return await this.runHealthChecks(n,e,r),n.close(),r}failConnection(e,r){let n=r.includes(Ty);n&&(e[Tn.ABI_MISMATCH]={status:K.FAIL,message:pt.ABI_MISMATCH,details:r,suggestion:pt.ABI_MISMATCH_SUGGESTION}),e[Tn.CONNECTION]={status:K.FAIL,message:pt.CONNECTION_FAILED,details:r,suggestion:n?pt.ABI_MISMATCH_SUGGESTION:pt.CONNECTION_SUGGESTION}}async runHealthChecks(e,r,n){try{let i=e.pragma(ei.INTEGRITY_CHECK,{simple:!0});i===uf||Array.isArray(i)&&i[0]?.integrity_check===uf?n[Tn.INTEGRITY]={status:K.PASS,message:pt.INTEGRITY_PASSED}:n[Tn.INTEGRITY]={status:K.FAIL,message:pt.INTEGRITY_FAILED,details:JSON.stringify(i),suggestion:pt.CORRUPTION_SUGGESTION}}catch(i){n[Tn.INTEGRITY]={status:K.FAIL,message:pt.INTEGRITY_CHECK_ERRORED,details:String(i),suggestion:pt.CORRUPTION_SUGGESTION}}try{let i=r+Sn.WAL_FILE_SUFFIX,s=await _y.stat(i).catch(()=>null);s&&s.size>Ay?n[Tn.WAL_BLOAT]={status:K.FAIL,message:pt.WAL_TOO_LARGE,details:pt.WAL_SIZE_DETAILS((s.size/1024/1024).toFixed(2)),suggestion:pt.WAL_BLOAT_SUGGESTION}:n[Tn.WAL_BLOAT]={status:K.PASS,message:pt.WAL_SIZE_NORMAL}}catch{}}};y.register(A.GraphStoreOpener,()=>ns.open);y.register(A.DiagnosticRunnerDb,()=>new co);function st(t){if(t===null||typeof t!="object"||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return(e===Object.prototype||e===null)&&Reflect.ownKeys(t).every(r=>df(t,r))}function df(t,e){let r=Object.getOwnPropertyDescriptor(t,e);return r?.enumerable===!0&&Object.hasOwn(r,"value")}function hr(t){if(!Array.isArray(t)||Object.getPrototypeOf(t)!==Array.prototype||Reflect.ownKeys(t).length!==t.length+1)return!1;for(let e=0;e<t.length;e++)if(!df(t,String(e)))return!1;return!0}function Rt(t,e,r=[]){let n=new Set([...e,...r]);return e.every(i=>Object.hasOwn(t,i))&&Reflect.ownKeys(t).every(i=>typeof i=="string"&&n.has(i))}function Qe(t){return typeof t=="string"&&t.trim().length>0}function pf(t){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=1}var is=["schemaVersion","requestId","featureSchemaVersion","evidence"],Oc=["repoId","worktreeId","projectId","snapshotHash","candidateSetHash","truncated"];function Ic(t){if(t.schemaVersion!==Bp||!Qe(t.requestId)||!Qe(t.featureSchemaVersion))return!1;let e=t.evidence;return st(e)&&Rt(e,Oc)&&Oc.filter(r=>r!=="truncated").every(r=>Qe(e[r]))&&e.truncated===!1}function gf(t,e){if(!Ic(e))return!1;let r=e.evidence;return e.schemaVersion===t.schemaVersion&&e.requestId===t.requestId&&e.featureSchemaVersion===t.featureSchemaVersion&&Oc.every(n=>r[n]===t.evidence[n])}var Ry=128*1024,yy=256,Oy=/^[a-f0-9]{64}$/;function gt(t){throw new E(T.SEMANTIC_CORPUS_INVALID,t)}function os(t,e){return(!st(t)||!Rt(t,e))&>("Invalid corpus record shape"),t}function po(t,e){e.every(r=>Qe(t[r]))||gt("Corpus identity must be nonblank")}function ss(t,e){(typeof t!="string"||!e.includes(t))&>("Unsupported corpus enum value")}function uo(t){(typeof t!="string"||!Oy.test(t))&>("Corpus hash must be lowercase SHA-256")}function ff(t,e=yy){return(!Array.isArray(t)||t.length>e||!hr(t))&>("Invalid or oversized corpus array"),t}function ni(t){let e=ff(t);return(!e.every(Qe)||new Set(e).size!==e.length)&>("Corpus references must be nonblank and unique"),e}function Iy(t){let e=["repoId","repoFamily","revision","projectId","callSiteId","snapshotHash","duplicateGroup","license","language","relation"],r=os(t,[...e,"usage","origin","split"]);po(r,e),uo(r.snapshotHash),ss(r.usage,["evaluation-only","training-and-evaluation"]),ss(r.origin,["real","synthetic"]),ss(r.split,["train","calibration","test","temporal"])}function Ly(t){let e=os(t,["status","server","version","configHash","snapshotHash","targetIds"]);po(e,["server","version"]),uo(e.configHash),uo(e.snapshotHash),ss(e.status,["resolved","timeout","empty","not-ready","unsupported","error"]),ni(e.targetIds)}function Cy(t){let e=os(t,["status","snapshotHash","positiveTargetIds","negativeTargetIds","evidenceRefs"]);uo(e.snapshotHash),ss(e.status,["confirmed","unreviewed","conflict","out-of-scope"]),ni(e.positiveTargetIds),ni(e.negativeTargetIds);let r=ni(e.evidenceRefs);e.status==="confirmed"&&r.length===0&>("Confirmed gold requires independent evidence")}function Ny(t){let e=ff(t,Kn.MAX_CANDIDATES),r=[],n=[];for(let i of e){let s=os(i,["id","targetId"]);po(s,["id","targetId"]),r.push(s.id),n.push(s.targetId)}ni(r),ni(n)}function go(t){try{let e=os(t,["schemaVersion","sampleId","source","candidates","truncated","oracle","review"]);(e.schemaVersion!==1||typeof e.truncated!="boolean")&>("Invalid corpus version or truncation flag"),po(e,["sampleId"]),Iy(e.source),Ny(e.candidates),Ly(e.oracle),Cy(e.review);let r=JSON.stringify(e);return Buffer.byteLength(r,"utf8")>Ry&>("Corpus record exceeds 128 KiB"),JSON.parse(r)}catch(e){throw E.wrap(T.SEMANTIC_CORPUS_INVALID,"Invalid corpus sample",e)}}function Py(t){let{oracle:e,review:r}=t;return r.status==="conflict"?!0:r.status!=="confirmed"?!1:r.positiveTargetIds.some(n=>r.negativeTargetIds.includes(n))?!0:e.status!=="resolved"||e.targetIds.length===0?!1:e.targetIds.length!==r.positiveTargetIds.length||e.targetIds.some(n=>!r.positiveTargetIds.includes(n))}function Dy(t){return t.source.language!=="typescript"||t.source.relation!=="cross-file-call"||t.review.status==="out-of-scope"}function vy(t){let{source:e,oracle:r,review:n}=t;return e.snapshotHash!==r.snapshotHash||e.snapshotHash!==n.snapshotHash?"freshness-mismatch":Py(t)?"label-conflict":Dy(t)?"out-of-scope":r.status!=="resolved"||r.targetIds.length===0?"oracle-failure":n.status!=="confirmed"?"unreviewed":t.truncated?"input-truncated":"ready"}function by(t,e,r){return e==="out-of-scope"?"out-of-scope":e!=="ready"?"unresolved":r.review.positiveTargetIds.includes(t)?"confirmed-positive":r.review.negativeTargetIds.includes(t)?"confirmed-negative":"unresolved"}function fo(t){let e=vy(t),r=new Set(t.candidates.map(i=>i.targetId)),n=e==="ready"?[...t.review.positiveTargetIds]:[];return{sampleId:t.sampleId,reason:e,labels:t.candidates.map(i=>({candidateId:i.id,targetId:i.targetId,label:by(i.targetId,e,t)})),goldTargetIds:n,missingTargetIds:n.filter(i=>!r.has(i))}}var wy=1e5;function mf(t,e){new Set(t).size!==t.length&>(e)}function Lc(t,e,r,n){if(t.has(e)&&t.get(e)!==r)throw new E(n?T.SEMANTIC_CORPUS_LEAKAGE:T.SEMANTIC_CORPUS_INVALID,n?"Corpus group crosses splits":"Repository has inconsistent family identity");t.set(e,r)}function Fy(t){mf(t.map(i=>i.sampleId),"Duplicate corpus sample ID"),mf(t.map(i=>JSON.stringify([i.source.repoId,i.source.projectId,i.source.callSiteId,i.source.snapshotHash])),"Duplicate corpus call-site snapshot");let e=new Map,r=new Map,n=new Map;for(let{source:i}of t)if(Lc(e,i.repoId,i.repoFamily,!1),Lc(r,i.repoFamily,i.split==="temporal"?"test":i.split,!0),Lc(n,i.duplicateGroup,i.split,!0),i.usage==="evaluation-only"&&i.split==="train")throw new E(T.SEMANTIC_CORPUS_LEAKAGE,"Evaluation-only source cannot enter training split")}function hf(t){try{(!st(t)||!Rt(t,["schemaVersion","corpusId","corpusVersion","splitSeed","samples"]))&>("Invalid corpus manifest shape"),(t.schemaVersion!==1||![t.corpusId,t.corpusVersion,t.splitSeed].every(Qe))&>("Invalid corpus manifest identity");let e=t.samples;(!Array.isArray(e)||e.length>wy||!hr(e))&>("Invalid or oversized corpus sample list");let r=e.map(go).sort((n,i)=>n.sampleId<i.sampleId?-1:n.sampleId>i.sampleId?1:0);return Fy(r),{schemaVersion:1,corpusId:t.corpusId,corpusVersion:t.corpusVersion,splitSeed:t.splitSeed,samples:r}}catch(e){throw E.wrap(T.SEMANTIC_CORPUS_INVALID,"Invalid corpus manifest",e)}}import{createHash as My}from"crypto";var Cc=["train","calibration","test","temporal"],Ef=["real","synthetic"];function mo(t,e){let r=0,n=0,i=0,s=0;for(let o of t){let a=e.get(o.sampleId).reason;if(a!=="ready"&&a!=="input-truncated")continue;let l=o.review.positiveTargetIds,c=new Set(o.candidates.map(p=>p.targetId)),u=l.filter(p=>c.has(p)).length;r++,n+=l.length,i+=u,u===l.length&&s++}return{requests:t.length,trustedGoldRequests:r,goldTargets:n,coveredTargets:i,fullyCoveredRequests:s,candidateRecall:n===0?null:i/n,setCoverage:r===0?null:s/r}}function Nc(t,e,r){let n={train:0,calibration:0,test:0,temporal:0};for(let i of Cc){let s=t.filter(o=>o.source.origin==="real"&&o.source.split===i&&e.get(o.sampleId).reason==="ready");n[i]=new Set(s.map(o=>o.source[r])).size}return n}function _f(t,e){return e.train>=4&&e.calibration>=2&&e.test>=2&&t.train+t.calibration+t.test>=1e4&&t.test>=2e3&&t.temporal>=1}function Pc(t){if(Array.isArray(t))return`[${t.map(Pc).join(",")}]`;if(t!==null&&typeof t=="object"){let e=t;return`{${Object.keys(e).sort().map(r=>`${JSON.stringify(r)}:${Pc(e[r])}`).join(",")}}`}return JSON.stringify(t)}function ky(t){return t===null?"insufficient-evidence":t>=.99?"pass":"fail"}function Sf(t){let{samples:e,...r}=t,n=e.map(fo),i=new Map(n.map(d=>[d.sampleId,d])),s={ready:0,"freshness-mismatch":0,"label-conflict":0,"out-of-scope":0,"oracle-failure":0,unreviewed:0,"input-truncated":0};for(let d of n)s[d.reason]++;let o=mo(e.filter(d=>d.source.origin==="real"),i),a=mo(e.filter(d=>d.source.origin==="synthetic"),i),l=Nc(e,i,"duplicateGroup"),c=Nc(e,i,"repoFamily"),u=Ef.flatMap(d=>Cc.map(f=>({origin:d,split:f,metrics:mo(e.filter(m=>m.source.origin===d&&m.source.split===f),i)}))),p=u.find(d=>d.origin==="real"&&d.split==="test").metrics.candidateRecall;return{...r,datasetHash:My("sha256").update(Pc(t),"utf8").digest("hex"),results:n,reasons:s,real:o,synthetic:a,slices:u,independentReadyRealRequests:l,readyRealFamilies:c,gates:{sampleSize:_f(l,c)?"pass":"insufficient-evidence",candidateRecall:ky(p)}}}var ho=class{label(e){return fo(go(e))}audit(e){return Sf(hf(e))}};import Tf from"fs/promises";import Gy from"os";import xy from"path";var j={DETECTED_CHANGES:"Detected changes",WORKING_TREE_HEAD:"working tree (HEAD)",NO_LOCAL_GRAPH_IMPACT:"No local graph impact detected for the changed files.",TOP_AFFECTED_FILES:"Top affected files:",analysisBase:t=>`Base: ${t}`,analysisFilesChanged:t=>`Files changed: ${t}`,analysisRiskLevel:t=>`Risk level: ${t}`,analysisImpactedNodes:(t,e)=>`Impacted nodes: ${t} across ${e} changed file(s).`,analysisAffectedFileLine:(t,e,r)=>` - ${t}: ${e} dependent(s) [${r}]`,KNOWLEDGE_BRANCH_ALREADY_EXISTS:"Knowledge branch already exists",CONCURRENT_INITIAL_COMMIT_SKIPPED:"Knowledge branch was created by a concurrent process; skipping duplicate initial commit",CREATED_KNOWLEDGE_BRANCH:"Created hidden knowledge branch",NO_GIT_HOOKS_DIR:"No .git/hooks directory; skipping post-commit hook install",POST_COMMIT_HOOK_ALREADY_INSTALLED:"Post-commit hook already installed",CONCURRENT_HOOK_INSTALL_SKIPPED:"Post-commit hook was installed by a concurrent process; skipping duplicate append",FAILED_TO_INSTALL_HOOK:"Failed to install post-commit hook",INSTALLED_POST_COMMIT_HOOK:"Installed post-commit hook",UPGRADED_LEGACY_POST_COMMIT_HOOK:"Upgraded legacy post-commit hook (docuvia snapshot -> docuvia analyze)",UPGRADED_POST_COMMIT_HOOK_FLUSH_L3:"Upgraded post-commit hook (added flush-staged-l3 step, issue #42)",UPGRADED_POST_COMMIT_HOOK_NOHUP:"Upgraded post-commit hook (nohup + log redirect, issue #58)",PRE_PUSH_HOOK_ALREADY_INSTALLED:"Pre-push hook already installed",CONCURRENT_PRE_PUSH_HOOK_INSTALL_SKIPPED:"Pre-push hook was installed by a concurrent process; skipping duplicate append",FAILED_TO_INSTALL_PRE_PUSH_HOOK:"Failed to install pre-push hook",INSTALLED_PRE_PUSH_HOOK:"Installed pre-push hook",UPGRADED_LEGACY_PRE_PUSH_HOOK:"Upgraded legacy pre-push hook (added sync-knowledge step)",REMOVED_POST_COMMIT_HOOK:"Removed post-commit hook",REMOVED_PRE_PUSH_HOOK:"Removed pre-push hook",NO_POST_COMMIT_HOOK_TO_REMOVE:"No Docuvia post-commit hook to remove",NO_PRE_PUSH_HOOK_TO_REMOVE:"No Docuvia pre-push hook to remove",FAILED_TO_REMOVE_POST_COMMIT_HOOK:"Failed to remove post-commit hook",FAILED_TO_REMOVE_PRE_PUSH_HOOK:"Failed to remove pre-push hook",NO_KNOWLEDGE_BRANCH_TO_DELETE:"No knowledge branch to delete",DELETED_KNOWLEDGE_BRANCH:"Deleted hidden knowledge branch",FAILED_TO_DELETE_KNOWLEDGE_BRANCH:"Failed to delete knowledge branch",REPAIRED_DUPLICATE_POST_COMMIT_HOOK:"Repaired duplicate post-commit hook block",NOTHING_TO_REPAIR:"Nothing to repair -- post-commit hook is not duplicated",PACKED_SNAPSHOT_ONTO_BRANCH:"Packed snapshot onto knowledge branch",NO_REMOTE_SKIP_RECONCILIATION:"No remote configured; skipping knowledge branch reconciliation",FAILED_TO_FETCH_CONTINUING_OFFLINE:"Failed to fetch knowledge branch from remote; continuing offline",REMOTE_REF_NOT_FOUND_TEXT:"couldn't find remote ref",REMOTE_KNOWLEDGE_BRANCH_NOT_YET_ON_REMOTE:"Knowledge branch does not exist on remote yet; treating as first-ever push",ADOPTED_REMOTE_BRANCH:"Adopted remote knowledge branch (no local copy existed)",FAST_FORWARDED_LOCAL_BRANCH:"Fast-forwarded local knowledge branch to remote",MERGED_DIVERGED_BRANCH:"Merged diverged knowledge branch",FAILED_TO_PUSH_WILL_RETRY:"Failed to push knowledge branch to remote; will retry on next sync",SNAPSHOT_UNKNOWN:"Snapshot [unknown]",MERGE_WINNER_LOCAL:"local",MERGE_WINNER_REMOTE:"remote",mergeCommitMessage:t=>`Merge knowledge branch (${t?"local":"remote"} wins)`,snapshotCommitMessage:t=>`Snapshot [${t.slice(0,7)}]
|
|
107
|
+
WHERE ${P.PROJECT_ID} = ? AND (${P.TARGET_FUNCTION} IN (${i}) OR ${P.CALLEE_NAME} IN (${i}))`).all(e,...r,...r);for(let o of s){let a={startLine:o.start_line,startColumn:o.start_column},l=n.get(o.file_path);l?l.push(a):n.set(o.file_path,[a])}return n}};var uy=1e4,dy=100,py=6e4,gy=".init-lock",Ur={INIT_LOCK_ACQUIRE_FAILED:"Failed to acquire database init lock",INIT_LOCK_TIMED_OUT:t=>`Timed out waiting for the database init lock at ${t} \u2014 another Docuvia process may be stuck`,OPEN_FAILED:t=>`Failed to open database at ${t}`,INVALID_DB_PATH:"Invalid database path: dbPath must be a non-empty string without NUL bytes",NOT_FOUND:t=>`Local database not found at ${t}. Please run "docuvia init".`,MIGRATIONS_FAILED:"Failed to apply migrations",PRUNE_MISSING_FILES_FAILED:"Failed to prune missing files"};function fy(t){if(!(!(t instanceof Error)||!("code"in t)))return t.code}function my(t){if(typeof t!="string"||t.length===0||t.includes("\0"))throw new E(T.INVALID_INPUT,Ur.INVALID_DB_PATH)}async function hy(t){let e=`${t}${gy}`,r=Date.now()+uy;for(;;)try{return await(await lo.open(e,"wx")).close(),e}catch(n){let i=fy(n);if(i!==Wn&&i!==gn&&i!==jn&&i!==Vn)throw E.wrap(T.DB_LOCKED,Ur.INIT_LOCK_ACQUIRE_FAILED,n);let s=await lo.stat(e).catch(()=>{});if(s&&Date.now()-s.mtimeMs>py){await lo.rm(e,{force:!0});continue}if(Date.now()>r)throw new E(T.DB_LOCKED,Ur.INIT_LOCK_TIMED_OUT(e));await new Promise(o=>setTimeout(o,dy))}}async function Ey(t){await lo.rm(t,{force:!0})}var ns=class t{constructor(e){this.db=e;this.projectsRepo=new qi(e),this.filesRepo=new Qi(e),this.tagsRepo=new Xi(e),this.graphRepo=new Zi(e),this.l3Repo=new es(e),this.ftsRepo=new ts(e),this.metaRepo=new ao(e),this.callSitesRepo=new rs(e)}db;lock=new so;projectsRepo;filesRepo;tagsRepo;graphRepo;l3Repo;ftsRepo;metaRepo;callSitesRepo;static async open(e){if(my(e.dbPath),lf.mkdirSync(cy.dirname(e.dbPath),{recursive:!0}),e.readonly&&!lf.existsSync(e.dbPath))throw new E(T.DB_NOT_FOUND,Ur.NOT_FOUND(e.dbPath));let r=e.readonly?void 0:await hy(e.dbPath).catch(n=>{throw E.wrap(T.DB_OPEN_FAILED,Ur.OPEN_FAILED(e.dbPath),n)});try{let n=e.readonly?new cf(e.dbPath,{readonly:!0,fileMustExist:!0}):new cf(e.dbPath);if(n.pragma(`${ei.BUSY_TIMEOUT} = ${Sn.BUSY_TIMEOUT_MS}`),!e.readonly){n.pragma(`${ei.JOURNAL_MODE} = ${Sn.JOURNAL_MODE}`),n.pragma(`${ei.SYNCHRONOUS} = ${Sn.SYNCHRONOUS}`);try{Rc(n,yc)}catch(i){throw new E(T.DB_MIGRATION_FAILED,Ur.MIGRATIONS_FAILED,i)}}return new t(n)}catch(n){throw E.wrap(T.DB_OPEN_FAILED,Ur.OPEN_FAILED(e.dbPath),n)}finally{r&&await Ey(r)}}async close(){this.db.close()}get projects(){return this.projectsRepo}get files(){return this.filesRepo}get tags(){return this.tagsRepo}get graph(){return this.graphRepo}get l3(){return this.l3Repo}get fts(){return this.ftsRepo}get meta(){return this.metaRepo}get callSites(){return this.callSitesRepo}async withWriteLock(e){return this.lock.runWrite(e)}async withReadLock(e){return this.lock.runRead(e)}withTransaction(e){return this.db.transaction(e).immediate()}pruneMissingFiles(e){try{let r=new Set(e),n=this.db.prepare(`SELECT id, ${P.PATH_PATTERNS} FROM ${b.L2_NODES}`).all().filter(o=>{let a;try{a=o.path_patterns?JSON.parse(o.path_patterns):[]}catch{a=[]}return a.length===0||a.every(l=>!r.has(l))}).map(o=>o.id);return{prunedFiles:this.db.transaction(o=>{if(o.length>0){let c=o.map(()=>"?").join(",");this.db.prepare(`DELETE FROM ${b.L2_NODE_L1_TAGS} WHERE ${P.L2_NODE_ID} IN (${c})`).run(...o),this.db.prepare(`DELETE FROM ${b.NODE_LINKS} WHERE ${P.SOURCE_NODE_ID} IN (${c}) OR ${P.TARGET_NODE_ID} IN (${c})`).run(...o,...o),this.db.prepare(`DELETE FROM ${b.L2_NODES} WHERE id IN (${c})`).run(...o)}let l=this.db.prepare(`SELECT ${P.FILE_PATH} FROM ${b.PROJECT_FILES}`).all().filter(c=>!r.has(c.file_path));for(let{file_path:c}of l)this.db.prepare(`DELETE FROM ${b.PROJECT_FILES} WHERE ${P.FILE_PATH} = ?`).run(c);return l.length})(n),prunedNodes:n.length}}catch(r){throw E.wrap(T.DB_QUERY_FAILED,Ur.PRUNE_MISSING_FILES_FAILED,r)}}};import _y from"fs/promises";import Sy from"better-sqlite3";var Tn={CONNECTION:"sqlite_connection",INTEGRITY:"sqlite_integrity",WAL_BLOAT:"sqlite_wal_bloat",ABI_MISMATCH:"sqlite_abi_mismatch"},Ty="NODE_MODULE_VERSION",uf="ok",pt={CONNECTION_FAILED:"Failed to open SQLite database",CONNECTION_SUGGESTION:"Ensure you have read/write permissions for the .docuvia directory, or try running 'docuvia init' again.",INTEGRITY_PASSED:"Database integrity check passed",INTEGRITY_FAILED:"Database integrity check failed",INTEGRITY_CHECK_ERRORED:"Error running integrity check",CORRUPTION_SUGGESTION:"The database file might be corrupted. Consider running 'docuvia clean' and 'docuvia hydrate' to rebuild it.",WAL_TOO_LARGE:"WAL file is too large (>100MB)",WAL_SIZE_DETAILS:t=>`Size: ${t} MB`,WAL_BLOAT_SUGGESTION:"SQLite Write-Ahead Log has bloated. You can run 'docuvia clean' and re-initialize, or restart the agent to force a checkpoint.",WAL_SIZE_NORMAL:"WAL file size is normal",ABI_MISMATCH:"The better-sqlite3 native module was compiled for a different Node.js version than the one running this command (NODE_MODULE_VERSION drift).",ABI_MISMATCH_SUGGESTION:"Run `pnpm install --force` (or `pnpm rebuild better-sqlite3`) using the SAME Node.js version the CLI will resolve at runtime, or switch to a single pinned Node.js version (e.g. via nvm) so the native binding is rebuilt against the version you actually use."},Ay=100*1024*1024,co=class{async checkHealth(e){let r={},n;try{n=new Sy(e,{readonly:!0,fileMustExist:!0})}catch(i){return this.failConnection(r,String(i)),r}return await this.runHealthChecks(n,e,r),n.close(),r}failConnection(e,r){let n=r.includes(Ty);n&&(e[Tn.ABI_MISMATCH]={status:K.FAIL,message:pt.ABI_MISMATCH,details:r,suggestion:pt.ABI_MISMATCH_SUGGESTION}),e[Tn.CONNECTION]={status:K.FAIL,message:pt.CONNECTION_FAILED,details:r,suggestion:n?pt.ABI_MISMATCH_SUGGESTION:pt.CONNECTION_SUGGESTION}}async runHealthChecks(e,r,n){try{let i=e.pragma(ei.INTEGRITY_CHECK,{simple:!0});i===uf||Array.isArray(i)&&i[0]?.integrity_check===uf?n[Tn.INTEGRITY]={status:K.PASS,message:pt.INTEGRITY_PASSED}:n[Tn.INTEGRITY]={status:K.FAIL,message:pt.INTEGRITY_FAILED,details:JSON.stringify(i),suggestion:pt.CORRUPTION_SUGGESTION}}catch(i){n[Tn.INTEGRITY]={status:K.FAIL,message:pt.INTEGRITY_CHECK_ERRORED,details:String(i),suggestion:pt.CORRUPTION_SUGGESTION}}try{let i=r+Sn.WAL_FILE_SUFFIX,s=await _y.stat(i).catch(()=>null);s&&s.size>Ay?n[Tn.WAL_BLOAT]={status:K.FAIL,message:pt.WAL_TOO_LARGE,details:pt.WAL_SIZE_DETAILS((s.size/1024/1024).toFixed(2)),suggestion:pt.WAL_BLOAT_SUGGESTION}:n[Tn.WAL_BLOAT]={status:K.PASS,message:pt.WAL_SIZE_NORMAL}}catch{}}};y.register(A.GraphStoreOpener,()=>ns.open);y.register(A.DiagnosticRunnerDb,()=>new co);function st(t){if(t===null||typeof t!="object"||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return(e===Object.prototype||e===null)&&Reflect.ownKeys(t).every(r=>df(t,r))}function df(t,e){let r=Object.getOwnPropertyDescriptor(t,e);return r?.enumerable===!0&&Object.hasOwn(r,"value")}function hr(t){if(!Array.isArray(t)||Object.getPrototypeOf(t)!==Array.prototype||Reflect.ownKeys(t).length!==t.length+1)return!1;for(let e=0;e<t.length;e++)if(!df(t,String(e)))return!1;return!0}function Rt(t,e,r=[]){let n=new Set([...e,...r]);return e.every(i=>Object.hasOwn(t,i))&&Reflect.ownKeys(t).every(i=>typeof i=="string"&&n.has(i))}function Qe(t){return typeof t=="string"&&t.trim().length>0}function pf(t){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=1}var is=["schemaVersion","requestId","featureSchemaVersion","evidence"],Oc=["repoId","worktreeId","projectId","snapshotHash","candidateSetHash","truncated"];function Ic(t){if(t.schemaVersion!==Bp||!Qe(t.requestId)||!Qe(t.featureSchemaVersion))return!1;let e=t.evidence;return st(e)&&Rt(e,Oc)&&Oc.filter(r=>r!=="truncated").every(r=>Qe(e[r]))&&e.truncated===!1}function gf(t,e){if(!Ic(e))return!1;let r=e.evidence;return e.schemaVersion===t.schemaVersion&&e.requestId===t.requestId&&e.featureSchemaVersion===t.featureSchemaVersion&&Oc.every(n=>r[n]===t.evidence[n])}var Ry=128*1024,yy=256,Oy=/^[a-f0-9]{64}$/;function gt(t){throw new E(T.SEMANTIC_CORPUS_INVALID,t)}function os(t,e){return(!st(t)||!Rt(t,e))&>("Invalid corpus record shape"),t}function po(t,e){e.every(r=>Qe(t[r]))||gt("Corpus identity must be nonblank")}function ss(t,e){(typeof t!="string"||!e.includes(t))&>("Unsupported corpus enum value")}function uo(t){(typeof t!="string"||!Oy.test(t))&>("Corpus hash must be lowercase SHA-256")}function ff(t,e=yy){return(!Array.isArray(t)||t.length>e||!hr(t))&>("Invalid or oversized corpus array"),t}function ni(t){let e=ff(t);return(!e.every(Qe)||new Set(e).size!==e.length)&>("Corpus references must be nonblank and unique"),e}function Iy(t){let e=["repoId","repoFamily","revision","projectId","callSiteId","snapshotHash","duplicateGroup","license","language","relation"],r=os(t,[...e,"usage","origin","split"]);po(r,e),uo(r.snapshotHash),ss(r.usage,["evaluation-only","training-and-evaluation"]),ss(r.origin,["real","synthetic"]),ss(r.split,["train","calibration","test","temporal"])}function Ly(t){let e=os(t,["status","server","version","configHash","snapshotHash","targetIds"]);po(e,["server","version"]),uo(e.configHash),uo(e.snapshotHash),ss(e.status,["resolved","timeout","empty","not-ready","unsupported","error"]),ni(e.targetIds)}function Cy(t){let e=os(t,["status","snapshotHash","positiveTargetIds","negativeTargetIds","evidenceRefs"]);uo(e.snapshotHash),ss(e.status,["confirmed","unreviewed","conflict","out-of-scope"]),ni(e.positiveTargetIds),ni(e.negativeTargetIds);let r=ni(e.evidenceRefs);e.status==="confirmed"&&r.length===0&>("Confirmed gold requires independent evidence")}function Ny(t){let e=ff(t,Kn.MAX_CANDIDATES),r=[],n=[];for(let i of e){let s=os(i,["id","targetId"]);po(s,["id","targetId"]),r.push(s.id),n.push(s.targetId)}ni(r),ni(n)}function go(t){try{let e=os(t,["schemaVersion","sampleId","source","candidates","truncated","oracle","review"]);(e.schemaVersion!==1||typeof e.truncated!="boolean")&>("Invalid corpus version or truncation flag"),po(e,["sampleId"]),Iy(e.source),Ny(e.candidates),Ly(e.oracle),Cy(e.review);let r=JSON.stringify(e);return Buffer.byteLength(r,"utf8")>Ry&>("Corpus record exceeds 128 KiB"),JSON.parse(r)}catch(e){throw E.wrap(T.SEMANTIC_CORPUS_INVALID,"Invalid corpus sample",e)}}function Py(t){let{oracle:e,review:r}=t;return r.status==="conflict"?!0:r.status!=="confirmed"?!1:r.positiveTargetIds.some(n=>r.negativeTargetIds.includes(n))?!0:e.status!=="resolved"||e.targetIds.length===0?!1:e.targetIds.length!==r.positiveTargetIds.length||e.targetIds.some(n=>!r.positiveTargetIds.includes(n))}function Dy(t){return t.source.language!=="typescript"||t.source.relation!=="cross-file-call"||t.review.status==="out-of-scope"}function vy(t){let{source:e,oracle:r,review:n}=t;return e.snapshotHash!==r.snapshotHash||e.snapshotHash!==n.snapshotHash?"freshness-mismatch":Py(t)?"label-conflict":Dy(t)?"out-of-scope":r.status!=="resolved"||r.targetIds.length===0?"oracle-failure":n.status!=="confirmed"?"unreviewed":t.truncated?"input-truncated":"ready"}function by(t,e,r){return e==="out-of-scope"?"out-of-scope":e!=="ready"?"unresolved":r.review.positiveTargetIds.includes(t)?"confirmed-positive":r.review.negativeTargetIds.includes(t)?"confirmed-negative":"unresolved"}function fo(t){let e=vy(t),r=new Set(t.candidates.map(i=>i.targetId)),n=e==="ready"?[...t.review.positiveTargetIds]:[];return{sampleId:t.sampleId,reason:e,labels:t.candidates.map(i=>({candidateId:i.id,targetId:i.targetId,label:by(i.targetId,e,t)})),goldTargetIds:n,missingTargetIds:n.filter(i=>!r.has(i))}}var wy=1e5;function mf(t,e){new Set(t).size!==t.length&>(e)}function Lc(t,e,r,n){if(t.has(e)&&t.get(e)!==r)throw new E(n?T.SEMANTIC_CORPUS_LEAKAGE:T.SEMANTIC_CORPUS_INVALID,n?"Corpus group crosses splits":"Repository has inconsistent family identity");t.set(e,r)}function Fy(t){mf(t.map(i=>i.sampleId),"Duplicate corpus sample ID"),mf(t.map(i=>JSON.stringify([i.source.repoId,i.source.projectId,i.source.callSiteId,i.source.snapshotHash])),"Duplicate corpus call-site snapshot");let e=new Map,r=new Map,n=new Map;for(let{source:i}of t)if(Lc(e,i.repoId,i.repoFamily,!1),Lc(r,i.repoFamily,i.split==="temporal"?"test":i.split,!0),Lc(n,i.duplicateGroup,i.split,!0),i.usage==="evaluation-only"&&i.split==="train")throw new E(T.SEMANTIC_CORPUS_LEAKAGE,"Evaluation-only source cannot enter training split")}function hf(t){try{(!st(t)||!Rt(t,["schemaVersion","corpusId","corpusVersion","splitSeed","samples"]))&>("Invalid corpus manifest shape"),(t.schemaVersion!==1||![t.corpusId,t.corpusVersion,t.splitSeed].every(Qe))&>("Invalid corpus manifest identity");let e=t.samples;(!Array.isArray(e)||e.length>wy||!hr(e))&>("Invalid or oversized corpus sample list");let r=e.map(go).sort((n,i)=>n.sampleId<i.sampleId?-1:n.sampleId>i.sampleId?1:0);return Fy(r),{schemaVersion:1,corpusId:t.corpusId,corpusVersion:t.corpusVersion,splitSeed:t.splitSeed,samples:r}}catch(e){throw E.wrap(T.SEMANTIC_CORPUS_INVALID,"Invalid corpus manifest",e)}}import{createHash as My}from"crypto";var Cc=["train","calibration","test","temporal"],Ef=["real","synthetic"];function mo(t,e){let r=0,n=0,i=0,s=0;for(let o of t){let a=e.get(o.sampleId).reason;if(a!=="ready"&&a!=="input-truncated")continue;let l=o.review.positiveTargetIds,c=new Set(o.candidates.map(p=>p.targetId)),u=l.filter(p=>c.has(p)).length;r++,n+=l.length,i+=u,u===l.length&&s++}return{requests:t.length,trustedGoldRequests:r,goldTargets:n,coveredTargets:i,fullyCoveredRequests:s,candidateRecall:n===0?null:i/n,setCoverage:r===0?null:s/r}}function Nc(t,e,r){let n={train:0,calibration:0,test:0,temporal:0};for(let i of Cc){let s=t.filter(o=>o.source.origin==="real"&&o.source.split===i&&e.get(o.sampleId).reason==="ready");n[i]=new Set(s.map(o=>o.source[r])).size}return n}function _f(t,e){return e.train>=4&&e.calibration>=2&&e.test>=2&&t.train+t.calibration+t.test>=1e4&&t.test>=2e3&&t.temporal>=1}function Pc(t){if(Array.isArray(t))return`[${t.map(Pc).join(",")}]`;if(t!==null&&typeof t=="object"){let e=t;return`{${Object.keys(e).sort().map(r=>`${JSON.stringify(r)}:${Pc(e[r])}`).join(",")}}`}return JSON.stringify(t)}function ky(t){return t===null?"insufficient-evidence":t>=.99?"pass":"fail"}function Sf(t){let{samples:e,...r}=t,n=e.map(fo),i=new Map(n.map(d=>[d.sampleId,d])),s={ready:0,"freshness-mismatch":0,"label-conflict":0,"out-of-scope":0,"oracle-failure":0,unreviewed:0,"input-truncated":0};for(let d of n)s[d.reason]++;let o=mo(e.filter(d=>d.source.origin==="real"),i),a=mo(e.filter(d=>d.source.origin==="synthetic"),i),l=Nc(e,i,"duplicateGroup"),c=Nc(e,i,"repoFamily"),u=Ef.flatMap(d=>Cc.map(f=>({origin:d,split:f,metrics:mo(e.filter(m=>m.source.origin===d&&m.source.split===f),i)}))),p=u.find(d=>d.origin==="real"&&d.split==="test").metrics.candidateRecall;return{...r,datasetHash:My("sha256").update(Pc(t),"utf8").digest("hex"),results:n,reasons:s,real:o,synthetic:a,slices:u,independentReadyRealRequests:l,readyRealFamilies:c,gates:{sampleSize:_f(l,c)?"pass":"insufficient-evidence",candidateRecall:ky(p)}}}var ho=class{label(e){return fo(go(e))}audit(e){return Sf(hf(e))}};import Tf from"fs/promises";import Gy from"os";import xy from"path";var j={DETECTED_CHANGES:"Detected changes",WORKING_TREE_HEAD:"working tree (HEAD)",NO_LOCAL_GRAPH_IMPACT:"No local graph impact detected for the changed files.",TOP_AFFECTED_FILES:"Top affected files:",analysisBase:t=>`Base: ${t}`,analysisFilesChanged:t=>`Files changed: ${t}`,analysisRiskLevel:t=>`Risk level: ${t}`,analysisImpactedNodes:(t,e)=>`Impacted nodes: ${t} across ${e} changed file(s).`,analysisAffectedFileLine:(t,e,r)=>` - ${t}: ${e} dependent(s) [${r}]`,KNOWLEDGE_BRANCH_ALREADY_EXISTS:"Knowledge branch already exists",CONCURRENT_INITIAL_COMMIT_SKIPPED:"Knowledge branch was created by a concurrent process; skipping duplicate initial commit",CREATED_KNOWLEDGE_BRANCH:"Created hidden knowledge branch",NO_GIT_HOOKS_DIR:"No .git/hooks directory; skipping post-commit hook install",POST_COMMIT_HOOK_ALREADY_INSTALLED:"Post-commit hook already installed",CONCURRENT_HOOK_INSTALL_SKIPPED:"Post-commit hook was installed by a concurrent process; skipping duplicate append",FAILED_TO_INSTALL_HOOK:"Failed to install post-commit hook",INSTALLED_POST_COMMIT_HOOK:"Installed post-commit hook",UPGRADED_LEGACY_POST_COMMIT_HOOK:"Upgraded legacy post-commit hook (docuvia snapshot -> docuvia analyze)",UPGRADED_POST_COMMIT_HOOK_FLUSH_L3:"Upgraded post-commit hook (added flush-staged-l3 step, issue #42)",UPGRADED_POST_COMMIT_HOOK_NOHUP:"Upgraded post-commit hook (nohup + log redirect, issue #58)",PRE_PUSH_HOOK_ALREADY_INSTALLED:"Pre-push hook already installed",CONCURRENT_PRE_PUSH_HOOK_INSTALL_SKIPPED:"Pre-push hook was installed by a concurrent process; skipping duplicate append",FAILED_TO_INSTALL_PRE_PUSH_HOOK:"Failed to install pre-push hook",INSTALLED_PRE_PUSH_HOOK:"Installed pre-push hook",UPGRADED_LEGACY_PRE_PUSH_HOOK:"Upgraded legacy pre-push hook (added sync-knowledge step)",REMOVED_POST_COMMIT_HOOK:"Removed post-commit hook",REMOVED_PRE_PUSH_HOOK:"Removed pre-push hook",NO_POST_COMMIT_HOOK_TO_REMOVE:"No Docuvia post-commit hook to remove",NO_PRE_PUSH_HOOK_TO_REMOVE:"No Docuvia pre-push hook to remove",FAILED_TO_REMOVE_POST_COMMIT_HOOK:"Failed to remove post-commit hook",FAILED_TO_REMOVE_PRE_PUSH_HOOK:"Failed to remove pre-push hook",NO_KNOWLEDGE_BRANCH_TO_DELETE:"No knowledge branch to delete",DELETED_KNOWLEDGE_BRANCH:"Deleted hidden knowledge branch",FAILED_TO_DELETE_KNOWLEDGE_BRANCH:"Failed to delete knowledge branch",REPAIRED_DUPLICATE_POST_COMMIT_HOOK:"Repaired duplicate post-commit hook block",NOTHING_TO_REPAIR:"Nothing to repair -- post-commit hook is not duplicated",PACKED_SNAPSHOT_ONTO_BRANCH:"Packed snapshot onto knowledge branch",NO_REMOTE_SKIP_RECONCILIATION:"No remote configured; skipping knowledge branch reconciliation",FAILED_TO_FETCH_CONTINUING_OFFLINE:"Failed to fetch knowledge branch from remote; continuing offline",REMOTE_REF_NOT_FOUND_TEXT:"couldn't find remote ref",REMOTE_KNOWLEDGE_BRANCH_NOT_YET_ON_REMOTE:"Knowledge branch does not exist on remote yet; treating as first-ever push",ADOPTED_REMOTE_BRANCH:"Adopted remote knowledge branch (no local copy existed)",FAST_FORWARDED_LOCAL_BRANCH:"Fast-forwarded local knowledge branch to remote",MERGED_DIVERGED_BRANCH:"Merged diverged knowledge branch",FAILED_TO_PUSH_WILL_RETRY:"Failed to push knowledge branch to remote; will retry on next sync",SNAPSHOT_UNKNOWN:"Snapshot [unknown]",MERGE_WINNER_LOCAL:"local",MERGE_WINNER_REMOTE:"remote",mergeCommitMessage:t=>`Merge knowledge branch (${t?"local":"remote"} wins)`,snapshotCommitMessage:t=>`Snapshot [${t.slice(0,7)}]
|
|
108
108
|
|
|
109
109
|
${S.SOURCE_COMMIT_TRAILER_KEY}: ${t}`,NOTHING_TO_HYDRATE:"Nothing to hydrate from yet \u2014 knowledge branch doesn't exist",HYDRATED_KNOWLEDGE_GRAPH:"Hydrated knowledge graph from git",HYDRATE_REFUSED_PENDING_WRITE:"Refused automatic hydration: a knowledge-branch write from this workspace has not been confirmed yet (its pack attempt is pending or failed); local.db was left untouched",hydrateRefusedCatastrophicShrink:(t,e)=>`Refused automatic hydration: the resolved knowledge commit has ${e} node(s), a catastrophic reduction from local.db's current ${t}; local.db was left untouched`,IMPORTED_L3_CARDS:"Imported L3 decision cards from knowledge branch",failedToWriteMarkdown:(t,e,r)=>`Failed to write markdown for node ${t} (${e}): ${r}`,sanitizedPathEscapesKnowledgeDir:t=>`Sanitized markdown path escapes knowledge directory: ${t}`,markdownFrontmatter:(t,e,r,n)=>`---
|
|
110
110
|
id: ${t}
|
|
@@ -173,7 +173,7 @@ ${L.content}`).join(`
|
|
|
173
173
|
`).filter(o=>o.trim().length>0);for(let o of s)try{let a=JSON.parse(o);if(typeof a.ts=="string"){let l=Date.parse(a.ts);if(!Number.isNaN(l)&&i-l<=n)return!0}}catch{}return!1}async runTierCQueueDiagnostic(e){if(!y.has(A.GraphStoreOpener))return!0;let r;try{r=await y.resolve(A.GraphStoreOpener)({dbPath:ie(this.workspaceRoot),readonly:!0});let i=lr(r).length;if(i===0)return e[ue.TIER_C_QUEUE]={status:K.PASS,message:k.TIER_C_QUEUE_OK(0,0)},!0;let s=await this.readLastTierCDrainOutcome();return s?s.processed===0?(e[ue.TIER_C_QUEUE]={status:K.FAIL,message:k.TIER_C_QUEUE_STUCK(i,s.reason??"unknown"),suggestion:k.TIER_C_QUEUE_STUCK_SUGGESTION},!1):(e[ue.TIER_C_QUEUE]={status:K.PASS,message:k.TIER_C_QUEUE_OK(i,s.processed)},!0):(e[ue.TIER_C_QUEUE]={status:K.FAIL,message:k.TIER_C_QUEUE_NEVER_DRAINED(i),suggestion:k.TIER_C_QUEUE_NEVER_DRAINED_SUGGESTION},!1)}catch{return!0}finally{await r?.close()}}async runStagedL3Diagnostic(e){let r;try{r=await Fi(this.workspaceRoot,this.logger)}catch{return!0}let n=Date.now(),i=r.filter(a=>{let l=Date.parse(a.stagedAt);return Number.isFinite(l)&&n-l>=S.DEFAULT_STAGED_L3_STRANDED_AFTER_MS});if(i.length===0)return e[ue.STAGED_L3_DECISIONS]={status:K.PASS,message:k.STAGED_L3_OK(r.length)},!0;let s=i.reduce((a,l)=>Date.parse(a.stagedAt)<=Date.parse(l.stagedAt)?a:l),o=Math.floor((n-Date.parse(s.stagedAt))/S.DEFAULT_STAGED_L3_STRANDED_AFTER_MS);return e[ue.STAGED_L3_DECISIONS]={status:K.FAIL,message:k.STAGED_L3_STRANDED(i.length,o,s.filePath),suggestion:k.STAGED_L3_STRANDED_SUGGESTION},!1}async readLastTierCDrainOutcome(){let e=Lt.join(this.workspaceRoot,Ee,Dr,$i),r;try{r=await cr.readFile(e,H)}catch{return}let n,i;for(let s of r.split(`
|
|
174
174
|
`))try{let o=JSON.parse(s);o.event===Y.TIER_C_SUMMARY?n={processed:Number(o.processed??0)}:o.event===Y.TIER_C_ITEM_FAILED&&typeof o.reason=="string"&&(i=o.reason)}catch{}if(n)return{processed:n.processed,reason:i}}async runL2SemanticCoverageDiagnostic(e,r){if(!y.has(A.GraphStoreOpener))return!0;let n;try{n=await y.resolve(A.GraphStoreOpener)({dbPath:ie(this.workspaceRoot),readonly:!0});let{totalNodes:s,describedNodes:o}=n.graph.getSemanticCoverage(),a=s>0?o/s:1,l=a<S.DEFAULT_L2_SEMANTIC_COVERAGE_FAIL_THRESHOLD,c=!!r;return e[ue.L2_SEMANTIC_COVERAGE]=l?c?{status:K.FAIL,message:k.L2_SEMANTIC_COVERAGE_LOW(o,s,a*100),suggestion:k.L2_SEMANTIC_COVERAGE_LOW_SUGGESTION}:{status:K.PASS,message:k.L2_SEMANTIC_COVERAGE_STRUCTURAL_ONLY(o,s)}:{status:K.PASS,message:k.L2_SEMANTIC_COVERAGE_OK(o,s)},!(l&&c)}catch{return!0}finally{await n?.close()}}async runWorktreeDivergenceDiagnostic(e){if(!y.has(A.GitProvider))return!0;try{let n=await y.resolve(A.GitProvider).listWorktrees(this.workspaceRoot),i=Lt.resolve(this.workspaceRoot),s=[];for(let o of n){if(Lt.resolve(o.path)===i)continue;let a=Lt.join(o.path,Ee,Yi);await cr.stat(a).catch(()=>null)&&s.push(o.path)}return e[ue.WORKTREE_DIVERGENCE]=s.length>0?{status:K.FAIL,message:k.WORKTREE_DIVERGENCE_FAIL(s.length,s),suggestion:k.WORKTREE_DIVERGENCE_SUGGESTION}:{status:K.PASS,message:k.WORKTREE_DIVERGENCE_OK(n.length)},s.length===0}catch{return!0}}async runAgentAuthoredAdoptionDiagnostic(e){if(!y.has(A.GraphStoreOpener)||!y.has(A.GitProvider))return!0;let r;try{let n=y.resolve(A.GitProvider);r=await y.resolve(A.GraphStoreOpener)({dbPath:ie(this.workspaceRoot),readonly:!0});let s=await n.getHeadSha(this.workspaceRoot),o=r.meta.get(S.META_KEY_LAST_INGESTED_SOURCE_SHA),a=o&&o!==s?await n.getChangedFilesSince(this.workspaceRoot,o):[];if(a.length===0)return e[ue.AGENT_AUTHED_ADOPTION]={status:K.PASS,message:k.AGENT_AUTHED_ADOPTION_SKIPPED},!0;let l=await Fi(this.workspaceRoot,this.logger),c=new Set(l.map(d=>d.filePath)),u=r.l3.getAllExportable().filter(d=>d.source===xt.AGENT_AUTHORED).length,p=a.filter(d=>!c.has(d.file)).length;return e[ue.AGENT_AUTHED_ADOPTION]={status:K.PASS,message:k.AGENT_AUTHED_ADOPTION_OK(l.length,a.length,p,u)},!0}catch{return!0}finally{await r?.close()}}async runCallGraphResolutionDiagnostic(e){if(!y.has(A.GraphStoreOpener))return!0;let r;try{r=await y.resolve(A.GraphStoreOpener)({dbPath:ie(this.workspaceRoot),readonly:!0});let{byFile:i,total:s}=wS(r),o=Object.keys(i).length;if(o===0||s.total===0)return e[ue.CALL_GRAPH_RESOLUTION]={status:K.PASS,message:k.CALL_GRAPH_RESOLUTION_NO_DATA},!0;let a=cg(s),l=a>0?s.resolved/a:1,c=l<S.DEFAULT_CALL_RESOLUTION_NOTE_THRESHOLD;return e[ue.CALL_GRAPH_RESOLUTION]=c?{status:K.PASS,message:k.CALL_GRAPH_RESOLUTION_LOW(s.resolved,a,l*100,o),suggestion:k.CALL_GRAPH_RESOLUTION_LOW_SUGGESTION}:{status:K.PASS,message:k.CALL_GRAPH_RESOLUTION_OK(s.resolved,a,o)},!0}catch{return!0}finally{await r?.close()}}async runDbDiagnostics(e){let r=Lt.join(this.workspaceRoot,Ee,Yi);if(!await cr.stat(r).catch(()=>null))return e[ue.DB_FOUND]={status:K.FAIL,message:k.DB_NOT_FOUND_AT(r)},!1;if(!y.has(A.DiagnosticRunnerDb))return e[ue.DB_RUNNER]={status:K.FAIL,message:k.DB_RUNNER_NOT_REGISTERED},!1;let s=await y.resolve(A.DiagnosticRunnerDb).checkHealth(r);return this.mergeDiagnosticResults(e,s)}async runGitDiagnostics(e){if(!y.has(A.DiagnosticRunnerGit))return e[ue.GIT_RUNNER]={status:K.FAIL,message:k.GIT_RUNNER_NOT_REGISTERED},!1;try{let n=await y.resolve(A.DiagnosticRunnerGit,{logger:this.logger}).checkHealth(this.workspaceRoot);return this.mergeDiagnosticResults(e,n)}catch(r){return e[ue.GIT_REACHABILITY]=this.buildGitReachabilityFailure(r),!1}}mergeDiagnosticResults(e,r){let n=!0;for(let[i,s]of Object.entries(r))e[i]=s,s.status===K.FAIL&&(n=!1);return n}buildGitReachabilityFailure(e){let r=e instanceof E||e instanceof Error?e.message:String(e),n;return e instanceof E&&(e.code===T.GIT_NETWORK_TIMEOUT?n=k.GIT_NETWORK_TIMEOUT_SUGGESTION:e.code===T.GIT_COMMAND_FAILED&&r.includes(k.GIT_NOT_A_REPO_TEXT)?n=k.GIT_NOT_A_REPO_SUGGESTION:e.code===T.GIT_COMMAND_FAILED&&r.includes(k.GIT_REMOTE_UNREADABLE_TEXT)&&(n=k.GIT_REMOTE_UNREADABLE_SUGGESTION)),{status:K.FAIL,message:k.GIT_REACHABILITY_FAILED(r),suggestion:n}}async runLogsDiagnostics(e){let r=Lt.join(this.workspaceRoot,Ee,Dr);try{let{errorsFound:n,logsChecked:i}=await this.scanLogFiles(r);return n>0?(e[ue.LOGS]={status:K.FAIL,message:k.LOGS_ERRORS_FOUND(n),suggestion:k.LOGS_ERRORS_FOUND_SUGGESTION},!1):(e[ue.LOGS]={status:K.PASS,message:k.LOGS_CHECKED_CLEAN(i)},!0)}catch{return e[ue.LOGS]={status:K.PASS,message:k.LOGS_NOT_FOUND_AT(r)},!0}}async scanLogFiles(e){let r=0,n=0,i=await cr.readdir(e);for(let s of i){if(!s.endsWith(VT))continue;n++;let a=(await cr.readFile(Lt.join(e,s),H)).split(`
|
|
175
175
|
`).filter(l=>l.trim().length>0);for(let l of a)try{let c=JSON.parse(l);c.level&&c.level>=50&&r++}catch{}}return{errorsFound:r,logsChecked:n}}};var Ml=class{constructor(e,r){this.workspaceRoot=e;this.logger=r}workspaceRoot;logger;async execute(e=!1){let{workspaceRoot:r,logger:n}=this,i=y.resolve(A.KnowledgeGitService,{logger:n}),s=await this.removeHookSafely(()=>i.removePostCommitHook(r),S.POST_COMMIT_HOOK_NAME),o=await this.removeHookSafely(()=>i.removePrePushHook(r),S.PRE_PUSH_HOOK_NAME),a=!1;if(!e)try{({deleted:a}=await i.deleteKnowledgeBranch(r))}catch(l){this.logger.warn("Failed to delete the docuvia-knowledge git branch",{error:l instanceof Error?l.message:String(l)})}return{postCommitRemoved:s,prePushRemoved:o,knowledgeBranchDeleted:a}}async removeHookSafely(e,r){try{let{removed:n}=await e();return n}catch(n){return this.logger.warn(`Failed to remove the ${r} git hook`,{error:n instanceof Error?n.message:String(n)}),!1}}};import QT from"fs/promises";import YF from"path";var XT={REMOVED:"Removed .docuvia/ directory",NOT_FOUND:".docuvia/ directory not present; nothing to remove"};async function ZT(t,e){let r=YF.join(t,Ee);if(!Pi(r,t))throw new E(T.UNINSTALL_WORKFLOW_FAILED,`Refusing to remove directory at ${r}: resolved outside workspace ${t}`);let n=!0;try{await QT.access(r)}catch{n=!1}return n?(await QT.rm(r,{recursive:!0,force:!0}),e.info(XT.REMOVED),{removed:!0}):(e.debug(XT.NOT_FOUND),{removed:!1})}async function eA(t,e){return Mi(t,e)}async function tA(t,e,r,n){return await kT(t,e,r,n),Mi(t,n)}function Se(t,e){let r=R.get(t,e);if(r===void 0)throw new E(T.INVALID_INPUT,IS.MISSING_MEMORY_KEY(e,t));return r}function rA(t){let e=R.get(t,O.LSP_BINARY_OVERRIDE),r=R.get(t,O.LSP_ARGS_OVERRIDE),n=R.get(t,O.LSP_TIMEOUT_MS),i=R.get(t,O.LSP_MAX_PROCESSES);if(!(e===void 0&&r===void 0&&n===void 0&&i===void 0))return{binaryOverride:e,argsOverride:r,timeoutMs:n,maxProcesses:i}}var X={async init(t,e){let r=Se(t,O.WORKSPACE_ROOT);return new nl(r,e).execute()},async clean(t,e){let r=Se(t,O.WORKSPACE_ROOT);return new ol(r,e).execute()},async status(t,e){let r=Se(t,O.WORKSPACE_ROOT);return new ul(r,e).execute()},async sync(t,e,r){let n=Se(t,O.WORKSPACE_ROOT),i=Se(t,O.API_URL),s=Se(t,O.PROJECT_ID),o=R.get(t,O.COMMIT_SHA);return new pl(n,e,i,r).execute({projectId:s,commitSha:o})},async analyze(t,e,r){let n=Se(t,O.WORKSPACE_ROOT);if(R.get(t,O.FLUSH_STAGED_L3))return new on(n,e,{flushStagedL3:!0}).execute();let s=R.get(t,O.TARGET_PATH),o=R.get(t,O.AGENT_AUTHORED_DECISIONS);if(s&&o)return new on(n,e,{targetPath:s,agentAuthoredDecisions:o}).execute();if(s){let l=Se(t,O.LLM_BASE_URL),c=Se(t,O.LLM_MODEL);return new on(n,e,{targetPath:s,llmBaseUrl:l,llmApiKey:r,llmModel:c}).execute()}return R.get(t,O.ESCALATE_TO_LSP)?new on(n,e,{escalateToLsp:!0,lspProviderConfig:rA(t),tierBCommitCap:R.get(t,O.TIER_B_COMMIT_CAP),full:R.get(t,O.TIER_B_FULL_RESYNC),llmBaseUrl:R.get(t,O.LLM_BASE_URL),llmApiKey:r,llmModel:R.get(t,O.LLM_MODEL),tierCDailyCallCap:R.get(t,O.TIER_C_DAILY_CALL_CAP),tierCDailyTokenCap:R.get(t,O.TIER_C_DAILY_TOKEN_CAP),tierCWallClockMs:R.get(t,O.TIER_C_WALL_CLOCK_MS),tierCItemCap:R.get(t,O.TIER_C_ITEM_CAP),tierCLoadThreshold:R.get(t,O.TIER_C_LOAD_THRESHOLD),force:R.get(t,O.FORCE),tierCDrainAll:R.get(t,O.TIER_C_DRAIN_ALL)}).execute():new on(n,e).execute()},async stageAgentAuthoredDecisions(t,e){let r=Se(t,O.WORKSPACE_ROOT),n=Se(t,O.TARGET_PATH),i=Se(t,O.AGENT_AUTHORED_DECISIONS),s=sl(n,r);if(s.status==="outside")throw new E(T.INVALID_INPUT,J.PATH_NOT_FOUND(n));if(s.status==="missing")throw new E(T.FS_READ_FAILED,J.PATH_NOT_FOUND(n));return bT(r,n,i,e)},async review(t,e){let r=Se(t,O.WORKSPACE_ROOT),n=R.get(t,O.BASE_REF);return new _l(r,e).execute(n)},async impact(t,e){let r=Se(t,O.WORKSPACE_ROOT),n=Se(t,O.TARGET);return new Sl(r,e).execute(n)},async query(t,e){let r=Se(t,O.WORKSPACE_ROOT),n=Se(t,O.TARGET),i=R.get(t,O.LIMIT);return new yl(r,e).execute(n,i)},async exportTopology(t,e){let r=Se(t,O.WORKSPACE_ROOT),n=R.get(t,O.COLLAPSE);return new Cl(r,e).execute({collapse:n})},async snapshot(t,e){let r=Se(t,O.WORKSPACE_ROOT);return new Nl(r,e).execute()},async hydrate(t,e,r){let n=Se(t,O.WORKSPACE_ROOT);return new vl(n,e).execute(r)},async syncKnowledge(t,e){let r=Se(t,O.WORKSPACE_ROOT),n=R.get(t,O.GIT_NETWORK_TIMEOUT_MS);return new wl(r,e,n).execute()},async doctor(t,e,r){let n=Se(t,O.WORKSPACE_ROOT);return new Fl(n,e).execute(r)},async uninstallGitHooks(t,e){let r=Se(t,O.WORKSPACE_ROOT),n=R.get(t,O.KEEP_DB);return new Ml(r,e).execute(n)},async removeDocuviaDir(t,e){let r=Se(t,O.WORKSPACE_ROOT);return ZT(r,e)},async listHooks(t,e){let r=Se(t,O.WORKSPACE_ROOT);return eA(r,e)},async setHookEnabled(t,e){let r=Se(t,O.WORKSPACE_ROOT),n=Se(t,O.HOOK_NAME),i=Se(t,O.HOOK_ENABLED);return tA(r,n,i,e)},async checkTierBGate(t,e){let r=Se(t,O.WORKSPACE_ROOT);return zT(r,e,rA(t))}};import nA from"pino";import{createRequire as WF}from"module";var jF=WF(import.meta.url),Sp="pino-pretty",VF=`[docuvia] ${Sp} unavailable, falling back to plain JSON logs.
|
|
176
|
-
`,zF=["req.headers.authorization","req.headers.Authorization","*.authorization","*.Authorization","*.*.authorization","*.*.Authorization","password","*.password","*.*.password","token","*.token","*.*.token","apiKey","*.apiKey","*.*.apiKey","OPENAI_API_KEY","*.OPENAI_API_KEY","*.*.OPENAI_API_KEY"],JF="[REDACTED]",qF="1";function QF(){if(process.env.DOCUVIA_PRETTY_LOGS===qF)try{return jF.resolve(Sp),{target:Sp,options:{colorize:!0,destination:2}}}catch{process.stderr.write(VF);return}}function ee(){let t=QF(),e=nA({level:process.env.LOG_LEVEL||Oe.INFO,redact:{paths:[...zF],censor:JF},transport:t},t?void 0:nA.destination(2)),r=new Up;return r.onLog(n=>{e[n.level](n.context??{},n.message)}),r}var an={UNKNOWN_OPTIONS:t=>`Unknown options provided: ${t}`,UNKNOWN_PLATFORMS:(t,e)=>`Unknown --platform value(s): ${t}. Available platforms: ${e}`,WORKSPACE_ROOT_EMPTY:"workspace root must not be empty",INVALID_FORMAT:(t,e)=>`Unknown --format value: ${t}. Available formats: ${e}`};var _t=class{};import*as rt from"fs/promises";import*as kt from"path";var iA=".js",sA=".cjs",kl=class extends _t{name=Ig;slug=Dg;async installHooks(e){await this.configureHooks(e),await this.configureMcpServer(e)}async configureHooks(e){let r=kt.join(e,Jn);await rt.mkdir(r,{recursive:!0}),await rt.writeFile(kt.join(r,Fr),eo,{mode:493});let n=fn.replace(/\${HOOKS_DIR}/g,Ec).replace(iA,sA);await Nt(kt.join(r,qn),n,Fr)}async configureMcpServer(e){let r=kt.join(e,gc);try{let n={mcpServers:{}};try{let i=await rt.readFile(r,H);n=JSON.parse(i)}catch{await rt.mkdir(kt.dirname(r),{recursive:!0})}n.mcpServers=n.mcpServers||{},n.mcpServers[Qn]={command:Xs,args:[xg,...Zs]},await rt.writeFile(r,JSON.stringify(n,null,2)),h.success(g.INIT_HOOKS_REGISTERED_MCP+r)}catch(n){let i=n instanceof Error?n.message:String(n);h.warn(g.INIT_HOOKS_FAIL_CURSOR_MCP+i)}}async uninstallHooks(e){let r=kt.join(e,Jn);try{await rt.unlink(kt.join(r,Fr)),h.success(`${g.UNINSTALL_REMOVED_FILE_PREFIX}${Fr}`)}catch{}let{removeBlock:n}=await import("./fs-utils-
|
|
176
|
+
`,zF=["req.headers.authorization","req.headers.Authorization","*.authorization","*.Authorization","*.*.authorization","*.*.Authorization","password","*.password","*.*.password","token","*.token","*.*.token","apiKey","*.apiKey","*.*.apiKey","OPENAI_API_KEY","*.OPENAI_API_KEY","*.*.OPENAI_API_KEY"],JF="[REDACTED]",qF="1";function QF(){if(process.env.DOCUVIA_PRETTY_LOGS===qF)try{return jF.resolve(Sp),{target:Sp,options:{colorize:!0,destination:2}}}catch{process.stderr.write(VF);return}}function ee(){let t=QF(),e=nA({level:process.env.LOG_LEVEL||Oe.INFO,redact:{paths:[...zF],censor:JF},transport:t},t?void 0:nA.destination(2)),r=new Up;return r.onLog(n=>{e[n.level](n.context??{},n.message)}),r}var an={UNKNOWN_OPTIONS:t=>`Unknown options provided: ${t}`,UNKNOWN_PLATFORMS:(t,e)=>`Unknown --platform value(s): ${t}. Available platforms: ${e}`,WORKSPACE_ROOT_EMPTY:"workspace root must not be empty",INVALID_FORMAT:(t,e)=>`Unknown --format value: ${t}. Available formats: ${e}`};var _t=class{};import*as rt from"fs/promises";import*as kt from"path";var iA=".js",sA=".cjs",kl=class extends _t{name=Ig;slug=Dg;async installHooks(e){await this.configureHooks(e),await this.configureMcpServer(e)}async configureHooks(e){let r=kt.join(e,Jn);await rt.mkdir(r,{recursive:!0}),await rt.writeFile(kt.join(r,Fr),eo,{mode:493});let n=fn.replace(/\${HOOKS_DIR}/g,Ec).replace(iA,sA);await Nt(kt.join(r,qn),n,Fr)}async configureMcpServer(e){let r=kt.join(e,gc);try{let n={mcpServers:{}};try{let i=await rt.readFile(r,H);n=JSON.parse(i)}catch{await rt.mkdir(kt.dirname(r),{recursive:!0})}n.mcpServers=n.mcpServers||{},n.mcpServers[Qn]={command:Xs,args:[xg,...Zs]},await rt.writeFile(r,JSON.stringify(n,null,2)),h.success(g.INIT_HOOKS_REGISTERED_MCP+r)}catch(n){let i=n instanceof Error?n.message:String(n);h.warn(g.INIT_HOOKS_FAIL_CURSOR_MCP+i)}}async uninstallHooks(e){let r=kt.join(e,Jn);try{await rt.unlink(kt.join(r,Fr)),h.success(`${g.UNINSTALL_REMOVED_FILE_PREFIX}${Fr}`)}catch{}let{removeBlock:n}=await import("./fs-utils-UY4EYC7B.js"),{CURSOR_RULES_FILENAME:i,AGENT_INSTRUCTIONS_MARKER:s,AGENT_INSTRUCTIONS_END_MARKER:o}=await import("./init-templates-CC5QOU4T.js"),a=kt.join(e,i);await n(a,`<!-- ${s} -->`,`<!-- ${o} -->`);let l=kt.join(r,qn),c=!1;try{(await rt.readFile(l,H)).trim()===fn.replace(/\$\{HOOKS_DIR\}/g,Ec).replace(iA,sA).trim()&&(await rt.unlink(l),c=!0)}catch{}if(c)try{await rt.rmdir(r)}catch{}let u=kt.join(e,gc);try{let p=await rt.readFile(u,H),d=JSON.parse(p);d?.mcpServers&&d.mcpServers[Qn]&&(delete d.mcpServers[Qn],await rt.writeFile(u,JSON.stringify(d,null,2)),h.success(`${g.UNINSTALL_REMOVED_MCP_SERVER_PREFIX}${u}`))}catch{}}};import*as Je from"fs/promises";import*as nt from"path";import Hs from"process";var XF="win32",ZF="darwin",eM="Library",tM="Application Support",rM=".config";async function nM(t){try{await Je.unlink(nt.join(t,wr)),h.success(`${g.UNINSTALL_REMOVED_FILE_PREFIX}${wr}`)}catch{}}async function iM(t){let e=nt.join(t,qn);try{if((await Je.readFile(e,H)).trim()===fn.replace(/\$\{HOOKS_DIR\}/g,hc).trim())return await Je.unlink(e),!0}catch{}return!1}async function sM(t){try{await Je.rmdir(t)}catch{}}function oA(){let t=fn.replace(/\${HOOKS_DIR}/g,kg);return JSON.parse(t)[Ht][0]}function lA(t){let e=t.hooks,r=Array.isArray(e)?e[0]?.command:void 0;return typeof r=="string"?r:""}function cA(t,e){let r=t?.hooks;return Array.isArray(r)&&r.some(n=>n?.command===e)}async function oM(t){try{let e=await Je.readFile(t,H);return{settings:JSON.parse(e),aborted:!1}}catch(e){return e?.code!==Js?(h.warn(`${g.FS_READ_ERROR}${t} (${e?.code??g.FS_READ_ERROR_UNKNOWN_CODE}); leaving it untouched`),{settings:{},aborted:!0}):{settings:{},aborted:!1}}}async function aM(t,e){let{settings:r,aborted:n}=await oM(t);if(n)return;if(r.hooks=r.hooks??{},r.hooks[Ht]!==void 0&&!Array.isArray(r.hooks[Ht])){h.warn(g.FS_UNEXPECTED_SHAPE(Ht,t));return}r.hooks[Ht]=r.hooks[Ht]??[];let i=r.hooks[Ht],s=lA(e);i.some(o=>cA(o,s))||(i.push(e),await Je.mkdir(nt.dirname(t),{recursive:!0}),await Je.writeFile(t,`${JSON.stringify(r,null,2)}
|
|
177
177
|
`,H))}async function lM(t,e){let r;try{let s=await Je.readFile(t,H);r=JSON.parse(s)}catch{return}let n=r?.hooks?.[Ht];if(!Array.isArray(n))return;let i=n.filter(s=>!cA(s,e));if(i.length!==n.length){if(i.length===0?delete r.hooks[Ht]:r.hooks[Ht]=i,Object.keys(r.hooks).length===0&&delete r.hooks,Object.keys(r).length===0){await Je.unlink(t),h.success(g.UNINSTALL_REMOVED_FILE_PREFIX+Qs);return}await Je.writeFile(t,`${JSON.stringify(r,null,2)}
|
|
178
178
|
`,H),h.success(g.UNINSTALL_REMOVED_HOOK_FROM_SETTINGS_PREFIX+t)}}function cM(t){let e=nt.join(t,fc);h.info(`${g.UNINSTALL_CLAUDE_MCP_MANUAL_REMINDER} (${e}).`)}function aA(){return Hs.platform===XF?nt.join(Hs.env.APPDATA||"",ji):Hs.platform===ZF?nt.join(Hs.env.HOME||"",eM,tM,ji):nt.join(Hs.env.HOME||"",rM,ji)}var Gl=class extends _t{name=ji;slug=vg;async installHooks(e){await this.configureHooks(e),this.printMcpServerSnippet(e)}printMcpServerSnippet(e){let r=aA();if(!r)return;let n=nt.join(r,fc),i=JSON.stringify({mcpServers:{[Qn]:{command:Xs,args:[Gg,...Zs],env:{[Ug]:e}}}},null,2);h.info(`${g.INIT_CLAUDE_MCP_MANUAL_SNIPPET} (${n}):
|
|
179
179
|
${i}`)}async configureHooks(e){let r=nt.join(e,zn);await Je.mkdir(r,{recursive:!0}),await Je.writeFile(nt.join(r,wr),eo,{mode:493});let n=fn.replace(/\${HOOKS_DIR}/g,hc);await Nt(nt.join(r,qn),n,wr),await aM(nt.join(e,pc,Qs),oA())}async uninstallHooks(e){let r=nt.join(e,zn);await nM(r),await iM(r)&&await sM(r);try{await lM(nt.join(e,pc,Qs),lA(oA()))}catch{}let i=aA();i&&cM(i)}};import*as uA from"path";var xl=class extends _t{name=Lg;slug=bg;instructionsPath(e){return uA.join(e,hg,Eg)}async installHooks(e){await Nt(this.instructionsPath(e),kr,At)}async uninstallHooks(e){await Gr(this.instructionsPath(e),`<!-- ${At} -->`,`<!-- ${Mr} -->`)}};import*as dA from"path";var Ul=class extends _t{name=Cg;slug=wg;agentsMdPath(e){return dA.join(e,Rg)}async installHooks(e){await Nt(this.agentsMdPath(e),kr,At)}async uninstallHooks(e){await Gr(this.agentsMdPath(e),`<!-- ${At} -->`,`<!-- ${Mr} -->`)}};import*as Bl from"fs/promises";import*as Tp from"path";var Hl=class extends _t{name=Ng;slug=Fg;rulesDir(e){return Tp.join(e,Og)}rulesFilePath(e){return Tp.join(this.rulesDir(e),mc)}async installHooks(e){await Nt(this.rulesFilePath(e),kr,At)}async uninstallHooks(e){try{await Bl.unlink(this.rulesFilePath(e)),h.success(`${g.UNINSTALL_REMOVED_FILE_PREFIX}${mc}`)}catch{return}try{await Bl.rmdir(this.rulesDir(e))}catch{}}};import*as pA from"path";var Kl=class extends _t{name=Pg;slug=Mg;hermesMdPath(e){return pA.join(e,yg)}async installHooks(e){await Nt(this.hermesMdPath(e),kr,At)}async uninstallHooks(e){await Gr(this.hermesMdPath(e),`<!-- ${At} -->`,`<!-- ${Mr} -->`)}};function uM(){return[new kl,new Gl,new xl,new Ul,new Hl,new Kl]}function dM(t){return t.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean)}async function $l(t,e,r,n=uM()){if(e!==void 0){let i=dM(e),s=n.map(a=>a.slug),o=i.filter(a=>!s.includes(a));if(o.length>0)throw new Error(an.UNKNOWN_PLATFORMS(o.join(", "),s.join(", ")));return n.filter(a=>i.includes(a.slug))}if(r){let i=n.map(o=>({name:o.name,value:o.name,checked:!0})),s=await h.askCheckbox(t,i);return n.filter(o=>s.includes(o.name))}return n}import pM from"fs/promises";import gA from"path";var gM=30*6e4,fM=1e4,mM=3e4;async function Yl(t,e,r){let n=gA.join(t,Ee,rg);await pM.mkdir(gA.dirname(n),{recursive:!0});let s=await y.resolve(A.ProcessLock)(n,{maxWaitMs:gM,heartbeatIntervalMs:fM,staleAfterMs:mM,onWaiting:r});try{return await e()}finally{await s.release()}}import*as Wt from"fs";import*as ki from"path";var hM=["---","name: docuvia-exploring","description: >"," Use when exploring or navigating an unfamiliar codebase -- before reaching for"," Grep, Glob, or Read. Queries the local Docuvia knowledge graph for concepts,"," files, and symbols, and checks blast radius before editing. Falls back to raw"," file tools only when the graph returns nothing or the target is flagged unprocessed.","---","","# Explore the Codebase via Docuvia","","## When to use this skill","","You are exploring, navigating, or learning about a codebase. Before any Grep, Glob, or Read","call, query the knowledge graph first -- it is structurally aware and orders of magnitude","cheaper than raw file scanning.","","## Exploration workflow","","**Step 1 -- Query the graph for the concept.**","","Use the `docuvia_query` MCP tool (or CLI fallback):","```",'npx --no-install docuvia query "<concept_or_file>" --format=prompt',"```","","The result includes `match_type` (exact/keyword/neighbor) -- treat a non-`exact` match on","what should be a well-known symbol as a signal to cross-check with Grep/Glob.","","**Step 2 -- Check blast radius before editing.**","","Before modifying any file or symbol, run:","```","npx --no-install docuvia impact <symbolOrFile>","```","","This returns which other parts of the codebase would be affected, with a risk level","assessment. Stop and warn the user if it comes back HIGH or CRITICAL.","","**Step 3 -- Only fall back to raw file tools when:**","","- The graph returns empty results",'- The target is flagged `tier_b_status="unprocessed"` (unknown, not zero)',"- You need exact source text, formatting, or a diff","- `query` returns a non-`exact` `match_type` for what should be a well-known symbol","","## After making code changes","","If your change reflects a real architectural decision, rule, or notable rationale, stage it:","","```","npx --no-install docuvia analyze <file> --agent-authored --stage","```","","Pipe a JSON payload on stdin or pass `--decisions-file=<path>`. Staged decisions flush","into the knowledge graph automatically on the next commit touching that file."].join(`
|