Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on:
pull_request:
branches: [main, master]
push:
branches: [main, master]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read

strategy:
matrix:
browser: [chrome, firefox]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Build for ${{ matrix.browser }}
run: |
if [ "${{ matrix.browser }}" = "firefox" ]; then
pnpm run build:firefox
else
pnpm run build
fi

- name: Create zip for ${{ matrix.browser }}
run: |
if [ "${{ matrix.browser }}" = "firefox" ]; then
pnpm run zip:firefox
else
pnpm run zip
fi

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: extension-${{ matrix.browser }}
path: .output/*.zip
retention-days: 7
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Build and zip Chrome extension
run: pnpm run zip

- name: Build and zip Firefox extension
run: pnpm run zip:firefox

- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
.output/inkcre-*-chrome.zip
.output/inkcre-*-firefox.zip
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ web-ext.config.ts
*.njsproj
*.sln
*.sw?

pnpm-lock.yaml
124 changes: 124 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# InKCre Web Extension

InKCre 是一个基于知识图谱的笔记和 AI 辅助写作浏览器扩展。

## 功能特性

- 创建互联的内容块(Blocks)构建个人知识图谱
- 使用关系(Relations)连接不同的内容块
- AI 辅助写作和内容解释
- 支持 Chrome 和 Firefox 浏览器

## 开发

### 环境要求

- Node.js 20+
- pnpm 9+

### 安装依赖

```bash
pnpm install
```

### 开发模式

```bash
# Chrome/Chromium 开发
pnpm run dev

# Firefox 开发
pnpm run dev:firefox
```

### 构建

```bash
# 构建 Chrome 版本
pnpm run build

# 构建 Firefox 版本
pnpm run build:firefox
```

### 打包

```bash
# 打包 Chrome 版本
pnpm run zip

# 打包 Firefox 版本
pnpm run zip:firefox
```

打包后的文件位于 `.output/` 目录:
- `inkcre-{version}-chrome.zip` - Chrome 扩展包
- `inkcre-{version}-firefox.zip` - Firefox 扩展包
- `inkcre-{version}-sources.zip` - 源代码包(仅 Firefox)

### 类型检查

```bash
pnpm run typecheck
```

## CI/CD

项目配置了自动化的 CI/CD 流程:

### 持续集成(CI)

当提交代码到主分支或创建 Pull Request 时,会自动触发 CI 流程:

- 类型检查
- 构建 Chrome 和 Firefox 版本
- 打包扩展
- 上传构建产物(保留 7 天)

### 持续部署(CD)

当创建版本标签时,会自动构建并发布到 GitHub Releases:

1. 创建新的版本标签:
```bash
git tag v0.1.0
git push origin v0.1.0
```

2. GitHub Actions 会自动:
- 构建 Chrome 和 Firefox 版本
- 打包扩展
- 创建 GitHub Release
- 上传扩展包到 Release

3. 用户可以从 [Releases 页面](https://github.com/InKCre/client-webext/releases) 下载最新版本

### 安装发布的扩展

#### Chrome/Edge

1. 从 [Releases](https://github.com/InKCre/client-webext/releases) 下载 `inkcre-*-chrome.zip`
2. 解压文件
3. 打开浏览器扩展管理页面(`chrome://extensions/` 或 `edge://extensions/`)
4. 启用"开发者模式"
5. 点击"加载已解压的扩展程序"
6. 选择解压后的文件夹

#### Firefox

1. 从 [Releases](https://github.com/InKCre/client-webext/releases) 下载 `inkcre-*-firefox.zip`
2. 打开 `about:debugging#/runtime/this-firefox`
3. 点击"临时加载附加组件"
4. 选择下载的 zip 文件

## 技术栈

- **框架**: WXT (Web Extension Toolkit) + Vue 3 + TypeScript
- **样式**: UnoCSS
- **存储**: @wxt-dev/storage
- **通信**: webext-bridge

## 许可证

见 [LICENSE](LICENSE) 文件。
Loading
Loading