feat: use --name as repository domain in repo create and init#180
Merged
feat: use --name as repository domain in repo create and init#180
Conversation
Previously `--name` was only sent as the display label while the domain was a random 8-char hex slug. The dashboard API accepts a caller-chosen domain, so derive it from user input (kebab-cased) and add a separate `--display-name` flag for the label. - `--name` is now required and defines the domain - Adds `--display-name` to set the display label (defaults to `--name`) - Validates the domain against the dashboard rule before POSTing - `prismic init` requires `--name` unless `--repo` is provided Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Drop the silent kebab-casing of --name. Validate it directly against the dashboard rule and error with guidance when it doesn't match. Users pass the exact domain they want. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Accept uppercase letters in --name to match the server-side rule
exactly (`^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$`). Wroom lowercases
the domain server-side, so any value the CLI accepts will be accepted
by the API.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Wroom lowercases the domain server-side. If the user passes `MyRepo`, the CLI was printing `Repository created: MyRepo` and `URL: https://MyRepo.prismic.io/`, both wrong. Lowercase after validation so the displayed output matches what was actually created. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
init is about connecting a project to a repository. Drop the --name/--display-name options added to init — repo creation with a custom display label belongs on `prismic repo create`. Instead, if --repo points to a domain the user doesn't have access to, check if it's available and create it with that name; if it's taken by another account, error clearly. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Keep the original shape of the access check; just branch on availability when the user lacks access, and thread the name into createRepo. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
It's only used in one place (the createRepo function), so it doesn't need its own lib file. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
tomaboro
approved these changes
May 8, 2026
Co-authored-by: tomaboro <tomaboro96@gmail.com>
29d904b to
8f2be73
Compare
8f2be73 to
e28f384
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2896d8f. Configure here.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Summary
prismic repo create --namenow sets the repository domain (URL slug), not just the display label. Previously the domain was a random 8-char hex string regardless of--name.--display-name(-d) onrepo createto control the human-readable label separately, matching the dashboard's two-field model.--nameis required onrepo createand validated against the same rule API uses: 4–63 chars,^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$. Invalid input errors with guidance. Valid input is lowercased before submitting (API lowercases server-side).prismic init --repo <name>now creates the repository if it doesn't already exist in your account (and is available). If the name is taken by another account, it errors clearly.How to QA [^1]
npx prismic@pr-180 repo create --name my-test-repo→ Creates a repo atmy-test-reponpx prismic@pr-180 repo create --name foo-bar --display-name "Foo Bar"→ Sets domainfoo-barand labelFoo Barin the dashboardnpx prismic@pr-180 repo create --name "My Test Repo"→ Errors with validation guidance (spaces are not allowed)npx prismic@pr-180 repo create --name "!!"→ Errors with validation guidancenpx prismic@pr-180 init --repo my-new-repoin a fresh project → Createsmy-new-repoand writes it toprismic.config.jsonnpx prismic@pr-180 init --repo prismic→ Errors (name taken by another account)npx prismic@pr-180 init→ Errors asking for--repo🤖 Generated with Claude Code
Note
Medium Risk
Medium risk because it changes core CLI flows for
initandrepo create, including input validation and repository creation behavior, which could break existing scripts or expectations around repo naming and provisioning.Overview
Repository creation now uses user-provided names as the domain.
prismic repo createrequires--name, validates it (length/charset), lowercases it, checks availability, and uses it as the repository domain; the human-friendly label is now optionally provided via--display-name.prismic initnow requires--repoand will auto-provision. The command lowercases/validates the provided repo name, creates the repository if it isn’t already in the user’s account (and is available), and improves error messages for missing/invalid/taken names. Option parsing gained optional per-flag zod schemas to enforce validation consistently, and tests were updated to cover the new behaviors and cleanup.Reviewed by Cursor Bugbot for commit 428aab2. Bugbot is set up for automated code reviews on this repo. Configure here.