From 82b08a10a2d93d4c00e306065cab1e628abd42ef Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Wed, 25 Mar 2026 13:54:08 -0400 Subject: [PATCH] refactor(workflows): hide internal modules from public API Make 7 modules pub(crate) (condition, graph, lifecycle, node_handler, run_dir) and 4 modules #[doc(hidden)] (artifact, test_support, transforms, stylesheet) to reduce the public surface of fabro-workflows. Internal crate::transform alias replaced with crate::transforms. External consumers still access what they need via narrowed re-exports. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/crates/fabro-workflows/src/condition.rs | 1 - lib/crates/fabro-workflows/src/lib.rs | 25 +++++++++++++------ .../fabro-workflows/src/operations/create.rs | 2 +- .../fabro-workflows/src/pipeline/transform.rs | 2 +- .../fabro-workflows/src/pipeline/types.rs | 2 +- .../src/transforms/stylesheet.rs | 2 +- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/lib/crates/fabro-workflows/src/condition.rs b/lib/crates/fabro-workflows/src/condition.rs index b79c2af79..1f93536a8 100644 --- a/lib/crates/fabro-workflows/src/condition.rs +++ b/lib/crates/fabro-workflows/src/condition.rs @@ -2,7 +2,6 @@ /// /// The parser lives in `fabro_graphviz::condition`; this module re-exports /// `parse_condition` and provides runtime evaluation against `Outcome`/`Context`. -pub use fabro_graphviz::condition::parse_condition; use fabro_graphviz::condition::{Clause, ConditionExpr, Op}; use crate::context::keys; diff --git a/lib/crates/fabro-workflows/src/lib.rs b/lib/crates/fabro-workflows/src/lib.rs index 06ccc88ab..2368fdbd0 100644 --- a/lib/crates/fabro-workflows/src/lib.rs +++ b/lib/crates/fabro-workflows/src/lib.rs @@ -88,35 +88,46 @@ pub fn build_completed_stages( stages } +#[doc(hidden)] pub mod artifact; pub mod asset_snapshot; pub mod assets; -pub mod condition; +pub(crate) mod condition; pub mod context; pub mod devcontainer_bridge; pub mod error; pub mod event; pub mod git; -pub mod graph; +pub(crate) mod graph; pub mod handler; mod hook_context; -pub mod lifecycle; -pub mod node_handler; +#[allow(dead_code)] +pub(crate) mod lifecycle; +pub(crate) mod node_handler; pub mod operations; pub mod outcome; pub mod pipeline; pub mod pull_request; pub mod records; mod retry; -pub mod run_dir; +pub(crate) mod run_dir; pub mod run_lookup; pub mod run_settings; pub mod run_status; pub mod sandbox_git; #[doc(hidden)] pub mod test_support; +#[doc(hidden)] pub mod transforms; -pub use transforms as transform; +// Re-export aliases (back-compat with `fabro_workflows::transform::*` imports) +#[doc(hidden)] +pub mod transform { + pub use crate::transforms::*; +} +#[doc(hidden)] +pub mod vars { + pub use crate::transforms::variable_expansion::*; +} +#[doc(hidden)] pub use transforms::stylesheet; -pub use transforms::variable_expansion as vars; diff --git a/lib/crates/fabro-workflows/src/operations/create.rs b/lib/crates/fabro-workflows/src/operations/create.rs index 3bcd7f217..1abc15cc5 100644 --- a/lib/crates/fabro-workflows/src/operations/create.rs +++ b/lib/crates/fabro-workflows/src/operations/create.rs @@ -4,7 +4,7 @@ use fabro_graphviz::graph::Graph; use crate::error::FabroError; use crate::pipeline::{self, TransformOptions, Validated}; -use crate::transform::Transform; +use crate::transforms::Transform; #[derive(Default)] pub struct CreateOptions { diff --git a/lib/crates/fabro-workflows/src/pipeline/transform.rs b/lib/crates/fabro-workflows/src/pipeline/transform.rs index fb0401597..eb48e2482 100644 --- a/lib/crates/fabro-workflows/src/pipeline/transform.rs +++ b/lib/crates/fabro-workflows/src/pipeline/transform.rs @@ -1,4 +1,4 @@ -use crate::transform::{ +use crate::transforms::{ FileInliningTransform, ModelResolutionTransform, StylesheetApplicationTransform, Transform, VariableExpansionTransform, }; diff --git a/lib/crates/fabro-workflows/src/pipeline/types.rs b/lib/crates/fabro-workflows/src/pipeline/types.rs index e5422c115..4e5a78d44 100644 --- a/lib/crates/fabro-workflows/src/pipeline/types.rs +++ b/lib/crates/fabro-workflows/src/pipeline/types.rs @@ -258,7 +258,7 @@ pub struct Finalized { /// Options for the TRANSFORM phase. pub struct TransformOptions { pub base_dir: Option, - pub custom_transforms: Vec>, + pub custom_transforms: Vec>, } /// Options for the RETRO phase. diff --git a/lib/crates/fabro-workflows/src/transforms/stylesheet.rs b/lib/crates/fabro-workflows/src/transforms/stylesheet.rs index 37a3cdd8e..45b3468c2 100644 --- a/lib/crates/fabro-workflows/src/transforms/stylesheet.rs +++ b/lib/crates/fabro-workflows/src/transforms/stylesheet.rs @@ -1,5 +1,5 @@ use fabro_graphviz::graph::{AttrValue, Graph}; -pub use fabro_graphviz::stylesheet::{parse_stylesheet, Declaration, Rule, Selector, Stylesheet}; +pub use fabro_graphviz::stylesheet::{parse_stylesheet, Rule, Selector, Stylesheet}; /// Recognized stylesheet properties. const STYLESHEET_PROPERTIES: &[&str] =