library add
Read one published source into the global literature library.
Invocation#
lem-cli library add <source> [--pdf <path>] [--text <path>]Inputs and options#
- The first argument is an arXiv id or arxiv.org URL, a DOI or doi.org URL, or the http(s) URL of the page that published the work.
- --pdf supplies a local PDF. --text supplies local text used when text cannot be extracted from the PDF. A ~/ prefix is expanded.
Output and state#
Metadata comes from the source's own publisher. An arXiv id is read from the arXiv Atom API. A DOI is read from the DOI system's registered CSL record rather than from the page it redirects to, because a registrant may serve a storefront whose site description would otherwise be stored as the paper's abstract. A page is read through its Highwire citation_* tags, then Open Graph, then the document title; a page that carries a DOI is keyed on that DOI.
Upserts one record by that identifier, keeps <id>.pdf and <id>.txt under the manifest's asset directory when available, and prints the saved record as JSON. A page with no PDF is kept as page text with MathML and SVG dropped and TeX annotations preserved.
Re-adding a work refreshes the record: it keeps the original added_at, the saved analysis, and every field the new reading did not supply, because the DOI agency holds the authors and the venue while the article page holds the PDF. What a source did not publish is recorded in acquisition_notes.
Refusals#
- A missing source refuses with “library add needs one arXiv id, DOI, or URL”. An unknown option refuses with “library add does not recognize <value>”; --pdf or --text without a path refuses with “<option> needs a path”.
- A source that is neither an arXiv id, a DOI, nor an http(s) URL refuses with “'<value>' is not an arXiv id, a DOI, or an http(s) URL”. A page that publishes no title refuses with “could not read source metadata: <url>: the page published no citation_title, og:title, or document title”.
- Unreadable local files, a local file without a PDF header, a metadata failure, or a manifest write failure is printed as a lem-cli refusal and exits nonzero.