agentlink_domain/lib.rs
1//! The agentlink domain.
2//!
3//! agentlink gives every AI coding agent in a repository the same brain, without
4//! copying a single file. It does that by exploiting a fact about the 2026
5//! ecosystem: for the resources that matter most, **the format has already
6//! converged and only the location differs.**
7//!
8//! * Instructions converged on `AGENTS.md` (Linux Foundation, December 2025).
9//! * Skills converged on Agent Skills / `SKILL.md` (open specification,
10//! December 2025), read by 30+ tools.
11//!
12//! So each pairing of an agent with a resource resolves to one of four verdicts:
13//!
14//! | Verdict | Meaning | Cost |
15//! |-----------------------------------------------|-------------------------------------------|------|
16//! | [`Native`](model::Strategy::Native) | the tool already reads the canonical path | zero |
17//! | [`Link`](model::Strategy::Link) | same format, different path | one link |
18//! | [`Import`](model::Strategy::Import) | link impossible; write a one-line stub | one small file |
19//! | [`plan::Blocked`] | needs a human decision | nothing is written |
20//!
21//! The payoff is that bidirectional propagation is not a feature anyone has to
22//! implement. For a `Native` or `Link` verdict there is exactly one inode, so
23//! editing, renaming, moving or deleting through any agent's path is immediately
24//! visible to every other agent — with no daemon, no watcher and no
25//! reconciliation pass.
26//!
27//! # Layering
28//!
29//! ```text
30//! agentlink-cli composition root, human-facing output
31//! ↓
32//! agentlink-domain this crate: pure domain, no `std::fs`
33//! ↑
34//! agentlink-fs adapter implementing [`Workspace`] against a real directory
35//! ```
36//!
37//! Everything here is deterministic and testable without a filesystem: planning
38//! is a pure function of observable state, and [`testing::FakeWorkspace`]
39//! simulates hosts — including Windows without symlink privileges — that a given
40//! CI runner cannot otherwise reproduce.
41
42#![forbid(unsafe_code)]
43#![warn(missing_debug_implementations, clippy::doc_markdown)]
44
45pub mod apply;
46pub mod config;
47pub mod gitignore;
48pub mod layout;
49pub mod lock;
50pub mod model;
51pub mod path;
52pub mod plan;
53pub mod provider;
54pub mod registry;
55pub mod workspace;
56
57#[cfg(any(test, feature = "testing"))]
58pub mod testing;
59
60pub use apply::{ApplyReport, apply};
61pub use config::Config;
62pub use layout::Layout;
63pub use lock::Lock;
64pub use model::{LinkSupport, LinkTarget, NodeKind, ResourceKind, Strategy, Via};
65pub use path::RelPath;
66pub use plan::{Blocked, Outcome, Plan, Planner, Skip, Step};
67pub use provider::{Capability, Provider};
68pub use registry::Registry;
69pub use workspace::{FsError, FsResult, Workspace};
70
71/// The version of the `agentlink` crate, surfaced in `--version` and lock files.
72pub const VERSION: &str = env!("CARGO_PKG_VERSION");