@precisionutilityguild/liquid-shadow 1.0.7 → 1.0.9

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.
@@ -1,6 +1,6 @@
1
- import Ae from"fs";function he(e){let t=e.split(`
2
- `),i=[],n=0;for(let s of t)i.push(n),n+=s.length+1;return i}function P(e,t){for(let i=0;i<t.length;i++)if(t[i+1]>e||i===t.length-1)return i+1;return 1}function te(e,t){return t.slice(0,e).toString("utf8").length}function ge(e){if(e.toString("utf8").length===e.length)return n=>n;let i=new Map;return n=>{let s=i.get(n);return s===void 0&&(s=e.slice(0,n).toString("utf8").length,i.set(n,s)),s}}function be(e,t,i){let n=e.start-t,s=e.end-t;return n<0||s>i.length?"":i.slice(n,s).toString("utf8")}function xe(e){let t=[],i=/\/\*\*[\s\S]*?\*\//g,n;for(;(n=i.exec(e))!==null;)t.push({start:n.index,end:n.index+n[0].length,text:n[0]});return t}function F(e,t,i){for(let n of t){if(n.start===e)return n.text;if(n.start>e&&n.start<e+50){let s=i.substring(e,n.start);if(/^\s*$/.test(s))return n.text}if(n.end<=e&&n.end>e-50){let s=i.substring(n.end,e);if(/^\s*$/.test(s))return n.text}}return""}function De(e){if(!e)return"";let i=e.replace(/\/\*\*|\*\/|\*/g,"").trim().split(`
3
- `)[0].trim();return i.length>200?i.substring(0,197)+"...":i}function ne(e,t,i){let n=e.toLowerCase(),s=t.toLowerCase();return n.includes("components/")||n.endsWith(".tsx")?"Component":n.startsWith("use")||s.startsWith("use")?"Hook":n.includes("models/")||s.endsWith("model")?"Model":n.includes("services/")||n.includes("controllers/")||n.includes("handlers/")||n.includes("mcp/")||n.endsWith("service.ts")||n.endsWith("controller.ts")||n.endsWith("handler.ts")||s.endsWith("service")||s.endsWith("controller")||s.endsWith("handler")?"Service":n.includes("repositories/")||n.includes("repos/")||n.endsWith("repository.ts")||n.endsWith("repo.ts")||s.endsWith("repository")||s.endsWith("repo")?"Repository":i==="TsInterfaceDeclaration"||i==="TsTypeAliasDeclaration"?"Type Definition":"Other"}function Q(e){let t=[];return/\b(fetch|axios|superagent|got)\s*\(|import\s+.*\b(http|https|node-fetch)\b/i.test(e)&&t.push("Network"),(/\b(knex|prisma|typeorm|mongoose|sequelize|pg|mysql|sqlite3)\b/i.test(e)||/\b(SELECT\s+.*FROM|INSERT\s+INTO|UPDATE\s+.*SET|DELETE\s+FROM)\b/i.test(e)||/\.query\s*\(|\.execute\s*\(/i.test(e)&&/db|database|client|pool/i.test(e))&&t.push("Database"),(/\bfs\./i.test(e)||/\b(readFileSync|writeFileSync|readFile|writeFile|readdir)\b/.test(e)||/import\s+.*\bfs\b/.test(e))&&t.push("File System"),(/\b(localStorage|sessionStorage|indexedDB)\./.test(e)||/\bdocument\.cookie\b/.test(e))&&t.push("Browser Storage"),t}function N(e,t){if(!e)return"";let i=e.trimStart();for(;/^\/\*[\s\S]*?\*\//.test(i);)i=i.replace(/^\/\*[\s\S]*?\*\/\s*/,"");for(;/^\/\/[^\n]*\n/.test(i);)i=i.replace(/^\/\/[^\n]*\n\s*/,"");if(i=i.replace(/^(?:import[^\n]*\n)+/,"").replace(/^(?:export\s+\{[^}]*\}\s+from\s+['"][^'"]+['"];?\s*\n?)+/,"").trim(),t==="TsInterfaceDeclaration"||t==="TsTypeAliasDeclaration")return i;let n=0,s=0,u=i.length;for(let h=0;h<i.length;h++){let S=i[h];if(S==="(")n++;else if(S===")")n--;else if(S==="<")s++;else if(S===">")s--;else if(S==="{"){if(n===0&&s===0){u=h;break}}else if(S===";"&&n===0&&s===0){u=h;break}else if(S==="="&&i[h+1]===">"&&n===0&&s===0){u=h+2;break}}let d=i.substring(0,u).trim();return d.length>500?d.slice(0,497)+"...":d}function Se(e){let t=[];for(let i of e)i.type==="ImportDeclaration"&&t.push({module:i.source.value,name:i.specifiers.map(n=>n.type==="ImportDefaultSpecifier"?"default":n.type==="ImportNamespaceSpecifier"?"*":n.local?.value||n.imported?.value||"*").join(", ")}),i.type==="ExportAllDeclaration"&&t.push({module:i.source.value,name:"*"}),i.type==="ExportNamedDeclaration"&&i.source&&t.push({module:i.source.value,name:i.specifiers.map(n=>n.type==="ExportSpecifier"?n.orig.value:"*").join(", ")});return t}function $e(e,t){for(let i of e){if((i.type==="FunctionDeclaration"||i.type==="ClassDeclaration")&&(i.identifier?.value||i.id?.value)===t)return i.span;if(i.type==="VariableDeclaration"){for(let n of i.declarations)if(n.id?.type==="Identifier"&&n.id.value===t)return n.span||i.span}if((i.type==="TsTypeAliasDeclaration"||i.type==="TsInterfaceDeclaration"||i.type==="TsEnumDeclaration")&&(i.id?.value||i.identifier?.value)===t)return i.span;if(i.type==="ExportDeclaration"){let n=i.declaration;if(!n)continue;if((n.type==="FunctionDeclaration"||n.type==="ClassDeclaration")&&(n.identifier?.value||n.id?.value)===t)return n.span||i.span;if(n.type==="VariableDeclaration"){for(let s of n.declarations)if(s.id?.type==="Identifier"&&s.id.value===t)return s.span||n.span||i.span}}}return null}function ve(e,t,i,n,s,u,d,h,S){let o=S??(a=>te(a,i)),l=[];for(let a of e){if(a.type==="ExportDeclaration"){let p=a.declaration,f=p.type,r="";f==="VariableDeclaration"?r=p.declarations.map(M=>M.id.value).join("",""):r=p.id?.value||p.identifier?.value||"anonymous";let c=o(a.span.start-t),y=o(a.span.end-t),m=F(c,u,n),g=h(a.span),T=[];if(a.type==="ExportDeclaration"&&(f==="ClassDeclaration"||f==="ClassExpression")){let M=p.body||[];for(let w of M)if(w.type==="ClassMethod"||w.type==="ClassProperty"){let A=w.key.value;if(!A)continue;let E=o(w.span.start-t),U=o(w.span.end-t),I=h(w.span),R=F(E,u,n);T.push({name:A,kind:w.type,signature:N(I,w.type),line:P(E,s),endLine:P(U,s),doc:R,classification:w.type==="ClassMethod"?"Method":"Property",capabilities:"[]"})}}else if(f==="FunctionDeclaration"&&p.body?.type==="BlockStatement")T=ue(p.body.stmts,t,i,n,s,u,h,o);else if(f==="VariableDeclaration"){for(let M of p.declarations)if(M.init&&(M.init.type==="ArrowFunctionExpression"||M.init.type==="FunctionExpression")&&M.init.body?.type==="BlockStatement"){T=ue(M.init.body.stmts,t,i,n,s,u,h,o);break}}l.push({name:r,kind:f,signature:N(g,f),line:P(c,s),endLine:P(y,s),doc:m,classification:ne(d,r,f),capabilities:JSON.stringify(Q(g)),members:T})}if(a.type==="ExportNamedDeclaration"){for(let p of a.specifiers)if(p.type==="ExportSpecifier"){let f=p.orig.value,r=p.exported?.value||f,y=$e(e,f)||a.span,m=o(y.start-t),g=o(y.end-t),T=F(m,u,n);l.push({name:r,kind:"ExportSpecifier",signature:`export { ${f} }`,line:P(m,s),endLine:P(g,s),doc:T,classification:"Export mapping",capabilities:"[]"})}}if(a.type==="ExportDefaultDeclaration"){let p=o(a.span.start-t),f=o(a.span.end-t),r=F(p,u,n),c=h(a.span),y=[];if(a.decl.type==="ClassExpression"||a.decl.type==="ClassDeclaration"){let m=a.decl.body||[];for(let g of m)if(g.type==="ClassMethod"||g.type==="ClassProperty"){let T=g.key.value;if(!T)continue;let M=o(g.span.start-t),w=o(g.span.end-t),A=h(g.span),E=F(M,u,n);y.push({name:T,kind:g.type,signature:N(A,g.type),line:P(M,s),endLine:P(w,s),doc:E,classification:g.type==="ClassMethod"?"Method":"Property",capabilities:"[]"})}}else(a.decl.type==="FunctionExpression"||a.decl.type==="FunctionDeclaration"||a.decl.type==="ArrowFunctionExpression")&&a.decl.body?.type==="BlockStatement"&&(y=ue(a.decl.body.stmts,t,i,n,s,u,h,o));l.push({name:"default",kind:"DefaultExport",signature:N(c,"DefaultExport"),line:P(p,s),endLine:P(f,s),doc:r,classification:"Default Export",capabilities:JSON.stringify(Q(c)),members:y})}if(a.type==="ExportAllDeclaration"){let p=o(a.span.start-t),f=o(a.span.end-t),r=a.source.value,c=F(p,u,n);l.push({name:"*",kind:"ExportAllDeclaration",signature:`export * from "${r}"`,line:P(p,s),endLine:P(f,s),doc:c,classification:"Re-export",capabilities:"[]"})}}return l}function ue(e,t,i,n,s,u,d,h){let S=[];for(let o of e){if(o.type==="VariableDeclaration")for(let l of o.declarations){let a=[],p=r=>{if(r.type==="Identifier")a.push({name:r.value,span:r.span});else if(r.type==="ArrayPattern")for(let c of r.elements)c&&p(c);else if(r.type==="ObjectPattern")for(let c of r.properties)c.type==="AssignmentPatternProperty"?a.push({name:c.key.value,span:c.span}):c.type==="KeyValuePatternProperty"&&p(c.value)};p(l.id);let f=l.init&&(l.init.type==="ArrowFunctionExpression"||l.init.type==="FunctionExpression");for(let r of a){let c=f?l.init.span||l.span||r.span:l.span||r.span,y=f?l.init.type:"VariableDeclaration",m=f?"Internal Function":"Internal Variable",g=h(c.start-t),T=h(c.end-t),M=d(c),w=F(g,u,n);S.push({name:r.name,kind:y,signature:N(M,y),line:P(g,s),endLine:P(T,s),doc:w,classification:m,capabilities:"[]"})}}if(o.type==="FunctionDeclaration"){let l=o.identifier?.value||o.ident?.value||"anonymous",a=h(o.span.start-t),p=h(o.span.end-t),f=d(o.span),r=F(a,u,n);S.push({name:l,kind:"FunctionDeclaration",signature:N(f,"FunctionDeclaration"),line:P(a,s),endLine:P(p,s),doc:r,classification:"Internal Function",capabilities:"[]"})}if(o.type==="ReturnStatement"&&o.argument?.type==="ObjectExpression")for(let l of o.argument.properties){let a="",p=l.span||l.key?.span||l.ident?.span;if(l.type==="KeyValueProperty"){let f=l.key;a=f?.value||f?.raw||(f?.type==="Identifier"?f.value:"")}else l.type==="MethodProperty"?a=l.key?.value||l.key?.raw||"":l.type==="ShorthandProperty"?a=l.ident?.value||"":l.type==="Identifier"&&(a=l.value||"");if(a&&p){let f=h(p.start-t),r=h(p.end-t),c=d(p),y=F(f,u,n);S.push({name:a,kind:"ReturnProperty",signature:N(c,"ReturnProperty"),line:P(f,s),endLine:P(r,s),doc:y,classification:"Return Member",capabilities:"[]"})}}if(o.type==="ExpressionStatement"&&o.expression.type==="CallExpression"){let l=o.expression;if(l.callee.type==="MemberExpression"&&(l.callee.property?.value==="on"||l.callee.property?.value==="once")){let a=l.arguments[0]?.expression?.value,p=l.arguments[1]?.expression;if(a&&p&&(p.type==="ArrowFunctionExpression"||p.type==="FunctionExpression")){let f=h(p.span.start-t),r=h(p.span.end-t),c=d(p.span);S.push({name:`on:${a}`,kind:p.type,signature:N(c,p.type),line:P(f,s),endLine:P(r,s),doc:"",classification:"Event Handler",capabilities:"[]"})}}if(l.callee.type==="Identifier"&&l.callee.value==="addRoute"&&l.arguments.length>=3){let a=l.arguments[2].expression;if(a.type==="StringLiteral"){let p=a.value,f=h(l.span.start-t),r=h(l.span.end-t),c=d(l.span);S.push({name:p,kind:"HTTP Route",signature:N(c,"HTTP Route"),line:P(f,s),endLine:P(r,s),doc:"",classification:"Service Boundary",capabilities:JSON.stringify({path:p})})}}}}return S}function Te(e,t,i,n,s,u){let d=u??(o=>te(o,i)),h=[];function S(o){if(!(!o||typeof o!="object")){if(o.type==="CallExpression"){let l=Fe(o);if(l){let a=d(o.span.start-t);h.push({...l,line:P(a,n),snippet:s(o.span)})}}for(let l of Object.keys(o)){if(l==="span")continue;let a=o[l];Array.isArray(a)?a.forEach(S):typeof a=="object"&&S(a)}}}return e.forEach(S),h}function Fe(e){let{callee:t,arguments:i}=e;if(!i||i.length===0)return null;if(t.type==="Identifier"&&t.value,t.type==="Identifier"&&t.value==="addRoute"&&i.length>=3){let n=i[2].expression;if(n.type==="StringLiteral")return{type:"api_route",name:n.value,direction:"consume"}}if(t.type==="MemberExpression"&&t.property?.type==="Identifier"){let n=t.property.value;if(n==="emit"&&i[0].expression.type==="StringLiteral")return{type:"socket_event",name:i[0].expression.value,direction:"produce"};if(n==="on"&&i[0].expression.type==="StringLiteral")return{type:"socket_event",name:i[0].expression.value,direction:"consume"};if(["get","post","put","delete","patch"].includes(n)&&i[0].expression.type==="StringLiteral"){let u=i[0].expression.value,d=t.object.type==="Identifier"?t.object.value:"";if(["axios","http","request","appApi","restApi","adminApi","client"].includes(d))return{type:"api_route",name:u,direction:"produce"};if(u.startsWith("/"))return{type:"api_route",name:u,direction:"consume"}}}return t.type==="Identifier"&&t.value==="fetch"&&i[0].expression.type==="StringLiteral"?{type:"api_route",name:i[0].expression.value,direction:"produce"}:null}function X(e){let{classification:t,capabilities:i,exports:n,fileName:s}=e,u={Network:"API integration",Database:"data persistence","File System":"file I/O operations","Browser Storage":"client-side storage"},d=i.map(r=>u[r]).filter(Boolean).join(" and "),S={Component:(r,c)=>{let y=c.find(g=>g.kind==="FunctionDeclaration"||g.kind==="ClassDeclaration")?.name,m=y?`React component: ${y}`:"React UI component";return r?`${m} with ${r}`:m},Hook:(r,c)=>{let y=c.find(g=>g.name.startsWith("use"))?.name,m=y?`Custom React hook: ${y}`:"Custom React hook";return r?`${m} for ${r}`:m},Service:(r,c)=>{let m=`Service layer: ${c[0]?.name||"Service"}`;return r?`${m} handling ${r}`:m},Repository:(r,c)=>`Data repository: ${c[0]?.name||"Repository"} for ${r||"data access"}`,"Type Definition":(r,c)=>`Type definitions: ${c.slice(0,3).map(m=>m.name).join("")}${c.length>3?"...":""}`,Model:(r,c)=>`Data model: ${c[0]?.name||"Model"}`,"HTTP Route":(r,c)=>{let y=c.filter(m=>m.classification==="Service Boundary");return y.length>0?`API endpoints: ${y.slice(0,3).map(m=>m.name).join("")}`:"API route handler"},"Micro IR (PHP)":(r,c)=>{let y=c.some(g=>g.classification==="Service Boundary"),m=c.find(g=>g.kind==="ClassDeclaration")?.name;return y?"PHP controller with API routes":m?`PHP class: ${m}`:"PHP module"},"Micro IR (Python)":(r,c)=>{let y=c.some(g=>g.classification==="Service Boundary"),m=c.find(g=>g.kind==="ClassDeclaration")?.name;return y?"Python API handler with routes":m?`Python class: ${m}`:"Python module"},"Micro IR (Go/TS) ":(r,c)=>{let y=c.some(g=>g.kind==="TypeDeclaration"),m=c.filter(g=>g.kind==="FunctionDeclaration");return y&&m.length>0?`Go package: types and ${m.length} function(s)`:y?"Go package: type definitions":m.length>0?`Go package: ${m[0].name} and ${m.length} function(s)`:"Go module"},"Micro IR (Rust/TS) ":(r,c)=>{let y=c.find(T=>T.kind==="TraitDeclaration")?.name,m=c.find(T=>T.kind==="StructDeclaration")?.name,g=c.filter(T=>T.kind==="FunctionDeclaration");return y?r.includes("Rust trait")?`Rust module: trait ${y}`:`Rust module: ${y}`:m?`Rust module: struct ${m}`:g.length>0?`Rust module: ${g.length} function(s)`:"Rust module"}}[t];if(S)return S(d,n);if(n.length===0)return s?`Module: ${s}`:"Module with no exports";let o=n.filter(r=>r.kind==="FunctionDeclaration"),l=n.filter(r=>r.kind==="ClassDeclaration"),a=n.filter(r=>r.kind==="TsInterfaceDeclaration"||r.kind==="TsTypeAliasDeclaration"),p=[];if(l.length>0&&p.push(`Class: ${l[0].name}`),o.length>0){let r=o.slice(0,2).map(c=>c.name).join("");p.push(`Functions: ${r}`)}a.length>0&&p.push(`Types: ${a.length}`);let f=p.length>0?p.join(" | "):`Module with ${n.length} export(s)`;return d?`${f} \u2014 ${d}`:f}function Re(e){let t=new Set;function i(n){if(!(!n||typeof n!="object")){n.typeAnnotation&&k(n.typeAnnotation,t),(n.type==="TsTypeReference"||n.type==="TsTypeAnnotation")&&k(n,t);for(let s in n){if(s==="span"||s==="comments"||s==="interpreter")continue;let u=n[s];u&&typeof u=="object"&&(Array.isArray(u)?u.forEach(i):i(u))}}}return e.forEach(n=>i(n)),Array.from(t)}function k(e,t){if(e){if(e.type==="TsTypeAnnotation"){k(e.typeAnnotation,t);return}e.type==="TsTypeReference"&&(e.typeName?.type==="Identifier"&&t.add(e.typeName.value),e.typeName?.type==="TsQualifiedName"&&Ce(e.typeName,t),e.typeParams&&k(e.typeParams,t)),e.type==="TsArrayType"&&k(e.elementType,t),e.type==="TsUnionType"&&e.types?.forEach(i=>k(i,t)),e.type==="TsIntersectionType"&&e.types?.forEach(i=>k(i,t)),e.type==="TsTupleType"&&e.elemTypes?.forEach(i=>k(i.ty,t)),(e.type==="TsFunctionType"||e.type==="TsConstructorType")&&(e.params?.forEach(i=>k(i.typeAnnotation,t)),e.typeAnnotation&&k(e.typeAnnotation,t)),e.type==="TsTypeParameterDeclaration"&&e.params?.forEach(i=>{i.constraint&&k(i.constraint,t),i.default&&k(i.default,t)}),e.type==="TsTypeParameterInstantiation"&&e.params?.forEach(i=>k(i,t)),e.type==="TsMappedType"&&e.typeAnnotation&&k(e.typeAnnotation,t),e.type==="TsIndexedAccessType"&&(k(e.objectType,t),k(e.indexType,t)),e.type==="TsConditionalType"&&(k(e.checkType,t),k(e.extendsType,t),k(e.trueType,t),k(e.falseType,t)),e.type==="TsTypeLiteral"&&e.members?.forEach(i=>{i.typeAnnotation&&k(i.typeAnnotation,t)})}}function Ce(e,t){e.type==="TsQualifiedName"?(e.left&&Ce(e.left,t),e.right?.value&&t.add(e.right.value)):e.type==="Identifier"&&t.add(e.value)}import Le from"path";import fe from"path";import ke from"path";import He from"fs";import{fileURLToPath as Ue}from"url";import*as H from"web-tree-sitter";import Ne from"pino";var We={10:"TRACE",20:"DEBUG",30:"INFO",40:"WARN",50:"ERROR",60:"FATAL"},ze=Ne({level:process.env.LOG_LEVEL||"warn",base:{service:"liquid-shadow"},formatters:{level(e,t){return{level:e,severity:We[t]??"INFO"}}},transport:{target:"pino-pretty",options:{colorize:!0,translateTime:"HH:MM:ss",destination:2,levelKey:"severity",messageKey:"message"}}}),O=ze;import{fileURLToPath as Be}from"node:url";import{dirname as me,join as Pe,resolve as Ze}from"node:path";import{existsSync as je}from"node:fs";var Je=Be(import.meta.url),we=me(Je);function Oe(){let e=we;for(;e!==me(e);){if(je(Pe(e,"package.json")))return e;e=me(e)}return Ze(we,"..","..")}function Me(...e){return Pe(Oe(),...e)}var St=ke.dirname(Ue(import.meta.url)),Ee=O.child({module:"parser:tree-sitter"}),ie=class{parser=null;languages=new Map;async ensureInitialized(){if(this.parser)return;let t=H.Parser||H;await t.init(),this.parser=new t}async getLanguage(t){if(this.languages.has(t))return this.languages.get(t);let i=Me("resources","grammars",`tree-sitter-${this.getLangName(t)}.wasm`);if(!He.existsSync(i))return Ee.warn({grammarPath:i},"Grammar WASM not found"),null;try{let n=await H.Language.load(i);return this.languages.set(t,n),n}catch(n){return Ee.error({err:n,ext:t},"Failed to load language grammar"),null}}getLangName(t){switch(t.toLowerCase()){case".php":return"php";case".py":return"python";case".go":return"go";case".rs":return"rust";default:return""}}getQueries(t){switch(t.toLowerCase()){case".php":return`
1
+ import ot from"fs";function Je(t){let n=t.split(`
2
+ `),i=[],e=0;for(let s of n)i.push(e),e+=s.length+1;return i}function E(t,n){for(let i=0;i<n.length;i++)if(n[i+1]>t||i===n.length-1)return i+1;return 1}function De(t,n){return n.slice(0,t).toString("utf8").length}function qe(t){if(t.toString("utf8").length===t.length)return e=>e;let i=new Map;return e=>{let s=i.get(e);return s===void 0&&(s=t.slice(0,e).toString("utf8").length,i.set(e,s)),s}}function He(t,n,i){let e=t.start-n,s=t.end-n;return e<0||s>i.length?"":i.slice(e,s).toString("utf8")}function Ue(t){let n=[],i=/\/\*\*[\s\S]*?\*\//g,e;for(;(e=i.exec(t))!==null;)n.push({start:e.index,end:e.index+e[0].length,text:e[0]});return n}function V(t,n,i){for(let e of n){if(e.start===t)return e.text;if(e.start>t&&e.start<t+50){let s=i.substring(t,e.start);if(/^\s*$/.test(s))return e.text}if(e.end<=t&&e.end>t-50){let s=i.substring(e.end,t);if(/^\s*$/.test(s))return e.text}}return""}function Ve(t){if(!t)return"";let i=t.replace(/\/\*\*|\*\/|\*/g,"").trim().split(`
3
+ `)[0].trim();return i.length>200?i.substring(0,197)+"...":i}function ve(t,n,i){let e=t.toLowerCase(),s=n.toLowerCase();return e.includes("components/")||e.endsWith(".tsx")?"Component":e.startsWith("use")||s.startsWith("use")?"Hook":e.includes("models/")||s.endsWith("model")?"Model":e.includes("services/")||e.includes("controllers/")||e.includes("handlers/")||e.includes("mcp/")||e.endsWith("service.ts")||e.endsWith("controller.ts")||e.endsWith("handler.ts")||s.endsWith("service")||s.endsWith("controller")||s.endsWith("handler")?"Service":e.includes("repositories/")||e.includes("repos/")||e.endsWith("repository.ts")||e.endsWith("repo.ts")||s.endsWith("repository")||s.endsWith("repo")?"Repository":i==="TsInterfaceDeclaration"||i==="TsTypeAliasDeclaration"?"Type Definition":"Other"}function he(t){let n=[];return/\b(fetch|axios|superagent|got)\s*\(|import\s+.*\b(http|https|node-fetch)\b/i.test(t)&&n.push("Network"),(/\b(knex|prisma|typeorm|mongoose|sequelize|pg|mysql|sqlite3)\b/i.test(t)||/\b(SELECT\s+.*FROM|INSERT\s+INTO|UPDATE\s+.*SET|DELETE\s+FROM)\b/i.test(t)||/\.query\s*\(|\.execute\s*\(/i.test(t)&&/db|database|client|pool/i.test(t))&&n.push("Database"),(/\bfs\./i.test(t)||/\b(readFileSync|writeFileSync|readFile|writeFile|readdir)\b/.test(t)||/import\s+.*\bfs\b/.test(t))&&n.push("File System"),(/\b(localStorage|sessionStorage|indexedDB)\./.test(t)||/\bdocument\.cookie\b/.test(t))&&n.push("Browser Storage"),n}function G(t,n){if(!t)return"";let i=t.trimStart();for(;/^\/\*[\s\S]*?\*\//.test(i);)i=i.replace(/^\/\*[\s\S]*?\*\/\s*/,"");for(;/^\/\/[^\n]*\n/.test(i);)i=i.replace(/^\/\/[^\n]*\n\s*/,"");if(i=i.replace(/^(?:import[^\n]*\n)+/,"").replace(/^(?:export\s+\{[^}]*\}\s+from\s+['"][^'"]+['"];?\s*\n?)+/,"").trim(),n==="TsInterfaceDeclaration"||n==="TsTypeAliasDeclaration")return i;let e=0,s=0,l=i.length;for(let y=0;y<i.length;y++){let T=i[y];if(T==="(")e++;else if(T===")")e--;else if(T==="<")s++;else if(T===">")s--;else if(T==="{"){if(e===0&&s===0){l=y;break}}else if(T===";"&&e===0&&s===0){l=y;break}else if(T==="="&&i[y+1]===">"&&e===0&&s===0){l=y+2;break}}let m=i.substring(0,l).trim();return m.length>500?m.slice(0,497)+"...":m}function Ge(t){let n=[];for(let i of t)i.type==="ImportDeclaration"&&n.push({module:i.source.value,name:i.specifiers.map(e=>e.type==="ImportDefaultSpecifier"?"default":e.type==="ImportNamespaceSpecifier"?"*":e.local?.value||e.imported?.value||"*").join(", ")}),i.type==="ExportAllDeclaration"&&n.push({module:i.source.value,name:"*"}),i.type==="ExportNamedDeclaration"&&i.source&&n.push({module:i.source.value,name:i.specifiers.map(e=>e.type==="ExportSpecifier"?e.orig.value:"*").join(", ")});return n}function mt(t,n){for(let i of t){if((i.type==="FunctionDeclaration"||i.type==="ClassDeclaration")&&(i.identifier?.value||i.id?.value)===n)return i.span;if(i.type==="VariableDeclaration"){for(let e of i.declarations)if(e.id?.type==="Identifier"&&e.id.value===n)return e.span||i.span}if((i.type==="TsTypeAliasDeclaration"||i.type==="TsInterfaceDeclaration"||i.type==="TsEnumDeclaration")&&(i.id?.value||i.identifier?.value)===n)return i.span;if(i.type==="ExportDeclaration"){let e=i.declaration;if(!e)continue;if((e.type==="FunctionDeclaration"||e.type==="ClassDeclaration")&&(e.identifier?.value||e.id?.value)===n)return e.span||i.span;if(e.type==="VariableDeclaration"){for(let s of e.declarations)if(s.id?.type==="Identifier"&&s.id.value===n)return s.span||e.span||i.span}}}return null}function Ke(t,n,i,e,s,l,m,y,T){let o=T??(a=>De(a,i)),p=[];for(let a of t){if(a.type==="ExportDeclaration"){let c=a.declaration,f=c.type,r="";f==="VariableDeclaration"?r=c.declarations.map(w=>w.id.value).join("",""):r=c.id?.value||c.identifier?.value||"anonymous";let u=o(a.span.start-n),b=o(a.span.end-n),S=V(u,l,e),D=y(a.span),d=[];if(a.type==="ExportDeclaration"&&(f==="ClassDeclaration"||f==="ClassExpression")){let w=c.body||[];for(let C of w)if(C.type==="ClassMethod"||C.type==="ClassProperty"){let N=C.key.value;if(!N)continue;let j=o(C.span.start-n),q=o(C.span.end-n),P=y(C.span),z=V(j,l,e);d.push({name:N,kind:C.type,signature:G(P,C.type),line:E(j,s),endLine:E(q,s),doc:z,classification:C.type==="ClassMethod"?"Method":"Property",capabilities:"[]"})}}else if(f==="FunctionDeclaration"&&c.body?.type==="BlockStatement")d=Pe(c.body.stmts,n,i,e,s,l,y,o);else if(f==="VariableDeclaration"){for(let w of c.declarations)if(w.init&&(w.init.type==="ArrowFunctionExpression"||w.init.type==="FunctionExpression")&&w.init.body?.type==="BlockStatement"){d=Pe(w.init.body.stmts,n,i,e,s,l,y,o);break}}p.push({name:r,kind:f,signature:G(D,f),line:E(u,s),endLine:E(b,s),doc:S,classification:ve(m,r,f),capabilities:JSON.stringify(he(D)),members:d})}if(a.type==="ExportNamedDeclaration"){for(let c of a.specifiers)if(c.type==="ExportSpecifier"){let f=c.orig.value,r=c.exported?.value||f,b=mt(t,f)||a.span,S=o(b.start-n),D=o(b.end-n),d=V(S,l,e);p.push({name:r,kind:"ExportSpecifier",signature:`export { ${f} }`,line:E(S,s),endLine:E(D,s),doc:d,classification:"Export mapping",capabilities:"[]"})}}if(a.type==="ExportDefaultDeclaration"){let c=o(a.span.start-n),f=o(a.span.end-n),r=V(c,l,e),u=y(a.span),b=[];if(a.decl.type==="ClassExpression"||a.decl.type==="ClassDeclaration"){let S=a.decl.body||[];for(let D of S)if(D.type==="ClassMethod"||D.type==="ClassProperty"){let d=D.key.value;if(!d)continue;let w=o(D.span.start-n),C=o(D.span.end-n),N=y(D.span),j=V(w,l,e);b.push({name:d,kind:D.type,signature:G(N,D.type),line:E(w,s),endLine:E(C,s),doc:j,classification:D.type==="ClassMethod"?"Method":"Property",capabilities:"[]"})}}else(a.decl.type==="FunctionExpression"||a.decl.type==="FunctionDeclaration"||a.decl.type==="ArrowFunctionExpression")&&a.decl.body?.type==="BlockStatement"&&(b=Pe(a.decl.body.stmts,n,i,e,s,l,y,o));p.push({name:"default",kind:"DefaultExport",signature:G(u,"DefaultExport"),line:E(c,s),endLine:E(f,s),doc:r,classification:"Default Export",capabilities:JSON.stringify(he(u)),members:b})}if(a.type==="ExportAllDeclaration"){let c=o(a.span.start-n),f=o(a.span.end-n),r=a.source.value,u=V(c,l,e);p.push({name:"*",kind:"ExportAllDeclaration",signature:`export * from "${r}"`,line:E(c,s),endLine:E(f,s),doc:u,classification:"Re-export",capabilities:"[]"})}}return p}function Pe(t,n,i,e,s,l,m,y){let T=[];for(let o of t){if(o.type==="VariableDeclaration")for(let p of o.declarations){let a=[],c=r=>{if(r.type==="Identifier")a.push({name:r.value,span:r.span});else if(r.type==="ArrayPattern")for(let u of r.elements)u&&c(u);else if(r.type==="ObjectPattern")for(let u of r.properties)u.type==="AssignmentPatternProperty"?a.push({name:u.key.value,span:u.span}):u.type==="KeyValuePatternProperty"&&c(u.value)};c(p.id);let f=p.init&&(p.init.type==="ArrowFunctionExpression"||p.init.type==="FunctionExpression");for(let r of a){let u=f?p.init.span||p.span||r.span:p.span||r.span,b=f?p.init.type:"VariableDeclaration",S=f?"Internal Function":"Internal Variable",D=y(u.start-n),d=y(u.end-n),w=m(u),C=V(D,l,e);T.push({name:r.name,kind:b,signature:G(w,b),line:E(D,s),endLine:E(d,s),doc:C,classification:S,capabilities:"[]"})}}if(o.type==="FunctionDeclaration"){let p=o.identifier?.value||o.ident?.value||"anonymous",a=y(o.span.start-n),c=y(o.span.end-n),f=m(o.span),r=V(a,l,e);T.push({name:p,kind:"FunctionDeclaration",signature:G(f,"FunctionDeclaration"),line:E(a,s),endLine:E(c,s),doc:r,classification:"Internal Function",capabilities:"[]"})}if(o.type==="ReturnStatement"&&o.argument?.type==="ObjectExpression")for(let p of o.argument.properties){let a="",c=p.span||p.key?.span||p.ident?.span;if(p.type==="KeyValueProperty"){let f=p.key;a=f?.value||f?.raw||(f?.type==="Identifier"?f.value:"")}else p.type==="MethodProperty"?a=p.key?.value||p.key?.raw||"":p.type==="ShorthandProperty"?a=p.ident?.value||"":p.type==="Identifier"&&(a=p.value||"");if(a&&c){let f=y(c.start-n),r=y(c.end-n),u=m(c),b=V(f,l,e);T.push({name:a,kind:"ReturnProperty",signature:G(u,"ReturnProperty"),line:E(f,s),endLine:E(r,s),doc:b,classification:"Return Member",capabilities:"[]"})}}if(o.type==="ExpressionStatement"&&o.expression.type==="CallExpression"){let p=o.expression;if(p.callee.type==="MemberExpression"&&(p.callee.property?.value==="on"||p.callee.property?.value==="once")){let a=p.arguments[0]?.expression?.value,c=p.arguments[1]?.expression;if(a&&c&&(c.type==="ArrowFunctionExpression"||c.type==="FunctionExpression")){let f=y(c.span.start-n),r=y(c.span.end-n),u=m(c.span);T.push({name:`on:${a}`,kind:c.type,signature:G(u,c.type),line:E(f,s),endLine:E(r,s),doc:"",classification:"Event Handler",capabilities:"[]"})}}if(p.callee.type==="Identifier"&&p.callee.value==="addRoute"&&p.arguments.length>=3){let a=p.arguments[2].expression;if(a.type==="StringLiteral"){let c=a.value,f=y(p.span.start-n),r=y(p.span.end-n),u=m(p.span);T.push({name:c,kind:"HTTP Route",signature:G(u,"HTTP Route"),line:E(f,s),endLine:E(r,s),doc:"",classification:"Service Boundary",capabilities:JSON.stringify({path:c})})}}}}return T}function Qe(t,n,i,e,s,l){let m=l??(o=>De(o,i)),y=[];function T(o){if(!(!o||typeof o!="object")){if(o.type==="CallExpression"){let p=ft(o);if(p){let a=m(o.span.start-n);y.push({...p,line:E(a,e),snippet:s(o.span)})}}for(let p of Object.keys(o)){if(p==="span")continue;let a=o[p];Array.isArray(a)?a.forEach(T):typeof a=="object"&&T(a)}}}return t.forEach(T),y}function ft(t){let{callee:n,arguments:i}=t;if(!i||i.length===0)return null;if(n.type==="Identifier"&&n.value,n.type==="Identifier"&&n.value==="addRoute"&&i.length>=3){let e=i[2].expression;if(e.type==="StringLiteral")return{type:"api_route",name:e.value,direction:"consume"}}if(n.type==="MemberExpression"&&n.property?.type==="Identifier"){let e=n.property.value;if(e==="emit"&&i[0].expression.type==="StringLiteral")return{type:"socket_event",name:i[0].expression.value,direction:"produce"};if(e==="on"&&i[0].expression.type==="StringLiteral")return{type:"socket_event",name:i[0].expression.value,direction:"consume"};if(["get","post","put","delete","patch"].includes(e)&&i[0].expression.type==="StringLiteral"){let l=i[0].expression.value,m=n.object.type==="Identifier"?n.object.value:"";if(["axios","http","request","appApi","restApi","adminApi","client"].includes(m))return{type:"api_route",name:l,direction:"produce"};if(l.startsWith("/"))return{type:"api_route",name:l,direction:"consume"}}}return n.type==="Identifier"&&n.value==="fetch"&&i[0].expression.type==="StringLiteral"?{type:"api_route",name:i[0].expression.value,direction:"produce"}:null}function ye(t){let{classification:n,capabilities:i,exports:e,fileName:s}=t,l={Network:"API integration",Database:"data persistence","File System":"file I/O operations","Browser Storage":"client-side storage"},m=i.map(r=>l[r]).filter(Boolean).join(" and "),T={Component:(r,u)=>{let b=u.find(D=>D.kind==="FunctionDeclaration"||D.kind==="ClassDeclaration")?.name,S=b?`React component: ${b}`:"React UI component";return r?`${S} with ${r}`:S},Hook:(r,u)=>{let b=u.find(D=>D.name.startsWith("use"))?.name,S=b?`Custom React hook: ${b}`:"Custom React hook";return r?`${S} for ${r}`:S},Service:(r,u)=>{let S=`Service layer: ${u[0]?.name||"Service"}`;return r?`${S} handling ${r}`:S},Repository:(r,u)=>`Data repository: ${u[0]?.name||"Repository"} for ${r||"data access"}`,"Type Definition":(r,u)=>`Type definitions: ${u.slice(0,3).map(S=>S.name).join("")}${u.length>3?"...":""}`,Model:(r,u)=>`Data model: ${u[0]?.name||"Model"}`,"HTTP Route":(r,u)=>{let b=u.filter(S=>S.classification==="Service Boundary");return b.length>0?`API endpoints: ${b.slice(0,3).map(S=>S.name).join("")}`:"API route handler"},"Micro IR (PHP)":(r,u)=>{let b=u.some(D=>D.classification==="Service Boundary"),S=u.find(D=>D.kind==="ClassDeclaration")?.name;return b?"PHP controller with API routes":S?`PHP class: ${S}`:"PHP module"},"Micro IR (Python)":(r,u)=>{let b=u.some(D=>D.classification==="Service Boundary"),S=u.find(D=>D.kind==="ClassDeclaration")?.name;return b?"Python API handler with routes":S?`Python class: ${S}`:"Python module"},"Micro IR (Go/TS) ":(r,u)=>{let b=u.some(D=>D.kind==="TypeDeclaration"),S=u.filter(D=>D.kind==="FunctionDeclaration");return b&&S.length>0?`Go package: types and ${S.length} function(s)`:b?"Go package: type definitions":S.length>0?`Go package: ${S[0].name} and ${S.length} function(s)`:"Go module"},"Micro IR (Rust/TS) ":(r,u)=>{let b=u.find(d=>d.kind==="TraitDeclaration")?.name,S=u.find(d=>d.kind==="StructDeclaration")?.name,D=u.filter(d=>d.kind==="FunctionDeclaration");return b?r.includes("Rust trait")?`Rust module: trait ${b}`:`Rust module: ${b}`:S?`Rust module: struct ${S}`:D.length>0?`Rust module: ${D.length} function(s)`:"Rust module"}}[n];if(T)return T(m,e);if(e.length===0)return s?`Module: ${s}`:"Module with no exports";let o=e.filter(r=>r.kind==="FunctionDeclaration"),p=e.filter(r=>r.kind==="ClassDeclaration"),a=e.filter(r=>r.kind==="TsInterfaceDeclaration"||r.kind==="TsTypeAliasDeclaration"),c=[];if(p.length>0&&c.push(`Class: ${p[0].name}`),o.length>0){let r=o.slice(0,2).map(u=>u.name).join("");c.push(`Functions: ${r}`)}a.length>0&&c.push(`Types: ${a.length}`);let f=c.length>0?c.join(" | "):`Module with ${e.length} export(s)`;return m?`${f} \u2014 ${m}`:f}function Xe(t){let n=new Set;function i(e){if(!(!e||typeof e!="object")){e.typeAnnotation&&I(e.typeAnnotation,n),(e.type==="TsTypeReference"||e.type==="TsTypeAnnotation")&&I(e,n);for(let s in e){if(s==="span"||s==="comments"||s==="interpreter")continue;let l=e[s];l&&typeof l=="object"&&(Array.isArray(l)?l.forEach(i):i(l))}}}return t.forEach(e=>i(e)),Array.from(n)}function I(t,n){if(t){if(t.type==="TsTypeAnnotation"){I(t.typeAnnotation,n);return}t.type==="TsTypeReference"&&(t.typeName?.type==="Identifier"&&n.add(t.typeName.value),t.typeName?.type==="TsQualifiedName"&&Ye(t.typeName,n),t.typeParams&&I(t.typeParams,n)),t.type==="TsArrayType"&&I(t.elementType,n),t.type==="TsUnionType"&&t.types?.forEach(i=>I(i,n)),t.type==="TsIntersectionType"&&t.types?.forEach(i=>I(i,n)),t.type==="TsTupleType"&&t.elemTypes?.forEach(i=>I(i.ty,n)),(t.type==="TsFunctionType"||t.type==="TsConstructorType")&&(t.params?.forEach(i=>I(i.typeAnnotation,n)),t.typeAnnotation&&I(t.typeAnnotation,n)),t.type==="TsTypeParameterDeclaration"&&t.params?.forEach(i=>{i.constraint&&I(i.constraint,n),i.default&&I(i.default,n)}),t.type==="TsTypeParameterInstantiation"&&t.params?.forEach(i=>I(i,n)),t.type==="TsMappedType"&&t.typeAnnotation&&I(t.typeAnnotation,n),t.type==="TsIndexedAccessType"&&(I(t.objectType,n),I(t.indexType,n)),t.type==="TsConditionalType"&&(I(t.checkType,n),I(t.extendsType,n),I(t.trueType,n),I(t.falseType,n)),t.type==="TsTypeLiteral"&&t.members?.forEach(i=>{i.typeAnnotation&&I(i.typeAnnotation,n)})}}function Ye(t,n){t.type==="TsQualifiedName"?(t.left&&Ye(t.left,n),t.right?.value&&n.add(t.right.value)):t.type==="Identifier"&&n.add(t.value)}import ct from"path";import $e from"path";import st from"path";import vt from"fs";import{fileURLToPath as Mt}from"url";import*as ie from"web-tree-sitter";import dt from"pino";var ht={10:"TRACE",20:"DEBUG",30:"INFO",40:"WARN",50:"ERROR",60:"FATAL"},yt=dt({level:process.env.LOG_LEVEL||"warn",base:{service:"liquid-shadow"},formatters:{level(t,n){return{level:t,severity:ht[n]??"INFO"}}},transport:{target:"pino-pretty",options:{colorize:!0,translateTime:"HH:MM:ss",destination:2,levelKey:"severity",messageKey:"message"}}}),ne=yt;import{fileURLToPath as gt}from"node:url";import{dirname as Ie,join as tt,resolve as bt}from"node:path";import{existsSync as xt}from"node:fs";var St=gt(import.meta.url),et=Ie(St);function Dt(){let t=et;for(;t!==Ie(t);){if(xt(tt(t,"package.json")))return t;t=Ie(t)}return bt(et,"..","..")}function nt(...t){return tt(Dt(),...t)}var Xt=st.dirname(Mt(import.meta.url)),it=ne.child({module:"parser:tree-sitter"}),Me=class{parser=null;languages=new Map;async ensureInitialized(){if(this.parser)return;let n=ie.Parser||ie;await n.init(),this.parser=new n}async getLanguage(n){if(this.languages.has(n))return this.languages.get(n);let i=nt("resources","grammars",`tree-sitter-${this.getLangName(n)}.wasm`);if(!vt.existsSync(i))return it.warn({grammarPath:i},"Grammar WASM not found"),null;try{let e=await ie.Language.load(i);return this.languages.set(n,e),e}catch(e){return it.error({err:e,ext:n},"Failed to load language grammar"),null}}getLangName(n){switch(n.toLowerCase()){case".php":return"php";case".py":return"python";case".go":return"go";case".rs":return"rust";default:return""}}getQueries(n){switch(n.toLowerCase()){case".php":return`
4
4
  (function_definition name: (name) @name) @func
5
5
  (class_declaration name: (name) @name) @class
6
6
  (interface_declaration name: (name) @name) @interface
@@ -24,14 +24,16 @@ import Ae from"fs";function he(e){let t=e.split(`
24
24
  (trait_item name: (_type_identifier) @name) @trait
25
25
  (type_item name: (_type_identifier) @name) @type
26
26
  (use_declaration argument: (_) @name) @import
27
- `;default:return""}}mapKind(t,i){if(t==="import")return"ImportDeclaration";if(i===".php"){if(t==="func")return"FunctionDeclaration";if(t==="class")return"ClassDeclaration";if(t==="interface")return"InterfaceDeclaration";if(t==="trait")return"TraitDeclaration";if(t==="method")return"MethodDeclaration"}if(i===".py"){if(t==="func")return"FunctionDeclaration";if(t==="class")return"ClassDeclaration"}if(i===".go"){if(t==="func")return"FunctionDeclaration";if(t==="type")return"TypeDeclaration"}if(i===".rs"){if(t==="func")return"FunctionDeclaration";if(t==="struct")return"StructDeclaration";if(t==="enum")return"EnumDeclaration";if(t==="trait")return"TraitDeclaration";if(t==="type")return"TypeDeclaration"}return"Unknown"}mapClassification(t){return t==="import"?"Dependency":t==="func"||t==="method"?"Function":t==="class"||t==="interface"||t==="trait"||t==="struct"||t==="enum"||t==="type"?"Class":"Other"}async parse(t,i){await this.ensureInitialized();let n=ke.extname(t).toLowerCase(),s=await this.getLanguage(n);if(!s||!this.parser)return[];this.parser.setLanguage(s);let u=this.parser.parse(i),d=i.split(`
28
- `),h=this.getQueries(n);if(!h)return[];let o=new H.Query(s,h).matches(u.rootNode),l=[];for(let a of o){let p=a.captures.find(c=>c.name==="name")?.node,f=a.captures[0].node,r=a.captures[0].name;if(p){let c=f.startPosition.row+1,y=f.endPosition.row+1,m=d[f.startPosition.row].trim();l.push({name:p.text,kind:this.mapKind(r,n),classification:this.mapClassification(r),signature:m,line:c,endLine:y,doc:"",capabilities:"{}"})}}return l}};var se=class{parse(t,i=!1){let n=[],s=[],u=t.split(`
29
- `),d="",h="",S=0,o=0,l=-1,a=-1,p=[],f=[],r=!1,c=i?"api":"",y="",m=/^namespace\s+([a-zA-Z0-9_\\]+);/,g=/^(?:abstract\s+)?(?:readonly\s+)?class\s+([a-zA-Z0-9_]+)/,T=/^interface\s+([a-zA-Z0-9_]+)/,M=/^trait\s+([a-zA-Z0-9_]+)/,w=/^(?:public|protected|private|static|\s)*function\s+([a-zA-Z0-9_]+)\s*\(/,A=/^use\s+([a-zA-Z0-9_\\]+)(?:\s+as\s+([a-zA-Z0-9_]+))?;/,E=/^#\[([a-zA-Z0-9_\\]+)(?:\((.*)\))?\]/,U=/(?:Route::|router->|\$router->|->)(get|post|put|delete|patch|match)\s*\(\s*(?:uri\s*:\s*)?['"]([^'"]+)['"]/,I=/->prefix\s*\(\s*(?:prefix\s*:\s*)?['"]([^'"]+)['"]/;for(let R=0;R<u.length;R++){let v=u[R].trim();if(!v)continue;let $=(v.match(/{/g)||[]).length,ce=(v.match(/}/g)||[]).length,le=o;if(o+=$-ce,h&&o<=a){let D=n.find(b=>b.name===h&&b.line===S);D&&(D.endLine=R+1),h="",a=-1}if(d&&o<=l){let D=n.find(b=>b.name===d&&(b.kind==="ClassDeclaration"||b.kind==="TraitDeclaration"||b.kind==="InterfaceDeclaration"));D&&(D.endLine=R+1),d="",l=-1}let Y=v.match(I);if(Y&&(c=Y[1]),v.includes("});")&&(c=""),v.startsWith("/**")){r=!0,f=[];continue}if(r){v.endsWith("*/")?r=!1:f.push(v.replace(/^\*\s?/,""));continue}let q=v.match(E);if(q){p.push(q[1]);continue}let G=v.match(m);if(G){y=G[1]||"",p=[],f=[];continue}let C=v.match(g);if(C){d=C[1],l=o-$;let D={attributes:p};y&&(D.namespace=y),n.push({name:d,kind:"ClassDeclaration",classification:"Class",signature:`class ${d}`,line:R+1,endLine:R+1,doc:f.join(`
30
- `).trim(),capabilities:JSON.stringify(D),members:[]}),p=[],f=[];continue}let x=v.match(T);if(x){let D=x[1];d=D,l=o-$,n.push({name:D,kind:"InterfaceDeclaration",classification:"Interface",signature:`interface ${D}`,line:R+1,endLine:R+1,doc:f.join(`
31
- `).trim(),capabilities:JSON.stringify({attributes:p}),members:[]}),p=[],f=[];continue}let L=v.match(M);if(L){let D=L[1];d=D,l=o-$,n.push({name:D,kind:"TraitDeclaration",classification:"Trait",signature:`trait ${D}`,line:R+1,endLine:R+1,doc:f.join(`
32
- `).trim(),capabilities:JSON.stringify({attributes:p}),members:[]}),p=[],f=[];continue}let K=v.match(w);if(K){let D=K[1],b=!!d;h=D,S=R+1,a=o-$;let J=!1,W={};for(let _ of p)_.toLowerCase().includes("route")&&(J=!0,W={type:"route",method:"GET",path:"/"});let z=f.join(`
33
- `).trim();if(J){let _=W.path||"/";n.push({name:_,kind:"HTTP Route",classification:"Service Boundary",signature:`Function: ${D}`,line:R+1,endLine:R+1,doc:z,capabilities:JSON.stringify({type:"route",handler:d?`${d}@${D}`:D,...W})}),s.push({type:"api_route",name:_,direction:"consume",line:R+1,snippet:v})}n.push({name:D,kind:b?"MethodDeclaration":"FunctionDeclaration",classification:b?"Method":"Function",signature:`${b?d+":: ":""}${D}`,line:R+1,endLine:R+1,doc:z,capabilities:JSON.stringify({attributes:p})}),p=[],f=[];continue}let Z=v.match(A);if(Z){let D=Z[1]||"",b=Z[2]||D.split("\\").pop()||"";n.push({name:b,kind:"ImportSpecifier",classification:"Dependency",signature:`use ${D}`,line:R+1,endLine:R+1,doc:"",capabilities:JSON.stringify({type:"use",namespace:D})}),p=[],f=[];continue}let V=v.match(U);if(V){let D=V[1].toUpperCase(),b=V[2];if(v.includes("Route::")||v.includes("router->")||v.includes("action")||v.includes(",")&&!v.includes("view(")){if(c){let B=c.startsWith("/")?c:`/${c}`,pe=b.startsWith("/")?b:`/${b}`;b=(B+pe).replace(/\/+/g,"/")}let W=null,z=v.match(/\[\s*([a-zA-Z0-9_]+)::class\s*,\s*['"]([^'"]+)['"]\s*\]/);if(z)W=`${z[1]}@${z[2]}`;else if(v.includes("::class")){let B=v.match(/([a-zA-Z0-9_]+)::class/);B&&(W=B[1])}let _=v;!v.endsWith(");")&&R+1<u.length&&(_+=" "+u[R+1].trim(),!_.endsWith(");")&&R+2<u.length&&(_+=" "+u[R+2].trim())),n.push({name:b,kind:"HTTP Route",classification:"Service Boundary",signature:_,line:R+1,endLine:R+1,doc:"",capabilities:JSON.stringify({type:"route",method:D,path:b,handler:W})}),s.push({type:"api_route",name:b,direction:"consume",line:R+1,snippet:_,method:D,url:b}),f=[];continue}}let ee=/(?:\$client|client|Http)::(get|post|put|delete|patch|request)\s*\(\s*(?:url\s*:\s*)?([^,)]+)|(?:\$client|client)->(request|get|post|put|delete|patch)\s*\(\s*([^,)]+)/,j=v.match(ee);if(j){let D=(j[1]||j[3]).toUpperCase(),b=(j[2]||j[4]).trim();(b.startsWith("'")&&b.endsWith("'")||b.startsWith('"')&&b.endsWith('"'))&&(b=b.substring(1,b.length-1)),s.push({type:"api_route",name:b,direction:"produce",line:R+1,snippet:v,method:D,url:b})}!v.startsWith("#[")&&!v.startsWith("//")&&!v.startsWith("*")&&!r&&(p=[],f=[])}return{nodes:n,events:s}}};var re=class{currentRoutePrefix="";parse(t){this.currentRoutePrefix="";let i=[],n=[],s=t.split(`
34
- `),u=[{indent:-1,name:"root",type:"root"}],d=[],h=/^class\s+([a-zA-Z0-9_]+)/,S=/^async\s+def\s+([a-zA-Z0-9_]+)|^def\s+([a-zA-Z0-9_]+)/,o=/^(?:from\s+([a-zA-Z0-9_\.]+)\s+import|import\s+([a-zA-Z0-9_\.]+))/,l=/^@(.*)/;function a(m){return m.trim().split(/[.(]/)[0]?.trim()||m}function p(m){let g=m.decorators.map(M=>a(M.raw)),T={decorators:m.decorators,decoratorNames:g};return m.async===!0&&(T.async=!0),JSON.stringify(T)}let f=!1,r="",c=[],y=[];for(let m=0;m<s.length;m++){let g=s[m],T=g.trim();if(!T||T.startsWith("#"))continue;let M=/^([a-zA-Z0-9_]+)\s*=\s*(?:APIRouter|Blueprint)\s*\(\s*(?:prefix\s*=\s*)?['"]([^'"]+)['"]/,w=T.match(M);if(w&&(this.currentRoutePrefix=w[2]),f){if(T.endsWith(r)||T.includes(r)){f=!1;let C=T.replace(r,"").trim();C&&c.push(C);let x=u[u.length-1];x.node&&(x.node.doc=c.join(`
35
- `).trim()),c=[]}else c.push(T);continue}let A=g.search(/\S/),E=g.trim(),U=E.match(/^(['"]{3})/);if(U){let C=U[1],x=u[u.length-1];if(x.node&&!x.node.doc){if(E.substring(3).includes(C)){let L=E.replace(new RegExp(C,"g"),"").trim();x.node.doc=L}else{f=!0,r=C;let L=E.substring(3).trim();L&&c.push(L)}continue}}for(;u.length>1&&u[u.length-1].indent>=A;)u.pop();let I=u[u.length-1],R=E.match(l);if(R){d.push({raw:R[1].trim(),line:m+1});continue}let v=E.match(h);if(v){let C=v[1],x={name:C,kind:"ClassDeclaration",classification:"Class",signature:`class ${C}`,line:m+1,endLine:m+1,doc:"",capabilities:p({decorators:d}),members:[]};y.push(x),I.node?(I.node.members||(I.node.members=[]),I.node.members.push(x)):i.push(x),u.push({indent:A,name:C,type:"class",node:x}),d=[];continue}let $=E.match(S);if($){let C=!!$[1],x=$[1]||$[2],L=I.type==="class",K=!1,Z={};for(let b of d)if(b.raw.match(/(?:app|router)\.(get|post|put|delete|patch)/)){K=!0;let W=["get","post","put","delete","patch"].find(B=>b.raw.toLowerCase().includes(`.${B}`))?.toUpperCase()||"GET",z=b.raw.match(/['"]([^'"]+)['"]/),_=z?z[1]:"/";if(this.currentRoutePrefix){let B=this.currentRoutePrefix.endsWith("/")?this.currentRoutePrefix.slice(0,-1):this.currentRoutePrefix,pe=_.startsWith("/")?_:`/${_}`;_=B+pe}Z={type:"route",method:W,path:_}}if(K){let b=Z.path||"",J={name:b||x,kind:"HTTP Route",classification:"Service Boundary",signature:`Function: ${x}`,line:m+1,endLine:m+1,doc:"",capabilities:JSON.stringify({handler:L?`${I.name}.${x}`:x,async:C,...Z})};y.push(J),i.push(J),n.push({type:"api_route",name:b,direction:"consume",line:m+1,snippet:E})}let V=d.some(b=>b.raw==="staticmethod"),ee=d.some(b=>b.raw==="classmethod"),j=`${C?"async ":""}${L?(V?"@staticmethod ":ee?"@classmethod ":"")+I.name+".":""}${x}`,D={name:x,kind:C&&L?"AsyncMethodDeclaration":C?"AsyncFunctionDeclaration":L?"MethodDeclaration":"FunctionDeclaration",classification:L?V||ee?"Static Method":"Method":"Function",signature:j,line:m+1,endLine:m+1,doc:"",capabilities:p({decorators:d,async:C}),members:[]};y.push(D),I.node?(I.node.members||(I.node.members=[]),I.node.members.push(D)):i.push(D),u.push({indent:A,name:x,type:"function",node:D}),d=[];continue}let ce=/^(?:path|re_path|url)\s*\(\s*['"]([^'"]+)['"]/,le=E.match(ce);if(le){let C=le[1].replace(/^\^/,""),x={name:C,kind:"HTTP Route",classification:"Service Boundary",signature:E.trim(),line:m+1,endLine:m+1,doc:"",capabilities:JSON.stringify({type:"route",method:"GET",path:C})};y.push(x),i.push(x),n.push({type:"api_route",name:C,direction:"consume",line:m+1,snippet:E});continue}let Y=/(?:requests|httpx|client|http)\.(get|post|put|delete|patch|request)\s*\(\s*(?:url\s*:\s*)?([^,)]+)/,q=E.match(Y);if(q){let C=q[1].toUpperCase(),x=q[2].trim();(x.startsWith("'")&&x.endsWith("'")||x.startsWith('"')&&x.endsWith('"'))&&(x=x.substring(1,x.length-1)),n.push({type:"api_route",name:x,direction:"produce",line:m+1,snippet:E,method:C,url:x})}let G=E.match(o);if(G){let C=G[1]||G[2],x={name:C,kind:"ImportSpecifier",classification:"Dependency",signature:`import ${C}`,line:m+1,endLine:m+1,doc:"",capabilities:JSON.stringify({type:"import",module:C})};y.push(x),i.push(x),d=[];continue}d=[],I.node&&(I.node.endLine=m+1)}return{nodes:y,events:n}}};function qe(e,t){let i=0,n=!1;for(let s=t;s<e.length;s++){let u=e[s];for(let d of u)if(d==="{")i++,n=!0;else if(d==="}"&&(i--,n&&i<=0))return s+1;if(!n&&s>t&&/[;}]$/.test(u.trim()))return s+1}return Math.min(e.length,t+41)}var Ie=[{extension:[".php"],rules:[]},{extension:[".py"],rules:[]},{extension:[".go"],rules:[{regex:/func\s+([a-zA-Z0-9_]+)\(/g,onMatch:e=>({name:e[1],kind:"FunctionDeclaration",classification:"Function",signature:e[0]})},{regex:/func\s+\([^\)]+\)\s+([a-zA-Z0-9_]+)\(/g,onMatch:e=>({name:e[1],kind:"MethodDeclaration",classification:"Method",signature:e[0]})},{regex:/import\s+['"]([^'"]+)['"]/g,onMatch:e=>({name:e[1],kind:"ImportSpecifier",classification:"Dependency",signature:e[0],meta:{type:"import",path:e[1]}})}]},{extension:[".rs"],rules:[{regex:/fn\s+([a-zA-Z0-9_]+)\s*\(/g,onMatch:e=>({name:e[1],kind:"FunctionDeclaration",classification:"Function",signature:e[0]})},{regex:/struct\s+([a-zA-Z0-9_]+)/g,onMatch:e=>({name:e[1],kind:"StructDeclaration",classification:"Class",signature:e[0]})},{regex:/enum\s+([a-zA-Z0-9_]+)/g,onMatch:e=>({name:e[1],kind:"EnumDeclaration",classification:"Class",signature:e[0]})},{regex:/trait\s+([a-zA-Z0-9_]+)/g,onMatch:e=>({name:e[1],kind:"TraitDeclaration",classification:"Class",signature:e[0]})},{regex:/use\s+([a-zA-Z0-9_:]+(?:\s+as\s+[a-zA-Z0-9_]+)?);/g,onMatch:e=>({name:e[1].trim(),kind:"ImportDeclaration",classification:"Dependency",signature:e[0],meta:{type:"import",path:e[1].trim()}})}]},{extension:[".ts",".tsx",".js",".jsx",".mjs",".cjs"],rules:[{regex:/(?:export\s+)?(?:async\s+)?function\s+([a-zA-Z0-9_]+)\s*\(/g,onMatch:e=>({name:e[1],kind:"FunctionDeclaration",classification:"Function"})},{regex:/(?:export\s+)?class\s+([a-zA-Z0-9_]+)/g,onMatch:e=>({name:e[1],kind:"ClassDeclaration",classification:"Class"})},{regex:/(?:export\s+)?interface\s+([a-zA-Z0-9_]+)/g,onMatch:e=>({name:e[1],kind:"InterfaceDeclaration",classification:"Interface"})},{regex:/(?:export\s+)?const\s+([a-zA-Z0-9_]+)\s*=/g,onMatch:e=>({name:e[1],kind:"VariableDeclaration",classification:"Constant"})},{regex:/import\s+.*\s+from\s+['"]([^'"]+)['"]/g,onMatch:e=>({name:e[1],kind:"ImportDeclaration",classification:"Dependency",meta:{path:e[1]}})}]}];function Ge(e,t){let i=[];if(e===".go"&&t.some(n=>n.kind==="TypeDeclaration")&&i.push("Go type"),e===".rs"&&(t.some(n=>n.kind==="TraitDeclaration")&&i.push("Rust trait"),t.some(n=>n.kind==="StructDeclaration")&&i.push("Rust struct"),t.some(n=>n.kind==="EnumDeclaration")&&i.push("Rust enum")),e===".py"){for(let n of t)if(n.capabilities)try{if(JSON.parse(n.capabilities).decoratorNames?.length){i.push("Python decorators");break}}catch{}t.some(n=>n.kind==="AsyncFunctionDeclaration"||n.kind==="AsyncMethodDeclaration")&&i.push("Async")}return i}var ae=class{phpParser=new se;pythonParser=new re;treeSitterParser=new ie;supports(t){return Ie.some(i=>i.extension.includes(t.toLowerCase()))}async parse(t,i){let n=fe.extname(t).toLowerCase(),s=[],u=[];if(n===".php"||n===".py"||n===".go"||n===".rs"){if(n===".py"){let o=this.pythonParser.parse(i);s=o.nodes,u=o.events}else if(n===".php"){let o=t.toLowerCase().endsWith("api.php"),l=this.phpParser.parse(i,o);s=l.nodes,u=l.events}else try{s=await this.treeSitterParser.parse(t,i)}catch{}if(s.length>0){let o=n===".php"?"Micro IR (PHP/TS) ":n===".py"?"Micro IR (Python/TS) ":n===".go"?"Micro IR (Go/TS) ":"Micro IR (Rust/TS) ",l=s.filter(r=>r.classification!=="Dependency"),a=s.filter(r=>r.classification==="Dependency"),p=Ge(n,s),f=X({classification:o,capabilities:p,exports:l.map(r=>({name:r.name,kind:r.kind,classification:r.classification})),fileName:fe.basename(t)});return{exports:l,imports:a.map(r=>({module:r.name,name:r.name,kind:r.kind,classification:r.classification})),events:u,classification:o,summary:f||`${n.substring(1).toUpperCase()} module`,parseStatus:"success"}}}let d=Ie.find(o=>o.extension.includes(n));if(!d)return{exports:[],imports:[],classification:"Unknown",summary:"",parseStatus:"failed",parseError:`Unsupported file extension: ${n}`};let h=i.split(`
36
- `);for(let o of d.rules){o.regex.lastIndex=0;let l;for(;(l=o.regex.exec(i))!==null;){let a=o.onMatch(l),p=i.substring(0,l.index).split(`
37
- `).length,f=qe(h,p-1);s.push({name:a.name||"anonymous",kind:a.kind||"Unknown",classification:a.classification||"Other",signature:a.signature||l[0],line:p,endLine:f,doc:"",capabilities:JSON.stringify(a.meta||{})})}}let S=X({classification:`Micro IR (${n.substring(1).toUpperCase()})`,capabilities:[],exports:s.map(o=>({name:o.name,kind:o.kind,classification:o.classification})),fileName:fe.basename(t)});return{exports:s,imports:[],classification:`Micro IR (${n.substring(1).toUpperCase()})`,summary:S||"Module",parseStatus:s.length>0?"success":"partial"}}};import*as de from"@swc/core";function _e(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.parse=="function"&&typeof t.parseSync=="function"}function Ve(){if(_e(de))return de;let e=de;if(_e(e.default))return e.default;throw new Error("SWC runtime unavailable: couldn't resolve parse/parseSync from @swc/core exports")}var Ke=Ve();function oe(e,t,i){return Ke.parseSync(e,t,i)}var ye=new ae;async function Ot(e){let t=Le.extname(e);if(ye.supports(t)&&t!==".ts"&&t!==".tsx")try{let u=await Ae.promises.readFile(e,"utf-8");return{...await ye.parse(e,u),content:u}}catch(u){return O.error({filePath:e,error:u.message},"HeuristicParser failed"),{exports:[],imports:[],classification:"Unknown",summary:"",content:"",parseStatus:"failed",parseError:u.message}}let i;try{i=await Ae.promises.readFile(e)}catch(u){return{exports:[],imports:[],classification:"Error",summary:"",content:"",parseStatus:"failed",parseError:`File read error: ${u.message}`}}let n=i.toString("utf8"),s=he(n);try{let u=e.endsWith(".tsx"),d=e.endsWith(".d.ts")||e.endsWith(".d.tsx"),h,S={syntax:"typescript",tsx:u,decorators:!0,comments:!0};if(d)try{h=oe(n,S)}catch{h=oe(n,{...S,isModule:!1})}else h=oe(n,S);let o=h.span.start,l=ge(i),a=xe(n),p=w=>be(w,o,i),f=Se(h.body),r=Re(h.body);r.length>0&&O.debug({filePath:e,count:r.length},"Extracted type references"),r.forEach(w=>{f.push({module:"__type_reference__",name:w})});let c=ve(h.body,o,i,n,s,a,e,p,l),y=Te(h.body,o,i,s,p,l),m=ne(e,"","Module"),T=a.length>0&&n.slice(0,a[0].start).trim().length===0?a[0].text:c.find(w=>w.doc)?.doc||"",M=De(T);if(!M&&c.length>0){let w=Q(n);M=X({classification:m,capabilities:w,exports:c.map(A=>({name:A.name,kind:A.kind,classification:A.classification})),fileName:Le.basename(e)})}return{exports:c,imports:f,events:y,classification:m,summary:M,content:n,parseStatus:"success"}}catch(u){O.warn({filePath:e,error:u.message},"SWC parsing failed, using heuristic fallback");try{let d=await ye.parse(e,n);return{...d,content:n,classification:d.classification+" (Degraded)",parseStatus:"partial",parseError:`SWC failed, used heuristic fallback: ${u.message}`}}catch(d){return O.error({filePath:e,error:d.message},"All parsing strategies failed"),{exports:[],imports:[],classification:"Error",summary:"",content:n,parseStatus:"failed",parseError:`All parsing strategies failed: ${d.message}`}}}}export{Ot as parseFile};
27
+ `;default:return""}}mapKind(n,i){if(n==="import")return"ImportDeclaration";if(i===".php"){if(n==="func")return"FunctionDeclaration";if(n==="class")return"ClassDeclaration";if(n==="interface")return"InterfaceDeclaration";if(n==="trait")return"TraitDeclaration";if(n==="method")return"MethodDeclaration"}if(i===".py"){if(n==="func")return"FunctionDeclaration";if(n==="class")return"ClassDeclaration"}if(i===".go"){if(n==="func")return"FunctionDeclaration";if(n==="type")return"TypeDeclaration"}if(i===".rs"){if(n==="func")return"FunctionDeclaration";if(n==="struct")return"StructDeclaration";if(n==="enum")return"EnumDeclaration";if(n==="trait")return"TraitDeclaration";if(n==="type")return"TypeDeclaration"}return"Unknown"}mapClassification(n){return n==="import"?"Dependency":n==="func"||n==="method"?"Function":n==="class"||n==="interface"||n==="trait"||n==="struct"||n==="enum"||n==="type"?"Class":"Other"}async parse(n,i){await this.ensureInitialized();let e=st.extname(n).toLowerCase(),s=await this.getLanguage(e);if(!s||!this.parser)return[];this.parser.setLanguage(s);let l=this.parser.parse(i),m=i.split(`
28
+ `),y=this.getQueries(e);if(!y)return[];let o=new ie.Query(s,y).matches(l.rootNode),p=[];for(let a of o){let c=a.captures.find(u=>u.name==="name")?.node,f=a.captures[0].node,r=a.captures[0].name;if(c){let u=f.startPosition.row+1,b=f.endPosition.row+1,S=m[f.startPosition.row].trim();p.push({name:c.text,kind:this.mapKind(r,e),classification:this.mapClassification(r),signature:S,line:u,endLine:b,doc:"",capabilities:"{}"})}}return p}};var Re=class{parse(n,i=!1){let e=[],s=[],l=n.split(`
29
+ `),m="",y="",T=0,o=0,p=-1,a=-1,c=[],f=[],r=!1,u=i?"api":"",b="",S=/^namespace\s+([a-zA-Z0-9_\\]+);/,D=/^(?:abstract\s+)?(?:readonly\s+)?class\s+([a-zA-Z0-9_]+)/,d=/^interface\s+([a-zA-Z0-9_]+)/,w=/^trait\s+([a-zA-Z0-9_]+)/,C=/^enum\s+([a-zA-Z0-9_]+)(?:\s*:\s*(string|int))?\s*/,N=/^((?:(?:public|protected|private|static)\s+)*)function\s+([a-zA-Z0-9_]+)\s*\(/,j=/^(public|protected|private)\s+(static\s+)?(readonly\s+)?(?:(\?\s*)?([a-zA-Z0-9_\\|]+)\s+)?\$([a-zA-Z0-9_]+)/,q=/^use\s+([a-zA-Z0-9_\\]+)(?:\s+as\s+([a-zA-Z0-9_]+))?;/,P=/^#\[([a-zA-Z0-9_\\]+)(?:\((.*)\))?\]/,z=/(?:Route::|router->|\$router->|->)(get|post|put|delete|patch|match)\s*\(\s*(?:uri\s*:\s*)?['"]([^'"]+)['"]/,W=/->prefix\s*\(\s*(?:prefix\s*:\s*)?['"]([^'"]+)['"]/,ce=/\$this->(hasMany|hasOne|belongsTo|belongsToMany|morphTo|morphMany|morphOne|morphToMany|morphedByMany)\s*\(\s*([a-zA-Z0-9_\\]+)(?:::class)?/,Fe=/^->(hasMany|hasOne|belongsTo|belongsToMany|morphTo|morphMany|morphOne|morphToMany|morphedByMany)\s*\(\s*([a-zA-Z0-9_\\]+)(?:::class)?/,ge=/(public|protected|private)\s+(readonly\s+)?(?:(\?\s*)?([a-zA-Z0-9_\\|]+)\s+)?\$([a-zA-Z0-9_]+)/g,be=/(?:protected|public)\s+\$(fillable|casts|guarded|hidden|appends|with)\s*=/;function xe(g){try{let h=JSON.parse(g||"{}");if(h&&typeof h=="object"&&!Array.isArray(h))return h}catch{}return{}}function le(g,h){let _=[],x=g,v=0,k=0;for(;x<l.length;){let F=l[x].trim();_.push(F),v+=(F.match(/\[/g)||[]).length-(F.match(/]/g)||[]).length,k+=(F.match(/\(/g)||[]).length-(F.match(/\)/g)||[]).length;let B=F.includes(h),H=v<=0&&k<=0;if(B&&H)break;x+=1}return{text:_.join(" "),endIndex:x}}function se(g,h){let _=h.replace(/^[^=]+=\s*/,"").replace(/;$/,"").trim();if(g==="casts"){let F={},B=/['"]([^'"]+)['"]\s*=>\s*['"]([^'"]+)['"]/g,H=null;for(;H=B.exec(_);)F[H[1]]=H[2];return F}let x=[],v=/['"]([^'"]+)['"]/g,k=null;for(;k=v.exec(_);)x.push(k[1]);return x}function Ee(g,h){for(let _=h;_>=0;_-=1){let x=g[_]?.trim()||"";if(x)return x}return""}function re(g,h,_,x){if(!m)return;let v=h.split("\\").pop()||h;s.push({type:"eloquent_relation",name:v,direction:"produce",line:_,snippet:x,method:g,url:`${m}->${v}`})}for(let g=0;g<l.length;g++){let h=l[g].trim();if(!h)continue;let _=(h.match(/{/g)||[]).length,x=(h.match(/}/g)||[]).length,v=o;if(o+=_-x,y&&o<=a){let R=e.find(M=>M.name===y&&M.line===T);R&&(R.endLine=g+1),y="",a=-1}if(m&&o<=p){let R=e.find(M=>M.name===m&&(M.kind==="ClassDeclaration"||M.kind==="TraitDeclaration"||M.kind==="InterfaceDeclaration"||M.kind==="EnumDeclaration"));R&&(R.endLine=g+1),m="",p=-1}let k=h.match(W);if(k&&(u=k[1]),h.includes("});")&&(u=""),h.startsWith("/**")){r=!0,f=[];continue}if(r){h.endsWith("*/")?r=!1:f.push(h.replace(/^\*\s?/,""));continue}let F=h.match(P);if(F){c.push(F[1]);continue}let B=h.match(S);if(B){b=B[1]||"",c=[],f=[];continue}let H=h.match(D);if(H){m=H[1],p=o-_;let R={attributes:c};b&&(R.namespace=b),e.push({name:m,kind:"ClassDeclaration",classification:"Class",signature:`class ${m}`,line:g+1,endLine:g+1,doc:f.join(`
30
+ `).trim(),capabilities:JSON.stringify(R),members:[]}),c=[],f=[];continue}let X=h.match(d);if(X){let R=X[1];m=R,p=o-_,e.push({name:R,kind:"InterfaceDeclaration",classification:"Interface",signature:`interface ${R}`,line:g+1,endLine:g+1,doc:f.join(`
31
+ `).trim(),capabilities:JSON.stringify({attributes:c}),members:[]}),c=[],f=[];continue}let pe=h.match(w);if(pe){let R=pe[1];m=R,p=o-_,e.push({name:R,kind:"TraitDeclaration",classification:"Trait",signature:`trait ${R}`,line:g+1,endLine:g+1,doc:f.join(`
32
+ `).trim(),capabilities:JSON.stringify({attributes:c}),members:[]}),c=[],f=[];continue}let ae=h.match(C);if(ae){let R=ae[1],M=ae[2]||null;m=R,p=o-_;let Z={attributes:c,backedType:M};b&&(Z.namespace=b),e.push({name:R,kind:"EnumDeclaration",classification:"Enum",signature:M?`enum ${R}: ${M}`:`enum ${R}`,line:g+1,endLine:g+1,doc:f.join(`
33
+ `).trim(),capabilities:JSON.stringify(Z),members:[]}),c=[],f=[];continue}let ue=h.match(N);if(ue){let R=(ue[1]||"").trim(),M=ue[2],Z=!!m,O=/\bprivate\b/.test(R)?"private":/\bprotected\b/.test(R)?"protected":"public",L=/\bstatic\b/.test(R),U=le(g,")"),te=U.text.match(/\)\s*:\s*([?a-zA-Z0-9_\\|]+)/),Se=te?te[1]:null,pt=_>0&&x>=_;y=M,T=g+1,a=o-_;let We=!1,_e={};for(let J of c)J.toLowerCase().includes("route")&&(We=!0,_e={type:"route",method:"GET",path:"/"});let ze=f.join(`
34
+ `).trim();if(We){let J=_e.path||"/";e.push({name:J,kind:"HTTP Route",classification:"Service Boundary",signature:`Function: ${M}`,line:g+1,endLine:g+1,doc:ze,capabilities:JSON.stringify({type:"route",handler:m?`${m}@${M}`:M,..._e})}),s.push({type:"api_route",name:J,direction:"consume",line:g+1,snippet:h})}let Ze={name:M,kind:Z?"MethodDeclaration":"FunctionDeclaration",classification:Z?"Method":"Function",signature:`${Z?m+":: ":""}${M}`,line:g+1,endLine:g+1,doc:ze,capabilities:JSON.stringify(Z?{attributes:c,visibility:O,static:L,returnType:Se}:{attributes:c,returnType:Se})};e.push(Ze);let ke=Z?h.match(ce):null;if(ke&&re(ke[1],ke[2],g+1,h),Z&&M==="__construct"){let J=null;for(;J=ge.exec(U.text);){let Be=J[1],Oe=!!J[2],Ae=J[4]?`${J[3]?"?":""}${J[4]}`:null,je=J[5],ut=`${Be} ${Oe?"readonly ":""}${Ae?`${Ae} `:""}$${je}`.trim();e.push({name:je,kind:"PropertyDeclaration",classification:"Property",signature:ut,line:g+1,endLine:g+1,doc:"",capabilities:JSON.stringify({visibility:Be,static:!1,readonly:Oe,type:Ae}),members:[]})}ge.lastIndex=0}pt&&(Ze.endLine=g+1,y="",a=-1),c=[],f=[];continue}let me=!1,Q=!1,A=g,$=m&&!y?h.match(j):null;if($){me=!0;let R=$[1],M=!!$[2],Z=!!$[3],O=$[5]?`${$[4]?"?":""}${$[5]}`:null,L=$[6],U=`${R} ${M?"static ":""}${Z?"readonly ":""}${O?`${O} `:""}$${L}`.trim();e.push({name:L,kind:"PropertyDeclaration",classification:"Property",signature:U,line:g+1,endLine:g+1,doc:f.join(`
35
+ `).trim(),capabilities:JSON.stringify({visibility:R,static:M,readonly:Z,type:O}),members:[]})}let Y=m&&!y?h.match(be):null;if(Y){Q=!0;let R=Y[1],M=le(g,";");A=M.endIndex;let Z=se(R,M.text),O=[...e].reverse().find(L=>L.name===m&&L.kind==="ClassDeclaration");if(O){let L=xe(O.capabilities);(!L.modelConfig||typeof L.modelConfig!="object"||Array.isArray(L.modelConfig))&&(L.modelConfig={}),L.modelConfig[R]=Z,O.capabilities=JSON.stringify(L)}}if(me||Q){Q&&A>g&&(g=A),c=[],f=[];continue}let oe=h.match(q);if(oe){let R=oe[1]||"",M=oe[2]||R.split("\\").pop()||"";e.push({name:M,kind:"ImportSpecifier",classification:"Dependency",signature:`use ${R}`,line:g+1,endLine:g+1,doc:"",capabilities:JSON.stringify({type:"use",namespace:R})}),c=[],f=[];continue}let K=h.match(z);if(K){let R=K[1].toUpperCase(),M=K[2];if(h.includes("Route::")||h.includes("router->")||h.includes("action")||h.includes(",")&&!h.includes("view(")){if(u){let te=u.startsWith("/")?u:`/${u}`,Se=M.startsWith("/")?M:`/${M}`;M=(te+Se).replace(/\/+/g,"/")}let O=null,L=h.match(/\[\s*([a-zA-Z0-9_]+)::class\s*,\s*['"]([^'"]+)['"]\s*\]/);if(L)O=`${L[1]}@${L[2]}`;else if(h.includes("::class")){let te=h.match(/([a-zA-Z0-9_]+)::class/);te&&(O=te[1])}let U=h;!h.endsWith(");")&&g+1<l.length&&(U+=" "+l[g+1].trim(),!U.endsWith(");")&&g+2<l.length&&(U+=" "+l[g+2].trim())),e.push({name:M,kind:"HTTP Route",classification:"Service Boundary",signature:U,line:g+1,endLine:g+1,doc:"",capabilities:JSON.stringify({type:"route",method:R,path:M,handler:O})}),s.push({type:"api_route",name:M,direction:"consume",line:g+1,snippet:U,method:R,url:M}),f=[];continue}}let ee=m&&y?h.match(ce):null,fe=m&&y?h.match(Fe):null;if(ee)re(ee[1],ee[2],g+1,h);else if(fe){let R=Ee(l,g-1);/\$this\b/.test(R)&&re(fe[1],fe[2],g+1,h)}let lt=/(?:\$client|client|Http)::(get|post|put|delete|patch|request)\s*\(\s*(?:url\s*:\s*)?([^,)]+)|(?:\$client|client)->(request|get|post|put|delete|patch)\s*\(\s*([^,)]+)/,de=h.match(lt);if(de){let R=(de[1]||de[3]).toUpperCase(),M=(de[2]||de[4]).trim();(M.startsWith("'")&&M.endsWith("'")||M.startsWith('"')&&M.endsWith('"'))&&(M=M.substring(1,M.length-1)),s.push({type:"api_route",name:M,direction:"produce",line:g+1,snippet:h,method:R,url:M})}!h.startsWith("#[")&&!h.startsWith("//")&&!h.startsWith("*")&&!r&&(c=[],f=[])}return{nodes:e,events:s}}};var Ce=class{currentRoutePrefix="";parse(n){this.currentRoutePrefix="";let i=[],e=[],s=n.split(`
36
+ `),l=[{indent:-1,name:"root",type:"root"}],m=[],y=/^class\s+([a-zA-Z0-9_]+)/,T=/^async\s+def\s+([a-zA-Z0-9_]+)|^def\s+([a-zA-Z0-9_]+)/,o=/^(?:from\s+([a-zA-Z0-9_\.]+)\s+import|import\s+([a-zA-Z0-9_\.]+))/,p=/^@(.*)/;function a(d){return d.trim().split(/[.(]/)[0]?.trim()||d}function c(d){let w=d.decorators.map(N=>a(N.raw)),C={decorators:d.decorators,decoratorNames:w};return d.async===!0&&(C.async=!0),d.accessor&&(C.accessor=d.accessor),d.contextmanager===!0&&(C.contextmanager=!0),JSON.stringify(C)}function f(d,w){return(d.match(new RegExp(`\\${w}`,"g"))||[]).length}function r(d){let w=[],C=d,N=0,j=0,q=0,P=!1;do{let z=s[C].trim();if(w.push(z),N+=f(z,"(")-f(z,")"),j+=f(z,"[")-f(z,"]"),q+=f(z,"{")-f(z,"}"),P=z.endsWith("\\"),C+1>=s.length||N<=0&&j<=0&&q<=0&&!P)break;C+=1}while(!0);return{text:w.join(" "),endIndex:C}}let u=!1,b="",S=[],D=[];for(let d=0;d<s.length;d++){let w=s[d],C=w.trim();if(!C||C.startsWith("#"))continue;let N=/^([a-zA-Z0-9_]+)\s*=\s*(?:APIRouter|Blueprint)\s*\(\s*(?:prefix\s*=\s*)?['"]([^'"]+)['"]/,j=C.match(N);if(j&&(this.currentRoutePrefix=j[2]),u){if(C.endsWith(b)||C.includes(b)){u=!1;let x=C.replace(b,"").trim();x&&S.push(x);let v=l[l.length-1];v.node&&(v.node.doc=S.join(`
37
+ `).trim()),S=[]}else S.push(C);continue}let q=w.search(/\S/),P=w.trim(),z=P.match(/^(['"]{3})/);if(z){let x=z[1],v=l[l.length-1];if(v.node&&!v.node.doc){if(P.substring(3).includes(x)){let k=P.replace(new RegExp(x,"g"),"").trim();v.node.doc=k}else{u=!0,b=x;let k=P.substring(3).trim();k&&S.push(k)}continue}}for(;l.length>1&&l[l.length-1].indent>=q;)l.pop();let W=l[l.length-1],ce=W.type==="root"&&q===0;if(ce&&/^__all__\s*=/.test(P)){let x=r(d),v=[],k=/['"]([^'"]+)['"]/g,F=null;for(;F=k.exec(x.text);)v.push(F[1]);let B={name:"__all__",kind:"ModuleExports",classification:"ExportList",signature:"__all__ = [...]",line:d+1,endLine:x.endIndex+1,doc:"",capabilities:JSON.stringify({exports:v}),members:[]};D.push(B),i.push(B),d=x.endIndex,m=[];continue}let ge=/^([A-Z][A-Z0-9_]*)(?:\s*:\s*[^=]+)?\s*=/,be=ce?P.match(ge):null;if(be){let x=r(d),v=x.text.length>120?`${x.text.slice(0,117)}...`:x.text,k={name:be[1],kind:"VariableDeclaration",classification:"Constant",signature:v,line:d+1,endLine:x.endIndex+1,doc:"",capabilities:"{}",members:[]};D.push(k),i.push(k),d=x.endIndex,m=[];continue}let xe=P.match(p);if(xe){m.push({raw:xe[1].trim(),line:d+1});continue}let le=P.match(y);if(le){let x=le[1],v={name:x,kind:"ClassDeclaration",classification:"Class",signature:`class ${x}`,line:d+1,endLine:d+1,doc:"",capabilities:c({decorators:m}),members:[]};D.push(v),W.node?(W.node.members||(W.node.members=[]),W.node.members.push(v)):i.push(v),l.push({indent:q,name:x,type:"class",node:v}),m=[];continue}let se=P.match(T);if(se){let x=!!se[1],v=se[1]||se[2],k=W.type==="class",F=m.some(A=>/(?:^|\.)contextmanager$/.test(A.raw.trim())),B;m.some(A=>A.raw.trim()==="property")&&(B="getter");for(let A of m){let $=A.raw.trim().match(/^[a-zA-Z_][a-zA-Z0-9_]*\.(setter|deleter)$/);if($){B=$[1];break}}let H=!1,X={};for(let A of m)if(A.raw.match(/(?:app|router)\.(get|post|put|delete|patch|websocket)/)){H=!0;let Y=["get","post","put","delete","patch","websocket"].find(ee=>A.raw.toLowerCase().includes(`.${ee}`))?.toUpperCase()||"GET",oe=A.raw.match(/['"]([^'"]+)['"]/),K=oe?oe[1]:"/";if(this.currentRoutePrefix){let ee=this.currentRoutePrefix.endsWith("/")?this.currentRoutePrefix.slice(0,-1):this.currentRoutePrefix,fe=K.startsWith("/")?K:`/${K}`;K=ee+fe}X={type:"route",method:Y,path:K}}if(H){let A=X.path||"",$=X.method==="WEBSOCKET",Y={name:A||v,kind:$?"WebSocket Route":"HTTP Route",classification:"Service Boundary",signature:`Function: ${v}`,line:d+1,endLine:d+1,doc:"",capabilities:JSON.stringify({handler:k?`${W.name}.${v}`:v,async:x,...X})};D.push(Y),i.push(Y),e.push({type:$?"websocket_route":"api_route",name:A,direction:"consume",line:d+1,snippet:P})}for(let A of m){let $=A.raw.match(/(?:^|\.)receiver\s*\(\s*([a-zA-Z0-9_\.]+)/);$&&e.push({type:"signal",name:$[1].split(".").pop()||$[1],direction:"consume",line:A.line,snippet:`@${A.raw}`})}let pe=m.some(A=>A.raw==="staticmethod"),ae=m.some(A=>A.raw==="classmethod"),ue=`${x?"async ":""}${k?(pe?"@staticmethod ":ae?"@classmethod ":"")+W.name+".":""}${v}`,me=!!B,Q={name:v,kind:me?"PropertyDeclaration":x&&k?"AsyncMethodDeclaration":x?"AsyncFunctionDeclaration":k?"MethodDeclaration":"FunctionDeclaration",classification:me?"Property":k?pe||ae?"Static Method":"Method":"Function",signature:ue,line:d+1,endLine:d+1,doc:"",capabilities:c({decorators:m,async:x,accessor:B,contextmanager:F}),members:[]};D.push(Q),W.node?(W.node.members||(W.node.members=[]),W.node.members.push(Q)):i.push(Q),l.push({indent:q,name:v,type:"function",node:Q}),m=[];continue}let Ee=/^(?:path|re_path|url)\s*\(\s*['"]([^'"]+)['"]/,re=P.match(Ee);if(re){let x=re[1].replace(/^\^/,""),v={name:x,kind:"HTTP Route",classification:"Service Boundary",signature:P.trim(),line:d+1,endLine:d+1,doc:"",capabilities:JSON.stringify({type:"route",method:"GET",path:x})};D.push(v),i.push(v),e.push({type:"api_route",name:x,direction:"consume",line:d+1,snippet:P});continue}let g=/(?:requests|httpx|client|http)\.(get|post|put|delete|patch|request)\s*\(\s*(?:url\s*:\s*)?([^,)]+)/,h=P.match(g);if(h){let x=h[1].toUpperCase(),v=h[2].trim();(v.startsWith("'")&&v.endsWith("'")||v.startsWith('"')&&v.endsWith('"'))&&(v=v.substring(1,v.length-1)),e.push({type:"api_route",name:v,direction:"produce",line:d+1,snippet:P,method:x,url:v})}let _=P.match(o);if(_){let x=_[1]||_[2],v={name:x,kind:"ImportSpecifier",classification:"Dependency",signature:`import ${x}`,line:d+1,endLine:d+1,doc:"",capabilities:JSON.stringify({type:"import",module:x})};D.push(v),i.push(v),m=[];continue}m=[],W.node&&(W.node.endLine=d+1)}return{nodes:D,events:e}}};function Rt(t,n){let i=0,e=!1;for(let s=n;s<t.length;s++){let l=t[s];for(let m of l)if(m==="{")i++,e=!0;else if(m==="}"&&(i--,e&&i<=0))return s+1;if(!e&&s>n&&/[;}]$/.test(l.trim()))return s+1}return Math.min(t.length,n+41)}var rt=[{extension:[".php"],rules:[]},{extension:[".py"],rules:[]},{extension:[".go"],rules:[{regex:/func\s+([a-zA-Z0-9_]+)\(/g,onMatch:t=>({name:t[1],kind:"FunctionDeclaration",classification:"Function",signature:t[0]})},{regex:/func\s+\([^\)]+\)\s+([a-zA-Z0-9_]+)\(/g,onMatch:t=>({name:t[1],kind:"MethodDeclaration",classification:"Method",signature:t[0]})},{regex:/import\s+['"]([^'"]+)['"]/g,onMatch:t=>({name:t[1],kind:"ImportSpecifier",classification:"Dependency",signature:t[0],meta:{type:"import",path:t[1]}})}]},{extension:[".rs"],rules:[{regex:/fn\s+([a-zA-Z0-9_]+)\s*\(/g,onMatch:t=>({name:t[1],kind:"FunctionDeclaration",classification:"Function",signature:t[0]})},{regex:/struct\s+([a-zA-Z0-9_]+)/g,onMatch:t=>({name:t[1],kind:"StructDeclaration",classification:"Class",signature:t[0]})},{regex:/enum\s+([a-zA-Z0-9_]+)/g,onMatch:t=>({name:t[1],kind:"EnumDeclaration",classification:"Class",signature:t[0]})},{regex:/trait\s+([a-zA-Z0-9_]+)/g,onMatch:t=>({name:t[1],kind:"TraitDeclaration",classification:"Class",signature:t[0]})},{regex:/use\s+([a-zA-Z0-9_:]+(?:\s+as\s+[a-zA-Z0-9_]+)?);/g,onMatch:t=>({name:t[1].trim(),kind:"ImportDeclaration",classification:"Dependency",signature:t[0],meta:{type:"import",path:t[1].trim()}})}]},{extension:[".ts",".tsx",".js",".jsx",".mjs",".cjs"],rules:[{regex:/(?:export\s+)?(?:async\s+)?function\s+([a-zA-Z0-9_]+)\s*\(/g,onMatch:t=>({name:t[1],kind:"FunctionDeclaration",classification:"Function"})},{regex:/(?:export\s+)?class\s+([a-zA-Z0-9_]+)/g,onMatch:t=>({name:t[1],kind:"ClassDeclaration",classification:"Class"})},{regex:/(?:export\s+)?interface\s+([a-zA-Z0-9_]+)/g,onMatch:t=>({name:t[1],kind:"InterfaceDeclaration",classification:"Interface"})},{regex:/(?:export\s+)?const\s+([a-zA-Z0-9_]+)\s*=/g,onMatch:t=>({name:t[1],kind:"VariableDeclaration",classification:"Constant"})},{regex:/import\s+.*\s+from\s+['"]([^'"]+)['"]/g,onMatch:t=>({name:t[1],kind:"ImportDeclaration",classification:"Dependency",meta:{path:t[1]}})}]}];function Ct(t,n){let i=[];if(t===".go"&&n.some(e=>e.kind==="TypeDeclaration")&&i.push("Go type"),t===".rs"&&(n.some(e=>e.kind==="TraitDeclaration")&&i.push("Rust trait"),n.some(e=>e.kind==="StructDeclaration")&&i.push("Rust struct"),n.some(e=>e.kind==="EnumDeclaration")&&i.push("Rust enum")),t===".py"){for(let e of n)if(e.capabilities)try{if(JSON.parse(e.capabilities).decoratorNames?.length){i.push("Python decorators");break}}catch{}n.some(e=>e.kind==="AsyncFunctionDeclaration"||e.kind==="AsyncMethodDeclaration")&&i.push("Async")}return i}var Te=class{phpParser=new Re;pythonParser=new Ce;treeSitterParser=new Me;supports(n){return rt.some(i=>i.extension.includes(n.toLowerCase()))}async parse(n,i){let e=$e.extname(n).toLowerCase(),s=[],l=[];if(e===".php"||e===".py"||e===".go"||e===".rs"){if(e===".py"){let o=this.pythonParser.parse(i);s=o.nodes,l=o.events}else if(e===".php"){let o=n.toLowerCase().endsWith("api.php"),p=this.phpParser.parse(i,o);s=p.nodes,l=p.events}else try{s=await this.treeSitterParser.parse(n,i)}catch{}if(s.length>0){let o=e===".php"?"Micro IR (PHP/TS) ":e===".py"?"Micro IR (Python/TS) ":e===".go"?"Micro IR (Go/TS) ":"Micro IR (Rust/TS) ",p=s.filter(r=>r.classification!=="Dependency"),a=s.filter(r=>r.classification==="Dependency"),c=Ct(e,s),f=ye({classification:o,capabilities:c,exports:p.map(r=>({name:r.name,kind:r.kind,classification:r.classification})),fileName:$e.basename(n)});return{exports:p,imports:a.map(r=>({module:r.name,name:r.name,kind:r.kind,classification:r.classification})),events:l,classification:o,summary:f||`${e.substring(1).toUpperCase()} module`,parseStatus:"success"}}}let m=rt.find(o=>o.extension.includes(e));if(!m)return{exports:[],imports:[],classification:"Unknown",summary:"",parseStatus:"failed",parseError:`Unsupported file extension: ${e}`};let y=i.split(`
38
+ `);for(let o of m.rules){o.regex.lastIndex=0;let p;for(;(p=o.regex.exec(i))!==null;){let a=o.onMatch(p),c=i.substring(0,p.index).split(`
39
+ `).length,f=Rt(y,c-1);s.push({name:a.name||"anonymous",kind:a.kind||"Unknown",classification:a.classification||"Other",signature:a.signature||p[0],line:c,endLine:f,doc:"",capabilities:JSON.stringify(a.meta||{})})}}let T=ye({classification:`Micro IR (${e.substring(1).toUpperCase()})`,capabilities:[],exports:s.map(o=>({name:o.name,kind:o.kind,classification:o.classification})),fileName:$e.basename(n)});return{exports:s,imports:[],classification:`Micro IR (${e.substring(1).toUpperCase()})`,summary:T||"Module",parseStatus:s.length>0?"success":"partial"}}};import*as Le from"@swc/core";function at(t){if(!t||typeof t!="object")return!1;let n=t;return typeof n.parse=="function"&&typeof n.parseSync=="function"}function Tt(){if(at(Le))return Le;let t=Le;if(at(t.default))return t.default;throw new Error("SWC runtime unavailable: couldn't resolve parse/parseSync from @swc/core exports")}var wt=Tt();function we(t,n,i){return wt.parseSync(t,n,i)}var Ne=new Te;async function vn(t){let n=ct.extname(t);if(Ne.supports(n)&&n!==".ts"&&n!==".tsx")try{let l=await ot.promises.readFile(t,"utf-8");return{...await Ne.parse(t,l),content:l}}catch(l){return ne.error({filePath:t,error:l.message},"HeuristicParser failed"),{exports:[],imports:[],classification:"Unknown",summary:"",content:"",parseStatus:"failed",parseError:l.message}}let i;try{i=await ot.promises.readFile(t)}catch(l){return{exports:[],imports:[],classification:"Error",summary:"",content:"",parseStatus:"failed",parseError:`File read error: ${l.message}`}}let e=i.toString("utf8"),s=Je(e);try{let l=t.endsWith(".tsx"),m=t.endsWith(".d.ts")||t.endsWith(".d.tsx"),y,T={syntax:"typescript",tsx:l,decorators:!0,comments:!0};if(m)try{y=we(e,T)}catch{y=we(e,{...T,isModule:!1})}else y=we(e,T);let o=y.span.start,p=qe(i),a=Ue(e),c=C=>He(C,o,i),f=Ge(y.body),r=Xe(y.body);r.length>0&&ne.debug({filePath:t,count:r.length},"Extracted type references"),r.forEach(C=>{f.push({module:"__type_reference__",name:C})});let u=Ke(y.body,o,i,e,s,a,t,c,p),b=Qe(y.body,o,i,s,c,p),S=ve(t,"","Module"),d=a.length>0&&e.slice(0,a[0].start).trim().length===0?a[0].text:u.find(C=>C.doc)?.doc||"",w=Ve(d);if(!w&&u.length>0){let C=he(e);w=ye({classification:S,capabilities:C,exports:u.map(N=>({name:N.name,kind:N.kind,classification:N.classification})),fileName:ct.basename(t)})}return{exports:u,imports:f,events:b,classification:S,summary:w,content:e,parseStatus:"success"}}catch(l){ne.warn({filePath:t,error:l.message},"SWC parsing failed, using heuristic fallback");try{let m=await Ne.parse(t,e);return{...m,content:e,classification:m.classification+" (Degraded)",parseStatus:"partial",parseError:`SWC failed, used heuristic fallback: ${l.message}`}}catch(m){return ne.error({filePath:t,error:m.message},"All parsing strategies failed"),{exports:[],imports:[],classification:"Error",summary:"",content:e,parseStatus:"failed",parseError:`All parsing strategies failed: ${m.message}`}}}}export{vn as parseFile};
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.7",
2
+ "version": "1.0.9",
3
3
  "toolsByPrefix": {
4
4
  "RECON": {
5
5
  "subcommands": [
@@ -36,15 +36,18 @@
36
36
  "subcommands": [
37
37
  "briefing",
38
38
  "chronicle",
39
+ "claim",
39
40
  "context",
40
41
  "crystallize",
41
42
  "crystallize_theme",
43
+ "dispatch_plan",
42
44
  "graph",
43
45
  "handoff",
44
46
  "handoff_read",
45
47
  "health",
46
48
  "log",
47
49
  "plan",
50
+ "release",
48
51
  "synthesize",
49
52
  "track",
50
53
  "working_set_check"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@precisionutilityguild/liquid-shadow",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Tactical Repository Intelligence Operative - Liquid Shadow Ecosystem",
5
5
  "homepage": "https://liquidshadow.pugcorp.online/",
6
6
  "repository": {