use camino::Utf8PathBuf;
use globset::{Glob, GlobSet, GlobSetBuilder};
use xchecker_utils::types::Priority;
#[derive(Debug, Clone)]
pub struct PriorityRules {
pub combined: GlobSet,
pub medium_start_index: usize,
pub low_start_index: usize,
}
impl Default for PriorityRules {
fn default() -> Self {
const HIGH_PATTERNS: &[&str] = &[
"**/SPEC*",
"**/ADR*",
"**/REPORT*",
"**/*SPEC*",
"**/*ADR*",
"**/*REPORT*",
"**/problem-statement*",
"**/*problem-statement*",
];
const MEDIUM_PATTERNS: &[&str] =
&["**/README*", "**/SCHEMA*", "**/*README*", "**/*SCHEMA*"];
const LOW_PATTERNS: &[&str] = &[
"**/*", ];
let mut builder = GlobSetBuilder::new();
for p in HIGH_PATTERNS
.iter()
.chain(MEDIUM_PATTERNS)
.chain(LOW_PATTERNS)
{
builder.add(Glob::new(p).unwrap());
}
Self {
combined: builder.build().unwrap(),
medium_start_index: HIGH_PATTERNS.len(),
low_start_index: HIGH_PATTERNS.len() + MEDIUM_PATTERNS.len(),
}
}
}
#[derive(Debug, Clone)]
pub struct SelectedFile {
pub path: Utf8PathBuf,
pub content: String,
pub priority: Priority,
pub blake3_pre_redaction: String,
#[allow(dead_code)] pub line_count: usize,
#[allow(dead_code)] pub byte_count: usize,
}
#[derive(Debug, Clone)]
pub struct CandidateFile {
pub path: Utf8PathBuf,
pub priority: Priority,
}