A tool for converting directory structures to YAML format, designed for use with Large Language Models (LLMs). TreeMapper maps your entire codebase into a structured YAML file, making it easy to analyze code, document projects, and work with AI tools.
Requires Python 3.9+:
pip install treemapper
Generate a YAML tree of a directory:
# Map current directory
treemapper .
# Map specific directory
treemapper /path/to/dir
# Custom output file
treemapper . -o my-tree.yaml
# Custom ignore patterns
treemapper . -i ignore.txt
# Disable all default ignores
treemapper . --no-default-ignores
treemapper [OPTIONS] [DIRECTORY]
Arguments:
DIRECTORY Directory to analyze (default: current directory)
Options:
-o, --output-file FILE Output YAML file (default: directory_tree.yaml)
-i, --ignore-file FILE Custom ignore patterns file
--no-default-ignores Disable all default ignores
-v, --verbosity [0-3] Logging verbosity (default: 0)
0=ERROR, 1=WARNING, 2=INFO, 3=DEBUG
-h, --help Show this help
By default, TreeMapper ignores:
- The output file itself
- All
.git
directories - Patterns from
.gitignore
files - Patterns from
.treemapperignore
file
Use --no-default-ignores
to disable all default ignores and only use patterns from -i/--ignore-file
.
name: my-project
type: directory
children:
- name: src
type: directory
children:
- name: main.py
type: file
content: |
def main():
print("Hello World")
- name: README.md
type: file
content: |
# My Project
Documentation here...
Apache License 2.0 - see LICENSE for details.