How yesinkim/schedule-ninja works
Main Components
• Browser Host (Google Chrome)
• Extension contexts: Content Script, Background Service Worker, Popup UI
• On-Device AI Module
• Gemini Nano (local model)
• External AI APIs (Prompt, Summarizer, Proofreader, Translator [planned])
• Google Calendar API
• UI Assets & Localization
• _locales messages
Relationships & Data Flows
a. User Action → Content Script
• “Drag” or “right-click” selection
• Content Script (content.js) observes DOM, captures context, injects inline modal
b. Content Script ↔ Background Worker
• chrome.runtime.sendMessage: send structured context
• Background Service Worker (background.js) receives, orchestrates AI calls
c. Background Worker → On-Device AI & External APIs
• First route: Gemini Nano for core parsing
• Fallback/secondary: Prompt API → Summarizer API → Proofreader API
d. Background Worker → Popup UI
• Pre-filled event draft pushed to popup.html/popup.js
e. User Confirmation in Popup → Background Worker → Google Calendar API
• Final event creation
f. Activity Log (in‐extension storage)
• Recent actions stored locally and displayed in Popup
Architectural Patterns
• MV3 Extension Pattern (manifest.json defines entry points, permissions)
• Event-driven, message-passing between contexts
• Separation of concerns:
• content.js for page interactions
• background.js for orchestration & external calls
• popup.js for user review
• Privacy-first: on-device inference (Gemini Nano) before external calls
Incorporate Technologies & Configurations
• manifest.json (MV3 config, permissions: storage, contextMenus, identity, scripting)
• content.js: DOM observation, inline modal injection
• background.js: chrome.alarms, chrome.identity, fetch to Google Calendar
• popup.html/css/modal.css/popup.js: React-like or vanilla JS UI
• _locales for i18n
• secrets.example.js (placeholder for API keys)
Putting It All Together
• Top-layer: Chrome Browser
• Middle-layer: On-Device AI Module (Gemini Nano)
• Side-layer: External AI Services (Prompt, Summarizer, Proofreader)
• Bottom-layer: Google Calendar API
• Storage: Local extension storage (activity log) attached to Background & Popup