Skip to content

Commit f5dd0b6

Browse files
haasonsaasclaude
andcommitted
fix: resolve all ESLint errors and warnings
- Auto-fix formatting issues (trailing spaces, missing commas, quotes) - Remove unused imports (Content, CodeLocation) - Replace all 'any' types with proper TypeScript types: - Add proper type definitions for AST nodes, execution graphs, and responses - Use 'unknown' instead of 'any' for dynamic data - Add specific interfaces for structured data - Ensure full type safety across the codebase All files now pass ESLint and TypeScript checks without errors. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent eecf7ef commit f5dd0b6

9 files changed

+258
-139
lines changed

src/analyzers/DeepCodeReasoner.ts

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,43 @@ import type {
99
CodeChange,
1010
Insight,
1111
CodeLocation,
12+
SystemImpact,
1213
} from '../models/types.js';
1314
import { ExecutionTracer } from './ExecutionTracer.js';
1415
import { SystemBoundaryAnalyzer } from './SystemBoundaryAnalyzer.js';
1516
import { PerformanceModeler } from './PerformanceModeler.js';
1617
import { HypothesisTester } from './HypothesisTester.js';
1718

19+
// Local type definitions
20+
interface ExecutionGraph {
21+
nodes: Map<string, ExecutionNode>;
22+
edges: Array<{ from: string; to: string; condition?: string }>;
23+
entryPoint: string;
24+
}
25+
26+
interface ExecutionNode {
27+
id: string;
28+
location: CodeLocation;
29+
type: 'function' | 'method' | 'conditional' | 'loop' | 'assignment';
30+
data: unknown;
31+
children: ExecutionNode[];
32+
}
33+
34+
interface ImpactReport {
35+
breakingChanges: BreakingChange[];
36+
performanceImplications: PerformanceIssue[];
37+
systemImpacts: SystemImpact[];
38+
}
39+
40+
interface BreakingChange {
41+
service: string;
42+
description: string;
43+
affectedLocations: CodeLocation[];
44+
confidence: number;
45+
mitigation: string;
46+
file?: string;
47+
}
48+
1849
export class DeepCodeReasoner {
1950
private executionTracer: ExecutionTracer;
2051
private systemAnalyzer: SystemBoundaryAnalyzer;
@@ -356,7 +387,7 @@ export class DeepCodeReasoner {
356387
}
357388
}
358389

