DeployHQ CLI — Agent Skill Guide
deployhq
Deploy code, manage servers, and automate infrastructure via the DeployHQ CLI (dhq). Use when the user wants to deploy, check deployment status, manage projects/servers, or interact with the DeployHQ platform.
SKILL.md
Full skill instructions
DeployHQ CLI — Agent Skill Guide
Identity
DeployHQ is a deployment automation platform. The dhq CLI (binary name: deployhq) manages projects, servers, deployments, and infrastructure via the DeployHQ REST API. Designed for both humans and AI agents.
Authentication
Three methods (checked in order):
- Environment variables (CI/agents):
DEPLOYHQ_ACCOUNT+DEPLOYHQ_EMAIL+DEPLOYHQ_API_KEY - Config files:
~/.deployhq/config.tomlor.deployhq.tomlin project directory - Interactive login:
dhq auth login
Verify with: dhq auth status
Output Contract
Critical rule: stdout is ALWAYS data (table or JSON). stderr is ALWAYS human messages.
- TTY mode: Table output with headers
- Piped/non-TTY: Auto-switches to JSON
--json: Force JSON output. Optionally select fields:--json name,status,identifier- Breadcrumbs: JSON responses include
breadcrumbsarray with suggested next commands - Exit codes: 0 = success, non-zero = failure
Non-Interactive Mode
Use --non-interactive to guarantee the CLI never prompts. This mode is auto-enabled when an agent is detected or output is piped.
In non-interactive mode, any ambiguity (e.g. multiple servers, missing required values) fails with a structured error listing available options instead of prompting.
The only commands that cannot run non-interactively are: dhq init, dhq hello, dhq configure (use their flag-based alternatives instead).
Command Groups
| Group | Description | Reference |
|---|---|---|
| projects | Create, list, update, delete projects | projects.md |
| servers | Manage deployment targets (SSH, FTP, S3, etc.) | servers.md |
| deployments | Create, monitor, rollback deployments | deployments.md |
| repos | Repository configuration, branches, commits | repos.md |
| configuration | Env vars, config files, build commands, exclusions, deployment checks, cache files, build languages, known hosts | configuration.md |
| global resources | Global servers, env vars, config files, SSH keys, templates | global-resources.md |
| operations | Activity, status, test-access, doctor | operations.md |
| auth & setup | Authentication, CLI config, agent setup | auth-setup.md |
Decision Trees
"Deploy code"
dhq projects list --json— find project permalinkdhq servers list -p <project> --json— find server identifierdhq deploy -p <project> -s <server> --json— create deploymentdhq deployments watch <id> -p <project>— monitor progress
"Check what's deployed"
dhq deployments list -p <project> --json— recent deploymentsdhq deployments show <id> -p <project> --json— details + steps
"Something went wrong"
dhq deployments logs <id> -p <project>— read step logsdhq rollback <id> -p <project> --json— rollback if neededdhq deployments abort <id> -p <project>— abort if running
"Set up a new project"
dhq projects create --name "My App" --json— create projectdhq repos create -p <project> --scm-type git --url <repo-url> --json— connect repodhq servers create -p <project> --name Production --protocol-type ssh --hostname <host> --username <user> --json— add serverdhq deploy -p <project> --json— first deployment
"Configure deployment"
dhq env-vars create -p <project> --name KEY --value val— add env vardhq config-files create -p <project> --path .env --body "..." --json— add config filedhq excluded-files create -p <project> --pattern "node_modules" --json— add exclusiondhq build-commands create -p <project> --name "Install" --command "npm install" --json— add build stepdhq deployment-checks create -p <project> --name "Health" --stage post_deploy --check-type http --http-url https://app.example.com/health --http-expected-status 200 --json— gate the deploy
"Escape hatch (any API endpoint)"
dhq api GET /projects
dhq api GET /projects/<permalink>/deployments
dhq api POST /projects/<permalink>/deployments --body '{"deployment":{...}}'
Invariants
- Always use
--jsonfor machine-readable output when scripting or in agent context - Use
--non-interactiveto guarantee no prompts (auto-enabled for agents and piped output) - JSON responses include
breadcrumbswithactionandcmdfields; deploy commands also includeresourceandid - Error responses include
retryable,exit_code, andrecoveryactions when applicable - Exit codes: 0 = success, 1 = user error, 2 = internal, 3 = auth, 4 = network, 5 = not found, 6 = conflict
- Empty results return exit 0 with empty
dataarray (not an error) dhq commands --jsonincludes per-command agent metadata:interactive,destructive,idempotent,safe_for_automation,resource_typesdhq apicovers all 144+ API endpoints not in the command tree- Project flag (
-p/--project) accepts permalink or identifier - Server flag (
-s/--server) uses fuzzy matching: exact > normalized > substring - Config precedence: flags > env vars >
.deployhq.toml>~/.deployhq/config.toml
Gotchas
- Some API fields return strings OR numbers inconsistently (handled internally by
FlexString) dhq deployauto-fetches latest revision if--revisionis omitteddhq deployis incremental by default — it picks up from the server's last successful deploy. Use--fullfor a full-branch deploy or--start-revision <sha>to pin a specific start commitdhq deploy --waitblocks until deployment completes (use--timeoutto cap)- Deployment
watchuses TUI in TTY mode, append-only in pipes dhq env-vars createprompts for value if--valueis omitted (not agent-friendly — always pass--value)
Triggers
- User mentions "deploy", "deployment", "release", "ship" → deployment workflow
- User mentions "server", "hosting", "target" → server management
- User mentions "rollback", "revert", "undo" → rollback workflow
- User mentions "environment variable", "env var", "config", "secret" → configuration
- User mentions "branch", "commit", "repository" → repo management
- User mentions "DeployHQ", "deployhq", "dhq" → general CLI usage
