KeiSeiKit-1.0/_primitives/_rust/kei-projects-index/src/docs.rs
Parfii-bot 0be354a920 KeiSeiKit-public — clean state
Single-commit clean baseline after security scrub of niche-tells,
project codenames, internal jargon, and contributor-email leaks.

Contents:
- 100 Rust crates (_primitives/_rust/)
- 37 agent manifests (_manifests/) + generated specs (_generated/)
- 67 user-invocable skills (skills/)
- 33 hooks (hooks/)
- Composition blocks (_blocks/)
- Documentation (docs/, README.md)
- TS adapter packages (_ts_packages/)
- Assembler (_assembler/)
- Roles (_roles/)
- Templates (_templates/)
- Forgejo CI (.forgejo/)

Author: Denis Parfionovich <info@greendragon.info>

License: see LICENSE.
2026-05-01 12:09:03 +08:00

37 lines
1.3 KiB
Rust

//! Documentation-presence detector.
//!
//! Constructor Pattern: one cube = "does this project have N standard
//! doc files?". No git2 dep — the dashboard can answer "which repos
//! lack a CLAUDE.md?" without pulling libgit2 in.
use std::path::Path;
/// Four-way doc-presence snapshot at the project root.
#[derive(Debug, Clone, Copy, Default)]
pub struct DocsState {
pub has_claude_md: bool,
pub has_decisions_md: bool,
pub has_runbook_md: bool,
pub has_readme: bool,
}
/// Case-insensitive `<root>/<name>` lookup. Probes the supplied form
/// (canonical uppercase-stem) and its lowercase variant — matches the
/// `readme.md` lowercase convention seen in some sister repos.
fn has_file_ci(root: &Path, name: &str) -> bool {
if root.join(name).is_file() {
return true;
}
root.join(name.to_lowercase()).is_file()
}
/// Detect CLAUDE.md / DECISIONS.md / RUNBOOK.md / README.md at the
/// project root. Lowercase variants are accepted.
pub fn detect_docs(project_root: &Path) -> DocsState {
DocsState {
has_claude_md: has_file_ci(project_root, "CLAUDE.md"),
has_decisions_md: has_file_ci(project_root, "DECISIONS.md"),
has_runbook_md: has_file_ci(project_root, "RUNBOOK.md"),
has_readme: has_file_ci(project_root, "README.md"),
}
}