agentic_navigation_guide/
lib.rs

1//! # Agentic Navigation Guide
2//!
3//! A library for verifying hand-written navigation guides against filesystem structure.
4//!
5//! This library provides functionality to:
6//! - Parse navigation guides from markdown files
7//! - Validate syntax of navigation guides
8//! - Verify guides against actual filesystem state
9//! - Generate navigation guides from directory structures
10
11#![warn(clippy::all)]
12#![allow(
13    clippy::module_name_repetitions,
14    clippy::must_use_candidate,
15    clippy::missing_errors_doc,
16    clippy::missing_const_for_fn,
17    clippy::return_self_not_must_use,
18    clippy::unused_self,
19    clippy::only_used_in_recursion,
20    clippy::unnecessary_wraps
21)]
22
23pub mod dumper;
24pub mod errors;
25pub mod parser;
26pub mod types;
27pub mod validator;
28pub mod verifier;
29
30pub use dumper::Dumper;
31pub use errors::{AppError, Result, SemanticError, SyntaxError};
32pub use parser::Parser;
33pub use types::{ExecutionMode, FilesystemItem, LogLevel, NavigationGuide, NavigationGuideLine};
34pub use validator::Validator;
35pub use verifier::Verifier;
36
37/// Parse a navigation guide from markdown content
38pub fn parse_navigation_guide(content: &str) -> Result<NavigationGuide> {
39    Parser::new().parse(content)
40}
41
42/// Check if a navigation guide has valid syntax
43pub fn check_syntax(guide: &NavigationGuide) -> Result<()> {
44    Validator::new().validate_syntax(guide)
45}
46
47/// Verify a navigation guide against the filesystem
48pub fn verify_guide(guide: &NavigationGuide, root_path: &std::path::Path) -> Result<()> {
49    Verifier::new(root_path).verify(guide)
50}
51
52/// Dump a directory structure as a navigation guide
53pub fn dump_directory(
54    root_path: &std::path::Path,
55    max_depth: Option<usize>,
56    exclude_patterns: &[String],
57    indent_size: usize,
58) -> Result<String> {
59    Dumper::new(root_path)
60        .with_max_depth(max_depth)
61        .with_exclude_patterns(exclude_patterns)?
62        .with_indent_size(indent_size)
63        .dump()
64}