docuvia 1.20.1 → 1.21.0
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-34USPXMP.js → chunk-HMNSKM6W.js} +2 -2
- package/dist/{chunk-WULDFQHU.js → chunk-NKKCG232.js} +2 -2
- package/dist/{chunk-2OLMINDD.js → chunk-RRS2FFZT.js} +4 -4
- package/dist/chunk-RRS2FFZT.js.map +1 -0
- package/dist/{chunk-PXZ4QCE3.js → chunk-W2AEK3XF.js} +2 -2
- package/dist/cli.js +104 -104
- package/dist/cli.js.map +1 -1
- package/dist/fs-utils-LQ3M7FUG.js +3 -0
- package/dist/{init-templates-ZGWV56MV.js → init-templates-AFKLXE3A.js} +2 -2
- package/dist/q1-named-import-candidate-certification.json +45 -0
- package/package.json +1 -1
- package/dist/chunk-2OLMINDD.js.map +0 -1
- package/dist/fs-utils-GUMXA35G.js +0 -3
- /package/dist/{chunk-34USPXMP.js.map → chunk-HMNSKM6W.js.map} +0 -0
- /package/dist/{chunk-WULDFQHU.js.map → chunk-NKKCG232.js.map} +0 -0
- /package/dist/{chunk-PXZ4QCE3.js.map → chunk-W2AEK3XF.js.map} +0 -0
- /package/dist/{fs-utils-GUMXA35G.js.map → fs-utils-LQ3M7FUG.js.map} +0 -0
- /package/dist/{init-templates-ZGWV56MV.js.map → init-templates-AFKLXE3A.js.map} +0 -0
package/dist/ast-worker.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as N,d as f,g as ce,h as de,i as u,j as ue,l as pe}from"./chunk-34USPXMP.js";import{Ha as le,Ka as F,d as se}from"./chunk-2OLMINDD.js";import"./chunk-KVOCOCYJ.js";import{parentPort as Q}from"worker_threads";import{Parser as Ke,Language as Wn}from"web-tree-sitter";import*as ae from"path";import*as Ue from"fs";var je=new Map([["public_field_definition","field-annotation"],["field_definition","field-annotation"],["property_signature","field-annotation"],["required_parameter","parameter-annotation"],["optional_parameter","parameter-annotation"],["variable_declarator","variable-annotation"]]),me=new Set(["function_declaration","function_expression","generator_function","generator_function_declaration","arrow_function","method_definition","method_signature","abstract_method_signature"]),Qe=new Set(["function_type","constructor_type","call_signature","construct_signature","index_signature"]),q=new Map([["program","program"],["class_declaration","class"],["abstract_class_declaration","class"],["interface_declaration","interface"],["object","object"],["function_declaration","function"],["function_expression","function"],["generator_function","function"],["generator_function_declaration","function"],["arrow_function","function"],["method_definition","method"],["method_signature","method"],["abstract_method_signature","method"]]),Ge=new Set(["class_declaration","abstract_class_declaration","interface_declaration","object"]),qe=new Map([["method_definition","method"],["method_signature","method"],["abstract_method_signature","method"],["public_field_definition","field"],["field_definition","field"],["property_signature","field"]]),$=new Map([["function_declaration","function"],["function_expression","function-expression"],["generator_function","function-expression"],["generator_function_declaration","function"],["arrow_function","arrow"]]),$e=new Set(["comment","class_static_block"]),y=new Set(["identifier","type_identifier","property_identifier","private_property_identifier"]);function c(e){return{start:e.startIndex,end:e.endIndex}}function _(e){let t=[];for(let n=0;n<e.namedChildCount;n+=1){let r=e.namedChild(n);r&&t.push(r)}return t}function K(e){let t=[];for(let n=0;n<e.childCount;n+=1){let r=e.child(n);r&&t.push(r)}return t}function z(e,t){t(e);for(let n of _(e))z(n,t)}function U(e){let t=e.childForFieldName("name");return!t||!y.has(t.type)?null:t.text}function b(e){let t=e.childForFieldName("type_parameters");return t?_(t).filter(n=>n.type==="type_parameter").map(n=>n.childForFieldName("name")?.text).filter(n=>!!n):[]}function M(e){let t=q.get(e.type)??"program",n=t==="program"?null:U(e);return{kind:t,name:n,span:c(e),genericTypeParameterNames:b(e)}}function A(e){let t=e;for(;t;){if(q.has(t.type))return M(t);t=t.parent}return{kind:"program",name:null,span:{start:0,end:0},genericTypeParameterNames:[]}}function D(e,t){let n=e;for(;n;){if(t(n))return n;n=n.parent}return null}function H(e){return e.type==="class_declaration"||e.type==="abstract_class_declaration"}function Ne(e){return H(e)||e.type==="interface_declaration"}function C(e){return me.has(e.type)}function ze(e){let t=e.parent;for(;t;){if(C(t))return!1;if(Qe.has(t.type))return!0;t=t.parent}return!1}function ye(e){let t=e.parent;for(;t;){if(t.type==="object_type")return!0;t=t.parent}return!1}function ge(e){let t=U(e);if(t)return t;if(e.type!=="arrow_function"&&e.type!=="function_expression")return null;let n=e.parent;if(!n)return null;let r=n.type==="variable_declarator"?n.childForFieldName("name"):n.type==="pair"?n.childForFieldName("key"):null;return r&&y.has(r.type)?r.text:null}function S(e){let t=e;for(;t;){if(t.type==="program"||t.type==="class_body"||t.type==="interface_body"||t.type==="statement_block"||t.type==="object")return c(t);if(C(t)){let n=t.childForFieldName("body");return c(n??t)}t=t.parent}return c(e)}function he(e){if(e.type!=="variable_declarator")return null;let t=e.parent;if(t?.type!=="variable_declaration")return null;let n=t.parent;for(;n;){if(C(n)){let r=n.childForFieldName("body");return c(r??n)}if(n.type==="program")return c(n);n=n.parent}return null}function k(e,t){return K(e).some(n=>n.text===t)}function Je(e){let t=e.parent;for(;t;){if(t.type==="method_definition"&&U(t)==="constructor")return t;if(t.type==="class_body"||t.type==="program")return null;t=t.parent}return null}function _e(e,t){return t==="javascript"||!Je(e)?!1:K(e).some(n=>n.type==="accessibility_modifier"||n.text==="readonly")}function xe(e,t){let n=e.parent;for(;n;){if(b(n).includes(t))return!0;n=n.parent}return!1}function R(e){return!e||!y.has(e.type)?null:e}function Fe(e){if(!e||e.type!=="type_annotation")return null;let t=_(e).filter(n=>n.type!=="comment");return t.length===1?R(t[0]):null}function J(e){if(e.type==="required_parameter"||e.type==="optional_parameter"){let n=e.childForFieldName("pattern");return n&&y.has(n.type)?n.text:null}let t=e.childForFieldName("name")??e.childForFieldName("property");return t&&y.has(t.type)?t.text:null}function Xe(e,t){if(t==="return-annotation")return M(e);let n=t==="parameter-property"?D(e.parent,H):t==="parameter-annotation"?D(e.parent,C):t==="field-annotation"||t==="implements"||t==="extends"?D(e.parent,Ne):null;return n?M(n):A(e.parent)}function Ze(e,t){if(t==="variable-annotation"||t==="new-initializer"){let n=he(e);if(n)return n}if(t==="parameter-property"||t==="implements"||t==="extends"){let n=D(e.parent,H);if(n)return c(n.childForFieldName("body")??n)}return S(e)}function w(e,t,n,r,a){let i=R(n);if(!i||xe(i,i.text))return null;let o=Xe(a,e);return{kind:e,name:t,typeName:i.text,typeText:i.text,declarationSpan:c(r),typeSpan:c(i),owner:o,lexicalScopeSpan:Ze(r,e)}}function et(e,t){let n=je.get(e.type);if(!n||t==="javascript"||tt(e,n))return null;let r=e.childForFieldName("type");if(e.hasError||r?.hasError)return null;let a=Fe(r),i=n==="parameter-annotation"&&_e(e,t)?"parameter-property":n;return w(i,J(e),a,e,e)}function tt(e,t){return ye(e)||t==="parameter-annotation"&&ze(e)}function nt(e){if(ye(e))return null;let t=e.childForFieldName("return_type");if(e.hasError||t?.hasError)return null;let n=Fe(t);return w("return-annotation",ge(e),n,e,e)}function rt(e){let t=Ae(e);return t?w("new-initializer",J(e),t,e,e):null}function Ae(e){if(e.type!=="variable_declarator"&&e.type!=="public_field_definition"&&e.type!=="field_definition")return null;let t=e.childForFieldName("value");return e.hasError||t?.type!=="new_expression"||t.hasError||t.childForFieldName("type_arguments")?null:R(t.childForFieldName("constructor"))}function at(e){if(e.type!=="type_alias_declaration"||e.hasError)return null;let t=e.childForFieldName("name"),n=R(e.childForFieldName("value"));return!t||!y.has(t.type)||!n||xe(n,n.text)?null:{name:t.text,typeName:n.text,declarationSpan:c(e),typeSpan:c(n),owner:A(e.parent),scopeSpan:S(e.parent??e),genericTypeParameterNames:b(e),isExported:e.parent?.type==="export_statement"}}function it(e){let t=e.type==="interface_declaration"?"interface":e.type==="class_declaration"||e.type==="abstract_class_declaration"?"class":null,n=U(e);return!t||!n?null:{kind:t,name:n,declarationSpan:c(e),scopeSpan:S(e.parent??e),genericTypeParameterNames:b(e)}}function ot(e){if(e.type!=="variable_declarator")return null;let t=e.parent;if(!t)return null;let n=/^(const|let|var)\b/u.exec(t.text);return n?.[1]==="const"||n?.[1]==="let"||n?.[1]==="var"?n[1]:null}function st(e){return e.type==="assignment_expression"||e.type==="augmented_assignment_expression"||e.type==="for_in_statement"||e.type==="for_of_statement"?e.childForFieldName("left"):e.type==="update_expression"?_(e).find(t=>y.has(t.type))??null:null}function lt(e){let t=new Map;return z(e,n=>{let r=st(n);if(r&&y.has(r.type)&&r.text){let a=t.get(r.text)??[];a.push(n.startIndex),t.set(r.text,a)}}),t}function ct(e,t,n,r){return(e.get(t)??[]).some(a=>a>r&&a<=n.end)}function dt(e,t){let n=Ae(e),r=e.childForFieldName("name"),a=ot(e);if(!n||!r||!y.has(r.type)||!a)return null;let o=he(e)??S(e);return{name:r.text,typeName:n.text,declarationSpan:c(e),scopeSpan:o,bindingKind:a,isReassigned:ct(t,r.text,o,r.endIndex)}}function ut(e,t){if(e.hasError)return[];if(t==="javascript"&&e.type==="class_heritage")return pt(e);let n=ft(e);if(!n||!Nt(e))return[];let r=yt(e),a=A(e.parent);return r.map(i=>w(n,a.name,i,e,e)).filter(i=>i!==null)}function pt(e){let t=R(_(e)[0]??null),n=A(e.parent),r=w("extends",n.name,t,e,e);return r?[r]:[]}function ft(e){return e.type==="implements_clause"?"implements":e.type==="extends_clause"||e.type==="extends_type_clause"?"extends":null}function mt(e){let t=D(e.parent,Ne),n=D(e.parent,r=>r.type==="conditional_type"||r.type==="type_alias_declaration");return n&&(!t||n.startIndex>t.startIndex)?null:t}function Nt(e){let t=mt(e);return!t||e.childForFieldName("type_arguments")?!1:e.type==="extends_type_clause"?t.type==="interface_declaration":H(t)}function yt(e){if(e.type!=="extends_clause")return _(e);let t=e.childForFieldName("value");return t?[t]:[]}function G(e){return e.type==="ERROR"||e.isMissing||e.hasError}function Se(e,t){if(t?.startsWith("#"))return"private";let n=_(e).find(r=>r.type==="accessibility_modifier");return n?.text==="private"||n?.text==="protected"?n.text:"public"}function X(e){return K(e).some(t=>t.text==="?")}function gt(e){let t=e.childForFieldName("parameters");if(t)return _(t).filter(r=>r.type!=="comment");let n=e.childForFieldName("parameter");return n?[n]:[]}function Te(e){return e.childForFieldName("pattern")??e}function ht(e){return e.type==="rest_pattern"||Te(e)?.type==="rest_pattern"}function _t(e){return e.type==="optional_parameter"||e.type==="rest_pattern"||e.type==="assignment_pattern"||e.childForFieldName("value")?!0:K(e).some(t=>t.text==="?")}function xt(e){return Te(e)?.text==="this"}function B(e){let t=gt(e).filter(a=>!xt(a)),n=0,r=!1;return t.forEach((a,i)=>{ht(a)?r=!0:_t(a)||(n=i+1)}),{requiredParameterCount:n,maxParameterCount:r?null:t.length}}function Ft(e){let t=e.childForFieldName("name")??e.childForFieldName("property");return t&&y.has(t.type)?t.text:null}function fe(e,t,n,r){return{kind:"unknown",name:r,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:null,genericTypeParameterNames:[],unsupportedReason:n}}function At(e,t,n){return e!=="method"?e:n==="constructor"?"constructor":k(t,"get")?"getter":k(t,"set")?"setter":e}function St(e,t){if(t==="method"||t==="constructor"||t==="getter"||t==="setter")return B(e);let r=e.childForFieldName("value");return r&&me.has(r.type)?B(r):null}function Tt(e,t){let n=qe.get(e.type),r=Ft(e);if(G(e))return fe(e,t,"syntax-error",r);if(!n||!r)return fe(e,t,r?"unsupported-member":"computed-name",r);let a=At(n,e,r);return{kind:a,name:r,declarationSpan:c(e),owner:t,lexicalScopeSpan:S(e),visibility:Se(e,r),isStatic:k(e,"static"),isAbstract:e.type==="abstract_method_signature"||k(e,"abstract"),isOptional:X(e),arity:St(e,a),genericTypeParameterNames:b(e)}}function It(e,t){let n=e.childForFieldName("key"),r=e.childForFieldName("value"),a=n&&y.has(n.type)?n.text:null;if(!a||!r||G(e)){let i=G(e)?"syntax-error":"computed-name";return{kind:"unknown",name:a,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:null,genericTypeParameterNames:[],unsupportedReason:i}}return{kind:"field",name:a,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(Dt(e,t)),visibility:"public",isStatic:!1,isAbstract:!1,isOptional:X(e),arity:C(r)?B(r):null,genericTypeParameterNames:[]}}function Dt(e,t){let n=e.parent;for(;n;){if(q.get(n.type)===t.kind&&n.startIndex===t.span.start&&n.endIndex===t.span.end)return n;n=n.parent}return e}function bt(e){return e.type==="object"?e:e.childForFieldName("body")}function Et(e,t,n){return{kind:"unknown",name:null,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(n),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:null,genericTypeParameterNames:[],unsupportedReason:"computed-name"}}function Ct(e,t,n){let r=J(e);return r?{kind:"field",name:r,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(n),visibility:Se(e,r),isStatic:!1,isAbstract:!1,isOptional:X(e),arity:null,genericTypeParameterNames:[]}:Et(e,t,n)}function Rt(e,t,n){let r=e.childForFieldName("parameters");return(r?_(r):[]).filter(a=>_e(a,"typescript")).map(a=>Ct(a,t,n))}function wt(e,t,n,r){if(e.type==="pair"&&t==="object")return[It(e,n)];let a=Tt(e,n),i=a.kind==="constructor"?Rt(e,n,r):[];return[a,...i]}function Ot(e,t,n){let r=[],a=new Set;e.hasError&&a.add("syntax-error");for(let i of _(e)){if($e.has(i.type))continue;let o=wt(i,t,n,e);r.push(...o);for(let s of o)s.unsupportedReason&&a.add(s.unsupportedReason)}return{declarations:r,reasons:a}}function vt(e){let t=M(e),n=bt(e),r=n?Ot(n,e.type,t):{declarations:[],reasons:new Set(["unsupported-member"])};return{inventory:{owner:t,complete:r.reasons.size===0,incompleteReasons:[...r.reasons].sort()},declarations:r.declarations}}function Pt(e){return{kind:$.get(e.type)??"function",name:ge(e),declarationSpan:c(e),owner:A(e.parent),lexicalScopeSpan:S(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:B(e),genericTypeParameterNames:b(e)}}function Lt(e){let t=e.parent;if(!t)return!1;let n=r=>r?.type===e.type&&r.startIndex===e.startIndex&&r.endIndex===e.endIndex;return!!((t.type==="public_field_definition"||t.type==="field_definition")&&n(t.childForFieldName("value"))||t.type==="pair"&&n(t.childForFieldName("value")))}function Mt(e){return e.type==="function_expression"&&e.parent?.type==="export_statement"&&/^export\s+default\s+(?:async\s+)?function(?:\s|\*|\()/u.test(e.parent.text)}function kt(e,t){return e.declarationSpan.start-t.declarationSpan.start||e.typeSpan.start-t.typeSpan.start||e.kind.localeCompare(t.kind)}function Bt(e,t){return e.declarationSpan.start-t.declarationSpan.start||e.declarationSpan.end-t.declarationSpan.end||e.kind.localeCompare(t.kind)}function Kt(e,t,n,r){let a=et(e,t);a&&r.facts.push(a);let i=nt(e);i&&r.facts.push(i);let o=rt(e);o&&r.facts.push(o);let s=at(e);s&&r.q3TypeAliases.push(s);let l=it(e);l&&r.q3Classes.push(l);let d=dt(e,n);d&&r.q3NewReceiverBindings.push(d),r.facts.push(...ut(e,t))}function Ut(e,t){if(!Ge.has(e.type))return;let n=`${e.startIndex}:${e.endIndex}:${e.type}`;if(t.visitedOwners.has(n))return;t.visitedOwners.add(n);let r=vt(e);t.ownerInventories.push(r.inventory),t.declarations.push(...r.declarations)}function Ht(e,t){!$.has(e.type)||Lt(e)&&!Mt(e)||t.declarations.push(Pt(e))}function Vt(e){if(e.type!=="variable_declarator"||e.hasError)return!1;let t=e.childForFieldName("name");if(!t||!y.has(t.type)||A(e.parent).kind!=="program")return!1;let n=e.childForFieldName("value");return!n||!$.has(n.type)}function Yt(e){return e?.type==="lexical_declaration"||e?.type==="variable_declaration"}function Wt(e,t){if(e?.type!=="export_statement"||e.parent?.type!=="program")return!1;let n=e.childForFieldName("declaration");return n?.type===t.type&&n.startIndex===t.startIndex&&n.endIndex===t.endIndex}function jt(e){let t=e.parent;return Yt(t)?Wt(t.parent,t):!1}function Qt(e){if(!Vt(e)||!jt(e))return null;let t=e.childForFieldName("name");if(!t)return null;let n=A(e.parent);return{kind:"unknown",name:t.text,declarationSpan:c(e),owner:n,lexicalScopeSpan:S(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:null,genericTypeParameterNames:[]}}function Gt(e,t,n,r){Kt(e,t,n,r),Ut(e,r),Ht(e,r);let a=Qt(e);a&&r.declarations.push(a)}function Ie(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")throw new RangeError(`Unsupported declared-type grammar: ${String(t)}`);let n=[],r=[],a=[],i=[],o=[],s=[],l=lt(e),g={facts:n,declarations:r,ownerInventories:a,q3Classes:i,q3TypeAliases:o,q3NewReceiverBindings:s,visitedOwners:new Set};return z(e,p=>Gt(p,t,l,g)),n.sort(kt),r.sort(Bt),a.sort((p,m)=>p.owner.span.start-m.owner.span.start||p.owner.kind.localeCompare(m.owner.kind)),o.sort((p,m)=>p.declarationSpan.start-m.declarationSpan.start),i.sort((p,m)=>p.declarationSpan.start-m.declarationSpan.start),s.sort((p,m)=>p.declarationSpan.start-m.declarationSpan.start),{schemaVersion:1,language:t,facts:n,declarations:r,ownerInventories:a,q3ReceiverFacts:{schemaVersion:1,classes:i,typeAliases:o,newReceiverBindings:s}}}var O=new Set(["arrow_function","function_declaration","function_expression","generator_function","generator_function_declaration","method_definition"]),De=new Set(["class_declaration","abstract_class_declaration","class"]),$t=new Set(["class","class_declaration","abstract_class_declaration","function_expression","function_declaration","generator_function","generator_function_declaration"]),zt=new Set(["function_type","constructor_type","call_signature","construct_signature","index_signature","object_type"]),Z=new Set(["for_statement","for_in_statement","for_of_statement","for_await_statement"]),Jt=new Set(["object_pattern","array_pattern","pair_pattern","assignment_pattern","object_assignment_pattern","rest_pattern"]),Xt=/^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u;function h(e){return{start:e.startIndex,end:e.endIndex}}function T(e){let t=[];for(let n=0;n<e.namedChildCount;n+=1){let r=e.namedChild(n);r&&t.push(r)}return t}function Zt(e){let t=[];for(let n=0;n<e.childCount;n+=1){let r=e.child(n);r&&t.push(r)}return t}function W(e,t){t(e);for(let n of T(e))W(n,t)}function v(e,t){let n=e;for(;n;){if(t(n))return n;n=n.parent}return null}function en(e){let t=e.childForFieldName("name")??e.childForFieldName("pattern")??e.childForFieldName("declarator");return t?.type==="identifier"?t.text:null}function V(e,t,n){return v(e.parent,t)??n}function tn(e){return e.parent?.text.trimStart().match(/^(var|let|const)\b/)?.[1]}function nn(e,t){if(e.type==="required_parameter"||e.type==="optional_parameter")return V(e,a=>O.has(a.type),t);if(tn(e)==="var")return V(e,a=>O.has(a.type),t);let r=v(e.parent,a=>Z.has(a.type));return r||V(e,a=>a.type==="statement_block",t)}function rn(e,t){return v(e.parent,n=>O.has(n.type))??t}function be(e){let t=e.parent;for(;t;){if(De.has(t.type))return t;if(t.type==="arrow_function"){t=t.parent;continue}if(O.has(t.type)&&!(t.type==="method_definition"&&t.parent?.type==="class_body"))return null;t=t.parent}return null}function an(e){let t=be(e),n=t?.childForFieldName("name")?.text;return t&&n?{name:n,span:h(t)}:null}function on(e,t,n){return n.type!=="public_field_definition"&&n.type!=="field_definition"||n.childForFieldName("name")?.text!==e?null:{kind:"field",name:e,declarationSpan:h(n),scopeSpan:h(t)}}function P(e){return e.type==="identifier"?[e.text]:e.type==="shorthand_property_identifier_pattern"||e.type==="shorthand_property_identifier"?[e.text]:Jt.has(e.type)?T(e).flatMap(P):[]}function L(e,t,n,r,a){let i=Y(n),o=e.get(i)??new Map;for(let s of a){let l=o.get(s);if(l){(l.declarationSpan.start!==t.startIndex||l.declarationSpan.end!==t.endIndex)&&o.set(s,{...l,kind:"unsupported"});continue}o.set(s,{name:s,declarationSpan:h(t),scopeSpan:h(n),kind:r})}e.set(i,o)}function sn(e,t,n){if(v(e.parent,l=>zt.has(l.type)))return;let r=e.childForFieldName("name")??e.childForFieldName("pattern")??e.childForFieldName("declarator");if(!r)return;let a=P(r),i=r.type==="identifier",o=v(e.parent,l=>Z.has(l.type)),s=i&&(e.type==="required_parameter"||e.type==="optional_parameter")?"parameter":o?"unsupported":i?"local":"unsupported";L(n,e,nn(e,t),s,a)}function ln(e,t){if(!O.has(e.type))return;let n=e.childForFieldName("parameters"),r=e.childForFieldName("parameter"),a=n?T(n):r?[r]:[];for(let i of a){if(i.type==="required_parameter"||i.type==="optional_parameter")continue;let o=P(i);if(o.length===0)continue;let s=i.type==="identifier";L(t,i,e,s?"parameter":"unsupported",o)}}function cn(e,t,n){if(!$t.has(e.type))return;let r=e.childForFieldName("name");if(r?.type!=="identifier"&&r?.type!=="type_identifier")return;let i=e.type==="class"||e.type==="function_expression"||e.type==="generator_function"?e:V(e,o=>o.type==="statement_block",t);L(n,r,i,"unsupported",[r.text])}function dn(e,t){if(e.type!=="catch_clause")return;let n=e.childForFieldName("parameter");if(!n)return;let r=e.childForFieldName("body")??e;L(t,n,r,"unsupported",P(n))}function un(e,t){if(!Z.has(e.type))return;let n=e.childForFieldName("left")??e.childForFieldName("initializer");if(!n)return;let r=n.type==="variable_declaration"?T(n).find(i=>i.type==="variable_declarator"):n,a=r?.type==="variable_declarator"?r.childForFieldName("name"):r;a&&L(t,a,e,"unsupported",P(a))}function pn(e,t,n){let r=n.get(Y(e))??new Map;for(let[a,i]of fn(t))mn(e,r,a,i);n.set(Y(e),r)}function fn(e){let t=new Map;for(let n of e){if(n.viaReexport)continue;let r=t.get(n.localName)??[];r.push(n),t.set(n.localName,r)}return t}function mn(e,t,n,r){let a=t.get(n),i=h(e);if(r.length!==1||a){t.set(n,{name:n,declarationSpan:a?.declarationSpan??i,scopeSpan:i,kind:"unsupported"});return}t.set(n,{name:n,declarationSpan:i,scopeSpan:i,kind:r[0]?.isTypeOnly?"type-only-import":"import"})}function Nn(e,t){let n=new Map;return W(e,r=>{(r.type==="required_parameter"||r.type==="optional_parameter"||r.type==="variable_declarator")&&sn(r,e,n),ln(r,n),cn(r,e,n),dn(r,n),un(r,n)}),pn(e,t,n),n}function ee(e,t){return`${e.startIndex}:${t}`}function Y(e){return`${e.type}:${e.startIndex}:${e.endIndex}`}function Ee(e,t,n){e.set(t,e.has(t)?null:n)}function yn(e){return Zt(e).some(t=>t.type==="accessibility_modifier"||t.text==="readonly")}function gn(e,t,n){if(t.type!=="method_definition"||t.childForFieldName("name")?.text!=="constructor")return;let r=t.childForFieldName("parameters");for(let a of r?T(r):[]){let i=en(a);!i||!yn(a)||Ee(n,ee(e,i),{kind:"parameter-property",name:i,declarationSpan:h(a),scopeSpan:h(e)})}}function hn(e,t){let n=e.childForFieldName("body");for(let r of n?T(n):[]){let a=r.childForFieldName("name")?.text,i=a?on(a,e,r):null;i&&Ee(t,ee(e,a),i),gn(e,r,t)}}function _n(e){let t=new Map;return W(e,n=>{De.has(n.type)&&hn(n,t)}),t}function Ce(e,t,n){return`${e}:${t}:${n}`}function xn(e,t){let n=new Map;return W(e,r=>{if(r.type!=="call_expression")return;let a=r.childForFieldName("function");if(!a)return;let i=a.childForFieldName("property")??a.childForFieldName("name")??a,o=a.childForFieldName("property")?.text??a.text,s=Ce(i.startPosition.row,i.startPosition.column,o);n.set(s,[...n.get(s)??[],r])}),{callExpressions:n,bindingsByScope:Nn(e,t),propertiesByClassAndName:_n(e)}}function Fn(e,t,n){let r=be(t);if(e==="this")return r?{kind:"this",name:"this",declarationSpan:h(r),scopeSpan:h(r)}:null;let a=e.match(/^this\.([\p{ID_Start}_$][\p{ID_Continue}$]*)$/u);if(a)return r?n.propertiesByClassAndName.get(ee(r,a[1]))??null:null}function An(e,t,n){if(!e)return null;let r=Fn(e,t,n);if(r!==void 0)return r;if(!Xt.test(e))return null;let a=Re(e,t,n);return a?Sn(e,a):null}function Re(e,t,n){let r=t;for(;r;){let a=n.bindingsByScope.get(Y(r))?.get(e);if(a)return a;r=r.parent}}function Sn(e,t){return!t||t.kind==="unsupported"||t.kind==="import"||t.kind==="type-only-import"?null:{kind:t.kind,name:e,declarationSpan:t.declarationSpan,scopeSpan:t.scopeSpan}}function Tn(e,t,n){if((e.calleeKind??"bare")!=="bare")return null;let a=e.calleeName,i=Re(a,t,n);return i?{kind:i.kind==="import"||i.kind==="type-only-import"||i.kind==="local"||i.kind==="parameter"?i.kind:"unsupported",name:a,declarationSpan:i.declarationSpan,scopeSpan:i.scopeSpan}:{kind:"unbound",name:a}}function In(e){switch(e.type){case"string":return"string";case"number":return"number";case"true":case"false":return"boolean";case"null":return"null";case"object":return"object";case"array":return"array";case"arrow_function":case"function_expression":return"function";default:return"unknown"}}function Dn(e,t){return t?[e.start,e.end,t.kind,t.declarationSpan.start,t.declarationSpan.end,t.scopeSpan.start,t.scopeSpan.end].join(":"):null}function bn(e,t){if(!e.calleeName||e.calleeKind==="computed")return null;let n=t.callExpressions.get(Ce(e.startLine,e.startColumn,e.calleeName));return n?.length===1?n[0]??null:null}function En(e){return!!e.calleeName&&e.calleeKind!=="computed"}function Cn(e,t,n,r){let a=t.childForFieldName("arguments"),i=a?T(a).filter(I=>I.type!=="comment"):[],o=i.some(I=>I.type==="spread_element"),s=rn(t,n),l=An(e.receiverText,t,r),d=Tn(e,t,r),g=t.childForFieldName("arguments")?.startIndex,p=t.text.slice(0,g===void 0?t.text.length:g-t.startIndex),m={startLine:e.startLine,startColumn:e.startColumn,calleeName:e.calleeName??"",calleeKind:e.calleeKind??"bare",receiverText:e.receiverText??null,receiverBinding:l,receiverOptional:p.includes("?."),calleeBinding:d,lexicalScopeSpan:h(s),callerType:an(t),argumentCount:o?null:i.length,hasSpreadArgument:o,argumentKinds:i.map(In)};return{fact:m,peerKey:Dn(m.lexicalScopeSpan,l)}}function Rn(e,t,n){if(!n||t.calleeKind!=="member"&&t.calleeKind!=="this")return;let r=e.get(n)??new Set;r.add(t.calleeName),e.set(n,r)}function we(e,t,n,r){let a=xn(e,r),i=n.flatMap(l=>{if(!En(l))return[];let d=bn(l,a);return d?[Cn(l,d,e,a)]:[]}),o=new Map;for(let{fact:l,peerKey:d}of i)Rn(o,l,d);let s=i.map(({fact:l,peerKey:d})=>({...l,peerMemberNames:[...d?o.get(d)??[]:[]].filter(g=>g!==l.calleeName).sort()}));return{schemaVersion:2,language:t,callSites:s}}import{createHash as On}from"crypto";var vn=new Set([N.VARIABLE_DECLARATOR,N.ASSIGNMENT_EXPRESSION,N.PAIR,N.PUBLIC_FIELD_DEFINITION]),Pn=new Set([u.ARROW_FUNCTION,u.FUNCTION_EXPRESSION,u.FUNCTION_DECLARATION,u.GENERATOR_FUNCTION,u.GENERATOR_FUNCTION_DECLARATION,u.FUNCTION_DEFINITION,u.METHOD_DECLARATION,u.METHOD_DEFINITION,u.LOCAL_FUNCTION_STATEMENT,u.CONSTRUCTOR_DECLARATION,u.DESTRUCTOR_DECLARATION,u.CONVERSION_OPERATOR_DECLARATION,u.OPERATOR_DECLARATION,u.COMPACT_CONSTRUCTOR_DECLARATION,u.METHOD,u.SINGLETON_METHOD,u.FUNCTION_ITEM]);function te(e){return On(le).update(e.text).digest("hex")}function ne(e){return e.childForFieldName("name")?.text||e.descendantsOfType(u.IDENTIFIER)[0]?.text||f.ANONYMOUS_NAME}function Ln(e){return e.childForFieldName("declarator")?.childForFieldName("declarator")}function Mn(e){let t=e.childForFieldName("name");if(t)return{name:t.text,nameNode:t};let n=Ln(e);if(!n)return;if(n.type!==N.QUALIFIED_IDENTIFIER)return{name:n.text,nameNode:n};let r=n.childForFieldName("name");return{name:r?.text??f.ANONYMOUS_NAME,nameNode:r}}function kn(e){let t=e.parent;for(;t;){if(t.type===N.ARGUMENTS||Pn.has(t.type))return;if(vn.has(t.type)){let n=t.childForFieldName("name")||t.childForFieldName("key")||t.childForFieldName("left");if(n)return{name:n.text,nameNode:n}}t=t.parent}}function Oe(e){return Mn(e)??kn(e)??{name:f.ANONYMOUS_NAME,nameNode:void 0}}function Bn(e){return Oe(e).name}function E(e,t){let n=e.parent;for(;n;){if(t.has(n.id))return ne(n);n=n.parent}return f.ANONYMOUS_NAME}function ve(e){return e.type===N.TYPE_IDENTIFIER?e.text:e.descendantsOfType(N.TYPE_IDENTIFIER)[0]?.text}function Kn(e){let t=e.parent;for(;t;){if(t.type===N.IMPL_ITEM){let n=t.childForFieldName("type");return n?ve(n):void 0}t=t.parent}}function Un(e){let n=e.childForFieldName("receiver")?.namedChild(0)?.childForFieldName("type");return n?ve(n):void 0}function Hn(e){let n=e.childForFieldName("declarator")?.childForFieldName("declarator");if(n?.type!==N.QUALIFIED_IDENTIFIER)return;let r=n.childForFieldName("scope");if(r)return r.type===N.QUALIFIED_IDENTIFIER?r.childForFieldName("name")?.text:r.text}function Vn(e){return Kn(e)??Un(e)??Hn(e)}function Pe(e,t,n){let r=t.extractClasses(e.rootNode);for(let a of r)n.push({name:ne(a),startLine:a.startPosition.row,endLine:a.endPosition.row,methods:[],contentHash:te(a)});return r}var Yn=new Set([u.ARROW_FUNCTION,u.FUNCTION_EXPRESSION]);function Le(e,t,n){let r=t.extractVariables?.(e.rootNode)??[],a=[];for(let i of r){let o=i.childForFieldName("value");o&&Yn.has(o.type)||(a.push(i),n.push({name:ne(i),startLine:i.startPosition.row,endLine:i.endPosition.row,contentHash:te(i)}))}return a}function re(e,t,n,r){let a=new Set(r.map(o=>o.id)),i=t.extractFunctions(e.rootNode);for(let o of i){let s=E(o,a),l=s===f.ANONYMOUS_NAME?Vn(o):s;n.push({name:Oe(o).name,startLine:o.startPosition.row,endLine:o.endPosition.row,declarationSpan:{start:o.startIndex,end:o.endIndex},contentHash:te(o),containerName:l})}return i}var ie=new se(e=>Q?.postMessage(e));process.on("uncaughtException",e=>{ie.error(f.WORKER_UNCAUGHT_EXCEPTION,{error:e instanceof Error?e.message:String(e)})});process.on("unhandledRejection",e=>{ie.error(f.WORKER_UNHANDLED_REJECTION,{error:e instanceof Error?e.message:String(e)})});var Me=!1,ke=null;function jn(){return ke??=ue(),ke}var Be=new Map;function Qn(e){let t=Be.get(e);return t||(t=Wn.load(e),Be.set(e,t)),t}function Gn(e){let t=[],n=e.matchAll(/import\s+{([^}]+)}\s+from\s+['"]([^'"]+)['"]/g);for(let r of n)t.push({localName:r[1].trim(),originalName:r[1].trim(),modulePath:r[2]});return t}function qn(e){return e.childForFieldName("function")||e.childForFieldName("expression")||e.childForFieldName("type")||e.childForFieldName("name")||e.childForFieldName("method")||e}function $n(e){let t=qn(e),n=t.namedChildren,r=n[n.length-1],a=n.length>=2?n[n.length-2]:void 0;if(!r||!a)return{targetFunction:j(t.text),calleeName:t.text,calleeKind:"bare"};if(!zn.has(r.type))return{targetFunction:j(t.text),calleeKind:"computed"};let i=r.text,o=a.text;return o.includes("(")?{targetFunction:j(t.text),calleeName:i,receiverText:o,calleeKind:"arg-chain"}:{targetFunction:j(t.text),calleeName:i,receiverText:o,calleeKind:o==="this"||o==="super"?"this":"member"}}function j(e){return e.replace(/\s+/g,"")}var zn=new Set(["identifier","property_identifier","field_identifier","shorthand_property_identifier","attribute"]);function Jn(e){return((e.childForFieldName("property")||e.childForFieldName("field")||e.childForFieldName("attribute")||e.childForFieldName("name")||e.childForFieldName("method"))??e).startPosition}function Xn(e,t,n,r){let a=new Set(n.map(o=>o.id)),i=t.extractCalls(e.rootNode);for(let o of i){if(r.length>=1e3)break;let s=Jn(o),l=$n(o);r.push({sourceFunction:E(o,a),targetFunction:l.targetFunction,startLine:s.row,startColumn:s.column,calleeName:l.calleeName,receiverText:l.receiverText,calleeKind:l.calleeKind})}}function Zn(e,t,n,r){if(!t.extractImplements)return;let a=new Set(n.map(i=>i.id));for(let i of t.extractImplements(e.rootNode))r.push({sourceClass:E(i,a),targetInterface:i.text})}function er(e,t,n,r){if(!t.extractExtends)return;let a=new Set(n.map(i=>i.id));for(let i of t.extractExtends(e.rootNode))r.push({sourceClass:E(i,a),targetClass:i.text})}var tr=new Set([F.TYPESCRIPT,F.JAVASCRIPT]),nr="Worker",rr="path",ar="resolve",ir="join",or="__dirname";function sr(e){if(e.type!=="call_expression")return!1;let t=e.childForFieldName("function");if(!t||t.type!=="member_expression")return!1;let n=t.childForFieldName("object")?.text,r=t.childForFieldName("property")?.text;return n===rr&&(r===ar||r===ir)}function lr(e){let t=e.childForFieldName("arguments");return!t||!t.namedChildren.some(a=>a?.type==="identifier"&&a.text===or)?void 0:t.descendantsOfType("string")[0]?.text.replace(/['"]/g,"")}function cr(e,t){for(let n of e.rootNode.descendantsOfType(N.ASSIGNMENT_EXPRESSION)){if(!n)continue;let r=n.childForFieldName("left"),a=n.childForFieldName("right");if(r?.text!==t||!a||!sr(a))continue;let i=lr(a);if(i)return i}}function dr(e,t){if(t.type==="string")return t.text.replace(/['"]/g,"");if(t.type==="identifier"||t.type==="member_expression")return cr(e,t.text)}function ur(e,t,n,r){if(!tr.has(t))return;let a=new Set(n.map(i=>i.id));for(let i of e.rootNode.descendantsOfType("new_expression")){if(!i||i.childForFieldName("constructor")?.text!==nr)continue;let l=i.childForFieldName("arguments")?.namedChildren.find(g=>g!==null);if(!l)continue;let d=dr(e,l);d&&r.push({sourceFunction:E(i,a),targetPath:d})}}function He(e){let t=[];for(let n=0;n<e.namedChildCount;n+=1){let r=e.namedChild(n);r&&t.push(r)}return t}function pr(e){let t=[];for(let n of He(e))t.push(...fr(n));return t}function fr(e){if(e.type!=="export_statement")return[];if(/^export\s+default\b/u.test(e.text))return[mr(e)];let t=e.childForFieldName("declaration");return t?Nr(t):[]}function mr(e){let t=/^export\s+default\s+(?:async\s+)?function(?:\s|\*|\()/u.test(e.text),n=[...e.descendantsOfType("function_declaration"),...e.descendantsOfType("generator_function_declaration"),...e.descendantsOfType("function_expression"),...e.descendantsOfType("generator_function"),...e.descendantsOfType("class_declaration"),...e.descendantsOfType("abstract_class_declaration")].filter(i=>i!==null),r=e.childForFieldName("declaration")??n.sort((i,o)=>i.startIndex-o.startIndex)[0];return r&&t&&["function_declaration","generator_function_declaration","function_expression","generator_function"].includes(r.type)?{name:"default",type:"function",declarationSpan:{start:r.startIndex,end:r.endIndex}}:{name:"default",type:r?.type==="class_declaration"||r?.type==="abstract_class_declaration"?"class":"other",declarationSpan:r?{start:r.startIndex,end:r.endIndex}:{start:e.startIndex,end:e.endIndex}}}function Nr(e){let t=yr(e);if(t)return[t];let n=gr(e);return n?[n]:e.type!=="lexical_declaration"&&e.type!=="variable_declaration"?[]:hr(e)}function yr(e){if(e.type!=="class_declaration"&&e.type!=="abstract_class_declaration")return;let t=e.childForFieldName("name");return t&&["identifier","type_identifier"].includes(t.type)?{name:t.text,type:"class"}:void 0}function gr(e){if(e.type!=="function_declaration"&&e.type!=="generator_function_declaration")return;let t=e.childForFieldName("name");return t?.type==="identifier"?{name:t.text,type:"function"}:void 0}function hr(e){let t=[];for(let n of He(e)){if(n.type!=="variable_declarator")continue;let r=n.childForFieldName("name");r?.type==="identifier"&&t.push({name:r.text,type:"variable"})}return t}function _r(e,t,n){let r=[],a=[],i=[],o,s=[],l=[],d=[],g=[],p=[],m=[],I=[];if(e){r.push(f.parsedViaTreeSitter(e.rootNode.childCount));try{i.push(...pr(e.rootNode)),(n===F.TYPESCRIPT||n===F.JAVASCRIPT)&&(o=de(e.rootNode));let x=Pe(e,t,l),oe=re(e,t,s,x),Ve=t.extractImports(e.rootNode);a.push(...ce(Ve)),Le(e,t,d),Xn(e,t,oe,g),Zn(e,t,x,p),er(e,t,x,m),ur(e,n,oe,I),r.push(f.QUERIED_VIA_LANGUAGE_PROVIDER)}catch(x){r.push(f.providerQueryFailed(x instanceof Error?x.message:String(x)))}}return{imports:a,exports:i,...o===void 0?{}:{reexports:o},functions:s,classes:l,variables:d,calls:g,implements:p,extends:m,workerSpawns:I,decisions:r}}function xr(e,t){for(let n of e.drainQueryCompileFailures?.()??[])ie.error(f.QUERY_COMPILE_FAILED,{language:t,kind:n.kind,pattern:n.pattern,message:n.message})}function Fr(e,t,n,r,a){let i=new Ke;i.setLanguage(n),t.initQueries?.(n),xr(t,r);let o=i.parse(e),s=_r(o,t,r),l=Ar(r,a),d=o&&l?{...s,declaredTypeFacts:Ie(o.rootNode,l),callSiteShapeFacts:we(o.rootNode,l,s.calls,s.imports)}:s;return o&&o.delete(),i.delete(),d}function Ar(e,t){if(e===F.TYPESCRIPT)return ae.extname(t).toLowerCase()===".tsx"?"tsx":"typescript";if(e===F.JAVASCRIPT)return"javascript"}async function Sr(e){Me||(await Ke.init(),Me=!0);let t=await jn(),n=ae.extname(e.filePath),r=t.getProviderForExtension(n);if(!r)return{taskId:e.taskId,success:!0,data:{imports:[],exports:[],functions:[],classes:[],calls:[],decisions:[f.noLanguageProviderForExtension(n)]}};let{wasmPath:a,attemptedPaths:i}=pe(r.wasm_file);if(!Ue.existsSync(a))return{taskId:e.taskId,success:!0,data:{imports:Gn(e.code),exports:[],functions:[],classes:[],calls:[],decisions:[f.wasmNotFound(e.language,i.join(", "))]}};let o=await Qn(a),s=Fr(e.code,r,o,e.language,e.filePath);return{taskId:e.taskId,success:!0,data:s}}Q?.on("message",async e=>{try{let t=await Sr(e);Q?.postMessage(t)}catch(t){Q?.postMessage({taskId:e.taskId,success:!1,error:t.stack||String(t)})}});export{Sr as buildParseResponse,re as collectFunctionNodes,ur as collectWorkerSpawns,$n as getCalleeEvidence,xr as reportQueryCompileFailures,Bn as resolveCallableName,pe as resolveWasmPath};
|
|
2
|
+
import{c as N,d as f,g as ce,h as de,i as u,j as ue,l as pe}from"./chunk-HMNSKM6W.js";import{Ia as le,La as F,d as se}from"./chunk-RRS2FFZT.js";import"./chunk-KVOCOCYJ.js";import{parentPort as Q}from"worker_threads";import{Parser as Ke,Language as Wn}from"web-tree-sitter";import*as ae from"path";import*as Ue from"fs";var je=new Map([["public_field_definition","field-annotation"],["field_definition","field-annotation"],["property_signature","field-annotation"],["required_parameter","parameter-annotation"],["optional_parameter","parameter-annotation"],["variable_declarator","variable-annotation"]]),me=new Set(["function_declaration","function_expression","generator_function","generator_function_declaration","arrow_function","method_definition","method_signature","abstract_method_signature"]),Qe=new Set(["function_type","constructor_type","call_signature","construct_signature","index_signature"]),q=new Map([["program","program"],["class_declaration","class"],["abstract_class_declaration","class"],["interface_declaration","interface"],["object","object"],["function_declaration","function"],["function_expression","function"],["generator_function","function"],["generator_function_declaration","function"],["arrow_function","function"],["method_definition","method"],["method_signature","method"],["abstract_method_signature","method"]]),Ge=new Set(["class_declaration","abstract_class_declaration","interface_declaration","object"]),qe=new Map([["method_definition","method"],["method_signature","method"],["abstract_method_signature","method"],["public_field_definition","field"],["field_definition","field"],["property_signature","field"]]),$=new Map([["function_declaration","function"],["function_expression","function-expression"],["generator_function","function-expression"],["generator_function_declaration","function"],["arrow_function","arrow"]]),$e=new Set(["comment","class_static_block"]),y=new Set(["identifier","type_identifier","property_identifier","private_property_identifier"]);function c(e){return{start:e.startIndex,end:e.endIndex}}function _(e){let t=[];for(let n=0;n<e.namedChildCount;n+=1){let r=e.namedChild(n);r&&t.push(r)}return t}function K(e){let t=[];for(let n=0;n<e.childCount;n+=1){let r=e.child(n);r&&t.push(r)}return t}function z(e,t){t(e);for(let n of _(e))z(n,t)}function U(e){let t=e.childForFieldName("name");return!t||!y.has(t.type)?null:t.text}function b(e){let t=e.childForFieldName("type_parameters");return t?_(t).filter(n=>n.type==="type_parameter").map(n=>n.childForFieldName("name")?.text).filter(n=>!!n):[]}function M(e){let t=q.get(e.type)??"program",n=t==="program"?null:U(e);return{kind:t,name:n,span:c(e),genericTypeParameterNames:b(e)}}function A(e){let t=e;for(;t;){if(q.has(t.type))return M(t);t=t.parent}return{kind:"program",name:null,span:{start:0,end:0},genericTypeParameterNames:[]}}function D(e,t){let n=e;for(;n;){if(t(n))return n;n=n.parent}return null}function H(e){return e.type==="class_declaration"||e.type==="abstract_class_declaration"}function Ne(e){return H(e)||e.type==="interface_declaration"}function C(e){return me.has(e.type)}function ze(e){let t=e.parent;for(;t;){if(C(t))return!1;if(Qe.has(t.type))return!0;t=t.parent}return!1}function ye(e){let t=e.parent;for(;t;){if(t.type==="object_type")return!0;t=t.parent}return!1}function ge(e){let t=U(e);if(t)return t;if(e.type!=="arrow_function"&&e.type!=="function_expression")return null;let n=e.parent;if(!n)return null;let r=n.type==="variable_declarator"?n.childForFieldName("name"):n.type==="pair"?n.childForFieldName("key"):null;return r&&y.has(r.type)?r.text:null}function S(e){let t=e;for(;t;){if(t.type==="program"||t.type==="class_body"||t.type==="interface_body"||t.type==="statement_block"||t.type==="object")return c(t);if(C(t)){let n=t.childForFieldName("body");return c(n??t)}t=t.parent}return c(e)}function he(e){if(e.type!=="variable_declarator")return null;let t=e.parent;if(t?.type!=="variable_declaration")return null;let n=t.parent;for(;n;){if(C(n)){let r=n.childForFieldName("body");return c(r??n)}if(n.type==="program")return c(n);n=n.parent}return null}function k(e,t){return K(e).some(n=>n.text===t)}function Je(e){let t=e.parent;for(;t;){if(t.type==="method_definition"&&U(t)==="constructor")return t;if(t.type==="class_body"||t.type==="program")return null;t=t.parent}return null}function _e(e,t){return t==="javascript"||!Je(e)?!1:K(e).some(n=>n.type==="accessibility_modifier"||n.text==="readonly")}function xe(e,t){let n=e.parent;for(;n;){if(b(n).includes(t))return!0;n=n.parent}return!1}function R(e){return!e||!y.has(e.type)?null:e}function Fe(e){if(!e||e.type!=="type_annotation")return null;let t=_(e).filter(n=>n.type!=="comment");return t.length===1?R(t[0]):null}function J(e){if(e.type==="required_parameter"||e.type==="optional_parameter"){let n=e.childForFieldName("pattern");return n&&y.has(n.type)?n.text:null}let t=e.childForFieldName("name")??e.childForFieldName("property");return t&&y.has(t.type)?t.text:null}function Xe(e,t){if(t==="return-annotation")return M(e);let n=t==="parameter-property"?D(e.parent,H):t==="parameter-annotation"?D(e.parent,C):t==="field-annotation"||t==="implements"||t==="extends"?D(e.parent,Ne):null;return n?M(n):A(e.parent)}function Ze(e,t){if(t==="variable-annotation"||t==="new-initializer"){let n=he(e);if(n)return n}if(t==="parameter-property"||t==="implements"||t==="extends"){let n=D(e.parent,H);if(n)return c(n.childForFieldName("body")??n)}return S(e)}function w(e,t,n,r,a){let i=R(n);if(!i||xe(i,i.text))return null;let o=Xe(a,e);return{kind:e,name:t,typeName:i.text,typeText:i.text,declarationSpan:c(r),typeSpan:c(i),owner:o,lexicalScopeSpan:Ze(r,e)}}function et(e,t){let n=je.get(e.type);if(!n||t==="javascript"||tt(e,n))return null;let r=e.childForFieldName("type");if(e.hasError||r?.hasError)return null;let a=Fe(r),i=n==="parameter-annotation"&&_e(e,t)?"parameter-property":n;return w(i,J(e),a,e,e)}function tt(e,t){return ye(e)||t==="parameter-annotation"&&ze(e)}function nt(e){if(ye(e))return null;let t=e.childForFieldName("return_type");if(e.hasError||t?.hasError)return null;let n=Fe(t);return w("return-annotation",ge(e),n,e,e)}function rt(e){let t=Ae(e);return t?w("new-initializer",J(e),t,e,e):null}function Ae(e){if(e.type!=="variable_declarator"&&e.type!=="public_field_definition"&&e.type!=="field_definition")return null;let t=e.childForFieldName("value");return e.hasError||t?.type!=="new_expression"||t.hasError||t.childForFieldName("type_arguments")?null:R(t.childForFieldName("constructor"))}function at(e){if(e.type!=="type_alias_declaration"||e.hasError)return null;let t=e.childForFieldName("name"),n=R(e.childForFieldName("value"));return!t||!y.has(t.type)||!n||xe(n,n.text)?null:{name:t.text,typeName:n.text,declarationSpan:c(e),typeSpan:c(n),owner:A(e.parent),scopeSpan:S(e.parent??e),genericTypeParameterNames:b(e),isExported:e.parent?.type==="export_statement"}}function it(e){let t=e.type==="interface_declaration"?"interface":e.type==="class_declaration"||e.type==="abstract_class_declaration"?"class":null,n=U(e);return!t||!n?null:{kind:t,name:n,declarationSpan:c(e),scopeSpan:S(e.parent??e),genericTypeParameterNames:b(e)}}function ot(e){if(e.type!=="variable_declarator")return null;let t=e.parent;if(!t)return null;let n=/^(const|let|var)\b/u.exec(t.text);return n?.[1]==="const"||n?.[1]==="let"||n?.[1]==="var"?n[1]:null}function st(e){return e.type==="assignment_expression"||e.type==="augmented_assignment_expression"||e.type==="for_in_statement"||e.type==="for_of_statement"?e.childForFieldName("left"):e.type==="update_expression"?_(e).find(t=>y.has(t.type))??null:null}function lt(e){let t=new Map;return z(e,n=>{let r=st(n);if(r&&y.has(r.type)&&r.text){let a=t.get(r.text)??[];a.push(n.startIndex),t.set(r.text,a)}}),t}function ct(e,t,n,r){return(e.get(t)??[]).some(a=>a>r&&a<=n.end)}function dt(e,t){let n=Ae(e),r=e.childForFieldName("name"),a=ot(e);if(!n||!r||!y.has(r.type)||!a)return null;let o=he(e)??S(e);return{name:r.text,typeName:n.text,declarationSpan:c(e),scopeSpan:o,bindingKind:a,isReassigned:ct(t,r.text,o,r.endIndex)}}function ut(e,t){if(e.hasError)return[];if(t==="javascript"&&e.type==="class_heritage")return pt(e);let n=ft(e);if(!n||!Nt(e))return[];let r=yt(e),a=A(e.parent);return r.map(i=>w(n,a.name,i,e,e)).filter(i=>i!==null)}function pt(e){let t=R(_(e)[0]??null),n=A(e.parent),r=w("extends",n.name,t,e,e);return r?[r]:[]}function ft(e){return e.type==="implements_clause"?"implements":e.type==="extends_clause"||e.type==="extends_type_clause"?"extends":null}function mt(e){let t=D(e.parent,Ne),n=D(e.parent,r=>r.type==="conditional_type"||r.type==="type_alias_declaration");return n&&(!t||n.startIndex>t.startIndex)?null:t}function Nt(e){let t=mt(e);return!t||e.childForFieldName("type_arguments")?!1:e.type==="extends_type_clause"?t.type==="interface_declaration":H(t)}function yt(e){if(e.type!=="extends_clause")return _(e);let t=e.childForFieldName("value");return t?[t]:[]}function G(e){return e.type==="ERROR"||e.isMissing||e.hasError}function Se(e,t){if(t?.startsWith("#"))return"private";let n=_(e).find(r=>r.type==="accessibility_modifier");return n?.text==="private"||n?.text==="protected"?n.text:"public"}function X(e){return K(e).some(t=>t.text==="?")}function gt(e){let t=e.childForFieldName("parameters");if(t)return _(t).filter(r=>r.type!=="comment");let n=e.childForFieldName("parameter");return n?[n]:[]}function Te(e){return e.childForFieldName("pattern")??e}function ht(e){return e.type==="rest_pattern"||Te(e)?.type==="rest_pattern"}function _t(e){return e.type==="optional_parameter"||e.type==="rest_pattern"||e.type==="assignment_pattern"||e.childForFieldName("value")?!0:K(e).some(t=>t.text==="?")}function xt(e){return Te(e)?.text==="this"}function B(e){let t=gt(e).filter(a=>!xt(a)),n=0,r=!1;return t.forEach((a,i)=>{ht(a)?r=!0:_t(a)||(n=i+1)}),{requiredParameterCount:n,maxParameterCount:r?null:t.length}}function Ft(e){let t=e.childForFieldName("name")??e.childForFieldName("property");return t&&y.has(t.type)?t.text:null}function fe(e,t,n,r){return{kind:"unknown",name:r,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:null,genericTypeParameterNames:[],unsupportedReason:n}}function At(e,t,n){return e!=="method"?e:n==="constructor"?"constructor":k(t,"get")?"getter":k(t,"set")?"setter":e}function St(e,t){if(t==="method"||t==="constructor"||t==="getter"||t==="setter")return B(e);let r=e.childForFieldName("value");return r&&me.has(r.type)?B(r):null}function Tt(e,t){let n=qe.get(e.type),r=Ft(e);if(G(e))return fe(e,t,"syntax-error",r);if(!n||!r)return fe(e,t,r?"unsupported-member":"computed-name",r);let a=At(n,e,r);return{kind:a,name:r,declarationSpan:c(e),owner:t,lexicalScopeSpan:S(e),visibility:Se(e,r),isStatic:k(e,"static"),isAbstract:e.type==="abstract_method_signature"||k(e,"abstract"),isOptional:X(e),arity:St(e,a),genericTypeParameterNames:b(e)}}function It(e,t){let n=e.childForFieldName("key"),r=e.childForFieldName("value"),a=n&&y.has(n.type)?n.text:null;if(!a||!r||G(e)){let i=G(e)?"syntax-error":"computed-name";return{kind:"unknown",name:a,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:null,genericTypeParameterNames:[],unsupportedReason:i}}return{kind:"field",name:a,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(Dt(e,t)),visibility:"public",isStatic:!1,isAbstract:!1,isOptional:X(e),arity:C(r)?B(r):null,genericTypeParameterNames:[]}}function Dt(e,t){let n=e.parent;for(;n;){if(q.get(n.type)===t.kind&&n.startIndex===t.span.start&&n.endIndex===t.span.end)return n;n=n.parent}return e}function bt(e){return e.type==="object"?e:e.childForFieldName("body")}function Et(e,t,n){return{kind:"unknown",name:null,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(n),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:null,genericTypeParameterNames:[],unsupportedReason:"computed-name"}}function Ct(e,t,n){let r=J(e);return r?{kind:"field",name:r,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(n),visibility:Se(e,r),isStatic:!1,isAbstract:!1,isOptional:X(e),arity:null,genericTypeParameterNames:[]}:Et(e,t,n)}function Rt(e,t,n){let r=e.childForFieldName("parameters");return(r?_(r):[]).filter(a=>_e(a,"typescript")).map(a=>Ct(a,t,n))}function wt(e,t,n,r){if(e.type==="pair"&&t==="object")return[It(e,n)];let a=Tt(e,n),i=a.kind==="constructor"?Rt(e,n,r):[];return[a,...i]}function Ot(e,t,n){let r=[],a=new Set;e.hasError&&a.add("syntax-error");for(let i of _(e)){if($e.has(i.type))continue;let o=wt(i,t,n,e);r.push(...o);for(let s of o)s.unsupportedReason&&a.add(s.unsupportedReason)}return{declarations:r,reasons:a}}function vt(e){let t=M(e),n=bt(e),r=n?Ot(n,e.type,t):{declarations:[],reasons:new Set(["unsupported-member"])};return{inventory:{owner:t,complete:r.reasons.size===0,incompleteReasons:[...r.reasons].sort()},declarations:r.declarations}}function Pt(e){return{kind:$.get(e.type)??"function",name:ge(e),declarationSpan:c(e),owner:A(e.parent),lexicalScopeSpan:S(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:B(e),genericTypeParameterNames:b(e)}}function Lt(e){let t=e.parent;if(!t)return!1;let n=r=>r?.type===e.type&&r.startIndex===e.startIndex&&r.endIndex===e.endIndex;return!!((t.type==="public_field_definition"||t.type==="field_definition")&&n(t.childForFieldName("value"))||t.type==="pair"&&n(t.childForFieldName("value")))}function Mt(e){return e.type==="function_expression"&&e.parent?.type==="export_statement"&&/^export\s+default\s+(?:async\s+)?function(?:\s|\*|\()/u.test(e.parent.text)}function kt(e,t){return e.declarationSpan.start-t.declarationSpan.start||e.typeSpan.start-t.typeSpan.start||e.kind.localeCompare(t.kind)}function Bt(e,t){return e.declarationSpan.start-t.declarationSpan.start||e.declarationSpan.end-t.declarationSpan.end||e.kind.localeCompare(t.kind)}function Kt(e,t,n,r){let a=et(e,t);a&&r.facts.push(a);let i=nt(e);i&&r.facts.push(i);let o=rt(e);o&&r.facts.push(o);let s=at(e);s&&r.q3TypeAliases.push(s);let l=it(e);l&&r.q3Classes.push(l);let d=dt(e,n);d&&r.q3NewReceiverBindings.push(d),r.facts.push(...ut(e,t))}function Ut(e,t){if(!Ge.has(e.type))return;let n=`${e.startIndex}:${e.endIndex}:${e.type}`;if(t.visitedOwners.has(n))return;t.visitedOwners.add(n);let r=vt(e);t.ownerInventories.push(r.inventory),t.declarations.push(...r.declarations)}function Ht(e,t){!$.has(e.type)||Lt(e)&&!Mt(e)||t.declarations.push(Pt(e))}function Vt(e){if(e.type!=="variable_declarator"||e.hasError)return!1;let t=e.childForFieldName("name");if(!t||!y.has(t.type)||A(e.parent).kind!=="program")return!1;let n=e.childForFieldName("value");return!n||!$.has(n.type)}function Yt(e){return e?.type==="lexical_declaration"||e?.type==="variable_declaration"}function Wt(e,t){if(e?.type!=="export_statement"||e.parent?.type!=="program")return!1;let n=e.childForFieldName("declaration");return n?.type===t.type&&n.startIndex===t.startIndex&&n.endIndex===t.endIndex}function jt(e){let t=e.parent;return Yt(t)?Wt(t.parent,t):!1}function Qt(e){if(!Vt(e)||!jt(e))return null;let t=e.childForFieldName("name");if(!t)return null;let n=A(e.parent);return{kind:"unknown",name:t.text,declarationSpan:c(e),owner:n,lexicalScopeSpan:S(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:null,genericTypeParameterNames:[]}}function Gt(e,t,n,r){Kt(e,t,n,r),Ut(e,r),Ht(e,r);let a=Qt(e);a&&r.declarations.push(a)}function Ie(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")throw new RangeError(`Unsupported declared-type grammar: ${String(t)}`);let n=[],r=[],a=[],i=[],o=[],s=[],l=lt(e),g={facts:n,declarations:r,ownerInventories:a,q3Classes:i,q3TypeAliases:o,q3NewReceiverBindings:s,visitedOwners:new Set};return z(e,p=>Gt(p,t,l,g)),n.sort(kt),r.sort(Bt),a.sort((p,m)=>p.owner.span.start-m.owner.span.start||p.owner.kind.localeCompare(m.owner.kind)),o.sort((p,m)=>p.declarationSpan.start-m.declarationSpan.start),i.sort((p,m)=>p.declarationSpan.start-m.declarationSpan.start),s.sort((p,m)=>p.declarationSpan.start-m.declarationSpan.start),{schemaVersion:1,language:t,facts:n,declarations:r,ownerInventories:a,q3ReceiverFacts:{schemaVersion:1,classes:i,typeAliases:o,newReceiverBindings:s}}}var O=new Set(["arrow_function","function_declaration","function_expression","generator_function","generator_function_declaration","method_definition"]),De=new Set(["class_declaration","abstract_class_declaration","class"]),$t=new Set(["class","class_declaration","abstract_class_declaration","function_expression","function_declaration","generator_function","generator_function_declaration"]),zt=new Set(["function_type","constructor_type","call_signature","construct_signature","index_signature","object_type"]),Z=new Set(["for_statement","for_in_statement","for_of_statement","for_await_statement"]),Jt=new Set(["object_pattern","array_pattern","pair_pattern","assignment_pattern","object_assignment_pattern","rest_pattern"]),Xt=/^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u;function h(e){return{start:e.startIndex,end:e.endIndex}}function T(e){let t=[];for(let n=0;n<e.namedChildCount;n+=1){let r=e.namedChild(n);r&&t.push(r)}return t}function Zt(e){let t=[];for(let n=0;n<e.childCount;n+=1){let r=e.child(n);r&&t.push(r)}return t}function W(e,t){t(e);for(let n of T(e))W(n,t)}function v(e,t){let n=e;for(;n;){if(t(n))return n;n=n.parent}return null}function en(e){let t=e.childForFieldName("name")??e.childForFieldName("pattern")??e.childForFieldName("declarator");return t?.type==="identifier"?t.text:null}function V(e,t,n){return v(e.parent,t)??n}function tn(e){return e.parent?.text.trimStart().match(/^(var|let|const)\b/)?.[1]}function nn(e,t){if(e.type==="required_parameter"||e.type==="optional_parameter")return V(e,a=>O.has(a.type),t);if(tn(e)==="var")return V(e,a=>O.has(a.type),t);let r=v(e.parent,a=>Z.has(a.type));return r||V(e,a=>a.type==="statement_block",t)}function rn(e,t){return v(e.parent,n=>O.has(n.type))??t}function be(e){let t=e.parent;for(;t;){if(De.has(t.type))return t;if(t.type==="arrow_function"){t=t.parent;continue}if(O.has(t.type)&&!(t.type==="method_definition"&&t.parent?.type==="class_body"))return null;t=t.parent}return null}function an(e){let t=be(e),n=t?.childForFieldName("name")?.text;return t&&n?{name:n,span:h(t)}:null}function on(e,t,n){return n.type!=="public_field_definition"&&n.type!=="field_definition"||n.childForFieldName("name")?.text!==e?null:{kind:"field",name:e,declarationSpan:h(n),scopeSpan:h(t)}}function P(e){return e.type==="identifier"?[e.text]:e.type==="shorthand_property_identifier_pattern"||e.type==="shorthand_property_identifier"?[e.text]:Jt.has(e.type)?T(e).flatMap(P):[]}function L(e,t,n,r,a){let i=Y(n),o=e.get(i)??new Map;for(let s of a){let l=o.get(s);if(l){(l.declarationSpan.start!==t.startIndex||l.declarationSpan.end!==t.endIndex)&&o.set(s,{...l,kind:"unsupported"});continue}o.set(s,{name:s,declarationSpan:h(t),scopeSpan:h(n),kind:r})}e.set(i,o)}function sn(e,t,n){if(v(e.parent,l=>zt.has(l.type)))return;let r=e.childForFieldName("name")??e.childForFieldName("pattern")??e.childForFieldName("declarator");if(!r)return;let a=P(r),i=r.type==="identifier",o=v(e.parent,l=>Z.has(l.type)),s=i&&(e.type==="required_parameter"||e.type==="optional_parameter")?"parameter":o?"unsupported":i?"local":"unsupported";L(n,e,nn(e,t),s,a)}function ln(e,t){if(!O.has(e.type))return;let n=e.childForFieldName("parameters"),r=e.childForFieldName("parameter"),a=n?T(n):r?[r]:[];for(let i of a){if(i.type==="required_parameter"||i.type==="optional_parameter")continue;let o=P(i);if(o.length===0)continue;let s=i.type==="identifier";L(t,i,e,s?"parameter":"unsupported",o)}}function cn(e,t,n){if(!$t.has(e.type))return;let r=e.childForFieldName("name");if(r?.type!=="identifier"&&r?.type!=="type_identifier")return;let i=e.type==="class"||e.type==="function_expression"||e.type==="generator_function"?e:V(e,o=>o.type==="statement_block",t);L(n,r,i,"unsupported",[r.text])}function dn(e,t){if(e.type!=="catch_clause")return;let n=e.childForFieldName("parameter");if(!n)return;let r=e.childForFieldName("body")??e;L(t,n,r,"unsupported",P(n))}function un(e,t){if(!Z.has(e.type))return;let n=e.childForFieldName("left")??e.childForFieldName("initializer");if(!n)return;let r=n.type==="variable_declaration"?T(n).find(i=>i.type==="variable_declarator"):n,a=r?.type==="variable_declarator"?r.childForFieldName("name"):r;a&&L(t,a,e,"unsupported",P(a))}function pn(e,t,n){let r=n.get(Y(e))??new Map;for(let[a,i]of fn(t))mn(e,r,a,i);n.set(Y(e),r)}function fn(e){let t=new Map;for(let n of e){if(n.viaReexport)continue;let r=t.get(n.localName)??[];r.push(n),t.set(n.localName,r)}return t}function mn(e,t,n,r){let a=t.get(n),i=h(e);if(r.length!==1||a){t.set(n,{name:n,declarationSpan:a?.declarationSpan??i,scopeSpan:i,kind:"unsupported"});return}t.set(n,{name:n,declarationSpan:i,scopeSpan:i,kind:r[0]?.isTypeOnly?"type-only-import":"import"})}function Nn(e,t){let n=new Map;return W(e,r=>{(r.type==="required_parameter"||r.type==="optional_parameter"||r.type==="variable_declarator")&&sn(r,e,n),ln(r,n),cn(r,e,n),dn(r,n),un(r,n)}),pn(e,t,n),n}function ee(e,t){return`${e.startIndex}:${t}`}function Y(e){return`${e.type}:${e.startIndex}:${e.endIndex}`}function Ee(e,t,n){e.set(t,e.has(t)?null:n)}function yn(e){return Zt(e).some(t=>t.type==="accessibility_modifier"||t.text==="readonly")}function gn(e,t,n){if(t.type!=="method_definition"||t.childForFieldName("name")?.text!=="constructor")return;let r=t.childForFieldName("parameters");for(let a of r?T(r):[]){let i=en(a);!i||!yn(a)||Ee(n,ee(e,i),{kind:"parameter-property",name:i,declarationSpan:h(a),scopeSpan:h(e)})}}function hn(e,t){let n=e.childForFieldName("body");for(let r of n?T(n):[]){let a=r.childForFieldName("name")?.text,i=a?on(a,e,r):null;i&&Ee(t,ee(e,a),i),gn(e,r,t)}}function _n(e){let t=new Map;return W(e,n=>{De.has(n.type)&&hn(n,t)}),t}function Ce(e,t,n){return`${e}:${t}:${n}`}function xn(e,t){let n=new Map;return W(e,r=>{if(r.type!=="call_expression")return;let a=r.childForFieldName("function");if(!a)return;let i=a.childForFieldName("property")??a.childForFieldName("name")??a,o=a.childForFieldName("property")?.text??a.text,s=Ce(i.startPosition.row,i.startPosition.column,o);n.set(s,[...n.get(s)??[],r])}),{callExpressions:n,bindingsByScope:Nn(e,t),propertiesByClassAndName:_n(e)}}function Fn(e,t,n){let r=be(t);if(e==="this")return r?{kind:"this",name:"this",declarationSpan:h(r),scopeSpan:h(r)}:null;let a=e.match(/^this\.([\p{ID_Start}_$][\p{ID_Continue}$]*)$/u);if(a)return r?n.propertiesByClassAndName.get(ee(r,a[1]))??null:null}function An(e,t,n){if(!e)return null;let r=Fn(e,t,n);if(r!==void 0)return r;if(!Xt.test(e))return null;let a=Re(e,t,n);return a?Sn(e,a):null}function Re(e,t,n){let r=t;for(;r;){let a=n.bindingsByScope.get(Y(r))?.get(e);if(a)return a;r=r.parent}}function Sn(e,t){return!t||t.kind==="unsupported"||t.kind==="import"||t.kind==="type-only-import"?null:{kind:t.kind,name:e,declarationSpan:t.declarationSpan,scopeSpan:t.scopeSpan}}function Tn(e,t,n){if((e.calleeKind??"bare")!=="bare")return null;let a=e.calleeName,i=Re(a,t,n);return i?{kind:i.kind==="import"||i.kind==="type-only-import"||i.kind==="local"||i.kind==="parameter"?i.kind:"unsupported",name:a,declarationSpan:i.declarationSpan,scopeSpan:i.scopeSpan}:{kind:"unbound",name:a}}function In(e){switch(e.type){case"string":return"string";case"number":return"number";case"true":case"false":return"boolean";case"null":return"null";case"object":return"object";case"array":return"array";case"arrow_function":case"function_expression":return"function";default:return"unknown"}}function Dn(e,t){return t?[e.start,e.end,t.kind,t.declarationSpan.start,t.declarationSpan.end,t.scopeSpan.start,t.scopeSpan.end].join(":"):null}function bn(e,t){if(!e.calleeName||e.calleeKind==="computed")return null;let n=t.callExpressions.get(Ce(e.startLine,e.startColumn,e.calleeName));return n?.length===1?n[0]??null:null}function En(e){return!!e.calleeName&&e.calleeKind!=="computed"}function Cn(e,t,n,r){let a=t.childForFieldName("arguments"),i=a?T(a).filter(I=>I.type!=="comment"):[],o=i.some(I=>I.type==="spread_element"),s=rn(t,n),l=An(e.receiverText,t,r),d=Tn(e,t,r),g=t.childForFieldName("arguments")?.startIndex,p=t.text.slice(0,g===void 0?t.text.length:g-t.startIndex),m={startLine:e.startLine,startColumn:e.startColumn,calleeName:e.calleeName??"",calleeKind:e.calleeKind??"bare",receiverText:e.receiverText??null,receiverBinding:l,receiverOptional:p.includes("?."),calleeBinding:d,lexicalScopeSpan:h(s),callerType:an(t),argumentCount:o?null:i.length,hasSpreadArgument:o,argumentKinds:i.map(In)};return{fact:m,peerKey:Dn(m.lexicalScopeSpan,l)}}function Rn(e,t,n){if(!n||t.calleeKind!=="member"&&t.calleeKind!=="this")return;let r=e.get(n)??new Set;r.add(t.calleeName),e.set(n,r)}function we(e,t,n,r){let a=xn(e,r),i=n.flatMap(l=>{if(!En(l))return[];let d=bn(l,a);return d?[Cn(l,d,e,a)]:[]}),o=new Map;for(let{fact:l,peerKey:d}of i)Rn(o,l,d);let s=i.map(({fact:l,peerKey:d})=>({...l,peerMemberNames:[...d?o.get(d)??[]:[]].filter(g=>g!==l.calleeName).sort()}));return{schemaVersion:2,language:t,callSites:s}}import{createHash as On}from"crypto";var vn=new Set([N.VARIABLE_DECLARATOR,N.ASSIGNMENT_EXPRESSION,N.PAIR,N.PUBLIC_FIELD_DEFINITION]),Pn=new Set([u.ARROW_FUNCTION,u.FUNCTION_EXPRESSION,u.FUNCTION_DECLARATION,u.GENERATOR_FUNCTION,u.GENERATOR_FUNCTION_DECLARATION,u.FUNCTION_DEFINITION,u.METHOD_DECLARATION,u.METHOD_DEFINITION,u.LOCAL_FUNCTION_STATEMENT,u.CONSTRUCTOR_DECLARATION,u.DESTRUCTOR_DECLARATION,u.CONVERSION_OPERATOR_DECLARATION,u.OPERATOR_DECLARATION,u.COMPACT_CONSTRUCTOR_DECLARATION,u.METHOD,u.SINGLETON_METHOD,u.FUNCTION_ITEM]);function te(e){return On(le).update(e.text).digest("hex")}function ne(e){return e.childForFieldName("name")?.text||e.descendantsOfType(u.IDENTIFIER)[0]?.text||f.ANONYMOUS_NAME}function Ln(e){return e.childForFieldName("declarator")?.childForFieldName("declarator")}function Mn(e){let t=e.childForFieldName("name");if(t)return{name:t.text,nameNode:t};let n=Ln(e);if(!n)return;if(n.type!==N.QUALIFIED_IDENTIFIER)return{name:n.text,nameNode:n};let r=n.childForFieldName("name");return{name:r?.text??f.ANONYMOUS_NAME,nameNode:r}}function kn(e){let t=e.parent;for(;t;){if(t.type===N.ARGUMENTS||Pn.has(t.type))return;if(vn.has(t.type)){let n=t.childForFieldName("name")||t.childForFieldName("key")||t.childForFieldName("left");if(n)return{name:n.text,nameNode:n}}t=t.parent}}function Oe(e){return Mn(e)??kn(e)??{name:f.ANONYMOUS_NAME,nameNode:void 0}}function Bn(e){return Oe(e).name}function E(e,t){let n=e.parent;for(;n;){if(t.has(n.id))return ne(n);n=n.parent}return f.ANONYMOUS_NAME}function ve(e){return e.type===N.TYPE_IDENTIFIER?e.text:e.descendantsOfType(N.TYPE_IDENTIFIER)[0]?.text}function Kn(e){let t=e.parent;for(;t;){if(t.type===N.IMPL_ITEM){let n=t.childForFieldName("type");return n?ve(n):void 0}t=t.parent}}function Un(e){let n=e.childForFieldName("receiver")?.namedChild(0)?.childForFieldName("type");return n?ve(n):void 0}function Hn(e){let n=e.childForFieldName("declarator")?.childForFieldName("declarator");if(n?.type!==N.QUALIFIED_IDENTIFIER)return;let r=n.childForFieldName("scope");if(r)return r.type===N.QUALIFIED_IDENTIFIER?r.childForFieldName("name")?.text:r.text}function Vn(e){return Kn(e)??Un(e)??Hn(e)}function Pe(e,t,n){let r=t.extractClasses(e.rootNode);for(let a of r)n.push({name:ne(a),startLine:a.startPosition.row,endLine:a.endPosition.row,methods:[],contentHash:te(a)});return r}var Yn=new Set([u.ARROW_FUNCTION,u.FUNCTION_EXPRESSION]);function Le(e,t,n){let r=t.extractVariables?.(e.rootNode)??[],a=[];for(let i of r){let o=i.childForFieldName("value");o&&Yn.has(o.type)||(a.push(i),n.push({name:ne(i),startLine:i.startPosition.row,endLine:i.endPosition.row,contentHash:te(i)}))}return a}function re(e,t,n,r){let a=new Set(r.map(o=>o.id)),i=t.extractFunctions(e.rootNode);for(let o of i){let s=E(o,a),l=s===f.ANONYMOUS_NAME?Vn(o):s;n.push({name:Oe(o).name,startLine:o.startPosition.row,endLine:o.endPosition.row,declarationSpan:{start:o.startIndex,end:o.endIndex},contentHash:te(o),containerName:l})}return i}var ie=new se(e=>Q?.postMessage(e));process.on("uncaughtException",e=>{ie.error(f.WORKER_UNCAUGHT_EXCEPTION,{error:e instanceof Error?e.message:String(e)})});process.on("unhandledRejection",e=>{ie.error(f.WORKER_UNHANDLED_REJECTION,{error:e instanceof Error?e.message:String(e)})});var Me=!1,ke=null;function jn(){return ke??=ue(),ke}var Be=new Map;function Qn(e){let t=Be.get(e);return t||(t=Wn.load(e),Be.set(e,t)),t}function Gn(e){let t=[],n=e.matchAll(/import\s+{([^}]+)}\s+from\s+['"]([^'"]+)['"]/g);for(let r of n)t.push({localName:r[1].trim(),originalName:r[1].trim(),modulePath:r[2]});return t}function qn(e){return e.childForFieldName("function")||e.childForFieldName("expression")||e.childForFieldName("type")||e.childForFieldName("name")||e.childForFieldName("method")||e}function $n(e){let t=qn(e),n=t.namedChildren,r=n[n.length-1],a=n.length>=2?n[n.length-2]:void 0;if(!r||!a)return{targetFunction:j(t.text),calleeName:t.text,calleeKind:"bare"};if(!zn.has(r.type))return{targetFunction:j(t.text),calleeKind:"computed"};let i=r.text,o=a.text;return o.includes("(")?{targetFunction:j(t.text),calleeName:i,receiverText:o,calleeKind:"arg-chain"}:{targetFunction:j(t.text),calleeName:i,receiverText:o,calleeKind:o==="this"||o==="super"?"this":"member"}}function j(e){return e.replace(/\s+/g,"")}var zn=new Set(["identifier","property_identifier","field_identifier","shorthand_property_identifier","attribute"]);function Jn(e){return((e.childForFieldName("property")||e.childForFieldName("field")||e.childForFieldName("attribute")||e.childForFieldName("name")||e.childForFieldName("method"))??e).startPosition}function Xn(e,t,n,r){let a=new Set(n.map(o=>o.id)),i=t.extractCalls(e.rootNode);for(let o of i){if(r.length>=1e3)break;let s=Jn(o),l=$n(o);r.push({sourceFunction:E(o,a),targetFunction:l.targetFunction,startLine:s.row,startColumn:s.column,calleeName:l.calleeName,receiverText:l.receiverText,calleeKind:l.calleeKind})}}function Zn(e,t,n,r){if(!t.extractImplements)return;let a=new Set(n.map(i=>i.id));for(let i of t.extractImplements(e.rootNode))r.push({sourceClass:E(i,a),targetInterface:i.text})}function er(e,t,n,r){if(!t.extractExtends)return;let a=new Set(n.map(i=>i.id));for(let i of t.extractExtends(e.rootNode))r.push({sourceClass:E(i,a),targetClass:i.text})}var tr=new Set([F.TYPESCRIPT,F.JAVASCRIPT]),nr="Worker",rr="path",ar="resolve",ir="join",or="__dirname";function sr(e){if(e.type!=="call_expression")return!1;let t=e.childForFieldName("function");if(!t||t.type!=="member_expression")return!1;let n=t.childForFieldName("object")?.text,r=t.childForFieldName("property")?.text;return n===rr&&(r===ar||r===ir)}function lr(e){let t=e.childForFieldName("arguments");return!t||!t.namedChildren.some(a=>a?.type==="identifier"&&a.text===or)?void 0:t.descendantsOfType("string")[0]?.text.replace(/['"]/g,"")}function cr(e,t){for(let n of e.rootNode.descendantsOfType(N.ASSIGNMENT_EXPRESSION)){if(!n)continue;let r=n.childForFieldName("left"),a=n.childForFieldName("right");if(r?.text!==t||!a||!sr(a))continue;let i=lr(a);if(i)return i}}function dr(e,t){if(t.type==="string")return t.text.replace(/['"]/g,"");if(t.type==="identifier"||t.type==="member_expression")return cr(e,t.text)}function ur(e,t,n,r){if(!tr.has(t))return;let a=new Set(n.map(i=>i.id));for(let i of e.rootNode.descendantsOfType("new_expression")){if(!i||i.childForFieldName("constructor")?.text!==nr)continue;let l=i.childForFieldName("arguments")?.namedChildren.find(g=>g!==null);if(!l)continue;let d=dr(e,l);d&&r.push({sourceFunction:E(i,a),targetPath:d})}}function He(e){let t=[];for(let n=0;n<e.namedChildCount;n+=1){let r=e.namedChild(n);r&&t.push(r)}return t}function pr(e){let t=[];for(let n of He(e))t.push(...fr(n));return t}function fr(e){if(e.type!=="export_statement")return[];if(/^export\s+default\b/u.test(e.text))return[mr(e)];let t=e.childForFieldName("declaration");return t?Nr(t):[]}function mr(e){let t=/^export\s+default\s+(?:async\s+)?function(?:\s|\*|\()/u.test(e.text),n=[...e.descendantsOfType("function_declaration"),...e.descendantsOfType("generator_function_declaration"),...e.descendantsOfType("function_expression"),...e.descendantsOfType("generator_function"),...e.descendantsOfType("class_declaration"),...e.descendantsOfType("abstract_class_declaration")].filter(i=>i!==null),r=e.childForFieldName("declaration")??n.sort((i,o)=>i.startIndex-o.startIndex)[0];return r&&t&&["function_declaration","generator_function_declaration","function_expression","generator_function"].includes(r.type)?{name:"default",type:"function",declarationSpan:{start:r.startIndex,end:r.endIndex}}:{name:"default",type:r?.type==="class_declaration"||r?.type==="abstract_class_declaration"?"class":"other",declarationSpan:r?{start:r.startIndex,end:r.endIndex}:{start:e.startIndex,end:e.endIndex}}}function Nr(e){let t=yr(e);if(t)return[t];let n=gr(e);return n?[n]:e.type!=="lexical_declaration"&&e.type!=="variable_declaration"?[]:hr(e)}function yr(e){if(e.type!=="class_declaration"&&e.type!=="abstract_class_declaration")return;let t=e.childForFieldName("name");return t&&["identifier","type_identifier"].includes(t.type)?{name:t.text,type:"class"}:void 0}function gr(e){if(e.type!=="function_declaration"&&e.type!=="generator_function_declaration")return;let t=e.childForFieldName("name");return t?.type==="identifier"?{name:t.text,type:"function"}:void 0}function hr(e){let t=[];for(let n of He(e)){if(n.type!=="variable_declarator")continue;let r=n.childForFieldName("name");r?.type==="identifier"&&t.push({name:r.text,type:"variable"})}return t}function _r(e,t,n){let r=[],a=[],i=[],o,s=[],l=[],d=[],g=[],p=[],m=[],I=[];if(e){r.push(f.parsedViaTreeSitter(e.rootNode.childCount));try{i.push(...pr(e.rootNode)),(n===F.TYPESCRIPT||n===F.JAVASCRIPT)&&(o=de(e.rootNode));let x=Pe(e,t,l),oe=re(e,t,s,x),Ve=t.extractImports(e.rootNode);a.push(...ce(Ve)),Le(e,t,d),Xn(e,t,oe,g),Zn(e,t,x,p),er(e,t,x,m),ur(e,n,oe,I),r.push(f.QUERIED_VIA_LANGUAGE_PROVIDER)}catch(x){r.push(f.providerQueryFailed(x instanceof Error?x.message:String(x)))}}return{imports:a,exports:i,...o===void 0?{}:{reexports:o},functions:s,classes:l,variables:d,calls:g,implements:p,extends:m,workerSpawns:I,decisions:r}}function xr(e,t){for(let n of e.drainQueryCompileFailures?.()??[])ie.error(f.QUERY_COMPILE_FAILED,{language:t,kind:n.kind,pattern:n.pattern,message:n.message})}function Fr(e,t,n,r,a){let i=new Ke;i.setLanguage(n),t.initQueries?.(n),xr(t,r);let o=i.parse(e),s=_r(o,t,r),l=Ar(r,a),d=o&&l?{...s,declaredTypeFacts:Ie(o.rootNode,l),callSiteShapeFacts:we(o.rootNode,l,s.calls,s.imports)}:s;return o&&o.delete(),i.delete(),d}function Ar(e,t){if(e===F.TYPESCRIPT)return ae.extname(t).toLowerCase()===".tsx"?"tsx":"typescript";if(e===F.JAVASCRIPT)return"javascript"}async function Sr(e){Me||(await Ke.init(),Me=!0);let t=await jn(),n=ae.extname(e.filePath),r=t.getProviderForExtension(n);if(!r)return{taskId:e.taskId,success:!0,data:{imports:[],exports:[],functions:[],classes:[],calls:[],decisions:[f.noLanguageProviderForExtension(n)]}};let{wasmPath:a,attemptedPaths:i}=pe(r.wasm_file);if(!Ue.existsSync(a))return{taskId:e.taskId,success:!0,data:{imports:Gn(e.code),exports:[],functions:[],classes:[],calls:[],decisions:[f.wasmNotFound(e.language,i.join(", "))]}};let o=await Qn(a),s=Fr(e.code,r,o,e.language,e.filePath);return{taskId:e.taskId,success:!0,data:s}}Q?.on("message",async e=>{try{let t=await Sr(e);Q?.postMessage(t)}catch(t){Q?.postMessage({taskId:e.taskId,success:!1,error:t.stack||String(t)})}});export{Sr as buildParseResponse,re as collectFunctionNodes,ur as collectWorkerSpawns,$n as getCalleeEvidence,xr as reportQueryCompileFailures,Bn as resolveCallableName,pe as resolveWasmPath};
|
|
3
3
|
//# sourceMappingURL=ast-worker.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{Ga as P,Ka as d,Qa as Y,Ra as B,Sa as G,Ta as H,Ua as Q,Va as V,Wa as j,Xa as W,Ya as q,Za as J,_a as K}from"./chunk-2OLMINDD.js";var z="anonymous";var Jt="AstWorkerCrashError",Kt={ARGUMENTS:"arguments",VARIABLE_DECLARATOR:"variable_declarator",ASSIGNMENT_EXPRESSION:"assignment_expression",PAIR:"pair",PUBLIC_FIELD_DEFINITION:"public_field_definition",IMPL_ITEM:"impl_item",TYPE_IDENTIFIER:"type_identifier",POINTER_TYPE:"pointer_type",QUALIFIED_IDENTIFIER:"qualified_identifier"},zt={PARSE_FAILURE_NO_DETAIL:"parse returned success=false with no error detail",PARSE_FAILURE_RESULT:"AST parse returned failure result",PARSE_THREW:"AST parse threw (worker crash or rejection)",WORKER_UNCAUGHT_EXCEPTION:"AST worker uncaughtException",QUERY_COMPILE_FAILED:"AST language query failed to compile; using fallback",WORKER_UNHANDLED_REJECTION:"AST worker unhandledRejection",WORKER_EXITED_DURING_SHUTDOWN:"AST worker exited during pool shutdown (expected)",WORKER_CRASHED_EXITED:"AST worker crashed/exited",WORKER_EXITED_UNEXPECTEDLY:"Worker exited unexpectedly",POOL_TERMINATED:"AST worker pool terminated before task completion",UNKNOWN_FILE:"(unknown file)",PARSE_CACHE_HIT:"AST parse cache hit",CACHE_METRICS_AND_QUEUE_PERFORMANCE:"AST cache metrics and queue performance",TASK_TIMED_OUT_TERMINATING:"AST worker task timed out \u2014 terminating stuck worker",WORKER_TERMINATE_FAILED:"AST worker terminate() rejected \u2014 forced termination did not complete",QUERIED_VIA_LANGUAGE_PROVIDER:"Queried nodes using @workspace/ast-core LanguageProvider",ANONYMOUS_NAME:z,workerCrashWhileParsing:t=>`AST worker crashed while parsing ${t}: `,taskTimedOutAfterMs:(t,e)=>`AST worker task ${t} timed out after ${e}ms`,workerExitedWithCode:t=>`Worker exited with code ${t}`,noLanguageProviderForExtension:t=>`No language provider registered for extension ${t}`,wasmNotFound:(t,e)=>`WASM not found for ${t}, AST parsing skipped (Regex fallback used). Tried paths: ${e}`,parsedViaTreeSitter:t=>`Parsed via web-tree-sitter (nodes: ${t})`,providerQueryFailed:t=>`ast-core provider query failed: ${t}`};var A={FILE:"file",CLASS:"class",FUNCTION:"function",CALL:"call",METHOD_CALL:"method_call",IMPORT:"import",API_CONTRACT:"api_contract"};var l={IDENTIFIER:"identifier",SCOPED_IDENTIFIER:"scoped_identifier",QUALIFIED_IDENTIFIER:"qualified_identifier",DOTTED_NAME:"dotted_name",ALIASED_IMPORT:"aliased_import",USE_AS_CLAUSE:"use_as_clause",USE_WILDCARD:"use_wildcard",SCOPED_USE_LIST:"scoped_use_list",USE_LIST:"use_list",DOT:"dot",BLANK_IDENTIFIER:"blank_identifier",NAMESPACE_USE_DECLARATION:"namespace_use_declaration",INCLUDE_EXPRESSION:"include_expression",INCLUDE_ONCE_EXPRESSION:"include_once_expression",REQUIRE_EXPRESSION:"require_expression",REQUIRE_ONCE_EXPRESSION:"require_once_expression",IMPORT_STATEMENT:"import_statement",IMPORT_FROM_STATEMENT:"import_from_statement",USE_DECLARATION:"use_declaration",IMPORT_DECLARATION:"import_declaration",PREPROC_INCLUDE:"preproc_include",USING_DECLARATION:"using_declaration",CALL:"call",USING_DIRECTIVE:"using_directive",CALL_EXPRESSION:"call_expression",METHOD_INVOCATION:"method_invocation",EXPLICIT_CONSTRUCTOR_INVOCATION:"explicit_constructor_invocation",COMMAND_CALL:"command_call",FUNCTION_CALL_EXPRESSION:"function_call_expression",MEMBER_CALL_EXPRESSION:"member_call_expression",SCOPED_CALL_EXPRESSION:"scoped_call_expression",INVOCATION_EXPRESSION:"invocation_expression",OBJECT_CREATION_EXPRESSION:"object_creation_expression",MEMBER_EXPRESSION:"member_expression",ATTRIBUTE:"attribute",MEMBER_ACCESS_EXPRESSION:"member_access_expression",VARIABLE_DECLARATION:"variable_declaration",LEXICAL_DECLARATION:"lexical_declaration",VARIABLE_DECLARATOR:"variable_declarator",ARROW_FUNCTION:"arrow_function",FUNCTION_DECLARATION:"function_declaration",METHOD_DEFINITION:"method_definition",CLASS_DECLARATION:"class_declaration",INTERFACE_DECLARATION:"interface_declaration",TYPE_ALIAS_DECLARATION:"type_alias_declaration",EXPORT_STATEMENT:"export_statement"};var T="*",pe=["require","require_relative","load"],Z="this",Ae="new";function on(t){let e=[];for(let n of t){let o=n.type,i=Ce[o];if(i){i(n,e);continue}if(ze(o)){tt(n,o,e);continue}rt(n,e)}return e}var Ce={[l.IMPORT_STATEMENT]:Oe,[l.EXPORT_STATEMENT]:xe,[l.IMPORT_FROM_STATEMENT]:Xe,[l.USE_DECLARATION]:Ve,[l.IMPORT_DECLARATION]:We,[l.PREPROC_INCLUDE]:qe,[l.USING_DECLARATION]:Je,[l.CALL]:Ke,[l.USING_DIRECTIVE]:nt};function Oe(t,e){let n=t.descendantsOfType("string").pop();if(!n)return;let o=n.text.replace(/['"]/g,""),i=/^import\s+type\b/u.test(t.text.trimStart());if(!Se(t,o,i,e)){if(Re(t,o,i,e)){he(t,o,i,e);return}ge(t,o,i,e)}}function Se(t,e,n,o){let i=t.descendantsOfType("namespace_import")[0];if(!i)return!1;let s=i.descendantsOfType("identifier")[0];return s&&o.push({localName:s.text,originalName:T,modulePath:e,...n?{isTypeOnly:!0}:{}}),!0}function Re(t,e,n,o){let i=t.descendantsOfType("named_imports")[0];if(!i)return!1;for(let s of i.descendantsOfType("import_specifier"))s&&Le(s,e,n,o);return!0}function Le(t,e,n,o){let i=t.childForFieldName("name");if(!i)return;let s=t.childForFieldName("alias"),a=i.text;o.push({localName:s?s.text:a,originalName:a,modulePath:e,...n||/^type\s/u.test(t.text.trimStart())?{isTypeOnly:!0}:{}})}function he(t,e,n,o){let i=De(t);!i||!Pe(t)||!Fe(t)||o.push({localName:i,originalName:"default",modulePath:e,isCombinedDefaultImport:!0,...n?{isTypeOnly:!0}:{}})}function De(t){let o=(t.descendantsOfType("import_clause")[0]?.namedChildren??[]).filter(s=>s!==null).find(s=>s.type==="identifier"),i=t.text.trimStart().match(/^import\s+(?:type\s+)?([$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*)\s*,\s*\{/u)?.[1];return o?.text??i}function Pe(t){return(t.descendantsOfType("import_clause")[0]?.namedChildren??[]).some(o=>o?.type==="named_imports")?!0:/^import\s+(?:type\s+)?[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*\s*,\s*\{/u.test(t.text.trimStart())}function Fe(t){return!!t.descendantsOfType("named_imports")[0]?.descendantsOfType("import_specifier").length}function ge(t,e,n,o){let i=t.descendantsOfType("identifier")[0];i&&o.push({localName:i.text,originalName:T,modulePath:e,isDefaultImport:!0,...n?{isTypeOnly:!0}:{}})}function xe(t,e){let n=t.childForFieldName("source");if(!n)return;let o=n.text.replace(/['"]/g,""),i=t.descendantsOfType("export_clause")[0];if(i)for(let s of i.descendantsOfType("export_specifier")){if(!s)continue;let a=s.childForFieldName("name");if(!a)continue;let E=s.childForFieldName("alias");e.push({localName:E?E.text:a.text,originalName:a.text,modulePath:o,viaReexport:!0})}}function $e(t){let e=t.childForFieldName("source");return e?e.text.replace(/^['"]|['"]$/gu,""):void 0}function w(t,e){return/^export\s+type\b/u.test(t.text.trimStart())||e!==void 0&&/^type(?:\s|$)/u.test(e.text.trimStart())}function ye(t,e,n){let o=n.childForFieldName("name");if(!o)return null;let i=n.childForFieldName("alias"),s=w(t,n),a=i?.text??o.text;return e!==void 0?{kind:"named",exportedName:a,importedName:o.text,modulePath:e,...s?{isTypeOnly:!0}:{}}:{kind:"local",exportedName:a,localName:o.text,...s?{isTypeOnly:!0}:{}}}function Me(t,e){let n=t.descendantsOfType("export_clause")[0];return n?n.descendantsOfType("export_specifier").flatMap(o=>{if(!o)return[];let i=ye(t,e,o);return i?[i]:[]}):null}function Ue(t,e){let n=t.text.trimStart().match(/^export\s+(?:type\s+)?\*\s+as\s+([$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*)/u)?.[1];return n?{kind:"namespace",exportedName:n,modulePath:e,...w(t)?{isTypeOnly:!0}:{}}:null}function we(t,e){return/^export\s+(?:type\s+)?\*\s+from\b/u.test(t.text.trimStart())?{kind:"star",exportedName:"*",modulePath:e,...w(t)?{isTypeOnly:!0}:{}}:null}function be(t){let e=$e(t),n=Me(t,e);if(n)return n;if(e===void 0)return[];let o=Ue(t,e);if(o)return[o];let i=we(t,e);return i?[i]:[]}function sn(t){let e=[];for(let n of t.namedChildren)n?.type===l.EXPORT_STATEMENT&&e.push(...be(n));return e}function Xe(t,e){let n=t.childForFieldName("module_name");if(!n)return;let o=n.text;if(t.descendantsOfType("wildcard_import")[0])return;t.childForFieldName("name")&&ot(t,o,e)}function ve(t,e){let n=t.childForFieldName("path"),o=t.childForFieldName("alias");n&&o&&e.push({localName:o.text,originalName:T,modulePath:n.text})}function ke(t,e,n){let o=t.childForFieldName("path"),i=t.childForFieldName("alias");o&&i&&n.push({localName:i.text,originalName:T,modulePath:`${e}::${o.text}`})}function Ye(t,e,n){let o=t.descendantsOfType("identifier").pop();o&&n.push({localName:o.text,originalName:T,modulePath:`${e}::${t.text}`})}function Be(t,e,n){if(t.type===l.USE_AS_CLAUSE){ke(t,e,n);return}if(t.type===l.IDENTIFIER){n.push({localName:t.text,originalName:T,modulePath:`${e}::${t.text}`});return}t.type===l.SCOPED_IDENTIFIER&&Ye(t,e,n)}function Ge(t,e){let n=t.childForFieldName("path"),o=t.childForFieldName("list");if(!n||!o)return;let i=n.text;for(let s of o.namedChildren)s&&Be(s,i,e)}function He(t,e){let n=t.descendantsOfType("identifier"),o=n[n.length-1];o&&e.push({localName:o.text,originalName:T,modulePath:t.text})}function Qe(t,e){for(let n of t.namedChildren)n&&n.type===l.IDENTIFIER&&e.push({localName:n.text,originalName:T,modulePath:n.text})}function Ve(t,e){let n=t.childForFieldName("argument");if(n){if(n.type===l.USE_AS_CLAUSE){ve(n,e);return}if(n.type!==l.USE_WILDCARD){if(n.type===l.SCOPED_USE_LIST){Ge(n,e);return}if(n.type===l.SCOPED_IDENTIFIER||n.type===l.IDENTIFIER){He(n,e);return}n.type===l.USE_LIST&&Qe(n,e)}}}function je(t,e){let n=t.childForFieldName("path");if(!n)return;let o=n.text.replace(/['"]/g,""),i=t.childForFieldName("name");if(i){if(i.type===l.DOT||i.type===l.BLANK_IDENTIFIER)return;e.push({localName:i.text,originalName:T,modulePath:o})}else{let s=o.split("/"),a=s[s.length-1];e.push({localName:a,originalName:T,modulePath:o})}}function We(t,e){let n=t.descendantsOfType("import_spec_list")[0];if(!n)return;let o=n.descendantsOfType("import_spec");for(let i of o)i&&je(i,e)}function qe(t,e){let n=t.childForFieldName("path");if(n){let o=n.text.replace(/[<>"']/g,"");e.push({localName:o,originalName:T,modulePath:o})}}function Je(t,e){let n=t.namedChildren;for(let o of n)if(o)if(o.type===l.QUALIFIED_IDENTIFIER){let i=o.descendantsOfType("identifier"),s=i[i.length-1];s&&e.push({localName:s.text,originalName:T,modulePath:o.text})}else o.type===l.IDENTIFIER&&e.push({localName:o.text,originalName:T,modulePath:o.text})}function Ke(t,e){let n=t.childForFieldName("method");if(!n)return;let o=n.text;if(!pe.includes(o))return;let i=t.childForFieldName("arguments");if(!i)return;let s=i.descendantsOfType("string_content")[0]||i.descendantsOfType("string")[0];if(!s)return;let a=s.text.replace(/['"]/g,""),E=a.replace(/\.rb$/,"");e.push({localName:E,originalName:T,modulePath:a})}function ze(t){return t===l.NAMESPACE_USE_DECLARATION||t===l.INCLUDE_EXPRESSION||t===l.INCLUDE_ONCE_EXPRESSION||t===l.REQUIRE_EXPRESSION||t===l.REQUIRE_ONCE_EXPRESSION}function Ze(t,e){let n=t.descendantsOfType("qualified_name")[0]||t.descendantsOfType("name")[0];if(n){let o=n.text,i=o.split("\\"),s=i[i.length-1];e.push({localName:s,originalName:T,modulePath:o})}}function et(t,e){let n=t.descendantsOfType("string")[0]||t.descendantsOfType("string_content")[0];if(n){let o=n.text.replace(/['"]/g,"");e.push({localName:o,originalName:T,modulePath:o})}}function tt(t,e,n){e===l.NAMESPACE_USE_DECLARATION?Ze(t,n):et(t,n)}function nt(t,e){let n=t.descendantsOfType("qualified_name")[0]||t.descendantsOfType("identifier")[0];if(n){let o=n.text,i=o.split("."),s=i[i.length-1];e.push({localName:s,originalName:T,modulePath:o})}}function rt(t,e){let n=t.descendantsOfType("string").pop();if(!n)return;let o=n.text.replace(/['"]/g,""),i=t.descendantsOfType("identifier");for(let s of i)s&&(e.some(a=>a.localName===s.text)||e.push({localName:s.text,originalName:s.text,modulePath:o}))}function ot(t,e,n){if(t.childForFieldName("name")){for(let i of t.namedChildren)if(i)if(i.type===l.ALIASED_IMPORT){let s=i.childForFieldName("name"),a=i.childForFieldName("alias");s&&a&&n.push({localName:a.text,originalName:s.text,modulePath:e})}else if(i.type===l.DOTTED_NAME){let s=i.descendantsOfType("identifier"),a=s[s.length-1];a&&n.push({localName:a.text,originalName:i.text,modulePath:e})}else i.type===l.IDENTIFIER&&n.push({localName:i.text,originalName:i.text,modulePath:e})}}function it(t){let e=t.childForFieldName("function");if(!e)return{isMethodCall:!1,methodName:""};if(e.type===l.MEMBER_EXPRESSION){let n=e.childForFieldName("property"),o=e.childForFieldName("object");if(n)return{isMethodCall:!0,methodName:n.text,objectName:o?.text}}return{isMethodCall:!1,methodName:e.text}}function st(t){let e=t.childForFieldName("function");if(!e)return{isMethodCall:!1,methodName:""};if(e.type===l.ATTRIBUTE){let n=e.childForFieldName("attribute"),o=e.childForFieldName("object");if(n)return{isMethodCall:!0,methodName:n.text,objectName:o?.text}}return{isMethodCall:!1,methodName:e.text}}function at(t){let e=t.childForFieldName("name"),n=t.childForFieldName("object");if(e)return{isMethodCall:!0,methodName:e.text,objectName:n?.text}}function ct(t){return{isMethodCall:!0,methodName:t.childForFieldName("constructor")?.text||Z,objectName:Z}}function lt(t){let e=t.childForFieldName("method");if(!e)return;let n=t.childForFieldName("receiver");return n?{isMethodCall:!0,methodName:e.text,objectName:n.text}:{isMethodCall:!1,methodName:e.text}}function U(t){let e=t.type,o=t.childForFieldName("name")?.text||"";if(e===l.MEMBER_CALL_EXPRESSION){let i=t.childForFieldName("object");return{isMethodCall:!0,methodName:o,objectName:i?.text}}if(e===l.SCOPED_CALL_EXPRESSION){let i=t.childForFieldName("scope");return{isMethodCall:!0,methodName:o,objectName:i?.text}}return{isMethodCall:!1,methodName:o}}function Et(t){let e=t.childForFieldName("function")||t.namedChildren[0];if(e&&e.type===l.MEMBER_ACCESS_EXPRESSION){let n=e.childForFieldName("name"),o=e.childForFieldName("expression");if(n)return{isMethodCall:!0,methodName:n.text,objectName:o?.text}}if(e)return{isMethodCall:!1,methodName:e.text}}function Nt(t){let e=t.childForFieldName("type");return{isMethodCall:!0,methodName:Ae,objectName:e?.text}}var an={[l.CALL_EXPRESSION]:it,[l.CALL]:st,[l.METHOD_INVOCATION]:at,[l.EXPLICIT_CONSTRUCTOR_INVOCATION]:ct,[l.COMMAND_CALL]:lt,[l.FUNCTION_CALL_EXPRESSION]:U,[l.MEMBER_CALL_EXPRESSION]:U,[l.SCOPED_CALL_EXPRESSION]:U,[l.INVOCATION_EXPRESSION]:Et,[l.OBJECT_CREATION_EXPRESSION]:Nt};var It=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,L=class t extends Date{#t=!1;#n=!1;#e=null;constructor(e){let n=!0,o=!0,i="Z";if(typeof e=="string"){let s=e.match(It);s?(s[1]||(n=!1,e=`0000-01-01T${e}`),o=!!s[2],o&&e[10]===" "&&(e=e.replace(" ","T")),s[2]&&+s[2]>23?e="":(i=s[3]||null,e=e.toUpperCase(),!i&&o&&(e+="Z"))):e=""}super(e),isNaN(this.getTime())||(this.#t=n,this.#n=o,this.#e=i)}isDateTime(){return this.#t&&this.#n}isLocal(){return!this.#t||!this.#n||!this.#e}isDate(){return this.#t&&!this.#n}isTime(){return this.#n&&!this.#t}isValid(){return this.#t||this.#n}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,n="Z"){let o=new t(e);return o.#e=n,o}static wrapAsLocalDateTime(e){let n=new t(e);return n.#e=null,n}static wrapAsLocalDate(e){let n=new t(e);return n.#n=!1,n.#e=null,n}static wrapAsLocalTime(e){let n=new t(e);return n.#t=!1,n.#e=null,n}};function ft(t,e){let n=t.slice(0,e).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function ut(t,e,n){let o=t.split(/\r\n|\n|\r/g),i="",s=(Math.log10(e+1)|0)+1;for(let a=e-1;a<=e+1;a++){let E=o[a-1];E&&(i+=a.toString().padEnd(s," "),i+=": ",i+=E,i+=`
|
|
2
|
+
import{$a as K,Ha as P,La as d,Ra as Y,Sa as B,Ta as G,Ua as H,Va as Q,Wa as V,Xa as j,Ya as W,Za as q,_a as J}from"./chunk-RRS2FFZT.js";var z="anonymous";var Jt="AstWorkerCrashError",Kt={ARGUMENTS:"arguments",VARIABLE_DECLARATOR:"variable_declarator",ASSIGNMENT_EXPRESSION:"assignment_expression",PAIR:"pair",PUBLIC_FIELD_DEFINITION:"public_field_definition",IMPL_ITEM:"impl_item",TYPE_IDENTIFIER:"type_identifier",POINTER_TYPE:"pointer_type",QUALIFIED_IDENTIFIER:"qualified_identifier"},zt={PARSE_FAILURE_NO_DETAIL:"parse returned success=false with no error detail",PARSE_FAILURE_RESULT:"AST parse returned failure result",PARSE_THREW:"AST parse threw (worker crash or rejection)",WORKER_UNCAUGHT_EXCEPTION:"AST worker uncaughtException",QUERY_COMPILE_FAILED:"AST language query failed to compile; using fallback",WORKER_UNHANDLED_REJECTION:"AST worker unhandledRejection",WORKER_EXITED_DURING_SHUTDOWN:"AST worker exited during pool shutdown (expected)",WORKER_CRASHED_EXITED:"AST worker crashed/exited",WORKER_EXITED_UNEXPECTEDLY:"Worker exited unexpectedly",POOL_TERMINATED:"AST worker pool terminated before task completion",UNKNOWN_FILE:"(unknown file)",PARSE_CACHE_HIT:"AST parse cache hit",CACHE_METRICS_AND_QUEUE_PERFORMANCE:"AST cache metrics and queue performance",TASK_TIMED_OUT_TERMINATING:"AST worker task timed out \u2014 terminating stuck worker",WORKER_TERMINATE_FAILED:"AST worker terminate() rejected \u2014 forced termination did not complete",QUERIED_VIA_LANGUAGE_PROVIDER:"Queried nodes using @workspace/ast-core LanguageProvider",ANONYMOUS_NAME:z,workerCrashWhileParsing:t=>`AST worker crashed while parsing ${t}: `,taskTimedOutAfterMs:(t,e)=>`AST worker task ${t} timed out after ${e}ms`,workerExitedWithCode:t=>`Worker exited with code ${t}`,noLanguageProviderForExtension:t=>`No language provider registered for extension ${t}`,wasmNotFound:(t,e)=>`WASM not found for ${t}, AST parsing skipped (Regex fallback used). Tried paths: ${e}`,parsedViaTreeSitter:t=>`Parsed via web-tree-sitter (nodes: ${t})`,providerQueryFailed:t=>`ast-core provider query failed: ${t}`};var A={FILE:"file",CLASS:"class",FUNCTION:"function",CALL:"call",METHOD_CALL:"method_call",IMPORT:"import",API_CONTRACT:"api_contract"};var l={IDENTIFIER:"identifier",SCOPED_IDENTIFIER:"scoped_identifier",QUALIFIED_IDENTIFIER:"qualified_identifier",DOTTED_NAME:"dotted_name",ALIASED_IMPORT:"aliased_import",USE_AS_CLAUSE:"use_as_clause",USE_WILDCARD:"use_wildcard",SCOPED_USE_LIST:"scoped_use_list",USE_LIST:"use_list",DOT:"dot",BLANK_IDENTIFIER:"blank_identifier",NAMESPACE_USE_DECLARATION:"namespace_use_declaration",INCLUDE_EXPRESSION:"include_expression",INCLUDE_ONCE_EXPRESSION:"include_once_expression",REQUIRE_EXPRESSION:"require_expression",REQUIRE_ONCE_EXPRESSION:"require_once_expression",IMPORT_STATEMENT:"import_statement",IMPORT_FROM_STATEMENT:"import_from_statement",USE_DECLARATION:"use_declaration",IMPORT_DECLARATION:"import_declaration",PREPROC_INCLUDE:"preproc_include",USING_DECLARATION:"using_declaration",CALL:"call",USING_DIRECTIVE:"using_directive",CALL_EXPRESSION:"call_expression",METHOD_INVOCATION:"method_invocation",EXPLICIT_CONSTRUCTOR_INVOCATION:"explicit_constructor_invocation",COMMAND_CALL:"command_call",FUNCTION_CALL_EXPRESSION:"function_call_expression",MEMBER_CALL_EXPRESSION:"member_call_expression",SCOPED_CALL_EXPRESSION:"scoped_call_expression",INVOCATION_EXPRESSION:"invocation_expression",OBJECT_CREATION_EXPRESSION:"object_creation_expression",MEMBER_EXPRESSION:"member_expression",ATTRIBUTE:"attribute",MEMBER_ACCESS_EXPRESSION:"member_access_expression",VARIABLE_DECLARATION:"variable_declaration",LEXICAL_DECLARATION:"lexical_declaration",VARIABLE_DECLARATOR:"variable_declarator",ARROW_FUNCTION:"arrow_function",FUNCTION_DECLARATION:"function_declaration",METHOD_DEFINITION:"method_definition",CLASS_DECLARATION:"class_declaration",INTERFACE_DECLARATION:"interface_declaration",TYPE_ALIAS_DECLARATION:"type_alias_declaration",EXPORT_STATEMENT:"export_statement"};var T="*",pe=["require","require_relative","load"],Z="this",Ae="new";function on(t){let e=[];for(let n of t){let o=n.type,i=Ce[o];if(i){i(n,e);continue}if(ze(o)){tt(n,o,e);continue}rt(n,e)}return e}var Ce={[l.IMPORT_STATEMENT]:Oe,[l.EXPORT_STATEMENT]:xe,[l.IMPORT_FROM_STATEMENT]:Xe,[l.USE_DECLARATION]:Ve,[l.IMPORT_DECLARATION]:We,[l.PREPROC_INCLUDE]:qe,[l.USING_DECLARATION]:Je,[l.CALL]:Ke,[l.USING_DIRECTIVE]:nt};function Oe(t,e){let n=t.descendantsOfType("string").pop();if(!n)return;let o=n.text.replace(/['"]/g,""),i=/^import\s+type\b/u.test(t.text.trimStart());if(!Se(t,o,i,e)){if(Re(t,o,i,e)){he(t,o,i,e);return}ge(t,o,i,e)}}function Se(t,e,n,o){let i=t.descendantsOfType("namespace_import")[0];if(!i)return!1;let s=i.descendantsOfType("identifier")[0];return s&&o.push({localName:s.text,originalName:T,modulePath:e,...n?{isTypeOnly:!0}:{}}),!0}function Re(t,e,n,o){let i=t.descendantsOfType("named_imports")[0];if(!i)return!1;for(let s of i.descendantsOfType("import_specifier"))s&&Le(s,e,n,o);return!0}function Le(t,e,n,o){let i=t.childForFieldName("name");if(!i)return;let s=t.childForFieldName("alias"),a=i.text;o.push({localName:s?s.text:a,originalName:a,modulePath:e,...n||/^type\s/u.test(t.text.trimStart())?{isTypeOnly:!0}:{}})}function he(t,e,n,o){let i=De(t);!i||!Pe(t)||!Fe(t)||o.push({localName:i,originalName:"default",modulePath:e,isCombinedDefaultImport:!0,...n?{isTypeOnly:!0}:{}})}function De(t){let o=(t.descendantsOfType("import_clause")[0]?.namedChildren??[]).filter(s=>s!==null).find(s=>s.type==="identifier"),i=t.text.trimStart().match(/^import\s+(?:type\s+)?([$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*)\s*,\s*\{/u)?.[1];return o?.text??i}function Pe(t){return(t.descendantsOfType("import_clause")[0]?.namedChildren??[]).some(o=>o?.type==="named_imports")?!0:/^import\s+(?:type\s+)?[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*\s*,\s*\{/u.test(t.text.trimStart())}function Fe(t){return!!t.descendantsOfType("named_imports")[0]?.descendantsOfType("import_specifier").length}function ge(t,e,n,o){let i=t.descendantsOfType("identifier")[0];i&&o.push({localName:i.text,originalName:T,modulePath:e,isDefaultImport:!0,...n?{isTypeOnly:!0}:{}})}function xe(t,e){let n=t.childForFieldName("source");if(!n)return;let o=n.text.replace(/['"]/g,""),i=t.descendantsOfType("export_clause")[0];if(i)for(let s of i.descendantsOfType("export_specifier")){if(!s)continue;let a=s.childForFieldName("name");if(!a)continue;let E=s.childForFieldName("alias");e.push({localName:E?E.text:a.text,originalName:a.text,modulePath:o,viaReexport:!0})}}function $e(t){let e=t.childForFieldName("source");return e?e.text.replace(/^['"]|['"]$/gu,""):void 0}function w(t,e){return/^export\s+type\b/u.test(t.text.trimStart())||e!==void 0&&/^type(?:\s|$)/u.test(e.text.trimStart())}function ye(t,e,n){let o=n.childForFieldName("name");if(!o)return null;let i=n.childForFieldName("alias"),s=w(t,n),a=i?.text??o.text;return e!==void 0?{kind:"named",exportedName:a,importedName:o.text,modulePath:e,...s?{isTypeOnly:!0}:{}}:{kind:"local",exportedName:a,localName:o.text,...s?{isTypeOnly:!0}:{}}}function Me(t,e){let n=t.descendantsOfType("export_clause")[0];return n?n.descendantsOfType("export_specifier").flatMap(o=>{if(!o)return[];let i=ye(t,e,o);return i?[i]:[]}):null}function Ue(t,e){let n=t.text.trimStart().match(/^export\s+(?:type\s+)?\*\s+as\s+([$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*)/u)?.[1];return n?{kind:"namespace",exportedName:n,modulePath:e,...w(t)?{isTypeOnly:!0}:{}}:null}function we(t,e){return/^export\s+(?:type\s+)?\*\s+from\b/u.test(t.text.trimStart())?{kind:"star",exportedName:"*",modulePath:e,...w(t)?{isTypeOnly:!0}:{}}:null}function be(t){let e=$e(t),n=Me(t,e);if(n)return n;if(e===void 0)return[];let o=Ue(t,e);if(o)return[o];let i=we(t,e);return i?[i]:[]}function sn(t){let e=[];for(let n of t.namedChildren)n?.type===l.EXPORT_STATEMENT&&e.push(...be(n));return e}function Xe(t,e){let n=t.childForFieldName("module_name");if(!n)return;let o=n.text;if(t.descendantsOfType("wildcard_import")[0])return;t.childForFieldName("name")&&ot(t,o,e)}function ve(t,e){let n=t.childForFieldName("path"),o=t.childForFieldName("alias");n&&o&&e.push({localName:o.text,originalName:T,modulePath:n.text})}function ke(t,e,n){let o=t.childForFieldName("path"),i=t.childForFieldName("alias");o&&i&&n.push({localName:i.text,originalName:T,modulePath:`${e}::${o.text}`})}function Ye(t,e,n){let o=t.descendantsOfType("identifier").pop();o&&n.push({localName:o.text,originalName:T,modulePath:`${e}::${t.text}`})}function Be(t,e,n){if(t.type===l.USE_AS_CLAUSE){ke(t,e,n);return}if(t.type===l.IDENTIFIER){n.push({localName:t.text,originalName:T,modulePath:`${e}::${t.text}`});return}t.type===l.SCOPED_IDENTIFIER&&Ye(t,e,n)}function Ge(t,e){let n=t.childForFieldName("path"),o=t.childForFieldName("list");if(!n||!o)return;let i=n.text;for(let s of o.namedChildren)s&&Be(s,i,e)}function He(t,e){let n=t.descendantsOfType("identifier"),o=n[n.length-1];o&&e.push({localName:o.text,originalName:T,modulePath:t.text})}function Qe(t,e){for(let n of t.namedChildren)n&&n.type===l.IDENTIFIER&&e.push({localName:n.text,originalName:T,modulePath:n.text})}function Ve(t,e){let n=t.childForFieldName("argument");if(n){if(n.type===l.USE_AS_CLAUSE){ve(n,e);return}if(n.type!==l.USE_WILDCARD){if(n.type===l.SCOPED_USE_LIST){Ge(n,e);return}if(n.type===l.SCOPED_IDENTIFIER||n.type===l.IDENTIFIER){He(n,e);return}n.type===l.USE_LIST&&Qe(n,e)}}}function je(t,e){let n=t.childForFieldName("path");if(!n)return;let o=n.text.replace(/['"]/g,""),i=t.childForFieldName("name");if(i){if(i.type===l.DOT||i.type===l.BLANK_IDENTIFIER)return;e.push({localName:i.text,originalName:T,modulePath:o})}else{let s=o.split("/"),a=s[s.length-1];e.push({localName:a,originalName:T,modulePath:o})}}function We(t,e){let n=t.descendantsOfType("import_spec_list")[0];if(!n)return;let o=n.descendantsOfType("import_spec");for(let i of o)i&&je(i,e)}function qe(t,e){let n=t.childForFieldName("path");if(n){let o=n.text.replace(/[<>"']/g,"");e.push({localName:o,originalName:T,modulePath:o})}}function Je(t,e){let n=t.namedChildren;for(let o of n)if(o)if(o.type===l.QUALIFIED_IDENTIFIER){let i=o.descendantsOfType("identifier"),s=i[i.length-1];s&&e.push({localName:s.text,originalName:T,modulePath:o.text})}else o.type===l.IDENTIFIER&&e.push({localName:o.text,originalName:T,modulePath:o.text})}function Ke(t,e){let n=t.childForFieldName("method");if(!n)return;let o=n.text;if(!pe.includes(o))return;let i=t.childForFieldName("arguments");if(!i)return;let s=i.descendantsOfType("string_content")[0]||i.descendantsOfType("string")[0];if(!s)return;let a=s.text.replace(/['"]/g,""),E=a.replace(/\.rb$/,"");e.push({localName:E,originalName:T,modulePath:a})}function ze(t){return t===l.NAMESPACE_USE_DECLARATION||t===l.INCLUDE_EXPRESSION||t===l.INCLUDE_ONCE_EXPRESSION||t===l.REQUIRE_EXPRESSION||t===l.REQUIRE_ONCE_EXPRESSION}function Ze(t,e){let n=t.descendantsOfType("qualified_name")[0]||t.descendantsOfType("name")[0];if(n){let o=n.text,i=o.split("\\"),s=i[i.length-1];e.push({localName:s,originalName:T,modulePath:o})}}function et(t,e){let n=t.descendantsOfType("string")[0]||t.descendantsOfType("string_content")[0];if(n){let o=n.text.replace(/['"]/g,"");e.push({localName:o,originalName:T,modulePath:o})}}function tt(t,e,n){e===l.NAMESPACE_USE_DECLARATION?Ze(t,n):et(t,n)}function nt(t,e){let n=t.descendantsOfType("qualified_name")[0]||t.descendantsOfType("identifier")[0];if(n){let o=n.text,i=o.split("."),s=i[i.length-1];e.push({localName:s,originalName:T,modulePath:o})}}function rt(t,e){let n=t.descendantsOfType("string").pop();if(!n)return;let o=n.text.replace(/['"]/g,""),i=t.descendantsOfType("identifier");for(let s of i)s&&(e.some(a=>a.localName===s.text)||e.push({localName:s.text,originalName:s.text,modulePath:o}))}function ot(t,e,n){if(t.childForFieldName("name")){for(let i of t.namedChildren)if(i)if(i.type===l.ALIASED_IMPORT){let s=i.childForFieldName("name"),a=i.childForFieldName("alias");s&&a&&n.push({localName:a.text,originalName:s.text,modulePath:e})}else if(i.type===l.DOTTED_NAME){let s=i.descendantsOfType("identifier"),a=s[s.length-1];a&&n.push({localName:a.text,originalName:i.text,modulePath:e})}else i.type===l.IDENTIFIER&&n.push({localName:i.text,originalName:i.text,modulePath:e})}}function it(t){let e=t.childForFieldName("function");if(!e)return{isMethodCall:!1,methodName:""};if(e.type===l.MEMBER_EXPRESSION){let n=e.childForFieldName("property"),o=e.childForFieldName("object");if(n)return{isMethodCall:!0,methodName:n.text,objectName:o?.text}}return{isMethodCall:!1,methodName:e.text}}function st(t){let e=t.childForFieldName("function");if(!e)return{isMethodCall:!1,methodName:""};if(e.type===l.ATTRIBUTE){let n=e.childForFieldName("attribute"),o=e.childForFieldName("object");if(n)return{isMethodCall:!0,methodName:n.text,objectName:o?.text}}return{isMethodCall:!1,methodName:e.text}}function at(t){let e=t.childForFieldName("name"),n=t.childForFieldName("object");if(e)return{isMethodCall:!0,methodName:e.text,objectName:n?.text}}function ct(t){return{isMethodCall:!0,methodName:t.childForFieldName("constructor")?.text||Z,objectName:Z}}function lt(t){let e=t.childForFieldName("method");if(!e)return;let n=t.childForFieldName("receiver");return n?{isMethodCall:!0,methodName:e.text,objectName:n.text}:{isMethodCall:!1,methodName:e.text}}function U(t){let e=t.type,o=t.childForFieldName("name")?.text||"";if(e===l.MEMBER_CALL_EXPRESSION){let i=t.childForFieldName("object");return{isMethodCall:!0,methodName:o,objectName:i?.text}}if(e===l.SCOPED_CALL_EXPRESSION){let i=t.childForFieldName("scope");return{isMethodCall:!0,methodName:o,objectName:i?.text}}return{isMethodCall:!1,methodName:o}}function Et(t){let e=t.childForFieldName("function")||t.namedChildren[0];if(e&&e.type===l.MEMBER_ACCESS_EXPRESSION){let n=e.childForFieldName("name"),o=e.childForFieldName("expression");if(n)return{isMethodCall:!0,methodName:n.text,objectName:o?.text}}if(e)return{isMethodCall:!1,methodName:e.text}}function Nt(t){let e=t.childForFieldName("type");return{isMethodCall:!0,methodName:Ae,objectName:e?.text}}var an={[l.CALL_EXPRESSION]:it,[l.CALL]:st,[l.METHOD_INVOCATION]:at,[l.EXPLICIT_CONSTRUCTOR_INVOCATION]:ct,[l.COMMAND_CALL]:lt,[l.FUNCTION_CALL_EXPRESSION]:U,[l.MEMBER_CALL_EXPRESSION]:U,[l.SCOPED_CALL_EXPRESSION]:U,[l.INVOCATION_EXPRESSION]:Et,[l.OBJECT_CREATION_EXPRESSION]:Nt};var It=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,L=class t extends Date{#t=!1;#n=!1;#e=null;constructor(e){let n=!0,o=!0,i="Z";if(typeof e=="string"){let s=e.match(It);s?(s[1]||(n=!1,e=`0000-01-01T${e}`),o=!!s[2],o&&e[10]===" "&&(e=e.replace(" ","T")),s[2]&&+s[2]>23?e="":(i=s[3]||null,e=e.toUpperCase(),!i&&o&&(e+="Z"))):e=""}super(e),isNaN(this.getTime())||(this.#t=n,this.#n=o,this.#e=i)}isDateTime(){return this.#t&&this.#n}isLocal(){return!this.#t||!this.#n||!this.#e}isDate(){return this.#t&&!this.#n}isTime(){return this.#n&&!this.#t}isValid(){return this.#t||this.#n}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,n="Z"){let o=new t(e);return o.#e=n,o}static wrapAsLocalDateTime(e){let n=new t(e);return n.#e=null,n}static wrapAsLocalDate(e){let n=new t(e);return n.#n=!1,n.#e=null,n}static wrapAsLocalTime(e){let n=new t(e);return n.#t=!1,n.#e=null,n}};function ft(t,e){let n=t.slice(0,e).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function ut(t,e,n){let o=t.split(/\r\n|\n|\r/g),i="",s=(Math.log10(e+1)|0)+1;for(let a=e-1;a<=e+1;a++){let E=o[a-1];E&&(i+=a.toString().padEnd(s," "),i+=": ",i+=E,i+=`
|
|
3
3
|
`,a===e&&(i+=" ".repeat(s+n+2),i+=`^
|
|
4
4
|
`))}return i}var f=class extends Error{line;column;codeblock;constructor(e,n){let[o,i]=ft(n.toml,n.ptr),s=ut(n.toml,o,i);super(`Invalid TOML document: ${e}
|
|
5
5
|
|
|
@@ -59,4 +59,4 @@ smol-toml/dist/index.js:
|
|
|
59
59
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
60
60
|
*)
|
|
61
61
|
*/
|
|
62
|
-
//# sourceMappingURL=chunk-
|
|
62
|
+
//# sourceMappingURL=chunk-HMNSKM6W.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{Ba as n,Ma as t,ea as e,ia as o}from"./chunk-RRS2FFZT.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-NKKCG232.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
var a={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error"};var d="ipc-log",te=new Set(Object.values(a));function v(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function R(e){if(!v(e))return!1;let{type:t,level:n,message:o,context:i}=e;return t===d&&typeof n=="string"&&te.has(n)&&typeof o=="string"&&(i===void 0||v(i))}var C=class{constructor(t){this.postMessageFn=t}postMessageFn;debug(t,n){this.send(a.DEBUG,t,n)}info(t,n){this.send(a.INFO,t,n)}warn(t,n){this.send(a.WARN,t,n)}error(t,n){this.send(a.ERROR,t,n)}onLog(){return()=>{}}send(t,n,o){let i=o?{type:d,level:t,message:n,context:o}:{type:d,level:t,message:n};this.postMessageFn(i)}};var y={CONTEXT_INJECTION:"context-injection",COMMIT_L3_WRITE:"commit-l3-write",TIER_B_C_PREPUSH:"tier-b-c-prepush"},ne={[y.CONTEXT_INJECTION]:!0,[y.COMMIT_L3_WRITE]:!0,[y.TIER_B_C_PREPUSH]:!0};var f=".docuvia",oe="logs",re="init.log",ie="clean.log",se="status.log",ae="sync.log",le="analyze.log",ce="review.log",de="impact.log",pe="query.log",ue="export-topology.log",ge="snapshot.log",ye="hydrate.log",me="sync-knowledge.log",A="node_modules",Se="local.db",Ee="init.lock",_e="tierC.lock",Re="sync-state.json",Ce="hooks-config.json",fe="pending-l3-decisions.json";var Ae="utf8";var Te="sha256";var s={TYPESCRIPT:"typescript",JAVASCRIPT:"javascript",PYTHON:"python",RUST:"rust",GO:"go",JAVA:"java",C:"c",CPP:"cpp",RUBY:"ruby",PHP:"php",CSHARP:"csharp"};var x=".claude/hooks",P=".cursor/hooks",b="docuvia-hook.js",M="docuvia-hook.cjs";var Ie=[`${x}/${b}`,`${P}/${M}`];function T(e){let t=e.replaceAll("\\","/");return Ie.includes(t)}var Le="EEXIST",Ne="ENOENT",Oe="EPERM",he="EACCES",De="EBUSY",ve="win32";var p=class{listeners=new Set;debug(t,n){this.emit(a.DEBUG,t,n)}info(t,n){this.emit(a.INFO,t,n)}warn(t,n){this.emit(a.WARN,t,n)}error(t,n){this.emit(a.ERROR,t,n)}onLog(t){return this.listeners.add(t),()=>this.listeners.delete(t)}emit(t,n,o){let i=o?{level:t,message:n,context:o}:{level:t,message:n};for(let u of this.listeners)u(i)}};function xe(){return new p}var I=class{constructor(t){this.logger=t}logger;handleMessage(t){return R(t)?(this.logger[t.level](t.message,t.context),!0):!1}};var c={GIT_COMMAND_FAILED:"GIT_COMMAND_FAILED",GIT_NETWORK_TIMEOUT:"GIT_NETWORK_TIMEOUT",GIT_NOT_A_REPOSITORY:"GIT_NOT_A_REPOSITORY",GIT_BRANCH_CREATE_FAILED:"GIT_BRANCH_CREATE_FAILED",GIT_HOOK_INSTALL_FAILED:"GIT_HOOK_INSTALL_FAILED",GIT_FAST_IMPORT_FAILED:"GIT_FAST_IMPORT_FAILED",DB_OPEN_FAILED:"DB_OPEN_FAILED",DB_NOT_FOUND:"DB_NOT_FOUND",DB_MIGRATION_FAILED:"DB_MIGRATION_FAILED",DB_QUERY_FAILED:"DB_QUERY_FAILED",DB_LOCKED:"DB_LOCKED",AST_WORKER_CRASHED:"AST_WORKER_CRASHED",AST_PARSE_FAILED:"AST_PARSE_FAILED",CALL_RESOLUTION_PROJECTION_SOURCE_MISSING:"CALL_RESOLUTION_PROJECTION_SOURCE_MISSING",CALL_RESOLUTION_QUARANTINE_UNAVAILABLE:"CALL_RESOLUTION_QUARANTINE_UNAVAILABLE",FS_READ_FAILED:"FS_READ_FAILED",FS_PATH_TRAVERSAL:"FS_PATH_TRAVERSAL",FACTORY_TOKEN_NOT_REGISTERED:"FACTORY_TOKEN_NOT_REGISTERED",FACTORY_LOCKED:"FACTORY_LOCKED",MEMORY_SCOPE_NOT_FOUND:"MEMORY_SCOPE_NOT_FOUND",SYNC_FETCH_FAILED:"SYNC_FETCH_FAILED",SYNC_PUSH_FAILED:"SYNC_PUSH_FAILED",LLM_NOT_INITIALIZED:"LLM_NOT_INITIALIZED",LLM_CHAT_COMPLETION_FAILED:"LLM_CHAT_COMPLETION_FAILED",LLM_HTTP_FAILED:"LLM_HTTP_FAILED",LLM_RATE_LIMITED:"LLM_RATE_LIMITED",LLM_AUTH_FAILED:"LLM_AUTH_FAILED",LLM_STREAM_FAILED:"LLM_STREAM_FAILED",LLM_INVALID_RESPONSE:"LLM_INVALID_RESPONSE",SEMANTIC_CORPUS_LEAKAGE:"SEMANTIC_CORPUS_LEAKAGE",SEMANTIC_CORPUS_IO_FAILED:"SEMANTIC_CORPUS_IO_FAILED",SEMANTIC_CORPUS_INVALID:"SEMANTIC_CORPUS_INVALID",SEMANTIC_INVALID_REQUEST:"SEMANTIC_INVALID_REQUEST",SEMANTIC_INVALID_RESPONSE:"SEMANTIC_INVALID_RESPONSE",SEMANTIC_INPUT_LIMIT_EXCEEDED:"SEMANTIC_INPUT_LIMIT_EXCEEDED",SEMANTIC_CANCELLED:"SEMANTIC_CANCELLED",SEMANTIC_DEADLINE_EXCEEDED:"SEMANTIC_DEADLINE_EXCEEDED",SEMANTIC_INFERENCE_FAILED:"SEMANTIC_INFERENCE_FAILED",INIT_WORKFLOW_FAILED:"INIT_WORKFLOW_FAILED",CLEAN_WORKFLOW_FAILED:"CLEAN_WORKFLOW_FAILED",UNINSTALL_WORKFLOW_FAILED:"UNINSTALL_WORKFLOW_FAILED",INVALID_INPUT:"INVALID_INPUT"};var Pe="DocuviaError",l=class e extends Error{code;cause;constructor(t,n,o){super(n),this.name=Pe,this.code=t,this.cause=o}static wrap(t,n,o){if(o instanceof e)return o;let i=o instanceof Error?o.message:String(o);return new e(t,`${n}: ${i}`,o)}};var be={WORKSPACE_ROOT:"workspaceRoot",API_URL:"apiUrl",PROJECT_ID:"projectId",COMMIT_SHA:"commitSha",TARGET_PATH:"targetPath",LLM_BASE_URL:"llmBaseUrl",LLM_MODEL:"llmModel",BASE_REF:"baseRef",HEAD_REF:"headRef",TARGET:"target",ESCALATE_TO_LSP:"escalateToLsp",TIER_B_FULL_RESYNC:"tierBFullResync",LIMIT:"limit",EXPLAIN_RESOLUTION:"explainResolution",COLLAPSE:"collapse",KEEP_DB:"keepDb",LSP_BINARY_OVERRIDE:"lspBinaryOverride",LSP_ARGS_OVERRIDE:"lspArgsOverride",LSP_TIMEOUT_MS:"lspTimeoutMs",LSP_MAX_PROCESSES:"lspMaxProcesses",TIER_B_COMMIT_CAP:"tierBCommitCap",TIER_C_DAILY_CALL_CAP:"tierCDailyCallCap",TIER_C_DAILY_TOKEN_CAP:"tierCDailyTokenCap",TIER_C_WALL_CLOCK_MS:"tierCWallClockMs",TIER_C_ITEM_CAP:"tierCItemCap",TIER_C_LOAD_THRESHOLD:"tierCLoadThreshold",GIT_NETWORK_TIMEOUT_MS:"gitNetworkTimeoutMs",FORCE:"force",TIER_C_DRAIN_ALL:"tierCDrainAll",AGENT_AUTHORED_DECISIONS:"agentAuthoredDecisions",HOOK_NAME:"hookName",HOOK_ENABLED:"hookEnabled",FLUSH_STAGED_L3:"flushStagedL3"},Me={SCOPE_NOT_FOUND:(e,t)=>`Cannot set "${e}": memory scope "${t}" was never created`},m=class{scopes=new Map;createScope(t){this.scopes.has(t)||this.scopes.set(t,new Map)}set(t,n,o){let i=this.scopes.get(t);if(!i)throw new l(c.MEMORY_SCOPE_NOT_FOUND,Me.SCOPE_NOT_FOUND(n,t));i.set(n,o)}get(t,n){return this.scopes.get(t)?.get(n)}deleteScope(t){this.scopes.delete(t)}hasScope(t){return this.scopes.has(t)}},Fe=new m;var F={REGISTER_LOCKED:e=>`Cannot register "${e}": factory is locked (test isolation)`,PROVIDER_NOT_REGISTERED:e=>`No provider registered for "${e}" \u2014 the implementation library that owns it was never imported for its registration side effect`},S=class{providers=new Map;locked=!1;register(t,n){if(this.locked)throw new l(c.FACTORY_LOCKED,F.REGISTER_LOCKED(String(t.description)));this.providers.set(t,n)}resolve(t,n){let o=this.providers.get(t);if(!o)throw new l(c.FACTORY_TOKEN_NOT_REGISTERED,F.PROVIDER_NOT_REGISTERED(String(t.description)));return o(this,n)}has(t){return this.providers.has(t)}lock(){this.locked=!0}unlock(){this.locked=!1}reset(){this.providers.clear(),this.locked=!1}},k=new S;function r(e){return Symbol(e)}var ke={HostEnvironment:r("HostEnvironmentSnapshot"),GitProvider:r("IGitProvider"),LineBlameProvider:r("ILineBlameProvider"),KnowledgeGitService:r("IKnowledgeGitService"),FileDiscovery:r("IFileDiscovery"),ConfigScanner:r("IConfigScanner"),VcsScanner:r("IVcsScanner"),AstProcessor:r("IAstProcessor"),GraphPersister:r("IGraphPersister"),TempFileManager:r("TempFileManager"),GraphStoreOpener:r("GraphStoreOpener"),ProcessLock:r("ProcessLock"),RemoteSyncClient:r("RemoteSyncClient"),LlmClient:r("LlmClient"),QueryService:r("IQueryService"),TierBCoverageHintProvider:r("ITierBCoverageHintProvider"),ImpactService:r("IImpactService"),ChangeDetectionService:r("IChangeDetectionService"),TopologyBuilder:r("ITopologyBuilder"),SnapshotRenderer:r("ISnapshotRenderer"),HydrationService:r("IHydrationService"),DiagnosticRunnerDb:r("DiagnosticRunnerDb"),DiagnosticRunnerGit:r("DiagnosticRunnerGit"),SemanticDiffAnalyzer:r("ISemanticDiffAnalyzer"),SemanticCorpusService:r("ISemanticCorpusService"),SemanticDecisionValidator:r("ISemanticDecisionValidator"),SemanticDecisionProvider:r("ISemanticDecisionProvider"),CallResolutionHypothesisService:r("ICallResolutionHypothesisService"),EdgeResolutionProviders:r("EdgeResolutionProviders")};var we={ADDED:"added",MODIFIED:"modified",DELETED:"deleted",RENAMED:"renamed"};var Ue={LSP:"lsp",LLM_INFERRED:"llm-inferred"},He={TYPESCRIPT:"typescript",PYTHON:"python",GO:"go",RUST:"rust",JAVA:"java",CPP:"cpp",CSHARP:"csharp",PHP:"php",RUBY:"ruby"};var Ke={EDGE_RELATION:"edge-relation",IMPACT_RELEVANCE:"impact-relevance",NEEDS_VERIFICATION:"needs-verification"};var Ge={CANDIDATE:"candidate",UNKNOWN:"unknown",VERIFY:"verify"},Be=1,Ve={MAX_CANDIDATES:32,MAX_OPTIONS:34,MAX_INPUT_BYTES:32*1024},je={SCORED:"scored",UNAVAILABLE:"unavailable"},Ye={RAW:"raw",CALIBRATED:"calibrated"},Qe={MODEL_NOT_INSTALLED:"model-not-installed",UNSUPPORTED_CAPABILITY:"unsupported-capability"};var qe={NO_REMOTE:"no-remote",UP_TO_DATE:"up-to-date",FAST_FORWARDED_LOCAL:"fast-forwarded-local",PUSHED_LOCAL:"pushed-local",MERGED:"merged"};import{createHash as We}from"crypto";function Xe(e){let t=Je(e.filePath);if(!/^[a-f0-9]{64}$/.test(e.sourceContentHash))throw new Error("Call-site source content hash must be a lowercase SHA-256 hex digest");if(!Number.isSafeInteger(e.startLine)||e.startLine<0)throw new Error("Call-site start line must be a non-negative zero-based integer");if(!Number.isSafeInteger(e.startColumn)||e.startColumn<0)throw new Error("Call-site start column must be a non-negative zero-based integer");if(!w(e.calleeKind))throw new Error("Call-site callee kind must be a non-empty string without NUL bytes");if(!w(e.calleeName))throw new Error("Call-site callee name must be a non-empty string without NUL bytes");return`call-site:v1:${We("sha256").update([t,e.sourceContentHash,String(e.startLine),String(e.startColumn),e.calleeKind,e.calleeName].join("\0"),"utf8").digest("hex")}`}function Je(e){if(typeof e!="string")throw new Error("Call-site path must be a workspace-relative POSIX path");if([e.length===0,e.endsWith("/"),e.startsWith("/"),/^[a-zA-Z]:/.test(e),e.includes("\\"),e.includes("\0")].some(Boolean))throw new Error("Call-site path must be a workspace-relative POSIX path");let n=[];for(let o of e.split("/"))if(!(!o||o===".")){if(o!==".."){n.push(o);continue}if(n.length===0)throw new Error("Call-site path must be a workspace-relative POSIX path");n.pop()}if(n.length===0)throw new Error("Call-site path must be a workspace-relative POSIX path");return n.join("/")}function w(e){return typeof e=="string"&&e.trim().length>0&&!e.includes("\0")}var ze="declared-member-hypothesis-v7",$e="ordered-evidence-v1";var Ze="q2:reexport-trace:v1",et="q3:super-call:v1",tt="q3:this-inherited:v1",nt="q3:typed-receiver:v1",ot="q3:new-receiver:v1";var rt="17f29ba13f08a288186c7bdbed2651248664643f98613df8d3087aade7b4f768";var it={MODULE:"module",PACKAGE:"package",PCD:"pcd"},st={CONTAINS:"contains",CALLS:"calls",IMPLEMENTS:"implements",EXTENDS:"extends",IMPORTS:"imports",DEPENDS_ON:"depends_on",DECISION:"decision"},L={CHANGE:"change",RULE:"rule",DECISION:"decision",CONTEXT:"context"},at={PENDING:"pending",ACTIVE:"active",DRAFT:"draft",GARBAGE:"garbage"},lt={ANALYZE:"analyze",AGENT_AUTHORED:"agent-authored"},ct={PROVEN:"proven",LIKELY:"likely",AMBIGUOUS:"ambiguous",UNRESOLVED:"unresolved",EXTERNAL:"external",UNSUPPORTED:"unsupported"},dt={TIER_B_TARGET_MISMATCH:"tier-b-target-mismatch"},pt={UNVERIFIED:"unverified",VERIFIED:"verified",CONTRADICTED:"contradicted"},ut="sha256-callsite-rule-v2",gt={SCOPE_RESOLVER:"scope-resolver",STRICT_PROOF:"strict-proof",HYPOTHESIS:"hypothesis",TIER_B:"tier-b"};var yt=L,mt={AUTO_FULL_INGESTION:"autoFullIngestion",AUTO_DELTA:"autoDelta",AUTO_DELTA_NOOP:"autoDeltaNoop",DECISION_EXTRACTION:"decisionExtraction",TIER_B_BATCH:"tierBBatch",FLUSH_STAGED_L3:"flushStagedL3"},St={NO_GRAPH:"no-graph",ANCHOR_NOT_IN_GRAPH:"anchor-not-in-graph"};var Et={CREATE_L3:"CREATE_L3"};var _t={SYSTEM:"system",USER:"user",ASSISTANT:"assistant",TOOL:"tool"},Rt="function";var Ct={LOW:"LOW",MEDIUM:"MEDIUM",HIGH:"HIGH",CRITICAL:"CRITICAL",UNKNOWN:"UNKNOWN"},ft={EXACT:"exact",LOWER_BOUND:"lower-bound"},At={BOUNDED:"bounded",UNRESOLVED:"unresolved"},Tt={DYNAMIC_IMPORT:"dynamic-import"},It={CORRUPT_JSON:"corrupt-json",NOT_ARRAY:"not-array",INVALID_RECORD:"invalid-record",MISSING:"missing",INCOMPLETE_SCAN:"incomplete-scan"},Lt={AVAILABLE:"available",UNAVAILABLE:"unavailable"},Nt={LSP_FALLBACK:"lsp-fallback",DYNAMIC_CANDIDATE:"dynamic-candidate"};var Ot={L2:"l2",L3:"l3"};var ht={FILE:"file",SYMBOL:"symbol",DECISION:"decision"},Dt={AUTO:"auto",FILE:"file",SYMBOL:"symbol"},vt={L1_TAG:"l1_tag",DIRECTORY:"directory"};var E={COMMIT_MESSAGE:"commitMessage",CONTRACT_SYMBOL:"contractSymbol"};function xt(e){if(e===void 0)return Ft();let t;try{t=JSON.parse(e)}catch{return U()}if(!Array.isArray(t))return U();let n=[],o=0;for(let i of t)Pt(i)?n.push(i):o++;return{entries:n,invalidCount:o,corrupt:!1}}function Pt(e){return!bt(e)||typeof e.target!="string"||typeof e.commitSha!="string"||!Mt(e)?!1:e.kind===E.COMMIT_MESSAGE?typeof e.message=="string":e.kind===E.CONTRACT_SYMBOL?typeof e.file=="string":!1}function bt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Mt(e){return e.failCount===void 0||typeof e.failCount=="number"&&Number.isInteger(e.failCount)&&e.failCount>=0}function Ft(){return{entries:[],invalidCount:0,corrupt:!1}}function U(){return{entries:[],invalidCount:0,corrupt:!0}}var kt={TYPESCRIPT:"typescript",REACT:"react",EXPRESS:"express",VUE:"vue"},wt={UNKNOWN:"unknown",JAVASCRIPT:"javascript",GENERIC:"generic",RUST:"rust",PYTHON:"python",GO:"go"},Ut="general",Ht={FRONTEND:"frontend",BACKEND:"backend",NEXTJS:"nextjs",SSR:"ssr",DRIZZLE:"drizzle",DATABASE:"database",TAILWINDCSS:"tailwindcss",CSS:"css",JEST:"jest",TESTING:"testing",VITEST:"vitest",POSTGRES:"postgres",MONOREPO:"monorepo",TOKIO:"tokio",ASYNC:"async",ACTIX:"actix",SERDE:"serde",TAURI:"tauri",DESKTOP:"desktop",DJANGO:"django",FASTAPI:"fastapi",PANDAS:"pandas",DATA:"data",GIN:"gin",STRICT_TS:"strict-ts",VITE:"vite",BUILD_TOOL:"build-tool"};var H="origin",N={KNOWLEDGE_ROOT:"docuvia-knowledge",KNOWLEDGE_LOG_SCAN_LIMIT:5e3,KNOWLEDGE_DIR_NAME:"knowledge",GRAPH_DIR_NAME:"graph",L3_DIR_NAME:"_l3",NODES_JSONL_NAME:"nodes.jsonl",EDGES_JSONL_NAME:"edges.jsonl",METADATA_JSON_NAME:"metadata.json",SOURCE_COMMIT_TRAILER_KEY:"Docuvia-Source",POST_COMMIT_HOOK_NAME:"post-commit",POST_COMMIT_HOOK_MARKER:"docuvia analyze",POST_COMMIT_FLUSH_L3_MARKER:"docuvia analyze --flush-staged-l3",POST_COMMIT_NOHUP_MARKER:"nohup npx --no-install docuvia analyze",DOCUVIA_HOOK_HEADER_COMMENT:"# Docuvia Knowledge Graph Evolver Hook",POST_COMMIT_HOOK_CONTENT:`#!/bin/bash
|
|
2
|
+
var a={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error"};var d="ipc-log",te=new Set(Object.values(a));function v(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function R(e){if(!v(e))return!1;let{type:t,level:n,message:o,context:i}=e;return t===d&&typeof n=="string"&&te.has(n)&&typeof o=="string"&&(i===void 0||v(i))}var C=class{constructor(t){this.postMessageFn=t}postMessageFn;debug(t,n){this.send(a.DEBUG,t,n)}info(t,n){this.send(a.INFO,t,n)}warn(t,n){this.send(a.WARN,t,n)}error(t,n){this.send(a.ERROR,t,n)}onLog(){return()=>{}}send(t,n,o){let i=o?{type:d,level:t,message:n,context:o}:{type:d,level:t,message:n};this.postMessageFn(i)}};var y={CONTEXT_INJECTION:"context-injection",COMMIT_L3_WRITE:"commit-l3-write",TIER_B_C_PREPUSH:"tier-b-c-prepush"},ne={[y.CONTEXT_INJECTION]:!0,[y.COMMIT_L3_WRITE]:!0,[y.TIER_B_C_PREPUSH]:!0};var f=".docuvia",oe="logs",re="init.log",ie="clean.log",se="status.log",ae="sync.log",le="analyze.log",ce="review.log",de="impact.log",pe="query.log",ue="export-topology.log",ge="snapshot.log",ye="hydrate.log",me="sync-knowledge.log",A="node_modules",Se="local.db",Ee="init.lock",_e="tierC.lock",Re="sync-state.json",Ce="hooks-config.json",fe="pending-l3-decisions.json";var Ae="utf8";var Te="sha256";var s={TYPESCRIPT:"typescript",JAVASCRIPT:"javascript",PYTHON:"python",RUST:"rust",GO:"go",JAVA:"java",C:"c",CPP:"cpp",RUBY:"ruby",PHP:"php",CSHARP:"csharp"};var x=".claude/hooks",P=".cursor/hooks",b="docuvia-hook.js",M="docuvia-hook.cjs";var Ie=[`${x}/${b}`,`${P}/${M}`];function T(e){let t=e.replaceAll("\\","/");return Ie.includes(t)}var Le="EEXIST",Ne="ENOENT",Oe="EPERM",he="EACCES",De="EBUSY",ve="win32";var p=class{listeners=new Set;debug(t,n){this.emit(a.DEBUG,t,n)}info(t,n){this.emit(a.INFO,t,n)}warn(t,n){this.emit(a.WARN,t,n)}error(t,n){this.emit(a.ERROR,t,n)}onLog(t){return this.listeners.add(t),()=>this.listeners.delete(t)}emit(t,n,o){let i=o?{level:t,message:n,context:o}:{level:t,message:n};for(let u of this.listeners)u(i)}};function xe(){return new p}var I=class{constructor(t){this.logger=t}logger;handleMessage(t){return R(t)?(this.logger[t.level](t.message,t.context),!0):!1}};var c={GIT_COMMAND_FAILED:"GIT_COMMAND_FAILED",GIT_NETWORK_TIMEOUT:"GIT_NETWORK_TIMEOUT",GIT_NOT_A_REPOSITORY:"GIT_NOT_A_REPOSITORY",GIT_BRANCH_CREATE_FAILED:"GIT_BRANCH_CREATE_FAILED",GIT_HOOK_INSTALL_FAILED:"GIT_HOOK_INSTALL_FAILED",GIT_FAST_IMPORT_FAILED:"GIT_FAST_IMPORT_FAILED",DB_OPEN_FAILED:"DB_OPEN_FAILED",DB_NOT_FOUND:"DB_NOT_FOUND",DB_MIGRATION_FAILED:"DB_MIGRATION_FAILED",DB_QUERY_FAILED:"DB_QUERY_FAILED",DB_LOCKED:"DB_LOCKED",AST_WORKER_CRASHED:"AST_WORKER_CRASHED",AST_PARSE_FAILED:"AST_PARSE_FAILED",CALL_RESOLUTION_PROJECTION_SOURCE_MISSING:"CALL_RESOLUTION_PROJECTION_SOURCE_MISSING",CALL_RESOLUTION_QUARANTINE_UNAVAILABLE:"CALL_RESOLUTION_QUARANTINE_UNAVAILABLE",FS_READ_FAILED:"FS_READ_FAILED",FS_PATH_TRAVERSAL:"FS_PATH_TRAVERSAL",FACTORY_TOKEN_NOT_REGISTERED:"FACTORY_TOKEN_NOT_REGISTERED",FACTORY_LOCKED:"FACTORY_LOCKED",MEMORY_SCOPE_NOT_FOUND:"MEMORY_SCOPE_NOT_FOUND",SYNC_FETCH_FAILED:"SYNC_FETCH_FAILED",SYNC_PUSH_FAILED:"SYNC_PUSH_FAILED",LLM_NOT_INITIALIZED:"LLM_NOT_INITIALIZED",LLM_CHAT_COMPLETION_FAILED:"LLM_CHAT_COMPLETION_FAILED",LLM_HTTP_FAILED:"LLM_HTTP_FAILED",LLM_RATE_LIMITED:"LLM_RATE_LIMITED",LLM_AUTH_FAILED:"LLM_AUTH_FAILED",LLM_STREAM_FAILED:"LLM_STREAM_FAILED",LLM_INVALID_RESPONSE:"LLM_INVALID_RESPONSE",SEMANTIC_CORPUS_LEAKAGE:"SEMANTIC_CORPUS_LEAKAGE",SEMANTIC_CORPUS_IO_FAILED:"SEMANTIC_CORPUS_IO_FAILED",SEMANTIC_CORPUS_INVALID:"SEMANTIC_CORPUS_INVALID",SEMANTIC_INVALID_REQUEST:"SEMANTIC_INVALID_REQUEST",SEMANTIC_INVALID_RESPONSE:"SEMANTIC_INVALID_RESPONSE",SEMANTIC_INPUT_LIMIT_EXCEEDED:"SEMANTIC_INPUT_LIMIT_EXCEEDED",SEMANTIC_CANCELLED:"SEMANTIC_CANCELLED",SEMANTIC_DEADLINE_EXCEEDED:"SEMANTIC_DEADLINE_EXCEEDED",SEMANTIC_INFERENCE_FAILED:"SEMANTIC_INFERENCE_FAILED",INIT_WORKFLOW_FAILED:"INIT_WORKFLOW_FAILED",CLEAN_WORKFLOW_FAILED:"CLEAN_WORKFLOW_FAILED",UNINSTALL_WORKFLOW_FAILED:"UNINSTALL_WORKFLOW_FAILED",INVALID_INPUT:"INVALID_INPUT"};var Pe="DocuviaError",l=class e extends Error{code;cause;constructor(t,n,o){super(n),this.name=Pe,this.code=t,this.cause=o}static wrap(t,n,o){if(o instanceof e)return o;let i=o instanceof Error?o.message:String(o);return new e(t,`${n}: ${i}`,o)}};var be={WORKSPACE_ROOT:"workspaceRoot",API_URL:"apiUrl",PROJECT_ID:"projectId",COMMIT_SHA:"commitSha",TARGET_PATH:"targetPath",LLM_BASE_URL:"llmBaseUrl",LLM_MODEL:"llmModel",BASE_REF:"baseRef",HEAD_REF:"headRef",TARGET:"target",ESCALATE_TO_LSP:"escalateToLsp",TIER_B_FULL_RESYNC:"tierBFullResync",LIMIT:"limit",EXPLAIN_RESOLUTION:"explainResolution",COLLAPSE:"collapse",KEEP_DB:"keepDb",LSP_BINARY_OVERRIDE:"lspBinaryOverride",LSP_ARGS_OVERRIDE:"lspArgsOverride",LSP_TIMEOUT_MS:"lspTimeoutMs",LSP_MAX_PROCESSES:"lspMaxProcesses",TIER_B_COMMIT_CAP:"tierBCommitCap",TIER_C_DAILY_CALL_CAP:"tierCDailyCallCap",TIER_C_DAILY_TOKEN_CAP:"tierCDailyTokenCap",TIER_C_WALL_CLOCK_MS:"tierCWallClockMs",TIER_C_ITEM_CAP:"tierCItemCap",TIER_C_LOAD_THRESHOLD:"tierCLoadThreshold",GIT_NETWORK_TIMEOUT_MS:"gitNetworkTimeoutMs",FORCE:"force",TIER_C_DRAIN_ALL:"tierCDrainAll",AGENT_AUTHORED_DECISIONS:"agentAuthoredDecisions",HOOK_NAME:"hookName",HOOK_ENABLED:"hookEnabled",FLUSH_STAGED_L3:"flushStagedL3"},Me={SCOPE_NOT_FOUND:(e,t)=>`Cannot set "${e}": memory scope "${t}" was never created`},m=class{scopes=new Map;createScope(t){this.scopes.has(t)||this.scopes.set(t,new Map)}set(t,n,o){let i=this.scopes.get(t);if(!i)throw new l(c.MEMORY_SCOPE_NOT_FOUND,Me.SCOPE_NOT_FOUND(n,t));i.set(n,o)}get(t,n){return this.scopes.get(t)?.get(n)}deleteScope(t){this.scopes.delete(t)}hasScope(t){return this.scopes.has(t)}},Fe=new m;var F={REGISTER_LOCKED:e=>`Cannot register "${e}": factory is locked (test isolation)`,PROVIDER_NOT_REGISTERED:e=>`No provider registered for "${e}" \u2014 the implementation library that owns it was never imported for its registration side effect`},S=class{providers=new Map;locked=!1;register(t,n){if(this.locked)throw new l(c.FACTORY_LOCKED,F.REGISTER_LOCKED(String(t.description)));this.providers.set(t,n)}resolve(t,n){let o=this.providers.get(t);if(!o)throw new l(c.FACTORY_TOKEN_NOT_REGISTERED,F.PROVIDER_NOT_REGISTERED(String(t.description)));return o(this,n)}has(t){return this.providers.has(t)}lock(){this.locked=!0}unlock(){this.locked=!1}reset(){this.providers.clear(),this.locked=!1}},k=new S;function r(e){return Symbol(e)}var ke={HostEnvironment:r("HostEnvironmentSnapshot"),GitProvider:r("IGitProvider"),LineBlameProvider:r("ILineBlameProvider"),KnowledgeGitService:r("IKnowledgeGitService"),FileDiscovery:r("IFileDiscovery"),ConfigScanner:r("IConfigScanner"),VcsScanner:r("IVcsScanner"),AstProcessor:r("IAstProcessor"),GraphPersister:r("IGraphPersister"),TempFileManager:r("TempFileManager"),GraphStoreOpener:r("GraphStoreOpener"),ProcessLock:r("ProcessLock"),RemoteSyncClient:r("RemoteSyncClient"),LlmClient:r("LlmClient"),QueryService:r("IQueryService"),TierBCoverageHintProvider:r("ITierBCoverageHintProvider"),ImpactService:r("IImpactService"),ChangeDetectionService:r("IChangeDetectionService"),TopologyBuilder:r("ITopologyBuilder"),SnapshotRenderer:r("ISnapshotRenderer"),HydrationService:r("IHydrationService"),DiagnosticRunnerDb:r("DiagnosticRunnerDb"),DiagnosticRunnerGit:r("DiagnosticRunnerGit"),SemanticDiffAnalyzer:r("ISemanticDiffAnalyzer"),SemanticCorpusService:r("ISemanticCorpusService"),SemanticDecisionValidator:r("ISemanticDecisionValidator"),SemanticDecisionProvider:r("ISemanticDecisionProvider"),CallResolutionHypothesisService:r("ICallResolutionHypothesisService"),EdgeResolutionProviders:r("EdgeResolutionProviders")};var Ue={ADDED:"added",MODIFIED:"modified",DELETED:"deleted",RENAMED:"renamed"};var we={LSP:"lsp",LLM_INFERRED:"llm-inferred"},He={TYPESCRIPT:"typescript",PYTHON:"python",GO:"go",RUST:"rust",JAVA:"java",CPP:"cpp",CSHARP:"csharp",PHP:"php",RUBY:"ruby"};var Ge={EDGE_RELATION:"edge-relation",IMPACT_RELEVANCE:"impact-relevance",NEEDS_VERIFICATION:"needs-verification"};var Ke={CANDIDATE:"candidate",UNKNOWN:"unknown",VERIFY:"verify"},Be=1,Ve={MAX_CANDIDATES:32,MAX_OPTIONS:34,MAX_INPUT_BYTES:32*1024},je={SCORED:"scored",UNAVAILABLE:"unavailable"},Ye={RAW:"raw",CALIBRATED:"calibrated"},Qe={MODEL_NOT_INSTALLED:"model-not-installed",UNSUPPORTED_CAPABILITY:"unsupported-capability"};var qe={NO_REMOTE:"no-remote",UP_TO_DATE:"up-to-date",FAST_FORWARDED_LOCAL:"fast-forwarded-local",PUSHED_LOCAL:"pushed-local",MERGED:"merged"};import{createHash as We}from"crypto";function Xe(e){let t=Je(e.filePath);if(!/^[a-f0-9]{64}$/.test(e.sourceContentHash))throw new Error("Call-site source content hash must be a lowercase SHA-256 hex digest");if(!Number.isSafeInteger(e.startLine)||e.startLine<0)throw new Error("Call-site start line must be a non-negative zero-based integer");if(!Number.isSafeInteger(e.startColumn)||e.startColumn<0)throw new Error("Call-site start column must be a non-negative zero-based integer");if(!U(e.calleeKind))throw new Error("Call-site callee kind must be a non-empty string without NUL bytes");if(!U(e.calleeName))throw new Error("Call-site callee name must be a non-empty string without NUL bytes");return`call-site:v1:${We("sha256").update([t,e.sourceContentHash,String(e.startLine),String(e.startColumn),e.calleeKind,e.calleeName].join("\0"),"utf8").digest("hex")}`}function Je(e){if(typeof e!="string")throw new Error("Call-site path must be a workspace-relative POSIX path");if([e.length===0,e.endsWith("/"),e.startsWith("/"),/^[a-zA-Z]:/.test(e),e.includes("\\"),e.includes("\0")].some(Boolean))throw new Error("Call-site path must be a workspace-relative POSIX path");let n=[];for(let o of e.split("/"))if(!(!o||o===".")){if(o!==".."){n.push(o);continue}if(n.length===0)throw new Error("Call-site path must be a workspace-relative POSIX path");n.pop()}if(n.length===0)throw new Error("Call-site path must be a workspace-relative POSIX path");return n.join("/")}function U(e){return typeof e=="string"&&e.trim().length>0&&!e.includes("\0")}var ze="declared-member-hypothesis-v7",$e="ordered-evidence-v1";var Ze="q1:named-import:v1",et="q2:reexport-trace:v1",tt="q3:super-call:v1",nt="q3:this-inherited:v1",ot="q3:typed-receiver:v1",rt="q3:new-receiver:v1";var it="17f29ba13f08a288186c7bdbed2651248664643f98613df8d3087aade7b4f768";var st={MODULE:"module",PACKAGE:"package",PCD:"pcd"},at={CONTAINS:"contains",CALLS:"calls",IMPLEMENTS:"implements",EXTENDS:"extends",IMPORTS:"imports",DEPENDS_ON:"depends_on",DECISION:"decision"},L={CHANGE:"change",RULE:"rule",DECISION:"decision",CONTEXT:"context"},lt={PENDING:"pending",ACTIVE:"active",DRAFT:"draft",GARBAGE:"garbage"},ct={ANALYZE:"analyze",AGENT_AUTHORED:"agent-authored"},dt={PROVEN:"proven",LIKELY:"likely",AMBIGUOUS:"ambiguous",UNRESOLVED:"unresolved",EXTERNAL:"external",UNSUPPORTED:"unsupported"},pt={TIER_B_TARGET_MISMATCH:"tier-b-target-mismatch"},ut={UNVERIFIED:"unverified",VERIFIED:"verified",CONTRADICTED:"contradicted"},gt="sha256-callsite-rule-v2",yt={SCOPE_RESOLVER:"scope-resolver",STRICT_PROOF:"strict-proof",HYPOTHESIS:"hypothesis",TIER_B:"tier-b"};var mt=L,St={AUTO_FULL_INGESTION:"autoFullIngestion",AUTO_DELTA:"autoDelta",AUTO_DELTA_NOOP:"autoDeltaNoop",DECISION_EXTRACTION:"decisionExtraction",TIER_B_BATCH:"tierBBatch",FLUSH_STAGED_L3:"flushStagedL3"},Et={NO_GRAPH:"no-graph",ANCHOR_NOT_IN_GRAPH:"anchor-not-in-graph"};var _t={CREATE_L3:"CREATE_L3"};var Rt={SYSTEM:"system",USER:"user",ASSISTANT:"assistant",TOOL:"tool"},Ct="function";var ft={LOW:"LOW",MEDIUM:"MEDIUM",HIGH:"HIGH",CRITICAL:"CRITICAL",UNKNOWN:"UNKNOWN"},At={EXACT:"exact",LOWER_BOUND:"lower-bound"},Tt={BOUNDED:"bounded",UNRESOLVED:"unresolved"},It={DYNAMIC_IMPORT:"dynamic-import"},Lt={CORRUPT_JSON:"corrupt-json",NOT_ARRAY:"not-array",INVALID_RECORD:"invalid-record",MISSING:"missing",INCOMPLETE_SCAN:"incomplete-scan"},Nt={AVAILABLE:"available",UNAVAILABLE:"unavailable"},Ot={LSP_FALLBACK:"lsp-fallback",DYNAMIC_CANDIDATE:"dynamic-candidate"};var ht={L2:"l2",L3:"l3"};var Dt={FILE:"file",SYMBOL:"symbol",DECISION:"decision"},vt={AUTO:"auto",FILE:"file",SYMBOL:"symbol"},xt={L1_TAG:"l1_tag",DIRECTORY:"directory"};var E={COMMIT_MESSAGE:"commitMessage",CONTRACT_SYMBOL:"contractSymbol"};function Pt(e){if(e===void 0)return kt();let t;try{t=JSON.parse(e)}catch{return w()}if(!Array.isArray(t))return w();let n=[],o=0;for(let i of t)bt(i)?n.push(i):o++;return{entries:n,invalidCount:o,corrupt:!1}}function bt(e){return!Mt(e)||typeof e.target!="string"||typeof e.commitSha!="string"||!Ft(e)?!1:e.kind===E.COMMIT_MESSAGE?typeof e.message=="string":e.kind===E.CONTRACT_SYMBOL?typeof e.file=="string":!1}function Mt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ft(e){return e.failCount===void 0||typeof e.failCount=="number"&&Number.isInteger(e.failCount)&&e.failCount>=0}function kt(){return{entries:[],invalidCount:0,corrupt:!1}}function w(){return{entries:[],invalidCount:0,corrupt:!0}}var Ut={TYPESCRIPT:"typescript",REACT:"react",EXPRESS:"express",VUE:"vue"},wt={UNKNOWN:"unknown",JAVASCRIPT:"javascript",GENERIC:"generic",RUST:"rust",PYTHON:"python",GO:"go"},Ht="general",Gt={FRONTEND:"frontend",BACKEND:"backend",NEXTJS:"nextjs",SSR:"ssr",DRIZZLE:"drizzle",DATABASE:"database",TAILWINDCSS:"tailwindcss",CSS:"css",JEST:"jest",TESTING:"testing",VITEST:"vitest",POSTGRES:"postgres",MONOREPO:"monorepo",TOKIO:"tokio",ASYNC:"async",ACTIX:"actix",SERDE:"serde",TAURI:"tauri",DESKTOP:"desktop",DJANGO:"django",FASTAPI:"fastapi",PANDAS:"pandas",DATA:"data",GIN:"gin",STRICT_TS:"strict-ts",VITE:"vite",BUILD_TOOL:"build-tool"};var H="origin",N={KNOWLEDGE_ROOT:"docuvia-knowledge",KNOWLEDGE_LOG_SCAN_LIMIT:5e3,KNOWLEDGE_DIR_NAME:"knowledge",GRAPH_DIR_NAME:"graph",L3_DIR_NAME:"_l3",NODES_JSONL_NAME:"nodes.jsonl",EDGES_JSONL_NAME:"edges.jsonl",METADATA_JSON_NAME:"metadata.json",SOURCE_COMMIT_TRAILER_KEY:"Docuvia-Source",POST_COMMIT_HOOK_NAME:"post-commit",POST_COMMIT_HOOK_MARKER:"docuvia analyze",POST_COMMIT_FLUSH_L3_MARKER:"docuvia analyze --flush-staged-l3",POST_COMMIT_NOHUP_MARKER:"nohup npx --no-install docuvia analyze",DOCUVIA_HOOK_HEADER_COMMENT:"# Docuvia Knowledge Graph Evolver Hook",POST_COMMIT_HOOK_CONTENT:`#!/bin/bash
|
|
3
3
|
# Docuvia Knowledge Graph Evolver Hook
|
|
4
4
|
# Non-intrusively extracts AST deltas in the background
|
|
5
5
|
if command -v npx > /dev/null 2>&1; then
|
|
@@ -94,6 +94,6 @@ fi
|
|
|
94
94
|
# Never blocks the push on a Tier B failure -- PLAT-007's reliability requirement (failures
|
|
95
95
|
# only ever surface via JSONL logs / doctor, never to the pushing developer).
|
|
96
96
|
exit 0
|
|
97
|
-
`,META_KEY_TIER_C_QUEUE:"tierCQueue",META_KEY_TIER_C_BUDGET:"tierCBudget",DEFAULT_TIER_C_DAILY_CALL_CAP:50,DEFAULT_TIER_C_DAILY_TOKEN_CAP:1e5,DEFAULT_TIER_C_WALL_CLOCK_MS:12e3,DEFAULT_TIER_C_ITEM_CAP:20,DEFAULT_TIER_C_LOAD_THRESHOLD:.8,DEFAULT_TIER_C_MAX_ITEM_FAILURES:3};import _ from"path";var
|
|
98
|
-
`)){let n=t.trim();if(n.startsWith($))return n.slice($.length).trim()}}function
|
|
99
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
`,META_KEY_TIER_C_QUEUE:"tierCQueue",META_KEY_TIER_C_BUDGET:"tierCBudget",DEFAULT_TIER_C_DAILY_CALL_CAP:50,DEFAULT_TIER_C_DAILY_TOKEN_CAP:1e5,DEFAULT_TIER_C_WALL_CLOCK_MS:12e3,DEFAULT_TIER_C_ITEM_CAP:20,DEFAULT_TIER_C_LOAD_THRESHOLD:.8,DEFAULT_TIER_C_MAX_ITEM_FAILURES:3};import _ from"path";var G=[".ts",".tsx",".mts",".cts"],K=[".js",".jsx",".mjs",".cjs"],B=[".py"],V=[".rs"],j=[".go"],Y=[".java"],Q=[".c",".h"],q=[".cpp",".cxx",".cc",".hpp",".hxx",".hh",".cu",".cuh"],W=[".rb",".rake",".gemspec"],X=[".php",".phtml",".php3",".php4",".php5",".phps"],J=[".cs"],O=new Set(["Rakefile","Gemfile","Guardfile","Vagrantfile","Brewfile"]),h=(()=>{let e=new Map,t=[[s.TYPESCRIPT,G],[s.JAVASCRIPT,K],[s.PYTHON,B],[s.RUST,V],[s.GO,j],[s.JAVA,Y],[s.C,Q],[s.CPP,q],[s.RUBY,W],[s.PHP,X],[s.CSHARP,J]];for(let[n,o]of t)for(let i of o)e.set(i,n);return e})();function Kt(e){let t=h.get(_.extname(e).toLowerCase());return t||(O.has(_.basename(e))?s.RUBY:void 0)}function z(e){return h.has(_.extname(e).toLowerCase())?!0:O.has(_.basename(e))}function Bt(){return Array.from(h.keys()).map(e=>e.replace(/^\./,""))}function Vt(e){return!T(e)&&z(e)&&!e.includes(`${A}/`)&&!e.includes(`${f}/`)}var jt="call-sites.jsonl";var Yt="call-resolutions.jsonl",Qt="impact.dynamic-dependencies.v1:",qt="snapshot.call-sites.availability.v1:",Wt={AVAILABLE:"available",UNAVAILABLE:"unavailable"},Xt="snapshot-call-sites-unavailable",Jt="snapshot.call-resolutions.availability.v1:",zt={AVAILABLE:"available",UNAVAILABLE:"unavailable"};var $t={TIMED_OUT_WAITING:e=>`Timed out waiting for the lock at ${e} \u2014 another process may be stuck`},D=class extends Error{constructor(t){super($t.TIMED_OUT_WAITING(t)),this.name="ProcessLockTimeoutError"}};var $=`${N.SOURCE_COMMIT_TRAILER_KEY}: `;function Zt(e){for(let t of e.split(`
|
|
98
|
+
`)){let n=t.trim();if(n.startsWith($))return n.slice($.length).trim()}}function en(e,t,n,o){if(!n&&!o)return;let u=(t?e.files.getTierBFileStatus(t):void 0)?.lastProcessedAt??null,Z=o&&u===null,g=e.files.getTierBCoverage(),ee=n&&g.processedFiles<g.totalFiles;if(!(!Z&&!ee))return{ownFileLastProcessedAt:u,workspaceFilesProcessed:g.processedFiles,workspaceFilesTotal:g.totalFiles}}function tn(e){let t={total:0,resolved:0,selfDiscarded:0,unresolved:0,unresolvable:0,external:0,unknownReceiver:0};for(let n of Object.values(e))t.total+=n.total,t.resolved+=n.resolved,t.selfDiscarded+=n.selfDiscarded,t.unresolvable=(t.unresolvable??0)+(n.unresolvable??0),t.external=(t.external??0)+(n.external??0),t.unknownReceiver=(t.unknownReceiver??0)+(n.unknownReceiver??0),t.unresolved+=n.unresolved;return t}function nn(e){return e.total-e.selfDiscarded-(e.unresolvable??0)-(e.external??0)-(e.unknownReceiver??0)}var on={PASS:"pass",FAIL:"fail"};export{a,p as b,xe as c,C as d,I as e,c as f,l as g,be as h,Fe as i,k as j,ke as k,Ue as l,we as m,He as n,Ge as o,Ke as p,Be as q,Ve as r,je as s,Ye as t,Qe as u,qe as v,Xe as w,ze as x,$e as y,Ze as z,et as A,tt as B,nt as C,ot as D,rt as E,it as F,st as G,at as H,lt as I,ct as J,dt as K,pt as L,ut as M,gt as N,yt as O,mt as P,St as Q,Et as R,_t as S,Rt as T,Ct as U,ft as V,At as W,Tt as X,It as Y,Lt as Z,Nt as _,Ot as $,ht as aa,Dt as ba,vt as ca,xt as da,y as ea,ne as fa,E as ga,Pt as ha,f as ia,oe as ja,re as ka,ie as la,se as ma,ae as na,le as oa,ce as pa,de as qa,pe as ra,ue as sa,ge as ta,ye as ua,me as va,A as wa,Se as xa,Ee as ya,_e as za,Re as Aa,Ce as Ba,fe as Ca,Ut as Da,wt as Ea,Ht as Fa,Gt as Ga,Ae as Ha,Te as Ia,H as Ja,N as Ka,s as La,x as Ma,P as Na,b as Oa,M as Pa,T as Qa,G as Ra,K as Sa,B as Ta,V as Ua,j as Va,Y as Wa,Q as Xa,q as Ya,W as Za,X as _a,J as $a,O as ab,Kt as bb,z as cb,Bt as db,Vt as eb,jt as fb,Yt as gb,Qt as hb,qt as ib,Wt as jb,Xt as kb,Jt as lb,zt as mb,Le as nb,Ne as ob,Oe as pb,he as qb,De as rb,ve as sb,D as tb,Zt as ub,en as vb,tn as wb,nn as xb,on as yb};
|
|
99
|
+
//# sourceMappingURL=chunk-RRS2FFZT.js.map
|