| title | Drift Detection - Jarvy |
|---|---|
| description | Detect when a developer's local environment has diverged from the team's expected configuration and remediate it. |
Drift detection catches the moment a developer's environment stops matching the team's jarvy.toml. After a successful jarvy setup, Jarvy snapshots a baseline. Later runs compare against that baseline and flag tool versions, install methods, and tracked files that have changed.
- A teammate manually
brew upgradesnodefrom 20 → 21 and a build silently breaks - A new dependency is added to
jarvy.tomlbut only half the team re-ran setup - A
.vscode/settings.jsonchange wasn't picked up by everyone - A CI runner image rotates and a tool version drifts
jarvy drift check answers: "is this machine still on the team baseline?"
# jarvy.toml
[drift]
enabled = true
check_on_run = false
track_files = [".vscode/settings.json", "package.json"]
version_policy = "minor"
ignore_tools = ["vim", "neovim"]
allow_upgrades = true| Field | Type | Default | Description |
|---|---|---|---|
enabled |
bool | false |
Master switch |
check_on_run |
bool | false |
Run drift check before every Jarvy command |
track_files |
array | [] |
Extra files hashed into the baseline |
version_policy |
enum | minor |
How strict version comparison is |
ignore_tools |
array | [] |
Tools excluded from drift comparison |
allow_upgrades |
bool | true |
Treat newer-than-baseline as OK |
| Policy | Matches | Use when |
|---|---|---|
major |
1.x.x ↔ 1.y.y |
You only care about API breaks |
minor |
1.2.x ↔ 1.2.y |
Default; tracks features & patches |
patch |
1.2.3 only |
Reproducibility-critical projects |
exact |
full string incl. pre-release | Deterministic CI, locked envs |
State is written to .jarvy/state.json after a successful jarvy setup:
{
"version": "1",
"created_at": "1706086800Z",
"updated_at": "1706086800Z",
"config_hash": "sha256:abc123...",
"tools": {
"node": {
"version": "20.10.0",
"path": "/opt/homebrew/bin/node",
"install_method": "brew"
}
},
"files": {
".vscode/settings.json": "sha256:def456..."
}
}Commit .jarvy/state.json if you want a single shared baseline across the team. Gitignore it if every developer should manage their own.
jarvy drift check # Detect drift; exit 1 if found
jarvy drift check --format json # JSON for CI
jarvy drift status # Show baseline summary
jarvy drift status -v # Show install method + path per tool
jarvy drift accept # Treat current state as new baseline
jarvy drift accept --tools node,go # Accept only these tools
jarvy drift fix # Reinstall to match baseline
jarvy drift fix --dry-run # Preview without changes| Code | Meaning |
|---|---|
0 |
No drift |
1 |
Drift detected |
2 |
No baseline state found — run jarvy setup first |
Block PRs that introduce drift:
- run: jarvy setup --ci
- run: jarvy drift check --format json#!/bin/sh
jarvy drift check --format json > /dev/null || {
echo "Environment drift detected. Run: jarvy drift fix"
exit 1
}brew upgrade node
jarvy drift check # Reports node version mismatch
jarvy drift accept --tools node # Adopt new version as baselinejarvy setupfinishes →EnvironmentStatesnapshots tool versions, install methods, paths, and file hashesjarvy drift checkbuilds a freshEnvironmentStateDriftDetectorcompares baseline vs. current under the configuredversion_policyDriftReportlists adds/removes/version-changes/file-changesDriftFixer(onfix) reinstalls/downgrades tools that have automatic remediation paths
Files are hashed with SHA-256. Tool detection uses the same probes as jarvy doctor.
- Source:
src/drift/ - Key types:
DriftConfig,EnvironmentState,ToolState,DriftDetector,DriftReport,DriftFixer - See CLI Reference for all flags