Skip to content

feat: support --ratchet / baseline filtering in multi-folder mode #868

Description

@Ayush7614

Summary

--ratchet and baseline suppression (.cve-lite/baseline.json) work in single-folder scans but are silently ignored in multi-folder mode. Monorepos without a root lockfile — the path that auto-enters multi-folder mode — cannot adopt the documented ratcheting CI gate.

Motivation

Ratcheting docs describe --ratchet as the way to land a hard CI gate on existing debt. Multi-folder is the natural scan path for npm/yarn/pnpm workspaces without a root lockfile. Today those repos get full historical noise every run, and --ratchet is a no-op (only referenced to skip the override hint).

Related gap: multi-folder already has JSON + HTML + maintenance/--fail-on partial parity with single-folder; baseline/ratchet is the biggest remaining CI feature hole.

Proposed behaviour

  1. First --ratchet run in multi-folder: write a baseline that covers all scanned subfolders (either one repo-root manifest keyed by subfolder path, or per-subfolder .cve-lite/baseline.json — open to maintainer preference).
  2. Subsequent runs: suppress known findings per subfolder; only new findings (and --fail-on / override / maintenance thresholds) fail CI.
  3. Exit-code policy should match single-folder: ratchet regressions + CVE/--fail-on + override + maintenance.
  4. Docs: note multi-folder support in ratcheting.md and CLI reference; today --ratchet is accepted without error despite doing nothing.

Non-goals

  • Multi-folder --fix / --sarif / --cdx (already explicitly rejected with a message)
  • Changing single-folder baseline format unless needed for the keyed multi-folder layout

Acceptance criteria

  • cve-lite /monorepo --ratchet creates a baseline and exits 0 on first run
  • Second run with the same findings exits 0 (suppressed); introducing a new finding fails
  • Unit/e2e coverage for save + gate paths
  • Docs updated

Happy to take this if maintainers agree on the baseline shape (single keyed file vs per-subfolder).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions