Repository Guidelines
Project Layout
src/: TypeScript source. Copy logic lives insrc/modules/copy/.addon/: packaged Zotero assets such asmanifest.json, prefs, locale, and icons.spec/unit/: fast unit tests run bynpm run test:unit.test/: scaffold/Zotero startup tests run bynpm run test.docs/manual-testing.md: manual verification checklist.
Commands
npm install: install dependencies.npm run start: run the Zotero plugin dev loop.npm run build: build the add-on and runtsc --noEmit.npm run lint:check: run Prettier and ESLint in check mode.npm run lint:fix: apply Prettier and ESLint fixes.npm run test:unit: run unit tests inspec/unit/.npm run test: run scaffold/Zotero tests.
For local npm run test on this machine, set:
$env:ZOTERO_PLUGIN_ZOTERO_BIN_PATH='C:\Program Files\Zotero\zotero.exe'
Coding Style
- Use TypeScript ESM with 2-space indentation and LF line endings.
- Prefer
camelCasefor values/functions andPascalCasefor types/classes. - Keep modules focused:
- resolver logic in
attachmentResolver.ts - clipboard behavior in
clipboardWriter.ts - UI strings in locale files
- resolver logic in
Compatibility
- Do not preserve backward compatibility unless the user explicitly asks for it.
- Prefer removing legacy preferences, migrations, compatibility shims, and old behavior branches instead of carrying them forward.
- When changing behavior, optimize for the current plugin contract rather than upgrade-path compatibility.
Testing
- Add or update targeted tests for every behavior change.
- Prefer
npm run test:unitwhile iterating. - Before commit, run
npm run test:unit,npm run build, andnpm run lint:check. - Run
npm run testas well when Zotero-based integration coverage is needed and the Zotero binary path is configured.
Release
- Releases are triggered by pushing a Git tag that matches
v**. - Before a release, run
npm run test:unit,npm run build, andnpm run lint:check. - Bump the version with
npm run release -- patch --yes,npm run release -- minor --yes, ornpm run release -- major --yes. This creates a version commit (chore(publish): release vX.Y.Z) and a matching Git tag, then pushes both automatically. - Do not use
npm versiondirectly; it produces a generic commit message that does not match the project's conventional-release configuration. - The GitHub Actions release workflow then runs
npm run buildandnpm run release. - If an agent updates compatibility claims, release notes, or packaging, it
must verify that
package.json,addon/manifest.json, and the release tag stay consistent.
Commits
- Use conventional prefixes such as
feat:,fix:,docs:, andchore:. - Keep commits narrow and describe the user-visible change.