Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Crates

Detailed per-crate reference. The seven crates form a strict DAG; see Architecture for the diagram. Module paths below are crates/<name>/src/....

guisu-core

Foundation types shared by every other crate. Zero non-std dependencies.

ModuleTypes
path.rsAbsPath, RelPath — newtype wrappers around PathBuf that cannot be mixed at compile time.
platform.rsPlatform { os, arch } and the CURRENT_PLATFORM constant.
traits.rsShared traits: AsAbsPath, AsRelPath.
error.rsError enum with the variants every crate needs.
#![allow(unused)]
fn main() {
let p = AbsPath::new("/home/user/.config/guisu")?;
let r = p.join(RelPath::new("dotfiles")?);
}

guisu-crypto

age encryption, file and inline. Built on the age crate.

ModulePublic API
age.rsdecrypt_file_content, encrypt_file_content, decrypt_inline, encrypt_inline.
identity.rsload_identities(path, is_ssh) — read age or SSH identity files.
recipient.rsparse_recipient(string) and derive_recipients(identities) — used during encryption.

Encryption writes to all configured recipients; decryption tries each identity in order until one works.

guisu-vault

Secret provider abstraction over password-manager CLIs.

#![allow(unused)]
fn main() {
pub trait SecretProvider: Send + Sync {
    fn name(&self) -> &str;
    fn is_available(&self) -> bool;
    fn execute(&self, args: &[&str]) -> Result<serde_json::Value>;
    fn help(&self) -> &str;
}
}
FileProvider
bw.rsBwCli (Bitwarden CLI) and RbwCli (unofficial Rust Bitwarden CLI).
bws.rsBwsCli (Bitwarden Secrets).

The cache lives in guisu-template (per-apply), not here.

guisu-template

minijinja environment with a curated function library.

ModuleWhat it contains
engine.rsTemplateEngine::new() and the two with_* constructors. add_function / add_filter calls register every function.
context.rsTemplateContext — the typed bag of variables injected into every render.
functions/One file per category: system.rs, vault.rs, strings.rs, data.rs, crypto.rs, files.rs.
info.rsHelper for guisu info to summarise the template engine state.
#![allow(unused)]
fn main() {
let engine = TemplateEngine::with_identities_and_template_dir(
    identities,
    Some(template_dir),
);
let rendered = engine.render_str(template, &context)?;
}

guisu-config

Loads and merges .guisu.toml plus platform-specific variable files.

ModuleWhat it contains
config.rsThe Config struct and sub-configs (GeneralConfig, AgeConfig, BitwardenConfig, UiConfig, IgnoreConfig, EditConfig).
dirs.rsresolve_dirs — applies [general] src_dir / dst_dir to the runtime context.
ignores.rsIgnoresConfig and the loader for per-platform ignore files.
patterns.rsIgnoreMatcher — gitignore-style pattern compilation.
variables.rsPer-platform variable loading (.guisu/variables/{darwin,linux,windows}/*.toml).
#![allow(unused)]
fn main() {
let config = Config::load_from_source(source_dir)?;
let patterns = config.platform_ignore_patterns();
}

guisu-engine

The three-state model and the apply loop. The largest crate by line count.

ModuleWhat it contains
state.rsSourceState, TargetState, DestinationState, PersistentState trait + RedbPersistentState, EntryState, HookState.
entry.rsSourceEntry, TargetEntry, DestEntry, EntryKind.
attr.rsFileAttributes (plain struct: is_template, is_encrypted, mode).
content.rsThe raw byte pipeline.
processor.rsContentProcessor<D, R> — generic decrypt + render pipeline.
database.rsredb table definitions.
hash.rsBLAKE3 helpers.
system.rsPlatform-specific destination state reads.
validator.rsCross-state validation.
git.rsIn-process git operations (init, fetch, merge) using git2.
hooks/Pre/post/once/onchange hook discovery and execution.
adapters/Alternative implementations (e.g. for tests).

guisu-cli

Binary + library. The binary entry point is src/main.rs, which delegates to guisu::run(cli).

ModuleWhat it contains
lib.rsCli (clap derive) and Commands enum.
cmd/One file per subcommand: add.rs, age.rs, apply.rs, cat.rs, diff.rs, edit.rs, hooks.rs, ignored.rs, info.rs, init.rs, status.rs, templates.rs, update.rs, variables.rs.
command.rsThe Command trait implemented by every subcommand.
common.rsRuntimeContext — shared state (config, paths, etc.) passed to every command.
conflict.rsThe interactive conflict TUI.
ui/Reusable TUI widgets.
stats.rsApplyStats — counted output of an apply.
#![allow(unused)]
fn main() {
impl Command for ApplyCommand {
    type Output = ApplyStats;
    fn execute(&self, ctx: &RuntimeContext) -> Result<ApplyStats> { ... }
}
}

Public surface stability

The guisu-cli binary’s command-line interface is stable. The library crates (guisu-core, guisu-crypto, guisu-vault, guisu-template, guisu-config, guisu-engine) are not yet API-stable; expect breaking changes before v1.0. See the Roadmap for the stabilisation timeline.

See also