Make capture gc reachable, and let it honour --json - #253
Merged
Conversation
Real-usage testing found `commitlore capture gc` could not run at all. The parent `capture` command declared `--transcript` with requiredOption, and commander enforces a parent's required options even when a subcommand is invoked, so the subcommand failed during parsing before its own action ran. Seventeen unit tests for gcPending passed while the command exposing it was unreachable. The requirement has not been dropped; it moved into the capture action, where it applies to the capture flow and not to a sibling that needs no transcript. A second defect surfaced immediately after: `--json` is declared on both `capture` and `capture gc`, and commander binds a flag declared on both to the parent, so the subcommand's own opts never saw it and the flag was silently ignored. gc now reads it from either level. Both were invisible to the unit tests because the tests called gcPending directly and never invoked the command. Ruled-out: dropping --json from the gc subcommand and relying on the parent's | the subcommand would then document a flag it does not declare, and a reader of `capture gc --help` would not see it Ruled-out: keeping requiredOption and giving gc its own top-level command | gc belongs to capture's surface, and moving it would make the fix a rename rather than a fix Limit: the guard against this class is four CLI-level tests; nothing structurally prevents a future subcommand from colliding with a parent option again Blast: local Undo: easy Certainty: firm Record-Id: r-gcwiring
CommitLore — record lintTrailers: clean — 1 commit in Active constraints for the paths this PR touchesLimits (55)
Ruled out (100)
Warnings (39)
Trailer violations fail this check. Active constraints are informational — they are what the repository already decided, not a verdict on this PR. |
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.
Found by real-usage testing, not by the suite.
Two defects
commitlore capture gccould not run at all.capturedeclared--transcriptwithrequiredOption, and commander enforces a parent's required options even when a subcommand is invoked — so parsing failed before gc's action ran:T-1019's seventeen unit tests passed because they call
gcPendingdirectly and never invoke the command.capture gc --jsonsilently ignored the flag.--jsonis declared on bothcaptureandcapture gc; commander binds it to the parent, so the subcommand's own opts never saw it.Fix
The transcript requirement moved into the capture action, where it applies to the capture flow and not to a sibling that needs none. gc reads
--jsonfrom either level.Verified in real usage
Four CLI-level regression tests added;
test/capture.test.ts13/13. Both typechecks exit 0. Rebuiltdist/committed.Relates to #215 — its acceptance criterion "wire
commitlore capture gcto this function" was not met in practice.