Skip to content

Watchdog: Sanity backbone (draft / RFC for the Sanity-as-dep decision) - #35

Draft
ylevtov wants to merge 1 commit into
UFO-101:mainfrom
ylevtov:watchdog-integration
Draft

Watchdog: Sanity backbone (draft / RFC for the Sanity-as-dep decision)#35
ylevtov wants to merge 1 commit into
UFO-101:mainfrom
ylevtov:watchdog-integration

Conversation

@ylevtov

@ylevtov ylevtov commented Jun 9, 2026

Copy link
Copy Markdown

Summary

Foundation for merging the standalone PauseAI Watchdog (live at https://ai-integrity-watch.vercel.app) into pauseai.uk. This commit is the architectural foundation only — UI routes and the Tailwind → vanilla-CSS port follow in subsequent commits on this same branch.

I'm opening it as a draft now so the Sanity-as-a-dependency decision can be reviewed against concrete schemas before the rest of the integration goes in. Yuli will walk through the context on a call.

What's in this commit

  • Sanity v3 deps added (@sanity/client, next-sanity, sanity, @sanity/vision, @sanity/image-url, styled-components). Only the Watchdog routes will use them; the rest of the site stays static.
  • lib/sanity/schemas/ — four document types: incident, company, category, submission (inbound from the public form, with a triage status).
  • lib/sanity/messagingValidation.ts — Studio-side validator that surfaces brand-spelling errors and discouraged-term warnings inline as editors type. Backed by the shared lib/messagingRules.ts module.
  • lib/sanity-client (read) and lib/sanity-write (server-only, for /api/submit).
  • lib/queries.ts, lib/types.ts, lib/companyLogos.ts, lib/categoryMeta.ts — the shared data layer the UI pages will consume.
  • sanity.config.ts + app/studio/[[...tool]]/ — the embedded Studio at /studio, so editors don't need a separate deploy.
  • .env.example with the three Sanity env vars.

Typecheck passes.

What's TODO on this branch before unmarking draft

  • app/watchdog/page.tsx — main feed (incident list + filters)
  • app/watchdog/[slug]/page.tsx — incident detail
  • app/watchdog/submit/page.tsx — submission form (POSTs to the API route)
  • app/watchdog/about/page.tsx — credits + AI Lab Watch attribution
  • components/watchdog/* — IncidentCard, IncidentFeed, CompanyFilter, CategoryFilter, SubmitForm
  • app/api/submit/route.ts — validates + writes a submission doc
  • app/api/revalidate/route.ts — Sanity webhook target for ISR refresh
  • app/watchdog/watchdog.css — scoped CSS using your design tokens (--bg, --accent, --surface, …); standalone Watchdog uses Tailwind, so the port is a mechanical Tailwind → vanilla-CSS translation, not a redesign
  • components/Nav.tsx — add the "Watchdog" link
  • Optional: lift the messaging-rule pre-commit hook (scripts/check-messaging.ts + .githooks/pre-commit)
  • Drop the accidentally-committed tsconfig.tsbuildinfo and gitignore it

See lib/sanity/INTEGRATION_NOTES.md for the full plan.

Decisions I'd love your input on

  1. Adopt Sanity as a dependency? This PR's question. Reversible: dropping Sanity later means migrating ~10–20 incidents to lib/data/incidents.ts and losing editor self-service + the public submission form.
  2. Mount point. Currently planned at /watchdog/. Could be /integrity-incidents/ if you'd rather. The existing /track-record/ (the personal one-year retrospective) stays untouched either way.
  3. Studio location. Currently /studio on the same domain. Alternative: a separate subdomain like watchdog-admin.pauseai.uk if you'd prefer to keep the public site free of any admin tier.

When this lands — deploy work

  • Add NEXT_PUBLIC_SANITY_*, SANITY_WRITE_TOKEN, SANITY_REVALIDATE_SECRET to Netlify env.
  • Add https://pauseai.uk (and previews) to the Sanity CORS allowlist, Allow credentials checked.
  • Invite editors at sanity.io/manage → project → Members.

Test plan

  • npm install (peer-deps clean)
  • npx tsc --noEmit passes (✅ green locally on this commit)
  • After UI port: npm run build succeeds with Sanity env vars set
  • /studio renders with the four schemas listed
  • /watchdog/ renders the incident feed (after follow-up commits)
  • /watchdog/submit POSTs to /api/submit and creates a submission doc visible in Studio

🤖 Generated with Claude Code

Foundation for merging the standalone PauseAI Watchdog
(ai-integrity-watch.vercel.app) into pauseai.uk. This commit is the
architectural foundation only — UI routes and CSS port follow in subsequent
commits on this branch. See `lib/sanity/INTEGRATION_NOTES.md` for the
full plan, the decisions the maintainer needs to weigh in on, and the TODO
list for the rest of the integration.

What's in:
- Sanity v3 deps (next-sanity, @sanity/client, sanity, @sanity/vision,
  @sanity/image-url, styled-components)
- lib/sanity/schemas: incident, company, category, submission (+ index)
- lib/sanity/messagingValidation: PauseAI brand/messaging rules surfaced
  inline in Studio as editors type (errors block publish, warnings don't)
- lib/messagingRules: shared rules module (single source of truth)
- lib/sanity-client (read), lib/sanity-write (server-only, for /api/submit)
- lib/queries, lib/types, lib/companyLogos, lib/categoryMeta
- sanity.config.ts + app/studio/[[...tool]] (embedded Studio at /studio)
- .env.example with the three Sanity env vars

Reversible if the team decides against Sanity: the only files that need
to come back out are this directory tree and the package.json deps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for pauseaiuk ready!

Name Link
🔨 Latest commit 5141a11
🔍 Latest deploy log https://app.netlify.com/projects/pauseaiuk/deploys/6a2891ecda6f280008de79ac
😎 Deploy Preview https://deploy-preview-35--pauseaiuk.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@UFO-101

UFO-101 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

@hturnbull93 Now is a good time to decide what CMS we want to use. My main concern about Sanity is that it is not FOSS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants