feat(flatcover) add --full and --list parameters, and accept ndjson via stdin#12
Merged
feat(flatcover) add --full and --list parameters, and accept ndjson via stdin#12
Conversation
…cover The --full flag was not passing integrity and resolved metadata through the coverage checking pipeline. The checkCoverage() function discarded these fields when grouping dependencies, and outputCoverage() did not accept or use the full parameter. - Preserve integrity/resolved in checkCoverage() by using Map instead of Set - Add full parameter to outputCoverage() function signature - Include fields conditionally in JSON, NDJSON, and CSV output formats - Update help text to document --full behavior with --cover - Add comprehensive tests for all output formats Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Enable coverage checking for arbitrary package lists without requiring
a lockfile. This supports two new input methods:
--list <file>: Read packages from a JSON array file
Example: flatcover --list packages.json --cover
- (stdin): Read NDJSON packages from stdin, one per line
Example: echo '{"name":"lodash","version":"4.17.21"}' | flatcover - --cover
Both methods support optional integrity and resolved fields which are
preserved when using --full. Input validation ensures each entry has
required name and version fields.
- Add -l/--list option to parseArgs for JSON file input
- Add '-' positional argument convention for stdin input
- Add readJsonList() and readStdinNdjson() helper functions
- Validate mutually exclusive input sources
- Restrict --workspace to lockfile input only
- Update help text with new input source documentation
- Add comprehensive tests for both input methods
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
89184a3 to
0187454
Compare
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
--full --coverpreserves integrity/resolved metadata: fields were discarded in coverage pipelinecheckCoverage()usesMap<string, Map<string, dep>>instead ofMap<string, Set<string>>to retain full dep infooutputCoverage()acceptsfullparameter, conditionally includes fields in JSON/NDJSON/CSV outputintegrity,resolvedcolumns when--fullspecified--fullbehavior with--cover--listaccepts JSON array file input: enables coverage checks without lockfile-l/--list <file>option reads[{name, version, integrity?, resolved?}]formatreadJsonList()validates array structure and required fields--fulloutputstdin accepts NDJSON input via
-argument: Unix convention for piped package listsreadStdinNdjson()parses one{name, version}object per lineecho '{"name":"lodash","version":"4.17.21"}' | flatcover - --coverInput source validation: prevents ambiguous input combinations
--list, stdin--workspacerestricted to lockfile input only