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 config;
19pub mod context;
20pub mod degradation;
21pub mod local_backend;
22pub mod setup;
23
24/// Return Gobby home, respecting `GOBBY_HOME` when set.
25pub fn gobby_home() -> anyhow::Result<std::path::PathBuf> {
26    if let Some(home) = std::env::var_os("GOBBY_HOME") {
27        return Ok(std::path::PathBuf::from(home));
28    }
29    dirs::home_dir()
30        .map(|home| home.join(".gobby"))
31        .ok_or_else(|| anyhow::anyhow!("cannot determine home directory"))
32}
33
34// Feature-gated modules.
35#[cfg(feature = "ai")]
36pub mod ai;
37
38#[cfg(feature = "postgres")]
39pub mod postgres;
40
41#[cfg(feature = "falkor")]
42pub mod falkor;
43
44#[cfg(feature = "qdrant")]
45pub mod qdrant;
46
47#[cfg(feature = "indexing")]
48pub mod indexing;
49
50#[cfg(feature = "search")]
51pub mod search;
52
53#[cfg(test)]
54pub(crate) mod test_http;