Metadata-Version: 2.4
Name: codeatlas-viz
Version: 0.5.0
Summary: Zero-config local codebase architecture & call-graph visualizer with an interactive Svelte UI.
Author: kutyfuty
License: MIT
Project-URL: Homepage, https://github.com/kutyfuty/codeatlas
Project-URL: Repository, https://github.com/kutyfuty/codeatlas
Project-URL: Issues, https://github.com/kutyfuty/codeatlas/issues
Keywords: cli,call-graph,ast,architecture,visualizer,developer-tools,svelte
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Documentation
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Provides-Extra: treesitter
Requires-Dist: tree-sitter>=0.23; extra == "treesitter"
Requires-Dist: tree-sitter-language-pack>=0.4; extra == "treesitter"
Dynamic: license-file

# CodeAtlas

[![CI](https://github.com/kutyfuty/codeatlas/actions/workflows/ci.yml/badge.svg)](https://github.com/kutyfuty/codeatlas/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/codeatlas-viz)](https://pypi.org/project/codeatlas-viz/)
[![Python](https://img.shields.io/pypi/pyversions/codeatlas-viz)](https://pypi.org/project/codeatlas-viz/)
[![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen.svg)](https://github.com/kutyfuty/codeatlas/blob/main/pyproject.toml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kutyfuty/codeatlas/blob/main/LICENSE)
[![architecture](https://raw.githubusercontent.com/kutyfuty/codeatlas/main/docs/badge.svg)](https://kutyfuty.github.io/codeatlas/demo/codeatlas/)

**Architecture guardrails for human- and AI-written code.** CodeAtlas maps your call graph, tells you (or your coding agent) what a change will break, and fails CI when a PR adds a new circular dependency or crosses a layer boundary. One `pip install`, zero runtime dependencies, nothing leaves your machine.

### 👉 [Live demo: explore Flask's call graph in your browser](https://kutyfuty.github.io/codeatlas/demo/flask/)

![CodeAtlas showing the blast radius of Flask's render_template](https://raw.githubusercontent.com/kutyfuty/codeatlas/main/docs/screenshot-blast-radius.jpg)

```bash
uvx codeatlas-viz serve .                              # interactive map of the current repo, no install
claude mcp add codeatlas -- uvx codeatlas-viz mcp      # give Claude Code the map + a self-check tool
```

<!-- mcp-name: io.github.kutyfuty/codeatlas -->

---

## Why CodeAtlas

Coding agents write a lot of code quickly. They also quietly add import cycles, call the database from the UI layer, and change functions without knowing who calls them. CodeAtlas gives you three things in one small tool:

| | What you get |
|---|---|
| **For your agent** (MCP) | `check_changes` lets the agent verify its own edits before it says "done": new cycles, new boundary violations, health delta, blast radius. Plus callers/callees, shortest call path, file outline and symbol source in one call. 11 tools, so the schema stays small in the prompt. |
| **For you** (UI) | `codeatlas serve`: an interactive call graph with hubs, cycles, unreferenced code, path finder and blast radius. `codeatlas export --format site` publishes the same map as a static site, like the [live demo](https://kutyfuty.github.io/codeatlas/). |
| **For CI** (rules) | `codeatlas check --baseline origin/main` fails only on **new** cycles or boundary violations, so legacy debt doesn't block you. A GitHub Action posts an architecture diff + blast radius comment on every PR. |

And it stays out of your way: pure Python standard library, no database, no index directory, no daemon, no API keys, no telemetry. It scans a few hundred files in seconds and works offline or in locked-down CI.

## Quick start

```bash
pip install codeatlas-viz        # or: uvx codeatlas-viz <command>, pipx install codeatlas-viz

codeatlas scan .                 # terminal summary: hubs, cycles, health score
codeatlas serve .                # interactive UI at http://127.0.0.1:4173
codeatlas impact .               # blast radius of your uncommitted changes
codeatlas check . --baseline origin/main --max-cycles 0   # CI gate: fail on new cycles only
```

Languages: Python (full `ast`), JavaScript, TypeScript and Svelte (structural parser, optional Tree-sitter), Go, Rust, Java, C and C++ (structural parser, optional Tree-sitter: `pip install "codeatlas-viz[treesitter]"`).

## Use it with your coding agent (MCP)

**Claude Code**

```bash
claude mcp add codeatlas -- uvx codeatlas-viz mcp
```

or install it as a plugin, which also adds a `/codeatlas:check` skill:

```text
/plugin marketplace add kutyfuty/codeatlas
/plugin install codeatlas@codeatlas
```

**Cursor, Windsurf, Claude Desktop, any MCP client**

```json
{
  "mcpServers": {
    "codeatlas": { "command": "uvx", "args": ["codeatlas-viz", "mcp", "/path/to/repo"] }
  }
}
```

| Tool | What it answers |
|---|---|
| `check_changes` | Did my edits add a cycle, break a boundary rule or lower the health score? What do they affect? |
| `blast_radius` | Who calls this file/symbol (transitively), which entrypoints and tests reach it? |
| `get_symbol` | Source + direct callers + callees of a symbol in one call |
| `get_callers` / `get_callees` | Direct neighbours in the call graph |
| `trace_path` | Shortest call chain from A to B |
| `get_file_outline` | Classes/functions in a file with line ranges and fan-in/out |
| `search_symbols` | Find symbols by name or path |
| `get_overview` | Size, languages, hubs, cycles, health score |
| `find_cycles_and_dead_code` | Cycles, unreferenced callables, rule violations |
| `rescan` | Force a rescan (the graph also refreshes automatically when scanned files change) |

## Architecture rules in CI

Put rules in `.codeatlas.toml`:

```toml
[check]
max_cycles = 0
min_health = 80

[[rules]]
name = "UI must go through the service layer"
from = "src/ui/*"
forbid = "src/db/*"
```

```bash
codeatlas check .                                   # whole repo
codeatlas check . --baseline origin/main            # only NEW cycles / violations fail
codeatlas diff . --base origin/main --with-impact --format markdown   # PR report
```

### GitHub Action

```yaml
name: CodeAtlas Architecture
on: [pull_request]
permissions:
  contents: read
  pull-requests: write

jobs:
  architecture:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: kutyfuty/codeatlas@v0.5.0
        with:
          baseline-only: "true"
          comment-on-pr: "true"
```

## Share your architecture map

```bash
# Static interactive site (GitHub Pages, Netlify, any host). Code previews link to GitHub:
codeatlas export . --format site -o site/ --source-url https://github.com/you/repo/blob/main

# Health badge for your README:
codeatlas export . --format badge -o docs/codeatlas-badge.svg

# Single-file HTML report, Markdown summary, Mermaid diagram or raw JSON:
codeatlas export . --format html -o report.html
codeatlas export . --format markdown -o SUMMARY.md
codeatlas export . --format mermaid -o architecture.mmd
codeatlas export . --format json -o graph.json
```

Exports never contain your local absolute paths. The site only includes source code if you pass `--embed-source`.

## How it compares

There are excellent code-graph tools; pick the one that fits your workload. Facts below are from each project's own documentation as of November 2026.

| | CodeAtlas | code-review-graph | GitNexus | Serena | import-linter / dependency-cruiser |
|---|---|---|---|---|---|
| Install footprint | stdlib only, no index | Tree-sitter + SQLite index | Node + native builds + graph DB | Python + language servers | Python-only / JS-only |
| License | MIT | MIT | PolyForm Noncommercial | see repo (license changed in v2) | BSD / MIT |
| Configurable layer rules + baseline gate | ✅ | coupling warnings | — | — | ✅ (imports only, one language) |
| Agent self-check of its edits | ✅ `check_changes` | ✅ impact radius | ✅ change detection | — | — |
| Interactive UI / static site export | ✅ / ✅ | D3 viz | web explorer | — | graphs via Graphviz |
| Precision | heuristic, name/type/import based | Tree-sitter AST | Tree-sitter AST | compiler-grade (LSP) | exact imports |
| Languages | 9 | ~35 | 10–18 | 40+ | 1 each |

**Where CodeAtlas is the better fit:** you want layer rules and "no new cycles" enforced in CI across languages, a tiny MCP surface for your agent, and zero setup (works in air-gapped or locked-down environments).
**Where others win:** very large monorepos, compiler-grade precision (Serena), many more languages, semantic search, persistent indexes.

## Accuracy notes

CodeAtlas resolves calls statically. Bare calls, `self.x()`, typed receivers (`svc: Service`, `x = Service()`), module calls (`utils.load()`) and package re-exports are resolved; calls on untyped receivers only match code in imported modules, and generic names (`get`, `pop`, `json`...) are never guessed. Dynamic dispatch (`getattr`, dependency injection) can't be seen statically, so "unreferenced" means *candidate*, not proof. Bug reports with a minimal example are very welcome.

## Security

`codeatlas serve` listens on `127.0.0.1` only, previews nothing but the scanned source files, and refuses requests from other websites (no CORS, Host-header and `Sec-Fetch-Site` checks). Passing `--host 0.0.0.0` exposes your source code to everyone on the network. Git refs from the API, MCP and CLI are validated so they can't be turned into git options.

## Contributing

New language analyzers, resolution improvements and UI ideas are all welcome. Look for [`good first issue`](https://github.com/kutyfuty/codeatlas/labels/good%20first%20issue) and read [CONTRIBUTING.md](CONTRIBUTING.md).

```bash
pip install -e ".[dev]" && pytest          # backend tests
cd frontend && npm ci && npm run build     # rebuild the UI bundle (src/codeatlas/web/)
```

## License

[MIT](https://github.com/kutyfuty/codeatlas/blob/main/LICENSE)
