use camino::Utf8PathBuf;
use cordance_core::advise::{AdviseFinding, Severity};
use cordance_core::pack::CordancePack;
use super::AdviseRule;
pub struct RBuild1;
impl AdviseRule for RBuild1 {
fn id(&self) -> &'static str {
"R-build-1"
}
fn doctrine_anchor(&self) -> &'static str {
"doctrine/principles/build.md"
}
fn check(&self, pack: &CordancePack) -> Vec<AdviseFinding> {
let has_task_runner = pack.sources.iter().any(|r| {
let p = r.path.as_str();
p.ends_with("justfile") || p.ends_with("Makefile") || p.ends_with("package.json")
});
if has_task_runner {
return vec![];
}
vec![AdviseFinding {
id: self.id().into(),
severity: Severity::Warning,
summary: "No local task runner detected (justfile, Makefile, or package.json).".into(),
doctrine_anchor: Utf8PathBuf::from(self.doctrine_anchor()),
project_paths: vec![".".into()],
remediation:
"Add a justfile (or Makefile) with a 'check' target that runs fmt + lint + test. \
Mirrors CI locally."
.into(),
}]
}
}