Skip to content

feat: create repositories seeded from the starter - #529

Draft
angeloashmore wants to merge 19 commits into
mainfrom
claude/vibrant-goldberg-hr4d15
Draft

angeloashmore wants to merge 19 commits into
mainfrom
claude/vibrant-goldberg-hr4d15

Conversation

@angeloashmore

@angeloashmore angeloashmore commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Resolves: prismicio/obelix#2488, prismicio/editor#2771

Description

Before this PR, the CLI created empty repositories, and Instant Start built starter repositories through a long, fragile flow. New users had nothing to look at until they modeled content.

After this PR, every repository the CLI creates is seeded from one Next.js starter: models, published pages, and a shared hosted preview. The repository records its starter (id, revision, framework, deploymentUrl), and GET /repository returns it. In an empty folder, prismic init downloads the starter code from <deploymentUrl>/starter.tar.gz and unpacks it with a built-in reader (no system tar). In an empty folder or an existing project, prismic init then points the preview and slice simulator at localhost and removes the previews under deploymentUrl, which unlocks model editing in the Page Builder. A repository without a recorded starter keeps its previews. Repositories from the old Instant Start (prismicio/next-instant-start) keep the handoff from main: no download, and the local setup runs only from prismic init --repo in the downloaded project. prismic repo create --empty and prismic init --empty opt out of seeding.

Public API changes, on purpose:

  • --empty is new on repo create and init, for users who want to model from scratch.
  • PRISMIC_STAGE is new, so the CLI can talk to an obelix pull request stage.
  • --lang is now ignored with a warning, not only deprecated, because seeded repositories always use en-us. This is on purpose, as a minor release.
  • repo create no longer needs a framework.
  • init in an existing project of any framework also gets the starter's models and documents, unless --empty is passed.

Merge and deploy prismicio/obelix#2488 first, with https://instant-start-nextjs.vercel.app/starter.json live. CI stays red until then: repository creation gets 405 from prismic.io.

Checklist

  • 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 init in an empty folder, then npm run dev, and open the repository's Page Builder.

https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf


Generated by Claude Code

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. ↩

Repository creation, guest creation included, calls the repository
service's `POST /repository`. The server generates the domain and seeds
the models, pages, locale and a shared preview.

`prismic init` in an empty folder downloads the repository's starter
archive from `GET /repository/starter` and extracts it with Node zlib
and a small ustar reader. Then the usual init steps run.

The new `prismic connect` command checks that the development server
serves `/slice-simulator`. Then it points the preview and the simulator
at localhost and removes the shared starter preview, which unlocks model
editing in the Page Builder.

`PRISMIC_STAGE` adds an Obelix stage prefix to every `api.internal` URL,
so the CLI can use a pull request stage.

`--lang` is deprecated because the starter sets the locale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

claude added 18 commits December 3, 2026 19:56
Create the repository before reading it, so that init uses one path to
set the framework for new and existing repositories. Treat any failed
starter download as "no starter project", as the API contract says.
Inline the tar reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
Check the repository access before init downloads the starter, so a
wrong domain gives the "not found in your account" error. Do not
overwrite files that already exist in the folder, such as .gitignore.

Print the `prismic connect` hint when the repository still uses the
shared starter preview, also for `prismic init --repo`. Match the
starter preview as the Page Builder lock does, and give a cold
development server more time to answer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
The repository service no longer serves a per-repository archive. Each
starter version publishes a static `starter.tar.gz` on its own preview
deployment. init finds that deployment from the repository's preview
configs, downloads the archive, and then sets `repositoryName` in
prismic.config.json.

init and connect recognize the starter preview with one helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
A preview URL with "#", "?" or "@" after the starter prefix could send
the starter download to another host. Accept only the hex version hash
in the starter host. This also keeps a user's own deployment named
"prismic-starter-next-<word>" from counting as the shared starter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
`prismic repo create --empty` sends `{ "empty": true }` to
`POST /repository/` to create a repository with no starter content.
The request also sends `X-Prismic-Source-Usecase: cli` for analytics.

