pub struct ComponentBuilder { /* private fields */ }Expand description
Builds Component nodes and DependsOn edges from manifest files.
The ComponentBuilder discovers manifest files in a repository,
parses them to extract component metadata, and creates the component
graph with proper containment and dependency edges.
§Usage
use codeprysm_core::builder::{ComponentBuilder, BuilderConfig};
use codeprysm_core::graph::PetCodeGraph;
use std::path::Path;
let mut graph = PetCodeGraph::new();
let mut builder = ComponentBuilder::new()?;
let components = builder.discover_components(Path::new("my-repo"), &[])?;
builder.add_to_graph(&mut graph, "my-repo", &components)?;Implementations§
Source§impl ComponentBuilder
impl ComponentBuilder
Sourcepub fn new() -> Result<Self, BuilderError>
pub fn new() -> Result<Self, BuilderError>
Create a new component builder.
Sourcepub fn discover_components(
&mut self,
root: &Path,
exclude_patterns: &[String],
) -> Result<Vec<DiscoveredComponent>, BuilderError>
pub fn discover_components( &mut self, root: &Path, exclude_patterns: &[String], ) -> Result<Vec<DiscoveredComponent>, BuilderError>
Discover all components (manifest files) in a directory.
Walks the directory tree, finds manifest files, parses them, and returns information about each discovered component.
§Arguments
root- Root directory to searchexclude_patterns- Glob patterns to exclude (e.g., “node_modules”, “target”)
§Returns
A list of discovered components with their manifest information.
Sourcepub fn add_to_graph(
&mut self,
graph: &mut PetCodeGraph,
repo_name: &str,
components: &[DiscoveredComponent],
) -> Result<usize, BuilderError>
pub fn add_to_graph( &mut self, graph: &mut PetCodeGraph, repo_name: &str, components: &[DiscoveredComponent], ) -> Result<usize, BuilderError>
Add discovered components to a graph.
Creates Component nodes with proper metadata and builds the containment hierarchy and dependency edges.
§Arguments
graph- The graph to add components torepo_name- Name of the repository (for parent containment)components- List of discovered components
§Returns
The number of Component nodes added to the graph.
Sourcepub fn path_index(&self) -> &HashMap<PathBuf, String>
pub fn path_index(&self) -> &HashMap<PathBuf, String>
Get the path index (for testing or inspection).
Auto Trait Implementations§
impl Freeze for ComponentBuilder
impl RefUnwindSafe for ComponentBuilder
impl Send for ComponentBuilder
impl Sync for ComponentBuilder
impl Unpin for ComponentBuilder
impl UnwindSafe for ComponentBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more