intent-core 0.1.0

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 (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/dist/compiler/index.d.ts +53 -0
  4. package/dist/compiler/index.d.ts.map +1 -0
  5. package/dist/compiler/index.js +147 -0
  6. package/dist/compiler/index.js.map +1 -0
  7. package/dist/compiler/parser.d.ts +25 -0
  8. package/dist/compiler/parser.d.ts.map +1 -0
  9. package/dist/compiler/parser.js +198 -0
  10. package/dist/compiler/parser.js.map +1 -0
  11. package/dist/generator/ai-manifest.d.ts +14 -0
  12. package/dist/generator/ai-manifest.d.ts.map +1 -0
  13. package/dist/generator/ai-manifest.js +276 -0
  14. package/dist/generator/ai-manifest.js.map +1 -0
  15. package/dist/generator/css.d.ts +16 -0
  16. package/dist/generator/css.d.ts.map +1 -0
  17. package/dist/generator/css.js +230 -0
  18. package/dist/generator/css.js.map +1 -0
  19. package/dist/generator/types.d.ts +11 -0
  20. package/dist/generator/types.d.ts.map +1 -0
  21. package/dist/generator/types.js +229 -0
  22. package/dist/generator/types.js.map +1 -0
  23. package/dist/index.d.ts +47 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +51 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/schema/define.d.ts +60 -0
  28. package/dist/schema/define.d.ts.map +1 -0
  29. package/dist/schema/define.js +167 -0
  30. package/dist/schema/define.js.map +1 -0
  31. package/dist/types/index.d.ts +156 -0
  32. package/dist/types/index.d.ts.map +1 -0
  33. package/dist/types/index.js +5 -0
  34. package/dist/types/index.js.map +1 -0
  35. package/dist/validator/constraints.d.ts +16 -0
  36. package/dist/validator/constraints.d.ts.map +1 -0
  37. package/dist/validator/constraints.js +168 -0
  38. package/dist/validator/constraints.js.map +1 -0
  39. package/dist/validator/index.d.ts +22 -0
  40. package/dist/validator/index.d.ts.map +1 -0
  41. package/dist/validator/index.js +321 -0
  42. package/dist/validator/index.js.map +1 -0
  43. package/package.json +61 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Intent Framework Contributors
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/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # intent-core
2
+
3
+ Core schema definition, compiler, and validator for the [Intent](https://github.com/mixedmetals/intent-framework) styling framework.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install intent-core
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { defineSystem, defineComponent, prop, when } from 'intent-core';
15
+
16
+ const system = defineSystem({
17
+ name: 'MySystem',
18
+ tokens: { color: { primary: '#6366F1' } },
19
+ components: {
20
+ Button: defineComponent({
21
+ name: 'Button',
22
+ properties: {
23
+ importance: prop.enum(['primary', 'secondary'], { required: true }),
24
+ },
25
+ constraints: [],
26
+ mappings: {
27
+ 'importance=primary': { background: 'primary' },
28
+ },
29
+ }),
30
+ },
31
+ });
32
+ ```
33
+
34
+ See the main repo for full documentation.
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Intent Compiler
3
+ *
4
+ * Main compilation orchestrator that transforms design system schemas
5
+ * into production-ready CSS and TypeScript definitions.
6
+ */
7
+ import type { DesignSystemConfig, ComponentCompilation, AIManifest } from '../types/index.js';
8
+ import { type BatchUsage } from '../validator/index.js';
9
+ export interface CompilerOptions {
10
+ /** Output minified CSS */
11
+ minify?: boolean;
12
+ /** Generate source maps */
13
+ sourceMap?: boolean;
14
+ /** CSS variable prefix */
15
+ cssPrefix?: string;
16
+ /** Generate dark mode variables */
17
+ darkMode?: boolean;
18
+ /** Dark mode tokens */
19
+ darkTokens?: Partial<DesignSystemConfig['tokens']>;
20
+ /** Strict validation (fail on warnings) */
21
+ strict?: boolean;
22
+ /** Output directory for compiled files */
23
+ outDir?: string;
24
+ }
25
+ export interface CompileResult {
26
+ success: boolean;
27
+ css: string;
28
+ types: string;
29
+ runtime: string;
30
+ manifest: AIManifest;
31
+ errors: string[];
32
+ warnings: string[];
33
+ }
34
+ export declare function compile(config: DesignSystemConfig, options?: CompilerOptions): Promise<CompileResult>;
35
+ export interface WatchOptions extends CompilerOptions {
36
+ onChange?: (result: CompileResult) => void;
37
+ onError?: (error: Error) => void;
38
+ }
39
+ export declare function watch(configPath: string, options?: WatchOptions): {
40
+ stop: () => void;
41
+ };
42
+ export declare function compileComponent(config: DesignSystemConfig, componentName: string, options?: CompilerOptions): Promise<ComponentCompilation | null>;
43
+ export interface ValidationWithUsageResult {
44
+ valid: boolean;
45
+ schemaValid: boolean;
46
+ usageValid: boolean;
47
+ errors: string[];
48
+ warnings: string[];
49
+ }
50
+ export declare function validateWithUsage(config: DesignSystemConfig, usages: BatchUsage[], options?: CompilerOptions): ValidationWithUsageResult;
51
+ export { generateAIManifest, generateAIPrompt, } from '../generator/ai-manifest.js';
52
+ export type { PromptContext } from '../generator/ai-manifest.js';
53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K,IAAI,CAAC;CAClC;AAED,wBAAgB,KAAK,CACnB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,YAAiB,GACzB;IAAE,IAAI,EAAE,MAAM,IAAI,CAAA;CAAE,CAMtB;AAMD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,kBAAkB,EAC1B,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CA8BtC;AAMD,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,GAAE,eAAoB,GAC5B,yBAAyB,CAmC3B;AAMD,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Intent Compiler
3
+ *
4
+ * Main compilation orchestrator that transforms design system schemas
5
+ * into production-ready CSS and TypeScript definitions.
6
+ */
7
+ import { validateSchema, validateAllUsages } from '../validator/index.js';
8
+ import { compileSystem } from '../generator/css.js';
9
+ import { generateSystemTypes, generateRuntimeTypes } from '../generator/types.js';
10
+ import { generateAIManifest } from '../generator/ai-manifest.js';
11
+ // ============================================================================
12
+ // Main Compiler
13
+ // ============================================================================
14
+ export async function compile(config, options = {}) {
15
+ const errors = [];
16
+ const warnings = [];
17
+ // Step 1: Validate schema
18
+ const schemaValidation = validateSchema(config);
19
+ for (const issue of schemaValidation.issues) {
20
+ const message = `[${issue.code}] ${issue.message} (${issue.path})`;
21
+ if (issue.severity === 'error') {
22
+ errors.push(message);
23
+ }
24
+ else {
25
+ warnings.push(message);
26
+ }
27
+ }
28
+ if (!schemaValidation.valid && options.strict) {
29
+ return {
30
+ success: false,
31
+ css: '',
32
+ types: '',
33
+ runtime: '',
34
+ manifest: generateAIManifest(config),
35
+ errors,
36
+ warnings,
37
+ };
38
+ }
39
+ // Step 2: Update config with options
40
+ const compiledConfig = {
41
+ ...config,
42
+ settings: {
43
+ ...config.settings,
44
+ cssPrefix: options.cssPrefix || config.settings?.cssPrefix || 'intent',
45
+ },
46
+ };
47
+ // Step 3: Generate CSS
48
+ const css = compileSystem(compiledConfig, {
49
+ minify: options.minify,
50
+ includeSourceMap: options.sourceMap,
51
+ });
52
+ // Add dark mode if specified
53
+ let finalCSS = css;
54
+ if (options.darkMode && options.darkTokens) {
55
+ const { generateDarkModeVariables } = await import('../generator/css.js');
56
+ const darkCSS = generateDarkModeVariables(config.tokens, options.darkTokens, options.cssPrefix);
57
+ finalCSS += '\n\n' + darkCSS;
58
+ }
59
+ // Step 4: Generate TypeScript types
60
+ const types = generateSystemTypes(compiledConfig);
61
+ // Step 5: Generate runtime types
62
+ const runtime = generateRuntimeTypes(compiledConfig);
63
+ // Step 6: Generate AI manifest
64
+ const manifest = generateAIManifest(compiledConfig);
65
+ return {
66
+ success: errors.length === 0,
67
+ css: finalCSS,
68
+ types,
69
+ runtime,
70
+ manifest,
71
+ errors,
72
+ warnings,
73
+ };
74
+ }
75
+ export function watch(configPath, options = {}) {
76
+ // This would use fs.watch in a real implementation
77
+ // For now, just return a no-op stop function
78
+ return {
79
+ stop: () => { },
80
+ };
81
+ }
82
+ // ============================================================================
83
+ // Component Compilation
84
+ // ============================================================================
85
+ export async function compileComponent(config, componentName, options = {}) {
86
+ const schema = config.components[componentName];
87
+ if (!schema) {
88
+ return null;
89
+ }
90
+ const compiledConfig = {
91
+ ...config,
92
+ settings: {
93
+ ...config.settings,
94
+ cssPrefix: options.cssPrefix || config.settings?.cssPrefix || 'intent',
95
+ },
96
+ };
97
+ const { compileComponent: compileComp } = await import('../generator/css.js');
98
+ const { generateComponentTypes } = await import('../generator/types.js');
99
+ const { generateValidCombinations } = await import('../validator/constraints.js');
100
+ const styles = compileComp(schema, compiledConfig);
101
+ const typeDefinition = generateComponentTypes(schema);
102
+ const propCombinations = generateValidCombinations(schema).map(c => Object.entries(c).map(([k, v]) => `${k}=${v}`));
103
+ return {
104
+ component: componentName,
105
+ styles,
106
+ typeDefinition,
107
+ propCombinations,
108
+ };
109
+ }
110
+ export function validateWithUsage(config, usages, options = {}) {
111
+ const errors = [];
112
+ const warnings = [];
113
+ // Validate schema first
114
+ const schemaValidation = validateSchema(config);
115
+ for (const issue of schemaValidation.issues) {
116
+ const message = `[${issue.code}] ${issue.message} (${issue.path})`;
117
+ if (issue.severity === 'error') {
118
+ errors.push(message);
119
+ }
120
+ else {
121
+ warnings.push(message);
122
+ }
123
+ }
124
+ // Validate usage
125
+ const usageValidation = validateAllUsages(config, usages, { strict: options.strict });
126
+ for (const issue of usageValidation.issues) {
127
+ const message = `[${issue.code}] ${issue.message} (${issue.path})`;
128
+ if (issue.severity === 'error') {
129
+ errors.push(message);
130
+ }
131
+ else {
132
+ warnings.push(message);
133
+ }
134
+ }
135
+ return {
136
+ valid: errors.length === 0 && (!options.strict || warnings.length === 0),
137
+ schemaValid: schemaValidation.valid,
138
+ usageValid: usageValidation.valid,
139
+ errors,
140
+ warnings,
141
+ };
142
+ }
143
+ // ============================================================================
144
+ // AI Helpers
145
+ // ============================================================================
146
+ export { generateAIManifest, generateAIPrompt, } from '../generator/ai-manifest.js';
147
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/compiler/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAmB,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAwB,MAAM,qBAAqB,CAAC;AAC1E,OA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BAA6B,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * AST Parser
3
+ *
4
+ * Parses TypeScript/React source files to extract Intent component usage.
5
+ */
6
+ import * as ts from 'typescript';
7
+ import type { ComponentUsage, ValidationIssue } from '../types/index.js';
8
+ export interface ParseOptions {
9
+ intentImports: string[];
10
+ componentNames: string[];
11
+ }
12
+ export interface ParsedResult {
13
+ usages: ComponentUsage[];
14
+ issues: ValidationIssue[];
15
+ }
16
+ export declare function parseSourceFile(sourceFile: ts.SourceFile, options: ParseOptions): ParsedResult;
17
+ export declare function parseFile(filePath: string, content: string, options: ParseOptions): ParsedResult;
18
+ export interface BatchParseResult {
19
+ [filePath: string]: ParsedResult;
20
+ }
21
+ export declare function parseFiles(files: Array<{
22
+ path: string;
23
+ content: string;
24
+ }>, options: ParseOptions): BatchParseResult;
25
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/compiler/parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMzE,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAMD,wBAAgB,eAAe,CAC7B,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,OAAO,EAAE,YAAY,GACpB,YAAY,CAoFd;AAoJD,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,YAAY,GACpB,YAAY,CAUd;AAMD,MAAM,WAAW,gBAAgB;IAC/B,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAAC;CAClC;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EAC/C,OAAO,EAAE,YAAY,GACpB,gBAAgB,CAQlB"}
@@ -0,0 +1,198 @@
1
+ /**
2
+ * AST Parser
3
+ *
4
+ * Parses TypeScript/React source files to extract Intent component usage.
5
+ */
6
+ import * as ts from 'typescript';
7
+ // ============================================================================
8
+ // Source File Parser
9
+ // ============================================================================
10
+ export function parseSourceFile(sourceFile, options) {
11
+ const usages = [];
12
+ const issues = [];
13
+ // Track imported Intent components
14
+ const importedComponents = new Map(); // local name -> component name
15
+ function visit(node) {
16
+ // Handle import declarations
17
+ if (ts.isImportDeclaration(node)) {
18
+ const moduleSpecifier = node.moduleSpecifier;
19
+ if (ts.isStringLiteral(moduleSpecifier)) {
20
+ const moduleName = moduleSpecifier.text;
21
+ // Check if this is an Intent import
22
+ const isIntentImport = options.intentImports.some(pattern => {
23
+ if (pattern.includes('*')) {
24
+ const regex = new RegExp('^' + pattern.replace(/\*/g, '.*') + '$');
25
+ return regex.test(moduleName);
26
+ }
27
+ return moduleName === pattern || moduleName.startsWith(pattern + '/');
28
+ });
29
+ if (isIntentImport) {
30
+ const importClause = node.importClause;
31
+ if (importClause?.namedBindings && ts.isNamedImports(importClause.namedBindings)) {
32
+ for (const element of importClause.namedBindings.elements) {
33
+ const localName = element.name.text;
34
+ const importedName = element.propertyName?.text || localName;
35
+ if (options.componentNames.includes(importedName)) {
36
+ importedComponents.set(localName, importedName);
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ // Handle JSX elements
44
+ if (ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)) {
45
+ const tagName = ts.isJsxOpeningElement(node)
46
+ ? node.tagName
47
+ : node.tagName;
48
+ if (ts.isIdentifier(tagName)) {
49
+ const localName = tagName.text;
50
+ const componentName = importedComponents.get(localName);
51
+ if (componentName) {
52
+ const { props, propIssues } = extractProps(ts.isJsxOpeningElement(node) ? node.attributes : node.attributes, sourceFile);
53
+ const { line, character } = ts.getLineAndCharacterOfPosition(sourceFile, node.getStart(sourceFile));
54
+ usages.push({
55
+ component: componentName,
56
+ props,
57
+ location: {
58
+ file: sourceFile.fileName,
59
+ line: line + 1,
60
+ column: character + 1,
61
+ },
62
+ });
63
+ issues.push(...propIssues.map(issue => ({
64
+ ...issue,
65
+ path: `${sourceFile.fileName}:${line + 1}:${character + 1}`,
66
+ })));
67
+ }
68
+ }
69
+ }
70
+ ts.forEachChild(node, visit);
71
+ }
72
+ visit(sourceFile);
73
+ return { usages, issues };
74
+ }
75
+ // ============================================================================
76
+ // Prop Extraction
77
+ // ============================================================================
78
+ function extractProps(attributes, sourceFile) {
79
+ const props = {};
80
+ const propIssues = [];
81
+ for (const attr of attributes.properties) {
82
+ // Handle spread attributes (we can't statically analyze these)
83
+ if (ts.isJsxSpreadAttribute(attr)) {
84
+ propIssues.push({
85
+ severity: 'warning',
86
+ code: 'DYNAMIC_PROPS',
87
+ message: 'Spread attributes cannot be statically validated',
88
+ path: '',
89
+ });
90
+ continue;
91
+ }
92
+ // Handle regular JSX attributes
93
+ if (ts.isJsxAttribute(attr)) {
94
+ const propName = ts.isIdentifier(attr.name) ? attr.name.text : attr.name.namespace.text;
95
+ // Check for forbidden className usage
96
+ if (propName === 'className') {
97
+ const value = attr.initializer;
98
+ // Check for arbitrary Tailwind-like values
99
+ if (value && ts.isStringLiteral(value)) {
100
+ const classValue = value.text;
101
+ // Detect Tailwind arbitrary values like pt-[7px]
102
+ if (/\[.+\]/.test(classValue)) {
103
+ propIssues.push({
104
+ severity: 'error',
105
+ code: 'ARBITRARY_VALUE',
106
+ message: `Arbitrary Tailwind values are not allowed: "${classValue}". Use Intent tokens instead.`,
107
+ path: '',
108
+ suggestion: 'Replace with Intent semantic props',
109
+ });
110
+ }
111
+ // Detect utility class usage
112
+ const utilityPatterns = [
113
+ /^flex$/, /^block$/, /^inline/, /^grid$/,
114
+ /^items-/, /^justify-/, /^bg-/, /^text-/, /^p-/, /^m-/, /^px-/, /^py-/
115
+ ];
116
+ const hasUtilityClasses = classValue.split(/\s+/).some(cls => utilityPatterns.some(pattern => pattern.test(cls)));
117
+ if (hasUtilityClasses) {
118
+ propIssues.push({
119
+ severity: 'warning',
120
+ code: 'UTILITY_CLASS',
121
+ message: `Tailwind utility classes detected: "${classValue}". Prefer Intent components.`,
122
+ path: '',
123
+ suggestion: 'Use Stack, Surface, or other Intent components instead',
124
+ });
125
+ }
126
+ }
127
+ // Still record the className prop (will be validated later)
128
+ props[propName] = extractValue(attr.initializer, sourceFile);
129
+ continue;
130
+ }
131
+ props[propName] = extractValue(attr.initializer, sourceFile);
132
+ }
133
+ }
134
+ return { props, propIssues };
135
+ }
136
+ // ============================================================================
137
+ // Value Extraction
138
+ // ============================================================================
139
+ function extractValue(initializer, sourceFile) {
140
+ if (!initializer) {
141
+ return true; // Boolean prop without value
142
+ }
143
+ // String literal: prop="value"
144
+ if (ts.isStringLiteral(initializer)) {
145
+ return initializer.text;
146
+ }
147
+ // Expression: prop={value}
148
+ if (ts.isJsxExpression(initializer)) {
149
+ if (!initializer.expression) {
150
+ return undefined;
151
+ }
152
+ const expr = initializer.expression;
153
+ // String literal in expression: prop={"value"}
154
+ if (ts.isStringLiteral(expr)) {
155
+ return expr.text;
156
+ }
157
+ // Number literal: prop={42}
158
+ if (ts.isNumericLiteral(expr)) {
159
+ return Number(expr.text);
160
+ }
161
+ // Boolean literal: prop={true}
162
+ if (expr.kind === ts.SyntaxKind.TrueKeyword)
163
+ return true;
164
+ if (expr.kind === ts.SyntaxKind.FalseKeyword)
165
+ return false;
166
+ // Identifier: prop={someVariable}
167
+ if (ts.isIdentifier(expr)) {
168
+ return { __dynamic: expr.text };
169
+ }
170
+ // Object literal: prop={{ key: value }}
171
+ if (ts.isObjectLiteralExpression(expr)) {
172
+ const obj = {};
173
+ for (const prop of expr.properties) {
174
+ if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {
175
+ obj[prop.name.text] = extractValue({ ...prop.initializer, kind: ts.SyntaxKind.JsxExpression }, sourceFile);
176
+ }
177
+ }
178
+ return obj;
179
+ }
180
+ }
181
+ // Fallback: return as string representation
182
+ return initializer.getText(sourceFile);
183
+ }
184
+ // ============================================================================
185
+ // Parse File
186
+ // ============================================================================
187
+ export function parseFile(filePath, content, options) {
188
+ const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
189
+ return parseSourceFile(sourceFile, options);
190
+ }
191
+ export function parseFiles(files, options) {
192
+ const results = {};
193
+ for (const file of files) {
194
+ results[file.path] = parseFile(file.path, file.content, options);
195
+ }
196
+ return results;
197
+ }
198
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/compiler/parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAiBjC,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,MAAM,UAAU,eAAe,CAC7B,UAAyB,EACzB,OAAqB;IAErB,MAAM,MAAM,GAAqB,EAAE,CAAC;IACpC,MAAM,MAAM,GAAsB,EAAE,CAAC;IAErC,mCAAmC;IACnC,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAkB,CAAC,CAAC,+BAA+B;IAErF,SAAS,KAAK,CAAC,IAAa;QAC1B,6BAA6B;QAC7B,IAAI,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,MAAM,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;YAC7C,IAAI,EAAE,CAAC,eAAe,CAAC,eAAe,CAAC,EAAE,CAAC;gBACxC,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC;gBAExC,oCAAoC;gB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,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBAChE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,YAAY,CAChC,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,EAAsB,EAC9E,UAAU,CACX,CAAC;gBACJ,CAAC;YACH,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC;IAED,4CAA4C;IAC5C,OAAO,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACzC,CAAC;AAED,+EAA+E;AAC/E,aAAa;AACb,+EAA+E;AAE/E,MAAM,UAAU,SAAS,CACvB,QAAgB,EAChB,OAAe,EACf,OAAqB;IAErB,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CACpC,QAAQ,EACR,OAAO,EACP,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,EACJ,EAAE,CAAC,UAAU,CAAC,GAAG,CAClB,CAAC;IAEF,OAAO,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAUD,MAAM,UAAU,UAAU,CACxB,KAA+C,EAC/C,OAAqB;IAErB,MAAM,OAAO,GAAqB,EAAE,CAAC;IAErC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * AI Manifest Generator
3
+ *
4
+ * Generates AI-friendly metadata for LLM consumption.
5
+ */
6
+ import type { DesignSystemConfig, AIManifest } from '../types/index.js';
7
+ export declare function generateAIManifest(config: DesignSystemConfig): AIManifest;
8
+ export interface PromptContext {
9
+ component?: string;
10
+ task?: string;
11
+ existingCode?: string;
12
+ }
13
+ export declare function generateAIPrompt(manifest: AIManifest, context?: PromptContext): string;
14
+ //# sourceMappingURL=ai-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-manifest.d.ts","sourceRoot":"","sources":["../../src/generator/ai-manifest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAElB,UAAU,EAEX,MAAM,mBAAmB,CAAC;AAsF3B,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,UAAU,CAUzE;AAqHD,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CA6FtF"}