Skip to content

Implement Environment Show Command #241

@josecelano

Description

@josecelano

Related:

Overview

Implement a new console command show that displays environment information with state-aware details. The command provides a read-only view of stored environment data without remote verification, making it fast and reliable for users to inspect their deployment state.

Goals

  • Provide console command to display environment information
  • Show state-aware details (different information per state)
  • Use human-friendly output formatting with UserOutput
  • Handle errors gracefully with actionable messages
  • Maintain fast execution (< 100ms for typical environments)
  • Ensure comprehensive test coverage (unit + E2E)

Implementation Plan

Phase 1: Presentation Layer - CLI Skeleton (1-2 hours)

  • Create CLI subcommand structure
  • Add command dispatch
  • Create initial E2E test
  • Manual CLI testing

Phase 2: Application Layer Foundation (2-3 hours)

  • Create ShowCommandHandler
  • Create ShowCommandError enum
  • Create EnvironmentInfo DTO
  • Implement environment loading with error handling
  • Comprehensive unit tests

Phase 3: State-Aware Information Extraction (3-4 hours)

  • Implement state-specific extraction
  • Add infrastructure details for Provisioned state
  • Extract service configuration for Running state
  • Handle all environment states
  • Comprehensive unit tests

Phase 4: Output Formatting (2-3 hours)

  • Implement output formatter using UserOutput
  • Add state-aware formatting
  • Include next-step guidance
  • Visual improvements

Phase 5: Testing Strategy Analysis and Documentation (2-3 hours)

  • Analyze E2E testing strategies
  • Implement chosen strategy
  • Add E2E tests for error scenarios
  • Write user documentation

Phase 6: Add Creation Timestamp (1-2 hours)

  • Add created_at field to Environment domain model
  • Update create command to populate timestamp
  • Update show command to display timestamp

Phase 7: Add Service URLs to RuntimeOutputs (2-3 hours)

  • Add service_endpoints field to RuntimeOutputs
  • Update run command to populate service URLs
  • Update show command to read from RuntimeOutputs

Architecture

DDD Layers: Application + Presentation
Patterns: Command Handler pattern, DTO pattern
Module Paths:

  • src/application/commands/show/
  • src/presentation/input/cli/subcommands/show.rs

Critical Constraints:

  • ⚠️ All output through UserOutput - NEVER use println!/eprintln!
  • No business logic in presentation layer
  • Error handling with explicit enum types (not anyhow)
  • Read-only operation - no state modifications
  • No remote network calls

Acceptance Criteria

✅ Pre-commit checks pass
✅ Command displays environment info for all states
✅ Shows IP, SSH details for Provisioned+ states
✅ Shows service URLs for Running state
✅ Provides next-step guidance
✅ Handles errors with clear messages
✅ All output via UserOutput (no println!)
✅ Follows DDD layer placement
✅ Unit tests with behavior-driven naming
✅ E2E tests for multiple states
✅ User documentation complete

Estimated Duration

Total: 14-22 hours (2-3 days)
Target Completion: January 2026

See full specification at docs/issues/241-implement-environment-show-command.md

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions