Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
5f7f3e4
🐛 修复和优化 ScriptEditor 问题 (#1258)
cyfung1031 Mar 11, 2026
62d414e
Merge branch 'main' into release/v1.4
CodFrm Mar 13, 2026
847b776
chore: bump version to 1.4.0-beta
CodFrm Mar 13, 2026
7b81b8c
fix: 构建时将 prerelease 版本号转换为 Chrome 兼容格式
CodFrm Mar 13, 2026
d45750f
refactor: 提取 toChromeVersion 为公共函数
CodFrm Mar 13, 2026
6084f79
Merge branch 'main' into release/v1.4
CodFrm Mar 13, 2026
9cc9262
✅ 修复 e2e 测试 service worker 超时并优化等待策略
CodFrm Mar 13, 2026
c4b26ed
✨ feat: 添加 Agent 聊天功能
CodFrm Mar 11, 2026
e735d8f
✨ feat: Agent API 通过 GM API 权限系统鉴权
CodFrm Mar 11, 2026
69c8973
✨ feat: 添加 OPFS 文件浏览器和优化 Agent 工具注册
CodFrm Mar 11, 2026
3e17c2c
🐛 fix: 修复 Agent tool calling 多个问题
CodFrm Mar 11, 2026
3cb6baa
🎨 style: 统一代码格式化
CodFrm Mar 11, 2026
e836c33
✨ feat: 添加 Agent 消息元数据展示和操作工具条
CodFrm Mar 11, 2026
8cd1a89
✨ feat: 添加 CATTool 系统和修复沙箱上下文注入
CodFrm Mar 12, 2026
f6f17cd
♻️ refactor: 拆分 Install Page 为 hooks + 独立视图组件
CodFrm Mar 12, 2026
e471187
📝 docs: 添加 CATTool 示例和使用文档
CodFrm Mar 12, 2026
3070ea1
🐛 fix: 修复 Agent 对话上下文丢失和流式错误处理
CodFrm Mar 12, 2026
c2c277c
♻️ refactor: 统一 UI/脚本聊天通道,规范字段命名,补充测试
CodFrm Mar 12, 2026
6e72ccc
✨ feat: 添加对话命令系统、修复删除弹框消失和会话 URL 同步
CodFrm Mar 12, 2026
359717e
✨ feat: CATTool 安装流程改进、模型配置存储迁移
CodFrm Mar 12, 2026
af95bbf
🔧 fix: 修复 lint 错误和 JSX 字面字符串警告
CodFrm Mar 12, 2026
d9bff8c
🔧 style: prettier 格式化
CodFrm Mar 12, 2026
d802120
✨ feat: 实现 CAT.agent.dom 页面 DOM 操作能力
CodFrm Mar 12, 2026
5e544ee
✨ feat: 添加 Skill 系统 — 提示词 + CATTool + 参考资料的组合能力
CodFrm Mar 12, 2026
4ff3dd7
✅ 添加 Agent 核心逻辑 E2E 测试
CodFrm Mar 12, 2026
7437f9e
♻️ refactor: Skill 系统三层渐进加载 — system prompt 只注入摘要,按需加载完整提示词和工具
CodFrm Mar 12, 2026
c3cad66
✨ feat: 实现临时会话(ephemeral conversation)支持
CodFrm Mar 12, 2026
a6c2e26
✨ feat: 实现 MCP Client — Streamable HTTP transport + Tools/Resources/P…
CodFrm Mar 12, 2026
027cdc6
🐛 fix: listModels 过滤 __default__ key 避免 ModelCard 崩溃
CodFrm Mar 12, 2026
eb7baa4
🐛 fix: OpenAI provider 支持 reasoning_content 思考过程展示并修复 usage/choices 处理顺序
CodFrm Mar 12, 2026
3bca9d8
✨ feat: Skill 管理页面 — 列表/安装/编辑/卸载 + 消息通道 + 单元测试
CodFrm Mar 12, 2026
1639aa6
🧹 chore: 移除未使用的 ComingSoon 组件
CodFrm Mar 12, 2026
fa7953d
✨ feat: Skill ZIP 包一键安装支持
CodFrm Mar 12, 2026
a24bf82
🐛 fix: trusted 模式 debugger 权限通过 confirm 页面请求
CodFrm Mar 12, 2026
6bdaf28
♻️ refactor: 移除 execute_skill_tool,load_skill 时按需注册 CATTool 为独立 LLM tool
CodFrm Mar 12, 2026
3a429a1
✨ feat: MCP 服务器详情面板 + 测试连接 loading 优化
CodFrm Mar 12, 2026
aee5000
✨ feat: Skill 安装优化 — 仅 ZIP 包 + 拖拽 + 独立安装页面
CodFrm Mar 12, 2026
cb0244a
✨ feat: 流式事件增强 + 淘宝 Skill 示例 + 输入法修复
CodFrm Mar 12, 2026
814d7a1
🧹 chore: 修复 prettier lint 错误 + eslint 忽略 .claude 目录
CodFrm Mar 12, 2026
48d5b94
🐛 fix: 修复测试和类型检查问题
CodFrm Mar 12, 2026
e6c8e06
feat: 会话附件支持 — 工具产出图片/文件展示
CodFrm Mar 12, 2026
ab05e05
fix: skill CATTool 权限验证失败 — UUID map 直接携带 grants
CodFrm Mar 12, 2026
9109fd3
feat: 移除 MCP 脚本 API + Tools/Skills 写操作权限强化
CodFrm Mar 12, 2026
bb67f45
fix: 修复代码块高亮渲染显示 [object Object] + 暗色模式适配
CodFrm Mar 12, 2026
d83136e
fix: debugger 权限改为安装时授予,移除动态请求流程
CodFrm Mar 13, 2026
42e2c89
feat: 用户消息编辑重新发送 + 修复工具调用展开内容截断
CodFrm Mar 13, 2026
ecb0c43
fix: MessageToolbar 移除 hasMetadata 提前返回,确保操作按钮始终可用
CodFrm Mar 13, 2026
78a80d0
feat: agent DOM monitor + CDP 重构 + browser_automation skill 示例
CodFrm Mar 13, 2026
2c9b452
feat: Anthropic/OpenAI prompt caching 支持 + 缓存用量展示
CodFrm Mar 13, 2026
18f8863
feat: 系统提示词模块化 + 聊天逻辑重构 + DOM 监控优化
CodFrm Mar 13, 2026
ec2fc50
fix: 修复 isolate:false 下 UUID mock 冲突导致的测试失败
CodFrm Mar 13, 2026
6cef826
🐛 修复和优化 ScriptEditor 问题 (#1258)
cyfung1031 Mar 11, 2026
abf61e7
chore: bump version to 1.4.0-beta
CodFrm Mar 13, 2026
4e0790c
fix: 构建时将 prerelease 版本号转换为 Chrome 兼容格式
CodFrm Mar 13, 2026
3ab199c
refactor: 提取 toChromeVersion 为公共函数
CodFrm Mar 13, 2026
db118d6
feat: 新增 CATTool 管理页面
CodFrm Mar 13, 2026
f4e3709
fix: 修复重新生成用户消息时内容重复的 bug
CodFrm Mar 13, 2026
8127753
feat: 错误处理三件套(超时、重试、错误分类)及单元测试
CodFrm Mar 13, 2026
6162dd5
refactor: 删除内置 DOM Tools,转为 browser-automation Skill 中的 CATTool
CodFrm Mar 13, 2026
a84b6a9
refactor: 优化 Agent 系统提示词,解耦工具实现细节
CodFrm Mar 13, 2026
2d6e7f3
refactor: 优化 browser-automation Skill 工具命名和提示词
CodFrm Mar 13, 2026
4f9d498
feat: ChatMessage.content 升级为 string | ContentBlock[] 支持多模态内容
CodFrm Mar 13, 2026
971f2bc
test: 补充 Agent 核心路径单元测试和 E2E 测试
CodFrm Mar 13, 2026
960a091
feat: CATTool 支持 @require 外部库加载
CodFrm Mar 13, 2026
016dcb8
fix: 修复 screenshot CATTool 截图失败的问题
CodFrm Mar 13, 2026
15ffbac
feat: Skill 管理支持查看工具代码和刷新缓存
CodFrm Mar 13, 2026
38767a1
fix: Skill 更新时清理旧的 scripts/references 文件
CodFrm Mar 13, 2026
779b0a3
feat: Agent 定时任务系统(internal/event 双模式)
CodFrm Mar 14, 2026
1c81c1c
fix: cdpClick 增加元素遮挡检测,避免点击到覆盖层
CodFrm Mar 14, 2026
db8e6a6
fix: 补全 Agent GM API 注册和 ESLint grant 白名单
CodFrm Mar 14, 2026
fb236d3
refactor: 迁移 Agent 示例到独立 skills 仓库
CodFrm Mar 14, 2026
5cb0e6a
feat: Skill Config 系统 — 支持 SKILL.md 声明配置字段并在沙箱中注入 CAT_CONFIG
CodFrm Mar 14, 2026
e98bdc9
docs: 同步 scriptcat.d.ts 类型声明并添加中文版
CodFrm Mar 14, 2026
aa8c203
refactor: 明确 Agent GM API 返回值类型,消除 unknown/any
CodFrm Mar 14, 2026
32e612b
fix: 修正 scriptcat.d.ts 类型声明与源码实现的差异
CodFrm Mar 14, 2026
7efcd37
fix: 修复 E2E 测试 flaky 问题
CodFrm Mar 14, 2026
d49afaf
feat: 允许 CATTool 通过 @timeout 元数据自定义超时时间
CodFrm Mar 14, 2026
8f2a01a
fix: 修复 ESLint 警告并优化 E2E service worker 就绪逻辑
CodFrm Mar 15, 2026
29cf81c
fix: 修复亮色模式下用户消息气泡字体颜色问题
CodFrm Mar 15, 2026
388b6d6
feat: 将 prompt cache 控制权交给调用方,默认启用缓存
CodFrm Mar 15, 2026
d231320
⚙️ Add husky pre-push hook and fix e2e test code style
CodFrm Mar 16, 2026
530bdf6
Merge remote-tracking branch 'origin/main' into release/v1.4
CodFrm Mar 16, 2026
4347e77
⚙️ 添加 pre-commit 钩子,提交前自动执行 lint-fix
CodFrm Mar 16, 2026
50cd845
Merge branch 'main' into release/v1.4
CodFrm Mar 16, 2026
2d24504
✨ 把 fetchIconByDomain 改成 scriptcat.org (#1268)
cyfung1031 Mar 16, 2026
40c99fb
🐛 新增批次检查脚本的 timeout, 避免一个脚本更新时间太长导致所有脚本检查失败 (#1265)
cyfung1031 Mar 16, 2026
056bfab
✅ additional test for responseType=document (#1262)
cyfung1031 Mar 16, 2026
2c07d6b
⚡️ 更完整的permission检查,更好的userScript权限提示 (#1251)
cyfung1031 Mar 16, 2026
2e875bc
⚡️ 优化 MessageConnect 的记忆管理及Cleanup机制 (#1248)
cyfung1031 Mar 16, 2026
0aaef32
Merge remote-tracking branch 'origin/main' into feature/agent
CodFrm Mar 16, 2026
cf63761
Merge remote-tracking branch 'origin/release/v1.4' into feature/agent
CodFrm Mar 16, 2026
e00df98
⚡️ CI 支持 feature/* 分支构建、Agent 错误持久化及 UI 优化
CodFrm Mar 16, 2026
e4385ee
⚡️ Anthropic max_tokens 必填修复及模型配置 UI 支持自定义 max tokens
CodFrm Mar 16, 2026
b366a7a
⚡️ CAT.agent.model 只读 API 及多 tool_call 并行修复
CodFrm Mar 16, 2026
381cd70
🎨 Prettier 格式化修正
CodFrm Mar 16, 2026
fe6fc52
♻️ 统一 Model/MCP 数据加载方式,UI 页面通过 SW 消息通道获取数据
CodFrm Mar 17, 2026
59e761a
✨ 支持图片输入与模型图片生成
CodFrm Mar 17, 2026
78e422f
✨ Provider 图标识别、模型能力检测及模型服务卡片布局修复
CodFrm Mar 17, 2026
247c368
🐛 修复 Gemini 图片输出检测:仅 Gemini 2.0 Flash 支持
CodFrm Mar 17, 2026
89249a1
✨ 支持用户手动标记模型视觉输入和图片输出能力
CodFrm Mar 17, 2026
6405fed
🐛 修复 --isolate=false 下 vi.mock 不稳定导致的测试偶发失败
CodFrm Mar 17, 2026
520e338
✨ 支持禁用 tools 及 Markdown 图片预览增强
CodFrm Mar 17, 2026
8b44394
处理e2e问题加上缓存
CodFrm Mar 17, 2026
3ae34cb
♻️ 合并 CATTool 到 Skill 系统,统一为 execute_skill_script
CodFrm Mar 17, 2026
222d2f1
🐛 修复 CI 测试失败:navigator mock 污染和 e2e fixture 两阶段启动不可靠
CodFrm Mar 17, 2026
ddd0dfb
🐛 修复 CI 测试失败:navigator mock 污染和 e2e fixture 两阶段启动不可靠
CodFrm Mar 17, 2026
5f61397
♻️ 重命名 ==CATTool== 为 ==SkillScript==,清除所有 CATTool 残留
CodFrm Mar 17, 2026
b00c148
♻️ 重构 Agent E2E 测试:两阶段启动 + 共享 fixture + 修复 Repo 缓存 bug
CodFrm Mar 17, 2026
adadc5c
✨ 实现 Agent 内置工具:web_fetch、web_search、ask_user、agent、task 管理
CodFrm Mar 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report_en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ body:
attributes:
label: "Problem Description"
description: "What problem occurred? What is the expected normal behavior?"
placeholder: "e.g., When clicking the download button on YouTube page, the script throws a 404 error, expected to show a download window"
placeholder:
"e.g., When clicking the download button on YouTube page, the script throws a 404 error, expected to show a
download window"
validations:
required: true

Expand All @@ -37,7 +39,9 @@ body:
id: scriptcat-version
attributes:
label: ScriptCat Version
description: You can view it by clicking on the ScriptCat popup window. If possible, please use the latest version as your issue may have already been resolved
description:
You can view it by clicking on the ScriptCat popup window. If possible, please use the latest version as your
issue may have already been resolved
placeholder: e.g., v0.17.0
validations:
required: true
Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Please clearly describe the feature you want:

### Use Case

In what situations is this feature needed? (e.g., when processing specific websites, improving operational efficiency, etc.)
In what situations is this feature needed? (e.g., when processing specific websites, improving operational efficiency,
etc.)

### Additional Information

Expand Down
63 changes: 47 additions & 16 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,62 +9,77 @@ When performing a code review, respond in Chinese.
ScriptCat is a sophisticated browser extension that executes user scripts with a unique multi-process architecture:

### Core Components
- **Service Worker** (`src/service_worker.ts`) - Main background process handling script management, installations, and chrome APIs

- **Service Worker** (`src/service_worker.ts`) - Main background process handling script management, installations, and
chrome APIs
- **Offscreen** (`src/offscreen.ts`) - Isolated background environment for running background/scheduled scripts
- **Sandbox** (`src/sandbox.ts`) - Secure execution environment inside offscreen for script isolation
- **Content Scripts** (`src/content.ts`) - Injected into web pages to execute user scripts
- **Inject Scripts** (`src/inject.ts`) - Runs in page context with access to page globals

### Message Passing System

ScriptCat uses a sophisticated message passing architecture (`packages/message/`):

- **ExtensionMessage** - Chrome extension runtime messages between service worker/content/pages
- **WindowMessage** - PostMessage-based communication between offscreen/sandbox
- **CustomEventMessage** - CustomEvent-based communication between content/inject scripts
- **MessageQueue** - Cross-environment event broadcasting system

Key pattern: All communication flows through Service Worker → Offscreen → Sandbox for background scripts, or Service Worker → Content → Inject for page scripts.
Key pattern: All communication flows through Service Worker → Offscreen → Sandbox for background scripts, or Service
Worker → Content → Inject for page scripts.

### Script Execution Flow

1. **Page Scripts**: Service Worker registers with `chrome.userScripts` → injected into pages
2. **Background Scripts**: Service Worker → Offscreen → Sandbox execution
3. **Scheduled Scripts**: Cron-based execution in Sandbox environment

## Key Development Patterns

### Path Aliases

```typescript
"@App": "./src/"
"@Packages": "./packages/"
"@Tests": "./tests/"
```

### Repository Pattern

All data access uses DAO classes extending `Repo<T>` base class:

```typescript
// Example: ScriptDAO, ResourceDAO, SubscribeDAO
export class ScriptDAO extends Repo<Script> {
public save(val: Script) { return super._save(val.uuid, val); }
public save(val: Script) {
return super._save(val.uuid, val);
}
}
```

### Service Layer Structure

Services follow a consistent pattern with dependency injection:

```typescript
export class ExampleService {
constructor(
private group: Group, // Message handling group
private messageQueue: IMessageQueue, // Event broadcasting (MessageQueue's interface)
private dataDAO: DataDAO // Data access
private group: Group, // Message handling group
private messageQueue: IMessageQueue, // Event broadcasting (MessageQueue's interface)
private dataDAO: DataDAO // Data access
) {}

init() {
this.group.on("action", this.handleAction.bind(this));
}
}
```

### Script Compilation & Sandboxing

User scripts are compiled with sandbox context isolation:

- `compileScriptCode()` - Wraps scripts with error handling and context binding
- `compileInjectScript()` - Creates window-mounted functions for inject scripts
- Sandbox uses `with(arguments[0])` for controlled variable access
Expand All @@ -77,10 +92,10 @@ User scripts are compiled with sandbox context isolation:
- **Rspack** - Fast bundler (Webpack alternative) with SWC
- **TypeScript** - Type-safe development


## Development Workflows

### Build & Development

```bash
pnpm run dev # Development with source maps
pnpm run dev:noMap # Development without source maps (needed for incognito)
Expand All @@ -89,44 +104,51 @@ pnpm run pack # Create browser extension packages
```

### Testing

```bash
pnpm test # Run all tests with Vitest
pnpm run coverage # Generate coverage reports
```

**Testing Patterns:**

- Uses Vitest with jsdom environment
- Chrome extension APIs mocked via `@Packages/chrome-extension-mock`
- Message system testing with `MockMessage` classes
- Sandbox testing validates script isolation

### Code Organization

- **Monorepo structure** with packages in `packages/` (message, filesystem, etc.)
- **Feature-based organization** in `src/app/service/` by environment
- **Shared utilities** in `src/pkg/` for cross-cutting concerns
- **Type definitions** in `src/types/` with global declarations

### Browser Extension Specifics

- **Manifest V3** with service worker background
- **User Scripts API** for script injection (Chrome/Edge)
- **Offscreen API** for DOM access in background contexts
- **Offscreen API** for DOM access in background contexts
- **Declarative Net Request** for script installation interception

## Critical Integration Points

### Script Installation Flow

1. URL patterns trigger declarative net request rules
2. Service Worker opens install page with cached script data
3. Install page validates and processes script metadata
4. Scripts registered with appropriate execution environment

### GM API Implementation

- Split between Service Worker (`GMApi`) and Offscreen (`OffscreenGMApi`)
- Permission verification via `PermissionVerify` service
- Value storage abstracted through `ValueService`
- Cross-origin requests handled in service worker context

### Resource Management

- `ResourceService` handles script dependencies (@require, @resource)
- Content Security Policy handling for external resources
- Caching layer via `Cache` class with automatic expiration
Expand All @@ -139,33 +161,42 @@ pnpm run coverage # Generate coverage reports
- Sandbox script execution isolated from page context - use `unsafeWindow` for page access

## File Structure Patterns

- Tests co-located with source files (`.test.ts` suffix)
- Template files use `.tpl` extension for build-time processing
- Configuration files use factory pattern for environment-specific setup

## Language

- The code is developed and maintained by developers based in Mainland China.
- Comments should preferably be written in Simplified Chinese.
- The user interface supports multiple languages, with English set as the default for global users.

## PR Review Policy

When performing Pull Request (PR) reviews, Copilot must always conduct a **comprehensive and independent review** of the entire PR content.
When performing Pull Request (PR) reviews, Copilot must always conduct a **comprehensive and independent review** of the
entire PR content.

- **Full Review Every Time**
Always review **all modified files** in every PR, regardless of previous reviews or user comments. Even during re-reviews, treat the PR as new and **do not rely on prior review states**.
Always review **all modified files** in every PR, regardless of previous reviews or user comments. Even during
re-reviews, treat the PR as new and **do not rely on prior review states**.

- **No Skipping of Files**
Do not skip or ignore any text-based file types (including `.md`, `.json`, `.yml`, `.toml`, `.ts`, `.js`, `.py`, `.html`, `.css`, `.tsx`, `.vue`, `.sh`, etc.). Every file that is changed must be fully examined.
Do not skip or ignore any text-based file types (including `.md`, `.json`, `.yml`, `.toml`, `.ts`, `.js`, `.py`,
`.html`, `.css`, `.tsx`, `.vue`, `.sh`, etc.). Every file that is changed must be fully examined.

- **Reference as Context Only**
PR descriptions, commit messages, or user discussions serve only as **reference context**. The review must focus primarily on the **actual code and file changes**.
PR descriptions, commit messages, or user discussions serve only as **reference context**. The review must focus
primarily on the **actual code and file changes**.

- **Infer Intent from Code Changes**
Always attempt to **infer the purpose and intent** of the changes directly from the modified content, rather than relying solely on user statements or PR titles.
Always attempt to **infer the purpose and intent** of the changes directly from the modified content, rather than
relying solely on user statements or PR titles.

- **Critical Thinking Requirement**
For each change, Copilot should assess correctness, consistency, and maintainability — ensuring that logic, style, and architectural impact align with project standards.
For each change, Copilot should assess correctness, consistency, and maintainability — ensuring that logic, style, and
architectural impact align with project standards.

- **Independent Verification**
Do not assume unchanged files or previously reviewed sections are safe; verify all code paths potentially affected by the modifications.
Do not assume unchanged files or previously reviewed sections are safe; verify all code paths potentially affected by
the modifications.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- release/*
- feature/*
- dev
paths-ignore:
- ".github/**"
Expand All @@ -25,7 +26,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
cache: "pnpm"

- name: Package with Node
env:
Expand All @@ -51,4 +52,3 @@ jobs:
name: scriptcat-chrome-extension
path: |
dist/ext/*

2 changes: 1 addition & 1 deletion .github/workflows/packageRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
cache: "pnpm"

- name: Package with Node
env:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- release/*
- feature/*
- dev
- develop/*
pull_request:
Expand All @@ -21,7 +22,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
cache: "pnpm"

- name: Setup pnpm
run: corepack enable
Expand Down Expand Up @@ -61,7 +62,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
cache: "pnpm"

- name: Setup pnpm
run: corepack enable
Expand Down
13 changes: 13 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

pnpm run lint-fix

# 将已暂存且被 lint-fix 修改过的文件重新加入暂存区
STAGED=$(git diff --cached --name-only --diff-filter=d)
CHANGED=$(git diff --name-only)

for file in $CHANGED; do
case "$STAGED" in
*"$file"*) git add "$file" ;;
esac
done
35 changes: 35 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

# Skip checks: SKIP_PRE_PUSH=1 git push or git push --no-verify
if [ "$SKIP_PRE_PUSH" = "1" ]; then
echo "⏭ SKIP_PRE_PUSH=1, skipping pre-push checks"
exit 0
fi

# Only run checks when pushing to main or release/* branches
remote="$1"
need_check=0

while read local_ref local_sha remote_ref remote_sha; do
branch=$(echo "$remote_ref" | sed 's|refs/heads/||')

if [ "$branch" = "main" ] || echo "$branch" | grep -q "^release/"; then
need_check=1
echo "🔍 Detected push target: $branch"
fi
done

if [ "$need_check" = "0" ]; then
exit 0
fi

echo ""
echo "▶ Running lint..."
pnpm run lint || exit 1

echo ""
echo "▶ Running tests..."
pnpm run test:ci || exit 1

echo ""
echo "✅ All checks passed! (build and e2e tests will run in CI)"
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"trailingComma": "es5",
"useTabs": false,
"endOfLine": "auto"
}
}
10 changes: 4 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ git commit -m "✨ add login feature"
### 工作流概述

`main` 分支是 ScriptCat 的主分支。为了保持代码的完整性,请不要直接修改 `main`
分支。你应该创建一个新的分支,并在这个分支上进行修改,然后发起一个目标分支为
`main` 的 Pull Request。Pull Request
的标题请尽量使用中文,以便于自动生成更新日志。
分支。你应该创建一个新的分支,并在这个分支上进行修改,然后发起一个目标分支为 `main` 的 Pull Request。Pull
Request 的标题请尽量使用中文,以便于自动生成更新日志。

如果你不是 ScriptCat 团队的成员,你可以先 fork 本仓库,然后向本仓库的 `main`
分支发起 Pull Request。在创建 commit 时,请按照上述 commit message
规范进行。我们将在 code review 完成后将你的贡献合并到主分支。
如果你不是 ScriptCat 团队的成员,你可以先 fork 本仓库,然后向本仓库的 `main` 分支发起 Pull
Request。在创建 commit 时,请按照上述 commit message 规范进行。我们将在 code review 完成后将你的贡献合并到主分支。

## 撰写文档

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ smooth.

| Browser | Store Link | Status |
| ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| Chrome | [Stable Version](https://chromewebstore.google.com/detail/scriptcat/ndcooeababalnlpkfedmmbbbgkljhpjf) [Beta Version](https://chromewebstore.google.com/detail/scriptcat-beta/jaehimmlecjmebpekkipmpmbpfhdacom) | ✅ Available |
| Chrome | [Stable Version](https://chromewebstore.google.com/detail/scriptcat/ndcooeababalnlpkfedmmbbbgkljhpjf) [Beta Version](https://chromewebstore.google.com/detail/scriptcat-beta/jaehimmlecjmebpekkipmpmbpfhdacom) | ✅ Available |
| Edge | [Stable Version](https://microsoftedge.microsoft.com/addons/detail/scriptcat/liilgpjgabokdklappibcjfablkpcekh) [Beta Version](https://microsoftedge.microsoft.com/addons/detail/scriptcat-beta/nimmbghgpcjmeniofmpdfkofcedcjpfi) | ✅ Available |
| Firefox | [Stable Version](https://addons.mozilla.org/en/firefox/addon/scriptcat/) [Beta Version](https://addons.mozilla.org/en/firefox/addon/scriptcat-pre/) | ✅ MV2 |

Expand Down
8 changes: 4 additions & 4 deletions README_RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ ScriptCat — это мощный менеджер пользовательск

#### Магазины расширений (рекомендуется)

| Браузер | Ссылка на магазин | Статус |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- |
| Chrome | [Стабильная версия](https://chromewebstore.google.com/detail/scriptcat/ndcooeababalnlpkfedmmbbbgkljhpjf) / [Beta](https://chromewebstore.google.com/detail/scriptcat-beta/jaehimmlecjmebpekkipmpmbpfhdacom) | ✅ Доступно |
| Браузер | Ссылка на магазин | Статус |
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| Chrome | [Стабильная версия](https://chromewebstore.google.com/detail/scriptcat/ndcooeababalnlpkfedmmbbbgkljhpjf) / [Beta](https://chromewebstore.google.com/detail/scriptcat-beta/jaehimmlecjmebpekkipmpmbpfhdacom) | ✅ Доступно |
| Edge | [Стабильная версия](https://microsoftedge.microsoft.com/addons/detail/scriptcat/liilgpjgabokdklappibcjfablkpcekh) / [Beta](https://microsoftedge.microsoft.com/addons/detail/scriptcat-beta/nimmbghgpcjmeniofmpdfkofcedcjpfi) | ✅ Доступно |
| Firefox | [Стабильная версия](https://addons.mozilla.org/firefox/addon/scriptcat/) / [Beta](https://addons.mozilla.org/firefox/addon/scriptcat-pre/) | ✅ MV2 |
| Firefox | [Стабильная версия](https://addons.mozilla.org/firefox/addon/scriptcat/) / [Beta](https://addons.mozilla.org/firefox/addon/scriptcat-pre/) | ✅ MV2 |

#### Ручная установка

Expand Down
Loading
Loading