Skip to content

Breaking: Convert coverage-dir from flag to positional argument#100

Merged
bartveneman merged 2 commits intomainfrom
claude/coverage-dir-positional-arg-7f1H4
Mar 18, 2026
Merged

Breaking: Convert coverage-dir from flag to positional argument#100
bartveneman merged 2 commits intomainfrom
claude/coverage-dir-positional-arg-7f1H4

Conversation

@bartveneman
Copy link
Member

@bartveneman bartveneman commented Mar 17, 2026

Summary

Refactored the CLI argument parsing to accept <coverage-dir> as a positional argument instead of a named flag (--coverage-dir), improving the command-line interface usability, because many CLI's accept auto-complete for positionals, not for named arguments.

Key Changes

  • Argument parsing: Modified parse_arguments() to accept coverage-dir as the first positional argument instead of a named option

    • Enabled allowPositionals: true in parseArgs() configuration
    • Removed 'coverage-dir' from the options object
    • Changed to read from positionals[0] instead of values['coverage-dir']
  • CLI interface: Updated the command signature from --coverage-dir=<dir> to <coverage-dir>

    • New usage: css-coverage <coverage-dir> --min-coverage=<number> [options]
    • Added "ARGUMENTS" section to help text to document the positional argument
    • Moved --coverage-dir description from OPTIONS to ARGUMENTS section
  • Tests: Updated all test cases to reflect the new positional argument syntax

    • Changed test descriptions to reference <coverage-dir> instead of --coverage-dir
    • Updated test invocations to pass coverage directory as first positional argument
    • Removed test for empty --coverage-dir flag (no longer applicable)
  • Documentation: Updated all CLI examples in help text to use the new positional argument syntax

Implementation Details

The change maintains backward compatibility in the returned CliArguments object structure while improving the command-line UX by using a more conventional positional argument pattern for the primary required input.

Closes #74

Breaking change: `--coverage-dir=<path>` is replaced by a positional
argument, e.g. `css-coverage ./coverage --min-coverage=0.8`.

Updates argument parsing, validation error messages, tests, and help text.

https://claude.ai/code/session_01HyhRGi53stHdRSZBkxTAeQ
@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2026

Bundle Report

Changes will decrease total bundle size by 24 bytes (-0.09%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
cli.js-esm 13.77kB -24 bytes (-0.17%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: cli.js-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
cli.mjs -24 bytes 13.77kB -0.17%

Files in cli.mjs:

  • ./src/cli/help.ts → Total Size: 1.38kB

  • ./src/cli/arguments.ts → Total Size: 1.79kB

@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.71%. Comparing base (dfc5876) to head (ddf03cb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #100   +/-   ##
=======================================
  Coverage   96.71%   96.71%           
=======================================
  Files          14       14           
  Lines        1064     1064           
  Branches      142      142           
=======================================
  Hits         1029     1029           
  Misses         34       34           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

positionals[0] is string | undefined; the assertion is safe because
we throw before reaching the return when coverage_dir is missing.

https://claude.ai/code/session_01HyhRGi53stHdRSZBkxTAeQ
@bartveneman bartveneman changed the title Convert coverage-dir from flag to positional argument Breaking: Convert coverage-dir from flag to positional argument Mar 17, 2026
@bartveneman bartveneman marked this pull request as ready for review March 18, 2026 08:20
@bartveneman bartveneman merged commit b27643b into main Mar 18, 2026
6 of 7 checks passed
@bartveneman bartveneman deleted the claude/coverage-dir-positional-arg-7f1H4 branch March 18, 2026 08:45
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.

replace cli coverage-dir with single positional argument

3 participants