Back to Plate

sync shadcn copy fallback

docs/plans/2026-05-30-sync-shadcn-copy-fallback.md

53.0.86.4 KB
Original Source

sync shadcn copy fallback

Objective: Apply the accepted sync-shadcn rows for mdx/code-command-yarn-tab and mdx/copy-button-fallback: keep the already-synced yarn tab row verified, implement upstream-style copy fallback semantics for Plate copy helpers, mark the copy fallback row synced, and regenerate the sync dashboard.

Completion threshold: Complete when code-command-yarn-tab and copy-button-fallback both resolve to synced in docs/sync/shadcn/deltas.json and docs/sync/shadcn/dashboard.json, the copy helpers use a hidden-textarea fallback and only show copied state after successful writes, yarn command support remains wired through command props, types, config, and copy UI, the dashboard is regenerated, lastSyncedCommit stays unchanged, and all verification commands recorded below pass.

Verification surface:

  • apps/www/src/components/copy-button.tsx
  • apps/www/src/components/code-block-command.tsx
  • apps/www/src/components/command-menu.tsx
  • apps/www/src/lib/rehype-npm-command.ts
  • apps/www/src/types/unist.ts
  • apps/www/src/hooks/use-config.ts
  • docs/sync/shadcn/deltas.json
  • docs/sync/shadcn/dashboard.json
  • docs/sync/shadcn/status.json

Constraints:

  • Do not run build:registry.
  • Do not advance docs/sync/shadcn/status.json:lastSyncedCommit.
  • Do not mutate unrelated sync rows.
  • Preserve Plate analytics and dropdown copy helpers while adopting upstream success semantics.

Boundaries:

  • In scope: source edits for copy behavior, sync row state, dashboard regeneration, and this closeout plan.
  • Out of scope: broader MDX primitive adoption, screenshots for unrelated rows, registry output, baseline advancement, and unrelated shadcn deltas.

Blocked condition: Blocked only if the copy helper change cannot pass www typecheck, the dashboard cannot regenerate from deltas.json, or row state cannot be verified in both durable JSON surfaces.

Start Gates:

GateAppliesEvidence
autogoal loaded and active goal createdyesActive goal created for the two accepted rows before mutable edits.
sync-shadcn apply mode establishedyesUser requested explicit pending -> synced row transitions.
Current row state readyesdeltas.json showed yarn already synced and copy fallback awaiting sync.
Upstream reference checkedyes../shadcn/apps/v4/components/copy-button.tsx confirmed fallback and success-gated behavior.
Baseline semantics readyesstatus.json keeps lastSyncedCommit at 4a4dc8eb0fc793d8e9225e780183ad605f15d2c2.

Work Checklist:

  • Verified code-command-yarn-tab already has local yarn command support.
  • Added hidden-textarea fallback for restricted clipboard environments.
  • Made copyToClipboardWithMeta return a success boolean.
  • Gated copied state on successful clipboard writes in copy buttons.
  • Preserved Plate copy analytics and dropdown helpers.
  • Marked copy-button-fallback synced in deltas.json.
  • Regenerated docs/sync/shadcn/dashboard.html and dashboard.json.
  • Verified row state, JSON parse, source evidence, lint, and www typecheck.
  • Left lastSyncedCommit unchanged because only selected rows were applied.

Completion Gates:

GateAppliesRequired actionEvidence
Accepted row stateyesVerify both requested rows are syncedDashboard JSON extraction returned both rows with state: synced.
Yarn row preservationyesVerify yarn source wiring remains presentrg found __yarnCommand__, yarn config union, and yarn command tab/copy support.
Copy fallback behavioryesVerify fallback and success-gated state existrg found legacyCopyToClipboard, async copy helper, awaited copy calls, and gated state updates.
Dashboard regenerationyesRun sync dashboard builderpnpm sync-shadcn dashboard completed and wrote dashboard HTML/JSON.
JSON validityyesParse durable sync JSONNode parsed deltas.json and dashboard.json successfully.
Source typecheckyesRun app typecheck after lint fixpnpm --filter www typecheck passed after final lint formatting.
Lint formattingyesRun repo lint fixerpnpm lint:fix passed after checking 3154 files.
Dashboard script syntaxyesCheck dashboard builder syntaxnode --check .agents/rules/sync-shadcn/scripts/build-dashboard.mjs passed.
Baseline advancementnoKeep sync baseline unchangedstatus.json still reports lastSyncedCommit 4a4dc8eb0fc793d8e9225e780183ad605f15d2c2.
Browser proofnoNo visible layout change in this apply sliceCopy behavior is source/typechecked; no screenshot needed for this row.
Registry/template outputnoAvoid CI-controlled generated registry/template outputNo registry build or template edit performed.
Goal plan completeyesRun autogoal completion checkRecorded for final closeout.

Phase / pass table:

PhaseStatusEvidenceNext
Intake and baseline readdoneRow states and status baseline readnone
ImplementationdoneCopy fallback and success-gated state implementednone
Sync metadatadonecopy-button-fallback marked synced and dashboard regeneratednone
VerificationdoneTypecheck, lint, JSON, syntax, and source audits passednone
CloseoutdoneThis plan records final evidencenone

Verification evidence:

  • pnpm sync-shadcn dashboard passed and wrote docs/sync/shadcn/dashboard.html plus docs/sync/shadcn/dashboard.json.
  • node --check .agents/rules/sync-shadcn/scripts/build-dashboard.mjs passed.
  • Node JSON parse passed for docs/sync/shadcn/deltas.json and docs/sync/shadcn/dashboard.json.
  • Dashboard JSON extraction returned code-command-yarn-tab and copy-button-fallback with state: synced.
  • Focused rg audit found yarn command plumbing and copy fallback/success semantics in the source files listed above.
  • pnpm lint:fix passed after checking 3154 files.
  • pnpm --filter www typecheck passed after the lint formatting pass.

Reboot status: The apply slice is complete. If resumed, only run the autogoal completion check and close the active goal; no implementation or metadata work remains.

Open risks: None for these two rows. Remaining MDX and Code Primitive rows are separate dashboard work and intentionally remain outside this apply slice.