pub fn audit_dir(dir: &Path, corpus: Corpus, limit: Option<usize>) -> ReportExpand description
Audit a directory. limit caps the number of files scanned (None = all).
Corpus::OpenCode (PARITY-4) is special-cased: a real OpenCode data root
(~/.local/share/opencode) holds no .jsonl files at all — sessions live
in opencode*.db (current installs) or a JSON-file tree (legacy). When
crate::session::detect_opencode_storage_surface resolves dir to the
SQLite surface, this routes through
crate::session::opencode_sqlite_corpus_envelope_text (up to limit
SESSIONS, not files — report.files counts sessions scanned in that
case) instead of the jsonl_files walk below, so a real store actually
gets audited rather than silently reporting zero files/lines. A directory
with no detected SQLite surface (e.g. a fixture dir of committed
envelope-form .jsonl files, or a not-yet-implemented legacy JSON tree)
falls back to the original file-walk unchanged.