Skip to content

Refactor memory and profiling CLI command groups#16

Merged
V3RON merged 2 commits into
masterfrom
refactor/nested-memory-profile-cli
May 7, 2026
Merged

Refactor memory and profiling CLI command groups#16
V3RON merged 2 commits into
masterfrom
refactor/nested-memory-profile-cli

Conversation

@V3RON
Copy link
Copy Markdown
Contributor

@V3RON V3RON commented May 7, 2026

Summary

  • Reorganizes the CLI so memory workflows now live under memory snapshot, memory usage, memory allocation, and memory allocation-timeline, while CPU profiling moves under profile cpu.
  • Shrinks the root agent-cdp --help output to top-level groups and examples so the CLI stays discoverable without dumping every leaf command.
  • Removes the separate raw memory capture flow and its unused implementation because memory snapshot capture --file produces the same snapshot artifact and remains the canonical capture path.

Context

This change makes the CLI match the product taxonomy more closely: heap snapshots, heap usage sampling, and allocation analysis now sit together under memory, and CPU profiling is isolated under profile cpu.

The implementation keeps the existing daemon IPC and analysis engines in place, but rewires command registration and help text around the nested groups. It also removes the obsolete raw snapshot code path and updates bundled docs and CLI tests to the new canonical surface.

Backward compatibility: this is an intentional breaking CLI change. The old flat commands (mem-snapshot, js-memory, js-allocation, js-allocation-timeline, js-profile, and raw memory capture) are removed rather than preserved as aliases. Daemon behavior, output semantics for the surviving workflows, and saved snapshot/profile artifact formats remain unchanged.

Risks

  • Any scripts, prompts, or docs that still invoke the removed flat command names will fail until updated.
  • Reviewers should pay extra attention to command discovery and subgroup help output, since the root help is now deliberately compact and depends on users drilling into subgroup help.
  • The raw export-only heap snapshot workflow is gone; users needing a saved snapshot file must now use memory snapshot capture --file.

Manual testing

  1. Start the daemon and select a target with agent-cdp start, agent-cdp target list, and agent-cdp target select <id>.
  2. Run agent-cdp --help, agent-cdp memory --help, and agent-cdp profile cpu --help and verify the root help is compact while subgroup help exposes the detailed command surface.
  3. Capture a heap snapshot with agent-cdp memory snapshot capture --name baseline --gc --file /tmp/baseline.heapsnapshot, then verify agent-cdp memory snapshot list and agent-cdp memory snapshot summary can inspect it.
  4. Run agent-cdp memory usage sample --label baseline and agent-cdp memory usage summary to confirm the nested usage commands still work against the daemon-backed state.
  5. If you have a workload to profile, run agent-cdp memory allocation start / stop, agent-cdp memory allocation summary, and agent-cdp profile cpu start / stop / hotspots to confirm the new command paths reach the existing analyzers.

@V3RON V3RON merged commit 449151f into master May 7, 2026
4 checks passed
@V3RON V3RON deleted the refactor/nested-memory-profile-cli branch May 7, 2026 14:28
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