Overview
Add machine-readable JSON output format (--json flag) to the create command. This enables automation workflows to programmatically extract environment creation details like paths, configuration references, and initial state.
Specification
See detailed specification: docs/issues/add-json-output-to-create-command.md
(Link will be updated after file rename with issue number)
🏗️ Architecture Requirements
DDD Layer: Presentation (src/presentation/)
Module Path: src/presentation/views/commands/create/
Pattern: MVC - View layer with format switching
Prerequisites
⚠️ Refactoring Required First: The create command currently violates MVC separation by embedding output formatting in the controller. Before adding JSON support, we must extract the view layer to match the pattern used by provision, list, and show commands.
Module Structure Requirements
Architectural Constraints
Anti-Patterns to Avoid
- ❌ Adding JSON support without extracting view layer first
- ❌ Mixing format switching logic into controller
- ❌ Creating technical debt by entrenching mixed concerns
Implementation Plan
Phase 0: Refactor - Extract View Layer (Prerequisite)
Purpose: Separate output formatting from controller logic to enable clean format switching.
Phase 1: Add CLI Flag
Phase 2: Add JSON Output Method to View
Phase 3: Implement Format Switching
Phase 4: Documentation
Phase 5: Testing
Acceptance Criteria
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.
Architecture
Functionality
Code Quality
Documentation
User Experience
Related Issues
Additional Context
UX Research
The dual-channel output strategy (stdout for results, stderr for progress) is based on documented research:
Golden Test Configuration
Test configuration available at: envs/golden-test-json-create.json
This ensures backward compatibility verification during refactoring.
Overview
Add machine-readable JSON output format (
--jsonflag) to thecreatecommand. This enables automation workflows to programmatically extract environment creation details like paths, configuration references, and initial state.Specification
See detailed specification: docs/issues/add-json-output-to-create-command.md
(Link will be updated after file rename with issue number)
🏗️ Architecture Requirements
DDD Layer: Presentation (
src/presentation/)Module Path:
src/presentation/views/commands/create/Pattern: MVC - View layer with format switching
Prerequisites
createcommand currently violates MVC separation by embedding output formatting in the controller. Before adding JSON support, we must extract the view layer to match the pattern used byprovision,list, andshowcommands.Module Structure Requirements
Architectural Constraints
Anti-Patterns to Avoid
Implementation Plan
Phase 0: Refactor - Extract View Layer (Prerequisite)
Purpose: Separate output formatting from controller logic to enable clean format switching.
src/presentation/views/commands/create/EnvironmentDetailsDatastruct (presentation DTO)From<&Environment<Created>>for data conversionEnvironmentDetailsViewwithrender_human_readable()methodPhase 1: Add CLI Flag
--jsonflag tocreatesubcommand argument parserPhase 2: Add JSON Output Method to View
render_json()method toEnvironmentDetailsViewserde_jsonSerializederive toEnvironmentDetailsDatacreated_at) in JSON outputPhase 3: Implement Format Switching
--jsonflag in controllerEnvironmentDetailsView::render_json()when flag setEnvironmentDetailsView::render_human_readable()otherwise (default)Phase 4: Documentation
Phase 5: Testing
--jsonflagjqto verify parsabilityAcceptance Criteria
Architecture
provision,list,showcommandsFunctionality
--jsonflag is accepted by create command--jsonflag, command outputs valid JSON to stdoutjq,serde_json, etc.)--jsonflag, output is unchanged (human-readable format)Code Quality
./scripts/pre-commit.shDocumentation
User Experience
Related Issues
Additional Context
UX Research
The dual-channel output strategy (stdout for results, stderr for progress) is based on documented research:
Golden Test Configuration
Test configuration available at:
envs/golden-test-json-create.jsonThis ensures backward compatibility verification during refactoring.