Commit bcbcb71
committed
feat(typescript): add Neo4j-backed analysis backend (Cypher over codeanalyzer-ts graph)
Add TSNeo4jBackend, a drop-in alternative to the in-memory TSCodeanalyzer that
answers the exact same get_* query surface (call graph, callers/callees, class
hierarchy, call sites, decorators, symbol/method/field lookups, imports/exports/
variables, ...) by running Cypher over a live Neo4j graph instead of walking the
pydantic / NetworkX structures.
The graph is the one codeanalyzer-typescript emits with `--emit neo4j` (schema
schema.neo4j.json). The backend can populate the database for you over Bolt
(running the analyzer with --emit neo4j --neo4j-uri), or query a DB that is
already loaded (build_db=False). Results are re-hydrated into the same
cldk.models.typescript pydantic objects the in-memory backend returns; lossy
fields inherent to the projection (collapsed comments/type-params, aggregated
import edges, the three round-tripped CALLS tag keys) are reconstructed
best-effort and documented inline.
- cldk/analysis/typescript/neo4j/: backend, model reconstruction, Neo4jConnectionConfig.
- TypeScriptAnalysis / CLDK.analysis: optional neo4j_config selects the backend;
default behavior unchanged.
- pyproject: optional `neo4j` extra for the driver.
- tests: live-DB integration tests (skipped when no Neo4j reachable) mirroring the
in-memory backend's sample-app expectations, plus no-DB backend-selection unit tests.1 parent 9a43542 commit bcbcb71
10 files changed
Lines changed: 1645 additions & 23 deletions
File tree
- cldk
- analysis/typescript
- neo4j
- tests/analysis/typescript
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
8 | 23 | | |
9 | 24 | | |
10 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments