npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

code-agent-auto-commit

v1.5.0

Published

CAC provides configurable AI auto-commit(using your git account) for OpenCode, Claude Code, Codex, and other AI code agents

Readme

code-agent-auto-commit

code-agent-auto-commit (cac) provides configurable code-agent-end auto-commit(using your git account) for:

  • OpenCode
  • Claude Code
  • OpenAI Codex CLI

Features

  • Auto-commit when a chat/agent turn ends
  • Commit strategies:
    • single: all changed files in one commit
    • per-file: one file per commit
  • AI-generated commit messages with multi-provider model configuration
    • OpenAI-compatible mode (openai-completions)
    • Anthropic-compatible mode (anthropic-messages)
  • Optional auto-push to GitHub, GitLab, or generic remotes
  • Tool installers for OpenCode, Codex, and Claude Code

Installation

pnpm add -g code-agent-auto-commit@latest

To update to the latest version:

pnpm update -g code-agent-auto-commit
OR:
pnpm add -g code-agent-auto-commit@latest

Then use the short command:

cac --help

Quick Start

# 1. Initialize config
cac init

# 2. Configure AI API key (pick one method):
#    Global (recommended — works across all projects):
cac ai set-key <provider|ENV_VAR> <api-key>
#    Or project-level (edit .cac/.env):
echo 'MINIMAX_API_KEY=sk-xxx' >> .cac/.env

# 3. Install hooks
cac install --tool all --scope project

# 4. Verify
cac status --scope project
cac ai "hello"

# 5. Agentic coding
opencode / claude / codex

Important: After cac init, you must configure an AI provider API key. Without a valid key, AI commit messages will not work and cac falls back to generic chore(auto): ... prefixed messages.

Model tip: Choose a fast, lightweight model (e.g. gpt-4.1-mini, MiniMax-M2.5-highspeed). Commit messages are short — speed matters more than intelligence here.

Commands

cac init [--worktree <path>] [--config <path>]
cac install [--tool all|opencode|codex|claude] [--scope project|global] [--worktree <path>] [--config <path>]
cac uninstall [--tool all|opencode|codex|claude] [--scope project|global] [--worktree <path>]
cac status [--scope project|global] [--worktree <path>] [--config <path>]
cac run [--tool opencode|codex|claude|manual] [--worktree <path>] [--config <path>] [--event-json <json>] [--event-stdin]
cac set-worktree <path> [--config <path>]
cac ai <message> [--config <path>]
cac ai set-key <provider|ENV_VAR> <api-key> [--config <path>]
cac ai get-key <provider|ENV_VAR> [--config <path>]

Command Details

  • cac init: creates .cac/.code-agent-auto-commit.json under the worktree (unless --config is provided), and also writes .cac/.env.example and .cac/.env with default provider API key env vars.
  • cac install: installs adapters/hooks for selected tools (opencode, codex, claude) in project or global scope. If no config exists at the resolved path, it creates one first.
  • cac uninstall: removes previously installed adapters/hooks for selected tools and scope.
  • cac status: prints resolved config path, worktree, commit mode, AI/push toggles, and install status of each adapter.
  • cac run: executes one auto-commit pass (manual or hook-triggered). It reads config, filters changed files, stages/commits by configured mode, and optionally pushes. Hook-triggered runs also write logs to .cac/run-<timestamp>.log.
  • cac set-worktree: updates only the worktree field in the resolved config file.
  • cac ai: tests AI request (cac ai "hi") or manages global keys (set-key / get-key).

Config File

Default project config file:

.cac/.code-agent-auto-commit.json

Generated env templates:

  • .cac/.env.example
  • .cac/.env

You can copy from:

.code-agent-auto-commit.example.json

Full schema and options:

  • doc/CONFIG.md
  • doc/zh-CN.md

AI Key Resolution

cac resolves API keys automatically in this order (first match wins):

  1. process.env — environment variable already set in the current shell
  2. ~/.config/code-agent-auto-commit/keys.env — global keys file (written by cac ai set-key)
  3. .cac/.env — project-level env file (created by cac init)
  4. ai.providers.<name>.apiKey — key stored directly in config (not recommended)

This means hooks work out of the box — no need to manually source .cac/.env before running. If AI request fails (missing key, invalid provider/model, or non-2xx response), cac falls back to commit.fallbackPrefix-style messages.

AI Models (Multi-Provider)

Model format follows provider/model (OpenClaw-style). Example:

{
  "ai": {
    "enabled": true,
    "model": "openai/gpt-4.1-mini",
    "defaultProvider": "openai",
    "providers": {
      "openai": {
        "api": "openai-completions",
        "baseUrl": "https://api.openai.com/v1",
        "apiKeyEnv": "OPENAI_API_KEY"
      },
      "anthropic": {
        "api": "anthropic-messages",
        "baseUrl": "https://api.anthropic.com/v1",
        "apiKeyEnv": "ANTHROPIC_API_KEY"
      },
      "moonshot": {
        "api": "openai-completions",
        "baseUrl": "https://api.moonshot.ai/v1",
        "apiKeyEnv": "MOONSHOT_API_KEY"
      }
    }
  }
}

Integration Notes

  • OpenCode: installs plugin under .opencode/plugins/ or ~/.config/opencode/plugins/
  • Codex CLI: writes managed notify block in .codex/config.toml or ~/.codex/config.toml
  • Claude Code: installs Stop hook in .claude/settings.json or ~/.claude/settings.json

If Codex config already has a custom notify = ..., installer stops and asks for manual merge.

Development

pnpm install
pnpm run typecheck
pnpm run build
pnpm test

Open Source

  • Contribution guide: CONTRIBUTING.md
  • Security policy: SECURITY.md
  • Code of conduct: CODE_OF_CONDUCT.md

License

MIT