Conversation
"Create a new site" in the repository picker: choose a site template (storefront or blog), the connected GitHub account that owns it, and a name. Studio generates a private repository from the template through its GitHub App, links it, and opens it as a project. - REPOSITORY_CREATE_FROM_TEMPLATE tool; template allowlist in @decocms/shared/site-templates - GitHub client createRepoFromTemplate: never adopts an existing repo, waits for the template copy, explains missing Administration permission - a partial installation grant gains the repository Studio created - gated by the default-off org flag site_create_enabled (staff/local always) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
What is this contribution about?
Adds "Create a new site" to New project. From the repository picker the user chooses a site template (Storefront →
deco-sites/storefront-tanstack, Blog →deco-sites/blog-tanstack), then the connected GitHub account (user or org) that will own the site, then a name. Studio generates a private repository from the template through its GitHub App, links it, and opens it as a project (site-editor view), reusing the existing import path.REPOSITORY_CREATE_FROM_TEMPLATE({ accountId, name, template }). The template is an id from a server-side allowlist (@decocms/shared/site-templates), so a caller can't generate from an arbitrary repo. The name must be a lower-case slug of at most 100 characters.createRepoFromTemplateon the GitHub provider client:administration: writeondeco-cmsneed an owner to accept it.grantRepository, an idempotent jsonb append). GitHub automatically gives the App access to a repository it creates with an installation token, including under selected-repositories installations (docs). A grant already at GitHub's 500-repository token limit is refused before anything is created.site_create_enabled, off by default. deco.cx staff and local dev always see the option (same pattern as the control-plane views). It is product gating only; the tool still needs a servable GitHub account.Out of scope, as a follow-up: hosting. The control-plane's
POST /sites(Nicácio'sSITE_CREATE) only creates repositories underdeco-sites, and this flow lets the user pick their own org. Wiring hosting would need the control-plane REST to accept an existing repo (repomode) and thedeco-hostingApp installed on the customer's org.How did you verify your code works?
bun run verify(format, oxlint, knip, unit): 9635 pass.tscis clean for api, web, shared and e2e.apps/api/src/storage/git-provider-accounts.integration.test.ts(real Postgres), 3/3:packages/e2e/tests/create-site.spec.ts, 2/2 locally against the GitHub stub. It runs under the synthetic GitHub App config, next togithub-connect.spec.ts.packages/shared/src/site-templates.test.tscovers the schema and allowlist, including empty, oversized and invalid slugs.Screenshots/Demonstration
Screenshots of the four steps (entry, template, account, name) to be attached; captured by the e2e spec (
create-site-{entry,template,account,name}.pngin the Playwright output).How to Test
site_create_enabledon for the org), with a GitHub account connected under Settings → Repositories.<account>/<name>repository generated fromdeco-sites/storefront-tanstack, and the project opens on it.Migration Notes
No database migration. New org flag
site_create_enabled(off by default). To open the feature to a customer org, turn it on in the admin flags editor.Review Checklist
🤖 Generated with Claude Code