@@ -50,23 +50,9 @@ pip install 'treemapper[tree-sitter]' # + AST parsing for smarter diff cont
5050
5151** Paper:** [ Context-Selection for Git Diff (Zenodo, 2026)] ( https://doi.org/10.5281/zenodo.18824580 )
5252
53- Smart context selection for git diffs — automatically finds the
54- minimal set of code fragments needed to understand a change:
55-
56- ``` bash
57- treemapper . --diff HEAD~1..HEAD # recent changes
58- treemapper . --diff main..feature # feature branch
59- treemapper . --diff HEAD~1 --budget 30000 # limit tokens
60- treemapper . --diff HEAD~1 --full # all changed code
61- ```
62-
63- Uses graph-based relevance propagation (Personalized PageRank)
64- to select the most important context. Output size is controlled
65- by algorithm convergence (τ-stopping) by default, or an explicit
66- ` --budget ` token limit. Understands imports, type references,
67- config dependencies, and co-change patterns across 50+ file types.
68-
69- Output format:
53+ Automatically finds the minimal set of code fragments needed to understand
54+ a change — imports, callers, type definitions, config dependencies — without
55+ dumping entire files. Understands 50+ file types.
7056
7157``` yaml
7258name : myproject
@@ -82,42 +68,35 @@ fragments:
8268 ...
8369` ` `
8470
85- | Flag | Default | Description |
86- |------------|---------------|------------------------------------------------|
87- | ` --budget` | none | Token limit (convergence-based by default) |
88- | `--alpha` | 0.60 | PPR damping factor |
89- | `--tau` | 0.08 | Stopping threshold |
90- | `--full` | false | Include all changed code |
71+ ### How it works
72+
73+ Uses Personalized PageRank on a code graph (imports, co-changes, type refs)
74+ to propagate relevance from changed lines outward. Stops when signal decays
75+ below threshold τ, or at an explicit ` --budget` token limit.
76+
77+ | Flag | Default | Description |
78+ |------------|---------|------------------------------------------|
79+ | `--budget` | none | Token limit (convergence-based by default) |
80+ | `--full` | false | Include all changed code, skip selection |
81+ | `--alpha` | 0.60 | PPR damping factor |
82+ | `--tau` | 0.08 | Convergence threshold |
9183
9284# # Usage
9385
9486<!-- BEGIN USAGE -->
9587` ` ` bash
96- treemapper # current dir, YAML to stdout
88+ # full codebase export:
9789treemapper . # YAML to stdout + token count
98- treemapper . -o tree.yaml # save to file
99- treemapper . --save # save to tree.yaml (default name)
100- treemapper . -o - # explicit stdout
101- treemapper . -f json # JSON format
102- treemapper . -f txt # plain text with indentation
103- treemapper . -f md # Markdown with fenced code blocks
90+ treemapper . -f md -c # Markdown → clipboard
91+ treemapper . -f json -o tree.json # JSON → file
10492treemapper . --no-content # structure only, no file contents
105- treemapper . --max-depth 3 # limit depth (0=root only)
106- treemapper . --max-file-bytes 10000 # skip files > 10KB (default: 10 MB)
107- treemapper . --no-file-size-limit # include all files regardless of size
93+ treemapper . --max-depth 3 # limit depth
10894treemapper . -i custom.ignore # custom ignore patterns
109- treemapper . -w whitelist # include-only filter
110- treemapper . --no-default-ignores # disable built-in ignore patterns
111- treemapper . --log-level info # log level (default: error)
112- treemapper . -c # copy to clipboard
113- treemapper . -c -o tree.yaml # clipboard + save to file
114- treemapper -v # show version
11595
11696# diff context mode (requires git repo):
11797treemapper . --diff HEAD~1 # context for last commit
11898treemapper . --diff main..feature # context for feature branch
119- treemapper . --diff HEAD~1 --budget 30000 # limit diff context to ~30k tokens
120- treemapper . --diff HEAD~1 --full # all changed code, no smart selection
99+ treemapper . --diff HEAD~1 --budget 30000 # limit to ~30k tokens
121100treemapper . --diff HEAD~1 -c # diff context to clipboard
122101` ` `
123102<!-- END USAGE -->
0 commit comments