boardui 0.5.5 → 0.5.6

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.
Files changed (3) hide show
  1. package/README.md +92 -0
  2. package/dist/index.js +255 -113
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -87,6 +87,98 @@ npx boardui@latest login 12CA1606-...
87
87
  Releases this machine's Lemon Squeezy activation and removes the locally stored
88
88
  license.
89
89
 
90
+ ## Custom paths and monorepos
91
+
92
+ Add an optional `boardui.json` next to the **destination package's**
93
+ `package.json`. Without this file, the existing root/`src` layout and `@/`
94
+ imports are unchanged. CLI `init`/`add` and MCP installations read the same
95
+ configuration; free and Pro components both support it.
96
+
97
+ For a shared package named `@workspace/ui` at `packages/ui`, use:
98
+
99
+ ```json
100
+ {
101
+ "paths": {
102
+ "components": "src/components",
103
+ "utils": "src/utils",
104
+ "hooks": "src/hooks",
105
+ "styles": "src/styles",
106
+ "lib": "src/lib"
107
+ },
108
+ "aliases": {
109
+ "components": "@workspace/ui/components",
110
+ "utils": "@workspace/ui/utils",
111
+ "hooks": "@workspace/ui/hooks",
112
+ "styles": "@workspace/ui/styles",
113
+ "lib": "@workspace/ui/lib"
114
+ }
115
+ }
116
+ ```
117
+
118
+ Run the commands from that package:
119
+
120
+ ```bash
121
+ cd packages/ui
122
+ npx boardui@latest init
123
+ npx boardui@latest add button
124
+ ```
125
+
126
+ The button lands in `src/components/base/buttons/button.tsx`. Its
127
+ `@/utils/cx` import becomes `@workspace/ui/utils/cx`, and its utility lands
128
+ in `src/utils/cx.ts`. Relative imports are adjusted when their destination
129
+ moves. Existing files still skip by default; `--overwrite` replaces them.
130
+
131
+ - Supported groups are `components`, `utils`, `hooks`, `styles`, and `lib`.
132
+ Configure both a path and an alias for each group you change. Omitted
133
+ groups keep the normal source-root path and `@/<group>` alias.
134
+ - Paths are relative to the directory containing `boardui.json` and must
135
+ remain inside that package. Aliases are import prefixes, without `*`.
136
+ They must already resolve through your TypeScript/bundler configuration
137
+ or package exports; BoardUI does not create those mappings for you.
138
+ - Dependencies install into the package where you run the CLI. Configured
139
+ projects also look up parent directories for workspace lockfiles to
140
+ select npm, pnpm, Yarn, or Bun. Run from `packages/ui`, not the monorepo
141
+ root with a path pointing into it.
142
+ - `--path`/`--dir` keep working for unconfigured projects. Combining them
143
+ with configured mappings reports an error before installation; put the
144
+ destination in `boardui.json` instead.
145
+ - `app/` routes stay under the normal source root; `public/` assets and
146
+ `.cursor/` rules stay at the package root. Install full-page templates
147
+ into the consuming app. This feature does not split a template's files
148
+ or dependencies across multiple workspace packages.
149
+ - Changing this config does not relocate previously installed files.
150
+ Use it before the first install, or migrate existing files/imports to
151
+ match the new layout before adding more components.
152
+
153
+ For the shared-package example, the package must expose its source. A
154
+ typical `packages/ui/package.json` exports section is:
155
+
156
+ ```json
157
+ {
158
+ "name": "@workspace/ui",
159
+ "exports": {
160
+ "./components/*": "./src/components/*.tsx",
161
+ "./utils/*": "./src/utils/*.ts",
162
+ "./hooks/*": "./src/hooks/*.ts",
163
+ "./styles/*": "./src/styles/*",
164
+ "./lib/*": "./src/lib/*.ts"
165
+ }
166
+ }
167
+ ```
168
+
169
+ Adapt extensions or explicit exports to your package's files and build
170
+ process. Each app must depend on the workspace package, import
171
+ `@workspace/ui/styles/globals.css`, and include the shared component source
172
+ in Tailwind's source detection. If needed, use Tailwind v4's `@source`
173
+ directive in the app stylesheet, with a path relative to that stylesheet.
174
+ The app's bundler must also compile the package's TypeScript/TSX source.
175
+
176
+ For MCP, pass the absolute `packages/ui` directory as `projectDir` to
177
+ `init_boardui`, `install_components`, and `install_rules`. Also pass it to
178
+ `get_component` and `get_usage_examples` to receive matching imports and
179
+ paths. Without `projectDir`, those read tools return the original registry
180
+ source/examples. Installed agent rules use the configured aliases too.
181
+
90
182
  ## Environment
91
183
 
92
184
  | Variable | Description |
package/dist/index.js CHANGED
@@ -5,27 +5,148 @@ import { Command } from "commander";
5
5
  import pc6 from "picocolors";
6
6
 
7
7
  // src/commands/add.ts
8
- import path5 from "path";
8
+ import path7 from "path";
9
9
  import ora from "ora";
10
10
  import pc from "picocolors";
11
11
  import prompts from "prompts";
12
12
 
13
+ // src/lib/config.ts
14
+ import { existsSync, readFileSync } from "fs";
15
+ import path from "path";
16
+ var SOURCE_GROUPS = ["components", "utils", "hooks", "styles", "lib"];
17
+ function object(value, label) {
18
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
19
+ throw new Error(`boardui.json: ${label} must be an object.`);
20
+ }
21
+ return value;
22
+ }
23
+ function readConfig(cwd) {
24
+ const configPath = path.join(cwd, "boardui.json");
25
+ if (!existsSync(configPath)) return void 0;
26
+ let raw;
27
+ try {
28
+ raw = JSON.parse(readFileSync(configPath, "utf8"));
29
+ } catch {
30
+ throw new Error("boardui.json: could not read valid JSON.");
31
+ }
32
+ const config = object(raw, "config");
33
+ for (const key of Object.keys(config)) {
34
+ if (!["$schema", "paths", "aliases"].includes(key)) {
35
+ throw new Error(`boardui.json: unknown option "${key}". Use paths and aliases.`);
36
+ }
37
+ }
38
+ const paths = object(config.paths === void 0 ? {} : config.paths, "paths");
39
+ const aliases = object(config.aliases === void 0 ? {} : config.aliases, "aliases");
40
+ const result = { paths: {}, aliases: {} };
41
+ for (const key of /* @__PURE__ */ new Set([...Object.keys(paths), ...Object.keys(aliases)])) {
42
+ if (!SOURCE_GROUPS.includes(key)) {
43
+ throw new Error(`boardui.json: unknown source group "${key}". Use ${SOURCE_GROUPS.join(", ")}.`);
44
+ }
45
+ const group = key;
46
+ const destination = paths[group];
47
+ const alias = aliases[group];
48
+ if (typeof destination !== "string" || !destination.trim() || typeof alias !== "string" || !alias.trim()) {
49
+ throw new Error(`boardui.json: configure both paths.${group} and aliases.${group} as non-empty strings.`);
50
+ }
51
+ const relative = path.relative(cwd, path.resolve(cwd, destination));
52
+ if (path.isAbsolute(destination) || path.win32.isAbsolute(destination) || destination.includes("\\") || /[\x00-\x1f*'"`${}]/.test(destination) || relative === ".." || relative.startsWith(`..${path.sep}`)) {
53
+ throw new Error(`boardui.json: paths.${group} must stay inside this package. Run BoardUI from the destination package instead.`);
54
+ }
55
+ const prefix = alias.replace(/\/+$/, "");
56
+ if (!prefix || /^[./]/.test(prefix) || /[^a-zA-Z0-9@#~_./-]/.test(prefix) || prefix.split("/").some((part) => !part || part === "." || part === "..")) {
57
+ throw new Error(`boardui.json: aliases.${group} must be an import prefix without wildcards (for example "@workspace/ui/${group}").`);
58
+ }
59
+ result.paths[group] = destination;
60
+ result.aliases[group] = prefix;
61
+ }
62
+ return result;
63
+ }
64
+ function sourceGroup(relPath) {
65
+ return SOURCE_GROUPS.find((group) => relPath === group || relPath.startsWith(`${group}/`));
66
+ }
67
+ function mappedPath(relPath, targetRoot, cwd, config) {
68
+ const group = sourceGroup(relPath);
69
+ const destination = group && config?.paths[group];
70
+ return destination ? path.resolve(cwd, destination, relPath.slice(group.length + 1)) : path.join(targetRoot, relPath);
71
+ }
72
+ function mappedImport(specifier, config) {
73
+ if (!specifier.startsWith("@/")) return specifier;
74
+ const group = sourceGroup(specifier.slice(2));
75
+ const alias = group && config?.aliases[group];
76
+ return alias ? alias + specifier.slice(group.length + 2) : specifier;
77
+ }
78
+ function checkDirectoryOverride(config, directory) {
79
+ if (directory && config && Object.keys(config.paths).length) {
80
+ throw new Error("Use paths in boardui.json instead of --path/--dir when custom aliases are configured.");
81
+ }
82
+ }
83
+ function needsAtAlias(config) {
84
+ return SOURCE_GROUPS.some((group) => (config?.aliases[group] ?? `@/${group}`).startsWith("@/"));
85
+ }
86
+ function mappedDocumentation(content, config) {
87
+ if (!config || !Object.keys(config.aliases).length) return content;
88
+ return content.replace(/@\/(?:components|utils|hooks|styles|lib)(?=\/|[\s`'"),.;:\]]|$)/g, (prefix) => mappedImport(prefix, config)).replace(/the `@\/` alias/g, "the aliases configured in `boardui.json`");
89
+ }
90
+
13
91
  // src/lib/installer.ts
14
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
15
- import path3 from "path";
92
+ import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
93
+ import path5 from "path";
94
+
95
+ // src/lib/imports.ts
96
+ import path2 from "path";
97
+ import ts from "typescript";
98
+ function rewriteImports(content, relPath, targetRoot, cwd, config) {
99
+ if (!config || !Object.keys(config.paths).length || !/\.[cm]?[jt]sx?$/.test(relPath)) return content;
100
+ const source = ts.createSourceFile(relPath, content, ts.ScriptTarget.Latest, true);
101
+ const edits = [];
102
+ const filePath = mappedPath(relPath, targetRoot, cwd, config);
103
+ function rewrite(node) {
104
+ if (!node || !ts.isStringLiteralLike(node)) return;
105
+ const specifier = node.text;
106
+ let replacement = mappedImport(specifier, config);
107
+ if (specifier.startsWith("./") || specifier.startsWith("../")) {
108
+ const referenced = path2.posix.normalize(path2.posix.join(path2.posix.dirname(relPath), specifier));
109
+ const target = mappedPath(referenced, targetRoot, cwd, config);
110
+ let relative = path2.relative(path2.dirname(filePath), target).split(path2.sep).join("/");
111
+ if (!relative.startsWith(".")) relative = `./${relative}`;
112
+ if (path2.resolve(path2.dirname(filePath), specifier) !== target) replacement = relative;
113
+ }
114
+ if (replacement !== specifier) {
115
+ edits.push({ start: node.getStart(source) + 1, end: node.getEnd() - 1, value: replacement });
116
+ }
117
+ }
118
+ function visit(node) {
119
+ if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) rewrite(node.moduleSpecifier);
120
+ else if (ts.isExternalModuleReference(node)) rewrite(node.expression);
121
+ else if (ts.isImportTypeNode(node) && ts.isLiteralTypeNode(node.argument)) rewrite(node.argument.literal);
122
+ else if (ts.isCallExpression(node) && (node.expression.kind === ts.SyntaxKind.ImportKeyword || ts.isIdentifier(node.expression) && node.expression.text === "require")) {
123
+ rewrite(node.arguments[0]);
124
+ }
125
+ ts.forEachChild(node, visit);
126
+ }
127
+ visit(source);
128
+ for (const edit of edits.sort((a, b) => b.start - a.start)) {
129
+ content = content.slice(0, edit.start) + edit.value + content.slice(edit.end);
130
+ }
131
+ return content;
132
+ }
16
133
 
17
134
  // src/lib/install.ts
18
135
  import { spawn } from "child_process";
19
136
 
20
137
  // src/lib/project.ts
21
- import { existsSync, readFileSync } from "fs";
22
- import path from "path";
23
- function detectPackageManager(cwd) {
24
- if (existsSync(path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
25
- if (existsSync(path.join(cwd, "yarn.lock"))) return "yarn";
26
- if (existsSync(path.join(cwd, "bun.lock")) || existsSync(path.join(cwd, "bun.lockb"))) {
138
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
139
+ import path3 from "path";
140
+ function detectPackageManager(cwd, searchParents = false) {
141
+ if (existsSync2(path3.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
142
+ if (existsSync2(path3.join(cwd, "yarn.lock"))) return "yarn";
143
+ if (existsSync2(path3.join(cwd, "bun.lock")) || existsSync2(path3.join(cwd, "bun.lockb"))) {
27
144
  return "bun";
28
145
  }
146
+ if (existsSync2(path3.join(cwd, "package-lock.json"))) return "npm";
147
+ if (searchParents && path3.dirname(cwd) !== cwd) {
148
+ return detectPackageManager(path3.dirname(cwd), true);
149
+ }
29
150
  return "npm";
30
151
  }
31
152
  function installCommand(pm, packages) {
@@ -79,13 +200,15 @@ function parseJsonc(raw) {
79
200
  return JSON.parse(out.replace(/,\s*([}\]])/g, "$1"));
80
201
  }
81
202
  function readProject(cwd) {
82
- const pkgPath = path.join(cwd, "package.json");
83
- if (!existsSync(pkgPath)) {
203
+ cwd = path3.resolve(cwd);
204
+ const pkgPath = path3.join(cwd, "package.json");
205
+ if (!existsSync2(pkgPath)) {
84
206
  throw new Error(
85
207
  "No package.json found in the current directory. Run this command from your project root."
86
208
  );
87
209
  }
88
- const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
210
+ const pkg = JSON.parse(readFileSync2(pkgPath, "utf8"));
211
+ const config = readConfig(cwd);
89
212
  const dependencyVersions = {
90
213
  ...pkg.devDependencies ?? {},
91
214
  ...pkg.dependencies ?? {}
@@ -97,11 +220,11 @@ function readProject(cwd) {
97
220
  let hasAtAlias = false;
98
221
  let aliasBase = ".";
99
222
  for (const configName of ["tsconfig.json", "jsconfig.json"]) {
100
- const configPath = path.join(cwd, configName);
101
- if (!existsSync(configPath)) continue;
223
+ const configPath = path3.join(cwd, configName);
224
+ if (!existsSync2(configPath)) continue;
102
225
  try {
103
- const config = parseJsonc(readFileSync(configPath, "utf8"));
104
- const atPaths = config.compilerOptions?.paths?.["@/*"];
226
+ const config2 = parseJsonc(readFileSync2(configPath, "utf8"));
227
+ const atPaths = config2.compilerOptions?.paths?.["@/*"];
105
228
  if (atPaths && atPaths.length > 0) {
106
229
  hasAtAlias = true;
107
230
  aliasBase = atPaths[0].replace(/\/?\*$/, "") || ".";
@@ -110,10 +233,11 @@ function readProject(cwd) {
110
233
  }
111
234
  break;
112
235
  }
113
- const usesSrcDir = existsSync(path.join(cwd, "src")) && (aliasBase.includes("src") || existsSync(path.join(cwd, "src", "app")) || existsSync(path.join(cwd, "src", "pages")));
236
+ const usesSrcDir = existsSync2(path3.join(cwd, "src")) && (aliasBase.includes("src") || existsSync2(path3.join(cwd, "src", "app")) || existsSync2(path3.join(cwd, "src", "pages")));
114
237
  return {
115
238
  cwd,
116
- packageManager: detectPackageManager(cwd),
239
+ config,
240
+ packageManager: detectPackageManager(cwd, Boolean(config)),
117
241
  isNextJs: installedDependencies.has("next"),
118
242
  hasAtAlias,
119
243
  usesSrcDir,
@@ -122,7 +246,7 @@ function readProject(cwd) {
122
246
  };
123
247
  }
124
248
  function sourceRoot(project) {
125
- return project.usesSrcDir ? path.join(project.cwd, "src") : project.cwd;
249
+ return project.usesSrcDir ? path3.join(project.cwd, "src") : project.cwd;
126
250
  }
127
251
 
128
252
  // src/lib/install.ts
@@ -140,18 +264,18 @@ async function installPackages(pm, packages, cwd) {
140
264
  }
141
265
 
142
266
  // src/lib/license.ts
143
- import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, rmSync, writeFileSync } from "fs";
267
+ import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync3, rmSync, writeFileSync } from "fs";
144
268
  import { homedir, hostname } from "os";
145
- import path2 from "path";
269
+ import path4 from "path";
146
270
  var LICENSE_API = process.env.BOARDUI_LICENSE_API ?? "https://www.boardui.com/api/licenses";
147
271
  var PRO_PRODUCT_IDS = /* @__PURE__ */ new Set([1220683, 1268490]);
148
272
  function configRoot() {
149
273
  if (process.env.XDG_CONFIG_HOME) return process.env.XDG_CONFIG_HOME;
150
274
  if (process.platform === "win32" && process.env.APPDATA) return process.env.APPDATA;
151
- return path2.join(homedir(), ".config");
275
+ return path4.join(homedir(), ".config");
152
276
  }
153
277
  function licenseFile() {
154
- return path2.join(configRoot(), "boardui", "license.json");
278
+ return path4.join(configRoot(), "boardui", "license.json");
155
279
  }
156
280
  function getLicense() {
157
281
  const envKey = process.env.BOARDUI_LICENSE_KEY;
@@ -164,8 +288,8 @@ function getLicense() {
164
288
  }
165
289
  try {
166
290
  const file = licenseFile();
167
- if (!existsSync2(file)) return null;
168
- const stored = JSON.parse(readFileSync2(file, "utf8"));
291
+ if (!existsSync3(file)) return null;
292
+ const stored = JSON.parse(readFileSync3(file, "utf8"));
169
293
  if (typeof stored.licenseKey !== "string" || stored.licenseKey.length === 0) return null;
170
294
  return {
171
295
  licenseKey: stored.licenseKey,
@@ -204,7 +328,7 @@ async function activateLicense(licenseKey) {
204
328
  throw new Error(data.error ?? "Could not activate this license key.");
205
329
  }
206
330
  const file = licenseFile();
207
- mkdirSync(path2.dirname(file), { recursive: true });
331
+ mkdirSync(path4.dirname(file), { recursive: true });
208
332
  writeFileSync(
209
333
  file,
210
334
  JSON.stringify(
@@ -385,10 +509,10 @@ var INIT_ITEMS = ["globals", "cx", "use-dismiss-on-outside-press", "rules"];
385
509
  var RULES_ITEM_NAME = "rules";
386
510
  var SKILL_ITEM_NAME = "skill";
387
511
  function skillTargetDir(options, cwd, home) {
388
- if (options.path) return path3.resolve(cwd, options.path);
389
- if (options.client) return path3.join(home, ".agents", "skills", "boardui");
390
- if (options.global) return path3.join(home, ".claude", "skills", "boardui");
391
- return path3.join(cwd, ".claude", "skills", "boardui");
512
+ if (options.path) return path5.resolve(cwd, options.path);
513
+ if (options.client) return path5.join(home, ".agents", "skills", "boardui");
514
+ if (options.global) return path5.join(home, ".claude", "skills", "boardui");
515
+ return path5.join(cwd, ".claude", "skills", "boardui");
392
516
  }
393
517
  var RULES_START_MARKER = "<!-- boardui:rules:start -->";
394
518
  var RULES_END_MARKER = "<!-- boardui:rules:end -->";
@@ -400,13 +524,13 @@ function syncAgentsRules(projectCwd, rulesMarkdown) {
400
524
  const block = `${RULES_START_MARKER}
401
525
  ${stripFrontmatter(rulesMarkdown).trim()}
402
526
  ${RULES_END_MARKER}`;
403
- const agentsPath = path3.join(projectCwd, "AGENTS.md");
404
- if (!existsSync3(agentsPath)) {
527
+ const agentsPath = path5.join(projectCwd, "AGENTS.md");
528
+ if (!existsSync4(agentsPath)) {
405
529
  writeFileSync2(agentsPath, `${block}
406
530
  `);
407
531
  return "created";
408
532
  }
409
- const current = readFileSync3(agentsPath, "utf8");
533
+ const current = readFileSync4(agentsPath, "utf8");
410
534
  const start = current.indexOf(RULES_START_MARKER);
411
535
  const end = current.indexOf(RULES_END_MARKER);
412
536
  if (start !== -1 && end > start) {
@@ -423,15 +547,17 @@ ${block}
423
547
  function isRootAnchored(relPath) {
424
548
  return relPath.startsWith(".") || relPath.startsWith("public/");
425
549
  }
426
- function collectWrites(items, targetRoot, rootAnchor = targetRoot) {
550
+ function collectWrites(items, targetRoot, rootAnchor = targetRoot, config) {
427
551
  const writesByPath = /* @__PURE__ */ new Map();
428
552
  for (const item of items) {
429
553
  for (const file of item.files) {
430
- const relPath = file.target ?? file.path;
431
- const absPath = path3.join(isRootAnchored(relPath) ? rootAnchor : targetRoot, relPath);
554
+ const originalPath = file.target ?? file.path;
555
+ const absPath = isRootAnchored(originalPath) ? path5.join(rootAnchor, originalPath) : mappedPath(originalPath, targetRoot, rootAnchor, config);
556
+ const relPath = config ? path5.relative(rootAnchor, absPath) : originalPath;
557
+ const content = /\.(md|mdc)$/.test(originalPath) ? mappedDocumentation(file.content, config) : rewriteImports(file.content, originalPath, targetRoot, rootAnchor, config);
432
558
  const pending = writesByPath.get(absPath);
433
559
  if (pending) {
434
- if (pending.content !== file.content) {
560
+ if (pending.content !== content) {
435
561
  throw new Error(`Registry items resolve to conflicting content for ${relPath}.`);
436
562
  }
437
563
  continue;
@@ -439,8 +565,8 @@ function collectWrites(items, targetRoot, rootAnchor = targetRoot) {
439
565
  writesByPath.set(absPath, {
440
566
  absPath,
441
567
  relPath,
442
- content: file.content,
443
- exists: existsSync3(absPath)
568
+ content,
569
+ exists: existsSync4(absPath)
444
570
  });
445
571
  }
446
572
  }
@@ -453,7 +579,7 @@ function writeFiles(writes, overwrite) {
453
579
  report.skipped.push(write.relPath);
454
580
  continue;
455
581
  }
456
- mkdirSync2(path3.dirname(write.absPath), { recursive: true });
582
+ mkdirSync2(path5.dirname(write.absPath), { recursive: true });
457
583
  writeFileSync2(write.absPath, write.content);
458
584
  (write.exists ? report.overwritten : report.created).push(write.relPath);
459
585
  }
@@ -462,15 +588,15 @@ function writeFiles(writes, overwrite) {
462
588
  async function downloadAssets(items, targetRoot, overwrite, rootAnchor = targetRoot) {
463
589
  const report = { fetched: [], skipped: [], failed: [] };
464
590
  for (const asset of items.flatMap((item) => item.assets ?? [])) {
465
- const absPath = path3.join(isRootAnchored(asset.target) ? rootAnchor : targetRoot, asset.target);
466
- if (existsSync3(absPath) && !overwrite) {
591
+ const absPath = path5.join(isRootAnchored(asset.target) ? rootAnchor : targetRoot, asset.target);
592
+ if (existsSync4(absPath) && !overwrite) {
467
593
  report.skipped.push(asset.target);
468
594
  continue;
469
595
  }
470
596
  try {
471
597
  const response = await fetch(`${assetsBaseUrl()}${asset.url}`);
472
598
  if (!response.ok) throw new Error(`HTTP ${response.status}`);
473
- mkdirSync2(path3.dirname(absPath), { recursive: true });
599
+ mkdirSync2(path5.dirname(absPath), { recursive: true });
474
600
  writeFileSync2(absPath, Buffer.from(await response.arrayBuffer()));
475
601
  report.fetched.push(asset.target);
476
602
  } catch {
@@ -515,14 +641,14 @@ async function installMissingDependencies(project, wanted) {
515
641
 
516
642
  // src/lib/telemetry.ts
517
643
  import { randomUUID } from "crypto";
518
- import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
644
+ import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "fs";
519
645
  import { homedir as homedir2 } from "os";
520
- import path4 from "path";
646
+ import path6 from "path";
521
647
 
522
648
  // src/version.ts
523
- import { readFileSync as readFileSync4 } from "fs";
649
+ import { readFileSync as readFileSync5 } from "fs";
524
650
  var packageJson = JSON.parse(
525
- readFileSync4(new URL("../package.json", import.meta.url), "utf8")
651
+ readFileSync5(new URL("../package.json", import.meta.url), "utf8")
526
652
  );
527
653
  var CLI_VERSION = packageJson.version;
528
654
 
@@ -538,22 +664,22 @@ function isTelemetryEnabled() {
538
664
  function configRoot2() {
539
665
  if (process.env.XDG_CONFIG_HOME) return process.env.XDG_CONFIG_HOME;
540
666
  if (process.platform === "win32" && process.env.APPDATA) return process.env.APPDATA;
541
- return path4.join(homedir2(), ".config");
667
+ return path6.join(homedir2(), ".config");
542
668
  }
543
669
  function anonymousIdFile() {
544
- return path4.join(configRoot2(), "boardui", "telemetry.json");
670
+ return path6.join(configRoot2(), "boardui", "telemetry.json");
545
671
  }
546
672
  function getAnonymousId() {
547
673
  const file = anonymousIdFile();
548
674
  try {
549
- if (existsSync4(file)) {
550
- const stored = JSON.parse(readFileSync5(file, "utf8"));
675
+ if (existsSync5(file)) {
676
+ const stored = JSON.parse(readFileSync6(file, "utf8"));
551
677
  if (typeof stored.anonymousId === "string" && UUID_V4_RE.test(stored.anonymousId)) {
552
678
  return stored.anonymousId;
553
679
  }
554
680
  }
555
681
  const anonymousId = randomUUID();
556
- mkdirSync3(path4.dirname(file), { recursive: true, mode: 448 });
682
+ mkdirSync3(path6.dirname(file), { recursive: true, mode: 448 });
557
683
  writeFileSync3(file, `${JSON.stringify({ anonymousId }, null, 2)}
558
684
  `, {
559
685
  encoding: "utf8",
@@ -648,7 +774,8 @@ async function pickComponents() {
648
774
  }
649
775
  async function add(components, options) {
650
776
  const project = readProject(process.cwd());
651
- if (!project.hasAtAlias) {
777
+ checkDirectoryOverride(project.config, options.path ?? options.dir);
778
+ if (!project.hasAtAlias && needsAtAlias(project.config)) {
652
779
  console.log(
653
780
  pc.yellow(
654
781
  `warning: no "@/*" path alias found in tsconfig.json \u2014 BoardUI components import via "@/". Add:
@@ -680,8 +807,8 @@ async function add(components, options) {
680
807
  spinner.succeed(
681
808
  `Resolved ${items.length} item${items.length === 1 ? "" : "s"}: ${items.map((i) => i.name).join(", ")}`
682
809
  );
683
- const targetRoot = options.path ? path5.resolve(process.cwd(), options.path) : options.dir ? path5.resolve(process.cwd(), options.dir) : sourceRoot(project);
684
- const writes = collectWrites(items, targetRoot, project.cwd);
810
+ const targetRoot = options.path ? path7.resolve(process.cwd(), options.path) : options.dir ? path7.resolve(process.cwd(), options.dir) : sourceRoot(project);
811
+ const writes = collectWrites(items, targetRoot, project.cwd, project.config);
685
812
  const conflicts = writes.filter((w) => w.exists);
686
813
  let overwrite = Boolean(options.overwrite);
687
814
  if (conflicts.length > 0 && !overwrite && !options.yes) {
@@ -774,7 +901,7 @@ ${pc.bold("Note:")} Tailwind was installed. Make sure a ${pc.cyan("postcss.confi
774
901
  console.log(
775
902
  `
776
903
  ${pc.bold("Note:")} import the BoardUI styles in your root layout or global css:
777
- ${pc.cyan(`@import "../styles/globals.css";`)} ${pc.dim("(adjust the relative path)")}`
904
+ ${pc.cyan(`import "${mappedImport("@/styles/globals.css", project.config)}";`)}`
778
905
  );
779
906
  }
780
907
  const written = report.created.length + report.overwritten.length;
@@ -789,13 +916,13 @@ Done. ${written} file${written === 1 ? "" : "s"} written.`));
789
916
  }
790
917
 
791
918
  // src/commands/init.ts
792
- import { existsSync as existsSync5, mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "fs";
793
- import path6 from "path";
919
+ import path8 from "path";
794
920
  import ora2 from "ora";
795
921
  import pc2 from "picocolors";
796
922
  import prompts2 from "prompts";
797
923
  async function init(options) {
798
924
  const project = readProject(process.cwd());
925
+ checkDirectoryOverride(project.config, options.dir);
799
926
  console.log(pc2.bold("\nBoardUI init\n"));
800
927
  if (!project.isNextJs) {
801
928
  console.log(
@@ -804,7 +931,7 @@ async function init(options) {
804
931
  )
805
932
  );
806
933
  }
807
- if (!project.hasAtAlias) {
934
+ if (!project.hasAtAlias && needsAtAlias(project.config)) {
808
935
  console.log(
809
936
  pc2.yellow(
810
937
  `warning: no "@/*" path alias found in tsconfig.json \u2014 BoardUI components import via "@/". Add:
@@ -816,7 +943,7 @@ async function init(options) {
816
943
  const { confirmed } = await prompts2({
817
944
  type: "confirm",
818
945
  name: "confirmed",
819
- message: `Set up BoardUI in ${path6.basename(project.cwd)}? (installs Tailwind v4 + runtime deps, writes styles/ and utils/)`,
946
+ message: `Set up BoardUI in ${path8.basename(project.cwd)}? (installs Tailwind v4 + runtime deps, writes styles/ and utils/)`,
820
947
  initial: true
821
948
  });
822
949
  if (!confirmed) {
@@ -852,28 +979,18 @@ async function init(options) {
852
979
  return;
853
980
  }
854
981
  spinner.succeed("Foundations fetched.");
855
- const targetRoot = options.dir ? path6.resolve(process.cwd(), options.dir) : sourceRoot(project);
856
- for (const item of items) {
857
- for (const file of item.files) {
858
- const relPath = file.target ?? file.path;
859
- const absPath = path6.join(isRootAnchored(relPath) ? project.cwd : targetRoot, relPath);
860
- if (existsSync5(absPath) && !options.overwrite) {
861
- console.log(` ${pc2.dim("skipped (exists)")} ${relPath}`);
862
- continue;
863
- }
864
- mkdirSync4(path6.dirname(absPath), { recursive: true });
865
- writeFileSync4(absPath, file.content);
866
- console.log(` ${pc2.green("created")} ${relPath}`);
867
- }
868
- }
982
+ const targetRoot = options.dir ? path8.resolve(process.cwd(), options.dir) : sourceRoot(project);
983
+ const report = writeFiles(collectWrites(items, targetRoot, project.cwd, project.config), Boolean(options.overwrite));
984
+ for (const relPath of report.created) console.log(` ${pc2.green("created")} ${relPath}`);
985
+ for (const relPath of report.overwritten) console.log(` ${pc2.green("overwrote")} ${relPath}`);
986
+ for (const relPath of report.skipped) console.log(` ${pc2.dim("skipped (exists)")} ${relPath}`);
869
987
  const rulesItem = items.find((item) => item.name === RULES_ITEM_NAME);
870
988
  if (rulesItem?.files[0]?.content) {
871
- const outcome = syncAgentsRules(project.cwd, rulesItem.files[0].content);
989
+ const outcome = syncAgentsRules(project.cwd, mappedDocumentation(rulesItem.files[0].content, project.config));
872
990
  console.log(
873
991
  ` ${pc2.green(outcome === "created" ? "created" : outcome)} AGENTS.md ${pc2.dim("(always-on BoardUI rules for AI agents)")}`
874
992
  );
875
993
  }
876
- const globalsPath = project.usesSrcDir ? "src/styles/globals.css" : "styles/globals.css";
877
994
  const telemetry = dependenciesReady ? trackInitSuccess({
878
995
  packageManager: project.packageManager,
879
996
  pro: Boolean(options.pro)
@@ -883,10 +1000,10 @@ ${pc2.bold("Almost done \u2014 wire up the styles:")}
883
1000
 
884
1001
  1. Import the BoardUI stylesheet in your root layout (app/layout.tsx):
885
1002
 
886
- ${pc2.cyan(`import "@/styles/globals.css";`)}
1003
+ ${pc2.cyan(`import "${mappedImport("@/styles/globals.css", project.config)}";`)}
887
1004
 
888
- ${pc2.dim(`(replaces the default create-next-app "./globals.css" import \u2014 or add`)}
889
- ${pc2.dim(`@import "${globalsPath.startsWith("src/") ? "../styles/globals.css" : "../styles/globals.css"}"; to your existing global css instead)`)}
1005
+ ${pc2.dim(`(replaces the default create-next-app "./globals.css" import;`)}
1006
+ ${pc2.dim(`in a shared UI package, import the exported stylesheet in each consuming app)`)}
890
1007
 
891
1008
  2. Make sure PostCSS uses Tailwind v4 (postcss.config.mjs):
892
1009
 
@@ -967,8 +1084,8 @@ async function logout() {
967
1084
  }
968
1085
 
969
1086
  // src/commands/mcp.ts
970
- import { existsSync as existsSync6, readFileSync as readFileSync6 } from "fs";
971
- import path7 from "path";
1087
+ import { existsSync as existsSync6, readFileSync as readFileSync7 } from "fs";
1088
+ import path9 from "path";
972
1089
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
973
1090
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
974
1091
  import { instrument } from "@posthog/mcp";
@@ -984,12 +1101,14 @@ Typical flow:
984
1101
 
985
1102
  Component names are exact \u2014 when unsure, call list_components instead of guessing.
986
1103
 
987
- 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.
1104
+ 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
+
1106
+ 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.
988
1107
 
989
1108
  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
990
1109
 
991
1110
  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.`;
992
- var posthog = new PostHog("phc_Cp49ooHFujriAf92MgJgj2spJZ2kyBrJC2uUN8wDRqSV", {
1111
+ var posthog = new PostHog("", {
993
1112
  host: "https://eu.i.posthog.com"
994
1113
  });
995
1114
  var freeIndexPromise = null;
@@ -1036,8 +1155,7 @@ var UNRELEASED = {
1036
1155
  orb: "The BoardUI orb component is not available yet. It is still in progress and not open to public use."
1037
1156
  };
1038
1157
  var CURATED_SUGGESTIONS = {
1039
- textarea: ["input"],
1040
- "text-area": ["input"],
1158
+ "text-area": ["textarea"],
1041
1159
  form: ["input", "select", "checkbox"],
1042
1160
  modal: ["settings-modal", "auth-card"],
1043
1161
  dialog: ["settings-modal"],
@@ -1100,27 +1218,26 @@ function maskKey(key) {
1100
1218
  return key.length > 8 ? `${key.slice(0, 4)}\u2026${key.slice(-4)}` : "\u2026";
1101
1219
  }
1102
1220
  function loadProject(projectDir) {
1103
- const cwd = projectDir ? path7.resolve(projectDir) : process.cwd();
1104
- try {
1105
- return readProject(cwd);
1106
- } catch {
1221
+ const cwd = projectDir ? path9.resolve(projectDir) : process.cwd();
1222
+ if (!existsSync6(path9.join(cwd, "package.json"))) {
1107
1223
  throw new Error(
1108
1224
  `No package.json found in ${cwd}. Pass projectDir with the absolute path of the user's project root (the directory containing package.json). If the directory is a fresh or empty one, scaffold an app there first (e.g. \`npx create-next-app@latest .\`), then call init_boardui again.`
1109
1225
  );
1110
1226
  }
1227
+ return readProject(cwd);
1111
1228
  }
1112
1229
  function applyAgentRules(project, items) {
1113
1230
  const rules = items.find((item) => item.name === RULES_ITEM_NAME);
1114
1231
  const content = rules?.files[0]?.content;
1115
1232
  if (!content) return [];
1116
- const outcome = syncAgentsRules(project.cwd, content);
1233
+ const outcome = syncAgentsRules(project.cwd, mappedDocumentation(content, project.config));
1117
1234
  const verb = outcome === "created" ? "written to a new AGENTS.md" : outcome === "updated" ? "refreshed in AGENTS.md" : "appended to AGENTS.md";
1118
1235
  const lines = [
1119
1236
  `Always-on design rules ${verb} (tokens, type scale, conventions \u2014 loaded by agents every session, unlike on-demand MCP calls).`
1120
1237
  ];
1121
- const claudeMd = path7.join(project.cwd, "CLAUDE.md");
1238
+ const claudeMd = path9.join(project.cwd, "CLAUDE.md");
1122
1239
  try {
1123
- if (existsSync6(claudeMd) && !readFileSync6(claudeMd, "utf8").includes("AGENTS.md")) {
1240
+ if (existsSync6(claudeMd) && !readFileSync7(claudeMd, "utf8").includes("AGENTS.md")) {
1124
1241
  lines.push(
1125
1242
  'This project has a CLAUDE.md that does not reference AGENTS.md \u2014 add a "@AGENTS.md" line to it so Claude Code loads the BoardUI rules too.'
1126
1243
  );
@@ -1130,7 +1247,7 @@ function applyAgentRules(project, items) {
1130
1247
  return lines;
1131
1248
  }
1132
1249
  function aliasWarning(project) {
1133
- return project.hasAtAlias ? "" : `
1250
+ return project.hasAtAlias || !needsAtAlias(project.config) ? "" : `
1134
1251
 
1135
1252
  Warning: no "@/*" path alias found in tsconfig.json \u2014 BoardUI components import via "@/". Add to tsconfig.json: "compilerOptions": { "paths": { "@/*": ["./*"] } }`;
1136
1253
  }
@@ -1185,6 +1302,27 @@ function formatItemDetail(item, tier) {
1185
1302
  );
1186
1303
  return lines.join("\n");
1187
1304
  }
1305
+ function projectExample(code, project) {
1306
+ return project ? rewriteImports(code, "example.tsx", sourceRoot(project), project.cwd, project.config) : code;
1307
+ }
1308
+ function projectItem(item, project) {
1309
+ if (!project?.config) return item;
1310
+ const writes = collectWrites([item], sourceRoot(project), project.cwd, project.config);
1311
+ return {
1312
+ ...item,
1313
+ files: writes.map((write) => ({
1314
+ path: write.relPath,
1315
+ target: write.relPath,
1316
+ content: write.content,
1317
+ type: "registry:file"
1318
+ })),
1319
+ meta: item.meta && {
1320
+ ...item.meta,
1321
+ example: item.meta.example && projectExample(item.meta.example, project),
1322
+ snippets: item.meta.snippets?.map((snippet) => ({ ...snippet, code: projectExample(snippet.code, project) }))
1323
+ }
1324
+ };
1325
+ }
1188
1326
  async function mcp() {
1189
1327
  const server = new McpServer(
1190
1328
  { name: "boardui", version: CLI_VERSION },
@@ -1268,11 +1406,13 @@ ${templates.map((item) => `- ${item.name}: ${item.description}`).join("\n")}`
1268
1406
  title: "Get component source",
1269
1407
  description: "Full detail for one BoardUI item: description, docs URL, npm/BoardUI dependencies, usage example, and complete source files. For unlicensed pro items it returns the purchase/activation instructions instead of source.",
1270
1408
  inputSchema: {
1271
- name: z.string().describe('Exact item name from list_components, e.g. "button".')
1409
+ name: z.string().describe('Exact item name from list_components, e.g. "button".'),
1410
+ projectDir: z.string().optional().describe("Destination package root; pass to adapt source paths and examples using its boardui.json.")
1272
1411
  },
1273
1412
  annotations: { readOnlyHint: true }
1274
1413
  },
1275
- safe(async ({ name: rawName }) => {
1414
+ safe(async ({ name: rawName, projectDir }) => {
1415
+ const project = projectDir ? loadProject(projectDir) : void 0;
1276
1416
  const resolved = resolveName(rawName, await nameUniverse());
1277
1417
  if (resolved.error !== void 0) return errorText(resolved.error);
1278
1418
  const name = resolved.name;
@@ -1283,12 +1423,12 @@ ${templates.map((item) => `- ${item.name}: ${item.description}`).join("\n")}`
1283
1423
 
1284
1424
  Public usage example (source requires the license):
1285
1425
  \`\`\`tsx
1286
- ${proItem.example}
1426
+ ${projectExample(proItem.example, project)}
1287
1427
  \`\`\`` : "";
1288
1428
  return text(proPitch([proItem]) + example);
1289
1429
  }
1290
1430
  const item = await fetchRegistryItem(name);
1291
- return text(formatItemDetail(item, proItem ? "pro" : "free"));
1431
+ return text(formatItemDetail(projectItem(item, project), proItem ? "pro" : "free"));
1292
1432
  })
1293
1433
  );
1294
1434
  server.registerTool(
@@ -1297,11 +1437,13 @@ ${proItem.example}
1297
1437
  title: "Get usage examples",
1298
1438
  description: "Working usage snippets for a BoardUI item, straight from its docs page: the main example plus per-section snippets (variants, sizes, ...). Available for pro items too, without a license.",
1299
1439
  inputSchema: {
1300
- name: z.string().describe("Exact item name from list_components.")
1440
+ name: z.string().describe("Exact item name from list_components."),
1441
+ projectDir: z.string().optional().describe("Destination package root; pass to adapt examples using its boardui.json.")
1301
1442
  },
1302
1443
  annotations: { readOnlyHint: true }
1303
1444
  },
1304
- safe(async ({ name: rawName }) => {
1445
+ safe(async ({ name: rawName, projectDir }) => {
1446
+ const project = projectDir ? loadProject(projectDir) : void 0;
1305
1447
  const resolved = resolveName(rawName, await nameUniverse());
1306
1448
  if (resolved.error !== void 0) return errorText(resolved.error);
1307
1449
  const name = resolved.name;
@@ -1315,13 +1457,13 @@ ${proItem.example}
1315
1457
  ...proItem.docsUrl ? ["", `Docs: ${proItem.docsUrl}`] : []
1316
1458
  ];
1317
1459
  if (proItem.example) {
1318
- lines2.push("", "```tsx", proItem.example, "```");
1460
+ lines2.push("", "```tsx", projectExample(proItem.example, project), "```");
1319
1461
  } else {
1320
1462
  lines2.push("", "No public example \u2014 see the docs page for a live preview.");
1321
1463
  }
1322
1464
  return text(lines2.join("\n"));
1323
1465
  }
1324
- const item = await fetchRegistryItem(name);
1466
+ const item = projectItem(await fetchRegistryItem(name), project);
1325
1467
  const lines = [
1326
1468
  `# ${item.title} (${item.name})`,
1327
1469
  "",
@@ -1394,7 +1536,7 @@ ${proItem.example}
1394
1536
  items = await resolveItems(freeSubset);
1395
1537
  }
1396
1538
  const targetRoot = sourceRoot(project);
1397
- const report = writeFiles(collectWrites(items, targetRoot, project.cwd), overwrite);
1539
+ const report = writeFiles(collectWrites(items, targetRoot, project.cwd, project.config), overwrite);
1398
1540
  const assets = await downloadAssets(items, targetRoot, overwrite, project.cwd);
1399
1541
  const wanted = missingDependencies(items, project);
1400
1542
  const deps = installDependencies ? await installMissingDependencies(project, wanted) : null;
@@ -1425,7 +1567,7 @@ ${proItem.example}
1425
1567
  if (items.some((item) => item.name === "globals")) {
1426
1568
  lines.push(
1427
1569
  "",
1428
- 'The globals stylesheet was installed \u2014 make sure the root layout imports it: import "@/styles/globals.css"; (replaces the default create-next-app globals.css import).'
1570
+ `The globals stylesheet was installed \u2014 make sure the root layout imports it: import "${mappedImport("@/styles/globals.css", project.config)}"; (replaces the default create-next-app globals.css import).`
1429
1571
  );
1430
1572
  }
1431
1573
  let result = lines.join("\n") + aliasWarning(project);
@@ -1475,7 +1617,7 @@ NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proF
1475
1617
  const deps = await installMissingDependencies(project, missing);
1476
1618
  const items = await resolveItems(INIT_ITEMS);
1477
1619
  const targetRoot = sourceRoot(project);
1478
- const report = writeFiles(collectWrites(items, targetRoot, project.cwd), overwrite);
1620
+ const report = writeFiles(collectWrites(items, targetRoot, project.cwd, project.config), overwrite);
1479
1621
  const rulesLines = applyAgentRules(project, items);
1480
1622
  if (!deps.error) {
1481
1623
  await trackInitSuccess({
@@ -1485,7 +1627,7 @@ NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proF
1485
1627
  });
1486
1628
  }
1487
1629
  const staleStylesheet = ["app/globals.css", "src/app/globals.css"].find(
1488
- (rel) => existsSync6(path7.join(project.cwd, rel))
1630
+ (rel) => existsSync6(path9.join(project.cwd, rel))
1489
1631
  );
1490
1632
  const lines = [
1491
1633
  `BoardUI initialized in ${project.cwd}.`,
@@ -1502,7 +1644,7 @@ NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proF
1502
1644
  ...rulesLines.length ? ["", ...rulesLines] : [],
1503
1645
  "",
1504
1646
  "Finish the wiring:",
1505
- '1. Import the BoardUI stylesheet in the root layout (app/layout.tsx): import "@/styles/globals.css"; \u2014 replacing the default create-next-app "./globals.css" import.',
1647
+ `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.`,
1506
1648
  '2. Make sure PostCSS uses Tailwind v4 (postcss.config.mjs): export default { plugins: { "@tailwindcss/postcss": {} } };',
1507
1649
  '3. Install components with install_components, e.g. ["button", "select", "date-picker"].',
1508
1650
  ...staleStylesheet ? [
@@ -1530,7 +1672,7 @@ NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proF
1530
1672
  const project = loadProject(projectDir);
1531
1673
  const items = await resolveItems([RULES_ITEM_NAME]);
1532
1674
  const report = writeFiles(
1533
- collectWrites(items, sourceRoot(project), project.cwd),
1675
+ collectWrites(items, sourceRoot(project), project.cwd, project.config),
1534
1676
  overwrite
1535
1677
  );
1536
1678
  const lines = [
@@ -1589,7 +1731,7 @@ ${skillMd}`
1589
1731
  async ({ overwrite = false, projectDir }) => {
1590
1732
  const project = loadProject(projectDir);
1591
1733
  const items = await resolveItems([SKILL_ITEM_NAME]);
1592
- const targetDir = path7.join(project.cwd, ".claude", "skills", "boardui");
1734
+ const targetDir = path9.join(project.cwd, ".claude", "skills", "boardui");
1593
1735
  const report = writeFiles(collectWrites(items, targetDir), overwrite);
1594
1736
  const lines = [
1595
1737
  ...report.created.map((relPath) => ` created .claude/skills/boardui/${relPath}`),
@@ -1711,17 +1853,17 @@ ${skillMd}`
1711
1853
  }
1712
1854
 
1713
1855
  // src/commands/skill.ts
1714
- import { existsSync as existsSync7, readFileSync as readFileSync7 } from "fs";
1856
+ import { existsSync as existsSync7, readFileSync as readFileSync8 } from "fs";
1715
1857
  import { homedir as homedir3 } from "os";
1716
- import path8 from "path";
1858
+ import path10 from "path";
1717
1859
  import ora3 from "ora";
1718
1860
  import pc5 from "picocolors";
1719
1861
  var KNOWN_CLIENTS = ["codex", "gemini"];
1720
1862
  function installedVersion(targetDir) {
1721
1863
  try {
1722
- const skillPath = path8.join(targetDir, "SKILL.md");
1864
+ const skillPath = path10.join(targetDir, "SKILL.md");
1723
1865
  if (!existsSync7(skillPath)) return null;
1724
- const match = readFileSync7(skillPath, "utf8").match(/^\s*version:\s*(\S+)\s*$/m);
1866
+ const match = readFileSync8(skillPath, "utf8").match(/^\s*version:\s*(\S+)\s*$/m);
1725
1867
  return match?.[1] ?? null;
1726
1868
  } catch {
1727
1869
  return null;
@@ -1751,7 +1893,7 @@ async function skill(options) {
1751
1893
  before && fetched && before !== fetched ? `Skill fetched (installed ${before} -> ${fetched}).` : `Skill fetched${fetched ? ` (version ${fetched})` : ""}.`
1752
1894
  );
1753
1895
  const report = writeFiles(collectWrites(items, targetDir), Boolean(options.force));
1754
- const shortDir = targetDir.startsWith(homedir3()) ? `~${targetDir.slice(homedir3().length)}` : path8.relative(process.cwd(), targetDir) || ".";
1896
+ const shortDir = targetDir.startsWith(homedir3()) ? `~${targetDir.slice(homedir3().length)}` : path10.relative(process.cwd(), targetDir) || ".";
1755
1897
  for (const relPath of report.created) console.log(` ${pc5.green("created")} ${shortDir}/${relPath}`);
1756
1898
  for (const relPath of report.overwritten) console.log(` ${pc5.green("updated")} ${shortDir}/${relPath}`);
1757
1899
  for (const relPath of report.skipped) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "boardui",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "Add BoardUI components to your project.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -40,12 +40,12 @@
40
40
  "picocolors": "^1.1.1",
41
41
  "posthog-node": "^5.51.4",
42
42
  "prompts": "^2.4.2",
43
- "zod": "^4.5.1"
43
+ "zod": "^4.5.1",
44
+ "typescript": "^5"
44
45
  },
45
46
  "devDependencies": {
46
47
  "@types/node": "^20",
47
48
  "@types/prompts": "^2.4.9",
48
- "tsup": "^8.3.5",
49
- "typescript": "^5"
49
+ "tsup": "^8.3.5"
50
50
  }
51
51
  }