CLI
Install and use the Foo Guard CLI for local scans and CI enforcement.
Installation
From this repository:
npm run cli:build
npm link --prefix packages/cliOr after npm publish:
npm install -g @agentguard/cliPlan requirements
CLI access requires a Pro personal API key or Team organization service key. Free and Individual plans do not include CLI access.
Authentication
export FOOGUARD_API_KEY=agt_live_...
export FOOGUARD_API_URL=https://fooguard.comTeam organization service keys use the agt_team_... prefix.
Common commands
fooguard --help
fooguard scan --help
fooguard scan ./agents --fail-on high
fooguard scan ./agents --fail-on high --min-grade BExit codes (CI enforcement)
The CLI exit code is the enforcement signal for CI pipelines:
| Code | Meaning | CI behavior |
|------|---------|-------------|
| `0` | **Policy passed** | Pipeline step succeeds |
| `1` | **Security policy failed** | Pipeline step fails — findings or grade violated policy |
| `2` | **Operational or configuration error** | Pipeline step fails — parser error, API error, invalid config, etc. |
fooguard scan ./agents --fail-on high
echo $? # 0 = pass, 1 = policy violation, 2 = errorUse exit code 1 as your CI security gate. This works in any CI platform — not just GitHub Actions.
Distinguishing policy failure from errors
- Exit
1means the scan ran successfully but policy was not met (findings at/abovefailOn, or grade belowminGrade) - Exit
2means the scan could not complete (network failure, unsupported file, usage limit, etc.)
Policy sources
Effective policy merges organization policy (Team), repository .fooguard.yml, and CLI flags. The strictest threshold wins.
# CLI override for a single run
fooguard scan ./agents --fail-on critical --min-grade ASee `.agentguard.yml` and CI/CD enforcement.
Baseline regression
fooguard scan ./agents --baseline --baseline-path .agentguard.baseline.jsonSee Baselines.
The CLI uses the same deterministic analysis engine as the REST API and web analyzer.