MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / readAnnotationRoutes

Function readAnnotationRoutes

graph-ui/src/provider/route-reader.ts:173–187  ·  view source on GitHub ↗

* Annotations, which is how Spring and its relatives register. * * Two annotations are declined, and both for the same reason: what they carry * is not a route. * * A mapping that names no verb is a class-level prefix. `@RequestMapping(path = * "/articles")` above a controller is the first hal

(source: string)

Source from the content-addressed store, hash-verified

171 * for exactly the languages where they appear, so declining them loses nothing.
172 */
173function readAnnotationRoutes(source: string): SourceRoute[] {
174 const routes: SourceRoute[] = [];
175 for (const match of source.matchAll(ANNOTATION_PATTERN)) {
176 const args = match[2] ?? '';
177 const path = ANNOTATION_PATH_PATTERN.exec(args)?.[1];
178 const verb = match[1] === 'Request'
179 ? ANNOTATION_METHOD_PATTERN.exec(args)?.[1]
180 : match[1].toUpperCase();
181 if (path === undefined || !path.startsWith('/') || verb === undefined) {
182 continue;
183 }
184 routes.push({ method: verb, path, line: lineAt(source, match.index ?? 0) });
185 }
186 return routes;
187}
188
189/** One registration reported once, even when two patterns both matched it. */
190function dedupe(routes: SourceRoute[]): SourceRoute[] {

Callers 1

readRoutesFunction · 0.85

Calls 2

lineAtFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected