Skip to content

refactor(sanity): clean up schemas, organize Studio structure, and optimize GROQ queries - #741

Open
codercatdev wants to merge 3 commits into
devfrom
refactor_sanity_schema_structure
Open

codercatdev wants to merge 3 commits into
devfrom
refactor_sanity_schema_structure

Conversation

@codercatdev

Copy link
Copy Markdown
Contributor

Summary

  • Sanity Schema Cleanup (apps/sanity/schemas/):
    • Removed 20 retired AI/video engine, legacy preview, and unqueried content schemas (engineConfig, contentConfig, dashboardSettings, gcsConfig, pipelineConfig, remotionConfig, sponsorConfig, automatedVideo, contentIdea, mediaAsset, videoAnalytics, sponsorLead, sponsorPool, previewSession, sponsorshipRequest, sharePreviewAction, course, lesson, short, podcastSeries, category, and socialPreviewFields).
    • Removed unused fields on podcast, post, page, sponsor, guest, and content, and made podcastType optional/hidden when unset since there is only one active podcast.
    • Restricted transcript.contentRef and sync-missing-youtube-transcripts to ["post", "podcast", "page"].
  • Sanity Studio Structure Refactor (apps/sanity/structure.ts):
    • Organized Studio into a clean Editorial Hub (Site Settings, Publishing & Release Readiness including drafts.** and Content Releases versions.**, Posts, Podcasts without "By Type" nesting, Pages, People & Sponsors, and Automation & Intelligence) with zero duplicate root items.
    • Updated @sanity/assist presets (apps/sanity/plugins/assist.ts) with CodingCat.dev-specific instructions for both post and podcast.
  • GROQ Query & Reference Optimizations (apps/site/src/lib/sanity/queries/):
    • Replaced array membership scans (^._id in author[]._ref || ^._id in guest[]._ref) in userRelated and sponsorRelated with Sanity's indexed references(^._id) filter.
    • Replaced ... in author[]->, guest[]->, sponsor[]->, and pick[].user-> with lean personRefFields and sponsorRefFields projections.
    • Separated portableTextFields from contentFields for people.ts and sponsors.ts.
    • Removed the non-optimizable transcript->statistics.viewCount join in homePageQuery filters and order(), sorting directly on statistics.youtube.viewCount.
  • Sanity MCP & Editorial Workflow Skill:
    • Fixed field projections and schema definitions in apps/site/src/pages/api/mcp.ts.
    • Added .agents/skills/sanity-editorial-workflow/SKILL.md for Sanity MCP + CLI content releases readiness, Gemini drafting, and cover photo generation/upload.

Verification

  • pnpm typegen (regenerated apps/sanity/extract.json and apps/site/src/lib/sanity/types.gen.ts)
  • pnpm lint (0 errors)
  • pnpm typecheck (0 errors, 0 warnings)
  • pnpm build & pnpm build:studio

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

⚡ Cloudflare Worker Preview Ready!

Environment URL
PR Preview https://a5a17542-codingcatdev-dev.codingcatdev.workers.dev
Dev Custom Domain https://dev.codingcat.dev
  • Worker Version ID: a5a17542-e273-4d5b-a29d-b556c157f526
  • Protection: Restricted to @codingcat.dev accounts via Cloudflare Zero Trust Access

This branch had an error being deployed

1 failed deployment
production — da202ff5 Deployed Oct 14, 2026 by codercatdev via sync-dataset #7
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.

1 participant