boardui 0.4.2 → 0.5.1
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 +159 -3
- 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.
|
|
@@ -919,7 +935,12 @@ Component names are exact \u2014 when unsure, call list_components instead of gu
|
|
|
919
935
|
|
|
920
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.
|
|
921
937
|
|
|
938
|
+
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
|
|
939
|
+
|
|
922
940
|
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.`;
|
|
941
|
+
var posthog = new PostHog("phc_Cp49ooHFujriAf92MgJgj2spJZ2kyBrJC2uUN8wDRqSV", {
|
|
942
|
+
host: "https://eu.i.posthog.com"
|
|
943
|
+
});
|
|
923
944
|
var freeIndexPromise = null;
|
|
924
945
|
var proIndexPromise = null;
|
|
925
946
|
function freeIndex() {
|
|
@@ -1045,6 +1066,7 @@ async function mcp() {
|
|
|
1045
1066
|
{ name: "boardui", version: CLI_VERSION },
|
|
1046
1067
|
{ instructions: INSTRUCTIONS }
|
|
1047
1068
|
);
|
|
1069
|
+
instrument(server, posthog);
|
|
1048
1070
|
server.registerTool(
|
|
1049
1071
|
"get_started",
|
|
1050
1072
|
{
|
|
@@ -1061,7 +1083,7 @@ ${INSTRUCTIONS}
|
|
|
1061
1083
|
|
|
1062
1084
|
Pro license on this machine: ${licensed ? "ACTIVE (pro installs unlocked)" : `none yet \u2014 pro items show a purchase link (${PRICING_URL})`}.
|
|
1063
1085
|
|
|
1064
|
-
Tools: list_components, get_component, get_usage_examples, install_components, init_boardui, install_rules, get_theme, activate_license, license_status, deactivate_license.`
|
|
1086
|
+
Tools: list_components, get_component, get_usage_examples, install_components, init_boardui, install_rules, get_skill, install_skill, get_theme, activate_license, license_status, deactivate_license.`
|
|
1065
1087
|
);
|
|
1066
1088
|
})
|
|
1067
1089
|
);
|
|
@@ -1403,6 +1425,72 @@ NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proF
|
|
|
1403
1425
|
}
|
|
1404
1426
|
)
|
|
1405
1427
|
);
|
|
1428
|
+
server.registerTool(
|
|
1429
|
+
"get_skill",
|
|
1430
|
+
{
|
|
1431
|
+
title: "About the BoardUI agent skill",
|
|
1432
|
+
description: "What the BoardUI agent skill is and what it contains: returns the live SKILL.md (workflow, design rules digest, component selection, gotchas, Pro licensing) plus the bundled reference files with their sizes, the install options for every client, and how updating works. Call this when the user asks about BoardUI skills or wants to read the skill before installing.",
|
|
1433
|
+
annotations: { readOnlyHint: true }
|
|
1434
|
+
},
|
|
1435
|
+
safe(async () => {
|
|
1436
|
+
const items = await resolveItems([SKILL_ITEM_NAME]);
|
|
1437
|
+
const files = items.flatMap((item) => item.files);
|
|
1438
|
+
const skillMd = files.find((file) => file.target === "SKILL.md")?.content ?? "";
|
|
1439
|
+
const listing = files.map((file) => `- ${file.target} (${Math.round(file.content.length / 1024)} KB)`).join("\n");
|
|
1440
|
+
return text(
|
|
1441
|
+
`The BoardUI agent skill (SKILL.md open standard) gives skill-capable agents always-loaded BoardUI knowledge; the MCP server stays the on-demand companion for live source and installs.
|
|
1442
|
+
|
|
1443
|
+
Files in the skill:
|
|
1444
|
+
${listing}
|
|
1445
|
+
|
|
1446
|
+
Install options:
|
|
1447
|
+
- This project via MCP: call install_skill (writes .claude/skills/boardui; overwrite updates).
|
|
1448
|
+
- CLI: npx boardui@latest skill \u2014 flags: --global (~/.claude/skills), --client codex (~/.agents/skills, read by Codex and Gemini), --path <dir> (any client), --force (update in place).
|
|
1449
|
+
- Skills load when a session starts, so restart the agent or open a fresh chat after installing.
|
|
1450
|
+
|
|
1451
|
+
Docs: https://www.boardui.com/skill
|
|
1452
|
+
|
|
1453
|
+
--- SKILL.md (live) ---
|
|
1454
|
+
|
|
1455
|
+
${skillMd}`
|
|
1456
|
+
);
|
|
1457
|
+
})
|
|
1458
|
+
);
|
|
1459
|
+
server.registerTool(
|
|
1460
|
+
"install_skill",
|
|
1461
|
+
{
|
|
1462
|
+
title: "Install the BoardUI agent skill",
|
|
1463
|
+
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.",
|
|
1464
|
+
inputSchema: {
|
|
1465
|
+
overwrite: z.boolean().optional().describe("Overwrite an existing install (default false: existing files are kept). This is how the skill updates."),
|
|
1466
|
+
projectDir: z.string().optional().describe("Absolute path of the project root; defaults to the server's working directory.")
|
|
1467
|
+
},
|
|
1468
|
+
annotations: { destructiveHint: false }
|
|
1469
|
+
},
|
|
1470
|
+
safe(
|
|
1471
|
+
async ({ overwrite = false, projectDir }) => {
|
|
1472
|
+
const project = loadProject(projectDir);
|
|
1473
|
+
const items = await resolveItems([SKILL_ITEM_NAME]);
|
|
1474
|
+
const targetDir = path7.join(project.cwd, ".claude", "skills", "boardui");
|
|
1475
|
+
const report = writeFiles(collectWrites(items, targetDir), overwrite);
|
|
1476
|
+
const lines = [
|
|
1477
|
+
...report.created.map((relPath) => ` created .claude/skills/boardui/${relPath}`),
|
|
1478
|
+
...report.overwritten.map((relPath) => ` updated .claude/skills/boardui/${relPath}`),
|
|
1479
|
+
...report.skipped.map(
|
|
1480
|
+
(relPath) => ` skipped ${relPath} (exists \u2014 pass overwrite to update)`
|
|
1481
|
+
)
|
|
1482
|
+
];
|
|
1483
|
+
if (report.created.length + report.overwritten.length > 0) {
|
|
1484
|
+
await trackSkillInstall({ scope: "project", source: "mcp" });
|
|
1485
|
+
lines.push(
|
|
1486
|
+
"",
|
|
1487
|
+
"Skill-capable agents discover it automatically in new sessions (Claude Code loads .claude/skills without configuration)."
|
|
1488
|
+
);
|
|
1489
|
+
}
|
|
1490
|
+
return text(lines.join("\n"));
|
|
1491
|
+
}
|
|
1492
|
+
)
|
|
1493
|
+
);
|
|
1406
1494
|
server.registerTool(
|
|
1407
1495
|
"get_theme",
|
|
1408
1496
|
{
|
|
@@ -1496,10 +1584,75 @@ NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proF
|
|
|
1496
1584
|
return text("Seat released and license removed from this machine.");
|
|
1497
1585
|
})
|
|
1498
1586
|
);
|
|
1587
|
+
process.on("SIGTERM", async () => {
|
|
1588
|
+
await posthog.shutdown();
|
|
1589
|
+
process.exit(0);
|
|
1590
|
+
});
|
|
1499
1591
|
await server.connect(new StdioServerTransport());
|
|
1500
1592
|
console.error(`boardui mcp v${CLI_VERSION} ready (stdio)`);
|
|
1501
1593
|
}
|
|
1502
1594
|
|
|
1595
|
+
// src/commands/skill.ts
|
|
1596
|
+
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "fs";
|
|
1597
|
+
import { homedir as homedir3 } from "os";
|
|
1598
|
+
import path8 from "path";
|
|
1599
|
+
import ora3 from "ora";
|
|
1600
|
+
import pc5 from "picocolors";
|
|
1601
|
+
var KNOWN_CLIENTS = ["codex", "gemini"];
|
|
1602
|
+
function installedVersion(targetDir) {
|
|
1603
|
+
try {
|
|
1604
|
+
const skillPath = path8.join(targetDir, "SKILL.md");
|
|
1605
|
+
if (!existsSync7(skillPath)) return null;
|
|
1606
|
+
const match = readFileSync7(skillPath, "utf8").match(/^\s*version:\s*(\S+)\s*$/m);
|
|
1607
|
+
return match?.[1] ?? null;
|
|
1608
|
+
} catch {
|
|
1609
|
+
return null;
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
async function skill(options) {
|
|
1613
|
+
if (options.client && !KNOWN_CLIENTS.includes(options.client)) {
|
|
1614
|
+
console.log(
|
|
1615
|
+
pc5.yellow(
|
|
1616
|
+
`warning: unknown client "${options.client}" \u2014 installing to ~/.agents/skills/boardui, the shared convention Codex and Gemini read.`
|
|
1617
|
+
)
|
|
1618
|
+
);
|
|
1619
|
+
}
|
|
1620
|
+
const targetDir = skillTargetDir(options, process.cwd(), homedir3());
|
|
1621
|
+
const before = installedVersion(targetDir);
|
|
1622
|
+
const spinner = ora3("Fetching the BoardUI agent skill...").start();
|
|
1623
|
+
let items;
|
|
1624
|
+
try {
|
|
1625
|
+
items = await resolveItems([SKILL_ITEM_NAME]);
|
|
1626
|
+
} catch (error) {
|
|
1627
|
+
spinner.fail(error.message);
|
|
1628
|
+
process.exitCode = 1;
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1631
|
+
const fetched = items.flatMap((item) => item.files).find((file) => file.target === "SKILL.md")?.content.match(/^\s*version:\s*(\S+)\s*$/m)?.[1];
|
|
1632
|
+
spinner.succeed(
|
|
1633
|
+
before && fetched && before !== fetched ? `Skill fetched (installed ${before} -> ${fetched}).` : `Skill fetched${fetched ? ` (version ${fetched})` : ""}.`
|
|
1634
|
+
);
|
|
1635
|
+
const report = writeFiles(collectWrites(items, targetDir), Boolean(options.force));
|
|
1636
|
+
const shortDir = targetDir.startsWith(homedir3()) ? `~${targetDir.slice(homedir3().length)}` : path8.relative(process.cwd(), targetDir) || ".";
|
|
1637
|
+
for (const relPath of report.created) console.log(` ${pc5.green("created")} ${shortDir}/${relPath}`);
|
|
1638
|
+
for (const relPath of report.overwritten) console.log(` ${pc5.green("updated")} ${shortDir}/${relPath}`);
|
|
1639
|
+
for (const relPath of report.skipped) {
|
|
1640
|
+
console.log(` ${pc5.dim("skipped (exists \u2014 pass --force to update)")} ${relPath}`);
|
|
1641
|
+
}
|
|
1642
|
+
const telemetry = trackSkillInstall({
|
|
1643
|
+
scope: options.path ? "path" : options.client ? "agents" : options.global ? "global" : "project",
|
|
1644
|
+
client: options.client && KNOWN_CLIENTS.includes(options.client) ? options.client : void 0
|
|
1645
|
+
});
|
|
1646
|
+
if (report.created.length + report.overwritten.length > 0) {
|
|
1647
|
+
console.log(
|
|
1648
|
+
`
|
|
1649
|
+
${pc5.bold("Done.")} Agents that support skills discover it automatically in new sessions.
|
|
1650
|
+
${pc5.dim("Update any time: npx boardui@latest skill --force")}`
|
|
1651
|
+
);
|
|
1652
|
+
}
|
|
1653
|
+
await telemetry;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1503
1656
|
// src/index.ts
|
|
1504
1657
|
var program = new Command();
|
|
1505
1658
|
program.name("boardui").description("Add BoardUI components to your project.").version(CLI_VERSION, "-v, --version");
|
|
@@ -1515,6 +1668,9 @@ program.command("list").description("List all available components.").action(asy
|
|
|
1515
1668
|
program.command("mcp").description("Start the BoardUI MCP server (stdio) so AI agents can browse and install components.").action(async () => {
|
|
1516
1669
|
await mcp();
|
|
1517
1670
|
});
|
|
1671
|
+
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) => {
|
|
1672
|
+
await skill(options);
|
|
1673
|
+
});
|
|
1518
1674
|
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
1675
|
await login(key);
|
|
1520
1676
|
});
|
|
@@ -1522,7 +1678,7 @@ program.command("logout").description("Release this machine's Pro seat and remov
|
|
|
1522
1678
|
await logout();
|
|
1523
1679
|
});
|
|
1524
1680
|
program.parseAsync().catch((error) => {
|
|
1525
|
-
console.error(
|
|
1681
|
+
console.error(pc6.red(`
|
|
1526
1682
|
${error.message}`));
|
|
1527
1683
|
process.exit(1);
|
|
1528
1684
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "boardui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
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
|
},
|