Skip to content

Add JSON output to register command (12.13) #396

@josecelano

Description

@josecelano

Summary

Add --output-format json support to the register command, as part of roadmap section 12 (Epic #348).

Roadmap task: 12.13
Parent Epic: #348

Specification

See docs/issues/396-add-json-output-to-register-command.md for the full spec (to be committed after issue creation).

JSON Output Format

{
  "environment_name": "my-env",
  "instance_ip": "192.168.1.100",
  "ssh_port": 22,
  "registered": true
}
Field Type Description
environment_name string Name of the environment the instance was registered to
instance_ip string IP address of the registered instance
ssh_port integer SSH port used for the instance (default 22)
registered boolean Always true when the command exits successfully

Implementation Notes

  • RegisterCommandController::execute() returns Environment<Provisioned> — the DTO is built from this rich result
  • DTO: RegisterDetailsData { environment_name, instance_ip, ssh_port, registered }
  • Named constructor: from_environment(env: &Environment<Provisioned>)
  • Strategy Pattern — same as all prior commands in this epic
  • complete_workflow() needs updating to receive &Environment<Provisioned> alongside output_format

Acceptance Criteria

  • cargo run -- register my-env 192.168.1.100 --output-format json 2>/dev/null produces valid JSON
  • Text mode output is unchanged
  • All existing tests pass
  • cargo run --bin linter all passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions