Skip to content

Add --min-grade flag for configurable CI gate threshold#74

Open
dmchaledev wants to merge 1 commit into
mainfrom
claude/nice-mendel-wz2zld
Open

Add --min-grade flag for configurable CI gate threshold#74
dmchaledev wants to merge 1 commit into
mainfrom
claude/nice-mendel-wz2zld

Conversation

@dmchaledev

Copy link
Copy Markdown
Contributor

Summary

  • The CLI's CI-gate exit-1 threshold was hardcoded to grades D and F (cli.ts:95), with no way to configure it
  • Adds --min-grade <grade> (accepts A+, A, B, C, D, F); exits 1 when the report falls below the specified grade
  • Default is D, preserving existing behavior for anyone who doesn't pass the flag
  • Updates --help output and README CLI example to document the new option

Before:

# Could only fail on D or F — no way to enforce stricter standards
security-headers https://staging.example.com || echo "Gate failed"

After:

# Teams can now gate on any grade
security-headers https://staging.example.com --min-grade B || echo "Gate failed"

Implementation

GRADE_ORDER array (['A+', 'A', 'B', 'C', 'D', 'F']) encodes severity by index. gradeIndex() looks up the report grade and the threshold, and exits 1 when the report index exceeds the threshold index. An invalid --min-grade value prints a clear error and exits 1.

The URL-detection filter is extended to skip the grade argument value so positional URL parsing stays correct regardless of flag order.

Test plan

  • All 85 existing tests pass (npm test)
  • No new runtime dependencies introduced
  • Manual: --min-grade B should exit 0 for A/A+, exit 1 for B/C/D/F
  • Manual: --min-grade A+ should exit 1 for anything below A+
  • Manual: --min-grade invalid should print a clear error and exit 1
  • Manual: omitting --min-grade behaves identically to the current D/F gate

🤖 Generated with Claude Code

https://claude.ai/code/session_01Enxu2FVQRw3oWQCQ1HtTnh


Generated by Claude Code

The exit-1 threshold was hardcoded to D/F. Teams enforcing stricter
security posture (e.g. requiring B or above on every deployment) had no
way to configure this without wrapping the tool. --min-grade accepts any
valid grade (A+, A, B, C, D, F) and exits 1 when the report falls below
it; the default preserves the existing D behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Enxu2FVQRw3oWQCQ1HtTnh
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.

2 participants