Skip to content

Commit 6a4d543

Browse files
authored
refactor(tui): remove deprecated commands and replace AuthAlertModal with toast (#545)
- Remove 8 deprecated commands: provider, providers, mcp-tools, mcp-auth, mcp-reload, mcp-logs, crash, eval - Change toast position from TopRight to BottomLeft - Replace AuthAlertModal with toast notifications for authentication - Delete alert.rs module (no longer needed)
1 parent 6577e50 commit 6a4d543

File tree

6 files changed

+5
-306
lines changed

6 files changed

+5
-306
lines changed

src/cortex-tui/src/app/state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::permissions::PermissionMode;
1111
use crate::question::QuestionState;
1212
use crate::selection::TextSelection;
1313
use crate::views::tool_call::{ContentSegment, ToolCallDisplay};
14-
use crate::widgets::ToastManager;
14+
use crate::widgets::{ToastManager, ToastPosition};
1515

1616
use super::approval::{ApprovalState, PendingToolResult};
1717
use super::autocomplete::AutocompleteState;
@@ -209,7 +209,7 @@ impl AppState {
209209
// provider_picker removed: provider is now always "cortex"
210210
model_picker: crate::widgets::ModelPickerState::new(),
211211
text_selection: TextSelection::new(),
212-
toasts: ToastManager::new(),
212+
toasts: ToastManager::new().with_position(ToastPosition::BottomLeft),
213213
permission_mode: PermissionMode::default(),
214214
tool_calls: Vec::new(),
215215
pending_tool_results: Vec::new(),

src/cortex-tui/src/commands/registry/builtin.rs

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -550,25 +550,7 @@ pub fn register_builtin_commands(registry: &mut CommandRegistry) {
550550
true,
551551
));
552552

553-
// NOTE: /provider and /providers are deprecated. Cortex is now a unified platform.
554-
// These commands are hidden from help but still work (with deprecation warning).
555-
registry.register(CommandDef::hidden(
556-
"provider",
557-
&["prov"],
558-
"[Deprecated] Switch provider - Cortex is now a unified platform",
559-
"/provider <name>",
560-
CommandCategory::Model,
561-
true,
562-
));
563553

564-
registry.register(CommandDef::hidden(
565-
"providers",
566-
&["lp", "list-providers"],
567-
"[Deprecated] List available providers - Cortex is now a unified platform",
568-
"/providers",
569-
CommandCategory::Model,
570-
false,
571-
));
572554

573555
registry.register(CommandDef::new(
574556
"temperature",
@@ -601,44 +583,7 @@ pub fn register_builtin_commands(registry: &mut CommandRegistry) {
601583
false,
602584
));
603585

604-
// NOTE: /mcp-tools, /mcp-auth, /mcp-reload, /mcp-logs are deprecated.
605-
// All MCP management is now centralized in the interactive /mcp panel.
606-
// These commands are hidden but still work for backwards compatibility.
607-
registry.register(CommandDef::hidden(
608-
"mcp-tools",
609-
&["tools", "lt"],
610-
"[Deprecated] Use /mcp instead - List MCP tools",
611-
"/mcp-tools [server]",
612-
CommandCategory::Mcp,
613-
true,
614-
));
615-
616-
registry.register(CommandDef::hidden(
617-
"mcp-auth",
618-
&["auth"],
619-
"[Deprecated] Use /mcp instead - Authenticate MCP server",
620-
"/mcp-auth <server>",
621-
CommandCategory::Mcp,
622-
true,
623-
));
624-
625-
registry.register(CommandDef::hidden(
626-
"mcp-reload",
627-
&["reload"],
628-
"[Deprecated] Use /mcp instead - Reload MCP servers",
629-
"/mcp-reload [server]",
630-
CommandCategory::Mcp,
631-
true,
632-
));
633586

634-
registry.register(CommandDef::hidden(
635-
"mcp-logs",
636-
&[],
637-
"[Deprecated] Use /mcp instead - View MCP server logs",
638-
"/mcp-logs [server]",
639-
CommandCategory::Mcp,
640-
true,
641-
));
642587

643588
// ========================================
644589
// DEBUG COMMANDS
@@ -698,23 +643,7 @@ pub fn register_builtin_commands(registry: &mut CommandRegistry) {
698643
false,
699644
));
700645

701-
registry.register(CommandDef::hidden(
702-
"crash",
703-
&[],
704-
"Test crash handler",
705-
"/crash",
706-
CommandCategory::Debug,
707-
false,
708-
));
709646

710-
registry.register(CommandDef::hidden(
711-
"eval",
712-
&[],
713-
"Evaluate expression",
714-
"/eval <expr>",
715-
CommandCategory::Debug,
716-
true,
717-
));
718647

719648
// ========================================
720649
// DEVELOPMENT & TOOLS COMMANDS

src/cortex-tui/src/modal/alert.rs

Lines changed: 0 additions & 224 deletions
This file was deleted.

src/cortex-tui/src/modal/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use ratatui::{
1414
use std::path::PathBuf;
1515

1616
// Re-export modal implementations
17-
pub mod alert;
1817
pub mod commands;
1918
pub mod help;
2019
pub mod login;
@@ -25,7 +24,6 @@ pub mod providers;
2524
pub mod sessions;
2625
pub mod upgrade;
2726

28-
pub use alert::{AuthAlertModal, ProviderAlertModal};
2927
pub use commands::CommandsModal;
3028
pub use help::HelpModal;
3129
pub use login::{LoginModal, LoginState};

src/cortex-tui/src/runner/event_loop/modal.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,7 @@ impl EventLoop {
277277
}
278278
}
279279
ModalAction::ConfigureProvider(_provider_id) => {
280-
use crate::modal::AuthAlertModal;
281-
let alert = AuthAlertModal::new();
282-
self.modal_stack.push(Box::new(alert));
280+
self.app_state.toasts.warning("Please run `cortex login` to authenticate");
283281
}
284282
ModalAction::ExecuteCommand(cmd) => {
285283
let cmd_str = if cmd.starts_with('/') {

src/cortex-tui/src/runner/event_loop/streaming.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ impl EventLoop {
6262
self.app_state.queued_count()
6363
);
6464

65-
// Open the authentication alert modal
66-
use crate::modal::AuthAlertModal;
67-
let alert = AuthAlertModal::new();
68-
self.modal_stack.push(Box::new(alert));
65+
// Show authentication required toast notification
66+
self.app_state.toasts.error("Authentication required. Please run `cortex login` to authenticate.");
6967
return Ok(());
7068
}
7169

0 commit comments

Comments
 (0)