Skip to content

feat: mosaic cite DOI — fetch and format citation strings #19

Closed

Description

@szaghi

Summary

Add a mosaic cite DOI command that fetches metadata for a DOI and prints a formatted citation string in common styles (APA, MLA, BibTeX, etc.).

Motivation

Researchers frequently need quick citation strings while writing. A mosaic cite command would surface this directly in the terminal without opening a browser.

Proposed behaviour

# Default: BibTeX output
mosaic cite 10.48550/arXiv.1706.03762

# Specify citation style
mosaic cite 10.48550/arXiv.1706.03762 --style apa
mosaic cite 10.48550/arXiv.1706.03762 --style mla
mosaic cite 10.48550/arXiv.1706.03762 --style chicago
mosaic cite 10.48550/arXiv.1706.03762 --style bibtex   # default

# Copy to clipboard (requires pyperclip or xclip)
mosaic cite 10.48550/arXiv.1706.03762 --copy

Implementation notes

  • Metadata source: Check local SQLite cache first; fall back to Crossref (api.crossref.org/works/{doi})
  • BibTeX: Format from Paper fields — already well supported by Crossref
  • Other styles: Use the Crossref content negotiation endpoint:
    GET https://doi.org/{doi}
    Accept: text/x-bibliography; style=apa
    
    This returns a pre-formatted string for any CSL style, no local rendering needed.
  • Clipboard: Optional --copy flag using pyperclip (if installed) or xclip/pbcopy subprocess

Priority

Tier 2 — high utility, low complexity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions