feat(config): default CLI_MODE to TUI - #2329
Conversation
The TUI (Ratatui-based terminal UI) is the richer, more polished interactive experience with sidebar, log broadcaster, and context display. The REPL is a bare-bones fallback. Since the `tui` cargo feature is already compiled in by default, the runtime should match. Users can still opt out with CLI_MODE=repl in env or DB settings. [skip-regression-check] Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request updates the default CLI mode to 'tui' in both the configuration settings and the channel configuration logic. A review comment suggests centralizing the default value by referencing the ChannelSettings defaults instead of hardcoding the string 'tui' in multiple places to improve maintainability and consistency.
| let cli_mode = db_first_optional_string(&cs.cli_mode, "CLI_MODE")? | ||
| .unwrap_or_else(|| "tui".to_string()); |
There was a problem hiding this comment.
To improve maintainability and ensure consistency, consider using the default value defined in ChannelSettings instead of hardcoding the "tui" string again here. This follows the pattern used for cli_enabled and centralizes the default configuration. Additionally, use .as_ref() when accessing Option fields in structs to prevent partial moves, and prefer or_else with a closure to avoid unnecessary cloning when the first option is Some.
let cli_mode = db_first_optional_string(&cs.cli_mode, "CLI_MODE")?
.or_else(|| defaults.cli_mode.as_ref().cloned())
.unwrap_or_default();References
- Use .as_ref().map() on Option fields within a struct to prevent partial moves, making the code more robust against future changes.
The TUI (Ratatui-based terminal UI) is the richer, more polished interactive experience with sidebar, log broadcaster, and context display. The REPL is a bare-bones fallback. Since the `tui` cargo feature is already compiled in by default, the runtime should match. Users can still opt out with CLI_MODE=repl in env or DB settings. [skip-regression-check] Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
CLI_MODEfrom empty (REPL) to"tui"so new installations get the full Ratatui terminal UI out of the boxtuicargo feature was already compiled in by default — this makes the runtime default matchCLI_MODE=replin env or DB settingsTest plan
config::channelstests passconfig::profiletests passsettingstests passcargo clippy --all --all-featurescleancargo runlaunches TUI without any env vars setCLI_MODE=repl cargo runfalls back to REPL🤖 Generated with Claude Code