Skip to content

feat: set a master locale when creating a repository#208

Merged
angeloashmore merged 1 commit into
mainfrom
feat/master-locale-on-create
Jul 2, 2026
Merged

feat: set a master locale when creating a repository#208
angeloashmore merged 1 commit into
mainfrom
feat/master-locale-on-create

Conversation

@angeloashmore

@angeloashmore angeloashmore commented Jul 1, 2026

Copy link
Copy Markdown
Member

Resolves: #207

Description

prismic init and prismic repo create create a repository with no locale, so you can't add content until you manually run prismic locale add en-us --master (and the Migration API fails without one).

This adds a --lang option (defaulting to en-us) to both commands that sets the new repository's master locale on creation, making a freshly created repository usable out of the box.

Checklist

  • A comprehensive Linear ticket, providing sufficient context and details to facilitate the review of the PR, is linked to the PR.
  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

Preview

How to QA 1

Run prismic repo create (or prismic repo create --lang fr-fr) and confirm the new repository has a master locale set. The same applies to prismic init when it creates a repository.


Note

Medium Risk
Touches repository provisioning and locale API calls; a failed upsert leaves a repo without a master locale, though errors are surfaced explicitly.

Overview
New repositories were created without a master locale, blocking content and Migration API use until someone ran prismic locale add manually.

prismic repo create and prismic init (when it creates a repo) now accept --lang / -l, default en-us. Shared createRepo calls upsertLocale with isMaster: true right after createRepository, with clear errors if locale setup fails.

An integration test asserts --lang fr-fr sets the master locale on the new repo.

Reviewed by Cursor Bugbot for commit f1ff2f1. Bugbot is set up for automated code reviews on this repo. Configure here.

Footnotes

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment.

Add a `--lang` option (default `en-us`) to `prismic init` and
`prismic repo create` that sets the new repository's master locale.
A freshly created repository has no locale, which blocks adding content
and breaks the Migration API until a master locale is added manually.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@jomifepe jomifepe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 💯

@angeloashmore angeloashmore merged commit 7d0ffdf into main Jul 2, 2026
14 of 16 checks passed
@angeloashmore angeloashmore deleted the feat/master-locale-on-create branch July 2, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a --lang flag to set the master locale on repository creation

3 participants