@foundrykit/cli 2.0.6 → 2.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foundrykit/cli",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",
@@ -25,7 +25,7 @@
25
25
  "glob": "^10.3.10",
26
26
  "inquirer": "^9.2.15",
27
27
  "node-fetch": "^3.3.0",
28
- "@foundrykit/types": "2.0.2"
28
+ "@foundrykit/types": "2.0.3"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^20.19.9",
@@ -17,7 +17,7 @@ import type {
17
17
  Config,
18
18
  } from '@foundrykit/types';
19
19
  import { getRegistry } from '../lib/registry.js';
20
- import { CLI_VERSION } from '../lib/constants.js';
20
+ import { CLI_VERSION, REGISTRY_CATEGORY_ORDER } from '../lib/constants.js';
21
21
 
22
22
  const execAsync = promisify(exec);
23
23
 
@@ -115,11 +115,14 @@ async function selectComponentsInteractively(): Promise<string[]> {
115
115
  * Create grouped choices for the interactive selector
116
116
  */
117
117
  function createGroupedChoices(components: ComponentMeta[]) {
118
+ const knownCategories = new Set<ComponentCategory>(
119
+ REGISTRY_CATEGORY_ORDER as readonly ComponentCategory[]
120
+ );
118
121
  const categories: ComponentCategory[] = [
119
- 'primitives',
120
- 'components',
121
- 'blocks',
122
- 'animations',
122
+ ...(REGISTRY_CATEGORY_ORDER as readonly ComponentCategory[]),
123
+ ...components
124
+ .map(component => component.category)
125
+ .filter(category => !knownCategories.has(category)),
123
126
  ];
124
127
 
125
128
  const choices: any[] = [];
@@ -319,6 +322,10 @@ export async function installComponentFiles(
319
322
  const config = await loadConfig();
320
323
  const basePath = options.path || process.cwd();
321
324
 
325
+ if (componentData.files.length === 0) {
326
+ return;
327
+ }
328
+
322
329
  console.log(chalk.blue('šŸ“ Installing component files...'));
323
330
 
324
331
  for (const file of componentData.files) {
@@ -482,6 +489,16 @@ export async function showUsageExample(
482
489
  const config = await loadConfig();
483
490
  console.log(chalk.cyan('\nšŸ’” Usage:'));
484
491
 
492
+ if (componentData.files.length === 0) {
493
+ const packageName = componentData.packageDependencies?.find(dep =>
494
+ dep.startsWith('@foundrykit/')
495
+ );
496
+ if (packageName) {
497
+ console.log(chalk.gray(`import { ... } from "${packageName}"`));
498
+ }
499
+ return;
500
+ }
501
+
485
502
  const componentName = componentData.name.replace(/\s+/g, '');
486
503
  const importPath = getImportPath(componentData, config);
487
504
 
@@ -549,6 +566,22 @@ export function transformImportsForConfig(
549
566
  'animations'
550
567
  );
551
568
 
569
+ transformed = transformRegistryBarrelImports(
570
+ transformed,
571
+ ['@foundrykit/maps', '@/components/maps'],
572
+ importPaths.maps,
573
+ config,
574
+ 'maps'
575
+ );
576
+
577
+ transformed = transformRegistryBarrelImports(
578
+ transformed,
579
+ ['@foundrykit/hooks', '@/hooks'],
580
+ importPaths.hooks,
581
+ config,
582
+ 'hooks'
583
+ );
584
+
552
585
  // Handle utils imports
553
586
  transformed = transformed
554
587
  .replace(/@foundrykit\/utils/g, importPaths.utils)
@@ -565,14 +598,37 @@ function getConfiguredImportPaths(
565
598
  components: 'components',
566
599
  blocks: 'components/blocks',
567
600
  animations: 'components/animations',
601
+ hooks: 'hooks',
602
+ maps: 'components/maps',
568
603
  utils: 'lib/utils',
569
604
  };
570
605
 
571
606
  return {
572
- primitives: resolveImportBasePath(paths.primitives, config),
573
- components: resolveImportBasePath(paths.components, config),
574
- blocks: resolveImportBasePath(paths.blocks, config),
575
- animations: resolveImportBasePath(paths.animations, config),
607
+ primitives: resolveImportBasePath(paths.primitives, config, {
608
+ preferRootAlias: true,
609
+ }),
610
+ components: resolveImportBasePath(paths.components, config, {
611
+ preferRootAlias: true,
612
+ }),
613
+ blocks: resolveImportBasePath(paths.blocks, config, {
614
+ preferRootAlias: true,
615
+ }),
616
+ animations: resolveImportBasePath(paths.animations, config, {
617
+ preferRootAlias: true,
618
+ }),
619
+ maps: resolveImportBasePath(
620
+ paths.maps ?? joinImportPath(paths.components, 'maps'),
621
+ config,
622
+ {
623
+ preferRootAlias: true,
624
+ }
625
+ ),
626
+ hooks: resolveImportBasePath(paths.hooks ?? 'hooks', config, {
627
+ preferRootAlias: true,
628
+ }),
629
+ packages: resolveImportBasePath(paths.components, config, {
630
+ preferRootAlias: true,
631
+ }),
576
632
  utils: resolveImportBasePath(paths.utils, config).replace(
577
633
  /\.(ts|js)x?$/,
578
634
  ''
@@ -580,13 +636,37 @@ function getConfiguredImportPaths(
580
636
  };
581
637
  }
582
638
 
583
- function resolveImportBasePath(filePath: string, config: Config): string {
639
+ function resolveImportBasePath(
640
+ filePath: string,
641
+ config: Config,
642
+ options: { preferRootAlias?: boolean } = {}
643
+ ): string {
644
+ if (isPackageImportSpecifier(filePath)) {
645
+ return filePath.replace(/\/$/, '');
646
+ }
647
+
584
648
  const normalizedPath = normalizeConfigPath(filePath).replace(
585
649
  /\.(ts|js)x?$/,
586
650
  ''
587
651
  );
588
652
  const aliases = config?.aliases ?? {};
589
653
 
654
+ if (options.preferRootAlias && aliases['@']) {
655
+ const rootTarget = normalizeConfigPath(aliases['@']);
656
+ const matchesRoot =
657
+ normalizedPath === rootTarget ||
658
+ (rootTarget !== '' && normalizedPath.startsWith(`${rootTarget}/`)) ||
659
+ rootTarget === '';
660
+
661
+ if (matchesRoot) {
662
+ const relativePath =
663
+ rootTarget === ''
664
+ ? normalizedPath
665
+ : normalizedPath.slice(rootTarget.length).replace(/^\//, '');
666
+ return joinImportPath('@', relativePath);
667
+ }
668
+ }
669
+
590
670
  const aliasMatches = Object.entries(aliases)
591
671
  .map(([alias, target]) => ({
592
672
  alias,
@@ -621,6 +701,10 @@ function normalizeConfigPath(filePath: string): string {
621
701
  .replace(/\/$/, '');
622
702
  }
623
703
 
704
+ function isPackageImportSpecifier(importPath: string): boolean {
705
+ return importPath.startsWith('@') && !importPath.startsWith('@/');
706
+ }
707
+
624
708
  function joinImportPath(basePath: string, childPath: string): string {
625
709
  const normalizedBase = basePath.replace(/\/$/, '');
626
710
  const normalizedChild = childPath.replace(/^\//, '').replace(/\/$/, '');
@@ -647,7 +731,11 @@ function transformRegistryBarrelImports(
647
731
  'g'
648
732
  );
649
733
 
650
- return content.replace(importPattern, (match, imports: string) => {
734
+ return content.replace(importPattern, (match, imports: string, source: string) => {
735
+ if (isPackageImportSpecifier(destinationBasePath)) {
736
+ return match.replace(source, destinationBasePath);
737
+ }
738
+
651
739
  const groupedImports = groupImportsByComponent(imports, config, category);
652
740
 
653
741
  return Array.from(groupedImports.entries())
@@ -728,7 +816,7 @@ function getInstalledComponentExportMap(
728
816
  category: ComponentCategory
729
817
  ): Map<string, string> {
730
818
  const exportMap = new Map<string, string>();
731
- const categoryPath = config.paths?.[category];
819
+ const categoryPath = getConfiguredCategoryPath(config, category);
732
820
  if (!categoryPath) {
733
821
  return exportMap;
734
822
  }
@@ -816,6 +904,8 @@ export function resolveComponentPath(
816
904
  components: 'components',
817
905
  blocks: 'components/blocks',
818
906
  animations: 'components/animations',
907
+ hooks: 'hooks',
908
+ maps: 'components/maps',
819
909
  utils: 'lib/utils',
820
910
  };
821
911
 
@@ -825,7 +915,8 @@ export function resolveComponentPath(
825
915
  }
826
916
 
827
917
  // Get the base path for the category from config
828
- const categoryPath = paths[category] || paths.components;
918
+ const categoryPath =
919
+ getConfiguredCategoryPath(config, category) || paths.components;
829
920
 
830
921
  // Extract just the filename from the original path
831
922
  const fileName = path.basename(originalPath);
@@ -848,12 +939,48 @@ export function resolveComponentPath(
848
939
  componentName,
849
940
  fileName
850
941
  );
942
+ } else if (category === 'maps') {
943
+ return path.join(
944
+ paths.maps || path.join(paths.components, 'maps'),
945
+ componentName,
946
+ fileName
947
+ );
948
+ } else if (category === 'hooks') {
949
+ return path.join(paths.hooks || 'hooks', componentName, fileName);
950
+ } else if (category === 'packages') {
951
+ return path.join(paths.components, componentName, fileName);
851
952
  }
852
953
 
853
954
  // Default to original path if category not recognized
854
955
  return originalPath;
855
956
  }
856
957
 
958
+ function getConfiguredCategoryPath(
959
+ config: Config,
960
+ category: ComponentCategory
961
+ ): string | undefined {
962
+ const paths = config.paths;
963
+
964
+ switch (category) {
965
+ case 'primitives':
966
+ return paths.primitives;
967
+ case 'components':
968
+ return paths.components;
969
+ case 'blocks':
970
+ return paths.blocks;
971
+ case 'animations':
972
+ return paths.animations;
973
+ case 'maps':
974
+ return paths.maps ?? path.join(paths.components, 'maps');
975
+ case 'hooks':
976
+ return paths.hooks ?? 'hooks';
977
+ case 'packages':
978
+ return paths.components;
979
+ default:
980
+ return undefined;
981
+ }
982
+ }
983
+
857
984
  /**
858
985
  * Get import path for a component
859
986
  */
@@ -867,6 +994,8 @@ export function getImportPath(
867
994
  components: 'components',
868
995
  blocks: 'components/blocks',
869
996
  animations: 'components/animations',
997
+ hooks: 'hooks',
998
+ maps: 'components/maps',
870
999
  utils: 'lib/utils',
871
1000
  };
872
1001
 
@@ -875,13 +1004,33 @@ export function getImportPath(
875
1004
  );
876
1005
 
877
1006
  if (componentData.category === 'primitives') {
878
- return `${resolveImportBasePath(paths.primitives, config)}/${componentName}`;
1007
+ return `${resolveImportBasePath(paths.primitives, config, {
1008
+ preferRootAlias: true,
1009
+ })}/${componentName}`;
879
1010
  } else if (componentData.category === 'components') {
880
- return `${resolveImportBasePath(paths.components, config)}/${componentName}`;
1011
+ return `${resolveImportBasePath(paths.components, config, {
1012
+ preferRootAlias: true,
1013
+ })}/${componentName}`;
881
1014
  } else if (componentData.category === 'blocks') {
882
- return `${resolveImportBasePath(paths.blocks, config)}/${componentName}`;
1015
+ return `${resolveImportBasePath(paths.blocks, config, {
1016
+ preferRootAlias: true,
1017
+ })}/${componentName}`;
883
1018
  } else if (componentData.category === 'animations') {
884
- return `${resolveImportBasePath(paths.animations, config)}/${componentName}`;
1019
+ return `${resolveImportBasePath(paths.animations, config, {
1020
+ preferRootAlias: true,
1021
+ })}/${componentName}`;
1022
+ } else if (componentData.category === 'maps') {
1023
+ return `${resolveImportBasePath(
1024
+ paths.maps || path.join(paths.components, 'maps'),
1025
+ config,
1026
+ {
1027
+ preferRootAlias: true,
1028
+ }
1029
+ )}/${componentName}`;
1030
+ } else if (componentData.category === 'hooks') {
1031
+ return `${resolveImportBasePath(paths.hooks || 'hooks', config, {
1032
+ preferRootAlias: true,
1033
+ })}/${componentName}`;
885
1034
  }
886
1035
 
887
1036
  return `@/components/${componentName}`;
@@ -37,6 +37,7 @@ interface PathConfig {
37
37
  components: string;
38
38
  blocks: string;
39
39
  hooks: string;
40
+ maps: string;
40
41
  animations: string;
41
42
  styles: string;
42
43
  lib: string;
@@ -285,6 +286,10 @@ async function getPathConfiguration(
285
286
  structure.componentsPath || path.join(structure.baseDir, 'components'),
286
287
  'blocks'
287
288
  ),
289
+ maps: path.join(
290
+ structure.componentsPath || path.join(structure.baseDir, 'components'),
291
+ 'maps'
292
+ ),
288
293
  animations: path.join(
289
294
  structure.componentsPath || path.join(structure.baseDir, 'components'),
290
295
  'animations'
@@ -358,6 +363,12 @@ async function getPathConfiguration(
358
363
  message: 'Hooks directory:',
359
364
  default: defaults.hooks,
360
365
  },
366
+ {
367
+ type: 'input',
368
+ name: 'maps',
369
+ message: 'Maps directory:',
370
+ default: defaults.maps,
371
+ },
361
372
  {
362
373
  type: 'input',
363
374
  name: 'animations',
@@ -748,6 +759,7 @@ async function createDirectories(pathConfig: PathConfig): Promise<void> {
748
759
  pathConfig.primitives,
749
760
  pathConfig.components,
750
761
  pathConfig.blocks,
762
+ pathConfig.maps,
751
763
  pathConfig.animations,
752
764
  pathConfig.hooks,
753
765
  pathConfig.lib,
@@ -875,6 +887,7 @@ async function createConfigFile(
875
887
  components: normalizePath(pathConfig.components),
876
888
  blocks: normalizePath(pathConfig.blocks),
877
889
  hooks: normalizePath(pathConfig.hooks),
890
+ maps: normalizePath(pathConfig.maps),
878
891
  animations: normalizePath(pathConfig.animations),
879
892
  },
880
893
  packageManager: structure.packageManager,
@@ -10,6 +10,7 @@ import fs from 'fs-extra';
10
10
  import path from 'path';
11
11
  import type { ComponentMeta, ComponentCategory } from '@foundrykit/types';
12
12
  import { getRegistry } from '../lib/registry.js';
13
+ import { REGISTRY_CATEGORY_ORDER } from '../lib/constants.js';
13
14
 
14
15
  interface ListOptions {
15
16
  category?: string;
@@ -32,15 +33,8 @@ export function listCommand() {
32
33
 
33
34
  // Validate category if provided
34
35
  if (options.category) {
35
- const validCategories: ComponentCategory[] = [
36
- 'primitives',
37
- 'components',
38
- 'blocks',
39
- 'animations',
40
- ];
41
- if (
42
- !validCategories.includes(options.category as ComponentCategory)
43
- ) {
36
+ const validCategories = REGISTRY_CATEGORY_ORDER as readonly string[];
37
+ if (!validCategories.includes(options.category)) {
44
38
  console.error(chalk.red(`Invalid category: ${options.category}`));
45
39
  console.log(
46
40
  chalk.gray(`Valid categories: ${validCategories.join(', ')}`)
@@ -108,11 +102,14 @@ function displayComponents(components: ComponentMeta[]): void {
108
102
  );
109
103
 
110
104
  // Display in category order
105
+ const knownCategories = new Set<ComponentCategory>(
106
+ REGISTRY_CATEGORY_ORDER as readonly ComponentCategory[]
107
+ );
111
108
  const categoryOrder: ComponentCategory[] = [
112
- 'primitives',
113
- 'components',
114
- 'blocks',
115
- 'animations',
109
+ ...(REGISTRY_CATEGORY_ORDER as readonly ComponentCategory[]),
110
+ ...(Object.keys(grouped).filter(
111
+ category => !knownCategories.has(category as ComponentCategory)
112
+ ) as ComponentCategory[]),
116
113
  ];
117
114
 
118
115
  for (const category of categoryOrder) {
@@ -13,3 +13,29 @@ export const DEFAULT_REGISTRY_URL = 'https://foundry.umiflow.com';
13
13
  export const CACHE_TTL = 24 * 60 * 60 * 1000; // 24 hours in milliseconds
14
14
  export const CACHE_DIR = '.foundrykit';
15
15
  export const CACHE_FILE = 'registry-cache.json';
16
+
17
+ export const REGISTRY_CATEGORY_ORDER = [
18
+ 'primitives',
19
+ 'components',
20
+ 'blocks',
21
+ 'animations',
22
+ 'maps',
23
+ 'hooks',
24
+ 'packages',
25
+ ] as const;
26
+
27
+ export const FOUNDRYKIT_PACKAGE_ALIASES = [
28
+ 'animation',
29
+ 'blocks',
30
+ 'cli',
31
+ 'components',
32
+ 'eslint-config',
33
+ 'hooks',
34
+ 'maps',
35
+ 'prettier-config',
36
+ 'primitives',
37
+ 'tailwind',
38
+ 'typescript-config',
39
+ 'types',
40
+ 'utils',
41
+ ] as const;
@@ -7,7 +7,12 @@ import fs from 'fs-extra';
7
7
  import path from 'path';
8
8
  import os from 'os';
9
9
  import chalk from 'chalk';
10
- import { DEFAULT_REGISTRY_URL, CACHE_DIR, CACHE_TTL } from './constants.js';
10
+ import {
11
+ DEFAULT_REGISTRY_URL,
12
+ CACHE_DIR,
13
+ CACHE_TTL,
14
+ FOUNDRYKIT_PACKAGE_ALIASES,
15
+ } from './constants.js';
11
16
  import type {
12
17
  ComponentMeta,
13
18
  ComponentData,
@@ -69,13 +74,21 @@ export class RegistryService {
69
74
  // Update cache
70
75
  await this.updateCache(components);
71
76
 
72
- return components;
77
+ return this.filterComponents(
78
+ this.withFoundryKitPackages(components),
79
+ category,
80
+ search
81
+ );
73
82
  } catch (error) {
74
83
  // Try to load from cache
75
84
  const cache = await this.loadCache();
76
85
  if (cache && this.isCacheValid(cache)) {
77
86
  console.log(chalk.yellow('Using cached registry data'));
78
- return this.filterComponents(cache.components, category, search);
87
+ return this.filterComponents(
88
+ this.withFoundryKitPackages(cache.components),
89
+ category,
90
+ search
91
+ );
79
92
  }
80
93
 
81
94
  // No valid cache, throw error
@@ -96,6 +109,14 @@ export class RegistryService {
96
109
  return this.createSpecialDependency(id);
97
110
  }
98
111
 
112
+ const foundryKitPackage = this.resolveFoundryKitPackageName(id);
113
+ const isExplicitFoundryKitPackage =
114
+ id.startsWith('@foundrykit/') ||
115
+ id.endsWith('-plugin') ||
116
+ FOUNDRYKIT_PACKAGE_ALIASES.includes(
117
+ id as (typeof FOUNDRYKIT_PACKAGE_ALIASES)[number]
118
+ );
119
+
99
120
  const cache = await this.loadCache();
100
121
  const cachedComponent = cache?.componentData?.[id];
101
122
  const hasValidCache = cache ? this.isCacheValid(cache) : false;
@@ -113,6 +134,9 @@ export class RegistryService {
113
134
 
114
135
  if (!response.ok) {
115
136
  if (response.status === 404) {
137
+ if (foundryKitPackage && isExplicitFoundryKitPackage) {
138
+ return this.createFoundryKitPackageDependency(foundryKitPackage);
139
+ }
116
140
  throw new Error(`Component "${id}" not found in registry`);
117
141
  }
118
142
  throw new Error(
@@ -127,6 +151,10 @@ export class RegistryService {
127
151
 
128
152
  return component;
129
153
  } catch (error) {
154
+ if (foundryKitPackage && isExplicitFoundryKitPackage) {
155
+ return this.createFoundryKitPackageDependency(foundryKitPackage);
156
+ }
157
+
130
158
  // Fall back to any cached component data, even if stale
131
159
  if (cachedComponent) {
132
160
  console.log(chalk.yellow(`Using cached data for component: ${id}`));
@@ -153,6 +181,7 @@ export class RegistryService {
153
181
  'cn', // Utils aliases
154
182
  'hooks',
155
183
  'types', // Package dependencies
184
+ 'maps',
156
185
  ];
157
186
  return specialDependencies.includes(id);
158
187
  }
@@ -185,46 +214,16 @@ export function cn(...inputs: ClassValue[]) {
185
214
  };
186
215
  }
187
216
 
188
- // Handle hooks package dependency
189
217
  if (id === 'hooks') {
190
- // Check if @foundrykit/hooks is already installed
191
- const isInstalled = await this.isPackageInstalled('@foundrykit/hooks');
192
- if (isInstalled) {
193
- return {
194
- id: 'hooks',
195
- name: 'Hooks',
196
- description: 'Custom React hooks package',
197
- category: 'primitives',
198
- files: [], // No files to install, it's a package
199
- registryDependencies: [],
200
- packageDependencies: ['@foundrykit/hooks'],
201
- };
202
- } else {
203
- throw new Error(
204
- 'Package "@foundrykit/hooks" is not installed. Please install it first: pnpm add @foundrykit/hooks'
205
- );
206
- }
218
+ return this.createFoundryKitPackageDependency('@foundrykit/hooks');
207
219
  }
208
220
 
209
- // Handle types package dependency
210
221
  if (id === 'types') {
211
- // Check if @foundrykit/types is already installed
212
- const isInstalled = await this.isPackageInstalled('@foundrykit/types');
213
- if (isInstalled) {
214
- return {
215
- id: 'types',
216
- name: 'Types',
217
- description: 'TypeScript type definitions',
218
- category: 'primitives',
219
- files: [], // No files to install, it's a package
220
- registryDependencies: [],
221
- packageDependencies: ['@foundrykit/types'],
222
- };
223
- } else {
224
- throw new Error(
225
- 'Package "@foundrykit/types" is not installed. Please install it first: pnpm add @foundrykit/types'
226
- );
227
- }
222
+ return this.createFoundryKitPackageDependency('@foundrykit/types');
223
+ }
224
+
225
+ if (id === 'maps') {
226
+ return this.createFoundryKitPackageDependency('@foundrykit/maps');
228
227
  }
229
228
 
230
229
  throw new Error(`Unknown special dependency: ${id}`);
@@ -253,6 +252,67 @@ export function cn(...inputs: ClassValue[]) {
253
252
  }
254
253
  }
255
254
 
255
+ private resolveFoundryKitPackageName(id: string): string | null {
256
+ if (/^@foundrykit\/[a-z0-9][a-z0-9-]*$/i.test(id)) {
257
+ return id;
258
+ }
259
+
260
+ if (
261
+ FOUNDRYKIT_PACKAGE_ALIASES.includes(
262
+ id as (typeof FOUNDRYKIT_PACKAGE_ALIASES)[number]
263
+ ) ||
264
+ /^[a-z0-9][a-z0-9-]*-plugin$/i.test(id)
265
+ ) {
266
+ return `@foundrykit/${id}`;
267
+ }
268
+
269
+ return null;
270
+ }
271
+
272
+ private createFoundryKitPackageDependency(packageName: string): ComponentData {
273
+ const id = packageName.replace('@foundrykit/', '');
274
+ const category =
275
+ id === 'maps' ? 'maps' : id === 'hooks' ? 'hooks' : 'packages';
276
+
277
+ return {
278
+ id,
279
+ name: this.toDisplayName(id),
280
+ description: `${packageName} npm package`,
281
+ category,
282
+ files: [],
283
+ registryDependencies: [],
284
+ packageDependencies: [packageName],
285
+ };
286
+ }
287
+
288
+ private withFoundryKitPackages(components: ComponentMeta[]): ComponentMeta[] {
289
+ const packageEntries = FOUNDRYKIT_PACKAGE_ALIASES.map(packageId => ({
290
+ id: packageId,
291
+ name: this.toDisplayName(packageId),
292
+ category:
293
+ packageId === 'maps'
294
+ ? ('maps' as const)
295
+ : packageId === 'hooks'
296
+ ? ('hooks' as const)
297
+ : ('packages' as const),
298
+ description: `@foundrykit/${packageId} npm package`,
299
+ packageDependencies: [`@foundrykit/${packageId}`],
300
+ }));
301
+
302
+ const seenIds = new Set(components.map(component => component.id));
303
+ return [
304
+ ...components,
305
+ ...packageEntries.filter(component => !seenIds.has(component.id)),
306
+ ];
307
+ }
308
+
309
+ private toDisplayName(id: string): string {
310
+ return id
311
+ .split('-')
312
+ .map(part => part.charAt(0).toUpperCase() + part.slice(1))
313
+ .join(' ');
314
+ }
315
+
256
316
  /**
257
317
  * Update the local cache with new component list
258
318
  */