@nghitrum/dsforge 0.1.5-alpha.1 → 0.1.5-alpha.10

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.
@@ -0,0 +1,8 @@
1
+ import {
2
+ COMPONENT_JSON_DEFINITIONS,
3
+ COMPONENT_METADATA_DEFINITIONS
4
+ } from "./chunk-A7VW6SII.js";
5
+ export {
6
+ COMPONENT_JSON_DEFINITIONS,
7
+ COMPONENT_METADATA_DEFINITIONS
8
+ };
@@ -3,7 +3,7 @@ import {
3
3
  generatePackageJson,
4
4
  generateReadme,
5
5
  generateTsConfig
6
- } from "./chunk-RI3XDGKU.js";
6
+ } from "./chunk-ZZRPNO6Z.js";
7
7
  export {
8
8
  generateChangelog,
9
9
  generatePackageJson,
@@ -0,0 +1,70 @@
1
+ // src/adapters/react/generateAiFolder.ts
2
+ function generateSystemPrompt(systemName, tokens, componentNames) {
3
+ const tokenLines = Object.entries(tokens).map(([cssVar, values]) => `${cssVar.padEnd(35)} ${values.light} (dark: ${values.dark})`).join("\n");
4
+ const pkgName = systemName.toLowerCase().replace(/\s+/g, "-");
5
+ return `# ${systemName} \u2014 AI Context
6
+
7
+ You are helping a developer build UI using the ${systemName} design system, generated by dsforge.
8
+
9
+ ## Rules
10
+ - Never hardcode colours, spacing, or typography values
11
+ - Always use CSS custom properties from this design system
12
+ - Always import components from '${pkgName}'
13
+ - Never install or suggest third-party component libraries
14
+
15
+ ## Tokens
16
+ ${tokenLines}
17
+
18
+ ## Available Components
19
+ ${componentNames.join(", ")}
20
+
21
+ ## Usage
22
+ import { ${componentNames.slice(0, 3).join(", ")} } from '${pkgName}'
23
+ import '${pkgName}/tokens/base.css'
24
+ `;
25
+ }
26
+ function generateComponentsJson(systemName, components, metadatas) {
27
+ const metaMap = Object.fromEntries(metadatas.map((m) => [m.name, m]));
28
+ const pkgName = systemName.toLowerCase().replace(/\s+/g, "-");
29
+ const combined = components.map((c) => ({
30
+ name: c.name,
31
+ import: `import { ${c.name} } from '${pkgName}'`,
32
+ description: c.description,
33
+ props: c.props,
34
+ examples: c.examples.slice(0, 2),
35
+ tokens: Object.keys(c.cssVars.light),
36
+ aiGuidance: metaMap[c.name]?.aiGuidance ?? []
37
+ }));
38
+ return JSON.stringify({ system: systemName, components: combined }, null, 2);
39
+ }
40
+ function generateCursorContext(systemName) {
41
+ return `# Design System Context for Cursor
42
+
43
+ This project uses the ${systemName} design system. When generating any UI code:
44
+
45
+ 1. Import components from '${systemName.toLowerCase().replace(/\s+/g, "-")}'
46
+ 2. Use CSS variables from tokens/base.css for all visual values
47
+ 3. Refer to ai/components.json for the full component API and usage rules
48
+
49
+ @file ../ai/system-prompt.md
50
+ @file ../ai/components.json
51
+ `;
52
+ }
53
+ function generateCopilotInstructions(systemName) {
54
+ const pkgName = systemName.toLowerCase().replace(/\s+/g, "-");
55
+ return `# GitHub Copilot Instructions
56
+
57
+ This project uses the ${systemName} design system.
58
+
59
+ - Always import components from '${pkgName}'
60
+ - Never hardcode colour, spacing, or typography values \u2014 use CSS custom properties
61
+ - Refer to ai/components.json for component APIs, props, and usage guidance
62
+ - Refer to ai/system-prompt.md for design system rules
63
+ `;
64
+ }
65
+ export {
66
+ generateComponentsJson,
67
+ generateCopilotInstructions,
68
+ generateCursorContext,
69
+ generateSystemPrompt
70
+ };
@@ -0,0 +1,16 @@
1
+ import {
2
+ COMPONENT_JSON_DEFINITIONS
3
+ } from "./chunk-A7VW6SII.js";
4
+
5
+ // src/adapters/react/generateComponentJson.ts
6
+ function generateComponentJson(name, resolvedCssVars) {
7
+ const definition = COMPONENT_JSON_DEFINITIONS[name];
8
+ if (!definition) throw new Error(`No JSON definition found for component: ${name}`);
9
+ return {
10
+ ...definition,
11
+ cssVars: resolvedCssVars
12
+ };
13
+ }
14
+ export {
15
+ generateComponentJson
16
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ COMPONENT_METADATA_DEFINITIONS
3
+ } from "./chunk-A7VW6SII.js";
4
+
5
+ // src/adapters/react/generateComponentMetadata.ts
6
+ function generateComponentMetadata(name) {
7
+ const definition = COMPONENT_METADATA_DEFINITIONS[name];
8
+ if (!definition) throw new Error(`No metadata definition found for component: ${name}`);
9
+ return definition;
10
+ }
11
+ export {
12
+ generateComponentMetadata
13
+ };
@@ -0,0 +1,19 @@
1
+ // src/adapters/react/generateRegistry.ts
2
+ function generateRegistry(systemName, version, components) {
3
+ return {
4
+ $schema: "https://ui.shadcn.com/schema/registry.json",
5
+ name: systemName,
6
+ version,
7
+ description: `Design system generated by dsforge`,
8
+ items: components.map((c) => ({
9
+ name: c.name.toLowerCase(),
10
+ type: "registry:ui",
11
+ description: c.description,
12
+ files: [{ path: `components/${c.name}/${c.name}.tsx`, type: "registry:component" }],
13
+ cssVars: c.cssVars
14
+ }))
15
+ };
16
+ }
17
+ export {
18
+ generateRegistry
19
+ };