[Add] a per-site project type driving clone, status and build (#251) - #255
Open
juanmaguitar wants to merge 1 commit into
Open
[Add] a per-site project type driving clone, status and build (#251)#255juanmaguitar wants to merge 1 commit into
juanmaguitar wants to merge 1 commit into
Conversation
juanmaguitar
force-pushed
the
juanmaguitar/support-gutenberg-as-a-contribution-target-not-o
branch
from
August 11, 2026 08:57
b571e5d to
716def9
Compare
This was referenced Aug 11, 2026
juanmaguitar
force-pushed
the
juanmaguitar/support-gutenberg-as-a-contribution-target-not-o
branch
from
August 11, 2026 10:57
716def9 to
1c66b4e
Compare
The toolkit assumed every site was a wordpress-develop checkout — the repo it clones, how it decides a site is "built", and the run/build commands were all hard-wired to WordPress Core. A contributor who wants to work on the block editor (Gutenberg) had no path in, even though the shape of the work is nearly identical. Give each site a project type, chosen once at creation, and let that single choice drive the parts of the flow that differ. This PR covers clone, status and run/build; serving Gutenberg in a real WordPress and the GitHub-issue work item / pull-request flow follow in later PRs. - src/project-type.cjs: one registry describing each target (Core, Gutenberg) — clone URL/branch, PR upstream, built-check path, dev/build scripts, allowed terminal scripts, plus the serve strategy, patch layout and work-item provider the later PRs will read. getProjectType / projectTypeForSite default to Core for any unknown or missing id, so sites created before this field existed need no migration and the Core path is byte-identical. - wordpress:setup resolves the type once and uses it for both the clone and the siteMeta it writes, so the two cannot disagree; site:status returns it. - site:status answers "is it built?" from the type's marker path (Core's wp-includes dist dir vs Gutenberg's build/block-library). - git:update-trunk pulls from the site's own upstream, not always wordpress-develop — updating a Gutenberg checkout from Core's trunk would overwrite it with a different project. - The create-site wizard gains a "Contribute to" choice (default Core), and the dev-server plan and terminal allow-list come from the chosen type. The sidebar button, modal and docs are retitled from "WordPress Core site" to the type-neutral "contributor site"; the create-site and empty-state screenshots are regenerated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
juanmaguitar
force-pushed
the
juanmaguitar/support-gutenberg-as-a-contribution-target-not-o
branch
from
August 11, 2026 13:49
1c66b4e to
747ac9b
Compare
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.
Why
The toolkit assumes every site is a
wordpress-developcheckout — the repo it clones, how itdecides a site is "built", and the run/build commands are all hard-wired to WordPress Core. A
contributor who wants to work on the block editor (Gutenberg) has no path in, even though the shape
of the work is nearly identical. Part of #251.
What changes
Each site gets a project type, chosen once at creation, and that single choice drives the parts
of the flow that differ. This PR covers setup/clone, built-status, and run/build; serving
Gutenberg in a real WordPress (PR next) and the GitHub-issue work-item / pull-request flow (PR after)
follow.
src/project-type.cjs— one registry describing each target (Core, Gutenberg): cloneURL/branch, PR upstream, built-check marker path, dev/build scripts, allowed terminal scripts —
plus the serve strategy, patch layout and work-item provider the later PRs will read.
getProjectType/projectTypeForSitedefault to Core for any unknown or missing id, so sitescreated before this field existed need no migration and the Core path stays byte-identical.
wordpress:setupresolves the type once and uses it for both the clone and thesiteMetaitwrites, so the two cannot disagree;
site:statusreturns it.build/wp-includes/js/distvs Gutenberg'sbuild/block-library.git:update-trunkpulls from the site's own upstream — updating a Gutenberg checkout fromCore's trunk would overwrite it with a different project.
npm run devvs Core's
grunt -- _watch) and the terminal allow-list come from the chosen type. The sidebarbutton, modal and docs are retitled to the type-neutral "contributor site"; the create-site and
empty-state screenshots are regenerated.
Deliberately not here: no Gutenberg serve yet (a Gutenberg site can clone/install/build but its
Playground preview comes in the next PR), and the work item is still Trac-only (GitHub issues land
with the PR flow).
How to test this
Platforms: any — no path/spawn/line-ending behavior changes; the marker path is composed with
path.join.Starting state: the app open on the site list.
Contribute to choice, WordPress Core (Trac tickets) selected.
wordpress-develop; install, build, anddev server behave exactly as before.
WordPress/gutenberg; afternpm run buildthe checklist reports it built (markerbuild/block-library); the terminal'snpm run <script>list is Gutenberg's; starting the dev server runsnpm run dev(not Grunt).WordPress/gutenberg, notwordpress-develop.What must not have happened:
projectTypereads as Core everywhere, withno store rewrite on status read.
build/wp-includes/js/distexists — the marker is its own (
test/ipc-wiring.test.cjspins this negative case).grunt -- _watch.Automated:
npm run lintclean;npm test— 797 pass, 0 fail. New/extended coverage intest/project-type.test.cjs,test/dev-server-command.test.cjs(Gutenbergnpm run devbranch),and
test/ipc-wiring.test.cjs(clone URL, built marker incl. the negative, and update-trunk URL pertype; setup persistence + normalization).
Risks and limitations
src/framing (e.g. "Edited files insrc/? Run npm runbuild"); a Gutenberg-aware copy pass rides with the later, user-facing PRs.
Related
Part of #251.
Design decisions and alternatives considered
if (type === …). The Core assumptions were spread across clone,status,
dev-server-command.cjs, and the trunk-update URL. Consolidating them intosrc/project-type.cjsturns each hard-wired constant into a lookup whose Core value reproducestoday's behavior, so the Core diffs read as pure refactors.
siteMetarecords simply lack the field;projectTypeForSite(undefined)yields Core. Nothing is rewritten on disk.into an inert spine + a follow-up; combining them means the wizard never exposes a choice the app
ignores, which removed a self-review finding entirely. Still under the size guideline (~490 lines).
git:update-trunkhad to become type-aware here, not later — a Gutenberg site updating fromCore's trunk is a data-loss bug, so it could not wait for a serve/PR PR.
Review outcome (required — see AGENTS.md)
1 [fix here] · 0 [follow-up]. Ran the review in
.github/instructions/code-review.instructions.mdagainst the branch; judgement pass dispatched toa fresh subagent.
npm run lintclean, 797 tests pass.facts (
serve.strategy,patch.layout,pr.*/workItem) are not yet consumed, so a Gutenbergsite can clone/build but not be served or produce a valid patch/PR. Resolved by merge strategy,
not by code: this PR and the serve + work-item/PR follow-ups merge together (see the banner in
Risks), so the option never reaches a user in the broken state. Deliberately kept the choice live
rather than gating it, because the stack lands atomically.
site:statusmarker/meta ordering, renderer memoization stability, IPC validation, cross-platformpath composition, or test quality (the per-type tests, including the negative built-marker case,
go red if a consumer stops honoring the type).
Screenshots or recording
The create-site modal now offers a Contribute to choice (WordPress Core / Gutenberg), Core
preselected, and the sidebar button + modal are retitled. Regenerated docs screenshots:
docs/public/screenshots/create-site-modal.pngandempty-state.png.