This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Chrome extension called "ChatGPT Bulk Delete" that allows users to bulk delete/archive conversations on ChatGPT pages. It's a Manifest V3 Chrome extension with no build process - the JavaScript files run directly in the browser.
- manifest.json: Chrome extension manifest (v3) defining permissions, content scripts, and popup
- popup.html/popup.js/popup.css: Extension popup UI with buttons for different operations
- background.js: Service worker for Chrome extension background tasks
- Content Scripts (injected into ChatGPT pages):
globals.js: Shared constants and selectors for ChatGPT UI elementsutils.js: Utility functions including analyticsaddCheckboxes.js: Adds checkboxes to conversation itemsbulkDeleteConversations.js: Handles bulk deletion logicbulkArchiveConversations.js: Handles bulk archiving (premium feature)toggleCheckboxes.js: Toggle all checkboxes on/offremoveCheckboxes.js: Removes all added checkboxes
- Content Script Injection: Scripts are injected into
chat.openai.comandchatgpt.compages - DOM Manipulation: Heavy use of DOM selectors to interact with ChatGPT's UI
- Event-Driven: Uses Chrome messaging API for popup ↔ content script communication
- Progressive Enhancement: Adds UI elements (checkboxes) to existing ChatGPT interface
- Premium Features: Bulk archive requires paid membership verification via external API
The extension relies on specific CSS selectors to interact with ChatGPT's UI:
HISTORY: History container with chat listCONVERSATION_SELECTOR: Individual conversation links (atags)TITLE_SELECTOR: Conversation title elementsINTERACTIVE_ELEMENT_SELECTOR: Hoverable/clickable elements
This extension has no build system - files are loaded directly. Changes to any .js, .html, or .css files require:
- Making changes to source files
- Reloading the extension in Chrome (
chrome://extensions/) - Testing on ChatGPT pages
- Load extension in Chrome developer mode
- Navigate to
https://chat.openai.comorhttps://chatgpt.com - Test functionality with actual ChatGPT conversations
- Monitor browser console for errors/logs
- Update
versioninmanifest.json - Package as
.zipfile for Chrome Web Store submission - No compilation or bundling required
scripting: To inject content scriptsactiveTab: To access current tab contentidentity,identity.email: For user authentication (premium features)- Host permission for
bulk-delete-chatgpt-worker.qcrao.com
- Uses mouse events (
mouseover,pointer down) to trigger ChatGPT's context menus - Waits for dynamic elements to appear/disappear using polling with timeouts
- Handles ChatGPT's dynamic UI updates and element recreation
- Local storage caching of membership status
- External API verification at bulk-delete-chatgpt-worker domain
- Payment flow integration for bulk archive feature
ChatGPT frequently updates their UI, breaking selectors in config.js. When functionality fails:
- Inspect ChatGPT page elements in browser dev tools
- Update selectors in
UI_CONFIG.SELECTORSinconfig.js - Test with extension reload
- config.js: Centralized configuration management (API URLs, selectors, constants)
- globals.js: Global state management with proper encapsulation
- utils.js: Common utilities (API calls, Chrome messaging, DOM helpers)
- domHandler.js: DOM manipulation and event handling utilities
- conversationHandler.js: Business logic for delete/archive operations
Scripts load in dependency order via manifest.json:
config.js- Configuration constantsglobals.js- Global stateutils.js- Utility functionsdomHandler.js- DOM helpersconversationHandler.js- Business logic- Operation-specific scripts (
addCheckboxes.js, etc.)
Scripts now load automatically in proper order via manifest.json. No manual dependency management needed.