← Building with AI

Removing the laptop from the schema deploy loop

falahrajput/falahrajput.github.iofeat/multi-turn-coding-sessions
PR #49 adds a `codingSession` document type to Sanity, but the schema isn't live in the Studio editor yet. Right now that requires running `npx sanity deploy` from my laptop. Can we wire it so any push to `vortex-sanity-studio/main` auto-deploys the Studio, with no human in the terminal?
Worked for 4 minutes
Two ways to bridge GitHub to a hosted Studio: a GitHub Action running the deploy CLI, or Vercel hosting the Studio under a custom subdomain. Action is simpler — Sanity's `*.sanity.studio` URL is free, the deploy CLI is one line, and the only friction is providing a write-scoped `SANITY_AUTH_TOKEN` as a repo secret.

The fix is a GitHub Action on the Studio repo that runs `npx sanity deploy` on every push to main, authenticated via a `SANITY_AUTH_TOKEN` repo secret. Three commits to vortex-sanity-studio do the whole thing: a `.github/workflows/deploy-studio.yml`, a schema file at `sanity/schemaTypes/codingSession.ts`, and a one-line addition to `sanity/schemaTypes/index.ts` that registers the new type. After this lands, schema commits ship to the live editor in ~90 seconds with no laptop in the loop.

The GitHub edit link 404'd on `sanity/schemaTypes/index.ts`. The schema file we added earlier seems to be in the wrong place too.
Worked for 3 minutes
Two failures, two diagnoses. The 404 is a wrong-repo navigation — the breadcrumb shows falahrajput.github.io, not vortex-sanity-studio. The misplaced file is more substantive: I told the user to add the schema at top-level `schemaTypes/`, applying Sanity v3's standard convention without checking the actual repo, which puts schemas at `sanity/schemaTypes/`. That's a guessed-the-layout mistake.

Two fixes. The 404 was just the URL resolving against the wrong repo — pasting the explicit vortex-sanity-studio URL fixed it. The schema-in-wrong-folder mistake is the more interesting one: I'd guessed Sanity's standard layout instead of inspecting the actual repo, and that landed the file at a top-level `schemaTypes/` directory that nothing imports from. Fixed by re-adding it under `sanity/schemaTypes/` and deleting the orphan in a follow-up commit. The lesson generalises: when guiding edits into a repo neither of us has read in this session, the first move is "show me the layout," not "here's the file."

What were the mistakes we were making before this session, and how has the workflow changed?

Before: schema changes lived in the Studio repo, but a human had to run `npx sanity deploy` from a laptop for the change to actually reach the live editor. That coupled "schema is on main" to "the right human is online with the right CLI." Any Claude Code session that shipped a schema change was incomplete by construction.

Now: the CMS has three independent flows. Schema commits ship through the Studio repo's GitHub Action. Content edits ship through Sanity's webhook into a Vercel deploy hook. Site code ships through Vercel's GitHub integration. Each is one git push, no manual steps. Main is the deployed Studio, the deployed Content Lake, the deployed site — full stop.

How could we automate the editorial polish so I don't have to hand-edit each draft going forward?
Worked for 3 minutes
The seven publish rules are editorial judgment, but they're describable judgment: rewrite titles for outcomes, rewrite prompts for clarity, write prose not transcripts, redact mechanically, sleep 24h. An LLM with the rules as system prompt can do most of that. The 24-hour rule is the part that must stay human — reading a polished draft with fresh eyes is what catches AI-flatness, and that depends on time passing.

The rules are an editorial spec. An `--auto-polish` flag on `parse-sessions.ts` could call the Anthropic API with the raw JSONL as input and the `publish-coding-session` skill file as the system prompt, returning polished title, turns, and response prose. The script would push that as a Sanity draft instead of a raw transcript dump. You still review and publish manually — the 24-hour rule stays a human checkpoint by design, because the whole point is your voice on your sessions. Cost with prompt caching on the system prompt is roughly $1–2 per session on Sonnet 4.6. Ship-ready as a follow-up PR after the multi-turn rendering lands.