Skip to content

refactor(cli): simplify command composition - #2606

Open
codyhartsook wants to merge 16 commits into
kagent-dev:mainfrom
codyhartsook:api-v2-cli-pr3
Open

refactor(cli): simplify command composition#2606
codyhartsook wants to merge 16 commits into
kagent-dev:mainfrom
codyhartsook:api-v2-cli-pr3

Conversation

@codyhartsook

@codyhartsook codyhartsook commented Aug 27, 2026

Copy link
Copy Markdown

Summary

  • Reduces cmd/kagent/main.go to a small entrypoint backed by a reusable root command
  • Flattens and colocates command constructors under a consistent internal command structure
  • Keeps root.go focused on composition while each command owns its Cobra wiring and flags
  • Centralizes connection flags, session setup, and output handling
  • Aligns CLI command composition with the agentregistry layout

The resulting boundary is intentionally small: Root() creates a fresh command tree, command packages own command-specific setup, and the shared connection package owns gRPC, TLS, and temporary port-forward setup. This removes package-level CLI flag state and keeps command behavior out of main.go.

tui-recording-pr.mp4

This is the third of three related CLI PRs and builds on #2559 and #2605. When reviewed as a stack, the changes unique to this PR are structural; the API v2 workflows and AgentInstance TUI behavior live in the first two PRs.

Related to #2366 and the K13 CLI cutover in docs/plans/api-v2-execution-plan.md.

Test plan

  • make -C go test
  • go test ./core/cli/...
  • make -C go lint
  • make -C go build
  • API v2 E2E suite against a refreshed local Kind cluster
  • CLI and AgentInstance TUI smoke tests against a local installation

Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
@codyhartsook
codyhartsook requested a review from a team as a code owner August 27, 2026 20:45
@codyhartsook codyhartsook changed the title refactor(cli): align command composition with agentregistry refactor(cli): simplify command composition Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant