baseline version
Prints the current version and build information for the CLI binary.
Use it when: you need to confirm which build is running locally, in CI, or on an operator machine.
baseline version
Baseline CLI Guide
This page explains what each command does, when to use it, and how the CLI connects to reporting, auth, API operations, and release workflows already implemented in this repository.
baseline check to see if a repository meets Baseline's production-readiness policies.baseline enforce when you want blocking output that reads clearly inside pipeline logs.baseline api serve when you need auth, audit history, and API-backed operations.npm i -g baselineprod-cli@latest before troubleshooting or testing a newly released flow.Baseline is moving quickly right now. If the docs mention a flow you do not see locally yet, update the CLI first.
npm i -g baselineprod-cli
baseline version
npm i -g baselineprod-cli@latest
baseline version
For release-by-release changes, read CHANGELOG.md.
Core Commands
baseline versionPrints the current version and build information for the CLI binary.
Use it when: you need to confirm which build is running locally, in CI, or on an operator machine.
baseline version
baseline checkRuns the full policy set and exits non-zero if blocking violations are found.
Use it when: you want a normal repository check before push, before merge, or in CI.
baseline check
Typical result: a readable list of violations such as missing tests, secrets, deployment gaps, or rollback documentation.
baseline enforceRuns policy enforcement with output formatted for strict release gating.
Use it when: the command is part of a required pipeline step and the output should focus on pass or block decisions.
baseline enforce
baseline scanBuilds a broader scan summary across files, security findings, and policy results.
Use it when: you want more context than a single pass/fail gate, especially during investigation or triage.
baseline scan
baseline initCreates a local Baseline configuration file under .baseline/config.yaml.
Use it when: you are onboarding a new repository and want a standard Baseline config scaffold.
baseline init
baseline reportExports results in machine-friendly or human-friendly formats.
Use it when: you need output for logs, automation, or security tooling.
baseline report --text
baseline report --json
baseline report --sarif
baseline explain <policy_id>Explains the status of one policy and gives focused remediation guidance.
Use it when: a repository is blocked by one specific rule and you want the shortest path to understanding the failure.
baseline explain D1
baseline explain R1
AI Commands
baseline generateGenerates scaffolded remediation drafts for some violations using the configured AI provider.
Use it when: you want a starting point for CI, tests, Dockerfile, README, or env-template fixes.
baseline generate
Important: Baseline does not use AI to decide whether a policy passes. Review generated content before merge.
baseline prGenerates remediation drafts, commits them, pushes a branch, and attempts to create a pull request through gh.
Use it when: you want a fast remediation branch workflow around detected violations.
baseline pr
baseline security-adviceCreates an AI-assisted security suggestions file for issues that may sit outside the deterministic policy set.
Use it when: you want extra review prompts beyond the enforced policies.
baseline security-advice --out SECURITY.AI.SUGGESTIONS.md
Important: the AI output may be wrong, incomplete, or overly broad. Treat it as advisory only.
API And Auth Commands
baseline api serveStarts the Baseline HTTP API server.
Use it when: you want the API, OIDC login flow, API key operations, audit persistence, or dashboard backend endpoints.
baseline api serve --addr :8080
Common hosted pages: /, /signin.html, /signup.html, /dashboard, and this CLI guide page.
baseline api keygenGenerates a random API key for machine-to-machine usage.
Use it when: you need a new bearer credential for automation or operator access.
baseline api keygen
baseline api verify-prodChecks whether API-related production configuration is complete.
Use it when: you are preparing an environment for production or preflight validation.
baseline api verify-prod
baseline api verify-prod --strict
baseline api migrate-postgresMigrates Baseline API data from SQLite into a Postgres target.
Use it when: you are moving an existing Baseline deployment from local SQLite storage to a hosted Postgres database.
baseline api migrate-postgres --sqlite-path ./baseline_api.db --database-url "postgres://USER:PASSWORD@HOST:5432/baseline?sslmode=disable" --reset-target
baseline dashboard serveRuns the separate local dashboard proxy service for selected read-only API paths.
Use it when: you want the proxy dashboard workflow instead of the API-hosted dashboard route.
baseline dashboard serve --addr 127.0.0.1:8091 --api http://127.0.0.1:8080
baseline dashboard loginStarts the hosted browser login flow for a CLI session.
Use it when: you want to connect the CLI to a hosted Baseline API and approve the session in the dashboard.
baseline dashboard login --api https://baseline-api-95nb.onrender.com
baseline dashboard whoami and logoutShows the current dashboard session identity or clears the saved CLI session.
Use it when: you want to verify which hosted account the CLI is using or explicitly sign the CLI out.
baseline dashboard whoami
baseline dashboard logout
baseline dashboard connect, status, disconnectManages the saved project-local dashboard upload connection used by baseline scan.
Use it when: you want to inspect, repair, or remove the saved dashboard connection for the current repository.
baseline dashboard connect --api http://127.0.0.1:8080
baseline dashboard status
baseline dashboard disconnect
Operational Workflows
go build -o baseline ./cmd/baseline
go test ./...
Use this when validating the repository itself before release or contribution.
baseline ci setup --help
baseline ci setup --provider github --mode enforce
Use this when you want Baseline to scaffold a CI workflow that runs repository checks in GitHub, GitLab, or Azure pipelines.
baseline check
baseline report --sarif
bash ./scripts/release-gate.sh
Use this when you want Baseline checks plus the repository's release gating scripts.
baseline api serve --addr :8080
bash ./scripts/api-smoke.sh
Use this when validating a production-like API startup and smoke path.
curl http://127.0.0.1:8080/healthz
curl http://127.0.0.1:8080/readyz
curl http://127.0.0.1:8080/metrics
Use this after starting the API to confirm health, readiness, and metrics exposure.
curl -H "Authorization: Bearer <admin_key>" \
http://127.0.0.1:8080/v1/dashboard
Use this to confirm that machine auth and dashboard summary APIs are functioning.
.\scripts\api-key-rotate.ps1 `
-ApiBaseUrl http://127.0.0.1:8080 `
-AdminApiKey "<current_admin_key>" `
-Role operator `
-Name "ops-rotation-01"
Use this when rotating operator keys through the API instead of hand-managing key material.
Release And Platform Operations
These are the API-hosted pages for local use when the Baseline API server is running.
http://127.0.0.1:8080/
http://127.0.0.1:8080/signin.html
http://127.0.0.1:8080/signup.html
Use them when: you want browser-based human access to the current public pages and auth flow.
These are standard repository commands often used around Baseline rollout and release preparation.
git status
git add -A
git commit -m "your message"
git push origin main
git tag v1.0.1
git push origin v1.0.1
Use them when: you are committing Baseline-related changes or publishing a tagged release.
Baseline expects the primary branch to be protected. This example configures required status checks on GitHub.
gh api \
-X PUT \
repos/<owner>/<repo>/branches/main/protection \
-H "Accept: application/vnd.github+json" \
-F required_status_checks.strict=true \
-F required_status_checks.contexts[]="Test" \
-F required_status_checks.contexts[]="Security Scan" \
-F required_status_checks.contexts[]="Release Gates" \
-F required_status_checks.contexts[]="API Smoke" \
-F enforce_admins=true \
-F required_pull_request_reviews.required_approving_review_count=1 \
-F required_pull_request_reviews.dismiss_stale_reviews=true \
-F restrictions=
Use it when: policy A1 needs a real protected-branch configuration behind it.
These scripts run the repository's release gate workflow outside the main CLI command surface.
bash ./scripts/release-gate.sh
.\scripts\release-gate.ps1
Use them when: you want the complete scripted release gate, especially in CI or pre-release validation.
These scripts test the API in a smoke-check workflow and write artifacts under .artifacts/api-smoke/<timestamp>.
bash ./scripts/api-smoke.sh
.\scripts\api-smoke.ps1
Use them when: you need a higher-confidence API smoke run than a single health check.
These API calls help operators inspect what the backend exposes and what has happened recently.
curl -H "Authorization: Bearer <admin_key>" \
http://127.0.0.1:8080/v1/dashboard/capabilities
curl -H "Authorization: Bearer <admin_key>" \
"http://127.0.0.1:8080/v1/dashboard/activity?limit=10"
curl http://127.0.0.1:8080/v1/auth/me
Use them when: verifying auth identity, rollout stage, capability flags, or recent operator-visible activity.
Reads recent audit events from the API.
curl -H "Authorization: Bearer <admin_key>" \
"http://127.0.0.1:8080/v1/audit/events?limit=20"
Use it when: you want to confirm that important changes are being recorded in the audit stream.
These examples are useful when a scan fails, readiness changes, or you need fast operational context.
curl http://127.0.0.1:8080/readyz
curl -H "Authorization: Bearer <admin_key>" \
"http://127.0.0.1:8080/v1/scans?project_id=<project_id>"
curl -H "Authorization: Bearer <admin_key>" \
"http://127.0.0.1:8080/v1/scans/<scan_id>/report?format=sarif"
Use them when: you need to inspect readiness dependencies, recent scans, or a SARIF report for a specific scan.
PowerShell helper script for issuing a new operator key and optionally revoking an older one.
.\scripts\api-key-rotate.ps1 `
-ApiBaseUrl http://127.0.0.1:8080 `
-AdminApiKey "<current_admin_key>" `
-Role operator `
-Name "ops-rotation-01"
.\scripts\api-key-rotate.ps1 `
-ApiBaseUrl http://127.0.0.1:8080 `
-AdminApiKey "<current_admin_key>" `
-Role operator `
-Name "ops-rotation-02" `
-RevokeKeyId "<old_key_id>"
Use it when: you want a controlled operator key lifecycle instead of manually distributing long-lived keys.
Reference
0 success20 blocking violations found50 system or runtime errorA1, B1, C1, D1, E1, F1, G1, H1, I1, J1, K1, L1, R1
Use baseline explain <policy_id> to drill into one of these.
A1 branch protectionB1 CI runs on pull requestsC1 tests existD1 no plaintext secretsE1 dependency files existF1 README and license existG1 risky code patterns blockedH1 deployment config existsI1 infrastructure-as-code existsJ1 env template existsK1 backup or recovery docs existL1 logging or monitoring existsR1 rollback docs existCLI-only use does not require a database. API persistence uses SQLite for keys, audit events, and integration jobs.
BASELINE_API_DB_PATH=.baseline/baseline.db
Baseline is easiest to adopt by starting with a repository check, then adding reporting, explain flows, AI drafts, and API-backed operations as your workflow matures.