Skip to content

Architecture Engine: dependency/module/folder/call graphs + JSON export (v0.1.2)#9

Merged
s1rry merged 1 commit into
mainfrom
feature/architecture-engine
Jul 4, 2026
Merged

Architecture Engine: dependency/module/folder/call graphs + JSON export (v0.1.2)#9
s1rry merged 1 commit into
mainfrom
feature/architecture-engine

Conversation

@s1rry

@s1rry s1rry commented Jul 4, 2026

Copy link
Copy Markdown
Owner

What

Architecture Engine — builds four graphs from AST data and exports them as JSON. No AI.

  • Model: ArchitectureModel in core over a generic typed Graph (GraphNode/GraphEdge with NodeKind/EdgeKind):
    • Folder graph — directory containment.
    • Dependency graph — file→file imports (+ external dependency nodes).
    • Module graph — directory-level dependencies aggregated from imports.
    • Call graph — function→function calls.
  • Builders: pure, deterministic functions in devpilot-core::architecture. Import resolution matches an import's final segment (after / or ::) to a source file's stem; call resolution matches by name, preferring the same file then a unique repo-wide match. Both heuristics are documented; unresolved imports become External nodes, ambiguous calls are dropped.
  • AST extension: the analyzer now captures per-function call sites (FunctionDef.calls) for Rust and TS/JS.
  • Use case: AnalyzeArchitecture parses every supported file in the repo and builds the model; unreadable/unparsable files are skipped.
  • Commands: analyze_architecture (returns the model) and export_architecture (writes pretty JSON to a path) via DI; typed lib/ipc/architecture.ts.

Verification

  • cargo fmt --check, clippy -D warnings, full cargo test --workspace: clean.
    • Builder unit tests (folder/dependency/module/call + external fallback), call-extraction tests over real Rust and TS, and an AnalyzeArchitecture use-case test over mocks.
  • cargo build -p devpilot-desktop and pnpm build (tsc strict): clean.

Scope per plan: graphs in core, one PR, backend + JSON export, no graph-visualization UI (that can follow).

🤖 Generated with Claude Code

…rt (v0.1.2)

No AI. Builds four graphs from AST data. ArchitectureModel in core with a
generic typed Graph; pure deterministic builders in
devpilot-core::architecture for folder (containment), dependency (file
imports), module (directory-level) and call (function) graphs. Import and
call resolution are documented name-based heuristics. AnalyzeArchitecture use
case parses every supported file and builds the model, skipping bad files.
The AST analyzer now captures per-function call sites. Exposed as
analyze_architecture and export_architecture (JSON to disk) commands via DI
with a typed lib/ipc/architecture layer.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@s1rry s1rry merged commit d3e9418 into main Jul 4, 2026
4 checks passed
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.

1 participant