Skip to content

Proposal 1: Create Input Layer #155

Closed

Description

@josecelano

Overview

Establish an explicit Input Layer in the presentation structure by creating src/presentation/input/ and moving the CLI module there. This is the first step in transforming the presentation layer into a four-layer architecture (Input → Dispatch → Controllers → Views).

Parent Epic: #154 - Presentation Layer Reorganization
Related: Refactor Plan | Design Proposal

Impact: 🟢🟢 Medium - Clear separation of user input parsing from command execution
Effort: 🔵🔵 Medium - Straightforward move with import updates
Estimated Time: 2-3 hours

Goals

  • Create src/presentation/input/ directory with proper module structure
  • Move src/presentation/cli/ to src/presentation/input/cli/
  • Update all imports from presentation::cli to presentation::input::cli
  • Add module documentation explaining the input layer's purpose
  • Document this as first step in refactor plan
  • Ensure old structure (commands/, user_output/) remains functional

🏗️ Architecture Requirements

DDD Layer: Presentation
Module Path: src/presentation/input/
Pattern: Input Layer (Layer 1 of 4-layer presentation architecture)

Target Structure

After this proposal:

src/presentation/
├── input/                    # ← NEW: Layer 1 - Input parsing
│   ├── mod.rs                #    Re-exports cli module
│   └── cli/                  #    ← MOVED from presentation/cli/
│       ├── mod.rs            #    Main CLI structure
│       └── global.rs         #    Global arguments
├── commands/                 # ← UNCHANGED (for now)
├── user_output/              # ← UNCHANGED (for now)
├── progress.rs               # ← UNCHANGED (for now)
└── errors.rs                 # ← UNCHANGED

Implementation Plan

Phase 1: Create Directory Structure (30 minutes)

  • Create src/presentation/input/ directory
  • Create src/presentation/input/mod.rs with module documentation
  • Verify directory structure

Phase 2: Move CLI Module (30 minutes)

  • Move src/presentation/cli/ to src/presentation/input/cli/
  • Verify files moved correctly
  • Remove old src/presentation/cli/ directory

Phase 3: Update Imports (60 minutes)

  • Update src/presentation/mod.rs: pub mod input;
  • Update src/main.rs: use torrust_tracker_deployer_lib::presentation::input::cli::Cli;
  • Search for all usages: rg "use.*presentation::cli" --type rust
  • Update each file found with new path presentation::input::cli

Phase 4: Documentation Updates (30 minutes)

  • Add completion note to refactor plan
  • Update README.md if it references presentation structure
  • Verify all documentation links still work

Phase 5: Testing & Verification (30 minutes)

  • Run pre-commit checks: ./scripts/pre-commit.sh
  • Verify all commands work: cargo run -- --help, etc.
  • Verify no compilation warnings

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.

Quality Checks:

  • Pre-commit checks pass: ./scripts/pre-commit.sh

Structure:

  • src/presentation/input/ directory exists
  • src/presentation/input/mod.rs contains module documentation
  • src/presentation/input/cli/ contains moved CLI module
  • Old src/presentation/cli/ directory removed

Imports:

  • All imports updated from presentation::cli to presentation::input::cli
  • No references to old path remain
  • cargo build completes without warnings

Functionality:

  • All CLI commands work as before
  • --help output unchanged
  • Command execution unchanged
  • Old structure (commands/, user_output/) still functional

Documentation:

  • input/mod.rs explains input layer purpose
  • References refactor plan for context
  • Refactor plan updated with completion status
  • No broken documentation links

Mergeable State:

  • Code compiles without warnings
  • All tests pass
  • Documentation accurate
  • Ready to merge to main
  • No intermediate or broken state

📚 Related Documentation


Created: November 6, 2025
Next Action: Begin Phase 1 (Create Directory Structure)

Activity

  1. added a commit that references this issue on Nov 7, 2025
  2. added a commit that references this issue on Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions