Skip to main content

boxology_cli_core/
lib.rs

1//! Effectful filesystem inputs for the `boxology` command.
2//!
3//! The CLI's effectful boundary walks a workspace and executes one validated generation plan, while
4//! pure planning selects and describes contract-generation candidates. Generation remains pure;
5//! execution delegates its writes to the generator writer. Classification of checked-in versus
6//! regenerated schema bytes is also pure, as is the check-step classification seam over supplied
7//! base-revision and checked-in schema bytes and regeneration comparison over derived artifacts.
8//! Trusted lock/fmt/Clippy/test/quality steps use an injectable runner; tool output is outside determinism claims.
9#![deny(missing_docs)]
10#![forbid(unsafe_code)]
11
12use std::{path::Path, process::Command};
13
14/// The exact argv passed to the one Cargo metadata invocation owned by the CLI.
15pub const CARGO_METADATA_ARGS: [&str; 5] =
16    ["metadata", "--format-version", "1", "--locked", "--no-deps"];
17
18/// Builds the captured Cargo metadata command for `root`.
19pub fn cargo_metadata_command(root: &Path) -> Command {
20    let mut command = Command::new("cargo");
21    command.args(CARGO_METADATA_ARGS).current_dir(root);
22    command
23}
24
25mod base;
26mod check;
27mod classify;
28mod compare;
29mod execute;
30mod generate;
31mod runner;
32mod walk;
33pub use base::{
34    BaseDiffInputs, BaseError, BaseInputsError, BaseSchemasError, DefaultBase, GitToolError,
35    ResolvedBase, base_diff_inputs, base_package_schemas, resolve_base, resolve_default_base,
36};
37pub use check::{
38    CheckClassificationError, ClassifyStepError, DuplicatePackages, PackageSchemas, classify_step,
39};
40pub use classify::{ClassifyError, classify};
41pub use compare::{
42    CompareDifference, CompareStepError, DifferenceKind, compare_plans, compare_step,
43    composition_step,
44};
45pub use execute::{ExecuteError, ExecutePlans, Outcome, execute, execute_plans};
46pub use generate::{GenerationPlan, PlanError, ResolvedImport, plan};
47pub use runner::{
48    CapturedOutput, CommandRunner, CommandSpec, QualityCommand, SpawnError, ToolStep, clippy_spec,
49    fmt_packages, fmt_spec, lock_spec, quality_specs, run_clippy_step, run_command, run_fmt_step,
50    run_lock_step, run_quality_step, run_test_step, test_spec,
51};
52pub use walk::{WalkError, WalkedWorkspace, walk};