@precisionutilityguild/liquid-shadow 1.0.7 → 1.0.10
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/README.md +3 -3
- package/dist/data/migrations/000_baseline.sql +27 -0
- package/dist/data/migrations/013_file_claims.sql +18 -0
- package/dist/data/migrations/014_tribunal_state.sql +24 -0
- package/dist/data/migrations/015_repo_level_handoffs_nullable.sql +52 -0
- package/dist/data/migrations/016_repair_tribunal_artifact_fk.sql +58 -0
- package/dist/entry/cli/index.js +597 -495
- package/dist/entry/ember/index.js +109 -32
- package/dist/entry/mcp/server.js +443 -347
- package/dist/entry/tribunal/index.js +650 -0
- package/dist/index.js +441 -345
- package/dist/logic/parser/index.js +16 -14
- package/dist/skills/shadow_audit/SKILL.md +22 -30
- package/dist/skills/shadow_chronicle/SKILL.md +16 -29
- package/dist/skills/shadow_continue/SKILL.md +37 -53
- package/dist/skills/shadow_coordinate/SKILL.md +46 -0
- package/dist/skills/shadow_crystallize/SKILL.md +13 -27
- package/dist/skills/shadow_mission/SKILL.md +27 -41
- package/dist/skills/shadow_onboard/SKILL.md +26 -35
- package/dist/skills/shadow_research/SKILL.md +15 -23
- package/dist/skills/shadow_sync/SKILL.md +18 -9
- package/dist/skills/shadow_synthesize/SKILL.md +14 -36
- package/dist/skills/shadow_trace_impact/SKILL.md +30 -50
- package/dist/skills/shadow_understand/SKILL.md +37 -52
- package/dist/skills/shadow_workspace/SKILL.md +17 -17
- package/dist/web-manifest.json +16 -6
- package/package.json +1 -1
- package/skills/shadow_audit/SKILL.md +22 -30
- package/skills/shadow_chronicle/SKILL.md +16 -29
- package/skills/shadow_continue/SKILL.md +37 -53
- package/skills/shadow_coordinate/SKILL.md +46 -0
- package/skills/shadow_crystallize/SKILL.md +13 -27
- package/skills/shadow_mission/SKILL.md +27 -41
- package/skills/shadow_onboard/SKILL.md +26 -35
- package/skills/shadow_research/SKILL.md +15 -23
- package/skills/shadow_sync/SKILL.md +18 -9
- package/skills/shadow_synthesize/SKILL.md +14 -36
- package/skills/shadow_trace_impact/SKILL.md +30 -50
- package/skills/shadow_understand/SKILL.md +37 -52
- package/skills/shadow_workspace/SKILL.md +17 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
`),i=[],
|
|
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(n){let t=n.split(`
|
|
2
|
+
`),i=[],e=0;for(let s of t)i.push(e),e+=s.length+1;return i}function w(n,t){for(let i=0;i<t.length;i++)if(t[i+1]>n||i===t.length-1)return i+1;return 1}function Se(n,t){return t.slice(0,n).toString("utf8").length}function qe(n){if(n.toString("utf8").length===n.length)return e=>e;let i=new Map;return e=>{let s=i.get(e);return s===void 0&&(s=n.slice(0,e).toString("utf8").length,i.set(e,s)),s}}function He(n,t,i){let e=n.start-t,s=n.end-t;return e<0||s>i.length?"":i.slice(e,s).toString("utf8")}function Ue(n){let t=[],i=/\/\*\*[\s\S]*?\*\//g,e;for(;(e=i.exec(n))!==null;)t.push({start:e.index,end:e.index+e[0].length,text:e[0]});return t}function U(n,t,i){for(let e of t){if(e.start===n)return e.text;if(e.start>n&&e.start<n+50){let s=i.substring(n,e.start);if(/^\s*$/.test(s))return e.text}if(e.end<=n&&e.end>n-50){let s=i.substring(e.end,n);if(/^\s*$/.test(s))return e.text}}return""}function Ve(n){if(!n)return"";let i=n.replace(/\/\*\*|\*\/|\*/g,"").trim().split(`
|
|
3
|
+
`)[0].trim();return i.length>200?i.substring(0,197)+"...":i}function ve(n,t,i){let e=n.toLowerCase(),s=t.toLowerCase(),l=e.split("/").pop()||e;return i==="TsInterfaceDeclaration"||i==="TsTypeAliasDeclaration"||i==="TsEnumDeclaration"?"Type Definition":l.startsWith("use")||s.startsWith("use")?"Hook":e.includes("components/")||e.endsWith(".tsx")?"Component":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":"Other"}function ce(n){let t=[];return/\b(fetch|axios|superagent|got)\s*\(|import\s+.*\b(http|https|node-fetch)\b/i.test(n)&&t.push("Network"),(/\b(knex|prisma|typeorm|mongoose|sequelize|pg|mysql|sqlite3)\b/i.test(n)||/\b(SELECT\s+.*FROM|INSERT\s+INTO|UPDATE\s+.*SET|DELETE\s+FROM)\b/i.test(n)||/\.query\s*\(|\.execute\s*\(/i.test(n)&&/db|database|client|pool/i.test(n))&&t.push("Database"),(/\bfs\./i.test(n)||/\b(readFileSync|writeFileSync|readFile|writeFile|readdir)\b/.test(n)||/import\s+.*\bfs\b/.test(n))&&t.push("File System"),(/\b(localStorage|sessionStorage|indexedDB)\./.test(n)||/\bdocument\.cookie\b/.test(n))&&t.push("Browser Storage"),t}function V(n,t){if(!n)return"";let i=n.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 e=0,s=0,l=i.length;for(let y=0;y<i.length;y++){let E=i[y];if(E==="(")e++;else if(E===")")e--;else if(E==="<")s++;else if(E===">")s--;else if(E==="{"){if(e===0&&s===0){l=y;break}}else if(E===";"&&e===0&&s===0){l=y;break}else if(E==="="&&i[y+1]===">"&&e===0&&s===0){l=y+2;break}}let f=i.substring(0,l).trim();return f.length>500?f.slice(0,497)+"...":f}function Ge(n){let t=[];for(let i of n)i.type==="ImportDeclaration"&&t.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"&&t.push({module:i.source.value,name:"*"}),i.type==="ExportNamedDeclaration"&&i.source&&t.push({module:i.source.value,name:i.specifiers.map(e=>e.type==="ExportSpecifier"?e.orig.value:"*").join(", ")});return t}function mt(n,t){for(let i of n){if((i.type==="FunctionDeclaration"||i.type==="ClassDeclaration")&&(i.identifier?.value||i.id?.value)===t)return i.span;if(i.type==="VariableDeclaration"){for(let e of i.declarations)if(e.id?.type==="Identifier"&&e.id.value===t)return e.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 e=i.declaration;if(!e)continue;if((e.type==="FunctionDeclaration"||e.type==="ClassDeclaration")&&(e.identifier?.value||e.id?.value)===t)return e.span||i.span;if(e.type==="VariableDeclaration"){for(let s of e.declarations)if(s.id?.type==="Identifier"&&s.id.value===t)return s.span||e.span||i.span}}}return null}function Ke(n,t,i,e,s,l,f,y,E){let o=E??(a=>Se(a,i)),u=[];for(let a of n){if(a.type==="ExportDeclaration"){let c=a.declaration,m=c.type,r="";m==="VariableDeclaration"?r=c.declarations.map(T=>T.id.value).join("",""):r=c.id?.value||c.identifier?.value||"anonymous";let p=o(a.span.start-t),g=o(a.span.end-t),x=U(p,l,e),S=y(a.span),d=[];if(a.type==="ExportDeclaration"&&(m==="ClassDeclaration"||m==="ClassExpression")){let T=c.body||[];for(let C of T)if(C.type==="ClassMethod"||C.type==="ClassProperty"){let N=C.key.value;if(!N)continue;let J=o(C.span.start-t),q=o(C.span.end-t),A=y(C.span),z=U(J,l,e);d.push({name:N,kind:C.type,signature:V(A,C.type),line:w(J,s),endLine:w(q,s),doc:z,classification:C.type==="ClassMethod"?"Method":"Property",capabilities:"[]"})}}else if(m==="FunctionDeclaration"&&c.body?.type==="BlockStatement")d=Ae(c.body.stmts,t,i,e,s,l,y,o);else if(m==="VariableDeclaration"){for(let T of c.declarations)if(T.init&&(T.init.type==="ArrowFunctionExpression"||T.init.type==="FunctionExpression")&&T.init.body?.type==="BlockStatement"){d=Ae(T.init.body.stmts,t,i,e,s,l,y,o);break}}u.push({name:r,kind:m,signature:V(S,m),line:w(p,s),endLine:w(g,s),doc:x,classification:ve(f,r,m),capabilities:JSON.stringify(ce(S)),members:d})}if(a.type==="ExportNamedDeclaration"){for(let c of a.specifiers)if(c.type==="ExportSpecifier"){let m=c.orig.value,r=c.exported?.value||m,g=mt(n,m)||a.span,x=o(g.start-t),S=o(g.end-t),d=U(x,l,e);u.push({name:r,kind:"ExportSpecifier",signature:`export { ${m} }`,line:w(x,s),endLine:w(S,s),doc:d,classification:"Export mapping",capabilities:"[]"})}}if(a.type==="ExportDefaultDeclaration"){let c=o(a.span.start-t),m=o(a.span.end-t),r=U(c,l,e),p=y(a.span),g=[];if(a.decl.type==="ClassExpression"||a.decl.type==="ClassDeclaration"){let x=a.decl.body||[];for(let S of x)if(S.type==="ClassMethod"||S.type==="ClassProperty"){let d=S.key.value;if(!d)continue;let T=o(S.span.start-t),C=o(S.span.end-t),N=y(S.span),J=U(T,l,e);g.push({name:d,kind:S.type,signature:V(N,S.type),line:w(T,s),endLine:w(C,s),doc:J,classification:S.type==="ClassMethod"?"Method":"Property",capabilities:"[]"})}}else(a.decl.type==="FunctionExpression"||a.decl.type==="FunctionDeclaration"||a.decl.type==="ArrowFunctionExpression")&&a.decl.body?.type==="BlockStatement"&&(g=Ae(a.decl.body.stmts,t,i,e,s,l,y,o));u.push({name:"default",kind:"DefaultExport",signature:V(p,"DefaultExport"),line:w(c,s),endLine:w(m,s),doc:r,classification:"Default Export",capabilities:JSON.stringify(ce(p)),members:g})}if(a.type==="ExportDefaultExpression"){let c=o(a.span.start-t),m=o(a.span.end-t),r=U(c,l,e),p=y(a.span),g=a.expression,x=g?.type==="Identifier"?g.value:g?.identifier?.value||g?.id?.value||void 0;u.push({name:"default",kind:"DefaultExport",signature:V(p,"DefaultExport"),line:w(c,s),endLine:w(m,s),doc:r,classification:"Default Export",capabilities:JSON.stringify(ce(p)),members:[],defaultTarget:x})}if(a.type==="ExportAllDeclaration"){let c=o(a.span.start-t),m=o(a.span.end-t),r=a.source.value,p=U(c,l,e);u.push({name:"*",kind:"ExportAllDeclaration",signature:`export * from "${r}"`,line:w(c,s),endLine:w(m,s),doc:p,classification:"Re-export",capabilities:"[]"})}}return u}function Ae(n,t,i,e,s,l,f,y){let E=[];for(let o of n){if(o.type==="VariableDeclaration")for(let u 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 p of r.elements)p&&c(p);else if(r.type==="ObjectPattern")for(let p of r.properties)p.type==="AssignmentPatternProperty"?a.push({name:p.key.value,span:p.span}):p.type==="KeyValuePatternProperty"&&c(p.value)};c(u.id);let m=u.init&&(u.init.type==="ArrowFunctionExpression"||u.init.type==="FunctionExpression");for(let r of a){let p=m?u.init.span||u.span||r.span:u.span||r.span,g=m?u.init.type:"VariableDeclaration",x=m?"Internal Function":"Internal Variable",S=y(p.start-t),d=y(p.end-t),T=f(p),C=U(S,l,e);E.push({name:r.name,kind:g,signature:V(T,g),line:w(S,s),endLine:w(d,s),doc:C,classification:x,capabilities:"[]"})}}if(o.type==="FunctionDeclaration"){let u=o.identifier?.value||o.ident?.value||"anonymous",a=y(o.span.start-t),c=y(o.span.end-t),m=f(o.span),r=U(a,l,e);E.push({name:u,kind:"FunctionDeclaration",signature:V(m,"FunctionDeclaration"),line:w(a,s),endLine:w(c,s),doc:r,classification:"Internal Function",capabilities:"[]"})}if(o.type==="ReturnStatement"&&o.argument?.type==="ObjectExpression")for(let u of o.argument.properties){let a="",c=u.span||u.key?.span||u.ident?.span;if(u.type==="KeyValueProperty"){let m=u.key;a=m?.value||m?.raw||(m?.type==="Identifier"?m.value:"")}else u.type==="MethodProperty"?a=u.key?.value||u.key?.raw||"":u.type==="ShorthandProperty"?a=u.ident?.value||"":u.type==="Identifier"&&(a=u.value||"");if(a&&c){let m=y(c.start-t),r=y(c.end-t),p=f(c),g=U(m,l,e);E.push({name:a,kind:"ReturnProperty",signature:V(p,"ReturnProperty"),line:w(m,s),endLine:w(r,s),doc:g,classification:"Return Member",capabilities:"[]"})}}if(o.type==="ExpressionStatement"&&o.expression.type==="CallExpression"){let u=o.expression;if(u.callee.type==="MemberExpression"&&(u.callee.property?.value==="on"||u.callee.property?.value==="once")){let a=u.arguments[0]?.expression?.value,c=u.arguments[1]?.expression;if(a&&c&&(c.type==="ArrowFunctionExpression"||c.type==="FunctionExpression")){let m=y(c.span.start-t),r=y(c.span.end-t),p=f(c.span);E.push({name:`on:${a}`,kind:c.type,signature:V(p,c.type),line:w(m,s),endLine:w(r,s),doc:"",classification:"Event Handler",capabilities:"[]"})}}if(u.callee.type==="Identifier"&&u.callee.value==="addRoute"&&u.arguments.length>=3){let a=u.arguments[2].expression;if(a.type==="StringLiteral"){let c=a.value,m=y(u.span.start-t),r=y(u.span.end-t),p=f(u.span);E.push({name:c,kind:"HTTP Route",signature:V(p,"HTTP Route"),line:w(m,s),endLine:w(r,s),doc:"",classification:"Service Boundary",capabilities:JSON.stringify({path:c})})}}}}return E}function Qe(n,t,i,e,s,l){let f=l??(o=>Se(o,i)),y=[];function E(o){if(!(!o||typeof o!="object")){if(o.type==="CallExpression"){let u=ft(o);if(u){let a=f(o.span.start-t);y.push({...u,line:w(a,e),snippet:s(o.span)})}}for(let u of Object.keys(o)){if(u==="span")continue;let a=o[u];Array.isArray(a)?a.forEach(E):typeof a=="object"&&E(a)}}}return n.forEach(E),y}function ft(n){let{callee:t,arguments:i}=n;if(!i||i.length===0)return null;if(t.type==="Identifier"&&t.value,t.type==="Identifier"&&t.value==="addRoute"&&i.length>=3){let e=i[2].expression;if(e.type==="StringLiteral")return{type:"api_route",name:e.value,direction:"consume"}}if(t.type==="MemberExpression"&&t.property?.type==="Identifier"){let e=t.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,f=t.object.type==="Identifier"?t.object.value:"";if(["axios","http","request","appApi","restApi","adminApi","client"].includes(f))return{type:"api_route",name:l,direction:"produce"};if(l.startsWith("/"))return{type:"api_route",name:l,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 ye(n){let{classification:t,capabilities:i,exports:e,fileName:s}=n,l={Network:"API integration",Database:"data persistence","File System":"file I/O operations","Browser Storage":"client-side storage"},f=i.map(r=>l[r]).filter(Boolean).join(" and "),E={Component:(r,p)=>{let g=p.find(S=>S.kind==="FunctionDeclaration"||S.kind==="ClassDeclaration")?.name,x=g?`React component: ${g}`:"React UI component";return r?`${x} with ${r}`:x},Hook:(r,p)=>{let g=p.find(S=>S.name.startsWith("use"))?.name,x=g?`Custom React hook: ${g}`:"Custom React hook";return r?`${x} for ${r}`:x},Service:(r,p)=>{let x=`Service layer: ${p[0]?.name||"Service"}`;return r?`${x} handling ${r}`:x},Repository:(r,p)=>`Data repository: ${p[0]?.name||"Repository"} for ${r||"data access"}`,"Type Definition":(r,p)=>`Type definitions: ${p.slice(0,3).map(x=>x.name).join("")}${p.length>3?"...":""}`,Model:(r,p)=>`Data model: ${p[0]?.name||"Model"}`,"HTTP Route":(r,p)=>{let g=p.filter(x=>x.classification==="Service Boundary");return g.length>0?`API endpoints: ${g.slice(0,3).map(x=>x.name).join("")}`:"API route handler"},"Micro IR (PHP)":(r,p)=>{let g=p.some(S=>S.classification==="Service Boundary"),x=p.find(S=>S.kind==="ClassDeclaration")?.name;return g?"PHP controller with API routes":x?`PHP class: ${x}`:"PHP module"},"Micro IR (Python)":(r,p)=>{let g=p.some(S=>S.classification==="Service Boundary"),x=p.find(S=>S.kind==="ClassDeclaration")?.name;return g?"Python API handler with routes":x?`Python class: ${x}`:"Python module"},"Micro IR (Go/TS) ":(r,p)=>{let g=p.some(S=>S.kind==="TypeDeclaration"),x=p.filter(S=>S.kind==="FunctionDeclaration");return g&&x.length>0?`Go package: types and ${x.length} function(s)`:g?"Go package: type definitions":x.length>0?`Go package: ${x[0].name} and ${x.length} function(s)`:"Go module"},"Micro IR (Rust/TS) ":(r,p)=>{let g=p.find(d=>d.kind==="TraitDeclaration")?.name,x=p.find(d=>d.kind==="StructDeclaration")?.name,S=p.filter(d=>d.kind==="FunctionDeclaration");return g?r.includes("Rust trait")?`Rust module: trait ${g}`:`Rust module: ${g}`:x?`Rust module: struct ${x}`:S.length>0?`Rust module: ${S.length} function(s)`:"Rust module"}}[t];if(E)return E(f,e);if(e.length===0)return s?`Module: ${s}`:"Module with no exports";let o=e.filter(r=>r.kind==="FunctionDeclaration"),u=e.filter(r=>r.kind==="ClassDeclaration"),a=e.filter(r=>r.kind==="TsInterfaceDeclaration"||r.kind==="TsTypeAliasDeclaration"),c=[];if(u.length>0&&c.push(`Class: ${u[0].name}`),o.length>0){let r=o.slice(0,2).map(p=>p.name).join("");c.push(`Functions: ${r}`)}a.length>0&&c.push(`Types: ${a.length}`);let m=c.length>0?c.join(" | "):`Module with ${e.length} export(s)`;return f?`${m} \u2014 ${f}`:m}function Xe(n){let t=new Set;function i(e){if(!(!e||typeof e!="object")){e.typeAnnotation&&I(e.typeAnnotation,t),(e.type==="TsTypeReference"||e.type==="TsTypeAnnotation")&&I(e,t);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 n.forEach(e=>i(e)),Array.from(t)}function I(n,t){if(n){if(n.type==="TsTypeAnnotation"){I(n.typeAnnotation,t);return}n.type==="TsTypeReference"&&(n.typeName?.type==="Identifier"&&t.add(n.typeName.value),n.typeName?.type==="TsQualifiedName"&&Ye(n.typeName,t),n.typeParams&&I(n.typeParams,t)),n.type==="TsArrayType"&&I(n.elementType,t),n.type==="TsUnionType"&&n.types?.forEach(i=>I(i,t)),n.type==="TsIntersectionType"&&n.types?.forEach(i=>I(i,t)),n.type==="TsTupleType"&&n.elemTypes?.forEach(i=>I(i.ty,t)),(n.type==="TsFunctionType"||n.type==="TsConstructorType")&&(n.params?.forEach(i=>I(i.typeAnnotation,t)),n.typeAnnotation&&I(n.typeAnnotation,t)),n.type==="TsTypeParameterDeclaration"&&n.params?.forEach(i=>{i.constraint&&I(i.constraint,t),i.default&&I(i.default,t)}),n.type==="TsTypeParameterInstantiation"&&n.params?.forEach(i=>I(i,t)),n.type==="TsMappedType"&&n.typeAnnotation&&I(n.typeAnnotation,t),n.type==="TsIndexedAccessType"&&(I(n.objectType,t),I(n.indexType,t)),n.type==="TsConditionalType"&&(I(n.checkType,t),I(n.extendsType,t),I(n.trueType,t),I(n.falseType,t)),n.type==="TsTypeLiteral"&&n.members?.forEach(i=>{i.typeAnnotation&&I(i.typeAnnotation,t)})}}function Ye(n,t){n.type==="TsQualifiedName"?(n.left&&Ye(n.left,t),n.right?.value&&t.add(n.right.value)):n.type==="Identifier"&&t.add(n.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(n,t){return{level:n,severity:ht[t]??"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 Dt=gt(import.meta.url),et=Ie(Dt);function St(){let n=et;for(;n!==Ie(n);){if(xt(tt(n,"package.json")))return n;n=Ie(n)}return bt(et,"..","..")}function nt(...n){return tt(St(),...n)}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 t=ie.Parser||ie;await t.init(),this.parser=new t}async getLanguage(t){if(this.languages.has(t))return this.languages.get(t);let i=nt("resources","grammars",`tree-sitter-${this.getLangName(t)}.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(t,e),e}catch(e){return it.error({err:e,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`
|
|
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
|
|
28
|
-
`),
|
|
29
|
-
`),
|
|
30
|
-
`).trim(),capabilities:JSON.stringify(
|
|
31
|
-
`).trim(),capabilities:JSON.stringify({attributes:
|
|
32
|
-
`).trim(),capabilities:JSON.stringify({attributes:
|
|
33
|
-
`).trim()
|
|
34
|
-
`)
|
|
35
|
-
`).trim()),
|
|
36
|
-
`)
|
|
37
|
-
`).
|
|
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 e=st.extname(t).toLowerCase(),s=await this.getLanguage(e);if(!s||!this.parser)return[];this.parser.setLanguage(s);let l=this.parser.parse(i),f=i.split(`
|
|
28
|
+
`),y=this.getQueries(e);if(!y)return[];let o=new ie.Query(s,y).matches(l.rootNode),u=[];for(let a of o){let c=a.captures.find(p=>p.name==="name")?.node,m=a.captures[0].node,r=a.captures[0].name;if(c){let p=m.startPosition.row+1,g=m.endPosition.row+1,x=f[m.startPosition.row].trim();u.push({name:c.text,kind:this.mapKind(r,e),classification:this.mapClassification(r),signature:x,line:p,endLine:g,doc:"",capabilities:"{}"})}}return u}};var Re=class{parse(t,i=!1){let e=[],s=[],l=t.split(`
|
|
29
|
+
`),f="",y="",E=0,o=0,u=-1,a=-1,c=[],m=[],r=!1,p=i?"api":"",g="",x=/^namespace\s+([a-zA-Z0-9_\\]+);/,S=/^(?:abstract\s+)?(?:readonly\s+)?class\s+([a-zA-Z0-9_]+)/,d=/^interface\s+([a-zA-Z0-9_]+)/,T=/^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_]+))?;/,A=/^#\[([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*)?['"]([^'"]+)['"]/,le=/\$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(b){try{let h=JSON.parse(b||"{}");if(h&&typeof h=="object"&&!Array.isArray(h))return h}catch{}return{}}function pe(b,h){let _=[],D=b,v=0,k=0;for(;D<l.length;){let F=l[D].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;D+=1}return{text:_.join(" "),endIndex:D}}function se(b,h){let _=h.replace(/^[^=]+=\s*/,"").replace(/;$/,"").trim();if(b==="casts"){let F={},B=/['"]([^'"]+)['"]\s*=>\s*['"]([^'"]+)['"]/g,H=null;for(;H=B.exec(_);)F[H[1]]=H[2];return F}let D=[],v=/['"]([^'"]+)['"]/g,k=null;for(;k=v.exec(_);)D.push(k[1]);return D}function we(b,h){for(let _=h;_>=0;_-=1){let D=b[_]?.trim()||"";if(D)return D}return""}function re(b,h,_,D){if(!f)return;let v=h.split("\\").pop()||h;s.push({type:"eloquent_relation",name:v,direction:"produce",line:_,snippet:D,method:b,url:`${f}->${v}`})}for(let b=0;b<l.length;b++){let h=l[b].trim();if(!h)continue;let _=(h.match(/{/g)||[]).length,D=(h.match(/}/g)||[]).length,v=o;if(o+=_-D,y&&o<=a){let R=e.find(M=>M.name===y&&M.line===E);R&&(R.endLine=b+1),y="",a=-1}if(f&&o<=u){let R=e.find(M=>M.name===f&&(M.kind==="ClassDeclaration"||M.kind==="TraitDeclaration"||M.kind==="InterfaceDeclaration"||M.kind==="EnumDeclaration"));R&&(R.endLine=b+1),f="",u=-1}let k=h.match(W);if(k&&(p=k[1]),h.includes("});")&&(p=""),h.startsWith("/**")){r=!0,m=[];continue}if(r){h.endsWith("*/")?r=!1:m.push(h.replace(/^\*\s?/,""));continue}let F=h.match(A);if(F){c.push(F[1]);continue}let B=h.match(x);if(B){g=B[1]||"",c=[],m=[];continue}let H=h.match(S);if(H){f=H[1],u=o-_;let R={attributes:c};g&&(R.namespace=g),e.push({name:f,kind:"ClassDeclaration",classification:"Class",signature:`class ${f}`,line:b+1,endLine:b+1,doc:m.join(`
|
|
30
|
+
`).trim(),capabilities:JSON.stringify(R),members:[]}),c=[],m=[];continue}let X=h.match(d);if(X){let R=X[1];f=R,u=o-_,e.push({name:R,kind:"InterfaceDeclaration",classification:"Interface",signature:`interface ${R}`,line:b+1,endLine:b+1,doc:m.join(`
|
|
31
|
+
`).trim(),capabilities:JSON.stringify({attributes:c}),members:[]}),c=[],m=[];continue}let ue=h.match(T);if(ue){let R=ue[1];f=R,u=o-_,e.push({name:R,kind:"TraitDeclaration",classification:"Trait",signature:`trait ${R}`,line:b+1,endLine:b+1,doc:m.join(`
|
|
32
|
+
`).trim(),capabilities:JSON.stringify({attributes:c}),members:[]}),c=[],m=[];continue}let ae=h.match(C);if(ae){let R=ae[1],M=ae[2]||null;f=R,u=o-_;let Z={attributes:c,backedType:M};g&&(Z.namespace=g),e.push({name:R,kind:"EnumDeclaration",classification:"Enum",signature:M?`enum ${R}: ${M}`:`enum ${R}`,line:b+1,endLine:b+1,doc:m.join(`
|
|
33
|
+
`).trim(),capabilities:JSON.stringify(Z),members:[]}),c=[],m=[];continue}let me=h.match(N);if(me){let R=(me[1]||"").trim(),M=me[2],Z=!!f,O=/\bprivate\b/.test(R)?"private":/\bprotected\b/.test(R)?"protected":"public",L=/\bstatic\b/.test(R),G=pe(b,")"),te=G.text.match(/\)\s*:\s*([?a-zA-Z0-9_\\|]+)/),De=te?te[1]:null,pt=_>0&&D>=_;y=M,E=b+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=m.join(`
|
|
34
|
+
`).trim();if(We){let j=_e.path||"/";e.push({name:j,kind:"HTTP Route",classification:"Service Boundary",signature:`Function: ${M}`,line:b+1,endLine:b+1,doc:ze,capabilities:JSON.stringify({type:"route",handler:f?`${f}@${M}`:M,..._e})}),s.push({type:"api_route",name:j,direction:"consume",line:b+1,snippet:h})}let Ze={name:M,kind:Z?"MethodDeclaration":"FunctionDeclaration",classification:Z?"Method":"Function",signature:`${Z?f+":: ":""}${M}`,line:b+1,endLine:b+1,doc:ze,capabilities:JSON.stringify(Z?{attributes:c,visibility:O,static:L,returnType:De}:{attributes:c,returnType:De})};e.push(Ze);let ke=Z?h.match(le):null;if(ke&&re(ke[1],ke[2],b+1,h),Z&&M==="__construct"){let j=null;for(;j=ge.exec(G.text);){let Be=j[1],Oe=!!j[2],Pe=j[4]?`${j[3]?"?":""}${j[4]}`:null,Je=j[5],ut=`${Be} ${Oe?"readonly ":""}${Pe?`${Pe} `:""}$${Je}`.trim();e.push({name:Je,kind:"PropertyDeclaration",classification:"Property",signature:ut,line:b+1,endLine:b+1,doc:"",capabilities:JSON.stringify({visibility:Be,static:!1,readonly:Oe,type:Pe}),members:[]})}ge.lastIndex=0}pt&&(Ze.endLine=b+1,y="",a=-1),c=[],m=[];continue}let fe=!1,Q=!1,P=b,$=f&&!y?h.match(J):null;if($){fe=!0;let R=$[1],M=!!$[2],Z=!!$[3],O=$[5]?`${$[4]?"?":""}${$[5]}`:null,L=$[6],G=`${R} ${M?"static ":""}${Z?"readonly ":""}${O?`${O} `:""}$${L}`.trim();e.push({name:L,kind:"PropertyDeclaration",classification:"Property",signature:G,line:b+1,endLine:b+1,doc:m.join(`
|
|
35
|
+
`).trim(),capabilities:JSON.stringify({visibility:R,static:M,readonly:Z,type:O}),members:[]})}let Y=f&&!y?h.match(be):null;if(Y){Q=!0;let R=Y[1],M=pe(b,";");P=M.endIndex;let Z=se(R,M.text),O=[...e].reverse().find(L=>L.name===f&&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(fe||Q){Q&&P>b&&(b=P),c=[],m=[];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:b+1,endLine:b+1,doc:"",capabilities:JSON.stringify({type:"use",namespace:R})}),c=[],m=[];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(p){let te=p.startsWith("/")?p:`/${p}`,De=M.startsWith("/")?M:`/${M}`;M=(te+De).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 G=h;!h.endsWith(");")&&b+1<l.length&&(G+=" "+l[b+1].trim(),!G.endsWith(");")&&b+2<l.length&&(G+=" "+l[b+2].trim())),e.push({name:M,kind:"HTTP Route",classification:"Service Boundary",signature:G,line:b+1,endLine:b+1,doc:"",capabilities:JSON.stringify({type:"route",method:R,path:M,handler:O})}),s.push({type:"api_route",name:M,direction:"consume",line:b+1,snippet:G,method:R,url:M}),m=[];continue}}let ee=f&&y?h.match(le):null,de=f&&y?h.match(Fe):null;if(ee)re(ee[1],ee[2],b+1,h);else if(de){let R=we(l,b-1);/\$this\b/.test(R)&&re(de[1],de[2],b+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*([^,)]+)/,he=h.match(lt);if(he){let R=(he[1]||he[3]).toUpperCase(),M=(he[2]||he[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:b+1,snippet:h,method:R,url:M})}!h.startsWith("#[")&&!h.startsWith("//")&&!h.startsWith("*")&&!r&&(c=[],m=[])}return{nodes:e,events:s}}};var Ce=class{currentRoutePrefix="";parse(t){this.currentRoutePrefix="";let i=[],e=[],s=t.split(`
|
|
36
|
+
`),l=[{indent:-1,name:"root",type:"root"}],f=[],y=/^class\s+([a-zA-Z0-9_]+)/,E=/^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_\.]+))/,u=/^@(.*)/;function a(d){return d.trim().split(/[.(]/)[0]?.trim()||d}function c(d){let T=d.decorators.map(N=>a(N.raw)),C={decorators:d.decorators,decoratorNames:T};return d.async===!0&&(C.async=!0),d.accessor&&(C.accessor=d.accessor),d.contextmanager===!0&&(C.contextmanager=!0),JSON.stringify(C)}function m(d,T){return(d.match(new RegExp(`\\${T}`,"g"))||[]).length}function r(d){let T=[],C=d,N=0,J=0,q=0,A=!1;do{let z=s[C].trim();if(T.push(z),N+=m(z,"(")-m(z,")"),J+=m(z,"[")-m(z,"]"),q+=m(z,"{")-m(z,"}"),A=z.endsWith("\\"),C+1>=s.length||N<=0&&J<=0&&q<=0&&!A)break;C+=1}while(!0);return{text:T.join(" "),endIndex:C}}let p=!1,g="",x=[],S=[];for(let d=0;d<s.length;d++){let T=s[d],C=T.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]),p){if(C.endsWith(g)||C.includes(g)){p=!1;let D=C.replace(g,"").trim();D&&x.push(D);let v=l[l.length-1];v.node&&(v.node.doc=x.join(`
|
|
37
|
+
`).trim()),x=[]}else x.push(C);continue}let q=T.search(/\S/),A=T.trim(),z=A.match(/^(['"]{3})/);if(z){let D=z[1],v=l[l.length-1];if(v.node&&!v.node.doc){if(A.substring(3).includes(D)){let k=A.replace(new RegExp(D,"g"),"").trim();v.node.doc=k}else{p=!0,g=D;let k=A.substring(3).trim();k&&x.push(k)}continue}}for(;l.length>1&&l[l.length-1].indent>=q;)l.pop();let W=l[l.length-1],le=W.type==="root"&&q===0;if(le&&/^__all__\s*=/.test(A)){let D=r(d),v=[],k=/['"]([^'"]+)['"]/g,F=null;for(;F=k.exec(D.text);)v.push(F[1]);let B={name:"__all__",kind:"ModuleExports",classification:"ExportList",signature:"__all__ = [...]",line:d+1,endLine:D.endIndex+1,doc:"",capabilities:JSON.stringify({exports:v}),members:[]};S.push(B),i.push(B),d=D.endIndex,f=[];continue}let ge=/^([A-Z][A-Z0-9_]*)(?:\s*:\s*[^=]+)?\s*=/,be=le?A.match(ge):null;if(be){let D=r(d),v=D.text.length>120?`${D.text.slice(0,117)}...`:D.text,k={name:be[1],kind:"VariableDeclaration",classification:"Constant",signature:v,line:d+1,endLine:D.endIndex+1,doc:"",capabilities:"{}",members:[]};S.push(k),i.push(k),d=D.endIndex,f=[];continue}let xe=A.match(u);if(xe){f.push({raw:xe[1].trim(),line:d+1});continue}let pe=A.match(y);if(pe){let D=pe[1],v={name:D,kind:"ClassDeclaration",classification:"Class",signature:`class ${D}`,line:d+1,endLine:d+1,doc:"",capabilities:c({decorators:f}),members:[]};S.push(v),W.node?(W.node.members||(W.node.members=[]),W.node.members.push(v)):i.push(v),l.push({indent:q,name:D,type:"class",node:v}),f=[];continue}let se=A.match(E);if(se){let D=!!se[1],v=se[1]||se[2],k=W.type==="class",F=f.some(P=>/(?:^|\.)contextmanager$/.test(P.raw.trim())),B;f.some(P=>P.raw.trim()==="property")&&(B="getter");for(let P of f){let $=P.raw.trim().match(/^[a-zA-Z_][a-zA-Z0-9_]*\.(setter|deleter)$/);if($){B=$[1];break}}let H=!1,X={};for(let P of f)if(P.raw.match(/(?:app|router)\.(get|post|put|delete|patch|websocket)/)){H=!0;let Y=["get","post","put","delete","patch","websocket"].find(ee=>P.raw.toLowerCase().includes(`.${ee}`))?.toUpperCase()||"GET",oe=P.raw.match(/['"]([^'"]+)['"]/),K=oe?oe[1]:"/";if(this.currentRoutePrefix){let ee=this.currentRoutePrefix.endsWith("/")?this.currentRoutePrefix.slice(0,-1):this.currentRoutePrefix,de=K.startsWith("/")?K:`/${K}`;K=ee+de}X={type:"route",method:Y,path:K}}if(H){let P=X.path||"",$=X.method==="WEBSOCKET",Y={name:P||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:D,...X})};S.push(Y),i.push(Y),e.push({type:$?"websocket_route":"api_route",name:P,direction:"consume",line:d+1,snippet:A})}for(let P of f){let $=P.raw.match(/(?:^|\.)receiver\s*\(\s*([a-zA-Z0-9_\.]+)/);$&&e.push({type:"signal",name:$[1].split(".").pop()||$[1],direction:"consume",line:P.line,snippet:`@${P.raw}`})}let ue=f.some(P=>P.raw==="staticmethod"),ae=f.some(P=>P.raw==="classmethod"),me=`${D?"async ":""}${k?(ue?"@staticmethod ":ae?"@classmethod ":"")+W.name+".":""}${v}`,fe=!!B,Q={name:v,kind:fe?"PropertyDeclaration":D&&k?"AsyncMethodDeclaration":D?"AsyncFunctionDeclaration":k?"MethodDeclaration":"FunctionDeclaration",classification:fe?"Property":k?ue||ae?"Static Method":"Method":"Function",signature:me,line:d+1,endLine:d+1,doc:"",capabilities:c({decorators:f,async:D,accessor:B,contextmanager:F}),members:[]};S.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}),f=[];continue}let we=/^(?:path|re_path|url)\s*\(\s*['"]([^'"]+)['"]/,re=A.match(we);if(re){let D=re[1].replace(/^\^/,""),v={name:D,kind:"HTTP Route",classification:"Service Boundary",signature:A.trim(),line:d+1,endLine:d+1,doc:"",capabilities:JSON.stringify({type:"route",method:"GET",path:D})};S.push(v),i.push(v),e.push({type:"api_route",name:D,direction:"consume",line:d+1,snippet:A});continue}let b=/(?:requests|httpx|client|http)\.(get|post|put|delete|patch|request)\s*\(\s*(?:url\s*:\s*)?([^,)]+)/,h=A.match(b);if(h){let D=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:A,method:D,url:v})}let _=A.match(o);if(_){let D=_[1]||_[2],v={name:D,kind:"ImportSpecifier",classification:"Dependency",signature:`import ${D}`,line:d+1,endLine:d+1,doc:"",capabilities:JSON.stringify({type:"import",module:D})};S.push(v),i.push(v),f=[];continue}f=[],W.node&&(W.node.endLine=d+1)}return{nodes:S,events:e}}};function Rt(n,t){let i=0,e=!1;for(let s=t;s<n.length;s++){let l=n[s];for(let f of l)if(f==="{")i++,e=!0;else if(f==="}"&&(i--,e&&i<=0))return s+1;if(!e&&s>t&&/[;}]$/.test(l.trim()))return s+1}return Math.min(n.length,t+41)}var rt=[{extension:[".php"],rules:[]},{extension:[".py"],rules:[]},{extension:[".go"],rules:[{regex:/func\s+([a-zA-Z0-9_]+)\(/g,onMatch:n=>({name:n[1],kind:"FunctionDeclaration",classification:"Function",signature:n[0]})},{regex:/func\s+\([^\)]+\)\s+([a-zA-Z0-9_]+)\(/g,onMatch:n=>({name:n[1],kind:"MethodDeclaration",classification:"Method",signature:n[0]})},{regex:/import\s+['"]([^'"]+)['"]/g,onMatch:n=>({name:n[1],kind:"ImportSpecifier",classification:"Dependency",signature:n[0],meta:{type:"import",path:n[1]}})}]},{extension:[".rs"],rules:[{regex:/fn\s+([a-zA-Z0-9_]+)\s*\(/g,onMatch:n=>({name:n[1],kind:"FunctionDeclaration",classification:"Function",signature:n[0]})},{regex:/struct\s+([a-zA-Z0-9_]+)/g,onMatch:n=>({name:n[1],kind:"StructDeclaration",classification:"Class",signature:n[0]})},{regex:/enum\s+([a-zA-Z0-9_]+)/g,onMatch:n=>({name:n[1],kind:"EnumDeclaration",classification:"Class",signature:n[0]})},{regex:/trait\s+([a-zA-Z0-9_]+)/g,onMatch:n=>({name:n[1],kind:"TraitDeclaration",classification:"Class",signature:n[0]})},{regex:/use\s+([a-zA-Z0-9_:]+(?:\s+as\s+[a-zA-Z0-9_]+)?);/g,onMatch:n=>({name:n[1].trim(),kind:"ImportDeclaration",classification:"Dependency",signature:n[0],meta:{type:"import",path:n[1].trim()}})}]},{extension:[".ts",".tsx",".js",".jsx",".mjs",".cjs"],rules:[{regex:/(?:export\s+)?(?:async\s+)?function\s+([a-zA-Z0-9_]+)\s*\(/g,onMatch:n=>({name:n[1],kind:"FunctionDeclaration",classification:"Function"})},{regex:/(?:export\s+)?class\s+([a-zA-Z0-9_]+)/g,onMatch:n=>({name:n[1],kind:"ClassDeclaration",classification:"Class"})},{regex:/(?:export\s+)?interface\s+([a-zA-Z0-9_]+)/g,onMatch:n=>({name:n[1],kind:"InterfaceDeclaration",classification:"Interface"})},{regex:/(?:export\s+)?const\s+([a-zA-Z0-9_]+)\s*=/g,onMatch:n=>({name:n[1],kind:"VariableDeclaration",classification:"Constant"})},{regex:/import\s+.*\s+from\s+['"]([^'"]+)['"]/g,onMatch:n=>({name:n[1],kind:"ImportDeclaration",classification:"Dependency",meta:{path:n[1]}})}]}];function Ct(n,t){let i=[];if(n===".go"&&t.some(e=>e.kind==="TypeDeclaration")&&i.push("Go type"),n===".rs"&&(t.some(e=>e.kind==="TraitDeclaration")&&i.push("Rust trait"),t.some(e=>e.kind==="StructDeclaration")&&i.push("Rust struct"),t.some(e=>e.kind==="EnumDeclaration")&&i.push("Rust enum")),n===".py"){for(let e of t)if(e.capabilities)try{if(JSON.parse(e.capabilities).decoratorNames?.length){i.push("Python decorators");break}}catch{}t.some(e=>e.kind==="AsyncFunctionDeclaration"||e.kind==="AsyncMethodDeclaration")&&i.push("Async")}return i}var Ee=class{phpParser=new Re;pythonParser=new Ce;treeSitterParser=new Me;supports(t){return rt.some(i=>i.extension.includes(t.toLowerCase()))}async parse(t,i){let e=$e.extname(t).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=t.toLowerCase().endsWith("api.php"),u=this.phpParser.parse(i,o);s=u.nodes,l=u.events}else try{s=await this.treeSitterParser.parse(t,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) ",u=s.filter(r=>r.classification!=="Dependency"),a=s.filter(r=>r.classification==="Dependency"),c=Ct(e,s),m=ye({classification:o,capabilities:c,exports:u.map(r=>({name:r.name,kind:r.kind,classification:r.classification})),fileName:$e.basename(t)});return{exports:u,imports:a.map(r=>({module:r.name,name:r.name,kind:r.kind,classification:r.classification})),events:l,classification:o,summary:m||`${e.substring(1).toUpperCase()} module`,parseStatus:"success"}}}let f=rt.find(o=>o.extension.includes(e));if(!f)return{exports:[],imports:[],classification:"Unknown",summary:"",parseStatus:"failed",parseError:`Unsupported file extension: ${e}`};let y=i.split(`
|
|
38
|
+
`);for(let o of f.rules){o.regex.lastIndex=0;let u;for(;(u=o.regex.exec(i))!==null;){let a=o.onMatch(u),c=i.substring(0,u.index).split(`
|
|
39
|
+
`).length,m=Rt(y,c-1);s.push({name:a.name||"anonymous",kind:a.kind||"Unknown",classification:a.classification||"Other",signature:a.signature||u[0],line:c,endLine:m,doc:"",capabilities:JSON.stringify(a.meta||{})})}}let E=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(t)});return{exports:s,imports:[],classification:`Micro IR (${e.substring(1).toUpperCase()})`,summary:E||"Module",parseStatus:s.length>0?"success":"partial"}}};import*as Le from"@swc/core";function at(n){if(!n||typeof n!="object")return!1;let t=n;return typeof t.parse=="function"&&typeof t.parseSync=="function"}function Et(){if(at(Le))return Le;let n=Le;if(at(n.default))return n.default;throw new Error("SWC runtime unavailable: couldn't resolve parse/parseSync from @swc/core exports")}var Tt=Et();function Te(n,t,i){return Tt.parseSync(n,t,i)}var Ne=new Ee;async function vn(n){let t=ct.extname(n);if(Ne.supports(t)&&t!==".ts"&&t!==".tsx")try{let l=await ot.promises.readFile(n,"utf-8");return{...await Ne.parse(n,l),content:l}}catch(l){return ne.error({filePath:n,error:l.message},"HeuristicParser failed"),{exports:[],imports:[],classification:"Unknown",summary:"",content:"",parseStatus:"failed",parseError:l.message}}let i;try{i=await ot.promises.readFile(n)}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=n.endsWith(".tsx"),f=n.endsWith(".d.ts")||n.endsWith(".d.tsx"),y,E={syntax:"typescript",tsx:l,decorators:!0,comments:!0};if(f)try{y=Te(e,E)}catch{y=Te(e,{...E,isModule:!1})}else y=Te(e,E);let o=y.span.start,u=qe(i),a=Ue(e),c=C=>He(C,o,i),m=Ge(y.body),r=Xe(y.body);r.length>0&&ne.debug({filePath:n,count:r.length},"Extracted type references"),r.forEach(C=>{m.push({module:"__type_reference__",name:C})});let p=Ke(y.body,o,i,e,s,a,n,c,u),g=Qe(y.body,o,i,s,c,u),x=ve(n,"","Module"),d=a.length>0&&e.slice(0,a[0].start).trim().length===0?a[0].text:p.find(C=>C.doc)?.doc||"",T=Ve(d);if(!T&&p.length>0){let C=ce(e);T=ye({classification:x,capabilities:C,exports:p.map(N=>({name:N.name,kind:N.kind,classification:N.classification})),fileName:ct.basename(n)})}return{exports:p,imports:m,events:g,classification:x,summary:T,content:e,parseStatus:"success"}}catch(l){ne.warn({filePath:n,error:l.message},"SWC parsing failed, using heuristic fallback");try{let f=await Ne.parse(n,e);return{...f,content:e,classification:f.classification+" (Degraded)",parseStatus:"partial",parseError:`SWC failed, used heuristic fallback: ${l.message}`}}catch(f){return ne.error({filePath:n,error:f.message},"All parsing strategies failed"),{exports:[],imports:[],classification:"Error",summary:"",content:e,parseStatus:"failed",parseError:`All parsing strategies failed: ${f.message}`}}}}export{vn as parseFile};
|
|
@@ -1,43 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: audit
|
|
3
|
-
description:
|
|
3
|
+
description: Audit repository health with Shadow tools. Use when hunting dead code, import cycles, layer drift, orphaned config, structural risks, or when turning audit findings into cleanup work.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Audit
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Use this skill when the goal is repository health, not feature delivery.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Start
|
|
11
11
|
|
|
12
|
-
1.
|
|
13
|
-
2.
|
|
14
|
-
3.
|
|
15
|
-
4. **Layer Integrity** (optional): `shadow_recon_topography` (repoPath) — Detailed layer analysis if hologram summary isn't enough.
|
|
16
|
-
5. **Log Findings**: `shadow_ops_log` (missionId, type: "discovery", content, repoPath).
|
|
17
|
-
6. **Create Cleanup Mission** (optional): `shadow_ops_plan` (name: "Codebase Cleanup", templateId: "refactoring", templateVars, repoPath).
|
|
12
|
+
1. `shadow_ops_context({ repoPath, compact: true })`
|
|
13
|
+
2. `shadow_analyze_debt({ repoPath, mode: "dead-code", confidenceThreshold: "high" })`
|
|
14
|
+
3. `shadow_analyze_debt({ repoPath, mode: "circular-deps" })`
|
|
18
15
|
|
|
19
|
-
##
|
|
16
|
+
## Add depth only when needed
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
| **Layers** | `shadow_recon_topography` — detailed breakdown if needed |
|
|
28
|
-
| **Config Audit** | `shadow_search_config` (kind: "Env", **showUsage: true**) — find orphaned env vars |
|
|
29
|
-
| **Event Mesh** | `shadow_analyze_mesh` (repoPath) — audit all HTTP routes, socket events, pubsub topics |
|
|
30
|
-
| **Type Integrity** | `shadow_analyze_type_graph` (filePath, repoPath) — interface/type inheritance chains |
|
|
31
|
-
| **Theme Patterns** | `shadow_ops_crystallize_theme` (query, repoPath) — recurring issues across missions |
|
|
18
|
+
- `shadow_recon_topography({ repoPath })` for layer drift and boundary violations.
|
|
19
|
+
- `shadow_recon_scout({ repoPath })` for architectural drift and anomalies.
|
|
20
|
+
- `shadow_search_config({ repoPath, kind: "Env", showUsage: true })` for orphaned config and env keys.
|
|
21
|
+
- `shadow_analyze_impact({ repoPath, symbolName, filePath? })` for risky hubs.
|
|
22
|
+
- `shadow_analyze_type_graph({ repoPath, symbolName, filePath? })` when a central interface or base class is involved.
|
|
23
|
+
- `shadow_analyze_mesh({ repoPath, topic, type? })` only when you already have a concrete route or event fragment such as `"/api/"` or `"order."`.
|
|
32
24
|
|
|
33
|
-
##
|
|
25
|
+
## Close the loop
|
|
34
26
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
27
|
+
- `shadow_ops_log({ repoPath, missionId?, type: "discovery", content, filePath?, symbolName? })`
|
|
28
|
+
- `shadow_ops_handoff({ repoPath, missionId?, kind: "debt_scan", findings, risks?, gaps? })`
|
|
29
|
+
- `shadow_ops_plan({ repoPath, name, goal, templateId: "refactoring", workingSet? })`
|
|
38
30
|
|
|
39
|
-
##
|
|
31
|
+
## Rules
|
|
40
32
|
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
33
|
+
- Start with `confidenceThreshold: "high"` and widen only if the user wants a broader sweep.
|
|
34
|
+
- `shadow_ops_crystallize_theme` takes `theme`, not `query`.
|
|
35
|
+
- `shadow_analyze_type_graph` requires `symbolName`.
|
|
@@ -1,40 +1,27 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: chronicle
|
|
3
|
-
description:
|
|
3
|
+
description: Read the repository narrative archive. Use when you need project history, ADR context, recent completed work, release-note material, or a chronological view of architectural changes.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Chronicle
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Use this skill when the answer lives in mission history rather than the current code graph.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Core calls
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
4. **Paginated**: `shadow_ops_chronicle` (limit: 10, offset: 10, repoPath) — Second page.
|
|
12
|
+
- Recent narrative: `shadow_ops_chronicle({ repoPath, limit: 10, format: "markdown" })`
|
|
13
|
+
- Structured output: `shadow_ops_chronicle({ repoPath, format: "json", limit: 50 })`
|
|
14
|
+
- Time window: `shadow_ops_chronicle({ repoPath, since, until })`
|
|
15
|
+
- Branch-scoped history: `shadow_ops_chronicle({ repoPath, branch, limit })`
|
|
16
|
+
- Pagination: `shadow_ops_chronicle({ repoPath, limit, offset })`
|
|
18
17
|
|
|
19
|
-
##
|
|
18
|
+
## Good pairings
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
| **Recent (Markdown)** | `shadow_ops_chronicle` (limit: 10, format: "markdown") |
|
|
24
|
-
| **Time Range** | `shadow_ops_chronicle` (since: <unix>, until: <unix>) |
|
|
25
|
-
| **JSON Data** | `shadow_ops_chronicle` (format: "json", limit: 50) |
|
|
26
|
-
| **Pagination** | `shadow_ops_chronicle` (limit: 10, offset: 10) |
|
|
20
|
+
- `shadow_ops_context({ repoPath, compact: true })` if you also need the current mission landscape.
|
|
21
|
+
- `shadow_ops_graph({ repoPath, missionId, format: "mermaid" })` when a historical mission hierarchy matters.
|
|
27
22
|
|
|
28
|
-
##
|
|
23
|
+
## Notes
|
|
29
24
|
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
## Use Cases
|
|
34
|
-
|
|
35
|
-
- **Onboarding**: Read last 10 entries to catch up
|
|
36
|
-
- **Release Notes**: Get completed missions since last release
|
|
37
|
-
- **ADR Review**: Extract all architectural decisions
|
|
38
|
-
- **Progress Reports**: Show what's been done this week
|
|
39
|
-
|
|
40
|
-
**Note:** Chronicle reads from Git Notes, so it's persistent across branches and clones.
|
|
25
|
+
- `format: "markdown"` is best for humans.
|
|
26
|
+
- `format: "json"` is best when another tool or agent will process the result.
|
|
27
|
+
- Chronicle is backed by Git Notes, so it survives across branches and clones.
|
|
@@ -3,61 +3,45 @@ name: continue
|
|
|
3
3
|
description: Get briefing, pick one mission from next_work_candidates, then work that mission to completion with all remaining steps in one run. Use when continuing work on missions, executing mission steps, or when the user asks to continue work, finish a mission, or proceed with development tasks.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# Continue
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Pick one mission from `next_work_candidates` and finish it end to end.
|
|
9
9
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
- **Option A (one shot):** `shadow_ops_context` (repoPath) → returns hologram + chronicle(5) + **briefing** (counts, **next_work_candidates** ranked by relevance). Use when you want architecture + history + backlog in one call at the start of /continue.
|
|
13
|
-
- **Option B:** `shadow_ops_briefing` (scope: "project", repoPath) → **next_work_candidates** (relevance-ranked), hierarchy, analytics.
|
|
14
|
-
- Use **altitude** to control output density: `orbit` (~200 tokens, counts + candidates only), `atmosphere` (default, strategy + crystals), `ground` (raw logs + working set + collisions).
|
|
15
|
-
- `shadow_sync_trace` (repoPath) only if you care about external changes. Otherwise skip.
|
|
16
|
-
|
|
17
|
-
## 2. Pick one mission
|
|
18
|
-
|
|
19
|
-
- **`next_work_candidates`** are ranked by the MissionRelevanceScorer (recency × 0.4 + activity × 0.3 + status × 0.2 + blockers × 0.1). Higher score = more relevant.
|
|
20
|
-
- Choose the top-ranked candidate. Prefer in-progress over planned. Parent-only missions (umbrellas) are already filtered out.
|
|
21
|
-
|
|
22
|
-
## 3. Work the whole mission
|
|
23
|
-
|
|
24
|
-
- For that mission, run through **all remaining steps** (not just one):
|
|
25
|
-
- **Surgical Discovery:** `shadow_analyze_flow` (symbolName, filePath, repoPath).
|
|
26
|
-
- **Execute Step**: Set in-progress → implement → `shadow_ops_track` (missionId, stepId, status: "completed", contextPivot, repoPath).
|
|
27
|
-
- **Atomic Logging:** At least once per step. `shadow_ops_log` (missionId, type: "decision", content, symbolName, repoPath).
|
|
28
|
-
- **Inter-agent handoff** (multi-agent pipelines only): When handing off findings to another agent, call `shadow_ops_handoff` (missionId, role, summary, findings, repoPath) to persist a typed artifact with embedding. The receiving agent calls `shadow_ops_handoff_read` (missionId, query, repoPath) to semantically retrieve relevant prior handoffs.
|
|
29
|
-
- **Seal the mission**: `shadow_ops_track` (missionId, status: "completed", repoPath).
|
|
30
|
-
- This **auto-triggers**: ADR synthesis, Git Notes persistence, and cascade parent completion (if all sibling missions are also done, the parent auto-completes too).
|
|
31
|
-
- No need to call `shadow_ops_synthesize` separately — it's automatic on completion.
|
|
32
|
-
- **Optional — Crystallize** (for long-running missions with many logs): `shadow_ops_crystallize` (missionId, repoPath) compresses raw intent logs into a single crystal summary. Useful mid-mission to keep briefings lean.
|
|
33
|
-
- **Optional — Theme Crystallize** (cross-mission patterns): `shadow_ops_crystallize_theme` (query, repoPath) clusters semantically related intent logs across ALL missions to surface recurring architectural themes. Use when you sense a pattern repeating across missions.
|
|
34
|
-
|
|
35
|
-
## 🛠 Precise Tooling
|
|
36
|
-
|
|
37
|
-
| Action | Atomic Tool | Example |
|
|
38
|
-
| :--------------------- | :----------------------------- | :--------------------------------------------------------------- |
|
|
39
|
-
| **Context (one shot)** | `shadow_ops_context` | repoPath — hologram + chronicle + briefing |
|
|
40
|
-
| **Briefing** | `shadow_ops_briefing` | scope: "project", altitude: "orbit", repoPath |
|
|
41
|
-
| **Flow Trace** | `shadow_analyze_flow` | symbolName: "handleRequest", filePath, repoPath |
|
|
42
|
-
| **Step Update** | `shadow_ops_track` | missionId: 4, stepId: "s2", status: "completed" |
|
|
43
|
-
| **Intent Log** | `shadow_ops_log` | missionId: 4, type: "fix", content: "..." |
|
|
44
|
-
| **Complete Mission** | `shadow_ops_track` | missionId: 4, status: "completed" — auto-synthesizes ADR |
|
|
45
|
-
| **Crystallize** | `shadow_ops_crystallize` | missionId: 4 — compress logs mid-mission |
|
|
46
|
-
| **Theme Crystallize** | `shadow_ops_crystallize_theme` | query: "auth patterns" — cross-mission semantic clustering |
|
|
47
|
-
| **Handoff (write)** | `shadow_ops_handoff` | missionId, role: "RECON", summary, findings — persist artifact |
|
|
48
|
-
| **Handoff (read)** | `shadow_ops_handoff_read` | missionId, query: "auth findings" — semantic retrieval |
|
|
49
|
-
| **Event Mesh** | `shadow_analyze_mesh` | repoPath — surface all HTTP routes, socket events, pubsub topics |
|
|
50
|
-
| **Type Graph** | `shadow_analyze_type_graph` | filePath, repoPath — interface/type inheritance map |
|
|
51
|
-
| **Explain Diff** | `shadow_analyze_explain_diff` | fromCommit, toCommit, repoPath — semantic diff narrative |
|
|
52
|
-
|
|
53
|
-
_Note: Always use `symbolName` in `shadow_ops_log` to create Liquid Anchors._
|
|
54
|
-
|
|
55
|
-
## 4. Don't
|
|
10
|
+
## Start
|
|
56
11
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
12
|
+
1. `shadow_ops_context({ repoPath, compact: true })` or `shadow_ops_briefing({ repoPath, scope: "project", altitude: "orbit" })`
|
|
13
|
+
2. Pick one leaf mission from `next_work_candidates`. Prefer in-progress over planned.
|
|
14
|
+
3. If there is no candidate, stop and plan new work instead of inventing a mission.
|
|
60
15
|
|
|
61
|
-
|
|
16
|
+
## Work loop
|
|
17
|
+
|
|
18
|
+
- Mark the active step: `shadow_ops_track({ repoPath, missionId, stepId, status: "in-progress" })`
|
|
19
|
+
- If multiple agents may edit the same area, check and claim first:
|
|
20
|
+
- `shadow_working_set_check({ repoPath, filePaths })`
|
|
21
|
+
- `shadow_ops_claim({ repoPath, missionId, filePaths, agentTag? })`
|
|
22
|
+
- Do focused discovery with the relevant search, recon, analyze, and inspect tools.
|
|
23
|
+
- Record at least one meaningful log per step:
|
|
24
|
+
- `shadow_ops_log({ repoPath, missionId, type: "decision" | "discovery" | "fix", content, filePath?, symbolName? })`
|
|
25
|
+
- Mark each finished step:
|
|
26
|
+
- `shadow_ops_track({ repoPath, missionId, stepId, status: "completed", contextPivot? })`
|
|
62
27
|
|
|
63
|
-
|
|
28
|
+
## Finish
|
|
29
|
+
|
|
30
|
+
- Optional handoff for downstream agents:
|
|
31
|
+
- `shadow_ops_handoff({ repoPath, missionId, kind, findings, risks?, gaps?, confidence?, agentTag? })`
|
|
32
|
+
- `shadow_ops_handoff_read({ repoPath, missionId?, kind?, query?, limit? })`
|
|
33
|
+
- Optional review gate, but only after the user explicitly asks for Tribunal or clearly approves it:
|
|
34
|
+
- `shadow_ops_tribunal_submit({ repoPath, missionId })`
|
|
35
|
+
- `shadow_ops_tribunal_status({ repoPath, missionId })`
|
|
36
|
+
- Release any claims you took:
|
|
37
|
+
- `shadow_ops_release({ repoPath, missionId, filePaths? })`
|
|
38
|
+
- Complete the mission:
|
|
39
|
+
- `shadow_ops_track({ repoPath, missionId, status: "completed" })`
|
|
40
|
+
|
|
41
|
+
## Rules
|
|
42
|
+
|
|
43
|
+
- Don't do one step and stop — /continue is "finish a mission," not "do one step."
|
|
44
|
+
- Don't call `shadow_ops_synthesize` after completion unless you are intentionally regenerating the record.
|
|
45
|
+
- Never run Tribunal without explicit user consent.
|
|
46
|
+
- `shadow_ops_handoff` does not take `role` or `summary`; use `kind` plus structured `findings`.
|
|
47
|
+
- `shadow_ops_crystallize_theme` takes `theme`, not `query`.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coordinate
|
|
3
|
+
description: Coordinate multi-agent or parallel work with working-set checks, file claims, dispatch waves, handoffs, and user-approved Tribunal review. Use when several agents may edit at once or when work must be transferred cleanly.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Coordinate
|
|
7
|
+
|
|
8
|
+
Use this skill when execution risk comes from overlap, not code complexity.
|
|
9
|
+
|
|
10
|
+
## Conflict control
|
|
11
|
+
|
|
12
|
+
- `shadow_working_set_check({ repoPath, filePaths })`
|
|
13
|
+
- `shadow_ops_claim({ repoPath, missionId, filePaths, agentTag? })`
|
|
14
|
+
- `shadow_ops_release({ repoPath, missionId, filePaths? })`
|
|
15
|
+
|
|
16
|
+
## Parallel planning
|
|
17
|
+
|
|
18
|
+
- `shadow_ops_dispatch_plan({ repoPath, parentMissionId?, missionIds?, includeClaimCheck: true })`
|
|
19
|
+
- `shadow_ops_graph({ repoPath, missionId, depth?, format: "mermaid" | "json" })`
|
|
20
|
+
|
|
21
|
+
## Handoffs
|
|
22
|
+
|
|
23
|
+
- Write: `shadow_ops_handoff({ repoPath, missionId?, kind, findings, risks?, gaps?, missionsCreated?, confidence?, agentTag? })`
|
|
24
|
+
- Read: `shadow_ops_handoff_read({ repoPath, missionId?, kind?, query?, limit? })`
|
|
25
|
+
|
|
26
|
+
Available `kind` values:
|
|
27
|
+
|
|
28
|
+
- `recon_report`
|
|
29
|
+
- `risk_assessment`
|
|
30
|
+
- `impact_map`
|
|
31
|
+
- `debt_scan`
|
|
32
|
+
- `custom`
|
|
33
|
+
|
|
34
|
+
## Tribunal
|
|
35
|
+
|
|
36
|
+
Never run Tribunal unless the user explicitly asks for it or clearly approves it.
|
|
37
|
+
|
|
38
|
+
- `shadow_ops_tribunal_submit({ repoPath, missionId })`
|
|
39
|
+
- `shadow_ops_tribunal_status({ repoPath, missionId? or sessionId? })`
|
|
40
|
+
|
|
41
|
+
## Rules
|
|
42
|
+
|
|
43
|
+
- Claim only the files you expect to edit.
|
|
44
|
+
- Release claims promptly when the work is done.
|
|
45
|
+
- Tribunal is opt-in only. Treat it as a user-consent gate, not an automatic review step.
|
|
46
|
+
- Handoffs must be structured. There is no `role` or `summary` field.
|