Export codebase structure and contents for AI/LLM context
Project description
TreeMapper
Extends ../CLAUDE.md
Export your codebase for AI/LLM context in one command.
pip install treemapper
treemapper . -o context.yaml # paste into ChatGPT/Claude
Why TreeMapper?
Unlike tree or find, TreeMapper exports structure + file contents in a format optimized for LLM context windows:
name: myproject
type: directory
children:
- name: main.py
type: file
content: |
def hello():
print("Hello, World!")
- name: utils/
type: directory
children:
- name: helpers.py
type: file
content: |
def add(a, b):
return a + b
Usage
treemapper . # YAML to stdout
treemapper . -o tree.yaml # save to file
treemapper . --format json # JSON format
treemapper . --format text # tree-style text
treemapper . --no-content # structure only (no file contents)
treemapper . --max-depth 3 # limit directory depth
treemapper . --max-file-bytes 10000 # skip files larger than 10KB
treemapper . -i custom.ignore # custom ignore patterns
Python API
from treemapper import map_directory, to_yaml, to_json, to_text
# Get tree as dict
tree = map_directory("./myproject")
tree = map_directory("./src", max_depth=2, no_content=True)
# Serialize to string
yaml_str = to_yaml(tree)
json_str = to_json(tree)
text_str = to_text(tree)
Ignore Patterns
Respects .gitignore and .treemapperignore automatically. Use --no-default-ignores to include everything.
Development
pip install -e ".[dev]"
pytest
pre-commit run --all-files
Testing
Integration tests only - test against real filesystem. No mocking.
Architecture
src/treemapper/
├── cli.py # argument parsing
├── ignore.py # gitignore/treemapperignore handling
├── tree.py # directory traversal
├── writer.py # YAML/JSON/text output
└── treemapper.py # main entry point
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file treemapper-1.1.2.tar.gz.
File metadata
- Download URL: treemapper-1.1.2.tar.gz
- Upload date:
- Size: 34.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91529969e23d7f8a13d28e294aa0c75129fec3c1f8db0eb1441268c84e075597
|
|
| MD5 |
283b48688062cba707ca64ad276c7d74
|
|
| BLAKE2b-256 |
88b2a8e91382d7485782a1db70a61485b40b05492b627c2c0d7c60082a54a6a4
|
Provenance
The following attestation bundles were made for treemapper-1.1.2.tar.gz:
Publisher:
cd.yml on nikolay-e/treemapper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
treemapper-1.1.2.tar.gz -
Subject digest:
91529969e23d7f8a13d28e294aa0c75129fec3c1f8db0eb1441268c84e075597 - Sigstore transparency entry: 779581219
- Sigstore integration time:
-
Permalink:
nikolay-e/treemapper@e9f3bf29038d7c86c686ddaece3f1d3661ee898a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nikolay-e
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@e9f3bf29038d7c86c686ddaece3f1d3661ee898a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file treemapper-1.1.2-py3-none-any.whl.
File metadata
- Download URL: treemapper-1.1.2-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfe9f8b1b67716a109964dc7aac026ecbd8f335c45155e15a654336a069d8e6a
|
|
| MD5 |
cb26a731289bb910578fa567c7de8519
|
|
| BLAKE2b-256 |
0900a92a2b8bff755b38a4abc24cbbe1e2a47c24787614cfc3fbd710f9df29ae
|
Provenance
The following attestation bundles were made for treemapper-1.1.2-py3-none-any.whl:
Publisher:
cd.yml on nikolay-e/treemapper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
treemapper-1.1.2-py3-none-any.whl -
Subject digest:
cfe9f8b1b67716a109964dc7aac026ecbd8f335c45155e15a654336a069d8e6a - Sigstore transparency entry: 779581222
- Sigstore integration time:
-
Permalink:
nikolay-e/treemapper@e9f3bf29038d7c86c686ddaece3f1d3661ee898a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nikolay-e
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@e9f3bf29038d7c86c686ddaece3f1d3661ee898a -
Trigger Event:
workflow_dispatch
-
Statement type: