Back to Plate

Fix shadcn registry kit dependencies

docs/plans/2026-06-14-fix-shadcn-registry-kit-dependencies.md

53.2.016.6 KB
Original Source

Fix shadcn registry kit dependencies

Objective: Fix GitHub issue #4971 by making Plate registry editor kit and editor block files install into the configured shadcn components alias so relative plugin imports resolve.

Goal plan: docs/plans/2026-06-14-fix-shadcn-registry-kit-dependencies.md

Task source:

  • type: GitHub issue
  • id / link: https://github.com/udecode/plate/issues/4971
  • title: [Bug]: relative imports fail due to CLI install
  • acceptance criteria: shadcn CLI installs editor-base-kit, editor-kit, their ./plugins/* dependencies, and editor block component files into the same configured components editor directory.

Completion threshold:

  • Registry source metadata maps every components/editor/* and blocks/*/components/editor/* file to @components/editor/*.
  • editor-base-kit relative ./plugins/* imports and editor block imports resolve after [email protected] add, including custom aliases.components.
  • Registry changelog records the registry-only user-visible fix, and source-only changelog rows do not claim unrelated same-day package releases.
  • Focused tests, registry source check, www typecheck, lint, shadcn smoke proof, and autoreview pass.

Verification surface:

  • bun test apps/www/src/registry/registry.test.ts 'apps/www/src/app/registry/changelog/[event]/route.test.ts' apps/www/src/app/registry/changelog/components.json/route.test.ts apps/www/src/app/registry/changelog/index.json/route.test.ts
  • node --test tooling/scripts/generate-ui-changelog-entries.test.mjs
  • pnpm --filter www exec tsx --tsconfig ./scripts/tsconfig.scripts.json scripts/check-registry-source.mts
  • pnpm --filter www typecheck
  • pnpm lint:fix
  • pnpm dlx [email protected] add <local registry item> --cwd <tmpdir> --yes --overwrite --silent smoke tests for custom aliases.components.
  • .agents/skills/autoreview/scripts/autoreview --mode local ...

Constraints:

  • Do not edit generated registry build output or run build:registry.
  • Registry-only user-visible work uses tooling/data/plate-ui-changelog.mdx plus generated /registry/changelog/* JSON, not a package changeset.
  • Do not create a PR, commit, push, or issue comment without an explicit user request.
  • Preserve explicit registry targets such as block page targets.

Boundaries:

  • Source of truth: GitHub issue #4971 title/body/comments fetched with gh issue view ... --comments --json.
  • Allowed edit scope: apps/www registry metadata/checks/changelog routes, changelog generator tests, and this goal plan.
  • Browser surface: applies because apps/www/** changed, but Browser/browser-use was not exposed by tool_search; route tests and CLI smoke cover the affected JSON/install behavior.
  • Tracker sync: N/A because repo policy requires explicit PR/comment request, and none was given.
  • Non-goals: package runtime changes, registry build output, unrelated docs plan file, PR creation.

Output budget strategy:

  • Used focused sed and rg reads, targeted tests, capped command output, and short smoke-test file lists instead of broad build or full test output.

Blocked condition:

  • Only Browser proof is blocked: tool_search exposed thread and automation tools, not Browser/browser-use. Code and CLI verification continued without browser proof.

Task state:

  • task_type: bug fix
  • task_complexity: medium
  • current_phase: closeout
  • current_phase_status: complete
  • goal_status: ready-to-close

Current verdict:

  • verdict: fixed
  • confidence: high
  • next owner: user
  • reason: focused tests, typecheck, lint, shadcn CLI smoke tests, and final autoreview are clean.

Start Gates:

GateAppliesEvidence
Skill analysis before editsyesLoaded task, autogoal, shadcn, plate-ui, changeset, and autoreview guidance before closeout.
Active goal checked or createdyesActive goal created for issue #4971 with this plan path.
Source of truth read before editsyesgh issue view 4971 --repo udecode/plate --comments --json ... read title/body/comments.
Tracker comments and attachments readyesGitHub issue comments included in source fetch; no attachments needed.
Video transcript evidence requirednoIssue has no video or screen recording.
Existing-code patterns readyesRead registry item creation, registry checks, changelog generator, and editor block files.
TDD decisionyesAdded focused registry/changelog tests around current behavior instead of dead-path removal assertions.
Branch decisionnoUser did not ask for branch, commit, push, or PR.
Release artifact decisionyesRegistry changelog required; package changeset not applicable.
Browser tool decisionyesBrowser proof blocked because Browser/browser-use tools were unavailable through tool_search.
PR expectation decisionyesN/A: no explicit PR request and repo policy forbids PR work without it.
Tracker sync expectation decisionyesN/A: no explicit tracker comment request and no PR exists.
Package/API pack selectedyesRegistry-only package/API surface selected.
Barrel/export impact decisionyesN/A: no package exports or barrel-owned files changed.

Work Checklist:

  • Objective, completion threshold, verification surface, constraints, boundaries, and blocked condition are concrete.
  • Task source classified with issue link, title, acceptance criteria, likely files, browser surface, and root-cause layer.
  • Video evidence marked N/A because issue has no video.
  • Nearby repo instructions and implementation patterns read before edits.
  • Implementation fixes the registry metadata ownership boundary instead of patching individual kit imports.
  • Release artifact requirement recorded as registry changelog, not package changeset.
  • Final handoff shape decided: no PR/tracker sync; concise final with tests and browser caveat.
  • Branch handling recorded as N/A because no branch/PR request.
  • Local-env-rot retry policy recorded as N/A because failures matched code/test expectations, not install corruption.
  • Workspace authority recorded: commands ran in /Users/zbeyens/git/plate.
  • High-risk note recorded for public registry install behavior.
  • Autoreview selected and rerun until clean.
  • Agent-native review marked N/A because no .agents/**, skills, hooks, prompts, or agent-action tooling changed.
  • Output budget discipline recorded and followed.
  • Public API/package boundary impact recorded as registry metadata surface only.
  • Release artifact matrix applied: registry changelog updated and generated JSON refreshed.
  • Changeset work marked N/A because no package versioned API/runtime delta.
  • Registry-only work updated tooling/data/plate-ui-changelog.mdx and generated changelog JSON.
  • No-artifact decision marked N/A because registry changelog artifact applies.
  • Compatibility decision explicit: preserve shadcn configured aliases.components via @components targets.
  • Package-owned proof recorded with www typecheck and registry source check.
  • Barrel/export generation marked N/A because exports and exported file layout did not change.

Completion Gates:

GateAppliesRequired actionEvidence
Named verification thresholdyesRun all named checksAll commands in Verification evidence passed.
Bug reproduced before fixyesRecord issue-level repro and CLI smokeIssue repro read; smoke proved raw targets miss custom alias while @components targets install correctly.
Targeted behavior verificationyesTest registry metadata and shadcn install pathsRegistry tests plus [email protected] custom-alias smokes passed.
TypeScript or typed config changedyesRun www typecheckpnpm --filter www typecheck passed.
Package exports or file layout changednoRun pnpm brl only if exports changedN/A: registry metadata targets changed, not package exports.
Package manifests, lockfile, or install graph changednoRun install only if graph changedN/A: no manifests or lockfiles changed.
Agent rules or skills changednoRun skill sync only for agent rule editsN/A.
Workspace authority proofyesRun checks in owning repo/appCommands ran in /Users/zbeyens/git/plate; www owns registry metadata.
Browser surface changedyesCapture Browser proof or caveatBlocked: Browser/browser-use tools unavailable through tool_search; route tests cover JSON surface.
Browser final proofyesAttach screenshot or caveatCaveat recorded: no Browser tool exposed.
CI-controlled template output changednoRestore template output if touchedN/A.
Package behavior or public API changednoAdd changeset if package API/runtime changedN/A: registry metadata/changelog only.
Registry-only component work changedyesUpdate registry changelog and generated JSONnode tooling/scripts/generate-ui-changelog-entries.mjs --write ran; generated event is unresolved source-only.
Docs or content changedyesVerify incidental docs/changelog claimsChangelog route tests and generator tests passed.
High-risk mini gateyesRecord failure mode and proofFailure mode: shadcn flattens targetless editor files; proof: custom-alias CLI smokes and registry tests.
Agent-native reviewnoLoad reviewer only for agent toolingN/A.
Local install corruption suspectednoRun reinstall only for env-rot signsN/A.
AutoreviewyesRerun until no accepted/actionable findingsFinal autoreview clean: no accepted/actionable findings.
PR create or updatenoPR requires explicit requestN/A.
Task-style PR body verifiednoVerify only when PR existsN/A.
PR proof image hostingnoHost images only for PR bodyN/A.
Tracker sync-backnoComment only when requested or PR existsN/A.
Final handoff contractyesFill exact outcome/caveats/testsFinal response will list fix, proof, Browser caveat, and no PR.
Final lintyesRun pnpm lint:fixPassed with no fixes after final changes.
Output budget disciplineyesConfirm scoped outputFollowed with capped output; one noisy rg recovered with targeted searches.
Goal plan completeyesRun autogoal completion checkerTo run after this update.
Public API / package boundary proofyesSource-audit registry public surfacecheck-registry-source.mts and tests assert target contract.
Release artifact classificationyesRecord artifact classRegistry-only user-visible install metadata.
Published package changesetnoAdd changeset only for package deltaN/A.
Registry changelogyesUpdate source and generated JSONDone.
No release artifactnoRecord reason if no artifactN/A.
Package typecheck/build/testyesRun owning package checkspnpm --filter www typecheck passed.
Barrel/export generationnoRun pnpm brl if exports changedN/A.

Phase / pass table:

PhaseStatusEvidenceNext
Intake and source readcompleteGitHub issue #4971 read; repo/skill instructions loaded.done
ImplementationcompleteRegistry target normalization, source checks, changelog generator, and generated changelog updated.done
VerificationcompleteTests, typecheck, lint, shadcn smokes, and autoreview passed.done
PR / tracker syncn/aNo explicit PR/comment request; repo policy forbids unsolicited PR/comment.done
CloseoutcompletePlan updated; completion checker remains final mechanical step.final response

Findings:

  • Root cause: targetless registry component files let shadcn infer default component paths, flattening editor kit files so ./plugins/* imports fail.
  • Follow-up root cause: editor block component files under blocks/*/components/editor/* need the same configured-alias target treatment.
  • Changelog root cause: source-only registry changelog rows could borrow unrelated same-day package release metadata.

Decisions and tradeoffs:

  • Use @components/editor/* targets because [email protected] maps @components through the consuming app's configured aliases.components.
  • Normalize centrally in createPlateRegistryItems() so new editor kit and block editor files inherit the contract.
  • Keep source-only changelog events unresolved until PR/commit/release evidence exists.

Implementation notes:

  • apps/www/src/registry/registry.ts now adds targets for any file path containing components/editor/ unless it already has an explicit target.
  • apps/www/scripts/check-registry-source.mts enforces that contract for kits and editor blocks.
  • apps/www/src/registry/registry.test.ts covers kit dependencies and editor block component files.
  • tooling/scripts/generate-ui-changelog-entries.mjs refuses release matching for source-only change units.

Review fixes:

  • First autoreview finding fixed: raw components/editor/* targets changed to alias-aware @components/editor/*.
  • First autoreview finding fixed: source-only changelog event no longer claims unrelated v53.1.3 list release.
  • Second autoreview finding fixed: blocks/*/components/editor/* files now receive alias-aware targets.
  • Final autoreview clean: no accepted/actionable findings.

Error attempts:

Error / failed attemptCountNext different moveResolution
Initial shadcn smoke lacked tsconfig.json1Add minimal tsconfig/package scaffoldSmoke reran successfully.
Synthetic block smoke did not materialize page file1Narrow smoke to block component files/import rewritesComponent smoke proved the flagged path.
Broad rg pattern invoked shell backticks1Rerun targeted quoted searchesStale generated event confirmed removed.

Verification evidence:

  • bun test apps/www/src/registry/registry.test.ts 'apps/www/src/app/registry/changelog/[event]/route.test.ts' apps/www/src/app/registry/changelog/components.json/route.test.ts apps/www/src/app/registry/changelog/index.json/route.test.ts passed: 8 tests, 170 expects.
  • node --test tooling/scripts/generate-ui-changelog-entries.test.mjs passed: 8 tests.
  • pnpm --filter www exec tsx --tsconfig ./scripts/tsconfig.scripts.json scripts/check-registry-source.mts passed.
  • pnpm --filter www typecheck passed, including docs source parity, registry source check, app TS, and package integration TS.
  • pnpm lint:fix passed with no fixes after final changes.
  • pnpm dlx [email protected] add custom aliases.components smoke installed @components/editor/* to src/shared/components/editor/* and preserved ./plugins/basic-blocks-base-kit.
  • pnpm dlx [email protected] add block component smoke installed blocks/editor-ai/components/editor/* targets to src/shared/components/editor/* and rewrote imports to @/shared/components/editor/*.
  • Final autoreview passed: no accepted/actionable findings; patch correct.

Final handoff contract:

  • PR line: N/A, no PR requested.
  • Issue / tracker line: N/A, no tracker comment requested.
  • Confidence line: high.
  • Flow table:
    • Reproduced: issue #4971 read; shadcn target behavior smoked.
    • Verified: focused tests, www typecheck, lint, shadcn smokes, autoreview.
  • Browser check: blocked because Browser/browser-use tools were unavailable.
  • Outcome: registry installs preserve editor kit/plugin and editor block component paths under configured components alias.
  • Caveat: no in-app browser screenshot; the affected surface is registry JSON/install metadata and was verified with route tests plus real shadcn CLI smokes.
  • Design:
    • Chosen boundary: central registry item target normalization.
    • Why not quick patch: individual kit edits would miss future editor files.
    • Why not broader change: package code and registry build output do not own this install-path contract.
  • Verified: commands listed in Verification evidence.
  • PR body verified: N/A.

Final handoff / sync:

  • PR: N/A, not requested.
  • Issue / tracker: N/A, not requested.
  • Browser proof: blocked; Browser/browser-use unavailable through tool_search.
  • Caveats: no package changeset; registry changelog event remains unresolved until real release provenance exists.

Open risks:

  • No open code risks found by final autoreview. Browser proof could not be captured because the required tool was unavailable, but shadcn CLI smoke directly verified the install behavior.

Reboot status:

QuestionAnswer
Where am I?Closeout after final clean autoreview.
Where am I going?Run autogoal completion checker, mark goal complete, send final response.
What is the goal?Fix issue #4971 shadcn registry install paths for editor kits and blocks.