Skip to main content

gobby_core/
lib.rs

1//! Shared primitives for Gobby CLI tools.
2//!
3//! The baseline crate stays dependency-light for consumers that only need
4//! project discovery, bootstrap config, daemon URLs, and shared foundation
5//! vocabulary. Datastore and indexing adapters sit behind Cargo feature gates
6//! so small binaries do not inherit services they never call.
7
8// Always available - existing modules.
9pub mod bootstrap;
10pub mod cli_contract;
11pub mod daemon_url;
12pub mod project;
13pub mod provisioning;
14
15// Always available - lightweight foundation modules.
16pub mod ai_context;
17pub mod ai_types;
18pub mod codewiki_contract;
19pub mod config;
20pub mod degradation;
21mod libpq;
22pub mod setup;
23pub mod token_budget;
24
25/// Return Gobby home, respecting `GOBBY_HOME` when set.
26pub fn gobby_home() -> anyhow::Result<std::path::PathBuf> {
27    if let Some(home) = std::env::var_os("GOBBY_HOME") {
28        return Ok(std::path::PathBuf::from(home));
29    }
30    dirs::home_dir()
31        .map(|home| home.join(".gobby"))
32        .ok_or_else(|| anyhow::anyhow!("cannot determine home directory"))
33}
34
35// Feature-gated modules.
36#[cfg(feature = "ai")]
37pub mod ai;
38
39#[cfg(feature = "postgres")]
40pub mod postgres;
41
42#[cfg(feature = "postgres")]
43pub mod secrets;
44
45#[cfg(feature = "falkor")]
46pub mod falkor;
47
48#[cfg(feature = "qdrant")]
49pub mod qdrant;
50
51#[cfg(feature = "indexing")]
52pub mod indexing;
53
54#[cfg(feature = "search")]
55pub mod search;
56
57#[cfg(feature = "graph-analytics")]
58pub mod graph_analytics;
59
60#[cfg(test)]
61pub(crate) mod test_http;