Skip to content

Latest commit

 

History

History
75 lines (60 loc) · 3.41 KB

File metadata and controls

75 lines (60 loc) · 3.41 KB

CLI reference

codelight [flags]

With no flags, Codelight judges uncommitted changes, including untracked files.

Flags

Flag Meaning
--staged Judge staged changes
--base <ref> Judge what changed in <ref>...HEAD
--only <id> Run one verifier. Repeat the flag to select more than one
--dry-run Show which verifiers would run without making model calls
--show-diff Print exactly what the judge receives. Works with --dry-run
--audit Check every glob against the whole repository without making model calls
--list Print configured verifiers and provider configuration
--spec Print the verifier authoring guide
--version Print the version, commit, and Go toolchain
--model <id> Override the model for every verifier
--prompt <file> Replace the built-in system prompt for this run
--show-prompt Print the system prompt this run would send without making model calls
--provider <name> Override the provider for every verifier
--providers <file> Load machine-local endpoints and credential names from this file
--base-url <url> Override the endpoint for --provider
--repo <dir> Check this repository instead of the current directory
--config <dir> Load verifiers from this directory instead of <repo>/.codelight/verifiers
--jobs <n> Set concurrent verifier jobs. The default is 8
--debug Print each HTTP provider's raw status and response body to standard error

Exit codes

Code Meaning
0 Nothing blocked the change. Warnings may have printed
1 A block verifier failed
2 Codelight could not run because of config, credentials, Git, model output, or an oversized diff

Exit 2 stays separate from exit 1. A verifier that did not run did not pass.

Model calls

Command Model calls
--version None. It reads no repository or config
--list, --audit, --dry-run, --spec, --show-prompt None
A run where no verifier matches None
A run where N verifiers match One initial call per verifier, in parallel. Retries may add calls

Verifier files

Verifiers live in .codelight/verifiers/*.yml. Each file contains a YAML list.

Field Required Default Meaning
id yes none Unique kebab-case name that states the property positively
paths yes none Globs that select changed files. **/ matches zero or more directories
exclude no none Globs removed from paths
severity no warn block exits 1; warn reports only
assert yes none The judge's full brief
context no diff diff sends hunks; file also sends each changed file in full
model no run model Model override for this verifier
effort no low low, medium, high, xhigh, max, or none
provider no run provider Named provider override for this verifier

Unknown fields, duplicate ids, and malformed globs are fatal. A typo must not create a verifier that appears to pass while matching nothing.

Start from the starter rules or browse the stack examples. Read Writing verifiers before you add a rule. The same guide is available through codelight --spec.

See Provider configuration for provider fields and precedence.