Skip to main content

TreeMapper

PyPI License

⚠️ DEPRECATED. TreeMapper is sunset. It has always been a thin wrapper around the diffctx engine, and diffctx now covers 100% of its functionality — same CLI surface, same flags, same Python API, same MCP server. This is the final release; no further updates will be published under the treemapper name.

Migrate:

pipx uninstall treemapper && pipx install diffctx

Then replace treemapperdiffctx, treemapper-mcpdiffctx-mcp, and import treemapperimport diffctx. Every command and API call works unchanged.

Map a codebase into LLM-ready context. TreeMapper serializes an entire directory tree — structure plus file contents — to YAML, JSON, Markdown, or text, and selects the minimal smart git-diff context needed to understand a change. Paste the output into Claude, ChatGPT, or any LLM.

TreeMapper is a thin command-line product built on the diffctx engine. All traversal, serialization, and diff-context selection live in diffctx; TreeMapper re-exposes them under the treemapper name so there is a single source of truth and no duplicated logic.

Installation

pipx install treemapper                  # recommended: isolated, no venv needed
pip install treemapper                   # or with pip
pip install 'treemapper[tree-sitter]'    # + AST parsing for smarter diff context
pip install 'treemapper[mcp]'            # + MCP server for AI assistants

Usage

treemapper .                     # map current directory to Markdown (stdout)
treemapper /path/to/project      # map a specific directory
treemapper . -f json             # output as JSON
treemapper . -f md --save        # save as tree.md
treemapper . --no-content        # structure only, no file contents
treemapper . -c                  # copy output to clipboard
treemapper . --diff HEAD~1       # smart context for the last commit
treemapper . --diff main..HEAD   # smart context for a branch range
treemapper graph .               # project dependency graph (mermaid)

Two modes

  • Tree mapping (treemapper .) — walks the directory tree, respects hierarchical ignore patterns (.gitignore, .diffctx/ignore), reads file contents with binary/encoding detection, and serializes the result.
  • Diff context (treemapper . --diff) — analyzes a git diff and selects the minimal set of code fragments needed to understand the change, instead of dumping whole files.

Run treemapper --help for the full flag reference.

Python API

import treemapper

tree = treemapper.map_directory(".", no_content=False)
print(treemapper.to_yaml(tree))

context = treemapper.build_diff_context(root_dir=".", diff_range="HEAD~1")

# treemapper.run drives the full branded CLI from Python (same surface as the command)
treemapper.run(["graph", "."], prog="treemapper", version=treemapper.__version__)

Every run reports an exact tiktoken token count (not a chars / 4 estimate), so you know the real context cost before you paste.

Relationship to diffctx

TreeMapper is the user-facing distribution; diffctx is the reusable engine. Pin compatibility is diffctx>=1.10.1,<2.0. If you are embedding the engine in your own tool, depend on diffctx directly.

License

Apache 2.0

Download files

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

Source Distribution

treemapper-2.4.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

treemapper-2.4.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file treemapper-2.4.0.tar.gz.

File metadata

  • Download URL: treemapper-2.4.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for treemapper-2.4.0.tar.gz
Algorithm Hash digest
SHA256 ec0f513feba09fa4fcf9f13f54545a0bafd1a7f0ae7d79ffd293c10c3383f6f3
MD5 0f468af487132f4c61ee741ed291be5f
BLAKE2b-256 9d00c3ae1b8aaaf40fa0d93f60496b53fe0d71ce0e8e9a8458fce9a29cc34bfa

See more details on using hashes here.

Provenance

The following attestation bundles were made for treemapper-2.4.0.tar.gz:

Publisher: cd.yml on nikolay-e/treemapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file treemapper-2.4.0-py3-none-any.whl.

File metadata

  • Download URL: treemapper-2.4.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for treemapper-2.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62c43e964d49da2adfd243c2efbad36616a2223be7cc016cf5a847f3adfc3767
MD5 69678b82040b8b4d84b892c2a9e6d036
BLAKE2b-256 e6458f16338fc0ad18a3ec1cda974c418102fcd1c6be2e80a5935666dcb68995

See more details on using hashes here.

Provenance

The following attestation bundles were made for treemapper-2.4.0-py3-none-any.whl:

Publisher: cd.yml on nikolay-e/treemapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

2.4.0 This release

2 files

2.3.0

2 files

2.2.0

2 files

2.1.0

2 files

1.6.1

5 files

1.6.0

2 files

1.5.0

2 files

1.4.4

2 files

1.4.3

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.7

2 files

1.3.6

2 files

1.3.5

2 files

1.3.4

2 files

1.3.3

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page