Skip to content

Port shadcn /create customizer into shadify with CopilotKit App mode#6

Draft
GeneralJerel wants to merge 5 commits intomainfrom
shadify-port
Draft

Port shadcn /create customizer into shadify with CopilotKit App mode#6
GeneralJerel wants to merge 5 commits intomainfrom
shadify-port

Conversation

@GeneralJerel
Copy link
Copy Markdown
Collaborator

Summary

  • Ports the shadcn /create theme customizer into shadify's UI, adapted for Vite/React Router via Next.js shims (dynamic, font/google, image, link, navigation, script, form).
  • Wires CopilotKit App mode into the customizer: permanent chat panel, chat tools for driving the customizer, randomize flow with a turn-scoped guard, and a custom Panel 03 component.
  • Hardens the port: font loading, preview tooltip crash fixes, and randomize loop regressions.

Commits

  • 5387bdb feat: port shadcn /create customizer into shadify with CopilotKit App mode
  • f551629 fix: render /create customizer correctly and make chat a permanent panel
  • 6f3f7ca feat: add CopilotKit chat tools for /create customizer
  • 36011f6 fix: harden /create customizer — fonts, preview tooltip crash, randomize loop
  • 6936b94 feat: panel 03 custom component + randomize turn-scoped guard

Test plan

  • Run apps/ui dev server and open /create; verify customizer renders with preview, fonts, and tooltips.
  • Exercise CopilotKit chat tools (apply preset, tweak colors/radius/fonts, randomize) and confirm the preview reflects each action.
  • Trigger randomize repeatedly to confirm the turn-scoped guard prevents loops.
  • Validate Panel 03 custom component renders in the preview.
  • Run pnpm -w test / typecheck for apps/ui.

🤖 Generated with Claude Code

GeneralJerel and others added 5 commits April 19, 2026 19:10
… mode

Adds a /create route backed by the shadcn design-system customizer: 33
pickers driving URL-synced design params and an inline preview of the
selected registry item. Integrates the CopilotKit agent via App mode so
users can drive the pickers conversationally (e.g. "make it pink with a
serif body font"). Chat at / remains unchanged.

- Router: adds react-router-dom v7 with BrowserRouter wrapping
  / (chat) and /create
- URL state: nuqs via its react-router v7 adapter; useDesignSystemSearchParams
  ported 1:1 with full preset encode/decode round-trip (?preset=b0)
- Inline preview: replaces shadcn's iframe/postMessage flow with a scoped
  DesignSystemProvider that injects CSS vars under [data-design-system-root]
  so theme tokens do not leak to the chat chrome
- Registry: bases/__index__ + all base/radix trees bulk-copied; api.ts ported
  without server-only; React.lazy chain preserved
- Next.js shims: 7 runtime shims (image, link, script, form, navigation,
  dynamic, font/google) wired via Vite and tsconfig aliases so ~50 ported
  files do not need hand edits
- Keyboard shortcuts preserved: R (randomize), Shift+R (reset), O (open
  preset), D (preview dark mode), Cmd+P (action menu), Cmd+Z / Cmd+Shift+Z
  (history)
- Agent: AgentState extended with design_params; system prompt updated with
  full param vocabulary; useDesignSystemCoAgent hook exposes current params
  via useCopilotReadable and registers updateDesignSystem action that writes
  URL state; CopilotSidebar mounted on /create for inline chat

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Import registry style-*.css and register style-* custom variants so the
  .cn-* component classes carrying all card/button visuals actually load.
- Map --font-sans/--font-heading into @theme inline and scope the global
  h1-h6 display-font rule so it no longer leaks into the preview.
- Work around @copilotkit/react-ui's broken bare ".dark" selector in
  input.css that was clobbering text color in the customizer Card.
- Replace the toggleable CopilotSidebar on /create with a permanent
  right-side CopilotChat panel using the same chatTheme as /.
- Bump @copilotkit/{react-core,react-ui,runtime} to 1.56.2 and
  @ag-ui/core to ^0.0.52 to satisfy the new peer dep.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Expose locks, history, randomize, reset, theme, preset, and preview
controls to the chat agent, and render every tool call as an animated
status card. Also swap chat/customizer column order on /create and use a
create-specific chat theme that allows default tool-call rendering.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ize loop

- Inject Google Fonts stylesheets on demand in the next/font/google shim so
  selected body/heading fonts actually load (previously only Fredoka and
  JetBrains Mono were in index.html, others fell back silently).
- Add the missing .cn-font-heading CSS rule so heading-styled text in cards
  picks up --font-heading instead of inheriting the body font.
- Wrap both base and radix preview blocks in TooltipProvider. codespaces-card
  uses Tooltip without a provider, which crashed the lazy subtree and left
  the "02" panel blank with no ErrorBoundary to catch it.
- Tighten the randomize CopilotKit tool: report which params actually changed
  and which were preserved by locks, and instruct the agent not to re-call
  the tool to "try to change" a locked param.
- Add prose styling (lists, headings, code, tables, links) to the /create
  assistant message via messageView.assistantMessage.className.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add a new "03" preview panel that renders a custom component built by the
  agent via a new `createCustomComponent` CopilotKit tool. Spec is a
  structured, allowlisted node tree (card/column/row/grid/heading/text/
  badge/icon/stat/progress/separator/image) that inherits the current theme
  via `tone` values. Persist the last spec in sessionStorage so it survives
  reloads on /create.
- Wire a CustomComponentProvider around /create, a PreviewSwitcher tab for
  panel 03, and an InlinePreview branch that renders the custom tree when
  `item=custom`. Add a tool-call card icon for the new tool.
- Make the chat panel mobile-friendly: slide-in Sheet on <lg, persistent
  sidebar on ≥lg, with a shared header.
- Replace the 2s time-window guard in `useRandomizeCoAgent` with a
  turn-scoped flag that resets when the chat run ends (isLoading false).
  The old window missed loops when per-call latency exceeded 2s. Also wrap
  the handler in try/catch so unexpected errors still return a tool result.
- Bump the agent model to gpt-5.4 and expand the system prompt with strict
  "call exactly once per request" rules for randomize and
  createCustomComponent, plus the allowed component-spec grammar.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant