motte 0.1.0

Defensive mount and root workspace helper for terminal environments
Documentation
  • Coverage
  • 93.33%
    28 out of 30 items documented5 out of 27 items with examples
  • Size
  • Source code size: 15.39 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 589.45 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 25s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Tknott95

motte

Defensive mount and root workspace helper for terminal environments.

Purpose

motte (from Old English mot, a mound or defensive hillock) provides workspace root detection, mount point resolution, path ancestry walking, and defensive boundary enforcement for building secure terminal environments.

Features

  • WorkspaceRoot — find project roots by marker file search
  • MountPoint — represent and query filesystem mount boundaries
  • PathAncestry — walk path components from leaf to root
  • DefensiveBoundary — safe path resolution with traversal prevention
  • Zero dependencies

Install

cargo add motte

Usage

use motte::{WorkspaceRoot, MountPoint, DefensiveBoundary};

// Find workspace root by marker files
let root_finder = WorkspaceRoot::rust_defaults();

// Check mount points
let mp = MountPoint::new("/tmp");
assert!(mp.contains("/tmp/project/file.txt"));

// Defensive boundary for safe path resolution
let boundary = DefensiveBoundary::new("/tmp/project");
let safe_path = boundary.resolve_safe("src/main.rs").unwrap();
assert!(safe_path.starts_with("/tmp/project"));

License

MIT OR Apache-2.0