Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 24, 2026

  • Set up project structure with npm/package.json
  • Add diff2html dependency (local/offline)
  • Create Chrome extension files:
    • manifest.json (v3)
    • background.js
    • diff-viewer.html (main page)
    • diff-viewer.js
    • styles.css
    • icons (16, 48, 128)
  • Create Edge extension files (same structure)
  • Add GitHub workflow files:
    • .github/dependabot.yml
    • .github/CODEOWNERS
    • .github/workflows/test.yml
    • .github/workflows/release.yml
    • .github/workflows/push-artifact.yml
  • Build scripts for both browsers
  • Test the extension functionality
  • Take screenshots of the UI
  • Run code review
  • Run security scan (fixed workflow permissions)
  • Refactor to eliminate duplicate code between Chrome and Edge

Refactoring

Moved shared files to src/common/ directory to eliminate code duplication:

  • diff-viewer.html, diff-viewer.js, styles.css - shared UI files
  • icons/ - shared icon files
  • lib/ - shared diff2html library

Browser-specific files remain in src/chrome/ and src/edge/:

  • manifest.json - browser-specific manifest
  • background.js - browser-specific background script

Screenshots

UI After Refactoring

Refactored UI

Original prompt

This section details on the original issue you should resolve

<issue_title>功能需求</issue_title>
<issue_description>1. 提供谷歌浏览器和edge浏览器两个插件的构建
2. 提供.github下dependabot和codeowners 以及测试工作流,release发布时上传产物的工作流,每次推送到master分支时上传产物保留7天
3. 功能需求是,点击插件后,在浏览器创建一个html页面,在这个页面里可以上传patch/diff文件 或者手动输入文件内容,然后在另一个视图利用diff2html 渲染UI
4. 我希望默认左右布局,支持切换上下布局

Image 5. 我希望不要用一些在线的css或者js或者api进行因为可能使用者处于无法连接外网的环境

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Add Chrome and Edge extension source files
- Add diff-viewer.html with side-by-side and line-by-line layouts
- Add diff2html library (offline/local)
- Add build script for both browsers
- Add GitHub workflows (test, release, push-artifact)
- Add dependabot.yml and CODEOWNERS
- Add README.md documentation

Co-authored-by: unknowIfGuestInDream <57802425+unknowIfGuestInDream@users.noreply.github.com>
Co-authored-by: unknowIfGuestInDream <57802425+unknowIfGuestInDream@users.noreply.github.com>
Copilot AI changed the title [WIP] Add browser extensions for Chrome and Edge with required workflows Add Patch Reader browser extension for Chrome and Edge Jan 24, 2026
@unknowIfGuestInDream unknowIfGuestInDream marked this pull request as ready for review January 24, 2026 08:42
@unknowIfGuestInDream
Copy link
Contributor

@copilot 谷歌浏览器和edge很多资源是一样的,是否存在重复代码的问题?

- Move shared files (diff-viewer.html, diff-viewer.js, styles.css, icons, lib) to src/common
- Keep only browser-specific files (manifest.json, background.js) in src/chrome and src/edge
- Update build script to copy common files to both browser directories during build
- Update README with new project structure

Co-authored-by: unknowIfGuestInDream <57802425+unknowIfGuestInDream@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 24, 2026

@copilot 谷歌浏览器和edge很多资源是一样的,是否存在重复代码的问题?

已在 4d83567 中解决。将共享文件(diff-viewer.html、diff-viewer.js、styles.css、icons、lib)移至 src/common/ 目录,Chrome 和 Edge 只保留各自特有的文件(manifest.json、background.js)。构建脚本会在打包时将 common 目录的文件复制到两个浏览器的输出目录。

新的项目结构:

src/
├── common/           # 共享文件
│   ├── diff-viewer.html
│   ├── diff-viewer.js
│   ├── styles.css
│   ├── icons/
│   └── lib/
├── chrome/           # Chrome 特有文件
│   ├── manifest.json
│   └── background.js
└── edge/             # Edge 特有文件
    ├── manifest.json
    └── background.js

@unknowIfGuestInDream unknowIfGuestInDream merged commit c38a9aa into master Jan 24, 2026
3 checks passed
@unknowIfGuestInDream unknowIfGuestInDream deleted the copilot/add-browser-extensions branch January 24, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

功能需求

2 participants