Skip to content

Commit 5b71a89

Browse files
authored
feat(frameworks): add Drupal 8/9/10/11 support (colbymchenry#271)
Detects Drupal projects via composer.json drupal/* deps; extracts routes from *.routing.yml (route nodes + references edges to controllers/forms/entity handlers) and Drupal hook implementations from .module/.install/.theme/.inc. Adds yaml/twig as file-level languages and excludes core/contrib by default. Resolves colbymchenry#268.
1 parent 95dace9 commit 5b71a89

8 files changed

Lines changed: 955 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,28 @@ a [GitHub Release](https://github.com/colbymchenry/codegraph/releases) tagged
77
This project follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
88
and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
99

10+
## [Unreleased]
11+
12+
### Added
13+
- **Framework support: Drupal 8/9/10/11** — CodeGraph now detects Drupal
14+
projects (via a `drupal/*` dependency in `composer.json`) and adds three
15+
levels of intelligence:
16+
- **Route extraction**: `*.routing.yml` files emit a `route` node per route,
17+
linked by a `references` edge to the `_controller`, `_form`, or
18+
entity-handler class/method, so querying a controller method surfaces the
19+
URL route that binds it.
20+
- **Hook detection**: hook implementations in `.module`, `.install`, `.theme`,
21+
and `.inc` files are detected via docblock (`Implements hook_X()`) with a
22+
module-name-prefix fallback. Each emits a `references` edge to the canonical
23+
`hook_X` name so `codegraph_callers("hook_form_alter")` returns every
24+
implementation across modules.
25+
- **Resolution**: `_controller`/`_form` FQCNs resolve to their PHP
26+
class/method nodes.
27+
New `yaml`/`twig` languages are tracked at the file level, the Drupal PHP
28+
extensions (`.module`/`.install`/`.theme`/`.inc`) are indexed with the PHP
29+
grammar, and `web/core`, `web/modules/contrib`, `web/themes/contrib` are
30+
excluded by default. Resolves [#268](https://github.com/colbymchenry/codegraph/issues/268).
31+
1032
## [0.9.1] - 2026-05-21
1133

1234
### Fixed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ The gains scale with codebase size: on large repos the agent answers from the in
124124
| **Impact Analysis** | Trace callers, callees, and the full impact radius of any symbol before making changes |
125125
| **Always Fresh** | File watcher uses native OS events (FSEvents/inotify/ReadDirectoryChangesW) with debounced auto-sync — the graph stays current as you code, zero config |
126126
| **19+ Languages** | TypeScript, JavaScript, Python, Go, Rust, Java, C#, PHP, Ruby, C, C++, Swift, Kotlin, Dart, Lua, Luau, Svelte, Liquid, Pascal/Delphi |
127-
| **Framework-aware Routes** | Recognizes web-framework routing files and links URL patterns to their handlers across 13 frameworks |
127+
| **Framework-aware Routes** | Recognizes web-framework routing files and links URL patterns to their handlers across 14 frameworks |
128128
| **100% Local** | No data leaves your machine. No API keys. No external services. SQLite database only |
129129

130130
---
@@ -141,6 +141,7 @@ CodeGraph detects web-framework routing files and emits `route` nodes linked by
141141
| **Express** | `app.get(...)`, `router.post(...)` with middleware chains |
142142
| **NestJS** | `@Controller` + `@Get/@Post/...`, GraphQL `@Resolver` + `@Query/@Mutation`, `@MessagePattern`/`@EventPattern`, `@SubscribeMessage` |
143143
| **Laravel** | `Route::get()`, `Route::resource()`, `Controller@action`, tuple syntax |
144+
| **Drupal** | `*.routing.yml` routes (`_controller`, `_form`, entity handlers); `hook_*` implementations in `.module`/`.theme`/`.install`/`.inc` |
144145
| **Rails** | `get '/x', to: 'users#index'`, hash-rocket `=>` syntax |
145146
| **Spring** | `@GetMapping`, `@PostMapping`, `@RequestMapping` on methods |
146147
| **Gin / chi / gorilla / mux** | `r.GET(...)`, `router.HandleFunc(...)` |

0 commit comments

Comments
 (0)