|
8 | 8 | //! - Skill `/command` input detection and resolution via `SkillRegistry` |
9 | 9 |
|
10 | 10 | use std::io; |
| 11 | + |
| 12 | +use crate::components::autocomplete::CommandInfo; |
11 | 13 | use std::path::PathBuf; |
12 | 14 | use std::pin::Pin; |
13 | 15 | use std::sync::Arc; |
@@ -161,8 +163,85 @@ pub async fn run(config: TuiConfig) -> anyhow::Result<()> { |
161 | 163 | let mut app = App::new(&model_name); |
162 | 164 | if let Ok(cwd) = std::env::current_dir() { |
163 | 165 | app.set_working_dir(cwd.display().to_string()); |
| 166 | + app.set_completion_cwd(cwd); |
164 | 167 | } |
165 | 168 |
|
| 169 | + // Register built-in slash commands for Tab completion |
| 170 | + app.set_slash_commands(vec![ |
| 171 | + CommandInfo { |
| 172 | + name: "/help".into(), |
| 173 | + description: "Show available commands".into(), |
| 174 | + }, |
| 175 | + CommandInfo { |
| 176 | + name: "/clear".into(), |
| 177 | + description: "Clear conversation history".into(), |
| 178 | + }, |
| 179 | + CommandInfo { |
| 180 | + name: "/compact".into(), |
| 181 | + description: "Compact conversation (free context)".into(), |
| 182 | + }, |
| 183 | + CommandInfo { |
| 184 | + name: "/exit".into(), |
| 185 | + description: "Exit crab-code".into(), |
| 186 | + }, |
| 187 | + CommandInfo { |
| 188 | + name: "/model".into(), |
| 189 | + description: "Show or switch the current model".into(), |
| 190 | + }, |
| 191 | + CommandInfo { |
| 192 | + name: "/cost".into(), |
| 193 | + description: "Show token usage and cost".into(), |
| 194 | + }, |
| 195 | + CommandInfo { |
| 196 | + name: "/status".into(), |
| 197 | + description: "Show session status".into(), |
| 198 | + }, |
| 199 | + CommandInfo { |
| 200 | + name: "/memory".into(), |
| 201 | + description: "Show or manage memory files".into(), |
| 202 | + }, |
| 203 | + CommandInfo { |
| 204 | + name: "/config".into(), |
| 205 | + description: "Open settings configuration".into(), |
| 206 | + }, |
| 207 | + CommandInfo { |
| 208 | + name: "/permissions".into(), |
| 209 | + description: "Show current permission mode".into(), |
| 210 | + }, |
| 211 | + CommandInfo { |
| 212 | + name: "/resume".into(), |
| 213 | + description: "Resume a previous session".into(), |
| 214 | + }, |
| 215 | + CommandInfo { |
| 216 | + name: "/diff".into(), |
| 217 | + description: "Show recent file changes".into(), |
| 218 | + }, |
| 219 | + CommandInfo { |
| 220 | + name: "/review".into(), |
| 221 | + description: "Review recent code changes".into(), |
| 222 | + }, |
| 223 | + CommandInfo { |
| 224 | + name: "/commit".into(), |
| 225 | + description: "Create a git commit".into(), |
| 226 | + }, |
| 227 | + CommandInfo { |
| 228 | + name: "/plan".into(), |
| 229 | + description: "Enter plan mode".into(), |
| 230 | + }, |
| 231 | + CommandInfo { |
| 232 | + name: "/fast".into(), |
| 233 | + description: "Toggle fast mode".into(), |
| 234 | + }, |
| 235 | + CommandInfo { |
| 236 | + name: "/thinking".into(), |
| 237 | + description: "Toggle extended thinking".into(), |
| 238 | + }, |
| 239 | + CommandInfo { |
| 240 | + name: "/effort".into(), |
| 241 | + description: "Set effort level".into(), |
| 242 | + }, |
| 243 | + ]); |
| 244 | + |
166 | 245 | // Main render + event loop |
167 | 246 | let result = run_loop( |
168 | 247 | &mut terminal, |
|
0 commit comments