Skip to content

Conversation

@josecelano
Copy link
Member

Summary

Implements the list command to display all environments in the workspace, as specified in issue #260.

Changes

Application Layer

  • Add ListCommandHandler with directory scanning logic
  • Add EnvironmentList and EnvironmentSummary DTOs for data transfer
  • Add ListCommandHandlerError with comprehensive help messages

Domain Layer

  • Add state_display_name() method to AnyEnvironmentState for human-readable state names
  • Add provider_display_name() method to ProviderConfig and AnyEnvironmentState
  • Remove duplicated format_provider_name() function from show handler (moved to domain layer)

Presentation Layer

  • Add ListCommandController orchestrating the two-step workflow
  • Add EnvironmentListView for table rendering
  • Add ListSubcommandError with detailed .help() methods
  • Register list command in CLI parser and router
  • Integrate into Container for dependency injection

Features

  • Scans data/ directory for environment.json files
  • Displays formatted table with:
    • Environment name
    • Current state (Created, Provisioned, Configured, Released, Running, Destroyed)
    • Provider (LXD, Hetzner Cloud)
    • Creation timestamp (ISO 8601)
  • Handles empty workspaces with helpful guidance
  • Reports partial failures (corrupted environments) without stopping
  • No network calls (read-only local operation)

Example Output

Environments (3 found):

Name                 State              Provider       Created
────────────────────────────────────────────────────────────────────────────────
production           Running            Hetzner Cloud  2026-01-05T10:30:00Z
staging              Provisioned        LXD            2026-01-06T14:15:30Z
dev-test             Created            LXD            2026-01-07T09:00:12Z

Testing

  • All pre-commit checks pass (linters, 1648 unit tests, doctests, E2E tests)
  • Manual testing with various workspace states

Related Issue

Closes #260

Add 'list' command to display all environments in the workspace.

Application Layer:
- Add ListCommandHandler with directory scanning logic
- Add EnvironmentList and EnvironmentSummary DTOs
- Add ListCommandHandlerError with comprehensive help messages

Domain Layer:
- Add state_display_name() to AnyEnvironmentState
- Add provider_display_name() to ProviderConfig and AnyEnvironmentState
- Remove duplicated format_provider_name() from show handler

Presentation Layer:
- Add ListCommandController orchestrating the workflow
- Add EnvironmentListView for table rendering
- Add ListSubcommandError with help() methods
- Register 'list' command in CLI parser and router
- Integrate into Container for dependency injection

Features:
- Scans data/ directory for environment.json files
- Displays table with name, state, provider, created_at
- Handles empty workspaces with helpful guidance
- Reports partial failures without stopping
- No network calls (read-only local operation)
@josecelano josecelano self-assigned this Jan 7, 2026
ProgressReporter.complete_step() and sub_step() were incorrectly
using output.result() (stdout) instead of output.progress() (stderr).

This caused progress indicators like '✓ Found 2 environment(s)' to
appear on stdout, making it impossible to pipe clean command output.

Now running 'cargo run -- list 2>/dev/null' shows only the actual
result data, with all progress messages properly going to stderr.
@josecelano
Copy link
Member Author

ACK 77fba2c

@josecelano josecelano merged commit ba3579b into main Jan 7, 2026
34 checks passed
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.

Implement Environment List Command

2 participants