Skip to content

feat(cli): ship a starter base for bare Payload apps - #446

Closed
Ducksss wants to merge 2 commits into
claude/cli-authoring-batchfrom
claude/base-bundle
Closed

Ducksss wants to merge 2 commits into
claude/cli-authoring-batchfrom
claude/base-bundle

Conversation

@Ducksss

@Ducksss Ducksss commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Stacked on #445. Review that first; this PR is the last commit only.

payload-components add has always required a repo shaped like the official
Payload website starter. A project scaffolded by create-payload-app fails
detection before any block is even considered: no blocks renderer, no Pages
collection with a layout field, and none of the primitives installed blocks
import. #442 removed the hardcoded-path blocker and explicitly deferred this one.

What it ships

payload-components init --scaffold copies eight files and registers two
collections:

File Why
src/utilities/ui.ts cn() — imported by 69 of the shipped source files
src/fields/link.ts, src/fields/linkGroup.ts the link field blocks compose for calls to action (22)
src/components/Link/index.tsx CMSLink, which renders a stored link (30)
src/components/Media/index.tsx Media, which renders an upload (38)
src/collections/Media.ts the media collection those uploads live in
src/collections/Pages/index.ts the layout blocks field installs register into
src/blocks/RenderBlocks.tsx the renderer map installs wire into

The surface is this small because the research narrowed it: across all 154 shipped
source files there are exactly four consumer imports outside shadcn UI, and
Media is used with exactly two props at all 46 of its call sites.

Three deliberate choices

It reproduces the starter's shape, so it needs no target of its own. A
scaffolded project detects as payload-website-starter, because that is honestly
what it now is. An earlier draft of this change added a third support-matrix
target and widened supportedTargets across all 67 manifests — that turned out to
be pure churn once the test showed detection already succeeding, and was dropped.

Nothing is overwritten. A project that already has its own cn, Media, or
Pages collection keeps it, and a re-run creates nothing. Files are copied through
the same guarded helper --localized already uses — not through shadcn, because
these are not catalog components and must never appear in the catalog.

