sndev.io / docs

drift

Compare last execute's snapshot against the live instance.

The drift command compares the snapshot written by the last sn execute against the current state of the same resolved target instance. It blocks if .sn-results/ was written for a different target key. In its default mode it reports differences and exits non-zero when any are found; it also supports re-applying the manifest (--fix), previewing remote changes (--pull), refreshing the review queue (--review), persisting safe per-field accept decisions (--accept), and dropping overlays (--clear-pulls). Treat the instance as shared configuration state: pull or review remote changes first, then merge intentional source changes back into the manifest.

sn drift <manifest.ts> [--target <name>] [--profile <name>] [--fix | --pull | --review | --accept <spec> | --clear-pulls] [--strict] [--only <stepId>] [--skip-skill <name>] [--dry-run] [--json]

Detect, re-apply, or reconcile manifest drift against the instance.

Arguments

NameRequiredDescription
manifest.tsYesPath to the manifest.

Flags

FlagDefaultDescription
--target <name>Compare against this instance registry key. Must match the target saved by the last execute.
--profile <name>Credential profile for drift reads and `--fix` re-execution.
--fixRe-execute the manifest to overwrite drifted instance values. Exits 1 on any step failure.
--pullRead-only preview of the remote-vs-local diff. No writes.
--reviewRefresh and list `<manifest-dir>/.sn-review/<basename>.queue.json` with review items for drift and reconciliation events.
--accept <spec>Persist an accept decision for safe leaf fields. Spec form: `<stepId>[.<field>]=<remote|local>`. Repeatable. Script/blob fields are guarded and must be merged into source manually.
--clear-pullsDrop overlay entries (whole overlay, or only the given step with `--only`).
--strictAlso treat untracked records as drift (default: warn-only).
--only <stepId>Scope detection/clear to one step. Repeatable.
--skip-skill <name>Exclude a skill from detection. Repeatable.
--dry-runPrint the overlay changes `--accept` or `--clear-pulls` would write.
--jsonMachine-readable drift report.

Examples

sn drift manifests/payroll/manifest.ts
2 step(s) drifted:
create-br.description remote: "Updated in prod" local: "Initial description"
create-br.active remote: false local: true
Run `sn drift manifests/payroll/manifest.ts --pull` to preview, or `--fix` to overwrite.
sn drift manifests/payroll/manifest.ts --accept "create-br.description=remote" --accept "create-br.active=local"
sn drift manifests/payroll/manifest.ts --review --status open
Review queue: manifests/payroll/manifest.ts
Open: 2 Accepted: 0 Applied: 0 Skipped: 0 Blocked: 0
open remote_difference create-br.description drifted
open unsafe_remote_difference create-br.script drifted
ModeSide effectExit 1 when
default (detect)NoneAny drift; `--strict` also fires on untracked
--fixRe-executes the manifestAny step fails
--pullNoneNever (always exit 0)
--reviewWrites `.sn-review/` queueDrift detection fails
--acceptWrites overlay + snapshot patchesSpec is malformed (exit 2)
--clear-pullsDrops overlayNever

side=remote on --accept patches the snapshot so the next sn drift sees the remote value as the new baseline. side=local reverts the overlay so the next sn execute overwrites the instance back to manifest values. Script-like fields are intentionally excluded from remote overlays; use sn drift --pull, review the remote code, and edit the manifest source.