cli: add test coverage for WithCommands lifecycle #13
Labels
No labels
needs-review
needs-review
needs-review
needs-review
needs-review
needs-review
needs-review
athena
athena-gemini
audit
clotho
clotho-gemini
codex
darbs-claude
security
wiki
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: core/go#13
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
cli.WithCommandsis the core registration pattern for the entire fleet — every domain repo uses it to wire commands through the Core framework lifecycle. But there are no tests for it.The lifecycle path:
cli.Main()creates core services + command servicescli.Init()creates root cobra command, starts servicescommandService.OnStartup()castsCore.Appto*cobra.Commandand calls the register functionProposal
Add tests in
pkg/cli/commands_test.go:TestWithCommands_RegistersOnStartup— verify commands appear on root after startupTestWithCommands_MultipleGroups— verify multipleWithCommandscalls compose correctlyTestWithCommands_GroupWithSubcommands— verify nested group/subcommand registrationTestWithCommands_ExecutesCommand— verify a registered command's RunE is invokedContext
LEM is the first external consumer. go-ml, go-devops, and go-ai will follow. This is the API contract that all domain repos depend on — it needs test coverage before more consumers adopt it.
Acceptance
commands_test.goexists with the above test casesgo test ./pkg/cli/ -run TestWithCommandsCompleted by Charon in
core/cli(e360115). CLI package now lives atforge.lthn.ai/core/cli/pkg/cli, notcore/go/pkg/cli.