Skip to content

test(cli): Add CLI command registration and flag tests#207

Merged
peterj merged 1 commit intoagentregistry-dev:mainfrom
groundnuty:test/77-cli-command-registration-tests
Feb 25, 2026
Merged

test(cli): Add CLI command registration and flag tests#207
peterj merged 1 commit intoagentregistry-dev:mainfrom
groundnuty:test/77-cli-command-registration-tests

Conversation

@groundnuty
Copy link
Copy Markdown
Contributor

@groundnuty groundnuty commented Feb 21, 2026

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 #77

Change Type

/kind feature

Changelog

Add CLI command registration and flag unit tests

Additional Notes

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 peterj merged commit 0d4b7c1 into agentregistry-dev:main Feb 25, 2026
10 checks passed
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add a unit test that ensures all commands are in the cli

2 participants