1jehuang / 1jehuang/jcode

Decompose TUI app state and turn orchestration

Open
#54 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement priority: low triage: needs-decision
Dominant language
Rust
Stars
19.9k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
30

Description

Summary

The TUI app layer is still carrying too much responsibility across src/tui/app.rs and related src/tui/app/* modules. State shape, turn execution, orchestration, remote/session flows, and UI coordination are still tightly coupled.

Why this matters

  • large blast radius for everyday TUI changes
  • difficult to test turn behavior independently from UI state
  • app state continues to grow as a god object
  • remote/auth/turn flows are expensive to reason about

Proposed direction

Decompose the app layer into clearer boundaries such as:

  • app state/data structs
  • turn engine / assistant interaction orchestration
  • remote session lifecycle
  • auth/login flows
  • UI-only state and presentation adapters

Suggested acceptance criteria

  • src/tui/app.rs shrinks materially
  • run_turn / run_turn_interactive orchestration is moved behind smaller units
  • at least src/tui/app/remote.rs and src/tui/app/auth.rs are split into smaller focused modules
  • new boundaries are covered by focused tests where practical
  • validation remains green under fmt/check/clippy

Notes

This is a follow-up architecture issue after the repo-wide quality enforcement work landed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading src/tui/app.rs and the related src/tui/app/* modules, especially src/tui/app/remote.rs and src/tui/app/auth.rs, to map state, turn execution, remote sessions, authentication, and UI coordination. Trace run_turn and run_turn_interactive, then inspect existing tests before proposing boundaries. Done means the app layer is materially smaller, focused modules have practical tests, and fmt, check, and clippy remain green.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.