Skip to content

feat(examples): Zotero / BibTeX citation web plugin sample (dev-board#1956) - #1959

Merged
AIWorkDeckAdmin merged 2 commits into
masterfrom
90d/ex-zotero-bibtex
Dec 5, 2026
Merged

AIWorkDeckAdmin merged 2 commits into
masterfrom
90d/ex-zotero-bibtex

Conversation

@AIWorkDeckAdmin

Copy link
Copy Markdown
Collaborator

Summary

Sandboxed web plugin sample examples/zotero-bibtex-web-plugin/ (pattern of examples/hello-web-plugin/). Sample only: not added to the marketplace, the official plugin set or any release.

  • Lists project .bib / .json files (awd.files.list), reads one (awd.files.read), parses BibTeX (@string macros, month macros, # concatenation, LaTeX accents, von particles, braced corporate authors; malformed entries skipped) or Zotero CSL-JSON.
  • Search by author/year/title; every term must match; author:/year:/title: prefixes; accent-insensitive.
  • Formats in-text (Author, Year), APA 7 reference or Chicago author-date reference and inserts it at the cursor via awd.doc.insertText (tracked change). Last library and style kept in awd.storage; files.changed refreshes the list; host errors become readable messages.
  • Permissions file_read + editor only (no network).
  • Theme: CSS uses only host --awd-* tokens and SDK awd-* classes, no colour literals (test-enforced).
  • l10n: every UI and manifest string is a key in l10n/en-US.json + l10n/zh-CN.json (the plugin l10n pair of spec §14.4 / hello-declarative-plugin). The sandbox CSP blocks fetch, so scripts/build-l10n.mjs generates web/l10n.js; a test fails if they drift.
  • README in English and Chinese.
  • CI: the tests join the frontend "Test plugin platform" step (test-reachability guard was red without it); the SDK copy joins the distributed-copies list in sdk/plugin-sdk/tests/platform.test.mjs.

Tests

  • node --test examples/zotero-bibtex-web-plugin/tests/*.test.mjs: 20/20, offline (parser, search, formats, l10n parity and mirror, no literal text/Han/colours in markup, JSDOM panel with a stub host bridge incl. XSS-as-text).
  • Red before: with citations.js stubbed and a literal string + hex colour injected into index.html, 10 of 16 fail; panel test fails when insert sends the wrong text or renders via innerHTML.
  • Full CI step locally: 211/211. desktop/tests/test-reachability.test.js: red without the CI line, green with it. sdk-parity, check-spdx, check-palette, check-design-system, check-ui-hygiene, check-tool-parity, npm run check:locales, plugin-dev validate, gitleaks: clean.

Not verified: the panel inside a running host with a real Word document (JSDOM with a stub bridge only).

🤖 Generated with Claude Code

…#1956)

Sandboxed web plugin sample: reads a project .bib file or Zotero CSL-JSON
export through awd.files, searches by author/year/title (field prefixes,
accent-insensitive), and inserts an in-text, APA or Chicago author-date
citation at the cursor through awd.doc.insertText (tracked change).

Styles use only host --awd-* tokens and SDK component classes; every UI
string is a key in l10n/en-US.json and l10n/zh-CN.json, mirrored into
web/l10n.js by scripts/build-l10n.mjs because the sandbox CSP blocks fetch.
20 offline tests (parser, search, formatting, l10n parity, no literal
text or colours, JSDOM panel with a stub host bridge) run in the frontend
CI step; the SDK copy joins the distributed-copies parity list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (CodeQL)

CodeQL flagged the regex-based comment/script/style stripping in the
zotero-bibtex-web-plugin l10n test (js/incomplete-multi-character-sanitization,
js/bad-tag-filter). Same check, indexOf scanner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AIWorkDeckAdmin
AIWorkDeckAdmin merged commit 4fae6a3 into master Dec 5, 2026
26 checks passed
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.

2 participants