Skip to main content

Find and auto-delete dead code across 9 languages — with git intelligence and auto PR

Project description

☠ Archaeologist

Codebase intelligence toolkit. Five tools to understand, clean, and improve your codebase — all from one install.

pip3 install archaeologist

Five Tools

☠ Unused Code Finder

Find functions nobody calls. Combines static analysis with git history into a confidence score. Auto-deletes on an isolated branch, runs your tests, and opens a GitHub PR.

deadcode ./my-project --explain
deadcode-report ./my-project --output report.html
deadcode-clean ./my-project --dry-run --min-confidence 85
deadcode-clean ./my-project --min-confidence 85

⬡ Codebase Graph

Interactive browser-based map of your architecture. Files grouped by folder, colored by health. See which files are clean, which have dead code, and which are completely unused.

archaeologist-graph ./my-project
archaeologist-graph ./my-project --output graph.html

◎ Change Impact Analyzer

Before changing any file, see what could break — every caller, every importer, test coverage, and a 0–100 blast radius score.

archaeologist-impact ./my-project user_service.dart
archaeologist-impact ./my-project user_service.dart --html

◈ Complexity Scorer

Scores every function on cyclomatic complexity — decision branches, nesting depth, and length. Ranks worst-first so you know what to refactor.

archaeologist-complexity ./my-project
archaeologist-complexity ./my-project --html --min-score 15

⧉ Duplicate Detector

Finds copy-paste code and near-identical functions. Detects same names in different files, exact body copies, and high-similarity implementations.

archaeologist-dupes ./my-project
archaeologist-dupes ./my-project --html

Languages

Production tested: Python, Dart/Flutter, JavaScript, TypeScript

Beta (may have false positives): Go, Java, Kotlin, Ruby, Rust, Swift


How the Unused Code Finder Works

  1. Parse — Tree-sitter builds an AST for every file, extracting all function definitions and calls
  2. Git analysis — Last commit date, author count, and commit frequency per file
  3. Score — Five signals combine into a 0–100 confidence score
  4. Delete — Functions removed by precise AST byte ranges — no broken syntax
  5. Test — Your test suite runs automatically. If tests fail, everything rolls back
  6. PR — A GitHub PR opens with full documentation of every change

Confidence Score Signals

Signal Points How it works
Call graph 45 Zero callers = full 45pts
Git age 20 2+ years untouched = 20pts
Author count 15 Single author = 15pts
Recursive dead 10 All callers are also dead = 10pts
Commit count 10 Only 1–2 commits ever = 10pts

Verdicts

  • 80–100: Safe to remove — Multiple signals agree. Auto-clean targets these by default.
  • 50–79: Review first — Likely unused. Verify manually before removing.
  • 40–49: Needs runtime data — Static analysis uncertain. May be called via reflection.

Git Flow (Auto-clean)

Your main branch is never touched. Everything happens on an isolated branch:

  1. New branch created — e.g. cleanup-2026-05-28
  2. Functions removed surgically by AST byte ranges
  3. Your test suite runs automatically
  4. If tests pass — branch committed
  5. GitHub PR opened with full documentation
  6. If tests fail — branch deleted, nothing changes

To review and merge:

git checkout cleanup-2026-05-28
git diff main cleanup-2026-05-28
git checkout main && git merge cleanup-2026-05-28

To roll back:

git branch -D cleanup-2026-05-28

Requirements

  • Python 3.11+
  • Git (for git history analysis)
  • GitHub token (optional, for auto-PR feature)

License

MIT — free to use, modify, and distribute.

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

archaeologist-0.8.2.tar.gz (53.8 kB view details)

Uploaded Source

Built Distribution

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

archaeologist-0.8.2-py3-none-any.whl (59.3 kB view details)

Uploaded Python 3

File details

Details for the file archaeologist-0.8.2.tar.gz.

File metadata

  • Download URL: archaeologist-0.8.2.tar.gz
  • Upload date:
  • Size: 53.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for archaeologist-0.8.2.tar.gz
Algorithm Hash digest
SHA256 f43252a2cb1367e7ecac43c8dcc2825bd38b0d544df5bf4b821847e0cb853db8
MD5 3410a2bf99c4858961d2bd82646ba047
BLAKE2b-256 f85c2f8c120fed364dd45b09af42863154d7f7f8aab8963608368facad3d20c8

See more details on using hashes here.

File details

Details for the file archaeologist-0.8.2-py3-none-any.whl.

File metadata

  • Download URL: archaeologist-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 59.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for archaeologist-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dfb2d8d1b86f706b11047f0ee4af8b41d9feb7b7d6d6ee3423ec6ea5b53a0126
MD5 94b682abd1bd0b476713059ef14504a0
BLAKE2b-256 2f9fa5068349f437edcdd09bbfab9b195c8336d74f6ffc48fd84853da394f100

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