Skip to content

refactor(cli): extract provider commands into commands/provider module - #2605

Open
varshaprasad96 wants to merge 1 commit into
NVIDIA:mainfrom
varshaprasad96:vnarsing/cli-refactor-3
Open

refactor(cli): extract provider commands into commands/provider module#2605
varshaprasad96 wants to merge 1 commit into
NVIDIA:mainfrom
varshaprasad96:vnarsing/cli-refactor-3

Conversation

@varshaprasad96

Copy link
Copy Markdown
Contributor

Summary

  • Extract all provider-related functions, helpers, constants, structs, and tests (~2,700 lines) from the monolithic run.rs into a dedicated commands/provider.rs module
  • Add pub use re-exports in run.rs so main.rs requires zero changes — all call sites continue using run::provider_create(...) etc.
  • Clean up unused imports in run.rs (provider proto types, openshell_providers, dialoguer::Confirm, HashSet, etc.)

Related Issue

Part of #2304 — CLI refactor series PR3 (provider commands). PRs 1–2 (scaffolding + gateway) are merged.

Changes

File Change
crates/openshell-cli/src/commands/mod.rs Add pub mod provider;
crates/openshell-cli/src/commands/provider.rs New — 2,671 lines: 24 public functions/structs, 27 private helpers/constants, 22 tests
crates/openshell-cli/src/run.rs Remove ~2,700 lines of provider code, add re-exports, clean unused imports

Not changed

  • main.rs — all calls go through run:: re-exports, no changes needed
  • No behavioral changes — pure mechanical code move with visibility adjustments

Testing

  • cargo check -p openshell-cli — zero errors, zero warnings
  • cargo test -p openshell-cli — all 211 tests pass (22 provider tests running from new location under commands::provider::tests)
  • mise run pre-commit — all lint, format, and license checks pass
  • Verified all 22 pub use re-exports match the 19 call sites in main.rs plus internal cross-module usage

Checklist

  • Follows Conventional Commits format
  • Follows the extraction pattern established in PR2 (gateway.rs)
  • DCO sign-off included
  • No AI attribution in commits
  • Pre-commit checks pass

Move all provider-related functions, helpers, constants, and tests from
the monolithic run.rs (~2,700 lines) into a dedicated
commands/provider.rs module. This is PR3 of the CLI refactor series
(issue NVIDIA#2304).

The extraction follows the same pattern established in PR2 (gateway):
- Self-contained module with own imports
- pub use re-exports in run.rs so callers (main.rs) are unchanged
- Inline #[cfg(test)] mod tests

Signed-off-by: Varsha Prasad Narsing <vnarsing@nvidia.com>
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

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