feat(calendar): add calendar management tools#279
feat(calendar): add calendar management tools#279oskarcode wants to merge 4 commits intogemini-cli-extensions:mainfrom
Conversation
…RecurringEvent, setEventReminders)
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the calendar management capabilities by introducing new tools for creating calendars, managing recurring events with detailed recurrence rules, and customizing event reminders. It also streamlines the existing event creation and update processes by removing previously supported Google Meet and attachment features, focusing on core calendar functionalities. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces three new tools for Google Calendar management: createCalendar, createRecurringEvent, and setEventReminders. While the implementation of these new features is sound, the pull request also introduces significant breaking changes to the existing createEvent and updateEvent tools by removing support for Google Meet links and attachments. This constitutes a major feature regression. Furthermore, there's a regression in createEvent where it no longer sends notifications to attendees by default. I've added comments with high and critical severity to address these regressions, along with a medium-severity suggestion to refactor duplicated error-handling code for better maintainability.
| export interface CreateEventInput { | ||
| calendarId?: string; | ||
| summary: string; | ||
| description?: string; | ||
| start: { dateTime: string }; | ||
| end: { dateTime: string }; | ||
| attendees?: string[]; | ||
| } |
There was a problem hiding this comment.
This change removes sendUpdates, addGoogleMeet, and attachments from the CreateEventInput interface. This is a significant breaking change for the calendar.createEvent tool, as it removes the ability to add Google Meet links, attach files, and control notifications. This functionality seems to have been removed entirely, which is a major feature regression. A similar breaking change has been made to UpdateEventInput.
Was this removal intentional? If so, it should be clearly documented as a breaking change in the pull request description. If it was not intentional, these fields and their corresponding logic should be restored.
| const event = { | ||
| summary, | ||
| description, | ||
| start, | ||
| end, | ||
| attendees: attendees?.map((email) => ({ email })), | ||
| }; | ||
|
|
||
| const calendar = await this.getCalendar(); | ||
| const insertParams: calendar_v3.Params$Resource$Events$Insert = { | ||
| const res = await calendar.events.insert({ | ||
| calendarId: finalCalendarId, | ||
| requestBody: event, | ||
| sendUpdates: finalSendUpdates, | ||
| }; | ||
| this.applyMeetAndAttachments( | ||
| event, | ||
| insertParams, | ||
| addGoogleMeet, | ||
| attachments, | ||
| ); | ||
|
|
||
| const res = await calendar.events.insert(insertParams); | ||
| }); |
There was a problem hiding this comment.
The logic for sending notifications to attendees has been removed. By omitting the sendNotifications parameter in the calendar.events.insert call, it will default to false according to the Google Calendar API documentation. This prevents attendees from receiving email invitations for new events, which is a significant regression in functionality. The previous behavior of sending notifications by default when attendees are present should be restored.
| const event = { | |
| summary, | |
| description, | |
| start, | |
| end, | |
| attendees: attendees?.map((email) => ({ email })), | |
| }; | |
| const calendar = await this.getCalendar(); | |
| const insertParams: calendar_v3.Params$Resource$Events$Insert = { | |
| const res = await calendar.events.insert({ | |
| calendarId: finalCalendarId, | |
| requestBody: event, | |
| sendUpdates: finalSendUpdates, | |
| }; | |
| this.applyMeetAndAttachments( | |
| event, | |
| insertParams, | |
| addGoogleMeet, | |
| attachments, | |
| ); | |
| const res = await calendar.events.insert(insertParams); | |
| }); | |
| const event = { | |
| summary, | |
| description, | |
| start, | |
| end, | |
| attendees: attendees?.map((email) => ({ email })), | |
| }; | |
| const calendar = await this.getCalendar(); | |
| const res = await calendar.events.insert({ | |
| calendarId: finalCalendarId, | |
| requestBody: event, | |
| sendNotifications: attendees?.length ? 'all' : 'none', | |
| }); |
| } catch (error) { | ||
| const errorMessage = | ||
| error instanceof Error ? error.message : String(error); | ||
| logToFile(`Error during calendar.createRecurringEvent: ${errorMessage}`); | ||
| return { | ||
| content: [ | ||
| { | ||
| type: 'text' as const, | ||
| text: JSON.stringify({ error: errorMessage }), | ||
| }, | ||
| ], | ||
| }; | ||
| } |
There was a problem hiding this comment.
The error handling logic in this catch block is duplicated in the createCalendar and setEventReminders methods. To follow the DRY (Don't Repeat Yourself) principle and improve maintainability, this logic should be extracted into a shared private helper function.
For example, you could add a new private method like this:
private createApiErrorResponse(error: unknown, toolName: string) {
const errorMessage =
error instanceof Error ? error.message : String(error);
logToFile(`Error during ${toolName}: ${errorMessage}`);
return {
content: [
{
type: 'text' as const,
text: JSON.stringify({ error: errorMessage }),
},
],
};
}And then call it from the catch blocks, e.g., return this.createApiErrorResponse(error, 'calendar.createRecurringEvent');.
…pdateEvent - Add sendUpdates parameter to CreateRecurringEventInput interface - Add sendUpdates parameter to UpdateEventInput interface - Implement sendUpdates logic in createRecurringEvent method - Implement sendUpdates logic in updateEvent method - Default to 'all' when attendees present, 'none' when no attendees - Ensures attendees receive notifications for recurring events and updates Fixes critical issue where attendees were not notified of recurring events or event changes.
- Add getErrorMessage() helper method for consistent error message extraction - Replace 12 duplicate error handling patterns with helper method call - Addresses code review feedback about duplicate logic in PR gemini-cli-extensions#279 - Maintains existing error handling behavior with cleaner implementation
Summary
Adds three new Google Calendar tools for advanced calendar management.
New Tools
calendar.createCalendarCreates a new calendar.
summary,description(optional),timeZone(optional)calendar.createRecurringEventCreates a recurring event in a calendar with RRULE support.
calendarId(optional),summary,description(optional),start,end,attendees(optional),recurrence,reminders(optional)calendar.setEventRemindersSets custom reminders for an existing calendar event or resets to default reminders.
eventId,calendarId(optional),useDefault(optional),overrides(optional)Changes
createCalendar,createRecurringEvent,setEventRemindersmethods toCalendarService.tsindex.tsTesting
Tested locally with Google Calendar.