Skip to content

Commit 15fb852

Browse files
committed
refactor: clean up imports and improve error handling
- Removed unused import of Memory from src/index.ts. - Simplified error message construction in src/core/symbol-references.ts. - Reorganized risk level calculation in src/tools/search-codebase.ts for clarity and consistency. - Added a TODO comment for reviewing confidence calculation in src/tools/search-codebase.ts.
1 parent 9a2d523 commit 15fb852

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/core/symbol-references.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ export async function findSymbolReferences(
8383
chunksRaw = JSON.parse(content);
8484
} catch (error) {
8585
throw new IndexCorruptedError(
86-
`Keyword index missing or unreadable (rebuild required): ${
87-
error instanceof Error ? error.message : String(error)
86+
`Keyword index missing or unreadable (rebuild required): ${error instanceof Error ? error.message : String(error)
8887
}`
8988
);
9089
}

src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ import {
2121
} from '@modelcontextprotocol/sdk/types.js';
2222
import { CodebaseIndexer } from './core/indexer.js';
2323
import type {
24-
IndexingStats,
25-
Memory
24+
IndexingStats
2625
} from './types/index.js';
2726
import { analyzerRegistry } from './core/analyzer-registry.js';
2827
import { AngularAnalyzer } from './analyzers/angular/index.js';

src/tools/search-codebase.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import type { SearchResult } from '../types/index.js';
99
import { buildEvidenceLock } from '../preflight/evidence-lock.js';
1010
import { shouldIncludePatternConflictCategory } from '../preflight/query-scope.js';
1111
import {
12-
isComplementaryPatternCategory,
1312
isComplementaryPatternConflict,
1413
shouldSkipLegacyTestingFrameworkCategory
1514
} from '../patterns/semantics.js';
@@ -395,12 +394,6 @@ export async function handle(
395394
const resultPaths = results.map((r) => r.filePath);
396395
const impactCandidates = computeImpactCandidates(resultPaths);
397396

398-
let riskLevel: 'low' | 'medium' | 'high' = 'low';
399-
if (impactCandidates.length > 10) {
400-
riskLevel = 'high';
401-
} else if (impactCandidates.length > 3) {
402-
riskLevel = 'medium';
403-
}
404397

405398
// Use existing pattern intelligence for evidenceLock scoring, but keep the output payload lite.
406399
const preferredPatternsForEvidence: Array<{ pattern: string; example?: string }> = [];
@@ -417,6 +410,14 @@ export async function handle(
417410
}
418411
}
419412

413+
414+
let riskLevel: 'low' | 'medium' | 'high' = 'low';
415+
if (impactCandidates.length > 10) {
416+
riskLevel = 'high';
417+
} else if (impactCandidates.length > 3) {
418+
riskLevel = 'medium';
419+
}
420+
420421
editPreflight = {
421422
mode: 'lite',
422423
riskLevel,
@@ -533,7 +534,8 @@ export async function handle(
533534
}));
534535

535536
// --- Confidence (index freshness) ---
536-
const confidence = computeIndexConfidence();
537+
// TODO: Review this confidence calculation
538+
//const confidence = computeIndexConfidence();
537539

538540
// --- Failure memories (1.5x relevance boost) ---
539541
const failureWarnings = relatedMemories

0 commit comments

Comments
 (0)