Skip to main content

Polyglot structural-analysis platform: extract dependency graphs, visualize coupling, track architectural drift.

Project description

code-split

Structural-analysis tool for Rust, Python, JavaScript and TypeScript codebases. Built AI-agent-friendly first — finds where a project has structural problems and hands an actionable shortlist to a human or an AI agent for the actual refactor.

Status: pre-alpha. APIs and output shapes may change without notice. Pin a specific version.

What it finds

  • Components that grew too complex and should be split. Per-function and per-module cyclomatic / cognitive / Halstead / MI metrics; flags entities above your threshold.
  • Strong coupling between components. Computes fan-in / fan-out / HK on the call and module graphs; surfaces the modules that everything depends on (or that depend on everything).
  • Cyclic dependencies. Detects SCCs at module, file and function level — including the silent ones the compiler does not catch.
  • Files that are just too big. Raw LOC, public surface size, item / method counts per file.

The tool does not refactor for you. It produces a structured, machine-readable list of problem spots and an offline HTML report a human or an LLM can act on.

CI integration

Runs as a linter. Configure thresholds in code-split.toml; the CLI exits non-zero when the codebase breaches them — so a PR that introduces a new cycle, a function above your cognitive budget, or a file above your LOC limit fails the build.

code-split analyze --plugin rust . && \
  code-split lint --max-cycles 0 --max-cognitive 25 --max-loc 800

Full CLI

Written in Rust — fast, memory-safe, single static-ish binary with no runtime dependencies (no Python, no Node, no JVM, no shared libs to install). One file on PATH, done.

Everything is driven from the command line: analyze → snapshot JSON, report → offline HTML, diff → before/after report between two snapshots, lint → CI gate. No daemon, no language server, no plugin host required at runtime.

HTML report with dynamic diagrams

code-split report writes a single self-contained HTML file with:

  • Three interactive levels: modules, files, functions.
  • Dagre-laid-out graph with pan/zoom and live filtering.
  • Sortable tables per metric; click a node to open its neighbourhood.
  • "Prompt generator" panel that copies a ready-to-paste prompt (one for each principle: ADP, SRP, OCP, LSP, ISP, DIP, DRY, KISS, LoD, MISU, CoI, YAGNI; plus Reduce Complexity, Split Components) — feed the prompt + the selected nodes to your AI agent.

No network, no analytics, no telemetry. Open in any browser, share as a file.

Install

Pick a channel:

# universal — shell installer that drops the prebuilt binary on PATH
curl -fsSL https://github.com/ffedoroff/code-split/releases/latest/download/code-split-installer.sh | sh

# Windows
powershell -ExecutionPolicy ByPass -c "irm https://github.com/ffedoroff/code-split/releases/latest/download/code-split-installer.ps1 | iex"

# Rust (Cargo)
cargo install code-split --version 0.1.0-alpha.9

# Node (npm)
npm install -g code-split

# Python (pip / uv / pipx)
pip install code-split

# Docker (Docker Hub)
docker pull ffedoroff/code-split:0.1.0-alpha.9

# Docker (GHCR — no anonymous rate limits)
docker pull ghcr.io/ffedoroff/code-split:0.1.0-alpha.9

All channels ship the same code-split binary built from the same Rust source. Linux (x86_64, aarch64), macOS (x86_64, aarch64), Windows (x86_64).

Quick start

# extract dependency graphs from a workspace
code-split analyze --plugin rust ./path/to/project
# → modules.json / files.json / functions.json

# generate an offline interactive HTML report
code-split report ./snapshots/latest

# before / after refactor comparison
code-split diff ./snapshots/before ./snapshots/after

Built-in plugins: rust (cargo + syn + rust-analyzer), python, javascript (also handles TypeScript). Third-party plugins resolved as code-split-plugin-<name> on PATH.

Documentation

  • PRD — product requirements
  • DESIGN — technical design
  • Principles corpus — Rust / Python / TypeScript principle catalogues used by the prompt generator

License

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

code_split-0.1.0a9.tar.gz (816.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

code_split-0.1.0a9-py3-none-win_amd64.whl (10.4 MB view details)

Uploaded Python 3Windows x86-64

code_split-0.1.0a9-py3-none-manylinux_2_28_x86_64.whl (10.6 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

code_split-0.1.0a9-py3-none-manylinux_2_28_aarch64.whl (9.9 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

code_split-0.1.0a9-py3-none-macosx_11_0_arm64.whl (10.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file code_split-0.1.0a9.tar.gz.

File metadata

  • Download URL: code_split-0.1.0a9.tar.gz
  • Upload date:
  • Size: 816.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for code_split-0.1.0a9.tar.gz
Algorithm Hash digest
SHA256 166b59def1f518fdde489ff7cd033f6915b6ad72190a3360cfcf9b746e8bd27f
MD5 24c0f41095b4ec392337b840962f15d0
BLAKE2b-256 40df99c8c7c39045d4f808beb3048bb3c421b6db9791c22e0184edd317e73f11

See more details on using hashes here.

File details

Details for the file code_split-0.1.0a9-py3-none-win_amd64.whl.

File metadata

  • Download URL: code_split-0.1.0a9-py3-none-win_amd64.whl
  • Upload date:
  • Size: 10.4 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for code_split-0.1.0a9-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 5bba7b03f4f0e8886baf13d167ecd0a19370a2d09cf17829e374bee292a5d04b
MD5 ade019ae38a9d5a7956a7437cb4c4a0b
BLAKE2b-256 88a018f296df9558ef358529c2b927883a6cdaeed96780292b3a77eb5083f28e

See more details on using hashes here.

File details

Details for the file code_split-0.1.0a9-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for code_split-0.1.0a9-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ba22132ab77d49acc06d71cb511455b24cb2f64d8efaeb6d16056b9aaf197587
MD5 001ff7a5761d9533862170c05615b4bc
BLAKE2b-256 9f802a4221f3276e06099511842560cb773c31205cd6319eff40f72c6c2536e6

See more details on using hashes here.

File details

Details for the file code_split-0.1.0a9-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for code_split-0.1.0a9-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 39c4f9b16047d503770c3cda124ca63d404c7b64a1f48cae4178b039b9e124e1
MD5 9d686bda2183aab37ff70a50ad69dd0b
BLAKE2b-256 91d56b880834ba81126d63a58cbf07420b6f6e3eb3628027bbccb860ae6036a3

See more details on using hashes here.

File details

Details for the file code_split-0.1.0a9-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for code_split-0.1.0a9-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 75635282f0470226f5a5acedfec87ea5000656021bd7b5ae8a38074e0a6df107
MD5 9f04ca85b5dff7c3cd27a94c5d8a82e2
BLAKE2b-256 c7d8340c6d177b121f47d102f468f630354bd638ea50a86e460b3dfa2e764119

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page