Add Developer Documentation for Destroy Command
Issue Type: Sub-issue (9.3)
Parent Epic: #9 (epic-app-layer-destroy-command.md)
Related Roadmap: Section 1.2
Dependencies: Issue #11 and #12 should be completed first
Priority: Medium
Estimated Effort: 2-3 hours
📋 Issue Overview
Document the destroy command implementation for developers. This includes architecture decisions, usage examples, error handling patterns, and E2E testing integration.
The documentation will help current and future developers understand how to use, maintain, and extend the destroy command functionality.
🎯 Goals
- Document destroy command architecture and design decisions
- Provide code examples for using
DestroyCommand in development
- Document error handling patterns and best practices
- Update E2E testing documentation with destroy functionality
- Ensure all documentation passes linting requirements
📦 Scope
Core Documentation
The documentation will be organized across three distinct locations:
- Internal Contributors:
docs/contributing/ - Developer-focused implementation details
- Decision Records:
docs/decisions/ - Architectural decisions and rationale
- User-Facing:
docs/user-guide/ - End-user command documentation
Documentation Locations
docs/contributing/commands.md - Single developer guide covering all commands (update existing or create new)
docs/decisions/ - Architectural decision records (if significant decisions are made)
docs/user-guide/commands/destroy.md - User-facing command documentation
docs/user-guide/commands.md - Command index with descriptions and links
- Updated E2E testing documentation
Content Structure
- Architecture Overview: How the destroy command fits into DDD layers
- Usage Examples: Code examples for developers
- Error Handling: Patterns and best practices
- Testing Integration: How destroy command integrates with E2E tests
- Troubleshooting: Common issues and solutions
🏗️ Documentation Structure
New Documentation Files
1. Internal Contributors Documentation: docs/contributing/commands.md
Single developer guide covering all commands (add destroy command section):
- Command Architecture: How all commands fit into DDD Application Layer patterns
- Destroy Command Implementation: Architecture, error handling, testing patterns
- Code Usage: Internal API usage examples for developers (not CLI usage)
- Testing Strategies: Unit test patterns, mock strategies, integration approaches
- Debugging and Development: Internal troubleshooting for contributors
2. User-Facing Documentation: docs/user-guide/commands/destroy.md
End-user command reference covering:
- Command syntax and options
- Usage examples and workflows
- Common use cases and scenarios
- Error messages and troubleshooting
- Safety considerations and best practices
3. Command Index: docs/user-guide/commands.md
Master command reference covering:
- List of all available commands with short descriptions
- Links to detailed command documentation
- Command categories and workflows
- Getting started guide
Updated Files
docs/contributing/testing.md
Add section on:
- Destroy command testing approaches
- E2E integration patterns
- Mock strategies for unit tests
docs/e2e-testing.md
Update with:
- New destroy functionality in E2E tests
- Updated test flow documentation
- Troubleshooting destroy-related test issues
docs/decisions/ (if needed)
Create ADRs for any significant architectural decisions made during implementation.
📋 Content Requirements
1. Internal Contributors Documentation (docs/contributing/commands.md)
Add Destroy Command Section
Add a new section to the existing (or create new) commands developer guide:
Architecture Documentation
Document how DestroyCommand integrates with existing command patterns:
- How it follows established DDD Application Layer patterns (like
ProvisionCommand, ConfigCommand)
- Integration with existing infrastructure services (OpenTofu client, state management)
- Error handling and recovery patterns specific to destroy operations
- Command composition and orchestration within the application layer
Internal API Usage Examples
Provide code examples for developers working on the codebase:
// How to use DestroyCommand in application layer code
use crate::application::commands::destroy::DestroyCommand;
async fn destroy_environment(environment_name: &str) -> Result<(), DestroyError> {
let destroy_command = DestroyCommand::new(environment_name)?;
destroy_command.execute().await
}
// How to integrate with E2E tests
async fn cleanup_test_environment(env: &Environment) -> Result<(), DestroyError> {
let destroy_cmd = DestroyCommand::for_environment(env);
destroy_cmd.execute().await
}
Error Handling Patterns for Developers
Document internal error handling (not user-facing):
- Error types and their meanings for developers
- Recovery strategies for partial failures in code
- Logging patterns for debugging and development
- How internal errors map to user-facing messages
- Testing error scenarios
Testing Integration for Contributors
Explain testing approaches for developers:
- How destroy command integrates with E2E test infrastructure
- Unit testing strategies and mock patterns
- Integration testing approaches
- CI/CD considerations for contributors
2. User-Facing Documentation (docs/user-guide/commands/destroy.md)
Command Reference
Document:
- Command syntax:
torrust-tracker-deployer destroy <ENVIRONMENT_NAME>
- Available options and flags
- Output format and progress indicators
- Exit codes and their meanings
Usage Examples
Provide practical examples:
# Basic usage
torrust-tracker-deployer destroy my-environment
# Example with verbose output (future)
torrust-tracker-deployer destroy my-environment --verbose
User Scenarios
Cover common use cases:
- Cleaning up after testing
- Removing failed deployments
- Scheduled environment cleanup
- Emergency teardown procedures
Troubleshooting
User-focused troubleshooting:
- Common error messages and solutions
- What to do when destroy fails
- How to verify complete cleanup
- When to contact support
3. Command Index (docs/user-guide/commands.md)
Command Overview
Provide a structured command reference:
# Available Commands
## Environment Management
- **[`provision`](commands/provision.md)** - Deploy new environments with infrastructure and applications
- **[`destroy`](commands/destroy.md)** - Remove environments and clean up all resources
- **[`configure`](commands/configure.md)** - Update configuration for existing environments
## Getting Started
For first-time users, we recommend starting with the `provision` command to create your first environment...
📋 Acceptance Criteria
Internal Contributors Documentation
User-Facing Documentation
Updated Documentation
Quality Standards
🧪 Documentation Quality Standards
Writing Guidelines
- Follow existing documentation style and structure
- Use clear, concise language
- Provide practical examples
- Include troubleshooting information
- Ensure accessibility for developers at different experience levels
Code Examples
- All code examples must be syntactically correct
- Include complete, runnable examples where possible
- Show both successful and error scenarios
- Follow project coding conventions
Linking and Cross-References
- Link to related documentation sections
- Reference relevant ADRs (Architectural Decision Records)
- Cross-reference with existing guides
- Ensure all links are valid and up-to-date
🔗 Dependencies
📝 Implementation Notes
Documentation Organization by Audience
Internal Contributors (docs/contributing/commands.md)
- Add destroy command section to existing (or create new) single commands developer guide
- Follow established pattern with clear headings and subheadings
- Provide quick reference sections for developers working on the codebase
- Use code blocks with proper syntax highlighting for internal API usage
- Focus on implementation details, architecture patterns, and contributor concerns
- Exclude user-facing information like CLI usage examples, command syntax, etc.
User-Facing (docs/user-guide/)
- Use simple, clear language suitable for end users
- Provide step-by-step instructions and examples
- Focus on practical usage and common scenarios
- Include troubleshooting sections with solutions
- Minimize technical jargon
Decision Records (docs/decisions/)
- Follow ADR template if significant architectural decisions are made
- Document rationale and alternatives considered
- Include consequences and future implications
File Structure to Create
docs/
├── contributing/
│ ├── commands.md (update existing or create new - single doc for all commands)
│ └── testing.md (updated)
├── user-guide/
│ ├── commands.md (new/updated)
│ └── commands/
│ └── destroy.md (new)
├── decisions/
│ └── [any-new-adrs].md (if needed)
└── e2e-testing.md (updated)
Integration with Existing Docs
Ensure seamless integration with:
- Existing command documentation patterns
- Error handling guides and conventions
- Testing conventions and E2E documentation
- Development principles and style guides
- Cross-reference with provision and configure command docs
Examples and Snippets
Include practical examples for:
- Basic destroy command usage
- Error handling and recovery
- Integration with existing services
- Testing patterns and mocks
🚀 Next Steps
After completing this documentation:
- Review documentation with team for accuracy and completeness
- Integrate feedback and revisions
- Ensure documentation stays up-to-date as destroy command evolves
- Consider adding video tutorials or interactive examples for complex topics
📊 Related Documentation
Issue Document: docs/issues/epic-app-layer-destroy-command-add-developer-documentation.md
Add Developer Documentation for Destroy Command
Issue Type: Sub-issue (9.3)
Parent Epic: #9 (
epic-app-layer-destroy-command.md)Related Roadmap: Section 1.2
Dependencies: Issue #11 and #12 should be completed first
Priority: Medium
Estimated Effort: 2-3 hours
📋 Issue Overview
Document the destroy command implementation for developers. This includes architecture decisions, usage examples, error handling patterns, and E2E testing integration.
The documentation will help current and future developers understand how to use, maintain, and extend the destroy command functionality.
🎯 Goals
DestroyCommandin development📦 Scope
Core Documentation
The documentation will be organized across three distinct locations:
docs/contributing/- Developer-focused implementation detailsdocs/decisions/- Architectural decisions and rationaledocs/user-guide/- End-user command documentationDocumentation Locations
docs/contributing/commands.md- Single developer guide covering all commands (update existing or create new)docs/decisions/- Architectural decision records (if significant decisions are made)docs/user-guide/commands/destroy.md- User-facing command documentationdocs/user-guide/commands.md- Command index with descriptions and linksContent Structure
🏗️ Documentation Structure
New Documentation Files
1. Internal Contributors Documentation:
docs/contributing/commands.mdSingle developer guide covering all commands (add destroy command section):
2. User-Facing Documentation:
docs/user-guide/commands/destroy.mdEnd-user command reference covering:
3. Command Index:
docs/user-guide/commands.mdMaster command reference covering:
Updated Files
docs/contributing/testing.mdAdd section on:
docs/e2e-testing.mdUpdate with:
docs/decisions/(if needed)Create ADRs for any significant architectural decisions made during implementation.
📋 Content Requirements
1. Internal Contributors Documentation (
docs/contributing/commands.md)Add Destroy Command Section
Add a new section to the existing (or create new) commands developer guide:
Architecture Documentation
Document how
DestroyCommandintegrates with existing command patterns:ProvisionCommand,ConfigCommand)Internal API Usage Examples
Provide code examples for developers working on the codebase:
Error Handling Patterns for Developers
Document internal error handling (not user-facing):
Testing Integration for Contributors
Explain testing approaches for developers:
2. User-Facing Documentation (
docs/user-guide/commands/destroy.md)Command Reference
Document:
torrust-tracker-deployer destroy <ENVIRONMENT_NAME>Usage Examples
Provide practical examples:
User Scenarios
Cover common use cases:
Troubleshooting
User-focused troubleshooting:
3. Command Index (
docs/user-guide/commands.md)Command Overview
Provide a structured command reference:
📋 Acceptance Criteria
Internal Contributors Documentation
docs/contributing/commands.mdUser-Facing Documentation
docs/user-guide/commands/destroy.mddocs/user-guide/commands.mdUpdated Documentation
docs/contributing/testing.mdQuality Standards
🧪 Documentation Quality Standards
Writing Guidelines
Code Examples
Linking and Cross-References
🔗 Dependencies
📝 Implementation Notes
Documentation Organization by Audience
Internal Contributors (
docs/contributing/commands.md)User-Facing (
docs/user-guide/)Decision Records (
docs/decisions/)File Structure to Create
Integration with Existing Docs
Ensure seamless integration with:
Examples and Snippets
Include practical examples for:
🚀 Next Steps
After completing this documentation:
📊 Related Documentation
Issue Document: docs/issues/epic-app-layer-destroy-command-add-developer-documentation.md