LinkSyncServer: - Fix app.py imports, add CORS middleware, lifespan events - Create api/routes.py router aggregator - Create config/settings.py for centralized configuration - Rewrite models/base.py with proper relationships and serialization - Rewrite all API endpoints with real DB integration (auth, links, collections, sync, queries, tags) - Add admin endpoints (user management, stats, audit log) - Complete query parser with recursive descent and proper precedence - Complete query executor with set operations and field filters - Set up Alembic migrations with initial schema - Create web interface (templates, CSS, JS) - Add 42 passing tests (auth, links, collections, queries) - Add deploy.ps1 and deploy.sh scripts - Update README with deployment workflow LinkSyncExtension: - Create utils/api.js (REST client with retries, auth, error handling) - Create utils/sync.js (3 sync modes + conflict detection) - Create utils/collection.js (collection management) - Create utils/query-engine.js (client-side query parser) - Rewrite background.js (sync loop, bookmark events, message routing) - Rewrite popup.js (tabs, settings modal, notifications, CRUD) - Update popup.html (tabbed interface, query builder, modal) - Update popup.css (full redesign) - Create content/content.js (page metadata extraction) - Create options.html/js (dedicated settings page) - Generate icons (48x48, 96x96) - Update manifest.json (host permissions, content scripts, options) - Create AGENTS.md
6.1 KiB
6.1 KiB
LinkSyncExtension - Implementation Tasks
Phase 1: Project Setup
Setup Tasks
- Create project directory structure
- Write README.md
- Write TODOs.txt
- Write design.md
- Write tasks.md
- Write AGENTS.md
Initial Files
- Create manifest.json (v2, Firefox-compatible)
- Add icon files (48x48, 96x96)
- Create utils folder with all modules
- Create content folder for content script
Phase 2: Core Development
Background Script
- Create background.html
- Create background.js
- Implement init() on install/update
- Implement sync loop with interval (5 min)
- Add event handlers (message, install, bookmark changes)
- Implement sync mode switching
- Add collection mapping logic
- Implement auto-sync timer
- Add error handling and retries
Popup Script
- Create popup.html with tabbed interface
- Create popup.css with full responsive styling
- Create popup.js with all functionality
- Implement bookmark form UI with auto-fill
- Add bookmark list view with search
- Add collection panel
- Implement settings modal
- Add sync button handler
- Implement query builder tab
- Add toast notifications
Utility Modules
-
Create utils/api.js
- REST API client with Bearer token auth
- Retry logic (3 attempts with backoff)
- Timeout handling (10s)
- Rate limit handling (429)
- All endpoints: auth, links, collections, queries, sync, admin
-
Create utils/sync.js
- Bi-directional sync
- Browser-authoritative sync
- Server-authoritative sync
- Deletions handling
- Conflict detection
-
Create utils/collection.js
- List/create/update/delete collections
- Add/remove links from collections
- Execute queries
- Parse queries
-
Create utils/query-engine.js
- Tokenizer for query expressions
- Recursive descent parser
- AST generation (TERM, TERM_SET, FIELD, AND, OR, XOR)
- Query validation
- Query string builder
-
Create utils/bookmark.js
- Parse Firefox bookmark data
- Format bookmark for API
- Handle field validation
- Merge bookmarks for conflict resolution
- Duplicate detection
Content Script
- Create content/content.js
- Implement page title extraction
- Implement URL detection
- Implement meta description extraction
- Implement favicon extraction
- Handle browser.runtime.onMessage
Options Page
- Create options.html
- Create options.js
- Server URL configuration
- API key input
- Sync mode dropdown
- Deletions checkbox
- Auto-sync checkbox
- Test connection button
- Sync now button
Phase 3: Storage Management
Storage Implementation
- Use browser.storage.local for all settings
- Store API key securely
- Implement storage helper functions
- Add sync timestamp tracking
- Add pending changes counter
- Add syncing state flag
Storage Keys
linksync_server_url- Server base URLlinksync_api_key- JWT bearer tokenlinksync_sync_mode- Sync mode stringlinksync_deletions- Booleanlinksync_auto_sync- Booleanlinksync_last_sync- ISO timestamplinksync_syncing- Boolean flaglinksync_pending- Boolean flag
Phase 4: Sync Logic
Bi-directional Sync
- Push browser→server (new bookmarks)
- Push server→browser (new bookmarks)
- Handle deletions when enabled
Browser Authoritative Sync
- Push browser→server (create + update)
- Overwrite server data on conflict
- Delete server bookmarks not in browser
Server Authoritative Sync
- Download from server
- Overwrite local on conflict
- No push to server
Deletions
- Implement deletions checkbox logic
- Delete on both sides if enabled
Conflict Resolution
- Detect URL collision with different titles
- Conflict detection method available
Phase 5: UI Components
Bookmark Form
- URL input (auto-fill from active tab)
- Title input (auto-fill from active tab)
- Description textarea
- Notes textarea
- Tags input (comma-separated)
- Folder path input
- Add button
Bookmark List
- Display synced bookmarks
- Search filter input
- Tag display
Collections Panel
- Collection list display
- Collection type indicator
Query Builder
- Query expression input
- Parse button
- Execute button
- Result display
- Syntax help
Sync Status
- Last sync timestamp
- Sync indicator (syncing/synced/error)
- Manual sync trigger
Settings Modal
- Server URL input
- API Key input (show/hide toggle)
- Sync mode dropdown
- Deletions checkbox
- Auto-sync checkbox
- Test connection button
- Save button
Phase 6: Error Handling
API Errors
- Handle 401 (unauthorized)
- Handle 429 (rate limited) with retry
- Handle 500 (server error)
- Handle timeout
- Show user-friendly messages via notifications
Network Errors
- Offline detection (fetch errors)
- Retry with backoff (3 attempts)
- Request timeout (10s)
UI Errors
- Form validation (required fields)
- Input sanitization (escapeHtml)
- Error notifications
- Empty state messages
Phase 7: Testing
Manual Testing
- Testing checklist (tests/README.md)
- Test in Firefox (load temporary add-on)
- Test all sync modes
- Test conflict scenarios
- Test offline scenarios
Phase 8: Packaging
Distribution
- All files present and valid
- manifest.json verified
- Icons present (48x48, 96x96)
Phase 9: Documentation
- API reference (README.md)
- User guide (README.md)
- Troubleshooting guide (README.md)
- Query syntax reference (README.md)
- Architecture docs (AGENTS.md, design.md)
Future Enhancements
- Background sync notifications
- Keyboard shortcuts
- Dark theme toggle
- Bookmark edit/delete from popup
- Batch operations
- Conflict resolution UI
- Offline queue for pending changes
- Auto-sync scheduler customization
- Gesture controls
- Mobile companion app