# Google Calendar Skill

Manage Google Calendar events. All times in PST (America/Los_Angeles).

## Scripts

```bash
cd skills/calendar

# List upcoming events (default: 7 days, 20 max)
npx tsx scripts/list.ts [--days 7] [--limit 20]

# Create an event
npx tsx scripts/create.ts --title "Meeting" --start "2026-02-25 10:00" --end "2026-02-25 11:00" [--description "..."] [--location "..."]

# Delete an event
npx tsx scripts/delete.ts <event_id>

# Create a busy block (shows as "busy" on calendar)
npx tsx scripts/block.ts --start "2026-02-25 10:00" --end "2026-02-25 14:00" [--title "Focus Time"]

# Today's schedule (compact view)
npx tsx scripts/today.ts
```

## Auth Setup

Uses Google Calendar API with OAuth 2.0. Shares credentials with the Gmail skill if you have calendar scopes enabled.

### Prerequisites

1. A Google Cloud project with the **Google Calendar API** enabled
2. OAuth 2.0 credentials (Desktop application type)
3. Download the OAuth client JSON and save it to `.credentials/gcp-oauth.keys.json`

### First-Time Authentication

```bash
# Generate the auth URL
npx tsx scripts/auth-manual.ts url

# Visit the URL in a browser, authorize, copy the redirect URL

# Exchange the code for tokens
npx tsx scripts/auth-manual.ts code "REDIRECT_URL"
```

Tokens are saved to `.credentials/gmail-tokens.json` (shared with Gmail skill). If you already have Gmail set up with calendar scopes, no additional auth is needed.

### Required OAuth Scopes

- `https://www.googleapis.com/auth/calendar` — full calendar access
- `https://www.googleapis.com/auth/calendar.events` — event management

## Notes

- All times are interpreted as PST (America/Los_Angeles) unless otherwise specified
- The `block.ts` script creates events with `transparency: "opaque"` so they show as busy
- `today.ts` gives a compact single-day view, ideal for morning briefings
- Event IDs for deletion can be found in the output of `list.ts`

## File Structure

```
skills/calendar/
  SKILL.md          # This file
  scripts/
    list.ts         # List upcoming events
    create.ts       # Create events
    delete.ts       # Delete events
    block.ts        # Block time (busy)
    today.ts        # Today's schedule
    auth-manual.ts  # OAuth flow
```
