Maintenance

From pipecat-ai/gradient-bang · View interactive version

Maintenance is an AI agent skill from the GitHub repository pipecat-ai/gradient-bang. Toggle the server-side login killswitch on a Supabase environment. Usage `/maintenance <env> <on|off>` (e.g. `/maintenance prod on`). Sets or unsets the `MAINTENANCE_MODE` secret on the login edge function, which short-circuits new logins with HTTP 503 when enabled. Existing sessions keep working.

How to use this skill

Skill file

Maintenance Mode

Toggle the MAINTENANCE_MODE secret on a Supabase project's edge functions. When enabled, the login edge function returns HTTP 503 before any rate-limiting or DB work, blocking all new sign-ins.

Parameters

/maintenance <env> <on|off> — both arguments required. If either is missing, ask.

Steps

1. Confirm intent for `prod on`

If the user is turning maintenance on for prod, briefly state what will happen (all new logins blocked) and ask the user to confirm before running the command. For prod off or any dev action, proceed without confirmation.

2. Source the env file and extract the project ref

The project ref is the subdomain of SUPABASE_URL in the env file:

set -a && source <env-file> && set +a
PROJECT_REF=$(echo "$SUPABASE_URL" | sed -E 's|https?://([^.]+)\..*|\1|')

3. Run the toggle

on:

npx supabase --workdir deployment secrets set MAINTENANCE_MODE=1 --project-ref "$PROJECT_REF"

off:

npx supabase --workdir deployment secrets unset MAINTENANCE_MODE --project-ref "$PROJECT_REF"

Secrets are read at runtime via Deno.env.get() in login/index.ts — no redeploy needed.

4. Verify

npx supabase --workdir deployment secrets list --project-ref "$PROJECT_REF" | grep MAINTENANCE_MODE

Report the final state to the user (on/off).

Optional message

If the user supplies a custom message (e.g. /maintenance prod on "back in 10 min"), also set:

npx supabase --workdir deployment secrets set MAINTENANCE_MESSAGE="<message>" --project-ref "$PROJECT_REF"

When turning off, also unset MAINTENANCE_MESSAGE only if it's currently set (unsetting a non-existent secret errors):

npx supabase --workdir deployment secrets list --project-ref "$PROJECT_REF" | grep -q MAINTENANCE_MESSAGE && npx supabase --workdir deployment secrets unset MAINTENANCE_MESSAGE --project-ref "$PROJECT_REF"

Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.