This repository contains developer tools that help teams work faster with AI hosted by mittwald in Germany.
mittwald AI hosting is especially useful for developer workflows that need:
- short feedback loops during coding
- reliable automation for continuous integration
- GDPR-aware, Germany-hosted infrastructure for AI-assisted development
AI-powered, well-formed git commit message generation based on your staged changes.
Good commit messages are important but easy to postpone. AI-assisted generation helps you:
- keep commit history understandable and review-friendly
- consistently follow the Conventional Commits format
- reduce time spent writing commit text
- improve consistency across contributors
The installer script sets up and configures cmai so commit messages can be generated using mittwald AI.
See https://github.com/mrgoonie/cmai for more details.
The installer shows each change before it applies the change:
- Installs the latest
cmai, ifcmaiis missing or too old. If this installer or the install script ofcmaiinstalledcmai, a newer version replaces it:cmaihas no version number, so the installer compares the installed script with the latest one. The installer first checks the downloaded script for content thatcmaihas no need for, such as unknown hosts or encoded code, and asks before it installs a script with such content. A newer version with such content does not replace the installedcmai, and a failed download keeps it. This check is a heuristic, not a guarantee. The installer needssudoonly if it cannot write the link/usr/local/bin/cmaiitself. - Asks for your mittwald AI API key, or takes the key from
MITTWALD_AI_API_KEY, and stores the key (see Where the API key is stored). - Configures
cmaito use mittwald AI. - Installs a
prepare-commit-msghook into your git template directory (default~/.git-templates). On Linux and macOS, the hook is in~/git-commit-ai/prepare-commit-msgand the template directory has a link to it.git initandgit clonecopy this link into a repository, so that an update of the hook reaches every repository. - Replaces copies of the hook from this installer with links, in the repository of the current directory and in the repositories below each directory of
--repos(see Update the hook in your repositories). On Windows, it updates these copies instead. - Optionally adds a snippet to your Vim config, so that
:qaborts the commit.
| System | Requirements |
|---|---|
| Linux | bash, git, curl, jq |
| macOS | git, curl and the bash of macOS; jq for example from brew install jq |
| Windows | Git for Windows; jq for example from winget install jqlang.jq |
On Windows, run the installer in Git Bash. The hook then works for every commit, also from PowerShell or an IDE. The installer puts cmai into ~/bin, which Git Bash has on its PATH.
The installer stores the API key in the keychain of your system, if both of these are true:
- Your system has a keychain that the installer can use: the macOS Keychain, the Windows Credential Manager, or on Linux a keyring with the
secret-toolcommand (GNOME Keyring, KWallet). - Your
cmaican take the API key from the environment variableCMAI_API_KEY. The hook reads the key from the keychain and passes it tocmaithis way, so that the key is never in a file.
Otherwise the key is in ~/.config/git-commit-ai/config, which only you can read. When you run the installer again and the two conditions are true, the installer moves the key from that file into the keychain.
To run cmai yourself with a key from the keychain, pass the key in the same way, for example on Linux:
CMAI_API_KEY="$(secret-tool lookup service git-commit-ai account api-key)" cmaicurl -fsSL https://github.com/mittwald/ai-developer-tools/raw/refs/heads/main/install-git-commit-ai.sh | bashOn Windows, run this command in Git Bash.
Make sure to run git init in your existing repository.
To read the script before you run it, download the script first:
curl -fsSLO https://github.com/mittwald/ai-developer-tools/raw/refs/heads/main/install-git-commit-ai.sh
less install-git-commit-ai.sh
bash install-git-commit-ai.shTo install or update without prompts, for example from a script, pass --non-interactive. Every step then takes its default answer. The default answer keeps an existing prepare-commit-msg hook from another source and does not install a cmai script with unexpected content. In both cases the installer stops.
curl -fsSL https://github.com/mittwald/ai-developer-tools/raw/refs/heads/main/install-git-commit-ai.sh | bash -s -- --non-interactivegit init does not replace a hook that a repository already has. A repository with a copy of the hook from an older installer keeps that copy. To replace these copies with links to the hook, pass the directories with your repositories to --repos:
curl -fsSL https://github.com/mittwald/ai-developer-tools/raw/refs/heads/main/install-git-commit-ai.sh | bash -s -- --repos ~/workspaceThe installer looks for repositories up to 5 levels below each directory. It changes only hooks from this installer. A repository without the hook, with a hook from another source, or with its own core.hooksPath stays as it is.
To link the hook in one repository, run this command in the repository:
ln -sf ~/git-commit-ai/prepare-commit-msg "$(git rev-parse --git-path hooks)/prepare-commit-msg"On Windows, copy the hook instead:
cp ~/.git-templates/hooks/prepare-commit-msg "$(git rev-parse --git-path hooks)/"- Run
git initin your existing repository, if not done already. - Stage your changes (
git add ...). - Commit your changes, omitting the commit message (
git commit). cmaiuses mittwald AI to generate a commit message.- Review and adjust the message if needed in your editor.
- 🥳
- The hook sends the diff of your staged changes to mittwald AI. Do not stage secrets.
- The hook never blocks a commit. It tries up to 3 times, with time limits of 30, 45 and 68 seconds. If the generation fails, the hook prints the reason and your editor opens without a generated message.
- While you wait, the hook shows a status line such as
1/3 Reading between the hunks.... The bold, fully colored part of the line grows with the elapsed share of the time limit. When the message is ready, the line becomesReading between the hunks... Read it all.. SetNO_COLOR=1for plain text. - Press
Ctrl-Cto stop the generation and the commit.
This repository is intended as a collection point for developer productivity tooling around mittwald AI hosting.
Check back later.
Please use this project's issue tracker to report specific suggestions or issues.
For security-related issues, please refrain from using the public issue tracker or discussion board. Have a look at the security policy, instead.
Also, please note that the issue tracker is not a support channel for mittwald's hosting products. Please use our regular support options to receive product support.
We are happy to accept external contributions to our documentation. See the Contribution guide for more information.