CONTEXT_MENU_ENTRIES maps every menu id to {action, style, parentId,
title}, replacing the split('-') id parsing that only worked because no
name contained a hyphen. Foreign menu ids are now ignored explicitly.
Parity pinned by tests enumerating all 30 previous ids. The 10-char
toolbar trigger threshold is now the named MIN_SELECTION_LENGTH.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
src/lib/providers.ts holds a per-provider spec (url, headers, body,
extractor, default model) and a single callProvider() covering both the
action-prompt and custom-prompt families (~250 lines -> one path).
getSystemPrompt, fetchWithTimeout, and listModels move along with it;
background.ts drops from 553 to 130 lines.
Behavior pinned by 20 parity tests written from the old functions
(request shapes, headers, defaults, error strings). One deliberate
change: max_tokens now scales with input length (1024-8192) instead of
a hard-coded 1024, so Expand no longer truncates long selections.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Encrypt (Options) and decrypt (background) now share one module; wire
format unchanged. Tests include fixtures proving values encrypted by the
old inline Options code still decrypt, plus tamper/wrong-key cases. The
module documents the honest threat model (key co-located with ciphertext
= obfuscation, not encryption).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- src/lib/types.ts: message contract (both ANALYZE_TEXT shapes preserved),
config/response types, storage-key constants.
- src/lib/messaging.ts: single safeStorageGet/safeStorageSet/safeSendMessage/
isExtensionValid implementation replacing the three divergent copies in
Options, Popup, and content. Content script keeps its refresh-toast
behavior via an onContextInvalidated callback.
- New '@lib' import alias (wxt force-overwrites '~' and '@' to srcDir, so
those cannot point at ./src); wired in wxt.config, tsconfig, vitest.
- tests/unit/messaging.test.ts: 14 unit tests over the wrappers.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Uninstall zustand, tailwindcss, autoprefixer, tweetnacl-util (all
unused); README no longer advertises Tailwind/Zustand.
- Fix stale 'Tone' -> 'Explain' copy in Options.
- Add .nvmrc/engines/packageManager (Node 22 to match CI).
- wxt.config.ts reads manifest version from package.json so the two
can never drift.
- Ignore *.zip build artifacts.
- Skip the two e2e specs with literal [EXTENSION_ID] placeholders
(cannot pass; TODO references the e2e-ID-resolution task).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>