How rohit-wadhwa/git-repo-tools works
Project type and purpose
• This is a browser extension (Chrome) that enhances GitHub repository pages by injecting quick-access buttons (“DeepWiki”, “GitDiagram”, “IDE”) and providing a popup settings UI.
• It consists of content scripts (in-page logic), a background script (persistent event handlers), a popup UI for settings, a manifest for permissions/config, and integrations with external web services.
File structure
• Top-level files:
• background.js – background script handling events and message routing
• content.js – content script injected into GitHub pages to modify the DOM and add buttons
• popup.html & popup.js – UI and logic for the browser-action popup (settings panel)
• docs & metadata: README.md, CONTRIBUTING.md, LICENSE.md, SECURITY.md, STORE.md, CHANGELOG.md
• No backend server or database – storage is via Chrome’s extension storage API (chrome.storage.local)
README for additional insights
• Confirms three main features: injecting buttons, opening external services, and configurable toggles
• Specifies settings are auto-saved, indicating use of Chrome storage APIs
• No server components – purely client-side + external web services
Main components and their relationships
a. Components
• Manifest (config/permissions)
• Content Script (runs on GitHub URLs; reads settings; injects buttons; handles button clicks by opening new tabs)
• Popup UI (settings interface; writes to chrome.storage; sends messages to content script/background)
• Chrome Storage (chrome.storage.local or sync)
• External Services: DeepWiki, GitDiagram, various WebIDE URLs
b. Relationships & data flow
1. On installation or browser load: manifest registers background.js and content.js for matching URLs.
2. User navigates to github.com/* – content.js runs, reads settings from chrome.storage, then injects the appropriate buttons into the page DOM.
3. Button click in page → content.js opens target service in new tab with constructed URL.
5. User changes a toggle in popup → popup.js updates chrome.storage and optionally sends a message to content.js to refresh injected UI.
6. background.js listens for runtime messages if needed (e.g., to coordinate settings changes across tabs).
c. Architectural patterns & principles
• Separation of concerns:
• Content scripts modify page UI, but do not handle persistent state
• Background script acts as a central event/message dispatcher
• Popup UI solely for user configuration
• Event-driven & message-passing using Chrome extension APIs
• Declarative configuration via manifest.json
d. Key technologies
• Chrome Extension APIs: chrome.runtime, chrome.storage, chrome.tabs
• Vanilla JavaScript, HTML/CSS (no framework)
• External REST-style services (DeepWiki, GitDiagram) and URL-based WebIDE endpoints
Elements
• Extension contexts (rectangles)
• Annotation for URL match patterns from manifest.json for when content scripts load