359-
private analyzeExecutionPatterns(_graph: any): {
390+
private analyzeExecutionPatterns(_graph: ExecutionGraph): {
360391
paths: ExecutionPath[];
361392
issues: Array<{
362393
description: string;
@@ -407,7 +438,7 @@ export class DeepCodeReasoner {
407438
];
408439
}
409440

410-
private generateCrossSystemActions(impacts: any): Action[] {
441+
private generateCrossSystemActions(impacts: ImpactReport): Action[] {
411442
const actions: Action[] = [];
412443

413444
if (impacts.breakingChanges.length > 0) {
@@ -422,28 +453,28 @@ export class DeepCodeReasoner {
422453
return actions;
423454
}
424455

425-
private generateCrossSystemNextSteps(_impacts: any): string[] {
456+
private generateCrossSystemNextSteps(_impacts: ImpactReport): string[] {
426457
return [
427458
'Update API documentation for changed endpoints',
428459
'Notify downstream service owners of changes',
429460
'Plan migration strategy for breaking changes',
430461
];
431462
}
432463

433-
private generateCrossSystemCodeChanges(impacts: any): CodeChange[] {
434-
return impacts.breakingChanges.map((change: any) => ({
435-
file: change.file,
436-
changeType: 'modify',
464+
private generateCrossSystemCodeChanges(impacts: ImpactReport): CodeChange[] {
465+
return impacts.breakingChanges.map((change) => ({
466+
file: change.file || 'unknown',
467+
changeType: 'modify' as const,
437468
description: change.mitigation,
438469
}));
439470
}
440471

441-
private extractCrossSystemInsights(impacts: any): Insight[] {
472+
private extractCrossSystemInsights(impacts: ImpactReport): Insight[] {
442473
return [
443474
{
444475
type: 'system_dependencies',
445476
description: `Found ${impacts.systemImpacts.length} cross-system impacts`,
446-
supporting_evidence: impacts.systemImpacts.map((i: any) => i.service),
477+
supporting_evidence: impacts.systemImpacts.map((i) => i.service),
447478
},
448479
];
449480
}

src/analyzers/DeepCodeReasonerV2.ts

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ export class DeepCodeReasonerV2 {
8585
entryPoint: CodeLocation,
8686
maxDepth: number = 10,
8787
_includeDataFlow: boolean = true,
88-
): Promise<any> {
88+
): Promise<{
89+
analysis: string;
90+
filesAnalyzed: string[];
91+
}> {
8992
// Get code context around entry point
9093
const _context = await this.codeReader.readCodeContext(entryPoint, 100);
9194

@@ -117,7 +120,11 @@ export class DeepCodeReasonerV2 {
117120
async analyzeCrossSystemImpact(
118121
changeScope: string[],
119122
impactTypes?: string[],
120-
): Promise<any> {
123+
): Promise<{
124+
analysis: string;
125+
filesAnalyzed: string[];
126+
impactTypes: string[];
127+
}> {
121128
const codeFiles = new Map<string, string>();
122129

123130
// Read all files in change scope
@@ -154,7 +161,10 @@ export class DeepCodeReasonerV2 {
154161
entryPoint: CodeLocation,
155162
profileDepth: number = 3,
156163
suspectedIssues?: string[],
157-
): Promise<any> {
164+
): Promise<{
165+
analysis: string;
166+
filesAnalyzed: string[];
167+
}> {
158168
const codeFiles = new Map<string, string>();
159169

160170
// Read entry point and related files
@@ -190,7 +200,12 @@ export class DeepCodeReasonerV2 {
190200
hypothesis: string,
191201
codeScope: string[],
192202
testApproach: string,
193-
): Promise<any> {
203+
): Promise<{
204+
hypothesis: string;
205+
testApproach: string;
206+
analysis: string;
207+
filesAnalyzed: string[];
208+
}> {
194209
const codeFiles = new Map<string, string>();
195210

196211
// Read all files in scope
@@ -353,25 +368,25 @@ export class DeepCodeReasonerV2 {
353368
try {
354369
// Create session
355370
const sessionId = this.conversationManager.createSession(context);
356-
371+
357372
// Read relevant code files
358373
const codeFiles = await this.codeReader.readCodeFiles(context.focusArea);
359-
374+
360375
// Start Gemini conversation
361376
const { response, suggestedFollowUps } = await this.conversationalGemini.startConversation(
362377
sessionId,
363378
context,
364379
analysisType,
365380
codeFiles,
366-
initialQuestion
381+
initialQuestion,
367382
);
368-
383+
369384
// Track conversation turn
370385
this.conversationManager.addTurn(sessionId, 'gemini', response, {
371386
analysisType,
372387
questions: suggestedFollowUps,
373388
});
374-
389+
375390
return {
376391
sessionId,
377392
initialResponse: response,
@@ -406,25 +421,25 @@ export class DeepCodeReasonerV2 {
406421
if (!session) {
407422
throw new SessionNotFoundError(sessionId);
408423
}
409-
424+
410425
// Add Claude's message to conversation history
411426
this.conversationManager.addTurn(sessionId, 'claude', message);
412-
427+
413428
// Continue with Gemini
414429
const { response, analysisProgress, canFinalize } = await this.conversationalGemini.continueConversation(
415430
sessionId,
416431
message,
417-
includeCodeSnippets
432+
includeCodeSnippets,
418433
);
419-
434+
420435
// Track Gemini's response
421436
this.conversationManager.addTurn(sessionId, 'gemini', response);
422-
437+
423438
// Update progress
424439
this.conversationManager.updateProgress(sessionId, {
425440
confidenceLevel: analysisProgress,
426441
});
427-
442+
428443
return {
429444
response,
430445
analysisProgress,
@@ -456,16 +471,16 @@ export class DeepCodeReasonerV2 {
456471
if (!session) {
457472
throw new SessionNotFoundError(sessionId);
458473
}
459-
474+
460475
// Get final analysis from Gemini
461476
const result = await this.conversationalGemini.finalizeConversation(
462477
sessionId,
463-
summaryFormat || 'detailed'
478+
summaryFormat || 'detailed',
464479
);
465-
480+
466481
// Extract additional insights from conversation manager
467482
const conversationResults = this.conversationManager.extractResults(sessionId);
468-
483+
469484
// Merge results
470485
return {
471486
...result,
@@ -504,9 +519,9 @@ export class DeepCodeReasonerV2 {
504519
canFinalize: false,
505520
};
506521
}
507-
522+
508523
const canFinalize = this.conversationManager.shouldComplete(sessionId);
509-
524+
510525
return {
511526
sessionId,
512527
status: session.status,

0 commit comments

Comments
 (0)