Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lig/todo-md
`todo-md` is a small pre-commit hook implemented in Bash that maintains `TODO.md` file in your repo
https://github.com/lig/todo-md
devtools pre-commit pre-commit-hook todo
Last synced: 19 days ago
JSON representation
`todo-md` is a small pre-commit hook implemented in Bash that maintains `TODO.md` file in your repo
- Host: GitHub
- URL: https://github.com/lig/todo-md
- Owner: lig
- License: mit
- Created: 2025-01-09T23:45:12.000Z (29 days ago)
- Default Branch: main
- Last Pushed: 2025-01-10T09:23:19.000Z (29 days ago)
- Last Synced: 2025-01-18T15:50:35.151Z (21 days ago)
- Topics: devtools, pre-commit, pre-commit-hook, todo
- Language: Shell
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TODO.md Pre-Commit Hook
`todo-md` is a pre-commit hook written in Bash that automatically maintains a `TODO.md` file in your repository. It collects `TODO:` comments from your code and organizes them into a markdown file, making it easy to track tasks and improvements.
## Features
- Automatically scans your staged files for `TODO:` comments.
- Updates `TODO.md` with references to the files, line numbers, and corresponding comments.
- Removes outdated entries from `TODO.md` when tasks are removed from the code.
- Uses Forge (e.g. Codeberg or GitHub) style `#L` links that work in a Forge UI.
- Uses IDE style `:` text for links that are being recognized in terminal output by most of IDEs.## Usage
### Installation
1. Install [pre-commit](https://pre-commit.com/).
2. Add the following to your `.pre-commit-config.yaml`:
```yaml
repos:
- repo: https://codeberg.org/lig/todo-md.git
rev: v1.0.2
hooks:
- id: todo-md
```3. Install the hook by running:
```bash
pre-commit install
```### How It Works
- The hook scans all staged files for lines containing `TODO:` comments.
- For each `TODO:` comment, it extracts:
- The file name
- The line number
- The comment text
- It updates `TODO.md` in the root of the repository with entries in the format:```markdown
* [path/to/file:](path/to/file#L): The TODO comment text
```- Outdated entries (corresponding to removed `TODO:` comments) are removed automatically.
### Example
Given the following code in a staged file:
```python
...
# TODO: Refactor this function
def example():
pass
````TODO.md` will be updated as:
```markdown
* [path/to/file:2](path/to/file#L2): Refactor this function
```See [TODO.md in this repo](TODO.md) for the real one. :)
## Contributing
Contributions are welcome! Feel free to submit issues or pull requests to the project repository: [todo-md on Codeberg](https://codeberg.org/lig/todo-md).
## License
This project is licensed under the [MIT License](LICENSE).