git-ca 0.2.3

git plugin that drafts commit messages using GitHub Copilot
.TH GIT-CA 1 "2026-05-06" "git-ca 0.2.3" "User Commands"
.SH NAME
git-ca \- draft git commit messages and pull request text with GitHub Copilot or OpenAI Codex
.SH SYNOPSIS
.B git ca
.RI [ OPTIONS ]
.RI [ COMMAND ]
.br
.B git-ca
.RI [ OPTIONS ]
.RI [ COMMAND ]
.SH DESCRIPTION
.B git-ca
is a Git subcommand that drafts commit messages and pull request text using
either GitHub Copilot or the OpenAI Codex (ChatGPT) backend. For commits it
reads the staged diff, asks the active backend for a Conventional Commits
message, writes the draft to Git's commit message file, and runs
.BR git-commit (1).
For pull requests it summarizes branch changes, asks the active backend for a
title and Markdown body, and runs
.BR gh-pr-create (1).
.PP
Git handles
.B git ca \--help
by opening this manual page. For clap-generated command help, use
.B git ca \-h
or
.BR "git-ca \--help" .
.SH OPTIONS
.TP
.BR \-n , " \--no-verify"
Skip pre-commit and commit-msg hooks.
.TP
.BI "\-m, \--model " MODEL
Use a specific model id for drafting. The id must be valid for the active
account's backend. Overrides the persisted default model.
.TP
.BR \-y , " \--yes"
Accept generated text without opening the editor. For commits, this commits
directly. For pull requests, this creates the pull request directly.
.TP
.BR \-h , " \--help"
Print command help when the binary is invoked directly or through
.BR "git ca \-h" .
.TP
.BR \-V , " \--version"
Print version information.
.SH COMMANDS
.TP
.BI "auth login [\--provider " PROVIDER "] [" ACCOUNT "]"
Log in via the chosen backend's OAuth flow. PROVIDER is
.B copilot
(GitHub device flow) or
.B codex
(ChatGPT OAuth via PKCE with a localhost callback on :1455 / :1457). When
.BI \--provider
is omitted on an interactive terminal,
.B auth login
prompts for a choice; when stdin is not a TTY (CI, piped input) it defaults
to
.BR copilot .
When ACCOUNT is provided, store credentials for that named account and make
it active.
.TP
.BI "auth set-token [--account " ACCOUNT "] " TOKEN
Store a GitHub token manually for a Copilot account and make it active.
The Codex backend is OAuth-only and not supported here. If ACCOUNT is not
provided, the token is stored under the default account.
.TP
.BI "auth use " ACCOUNT
Select the named account; the backend is determined by which provider that
account was logged in with.
.TP
.BI "auth logout [" ACCOUNT "]"
Delete locally stored tokens. When ACCOUNT is provided, only that named account
is removed.
.TP
.B auth status
Show local auth state, the active account's provider, all linked accounts, and
provider-specific token state (Copilot token TTL or ChatGPT account/last
refresh).
.TP
.B models
List available models for the active account's backend. For Copilot this hits
the live model-listing endpoint; for Codex (which has no listing endpoint)
this prints the known accepted slugs.
.TP
.BI "pr [\--base " BRANCH "] [\--source " diff|commits "]"
Draft a pull request title and Markdown body for the current branch, then run
.BR "gh pr create" .
When
.BI \--base
is omitted, the base branch is resolved from
.BR origin/HEAD ,
falling back to
.BR main .
The default source is the branch diff against the merge base; use
.B \--source commits
to summarize commit messages instead.
Use
.B \--yes
on this command to skip editor review and create the pull request directly.
Persisted PR auto-accept config has the same effect.
.TP
.B config list
Print all persisted config values.
.TP
.BI "config set-model " MODEL
Persist the default model. For Copilot accounts the id is validated against
the live model list; for Codex it is accepted verbatim because the backend
has no listing endpoint.
.TP
.B config get-model
Print the persisted default model, if any.
.TP
.BI "config set-auto-accept " true|false
Persist whether generated commit messages commit without opening the editor.
This setting does not apply to pull request creation.
.TP
.B config get-auto-accept
Print the persisted commit auto-accept setting.
.TP
.BI "config set-auto-accept-pr " true|false
Persist whether generated pull requests are created without opening the editor.
.TP
.B config get-auto-accept-pr
Print the persisted PR auto-accept setting.
.SH EXAMPLES
.TP
Draft a commit message and open the editor:
.B git ca
.TP
Draft with a specific model:
.B git ca \-m gpt-4o
.TP
Commit the generated message directly:
.B git ca \--yes
.TP
Draft a pull request against develop:
.B git ca pr \--base develop
.TP
Create the generated pull request directly:
.B git ca pr \--yes
.TP
Show clap-generated help instead of this manual page:
.B git ca \-h
.SH FILES
.TP
.I ~/.config/git-ca/config.json
User preferences, including default model and commit/PR auto-accept behavior.
.TP
.I ~/.config/git-ca/auth.json
Local credential cache. Each account is tagged with its provider; Copilot
accounts hold a GitHub token plus a cached Copilot API token, Codex accounts
hold ChatGPT access/refresh/id tokens and the linked account id.
.TP
.I ~/.config/git-ca/commit-system-prompt.md
Optional manually edited system prompt override for commit message drafts.
.TP
.I ~/.config/git-ca/pr-system-prompt.md
Optional manually edited system prompt override for pull request drafts. Custom
content must still instruct the model to return JSON with title and body.
.SH SEE ALSO
.BR git (1),
.BR git-commit (1),
.BR gh (1)