The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.
TypeScript b2b-marketplacecomposable-commerceecommerceenterpriseheadless-commercemarketplacemedusamedusajsmulti-vendortypescript
chore: v2.0 stable cleanup (#788)
Jakub Sieradzki1236863d08c7
diff --git a/templates/basic/.ai/skills/README.md b/templates/basic/.ai/skills/README.mdindex 9fd63fead..58600d891 100644--- a/templates/basic/.ai/skills/README.md+++ b/templates/basic/.ai/skills/README.md@@ -9,9 +9,9 @@ Use these skills for repeated workflows in a project created from this starter.- `mercur-cli`- `mercur-blocks`- `medusa-ui-conformance`-- `admin-page-ui`-- `admin-form-ui`-- `admin-tab-ui`+- `dashboard-page-ui`+- `dashboard-form-ui`+- `dashboard-tab-ui`## Linking to your agent runtimediff --git a/templates/basic/.ai/skills/admin-form-ui/SKILL.md b/templates/basic/.ai/skills/admin-form-ui/SKILL.mddeleted file mode 100644index ab5481751..000000000--- a/templates/basic/.ai/skills/admin-form-ui/SKILL.md+++ /dev/null@@ -1,44 +0,0 @@-----name: admin-form-ui-description: Create or modify admin forms in the Mercur basic starter using stable form structure, validation, submission guards, and dashboard UI conventions.------# Admin Form UI--Use this skill when:-- adding or editing an admin form-- wiring page-level create or edit flows-- reviewing submission, validation, or field structure--## Core rule--Prefer the existing Mercur admin form pattern already present in the screen or package. Do not introduce a parallel form system just because it is locally convenient.--Before introducing custom field wrappers, selectors, overlays, or other interactive form UI, apply `medusa-ui-conformance`.--## Hard rules--1. Do not hardcode labels, hints, or button text; use i18n.-2. Do not ship forms without explicit validation behavior.-3. Do not rely only on button disabled state; submission guards must also protect non-button submit paths.-4. Do not flatten large forms into one unstructured wall of fields.-5. Do not add ad hoc field wrappers when the existing project already has a preferred form composition.--## Preferred patterns--- Use schema-driven validation when the form is non-trivial.-- Group related fields together and keep labels, hints, and errors predictable.-- Preserve loading, pending, success, and failure behavior in submission flows.-- When extending an existing Mercur form, follow its established wrapper, field, and footer shape.--## When to switch skills--- If the task is mainly page structure, use `admin-page-ui`.-- If the task is mainly a tabbed wizard, use `admin-tab-ui`.--## Verification--- confirm validation fires on the expected fields-- confirm the submit path is guarded during pending async work-- confirm translated copy, hints, and errors remain coherent-- run admin build or lint after non-trivial form changesdiff --git a/templates/basic/.ai/skills/admin-page-ui/SKILL.md b/templates/basic/.ai/skills/admin-page-ui/SKILL.mddeleted file mode 100644index f80e98e80..000000000--- a/templates/basic/.ai/skills/admin-page-ui/SKILL.md+++ /dev/null@@ -1,46 +0,0 @@-----name: admin-page-ui-description: Create or modify admin pages in the Mercur basic starter using correct routing, page composition, i18n, and dashboard UI conventions.------# Admin Page UI--Use this skill when:-- adding a new admin page under `apps/admin/src/pages`-- extending a list or detail page-- adding page-level actions, sections, or empty states--## First checks--- Confirm the route file belongs under `apps/admin/src/pages`.-- Decide whether the task is page-level, form-level, or tab-level.-- Before inventing custom UI, apply `medusa-ui-conformance`.-- If it is form-only, use `admin-form-ui`.-- If it is tabbed wizard work, use `admin-tab-ui`.--## Hard rules--1. Do not hardcode user-facing strings; use i18n.-2. Do not hide route behavior behind unclear folder structure; keep file-based routing obvious.-3. Do not ship a page without explicit loading, empty, error, and success-state thinking.-4. Do not invent a brand-new page anatomy when an existing Mercur admin page pattern already fits.-5. Do not scatter action buttons and page actions without a clear header structure.--## Page patterns--- List pages should have a clear title, actions, and data state handling.-- Detail pages should have a stable header plus clearly grouped sections.-- Section-heavy screens should stay scannable and avoid one giant unstructured column.--## Routing expectations--- `page.tsx` controls the route.-- Export route metadata when the page should appear in navigation.-- Keep nested routes and dynamic segments easy to infer from the folder path.--## Verification--- confirm the route resolves-- confirm the page copy is translated or translation-ready-- confirm loading and error behavior still make sense-- run admin build or lint after non-trivial page workdiff --git a/templates/basic/.ai/skills/admin-tab-ui/SKILL.md b/templates/basic/.ai/skills/admin-tab-ui/SKILL.mddeleted file mode 100644index bb2fc8d81..000000000--- a/templates/basic/.ai/skills/admin-tab-ui/SKILL.md+++ /dev/null@@ -1,40 +0,0 @@-----name: admin-tab-ui-description: Create or modify tabbed admin workflows in the Mercur basic starter using stable tab structure, validation scope, and i18n-aware wizard conventions.------# Admin Tab UI--Use this skill when:-- adding a custom tab to a tabbed admin flow-- extending a multi-step wizard-- reviewing tab layout, validation scope, or navigation behavior--Before introducing custom interactive UI inside a tab, apply `medusa-ui-conformance`.--## Hard rules--1. Do not hardcode tab labels; use i18n-aware metadata.-2. Do not put all fields into one flat tab without section structure.-3. Do not ignore forward-navigation validation scope.-4. Do not break keyboard or submit behavior when adding a tab.-5. Do not assume tabs are static if visibility depends on form state.--## Preferred patterns--- Give each tab a single clear purpose.-- Keep a visible header and grouped sections inside the tab body.-- Keep validation fields scoped to the tab when the flow expects step-by-step validation.-- Preserve navigation behavior when tabs appear or disappear dynamically.--## When to switch skills--- Page shell work -> `admin-page-ui`-- Form field work without wizard concerns -> `admin-form-ui`--## Verification--- confirm the tab label and content are translation-ready-- confirm forward navigation validates the intended fields-- confirm dynamic visibility does not leave the flow in an invalid state-- run admin build or lint after non-trivial tab workdiff --git a/templates/basic/.ai/skills/dashboard-form-ui/SKILL.md b/templates/basic/.ai/skills/dashboard-form-ui/SKILL.mdnew file mode 100644index 000000000..c9ca01587--- /dev/null+++ b/templates/basic/.ai/skills/dashboard-form-ui/SKILL.md@@ -0,0 +1,124 @@+---+name: dashboard-form-ui+description: Create or modify forms in admin or vendor dashboards in the Mercur basic starter using stable form structure, validation, submission guards, and dashboard UI conventions.+---++# Dashboard Form UI++Use this skill when:+- adding or editing a form in admin or vendor+- wiring page-level create or edit flows+- reviewing submission, validation, or field structure++Applies equally to **admin** and **vendor** dashboards.++## Core rule++Prefer the existing Mercur form pattern already present in the screen or package. Do not introduce a parallel form system just because it is locally convenient.++Before introducing custom field wrappers, selectors, overlays, or other interactive form UI, apply `medusa-ui-conformance`.++## Required imports++Forms use `react-hook-form` with `zod` validation and components from `@mercurjs/dashboard-shared` and `@medusajs/ui`.++## Standard form page structure++A create/edit form page is a `RouteFocusModal` drawer route:++```tsx+// The page default export wraps RouteFocusModal (provides context)+const CreatePage = () => (+ <RouteFocusModal>+ <CreateForm />+ </RouteFocusModal>+);+export default CreatePage;++// The form component uses RouteFocusModal.Form, .Header, .Body, .Footer+const CreateForm = () => {+ const { t } = useTranslation();+ const { handleSuccess } = useRouteModal();+ const form = useForm({ defaultValues: { ... }, resolver: zodResolver(schema) });++ const handleSubmit = form.handleSubmit(async (data) => {+ await mutateAsync(data, {+ onSuccess: () => { toast.success("Created"); handleSuccess("/route"); },+ onError: (error) => toast.error(error.message),+ });+ });++ return (+ <RouteFocusModal.Form form={form}>+ <form onSubmit={handleSubmit} className="flex h-full flex-col overflow-hidden">+ <RouteFocusModal.Header />+ <RouteFocusModal.Body className="flex size-full flex-col items-center p-16">+ <div className="flex w-full max-w-[720px] flex-col gap-y-8">+ {/* Heading, fields */}+ </div>+ </RouteFocusModal.Body>+ <RouteFocusModal.Footer>+ <RouteFocusModal.Close asChild>+ <Button size="small" variant="secondary">{t("actions.cancel")}</Button>+ </RouteFocusModal.Close>+ <Button size="small" variant="primary" type="submit" isLoading={isPending}>+ {t("actions.create")}+ </Button>+ </RouteFocusModal.Footer>+ </form>+ </RouteFocusModal.Form>+ );+};+```++## Two form containers++### RouteFocusModal — for create flows+Full-screen modal overlay. Used for creating new entities.+- Page wraps `RouteFocusModal` (provides context), form uses `.Form`, `.Header`, `.Body`, `.Footer`, `.Close`+- `useRouteModal()` must be called inside the provider+- If using `TabbedForm`, do NOT use `RouteFocusModal.Form` — `TabbedForm` renders it internally. See `dashboard-tab-ui`.++### RouteDrawer — for edit flows+Side panel from the right. Used for editing existing entities.+- Same pattern: page wraps `RouteDrawer`, form uses `.Form`, `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close`+- **Critical:** Edit drawer route must use `@` prefix directory (e.g. `[id]/@edit/page.tsx`) to create a parallel route. Without `@`, the detail page unmounts. See `dashboard-page-ui` for full pattern.++## Key components++- `RouteFocusModal` / `RouteDrawer` — wraps the page, provides modal provider context+- `.Form` — wraps the form, connects react-hook-form+- `.Header` — modal/drawer header (RouteFocusModal has close button built in; RouteDrawer uses `.Title` and `.Description`)+- `.Body` — scrollable content area+- `.Footer` — sticky footer with actions+- `.Close` — closes the modal/drawer (use with `asChild` on Cancel button)+- `Form.Field` / `Form.Item` / `Form.Label` / `Form.Control` / `Form.ErrorMessage` — form field composition+- `Form.Label optional` — marks a field as optional in the UI++## Hard rules++1. Do not hardcode labels, hints, or button text; use i18n.+2. Do not ship forms without explicit validation behavior.+3. Do not rely only on button disabled state; submission guards must also protect non-button submit paths.+4. Do not flatten large forms into one unstructured wall of fields.+5. Do not add ad hoc field wrappers when the existing project already has a preferred form composition.+6. Do not use `useRouteModal()` outside a `RouteFocusModal` provider.++## Preferred patterns++- Use schema-driven validation (`zod` + `zodResolver`) when the form is non-trivial.+- Group related fields together and keep labels, hints, and errors predictable.+- Preserve loading, pending, success, and failure behavior in submission flows.+- When extending an existing form, follow its established wrapper, field, and footer shape.++## When to switch skills++- If the task is mainly page structure, use `dashboard-page-ui`.+- If the task is mainly a tabbed wizard, use `dashboard-tab-ui`.++## Verification++- confirm validation fires on the expected fields+- confirm the submit path is guarded during pending async work+- confirm translated copy, hints, and errors remain coherent+- run app build or lint after non-trivial form changesdiff --git a/templates/basic/.ai/skills/dashboard-page-ui/SKILL.md b/templates/basic/.ai/skills/dashboard-page-ui/SKILL.mdnew file mode 100644index 000000000..d05ff1b40--- /dev/null+++ b/templates/basic/.ai/skills/dashboard-page-ui/SKILL.md@@ -0,0 +1,180 @@+---+name: dashboard-page-ui+description: Create or modify pages in admin or vendor dashboards in the Mercur basic starter using correct routing, page composition, i18n, and dashboard UI conventions.+---++# Dashboard Page UI++Use this skill when:+- adding a new page under `apps/admin/src/routes` or `apps/vendor/src/routes`+- extending a list or detail page in either dashboard+- adding page-level actions, sections, or empty states++Applies equally to **admin** and **vendor** dashboards — they share the same component library and routing conventions.++## First checks++- Route files belong under `src/routes` (NOT `src/pages` — the `mercurDashboardPlugin` scans `src/routes` only).+- Decide whether the task is page-level, form-level, or tab-level.+- Before inventing custom UI, apply `medusa-ui-conformance`.+- If it is form-only, use `dashboard-form-ui`.+- If it is tabbed wizard work, use `dashboard-tab-ui`.++## Hard rules++1. Do not hardcode user-facing strings; use i18n.+2. Do not hide route behavior behind unclear folder structure; keep file-based routing obvious.+3. Do not ship a page without explicit loading, empty, error, and success-state thinking.+4. Do not invent a brand-new page anatomy when an existing dashboard page pattern already fits.+5. Do not scatter action buttons and page actions without a clear header structure.+6. Do not place route files in `src/pages` — the `mercurDashboardPlugin` scans `src/routes` only.++## Sidebar navigation++For a page to appear in the sidebar, its `page.tsx` must export a named `config`:++```tsx+import type { RouteConfig } from "@mercurjs/dashboard-sdk";+import { Star } from "@medusajs/icons";++export const config: RouteConfig = {+ label: "My Page",+ icon: Star,+};+```++Without this export the page is reachable by URL but invisible in navigation.++## List page pattern++Use `_DataTable`, `SingleColumnPage`, and `useDataTable` from `@mercurjs/dashboard-shared`.++A list page should include:+- `SingleColumnPage` wrapper+- `Container` with heading and action buttons (Create via `Link` to the create route)+- `_DataTable` with `pagination`, `search`, `filters`, `orderBy`, `count`, `pageSize`, `noRecords`+- `navigateTo` on `_DataTable` to link rows to detail pages++## Detail page pattern++Detail pages use `TwoColumnPage` with `.Main` and `.Sidebar` from `@mercurjs/dashboard-shared`.++### Structure++```tsx+<TwoColumnPage data={entity} showJSON showMetadata>+ <TwoColumnPage.Main>+ <Container className="divide-y p-0">+ {/* Header: title, StatusBadge for status, ActionMenu for actions */}+ <SectionRow title="Field Label" value={entity.field} />+ </Container>+ {/* Group related fields into separate Container blocks with Heading level="h2" */}+ </TwoColumnPage.Main>++ <TwoColumnPage.Sidebar>+ <Container className="divide-y p-0">+ {/* Secondary info: organization, inventory, metadata */}+ <SectionRow title="Field Label" value={entity.field} />+ </Container>+ </TwoColumnPage.Sidebar>+</TwoColumnPage>+```++### Detail page conventions++- Use `SectionRow` for key-value pairs — `title` is the label, `value` is string or ReactNode.+- Use `StatusBadge` only for statuses (published, draft, active, etc.) — never `Badge`.+- Use plain text for categories, types, and other descriptive values — never wrap in `Badge`.+- Use `ActionMenu` with `groups` for contextual actions (Edit, Delete). Put destructive actions in a separate group.+- Main column: primary content, descriptions, key details.+- Sidebar: secondary info, organization, metadata.++## Create page pattern++Create pages live at `src/routes/<entity>/create/page.tsx` and open as a `RouteFocusModal` full-screen overlay:++```tsx+const CreatePage = () => (+ <RouteFocusModal>+ <CreateForm />+ </RouteFocusModal>+);+export default CreatePage;+```++The form component inside uses `useRouteModal()` for `handleSuccess`. See `dashboard-form-ui` or `dashboard-tab-ui` for form details.++## Edit drawer pattern++Edit pages use `RouteDrawer` — a side panel that slides in from the right over the detail page.++**Critical:** The edit directory must use the `@` prefix to create a parallel route:+- Correct: `src/routes/<entity>/[id]/@edit/page.tsx`+- Wrong: `src/routes/<entity>/[id]/edit/page.tsx`++Without `@`, the SDK creates a flat route that **replaces** the detail page — the background disappears. With `@`, it creates a child route that renders inside the parent's `Outlet`.++The detail page must set `hasOutlet` to render the child route:+```tsx+<TwoColumnPage data={entity} showJSON showMetadata hasOutlet>+```++Edit drawer structure:+```tsx+const EditForm = () => {+ const { handleSuccess } = useRouteModal();+ const form = useForm({ ... });+ const handleSubmit = form.handleSubmit(async (data) => {+ handleSuccess(`/<entity>/${id}`);+ });++ return (+ <RouteDrawer.Form form={form}>+ <form onSubmit={handleSubmit} className="flex h-full flex-col overflow-hidden">+ <RouteDrawer.Header>+ <RouteDrawer.Title>Edit Entity</RouteDrawer.Title>+ <RouteDrawer.Description>Update details.</RouteDrawer.Description>+ </RouteDrawer.Header>+ <RouteDrawer.Body className="flex flex-col gap-y-4 overflow-y-auto p-6">+ {/* Form.Field components */}+ </RouteDrawer.Body>+ <RouteDrawer.Footer>+ <RouteDrawer.Close asChild>+ <Button size="small" variant="secondary">{t("actions.cancel")}</Button>+ </RouteDrawer.Close>+ <Button size="small" variant="primary" type="submit">{t("actions.save")}</Button>+ </RouteDrawer.Footer>+ </form>+ </RouteDrawer.Form>+ );+};++const EditPage = () => (+ <RouteDrawer>+ <EditForm />+ </RouteDrawer>+);+export default EditPage;+```++Link to edit from the detail page ActionMenu:+```tsx+{ label: "Edit", icon: <PencilSquare />, onClick: () => navigate(`/<entity>/${id}/edit`) }+```++## Routing expectations++- `page.tsx` controls the route.+- Export `config: RouteConfig` when the page should appear in navigation.+- Detail pages: `src/routes/<entity>/[id]/page.tsx`+- Create pages: `src/routes/<entity>/create/page.tsx`+- Edit drawers: `src/routes/<entity>/[id]/@edit/page.tsx` (note `@` prefix)+- Keep nested routes and dynamic segments easy to infer from the folder path.++## Verification++- confirm the route resolves and appears in sidebar (if config is exported)+- confirm the page copy is translated or translation-ready+- confirm loading and error behavior still make sense+- confirm StatusBadge is used for statuses, plain text for descriptive values+- run app build or lint after non-trivial page workdiff --git a/templates/basic/.ai/skills/dashboard-tab-ui/SKILL.md b/templates/basic/.ai/skills/dashboard-tab-ui/SKILL.mdnew file mode 100644index 000000000..847ab887a--- /dev/null+++ b/templates/basic/.ai/skills/dashboard-tab-ui/SKILL.md@@ -0,0 +1,109 @@+---+name: dashboard-tab-ui+description: Create or modify tabbed workflows in admin or vendor dashboards in the Mercur basic starter using stable tab structure, validation scope, and i18n-aware wizard conventions.+---++# Dashboard Tab UI++Use this skill when:+- adding a custom tab to a tabbed flow in admin or vendor+- extending a multi-step wizard+- reviewing tab layout, validation scope, or navigation behavior++Applies equally to **admin** and **vendor** dashboards.++Before introducing custom interactive UI inside a tab, apply `medusa-ui-conformance`.++## Required component++Always use `TabbedForm` from `@mercurjs/dashboard-shared` — do NOT build custom tab navigation with `ProgressTabs` from `@medusajs/ui` directly.++## TabbedForm API++`TabbedForm` handles internally: `RouteFocusModal.Form`, `ProgressTabs` in the header navbar, `KeyboundForm`, and a default footer with Cancel/Continue/Save.++### Props++- `form` — `UseFormReturn` from `react-hook-form`+- `onSubmit` — submit handler from `form.handleSubmit()`+- `isLoading` (optional) — disables submit button+- `footer` (optional) — custom footer render prop; omit to use the default++### TabbedForm.Tab props++- `id` (string, required) — unique tab identifier+- `label` (string, required) — display label in the tab bar+- `validationFields` (FieldPath[], optional) — fields to validate on this tab+- `isVisible` ((form) => boolean, optional) — dynamic tab visibility++## Page structure++The create page wraps `RouteFocusModal` around the form component:++```tsx+const CreatePage = () => (+ <RouteFocusModal>+ <CreateForm />+ </RouteFocusModal>+);+export default CreatePage;+```++The form component renders `TabbedForm` directly — do NOT nest it inside another `RouteFocusModal.Form`:++```tsx+const CreateForm = () => {+ const { handleSuccess } = useRouteModal();+ const form = useForm({ resolver: zodResolver(schema), defaultValues: { ... } });+ const handleSubmit = form.handleSubmit(async (data) => {+ handleSuccess("/entity-route");+ });++ return (+ <TabbedForm form={form} onSubmit={handleSubmit}>+ <TabbedForm.Tab id="general" label="General">+ <div className="flex flex-col gap-y-4 p-8">+ {/* Form.Field components */}+ </div>+ </TabbedForm.Tab>+ </TabbedForm>+ );+};+```++## Known issue: validation blocks Continue++`TabbedForm`'s internal `onNext` calls `form.trigger()` without arguments, which validates the **entire** form — not just the active tab's fields. Required fields on later tabs will prevent Continue from working.++**Workaround:** Only mark fields as required (`.min(1)`) if they are on the first tab. Use `.optional()` for fields on later tabs and validate at submit time if needed.++## Hard rules++1. Do not hardcode tab labels; use i18n-aware metadata.+2. Do not put all fields into one flat tab without section structure.+3. Do not build custom tab UI with `ProgressTabs` directly — use `TabbedForm`.+4. Do not wrap `TabbedForm` in `RouteFocusModal.Form` — it does this internally.+5. Do not provide a custom `footer` unless you need to change button labels — the default footer handles Cancel/Continue/Save correctly.+6. Do not add required zod validation to fields on tabs beyond the first (see known issue above).+7. Do not break keyboard or submit behavior when adding a tab.+8. Do not assume tabs are static if visibility depends on form state.++## Preferred patterns++- Give each tab a single clear purpose.+- Keep a visible header (`Heading level="h2"`) and grouped sections inside each tab body.+- Add `className="p-8"` to the wrapping div inside each `TabbedForm.Tab` for consistent spacing.+- Use `Form.Field` / `Form.Item` / `Form.Label` / `Form.Control` / `Form.ErrorMessage` from `@mercurjs/dashboard-shared`.+- Use `zodResolver` with `react-hook-form` for schema validation.++## When to switch skills++- Page shell work -> `dashboard-page-ui`+- Form field work without wizard concerns -> `dashboard-form-ui`++## Verification++- confirm Continue navigates to the next tab (check that later-tab fields are not required in zod schema)+- confirm tab labels and content are translation-ready+- confirm dynamic visibility does not leave the flow in an invalid state+- run app build or lint after non-trivial tab workdiff --git a/templates/basic/.ai/skills/medusa-ui-conformance/SKILL.md b/templates/basic/.ai/skills/medusa-ui-conformance/SKILL.mdindex 006b51017..ab1f3cd4e 100644--- a/templates/basic/.ai/skills/medusa-ui-conformance/SKILL.md+++ b/templates/basic/.ai/skills/medusa-ui-conformance/SKILL.md@@ -13,37 +13,87 @@ Use this skill when:This starter does not assume direct Radix usage on day one.Use this order:-1. existing local wrapper-2. `@medusajs/ui`-3. composition of existing wrappers plus `@medusajs/ui`+1. `@mercurjs/dashboard-shared` components (TabbedForm, _DataTable, SingleColumnPage, TwoColumnPage, RouteFocusModal, Form, etc.)+2. `@medusajs/ui` components (Button, Input, Select, Container, Heading, Text, StatusBadge, toast, etc.)+3. composition of the above4. only then add a lower-level primitive if the project genuinely needs it+## Available from @mercurjs/dashboard-shared++Layout: `SingleColumnPage`, `TwoColumnPage` (.Main, .Sidebar), `SectionRow`+Data: `_DataTable`, `useDataTable`, `DataGrid`+Modal: `RouteFocusModal` (.Form, .Header, .Body, .Footer, .Close), `RouteDrawer`, `StackedFocusModal`, `StackedDrawer`+Form: `Form` (.Field, .Item, .Label, .Control, .ErrorMessage), `TabbedForm` (.Tab, .useForm)+Actions: `ActionMenu` (with `groups` of actions)+Hooks: `useRouteModal`, `useStackedModal`, `useTabManagement`, `useTabbedForm`, `useDataTable`, `useQueryParams`++## Available from @medusajs/ui++Primitives: `Button`, `Input`, `Textarea`, `Select`, `Checkbox`, `Switch`, `RadioGroup`+Layout: `Container`, `Heading`, `Text`, `Table`, `Tabs`, `ProgressTabs`+Status: `StatusBadge` — for statuses with colored dot (e.g. published, draft, active)+Tags: `Badge` — for counts and tags only, never for statuses+Feedback: `toast`+Icons: import from `@medusajs/icons`++## Component usage rules++### StatusBadge vs Badge vs plain text++- `StatusBadge` — statuses only (published, draft, active, pending, etc.). Takes `color`: "green", "orange", "red", "blue", "grey".+- `Badge` — counts and tags only (e.g. "3 items", "+2 more"). Never for statuses.+- Plain text — categories, types, names, descriptions, and any other descriptive values. Do not wrap in Badge or StatusBadge.++### SectionRow++- Key-value display in detail pages. `title` is the label, `value` is string or ReactNode.+- Keep values simple: plain text, `StatusBadge`, or minimal formatted content.++### ActionMenu++- Contextual actions (Edit, Delete, etc.) on detail pages and row-level.+- `groups` array — each group is visually separated. Put destructive actions in their own group.++### TabbedForm++- Multi-step form wizard inside `RouteFocusModal`. Renders `ProgressTabs` in the header navbar automatically.+- Do NOT build tab navigation manually with `ProgressTabs` — use `TabbedForm` which handles form context, keyboard shortcuts, and footer.++### _DataTable++- Data tables with pagination, search, filters, sorting.+- Do NOT build custom tables with `Table` from `@medusajs/ui` when `_DataTable` covers the use case.+## Hard rules-1. Do not build a custom dropdown, dialog, drawer, tooltip, popover, tabs, accordion, or select if `@medusajs/ui` already covers the interaction.-2. Do not add a new shared component when an existing local wrapper already solves the pattern.-3. Do not introduce custom interactive UI without keyboard behavior, focus handling, i18n, and stable `data-testid` coverage.-4. Do not create a one-off visual language that fights the rest of the dashboard.-5. Do not treat low-level primitives as the default starting point for UI work.+1. Do not build custom dropdowns, dialogs, drawers, tooltips, popovers, tabs, accordions, or selects if `@medusajs/ui` already covers the interaction.+2. Do not build custom tabbed forms — use `TabbedForm` from `@mercurjs/dashboard-shared`.+3. Do not build custom data tables — use `_DataTable` from `@mercurjs/dashboard-shared`.+4. Do not add a new shared component when an existing wrapper already solves the pattern.+5. Do not introduce custom interactive UI without keyboard behavior, focus handling, and i18n.+6. Do not create a one-off visual language that fights the rest of the dashboard.+7. Do not use `ProgressTabs` directly for multi-step forms — use `TabbedForm`.+8. Do not use `Badge` for status display — use `StatusBadge`.+9. Do not wrap categories, types, or descriptive text in `Badge` or `StatusBadge` — use plain text.## Decision checksBefore creating custom UI, ask:-- does this pattern already exist in shared components?+- does `@mercurjs/dashboard-shared` export a component for this?- can `@medusajs/ui` solve this directly?-- can I compose the solution from existing wrappers and Medusa UI components?-- if not, is the gap real and reusable enough to justify a new shared component?+- can I compose the solution from existing wrappers and `@medusajs/ui`?+- if not, is the gap real and reusable enough to justify a new component?## Review checklist-- reused an existing wrapper where possible+- reused `@mercurjs/dashboard-shared` where applicable- preferred `@medusajs/ui` over custom primitives-- kept copy translation-ready-- kept interaction accessible and testable-- kept the component reusable if the pattern is shared+- `StatusBadge` for statuses, plain text for descriptive values+- copy is translation-ready+- interaction is accessible and testable## Verification- run the relevant app lint/build- manually check keyboard and focus behavior for non-trivial interactions-- verify translated copy and labels+- verify StatusBadge vs Badge vs plain text usagediff --git a/templates/basic/.ai/skills/mercur-cli/SKILL.md b/templates/basic/.ai/skills/mercur-cli/SKILL.mdindex 51783f596..2057f71d5 100644--- a/templates/basic/.ai/skills/mercur-cli/SKILL.md+++ b/templates/basic/.ai/skills/mercur-cli/SKILL.md@@ -22,41 +22,56 @@ Use this skill when:## Where commands run-- Run Mercur CLI registry commands from the project root where `blocks.json` lives.-- Run backend verification from `packages/api` after install if backend files changed.-- Run admin or vendor verification from `apps/admin` or `apps/vendor` after UI installs or edits.+- Run Mercur CLI registry commands (`search`, `view`, `add`, `diff`) from the **project root** where `blocks.json` lives.+- Run `medusa` commands (`db:generate`, `db:migrate`) from `packages/api` using `bunx medusa`.+- Run admin or vendor verification from `apps/admin` or `apps/vendor`.## Common flows### Discover and inspect a block```bash-npx @mercurjs/cli@canary search --query review-npx @mercurjs/cli@canary view reviews+npx @mercurjs/cli@canary search --query <keyword>+npx @mercurjs/cli@canary view <block-name>```### Add a block```bash-npx @mercurjs/cli@canary add reviews+npx @mercurjs/cli@canary add <block-name>```+**Important:** When CLI asks to overwrite `middlewares.ts`, always decline (`n`) and merge manually.+### Check local drift```bash-npx @mercurjs/cli@canary diff reviews+npx @mercurjs/cli@canary diff <block-name>```## After `add`-Always inspect:-- where files landed based on `blocks.json`-- whether `packages/api/medusa-config.ts` needs an update-- whether route types need codegen-- whether backend or app builds should run+Follow the block docs output, but verify everything against the actual installed files:++1. **Middleware**: Read the actual middleware file to get the correct export name and path. Add the import and spread to `src/api/middlewares.ts`.+2. **medusa-config.ts**: Add modules, providers, plugin options, or env-driven config as docs specify.+3. **Migrations**: If the block added a module with models, run `bunx medusa db:generate <module>` and `bunx medusa db:migrate` from `packages/api`.+4. **Dependencies**: If the dev server fails with "Cannot find module", install the missing dependency with `bun add <package>` in the correct workspace.+5. **Env vars**: Add any required environment variables to `.env`.+6. **Validation**: Run the dev server and check for startup errors before moving on.++## Known CLI behaviors++- CLI may prompt "You need to create a blocks.json" even when it exists — this happens when running from the wrong directory.+- CLI's `add` outputs the block docs after installation — read them carefully but verify against installed files.+- CLI may install files from one block that overlap with another block (shared files). Declining overwrites preserves existing work.+- The `search` command with `--query ""` returns all available blocks.## Avoid- running registry commands outside the project root- guessing block names without `search` or `view`+- accepting `middlewares.ts` overwrite from CLI- assuming an installed block only changed one workspace+- trusting block docs blindly for import paths or dependencies+- skipping dev server validation after installing a blockdiff --git a/templates/basic/.ai/skills/migration-guide/SKILL.md b/templates/basic/.ai/skills/migration-guide/SKILL.mdindex 43c8418bd..9e769ca68 100644--- a/templates/basic/.ai/skills/migration-guide/SKILL.md+++ b/templates/basic/.ai/skills/migration-guide/SKILL.md@@ -34,8 +34,8 @@ Use this skill when:| `apps/backend/src/api/` | `packages/api/src/api/` || `apps/backend/src/subscribers/` | `packages/api/src/subscribers/` || `apps/backend/src/links/` | `packages/api/src/links/` |-| `apps/admin/src/routes/` | `apps/admin/src/pages/` |-| `apps/vendor/src/routes/` | `apps/vendor/src/pages/` |+| `apps/admin/src/routes/` | `apps/admin/src/routes/` |+| `apps/vendor/src/routes/` | `apps/vendor/src/routes/` |## Import Changes@@ -123,7 +123,7 @@ Port in this order:6. **Subscribers** — copy to `packages/api/src/subscribers/`7. **API routes** — copy to `packages/api/src/api/`, type both generics8. **Middleware** — merge into `packages/api/src/api/middlewares.ts`-9. **Dashboard pages** — move to `src/pages/`, update imports+9. **Dashboard pages** — move to `src/routes/` (NOT `src/pages/` — dashboard SDK scans `src/routes/`), update importsAfter each group: run `bun medusa develop` and verify server starts.diff --git a/templates/basic/CLAUDE.md b/templates/basic/CLAUDE.mdindex b7a0f539b..98689936e 100644--- a/templates/basic/CLAUDE.md+++ b/templates/basic/CLAUDE.md@@ -91,3 +91,15 @@ Typical checks:- If a task is about blocks, always use `mercur-blocks`.- If a task is about CLI choice, initialization, or registry commands, use `mercur-cli`.- If a task adds custom admin or vendor UI, load `medusa-ui-conformance` before inventing new components.++## Lessons Learned++When you encounter a repeatable bug, a non-obvious gotcha, or learn something that would save time in future sessions, write it to `.ai/lessons.md`.++This file acts as a shared knowledge base across agents and sessions. Before starting non-trivial work, check `.ai/lessons.md` for known issues that might apply.++Format each entry as:+```+### <short title>+<what happened, why, and what to do instead>+```\ No newline at end of file