Skip to content

cli/serviceability: move per-resource subcommand wrappers into module crate#3759

Open
juan-malbeclabs wants to merge 1 commit into
jo/6-docs-cli-standardfrom
jo/7-cli-serviceability-move-cli-files
Open

cli/serviceability: move per-resource subcommand wrappers into module crate#3759
juan-malbeclabs wants to merge 1 commit into
jo/6-docs-cli-standardfrom
jo/7-cli-serviceability-move-cli-files

Conversation

@juan-malbeclabs
Copy link
Copy Markdown
Contributor

@juan-malbeclabs juan-malbeclabs commented May 22, 2026

RFC-20 implementation stack

This PR is part of a 9-PR chain delivering RFC-20: CLI standardization. Each PR's diff is only its own contribution; reviewers should consume them in order.

# PR Scope
1 #3753 doublezero-cli-core foundation crate + solana_l1_rpc_url
2 #3754 --solana-url + --log-verbose global flags + tracing init
3 #3755 CliContext built in main + centralized error rendering
4 #3756 rename doublezero_clidoublezero-serviceability-cli
5 #3757 rewrite location get as the async + CliContext reference verb
6 #3758 docs/cli-standard.md + CLAUDE.md pointer
7 #3759 move per-resource subcommand wrappers into the module crate
8 #3760 add ServiceabilityCommand enum + async dispatcher
9 #3761 #[command(flatten)] + collapse binary dispatch

This PR: #3759 — position 7 of 9. Previous: #3758 · Next: #3760


Summary of Changes

  • Moves the 13 per-resource serviceability subcommand wrapper files (accesspass, config, contributor, device, exchange, globalconfig, link, location, multicastgroup, permission, resource, tenant, user) from client/doublezero/src/cli/ into the doublezero-serviceability-cli module crate at smartcontract/cli/src/cli/, per RFC-20 §Module contract item 2 ("the module crate exports the subcommand enum").
  • Adds smartcontract/cli/src/cli/mod.rs and pub mod cli; in the library's lib.rs so the new module is reachable.
  • Rewrites import paths in the moved files (doublezero_serviceability_cli::<resource>::* -> crate::<resource>::*) and in the binary (client/doublezero/src/{cli/command.rs,main.rs} switch to doublezero_serviceability_cli::cli::<resource>::* for the moved types).
  • cli/multicast.rs stays in the binary: its Subscribe, Unsubscribe, Publish, and Unpublish variants are async and their execute impls live in client/doublezero/src/command/multicast.rs (binary-local), depending on ServiceControllerImpl and crate::command::helpers::resolve_client_ip. The binary's cli/multicast.rs now imports MulticastGroupCliCommand from the library.
  • No Command enum reshape, no main.rs dispatch change. Pure file relocation. The next PR adds the top-level ServiceabilityCommand enum; the PR after that wires it into the binary via #[command(flatten)] and collapses the dispatch.

Diff Breakdown

Category Files Lines (+/-) Net
Scaffolding 19 +75 / -32 +43
Docs 1 +1 / -0 +1
Total 20 +76 / -32 +44

Pure file moves (tracked as renames in git, ~95% similarity each) plus import-path rewrites in the binary and the new library cli/mod.rs. Behavior unchanged.

Key files (click to expand)
  • smartcontract/cli/src/cli/mod.rs (new) - declares the 13 moved modules.
  • smartcontract/cli/src/lib.rs - adds pub mod cli;.
  • client/doublezero/src/cli/mod.rs - keeps only command, geolocation, and multicast (the binary-local ones).
  • client/doublezero/src/cli/command.rs - imports MulticastCliCommand from crate::cli and the 13 moved types from doublezero_serviceability_cli::cli::*.
  • client/doublezero/src/cli/multicast.rs - imports MulticastGroupCliCommand from the library.
  • client/doublezero/src/main.rs - imports the moved subcommand enums (DeviceCommands, LinkCommands, ...) from doublezero_serviceability_cli::cli::*; the per-resource match arms switch from cli::<resource>::*Commands::* to doublezero_serviceability_cli::cli::<resource>::*Commands::*.

Testing Verification

  • cargo check --workspace clean.
  • make rust-test green workspace-wide (including the cargo test -p doublezero-serviceability-cli location::get reference verb).
  • make rust-lint clean.
  • cargo run -p doublezero -- --help and cargo run -p doublezero -- device list --help produce the same command tree as before; the relocation is invisible to users.
  • Targets jo/6-docs-cli-standard; the diff shown is only this PR's contribution. Follow-ups #PR8 (add ServiceabilityCommand enum) and #PR9 (flatten in binary + collapse dispatch) complete the RFC-20 §Module contract item 2 work.

@juan-malbeclabs juan-malbeclabs force-pushed the jo/7-cli-serviceability-move-cli-files branch from f274db8 to 17d3095 Compare May 24, 2026 14:42
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