| name | tugboat-cli |
| description | This skill should be used when managing Tugboat preview environments via the tugboat CLI. It applies when creating, listing, rebuilding, refreshing, debugging, or administering Tugboat previews, services, and repositories. Triggers on tugboat commands, preview environment management, .tugboat/config.yml editing, and Tugboat QA workflow questions. |
Tugboat CLI
Overview
Tugboat is a preview environment service (tugboatqa.com) that builds fully functional website previews for branches, tags, commits, and pull requests. This skill provides guidance for using the tugboat CLI to manage previews, services, repositories, and related resources.
Prerequisites
- The
tugboat CLI must be installed (brew install tugboatqa/tugboat/tugboat-cli on macOS)
- An API access token must be configured (generated at https://dashboard.tugboatqa.com/access-tokens)
- Token is stored in
~/.tugboat.yml after first use, or passed via -t flag or TUGBOAT_API_TOKEN env var
Quick Start
To list available projects and repos:
tugboat ls projects
tugboat ls repos
To create a preview from a branch:
tugboat ls repos
tugboat create preview <branch> repo=<repo-id>
To check preview status and open it:
tugboat ls previews repo=<repo-id>
tugboat ls <preview-id> -b
Common Workflows
Creating and Managing Previews
tugboat create preview <ref> repo=<repo-id>
tugboat create preview <ref> repo=<repo-id> type=pullrequest
tugboat create preview <ref> repo=<repo-id> base=false
tugboat refresh <preview-id>
tugboat rebuild <preview-id>
tugboat reset <preview-id>
tugboat redeploy <preview-id>
tugboat start <preview-id>
tugboat stop <preview-id>
tugboat suspend <preview-id>
tugboat cancel <preview-id>
tugboat delete <preview-id>
Base Previews (Speed Up Builds)
Base previews are snapshots that child previews clone from instead of building from scratch.
tugboat create preview main repo=<repo-id> anchor=true
tugboat update <preview-id> anchor=true
tugboat ls previews repo=<repo-id> anchor=true
tugboat rebuild <base-preview-id>
Debugging Previews
tugboat log <preview-id>
tugboat log <preview-id> -a
tugboat ls services preview=<preview-id>
tugboat shell <preview-id>
tugboat shell <service-id>
tugboat shell <id> command="drush status"
tugboat output <service-id>
Uploading a File Into a Preview (e.g. an HTML report)
There is no tugboat cp/upload command, and two non-obvious traps make naive
approaches fail silently:
tugboat shell ... command= does NOT forward stdin. cat localfile | tugboat shell <id> command="cat > dest" produces an empty file — the pipe is ignored.
- A plain string
command= is split on whitespace and exec'd directly — it is NOT run through a shell. So command="echo hi > /tmp/x" passes > and /tmp/x as literal args to echo; redirects and pipes never happen.
The working pattern: pass command= a JSON array of argv (["bash","-c","<script>"]).
A JSON array is honored verbatim, so the script string runs through a real shell with
pipes/redirects intact. Carry the file content as base64 inside that script:
tugboat ls services preview=<preview-id>
python3 - <<'PY'
import base64, json
src = "report.html"
dest = "/var/lib/tugboat/web/report.html"
b64 = base64.b64encode(open(src, "rb").read()).decode()
script = f"printf %s '{b64}' | base64 -d > '{dest}' && ls -l '{dest}'"
open("/tmp/tb-cmd.json", "w").write(json.dumps(["bash", "-c", script]))
print("b64 bytes:", len(b64))
PY
tugboat shell <service-id> command="$(cat /tmp/tb-cmd.json)"
rm -f /tmp/tb-cmd.json
Re-uploading: preview files placed this way live outside git, so a tugboat rebuild
(or a fresh build) wipes them — just re-run the steps above to restore the file. Use
printf %s (not echo) so no trailing newline corrupts binary payloads.
Listing and Filtering Resources
tugboat ls projects
tugboat ls repos
tugboat ls previews repo=<repo-id>
tugboat ls services preview=<preview-id>
tugboat ls screenshots service=<service-id>
tugboat ls visualdiffs preview=<preview-id>
tugboat ls branches <repo-id>
tugboat ls pulls <repo-id>
tugboat ls pulls <repo-id> state=all
tugboat ls tags <repo-id>
JSON Output for Scripting
Append -j or --json to any command for JSON output. Combine with -q for just IDs.
tugboat ls previews repo=<repo-id> -j
tugboat create preview main repo=<repo-id> -q
Config Validation
Validate a .tugboat/config.yml before committing:
tugboat validate .tugboat/config.yml
tugboat validate <repo-id>
tugboat validate <repo-id> <git-ref>
Config File (.tugboat/config.yml)
The .tugboat/config.yml file in a repository defines the Docker services and lifecycle commands for previews. For the full configuration schema including service properties, lifecycle phases (init, update, build, ready, online, start, clone), and environment variables, read references/cli_reference.md.
Key concepts:
- Services are Docker containers (e.g., apache, mysql, redis)
- The
default: true service receives the preview URL
- The
checkout: true service gets the git clone
- Lifecycle phases run commands at different stages (init for fresh builds, update for data imports, build for every build)
- Services can depend on each other via
depends
Reference
For the complete command reference, configuration schema, environment variables, and API details, load references/cli_reference.md.