Skip to content

Commit e4814fc

Browse files
authored
Improved context handling (#22)
* feat(tests): add unit tests for extractMethodSignatures function to validate method signature extraction from TypeScript/React files refactor(agent.ts): update project context retrieval to use new method for improved context with method signatures and docstrings refactor(context.ts): deprecate old context retrieval method and implement new method for better performance and focused context extraction * chore(context.ts): remove unnecessary console.log statements to clean up output and improve readability * fix(context.ts): update relative path calculation to ensure consistent display of file paths from project root refactor(context.ts): change file variable to be used in method signatures formatting for clarity and accuracy * feat: Implement enhanced context generation using ts-morph and react-docgen * chore: update .gitignore to include /tmp/ directory for temporary files refactor(agent.ts): simplify context retrieval logic by removing unnecessary object destructuring refactor(analyzeTsWithMorph.ts): clean up code by removing redundant whitespace and comments for better readability refactor(context.ts): enhance project context generation by removing component documentation extraction and improving logging feat: add test script for context generation to validate functionality and output chore: remove unused extractComponentDocs module to streamline codebase * feat(analysis): enhance TypeScript analysis by adding more specific file paths and improving component detection logic refactor(analysis): remove deprecated context functions and streamline context generation fix(context): update project ID in test script to ensure correct context generation for testing purposes * chore(tests): remove outdated context test file as it is no longer needed * Feature/structured analysis and context (#23) * feat: Implement enhanced context generation using ts-morph and react-docgen * chore: update .gitignore to include /tmp/ directory for temporary files refactor(agent.ts): simplify context retrieval logic by removing unnecessary object destructuring refactor(analyzeTsWithMorph.ts): clean up code by removing redundant whitespace and comments for better readability refactor(context.ts): enhance project context generation by removing component documentation extraction and improving logging feat: add test script for context generation to validate functionality and output chore: remove unused extractComponentDocs module to streamline codebase * feat(analysis): enhance TypeScript analysis by adding more specific file paths and improving component detection logic refactor(analysis): remove deprecated context functions and streamline context generation fix(context): update project ID in test script to ensure correct context generation for testing purposes * chore(tests): remove outdated context test file as it is no longer needed * fix(analysis): remove numeric project ID prefixes from file paths for better readability in analysis results fix(context): clean file paths in relationships to enhance clarity and consistency in output
1 parent 5b9b26f commit e4814fc

File tree

7 files changed

+1071
-269
lines changed

7 files changed

+1071
-269
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
!.yarn/plugins
1010
!.yarn/releases
1111
!.yarn/versions
12+
/tmp/
1213

1314
tmp.log
1415

lib/llm/core/agent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Action, normalizeAction, isValidAction, AgentErrorType } from './types'
1010
import { generateAICompletion, generateSummaryWithFlash } from '../api/ai';
1111
import { isWebRequestEnvironment } from '@/lib/environment';
1212
import { buildNaivePrompt } from './prompts';
13-
import { getProjectContextOnlyDirectoryStructure } from '../utils/context';
13+
import { getProjectContextWithDirectoryStructureAndAnalysis } from '../utils/context';
1414

1515
// Action operation type mapping for database operations
1616
type OperationType = 'create' | 'edit' | 'delete' | 'error' | 'read' | 'createDir' | 'removeDir';
@@ -68,7 +68,7 @@ export class Agent {
6868
let context = '';
6969
try {
7070
console.log(`🔍 Getting project context for projectId: ${this.projectId}`);
71-
context = await getProjectContextOnlyDirectoryStructure(this.projectId, {
71+
context = await getProjectContextWithDirectoryStructureAndAnalysis(this.projectId, {
7272
maxSize: CONTEXT.MAX_CONTEXT_SIZE,
7373
excludeDirs: CONTEXT.EXCLUDE_DIRS,
7474
});

0 commit comments

Comments
 (0)