test(cli): Add CLI command registration and flag tests#207
Merged
peterj merged 1 commit intoagentregistry-dev:mainfrom Feb 25, 2026
Merged
Conversation
Add complementary unit tests for CLI command tree structure, flag registration, required flag validation, hidden command detection, and argument count validators. Uses slices.Sort instead of forbidden sort package. Addresses agentregistry-dev#77
peterj
approved these changes
Feb 25, 2026
christian-posta
pushed a commit
to christian-posta/agentregistry
that referenced
this pull request
Mar 9, 2026
…-dev#207) # Description Add complementary unit tests for CLI command tree structure, flag registration, required flag validation, hidden command detection, and argument count validators. Test coverage includes: - `TestCommandTree` - verifies all 8 top-level commands and subcommand counts - `TestCommandsHaveRequiredMetadata` - walks entire tree checking Use/Short fields - `TestHiddenCommands` - verifies import/export are hidden - `TestAgentInitFlags` - 6 flags with correct defaults - `TestSkillPublishFlags` - 5 flags with defaults + required flag check - `TestRequiredFlags` - 4 commands with required flags validated - `TestRootPersistentFlags` - registry-url and registry-token - `TestArgsValidators` - 16 cases testing ExactArgs/ArbitraryArgs enforcement Uses `slices.Sort` instead of forbidden `sort` package. Fixes agentregistry-dev#77 # Change Type /kind feature # Changelog ```release-note Add CLI command registration and flag unit tests ``` # Additional Notes - Complementary to PR agentregistry-dev#137 (stalled on lint failure from `sort` package usage) - Uses `slices.Sort` to comply with `depguard` linter rule - Single new file: `pkg/cli/commands_test.go` (346 lines, 39+ subtests)
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.
Description
Add complementary unit tests for CLI command tree structure, flag
registration, required flag validation, hidden command detection,
and argument count validators.
Test coverage includes:
TestCommandTree- verifies all 8 top-level commands and subcommand countsTestCommandsHaveRequiredMetadata- walks entire tree checking Use/Short fieldsTestHiddenCommands- verifies import/export are hiddenTestAgentInitFlags- 6 flags with correct defaultsTestSkillPublishFlags- 5 flags with defaults + required flag checkTestRequiredFlags- 4 commands with required flags validatedTestRootPersistentFlags- registry-url and registry-tokenTestArgsValidators- 16 cases testing ExactArgs/ArbitraryArgs enforcementUses
slices.Sortinstead of forbiddensortpackage.Fixes #77
Change Type
/kind feature
Changelog
Additional Notes
sortpackage usage)slices.Sortto comply withdepguardlinter rulepkg/cli/commands_test.go(346 lines, 39+ subtests)