torchcell.literature.backfill_key

backfill_key(artifact_dir: Path, *, citation_index: dict[str, dict[str, Any]] | None = None, lib: ZoteroLibrary | None = None, force: bool = False, dry_run: bool = False) → KeyBackfillResult[source]

Regularize one citation-key directory to a manifest.json.

Parameters:
  • artifact_dir – The <...>/torchcell-library/<citation_key>/ directory.

  • citation_index – Optional citation_key -> Zotero item map for enrichment.

  • lib – Connected Zotero library (required to enrich when a match is found).

  • force – Rewrite an existing manifest instead of skipping it.

  • dry_run – Build the manifest but do not write it.

Returns:

The per-key outcome (mode, file count, provenance completeness). A skipped key reports the values recorded in its existing manifest.

Raises:

CorruptManifestError – Without force, the existing manifest does not parse as a Manifest.