pub const DEFAULT_TEMPLATE: &str = include_str!("../../assets/default_template.md");
pub const CONFIG_LINT_PLUGIN: &str = include_str!("../../assets/config_lint.yml");
pub const CONFIG_LINT_URL: &str =
"https://raw.githubusercontent.com/nickderobertis/llmlint/main/assets/config_lint.yml";
pub const INIT_CONFIG: &str = include_str!("../../assets/init.llmlint.yml");
pub const CONFIG_SCHEMA: &str = include_str!("../../assets/llmlint.schema.json");
pub fn bundled_url(url: &str) -> Option<&'static str> {
if url == CONFIG_LINT_URL {
Some(CONFIG_LINT_PLUGIN)
} else {
None
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn bundled_url_resolves_config_lint() {
assert_eq!(bundled_url(CONFIG_LINT_URL), Some(CONFIG_LINT_PLUGIN));
assert!(bundled_url("https://example.com/other.yml").is_none());
}
#[test]
fn embedded_assets_are_non_empty() {
assert!(DEFAULT_TEMPLATE.contains("{% for r in rules %}"));
assert!(CONFIG_LINT_PLUGIN.contains("name_describes_what_the_rule_checks"));
assert!(INIT_CONFIG.contains("config_lint.yml"));
assert!(INIT_CONFIG.contains("plugins:"));
let schema: serde_json::Value = serde_json::from_str(CONFIG_SCHEMA).unwrap();
assert_eq!(schema["$id"], crate::domain::config_schema::SCHEMA_URL);
}
}