Skip to content

refactor: standardize command view folder structure#401

Merged
josecelano merged 4 commits intomainfrom
refactor/standardize-command-view-folder-structure
Feb 27, 2026
Merged

refactor: standardize command view folder structure#401
josecelano merged 4 commits intomainfrom
refactor/standardize-command-view-folder-structure

Conversation

@josecelano
Copy link
Member

Summary

Brings run, list, and show command view modules into alignment with the canonical folder structure followed by all other 10 command view modules.

Implements all 3 proposals from docs/refactors/plans/standardize-command-view-folder-structure.md.

Changes

Proposal #1 — Move run view files into views/ subfolder (8e3f8a41)

  • Moved run/json_view.rsrun/views/json_view.rs
  • Moved run/text_view.rsrun/views/text_view.rs
  • Added run/views/mod.rs
  • Updated run/mod.rs to use mod views

Proposal #2 — Extract run inline DTO to view_data/ (ff0c6d7b)

  • Replaced the private RunCommandOutput<'a> struct inline in json_view.rs with a public owned RunDetailsData struct in run/view_data/run_details.rs
  • Updated both JsonView::render and TextView::render to accept &RunDetailsData
  • Updated run handler to construct RunDetailsData and pass it to both views

Proposal #3 — Add view_data/ to list and show (3d63edc6)

  • Created list/view_data/list_details.rs re-exporting EnvironmentList and EnvironmentSummary
  • Created show/view_data/show_details.rs re-exporting all 7 application-layer types used by show views
  • Updated all imports in list/views/ and show/views/ (9 files) to go through view_data/ instead of directly from application::command_handlers

Result

All 13 command view modules now follow the same layout:

<command>/
  mod.rs
  view_data/<dto>.rs
  views/
    json_view.rs
    text_view.rs

Testing

  • All 431 tests pass
  • All linters pass (cargo run --bin linter all)

Next Step

This unblocks standardize-json-view-render-api — file paths are now stable for that plan's Proposal #2.

Move json_view.rs and text_view.rs from run/ directly into run/views/,
matching the layout of all other 12 command view modules.

Add run/views/mod.rs that re-exports JsonView and TextView.
Update run/mod.rs to delegate through the views submodule.

All public re-exports from run/mod.rs remain unchanged.
Move the private RunCommandOutput<'a> struct out of json_view.rs
and into a dedicated view_data/run_details.rs as the public RunDetailsData
struct, matching the pattern used by all other command view modules.

Changes:
- Add run/view_data/run_details.rs with RunDetailsData (owned types)
- Add run/view_data/mod.rs
- Update run/mod.rs to declare pub mod view_data and re-export RunDetailsData
- Update json_view.rs: render(data: &RunDetailsData) instead of 3 params
- Update text_view.rs: render(data: &RunDetailsData) instead of 3 params
- Update handler: construct RunDetailsData and pass to both views
Create view_data/ subfolder for list and show commands, routing all
application-layer type imports through a dedicated view_data/ module instead
of importing directly from application::command_handlers in each view file.

Changes:
- Add list/view_data/list_details.rs re-exporting EnvironmentList, EnvironmentSummary
- Add list/view_data/mod.rs
- Update list/mod.rs to declare pub mod view_data and re-export EnvironmentList
- Update list/views/json_view.rs and text_view.rs imports to use view_data
- Add show/view_data/show_details.rs re-exporting EnvironmentInfo, GrafanaInfo,
  InfrastructureInfo, LocalhostServiceInfo, PrometheusInfo, ServiceInfo, TlsDomainInfo
- Add show/view_data/mod.rs
- Update show/mod.rs to declare pub mod view_data and re-export EnvironmentInfo
- Update show/views/json_view.rs, text_view.rs, grafana.rs, prometheus.rs,
  infrastructure.rs, tracker_services.rs, https_hint.rs imports to use view_data

All 13 command view modules now have a view_data/ subfolder.
…structure plan

Update refactor plan to reflect completed status:
- Mark all 3 proposals as Completed with commit hashes
- Update Progress Tracking: 3/3 complete, 0 not started
- Mark all implementation checklist items as done [x]
- Update phase summaries to 100% completion
- Update Last Updated date and Status to Completed

Commits:
- Proposal #1: 8e3f8a4 (move run views/ subfolder)
- Proposal #2: ff0c6d7 (extract run DTO to view_data/)
- Proposal #3: 3d63edc (add view_data/ to list and show)
@josecelano josecelano self-assigned this Feb 27, 2026
@josecelano
Copy link
Member Author

ACK 303c864

@josecelano josecelano merged commit d9a1c51 into main Feb 27, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant