Scope templates --status flag to the list subcommand#518
Merged
Conversation
The --status filter was registered as a persistent flag on the templates command group, so it leaked onto every subcommand (construct, show, create, etc.) where it has no meaning and is silently ignored. Move it to a local flag on `templates list`, the only command that uses it. This is cosmetic — the stray flag was never sent in any request body and did not cause the `templates construct` 400 reported in #454 (that is an SDK bug tracked in basecamp/basecamp-sdk#354). Refs #454
Review carefully before merging. Consider a major version bump. |
There was a problem hiding this comment.
Pull request overview
This PR cleans up the CLI UX for the templates command group by scoping the --status flag to templates list (the only subcommand that actually uses it), instead of exposing it as a persistent flag on every templates subcommand.
Changes:
- Removed
--statusas a persistent flag frombasecamp templates. - Added
--statusas a local flag onbasecamp templates list. - Updated the
.surfacesnapshot to remove the spurious--statusentries from unrelated subcommands.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/commands/templates.go | Moves --status from a persistent templates flag to a local templates list flag. |
| .surface | Removes --status from non-list templates subcommands in the CLI surface snapshot. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CI surface diff flags the 7 removed `templates … --status` entries as breaking removals — acknowledge them in .surface-breaking. Also retarget the e2e flag-parsing test from `templates --status` to `templates list --status`, matching where the flag now lives.
Per PR review: --status was accepted as any string and, for non-active values, interpolated directly into the request URL. Reject anything outside active/archived/trashed (or empty) with a usage error before the value reaches the account layer or the URL. Add an e2e test for the invalid case.
Per PR review: the acknowledged removals were appended after the SUB block. Move them into the FLAG section in correct lexical position so the file stays grouped and deterministic. Content is unchanged — only reordered.
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
The
--statusfilter was registered as a persistent flag on thetemplatescommand group, so Cobra propagated it onto every subcommand —construct,show,create,update,delete,construction— where it has no meaning and is silently ignored.This moves it to a local flag on
templates list, the only command that actually uses it.Context
Surfaced while validating #454 (
templates constructreturnsBad Request). The reporter suspected this stray--statusflag was being sent in the construct POST body and causing the 400. It is not — the flag is never read byconstructand never enters any request body. The real cause of #454 is an SDK bug (flat request body missing theprojectenvelope), tracked in basecamp/basecamp-sdk#354.So this change is purely a cosmetic UX cleanup: the flag no longer clutters the help of commands that don't support it.
Verification
--statusnow appears only undertemplates list --help, and is gone fromtemplates construct --help(and the other subcommands)..surfacesnapshot updated: the 7 spurioustemplates … --statusentries removed,templates list --statusretained.go vet,internal/commandsunit tests, skill-drift, and smoke-coverage checks all pass.Refs #454
Summary by cubic
Scoped the
--statusflag totemplates listonly and removed it from othertemplatessubcommands. Added validation to accept only empty,active,archived, ortrashed; grouped the acknowledged removals under the.surface-breakingFLAG section; retargeted the e2e test totemplates list --statusand added an invalid-value failure case.Written for commit 8140b48. Summary will update on new commits.