You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request lets template authors include an optional sanity-template.json as part of the template, with a postInitMessage that the CLI shows after the template has been successfully set up. This allows template authors to highlight next steps, links, commands or anything else they want people to see at the end of init – maintained in the template itself, so copy tweaks don't require a new CLI release.
Example flow
Given a template that contains sanity-template.json at the project root, e.g.:
Then they see the usual success output from init and after that the postInitMessage appears, e.g:
Success! Your Studio has been created.
(cd /path/to/project to navigate to your new project directory)
Get started by running pnpm dev to launch your Studio's development server
Other helpful commands:
npx sanity docs browse to open the documentation in a browser
npx sanity manage to open the project settings in a browser
npx sanity help to explore the CLI manual
Message from the template author:
POST MESSAGE
What to review
From the repo root, after a local build, run sanity init against a template branch that includes sanity-template.json with postInitMessage – e.g. this branch of the Next.js clean starter where that file was added:
1. sanity-template.json not removed when manifest exists but fails schema validation
removeTemplateManifestFromOutput is only called when templateManifest is truthy (init.ts:737). If the file exists but fails schema validation (e.g. postInitMessage: 42), readTemplateManifest returns null, and the file is left in the user's project directory. The cleanup should be unconditional — removeTemplateManifestFromOutput already swallows errors if the file doesn't exist.
// currentif(templateManifest){awaitremoveTemplateManifestFromOutput(outputPath)}// fix: always attempt cleanup, regardless of parse resultawaitremoveTemplateManifestFromOutput(outputPath)
To support this, readTemplateManifest would need to indicate "file existed but was invalid" vs "file didn't exist" — or simply always call removeTemplateManifestFromOutput unconditionally (it's already safe to do so). Fix this →
String form caps at 2,000 chars, but array form allows up to 50 × 500 = 25,000 chars. A template author using the array form can display 12× more text, bypassing the intended limit. Consider either making the total-character limit consistent across both forms, or adding an overall character budget to the array branch. Fix this →
hermanwikner
changed the title
feat(init): support sanity-template.json with postInitMessage [WIP]
feat(init): support sanity-template.json with postInitMessage [WIP]
Mar 24, 2026
hermanwikner
changed the title
feat(init): support sanity-template.json with postInitMessage [WIP]
feat(init): support sanity-template.json with postInitMessageMar 25, 2026
The reason will be displayed to describe this comment to others. Learn more.
Saw claude mentioned that if a bad template manifest or the read fails we do not clean it up? Is it worth cleaning up here regardless or even in readTemplateManifest.ts?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request lets template authors include an optional
sanity-template.jsonas part of the template, with apostInitMessagethat the CLI shows after the template has been successfully set up. This allows template authors to highlight next steps, links, commands or anything else they want people to see at the end of init – maintained in the template itself, so copy tweaks don't require a new CLI release.Example flow
Given a template that contains
sanity-template.jsonat the project root, e.g.:{ "postInitMessage": "POST MESSAGE" }When the user bootstraps that template, e.g:
Then they see the usual success output from init and after that the
postInitMessageappears, e.g:What to review
From the repo root, after a local build, run
sanity initagainst a template branch that includessanity-template.jsonwithpostInitMessage– e.g. this branch of the Next.js clean starter where that file was added:Confirm the
postInitMessageappears after the usual success output