Skip to main content

niwa_core/
lib.rs

1//! # niwa-core
2//!
3//! Core library for NIWA Expertise Graph management.
4//!
5//! ## Features
6//!
7//! - SQLite-based Expertise storage with versioning
8//! - Full-text search with FTS5
9//! - Dependency graph (Relations)
10//! - Type-safe operations with llm-toolkit Expertise types
11//!
12//! ## Example
13//!
14//! ```no_run
15//! use niwa_core::{Database, Expertise, Scope, SearchOptions, StorageOperations};
16//!
17//! #[tokio::main]
18//! async fn main() -> anyhow::Result<()> {
19//!     // Initialize database
20//!     let db = Database::open("~/.niwa/graph.db").await?;
21//!
22//!     // Create expertise
23//!     let mut expertise = Expertise::new("rust-expert", "1.0.0");
24//!     expertise.metadata.scope = Scope::Personal;
25//!
26//!     // Store
27//!     db.storage().create(expertise).await?;
28//!
29//!     // Query
30//!     let results = db.query().search("rust error handling", SearchOptions::default()).await?;
31//!
32//!     Ok(())
33//! }
34//! ```
35
36pub mod db;
37pub mod error;
38pub mod graph;
39pub mod query;
40pub mod storage;
41pub mod types;
42
43// Re-exports for convenience
44pub use db::Database;
45pub use error::{Error, Result};
46pub use graph::{GraphOperations, RelationType};
47pub use query::{QueryBuilder, SearchOptions};
48pub use storage::{Storage, StorageOperations};
49pub use types::{Expertise, ExpertiseMetadata, Scope};
50
51/// Library version
52pub const VERSION: &str = env!("CARGO_PKG_VERSION");