Skip to content

feat: add Micronaut framework route extraction#973

Open
lw-yang wants to merge 1 commit into
colbymchenry:mainfrom
lw-yang:feat/micronaut-route-support
Open

feat: add Micronaut framework route extraction#973
lw-yang wants to merge 1 commit into
colbymchenry:mainfrom
lw-yang:feat/micronaut-route-support

Conversation

@lw-yang

@lw-yang lw-yang commented Jun 24, 2026

Copy link
Copy Markdown

Summary

Adds a new micronautResolver framework resolver that extracts HTTP route nodes from Micronaut annotations, enabling codegraph_explore to resolve URL paths (e.g. /api/v1/executions/search) directly to their handler methods.

Supported annotations:

  • Class-level: @Controller("/prefix"), @Client("/prefix")
  • Method-level: @Get, @Post, @Put, @Delete, @Patch, @Head, @Options, @Trace, @HttpMethodMapping
  • Path syntax: @Get("/path"), @Get(uri = "/path"), @Get(value = "/path"), bare @Get

What it does:

  • Detects Micronaut projects via pom.xml / build.gradle / annotation scanning
  • Emits kind: 'route' nodes with full resolved paths (class prefix + method path)
  • Creates references edges linking route nodes to handler method names
  • Supports both Java and Kotlin source files
  • Handles interface methods (e.g. @Client declarative HTTP clients) without access modifiers

Files changed

  • src/resolution/frameworks/micronaut.ts — New resolver (extract + detect + resolve)
  • src/resolution/frameworks/index.ts — Register micronautResolver in the framework list
  • __tests__/micronaut.test.ts — 16 test cases covering all annotation patterns

Test plan

  • All 16 new Micronaut tests pass
  • Existing framework tests (129 tests) pass with no regression
  • Manual verification with Kestra codebase (Micronaut project)

Verification on Kestra (real-world Micronaut project)

Ran codegraph init on Kestra (2,877 files) with this branch:

  • 399 route nodes extracted from Micronaut controllers
  • Route-to-handler edges correctly established, e.g.:
route: GET /api/v1/{tenant}/executions/search
  → file: ExecutionController.java:204
  → handler: searchExecutions (method)
  → edge: references

Sample indexed routes:

GET /api/v1/{tenant}/executions/search           → ExecutionController.java:204
DELETE /api/v1/{tenant}/flows/{namespace}/{id}    → FlowController.java:564
DELETE /api/v1/{tenant}/dashboards/{id}           → DashboardController.java:192
POST /api/v1/{tenant}/executions/{id}/restart    → ExecutionController.java

Before this change, querying /executions/search via CodeGraph returned irrelevant FTS5 matches on the word "search" across unrelated symbols. After this change, the route resolves directly to the handler method with full call-chain traversal.

Closes #971

Add a new framework resolver that extracts HTTP route nodes from
Micronaut annotations (@controller, @get, @post, @put, @delete,
@patch, @Head, @options, @HttpMethodMapping), enabling codegraph_explore
to resolve URL paths to their handler methods in Micronaut-based
projects like Kestra.

Closes colbymchenry#971

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Micronaut framework route extraction

1 participant