# plugin-agenda

`@fayz-ai/plugin-agenda` · beta · Partial capability

Every service business runs on a calendar. Salons book stylists, clinics book doctors, studios book rooms — the same primitive, rebuilt badly a thousand times. plugin-agenda is that primitive done once: a resource-aware calendar with appointments, blocks, working hours, conflict detection, and drag-and-drop, all driven by config instead of forks.

## Overview

The calendar as a primitive: appointments, blocks, working hours, conflict detection and drag-and-drop, all driven by config. The plugin mounts the `/agenda` page.

It packages four migrations that back **public booking** and the `v_bookings` bridge view (view rename and compatibility, plus phone dedupe). The Supabase provider reads and writes shared tables (`bookings`, `schedules`, `locations`) and `v_bookings`, with automatic fallback to a mock provider (a sample salon schedule the app can seed). Config is rich: locations, booking windows, concurrency and service selection via lookup.

It ships an official Google Calendar addon (`createGoogleCalendarPlugin`) and a finance bridge (`createFinancialBridge`) that computes commission when an appointment is completed. For AI, it exposes `listAppointments`, `createAppointment` and `checkAvailability`. Status **beta / partial capability**.

## When to use it

- Any business built around a schedule: salons, clinics, studios.
- You need conflict detection and a per-resource or per-professional view.
- You want to sync with Google Calendar or generate commission from an appointment.

## Specs

- **Package:** `@fayz-ai/plugin-agenda`
- **Version:** 0.3.0
- **Status:** beta
- **Capability:** Partial capability
- **Product type:** Scheduling
- **Stable channel:** `^0.4.0`
- **Migrations:** 4 migration(s)
- **Factory:** `createAgendaPlugin()`

## Data model

No tables of its own — this plugin uses the core / archetype library (same rule: tenant_id + RLS)..

## AI tools

| id | mode | description |
| --- | --- | --- |
| `agenda.list-appointments` | read | Lists upcoming appointments for a given date or date range, optionally filtered by professional. |
| `agenda.create-appointment` | persist | Creates a new appointment. Takes IDS, not names: resolve the client/service/professional ids first via findAnything/searchRecords, then call this with an ISO start time in the tenant timezone. The user confirms before booking. |
| `agenda.check-availability` | read | Checks available time slots for a professional on a given date. |

## Integrations

Hosted connector(s): `google-calendar`

## Integrate

Add the plugin to surfaces.admin.plugins in your app's app.manifest.json and run the doctor to validate:

```json
{ "surfaces": { "admin": { "plugins": [ { "id": "agenda", "enabled": true } ] } } }
```

```bash
npx fayz doctor
```
