Commit graph

9 commits

Author SHA1 Message Date
Johannes Millan
33102f6a3e fix(sync-md): fix window focus immediate sync trigger
Store pendingMdToSpSync config in local variable before calling handleMdToSpSync
to prevent race conditions when window gains focus during debounce period.
2025-07-10 16:27:35 +02:00
Johannes Millan
d0e45524bf fix(syncMd): separate debounce timers for MD to SP and SP to MD sync
- Use separate mdToSpDebounceTimer and spToMdDebounceTimer variables
- Prevents SP changes from canceling the 10-second MD to SP debounce
- Add logging to differentiate between sync directions
- Clear timer state when sync completes

This fixes the issue where frequent SP changes were preventing
the 10-second debounce for markdown file changes from working.
2025-07-10 15:43:35 +02:00
Johannes Millan
c9a1ec2136 feat(syncMd): implement 10-second debounce for MD to SP sync with focus-aware triggering
- Add SYNC_DEBOUNCE_MS_MD_TO_SP constant (10 seconds)
- Always use 10-second debounce for markdown file changes
- Track pending MD to SP syncs
- Immediately trigger sync when window gains focus if pending
- Extract handleMdToSpSync for reusability

This prevents sync conflicts when editing markdown files outside SP
2025-07-10 15:24:40 +02:00
Johannes Millan
564e0f023b feat(syncMd): update build configuration and archive old implementation
- Update package.json with latest dependencies
- Configure build script for plugin packaging
- Archive old implementation in src/background/old/
- Remove obsolete test files and utilities
- Clean up unused replication approach
2025-07-10 14:57:08 +02:00
Johannes Millan
e4f83e3de8 feat(syncMd): add comprehensive test suite and development configuration
Tests:
- Markdown parser tests with edge cases and error handling
- Task operations generator tests for create/update/delete/reorder
- SP to markdown conversion tests with ordering validation
- Sync state verification tests
- Integration tests for full sync workflows
- File utilities tests

Configuration:
- Jest setup for plugin testing
- ESLint and Prettier configuration
- Test utilities and mocks
2025-07-10 14:56:19 +02:00
Johannes Millan
30a962c2a9 feat(syncMd): implement core markdown sync plugin with bidirectional synchronization
Core sync infrastructure:
- Markdown parser with task ID extraction and parent-child support
- SP to markdown converter with proper task ordering based on project taskIds
- Task operations generator for efficient batch updates
- Sync manager with file watching and intelligent debouncing
- Window focus-aware debouncing (15s when unfocused, 1s when focused)
- Post-sync verification to ensure consistency

Key features:
- Bidirectional sync between markdown files and Super Productivity
- Preserves task hierarchy and subtask ordering
- Handles duplicate ID detection and prevention
- Smart conflict resolution with detailed logging
- Efficient batch operations to minimize API calls

Plugin integration:
- Background script with proper initialization
- UI bridge for configuration management
- Plugin manifest and entry point
- Configuration UI for file path setup
2025-07-10 14:55:44 +02:00
Johannes Millan
88814795c7 feat(sync-md): new approach and make it work better 2025-07-07 18:39:14 +02:00
Johannes Millan
2548ad1b7a test: fix 2025-07-03 17:53:14 +02:00
Johannes Millan
d4d81bf511 feat(plugin-api): create foundational plugin API package
- Add @super-productivity/plugin-api package with TypeScript definitions
- Define core plugin interfaces, types, and manifest structure
- Add plugin hooks system for event-driven architecture
- Create plugin API type definitions and constants
- Add documentation and development guidelines
2025-06-27 18:13:19 +02:00