feat: expose Reminders sections in output#25
Conversation
Read section names from the Reminders CoreData SQLite store and surface them on ReminderItem as an optional sectionName field. Sections appear in standard output as [List/Section], in plain output as an extra column, and in JSON output as a top-level key. Implementation approach: - Add SectionResolver that opens the Reminders SQLite database read-only and joins three tables (ZREMCDBASESECTION, ZREMCDREMINDER, ZREMCDBASELIST) to build an EventKit ID → section-name map. Degrades gracefully to an empty map when the database is unavailable. - Add sectionName: String? to ReminderItem. - Link sqlite3 in Package.swift. - Refactor EventKitStore to use a shared item(from:) helper, eliminating four duplicate ReminderItem construction sites. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thanks for putting this together, @maciej. The read‑only approach and graceful fallback are solid. A few suggestions, mostly nits: findDatabase() returns the first readable .sqlite, but there can be multiple Data-.sqlite files. It would be more reliable to choose the most recently modified Data-.sqlite (or follow whatever store pointer exists), otherwise you can end up reading a stale store and missing/incorrect section mappings. CK identifiers can be null/empty depending on sync state. Guarding against null CK IDs would avoid accidental empty map entries. Section ordering isn’t accounted for (ZSECTIONIDSORDERINGASDATA). If the goal is only to annotate reminders with section names, that’s fine, but it might be worth calling out in docs or leaving room to incorporate ordering later. Consider sqlite busy timeout or read-only options that handle WAL/lock contention a bit more gracefully. Not critical, but reduces intermittent failures. Happy to help iterate if you want a quick follow‑up patch. Some of these nits are unique to how I use Reminders.app. I use the Columns view, and have Kanban-style sections, such that ordering and frequent section changes and CloudKit syncs are relevant use cases. |
Summary
Closes #14.
sectionNameas an optional field onReminderItem— appears in JSON, plain, and standard output formats (e.g.[Books/Non-fiction]).EventKitStoreto use a shareditem(from:)helper, removing four duplicateReminderItemconstruction sites.Details
SectionResolveropens the Reminders SQLite database read-only and joins three tables (ZREMCDBASESECTION,ZREMCDREMINDER,ZREMCDBASELIST) to build an EventKit calendarItemIdentifier → section display name map. It degrades gracefully to an empty map when the database is unavailable or unreadable.🤖 Generated with Claude Code