AI-powered command line utilities for working with Git repositories.
gitai is a small Python CLI for repo workflows that benefit from LLMs. It is
designed to be installed as a global uv tool and run from any repository on
the machine.
From this checkout:
uv tool install .During development:
uv run gitai --helpAfter a global install, refresh the tool from this checkout with:
uv tool install . --reinstallgitai uses LiteLLM, so model names follow LiteLLM provider conventions.
You can configure a provider interactively:
gitai setup
gitai setup --provider gemini
gitai setup --provider openai --model openai/gpt-5
gitai setup --provider anthropicThe setup command uses interactive prompts for any missing values. It asks for the API key securely, shows a searchable list of known LiteLLM chat models for the provider, validates the key with the selected model, and only saves the configuration if validation succeeds.
This writes ~/.gitai/config.json with owner-only file permissions where the
operating system supports them. The file stores provider API keys and default
models:
{
"default_provider": "gemini",
"providers": {
"gemini": {
"api_key": "...",
"model": "gemini/gemini-2.5-flash"
}
}
}Environment variables are also supported and take precedence over saved config:
export GEMINI_API_KEY=...
export OPENAI_API_KEY=...
export ANTHROPIC_API_KEY=...For Gemini, GOOGLE_API_KEY is also accepted.
Use .env.example as a template if you prefer local environment files. Do not
commit real API keys.
Save provider credentials in ~/.gitai/config.json.
gitai setup
gitai setup --provider gemini
gitai setup --provider openai --api-key sk-... --model openai/gpt-5Use --skip-validation only when you need to save config while offline or when
the provider endpoint is temporarily unavailable.
Generate a Conventional Commit message from the current repository diff.
gitai commit
gitai commit --staged
gitai commit --length short
gitai commit --length long
gitai commit --provider openai --model openai/gpt-5
gitai commit --apply
gitai commit --apply --yesBy default, gitai commit prints the generated message and does not create a
commit. Use --apply to run git commit -F - with the generated message.
The default --length long output includes a title plus body details.
Use --length short to generate only the Conventional Commit title.
Diff selection:
--stagedrequires staged changes and summarizesgit diff --cached.- Without
--staged, staged changes are preferred when present. - If nothing is staged, unstaged tracked-file changes are summarized.
Generated commit titles are validated against the Conventional Commits format:
type(optional-scope): imperative subject
Allowed types are build, chore, ci, docs, feat, fix, perf,
refactor, revert, style, and test.
Install dependencies and run the local CLI with uv:
uv sync
uv run gitai --helpRun the repository checks:
make checkBuild the package artifacts:
make buildBuild the documentation site:
make docsDocumentation source lives in mkdocs/. Generated HTML is written to docs/.
Do not commit provider API keys. Prefer gitai setup, which stores keys in
~/.gitai/config.json with owner-only permissions where supported, or use local
environment variables from an untracked .env file.
No license has been selected yet. Choose and add a LICENSE file before making
the repository public.