DocsReference
CLI
Commands for first-time setup, people, tokens, policies, audit checks and backups.
Run commands from the Gatehouse directory with npm run cli --. They use the same configuration as the server, so set the same environment variables (especially the master key) first. In Docker, prefix with docker compose exec gatehouse.
Commands
| Command | What it does |
|---|---|
create-owner --email <e> --name <n> --password <p> |
Creates the first owner on a fresh install, without the setup code. |
create-user --email <e> --name <n> --password <p> [--role owner|admin|auditor|member] [--teams a,b] |
Creates a person. --teams lists their groups. |
create-token --email <e> --name <n> [--days 90] |
Prints a personal token for an agent or CI job. |
verify-audit |
Recomputes the audit hash chain and reports where it breaks, if anywhere. |
export-policies |
Prints every policy as JSON. |
import-policies <file.json> |
Replaces every policy (policy as code). |
backup <file.db> |
Writes a consistent copy of the database. Safe while Gatehouse runs. |
Examples
# Fresh install without the browser
npm run cli -- create-owner --email you@company.com --name "Your Name" --password '…'
# A token for a CI job that expires in 30 days
npm run cli -- create-token --email ci@company.com --name "Release bot" --days 30
# Policy as code
npm run cli -- export-policies > policies.json
npm run cli -- import-policies policies.json
# Nightly backup
npm run cli -- backup /data/backups/gatehouse-$(date +%F).db
backup refuses to overwrite an existing file, so include the date in the name.