Skip to content

feat(flatcover) add --full and --list parameters, and accept ndjson via stdin#12

Merged
indexzero merged 3 commits intomainfrom
flatcover-full
Jan 18, 2026
Merged

feat(flatcover) add --full and --list parameters, and accept ndjson via stdin#12
indexzero merged 3 commits intomainfrom
flatcover-full

Conversation

@indexzero
Copy link
Owner

  • --full --cover preserves integrity/resolved metadata: fields were discarded in coverage pipeline

    • checkCoverage() uses Map<string, Map<string, dep>> instead of Map<string, Set<string>> to retain full dep info
    • outputCoverage() accepts full parameter, conditionally includes fields in JSON/NDJSON/CSV output
    • CSV adds integrity,resolved columns when --full specified
    • Help text documents --full behavior with --cover
  • --list accepts JSON array file input: enables coverage checks without lockfile

    • -l/--list <file> option reads [{name, version, integrity?, resolved?}] format
    • readJsonList() validates array structure and required fields
    • Preserves optional integrity/resolved for --full output
  • stdin accepts NDJSON input via - argument: Unix convention for piped package lists

    • readStdinNdjson() parses one {name, version} object per line
    • Skips empty lines, validates JSON and required fields
    • Example: echo '{"name":"lodash","version":"4.17.21"}' | flatcover - --cover
  • Input source validation: prevents ambiguous input combinations

    • Mutually exclusive: lockfile, --list, stdin
    • --workspace restricted to lockfile input only
    • Clear error messages for invalid combinations

indexzero and others added 2 commits January 17, 2026 23:35
…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>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@indexzero indexzero merged commit 4e94fe4 into main Jan 18, 2026
5 checks passed
@indexzero indexzero deleted the flatcover-full branch January 23, 2026 16:17
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.

1 participant