boardui 0.5.6 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/index.js +58 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,6 +67,12 @@ by writing files directly, one-time project init, theme tokens, and Pro
|
|
|
67
67
|
license activation/status/deactivation. Setup guide with per-client config:
|
|
68
68
|
https://www.boardui.com/mcp
|
|
69
69
|
|
|
70
|
+
The server's startup instructions, `get_started`, `get_theme`, and
|
|
71
|
+
`init_boardui` include RTL setup for Arabic and Hebrew: install the free
|
|
72
|
+
`direction` foundation, wrap the app with `DirectionProvider`, and set matching
|
|
73
|
+
HTML language/direction. The guidance covers free and Pro source, logical
|
|
74
|
+
styles, mixed content, fonts, and existing installations.
|
|
75
|
+
|
|
70
76
|
Successful MCP-driven installs send the same anonymous telemetry as the CLI,
|
|
71
77
|
tagged with `source: "mcp"`.
|
|
72
78
|
|
|
@@ -216,6 +222,13 @@ The daily buckets do not expire automatically.
|
|
|
216
222
|
`package.json` and `package-lock.json` stay in sync. The CLI reads its
|
|
217
223
|
displayed and telemetry version from `package.json` at runtime.
|
|
218
224
|
2. `cd cli && npm install && npm run build`
|
|
225
|
+
The build embeds the public PostHog project token for MCP analytics. It
|
|
226
|
+
reads the repo's `.env` / `.env.local`, then `cli/.env` / `cli/.env.local`,
|
|
227
|
+
then the build environment (highest priority). Set `POSTHOG_PROJECT_TOKEN`
|
|
228
|
+
and optionally `POSTHOG_HOST`, or use the site's
|
|
229
|
+
`NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN` / `NEXT_PUBLIC_POSTHOG_HOST`. A missing
|
|
230
|
+
or invalid project token fails the build instead of silently disabling
|
|
231
|
+
analytics in every customer's MCP server. Never use a personal API key.
|
|
219
232
|
3. Smoke test: `node dist/index.js list`
|
|
220
233
|
4. `npm publish`
|
|
221
234
|
|
package/dist/index.js
CHANGED
|
@@ -1091,6 +1091,38 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
1091
1091
|
import { instrument } from "@posthog/mcp";
|
|
1092
1092
|
import { PostHog } from "posthog-node";
|
|
1093
1093
|
import { z } from "zod";
|
|
1094
|
+
|
|
1095
|
+
// ../lib/agent/rtl.ts
|
|
1096
|
+
var RTL_SETUP_GUIDE = [
|
|
1097
|
+
"## RTL Support",
|
|
1098
|
+
"",
|
|
1099
|
+
"BoardUI supports Arabic, Hebrew, and other right-to-left languages across free components, Pro blocks, and templates. The same source handles RTL and LTR; there is no RTL CLI flag or separate component version.",
|
|
1100
|
+
"",
|
|
1101
|
+
"1. Read get_component and get_usage_examples for the free `direction` item. Install it with install_components (stdio), or write its source and dependencies yourself (read-only HTTP). CLI equivalent: `npx boardui@latest add direction`.",
|
|
1102
|
+
"2. Wrap the app with DirectionProvider using an explicit BCP 47 locale: `ar` for Arabic, `he` for Hebrew, `en-US` for English. Set matching `lang` and `dir` on `<html>` for a full-app RTL layout. CSS dir alone does not configure React Aria keyboard navigation, calendars, or portalled menus.",
|
|
1103
|
+
"",
|
|
1104
|
+
"```tsx",
|
|
1105
|
+
'import { DirectionProvider } from "@/components/foundations/direction/direction";',
|
|
1106
|
+
"",
|
|
1107
|
+
"export default function RootLayout({ children }: { children: React.ReactNode }) {",
|
|
1108
|
+
" return (",
|
|
1109
|
+
' <html lang="ar" dir="rtl">',
|
|
1110
|
+
" <body>",
|
|
1111
|
+
' <DirectionProvider locale="ar">{children}</DirectionProvider>',
|
|
1112
|
+
" </body>",
|
|
1113
|
+
" </html>",
|
|
1114
|
+
" );",
|
|
1115
|
+
"}",
|
|
1116
|
+
"```",
|
|
1117
|
+
"",
|
|
1118
|
+
"3. Use logical styles such as ps/pe, ms/me, start/end, and text-start/text-end. Mirror navigation arrows and drawer motion; preserve physical coordinates for charts, canvas, and decorative art. Custom portals should carry `dir={useDirection()}` on their root. Nest DirectionProvider for mixed-language regions.",
|
|
1119
|
+
"4. Keep email addresses, URLs, OTP digits, and code LTR; isolate mixed text with bdi or dir=auto. Choose fonts with Arabic or Hebrew coverage and avoid extra letter spacing for Arabic. Translate application labels and accessible names in the application's translation layer; use Intl for dates, numbers, and currencies. Optional `template-copy` supplies TemplateCopyProvider for translating template display copy. Chinese (`zh-CN`) remains LTR.",
|
|
1120
|
+
"5. For older installations, refresh the provider, component source, shared dependencies, and global styles. Preserve customizations before using overwrite. Pro updates use the licensed CLI or updated source downloads.",
|
|
1121
|
+
"",
|
|
1122
|
+
"Setup and live Arabic/Hebrew examples: https://www.boardui.com/rtl"
|
|
1123
|
+
].join("\n");
|
|
1124
|
+
|
|
1125
|
+
// src/commands/mcp.ts
|
|
1094
1126
|
var PRICING_URL = "https://www.boardui.com/pricing";
|
|
1095
1127
|
var INSTRUCTIONS = `BoardUI is a React + Tailwind CSS v4 design system (Next.js first) with free components and paid Pro components/templates. This server installs component source directly into the user's project \u2014 no terminal needed.
|
|
1096
1128
|
|
|
@@ -1101,6 +1133,8 @@ Typical flow:
|
|
|
1101
1133
|
|
|
1102
1134
|
Component names are exact \u2014 when unsure, call list_components instead of guessing.
|
|
1103
1135
|
|
|
1136
|
+
${RTL_SETUP_GUIDE}
|
|
1137
|
+
|
|
1104
1138
|
Design rules (always apply when writing UI in a BoardUI project): style with BoardUI's semantic Tailwind tokens, never raw palette classes or hex \u2014 text via text-text-primary/-secondary/-tertiary, surfaces via bg-background-*-default/-hover, borders via border-border-* and border-separator-border, icons via text-foreground-icon-*. Type uses composite utilities (text-title-2-medium, text-headline-medium, text-body-medium, ...) that set size/weight/line-height together \u2014 never rebuild them from text-sm font-medium. Dark mode flips tokens automatically via the .dark class; never hardcode dark: colors. Merge classes with cx() from @/utils/cx (or the utils alias configured in boardui.json); icons from @remixicon/react as component references. init_boardui installs these rules as always-on files (AGENTS.md + .cursor/rules/boardui.mdc) so they survive beyond this session; install_rules adds them to an already initialized project.
|
|
1105
1139
|
|
|
1106
1140
|
Monorepos/custom aliases: put boardui.json next to the destination package's package.json, and pass that package as projectDir. Installs read its paths/aliases and keep npm dependencies in that package. Pass projectDir to get_component and get_usage_examples too for matching source and examples. Package exports and each consuming app's stylesheet/Tailwind setup must already be wired by the project.
|
|
@@ -1108,9 +1142,6 @@ Monorepos/custom aliases: put boardui.json next to the destination package's pac
|
|
|
1108
1142
|
Agent skill: BoardUI also ships an agent skill (SKILL.md open standard) carrying deeper always-loaded knowledge \u2014 the full component catalog, theming, page patterns, and the motion language. get_skill answers questions about it (returns SKILL.md and the file list); install_skill writes it into the project's .claude/skills/boardui. For other destinations, relay the CLI: npx boardui@latest skill (project), --global (~/.claude/skills), --client codex (~/.agents/skills, read by Codex and Gemini), --path <dir> (anywhere), --force (update). Docs: https://www.boardui.com/skill
|
|
1109
1143
|
|
|
1110
1144
|
Pro: items marked PRO require a one-time BoardUI Pro license (${PRICING_URL}, lifetime updates). If the user wants a pro item and no license is active, relay the pricing link \u2014 and if they already purchased, ask them for the license key from their purchase email, then call activate_license with it. After that, pro installs work like free ones.`;
|
|
1111
|
-
var posthog = new PostHog("", {
|
|
1112
|
-
host: "https://eu.i.posthog.com"
|
|
1113
|
-
});
|
|
1114
1145
|
var freeIndexPromise = null;
|
|
1115
1146
|
var proIndexPromise = null;
|
|
1116
1147
|
function freeIndex() {
|
|
@@ -1328,7 +1359,25 @@ async function mcp() {
|
|
|
1328
1359
|
{ name: "boardui", version: CLI_VERSION },
|
|
1329
1360
|
{ instructions: INSTRUCTIONS }
|
|
1330
1361
|
);
|
|
1331
|
-
|
|
1362
|
+
const token = "phc_Cp49ooHFujriAf92MgJgj2spJZ2kyBrJC2uUN8wDRqSV"?.trim();
|
|
1363
|
+
const posthog = isTelemetryEnabled() && token ? new PostHog(token, {
|
|
1364
|
+
host: "https://eu.i.posthog.com",
|
|
1365
|
+
// Tool calls are infrequent; do not leave a short session's only call
|
|
1366
|
+
// waiting for the default batch threshold / five-second timer.
|
|
1367
|
+
flushAt: 1,
|
|
1368
|
+
flushInterval: 1e3
|
|
1369
|
+
}) : null;
|
|
1370
|
+
if (posthog) {
|
|
1371
|
+
posthog.on("error", () => console.error("[mcp-analytics] PostHog delivery failed."));
|
|
1372
|
+
instrument(server, posthog, {
|
|
1373
|
+
eventProperties: () => ({ $mcp_transport: "stdio" }),
|
|
1374
|
+
logger: (message) => {
|
|
1375
|
+
if (/warning|failed/i.test(message)) console.error(`[mcp-analytics] ${message}`);
|
|
1376
|
+
}
|
|
1377
|
+
});
|
|
1378
|
+
} else if (isTelemetryEnabled()) {
|
|
1379
|
+
console.error("[mcp-analytics] PostHog project token is missing; MCP analytics is disabled.");
|
|
1380
|
+
}
|
|
1332
1381
|
server.registerTool(
|
|
1333
1382
|
"get_started",
|
|
1334
1383
|
{
|
|
@@ -1647,6 +1696,8 @@ NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proF
|
|
|
1647
1696
|
`1. Import the BoardUI stylesheet in the consuming app's root layout: import "${mappedImport("@/styles/globals.css", project.config)}"; \u2014 replacing the default create-next-app "./globals.css" import.`,
|
|
1648
1697
|
'2. Make sure PostCSS uses Tailwind v4 (postcss.config.mjs): export default { plugins: { "@tailwindcss/postcss": {} } };',
|
|
1649
1698
|
'3. Install components with install_components, e.g. ["button", "select", "date-picker"].',
|
|
1699
|
+
"",
|
|
1700
|
+
mappedDocumentation(RTL_SETUP_GUIDE, project.config),
|
|
1650
1701
|
...staleStylesheet ? [
|
|
1651
1702
|
"",
|
|
1652
1703
|
`Note: ${staleStylesheet} is create-next-app's stylesheet, superseded by styles/globals.css \u2014 once step 1's import is swapped, that file is safe to delete.`
|
|
@@ -1755,12 +1806,12 @@ ${skillMd}`
|
|
|
1755
1806
|
"get_theme",
|
|
1756
1807
|
{
|
|
1757
1808
|
title: "Get theme tokens",
|
|
1758
|
-
description: "The BoardUI theme foundations: color primitives + semantic tokens (theme.css), the type scale (typography.css),
|
|
1809
|
+
description: "The BoardUI theme foundations: color primitives + semantic tokens (theme.css), the type scale (typography.css), the Tailwind entry stylesheet (globals.css), and RTL setup for Arabic and Hebrew. Use when restyling components, mapping BoardUI tokens onto a brand, or enabling RTL.",
|
|
1759
1810
|
annotations: { readOnlyHint: true }
|
|
1760
1811
|
},
|
|
1761
1812
|
safe(async () => {
|
|
1762
1813
|
const items = await resolveItems(["globals"]);
|
|
1763
|
-
const lines = [];
|
|
1814
|
+
const lines = [RTL_SETUP_GUIDE, ""];
|
|
1764
1815
|
for (const item of items) {
|
|
1765
1816
|
for (const file of item.files) {
|
|
1766
1817
|
lines.push(`## ${file.target}`, "", "```css", file.content, "```", "");
|
|
@@ -1845,7 +1896,7 @@ ${skillMd}`
|
|
|
1845
1896
|
})
|
|
1846
1897
|
);
|
|
1847
1898
|
process.on("SIGTERM", async () => {
|
|
1848
|
-
await posthog
|
|
1899
|
+
await posthog?.shutdown();
|
|
1849
1900
|
process.exit(0);
|
|
1850
1901
|
});
|
|
1851
1902
|
await server.connect(new StdioServerTransport());
|