lifeloop-cli 0.2.0

Provider-neutral lifecycle abstraction and normalizer for AI harnesses
Documentation
//! Host integration asset rendering and merge behavior.
//!
//! Lifeloop owns the file shape, merge safety, and status reporting for
//! lifecycle integration assets installed into harness host directories
//! (`.claude/`, `.codex/`, `.hermes/`, `.openclaw/`). The `host apply`
//! and `host inspect` compatibility commands route here.
//!
//! # Boundary (issue #4)
//!
//! This module owns:
//! * rendering source/applied asset content as in-memory data,
//! * additive-merge logic that preserves user-owned entries,
//! * asset status reporting (`Present`/`Missing`/`Drifted`/`InvalidMode`/
//!   `NotApplicable`),
//! * supported-mode rules for each adapter.
//!
//! This module does **not** own:
//! * the hook protocol command strings themselves (those are issue #3 —
//!   the strings appear here only as opaque compatibility labels that the
//!   merge logic must recognize so it can scrub stale entries);
//! * the full adapter manifest registry (issue #6);
//! * lifecycle routing (issue #7);
//! * telemetry parsing (issue #5);
//! * filesystem IO. Callers handle reads, writes, mode bits, and atomic
//!   replace. This module is pure: it operates on `serde_json::Value`,
//!   strings, and byte slices.
//!
//! # CCD compatibility
//!
//! The command-prefix constants and legacy recognizer patterns
//! (`CCD_COMPAT_*`) are CCD compatibility labels — Lifeloop's first
//! client wires its own binary into harness hooks via these prefixes.
//! They are *not* core Lifeloop semantics: a future non-CCD client
//! gets its own profile in the same shape. Keeping them in one place
//! makes the compat surface auditable.
//!
//! # Lifecycle integration profiles (issue #26)
//!
//! [`LifecycleProfile`] generalizes the CCD-shaped command-prefix /
//! managed-event surface into a per-client-profile struct. The free
//! functions exported from this module keep their CCD-compat default
//! behavior (they delegate to [`CCD_COMPAT_PROFILE`]); paired
//! `*_with_profile` variants accept any profile so a non-CCD client
//! (e.g. [`LIFELOOP_DIRECT_PROFILE`], the post-slimdown shape where
//! the harness invokes the `lifeloop` CLI directly without CCD as
//! broker) can render and merge its own lifecycle hook assets without
//! editing core merge logic. This is the bridge contemplated by
//! `docs/release-gates.md` for the CCD slimdown
//! (dusk-network/ccd#723) — the slimdown lands by switching active
//! installs from `CCD_COMPAT_PROFILE` to a non-CCD profile, not by
//! rewriting the renderer.

mod merge;
mod model;
mod profiles;
mod render;
mod status;

pub use merge::{
    codex_hooks_contain_managed_lifecycle, codex_hooks_contain_managed_lifecycle_with_profile,
    codex_hooks_feature_is_enabled, merge_claude_settings, merge_claude_settings_text,
    merge_claude_settings_text_with_profile, merge_claude_settings_with_profile,
    merge_codex_config_text, merge_codex_hooks, merge_codex_hooks_text,
    merge_codex_hooks_text_with_profile, merge_codex_hooks_with_profile,
};
pub use model::*;
pub use profiles::*;
pub use render::{
    render_applied_assets, render_applied_assets_with_profile, render_required_source_assets,
    render_source_assets, render_source_assets_with_profile,
};
pub use status::{
    aggregate_status, asset_status, byte_equal_asset_status, claude_settings_status,
    claude_settings_status_with_profile, codex_config_status, codex_hooks_status,
    codex_hooks_status_with_profile,
};