Skip to main content

CLI Reference

The DaoFlow CLI is the primary interface for AI agents and power users. Every command supports structured JSON output for machine consumption.

Generated Contract Artifact

The published CLI contract is generated from the live Commander program and committed as a static artifact:

  • cli-contract.json — command inventory, subcommands, options, documented scope requirements, and machine-readable example payloads

Generate it with bun run contracts:generate and validate it with bun run contracts:check.

Installation

# One-line install (auto-detects OS and architecture)
curl -fsSL -o /usr/local/bin/daoflow \
https://github.com/DaoFlow-dev/DaoFlow/releases/latest/download/daoflow-$(uname -s | tr A-Z a-z)-$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')
chmod +x /usr/local/bin/daoflow

# Or build from source
cd packages/cli && bun run build && bun link

Global Flags

Every command accepts these flags:

FlagDescription
--jsonOutput structured JSON to stdout (progress/errors to stderr)
--quiet / -qBare value output only (just the ID, just the URL)
--dry-runPreview changes without executing (mutating commands only)
--yesSkip confirmation prompts (required for mutating commands)
--timeout <seconds>Request timeout (default: 30)
--idempotency-keyPrevent duplicate operations
--helpShow command help with examples and required scopes
--cli-version / -VShow CLI version

Output Contract

  • Without --json: Human-readable tables and prose to stdout
  • With --json: Structured JSON to stdout, progress to stderr
  • Every JSON response includes { "ok": true/false } at the top level
  • Errors include { "ok": false, "error": "message", "code": "ERROR_CODE", "requiredScope": "..." }

Exit Codes

CodeMeaning
0Success
1General error
2Permission denied
3Dry-run completed (no changes)

Command Overview

CommandLaneScope RequiredMutating
loginnone (creates session)yes
whoamireadany valid tokenno
capabilitiesreadany valid tokenno
auditreadany valid tokenno
approvalsread/commandany valid token / approvals:decidevaries
statusreadserver:readno
server addcommandserver:writeyes
servicesreadservice:readno
projectsread/commanddeploy:read, deploy:start, service:updatevaries
templatesvariesnone / deploy:read / deploy:startvaries
deploycommanddeploy:startyes
rollbackcommanddeploy:rollbackyes
diffplanningdeploy:readno
logsreadlogs:readno
envread/commandenv:read / env:writevaries
planplanningdeploy:readno
doctorreadserver:read, logs:readno
backup listreadbackup:readno
backup runcommandbackup:runyes
backup restorecommandbackup:restoreyes

The generated contract includes additional command families not expanded into individual docs pages here, including backup destination management, backup schedule management, token management, config helpers, install/upgrade flows, and update commands.

templates is the new curated catalog worth calling out separately: it renders shared starter stacks into the same direct Compose planning and execution flows DaoFlow already uses elsewhere.

backup restore --dry-run is the exception worth noting: it uses the API planning lane through backupRestorePlan, exits with code 3, and only requires backup:read.

Configuration

The CLI stores configuration in ~/.daoflow/config.json:

{
"currentContext": "default",
"contexts": {
"default": {
"apiUrl": "http://localhost:3000",
"token": "dfl_abc123...",
"authMethod": "api-token"
}
}
}

For automation, DAOFLOW_URL and DAOFLOW_TOKEN can provide a runtime auth context without writing a config file. Set both together; a partial override is treated as an error.

For fresh server installs, DAOFLOW_INITIAL_ADMIN_EMAIL and DAOFLOW_INITIAL_ADMIN_PASSWORD can preseed the first owner account that daoflow install writes into the generated .env.