Overview
Add optional FormatterOverride trait support to enable alternative output formats (JSON, structured logs, colored output) without modifying individual message types. This enhancement preserves the trait-based message design (Proposal 3) while allowing format transformation for machine-readable outputs.
Note: This is an optional enhancement that builds on the existing trait-based design. The current implementation using Theme and OutputMessage trait already provides good separation and flexibility. This proposal is only needed if we require format overrides beyond what themes provide (e.g., JSON output, ANSI color codes, structured logging).
Specification
See detailed specification: docs/issues/133-add-formatter-override-support.md
🏗️ Architecture Requirements
DDD Layer: Presentation
Module Path: src/presentation/user_output.rs
Pattern: Trait-based Extension (Strategy Pattern)
Key Requirements
Implementation Plan
Phase 1: Core Trait and Integration (2-3 hours)
Phase 2: Example Implementation (1-2 hours)
Phase 3: Testing (2-3 hours)
Phase 4: Documentation (1 hour)
Acceptance Criteria
Quality Checks:
Task-Specific Criteria:
Related
Overview
Add optional
FormatterOverridetrait support to enable alternative output formats (JSON, structured logs, colored output) without modifying individual message types. This enhancement preserves the trait-based message design (Proposal 3) while allowing format transformation for machine-readable outputs.Note: This is an optional enhancement that builds on the existing trait-based design. The current implementation using
ThemeandOutputMessagetrait already provides good separation and flexibility. This proposal is only needed if we require format overrides beyond what themes provide (e.g., JSON output, ANSI color codes, structured logging).Specification
See detailed specification: docs/issues/133-add-formatter-override-support.md
🏗️ Architecture Requirements
DDD Layer: Presentation
Module Path:
src/presentation/user_output.rsPattern: Trait-based Extension (Strategy Pattern)
Key Requirements
OutputMessagetrait designOption<Box<dyn FormatterOverride>>)Implementation Plan
Phase 1: Core Trait and Integration (2-3 hours)
FormatterOverridetrait with comprehensive documentationformatter_overridefield toUserOutputwrite()method to apply override when presentPhase 2: Example Implementation (1-2 hours)
JsonFormatterwithFormatterOverridetraitPhase 3: Testing (2-3 hours)
FormatterOverridetrait behaviorJsonFormatteroutput structurePhase 4: Documentation (1 hour)
Acceptance Criteria
Quality Checks:
./scripts/pre-commit.shTask-Specific Criteria:
FormatterOverridetrait is properly documentedJsonFormatterproduces valid JSON with all required fieldsRelated