Durai
Durai is a command-line utility designed to scan codebases for specific keywords in comments (like TODO and FIXME) and consolidate them into grouped lists.
Installation
For Non-Haxe Users (Standalone):
- Download the latest pre-compiled binary (e.g.,
durai.exeordurai.n) from the GitHub Releases page. - Place the file in a directory of your choice.
- (Optional) Add that directory to your system's
PATHto run theduraicommand globally.
For Haxe Users:
haxelib install durai
Once installed, you can run it from anywhere using:
haxelib run durai
Updating
To update Durai to the latest version via haxelib, run:
haxelib update durai
If you built the project from source, pull the latest changes from the repository and rebuild the executable:
git pull
haxe build.hxml
Usage
The Durai CLI provides several commands to manage your keywords and run scans.
Scanning Code
To run the utility and scan the current directory (and its subdirectories) for keywords:
durai
(or durai run)
(If you installed via haxelib, use haxelib run durai)
The utility will recursively scan the current directory and its subdirectories, extracting any comments containing the tracked keywords (e.g., TODO, FIXME) and printing them to the console grouped by keyword.
Example Output:
TODO
src/Main.hx:12 refactor this to use the new API
src/utils/Parser.hx:45 add support for edge cases
FIXME
src/Durai.hx:112 memory leak when loading large files
For a web based output you'll notice that a directory called durai/ has been created within
your project. Inside is an index.html file with some simple tables showing your results.
Managing Keywords
You can dynamically add or remove keywords that Durai tracks for your project without needing to modify the source code. These are saved in a local .durai.json file.
Add a keyword:
durai add <keyword>
Example: durai add BUG
Remove a keyword:
durai remove <keyword>
Example: durai remove BUG
List current keywords:
durai list
Supported Languages
Durai is language-agnostic in its approach to parsing comments, but is specifically optimized to target the following languages out of the box:
- Ruby (
.rb) - Python (
.py) - C/C++ (
.c,.cpp,.h,.hpp,.cc,.cxx) - Go (
.go) - Rust (
.rs) - JavaScript / TypeScript (
.js,.ts,.jsx,.tsx) - Haxe (
.hx)
Default Keywords
By default, Durai searches your codebase comments for the following keywords:
TODOFIXMENOTEBUG
Any text following these keywords on the same line (including separators like : or -) will be cleanly extracted and included in the final grouped output.
Adding Custom Keywords
If you want to track additional annotations (such as NOTE, BUG, or HACK), you can easily add them using the CLI:
durai add BUG
Tests
This project uses utest for unit testing. To run the test suite, ensure you have the library installed:
haxelib install utest
Then, execute the tests using the provided Haxe build file:
haxe test.hxml