Scan a Single Subdirectory or Monorepo Package
Target a single monorepo package by scanning from its directory or with --cwd, so the DriftScore reflects that package. Gate each package independently in CI.
In a monorepo, a repo-wide DriftScore can hide which package actually needs upgrades. Vibgrate lets you scope a scan to a single package so the findings and DriftScore reflect just that workspace. The default subcommand is scan, and a bare vg scans the current directory, so the simplest approach is to scan from inside the package.
Prerequisites
- Vibgrate CLI installed
- A monorepo or multi-package project
Steps
1. Map your packages
Note where each package's manifests and lockfiles live so you know which directory to scan.
2. Scan from the package directory
Change into the package directory and run a bare scan. Because scan is the default and it targets the current directory, this scopes the scan to that package.
vg
3. Target a package with --cwd
To scan a package without changing directories, point the CLI at it with --cwd.
vg scan --cwd packages/api
4. Read the package DriftScore
The scan prints a results table and a DriftScore scoped to that package, so you can compare packages and prioritize the worst offenders.
5. Gate per package in CI
Combine package scoping with a gate so each package can fail independently.
vg scan --cwd packages/api --fail-on error
Verification
A scan from the package directory or with --cwd reports findings and a DriftScore for that package only. Compare two packages to confirm the scores differ as expected. With --fail-on, the exit code reflects that package's findings.
Next Steps
- Exclude vendored or generated paths within the package.
- Gate each package in CI using exit codes.
- Track per-package drift over time with
vg baseline.