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

57
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,57 @@
name: CI — Test & Build
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run typecheck
- name: Run unit tests
run: npm test
build:
name: Build Extension
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build extension
run: npm run build
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: lexai-chrome-mv3-${{ github.sha }}
path: .output/chrome-mv3/
retention-days: 7

View File

@@ -0,0 +1,52 @@
name: Preview — PR Build Check
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
preview-build:
name: PR Preview Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run typecheck
- name: Run unit tests
run: npm test
- name: Build extension
run: npm run build
- name: Package preview ZIP
run: npm run zip
- name: Upload PR artifact
uses: actions/upload-artifact@v4
with:
name: lexai-pr-${{ github.event.pull_request.number }}-preview
path: .output/lexai-*.zip
retention-days: 3
- name: Comment on PR
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## ⚡ LexAI Preview Build Ready\n\n✅ Tests passed\n✅ Build successful\n\n📦 Download the extension ZIP from the **Artifacts** section above to test this PR.\n\nCommit: \`${{ github.sha }}\``
})

View File

@@ -0,0 +1,67 @@
name: Release — Package & Publish
on:
push:
tags:
- 'v*.*.*' # Triggers on: git tag v0.1.0 && git push --tags
jobs:
release:
name: Build & Package Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build extension
run: npm run build
- name: Package as ZIP (Chrome Web Store)
run: npm run zip
- name: Get version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create Gitea Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: LexAI ${{ steps.version.outputs.VERSION }}
body: |
## LexAI ${{ steps.version.outputs.VERSION }}
### Installation
1. Download `lexai-chrome-mv3.zip` below
2. Go to `chrome://extensions`
3. Enable Developer Mode
4. Click "Load unpacked" → extract the zip first
### What's new
See CHANGELOG.md for details.
draft: false
prerelease: false
- name: Upload ZIP to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .output/lexai-*.zip
asset_name: lexai-chrome-mv3-${{ steps.version.outputs.VERSION }}.zip
asset_content_type: application/zip