Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
feat(agent-tui): /settings and /config with words run /vibe-setting
thinhlpg651a01c69c5c
diff --git a/docs/src/pages/docs/agent/slash-commands.mdx b/docs/src/pages/docs/agent/slash-commands.mdxindex acf1a6ee3..7af790bca 100644--- a/docs/src/pages/docs/agent/slash-commands.mdx+++ b/docs/src/pages/docs/agent/slash-commands.mdx@@ -71,10 +71,10 @@ See [Run modes](/docs/agent/run-modes), [Goals and todos](/docs/agent/goals-and-| `/plugin [list\|install <spec>\|remove <name>\|search [query]]` | Manage plugins: install from a git URL or the marketplace, list/remove installed, search the marketplace || `/reload [config\|plugin\|skills\|system-prompt]` | Re-read on-disk state into the running session without a restart (bare: all). `config` re-applies the project's `agent.toml` limits - `context_window`, `compaction_ratio`, `compaction_reserve_tokens`, `max_tokens`, `send_reasoning`, `[budget].max_tokens` - to the next run and lists what changed; the model, `[tools]`, `[provider]` and `[budget].max_usd` still need a restart. `plugin`/`skills` re-scan and rebuild the catalog, reporting added/removed/changed entries. `system-prompt` re-reads the project instructions (`JAN.md`, or a `[context].fallback_files` entry such as `AGENTS.md` where a directory has none), which apply on the next run || `/login` | Sign in to Tokamak and save the API key |-| `/config` | View provider config (`~/.jan/config.toml`) |+| `/config [what you want]` | View provider config (`~/.jan/config.toml`). With words, it is `/vibe-setting` || `/terminal-setup` | Configure this terminal so <kbd>Shift</kbd>+<kbd>Enter</kbd> inserts a newline and, on macOS, <kbd>Option</kbd>+<kbd>Delete</kbd> deletes a word. Writes the terminal's own config where it can (VS Code, kitty, Ghostty, tmux) and prints the manual step where it cannot. Idempotent |-| `/settings [max_parallel_subagents N]` | Edit settings in an interactive menu - the project's `agent.toml` (`[agent]` knobs `context_window`, `compaction_ratio`, `compaction_reserve_tokens`, `max_tokens`, `max_parallel_subagents`, `[budget]` limits, the `[tools]` / `[skills]` toggles) and user-wide `~/.jan/config.toml` keys such as `wave` and `ask_timeout_secs` in the one list (Enter edits a row, `x` resets to default, Esc cancels, clearing the field unsets - except `wave`, where an empty field is the "no sweep" value and `x` restores the default π). The leading `providers` row opens a manager for OpenAI-compatible providers in `~/.jan/config.toml`: `a` adds, Enter edits, `d` twice deletes. `max_parallel_subagents N` works as a one-shot shortcut. Writes apply on the next session (or after `/reload config` for the `[agent]`/`[budget]` limits), except cosmetic ones like `wave` that apply immediately |-| `/vibe-setting <what you want>` | Say what you want in plain words and the agent proposes the settings changes that get it. See [below](#vibe-setting) |+| `/settings [what you want]` | With words (other than the `max_parallel_subagents N` shortcut), it is `/vibe-setting`. Bare, it opens the menu to edit settings in an interactive menu - the project's `agent.toml` (`[agent]` knobs `context_window`, `compaction_ratio`, `compaction_reserve_tokens`, `max_tokens`, `max_parallel_subagents`, `[budget]` limits, the `[tools]` / `[skills]` toggles) and user-wide `~/.jan/config.toml` keys such as `wave` and `ask_timeout_secs` in the one list (Enter edits a row, `x` resets to default, Esc cancels, clearing the field unsets - except `wave`, where an empty field is the "no sweep" value and `x` restores the default π). The leading `providers` row opens a manager for OpenAI-compatible providers in `~/.jan/config.toml`: `a` adds, Enter edits, `d` twice deletes. `max_parallel_subagents N` works as a one-shot shortcut. Writes apply on the next session (or after `/reload config` for the `[agent]`/`[budget]` limits), except cosmetic ones like `wave` that apply immediately |+| `/vibe-setting <what you want>` | Say what you want in plain words and the agent proposes the settings changes that get it. `/settings <words>` and `/config <words>` do the same. See [below](#vibe-setting) |### `/vibe-setting`@@ -127,6 +127,6 @@ See [Providers](/docs/agent/providers), [MCP](/docs/agent/mcp), [Plugins](/docs/| `/update` | Install the latest published build. Takes effect on restart |<Callout type="info">-`/config` is read-only. To change providers, use `jan config set` from the shell - see+Bare `/config` is read-only. To change providers, use `jan config set` from the shell - see[Providers](/docs/agent/providers).</Callout>diff --git a/src-tauri/src/core/cli/tui.rs b/src-tauri/src/core/cli/tui.rsindex 4a50f2e39..8e20ec284 100644--- a/src-tauri/src/core/cli/tui.rs+++ b/src-tauri/src/core/cli/tui.rs@@ -12303,14 +12303,14 @@ const SLASH_COMMANDS: &[SlashCommand] = &[},SlashCommand {name: "/config",- hint: "",- description: "View provider config (~/.jan/config.toml)",+ hint: "[what you want]",+ description: "View provider config (~/.jan/config.toml); with words, same as /vibe-setting",alias_of: None,},SlashCommand {name: "/settings",- hint: "[max_parallel_subagents N]",- description: "Edit agent.toml and ~/.jan settings (menu); most apply next run",+ hint: "[what you want]",+ description: "Edit agent.toml and ~/.jan settings (menu); with words, same as /vibe-setting",alias_of: None,},SlashCommand {@@ -12529,7 +12529,8 @@ async fn run_command("login" => login_command(app, arg),"logout" => logout_command(app, arg),"update" => update_command(app),- "config" => open_config_screen(app),+ "config" if arg.trim().is_empty() => open_config_screen(app),+ "config" => vibe_setting::command(app, arg),"terminal-setup" => terminal_setup_command(app),"settings" => settings_command(app, arg),"vibe-setting" => vibe_setting::command(app, arg),@@ -13719,8 +13720,16 @@ fn apply_live_unset(def: &AgentSettingDef) -> bool {fn settings_command(app: &mut App, arg: &str) {let toml_path = app.agent_dir.join("agent.toml");let arg = arg.trim();- let Some((key, value)) = arg.split_once(char::is_whitespace) else {+ if arg.is_empty() {return open_settings_screen(app);+ }+ // `/settings max_parallel_subagents N` keeps its direct write; any other+ // words are a plain-language request for the `/vibe-setting` flow.+ let Some((key, value)) = arg+ .split_once(char::is_whitespace)+ .filter(|(key, _)| *key == "max_parallel_subagents")+ else {+ return vibe_setting::command(app, arg);};match key {"max_parallel_subagents" => {@@ -13742,9 +13751,7 @@ fn settings_command(app: &mut App, arg: &str) {Err(e) => app.note(&format!("failed to write {}: {e}", toml_path.display())),}}- other => app.note(&format!(- "unknown setting '/settings {other}' (bare /settings opens the menu)"- )),+ _ => unreachable!("only max_parallel_subagents reaches the direct write"),}}@@ -26159,11 +26166,37 @@ mod tests {super::settings_command(&mut app, "max_parallel_subagents lots");assert!(transcript_text(&app).contains("is not an integer"));- super::settings_command(&mut app, "warp_drive 5");- assert!(transcript_text(&app).contains("unknown setting"));let _ = std::fs::remove_dir_all(&app.agent_dir);}+ /// `/settings <words>` and `/config <words>` are `/vibe-setting`: they+ /// reach its guards (here, no signed-in model) instead of the menu or an+ /// "unknown setting" error. Bare forms keep opening their screens.+ #[tokio::test]+ async fn settings_and_config_with_words_route_to_vibe_setting() {+ for line in ["settings stop compacting so often", "config show me its thinking", "settings warp_drive 5"] {+ let mut app = test_app();+ app.model.clear();+ run_command(&mut app, line, &no_mcp()).await;+ let text = transcript_text(&app);+ assert!(text.contains("not signed in"), "{line}: {text}");+ assert!(!text.contains("unknown setting"), "{line}: {text}");+ assert!(app.picker.is_none(), "{line} must not open the menu");+ }+ let mut app = test_app();+ run_command(&mut app, "settings", &no_mcp()).await;+ assert!(app.picker.is_some(), "bare /settings still opens the menu");+ }++ #[test]+ fn settings_and_config_advertise_the_vibe_form() {+ for name in ["/settings", "/config"] {+ let row = SLASH_COMMANDS.iter().find(|c| c.name == name).unwrap();+ assert_eq!(row.hint, "[what you want]", "{name}");+ assert!(row.description.contains("/vibe-setting"), "{name}");+ }+ }+#[test]fn settings_prompt_enter_writes_and_closes() {let mut app = test_app();