pub struct Command { /* private fields */ }Expand description
One slash-command palette entry completed by SlashCommands.
Implementations§
Source§impl Command
impl Command
Sourcepub fn new(name: &str, description: &str, aliases: &[&str]) -> Self
pub fn new(name: &str, description: &str, aliases: &[&str]) -> Self
Builds a palette entry from its name, blurb, and alias spellings.
Examples found in repository?
examples/chat/demo.rs (lines 136-140)
134pub fn demo_commands() -> Vec<Command> {
135 vec![
136 Command::new(
137 "security",
138 "Plan, run, inspect, import, and compare OMP-native security scans",
139 &[],
140 )
141 .with_args(&[
142 ("plan", "Draft a scan plan for this workspace", "[focus]"),
143 ("run", "Execute the current scan plan", ""),
144 ("inspect", "Browse findings from the last scan", "[finding-id]"),
145 ("import", "Import an external scan report", "<path>"),
146 ("compare", "Diff two scan runs", "<run-a> <run-b>"),
147 ])
148 .with_hint("plan|run|inspect|import|compare"),
149 Command::new("attach", "Stage an image attachment on the composer", &[]).with_hint("<path>"),
150 Command::new("settings", "Open settings menu", &[]),
151 Command::new("setup", "Open provider setup", &["providers"]).with_hint("[provider]"),
152 Command::new("plan", "Toggle plan mode (agent plans before executing)", &[]),
153 Command::new("plan-review", "Re-open the plan review for the latest plan", &[]),
154 Command::new("vibe", "Toggle persistent fast worker sessions", &[]),
155 Command::new("goal", "Toggle an autonomous objective for this session", &[])
156 .with_hint("<objective>"),
157 Command::new("guided-goal", "Interview you in chat, then set up goal mode", &[]),
158 Command::new("queue", "Queue a message for after the agent yields", &[]),
159 Command::new("switch", "Switch model for this session (same as alt+p)", &[]),
160 Command::new("fast", "Toggle priority service tier", &[]),
161 Command::new("computer", "Toggle the native computer-use tool", &[]),
162 Command::new("vision", "Control inspect_image vision delegation", &[]),
163 Command::new("prewalk", "Switch to a fast model at the next action", &[]),
164 Command::new("advisor", "Toggle the second-model advisor", &[]),
165 Command::new("export", "Export session to an HTML file", &[]),
166 Command::new("dump", "Copy the session transcript to clipboard", &[]),
167 Command::new("share", "Share session via an encrypted link", &[]),
168 Command::new("collab", "Share this session live via a relay", &[]),
169 Command::new("join", "Join a shared collab session", &[]),
170 Command::new("leave", "Leave the collab session", &[]),
171 Command::new("browser", "Toggle browser headless vs visible mode", &[]),
172 Command::new("copy", "Pick conversation text or code to copy", &[]),
173 Command::new("todo", "View or modify the agent's todo list", &[]),
174 Command::new("session", "Session management commands", &[]),
175 Command::new("jobs", "Show async background jobs status", &[]),
176 Command::new("usage", "Show provider usage and limits", &[]),
177 Command::new("stats", "Launch the local stats dashboard", &[]),
178 Command::new("changelog", "Show changelog entries", &[]),
179 Command::new("hotkeys", "Show all keyboard shortcuts", &[]),
180 Command::new("tools", "Show tools currently visible to the agent", &[]),
181 Command::new("context", "Show estimated context usage breakdown", &[]),
182 Command::new("agents", "Open Agent Control Center dashboard", &[]),
183 Command::new("branch", "Create a new branch from a previous message", &[]),
184 Command::new("fork", "Create a new fork from a previous message", &[]),
185 Command::new("tree", "Navigate the session tree", &[]),
186 Command::new("login", "Login with an OAuth provider", &[]),
187 Command::new("logout", "Logout from an OAuth provider", &[]),
188 Command::new("mcp", "Manage MCP servers", &[]),
189 Command::new("ssh", "Manage SSH hosts", &[]),
190 Command::new("new", "Start a new session", &[]),
191 Command::new("fresh", "Reset provider state without changing the transcript", &[]),
192 Command::new("clear", "Clear conversation context, keeping the session", &[]),
193 Command::new("drop", "Delete the current session and start a new one", &[]),
194 Command::new("compact", "Manually compact the session context", &[]),
195 Command::new("shake", "Drop heavy content from context", &[]),
196 Command::new("handoff", "Hand off context to a new session", &[]),
197 Command::new("resume", "Resume a different session", &[]),
198 Command::new("btw", "Ask an ephemeral side question", &[]),
199 Command::new("tan", "Run a background agent on tangential work", &[]),
200 Command::new("omfg", "Forge a rule from a recurring complaint", &[]),
201 Command::new("retry", "Retry the last failed agent turn", &[]),
202 Command::new("debug", "Open the debug tools selector", &[]),
203 Command::new("memory", "Inspect and operate memory maintenance", &[]),
204 Command::new("rename", "Rename the current session", &[]),
205 Command::new("move", "Move the session to a different directory", &[]),
206 Command::new("add-dir", "Add a workspace directory", &[]),
207 Command::new("remove-dir", "Remove a workspace directory", &[]),
208 Command::new("dirs", "List this session's workspace directories", &[]),
209 Command::new("marketplace", "Manage marketplace plugins", &[]),
210 Command::new("plugins", "View and manage installed plugins", &[]),
211 Command::new("reload-plugins", "Reload skills, commands, hooks, tools, and agents", &[]),
212 Command::new("force", "Force the next turn to use a specific tool", &["force:"]),
213 Command::new("live", "Start Codex-backed realtime voice mode", &[]),
214 Command::new("pause", "Freeze all agents until resumed", &[]),
215 Command::new("quit", "Quit the application", &["q"]),
216 ]
217}Sourcepub fn with_args(self, args: &[(&str, &str, &str)]) -> Self
pub fn with_args(self, args: &[(&str, &str, &str)]) -> Self
Argument candidates offered once the command name is complete:
(name, description, usage), with "" usage meaning none. Usage
text ghosts after the argument pi-style (<path>, <a> <b>).
Examples found in repository?
examples/chat/demo.rs (lines 141-147)
134pub fn demo_commands() -> Vec<Command> {
135 vec![
136 Command::new(
137 "security",
138 "Plan, run, inspect, import, and compare OMP-native security scans",
139 &[],
140 )
141 .with_args(&[
142 ("plan", "Draft a scan plan for this workspace", "[focus]"),
143 ("run", "Execute the current scan plan", ""),
144 ("inspect", "Browse findings from the last scan", "[finding-id]"),
145 ("import", "Import an external scan report", "<path>"),
146 ("compare", "Diff two scan runs", "<run-a> <run-b>"),
147 ])
148 .with_hint("plan|run|inspect|import|compare"),
149 Command::new("attach", "Stage an image attachment on the composer", &[]).with_hint("<path>"),
150 Command::new("settings", "Open settings menu", &[]),
151 Command::new("setup", "Open provider setup", &["providers"]).with_hint("[provider]"),
152 Command::new("plan", "Toggle plan mode (agent plans before executing)", &[]),
153 Command::new("plan-review", "Re-open the plan review for the latest plan", &[]),
154 Command::new("vibe", "Toggle persistent fast worker sessions", &[]),
155 Command::new("goal", "Toggle an autonomous objective for this session", &[])
156 .with_hint("<objective>"),
157 Command::new("guided-goal", "Interview you in chat, then set up goal mode", &[]),
158 Command::new("queue", "Queue a message for after the agent yields", &[]),
159 Command::new("switch", "Switch model for this session (same as alt+p)", &[]),
160 Command::new("fast", "Toggle priority service tier", &[]),
161 Command::new("computer", "Toggle the native computer-use tool", &[]),
162 Command::new("vision", "Control inspect_image vision delegation", &[]),
163 Command::new("prewalk", "Switch to a fast model at the next action", &[]),
164 Command::new("advisor", "Toggle the second-model advisor", &[]),
165 Command::new("export", "Export session to an HTML file", &[]),
166 Command::new("dump", "Copy the session transcript to clipboard", &[]),
167 Command::new("share", "Share session via an encrypted link", &[]),
168 Command::new("collab", "Share this session live via a relay", &[]),
169 Command::new("join", "Join a shared collab session", &[]),
170 Command::new("leave", "Leave the collab session", &[]),
171 Command::new("browser", "Toggle browser headless vs visible mode", &[]),
172 Command::new("copy", "Pick conversation text or code to copy", &[]),
173 Command::new("todo", "View or modify the agent's todo list", &[]),
174 Command::new("session", "Session management commands", &[]),
175 Command::new("jobs", "Show async background jobs status", &[]),
176 Command::new("usage", "Show provider usage and limits", &[]),
177 Command::new("stats", "Launch the local stats dashboard", &[]),
178 Command::new("changelog", "Show changelog entries", &[]),
179 Command::new("hotkeys", "Show all keyboard shortcuts", &[]),
180 Command::new("tools", "Show tools currently visible to the agent", &[]),
181 Command::new("context", "Show estimated context usage breakdown", &[]),
182 Command::new("agents", "Open Agent Control Center dashboard", &[]),
183 Command::new("branch", "Create a new branch from a previous message", &[]),
184 Command::new("fork", "Create a new fork from a previous message", &[]),
185 Command::new("tree", "Navigate the session tree", &[]),
186 Command::new("login", "Login with an OAuth provider", &[]),
187 Command::new("logout", "Logout from an OAuth provider", &[]),
188 Command::new("mcp", "Manage MCP servers", &[]),
189 Command::new("ssh", "Manage SSH hosts", &[]),
190 Command::new("new", "Start a new session", &[]),
191 Command::new("fresh", "Reset provider state without changing the transcript", &[]),
192 Command::new("clear", "Clear conversation context, keeping the session", &[]),
193 Command::new("drop", "Delete the current session and start a new one", &[]),
194 Command::new("compact", "Manually compact the session context", &[]),
195 Command::new("shake", "Drop heavy content from context", &[]),
196 Command::new("handoff", "Hand off context to a new session", &[]),
197 Command::new("resume", "Resume a different session", &[]),
198 Command::new("btw", "Ask an ephemeral side question", &[]),
199 Command::new("tan", "Run a background agent on tangential work", &[]),
200 Command::new("omfg", "Forge a rule from a recurring complaint", &[]),
201 Command::new("retry", "Retry the last failed agent turn", &[]),
202 Command::new("debug", "Open the debug tools selector", &[]),
203 Command::new("memory", "Inspect and operate memory maintenance", &[]),
204 Command::new("rename", "Rename the current session", &[]),
205 Command::new("move", "Move the session to a different directory", &[]),
206 Command::new("add-dir", "Add a workspace directory", &[]),
207 Command::new("remove-dir", "Remove a workspace directory", &[]),
208 Command::new("dirs", "List this session's workspace directories", &[]),
209 Command::new("marketplace", "Manage marketplace plugins", &[]),
210 Command::new("plugins", "View and manage installed plugins", &[]),
211 Command::new("reload-plugins", "Reload skills, commands, hooks, tools, and agents", &[]),
212 Command::new("force", "Force the next turn to use a specific tool", &["force:"]),
213 Command::new("live", "Start Codex-backed realtime voice mode", &[]),
214 Command::new("pause", "Freeze all agents until resumed", &[]),
215 Command::new("quit", "Quit the application", &["q"]),
216 ]
217}Sourcepub fn with_hint(self, hint: &str) -> Self
pub fn with_hint(self, hint: &str) -> Self
Usage hint shown as dim ghost text after the cursor, pi-style
(e.g. <name> [--scope project|user]).
Examples found in repository?
examples/chat/demo.rs (line 148)
134pub fn demo_commands() -> Vec<Command> {
135 vec![
136 Command::new(
137 "security",
138 "Plan, run, inspect, import, and compare OMP-native security scans",
139 &[],
140 )
141 .with_args(&[
142 ("plan", "Draft a scan plan for this workspace", "[focus]"),
143 ("run", "Execute the current scan plan", ""),
144 ("inspect", "Browse findings from the last scan", "[finding-id]"),
145 ("import", "Import an external scan report", "<path>"),
146 ("compare", "Diff two scan runs", "<run-a> <run-b>"),
147 ])
148 .with_hint("plan|run|inspect|import|compare"),
149 Command::new("attach", "Stage an image attachment on the composer", &[]).with_hint("<path>"),
150 Command::new("settings", "Open settings menu", &[]),
151 Command::new("setup", "Open provider setup", &["providers"]).with_hint("[provider]"),
152 Command::new("plan", "Toggle plan mode (agent plans before executing)", &[]),
153 Command::new("plan-review", "Re-open the plan review for the latest plan", &[]),
154 Command::new("vibe", "Toggle persistent fast worker sessions", &[]),
155 Command::new("goal", "Toggle an autonomous objective for this session", &[])
156 .with_hint("<objective>"),
157 Command::new("guided-goal", "Interview you in chat, then set up goal mode", &[]),
158 Command::new("queue", "Queue a message for after the agent yields", &[]),
159 Command::new("switch", "Switch model for this session (same as alt+p)", &[]),
160 Command::new("fast", "Toggle priority service tier", &[]),
161 Command::new("computer", "Toggle the native computer-use tool", &[]),
162 Command::new("vision", "Control inspect_image vision delegation", &[]),
163 Command::new("prewalk", "Switch to a fast model at the next action", &[]),
164 Command::new("advisor", "Toggle the second-model advisor", &[]),
165 Command::new("export", "Export session to an HTML file", &[]),
166 Command::new("dump", "Copy the session transcript to clipboard", &[]),
167 Command::new("share", "Share session via an encrypted link", &[]),
168 Command::new("collab", "Share this session live via a relay", &[]),
169 Command::new("join", "Join a shared collab session", &[]),
170 Command::new("leave", "Leave the collab session", &[]),
171 Command::new("browser", "Toggle browser headless vs visible mode", &[]),
172 Command::new("copy", "Pick conversation text or code to copy", &[]),
173 Command::new("todo", "View or modify the agent's todo list", &[]),
174 Command::new("session", "Session management commands", &[]),
175 Command::new("jobs", "Show async background jobs status", &[]),
176 Command::new("usage", "Show provider usage and limits", &[]),
177 Command::new("stats", "Launch the local stats dashboard", &[]),
178 Command::new("changelog", "Show changelog entries", &[]),
179 Command::new("hotkeys", "Show all keyboard shortcuts", &[]),
180 Command::new("tools", "Show tools currently visible to the agent", &[]),
181 Command::new("context", "Show estimated context usage breakdown", &[]),
182 Command::new("agents", "Open Agent Control Center dashboard", &[]),
183 Command::new("branch", "Create a new branch from a previous message", &[]),
184 Command::new("fork", "Create a new fork from a previous message", &[]),
185 Command::new("tree", "Navigate the session tree", &[]),
186 Command::new("login", "Login with an OAuth provider", &[]),
187 Command::new("logout", "Logout from an OAuth provider", &[]),
188 Command::new("mcp", "Manage MCP servers", &[]),
189 Command::new("ssh", "Manage SSH hosts", &[]),
190 Command::new("new", "Start a new session", &[]),
191 Command::new("fresh", "Reset provider state without changing the transcript", &[]),
192 Command::new("clear", "Clear conversation context, keeping the session", &[]),
193 Command::new("drop", "Delete the current session and start a new one", &[]),
194 Command::new("compact", "Manually compact the session context", &[]),
195 Command::new("shake", "Drop heavy content from context", &[]),
196 Command::new("handoff", "Hand off context to a new session", &[]),
197 Command::new("resume", "Resume a different session", &[]),
198 Command::new("btw", "Ask an ephemeral side question", &[]),
199 Command::new("tan", "Run a background agent on tangential work", &[]),
200 Command::new("omfg", "Forge a rule from a recurring complaint", &[]),
201 Command::new("retry", "Retry the last failed agent turn", &[]),
202 Command::new("debug", "Open the debug tools selector", &[]),
203 Command::new("memory", "Inspect and operate memory maintenance", &[]),
204 Command::new("rename", "Rename the current session", &[]),
205 Command::new("move", "Move the session to a different directory", &[]),
206 Command::new("add-dir", "Add a workspace directory", &[]),
207 Command::new("remove-dir", "Remove a workspace directory", &[]),
208 Command::new("dirs", "List this session's workspace directories", &[]),
209 Command::new("marketplace", "Manage marketplace plugins", &[]),
210 Command::new("plugins", "View and manage installed plugins", &[]),
211 Command::new("reload-plugins", "Reload skills, commands, hooks, tools, and agents", &[]),
212 Command::new("force", "Force the next turn to use a specific tool", &["force:"]),
213 Command::new("live", "Start Codex-backed realtime voice mode", &[]),
214 Command::new("pause", "Freeze all agents until resumed", &[]),
215 Command::new("quit", "Quit the application", &["q"]),
216 ]
217}Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The command’s primary spelling, without the leading /.
Examples found in repository?
examples/chat/commands.rs (line 194)
177fn entries() -> Vec<EntrySpec> {
178 let commands = demo_commands();
179 let mut list = Vec::with_capacity(commands.len() + 3);
180 list.push(EntrySpec::action(
181 SWITCH_MODEL,
182 "Switch Model",
183 "Pick the model for this session",
184 "ctrl+p",
185 ));
186 list.push(EntrySpec::action(
187 TOGGLE_SIDEBAR,
188 "Toggle Sidebar",
189 "Show or hide the session rail",
190 "ctrl+b",
191 ));
192 list.push(EntrySpec::action(QUIT, "Quit", "Exit the demo", "ctrl+c"));
193 list.extend(commands.iter().map(|command| {
194 let name = fmts!("/{}", command.name());
195 EntrySpec {
196 value: name.clone(),
197 label: name.clone(),
198 name,
199 name_fg: CYAN,
200 detail: Str::from(command.description()),
201 key: Str::default(),
202 }
203 }));
204 list
205}Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
The one-line blurb shown beside the command name.
Examples found in repository?
examples/chat/commands.rs (line 200)
177fn entries() -> Vec<EntrySpec> {
178 let commands = demo_commands();
179 let mut list = Vec::with_capacity(commands.len() + 3);
180 list.push(EntrySpec::action(
181 SWITCH_MODEL,
182 "Switch Model",
183 "Pick the model for this session",
184 "ctrl+p",
185 ));
186 list.push(EntrySpec::action(
187 TOGGLE_SIDEBAR,
188 "Toggle Sidebar",
189 "Show or hide the session rail",
190 "ctrl+b",
191 ));
192 list.push(EntrySpec::action(QUIT, "Quit", "Exit the demo", "ctrl+c"));
193 list.extend(commands.iter().map(|command| {
194 let name = fmts!("/{}", command.name());
195 EntrySpec {
196 value: name.clone(),
197 label: name.clone(),
198 name,
199 name_fg: CYAN,
200 detail: Str::from(command.description()),
201 key: Str::default(),
202 }
203 }));
204 list
205}Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnsafeUnpin for Command
impl UnwindSafe for Command
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more