Declare PRISMIC_STAGE in env.ts with the other PRISMIC_* variables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
The repository service now takes app and agent in the JSON body and
forwards them to Wroom for analytics. Remove the source use case header,
because app now gives the same information.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
The starter reader wrote files with names longer than 100 characters
to a truncated path when the archive used GNU or pax long names. It
now reads those names.

A folder is empty when it has no files other than dotfiles. A
package.json in a parent folder no longer blocks the starter download.

A network error during the download now shows the retry command. A
failed repository creation now tells the user to check for a partly
created repository. `repo create` prints the domain before its
follow-up calls, and shows the starter hint only when no framework is
set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
When Prismic refused to create a repository, the CLI showed an
unexpected-error message. The user did not know why.

A 400 from repository creation now shows the message from the server.
Nothing exists after a 400, so the CLI does not say that the repository
can exist anyway. 5xx and network errors keep the current messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
A seeded creation now takes about 16 seconds. The CLI printed nothing
in that time. It now prints "Creating repository..." before the call.

After init takes over a seeded repository, the starter preview is
gone. The "has no starter project" error then gave the wrong cause.
The error now says that the repository is empty or that its starter
is already set up. It tells the user to run init in the project that
holds the code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
Init always created a seeded repository. In an existing project, the
user or agent may want to build the models from the existing website.

With --empty, init creates the new repository without models, pages,
or starter preview, the same as `repo create --empty`. Without the
flag, init still creates a seeded repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
…mmit

The starter's shared deployment is now served at
instant-start-nextjs-<sha>.vercel.app, and it no longer serves a
starter.tar.gz archive. init reads the commit sha from that host and
downloads the code from codeload.github.com. It drops the top-level
folder of the archive.

GitHub serves a fork's commits through the parent repository's URLs.
init first checks that the commit is on main, so a forged sha cannot
point at foreign code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
The repository service now records the starter of a seeded repository:
its id, revision, framework and deployment URL. init reads this record
instead of a sha in the preview host.

In an empty folder, init downloads `<deploymentUrl>/starter.json` and
writes its files. It rejects absolute paths and `..` paths. The
takeover removes the previews whose URL starts with the deployment URL.
Without a recorded starter, init skips the takeover.

This removes the host regex, the GitHub check, the codeload download
and the tar reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
Repositories from the old Instant Start record the starter
prismicio/next-instant-start. Its deployments do not serve starter.json.

Init now downloads starter.json only for the
prismicio-community/instant-start-nextjs starter. For other starters in
an empty folder, init stops with the same error as before.

One handoff now handles both starters. It removes the previews that
point at the starter deployment, adds the local preview, sets the
simulator, completes the onboarding step, and renames package.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
The starter now serves its project files in files.json. starter.json
holds only the Prismic data, so init downloads files.json instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
The starter keeps its project files in starter.json. This reverts
commit 6aaf11d.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
The starter now serves its project in starter.tar.gz. starter.json
holds only the Prismic data. init downloads the archive and extracts it
with the system tar, which refuses absolute paths and "..".

tar extracts to a temporary folder. Then init copies the files and keeps
the files that exist, because GNU tar fails on existing files with -k.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
init no longer needs the system tar, a temporary folder or a copy step.
It gunzips the archive with node:zlib and reads the ustar entries. It
writes regular files and keeps files that exist. It skips folders and
refuses other entry types.

The path check is back, because tar no longer does it. init refuses
absolute paths and ".." segments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
The MCP URL ignored PRISMIC_STAGE. MCP calls went to the persistent
MCP server, even when every other API call used the stage. Preview
stages serve MCP at `<stage>-mcp.<host>`. Use that host when
PRISMIC_STAGE is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD8C9qyy3L63SVaf3uf
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.

2 participants