Skip to main content

morph_cli/
lib.rs

1pub mod cli;
2pub mod commands;
3pub mod core;
4pub mod recipes;
5pub mod utils;
6
7// Re-export core execution APIs to provide a stable, minimal library surface.
8
9pub use crate::core::recipe::{
10    DetectionReport, FileAnalysis, FileClassification, Recipe, RecipeMetadata, SkippedTransform,
11    TransformMode, TransformOptions, TransformReport, UnsupportedPatternReport,
12};
13pub use crate::core::registry::RecipeRegistry;
14pub use crate::core::pipeline::executor::{PipelineExecutor, PipelineSummary};
15pub use crate::core::detection::scanner::{Scanner, ScanResult};
16
17// Provide a programmatic entry point for running a recipe.
18pub fn run_recipe(
19    project_root: std::path::PathBuf,
20    recipe_name: &str,
21    mode: TransformMode,
22    review: bool,
23    autofix: bool,
24    verbose: bool,
25) -> anyhow::Result<PipelineSummary> {
26    let registry = RecipeRegistry::new();
27    let executor = PipelineExecutor::new(project_root.clone()).add_recipe(recipe_name);
28    executor.execute(&project_root, mode, review, autofix, &registry, verbose)
29}
30
31pub fn scan_project(
32    project_root: std::path::PathBuf,
33) -> anyhow::Result<ScanResult> {
34    let mut scanner = Scanner::new(project_root);
35    Ok(scanner.scan())
36}