Skip to content

feat: multi-folder scan for monorepos with no root lockfile#497

Open
sonukapoor wants to merge 11 commits into
mainfrom
feature/issue-496-multi-folder-scan
Open

feat: multi-folder scan for monorepos with no root lockfile#497
sonukapoor wants to merge 11 commits into
mainfrom
feature/issue-496-multi-folder-scan

Conversation

@sonukapoor
Copy link
Copy Markdown
Collaborator

Closes #496

When cve-lite . is run from a directory with no root lockfile but 2 or more nested lockfiles, the tool now automatically scans all nested packages and presents results grouped by subfolder.

What changed

  • New detection logic in src/index.ts — activates multi-folder mode when no root lockfile exists and 2+ nested lockfiles are found; falls through to the existing single-folder path otherwise
  • src/parsers/multi-package.tsfindNestedLockfiles walks subdirectories and stops recursing when a lockfile is found (prevents double-counting), loadMultiplePackages returns one ScanInput per subfolder
  • src/scan/multi-folder-scan.ts — orchestrates the existing scan pipeline once per folder; handles --json, --report, --fail-on, and unsupported flag messages for --fix/--sarif/--cdx
  • src/output/multi-folder-printer.ts — terminal output with a folder header per result, compact and verbose modes both supported, fix commands prefixed with cd subfolder &&
  • src/output/multi-folder-html-reporter.ts — single HTML report with collapsible folder sections using the same <details>/<summary> arrow pattern and design as the existing report
  • src/remediation/fix-commands.ts — new subfolder option prefixes all generated commands with cd subfolder &&
  • examples/no-root-package/ — test fixture with sessionManager/ (axios@1.7.7) and apiServer/ (lodash@4.17.20), no root package.json

Single-folder scans, workspace scans, and all existing examples are unaffected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support monorepos without a root package.json

1 participant