@@ -13,7 +13,7 @@ import {
1313 CodeComponent ,
1414 ImportStatement ,
1515 ExportStatement ,
16- Dependency ,
16+ Dependency
1717} from '../../types/index.js' ;
1818import { createChunksFromCode } from '../../utils/chunking.js' ;
1919import { detectLanguage } from '../../utils/language-detection.js' ;
@@ -29,13 +29,26 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
2929 readonly version = '1.0.0' ;
3030 readonly supportedExtensions = [
3131 // JavaScript/TypeScript
32- '.js' , '.jsx' , '.ts' , '.tsx' , '.mjs' , '.cjs' ,
32+ '.js' ,
33+ '.jsx' ,
34+ '.ts' ,
35+ '.tsx' ,
36+ '.mjs' ,
37+ '.cjs' ,
3338 // Python
34- '.py' , '.pyi' ,
39+ '.py' ,
40+ '.pyi' ,
3541 // Java/Kotlin
36- '.java' , '.kt' , '.kts' ,
42+ '.java' ,
43+ '.kt' ,
44+ '.kts' ,
3745 // C/C++
38- '.c' , '.cpp' , '.cc' , '.cxx' , '.h' , '.hpp' ,
46+ '.c' ,
47+ '.cpp' ,
48+ '.cc' ,
49+ '.cxx' ,
50+ '.h' ,
51+ '.hpp' ,
3952 // C#
4053 '.cs' ,
4154 // Go
@@ -51,17 +64,29 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
5164 // Scala
5265 '.scala' ,
5366 // Shell
54- '.sh' , '.bash' , '.zsh' ,
67+ '.sh' ,
68+ '.bash' ,
69+ '.zsh' ,
5570 // Config
56- '.json' , '.yaml' , '.yml' , '.toml' , '.xml' ,
71+ '.json' ,
72+ '.yaml' ,
73+ '.yml' ,
74+ '.toml' ,
75+ '.xml' ,
5776 // Markup
58- '.html' , '.htm' , '.md' , '.mdx' ,
77+ '.html' ,
78+ '.htm' ,
79+ '.md' ,
80+ '.mdx' ,
5981 // Styles
60- '.css' , '.scss' , '.sass' , '.less' ,
82+ '.css' ,
83+ '.scss' ,
84+ '.sass' ,
85+ '.less'
6186 ] ;
6287 readonly priority = 10 ; // Low priority - fallback analyzer
6388
64- canAnalyze ( filePath : string , content ?: string ) : boolean {
89+ canAnalyze ( filePath : string , _content ?: string ) : boolean {
6590 const ext = path . extname ( filePath ) . toLowerCase ( ) ;
6691 return this . supportedExtensions . includes ( ext ) ;
6792 }
@@ -108,14 +133,13 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
108133 metadata : {
109134 analyzer : this . name ,
110135 fileSize : content . length ,
111- lineCount : content . split ( '\n' ) . length ,
136+ lineCount : content . split ( '\n' ) . length
112137 } ,
113- chunks,
138+ chunks
114139 } ;
115140 }
116141
117142 async detectCodebaseMetadata ( rootPath : string ) : Promise < CodebaseMetadata > {
118- const packageJsonPath = path . join ( rootPath , 'package.json' ) ;
119143 let projectName = path . basename ( rootPath ) ;
120144 let dependencies : Dependency [ ] = [ ] ;
121145
@@ -124,9 +148,8 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
124148
125149 try {
126150 workspaceType = await detectWorkspaceType ( rootPath ) ;
127- workspacePackages = workspaceType !== 'single'
128- ? await scanWorkspacePackageJsons ( rootPath )
129- : [ ] ;
151+ workspacePackages =
152+ workspaceType !== 'single' ? await scanWorkspacePackageJsons ( rootPath ) : [ ] ;
130153
131154 const pkgPath = path . join ( rootPath , 'package.json' ) ;
132155 let packageJson : any = { } ;
@@ -137,16 +160,17 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
137160 // no root package.json
138161 }
139162
140- const rawDeps = workspaceType !== 'single'
141- ? aggregateWorkspaceDependencies ( workspacePackages )
142- : { ...packageJson . dependencies , ...packageJson . devDependencies } ;
163+ const rawDeps =
164+ workspaceType !== 'single'
165+ ? aggregateWorkspaceDependencies ( workspacePackages )
166+ : { ...packageJson . dependencies , ...packageJson . devDependencies } ;
143167
144168 dependencies = Object . entries ( rawDeps ) . map ( ( [ name , version ] ) => ( {
145169 name,
146170 version : version as string ,
147- category : categorizeDependency ( name ) ,
171+ category : categorizeDependency ( name )
148172 } ) ) ;
149- } catch ( error ) {
173+ } catch ( _error ) {
150174 // skip
151175 }
152176
@@ -166,20 +190,20 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
166190 shared : 0 ,
167191 feature : 0 ,
168192 infrastructure : 0 ,
169- unknown : 0 ,
193+ unknown : 0
170194 } ,
171- patterns : [ ] ,
195+ patterns : [ ]
172196 } ,
173197 styleGuides : [ ] ,
174198 documentation : [ ] ,
175199 projectStructure : {
176200 type : workspaceType === 'single' ? 'single-app' : 'monorepo' ,
177- packages : workspacePackages . map ( p => ( {
201+ packages : workspacePackages . map ( ( p ) => ( {
178202 name : p . name || path . basename ( path . dirname ( p . filePath ) ) ,
179203 path : path . relative ( rootPath , path . dirname ( p . filePath ) ) ,
180- type : 'app' , // default to app
204+ type : 'app' // default to app
181205 } ) ) ,
182- workspaces : workspaceType !== 'single' ? [ workspaceType ] : undefined ,
206+ workspaces : workspaceType !== 'single' ? [ workspaceType ] : undefined
183207 } ,
184208 statistics : {
185209 totalFiles : 0 ,
@@ -195,12 +219,12 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
195219 shared : 0 ,
196220 feature : 0 ,
197221 infrastructure : 0 ,
198- unknown : 0 ,
199- } ,
222+ unknown : 0
223+ }
200224 } ,
201225 customMetadata : {
202- monorepoType : workspaceType !== 'single' ? workspaceType : undefined ,
203- } ,
226+ monorepoType : workspaceType !== 'single' ? workspaceType : undefined
227+ }
204228 } ;
205229
206230 return metadata ;
@@ -209,7 +233,7 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
209233 private async parseJSTSFile (
210234 filePath : string ,
211235 content : string ,
212- language : 'typescript' | 'javascript'
236+ _language : 'typescript' | 'javascript'
213237 ) : Promise < {
214238 components : CodeComponent [ ] ;
215239 imports : ImportStatement [ ] ;
@@ -226,7 +250,7 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
226250 loc : true ,
227251 range : true ,
228252 comment : true ,
229- jsx : filePath . endsWith ( 'x' ) ,
253+ jsx : filePath . endsWith ( 'x' )
230254 } ) ;
231255
232256 // Extract imports
@@ -241,7 +265,7 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
241265 } ) ,
242266 isDefault : node . specifiers . some ( ( s : any ) => s . type === 'ImportDefaultSpecifier' ) ,
243267 isDynamic : false ,
244- line : node . loc ?. start . line ,
268+ line : node . loc ?. start . line
245269 } ) ;
246270 }
247271
@@ -252,7 +276,7 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
252276 type : 'class' ,
253277 startLine : node . loc ! . start . line ,
254278 endLine : node . loc ! . end . line ,
255- metadata : { } ,
279+ metadata : { }
256280 } ) ;
257281 }
258282
@@ -262,15 +286,16 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
262286 type : 'function' ,
263287 startLine : node . loc ! . start . line ,
264288 endLine : node . loc ! . end . line ,
265- metadata : { } ,
289+ metadata : { }
266290 } ) ;
267291 }
268292
269293 if ( node . type === 'VariableDeclaration' ) {
270294 for ( const decl of node . declarations ) {
271295 if ( decl . id . type === 'Identifier' ) {
272296 // Check if it's an arrow function or function expression
273- const isFunction = decl . init &&
297+ const isFunction =
298+ decl . init &&
274299 ( decl . init . type === 'ArrowFunctionExpression' ||
275300 decl . init . type === 'FunctionExpression' ) ;
276301
@@ -279,7 +304,7 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
279304 type : isFunction ? 'function' : 'variable' ,
280305 startLine : decl . loc ! . start . line ,
281306 endLine : decl . loc ! . end . line ,
282- metadata : { } ,
307+ metadata : { }
283308 } ) ;
284309 }
285310 }
@@ -294,15 +319,15 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
294319 exports . push ( {
295320 name : decl . id . name ,
296321 isDefault : false ,
297- type : 'named' ,
322+ type : 'named'
298323 } ) ;
299324 }
300325 }
301326 } else if ( 'id' in node . declaration && node . declaration . id ) {
302327 exports . push ( {
303328 name : ( node . declaration . id as any ) . name ,
304329 isDefault : false ,
305- type : 'named' ,
330+ type : 'named'
306331 } ) ;
307332 }
308333 }
@@ -313,21 +338,19 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
313338 exports . push ( {
314339 name : spec . exported . name ,
315340 isDefault : false ,
316- type : 'named' ,
341+ type : 'named'
317342 } ) ;
318343 }
319344 }
320345 }
321346 }
322347
323348 if ( node . type === 'ExportDefaultDeclaration' ) {
324- const name = node . declaration . type === 'Identifier'
325- ? node . declaration . name
326- : 'default' ;
349+ const name = node . declaration . type === 'Identifier' ? node . declaration . name : 'default' ;
327350 exports . push ( {
328351 name,
329352 isDefault : true ,
330- type : 'default' ,
353+ type : 'default'
331354 } ) ;
332355 }
333356 }
@@ -349,7 +372,10 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
349372 // Classes: class, struct
350373 { regex : / (?: ^ | \s ) (?: c l a s s | s t r u c t | i n t e r f a c e | t r a i t ) \s + ( \w + ) / i, type : 'class' } ,
351374 // Methods: pub fn, pub fn, private func
352- { regex : / (?: p u b | p u b l i c | p r i v a t e | p r o t e c t e d ) ? \s * (?: f n | f u n c | f u n c t i o n | d e f | m e t h o d ) \s + ( \w + ) / i, type : 'method' } ,
375+ {
376+ regex : / (?: p u b | p u b l i c | p r i v a t e | p r o t e c t e d ) ? \s * (?: f n | f u n c | f u n c t i o n | d e f | m e t h o d ) \s + ( \w + ) / i,
377+ type : 'method'
378+ }
353379 ] ;
354380
355381 lines . forEach ( ( line , index ) => {
@@ -361,7 +387,7 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
361387 type : pattern . type ,
362388 startLine : index + 1 ,
363389 endLine : index + 1 , // Will be updated if we find end
364- metadata : { } ,
390+ metadata : { }
365391 } ) ;
366392 }
367393 }
@@ -412,7 +438,9 @@ export class GenericAnalyzer implements FrameworkAnalyzer {
412438 // Fallback to first meaningful line
413439 const firstLine = content
414440 . split ( '\n' )
415- . find ( line => line . trim ( ) && ! line . trim ( ) . startsWith ( 'import' ) && ! line . trim ( ) . startsWith ( '//' ) ) ;
441+ . find (
442+ ( line ) => line . trim ( ) && ! line . trim ( ) . startsWith ( 'import' ) && ! line . trim ( ) . startsWith ( '//' )
443+ ) ;
416444
417445 return `${ language } code in ${ fileName } : ${ firstLine ? firstLine . trim ( ) . slice ( 0 , 60 ) + '...' : 'code definition' } ` ;
418446 }
0 commit comments