This file provides guidance to agents when working with code in this repository.
npm run build # bundles bin/cli.ts β dist/cli.mjs via tsdown with minification
npm run lint # oxlint
npm run lint:fix # oxlint --fix
npm run fmt # oxfmt
npm run fmt:check # oxfmt --check
npm run check-types # tsc --noEmit
npm test # vitest runacai is an opinionated CLI tool that generates git commit messages using already-installed AI tools (Claude Code, OpenAI Codex).
- Preflight β verify git repo and selected provider CLI availability
- File staging β prompt user to stage files if nothing is staged (interactive multi-select grouped by status)
- Context gathering β collect staged diff, stat, file list, and last 10 commit messages (for style inference)
- Generation β spawn provider CLI subprocess with system prompt (commit history for style) and user prompt (diff/stat/files), parse response
- Review loop β user can accept, edit in
$EDITOR, revise with feedback (re-runs generation), copy to clipboard, or cancel
bin/cli.tsβ entry point and interactive flow orchestrator using@clack/promptssrc/providers.tsβ provider interface, registry (claude + codex),ensureProvider()andgenerateCommitMessage()functionssrc/prompts.tsβ shared prompt-building logic (buildSystemPrompt,buildUserPrompt) and intelligent diff truncation at hunk boundariessrc/git.tsβ git operations wrapper (diff, staging, commit via temp file to avoid shell escaping)src/args.tsβ CLI argument parsing vianode:util parseArgs; supports-p/--provider,-m/--model,-y/--yoloflags andACAI_PROVIDER/ACAI_MODELenv vars
- Commit messages are written via temp file (
git commit -F) rather than-mflag to avoid shell escaping issues - Diff truncation preserves whole hunks rather than cutting mid-hunk
- Commit style is inferred from repo history (system prompt includes recent commits) rather than hardcoded conventions
- Clipboard support detects platform: pbcopy (macOS), xclip/xsel (X11), wl-copy (Wayland)