feat: initial LexAI Chrome extension scaffold
Some checks failed
CI — Test & Build / Unit Tests (push) Failing after 54s
CI — Test & Build / Build Extension (push) Has been skipped

- WXT + React 18 + TypeScript setup
- Background service worker (LLM API proxy)
- Content script (floating toolbar + text selection)
- Options page (provider/model/API key config)
- Popup UI
- Gitea Actions workflows (CI, preview, release)
- Vitest unit tests + Playwright E2E setup
- Supports: OpenAI, Anthropic, Groq, OpenRouter
This commit is contained in:
Nemo
2026-03-06 09:34:15 +08:00
commit b04076081c
20 changed files with 6254 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
# Reference Project Notes
## Scramble (zlwaterfield/scramble) ⭐ 1,647
- Uses `browserAPI` abstraction for Chrome/Firefox compat
- Content script listens for messages, calls background to do actual LLM calls
- **Key pattern:** `replaceSelectedText()` handles both:
1. `TEXTAREA` / `INPUT` elements (uses selectionStart/End)
2. Generic DOM selection (uses Range API)
- Context menu integration for triggering actions
- Good reference for: text replacement, context menu setup
## Proofly (onderceylan/proofly)
- Privacy-first: uses Chrome's built-in on-device AI (no API key needed)
- Good reference for: Manifest V3 structure, shadow DOM injection for UI
## Key Learnings for LexAI
1. **Always handle both textarea AND contenteditable** — different replacement logic needed
2. **Use shadow DOM for toolbar** — prevents host page CSS from breaking our UI
3. **Background as CORS proxy** — content scripts can't call external APIs directly
4. **Context menu = power user feature** — right-click → LexAI actions
5. **Debounce selection events** — users drag text slowly, don't fire on every pixel