readme

Archived: AI ceremony script generation (Astro)

Salvaged from apps/adventure-weddings/ before that app was deleted on 2026-08-07. This is reference material, not wired to anything. Nothing imports it.

Why the app was deleted

apps/adventure-weddings/ was an Astro site that had been superseded by the Lovable React site at ~/Projects/adventure-weddings (repo veganpolice/adventure-weddings), which is what actually serves adventureweddings.love. The Astro app was still deploying, but only to adventure-weddings.pages.dev, and its Supabase project (piyugutiwimbsfkvfnpc) had already been deleted — the hostname NXDOMAINs. So the app was live-but-orphaned with no working backend.

Two codebases sharing the name “adventure weddings” also caused repeated tooling confusion: PR numbers, gh targets, and content paths resolved against whichever repo a session started in.

Why this part was kept

Everything else in the app was static: 365 of its 509 admin pages were the generated social-media content planner, and only 3 pages touched Supabase at all. This ceremony generator was the one piece with real logic, and it was the newest code in the app — merged 2026-07-03 as PR #6 (651c339), followed by 9f0c969 which fixed the tslib bundling that had been 500ing every SSR route.

What’s here

PathWas
api/generate.tssrc/pages/api/ceremony/generate.ts — questionnaire → Claude → draft
api/drafts.tssrc/pages/api/ceremony/drafts.ts — save/list/PATCH draft status
api/responses.tssrc/pages/api/ceremony/responses.ts — questionnaire responses
lib/ceremony-prompt.tssrc/lib/ceremony-prompt.ts — prompt construction
admin/ceremony.astro, admin/ceremony-library.astro, admin/ceremony-pages/[id].astrothe admin UI
supabase/001_initial_schema.sqlthe schema, including ceremony_drafts

Known defects, if this is ever revived

A code review on 2026-08-07 found these. They were never hit in production because the database was already gone.

  1. Truncated drafts saved as complete (api/generate.ts). Only stop_reason === 'refusal' is handled. A max_tokens cut-off yields a non-empty fragment that passes the empty-draft guard and is stored as a normal status: 'draft' version, indistinguishable from a finished one. Check stop_reason === 'max_tokens' and fail loudly.
  2. Version collisions poison PATCH. ceremony_drafts has no unique constraint on (client_id, version), and two write paths both do read-max-then-insert. Two rows at version N make the .single() in the PATCH path error, so every later status change on that version 404s permanently with no UI recovery. Add unique (client_id, version).
  3. All DB errors reported as 404 (api/drafts.ts) — connection and permission failures are collapsed into “Draft version not found”.
  4. max_tokens: 16000 is a hard cap covering thinking plus output on claude-sonnet-5. Verify current thinking-default behaviour against the API docs before reusing these numbers.

If reviving this against the live Lovable Supabase (blksxqiqivuwfvwjzpmi), it needs new schema, auth, and UI work regardless — the Astro/service-role model here does not carry over.