MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / detect

Function detect

src/resolution/frameworks/java.ts:24–59  ·  view source on GitHub ↗
(context: ResolutionContext)

Source from the content-addressed store, hash-verified

22 },
23
24 detect(context: ResolutionContext): boolean {
25 // Check for pom.xml with Spring
26 const pomXml = context.readFile('pom.xml');
27 if (pomXml && (pomXml.includes('spring-boot') || pomXml.includes('springframework'))) {
28 return true;
29 }
30
31 // Check for build.gradle with Spring
32 const buildGradle = context.readFile('build.gradle');
33 if (buildGradle && (buildGradle.includes('spring-boot') || buildGradle.includes('springframework'))) {
34 return true;
35 }
36
37 const buildGradleKts = context.readFile('build.gradle.kts');
38 if (buildGradleKts && (buildGradleKts.includes('spring-boot') || buildGradleKts.includes('springframework'))) {
39 return true;
40 }
41
42 // Check for Spring annotations in Java files
43 const allFiles = context.getAllFiles();
44 for (const file of allFiles) {
45 if (file.endsWith('.java')) {
46 const content = context.readFile(file);
47 if (content && (
48 content.includes('@SpringBootApplication') ||
49 content.includes('@RestController') ||
50 content.includes('@Service') ||
51 content.includes('@Repository')
52 )) {
53 return true;
54 }
55 }
56 }
57
58 return false;
59 },
60
61 resolve(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null {
62 // A route's handler is the method its mapping annotation is written on,

Callers

nothing calls this directly

Calls 2

readFileMethod · 0.80
getAllFilesMethod · 0.65

Tested by

no test coverage detected