@getcoherent/core 0.6.12 → 0.6.14

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sergei Kovtun
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -2733,8 +2733,8 @@ interface ComponentProvider {
2733
2733
  * See docs/epic-2-shared-components.md.
2734
2734
  */
2735
2735
 
2736
- /** Shared component type: layout (layout.tsx), section (reusable block), widget (small element) */
2737
- declare const SharedComponentTypeSchema: z.ZodEnum<["layout", "section", "widget"]>;
2736
+ /** Shared component type classification */
2737
+ declare const SharedComponentTypeSchema: z.ZodEnum<["layout", "navigation", "data-display", "form", "feedback", "section", "widget"]>;
2738
2738
  type SharedComponentType = z.infer<typeof SharedComponentTypeSchema>;
2739
2739
  /** Single entry in the shared components registry */
2740
2740
  declare const SharedComponentEntrySchema: z.ZodObject<{
@@ -2743,7 +2743,7 @@ declare const SharedComponentEntrySchema: z.ZodObject<{
2743
2743
  /** Display name (e.g. "Header", "PricingCard") */
2744
2744
  name: z.ZodString;
2745
2745
  /** layout | section | widget */
2746
- type: z.ZodEnum<["layout", "section", "widget"]>;
2746
+ type: z.ZodEnum<["layout", "navigation", "data-display", "form", "feedback", "section", "widget"]>;
2747
2747
  /** Path to component file relative to project root */
2748
2748
  file: z.ZodString;
2749
2749
  /** List of file paths that import this component (e.g. ["app/layout.tsx", "app/dashboard/page.tsx"]) */
@@ -2753,24 +2753,36 @@ declare const SharedComponentEntrySchema: z.ZodObject<{
2753
2753
  description: z.ZodOptional<z.ZodString>;
2754
2754
  /** TypeScript props interface body, e.g. "{ icon: React.ReactNode; title: string }" */
2755
2755
  propsInterface: z.ZodOptional<z.ZodString>;
2756
+ /** Example JSX usage, e.g. '<StatsCard icon={Users} value="1,234" />' */
2757
+ usageExample: z.ZodOptional<z.ZodString>;
2758
+ /** Package and component dependencies, e.g. ['lucide-react', 'components/ui/card'] */
2759
+ dependencies: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
2760
+ /** How this component was created */
2761
+ source: z.ZodOptional<z.ZodEnum<["extracted", "generated", "manual"]>>;
2756
2762
  }, "strip", z.ZodTypeAny, {
2757
- type: "layout" | "section" | "widget";
2763
+ type: "form" | "layout" | "navigation" | "feedback" | "data-display" | "section" | "widget";
2758
2764
  name: string;
2759
2765
  id: string;
2760
2766
  file: string;
2761
2767
  usedIn: string[];
2768
+ dependencies: string[];
2762
2769
  description?: string | undefined;
2770
+ source?: "extracted" | "generated" | "manual" | undefined;
2763
2771
  createdAt?: string | undefined;
2764
2772
  propsInterface?: string | undefined;
2773
+ usageExample?: string | undefined;
2765
2774
  }, {
2766
- type: "layout" | "section" | "widget";
2775
+ type: "form" | "layout" | "navigation" | "feedback" | "data-display" | "section" | "widget";
2767
2776
  name: string;
2768
2777
  id: string;
2769
2778
  file: string;
2770
2779
  description?: string | undefined;
2780
+ source?: "extracted" | "generated" | "manual" | undefined;
2771
2781
  createdAt?: string | undefined;
2772
2782
  usedIn?: string[] | undefined;
2773
2783
  propsInterface?: string | undefined;
2784
+ usageExample?: string | undefined;
2785
+ dependencies?: string[] | undefined;
2774
2786
  }>;
2775
2787
  type SharedComponentEntry = z.infer<typeof SharedComponentEntrySchema>;
2776
2788
  /** Root schema for coherent.components.json */
@@ -2781,7 +2793,7 @@ declare const SharedComponentsManifestSchema: z.ZodObject<{
2781
2793
  /** Display name (e.g. "Header", "PricingCard") */
2782
2794
  name: z.ZodString;
2783
2795
  /** layout | section | widget */
2784
- type: z.ZodEnum<["layout", "section", "widget"]>;
2796
+ type: z.ZodEnum<["layout", "navigation", "data-display", "form", "feedback", "section", "widget"]>;
2785
2797
  /** Path to component file relative to project root */
2786
2798
  file: z.ZodString;
2787
2799
  /** List of file paths that import this component (e.g. ["app/layout.tsx", "app/dashboard/page.tsx"]) */
@@ -2791,49 +2803,67 @@ declare const SharedComponentsManifestSchema: z.ZodObject<{
2791
2803
  description: z.ZodOptional<z.ZodString>;
2792
2804
  /** TypeScript props interface body, e.g. "{ icon: React.ReactNode; title: string }" */
2793
2805
  propsInterface: z.ZodOptional<z.ZodString>;
2806
+ /** Example JSX usage, e.g. '<StatsCard icon={Users} value="1,234" />' */
2807
+ usageExample: z.ZodOptional<z.ZodString>;
2808
+ /** Package and component dependencies, e.g. ['lucide-react', 'components/ui/card'] */
2809
+ dependencies: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
2810
+ /** How this component was created */
2811
+ source: z.ZodOptional<z.ZodEnum<["extracted", "generated", "manual"]>>;
2794
2812
  }, "strip", z.ZodTypeAny, {
2795
- type: "layout" | "section" | "widget";
2813
+ type: "form" | "layout" | "navigation" | "feedback" | "data-display" | "section" | "widget";
2796
2814
  name: string;
2797
2815
  id: string;
2798
2816
  file: string;
2799
2817
  usedIn: string[];
2818
+ dependencies: string[];
2800
2819
  description?: string | undefined;
2820
+ source?: "extracted" | "generated" | "manual" | undefined;
2801
2821
  createdAt?: string | undefined;
2802
2822
  propsInterface?: string | undefined;
2823
+ usageExample?: string | undefined;
2803
2824
  }, {
2804
- type: "layout" | "section" | "widget";
2825
+ type: "form" | "layout" | "navigation" | "feedback" | "data-display" | "section" | "widget";
2805
2826
  name: string;
2806
2827
  id: string;
2807
2828
  file: string;
2808
2829
  description?: string | undefined;
2830
+ source?: "extracted" | "generated" | "manual" | undefined;
2809
2831
  createdAt?: string | undefined;
2810
2832
  usedIn?: string[] | undefined;
2811
2833
  propsInterface?: string | undefined;
2834
+ usageExample?: string | undefined;
2835
+ dependencies?: string[] | undefined;
2812
2836
  }>, "many">>;
2813
2837
  /** Next numeric id for new entries (CID-XXX → nextId = 4 for CID-004) */
2814
2838
  nextId: z.ZodDefault<z.ZodNumber>;
2815
2839
  }, "strip", z.ZodTypeAny, {
2816
2840
  shared: {
2817
- type: "layout" | "section" | "widget";
2841
+ type: "form" | "layout" | "navigation" | "feedback" | "data-display" | "section" | "widget";
2818
2842
  name: string;
2819
2843
  id: string;
2820
2844
  file: string;
2821
2845
  usedIn: string[];
2846
+ dependencies: string[];
2822
2847
  description?: string | undefined;
2848
+ source?: "extracted" | "generated" | "manual" | undefined;
2823
2849
  createdAt?: string | undefined;
2824
2850
  propsInterface?: string | undefined;
2851
+ usageExample?: string | undefined;
2825
2852
  }[];
2826
2853
  nextId: number;
2827
2854
  }, {
2828
2855
  shared?: {
2829
- type: "layout" | "section" | "widget";
2856
+ type: "form" | "layout" | "navigation" | "feedback" | "data-display" | "section" | "widget";
2830
2857
  name: string;
2831
2858
  id: string;
2832
2859
  file: string;
2833
2860
  description?: string | undefined;
2861
+ source?: "extracted" | "generated" | "manual" | undefined;
2834
2862
  createdAt?: string | undefined;
2835
2863
  usedIn?: string[] | undefined;
2836
2864
  propsInterface?: string | undefined;
2865
+ usageExample?: string | undefined;
2866
+ dependencies?: string[] | undefined;
2837
2867
  }[] | undefined;
2838
2868
  nextId?: number | undefined;
2839
2869
  }>;
@@ -3146,6 +3176,9 @@ interface CreateSharedComponentInput {
3146
3176
  usedIn?: string[];
3147
3177
  description?: string;
3148
3178
  propsInterface?: string;
3179
+ usageExample?: string;
3180
+ dependencies?: string[];
3181
+ source?: 'extracted' | 'generated' | 'manual';
3149
3182
  }
3150
3183
  /**
3151
3184
  * Add a new shared component: allocate CID, set createdAt, append to shared, increment nextId.
@@ -3557,6 +3590,9 @@ interface GenerateSharedComponentInput {
3557
3590
  overwrite?: boolean;
3558
3591
  /** TypeScript props interface body, e.g. "{ title: string; icon: React.ReactNode }". */
3559
3592
  propsInterface?: string;
3593
+ usageExample?: string;
3594
+ dependencies?: string[];
3595
+ source?: 'extracted' | 'generated' | 'manual';
3560
3596
  }
3561
3597
  interface GenerateSharedComponentResult {
3562
3598
  id: string;
package/dist/index.js CHANGED
@@ -454,7 +454,15 @@ var EXAMPLE_SPA_CONFIG = {
454
454
 
455
455
  // src/types/shared-components-manifest.ts
456
456
  import { z as z2 } from "zod";
457
- var SharedComponentTypeSchema = z2.enum(["layout", "section", "widget"]);
457
+ var SharedComponentTypeSchema = z2.enum([
458
+ "layout",
459
+ "navigation",
460
+ "data-display",
461
+ "form",
462
+ "feedback",
463
+ "section",
464
+ "widget"
465
+ ]);
458
466
  var SharedComponentEntrySchema = z2.object({
459
467
  /** Unique ID: CID-001, CID-002, ... */
460
468
  id: z2.string().regex(/^CID-\d{3,}$/, "Must be CID-XXX with zero-padded number"),
@@ -470,7 +478,13 @@ var SharedComponentEntrySchema = z2.object({
470
478
  /** Human-readable description */
471
479
  description: z2.string().optional(),
472
480
  /** TypeScript props interface body, e.g. "{ icon: React.ReactNode; title: string }" */
473
- propsInterface: z2.string().optional()
481
+ propsInterface: z2.string().optional(),
482
+ /** Example JSX usage, e.g. '<StatsCard icon={Users} value="1,234" />' */
483
+ usageExample: z2.string().optional(),
484
+ /** Package and component dependencies, e.g. ['lucide-react', 'components/ui/card'] */
485
+ dependencies: z2.array(z2.string()).default([]),
486
+ /** How this component was created */
487
+ source: z2.enum(["extracted", "generated", "manual"]).optional()
474
488
  });
475
489
  var SharedComponentsManifestSchema = z2.object({
476
490
  shared: z2.array(SharedComponentEntrySchema).default([]),
@@ -1977,6 +1991,9 @@ function createEntry(manifest, input) {
1977
1991
  usedIn: input.usedIn ?? [],
1978
1992
  description: input.description,
1979
1993
  propsInterface: input.propsInterface,
1994
+ usageExample: input.usageExample,
1995
+ dependencies: input.dependencies ?? [],
1996
+ source: input.source,
1980
1997
  createdAt: now
1981
1998
  };
1982
1999
  const nextManifest = {
@@ -6826,7 +6843,10 @@ async function generateSharedComponent(projectRoot, input) {
6826
6843
  file: filePath,
6827
6844
  usedIn: input.usedIn ?? [],
6828
6845
  description: input.description,
6829
- propsInterface: input.propsInterface
6846
+ propsInterface: input.propsInterface,
6847
+ usageExample: input.usageExample,
6848
+ dependencies: input.dependencies,
6849
+ source: input.source
6830
6850
  });
6831
6851
  await saveManifest(projectRoot, nextManifest);
6832
6852
  return { id: entry.id, name: entry.name, file: entry.file };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.6.12",
6
+ "version": "0.6.14",
7
7
  "description": "Core design system engine for Coherent",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",
@@ -32,12 +32,6 @@
32
32
  ],
33
33
  "author": "Coherent Design Method",
34
34
  "license": "MIT",
35
- "scripts": {
36
- "dev": "tsup --watch",
37
- "build": "tsup",
38
- "typecheck": "tsc --noEmit",
39
- "test": "vitest"
40
- },
41
35
  "dependencies": {
42
36
  "handlebars": "^4.7.8",
43
37
  "zod": "^3.22.4"
@@ -47,5 +41,11 @@
47
41
  "tsup": "^8.0.1",
48
42
  "typescript": "^5.3.3",
49
43
  "vitest": "^1.2.1"
44
+ },
45
+ "scripts": {
46
+ "dev": "tsup --watch",
47
+ "build": "tsup",
48
+ "typecheck": "tsc --noEmit",
49
+ "test": "vitest"
50
50
  }
51
- }
51
+ }