Skip to content

making the UUID a first-class citizen - #90

Open
cromulus wants to merge 6 commits into
keith:mainfrom
cromulus:list_ids
Open

cromulus wants to merge 6 commits into
keith:mainfrom
cromulus:list_ids

Conversation

@cromulus

Copy link
Copy Markdown

every list and every reminder has a unique id.

This PR displays those values when --format json is used, and allows the ID to be an argument for the list and reminder.

we also return the unique ID and the list ID when a reminder is created.

@cromulus

Copy link
Copy Markdown
Author

Just wanted to bump this: using uuid as a first class citizen in the cli will help substantially with integrating this into other applications!

Thanks!

@cromulus

cromulus commented Jan 22, 2025

Copy link
Copy Markdown
Author

Another reason why having the UUID as a first class citizen: it means we can LINK TO A REMINDER

https://www.reddit.com/r/shortcuts/comments/bc5h9a/comment/l2nf9pd/

x-apple-reminderkit://REMCDReminder/{UUID is here}

FYI, the code builds and runs, and only adds a few json fields when --format json is added.

@wrobel

wrobel commented Jan 29, 2026

Copy link
Copy Markdown

I updated the path provided here to buildable state again. See #103

I do believe it would make a lot of sense to fully switch over to the UUID based approach on the CLI as the index based access is very brittle. For the "delete completed item" that I actually wanted to solve for myself the index based approach would be weird as you need to set context information ("Should the indexed list contain completed items or not?").

I would suggest to deprecate index based access to the items.

udondan added a commit to udondan/reminders-cli that referenced this pull request Sep 13, 2026
* feat: output unique list identifiers via show-lists

Adds calendarIdentifier alongside each list's title in 'show-lists' output (both plain and JSON), so lists can be referenced by a stable ID.

Cherry-picked from keith/reminders-cli#90, commit a4941436 ("now we are outputting unique ids for lists").

* feat: include list id in show-all JSON output

Adds listId (the reminder's list's calendarIdentifier) to the JSON encoding of each reminder.

Cherry-picked from keith/reminders-cli#90, commit 2b0cc0b7 ("showing list id in show-all").

* feat: accept a list id in place of a list name for add

addReminder's list argument now resolves either a list name or its calendarIdentifier.

Cherry-picked from keith/reminders-cli#90, commit 1f7ac31b ("can create reminders using uuids").

* feat: accept a reminder id in place of an index for complete/uncomplete/edit

setComplete and edit now resolve their reminder argument by numeric index or by calendarItemExternalIdentifier, and gain --format to print the updated reminder as JSON. Also removes a leftover debug print left in setComplete.

Cherry-picked from keith/reminders-cli#90, commit db382c90 ("now can complete with IDs").

* feat: finish threading list ids through show/add/edit/delete

Renames the remaining listName/index arguments to listNameOrId/indexOrId across Show, Add, Edit and Delete, dropping an unused duplicate add() method left over from an earlier merge.

No changes on top of this branch: the renames were already applied while resolving conflicts on the preceding cherry-picks, including preserving this fork's own existing fix for deleting completed reminders by external id, and the delete command's list argument now resolves by name or id via the same calendar(withNameOrId:) helper.

Cherry-picked from keith/reminders-cli#90, commit 9c05a672 ("adding ids to lists").

* chore: rebase the list-id patch (no changes needed in this fork)

Upstream, this commit rebases cromulus' list-id work onto a newer base of reminders-cli so it applies again. In this fork the equivalent state was already reached while adapting the earlier commits in this series, so there is nothing further to apply here; kept as an empty commit to credit the rebase.

Cherry-picked from keith/reminders-cli#103, commit 45e653fb ("updated patch: making the UUID a first-class citizen").

* chore: acknowledge the upstream fix for deleting completed items

Upstream, this commit adds --id/--index flags to delete so a completed reminder can be deleted by its external identifier. This fork already fixed the same underlying problem independently, with a smaller change that keeps the delete command's existing positional index-or-id argument and auto-detects whether it is numeric (index, scoped to incomplete items like show) or an external id (scoped to all items, completed included). That existing fix is kept as-is; this commit intentionally applies no changes and is kept empty to credit the upstream fix for the same issue.

Cherry-picked from keith/reminders-cli pull request 103 ("Allow to delete completed items").

* test: cover list/reminder id resolution and list id encoding

Extract the list-name-or-id matching logic out of Reminders.calendar(withNameOrId:)
into a free function, and expose getReminder(from:atIndexOrId:) internally, so both
can be exercised directly via @testable import without needing live access to
Reminders.app, following the precedent already set by matchesAdditionalFilters.

