Todo Tree
A command-line tool to find and display TODO-style comments in your codebase, similar to the VS Code "Todo Tree" extension.
Features
- 🔍 Recursive directory scanning - Respects
.gitignorerules automatically - 🏷️ Configurable tags - TODO, FIXME, BUG, NOTE, HACK, XXX, WARN, PERF (and custom tags)
- 🌳 Tree view output - Beautiful hierarchical display grouped by file
- 📋 Multiple output formats - Tree, flat list, and JSON
- ⚙️ Configuration file support -
.todorcin JSON or YAML format - 🎨 Colored output - Priority-based coloring for different tag types
- 🔗 Clickable links - Terminal hyperlinks to file locations (where supported)
Installation
Using Cargo (Recommended)
From Source
# Clone the repository
# Build and install
Usage
The tool provides two binary names: todo-tree and tt (alias for quick access).
Basic Commands
# Scan current directory (default command)
# Scan a specific directory
# Scan with specific tags
# List all TODOs in flat format
# Show configured tags
# Show statistics
Command Reference
scan (default)
Scan directories for TODO-style comments and display in tree format.
)
)
)
)
)
list
List all TODO items in a flat format.
tags
Show or manage configured tags.
init
Create a new configuration file.
stats
Show statistics about TODOs in the codebase.
Global Options
These options apply to all commands:
Configuration
Create a .todorc.json or .todorc.yaml file in your project root:
JSON Format (.todorc.json)
YAML Format (.todorc.yaml)
tags:
- TODO
- FIXME
- BUG
- NOTE
- HACK
include:
- "*.rs"
- "*.py"
exclude:
- "target/**"
- "node_modules/**"
json: false
flat: false
no_color: false
Configuration Search Order
.todorcin the current directory.todorc.jsonin the current directory.todorc.yamlor.todorc.ymlin the current directory- Parent directories (recursive)
~/.config/todo-tree/config.json(global config)
Examples
Example 1: Basic Scan
)
)
)
)
)
Example 2: Group by Tag
)
)
)
)
)
)
Example 3: JSON Output
{
{
{
}
}
}
Example 4: Filter by Tag
)
Example 5: Include/Exclude Patterns
# Only scan Rust files
# Exclude test files
# Combine patterns
Example 6: Statistics
)
)
)
)
)
Supported Comment Styles
The tool recognizes TODO-style tags in various comment formats:
| Language | Comment Styles |
|---|---|
| C, C++, Rust, Go, Java, JavaScript, TypeScript | //, /* */ |
| Python, Ruby, Shell, YAML | # |
| HTML, XML | <!-- --> |
| SQL | --, /* */ |
| Lisp, Clojure | ; |
| Lua | -- |
Tag Formats Recognized
// TODO: Simple tag with colon
// TODO Simple tag without colon
// TODO(author): Tag with author
// todo: Case insensitive (by default)
Priority Levels
Tags are assigned priority levels for sorting and coloring:
| Priority | Tags | Color |
|---|---|---|
| Critical | BUG, FIXME, XXX | Red |
| High | HACK, WARN, WARNING | Yellow |
| Medium | TODO, PERF | Cyan |
| Low | NOTE, INFO, IDEA | Green |
Terminal Support
Clickable Links
The tool generates clickable hyperlinks (OSC 8) in supported terminals:
- iTerm2
- WezTerm
- Hyper
- VS Code Terminal
- GNOME Terminal (VTE 0.50+)
- Konsole
- Alacritty
Color Support
Colors are automatically enabled when outputting to a terminal. Use --no-color or set the NO_COLOR environment variable to disable.
Development
Building
Running Tests
Project Structure
src/
├── lib.rs # Library entry point with command implementations
├── main.rs # Binary entry point (todo-tree)
├── bin/
│ └── tt.rs # Binary entry point (tt alias)
├── cli.rs # Command-line argument parsing (clap)
├── config.rs # Configuration file handling
├── parser.rs # Regex-based tag detection
├── printer.rs # Output formatting (tree, flat, JSON)
└── scanner.rs # Directory traversal (ignore crate)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feat/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feat/amazing-feature) - Open a Pull Request
Acknowledgments
License
MIT License - see LICENSE for details.