Concepts

Prismic CLI

NEW

Last updated

The Prismic CLI is a command-line tool for managing Prismic repositories. You can create repositories and configure their settings from your terminal.

When used in a repository that supports the Type Builder, the Prismic CLI is also used to pull content models from Prismic into your local codebase.

Quick start

The Prismic CLI can be used via npx, no installation required.

npx prismic

Install the skill to teach AI agents how to use the CLI:

npx skills add --global prismicio/skills

Learn about npx skills

Help and reference

Use --help to learn about the CLI’s capabilities.

npx prismic --help

It works for commands and subcommands as well:

npx prismic repo --help
npx prismic webhook create --help

CLI commands

The Prismic CLI comes with the following commands, some of which have subcommands.

CommandDescription
prismic docsList and view Prismic documentation.
prismic repoCreate and manage repositories.
prismic localeManage repository locales.
prismic previewManage repository previews.
prismic tokenManage repository access and write tokens.
prismic webhookManage repository webhooks.
prismic loginAuthenticate the CLI with a Prismic account.
prismic logoutLog out of the CLI.
prismic whoamiDetermine which Prismic account is logged in.

Type Builder projects

The Prismic CLI integrates with the Type Builder through these extra commands.

CommandDescription
prismic initInstall and set up Prismic in a new website project.
prismic syncPull content models from the Type Builder into a project.
prismic genGenerate code for a project.

Set up a Type Builder project

Use the init command to integrate Prismic into your project. It installs Prismic’s packages and configures your project with a Prismic client and content previews.

npx prismic init --repo <your-repository-name>

Sync Type Builder models

Use the sync command to pull content models from the Type Builder into your codebase. This generates TypeScript types for your page types, custom types, and slices. It also bootstraps component files for pages and slices.

npx prismic sync

Use --watch to keep models in sync as you make changes in the Type Builder:

npx prismic sync --watch
Was this page helpful?