Skip to content

Commit e6e38e7

Browse files
committed
docs: trim usage to 10 examples, restructure diff context section
1 parent b2d71ec commit e6e38e7

File tree

3 files changed

+26
-59
lines changed

3 files changed

+26
-59
lines changed

.markdownlint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
MD013:
22
tables: false
3+
code_blocks: false

README.md

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -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
7258
name: 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:
9789
treemapper . # 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
10492
treemapper . --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
10894
treemapper . -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):
11797
treemapper . --diff HEAD~1 # context for last commit
11898
treemapper . --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
121100
treemapper . --diff HEAD~1 -c # diff context to clipboard
122101
```
123102
<!-- END USAGE -->

scripts/update_readme_usage.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,19 @@
77
from pathlib import Path
88

99
_USAGE_EXAMPLES: list[tuple[str, str]] = [
10-
("treemapper", "current dir, YAML to stdout"),
10+
("# full codebase export:", ""),
1111
("treemapper .", "YAML to stdout + token count"),
12-
("treemapper . -o tree.yaml", "save to file"),
13-
("treemapper . --save", "save to tree.yaml (default name)"),
14-
("treemapper . -o -", "explicit stdout"),
15-
("treemapper . -f json", "JSON format"),
16-
("treemapper . -f txt", "plain text with indentation"),
17-
("treemapper . -f md", "Markdown with fenced code blocks"),
12+
("treemapper . -f md -c", "Markdown → clipboard"),
13+
("treemapper . -f json -o tree.json", "JSON → file"),
1814
("treemapper . --no-content", "structure only, no file contents"),
19-
("treemapper . --max-depth 3", "limit depth (0=root only)"),
20-
("treemapper . --max-file-bytes 10000", "skip files > 10KB (default: 10 MB)"),
21-
("treemapper . --no-file-size-limit", "include all files regardless of size"),
15+
("treemapper . --max-depth 3", "limit depth"),
2216
("treemapper . -i custom.ignore", "custom ignore patterns"),
23-
("treemapper . -w whitelist", "include-only filter"),
24-
("treemapper . --no-default-ignores", "disable built-in ignore patterns"),
25-
("treemapper . --log-level info", "log level (default: error)"),
26-
("treemapper . -c", "copy to clipboard"),
27-
("treemapper . -c -o tree.yaml", "clipboard + save to file"),
28-
("treemapper -v", "show version"),
2917
# diff context mode
3018
("", ""),
3119
("# diff context mode (requires git repo):", ""),
3220
("treemapper . --diff HEAD~1", "context for last commit"),
3321
("treemapper . --diff main..feature", "context for feature branch"),
34-
("treemapper . --diff HEAD~1 --budget 30000", "limit diff context to ~30k tokens"),
35-
("treemapper . --diff HEAD~1 --full", "all changed code, no smart selection"),
22+
("treemapper . --diff HEAD~1 --budget 30000", "limit to ~30k tokens"),
3623
("treemapper . --diff HEAD~1 -c", "diff context to clipboard"),
3724
]
3825

0 commit comments

Comments
 (0)