Keep your code flowing
tbdflow
is a lightweight wrapper around Git that codifies an opinionated TBD workflow. It automates common tasks, encourages best practices like Conventional Commits, and helps maintain a clean and stable main
branch.
This tool is built around a specific philosophy of Trunk-Based Development:
commit
command is your everyday go-to. It automates pulling the latest changes, committing, and pushing directly to main
, promoting small, frequent integrations.This CLI isn’t a replacement for Git. You’ll still reach for raw git
when doing advanced work like rebasing, cherry-picking, or running git bisect
.
This tool is as a workflow assistant, tbdflow
encapsulates a repeatable, opinionated process to support your day-to-day development.
It offers three main benefits:
Consistency across the team Everyone follows the same steps for common tasks. Commits, branches, and releases are handled the same way every time, keeping your Git history clean and predictable.
Less to remember
No need to recall the exact flags or sequences (like pull --rebase
, merge --no-ff
, or commit message formats). The CLI handles that, so you can stay focused on writing code.
It supports “the TBD way” This tool makes the preferred approach easy by providing a smooth, safe, and efficient path for 80% of everyday tasks. For the other 20%, you can always use Git directly.
You need Rust and Cargo installed.
The easiest way to install tbdflow
is to download it from crates.io. You can do it using the following command:
cargo install tbdflow
If you want to update tbdflow
to the latest version, execute the following command:
tbdflow update
tbdflow
is configurable via two optional files in the root of your repository. To get started quickly, run tbdflow init
to generate default versions of these files.
.tbdflow.yml
This file controls the core workflow of the tool. You can customise:
.dod.yml
This file controls the interactive Definition of Done checklist for the commit command.
To move beyond just automating process, tbdflow
integrates an optional pre-commit quality check. If a .dod.yml
file is present in your repository, the commit command will present an interactive checklist to ensure your work meets the team’s agreed-upon standards.
Example .dod.yml
:
# --- Interactive Checklist ---
checklist:
- "Code is clean, readable, and adheres to team coding standards."
- "All relevant automated tests (unit, integration) pass successfully."
- "New features or bug fixes are covered by appropriate new tests."
- "Security implications of this change have been considered."
- "Relevant documentation (code comments, READMEs, etc.) is updated."⏎
If you try to proceed without checking all items, the tool will offer to add a TODO list to your commit message footer, ensuring the incomplete work is tracked directly in your Git history.
If a .tbdflow.yml
file is present and contains a lint section, the commit command will automatically validate your commit message against the configured rules before the DoD check. This provides immediate feedback on stylistic and structural conventions.
Default linting rules:
lint:
conventional_commit_type:
enabled: true
allowed_types:
- build
- chore
- ci
- docs
- feat
- fix
- perf
- refactor
- revert
- style
- test
issue_key_missing:
enabled: false
pattern: ^[A-Z]+-\d+$
scope:
enabled: true
enforce_lowercase: true
subject_line_rules:
max_length: 72
enforce_lowercase: true
no_period: true
body_line_rules:
max_line_length: 80
leading_blank: true
Set up a new local repo
# Create a new local repo
mkdir tbd && cd tbd
tbdflow init
Default flow:
# A new feature
tbdflow commit -t feat -s auth -m "add password reset endpoint"
# A bug fix with a breaking change
tbdflow commit -t fix -m "correct user permission logic" -b
tbdflow commit -t refactor -m "rename internal API" --breaking --breaking-description "The `getUser` function has been renamed to `fetchUser`."
# A bug fix with a new tag
tbdflow commit -t fix -m "correct user permission logic" --tag "v1.1.1"
# Reference an issue
tbdflow commit -t feat -m "add feature x as part of bigger thing" --issue "ABC-123"
Exceptions a.k.a. branches
# Create a feature branch
tbdflow branch --type feat --name "user-profile-page"
# Create a release branch
tbdflow branch -t release -n "2.1.0"
# (This will be named "fix/PROJ-123-login-bug" by default)
tbdflow branch -t fix -n "login-bug" --issue "PROJ-123"
# Complete a feature branch
tbdflow complete -t feat -n "user-profile-page"
# Complete a release branch (this will be tagged v2.1.0)
tbdflow complete -t release -n "2.1.0"
tbdflow
has a couple of commands that can be beneficial to use but they are not part of the workflow, they are for inspecting the state of the repository.
# Does a pull, shows latest changes to main branch, and warns about stale branches.
tbdflow sync
# Checks the status of the working dir
tbdflow status
# Shows the current branch name
tbdflow current-branch
# Explicitly checks for local branches older than one day.
tbdflow check-branches
# Generate a CHANGELOG
tbdflow changelog --unreleased
# Do a dry run to see what git commands will be executed
tbdflow --dry-run sync
# Checks for a new version of tbdflow and updates it if available.
tbdflow update
To make tbdflow
even faster to use, you can enable shell completion. Add one of the following lines to your shell’s configuration file.
For Zsh (~/.zshrc
):
eval "$(tbdflow generate-completion zsh)"
For Bash (~/.bashrc
):
eval "$(tbdflow generate-completion bash)"
For Fish (~/.config/fish/config.fish
):
tbdflow generate-completion fish | source
You can generate a man page for tbdflow
by running the following command:
tbdflow generate-man-page > tbdflow.1
All development happens at tbdflow.git. Feedback and contributions welcome!