Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
OpenSciMLPublic

About

Tiny AI-powered command line utilities for working with Git repositories.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

gitai

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.

Install

From this checkout:

uv tool install .

During development:

uv run gitai --help

After a global install, refresh the tool from this checkout with:

uv tool install . --reinstall

Configuration

gitai 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 anthropic

The 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.

Commands

gitai setup

Save provider credentials in ~/.gitai/config.json.

gitai setup
gitai setup --provider gemini
gitai setup --provider openai --api-key sk-... --model openai/gpt-5

Use --skip-validation only when you need to save config while offline or when the provider endpoint is temporarily unavailable.

gitai commit

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 --yes

By 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:

  • --staged requires staged changes and summarizes git 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.

Development

Install dependencies and run the local CLI with uv:

uv sync
uv run gitai --help

Run the repository checks:

make check

Build the package artifacts:

make build

Build the documentation site:

make docs

Documentation source lives in mkdocs/. Generated HTML is written to docs/.

Security

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.

License

No license has been selected yet. Choose and add a LICENSE file before making the repository public.

About

Tiny AI-powered command line utilities for working with Git repositories.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages