boardui 0.4.2 → 0.5.0
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/dist/index.js +127 -4
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
|
-
import
|
|
5
|
+
import pc6 from "picocolors";
|
|
6
6
|
|
|
7
7
|
// src/commands/add.ts
|
|
8
8
|
import path5 from "path";
|
|
@@ -365,6 +365,13 @@ var DEV_DEPS = ["tailwindcss", "@tailwindcss/postcss"];
|
|
|
365
365
|
var PRO_DEPS = ["recharts", "motion", "prism-react-renderer", "@internationalized/date"];
|
|
366
366
|
var INIT_ITEMS = ["globals", "cx", "use-dismiss-on-outside-press", "rules"];
|
|
367
367
|
var RULES_ITEM_NAME = "rules";
|
|
368
|
+
var SKILL_ITEM_NAME = "skill";
|
|
369
|
+
function skillTargetDir(options, cwd, home) {
|
|
370
|
+
if (options.path) return path3.resolve(cwd, options.path);
|
|
371
|
+
if (options.client) return path3.join(home, ".agents", "skills", "boardui");
|
|
372
|
+
if (options.global) return path3.join(home, ".claude", "skills", "boardui");
|
|
373
|
+
return path3.join(cwd, ".claude", "skills", "boardui");
|
|
374
|
+
}
|
|
368
375
|
var RULES_START_MARKER = "<!-- boardui:rules:start -->";
|
|
369
376
|
var RULES_END_MARKER = "<!-- boardui:rules:end -->";
|
|
370
377
|
function stripFrontmatter(markdown) {
|
|
@@ -553,6 +560,13 @@ async function trackInitSuccess({
|
|
|
553
560
|
}) {
|
|
554
561
|
await sendTelemetryEvent({ event: "init", packageManager, pro, source });
|
|
555
562
|
}
|
|
563
|
+
async function trackSkillInstall({
|
|
564
|
+
scope,
|
|
565
|
+
client,
|
|
566
|
+
source = "cli"
|
|
567
|
+
}) {
|
|
568
|
+
await sendTelemetryEvent({ event: "skill", scope, client, source });
|
|
569
|
+
}
|
|
556
570
|
async function trackAddSuccess({
|
|
557
571
|
packageManager,
|
|
558
572
|
components,
|
|
@@ -906,6 +920,8 @@ import { existsSync as existsSync6, readFileSync as readFileSync6 } from "fs";
|
|
|
906
920
|
import path7 from "path";
|
|
907
921
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
908
922
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
923
|
+
import { instrument } from "@posthog/mcp";
|
|
924
|
+
import { PostHog } from "posthog-node";
|
|
909
925
|
import { z } from "zod";
|
|
910
926
|
var PRICING_URL = "https://www.boardui.com/pricing";
|
|
911
927
|
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.
|
|
@@ -917,9 +933,12 @@ Typical flow:
|
|
|
917
933
|
|
|
918
934
|
Component names are exact \u2014 when unsure, call list_components instead of guessing.
|
|
919
935
|
|
|
920
|
-
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; 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.
|
|
936
|
+
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; 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. For deeper always-loaded knowledge (full catalog, theming, page patterns), install_skill writes the BoardUI agent skill into .claude/skills/boardui.
|
|
921
937
|
|
|
922
938
|
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 Lemon Squeezy receipt, then call activate_license with it. After that, pro installs work like free ones.`;
|
|
939
|
+
var posthog = new PostHog("phc_Cp49ooHFujriAf92MgJgj2spJZ2kyBrJC2uUN8wDRqSV", {
|
|
940
|
+
host: "https://eu.i.posthog.com"
|
|
941
|
+
});
|
|
923
942
|
var freeIndexPromise = null;
|
|
924
943
|
var proIndexPromise = null;
|
|
925
944
|
function freeIndex() {
|
|
@@ -1045,6 +1064,7 @@ async function mcp() {
|
|
|
1045
1064
|
{ name: "boardui", version: CLI_VERSION },
|
|
1046
1065
|
{ instructions: INSTRUCTIONS }
|
|
1047
1066
|
);
|
|
1067
|
+
instrument(server, posthog);
|
|
1048
1068
|
server.registerTool(
|
|
1049
1069
|
"get_started",
|
|
1050
1070
|
{
|
|
@@ -1061,7 +1081,7 @@ ${INSTRUCTIONS}
|
|
|
1061
1081
|
|
|
1062
1082
|
Pro license on this machine: ${licensed ? "ACTIVE (pro installs unlocked)" : `none yet \u2014 pro items show a purchase link (${PRICING_URL})`}.
|
|
1063
1083
|
|
|
1064
|
-
Tools: list_components, get_component, get_usage_examples, install_components, init_boardui, install_rules, get_theme, activate_license, license_status, deactivate_license.`
|
|
1084
|
+
Tools: list_components, get_component, get_usage_examples, install_components, init_boardui, install_rules, install_skill, get_theme, activate_license, license_status, deactivate_license.`
|
|
1065
1085
|
);
|
|
1066
1086
|
})
|
|
1067
1087
|
);
|
|
@@ -1403,6 +1423,41 @@ NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proF
|
|
|
1403
1423
|
}
|
|
1404
1424
|
)
|
|
1405
1425
|
);
|
|
1426
|
+
server.registerTool(
|
|
1427
|
+
"install_skill",
|
|
1428
|
+
{
|
|
1429
|
+
title: "Install the BoardUI agent skill",
|
|
1430
|
+
description: "Writes the BoardUI agent skill into the project's .claude/skills/boardui: SKILL.md with the workflow and design rules, plus reference files carrying the full component catalog, theming guide, page patterns, and the micro-animation language. Agents that support skills then load BoardUI knowledge automatically every session, without MCP calls. Re-run with overwrite to update to the latest content.",
|
|
1431
|
+
inputSchema: {
|
|
1432
|
+
overwrite: z.boolean().optional().describe("Overwrite an existing install (default false: existing files are kept). This is how the skill updates."),
|
|
1433
|
+
projectDir: z.string().optional().describe("Absolute path of the project root; defaults to the server's working directory.")
|
|
1434
|
+
},
|
|
1435
|
+
annotations: { destructiveHint: false }
|
|
1436
|
+
},
|
|
1437
|
+
safe(
|
|
1438
|
+
async ({ overwrite = false, projectDir }) => {
|
|
1439
|
+
const project = loadProject(projectDir);
|
|
1440
|
+
const items = await resolveItems([SKILL_ITEM_NAME]);
|
|
1441
|
+
const targetDir = path7.join(project.cwd, ".claude", "skills", "boardui");
|
|
1442
|
+
const report = writeFiles(collectWrites(items, targetDir), overwrite);
|
|
1443
|
+
const lines = [
|
|
1444
|
+
...report.created.map((relPath) => ` created .claude/skills/boardui/${relPath}`),
|
|
1445
|
+
...report.overwritten.map((relPath) => ` updated .claude/skills/boardui/${relPath}`),
|
|
1446
|
+
...report.skipped.map(
|
|
1447
|
+
(relPath) => ` skipped ${relPath} (exists \u2014 pass overwrite to update)`
|
|
1448
|
+
)
|
|
1449
|
+
];
|
|
1450
|
+
if (report.created.length + report.overwritten.length > 0) {
|
|
1451
|
+
await trackSkillInstall({ scope: "project", source: "mcp" });
|
|
1452
|
+
lines.push(
|
|
1453
|
+
"",
|
|
1454
|
+
"Skill-capable agents discover it automatically in new sessions (Claude Code loads .claude/skills without configuration)."
|
|
1455
|
+
);
|
|
1456
|
+
}
|
|
1457
|
+
return text(lines.join("\n"));
|
|
1458
|
+
}
|
|
1459
|
+
)
|
|
1460
|
+
);
|
|
1406
1461
|
server.registerTool(
|
|
1407
1462
|
"get_theme",
|
|
1408
1463
|
{
|
|
@@ -1496,10 +1551,75 @@ NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proF
|
|
|
1496
1551
|
return text("Seat released and license removed from this machine.");
|
|
1497
1552
|
})
|
|
1498
1553
|
);
|
|
1554
|
+
process.on("SIGTERM", async () => {
|
|
1555
|
+
await posthog.shutdown();
|
|
1556
|
+
process.exit(0);
|
|
1557
|
+
});
|
|
1499
1558
|
await server.connect(new StdioServerTransport());
|
|
1500
1559
|
console.error(`boardui mcp v${CLI_VERSION} ready (stdio)`);
|
|
1501
1560
|
}
|
|
1502
1561
|
|
|
1562
|
+
// src/commands/skill.ts
|
|
1563
|
+
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "fs";
|
|
1564
|
+
import { homedir as homedir3 } from "os";
|
|
1565
|
+
import path8 from "path";
|
|
1566
|
+
import ora3 from "ora";
|
|
1567
|
+
import pc5 from "picocolors";
|
|
1568
|
+
var KNOWN_CLIENTS = ["codex", "gemini"];
|
|
1569
|
+
function installedVersion(targetDir) {
|
|
1570
|
+
try {
|
|
1571
|
+
const skillPath = path8.join(targetDir, "SKILL.md");
|
|
1572
|
+
if (!existsSync7(skillPath)) return null;
|
|
1573
|
+
const match = readFileSync7(skillPath, "utf8").match(/^\s*version:\s*(\S+)\s*$/m);
|
|
1574
|
+
return match?.[1] ?? null;
|
|
1575
|
+
} catch {
|
|
1576
|
+
return null;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
async function skill(options) {
|
|
1580
|
+
if (options.client && !KNOWN_CLIENTS.includes(options.client)) {
|
|
1581
|
+
console.log(
|
|
1582
|
+
pc5.yellow(
|
|
1583
|
+
`warning: unknown client "${options.client}" \u2014 installing to ~/.agents/skills/boardui, the shared convention Codex and Gemini read.`
|
|
1584
|
+
)
|
|
1585
|
+
);
|
|
1586
|
+
}
|
|
1587
|
+
const targetDir = skillTargetDir(options, process.cwd(), homedir3());
|
|
1588
|
+
const before = installedVersion(targetDir);
|
|
1589
|
+
const spinner = ora3("Fetching the BoardUI agent skill...").start();
|
|
1590
|
+
let items;
|
|
1591
|
+
try {
|
|
1592
|
+
items = await resolveItems([SKILL_ITEM_NAME]);
|
|
1593
|
+
} catch (error) {
|
|
1594
|
+
spinner.fail(error.message);
|
|
1595
|
+
process.exitCode = 1;
|
|
1596
|
+
return;
|
|
1597
|
+
}
|
|
1598
|
+
const fetched = items.flatMap((item) => item.files).find((file) => file.target === "SKILL.md")?.content.match(/^\s*version:\s*(\S+)\s*$/m)?.[1];
|
|
1599
|
+
spinner.succeed(
|
|
1600
|
+
before && fetched && before !== fetched ? `Skill fetched (installed ${before} -> ${fetched}).` : `Skill fetched${fetched ? ` (version ${fetched})` : ""}.`
|
|
1601
|
+
);
|
|
1602
|
+
const report = writeFiles(collectWrites(items, targetDir), Boolean(options.force));
|
|
1603
|
+
const shortDir = targetDir.startsWith(homedir3()) ? `~${targetDir.slice(homedir3().length)}` : path8.relative(process.cwd(), targetDir) || ".";
|
|
1604
|
+
for (const relPath of report.created) console.log(` ${pc5.green("created")} ${shortDir}/${relPath}`);
|
|
1605
|
+
for (const relPath of report.overwritten) console.log(` ${pc5.green("updated")} ${shortDir}/${relPath}`);
|
|
1606
|
+
for (const relPath of report.skipped) {
|
|
1607
|
+
console.log(` ${pc5.dim("skipped (exists \u2014 pass --force to update)")} ${relPath}`);
|
|
1608
|
+
}
|
|
1609
|
+
const telemetry = trackSkillInstall({
|
|
1610
|
+
scope: options.path ? "path" : options.client ? "agents" : options.global ? "global" : "project",
|
|
1611
|
+
client: options.client && KNOWN_CLIENTS.includes(options.client) ? options.client : void 0
|
|
1612
|
+
});
|
|
1613
|
+
if (report.created.length + report.overwritten.length > 0) {
|
|
1614
|
+
console.log(
|
|
1615
|
+
`
|
|
1616
|
+
${pc5.bold("Done.")} Agents that support skills discover it automatically in new sessions.
|
|
1617
|
+
${pc5.dim("Update any time: npx boardui@latest skill --force")}`
|
|
1618
|
+
);
|
|
1619
|
+
}
|
|
1620
|
+
await telemetry;
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1503
1623
|
// src/index.ts
|
|
1504
1624
|
var program = new Command();
|
|
1505
1625
|
program.name("boardui").description("Add BoardUI components to your project.").version(CLI_VERSION, "-v, --version");
|
|
@@ -1515,6 +1635,9 @@ program.command("list").description("List all available components.").action(asy
|
|
|
1515
1635
|
program.command("mcp").description("Start the BoardUI MCP server (stdio) so AI agents can browse and install components.").action(async () => {
|
|
1516
1636
|
await mcp();
|
|
1517
1637
|
});
|
|
1638
|
+
program.command("skill").description("Install the BoardUI agent skill (SKILL.md + references) so agents like Claude Code and Codex know the design system.").option("-g, --global", "install to ~/.claude/skills/boardui instead of the project's .claude/skills").option("-c, --client <client>", "install to ~/.agents/skills/boardui for clients that read it (codex, gemini)").option("-p, --path <dir>", "custom directory to install the skill into").option("-f, --force", "overwrite an existing install (how you update)").action(async (options) => {
|
|
1639
|
+
await skill(options);
|
|
1640
|
+
});
|
|
1518
1641
|
program.command("login").description("Activate a BoardUI Pro license key on this machine.").argument("[key]", "license key from your Lemon Squeezy receipt").action(async (key) => {
|
|
1519
1642
|
await login(key);
|
|
1520
1643
|
});
|
|
@@ -1522,7 +1645,7 @@ program.command("logout").description("Release this machine's Pro seat and remov
|
|
|
1522
1645
|
await logout();
|
|
1523
1646
|
});
|
|
1524
1647
|
program.parseAsync().catch((error) => {
|
|
1525
|
-
console.error(
|
|
1648
|
+
console.error(pc6.red(`
|
|
1526
1649
|
${error.message}`));
|
|
1527
1650
|
process.exit(1);
|
|
1528
1651
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "boardui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Add BoardUI components to your project.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,9 +34,11 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
37
|
+
"@posthog/mcp": "^0.12.0",
|
|
37
38
|
"commander": "^12.1.0",
|
|
38
39
|
"ora": "^8.1.1",
|
|
39
40
|
"picocolors": "^1.1.1",
|
|
41
|
+
"posthog-node": "^5.51.4",
|
|
40
42
|
"prompts": "^2.4.2",
|
|
41
43
|
"zod": "^4.5.1"
|
|
42
44
|
},
|