feat(cli): add --fail-on grade option for configurable CI gate threshold#73
Open
dmchaledev wants to merge 1 commit into
Open
feat(cli): add --fail-on grade option for configurable CI gate threshold#73dmchaledev wants to merge 1 commit into
dmchaledev wants to merge 1 commit into
Conversation
The exit-code gate was hardcoded to D/F grades, making it impossible for teams to enforce stricter standards (e.g. "fail on C or worse") or opt into a softer threshold via a single flag. --fail-on accepts any valid grade (A+, A, B, C, D, F) and exits 1 when the report grade is at or below that level. Default behavior (fail on D) is unchanged. Also fixes URL positional-argument detection to use a Set of known flag values rather than a string-equality check against the timeout number, which was fragile when --timeout and --fail-on were both present. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TLaWreutDFMwM1cLViGzty
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
--fail-on <grade>CLI option so teams can set their own CI gate threshold instead of the hardcoded D/F defaultSetof known flag values (more robust than the previous string-equality check againsttimeoutMs)--helpoutput and examples to document the new flagMotivation
The CLI's exit-code gate is its primary CI use case (per README):
But the failure threshold was hardcoded to D or F (
cli.tsline 95):Teams that have already achieved a B or C grade and want to enforce "must not regress below B" have no way to do that today. With this change:
The default behavior (exit 1 on D or F) is unchanged for backward compatibility.
How it works
Grades are ordered best-to-worst as
['A+', 'A', 'B', 'C', 'D', 'F']. The CLI exits 1 whenGRADE_ORDER.indexOf(report.grade) >= GRADE_ORDER.indexOf(threshold). An invalid grade value produces a clear error message and exits 1 immediately.Test plan
npm run typecheckpassesnpm test)--fail-on Bexits 1 for a C-grade report and exits 0 for a B-grade report (manually verified viaanalyzeHeaders)--fail-on Xprints an error and exits 1--fail-on) unchanged: exits 1 only on D/F🤖 Generated with Claude Code
https://claude.ai/code/session_01TLaWreutDFMwM1cLViGzty
Generated by Claude Code