@matchkit.io/cli 0.1.4 → 0.1.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.
@@ -23,10 +23,25 @@ function buildImportMap(fullSkillDir) {
23
23
  // Skip non-component entries (layouts, patterns)
24
24
  if (comp.type === "registry:layout" || comp.type === "registry:pattern")
25
25
  continue;
26
- const file = comp.file.replace(/\.tsx$/, "");
26
+ // Strip directory prefix from file path (e.g. "components/button.tsx" "button")
27
+ const basename = comp.file.replace(/^(components|lib)\//, "").replace(/\.tsx?$/, "");
27
28
  const exports = Array.isArray(comp.exportName) ? comp.exportName : [comp.exportName];
28
29
  const importStr = `{ ${exports.join(", ")} }`;
29
- lines.push(`| ${comp.name} | \`import ${importStr} from "@/components/ui/${file}"\` |`);
30
+ // Use the registry category to determine the correct import prefix:
31
+ // lib → @/lib/{name} (utils.ts)
32
+ // layout → @/components/layout/{name} (sidebar-nav, top-bar, page-header)
33
+ // ui/chart/other → @/components/ui/{name} (everything else)
34
+ let importPath;
35
+ if (comp.category === "lib") {
36
+ importPath = `@/lib/${basename}`;
37
+ }
38
+ else if (comp.category === "layout") {
39
+ importPath = `@/components/layout/${basename}`;
40
+ }
41
+ else {
42
+ importPath = `@/components/ui/${basename}`;
43
+ }
44
+ lines.push(`| ${comp.name} | \`import ${importStr} from "${importPath}"\` |`);
30
45
  }
31
46
  if (lines.length === 0)
32
47
  return "";
@@ -62,6 +77,9 @@ A full design system is installed at \`${skillDir}/\`. You MUST use it for ALL U
62
77
  export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); }
63
78
  \`\`\`
64
79
  5. **Copy component files** from \`${skillDir}/components/\` to \`src/components/ui/\` as needed
80
+ 6. **Copy layout files** from \`${skillDir}/layouts/\` to \`src/components/layout/\` as needed (sidebar-nav, top-bar, page-header)
81
+ 7. **Read \`${skillDir}/layouts/app-shell.tsx\`** — reference implementation showing how to compose the app shell
82
+ 8. **Read the .tsx source** of any component before using it — the file contains the exact props interface
65
83
 
66
84
  ### Rules — follow these at ALL times:
67
85
 
@@ -70,8 +88,10 @@ A full design system is installed at \`${skillDir}/\`. You MUST use it for ALL U
70
88
  - **NEVER** hardcode hex colors, pixel spacing, or font sizes — use CSS variables from \`globals.css\`
71
89
  - **NEVER** improvise a component if one already exists in the registry
72
90
  - **NEVER** modify files inside \`${skillDir}/\` — it is the upstream source of truth
73
- - **ALWAYS** use \`@/components/ui/{name}\` import paths for design system components
91
+ - **ALWAYS** use \`@/components/ui/{name}\` import paths for UI components
92
+ - **ALWAYS** use \`@/components/layout/{name}\` import paths for layout components (sidebar-nav, top-bar, page-header)
74
93
  - **ALWAYS** use \`@/lib/utils\` for the \`cn()\` helper
94
+ - **ALWAYS** read the component .tsx source to see its props interface before using it — do NOT guess props
75
95
 
76
96
  ### Available resources in \`${skillDir}/\`:
77
97
 
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from "commander";
3
+ import { readFileSync } from "node:fs";
4
+ import { fileURLToPath } from "node:url";
5
+ import { dirname, join } from "node:path";
3
6
  import { initCommand } from "./commands/init.js";
4
7
  import { addCommand } from "./commands/add.js";
5
8
  import { listCommand } from "./commands/list.js";
@@ -7,11 +10,13 @@ import { diffCommand } from "./commands/diff.js";
7
10
  import { loginCommand } from "./commands/login.js";
8
11
  import { pullCommand } from "./commands/pull.js";
9
12
  import { statusCommand } from "./commands/status.js";
13
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
+ const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
10
15
  const program = new Command();
11
16
  program
12
17
  .name("matchkit")
13
18
  .description("MatchKit — style-agnostic design system CLI")
14
- .version("0.1.4");
19
+ .version(pkg.version);
15
20
  program
16
21
  .command("init")
17
22
  .description("Initialize a MatchKit design system in your project")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matchkit.io/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "CLI for MatchKit design system skills. Init projects, add components, manage your design system.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",