test(cmd): enforce cross-product CLI conventions - #33
Merged
Conversation
Add a repo-wide conventions test that walks the assembled command tree and gates new commands so product teams stay consistent without reviewer memory: - destructive commands (delete/stop/reboot) must define --dry-run and --force; - command verbs must be canonical (denylist rejects remove/fetch/ls/add/etc.); - every command has a Short description. All current commands already conform; the test is a gate for future ones.
This was referenced Jul 7, 2026
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
Item #2 of the CLI-flow alignment: convention-as-tests (mirrors the mcp
test_conventions.py). A repo-wide Go test walks the assembled command tree (rootCmd) and enforces uniform rules so new product commands stay consistent without relying on reviewers to remember them:delete/stop/rebootmust define--dry-runand--force.remove/rm/destroy→delete,fetch/describe/show→get,ls→list,add/new→create,modify/edit→update).grn configuresubcommands (local-file verbs set/get/list) are exempt.Short.Why a denylist instead of a strict verb-noun allowlist
The CLI's naming is intentionally heterogeneous (vks
create-nodegroup,wait cluster-active, vserverserver create), so a rigid "verb-noun allowlist" would either break existing commands or need many exemptions. A denylist + the destructive-safety rule capture the high-value, uniform invariants and pass cleanly on all current commands — while still catching real drift (typos / wrong synonyms) in new commands.Verified
All current commands already conform:
go test ./cmd/green (3 new tests pass), fullgo test ./...green,go vetclean. The scaffold's generatedlist-examplescommand also conforms.Plan progress
Test-only; no change to the shipped
grnbinary.