Skip to main content

sbom_tools/watch/
mod.rs

1//! Continuous monitoring / watch mode for SBOMs.
2//!
3//! Polls directories for SBOM file changes and optionally re-enriches
4//! with vulnerability/EOL data on a configurable interval, firing alerts
5//! through pluggable sinks (stdout, NDJSON, webhook).
6
7pub(crate) mod alerts;
8pub(crate) mod config;
9pub(crate) mod loop_impl;
10pub(crate) mod monitor;
11pub(crate) mod state;
12
13pub use config::{WatchConfig, parse_duration};
14pub use loop_impl::run_watch_loop;
15
16/// Errors specific to the watch subsystem.
17#[derive(Debug, thiserror::Error)]
18#[non_exhaustive]
19pub enum WatchError {
20    #[error("invalid interval '{0}': expected format like 30s, 5m, 1h")]
21    InvalidInterval(String),
22
23    #[error("no SBOM files found in watched directories")]
24    NoFilesFound,
25
26    #[error("watch directory does not exist: {}", .0.display())]
27    DirNotFound(std::path::PathBuf),
28
29    #[error("webhook delivery failed: {0}")]
30    WebhookFailed(String),
31}