Skip to main content

nils_common/
lib.rs

1//! Foundation crate shared across nils-* CLIs.
2//!
3//! Each public module documents its own surface; `crates/nils-common/README.md` carries the
4//! per-module narrative and the consumer index, and
5//! `docs/specs/workspace-shared-crate-boundary-v1.md` carries the boundary contract.
6//!
7//! ## Compatibility rules
8//! - Returns structured results only; user-facing warning/error text stays in caller adapters.
9//! - Exit-code mapping stays in caller crates.
10//! - APIs stay domain-neutral and must not encode crate-specific UX policies.
11//! - Quoting and ANSI differences are expressed via explicit mode/policy parameters.
12//!
13pub mod clipboard;
14pub mod env;
15pub mod fs;
16pub mod git;
17pub mod markdown;
18pub mod process;
19pub mod provider_runtime;
20pub mod rate_limits_ansi;
21pub mod shell;
22
23pub fn greeting(name: &str) -> String {
24    format!("Hello, {name}!")
25}
26
27#[cfg(test)]
28mod tests {
29    use super::*;
30    use pretty_assertions::assert_eq;
31
32    #[test]
33    fn greeting_formats_name() {
34        let result = greeting("Nils");
35        assert_eq!(result, "Hello, Nils!");
36    }
37}