File size: 888 Bytes
d90101d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use derive_setters::Setters;
use serde::Deserialize;

/// A user-defined command loaded from a Markdown file with YAML frontmatter.
///
/// Commands are discovered from `.md` files in the forge commands directories
/// and made available as slash commands in the UI. The `name` and `description`
/// come from YAML frontmatter; the `prompt` is the Markdown body of the file.
#[derive(Debug, Clone, Default, Deserialize, Setters, PartialEq)]
#[setters(into, strip_option)]
pub struct Command {
    /// The command name used to invoke it (e.g. `github-pr-description`).
    #[serde(default)]
    pub name: String,
    /// Short description shown in the command list.
    #[serde(default)]
    pub description: String,
    /// The prompt template body (Markdown content after the frontmatter).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub prompt: Option<String>,
}