Commit Graph

13 Commits

Author SHA1 Message Date
john kevin asprec
acea99d7ad feat: Implement Prompt Builder functionality in Popup and Options
Some checks failed
CI — Test & Build / Test & Build (push) Failing after 39s
- Added a new "Prompt Builder" tab in the Popup for generating AI prompts with customizable parameters.
- Introduced new state variables for managing prompt styles, personas, formats, and models.
- Enhanced the Options page to fetch and display models based on the provided API key.
- Updated the actions and types to include the new 'prompt' action and its associated parameters.
- Implemented migration logic for legacy plaintext API keys to encrypted storage.
- Updated the getSystemPrompt function to incorporate prompt parameters for better instruction generation.
- Added tests for the new functionality, including context menu entries and prompt generation logic.
2026-07-15 15:27:41 +08:00
john kevin asprec
d0c4cc947d refactor: declarative context-menu registry; named selection threshold
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>
2026-07-14 21:44:16 +08:00
john kevin asprec
f0962471b4 refactor: collapse 8 provider functions into one adapter table
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>
2026-07-14 21:42:39 +08:00
john kevin asprec
c4634d4965 refactor: consolidate API-key crypto into src/lib/crypto with compat tests
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>
2026-07-14 21:38:42 +08:00
john kevin asprec
47d9152bda refactor: single source for writing styles + action labels; add theme module
- src/lib/actions.ts: canonical ACTIONS/ACTION_LABELS/WRITING_STYLES;
  context-menu styles derived (WRITING_STYLES minus Default). Replaces
  the three duplicated style arrays in popup, content, and background.
- src/lib/theme.ts: canonical palette. Existing hex literals in the
  entrypoints are swapped wholesale when light/dark theming lands, so
  the color plumbing is only rewritten once.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 21:35:54 +08:00
john kevin asprec
324cfcc486 refactor: extract shared types + safe chrome wrappers into src/lib
- 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>
2026-07-14 21:33:56 +08:00
john kevin asprec
f7fcd41341 feat: implement API key resolution and live model listing for providers
All checks were successful
CI — Test & Build / Test & Build (push) Successful in 59s
2026-07-13 13:56:48 +08:00
Forge
b0f79566e6 feat: LEXAI-15 writing style selector in modal, popup, and right-click menu
Some checks failed
CI — Test & Build / Test & Build (push) Failing after 47s
2026-03-06 15:43:10 +08:00
Forge
1490e6641f feat: replace Tone Analysis with Explain - simplifies highlighted text in plain language
Some checks failed
CI — Test & Build / Test & Build (push) Failing after 49s
2026-03-06 15:27:40 +08:00
Forge
e3b4925ef5 feat: LEXAI-16 request timeout (fetchWithTimeout), LEXAI-19 Copy As, LEXAI-20 Download
Some checks failed
CI — Test & Build / Test & Build (push) Has been cancelled
2026-03-06 15:25:45 +08:00
Forge
0273356f4d feat: LEXAI-13 API encryption, LEXAI-11 context menu, LEXAI-12 tone analysis
- LEXAI-13: TweetNaCl secretbox encryption for API keys in Options + background
  - getOrCreateEncKey() generates per-device 32-byte key stored in chrome.storage.local
  - Keys saved as nonce+ciphertext (base64) under apiKeyEnc
  - Backward compat: falls back to plaintext apiKey if no encrypted key found
  - Lock icon 🔒 shown in Options label when key is encrypted
- LEXAI-11: Right-click context menu with Fix, Rephrase, Shorten, Expand, Tone
  - Registered via onInstalled in background service worker
  - Sends lexai-context-menu message to content script
  - Content script listener added at bottom of main()
- LEXAI-12: Tone analysis button added to floating toolbar (teal #2dd4bf)
  - Analysis-only: showModal called with null originalText = no Replace button
  - Tone system prompt updated to pure analysis (no rewrite)
2026-03-06 15:06:43 +08:00
Forge
c35ef08531 feat: fix WXT setup — install @wxt-dev/module-react, fix sandbox imports, clean build (closes #1)
Some checks failed
CI — Test & Build / Unit Tests (push) Failing after 34s
CI — Test & Build / Build Extension (push) Has been skipped
2026-03-06 13:11:19 +08:00
Nemo
b04076081c 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
2026-03-06 09:34:15 +08:00