Skip to main content

forge_server/
commands.rs

1//! forge's own slash commands: the catalogue a view offers beside the
2//! ones the CLI advertises. View-side data with no session in it, so it
3//! lives here rather than in either view: the table is the same for every
4//! reader, and a second copy would drift.
5//!
6//! **Every name here is one the surviving stack answers.** The terminal's
7//! own handlers (`/diff`, `/spinner`, `/dictate`, `/gateway`,
8//! `/launchpad`) went with it rather than being ported: a name advertised
9//! here and answered nowhere is worse than an absent one, because typing
10//! it reaches the model as prose. Their filed issues are the later menu.
11//!
12//! **`/usage` describes the CLI's own answer.** The name is a CLI builtin,
13//! and the client's page that answered it is gone, so the line must state
14//! what typing it draws rather than that page's report.
15
16/// One command in the catalogue: the name as it is typed, and what it
17/// does.
18#[derive(Debug, Clone, Copy, PartialEq, Eq)]
19pub struct ForgeCommand {
20    pub name: &'static str,
21    pub description: &'static str,
22}
23
24/// Every command in the catalogue, alphabetical by name, which is the
25/// order a dropdown draws them in.
26pub const FORGE_COMMANDS: &[ForgeCommand] = &[
27    ForgeCommand { name: "/compact", description: "Compact session context" },
28    ForgeCommand { name: "/effort", description: "Show / set thinking effort" },
29    ForgeCommand { name: "/handoff", description: "Hand off to a fresh session" },
30    ForgeCommand { name: "/mode", description: "Show / set session mode" },
31    ForgeCommand { name: "/model", description: "Show / set session model" },
32    ForgeCommand { name: "/new", description: "Start a fresh session" },
33    ForgeCommand { name: "/resume", description: "Resume a session by ID" },
34    ForgeCommand { name: "/usage", description: "Show session cost and plan usage" },
35];
36
37/// Whether `name` is in the catalogue. A view rendering the CLI's own
38/// list skips these, so one command is not drawn twice.
39pub fn is_forge_command(name: &str) -> bool {
40    FORGE_COMMANDS.iter().any(|command| command.name == name)
41}