CLI Reference
The primary binary is hostshift. Migration behavior lives in the Go CLI; there is no Node migration runtime or compatibility entrypoint.
All commands that can mutate the target default to dry-run mode unless --apply is passed.
Global Behavior
Section titled “Global Behavior”HostShift uses system OpenSSH. Set HOSTSHIFT_SSH_CONFIG when tests or automation need a temporary SSH config:
HOSTSHIFT_SSH_CONFIG=/tmp/hostshift-ssh-config hostshift plan --profile profile.yaml --target new-server --jsonTarget commands can be wrapped with non-interactive sudo by setting HOSTSHIFT_TARGET_SUDO=1. Source commands are never sudo-wrapped by HostShift.
version
Section titled “version”Prints the CLI version.
hostshift versiondoctor
Section titled “doctor”Validates source and target SSH aliases and prints the active source-safety contract.
hostshift doctor --source old-server --target new-server --jsonImportant output fields:
sourceWillBeModified: falsesourcePolicy: strict-read-onlyversionsourcetarget
discover
Section titled “discover”Reads allowlisted facts from the source and writes a v2 profile with safe workload candidates.
hostshift discover \ --source old-server \ --name customer-migration \ --profile customer-migration.profile.yaml \ --jsonRequired flags:
--source: SSH alias for the source.--name: profile name.
Optional flags:
--profile: output path. Defaults to<name>.profile.yaml.--json: machine-readable output.
discover fails if a required fact cannot be read. Optional facts are preserved in output with their error so operators can decide whether they matter for the migration. Generated workload candidates still require operator review before approved: true.
Builds the action and stream plan from a profile.
hostshift plan --profile examples/web-stack-v2.yaml --target new-server --jsonRequired flags:
--profile: v1 or v2 profile path.
Optional flags:
--target: override the target SSH alias in the profile.--json: machine-readable output.
The plan contains:
actions: local or target commands grouped by phase.streams: source-to-target data streams for file, image, and database movement.blockers: conditions that prevent apply.warnings: non-blocking risks, for example cross-distribution compatibility warnings.sourceWillBeModified: false.
explain
Section titled “explain”Builds the same plan and returns an AI-friendly review summary without applying anything.
hostshift explain --profile examples/web-stack-v2.yaml --target new-server --jsonRequired flags:
--profile: v1 or v2 profile path.
Optional flags:
--target: override the target SSH alias in the profile.--json: machine-readable output.
The explanation contains blocker and warning summaries, workload and stream counts, target impact counts, safe next actions for a human operator, and source safety notes for AI clients.
review
Section titled “review”Builds the same plan and returns structured migration findings for AI-assisted profile review without applying anything.
hostshift review --profile examples/web-stack-v2.yaml --target new-server --jsonRequired flags:
--profile: v1 or v2 profile path.
Optional flags:
--target: override the target SSH alias in the profile.--json: machine-readable output.
The review output contains:
status:blocked,needs-review, orready-for-dry-runfindings: blocker, warning, and info records with workload-aware recommendationsfindings[].suggestedProfilePatch: optional YAML snippet that an operator can review and adaptoperatorChecklist: human review steps before any apply commandaiBrief: constraints AI clients must follow, including no MCP apply operationssourceWillBeModified: false
review checks for missing evidence such as container workloads without HTTP/application checks, databases without scalar verification, service workloads without serviceActive, Nginx config transfer without nginxConfig, and database workloads that may need secret environment variable names.
Suggested snippets are advisory. HostShift does not write them into the profile automatically, and AI clients should present them for human review instead of applying them.
prepare
Section titled “prepare”Plans or applies target preparation actions.
hostshift prepare --profile profile.yaml --target new-server --jsonhostshift prepare --profile profile.yaml --target new-server --apply --state-dir .hostshift --run-id prep-001 --jsonTypical prepare actions:
- install target package capabilities through the platform adapter
- write target UFW rules
- write target OpenSSH keepalive drop-ins
- write target MySQL bind-address drop-ins
- validate Docker Compose configuration
- disable the default Nginx site when Nginx config is migrated
Plans or applies data streams.
hostshift sync --profile profile.yaml --target new-server --jsonhostshift sync --profile profile.yaml --target new-server --apply --state-dir .hostshift --run-id sync-001 --jsonSync streams are validated source read commands piped into validated target write commands. Examples:
tar --createintotar --extractdocker image saveintodocker image loadmysqldumpintomysqlpg_dumpintopg_restore
verify
Section titled “verify”Plans or applies target-side verification checks.
hostshift verify --profile profile.yaml --target new-server --jsonhostshift verify --profile profile.yaml --target new-server --apply --state-dir .hostshift --run-id verify-001 --jsonVerification actions run only on the target. They cover HTTP health, Laravel DB connectivity, file assertions, database scalar assertions, service status, firewall rule checks, and Nginx config validation.
cutover
Section titled “cutover”Plans or applies target-only cutover actions.
hostshift cutover --profile profile.yaml --target new-server --jsonhostshift cutover --profile profile.yaml --target new-server --apply --confirm START-MIGRATION --state-dir .hostshift --run-id cutover-001 --jsonDry-run output includes:
confirmationCodesourceWillBeModified: false- target-only cutover actions such as
docker compose up -d --buildand standalonedocker run
Apply refuses blockers and requires the exact confirmation code. DNS remains manual.
rollback
Section titled “rollback”Reports rollback guidance and target rollback metadata.
hostshift rollback --profile profile.yaml --jsonRollback output always states sourceChanged: false because HostShift never mutates the source. Automatic rollback is intentionally disabled; operators should keep DNS on the source and inspect target-side rollback metadata before stopping target services.
capabilities
Section titled “capabilities”Prints a local catalog for AI clients and operators without connecting to source or target hosts.
hostshift capabilities --jsonThe report includes supported releases, target package capability mappings, workload types, check types, source fact names, and AI safety guidance. It always reports sourceWillBeModified: false and applyToolsExposed: false.
mcp stdio
Section titled “mcp stdio”Runs the HostShift MCP server over stdin/stdout for AI clients.
hostshift mcp stdioThe MCP server exposes discovery, planning, explanation, structured review, dry-run, cutover dry-run, local profile migration, source policy introspection, capability catalog inspection, and rollback metadata tools. It also exposes the hostshift_migration_operator prompt and local hostshift://source-safety, hostshift://migration-workflow, and hostshift://capabilities resources. It does not expose apply tools.
mcp doctor
Section titled “mcp doctor”Validates the MCP tool surface and Claude Desktop config example without running remote commands.
hostshift mcp doctor --jsonhostshift mcp doctor --claude-config integrations/claude/claude_desktop_config.example.json --jsonThe report includes protocol version, exposed tool, prompt, and resource names, whether any apply tool is exposed, and whether the Claude config points to hostshift mcp stdio.
profile migrate
Section titled “profile migrate”Reads a v1 profile and writes a v2 profile.
hostshift profile migrate --input examples/profile.yaml --output profile.v2.yamlThe migration maps v1 composeProjects, standaloneContainers, fileSets, databases, healthChecks, and applicationChecks into v2 workloads and checks.
status
Section titled “status”Reads saved run state.
hostshift status --state-dir .hostshift --run-id sync-001 --jsonState lives at:
<state-dir>/runs/<run-id>/state.jsonIf --state-dir is omitted, HostShift uses HOSTSHIFT_STATE_DIR or the OS user config directory.
Phase commands return the effective runId; when --run-id is omitted, HostShift generates one before writing state.
resume
Section titled “resume”Loads a run state, rebuilds the phase plan, verifies its fingerprint, and reports completed and pending steps without changing state.
hostshift resume \ --profile migration.profile.yaml \ --state-dir .hostshift \ --run-id sync-001 \ --jsonContinue only the pending steps:
hostshift resume \ --profile migration.profile.yaml \ --state-dir .hostshift \ --run-id sync-001 \ --apply \ --jsonResume refuses changed profiles, targets, blockers, or generated commands. Completed action and stream IDs are not replayed. State is persisted atomically before and after every remote operation.
When an operation failed or the process stopped while it was running, HostShift treats that action as potentially partial. Preview the run first, inspect the target, then explicitly confirm the exact retry:
hostshift resume \ --profile migration.profile.yaml \ --state-dir .hostshift \ --run-id sync-001 \ --apply \ --retry-failed target.workload.mysql.app.dump \ --jsonCutover resume also requires the normal --confirm <code> value. Runs created before plan fingerprints were introduced cannot be resumed safely; start a new phase run instead.
policy source
Section titled “policy source”Prints the source policy contract.
hostshift policy sourceForbidden source-side behavior includes sudo, package installation, service management, file writes, snapshot creation, maintenance mode, and firewall changes.
Writes an SPDX 2.3 JSON SBOM from the Go module graph.
hostshift sbom --output dist/hostshift.sbom.spdx.json --jsonOptional flags:
--output: output path. Defaults todist/hostshift.sbom.spdx.json.--json: machine-readable summary output.
matrix docker
Section titled “matrix docker”Lists or explains the Docker integration matrix without running containers.
hostshift matrix docker --listhostshift matrix docker --list-imageshostshift matrix docker --pair 'ubuntu22->debian12' --jsonOptional flags:
--list: list source and target pairs.--list-images: list unique fixture base images.--pair: filter to one pair such asubuntu22->debian12; quote it in shells because>is a redirection operator.--json: machine-readable output.
Real Docker execution still uses HOSTSHIFT_RUN_DOCKER_MATRIX=1 make test-integration-docker.
docker-e2e
Section titled “docker-e2e”Runs the Go-backed Docker integration runner used by tests/integration/docker/run-matrix.sh.
hostshift docker-e2e --listhostshift docker-e2e --list-imageshostshift docker-e2e --pair 'ubuntu22->debian12'HOSTSHIFT_RUN_DOCKER_MATRIX=1 hostshift docker-e2e --pair 'ubuntu22->debian12'Optional flags:
--list: list source and target pairs.--list-images: list unique fixture base images.--pair: filter to one pair. Quote values containing>.--pull-images: pre-pull required fixture base images.
matrix vm
Section titled “matrix vm”Lists or explains the real VM e2e matrix without booting VMs.
hostshift matrix vm --listhostshift matrix vm --pair 'ubuntu22->debian12' --jsonhostshift matrix vm --provider lima --jsonOptional flags:
--list: list source and target pairs.--pair: filter to one pair such asubuntu22->debian12; quote it in shells because>is a redirection operator.--provider: VM provider. Currentlylima.--json: machine-readable output.
Real VM execution still uses HOSTSHIFT_RUN_VM_E2E=1 make test-e2e-vm for provider preflight and HOSTSHIFT_RUN_VM_E2E=1 bash tests/e2e/vm/run-vm-e2e.sh --apply for the apply workflow.
vm-e2e
Section titled “vm-e2e”Runs the Go-backed VM e2e runner used by tests/e2e/vm/run-vm-e2e.sh.
hostshift vm-e2e --listhostshift vm-e2e --pair 'ubuntu22->debian12' --emit-dir /tmp/hostshift-vmHOSTSHIFT_RUN_VM_E2E=1 hostshift vm-e2e --pair 'ubuntu22->debian12' --applyOptional flags:
--list: list source and target pairs.--pair: filter to one pair. Quote values containing>.--provider: VM provider. Currentlylima.--emit-dir: write rendered workspaces under a chosen directory.--apply: boot VMs and run the live HostShift workflow whenHOSTSHIFT_RUN_VM_E2E=1is set.