README.md

  1<!--
  2SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
  3
  4SPDX-License-Identifier: CC0-1.0
  5-->
  6
  7# formatted-commit
  8
  9<!--[![REUSE status](https://api.reuse.software/badge/git.secluded.site/formatted-commit)](https://api.reuse.software/info/git.secluded.site/formatted-commit)-->
 10
 11[![Go Report Card](https://goreportcard.com/badge/git.secluded.site/formatted-commit)](https://goreportcard.com/report/git.secluded.site/formatted-commit)
 12
 13CLI tool that requires conformance with the Conventional Commits specification
 14through flags, made for LLMs and not really for the operators (but I guess you
 15can use this directly if you want). Operators would likely prefer, as the author
 16does, [meteor](https://github.com/stefanlogue/meteor).
 17
 18`formatted-commit` enforces a 50-character subject limit and sanitises/wraps the body at 72
 19characters. I might make that configurable. Idk. It's a loose standard held by
 20projects like the Linux kernel and I try to stick to it.
 21
 22## Installation
 23
 24As this is mostly meant for agentic coding tools, you'll need one. I like [Crush
 25💘](https://github.com/charmbracelet/crush) (and maintain [a
 26fork](https://git.secluded.site/crush)) or [OpenCode](https://opencode.ai/) as
 27the best more-open options and [Amp](https://ampcode.com/) as the overall best
 28option if you don't mind completely proprietary and paying for 100% of your API
 29usage.
 30
 31You may install `formatted-commit` manually using the following command. You may
 32also skip this and just add the prompt snippet; it tells the model about the
 33command so it can try to run it on its own or ask you to run it.
 34
 35```bash
 36go install git.secluded.site/formatted-commits@latest
 37```
 38
 39Copy/paste this into wherever you tell your models how to write commits. For
 40Crush, that might be `~/.config/crush/CRUSH.md` or `./CRUSH.md` in a repo. For
 41[my Crush fork](https://git.secluded.site/crush) and Amp, that's
 42`~/.config/AGENTS.md`. Look up where your tool checks for rules files and put
 43this in a section like `## Creating git commits` or something.
 44
 45```markdown
 46Create commits exclusively using `formatted-commit`. Try to use it normally, but if it's not in my PATH, ask me to `go install git.secluded.site/formatted-commit@latest`. It has no sub-commands and the following options:
 47<formatted-commit_flags>
 48-t --type Commit type (required)
 49-s --scope Commit scope (optional)
 50-B --breaking Mark as breaking change (optional)
 51-m --message Commit message (required)
 52-b --body Commit body (optional)
 53-T --trailer Trailer in 'Sentence-case-key: value' format (optional, repeatable)
 54-h --help
 55</formatted-commit_flags>
 56<formatted-commit_example>
 57formatted-commit -t feat -s "web/git-bug" -m "do a fancy new thing" -T "Crush <crush@charm.land>" -b "$(cat <<'EOF'
 58Multi-line
 59
 60- Body
 61- Here
 62
 63EOF
 64)"
 65</formatted-commit_example>
 66```
 67
 68## Contributions
 69
 70Patch requests are in [amolith/llm-projects] on [pr.pico.sh]. You don't need a
 71new account to contribute, you don't need to fork this repo, you don't need to
 72fiddle with `git send-email`, you don't need to faff with your email client to
 73get `git request-pull` working...
 74
 75You just need:
 76
 77- Git
 78- SSH
 79- An SSH key
 80
 81```sh
 82# Clone this repo, make your changes, and commit them
 83# Create a new patch request with
 84git format-patch origin/main --stdout | ssh pr.pico.sh pr create amolith/llm-projects
 85# After potential feedback, submit a revision to an existing patch request with
 86git format-patch origin/main --stdout | ssh pr.pico.sh pr add {prID}
 87# List patch requests
 88ssh pr.pico.sh pr ls amolith/llm-projects
 89```
 90
 91See "How do Patch Requests work?" on [pr.pico.sh]'s home page for a more
 92complete example workflow.
 93
 94[amolith/llm-projects]: https://pr.pico.sh/r/amolith/llm-projects
 95[pr.pico.sh]: https://pr.pico.sh
 96
 97## Usage
 98
 99```text
100$ formatted-commit -h
101
102  formatted-commit helps you create well-formatted Git commits that follow
103  the Conventional Commits specification with proper subject length validation,
104  body wrapping, and trailer formatting.
105
106  USAGE
107
108
109    formatted-commit [--flags]
110
111
112  EXAMPLES
113
114
115    # With co-author
116    formatted-commit -t feat -m "do a thing" -T "Crush <crush@charm.land>"
117
118    # Breaking change with longer body
119    formatted-commit -t feat -m "do a thing that borks a thing" -B "$(cat <<'EOF'
120    Multi-line
121    - Body
122    - Here
123
124    This is what borked because of new shiny, this is how migrate
125    EOF
126    )"
127
128    # Including scope for more precise changes
129    formatted-commit -t refactor -s "web/git-bug" -m "fancy shmancy" \
130      -b "Had to do a weird thing because..."
131
132
133  COMMANDS
134
135    help [command]  Help about any command
136
137  FLAGS
138
139    -b --body       Commit body (optional)
140    -B --breaking   Mark as breaking change (optional)
141    -h --help       Help for formatted-commit
142    -m --message    Commit message (required)
143    -s --scope      Commit scope (optional)
144    -T --trailer    Trailer in 'Sentence-case-key: value' format (optional, repeatable)
145    -t --type       Commit type (required)
146    -v --version    Version for formatted-commit
147```