Back to Plate

Modernize Plate registry contract

docs/plans/2026-06-02-modernize-plate-registry-contract.md

53.0.815.0 KB
Original Source

Modernize Plate registry contract

Objective: Keep Plate registry source aligned with shadcn registry conventions while making generated public item JSON safe for direct URL installs.

Task source:

  • type: user request
  • title: simplify Plate registry toward current shadcn registry behavior
  • acceptance criteria: source registry uses @plate/* for Plate self-dependencies and bare names for upstream shadcn items; public generated item JSON rewrites Plate self-dependencies to same-base .json URLs; direct/local install adapters keep compatibility; docs do not recommend unsafe version-pinned raw aggregate installs.

Completion threshold:

  • Registry dependency helpers enforce the source-vs-public split.
  • Build/check scripts assert the public generated contract has no @plate/* dependencies.
  • Docs registry output follows the same public URL behavior.
  • Installation docs avoid raw aggregate JSON for version-pinned docs.
  • Browser, typecheck, lint, focused tests, source checks, and autoreview are clean.
  • node .agents/skills/autogoal/scripts/check-complete.mjs docs/plans/2026-06-02-modernize-plate-registry-contract.md passes.

Verification surface:

  • pnpm --filter www exec bun test scripts/registry-dependencies.test.mts src/lib/plate-init.test.ts src/app/r/registries.json/route.test.ts
  • pnpm --filter www exec tsx --tsconfig ./scripts/tsconfig.scripts.json scripts/check-registry-source.mts
  • pnpm --filter www exec tsx --tsconfig ./scripts/tsconfig.scripts.json scripts/check-docs-source-parity.mts
  • pnpm lint:fix
  • pnpm --filter www typecheck
  • Browser proof on http://localhost:3003/r/registries.json, http://localhost:3003/init/md, /docs/installation/docs, and /cn/docs/installation/docs
  • .agents/skills/autoreview/scripts/autoreview --mode local

Constraints:

  • Do not run build:registry locally; generated registry output is CI-owned.
  • Do not change package exports, manifests, or templates.
  • Preserve public @plate registry install docs and init flow.
  • Do not commit or push unless the user asks.

Boundaries:

  • Source of truth: apps/www/src/registry/**, apps/www/scripts/**, install docs, and .agents/rules/shadcn-parity.mdc.
  • Allowed edit scope: registry dependency helpers/checks/build scripts, local template adapter, install docs warning, agent rule, and this plan.
  • Browser surface: exposed registry/init routes plus rendered install docs.
  • Tracker sync: N/A, chat-only task.
  • Non-goals: rebuilding public/r, redesigning registry item content, package release work, or replacing shadcn CLI behavior.

Output budget strategy:

  • Searches were scoped to registry/docs keywords and capped with max_output_tokens; broad generated output was not streamed.

Blocked condition:

  • None. Local dev server was already available on port 3003.

Task state:

  • task_type: implementation
  • task_complexity: medium
  • current_phase: final response
  • current_phase_status: complete
  • next_phase: final response
  • goal_status: plan-only because an unrelated paused active goal prevented creating a new autogoal state.

Current verdict:

  • verdict: complete
  • confidence: high
  • next owner: user
  • reason: source, public output, docs, and agent rule contracts agree.

Start Gates:

GateAppliesEvidence
Skill analysis before editsyesautogoal/task/shadcn/browser/autoreview workflows used
Active goal checked or createdyesexisting unrelated paused goal blocked new goal; file plan used instead
Source of truth read before editsyesregistry scripts, source registry files, install docs, and shadcn parity rule read
Tracker comments and attachments readN/Ano tracker
Video transcript evidence requiredN/Ano video
docs/solutions checked for non-trivial existing-code workN/Alocal source ownership was direct and sufficient
TDD decision before behavior change or bug fixyesfocused helper/check tests added before closeout
Branch decision for code-changing taskN/Ano user request to branch
Release artifact decisionyesno package release; no changeset
Browser tool decision for browser surfaceyesBrowser used on local dev server
PR expectation decisionN/Ano PR requested
Tracker sync expectation decisionN/Ano tracker
Output budget strategy recordedyesscoped searches and capped output
Browser pack selectedyeslocal docs/registry route proof
Browser route / app surface identifiedyes/r/registries.json, /init/md, install docs routes
Browser tool decision recordedyesin-app Browser with Node REPL bridge
Console/network caveat policy recordedyesroute/text checks only; no interactive console state relevant
Docs pack selectedyesinstallation docs warning changed
docs-creator loadedN/Awarning is a narrow correctness fix
Docs lane selectedyesinstallation docs
Target docs and nearest sibling docs readyesEnglish and Chinese installation docs
Docs style doctrine readyescurrent-state warning, no changelog framing
Documented source owner identifiedyesregistry generator/check scripts own install behavior

Work Checklist:

  • Objective includes outcome, completion threshold, verification surface, constraints, boundaries, and blocked condition.
  • Task source classified with source type, title, acceptance criteria, likely files/routes, browser surface, and root-cause layer.
  • Required video or screen-recording evidence is N/A: no video.
  • Nearby repo instructions and implementation patterns read before edits.
  • Implementation fixes the right ownership boundary: source registry names stay authored; public generated output rewrites direct-install dependencies.
  • Release artifact requirement recorded: N/A, no package release or registry component changelog.
  • Final handoff shape decided: concise chat summary with commands/browser/review.
  • Branch handling recorded: N/A, no branch requested.
  • Local-env-rot retry policy recorded: N/A, no surprising install corruption.
  • Workspace authority recorded: all commands ran in /Users/zbeyens/git/plate.
  • High-risk note recorded: public registry contract can break direct installs; source checks and tests assert no @plate/* public deps.
  • Review/autoreview target selected: dirty local review.
  • Agent-native review decision recorded: N/A, rule wording only; autoreview covered the contradiction.
  • Output budget discipline recorded and followed.
  • Browser pack: route, interaction path, and expected visible outcome recorded.
  • Browser pack: browser proof uses repo-approved Browser tool.
  • Browser pack: console/network errors N/A for static JSON/markdown route proof; HTTP route health checked where Browser navigation timing was suspect.
  • Browser pack: exact route proof ready for final handoff.
  • Docs pack: docs lane, target docs, and source owner recorded.
  • Docs pack: named routes/components backed by registry source and checks.
  • Docs pack: docs use current-state reference voice.
  • Docs pack: links/routes verified by Browser or HTTP.

Completion Gates:

GateAppliesRequired actionEvidence
Named verification thresholdyesrun commands and browser proofall verification commands listed below
Bug reproduced before fixyesshadcn build probe proved @plate/* is not rewritten by CLItemp registry probe kept @plate/child unchanged
Targeted behavior verificationyesfocused tests and source checkspassed
TypeScript or typed config changedyespnpm --filter www typecheckpassed
Package exports or file layout changedN/Ano package exports/layoutN/A
Package manifests, lockfile, or install graph changedN/Ano manifest editN/A
Agent rules or skills changedyesrun pnpm install after rule editpassed
Workspace authority proofyesowning app commands in /Users/zbeyens/git/platepassed
Browser surface changedyesBrowser route proofpassed
Browser final proofyesexact Browser route booleans recordedpassed
CI-controlled template output changedN/Ano template output editedN/A
Package behavior or public API changedN/Adocs app registry behavior onlyN/A
Registry-only component work changedN/Ano registry component content changeN/A
Docs or content changedyestypecheck and Browser proofpassed
High-risk mini gateyesdirect URL dependency failure mode checkedpublic output converts Plate deps to same-base URLs
Agent-native review for agent/tooling changesN/Ano action tooling behavior changedN/A
Local install corruption suspectedN/Ano corruption signalN/A
Autoreview for non-trivial implementation changesyeslocal autoreview until cleanclean
PR create or updateN/Ano PR requestedN/A
Task-style PR body verifiedN/Ano PRN/A
PR proof image hostingN/Ano PRN/A
Tracker sync-backN/Ano trackerN/A
Final handoff contractyesconcise final responseready: final response will list changed contract and proof commands
Final lintyespnpm lint:fixpassed
Output budget disciplineyesno unbounded streampassed
Goal plan completeyesnode .agents/skills/autogoal/scripts/check-complete.mjs docs/plans/2026-06-02-modernize-plate-registry-contract.mdpassed
Browser interaction proofyesapproved Browser route proofpassed
Browser console/network checkN/Astatic route/text proof; HTTP 200 checked for localized routeN/A: no interactive browser flow or network mutation
Browser final proof artifactyesexact URL/text booleans recordedpassed
Docs source-backed claim audityesinstall warning aligned with generated dependency contractpassed: warning matches public dependency rewrite behavior
Docs links / routes / previewsyesinstall docs routes renderpassed: English and Chinese routes rendered in Browser
Docs MDX/content parseryespnpm --filter www typecheck runs Fumadocs source generationpassed
Plugin page specificsN/Ano plugin pageN/A: install docs only

Phase / pass table:

PhaseStatusEvidenceNext
Intake and source readcompleteregistry scripts, docs, shadcn rule readimplementation
Implementationcompletehelper/build/docs/rule patchesverification
Verificationcompletetests/source checks/lint/typecheck/browserautoreview
Review fixescompletefixed raw docs URL warning, rule contradiction, unfinished plan stub; final autoreview cleanfinal response
Closeoutcompletefinal plan check ready and final response pendingfinal response

Findings:

  • The shadcn CLI does not rewrite custom @plate/* registryDependencies for direct item JSON installs.
  • Public generated Plate registry dependencies must be same-base .json URLs.
  • Raw GitHub aggregate docs item installs can mix versions through transitive live registry dependencies.

Decisions and tradeoffs:

  • Keep @plate/* as the authored source contract because it is compact, shadcn-like, and checkable.
  • Emit same-base URLs only at the public generated boundary because direct URL installs need resolvable transitive Plate items.
  • Do not run build:registry; CI owns generated public/r.
  • Keep bare shadcn item names, not @shadcn/*.

Implementation notes:

  • registry-dependencies.mts owns source, public, and local-file dependency normalization.
  • build-registry.mts and build-docs-registry.mts transform source dependencies before public output.
  • check-registry-source.mts and check-docs-source-parity.mts assert both source and public contracts.
  • prepare-local-template-registry.mjs keeps old URL/local sync compatibility.
  • Install docs now reject raw aggregate JSON for version-pinned full docs.
  • shadcn-parity.mdc now documents the source-vs-public split.

Review fixes:

  • Fixed autoreview P3 by replacing unsafe versioned raw aggregate docs guidance in English and Chinese docs.
  • Fixed autoreview P2 by aligning shadcn-parity.mdc with generated public same-base URL output.
  • Removed unrelated unfinished docs/plans/2026-06-02-fix-search-result-order.md template stub.

Error attempts:

Error / failed attemptCountNext different moveResolution
Docs source parity failed when run without fresh Fumadocs source1ran pnpm --filter www build:source then parity checkpassed
Browser CN route first timed out waiting on navigation1verified HTTP 200 and read body after normal Browser navigationpassed

Verification evidence:

  • pnpm --filter www exec bun test scripts/registry-dependencies.test.mts src/lib/plate-init.test.ts src/app/r/registries.json/route.test.ts: 11 passed, 37 expects.
  • pnpm --filter www exec tsx --tsconfig ./scripts/tsconfig.scripts.json scripts/check-registry-source.mts: passed.
  • pnpm --filter www exec tsx --tsconfig ./scripts/tsconfig.scripts.json scripts/check-docs-source-parity.mts: passed after source generation.
  • pnpm lint:fix: passed, no fixes applied.
  • pnpm --filter www typecheck: passed.
  • Browser /r/registries.json: @plate registry entry is https://platejs.org/r/{name}.json.
  • Browser /init/md: includes npx shadcn@latest add @plate/editor-basic and the Plate preset.
  • Browser /docs/installation/docs: new raw aggregate warning present, old unsafe step absent.
  • Browser /cn/docs/installation/docs: translated raw aggregate warning present, old unsafe step absent.
  • pnpm install: passed and synced .agents/skills/shadcn-parity/SKILL.md.
  • .agents/skills/autoreview/scripts/autoreview --mode local: clean, no accepted/actionable findings.

Final handoff contract:

  • PR line: N/A, no PR requested.
  • Issue / tracker line: N/A.
  • Confidence line: high.
  • Flow table:
    • Reproduced: shadcn CLI probe proved custom @plate/* is not rewritten.
    • Verified: focused tests, source checks, lint, typecheck, Browser, and autoreview.
  • Browser check: route/text proof on registry, init, English docs, and Chinese docs.
  • Outcome: Plate registry source follows shadcn-style names while public generated output remains direct-install-safe.
  • Caveat: public/r was not rebuilt locally by policy; CI will generate it.
  • Design:
    • Chosen boundary: authored source stays namespaced; generated public output rewrites.
    • Why not quick patch: changing only one item would leave direct installs broken elsewhere.
    • Why not broader change: forking shadcn CLI or replacing registry source shape is unnecessary.
  • Verified: focused tests, source checks, lint, typecheck, Browser, rule sync, autoreview, and plan checker.
  • PR body verified: N/A.

Reboot status:

  • current_phase: final response
  • next_action: send concise final handoff
  • blocker: none

Open risks:

  • None.

Timeline:

  • 2026-06-02T12:29:44.236Z Task goal plan created.
  • 2026-06-02T12:55:00.000Z Registry contract implementation and review fixes recorded.
  • 2026-06-02T13:10:00.000Z Final autoreview clean.