Skip to main content

ailint_core/rules/structural/
mod.rs

1//! Structural rules: schema / frontmatter / required-section validation.
2//! Range: **AIL001 – AIL099**.
3
4pub mod broken_local_link;
5pub mod empty_file;
6pub mod frontmatter_schema;
7pub mod malformed_yaml;
8pub mod mcp_schema;
9pub mod required_section;
10
11pub use broken_local_link::BrokenLocalLinkRule;
12pub use empty_file::EmptyFileRule;
13pub use frontmatter_schema::FrontmatterSchemaRule;
14pub use malformed_yaml::MalformedYamlRule;
15pub use mcp_schema::McpSchemaValidationRule;
16pub use required_section::MissingRequiredSectionRule;
17
18use crate::rules::{Rule, RuleId};
19
20/// AIL001: frontmatter fails the schema expected for its file type.
21pub const AIL001: RuleId = RuleId::new(1, "no-frontmatter-schema-error");
22/// AIL002: guidance file is empty or whitespace-only.
23pub const AIL002: RuleId = RuleId::new(2, "instructions-file-empty");
24/// AIL003: a section required for this file type is missing.
25pub const AIL003: RuleId = RuleId::new(3, "missing-required-section");
26/// AIL004: MCP server config file fails the minimum schema.
27pub const AIL004: RuleId = RuleId::new(4, "mcp-schema-validation");
28/// AIL040: relative link points at a file that does not exist.
29pub const AIL040: RuleId = RuleId::new(40, "broken-local-link");
30/// AIL041: YAML file (or frontmatter) fails to parse.
31pub const AIL041: RuleId = RuleId::new(41, "malformed-yaml");
32
33/// All structural rules, in registration order.
34pub fn all_rules() -> Vec<Box<dyn Rule>> {
35    vec![
36        Box::new(EmptyFileRule),
37        Box::new(FrontmatterSchemaRule),
38        Box::new(MissingRequiredSectionRule),
39        Box::new(BrokenLocalLinkRule),
40        Box::new(MalformedYamlRule),
41        Box::new(McpSchemaValidationRule),
42    ]
43}