Expand description
Validation rules for agnix - agent configuration linter.
This crate provides the rule definitions used by agnix to validate agent configurations including Skills, Hooks, MCP servers, Memory files, and Plugins.
§Usage
use agnix_rules::{RULES_DATA, RULES_METADATA, VALID_TOOLS, TOOL_RULE_PREFIXES};
// RULES_DATA is a static array of (rule_id, rule_name) tuples
for (id, name) in RULES_DATA {
println!("{}: {}", id, name);
}
// VALID_TOOLS contains all tool names from rules.json
for tool in VALID_TOOLS {
println!("Tool: {}", tool);
}
// TOOL_RULE_PREFIXES maps rule prefixes to their tools
for (prefix, tool) in TOOL_RULE_PREFIXES {
println!("Prefix {} -> Tool {}", prefix, tool);
}§Rule Categories
- AS-xxx: Agent Skills
- CC-xxx: Claude Code (Hooks, Skills, Memory, etc.)
- MCP-xxx: Model Context Protocol
- COP-xxx: GitHub Copilot
- CUR-xxx: Cursor
- XML-xxx: XML/XSLT based configs
- XP-xxx: Cross-platform rules
Constants§
- AUTHORING_
CATALOG_ JSON - Raw authoring catalog JSON (top-level
authoringsection from rules.json). This is generated at build time to keep rules.json as the source of truth. - AUTHORING_
FAMILIES - Authoring family IDs derived from rules.json authoring.families.
- AUTHORING_
VERSION - Authoring catalog schema version.
- RULES_
DATA - Rule data as (id, name) tuples.
- RULES_
METADATA - Rule metadata as (id, category, severity, tool) tuples.
- TOOL_
RULE_ PREFIXES - Mapping of rule ID prefixes to their associated tools.
- VALID_
TOOLS - Valid tool names derived from rules.json evidence.applies_to.tool.
Functions§
- authoring_
catalog_ json - Returns the raw authoring catalog JSON generated from rules.json.
- authoring_
families - Returns authoring family IDs derived from rules.json
authoring.families. - get_
prefixes_ for_ tool - Returns all rule prefixes associated with a tool.
- get_
rule_ metadata - Looks up structured metadata for a rule by ID.
- get_
rule_ name - Looks up a rule by ID, returning the name if found.
- get_
tool_ for_ prefix - Returns the tool name for a given rule ID prefix, if any.
- is_
valid_ tool - Check if a tool name is valid (exists in rules.json).
- normalize_
tool_ name - Normalize a tool name to its canonical form from rules.json.
- rule_
count - Returns the total number of rules.
- valid_
tools - Returns the list of valid tool names derived from rules.json.