Overview
Implement the presentation layer for the provision console command to enable users to provision VM infrastructure from the CLI. The application layer ProvisionCommandHandler is already implemented - this task focuses on creating the console interface (CLI command, controller, router integration, and user interaction).
Specification
See detailed specification: docs/issues/implement-provision-console-command.md
(Link will be updated after issue number is assigned and file is renamed)
🏗️ Architecture Requirements
DDD Layer: Presentation
Module Path: src/presentation/
Pattern: CLI Subcommand + Controller (single command pattern)
Module Structure Requirements
Architectural Constraints
Anti-Patterns to Avoid
- ❌ Implementing provisioning logic in controller (already in
ProvisionCommandHandler)
- ❌ Direct infrastructure access from presentation layer
- ❌ Using
anyhow for command-specific errors
- ❌ Mixing routing and execution logic
Implementation Plan
Phase 1: CLI Command Definition (30 minutes)
Phase 2: Controller Structure (1 hour)
Phase 3: Controller Handler (2 hours)
Phase 4: Router Integration (30 minutes)
Phase 5: Testing (1.5 hours)
Phase 6: Documentation and Review (30 minutes)
Phase 7: Manual End-to-End Testing (45 minutes)
Perform complete workflow testing to verify the provision command integrates correctly with create and destroy commands:
Acceptance Criteria
Note for Contributors: These criteria define what the PR reviewer will check. Use this as your pre-review checklist before submitting the PR to minimize back-and-forth iterations.
Quality Checks:
CLI Integration:
Controller Implementation:
Router Integration:
Error Handling:
Testing:
Code Quality:
User Experience:
Related
Overview
Implement the presentation layer for the
provisionconsole command to enable users to provision VM infrastructure from the CLI. The application layerProvisionCommandHandleris already implemented - this task focuses on creating the console interface (CLI command, controller, router integration, and user interaction).Specification
See detailed specification: docs/issues/implement-provision-console-command.md
(Link will be updated after issue number is assigned and file is renamed)
🏗️ Architecture Requirements
DDD Layer: Presentation
Module Path:
src/presentation/Pattern: CLI Subcommand + Controller (single command pattern)
Module Structure Requirements
ExecutionContextpattern for dependency injectionArchitectural Constraints
ProvisionCommandHandlerProvisionCommandHandlerUserOutputtrait - Consistent output formattingAnti-Patterns to Avoid
ProvisionCommandHandler)anyhowfor command-specific errorsImplementation Plan
Phase 1: CLI Command Definition (30 minutes)
Provisionvariant toCommandsenum insrc/presentation/input/cli/commands.rscargo buildPhase 2: Controller Structure (1 hour)
src/presentation/controllers/provision/directorymod.rswith module exportserrors.rswithProvisionSubcommandErrorenumhelp()method for all error variantsDisplayandErrortraitsFromconversions for error typesPhase 3: Controller Handler (2 hours)
handler.rswith mainhandle()functionProvisionCommandHandler::execute()Phase 4: Router Integration (30 minutes)
provisionmodule tosrc/presentation/controllers/mod.rssrc/presentation/dispatch/router.rswith provision routeCommandErrorif needed for provision errorsPhase 5: Testing (1.5 hours)
src/presentation/controllers/provision/tests/mod.rsPhase 6: Documentation and Review (30 minutes)
Phase 7: Manual End-to-End Testing (45 minutes)
Perform complete workflow testing to verify the provision command integrates correctly with create and destroy commands:
Created)Provisioned, instance IP saved)Acceptance Criteria
Quality Checks:
./scripts/pre-commit.shCLI Integration:
torrust-tracker-deployer provision <environment>command is availabletorrust-tracker-deployer provision --helpshows clear documentationController Implementation:
ExecutionContextpatternRouter Integration:
Error Handling:
Testing:
Code Quality:
User Experience:
Related