Skip to main content

Crate agent_rules_tool

Crate agent_rules_tool 

Source
Expand description

Lint and migrate AI agent rule files per agent-rules-spec.

§Quick start

use agent_rules_tool::{lint_string, migrate_string, LintOptions, MigrateOptions};
use agent_rules_tool::format::RuleFormat;

let report = lint_string(content, &LintOptions::default())?;
assert!(report.valid);

let migrated = migrate_string(
    content,
    &MigrateOptions {
        from: RuleFormat::Cursor,
        to: RuleFormat::Agents,
        ..Default::default()
    },
)?;

§Modules

  • lint — validate rule content against schema and RFC semantics
  • migrate — convert between tool-native and canonical formats
  • format — format detection and tool directory defaults
  • spec — vendored spec URLs, embedded schema, and constants
  • report — YAML lint report serialization

Re-exports§

pub use error::Error;
pub use format::RuleFormat;
pub use format::RuleFormatArg;
pub use lint::exceeds_threshold;
pub use lint::lint_directory;
pub use lint::lint_string;
pub use migrate::InputRule;
pub use migrate::MigrateOptions;
pub use migrate::MigrateResult;
pub use migrate::MigrateSummary;
pub use migrate::MigrateWarning;
pub use migrate::build_inputs_from_dirs;
pub use migrate::migrate_paths;
pub use migrate::migrate_string;

Modules§

cli
CLI definitions for the agent-rules-tool binary.
discover
Known tool rule directories and format inference from paths.
error
Error types returned by parse, lint, migrate, and I/O operations.
format
Rule format identifiers and auto-detection from frontmatter.
io
Atomic file writes used by migrate output.
lint
Lint rule file content against the embedded JSON Schema and RFC semantics.
migrate
Migrate agent rule files between tool-native and canonical formats.
parse
Parse markdown rule files into YAML frontmatter and body text.
report
YAML serialization of lint reports for CLI --report output.
schema
JSON Schema validation of rule frontmatter against the embedded schema.
spec
Spec citations, URLs, and embedded vendored artifacts from agent-rules-spec.
walk
Recursive discovery of rule files on disk.

Structs§

FileLintResult
Lint result for one file within a directory scan.
LintOptions
Options controlling lint_string and lint_directory.
LintReport
Result of linting one rule file’s content.
SpecIndex
Vendored agent-rules-spec index manifest.
SpecIndexEntry
One entry in SpecIndex::files.
Violation
A single lint finding with a citation into the spec or schema.

Enums§

Severity
Violation severity for lint results and exit-code thresholds.

Functions§

load_spec_index
Load the embedded spec index from spec::EMBEDDED_INDEX.