Skip to content

Commit abe23a9

Browse files
authored
Merge pull request #25 from telepace/feat/client-deployment
feat: expand item types and improve API response handling
2 parents 12033fc + 326d986 commit abe23a9

File tree

209 files changed

+26403
-9074
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+26403
-9074
lines changed

.cursor/rules/github-operation.mdc renamed to .cursor/rules/mcp-operation.mdc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Any operations involving issues and pulls on GitHub
33
globs:
44
alwaysApply: false
55
---
6-
**Repository Resolution Logic:**
6+
**Github Repository Resolution Logic:**
77

88
- If owner and repo are explicitly provided, use them.
99
- Otherwise, default to:
@@ -17,3 +17,7 @@ alwaysApply: false
1717
- The language chosen for raising an issue: Chinese-
1818
- Be careful not to be too AI in your tone.
1919
- Pay attention to choosing the appropriate labels and types. And select the latest Milestone
20+
21+
**Postgres db operation Logic:**
22+
23+
- db name is `app`
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
Design with Test-Driven Development + sequential thinking + API documentation review.
7+
8+
## Process
9+
10+
1. **Write Tests First**
11+
- Define expected behavior before implementation
12+
13+
2. **Think Sequentially**
14+
- Number each thought step
15+
- Revise or branch when needed
16+
- Generate and verify hypothesis
17+
18+
3. **Check API Docs**
19+
- Consult official documentation before API usage
20+
- Validate understanding with test cases
21+
22+
4. **Implement Minimally**
23+
- Write code that passes tests
24+
- Follow your sequential thought chain
25+
5. **Refactor & Validate**
26+
- Clean up while maintaining passing tests
27+
- Verify all requirements are met

.env.example

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ DOMAIN=localhost.nip.io
2626
# Used by the backend to generate links (e.g., in emails).
2727
# Example for local development: http://localhost:8000
2828
# Example for production: https://dashboard.yourdomain.com
29-
FRONTEND_HOST=http://localhost:8000
29+
FRONTEND_HOST=http://localhost:3000
3030

3131
# -- Backend Settings --
3232

@@ -47,6 +47,7 @@ [email protected]
4747

4848
# First Superuser Password: Password for the initial administrator account.
4949
# Choose a strong password.
50+
# min_length=8
5051
FIRST_SUPERUSER_PASSWORD='telepace'
5152

5253
# -- Email (SMTP) Settings --
@@ -220,5 +221,3 @@ OR_API_KEY="sk-or-api03-1234567890"
220221
# Google OAuth client ID and secret for authentication
221222
GOOGLE_CLIENT_ID=
222223
GOOGLE_CLIENT_SECRET=
223-
GOOGLE_OAUTH_REDIRECT_URI=http://localhost:8000/api/v1/login/google/callback
224-
FRONTEND_URL=http://localhost:3000

.github/workflows/generate-client.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Setup pnpm
3333
uses: pnpm/action-setup@v3
3434
with:
35-
version: 8
35+
version: 9.9.0
3636

3737
- name: Setup Node.js
3838
uses: actions/setup-node@v4
@@ -56,6 +56,10 @@ jobs:
5656
- name: Install Frontend Dependencies
5757
run: pnpm install
5858
working-directory: frontend
59+
60+
- name: Install Admin Dependencies
61+
run: pnpm install
62+
working-directory: admin
5963

