feat(cli): add unified calendar API commands#31
Draft
sahitya-chandra wants to merge 2 commits intomainfrom
Draft
feat(cli): add unified calendar API commands#31sahitya-chandra wants to merge 2 commits intomainfrom
sahitya-chandra wants to merge 2 commits intomainfrom
Conversation
Add new 'unified-cal' command group to the companion CLI that exposes the unified calendar API endpoints for full CRUD operations on connected calendar events. Commands added: - calcom unified-cal connections — list calendar connections - calcom unified-cal events list — list events for a connection - calcom unified-cal events get — get a single event - calcom unified-cal events create — create a new event - calcom unified-cal events update — update an existing event - calcom unified-cal events delete — delete/cancel an event - calcom unified-cal freebusy — get free/busy times Uses the existing 'calcom login' auth infrastructure (API key or OAuth). All commands support --json output.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/cli/src/commands/unified-cal/command.ts">
<violation number="1" location="packages/cli/src/commands/unified-cal/command.ts:140">
P2: Guard against empty updates so the CLI doesn’t send a PATCH with an empty body. Validate at least one updatable field before calling the API.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(cli): add unified calendar API commands
Summary
Adds a new
unified-calcommand group to the companion CLI that exposes the unified calendar API endpoints for full CRUD operations on connected calendar events. This uses the existingcalcom loginauth infrastructure (API key or OAuth) — no new auth flow is needed.Commands added:
calcom unified-cal connections— list calendar connectionscalcom unified-cal events list— list events for a connection (requires--connection-id,--from,--to)calcom unified-cal events get— get a single event by IDcalcom unified-cal events create— create a new event (title, start, end, optional description/location/attendees)calcom unified-cal events update— update an existing eventcalcom unified-cal events delete— delete/cancel an eventcalcom unified-cal freebusy— get free/busy times for a connectionAll commands support
--jsonfor machine-readable output. Follows the existing command pattern (commander subcommands,withErrorHandling, shared output helpers).Files added:
packages/cli/src/commands/unified-cal/command.ts— command definitions and API callspackages/cli/src/commands/unified-cal/output.ts— rendering/display functionspackages/cli/src/commands/unified-cal/types.ts— TypeScript interfaces for API responsespackages/cli/src/commands/unified-cal/index.ts— barrel exportFiles modified:
packages/cli/src/index.ts— registers the newunified-calcommandUpdates since last revision
events updatecommand — now throws a descriptive error if no updatable fields are provided instead of sending an empty PATCH request (identified by cubic).Review & Testing Checklist for Human
/v2/calendars/connections/...endpoints from cal.com PR #28297. Those endpoints must be merged and deployed before any of these commands will work. Verify the backend is available before testing.types.tsinterfaces are manually written to match the expected API shape (especiallyCalendarEventfields liketitle,isAllDay,organizer,attendees). If the actual API response uses different field names or structure, commands will silently render empty/incorrect data. Cross-checktypes.tsagainst the real API output once available.response.data as CalendarEvent[]casts incommand.ts— if theapiRequestresponse wrapper nests data differently than assumed, these will fail at runtime without a compile-time error.apiRequest: The delete command uses rawfetch()becauseapiRequestcallsresponse.json()which fails on 204 No Content. This duplicates auth header logic (command.ts:236-260). Verify token handling matches whatapiRequestdoes.calcom login, then:calcom unified-cal connections— verify it lists connected calendarscalcom unified-cal events list --connection-id <id> --from 2026-03-01 --to 2026-03-31— verify events are returnedcalcom unified-cal events create --connection-id <id> --title "Test" --start 2026-03-20T14:00:00 --end 2026-03-20T15:00:00— verify event is createdcalcom unified-cal events update --connection-id <id> --event-id <id> --title "Updated"— verify update workscalcom unified-cal events update --connection-id <id> --event-id <id>(no fields) — verify it rejects with errorcalcom unified-cal events delete --connection-id <id> --event-id <id>— verify deletioncalcom unified-cal freebusy --connection-id <id> --from 2026-03-01 --to 2026-03-31— verify busy timesNotes
biome lint) and typecheck (tsc --noEmit) both pass clean.commander,chalk, and the sharedapiRequest/configutilities.Cal Unified Calendarstag — once the backend API spec is updated in the OpenAPI JSON, these hand-written types should ideally be replaced with generated SDK types for better type safety.