1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! # ggen v26_5_19: Fully-Rendered Libraries via Ontology-First Compilation
//!
//! This module implements the v26_5_19 constitutional law: **A = μ(O)**
//!
//! ## Core Concepts
//!
//! - **O (Ontology Substrate)**: The only authored input (ontologies, constraints, manifests)
//! - **μ (Projection Function)**: Deterministic transformation function
//! - **A (Artifacts)**: Output files (never edited directly, only projected)
//! - **Λ (Pass Ordering)**: Total ordering of projection passes
//! - **H (Guards)**: Forbidden output class constraints
//!
//! ## Staged Compilation Pipeline
//!
//! The projection function μ is implemented as a sequence of passes:
//!
//! 1. **μ₁: Normalization** - Ontology → Ontology (CONSTRUCT rewrites)
//! 2. **μ₂: Extraction** - Ontology → Bindings (SELECT queries)
//! 3. **μ₃: Emission** - Bindings → Files (Tera templates)
//! 4. **μ₄: Canonicalization** - Files → Canonical Files (formatting)
//! 5. **μ₅: Receipt** - Files → Receipt (provenance binding)
//!
//! ## Constitutional Invariants
//!
//! - **Idempotence**: μ∘μ = μ
//! - **Determinism**: Same O always produces same A
//! - **Provenance**: hash(A) = hash(μ(O))
//! - **No Edit**: A is never modified, only regenerated
//! - **Substrate Only**: Only O is authored
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use crate::pipeline_engine::{StagedPipeline, PipelineConfig, Epoch};
//!
//! # fn main() -> crate::utils::error::Result<()> {
//! // Create pipeline configuration
//! let config = PipelineConfig::new("project", "1.0.0")
//! .with_ontology("ontology/domain.ttl")
//! .with_output_dir(".");
//!
//! // Build and run pipeline
//! let mut pipeline = StagedPipeline::new(config)?;
//! let receipt = pipeline.run()?;
//!
//! // Verify the projection
//! assert!(receipt.is_valid);
//! # Ok(())
//! # }
//! ```
// Core types
// Staged compilation passes
// Pipeline orchestration
// Re-exports
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
// Pass implementations
pub use ;