All apps/Sanity CLI

Sanity CLI

sanity

Command-line tool for Sanity Studio projects.

Runs as sanity|macOS, Linux, Windows|www.sanity.io

Command form

ai-draft · 6 tasks · 17 fields

Create, run, build and deploy a studio. Datasets, documents, CORS, GraphQL and user management are not covered.

Opens the form; the finished command lands at your prompt, unrun
otty gui sanity

sanity init

Initialize a project
Initialize a projectExample values, fixed in this page — nothing here reaches a terminal
Basic
Project ID
string
Dataset
string
Output path
directory
Template
string
TasksEach one presets the form for one job
Initialize
projectdatasetoutput_pathtemplate
Unattended init
yesprojectdatasetoutput_pathtemplate
ParametersOnly these flags are editable in the form
Unattended (accept defaults)
boolean
--yes-y
Project ID
string
--project
Dataset
string
--dataset
Output path
path
--output-path
Template
string
--template
Create project with name
string
--create-project
Dataset visibility
enum
--visibilitypublicprivate
Reconfigure current folder
boolean
--reconfigure

sanity start

Start the studio
Start the studioExample values, fixed in this page — nothing here reaches a terminal
Basic
Port
integer
Host
string
TasksEach one presets the form for one job
Start dev server
porthost
ParametersOnly these flags are editable in the form
Port
integer
--port
Host
string
--host

sanity build

Build the studio
Build the studioExample values, fixed in this page — nothing here reaches a terminal
Basic
Source maps
--source-maps
Skip minifying
--no-minify
TasksEach one presets the form for one job
Build
source_mapsno_minify
ParametersOnly these flags are editable in the form
Source maps
boolean
--source-maps
Skip minifying
boolean
--no-minify
Unattended
boolean
--yes-y

sanity deploy

Deploy the studio
Deploy the studioExample values, fixed in this page — nothing here reaches a terminal
Basic
Built directory
directory
TasksEach one presets the form for one job
Build and deploy
source_dir
Deploy existing build
source_dirno_build
ParametersOnly these flags are editable in the form
Built directory
path · positional 0
Source maps
boolean
--source-maps
Skip minifying
boolean
--no-minify
Skip build
boolean
--no-build
SourcesEvery flag above is checked against these
src
completion

github.com

src
completion

github.com

src
completion

github.com

src
completion

github.com

src
completion

github.com

Before it fills your prompt, Otty checks the installed sanity against its version. A form that does not match your version is not offered.