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

Function detect

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

readFileMethod · 0.65
getAllFilesMethod · 0.65

Tested by

no test coverage detected