bctx-weave 0.1.7

bctx-weave — FilterMesh lens pipeline, CLI interception, domain compression
Documentation
use super::{Lens, LensContext, LensId, LensOutput};
use forge::budget::estimator::TokenEstimator;
use forge::signal::compactor;

/// Clarity: strip ANSI codes, normalise whitespace, collapse blank lines.
pub struct ClarityLens;

impl Lens for ClarityLens {
    fn id(&self) -> LensId {
        LensId::Clarity
    }

    fn apply(&self, input: &str, _ctx: &LensContext) -> LensOutput {
        let tokens_before = TokenEstimator::count_nonblocking(input);
        let normalised = compactor::normalise(input);
        let compacted = compactor::collapse_blanks(&normalised);
        let tokens_after = TokenEstimator::count_nonblocking(&compacted);
        LensOutput {
            content: compacted,
            tokens_before,
            tokens_after,
            applied: vec!["clarity".into()],
        }
    }
}