fix: multi-folder --json writes a timestamped file like single-folder - #902
Open
Ayush7614 wants to merge 3 commits into
Open
fix: multi-folder --json writes a timestamped file like single-folder#902Ayush7614 wants to merge 3 commits into
Ayush7614 wants to merge 3 commits into
Conversation
sonukapoor
requested changes
Jul 28, 2026
sonukapoor
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for taking this on @Ayush7614. The mechanism is right, and I like that you carried the maintenanceFindings / overrideFindings spreads over untouched rather than restructuring them. The tests are solid too: writing to a real temp cwd and reading the file back instead of asserting on the console.log call is exactly the right way to prove this, and catching that the file lands in process.cwd() (not the scanned project dir) in the e2e test was a good catch.
Two things before I can merge:
- Could you add
Closes #877to the PR body? Right now it is not referenced anywhere in the description, so merging will not auto-close the issue. - I dogfooded a real redirect (
cve-lite . --json > out.json) on a monorepo fixture andout.jsonjust contains the textJSON saved to cve-lite-scan-....json, not the payload. That is expected given the design, but it is the exact pattern #877 calls out, andwebsite/docs/workflow-integration.md(around lines 211 and 218) still showscve-lite . --json > cve-lite-report.json. Since multi-folder used to print real JSON to stdout, that redirect actually worked before this change and is only broken now for multi-folder as a side effect. Could you update those two examples too, or note explicitly that they are being left for a follow-up? I do not want to close #877 while one of the two doc locations it names still teaches the broken pattern.
Everything else looks good, happy to merge once those are sorted.
Multi-folder --json dumped the payload to stdout while single-folder (and the CLI help text) write a cve-lite-scan-*.json file. Align the behavior and stop teaching stdout redirects in the NX workspace docs.
The e2e asserted JSON.parse(stdout); multi-folder --json now writes a timestamped file like single-folder. Read the file and use the seeded offline DB so the assertion is stable locally and in CI.
Align workflow-integration.md with the file-write contract so CI that follows the docs does not capture "JSON saved to …" instead of findings.
Ayush7614
force-pushed
the
fix/multi-folder-json-file
branch
from
July 28, 2026 12:09
2968ea8 to
14cd97b
Compare
Collaborator
Author
|
@sonukapoor thanks for the review — addressed:
Also rebased this branch onto latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--jsonnow writescve-lite-scan-<ts>.jsonto the working directory and prints the saved path (same contract as single-folderwriteOutputs).multiFolder, per-foldersubfoldertags, optional OA/DM).cve-lite . --json > file(nx-workspaces.md,workflow-integration.md) so redirects are no longer recommended.Why
Help text says
--jsonsaves a timestamped file. Single-folder does that; multi-folder previously dumped JSON to stdout only. Unifying on the file-write contract also closes the docs/redirect footgun called out in #877.Test plan
npm test -- tests/multi-folder-scan.test.ts--jsonreads the written filenpm run build--json > …in NX or workflow-integration examplesCloses #877