projd-core
projd-core is the shared scanning model for Projd CLI and GUI. It detects
project markers, source languages, dependency manifests, tests, CI providers,
repository state, risks, project health, and per-language code line statistics.
The crate also provides project root discovery (discover_roots,
DiscoverOptions, DiscoveredRoot, RootKind) for directories that may
contain multiple independent projects with different VCS, build systems,
documentation sites, or datasets. Discovery terminates on detected root kinds
rather than directory depth.
Source control detection covers git, hg, svn, fossil, and bzr. Git, hg, and
svn populate branch / revision / last-commit / dirty fields by shelling out to
the corresponding CLI. Fossil and bzr currently report only marker presence;
the CLI-driven fields will be filled in a follow-up release. The ProjectScan
field is vcs: VcsSummary with kind: VcsKind (replaces the previous
git: GitSummary field as of 0.3.0).
render_html(&ProjectScan) and render_multi_html(&MultiProjectScan) produce
self-contained HTML reports with embedded CSS and inline SVG charts. No
JavaScript, no CDN, no external assets — the output is one file you can email,
upload to a static site, or open with a browser. The report respects the
viewer's OS theme via prefers-color-scheme.
VcsSummary.activity carries history-derived metrics: days_since_last_commit,
commits_last_90d, contributors_count, and first_commit_date. Only git
populates these fields in the current release; hg / svn / fossil / bzr leave
them as None. Contributor names and emails are not collected by default;
pass ScanOptions { detailed_contributors: true } to scan_path_with or
scan_paths_recursive_with to populate VcsActivity.contributors. The
HealthSignalKind::Activity signal reflects activity freshness against
thresholds of 90 days (active → pass) and 365 days (stale / dormant → warn).
The crate also exposes scan_paths_recursive(path, opts) -> MultiProjectScan,
which runs discover_roots on the path and then scans every detected root.
MultiProjectScan carries one ProjectScan per root plus an aggregated
MultiProjectSummary (by_kind, by_grade, by_risk_level,
files_scanned). Single-project scan_path runs a cheap multi-root check
and emits RiskCode::MultipleVcsRootsFound and RiskCode::NestedVcsRoot when
the scanned directory actually contains more than one root or a vendored
submodule.
This crate intentionally does not expose repository, homepage, or author metadata
in Cargo.toml, so published crates stay decoupled from local hosting details.