6064
# 安装所有后端依赖项
6165
- name: Install Backend Dependencies
@@ -94,7 +98,9 @@ jobs:
9498
9599
# 6. Stage Generated Files
96100
- name: Stage Generated Client Files
97-
run: git add frontend/src/client # Adjust path if needed
101+
run: |
102+
git add frontend/app/openapi-client
103+
git add admin/src/client
98104
99105
# 7. Handle Changes for Same-Repo Events (Push/PR from same repo)
100106
- name: Commit and Push Changes (Same Repo)
@@ -104,8 +110,8 @@ jobs:
104110
# Check if there are staged changes
105111
if ! git diff --staged --quiet; then
106112
echo "✅ Changes detected in generated client. Committing and pushing..."
107-
# Pull before pushing to avoid conflicts if possible (optional)
108-
# git pull --ff-only origin ${{ github.head_ref || github.ref_name }}
113+
# Pull before pushing to avoid conflicts
114+
git pull --rebase origin ${{ github.head_ref || github.ref_name }}
109115
git commit -m "ci: ✨ Autogenerate frontend client"
110116
git push origin HEAD:${{ github.head_ref || github.ref_name }}
111117
else

.github/workflows/playwright.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ jobs:
4848
steps:
4949
- uses: actions/checkout@v4
5050
- name: Install pnpm
51-
uses: pnpm/action-setup@v2
51+
uses: pnpm/action-setup@v3
5252
with:
53-
version: 8
53+
version: 9.9.0
5454
- uses: actions/setup-node@v4
5555
with:
5656
node-version: lts/*

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ jobs:
5757
run: |
5858
echo "## 🚀 Release Summary" >> $GITHUB_STEP_SUMMARY
5959
echo "Release draft created for version ${{ github.event.inputs.version }}." >> $GITHUB_STEP_SUMMARY
60-
echo "Visit the [Releases section](https://github.com/vintasoftware/nextjs-fastapi-template/releases) to review and publish the release." >> $GITHUB_STEP_SUMMARY
60+
echo "Visit the [Releases section](https://github.com/https://github.com/telepace/releases) to review and publish the release." >> $GITHUB_STEP_SUMMARY
6161
echo "Once the draft is published, another action will automatically be triggered to publish the packages." >> $GITHUB_STEP_SUMMARY

Makefile

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ UV_EXISTS := $(shell command -v uv 2> /dev/null)
6666

6767
## all: Run all tests, linting, formatting and build all components
6868
.PHONY: all
69-
all: format lint test backend-build frontend-build admin-build
69+
all: format lint generate-client backend-build frontend-build admin-build # test
7070
@echo "===========> All checks and builds completed successfully"
7171

7272
## dev: Start development environment
@@ -81,7 +81,8 @@ lint: backend-lint frontend-lint admin-lint
8181

8282
## test: Run tests for all components
8383
.PHONY: test
84-
test: backend-test frontend-test website-test admin-test
84+
test: backend-test frontend-test website-test admin-test extension-test-unit
85+
@echo "===========> All tests completed successfully"
8586

8687
## format: Format code in all components
8788
.PHONY: format
@@ -395,9 +396,15 @@ website-test: website-install
395396
# EXTENSION TARGETS
396397
# ==============================================================================
397398

399+
## extension-clean: Clean extension build artifacts and cache
400+
.PHONY: extension-clean
401+
extension-clean:
402+
@echo "===========> Cleaning extension build artifacts and cache"
403+
@cd $(EXTENSION_DIR) && rm -rf build .plasmo
404+
398405
## extension-all: Run all extension related tasks without starting services
399406
.PHONY: extension-all
400-
extension-all: extension-build extension-package
407+
extension-all: extension-build extension-package extension-test
401408
@echo "===========> Extension all checks completed successfully"
402409

403410
## extension: Start extension development
@@ -408,16 +415,35 @@ extension: check-pnpm
408415

409416
## extension-build: Build browser extension for production
410417
.PHONY: extension-build
411-
extension-build: check-pnpm
418+
extension-build: check-pnpm extension-clean
412419
@echo "===========> Building browser extension for production"
413-
@cd $(EXTENSION_DIR) && $(PNPM) run build
420+
@cd $(EXTENSION_DIR) && $(PNPM) run build:with-tailwind
421+
@echo "===========> Running post-build fixes"
422+
@cd $(EXTENSION_DIR) && ./scripts/fix-build.sh
414423

415424
## extension-package: Package browser extension for distribution
416425
.PHONY: extension-package
417426
extension-package: check-pnpm
418427
@echo "===========> Packaging browser extension for distribution"
419428
@cd $(EXTENSION_DIR) && $(PNPM) run package
420429

430+
## extension-test: Run all extension tests
431+
.PHONY: extension-test
432+
extension-test: extension-test-unit extension-test-e2e
433+
@echo "===========> All extension tests completed"
434+
435+
## extension-test-unit: Run extension unit tests with Jest
436+
.PHONY: extension-test-unit
437+
extension-test-unit: check-pnpm
438+
@echo "===========> Running extension unit tests"
439+
@cd $(EXTENSION_DIR) && $(PNPM) test
440+
441+
## extension-test-e2e: Run extension E2E tests with Playwright
442+
.PHONY: extension-test-e2e
443+
extension-test-e2e: check-pnpm
444+
@echo "===========> Running extension E2E tests"
445+
@cd $(EXTENSION_DIR) && $(PNPM) exec playwright test
446+
421447
# ==============================================================================
422448
# DOCKER TARGETS
423449
# ==============================================================================

README.md

Lines changed: 112 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ This project provides optimized scripts and Makefile targets for common developm
418418
### Frontend Development
419419

420420
- `make frontend-install` - Install frontend dependencies
421-
- `make frontend-dev` - Run frontend development server
421+
- `make frontend` - Run frontend development server
422422
- `make frontend-build` - Build frontend for production
423423
- `make frontend-test` - Run frontend tests
424424
- `make frontend-lint` - Run linters on frontend code
@@ -436,4 +436,114 @@ This project provides optimized scripts and Makefile targets for common developm
436436
- `make generate-client` - Generate OpenAPI client for frontend
437437
- `make format` - Format code in all components
438438
- `make lint` - Run linters on all components
439-
- `make clean` - Clean build artifacts
439+
- `make clean` - Clean build artifacts
440+
441+
# Nexus 浏览器扩展重构计划
442+
443+
## 目标
444+
- 优化扩展架构,减少冗余代码
445+
- 重新设计UI,提高用户体验
446+
- 将设置整合到options.html中
447+
- 简化侧边栏功能,提高性能和可维护性
448+
- 参考Sider等优秀扩展的设计模式
449+
450+
## 现状分析
451+
目前扩展存在以下问题:
452+
1. 多个重复或未使用的文件和模块
453+
2. 侧边栏实现混合了原生DOM操作和React,不够统一
454+
3. 设置功能分散在多个位置
455+
4. UI组件结构复杂,维护困难
456+
5. 缺乏统一的状态管理
457+
458+
## 架构重构计划
459+
460+
### 1. 核心架构优化
461+
- **采用模块化设计**:清晰区分UI层、业务逻辑层和基础设施层
462+
- **统一状态管理**:使用React Context或Redux管理全局状态
463+
- **API抽象**:将所有浏览器API调用封装到单独的服务层
464+
465+
### 2. 组件结构调整
466+
- **UI组件库精简**:保留必要的UI组件,移除未使用组件
467+
- **功能组件化**:将每个主要功能(摘要、搜索等)封装为独立组件
468+
- **采用React Hooks**:重构类组件为函数组件,使用hooks管理状态
469+
470+
### 3. 页面重组
471+
- **侧边栏(SidePanel)**:专注于内容交互和AI对话功能
472+
- **弹出窗口(Popup)**:提供快速访问和简要信息
473+
- **选项页面(Options)**:集中所有设置管理功能
474+
475+
## 功能优化计划
476+
477+
### 1. 侧边栏优化
478+
- 重新设计侧边栏UI,更简洁现代
479+
- 实现类似Sider的AI对话界面
480+
- 增强上下文感知能力,更好地理解当前页面内容
481+
- 添加对话历史记录功能
482+
483+
### 2. 设置功能整合
484+
- 将所有设置集中到options.html
485+
- 按类别组织设置选项(一般设置、AI设置、剪藏设置等)
486+
- 增加设置搜索功能
487+
- 实现设置同步功能
488+
489+
### 3. 增强功能
490+
- 实现多AI模型支持(类似Sider)
491+
- 添加更丰富的上下文操作(翻译、解释、总结等)
492+
- 改进内容提取算法,更准确识别页面主要内容
493+
- 添加键盘快捷方式
494+
495+
## 技术实现计划
496+
497+
### 第一阶段:架构整理与基础重构
498+
1. 清理未使用的代码和文件
499+
2. 创建新的核心架构(服务层、状态管理)
500+
3. 重构基础UI组件库
501+
502+
### 第二阶段:功能组件重构
503+
1. 重构侧边栏核心组件
504+
2. 重构弹出窗口UI
505+
3. 重新设计Options页面
506+
507+
### 第三阶段:功能优化与扩展
508+
1. 实现新的AI对话界面
509+
2. 增强设置功能
510+
3. 添加新功能
511+
512+
### 第四阶段:测试与性能优化
513+
1. 全面测试各项功能
514+
2. 性能优化
515+
3. 兼容性测试
516+
517+
## 具体实施计划
518+
每个阶段详细的任务清单和实现时间表将根据开发资源和优先级另行制定。
519+
520+
## 重构进度
521+
522+
### 已完成
523+
1. 设计规划:制定了全面的重构计划
524+
2. 侧边栏重构:
525+
- 重新设计了侧边栏组件,使用React Hooks和函数组件
526+
- 实现了类似Sider的对话界面
527+
- 增加了对话历史管理
528+
- 添加了暗色模式切换
529+
3. 选项页面重构:
530+
- 设计了全新的选项页面布局,采用侧边导航样式
531+
- 将所有设置集中归类,包括一般设置、AI设置、剪藏设置和键盘快捷键等
532+
- 实现了多AI模型支持和API密钥配置
533+
- 添加了快捷提示管理功能
534+
535+
### 未完成
536+
1. Popup页面重构
537+
2. 背景服务优化
538+
3. 内容脚本优化
539+
4. 状态管理统一
540+
5. API服务层抽象
541+
6. Manifest.json更新
542+
543+
## 下一步计划
544+
1. 更新manifest.json,添加必要的权限和配置
545+
2. 重构Popup页面,实现快速访问功能
546+
3. 创建服务层,统一API调用
547+
4. 实现状态管理系统,使用React Context或Redux
548+
5. 优化页面内容提取算法
549+
6. 增强AI功能,添加更多模型支持

README_zh-CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ QuickForge AI使集成各种AI服务变得简单:
471471
+ [1000UserGuide:对独立开发者和创业者来说,找到前1000个早期用户太关键了。这里精心整理了300多个国内外渠道,适合独立开发者和创业者推广产品的渠道。](https://github.com/naxiaoduo/1000UserGuide)
472472
+ [中国独立开发者项目列表](https://github.com/1c7/chinese-independent-developer)
473473
+ [独立开发者必备技能及现代工具 & 分别的上手指导](https://nsddd.top/zh/posts/ai-projects/independent-developer/)
474+
+ [发现最好的独立开发者技术栈](https://www.chuhai.tools/categories/chrome-extension-development-template)
474475

475476

476477
## 📄 许可证

SECURITY.md

Lines changed: 0 additions & 29 deletions
This file was deleted.
76.6 KB
Binary file not shown.

admin/src/client/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ export { CancelablePromise, CancelError } from "./core/CancelablePromise"
44
export { OpenAPI, type OpenAPIConfig } from "./core/OpenAPI"
55
export * from "./sdk.gen"
66
export * from "./types.gen"
7-
export { isApiResponse, extractApiResponseError } from "./utils"
8-
export { type ItemPublic } from "./types"
7+
export * from "./utils"

0 commit comments

Comments
 (0)