@jokeran/frontend-code-skimmer 0.4.6 → 0.4.7

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 (2) hide show
  1. package/dist/index.js +129 -112
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import*as J from'path';import J__default from'path';import {fileURLToPath}from'url';import {McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import Qr from'os';import*as Q from'fs';import Q__default from'fs';import rr,{createHash}from'crypto';import lr from'better-sqlite3';import Zr 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 k(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 rr.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 J__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 Zt(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 Qt(o,e,t){if(t===0||t>3)return;let n=k(o).split(" "),r=k(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 ir=[".ts",".tsx",".js",".jsx",".vue"],or=["index.ts","index.tsx","index.js","index.jsx","index.vue"];function ar(o){return [...ir.map(e=>`${o}${e}`),...or.map(e=>J.join(o,e))]}function Ne(o){if(Q.existsSync(o))try{if(Q.statSync(o).isFile())return o}catch{}for(let e of ar(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"],tn={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"],nn=["ref","reactive","shallowRef","shallowReactive","readonly"],rn=["computed"],sn=["watch","watchEffect","watchPostEffect","watchSyncEffect"],Lt=["useState","useReducer","useRef","useImperativeHandle"],Rt=["useMemo","useCallback"],kt=["useEffect","useLayoutEffect","useInsertionEffect"],on=["useContext","useDebugValue","useDeferredValue","useId","useSyncExternalStore","useTransition"],Je=".skimmer-index.db",an=30,cn=4,ln=300;var cr=[{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 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 (
5
5
  version INTEGER PRIMARY KEY,
6
6
  applied_at INTEGER NOT NULL,
7
7
  description TEXT
@@ -34,11 +34,15 @@ import*as J from'path';import J__default from'path';import {fileURLToPath}from'u
34
34
  file_path TEXT NOT NULL,
35
35
  error TEXT NOT NULL,
36
36
  last_seen_at INTEGER NOT NULL
37
- )`,"CREATE INDEX IF NOT EXISTS idx_index_failures_file ON index_failures(file_path)","CREATE INDEX IF NOT EXISTS idx_index_failures_seen ON index_failures(last_seen_at DESC)"]}];function pn(o){let e=[],t=[];o.exec(`CREATE TABLE IF NOT EXISTS schema_version (
37
+ )`,"CREATE INDEX IF NOT EXISTS idx_index_failures_file ON index_failures(file_path)","CREATE INDEX IF NOT EXISTS idx_index_failures_seen ON index_failures(last_seen_at DESC)"]},{version:11,description:"\u6301\u4E45\u5316\u5F85\u8865\u7B97 precise \u7684\u6587\u4EF6\u961F\u5217\uFF0C\u907F\u514D watcher/\u8FDB\u7A0B\u91CD\u542F\u540E\u7CBE\u786E\u56FE\u8C31\u9648\u65E7",statements:[`CREATE TABLE IF NOT EXISTS precise_pending (
38
+ rel_path TEXT PRIMARY KEY,
39
+ priority TEXT NOT NULL DEFAULT 'normal',
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 (
38
42
  version INTEGER PRIMARY KEY,
39
43
  applied_at INTEGER NOT NULL,
40
44
  description TEXT
41
- )`);let n=o.prepare("SELECT MAX(version) as v FROM schema_version").get()?.v??0;for(let r of cr){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 dr(o,e){let t=J__default.posix.dirname(e),n=t==="."?[]:t.split("/").map(()=>"..");return J__default.resolve(J__default.dirname(o),...n)}function ur(o,e,t){if(!o)return o;if(J__default.isAbsolute(o)){let n=de(Ne(o),t);return n.startsWith("..")?o.replace(/\\/g,"/"):n}if(o.startsWith(".")){let n=Ne(J__default.resolve(J__default.dirname(e),o)),r=de(n,t);return r.startsWith("..")?o.replace(/\\/g,"/"):r}if(o.startsWith("@/")){let n=Ne(J__default.resolve(t,"src",o.slice(2))),r=de(n,t);return r.startsWith("..")?o.replace(/\\/g,"/"):r}return o.replace(/\\/g,"/")}var Ye=class{db;constructor(e,t){let n=t||J__default.join(e,Je);Q__default.mkdirSync(J__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(`
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(`
42
46
  -- \u6587\u4EF6\u5143\u4FE1\u606F
43
47
  CREATE TABLE IF NOT EXISTS files (
44
48
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -179,11 +183,17 @@ import*as J from'path';import J__default from'path';import {fileURLToPath}from'u
179
183
  last_seen_at INTEGER NOT NULL
180
184
  );
181
185
 
186
+ CREATE TABLE IF NOT EXISTS precise_pending (
187
+ rel_path TEXT PRIMARY KEY,
188
+ priority TEXT NOT NULL DEFAULT 'normal',
189
+ added_at INTEGER NOT NULL
190
+ );
191
+
182
192
  -- \u7D22\u5F15\uFF08\u4EC5\u4FDD\u7559\u65E7\u5217\u7D22\u5F15\u2014\u2014\u65B0\u5217\u7D22\u5F15\u5728 migration \u4E4B\u540E\u521B\u5EFA\uFF09
183
193
  CREATE INDEX IF NOT EXISTS idx_symbols_name ON symbols(name);
184
194
  CREATE INDEX IF NOT EXISTS idx_symbols_framework ON symbols(framework);
185
195
  CREATE INDEX IF NOT EXISTS idx_behaviors_file ON behaviors(file_id);
186
- `);let{applied:e,errors:t}=pn(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}=un(this.db);e.length>0&&process.stderr.write(`[Frontend-Code-Skimmer] \u6570\u636E\u5E93\u8FC1\u79FB\u5B8C\u6210: v${e.join(", v")}
187
197
  `),t.length>0&&process.stderr.write(`[Frontend-Code-Skimmer] \u8FC1\u79FB\u8B66\u544A: ${t.join("; ")}
188
198
  `),this.db.exec(`
189
199
  CREATE INDEX IF NOT EXISTS idx_behaviors_api_lc ON behaviors(api_name_lc, operation_lc);
@@ -198,6 +208,7 @@ import*as J from'path';import J__default from'path';import {fileURLToPath}from'u
198
208
  CREATE INDEX IF NOT EXISTS idx_prop_writes_file ON property_writes(file_id);
199
209
  CREATE INDEX IF NOT EXISTS idx_index_failures_file ON index_failures(file_path);
200
210
  CREATE INDEX IF NOT EXISTS idx_index_failures_seen ON index_failures(last_seen_at DESC);
211
+ CREATE INDEX IF NOT EXISTS idx_precise_pending_priority ON precise_pending(priority, added_at);
201
212
 
202
213
  CREATE VIRTUAL TABLE IF NOT EXISTS relations_fts USING fts5(
203
214
  args,
@@ -225,7 +236,7 @@ import*as J from'path';import J__default from'path';import {fileURLToPath}from'u
225
236
  INSERT INTO relations_fts(rowid, args)
226
237
  VALUES (new.id, new.args);
227
238
  END;
228
- `);}saveParseResult(e,t,n,r,s,i,a=0,c="",l=""){let p=J__default.extname(t).slice(1),d=dr(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,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(`
229
240
  UPDATE files SET
230
241
  abs_path = ?, framework = ?, content_hash = ?,
231
242
  last_indexed_at = ?, file_size = ?, line_count = ?, file_mtime = ?,
@@ -240,31 +251,36 @@ import*as J from'path';import J__default from'path';import {fileURLToPath}from'u
240
251
  signature, params_json, default_value, camel_words, jsdoc,
241
252
  is_async, hook_deps_json, state_setter_name, parent_component)
242
253
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
243
- `),h=new Map,b=new Map,S=N=>N.internalKey||`${N.name}:${N.startLine}:${N.endLine}`,y=(N,x)=>{h.set(S(N),x);let L=b.get(N.name)||[];L.push({id:x,name:N.name,startLine:N.startLine,endLine:N.endLine}),b.set(N.name,L);},_=(N,x,L)=>{if(L&&h.has(L))return h.get(L);let w=b.get(N)||[];if(w.length===0)return;if(w.length===1||x==null)return w[0]?.id;let M=w.filter(P=>P.startLine<=x&&x<=P.endLine);return M.length===1?M[0].id:M.length>1?M.sort((P,B)=>P.endLine-P.startLine-(B.endLine-B.startLine)||Math.abs(P.startLine-x)-Math.abs(B.startLine-x))[0]?.id:w.slice().sort((P,B)=>Math.abs(P.startLine-x)-Math.abs(B.startLine-x)||P.endLine-P.startLine-(B.endLine-B.startLine))[0]?.id};for(let N of e.symbols){let L=N.camelWords||k(N.name),w=N.name.toLowerCase(),M=N.category.toLowerCase(),P=m.run(f,N.name,w,N.category,M,N.framework,N.startLine,N.endLine,N.signature||null,N.params?JSON.stringify(N.params):null,N.defaultValue||null,L,N.jsdoc||null,N.isAsync?1:0,N.hookDeps?JSON.stringify(N.hookDeps):null,N.stateSetterName||null,N.parentComponent||null);y(N,P.lastInsertRowid);}let E=this.db.prepare(`
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(`
244
255
  INSERT INTO relations (caller_id, callee_name, callee_name_lc, call_type, line_number, args,
245
256
  source_kind, import_source, receiver_token, edge_kind)
246
257
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
247
- `);for(let N of e.relations){let x=_(N.callerName,N.callerLine,N.callerKey);if(x){let L=N.sourceKind||ze(N.callType);E.run(x,N.calleeName,N.calleeName.toLowerCase(),N.callType,N.line,N.args||null,L,N.importSource||null,N.receiverToken||null,N.edgeKind||"heuristic");}}if(this.db.prepare("DELETE FROM data_assignments WHERE file_id = ?").run(f),e.assignments?.length){let N=this.db.prepare(`
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(`
248
259
  INSERT INTO data_assignments (symbol_name, symbol_name_lc, file_id, kind, source_layer, line_number, text_snippet)
249
260
  VALUES (?, ?, ?, ?, ?, ?, ?)
250
- `);for(let x of e.assignments)N.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 N=this.db.prepare(`
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(`
251
262
  INSERT INTO property_writes (object_name, object_name_lc, property_name, property_name_lc, file_id, kind, source_layer, line_number, text_snippet)
252
263
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
253
- `);for(let x of e.propertyWrites)N.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 N=this.db.prepare(`
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(`
254
265
  INSERT INTO file_dependencies (from_file, to_file, dependency_kind, line_number)
255
266
  VALUES (?, ?, ?, ?)
256
- `);for(let x of e.fileDependencies)N.run(n,ur(x.toFile,t,d),x.dependencyKind,x.line);}let A=this.db.prepare(`
267
+ `);for(let N of e.fileDependencies)_.run(n,mr(N.toFile,t,u),N.dependencyKind,N.line);}let L=this.db.prepare(`
257
268
  INSERT INTO behaviors (symbol_id, file_id, category, api_name, api_name_lc, operation, operation_lc, detail, detail_lc, line_number)
258
269
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
259
- `);for(let N of e.behaviors){let x=_(N.symbolName,N.line,N.symbolKey);if(x){let L=N.detail||null;A.run(x,f,N.category,N.apiName,N.apiName.toLowerCase(),N.operation,N.operation.toLowerCase(),L,L?.toLowerCase()??"",N.line);}}if(e.errors?.length){let N=this.db.prepare(`
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(`
260
271
  INSERT INTO index_failures (file_path, error, last_seen_at)
261
272
  VALUES (?, ?, ?)
262
- `),x=Date.now();for(let L of e.errors)N.run(n,L,x);}})();}recordIndexFailure(e,t){this.clearIndexFailures(e),this.db.prepare(`
273
+ `),N=Date.now();for(let A of e.errors)_.run(n,A,N);}})();}recordIndexFailure(e,t){this.clearIndexFailures(e),this.db.prepare(`
263
274
  INSERT INTO index_failures (file_path, error, last_seen_at)
264
275
  VALUES (?, ?, ?)
265
- `).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}deleteFile(e){this.db.prepare("DELETE FROM file_dependencies WHERE from_file = ? OR to_file = ?").run(e,e),this.clearIndexFailures(e),this.db.prepare("DELETE FROM files WHERE path = ?").run(e);}clearProjectIndex(){this.db.exec(`
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(`
277
+ SELECT rel_path, priority
278
+ FROM precise_pending
279
+ ORDER BY CASE priority WHEN 'high' THEN 0 WHEN 'normal' THEN 1 ELSE 2 END, added_at
280
+ `).all().map(t=>({relPath:t.rel_path,priority:t.priority==="high"||t.priority==="low"?t.priority:"normal"}))}hasPreciseRelations(){return !!this.db.prepare("SELECT 1 as found FROM relations WHERE edge_kind = 'precise' LIMIT 1").get()}deleteFile(e){this.db.prepare("DELETE FROM file_dependencies WHERE from_file = ? OR to_file = ?").run(e,e),this.clearIndexFailures(e),this.deletePrecisePending(e),this.db.prepare("DELETE FROM files WHERE path = ?").run(e);}clearProjectIndex(){this.db.exec(`
266
281
  DELETE FROM file_dependencies;
267
282
  DELETE FROM index_failures;
283
+ DELETE FROM precise_pending;
268
284
  DELETE FROM files;
269
285
  `);}getFileOutline(e){let t=this.db.prepare("SELECT * FROM files WHERE path = ?").get(e);if(!t)return {file:void 0,symbols:[],behaviors:[]};let n=t.id,r=this.db.prepare(`
270
286
  SELECT s.*, f.path as file_path
@@ -279,14 +295,14 @@ import*as J from'path';import J__default from'path';import {fileURLToPath}from'u
279
295
  SELECT s.*, f.path as file_path, f.abs_path
280
296
  FROM symbols s JOIN files f ON s.file_id = f.id
281
297
  WHERE s.name_lc = ?
282
- `,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(d=>`${d}*`).join(" ");try{let d=`
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=`
283
299
  SELECT s.*, f.path as file_path, f.abs_path,
284
300
  bm25(symbols_fts, 10.0, 1.0, 0.5, 0.5) as fts_rank
285
301
  FROM symbols_fts
286
302
  JOIN symbols s ON symbols_fts.rowid = s.id
287
303
  JOIN files f ON s.file_id = f.id
288
304
  WHERE symbols_fts MATCH ?
289
- `,u=[p];return t&&(d+=" AND s.category_lc = ?",u.push(t.toLowerCase())),n&&(d+=" AND s.framework = ?",u.push(n)),r&&(d+=" AND f.path_lc LIKE ?",u.push(`%${r.toLowerCase()}%`)),d+=` ORDER BY fts_rank LIMIT ${a}`,this.db.prepare(d).all(...u)}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(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=`
290
306
  SELECT s.*, f.path as file_path, f.abs_path, 0 as fts_rank
291
307
  FROM symbols s JOIN files f ON s.file_id = f.id
292
308
  WHERE (s.name_lc LIKE ? OR LOWER(s.camel_words) LIKE ?) ESCAPE '\\'
@@ -363,7 +379,7 @@ import*as J from'path';import J__default from'path';import {fileURLToPath}from'u
363
379
  JOIN symbols s ON r.caller_id = s.id
364
380
  JOIN files f ON s.file_id = f.id
365
381
  WHERE fts.args MATCH ?
366
- `,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 d=/[^a-zA-Z0-9_\u4e00-\u9fa5]/.test(r);if(!l&&(p||d)){let g=r.replace(/[\\%_]/g,"\\$&"),f=`
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=`
367
383
  SELECT r.*, s.name as caller_name, s.start_line, s.end_line, s.category,
368
384
  f.path as file_path
369
385
  FROM relations r
@@ -406,45 +422,46 @@ import*as J from'path';import J__default from'path';import {fileURLToPath}from'u
406
422
  JOIN symbols s ON r.caller_id = s.id
407
423
  JOIN files f ON s.file_id = f.id
408
424
  WHERE r.callee_name_lc = ?
409
- `,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=fr(i,e);c&&r.push(c);}if(i.type==="MemberExpression"){let a=mr(i);a&&r.push(a);}}),Nr(r)}function fr(o,e,t){let n=o.callee;if(!n)return null;let r=et(o);if(n.type==="MemberExpression"||n.type==="OptionalMemberExpression"){let s=gr(n);if(!s)return null;let{apiName:i,operation:a}=s,c=o.arguments,l=re(c?.[0]),p=Er(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||re(c?.[1]),line:r}:dn(a)&&_r(c)?{symbolName:e,category:"network",apiName:i,operation:a,detail:l||re(c?.[1]),line:r}:Ze(i)||Ze(`${i}.${a}`)?{symbolName:e,category:"network",apiName:i,operation:dn(a)?a:"wrapped_call",detail:l||re(c?.[1]),line:r}:null}if(n.type==="Identifier"){let s=n.name,i=hr(s),a=o.arguments,c=re(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||re(a?.[1]),line:r}:null}return null}function mr(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=br(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 gr(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 hr(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 yr(o){let e=o.loc;return {line:e?.start?.line??0,column:e?.start?.column??0}}function br(o){return o.type==="Identifier"?o.name:o.type==="ThisExpression"?"this":null}function Er(o){if(o==="this")return null;for(let[e,t]of Object.entries(tn))if(o in t)return e;return null}function re(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=re(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 re(o);let t=re(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 dn(o){return ["get","post","put","delete","patch","request"].includes(o.toLowerCase())}function _r(o,e){if(!o||o.length===0)return false;for(let t of o.slice(0,2)){let n=re(t);if(n&&(/https?:\/\//i.test(n)||n.includes("/")||/gw\d?\/|\/m\/|\/api\//i.test(n)))return true}return false}function Nr(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&&!fn(a)){let c=i.arguments,l=vt(c);r.push({calleeName:a,line:et(i),args:l});}}}),wt(r)}function un(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||Tr(l)||fn(p))return;let d=i.arguments,u=vt(d);r.push({calleeName:p,line:et(i),args:u,receiverToken:l});}),wt(r)}function fn(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 Tr(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=>re(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(`
410
- `);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 d=e+s,u=`${p}:${d}:${a.index}`;n.has(u)||(n.add(u),t.push({calleeName:p,line:d}));}}return t}function mn(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:d}=yr(r),u=`${l}:${p}:${d}`;!l||n.has(u)||(n.add(u),t.push({calleeName:l,line:p}));}),t}var xr=createRequire(import.meta.url),gn=false;function Ar(o){gn||(gn=true,process.stderr.write(`[Frontend-Code-Skimmer] precise import graph \u5DF2\u964D\u7EA7: ${String(o)}
411
- `));}function hn(o,e,t){let n={filePath:o,imports:[],exports:[]};try{let r=xr("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 d=p.namedBindings;if(d&&r.isNamedImports(d))for(let u of d.elements){let g=u.propertyName?u.propertyName.text:u.name.text;n.imports.push({localName:u.name.text,originalName:g,modulePath:c,resolvedFile:l,isDefault:!1,isReExport:!1});}d&&r.isNamespaceImport(d)&&n.imports.push({localName:d.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){Ar(r);}return n}function st(o,e){let t=J.dirname(o);if(e.startsWith(".")){let n=J.resolve(t,e);return Ne(n)}return e.startsWith("@/")?Lr(o,e):e}function Lr(o,e){let t=J.dirname(o);for(let n=0;n<10;n++){let r=J.join(t,"src");if(Q.existsSync(r)&&Q.statSync(r).isDirectory()){let i=J.join(r,e.replace(/^@\//,""));return Ne(i)}let s=J.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=>$t(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}:${Rr(e)}`}function Rr(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 $t(o){return o?o.type==="Identifier"?String(o.name||"param"):o.type==="AssignmentPattern"?$t(o.left):o.type==="RestElement"?$t(o.argument):"param":"param"}var yn=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=yn("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(`
412
- `),l;try{l=yn("@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),d=nt(s.template.content,p);if(d.length>0){let u=s.template.content.split(`
413
- `).length;n.symbols.push({name:"<template>",category:"lifecycle",framework:"vue2",startLine:p,endLine:p+u-1,camelWords:"template"});for(let g of d)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]===`
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]===`
414
430
  `&&n++;return n}extractFromAST(e,t,n,r,s){let i=t.split(`
415
- `);s.fileDependencies=fe(e.body||[],s.filePath);let a=null;V(e,d=>{if(d.type==="ExportDefaultDeclaration"){let u=d.declaration;if(u?.type==="ObjectExpression")a=u;else if(u?.type==="CallExpression"){let g=u.arguments;g&&g.length>0&&g[0].type==="ObjectExpression"&&(a=g[0]);}else if(u?.type==="Identifier"){let g=u.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,d=>{d.type==="ExportDefaultDeclaration"&&d.declaration?.type==="ClassDeclaration"&&(l=true,this.extractFromClassComponent(d.declaration,t,n,r,s));}),!l)){let d=null,u=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>u&&(u=h,d=f);}}),u>=2&&d&&(a=d);}if(!a)return;let p=a.properties;for(let d of p||[]){let u=this.getPropKey(d);if(!u)continue;let g=d.type==="ObjectMethod"?d:d.value;if(!g)continue;let f=m=>m+r-1;switch(u){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(u)){let m=f(this.getStartLine(d)),h=f(this.getEndLine(d)),b=K(n.join(`
416
- `),m),S=s.symbols.length;s.symbols.push({name:u,category:"lifecycle",framework:"vue2",startLine:m,endLine:h,jsdoc:b,camelWords:k(u)});let y=z(g,u);s.behaviors.push(...y);let _=Te(g,u);for(let E of _){if(E.args){let A=String(E.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");s.symbols[S].camelWords+=` ${k(A)} ${A}`;}s.relations.push(U({callerName:u,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:k(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:k(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(d=>this.getPropKey(d)==="default");p&&(l=this.getLiteralValue(p.value));}r.symbols.push({name:i,category:"prop",framework:"vue2",startLine:a,endLine:c,defaultValue:l,camelWords:k(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)),d=r(this.getEndLine(a)),u=K(s.join(`
417
- `),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:d,signature:m,params:g,isAsync:f,jsdoc:u,camelWords:k(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 _=String(y.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");i.symbols[i.symbols.length-1].camelWords+=` ${k(_)} ${_}`;}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 _=String(y.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");i.symbols[i.symbols.length-1].camelWords+=` ${k(_)} ${_}`;}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:k(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:k(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:k(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)),d=i(this.getEndLine(c)),u=K(n.join(`
418
- `),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:d,signature:b,params:m,isAsync:h,jsdoc:u,camelWords:k(l)});let S=z(c,l);s.behaviors.push(...S);let y=Te(c,l);for(let E of y){if(E.args){let A=String(E.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");s.symbols[s.symbols.length-1].camelWords+=` ${k(A)} ${A}`;}s.relations.push(U({callerName:l,callerLine:p,calleeName:E.calleeName,callType:"this_method",line:i(E.line),args:E.args}));}let _=G(c,l,n,true);for(let E of _){if(E.args){let A=String(E.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");s.symbols[s.symbols.length-1].camelWords+=` ${k(A)} ${A}`;}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:d,defaultValue:f,camelWords:k(l)});}}}};var It=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}=It("@vue/compiler-sfc"),{descriptor:s}=r(t),i=t.split(`
419
- `),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 d=s.template.content.split(`
420
- `).length;n.symbols.push({name:"<template>",category:"lifecycle",framework:"vue3",startLine:l,endLine:l+d-1,camelWords:"template"});for(let u of p)n.relations.push(U({callerName:"<template>",callerLine:l,calleeName:u.calleeName,callType:"template_event",line:u.line}));}}}catch(r){n.errors?.push(`Vue3 \u89E3\u6790\u5931\u8D25: ${String(r)}`);}return n}parseSetupContent(e,t,n,r){let s;try{s=It("@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(`
421
- `),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=It("@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(`
422
- `);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(d=>this.getPropKey(d)==="setup");if(p){c=true;let d=p.type==="ObjectMethod"?p:p.value;if(!d)return;let u=d.body;if(u?.type==="BlockStatement"){let g=u.body;for(let f of g||[])this.processTopLevelStatement(f,i,n,a,r);}}}}),c||V(s.program,l=>{if(!c&&l.type==="ObjectExpression"){let d=(l.properties||[]).find(u=>this.getPropKey(u)==="setup");if(d){c=true;let u=d.type==="ObjectMethod"?d:d.value;if(!u)return;let g=u.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:d}=i(e),u=K(n.join(`
423
- `),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(d),signature:`${l}(${(g||[]).join(", ")})`,params:g,isAsync:c.async===true,jsdoc:u,camelWords:k(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+=` ${k(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(`
424
- `),t(c)),d=this.extractParams(e),u=At.includes(a);if(s.symbols.push({name:a,category:u?"lifecycle":be(a)?"hook":"method",framework:"vue3",startLine:t(c),endLine:t(l),signature:`${a}(${(d||[]).join(", ")})`,params:d,isAsync:e.async===true,jsdoc:p,camelWords:k(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+=` ${k(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:d}=i(e);s.symbols.push({name:l,category:l==="defineProps"?"prop":l==="defineEmits"?"emit":"export",framework:"vue3",startLine:t(p),endLine:t(d),camelWords:k(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:d}=i(e);s.symbols.push({name:l,category:"lifecycle",framework:"vue3",startLine:t(p),endLine:t(d),camelWords:k(l)});let u=a.arguments;if(u?.[0]){let g=z(u[0],l);s.behaviors.push(...g);let f=G(u[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+=` ${k(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(`
425
- `),c);if(nn.includes(a)){let d=t.arguments,u=d?.[0]?this.getLiteralValue(d[0]):void 0;return {name:e,category:"state",framework:"vue3",startLine:c,endLine:l,defaultValue:u,jsdoc:p,camelWords:k(e)}}return rn.includes(a)?{name:e,category:"computed",framework:"vue3",startLine:c,endLine:l,jsdoc:p,camelWords:k(e)}:sn.includes(a)?{name:e,category:"effect",framework:"vue3",startLine:c,endLine:l,camelWords:k(e)}:a==="provide"||a==="inject"?{name:e,category:"provide",framework:"vue3",startLine:c,endLine:l,camelWords:k(e)}:be(a)?{name:e,category:"hook",framework:"vue3",startLine:c,endLine:l,jsdoc:p,camelWords:k(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 Cr=createRequire(import.meta.url),$r=[...Lt,...Rt,...kt,...on],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=Cr("@babel/parser").parse(t,{sourceType:"module",plugins:["jsx","typescript","decorators-legacy"],errorRecovery:!0}),i=t.split(`
426
- `);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,d=this.buildSymbolKey(i,l,p);if(n.symbols.push({name:i,category:"constant",framework:"react",startLine:l,endLine:p,internalKey:d,isExported:r,defaultValue:this.getLiteralValue(a),jsdoc:K(t.join(`
427
- `),l),camelWords:k(i)}),!a)return;let u=z(a,i,t,true);n.behaviors.push(...u);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+=` ${k(h)} ${h}`;}n.relations.push(U({callerName:i,callerLine:l,callerKey:d,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),d=K(t.join(`
428
- `),a),u=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}(${(u||[]).join(", ")})`,params:u,isAsync:e.async===true,isExported:r,jsdoc:d,parentComponent:p?s:void 0,camelWords:k(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 _=n.symbols.findIndex(E=>E.name===s&&E.startLine===a);if(y.args&&_!==-1){let E=String(y.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");n.symbols[_].camelWords+=` ${k(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=mn(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:d}=s(e),u=p,g=d;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:u,endLine:g,internalKey:this.buildSymbolKey(m,u,g,t),stateSetterName:h,defaultValue:this.getLiteralValue(b?.[0]),parentComponent:t,camelWords:k(m)});}}else if(i.id?.type==="Identifier"){let f=i.id.name;r.symbols.push({name:f,category:"state",framework:"react",startLine:u,endLine:g,internalKey:this.buildSymbolKey(f,u,g,t),parentComponent:t,camelWords:k(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:u,endLine:g,internalKey:this.buildSymbolKey(f,u,g,t),defaultValue:this.getLiteralValue(m?.[0]),parentComponent:t,camelWords:k(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:u,endLine:g,internalKey:this.buildSymbolKey(f,u,g,t),hookDeps:b,parentComponent:t,camelWords:k(f)});}if(be(l)&&!$r.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:u,endLine:g,internalKey:this.buildSymbolKey(f,u,g,t),parentComponent:t,camelWords:k(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),d=i.arguments,u=d?.[1],g=this.extractDepsArray(u),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:k(c)}),d?.[0]){let h=z(d[0],m,n,true).map(S=>({...S,symbolKey:f}));r.behaviors.push(...h);let b=G(d[0],m,n,true);for(let S of b){let y=r.symbols.findIndex(_=>_.name===c&&_.startLine===l);if(S.args&&y!==-1){let _=String(S.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");r.symbols[y].camelWords+=` ${k(_)} ${_}`;}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(`
429
- `),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:k(i)}),e.body){let d=z(e.body,i,n,true);r.behaviors.push(...d);let u=G(e.body,i,n,true);for(let g of u){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+=` ${k(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:_}=s(e);r.symbols.push({name:l,category:"computed",framework:"react",startLine:y,endLine:_,internalKey:this.buildSymbolKey(l,y,_,t),hookDeps:S,parentComponent:t,camelWords:k(l)});continue}if(!c)continue;let{start:u,end:g}=s(e),f=K(n.join(`
430
- `),u),m=this.extractParams(a);if(r.symbols.push({name:l,category:"method",framework:"react",startLine:u,endLine:g,internalKey:this.buildSymbolKey(l,u,g,t),signature:`${l}(${(m||[]).join(", ")})`,params:m,isAsync:a.async===true,jsdoc:f,parentComponent:t,camelWords:k(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(_=>_.name===l&&_.startLine===u);if(S.args&&y!==-1){let _=String(S.args).replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g," ");r.symbols[y].camelWords+=` ${k(_)} ${_}`;}r.relations.push(U({callerName:l,callerLine:u,callerKey:this.buildSymbolKey(l,u,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 Pr=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=Pr("@babel/parser").parse(t,{sourceType:"module",plugins:["jsx","typescript","decorators-legacy","classProperties"],errorRecovery:!0}),a=t.split(`
431
- `),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:d}=this.getLineRange(i),u=this.buildSymbolKey(c,p,d);if(l&&(l.type==="ArrowFunctionExpression"||l.type==="FunctionExpression")){this.addFunctionSymbol(c,l,t,n,r,{startLine:p,endLine:d,isExported:s});continue}if(r.symbols.push({name:c,category:"constant",framework:n,startLine:p,endLine:d,internalKey:u,isExported:s,defaultValue:this.getLiteralValue(l),jsdoc:K(t.join(`
432
- `),p),camelWords:k(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:u,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:u,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(`
433
- `),i.startLine),parentComponent:i.ownerClass,camelWords:k(e)});let l=t.body;if(!l)return;let p=z(l,e,n,true);s.behaviors.push(...p);let d=G(l,e,n,true);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 u=un(l,e,n);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 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(`
434
- `),a),camelWords:k(i)});let l=e.body?.body;for(let p of l||[]){let d=p.key,u=d?.type==="Identifier"?String(d.name||""):"";if(!u||u==="constructor")continue;if(p.type==="ClassMethod"||p.type==="ClassPrivateMethod"){this.addFunctionSymbol(u,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(u,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 Or=new Set(["FunctionDeclaration","ArrowFunctionExpression","FunctionExpression","ObjectMethod","ClassMethod","ClassProperty"]);function bn(o,e){return !!e?.skipNestedFunctions&&Or.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;bn(i,t)||me(i,e,t);}continue}if(r&&typeof r=="object"&&r.type){let s=r;if(bn(s,t))continue;me(s,e,t);}}}}function En(o,e,t=true,n){let r=[],s=[],i=(a,c=120)=>Fr(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 d of l)r.push({symbolName:d,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 u=q(c);if(u){r.push({symbolName:u,kind:"assignment",line:p,text:l,sourceLayer:ne(l,p)});return}}if(c.type==="MemberExpression"){let d=te(c);if(d&&Pt(d)){let u=q(c);s.push({objectName:d,propertyName:u||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 u=q(c);if(u){r.push({symbolName:u,kind:"update",line:p,text:l,sourceLayer:ne(l,p)});return}}if(c.type==="MemberExpression"){let d=te(c);if(d&&Pt(d)){let u=q(c);s.push({objectName:d,propertyName:u||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 Fr(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 Mr=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=hn(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,jr(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 jr(o){let e=new Map;try{let n=Mr("@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)Nn(s,e);}catch{return e}return e}function Nn(o,e){if(o.type==="FunctionDeclaration"){let t=xe(o.id);if(!t)return;Ce(t,o,e),Ur(Br(o),t,e);return}if(o.type==="VariableDeclaration"){Tn(o,void 0,e);return}if(o.type==="ClassDeclaration"){Wr(o,e);return}if(o.type==="ExportNamedDeclaration"||o.type==="ExportDefaultDeclaration"){let t=o.declaration;if(!t)return;Nn(t,e);}}function Ur(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"){Tn(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 Tn(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 Wr(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=Xr(r||e),i=Kr(o,s.start,s.end,n),a=Hr(e);t.set(i,a);}function Hr(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;_n(s)||Ot(s,e);}continue}if(n&&typeof n=="object"&&n.type){let r=n;if(_n(r))continue;Ot(r,e);}}}function _n(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 Br(o){let e=o.body;return !e||e.type!=="BlockStatement"?[]:e.body||[]}function Xr(o){let e=o.loc;return {start:e?.start?.line??1,end:e?.end?.line??1}}function Kr(o,e,t,n){return n?`${n}:${o}:${e}:${t}`:`root:${o}:${e}:${t}`}var Sn=createRequire(import.meta.url);function xn(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}},zr=[new at,new we,new We,new ct,new Mt];function He(o,e){for(let t of zr)if(t.canParse(o,e)){let n=t.parse(o,e);return qr(n),Gr(n,e),n}return {framework:"js",filePath:o,symbols:[],relations:[],behaviors:[],errors:[`\u6CA1\u6709\u627E\u5230\u9002\u5408\u7684\u89E3\u6790\u5668: ${o}`]}}function Gr(o,e){if(o.symbols.length!==0)try{let t=e,n=o.filePath.endsWith(".vue"),r=0;if(n)try{let{parse:u}=Sn("@vue/compiler-sfc"),{descriptor:g}=u(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(u){xn(o,`\u751F\u547D\u5468\u671F\u63D0\u53D6\u8DF3\u8FC7: Vue SFC \u89E3\u6790\u5931\u8D25 - ${String(u)}`);return}let a=Sn("@babel/parser").parse(t,{sourceType:"module",plugins:["jsx","typescript","decorators-legacy"],errorRecovery:!0}).program.body;if(!a?.length)return;let c=t.split(`
435
- `),{assignments:l,propertyWrites:p}=En({type:"Program",body:a},o.filePath,!1,c);if(r>0){for(let u of l)u.line+=r;for(let u of p)u.line+=r;}let d=new Set(o.symbols.map(u=>u.name));o.assignments=l.filter(u=>d.has(u.symbolName)),o.propertyWrites=p.filter(u=>d.has(u.objectName));}catch(t){xn(o,`\u751F\u547D\u5468\u671F\u63D0\u53D6\u8DF3\u8FC7: AST \u89E3\u6790\u5931\u8D25 - ${String(t)}`);}}function qr(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 Be(o,e){let t=Jr(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?An(n.join(`
436
- `)):"",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?An(s.join(`
437
- `)):"";return {contentHash:t,exportSignatureHash:r,importSignatureHash:i}}function Rn(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 kn(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 Jr(o){return createHash("sha256").update(o,"utf-8").digest("hex").slice(0,16)}function An(o){return createHash("sha256").update(o,"utf-8").digest("hex").slice(0,12)}var Yr={maxFiles:20,maxTimeMs:1500},pt=class{pending=[];options;constructor(e){this.options={...Yr,...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}
438
- `);for(let r of e){let s=r.result.errors||[];s.includes(n)||(r.result.errors=[...s,n]);}}}async indexProject(e){let t=Date.now(),n=e?.include||[...St],r=e?.exclude||[...Tt],s=e?.force||false,i=Date.now(),a=await Zr(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,d=0,u=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(),_=Q__default.readFileSync(h,"utf-8"),E=Date.now()-y,A=Date.now(),N=He(h,_),x=Date.now()-A;p+=E,d+=x,f.push({absPath:h,relPath:b,result:N,parseMs:x,readMs:E,content:_,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"),_=Be(m.result,m.content);this.db.saveParseResult(m.result,m.absPath,m.relPath,b,y,S,m.mtime,_.exportSignatureHash,_.importSignatureHash),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}))),u+=Date.now()-h;}catch(b){this.db.recordIndexFailure(m.relPath,String(b)),l.errors.push({file:m.relPath,error:String(b)});}}}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,d+=b.parseMs||0,u+=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=d,l.phaseTimings.saveToDbMs=u,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.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 _=Q__default.readFileSync(b,"utf-8"),E=Me(_);if(S.contentHash===E){this.db.updateFileMtime(h,y.mtimeMs);continue}let A=He(b,_),N=Be(A,_),x=Rn(S,N);if(x==="unchanged")continue;let{files:L,truncated:w}=kn(h,x,i);w&&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
439
- `);for(let P of L)a.add(P);let M=x==="export_changed"||x==="full_changed"?"high":x==="import_changed"?"normal":"low";for(let P of L)this.scheduler.enqueue(P,M);}let{tasks:c,exceededBudget:l,remainingPending:p}=this.scheduler.dequeueBatch(),d=[],u=[],g=0;for(let h=0;h<c.length;h++){let S=c[h].relPath;if(a.add(S),Date.now()-t>=r){u.push(...c.slice(h));break}let y=this.fileAbsPath(S);if(!Q__default.existsSync(y)){this.removeFile(S);continue}try{let _=Q__default.readFileSync(y,"utf-8"),E=He(y,_),A=Me(_),N=qe(_),x=Buffer.byteLength(_,"utf-8");d.push({absPath:y,relPath:S,result:E,content:_,hash:A,lineCount:N,fileSize:x,mtime:Q__default.statSync(y).mtimeMs});}catch(_){this.db.recordIndexFailure(S,String(_)),process.stderr.write(`[Frontend-Code-Skimmer] Selective precise \u5931\u8D25: ${S} - ${String(_)}
440
- `);}}u.length>0&&this.scheduler.requeue(u),this.enhancePreciseRelations(d);for(let h of d)try{let b=Be(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),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)}
441
- `);}let f=Date.now()-t,m=p+u.length;return process.stderr.write(`[Frontend-Code-Skimmer] Selective precise: ${g}/${a.size} affected, ${f}ms, pending: ${m}${l||u.length>0?" (budget limited)":""}
442
- `),{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 y=Q__default.statSync(e);r=y.mtimeMs,s=y.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=Date.now(),c=Q__default.readFileSync(e,"utf-8"),l=Date.now()-a,p=Me(c);if(!n&&i&&i.hash===p)return r>0&&i.mtime!==r&&this.db.updateFileMtime(t,r),{skipped:true,symbolCount:0,readMs:l,parseMs:0,saveMs:0};let d=qe(c),u=Buffer.byteLength(c,"utf-8"),g=Date.now(),f=He(e,c),m=Date.now()-g,h=Be(f,c),b=Date.now();this.db.clearIndexFailures(t),this.db.saveParseResult(f,e,t,p,u,d,r,h.exportSignatureHash,h.importSignatureHash);let S=Date.now()-b;return {skipped:false,symbolCount:f.symbols.length,readMs:l,parseMs:m,saveMs:S,errors:f.errors}}removeFile(e){this.db.deleteFile(e);}fileAbsPath(e){return J__default.join(this.projectRoot,e)}async startWatcher(){let{default:e}=await import('chokidar'),t=e.watch([...St].map(r=>J__default.posix.join(this.projectRoot,r)),{cwd:this.projectRoot,ignored:[...Tt],persistent:true,ignoreInitial:true,awaitWriteFinish:{stabilityThreshold:ln}}),n=async r=>{let s=de(r,this.projectRoot);try{await this.indexFile(r,s),this.scheduler.enqueue(s,"normal"),process.stderr.write(`[Frontend-Code-Skimmer] \u5DF2\u66F4\u65B0\u7D22\u5F15: ${s}
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}
443
460
  `);}catch(i){process.stderr.write(`[Frontend-Code-Skimmer] \u66F4\u65B0\u5931\u8D25: ${s} - ${String(i)}
444
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}
445
- `);}),()=>t.close()}};var ts=8,ns=30,rs=14,ss=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=J__default.join(Qr.homedir(),".frontend-code-skimmer","databases"),Q__default.mkdirSync(this.globalCacheDir,{recursive:true}),this.defaultProject=process.env.SKIMMER_PROJECT||null,this.defaultProject&&(this.defaultProject=J__default.resolve(this.defaultProject)),this.maxOpenProjects=this.parsePositiveInt(process.env.SKIMMER_MAX_OPEN_PROJECTS,ts);let e=this.parsePositiveInt(process.env.SKIMMER_DB_IDLE_MINUTES,ns),t=this.parsePositiveInt(process.env.SKIMMER_DB_TTL_DAYS,rs);this.maxIdleMs=e*60*1e3,this.dbTtlMs=t*24*60*60*1e3,this.maybeCleanupDiskCache(Date.now());}resolveProjectRoot(e){if(e){let t=J__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=J__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 Ye(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}
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}
446
463
  `),process.stderr.write(`[Frontend-Code-Skimmer] \u6570\u636E\u5E93: ${r}
447
- `),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=J__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=J__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=J__default.resolve(e),r=this.watcherCleanups.get(n);if(r)try{r();}catch{}this.watcherCleanups.set(n,t);}hasWatcher(e){let t=J__default.resolve(e);return this.watcherCleanups.has(t)}closeProject(e){let t=J__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 J__default.resolve(process.env.SKIMMER_DB);let t=J__default.join(e,".agent","skimmer_find_symbol"),n=J__default.join(t,Je);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 J__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<ss)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(J__default.resolve(s));let r=e-this.dbTtlMs;for(let s of t){if(!s.isFile()||!s.name.endsWith(".db"))continue;let i=J__default.join(this.globalCacheDir,s.name);if(n.has(J__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(!os(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 os(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
+ `),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
448
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
449
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
450
467
  \u591A\u4E2A\u9879\u76EE\u4F1A\u5E76\u884C\u7F13\u5B58\uFF0C\u5207\u6362\u65E0\u9700\u91CD\u542F\u3002
@@ -455,45 +472,45 @@ import*as J from'path';import J__default from'path';import {fileURLToPath}from'u
455
472
  - \u5F3A\u5236\u5168\u91CF\u91CD\u5EFA: force=true
456
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
457
474
 
458
- \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:d,warnings:u}=vn(p,l),g=e.getIndexer(l),f=await g.indexProject({include:r,exclude:s,force:n,precisionMode:d,onProgress:(w,M)=>{(w%20===0||w===M)&&process.stderr.write(`[Frontend-Code-Skimmer] \u8FDB\u5EA6: ${w}/${M}
459
- `);}});e.setLastProject(l);let m=0;try{let w=Date.now(),M=await g.startWatcher();m=Date.now()-w,e.registerWatcher(l,M),process.stderr.write(`[Frontend-Code-Skimmer] \u6587\u4EF6\u76D1\u542C\u5DF2\u542F\u52A8: ${l}
460
- `);}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)}
461
- `);}let h=null;if(a)try{let w=await g.selectivePrecise({maxFiles:c||20});h={reindexedFiles:w.reindexedFiles,affectedFiles:w.affectedFiles.length,skippedByBudget:w.skippedByBudget};}catch(w){process.stderr.write(`[Frontend-Code-Skimmer] Selective precise \u5931\u8D25: ${String(w)}
462
- `);}let b=f.indexedFiles>0||f.totalFiles>0,S=f.totalSymbols>0,y=b?"\u2705 \u53EF\u7528":"\u274C \u65E0\u53EF\u67E5\u8BE2\u6587\u4EF6",_=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",A=b?"\u2705 \u53EF\u7528\uFF08\u57FA\u4E8E\u6B63\u5219\u626B\u63CF\u6587\u4EF6\uFF09":"\u274C \u65E0\u53EF\u67E5\u8BE2\u6587\u4EF6",N=f.phaseTimings,x=N?["","\u23F1\uFE0F \u3010\u9636\u6BB5\u8017\u65F6\u3011",` \u{1F50D} \u6587\u4EF6\u53D1\u73B0: ${N.discoverFilesMs}ms`,` \u{1F4D6} \u6587\u4EF6\u8BFB\u53D6: ${N.readFilesMs}ms`,` \u{1F52C} \u89E3\u6790: ${N.parseMs}ms`,` \u{1F4BE} \u6570\u636E\u5E93\u5199\u5165: ${N.saveToDbMs}ms`,` \u{1F4CA} \u603B\u8BA1: ${N.totalMs}ms`,` \u{1F4E1} \u6587\u4EF6\u76D1\u542C: ${m}ms`]:[],L=[`\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: ${d}`,` \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 ${_}`,` skimmer_get_component_outline ${_}`,` skimmer_find_by_behavior ${E}`,` skimmer_trace_data_lifecycle ${A}`,` skimmer_trace_assignments ${A}`,` 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){L.push(`
463
- \u26A0\uFE0F \u89E3\u6790\u5931\u8D25 (${f.errors.length} \u4E2A):`);for(let w of f.errors.slice(0,5))L.push(` - ${w.file}: ${w.error}`);f.errors.length>5&&L.push(` ... \u8FD8\u6709 ${f.errors.length-5} \u4E2A`);}if(u.length>0){L.push(""),L.push("\u26A0\uFE0F \u7CBE\u5EA6\u964D\u7EA7:");for(let w of u)L.push(` - ${w}`);}if(h){L.push(""),L.push("\u{1F3AF} \u9009\u62E9\u6027 Precise \u91CD\u7B97:"),L.push(` \u{1F4CA} \u91CD\u7B97\u6587\u4EF6: ${h.reindexedFiles}`),L.push(` \u{1F517} \u5F71\u54CD\u6587\u4EF6: ${h.affectedFiles} (\u5019\u9009\u6570)`),h.skippedByBudget>0&&(L.push(` \u23F8\uFE0F \u8D85\u9884\u7B97\u8DF3\u8FC7\u7684\u6587\u4EF6: ${h.skippedByBudget}`),L.push(" \u{1F4A1} \u540E\u7EED watcher \u89E6\u53D1\u6216\u518D\u6B21\u8C03\u7528 selective_precise=true \u7EE7\u7EED"));let w=g.getScheduler().pendingCount;w>0&&L.push(` \u{1F4CB} Pending queue: ${w} \u6587\u4EF6\u5F85\u91CD\u7B97`);}return {content:[{type:"text",text:L.join(`
464
- `)}]}});}function Ut(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 $n(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}=Ut(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(`
465
- `)}function In(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: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
466
483
  \u5305\u542B: props\u3001data/state\u3001computed\u3001methods/functions\u3001watch/effect\u3001lifecycle\u3001\u884C\u4E3A\u6807\u7B7E\u3002
467
484
  \u884C\u4E3A\u6807\u7B7E\u81EA\u52A8\u6807\u51FA: [storage:localStorage.setItem] [network:axios.get] \u7B49\u3002
468
485
 
469
486
  project_path \u53EF\u7701\u7565\uFF08\u4F7F\u7528\u4E0A\u6B21 skimmer_index_project \u6307\u5B9A\u7684\u9879\u76EE\uFF09\u3002
470
- 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 _=Math.round((performance.now()-s)*100)/100,E=H({durationMs:_,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 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}
471
488
 
472
489
  \u8BF7\u5148\u8FD0\u884C:
473
490
  skimmer_index_project({ project_path: "${n||"<\u9879\u76EE\u8DEF\u5F84>"}" })
474
491
 
475
492
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
476
- ${W(E)}`}]}}let p="",d=a.abs_path,{stale:u,reason:g}=Ut(i,d,t);u&&(p=`
493
+ ${W(E)}`}]}}let p="",u=a.abs_path,{stale:d,reason:g}=Bt(i,u,t);d&&(p=`
477
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
478
495
  \u7ACB\u5373\u91CD\u5EFA: skimmer_index_project({ force: true })
479
- `);let f=new Map;for(let _ of l){let E=_.symbol_id;f.has(E)||f.set(E,[]);let A=`[${_.category}:${_.api_name}.${_.operation}${_.detail?`("${_.detail}")`:""}]`,N=f.get(E);N.includes(A)||N.push(A);}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 _ of c){if(_.name==="<template>")continue;let E=_.category;h[E]||(h[E]=[]),h[E].push(_);}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:_,icon:E,label:A}of b){let N=h[_];if(N?.length){m.push(`
480
- ${E} ${A} (${N.length}):`);for(let x of N){let L=x.name,w=ke(x.start_line,x.end_line),M=je(x.params_json,[]),P=M.length>0?`(${M.join(", ")})`:"",B=x.default_value?` = ${x.default_value}`:"",ce=x.is_async?"async ":"",ye=f.get(x.id),Ae=ye?.length?` ${ye.slice(0,3).join(" ")}`:"",Y=x.state_setter_name?` \u2192 ${x.state_setter_name}`:"",le=x.hook_deps_json?` [deps:${je(x.hook_deps_json,[]).join(",")}]`:"";m.push(` \u2022 ${ce}${L}${P}${B}${Y}${le} ${w}${Ae}`);}}}m.push(`
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(`
481
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(`
482
499
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
483
500
  ${W(y)}`),{content:[{type:"text",text:m.join(`
484
- `)}]}});}var Xe=class{constructor(e){this.db=e;}db;search(e,t){let{category:n,framework:r,filePath:s,limit:i=an,fuzzy:a=true,allowFallbackScan:c=false,debug:l=false}=t||{},p=e.trim(),d=new Map,u={},g=performance.now(),f=this.db.exactSearch(p,n,r,s);for(let A of f)d.set(A.id,{symbol:A,filePath:A.file_path,score:100,matchReason:"\u7CBE\u786E\u5339\u914D"});if(u["1_exact"]=Math.round((performance.now()-g)*100)/100,d.size>=i)return {results:this.rankResults(d,i)};let m=performance.now(),h=0,b=k(p),S=[p,b,...b.split(" ")].filter(Boolean).filter((A,N,x)=>x.indexOf(A)===N);for(let A of S){if(A.length<2)continue;let N=this.db.ftsSearch(A,n,r,s,i);h+=N.length;for(let x of N){let L=x.id;if(d.has(L))continue;let w=this.calcFtsScore(p,x.name);d.set(L,{symbol:x,filePath:x.file_path,score:w,matchReason:`FTS5 \u524D\u7F00\u5339\u914D ("${A}")`});}}if(u["2_fts"]=Math.round((performance.now()-m)*100)/100,d.size>=i)return {results:this.rankResults(d,i),debug:l?{phase_timings:u,candidate_count:h}:void 0};let y=a&&p.length>=3,_=0;if(y){let A=performance.now(),N=this.db.getAllSymbolNames(s),x=p.toLowerCase(),L=k(p).split(" ");for(let{name:w,file_path:M,id:P}of N){if(d.has(P))continue;_++;let B=Ge(x,w.toLowerCase()),ce=Math.max(x.length,w.length),ye=Math.min(cn,Math.max(1,Math.floor(ce*.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 se=Qt(p,w,B);d.set(P,{symbol:X,filePath:M,score:le,matchReason:`\u6A21\u7CCA\u5339\u914D (\u7F16\u8F91\u8DDD\u79BB=${B})`,spellingSuggestion:se});continue}let Ae=k(w).split(" "),Y=L.filter(le=>Ae.some(X=>Zt(le,X)>=75));if(Y.length>0&&Y.length>=Math.ceil(L.length*.5)){let le=50+Y.length*10,X=this.db.getSymbolById(P);if(!X||n&&X.category!==n||r&&X.framework!==r)continue;d.set(P,{symbol:X,filePath:M,score:le,matchReason:`\u5355\u8BCD\u5339\u914D (${Y.join(", ")})`});}}u["3_fuzzy"]=Math.round((performance.now()-A)*100)/100;}if(d.size===0&&c){let A=performance.now(),N=this.db.ftsSearchWithFallback(p,n,r,s,i);for(let x of N){let L=x.id;d.has(L)||d.set(L,{symbol:x,filePath:x.file_path,score:50,matchReason:"LIKE \u5168\u8868\u626B\u63CF fallback"});}u["4_fallback"]=Math.round((performance.now()-A)*100)/100;}let E=l?{phase_timings:u,candidate_count:h+_,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(d,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=k(e).split(" "),i=k(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 Mn=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,"\\$&")}function $e(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(`
485
- `);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 Pn(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 Mn("@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}=Mn("@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(`
486
- `).length;return [{content:t[1],lineOffset:r}]}function _e(o,e){return (o.loc?.start?.line??1)+e-1}function Xt(o,e){if(o.type!=="MemberExpression")return false;let t=o.object;return !t||t.type!=="ThisExpression"?false:q(o)===e}function Wt(o,e){return !!o&&o.type==="Identifier"&&String(o.name||"")===e}function jn(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 Ht(o,e,t=2){if(!Q__default.existsSync(o))return {snippet:"",startLine:e};let n=Q__default.readFileSync(o,"utf-8").split(`
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(`
487
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(`
488
- `),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 On={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 Fn(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(`
489
- `),a=Et(r.path||J__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 d=p.id;if(!d||d.type!=="Identifier")return;let u=String(d.name||"");if(!u||u===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=Xt(g,e)||q(g)===e),!f)return;let m=_e(p,c.lineOffset),h=i[m-1]?.trim()||"";n.push({alias:u,filePath:r.path,abs_path:r.abs_path,line:m,text:h});});}}return n}function Dn(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(`
490
- `),a=Et(r.path||J__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 d=p.id;if(!d||d.type!=="ObjectPattern")return;let u=d.properties||[];for(let g of u){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 Bt(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(`
491
- `),c=Et(s.path||J__default.basename(s.abs_path),i);for(let l of c){let p=bt(l.content);if(p&&(me(p,d=>{if(!(r.length>=n)){if(d.type==="VariableDeclarator"){let u=d.id;if(Wt(u,e)){let g=_e(d,l.lineOffset);r.push({filePath:s.path,line:g,kind:"declaration",text:a[g-1]?.trim()||""});}}if(d.type==="AssignmentExpression"){let u=d.left;if(!u)return;let g=_e(d,l.lineOffset);if(Wt(u,e)||Xt(u,e)){r.push({filePath:s.path,line:g,kind:"assignment",text:a[g-1]?.trim()||""});return}t&&u.type==="MemberExpression"&&te(u)===e&&r.push({filePath:s.path,line:g,kind:u.computed?"indexed_assignment":"property_assignment",text:a[g-1]?.trim()||""});}if(d.type==="UpdateExpression"){let u=d.argument;if(!u)return;if(Wt(u,e)||Xt(u,e)){let g=_e(d,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 jn(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(`
492
- `),c=Et(s.path||J__default.basename(s.abs_path),i);for(let l of c){let p=bt(l.content);if(p&&(me(p,d=>{if(!(r.length>=n)){if(d.type==="AssignmentExpression"){let u=d.left;if(!u||u.type!=="MemberExpression"||te(u)!==e)return;let f=q(u);if(t&&f!==t)return;let m=_e(d,l.lineOffset);r.push({filePath:s.path,line:m,kind:u.computed?"bracket":"dot",text:a[m-1]?.trim()||""});}if(d.type==="UpdateExpression"){let u=d.argument;if(!u||u.type!=="MemberExpression"||te(u)!==e)return;let f=q(u);if(t&&f!==t)return;let m=_e(d,l.lineOffset);r.push({filePath:s.path,line:m,kind:u.computed?"bracket":"dot",text:a[m-1]?.trim()||""});}if(d.type==="UnaryExpression"&&d.operator==="delete"){let u=d.argument;if(!u||u.type!=="MemberExpression"||te(u)!==e)return;let f=q(u);if(t&&f!==t)return;let m=_e(d,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 jn(r).slice(0,n)}function Un(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
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
493
510
  \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
494
511
  \u9A7C\u5CF0\u62C6\u8BCD\uFF1A\u641C "change cache" \u4E5F\u80FD\u627E\u5230 "changeCacheValue"\u3002
495
512
  \u6846\u67B6\u611F\u77E5\uFF1A\u53EF\u6309 vue2/vue3/react \u8FC7\u6EE4\u3002
496
- 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 d=performance.now(),{db:u}=e.getContext(n),g=new Xe(u),{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()-d)*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
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
497
514
 
498
515
  \u{1F4A1} \u5C1D\u8BD5:
499
516
  skimmer_find_by_behavior \u6309\u884C\u4E3A\u641C\u7D22
@@ -502,47 +519,47 @@ project_path \u53EF\u7701\u7565\u3002`,inputSchema:z$1.object({query:z$1.string(
502
519
 
503
520
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
504
521
  ${W(b)}`}]};let S=[`\u{1F50D} \u641C\u7D22 "${t}" \u2014 \u627E\u5230 ${f.length} \u4E2A\u7ED3\u679C
505
- `];return f.forEach((y,_)=>{let E=y.symbol,A=je(E.params_json,[]),N=A.length>0?`(${A.join(", ")})`:"",x=ke(E.start_line,E.end_line);S.push(`${_+1}. ${E.name}${N} [${E.category}/${E.framework}] \u5339\u914D\u5EA6: ${y.score}%`),S.push(` \u{1F4C4} ${y.filePath}:${x}`),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
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
506
523
  ${W(b)}`),{content:[{type:"text",text:S.join(`
507
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
508
525
  \u540C\u65F6\u8FD4\u56DE\u8BE5\u7B26\u53F7\u7684\u884C\u4E3A\u6807\u7B7E\uFF08\u64CD\u4F5C\u4E86\u54EA\u4E9B\u5916\u90E8 API\uFF09\u3002
509
- 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 x=Math.round((performance.now()-i)*100)/100,L=H({durationMs:x,resultCount:0,backend:"indexed"});return {content:[{type:"text",text:`\u274C \u672A\u627E\u5230: ${n}
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}
510
527
  \u{1F4C4} \u6587\u4EF6: ${t}
511
528
 
512
529
  \u{1F4A1} \u8BD5\u8BD5: skimmer_find_symbol({ query: "${n}" })
513
530
 
514
531
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
515
- ${W(L)}`}]}}let l=c.abs_path;if(!Q__default.existsSync(l))return {content:[{type:"text",text:`\u274C \u6587\u4EF6\u4E0D\u5B58\u5728: ${l}`}]};let d=Q__default.readFileSync(l,"utf-8").split(`
516
- `),u=Math.max(1,c.start_line-s)-1,g=Math.min(d.length,c.end_line+s),f=d.slice(u,g).join(`
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(`
517
534
  `),h=f.includes(n)?"":`
518
535
  \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
519
- \u6587\u4EF6\u5DF2\u88AB\u4FEE\u6539\u4F46\u7D22\u5F15\u672A\u66F4\u65B0\uFF0C\u884C\u53F7\u53EF\u80FD\u504F\u79FB ${d.length-c.end_line} \u884C\u5DE6\u53F3\u3002
536
+ \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
520
537
  \u5EFA\u8BAE: skimmer_index_project({ force: true })
521
- `,{behaviors:b}=a.getFileOutline(t),S=b.filter(x=>x.symbol_id===c.id),y=l.split(".").pop()||"js",_=["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 x=[...new Set(S.map(L=>`[${L.category}:${L.api_name}.${L.operation}${L.detail?`("${L.detail}")`:""}]`))];E.push(`\u{1F3F7}\uFE0F \u884C\u4E3A: ${x.join(" ")}`);}E.push(`
522
- \`\`\`${_}`),E.push(f),E.push("```");let A=Math.round((performance.now()-i)*100)/100,N=H({durationMs:A,resultCount:1,backend:"indexed"});return E.push(`
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(`
523
540
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
524
- ${W(N)}`),{content:[{type:"text",text:E.join(`
541
+ ${W(_)}`),{content:[{type:"text",text:E.join(`
525
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
526
543
  \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
527
544
  \u2705 \u672C\u5DE5\u5177\u9002\u5408\uFF1Aloading / errorMsg / count \u8FD9\u7C7B\u7B80\u5355 flag \u7684\u8D4B\u503C\u8FFD\u8E2A\u3002
528
- \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)),d=s??true,u=c.exactSearch(t,"state",void 0,r||void 0),g={vue2:"Vue2 data()",vue3:"Vue3 ref/reactive",react:"React useState/useRef"},f=u.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=Bt(l,t,d,p);if(m.length===0){let E=Pn(t,d);m=$e(l,E,p);}let h=new Map;for(let E of [...f,...m]){let A=`${E.filePath}:${E.line}`;h.has(A)||h.set(A,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}"
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}"
529
546
  \u672A\u627E\u5230\u5339\u914D\u8D4B\u503C\u8BED\u53E5\uFF08\u5305\u62EC\u58F0\u660E\u521D\u59CB\u5316\uFF09
530
- \u8FC7\u6EE4: file_path=${r||"*"} include_properties=${d}
547
+ \u8FC7\u6EE4: file_path=${r||"*"} include_properties=${u}
531
548
 
532
549
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
533
- ${W(E)}`}]}}let y=[`\u{1F9E9} \u53D8\u91CF\u8D4B\u503C\u8FFD\u8E2A: "${t}"`,`\u8FC7\u6EE4: file_path=${r||"*"} include_properties=${d}`,`\u547D\u4E2D: ${b.length} \u5904${f.length>0?`\uFF08\u542B ${f.length} \u5904\u58F0\u660E\u521D\u59CB\u5316\uFF09`:""}`,""];b.forEach((E,A)=>{y.push(`${A+1}. [${E.kind}] \u{1F4C4} ${E.filePath}:L${E.line}`),y.push(` ${E.text}`);});let _=H({durationMs:S,resultCount:b.length,backend:"ast_scan"});return y.push(`
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(`
534
551
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
535
- ${W(_)}`),{content:[{type:"text",text:y.join(`
552
+ ${W(T)}`),{content:[{type:"text",text:y.join(`
536
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
537
554
  \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
538
555
  \u2705 \u672C\u5DE5\u5177\u9002\u5408\uFF1Aobject.specificProp \u7684\u5355\u5B57\u6BB5\u7EA7\u522B\u7CBE\u786E\u8FFD\u8E2A\u3002
539
- \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)),d=Fn(l,t,20),u=Dn(l,t,20),g=[...new Set([...d.map(y=>y.alias),...u.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="(?:=|\\+=|-=|\\*=|/=|%=|\\|=|&=|\\^=|&&=|\\|\\|=|\\?\\?=)",_=[];for(let E of f){let A=Ke(E);if(n){let N=Ke(n);_.push({kind:"dot",regex:new RegExp(`\\b${A}\\.${N}\\s*${y}`)},{kind:"bracket",regex:new RegExp(`\\b${A}\\s*\\[(?:'${N}'|"${N}")\\]\\s*${y}`)},{kind:"delete",regex:new RegExp(`\\bdelete\\s+${A}\\.(?:${N})\\b`)});}else _.push({kind:"dot",regex:new RegExp(`\\b${A}\\.[A-Za-z_$][\\w$]*\\s*${y}`)},{kind:"bracket",regex:new RegExp(`\\b${A}\\s*\\[(?:'[^']+'|"[^"]+")\\]\\s*${y}`)},{kind:"delete",regex:new RegExp(`\\bdelete\\s+${A}\\.[A-Za-z_$][\\w$]*\\b`)});}m=$e(l,_,p);}let h=Math.round((performance.now()-a)*100)/100;if(m.length===0){let y=g.length>0?`
540
- \u522B\u540D\u5C55\u5F00: ${g.join(", ")}\uFF08\u5747\u672A\u547D\u4E2D\uFF09`:"",_=H({durationMs:h,resultCount:0,backend:"ast_scan"});return {content:[{type:"text",text:`\u{1F9ED} \u5C5E\u6027\u4FEE\u6539\u8FFD\u8E2A: ${t}${n?`.${n}`:".*"}
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}`:".*"}
541
558
  \u672A\u627E\u5230\u5339\u914D\u8BED\u53E5${y}
542
559
  \u8FC7\u6EE4: file_path=${s||"*"}
543
560
 
544
561
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
545
- ${W(_)}`}]}}let b=[`\u{1F9ED} \u5C5E\u6027\u4FEE\u6539\u8FFD\u8E2A: ${t}${n?`.${n}`:".*"}`,`\u8FC7\u6EE4: file_path=${s||"*"}`];if(g.length>0){let y=d.map(E=>E.alias).filter(E=>E!==t).join(", "),_=u.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`),_&&b.push(`\u26A1 \u89E3\u6784\u522B\u540D: ${_}\uFF08\u901A\u8FC7 const { ${t}: alias } \u5C55\u5F00\uFF09`);}b.push(`\u547D\u4E2D: ${m.length} \u5904`,""),m.forEach((y,_)=>{b.push(`${_+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(`
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(`
546
563
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
547
564
  ${W(S)}`),{content:[{type:"text",text:b.join(`
548
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
@@ -552,22 +569,22 @@ ${W(S)}`),{content:[{type:"text",text:b.join(`
552
569
  - \u627E\u53D1\u8BF7\u6C42\u7684: { category: "network" }
553
570
  - \u627E\u8DEF\u7531\u8DF3\u8F6C\u7684: { category: "router" }
554
571
  - \u6309 key \u540D\u641C\u7D22: { keyword: "cacheData" }
555
- 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),d=new Xe(l).searchByBehavior({category:n,apiName:r,operation:s,keyword:i,filePath:a}),u=new Set(["localstorage","sessionstorage","cookie"]);r||(d=d.filter(b=>b.category!=="storage"||u.has(b.apiName.toLowerCase())));let g=Math.round((performance.now()-c)*100)/100,f=H({durationMs:g,resultCount:d.length,backend:"indexed"});if(d.length===0)return {content:[{type:"text",text:`\u{1F3F7}\uFE0F \u672A\u627E\u5230\u5339\u914D\u7684\u884C\u4E3A
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
556
573
  \u8FC7\u6EE4\u6761\u4EF6: ${JSON.stringify({category:n,api_name:r,operation:s,keyword:i,file_path:a})}
557
574
 
558
575
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
559
- ${W(f)}`}]};let m=new Map;for(let b of d){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 ${d.length} \u6761
560
- `];for(let[b,S]of m){let[y,_]=b.split(":"),E=new Map;for(let A of S)E.has(A.operation)||E.set(A.operation,[]),E.get(A.operation).push(A);h.push(`\u{1F4C2} ${y} \u2192 ${_}:`);for(let[A,N]of E){h.push(` ${A}:`);let x=new Map;for(let L of N){let w=`${L.symbolName}|${L.filePath}`;x.has(w)||x.set(w,{item:L,callLines:[]}),x.get(w).callLines.push(L.line);}for(let{item:L,callLines:w}of x.values()){let M=L.detail?` key="${L.detail}"`:"",P=w.length>1?` \xD7${w.length} (L${w.join(", L")})`:` L${w[0]||L.startLine}`;h.push(` \u2022 ${L.symbolName}${M}${P} \u{1F4C4} ${L.filePath}:${ke(L.startLine,L.endLine)}`);}}h.push("");}return h.push(`\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
561
578
  ${W(f)}`),{content:[{type:"text",text:h.join(`
562
- `)}]}}),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')}),annotations:{readOnlyHint:true,destructiveHint:false}},async({symbol_name:t,project_path:n,file_path:r,direction:s,arg_keyword:i})=>{let a=performance.now(),{db:c}=e.getContext(n),l=c.getSymbolByName(t,r),p=[`\u{1F4CA} ${t} \u7684\u8C03\u7528\u56FE\u8C31
563
- `],d=0,u=0,g=[],f=[],m=void 0;if(s==="callers"||s==="both"){if(g=c.getCallers(t,m,i),d+=g.length,u+=g.filter(_=>_.edge_kind==="precise").length,p.push(`\u2B06\uFE0F \u88AB\u8C03\u7528 (${g.length} \u5904):`),g.length===0)p.push(" \uFF08\u672A\u627E\u5230\u8C03\u7528\u8005\uFF09");else {let _={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 E of g){let A=E.args?` \u53C2\u6570: "${E.args}"`:"",N=E.source_kind||"",x=E.edge_kind||"",L=_[N]?` ${_[N]}`:"",w=x==="precise"?" [\u{1F3AF}precise]":"";p.push(` \u2022 ${E.caller_name} [${E.category}]${L}${w} \u{1F4C4} ${E.file_path}:L${E.start_line}${A}`);}}p.push("");}if((s==="callees"||s==="both")&&l){if(f=c.getCallees(l.id),d+=f.length,u+=f.filter(_=>_.edge_kind==="precise").length,p.push(`\u2B07\uFE0F \u8C03\u7528\u4E86 (${f.length} \u4E2A):`),f.length===0)p.push(" \uFF08\u672A\u5206\u6790\u5230\u8C03\u7528\u5173\u7CFB\uFF09");else for(let _ of f){let E=_.args?`("${_.args}")`:"",N=(_.edge_kind||"")==="precise"?" [\u{1F3AF}precise]":"";p.push(` \u2022 ${_.callee_name}${E} [${_.call_type}]${N} L${_.line_number}`);}p.push("");}if(l){let{behaviors:_}=c.getFileOutline(l.file_path),E=_.filter(A=>A.symbol_id===l.id);if(E.length>0){p.push("\u{1F4E6} \u5916\u90E8\u72B6\u6001\u64CD\u4F5C:");for(let A of E){let N=A.detail?` ("${A.detail}")`:"";p.push(` \u2022 ${A.api_name}.${A.operation}${N} [${A.category}] L${A.line_number}`);}}}let h=Math.round((performance.now()-a)*100)/100,b=u>0?"precise":"heuristic",S=[];b==="heuristic"&&d>0&&S.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 y=H({durationMs:h,resultCount:d,backend:"indexed",precisionEffective:b,precisionWarnings:S.length>0?S:void 0});return p.push(`
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(`
564
581
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
565
- ${W(y)}`),{content:[{type:"text",text:p.join(`
566
- `)}]}}),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")}),annotations:{readOnlyHint:true,destructiveHint:false}},async({symbol_name:t,project_path:n,file_path:r})=>{let s=performance.now(),{db:i}=e.getContext(n),a=i.getSymbolByName(t,r),c=i.getCallers(t),{behaviors:l}=a?i.getFileOutline(a.file_path):{behaviors:[]},p=a?l.filter(b=>b.symbol_id===a.id):[],d=c.length===0?"\u{1F7E2}":c.length<=3?"\u{1F7E1}":"\u{1F534}",u=c.length===0?"\u4F4E":c.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",`${d} \u98CE\u9669\u7B49\u7EA7: ${u} (${c.length} \u5904\u76F4\u63A5\u8C03\u7528)`,""],f={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(c.length>0?(g.push("\u{1F534} \u76F4\u63A5\u5F71\u54CD:"),c.forEach((b,S)=>{let y=b.source_kind||"",_=f[y]?` ${f[y]}`:"";g.push(` ${S+1}. ${b.caller_name} [${b.category}]${_} \u{1F4C4} ${b.file_path}:L${b.start_line}`);}),g.push("")):g.push(`\u2705 \u65E0\u8C03\u7528\u8005\uFF0C\u5F71\u54CD\u8303\u56F4\u53EF\u63A7
567
- `),a){let b=i.getFileDependencies(a.file_path,"to");if(b.length>0){g.push(`\u{1F4C2} \u6587\u4EF6\u4F9D\u8D56 (${b.length} \u4E2A\u6587\u4EF6 import \u4E86\u6B64\u6587\u4EF6):`);let S={import:"\u{1F4E5}",re_export:"\u{1F504}",component_ref:"\u{1F9E9}",store_ref:"\u{1F4E6}",api_ref:"\u{1F310}"};b.slice(0,10).forEach(y=>{g.push(` ${S[y.dependency_kind]||"\u2022"} ${y.from_file} (${y.dependency_kind})`);}),g.push("");}}if(p.length>0){g.push("\u{1F4E6} \u5916\u90E8\u72B6\u6001\u5F71\u54CD:");for(let b of p)g.push(` \u2022 ${b.api_name}.${b.operation}${b.detail?` key="${b.detail}"`:""} [${b.category}]`);g.push(`
568
- \u26A0\uFE0F \u4FEE\u6539\u65F6\u6CE8\u610F\u5916\u90E8\u72B6\u6001\u7684\u8BFB\u5199\u683C\u5F0F\u4FDD\u6301\u4E00\u81F4`);}let m=Math.round((performance.now()-s)*100)/100,h=H({durationMs:m,resultCount:c.length,backend:"indexed"});return g.push(`
582
+ ${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(`
569
586
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
570
- ${W(h)}`),{content:[{type:"text",text:g.join(`
587
+ ${W(T)}`),{content:[{type:"text",text:b.join(`
571
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
572
589
 
573
590
  \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
@@ -586,19 +603,19 @@ ${W(h)}`),{content:[{type:"text",text:g.join(`
586
603
  \u65E7\u65B9\u5F0F: trace_assignments \u2192 find_symbol \u2192 get_code_slice \u2192 find_by_behavior \u2192 trace_key_flow
587
604
  \u65B0\u65B9\u5F0F: skimmer_trace_data_lifecycle({ variable: "xxx" }) \u2190 \u76F4\u63A5\u5F97\u5230\u5168\u90E8
588
605
 
589
- 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)),d=Math.min(120,Math.max(1,a||40)),u=l.listFiles(r),g="",f=$n(l,u,r?u.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:
590
- `+f.staleFilePaths.slice(0,3).map(T=>` \u2022 ${T}`).join(`
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(`
591
608
  `)+`
592
609
  \u5EFA\u8BAE: skimmer_index_project({ force: true })
593
- `);let m=Dn(u,t,20),h=[...new Set(m.map(T=>T.alias).filter(T=>T!==t))],b=Fn(u,t,20),S=[...new Set(b.map(T=>T.alias).filter(T=>T!==t))],y=[...new Set([...h,...S])],E=[t,...y],A=l.exactSearch(t,"state",void 0,r||void 0),N={vue2:"Vue2 data()",vue3:"Vue3 ref/reactive",react:"React useState/useRef"},x=A.filter(T=>T.default_value!=null).map(T=>({filePath:T.file_path,line:T.start_line,kind:`data_init(${N[T.framework]||T.framework})`,text:`${T.name}: ${T.default_value} \u2190 \u58F0\u660E\u521D\u59CB\u5316`})),L=false,w=l.getAssignments(t,r,d),M=[];w.length>0?(M=w.map(T=>({filePath:T.file_path,line:T.line_number,kind:T.kind,text:T.text_snippet||"",sourceLayer:T.source_layer||void 0})),L=true):M=Bt(u,t,false,d);for(let T of y){let $=l.getAssignments(T,r,Math.floor(d/2));$.length>0?M.push(...$.map(R=>({filePath:R.file_path,line:R.line_number,kind:R.kind,text:R.text_snippet||"",sourceLayer:R.source_layer||void 0}))):M.push(...Bt(u,T,false,Math.floor(d/2)));}let P=M.length===0?$e(u,Pn(t,false),d):[],B=new Map;for(let T of [...x,...M.length>0?M:P]){let $=`${T.filePath}:${T.line}`;B.has($)||B.set($,T);}let ce=[...B.values()],ye=false,Ae=l.getPropertyWrites(t,void 0,r,d),Y=[];Ae.length>0?(Y=Ae.map(T=>({filePath:T.file_path,line:T.line_number,kind:T.kind,text:T.text_snippet||"",sourceLayer:T.source_layer||void 0})),ye=true):Y=ht(u,t,void 0,d);for(let T of y){let $=l.getPropertyWrites(T,void 0,r,Math.floor(d/2));$.length>0?Y.push(...$.map(R=>({filePath:R.file_path,line:R.line_number,kind:R.kind,text:R.text_snippet||"",sourceLayer:R.source_layer||void 0}))):Y.push(...ht(u,T,void 0,Math.floor(d/2)));}let le=Y.length===0?$e(u,[{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`)}],d):[],X=Y.length>0?Y:le,se=l.findRelationsByArgKeyword(t,r,d);for(let T of y)se.push(...l.findRelationsByArgKeyword(T,r,Math.floor(d/2)));let Vt=[],zt=[],Gt=[];for(let T of E){let $=Ke(T),R=/^[a-zA-Z_$][\w$]*$/.test(T)?"\\b":"";Vt.push({kind:"template",regex:new RegExp(`(?::\\w+|v-model|v-if|v-show|@\\w+)="[^"]*${R}${$}${R}|\\{\\{[^}]*${R}${$}${R}[^}]*\\}\\}`)},{kind:"return",regex:new RegExp(`\\breturn\\b[^=]*${R}${$}${R}`)},{kind:"watch",regex:new RegExp(`watch[^(]*['"]\\.?${$}['"]`)},{kind:"computed_read",regex:new RegExp(`=>[^=]*${R}${$}${R}|return[^=]*${R}${$}${R}`)},{kind:"arg_usage",regex:new RegExp(`\\(\\s*[^)]*${R}${$}${R}[^)]*\\)`)}),zt.push(`${R}${$}${R}\\s*(?:=|\\+=|-=|\\*=|\\/=)(?!=)|\\b(?:const|let|var)\\s+${$}\\b`),Gt.push(`${R}${$}${R}\\.\\w+\\s*(?:=|\\+=|-=)(?!=)|${R}${$}${R}\\s*\\[`);}let zn=$e(u,Vt,d),Gn=new RegExp(zt.join("|")),qn=new RegExp(Gt.join("|")),Pe=zn.filter(T=>!Gn.test(T.text)&&!qn.test(T.text)),_t=new Map,qt=(T,$)=>{if(!_t.has(T)){let{behaviors:O}=l.getFileOutline(T),I=new Map;for(let j of O){let ee=String(j.symbol_name||"");I.has(ee)||I.set(ee,[]),I.get(ee).push(j);}_t.set(T,I);}return (_t.get(T)?.get($)||[]).filter(O=>String(O.category||"")!=="storage"?false:s==="all"?true:String(O.api_name||"").toLowerCase()===s.toLowerCase())},Jn=(T,$)=>{let R=[],O=[{name:T,filePath:$,path:[T],level:0}],I=new Set([`${$}::${T}`]);for(;O.length>0;){let j=O.shift(),ee=qt(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=qt(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 Yt=`${pe}::${De}`;I.has(Yt)||(I.add(Yt),O.push({name:De,filePath:pe,path:[...j.path,De],level:j.level+1}));}}return R},Yn=y.length>0?`
594
- \u{1F517} \u53D1\u73B0\u522B\u540D: ${y.map(T=>`"${T}"`).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(T=>{let R=u.find(j=>j.path===T.filePath)?.abs_path||T.abs_path,O=gt("alias_ref"),I=R?Ht(R,T.line,2):{snippet:""};Le.push(` \u{1F4C4} ${T.filePath}:L${T.line} "${T.alias}" = ... ${O}`),Le.push(` ${T.text}`),I.snippet&&Le.push(I.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}${Yn}`,""];if(g&&C.push(g),C.push(`\u2460 \u58F0\u660E & \u6574\u4F53\u8D4B\u503C (${ce.length} \u5904)`),ce.length===0)C.push(" \uFF08\u672A\u627E\u5230\uFF09");else {let T={init:[],cache:[],user:[],unknown:[]};for(let R of ce){let O=R.sourceLayer||ne(R.text,R.line);T[O].push(R);}let $=["init","cache","user","unknown"];for(let R of $){let O=T[R];!O||O.length===0||(C.push(` \u25B8 ${On[R]} (${O.length} \u5904)`),O.slice(0,8).forEach(I=>{let j=y.includes(I.text.split("=")[0]?.trim().replace(/^(?:const|let|var)\s+/,"")||""),ee=gt(I.kind,j);C.push(` \u{1F4C4} ${I.filePath}:L${I.line} [${I.kind}] ${ee}`),C.push(` ${I.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(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 X){let O=R.sourceLayer||ne(R.text,R.line);T[O].push(R);}let $=["init","cache","user","unknown"];for(let R of $){let O=T[R];!O||O.length===0||(C.push(` \u25B8 ${On[R]} (${O.length} \u5904)`),O.slice(0,8).forEach(I=>{let j=y.some(Fe=>I.text.startsWith(Fe)),ee=gt(I.kind,j),pe=u.find(Fe=>Fe.path===I.filePath)?.abs_path||"",Oe=pe?Ht(pe,I.line,2):{snippet:""},Nt=j?" \u{1F517}(via alias)":"";C.push(` \u{1F4C4} ${I.filePath}:L${I.line} [${I.kind}] ${ee}${Nt}`),Oe.snippet&&C.push(Oe.snippet);}));}}if(C.push(""),C.push(`\u2462 \u4F5C\u4E3A\u53C2\u6570\u88AB\u4F20\u5165\u8C03\u7528 (${se.length} \u5904)`),se.length===0?C.push(" \uFF08\u672A\u53D1\u73B0\u4EE5\u8BE5\u53D8\u91CF\u4F5C\u4E3A\u53C2\u6570\u7684\u51FD\u6570\u8C03\u7528\uFF09"):se.slice(0,20).forEach(T=>{let $=String(T.args||"");C.push(` \u{1F4C4} ${T.file_path}:L${T.line_number} ${T.caller_name} \u2192 ${T.callee_name} \u53C2\u6570: "${$}"`);}),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 T=new Map;for(let R of Pe)T.has(R.kind)||T.set(R.kind,[]),T.get(R.kind).push(R);let $={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,O]of T)C.push(` \u25B8 ${$[R]||R}`),O.slice(0,8).forEach(I=>C.push(` \u{1F4C4} ${I.filePath}:L${I.line} ${I.text}`));}C.push("");let Re=0;C.push(`\u2464 Storage \u843D\u70B9\u8FFD\u8E2A (storage_api=${s}, depth=${p})`);let Zn=s==="localStorage"?"localStorage":s==="sessionStorage"?"sessionStorage":"(?:localStorage|sessionStorage)",Qn=E.map(T=>({kind:"direct_storage",regex:new RegExp(`${Zn}\\.(?:setItem|getItem|removeItem|clear)\\(.*?\\b${Ke(T)}\\b`)})),Ve=$e(u,Qn,d);if(Ve.length>0&&(Re+=1,C.push(` \u843D\u70B9 [\u76F4\u63A5\u547D\u4E2D\u5B58\u50A8] ${gt("direct_storage")}:`),Ve.slice(0,15).forEach(T=>{let R=u.find(I=>I.path===T.filePath)?.abs_path||"",O=R?Ht(R,T.line,2):{snippet:""};C.push(` \u{1F4C4} ${T.filePath}:L${T.line} ${T.text.trim()}`),O.snippet&&C.push(O.snippet);})),se.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 T=new Map;for(let $ of se){let R=`${$.file_path}::${$.callee_name}`;T.has(R)||T.set(R,$);}for(let[,$]of T){let R=String($.callee_name||""),O=String($.file_path||""),I=Jn(R,O);I.length!==0&&(Re+=1,I.slice(0,3).forEach(j=>{let ee=j.file!==O?` \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 er=y.length>0?` (\u542B ${y.length} \u4E2A\u522B\u540D: ${y.slice(0,3).map(T=>`"${T}"`).join(", ")})`:"";C.push(`\u2705 \u6C47\u603B${er}:`),C.push(` \u2460 \u58F0\u660E/\u8D4B\u503C: ${ce.length} \u5904`),C.push(` \u2461 \u5C5E\u6027\u4FEE\u6539: ${X.length} \u5904 (\u5DF2\u8FFD\u8E2A\u522B\u540D: ${y.map(T=>`"${T}"`).join(", ")||"\u65E0"})`),C.push(` \u2462 \u53C2\u6570\u4F20\u9012: ${se.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 tr=Math.round((performance.now()-c)*100)/100,nr=ce.length+X.length+se.length+Pe.length+Re,Jt=H({durationMs:tr,resultCount:nr,backend:L&&ye?"indexed":L||ye?"hybrid":"fallback_scan"});return f.stale&&(Jt.index_freshness=f),C.push(`
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(`
595
612
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
596
- ${W(Jt)}`),{content:[{type:"text",text:C.join(`
597
- `)}]}});}function Hn(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
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
598
615
  \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
599
- 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 _=r.getLastIndexedTime();return _?new Date(_).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),d=e.hasWatcher(s),f=e.listProjects().find(_=>_.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(_=>({file:_.file_path,error:_.error})),watcherActive:d,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 _ of h.failedFiles.slice(0,5))y.push(` - ${_.file}: ${_.error}`);}return y.push(""),y.push("\u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500"),y.push(W(S)),{content:[{type:"text",text:y.join(`
600
- `)}]}});}var cs="\u9879\u76EE\u6839\u76EE\u5F55\uFF08\u53EF\u7701\u7565\uFF0C\u4F7F\u7528\u4E0A\u6B21\u7D22\u5F15\u7684\u9879\u76EE\uFF09";function Bn(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
601
- \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(cs),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
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
602
619
 
603
620
  \u4F7F\u7528 skimmer_index_project({ project_path: "/your/project" }) \u5F00\u59CB\u7D22\u5F15
604
621
 
@@ -607,18 +624,18 @@ ${W(h)}`}]};let b=[`\u{1F4CB} \u5DF2\u7D22\u5F15\u7684\u9879\u76EE (${f.length}
607
624
  `];return f.forEach((S,y)=>{b.push(`${y+1}. ${S.root}`),b.push(` \u6570\u636E\u5E93: ${S.dbPath}`);}),b.push(`
608
625
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
609
626
  ${W(h)}`),{content:[{type:"text",text:b.join(`
610
- `)}]}}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 d=a.behaviorStats;if(d?.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 d)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 u=Math.round((performance.now()-r)*100)/100,g=H({durationMs:u,resultCount:1,backend:"indexed"});return c.push(`
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(`
611
628
  \u2500\u2500 \u5143\u4FE1\u606F \u2500\u2500
612
629
  ${W(g)}`),{content:[{type:"text",text:c.join(`
613
- `)}]}});}function Kn(o){let e=[J__default.resolve(o,"../package.json"),J__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,Vn=Kn(J__default.dirname(fileURLToPath(import.meta.url))),Ie=new McpServer({name:"frontend-code-skimmer",version:Vn});Cn(Ie,he);In(Ie,he);Un(Ie,he);Hn(Ie,he);Bn(Ie,he);async function ms(){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}
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}
614
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
615
632
  `);let i=await r.startWatcher();he.registerWatcher(n,i),process.stderr.write(`[Frontend-Code-Skimmer] \u6587\u4EF6\u76D1\u542C\u5DF2\u542F\u52A8: ${n}
616
633
  `);}catch(n){process.stderr.write(`[Frontend-Code-Skimmer] \u7D22\u5F15\u5931\u8D25: ${String(n)}
617
- `);}}let e=new StdioServerTransport;await Ie.connect(e),process.stderr.write(`[Frontend-Code-Skimmer MCP] \u5DF2\u542F\u52A8 (v${Vn})
634
+ `);}}let e=new StdioServerTransport;await $e.connect(e),process.stderr.write(`[Frontend-Code-Skimmer MCP] \u5DF2\u542F\u52A8 (v${Gn})
618
635
  `),process.stderr.write(`[Frontend-Code-Skimmer MCP] \u652F\u6301\u6846\u67B6: Vue 2 / Vue 3 / React Hooks
619
636
  `),process.stderr.write(`[Frontend-Code-Skimmer MCP] \u652F\u6301\u7CBE\u5EA6: heuristic / precise (\u8DE8\u6587\u4EF6 import \u7ED1\u5B9A)
620
637
  `),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
621
638
  `),process.env.SKIMMER_PROJECT?process.stderr.write(`[Frontend-Code-Skimmer MCP] \u9ED8\u8BA4\u9879\u76EE: ${process.env.SKIMMER_PROJECT}
622
639
  `):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
623
- `);let t=()=>{he.closeAll(),process.exit(0);};process.on("SIGINT",t),process.on("SIGTERM",t);}ms().catch(o=>{process.stderr.write(`[Frontend-Code-Skimmer MCP] \u542F\u52A8\u5931\u8D25: ${String(o)}
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)}
624
641
  `),process.exit(1);});