Skip to content

Refactor CLI command registration around commander#15

Merged
V3RON merged 3 commits intomasterfrom
feat/cli-commander
May 7, 2026
Merged

Refactor CLI command registration around commander#15
V3RON merged 3 commits intomasterfrom
feat/cli-commander

Conversation

@V3RON
Copy link
Copy Markdown
Contributor

@V3RON V3RON commented May 6, 2026

Summary

  • Migrate the agent-cdp CLI to Commander so command parsing and validation live behind a dedicated src/cli/ Module family instead of a single hand-rolled dispatcher.
  • Preserve the existing top-level help text, including the agent guidance to run agent-cdp skills get core, while keeping the current command names, flags, IPC payloads, and formatter output paths.
  • Add focused CLI tests for preserved help output, Commander-backed dispatch, and the existing auto-target-selection behavior.

Backward Compatibility

  • Existing command names, flag names, daemon IPC commands, and formatter-driven output remain compatible.
  • The top-level help output still includes the full legacy command reference and agent guidance text.
  • Error wording now comes from Commander for some parse failures and unknown commands/options, so exact error text may differ slightly even though the workflows and required flags remain the same.
  • No daemon lifecycle, saved artifact format, or command defaults changed.

Risks

  • Commander now owns parsing, so there is some regression risk around edge-case flag handling and parse-error wording.
  • The custom top-level help is preserved by intercepting help requests before command execution, which could behave differently from the old parser for unusual argument values that literally equal --help.
  • The CLI is now split across multiple command-family Modules, so future command additions need to follow the new registration pattern to keep locality.

Manual Testing

Setup:

  • Use a checkout of this branch with dependencies installed.
  • Have any CDP target available if you want to smoke-test target-aware commands.

Scenario:

  1. Run pnpm test, pnpm typecheck, and pnpm build from the repo root and verify they all succeed.
  2. Run pnpm agent-cdp -- help and verify the output still includes the full command list plus the instruction for LLM agents to run agent-cdp skills get core.
  3. Run pnpm agent-cdp -- target list --url http://127.0.0.1:9222 and verify the command still accepts the existing flag shape and prints the usual target formatter output.
  4. Run pnpm agent-cdp -- runtime eval --expr "process.version" against a selected target and verify the command still routes through the daemon and prints the existing runtime formatter output.

V3RON added 3 commits May 6, 2026 16:24
Preserve normal help and version exits so grouped commands do not fail and Commander errors are not printed twice. Add regression coverage for help routing, version handling, and missing required options.
@V3RON V3RON merged commit bc2a77b into master May 7, 2026
4 checks passed
@V3RON V3RON deleted the feat/cli-commander branch May 7, 2026 12:58
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