Skip to content

Add Purge Command to Remove Local Environment Data #322

@josecelano

Description

@josecelano

Summary

Add a purge command that removes local data for environments in any state, with proper confirmation to prevent accidental data loss.

Specification

See detailed specification: docs/issues/322-add-purge-command-to-remove-local-data.md

Goals

  • Allow users to clean up local environment data without manual file deletion
  • Enable reuse of environment names after destruction
  • Provide safe purging with confirmation prompts
  • Support automation with --force flag

Implementation Plan

Phase 1: Domain Model & Application Layer (2-3 hours)

  • Add purge command to domain model
  • Create PurgeCommand in src/application/command_handlers/purge/
  • Implement PurgeStep that removes local directories
  • Add confirmation logic to presentation layer
  • Support --force flag in CLI arguments

Phase 2: Integration & Testing (1-2 hours)

  • Add purge subcommand to CLI
  • Wire command handler in main application
  • Add unit tests for purge command
  • Add E2E tests in tests/e2e/purge_command.rs (modeled after destroy_command.rs)
  • Test with various environment states

Phase 3: User Experience Enhancements (1 hour)

  • Update destroy command output with purge hint
  • Add helpful error messages
  • Update user documentation
  • Add examples to command help text

Acceptance Criteria

  • purge command removes both data/{env-name}/ and build/{env-name}/ directories
  • Always prompts for confirmation in interactive mode
  • --force flag skips confirmation
  • Works with any environment state
  • Shows appropriate warnings for non-Destroyed states
  • destroy command output hints about purge
  • Unit tests cover all confirmation scenarios
  • E2E tests verify purge workflow (5 test scenarios minimum)
  • Pre-commit checks pass: ./scripts/pre-commit.sh
  • Documentation updated in docs/user-guide/commands/

Related

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions