Guidance for agents editing this repository.
- Place Rust doc comments (
///and//!) before attribute directives such as#[derive(...)],#[cfg(...)], and serde attributes. - Prefer comments that explain intent, tradeoffs, and context over comments that restate obvious behavior.
- Do not add trivial inline comments.
- Keep the non-recursive model: each directory has its own
.treewardfile containing only immediate children. - Keep entry naming and shape consistent across runtime and persisted representations:
- Field name is
symlink_target(nottarget). - Entry variants are
File,Dir, andSymlink. - Persisted file entries use
mtime_nanos(u64) andsize, plussha256in ward files.
- Field name is
- Use deterministic maps (
BTreeMap) for entry collections to preserve stable TOML output. - Keep
#[serde(deny_unknown_fields)]on persisted types to fail fast on unexpected input.
- Use
thiserrorfor typed library errors;anyhowis acceptable at CLI boundaries. - Corrupted/unreadable
.treewardfiles and permission failures are fatal errors. - Do not silently skip filesystem problems.
- Preserve concurrent-modification checks when checksumming files (compare mtime before and after read; no retries).
- Symlinks are tracked but never followed.
- Use
symlink_metadata()(notmetadata()) when type-dispatching filesystem entries. - Use
read_link()for symlink targets. - Broken symlinks are valid tracked entries.
- Runtime metadata uses
SystemTime. - Persisted metadata uses nanoseconds since
UNIX_EPOCHinmtime_nanos(u64). - Use nanosecond-precision conversion when writing ward files.
- For tree walks, compare both ward entries and filesystem entries (union traversal).
- Visit subdirectories found in either source.
- Canonicalize the root path before recursive operations.
PR titles must follow Conventional Commits style. This is enforced by CI and used by git-cliff for changelog generation.
- Allowed types:
feat,fix,docs,doc,perf,refactor,style,test,chore,ci,revert. - Scope is optional. Examples:
feat: add user login,fix(parser): handle empty input. - Type must reflect user-visible behavior, not implementation activity.
- CLI interface or behavior changes must be
feat,fix, orperf(use!when breaking), notrefactor. - Every PR body must contain exactly one of
changelog: includeorchangelog: skip. This is enforced by CI.
When the user asks to make or cut a release, follow the Releasing section of CONTRIBUTING.md.
cargo testcargo clippy --all-targets --all-features -- -D warningscargo fmtdprint fmt