torchcell.literature.backfill_mirror

backfill_mirror(root: str | Path, *, use_zotero: bool = True, force: bool = False, dry_run: bool = False) → BackfillReport[source]

Backfill manifests for every citation-key directory under root.

Dynamically scans for directories lacking (or, with force, already having) a manifest – the set of keys is never hardcoded, so the mirror can keep growing. Only citation-key directories are visited (is_citation_key_dir()): a directory whose name starts with _ and a directory holding no file are not citation keys, get no manifest and do not appear in the report. Loose files at the root are ignored.

Parameters:
  • root – The torchcell-library directory (or a fixture mirror root).

  • use_zotero – Enrich from the TorchCell Zotero group (needs ZOTERO_* env); when False, every directory is written offline.

  • force – Rewrite manifests that already exist.

  • dry_run – Build + report but write nothing.

Returns:

A BackfillReport with one KeyBackfillResult per directory.