Add IdentifierTests.swift covering: EKCalendar/EKReminder JSON encoding of
calendarIdentifier/listId, list resolution by id/title with id taking precedence on
a collision, and reminder resolution by index vs. external id, including not-found
cases.

* docs: document list ids and per-command json format flags

Show that show-lists now prints each list's calendarIdentifier alongside its
title, that any list name argument also accepts an id, that complete/uncomplete/
edit support --format json, and how to delete an already-completed reminder by
its id.

---------

Co-authored-by: Bill Cromie <bill.cromie@gmail.com>
Co-authored-by: Gunnar Wrobel <post@gunnarwrobel.de>
udondan added a commit to udondan/reminders-cli that referenced this pull request Sep 13, 2026
…am (#7)

* feat: output unique list identifiers via show-lists

Adds calendarIdentifier alongside each list's title in 'show-lists' output (both plain and JSON), so lists can be referenced by a stable ID.

Cherry-picked from keith/reminders-cli#90, commit 1778d75c ("now we are outputting unique ids for lists").

* feat: include list id in show-all JSON output

Adds listId (the reminder's list's calendarIdentifier) to the JSON encoding of each reminder.

Cherry-picked from keith/reminders-cli#90, commit e1354ad6 ("showing list id in show-all").

* feat: accept a list id in place of a list name for add

addReminder's list argument now resolves either a list name or its calendarIdentifier.

Cherry-picked from keith/reminders-cli#90, commit cf72df2b ("can create reminders using uuids").

* feat: accept a reminder id in place of an index for complete/uncomplete/edit

setComplete and edit now resolve their reminder argument by numeric index or by calendarItemExternalIdentifier, and gain --format to print the updated reminder as JSON. Also removes a leftover debug print left in setComplete.

Cherry-picked from keith/reminders-cli#90, commit 2a87ecff ("now can complete with IDs").

* feat: finish threading list ids through show/add/edit/delete

Renames the remaining listName/index arguments to listNameOrId/indexOrId across Show, Add, Edit and Delete, dropping an unused duplicate add() method left over from an earlier merge.

No changes on top of this branch: the renames were already applied while resolving conflicts on the preceding cherry-picks, including preserving this fork's own existing fix for deleting completed reminders by external id, and the delete command's list argument now resolves by name or id via the same calendar(withNameOrId:) helper.

Cherry-picked from keith/reminders-cli#90, commit 806e773d ("adding ids to lists").

* chore: rebase the list-id patch (no changes needed in this fork)

Upstream, this commit rebases cromulus' list-id work onto a newer base of reminders-cli so it applies again. In this fork the equivalent state was already reached while adapting the earlier commits in this series, so there is nothing further to apply here; kept as an empty commit to credit the rebase.

Cherry-picked from keith/reminders-cli#103, commit 4c8bbb1f ("updated patch: making the UUID a first-class citizen").

* chore: acknowledge the upstream fix for deleting completed items

Upstream, this commit adds --id/--index flags to delete so a completed reminder can be deleted by its external identifier. This fork already fixed the same underlying problem independently, with a smaller change that keeps the delete command's existing positional index-or-id argument and auto-detects whether it is numeric (index, scoped to incomplete items like show) or an external id (scoped to all items, completed included). That existing fix is kept as-is; this commit intentionally applies no changes and is kept empty to credit the upstream fix for the same issue.

Cherry-picked from keith/reminders-cli pull request 103 ("Allow to delete completed items").

* test: cover list/reminder id resolution and list id encoding

Extract the list-name-or-id matching logic out of Reminders.calendar(withNameOrId:)
into a free function, and expose getReminder(from:atIndexOrId:) internally, so both
can be exercised directly via @testable import without needing live access to
Reminders.app, following the precedent already set by matchesAdditionalFilters.

Add IdentifierTests.swift covering: EKCalendar/EKReminder JSON encoding of
calendarIdentifier/listId, list resolution by id/title with id taking precedence on
a collision, and reminder resolution by index vs. external id, including not-found
cases.

* docs: document list ids and per-command json format flags

Show that show-lists now prints each list's calendarIdentifier alongside its
title, that any list name argument also accepts an id, that complete/uncomplete/
edit support --format json, and how to delete an already-completed reminder by
its id.

---------

Co-authored-by: Bill Cromie <bill.cromie@gmail.com>
Co-authored-by: Gunnar Wrobel <post@gunnarwrobel.de>
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.

3 participants