Skip to content

Add ability to import and bidirectionally sync Zotero reference collections#654

Open
petebachant wants to merge 18 commits into
mainfrom
zotero-import
Open

Add ability to import and bidirectionally sync Zotero reference collections#654
petebachant wants to merge 18 commits into
mainfrom
zotero-import

Conversation

@petebachant

@petebachant petebachant commented Jul 26, 2026

Copy link
Copy Markdown
Member

Resolves #146

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Zotero-backed reference management to Calkit projects, including importing Zotero collections, syncing (pull) updates, and editing/viewing reference items and notes in the UI, with corresponding backend APIs and generated client updates.

Changes:

  • Implement Zotero import/sync endpoints plus reference item + note CRUD (with optional Zotero note/PDF integration).
  • Revamp the References page UI to support collection selection, search, item details modal (PDF + notes), and collection/item creation/editing flows.
  • Add BibTeX/LaTeX display-cleanup helpers (with tests) and introduce a project-wide Cmd/Ctrl+K command palette.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
frontend/src/routes/_layout/$accountName/$projectName/_layout/references.tsx New references UI with collection selection, search, modals, and Zotero import entry points
frontend/src/routes/_layout/$accountName/$projectName/_layout.tsx Mount project command palette in the main project layout
frontend/src/lib/bibtex.ts Add helpers to clean/display BibTeX/LaTeX field values
frontend/src/lib/bibtex.test.ts Test coverage for BibTeX display helpers
frontend/src/components/References/ReferencesInfoPanel.tsx Add info/comments panel for a selected references collection + Zotero sync button
frontend/src/components/References/ReferenceItemModal.tsx Full-screen reference item modal with PDF viewer + anchored notes editing
frontend/src/components/References/NewReferencesCollection.tsx Modal to create a new empty .bib references collection
frontend/src/components/References/ImportFromZoteroModal.tsx Modal flow to import from Zotero (whole collection or selected items)
frontend/src/components/References/FileViewModal.tsx Minor import/style adjustment for reference file viewing
frontend/src/components/References/EditReferenceItemModal.tsx Modal to add/edit a BibTeX entry in a collection
frontend/src/components/Common/SidebarItems.tsx Export project nav items for reuse by the command palette
frontend/src/components/Common/ProjectCommandPalette.tsx New Cmd/Ctrl+K project section jump palette
frontend/src/client/types.gen.ts Generated client types for new references/Zotero/note APIs
frontend/src/client/sdk.gen.ts Generated SDK methods for new references/Zotero/note endpoints
frontend/src/client/schemas.gen.ts Generated schemas for new references/Zotero/note models
backend/app/zotero.py Zotero Web API integration + BibTeX formatting + note (de)serialization helpers
backend/app/users.py Add helper to fetch Zotero API key plus Zotero user id
backend/app/tests/api/routes/projects/test_core.py Add extensive API tests for Zotero import/sync, PDF, reference items, and notes
backend/app/api/routes/projects/core.py Add/extend project routes for references collections, items, Zotero import/sync, and notes
AGENTS.md Add troubleshooting guidance for stale frontend client vs backend behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/src/routes/_layout/$accountName/$projectName/_layout/references.tsx Outdated
Comment on lines +92 to +99
let href: string | undefined
if (key === "doi") {
href = value.startsWith("http")
? value
: `https://doi.org/${value}`
} else if (key === "url") {
href = value
}
Comment thread frontend/src/components/References/ReferenceItemModal.tsx
Comment on lines +96 to +105
if (entry.has_pdf) {
setPdfLoading(true)
const url =
`${apiUrl}/projects/${ownerName}/${projectName}/zotero/items/` +
`${encodeURIComponent(entry.key)}/pdf?path=${encodeURIComponent(bibPath)}`
fetch(url, {
headers: {
Authorization: `Bearer ${localStorage.getItem("access_token")}`,
},
})
Comment thread backend/app/zotero.py Outdated
Comment on lines +681 to +683
# Local, gitignored Zotero state under .calkit/zotero/ (like Overleaf's
# .calkit/overleaf/). The durable link is committed in calkit.yaml; these files
# hold only local sync bookkeeping and cached item/note metadata.
Comment on lines 5086 to +5089
for ref_collection in ref_collections:
# Read entries
path = ref_collection["path"]
link = ref_collection.get("zotero")
Comment thread backend/app/api/routes/projects/core.py Outdated
Comment on lines +5981 to +5983
Notes are serialized to Markdown (one ``# heading`` section per titled note)
and committed. For a Zotero-linked reference, the notes are also pushed to
Zotero.
Comment on lines +106 to +107
enabled: isOpen && mode === "items" && Boolean(library),
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

I want to be able to import references from Zotero so I can manage them on a project-by-project basis rather than as a horizontal silo

2 participants