How beilunyang/github-master-extension works
Purpose and Runtime
GitHub Master is a browser extension that augments GitHub repository pages with DeepWiki and GitDiagram navigation buttons. It targets Chrome (Manifest V3) and Firefox (Manifest V2) builds, configured through wxt.config.ts and packaged from package.json.
Extension Entry Points
• entrypoints/content.ts is the page-facing content script. It detects GitHub repository context and injects the external-service buttons into GitHub’s repository navigation UI.
• entrypoints/background.ts is the extension background runtime, providing the privileged/browser-lifecycle boundary for the content and popup contexts.
• entrypoints/popup/main.tsx mounts the popup UI; entrypoints/popup/App.tsx implements user-facing button visibility/preferences controls.
GitHub Page Augmentation Flow
On supported GitHub pages, the content script operates inside GitHub’s DOM boundary:
1. Identify repository navigation context and repository identity.
2. Create localized DeepWiki and GitDiagram controls.
3. Add controls to the GitHub navigation area.
4. Direct user clicks to the corresponding external DeepWiki or GitDiagram repository page.
The extension does not host or proxy either service; GitHub, DeepWiki, and GitDiagram are separate boundaries.
Settings and Popup Boundary
The popup is a React-based extension UI, separated from the GitHub page runtime:
• entrypoints/popup/App.tsx
• entrypoints/popup/main.tsx
• entrypoints/popup/App.css
It exposes customization for showing or hiding injected buttons. Browser extension APIs and the background context are the expected persistence/coordination boundary between popup preferences and content-script behavior.
Localization Architecture
Two localization systems serve distinct browser-extension surfaces:
• i18n/index.ts and locale modules such as i18n/locales/en.ts provide application/UI translations for popup and injected controls.
• public/_locales/en/messages.json, public/_locales/zh_CN/messages.json, and public/_locales/zh_TW/messages.json provide browser manifest/store-visible localized extension metadata.
Supported language variants include English, Simplified Chinese, Traditional Chinese, and generic Chinese definitions.
Build and Release Pipeline
WXT drives multi-browser extension bundling from wxt.config.ts, producing browser-specific build outputs described in the README. The release workflow at .github/workflows/build-release.yml builds Chrome and Firefox distributables and publishes releases from version tags. Development and package orchestration use pnpm, defined by package.json and pnpm-lock.yaml.
Components 16
Extension runtimes
Separate page, popup, and privileged extension contexts.
- Content script · Detects repository context and injects navigation controls.
entrypoints/content.ts - Background runtime · Provides lifecycle and browser API coordination.
entrypoints/background.ts - Popup mount
entrypoints/popup/main.tsx - Preferences UI · Controls visibility of injected buttons.
entrypoints/popup/App.tsx - Popup styles
entrypoints/popup/App.css
Localization
UI strings and browser-visible metadata use distinct systems.
- Application translations · Supplies strings for popup and injected controls.
i18n/index.ts - English UI locale
i18n/locales/en.ts - Manifest locale metadata · Localizes extension metadata for browser and store surfaces.
public/_locales/en/messages.json
Build and release
WXT and pnpm produce browser-specific extension packages.
- WXT configuration · Configures Chrome MV3 and Firefox MV2 builds.
wxt.config.ts - Package orchestration
package.json - Dependency lockfile
pnpm-lock.yaml - Release workflow · Builds Chrome and Firefox distributables from version tags.
.github/workflows/build-release.yml - Chrome and Firefox packages · Browser-specific extension distributables.
Other components
- GitHub repository pages · The DOM surface augmented by the extension.
- DeepWiki · Opened directly for the current repository.
- GitDiagram · Opened directly for the current repository.
Connections 19
- GitHub repository pages → Content script: loads on supported pages
- Content script → GitHub repository pages: injects localized controls
- Content script → DeepWiki: opens repository page
- Content script → GitDiagram: opens repository page
- Popup mount → Preferences UI: mounts
- Preferences UI → Popup styles: uses
- Preferences UI → Background runtime: persists preferences via browser APIs
- Background runtime → Content script: coordinates preferences
- Application translations → English UI locale: loads locale
- Application translations → Content script: localizes controls
- Application translations → Preferences UI: localizes UI
- WXT configuration → Content script: bundles
- WXT configuration → Background runtime: bundles
- WXT configuration → Popup mount: bundles
- WXT configuration → Manifest locale metadata: packages metadata
- Package orchestration → WXT configuration: defines tooling
- Dependency lockfile → Package orchestration: locks dependencies
- Release workflow → WXT configuration: runs builds
- Release workflow → Chrome and Firefox packages: publishes