Skip to content

Add per-calendar sync mode for one-way sync#35

Open
MicaelJarniac wants to merge 1 commit intobobuk:mainfrom
MicaelJarniac:feature/one-way-sync
Open

Add per-calendar sync mode for one-way sync#35
MicaelJarniac wants to merge 1 commit intobobuk:mainfrom
MicaelJarniac:feature/one-way-sync

Conversation

@MicaelJarniac
Copy link

@MicaelJarniac MicaelJarniac commented Feb 12, 2026

Summary

  • Closes Feature request: one-way sync option (read-only source calendars) #34
  • Adds a mode field per calendar (read, write, or both) to control sync direction
  • read mode: events are sourced from this calendar but no blocker events are written to it
  • write mode: blocker events are written here but its events are not read/synced to others
  • both mode (default): preserves existing bidirectional behavior — fully backward compatible

Changes

  • dbinit.go: Migration v4→v5 adds mode TEXT DEFAULT 'both' column to calendars table
  • add.go: Prompts for sync mode when adding a calendar (defaults to both)
  • sync.go: Introduces CalendarEntry struct; getCalendarsFromDB returns mode info; syncCalendar skips reading from write-only calendars and skips writing to read-only calendars
  • list.go: Shows mode and blocker event count for all calendars (including those with 0 blockers)
  • cleanup.go: Updated for new getCalendarsFromDB return type
  • README.md: Documents sync modes with a table and usage examples
  • CLAUDE.md: Updated architecture docs to reflect new schema and sync flow

Test plan

  • Build with go build and verify no compile errors
  • Run ./gcalsync add — verify mode prompt appears and defaults to both
  • Run ./gcalsync add with read mode — verify events from that calendar create blockers elsewhere but no blockers are written to it
  • Run ./gcalsync add with write mode — verify blockers are written to it but its events are not synced
  • Run ./gcalsync list — verify mode column is displayed
  • Verify existing databases migrate cleanly (mode defaults to both)
  • Run ./gcalsync cleanup and ./gcalsync desync — verify they still work

🤖 Generated with Claude Code

Support controlling sync direction per calendar: "read" calendars
only source events (no blockers written to them), "write" calendars
only receive blockers (their events aren't read), and "both" preserves
the existing bidirectional behavior (default for backward compat).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: one-way sync option (read-only source calendars)

1 participant