@jokeran/frontend-code-skimmer 0.4.7 → 0.4.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.
Files changed (3) hide show
  1. package/README.md +367 -322
  2. package/dist/index.js +172 -150
  3. package/package.json +51 -50
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import*as Y from'path';import Y__default from'path';import {fileURLToPath}from'url';import {McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import ts from'os';import*as Q from'fs';import Q__default from'fs';import ir,{createHash}from'crypto';import dr from'better-sqlite3';import es from'fast-glob';import {createRequire}from'module';import {z as z$1}from'zod';function ze(o){switch(o){case "template_event":return "template_event";case "jsx_event":return "jsx_event";case "hook_call":return "hook_call";case "import_func":return "import_call";default:return "method_call"}}function w(o){return o.replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/_/g," ").replace(/-/g," ").toLowerCase().trim().replace(/\s+/g," ")}function Ge(o,e){let t=o.length,n=e.length,r=Array.from({length:t+1},(s,i)=>Array.from({length:n+1},(a,c)=>i===0?c:c===0?i:0));for(let s=1;s<=t;s++)for(let i=1;i<=n;i++)o[s-1]===e[i-1]?r[s][i]=r[s-1][i-1]:r[s][i]=1+Math.min(r[s-1][i],r[s][i-1],r[s-1][i-1]);return r[t][n]}function Me(o){return ir.createHash("md5").update(o).digest("hex")}function qe(o){if(!o)return 0;let e=1;for(let t=0;t<o.length;t++)o[t]===`
3
- `&&e++;return e}function ke(o,e){return o===e?`L${o}`:`L${o}-L${e}`}function de(o,e){return Y__default.relative(e,o).replace(/\\/g,"/")}function je(o,e){if(!o)return e;try{return JSON.parse(o)}catch{return e}}function K(o,e){let t=o.split(`
4
- `),r=e-1-1;for(;r>=0&&t[r].trim()==="";)r--;if(r<0||!t[r].trim().endsWith("*/"))return;let s=r;for(;s>0&&!t[s].trim().startsWith("/**");)s--;if(t[s].trim().startsWith("/**"))return t.slice(s,r+1).map(i=>i.replace(/^\s*\*\s?/,"").replace(/\/\*\*/,"").replace(/\*\//,"").trim()).filter(i=>i.length>0).join(" ")}function en(o,e){let t=o.toLowerCase(),n=e.toLowerCase();if(t===n)return 100;if(n.includes(t)||t.includes(n))return 85;let r=Ge(t,n),s=Math.max(t.length,n.length);if(s===0)return 100;let i=Math.max(0,100-r/s*100);return Math.round(i)}function be(o){return o.startsWith("use")&&o.length>3&&/[A-Z]/.test(o[3])}function tn(o,e,t){if(t===0||t>3)return;let n=w(o).split(" "),r=w(e).split(" ");for(let s of n)for(let i of r){let a=Ge(s,i);if(a>0&&a<=3&&s!==i)return `"${s}" \u53EF\u80FD\u662F "${i}" \u7684\u62FC\u5199\u9519\u8BEF (\u7F16\u8F91\u8DDD\u79BB=${a})`}}var ar=[".ts",".tsx",".js",".jsx",".vue"],cr=["index.ts","index.tsx","index.js","index.jsx","index.vue"];function lr(o){return [...ar.map(e=>`${o}${e}`),...cr.map(e=>Y.join(o,e))]}function Ne(o){if(Q.existsSync(o))try{if(Q.statSync(o).isFile())return o}catch{}for(let e of lr(o))if(Q.existsSync(e))return e;return o}var Tt=["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/coverage/**","**/.nuxt/**","**/.next/**","**/__tests__/**","**/docs/js/**","**/public/**/*.js","**/*.test.*","**/*.spec.*","**/*.min.js"],St=["**/*.vue","**/*.js","**/*.jsx","**/*.ts","**/*.tsx"],rn={storage:{localStorage:["setItem","getItem","removeItem","clear","key"],sessionStorage:["setItem","getItem","removeItem","clear","key"],cookie:["cookie"]},network:{axios:["get","post","put","delete","patch","request","create"],fetch:["fetch"],XMLHttpRequest:["open","send"],$http:["get","post","put","delete"]},router:{$router:["push","replace","go","back","forward"],$route:[],useRouter:[],useRoute:[],navigate:[],history:["push","replace","go"]},vuex:{$store:["commit","dispatch","getters","state"],useStore:[],store:["commit","dispatch"]},dom:{document:["querySelector","getElementById","createElement","addEventListener"],window:["addEventListener","removeEventListener","open","close"],$refs:[],$nextTick:[],nextTick:[]},event:{$emit:[],EventBus:["emit","on","off"],dispatchEvent:[],emit:[]},timer:{setTimeout:[],setInterval:[],clearTimeout:[],clearInterval:[],requestAnimationFrame:[]},i18n:{$t:[],useI18n:[],t:[],i18n:["t","tc","te"]}},xt=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured"],At=["onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onActivated","onDeactivated","onErrorCaptured","onRenderTracked","onRenderTriggered","onServerPrefetch"],sn=["ref","reactive","shallowRef","shallowReactive","readonly"],on=["computed"],an=["watch","watchEffect","watchPostEffect","watchSyncEffect"],Lt=["useState","useReducer","useRef","useImperativeHandle"],Rt=["useMemo","useCallback"],kt=["useEffect","useLayoutEffect","useInsertionEffect"],cn=["useContext","useDebugValue","useDeferredValue","useId","useSyncExternalStore","useTransition"],Ye=".skimmer-index.db",ln=30,pn=4,dn=300;var pr=[{version:1,description:"\u5EFA\u7ACB schema_version \u8868",statements:[`CREATE TABLE IF NOT EXISTS schema_version (
2
+ import*as Y from'path';import Y__default from'path';import {fileURLToPath}from'url';import {McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import ys from'os';import*as ne from'fs';import ne__default from'fs';import _r,{createHash}from'crypto';import Lr from'better-sqlite3';import hs from'fast-glob';import {createRequire}from'module';import {z as z$1}from'zod';function Ze(s){switch(s){case "template_event":return "template_event";case "jsx_event":return "jsx_event";case "hook_call":return "hook_call";case "import_func":return "import_call";case "new_call":return "constructor_call";default:return "method_call"}}function v(s){return s.replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/_/g," ").replace(/-/g," ").toLowerCase().trim().replace(/\s+/g," ")}function et(s,e){let t=s.length,n=e.length,r=Array.from({length:t+1},(i,o)=>Array.from({length:n+1},(a,c)=>o===0?c:c===0?o:0));for(let i=1;i<=t;i++)for(let o=1;o<=n;o++)s[i-1]===e[o-1]?r[i][o]=r[i-1][o-1]:r[i][o]=1+Math.min(r[i-1][o],r[i][o-1],r[i-1][o-1]);return r[t][n]}function We(s){return _r.createHash("md5").update(s).digest("hex")}function tt(s){if(!s)return 0;let e=1;for(let t=0;t<s.length;t++)s[t]===`
3
+ `&&e++;return e}function Se(s,e){return s===e?`L${s}`:`L${s}-L${e}`}function ue(s,e){return Y__default.relative(e,s).replace(/\\/g,"/")}function He(s,e){if(!s)return e;try{return JSON.parse(s)}catch{return e}}function V(s,e){let t=s.split(`
4
+ `),r=e-1-1;for(;r>=0&&t[r].trim()==="";)r--;if(r<0||!t[r].trim().endsWith("*/"))return;let i=r;for(;i>0&&!t[i].trim().startsWith("/**");)i--;if(t[i].trim().startsWith("/**"))return t.slice(i,r+1).map(o=>o.replace(/^\s*\*\s?/,"").replace(/\/\*\*/,"").replace(/\*\//,"").trim()).filter(o=>o.length>0).join(" ")}function ln(s,e){let t=s.toLowerCase(),n=e.toLowerCase();if(t===n)return 100;if(n.includes(t)||t.includes(n))return 85;let r=et(t,n),i=Math.max(t.length,n.length);if(i===0)return 100;let o=Math.max(0,100-r/i*100);return Math.round(o)}function xe(s){return s.startsWith("use")&&s.length>3&&/[A-Z]/.test(s[3])}function pn(s,e,t){if(t===0||t>3)return;let n=v(s).split(" "),r=v(e).split(" ");for(let i of n)for(let o of r){let a=et(i,o);if(a>0&&a<=3&&i!==o)return `"${i}" \u53EF\u80FD\u662F "${o}" \u7684\u62FC\u5199\u9519\u8BEF (\u7F16\u8F91\u8DDD\u79BB=${a})`}}var Sr=[".ts",".tsx",".js",".jsx",".vue"],xr=["index.ts","index.tsx","index.js","index.jsx","index.vue"];function Tr(s){return [...Sr.map(e=>`${s}${e}`),...xr.map(e=>Y.join(s,e))]}function Ae(s){if(ne.existsSync(s))try{if(ne.statSync(s).isFile())return s}catch{}for(let e of Tr(s))if(ne.existsSync(e))return e;return s}var It=["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/coverage/**","**/.nuxt/**","**/.next/**","**/__tests__/**","**/docs/js/**","**/public/**/*.js","**/*.test.*","**/*.spec.*","**/*.min.js"],$t=["**/*.vue","**/*.js","**/*.jsx","**/*.ts","**/*.tsx"],un={storage:{localStorage:["setItem","getItem","removeItem","clear","key"],sessionStorage:["setItem","getItem","removeItem","clear","key"],cookie:["cookie"]},network:{axios:["get","post","put","delete","patch","request","create"],fetch:["fetch"],XMLHttpRequest:["open","send"],$http:["get","post","put","delete"]},router:{$router:["push","replace","go","back","forward"],$route:[],useRouter:[],useRoute:[],navigate:[],history:["push","replace","go"]},vuex:{$store:["commit","dispatch","getters","state"],useStore:[],store:["commit","dispatch"]},dom:{document:["querySelector","getElementById","createElement","addEventListener"],window:["addEventListener","removeEventListener","open","close"],$refs:[],$nextTick:[],nextTick:[]},event:{$emit:[],EventBus:["emit","on","off"],dispatchEvent:[],emit:[]},timer:{setTimeout:[],setInterval:[],clearTimeout:[],clearInterval:[],requestAnimationFrame:[]},i18n:{$t:[],useI18n:[],t:[],i18n:["t","tc","te"]}},Pt=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured"],Ft=["onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onActivated","onDeactivated","onErrorCaptured","onRenderTracked","onRenderTriggered","onServerPrefetch"],fn=["ref","reactive","shallowRef","shallowReactive","readonly"],mn=["computed"],gn=["watch","watchEffect","watchPostEffect","watchSyncEffect"],Ot=["useState","useReducer","useRef","useImperativeHandle"],Dt=["useMemo","useCallback"],Mt=["useEffect","useLayoutEffect","useInsertionEffect"],hn=["useContext","useDebugValue","useDeferredValue","useId","useSyncExternalStore","useTransition"],nt=".skimmer-index.db",yn=30,bn=4,En=300;var Ar=[{version:1,description:"\u5EFA\u7ACB schema_version \u8868",statements:[`CREATE TABLE IF NOT EXISTS schema_version (
5
5
  version INTEGER PRIMARY KEY,
6
6
  applied_at INTEGER NOT NULL,
7
7
  description TEXT
@@ -38,11 +38,11 @@ import*as Y from'path';import Y__default from'path';import {fileURLToPath}from'u
38
38
  rel_path TEXT PRIMARY KEY,
39
39
  priority TEXT NOT NULL DEFAULT 'normal',
40
40
  added_at INTEGER NOT NULL
41
- )`,"CREATE INDEX IF NOT EXISTS idx_precise_pending_priority ON precise_pending(priority, added_at)"]}];function un(o){let e=[],t=[];o.exec(`CREATE TABLE IF NOT EXISTS schema_version (
41
+ )`,"CREATE INDEX IF NOT EXISTS idx_precise_pending_priority ON precise_pending(priority, added_at)"]}];function _n(s){let e=[],t=[];s.exec(`CREATE TABLE IF NOT EXISTS schema_version (
42
42
  version INTEGER PRIMARY KEY,
43
43
  applied_at INTEGER NOT NULL,
44
44
  description TEXT
45
- )`);let n=o.prepare("SELECT MAX(version) as v FROM schema_version").get()?.v??0;for(let r of pr){if(r.version<=n)continue;let s=Date.now(),i=true;for(let a of r.statements)try{o.exec(a);}catch(c){let l=String(c);if(l.includes("duplicate column name"))continue;t.push(`v${r.version}: ${l.slice(0,120)}`),i=false;}o.prepare("INSERT OR REPLACE INTO schema_version (version, applied_at, description) VALUES (?, ?, ?)").run(r.version,s,i?r.description:`${r.description} (\u90E8\u5206\u8BED\u53E5\u8DF3\u8FC7)`),e.push(r.version);}return {applied:e,errors:t}}function fr(o,e){let t=Y__default.posix.dirname(e),n=t==="."?[]:t.split("/").map(()=>"..");return Y__default.resolve(Y__default.dirname(o),...n)}function mr(o,e,t){if(!o)return o;if(Y__default.isAbsolute(o)){let n=de(Ne(o),t);return n.startsWith("..")?o.replace(/\\/g,"/"):n}if(o.startsWith(".")){let n=Ne(Y__default.resolve(Y__default.dirname(e),o)),r=de(n,t);return r.startsWith("..")?o.replace(/\\/g,"/"):r}if(o.startsWith("@/")){let n=Ne(Y__default.resolve(t,"src",o.slice(2))),r=de(n,t);return r.startsWith("..")?o.replace(/\\/g,"/"):r}return o.replace(/\\/g,"/")}var Je=class{db;constructor(e,t){let n=t||Y__default.join(e,Ye);Q__default.mkdirSync(Y__default.dirname(n),{recursive:true}),this.db=new dr(n),this.initialize();}initialize(){this.db.pragma("journal_mode = WAL"),this.db.pragma("foreign_keys = ON"),this.db.pragma("synchronous = NORMAL"),this.db.exec(`
45
+ )`);let n=s.prepare("SELECT MAX(version) as v FROM schema_version").get()?.v??0;for(let r of Ar){if(r.version<=n)continue;let i=Date.now(),o=true;for(let a of r.statements)try{s.exec(a);}catch(c){let l=String(c);if(l.includes("duplicate column name"))continue;t.push(`v${r.version}: ${l.slice(0,120)}`),o=false;}s.prepare("INSERT OR REPLACE INTO schema_version (version, applied_at, description) VALUES (?, ?, ?)").run(r.version,i,o?r.description:`${r.description} (\u90E8\u5206\u8BED\u53E5\u8DF3\u8FC7)`),e.push(r.version);}return {applied:e,errors:t}}function wr(s,e){let t=Y__default.posix.dirname(e),n=t==="."?[]:t.split("/").map(()=>"..");return Y__default.resolve(Y__default.dirname(s),...n)}function vr(s,e,t){if(!s)return s;if(Y__default.isAbsolute(s)){let n=ue(Ae(s),t);return n.startsWith("..")?s.replace(/\\/g,"/"):n}if(s.startsWith(".")){let n=Ae(Y__default.resolve(Y__default.dirname(e),s)),r=ue(n,t);return r.startsWith("..")?s.replace(/\\/g,"/"):r}if(s.startsWith("@/")){let n=Ae(Y__default.resolve(t,"src",s.slice(2))),r=ue(n,t);return r.startsWith("..")?s.replace(/\\/g,"/"):r}return s.replace(/\\/g,"/")}var rt=class{db;constructor(e,t){let n=t||Y__default.join(e,nt);ne__default.mkdirSync(Y__default.dirname(n),{recursive:true}),this.db=new Lr(n),this.initialize();}initialize(){this.db.pragma("journal_mode = WAL"),this.db.pragma("foreign_keys = ON"),this.db.pragma("synchronous = NORMAL"),this.db.exec(`
46
46
  -- \u6587\u4EF6\u5143\u4FE1\u606F
47
47
  CREATE TABLE IF NOT EXISTS files (
48
48
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -193,7 +193,7 @@ import*as Y from'path';import Y__default from'path';import {fileURLToPath}from'u
193
193
  CREATE INDEX IF NOT EXISTS idx_symbols_name ON symbols(name);
194
194
  CREATE INDEX IF NOT EXISTS idx_symbols_framework ON symbols(framework);
195
195
  CREATE INDEX IF NOT EXISTS idx_behaviors_file ON behaviors(file_id);
196
- `);let{applied:e,errors:t}=un(this.db);e.length>0&&process.stderr.write(`[Frontend-Code-Skimmer] \u6570\u636E\u5E93\u8FC1\u79FB\u5B8C\u6210: v${e.join(", v")}
196
+ `);let{applied:e,errors:t}=_n(this.db);e.length>0&&process.stderr.write(`[Frontend-Code-Skimmer] \u6570\u636E\u5E93\u8FC1\u79FB\u5B8C\u6210: v${e.join(", v")}
197
197
  `),t.length>0&&process.stderr.write(`[Frontend-Code-Skimmer] \u8FC1\u79FB\u8B66\u544A: ${t.join("; ")}
198
198
  `),this.db.exec(`
199
199
  CREATE INDEX IF NOT EXISTS idx_behaviors_api_lc ON behaviors(api_name_lc, operation_lc);
@@ -236,44 +236,44 @@ import*as Y from'path';import Y__default from'path';import {fileURLToPath}from'u
236
236
  INSERT INTO relations_fts(rowid, args)
237
237
  VALUES (new.id, new.args);
238
238
  END;
239
- `);}saveParseResult(e,t,n,r,s,i,a=0,c="",l=""){let p=Y__default.extname(t).slice(1),u=fr(t,n);this.db.transaction(()=>{this.clearIndexFailures(n);let g=this.db.prepare("SELECT id FROM files WHERE path = ?").get(n),f;g?(f=g.id,this.db.prepare("DELETE FROM symbols WHERE file_id = ?").run(f),this.db.prepare(`
239
+ `);}saveParseResult(e,t,n,r,i,o,a=0,c="",l=""){let p=Y__default.extname(t).slice(1),u=wr(t,n);this.db.transaction(()=>{this.clearIndexFailures(n);let h=this.db.prepare("SELECT id FROM files WHERE path = ?").get(n),f;h?(f=h.id,this.db.prepare("DELETE FROM symbols WHERE file_id = ?").run(f),this.db.prepare(`
240
240
  UPDATE files SET
241
241
  abs_path = ?, framework = ?, content_hash = ?,
242
242
  last_indexed_at = ?, file_size = ?, line_count = ?, file_mtime = ?,
243
243
  path_lc = LOWER(?),
244
244
  export_signature_hash = ?, import_signature_hash = ?
245
245
  WHERE id = ?
246
- `).run(t,e.framework,r,Date.now(),s,i,a,n,c,l,f)):f=this.db.prepare(`
246
+ `).run(t,e.framework,r,Date.now(),i,o,a,n,c,l,f)):f=this.db.prepare(`
247
247
  INSERT INTO files (path, path_lc, abs_path, file_type, framework, content_hash, last_indexed_at, file_size, line_count, file_mtime, export_signature_hash, import_signature_hash)
248
248
  VALUES (?, LOWER(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
249
- `).run(n,n,t,p,e.framework,r,Date.now(),s,i,a,c,l).lastInsertRowid;let m=this.db.prepare(`
249
+ `).run(n,n,t,p,e.framework,r,Date.now(),i,o,a,c,l).lastInsertRowid;let m=this.db.prepare(`
250
250
  INSERT INTO symbols (file_id, name, name_lc, category, category_lc, framework, start_line, end_line,
251
251
  signature, params_json, default_value, camel_words, jsdoc,
252
252
  is_async, hook_deps_json, state_setter_name, parent_component)
253
253
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
254
- `),h=new Map,b=new Map,S=_=>_.internalKey||`${_.name}:${_.startLine}:${_.endLine}`,y=(_,N)=>{h.set(S(_),N);let A=b.get(_.name)||[];A.push({id:N,name:_.name,startLine:_.startLine,endLine:_.endLine}),b.set(_.name,A);},T=(_,N,A)=>{if(A&&h.has(A))return h.get(A);let k=b.get(_)||[];if(k.length===0)return;if(k.length===1||N==null)return k[0]?.id;let $=k.filter(P=>P.startLine<=N&&N<=P.endLine);return $.length===1?$[0].id:$.length>1?$.sort((P,B)=>P.endLine-P.startLine-(B.endLine-B.startLine)||Math.abs(P.startLine-N)-Math.abs(B.startLine-N))[0]?.id:k.slice().sort((P,B)=>Math.abs(P.startLine-N)-Math.abs(B.startLine-N)||P.endLine-P.startLine-(B.endLine-B.startLine))[0]?.id};for(let _ of e.symbols){let A=_.camelWords||w(_.name),k=_.name.toLowerCase(),$=_.category.toLowerCase(),P=m.run(f,_.name,k,_.category,$,_.framework,_.startLine,_.endLine,_.signature||null,_.params?JSON.stringify(_.params):null,_.defaultValue||null,A,_.jsdoc||null,_.isAsync?1:0,_.hookDeps?JSON.stringify(_.hookDeps):null,_.stateSetterName||null,_.parentComponent||null);y(_,P.lastInsertRowid);}let E=this.db.prepare(`
254
+ `),y=new Map,g=new Map,N=_=>_.internalKey||`${_.name}:${_.startLine}:${_.endLine}`,b=(_,x)=>{y.set(N(_),x);let A=g.get(_.name)||[];A.push({id:x,name:_.name,startLine:_.startLine,endLine:_.endLine}),g.set(_.name,A);},S=(_,x,A)=>{if(A&&y.has(A))return y.get(A);let w=g.get(_)||[];if(w.length===0)return;if(w.length===1||x==null)return w[0]?.id;let P=w.filter($=>$.startLine<=x&&x<=$.endLine);return P.length===1?P[0].id:P.length>1?P.sort(($,H)=>$.endLine-$.startLine-(H.endLine-H.startLine)||Math.abs($.startLine-x)-Math.abs(H.startLine-x))[0]?.id:w.slice().sort(($,H)=>Math.abs($.startLine-x)-Math.abs(H.startLine-x)||$.endLine-$.startLine-(H.endLine-H.startLine))[0]?.id};for(let _ of e.symbols){let A=_.camelWords||v(_.name),w=_.name.toLowerCase(),P=_.category.toLowerCase(),$=m.run(f,_.name,w,_.category,P,_.framework,_.startLine,_.endLine,_.signature||null,_.params?JSON.stringify(_.params):null,_.defaultValue||null,A,_.jsdoc||null,_.isAsync?1:0,_.hookDeps?JSON.stringify(_.hookDeps):null,_.stateSetterName||null,_.parentComponent||null);b(_,$.lastInsertRowid);}let E=this.db.prepare(`
255
255
  INSERT INTO relations (caller_id, callee_name, callee_name_lc, call_type, line_number, args,
256
256
  source_kind, import_source, receiver_token, edge_kind)
257
257
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
258
- `);for(let _ of e.relations){let N=T(_.callerName,_.callerLine,_.callerKey);if(N){let A=_.sourceKind||ze(_.callType);E.run(N,_.calleeName,_.calleeName.toLowerCase(),_.callType,_.line,_.args||null,A,_.importSource||null,_.receiverToken||null,_.edgeKind||"heuristic");}}if(this.db.prepare("DELETE FROM data_assignments WHERE file_id = ?").run(f),e.assignments?.length){let _=this.db.prepare(`
258
+ `);for(let _ of e.relations){let x=S(_.callerName,_.callerLine,_.callerKey);if(x){let A=_.sourceKind||Ze(_.callType);E.run(x,_.calleeName,_.calleeName.toLowerCase(),_.callType,_.line,_.args||null,A,_.importSource||null,_.receiverToken||null,_.edgeKind||"heuristic");}}if(this.db.prepare("DELETE FROM data_assignments WHERE file_id = ?").run(f),e.assignments?.length){let _=this.db.prepare(`
259
259
  INSERT INTO data_assignments (symbol_name, symbol_name_lc, file_id, kind, source_layer, line_number, text_snippet)
260
260
  VALUES (?, ?, ?, ?, ?, ?, ?)
261
- `);for(let N of e.assignments)_.run(N.symbolName,N.symbolName.toLowerCase(),f,N.kind,N.sourceLayer||"unknown",N.line,N.text);}if(this.db.prepare("DELETE FROM property_writes WHERE file_id = ?").run(f),e.propertyWrites?.length){let _=this.db.prepare(`
261
+ `);for(let x of e.assignments)_.run(x.symbolName,x.symbolName.toLowerCase(),f,x.kind,x.sourceLayer||"unknown",x.line,x.text);}if(this.db.prepare("DELETE FROM property_writes WHERE file_id = ?").run(f),e.propertyWrites?.length){let _=this.db.prepare(`
262
262
  INSERT INTO property_writes (object_name, object_name_lc, property_name, property_name_lc, file_id, kind, source_layer, line_number, text_snippet)
263
263
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
264
- `);for(let N of e.propertyWrites)_.run(N.objectName,N.objectName.toLowerCase(),N.propertyName||null,N.propertyName?.toLowerCase()||"",f,N.kind,N.sourceLayer||"unknown",N.line,N.text);}if(this.db.prepare("DELETE FROM file_dependencies WHERE from_file = ?").run(n),e.fileDependencies?.length){let _=this.db.prepare(`
264
+ `);for(let x of e.propertyWrites)_.run(x.objectName,x.objectName.toLowerCase(),x.propertyName||null,x.propertyName?.toLowerCase()||"",f,x.kind,x.sourceLayer||"unknown",x.line,x.text);}if(this.db.prepare("DELETE FROM file_dependencies WHERE from_file = ?").run(n),e.fileDependencies?.length){let _=this.db.prepare(`
265
265
  INSERT INTO file_dependencies (from_file, to_file, dependency_kind, line_number)
266
266
  VALUES (?, ?, ?, ?)
267
- `);for(let N of e.fileDependencies)_.run(n,mr(N.toFile,t,u),N.dependencyKind,N.line);}let L=this.db.prepare(`
267
+ `);for(let x of e.fileDependencies)_.run(n,vr(x.toFile,t,u),x.dependencyKind,x.line);}let L=this.db.prepare(`
268
268
  INSERT INTO behaviors (symbol_id, file_id, category, api_name, api_name_lc, operation, operation_lc, detail, detail_lc, line_number)
269
269
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
270
- `);for(let _ of e.behaviors){let N=T(_.symbolName,_.line,_.symbolKey);if(N){let A=_.detail||null;L.run(N,f,_.category,_.apiName,_.apiName.toLowerCase(),_.operation,_.operation.toLowerCase(),A,A?.toLowerCase()??"",_.line);}}if(e.errors?.length){let _=this.db.prepare(`
270
+ `);for(let _ of e.behaviors){let x=S(_.symbolName,_.line,_.symbolKey);if(x){let A=_.detail||null;L.run(x,f,_.category,_.apiName,_.apiName.toLowerCase(),_.operation,_.operation.toLowerCase(),A,A?.toLowerCase()??"",_.line);}}if(e.errors?.length){let _=this.db.prepare(`
271
271
  INSERT INTO index_failures (file_path, error, last_seen_at)
272
272
  VALUES (?, ?, ?)
273
- `),N=Date.now();for(let A of e.errors)_.run(n,A,N);}})();}recordIndexFailure(e,t){this.clearIndexFailures(e),this.db.prepare(`
273
+ `),x=Date.now();for(let A of e.errors)_.run(n,A,x);}})();}recordIndexFailure(e,t){this.clearIndexFailures(e),this.db.prepare(`
274
274
  INSERT INTO index_failures (file_path, error, last_seen_at)
275
275
  VALUES (?, ?, ?)
276
- `).run(e,t,Date.now());}clearIndexFailures(e){this.db.prepare("DELETE FROM index_failures WHERE file_path = ?").run(e);}getFileHash(e){return this.db.prepare("SELECT content_hash FROM files WHERE path = ?").get(e)?.content_hash??null}getFileMeta(e){let t=this.db.prepare("SELECT content_hash, file_mtime, file_size FROM files WHERE path = ?").get(e);return t?{hash:t.content_hash,mtime:t.file_mtime??0,fileSize:t.file_size??0}:null}updateFileMtime(e,t){this.db.prepare("UPDATE files SET file_mtime = ? WHERE path = ?").run(t,e);}getFileSignatures(e){let t=this.db.prepare("SELECT content_hash, export_signature_hash, import_signature_hash FROM files WHERE path = ?").get(e);return t?{contentHash:t.content_hash,exportSignatureHash:t.export_signature_hash||"",importSignatureHash:t.import_signature_hash||""}:null}getReverseDependencies(e){return this.db.prepare("SELECT from_file FROM file_dependencies WHERE to_file = ? AND dependency_kind IN ('import', 're_export')").all(e).map(n=>n.from_file)}getReverseDependencyMap(){let e=this.db.prepare("SELECT from_file, to_file FROM file_dependencies WHERE dependency_kind IN ('import', 're_export')").all(),t=new Map;for(let{from_file:n,to_file:r}of e){let s=t.get(r)||[];s.push(n),t.set(r,s);}return t}getAllFilePaths(){return this.db.prepare("SELECT path FROM files ORDER BY path").all().map(t=>t.path)}getFileHashAndMtime(e){let t=this.db.prepare("SELECT content_hash, file_mtime FROM files WHERE path = ?").get(e);return t?{contentHash:t.content_hash,mtime:t.file_mtime??0}:null}enqueuePrecisePending(e,t){let n=Date.now(),r=i=>i==="high"?3:i==="normal"?2:1,s=this.db.prepare("SELECT priority, added_at FROM precise_pending WHERE rel_path = ?").get(e);if(!s){this.db.prepare("INSERT INTO precise_pending (rel_path, priority, added_at) VALUES (?, ?, ?)").run(e,t,n);return}r(t)>r(s.priority)&&this.db.prepare("UPDATE precise_pending SET priority = ? WHERE rel_path = ?").run(t,e);}deletePrecisePending(e){this.db.prepare("DELETE FROM precise_pending WHERE rel_path = ?").run(e);}clearPrecisePending(){this.db.prepare("DELETE FROM precise_pending").run();}getPrecisePendingCount(){return this.db.prepare("SELECT COUNT(*) as count FROM precise_pending").get().count}listPrecisePending(){return this.db.prepare(`
276
+ `).run(e,t,Date.now());}clearIndexFailures(e){this.db.prepare("DELETE FROM index_failures WHERE file_path = ?").run(e);}getFileHash(e){return this.db.prepare("SELECT content_hash FROM files WHERE path = ?").get(e)?.content_hash??null}getFileMeta(e){let t=this.db.prepare("SELECT content_hash, file_mtime, file_size FROM files WHERE path = ?").get(e);return t?{hash:t.content_hash,mtime:t.file_mtime??0,fileSize:t.file_size??0}:null}updateFileMtime(e,t){this.db.prepare("UPDATE files SET file_mtime = ? WHERE path = ?").run(t,e);}getFileSignatures(e){let t=this.db.prepare("SELECT content_hash, export_signature_hash, import_signature_hash FROM files WHERE path = ?").get(e);return t?{contentHash:t.content_hash,exportSignatureHash:t.export_signature_hash||"",importSignatureHash:t.import_signature_hash||""}:null}getReverseDependencies(e){return this.db.prepare("SELECT from_file FROM file_dependencies WHERE to_file = ? AND dependency_kind IN ('import', 're_export')").all(e).map(n=>n.from_file)}getReverseDependencyMap(){let e=this.db.prepare("SELECT from_file, to_file FROM file_dependencies WHERE dependency_kind IN ('import', 're_export')").all(),t=new Map;for(let{from_file:n,to_file:r}of e){let i=t.get(r)||[];i.push(n),t.set(r,i);}return t}getAllFilePaths(){return this.db.prepare("SELECT path FROM files ORDER BY path").all().map(t=>t.path)}getFileHashAndMtime(e){let t=this.db.prepare("SELECT content_hash, file_mtime FROM files WHERE path = ?").get(e);return t?{contentHash:t.content_hash,mtime:t.file_mtime??0}:null}enqueuePrecisePending(e,t){let n=Date.now(),r=o=>o==="high"?3:o==="normal"?2:1,i=this.db.prepare("SELECT priority, added_at FROM precise_pending WHERE rel_path = ?").get(e);if(!i){this.db.prepare("INSERT INTO precise_pending (rel_path, priority, added_at) VALUES (?, ?, ?)").run(e,t,n);return}r(t)>r(i.priority)&&this.db.prepare("UPDATE precise_pending SET priority = ? WHERE rel_path = ?").run(t,e);}deletePrecisePending(e){this.db.prepare("DELETE FROM precise_pending WHERE rel_path = ?").run(e);}clearPrecisePending(){this.db.prepare("DELETE FROM precise_pending").run();}getPrecisePendingCount(){return this.db.prepare("SELECT COUNT(*) as count FROM precise_pending").get().count}listPrecisePending(){return this.db.prepare(`
277
277
  SELECT rel_path, priority
278
278
  FROM precise_pending
279
279
  ORDER BY CASE priority WHEN 'high' THEN 0 WHEN 'normal' THEN 1 ELSE 2 END, added_at
@@ -287,26 +287,26 @@ import*as Y from'path';import Y__default from'path';import {fileURLToPath}from'u
287
287
  FROM symbols s JOIN files f ON s.file_id = f.id
288
288
  WHERE s.file_id = ?
289
289
  ORDER BY s.start_line ASC
290
- `).all(n),s=this.db.prepare(`
290
+ `).all(n),i=this.db.prepare(`
291
291
  SELECT b.*, s.name as symbol_name
292
292
  FROM behaviors b JOIN symbols s ON b.symbol_id = s.id
293
293
  WHERE b.file_id = ?
294
- `).all(n);return {file:t,symbols:r,behaviors:s}}listFiles(e){let t="SELECT path, abs_path, framework, line_count FROM files",n=[];return e&&(t+=" WHERE path_lc LIKE ?",n.push(`%${e.toLowerCase()}%`)),t+=" ORDER BY path",this.db.prepare(t).all(...n)}exactSearch(e,t,n,r){let s=`
294
+ `).all(n);return {file:t,symbols:r,behaviors:i}}listFiles(e){let t="SELECT path, abs_path, framework, line_count FROM files",n=[];return e&&(t+=" WHERE path_lc LIKE ?",n.push(`%${e.toLowerCase()}%`)),t+=" ORDER BY path",this.db.prepare(t).all(...n)}exactSearch(e,t,n,r){let i=`
295
295
  SELECT s.*, f.path as file_path, f.abs_path
296
296
  FROM symbols s JOIN files f ON s.file_id = f.id
297
297
  WHERE s.name_lc = ?
298
- `,i=[e.toLowerCase()];return t&&(s+=" AND s.category_lc = ?",i.push(t.toLowerCase())),n&&(s+=" AND s.framework = ?",i.push(n)),r&&(s+=" AND f.path_lc LIKE ?",i.push(`%${r.toLowerCase()}%`)),s+=" LIMIT 30",this.db.prepare(s).all(...i)}ftsSearch(e,t,n,r,s=20,i=true){let a=Math.max(1,Math.min(200,s)),l=e.replace(/[^\w\u4e00-\u9fa5\s]/g," ").trim().split(/\s+/).filter(p=>p.length>=2);if(l.length>0){let p=l.map(u=>`${u}*`).join(" ");try{let u=`
298
+ `,o=[e.toLowerCase()];return t&&(i+=" AND s.category_lc = ?",o.push(t.toLowerCase())),n&&(i+=" AND s.framework = ?",o.push(n)),r&&(i+=" AND f.path_lc LIKE ?",o.push(`%${r.toLowerCase()}%`)),i+=" LIMIT 30",this.db.prepare(i).all(...o)}ftsSearch(e,t,n,r,i=20,o=true){let a=Math.max(1,Math.min(200,i)),l=e.replace(/[^\w\u4e00-\u9fa5\s]/g," ").trim().split(/\s+/).filter(p=>p.length>=2);if(l.length>0){let p=l.map(u=>`${u}*`).join(" ");try{let u=`
299
299
  SELECT s.*, f.path as file_path, f.abs_path,
300
300
  bm25(symbols_fts, 10.0, 1.0, 0.5, 0.5) as fts_rank
301
301
  FROM symbols_fts
302
302
  JOIN symbols s ON symbols_fts.rowid = s.id
303
303
  JOIN files f ON s.file_id = f.id
304
304
  WHERE symbols_fts MATCH ?
305
- `,d=[p];return t&&(u+=" AND s.category_lc = ?",d.push(t.toLowerCase())),n&&(u+=" AND s.framework = ?",d.push(n)),r&&(u+=" AND f.path_lc LIKE ?",d.push(`%${r.toLowerCase()}%`)),u+=` ORDER BY fts_rank LIMIT ${a}`,this.db.prepare(u).all(...d)}catch{if(i)return []}}return i?[]:this.ftsLikeFallback(e,t,n,r,a)}ftsSearchWithFallback(e,t,n,r,s=20){return this.ftsSearch(e,t,n,r,s,false)}ftsLikeFallback(e,t,n,r,s=20){let i=e.toLowerCase().replace(/[\\%_]/g,"\\$&"),a=`
305
+ `,d=[p];return t&&(u+=" AND s.category_lc = ?",d.push(t.toLowerCase())),n&&(u+=" AND s.framework = ?",d.push(n)),r&&(u+=" AND f.path_lc LIKE ?",d.push(`%${r.toLowerCase()}%`)),u+=` ORDER BY fts_rank LIMIT ${a}`,this.db.prepare(u).all(...d)}catch{if(o)return []}}return o?[]:this.ftsLikeFallback(e,t,n,r,a)}ftsSearchWithFallback(e,t,n,r,i=20){return this.ftsSearch(e,t,n,r,i,false)}ftsLikeFallback(e,t,n,r,i=20){let o=e.toLowerCase().replace(/[\\%_]/g,"\\$&"),a=`
306
306
  SELECT s.*, f.path as file_path, f.abs_path, 0 as fts_rank
307
307
  FROM symbols s JOIN files f ON s.file_id = f.id
308
308
  WHERE (s.name_lc LIKE ? OR LOWER(s.camel_words) LIKE ?) ESCAPE '\\'
309
- `,c=[`%${i}%`,`%${i}%`];return t&&(a+=" AND s.category_lc = ?",c.push(t.toLowerCase())),n&&(a+=" AND s.framework = ?",c.push(n)),r&&(a+=" AND f.path_lc LIKE ?",c.push(`%${r.toLowerCase()}%`)),a+=` LIMIT ${Math.max(1,Math.min(200,s))}`,this.db.prepare(a).all(...c)}getAllSymbolNames(e){let t=`
309
+ `,c=[`%${o}%`,`%${o}%`];return t&&(a+=" AND s.category_lc = ?",c.push(t.toLowerCase())),n&&(a+=" AND s.framework = ?",c.push(n)),r&&(a+=" AND f.path_lc LIKE ?",c.push(`%${r.toLowerCase()}%`)),a+=` LIMIT ${Math.max(1,Math.min(200,i))}`,this.db.prepare(a).all(...c)}getAllSymbolNames(e){let t=`
310
310
  SELECT DISTINCT s.name, f.path as file_path, s.id
311
311
  FROM symbols s JOIN files f ON s.file_id = f.id
312
312
  `,n=[];return e&&(t+=" WHERE f.path_lc LIKE ?",n.push(`%${e.toLowerCase()}%`)),this.db.prepare(t).all(...n)}getSymbolById(e){return this.db.prepare(`
@@ -353,25 +353,25 @@ import*as Y from'path';import Y__default from'path';import {fileURLToPath}from'u
353
353
  s.parent_component IS NULL DESC,
354
354
  f.line_count DESC
355
355
  LIMIT 1
356
- `).get(e.toLowerCase())}behaviorSearch(e,t,n,r,s){let i=`
356
+ `).get(e.toLowerCase())}behaviorSearch(e,t,n,r,i){let o=`
357
357
  SELECT b.*, s.name as symbol_name, s.start_line, s.end_line, s.category as symbol_category,
358
358
  f.path as file_path
359
359
  FROM behaviors b
360
360
  JOIN symbols s ON b.symbol_id = s.id
361
361
  JOIN files f ON b.file_id = f.id
362
362
  WHERE 1=1
363
- `,a=[];return e&&(i+=" AND b.category = ?",a.push(e)),t&&(i+=" AND b.api_name_lc = ?",a.push(t.toLowerCase())),n&&(i+=" AND b.operation_lc = ?",a.push(n.toLowerCase())),r&&(i+=" AND (b.detail_lc LIKE ? OR b.api_name_lc LIKE ?)",a.push(`%${r.toLowerCase()}%`,`%${r.toLowerCase()}%`)),s&&(i+=" AND f.path_lc LIKE ?",a.push(`%${s.toLowerCase()}%`)),i+=" ORDER BY f.path, b.line_number LIMIT 50",this.db.prepare(i).all(...a)}getCallers(e,t,n){let r=`
363
+ `,a=[];return e&&(o+=" AND b.category = ?",a.push(e)),t&&(o+=" AND b.api_name_lc = ?",a.push(t.toLowerCase())),n&&(o+=" AND b.operation_lc = ?",a.push(n.toLowerCase())),r&&(o+=" AND (b.detail_lc LIKE ? OR b.api_name_lc LIKE ?)",a.push(`%${r.toLowerCase()}%`,`%${r.toLowerCase()}%`)),i&&(o+=" AND f.path_lc LIKE ?",a.push(`%${i.toLowerCase()}%`)),o+=" ORDER BY f.path, b.line_number LIMIT 50",this.db.prepare(o).all(...a)}getCallers(e,t,n){let r=`
364
364
  SELECT r.*, s.name as caller_name, s.start_line, s.end_line, s.category,
365
365
  f.path as file_path
366
366
  FROM relations r
367
367
  JOIN symbols s ON r.caller_id = s.id
368
368
  JOIN files f ON s.file_id = f.id
369
369
  WHERE r.callee_name_lc = ?
370
- `,s=[e.toLowerCase()];return t&&(r+=" AND f.path_lc LIKE ?",s.push(`%${t.toLowerCase()}%`)),n&&(r+=" AND LOWER(COALESCE(r.args, '')) LIKE LOWER(?)",s.push(`%${n}%`)),r+=" ORDER BY f.path, r.line_number",this.db.prepare(r).all(...s)}getCallees(e){return this.db.prepare(`
370
+ `,i=[e.toLowerCase()];return t&&(r+=" AND f.path_lc LIKE ?",i.push(`%${t.toLowerCase()}%`)),n&&(r+=" AND LOWER(COALESCE(r.args, '')) LIKE LOWER(?)",i.push(`%${n}%`)),r+=" ORDER BY f.path, r.line_number",this.db.prepare(r).all(...i)}getCallees(e){return this.db.prepare(`
371
371
  SELECT r.*, r.callee_name
372
372
  FROM relations r
373
373
  WHERE r.caller_id = ?
374
- `).all(e)}findRelationsByArgKeyword(e,t,n=50){let r=e.trim();if(!r)return [];let s=`
374
+ `).all(e)}findRelationsByArgKeyword(e,t,n=50){let r=e.trim();if(!r)return [];let i=`
375
375
  SELECT r.*, s.name as caller_name, s.start_line, s.end_line, s.category,
376
376
  f.path as file_path
377
377
  FROM relations_fts fts
@@ -379,14 +379,14 @@ import*as Y from'path';import Y__default from'path';import {fileURLToPath}from'u
379
379
  JOIN symbols s ON r.caller_id = s.id
380
380
  JOIN files f ON s.file_id = f.id
381
381
  WHERE fts.args MATCH ?
382
- `,a=[`"${r.replace(/"/g,'""')}"`];t&&(s+=" AND f.path_lc LIKE ?",a.push(`%${t.toLowerCase()}%`)),s+=" ORDER BY f.path, r.line_number LIMIT ?",a.push(n);let c=[],l=false,p=false;try{c=this.db.prepare(s).all(...a),c.length>0&&(l=!0);}catch{p=true;}let u=/[^a-zA-Z0-9_\u4e00-\u9fa5]/.test(r);if(!l&&(p||u)){let g=r.replace(/[\\%_]/g,"\\$&"),f=`
382
+ `,a=[`"${r.replace(/"/g,'""')}"`];t&&(i+=" AND f.path_lc LIKE ?",a.push(`%${t.toLowerCase()}%`)),i+=" ORDER BY f.path, r.line_number LIMIT ?",a.push(n);let c=[],l=false,p=false;try{c=this.db.prepare(i).all(...a),c.length>0&&(l=!0);}catch{p=true;}let u=/[^a-zA-Z0-9_\u4e00-\u9fa5]/.test(r);if(!l&&(p||u)){let h=r.replace(/[\\%_]/g,"\\$&"),f=`
383
383
  SELECT r.*, s.name as caller_name, s.start_line, s.end_line, s.category,
384
384
  f.path as file_path
385
385
  FROM relations r
386
386
  JOIN symbols s ON r.caller_id = s.id
387
387
  JOIN files f ON s.file_id = f.id
388
388
  WHERE LOWER(COALESCE(r.args, '')) LIKE LOWER(?) ESCAPE '\\'
389
- `,m=[`%${g}%`];t&&(f+=" AND f.path_lc LIKE ?",m.push(`%${t.toLowerCase()}%`)),f+=" ORDER BY f.path, r.line_number LIMIT ?",m.push(n),c=this.db.prepare(f).all(...m);}return c}getLastIndexedTime(){return this.db.prepare("SELECT MAX(last_indexed_at) as ts FROM files").get()?.ts??null}getProjectStats(){let e=this.db.prepare("SELECT COUNT(*) as c FROM files").get().c,t=this.db.prepare("SELECT COUNT(*) as c FROM symbols").get().c,n=this.db.prepare("SELECT COUNT(*) as c FROM behaviors").get().c,r=this.db.prepare("SELECT COUNT(*) as c FROM relations").get().c,s=this.db.prepare("SELECT COUNT(*) as c FROM index_failures").get().c,i=this.db.prepare(`
389
+ `,m=[`%${h}%`];t&&(f+=" AND f.path_lc LIKE ?",m.push(`%${t.toLowerCase()}%`)),f+=" ORDER BY f.path, r.line_number LIMIT ?",m.push(n),c=this.db.prepare(f).all(...m);}return c}getLastIndexedTime(){return this.db.prepare("SELECT MAX(last_indexed_at) as ts FROM files").get()?.ts??null}getProjectStats(){let e=this.db.prepare("SELECT COUNT(*) as c FROM files").get().c,t=this.db.prepare("SELECT COUNT(*) as c FROM symbols").get().c,n=this.db.prepare("SELECT COUNT(*) as c FROM behaviors").get().c,r=this.db.prepare("SELECT COUNT(*) as c FROM relations").get().c,i=this.db.prepare("SELECT COUNT(*) as c FROM index_failures").get().c,o=this.db.prepare(`
390
390
  SELECT framework, COUNT(*) as count FROM files GROUP BY framework
391
391
  `).all(),a=this.db.prepare(`
392
392
  SELECT f.path, f.line_count, COUNT(s.id) as symbol_count
@@ -395,7 +395,7 @@ import*as Y from'path';import Y__default from'path';import {fileURLToPath}from'u
395
395
  ORDER BY f.line_count DESC LIMIT 10
396
396
  `).all(),c=this.db.prepare(`
397
397
  SELECT category, COUNT(*) as count FROM behaviors GROUP BY category ORDER BY count DESC
398
- `).all(),l=this.db.prepare("SELECT page_count * page_size as size FROM pragma_page_count(), pragma_page_size()").get()?.size??0;return {fileCount:e,symbolCount:t,behaviorCount:n,relationCount:r,failureCount:s,frameworkBreakdown:i,topFiles:a,behaviorStats:c,dbSize:l}}getIndexFailures(e=20){return this.db.prepare(`
398
+ `).all(),l=this.db.prepare("SELECT page_count * page_size as size FROM pragma_page_count(), pragma_page_size()").get()?.size??0;return {fileCount:e,symbolCount:t,behaviorCount:n,relationCount:r,failureCount:i,frameworkBreakdown:o,topFiles:a,behaviorStats:c,dbSize:l}}getIndexFailures(e=20){return this.db.prepare(`
399
399
  SELECT file_path, error, last_seen_at
400
400
  FROM index_failures
401
401
  ORDER BY last_seen_at DESC, id DESC
@@ -411,57 +411,57 @@ import*as Y from'path';import Y__default from'path';import {fileURLToPath}from'u
411
411
  SELECT a.*, f.path as file_path
412
412
  FROM data_assignments a JOIN files f ON a.file_id = f.id
413
413
  WHERE a.symbol_name_lc = ?
414
- `,s=[e.toLowerCase()];return t&&(r+=" AND f.path_lc LIKE ?",s.push(`%${t.toLowerCase()}%`)),r+=" ORDER BY f.path, a.line_number LIMIT ?",s.push(n),this.db.prepare(r).all(...s)}getPropertyWrites(e,t,n,r=40){let s=`
414
+ `,i=[e.toLowerCase()];return t&&(r+=" AND f.path_lc LIKE ?",i.push(`%${t.toLowerCase()}%`)),r+=" ORDER BY f.path, a.line_number LIMIT ?",i.push(n),this.db.prepare(r).all(...i)}getPropertyWrites(e,t,n,r=40){let i=`
415
415
  SELECT pw.*, f.path as file_path
416
416
  FROM property_writes pw JOIN files f ON pw.file_id = f.id
417
417
  WHERE pw.object_name_lc = ?
418
- `,i=[e.toLowerCase()];return t&&(s+=" AND pw.property_name_lc = ?",i.push(t.toLowerCase())),n&&(s+=" AND f.path_lc LIKE ?",i.push(`%${n.toLowerCase()}%`)),s+=" ORDER BY f.path, pw.line_number LIMIT ?",i.push(r),this.db.prepare(s).all(...i)}getCallersWithSourceKind(e,t,n){let r=`
418
+ `,o=[e.toLowerCase()];return t&&(i+=" AND pw.property_name_lc = ?",o.push(t.toLowerCase())),n&&(i+=" AND f.path_lc LIKE ?",o.push(`%${n.toLowerCase()}%`)),i+=" ORDER BY f.path, pw.line_number LIMIT ?",o.push(r),this.db.prepare(i).all(...o)}getCallersWithSourceKind(e,t,n){let r=`
419
419
  SELECT r.*, s.name as caller_name, s.start_line, s.end_line, s.category,
420
420
  f.path as file_path
421
421
  FROM relations r
422
422
  JOIN symbols s ON r.caller_id = s.id
423
423
  JOIN files f ON s.file_id = f.id
424
424
  WHERE r.callee_name_lc = ?
425
- `,s=[e.toLowerCase()];return t&&(r+=" AND f.path_lc LIKE ?",s.push(`%${t.toLowerCase()}%`)),n&&(r+=" AND LOWER(COALESCE(r.args, '')) LIKE LOWER(?)",s.push(`%${n}%`)),r+=" ORDER BY f.path, r.line_number",this.db.prepare(r).all(...s)}close(){this.db.close();}};function q(o){let e=o.property;return e?e.type==="Identifier"?String(e.name||""):e.type==="Literal"||e.type==="StringLiteral"?String(e.value||""):null:null}function te(o){let e=o.object;return e?e.type==="Identifier"?String(e.name||""):e.type==="ThisExpression"?q(o):e.type==="MemberExpression"?e.object?.type==="ThisExpression"?q(e):te(e):null:null}function ne(o,e){let t=o||"";return /created|mounted|beforeMount|setup\s*\(|\bdata\s*\(/.test(t)?"init":/getItem|localStorage|sessionStorage|\bfetch\b|\bload[A-Z]|\bget[A-Z]/.test(t)?"cache":/@click|@change|@input|onClick|onChange|handle[A-Z]|\bwatch\b/.test(t)?"user":e<=30?"init":"unknown"}function z(o,e,t,n=false){let r=[];return V(o,i=>{if(n&&i!==o&&(i.type==="FunctionDeclaration"||i.type==="ArrowFunctionExpression"||i.type==="FunctionExpression"||i.type==="ClassDeclaration"))return false;if(i.type==="CallExpression"||i.type==="OptionalCallExpression"){let c=gr(i,e);c&&r.push(c);}if(i.type==="MemberExpression"){let a=hr(i);a&&r.push(a);}}),Sr(r)}function gr(o,e,t){let n=o.callee;if(!n)return null;let r=et(o);if(n.type==="MemberExpression"||n.type==="OptionalMemberExpression"){let s=yr(n);if(!s)return null;let{apiName:i,operation:a}=s,c=o.arguments,l=se(c?.[0]),p=Nr(i);return p?{symbolName:e,category:p,apiName:i,operation:a,detail:l,line:r}:i==="this"&&Ze(a)?{symbolName:e,category:"network",apiName:`this.${a}`,operation:"wrapped_call",detail:l||se(c?.[1]),line:r}:fn(a)&&Tr(c)?{symbolName:e,category:"network",apiName:i,operation:a,detail:l||se(c?.[1]),line:r}:Ze(i)||Ze(`${i}.${a}`)?{symbolName:e,category:"network",apiName:i,operation:fn(a)?a:"wrapped_call",detail:l||se(c?.[1]),line:r}:null}if(n.type==="Identifier"){let s=n.name,i=br(s),a=o.arguments,c=se(a?.[0]);return i?{symbolName:e,category:i.category,apiName:s,operation:i.operation,detail:c,line:r}:Ze(s)?{symbolName:e,category:"network",apiName:s,operation:"wrapped_call",detail:c||se(a?.[1]),line:r}:null}return null}function hr(o,e,t){let n=o.object,r=o.property;if(!n||!r||n.type!=="MemberExpression"&&n.type!=="ThisExpression"&&n.type!=="Identifier")return null;let s=_r(n);if(!s)return null;r.type==="Identifier"?r.name:"";if(s==="this"||s===""){n.type==="MemberExpression"?n.property?.name:"";return null}return null}function yr(o){let e=o.object,t=o.property;if(!e||!t||t.type!=="Identifier")return null;let n=t.name;if(e.type==="MemberExpression"||e.type==="OptionalMemberExpression"){let r=e.property?.name;if(r)return {apiName:r,operation:n}}return e.type==="Identifier"?{apiName:e.name,operation:n}:e.type==="ThisExpression"?{apiName:"this",operation:n}:null}function br(o){let e={fetch:"network",setTimeout:"timer",setInterval:"timer",clearTimeout:"timer",clearInterval:"timer",requestAnimationFrame:"timer",navigate:"router"};return e[o]?{category:e[o],operation:o}:null}function et(o){return o.loc?.start?.line??0}function Er(o){let e=o.loc;return {line:e?.start?.line??0,column:e?.start?.column??0}}function _r(o){return o.type==="Identifier"?o.name:o.type==="ThisExpression"?"this":null}function Nr(o){if(o==="this")return null;for(let[e,t]of Object.entries(rn))if(o in t)return e;return null}function se(o,e){if(o){if(o.type==="Literal"||o.type==="StringLiteral"||o.type==="NumericLiteral"||o.type==="BooleanLiteral")return String(o.value);if(o.type==="NullLiteral")return "null";if(o.type==="TemplateLiteral"){let t=o.quasis,n=o.expressions||[],r=[];for(let i=0;i<t.length;i++){let a=t[i].value?.cooked||"";if(a&&r.push(a),i<n.length){let c=Qe(n[i])||"expr";r.push(`\${${c}}`);}}return r.join("")||"${expr}"}if(o.type==="Identifier")return `[\u53D8\u91CF: ${o.name}]`;if(o.type==="ObjectExpression"){let t=o.properties||[],n=["url","uri","path","api","endpoint"];for(let r of t){let s=r.key,i=r.value;if(!s||!i)continue;let a=s.type==="Identifier"?String(s.name):s.type==="Literal"?String(s.value):"";if(!n.includes(a))continue;let c=se(i);if(c)return `${a}:${c}`}return "{...}"}}}function Qe(o,e){if(!o)return;if(o.type==="Identifier")return o.name;if(o.type==="ThisExpression")return "this";if(o.type==="Literal"||o.type==="StringLiteral"||o.type==="NumericLiteral"||o.type==="BooleanLiteral")return String(o.value);if(o.type==="NullLiteral")return "null";if(o.type==="MemberExpression"){let n=Qe(o.object)||"obj",r=o.property,s=r?.type==="Identifier"?String(r.name):Qe(r)||"prop";return o.computed?`${n}[${s}]`:`${n}.${s}`}if(o.type==="CallExpression")return `${Qe(o.callee)||"fn"}(...)`;if(o.type==="TemplateLiteral")return se(o);let t=se(o);return t?.startsWith("[\u53D8\u91CF: ")?t.replace(/^\[变量: /,"").replace(/\]$/,""):t}function Ze(o){return /request|api|http|fetch|ajax|akscommonhandle|commonhandle/i.test(o)}function fn(o){return ["get","post","put","delete","patch","request"].includes(o.toLowerCase())}function Tr(o,e){if(!o||o.length===0)return false;for(let t of o.slice(0,2)){let n=se(t);if(n&&(/https?:\/\//i.test(n)||n.includes("/")||/gw\d?\/|\/m\/|\/api\//i.test(n)))return true}return false}function Sr(o){let e=new Set;return o.filter(t=>{let n=`${t.apiName}:${t.operation}:${t.line}`;return e.has(n)?false:(e.add(n),true)})}function Te(o,e,t){let n=[];return V(o,r=>{if(r.type==="CallExpression"&&r.callee?.type==="MemberExpression"){let s=r.callee,i=s.object,a=s.property;if(i.type==="ThisExpression"&&a.type==="Identifier"){let c=a.name;if(!c.startsWith("$")&&c!==e){let l=r.arguments,p=vt(l);n.push({calleeName:c,line:et(r),args:p});}}}}),n}function G(o,e,t,n=false){let r=[];return V(o,i=>{if(n&&i!==o&&(i.type==="FunctionDeclaration"||i.type==="ArrowFunctionExpression"||i.type==="FunctionExpression"||i.type==="ClassDeclaration"))return false;if(i.type==="CallExpression"&&i.callee?.type==="Identifier"){let a=i.callee.name;if(a!==e&&!gn(a)){let c=i.arguments,l=vt(c);r.push({calleeName:a,line:et(i),args:l});}}}),wt(r)}function mn(o,e,t){let n=[];return V(o,s=>{if(s!==o&&(s.type==="FunctionDeclaration"||s.type==="ArrowFunctionExpression"||s.type==="FunctionExpression"||s.type==="ClassDeclaration"))return false;if(s.type!=="CallExpression"&&s.type!=="OptionalCallExpression")return;let i=s.arguments||[];for(let a of i)a.type!=="ArrowFunctionExpression"&&a.type!=="FunctionExpression"||(n.push(...G(a,e,t,true)),n.push(...Te(a,e)),n.push(...tt(a,e,t,true)));}),wt(n)}function tt(o,e,t,n=false){let r=[];return V(o,i=>{if(n&&i!==o&&(i.type==="FunctionDeclaration"||i.type==="ArrowFunctionExpression"||i.type==="FunctionExpression"||i.type==="ClassDeclaration"))return false;if(i.type!=="CallExpression"&&i.type!=="OptionalCallExpression")return;let a=i.callee;if(!a||a.type!=="MemberExpression"&&a.type!=="OptionalMemberExpression")return;let c=a.object;if(!c||c.type==="ThisExpression")return;let l=te(a),p=q(a);if(!l||!p||p===e||xr(l)||gn(p))return;let u=i.arguments,d=vt(u);r.push({calleeName:p,line:et(i),args:d,receiverToken:l});}),wt(r)}function gn(o){return /^(useState|useEffect|useMemo|useCallback|useRef|useContext|useReducer|ref|reactive|computed|watch|watchEffect|console|setTimeout|setInterval|Math|Object|Array|JSON|String|Number|Boolean|Promise|require|import)$/.test(o)}function xr(o){return /^(console|Math|Object|Array|JSON|String|Number|Boolean|Promise|Reflect|Date|Error|RegExp|Symbol|process|fs|path|os|assert|test|document|window|localStorage|sessionStorage|navigator|global|globalThis)$/.test(o)}function wt(o){let e=new Set;return o.filter(t=>{let n=`${t.receiverToken||""}:${t.calleeName}:${t.line}:${t.args||""}`;return e.has(n)?false:(e.add(n),true)})}function vt(o,e){if(!o||o.length===0)return;let t=o.slice(0,3).map(n=>se(n)).filter(n=>!!n);return t.length>0?t.join(", "):void 0}function V(o,e){if(!(!o||typeof o!="object")&&e(o)!==false)for(let t of Object.keys(o)){if(t==="type"||t==="loc"||t==="start"||t==="end")continue;let n=o[t];if(Array.isArray(n))for(let r of n)r&&typeof r=="object"&&r.type&&V(r,e);else n&&typeof n=="object"&&n.type&&V(n,e);}}function nt(o,e){let t=[],n=new Set,r=o.split(`
426
- `);for(let s=0;s<r.length;s++){let i=/(?:@|v-on:)[a-z][a-z0-9-]*(?:\.[a-z-]+)*="([^"]+)"/g,a;for(;(a=i.exec(r[s]))!==null;){let l=a[1].trim().match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\([^)]*\))?$/);if(!l)continue;let p=l[1];if(p.startsWith("$"))continue;let u=e+s,d=`${p}:${u}:${a.index}`;n.has(d)||(n.add(d),t.push({calleeName:p,line:u}));}}return t}function hn(o,e){let t=[],n=new Set;return V(o,r=>{if(r.type!=="JSXAttribute")return;let s=r.name,i=r.value;if(!s||!i)return;let a=s.type==="JSXIdentifier"?String(s.name):"";if(!/^on[A-Z]/.test(a)||i.type!=="JSXExpressionContainer")return;let c=i.expression;if(!c)return;let l;if(c.type==="Identifier")l=c.name;else if(c.type==="MemberExpression"){let g=c.property?.name;g&&!/^\$/.test(g)&&(l=g);}let{line:p,column:u}=Er(r),d=`${l}:${p}:${u}`;!l||n.has(d)||(n.add(d),t.push({calleeName:l,line:p}));}),t}var Lr=createRequire(import.meta.url),yn=false;function Rr(o){yn||(yn=true,process.stderr.write(`[Frontend-Code-Skimmer] precise import graph \u5DF2\u964D\u7EA7: ${String(o)}
427
- `));}function bn(o,e,t){let n={filePath:o,imports:[],exports:[]};try{let r=Lr("typescript"),s=r.createSourceFile(o,e,r.ScriptTarget.Latest,!0);r.forEachChild(s,i=>{if(r.isImportDeclaration(i)){let a=i.moduleSpecifier;if(!a||!r.isStringLiteral(a))return;let c=a.text,l=st(o,c),p=i.importClause;if(!p){n.imports.push({localName:"",originalName:"",modulePath:c,resolvedFile:l,isDefault:!1,isReExport:!1});return}let u=p.namedBindings;if(u&&r.isNamedImports(u))for(let d of u.elements){let g=d.propertyName?d.propertyName.text:d.name.text;n.imports.push({localName:d.name.text,originalName:g,modulePath:c,resolvedFile:l,isDefault:!1,isReExport:!1});}u&&r.isNamespaceImport(u)&&n.imports.push({localName:u.name.text,originalName:"*",modulePath:c,resolvedFile:l,isDefault:!1,isReExport:!1}),p.name&&n.imports.push({localName:p.name.text,originalName:"default",modulePath:c,resolvedFile:l,isDefault:!0,isReExport:!1});}if(r.isExportDeclaration(i)){let a=i.moduleSpecifier;if(a&&r.isStringLiteral(a)){let c=a.text,l=i.exportClause;if(l&&r.isNamedExports(l))for(let p of l.elements)n.exports.push({name:p.name.text,isDefault:!1,source:"re_export",reExportFrom:c});}else if(i.exportClause){let c=i.exportClause;if(r.isNamedExports(c))for(let l of c.elements)n.exports.push({name:l.name.text,isDefault:!1,source:"local"});}}if(r.isExportAssignment(i)&&(i.isExportEquals||n.exports.push({name:"default",isDefault:!0,source:"local"})),(r.isFunctionDeclaration(i)||r.isVariableStatement(i)||r.isClassDeclaration(i))&&i.modifiers?.some(a=>a.kind===r.SyntaxKind.ExportKeyword)){if(r.isFunctionDeclaration(i)&&i.name)n.exports.push({name:i.name.text,isDefault:i.name.text==="default",source:"local"});else if(r.isClassDeclaration(i)&&i.name)n.exports.push({name:i.name.text,isDefault:i.name.text==="default",source:"local"});else if(r.isVariableStatement(i))for(let a of i.declarationList.declarations)r.isIdentifier(a.name)&&n.exports.push({name:a.name.text,isDefault:!1,source:"local"});}});}catch(r){Rr(r);}return n}function st(o,e){let t=Y.dirname(o);if(e.startsWith(".")){let n=Y.resolve(t,e);return Ne(n)}return e.startsWith("@/")?kr(o,e):e}function kr(o,e){let t=Y.dirname(o);for(let n=0;n<10;n++){let r=Y.join(t,"src");if(Q.existsSync(r)&&Q.statSync(r).isDirectory()){let i=Y.join(r,e.replace(/^@\//,""));return Ne(i)}let s=Y.dirname(t);if(s===t)break;t=s;}return e}function U(o){return {callerName:o.callerName,callerLine:o.callerLine,callerKey:o.callerKey,calleeName:o.calleeName,callType:o.callType,line:o.line,args:o.args,sourceKind:ze(o.callType),importSource:o.importSource,receiverToken:o.receiverToken,edgeKind:o.edgeKind||"heuristic"}}function fe(o,e){let t=[];for(let n of o){let r=n.type;if(r==="ImportDeclaration"){let s=n.source,i=n.loc;s?.value&&t.push({fromFile:e,toFile:st(e,s.value),dependencyKind:"import",line:i?.start?.line??1});}if(r==="ExportNamedDeclaration"||r==="ExportAllDeclaration"){let s=n.source,i=n.loc;s?.value&&t.push({fromFile:e,toFile:st(e,s.value),dependencyKind:"re_export",line:i?.start?.line??1});}}return t}function ot(o,e){let t=new Map(e.map(r=>[r.name,r])),n=[];for(let r of o){let s=r.type;if(s==="ExportNamedDeclaration"){let i=r.declaration,a=r.source;if(i){if(i.type==="FunctionDeclaration"||i.type==="ClassDeclaration"){let c=i.id;c?.name&&n.push(it(c.name,t.get(c.name)));}else if(i.type==="VariableDeclaration")for(let c of i.declarations||[]){let l=c.id;l?.type==="Identifier"&&l.name&&n.push(it(l.name,t.get(l.name)));}continue}for(let c of r.specifiers||[]){let l=Ct(c.local),p=Ct(c.exported)||l;p&&(a?.value?n.push(`re_export:${p}:${a.value}`):n.push(it(p,l?t.get(l):void 0)));}continue}if(s==="ExportAllDeclaration"){let i=r.source;i?.value&&n.push(`re_export_all:${i.value}`);continue}if(s==="ExportDefaultDeclaration"){let i=r.declaration;if(!i){n.push("default:unknown");continue}if(i.type==="Identifier"){let a=Ct(i);n.push(it("default",a?t.get(a):void 0));continue}if(i.type==="FunctionDeclaration"||i.type==="FunctionExpression"||i.type==="ArrowFunctionExpression"){let a=(i.params||[]).map(c=>It(c)).join(", ");n.push(`default:fn(${a})`);continue}if(i.type==="ClassDeclaration"||i.type==="ClassExpression"){n.push("default:class");continue}n.push(`default:${String(i.type||"unknown")}`);}}return n.sort()}function it(o,e){return `${o}:${wr(e)}`}function wr(o){return o?o.category==="class"?"class":o.signature?`fn${o.signature.replace(/^[^(]*/,"")}`:o.category==="constant"?`const:${o.defaultValue||""}`:o.category:"unknown"}function Ct(o){if(o){if(o.type==="Identifier")return String(o.name||"");if(o.type==="StringLiteral")return String(o.value||"")}}function It(o){return o?o.type==="Identifier"?String(o.name||"param"):o.type==="AssignmentPattern"?It(o.left):o.type==="RestElement"?It(o.argument):"param":"param"}var En=createRequire(import.meta.url);var we=class{name="Vue2Parser";canParse(e,t){return e.endsWith(".vue")}parse(e,t){let n={framework:"vue2",filePath:e,symbols:[],relations:[],behaviors:[],errors:[]};try{let s=En("vue-template-compiler").parseComponent(t);if(!s.script?.content)return n;let i=s.script.content,a=this.getScriptStartLine(t,s.script.start),c=t.split(`
428
- `),l;try{l=En("@babel/parser").parse(i,{sourceType:"module",plugins:["jsx","typescript","decorators-legacy"],errorRecovery:!0});}catch(p){return n.errors?.push(`AST \u89E3\u6790\u5931\u8D25: ${String(p)}`),n}if(this.extractFromAST(l.program,i,c,a,n),s.template?.content){let p=this.getScriptStartLine(t,s.template.start),u=nt(s.template.content,p);if(u.length>0){let d=s.template.content.split(`
429
- `).length;n.symbols.push({name:"<template>",category:"lifecycle",framework:"vue2",startLine:p,endLine:p+d-1,camelWords:"template"});for(let g of u)n.relations.push(U({callerName:"<template>",callerLine:p,calleeName:g.calleeName,callType:"template_event",line:g.line}));}}}catch(r){n.errors?.push(`\u89E3\u6790\u5931\u8D25: ${String(r)}`);}return n}getScriptStartLine(e,t){let n=1;for(let r=0;r<t&&r<e.length;r++)e[r]===`
430
- `&&n++;return n}extractFromAST(e,t,n,r,s){let i=t.split(`
431
- `);s.fileDependencies=fe(e.body||[],s.filePath);let a=null;V(e,u=>{if(u.type==="ExportDefaultDeclaration"){let d=u.declaration;if(d?.type==="ObjectExpression")a=d;else if(d?.type==="CallExpression"){let g=d.arguments;g&&g.length>0&&g[0].type==="ObjectExpression"&&(a=g[0]);}else if(d?.type==="Identifier"){let g=d.name;V(e,f=>{if(f.type==="VariableDeclarator"&&f.id?.name===g){if(f.init?.type==="ObjectExpression")a=f.init;else if(f.init?.type==="CallExpression"){let m=f.init.arguments;m&&m.length>0&&m[0].type==="ObjectExpression"&&(a=m[0]);}}});}}});let l=false;if(!a&&(V(e,u=>{u.type==="ExportDefaultDeclaration"&&u.declaration?.type==="ClassDeclaration"&&(l=true,this.extractFromClassComponent(u.declaration,t,n,r,s));}),!l)){let u=null,d=0,g=["data","methods","computed","props","watch","components","created","mounted","mixins"];V(e,f=>{if(f.type==="ObjectExpression"){let m=f.properties||[],h=0;for(let b of m){let S=this.getPropKey(b);S&&g.includes(S)&&h++;}h>d&&(d=h,u=f);}}),d>=2&&u&&(a=u);}if(!a)return;let p=a.properties;for(let u of p||[]){let d=this.getPropKey(u);if(!d)continue;let g=u.type==="ObjectMethod"?u:u.value;if(!g)continue;let f=m=>m+r-1;switch(d){case "name":g?.type==="Literal"&&(String(g.value));break;case "data":this.extractData(g,i,f,s);break;case "props":this.extractProps(g,i,f,s);break;case "computed":this.extractComputedOrMethods(g,"computed",i,f,n,s);break;case "methods":this.extractComputedOrMethods(g,"method",i,f,n,s);break;case "watch":this.extractWatch(g,i,f,s);break;case "filters":this.extractComputedOrMethods(g,"filter",i,f,n,s);break;case "components":this.extractComponents(g,s);break;case "mixins":this.extractMixins(g,s);break;default:if(xt.includes(d)){let m=f(this.getStartLine(u)),h=f(this.getEndLine(u)),b=K(n.join(`
432
- `),m),S=s.symbols.length;s.symbols.push({name:d,category:"lifecycle",framework:"vue2",startLine:m,endLine:h,jsdoc:b,camelWords:w(d)});let y=z(g,d);s.behaviors.push(...y);let T=Te(g,d);for(let E of T){if(E.args){let L=String(E.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");s.symbols[S].camelWords+=` ${w(L)} ${L}`;}s.relations.push(U({callerName:d,callerLine:m,calleeName:E.calleeName,callType:"this_method",line:f(E.line),args:E.args}));}}break}}}extractData(e,t,n,r){let s=null;if(e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"||e.type==="ObjectMethod"?V(e.body,i=>{i.type==="ReturnStatement"&&i.argument?.type==="ObjectExpression"&&(s=i.argument);}):e.type==="ObjectExpression"&&(s=e),!!s)for(let i of s.properties){let a=this.getPropKey(i);if(!a)continue;let c=n(this.getStartLine(i)),l=n(this.getEndLine(i)),p=this.getLiteralValue(i.value);r.symbols.push({name:a,category:"state",framework:"vue2",startLine:c,endLine:l,defaultValue:p,camelWords:w(a)});}}extractProps(e,t,n,r){if(e.type==="ArrayExpression"){for(let s of e.elements||[])if(s?.type==="Literal"){let i=String(s.value);r.symbols.push({name:i,category:"prop",framework:"vue2",startLine:n(this.getStartLine(s)),endLine:n(this.getEndLine(s)),camelWords:w(i)});}}else if(e.type==="ObjectExpression")for(let s of e.properties||[]){let i=this.getPropKey(s);if(!i)continue;let a=n(this.getStartLine(s)),c=n(this.getEndLine(s)),l;if(s.value?.type==="ObjectExpression"){let p=s.value.properties?.find(u=>this.getPropKey(u)==="default");p&&(l=this.getLiteralValue(p.value));}r.symbols.push({name:i,category:"prop",framework:"vue2",startLine:a,endLine:c,defaultValue:l,camelWords:w(i)});}}extractComputedOrMethods(e,t,n,r,s,i){if(e.type==="ObjectExpression")for(let a of e.properties||[]){let c=this.getPropKey(a);if(!c)continue;let l=a.type==="ObjectMethod"?a:a.value;if(!l)continue;let p=r(this.getStartLine(a)),u=r(this.getEndLine(a)),d=K(s.join(`
433
- `),p),g=this.extractParams(l),f=l.async===true,m=g?`${c}(${g.join(", ")})`:c;if(i.symbols.push({name:c,category:t,framework:"vue2",startLine:p,endLine:u,signature:m,params:g,isAsync:f,jsdoc:d,camelWords:w(c)}),t==="method"&&l){let h=z(l,c);i.behaviors.push(...h);let b=Te(l,c);for(let y of b){if(y.args){let T=String(y.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");i.symbols[i.symbols.length-1].camelWords+=` ${w(T)} ${T}`;}i.relations.push(U({callerName:c,callerLine:p,calleeName:y.calleeName,callType:"this_method",line:r(y.line),args:y.args}));}let S=G(l,c,s,true);for(let y of S){if(y.args){let T=String(y.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");i.symbols[i.symbols.length-1].camelWords+=` ${w(T)} ${T}`;}i.relations.push(U({callerName:c,callerLine:p,calleeName:y.calleeName,callType:"direct_call",line:r(y.line),args:y.args}));}}}}extractWatch(e,t,n,r){if(e.type==="ObjectExpression")for(let s of e.properties||[]){let i=this.getPropKey(s);if(!i)continue;let a=n(this.getStartLine(s)),c=n(this.getEndLine(s));r.symbols.push({name:i,category:"effect",framework:"vue2",startLine:a,endLine:c,camelWords:w(i)});}}extractComponents(e,t){if(e.type==="ObjectExpression")for(let n of e.properties||[]){let r=this.getPropKey(n);r&&t.symbols.push({name:r,category:"component",framework:"vue2",startLine:this.getStartLine(n),endLine:this.getEndLine(n),camelWords:w(r)});}}extractMixins(e,t){if(e.type==="ArrayExpression")for(let n of e.elements||[]){let r=n?.type==="Identifier"?n.name:null;r&&t.symbols.push({name:r,category:"mixin",framework:"vue2",startLine:this.getStartLine(n),endLine:this.getEndLine(n),camelWords:w(r)});}}getPropKey(e){if(!e)return null;let t=e.key;return t?t.type==="Identifier"?t.name:t.type==="Literal"?String(t.value):null:null}getStartLine(e){return e?.loc?.start?.line??1}getEndLine(e){return e?.loc?.end?.line??1}extractParams(e){if(!e)return;let t=e.params;if(t)return t.map(n=>n.type==="Identifier"?n.name:n.type==="AssignmentPattern"?n.left?.name||"?":n.type==="RestElement"?`...${n.argument?.name||""}`:n.type==="TSParameterProperty"&&n.parameter?.name||"?")}getLiteralValue(e){if(e){if(e.type==="Literal"||e.type==="StringLiteral"||e.type==="NumericLiteral"||e.type==="BooleanLiteral")return String(e.value);if(e.type==="NullLiteral"||e.value===null)return "null";if(e.type==="ObjectExpression")return "{}";if(e.type==="ArrayExpression")return "[]";if(e.type==="Identifier"&&e.name==="undefined")return "undefined";if(e.type==="ArrowFunctionExpression"||e.type==="FunctionExpression"||e.type==="ObjectMethod")return "function"}}extractFromClassComponent(e,t,n,r,s){let i=c=>c+r-1,a=e.body;if(!(!a||a.type!=="ClassBody"))for(let c of a.body||[]){let l=this.getPropKey(c);if(!l)continue;let p=i(this.getStartLine(c)),u=i(this.getEndLine(c)),d=K(n.join(`
434
- `),p);if(c.type==="ClassMethod"){let f=xt.includes(l)?"lifecycle":"method",m=this.extractParams(c),h=c.async===true,b=m?`${l}(${m.join(", ")})`:l;s.symbols.push({name:l,category:f,framework:"vue2",startLine:p,endLine:u,signature:b,params:m,isAsync:h,jsdoc:d,camelWords:w(l)});let S=z(c,l);s.behaviors.push(...S);let y=Te(c,l);for(let E of y){if(E.args){let L=String(E.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");s.symbols[s.symbols.length-1].camelWords+=` ${w(L)} ${L}`;}s.relations.push(U({callerName:l,callerLine:p,calleeName:E.calleeName,callType:"this_method",line:i(E.line),args:E.args}));}let T=G(c,l,n,true);for(let E of T){if(E.args){let L=String(E.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");s.symbols[s.symbols.length-1].camelWords+=` ${w(L)} ${L}`;}s.relations.push(U({callerName:l,callerLine:p,calleeName:E.calleeName,callType:"direct_call",line:i(E.line),args:E.args}));}}else if(c.type==="ClassProperty"){let g=(c.decorators||[]).some(m=>m.expression?.callee?.name==="Prop"),f=this.getLiteralValue(c.value);s.symbols.push({name:l,category:g?"prop":"state",framework:"vue2",startLine:p,endLine:u,defaultValue:f,camelWords:w(l)});}}}};var $t=createRequire(import.meta.url),at=class{name="Vue3Parser";canParse(e,t){return e.endsWith(".vue")?this.looksLikeVue3File(t):false}parse(e,t){let n={framework:"vue3",filePath:e,symbols:[],relations:[],behaviors:[],errors:[]};try{let{parse:r}=$t("@vue/compiler-sfc"),{descriptor:s}=r(t),i=t.split(`
435
- `),a=!!s.scriptSetup,c=!!s.script;if(a){let l=s.scriptSetup,p=l.loc.start.line;this.parseSetupContent(l.content,p,i,n);}else if(c){let l=s.script,p=l.loc.start.line;this.parseScriptContent(l.content,p,i,n)||this.populateFromOptionsApiFallback(e,t,n);}if(s.template?.content){let l=s.template.loc.start.line,p=nt(s.template.content,l);if(p.length>0){let u=s.template.content.split(`
436
- `).length;n.symbols.push({name:"<template>",category:"lifecycle",framework:"vue3",startLine:l,endLine:l+u-1,camelWords:"template"});for(let d of p)n.relations.push(U({callerName:"<template>",callerLine:l,calleeName:d.calleeName,callType:"template_event",line:d.line}));}}}catch(r){n.errors?.push(`Vue3 \u89E3\u6790\u5931\u8D25: ${String(r)}`);}return n}parseSetupContent(e,t,n,r){let s;try{s=$t("@babel/parser").parse(e,{sourceType:"module",plugins:["typescript","jsx","decorators-legacy"],errorRecovery:!0});}catch(l){r.errors?.push(`AST \u89E3\u6790\u5931\u8D25: ${String(l)}`);return}let i=l=>l+t-1,a=e.split(`
437
- `),c=s.program.body;r.fileDependencies=fe(c,r.filePath);for(let l of c||[])this.processTopLevelStatement(l,i,n,a,r);}parseScriptContent(e,t,n,r){let s;try{s=$t("@babel/parser").parse(e,{sourceType:"module",plugins:["typescript","jsx","decorators-legacy"],errorRecovery:!0});}catch(l){return r.errors?.push(`AST \u89E3\u6790\u5931\u8D25: ${String(l)}`),false}let i=l=>l+t-1,a=e.split(`
438
- `);r.fileDependencies=fe(s.program.body||[],r.filePath);let c=false;return V(s.program,l=>{if(l.type==="ExportDefaultDeclaration"&&l.declaration?.type==="ObjectExpression"){let p=l.declaration.properties?.find(u=>this.getPropKey(u)==="setup");if(p){c=true;let u=p.type==="ObjectMethod"?p:p.value;if(!u)return;let d=u.body;if(d?.type==="BlockStatement"){let g=d.body;for(let f of g||[])this.processTopLevelStatement(f,i,n,a,r);}}}}),c||V(s.program,l=>{if(!c&&l.type==="ObjectExpression"){let u=(l.properties||[]).find(d=>this.getPropKey(d)==="setup");if(u){c=true;let d=u.type==="ObjectMethod"?u:u.value;if(!d)return;let g=d.body;if(g?.type==="BlockStatement"){let f=g.body;for(let m of f||[])this.processTopLevelStatement(m,i,n,a,r);}}}}),c}processTopLevelStatement(e,t,n,r,s){let i=a=>{let c=a?.loc;return {start:c?.start?.line??1,end:c?.end?.line??1}};if(e.type==="VariableDeclaration")for(let a of e.declarations||[]){if(a.id?.type!=="Identifier"&&a.id?.type!=="ArrayPattern")continue;let c=a.init;if(c&&a.id.type==="Identifier"){let l=a.id.name;if(c.type==="ArrowFunctionExpression"||c.type==="FunctionExpression"){let{start:p,end:u}=i(e),d=K(n.join(`
439
- `),t(p)),g=this.extractParams(c),f=s.symbols.length;if(s.symbols.push({name:l,category:"method",framework:"vue3",startLine:t(p),endLine:t(u),signature:`${l}(${(g||[]).join(", ")})`,params:g,isAsync:c.async===true,jsdoc:d,camelWords:w(l)}),c.body){let m=z(c.body,l);s.behaviors.push(...m);let h=G(c.body,l);for(let b of h){if(b.args){let S=String(b.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");s.symbols[f].camelWords+=` ${w(S)} ${S}`;}s.relations.push(U({callerName:l,callerLine:t(p),calleeName:b.calleeName,callType:"direct_call",line:t(b.line),args:b.args}));}}}else {let p=this.classifyVue3Declaration(l,c,t,i(e),n);p&&s.symbols.push(p);}}}if(e.type==="FunctionDeclaration"&&e.id?.type==="Identifier"){let a=e.id.name,{start:c,end:l}=i(e),p=K(n.join(`
440
- `),t(c)),u=this.extractParams(e),d=At.includes(a);if(s.symbols.push({name:a,category:d?"lifecycle":be(a)?"hook":"method",framework:"vue3",startLine:t(c),endLine:t(l),signature:`${a}(${(u||[]).join(", ")})`,params:u,isAsync:e.async===true,jsdoc:p,camelWords:w(a)}),e.body){let g=z(e.body,a);s.behaviors.push(...g);let f=G(e.body,a);for(let m of f){if(m.args){let h=String(m.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");s.symbols[s.symbols.length-1].camelWords+=` ${w(h)} ${h}`;}s.relations.push(U({callerName:a,callerLine:t(c),calleeName:m.calleeName,callType:"direct_call",line:t(m.line),args:m.args}));}}}if(e.type==="ExpressionStatement"&&e.expression?.type==="CallExpression"){let c=e.expression.callee;if(c?.type==="Identifier"){let l=c.name;if(["defineProps","defineEmits","defineExpose"].includes(l)){let{start:p,end:u}=i(e);s.symbols.push({name:l,category:l==="defineProps"?"prop":l==="defineEmits"?"emit":"export",framework:"vue3",startLine:t(p),endLine:t(u),camelWords:w(l)});}}}if(e.type==="ExpressionStatement"&&e.expression?.type==="CallExpression"){let a=e.expression,c=a.callee;if(c?.type==="Identifier"){let l=c.name;if(At.includes(l)){let{start:p,end:u}=i(e);s.symbols.push({name:l,category:"lifecycle",framework:"vue3",startLine:t(p),endLine:t(u),camelWords:w(l)});let d=a.arguments;if(d?.[0]){let g=z(d[0],l);s.behaviors.push(...g);let f=G(d[0],l);for(let m of f){if(m.args){let h=String(m.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");s.symbols[s.symbols.length-1].camelWords+=` ${w(h)} ${h}`;}s.relations.push(U({callerName:l,callerLine:t(p),calleeName:m.calleeName,callType:"direct_call",line:t(m.line),args:m.args}));}}}}}}classifyVue3Declaration(e,t,n,r,s){if(t.type!=="CallExpression")return null;let i=t.callee;if(i?.type!=="Identifier")return null;let a=i.name,c=n(r.start),l=n(r.end),p=K(s.join(`
441
- `),c);if(sn.includes(a)){let u=t.arguments,d=u?.[0]?this.getLiteralValue(u[0]):void 0;return {name:e,category:"state",framework:"vue3",startLine:c,endLine:l,defaultValue:d,jsdoc:p,camelWords:w(e)}}return on.includes(a)?{name:e,category:"computed",framework:"vue3",startLine:c,endLine:l,jsdoc:p,camelWords:w(e)}:an.includes(a)?{name:e,category:"effect",framework:"vue3",startLine:c,endLine:l,camelWords:w(e)}:a==="provide"||a==="inject"?{name:e,category:"provide",framework:"vue3",startLine:c,endLine:l,camelWords:w(e)}:be(a)?{name:e,category:"hook",framework:"vue3",startLine:c,endLine:l,jsdoc:p,camelWords:w(e)}:null}getPropKey(e){let t=e?.key;return t?t.type==="Identifier"?t.name:t.type==="Literal"?String(t.value):null:null}extractParams(e){let t=e.params;if(t)return t.map(n=>n.type==="Identifier"?n.name:n.type==="AssignmentPattern"?n.left?.name||"?":n.type==="RestElement"?`...${n.argument?.name||""}`:n.type==="ObjectPattern"?"{...}":n.type==="TSParameterProperty"&&n.parameter?.name||"?")}getLiteralValue(e){if(e){if(e.type==="Literal"||e.type==="StringLiteral"||e.type==="NumericLiteral"||e.type==="BooleanLiteral")return String(e.value);if(e.type==="NullLiteral")return "null";if(e.type==="ObjectExpression")return "{}";if(e.type==="ArrayExpression")return "[]"}}looksLikeVue3File(e){return e.includes("<script setup")?true:/\bdefine(?:Props|Emits|Expose|Slots|Model)\s*\(/.test(e)||/\bwithDefaults\s*\(/.test(e)||/\bdefineComponent\s*\(/.test(e)||/\bsetup\s*\(/.test(e)||/\b(?:ref|reactive|shallowRef|shallowReactive|readonly|computed|watch|watchEffect|watchPostEffect|watchSyncEffect|provide|inject|nextTick|onBeforeMount|onMounted|onBeforeUpdate|onUpdated|onBeforeUnmount|onUnmounted|onActivated|onDeactivated|onErrorCaptured|onRenderTracked|onRenderTriggered|onServerPrefetch)\s*\(/.test(e)}populateFromOptionsApiFallback(e,t,n){let r=new we().parse(e,t);n.symbols=r.symbols.map(s=>({...s,framework:"vue3"})),n.relations=r.relations,n.behaviors=r.behaviors,n.errors=[...n.errors||[],...r.errors||[]];}};var $r=createRequire(import.meta.url),Pr=[...Lt,...Rt,...kt,...cn],We=class{name="ReactParser";canParse(e,t){let n=e.split(".").pop()?.toLowerCase();return ["jsx","tsx","js","ts"].includes(n||"")?n==="ts"?/from\s+['"]react['"]/.test(t)||/require\(\s*['"]react['"]\s*\)/.test(t)||/\bReact\./.test(t):t.includes("useState")||t.includes("useEffect")||t.includes("from 'react'")||t.includes('from "react"')||t.includes("React.")?true:n==="jsx"||n==="tsx"||n==="js"?t.includes("jsx")||t.includes("JSX")||this.containsLikelyJsx(t):false:false}containsLikelyJsx(e){return /(?:^|\breturn\b|[=(,:{?&|;>])[\s([]*<[A-Za-z][\w.:-]*(?:\s|\/?>)/m.test(e)||/<>|<\/>/.test(e)}parse(e,t){let n={framework:"react",filePath:e,symbols:[],relations:[],behaviors:[],errors:[]};try{let s=$r("@babel/parser").parse(t,{sourceType:"module",plugins:["jsx","typescript","decorators-legacy"],errorRecovery:!0}),i=t.split(`
442
- `);this.extractFromAST(s.program?s.program:s,i,n);}catch(r){n.errors?.push(`React \u89E3\u6790\u5931\u8D25: ${String(r)}`);}return n}extractFromAST(e,t,n){let r=e.body;n.fileDependencies=fe(r,n.filePath);for(let s of r||[]){if(s.type==="FunctionDeclaration"||s.type==="ExportDefaultDeclaration"&&s.declaration?.type==="FunctionDeclaration"||s.type==="ExportNamedDeclaration"&&s.declaration?.type==="FunctionDeclaration"){let i=s.type==="FunctionDeclaration"?s:s.declaration,a=s.type!=="FunctionDeclaration";i&&i.id?.type==="Identifier"&&this.processFunction(i,t,n,a);}if(s.type==="VariableDeclaration"||s.type==="ExportNamedDeclaration"&&s.declaration?.type==="VariableDeclaration"||s.type==="ExportDefaultDeclaration"&&s.declaration?.type==="VariableDeclaration"){let i=s.type==="VariableDeclaration"?s:s.declaration,a=s.type!=="VariableDeclaration";if(i)for(let c of i.declarations||[]){let l=c.init;if(l&&(l.type==="ArrowFunctionExpression"||l.type==="FunctionExpression")&&c.id?.type==="Identifier"){let p={...l,id:c.id,loc:{start:i.loc?.start??l.loc?.start,end:l.loc?.end}};this.processFunction(p,t,n,a);continue}this.processTopLevelVariableDeclaration(c,t,n,a);}}}n.exportSignatureEntries=ot(r,n.symbols);}processTopLevelVariableDeclaration(e,t,n,r){let s=e.id;if(!s||s.type!=="Identifier")return;let i=s.name;if(!i)return;let a=e.init,c=e.loc,l=c?.start?.line??1,p=c?.end?.line??1,u=this.buildSymbolKey(i,l,p);if(n.symbols.push({name:i,category:"constant",framework:"react",startLine:l,endLine:p,internalKey:u,isExported:r,defaultValue:this.getLiteralValue(a),jsdoc:K(t.join(`
443
- `),l),camelWords:w(i)}),!a)return;let d=z(a,i,t,true);n.behaviors.push(...d);let g=G(a,i,t,true);for(let f of g){let m=n.symbols.findIndex(h=>h.name===i&&h.startLine===l);if(f.args&&m!==-1){let h=String(f.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");n.symbols[m].camelWords+=` ${w(h)} ${h}`;}n.relations.push(U({callerName:i,callerLine:l,callerKey:u,calleeName:f.calleeName,callType:"direct_call",line:f.line,args:f.args}));}}processFunction(e,t,n,r=false){let s=e.id?.name;if(!s)return;let i=e.loc,a=i?.start?.line??1,c=i?.end?.line??1,l=be(s),p=!l&&/^[A-Z]/.test(s),u=K(t.join(`
444
- `),a),d=this.extractParams(e),g=this.buildSymbolKey(s,a,c);n.symbols.push({name:s,category:l?"hook":p?"component":"function",framework:"react",startLine:a,endLine:c,internalKey:g,signature:`${s}(${(d||[]).join(", ")})`,params:d,isAsync:e.async===true,isExported:r,jsdoc:u,parentComponent:p?s:void 0,camelWords:w(s)});let f=e.body;if(f?.type!=="BlockStatement")return;let m=f.body;for(let y of m||[])this.processComponentStatement(y,s,t,n);let h=z(f,s,t,true);n.behaviors.push(...h);let b=G(f,s,t,true);for(let y of b){let T=n.symbols.findIndex(E=>E.name===s&&E.startLine===a);if(y.args&&T!==-1){let E=String(y.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");n.symbols[T].camelWords+=` ${w(E)} ${E}`;}n.relations.push(U({callerName:s,callerLine:a,callerKey:g,calleeName:y.calleeName,callType:"direct_call",line:y.line,args:y.args}));}let S=hn(f);for(let y of S)n.relations.push(U({callerName:s,callerLine:a,callerKey:g,calleeName:y.calleeName,callType:"jsx_event",line:y.line}));}processComponentStatement(e,t,n,r){let s=i=>{let a=i?.loc;return {start:a?.start?.line??1,end:a?.end?.line??1}};if(e.type==="VariableDeclaration")for(let i of e.declarations||[]){let a=i.init;if(!a||a.type!=="CallExpression")continue;let c=a.callee;if(c?.type!=="Identifier")continue;let l=c.name,{start:p,end:u}=s(e),d=p,g=u;if(Lt.includes(l)&&l!=="useRef"){if(i.id?.type==="ArrayPattern"){let f=i.id.elements,m=f[0]?.name,h=f[1]?.name;if(m){let b=a.arguments;r.symbols.push({name:m,category:"state",framework:"react",startLine:d,endLine:g,internalKey:this.buildSymbolKey(m,d,g,t),stateSetterName:h,defaultValue:this.getLiteralValue(b?.[0]),parentComponent:t,camelWords:w(m)});}}else if(i.id?.type==="Identifier"){let f=i.id.name;r.symbols.push({name:f,category:"state",framework:"react",startLine:d,endLine:g,internalKey:this.buildSymbolKey(f,d,g,t),parentComponent:t,camelWords:w(f)});}}if(l==="useRef"&&i.id?.type==="Identifier"){let f=i.id.name,m=a.arguments;r.symbols.push({name:f,category:"state",framework:"react",startLine:d,endLine:g,internalKey:this.buildSymbolKey(f,d,g,t),defaultValue:this.getLiteralValue(m?.[0]),parentComponent:t,camelWords:w(f)});}if(Rt.includes(l)&&i.id?.type==="Identifier"){let f=i.id.name,h=a.arguments?.[1],b=this.extractDepsArray(h);r.symbols.push({name:f,category:"computed",framework:"react",startLine:d,endLine:g,internalKey:this.buildSymbolKey(f,d,g,t),hookDeps:b,parentComponent:t,camelWords:w(f)});}if(be(l)&&!Pr.includes(l)){let f=i.id?.type==="Identifier"?i.id.name:i.id?.type==="ObjectPattern"?"{...}":"?";r.symbols.push({name:f,category:"hook",framework:"react",startLine:d,endLine:g,internalKey:this.buildSymbolKey(f,d,g,t),parentComponent:t,camelWords:w(f)});}}if(e.type==="ExpressionStatement"&&e.expression?.type==="CallExpression"){let i=e.expression,a=i.callee;if(a?.type==="Identifier"){let c=a.name;if(kt.includes(c)){let{start:l,end:p}=s(e),u=i.arguments,d=u?.[1],g=this.extractDepsArray(d),f=this.buildSymbolKey(c,l,p,t),m=`${t}.${c}`;if(r.symbols.push({name:c,category:"effect",framework:"react",startLine:l,endLine:p,internalKey:f,hookDeps:g,parentComponent:t,camelWords:w(c)}),u?.[0]){let h=z(u[0],m,n,true).map(S=>({...S,symbolKey:f}));r.behaviors.push(...h);let b=G(u[0],m,n,true);for(let S of b){let y=r.symbols.findIndex(T=>T.name===c&&T.startLine===l);if(S.args&&y!==-1){let T=String(S.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");r.symbols[y].camelWords+=` ${w(T)} ${T}`;}r.relations.push(U({callerName:m,callerLine:l,callerKey:f,calleeName:S.calleeName,callType:"direct_call",line:S.line,args:S.args}));}}}}}if(e.type==="FunctionDeclaration"&&e.id?.type==="Identifier"){let i=e.id.name;if(!be(i)){let{start:a,end:c}=s(e),l=K(n.join(`
445
- `),a),p=this.extractParams(e);if(r.symbols.push({name:i,category:"method",framework:"react",startLine:a,endLine:c,internalKey:this.buildSymbolKey(i,a,c,t),signature:`${i}(${(p||[]).join(", ")})`,params:p,isAsync:e.async===true,jsdoc:l,parentComponent:t,camelWords:w(i)}),e.body){let u=z(e.body,i,n,true);r.behaviors.push(...u);let d=G(e.body,i,n,true);for(let g of d){let f=r.symbols.findIndex(m=>m.name===i&&m.startLine===a);if(g.args&&f!==-1){let m=String(g.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");r.symbols[f].camelWords+=` ${w(m)} ${m}`;}r.relations.push(U({callerName:i,callerLine:a,callerKey:this.buildSymbolKey(i,a,c,t),calleeName:g.calleeName,callType:"direct_call",line:g.line,args:g.args}));}}}}if(e.type==="VariableDeclaration")for(let i of e.declarations||[]){let a=i.init;if(!a)continue;let c=a.type==="ArrowFunctionExpression"||a.type==="FunctionExpression";if(!c||i.id?.type!=="Identifier")continue;let l=i.id.name,p=a.type==="CallExpression"?a.callee:null;if(p?.type==="Identifier"&&be(p.name))continue;if(a.type==="CallExpression"&&a.callee?.name==="useCallback"){let b=a.arguments?.[1],S=this.extractDepsArray(b),{start:y,end:T}=s(e);r.symbols.push({name:l,category:"computed",framework:"react",startLine:y,endLine:T,internalKey:this.buildSymbolKey(l,y,T,t),hookDeps:S,parentComponent:t,camelWords:w(l)});continue}if(!c)continue;let{start:d,end:g}=s(e),f=K(n.join(`
446
- `),d),m=this.extractParams(a);if(r.symbols.push({name:l,category:"method",framework:"react",startLine:d,endLine:g,internalKey:this.buildSymbolKey(l,d,g,t),signature:`${l}(${(m||[]).join(", ")})`,params:m,isAsync:a.async===true,jsdoc:f,parentComponent:t,camelWords:w(l)}),a.body){let h=z(a.body,l,n,true);r.behaviors.push(...h);let b=G(a.body,l,n,true);for(let S of b){let y=r.symbols.findIndex(T=>T.name===l&&T.startLine===d);if(S.args&&y!==-1){let T=String(S.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");r.symbols[y].camelWords+=` ${w(T)} ${T}`;}r.relations.push(U({callerName:l,callerLine:d,callerKey:this.buildSymbolKey(l,d,g,t),calleeName:S.calleeName,callType:"direct_call",line:S.line,args:S.args}));}}}}extractDepsArray(e){if(!(!e||e.type!=="ArrayExpression"))return (e.elements||[]).filter(t=>!!t&&t.type==="Identifier").map(t=>t.name)}extractParams(e){let t=e.params;if(t)return t.map(n=>n.type==="Identifier"?n.name:n.type==="ObjectPattern"?"{...}":n.type==="ArrayPattern"?"[...]":n.type==="AssignmentPattern"?n.left?.name||"?":n.type==="RestElement"?`...${n.argument?.name||""}`:n.type==="TSParameterProperty"&&n.parameter?.name||"?")}getLiteralValue(e){if(e){if(e.type==="Literal"||e.type==="StringLiteral"||e.type==="NumericLiteral"||e.type==="BooleanLiteral")return String(e.value);if(e.type==="NullLiteral")return "null";if(e.type==="ObjectExpression")return "{}";if(e.type==="ArrayExpression")return "[]";if(e.type==="Identifier"&&e.name==="null")return "null"}}buildSymbolKey(e,t,n,r){return `${r||"root"}:${e}:${t}:${n}`}};var Fr=createRequire(import.meta.url),ct=class{name="ToolingTsParser";canParse(e){let t=e.split(".").pop()?.toLowerCase();return ["js","jsx","ts","tsx"].includes(t||"")}parse(e,t){let n=e.endsWith(".ts")||e.endsWith(".tsx")?"ts":"js",r={framework:n,filePath:e,symbols:[],relations:[],behaviors:[],errors:[]};try{let i=Fr("@babel/parser").parse(t,{sourceType:"module",plugins:["jsx","typescript","decorators-legacy","classProperties"],errorRecovery:!0}),a=t.split(`
447
- `),c=(i.program||i).body,l=new Set;r.fileDependencies=fe(c||[],e);for(let p of c||[])this.processTopLevelStatement(p,a,n,r,l);if(l.size>0)for(let p of r.symbols)l.has(p.name)&&(p.isExported=!0);r.exportSignatureEntries=ot(c||[],r.symbols);}catch(s){r.errors?.push(`Tooling \u89E3\u6790\u5931\u8D25: ${String(s)}`);}return r}processTopLevelStatement(e,t,n,r,s){if(e.type==="FunctionDeclaration"){this.addTopLevelFunction(e,t,n,r,false);return}if(e.type==="ExportNamedDeclaration"||e.type==="ExportDefaultDeclaration"){let i=e.declaration;if(!i){this.collectDeferredExportNames(e,s);return}if(i.type==="FunctionDeclaration"){this.addTopLevelFunction(i,t,n,r,true);return}if(i.type==="ClassDeclaration"){this.addClass(i,t,n,r,true);return}if(i.type==="VariableDeclaration"){this.processVariableDeclaration(i,t,n,r,true);return}this.collectDeferredExportNames(e,s);return}if(e.type==="ClassDeclaration"){this.addClass(e,t,n,r,false);return}e.type==="VariableDeclaration"&&this.processVariableDeclaration(e,t,n,r,false);}collectDeferredExportNames(e,t){if(e.type==="ExportNamedDeclaration"){if(e.source?.type==="StringLiteral")return;for(let r of e.specifiers||[]){let s=r.local;s?.type==="Identifier"&&t.add(String(s.name||""));}return}if(e.type==="ExportDefaultDeclaration"){let n=e.declaration;n?.type==="Identifier"&&t.add(String(n.name||""));}}processVariableDeclaration(e,t,n,r,s){for(let i of e.declarations||[]){let a=i.id;if(!a||a.type!=="Identifier")continue;let c=String(a.name||"");if(!c)continue;let l=i.init,{start:p,end:u}=this.getLineRange(i),d=this.buildSymbolKey(c,p,u);if(l&&(l.type==="ArrowFunctionExpression"||l.type==="FunctionExpression")){this.addFunctionSymbol(c,l,t,n,r,{startLine:p,endLine:u,isExported:s});continue}if(r.symbols.push({name:c,category:"constant",framework:n,startLine:p,endLine:u,internalKey:d,isExported:s,defaultValue:this.getLiteralValue(l),jsdoc:K(t.join(`
448
- `),p),camelWords:w(c)}),!l)continue;let g=z(l,c,t,true);r.behaviors.push(...g);let f=G(l,c,t,true);for(let h of f)r.relations.push(U({callerName:c,callerLine:p,callerKey:d,calleeName:h.calleeName,callType:"direct_call",line:h.line,args:h.args}));let m=tt(l,c,t,true);for(let h of m)r.relations.push(U({callerName:c,callerLine:p,callerKey:d,calleeName:h.calleeName,callType:"direct_call",line:h.line,args:h.args,receiverToken:h.receiverToken}));}}addTopLevelFunction(e,t,n,r,s){let i=e.id?.name;if(!i)return;let{start:a,end:c}=this.getLineRange(e);this.addFunctionSymbol(i,e,t,n,r,{startLine:a,endLine:c,isExported:s});}addFunctionSymbol(e,t,n,r,s,i){let a=this.buildSymbolKey(e,i.startLine,i.endLine,i.ownerClass),c=this.extractParams(t);s.symbols.push({name:e,category:i.ownerClass?"method":"function",framework:r,startLine:i.startLine,endLine:i.endLine,internalKey:a,signature:`${e}(${(c||[]).join(", ")})`,params:c,isAsync:t.async===true,isExported:i.isExported,jsdoc:K(n.join(`
449
- `),i.startLine),parentComponent:i.ownerClass,camelWords:w(e)});let l=t.body;if(!l)return;let p=z(l,e,n,true);s.behaviors.push(...p);let u=G(l,e,n,true);for(let m of u)s.relations.push(U({callerName:e,callerLine:i.startLine,callerKey:a,calleeName:m.calleeName,callType:"direct_call",line:m.line,args:m.args}));let d=mn(l,e,n);for(let m of d)s.relations.push(U({callerName:e,callerLine:i.startLine,callerKey:a,calleeName:m.calleeName,callType:"direct_call",line:m.line,args:m.args}));let g=tt(l,e,n,true);for(let m of g)s.relations.push(U({callerName:e,callerLine:i.startLine,callerKey:a,calleeName:m.calleeName,callType:"direct_call",line:m.line,args:m.args,receiverToken:m.receiverToken}));let f=Te(l,e);for(let m of f)s.relations.push(U({callerName:e,callerLine:i.startLine,callerKey:a,calleeName:m.calleeName,callType:"this_method",line:m.line,args:m.args}));}addClass(e,t,n,r,s){let i=e.id?.name;if(!i)return;let{start:a,end:c}=this.getLineRange(e);r.symbols.push({name:i,category:"class",framework:n,startLine:a,endLine:c,isExported:s,jsdoc:K(t.join(`
450
- `),a),camelWords:w(i)});let l=e.body?.body;for(let p of l||[]){let u=p.key,d=u?.type==="Identifier"?String(u.name||""):"";if(!d||d==="constructor")continue;if(p.type==="ClassMethod"||p.type==="ClassPrivateMethod"){this.addFunctionSymbol(d,p,t,n,r,{startLine:this.getLineRange(p).start,endLine:this.getLineRange(p).end,isExported:false,ownerClass:i});continue}let g=p.value;g&&(g.type==="ArrowFunctionExpression"||g.type==="FunctionExpression")&&(p.type==="ClassProperty"||p.type==="PropertyDefinition")&&this.addFunctionSymbol(d,g,t,n,r,{startLine:this.getLineRange(p).start,endLine:this.getLineRange(p).end,isExported:false,ownerClass:i});}}extractParams(e){let t=e.params;return t?.length?t.map(n=>{if(n.type==="Identifier")return String(n.name||"");if(n.type==="AssignmentPattern"){let r=n.left;return r?.type==="Identifier"?String(r.name||""):"param"}return "param"}):[]}getLiteralValue(e){if(e){if(e.type==="StringLiteral"||e.type==="NumericLiteral"||e.type==="BooleanLiteral")return String(e.value);if(e.type==="NullLiteral")return "null";if(e.type==="ObjectExpression")return "{...}";if(e.type==="ArrayExpression")return "[...]"}}buildSymbolKey(e,t,n,r){return `${r||"root"}:${e}:${t}:${n}`}getLineRange(e){let t=e.loc;return {start:t?.start?.line??1,end:t?.end?.line??1}}};var Dr=new Set(["FunctionDeclaration","ArrowFunctionExpression","FunctionExpression","ObjectMethod","ClassMethod","ClassProperty"]);function _n(o,e){return !!e?.skipNestedFunctions&&Dr.has(String(o.type||""))}function me(o,e,t){if(!(!o||typeof o!="object")){e(o);for(let n of Object.keys(o)){if(n==="type"||n==="loc"||n==="start"||n==="end")continue;let r=o[n];if(Array.isArray(r)){for(let s of r){if(!s||typeof s!="object"||!s.type)continue;let i=s;_n(i,t)||me(i,e,t);}continue}if(r&&typeof r=="object"&&r.type){let s=r;if(_n(s,t))continue;me(s,e,t);}}}}function Nn(o,e,t=true,n){let r=[],s=[],i=(a,c=120)=>Mr(a,n,c);return me(o,a=>{if(a.type==="VariableDeclarator"){let c=a.id;if(!c)return;let l=lt(c),p=i(a);for(let u of l)r.push({symbolName:u,kind:"declaration",line:ve(a),text:p,sourceLayer:ne(p,ve(a))});}if(a.type==="AssignmentExpression"){let c=a.left;if(!c)return;let l=i(a),p=ve(a);if(c.type==="Identifier"&&r.push({symbolName:c.name,kind:"assignment",line:p,text:l,sourceLayer:ne(l,p)}),c.type==="MemberExpression"&&c.object?.type==="ThisExpression"){let d=q(c);if(d){r.push({symbolName:d,kind:"assignment",line:p,text:l,sourceLayer:ne(l,p)});return}}if(c.type==="MemberExpression"){let u=te(c);if(u&&Pt(u)){let d=q(c);s.push({objectName:u,propertyName:d||void 0,line:p,text:l,kind:c.computed?"bracket":"dot",sourceLayer:ne(l,p)});}}}if(a.type==="UpdateExpression"){let c=a.argument;if(!c)return;let l=i(a),p=ve(a);if(c.type==="Identifier"&&r.push({symbolName:c.name,kind:"update",line:p,text:l,sourceLayer:ne(l,p)}),c.type==="MemberExpression"&&c.object?.type==="ThisExpression"){let d=q(c);if(d){r.push({symbolName:d,kind:"update",line:p,text:l,sourceLayer:ne(l,p)});return}}if(c.type==="MemberExpression"){let u=te(c);if(u&&Pt(u)){let d=q(c);s.push({objectName:u,propertyName:d||void 0,line:p,text:l,kind:c.computed?"bracket":"dot",sourceLayer:ne(l,p)});}}}if(a.type==="UnaryExpression"&&a.operator==="delete"){let c=a.argument;if(c?.type==="MemberExpression"){let l=te(c);if(l&&Pt(l)){let p=q(c);s.push({objectName:l,propertyName:p||void 0,line:ve(a),text:i(a),kind:"delete",sourceLayer:ne(i(a),ve(a))});}}}},{skipNestedFunctions:t}),{assignments:r,propertyWrites:s}}function lt(o){return o.type==="Identifier"?[o.name]:o.type==="ObjectPattern"?(o.properties||[]).flatMap(t=>{let n=t.type==="ObjectProperty"||t.type==="Property"?t.value:t;return n?lt(n):[]}):o.type==="ArrayPattern"?(o.elements||[]).flatMap(t=>t?lt(t):[]):o.type==="AssignmentPattern"?lt(o.left):[]}function Pt(o){return !(/^[A-Z][A-Z]/.test(o)||/^(document|window|console|localStorage|sessionStorage|navigator|process|global|globalThis)$/.test(o))}function ve(o){return o.loc?.start?.line??1}function Mr(o,e,t=120){if(e){let r=o.loc;if(r?.start?.line&&r?.end?.line){let s=r.start.line-1,i=Math.min(r.end.line-1,s+5);return e.slice(s,i+1).map(c=>c.trim()).filter(c=>c).join(" ").slice(0,t)}}let n=o.loc;return n?.start?.line?`L${n.start.line}`:String(o.type||"?")}var Ur=createRequire(import.meta.url);function Ft(o,e){let t={files:new Map,resolutionCache:new Map,localShadowCache:new Map};for(let{path:n,content:r}of o){let s=bn(n,r);t.files.set(n,s);let i=new Map;for(let a of s.imports)a.localName&&i.set(a.localName,`${a.resolvedFile}::${a.originalName}`);t.resolutionCache.set(n,i),t.localShadowCache.set(n,Wr(r));}return t}function Dt(o,e,t,n){if(t.files.size===0)return o;let r=t.resolutionCache.get(e);if(!r||r.size===0)return o;let s=t.localShadowCache.get(e);return t.files.get(e)?o.map(c=>{let l=r.get(c.calleeName);return !l||c.callerKey&&s?.get(c.callerKey)?.has(c.calleeName)||n.has(c.calleeName)?c:{...c,edgeKind:"precise",importSource:c.importSource||l}}):o}function Wr(o){let e=new Map;try{let n=Ur("@babel/parser").parse(o,{sourceType:"module",plugins:["jsx","typescript","decorators-legacy","classProperties"],errorRecovery:!0}),r=(n.program||n).body;if(!r?.length)return e;for(let s of r)Sn(s,e);}catch{return e}return e}function Sn(o,e){if(o.type==="FunctionDeclaration"){let t=xe(o.id);if(!t)return;Ce(t,o,e),Br(Kr(o),t,e);return}if(o.type==="VariableDeclaration"){xn(o,void 0,e);return}if(o.type==="ClassDeclaration"){Hr(o,e);return}if(o.type==="ExportNamedDeclaration"||o.type==="ExportDefaultDeclaration"){let t=o.declaration;if(!t)return;Sn(t,e);}}function Br(o,e,t){for(let n of o){if(n.type==="FunctionDeclaration"){let r=xe(n.id);if(!r)continue;Ce(r,n,t,e);continue}if(n.type==="VariableDeclaration"){xn(n,e,t);continue}if(n.type==="ExpressionStatement"){let r=n.expression;if(r?.type!=="CallExpression")continue;let s=r.callee,i=s?.type==="Identifier"?String(s.name||""):"";if(!/^use[A-Z]/.test(i))continue;let a=r.arguments?.[0];if(!a||a.type!=="ArrowFunctionExpression"&&a.type!=="FunctionExpression")continue;Ce(i,a,t,e,n);}}}function xn(o,e,t){for(let n of o.declarations||[]){let r=xe(n.id),s=n.init;!r||!s||s.type!=="ArrowFunctionExpression"&&s.type!=="FunctionExpression"||Ce(r,s,t,e,n);}}function Hr(o,e){let t=xe(o.id);if(!t)return;let n=o.body?.body||[];for(let r of n){let s=xe(r.key);if(!s||s==="constructor")continue;if(r.type==="ClassMethod"||r.type==="ClassPrivateMethod"){Ce(s,r,e,t);continue}let i=r.value;i&&(i.type==="ArrowFunctionExpression"||i.type==="FunctionExpression")&&(r.type==="ClassProperty"||r.type==="PropertyDefinition")&&Ce(s,i,e,t,r);}}function Ce(o,e,t,n,r){let s=Vr(r||e),i=zr(o,s.start,s.end,n),a=Xr(e);t.set(i,a);}function Xr(o){let e=new Set;for(let n of o.params||[])for(let r of Se(n))e.add(r);let t=o.body;return t&&Ot(t,n=>{if(n.type==="VariableDeclarator"){for(let r of Se(n.id))e.add(r);return}if(n.type==="FunctionDeclaration"){let r=xe(n.id);return r&&e.add(r),false}if(n.type==="ClassDeclaration"){let r=xe(n.id);return r&&e.add(r),false}}),e}function Ot(o,e){if(!(!o||typeof o!="object")&&e(o)!==false)for(let t of Object.keys(o)){if(t==="type"||t==="loc"||t==="start"||t==="end")continue;let n=o[t];if(Array.isArray(n)){for(let r of n){if(!r||typeof r!="object"||!r.type)continue;let s=r;Tn(s)||Ot(s,e);}continue}if(n&&typeof n=="object"&&n.type){let r=n;if(Tn(r))continue;Ot(r,e);}}}function Tn(o){return ["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression","ClassMethod","ClassPrivateMethod","ObjectMethod"].includes(String(o.type||""))}function Se(o){return o?o.type==="Identifier"?[String(o.name||"")]:o.type==="AssignmentPattern"?Se(o.left):o.type==="RestElement"?Se(o.argument):o.type==="ArrayPattern"?(o.elements||[]).flatMap(e=>Se(e)):o.type==="ObjectPattern"?(o.properties||[]).flatMap(e=>{if(e.type==="RestElement")return Se(e.argument);let t=e.value||e.argument;return Se(t)}):[]:[]}function xe(o){if(o&&o.type==="Identifier")return String(o.name||"")}function Kr(o){let e=o.body;return !e||e.type!=="BlockStatement"?[]:e.body||[]}function Vr(o){let e=o.loc;return {start:e?.start?.line??1,end:e?.end?.line??1}}function zr(o,e,t,n){return n?`${n}:${o}:${e}:${t}`:`root:${o}:${e}:${t}`}var An=createRequire(import.meta.url);function Ln(o,e){let t=o.errors||[];t.includes(e)||(o.errors=[...t,e]);}var Mt=class extends We{name="JsTsFallbackParser";canParse(e){let t=e.split(".").pop()?.toLowerCase();return ["js","ts","jsx","tsx"].includes(t||"")}parse(e,t){let n=super.parse(e,t);return n.framework=e.endsWith(".ts")||e.endsWith(".tsx")?"ts":"js",n}},qr=[new at,new we,new We,new ct,new Mt];function Be(o,e){for(let t of qr)if(t.canParse(o,e)){let n=t.parse(o,e);return Jr(n),Yr(n,e),n}return {framework:"js",filePath:o,symbols:[],relations:[],behaviors:[],errors:[`\u6CA1\u6709\u627E\u5230\u9002\u5408\u7684\u89E3\u6790\u5668: ${o}`]}}function Yr(o,e){if(o.symbols.length!==0)try{let t=e,n=o.filePath.endsWith(".vue"),r=0;if(n)try{let{parse:d}=An("@vue/compiler-sfc"),{descriptor:g}=d(e);if(g.scriptSetup?.content)t=g.scriptSetup.content,r=g.scriptSetup.loc.start.line-1;else if(g.script?.content)t=g.script.content,r=g.script.loc.start.line-1;else return}catch(d){Ln(o,`\u751F\u547D\u5468\u671F\u63D0\u53D6\u8DF3\u8FC7: Vue SFC \u89E3\u6790\u5931\u8D25 - ${String(d)}`);return}let a=An("@babel/parser").parse(t,{sourceType:"module",plugins:["jsx","typescript","decorators-legacy"],errorRecovery:!0}).program.body;if(!a?.length)return;let c=t.split(`
451
- `),{assignments:l,propertyWrites:p}=Nn({type:"Program",body:a},o.filePath,!1,c);if(r>0){for(let d of l)d.line+=r;for(let d of p)d.line+=r;}let u=new Set(o.symbols.map(d=>d.name));o.assignments=l.filter(d=>u.has(d.symbolName)),o.propertyWrites=p.filter(d=>u.has(d.objectName));}catch(t){Ln(o,`\u751F\u547D\u5468\u671F\u63D0\u53D6\u8DF3\u8FC7: AST \u89E3\u6790\u5931\u8D25 - ${String(t)}`);}}function Jr(o){if(!o.relations.length||!o.behaviors.length)return;let e=new Set(["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","setup","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onActivated","onDeactivated","onErrorCaptured","componentDidMount","componentDidUpdate","componentWillUnmount","componentDidCatch","getDerivedStateFromProps","getSnapshotBeforeUpdate","render","init","initialize"]),t=new Set(o.behaviors.filter(r=>r.category==="network").map(r=>r.symbolName));if(t.size===0)return;let n=new Set(o.behaviors.map(r=>`${r.symbolName}:${r.category}:${r.apiName}:${r.operation}:${r.line}`));for(let r of o.relations){if(!t.has(r.calleeName)||t.has(r.callerName)||e.has(r.callerName))continue;let s={symbolName:r.callerName,symbolKey:r.callerKey,category:"network",apiName:"wrapped_network",operation:r.calleeName,detail:r.args,line:r.line},i=`${s.symbolName}:${s.category}:${s.apiName}:${s.operation}:${s.line}`;n.has(i)||(n.add(i),o.behaviors.push(s));}}function He(o,e){let t=Zr(e),n=o.exportSignatureEntries?.length?[...o.exportSignatureEntries]:(()=>{let a=[];for(let c of o.symbols)if(c.isExported){let l=c.signature||"";a.push(`${c.name}:${l}`);}return a.sort(),a})(),r=n.length>0?Rn(n.join(`
452
- `)):"",s=[];if(o.fileDependencies&&o.fileDependencies.length>0)for(let a of o.fileDependencies)(a.dependencyKind==="import"||a.dependencyKind==="re_export")&&s.push(a.toFile);s.sort();let i=s.length>0?Rn(s.join(`
453
- `)):"";return {contentHash:t,exportSignatureHash:r,importSignatureHash:i}}function jt(o,e){if(!o)return "full_changed";if(o.contentHash===e.contentHash)return "unchanged";let t=o.exportSignatureHash!==e.exportSignatureHash,n=o.importSignatureHash!==e.importSignatureHash;return t&&n?"full_changed":t?"export_changed":n?"import_changed":"body_only"}function Ut(o,e,t,n=200){if(e==="unchanged")return {files:[],truncated:false};if(e==="body_only")return {files:[o],truncated:false};if(e==="import_changed")return {files:[o],truncated:false};let r=new Set([o]),s=[o];for(;s.length>0;){let i=s.shift(),a=t.get(i)||[];for(let c of a)if(!r.has(c)){if(r.add(c),r.size>=n)return {files:Array.from(r),truncated:true};s.push(c);}}return {files:Array.from(r),truncated:false}}function Zr(o){return createHash("sha256").update(o,"utf-8").digest("hex").slice(0,16)}function Rn(o){return createHash("sha256").update(o,"utf-8").digest("hex").slice(0,12)}var Qr={maxFiles:20,maxTimeMs:1500},pt=class{pending=[];options;constructor(e){this.options={...Qr,...e};}configure(e){this.options={...this.options,...e};}enqueue(e,t){let n=this.pending.find(r=>r.relPath===e);if(n){let r={high:3,normal:2,low:1};r[t]>r[n.priority]&&(n.priority=t);return}this.pending.push({relPath:e,priority:t,addedAt:Date.now()});}dequeueBatch(){if(this.pending.length===0)return {tasks:[],exceededBudget:false,remainingPending:0};let e={high:0,normal:1,low:2};this.pending.sort((s,i)=>{let a=e[s.priority],c=e[i.priority];return a!==c?a-c:s.addedAt-i.addedAt});let t=[],n=this.pending.length>this.options.maxFiles;for(let s=0;s<Math.min(this.options.maxFiles,this.pending.length);s++)t.push(this.pending[s]);let r=new Set(t.map(s=>s.relPath));return this.pending=this.pending.filter(s=>!r.has(s.relPath)),{tasks:t,exceededBudget:n,remainingPending:this.pending.length}}requeue(e){if(e.length===0)return;let t=new Set(this.pending.map(r=>r.relPath)),n=e.filter(r=>!t.has(r.relPath));this.pending=[...n,...this.pending];}clear(){this.pending=[];}get pendingCount(){return this.pending.length}get budget(){return this.options}summary(){return this.pending.map(e=>({relPath:e.relPath,priority:e.priority}))}};var dt=class{projectRoot;db;scheduler;constructor(e,t){this.projectRoot=e,this.db=t,this.scheduler=new pt;}getScheduler(){return this.scheduler}enhancePreciseRelations(e){try{let t=e.filter(({absPath:r})=>/\.(ts|tsx|js|jsx)$/i.test(r)).map(({absPath:r,content:s})=>({path:r,content:s})),n=Ft(t,"precise");if(n.files.size===0)return;for(let r of e){if(r.result.relations.length===0)continue;let s=new Set(r.result.symbols.map(i=>i.name));r.result.relations=Dt(r.result.relations,r.result.filePath,n,s);}}catch(t){let n=`precise enhancement \u5931\u8D25\uFF0C\u5DF2\u56DE\u9000\u5230\u672C\u5730 relations: ${String(t)}`;process.stderr.write(`[Frontend-Code-Skimmer] ${n}
454
- `);for(let r of e){let s=r.result.errors||[];s.includes(n)||(r.result.errors=[...s,n]);}}}enqueuePrecise(e,t){this.scheduler.enqueue(e,t),this.db.enqueuePrecisePending(e,t);}hydratePendingPreciseQueue(){for(let e of this.db.listPrecisePending())this.scheduler.enqueue(e.relPath,e.priority);}enqueueAffectedPrecise(e,t){if(t==="unchanged")return;let n=this.db.getReverseDependencyMap(),{files:r,truncated:s}=Ut(e,t,n);s&&process.stderr.write(`[Frontend-Code-Skimmer] \u26A0\uFE0F ${e} \u7684 precise \u5F85\u8865\u7B97\u6269\u6563\u5DF2\u8FBE\u4E0A\u9650\uFF08200\uFF09\uFF0C\u90E8\u5206\u4E0B\u6E38\u6587\u4EF6\u5C06\u8DF3\u8FC7\u672C\u8F6E
455
- `);let i=t==="export_changed"||t==="full_changed"?"high":t==="import_changed"?"normal":"low";for(let a of r)this.enqueuePrecise(a,i);}async indexProject(e){let t=Date.now(),n=e?.include||[...St],r=e?.exclude||[...Tt],s=e?.force||false,i=Date.now(),a=await es(n,{cwd:this.projectRoot,ignore:r,absolute:true,onlyFiles:true}),c=Date.now()-i,l={totalFiles:a.length,indexedFiles:0,skippedFiles:0,totalSymbols:0,durationMs:0,phaseTimings:{discoverFilesMs:c,readFilesMs:0,parseMs:0,saveToDbMs:0,totalMs:0},errors:[]};s&&(this.scheduler.clear(),this.db.clearProjectIndex());let p=0,u=0,d=0;if((e?.precisionMode||"heuristic")==="precise"){let f=[];for(let m=0;m<a.length;m++){let h=a[m],b=de(h,this.projectRoot);e?.onProgress?.(m+1,a.length,b);try{let S=Q__default.statSync(h).mtimeMs,y=Date.now(),T=Q__default.readFileSync(h,"utf-8"),E=Date.now()-y,L=Date.now(),_=Be(h,T),N=Date.now()-L;p+=E,u+=N,f.push({absPath:h,relPath:b,result:_,parseMs:N,readMs:E,content:T,mtime:S});}catch(S){this.db.recordIndexFailure(b,String(S)),l.errors.push({file:b,error:String(S)});}}this.enhancePreciseRelations(f);for(let m of f){let h=Date.now();try{let b=Me(m.content),S=qe(m.content),y=Buffer.byteLength(m.content,"utf-8"),T=He(m.result,m.content);this.db.saveParseResult(m.result,m.absPath,m.relPath,b,y,S,m.mtime,T.exportSignatureHash,T.importSignatureHash),this.db.deletePrecisePending(m.relPath),l.indexedFiles++,l.totalSymbols+=m.result.symbols.length,m.result.errors?.length&&l.errors.push(...m.result.errors.map(E=>({file:m.relPath,error:E}))),d+=Date.now()-h;}catch(b){this.db.recordIndexFailure(m.relPath,String(b)),l.errors.push({file:m.relPath,error:String(b)});}}this.scheduler.clear();}else for(let f=0;f<a.length;f++){let m=a[f],h=de(m,this.projectRoot);e?.onProgress?.(f+1,a.length,h);try{let b=await this.indexFile(m,h,s);b.skipped?l.skippedFiles++:(l.indexedFiles++,l.totalSymbols+=b.symbolCount,p+=b.readMs||0,u+=b.parseMs||0,d+=b.saveMs||0,b.errors?.length&&l.errors.push(...b.errors.map(S=>({file:h,error:S}))));}catch(b){this.db.recordIndexFailure(h,String(b)),l.errors.push({file:h,error:String(b)});}}return l.phaseTimings.readFilesMs=p,l.phaseTimings.parseMs=u,l.phaseTimings.saveToDbMs=d,l.phaseTimings.totalMs=Date.now()-t,l.durationMs=l.phaseTimings.totalMs,l}async selectivePrecise(e){let t=Date.now(),n=e?.maxFiles??20,r=e?.maxTimeMs??1500;this.hydratePendingPreciseQueue(),this.scheduler.configure({maxFiles:n,maxTimeMs:r});let s=this.db.getAllFilePaths(),i=this.db.getReverseDependencyMap(),a=new Set;for(let h of s){let b=this.fileAbsPath(h);if(!Q__default.existsSync(b))continue;let S=this.db.getFileSignatures(h);if(!S){this.scheduler.enqueue(h,"low");continue}let y;try{y=Q__default.statSync(b);let P=this.db.getFileHashAndMtime(h);if(P&&P.mtime===y.mtimeMs&&P.contentHash)continue}catch{continue}let T=Q__default.readFileSync(b,"utf-8"),E=Me(T);if(S.contentHash===E){this.db.updateFileMtime(h,y.mtimeMs);continue}let L=Be(b,T),_=He(L,T),N=jt(S,_);if(N==="unchanged")continue;let{files:A,truncated:k}=Ut(h,N,i);k&&process.stderr.write(`[Frontend-Code-Skimmer] \u26A0\uFE0F ${h} \u7684\u53CD\u5411\u4F9D\u8D56\u6269\u6563\u5DF2\u8FBE\u4E0A\u9650\uFF08200\uFF09\uFF0C\u90E8\u5206\u4E0B\u6E38\u6587\u4EF6\u5C06\u8DF3\u8FC7\u672C\u6B21 precise \u91CD\u7B97
456
- `);for(let P of A)a.add(P);let $=N==="export_changed"||N==="full_changed"?"high":N==="import_changed"?"normal":"low";for(let P of A)this.scheduler.enqueue(P,$);}let{tasks:c,exceededBudget:l,remainingPending:p}=this.scheduler.dequeueBatch(),u=[],d=[],g=0;for(let h=0;h<c.length;h++){let S=c[h].relPath;if(a.add(S),Date.now()-t>=r){d.push(...c.slice(h));break}let y=this.fileAbsPath(S);if(!Q__default.existsSync(y)){this.removeFile(S),this.db.deletePrecisePending(S);continue}try{let T=Q__default.readFileSync(y,"utf-8"),E=Be(y,T),L=Me(T),_=qe(T),N=Buffer.byteLength(T,"utf-8");u.push({absPath:y,relPath:S,result:E,content:T,hash:L,lineCount:_,fileSize:N,mtime:Q__default.statSync(y).mtimeMs});}catch(T){this.db.recordIndexFailure(S,String(T)),process.stderr.write(`[Frontend-Code-Skimmer] Selective precise \u5931\u8D25: ${S} - ${String(T)}
457
- `);}}d.length>0&&this.scheduler.requeue(d),this.enhancePreciseRelations(u);for(let h of u)try{let b=He(h.result,h.content);this.db.saveParseResult(h.result,h.absPath,h.relPath,h.hash,h.fileSize,h.lineCount,h.mtime,b.exportSignatureHash,b.importSignatureHash),this.db.deletePrecisePending(h.relPath),g++;}catch(b){this.db.recordIndexFailure(h.relPath,String(b)),process.stderr.write(`[Frontend-Code-Skimmer] Selective precise \u843D\u5E93\u5931\u8D25: ${h.relPath} - ${String(b)}
458
- `);}let f=Date.now()-t,m=p+d.length;return process.stderr.write(`[Frontend-Code-Skimmer] Selective precise: ${g}/${a.size} affected, ${f}ms, pending: ${m}${l||d.length>0?" (budget limited)":""}
459
- `),{reindexedFiles:g,affectedFiles:Array.from(a),skippedByBudget:m}}async indexFile(e,t,n=false){let r=0,s=0,i=null;if(!n){try{let L=Q__default.statSync(e);r=L.mtimeMs,s=L.size;}catch{}if(i=this.db.getFileMeta(t),i&&i.mtime>0&&i.mtime===r&&!(i.fileSize>0&&i.fileSize!==s))return {skipped:true,symbolCount:0,readMs:0,parseMs:0,saveMs:0}}let a=n?null:this.db.getFileSignatures(t),c=!n&&(this.db.hasPreciseRelations()||this.db.getPrecisePendingCount()>0),l=Date.now(),p=Q__default.readFileSync(e,"utf-8"),u=Date.now()-l,d=Me(p);if(!n&&i&&i.hash===d)return r>0&&i.mtime!==r&&this.db.updateFileMtime(t,r),{skipped:true,symbolCount:0,readMs:u,parseMs:0,saveMs:0};let g=qe(p),f=Buffer.byteLength(p,"utf-8"),m=Date.now(),h=Be(e,p),b=Date.now()-m,S=He(h,p),y=jt(a,S),T=Date.now();this.db.clearIndexFailures(t),this.db.saveParseResult(h,e,t,d,f,g,r,S.exportSignatureHash,S.importSignatureHash),c&&this.enqueueAffectedPrecise(t,y);let E=Date.now()-T;return {skipped:false,symbolCount:h.symbols.length,readMs:u,parseMs:b,saveMs:E,errors:h.errors,changeType:y}}removeFile(e){this.db.deleteFile(e);}fileAbsPath(e){return Y__default.join(this.projectRoot,e)}async startWatcher(){let{default:e}=await import('chokidar'),t=e.watch([...St].map(r=>Y__default.posix.join(this.projectRoot,r)),{cwd:this.projectRoot,ignored:[...Tt],persistent:true,ignoreInitial:true,awaitWriteFinish:{stabilityThreshold:dn}}),n=async r=>{let s=de(r,this.projectRoot);try{await this.indexFile(r,s),process.stderr.write(`[Frontend-Code-Skimmer] \u5DF2\u66F4\u65B0\u7D22\u5F15: ${s}
460
- `);}catch(i){process.stderr.write(`[Frontend-Code-Skimmer] \u66F4\u65B0\u5931\u8D25: ${s} - ${String(i)}
461
- `);}};return t.on("add",n).on("change",n).on("unlink",r=>{let s=de(r,this.projectRoot);this.removeFile(s),process.stderr.write(`[Frontend-Code-Skimmer] \u5DF2\u5220\u9664\u7D22\u5F15: ${s}
462
- `);}),()=>t.close()}};var rs=8,ss=30,is=14,os=360*60*1e3,ut=class{dbCache=new Map;accessTimes=new Map;indexerCache=new Map;dbPaths=new Map;watcherCleanups=new Map;lastProject=null;globalCacheDir;defaultProject;maxOpenProjects;maxIdleMs;dbTtlMs;lastDiskCleanupAt=0;constructor(){this.globalCacheDir=Y__default.join(ts.homedir(),".frontend-code-skimmer","databases"),Q__default.mkdirSync(this.globalCacheDir,{recursive:true}),this.defaultProject=process.env.SKIMMER_PROJECT||null,this.defaultProject&&(this.defaultProject=Y__default.resolve(this.defaultProject)),this.maxOpenProjects=this.parsePositiveInt(process.env.SKIMMER_MAX_OPEN_PROJECTS,rs);let e=this.parsePositiveInt(process.env.SKIMMER_DB_IDLE_MINUTES,ss),t=this.parsePositiveInt(process.env.SKIMMER_DB_TTL_DAYS,is);this.maxIdleMs=e*60*1e3,this.dbTtlMs=t*24*60*60*1e3,this.maybeCleanupDiskCache(Date.now());}resolveProjectRoot(e){if(e){let t=Y__default.resolve(e);if(!Q__default.existsSync(t))throw new Error(`\u9879\u76EE\u8DEF\u5F84\u4E0D\u5B58\u5728: ${t}`);return t}return this.lastProject?this.lastProject:this.defaultProject?this.defaultProject:process.cwd()}getDatabase(e){let t=Y__default.resolve(e),n=Date.now();if(this.evictIdleDatabases(n),this.maybeCleanupDiskCache(n),this.dbCache.has(t))return this.touchProject(t,n),this.dbCache.get(t);this.evictLruIfNeeded(n);let r=this.resolveDbPath(t),s=new Je(t,r);return this.dbCache.set(t,s),this.dbPaths.set(t,r),this.touchProject(t,n),this.lastProject=t,process.stderr.write(`[Frontend-Code-Skimmer] \u5DF2\u8FDE\u63A5\u9879\u76EE: ${t}
425
+ `,i=[e.toLowerCase()];return t&&(r+=" AND f.path_lc LIKE ?",i.push(`%${t.toLowerCase()}%`)),n&&(r+=" AND LOWER(COALESCE(r.args, '')) LIKE LOWER(?)",i.push(`%${n}%`)),r+=" ORDER BY f.path, r.line_number",this.db.prepare(r).all(...i)}close(){this.db.close();}};function K(s){let e=s.property;return e?e.type==="Identifier"?String(e.name||""):e.type==="Literal"||e.type==="StringLiteral"?String(e.value||""):null:null}function te(s){let e=s.object;return e?e.type==="Identifier"?String(e.name||""):e.type==="ThisExpression"?K(s):e.type==="MemberExpression"?e.object?.type==="ThisExpression"?K(e):te(e):null:null}function re(s,e){let t=s||"";return /created|mounted|beforeMount|setup\s*\(|\bdata\s*\(/.test(t)?"init":/getItem|localStorage|sessionStorage|\bfetch\b|\bload[A-Z]|\bget[A-Z]/.test(t)?"cache":/@click|@change|@input|onClick|onChange|handle[A-Z]|\bwatch\b/.test(t)?"user":e<=30?"init":"unknown"}function G(s,e,t,n=false){let r=[];return z(s,o=>{if(n&&o!==s&&(o.type==="FunctionDeclaration"||o.type==="ArrowFunctionExpression"||o.type==="FunctionExpression"||o.type==="ClassDeclaration"))return false;if(o.type==="CallExpression"||o.type==="OptionalCallExpression"){let c=kr(o,e);c&&r.push(c);}if(o.type==="MemberExpression"){let a=Cr(o);a&&r.push(a);}}),Mr(r)}function kr(s,e,t){let n=s.callee;if(!n)return null;let r=Ke(s);if(n.type==="MemberExpression"||n.type==="OptionalMemberExpression"){let i=Ir(n);if(!i)return null;let{apiName:o,operation:a}=i,c=s.arguments,l=ae(c?.[0]),p=Or(o);return p?{symbolName:e,category:p,apiName:o,operation:a,detail:l,line:r}:o==="this"&&st(a)?{symbolName:e,category:"network",apiName:`this.${a}`,operation:"wrapped_call",detail:l||ae(c?.[1]),line:r}:Nn(a)&&Dr(c)?{symbolName:e,category:"network",apiName:o,operation:a,detail:l||ae(c?.[1]),line:r}:st(o)||st(`${o}.${a}`)?{symbolName:e,category:"network",apiName:o,operation:Nn(a)?a:"wrapped_call",detail:l||ae(c?.[1]),line:r}:null}if(n.type==="Identifier"){let i=n.name,o=$r(i),a=s.arguments,c=ae(a?.[0]);return o?{symbolName:e,category:o.category,apiName:i,operation:o.operation,detail:c,line:r}:st(i)?{symbolName:e,category:"network",apiName:i,operation:"wrapped_call",detail:c||ae(a?.[1]),line:r}:null}return null}function Cr(s,e,t){let n=s.object,r=s.property;if(!n||!r||n.type!=="MemberExpression"&&n.type!=="ThisExpression"&&n.type!=="Identifier")return null;let i=Fr(n);if(!i)return null;r.type==="Identifier"?r.name:"";if(i==="this"||i===""){n.type==="MemberExpression"?n.property?.name:"";return null}return null}function Ir(s){let e=s.object,t=s.property;if(!e||!t||t.type!=="Identifier")return null;let n=t.name;if(e.type==="MemberExpression"||e.type==="OptionalMemberExpression"){let r=e.property?.name;if(r)return {apiName:r,operation:n}}return e.type==="Identifier"?{apiName:e.name,operation:n}:e.type==="ThisExpression"?{apiName:"this",operation:n}:null}function $r(s){let e={fetch:"network",setTimeout:"timer",setInterval:"timer",clearTimeout:"timer",clearInterval:"timer",requestAnimationFrame:"timer",navigate:"router"};return e[s]?{category:e[s],operation:s}:null}function Ke(s){return s.loc?.start?.line??0}function Pr(s){let e=s.loc;return {line:e?.start?.line??0,column:e?.start?.column??0}}function Fr(s){return s.type==="Identifier"?s.name:s.type==="ThisExpression"?"this":null}function Or(s){if(s==="this")return null;for(let[e,t]of Object.entries(un))if(s in t)return e;return null}function ae(s,e){if(s){if(s.type==="Literal"||s.type==="StringLiteral"||s.type==="NumericLiteral"||s.type==="BooleanLiteral")return String(s.value);if(s.type==="NullLiteral")return "null";if(s.type==="TemplateLiteral"){let t=s.quasis,n=s.expressions||[],r=[];for(let o=0;o<t.length;o++){let a=t[o].value?.cooked||"";if(a&&r.push(a),o<n.length){let c=it(n[o])||"expr";r.push(`\${${c}}`);}}return r.join("")||"${expr}"}if(s.type==="Identifier")return `[\u53D8\u91CF: ${s.name}]`;if(s.type==="ObjectExpression"){let t=s.properties||[],n=["url","uri","path","api","endpoint"];for(let r of t){let i=r.key,o=r.value;if(!i||!o)continue;let a=i.type==="Identifier"?String(i.name):i.type==="Literal"?String(i.value):"";if(!n.includes(a))continue;let c=ae(o);if(c)return `${a}:${c}`}return "{...}"}}}function it(s,e){if(!s)return;if(s.type==="Identifier")return s.name;if(s.type==="ThisExpression")return "this";if(s.type==="Literal"||s.type==="StringLiteral"||s.type==="NumericLiteral"||s.type==="BooleanLiteral")return String(s.value);if(s.type==="NullLiteral")return "null";if(s.type==="MemberExpression"){let n=it(s.object)||"obj",r=s.property,i=r?.type==="Identifier"?String(r.name):it(r)||"prop";return s.computed?`${n}[${i}]`:`${n}.${i}`}if(s.type==="CallExpression")return `${it(s.callee)||"fn"}(...)`;if(s.type==="TemplateLiteral")return ae(s);let t=ae(s);return t?.startsWith("[\u53D8\u91CF: ")?t.replace(/^\[变量: /,"").replace(/\]$/,""):t}function st(s){return /request|api|http|fetch|ajax|akscommonhandle|commonhandle/i.test(s)}function Nn(s){return ["get","post","put","delete","patch","request"].includes(s.toLowerCase())}function Dr(s,e){if(!s||s.length===0)return false;for(let t of s.slice(0,2)){let n=ae(t);if(n&&(/https?:\/\//i.test(n)||n.includes("/")||/gw\d?\/|\/m\/|\/api\//i.test(n)))return true}return false}function Mr(s){let e=new Set;return s.filter(t=>{let n=`${t.apiName}:${t.operation}:${t.line}`;return e.has(n)?false:(e.add(n),true)})}function Le(s,e,t){let n=[];return z(s,r=>{if(r.type==="CallExpression"&&r.callee?.type==="MemberExpression"){let i=r.callee,o=i.object,a=i.property;if(o.type==="ThisExpression"&&a.type==="Identifier"){let c=a.name;if(!c.startsWith("$")&&c!==e){let l=r.arguments,p=lt(l);n.push({calleeName:c,line:Ke(r),args:p});}}}}),n}function q(s,e,t,n=false){let r=[];return z(s,o=>{if(n&&o!==s&&(o.type==="FunctionDeclaration"||o.type==="ArrowFunctionExpression"||o.type==="FunctionExpression"||o.type==="ClassDeclaration"))return false;if(o.type==="CallExpression"&&o.callee?.type==="Identifier"){let a=o.callee.name;if(a!==e&&!xn(a)){let c=o.arguments,l=lt(c);r.push({calleeName:a,line:Ke(o),args:l});}}}),ct(r)}function Sn(s,e,t){let n=[];return z(s,i=>{if(i!==s&&(i.type==="FunctionDeclaration"||i.type==="ArrowFunctionExpression"||i.type==="FunctionExpression"||i.type==="ClassDeclaration"))return false;if(i.type!=="CallExpression"&&i.type!=="OptionalCallExpression")return;let o=i.arguments||[];for(let a of o)a.type!=="ArrowFunctionExpression"&&a.type!=="FunctionExpression"||(n.push(...q(a,e,t,true)),n.push(...Le(a,e)),n.push(...ot(a,e,t,true)),n.push(...at(a,e,t,true)));}),ct(n)}function ot(s,e,t,n=false){let r=[];return z(s,o=>{if(n&&o!==s&&(o.type==="FunctionDeclaration"||o.type==="ArrowFunctionExpression"||o.type==="FunctionExpression"||o.type==="ClassDeclaration"))return false;if(o.type!=="CallExpression"&&o.type!=="OptionalCallExpression")return;let a=o.callee;if(!a||a.type!=="MemberExpression"&&a.type!=="OptionalMemberExpression")return;let c=a.object;if(!c||c.type==="ThisExpression")return;let l=te(a),p=K(a);if(!l||!p||p===e||jr(l)||xn(p))return;let u=o.arguments,d=lt(u);r.push({calleeName:p,line:Ke(o),args:d,receiverToken:l});}),ct(r)}function at(s,e,t,n=false){let r=[];return z(s,o=>{if(n&&o!==s&&(o.type==="FunctionDeclaration"||o.type==="ArrowFunctionExpression"||o.type==="FunctionExpression"||o.type==="ClassDeclaration"))return false;if(o.type!=="NewExpression")return;let a=o.callee;if(!a||a.type!=="Identifier")return;let c=String(a.name||"");if(!c||c===e||Br(c))return;let l=o.arguments;r.push({calleeName:c,line:Ke(o),args:lt(l)});}),ct(r)}function xn(s){return /^(useState|useEffect|useMemo|useCallback|useRef|useContext|useReducer|ref|reactive|computed|watch|watchEffect|console|setTimeout|setInterval|Math|Object|Array|JSON|String|Number|Boolean|Promise|require|import|trim|toLowerCase|toUpperCase|split|join|slice|substring|substr|replace|match|test|startsWith|endsWith|includes|map|filter|reduce|forEach|some|every|find|findIndex|push|pop|shift|unshift|splice|sort|reverse|concat|flat|flatMap|set|get|has|add|delete|clear|keys|values|entries)$/.test(s)}function jr(s){return /^(console|Math|Object|Array|JSON|String|Number|Boolean|Promise|Reflect|Date|Error|RegExp|Symbol|process|fs|path|os|assert|test|document|window|localStorage|sessionStorage|navigator|global|globalThis)$/.test(s)}function Br(s){return /^(Object|Array|Map|Set|WeakMap|WeakSet|Date|Error|RegExp|Promise|URL|URLSearchParams|AbortController|FormData|Blob|File|Buffer|String|Number|Boolean|Symbol)$/.test(s)}function ct(s){let e=new Set;return s.filter(t=>{let n=`${t.receiverToken||""}:${t.calleeName}:${t.line}:${t.args||""}`;return e.has(n)?false:(e.add(n),true)})}function lt(s,e){if(!s||s.length===0)return;let t=s.slice(0,3).map(n=>ae(n)).filter(n=>!!n);return t.length>0?t.join(", "):void 0}function z(s,e){if(!(!s||typeof s!="object")&&e(s)!==false)for(let t of Object.keys(s)){if(t==="type"||t==="loc"||t==="start"||t==="end")continue;let n=s[t];if(Array.isArray(n))for(let r of n)r&&typeof r=="object"&&r.type&&z(r,e);else n&&typeof n=="object"&&n.type&&z(n,e);}}function pt(s,e){let t=[],n=new Set,r=s.split(`
426
+ `);for(let i=0;i<r.length;i++){let o=/(?:@|v-on:)[a-z][a-z0-9-]*(?:\.[a-z-]+)*="([^"]+)"/g,a;for(;(a=o.exec(r[i]))!==null;){let l=a[1].trim().match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\([^)]*\))?$/);if(!l)continue;let p=l[1];if(p.startsWith("$"))continue;let u=e+i,d=`${p}:${u}:${a.index}`;n.has(d)||(n.add(d),t.push({calleeName:p,line:u}));}}return t}function Tn(s,e){let t=[],n=new Set;return z(s,r=>{if(r.type!=="JSXAttribute")return;let i=r.name,o=r.value;if(!i||!o)return;let a=i.type==="JSXIdentifier"?String(i.name):"";if(!/^on[A-Z]/.test(a)||o.type!=="JSXExpressionContainer")return;let c=o.expression;if(!c)return;let l;if(c.type==="Identifier")l=c.name;else if(c.type==="MemberExpression"){let h=c.property?.name;h&&!/^\$/.test(h)&&(l=h);}let{line:p,column:u}=Pr(r),d=`${l}:${p}:${u}`;!l||n.has(d)||(n.add(d),t.push({calleeName:l,line:p}));}),t}var Wr=createRequire(import.meta.url),An=false;function Hr(s){An||(An=true,process.stderr.write(`[Frontend-Code-Skimmer] precise import graph \u5DF2\u964D\u7EA7: ${String(s)}
427
+ `));}function Ln(s,e,t){let n={filePath:s,imports:[],exports:[]};try{let r=Wr("typescript"),i=r.createSourceFile(s,e,r.ScriptTarget.Latest,!0);r.forEachChild(i,o=>{if(r.isImportDeclaration(o)){let a=o.moduleSpecifier;if(!a||!r.isStringLiteral(a))return;let c=a.text,l=ut(s,c),p=o.importClause;if(!p){n.imports.push({localName:"",originalName:"",modulePath:c,resolvedFile:l,isDefault:!1,isReExport:!1});return}let u=p.namedBindings;if(u&&r.isNamedImports(u))for(let d of u.elements){let h=d.propertyName?d.propertyName.text:d.name.text;n.imports.push({localName:d.name.text,originalName:h,modulePath:c,resolvedFile:l,isDefault:!1,isReExport:!1});}u&&r.isNamespaceImport(u)&&n.imports.push({localName:u.name.text,originalName:"*",modulePath:c,resolvedFile:l,isDefault:!1,isReExport:!1}),p.name&&n.imports.push({localName:p.name.text,originalName:"default",modulePath:c,resolvedFile:l,isDefault:!0,isReExport:!1});}if(r.isExportDeclaration(o)){let a=o.moduleSpecifier;if(a&&r.isStringLiteral(a)){let c=a.text,l=o.exportClause;if(l&&r.isNamedExports(l))for(let p of l.elements)n.exports.push({name:p.name.text,isDefault:!1,source:"re_export",reExportFrom:c});}else if(o.exportClause){let c=o.exportClause;if(r.isNamedExports(c))for(let l of c.elements)n.exports.push({name:l.name.text,isDefault:!1,source:"local"});}}if(r.isExportAssignment(o)&&(o.isExportEquals||n.exports.push({name:"default",isDefault:!0,source:"local"})),(r.isFunctionDeclaration(o)||r.isVariableStatement(o)||r.isClassDeclaration(o))&&o.modifiers?.some(a=>a.kind===r.SyntaxKind.ExportKeyword)){if(r.isFunctionDeclaration(o)&&o.name)n.exports.push({name:o.name.text,isDefault:o.name.text==="default",source:"local"});else if(r.isClassDeclaration(o)&&o.name)n.exports.push({name:o.name.text,isDefault:o.name.text==="default",source:"local"});else if(r.isVariableStatement(o))for(let a of o.declarationList.declarations)r.isIdentifier(a.name)&&n.exports.push({name:a.name.text,isDefault:!1,source:"local"});}});}catch(r){Hr(r);}return n}function ut(s,e){let t=Y.dirname(s);if(e.startsWith(".")){let n=Y.resolve(t,e);return Ae(n)}return e.startsWith("@/")?Xr(s,e):e}function Xr(s,e){let t=Y.dirname(s);for(let n=0;n<10;n++){let r=Y.join(t,"src");if(ne.existsSync(r)&&ne.statSync(r).isDirectory()){let o=Y.join(r,e.replace(/^@\//,""));return Ae(o)}let i=Y.dirname(t);if(i===t)break;t=i;}return e}function B(s){return {callerName:s.callerName,callerLine:s.callerLine,callerKey:s.callerKey,calleeName:s.calleeName,callType:s.callType,line:s.line,args:s.args,sourceKind:Ze(s.callType),importSource:s.importSource,receiverToken:s.receiverToken,edgeKind:s.edgeKind||"heuristic"}}function me(s,e){let t=[];for(let n of s){let r=n.type;if(r==="ImportDeclaration"){let i=n.source,o=n.loc;i?.value&&t.push({fromFile:e,toFile:ut(e,i.value),dependencyKind:"import",line:o?.start?.line??1});}if(r==="ExportNamedDeclaration"||r==="ExportAllDeclaration"){let i=n.source,o=n.loc;i?.value&&t.push({fromFile:e,toFile:ut(e,i.value),dependencyKind:"re_export",line:o?.start?.line??1});}}return t}function mt(s,e){let t=new Map(e.map(r=>[r.name,r])),n=[];for(let r of s){let i=r.type;if(i==="ExportNamedDeclaration"){let o=r.declaration,a=r.source;if(o){if(o.type==="FunctionDeclaration"||o.type==="ClassDeclaration"){let c=o.id;c?.name&&n.push(ft(c.name,t.get(c.name)));}else if(o.type==="VariableDeclaration")for(let c of o.declarations||[]){let l=c.id;l?.type==="Identifier"&&l.name&&n.push(ft(l.name,t.get(l.name)));}continue}for(let c of r.specifiers||[]){let l=jt(c.local),p=jt(c.exported)||l;p&&(a?.value?n.push(`re_export:${p}:${a.value}`):n.push(ft(p,l?t.get(l):void 0)));}continue}if(i==="ExportAllDeclaration"){let o=r.source;o?.value&&n.push(`re_export_all:${o.value}`);continue}if(i==="ExportDefaultDeclaration"){let o=r.declaration;if(!o){n.push("default:unknown");continue}if(o.type==="Identifier"){let a=jt(o);n.push(ft("default",a?t.get(a):void 0));continue}if(o.type==="FunctionDeclaration"||o.type==="FunctionExpression"||o.type==="ArrowFunctionExpression"){let a=(o.params||[]).map(c=>Bt(c)).join(", ");n.push(`default:fn(${a})`);continue}if(o.type==="ClassDeclaration"||o.type==="ClassExpression"){n.push("default:class");continue}n.push(`default:${String(o.type||"unknown")}`);}}return n.sort()}function ft(s,e){return `${s}:${Kr(e)}`}function Kr(s){return s?s.category==="class"?"class":s.signature?`fn${s.signature.replace(/^[^(]*/,"")}`:s.category==="constant"?`const:${s.defaultValue||""}`:s.category:"unknown"}function jt(s){if(s){if(s.type==="Identifier")return String(s.name||"");if(s.type==="StringLiteral")return String(s.value||"")}}function Bt(s){return s?s.type==="Identifier"?String(s.name||"param"):s.type==="AssignmentPattern"?Bt(s.left):s.type==="RestElement"?Bt(s.argument):"param":"param"}var Rn=createRequire(import.meta.url);var $e=class{name="Vue2Parser";canParse(e,t){return e.endsWith(".vue")}parse(e,t){let n={framework:"vue2",filePath:e,symbols:[],relations:[],behaviors:[],errors:[]};try{let i=Rn("vue-template-compiler").parseComponent(t);if(!i.script?.content)return n;let o=i.script.content,a=this.getScriptStartLine(t,i.script.start),c=t.split(`
428
+ `),l;try{l=Rn("@babel/parser").parse(o,{sourceType:"module",plugins:["jsx","typescript","decorators-legacy"],errorRecovery:!0});}catch(p){return n.errors?.push(`AST \u89E3\u6790\u5931\u8D25: ${String(p)}`),n}if(this.extractFromAST(l.program,o,c,a,n),i.template?.content){let p=this.getScriptStartLine(t,i.template.start),u=pt(i.template.content,p);if(u.length>0){let d=i.template.content.split(`
429
+ `).length;n.symbols.push({name:"<template>",category:"lifecycle",framework:"vue2",startLine:p,endLine:p+d-1,camelWords:"template"});for(let h of u)n.relations.push(B({callerName:"<template>",callerLine:p,calleeName:h.calleeName,callType:"template_event",line:h.line}));}}}catch(r){n.errors?.push(`\u89E3\u6790\u5931\u8D25: ${String(r)}`);}return n}getScriptStartLine(e,t){let n=1;for(let r=0;r<t&&r<e.length;r++)e[r]===`
430
+ `&&n++;return n}extractFromAST(e,t,n,r,i){let o=t.split(`
431
+ `);i.fileDependencies=me(e.body||[],i.filePath);let a=null;z(e,u=>{if(u.type==="ExportDefaultDeclaration"){let d=u.declaration;if(d?.type==="ObjectExpression")a=d;else if(d?.type==="CallExpression"){let h=d.arguments;h&&h.length>0&&h[0].type==="ObjectExpression"&&(a=h[0]);}else if(d?.type==="Identifier"){let h=d.name;z(e,f=>{if(f.type==="VariableDeclarator"&&f.id?.name===h){if(f.init?.type==="ObjectExpression")a=f.init;else if(f.init?.type==="CallExpression"){let m=f.init.arguments;m&&m.length>0&&m[0].type==="ObjectExpression"&&(a=m[0]);}}});}}});let l=false;if(!a&&(z(e,u=>{u.type==="ExportDefaultDeclaration"&&u.declaration?.type==="ClassDeclaration"&&(l=true,this.extractFromClassComponent(u.declaration,t,n,r,i));}),!l)){let u=null,d=0,h=["data","methods","computed","props","watch","components","created","mounted","mixins"];z(e,f=>{if(f.type==="ObjectExpression"){let m=f.properties||[],y=0;for(let g of m){let N=this.getPropKey(g);N&&h.includes(N)&&y++;}y>d&&(d=y,u=f);}}),d>=2&&u&&(a=u);}if(!a)return;let p=a.properties;for(let u of p||[]){let d=this.getPropKey(u);if(!d)continue;let h=u.type==="ObjectMethod"?u:u.value;if(!h)continue;let f=m=>m+r-1;switch(d){case "name":h?.type==="Literal"&&(String(h.value));break;case "data":this.extractData(h,o,f,i);break;case "props":this.extractProps(h,o,f,i);break;case "computed":this.extractComputedOrMethods(h,"computed",o,f,n,i);break;case "methods":this.extractComputedOrMethods(h,"method",o,f,n,i);break;case "watch":this.extractWatch(h,o,f,i);break;case "filters":this.extractComputedOrMethods(h,"filter",o,f,n,i);break;case "components":this.extractComponents(h,i);break;case "mixins":this.extractMixins(h,i);break;default:if(Pt.includes(d)){let m=f(this.getStartLine(u)),y=f(this.getEndLine(u)),g=V(n.join(`
432
+ `),m),N=i.symbols.length;i.symbols.push({name:d,category:"lifecycle",framework:"vue2",startLine:m,endLine:y,jsdoc:g,camelWords:v(d)});let b=G(h,d);i.behaviors.push(...b);let S=Le(h,d);for(let E of S){if(E.args){let L=String(E.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");i.symbols[N].camelWords+=` ${v(L)} ${L}`;}i.relations.push(B({callerName:d,callerLine:m,calleeName:E.calleeName,callType:"this_method",line:f(E.line),args:E.args}));}}break}}}extractData(e,t,n,r){let i=null;if(e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"||e.type==="ObjectMethod"?z(e.body,o=>{o.type==="ReturnStatement"&&o.argument?.type==="ObjectExpression"&&(i=o.argument);}):e.type==="ObjectExpression"&&(i=e),!!i)for(let o of i.properties){let a=this.getPropKey(o);if(!a)continue;let c=n(this.getStartLine(o)),l=n(this.getEndLine(o)),p=this.getLiteralValue(o.value);r.symbols.push({name:a,category:"state",framework:"vue2",startLine:c,endLine:l,defaultValue:p,camelWords:v(a)});}}extractProps(e,t,n,r){if(e.type==="ArrayExpression"){for(let i of e.elements||[])if(i?.type==="Literal"){let o=String(i.value);r.symbols.push({name:o,category:"prop",framework:"vue2",startLine:n(this.getStartLine(i)),endLine:n(this.getEndLine(i)),camelWords:v(o)});}}else if(e.type==="ObjectExpression")for(let i of e.properties||[]){let o=this.getPropKey(i);if(!o)continue;let a=n(this.getStartLine(i)),c=n(this.getEndLine(i)),l;if(i.value?.type==="ObjectExpression"){let p=i.value.properties?.find(u=>this.getPropKey(u)==="default");p&&(l=this.getLiteralValue(p.value));}r.symbols.push({name:o,category:"prop",framework:"vue2",startLine:a,endLine:c,defaultValue:l,camelWords:v(o)});}}extractComputedOrMethods(e,t,n,r,i,o){if(e.type==="ObjectExpression")for(let a of e.properties||[]){let c=this.getPropKey(a);if(!c)continue;let l=a.type==="ObjectMethod"?a:a.value;if(!l)continue;let p=r(this.getStartLine(a)),u=r(this.getEndLine(a)),d=V(i.join(`
433
+ `),p),h=this.extractParams(l),f=l.async===true,m=h?`${c}(${h.join(", ")})`:c;if(o.symbols.push({name:c,category:t,framework:"vue2",startLine:p,endLine:u,signature:m,params:h,isAsync:f,jsdoc:d,camelWords:v(c)}),t==="method"&&l){let y=G(l,c);o.behaviors.push(...y);let g=Le(l,c);for(let b of g){if(b.args){let S=String(b.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");o.symbols[o.symbols.length-1].camelWords+=` ${v(S)} ${S}`;}o.relations.push(B({callerName:c,callerLine:p,calleeName:b.calleeName,callType:"this_method",line:r(b.line),args:b.args}));}let N=q(l,c,i,true);for(let b of N){if(b.args){let S=String(b.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");o.symbols[o.symbols.length-1].camelWords+=` ${v(S)} ${S}`;}o.relations.push(B({callerName:c,callerLine:p,calleeName:b.calleeName,callType:"direct_call",line:r(b.line),args:b.args}));}}}}extractWatch(e,t,n,r){if(e.type==="ObjectExpression")for(let i of e.properties||[]){let o=this.getPropKey(i);if(!o)continue;let a=n(this.getStartLine(i)),c=n(this.getEndLine(i));r.symbols.push({name:o,category:"effect",framework:"vue2",startLine:a,endLine:c,camelWords:v(o)});}}extractComponents(e,t){if(e.type==="ObjectExpression")for(let n of e.properties||[]){let r=this.getPropKey(n);r&&t.symbols.push({name:r,category:"component",framework:"vue2",startLine:this.getStartLine(n),endLine:this.getEndLine(n),camelWords:v(r)});}}extractMixins(e,t){if(e.type==="ArrayExpression")for(let n of e.elements||[]){let r=n?.type==="Identifier"?n.name:null;r&&t.symbols.push({name:r,category:"mixin",framework:"vue2",startLine:this.getStartLine(n),endLine:this.getEndLine(n),camelWords:v(r)});}}getPropKey(e){if(!e)return null;let t=e.key;return t?t.type==="Identifier"?t.name:t.type==="Literal"?String(t.value):null:null}getStartLine(e){return e?.loc?.start?.line??1}getEndLine(e){return e?.loc?.end?.line??1}extractParams(e){if(!e)return;let t=e.params;if(t)return t.map(n=>n.type==="Identifier"?n.name:n.type==="AssignmentPattern"?n.left?.name||"?":n.type==="RestElement"?`...${n.argument?.name||""}`:n.type==="TSParameterProperty"&&n.parameter?.name||"?")}getLiteralValue(e){if(e){if(e.type==="Literal"||e.type==="StringLiteral"||e.type==="NumericLiteral"||e.type==="BooleanLiteral")return String(e.value);if(e.type==="NullLiteral"||e.value===null)return "null";if(e.type==="ObjectExpression")return "{}";if(e.type==="ArrayExpression")return "[]";if(e.type==="Identifier"&&e.name==="undefined")return "undefined";if(e.type==="ArrowFunctionExpression"||e.type==="FunctionExpression"||e.type==="ObjectMethod")return "function"}}extractFromClassComponent(e,t,n,r,i){let o=c=>c+r-1,a=e.body;if(!(!a||a.type!=="ClassBody"))for(let c of a.body||[]){let l=this.getPropKey(c);if(!l)continue;let p=o(this.getStartLine(c)),u=o(this.getEndLine(c)),d=V(n.join(`
434
+ `),p);if(c.type==="ClassMethod"){let f=Pt.includes(l)?"lifecycle":"method",m=this.extractParams(c),y=c.async===true,g=m?`${l}(${m.join(", ")})`:l;i.symbols.push({name:l,category:f,framework:"vue2",startLine:p,endLine:u,signature:g,params:m,isAsync:y,jsdoc:d,camelWords:v(l)});let N=G(c,l);i.behaviors.push(...N);let b=Le(c,l);for(let E of b){if(E.args){let L=String(E.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");i.symbols[i.symbols.length-1].camelWords+=` ${v(L)} ${L}`;}i.relations.push(B({callerName:l,callerLine:p,calleeName:E.calleeName,callType:"this_method",line:o(E.line),args:E.args}));}let S=q(c,l,n,true);for(let E of S){if(E.args){let L=String(E.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");i.symbols[i.symbols.length-1].camelWords+=` ${v(L)} ${L}`;}i.relations.push(B({callerName:l,callerLine:p,calleeName:E.calleeName,callType:"direct_call",line:o(E.line),args:E.args}));}}else if(c.type==="ClassProperty"){let h=(c.decorators||[]).some(m=>m.expression?.callee?.name==="Prop"),f=this.getLiteralValue(c.value);i.symbols.push({name:l,category:h?"prop":"state",framework:"vue2",startLine:p,endLine:u,defaultValue:f,camelWords:v(l)});}}}};var Ut=createRequire(import.meta.url),gt=class{name="Vue3Parser";canParse(e,t){return e.endsWith(".vue")?this.looksLikeVue3File(t):false}parse(e,t){let n={framework:"vue3",filePath:e,symbols:[],relations:[],behaviors:[],errors:[]};try{let{parse:r}=Ut("@vue/compiler-sfc"),{descriptor:i}=r(t),o=t.split(`
435
+ `),a=!!i.scriptSetup,c=!!i.script;if(a){let l=i.scriptSetup,p=l.loc.start.line;this.parseSetupContent(l.content,p,o,n);}else if(c){let l=i.script,p=l.loc.start.line;this.parseScriptContent(l.content,p,o,n)||this.populateFromOptionsApiFallback(e,t,n);}if(i.template?.content){let l=i.template.loc.start.line,p=pt(i.template.content,l);if(p.length>0){let u=i.template.content.split(`
436
+ `).length;n.symbols.push({name:"<template>",category:"lifecycle",framework:"vue3",startLine:l,endLine:l+u-1,camelWords:"template"});for(let d of p)n.relations.push(B({callerName:"<template>",callerLine:l,calleeName:d.calleeName,callType:"template_event",line:d.line}));}}}catch(r){n.errors?.push(`Vue3 \u89E3\u6790\u5931\u8D25: ${String(r)}`);}return n}parseSetupContent(e,t,n,r){let i;try{i=Ut("@babel/parser").parse(e,{sourceType:"module",plugins:["typescript","jsx","decorators-legacy"],errorRecovery:!0});}catch(l){r.errors?.push(`AST \u89E3\u6790\u5931\u8D25: ${String(l)}`);return}let o=l=>l+t-1,a=e.split(`
437
+ `),c=i.program.body;r.fileDependencies=me(c,r.filePath);for(let l of c||[])this.processTopLevelStatement(l,o,n,a,r);}parseScriptContent(e,t,n,r){let i;try{i=Ut("@babel/parser").parse(e,{sourceType:"module",plugins:["typescript","jsx","decorators-legacy"],errorRecovery:!0});}catch(l){return r.errors?.push(`AST \u89E3\u6790\u5931\u8D25: ${String(l)}`),false}let o=l=>l+t-1,a=e.split(`
438
+ `);r.fileDependencies=me(i.program.body||[],r.filePath);let c=false;return z(i.program,l=>{if(l.type==="ExportDefaultDeclaration"&&l.declaration?.type==="ObjectExpression"){let p=l.declaration.properties?.find(u=>this.getPropKey(u)==="setup");if(p){c=true;let u=p.type==="ObjectMethod"?p:p.value;if(!u)return;let d=u.body;if(d?.type==="BlockStatement"){let h=d.body;for(let f of h||[])this.processTopLevelStatement(f,o,n,a,r);}}}}),c||z(i.program,l=>{if(!c&&l.type==="ObjectExpression"){let u=(l.properties||[]).find(d=>this.getPropKey(d)==="setup");if(u){c=true;let d=u.type==="ObjectMethod"?u:u.value;if(!d)return;let h=d.body;if(h?.type==="BlockStatement"){let f=h.body;for(let m of f||[])this.processTopLevelStatement(m,o,n,a,r);}}}}),c}processTopLevelStatement(e,t,n,r,i){let o=a=>{let c=a?.loc;return {start:c?.start?.line??1,end:c?.end?.line??1}};if(e.type==="VariableDeclaration")for(let a of e.declarations||[]){if(a.id?.type!=="Identifier"&&a.id?.type!=="ArrayPattern")continue;let c=a.init;if(c&&a.id.type==="Identifier"){let l=a.id.name;if(c.type==="ArrowFunctionExpression"||c.type==="FunctionExpression"){let{start:p,end:u}=o(e),d=V(n.join(`
439
+ `),t(p)),h=this.extractParams(c),f=i.symbols.length;if(i.symbols.push({name:l,category:"method",framework:"vue3",startLine:t(p),endLine:t(u),signature:`${l}(${(h||[]).join(", ")})`,params:h,isAsync:c.async===true,jsdoc:d,camelWords:v(l)}),c.body){let m=G(c.body,l);i.behaviors.push(...m);let y=q(c.body,l);for(let g of y){if(g.args){let N=String(g.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");i.symbols[f].camelWords+=` ${v(N)} ${N}`;}i.relations.push(B({callerName:l,callerLine:t(p),calleeName:g.calleeName,callType:"direct_call",line:t(g.line),args:g.args}));}}}else {let p=this.classifyVue3Declaration(l,c,t,o(e),n);p&&i.symbols.push(p);}}}if(e.type==="FunctionDeclaration"&&e.id?.type==="Identifier"){let a=e.id.name,{start:c,end:l}=o(e),p=V(n.join(`
440
+ `),t(c)),u=this.extractParams(e),d=Ft.includes(a);if(i.symbols.push({name:a,category:d?"lifecycle":xe(a)?"hook":"method",framework:"vue3",startLine:t(c),endLine:t(l),signature:`${a}(${(u||[]).join(", ")})`,params:u,isAsync:e.async===true,jsdoc:p,camelWords:v(a)}),e.body){let h=G(e.body,a);i.behaviors.push(...h);let f=q(e.body,a);for(let m of f){if(m.args){let y=String(m.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");i.symbols[i.symbols.length-1].camelWords+=` ${v(y)} ${y}`;}i.relations.push(B({callerName:a,callerLine:t(c),calleeName:m.calleeName,callType:"direct_call",line:t(m.line),args:m.args}));}}}if(e.type==="ExpressionStatement"&&e.expression?.type==="CallExpression"){let c=e.expression.callee;if(c?.type==="Identifier"){let l=c.name;if(["defineProps","defineEmits","defineExpose"].includes(l)){let{start:p,end:u}=o(e);i.symbols.push({name:l,category:l==="defineProps"?"prop":l==="defineEmits"?"emit":"export",framework:"vue3",startLine:t(p),endLine:t(u),camelWords:v(l)});}}}if(e.type==="ExpressionStatement"&&e.expression?.type==="CallExpression"){let a=e.expression,c=a.callee;if(c?.type==="Identifier"){let l=c.name;if(Ft.includes(l)){let{start:p,end:u}=o(e);i.symbols.push({name:l,category:"lifecycle",framework:"vue3",startLine:t(p),endLine:t(u),camelWords:v(l)});let d=a.arguments;if(d?.[0]){let h=G(d[0],l);i.behaviors.push(...h);let f=q(d[0],l);for(let m of f){if(m.args){let y=String(m.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");i.symbols[i.symbols.length-1].camelWords+=` ${v(y)} ${y}`;}i.relations.push(B({callerName:l,callerLine:t(p),calleeName:m.calleeName,callType:"direct_call",line:t(m.line),args:m.args}));}}}}}}classifyVue3Declaration(e,t,n,r,i){if(t.type!=="CallExpression")return null;let o=t.callee;if(o?.type!=="Identifier")return null;let a=o.name,c=n(r.start),l=n(r.end),p=V(i.join(`
441
+ `),c);if(fn.includes(a)){let u=t.arguments,d=u?.[0]?this.getLiteralValue(u[0]):void 0;return {name:e,category:"state",framework:"vue3",startLine:c,endLine:l,defaultValue:d,jsdoc:p,camelWords:v(e)}}return mn.includes(a)?{name:e,category:"computed",framework:"vue3",startLine:c,endLine:l,jsdoc:p,camelWords:v(e)}:gn.includes(a)?{name:e,category:"effect",framework:"vue3",startLine:c,endLine:l,camelWords:v(e)}:a==="provide"||a==="inject"?{name:e,category:"provide",framework:"vue3",startLine:c,endLine:l,camelWords:v(e)}:xe(a)?{name:e,category:"hook",framework:"vue3",startLine:c,endLine:l,jsdoc:p,camelWords:v(e)}:null}getPropKey(e){let t=e?.key;return t?t.type==="Identifier"?t.name:t.type==="Literal"?String(t.value):null:null}extractParams(e){let t=e.params;if(t)return t.map(n=>n.type==="Identifier"?n.name:n.type==="AssignmentPattern"?n.left?.name||"?":n.type==="RestElement"?`...${n.argument?.name||""}`:n.type==="ObjectPattern"?"{...}":n.type==="TSParameterProperty"&&n.parameter?.name||"?")}getLiteralValue(e){if(e){if(e.type==="Literal"||e.type==="StringLiteral"||e.type==="NumericLiteral"||e.type==="BooleanLiteral")return String(e.value);if(e.type==="NullLiteral")return "null";if(e.type==="ObjectExpression")return "{}";if(e.type==="ArrayExpression")return "[]"}}looksLikeVue3File(e){return e.includes("<script setup")?true:/\bdefine(?:Props|Emits|Expose|Slots|Model)\s*\(/.test(e)||/\bwithDefaults\s*\(/.test(e)||/\bdefineComponent\s*\(/.test(e)||/\bsetup\s*\(/.test(e)||/\b(?:ref|reactive|shallowRef|shallowReactive|readonly|computed|watch|watchEffect|watchPostEffect|watchSyncEffect|provide|inject|nextTick|onBeforeMount|onMounted|onBeforeUpdate|onUpdated|onBeforeUnmount|onUnmounted|onActivated|onDeactivated|onErrorCaptured|onRenderTracked|onRenderTriggered|onServerPrefetch)\s*\(/.test(e)}populateFromOptionsApiFallback(e,t,n){let r=new $e().parse(e,t);n.symbols=r.symbols.map(i=>({...i,framework:"vue3"})),n.relations=r.relations,n.behaviors=r.behaviors,n.errors=[...n.errors||[],...r.errors||[]];}};var qr=createRequire(import.meta.url),Yr=[...Ot,...Dt,...Mt,...hn],ze=class{name="ReactParser";canParse(e,t){let n=e.split(".").pop()?.toLowerCase();return ["jsx","tsx","js","ts"].includes(n||"")?n==="ts"?/from\s+['"]react['"]/.test(t)||/require\(\s*['"]react['"]\s*\)/.test(t)||/\bReact\./.test(t):t.includes("useState")||t.includes("useEffect")||t.includes("from 'react'")||t.includes('from "react"')||t.includes("React.")?true:n==="jsx"||n==="tsx"||n==="js"?t.includes("jsx")||t.includes("JSX")||this.containsLikelyJsx(t):false:false}containsLikelyJsx(e){return /(?:^|\breturn\b|[=(,:{?&|;>])[\s([]*<[A-Za-z][\w.:-]*(?:\s|\/?>)/m.test(e)||/<>|<\/>/.test(e)}parse(e,t){let n={framework:"react",filePath:e,symbols:[],relations:[],behaviors:[],errors:[]};try{let i=qr("@babel/parser").parse(t,{sourceType:"module",plugins:["jsx","typescript","decorators-legacy"],errorRecovery:!0}),o=t.split(`
442
+ `);this.extractFromAST(i.program?i.program:i,o,n);}catch(r){n.errors?.push(`React \u89E3\u6790\u5931\u8D25: ${String(r)}`);}return n}extractFromAST(e,t,n){let r=e.body;n.fileDependencies=me(r,n.filePath);for(let i of r||[]){if(i.type==="FunctionDeclaration"||i.type==="ExportDefaultDeclaration"&&i.declaration?.type==="FunctionDeclaration"||i.type==="ExportNamedDeclaration"&&i.declaration?.type==="FunctionDeclaration"){let o=i.type==="FunctionDeclaration"?i:i.declaration,a=i.type!=="FunctionDeclaration";o&&o.id?.type==="Identifier"&&this.processFunction(o,t,n,a);}if(i.type==="VariableDeclaration"||i.type==="ExportNamedDeclaration"&&i.declaration?.type==="VariableDeclaration"||i.type==="ExportDefaultDeclaration"&&i.declaration?.type==="VariableDeclaration"){let o=i.type==="VariableDeclaration"?i:i.declaration,a=i.type!=="VariableDeclaration";if(o)for(let c of o.declarations||[]){let l=c.init;if(l&&(l.type==="ArrowFunctionExpression"||l.type==="FunctionExpression")&&c.id?.type==="Identifier"){let p={...l,id:c.id,loc:{start:o.loc?.start??l.loc?.start,end:l.loc?.end}};this.processFunction(p,t,n,a);continue}this.processTopLevelVariableDeclaration(c,t,n,a);}}}n.exportSignatureEntries=mt(r,n.symbols);}processTopLevelVariableDeclaration(e,t,n,r){let i=e.id;if(!i||i.type!=="Identifier")return;let o=i.name;if(!o)return;let a=e.init,c=e.loc,l=c?.start?.line??1,p=c?.end?.line??1,u=this.buildSymbolKey(o,l,p);if(n.symbols.push({name:o,category:"constant",framework:"react",startLine:l,endLine:p,internalKey:u,isExported:r,defaultValue:this.getLiteralValue(a),jsdoc:V(t.join(`
443
+ `),l),camelWords:v(o)}),!a)return;let d=G(a,o,t,true);n.behaviors.push(...d);let h=q(a,o,t,true);for(let f of h){let m=n.symbols.findIndex(y=>y.name===o&&y.startLine===l);if(f.args&&m!==-1){let y=String(f.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");n.symbols[m].camelWords+=` ${v(y)} ${y}`;}n.relations.push(B({callerName:o,callerLine:l,callerKey:u,calleeName:f.calleeName,callType:"direct_call",line:f.line,args:f.args}));}}processFunction(e,t,n,r=false){let i=e.id?.name;if(!i)return;let o=e.loc,a=o?.start?.line??1,c=o?.end?.line??1,l=xe(i),p=!l&&/^[A-Z]/.test(i),u=V(t.join(`
444
+ `),a),d=this.extractParams(e),h=this.buildSymbolKey(i,a,c);n.symbols.push({name:i,category:l?"hook":p?"component":"function",framework:"react",startLine:a,endLine:c,internalKey:h,signature:`${i}(${(d||[]).join(", ")})`,params:d,isAsync:e.async===true,isExported:r,jsdoc:u,parentComponent:p?i:void 0,camelWords:v(i)});let f=e.body;if(f?.type!=="BlockStatement")return;let m=f.body;for(let b of m||[])this.processComponentStatement(b,i,t,n);let y=G(f,i,t,true);n.behaviors.push(...y);let g=q(f,i,t,true);for(let b of g){let S=n.symbols.findIndex(E=>E.name===i&&E.startLine===a);if(b.args&&S!==-1){let E=String(b.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");n.symbols[S].camelWords+=` ${v(E)} ${E}`;}n.relations.push(B({callerName:i,callerLine:a,callerKey:h,calleeName:b.calleeName,callType:"direct_call",line:b.line,args:b.args}));}let N=Tn(f);for(let b of N)n.relations.push(B({callerName:i,callerLine:a,callerKey:h,calleeName:b.calleeName,callType:"jsx_event",line:b.line}));}processComponentStatement(e,t,n,r){let i=o=>{let a=o?.loc;return {start:a?.start?.line??1,end:a?.end?.line??1}};if(e.type==="VariableDeclaration")for(let o of e.declarations||[]){let a=o.init;if(!a||a.type!=="CallExpression")continue;let c=a.callee;if(c?.type!=="Identifier")continue;let l=c.name,{start:p,end:u}=i(e),d=p,h=u;if(Ot.includes(l)&&l!=="useRef"){if(o.id?.type==="ArrayPattern"){let f=o.id.elements,m=f[0]?.name,y=f[1]?.name;if(m){let g=a.arguments;r.symbols.push({name:m,category:"state",framework:"react",startLine:d,endLine:h,internalKey:this.buildSymbolKey(m,d,h,t),stateSetterName:y,defaultValue:this.getLiteralValue(g?.[0]),parentComponent:t,camelWords:v(m)});}}else if(o.id?.type==="Identifier"){let f=o.id.name;r.symbols.push({name:f,category:"state",framework:"react",startLine:d,endLine:h,internalKey:this.buildSymbolKey(f,d,h,t),parentComponent:t,camelWords:v(f)});}}if(l==="useRef"&&o.id?.type==="Identifier"){let f=o.id.name,m=a.arguments;r.symbols.push({name:f,category:"state",framework:"react",startLine:d,endLine:h,internalKey:this.buildSymbolKey(f,d,h,t),defaultValue:this.getLiteralValue(m?.[0]),parentComponent:t,camelWords:v(f)});}if(Dt.includes(l)&&o.id?.type==="Identifier"){let f=o.id.name,y=a.arguments?.[1],g=this.extractDepsArray(y);r.symbols.push({name:f,category:"computed",framework:"react",startLine:d,endLine:h,internalKey:this.buildSymbolKey(f,d,h,t),hookDeps:g,parentComponent:t,camelWords:v(f)});}if(xe(l)&&!Yr.includes(l)){let f=o.id?.type==="Identifier"?o.id.name:o.id?.type==="ObjectPattern"?"{...}":"?";r.symbols.push({name:f,category:"hook",framework:"react",startLine:d,endLine:h,internalKey:this.buildSymbolKey(f,d,h,t),parentComponent:t,camelWords:v(f)});}}if(e.type==="ExpressionStatement"&&e.expression?.type==="CallExpression"){let o=e.expression,a=o.callee;if(a?.type==="Identifier"){let c=a.name;if(Mt.includes(c)){let{start:l,end:p}=i(e),u=o.arguments,d=u?.[1],h=this.extractDepsArray(d),f=this.buildSymbolKey(c,l,p,t),m=`${t}.${c}`;if(r.symbols.push({name:c,category:"effect",framework:"react",startLine:l,endLine:p,internalKey:f,hookDeps:h,parentComponent:t,camelWords:v(c)}),u?.[0]){let y=G(u[0],m,n,true).map(N=>({...N,symbolKey:f}));r.behaviors.push(...y);let g=q(u[0],m,n,true);for(let N of g){let b=r.symbols.findIndex(S=>S.name===c&&S.startLine===l);if(N.args&&b!==-1){let S=String(N.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");r.symbols[b].camelWords+=` ${v(S)} ${S}`;}r.relations.push(B({callerName:m,callerLine:l,callerKey:f,calleeName:N.calleeName,callType:"direct_call",line:N.line,args:N.args}));}}}}}if(e.type==="FunctionDeclaration"&&e.id?.type==="Identifier"){let o=e.id.name;if(!xe(o)){let{start:a,end:c}=i(e),l=V(n.join(`
445
+ `),a),p=this.extractParams(e);if(r.symbols.push({name:o,category:"method",framework:"react",startLine:a,endLine:c,internalKey:this.buildSymbolKey(o,a,c,t),signature:`${o}(${(p||[]).join(", ")})`,params:p,isAsync:e.async===true,jsdoc:l,parentComponent:t,camelWords:v(o)}),e.body){let u=G(e.body,o,n,true);r.behaviors.push(...u);let d=q(e.body,o,n,true);for(let h of d){let f=r.symbols.findIndex(m=>m.name===o&&m.startLine===a);if(h.args&&f!==-1){let m=String(h.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");r.symbols[f].camelWords+=` ${v(m)} ${m}`;}r.relations.push(B({callerName:o,callerLine:a,callerKey:this.buildSymbolKey(o,a,c,t),calleeName:h.calleeName,callType:"direct_call",line:h.line,args:h.args}));}}}}if(e.type==="VariableDeclaration")for(let o of e.declarations||[]){let a=o.init;if(!a)continue;let c=a.type==="ArrowFunctionExpression"||a.type==="FunctionExpression";if(!c||o.id?.type!=="Identifier")continue;let l=o.id.name,p=a.type==="CallExpression"?a.callee:null;if(p?.type==="Identifier"&&xe(p.name))continue;if(a.type==="CallExpression"&&a.callee?.name==="useCallback"){let g=a.arguments?.[1],N=this.extractDepsArray(g),{start:b,end:S}=i(e);r.symbols.push({name:l,category:"computed",framework:"react",startLine:b,endLine:S,internalKey:this.buildSymbolKey(l,b,S,t),hookDeps:N,parentComponent:t,camelWords:v(l)});continue}if(!c)continue;let{start:d,end:h}=i(e),f=V(n.join(`
446
+ `),d),m=this.extractParams(a);if(r.symbols.push({name:l,category:"method",framework:"react",startLine:d,endLine:h,internalKey:this.buildSymbolKey(l,d,h,t),signature:`${l}(${(m||[]).join(", ")})`,params:m,isAsync:a.async===true,jsdoc:f,parentComponent:t,camelWords:v(l)}),a.body){let y=G(a.body,l,n,true);r.behaviors.push(...y);let g=q(a.body,l,n,true);for(let N of g){let b=r.symbols.findIndex(S=>S.name===l&&S.startLine===d);if(N.args&&b!==-1){let S=String(N.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");r.symbols[b].camelWords+=` ${v(S)} ${S}`;}r.relations.push(B({callerName:l,callerLine:d,callerKey:this.buildSymbolKey(l,d,h,t),calleeName:N.calleeName,callType:"direct_call",line:N.line,args:N.args}));}}}}extractDepsArray(e){if(!(!e||e.type!=="ArrayExpression"))return (e.elements||[]).filter(t=>!!t&&t.type==="Identifier").map(t=>t.name)}extractParams(e){let t=e.params;if(t)return t.map(n=>n.type==="Identifier"?n.name:n.type==="ObjectPattern"?"{...}":n.type==="ArrayPattern"?"[...]":n.type==="AssignmentPattern"?n.left?.name||"?":n.type==="RestElement"?`...${n.argument?.name||""}`:n.type==="TSParameterProperty"&&n.parameter?.name||"?")}getLiteralValue(e){if(e){if(e.type==="Literal"||e.type==="StringLiteral"||e.type==="NumericLiteral"||e.type==="BooleanLiteral")return String(e.value);if(e.type==="NullLiteral")return "null";if(e.type==="ObjectExpression")return "{}";if(e.type==="ArrayExpression")return "[]";if(e.type==="Identifier"&&e.name==="null")return "null"}}buildSymbolKey(e,t,n,r){return `${r||"root"}:${e}:${t}:${n}`}};var Qr=createRequire(import.meta.url),ht=class{name="ToolingTsParser";canParse(e){let t=e.split(".").pop()?.toLowerCase();return ["js","jsx","ts","tsx"].includes(t||"")}parse(e,t){let n=e.endsWith(".ts")||e.endsWith(".tsx")?"ts":"js",r={framework:n,filePath:e,symbols:[],relations:[],behaviors:[],errors:[]};try{let o=Qr("@babel/parser").parse(t,{sourceType:"module",plugins:["jsx","typescript","decorators-legacy","classProperties"],errorRecovery:!0}),a=t.split(`
447
+ `),c=(o.program||o).body,l=new Set;r.fileDependencies=me(c||[],e);for(let p of c||[])this.processTopLevelStatement(p,a,n,r,l);if(l.size>0)for(let p of r.symbols)l.has(p.name)&&(p.isExported=!0);r.exportSignatureEntries=mt(c||[],r.symbols);}catch(i){r.errors?.push(`Tooling \u89E3\u6790\u5931\u8D25: ${String(i)}`);}return r}processTopLevelStatement(e,t,n,r,i){if(e.type==="FunctionDeclaration"){this.addTopLevelFunction(e,t,n,r,false);return}if(e.type==="ExportNamedDeclaration"||e.type==="ExportDefaultDeclaration"){let o=e.declaration;if(!o){this.collectDeferredExportNames(e,i);return}if(o.type==="FunctionDeclaration"){this.addTopLevelFunction(o,t,n,r,true);return}if(o.type==="ClassDeclaration"){this.addClass(o,t,n,r,true);return}if(o.type==="VariableDeclaration"){this.processVariableDeclaration(o,t,n,r,true);return}this.collectDeferredExportNames(e,i);return}if(e.type==="ClassDeclaration"){this.addClass(e,t,n,r,false);return}e.type==="VariableDeclaration"&&this.processVariableDeclaration(e,t,n,r,false);}collectDeferredExportNames(e,t){if(e.type==="ExportNamedDeclaration"){if(e.source?.type==="StringLiteral")return;for(let r of e.specifiers||[]){let i=r.local;i?.type==="Identifier"&&t.add(String(i.name||""));}return}if(e.type==="ExportDefaultDeclaration"){let n=e.declaration;n?.type==="Identifier"&&t.add(String(n.name||""));}}processVariableDeclaration(e,t,n,r,i){for(let o of e.declarations||[]){let a=o.id;if(!a||a.type!=="Identifier")continue;let c=String(a.name||"");if(!c)continue;let l=o.init,{start:p,end:u}=this.getLineRange(o),d=this.buildSymbolKey(c,p,u);if(l&&(l.type==="ArrowFunctionExpression"||l.type==="FunctionExpression")){this.addFunctionSymbol(c,l,t,n,r,{startLine:p,endLine:u,isExported:i});continue}if(r.symbols.push({name:c,category:"constant",framework:n,startLine:p,endLine:u,internalKey:d,isExported:i,defaultValue:this.getLiteralValue(l),jsdoc:V(t.join(`
448
+ `),p),camelWords:v(c)}),!l)continue;let h=G(l,c,t,true);r.behaviors.push(...h);let f=q(l,c,t,true);for(let g of f)r.relations.push(B({callerName:c,callerLine:p,callerKey:d,calleeName:g.calleeName,callType:"direct_call",line:g.line,args:g.args}));let m=ot(l,c,t,true);for(let g of m)r.relations.push(B({callerName:c,callerLine:p,callerKey:d,calleeName:g.calleeName,callType:"direct_call",line:g.line,args:g.args,receiverToken:g.receiverToken}));let y=at(l,c,t,true);for(let g of y)r.relations.push(B({callerName:c,callerLine:p,callerKey:d,calleeName:g.calleeName,callType:"new_call",line:g.line,args:g.args}));}}addTopLevelFunction(e,t,n,r,i){let o=e.id?.name;if(!o)return;let{start:a,end:c}=this.getLineRange(e);this.addFunctionSymbol(o,e,t,n,r,{startLine:a,endLine:c,isExported:i});}addFunctionSymbol(e,t,n,r,i,o){let a=this.buildSymbolKey(e,o.startLine,o.endLine,o.ownerClass),c=this.extractParams(t);i.symbols.push({name:e,category:o.ownerClass?"method":"function",framework:r,startLine:o.startLine,endLine:o.endLine,internalKey:a,signature:`${e}(${(c||[]).join(", ")})`,params:c,isAsync:t.async===true,isExported:o.isExported,jsdoc:V(n.join(`
449
+ `),o.startLine),parentComponent:o.ownerClass,camelWords:v(e)});let l=t.body;if(!l)return;let p=G(l,e,n,true);i.behaviors.push(...p);let u=q(l,e,n,true);for(let y of u)i.relations.push(B({callerName:e,callerLine:o.startLine,callerKey:a,calleeName:y.calleeName,callType:"direct_call",line:y.line,args:y.args}));let d=Sn(l,e,n);for(let y of d)i.relations.push(B({callerName:e,callerLine:o.startLine,callerKey:a,calleeName:y.calleeName,callType:"direct_call",line:y.line,args:y.args}));let h=ot(l,e,n,true);for(let y of h)i.relations.push(B({callerName:e,callerLine:o.startLine,callerKey:a,calleeName:y.calleeName,callType:"direct_call",line:y.line,args:y.args,receiverToken:y.receiverToken}));let f=at(l,e,n,true);for(let y of f)i.relations.push(B({callerName:e,callerLine:o.startLine,callerKey:a,calleeName:y.calleeName,callType:"new_call",line:y.line,args:y.args}));let m=Le(l,e);for(let y of m)i.relations.push(B({callerName:e,callerLine:o.startLine,callerKey:a,calleeName:y.calleeName,callType:"this_method",line:y.line,args:y.args}));}addClass(e,t,n,r,i){let o=e.id?.name;if(!o)return;let{start:a,end:c}=this.getLineRange(e);r.symbols.push({name:o,category:"class",framework:n,startLine:a,endLine:c,isExported:i,jsdoc:V(t.join(`
450
+ `),a),camelWords:v(o)});let l=e.body?.body;for(let p of l||[]){let u=p.key,d=u?.type==="Identifier"?String(u.name||""):"";if(!d||d==="constructor")continue;if(p.type==="ClassMethod"||p.type==="ClassPrivateMethod"){this.addFunctionSymbol(d,p,t,n,r,{startLine:this.getLineRange(p).start,endLine:this.getLineRange(p).end,isExported:false,ownerClass:o});continue}let h=p.value;h&&(h.type==="ArrowFunctionExpression"||h.type==="FunctionExpression")&&(p.type==="ClassProperty"||p.type==="PropertyDefinition")&&this.addFunctionSymbol(d,h,t,n,r,{startLine:this.getLineRange(p).start,endLine:this.getLineRange(p).end,isExported:false,ownerClass:o});}}extractParams(e){let t=e.params;return t?.length?t.map(n=>{if(n.type==="Identifier")return String(n.name||"");if(n.type==="AssignmentPattern"){let r=n.left;return r?.type==="Identifier"?String(r.name||""):"param"}return "param"}):[]}getLiteralValue(e){if(e){if(e.type==="StringLiteral"||e.type==="NumericLiteral"||e.type==="BooleanLiteral")return String(e.value);if(e.type==="NullLiteral")return "null";if(e.type==="ObjectExpression")return "{...}";if(e.type==="ArrayExpression")return "[...]"}}buildSymbolKey(e,t,n,r){return `${r||"root"}:${e}:${t}:${n}`}getLineRange(e){let t=e.loc;return {start:t?.start?.line??1,end:t?.end?.line??1}}};var Zr=new Set(["FunctionDeclaration","ArrowFunctionExpression","FunctionExpression","ObjectMethod","ClassMethod","ClassProperty"]);function wn(s,e){return !!e?.skipNestedFunctions&&Zr.has(String(s.type||""))}function ge(s,e,t){if(!(!s||typeof s!="object")){e(s);for(let n of Object.keys(s)){if(n==="type"||n==="loc"||n==="start"||n==="end")continue;let r=s[n];if(Array.isArray(r)){for(let i of r){if(!i||typeof i!="object"||!i.type)continue;let o=i;wn(o,t)||ge(o,e,t);}continue}if(r&&typeof r=="object"&&r.type){let i=r;if(wn(i,t))continue;ge(i,e,t);}}}}function vn(s,e,t=true,n){let r=[],i=[],o=(a,c=120)=>es(a,n,c);return ge(s,a=>{if(a.type==="VariableDeclarator"){let c=a.id;if(!c)return;let l=bt(c),p=o(a);for(let u of l)r.push({symbolName:u,kind:"declaration",line:Te(a),text:p,sourceLayer:re(p,Te(a))});}if(a.type==="AssignmentExpression"){let c=a.left;if(!c)return;let l=o(a),p=Te(a);if(c.type==="Identifier"&&r.push({symbolName:c.name,kind:"assignment",line:p,text:l,sourceLayer:re(l,p)}),c.type==="MemberExpression"&&c.object?.type==="ThisExpression"){let d=K(c);if(d){r.push({symbolName:d,kind:"assignment",line:p,text:l,sourceLayer:re(l,p)});return}}if(c.type==="MemberExpression"){let u=te(c);if(u&&yt(u)){let d=K(c);i.push({objectName:u,propertyName:d||void 0,line:p,text:l,kind:c.computed?"bracket":"dot",sourceLayer:re(l,p)});}}}if(a.type==="UpdateExpression"){let c=a.argument;if(!c)return;let l=o(a),p=Te(a);if(c.type==="Identifier"&&r.push({symbolName:c.name,kind:"update",line:p,text:l,sourceLayer:re(l,p)}),c.type==="MemberExpression"&&c.object?.type==="ThisExpression"){let d=K(c);if(d){r.push({symbolName:d,kind:"update",line:p,text:l,sourceLayer:re(l,p)});return}}if(c.type==="MemberExpression"){let u=te(c);if(u&&yt(u)){let d=K(c);i.push({objectName:u,propertyName:d||void 0,line:p,text:l,kind:c.computed?"bracket":"dot",sourceLayer:re(l,p)});}}}if(a.type==="UnaryExpression"&&a.operator==="delete"){let c=a.argument;if(c?.type==="MemberExpression"){let l=te(c);if(l&&yt(l)){let p=K(c);i.push({objectName:l,propertyName:p||void 0,line:Te(a),text:o(a),kind:"delete",sourceLayer:re(o(a),Te(a))});}}}if(a.type==="CallExpression"||a.type==="OptionalCallExpression"){let c=a.callee;if(!c||c.type!=="MemberExpression"&&c.type!=="OptionalMemberExpression")return;let l=K(c);if(!l||!/^(push|pop|shift|unshift|splice|sort|reverse|copyWithin|fill)$/.test(l))return;let p=te(c);if(!p||!yt(p))return;i.push({objectName:p,propertyName:l,line:Te(a),text:o(a),kind:"array_mutation",sourceLayer:re(o(a),Te(a))});}},{skipNestedFunctions:t}),{assignments:r,propertyWrites:i}}function bt(s){return s.type==="Identifier"?[s.name]:s.type==="ObjectPattern"?(s.properties||[]).flatMap(t=>{let n=t.type==="ObjectProperty"||t.type==="Property"?t.value:t;return n?bt(n):[]}):s.type==="ArrayPattern"?(s.elements||[]).flatMap(t=>t?bt(t):[]):s.type==="AssignmentPattern"?bt(s.left):[]}function yt(s){return !(/^[A-Z][A-Z]/.test(s)||/^(document|window|console|localStorage|sessionStorage|navigator|process|global|globalThis)$/.test(s))}function Te(s){return s.loc?.start?.line??1}function es(s,e,t=120){if(e){let r=s.loc;if(r?.start?.line&&r?.end?.line){let i=r.start.line-1,o=Math.min(r.end.line-1,i+5);return e.slice(i,o+1).map(c=>c.trim()).filter(c=>c).join(" ").slice(0,t)}}let n=s.loc;return n?.start?.line?`L${n.start.line}`:String(s.type||"?")}var ns=createRequire(import.meta.url);function Ht(s,e){let t={files:new Map,resolutionCache:new Map,localShadowCache:new Map};for(let{path:n,content:r}of s){let i=Ln(n,r);t.files.set(n,i);let o=new Map;for(let a of i.imports)a.localName&&o.set(a.localName,`${a.resolvedFile}::${a.originalName}`);t.resolutionCache.set(n,o),t.localShadowCache.set(n,rs(r));}return t}function Xt(s,e,t,n){if(t.files.size===0)return s;let r=t.resolutionCache.get(e);if(!r||r.size===0)return s;let i=t.localShadowCache.get(e);return t.files.get(e)?s.map(c=>{let l=r.get(c.calleeName);return !l||c.callerKey&&i?.get(c.callerKey)?.has(c.calleeName)||n.has(c.calleeName)?c:{...c,edgeKind:"precise",importSource:c.importSource||l}}):s}function rs(s){let e=new Map;try{let n=ns("@babel/parser").parse(s,{sourceType:"module",plugins:["jsx","typescript","decorators-legacy","classProperties"],errorRecovery:!0}),r=(n.program||n).body;if(!r?.length)return e;for(let i of r)Cn(i,e);}catch{return e}return e}function Cn(s,e){if(s.type==="FunctionDeclaration"){let t=we(s.id);if(!t)return;Pe(t,s,e),ss(as(s),t,e);return}if(s.type==="VariableDeclaration"){In(s,void 0,e);return}if(s.type==="ClassDeclaration"){is(s,e);return}if(s.type==="ExportNamedDeclaration"||s.type==="ExportDefaultDeclaration"){let t=s.declaration;if(!t)return;Cn(t,e);}}function ss(s,e,t){for(let n of s){if(n.type==="FunctionDeclaration"){let r=we(n.id);if(!r)continue;Pe(r,n,t,e);continue}if(n.type==="VariableDeclaration"){In(n,e,t);continue}if(n.type==="ExpressionStatement"){let r=n.expression;if(r?.type!=="CallExpression")continue;let i=r.callee,o=i?.type==="Identifier"?String(i.name||""):"";if(!/^use[A-Z]/.test(o))continue;let a=r.arguments?.[0];if(!a||a.type!=="ArrowFunctionExpression"&&a.type!=="FunctionExpression")continue;Pe(o,a,t,e,n);}}}function In(s,e,t){for(let n of s.declarations||[]){let r=we(n.id),i=n.init;!r||!i||i.type!=="ArrowFunctionExpression"&&i.type!=="FunctionExpression"||Pe(r,i,t,e,n);}}function is(s,e){let t=we(s.id);if(!t)return;let n=s.body?.body||[];for(let r of n){let i=we(r.key);if(!i||i==="constructor")continue;if(r.type==="ClassMethod"||r.type==="ClassPrivateMethod"){Pe(i,r,e,t);continue}let o=r.value;o&&(o.type==="ArrowFunctionExpression"||o.type==="FunctionExpression")&&(r.type==="ClassProperty"||r.type==="PropertyDefinition")&&Pe(i,o,e,t,r);}}function Pe(s,e,t,n,r){let i=cs(r||e),o=ls(s,i.start,i.end,n),a=os(e);t.set(o,a);}function os(s){let e=new Set;for(let n of s.params||[])for(let r of Re(n))e.add(r);let t=s.body;return t&&Wt(t,n=>{if(n.type==="VariableDeclarator"){for(let r of Re(n.id))e.add(r);return}if(n.type==="FunctionDeclaration"){let r=we(n.id);return r&&e.add(r),false}if(n.type==="ClassDeclaration"){let r=we(n.id);return r&&e.add(r),false}}),e}function Wt(s,e){if(!(!s||typeof s!="object")&&e(s)!==false)for(let t of Object.keys(s)){if(t==="type"||t==="loc"||t==="start"||t==="end")continue;let n=s[t];if(Array.isArray(n)){for(let r of n){if(!r||typeof r!="object"||!r.type)continue;let i=r;kn(i)||Wt(i,e);}continue}if(n&&typeof n=="object"&&n.type){let r=n;if(kn(r))continue;Wt(r,e);}}}function kn(s){return ["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression","ClassMethod","ClassPrivateMethod","ObjectMethod"].includes(String(s.type||""))}function Re(s){return s?s.type==="Identifier"?[String(s.name||"")]:s.type==="AssignmentPattern"?Re(s.left):s.type==="RestElement"?Re(s.argument):s.type==="ArrayPattern"?(s.elements||[]).flatMap(e=>Re(e)):s.type==="ObjectPattern"?(s.properties||[]).flatMap(e=>{if(e.type==="RestElement")return Re(e.argument);let t=e.value||e.argument;return Re(t)}):[]:[]}function we(s){if(s&&s.type==="Identifier")return String(s.name||"")}function as(s){let e=s.body;return !e||e.type!=="BlockStatement"?[]:e.body||[]}function cs(s){let e=s.loc;return {start:e?.start?.line??1,end:e?.end?.line??1}}function ls(s,e,t,n){return n?`${n}:${s}:${e}:${t}`:`root:${s}:${e}:${t}`}var $n=createRequire(import.meta.url);function Pn(s,e){let t=s.errors||[];t.includes(e)||(s.errors=[...t,e]);}var Kt=class extends ze{name="JsTsFallbackParser";canParse(e){let t=e.split(".").pop()?.toLowerCase();return ["js","ts","jsx","tsx"].includes(t||"")}parse(e,t){let n=super.parse(e,t);return n.framework=e.endsWith(".ts")||e.endsWith(".tsx")?"ts":"js",n}},ds=[new gt,new $e,new ze,new ht,new Kt];function Ve(s,e){for(let t of ds)if(t.canParse(s,e)){let n=t.parse(s,e);return fs(n),us(n,e),n}return {framework:"js",filePath:s,symbols:[],relations:[],behaviors:[],errors:[`\u6CA1\u6709\u627E\u5230\u9002\u5408\u7684\u89E3\u6790\u5668: ${s}`]}}function us(s,e){if(s.symbols.length!==0)try{let t=e,n=s.filePath.endsWith(".vue"),r=0;if(n)try{let{parse:d}=$n("@vue/compiler-sfc"),{descriptor:h}=d(e);if(h.scriptSetup?.content)t=h.scriptSetup.content,r=h.scriptSetup.loc.start.line-1;else if(h.script?.content)t=h.script.content,r=h.script.loc.start.line-1;else return}catch(d){Pn(s,`\u751F\u547D\u5468\u671F\u63D0\u53D6\u8DF3\u8FC7: Vue SFC \u89E3\u6790\u5931\u8D25 - ${String(d)}`);return}let a=$n("@babel/parser").parse(t,{sourceType:"module",plugins:["jsx","typescript","decorators-legacy"],errorRecovery:!0}).program.body;if(!a?.length)return;let c=t.split(`
451
+ `),{assignments:l,propertyWrites:p}=vn({type:"Program",body:a},s.filePath,!1,c);if(r>0){for(let d of l)d.line+=r;for(let d of p)d.line+=r;}let u=new Set(s.symbols.map(d=>d.name));s.assignments=l.filter(d=>u.has(d.symbolName)),s.propertyWrites=p.filter(d=>u.has(d.objectName));}catch(t){Pn(s,`\u751F\u547D\u5468\u671F\u63D0\u53D6\u8DF3\u8FC7: AST \u89E3\u6790\u5931\u8D25 - ${String(t)}`);}}function fs(s){if(!s.relations.length||!s.behaviors.length)return;let e=new Set(["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","setup","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onActivated","onDeactivated","onErrorCaptured","componentDidMount","componentDidUpdate","componentWillUnmount","componentDidCatch","getDerivedStateFromProps","getSnapshotBeforeUpdate","render","init","initialize"]),t=new Set(s.behaviors.filter(r=>r.category==="network").map(r=>r.symbolName));if(t.size===0)return;let n=new Set(s.behaviors.map(r=>`${r.symbolName}:${r.category}:${r.apiName}:${r.operation}:${r.line}`));for(let r of s.relations){if(!t.has(r.calleeName)||t.has(r.callerName)||e.has(r.callerName))continue;let i={symbolName:r.callerName,symbolKey:r.callerKey,category:"network",apiName:"wrapped_network",operation:r.calleeName,detail:r.args,line:r.line},o=`${i.symbolName}:${i.category}:${i.apiName}:${i.operation}:${i.line}`;n.has(o)||(n.add(o),s.behaviors.push(i));}}function Ge(s,e){let t=ms(e),n=s.exportSignatureEntries?.length?[...s.exportSignatureEntries]:(()=>{let a=[];for(let c of s.symbols)if(c.isExported){let l=c.signature||"";a.push(`${c.name}:${l}`);}return a.sort(),a})(),r=n.length>0?Fn(n.join(`
452
+ `)):"",i=[];if(s.fileDependencies&&s.fileDependencies.length>0)for(let a of s.fileDependencies)(a.dependencyKind==="import"||a.dependencyKind==="re_export")&&i.push(a.toFile);i.sort();let o=i.length>0?Fn(i.join(`
453
+ `)):"";return {contentHash:t,exportSignatureHash:r,importSignatureHash:o}}function zt(s,e){if(!s)return "full_changed";if(s.contentHash===e.contentHash)return "unchanged";let t=s.exportSignatureHash!==e.exportSignatureHash,n=s.importSignatureHash!==e.importSignatureHash;return t&&n?"full_changed":t?"export_changed":n?"import_changed":"body_only"}function Vt(s,e,t,n=200){if(e==="unchanged")return {files:[],truncated:false};if(e==="body_only")return {files:[s],truncated:false};if(e==="import_changed")return {files:[s],truncated:false};let r=new Set([s]),i=[s];for(;i.length>0;){let o=i.shift(),a=t.get(o)||[];for(let c of a)if(!r.has(c)){if(r.add(c),r.size>=n)return {files:Array.from(r),truncated:true};i.push(c);}}return {files:Array.from(r),truncated:false}}function ms(s){return createHash("sha256").update(s,"utf-8").digest("hex").slice(0,16)}function Fn(s){return createHash("sha256").update(s,"utf-8").digest("hex").slice(0,12)}var gs={maxFiles:20,maxTimeMs:1500},Et=class{pending=[];options;constructor(e){this.options={...gs,...e};}configure(e){this.options={...this.options,...e};}enqueue(e,t){let n=this.pending.find(r=>r.relPath===e);if(n){let r={high:3,normal:2,low:1};r[t]>r[n.priority]&&(n.priority=t);return}this.pending.push({relPath:e,priority:t,addedAt:Date.now()});}dequeueBatch(){if(this.pending.length===0)return {tasks:[],exceededBudget:false,remainingPending:0};let e={high:0,normal:1,low:2};this.pending.sort((i,o)=>{let a=e[i.priority],c=e[o.priority];return a!==c?a-c:i.addedAt-o.addedAt});let t=[],n=this.pending.length>this.options.maxFiles;for(let i=0;i<Math.min(this.options.maxFiles,this.pending.length);i++)t.push(this.pending[i]);let r=new Set(t.map(i=>i.relPath));return this.pending=this.pending.filter(i=>!r.has(i.relPath)),{tasks:t,exceededBudget:n,remainingPending:this.pending.length}}requeue(e){if(e.length===0)return;let t=new Set(this.pending.map(r=>r.relPath)),n=e.filter(r=>!t.has(r.relPath));this.pending=[...n,...this.pending];}clear(){this.pending=[];}get pendingCount(){return this.pending.length}get budget(){return this.options}summary(){return this.pending.map(e=>({relPath:e.relPath,priority:e.priority}))}};var _t=class{projectRoot;db;scheduler;constructor(e,t){this.projectRoot=e,this.db=t,this.scheduler=new Et;}getScheduler(){return this.scheduler}enhancePreciseRelations(e){try{let t=e.filter(({absPath:r})=>/\.(ts|tsx|js|jsx)$/i.test(r)).map(({absPath:r,content:i})=>({path:r,content:i})),n=Ht(t,"precise");if(n.files.size===0)return;for(let r of e){if(r.result.relations.length===0)continue;let i=new Set(r.result.symbols.map(o=>o.name));r.result.relations=Xt(r.result.relations,r.result.filePath,n,i);}}catch(t){let n=`precise enhancement \u5931\u8D25\uFF0C\u5DF2\u56DE\u9000\u5230\u672C\u5730 relations: ${String(t)}`;process.stderr.write(`[Frontend-Code-Skimmer] ${n}
454
+ `);for(let r of e){let i=r.result.errors||[];i.includes(n)||(r.result.errors=[...i,n]);}}}enqueuePrecise(e,t){this.scheduler.enqueue(e,t),this.db.enqueuePrecisePending(e,t);}hydratePendingPreciseQueue(){for(let e of this.db.listPrecisePending())this.scheduler.enqueue(e.relPath,e.priority);}enqueueAffectedPrecise(e,t){if(t==="unchanged")return;let n=this.db.getReverseDependencyMap(),{files:r,truncated:i}=Vt(e,t,n);i&&process.stderr.write(`[Frontend-Code-Skimmer] \u26A0\uFE0F ${e} \u7684 precise \u5F85\u8865\u7B97\u6269\u6563\u5DF2\u8FBE\u4E0A\u9650\uFF08200\uFF09\uFF0C\u90E8\u5206\u4E0B\u6E38\u6587\u4EF6\u5C06\u8DF3\u8FC7\u672C\u8F6E
455
+ `);let o=t==="export_changed"||t==="full_changed"?"high":t==="import_changed"?"normal":"low";for(let a of r)this.enqueuePrecise(a,o);}async indexProject(e){let t=Date.now(),n=e?.include||[...$t],r=e?.exclude||[...It],i=e?.force||false,o=Date.now(),a=await hs(n,{cwd:this.projectRoot,ignore:r,absolute:true,onlyFiles:true}),c=Date.now()-o,l={totalFiles:a.length,indexedFiles:0,skippedFiles:0,totalSymbols:0,durationMs:0,phaseTimings:{discoverFilesMs:c,readFilesMs:0,parseMs:0,saveToDbMs:0,totalMs:0},errors:[]};i&&(this.scheduler.clear(),this.db.clearProjectIndex());let p=0,u=0,d=0;if((e?.precisionMode||"heuristic")==="precise"){let f=[];for(let m=0;m<a.length;m++){let y=a[m],g=ue(y,this.projectRoot);e?.onProgress?.(m+1,a.length,g);try{let N=ne__default.statSync(y).mtimeMs,b=Date.now(),S=ne__default.readFileSync(y,"utf-8"),E=Date.now()-b,L=Date.now(),_=Ve(y,S),x=Date.now()-L;p+=E,u+=x,f.push({absPath:y,relPath:g,result:_,parseMs:x,readMs:E,content:S,mtime:N});}catch(N){this.db.recordIndexFailure(g,String(N)),l.errors.push({file:g,error:String(N)});}}this.enhancePreciseRelations(f);for(let m of f){let y=Date.now();try{let g=We(m.content),N=tt(m.content),b=Buffer.byteLength(m.content,"utf-8"),S=Ge(m.result,m.content);this.db.saveParseResult(m.result,m.absPath,m.relPath,g,b,N,m.mtime,S.exportSignatureHash,S.importSignatureHash),this.db.deletePrecisePending(m.relPath),l.indexedFiles++,l.totalSymbols+=m.result.symbols.length,m.result.errors?.length&&l.errors.push(...m.result.errors.map(E=>({file:m.relPath,error:E}))),d+=Date.now()-y;}catch(g){this.db.recordIndexFailure(m.relPath,String(g)),l.errors.push({file:m.relPath,error:String(g)});}}this.scheduler.clear();}else for(let f=0;f<a.length;f++){let m=a[f],y=ue(m,this.projectRoot);e?.onProgress?.(f+1,a.length,y);try{let g=await this.indexFile(m,y,i);g.skipped?l.skippedFiles++:(l.indexedFiles++,l.totalSymbols+=g.symbolCount,p+=g.readMs||0,u+=g.parseMs||0,d+=g.saveMs||0,g.errors?.length&&l.errors.push(...g.errors.map(N=>({file:y,error:N}))));}catch(g){this.db.recordIndexFailure(y,String(g)),l.errors.push({file:y,error:String(g)});}}return l.phaseTimings.readFilesMs=p,l.phaseTimings.parseMs=u,l.phaseTimings.saveToDbMs=d,l.phaseTimings.totalMs=Date.now()-t,l.durationMs=l.phaseTimings.totalMs,l}async selectivePrecise(e){let t=Date.now(),n=e?.maxFiles??20,r=e?.maxTimeMs??1500;this.hydratePendingPreciseQueue(),this.scheduler.configure({maxFiles:n,maxTimeMs:r});let i=this.db.getAllFilePaths(),o=this.db.getReverseDependencyMap(),a=new Set;for(let y of i){let g=this.fileAbsPath(y);if(!ne__default.existsSync(g))continue;let N=this.db.getFileSignatures(y);if(!N){this.scheduler.enqueue(y,"low");continue}let b;try{b=ne__default.statSync(g);let $=this.db.getFileHashAndMtime(y);if($&&$.mtime===b.mtimeMs&&$.contentHash)continue}catch{continue}let S=ne__default.readFileSync(g,"utf-8"),E=We(S);if(N.contentHash===E){this.db.updateFileMtime(y,b.mtimeMs);continue}let L=Ve(g,S),_=Ge(L,S),x=zt(N,_);if(x==="unchanged")continue;let{files:A,truncated:w}=Vt(y,x,o);w&&process.stderr.write(`[Frontend-Code-Skimmer] \u26A0\uFE0F ${y} \u7684\u53CD\u5411\u4F9D\u8D56\u6269\u6563\u5DF2\u8FBE\u4E0A\u9650\uFF08200\uFF09\uFF0C\u90E8\u5206\u4E0B\u6E38\u6587\u4EF6\u5C06\u8DF3\u8FC7\u672C\u6B21 precise \u91CD\u7B97
456
+ `);for(let $ of A)a.add($);let P=x==="export_changed"||x==="full_changed"?"high":x==="import_changed"?"normal":"low";for(let $ of A)this.scheduler.enqueue($,P);}let{tasks:c,exceededBudget:l,remainingPending:p}=this.scheduler.dequeueBatch(),u=[],d=[],h=0;for(let y=0;y<c.length;y++){let N=c[y].relPath;if(a.add(N),Date.now()-t>=r){d.push(...c.slice(y));break}let b=this.fileAbsPath(N);if(!ne__default.existsSync(b)){this.removeFile(N),this.db.deletePrecisePending(N);continue}try{let S=ne__default.readFileSync(b,"utf-8"),E=Ve(b,S),L=We(S),_=tt(S),x=Buffer.byteLength(S,"utf-8");u.push({absPath:b,relPath:N,result:E,content:S,hash:L,lineCount:_,fileSize:x,mtime:ne__default.statSync(b).mtimeMs});}catch(S){this.db.recordIndexFailure(N,String(S)),process.stderr.write(`[Frontend-Code-Skimmer] Selective precise \u5931\u8D25: ${N} - ${String(S)}
457
+ `);}}d.length>0&&this.scheduler.requeue(d),this.enhancePreciseRelations(u);for(let y of u)try{let g=Ge(y.result,y.content);this.db.saveParseResult(y.result,y.absPath,y.relPath,y.hash,y.fileSize,y.lineCount,y.mtime,g.exportSignatureHash,g.importSignatureHash),this.db.deletePrecisePending(y.relPath),h++;}catch(g){this.db.recordIndexFailure(y.relPath,String(g)),process.stderr.write(`[Frontend-Code-Skimmer] Selective precise \u843D\u5E93\u5931\u8D25: ${y.relPath} - ${String(g)}
458
+ `);}let f=Date.now()-t,m=p+d.length;return process.stderr.write(`[Frontend-Code-Skimmer] Selective precise: ${h}/${a.size} affected, ${f}ms, pending: ${m}${l||d.length>0?" (budget limited)":""}
459
+ `),{reindexedFiles:h,affectedFiles:Array.from(a),skippedByBudget:m}}async indexFile(e,t,n=false){let r=0,i=0,o=null;if(!n){try{let L=ne__default.statSync(e);r=L.mtimeMs,i=L.size;}catch{}if(o=this.db.getFileMeta(t),o&&o.mtime>0&&o.mtime===r&&!(o.fileSize>0&&o.fileSize!==i))return {skipped:true,symbolCount:0,readMs:0,parseMs:0,saveMs:0}}let a=n?null:this.db.getFileSignatures(t),c=!n&&(this.db.hasPreciseRelations()||this.db.getPrecisePendingCount()>0),l=Date.now(),p=ne__default.readFileSync(e,"utf-8"),u=Date.now()-l,d=We(p);if(!n&&o&&o.hash===d)return r>0&&o.mtime!==r&&this.db.updateFileMtime(t,r),{skipped:true,symbolCount:0,readMs:u,parseMs:0,saveMs:0};let h=tt(p),f=Buffer.byteLength(p,"utf-8"),m=Date.now(),y=Ve(e,p),g=Date.now()-m,N=Ge(y,p),b=zt(a,N),S=Date.now();this.db.clearIndexFailures(t),this.db.saveParseResult(y,e,t,d,f,h,r,N.exportSignatureHash,N.importSignatureHash),c&&this.enqueueAffectedPrecise(t,b);let E=Date.now()-S;return {skipped:false,symbolCount:y.symbols.length,readMs:u,parseMs:g,saveMs:E,errors:y.errors,changeType:b}}removeFile(e){this.db.deleteFile(e);}fileAbsPath(e){return Y__default.join(this.projectRoot,e)}async startWatcher(){let{default:e}=await import('chokidar'),t=e.watch([...$t].map(r=>Y__default.posix.join(this.projectRoot,r)),{cwd:this.projectRoot,ignored:[...It],persistent:true,ignoreInitial:true,awaitWriteFinish:{stabilityThreshold:En}}),n=async r=>{let i=ue(r,this.projectRoot);try{await this.indexFile(r,i),process.stderr.write(`[Frontend-Code-Skimmer] \u5DF2\u66F4\u65B0\u7D22\u5F15: ${i}
460
+ `);}catch(o){process.stderr.write(`[Frontend-Code-Skimmer] \u66F4\u65B0\u5931\u8D25: ${i} - ${String(o)}
461
+ `);}};return t.on("add",n).on("change",n).on("unlink",r=>{let i=ue(r,this.projectRoot);this.removeFile(i),process.stderr.write(`[Frontend-Code-Skimmer] \u5DF2\u5220\u9664\u7D22\u5F15: ${i}
462
+ `);}),()=>t.close()}};var Es=8,_s=30,Ns=14,Ss=360*60*1e3,Nt=class{dbCache=new Map;accessTimes=new Map;indexerCache=new Map;dbPaths=new Map;watcherCleanups=new Map;lastProject=null;globalCacheDir;defaultProject;maxOpenProjects;maxIdleMs;dbTtlMs;lastDiskCleanupAt=0;constructor(){this.globalCacheDir=Y__default.join(ys.homedir(),".frontend-code-skimmer","databases"),ne__default.mkdirSync(this.globalCacheDir,{recursive:true}),this.defaultProject=process.env.SKIMMER_PROJECT||null,this.defaultProject&&(this.defaultProject=Y__default.resolve(this.defaultProject)),this.maxOpenProjects=this.parsePositiveInt(process.env.SKIMMER_MAX_OPEN_PROJECTS,Es);let e=this.parsePositiveInt(process.env.SKIMMER_DB_IDLE_MINUTES,_s),t=this.parsePositiveInt(process.env.SKIMMER_DB_TTL_DAYS,Ns);this.maxIdleMs=e*60*1e3,this.dbTtlMs=t*24*60*60*1e3,this.maybeCleanupDiskCache(Date.now());}resolveProjectRoot(e){if(e){let t=Y__default.resolve(e);if(!ne__default.existsSync(t))throw new Error(`\u9879\u76EE\u8DEF\u5F84\u4E0D\u5B58\u5728: ${t}`);return t}return this.lastProject?this.lastProject:this.defaultProject?this.defaultProject:process.cwd()}getDatabase(e){let t=Y__default.resolve(e),n=Date.now();if(this.evictIdleDatabases(n),this.maybeCleanupDiskCache(n),this.dbCache.has(t))return this.touchProject(t,n),this.dbCache.get(t);this.evictLruIfNeeded(n);let r=this.resolveDbPath(t),i=new rt(t,r);return this.dbCache.set(t,i),this.dbPaths.set(t,r),this.touchProject(t,n),this.lastProject=t,process.stderr.write(`[Frontend-Code-Skimmer] \u5DF2\u8FDE\u63A5\u9879\u76EE: ${t}
463
463
  `),process.stderr.write(`[Frontend-Code-Skimmer] \u6570\u636E\u5E93: ${r}
464
- `),s}getContext(e){let t=this.resolveProjectRoot(e),n=this.getDatabase(t);return this.lastProject=t,{db:n,projectRoot:t}}getIndexer(e){let t=this.resolveProjectRoot(e),n=Y__default.resolve(t),r=Date.now();if(this.evictIdleDatabases(r),this.maybeCleanupDiskCache(r),this.indexerCache.has(n))return this.touchProject(n,r),this.lastProject=n,this.indexerCache.get(n);let s=this.getDatabase(n),i=new dt(n,s);return this.indexerCache.set(n,i),this.touchProject(n,r),this.lastProject=n,i}setLastProject(e){this.lastProject=Y__default.resolve(e);}listProjects(){return Array.from(this.dbCache.entries()).map(([e])=>({root:e,dbPath:this.dbPaths.get(e)||this.resolveDbPath(e)}))}registerWatcher(e,t){let n=Y__default.resolve(e),r=this.watcherCleanups.get(n);if(r)try{r();}catch{}this.watcherCleanups.set(n,t);}hasWatcher(e){let t=Y__default.resolve(e);return this.watcherCleanups.has(t)}closeProject(e){let t=Y__default.resolve(e),n=this.watcherCleanups.get(t);if(n){try{n();}catch{}this.watcherCleanups.delete(t);}let r=this.dbCache.get(t);r&&(r.close(),this.dbCache.delete(t),this.accessTimes.delete(t),this.indexerCache.delete(t),this.dbPaths.delete(t),this.lastProject===t&&(this.lastProject=null));}closeAll(){for(let e of this.watcherCleanups.values())try{e();}catch{}this.watcherCleanups.clear();for(let e of this.dbCache.values())e.close();this.dbCache.clear(),this.indexerCache.clear(),this.accessTimes.clear(),this.dbPaths.clear(),this.lastProject=null;}resolveDbPath(e){if(process.env.SKIMMER_DB&&this.dbCache.size===0)return Y__default.resolve(process.env.SKIMMER_DB);let t=Y__default.join(e,".agent","skimmer_find_symbol"),n=Y__default.join(t,Ye);try{return Q__default.mkdirSync(t,{recursive:!0}),Q__default.accessSync(e,Q__default.constants.W_OK),n}catch{let r=createHash("md5").update(e).digest("hex").slice(0,8),s=e.replace(/[/\\:]/g,"_").replace(/^_+/,"").slice(-40);return Y__default.join(this.globalCacheDir,`${r}_${s}.db`)}}parsePositiveInt(e,t){let n=Number.parseInt(String(e||""),10);return Number.isFinite(n)&&n>0?n:t}touchProject(e,t){this.accessTimes.set(e,t);}evictLruIfNeeded(e){for(;this.dbCache.size>=this.maxOpenProjects;){let t=null,n=Number.POSITIVE_INFINITY;for(let r of this.dbCache.keys()){let s=this.accessTimes.get(r)??e;s<n&&(n=s,t=r);}if(!t)break;this.closeProject(t);}}evictIdleDatabases(e){let t=[];for(let n of this.dbCache.keys()){if(n===this.lastProject)continue;let r=this.accessTimes.get(n)??e;e-r>this.maxIdleMs&&t.push(n);}for(let n of t)this.closeProject(n);}maybeCleanupDiskCache(e){if(e-this.lastDiskCleanupAt<os)return;this.lastDiskCleanupAt=e;let t=[];try{t=Q__default.readdirSync(this.globalCacheDir,{withFileTypes:!0});}catch{return}let n=new Set;for(let s of this.dbPaths.values())s.startsWith(this.globalCacheDir)&&n.add(Y__default.resolve(s));let r=e-this.dbTtlMs;for(let s of t){if(!s.isFile()||!s.name.endsWith(".db"))continue;let i=Y__default.join(this.globalCacheDir,s.name);if(n.has(Y__default.resolve(i)))continue;let a;try{a=Q__default.statSync(i);}catch{continue}a.mtimeMs>=r||(this.safeUnlink(i),this.safeUnlink(`${i}-wal`),this.safeUnlink(`${i}-shm`));}}safeUnlink(e){try{Q__default.existsSync(e)&&Q__default.unlinkSync(e);}catch{}}};var ft=createRequire(import.meta.url);function vn(o,e){let t=[];if(o==="heuristic")return {effective:"heuristic",warnings:t};let n=ft("fs"),r=ft("path");if(!cs(e,n,r))return t.push("precise \u6A21\u5F0F\u964D\u7EA7\u4E3A heuristic: \u9879\u76EE\u5185\u672A\u627E\u5230 tsconfig\uFF08\u5DF2\u68C0\u67E5\u6839\u76EE\u5F55\u53CA\u6700\u591A 3 \u5C42\u5B50\u76EE\u5F55\uFF09"),{effective:"heuristic",warnings:t};try{ft.resolve("typescript",{paths:[e]});}catch{try{ft.resolve("typescript");}catch{return t.push("precise \u6A21\u5F0F\u964D\u7EA7\u4E3A heuristic: typescript \u5305\u4E0D\u53EF\u7528\uFF08\u53EF\u80FD\u9700\u8981 npm install\uFF09"),{effective:"heuristic",warnings:t}}}return {effective:"precise",warnings:t}}function cs(o,e,t){let n=["tsconfig.json","tsconfig.base.json","tsconfig.app.json","tsconfig.lib.json","tsconfig.node.json"],r=new Set([".git","node_modules","dist","build","coverage",".next",".nuxt"]),s=[{dir:o,depth:0}];for(;s.length>0;){let i=s.shift();if(!i)break;for(let c of n){let l=t.join(i.dir,c);if(e.existsSync(l))return l}if(i.depth>=3)continue;let a;try{a=e.readdirSync(i.dir,{withFileTypes:!0});}catch{continue}for(let c of a)c.isDirectory()&&(r.has(c.name)||s.push({dir:t.join(i.dir,c.name),depth:i.depth+1}));}return null}function Cn(o,e){o.registerTool("skimmer_index_project",{title:"\u7D22\u5F15\u9879\u76EE\u4EE3\u7801\uFF08\u652F\u6301\u4EFB\u610F\u9879\u76EE\uFF09",description:`\u521D\u59CB\u5316\u6216\u589E\u91CF\u66F4\u65B0\u524D\u7AEF\u9879\u76EE\u4EE3\u7801\u7D22\u5F15\u3002\u652F\u6301 Vue2/Vue3/React Hooks\u3002
464
+ `),i}getContext(e){let t=this.resolveProjectRoot(e),n=this.getDatabase(t);return this.lastProject=t,{db:n,projectRoot:t}}getIndexer(e){let t=this.resolveProjectRoot(e),n=Y__default.resolve(t),r=Date.now();if(this.evictIdleDatabases(r),this.maybeCleanupDiskCache(r),this.indexerCache.has(n))return this.touchProject(n,r),this.lastProject=n,this.indexerCache.get(n);let i=this.getDatabase(n),o=new _t(n,i);return this.indexerCache.set(n,o),this.touchProject(n,r),this.lastProject=n,o}setLastProject(e){this.lastProject=Y__default.resolve(e);}listProjects(){return Array.from(this.dbCache.entries()).map(([e])=>({root:e,dbPath:this.dbPaths.get(e)||this.resolveDbPath(e)}))}registerWatcher(e,t){let n=Y__default.resolve(e),r=this.watcherCleanups.get(n);if(r)try{r();}catch{}this.watcherCleanups.set(n,t);}hasWatcher(e){let t=Y__default.resolve(e);return this.watcherCleanups.has(t)}closeProject(e){let t=Y__default.resolve(e),n=this.watcherCleanups.get(t);if(n){try{n();}catch{}this.watcherCleanups.delete(t);}let r=this.dbCache.get(t);r&&(r.close(),this.dbCache.delete(t),this.accessTimes.delete(t),this.indexerCache.delete(t),this.dbPaths.delete(t),this.lastProject===t&&(this.lastProject=null));}closeAll(){for(let e of this.watcherCleanups.values())try{e();}catch{}this.watcherCleanups.clear();for(let e of this.dbCache.values())e.close();this.dbCache.clear(),this.indexerCache.clear(),this.accessTimes.clear(),this.dbPaths.clear(),this.lastProject=null;}resolveDbPath(e){if(process.env.SKIMMER_DB&&this.dbCache.size===0)return Y__default.resolve(process.env.SKIMMER_DB);let t=Y__default.join(e,".agent","skimmer_find_symbol"),n=Y__default.join(t,nt);try{return ne__default.mkdirSync(t,{recursive:!0}),ne__default.accessSync(e,ne__default.constants.W_OK),n}catch{let r=createHash("md5").update(e).digest("hex").slice(0,8),i=e.replace(/[/\\:]/g,"_").replace(/^_+/,"").slice(-40);return Y__default.join(this.globalCacheDir,`${r}_${i}.db`)}}parsePositiveInt(e,t){let n=Number.parseInt(String(e||""),10);return Number.isFinite(n)&&n>0?n:t}touchProject(e,t){this.accessTimes.set(e,t);}evictLruIfNeeded(e){for(;this.dbCache.size>=this.maxOpenProjects;){let t=null,n=Number.POSITIVE_INFINITY;for(let r of this.dbCache.keys()){let i=this.accessTimes.get(r)??e;i<n&&(n=i,t=r);}if(!t)break;this.closeProject(t);}}evictIdleDatabases(e){let t=[];for(let n of this.dbCache.keys()){if(n===this.lastProject)continue;let r=this.accessTimes.get(n)??e;e-r>this.maxIdleMs&&t.push(n);}for(let n of t)this.closeProject(n);}maybeCleanupDiskCache(e){if(e-this.lastDiskCleanupAt<Ss)return;this.lastDiskCleanupAt=e;let t=[];try{t=ne__default.readdirSync(this.globalCacheDir,{withFileTypes:!0});}catch{return}let n=new Set;for(let i of this.dbPaths.values())i.startsWith(this.globalCacheDir)&&n.add(Y__default.resolve(i));let r=e-this.dbTtlMs;for(let i of t){if(!i.isFile()||!i.name.endsWith(".db"))continue;let o=Y__default.join(this.globalCacheDir,i.name);if(n.has(Y__default.resolve(o)))continue;let a;try{a=ne__default.statSync(o);}catch{continue}a.mtimeMs>=r||(this.safeUnlink(o),this.safeUnlink(`${o}-wal`),this.safeUnlink(`${o}-shm`));}}safeUnlink(e){try{ne__default.existsSync(e)&&ne__default.unlinkSync(e);}catch{}}};var St=createRequire(import.meta.url);function Mn(s,e){let t=[];if(s==="heuristic")return {effective:"heuristic",warnings:t};let n=St("fs"),r=St("path");if(!Ts(e,n,r))return t.push("precise \u6A21\u5F0F\u964D\u7EA7\u4E3A heuristic: \u9879\u76EE\u5185\u672A\u627E\u5230 tsconfig\uFF08\u5DF2\u68C0\u67E5\u6839\u76EE\u5F55\u53CA\u6700\u591A 3 \u5C42\u5B50\u76EE\u5F55\uFF09"),{effective:"heuristic",warnings:t};try{St.resolve("typescript",{paths:[e]});}catch{try{St.resolve("typescript");}catch{return t.push("precise \u6A21\u5F0F\u964D\u7EA7\u4E3A heuristic: typescript \u5305\u4E0D\u53EF\u7528\uFF08\u53EF\u80FD\u9700\u8981 npm install\uFF09"),{effective:"heuristic",warnings:t}}}return {effective:"precise",warnings:t}}function Ts(s,e,t){let n=["tsconfig.json","tsconfig.base.json","tsconfig.app.json","tsconfig.lib.json","tsconfig.node.json"],r=new Set([".git","node_modules","dist","build","coverage",".next",".nuxt"]),i=[{dir:s,depth:0}];for(;i.length>0;){let o=i.shift();if(!o)break;for(let c of n){let l=t.join(o.dir,c);if(e.existsSync(l))return l}if(o.depth>=3)continue;let a;try{a=e.readdirSync(o.dir,{withFileTypes:!0});}catch{continue}for(let c of a)c.isDirectory()&&(r.has(c.name)||i.push({dir:t.join(o.dir,c.name),depth:o.depth+1}));}return null}function jn(s,e){s.registerTool("skimmer_index_project",{title:"\u7D22\u5F15\u9879\u76EE\u4EE3\u7801\uFF08\u652F\u6301\u4EFB\u610F\u9879\u76EE\uFF09",description:`\u521D\u59CB\u5316\u6216\u589E\u91CF\u66F4\u65B0\u524D\u7AEF\u9879\u76EE\u4EE3\u7801\u7D22\u5F15\u3002\u652F\u6301 Vue2/Vue3/React Hooks\u3002
465
465
  \u6BCF\u6B21\u8C03\u7528\u5FC5\u987B\u4F20\u5165 project_path\uFF08\u9879\u76EE\u6839\u76EE\u5F55\u7EDD\u5BF9\u8DEF\u5F84\uFF09\uFF0C\u65E0\u9700\u5728\u542F\u52A8\u65F6\u56FA\u5B9A\u9879\u76EE\u3002
466
466
  \u4F18\u5148\u4ECE\u7F16\u8F91\u5668\u5DE5\u4F5C\u533A\u3001\u5DF2\u6253\u5F00\u6587\u4EF6\u548C\u5F53\u524D\u4E0A\u4E0B\u6587\u4E2D\u81EA\u52A8\u63A8\u65AD project_path\uFF0C\u907F\u514D\u5411\u7528\u6237\u8FFD\u95EE\u8DEF\u5F84\u3002
467
467
  \u591A\u4E2A\u9879\u76EE\u4F1A\u5E76\u884C\u7F13\u5B58\uFF0C\u5207\u6362\u65E0\u9700\u91CD\u542F\u3002
@@ -472,45 +472,47 @@ import*as Y from'path';import Y__default from'path';import {fileURLToPath}from'u
472
472
  - \u5F3A\u5236\u5168\u91CF\u91CD\u5EFA: force=true
473
473
  - \u7CBE\u786E\u7CBE\u5EA6\u6A21\u5F0F: precision_mode="precise"\uFF08\u57FA\u4E8E TypeScript Compiler API \u505A\u8DE8\u6587\u4EF6 import/export \u7ED1\u5B9A\uFF09
474
474
 
475
- \u8FD4\u56DE: \u7D22\u5F15\u7EDF\u8BA1\uFF08\u6587\u4EF6\u6570\u3001\u7B26\u53F7\u6570\u3001\u8017\u65F6\u3001\u7CBE\u5EA6\u6A21\u5F0F\uFF09`,inputSchema:z$1.object({project_path:z$1.string().describe('\u9879\u76EE\u6839\u76EE\u5F55\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 "/Users/xxx/projects/my-app"'),force:z$1.boolean().optional().default(false).describe("\u662F\u5426\u5F3A\u5236\u5168\u91CF\u91CD\u5EFA\uFF08\u9ED8\u8BA4\u589E\u91CF\uFF0C\u53EA\u66F4\u65B0\u53D8\u66F4\u6587\u4EF6\uFF09"),include:z$1.array(z$1.string()).optional().describe('\u8981\u5305\u542B\u7684\u6587\u4EF6 glob \u6A21\u5F0F\uFF0C\u5982 ["**/*.vue","**/*.tsx"]'),exclude:z$1.array(z$1.string()).optional().describe("\u8981\u989D\u5916\u6392\u9664\u7684 glob \u6A21\u5F0F"),precision_mode:z$1.enum(["heuristic","precise"]).optional().default("heuristic").describe("\u5206\u6790\u7CBE\u5EA6\u6A21\u5F0F: heuristic(\u5FEB\u901F\uFF0C\u9ED8\u8BA4) | precise(\u8DE8\u6587\u4EF6 import/export \u7ED1\u5B9A\uFF0C\u9700\u8981\u9879\u76EE\u5185\u5B58\u5728 tsconfig)"),selective_precise:z$1.boolean().optional().default(false).describe("Phase 5: \u662F\u5426\u5728\u7D22\u5F15\u540E\u6267\u884C\u9009\u62E9\u6027 precise \u91CD\u7B97\uFF08\u4EC5\u91CD\u7B97\u53D8\u66F4\u6587\u4EF6+\u53D7\u5F71\u54CD\u6587\u4EF6\uFF09"),max_precise_files:z$1.number().optional().default(20).describe("\u9009\u62E9\u6027 precise \u5355\u6B21\u6700\u5927\u6587\u4EF6\u6570\uFF08\u9ED8\u8BA4 20\uFF09")}),annotations:{readOnlyHint:false,destructiveHint:false,idempotentHint:true}},async({project_path:t,force:n,include:r,exclude:s,precision_mode:i,selective_precise:a,max_precise_files:c})=>{let{projectRoot:l}=e.getContext(t),p=i||"heuristic",{effective:u,warnings:d}=vn(p,l),g=e.getIndexer(l),f=await g.indexProject({include:r,exclude:s,force:n,precisionMode:u,onProgress:(k,$)=>{(k%20===0||k===$)&&process.stderr.write(`[Frontend-Code-Skimmer] \u8FDB\u5EA6: ${k}/${$}
476
- `);}});e.setLastProject(l);let m=0;try{let k=Date.now(),$=await g.startWatcher();m=Date.now()-k,e.registerWatcher(l,$),process.stderr.write(`[Frontend-Code-Skimmer] \u6587\u4EF6\u76D1\u542C\u5DF2\u542F\u52A8: ${l}
477
- `);}catch(k){process.stderr.write(`[Frontend-Code-Skimmer] \u6587\u4EF6\u76D1\u542C\u542F\u52A8\u5931\u8D25\uFF08\u7D22\u5F15\u4ECD\u53EF\u7528\uFF09: ${String(k)}
478
- `);}let h=null;if(a)try{let k=await g.selectivePrecise({maxFiles:c||20});h={reindexedFiles:k.reindexedFiles,affectedFiles:k.affectedFiles.length,skippedByBudget:k.skippedByBudget};}catch(k){process.stderr.write(`[Frontend-Code-Skimmer] Selective precise \u5931\u8D25: ${String(k)}
479
- `);}let b=f.indexedFiles>0||f.totalFiles>0,S=f.totalSymbols>0,y=b?"\u2705 \u53EF\u7528":"\u274C \u65E0\u53EF\u67E5\u8BE2\u6587\u4EF6",T=S?"\u2705 \u53EF\u7528":"\u26A0\uFE0F \u7B26\u53F7\u6570\u4E3A0\uFF08\u89E3\u6790\u53EF\u80FD\u672A\u63D0\u53D6\u5230\u7B26\u53F7\uFF0C\u4F46\u6587\u4EF6\u641C\u7D22\u4ECD\u53EF\u7528\uFF09",E=b?"\u2705 \u53EF\u7528":"\u274C \u65E0\u53EF\u67E5\u8BE2\u6587\u4EF6",L=b?"\u2705 \u53EF\u7528\uFF08\u57FA\u4E8E\u6B63\u5219\u626B\u63CF\u6587\u4EF6\uFF09":"\u274C \u65E0\u53EF\u67E5\u8BE2\u6587\u4EF6",_=f.phaseTimings,N=_?["","\u23F1\uFE0F \u3010\u9636\u6BB5\u8017\u65F6\u3011",` \u{1F50D} \u6587\u4EF6\u53D1\u73B0: ${_.discoverFilesMs}ms`,` \u{1F4D6} \u6587\u4EF6\u8BFB\u53D6: ${_.readFilesMs}ms`,` \u{1F52C} \u89E3\u6790: ${_.parseMs}ms`,` \u{1F4BE} \u6570\u636E\u5E93\u5199\u5165: ${_.saveToDbMs}ms`,` \u{1F4CA} \u603B\u8BA1: ${_.totalMs}ms`,` \u{1F4E1} \u6587\u4EF6\u76D1\u542C: ${m}ms`]:[],A=[`\u2705 \u7D22\u5F15\u5B8C\u6210 \u2014 ${l}`,"\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501","","\u{1F4CA} \u3010\u7EDF\u8BA1\u6570\u91CF\u3011\uFF08\u6CE8\u610F\uFF1A\u7B26\u53F7\u65700\u53EF\u80FD\u662F\u89E3\u6790\u89C4\u5219\u672A\u547D\u4E2D\uFF0C\u4E0D\u4EE3\u8868\u7D22\u5F15\u5931\u8D25\uFF09",` \u{1F4C1} \u603B\u6587\u4EF6\u6570: ${f.totalFiles}`,` \u{1F504} \u5DF2\u7D22\u5F15: ${f.indexedFiles}`,` \u23E9 \u5DF2\u8DF3\u8FC7: ${f.skippedFiles} (\u5185\u5BB9\u672A\u53D8)`,` \u{1F523} \u603B\u7B26\u53F7\u6570: ${f.totalSymbols}`,` \u{1F3AF} \u7CBE\u5EA6\u6A21\u5F0F: ${u}`,` \u23F1\uFE0F \u8017\u65F6: ${f.durationMs}ms`,...N,"","\u{1F50C} \u3010\u53EF\u67E5\u8BE2\u80FD\u529B\u72B6\u6001\u3011\uFF08\u4E0E\u7B26\u53F7\u6570\u65E0\u5173\uFF0C\u53EA\u8981\u6587\u4EF6\u626B\u63CF\u5B8C\u6210\u5373\u53EF\u7528\uFF09",` skimmer_find_symbol ${T}`,` skimmer_get_component_outline ${T}`,` skimmer_find_by_behavior ${E}`,` skimmer_trace_data_lifecycle ${L}`,` skimmer_trace_assignments ${L}`,` skimmer_get_code_slice ${y}`," skimmer_index_health \u2705 \u53EF\u7528","","\u{1F4A1} \u540E\u7EED\u5DE5\u5177\u8C03\u7528\u53EF\u7701\u7565 project_path\uFF08\u81EA\u52A8\u4F7F\u7528\u6B64\u9879\u76EE\uFF09"," \u5982\u7B26\u53F7\u6570\u4E3A0\u4F46\u5DE5\u5177\u4ECD\u8FD4\u56DE\u7ED3\u679C\uFF0C\u5C5E\u6B63\u5E38\u73B0\u8C61\uFF08\u6B63\u5219\u626B\u63CF\u8DEF\u5F84\u4E0D\u4F9D\u8D56\u7B26\u53F7\u7D22\u5F15\uFF09","\u{1F441}\uFE0F \u6587\u4EF6\u76D1\u542C\u5DF2\u542F\u52A8 \u2014 \u4EE3\u7801\u53D8\u66F4\u5C06\u81EA\u52A8\u589E\u91CF\u66F4\u65B0\u7D22\u5F15\uFF08\u65E0\u9700\u624B\u52A8\u91CD\u65B0\u7D22\u5F15\uFF09"];if(f.errors.length>0){A.push(`
480
- \u26A0\uFE0F \u89E3\u6790\u5931\u8D25 (${f.errors.length} \u4E2A):`);for(let k of f.errors.slice(0,5))A.push(` - ${k.file}: ${k.error}`);f.errors.length>5&&A.push(` ... \u8FD8\u6709 ${f.errors.length-5} \u4E2A`);}if(d.length>0){A.push(""),A.push("\u26A0\uFE0F \u7CBE\u5EA6\u964D\u7EA7:");for(let k of d)A.push(` - ${k}`);}if(h){A.push(""),A.push("\u{1F3AF} \u9009\u62E9\u6027 Precise \u91CD\u7B97:"),A.push(` \u{1F4CA} \u91CD\u7B97\u6587\u4EF6: ${h.reindexedFiles}`),A.push(` \u{1F517} \u5F71\u54CD\u6587\u4EF6: ${h.affectedFiles} (\u5019\u9009\u6570)`),h.skippedByBudget>0&&(A.push(` \u23F8\uFE0F \u8D85\u9884\u7B97\u8DF3\u8FC7\u7684\u6587\u4EF6: ${h.skippedByBudget}`),A.push(" \u{1F4A1} \u540E\u7EED watcher \u89E6\u53D1\u6216\u518D\u6B21\u8C03\u7528 selective_precise=true \u7EE7\u7EED"));let k=g.getScheduler().pendingCount;k>0&&A.push(` \u{1F4CB} Pending queue: ${k} \u6587\u4EF6\u5F85\u91CD\u7B97`);}return {content:[{type:"text",text:A.join(`
481
- `)}]}});}function Bt(o,e,t){try{if(!e||!Q__default.existsSync(e))return {stale:!1};let n=Q__default.statSync(e),r=o.getFileMeta(t);if(!r)return {stale:!1};let s=r.mtime>0&&n.mtimeMs>r.mtime,i=r.fileSize>0&&n.size!==r.fileSize;return s||i?{stale:!0,reason:i?`\u6587\u4EF6\u5927\u5C0F\u5DEE\u5F02 ${n.size-r.fileSize>0?"+":""}${n.size-r.fileSize} \u5B57\u8282`:"\u6587\u4EF6\u4FEE\u6539\u65F6\u95F4\u66F4\u65B0"}:{stale:!1}}catch{return {stale:false}}}function In(o,e,t=5){let n=e.slice(0,t),r=[],s=0;for(let i of n){if(!i.abs_path||!Q__default.existsSync(i.abs_path))continue;s++;let{stale:a}=Bt(o,i.abs_path,i.path);a&&r.push(i.path);}return {stale:r.length>0,reason:r.length>0?`${r.length}/${s} \u6587\u4EF6\u5DF2\u4FEE\u6539\u4F46\u7D22\u5F15\u672A\u66F4\u65B0`:void 0,checkedFiles:s,staleFiles:r.length,staleFilePaths:r.slice(0,5)}}function H(o){return {duration_ms:o.durationMs,result_count:o.resultCount,backend:o.backend,index_freshness:o.indexFreshness,project_count:o.projectCount??1,debug:o.debug,precision_mode_requested:o.precisionRequested,precision_mode_effective:o.precisionEffective,precision_warnings:o.precisionWarnings}}function W(o){let e=[`\u23F1\uFE0F \u8017\u65F6: ${o.duration_ms}ms | \u{1F4CA} \u7ED3\u679C\u6570: ${o.result_count} | \u{1F527} \u540E\u7AEF: ${o.backend}`];if(o.precision_mode_effective){let t=o.precision_mode_effective==="precise"?"\u{1F3AF} \u7CBE\u786E":"\u26A1 \u542F\u53D1\u5F0F",n=o.precision_mode_requested!==o.precision_mode_effective?` (\u8BF7\u6C42: ${o.precision_mode_requested})`:"";e.push(`\u{1F4D0} \u7CBE\u5EA6\u6A21\u5F0F: ${t}${n}`);}if(o.precision_warnings&&o.precision_warnings.length>0)for(let t of o.precision_warnings)e.push(`\u26A0\uFE0F \u7CBE\u5EA6\u8B66\u544A: ${t}`);if(o.index_freshness){let t=o.index_freshness;t.stale?(e.push(`\u26A0\uFE0F \u7D22\u5F15\u65B0\u9C9C\u5EA6: \u5DF2\u8FC7\u671F (${t.staleFiles}/${t.checkedFiles} \u6587\u4EF6) \u2014 ${t.reason||""}`),t.staleFilePaths.length>0&&e.push(` \u8FC7\u671F\u6587\u4EF6: ${t.staleFilePaths.join(", ")}`)):e.push(`\u2705 \u7D22\u5F15\u65B0\u9C9C\u5EA6: \u6700\u65B0 (\u5DF2\u68C0\u67E5 ${t.checkedFiles} \u6587\u4EF6)`);}if(o.debug){if(e.push("\u2500\u2500 \u8C03\u8BD5\u4FE1\u606F \u2500\u2500"),o.debug.phase_timings){e.push("\u9636\u6BB5\u8017\u65F6:");for(let[t,n]of Object.entries(o.debug.phase_timings))e.push(` ${t}: ${n}ms`);}o.debug.query_plan&&e.push(`\u67E5\u8BE2\u8BA1\u5212: ${o.debug.query_plan}`),o.debug.candidate_count!==void 0&&e.push(`\u5019\u9009\u6570: ${o.debug.candidate_count}`),o.debug.scanned_files!==void 0&&e.push(`\u626B\u63CF\u6587\u4EF6\u6570: ${o.debug.scanned_files}`),o.debug.fallback_reason&&e.push(`\u964D\u7EA7\u539F\u56E0: ${o.debug.fallback_reason}`);}return e.join(`
482
- `)}function $n(o,e){o.registerTool("skimmer_get_component_outline",{title:"\u83B7\u53D6\u7EC4\u4EF6/\u6587\u4EF6\u7ED3\u6784\u9AA8\u67B6",description:`\u5C06\u6570\u5343\u884C\u4EE3\u7801\u538B\u7F29\u4E3A\u6E05\u6670\u7684\u7ED3\u6784\u9AA8\u67B6\uFF08\u7EA6 30-80 \u884C\uFF09\uFF0C\u8282\u7701 90%+ Token\u3002
475
+ \u8FD4\u56DE: \u7D22\u5F15\u7EDF\u8BA1\uFF08\u6587\u4EF6\u6570\u3001\u7B26\u53F7\u6570\u3001\u8017\u65F6\u3001\u7CBE\u5EA6\u6A21\u5F0F\uFF09`,inputSchema:z$1.object({project_path:z$1.string().describe('\u9879\u76EE\u6839\u76EE\u5F55\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 "/Users/xxx/projects/my-app"'),force:z$1.boolean().optional().default(false).describe("\u662F\u5426\u5F3A\u5236\u5168\u91CF\u91CD\u5EFA\uFF08\u9ED8\u8BA4\u589E\u91CF\uFF0C\u53EA\u66F4\u65B0\u53D8\u66F4\u6587\u4EF6\uFF09"),include:z$1.array(z$1.string()).optional().describe('\u8981\u5305\u542B\u7684\u6587\u4EF6 glob \u6A21\u5F0F\uFF0C\u5982 ["**/*.vue","**/*.tsx"]'),exclude:z$1.array(z$1.string()).optional().describe("\u8981\u989D\u5916\u6392\u9664\u7684 glob \u6A21\u5F0F"),precision_mode:z$1.enum(["heuristic","precise"]).optional().default("heuristic").describe("\u5206\u6790\u7CBE\u5EA6\u6A21\u5F0F: heuristic(\u5FEB\u901F\uFF0C\u9ED8\u8BA4) | precise(\u8DE8\u6587\u4EF6 import/export \u7ED1\u5B9A\uFF0C\u9700\u8981\u9879\u76EE\u5185\u5B58\u5728 tsconfig)"),selective_precise:z$1.boolean().optional().default(false).describe("Phase 5: \u662F\u5426\u5728\u7D22\u5F15\u540E\u6267\u884C\u9009\u62E9\u6027 precise \u91CD\u7B97\uFF08\u4EC5\u91CD\u7B97\u53D8\u66F4\u6587\u4EF6+\u53D7\u5F71\u54CD\u6587\u4EF6\uFF09"),max_precise_files:z$1.number().optional().default(20).describe("\u9009\u62E9\u6027 precise \u5355\u6B21\u6700\u5927\u6587\u4EF6\u6570\uFF08\u9ED8\u8BA4 20\uFF09")}),annotations:{readOnlyHint:false,destructiveHint:false,idempotentHint:true}},async({project_path:t,force:n,include:r,exclude:i,precision_mode:o,selective_precise:a,max_precise_files:c})=>{let{projectRoot:l}=e.getContext(t),p=o||"heuristic",{effective:u,warnings:d}=Mn(p,l),h=e.getIndexer(l),f=await h.indexProject({include:r,exclude:i,force:n,precisionMode:u,onProgress:(w,P)=>{(w%20===0||w===P)&&process.stderr.write(`[Frontend-Code-Skimmer] \u8FDB\u5EA6: ${w}/${P}
476
+ `);}});e.setLastProject(l);let m=0;try{let w=Date.now(),P=await h.startWatcher();m=Date.now()-w,e.registerWatcher(l,P),process.stderr.write(`[Frontend-Code-Skimmer] \u6587\u4EF6\u76D1\u542C\u5DF2\u542F\u52A8: ${l}
477
+ `);}catch(w){process.stderr.write(`[Frontend-Code-Skimmer] \u6587\u4EF6\u76D1\u542C\u542F\u52A8\u5931\u8D25\uFF08\u7D22\u5F15\u4ECD\u53EF\u7528\uFF09: ${String(w)}
478
+ `);}let y=null;if(a)try{let w=await h.selectivePrecise({maxFiles:c||20});y={reindexedFiles:w.reindexedFiles,affectedFiles:w.affectedFiles.length,skippedByBudget:w.skippedByBudget};}catch(w){process.stderr.write(`[Frontend-Code-Skimmer] Selective precise \u5931\u8D25: ${String(w)}
479
+ `);}let g=f.indexedFiles>0||f.totalFiles>0,N=f.totalSymbols>0,b=g?"\u2705 \u53EF\u7528":"\u274C \u65E0\u53EF\u67E5\u8BE2\u6587\u4EF6",S=N?"\u2705 \u53EF\u7528":"\u26A0\uFE0F \u7B26\u53F7\u6570\u4E3A0\uFF08\u89E3\u6790\u53EF\u80FD\u672A\u63D0\u53D6\u5230\u7B26\u53F7\uFF0C\u4F46\u6587\u4EF6\u641C\u7D22\u4ECD\u53EF\u7528\uFF09",E=g?"\u2705 \u53EF\u7528":"\u274C \u65E0\u53EF\u67E5\u8BE2\u6587\u4EF6",L=g?"\u2705 \u53EF\u7528\uFF08\u57FA\u4E8E\u6B63\u5219\u626B\u63CF\u6587\u4EF6\uFF09":"\u274C \u65E0\u53EF\u67E5\u8BE2\u6587\u4EF6",_=f.phaseTimings,x=_?["","\u23F1\uFE0F \u3010\u9636\u6BB5\u8017\u65F6\u3011",` \u{1F50D} \u6587\u4EF6\u53D1\u73B0: ${_.discoverFilesMs}ms`,` \u{1F4D6} \u6587\u4EF6\u8BFB\u53D6: ${_.readFilesMs}ms`,` \u{1F52C} \u89E3\u6790: ${_.parseMs}ms`,` \u{1F4BE} \u6570\u636E\u5E93\u5199\u5165: ${_.saveToDbMs}ms`,` \u{1F4CA} \u603B\u8BA1: ${_.totalMs}ms`,` \u{1F4E1} \u6587\u4EF6\u76D1\u542C: ${m}ms`]:[],A=[`\u2705 \u7D22\u5F15\u5B8C\u6210 \u2014 ${l}`,"\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501","","\u{1F4CA} \u3010\u7EDF\u8BA1\u6570\u91CF\u3011\uFF08\u6CE8\u610F\uFF1A\u7B26\u53F7\u65700\u53EF\u80FD\u662F\u89E3\u6790\u89C4\u5219\u672A\u547D\u4E2D\uFF0C\u4E0D\u4EE3\u8868\u7D22\u5F15\u5931\u8D25\uFF09",` \u{1F4C1} \u603B\u6587\u4EF6\u6570: ${f.totalFiles}`,` \u{1F504} \u5DF2\u7D22\u5F15: ${f.indexedFiles}`,` \u23E9 \u5DF2\u8DF3\u8FC7: ${f.skippedFiles} (\u5185\u5BB9\u672A\u53D8)`,` \u{1F523} \u603B\u7B26\u53F7\u6570: ${f.totalSymbols}`,` \u{1F3AF} \u7CBE\u5EA6\u6A21\u5F0F: ${u}`,` \u23F1\uFE0F \u8017\u65F6: ${f.durationMs}ms`,...x,"","\u{1F50C} \u3010\u53EF\u67E5\u8BE2\u80FD\u529B\u72B6\u6001\u3011\uFF08\u4E0E\u7B26\u53F7\u6570\u65E0\u5173\uFF0C\u53EA\u8981\u6587\u4EF6\u626B\u63CF\u5B8C\u6210\u5373\u53EF\u7528\uFF09",` skimmer_find_symbol ${S}`,` skimmer_get_component_outline ${S}`,` skimmer_find_by_behavior ${E}`,` skimmer_trace_data_lifecycle ${L}`,` skimmer_trace_assignments ${L}`,` skimmer_get_code_slice ${b}`," skimmer_index_health \u2705 \u53EF\u7528","","\u{1F4A1} \u540E\u7EED\u5DE5\u5177\u8C03\u7528\u53EF\u7701\u7565 project_path\uFF08\u81EA\u52A8\u4F7F\u7528\u6B64\u9879\u76EE\uFF09"," \u5982\u7B26\u53F7\u6570\u4E3A0\u4F46\u5DE5\u5177\u4ECD\u8FD4\u56DE\u7ED3\u679C\uFF0C\u5C5E\u6B63\u5E38\u73B0\u8C61\uFF08\u6B63\u5219\u626B\u63CF\u8DEF\u5F84\u4E0D\u4F9D\u8D56\u7B26\u53F7\u7D22\u5F15\uFF09","\u{1F441}\uFE0F \u6587\u4EF6\u76D1\u542C\u5DF2\u542F\u52A8 \u2014 \u4EE3\u7801\u53D8\u66F4\u5C06\u81EA\u52A8\u589E\u91CF\u66F4\u65B0\u7D22\u5F15\uFF08\u65E0\u9700\u624B\u52A8\u91CD\u65B0\u7D22\u5F15\uFF09"];if(f.errors.length>0){A.push(`
480
+ \u26A0\uFE0F \u89E3\u6790\u5931\u8D25 (${f.errors.length} \u4E2A):`);for(let w of f.errors.slice(0,5))A.push(` - ${w.file}: ${w.error}`);f.errors.length>5&&A.push(` ... \u8FD8\u6709 ${f.errors.length-5} \u4E2A`);}if(d.length>0){A.push(""),A.push("\u26A0\uFE0F \u7CBE\u5EA6\u964D\u7EA7:");for(let w of d)A.push(` - ${w}`);}if(y){A.push(""),A.push("\u{1F3AF} \u9009\u62E9\u6027 Precise \u91CD\u7B97:"),A.push(` \u{1F4CA} \u91CD\u7B97\u6587\u4EF6: ${y.reindexedFiles}`),A.push(` \u{1F517} \u5F71\u54CD\u6587\u4EF6: ${y.affectedFiles} (\u5019\u9009\u6570)`),y.skippedByBudget>0&&(A.push(` \u23F8\uFE0F \u8D85\u9884\u7B97\u8DF3\u8FC7\u7684\u6587\u4EF6: ${y.skippedByBudget}`),A.push(" \u{1F4A1} \u540E\u7EED watcher \u89E6\u53D1\u6216\u518D\u6B21\u8C03\u7528 selective_precise=true \u7EE7\u7EED"));let w=h.getScheduler().pendingCount;w>0&&A.push(` \u{1F4CB} Pending queue: ${w} \u6587\u4EF6\u5F85\u91CD\u7B97`);}return {content:[{type:"text",text:A.join(`
481
+ `)}]}});}function qt(s,e,t){try{if(!e||!ne__default.existsSync(e))return {stale:!1};let n=ne__default.statSync(e),r=s.getFileMeta(t);if(!r)return {stale:!1};let i=r.mtime>0&&n.mtimeMs>r.mtime,o=r.fileSize>0&&n.size!==r.fileSize;return i||o?{stale:!0,reason:o?`\u6587\u4EF6\u5927\u5C0F\u5DEE\u5F02 ${n.size-r.fileSize>0?"+":""}${n.size-r.fileSize} \u5B57\u8282`:"\u6587\u4EF6\u4FEE\u6539\u65F6\u95F4\u66F4\u65B0"}:{stale:!1}}catch{return {stale:false}}}function Bn(s,e,t=5){let n=e.slice(0,t),r=[],i=0;for(let o of n){if(!o.abs_path||!ne__default.existsSync(o.abs_path))continue;i++;let{stale:a}=qt(s,o.abs_path,o.path);a&&r.push(o.path);}return {stale:r.length>0,reason:r.length>0?`${r.length}/${i} \u6587\u4EF6\u5DF2\u4FEE\u6539\u4F46\u7D22\u5F15\u672A\u66F4\u65B0`:void 0,checkedFiles:i,staleFiles:r.length,staleFilePaths:r.slice(0,5)}}function X(s){return {duration_ms:s.durationMs,result_count:s.resultCount,backend:s.backend,index_freshness:s.indexFreshness,project_count:s.projectCount??1,debug:s.debug,precision_mode_requested:s.precisionRequested,precision_mode_effective:s.precisionEffective,precision_warnings:s.precisionWarnings}}function W(s){let e=[`\u23F1\uFE0F \u8017\u65F6: ${s.duration_ms}ms | \u{1F4CA} \u7ED3\u679C\u6570: ${s.result_count} | \u{1F527} \u540E\u7AEF: ${s.backend}`];if(s.precision_mode_effective){let t=s.precision_mode_effective==="precise"?"\u{1F3AF} \u7CBE\u786E":"\u26A1 \u542F\u53D1\u5F0F",n=s.precision_mode_requested!==s.precision_mode_effective?` (\u8BF7\u6C42: ${s.precision_mode_requested})`:"";e.push(`\u{1F4D0} \u7CBE\u5EA6\u6A21\u5F0F: ${t}${n}`);}if(s.precision_warnings&&s.precision_warnings.length>0)for(let t of s.precision_warnings)e.push(`\u26A0\uFE0F \u7CBE\u5EA6\u8B66\u544A: ${t}`);if(s.index_freshness){let t=s.index_freshness;t.stale?(e.push(`\u26A0\uFE0F \u7D22\u5F15\u65B0\u9C9C\u5EA6: \u5DF2\u8FC7\u671F (${t.staleFiles}/${t.checkedFiles} \u6587\u4EF6) \u2014 ${t.reason||""}`),t.staleFilePaths.length>0&&e.push(` \u8FC7\u671F\u6587\u4EF6: ${t.staleFilePaths.join(", ")}`)):e.push(`\u2705 \u7D22\u5F15\u65B0\u9C9C\u5EA6: \u6700\u65B0 (\u5DF2\u68C0\u67E5 ${t.checkedFiles} \u6587\u4EF6)`);}if(s.debug){if(e.push("\u2500\u2500 \u8C03\u8BD5\u4FE1\u606F \u2500\u2500"),s.debug.phase_timings){e.push("\u9636\u6BB5\u8017\u65F6:");for(let[t,n]of Object.entries(s.debug.phase_timings))e.push(` ${t}: ${n}ms`);}s.debug.query_plan&&e.push(`\u67E5\u8BE2\u8BA1\u5212: ${s.debug.query_plan}`),s.debug.candidate_count!==void 0&&e.push(`\u5019\u9009\u6570: ${s.debug.candidate_count}`),s.debug.scanned_files!==void 0&&e.push(`\u626B\u63CF\u6587\u4EF6\u6570: ${s.debug.scanned_files}`),s.debug.fallback_reason&&e.push(`\u964D\u7EA7\u539F\u56E0: ${s.debug.fallback_reason}`);}return e.join(`
482
+ `)}function Un(s,e){s.registerTool("skimmer_get_component_outline",{title:"\u83B7\u53D6\u7EC4\u4EF6/\u6587\u4EF6\u7ED3\u6784\u9AA8\u67B6",description:`\u5C06\u6570\u5343\u884C\u4EE3\u7801\u538B\u7F29\u4E3A\u6E05\u6670\u7684\u7ED3\u6784\u9AA8\u67B6\uFF08\u7EA6 30-80 \u884C\uFF09\uFF0C\u8282\u7701 90%+ Token\u3002
483
483
  \u5305\u542B: props\u3001data/state\u3001computed\u3001methods/functions\u3001watch/effect\u3001lifecycle\u3001\u884C\u4E3A\u6807\u7B7E\u3002
484
484
  \u884C\u4E3A\u6807\u7B7E\u81EA\u52A8\u6807\u51FA: [storage:localStorage.setItem] [network:axios.get] \u7B49\u3002
485
485
 
486
486
  project_path \u53EF\u7701\u7565\uFF08\u4F7F\u7528\u4E0A\u6B21 skimmer_index_project \u6307\u5B9A\u7684\u9879\u76EE\uFF09\u3002
487
- file_path \u4F7F\u7528\u76F8\u5BF9\u4E8E\u9879\u76EE\u6839\u76EE\u5F55\u7684\u8DEF\u5F84\uFF0C\u5982 "src/views/apply/index.vue"\u3002`,inputSchema:z$1.object({file_path:z$1.string().describe('\u6587\u4EF6\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u5982 "src/views/apply/index.vue"'),project_path:z$1.string().optional().describe("\u9879\u76EE\u6839\u76EE\u5F55\uFF08\u53EF\u7701\u7565\uFF0C\u4F7F\u7528\u4E0A\u6B21\u7D22\u5F15\u7684\u9879\u76EE\uFF09"),debug:z$1.boolean().optional().default(false).describe("\u662F\u5426\u8F93\u51FA\u8C03\u8BD5\u5143\u4FE1\u606F")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({file_path:t,project_path:n,debug:r})=>{let s=performance.now(),{db:i}=e.getContext(n),{file:a,symbols:c,behaviors:l}=i.getFileOutline(t);if(!a){let T=Math.round((performance.now()-s)*100)/100,E=H({durationMs:T,resultCount:0,backend:"indexed"});return {content:[{type:"text",text:`\u274C \u6587\u4EF6\u672A\u7D22\u5F15: ${t}
487
+ file_path \u4F7F\u7528\u76F8\u5BF9\u4E8E\u9879\u76EE\u6839\u76EE\u5F55\u7684\u8DEF\u5F84\uFF0C\u5982 "src/views/apply/index.vue"\u3002`,inputSchema:z$1.object({file_path:z$1.string().describe('\u6587\u4EF6\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u5982 "src/views/apply/index.vue"'),project_path:z$1.string().optional().describe("\u9879\u76EE\u6839\u76EE\u5F55\uFF08\u53EF\u7701\u7565\uFF0C\u4F7F\u7528\u4E0A\u6B21\u7D22\u5F15\u7684\u9879\u76EE\uFF09"),debug:z$1.boolean().optional().default(false).describe("\u662F\u5426\u8F93\u51FA\u8C03\u8BD5\u5143\u4FE1\u606F")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({file_path:t,project_path:n,debug:r})=>{let i=performance.now(),{db:o}=e.getContext(n),{file:a,symbols:c,behaviors:l}=o.getFileOutline(t);if(!a){let S=Math.round((performance.now()-i)*100)/100,E=X({durationMs:S,resultCount:0,backend:"indexed"});return {content:[{type:"text",text:`\u274C \u6587\u4EF6\u672A\u7D22\u5F15: ${t}
488
488
 
489
489
  \u8BF7\u5148\u8FD0\u884C:
490
490
  skimmer_index_project({ project_path: "${n||"<\u9879\u76EE\u8DEF\u5F84>"}" })
491
491
 
492
492
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
493
- ${W(E)}`}]}}let p="",u=a.abs_path,{stale:d,reason:g}=Bt(i,u,t);d&&(p=`
494
- \u26A0\uFE0F [\u7D22\u5F15\u5DF2\u8FC7\u671F] ${g||""}\uFF0C\u884C\u53F7\u53EF\u80FD\u504F\u79FB\uFF08\u7D22\u5F15\u8BB0\u5F55 ${a.line_count} \u884C\uFF0C\u5B9E\u9645\u53EF\u80FD\u5DF2\u53D8\u5316\uFF09
493
+ ${W(E)}`}]}}let p="",u=a.abs_path,{stale:d,reason:h}=qt(o,u,t);d&&(p=`
494
+ \u26A0\uFE0F [\u7D22\u5F15\u5DF2\u8FC7\u671F] ${h||""}\uFF0C\u884C\u53F7\u53EF\u80FD\u504F\u79FB\uFF08\u7D22\u5F15\u8BB0\u5F55 ${a.line_count} \u884C\uFF0C\u5B9E\u9645\u53EF\u80FD\u5DF2\u53D8\u5316\uFF09
495
495
  \u7ACB\u5373\u91CD\u5EFA: skimmer_index_project({ force: true })
496
- `);let f=new Map;for(let T of l){let E=T.symbol_id;f.has(E)||f.set(E,[]);let L=`[${T.category}:${T.api_name}.${T.operation}${T.detail?`("${T.detail}")`:""}]`,_=f.get(E);_.includes(L)||_.push(L);}let m=[];m.push(`\u{1F4C4} ${t} (${a.line_count} \u884C, ${a.framework})`),m.push(`${"\u2501".repeat(50)}`),p&&m.push(p);let h={};for(let T of c){if(T.name==="<template>")continue;let E=T.category;h[E]||(h[E]=[]),h[E].push(T);}let b=[{key:"prop",icon:"\u{1F4E6}",label:"Props"},{key:"state",icon:"\u{1F4CA}",label:"Data / State"},{key:"computed",icon:"\u{1F504}",label:"Computed"},{key:"method",icon:"\u26A1",label:"Methods / Functions"},{key:"effect",icon:"\u{1F440}",label:"Watch / Effect"},{key:"lifecycle",icon:"\u{1F517}",label:"Lifecycle"},{key:"hook",icon:"\u{1FA9D}",label:"Hooks"},{key:"component",icon:"\u{1F9E9}",label:"Components"},{key:"mixin",icon:"\u{1F500}",label:"Mixins"},{key:"provide",icon:"\u{1F489}",label:"Provide / Inject"},{key:"emit",icon:"\u{1F4E1}",label:"Emits"},{key:"filter",icon:"\u{1F50D}",label:"Filters"},{key:"function",icon:"\u{1F527}",label:"Functions"},{key:"constant",icon:"\u{1F4CC}",label:"Constants"}];for(let{key:T,icon:E,label:L}of b){let _=h[T];if(_?.length){m.push(`
497
- ${E} ${L} (${_.length}):`);for(let N of _){let A=N.name,k=ke(N.start_line,N.end_line),$=je(N.params_json,[]),P=$.length>0?`(${$.join(", ")})`:"",B=N.default_value?` = ${N.default_value}`:"",re=N.is_async?"async ":"",ye=f.get(N.id),Ae=ye?.length?` ${ye.slice(0,3).join(" ")}`:"",J=N.state_setter_name?` \u2192 ${N.state_setter_name}`:"",le=N.hook_deps_json?` [deps:${je(N.hook_deps_json,[]).join(",")}]`:"";m.push(` \u2022 ${re}${A}${P}${B}${J}${le} ${k}${Ae}`);}}}m.push(`
498
- ${"\u2500".repeat(50)}`),m.push(`\u{1F4A1} \u67E5\u770B\u5177\u4F53\u4EE3\u7801: skimmer_get_code_slice({ file_path: "${t}", symbol_name: "\u65B9\u6CD5\u540D" })`);let S=Math.round((performance.now()-s)*100)/100,y=H({durationMs:S,resultCount:c.length,backend:"indexed"});return r&&(y.debug={scanned_files:1}),m.push(`
496
+ `);let f=new Map;for(let S of l){let E=S.symbol_id;f.has(E)||f.set(E,[]);let L=`[${S.category}:${S.api_name}.${S.operation}${S.detail?`("${S.detail}")`:""}]`,_=f.get(E);_.includes(L)||_.push(L);}let m=[];m.push(`\u{1F4C4} ${t} (${a.line_count} \u884C, ${a.framework})`),m.push(`${"\u2501".repeat(50)}`),p&&m.push(p);let y={};for(let S of c){if(S.name==="<template>")continue;let E=S.category;y[E]||(y[E]=[]),y[E].push(S);}let g=[{key:"prop",icon:"\u{1F4E6}",label:"Props"},{key:"state",icon:"\u{1F4CA}",label:"Data / State"},{key:"computed",icon:"\u{1F504}",label:"Computed"},{key:"method",icon:"\u26A1",label:"Methods / Functions"},{key:"effect",icon:"\u{1F440}",label:"Watch / Effect"},{key:"lifecycle",icon:"\u{1F517}",label:"Lifecycle"},{key:"hook",icon:"\u{1FA9D}",label:"Hooks"},{key:"component",icon:"\u{1F9E9}",label:"Components"},{key:"mixin",icon:"\u{1F500}",label:"Mixins"},{key:"provide",icon:"\u{1F489}",label:"Provide / Inject"},{key:"emit",icon:"\u{1F4E1}",label:"Emits"},{key:"filter",icon:"\u{1F50D}",label:"Filters"},{key:"function",icon:"\u{1F527}",label:"Functions"},{key:"constant",icon:"\u{1F4CC}",label:"Constants"}];for(let{key:S,icon:E,label:L}of g){let _=y[S];if(_?.length){m.push(`
497
+ ${E} ${L} (${_.length}):`);for(let x of _){let A=x.name,w=Se(x.start_line,x.end_line),P=He(x.params_json,[]),$=P.length>0?`(${P.join(", ")})`:"",H=x.default_value?` = ${x.default_value}`:"",oe=x.is_async?"async ":"",Ne=f.get(x.id),ve=Ne?.length?` ${Ne.slice(0,3).join(" ")}`:"",Q=x.state_setter_name?` \u2192 ${x.state_setter_name}`:"",Ye=x.hook_deps_json?` [deps:${He(x.hook_deps_json,[]).join(",")}]`:"";m.push(` \u2022 ${oe}${A}${$}${H}${Q}${Ye} ${w}${ve}`);}}}m.push(`
498
+ ${"\u2500".repeat(50)}`),m.push(`\u{1F4A1} \u67E5\u770B\u5177\u4F53\u4EE3\u7801: skimmer_get_code_slice({ file_path: "${t}", symbol_name: "\u65B9\u6CD5\u540D" })`);let N=Math.round((performance.now()-i)*100)/100,b=X({durationMs:N,resultCount:c.length,backend:"indexed"});return r&&(b.debug={scanned_files:1}),m.push(`
499
499
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
500
- ${W(y)}`),{content:[{type:"text",text:m.join(`
501
- `)}]}});}var Xe=class{constructor(e){this.db=e;}db;search(e,t){let{category:n,framework:r,filePath:s,limit:i=ln,fuzzy:a=true,allowFallbackScan:c=false,debug:l=false}=t||{},p=e.trim(),u=new Map,d={},g=performance.now(),f=this.db.exactSearch(p,n,r,s);for(let L of f)u.set(L.id,{symbol:L,filePath:L.file_path,score:100,matchReason:"\u7CBE\u786E\u5339\u914D"});if(d["1_exact"]=Math.round((performance.now()-g)*100)/100,u.size>=i)return {results:this.rankResults(u,i)};let m=performance.now(),h=0,b=w(p),S=[p,b,...b.split(" ")].filter(Boolean).filter((L,_,N)=>N.indexOf(L)===_);for(let L of S){if(L.length<2)continue;let _=this.db.ftsSearch(L,n,r,s,i);h+=_.length;for(let N of _){let A=N.id;if(u.has(A))continue;let k=this.calcFtsScore(p,N.name);u.set(A,{symbol:N,filePath:N.file_path,score:k,matchReason:`FTS5 \u524D\u7F00\u5339\u914D ("${L}")`});}}if(d["2_fts"]=Math.round((performance.now()-m)*100)/100,u.size>=i)return {results:this.rankResults(u,i),debug:l?{phase_timings:d,candidate_count:h}:void 0};let y=a&&p.length>=3,T=0;if(y){let L=performance.now(),_=this.db.getAllSymbolNames(s),N=p.toLowerCase(),A=w(p).split(" ");for(let{name:k,file_path:$,id:P}of _){if(u.has(P))continue;T++;let B=Ge(N,k.toLowerCase()),re=Math.max(N.length,k.length),ye=Math.min(pn,Math.max(1,Math.floor(re*.28)));if(B<=ye){let le=Math.max(0,80-B*15),X=this.db.getSymbolById(P);if(!X||n&&X.category!==n||r&&X.framework!==r)continue;let ie=tn(p,k,B);u.set(P,{symbol:X,filePath:$,score:le,matchReason:`\u6A21\u7CCA\u5339\u914D (\u7F16\u8F91\u8DDD\u79BB=${B})`,spellingSuggestion:ie});continue}let Ae=w(k).split(" "),J=A.filter(le=>Ae.some(X=>en(le,X)>=75));if(J.length>0&&J.length>=Math.ceil(A.length*.5)){let le=50+J.length*10,X=this.db.getSymbolById(P);if(!X||n&&X.category!==n||r&&X.framework!==r)continue;u.set(P,{symbol:X,filePath:$,score:le,matchReason:`\u5355\u8BCD\u5339\u914D (${J.join(", ")})`});}}d["3_fuzzy"]=Math.round((performance.now()-L)*100)/100;}if(u.size===0&&c){let L=performance.now(),_=this.db.ftsSearchWithFallback(p,n,r,s,i);for(let N of _){let A=N.id;u.has(A)||u.set(A,{symbol:N,filePath:N.file_path,score:50,matchReason:"LIKE \u5168\u8868\u626B\u63CF fallback"});}d["4_fallback"]=Math.round((performance.now()-L)*100)/100;}let E=l?{phase_timings:d,candidate_count:h+T,fallback_reason:!y&&p.length<3?"\u67E5\u8BE2\u8FC7\u77ED (<3\u5B57\u7B26)\uFF0C\u8DF3\u8FC7\u6A21\u7CCA\u5339\u914D":void 0}:void 0;return {results:this.rankResults(u,i),debug:E}}calcFtsScore(e,t){let n=e.toLowerCase(),r=t.toLowerCase();if(r===n)return 98;if(r.startsWith(n))return 91;if(r.includes(n))return 80;let s=w(e).split(" "),i=w(t).split(" "),a=s.some(l=>i[0]?.startsWith(l))?8:0,c=s.filter(l=>i.some(p=>p.startsWith(l))).length;return Math.min(88,58+c*8+a)}rankResults(e,t){return Array.from(e.values()).sort((n,r)=>r.score-n.score).slice(0,t)}searchByBehavior(e){return this.db.behaviorSearch(e.category,e.apiName,e.operation,e.keyword,e.filePath).map(n=>({symbolName:n.symbol_name,category:n.category,apiName:n.api_name,operation:n.operation,detail:n.detail,line:n.line_number,filePath:n.file_path,startLine:n.start_line,endLine:n.end_line}))}};var Un=createRequire(import.meta.url),Ee="\u9879\u76EE\u6839\u76EE\u5F55\uFF08\u53EF\u7701\u7565\uFF0C\u81EA\u52A8\u4F7F\u7528\u4E0A\u6B21 skimmer_index_project \u6307\u5B9A\u7684\u9879\u76EE\uFF09";function Ke(o){return o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async function Pn(o,e,t,n,r){if(!n)return null;let s=t.getPrecisePendingCount();if(s<=0)return null;let i=await o.getIndexer(e).selectivePrecise({maxFiles:r,maxTimeMs:1500});return {pendingBefore:s,reindexedFiles:i.reindexedFiles,affectedFiles:i.affectedFiles.length,skippedByBudget:i.skippedByBudget}}function On(o){if(!o)return [];let e=[`\u{1F504} \u5DF2\u81EA\u52A8\u8865\u7B97 pending precise: ${o.reindexedFiles}/${o.affectedFiles} \u6587\u4EF6\uFF08\u67E5\u8BE2\u524D\u5F85\u8865 ${o.pendingBefore}\uFF09`];return o.skippedByBudget>0&&e.push(` \u23F8\uFE0F \u4ECD\u6709 ${o.skippedByBudget} \u4E2A precise pending \u6587\u4EF6\u53D7\u9884\u7B97\u9650\u5236\u672A\u8865\u5B8C\uFF0C\u53EF\u518D\u6B21\u67E5\u8BE2\u6216\u8C03\u7528 selective_precise=true \u7EE7\u7EED`),e.push(""),e}function Ie(o,e,t){let n=[];for(let r of o){if(!r?.abs_path||!Q__default.existsSync(r.abs_path))continue;let s=Q__default.readFileSync(r.abs_path,"utf-8").split(`
502
- `);for(let i=0;i<s.length;i++){let a=s[i];for(let c of e)if(c.regex.test(a)){n.push({filePath:r.path,line:i+1,kind:c.kind,text:a.trim()});break}if(n.length>=t)return n}}return n}function Fn(o,e){let t=Ke(o),n="(?:=|\\+=|-=|\\*=|/=|%=|\\|=|&=|\\^=|&&=|\\|\\|=|\\?\\?=)",r=[{kind:"declaration",regex:new RegExp(`\\b(?:const|let|var)\\s+${t}\\b`)},{kind:"assignment",regex:new RegExp(`\\b${t}\\b\\s*${n}`)},{kind:"update",regex:new RegExp(`(?:\\+\\+|--)\\s*\\b${t}\\b|\\b${t}\\b\\s*(?:\\+\\+|--)`)}];return e&&r.push({kind:"property_assignment",regex:new RegExp(`\\b${t}\\.[A-Za-z_$][\\w$]*\\s*${n}`)},{kind:"indexed_assignment",regex:new RegExp(`\\b${t}\\s*\\[[^\\]]+\\]\\s*${n}`)}),r}function bt(o){try{return Un("@babel/parser").parse(o,{sourceType:"module",plugins:["typescript","jsx","decorators-legacy"],errorRecovery:!0})}catch{return null}}function Et(o,e){if(!o.endsWith(".vue"))return [{content:e,lineOffset:1}];try{let{parse:s}=Un("@vue/compiler-sfc"),{descriptor:i}=s(e),a=[];if(i.script?.content&&a.push({content:i.script.content,lineOffset:i.script.loc.start.line}),i.scriptSetup?.content&&a.push({content:i.scriptSetup.content,lineOffset:i.scriptSetup.loc.start.line}),a.length>0)return a}catch{}let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!t||!t[1])return [];let r=e.slice(0,t.index||0).split(`
503
- `).length;return [{content:t[1],lineOffset:r}]}function _e(o,e){return (o.loc?.start?.line??1)+e-1}function Vt(o,e){if(o.type!=="MemberExpression")return false;let t=o.object;return !t||t.type!=="ThisExpression"?false:q(o)===e}function Ht(o,e){return !!o&&o.type==="Identifier"&&String(o.name||"")===e}function Wn(o){let e=new Set;return o.filter(t=>{let n=`${t.filePath}:${t.line}:${t.kind}:${t.text}`;return e.has(n)?false:(e.add(n),true)})}function Xt(o,e,t=2){if(!Q__default.existsSync(o))return {snippet:"",startLine:e};let n=Q__default.readFileSync(o,"utf-8").split(`
504
- `),r=Math.max(0,e-1-t),s=Math.min(n.length-1,e-1+t);return {snippet:n.slice(r,s+1).map((a,c)=>{let l=r+c+1;return ` ${l===e?"\u25B6":" "} ${String(l).padStart(4)} \u2502 ${a}`}).join(`
505
- `),startLine:r+1}}function gt(o,e=false){let n=Math.max(50,({declaration:95,assignment:85,update:80,property_assignment:75,indexed_assignment:75,dot:75,bracket:75,delete:70,direct_storage:90,alias_ref:70,regex_fallback:60}[o]??65)-(e?5:0)),r=n>=90?"\u25CF\u25CF\u25CF\u25CF\u25CF":n>=80?"\u25CF\u25CF\u25CF\u25CF\u25CB":n>=70?"\u25CF\u25CF\u25CF\u25CB\u25CB":n>=60?"\u25CF\u25CF\u25CB\u25CB\u25CB":"\u25CF\u25CB\u25CB\u25CB\u25CB";return `[\u7F6E\u4FE1\u5EA6 ${n}% ${r}]`}var Dn={init:"\u{1F331} \u521D\u59CB\u5316\u6765\u6E90",cache:"\u{1F4BE} \u7F13\u5B58\u56DE\u663E",user:"\u{1F5B1}\uFE0F \u7528\u6237\u4EA4\u4E92",unknown:"\u2753 \u672A\u77E5\u6765\u6E90"};function Mn(o,e,t){let n=[];for(let r of o){if(!r.abs_path||!Q__default.existsSync(r.abs_path))continue;let s=Q__default.readFileSync(r.abs_path,"utf-8"),i=s.split(`
506
- `),a=Et(r.path||Y__default.basename(r.abs_path),s);for(let c of a){let l=bt(c.content);l&&me(l,p=>{if(n.length>=t||p.type!=="VariableDeclarator")return;let u=p.id;if(!u||u.type!=="Identifier")return;let d=String(u.name||"");if(!d||d===e)return;let g=p.init;if(!g)return;let f=false;if(g.type==="Identifier"&&String(g.name||"")===e?f=true:g.type==="MemberExpression"&&(f=Vt(g,e)||q(g)===e),!f)return;let m=_e(p,c.lineOffset),h=i[m-1]?.trim()||"";n.push({alias:d,filePath:r.path,abs_path:r.abs_path,line:m,text:h});});}}return n}function jn(o,e,t){let n=[];for(let r of o){if(!r.abs_path||!Q__default.existsSync(r.abs_path))continue;let s=Q__default.readFileSync(r.abs_path,"utf-8"),i=s.split(`
507
- `),a=Et(r.path||Y__default.basename(r.abs_path),s);for(let c of a){let l=bt(c.content);l&&me(l,p=>{if(n.length>=t||p.type!=="VariableDeclarator")return;let u=p.id;if(!u||u.type!=="ObjectPattern")return;let d=u.properties||[];for(let g of d){if(g.type!=="ObjectProperty"&&g.type!=="Property")continue;let f=g.key,m=g.value,h=f?.type==="Identifier"?String(f.name||""):null;if(h!==e)continue;let b=m?.type==="Identifier"?String(m.name||""):h;if(!b)continue;let S=_e(p,c.lineOffset),y=i[S-1]?.trim()||"";n.push({alias:b,filePath:r.path,line:S,text:y});}});}}return n}function Kt(o,e,t,n){let r=[];for(let s of o){if(!s.abs_path||!Q__default.existsSync(s.abs_path))continue;let i=Q__default.readFileSync(s.abs_path,"utf-8"),a=i.split(`
508
- `),c=Et(s.path||Y__default.basename(s.abs_path),i);for(let l of c){let p=bt(l.content);if(p&&(me(p,u=>{if(!(r.length>=n)){if(u.type==="VariableDeclarator"){let d=u.id;if(Ht(d,e)){let g=_e(u,l.lineOffset);r.push({filePath:s.path,line:g,kind:"declaration",text:a[g-1]?.trim()||""});}}if(u.type==="AssignmentExpression"){let d=u.left;if(!d)return;let g=_e(u,l.lineOffset);if(Ht(d,e)||Vt(d,e)){r.push({filePath:s.path,line:g,kind:"assignment",text:a[g-1]?.trim()||""});return}t&&d.type==="MemberExpression"&&te(d)===e&&r.push({filePath:s.path,line:g,kind:d.computed?"indexed_assignment":"property_assignment",text:a[g-1]?.trim()||""});}if(u.type==="UpdateExpression"){let d=u.argument;if(!d)return;if(Ht(d,e)||Vt(d,e)){let g=_e(u,l.lineOffset);r.push({filePath:s.path,line:g,kind:"update",text:a[g-1]?.trim()||""});}}}}),r.length>=n))break}if(r.length>=n)break}return Wn(r).slice(0,n)}function ht(o,e,t,n){let r=[];for(let s of o){if(!s.abs_path||!Q__default.existsSync(s.abs_path))continue;let i=Q__default.readFileSync(s.abs_path,"utf-8"),a=i.split(`
509
- `),c=Et(s.path||Y__default.basename(s.abs_path),i);for(let l of c){let p=bt(l.content);if(p&&(me(p,u=>{if(!(r.length>=n)){if(u.type==="AssignmentExpression"){let d=u.left;if(!d||d.type!=="MemberExpression"||te(d)!==e)return;let f=q(d);if(t&&f!==t)return;let m=_e(u,l.lineOffset);r.push({filePath:s.path,line:m,kind:d.computed?"bracket":"dot",text:a[m-1]?.trim()||""});}if(u.type==="UpdateExpression"){let d=u.argument;if(!d||d.type!=="MemberExpression"||te(d)!==e)return;let f=q(d);if(t&&f!==t)return;let m=_e(u,l.lineOffset);r.push({filePath:s.path,line:m,kind:d.computed?"bracket":"dot",text:a[m-1]?.trim()||""});}if(u.type==="UnaryExpression"&&u.operator==="delete"){let d=u.argument;if(!d||d.type!=="MemberExpression"||te(d)!==e)return;let f=q(d);if(t&&f!==t)return;let m=_e(u,l.lineOffset);r.push({filePath:s.path,line:m,kind:"delete",text:a[m-1]?.trim()||""});}}}),r.length>=n))break}if(r.length>=n)break}return Wn(r).slice(0,n)}function Bn(o,e){o.registerTool("skimmer_find_symbol",{title:"\u667A\u80FD\u7B26\u53F7\u641C\u7D22\uFF08\u652F\u6301\u62FC\u5199\u9519\u8BEF\uFF09",description:`\u4E09\u5C42\u641C\u7D22\uFF1A\u7CBE\u786E\u5339\u914D \u2192 FTS5\u5168\u6587 \u2192 Levenshtein\u6A21\u7CCA\u3002
500
+ ${W(b)}`),{content:[{type:"text",text:m.join(`
501
+ `)}]}});}var U={symbolWordHitBoost:8,compactSpanBoost:4,fileCoherence:{maxBoost:40,perExtraHit:24},noisePenalty:{testFile:-40,exampleFile:-18,declarationFile:-25},fileRoleBoost:{businessByIntent:{symbol_like:0,behavior_like:14,api_like:24,natural_language:12},componentByIntent:{symbol_like:0,behavior_like:6,api_like:8,natural_language:4},utilityByIntent:{symbol_like:0,behavior_like:-10,api_like:-22,natural_language:-6}},behaviorMatchBoost:{category:20,apiByIntent:{symbol_like:20,behavior_like:22,api_like:26,natural_language:20},operationByIntent:{symbol_like:25,behavior_like:25,api_like:30,natural_language:25},keyword:10},behaviorKeywordMatchBoost:{detail:18,api:10,operation:8,category:12,apiByIntent:{symbol_like:12,behavior_like:12,api_like:18,natural_language:12},operationByIntent:{symbol_like:15,behavior_like:15,api_like:20,natural_language:15}},byIntent:{symbol_like:{symbolCandidateAdjust:12,behaviorCandidateBase:110,behaviorKeywordCandidateBase:86,executableDefinitionBoost:10,behaviorDefinitionBoost:5,allowFileCoherence:false},behavior_like:{symbolCandidateAdjust:-2,behaviorCandidateBase:115,behaviorKeywordCandidateBase:92,executableDefinitionBoost:14,behaviorDefinitionBoost:7,allowFileCoherence:true},api_like:{symbolCandidateAdjust:-18,behaviorCandidateBase:124,behaviorKeywordCandidateBase:102,executableDefinitionBoost:14,behaviorDefinitionBoost:10,allowFileCoherence:true},natural_language:{symbolCandidateAdjust:-10,behaviorCandidateBase:112,behaviorKeywordCandidateBase:92,executableDefinitionBoost:16,behaviorDefinitionBoost:8,allowFileCoherence:true}}};var As=new Set(["function","method","hook","effect","lifecycle"]);function Wn(s,e,t){let n=Array.from(s,a=>({...a}));if(n.length===0)return [];let r=new Map;for(let a of n)r.set(a.filePath,(r.get(a.filePath)||0)+1);for(let a of n){let c=[],l=Ls(a,e);l>0&&(a.score+=l,c.push(`definition boost(${l})`));let p=Rs(a,r,e);p>0&&(a.score+=p,c.push(`file coherence(${r.get(a.filePath)||1})`));let u=ws(a.filePath);u!==0&&(a.score+=u,c.push(`noise penalty(${u})`));let d=vs(a.filePath,e);d!==0&&(a.score+=d,c.push(`file role(${d})`)),c.length>0&&(a.matchReason=`${a.matchReason} + ${c.join(" + ")}`);}let i=n.sort((a,c)=>c.score-a.score||a.filePath.localeCompare(c.filePath)).slice(0,t),o=$s(i);return i.map((a,c)=>({...a,displayScore:o[c]??0}))}function Ls(s,e){let t=U.byIntent[e],n=0;As.has(s.category||"")&&(n+=t.executableDefinitionBoost),(s.behaviors?.length||0)>0&&(n+=t.behaviorDefinitionBoost);let r=Math.max(1,s.endLine-s.startLine+1);return n>0&&r<=30&&(n+=U.compactSpanBoost),n}function Rs(s,e,t){if(!U.byIntent[t].allowFileCoherence)return 0;let n=e.get(s.filePath)||0;return n<=1?0:Math.min(U.fileCoherence.maxBoost,(n-1)*U.fileCoherence.perExtraHit)}function ws(s){let e=s.toLowerCase();return e.includes("__tests__")||e.includes("/tests/")||e.endsWith(".test.ts")||e.endsWith(".spec.ts")?U.noisePenalty.testFile:/(mock|fixture|demo|example|sample)/.test(e)?U.noisePenalty.exampleFile:e.endsWith(".d.ts")?U.noisePenalty.declarationFile:0}function vs(s,e){let t=s.toLowerCase();return Is(t)?U.fileRoleBoost.utilityByIntent[e]:ks(t)?U.fileRoleBoost.businessByIntent[e]:Cs(t)?U.fileRoleBoost.componentByIntent[e]:0}function ks(s){return /(^|\/)(views|pages|screens|features|modules)\//.test(s)}function Cs(s){return /(^|\/)components\//.test(s)}function Is(s){return /(^|\/)(config|utils|helpers|lib|shared)\//.test(s)||/(utils?|helpers?|storage|cache|fetch)\.(js|ts|vue|tsx|jsx)$/.test(s)}function $s(s){if(s.length===0)return [];if(s.length===1)return [100];let e=s.map(r=>r.score),t=Math.max(...e),n=Math.min(...e);return t===n?s.map((r,i)=>Math.max(0,100-i*5)):e.map(r=>{let i=55+(r-n)/(t-n)*45;return Math.max(0,Math.min(100,Math.round(i)))})}var Hn=new Set(["a","an","and","are","as","at","be","by","for","from","how","in","into","is","of","on","or","the","to","with","where","what","which"]);function Tt(s){let e=s.trim();if(!e)return "natural_language";let t=Qt(e);return Ps(e,t)?"api_like":/[A-Z]/.test(e)||/[_./:#()[\]{}]/.test(e)||/^[a-zA-Z][a-zA-Z0-9]+$/.test(e)?"symbol_like":t?"behavior_like":"natural_language"}function Jt(s){return s.toLowerCase().replace(/[^a-z0-9_\u4e00-\u9fa5\s]/gi," ").split(/\s+/).filter(Boolean).filter(t=>!Hn.has(t)).join(" ")||s}function Xn(s){return s.toLowerCase().replace(/[^a-z0-9_\u4e00-\u9fa5\s-]/gi," ").split(/[\s-]+/).filter(Boolean).filter(e=>e.length>=3).filter(e=>!Hn.has(e))}function Qt(s){let e=s.toLowerCase(),t=zn(s),n=ie(t,["cache","storage","localstorage","sessionstorage","draft","\u8349\u7A3F","\u7F13\u5B58"]),r=ie(t,["fetch","axios","request","api","network","http"]),i=ie(t,["route","router","navigate","jump","push","replace","\u8DEF\u7531","\u8DF3\u8F6C"]);return n?{category:"storage",apiName:e.includes("sessionstorage")?"sessionStorage":e.includes("localstorage")?"localStorage":void 0,operation:Fs(t)}:r?{category:"network",apiName:e.includes("axios")?"axios":e.includes("fetch")?"fetch":void 0,operation:Os(t)}:i?{category:"router",operation:/(push|replace|jump|navigate|跳转)/.test(e)?"push":void 0}:null}function Kn(s,e,t){if(!t)return false;if(s==="api_like"||s==="behavior_like"||s==="natural_language")return true;let n=zn(e);return ie(n,["localstorage","sessionstorage","axios","fetch","router","navigate"])}function Ps(s,e){let t=s.toLowerCase(),n=/\b[a-z_$][\w$]*\s*\.\s*[a-z_$][\w$]*/i.test(s),r=/(localstorage|sessionstorage|axios|fetch|\$router|router|navigate|history)/.test(t),i=/(setitem|getitem|removeitem|clear|push|replace|get|post|put|delete|patch|navigate|dispatch|commit)/.test(t);return !!(r&&(i||n)||n&&e?.category||e?.apiName&&e?.operation)}function Fs(s){if(Yt(s,["get","item"]))return "getItem";if(Yt(s,["set","item"]))return "setItem";if(Yt(s,["remove","item"]))return "removeItem";if(ie(s,["read","load","restore","getitem","\u8BFB\u53D6","\u6062\u590D"]))return "getItem";if(ie(s,["remove","delete","clear","\u6E05\u9664","\u5220\u9664","removeitem"]))return "removeItem";if(ie(s,["save","write","persist","store","setitem","\u7F13\u5B58","\u5199\u5165"]))return "setItem"}function Os(s){if(ie(s,["post","create","submit"]))return "post";if(ie(s,["put","update"]))return "put";if(ie(s,["delete","remove"]))return "delete";if(ie(s,["patch"]))return "patch";if(ie(s,["get","fetch","load","request"]))return "get"}function zn(s){return v(s).toLowerCase().replace(/[^a-z0-9_\u4e00-\u9fa5\s-]/gi," ").split(/[\s-]+/).filter(Boolean)}function ie(s,e){return e.some(t=>s.includes(t))}function Yt(s,e){for(let t=0;t<=s.length-e.length;t+=1)if(e.every((n,r)=>s[t+r]===n))return true;return false}var Fe=class{constructor(e){this.db=e;}search(e,t){let{category:n,framework:r,filePath:i,limit:o=yn,fuzzy:a=true,allowFallbackScan:c=false,debug:l=false}=t||{},p=e.trim(),u=new Map,d={},h=performance.now(),f=this.db.exactSearch(p,n,r,i);for(let L of f)u.set(L.id,{symbol:L,filePath:L.file_path,score:100,matchReason:"\u7CBE\u786E\u5339\u914D"});if(d["1_exact"]=Math.round((performance.now()-h)*100)/100,u.size>=o)return {results:this.rankResults(u,o)};let m=performance.now(),y=0,g=v(p),N=[p,g,...g.split(" ")].filter(Boolean).filter((L,_,x)=>x.indexOf(L)===_);for(let L of N){if(L.length<2)continue;let _=this.db.ftsSearch(L,n,r,i,o);y+=_.length;for(let x of _){let A=x.id;if(u.has(A))continue;let w=this.calcFtsScore(p,x.name);u.set(A,{symbol:x,filePath:x.file_path,score:w,matchReason:`FTS5 \u524D\u7F00\u5339\u914D ("${L}")`});}}if(d["2_fts"]=Math.round((performance.now()-m)*100)/100,u.size>=o)return {results:this.rankResults(u,o),debug:l?{phase_timings:d,candidate_count:y}:void 0};let b=a&&p.length>=3,S=0;if(b){let L=performance.now(),_=this.db.getAllSymbolNames(i),x=p.toLowerCase(),A=v(p).split(" ");for(let{name:w,file_path:P,id:$}of _){if(u.has($))continue;S++;let H=et(x,w.toLowerCase()),oe=Math.max(x.length,w.length),Ne=Math.min(bn,Math.max(1,Math.floor(oe*.28)));if(H<=Ne){let Z=Math.max(0,80-H*15),J=this.db.getSymbolById($);if(!J||n&&J.category!==n||r&&J.framework!==r)continue;let Je=pn(p,w,H);u.set($,{symbol:J,filePath:P,score:Z,matchReason:`\u6A21\u7CCA\u5339\u914D (\u7F16\u8F91\u8DDD\u79BB=${H})`,spellingSuggestion:Je});continue}let ve=v(w).split(" "),Q=A.filter(Z=>ve.some(J=>J.length>=3&&ln(Z,J)>=75));if(A.length>1?Q.length===A.length:Q.length>0){let Z=50+Q.length*10,J=this.db.getSymbolById($);if(!J||n&&J.category!==n||r&&J.framework!==r)continue;u.set($,{symbol:J,filePath:P,score:Z,matchReason:`\u5355\u8BCD\u5339\u914D (${Q.join(", ")})`});}}d["3_fuzzy"]=Math.round((performance.now()-L)*100)/100;}if(u.size===0&&c){let L=performance.now(),_=this.db.ftsSearchWithFallback(p,n,r,i,o);for(let x of _){let A=x.id;u.has(A)||u.set(A,{symbol:x,filePath:x.file_path,score:50,matchReason:"LIKE \u5168\u8868\u626B\u63CF fallback"});}d["4_fallback"]=Math.round((performance.now()-L)*100)/100;}let E=l?{phase_timings:d,candidate_count:y+S,fallback_reason:!b&&p.length<3?"\u67E5\u8BE2\u8FC7\u77ED (<3\u5B57\u7B26)\uFF0C\u8DF3\u8FC7\u6A21\u7CCA\u5339\u914D":void 0}:void 0;return {results:this.rankResults(u,o),debug:E}}calcFtsScore(e,t){let n=e.toLowerCase(),r=t.toLowerCase();if(r===n)return 98;if(r.startsWith(n))return 91;if(r.includes(n))return 80;let i=v(e).split(" "),o=v(t).split(" "),a=i.some(l=>o[0]?.startsWith(l))?8:0,c=i.filter(l=>o.some(p=>p.startsWith(l))).length;return Math.min(88,58+c*8+a)}rankResults(e,t){return Array.from(e.values()).sort((n,r)=>r.score-n.score).slice(0,t)}searchByBehavior(e){return this.db.behaviorSearch(e.category,e.apiName,e.operation,e.keyword,e.filePath).map(n=>({symbolId:n.symbol_id,symbolName:n.symbol_name,category:n.category,apiName:n.api_name,operation:n.operation,detail:n.detail,line:n.line_number,filePath:n.file_path,startLine:n.start_line,endLine:n.end_line}))}searchSnippets(e,t){let n=e.trim();if(!n)return [];let{filePath:r,limit:i=8,contextLines:o=1,maxLines:a=24}=t||{},c=Tt(n),l=new Map,p=Xn(n),u=Jt(n),d=this.search(u,{filePath:r,limit:Math.max(i*2,8),fuzzy:c!=="natural_language",allowFallbackScan:false}).results;for(let g of d){let N=g.symbol,b=this.buildSnippetCandidateFromSymbol({symbol:N,filePath:g.filePath,baseScore:this.scoreSymbolCandidate(c,n,g),matchReason:this.describeSymbolReason(c,g.matchReason)});b&&this.mergeSnippetCandidate(l,b);}let h=Qt(n),m=Kn(c,n,h)?h:null;if(m){let g=this.searchByBehavior({category:m.category,apiName:m.apiName,operation:m.operation,keyword:m.keyword,filePath:r});for(let N of g){let b=N.symbolId;if(typeof b!="number")continue;let S=this.db.getSymbolById(b);if(!S)continue;let E=this.buildSnippetCandidateFromSymbol({symbol:S,filePath:N.filePath,baseScore:this.scoreBehaviorCandidate(m,c,N),matchReason:this.describeBehaviorReason(m,N)});E&&this.mergeSnippetCandidate(l,E);}}if(p.length>0)for(let g of p.slice(0,3)){let N=this.searchByBehavior({category:m?.category,apiName:m?.apiName,operation:m?.operation,keyword:g,filePath:r});for(let b of N){let S=b.symbolId;if(typeof S!="number")continue;let E=this.db.getSymbolById(S);if(!E)continue;let L=this.buildSnippetCandidateFromSymbol({symbol:E,filePath:b.filePath,baseScore:this.scoreBehaviorKeywordCandidate(g,m,c,b),matchReason:`behavior keyword "${g}" \u547D\u4E2D \u2192 ${b.apiName}.${b.operation}`});L&&this.mergeSnippetCandidate(l,L);}}return Wn(l.values(),c,i).map(g=>this.toSnippetResult(g,o,a,g.displayScore)).filter(g=>!!g)}scoreSymbolCandidate(e,t,n){let r=U.byIntent[e],i=n.score+r.symbolCandidateAdjust,o=n.symbol,a=String(o.name||""),c=String(o.signature||""),l=String(o.jsdoc||""),u=Jt(t).toLowerCase().split(/\s+/).filter(Boolean),d=`${a} ${c} ${l}`.toLowerCase();if(u.length>0){let h=u.filter(f=>d.includes(f)).length;i+=h*U.symbolWordHitBoost;}return i}scoreBehaviorCandidate(e,t,n){let i=U.byIntent[t].behaviorCandidateBase;return e.category&&n.category===e.category&&(i+=U.behaviorMatchBoost.category),e.apiName&&n.apiName.toLowerCase()===e.apiName.toLowerCase()&&(i+=U.behaviorMatchBoost.apiByIntent[t]),e.operation&&n.operation.toLowerCase()===e.operation.toLowerCase()&&(i+=U.behaviorMatchBoost.operationByIntent[t]),e.keyword&&(n.detail||"").toLowerCase().includes(e.keyword.toLowerCase())&&(i+=U.behaviorMatchBoost.keyword),i}scoreBehaviorKeywordCandidate(e,t,n,r){let o=U.byIntent[n].behaviorKeywordCandidateBase;return (r.detail||"").toLowerCase().includes(e.toLowerCase())&&(o+=U.behaviorKeywordMatchBoost.detail),r.apiName.toLowerCase().includes(e.toLowerCase())&&(o+=U.behaviorKeywordMatchBoost.api),r.operation.toLowerCase().includes(e.toLowerCase())&&(o+=U.behaviorKeywordMatchBoost.operation),t?.category&&r.category===t.category&&(o+=U.behaviorKeywordMatchBoost.category),t?.apiName&&r.apiName.toLowerCase()===t.apiName.toLowerCase()&&(o+=U.behaviorKeywordMatchBoost.apiByIntent[n]),t?.operation&&r.operation.toLowerCase()===t.operation.toLowerCase()&&(o+=U.behaviorKeywordMatchBoost.operationByIntent[n]),o}describeSymbolReason(e,t){return e==="symbol_like"?`symbol \u547D\u4E2D: ${t}`:e==="api_like"?`API \u67E5\u8BE2\u8865\u5145\u547D\u4E2D: ${t}`:e==="natural_language"?`\u81EA\u7136\u8BED\u8A00\u8865\u5145\u547D\u4E2D: ${t}`:`\u6DF7\u5408\u547D\u4E2D: ${t}`}describeBehaviorReason(e,t){return `behavior \u547D\u4E2D (${[e.category?`category=${e.category}`:null,e.apiName?`api=${e.apiName}`:null,e.operation?`operation=${e.operation}`:null].filter(Boolean).join(", ")||"\u5173\u952E\u8BCD"}) \u2192 ${t.apiName}.${t.operation}`}buildSnippetCandidateFromSymbol(e){let t=e.symbol,n=String(t.abs_path||""),r=e.filePath||String(t.file_path||""),i=Number(t.start_line||0),o=Number(t.end_line||0),a=Number(t.id||0),c=String(t.name||"");if(!n||!r||!i||!o||!c)return null;let l=this.getBehaviorLabels(r,a);return {key:`${r}:${i}:${o}:${c}`,symbolName:c,category:String(t.category||""),framework:String(t.framework||""),filePath:r,absPath:n,startLine:i,endLine:o,score:e.baseScore,matchReason:e.matchReason,behaviors:l}}mergeSnippetCandidate(e,t){let n=e.get(t.key);if(!n){e.set(t.key,t);return}n.score=Math.max(n.score,t.score),n.matchReason.includes(t.matchReason)||(n.matchReason=`${n.matchReason} + ${t.matchReason}`),n.behaviors=[...new Set([...n.behaviors||[],...t.behaviors||[]])];}toSnippetResult(e,t,n,r){if(!ne__default.existsSync(e.absPath))return null;let o=ne__default.readFileSync(e.absPath,"utf-8").split(`
502
+ `),a=Math.max(0,e.startLine-1-t),c=Math.min(o.length-1,e.endLine-1+t),l=Math.min(c,a+Math.max(1,n)-1),p=o.slice(a,l+1).join(`
503
+ `),d=p.includes(e.symbolName)?void 0:`\u26A0\uFE0F [\u884C\u53F7\u504F\u79FB] \u7D22\u5F15\u8BB0\u5F55 ${e.symbolName} \u5728 ${e.filePath}:L${e.startLine}-L${e.endLine}\uFF0C\u4F46\u5F53\u524D\u4F4D\u7F6E\u7247\u6BB5\u672A\u51FA\u73B0\u8BE5\u7B26\u53F7\uFF1B\u6587\u4EF6\u53EF\u80FD\u5DF2\u4FEE\u6539\u4F46\u672A\u91CD\u65B0\u7D22\u5F15\u3002\u5EFA\u8BAE: skimmer_index_project({ force: true })`;return {symbolName:e.symbolName,category:e.category,framework:e.framework,filePath:e.filePath,startLine:a+1,endLine:l+1,snippet:p,score:r,matchReason:e.matchReason,behaviors:e.behaviors,offsetWarning:d}}getBehaviorLabels(e,t){return this.db.getFileOutline(e).behaviors.filter(r=>r.symbol_id===t).map(r=>`[${r.category}:${r.api_name}.${r.operation}${r.detail?`("${r.detail}")`:""}]`)}};var er=createRequire(import.meta.url),ye="\u9879\u76EE\u6839\u76EE\u5F55\uFF08\u53EF\u7701\u7565\uFF0C\u81EA\u52A8\u4F7F\u7528\u4E0A\u6B21 skimmer_index_project \u6307\u5B9A\u7684\u9879\u76EE\uFF09";function be(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var qe="(?:=|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^=|&&=|\\|\\|=|\\?\\?=)",tr="(?:push|pop|shift|unshift|splice|sort|reverse|copyWithin|fill)";async function Gn(s,e,t,n,r){if(!n)return null;let i=t.getPrecisePendingCount();if(i<=0)return null;let o=await s.getIndexer(e).selectivePrecise({maxFiles:r,maxTimeMs:1500});return {pendingBefore:i,reindexedFiles:o.reindexedFiles,affectedFiles:o.affectedFiles.length,skippedByBudget:o.skippedByBudget}}function qn(s){if(!s)return [];let e=[`\u{1F504} \u5DF2\u81EA\u52A8\u8865\u7B97 pending precise: ${s.reindexedFiles}/${s.affectedFiles} \u6587\u4EF6\uFF08\u67E5\u8BE2\u524D\u5F85\u8865 ${s.pendingBefore}\uFF09`];return s.skippedByBudget>0&&e.push(` \u23F8\uFE0F \u4ECD\u6709 ${s.skippedByBudget} \u4E2A precise pending \u6587\u4EF6\u53D7\u9884\u7B97\u9650\u5236\u672A\u8865\u5B8C\uFF0C\u53EF\u518D\u6B21\u67E5\u8BE2\u6216\u8C03\u7528 selective_precise=true \u7EE7\u7EED`),e.push(""),e}function Oe(s,e,t){let n=[];for(let r of s){if(!r?.abs_path||!ne__default.existsSync(r.abs_path))continue;let i=ne__default.readFileSync(r.abs_path,"utf-8").split(`
504
+ `);for(let o=0;o<i.length;o++){let a=i[o];for(let c of e)if(c.regex.test(a)){n.push({filePath:r.path,line:o+1,kind:c.kind,text:a.trim()});break}if(n.length>=t)return n}}return n}function Yn(s,e){let t=be(s),n=[{kind:"declaration",regex:new RegExp(`\\b(?:const|let|var)\\s+${t}\\b`)},{kind:"assignment",regex:new RegExp(`\\b${t}\\b\\s*${qe}`)},{kind:"update",regex:new RegExp(`(?:\\+\\+|--)\\s*\\b${t}\\b|\\b${t}\\b\\s*(?:\\+\\+|--)`)}];return e&&n.push({kind:"property_assignment",regex:new RegExp(`\\b${t}\\.[A-Za-z_$][\\w$]*\\s*${qe}`)},{kind:"indexed_assignment",regex:new RegExp(`\\b${t}\\s*\\[[^\\]]+\\]\\s*${qe}`)},{kind:"array_mutation",regex:new RegExp(`\\b${t}\\.${tr}\\s*\\(`)}),n}function wt(s){try{return er("@babel/parser").parse(s,{sourceType:"module",plugins:["typescript","jsx","decorators-legacy"],errorRecovery:!0})}catch{return null}}function vt(s,e){if(!s.endsWith(".vue"))return [{content:e,lineOffset:1}];try{let{parse:i}=er("@vue/compiler-sfc"),{descriptor:o}=i(e),a=[];if(o.script?.content&&a.push({content:o.script.content,lineOffset:o.script.loc.start.line}),o.scriptSetup?.content&&a.push({content:o.scriptSetup.content,lineOffset:o.scriptSetup.loc.start.line}),a.length>0)return a}catch{}let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!t||!t[1])return [];let r=e.slice(0,t.index||0).split(`
505
+ `).length;return [{content:t[1],lineOffset:r}]}function Ee(s,e){return (s.loc?.start?.line??1)+e-1}function nn(s,e){if(s.type!=="MemberExpression")return false;let t=s.object;return !t||t.type!=="ThisExpression"?false:K(s)===e}function Zt(s,e){return !!s&&s.type==="Identifier"&&String(s.name||"")===e}function nr(s){let e=new Set;return s.filter(t=>{let n=`${t.filePath}:${t.line}:${t.kind}:${t.text}`;return e.has(n)?false:(e.add(n),true)})}function en(s,e,t=2){if(!ne__default.existsSync(s))return {snippet:"",startLine:e};let n=ne__default.readFileSync(s,"utf-8").split(`
506
+ `),r=Math.max(0,e-1-t),i=Math.min(n.length-1,e-1+t);return {snippet:n.slice(r,i+1).map((a,c)=>{let l=r+c+1;return ` ${l===e?"\u25B6":" "} ${String(l).padStart(4)} \u2502 ${a}`}).join(`
507
+ `),startLine:r+1}}function At(s,e=false){let n=Math.max(50,({declaration:95,assignment:85,update:80,property_assignment:75,indexed_assignment:75,dot:75,bracket:75,delete:70,direct_storage:90,alias_ref:70,regex_fallback:60}[s]??65)-(e?5:0)),r=n>=90?"\u25CF\u25CF\u25CF\u25CF\u25CF":n>=80?"\u25CF\u25CF\u25CF\u25CF\u25CB":n>=70?"\u25CF\u25CF\u25CF\u25CB\u25CB":n>=60?"\u25CF\u25CF\u25CB\u25CB\u25CB":"\u25CF\u25CB\u25CB\u25CB\u25CB";return `[\u7F6E\u4FE1\u5EA6 ${n}% ${r}]`}var Jn={init:"\u{1F331} \u521D\u59CB\u5316\u6765\u6E90",cache:"\u{1F4BE} \u7F13\u5B58\u56DE\u663E",user:"\u{1F5B1}\uFE0F \u7528\u6237\u4EA4\u4E92",unknown:"\u2753 \u672A\u77E5\u6765\u6E90"};function Qn(s,e,t){let n=[];for(let r of s){if(!r.abs_path||!ne__default.existsSync(r.abs_path))continue;let i=ne__default.readFileSync(r.abs_path,"utf-8"),o=i.split(`
508
+ `),a=vt(r.path||Y__default.basename(r.abs_path),i);for(let c of a){let l=wt(c.content);l&&ge(l,p=>{if(n.length>=t||p.type!=="VariableDeclarator")return;let u=p.id;if(!u||u.type!=="Identifier")return;let d=String(u.name||"");if(!d||d===e)return;let h=p.init;if(!h)return;let f=false;if(h.type==="Identifier"&&String(h.name||"")===e?f=true:h.type==="MemberExpression"&&(f=nn(h,e)||K(h)===e),!f)return;let m=Ee(p,c.lineOffset),y=o[m-1]?.trim()||"";n.push({alias:d,filePath:r.path,abs_path:r.abs_path,line:m,text:y});});}}return n}function Zn(s,e,t){let n=[];for(let r of s){if(!r.abs_path||!ne__default.existsSync(r.abs_path))continue;let i=ne__default.readFileSync(r.abs_path,"utf-8"),o=i.split(`
509
+ `),a=vt(r.path||Y__default.basename(r.abs_path),i);for(let c of a){let l=wt(c.content);l&&ge(l,p=>{if(n.length>=t||p.type!=="VariableDeclarator")return;let u=p.id;if(!u||u.type!=="ObjectPattern")return;let d=u.properties||[];for(let h of d){if(h.type!=="ObjectProperty"&&h.type!=="Property")continue;let f=h.key,m=h.value,y=f?.type==="Identifier"?String(f.name||""):null;if(y!==e)continue;let g=m?.type==="Identifier"?String(m.name||""):y;if(!g)continue;let N=Ee(p,c.lineOffset),b=o[N-1]?.trim()||"";n.push({alias:g,filePath:r.path,line:N,text:b});}});}}return n}function tn(s,e,t,n){let r=[];for(let i of s){if(!i.abs_path||!ne__default.existsSync(i.abs_path))continue;let o=ne__default.readFileSync(i.abs_path,"utf-8"),a=o.split(`
510
+ `),c=vt(i.path||Y__default.basename(i.abs_path),o);for(let l of c){let p=wt(l.content);if(p&&(ge(p,u=>{if(!(r.length>=n)){if(u.type==="VariableDeclarator"){let d=u.id;if(Zt(d,e)){let h=Ee(u,l.lineOffset);r.push({filePath:i.path,line:h,kind:"declaration",text:a[h-1]?.trim()||""});}}if(u.type==="AssignmentExpression"){let d=u.left;if(!d)return;let h=Ee(u,l.lineOffset);if(Zt(d,e)||nn(d,e)){r.push({filePath:i.path,line:h,kind:"assignment",text:a[h-1]?.trim()||""});return}t&&d.type==="MemberExpression"&&te(d)===e&&r.push({filePath:i.path,line:h,kind:d.computed?"indexed_assignment":"property_assignment",text:a[h-1]?.trim()||""});}if(u.type==="UpdateExpression"){let d=u.argument;if(!d)return;if(Zt(d,e)||nn(d,e)){let h=Ee(u,l.lineOffset);r.push({filePath:i.path,line:h,kind:"update",text:a[h-1]?.trim()||""});}}if(t&&(u.type==="CallExpression"||u.type==="OptionalCallExpression")){let d=u.callee;if(!d||d.type!=="MemberExpression"&&d.type!=="OptionalMemberExpression"||te(d)!==e)return;let f=K(d);if(!f||!/^(push|pop|shift|unshift|splice|sort|reverse|copyWithin|fill)$/.test(f))return;let m=Ee(u,l.lineOffset);r.push({filePath:i.path,line:m,kind:"array_mutation",text:a[m-1]?.trim()||""});}}}),r.length>=n))break}if(r.length>=n)break}return nr(r).slice(0,n)}function Lt(s,e,t,n){let r=[];for(let i of s){if(!i.abs_path||!ne__default.existsSync(i.abs_path))continue;let o=ne__default.readFileSync(i.abs_path,"utf-8"),a=o.split(`
511
+ `),c=vt(i.path||Y__default.basename(i.abs_path),o);for(let l of c){let p=wt(l.content);if(p&&(ge(p,u=>{if(!(r.length>=n)){if(u.type==="AssignmentExpression"){let d=u.left;if(!d||d.type!=="MemberExpression"||te(d)!==e)return;let f=K(d);if(t&&f!==t)return;let m=Ee(u,l.lineOffset);r.push({filePath:i.path,line:m,kind:d.computed?"bracket":"dot",text:a[m-1]?.trim()||""});}if(u.type==="UpdateExpression"){let d=u.argument;if(!d||d.type!=="MemberExpression"||te(d)!==e)return;let f=K(d);if(t&&f!==t)return;let m=Ee(u,l.lineOffset);r.push({filePath:i.path,line:m,kind:d.computed?"bracket":"dot",text:a[m-1]?.trim()||""});}if(u.type==="UnaryExpression"&&u.operator==="delete"){let d=u.argument;if(!d||d.type!=="MemberExpression"||te(d)!==e)return;let f=K(d);if(t&&f!==t)return;let m=Ee(u,l.lineOffset);r.push({filePath:i.path,line:m,kind:"delete",text:a[m-1]?.trim()||""});}}}),r.length>=n))break}if(r.length>=n)break}return nr(r).slice(0,n)}function rr(s,e){s.registerTool("skimmer_find_symbol",{title:"\u667A\u80FD\u7B26\u53F7\u641C\u7D22\uFF08\u652F\u6301\u62FC\u5199\u9519\u8BEF\uFF09",description:`\u4E09\u5C42\u641C\u7D22\uFF1A\u7CBE\u786E\u5339\u914D \u2192 FTS5\u5168\u6587 \u2192 Levenshtein\u6A21\u7CCA\u3002
510
512
  \u89E3\u51B3\u62FC\u5199\u9519\u8BEF\uFF1A\u641C "changeCash" \u80FD\u627E\u5230 "changeCashValue"\uFF0C\u5E76\u63D0\u793A "cash \u53EF\u80FD\u662F cache \u7684\u62FC\u5199\u9519\u8BEF"\u3002
511
513
  \u9A7C\u5CF0\u62C6\u8BCD\uFF1A\u641C "change cache" \u4E5F\u80FD\u627E\u5230 "changeCacheValue"\u3002
512
514
  \u6846\u67B6\u611F\u77E5\uFF1A\u53EF\u6309 vue2/vue3/react \u8FC7\u6EE4\u3002
513
- project_path \u53EF\u7701\u7565\u3002`,inputSchema:z$1.object({query:z$1.string().describe('\u641C\u7D22\u8BCD\uFF0C\u5982 "changeCash" \u6216 "handle submit"'),project_path:z$1.string().optional().describe(Ee),category:z$1.enum(["state","computed","method","effect","prop","lifecycle","hook","component","mixin","function","all"]).optional().default("all").describe("\u7B26\u53F7\u7C7B\u578B\u8FC7\u6EE4"),framework:z$1.enum(["vue2","vue3","react","all"]).optional().default("all"),file_path:z$1.string().optional().describe('\u9650\u5B9A\u6587\u4EF6\u8DEF\u5F84\u641C\u7D22\uFF08\u5305\u542B\u5373\u53EF\uFF0C\u5982 "index.vue"\uFF09'),fuzzy:z$1.boolean().optional().default(true).describe("\u662F\u5426\u542F\u7528\u6A21\u7CCA\u5339\u914D\uFF08\u9ED8\u8BA4 true\uFF0C\u77ED\u67E5\u8BE2\u81EA\u52A8\u7981\u7528\uFF09"),allow_fallback_scan:z$1.boolean().optional().default(false).describe("0\u547D\u4E2D\u65F6\u662F\u5426\u5141\u8BB8 LIKE \u5168\u8868\u626B\u63CF\uFF08\u9ED8\u8BA4\u4E0D\u542F\u7528\uFF0C\u6602\u8D35\u64CD\u4F5C\uFF09"),debug:z$1.boolean().optional().default(false).describe("\u662F\u5426\u8F93\u51FA\u5404\u9636\u6BB5\u8017\u65F6\u548C\u5019\u9009\u6570"),limit:z$1.number().optional().default(15)}),annotations:{readOnlyHint:true,destructiveHint:false}},async({query:t,project_path:n,category:r,framework:s,file_path:i,fuzzy:a,allow_fallback_scan:c,debug:l,limit:p})=>{let u=performance.now(),{db:d}=e.getContext(n),g=new Xe(d),{results:f,debug:m}=g.search(t,{category:r==="all"?void 0:r,framework:s==="all"?void 0:s,filePath:i,fuzzy:a,limit:p,allowFallbackScan:c,debug:l}),h=Math.round((performance.now()-u)*100)/100,b=H({durationMs:h,resultCount:f.length,backend:"indexed",debug:l?m:void 0});if(f.length===0)return {content:[{type:"text",text:`\u{1F50D} \u641C\u7D22 "${t}" \u65E0\u7ED3\u679C
515
+ project_path \u53EF\u7701\u7565\u3002`,inputSchema:z$1.object({query:z$1.string().describe('\u641C\u7D22\u8BCD\uFF0C\u5982 "changeCash" \u6216 "handle submit"'),project_path:z$1.string().optional().describe(ye),category:z$1.enum(["state","computed","method","effect","prop","lifecycle","hook","component","mixin","function","all"]).optional().default("all").describe("\u7B26\u53F7\u7C7B\u578B\u8FC7\u6EE4"),framework:z$1.enum(["vue2","vue3","react","all"]).optional().default("all"),file_path:z$1.string().optional().describe('\u9650\u5B9A\u6587\u4EF6\u8DEF\u5F84\u641C\u7D22\uFF08\u5305\u542B\u5373\u53EF\uFF0C\u5982 "index.vue"\uFF09'),fuzzy:z$1.boolean().optional().default(true).describe("\u662F\u5426\u542F\u7528\u6A21\u7CCA\u5339\u914D\uFF08\u9ED8\u8BA4 true\uFF0C\u77ED\u67E5\u8BE2\u81EA\u52A8\u7981\u7528\uFF09"),allow_fallback_scan:z$1.boolean().optional().default(false).describe("0\u547D\u4E2D\u65F6\u662F\u5426\u5141\u8BB8 LIKE \u5168\u8868\u626B\u63CF\uFF08\u9ED8\u8BA4\u4E0D\u542F\u7528\uFF0C\u6602\u8D35\u64CD\u4F5C\uFF09"),debug:z$1.boolean().optional().default(false).describe("\u662F\u5426\u8F93\u51FA\u5404\u9636\u6BB5\u8017\u65F6\u548C\u5019\u9009\u6570"),limit:z$1.number().optional().default(15)}),annotations:{readOnlyHint:true,destructiveHint:false}},async({query:t,project_path:n,category:r,framework:i,file_path:o,fuzzy:a,allow_fallback_scan:c,debug:l,limit:p})=>{let u=performance.now(),{db:d}=e.getContext(n),h=new Fe(d),{results:f,debug:m}=h.search(t,{category:r==="all"?void 0:r,framework:i==="all"?void 0:i,filePath:o,fuzzy:a,limit:p,allowFallbackScan:c,debug:l}),y=Math.round((performance.now()-u)*100)/100,g=X({durationMs:y,resultCount:f.length,backend:"indexed",debug:l?m:void 0});if(f.length===0)return {content:[{type:"text",text:`\u{1F50D} \u641C\u7D22 "${t}" \u65E0\u7ED3\u679C
514
516
 
515
517
  \u{1F4A1} \u5C1D\u8BD5:
516
518
  skimmer_find_by_behavior \u6309\u884C\u4E3A\u641C\u7D22
@@ -518,74 +520,94 @@ project_path \u53EF\u7701\u7565\u3002`,inputSchema:z$1.object({query:z$1.string(
518
520
  \u{1F4A1} \u5C1D\u8BD5: skimmer_find_symbol({ allow_fallback_scan: true }) \u542F\u7528\u5168\u8868\u626B\u63CF`}
519
521
 
520
522
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
521
- ${W(b)}`}]};let S=[`\u{1F50D} \u641C\u7D22 "${t}" \u2014 \u627E\u5230 ${f.length} \u4E2A\u7ED3\u679C
522
- `];return f.forEach((y,T)=>{let E=y.symbol,L=je(E.params_json,[]),_=L.length>0?`(${L.join(", ")})`:"",N=ke(E.start_line,E.end_line);S.push(`${T+1}. ${E.name}${_} [${E.category}/${E.framework}] \u5339\u914D\u5EA6: ${y.score}%`),S.push(` \u{1F4C4} ${y.filePath}:${N}`),S.push(` \u{1F3AF} ${y.matchReason}`),y.spellingSuggestion&&S.push(` \u{1F4A1} ${y.spellingSuggestion}`),E.default_value&&S.push(` \u{1F4CC} \u9ED8\u8BA4\u503C: ${E.default_value}`),S.push("");}),S.push(`\u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
523
- ${W(b)}`),{content:[{type:"text",text:S.join(`
524
- `)}]}}),o.registerTool("skimmer_get_code_slice",{title:"\u83B7\u53D6\u7CBE\u51C6\u4EE3\u7801\u7247\u6BB5",description:`\u8FD4\u56DE\u6307\u5B9A\u51FD\u6570/\u53D8\u91CF\u7684\u5B8C\u6574\u4EE3\u7801\uFF0C\u907F\u514D\u8BFB\u53D6\u5927\u6587\u4EF6\u6D6A\u8D39 Token\u3002
523
+ ${W(g)}`}]};let N=[`\u{1F50D} \u641C\u7D22 "${t}" \u2014 \u627E\u5230 ${f.length} \u4E2A\u7ED3\u679C
524
+ `];return f.forEach((b,S)=>{let E=b.symbol,L=He(E.params_json,[]),_=L.length>0?`(${L.join(", ")})`:"",x=Se(E.start_line,E.end_line);N.push(`${S+1}. ${E.name}${_} [${E.category}/${E.framework}] \u5339\u914D\u5EA6: ${b.score}%`),N.push(` \u{1F4C4} ${b.filePath}:${x}`),N.push(` \u{1F3AF} ${b.matchReason}`),b.spellingSuggestion&&N.push(` \u{1F4A1} ${b.spellingSuggestion}`),E.default_value&&N.push(` \u{1F4CC} \u9ED8\u8BA4\u503C: ${E.default_value}`),N.push("");}),N.push(`\u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
525
+ ${W(g)}`),{content:[{type:"text",text:N.join(`
526
+ `)}]}}),s.registerTool("skimmer_search_snippets",{title:"\u9762\u5411 Agent \u7684\u4EE3\u7801\u7247\u6BB5\u641C\u7D22",description:`snippet-first \u641C\u7D22\uFF1A\u76F4\u63A5\u8FD4\u56DE\u76F8\u5173\u4EE3\u7801\u7247\u6BB5\uFF0C\u800C\u4E0D\u662F\u53EA\u8FD4\u56DE\u7B26\u53F7\u5143\u4FE1\u606F\u3002
527
+ \u9002\u5408\u81EA\u7136\u8BED\u8A00\u7B2C\u4E00\u8DF3\u67E5\u8BE2\uFF0C\u5982 "save to cache"\u3001"localStorage setItem"\u3001"authentication flow"\u3002
528
+ \u540C\u65F6\u517C\u5BB9\u7B26\u53F7\u578B\u67E5\u8BE2\uFF0C\u5982 "changeCacheValue"\u3002
529
+ project_path \u53EF\u7701\u7565\u3002`,inputSchema:z$1.object({query:z$1.string().describe('\u81EA\u7136\u8BED\u8A00\u3001\u884C\u4E3A\u63CF\u8FF0\u6216\u7B26\u53F7\u540D\uFF0C\u5982 "save to cache" / "localStorage setItem" / "changeCacheValue"'),project_path:z$1.string().optional().describe(ye),file_path:z$1.string().optional().describe('\u9650\u5B9A\u6587\u4EF6\u8DEF\u5F84\u641C\u7D22\uFF08\u5305\u542B\u5373\u53EF\uFF0C\u5982 "src/service/cache.ts"\uFF09'),context_lines:z$1.number().optional().default(1).describe("\u7247\u6BB5\u4E0A\u4E0B\u6587\u884C\u6570"),max_lines:z$1.number().optional().default(24).describe("\u5355\u4E2A\u7247\u6BB5\u6700\u5927\u884C\u6570"),limit:z$1.number().optional().default(8).describe("\u8FD4\u56DE\u7247\u6BB5\u6570")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({query:t,project_path:n,file_path:r,context_lines:i,max_lines:o,limit:a})=>{let c=performance.now(),{db:l}=e.getContext(n),p=new Fe(l),u=Tt(t),d=p.searchSnippets(t,{filePath:r,contextLines:i,maxLines:o,limit:a}),h=Math.round((performance.now()-c)*100)/100,f=X({durationMs:h,resultCount:d.length,backend:"indexed"});if(d.length===0)return {content:[{type:"text",text:`\u{1F50E} \u4EE3\u7801\u7247\u6BB5\u641C\u7D22 "${t}" \u65E0\u7ED3\u679C
530
+
531
+ \u{1F4A1} \u5C1D\u8BD5:
532
+ 1. \u7528\u66F4\u5177\u4F53\u7684\u884C\u4E3A\u8BCD\uFF0C\u5982 "localStorage setItem"
533
+ 2. \u7528 skimmer_find_symbol \u641C\u7B26\u53F7\u540D
534
+ 3. \u7528 skimmer_find_by_behavior \u6309\u884C\u4E3A\u8FC7\u6EE4
535
+
536
+ \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
537
+ ${W(f)}`}]};let m=[`\u{1F50E} \u4EE3\u7801\u7247\u6BB5\u641C\u7D22 "${t}" \u2014 \u627E\u5230 ${d.length} \u4E2A\u7ED3\u679C`,`\u{1F9ED} \u67E5\u8BE2\u610F\u56FE: ${u}
538
+ `];for(let[y,g]of d.entries()){m.push(`${y+1}. ${g.symbolName} [${g.category||"unknown"}/${g.framework||"unknown"}] \u5339\u914D\u5EA6: ${g.score}%`),m.push(` \u{1F4C4} ${g.filePath}:${Se(g.startLine,g.endLine)}`),m.push(` \u{1F3AF} ${g.matchReason}`),g.behaviors?.length&&m.push(` \u{1F3F7}\uFE0F ${g.behaviors.join(" ")}`),g.offsetWarning&&m.push(` ${g.offsetWarning}`);let N=g.filePath.split(".").pop()||"js",b=["tsx","jsx"].includes(N)?"jsx":N==="ts"?"typescript":N==="vue"?"vue":"javascript";m.push(` \`\`\`${b}`),m.push(g.snippet),m.push(" ```"),m.push("");}return m.push(`\u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
539
+ ${W(f)}`),{content:[{type:"text",text:m.join(`
540
+ `)}]}}),s.registerTool("skimmer_get_code_slice",{title:"\u83B7\u53D6\u7CBE\u51C6\u4EE3\u7801\u7247\u6BB5",description:`\u8FD4\u56DE\u6307\u5B9A\u51FD\u6570/\u53D8\u91CF\u7684\u5B8C\u6574\u4EE3\u7801\uFF0C\u907F\u514D\u8BFB\u53D6\u5927\u6587\u4EF6\u6D6A\u8D39 Token\u3002
525
541
  \u540C\u65F6\u8FD4\u56DE\u8BE5\u7B26\u53F7\u7684\u884C\u4E3A\u6807\u7B7E\uFF08\u64CD\u4F5C\u4E86\u54EA\u4E9B\u5916\u90E8 API\uFF09\u3002
526
- project_path \u53EF\u7701\u7565\u3002`,inputSchema:z$1.object({file_path:z$1.string().describe("\u6587\u4EF6\u76F8\u5BF9\u8DEF\u5F84\uFF08\u76F8\u5BF9\u4E8E\u9879\u76EE\u6839\u76EE\u5F55\uFF09"),symbol_name:z$1.string().describe("\u51FD\u6570\u6216\u53D8\u91CF\u540D"),project_path:z$1.string().optional().describe(Ee),context_lines:z$1.number().optional().default(0).describe("\u4E0A\u4E0B\u65B9\u989D\u5916\u5C55\u793A\u7684\u884C\u6570")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({file_path:t,symbol_name:n,project_path:r,context_lines:s})=>{let i=performance.now(),{db:a}=e.getContext(r),c=a.getSymbolByName(n,t);if(!c){let N=Math.round((performance.now()-i)*100)/100,A=H({durationMs:N,resultCount:0,backend:"indexed"});return {content:[{type:"text",text:`\u274C \u672A\u627E\u5230: ${n}
527
- \u{1F4C4} \u6587\u4EF6: ${t}
542
+ project_path \u53EF\u7701\u7565\u3002`,inputSchema:z$1.object({file_path:z$1.string().describe("\u6587\u4EF6\u76F8\u5BF9\u8DEF\u5F84\uFF08\u76F8\u5BF9\u4E8E\u9879\u76EE\u6839\u76EE\u5F55\uFF09"),symbol_name:z$1.string().describe("\u51FD\u6570\u6216\u53D8\u91CF\u540D"),project_path:z$1.string().optional().describe(ye),context_lines:z$1.number().optional().default(0).describe("\u4E0A\u4E0B\u65B9\u989D\u5916\u5C55\u793A\u7684\u884C\u6570")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({file_path:t,symbol_name:n,project_path:r,context_lines:i})=>{let o=performance.now(),{db:a}=e.getContext(r),c=a.getSymbolByName(n,t);if(!c){let x=Math.round((performance.now()-o)*100)/100,A=X({durationMs:x,resultCount:0,backend:"indexed"}),w=a.exactSearch(n,void 0,void 0,void 0),P=w.length>0?`
528
543
 
529
- \u{1F4A1} \u8BD5\u8BD5: skimmer_find_symbol({ query: "${n}" })
544
+ \u{1F50E} \u540C\u540D\u7B26\u53F7\u5B58\u5728\u4E8E\u5176\u4ED6\u4F4D\u7F6E:
545
+ ${w.slice(0,5).map(($,H)=>` ${H+1}. ${$.name} [${$.category}/${$.framework}] \u{1F4C4} ${$.file_path}:${Se($.start_line,$.end_line)}`).join(`
546
+ `)}
547
+
548
+ \u{1F4A1} \u53EF\u6539\u7528: skimmer_get_code_slice({ file_path: "${w[0].file_path}", symbol_name: "${n}" })`:`
549
+
550
+ \u{1F4A1} \u8BD5\u8BD5: skimmer_find_symbol({ query: "${n}" })`;return {content:[{type:"text",text:`\u274C \u672A\u627E\u5230: ${n}
551
+ \u{1F4C4} \u8BF7\u6C42\u6587\u4EF6: ${t}${P}
530
552
 
531
553
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
532
- ${W(A)}`}]}}let l=c.abs_path;if(!Q__default.existsSync(l))return {content:[{type:"text",text:`\u274C \u6587\u4EF6\u4E0D\u5B58\u5728: ${l}`}]};let u=Q__default.readFileSync(l,"utf-8").split(`
533
- `),d=Math.max(1,c.start_line-s)-1,g=Math.min(u.length,c.end_line+s),f=u.slice(d,g).join(`
534
- `),h=f.includes(n)?"":`
554
+ ${W(A)}`}]}}let l=c.abs_path;if(!ne__default.existsSync(l))return {content:[{type:"text",text:`\u274C \u6587\u4EF6\u4E0D\u5B58\u5728: ${l}`}]};let u=ne__default.readFileSync(l,"utf-8").split(`
555
+ `),d=Math.max(1,c.start_line-i)-1,h=Math.min(u.length,c.end_line+i),f=u.slice(d,h).join(`
556
+ `),y=f.includes(n)?"":`
535
557
  \u26A0\uFE0F [\u884C\u53F7\u504F\u79FB] \u7D22\u5F15\u8BB0\u5F55 ${n} \u5728 L${c.start_line}\uFF0C\u4F46\u8BE5\u4F4D\u7F6E\u672A\u627E\u5230\u6B64\u7B26\u53F7\u3002
536
558
  \u6587\u4EF6\u5DF2\u88AB\u4FEE\u6539\u4F46\u7D22\u5F15\u672A\u66F4\u65B0\uFF0C\u884C\u53F7\u53EF\u80FD\u504F\u79FB ${u.length-c.end_line} \u884C\u5DE6\u53F3\u3002
537
559
  \u5EFA\u8BAE: skimmer_index_project({ force: true })
538
- `,{behaviors:b}=a.getFileOutline(t),S=b.filter(N=>N.symbol_id===c.id),y=l.split(".").pop()||"js",T=["tsx","jsx"].includes(y)?"jsx":["ts"].includes(y)?"typescript":"javascript",E=[`\u{1F4CD} ${c.name} [${c.category}/${c.framework}]`,`\u{1F4C4} ${t}:${ke(c.start_line,c.end_line)}`];if(h&&E.push(h),c.jsdoc&&E.push(`\u{1F4DD} ${c.jsdoc}`),S.length>0){let N=[...new Set(S.map(A=>`[${A.category}:${A.api_name}.${A.operation}${A.detail?`("${A.detail}")`:""}]`))];E.push(`\u{1F3F7}\uFE0F \u884C\u4E3A: ${N.join(" ")}`);}E.push(`
539
- \`\`\`${T}`),E.push(f),E.push("```");let L=Math.round((performance.now()-i)*100)/100,_=H({durationMs:L,resultCount:1,backend:"indexed"});return E.push(`
560
+ `,{behaviors:g}=a.getFileOutline(t),N=g.filter(x=>x.symbol_id===c.id),b=l.split(".").pop()||"js",S=["tsx","jsx"].includes(b)?"jsx":["ts"].includes(b)?"typescript":"javascript",E=[`\u{1F4CD} ${c.name} [${c.category}/${c.framework}]`,`\u{1F4C4} ${t}:${Se(c.start_line,c.end_line)}`];if(y&&E.push(y),c.jsdoc&&E.push(`\u{1F4DD} ${c.jsdoc}`),N.length>0){let x=[...new Set(N.map(A=>`[${A.category}:${A.api_name}.${A.operation}${A.detail?`("${A.detail}")`:""}]`))];E.push(`\u{1F3F7}\uFE0F \u884C\u4E3A: ${x.join(" ")}`);}E.push(`
561
+ \`\`\`${S}`),E.push(f),E.push("```");let L=Math.round((performance.now()-o)*100)/100,_=X({durationMs:L,resultCount:1,backend:"indexed"});return E.push(`
540
562
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
541
563
  ${W(_)}`),{content:[{type:"text",text:E.join(`
542
- `)}]}}),o.registerTool("skimmer_trace_assignments",{title:"\u8FFD\u8E2A\u53D8\u91CF\u8D4B\u503C\u94FE\u8DEF\uFF08\u8F7B\u91CF\uFF09",description:`\u3010\u964D\u7EA7\u5DE5\u5177\u3011\u4EC5\u5728\u4EE5\u4E0B\u573A\u666F\u5355\u72EC\u4F7F\u7528\uFF1A\u53EA\u9700\u67E5\u770B\u67D0\u4E2A\u7B80\u5355\u53D8\u91CF\uFF08\u975E\u5BF9\u8C61\uFF09\u7684\u8D4B\u503C\u4F4D\u7F6E\uFF0C\u4E14\u4E0D\u5173\u5FC3\u5C5E\u6027\u4FEE\u6539/\u53C2\u6570\u4F20\u9012/storage\u94FE\u8DEF\u3002
564
+ `)}]}}),s.registerTool("skimmer_trace_assignments",{title:"\u8FFD\u8E2A\u53D8\u91CF\u8D4B\u503C\u94FE\u8DEF\uFF08\u8F7B\u91CF\uFF09",description:`\u3010\u964D\u7EA7\u5DE5\u5177\u3011\u4EC5\u5728\u4EE5\u4E0B\u573A\u666F\u5355\u72EC\u4F7F\u7528\uFF1A\u53EA\u9700\u67E5\u770B\u67D0\u4E2A\u7B80\u5355\u53D8\u91CF\uFF08\u975E\u5BF9\u8C61\uFF09\u7684\u8D4B\u503C\u4F4D\u7F6E\uFF0C\u4E14\u4E0D\u5173\u5FC3\u5C5E\u6027\u4FEE\u6539/\u53C2\u6570\u4F20\u9012/storage\u94FE\u8DEF\u3002
543
565
  \u26A0\uFE0F \u7EDD\u5927\u591A\u6570\u53D8\u91CF\u6EAF\u6E90\u573A\u666F\u8BF7\u4F18\u5148\u4F7F\u7528 skimmer_trace_data_lifecycle\uFF0C\u5B83\u80FD\u4E00\u6B21\u62FF\u5230\u6240\u6709\u4FE1\u606F\u3002
544
566
  \u2705 \u672C\u5DE5\u5177\u9002\u5408\uFF1Aloading / errorMsg / count \u8FD9\u7C7B\u7B80\u5355 flag \u7684\u8D4B\u503C\u8FFD\u8E2A\u3002
545
- \u274C \u4E0D\u9002\u5408\uFF1AstorageParams / savedData \u8FD9\u7C7B\u5BF9\u8C61\u3001\u9700\u8981\u8FFD\u8E2A\u5B8C\u6574\u6570\u636E\u6D41\u7684\u573A\u666F\u3002`,inputSchema:z$1.object({variable:z$1.string().describe('\u53D8\u91CF\u540D\uFF0C\u5982 "changeResult"'),project_path:z$1.string().optional().describe(Ee),file_path:z$1.string().optional().describe("\u9650\u5B9A\u6587\u4EF6\u8DEF\u5F84\uFF08\u5305\u542B\u5373\u53EF\uFF09"),include_properties:z$1.boolean().optional().default(true).describe("\u662F\u5426\u5305\u542B variable.xxx / variable[...] \u8D4B\u503C"),limit:z$1.number().optional().default(80)}),annotations:{readOnlyHint:true,destructiveHint:false}},async({variable:t,project_path:n,file_path:r,include_properties:s,limit:i})=>{let a=performance.now(),{db:c}=e.getContext(n),l=c.listFiles(r),p=Math.min(300,Math.max(1,i||80)),u=s??true,d=c.exactSearch(t,"state",void 0,r||void 0),g={vue2:"Vue2 data()",vue3:"Vue3 ref/reactive",react:"React useState/useRef"},f=d.filter(E=>E.default_value!=null).map(E=>({filePath:E.file_path,line:E.start_line,kind:`data_init(${g[E.framework]||E.framework})`,text:`${E.name}: ${E.default_value} \u2190 \u58F0\u660E\u521D\u59CB\u5316`})),m=Kt(l,t,u,p);if(m.length===0){let E=Fn(t,u);m=Ie(l,E,p);}let h=new Map;for(let E of [...f,...m]){let L=`${E.filePath}:${E.line}`;h.has(L)||h.set(L,E);}let b=[...h.values()],S=Math.round((performance.now()-a)*100)/100;if(b.length===0){let E=H({durationMs:S,resultCount:0,backend:"ast_scan"});return {content:[{type:"text",text:`\u{1F9E9} \u53D8\u91CF\u8D4B\u503C\u8FFD\u8E2A: "${t}"
567
+ \u274C \u4E0D\u9002\u5408\uFF1AstorageParams / savedData \u8FD9\u7C7B\u5BF9\u8C61\u3001\u9700\u8981\u8FFD\u8E2A\u5B8C\u6574\u6570\u636E\u6D41\u7684\u573A\u666F\u3002`,inputSchema:z$1.object({variable:z$1.string().describe('\u53D8\u91CF\u540D\uFF0C\u5982 "changeResult"'),project_path:z$1.string().optional().describe(ye),file_path:z$1.string().optional().describe("\u9650\u5B9A\u6587\u4EF6\u8DEF\u5F84\uFF08\u5305\u542B\u5373\u53EF\uFF09"),include_properties:z$1.boolean().optional().default(true).describe("\u662F\u5426\u5305\u542B variable.xxx / variable[...] \u8D4B\u503C"),limit:z$1.number().optional().default(80)}),annotations:{readOnlyHint:true,destructiveHint:false}},async({variable:t,project_path:n,file_path:r,include_properties:i,limit:o})=>{let a=performance.now(),{db:c}=e.getContext(n),l=c.listFiles(r),p=Math.min(300,Math.max(1,o||80)),u=i??true,d=c.exactSearch(t,"state",void 0,r||void 0),h={vue2:"Vue2 data()",vue3:"Vue3 ref/reactive",react:"React useState/useRef"},f=d.filter(E=>E.default_value!=null).map(E=>({filePath:E.file_path,line:E.start_line,kind:`data_init(${h[E.framework]||E.framework})`,text:`${E.name}: ${E.default_value} \u2190 \u58F0\u660E\u521D\u59CB\u5316`})),m=tn(l,t,u,p);if(m.length===0){let E=Yn(t,u);m=Oe(l,E,p);}let y=new Map;for(let E of [...f,...m]){let L=`${E.filePath}:${E.line}`;y.has(L)||y.set(L,E);}let g=[...y.values()],N=Math.round((performance.now()-a)*100)/100;if(g.length===0){let E=X({durationMs:N,resultCount:0,backend:"ast_scan"});return {content:[{type:"text",text:`\u{1F9E9} \u53D8\u91CF\u8D4B\u503C\u8FFD\u8E2A: "${t}"
546
568
  \u672A\u627E\u5230\u5339\u914D\u8D4B\u503C\u8BED\u53E5\uFF08\u5305\u62EC\u58F0\u660E\u521D\u59CB\u5316\uFF09
547
569
  \u8FC7\u6EE4: file_path=${r||"*"} include_properties=${u}
548
570
 
549
571
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
550
- ${W(E)}`}]}}let y=[`\u{1F9E9} \u53D8\u91CF\u8D4B\u503C\u8FFD\u8E2A: "${t}"`,`\u8FC7\u6EE4: file_path=${r||"*"} include_properties=${u}`,`\u547D\u4E2D: ${b.length} \u5904${f.length>0?`\uFF08\u542B ${f.length} \u5904\u58F0\u660E\u521D\u59CB\u5316\uFF09`:""}`,""];b.forEach((E,L)=>{y.push(`${L+1}. [${E.kind}] \u{1F4C4} ${E.filePath}:L${E.line}`),y.push(` ${E.text}`);});let T=H({durationMs:S,resultCount:b.length,backend:"ast_scan"});return y.push(`
572
+ ${W(E)}`}]}}let b=[`\u{1F9E9} \u53D8\u91CF\u8D4B\u503C\u8FFD\u8E2A: "${t}"`,`\u8FC7\u6EE4: file_path=${r||"*"} include_properties=${u}`,`\u547D\u4E2D: ${g.length} \u5904${f.length>0?`\uFF08\u542B ${f.length} \u5904\u58F0\u660E\u521D\u59CB\u5316\uFF09`:""}`,""];g.forEach((E,L)=>{b.push(`${L+1}. [${E.kind}] \u{1F4C4} ${E.filePath}:L${E.line}`),b.push(` ${E.text}`);});let S=X({durationMs:N,resultCount:g.length,backend:"ast_scan"});return b.push(`
551
573
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
552
- ${W(T)}`),{content:[{type:"text",text:y.join(`
553
- `)}]}}),o.registerTool("skimmer_trace_property_changes",{title:"\u8FFD\u8E2A\u5BF9\u8C61\u5C5E\u6027\u4FEE\u6539",description:`\u3010\u964D\u7EA7\u5DE5\u5177\u3011\u4EC5\u5728\u4EE5\u4E0B\u573A\u666F\u5355\u72EC\u4F7F\u7528\uFF1A\u9700\u8981\u7CBE\u786E\u8FC7\u6EE4\u67D0\u4E00\u4E2A\u5177\u4F53\u5C5E\u6027\u5B57\u6BB5\uFF08\u5982 storageParams.receiveAdr\uFF09\uFF0C\u800C\u4E0D\u9700\u8981\u6574\u4F53\u8D4B\u503C/\u53C2\u6570\u4F20\u9012/storage\u94FE\u8DEF\u4FE1\u606F\u3002
574
+ ${W(S)}`),{content:[{type:"text",text:b.join(`
575
+ `)}]}}),s.registerTool("skimmer_trace_property_changes",{title:"\u8FFD\u8E2A\u5BF9\u8C61\u5C5E\u6027\u4FEE\u6539",description:`\u3010\u964D\u7EA7\u5DE5\u5177\u3011\u4EC5\u5728\u4EE5\u4E0B\u573A\u666F\u5355\u72EC\u4F7F\u7528\uFF1A\u9700\u8981\u7CBE\u786E\u8FC7\u6EE4\u67D0\u4E00\u4E2A\u5177\u4F53\u5C5E\u6027\u5B57\u6BB5\uFF08\u5982 storageParams.receiveAdr\uFF09\uFF0C\u800C\u4E0D\u9700\u8981\u6574\u4F53\u8D4B\u503C/\u53C2\u6570\u4F20\u9012/storage\u94FE\u8DEF\u4FE1\u606F\u3002
554
576
  \u26A0\uFE0F \u7EDD\u5927\u591A\u6570\u5BF9\u8C61\u6EAF\u6E90\u573A\u666F\u8BF7\u4F18\u5148\u4F7F\u7528 skimmer_trace_data_lifecycle\uFF0C\u5B83\u80FD\u4E00\u6B21\u62FF\u5230\u6240\u6709\u4FE1\u606F\u3002
555
577
  \u2705 \u672C\u5DE5\u5177\u9002\u5408\uFF1Aobject.specificProp \u7684\u5355\u5B57\u6BB5\u7EA7\u522B\u7CBE\u786E\u8FFD\u8E2A\u3002
556
- \u274C \u4E0D\u9002\u5408\uFF1A\u9700\u8981\u4E86\u89E3\u5BF9\u8C61\u6574\u4F53\u6765\u6E90\u6216\u6570\u636E\u6D41\u5411\u7684\u573A\u666F\u3002`,inputSchema:z$1.object({object:z$1.string().describe('\u5BF9\u8C61\u540D\uFF0C\u5982 "storageParams" / "params"'),property:z$1.string().optional().describe('\u5C5E\u6027\u540D\uFF0C\u5982 "receiveAdr"'),project_path:z$1.string().optional().describe(Ee),file_path:z$1.string().optional().describe("\u9650\u5B9A\u6587\u4EF6\u8DEF\u5F84\uFF08\u5305\u542B\u5373\u53EF\uFF09"),limit:z$1.number().optional().default(80)}),annotations:{readOnlyHint:true,destructiveHint:false}},async({object:t,property:n,project_path:r,file_path:s,limit:i})=>{let a=performance.now(),{db:c}=e.getContext(r),l=c.listFiles(s),p=Math.min(300,Math.max(1,i||80)),u=Mn(l,t,20),d=jn(l,t,20),g=[...new Set([...u.map(y=>y.alias),...d.map(y=>y.alias)].filter(y=>y!==t))],f=[t,...g],m=ht(l,t,n,p);for(let y of g)m.push(...ht(l,y,n,Math.floor(p/2)));if(m.length===0){let y="(?:=|\\+=|-=|\\*=|/=|%=|\\|=|&=|\\^=|&&=|\\|\\|=|\\?\\?=)",T=[];for(let E of f){let L=Ke(E);if(n){let _=Ke(n);T.push({kind:"dot",regex:new RegExp(`\\b${L}\\.${_}\\s*${y}`)},{kind:"bracket",regex:new RegExp(`\\b${L}\\s*\\[(?:'${_}'|"${_}")\\]\\s*${y}`)},{kind:"delete",regex:new RegExp(`\\bdelete\\s+${L}\\.(?:${_})\\b`)});}else T.push({kind:"dot",regex:new RegExp(`\\b${L}\\.[A-Za-z_$][\\w$]*\\s*${y}`)},{kind:"bracket",regex:new RegExp(`\\b${L}\\s*\\[(?:'[^']+'|"[^"]+")\\]\\s*${y}`)},{kind:"delete",regex:new RegExp(`\\bdelete\\s+${L}\\.[A-Za-z_$][\\w$]*\\b`)});}m=Ie(l,T,p);}let h=Math.round((performance.now()-a)*100)/100;if(m.length===0){let y=g.length>0?`
557
- \u522B\u540D\u5C55\u5F00: ${g.join(", ")}\uFF08\u5747\u672A\u547D\u4E2D\uFF09`:"",T=H({durationMs:h,resultCount:0,backend:"ast_scan"});return {content:[{type:"text",text:`\u{1F9ED} \u5C5E\u6027\u4FEE\u6539\u8FFD\u8E2A: ${t}${n?`.${n}`:".*"}
558
- \u672A\u627E\u5230\u5339\u914D\u8BED\u53E5${y}
559
- \u8FC7\u6EE4: file_path=${s||"*"}
578
+ \u274C \u4E0D\u9002\u5408\uFF1A\u9700\u8981\u4E86\u89E3\u5BF9\u8C61\u6574\u4F53\u6765\u6E90\u6216\u6570\u636E\u6D41\u5411\u7684\u573A\u666F\u3002`,inputSchema:z$1.object({object:z$1.string().describe('\u5BF9\u8C61\u540D\uFF0C\u5982 "storageParams" / "params"'),property:z$1.string().optional().describe('\u5C5E\u6027\u540D\uFF0C\u5982 "receiveAdr"'),project_path:z$1.string().optional().describe(ye),file_path:z$1.string().optional().describe("\u9650\u5B9A\u6587\u4EF6\u8DEF\u5F84\uFF08\u5305\u542B\u5373\u53EF\uFF09"),limit:z$1.number().optional().default(80)}),annotations:{readOnlyHint:true,destructiveHint:false}},async({object:t,property:n,project_path:r,file_path:i,limit:o})=>{let a=performance.now(),{db:c}=e.getContext(r),l=c.listFiles(i),p=Math.min(300,Math.max(1,o||80)),u=Qn(l,t,20),d=Zn(l,t,20),h=[...new Set([...u.map(b=>b.alias),...d.map(b=>b.alias)].filter(b=>b!==t))],f=[t,...h],m=Lt(l,t,n,p);for(let b of h)m.push(...Lt(l,b,n,Math.floor(p/2)));if(m.length===0){let b="(?:=|\\+=|-=|\\*=|/=|%=|\\|=|&=|\\^=|&&=|\\|\\|=|\\?\\?=)",S=[];for(let E of f){let L=be(E);if(n){let _=be(n);S.push({kind:"dot",regex:new RegExp(`\\b${L}\\.${_}\\s*${b}`)},{kind:"bracket",regex:new RegExp(`\\b${L}\\s*\\[(?:'${_}'|"${_}")\\]\\s*${b}`)},{kind:"delete",regex:new RegExp(`\\bdelete\\s+${L}\\.(?:${_})\\b`)});}else S.push({kind:"dot",regex:new RegExp(`\\b${L}\\.[A-Za-z_$][\\w$]*\\s*${b}`)},{kind:"bracket",regex:new RegExp(`\\b${L}\\s*\\[(?:'[^']+'|"[^"]+")\\]\\s*${b}`)},{kind:"delete",regex:new RegExp(`\\bdelete\\s+${L}\\.[A-Za-z_$][\\w$]*\\b`)});}m=Oe(l,S,p);}let y=Math.round((performance.now()-a)*100)/100;if(m.length===0){let b=h.length>0?`
579
+ \u522B\u540D\u5C55\u5F00: ${h.join(", ")}\uFF08\u5747\u672A\u547D\u4E2D\uFF09`:"",S=X({durationMs:y,resultCount:0,backend:"ast_scan"});return {content:[{type:"text",text:`\u{1F9ED} \u5C5E\u6027\u4FEE\u6539\u8FFD\u8E2A: ${t}${n?`.${n}`:".*"}
580
+ \u672A\u627E\u5230\u5339\u914D\u8BED\u53E5${b}
581
+ \u8FC7\u6EE4: file_path=${i||"*"}
560
582
 
561
583
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
562
- ${W(T)}`}]}}let b=[`\u{1F9ED} \u5C5E\u6027\u4FEE\u6539\u8FFD\u8E2A: ${t}${n?`.${n}`:".*"}`,`\u8FC7\u6EE4: file_path=${s||"*"}`];if(g.length>0){let y=u.map(E=>E.alias).filter(E=>E!==t).join(", "),T=d.map(E=>E.alias).filter(E=>E!==t).join(", ");y&&b.push(`\u26A1 \u5F15\u7528\u522B\u540D: ${y}\uFF08\u901A\u8FC7 let alias = this.${t} \u5C55\u5F00\uFF09`),T&&b.push(`\u26A1 \u89E3\u6784\u522B\u540D: ${T}\uFF08\u901A\u8FC7 const { ${t}: alias } \u5C55\u5F00\uFF09`);}b.push(`\u547D\u4E2D: ${m.length} \u5904`,""),m.forEach((y,T)=>{b.push(`${T+1}. [${y.kind}] \u{1F4C4} ${y.filePath}:L${y.line}`),b.push(` ${y.text}`);});let S=H({durationMs:h,resultCount:m.length,backend:"ast_scan"});return b.push(`
584
+ ${W(S)}`}]}}let g=[`\u{1F9ED} \u5C5E\u6027\u4FEE\u6539\u8FFD\u8E2A: ${t}${n?`.${n}`:".*"}`,`\u8FC7\u6EE4: file_path=${i||"*"}`];if(h.length>0){let b=u.map(E=>E.alias).filter(E=>E!==t).join(", "),S=d.map(E=>E.alias).filter(E=>E!==t).join(", ");b&&g.push(`\u26A1 \u5F15\u7528\u522B\u540D: ${b}\uFF08\u901A\u8FC7 let alias = this.${t} \u5C55\u5F00\uFF09`),S&&g.push(`\u26A1 \u89E3\u6784\u522B\u540D: ${S}\uFF08\u901A\u8FC7 const { ${t}: alias } \u5C55\u5F00\uFF09`);}g.push(`\u547D\u4E2D: ${m.length} \u5904`,""),m.forEach((b,S)=>{g.push(`${S+1}. [${b.kind}] \u{1F4C4} ${b.filePath}:L${b.line}`),g.push(` ${b.text}`);});let N=X({durationMs:y,resultCount:m.length,backend:"ast_scan"});return g.push(`
563
585
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
564
- ${W(S)}`),{content:[{type:"text",text:b.join(`
565
- `)}]}}),o.registerTool("skimmer_find_by_behavior",{title:"\u6309\u884C\u4E3A\u6807\u7B7E\u641C\u7D22\u51FD\u6570",description:`\u6309 API \u8C03\u7528\u884C\u4E3A\u641C\u7D22\uFF0C\u5B8C\u5168\u7ED5\u8FC7\u547D\u540D\u95EE\u9898\u3002
586
+ ${W(N)}`),{content:[{type:"text",text:g.join(`
587
+ `)}]}}),s.registerTool("skimmer_find_by_behavior",{title:"\u6309\u884C\u4E3A\u6807\u7B7E\u641C\u7D22\u51FD\u6570",description:`\u6309 API \u8C03\u7528\u884C\u4E3A\u641C\u7D22\uFF0C\u5B8C\u5168\u7ED5\u8FC7\u547D\u540D\u95EE\u9898\u3002
566
588
  \u793A\u4F8B:
567
589
  - \u627E\u6240\u6709\u64CD\u4F5C localStorage \u7684\u51FD\u6570: { category: "storage" }
568
590
  - \u627E\u5199\u5165 localStorage \u7684: { api_name: "localStorage", operation: "setItem" }
569
591
  - \u627E\u53D1\u8BF7\u6C42\u7684: { category: "network" }
570
592
  - \u627E\u8DEF\u7531\u8DF3\u8F6C\u7684: { category: "router" }
571
593
  - \u6309 key \u540D\u641C\u7D22: { keyword: "cacheData" }
572
- project_path \u53EF\u7701\u7565\u3002`,inputSchema:z$1.object({project_path:z$1.string().optional().describe(Ee),category:z$1.enum(["storage","network","router","vuex","dom","event","timer","i18n"]).optional().describe("\u884C\u4E3A\u7C7B\u522B"),api_name:z$1.string().optional().describe('"localStorage" / "axios" / "$router"'),operation:z$1.string().optional().describe('"setItem" / "get" / "push" / "commit"'),keyword:z$1.string().optional().describe('\u5728\u53C2\u6570\u503C\u4E2D\u641C\u7D22\uFF08\u5982 key \u540D "cacheData"\uFF09'),file_path:z$1.string().optional().describe('\u9650\u5B9A\u6587\u4EF6\u8DEF\u5F84\u641C\u7D22\uFF08\u5305\u542B\u5373\u53EF\uFF0C\u5982 "src/views/apply/index.vue"\uFF09')}),annotations:{readOnlyHint:true,destructiveHint:false}},async({project_path:t,category:n,api_name:r,operation:s,keyword:i,file_path:a})=>{let c=performance.now(),{db:l}=e.getContext(t),u=new Xe(l).searchByBehavior({category:n,apiName:r,operation:s,keyword:i,filePath:a}),d=new Set(["localstorage","sessionstorage","cookie"]);r||(u=u.filter(b=>b.category!=="storage"||d.has(b.apiName.toLowerCase())));let g=Math.round((performance.now()-c)*100)/100,f=H({durationMs:g,resultCount:u.length,backend:"indexed"});if(u.length===0)return {content:[{type:"text",text:`\u{1F3F7}\uFE0F \u672A\u627E\u5230\u5339\u914D\u7684\u884C\u4E3A
573
- \u8FC7\u6EE4\u6761\u4EF6: ${JSON.stringify({category:n,api_name:r,operation:s,keyword:i,file_path:a})}
594
+ project_path \u53EF\u7701\u7565\u3002`,inputSchema:z$1.object({project_path:z$1.string().optional().describe(ye),category:z$1.enum(["storage","network","router","vuex","dom","event","timer","i18n"]).optional().describe("\u884C\u4E3A\u7C7B\u522B"),api_name:z$1.string().optional().describe('"localStorage" / "axios" / "$router"'),operation:z$1.string().optional().describe('"setItem" / "get" / "push" / "commit"'),keyword:z$1.string().optional().describe('\u5728\u53C2\u6570\u503C\u4E2D\u641C\u7D22\uFF08\u5982 key \u540D "cacheData"\uFF09'),file_path:z$1.string().optional().describe('\u9650\u5B9A\u6587\u4EF6\u8DEF\u5F84\u641C\u7D22\uFF08\u5305\u542B\u5373\u53EF\uFF0C\u5982 "src/views/apply/index.vue"\uFF09')}),annotations:{readOnlyHint:true,destructiveHint:false}},async({project_path:t,category:n,api_name:r,operation:i,keyword:o,file_path:a})=>{let c=performance.now(),{db:l}=e.getContext(t),u=new Fe(l).searchByBehavior({category:n,apiName:r,operation:i,keyword:o,filePath:a}),d=new Set(["localstorage","sessionstorage","cookie"]);r||(u=u.filter(g=>g.category!=="storage"||d.has(g.apiName.toLowerCase())));let h=Math.round((performance.now()-c)*100)/100,f=X({durationMs:h,resultCount:u.length,backend:"indexed"});if(u.length===0)return {content:[{type:"text",text:`\u{1F3F7}\uFE0F \u672A\u627E\u5230\u5339\u914D\u7684\u884C\u4E3A
595
+ \u8FC7\u6EE4\u6761\u4EF6: ${JSON.stringify({category:n,api_name:r,operation:i,keyword:o,file_path:a})}
574
596
 
575
597
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
576
- ${W(f)}`}]};let m=new Map;for(let b of u){let S=`${b.category}:${b.apiName}`;m.has(S)||m.set(S,[]),m.get(S).push(b);}let h=[`\u{1F3F7}\uFE0F \u884C\u4E3A\u641C\u7D22\u7ED3\u679C \u2014 ${u.length} \u6761
577
- `];for(let[b,S]of m){let[y,T]=b.split(":"),E=new Map;for(let L of S)E.has(L.operation)||E.set(L.operation,[]),E.get(L.operation).push(L);h.push(`\u{1F4C2} ${y} \u2192 ${T}:`);for(let[L,_]of E){h.push(` ${L}:`);let N=new Map;for(let A of _){let k=`${A.symbolName}|${A.filePath}`;N.has(k)||N.set(k,{item:A,callLines:[]}),N.get(k).callLines.push(A.line);}for(let{item:A,callLines:k}of N.values()){let $=A.detail?` key="${A.detail}"`:"",P=k.length>1?` \xD7${k.length} (L${k.join(", L")})`:` L${k[0]||A.startLine}`;h.push(` \u2022 ${A.symbolName}${$}${P} \u{1F4C4} ${A.filePath}:${ke(A.startLine,A.endLine)}`);}}h.push("");}return h.push(`\u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
578
- ${W(f)}`),{content:[{type:"text",text:h.join(`
579
- `)}]}}),o.registerTool("skimmer_get_call_graph",{title:"\u83B7\u53D6\u51FD\u6570\u8C03\u7528\u5173\u7CFB\u56FE\u8C31",description:"\u67E5\u770B\u51FD\u6570\u88AB\u8C01\u8C03\u7528\uFF08callers\uFF09\u4EE5\u53CA\u5B83\u8C03\u7528\u4E86\u4EC0\u4E48\uFF08callees\uFF09\u3002project_path \u53EF\u7701\u7565\u3002",inputSchema:z$1.object({symbol_name:z$1.string().describe("\u51FD\u6570\u540D"),project_path:z$1.string().optional().describe(Ee),file_path:z$1.string().optional().describe("\u6587\u4EF6\u8DEF\u5F84\uFF08\u540C\u540D\u51FD\u6570\u65F6\u7528\u4E8E\u7CBE\u786E\u5B9A\u4F4D\uFF09"),direction:z$1.enum(["callers","callees","both"]).optional().default("both"),arg_keyword:z$1.string().optional().describe('\u8C03\u7528\u53C2\u6570\u5173\u952E\u5B57\u8FC7\u6EE4\uFF08\u5982 "storageParams"\uFF09'),auto_precise:z$1.boolean().optional().default(true).describe("\u5F53\u5B58\u5728 watcher/heuristic \u4EA7\u751F\u7684 precise pending \u65F6\uFF0C\u67E5\u8BE2\u524D\u81EA\u52A8\u6309\u9884\u7B97\u8865\u7B97 precise\uFF08\u9ED8\u8BA4 true\uFF09"),max_precise_files:z$1.number().optional().default(20).describe("auto_precise \u5355\u6B21\u6700\u591A\u8865\u7B97\u6587\u4EF6\u6570\uFF08\u9ED8\u8BA4 20\uFF09")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({symbol_name:t,project_path:n,file_path:r,direction:s,arg_keyword:i,auto_precise:a,max_precise_files:c})=>{let l=performance.now(),{db:p,projectRoot:u}=e.getContext(n),d=await Pn(e,u,p,a!==false,Math.max(1,c||20)),g=p.getSymbolByName(t,r),f=[`\u{1F4CA} ${t} \u7684\u8C03\u7528\u56FE\u8C31
580
- `];f.push(...On(d));let m=0,h=0,b=[],S=[],y=void 0;if(s==="callers"||s==="both"){if(b=p.getCallers(t,y,i),m+=b.length,h+=b.filter(N=>N.edge_kind==="precise").length,f.push(`\u2B06\uFE0F \u88AB\u8C03\u7528 (${b.length} \u5904):`),b.length===0)f.push(" \uFF08\u672A\u627E\u5230\u8C03\u7528\u8005\uFF09");else {let N={method_call:"",template_event:"\u{1F5BC}\uFE0F",jsx_event:"\u269B\uFE0F",hook_call:"\u{1FA9D}",import_call:"\u{1F4E5}",router_call:"\u{1F6E3}\uFE0F",store_dispatch:"\u{1F4E6}",store_commit:"\u{1F4E6}"};for(let A of b){let k=A.args?` \u53C2\u6570: "${A.args}"`:"",$=A.source_kind||"",P=A.edge_kind||"",B=N[$]?` ${N[$]}`:"",re=P==="precise"?" [\u{1F3AF}precise]":"";f.push(` \u2022 ${A.caller_name} [${A.category}]${B}${re} \u{1F4C4} ${A.file_path}:L${A.start_line}${k}`);}}f.push("");}if((s==="callees"||s==="both")&&g){if(S=p.getCallees(g.id),m+=S.length,h+=S.filter(N=>N.edge_kind==="precise").length,f.push(`\u2B07\uFE0F \u8C03\u7528\u4E86 (${S.length} \u4E2A):`),S.length===0)f.push(" \uFF08\u672A\u5206\u6790\u5230\u8C03\u7528\u5173\u7CFB\uFF09");else for(let N of S){let A=N.args?`("${N.args}")`:"",$=(N.edge_kind||"")==="precise"?" [\u{1F3AF}precise]":"";f.push(` \u2022 ${N.callee_name}${A} [${N.call_type}]${$} L${N.line_number}`);}f.push("");}if(g){let{behaviors:N}=p.getFileOutline(g.file_path),A=N.filter(k=>k.symbol_id===g.id);if(A.length>0){f.push("\u{1F4E6} \u5916\u90E8\u72B6\u6001\u64CD\u4F5C:");for(let k of A){let $=k.detail?` ("${k.detail}")`:"";f.push(` \u2022 ${k.api_name}.${k.operation}${$} [${k.category}] L${k.line_number}`);}}}let T=Math.round((performance.now()-l)*100)/100,E=h>0?"precise":"heuristic",L=[];E==="heuristic"&&m>0&&L.push('\u5F53\u524D\u7ED3\u679C\u5747\u4E3A\u542F\u53D1\u5F0F\u5206\u6790\uFF0C\u4F7F\u7528 skimmer_index_project({ precision_mode: "precise" }) \u53EF\u83B7\u5F97\u8DE8\u6587\u4EF6 import/export \u7CBE\u786E\u7ED1\u5B9A');let _=H({durationMs:T,resultCount:m,backend:"indexed",precisionEffective:E,precisionWarnings:L.length>0?L:void 0});return f.push(`
598
+ ${W(f)}`}]};let m=new Map;for(let g of u){let N=`${g.category}:${g.apiName}`;m.has(N)||m.set(N,[]),m.get(N).push(g);}let y=[`\u{1F3F7}\uFE0F \u884C\u4E3A\u641C\u7D22\u7ED3\u679C \u2014 ${u.length} \u6761
599
+ `];for(let[g,N]of m){let[b,S]=g.split(":"),E=new Map;for(let L of N)E.has(L.operation)||E.set(L.operation,[]),E.get(L.operation).push(L);y.push(`\u{1F4C2} ${b} \u2192 ${S}:`);for(let[L,_]of E){y.push(` ${L}:`);let x=new Map;for(let A of _){let w=`${A.symbolName}|${A.filePath}`;x.has(w)||x.set(w,{item:A,callLines:[]}),x.get(w).callLines.push(A.line);}for(let{item:A,callLines:w}of x.values()){let P=A.detail?` key="${A.detail}"`:"",$=w.length>1?` \xD7${w.length} (L${w.join(", L")})`:` L${w[0]||A.startLine}`;y.push(` \u2022 ${A.symbolName}${P}${$} \u{1F4C4} ${A.filePath}:${Se(A.startLine,A.endLine)}`);}}y.push("");}return y.push(`\u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
600
+ ${W(f)}`),{content:[{type:"text",text:y.join(`
601
+ `)}]}}),s.registerTool("skimmer_get_call_graph",{title:"\u83B7\u53D6\u51FD\u6570\u8C03\u7528\u5173\u7CFB\u56FE\u8C31",description:"\u67E5\u770B\u51FD\u6570\u88AB\u8C01\u8C03\u7528\uFF08callers\uFF09\u4EE5\u53CA\u5B83\u8C03\u7528\u4E86\u4EC0\u4E48\uFF08callees\uFF09\u3002project_path \u53EF\u7701\u7565\u3002",inputSchema:z$1.object({symbol_name:z$1.string().describe("\u51FD\u6570\u540D"),project_path:z$1.string().optional().describe(ye),file_path:z$1.string().optional().describe("\u6587\u4EF6\u8DEF\u5F84\uFF08\u540C\u540D\u51FD\u6570\u65F6\u7528\u4E8E\u7CBE\u786E\u5B9A\u4F4D\uFF09"),direction:z$1.enum(["callers","callees","both"]).optional().default("both"),arg_keyword:z$1.string().optional().describe('\u8C03\u7528\u53C2\u6570\u5173\u952E\u5B57\u8FC7\u6EE4\uFF08\u5982 "storageParams"\uFF09'),auto_precise:z$1.boolean().optional().default(true).describe("\u5F53\u5B58\u5728 watcher/heuristic \u4EA7\u751F\u7684 precise pending \u65F6\uFF0C\u67E5\u8BE2\u524D\u81EA\u52A8\u6309\u9884\u7B97\u8865\u7B97 precise\uFF08\u9ED8\u8BA4 true\uFF09"),max_precise_files:z$1.number().optional().default(20).describe("auto_precise \u5355\u6B21\u6700\u591A\u8865\u7B97\u6587\u4EF6\u6570\uFF08\u9ED8\u8BA4 20\uFF09")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({symbol_name:t,project_path:n,file_path:r,direction:i,arg_keyword:o,auto_precise:a,max_precise_files:c})=>{let l=performance.now(),{db:p,projectRoot:u}=e.getContext(n),d=await Gn(e,u,p,a!==false,Math.max(1,c||20)),h=p.getSymbolByName(t,r),f=[`\u{1F4CA} ${t} \u7684\u8C03\u7528\u56FE\u8C31
602
+ `];f.push(...qn(d));let m=0,y=0,g=[],N=[],b=void 0;if(i==="callers"||i==="both"){if(g=p.getCallers(t,b,o),m+=g.length,y+=g.filter(x=>x.edge_kind==="precise").length,f.push(`\u2B06\uFE0F \u88AB\u8C03\u7528 (${g.length} \u5904):`),g.length===0)f.push(" \uFF08\u672A\u627E\u5230\u8C03\u7528\u8005\uFF09");else {let x={method_call:"",template_event:"\u{1F5BC}\uFE0F",jsx_event:"\u269B\uFE0F",hook_call:"\u{1FA9D}",import_call:"\u{1F4E5}",router_call:"\u{1F6E3}\uFE0F",store_dispatch:"\u{1F4E6}",store_commit:"\u{1F4E6}",constructor_call:"\u{1F195}"};for(let A of g){let w=A.args?` \u53C2\u6570: "${A.args}"`:"",P=A.source_kind||"",$=A.edge_kind||"",H=x[P]?` ${x[P]}`:"",oe=$==="precise"?" [\u{1F3AF}precise]":"";f.push(` \u2022 ${A.caller_name} [${A.category}]${H}${oe} \u{1F4C4} ${A.file_path}:L${A.start_line}${w}`);}}f.push("");}if((i==="callees"||i==="both")&&h){if(N=p.getCallees(h.id),m+=N.length,y+=N.filter(x=>x.edge_kind==="precise").length,f.push(`\u2B07\uFE0F \u8C03\u7528\u4E86 (${N.length} \u4E2A):`),N.length===0)f.push(" \uFF08\u672A\u5206\u6790\u5230\u8C03\u7528\u5173\u7CFB\uFF09");else for(let x of N){let A=x.args?`("${x.args}")`:"",P=(x.edge_kind||"")==="precise"?" [\u{1F3AF}precise]":"";f.push(` \u2022 ${x.callee_name}${A} [${x.call_type}]${P} L${x.line_number}`);}f.push("");}if(h){let{behaviors:x}=p.getFileOutline(h.file_path),A=x.filter(w=>w.symbol_id===h.id);if(A.length>0){f.push("\u{1F4E6} \u5916\u90E8\u72B6\u6001\u64CD\u4F5C:");for(let w of A){let P=w.detail?` ("${w.detail}")`:"";f.push(` \u2022 ${w.api_name}.${w.operation}${P} [${w.category}] L${w.line_number}`);}}}let S=Math.round((performance.now()-l)*100)/100,E=y>0?"precise":"heuristic",L=[];E==="heuristic"&&m>0&&L.push('\u5F53\u524D\u7ED3\u679C\u4E3A\u542F\u53D1\u5F0F\u8FB9\uFF1B\u5982\u5B58\u5728\u540C\u540D\u7B26\u53F7\u3001\u91CD\u5BFC\u51FA\u6216\u590D\u6742 import\uFF0C\u53EF\u7528 skimmer_index_project({ precision_mode: "precise" }) \u8FDB\u4E00\u6B65\u6D88\u6B67');let _=X({durationMs:S,resultCount:m,backend:"indexed",precisionEffective:E,precisionWarnings:L.length>0?L:void 0});return f.push(`
581
603
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
582
604
  ${W(_)}`),{content:[{type:"text",text:f.join(`
583
- `)}]}}),o.registerTool("skimmer_get_blast_radius",{title:"\u8BC4\u4F30\u4FEE\u6539\u5F71\u54CD\u8303\u56F4",description:"\u5206\u6790\u4FEE\u6539\u67D0\u51FD\u6570\u4F1A\u5F71\u54CD\u54EA\u4E9B\u8C03\u7528\u70B9\uFF0C\u7ED9\u51FA\u98CE\u9669\u7B49\u7EA7\u3002\u4FEE\u6539\u524D\u8C03\u7528\u8BC4\u4F30\u98CE\u9669\u3002project_path \u53EF\u7701\u7565\u3002",inputSchema:z$1.object({symbol_name:z$1.string().describe("\u8981\u4FEE\u6539\u7684\u51FD\u6570\u540D"),project_path:z$1.string().optional().describe(Ee),file_path:z$1.string().optional().describe("\u6587\u4EF6\u8DEF\u5F84\uFF08\u540C\u540D\u65F6\u7CBE\u786E\u5B9A\u4F4D\uFF09"),auto_precise:z$1.boolean().optional().default(true).describe("\u5F53\u5B58\u5728 watcher/heuristic \u4EA7\u751F\u7684 precise pending \u65F6\uFF0C\u67E5\u8BE2\u524D\u81EA\u52A8\u6309\u9884\u7B97\u8865\u7B97 precise\uFF08\u9ED8\u8BA4 true\uFF09"),max_precise_files:z$1.number().optional().default(20).describe("auto_precise \u5355\u6B21\u6700\u591A\u8865\u7B97\u6587\u4EF6\u6570\uFF08\u9ED8\u8BA4 20\uFF09")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({symbol_name:t,project_path:n,file_path:r,auto_precise:s,max_precise_files:i})=>{let a=performance.now(),{db:c,projectRoot:l}=e.getContext(n),p=await Pn(e,l,c,s!==false,Math.max(1,i||20)),u=c.getSymbolByName(t,r),d=c.getCallers(t),{behaviors:g}=u?c.getFileOutline(u.file_path):{behaviors:[]},f=u?g.filter(E=>E.symbol_id===u.id):[],m=d.length===0?"\u{1F7E2}":d.length<=3?"\u{1F7E1}":"\u{1F534}",h=d.length===0?"\u4F4E":d.length<=3?"\u4E2D":"\u9AD8",b=[`\u{1F4A5} \u4FEE\u6539 ${t} \u7684\u5F71\u54CD\u8BC4\u4F30`,"\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",...On(p),`${m} \u98CE\u9669\u7B49\u7EA7: ${h} (${d.length} \u5904\u76F4\u63A5\u8C03\u7528)`,""],S={method_call:"\u{1F4DE} \u65B9\u6CD5\u8C03\u7528",template_event:"\u{1F5BC}\uFE0F \u6A21\u677F\u4E8B\u4EF6",jsx_event:"\u269B\uFE0F JSX\u4E8B\u4EF6",hook_call:"\u{1FA9D} Hook\u8C03\u7528",import_call:"\u{1F4E5} \u5BFC\u5165\u8C03\u7528",router_call:"\u{1F6E3}\uFE0F \u8DEF\u7531",store_dispatch:"\u{1F4E6} Store",store_commit:"\u{1F4E6} Commit"};if(d.length>0?(b.push("\u{1F534} \u76F4\u63A5\u5F71\u54CD:"),d.forEach((E,L)=>{let _=E.source_kind||"",N=S[_]?` ${S[_]}`:"";b.push(` ${L+1}. ${E.caller_name} [${E.category}]${N} \u{1F4C4} ${E.file_path}:L${E.start_line}`);}),b.push("")):b.push(`\u2705 \u65E0\u8C03\u7528\u8005\uFF0C\u5F71\u54CD\u8303\u56F4\u53EF\u63A7
584
- `),u){let E=c.getFileDependencies(u.file_path,"to");if(E.length>0){b.push(`\u{1F4C2} \u6587\u4EF6\u4F9D\u8D56 (${E.length} \u4E2A\u6587\u4EF6 import \u4E86\u6B64\u6587\u4EF6):`);let L={import:"\u{1F4E5}",re_export:"\u{1F504}",component_ref:"\u{1F9E9}",store_ref:"\u{1F4E6}",api_ref:"\u{1F310}"};E.slice(0,10).forEach(_=>{b.push(` ${L[_.dependency_kind]||"\u2022"} ${_.from_file} (${_.dependency_kind})`);}),b.push("");}}if(f.length>0){b.push("\u{1F4E6} \u5916\u90E8\u72B6\u6001\u5F71\u54CD:");for(let E of f)b.push(` \u2022 ${E.api_name}.${E.operation}${E.detail?` key="${E.detail}"`:""} [${E.category}]`);b.push(`
585
- \u26A0\uFE0F \u4FEE\u6539\u65F6\u6CE8\u610F\u5916\u90E8\u72B6\u6001\u7684\u8BFB\u5199\u683C\u5F0F\u4FDD\u6301\u4E00\u81F4`);}let y=Math.round((performance.now()-a)*100)/100,T=H({durationMs:y,resultCount:d.length,backend:"indexed"});return b.push(`
605
+ `)}]}}),s.registerTool("skimmer_get_blast_radius",{title:"\u8BC4\u4F30\u4FEE\u6539\u5F71\u54CD\u8303\u56F4",description:"\u5206\u6790\u4FEE\u6539\u67D0\u51FD\u6570\u4F1A\u5F71\u54CD\u54EA\u4E9B\u8C03\u7528\u70B9\uFF0C\u7ED9\u51FA\u98CE\u9669\u7B49\u7EA7\u3002\u4FEE\u6539\u524D\u8C03\u7528\u8BC4\u4F30\u98CE\u9669\u3002project_path \u53EF\u7701\u7565\u3002",inputSchema:z$1.object({symbol_name:z$1.string().describe("\u8981\u4FEE\u6539\u7684\u51FD\u6570\u540D"),project_path:z$1.string().optional().describe(ye),file_path:z$1.string().optional().describe("\u6587\u4EF6\u8DEF\u5F84\uFF08\u540C\u540D\u65F6\u7CBE\u786E\u5B9A\u4F4D\uFF09"),auto_precise:z$1.boolean().optional().default(true).describe("\u5F53\u5B58\u5728 watcher/heuristic \u4EA7\u751F\u7684 precise pending \u65F6\uFF0C\u67E5\u8BE2\u524D\u81EA\u52A8\u6309\u9884\u7B97\u8865\u7B97 precise\uFF08\u9ED8\u8BA4 true\uFF09"),max_precise_files:z$1.number().optional().default(20).describe("auto_precise \u5355\u6B21\u6700\u591A\u8865\u7B97\u6587\u4EF6\u6570\uFF08\u9ED8\u8BA4 20\uFF09")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({symbol_name:t,project_path:n,file_path:r,auto_precise:i,max_precise_files:o})=>{let a=performance.now(),{db:c,projectRoot:l}=e.getContext(n),p=await Gn(e,l,c,i!==false,Math.max(1,o||20)),u=c.getSymbolByName(t,r),d=c.getCallers(t),{behaviors:h}=u?c.getFileOutline(u.file_path):{behaviors:[]},f=u?h.filter(E=>E.symbol_id===u.id):[],m=d.length===0?"\u{1F7E2}":d.length<=3?"\u{1F7E1}":"\u{1F534}",y=d.length===0?"\u4F4E":d.length<=3?"\u4E2D":"\u9AD8",g=[`\u{1F4A5} \u4FEE\u6539 ${t} \u7684\u5F71\u54CD\u8BC4\u4F30`,"\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",...qn(p),`${m} \u98CE\u9669\u7B49\u7EA7: ${y} (${d.length} \u5904\u76F4\u63A5\u8C03\u7528)`,""],N={method_call:"\u{1F4DE} \u65B9\u6CD5\u8C03\u7528",template_event:"\u{1F5BC}\uFE0F \u6A21\u677F\u4E8B\u4EF6",jsx_event:"\u269B\uFE0F JSX\u4E8B\u4EF6",hook_call:"\u{1FA9D} Hook\u8C03\u7528",import_call:"\u{1F4E5} \u5BFC\u5165\u8C03\u7528",router_call:"\u{1F6E3}\uFE0F \u8DEF\u7531",store_dispatch:"\u{1F4E6} Store",store_commit:"\u{1F4E6} Commit",constructor_call:"\u{1F195} \u6784\u9020\u5B9E\u4F8B"};if(d.length>0?(g.push("\u{1F534} \u76F4\u63A5\u5F71\u54CD:"),d.forEach((E,L)=>{let _=E.source_kind||"",x=N[_]?` ${N[_]}`:"";g.push(` ${L+1}. ${E.caller_name} [${E.category}]${x} \u{1F4C4} ${E.file_path}:L${E.start_line}`);}),g.push("")):g.push(`\u2705 \u65E0\u8C03\u7528\u8005\uFF0C\u5F71\u54CD\u8303\u56F4\u53EF\u63A7
606
+ `),u){let E=c.getFileDependencies(u.file_path,"to");if(E.length>0){g.push(`\u{1F4C2} \u6587\u4EF6\u4F9D\u8D56 (${E.length} \u4E2A\u6587\u4EF6 import \u4E86\u6B64\u6587\u4EF6):`);let L={import:"\u{1F4E5}",re_export:"\u{1F504}",component_ref:"\u{1F9E9}",store_ref:"\u{1F4E6}",api_ref:"\u{1F310}"};E.slice(0,10).forEach(_=>{g.push(` ${L[_.dependency_kind]||"\u2022"} ${_.from_file} (${_.dependency_kind})`);}),g.push("");}}if(f.length>0){g.push("\u{1F4E6} \u5916\u90E8\u72B6\u6001\u5F71\u54CD:");for(let E of f)g.push(` \u2022 ${E.api_name}.${E.operation}${E.detail?` key="${E.detail}"`:""} [${E.category}]`);g.push(`
607
+ \u26A0\uFE0F \u4FEE\u6539\u65F6\u6CE8\u610F\u5916\u90E8\u72B6\u6001\u7684\u8BFB\u5199\u683C\u5F0F\u4FDD\u6301\u4E00\u81F4`);}let b=Math.round((performance.now()-a)*100)/100,S=X({durationMs:b,resultCount:d.length,backend:"indexed"});return g.push(`
586
608
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
587
- ${W(T)}`),{content:[{type:"text",text:b.join(`
588
- `)}]}}),o.registerTool("skimmer_trace_data_lifecycle",{title:"\u53D8\u91CF\u5B8C\u6574\u751F\u547D\u5468\u671F\u8FFD\u8E2A\uFF08\u4E00\u952E\u7248\uFF09",description:`\u2B50 \u3010\u9996\u9009\u5DE5\u5177\u3011\u8FFD\u8E2A\u53D8\u91CF/\u72B6\u6001\u7684\u5B8C\u6574\u6570\u636E\u751F\u547D\u5468\u671F\uFF0C\u4E00\u6B21\u8C03\u7528\u805A\u5408 4 \u4E2A\u7EF4\u5EA6\uFF0C\u66FF\u4EE3\u8FC7\u53BB\u591A\u6B65\u624B\u52A8\u8FFD\u8E2A\u3002
609
+ ${W(S)}`),{content:[{type:"text",text:g.join(`
610
+ `)}]}}),s.registerTool("skimmer_trace_data_lifecycle",{title:"\u53D8\u91CF\u5B8C\u6574\u751F\u547D\u5468\u671F\u8FFD\u8E2A\uFF08\u4E00\u952E\u7248\uFF09",description:`\u2B50 \u3010\u9996\u9009\u5DE5\u5177\u3011\u8FFD\u8E2A\u53D8\u91CF/\u72B6\u6001\u7684\u5B8C\u6574\u6570\u636E\u751F\u547D\u5468\u671F\uFF0C\u4E00\u6B21\u8C03\u7528\u805A\u5408 4 \u4E2A\u7EF4\u5EA6\uFF0C\u66FF\u4EE3\u8FC7\u53BB\u591A\u6B65\u624B\u52A8\u8FFD\u8E2A\u3002
589
611
 
590
612
  \u{1F3AF} \u89E6\u53D1\u89C4\u5219\uFF08\u9047\u5230\u4EE5\u4E0B\u4EFB\u610F\u4E00\u79CD\u95EE\u9898\uFF0C\u76F4\u63A5\u4F7F\u7528\u672C\u5DE5\u5177\uFF09\uFF1A
591
613
  - "xxx \u662F\u4ECE\u54EA\u91CC\u6765\u7684\uFF1F" / "xxx \u662F\u600E\u4E48\u8D4B\u503C\u7684\uFF1F"
@@ -603,39 +625,39 @@ ${W(T)}`),{content:[{type:"text",text:b.join(`
603
625
  \u65E7\u65B9\u5F0F: trace_assignments \u2192 find_symbol \u2192 get_code_slice \u2192 find_by_behavior \u2192 trace_key_flow
604
626
  \u65B0\u65B9\u5F0F: skimmer_trace_data_lifecycle({ variable: "xxx" }) \u2190 \u76F4\u63A5\u5F97\u5230\u5168\u90E8
605
627
 
606
- project_path \u53EF\u7701\u7565\u3002`,inputSchema:z$1.object({variable:z$1.string().describe('\u8981\u8FFD\u8E2A\u7684\u53D8\u91CF\u540D\u6216 key\uFF0C\u5982 "storageParams" / "savedData"'),project_path:z$1.string().optional().describe(Ee),file_path:z$1.string().optional().describe('\u9650\u5B9A\u6587\u4EF6\u8DEF\u5F84\uFF08\u5305\u542B\u5373\u53EF\uFF0C\u5982 "src/views/apply/index.vue"\uFF09'),storage_api:z$1.enum(["localStorage","sessionStorage","all"]).optional().default("all").describe("storage \u843D\u70B9\u8FC7\u6EE4"),max_depth:z$1.number().optional().default(2).describe("storage \u94FE\u8DEF\u5411\u4E0B\u8FFD\u8E2A\u6DF1\u5EA6\uFF081-5\uFF09"),limit:z$1.number().optional().default(40).describe("\u6BCF\u7EF4\u5EA6\u6700\u5927\u7ED3\u679C\u6570")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({variable:t,project_path:n,file_path:r,storage_api:s,max_depth:i,limit:a})=>{let c=performance.now(),{db:l}=e.getContext(n),p=Math.min(5,Math.max(1,i||2)),u=Math.min(120,Math.max(1,a||40)),d=l.listFiles(r),g="",f=In(l,d,r?d.length:5);f.stale&&(g=`\u26A0\uFE0F [\u7D22\u5F15\u5DF2\u8FC7\u671F] \u4EE5\u4E0B\u6587\u4EF6\u5DF2\u4FEE\u6539\u4F46\u7D22\u5F15\u672A\u66F4\u65B0\uFF0C\u2462 \u53C2\u6570\u4F20\u9012 \u548C \u2464 storage \u94FE\u8DEF\u7684\u884C\u53F7\u53EF\u80FD\u504F\u79FB:
607
- `+f.staleFilePaths.slice(0,3).map(x=>` \u2022 ${x}`).join(`
628
+ project_path \u53EF\u7701\u7565\u3002`,inputSchema:z$1.object({variable:z$1.string().describe('\u8981\u8FFD\u8E2A\u7684\u53D8\u91CF\u540D\u6216 key\uFF0C\u5982 "storageParams" / "savedData"'),project_path:z$1.string().optional().describe(ye),file_path:z$1.string().optional().describe('\u9650\u5B9A\u6587\u4EF6\u8DEF\u5F84\uFF08\u5305\u542B\u5373\u53EF\uFF0C\u5982 "src/views/apply/index.vue"\uFF09'),storage_api:z$1.enum(["localStorage","sessionStorage","all"]).optional().default("all").describe("storage \u843D\u70B9\u8FC7\u6EE4"),max_depth:z$1.number().optional().default(2).describe("storage \u94FE\u8DEF\u5411\u4E0B\u8FFD\u8E2A\u6DF1\u5EA6\uFF081-5\uFF09"),limit:z$1.number().optional().default(40).describe("\u6BCF\u7EF4\u5EA6\u6700\u5927\u7ED3\u679C\u6570")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({variable:t,project_path:n,file_path:r,storage_api:i,max_depth:o,limit:a})=>{let c=performance.now(),{db:l}=e.getContext(n),p=Math.min(5,Math.max(1,o||2)),u=Math.min(120,Math.max(1,a||40)),d=l.listFiles(r),h="",f=Bn(l,d,r?d.length:5);f.stale&&(h=`\u26A0\uFE0F [\u7D22\u5F15\u5DF2\u8FC7\u671F] \u4EE5\u4E0B\u6587\u4EF6\u5DF2\u4FEE\u6539\u4F46\u7D22\u5F15\u672A\u66F4\u65B0\uFF0C\u2462 \u53C2\u6570\u4F20\u9012 \u548C \u2464 storage \u94FE\u8DEF\u7684\u884C\u53F7\u53EF\u80FD\u504F\u79FB:
629
+ `+f.staleFilePaths.slice(0,3).map(T=>` \u2022 ${T}`).join(`
608
630
  `)+`
609
631
  \u5EFA\u8BAE: skimmer_index_project({ force: true })
610
- `);let m=jn(d,t,20),h=[...new Set(m.map(x=>x.alias).filter(x=>x!==t))],b=Mn(d,t,20),S=[...new Set(b.map(x=>x.alias).filter(x=>x!==t))],y=[...new Set([...h,...S])],E=[t,...y],L=l.exactSearch(t,"state",void 0,r||void 0),_={vue2:"Vue2 data()",vue3:"Vue3 ref/reactive",react:"React useState/useRef"},N=L.filter(x=>x.default_value!=null).map(x=>({filePath:x.file_path,line:x.start_line,kind:`data_init(${_[x.framework]||x.framework})`,text:`${x.name}: ${x.default_value} \u2190 \u58F0\u660E\u521D\u59CB\u5316`})),A=false,k=l.getAssignments(t,r,u),$=[];k.length>0?($=k.map(x=>({filePath:x.file_path,line:x.line_number,kind:x.kind,text:x.text_snippet||"",sourceLayer:x.source_layer||void 0})),A=true):$=Kt(d,t,false,u);for(let x of y){let I=l.getAssignments(x,r,Math.floor(u/2));I.length>0?$.push(...I.map(R=>({filePath:R.file_path,line:R.line_number,kind:R.kind,text:R.text_snippet||"",sourceLayer:R.source_layer||void 0}))):$.push(...Kt(d,x,false,Math.floor(u/2)));}let P=$.length===0?Ie(d,Fn(t,false),u):[],B=new Map;for(let x of [...N,...$.length>0?$:P]){let I=`${x.filePath}:${x.line}`;B.has(I)||B.set(I,x);}let re=[...B.values()],ye=false,Ae=l.getPropertyWrites(t,void 0,r,u),J=[];Ae.length>0?(J=Ae.map(x=>({filePath:x.file_path,line:x.line_number,kind:x.kind,text:x.text_snippet||"",sourceLayer:x.source_layer||void 0})),ye=true):J=ht(d,t,void 0,u);for(let x of y){let I=l.getPropertyWrites(x,void 0,r,Math.floor(u/2));I.length>0?J.push(...I.map(R=>({filePath:R.file_path,line:R.line_number,kind:R.kind,text:R.text_snippet||"",sourceLayer:R.source_layer||void 0}))):J.push(...ht(d,x,void 0,Math.floor(u/2)));}let le=J.length===0?Ie(d,[{kind:"dot",regex:new RegExp(`\\b${t}\\.[A-Za-z_$][\\w$]*\\s*(?:=|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^=|&&=|\\|\\|=|\\?\\?=`)},{kind:"bracket",regex:new RegExp(`\\b${t}\\s*\\[(?:'[^']+'|"[^"]+")\\]\\s*(?:=|\\+=)`)},{kind:"delete",regex:new RegExp(`\\bdelete\\s+${t}\\.[A-Za-z_$][\\w$]*\\b`)}],u):[],X=J.length>0?J:le,ie=l.findRelationsByArgKeyword(t,r,u);for(let x of y)ie.push(...l.findRelationsByArgKeyword(x,r,Math.floor(u/2)));let Gt=[],qt=[],Yt=[];for(let x of E){let I=Ke(x),R=/^[a-zA-Z_$][\w$]*$/.test(x)?"\\b":"";Gt.push({kind:"template",regex:new RegExp(`(?::\\w+|v-model|v-if|v-show|@\\w+)="[^"]*${R}${I}${R}|\\{\\{[^}]*${R}${I}${R}[^}]*\\}\\}`)},{kind:"return",regex:new RegExp(`\\breturn\\b[^=]*${R}${I}${R}`)},{kind:"watch",regex:new RegExp(`watch[^(]*['"]\\.?${I}['"]`)},{kind:"computed_read",regex:new RegExp(`=>[^=]*${R}${I}${R}|return[^=]*${R}${I}${R}`)},{kind:"arg_usage",regex:new RegExp(`\\(\\s*[^)]*${R}${I}${R}[^)]*\\)`)}),qt.push(`${R}${I}${R}\\s*(?:=|\\+=|-=|\\*=|\\/=)(?!=)|\\b(?:const|let|var)\\s+${I}\\b`),Yt.push(`${R}${I}${R}\\.\\w+\\s*(?:=|\\+=|-=)(?!=)|${R}${I}${R}\\s*\\[`);}let qn=Ie(d,Gt,u),Yn=new RegExp(qt.join("|")),Jn=new RegExp(Yt.join("|")),Pe=qn.filter(x=>!Yn.test(x.text)&&!Jn.test(x.text)),_t=new Map,Jt=(x,I)=>{if(!_t.has(x)){let{behaviors:F}=l.getFileOutline(x),O=new Map;for(let j of F){let ee=String(j.symbol_name||"");O.has(ee)||O.set(ee,[]),O.get(ee).push(j);}_t.set(x,O);}return (_t.get(x)?.get(I)||[]).filter(F=>String(F.category||"")!=="storage"?false:s==="all"?true:String(F.api_name||"").toLowerCase()===s.toLowerCase())},Zn=(x,I)=>{let R=[],F=[{name:x,filePath:I,path:[x],level:0}],O=new Set([`${I}::${x}`]);for(;F.length>0;){let j=F.shift(),ee=Jt(j.filePath,j.name);if(ee.length>0){R.push({path:j.path,file:j.filePath,behaviors:ee});continue}if(j.level>=p)continue;let Z=l.getSymbolByName(j.name,j.filePath);if(Z||(Z=l.getSymbolByName(j.name)),!Z)continue;let pe=String(Z.file_path||Z.abs_path||j.filePath),Oe=Jt(pe,j.name);if(Oe.length>0){R.push({path:j.path,file:pe,behaviors:Oe});continue}let Nt=l.getCallees(Z.id);for(let Fe of Nt){let De=String(Fe.callee_name||"");if(!De||De.startsWith("$"))continue;let Qt=`${pe}::${De}`;O.has(Qt)||(O.add(Qt),F.push({name:De,filePath:pe,path:[...j.path,De],level:j.level+1}));}}return R},Qn=y.length>0?`
611
- \u{1F517} \u53D1\u73B0\u522B\u540D: ${y.map(x=>`"${x}"`).join(", ")}\uFF08\u5DF2\u4E00\u5E76\u8FFD\u8E2A\u5C5E\u6027\u4FEE\u6539\uFF09`:"",Le=[];b.length>0&&(Le.push(` \u{1F517} \u5F15\u7528\u522B\u540D\u4F20\u64AD (${b.length} \u5904) \u2014 \u8FD9\u4E9B\u5C40\u90E8\u53D8\u91CF\u662F "${t}" \u7684\u5F15\u7528\uFF0C\u5176\u5C5E\u6027\u4FEE\u6539\u4E5F\u88AB\u8FFD\u8E2A:`),b.slice(0,10).forEach(x=>{let R=d.find(j=>j.path===x.filePath)?.abs_path||x.abs_path,F=gt("alias_ref"),O=R?Xt(R,x.line,2):{snippet:""};Le.push(` \u{1F4C4} ${x.filePath}:L${x.line} "${x.alias}" = ... ${F}`),Le.push(` ${x.text}`),O.snippet&&Le.push(O.snippet);}));let C=[`\u{1F52C} \u53D8\u91CF\u751F\u547D\u5468\u671F\u8FFD\u8E2A: "${t}"`,"\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u8FC7\u6EE4: file_path=${r||"*"} storage_api=${s} depth=${p}${Qn}`,""];if(g&&C.push(g),C.push(`\u2460 \u58F0\u660E & \u6574\u4F53\u8D4B\u503C (${re.length} \u5904)`),re.length===0)C.push(" \uFF08\u672A\u627E\u5230\uFF09");else {let x={init:[],cache:[],user:[],unknown:[]};for(let R of re){let F=R.sourceLayer||ne(R.text,R.line);x[F].push(R);}let I=["init","cache","user","unknown"];for(let R of I){let F=x[R];!F||F.length===0||(C.push(` \u25B8 ${Dn[R]} (${F.length} \u5904)`),F.slice(0,8).forEach(O=>{let j=y.includes(O.text.split("=")[0]?.trim().replace(/^(?:const|let|var)\s+/,"")||""),ee=gt(O.kind,j);C.push(` \u{1F4C4} ${O.filePath}:L${O.line} [${O.kind}] ${ee}`),C.push(` ${O.text}`);}));}Le.length>0&&(C.push(""),C.push(...Le));}if(C.push(""),C.push(`\u2461 \u5C5E\u6027\u4FEE\u6539 (${X.length} \u5904)`),X.length===0)C.push(' \uFF08\u672A\u627E\u5230 object.prop \u6216 object["prop"] \u5199\u5165\uFF09'),y.length>0&&C.push(` \u2139\uFE0F \u5DF2\u8FFD\u8E2A\u522B\u540D: ${y.map(x=>`"${x}"`).join(", ")} \u7684\u5C5E\u6027\u4FEE\u6539\uFF08\u5982\u4ECD\u672A\u627E\u5230\uFF0C\u8868\u793A\u771F\u6B63\u65E0\u95F4\u63A5\u5199\u5165\uFF09`);else {let x={init:[],cache:[],user:[],unknown:[]};for(let R of X){let F=R.sourceLayer||ne(R.text,R.line);x[F].push(R);}let I=["init","cache","user","unknown"];for(let R of I){let F=x[R];!F||F.length===0||(C.push(` \u25B8 ${Dn[R]} (${F.length} \u5904)`),F.slice(0,8).forEach(O=>{let j=y.some(Fe=>O.text.startsWith(Fe)),ee=gt(O.kind,j),pe=d.find(Fe=>Fe.path===O.filePath)?.abs_path||"",Oe=pe?Xt(pe,O.line,2):{snippet:""},Nt=j?" \u{1F517}(via alias)":"";C.push(` \u{1F4C4} ${O.filePath}:L${O.line} [${O.kind}] ${ee}${Nt}`),Oe.snippet&&C.push(Oe.snippet);}));}}if(C.push(""),C.push(`\u2462 \u4F5C\u4E3A\u53C2\u6570\u88AB\u4F20\u5165\u8C03\u7528 (${ie.length} \u5904)`),ie.length===0?C.push(" \uFF08\u672A\u53D1\u73B0\u4EE5\u8BE5\u53D8\u91CF\u4F5C\u4E3A\u53C2\u6570\u7684\u51FD\u6570\u8C03\u7528\uFF09"):ie.slice(0,20).forEach(x=>{let I=String(x.args||"");C.push(` \u{1F4C4} ${x.file_path}:L${x.line_number} ${x.caller_name} \u2192 ${x.callee_name} \u53C2\u6570: "${I}"`);}),C.push(""),C.push(`\u2463 \u8BFB\u53D6/\u4F7F\u7528 (${Pe.length} \u5904)`),Pe.length===0)C.push(" \uFF08\u672A\u53D1\u73B0 template \u7ED1\u5B9A / watch / computed / return \u4E2D\u7684\u5F15\u7528\uFF09");else {let x=new Map;for(let R of Pe)x.has(R.kind)||x.set(R.kind,[]),x.get(R.kind).push(R);let I={template:"\u{1F5BC}\uFE0F template \u7ED1\u5B9A",return:"\u21A9\uFE0F return \u8FD4\u56DE",watch:"\u{1F441}\uFE0F watch \u76D1\u542C",computed_read:"\u{1F9EE} computed \u5F15\u7528",arg_usage:"\u{1F4E8} \u51FD\u6570\u53C2\u6570\u4F7F\u7528"};for(let[R,F]of x)C.push(` \u25B8 ${I[R]||R}`),F.slice(0,8).forEach(O=>C.push(` \u{1F4C4} ${O.filePath}:L${O.line} ${O.text}`));}C.push("");let Re=0;C.push(`\u2464 Storage \u843D\u70B9\u8FFD\u8E2A (storage_api=${s}, depth=${p})`);let er=s==="localStorage"?"localStorage":s==="sessionStorage"?"sessionStorage":"(?:localStorage|sessionStorage)",tr=E.map(x=>({kind:"direct_storage",regex:new RegExp(`${er}\\.(?:setItem|getItem|removeItem|clear)\\(.*?\\b${Ke(x)}\\b`)})),Ve=Ie(d,tr,u);if(Ve.length>0&&(Re+=1,C.push(` \u843D\u70B9 [\u76F4\u63A5\u547D\u4E2D\u5B58\u50A8] ${gt("direct_storage")}:`),Ve.slice(0,15).forEach(x=>{let R=d.find(O=>O.path===x.filePath)?.abs_path||"",F=R?Xt(R,x.line,2):{snippet:""};C.push(` \u{1F4C4} ${x.filePath}:L${x.line} ${x.text.trim()}`),F.snippet&&C.push(F.snippet);})),ie.length===0&&Ve.length===0)C.push(" \uFF08\u672A\u53D1\u73B0\u76F4\u63A5 Storage \u64CD\u4F5C\uFF0C\u4E14\u65E0\u8C03\u7528\u5165\u53E3\u5C55\u5F00\u8FFD\u8E2A\uFF09");else {let x=new Map;for(let I of ie){let R=`${I.file_path}::${I.callee_name}`;x.has(R)||x.set(R,I);}for(let[,I]of x){let R=String(I.callee_name||""),F=String(I.file_path||""),O=Zn(R,F);O.length!==0&&(Re+=1,O.slice(0,3).forEach(j=>{let ee=j.file!==F?` \u2197 \u8DE8\u6587\u4EF6: ${j.file}`:"";C.push(` \u94FE\u8DEF: ${j.path.join(" \u2192 ")}${ee}`),j.behaviors.forEach(Z=>{let pe=Z.detail?`("${String(Z.detail)}")`:"";C.push(` \u843D\u70B9: ${Z.api_name}.${Z.operation}${pe} [${Z.category}] L${Z.line_number}`);});}));}Re===0&&Ve.length===0&&C.push(` \uFF08\u5728 depth=${p} \u5C42\u5185\u672A\u627E\u5230 storage \u5199\u5165\u94FE\u8DEF\uFF09`);}C.push(""),C.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");let nr=y.length>0?` (\u542B ${y.length} \u4E2A\u522B\u540D: ${y.slice(0,3).map(x=>`"${x}"`).join(", ")})`:"";C.push(`\u2705 \u6C47\u603B${nr}:`),C.push(` \u2460 \u58F0\u660E/\u8D4B\u503C: ${re.length} \u5904`),C.push(` \u2461 \u5C5E\u6027\u4FEE\u6539: ${X.length} \u5904 (\u5DF2\u8FFD\u8E2A\u522B\u540D: ${y.map(x=>`"${x}"`).join(", ")||"\u65E0"})`),C.push(` \u2462 \u53C2\u6570\u4F20\u9012: ${ie.length} \u5904`),C.push(` \u2463 \u8BFB\u53D6\u5F15\u7528: ${Pe.length} \u5904`),C.push(` \u2464 storage: ${Re>0?`\u2713 \u53D1\u73B0\u5199\u5165\u94FE\u8DEF (${Re} \u6761)`:"\u2717 \u672A\u53D1\u73B0"}`),C.push(""),C.push("\u{1F4A1} \u6765\u6E90\u5206\u5C42\u8BF4\u660E: \u{1F331}\u521D\u59CB\u5316 = lifecycle/data | \u{1F4BE}\u7F13\u5B58\u56DE\u663E = storage\u8BFB/fetch | \u{1F5B1}\uFE0F\u7528\u6237\u4EA4\u4E92 = \u4E8B\u4EF6/watch"),C.push("\u{1F4CA} \u7F6E\u4FE1\u5EA6: \u25CF\u25CF\u25CF\u25CF\u25CF \u226590% \u25CF\u25CF\u25CF\u25CF\u25CB \u226580% \u25CF\u25CF\u25CF\u25CB\u25CB \u226570% \u25CF\u25CF\u25CB\u25CB\u25CB \u226560% \u9700\u4EBA\u5DE5\u9A8C\u8BC1\u884C\u53F7\u786E\u8BA4");let rr=Math.round((performance.now()-c)*100)/100,sr=re.length+X.length+ie.length+Pe.length+Re,Zt=H({durationMs:rr,resultCount:sr,backend:A&&ye?"indexed":A||ye?"hybrid":"fallback_scan"});return f.stale&&(Zt.index_freshness=f),C.push(`
632
+ `);let m=Zn(d,t,20),y=[...new Set(m.map(T=>T.alias).filter(T=>T!==t))],g=Qn(d,t,20),N=[...new Set(g.map(T=>T.alias).filter(T=>T!==t))],b=[...new Set([...y,...N])],E=[t,...b],L=l.exactSearch(t,"state",void 0,r||void 0),_={vue2:"Vue2 data()",vue3:"Vue3 ref/reactive",react:"React useState/useRef"},x=L.filter(T=>T.default_value!=null).map(T=>({filePath:T.file_path,line:T.start_line,kind:`data_init(${_[T.framework]||T.framework})`,text:`${T.name}: ${T.default_value} \u2190 \u58F0\u660E\u521D\u59CB\u5316`})),A=false,w=l.getAssignments(t,r,u),P=[];w.length>0?(P=w.map(T=>({filePath:T.file_path,line:T.line_number,kind:T.kind,text:T.text_snippet||"",sourceLayer:T.source_layer||void 0})),A=true):P=tn(d,t,false,u);for(let T of b){let I=l.getAssignments(T,r,Math.floor(u/2));I.length>0?P.push(...I.map(R=>({filePath:R.file_path,line:R.line_number,kind:R.kind,text:R.text_snippet||"",sourceLayer:R.source_layer||void 0}))):P.push(...tn(d,T,false,Math.floor(u/2)));}let $=P.length===0?Oe(d,Yn(t,false),u):[],H=new Map;for(let T of [...x,...P.length>0?P:$]){let I=`${T.filePath}:${T.line}`;H.has(I)||H.set(I,T);}let oe=[...H.values()],Ne=false,ve=l.getPropertyWrites(t,void 0,r,u),Q=[];ve.length>0?(Q=ve.map(T=>({filePath:T.file_path,line:T.line_number,kind:T.kind,text:T.text_snippet||"",sourceLayer:T.source_layer||void 0})),Ne=true):Q=Lt(d,t,void 0,u);for(let T of b){let I=l.getPropertyWrites(T,void 0,r,Math.floor(u/2));I.length>0?Q.push(...I.map(R=>({filePath:R.file_path,line:R.line_number,kind:R.kind,text:R.text_snippet||"",sourceLayer:R.source_layer||void 0}))):Q.push(...Lt(d,T,void 0,Math.floor(u/2)));}let Ye=Q.length===0?Oe(d,[{kind:"dot",regex:new RegExp(`\\b${be(t)}\\.[A-Za-z_$][\\w$]*\\s*${qe}`)},{kind:"bracket",regex:new RegExp(`\\b${be(t)}\\s*\\[(?:'[^']+'|"[^"]+")\\]\\s*${qe}`)},{kind:"array_mutation",regex:new RegExp(`\\b${be(t)}\\.${tr}\\s*\\(`)},{kind:"delete",regex:new RegExp(`\\bdelete\\s+${be(t)}\\.[A-Za-z_$][\\w$]*\\b`)}],u):[],ke=Q.length>0?Q:Ye,Z=l.findRelationsByArgKeyword(t,r,u);for(let T of b)Z.push(...l.findRelationsByArgKeyword(T,r,Math.floor(u/2)));let J=[],Je=[],sn=[];for(let T of E){let I=be(T),R=/^[a-zA-Z_$][\w$]*$/.test(T)?"\\b":"";J.push({kind:"template",regex:new RegExp(`(?::\\w+|v-model|v-if|v-show|@\\w+)="[^"]*${R}${I}${R}|\\{\\{[^}]*${R}${I}${R}[^}]*\\}\\}`)},{kind:"return",regex:new RegExp(`\\breturn\\b[^=]*${R}${I}${R}`)},{kind:"watch",regex:new RegExp(`watch[^(]*['"]\\.?${I}['"]`)},{kind:"computed_read",regex:new RegExp(`=>[^=]*${R}${I}${R}|return[^=]*${R}${I}${R}`)},{kind:"arg_usage",regex:new RegExp(`\\(\\s*[^)]*${R}${I}${R}[^)]*\\)`)}),Je.push(`${R}${I}${R}\\s*(?:=|\\+=|-=|\\*=|\\/=)(?!=)|\\b(?:const|let|var)\\s+${I}\\b`),sn.push(`${R}${I}${R}\\.\\w+\\s*(?:=|\\+=|-=)(?!=)|${R}${I}${R}\\s*\\[`);}let pr=Oe(d,J,u),dr=new RegExp(Je.join("|")),ur=new RegExp(sn.join("|")),Me=pr.filter(T=>!dr.test(T.text)&&!ur.test(T.text)),kt=new Map,on=(T,I)=>{if(!kt.has(T)){let{behaviors:M}=l.getFileOutline(T),F=new Map;for(let j of M){let se=String(j.symbol_name||"");F.has(se)||F.set(se,[]),F.get(se).push(j);}kt.set(T,F);}return (kt.get(T)?.get(I)||[]).filter(M=>String(M.category||"")!=="storage"?false:i==="all"?true:String(M.api_name||"").toLowerCase()===i.toLowerCase())},fr=(T,I)=>{let R=[],M=[{name:T,filePath:I,path:[T],level:0}],F=new Set([`${I}::${T}`]);for(;M.length>0;){let j=M.shift(),se=on(j.filePath,j.name);if(se.length>0){R.push({path:j.path,file:j.filePath,behaviors:se});continue}if(j.level>=p)continue;let ee=l.getSymbolByName(j.name,j.filePath);if(ee||(ee=l.getSymbolByName(j.name)),!ee)continue;let de=String(ee.file_path||ee.abs_path||j.filePath),je=on(de,j.name);if(je.length>0){R.push({path:j.path,file:de,behaviors:je});continue}let Ct=l.getCallees(ee.id);for(let Be of Ct){let Ue=String(Be.callee_name||"");if(!Ue||Ue.startsWith("$"))continue;let cn=`${de}::${Ue}`;F.has(cn)||(F.add(cn),M.push({name:Ue,filePath:de,path:[...j.path,Ue],level:j.level+1}));}}return R},mr=b.length>0?`
633
+ \u{1F517} \u53D1\u73B0\u522B\u540D: ${b.map(T=>`"${T}"`).join(", ")}\uFF08\u5DF2\u4E00\u5E76\u8FFD\u8E2A\u5C5E\u6027\u4FEE\u6539\uFF09`:"",Ce=[];g.length>0&&(Ce.push(` \u{1F517} \u5F15\u7528\u522B\u540D\u4F20\u64AD (${g.length} \u5904) \u2014 \u8FD9\u4E9B\u5C40\u90E8\u53D8\u91CF\u662F "${t}" \u7684\u5F15\u7528\uFF0C\u5176\u5C5E\u6027\u4FEE\u6539\u4E5F\u88AB\u8FFD\u8E2A:`),g.slice(0,10).forEach(T=>{let R=d.find(j=>j.path===T.filePath)?.abs_path||T.abs_path,M=At("alias_ref"),F=R?en(R,T.line,2):{snippet:""};Ce.push(` \u{1F4C4} ${T.filePath}:L${T.line} "${T.alias}" = ... ${M}`),Ce.push(` ${T.text}`),F.snippet&&Ce.push(F.snippet);}));let C=[`\u{1F52C} \u53D8\u91CF\u751F\u547D\u5468\u671F\u8FFD\u8E2A: "${t}"`,"\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u8FC7\u6EE4: file_path=${r||"*"} storage_api=${i} depth=${p}${mr}`,""];if(h&&C.push(h),C.push(`\u2460 \u58F0\u660E & \u6574\u4F53\u8D4B\u503C (${oe.length} \u5904)`),oe.length===0)C.push(" \uFF08\u672A\u627E\u5230\uFF09");else {let T={init:[],cache:[],user:[],unknown:[]};for(let R of oe){let M=R.sourceLayer||re(R.text,R.line);T[M].push(R);}let I=["init","cache","user","unknown"];for(let R of I){let M=T[R];!M||M.length===0||(C.push(` \u25B8 ${Jn[R]} (${M.length} \u5904)`),M.slice(0,8).forEach(F=>{let j=b.includes(F.text.split("=")[0]?.trim().replace(/^(?:const|let|var)\s+/,"")||""),se=At(F.kind,j);C.push(` \u{1F4C4} ${F.filePath}:L${F.line} [${F.kind}] ${se}`),C.push(` ${F.text}`);}));}Ce.length>0&&(C.push(""),C.push(...Ce));}if(C.push(""),C.push(`\u2461 \u5C5E\u6027\u4FEE\u6539 (${ke.length} \u5904)`),ke.length===0)C.push(' \uFF08\u672A\u627E\u5230 object.prop \u6216 object["prop"] \u5199\u5165\uFF09'),b.length>0&&C.push(` \u2139\uFE0F \u5DF2\u8FFD\u8E2A\u522B\u540D: ${b.map(T=>`"${T}"`).join(", ")} \u7684\u5C5E\u6027\u4FEE\u6539\uFF08\u5982\u4ECD\u672A\u627E\u5230\uFF0C\u8868\u793A\u771F\u6B63\u65E0\u95F4\u63A5\u5199\u5165\uFF09`);else {let T={init:[],cache:[],user:[],unknown:[]};for(let R of ke){let M=R.sourceLayer||re(R.text,R.line);T[M].push(R);}let I=["init","cache","user","unknown"];for(let R of I){let M=T[R];!M||M.length===0||(C.push(` \u25B8 ${Jn[R]} (${M.length} \u5904)`),M.slice(0,8).forEach(F=>{let j=b.some(Be=>F.text.startsWith(Be)),se=At(F.kind,j),de=d.find(Be=>Be.path===F.filePath)?.abs_path||"",je=de?en(de,F.line,2):{snippet:""},Ct=j?" \u{1F517}(via alias)":"";C.push(` \u{1F4C4} ${F.filePath}:L${F.line} [${F.kind}] ${se}${Ct}`),je.snippet&&C.push(je.snippet);}));}}if(C.push(""),C.push(`\u2462 \u4F5C\u4E3A\u53C2\u6570\u88AB\u4F20\u5165\u8C03\u7528 (${Z.length} \u5904)`),Z.length===0?C.push(" \uFF08\u672A\u53D1\u73B0\u4EE5\u8BE5\u53D8\u91CF\u4F5C\u4E3A\u53C2\u6570\u7684\u51FD\u6570\u8C03\u7528\uFF09"):Z.slice(0,20).forEach(T=>{let I=String(T.args||"");C.push(` \u{1F4C4} ${T.file_path}:L${T.line_number} ${T.caller_name} \u2192 ${T.callee_name} \u53C2\u6570: "${I}"`);}),C.push(""),C.push(`\u2463 \u8BFB\u53D6/\u4F7F\u7528 (${Me.length} \u5904)`),Me.length===0)C.push(" \uFF08\u672A\u53D1\u73B0 template \u7ED1\u5B9A / watch / computed / return \u4E2D\u7684\u5F15\u7528\uFF09");else {let T=new Map;for(let R of Me)T.has(R.kind)||T.set(R.kind,[]),T.get(R.kind).push(R);let I={template:"\u{1F5BC}\uFE0F template \u7ED1\u5B9A",return:"\u21A9\uFE0F return \u8FD4\u56DE",watch:"\u{1F441}\uFE0F watch \u76D1\u542C",computed_read:"\u{1F9EE} computed \u5F15\u7528",arg_usage:"\u{1F4E8} \u51FD\u6570\u53C2\u6570\u4F7F\u7528"};for(let[R,M]of T)C.push(` \u25B8 ${I[R]||R}`),M.slice(0,8).forEach(F=>C.push(` \u{1F4C4} ${F.filePath}:L${F.line} ${F.text}`));}C.push("");let Ie=0;C.push(`\u2464 Storage \u843D\u70B9\u8FFD\u8E2A (storage_api=${i}, depth=${p})`);let gr=i==="localStorage"?"localStorage":i==="sessionStorage"?"sessionStorage":"(?:localStorage|sessionStorage)",hr=E.map(T=>({kind:"direct_storage",regex:new RegExp(`${gr}\\.(?:setItem|getItem|removeItem|clear)\\(.*?\\b${be(T)}\\b`)})),Qe=Oe(d,hr,u);if(Qe.length>0&&(Ie+=1,C.push(` \u843D\u70B9 [\u76F4\u63A5\u547D\u4E2D\u5B58\u50A8] ${At("direct_storage")}:`),Qe.slice(0,15).forEach(T=>{let R=d.find(F=>F.path===T.filePath)?.abs_path||"",M=R?en(R,T.line,2):{snippet:""};C.push(` \u{1F4C4} ${T.filePath}:L${T.line} ${T.text.trim()}`),M.snippet&&C.push(M.snippet);})),Z.length===0&&Qe.length===0)C.push(" \uFF08\u672A\u53D1\u73B0\u76F4\u63A5 Storage \u64CD\u4F5C\uFF0C\u4E14\u65E0\u8C03\u7528\u5165\u53E3\u5C55\u5F00\u8FFD\u8E2A\uFF09");else {let T=new Map;for(let I of Z){let R=`${I.file_path}::${I.callee_name}`;T.has(R)||T.set(R,I);}for(let[,I]of T){let R=String(I.callee_name||""),M=String(I.file_path||""),F=fr(R,M);F.length!==0&&(Ie+=1,F.slice(0,3).forEach(j=>{let se=j.file!==M?` \u2197 \u8DE8\u6587\u4EF6: ${j.file}`:"";C.push(` \u94FE\u8DEF: ${j.path.join(" \u2192 ")}${se}`),j.behaviors.forEach(ee=>{let de=ee.detail?`("${String(ee.detail)}")`:"";C.push(` \u843D\u70B9: ${ee.api_name}.${ee.operation}${de} [${ee.category}] L${ee.line_number}`);});}));}Ie===0&&Qe.length===0&&C.push(` \uFF08\u5728 depth=${p} \u5C42\u5185\u672A\u627E\u5230 storage \u5199\u5165\u94FE\u8DEF\uFF09`);}C.push(""),C.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");let yr=b.length>0?` (\u542B ${b.length} \u4E2A\u522B\u540D: ${b.slice(0,3).map(T=>`"${T}"`).join(", ")})`:"";C.push(`\u2705 \u6C47\u603B${yr}:`),C.push(` \u2460 \u58F0\u660E/\u8D4B\u503C: ${oe.length} \u5904`),C.push(` \u2461 \u5C5E\u6027\u4FEE\u6539: ${ke.length} \u5904 (\u5DF2\u8FFD\u8E2A\u522B\u540D: ${b.map(T=>`"${T}"`).join(", ")||"\u65E0"})`),C.push(` \u2462 \u53C2\u6570\u4F20\u9012: ${Z.length} \u5904`),C.push(` \u2463 \u8BFB\u53D6\u5F15\u7528: ${Me.length} \u5904`),C.push(` \u2464 storage: ${Ie>0?`\u2713 \u53D1\u73B0\u5199\u5165\u94FE\u8DEF (${Ie} \u6761)`:"\u2717 \u672A\u53D1\u73B0"}`),C.push(""),C.push("\u{1F4A1} \u6765\u6E90\u5206\u5C42\u8BF4\u660E: \u{1F331}\u521D\u59CB\u5316 = lifecycle/data | \u{1F4BE}\u7F13\u5B58\u56DE\u663E = storage\u8BFB/fetch | \u{1F5B1}\uFE0F\u7528\u6237\u4EA4\u4E92 = \u4E8B\u4EF6/watch"),C.push("\u{1F4CA} \u7F6E\u4FE1\u5EA6: \u25CF\u25CF\u25CF\u25CF\u25CF \u226590% \u25CF\u25CF\u25CF\u25CF\u25CB \u226580% \u25CF\u25CF\u25CF\u25CB\u25CB \u226570% \u25CF\u25CF\u25CB\u25CB\u25CB \u226560% \u9700\u4EBA\u5DE5\u9A8C\u8BC1\u884C\u53F7\u786E\u8BA4");let br=Math.round((performance.now()-c)*100)/100,Er=oe.length+ke.length+Z.length+Me.length+Ie,an=X({durationMs:br,resultCount:Er,backend:A&&Ne?"indexed":A||Ne?"hybrid":"fallback_scan"});return f.stale&&(an.index_freshness=f),C.push(`
612
634
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
613
- ${W(Zt)}`),{content:[{type:"text",text:C.join(`
614
- `)}]}});}function Xn(o,e){o.registerTool("skimmer_index_health",{title:"\u7D22\u5F15\u5065\u5EB7\u68C0\u67E5",description:`\u68C0\u67E5\u5F53\u524D\u9879\u76EE\u7D22\u5F15\u7684\u5065\u5EB7\u72B6\u6001\u3002
635
+ ${W(an)}`),{content:[{type:"text",text:C.join(`
636
+ `)}]}});}function ir(s,e){s.registerTool("skimmer_index_health",{title:"\u7D22\u5F15\u5065\u5EB7\u68C0\u67E5",description:`\u68C0\u67E5\u5F53\u524D\u9879\u76EE\u7D22\u5F15\u7684\u5065\u5EB7\u72B6\u6001\u3002
615
637
  \u8FD4\u56DE: \u7D22\u5F15\u6587\u4EF6\u6570\u3001\u7B26\u53F7\u6570\u3001\u5173\u7CFB\u6570\u3001\u884C\u4E3A\u6570\u3001\u6700\u540E\u66F4\u65B0\u65F6\u95F4\u3001\u5931\u8D25\u6587\u4EF6\u3001watcher \u72B6\u6001\u3001\u6570\u636E\u5E93\u5927\u5C0F\u3002
616
- project_path \u53EF\u7701\u7565\uFF08\u81EA\u52A8\u4F7F\u7528\u4E0A\u6B21\u7D22\u5F15\u7684\u9879\u76EE\uFF09\u3002`,inputSchema:z$1.object({project_path:z$1.string().optional().describe("\u9879\u76EE\u6839\u76EE\u5F55\uFF08\u53EF\u7701\u7565\uFF0C\u4F7F\u7528\u4E0A\u6B21\u7D22\u5F15\u7684\u9879\u76EE\uFF09")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({project_path:t})=>{let n=performance.now(),{db:r,projectRoot:s}=e.getContext(t),i=r.getProjectStats(),a=(()=>{try{let T=r.getLastIndexedTime();return T?new Date(T).toISOString():"\u6682\u65E0\u7D22\u5F15\u6570\u636E"}catch{return "\u6682\u65E0\u7D22\u5F15\u6570\u636E"}})(),c=i.fileCount||0,l=i.symbolCount||0,p=r.getIndexFailures(10),u=e.hasWatcher(s),f=e.listProjects().find(T=>T.root===s)?.dbPath||"",m=i.dbSize||0,h={dbPath:f,indexedFiles:c,totalSymbols:l,totalRelations:i.relationCount||0,totalBehaviors:i.behaviorCount||0,lastIndexedAt:a,failureCount:i.failureCount||0,failedFiles:p.map(T=>({file:T.file_path,error:T.error})),watcherActive:u,dbSizeBytes:m},b=Math.round((performance.now()-n)*100)/100,S=H({durationMs:b,resultCount:1,backend:"indexed"}),y=[`\u{1F3E5} \u7D22\u5F15\u5065\u5EB7\u68C0\u67E5 \u2014 ${s}`,"\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501","","\u{1F4CA} \u7D22\u5F15\u7EDF\u8BA1:",` \u{1F4C1} \u5DF2\u7D22\u5F15\u6587\u4EF6: ${h.indexedFiles}`,` \u{1F523} \u7B26\u53F7\u6570: ${h.totalSymbols}`,` \u{1F517} \u8C03\u7528\u5173\u7CFB: ${h.totalRelations}`,` \u{1F3F7}\uFE0F \u884C\u4E3A\u6807\u7B7E: ${h.totalBehaviors}`,` \u{1F4C5} \u6700\u540E\u7D22\u5F15\u65F6\u95F4: ${h.lastIndexedAt}`,` \u2757 \u5931\u8D25\u6587\u4EF6\u603B\u6570: ${h.failureCount}`,"","\u{1F50C} \u8FD0\u884C\u65F6\u72B6\u6001:",` \u{1F4C2} \u6587\u4EF6\u76D1\u542C: ${h.watcherActive?"\u2705 \u6D3B\u8DC3":"\u274C \u672A\u542F\u52A8"}`,` \u{1F4BE} \u6570\u636E\u5E93\u5927\u5C0F: ${Math.round(h.dbSizeBytes/1024)} KB`,` \u{1F4CD} \u6570\u636E\u5E93\u8DEF\u5F84: ${h.dbPath||"\uFF08\u5185\u5B58\uFF09"}`,"","\u{1F4A1} \u5EFA\u8BAE:"];if(h.totalSymbols===0&&h.indexedFiles>0?y.push(" \u26A0\uFE0F \u6709\u6587\u4EF6\u4F46\u7B26\u53F7\u6570\u4E3A0 \u2014 \u53EF\u80FD\u9700\u8981\u8C03\u6574\u89E3\u6790\u89C4\u5219\u6216\u5F3A\u5236\u91CD\u5EFA"):h.indexedFiles===0?y.push(" \u274C \u5C1A\u672A\u7D22\u5F15 \u2014 \u8FD0\u884C skimmer_index_project \u5F00\u59CB\u7D22\u5F15"):y.push(" \u2705 \u7D22\u5F15\u72B6\u6001\u6B63\u5E38"),!h.watcherActive&&h.indexedFiles>0&&y.push(" \u{1F4A1} \u6587\u4EF6\u76D1\u542C\u672A\u542F\u52A8 \u2014 \u8FD0\u884C skimmer_index_project \u53EF\u81EA\u52A8\u5F00\u542F"),h.failedFiles.length>0){y.push(""),y.push("\u26A0\uFE0F \u6700\u8FD1\u5931\u8D25\u6587\u4EF6\u6837\u672C:");for(let T of h.failedFiles.slice(0,5))y.push(` - ${T.file}: ${T.error}`);}return y.push(""),y.push("\u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500"),y.push(W(S)),{content:[{type:"text",text:y.join(`
617
- `)}]}});}var ps="\u9879\u76EE\u6839\u76EE\u5F55\uFF08\u53EF\u7701\u7565\uFF0C\u4F7F\u7528\u4E0A\u6B21\u7D22\u5F15\u7684\u9879\u76EE\uFF09";function Kn(o,e){o.registerTool("skimmer_get_project_overview",{title:"\u83B7\u53D6\u9879\u76EE\u6574\u4F53\u6982\u89C8",description:`\u8FD4\u56DE\u9879\u76EE\u7684\u5168\u666F\u7EDF\u8BA1\uFF1A\u6587\u4EF6\u6570\u3001\u6846\u67B6\u5206\u5E03\u3001\u6700\u5927\u6587\u4EF6\u3001\u884C\u4E3A\u7EDF\u8BA1\u3002
618
- \u652F\u6301\u5217\u51FA\u5F53\u524D\u6240\u6709\u5DF2\u7F13\u5B58\u7684\u9879\u76EE\u3002project_path \u53EF\u7701\u7565\u3002`,inputSchema:z$1.object({project_path:z$1.string().optional().describe(ps),list_all_projects:z$1.boolean().optional().default(false).describe("\u662F\u5426\u5217\u51FA\u6240\u6709\u5DF2\u7D22\u5F15\u7684\u9879\u76EE")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({project_path:t,list_all_projects:n})=>{let r=performance.now();if(n){let f=e.listProjects(),m=Math.round((performance.now()-r)*100)/100,h=H({durationMs:m,resultCount:f.length,backend:"indexed"});if(f.length===0)return {content:[{type:"text",text:`\u{1F4CB} \u5F53\u524D\u6CA1\u6709\u5DF2\u7D22\u5F15\u7684\u9879\u76EE
638
+ project_path \u53EF\u7701\u7565\uFF08\u81EA\u52A8\u4F7F\u7528\u4E0A\u6B21\u7D22\u5F15\u7684\u9879\u76EE\uFF09\u3002`,inputSchema:z$1.object({project_path:z$1.string().optional().describe("\u9879\u76EE\u6839\u76EE\u5F55\uFF08\u53EF\u7701\u7565\uFF0C\u4F7F\u7528\u4E0A\u6B21\u7D22\u5F15\u7684\u9879\u76EE\uFF09")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({project_path:t})=>{let n=performance.now(),{db:r,projectRoot:i}=e.getContext(t),o=r.getProjectStats(),a=(()=>{try{let S=r.getLastIndexedTime();return S?new Date(S).toISOString():"\u6682\u65E0\u7D22\u5F15\u6570\u636E"}catch{return "\u6682\u65E0\u7D22\u5F15\u6570\u636E"}})(),c=o.fileCount||0,l=o.symbolCount||0,p=r.getIndexFailures(10),u=e.hasWatcher(i),f=e.listProjects().find(S=>S.root===i)?.dbPath||"",m=o.dbSize||0,y={dbPath:f,indexedFiles:c,totalSymbols:l,totalRelations:o.relationCount||0,totalBehaviors:o.behaviorCount||0,lastIndexedAt:a,failureCount:o.failureCount||0,failedFiles:p.map(S=>({file:S.file_path,error:S.error})),watcherActive:u,dbSizeBytes:m},g=Math.round((performance.now()-n)*100)/100,N=X({durationMs:g,resultCount:1,backend:"indexed"}),b=[`\u{1F3E5} \u7D22\u5F15\u5065\u5EB7\u68C0\u67E5 \u2014 ${i}`,"\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501","","\u{1F4CA} \u7D22\u5F15\u7EDF\u8BA1:",` \u{1F4C1} \u5DF2\u7D22\u5F15\u6587\u4EF6: ${y.indexedFiles}`,` \u{1F523} \u7B26\u53F7\u6570: ${y.totalSymbols}`,` \u{1F517} \u8C03\u7528\u5173\u7CFB: ${y.totalRelations}`,` \u{1F3F7}\uFE0F \u884C\u4E3A\u6807\u7B7E: ${y.totalBehaviors}`,` \u{1F4C5} \u6700\u540E\u7D22\u5F15\u65F6\u95F4: ${y.lastIndexedAt}`,` \u2757 \u5931\u8D25\u6587\u4EF6\u603B\u6570: ${y.failureCount}`,"","\u{1F50C} \u8FD0\u884C\u65F6\u72B6\u6001:",` \u{1F4C2} \u6587\u4EF6\u76D1\u542C: ${y.watcherActive?"\u2705 \u6D3B\u8DC3":"\u274C \u672A\u542F\u52A8"}`,` \u{1F4BE} \u6570\u636E\u5E93\u5927\u5C0F: ${Math.round(y.dbSizeBytes/1024)} KB`,` \u{1F4CD} \u6570\u636E\u5E93\u8DEF\u5F84: ${y.dbPath||"\uFF08\u5185\u5B58\uFF09"}`,"","\u{1F4A1} \u5EFA\u8BAE:"];if(y.totalSymbols===0&&y.indexedFiles>0?b.push(" \u26A0\uFE0F \u6709\u6587\u4EF6\u4F46\u7B26\u53F7\u6570\u4E3A0 \u2014 \u53EF\u80FD\u9700\u8981\u8C03\u6574\u89E3\u6790\u89C4\u5219\u6216\u5F3A\u5236\u91CD\u5EFA"):y.indexedFiles===0?b.push(" \u274C \u5C1A\u672A\u7D22\u5F15 \u2014 \u8FD0\u884C skimmer_index_project \u5F00\u59CB\u7D22\u5F15"):b.push(" \u2705 \u7D22\u5F15\u72B6\u6001\u6B63\u5E38"),!y.watcherActive&&y.indexedFiles>0&&b.push(" \u{1F4A1} \u6587\u4EF6\u76D1\u542C\u672A\u542F\u52A8 \u2014 \u8FD0\u884C skimmer_index_project \u53EF\u81EA\u52A8\u5F00\u542F"),y.failedFiles.length>0){b.push(""),b.push("\u26A0\uFE0F \u6700\u8FD1\u5931\u8D25\u6587\u4EF6\u6837\u672C:");for(let S of y.failedFiles.slice(0,5))b.push(` - ${S.file}: ${S.error}`);}return b.push(""),b.push("\u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500"),b.push(W(N)),{content:[{type:"text",text:b.join(`
639
+ `)}]}});}var Ms="\u9879\u76EE\u6839\u76EE\u5F55\uFF08\u53EF\u7701\u7565\uFF0C\u4F7F\u7528\u4E0A\u6B21\u7D22\u5F15\u7684\u9879\u76EE\uFF09";function or(s,e){s.registerTool("skimmer_get_project_overview",{title:"\u83B7\u53D6\u9879\u76EE\u6574\u4F53\u6982\u89C8",description:`\u8FD4\u56DE\u9879\u76EE\u7684\u5168\u666F\u7EDF\u8BA1\uFF1A\u6587\u4EF6\u6570\u3001\u6846\u67B6\u5206\u5E03\u3001\u6700\u5927\u6587\u4EF6\u3001\u884C\u4E3A\u7EDF\u8BA1\u3002
640
+ \u652F\u6301\u5217\u51FA\u5F53\u524D\u6240\u6709\u5DF2\u7F13\u5B58\u7684\u9879\u76EE\u3002project_path \u53EF\u7701\u7565\u3002`,inputSchema:z$1.object({project_path:z$1.string().optional().describe(Ms),list_all_projects:z$1.boolean().optional().default(false).describe("\u662F\u5426\u5217\u51FA\u6240\u6709\u5DF2\u7D22\u5F15\u7684\u9879\u76EE")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({project_path:t,list_all_projects:n})=>{let r=performance.now();if(n){let f=e.listProjects(),m=Math.round((performance.now()-r)*100)/100,y=X({durationMs:m,resultCount:f.length,backend:"indexed"});if(f.length===0)return {content:[{type:"text",text:`\u{1F4CB} \u5F53\u524D\u6CA1\u6709\u5DF2\u7D22\u5F15\u7684\u9879\u76EE
619
641
 
620
642
  \u4F7F\u7528 skimmer_index_project({ project_path: "/your/project" }) \u5F00\u59CB\u7D22\u5F15
621
643
 
622
644
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
623
- ${W(h)}`}]};let b=[`\u{1F4CB} \u5DF2\u7D22\u5F15\u7684\u9879\u76EE (${f.length} \u4E2A):
624
- `];return f.forEach((S,y)=>{b.push(`${y+1}. ${S.root}`),b.push(` \u6570\u636E\u5E93: ${S.dbPath}`);}),b.push(`
645
+ ${W(y)}`}]};let g=[`\u{1F4CB} \u5DF2\u7D22\u5F15\u7684\u9879\u76EE (${f.length} \u4E2A):
646
+ `];return f.forEach((N,b)=>{g.push(`${b+1}. ${N.root}`),g.push(` \u6570\u636E\u5E93: ${N.dbPath}`);}),g.push(`
625
647
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
626
- ${W(h)}`),{content:[{type:"text",text:b.join(`
627
- `)}]}}let{db:s,projectRoot:i}=e.getContext(t),a=s.getProjectStats(),c=["\u{1F4CA} \u9879\u76EE\u6982\u89C8","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4C1} ${i}`,"",`\u{1F4C8} \u6574\u4F53: \u6587\u4EF6 ${a.fileCount} | \u7B26\u53F7 ${a.symbolCount} | \u884C\u4E3A\u6807\u7B7E ${a.behaviorCount} | \u8C03\u7528\u5173\u7CFB ${a.relationCount}`,""],l=a.frameworkBreakdown;if(l?.length){let f={vue2:"\u{1F7E2} Vue2",vue3:"\u{1F535} Vue3",react:"\u269B\uFE0F React",js:"\u{1F4DC} JS",ts:"\u{1F4D8} TS"};c.push("\u{1F527} \u6846\u67B6\u5206\u5E03:");for(let m of l)c.push(` ${f[m.framework]||m.framework}: ${m.count} \u4E2A`);c.push("");}let p=a.topFiles;p?.length&&(c.push("\u{1F5C2}\uFE0F Top 10 \u6700\u5927\u6587\u4EF6:"),p.forEach((f,m)=>{c.push(` ${m+1}. ${f.path} (${f.line_count} \u884C, ${f.symbol_count} \u7B26\u53F7)`);}),c.push(""));let u=a.behaviorStats;if(u?.length){let f={storage:"\u{1F4BE} \u5B58\u50A8",network:"\u{1F310} \u7F51\u7EDC",router:"\u{1F6E3}\uFE0F \u8DEF\u7531",vuex:"\u{1F4E6} Vuex",dom:"\u{1F5A5}\uFE0F DOM",event:"\u{1F4E1} \u4E8B\u4EF6",timer:"\u23F1\uFE0F \u5B9A\u65F6\u5668",i18n:"\u{1F30D} \u56FD\u9645\u5316"};c.push("\u{1F3F7}\uFE0F \u884C\u4E3A\u7EDF\u8BA1:");for(let m of u)c.push(` ${f[m.category]||m.category}: ${m.count} \u5904`);c.push("");}c.push(`\u{1F4BD} \u6570\u636E\u5E93: ${Math.round(a.dbSize/1024)} KB`);let d=Math.round((performance.now()-r)*100)/100,g=H({durationMs:d,resultCount:1,backend:"indexed"});return c.push(`
648
+ ${W(y)}`),{content:[{type:"text",text:g.join(`
649
+ `)}]}}let{db:i,projectRoot:o}=e.getContext(t),a=i.getProjectStats(),c=["\u{1F4CA} \u9879\u76EE\u6982\u89C8","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4C1} ${o}`,"",`\u{1F4C8} \u6574\u4F53: \u6587\u4EF6 ${a.fileCount} | \u7B26\u53F7 ${a.symbolCount} | \u884C\u4E3A\u6807\u7B7E ${a.behaviorCount} | \u8C03\u7528\u5173\u7CFB ${a.relationCount}`,""],l=a.frameworkBreakdown;if(l?.length){let f={vue2:"\u{1F7E2} Vue2",vue3:"\u{1F535} Vue3",react:"\u269B\uFE0F React",js:"\u{1F4DC} JS",ts:"\u{1F4D8} TS"};c.push("\u{1F527} \u6846\u67B6\u5206\u5E03:");for(let m of l)c.push(` ${f[m.framework]||m.framework}: ${m.count} \u4E2A`);c.push("");}let p=a.topFiles;p?.length&&(c.push("\u{1F5C2}\uFE0F Top 10 \u6700\u5927\u6587\u4EF6:"),p.forEach((f,m)=>{c.push(` ${m+1}. ${f.path} (${f.line_count} \u884C, ${f.symbol_count} \u7B26\u53F7)`);}),c.push(""));let u=a.behaviorStats;if(u?.length){let f={storage:"\u{1F4BE} \u5B58\u50A8",network:"\u{1F310} \u7F51\u7EDC",router:"\u{1F6E3}\uFE0F \u8DEF\u7531",vuex:"\u{1F4E6} Vuex",dom:"\u{1F5A5}\uFE0F DOM",event:"\u{1F4E1} \u4E8B\u4EF6",timer:"\u23F1\uFE0F \u5B9A\u65F6\u5668",i18n:"\u{1F30D} \u56FD\u9645\u5316"};c.push("\u{1F3F7}\uFE0F \u884C\u4E3A\u7EDF\u8BA1:");for(let m of u)c.push(` ${f[m.category]||m.category}: ${m.count} \u5904`);c.push("");}c.push(`\u{1F4BD} \u6570\u636E\u5E93: ${Math.round(a.dbSize/1024)} KB`);let d=Math.round((performance.now()-r)*100)/100,h=X({durationMs:d,resultCount:1,backend:"indexed"});return c.push(`
628
650
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
629
- ${W(g)}`),{content:[{type:"text",text:c.join(`
630
- `)}]}});}function zn(o){let e=[Y__default.resolve(o,"../package.json"),Y__default.resolve(o,"../../package.json")];for(let t of e)try{let n=JSON.parse(Q__default.readFileSync(t,"utf-8"));if(typeof n.version=="string"&&n.version.trim())return n.version.trim()}catch{}return "0.0.0-dev"}var he=new ut,Gn=zn(Y__default.dirname(fileURLToPath(import.meta.url))),$e=new McpServer({name:"frontend-code-skimmer",version:Gn});Cn($e,he);$n($e,he);Bn($e,he);Xn($e,he);Kn($e,he);async function hs(){if(process.env.SKIMMER_AUTO_INDEX==="true"&&process.env.SKIMMER_PROJECT){process.stderr.write(`[Frontend-Code-Skimmer] \u81EA\u52A8\u7D22\u5F15: ${process.env.SKIMMER_PROJECT}
631
- `);try{let{projectRoot:n}=he.getContext(process.env.SKIMMER_PROJECT),r=he.getIndexer(n),s=await r.indexProject();process.stderr.write(`[Frontend-Code-Skimmer] \u5B8C\u6210: ${s.indexedFiles} \u6587\u4EF6, ${s.totalSymbols} \u7B26\u53F7
632
- `);let i=await r.startWatcher();he.registerWatcher(n,i),process.stderr.write(`[Frontend-Code-Skimmer] \u6587\u4EF6\u76D1\u542C\u5DF2\u542F\u52A8: ${n}
651
+ ${W(h)}`),{content:[{type:"text",text:c.join(`
652
+ `)}]}});}function cr(s){let e=[Y__default.resolve(s,"../package.json"),Y__default.resolve(s,"../../package.json")];for(let t of e)try{let n=JSON.parse(ne__default.readFileSync(t,"utf-8"));if(typeof n.version=="string"&&n.version.trim())return n.version.trim()}catch{}return "0.0.0-dev"}var _e=new Nt,lr=cr(Y__default.dirname(fileURLToPath(import.meta.url))),De=new McpServer({name:"frontend-code-skimmer",version:lr});jn(De,_e);Un(De,_e);rr(De,_e);ir(De,_e);or(De,_e);async function Xs(){if(process.env.SKIMMER_AUTO_INDEX==="true"&&process.env.SKIMMER_PROJECT){process.stderr.write(`[Frontend-Code-Skimmer] \u81EA\u52A8\u7D22\u5F15: ${process.env.SKIMMER_PROJECT}
653
+ `);try{let{projectRoot:n}=_e.getContext(process.env.SKIMMER_PROJECT),r=_e.getIndexer(n),i=await r.indexProject();process.stderr.write(`[Frontend-Code-Skimmer] \u5B8C\u6210: ${i.indexedFiles} \u6587\u4EF6, ${i.totalSymbols} \u7B26\u53F7
654
+ `);let o=await r.startWatcher();_e.registerWatcher(n,o),process.stderr.write(`[Frontend-Code-Skimmer] \u6587\u4EF6\u76D1\u542C\u5DF2\u542F\u52A8: ${n}
633
655
  `);}catch(n){process.stderr.write(`[Frontend-Code-Skimmer] \u7D22\u5F15\u5931\u8D25: ${String(n)}
634
- `);}}let e=new StdioServerTransport;await $e.connect(e),process.stderr.write(`[Frontend-Code-Skimmer MCP] \u5DF2\u542F\u52A8 (v${Gn})
656
+ `);}}let e=new StdioServerTransport;await De.connect(e),process.stderr.write(`[Frontend-Code-Skimmer MCP] \u5DF2\u542F\u52A8 (v${lr})
635
657
  `),process.stderr.write(`[Frontend-Code-Skimmer MCP] \u652F\u6301\u6846\u67B6: Vue 2 / Vue 3 / React Hooks
636
658
  `),process.stderr.write(`[Frontend-Code-Skimmer MCP] \u652F\u6301\u7CBE\u5EA6: heuristic / precise (\u8DE8\u6587\u4EF6 import \u7ED1\u5B9A)
637
659
  `),process.stderr.write(`[Frontend-Code-Skimmer MCP] \u652F\u6301\u6A21\u5F0F: \u52A8\u6001\u4EFB\u610F\u9879\u76EE\uFF08\u65E0\u9700\u542F\u52A8\u65F6\u6307\u5B9A\uFF09
638
660
  `),process.env.SKIMMER_PROJECT?process.stderr.write(`[Frontend-Code-Skimmer MCP] \u9ED8\u8BA4\u9879\u76EE: ${process.env.SKIMMER_PROJECT}
639
661
  `):process.stderr.write(`[Frontend-Code-Skimmer MCP] \u63D0\u793A: \u672A\u8BBE\u7F6E SKIMMER_PROJECT\uFF0C\u6BCF\u6B21\u8C03\u7528\u5DE5\u5177\u65F6\u8BF7\u4F20\u5165 project_path
640
- `);let t=()=>{he.closeAll(),process.exit(0);};process.on("SIGINT",t),process.on("SIGTERM",t);}hs().catch(o=>{process.stderr.write(`[Frontend-Code-Skimmer MCP] \u542F\u52A8\u5931\u8D25: ${String(o)}
662
+ `);let t=()=>{_e.closeAll(),process.exit(0);};process.on("SIGINT",t),process.on("SIGTERM",t);}Xs().catch(s=>{process.stderr.write(`[Frontend-Code-Skimmer MCP] \u542F\u52A8\u5931\u8D25: ${String(s)}
641
663
  `),process.exit(1);});