MorphArch scans Git history, extracts dependency edges from source code, computes architectural health, and helps you inspect large repositories through a terminal UI designed for repeated analysis.
It supports Rust, TypeScript, JavaScript, Python, and Go out of the box, and works well with Nx, Turborepo, pnpm workspaces, Cargo workspaces, and other monorepo layouts.
Why MorphArch
- Grouped by default: large repositories open on a cluster map instead of a full raw dependency graph.
- Git-native: scan history, not only
HEAD, and replay changes in the TUI. - Language-aware: import extraction uses safe fast paths with AST fallback instead of plain regex matching.
- Operational: the TUI is built for triage, inspection, drift review, and focused debugging inside the terminal.
- Configurable: ignore presets, scoring rules, boundaries, clustering, and
presentation can all be tuned in
morpharch.toml.
Features
- First-parent history scanning: walks a deterministic Git history stream
with
gixand avoids merge-order ambiguity. - Repo-scoped local cache: stores commit frames, checkpoints, and scan state in SQLite for fast replay and incremental updates.
- Language-aware dependency extraction: parses Rust, TypeScript, JavaScript, Python, and Go with comment/string-safe fast paths and AST fallback.
- Terminal UI built for inspection: cluster map, cluster details, focused inspect lens, timeline, and contextual insights.
- Scale-aware health scoring: cycle, layering, hub, coupling, cognitive, and instability debt combine into a 0-100 health score.
- Blast radius analysis: inspect likely downstream impact for high-risk modules without leaving the terminal.
- Config-driven clustering: semantic families, rules, constraints, aliases, kind hints, and color mode can all be customized per repo.
- Incremental performance: subtree caching, blob caching, delta frames, and parallel parsing reduce repeated scan cost substantially.
Installation
Quick install
Linux / macOS:
|
Windows PowerShell:
irm https://raw.githubusercontent.com/onplt/morpharch/main/install.ps1 | iex
Other install methods
| Platform | Command |
|---|---|
cargo-binstall |
cargo binstall morpharch |
| Homebrew | brew install onplt/morpharch |
| npm | npm install -g morpharch |
| Scoop | scoop bucket add morpharch https://github.com/onplt/scoop-morpharch then scoop install morpharch |
| AUR | yay -S morpharch-bin |
| Docker | docker run --rm -v .:/repo ghcr.io/onplt/morpharch scan . -n 1 |
From source:
Quick Start
# Scan a repository and open the TUI
# Static report for HEAD
# Historical drift table
# Recent cached graph frames
If you are exploring a large repo for the first time, start with a commit limit:
TUI mental model
Map: start with a cluster-level view of the repository.Cluster details: open one subsystem to inspect members, dependencies, and link pressure.Inspect: center a single member and use the focused raw graph only when you need graph-level detail.
The insights panel then gives you:
Overview: current state, recent trend, risk drivers, and suggested actionsHotspots: the modules creating the most pressureBlast: downstream impact for high-risk modules
Commands
morpharch scan <path>
Scan a Git repository, compute per-commit dependency data, and store it in the local repo-scoped cache.
| Flag | Description |
|---|---|
-n, --max-commits <N> |
Maximum commits to scan. 0 means unlimited. |
Notes:
- history traversal is
first-parentonly - repeated scans reuse the local cache when the repo and config are unchanged
- increasing
--max-commitson an already scanned repo can trigger a backfill rebuild
morpharch watch <path>
Scan a repository and launch the TUI.
| Flag | Description |
|---|---|
-n, --max-commits <N> |
Maximum commits to scan before launching the TUI. |
-s, --max-snapshots <N> |
Maximum snapshots loaded into the TUI timeline. Default: 200. |
morpharch analyze [commit]
Generate a detailed report for one commit.
morpharch list-drift
Show recent health drift and graph deltas for one repository.
morpharch list-graphs
Show recently stored graph frames for one repository.
TUI Navigation
Global model
MorphArch uses one interaction model everywhere:
Tab/Shift+Tab: move panel focusj/kor arrow keys: move selection inside the active panelh/lor[ ]: switch local views or insight tabsEnter: drill inEsc: drill out
Key shortcuts
| Key | Action |
|---|---|
Tab / Shift+Tab |
Cycle panel focus |
1-4 |
Jump to Packages / Graph / Insights / Timeline |
j/k |
Move selection in the active panel |
h/l or [ ] |
Switch local views or insight tabs |
Enter |
Open cluster, inspect member, or open selected item |
Esc |
Back out one semantic level |
Space / p |
Play or pause timeline auto-advance |
/ |
Filter sidebar entries or graph context |
c |
Reset the current graph viewport |
r |
Reheat the raw graph layout |
x |
Toggle blast overlay |
b / i |
Toggle sidebar or detail panel |
q |
Quit |
Mouse support
- Click sidebar entries to select them and click map clusters to open the corresponding cluster.
- Scroll on the raw graph to zoom.
- Drag the raw graph background to pan.
- Drag the timeline to scrub history.
- Click insight tabs or hotspot rows directly.
Configuration
MorphArch works with zero config, but a morpharch.toml in the repo root lets
you tune both analysis and presentation.
[]
= true
= ["repo_noise"]
= ["third_party/tmp/**"]
[]
= [".circleci/**", "scripts/dev/**"]
[]
= 2
= 3
= [
"/test/",
"/tests/",
"/testdata/",
"/__tests__/",
"/fixtures/",
"/e2e/",
]
[]
= 30
= 25
= 15
= 12
= 10
= 8
[]
= 0.3
= 2
= 0.8
= 0.3
= 5
[[]]
= "packages/**"
= ["apps/**", "cmd/**"]
[]
= ["deno_core"]
= ["main", "index", "app", "lib", "mod", "server"]
[]
= "hybrid"
[]
= true
= "workspace"
= 2
= true
[]
= true
= 2
= 6
= 0.45
= true
= true
= true
[[]]
= "runtime"
= "infra"
= ["runtime", "runtime/**"]
= "never"
[[]]
= "node_compat"
= "domain"
= ["node", "node/**", "node_*"]
[[]]
= "must_group"
= ["core", "core/**"]
[]
= "explicit_only"
= "minimal"
[]
= "third-party"
= "platform"
[]
= "infra"
= "deps"
Configuration highlights
ignore.use_defaults: enables built-in presets for tooling, build artifacts, and generated filesignore.presets/ignore.custom_presets: reusable ignore bundles for large reposscan.package_depth: controls how many meaningful path segments become one package labelscan.external_min_importers: hides low-signal third-party dependencies unless they are imported by at leastNinternal packagesscan.test_path_patterns: controls which path fragments are treated as non-architectural test or fixture codescoring.boundaries: explicit architectural rules that feed layering debtclustering.families: stable semantic grouping for important subsystemsclustering.rules: label-based pattern grouping for dynamic naming casesclustering.presentation.kind_mode:explicit_then_heuristicorexplicit_onlyclustering.presentation.color_mode:minimalorsemantic
Scan heuristics
- Python relative imports such as
from . import configandfrom ..shared import utilare resolved as internal dependencies. - The default test-path filter is intentionally narrow. Directories like
examples/,bench/, andmocks/are no longer excluded unless you add them explicitly throughscan.test_path_patternsorignorerules. - Set
scan.external_min_importers = 0if you want every third-party dependency to stay visible in the TUI and dependency views.
Architecture Health Scoring
MorphArch assigns a health score from 0 to 100.
| Range | Meaning |
|---|---|
90-100 |
Clean |
70-89 |
Healthy |
40-69 |
Warning |
0-39 |
Critical |
The score is built from six components:
- Cycle debt
- Layering debt
- Hub / god module debt
- Coupling debt
- Cognitive debt
- Instability debt
See morpharch.dev/docs/concepts/scoring for the full explanation.
Documentation
- Website: morpharch.dev
- Docs home: morpharch.dev/docs/intro
- Intro: morpharch.dev/docs/intro
- Quick start: morpharch.dev/docs/quick-start
- CLI reference: morpharch.dev/docs/cli-reference
- Configuration guide: morpharch.dev/docs/guides/configuration
- How it works: morpharch.dev/docs/concepts/how-it-works
Docs source lives under website/docs. The landing page source lives at website/src/pages/index.tsx.
Contributing
Website:
License
Apache-2.0 OR MIT