1 line
11 KiB
JSON
1 line
11 KiB
JSON
{"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."}}}} |