feat(cli): rename mcp_config asset category to mcp-config with snake_case alias
This commit is contained in:
@@ -590,12 +590,33 @@ mod tests {
|
|||||||
parse(&["--install-builtins", "agents"]).install_builtins,
|
parse(&["--install-builtins", "agents"]).install_builtins,
|
||||||
Some(AssetCategory::Agents)
|
Some(AssetCategory::Agents)
|
||||||
);
|
);
|
||||||
|
assert_eq!(
|
||||||
|
parse(&["--install-builtins", "mcp-config"]).install_builtins,
|
||||||
|
Some(AssetCategory::McpConfig)
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parse(&["--install-builtins", "mcp_config"]).install_builtins,
|
parse(&["--install-builtins", "mcp_config"]).install_builtins,
|
||||||
Some(AssetCategory::McpConfig)
|
Some(AssetCategory::McpConfig)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn mcp_config_canonical_value_is_kebab_case() {
|
||||||
|
use clap::ValueEnum;
|
||||||
|
|
||||||
|
let category = AssetCategory::McpConfig.to_possible_value().unwrap();
|
||||||
|
assert_eq!(category.get_name(), "mcp-config");
|
||||||
|
assert!(category.get_name_and_aliases().any(|n| n == "mcp_config"));
|
||||||
|
assert!(AssetCategory::NAMES.contains(&"mcp-config"));
|
||||||
|
assert!(!AssetCategory::NAMES.contains(&"mcp_config"));
|
||||||
|
|
||||||
|
let filter = InstallFilter::McpConfig.to_possible_value().unwrap();
|
||||||
|
assert_eq!(filter.get_name(), "mcp-config");
|
||||||
|
assert!(filter.get_name_and_aliases().any(|n| n == "mcp_config"));
|
||||||
|
assert!(InstallFilter::NAMES.contains(&"mcp-config"));
|
||||||
|
assert!(!InstallFilter::NAMES.contains(&"mcp_config"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_install_builtins_conflicts_with_install() {
|
fn parse_install_builtins_conflicts_with_install() {
|
||||||
assert!(
|
assert!(
|
||||||
@@ -633,6 +654,26 @@ mod tests {
|
|||||||
parse(&["--install", "https://github.com/x/y", "--filter", "agents"]).filter,
|
parse(&["--install", "https://github.com/x/y", "--filter", "agents"]).filter,
|
||||||
Some(InstallFilter::Agents)
|
Some(InstallFilter::Agents)
|
||||||
);
|
);
|
||||||
|
assert_eq!(
|
||||||
|
parse(&[
|
||||||
|
"--install",
|
||||||
|
"https://github.com/x/y",
|
||||||
|
"--filter",
|
||||||
|
"mcp-config"
|
||||||
|
])
|
||||||
|
.filter,
|
||||||
|
Some(InstallFilter::McpConfig)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
parse(&[
|
||||||
|
"--install",
|
||||||
|
"https://github.com/x/y",
|
||||||
|
"--filter",
|
||||||
|
"mcp_config"
|
||||||
|
])
|
||||||
|
.filter,
|
||||||
|
Some(InstallFilter::McpConfig)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -4158,6 +4158,10 @@ mod tests {
|
|||||||
classify_install_target("agents", &owned_names(&["agents"])),
|
classify_install_target("agents", &owned_names(&["agents"])),
|
||||||
InstallTarget::Category(AssetCategory::Agents)
|
InstallTarget::Category(AssetCategory::Agents)
|
||||||
);
|
);
|
||||||
|
assert_eq!(
|
||||||
|
classify_install_target("mcp-config", &[]),
|
||||||
|
InstallTarget::Category(AssetCategory::McpConfig)
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
classify_install_target("mcp_config", &[]),
|
classify_install_target("mcp_config", &[]),
|
||||||
InstallTarget::Category(AssetCategory::McpConfig)
|
InstallTarget::Category(AssetCategory::McpConfig)
|
||||||
|
|||||||
+6
-6
@@ -407,12 +407,12 @@ pub enum AssetCategory {
|
|||||||
Macros,
|
Macros,
|
||||||
Functions,
|
Functions,
|
||||||
Skills,
|
Skills,
|
||||||
#[value(name = "mcp_config")]
|
#[value(name = "mcp-config", alias = "mcp_config")]
|
||||||
McpConfig,
|
McpConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AssetCategory {
|
impl AssetCategory {
|
||||||
pub const NAMES: [&'static str; 5] = ["agents", "macros", "functions", "skills", "mcp_config"];
|
pub const NAMES: [&'static str; 5] = ["agents", "macros", "functions", "skills", "mcp-config"];
|
||||||
|
|
||||||
pub fn parse(name: &str) -> Option<Self> {
|
pub fn parse(name: &str) -> Option<Self> {
|
||||||
match name {
|
match name {
|
||||||
@@ -420,7 +420,7 @@ impl AssetCategory {
|
|||||||
"macros" => Some(Self::Macros),
|
"macros" => Some(Self::Macros),
|
||||||
"functions" => Some(Self::Functions),
|
"functions" => Some(Self::Functions),
|
||||||
"skills" => Some(Self::Skills),
|
"skills" => Some(Self::Skills),
|
||||||
"mcp_config" => Some(Self::McpConfig),
|
"mcp-config" | "mcp_config" => Some(Self::McpConfig),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -439,7 +439,7 @@ pub enum InstallFilter {
|
|||||||
Skills,
|
Skills,
|
||||||
Macros,
|
Macros,
|
||||||
Functions,
|
Functions,
|
||||||
#[value(name = "mcp_config")]
|
#[value(name = "mcp-config", alias = "mcp_config")]
|
||||||
McpConfig,
|
McpConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,7 +450,7 @@ impl InstallFilter {
|
|||||||
"skills",
|
"skills",
|
||||||
"macros",
|
"macros",
|
||||||
"functions",
|
"functions",
|
||||||
"mcp_config",
|
"mcp-config",
|
||||||
];
|
];
|
||||||
|
|
||||||
pub fn parse(name: &str) -> Option<Self> {
|
pub fn parse(name: &str) -> Option<Self> {
|
||||||
@@ -460,7 +460,7 @@ impl InstallFilter {
|
|||||||
"skills" => Some(Self::Skills),
|
"skills" => Some(Self::Skills),
|
||||||
"macros" => Some(Self::Macros),
|
"macros" => Some(Self::Macros),
|
||||||
"functions" => Some(Self::Functions),
|
"functions" => Some(Self::Functions),
|
||||||
"mcp_config" => Some(Self::McpConfig),
|
"mcp-config" | "mcp_config" => Some(Self::McpConfig),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7871,6 +7871,10 @@ mod tests {
|
|||||||
AssetCategory::parse("functions"),
|
AssetCategory::parse("functions"),
|
||||||
Some(AssetCategory::Functions)
|
Some(AssetCategory::Functions)
|
||||||
);
|
);
|
||||||
|
assert_eq!(
|
||||||
|
AssetCategory::parse("mcp-config"),
|
||||||
|
Some(AssetCategory::McpConfig)
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
AssetCategory::parse("mcp_config"),
|
AssetCategory::parse("mcp_config"),
|
||||||
Some(AssetCategory::McpConfig)
|
Some(AssetCategory::McpConfig)
|
||||||
|
|||||||
Reference in New Issue
Block a user