buoy drift
Detect design drift in your codebase. Scan for issues, inspect each drift signal, apply fixes, and manage ignore rules for intentional exceptions.
Usage
Commands
scan Scan your codebase for design system usage and drift signals check Show detailed drift signals with severity and type fix Suggest and apply fixes for drift issues ignore Ignore specific drift signals by file, type, component, or value buoy drift scan
Scan your codebase for design system usage. Zero-config auto-detection finds components, tokens, and patterns. Results are cached for fast repeat runs.
Options
-s, --source <path> Source directory to scan (default: auto-detected) --json Output as JSON for scripting -v, --verbose Show detailed scan progress and per-file results --no-persist Don't save results to scan history --no-cache Bypass cache and force a full re-scan --clear-cache Clear the scan cache before running Examples
Basic scan
Scan a specific directory
Verbose output
Auto-detection
buoy drift scan works with zero configuration. It auto-detects your framework,
styling approach, and source directory. Supported frameworks include React, Vue,
Svelte, Angular, and vanilla HTML/CSS.
buoy drift check
Show detailed information about each instance where code diverges from your design system. Use in CI pipelines for automated drift detection.
Options
--type <type> Filter by drift type (color, spacing, typography) --severity <level> Filter by severity (high, medium, low) --file <path> Check specific file only --json Output as JSON for scripting --include <glob> Include additional file patterns --exclude <glob> Exclude file patterns Example Output
Filtering Examples
<div class=""># Only color issues</div><div class="">buoy drift check --type color</div><div class=""></div><div class=""># Only high severity</div><div class="">buoy drift check --severity high</div><div class=""></div><div class=""># Specific file</div><div class="">buoy drift check --file src/components/Card.tsx</div><div class=""></div><div class=""># Combine filters</div><div class="">buoy drift check --type spacing --severity high</div> What It Scans
React Components, props, inline styles Vue Components, scoped styles Svelte Components, style blocks Angular Components, stylesheets Tailwind Config tokens, arbitrary values CSS/SCSS Custom properties, values buoy drift fix
Automatically fix design drift issues in your codebase. Replaces hardcoded values with design tokens and applies other safe transformations.
Options
--apply Apply fixes to source files --dry-run Show detailed diff without applying changes -c, --confidence <level> Minimum confidence level: exact, high, medium, low (default: high) -t, --type <types> Fix types to include (comma-separated: hardcoded-color, hardcoded-spacing) -f, --file <patterns> File glob patterns to include (comma-separated) --exclude <patterns> File glob patterns to exclude (comma-separated) --backup Create .bak backup files before modifying --json Output as JSON --force Skip safety checks Examples
Preview fixes (dry run)
Apply fixes
Fix only color issues
Fix specific files
Confidence Levels
Each fix suggestion includes a confidence score indicating how safe it is to apply:
exact 100% — Value exactly matches a design token — safest to auto-apply high 95-99% — Very close match, safe to auto-apply medium 70-94% — Close match, review recommended low <70% — Ambiguous, manual review required By default, --apply only applies high and exact confidence fixes.
buoy drift ignore
Ignore specific drift signals so they don't appear in checks or affect your health score. More targeted than baselines — filter by file path, drift type, component name, or specific value.
Commands
all Ignore all current drift signals add Add current drift signals to the ignore list show View all ignored signals and their filters clear Remove the ignore list entirely Options
These flags work with all and add to target specific signals:
--file <glob> Ignore drift in matching files or folders (e.g. "src/legacy/**") --type <type> Ignore a specific drift type (e.g. hardcoded-color) --component <name> Ignore drift from a specific component (e.g. "LegacyCard") --value <value> Ignore a specific hardcoded value (e.g. "#ff0000") Examples
Ignore all drift in legacy code
Ignore a specific drift type
Ignore drift from a single component
Ignore a specific value
Combine filters
<div class=""># Ignore hardcoded colors in legacy files</div><div class="">buoy drift ignore add --file "src/legacy/**" --type hardcoded-color</div><div class=""></div><div class=""># Ignore a specific value in a specific component</div><div class="">buoy drift ignore add --component "OldButton" --value "#333"</div> View ignored signals
Clear all ignore rules
Severity Pipeline
When buoy drift check runs, severity rules from .buoy.yaml are applied
in a fixed order before results are displayed:
1. Promote Conditional severity upgrades. Matches drift by type, file, component, token, or value and elevates severity (e.g. warning → critical). 2. Enforce Unconditional critical. Overrides any promote result. If enforce matches, the drift is critical — no negotiation. 3. Ignore The escape hatch. Ignored drift is excluded entirely, even if promoted or enforced.
Configure these in your .buoy.yaml under drift.promote, drift.enforce,
and drift.ignore. See Configuration for full details.
Health gate
When health.failBelow is configured, buoy drift check also exits with code 1
if the health score drops below the threshold. The --json output includes a health object:
<div class="">{</div><div class=""> "drifts": [...],</div><div class=""> "health": {</div><div class=""> "score": 68,</div><div class=""> "threshold": 70,</div><div class=""> "passed": false</div><div class=""> }</div><div class="">}</div> Drift Types
hardcoded-value Raw values instead of design tokens close-match Values near tokens (likely typos) naming-inconsistency Component names that don't follow conventions deprecated-pattern Usage of deprecated design patterns