Thank you for your interest in contributing to AI Chat Exporter! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Workflow
- Coding Standards
- Adding New Scrapers
- Testing
- Submitting Changes
- Be respectful and inclusive
- Provide constructive feedback
- Focus on what is best for the community
- Show empathy towards other community members
- Node.js >= 16.0.0
- npm >= 8.0.0
- Git
- A Chromium-based browser (Chrome, Edge, Brave, etc.) or Firefox
# Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/ai-chat-exporter.git
cd ai-chat-exporter
# Install dependencies
npm install
# Load extension in browser
# Chrome: Navigate to chrome://extensions/, enable Developer Mode, click "Load unpacked"
# Firefox: Navigate to about:debugging, click "Load Temporary Add-on"src/
├── popup/ # Extension popup UI
├── content/ # Content scripts (message handlers)
├── scrapers/ # Platform-specific scrapers
├── utils/ # Shared utilities
└── lib/ # Third-party libraries
-
Create a new branch for your feature/fix:
git checkout -b feature/your-feature-name
-
Make your changes following our coding standards
-
Test your changes thoroughly
-
Commit with a descriptive message:
git commit -m "feat: add support for Platform X"
We follow the Conventional Commits specification:
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringtest:- Adding or updating testschore:- Maintenance tasks
- Use ES6+ features
- Use
constandlet, nevervar - Use arrow functions when appropriate
- Add JSDoc comments for functions
- Follow the DRY (Don't Repeat Yourself) principle
- Keep functions small and focused
/**
* Extract messages from chat container
* @param {Element} container - The chat container element
* @returns {Array<Object>} Array of message objects
*/
function extractMessages(container) {
const messages = [];
// Implementation
return messages;
}- Shared utilities →
src/utils/utils.js - Platform scrapers →
src/scrapers/platform-name-scraper.js - Content scripts →
src/content/ - UI components →
src/popup/
- Files: kebab-case (
gemini-scraper.js) - Functions: camelCase (
extractMessages) - Constants: UPPER_SNAKE_CASE (
MAX_RETRIES) - Classes: PascalCase (
MessageExtractor)
To add support for a new AI platform:
Create src/scrapers/platform-name-scraper.js:
/**
* Platform Name Scraper
* Specialized scraper for Platform Name
*/
async function scrapePlatformName() {
try {
console.log("[PlatformName-Scraper] Starting scrape");
// Wait for main container
const container = await waitForElement(".chat-container");
// Extract messages
const messages = extractMessages(container);
return {
success: true,
messages,
count: messages.length,
timestamp: new Date().toISOString(),
url: location.href,
platform: "Platform Name",
};
} catch (error) {
console.error("[PlatformName-Scraper] Error:", error);
return {
success: false,
error: error.message,
timestamp: new Date().toISOString(),
url: location.href,
};
}
}
// Export globally
if (typeof window !== 'undefined') {
window.scrapePlatformName = scrapePlatformName;
}Add platform detection in src/scrapers/scraper-router.js:
const PLATFORM_CONFIG = {
// ... existing platforms
PLATFORM_NAME: {
pattern: /^https:\/\/platform\.com\/chat\//,
scraper: 'platform-name',
name: 'Platform Name',
},
};Add scraper function mapping:
function getScraperFunction() {
const platform = detectPlatform();
switch (platform.scraper) {
// ... existing cases
case 'platform-name':
if (typeof scrapePlatformName !== 'undefined') {
return scrapePlatformName;
}
return scrapeGeneric;
}
}Add your scraper to manifest.json:
{
"content_scripts": [{
"js": [
"src/lib/browser-polyfill.js",
"src/utils/utils.js",
"src/scrapers/platform-name-scraper.js",
"src/scrapers/scraper-router.js",
// ... other scripts
]
}]
}Create documentation in docs/PLATFORM_NAME_SCRAPER_GUIDE.md explaining:
- How the scraper works
- Platform-specific challenges
- Selectors used
- Known limitations
- Extension loads without errors
- Platform detection works correctly
- Messages are extracted completely
- Images/media are captured
- JSON export works
- Markdown export works
- PDF export works
- Works across different browsers (Chrome, Firefox, Edge)
- Navigate to the target platform
- Open browser DevTools → Console
- Click the extension icon
- Click "Export Current Page"
- Verify:
- All messages extracted
- Media captured correctly
- No console errors
- Export formats work
- Update the README.md with details of changes if needed
- Update documentation in
docs/if needed - Ensure all tests pass
- Update the version number in
package.jsonandmanifest.json(following SemVer)
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Tested in Chrome
- [ ] Tested in Firefox
- [ ] Tested in Edge
## Screenshots (if applicable)
Add screenshots here
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-reviewed code
- [ ] Commented complex code
- [ ] Updated documentation
- [ ] No new warnings- Check existing Issues
- Read the Documentation
- Ask in Discussions
Thank you for contributing to AI Chat Exporter!