Add BibTeX entry to bibliography file
Adds BibTeX entries to bibliography files with validation and duplicate detection.
/plugin marketplace add Data-Wise/scholar/plugin install data-wise-scholar@Data-Wise/scholarplugin-api/commands/literature/I'll help you add a BibTeX entry to your bibliography file.
Usage: /research:bib:add <bib-file>
Examples:
/research:bib:add ~/Documents/references/mediation.bib/research:bib:add ./references.bibPlease provide:
You can get BibTeX entries from:
/research:doi <doi> - Get BibTeX from DOIUse the shell API wrapper from ${CLAUDE_PLUGIN_ROOT}/lib/bibtex-utils.sh:
# Source the API wrapper
source "${CLAUDE_PLUGIN_ROOT}/lib/bibtex-utils.sh"
# Extract bib file path
BIB_FILE="$1"
if [[ -z "$BIB_FILE" ]]; then
echo "Error: .bib file path required"
exit 1
fi
# Expand ~ to home directory
BIB_FILE="${BIB_FILE/#\~/$HOME}"
# Ask for BibTeX entry if not provided
if [[ -z "$2" ]]; then
echo "Please provide the BibTeX entry to add:"
echo "(Enter the complete @article{...} or @book{...} entry)"
echo ""
# Read multi-line entry until we see a closing }
BIBTEX_ENTRY=""
while IFS= read -r line; do
BIBTEX_ENTRY+="$line"$'\n'
# Check if we've reached the end of the entry
if [[ "$line" =~ ^\} ]]; then
break
fi
done
else
BIBTEX_ENTRY="$2"
fi
# Add entry to file
bib_add "$BIB_FILE" "$BIBTEX_ENTRY"
Can be used after:
/research:doi <doi> - Get BibTeX from DOI, then add to file/research:arxiv <query> - Find paper, get DOI, get BibTeX, add to fileUser: /research:doi 10.1037/met0000310
(Shows metadata and BibTeX)
User: /research:bib:add ~/Documents/references/mediation.bib
(Adds the BibTeX entry from previous command)
After adding entry, offer to: