Skip to main content

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

Project description

code-split

CI codecov dependencies Crates.io npm PyPI License

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.

Offline & private

code-split always runs entirely on your machine. It makes no network calls, sends no telemetry or analytics, and never uploads your code or analysis results anywhere. Generated HTML reports are self-contained — no CDN, no external requests, no tracking.

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 check . \
  --threshold function.cognitive=25 --threshold file.loc=800

The linter is the check command — exits non-zero on any cycle or threshold violation (mutual and chain cycle checks are on by default). See docs/CLI.md for all flags.

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.

Three commands: check (linter — exits non-zero on violations), report (snapshot JSON + offline HTML, with optional in-run before/after diff via --before), diff (HTML or JSON diff between two snapshots, for CI artifacts). No daemon, no language server, no plugin host required at runtime. Full reference: docs/CLI.md.

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

Package pages: crates.io · npm · PyPI · Docker Hub · GHCR

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.1

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

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

# Docker (Docker Hub)
docker pull fedoroff/code-split:0.1.1

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

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

# lint a project — non-zero exit on violations (CI linter)
code-split check ./path/to/project

# analyze and write a snapshot JSON + offline HTML report
code-split report
# → .code-split/{project-dir}-{ts}.json + .code-split/index.html

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

Built-in plugins: rust (cargo + syn + rust-analyzer), python, javascript (also handles TypeScript) — all compiled into the single binary, nothing to install.

Documentation

  • CLI — commands, flags, and examples
  • Rule reference — rule ids grouped by concern (CYC/CPX/CPL/SIZ), threshold scopes (file/module/function, each single + .avg), what each flags, and how to fix it
  • Configcode-split.toml schema
  • 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.1.tar.gz (842.3 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.1-py3-none-win_amd64.whl (10.4 MB view details)

Uploaded Python 3Windows x86-64

code_split-0.1.1-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.1-py3-none-manylinux_2_28_aarch64.whl (10.0 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

code_split-0.1.1-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.1.tar.gz.

File metadata

  • Download URL: code_split-0.1.1.tar.gz
  • Upload date:
  • Size: 842.3 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.1.tar.gz
Algorithm Hash digest
SHA256 a4d1c6574b1343e0b96c9057f82134ea6fbb145b0226d34e0671e69c3e691eb3
MD5 a25fdaa4693499df983c720572ae6dc9
BLAKE2b-256 ac841d848fc8f93d7dc62805da312e5e6bba1cce624d146a050e277f0b06385a

See more details on using hashes here.

File details

Details for the file code_split-0.1.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: code_split-0.1.1-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.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 8e4b87983c54498df56f6c258bc857aed38ed01db8e973dcadc134fe3d5766a9
MD5 9be5751185ccc03d3e01650c924e383d
BLAKE2b-256 c7db7b7f69f9a2b808c05a4c6f3bb51ce9082473f3faf5dcd1ad14c0063eb64e

See more details on using hashes here.

File details

Details for the file code_split-0.1.1-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for code_split-0.1.1-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 795fd1422554619e00a017b3acd2391e6c53786e5356834dfac5beef6523b1a7
MD5 a8a02a9816554a2b4dc9c331c7a40743
BLAKE2b-256 b84d28980ba26de85a86d8f24739fefb8a8ccad454851a5631cd0312b90ef0d5

See more details on using hashes here.

File details

Details for the file code_split-0.1.1-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for code_split-0.1.1-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 926f5581cb5a998a5cdd25764a4293cb1e81f62505390bdbfb891cfd43842e1d
MD5 24c1d1f4a1091b715c9cc3bb40821a69
BLAKE2b-256 e798f2773b5992d8cd7b365b2ebb943adbcb5392f4c6243b353e2cdcfae814ed

See more details on using hashes here.

File details

Details for the file code_split-0.1.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for code_split-0.1.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3f09139650e2778c0e5996eca7afc1ee82b24c19d7ba0dd255c1aa1f90a9f4c3
MD5 27ab73797f66aad9b55e257065740a94
BLAKE2b-256 adf5fbaeefec7d2d5b08bab1bd28ff0346f0a969e62f6b52f2112648882752b6

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