cadi_core/lib.rs
1//! CADI Core - Core types and utilities for Content-Addressed Development Interface
2//!
3//! This crate provides the fundamental types and utilities used across the CADI ecosystem.
4//!
5//! ## Modules
6//!
7//! - `chunk` - Basic chunk types
8//! - `manifest` - CADI manifest parsing
9//! - `hash` - Content hashing utilities
10//! - `atomic` - Atomic chunk system with aliases
11//! - `smart_chunker` - Intelligent code analysis
12//! - `graph` - Merkle DAG graph store for dependencies
13//! - `atomizer` - Language-aware AST parsing (Phase 1)
14//! - `rehydration` - Virtual view assembly (Phase 2)
15//!
16//! ## The Graph Store
17//!
18//! The `graph` module provides the core infrastructure for O(1) dependency queries:
19//!
20//! ```rust,ignore
21//! use cadi_core::graph::{GraphStore, GraphNode, EdgeType};
22//!
23//! let store = GraphStore::open(".cadi/graph")?;
24//! store.insert_node(&node)?;
25//! let deps = store.get_dependencies("chunk:sha256:abc...")?;
26//! ```
27//!
28//! ## The Atomizer
29//!
30//! The `atomizer` module provides language-aware code parsing:
31//!
32//! ```rust,ignore
33//! use cadi_core::atomizer::{AtomExtractor, AtomizerConfig};
34//!
35//! let extractor = AtomExtractor::new("rust", AtomizerConfig::default());
36//! let atoms = extractor.extract(source)?;
37//! ```
38//!
39//! ## Virtual Views (Rehydration)
40//!
41//! The `rehydration` module assembles atoms into coherent contexts:
42//!
43//! ```rust,ignore
44//! use cadi_core::rehydration::{RehydrationEngine, ViewConfig};
45//!
46//! let engine = RehydrationEngine::new(graph);
47//! let view = engine.create_view(atom_ids, ViewConfig::default()).await?;
48//! ```
49//!
50//! ## Ghost Import Resolver
51//!
52//! The `ghost` module automatically expands atom context with dependencies:
53//!
54//! ```rust,ignore
55//! use cadi_core::ghost::{GhostResolver, ExpansionPolicy};
56//!
57//! let resolver = GhostResolver::new(graph);
58//! let result = resolver.resolve(&atom_ids).await?;
59//! ```
60
61pub mod chunk;
62pub mod manifest;
63pub mod hash;
64pub mod error;
65
66pub use chunk::*;
67pub use manifest::*;
68pub use hash::*;
69pub use error::*;
70
71pub mod ast;
72pub mod parser;
73pub mod validator;
74
75// New atomic chunk and smart chunking system
76pub mod atomic;
77pub mod smart_chunker;
78pub mod project_analyzer;
79
80pub use atomic::*;
81pub use smart_chunker::*;
82pub use project_analyzer::*;
83
84// Phase 0: Graph Store for O(1) dependency queries
85pub mod graph;
86
87// Phase 1: Language-aware AST parsing
88pub mod atomizer;
89
90// Phase 2: Virtual view assembly (rehydration)
91pub mod rehydration;
92
93// Phase 3: Ghost Import Resolver
94pub mod ghost;
95
96