We need to refactor the code in @internal/cli/repl.go. It's too big right now. Give me some ideas on how to refactor these. Save the plan in @.ai-interactions/outputs/phase-2/output-6_repl-refactor.md.
Ok so we will now address the refactoring ideas in @.ai-interactions/outputs/phase-2/output-6_repl-refactor.md. This is critical change so we will do it one by one. Do the first one and ask for my approval before moving to the next one. I will test the changes in between.
We should write unit tests for functions in @internal/cli/streaming.go. Which functions are worthy enough? And how would you write the tests for them given that there is bubbletea involved?
Add unit tests for @internal/cli/streaming.go.
Proceed to refactoring with the next step. Make sure unit tests work accordingly after refactor.
Let's implement the next step: Move Model Selection to internal/cli/modelselection/.
Based on the refactoring we did so far, let's do some code review:
Refactor the View() function in @internal/cli/modelselection/model.go. It's big right now.
Time to do the refactor for outputs as outlined in @.ai-interactions/outputs/phase-2/output-2_repl-refactor.md.
We now have two states: AppState and replState. And they also have overlap in between them. This is not ideal. Let's refactor them.