Skip to main content
preloop migrate is built to be driven by an AI agent. Every step is a command that prints either a short human summary or one JSON document, and the four decisions that must not be automated are explicit gates.

Commands

guide prints the playbook from one source file, so the text below and the text an agent receives are identical; a unit test fails if they drift.

Machine-readable surface

plan --json returns one document with schema_version: 1: Secret names only: values are never read, printed or serialized. plan reads .github/workflows and git remote; it never contacts GitHub. apply --json returns schema_version, dry_run, applied, branch, commit, pr_url, changed_files, diff, diff_lines, manual_review (including ${{ }} expressions and mapping forms left for a human), disable_command and next_step. In --json mode stdout carries exactly one document and progress goes to stderr. Without a terminal and without --yes, apply exits 2 and changes nothing. verify --json returns schema_version, repo, ok, workflows[] (path, runs_on_rewritten, github_state, drift) and remaining[]. github_state is disabled, active, missing or unknown. drift is true when the local workflow still declares GitHub-hosted runs-on values; run preloop migrate apply --yes --json again to fix it.

Exit codes

When verify exits 3, the fix is gh auth login (with git/gh installed). Never handle tokens to work around it.

Human gates

An agent must stop and ask before opening the pull request, running gh workflow disable, setting any secret, or overriding a stays_on_github verdict. The full when/question text is in plan --json.human_gates and in the playbook below.

Owned workflows

When the engine has the owned-workflows endpoint (GET, PUT and DELETE /api/v1/owned-workflows/{owner}/{repo}, plus /drift), it is the server-side record of which workflows Preloop owns. It is available when the engine has that endpoint; preloop migrate verify does not depend on it and checks the local files and GitHub state directly.

Playbook

Everything below is the exact text preloop migrate guide prints.