Command reference
Every command and flag of the codeveto CLI, its exit codes and the environment variables it reads.
On this page
Commands
| Command | Does |
|---|---|
review |
Review a change and exit 0 clear, 1 vetoed, 2 incomplete. |
rules |
List the rules. |
explain |
Explain one rule. |
packets |
Write AI review packets (harness step 1). |
verify |
Verify AI responses (harness step 2). |
mcp |
Run the stdio MCP server. |
hook |
Install or remove a Git hook. |
init |
Write a CI workflow for a forge. |
publish |
Publish a report to a forge. |
version |
Print the CodeVeto version. |
codeveto --help and codeveto <command> --help print the same flags as this page. codeveto with no command prints the help and exits 2.
Revision flags
review, packets, verify and mcp take the same flags to choose what is compared. --base, --staged and --commit exclude each other; with none of them the mode is worktree.
| Flag | Mode | Compares |
|---|---|---|
| none | worktree | The trust anchor with the working tree: commits since the anchor plus staged, unstaged and untracked files. POSIX only in 0.1. |
--base REF |
range | REF with HEAD, or with --head. |
--head REF |
range | The head revision of a --base review. Needs --base. |
--comparison merge-base |
range | Head with the merge base of REF and head (the default). Needs --base. |
--comparison direct |
range | Head with REF itself. Needs --base. |
--staged |
staged | The index with HEAD: what git commit would record. |
--commit REF |
commit | One commit with its first parent (a root commit with the empty tree). |
--anchor OID |
any | Read configuration from this commit: a full 40- or 64-character commit ID, never a branch name or a short ID. |
--repo PATH |
any | The repository to review. Default .; required for mcp. |
Without --anchor, a range review reads configuration from the merge base (with direct, from REF), a commit review from the parent, and staged and worktree reviews from the local anchor described in Trust model.
review
codeveto review [--base REF [--head REF] [--comparison merge-base|direct] | --staged | --commit REF]
[--anchor OID] [--repo PATH] [--format text|json|sarif|markdown|github|agent]
[--output FILE] [--fail-on error|warning|note|never | --strict] [--config FILE]
[--no-repo-config] [--ai claude|openai|none] [--ai-model ID] [--ai-base-url URL]
[--ai-optional] [--ai-response-format json_schema|json_object|prompt]
[--color auto|always|never]| Flag | Default | Meaning |
|---|---|---|
--format |
text |
Output format: text, json, sarif, markdown, github or agent. See Output formats. |
--output FILE |
stdout | Write the output to FILE through a temporary file and a rename, so a reader never sees half a report. |
--fail-on LEVEL |
error |
The lowest severity that blocks: error, warning, note, or never (report only). |
--strict |
Same as --fail-on warning. Cannot be combined with --fail-on. |
|
--config FILE |
An extra trusted config file, applied after the user config. Refused when it lies inside the reviewed repository. | |
--no-repo-config |
Ignore the repository's .codeveto.toml. |
|
--ai PROVIDER |
none |
Run the AI pass with claude or openai, or turn it off with none. |
--ai-model ID |
provider default | The model ID. Claude defaults to claude-opus-5-5; openai has no default and needs this flag or [ai] model in user config. |
--ai-base-url URL |
provider default | The model API base URL for either provider: https://, or http:// only for localhost or a loopback IP, never with user info. |
--ai-optional |
When the AI pass cannot start (SDK missing, no credentials, model unknown), continue without it instead of ending incomplete. It never overrides [ai] blocking or [ai] required. |
|
--ai-response-format |
json_schema |
openai only: how the model is asked for structured output. json_object and prompt embed the answer schema in the system prompt. |
--color |
auto |
auto colours only on a terminal and only when NO_COLOR is unset; always and never force it. |
--format agent turns the AI pass off unless --ai is given. The exit code is the verdict's in every format.
rules
codeveto rules [--format text|json] [--pack NAME]Lists every rule with its severity and title, or as JSON ({"tool": ..., "rules": [...]} with each rule's pack, scope, languages, classes, tags, rationale and hint). --pack limits the list to one pack; an unknown pack is exit 2 with the list of packs.
codeveto rules --pack secretssecrets/anthropic-key error Anthropic API key
secrets/aws-access-key error AWS access key ID
secrets/aws-secret-key error AWS secret access key
...
secrets/private-key error Private key (non-waivable)
...
18 rules in 1 packexplain
codeveto explain RULE_IDPrints one rule's title, rationale, hint and metadata. An unknown rule ID is exit 2.
codeveto explain security/sql-interpolationsecurity/sql-interpolation error
SQL built by string interpolation
Values interpolated or concatenated into SQL text become part of the statement, so a crafted value can change what the query does (SQL injection).
Hint: Pass values as query parameters (placeholders) or use the query builder.
Pack: security
Scope: line
Languages: go, java, javascript, kotlin, python, typescript
Classes: all text files
Tags: cwe-89, security
Default: enabled
Waivable: yes
Introduced-only filter: onpackets
codeveto packets [revision flags] [--output FILE]Harness AI step 1: writes the AI review packets of the selected change as JSON, to stdout or to --output. It reads the same trusted configuration as review and uses no network. Exit 0 when the document was written, 2 on a usage, config or Git error. See AI review.
verify
codeveto verify [revision flags] --responses FILEHarness AI step 2: reviews the change again, regenerates its packets, verifies the responses file against them and prints the JSON report with the verified AI findings. The responses file is read as a regular file of at most 2 MiB. The exit code is the verdict's; an unreadable file is exit 2.
mcp
codeveto mcp --repo PATH [--anchor OID] [--base REF [--head REF] [--comparison merge-base|direct] | --staged | --commit REF]Runs a stdio MCP server for agent harnesses. The repository, the revision flags and the anchor are fixed when it starts; no tool call can change them. See Local and agents.
hook
codeveto hook install|uninstall --pre-commit|--pre-push [--repo PATH] [--force]| Flag | Meaning |
|---|---|
install / uninstall |
Write CodeVeto's hook, or remove it (only a hook CodeVeto wrote, restoring any backup it made). |
--pre-commit / --pre-push |
Which hook. One is required. |
--repo PATH |
The repository. Default .. |
--force |
Install even when the hooks directory is inside the work tree or tracked, or replace a hook CodeVeto did not write (kept as <hook>.codeveto-backup). |
codeveto hook install --pre-commitcodeveto: hook: installed /path/to/repo/.git/hooks/pre-commitinit
codeveto init github|forgejo [--repo PATH] [--force] [--hash sha256:HEX] [--action-sha SHA | --allow-tag]| Flag | Forge | Meaning |
|---|---|---|
--repo PATH |
both | The repository. Default .. |
--force |
both | Overwrite an existing workflow file. |
--action-sha SHA |
github | The full commit SHA of the CodeVeto release to pin the action to. |
--allow-tag |
github | Use the movable v0.1 tag when no release commit SHA is known. The file says it is not a pin. |
--hash sha256:HEX |
forgejo | A wheel hash to pin instead of asking PyPI. Repeatable. |
init github writes .github/workflows/codeveto.yml; init forgejo writes .forgejo/workflows/codeveto.yml. Exit 0 when the file was written, 2 otherwise. See Reviewing in CI.
publish
codeveto publish github|forgejo --report FILERuns inside the CI job. It reads a JSON report, treats it as untrusted, and publishes it: annotations, the job summary, one sticky comment and inline review comments on GitHub; a commit status and one sticky comment on Forgejo. It reads the runner's GITHUB_* variables, the token from GITHUB_TOKEN, and CODEVETO_COMMENT, CODEVETO_SARIF and CODEVETO_BOT_LOGIN, which the action sets from its inputs. Exit 0 when everything was published, 2 when something was not; the review's own exit code is never changed.
version
codeveto versioncodeveto 0.1.0codeveto --version prints the same line.
Exit codes
| Exit | Meaning |
|---|---|
| 0 | review, verify: the verdict is clear. Every other command: it succeeded. --help and --version exit 0. |
| 1 | review, verify: the verdict is vetoed. Nothing else ever exits 1. |
| 2 | The review is incomplete, or the command failed: a usage error, invalid configuration, a Git error, an interruption or an internal error. |
An unexpected exception prints one line, codeveto: internal error (...), and exits 2, never 1. Set CODEVETO_DEBUG=1 to also print the traceback.
Environment variables
| Variable | Read by | Effect |
|---|---|---|
CODEVETO_DETERMINISTIC |
every renderer | 1 zeroes durations, so the same change gives byte-identical output. SOURCE_DATE_EPOCH (any value) does the same. |
NO_COLOR |
review --color auto |
Any non-empty value turns colour off. |
CODEVETO_DEBUG |
every command | 1 prints the traceback of an internal error. |
XDG_CONFIG_HOME |
config | Where the user config lives: $XDG_CONFIG_HOME/codeveto/config.toml. APPDATA on Windows. |
ANTHROPIC_API_KEY |
--ai claude |
The Claude API key (the SDK's own variable). |
ANTHROPIC_BASE_URL |
--ai claude |
The Claude API base URL when --ai-base-url and [ai] base_url are not set. Default https://api.anthropic.com. |
CODEVETO_AI_BASE_URL |
--ai openai |
The OpenAI-compatible base URL when --ai-base-url and [ai] base_url are not set. Default https://api.openai.com/v1. OPENAI_BASE_URL is never read. |
CODEVETO_AI_API_KEY |
--ai openai |
The key for the OpenAI-compatible endpoint. Required for any host but api.openai.com; may be unset for a loopback host. |
OPENAI_API_KEY |
--ai openai |
Used only when the host is api.openai.com and CODEVETO_AI_API_KEY is unset. |
Environment variables are read only for credentials, endpoints and the user config location. They never change which rules run or what blocks.