krypt_core/lib.rs
1//! `krypt-core` — the engine.
2//!
3//! Everything that does real work lives here, behind a stable Rust API.
4//! The `krypt` binary (in `krypt-cli`) is a thin shell around this crate.
5//!
6//! Current modules:
7//!
8//! - [`config`] — `.krypt.toml` schema, parser, validator (issue #9)
9//! - [`paths`] — `${VAR}` resolution with XDG defaults + platform gating
10//! (issue #11)
11//! - [`include`] — `include = [...]` glob expansion and config merging
12//! (issue #10)
13//! - [`copy`] — plan + atomic deploy of [[link]] and [[template]]
14//! entries to their resolved destinations (issue #12)
15//! - [`manifest`] — versioned record of what was deployed, with sha256
16//! hashes for drift detection (issue #13)
17//! - [`deploy`] — high-level link / unlink / relink orchestration
18//! over the other modules (issue #15)
19//! - [`tool_config`] — `${XDG_CONFIG}/krypt/config.toml` schema + I/O
20//! (issue #14)
21//! - [`init`] — `krypt init` orchestration: clone + write tool config
22//! (issue #14)
23//! - [`update`] — `krypt update` orchestration: pull repo + re-deploy
24//! (issue #17)
25//! - [`adopt`] — `krypt adopt` / `krypt adopt-edits`: import existing
26//! dotfiles into the repo and sync in-place edits back (issue #16)
27//! - [`doctor`] — `krypt doctor` diagnostic health-check: prints one
28//! status line per check and serializes to JSON for `--json` (issue #20)
29//!
30//! - [`setup`] — `krypt setup` interactive wizard: reads `[prompts]`
31//! sections, asks questions, and applies one of four built-in writers
32//! (gitconfig, hypr_vars, env, generic_template) (issue #18).
33//! - [`runner`] — step runner DSL: executes a `Vec<Step>` from a
34//! `[[command]]` or `[[hook]]` declaratively, with injected process,
35//! notifier, and prompter dependencies (issue #23).
36//! - [`predicate`] — predicate grammar + evaluator for `if =` conditions:
37//! `command_exists`, `env`, `platform`, `file_exists`, negation (`!`), and
38//! AND (`,`). [`predicate::default_predicate_evaluator`] wires a
39//! [`predicate::PredicateEnv`] into the runner's closure parameter
40//! (issue #24).
41//! - [`notify`] — cross-platform notification backends: `notify-send`
42//! (Linux), `osascript` / `terminal-notifier` (macOS), PowerShell
43//! (Windows), with `stderr` fallback. [`notify::AutoNotifier`] implements
44//! the [`runner::Notifier`] trait and replaces the old `RealNotifier` stub
45//! (issue #26).
46//! - [`dispatch`] — generic `krypt <group> <name>` dispatcher: list and run
47//! `[[command]]` entries from `.krypt.toml` for any group. Renamed from
48//! `menu` in issue #45; `krypt menu` is now `dispatch::run_in_group("menu", …)`.
49//! - [`battery`] — cross-platform battery state reader: `LinuxSysfsReader`
50//! (Linux), `UnsupportedReader` (macOS/Windows stub). Used by
51//! `krypt battery {report,log,clear}` (issue #28).
52
53#![forbid(unsafe_code)]
54#![warn(missing_docs)]
55
56pub mod adopt;
57pub mod battery;
58pub mod config;
59pub mod copy;
60pub mod deploy;
61pub mod dispatch;
62pub mod doctor;
63pub mod include;
64pub mod init;
65pub mod manifest;
66pub mod notify;
67pub mod paths;
68pub mod predicate;
69pub mod runner;
70pub mod setup;
71pub mod tool_config;
72pub mod update;
73
74pub use include::{expand_includes, load_with_includes};
75
76/// Crate version, exposed for `krypt --version` aggregation.
77pub const VERSION: &str = env!("CARGO_PKG_VERSION");