{"repo": "andreapianidev/safarai", "files": {"DEVELOPMENT.md": {"686f72b9973c252af88f8d640a7ef13901542c4a": {"t": 1785746397.55456, "n": 4927, "h": "7cda6834bc2af0ce", "c": "# SafarAI Development Guide\n\n## ๐Ÿ”‘ API Key Setup\n\n### For Development\n1. **Copy the environment template:**\n ```bash\n cp .env.example .env\n ```\n\n2. **Add your DeepSeek API key to `.env`:**\n ```bash\n DEEPSEEK_API_KEY=your-api-key-here\n ```\n\n3. **The API key is automatically loaded in development mode**\n\n### For Production\n- Users will be prompted to enter their own API key\n- Keys are stored securely in the browser's local storage\n- No hardcoded keys in production builds\n\n## ๐Ÿ› ๏ธ Development Setup\n\n### Prerequisites\n- Xcode 15+\n- macOS 13+ (Ventura)\n- DeepSeek API account\n\n### Quick Start\n1. **Clone and setup:**\n ```bash\n git clone https://github.com/your-repo/SafarAI.git\n cd SafarAI\n \n # Copy environment file\n cp .env.example .env\n # Edit .env with your API key\n ```\n\n2. **Open in Xcode:**\n ```bash\n open SafarAI.xcodeproj\n ```\n\n3. **Build and run** (โŒ˜+R)\n\n4. **Enable extension** in Safari > Preferences > Extensions\n\n## ๐Ÿ”ง Configuration\n\n### Environment Variables (.env)\n```bash\n# DeepSeek API\nDEEPSEEK_API_KEY=sk-your-key-here\nDEEPSEEK_API_URL=https://api.deepseek.com/v1/chat/completions\n\n# Development\nDEBUG_MODE=true\nLOG_LEVEL=info\n```\n\n### Build Configurations\n- **Debug**: Uses API key from .env, enables logging\n- **Release**: Requires user to enter API key, minimal logging\n\n## ๐Ÿงช Testing\n\n### Manual Testing Checklist\n- [ ] Extension loads in Safari\n- [ ] Sidebar opens/closes correctly\n- [ ] Content extraction works on various sites\n- [ ] API key input and storage functions\n- [ ] AI responses are relevant\n- [ ] Error handling works properly\n\n### Test Sites\nTry these different types of websites:\n- News articles (CNN, BBC)\n- Technical documentation (MDN, Apple Docs)\n- E-commerce sites (Amazon, Apple Store)\n- Blog posts (Medium, personal blogs)\n- Academic papers (arXiv, research sites)\n\n## ๐Ÿ› Debugging\n\n### Console Logs\n- **Background script**: Browser DevTools > Extensions > SafarAI > Background page\n- **Content script**: Browser DevTools > Console (on any webpage)\n- **Sidebar**: Right-click sidebar > Inspect\n\n### Common Issues\n\n#### Extension not appearing\n```bash\n# Check Safari preferences\nSafari > Preferences > Extensions > SafarAI\n\n# Verify extension is built correctly\n# Check Xcode build logs for errors\n```\n\n#### API calls failing\n```bash\n# Check API key format\necho $DEEPSEEK_API_KEY | grep \"^sk-\"\n\n# Test API manually\ncurl -X POST https://api.deepseek.com/v1/chat/completions \\\n -H \"Authorization: Bearer $DEEPSEEK_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"model\":\"deepseek-chat\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}]}'\n```\n\n#### Content extraction issues\n- Check browser console for JavaScript errors\n- Verify content script is injected properly\n- Test on different website structures\n\n## ๐Ÿ“ Project Structure\n\n```\nSafarAI/\nโ”œโ”€โ”€ ๐Ÿ“ฑ SafarAI/ # Main macOS app\nโ”‚ โ”œโ”€โ”€ AppDelegate.swift # App lifecycle\nโ”‚ โ”œโ”€โ”€ SafarAIAppView.swift # SwiftUI main view\nโ”‚ โ””โ”€โ”€ Assets.xcassets/ # Icons and assets\nโ”œโ”€โ”€ ๐Ÿ”Œ SafarAI Extension/ # Safari extension\nโ”‚ โ”œโ”€โ”€ SafariWebExtensionHandler.swift # Native bridge\nโ”‚ โ”œโ”€โ”€ Info.plist # Extension info\nโ”‚ โ””โ”€โ”€ Resources/ # Web extension files\nโ”‚ โ”œโ”€โ”€ manifest.json # Extension manifest\nโ”‚ โ”œโ”€โ”€ sidebar.html # Sidebar interface\nโ”‚ โ”œโ”€โ”€ sidebar.css # Styling\nโ”‚ โ”œโ”€โ”€ sidebar.js # Main logic\nโ”‚ โ”œโ”€โ”€ content.js # Page content extraction\nโ”‚ โ”œโ”€โ”€ background.js # Background tasks\nโ”‚ โ”œโ”€โ”€ config.template.js # Configuration template\nโ”‚ โ””โ”€โ”€ _locales/en/messages.json # Localization\nโ”œโ”€โ”€ .env # Environment variables (ignored)\nโ”œโ”€โ”€ .gitignore # Git ignore rules\nโ”œโ”€โ”€ README.md # Main documentation\nโ”œโ”€โ”€ DEVELOPMENT.md # This file\nโ””โ”€โ”€ BUILD_INSTRUCTIONS.md # Build and deployment guide\n```\n\n## ๐Ÿš€ Deployment\n\n### Development Build\n1. Build in Xcode (โŒ˜+B)\n2. Run to install extension (โŒ˜+R)\n3. Enable in Safari preferences\n\n### Release Build\n1. Archive in Xcode (Product > Archive)\n2. Export for distribution\n3. Sign with Developer ID or Mac App Store certificate\n\n## ๐Ÿ”’ Security Notes\n\n### API Key Handling\n- โœ… **Development**: Key in .env (not committed)\n- โœ… **Production**: User enters key (stored in browser storage)\n- โŒ **Never**: Hardcode keys in source code\n\n### Content Security\n- All API calls use HTTPS\n- Content scripts run in isolated contexts\n- Extension runs in Safari's sandbox\n\n### Privacy\n- No user data is sent to our servers\n- Only webpage content and user questions sent to DeepSeek\n- API keys stored locally only\n\n## ๐Ÿ“ Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Add your changes with tests\n4. Update documentation\n5. Submit a pull request\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines."}, "8d8f23420b87a37280913232466525ab7e216b80": {"t": 1785758791.9200583, "n": 4927, "h": "7cda6834bc2af0ce", "c": "# SafarAI Development Guide\n\n## ๐Ÿ”‘ API Key Setup\n\n### For Development\n1. **Copy the environment template:**\n ```bash\n cp .env.example .env\n ```\n\n2. **Add your DeepSeek API key to `.env`:**\n ```bash\n DEEPSEEK_API_KEY=your-api-key-here\n ```\n\n3. **The API key is automatically loaded in development mode**\n\n### For Production\n- Users will be prompted to enter their own API key\n- Keys are stored securely in the browser's local storage\n- No hardcoded keys in production builds\n\n## ๐Ÿ› ๏ธ Development Setup\n\n### Prerequisites\n- Xcode 15+\n- macOS 13+ (Ventura)\n- DeepSeek API account\n\n### Quick Start\n1. **Clone and setup:**\n ```bash\n git clone https://github.com/your-repo/SafarAI.git\n cd SafarAI\n \n # Copy environment file\n cp .env.example .env\n # Edit .env with your API key\n ```\n\n2. **Open in Xcode:**\n ```bash\n open SafarAI.xcodeproj\n ```\n\n3. **Build and run** (โŒ˜+R)\n\n4. **Enable extension** in Safari > Preferences > Extensions\n\n## ๐Ÿ”ง Configuration\n\n### Environment Variables (.env)\n```bash\n# DeepSeek API\nDEEPSEEK_API_KEY=sk-your-key-here\nDEEPSEEK_API_URL=https://api.deepseek.com/v1/chat/completions\n\n# Development\nDEBUG_MODE=true\nLOG_LEVEL=info\n```\n\n### Build Configurations\n- **Debug**: Uses API key from .env, enables logging\n- **Release**: Requires user to enter API key, minimal logging\n\n## ๐Ÿงช Testing\n\n### Manual Testing Checklist\n- [ ] Extension loads in Safari\n- [ ] Sidebar opens/closes correctly\n- [ ] Content extraction works on various sites\n- [ ] API key input and storage functions\n- [ ] AI responses are relevant\n- [ ] Error handling works properly\n\n### Test Sites\nTry these different types of websites:\n- News articles (CNN, BBC)\n- Technical documentation (MDN, Apple Docs)\n- E-commerce sites (Amazon, Apple Store)\n- Blog posts (Medium, personal blogs)\n- Academic papers (arXiv, research sites)\n\n## ๐Ÿ› Debugging\n\n### Console Logs\n- **Background script**: Browser DevTools > Extensions > SafarAI > Background page\n- **Content script**: Browser DevTools > Console (on any webpage)\n- **Sidebar**: Right-click sidebar > Inspect\n\n### Common Issues\n\n#### Extension not appearing\n```bash\n# Check Safari preferences\nSafari > Preferences > Extensions > SafarAI\n\n# Verify extension is built correctly\n# Check Xcode build logs for errors\n```\n\n#### API calls failing\n```bash\n# Check API key format\necho $DEEPSEEK_API_KEY | grep \"^sk-\"\n\n# Test API manually\ncurl -X POST https://api.deepseek.com/v1/chat/completions \\\n -H \"Authorization: Bearer $DEEPSEEK_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"model\":\"deepseek-chat\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}]}'\n```\n\n#### Content extraction issues\n- Check browser console for JavaScript errors\n- Verify content script is injected properly\n- Test on different website structures\n\n## ๐Ÿ“ Project Structure\n\n```\nSafarAI/\nโ”œโ”€โ”€ ๐Ÿ“ฑ SafarAI/ # Main macOS app\nโ”‚ โ”œโ”€โ”€ AppDelegate.swift # App lifecycle\nโ”‚ โ”œโ”€โ”€ SafarAIAppView.swift # SwiftUI main view\nโ”‚ โ””โ”€โ”€ Assets.xcassets/ # Icons and assets\nโ”œโ”€โ”€ ๐Ÿ”Œ SafarAI Extension/ # Safari extension\nโ”‚ โ”œโ”€โ”€ SafariWebExtensionHandler.swift # Native bridge\nโ”‚ โ”œโ”€โ”€ Info.plist # Extension info\nโ”‚ โ””โ”€โ”€ Resources/ # Web extension files\nโ”‚ โ”œโ”€โ”€ manifest.json # Extension manifest\nโ”‚ โ”œโ”€โ”€ sidebar.html # Sidebar interface\nโ”‚ โ”œโ”€โ”€ sidebar.css # Styling\nโ”‚ โ”œโ”€โ”€ sidebar.js # Main logic\nโ”‚ โ”œโ”€โ”€ content.js # Page content extraction\nโ”‚ โ”œโ”€โ”€ background.js # Background tasks\nโ”‚ โ”œโ”€โ”€ config.template.js # Configuration template\nโ”‚ โ””โ”€โ”€ _locales/en/messages.json # Localization\nโ”œโ”€โ”€ .env # Environment variables (ignored)\nโ”œโ”€โ”€ .gitignore # Git ignore rules\nโ”œโ”€โ”€ README.md # Main documentation\nโ”œโ”€โ”€ DEVELOPMENT.md # This file\nโ””โ”€โ”€ BUILD_INSTRUCTIONS.md # Build and deployment guide\n```\n\n## ๐Ÿš€ Deployment\n\n### Development Build\n1. Build in Xcode (โŒ˜+B)\n2. Run to install extension (โŒ˜+R)\n3. Enable in Safari preferences\n\n### Release Build\n1. Archive in Xcode (Product > Archive)\n2. Export for distribution\n3. Sign with Developer ID or Mac App Store certificate\n\n## ๐Ÿ”’ Security Notes\n\n### API Key Handling\n- โœ… **Development**: Key in .env (not committed)\n- โœ… **Production**: User enters key (stored in browser storage)\n- โŒ **Never**: Hardcode keys in source code\n\n### Content Security\n- All API calls use HTTPS\n- Content scripts run in isolated contexts\n- Extension runs in Safari's sandbox\n\n### Privacy\n- No user data is sent to our servers\n- Only webpage content and user questions sent to DeepSeek\n- API keys stored locally only\n\n## ๐Ÿ“ Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Add your changes with tests\n4. Update documentation\n5. Submit a pull request\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines."}}}}