Skip to content

Commit d9dc487

Browse files
authored
Merge pull request #130 from fwilhe/feature/default-gui-mode
Make GUI the default launch mode
2 parents 9c4f9ee + 984ee23 commit d9dc487

4 files changed

Lines changed: 26 additions & 20 deletions

File tree

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,21 @@ See [docs/format-on-save-feature.md](docs/format-on-save-feature.md) for detaile
125125
### GUI Mode (Recommended)
126126

127127
```bash
128-
# Start with graphical interface
129-
code-assistant --ui
128+
# Start with graphical interface (default)
129+
code-assistant
130130

131131
# Start GUI with initial task
132-
code-assistant --ui --task "Analyze the authentication system"
132+
code-assistant --task "Analyze the authentication system"
133133
```
134134

135135
### Terminal Mode
136136

137137
```bash
138-
# Basic usage
139-
code-assistant --task "Explain the purpose of this codebase"
138+
# Start with terminal interface
139+
code-assistant --tui --task "Explain the purpose of this codebase"
140140

141141
# With specific model
142-
code-assistant --task "Add error handling" --model "GPT-5"
142+
code-assistant --tui --task "Add error handling" --model "GPT-5"
143143
```
144144

145145
### Working Directory Matters
@@ -150,7 +150,7 @@ The directory from which you launch `code-assistant` determines the project cont
150150

151151
```bash
152152
cd ~/workspace/my-project
153-
code-assistant --ui
153+
code-assistant
154154
```
155155

156156
Chats are **grouped by directory**, so starting a new chat from the correct project directory ensures:

crates/code_assistant/src/cli.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ pub struct Args {
7979
#[arg(long, default_value = ".")]
8080
pub path: PathBuf,
8181

82-
/// Task to perform on the codebase (required in terminal mode, optional with --ui)
82+
/// Task to perform on the codebase (required in terminal mode, optional in GUI mode)
8383
#[arg(short, long)]
8484
pub task: Option<String>,
8585

86-
/// Start with GUI interface
86+
/// Start with terminal interface instead of GUI
8787
#[arg(long)]
88-
pub ui: bool,
88+
pub tui: bool,
8989

9090
/// Continue from previous state
9191
#[arg(long)]
@@ -274,7 +274,7 @@ mod tests {
274274

275275
assert_eq!(args.path, std::path::PathBuf::from("."));
276276
assert_eq!(args.verbose, 0);
277-
assert!(!args.ui);
277+
assert!(!args.tui);
278278
assert!(!args.continue_task);
279279
assert!(!args.fast_playback);
280280
assert!(!args.use_diff_format);

crates/code_assistant/src/main.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,16 @@ async fn main() -> Result<()> {
105105
}
106106
}
107107
None => {
108-
if args.ui {
108+
// Determine whether to launch the GPUI frontend. The graphical
109+
// interface is the default when compiled in; otherwise we fall
110+
// back to the terminal frontend so the binary stays useful in
111+
// headless builds (e.g. `--no-default-features`).
112+
#[cfg(feature = "gpui-frontend")]
113+
let use_gpui = !args.tui;
114+
#[cfg(not(feature = "gpui-frontend"))]
115+
let use_gpui = false;
116+
117+
if use_gpui {
109118
// GPUI mode - use stderr to keep stdout clean
110119
setup_logging(args.verbose, false);
111120
} else {
@@ -120,7 +129,7 @@ async fn main() -> Result<()> {
120129

121130
// In GUI mode, allow starting without a valid model config
122131
// (the settings screen will guide the user through setup).
123-
let model_name = if args.ui {
132+
let model_name = if use_gpui {
124133
args.get_model_name().unwrap_or_default()
125134
} else {
126135
args.get_model_name()?
@@ -140,18 +149,15 @@ async fn main() -> Result<()> {
140149
sandbox_policy,
141150
};
142151

143-
if args.ui {
152+
if use_gpui {
144153
#[cfg(feature = "gpui-frontend")]
145154
{
146155
app::gpui::run(config)
147156
}
148157
#[cfg(not(feature = "gpui-frontend"))]
149158
{
150159
let _ = config;
151-
anyhow::bail!(
152-
"This binary was built without the GPUI frontend \
153-
(feature `gpui-frontend`)"
154-
)
160+
unreachable!("use_gpui is only true when the gpui-frontend feature is enabled")
155161
}
156162
} else {
157163
#[cfg(feature = "terminal-frontend")]

docs/agent-client-protocol/acp-integration-plan.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ The Agent Client Protocol standardizes communication between code editors (clien
1111
### Current Architecture
1212

1313
code-assistant currently supports three run modes:
14-
1. **Terminal UI** (`code-assistant --task "..."`) - Interactive terminal interface
15-
2. **GPUI** (`code-assistant --ui`) - Modern graphical interface
14+
1. **Terminal UI** (`code-assistant --tui --task "..."`) - Interactive terminal interface
15+
2. **GPUI** (`code-assistant`) - Modern graphical interface (default)
1616
3. **MCP Server** (`code-assistant server`) - Model Context Protocol server for Claude Desktop
1717

1818
The architecture has:

0 commit comments

Comments
 (0)