# git-coco

> git-coco — AI git commits, changelogs, code review, and PR/MR creation, plus a terminal workstation. Works on GitHub, GitHub Enterprise, GitLab, Bitbucket (Cloud and Server), and Gitea/Forgejo/Codeberg; supports OpenAI, Anthropic, Gemini, Mistral, Azure,

Latest version **0.96.0** (published 2026-12-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install git-coco
pnpm add git-coco
yarn add git-coco
bun add git-coco
```

Provides the command `coco`.

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; large bundle; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.96.0 |
| Published | 2026-12-03 |
| First published | 2023-07-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^22.22.2 \|\| ^24.15.0 \|\| >=26.0.0 |
| Dependencies | 29 |
| Unpacked size | 10.9 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | gfargo |
| Maintainers | gfargo |
| Keywords | git, git-coco, coco, ai, ai-commit, commit-message, conventional-commits, commitlint, changelog, code-review, pull-request, merge-request, github, github-enterprise, gitlab, glab, gh, multi-forge, ollama, local-llm, openai, anthropic, cli, tui, terminal, developer-tools, bitbucket, gitea, forgejo, codeberg |

## Links

- npm: https://www.npmjs.com/package/git-coco
- Repository: https://github.com/gfargo/coco
- Homepage: https://coco.griffen.codes
- Issues: https://github.com/gfargo/coco/issues
- npm.io page: https://npm.io/package/git-coco

## Dependencies (29)

- [ajv](https://npm.io/package/ajv.md) ^8.20.0
- [ini](https://npm.io/package/ini.md) 7.0.0
- [ink](https://npm.io/package/ink.md) 7.1.1
- [ora](https://npm.io/package/ora.md) 5.4.1
- [zod](https://npm.io/package/zod.md) 4.6.7
- [diff](https://npm.io/package/diff.md) 9.0.0
- [chalk](https://npm.io/package/chalk.md) 4.1.2
- [react](https://npm.io/package/react.md) 19.3.1
- [yargs](https://npm.io/package/yargs.md) 18.2.0
- [p-queue](https://npm.io/package/p-queue.md) 5.0.0
- [tiktoken](https://npm.io/package/tiktoken.md) ^1.0.21
- [minimatch](https://npm.io/package/minimatch.md) ^11.0.8
- [pretty-ms](https://npm.io/package/pretty-ms.md) 7.0.1
- [simple-git](https://npm.io/package/simple-git.md) 4.0.2
- [@langchain/aws](https://npm.io/package/@langchain/aws.md) ^1.4.5
- [@langchain/core](https://npm.io/package/@langchain/core.md) ^1.1.34
- [performance-now](https://npm.io/package/performance-now.md) 2.1.0
- [web-tree-sitter](https://npm.io/package/web-tree-sitter.md) ^0.27.0
- [@commitlint/core](https://npm.io/package/@commitlint/core.md) ^21.2.4
- [@inquirer/prompts](https://npm.io/package/@inquirer/prompts.md) 8.8.1
- [@langchain/ollama](https://npm.io/package/@langchain/ollama.md) ^1.2.7
- [@langchain/openai](https://npm.io/package/@langchain/openai.md) ^1.4.5
- [@langchain/classic](https://npm.io/package/@langchain/classic.md) 1.0.32
- [react-devtools-core](https://npm.io/package/react-devtools-core.md) 8.0.0
- [@langchain/anthropic](https://npm.io/package/@langchain/anthropic.md) ^1.5.11
- [@langchain/mistralai](https://npm.io/package/@langchain/mistralai.md) ^1.2.1
- [@langchain/google-genai](https://npm.io/package/@langchain/google-genai.md) ^2.1.31
- [@langchain/textsplitters](https://npm.io/package/@langchain/textsplitters.md) 1.0.2
- [@modelcontextprotocol/sdk](https://npm.io/package/@modelcontextprotocol/sdk.md) 1.32.2

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.96.0 (latest) — 2026-12-03
- 0.95.0 — 2026-12-02
- 0.94.0 — 2026-11-07
- 0.93.0 — 2026-11-02
- 0.92.0 — 2026-10-31
- 0.91.0 — 2026-08-16
- 0.90.0 — 2026-08-14
- 0.89.0 — 2026-08-13
- 0.88.0 — 2026-08-11
- 0.87.0 — 2026-08-08
- 0.86.0 — 2026-08-06
- 0.85.0 — 2026-08-02
- 0.84.1 — 2026-07-24
- 0.84.0 — 2026-07-24
- 0.83.1 — 2026-07-22
- … 162 more at https://npm.io/package/git-coco/versions

## README

![coco banner image](https://repository-images.githubusercontent.com/663130268/2fc2b7a1-2626-4f9a-9938-a5b410db1b0e)

# `coco`

[![NPM Version](https://img.shields.io/npm/v/git-coco.svg)](https://www.npmjs.com/package/git-coco)
[![NPM Downloads](https://img.shields.io/npm/dt/git-coco.svg)](https://www.npmjs.com/package/git-coco)
[![Last Commit](https://img.shields.io/github/last-commit/gfargo/coco)](https://github.com/gfargo/coco/tree/main)
[![Discord](https://img.shields.io/discord/1176716060825767948)](https://discord.gg/KGu9nE9Ejx)

**AI commits, changelogs, code review, PR creation, a structured agent/MCP API, and a full keyboard-driven git workstation — all from one CLI.** `coco commit` turns your staged diff into a Conventional-Commits-ready message. `coco commit --split` breaks a large staging area into logical multi-commit groups. `coco changelog` writes your release notes. `coco review` catches issues before they ship. `coco pr create` generates a title and body and opens it on your forge. `coco agent` and `coco mcp` expose the same generation engine to coding agents through versioned JSON and four local read-only MCP tools. And `coco ui` ties it all together in a terminal workstation with 16 views, chord navigation, and one-keystroke workflows. Seven AI providers — including fully local Ollama — on GitHub, GitHub Enterprise, GitLab, Bitbucket, and Gitea/Forgejo/Codeberg.

> The package is **git-coco**; the command is `coco`.

```bash
git add .
coco commit          # AI writes the message from your staged changes
```

![coco commit generating a commit message from staged changes](https://coco.griffen.codes/screenshots/readme-commit.gif)

That's the core. Everything else — changelogs, code review, PRs, and the workstation — is the same engine pointed at more of your git workflow.

![coco ui — a full terminal git workstation](https://coco.griffen.codes/screenshots/readme-workstation.gif)

## Why coco

- 🤖 **Smart commits** — contextual AI messages from your staged diff, with Conventional Commits and commitlint validation built in
- 🔌 **Agent-native** — versioned JSON/stdin operations plus four discoverable local MCP tools for commit drafts, reviews, changelogs, and recaps
- 🏠 **Local-first** — run fully offline with Ollama (no API costs, nothing leaves your machine)
- 🖥️ **Terminal workstation** — 16 views (history, status, diff, branches, PRs, issues, and more) via `g`-chord navigation + command palette
- 🌐 **Multi-forge** — GitHub, GitHub Enterprise, GitLab, Bitbucket (Cloud and Server), and Gitea/Forgejo/Codeberg from the same tool
- 🎨 **120+ themes** — Catppuccin, Gruvbox, Dracula, Tokyo Night, and many more, with a live picker (`gC`)
- 🩺 **Self-diagnosing** — `coco doctor` audits your config, providers, and model routing in one command

## Install

```bash
# Homebrew (macOS/Linux)
brew install gfargo/tap/coco

# curl
curl -fsSL https://coco.griffen.codes/install.sh | sh

# npm (needs Node 22+)
npm install -g git-coco

# try without installing
npx git-coco@latest init

# Docker (no Node install required)
docker run --rm -v "$PWD:/repo" -w /repo ghcr.io/gfargo/coco:latest commit
```

## Quick Start

```bash
coco init            # pick a provider, set preferences
git add .
coco commit -i       # generate your first commit (interactive)
```

## Commands

| Command | What it does |
|---------|-------------|
| [`coco commit`](https://github.com/gfargo/coco/wiki/Command-Reference#commit) | Generate commit messages from staged changes |
| [`coco commit --split`](https://github.com/gfargo/coco/wiki/Command-Reference#commit---split) | Break a large diff into logical multi-commit groups |
| [`coco amend`](https://github.com/gfargo/coco/wiki/Command-Reference#amend) | Regenerate and rewrite the last commit message |
| [`coco changelog`](https://github.com/gfargo/coco/wiki/Command-Reference#changelog) | Create changelogs from commit history (by branch, tag, or range) |
| [`coco pr create`](https://github.com/gfargo/coco/wiki/Command-Reference#pr-create) | Generate PR title + body and open via `gh` / `glab` / the Bitbucket or Gitea API |
| [`coco recap`](https://github.com/gfargo/coco/wiki/Command-Reference#recap) | Summarize recent changes for standups or handoffs |
| [`coco review`](https://github.com/gfargo/coco/wiki/Command-Reference#review) | AI code review with severity gating for CI (`--severity`) |
| [`coco watch`](https://github.com/gfargo/coco/wiki/Command-Reference#watch) | Continuously re-run review / commit-draft as changes settle, `--json` for editors |
| [`coco agent`](https://github.com/gfargo/coco/wiki/Agent-CLI-and-MCP) | Run commit-draft, review, changelog, or recap through versioned JSON/stdin |
| [`coco mcp`](https://github.com/gfargo/coco/wiki/Agent-CLI-and-MCP) | Start a local stdio MCP server with four read-only generation tools |
| [`coco ui`](https://github.com/gfargo/coco/wiki/Coco-UI) | Full-screen git workstation — 16 views, keyboard-driven |
| [`coco workspace`](https://github.com/gfargo/coco/wiki/Command-Reference#workspace) | Multi-repo overview; drill into any repo as a `coco ui` session |
| [`coco log`](https://github.com/gfargo/coco/wiki/Command-Reference#log) | Commit history with graph, filters, and JSON output |
| [`coco prs` / `coco issues`](https://github.com/gfargo/coco/wiki/Command-Reference#prs--issues) | List PRs or issues across GitHub, GitLab, Bitbucket, or Gitea/Forgejo |
| [`coco doctor`](https://github.com/gfargo/coco/wiki/Command-Reference#doctor) | Diagnose config, providers, model routing, and usage stats |
| [`coco init`](https://github.com/gfargo/coco/wiki/Getting-Started) | Interactive setup wizard |

Global flags: `--repo <dir>` targets any repo without `cd`, `--json` for machine output, `--quiet` suppresses chrome.

## Use coco in CI

The repo ships a composite GitHub Action (`action.yml`) that installs a pinned `git-coco` and runs a `coco` command, so you don't have to hand-roll the Node setup / `npm install -g` / severity-flag plumbing yourself:

```yaml
# .github/workflows/review.yml
name: coco review

on: pull_request

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0 # coco diffs against the base branch

      - id: coco
        uses: gfargo/coco@v1
        with:
          command: review --staged
          severity: 7 # fail the job if any finding is severity >= 7
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

      - name: Show findings
        if: always()
        run: echo '${{ steps.coco.outputs.findings }}' | jq '.'
```

The action's `severity` gate exits non-zero (failing the job) when a finding meets the threshold — it isn't swallowed. `outputs.findings` carries whatever the `coco` command wrote to stdout; with the default `json: true` on `coco review`, that's the `--json` findings array (`fromJSON(steps.coco.outputs.findings)` parses it downstream).

| Input | Default | Description |
|---|---|---|
| `command` | *(required)* | The `coco` subcommand and its args, e.g. `review --staged`, `lint`, `review --pr 42` |
| `version` | `latest` | `git-coco` npm version/dist-tag to install |
| `severity` | *(none)* | Forwarded as `--severity`. Numeric 1-10 for `review`, `error`\|`warning` for `lint` |
| `json` | `true` | Adds `--json --quiet` so `outputs.findings` is clean, machine-readable JSON |
| `args` | *(none)* | Extra raw args appended after severity/json, e.g. `--pr 42` |
| `repo` | *(checkout root)* | Forwarded as `--repo <dir>` to target a different directory |

coco reads provider credentials from the environment, same as local usage — supply `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` / etc. via the workflow's `env` or repo secrets; the action does not manage keys itself.

## Agent and MCP integration

Use `coco` directly from coding agents and IDEs without scraping interactive terminal output:

```bash
# Inspect the strict protocol-v1 schemas
coco agent schema --task review

# Run a one-shot structured operation
coco agent commit-draft --input request.json --repo /work/project

# Start the local stdio MCP server; it resolves the repository on each call
# from the tool input or the client's workspace roots
coco mcp

# Or pin it to one repository
coco mcp --repo /work/project
```

Both transports share typed `commit-draft`, `review`, `changelog`, and `recap` operations. They accept safe repository scopes or caller-supplied patches/summaries and return explicit success/failure envelopes. By default MCP tools never create commits, write repository files, post comments, or mutate a forge. Starting the server with `coco mcp --allow-write` additionally registers `coco_commit_apply`, an opt-in tool that commits the currently staged index (it never stages files itself and never pushes). When local usage stats are already enabled, calls add metadata-only `agent-cli`/`mcp` records to the user-cache ledger; prompts, diffs, and code are never recorded.

See **[Agent CLI and MCP](https://github.com/gfargo/coco/wiki/Agent-CLI-and-MCP)** for client setup, every parameter and schema, safety boundaries, examples, analytics, and troubleshooting.

## Git hooks

Get an AI-drafted message on every plain `git commit`, without typing `coco commit`.

**Native git hook** — `coco hooks install` writes a `prepare-commit-msg` hook that fills the message only when it's still empty (chaining to any existing hook first):

```bash
coco hooks install     # add the hook (--force to replace an existing one)
coco hooks status      # check what's installed
coco hooks uninstall   # remove it
```

**[pre-commit](https://pre-commit.com) framework** — repos already using `pre-commit` can pull in the same behavior via `.pre-commit-hooks.yaml`:

```yaml
repos:
  - repo: https://github.com/gfargo/coco
    rev: v0.89.0
    hooks:
      - id: coco-commit-msg
```

Pin `rev` to the latest coco release tag (`v0.89.0` or newer — run `pre-commit autoupdate` to resolve it automatically); tags before `v0.89.0` predate `.pre-commit-hooks.yaml` and won't resolve.

Both paths run `coco commit --print-message`'s draft-generation logic and fail open — a missing API key, a generation error, or `coco` being unavailable simply leaves the message file untouched rather than blocking the commit. Set `COCO_SKIP=1` to bypass either hook for a single commit.

## Configuration

```bash
coco init                    # interactive setup
coco init --scope project    # project-specific config
```

Seven providers out of the box — **OpenAI**, **Anthropic**, **Google Gemini**, **Mistral**, **Azure OpenAI**, **AWS Bedrock**, **Ollama** — plus any OpenAI-compatible endpoint. Keys read from config or environment (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, etc.).

```json
{
  "service": { "provider": "openai", "model": "gpt-4o" },
  "conventionalCommits": true
}
```

See the [Configuration Overview](https://github.com/gfargo/coco/wiki/Config-Overview) for every option — themes, per-task model routing, output modes, and more.

## Documentation

📚 **[Wiki](https://github.com/gfargo/coco/wiki)** — Getting Started, Command Reference, Configuration, Coco UI, Using Ollama, Team Collaboration, Troubleshooting

🤖 **[Agent CLI and MCP](https://github.com/gfargo/coco/wiki/Agent-CLI-and-MCP)** — structured operations, MCP client setup, schemas, safety, analytics, and troubleshooting

💬 **[Discord](https://discord.gg/KGu9nE9Ejx)** — real-time help and discussion

🐛 **[Issues](https://github.com/gfargo/coco/issues)** — bug reports and feature requests

## Contributing

We welcome contributions — see [CONTRIBUTING.md](CONTRIBUTING.md) to get started.

## Project Stats

![Repobeats](https://repobeats.axiom.co/api/embed/ea76b881139f16595a343046d4f2bc9125a47e26.svg "Repobeats analytics image")

## License

MIT © [gfargo](https://github.com/gfargo/)

<div align="center">
<img src="https://coco.griffen.codes/mascott/mascott_d.png" width="200px">
<p>Thanks for using <code>coco</code> ✨💜</p>
</div>

---
_Source: https://npm.io/package/git-coco · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
