appleboy/CodeGPT

A CLI written in Go language that writes git commit messages or do a code review brief for you using ChatGPT AI (gpt-4.1, gpt-4o model) and automatically installs a git prepare-commit-msg hook.

What is CodeGPT?

CodeGPT is a command‑line tool (written in Go) that talks to large‑language‑model APIs (OpenAI, Azure OpenAI, Gemini, Anthropic, Ollama, Groq, OpenRouter) to help developers with two everyday Git tasks:

  1. Generate commit messages – it reads the git diff of your staged changes, sends the diff to the chosen LLM, and returns a commit message that follows the Conventional Commits format. The tool can also install a prepare‑commit‑msg Git hook so the AI‑generated message is automatically inserted when you run git commit.
  2. Summarize code reviews – it can produce a short review of the changes in a pull‑request‑style summary.

Both features support streaming output (tokens appear as they are generated), language translation (English, Traditional‑Chinese, Simplified‑Chinese, Japanese), and custom prompt templates.


How do you get it?

  • macOSbrew tap appleboy/tap && brew install codegpt
  • Windowschoco install codegpt
  • Any OS – run the provided install script or download a pre‑compiled binary from the GitHub releases page.
  • From sourcego install github.com/appleboy/CodeGPT/cmd/codegpt@latest
  • VS Code devcontainer – add the ghcr.io/kvokka/features/codegpt feature to devcontainer.json.

How does it work?

  1. Configuration – You supply an API key (or a command that fetches one dynamically) via an environment variable, a .codegpt.yaml file, or the built‑in API‑key helper feature. The config file lives under $HOME/.config/codegpt/ and lets you set:
    • Provider (openai, azure, gemini, anthropic, ollama, groq, openrouter)
    • Base URL, model name, temperature, max‑tokens, proxy settings, etc.
    • Git‑specific options like how many context lines to include in the diff and which files to exclude.
  2. Running the CLIcodegpt commit (or codegpt review) reads the diff, builds a prompt from the selected template, calls the LLM endpoint, and prints the result. With the --stream flag you see the response token‑by‑token.
  3. Git hookcodegpt hook install writes a prepare‑commit‑msg script that invokes the CLI automatically, so every git commit can be auto‑filled with an AI‑generated message.

Who might find it useful?

  • Developers who want consistent, conventional commit messages without manually writing them.
  • Teams that need quick, readable summaries of code changes for pull‑request descriptions or internal reviews.
  • Anyone who works with multiple LLM providers (e.g., prefers Azure OpenAI for compliance or wants to run locally with Ollama) – CodeGPT abstracts the provider behind a single CLI.

What are its limits?

  • It is a client only; the quality of the generated text depends entirely on the underlying model you point it at.
  • The tool needs internet access (or a local Ollama server) and a valid API key for the chosen provider.
  • It does not perform any static analysis or linting – it merely forwards the diff to the model.
  • The Git hook inserts the AI text verbatim; you should still review the message before finalising the commit.

Quick start example

# Install (macOS example)
brew tap appleboy/tap && brew install codegpt

# Export your OpenAI key (or configure it via `codegpt config set`)
export OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx

# Generate a commit message for staged changes
codegpt commit

# Or install the hook so `git commit` does it automatically
codegpt hook install

Where to learn more?


All information above is taken directly from the project's README; no additional features have been inferred.

Related

  • Project
  • Project
  • Project
  • Project
  • Project