A config it cannot parse is reported, not rewritten. Registering the
collections is text-anchored on collections: [. Without that anchor the command
prints the two lines to add rather than guessing at the shape of someone's
buildConfig call — that is precisely the kind of edit nobody could review.

The primitives are intentionally thinner than the starter's: CMSLink renders
through next/link and cn rather than a Button a bare app does not have, and
Media covers the two props blocks actually pass, falling back to a plain img
when the upload has no intrinsic dimensions.

Known limitation — please weigh this

This is target code that cannot be typechecked in this repository.
payload-components/source is excluded from tsc and there is no payload
dependency here, by design.

Coverage proves the bundle turns an undetectable project into a detected one, that
it is idempotent, that it never clobbers, and that the config patch is correct in
all three branches. It does not prove the copied code compiles against a
real Payload app. That needs a test:fresh scenario — scaffold a blank app,
init --scaffold, install a block, stop at tsc --noEmit — which needs network
and a database and is not in this change. getCreatePayloadAppArgs already
hardcodes -t website as a one-line seam for it.

It is also worth saying plainly: this duplicates code the official Payload website
starter owns, and that is a real maintenance burden and a divergence risk. It is
why #442 deferred it. If you would rather point bare-app users at the website
starter instead, this PR is the thing to drop.

Verification

Step Result
lint · format:check · tsc · test:registry 0
test:int 505 passed, 1 skipped (+7 for the bundle)
test:e2e (production mode) 397 passed, all 5 batches

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings August 9, 2026 12:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vercel

vercel Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
payload-components Ready Ready Preview Aug 9, 2026 1:16pm
payload-components-97bf Ready Ready Preview Aug 9, 2026 1:16pm

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • dev

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: aa1abe87-8261-4d64-a5bb-8b75bbf18d6b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

Comment @coderabbitai help to get the list of available commands.

Ducksss and others added 2 commits August 9, 2026 21:10
…tries, and template seeding (#447)

Five features that close gaps the install lifecycle work opened, stacked on #442.

**doctor --json + exit codes.** `list` and `diff` gained `--json`; `doctor` did
not, so the install story was not fully CI-checkable. Findings are now collected
rather than printed as they happen, so one run renders either the human report
(byte-identical to before) or JSON. Every finding carries a scope — project,
scripts, state, or a component name — and the exit code separates the two
failures that need different responses: 2 means the project cannot accept
installs at all, 1 means a recorded install drifted.

**Changelogs and content-breaking upgrades.** `update` could move a consumer
from 0.1.0 to 0.2.0 with no way to say what changed, and no way to signal that
stored Payload data needed migrating first. Manifests now carry release notes,
validated on load: real semver, ordered newest first, the manifest's own version
present, and a `breaking` entry must declare its migration — otherwise `update`
could refuse an upgrade without being able to explain why. `diff` prints pending
entries; `update` holds a breaking component back entirely until
--accept-breaking. That is deliberately not --force: one means "discard my local
edits", the other means "I have migrated my content". Seeded from real history —
stats-proof and content-quote were already at 0.2.0 from the logoLabel change.

**payload-components new.** Adding a component touches a dozen files whose shape
is entirely derivable from the slug. The generator writes those, appends to the
mechanical lists, and prints the decisions it refuses to guess: where the
component ranks in the curated catalog order, its dbName abbreviation (checked
against every existing block), the Content model prose, the demo copy.

**Third-party registries.** `add @scope/name` was documented in
content/docs/registry.mdx and never implemented; the pinned shadcn supports it
natively. The boundary is explicit: files only, https only, no Payload wiring, no
install state, and --demo/--localized rejected, because a third-party item has no
manifest to record a contract against.

**add-template --demo.** One draft Page per page of a concept, reusing
writeSeedScript unchanged. The blocker was that the ownership record was keyed to
the first manifest, and every shipped template starts three to five of its pages
with the same block — so those pages would all have claimed the same record.
Ownership identity is now an optional, explicit part of SeedTarget that defaults
to the old behavior, leaving all 27 pinned seed tests untouched.

Also fixes two things found while mapping the authoring surface: hero-aurora and
hero-kinetic existed as doc pages but were missing from the sidebar (the meta
check only ran one direction — now it runs both), and the component-template
README still named four files that have since become derived.

Co-authored-by: Claude Opus 5 <[email protected]>
`payload-components add` has always required a repo shaped like the official
Payload website starter. A project scaffolded by `create-payload-app` fails
detection before any block is even considered: no blocks renderer, no Pages
collection with a `layout` field, and none of the primitives installed blocks
import. PR #442 removed the hardcoded-path blocker; this removes the last one.

`payload-components init --scaffold` copies eight files and registers two
collections. The surface is small because the research narrowed it: across all
154 shipped source files there are exactly four consumer imports outside shadcn
UI — `cn` (69 files), `Media` (38), `CMSLink` (30), `linkGroup` (22) — and `Media`
is used with exactly two props at all 46 of its call sites.

Three deliberate choices:

- **It reproduces the starter's shape, so it needs no target of its own.** A
  scaffolded project detects as `payload-website-starter`, because that is
  honestly what it now is. An earlier draft added a third support-matrix target
  and widened `supportedTargets` across all 67 manifests; that turned out to be
  pure churn and was dropped.
- **Nothing is overwritten.** A project that already has its own `cn`, `Media`,
  or Pages collection keeps it, and a re-run creates nothing. Files are copied
  through the same guarded helper `--localized` uses, not through shadcn — these
  are not catalog components and must never appear in the catalog.
- **A config it cannot parse is reported, not rewritten.** Registering the
  collections is text-anchored on `collections: [`; without that anchor the
  command prints the two lines to add rather than guessing at the shape of
  someone's `buildConfig` call.

The primitives are intentionally thinner than the starter's: `CMSLink` renders
through `next/link` and `cn` rather than a `Button` a bare app does not have, and
`Media` covers the two props blocks actually pass. They are the consumer's code
after install — the CLI does not track or update them.

Known limitation: this is target code that cannot be typechecked in this
repository (payload-components/source is excluded from tsc, and there is no
`payload` dependency here). Coverage proves the bundle turns an undetectable
project into a detected one, that it is idempotent, and that it never clobbers.
Proving it *compiles* against a real Payload app needs a fresh-smoke scenario —
network plus a database — which is not in this change.

Co-Authored-By: Claude Opus 5 <[email protected]>
@Ducksss
Ducksss force-pushed the claude/base-bundle branch from 83b167b to 0c8d260 Compare August 9, 2026 13:12
@Ducksss

Ducksss commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

Superseded by a PR targeting dev directly — GitHub's retarget API kept erroring after the stack merged, and this PR's base branch is now stale. Same commit, rebased onto dev.

This branch was successfully deployed

2 active deployments
Preview – payload-components — 0c8d2604 Deployed Aug 9, 2026 by vercel[bot]
Preview – payload-components-97bf — 0c8d2604 Deployed Aug 9, 2026 by vercel[bot]
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