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 recursive;
27pub mod types;
28pub mod validator;
29pub mod verifier;
30
31pub use dumper::Dumper;
32pub use errors::{AppError, Result, SemanticError, SyntaxError};
33pub use parser::Parser;
34pub use recursive::{find_guides, verify_guides, GuideLocation, GuideVerificationResult};
35pub use types::{ExecutionMode, FilesystemItem, LogLevel, NavigationGuide, NavigationGuideLine};
36pub use validator::Validator;
37pub use verifier::Verifier;
38
39/// Parse a navigation guide from markdown content
40pub fn parse_navigation_guide(content: &str) -> Result<NavigationGuide> {
41    Parser::new().parse(content)
42}
43
44/// Check if a navigation guide has valid syntax
45pub fn check_syntax(guide: &NavigationGuide) -> Result<()> {
46    Validator::new().validate_syntax(guide)
47}
48
49/// Verify a navigation guide against the filesystem
50pub fn verify_guide(guide: &NavigationGuide, root_path: &std::path::Path) -> Result<()> {
51    Verifier::new(root_path).verify(guide)
52}
53
54/// Dump a directory structure as a navigation guide
55pub fn dump_directory(
56    root_path: &std::path::Path,
57    max_depth: Option<usize>,
58    exclude_patterns: &[String],
59    indent_size: usize,
60) -> Result<String> {
61    Dumper::new(root_path)
62        .with_max_depth(max_depth)
63        .with_exclude_patterns(exclude_patterns)?
64        .with_indent_size(indent_size)
65        .dump()
66}