CI & Automation
Every sync command can run unattended. The contract in CI is deliberately strict: no prompts, no guessing, and nothing destructive without an explicit flag.
No prompts
Where the interactive CLI would ask a question, a non-interactive run refuses instead:
- An ambiguous record match (two target records that could both be the committed one) fails the command rather than picking a candidate. Resolve it once with an interactive push; the answer lands in the committed identity map and CI runs cleanly after that.
- Deletions happen only with
--dangerously-allow-delete. Amirrorpush without it refuses before changing anything on the target. --yesconfirms an ordinary, non-destructive apply. It never authorizes a deletion.
Credentials
Pass tokens through environment variables named DIRECTUS_<PROFILE>_TOKEN:
DIRECTUS_PRODUCTION_TOKEN=$PROD_TOKEN d6s sync push --to production --yes
The credential store saved on a developer machine is never read in CI; tokens come from the environment only.
JSON reports
Add --json and stdout carries exactly one machine-readable report per command; pull, diff, and push each emit their own. Warnings (stripped secret fields, version drift, flow headers exported verbatim) still go to stderr, so your logs keep them while stdout stays parseable.
A diff whose records are ambiguous reports them as unresolved and counts them into its changes. A non-interactive push refuses that state, so an unresolved diff is a real difference for your pipeline to surface, not noise.
A typical pipeline
# On a schedule: refresh the committed snapshot from the source instance.
# Commit the result; a clean git status means nothing changed.
DIRECTUS_STAGING_TOKEN=$STAGING_TOKEN d6s sync pull --from staging --json
# In pull request checks: preview what merging would apply to the target.
DIRECTUS_PRODUCTION_TOKEN=$PROD_TOKEN d6s sync diff --to production --json
# On merge: apply.
DIRECTUS_PRODUCTION_TOKEN=$PROD_TOKEN d6s sync push --to production --yes --json
Exit behavior
Commands exit non-zero on any refusal or failure (an ambiguous match, a missing deletion flag, a version mismatch, a failed import), so a pipeline step fails visibly instead of continuing past a partial sync.
Get once-a-month release notes & real‑world code tips...no fluff. 🐰
Diffing & Pushing
Preview what a push would change with a read-only diff, then apply it to a target instance by choosing a push mode, passing the deletion gates, and resolving record identity.
Secrets & Limitations
How Environment Sync keeps secret values out of the files you commit, the one exception to review before publishing a repository, and what the tool deliberately does not do.