Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit18b51f7

Browse files
mizchiclaude
andcommitted
perf: optimize get_project_overview with automatic indexing and incremental updates
- Initial run: Automatic full indexing of TypeScript/JavaScript files- Subsequent runs: Fast incremental updates using Git diff- Reduced DB queries from 9 to 1 with in-memory filtering- Performance: ~0s on subsequent runs (from several seconds)🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>
1 parenta007df3 commit18b51f7

File tree

2 files changed

+242
-104
lines changed

2 files changed

+242
-104
lines changed

‎src/tools/highlevel/projectOverview.test.ts‎

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,124 @@ describe("getProjectOverviewTool", () => {
8888

8989
// Mock symbols for overview
9090
vi.mocked(IndexerAdapter.querySymbols).mockImplementation((_,query)=>{
91+
// If no query parameters, return all symbols (for the optimized implementation)
92+
if(!query||Object.keys(query).length===0){
93+
return[
94+
// Classes
95+
{
96+
name:"UserController",
97+
kind:SymbolKind.Class,
98+
location:{
99+
uri:"file:///test/file.ts",
100+
range:{
101+
start:{line:0,character:0},
102+
end:{line:0,character:0},
103+
},
104+
},
105+
},
106+
{
107+
name:"AuthService",
108+
kind:SymbolKind.Class,
109+
location:{
110+
uri:"file:///test/file.ts",
111+
range:{
112+
start:{line:0,character:0},
113+
end:{line:0,character:0},
114+
},
115+
},
116+
},
117+
{
118+
name:"DatabaseConnection",
119+
kind:SymbolKind.Class,
120+
location:{
121+
uri:"file:///test/file.ts",
122+
range:{
123+
start:{line:0,character:0},
124+
end:{line:0,character:0},
125+
},
126+
},
127+
},
128+
// Interfaces
129+
{
130+
name:"IUser",
131+
kind:SymbolKind.Interface,
132+
location:{
133+
uri:"file:///test/file.ts",
134+
range:{
135+
start:{line:0,character:0},
136+
end:{line:0,character:0},
137+
},
138+
},
139+
},
140+
{
141+
name:"IAuthToken",
142+
kind:SymbolKind.Interface,
143+
location:{
144+
uri:"file:///test/file.ts",
145+
range:{
146+
start:{line:0,character:0},
147+
end:{line:0,character:0},
148+
},
149+
},
150+
},
151+
// Functions
152+
{
153+
name:"main",
154+
kind:SymbolKind.Function,
155+
location:{
156+
uri:"file:///test/file.ts",
157+
range:{
158+
start:{line:0,character:0},
159+
end:{line:0,character:0},
160+
},
161+
},
162+
},
163+
{
164+
name:"initializeApp",
165+
kind:SymbolKind.Function,
166+
location:{
167+
uri:"file:///test/file.ts",
168+
range:{
169+
start:{line:0,character:0},
170+
end:{line:0,character:0},
171+
},
172+
},
173+
},
174+
{
175+
name:"connectDatabase",
176+
kind:SymbolKind.Function,
177+
location:{
178+
uri:"file:///test/file.ts",
179+
range:{
180+
start:{line:0,character:0},
181+
end:{line:0,character:0},
182+
},
183+
},
184+
},
185+
{
186+
name:"startServer",
187+
kind:SymbolKind.Function,
188+
location:{
189+
uri:"file:///test/file.ts",
190+
range:{
191+
start:{line:0,character:0},
192+
end:{line:0,character:0},
193+
},
194+
},
195+
},
196+
{
197+
name:"handleRequest",
198+
kind:SymbolKind.Function,
199+
location:{
200+
uri:"file:///test/file.ts",
201+
range:{
202+
start:{line:0,character:0},
203+
end:{line:0,character:0},
204+
},
205+
},
206+
},
207+
];
208+
}
91209
if(query.kind===SymbolKind.Class){
92210
return[
93211
{
@@ -334,9 +452,44 @@ describe("getProjectOverviewTool", () => {
334452
constmanyClasses=Array.from({length:50},(_,i)=>({
335453
name:`Class${i}`,
336454
kind:SymbolKind.Class,
455+
location:{
456+
uri:"file:///test/file.ts",
457+
range:{
458+
start:{line:0,character:0},
459+
end:{line:0,character:0},
460+
},
461+
},
462+
}));
463+
464+
constmanyFunctions=Array.from({length:100},(_,i)=>({
465+
name:`function${i}`,
466+
kind:SymbolKind.Function,
467+
location:{
468+
uri:"file:///test/file.ts",
469+
range:{
470+
start:{line:0,character:0},
471+
end:{line:0,character:0},
472+
},
473+
},
474+
}));
475+
476+
constmanyInterfaces=Array.from({length:30},(_,i)=>({
477+
name:`Interface${i}`,
478+
kind:SymbolKind.Interface,
479+
location:{
480+
uri:"file:///test/file.ts",
481+
range:{
482+
start:{line:0,character:0},
483+
end:{line:0,character:0},
484+
},
485+
},
337486
}));
338487

339488
vi.mocked(IndexerAdapter.querySymbols).mockImplementation((_,query)=>{
489+
// If no query parameters, return all symbols (for the optimized implementation)
490+
if(!query||Object.keys(query).length===0){
491+
return[...manyClasses, ...manyFunctions, ...manyInterfaces];
492+
}
340493
if(query.kind===SymbolKind.Class){
341494
returnmanyClasses.map((c)=>({
342495
...c,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp