Skip to content

Add a prismic doctor command that reports open setup steps #421

Open

Description

@angeloashmore

Is your feature request related to a problem? Please describe.

There is no command that tells you whether a project is set up correctly. Setup steps that the CLI cannot do itself, such as adding <PrismicPreview> or declaring PUBLIC_PRISMIC_ENVIRONMENT in a SvelteKit 3 src/env.ts, appear only after init, gen setup, preview add, and env set. If you miss that output, you cannot get it again. Agents also have no simple way to make sure that their changes left the project in a working state.

Describe the solution you'd like

A prismic doctor command that lists every open setup step and exits with a non-zero code when one or more steps are open. This makes it useful for agents and in CI.

A first version can run the existing setup instructions (getSetupInstructions() in each adapter) and these checks:

  • The installed @prismicio/* versions support the framework version. For example, @prismicio/svelte v2 does not support SvelteKit 3.
  • The repository has a slice simulator URL and at least one preview.
  • prismic.config.json is valid, and the user is logged in.

The commands that print setup steps today can end with "Run prismic doctor for details." The two must use the same checks.

Describe alternatives you've considered

  • Print the setup steps after every command. This makes every command slower, because one check scans all source files. It also adds text to output that tools parse, and people stop reading a warning that is always there.
  • Add the steps to prismic status. That command is about model differences with Prismic, so setup checks do not belong there.

Additional context

doctor is the usual name for this command in other tools, for example brew doctor, flutter doctor, and expo doctor.

The need for this came up in #418, which adds SvelteKit 3 support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions