MCPcopy Create free account
hub / github.com/PatrickSys/codebase-context / detectChunkTrend

Method detectChunkTrend

src/core/search.ts:307–336  ·  view source on GitHub ↗

* Detect pattern trend from chunk content

(chunk: CodeChunk)

Source from the content-addressed store, hash-verified

305 * Detect pattern trend from chunk content
306 */
307 private detectChunkTrend(chunk: CodeChunk): {
308 trend: 'Rising' | 'Stable' | 'Declining' | undefined;
309 warning?: string;
310 } {
311 if (!this.patternIntelligence || chunk.content == null) {
312 return { trend: undefined };
313 }
314
315 const content = chunk.content.toLowerCase();
316 const { decliningPatterns, risingPatterns, patternWarnings } = this.patternIntelligence;
317
318 // Check for declining patterns
319 for (const pattern of decliningPatterns) {
320 if (content.includes(pattern)) {
321 return {
322 trend: 'Declining',
323 warning: patternWarnings.get(pattern)
324 };
325 }
326 }
327
328 // Check for rising patterns
329 for (const pattern of risingPatterns) {
330 if (content.includes(pattern)) {
331 return { trend: 'Rising' };
332 }
333 }
334
335 return { trend: 'Stable' };
336 }
337
338 private isTestFile(filePath: string): boolean {
339 const normalized = filePath.toLowerCase().replace(/\\/g, '/');

Callers 1

scoreAndSortResultsMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected