Expand description
Runtime capability detection for optional bones subsystems.
This module probes the active SQLite database and filesystem to determine
which optional features are available at startup. The result is a
Capabilities struct that callers use to choose between full-featured
and gracefully-degraded code paths — without panicking on missing deps.
§Design
Every probe is infallible from the caller’s perspective: it returns a
bool, logs the outcome at debug! level, and never propagates errors.
This ensures the CLI remains usable even when subsystems are broken or not
yet initialised.
§Usage
use bones_core::capabilities::{detect_capabilities, describe_capabilities};
use bones_core::db::open_projection;
use std::path::Path;
let conn = open_projection(Path::new(".bones/bones-projection.sqlite3")).unwrap();
let caps = detect_capabilities(&conn);
if !caps.db.fts5 {
eprintln!("FTS5 not available — falling back to LIKE queries");
}
for status in describe_capabilities(&caps) {
if !status.available {
eprintln!("[{}] degraded: {}", status.name, status.fallback);
}
}Structs§
- Capabilities
- Runtime capability flags detected at startup.
- Capability
Status - Status of a single capability for user-visible display.
- DbCapabilities
- Database-derived capability flags.
- FsCapabilities
- Filesystem-derived capability flags.
Functions§
- describe_
capabilities - Describe which capabilities are active or missing for user display.
- detect_
capabilities - Detect available capabilities by probing the database and filesystem.