Skip to main content

get_tool_for_prefix

Function get_tool_for_prefix 

Source
pub fn get_tool_for_prefix(prefix: &str) -> Option<&'static str>
Expand description

Returns the tool name for a given rule ID prefix, if any.

Only returns a tool if ALL rules with that prefix have the same tool. Prefixes with mixed tools or no tools return None.

ยงExample

use agnix_rules::get_tool_for_prefix;

assert_eq!(get_tool_for_prefix("CC-HK-"), Some("claude-code"));
assert_eq!(get_tool_for_prefix("COP-"), Some("github-copilot"));
assert_eq!(get_tool_for_prefix("CUR-"), Some("cursor"));
// Generic prefixes without a consistent tool return None
assert_eq!(get_tool_for_prefix("MCP-"), None);