This document provides guidance for developers working on the Oldest TODO Finder project.
- Rust (latest stable version)
- Git
- ripgrep
- An IDE with Rust support (VS Code with rust-analyzer recommended)
-
Clone the repository
git clone https://github.com/yourusername/oldest-todo-finder.git cd oldest-todo-finder -
Install dependencies Make sure you have Git and ripgrep installed on your system.
-
Build the project in development mode
cargo build
-
Run tests
cargo test --workspace
.
├── blame_finder/ # Library crate for git/todo functionality
│ ├── src/
│ │ ├── lib.rs # Main library entry points
│ │ ├── repo.rs # Repository management
│ │ ├── todo.rs # TODO finding logic
│ │ ├── blame.rs # Git blame analysis
│ │ └── error.rs # Error definitions
│ ├── examples/ # Example CLI applications
│ └── Cargo.toml # Library dependencies
├── src/ # Web server application
│ ├── main.rs # Server entry point
│ └── templates.rs # HTML templating
├── static/ # Static assets
│ └── css/
│ └── styles.css # Styling for the web UI
└── Cargo.toml # Main application dependencies
- Repository Module: Handles cloning and updating Git repositories
- Todo Module: Uses ripgrep to find TODO comments in repositories
- Blame Module: Uses Git blame to determine when TODOs were added
- Error Module: Error types for the library
- Main: Sets up the Axum server and routes
- Templates: Generates HTML responses for the web UI
To add support for additional comment types (like "FIXME" or "XXX"):
-
Modify
blame_finder/src/todo.rsto search for additional patterns:let output = Command::new("rg") .current_dir(repo.path()) .arg("TODO|FIXME|XXX") // Add additional patterns here .arg("--line-number") // ...
-
Update the UI to reflect these changes in
src/templates.rs.
The current implementation primarily targets GitHub, but can be extended:
- Update URL parsing in
blame_finder/src/repo.rsto support more hosts:if !["github.com", "gitlab.com", "bitbucket.org", "your-new-host.com"].contains(&host) { // ... }
-
"Command not found" errors:
- Ensure
gitandrg(ripgrep) are installed and in your PATH
- Ensure
-
Permission Issues:
- Check that your application has permission to create directories in the user's home folder
-
ripgrep Pattern Issues:
- Try running the ripgrep command manually to debug pattern matching problems
The application uses tracing for logging. You can set the log level using the RUST_LOG environment variable:
RUST_LOG=debug cargo runIf you need to improve performance:
-
Limit Repository Depth:
- Adjust the git clone depth in
repo.rsto balance history availability with performance
- Adjust the git clone depth in
-
Add More File Filters:
- Modify the ripgrep file filters to focus on relevant file types
-
Add Caching:
- Implement a caching layer for repository results
For deploying to production:
-
Build the release version:
cargo build --release
-
Setup the static directory: Ensure the
staticdirectory is accessible to the running application. -
Configure port: The application reads the
PORTenvironment variable (default: 3000). -
Setup automatic cleanup: The application handles cleanup itself, but you might want to add additional system-level cleanup as a fallback.