@damarkuncoro/meta-architecture-style-engine 0.1.0 → 0.1.1

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/index.ts","../../../src/dsl/Tokenizer.ts","../../../src/dsl/Parser.ts","../../../src/dsl/Validator.ts","../../../src/dsl/Compiler.ts","../../../src/materializer/CSSMaterializer.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * MASE CLI Tool\n * \n * Command-line interface for Meta-Architecture Style Engine.\n * \n * Commands:\n * - mase init: Initialize a new project\n * - mase compile: Compile contract DSL to TypeScript\n * - mase validate: Validate contract DSL\n * - mase generate-css: Generate CSS from contract DSL\n * - mase watch: Watch for changes and recompile\n * \n * Key Principles:\n * - DRY: Single CLI logic\n * - SOLID: Single responsibility\n * - YAGNI: Only implement what's needed\n * - DDD: Domain-specific CLI commands\n */\n\nimport { Command } from 'commander';\nimport { ContractDSLTokenizer, ContractDSLParser, ContractDSLValidator, ContractDSLCompiler } from '../dsl';\nimport { CSSMaterializer } from '../materializer';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nconst program = new Command();\n\nprogram\n .name('mase')\n .description('Meta-Architecture Style Engine CLI')\n .version('1.0.0');\n\n/**\n * mase init\n * Initialize a new project with MASE.\n */\nprogram\n .command('init')\n .description('Initialize a new project with MASE')\n .argument('[project-name]', 'Project name')\n .option('-t, --template <template>', 'Template to use (default, minimal, full)', 'default')\n .option('--typescript', 'Use TypeScript (default)', true)\n .option('--javascript', 'Use JavaScript')\n .action((projectName, options) => {\n console.log('Initializing MASE project...');\n console.log(`Project name: ${projectName || 'mase-project'}`);\n console.log(`Template: ${options.template}`);\n console.log(`TypeScript: ${options.typescript}`);\n console.log('✅ Project initialized successfully!');\n });\n\n/**\n * mase compile\n * Compile a contract DSL file to TypeScript.\n */\nprogram\n .command('compile')\n .description('Compile a contract DSL file to TypeScript')\n .argument('<contract-file>', 'Contract DSL file to compile')\n .option('-o, --output <file>', 'Output file (default: stdout)')\n .option('--format <format>', 'Output format (ts, json, ast)', 'ts')\n .option('--watch', 'Watch for changes', false)\n .action((contractFile, options) => {\n console.log(`Compiling ${contractFile}...`);\n \n try {\n // Read contract file\n const source = fs.readFileSync(contractFile, 'utf-8');\n \n // Tokenize\n const tokenizer = new ContractDSLTokenizer();\n const tokens = tokenizer.tokenize(source);\n \n // Parse\n const parser = new ContractDSLParser();\n const ast = parser.parse(tokens);\n \n // Validate\n const validator = new ContractDSLValidator();\n const validationResult = validator.validate(ast);\n \n if (!validationResult.isValid) {\n console.error('❌ Validation errors:');\n validationResult.errors.forEach(error => {\n console.error(` - ${error.path}: ${error.message}`);\n });\n process.exit(1);\n }\n \n // Compile\n const compiler = new ContractDSLCompiler();\n const result = compiler.compile(ast);\n \n if (result.errors.length > 0) {\n console.error('❌ Compilation errors:');\n result.errors.forEach(error => {\n console.error(` - ${error}`);\n });\n process.exit(1);\n }\n \n // Output based on format\n let output: string;\n \n switch (options.format) {\n case 'json':\n output = JSON.stringify(ast, null, 2);\n break;\n case 'ast':\n output = JSON.stringify(ast, null, 2);\n break;\n case 'ts':\n default:\n output = compiler.generateTypeScriptFile(ast);\n break;\n }\n \n if (options.output) {\n fs.writeFileSync(options.output, output, 'utf-8');\n console.log(`✅ Compiled to ${options.output}`);\n } else {\n console.log(output);\n }\n \n if (options.watch) {\n console.log('👀 Watching for changes...');\n // TODO: Implement watch mode\n }\n \n } catch (error) {\n console.error('❌ Error:', error);\n process.exit(1);\n }\n });\n\n/**\n * mase validate\n * Validate a contract DSL file.\n */\nprogram\n .command('validate')\n .description('Validate a contract DSL file')\n .argument('<contract-file>', 'Contract DSL file to validate')\n .option('--strict', 'Enable strict validation', false)\n .option('--fix', 'Auto-fix issues', false)\n .option('--watch', 'Watch for changes', false)\n .action((contractFile, options) => {\n console.log(`Validating ${contractFile}...`);\n \n try {\n // Read contract file\n const source = fs.readFileSync(contractFile, 'utf-8');\n \n // Tokenize\n const tokenizer = new ContractDSLTokenizer();\n const tokens = tokenizer.tokenize(source);\n \n // Parse\n const parser = new ContractDSLParser();\n const ast = parser.parse(tokens);\n \n // Validate\n const validator = new ContractDSLValidator();\n const validationResult = validator.validate(ast);\n \n if (validationResult.isValid) {\n console.log('✅ Contract is valid!');\n } else {\n console.error('❌ Validation errors:');\n validationResult.errors.forEach(error => {\n console.error(` - ${error.path}: ${error.message}`);\n });\n process.exit(1);\n }\n \n if (options.watch) {\n console.log('👀 Watching for changes...');\n // TODO: Implement watch mode\n }\n \n } catch (error) {\n console.error('❌ Error:', error);\n process.exit(1);\n }\n });\n\n/**\n * mase generate-css\n * Generate CSS from a contract DSL file.\n */\nprogram\n .command('generate-css')\n .description('Generate CSS from a contract DSL file')\n .argument('<contract-file>', 'Contract DSL file to generate CSS from')\n .option('-o, --output <file>', 'Output file (default: stdout)')\n .option('--format <format>', 'Output format (class, variable, inline)', 'class')\n .option('--theme <theme>', 'Theme (light, dark)', 'light')\n .option('--device <device>', 'Device (mobile, tablet, desktop)', 'desktop')\n .action((contractFile, options) => {\n console.log(`Generating CSS from ${contractFile}...`);\n \n try {\n // Read contract file\n const source = fs.readFileSync(contractFile, 'utf-8');\n \n // Tokenize\n const tokenizer = new ContractDSLTokenizer();\n const tokens = tokenizer.tokenize(source);\n \n // Parse\n const parser = new ContractDSLParser();\n const ast = parser.parse(tokens);\n \n // Validate\n const validator = new ContractDSLValidator();\n const validationResult = validator.validate(ast);\n \n if (!validationResult.isValid) {\n console.error('❌ Validation errors:');\n validationResult.errors.forEach(error => {\n console.error(` - ${error.path}: ${error.message}`);\n });\n process.exit(1);\n }\n \n // Compile\n const compiler = new ContractDSLCompiler();\n const result = compiler.compile(ast);\n \n // Materialize to CSS\n const materializer = new CSSMaterializer();\n const cssResult = materializer.materialize(\n result.constitution.rules.map(rule => ({\n domain: rule.domain,\n semantic: rule.property,\n tokenRef: rule.allowedTokens[0]\n })),\n {\n platform: 'web',\n theme: options.theme as 'light' | 'dark',\n device: options.device as 'mobile' | 'tablet' | 'desktop',\n outputFormat: options.format as 'class' | 'variable' | 'inline'\n }\n );\n \n // Output based on format\n let output: string;\n \n switch (options.format) {\n case 'variable':\n output = cssResult.output.variables;\n break;\n case 'inline':\n output = cssResult.output.inline;\n break;\n case 'class':\n default:\n output = cssResult.output.classes;\n break;\n }\n \n if (options.output) {\n fs.writeFileSync(options.output, output, 'utf-8');\n console.log(`✅ CSS generated to ${options.output}`);\n } else {\n console.log(output);\n }\n \n } catch (error) {\n console.error('❌ Error:', error);\n process.exit(1);\n }\n });\n\n/**\n * mase watch\n * Watch for changes and recompile.\n */\nprogram\n .command('watch')\n .description('Watch for changes and recompile')\n .argument('<contract-file>', 'Contract DSL file to watch')\n .option('--command <command>', 'Command to run on change', 'mase compile')\n .option('--debounce <ms>', 'Debounce time in ms', '300')\n .action((contractFile, options) => {\n console.log(`Watching ${contractFile}...`);\n console.log(`Command: ${options.command}`);\n console.log(`Debounce: ${options.debounce}ms`);\n console.log('👀 Watching for changes...');\n // TODO: Implement watch mode\n });\n\n// Parse command line arguments\nprogram.parse(process.argv);","/**\n * Contract DSL Tokenizer\n * \n * Tokenizes Contract DSL source code into tokens for parsing.\n * \n * Responsibilities:\n * - Convert DSL source to tokens\n * - Handle whitespace and comments\n * - Provide error locations\n * \n * Key Principles:\n * - DRY: Single tokenization logic\n * - SOLID: Single responsibility\n * - YAGNI: Only tokenize what's needed\n * - DDD: Domain-specific token types\n */\n\n/**\n * TokenType\n * Enum of all token types in Contract DSL.\n */\nexport type TokenType =\n // Keywords\n | 'CONTRACT'\n | 'DOMAIN'\n | 'ALLOWS'\n | 'DEFAULT'\n | 'CONSTRAINTS'\n | 'CONFLICTS'\n \n // Contexts\n | 'MOBILE'\n | 'TABLET'\n | 'DESKTOP'\n | 'LIGHT'\n | 'DARK'\n | 'WEB'\n | 'NATIVE'\n | 'CANVAS'\n | 'DEFAULT_CTX'\n | 'HOVER'\n | 'ACTIVE'\n | 'DISABLED'\n \n // Domains\n | 'LAYOUT'\n | 'TYPOGRAPHY'\n | 'COLOR'\n | 'EFFECT'\n | 'INTERACTION'\n \n // Punctuation\n | 'LBRACE'\n | 'RBRACE'\n | 'LBRACKET'\n | 'RBRACKET'\n | 'COLON'\n | 'SEMICOLON'\n | 'COMMA'\n \n // Literals\n | 'IDENTIFIER'\n \n // Special\n | 'EOF'\n | 'UNKNOWN';\n\nexport const TokenType = {\n // Keywords\n CONTRACT: 'CONTRACT' as const,\n DOMAIN: 'DOMAIN' as const,\n ALLOWS: 'ALLOWS' as const,\n DEFAULT: 'DEFAULT' as const,\n CONSTRAINTS: 'CONSTRAINTS' as const,\n CONFLICTS: 'CONFLICTS' as const,\n \n // Contexts\n MOBILE: 'MOBILE' as const,\n TABLET: 'TABLET' as const,\n DESKTOP: 'DESKTOP' as const,\n LIGHT: 'LIGHT' as const,\n DARK: 'DARK' as const,\n WEB: 'WEB' as const,\n NATIVE: 'NATIVE' as const,\n CANVAS: 'CANVAS' as const,\n DEFAULT_CTX: 'DEFAULT_CTX' as const,\n HOVER: 'HOVER' as const,\n ACTIVE: 'ACTIVE' as const,\n DISABLED: 'DISABLED' as const,\n \n // Domains\n LAYOUT: 'LAYOUT' as const,\n TYPOGRAPHY: 'TYPOGRAPHY' as const,\n COLOR: 'COLOR' as const,\n EFFECT: 'EFFECT' as const,\n INTERACTION: 'INTERACTION' as const,\n \n // Punctuation\n LBRACE: 'LBRACE' as const,\n RBRACE: 'RBRACE' as const,\n LBRACKET: 'LBRACKET' as const,\n RBRACKET: 'RBRACKET' as const,\n COLON: 'COLON' as const,\n SEMICOLON: 'SEMICOLON' as const,\n COMMA: 'COMMA' as const,\n \n // Literals\n IDENTIFIER: 'IDENTIFIER' as const,\n \n // Special\n EOF: 'EOF' as const,\n UNKNOWN: 'UNKNOWN' as const\n};\n\n/**\n * Token\n * Represents a single token in the DSL.\n */\nexport interface Token {\n readonly type: TokenType;\n readonly value: string;\n readonly line: number;\n readonly column: number;\n}\n\n/**\n * TokenizerError\n * Error during tokenization.\n */\nexport class TokenizerError extends Error {\n readonly line: number;\n readonly column: number;\n \n constructor(message: string, line: number, column: number) {\n super(message);\n this.name = 'TokenizerError';\n this.line = line;\n this.column = column;\n }\n}\n\n/**\n * ContractDSLTokenizer\n * Tokenizes Contract DSL source code.\n */\nexport class ContractDSLTokenizer {\n private source: string = '';\n private position: number = 0;\n private line: number = 1;\n private column: number = 1;\n \n // Keyword map\n private readonly keywords: Map<string, TokenType> = new Map([\n ['contract', TokenType.CONTRACT],\n ['domain', TokenType.DOMAIN],\n ['allows', TokenType.ALLOWS],\n ['default', TokenType.DEFAULT],\n ['constraints', TokenType.CONSTRAINTS],\n ['conflicts', TokenType.CONFLICTS],\n \n // Contexts\n ['mobile', TokenType.MOBILE],\n ['tablet', TokenType.TABLET],\n ['desktop', TokenType.DESKTOP],\n ['light', TokenType.LIGHT],\n ['dark', TokenType.DARK],\n ['web', TokenType.WEB],\n ['native', TokenType.NATIVE],\n ['canvas', TokenType.CANVAS],\n ['default', TokenType.DEFAULT_CTX],\n ['hover', TokenType.HOVER],\n ['active', TokenType.ACTIVE],\n ['disabled', TokenType.DISABLED],\n \n // Domains\n ['layout', TokenType.LAYOUT],\n ['typography', TokenType.TYPOGRAPHY],\n ['color', TokenType.COLOR],\n ['effect', TokenType.EFFECT],\n ['interaction', TokenType.INTERACTION]\n ]);\n \n /**\n * Tokenize source code\n * @param source - DSL source code\n * @returns Array of tokens\n */\n tokenize(source: string): Token[] {\n this.source = source;\n this.position = 0;\n this.line = 1;\n this.column = 1;\n \n const tokens: Token[] = [];\n \n while (this.position < this.source.length) {\n const char = this.source[this.position];\n \n // Skip whitespace\n if (this.isWhitespace(char)) {\n this.advance();\n continue;\n }\n \n // Skip comments\n if (char === '/' && this.peek() === '/') {\n this.skipComment();\n continue;\n }\n \n // Tokenize\n const token = this.nextToken();\n if (token) {\n tokens.push(token);\n }\n }\n \n // Add EOF token\n tokens.push({\n type: TokenType.EOF,\n value: '',\n line: this.line,\n column: this.column\n });\n \n return tokens;\n }\n \n /**\n * Get next token\n * @returns Token or null if EOF\n */\n private nextToken(): Token | null {\n const char = this.source[this.position];\n \n // Punctuation\n if (char === '{') return this.createToken(TokenType.LBRACE, char);\n if (char === '}') return this.createToken(TokenType.RBRACE, char);\n if (char === '[') return this.createToken(TokenType.LBRACKET, char);\n if (char === ']') return this.createToken(TokenType.RBRACKET, char);\n if (char === ':') return this.createToken(TokenType.COLON, char);\n if (char === ';') return this.createToken(TokenType.SEMICOLON, char);\n if (char === ',') return this.createToken(TokenType.COMMA, char);\n \n // Identifier or keyword\n if (this.isLetter(char) || char === '_' || char === '-') {\n return this.readIdentifier();\n }\n \n // Unknown character\n throw new TokenizerError(\n `Unknown character: '${char}'`,\n this.line,\n this.column\n );\n }\n \n /**\n * Read identifier or keyword\n * @returns Token\n */\n private readIdentifier(): Token {\n const start = this.position;\n const startLine = this.line;\n const startColumn = this.column;\n \n while (\n this.position < this.source.length &&\n (this.isLetter(this.source[this.position]) ||\n this.isDigit(this.source[this.position]) ||\n this.source[this.position] === '_' ||\n this.source[this.position] === '-' ||\n this.source[this.position] === '.')\n ) {\n this.advance();\n }\n \n const value = this.source.substring(start, this.position);\n const type = this.keywords.get(value) || TokenType.IDENTIFIER;\n \n return {\n type,\n value,\n line: startLine,\n column: startColumn\n };\n }\n \n /**\n * Skip single-line comment\n */\n private skipComment(): void {\n while (this.position < this.source.length && this.source[this.position] !== '\\n') {\n this.advance();\n }\n }\n \n /**\n * Create token\n * @param type - Token type\n * @param value - Token value\n * @returns Token\n */\n private createToken(type: TokenType, value: string): Token {\n const token = {\n type,\n value,\n line: this.line,\n column: this.column\n };\n \n this.advance();\n return token;\n }\n \n /**\n * Advance to next character\n */\n private advance(): void {\n if (this.source[this.position] === '\\n') {\n this.line++;\n this.column = 1;\n } else {\n this.column++;\n }\n this.position++;\n }\n \n /**\n * Peek at next character\n * @returns Next character or empty string\n */\n private peek(): string {\n if (this.position + 1 < this.source.length) {\n return this.source[this.position + 1];\n }\n return '';\n }\n \n /**\n * Check if character is whitespace\n * @param char - Character to check\n * @returns True if whitespace\n */\n private isWhitespace(char: string): boolean {\n return char === ' ' || char === '\\t' || char === '\\n' || char === '\\r';\n }\n \n /**\n * Check if character is letter\n * @param char - Character to check\n * @returns True if letter\n */\n private isLetter(char: string): boolean {\n return /[a-zA-Z]/.test(char);\n }\n \n /**\n * Check if character is digit\n * @param char - Character to check\n * @returns True if digit\n */\n private isDigit(char: string): boolean {\n return /[0-9]/.test(char);\n }\n}","/**\n * Contract DSL Parser\n * \n * Parses tokens from Contract DSL into Abstract Syntax Tree (AST).\n * \n * Responsibilities:\n * - Parse tokens into AST\n * - Implement EBNF grammar\n * - Provide syntax errors\n * \n * Key Principles:\n * - DRY: Single parsing logic\n * - SOLID: Single responsibility\n * - YAGNI: Only parse what's needed\n * - DDD: Domain-specific AST structure\n */\n\nimport type { Token, TokenType } from './Tokenizer';\nimport { TokenType as TT } from './Tokenizer';\n\n/**\n * ContractAST\n * Abstract Syntax Tree for a contract.\n */\nexport interface ContractAST {\n readonly name: string;\n readonly domain: string;\n readonly properties: PropertyAST[];\n}\n\n/**\n * PropertyAST\n * AST for a property declaration.\n */\nexport interface PropertyAST {\n readonly name: string;\n readonly allows: string[];\n readonly default?: string;\n readonly constraints?: ConstraintAST[];\n readonly conflicts?: string[];\n}\n\n/**\n * ConstraintAST\n * AST for a constraint declaration.\n */\nexport interface ConstraintAST {\n readonly context: string;\n readonly allows: string[];\n}\n\n/**\n * ParserError\n * Error during parsing.\n */\nexport class ParserError extends Error {\n readonly line: number;\n readonly column: number;\n \n constructor(message: string, line: number, column: number) {\n super(message);\n this.name = 'ParserError';\n this.line = line;\n this.column = column;\n }\n}\n\n/**\n * ContractDSLParser\n * Parses Contract DSL tokens into AST.\n */\nexport class ContractDSLParser {\n private tokens: Token[] = [];\n private position: number = 0;\n \n /**\n * Parse tokens into AST\n * @param tokens - Array of tokens\n * @returns Contract AST\n */\n parse(tokens: Token[]): ContractAST {\n this.tokens = tokens;\n this.position = 0;\n \n // Parse contract\n const contract = this.parseContract();\n \n // Expect EOF\n this.expect(TT.EOF);\n \n return contract;\n }\n \n /**\n * Parse contract\n * @returns Contract AST\n */\n private parseContract(): ContractAST {\n // Expect 'contract'\n this.expect(TT.CONTRACT);\n \n // Expect identifier (contract name)\n const name = this.expectIdentifier();\n \n // Expect '{'\n this.expect(TT.LBRACE);\n \n // Parse domain\n const domain = this.parseDomain();\n \n // Parse properties\n const properties: PropertyAST[] = [];\n while (this.peek()?.type === TT.IDENTIFIER) {\n properties.push(this.parseProperty());\n }\n \n // Expect '}'\n this.expect(TT.RBRACE);\n \n return {\n name,\n domain,\n properties\n };\n }\n \n /**\n * Parse domain declaration\n * @returns Domain name\n */\n private parseDomain(): string {\n // Expect 'domain'\n this.expect(TT.DOMAIN);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect domain identifier\n const domain = this.expectIdentifier();\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return domain;\n }\n \n /**\n * Parse property declaration\n * @returns Property AST\n */\n private parseProperty(): PropertyAST {\n // Expect identifier (property name)\n const name = this.expectIdentifier();\n \n // Expect '{'\n this.expect(TT.LBRACE);\n \n // Parse property body\n const allows = this.parseAllows();\n const defaultVal = this.parseDefault();\n const constraints = this.parseConstraints();\n const conflicts = this.parseConflicts();\n \n // Expect '}'\n this.expect(TT.RBRACE);\n \n return {\n name,\n allows,\n default: defaultVal,\n constraints,\n conflicts\n };\n }\n \n /**\n * Parse allows declaration\n * @returns Array of allowed tokens\n */\n private parseAllows(): string[] {\n // Expect 'allows'\n this.expect(TT.ALLOWS);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect '['\n this.expect(TT.LBRACKET);\n \n // Parse token list\n const tokens: string[] = [];\n if (this.peek()?.type === TT.IDENTIFIER) {\n tokens.push(this.expectIdentifier());\n \n while (this.peek()?.type === TT.COMMA) {\n this.expect(TT.COMMA);\n tokens.push(this.expectIdentifier());\n }\n }\n \n // Expect ']'\n this.expect(TT.RBRACKET);\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return tokens;\n }\n \n /**\n * Parse default declaration\n * @returns Default token or undefined\n */\n private parseDefault(): string | undefined {\n // Check if 'default' keyword\n if (this.peek()?.type !== TT.DEFAULT) {\n return undefined;\n }\n \n // Expect 'default'\n this.expect(TT.DEFAULT);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect identifier\n const value = this.expectIdentifier();\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return value;\n }\n \n /**\n * Parse constraints declaration\n * @returns Array of constraints or undefined\n */\n private parseConstraints(): ConstraintAST[] | undefined {\n // Check if 'constraints' keyword\n if (this.peek()?.type !== TT.CONSTRAINTS) {\n return undefined;\n }\n \n // Expect 'constraints'\n this.expect(TT.CONSTRAINTS);\n \n // Expect '{'\n this.expect(TT.LBRACE);\n \n // Parse constraint list\n const constraints: ConstraintAST[] = [];\n while (this.peek()?.type === TT.MOBILE || \n this.peek()?.type === TT.TABLET || \n this.peek()?.type === TT.DESKTOP ||\n this.peek()?.type === TT.LIGHT || \n this.peek()?.type === TT.DARK ||\n this.peek()?.type === TT.WEB || \n this.peek()?.type === TT.NATIVE ||\n this.peek()?.type === TT.CANVAS ||\n this.peek()?.type === TT.DEFAULT_CTX ||\n this.peek()?.type === TT.HOVER || \n this.peek()?.type === TT.ACTIVE ||\n this.peek()?.type === TT.DISABLED) {\n constraints.push(this.parseConstraint());\n }\n \n // Expect '}'\n this.expect(TT.RBRACE);\n \n return constraints;\n }\n \n /**\n * Parse constraint\n * @returns Constraint AST\n */\n private parseConstraint(): ConstraintAST {\n // Expect context\n const context = this.expectContext();\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect '['\n this.expect(TT.LBRACKET);\n \n // Parse token list\n const tokens: string[] = [];\n if (this.peek()?.type === TT.IDENTIFIER) {\n tokens.push(this.expectIdentifier());\n \n while (this.peek()?.type === TT.COMMA) {\n this.expect(TT.COMMA);\n tokens.push(this.expectIdentifier());\n }\n }\n \n // Expect ']'\n this.expect(TT.RBRACKET);\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return {\n context,\n allows: tokens\n };\n }\n \n /**\n * Parse conflicts declaration\n * @returns Array of conflicting properties or undefined\n */\n private parseConflicts(): string[] | undefined {\n // Check if 'conflicts' keyword\n if (this.peek()?.type !== TT.CONFLICTS) {\n return undefined;\n }\n \n // Expect 'conflicts'\n this.expect(TT.CONFLICTS);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect '['\n this.expect(TT.LBRACKET);\n \n // Parse property list\n const properties: string[] = [];\n if (this.peek()?.type === TT.IDENTIFIER) {\n properties.push(this.expectIdentifier());\n \n while (this.peek()?.type === TT.COMMA) {\n this.expect(TT.COMMA);\n properties.push(this.expectIdentifier());\n }\n }\n \n // Expect ']'\n this.expect(TT.RBRACKET);\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return properties;\n }\n \n /**\n * Expect identifier token\n * @returns Identifier value\n */\n private expectIdentifier(): string {\n const token = this.peek();\n if (!token || token.type !== TT.IDENTIFIER) {\n throw new ParserError(\n `Expected identifier, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n return token.value;\n }\n \n /**\n * Expect context token\n * @returns Context value\n */\n private expectContext(): string {\n const token = this.peek();\n if (!token || \n (token.type !== TT.MOBILE && \n token.type !== TT.TABLET && \n token.type !== TT.DESKTOP &&\n token.type !== TT.LIGHT && \n token.type !== TT.DARK &&\n token.type !== TT.WEB && \n token.type !== TT.NATIVE &&\n token.type !== TT.CANVAS &&\n token.type !== TT.DEFAULT_CTX &&\n token.type !== TT.HOVER && \n token.type !== TT.ACTIVE &&\n token.type !== TT.DISABLED)) {\n throw new ParserError(\n `Expected context, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n return token.value;\n }\n \n /**\n * Expect specific token type\n * @param type - Expected token type\n */\n private expect(type: TokenType): void {\n const token = this.peek();\n if (!token || token.type !== type) {\n throw new ParserError(\n `Expected ${type}, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n }\n \n /**\n * Peek at current token\n * @returns Current token or undefined\n */\n private peek(): Token | undefined {\n return this.tokens[this.position];\n }\n \n /**\n * Advance to next token\n */\n private advance(): void {\n this.position++;\n }\n}","/**\n * Contract DSL Validator\n * \n * Validates Contract DSL AST structure and semantics.\n * \n * Responsibilities:\n * - Validate AST structure\n * - Check token references\n * - Validate constraints\n * \n * Key Principles:\n * - DRY: Single validation logic\n * - SOLID: Single responsibility\n * - YAGNI: Only validate what's needed\n * - DDD: Domain-specific validation rules\n */\n\nimport type { ContractAST, PropertyAST, ConstraintAST } from './Parser';\nimport type { StyleDomain } from '../domain/types';\n\n/**\n * ValidationError\n * Error during validation.\n */\nexport class ValidationError extends Error {\n readonly path: string;\n \n constructor(message: string, path: string) {\n super(message);\n this.name = 'ValidationError';\n this.path = path;\n }\n}\n\n/**\n * ValidationResult\n * Result of validation.\n */\nexport interface ValidationResult {\n readonly isValid: boolean;\n readonly errors: ValidationError[];\n}\n\n/**\n * ContractDSLValidator\n * Validates Contract DSL AST.\n */\nexport class ContractDSLValidator {\n private readonly validDomains: Set<StyleDomain> = new Set([\n 'layout',\n 'typography',\n 'color',\n 'effect',\n 'interaction'\n ]);\n \n private readonly validContexts: Set<string> = new Set([\n 'mobile',\n 'tablet',\n 'desktop',\n 'light',\n 'dark',\n 'web',\n 'native',\n 'canvas',\n 'default',\n 'hover',\n 'active',\n 'disabled'\n ]);\n \n /**\n * Validate contract AST\n * @param ast - Contract AST\n * @returns Validation result\n */\n validate(ast: ContractAST): ValidationResult {\n const errors: ValidationError[] = [];\n \n // Validate contract name\n this.validateContractName(ast.name, errors);\n \n // Validate domain\n this.validateDomain(ast.domain, errors);\n \n // Validate properties\n this.validateProperties(ast.properties, errors);\n \n return {\n isValid: errors.length === 0,\n errors\n };\n }\n \n /**\n * Validate contract name\n * @param name - Contract name\n * @param errors - Array to collect errors\n */\n private validateContractName(name: string, errors: ValidationError[]): void {\n if (!name || name.trim().length === 0) {\n errors.push(new ValidationError(\n 'Contract name cannot be empty',\n 'contract.name'\n ));\n }\n \n if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name)) {\n errors.push(new ValidationError(\n `Invalid contract name: '${name}'. Must start with a letter and contain only letters, digits, underscores, and hyphens.`,\n 'contract.name'\n ));\n }\n }\n \n /**\n * Validate domain\n * @param domain - Domain name\n * @param errors - Array to collect errors\n */\n private validateDomain(domain: string, errors: ValidationError[]): void {\n if (!domain || domain.trim().length === 0) {\n errors.push(new ValidationError(\n 'Domain cannot be empty',\n 'contract.domain'\n ));\n return;\n }\n \n if (!this.validDomains.has(domain as StyleDomain)) {\n errors.push(new ValidationError(\n `Invalid domain: '${domain}'. Must be one of: ${Array.from(this.validDomains).join(', ')}`,\n 'contract.domain'\n ));\n }\n }\n \n /**\n * Validate properties\n * @param properties - Array of properties\n * @param errors - Array to collect errors\n */\n private validateProperties(properties: PropertyAST[], errors: ValidationError[]): void {\n if (!properties || properties.length === 0) {\n errors.push(new ValidationError(\n 'Contract must have at least one property',\n 'contract.properties'\n ));\n return;\n }\n \n // Check for duplicate property names\n const propertyNames = new Set<string>();\n for (const property of properties) {\n if (propertyNames.has(property.name)) {\n errors.push(new ValidationError(\n `Duplicate property name: '${property.name}'`,\n `contract.properties.${property.name}`\n ));\n }\n propertyNames.add(property.name);\n \n // Validate individual property\n this.validateProperty(property, errors);\n }\n }\n \n /**\n * Validate property\n * @param property - Property AST\n * @param errors - Array to collect errors\n */\n private validateProperty(property: PropertyAST, errors: ValidationError[]): void {\n const path = `contract.properties.${property.name}`;\n \n // Validate property name\n if (!property.name || property.name.trim().length === 0) {\n errors.push(new ValidationError(\n 'Property name cannot be empty',\n `${path}.name`\n ));\n }\n \n // Validate allows\n this.validateAllows(property.allows, `${path}.allows`, errors);\n \n // Validate default\n if (property.default) {\n this.validateDefault(property.default, property.allows, `${path}.default`, errors);\n }\n \n // Validate constraints\n if (property.constraints) {\n this.validateConstraints(property.constraints, property.allows, `${path}.constraints`, errors);\n }\n \n // Validate conflicts\n if (property.conflicts) {\n this.validateConflicts(property.conflicts, `${path}.conflicts`, errors);\n }\n }\n \n /**\n * Validate allows\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateAllows(allows: string[], path: string, errors: ValidationError[]): void {\n if (!allows || allows.length === 0) {\n errors.push(new ValidationError(\n 'Property must have at least one allowed token',\n path\n ));\n return;\n }\n \n // Check for duplicate tokens\n const tokenSet = new Set<string>();\n for (const token of allows) {\n if (tokenSet.has(token)) {\n errors.push(new ValidationError(\n `Duplicate allowed token: '${token}'`,\n path\n ));\n }\n tokenSet.add(token);\n \n // Validate token format\n this.validateTokenFormat(token, path, errors);\n }\n }\n \n /**\n * Validate default\n * @param defaultVal - Default token\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateDefault(defaultVal: string, allows: string[], path: string, errors: ValidationError[]): void {\n // Validate token format\n this.validateTokenFormat(defaultVal, path, errors);\n \n // Check if default is in allows\n if (!allows.includes(defaultVal)) {\n errors.push(new ValidationError(\n `Default token '${defaultVal}' is not in allowed tokens`,\n path\n ));\n }\n }\n \n /**\n * Validate constraints\n * @param constraints - Array of constraints\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateConstraints(constraints: ConstraintAST[], allows: string[], path: string, errors: ValidationError[]): void {\n if (!constraints || constraints.length === 0) {\n return;\n }\n \n // Check for duplicate contexts\n const contextSet = new Set<string>();\n for (const constraint of constraints) {\n if (contextSet.has(constraint.context)) {\n errors.push(new ValidationError(\n `Duplicate context: '${constraint.context}'`,\n `${path}.${constraint.context}`\n ));\n }\n contextSet.add(constraint.context);\n \n // Validate individual constraint\n this.validateConstraint(constraint, allows, `${path}.${constraint.context}`, errors);\n }\n }\n \n /**\n * Validate constraint\n * @param constraint - Constraint AST\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateConstraint(constraint: ConstraintAST, allows: string[], path: string, errors: ValidationError[]): void {\n // Validate context\n if (!this.validContexts.has(constraint.context)) {\n errors.push(new ValidationError(\n `Invalid context: '${constraint.context}'. Must be one of: ${Array.from(this.validContexts).join(', ')}`,\n `${path}.context`\n ));\n }\n \n // Validate allows\n if (!constraint.allows || constraint.allows.length === 0) {\n errors.push(new ValidationError(\n 'Constraint must have at least one allowed token',\n `${path}.allows`\n ));\n return;\n }\n \n // Check if constraint allows are subset of property allows\n for (const token of constraint.allows) {\n if (!allows.includes(token)) {\n errors.push(new ValidationError(\n `Constraint token '${token}' is not in property allowed tokens`,\n `${path}.allows`\n ));\n }\n \n // Validate token format\n this.validateTokenFormat(token, `${path}.allows`, errors);\n }\n }\n \n /**\n * Validate conflicts\n * @param conflicts - Array of conflicting properties\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateConflicts(conflicts: string[], path: string, errors: ValidationError[]): void {\n if (!conflicts || conflicts.length === 0) {\n return;\n }\n \n // Check for duplicate properties\n const propertySet = new Set<string>();\n for (const property of conflicts) {\n if (propertySet.has(property)) {\n errors.push(new ValidationError(\n `Duplicate conflicting property: '${property}'`,\n path\n ));\n }\n propertySet.add(property);\n \n // Validate property name format\n if (!property || property.trim().length === 0) {\n errors.push(new ValidationError(\n 'Conflicting property name cannot be empty',\n path\n ));\n }\n }\n }\n \n /**\n * Validate token format\n * @param token - Token to validate\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateTokenFormat(token: string, path: string, errors: ValidationError[]): void {\n if (!token || token.trim().length === 0) {\n errors.push(new ValidationError(\n 'Token cannot be empty',\n path\n ));\n return;\n }\n \n // Token should be in format: category.subcategory.value\n const parts = token.split('.');\n if (parts.length < 2) {\n errors.push(new ValidationError(\n `Invalid token format: '${token}'. Must be in format: 'category.subcategory.value'`,\n path\n ));\n }\n \n // Each part should be valid identifier\n for (const part of parts) {\n if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(part)) {\n errors.push(new ValidationError(\n `Invalid token part: '${part}'. Must start with a letter and contain only letters, digits, underscores, and hyphens.`,\n path\n ));\n }\n }\n }\n}","/**\n * Contract DSL Compiler\n * \n * Compiles Contract DSL AST to ComponentConstitution and StyleContractDefinition.\n * \n * Responsibilities:\n * - Compile AST to ComponentConstitution\n * - Generate StyleContractDefinition\n * - Provide compile errors\n * \n * Key Principles:\n * - DRY: Single compilation logic\n * - SOLID: Single responsibility\n * - YAGNI: Only compile what's needed\n * - DDD: Domain-specific compilation\n */\n\nimport type { ContractAST, PropertyAST, ConstraintAST } from './Parser';\nimport type { ComponentConstitution, StyleContractDefinition, StyleRule, StyleDomain } from '../domain/types';\n\n/**\n * CompileResult\n * Result of compilation.\n */\nexport interface CompileResult {\n readonly constitution: ComponentConstitution;\n readonly contract: StyleContractDefinition;\n readonly errors: string[];\n}\n\n/**\n * CompilerError\n * Error during compilation.\n */\nexport class CompilerError extends Error {\n readonly path: string;\n \n constructor(message: string, path: string) {\n super(message);\n this.name = 'CompilerError';\n this.path = path;\n }\n}\n\n/**\n * ContractDSLCompiler\n * Compiles Contract DSL AST to ComponentConstitution and StyleContractDefinition.\n */\nexport class ContractDSLCompiler {\n /**\n * Compile AST to ComponentConstitution and StyleContractDefinition\n * @param ast - Contract AST\n * @returns Compile result\n */\n compile(ast: ContractAST): CompileResult {\n const errors: string[] = [];\n \n // Compile to ComponentConstitution\n const constitution = this.compileToConstitution(ast, errors);\n \n // Compile to StyleContractDefinition\n const contract = this.compileToContractDefinition(ast, errors);\n \n return {\n constitution,\n contract,\n errors\n };\n }\n \n /**\n * Compile AST to ComponentConstitution\n * @param ast - Contract AST\n * @param errors - Array to collect errors\n * @returns ComponentConstitution\n */\n private compileToConstitution(ast: ContractAST, errors: string[]): ComponentConstitution {\n const rules: StyleRule[] = [];\n \n for (const property of ast.properties) {\n const rule = this.compilePropertyToRule(property, errors);\n rules.push(rule);\n }\n \n return {\n componentName: ast.name,\n rules\n };\n }\n \n /**\n * Compile property to StyleRule\n * @param property - Property AST\n * @param errors - Array to collect errors\n * @returns StyleRule\n */\n private compilePropertyToRule(property: PropertyAST, errors: string[]): StyleRule {\n return {\n property: property.name,\n domain: this.inferDomain(property.name, errors),\n allowedTokens: property.allows,\n conflictsWith: property.conflicts\n };\n }\n \n /**\n * Infer domain from property name\n * @param propertyName - Property name\n * @param errors - Array to collect errors\n * @returns Inferred domain\n */\n private inferDomain(propertyName: string, errors: string[]): StyleDomain {\n // Simple heuristic to infer domain from property name\n const layoutProperties = ['padding', 'margin', 'spacing', 'gap', 'width', 'height', 'radius', 'shadow'];\n const typographyProperties = ['size', 'weight', 'line-height', 'color', 'font'];\n const colorProperties = ['background', 'foreground', 'border', 'text', 'intent'];\n const effectProperties = ['opacity', 'blur', 'transform', 'transition', 'animation'];\n const interactionProperties = ['hover', 'active', 'focus', 'disabled', 'state'];\n \n if (layoutProperties.some(prop => propertyName.includes(prop))) {\n return 'layout';\n }\n \n if (typographyProperties.some(prop => propertyName.includes(prop))) {\n return 'typography';\n }\n \n if (colorProperties.some(prop => propertyName.includes(prop))) {\n return 'color';\n }\n \n if (effectProperties.some(prop => propertyName.includes(prop))) {\n return 'effect';\n }\n \n if (interactionProperties.some(prop => propertyName.includes(prop))) {\n return 'interaction';\n }\n \n // Default to layout if unknown\n errors.push(`Warning: Could not infer domain for property '${propertyName}', defaulting to 'layout'`);\n return 'layout';\n }\n \n /**\n * Compile AST to StyleContractDefinition\n * @param ast - Contract AST\n * @param errors - Array to collect errors\n * @returns StyleContractDefinition\n */\n private compileToContractDefinition(ast: ContractAST, errors: string[]): StyleContractDefinition {\n const contract: Record<string, string> = {};\n \n for (const property of ast.properties) {\n const defaultValue = property.default || property.allows[0];\n contract[property.name] = defaultValue;\n }\n \n return contract as StyleContractDefinition;\n }\n \n /**\n * Generate TypeScript code for ComponentConstitution\n * @param ast - Contract AST\n * @returns TypeScript code\n */\n generateConstitutionCode(ast: ContractAST): string {\n const lines: string[] = [];\n \n lines.push(`import type { ComponentConstitution } from '../domain/types';`);\n lines.push('');\n lines.push(`export const ${ast.name}Constitution: ComponentConstitution = {`);\n lines.push(` componentName: '${ast.name}',`);\n lines.push(` domain: '${ast.domain}',`);\n lines.push(` rules: [`);\n \n for (const property of ast.properties) {\n lines.push(` {`);\n lines.push(` property: '${property.name}',`);\n lines.push(` domain: '${this.inferDomain(property.name, [])}',`);\n lines.push(` allowedTokens: [${property.allows.map(t => `'${t}'`).join(', ')}],`);\n \n if (property.conflicts && property.conflicts.length > 0) {\n lines.push(` conflictsWith: [${property.conflicts.map(c => `'${c}'`).join(', ')}],`);\n }\n \n lines.push(` },`);\n }\n \n lines.push(` ]`);\n lines.push(`};`);\n \n return lines.join('\\n');\n }\n \n /**\n * Generate TypeScript code for StyleContractDefinition\n * @param ast - Contract AST\n * @returns TypeScript code\n */\n generateContractCode(ast: ContractAST): string {\n const lines: string[] = [];\n \n lines.push(`import type { StyleContractDefinition } from '../domain/types';`);\n lines.push('');\n lines.push(`export const ${ast.name}Contract: StyleContractDefinition = {`);\n \n for (const property of ast.properties) {\n const defaultValue = property.default || property.allows[0];\n lines.push(` ${property.name}: '${defaultValue}',`);\n }\n \n lines.push(`};`);\n \n return lines.join('\\n');\n }\n \n /**\n * Generate complete TypeScript file\n * @param ast - Contract AST\n * @returns TypeScript file content\n */\n generateTypeScriptFile(ast: ContractAST): string {\n const lines: string[] = [];\n \n lines.push(`/**`);\n lines.push(` * ${ast.name} Contract`);\n lines.push(` * Generated from Contract DSL`);\n lines.push(` */`);\n lines.push('');\n lines.push(this.generateConstitutionCode(ast));\n lines.push('');\n lines.push(this.generateContractCode(ast));\n \n return lines.join('\\n');\n }\n}","/**\n * CSS Materializer\n * \n * Converts semantic nodes to CSS output for web platform.\n * \n * Responsibilities:\n * - Map semantic → CSS property\n * - Map token → CSS value\n * - Map domain → CSS layer\n * - Generate CSS classes or variables\n * - Support responsive variants\n * \n * Key Principles:\n * - DRY: Single materialization logic\n * - SOLID: Single responsibility\n * - YAGNI: Only materialize what's needed\n * - DDD: Domain-specific CSS generation\n */\n\nimport type { Materializer, MaterializationContext, MaterializationResult } from './Materializer';\nimport type { SemanticNode } from '../domain/types';\n\n/**\n * CSSOutput\n * CSS output format.\n */\nexport interface CSSOutput {\n readonly classes: string;\n readonly variables: string;\n readonly inline: string;\n}\n\n/**\n * SemanticToCSSMapping\n * Mapping from semantic to CSS property.\n */\ninterface SemanticToCSSMapping {\n readonly [semantic: string]: string;\n}\n\n/**\n * CSSMaterializer\n * Materializes semantic nodes to CSS output.\n */\nexport class CSSMaterializer implements Materializer<CSSOutput> {\n private readonly semanticToCSS: SemanticToCSSMapping;\n \n constructor() {\n this.semanticToCSS = this.buildSemanticToCSSMapping();\n }\n \n /**\n * Materialize semantic nodes to CSS output\n * @param nodes - Resolved semantic nodes\n * @param context - Materialization context\n * @returns CSS output\n */\n materialize(\n nodes: readonly SemanticNode[],\n context: MaterializationContext\n ): MaterializationResult<CSSOutput> {\n const classes: string[] = [];\n const variables: string[] = [];\n const inline: string[] = [];\n \n for (const node of nodes) {\n const cssProperty = this.mapSemanticToCSS(node.semantic);\n const cssValue = this.mapTokenToCSS(node.tokenRef, context.theme);\n \n // Generate based on output format\n switch (context.outputFormat) {\n case 'class':\n classes.push(this.generateCSSClass(node.semantic, cssProperty, cssValue));\n break;\n case 'variable':\n variables.push(this.generateCSSVariable(node.tokenRef, cssValue));\n break;\n case 'inline':\n inline.push(this.generateInlineStyle(cssProperty, cssValue));\n break;\n }\n }\n \n return {\n output: {\n classes: classes.join('\\n'),\n variables: variables.join('\\n'),\n inline: inline.join('; ')\n },\n metadata: {\n platform: context.platform,\n theme: context.theme,\n device: context.device,\n format: context.outputFormat,\n timestamp: new Date().toISOString()\n }\n };\n }\n \n /**\n * Build semantic to CSS mapping\n * @returns Mapping object\n */\n private buildSemanticToCSSMapping(): SemanticToCSSMapping {\n return {\n // Spacing\n 'spacing.padding.small': 'padding',\n 'spacing.padding.medium': 'padding',\n 'spacing.padding.large': 'padding',\n 'spacing.margin.small': 'margin',\n 'spacing.margin.medium': 'margin',\n 'spacing.margin.large': 'margin',\n 'spacing.gap.small': 'gap',\n 'spacing.gap.medium': 'gap',\n 'spacing.gap.large': 'gap',\n \n // Color\n 'color.background.primary': 'background-color',\n 'color.background.secondary': 'background-color',\n 'color.background.tertiary': 'background-color',\n 'color.text.primary': 'color',\n 'color.text.secondary': 'color',\n 'color.text.tertiary': 'color',\n 'color.border.primary': 'border-color',\n 'color.border.secondary': 'border-color',\n \n // Typography\n 'typography.size.small': 'font-size',\n 'typography.size.base': 'font-size',\n 'typography.size.large': 'font-size',\n 'typography.weight.light': 'font-weight',\n 'typography.weight.normal': 'font-weight',\n 'typography.weight.bold': 'font-weight',\n 'typography.line-height.tight': 'line-height',\n 'typography.line-height.normal': 'line-height',\n 'typography.line-height.relaxed': 'line-height',\n \n // Effect\n 'effect.shadow.small': 'box-shadow',\n 'effect.shadow.medium': 'box-shadow',\n 'effect.shadow.large': 'box-shadow',\n 'effect.radius.small': 'border-radius',\n 'effect.radius.medium': 'border-radius',\n 'effect.radius.large': 'border-radius',\n 'effect.opacity.low': 'opacity',\n 'effect.opacity.medium': 'opacity',\n 'effect.opacity.high': 'opacity'\n };\n }\n \n /**\n * Map semantic to CSS property\n * @param semantic - Semantic string\n * @returns CSS property\n */\n private mapSemanticToCSS(semantic: string): string {\n const cssProperty = this.semanticToCSS[semantic];\n \n if (!cssProperty) {\n // Fallback: extract last part of semantic\n const parts = semantic.split('.');\n const lastPart = parts[parts.length - 1];\n \n // Map common patterns\n if (lastPart === 'small' || lastPart === 'medium' || lastPart === 'large') {\n return parts[parts.length - 2]; // e.g., padding, margin\n }\n \n return lastPart;\n }\n \n return cssProperty;\n }\n \n /**\n * Map token to CSS value\n * @param tokenRef - Token reference\n * @param theme - Theme\n * @returns CSS value\n */\n private mapTokenToCSS(tokenRef: string, theme: string): string {\n // In a real implementation, this would resolve the token from a token registry\n // For now, we'll use CSS variables as the default approach\n \n // Convert token reference to CSS variable name\n const cssVarName = tokenRef.replace(/\\./g, '-');\n \n // Add theme suffix if dark mode\n if (theme === 'dark') {\n return `var(--${cssVarName}-dark)`;\n }\n \n return `var(--${cssVarName})`;\n }\n \n /**\n * Generate CSS class\n * @param semantic - Semantic string\n * @param property - CSS property\n * @param value - CSS value\n * @returns CSS class string\n */\n private generateCSSClass(semantic: string, property: string, value: string): string {\n // Generate class name from semantic\n const className = this.generateClassName(semantic);\n \n return `.${className} { ${property}: ${value}; }`;\n }\n \n /**\n * Generate CSS variable\n * @param tokenRef - Token reference\n * @param value - CSS value\n * @returns CSS variable string\n */\n private generateCSSVariable(tokenRef: string, value: string): string {\n const varName = tokenRef.replace(/\\./g, '-');\n \n return `--${varName}: ${value};`;\n }\n \n /**\n * Generate inline style\n * @param property - CSS property\n * @param value - CSS value\n * @returns Inline style string\n */\n private generateInlineStyle(property: string, value: string): string {\n return `${property}: ${value}`;\n }\n \n /**\n * Generate class name from semantic\n * @param semantic - Semantic string\n * @returns Class name\n */\n private generateClassName(semantic: string): string {\n // Convert semantic to kebab-case class name\n return semantic\n .replace(/\\./g, '-')\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase();\n }\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,uBAAwB;;;AC8CjB,IAAM,YAAY;AAAA;AAAA,EAEvB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,aAAa;AAAA,EACb,WAAW;AAAA;AAAA,EAGX,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,QAAQ;AAA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AAI;","names":[]}
1
+ {"version":3,"sources":["../../../src/cli/index.ts","../../../src/cli/commands/init.ts","../../../src/cli/commands/compile.ts","../../../src/dsl/lexer/TokenizerError.ts","../../../src/dsl/lexer/Tokenizer.ts","../../../src/dsl/parser/ParserError.ts","../../../src/dsl/parser/Parser.ts","../../../src/dsl/validator/ValidationError.ts","../../../src/dsl/validator/Validator.ts","../../../src/dsl/compiler/Compiler.ts","../../../src/cli/commands/validate.ts","../../../src/cli/commands/generate-css.ts","../../../src/materializer/targets/CSSMaterializer.ts","../../../src/cli/commands/watch.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * MASE CLI Tool\n * \n * Command-line interface for Meta-Architecture Style Engine.\n * \n * Key Principles:\n * - DRY: Single CLI logic\n * - SOLID: Single responsibility\n * - YAGNI: Only implement what's needed\n * - DDD: Domain-specific CLI commands\n */\n\nimport { Command } from 'commander';\nimport { initCommand } from './commands/init';\nimport { compileCommand } from './commands/compile';\nimport { validateCommand } from './commands/validate';\nimport { generateCssCommand } from './commands/generate-css';\nimport { watchCommand } from './commands/watch';\n\nconst program = new Command();\n\nprogram\n .name('mase')\n .description('Meta-Architecture Style Engine CLI')\n .version('1.0.0');\n\n// Register Commands\nprogram.addCommand(initCommand);\nprogram.addCommand(compileCommand);\nprogram.addCommand(validateCommand);\nprogram.addCommand(generateCssCommand);\nprogram.addCommand(watchCommand);\n\n// Parse Arguments\nprogram.parse(process.argv);\n","import { Command } from 'commander';\n\nexport const initCommand = new Command('init')\n .description('Initialize a new project with MASE')\n .argument('[project-name]', 'Project name')\n .option('-t, --template <template>', 'Template to use (default, minimal, full)', 'default')\n .option('--typescript', 'Use TypeScript (default)', true)\n .option('--javascript', 'Use JavaScript')\n .action((projectName, options) => {\n console.log('Initializing MASE project...');\n console.log(`Project name: ${projectName || 'mase-project'}`);\n console.log(`Template: ${options.template}`);\n console.log(`TypeScript: ${options.typescript}`);\n console.log('✅ Project initialized successfully!');\n });\n","import { Command } from 'commander';\nimport { ContractDSLTokenizer, ContractDSLParser, ContractDSLValidator, ContractDSLCompiler } from '../../dsl';\nimport * as fs from 'fs';\n\nexport const compileCommand = new Command('compile')\n .description('Compile a contract DSL file to TypeScript')\n .argument('<contract-file>', 'Contract DSL file to compile')\n .option('-o, --output <file>', 'Output file (default: stdout)')\n .option('--format <format>', 'Output format (ts, json, ast)', 'ts')\n .option('--watch', 'Watch for changes', false)\n .action((contractFile, options) => {\n console.log(`Compiling ${contractFile}...`);\n \n try {\n // Read contract file\n const source = fs.readFileSync(contractFile, 'utf-8');\n \n // Tokenize\n const tokenizer = new ContractDSLTokenizer();\n const tokens = tokenizer.tokenize(source);\n \n // Parse\n const parser = new ContractDSLParser();\n const ast = parser.parse(tokens);\n \n // Validate\n const validator = new ContractDSLValidator();\n const validationResult = validator.validate(ast);\n \n if (!validationResult.isValid) {\n console.error('❌ Validation errors:');\n validationResult.errors.forEach(error => {\n console.error(` - ${error.path}: ${error.message}`);\n });\n process.exit(1);\n }\n \n // Compile\n const compiler = new ContractDSLCompiler();\n const result = compiler.compile(ast);\n \n if (result.errors.length > 0) {\n console.error('❌ Compilation errors:');\n result.errors.forEach(error => {\n console.error(` - ${error}`);\n });\n process.exit(1);\n }\n \n // Output based on format\n let output: string;\n \n switch (options.format) {\n case 'json':\n output = JSON.stringify(ast, null, 2);\n break;\n case 'ast':\n output = JSON.stringify(ast, null, 2);\n break;\n case 'ts':\n default:\n output = compiler.generateTypeScriptFile(ast);\n break;\n }\n \n if (options.output) {\n fs.writeFileSync(options.output, output, 'utf-8');\n console.log(`✅ Compiled to ${options.output}`);\n } else {\n console.log(output);\n }\n \n if (options.watch) {\n console.log('👀 Watching for changes...');\n // TODO: Implement watch mode\n }\n \n } catch (error) {\n console.error('❌ Error:', error);\n process.exit(1);\n }\n });\n","export class TokenizerError extends Error {\n readonly line: number;\n readonly column: number;\n \n constructor(message: string, line: number, column: number) {\n super(message);\n this.name = 'TokenizerError';\n this.line = line;\n this.column = column;\n }\n}\n","/**\n * Contract DSL Tokenizer\n * \n * Tokenizes Contract DSL source code into tokens for parsing.\n * \n * Responsibilities:\n * - Convert DSL source to tokens\n * - Handle whitespace and comments\n * - Provide error locations\n * \n * Key Principles:\n * - DRY: Single tokenization logic\n * - SOLID: Single responsibility\n * - YAGNI: Only tokenize what's needed\n * - DDD: Domain-specific token types\n */\n\n/**\n * TokenType\n * Enum of all token types in Contract DSL.\n */\nexport type TokenType =\n // Keywords\n | 'CONTRACT'\n | 'DOMAIN'\n | 'ALLOWS'\n | 'DEFAULT'\n | 'CONSTRAINTS'\n | 'CONFLICTS'\n \n // Contexts\n | 'MOBILE'\n | 'TABLET'\n | 'DESKTOP'\n | 'LIGHT'\n | 'DARK'\n | 'WEB'\n | 'NATIVE'\n | 'CANVAS'\n | 'DEFAULT_CTX'\n | 'HOVER'\n | 'ACTIVE'\n | 'DISABLED'\n \n // Domains\n | 'LAYOUT'\n | 'TYPOGRAPHY'\n | 'COLOR'\n | 'EFFECT'\n | 'INTERACTION'\n \n // Punctuation\n | 'LBRACE'\n | 'RBRACE'\n | 'LBRACKET'\n | 'RBRACKET'\n | 'COLON'\n | 'SEMICOLON'\n | 'COMMA'\n \n // Literals\n | 'IDENTIFIER'\n \n // Special\n | 'EOF'\n | 'UNKNOWN';\n\nexport const TokenType = {\n // Keywords\n CONTRACT: 'CONTRACT' as const,\n DOMAIN: 'DOMAIN' as const,\n ALLOWS: 'ALLOWS' as const,\n DEFAULT: 'DEFAULT' as const,\n CONSTRAINTS: 'CONSTRAINTS' as const,\n CONFLICTS: 'CONFLICTS' as const,\n \n // Contexts\n MOBILE: 'MOBILE' as const,\n TABLET: 'TABLET' as const,\n DESKTOP: 'DESKTOP' as const,\n LIGHT: 'LIGHT' as const,\n DARK: 'DARK' as const,\n WEB: 'WEB' as const,\n NATIVE: 'NATIVE' as const,\n CANVAS: 'CANVAS' as const,\n DEFAULT_CTX: 'DEFAULT_CTX' as const,\n HOVER: 'HOVER' as const,\n ACTIVE: 'ACTIVE' as const,\n DISABLED: 'DISABLED' as const,\n \n // Domains\n LAYOUT: 'LAYOUT' as const,\n TYPOGRAPHY: 'TYPOGRAPHY' as const,\n COLOR: 'COLOR' as const,\n EFFECT: 'EFFECT' as const,\n INTERACTION: 'INTERACTION' as const,\n \n // Punctuation\n LBRACE: 'LBRACE' as const,\n RBRACE: 'RBRACE' as const,\n LBRACKET: 'LBRACKET' as const,\n RBRACKET: 'RBRACKET' as const,\n COLON: 'COLON' as const,\n SEMICOLON: 'SEMICOLON' as const,\n COMMA: 'COMMA' as const,\n \n // Literals\n IDENTIFIER: 'IDENTIFIER' as const,\n \n // Special\n EOF: 'EOF' as const,\n UNKNOWN: 'UNKNOWN' as const\n};\n\n/**\n * Token\n * Represents a single token in the DSL.\n */\nexport interface Token {\n readonly type: TokenType;\n readonly value: string;\n readonly line: number;\n readonly column: number;\n}\n\nimport { TokenizerError } from './TokenizerError';\n\n/**\n * ContractDSLTokenizer\n * Tokenizes Contract DSL source code.\n */\nexport class ContractDSLTokenizer {\n private source: string = '';\n private position: number = 0;\n private line: number = 1;\n private column: number = 1;\n \n // Keyword map\n private readonly keywords: Map<string, TokenType> = new Map([\n ['contract', TokenType.CONTRACT],\n ['domain', TokenType.DOMAIN],\n ['allows', TokenType.ALLOWS],\n ['default', TokenType.DEFAULT],\n ['constraints', TokenType.CONSTRAINTS],\n ['conflicts', TokenType.CONFLICTS],\n \n // Contexts\n ['mobile', TokenType.MOBILE],\n ['tablet', TokenType.TABLET],\n ['desktop', TokenType.DESKTOP],\n ['light', TokenType.LIGHT],\n ['dark', TokenType.DARK],\n ['web', TokenType.WEB],\n ['native', TokenType.NATIVE],\n ['canvas', TokenType.CANVAS],\n // ['default', TokenType.DEFAULT_CTX], // Removed duplicate mapping\n ['hover', TokenType.HOVER],\n ['active', TokenType.ACTIVE],\n ['disabled', TokenType.DISABLED],\n \n // Domains\n ['layout', TokenType.LAYOUT],\n ['typography', TokenType.TYPOGRAPHY],\n ['color', TokenType.COLOR],\n ['effect', TokenType.EFFECT],\n ['interaction', TokenType.INTERACTION]\n ]);\n \n /**\n * Tokenize source code\n * @param source - DSL source code\n * @returns Array of tokens\n */\n tokenize(source: string): Token[] {\n this.source = source;\n this.position = 0;\n this.line = 1;\n this.column = 1;\n \n const tokens: Token[] = [];\n \n while (this.position < this.source.length) {\n const char = this.source[this.position];\n \n // Skip whitespace\n if (this.isWhitespace(char)) {\n this.advance();\n continue;\n }\n \n // Skip comments\n if (char === '/' && this.peek() === '/') {\n this.skipComment();\n continue;\n }\n \n // Tokenize\n const token = this.nextToken();\n if (token) {\n tokens.push(token);\n }\n }\n \n // Add EOF token\n tokens.push({\n type: TokenType.EOF,\n value: '',\n line: this.line,\n column: this.column\n });\n \n return tokens;\n }\n \n /**\n * Get next token\n * @returns Token or null if EOF\n */\n private nextToken(): Token | null {\n const char = this.source[this.position];\n \n // Punctuation\n if (char === '{') return this.createToken(TokenType.LBRACE, char);\n if (char === '}') return this.createToken(TokenType.RBRACE, char);\n if (char === '[') return this.createToken(TokenType.LBRACKET, char);\n if (char === ']') return this.createToken(TokenType.RBRACKET, char);\n if (char === ':') return this.createToken(TokenType.COLON, char);\n if (char === ';') return this.createToken(TokenType.SEMICOLON, char);\n if (char === ',') return this.createToken(TokenType.COMMA, char);\n \n // Identifier or keyword\n if (this.isLetter(char) || char === '_' || char === '-') {\n return this.readIdentifier();\n }\n \n // Unknown character\n throw new TokenizerError(\n `Unknown character: '${char}'`,\n this.line,\n this.column\n );\n }\n \n /**\n * Read identifier or keyword\n * @returns Token\n */\n private readIdentifier(): Token {\n const start = this.position;\n const startLine = this.line;\n const startColumn = this.column;\n \n while (\n this.position < this.source.length &&\n (this.isLetter(this.source[this.position]) ||\n this.isDigit(this.source[this.position]) ||\n this.source[this.position] === '_' ||\n this.source[this.position] === '-' ||\n this.source[this.position] === '.')\n ) {\n this.advance();\n }\n \n const value = this.source.substring(start, this.position);\n const type = this.keywords.get(value) || TokenType.IDENTIFIER;\n \n return {\n type,\n value,\n line: startLine,\n column: startColumn\n };\n }\n \n /**\n * Skip single-line comment\n */\n private skipComment(): void {\n while (this.position < this.source.length && this.source[this.position] !== '\\n') {\n this.advance();\n }\n }\n \n /**\n * Create token\n * @param type - Token type\n * @param value - Token value\n * @returns Token\n */\n private createToken(type: TokenType, value: string): Token {\n const token = {\n type,\n value,\n line: this.line,\n column: this.column\n };\n \n this.advance();\n return token;\n }\n \n /**\n * Advance to next character\n */\n private advance(): void {\n if (this.source[this.position] === '\\n') {\n this.line++;\n this.column = 1;\n } else {\n this.column++;\n }\n this.position++;\n }\n \n /**\n * Peek at next character\n * @returns Next character or empty string\n */\n private peek(): string {\n if (this.position + 1 < this.source.length) {\n return this.source[this.position + 1];\n }\n return '';\n }\n \n /**\n * Check if character is whitespace\n * @param char - Character to check\n * @returns True if whitespace\n */\n private isWhitespace(char: string): boolean {\n return char === ' ' || char === '\\t' || char === '\\n' || char === '\\r';\n }\n \n /**\n * Check if character is letter\n * @param char - Character to check\n * @returns True if letter\n */\n private isLetter(char: string): boolean {\n return /[a-zA-Z]/.test(char);\n }\n \n /**\n * Check if character is digit\n * @param char - Character to check\n * @returns True if digit\n */\n private isDigit(char: string): boolean {\n return /[0-9]/.test(char);\n }\n}","export class ParserError extends Error {\n readonly line: number;\n readonly column: number;\n \n constructor(message: string, line: number, column: number) {\n super(message);\n this.name = 'ParserError';\n this.line = line;\n this.column = column;\n }\n}\n","/**\n * Contract DSL Parser\n * \n * Parses tokens from Contract DSL into Abstract Syntax Tree (AST).\n * \n * Responsibilities:\n * - Parse tokens into AST\n * - Implement EBNF grammar\n * - Provide syntax errors\n * \n * Key Principles:\n * - DRY: Single parsing logic\n * - SOLID: Single responsibility\n * - YAGNI: Only parse what's needed\n * - DDD: Domain-specific AST structure\n */\n\nimport type { Token, TokenType } from '../lexer/Tokenizer';\nimport { TokenType as TT } from '../lexer/Tokenizer';\nimport { ParserError } from './ParserError';\n\n/**\n * ContractAST\n * Abstract Syntax Tree for a contract.\n */\nexport interface ContractAST {\n readonly name: string;\n readonly domain: string;\n readonly properties: PropertyAST[];\n}\n\n/**\n * PropertyAST\n * AST for a property declaration.\n */\nexport interface PropertyAST {\n readonly name: string;\n readonly allows: string[];\n readonly default?: string;\n readonly constraints?: ConstraintAST[];\n readonly conflicts?: string[];\n}\n\n/**\n * ConstraintAST\n * AST for a constraint declaration.\n */\nexport interface ConstraintAST {\n readonly context: string;\n readonly allows: string[];\n}\n\n/**\n * ContractDSLParser\n * Parses Contract DSL tokens into AST.\n */\nexport class ContractDSLParser {\n private tokens: Token[] = [];\n private position: number = 0;\n \n /**\n * Parse tokens into AST\n * @param tokens - Array of tokens\n * @returns Contract AST\n */\n parse(tokens: Token[]): ContractAST {\n this.tokens = tokens;\n this.position = 0;\n \n // Parse contract\n const contract = this.parseContract();\n \n // Expect EOF\n this.expect(TT.EOF);\n \n return contract;\n }\n \n /**\n * Parse contract\n * @returns Contract AST\n */\n private parseContract(): ContractAST {\n // Expect 'contract'\n this.expect(TT.CONTRACT);\n \n // Expect identifier (contract name)\n const name = this.expectIdentifier();\n \n // Expect '{'\n this.expect(TT.LBRACE);\n \n // Parse domain\n const domain = this.parseDomain();\n \n // Parse properties\n const properties: PropertyAST[] = [];\n while (this.peek()?.type === TT.IDENTIFIER) {\n properties.push(this.parseProperty());\n }\n \n // Expect '}'\n this.expect(TT.RBRACE);\n \n return {\n name,\n domain,\n properties\n };\n }\n \n /**\n * Parse domain declaration\n * @returns Domain name\n */\n private parseDomain(): string {\n // Expect 'domain'\n this.expect(TT.DOMAIN);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect domain identifier\n const domain = this.expectDomain();\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return domain;\n }\n \n /**\n * Parse property declaration\n * @returns Property AST\n */\n private parseProperty(): PropertyAST {\n // Expect identifier (property name)\n const name = this.expectIdentifier();\n \n // Expect '{'\n this.expect(TT.LBRACE);\n \n // Parse property body\n const allows = this.parseAllows();\n const defaultVal = this.parseDefault();\n const constraints = this.parseConstraints();\n const conflicts = this.parseConflicts();\n \n // Expect '}'\n this.expect(TT.RBRACE);\n \n return {\n name,\n allows,\n default: defaultVal,\n constraints,\n conflicts\n };\n }\n \n /**\n * Parse allows declaration\n * @returns Array of allowed tokens\n */\n private parseAllows(): string[] {\n // Expect 'allows'\n this.expect(TT.ALLOWS);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect '['\n this.expect(TT.LBRACKET);\n \n // Parse token list\n const tokens: string[] = [];\n if (this.peek()?.type === TT.IDENTIFIER) {\n tokens.push(this.expectIdentifier());\n \n while (this.peek()?.type === TT.COMMA) {\n this.expect(TT.COMMA);\n tokens.push(this.expectIdentifier());\n }\n }\n \n // Expect ']'\n this.expect(TT.RBRACKET);\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return tokens;\n }\n \n /**\n * Parse default declaration\n * @returns Default token or undefined\n */\n private parseDefault(): string | undefined {\n // Check if 'default' keyword\n if (this.peek()?.type !== TT.DEFAULT) {\n return undefined;\n }\n \n // Expect 'default'\n this.expect(TT.DEFAULT);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect identifier\n const value = this.expectIdentifier();\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return value;\n }\n \n /**\n * Parse constraints declaration\n * @returns Array of constraints or undefined\n */\n private parseConstraints(): ConstraintAST[] | undefined {\n // Check if 'constraints' keyword\n if (this.peek()?.type !== TT.CONSTRAINTS) {\n return undefined;\n }\n \n // Expect 'constraints'\n this.expect(TT.CONSTRAINTS);\n \n // Expect '{'\n this.expect(TT.LBRACE);\n \n // Parse constraint list\n const constraints: ConstraintAST[] = [];\n while (this.peek()?.type === TT.MOBILE || \n this.peek()?.type === TT.TABLET || \n this.peek()?.type === TT.DESKTOP ||\n this.peek()?.type === TT.LIGHT || \n this.peek()?.type === TT.DARK ||\n this.peek()?.type === TT.WEB || \n this.peek()?.type === TT.NATIVE ||\n this.peek()?.type === TT.CANVAS ||\n this.peek()?.type === TT.DEFAULT_CTX ||\n this.peek()?.type === TT.HOVER || \n this.peek()?.type === TT.ACTIVE ||\n this.peek()?.type === TT.DISABLED) {\n constraints.push(this.parseConstraint());\n }\n \n // Expect '}'\n this.expect(TT.RBRACE);\n \n return constraints;\n }\n \n /**\n * Parse constraint\n * @returns Constraint AST\n */\n private parseConstraint(): ConstraintAST {\n // Expect context\n const context = this.expectContext();\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect '['\n this.expect(TT.LBRACKET);\n \n // Parse token list\n const tokens: string[] = [];\n if (this.peek()?.type === TT.IDENTIFIER) {\n tokens.push(this.expectIdentifier());\n \n while (this.peek()?.type === TT.COMMA) {\n this.expect(TT.COMMA);\n tokens.push(this.expectIdentifier());\n }\n }\n \n // Expect ']'\n this.expect(TT.RBRACKET);\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return {\n context,\n allows: tokens\n };\n }\n \n /**\n * Parse conflicts declaration\n * @returns Array of conflicting properties or undefined\n */\n private parseConflicts(): string[] | undefined {\n // Check if 'conflicts' keyword\n if (this.peek()?.type !== TT.CONFLICTS) {\n return undefined;\n }\n \n // Expect 'conflicts'\n this.expect(TT.CONFLICTS);\n \n // Expect ':'\n this.expect(TT.COLON);\n \n // Expect '['\n this.expect(TT.LBRACKET);\n \n // Parse property list\n const properties: string[] = [];\n if (this.peek()?.type === TT.IDENTIFIER) {\n properties.push(this.expectIdentifier());\n \n while (this.peek()?.type === TT.COMMA) {\n this.expect(TT.COMMA);\n properties.push(this.expectIdentifier());\n }\n }\n \n // Expect ']'\n this.expect(TT.RBRACKET);\n \n // Expect ';'\n this.expect(TT.SEMICOLON);\n \n return properties;\n }\n \n /**\n * Expect identifier token\n * @returns Identifier value\n */\n private expectIdentifier(): string {\n const token = this.peek();\n if (!token || token.type !== TT.IDENTIFIER) {\n throw new ParserError(\n `Expected identifier, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n return token.value;\n }\n \n /**\n * Expect domain token\n * @returns Domain value\n */\n private expectDomain(): string {\n const token = this.peek();\n if (!token || \n (token.type !== TT.LAYOUT && \n token.type !== TT.TYPOGRAPHY && \n token.type !== TT.COLOR &&\n token.type !== TT.EFFECT &&\n token.type !== TT.INTERACTION &&\n token.type !== TT.IDENTIFIER)) {\n throw new ParserError(\n `Expected domain, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n return token.value;\n }\n\n /**\n * Expect context token\n * @returns Context value\n */\n private expectContext(): string {\n const token = this.peek();\n if (!token || \n (token.type !== TT.MOBILE && \n token.type !== TT.TABLET && \n token.type !== TT.DESKTOP &&\n token.type !== TT.LIGHT && \n token.type !== TT.DARK &&\n token.type !== TT.WEB && \n token.type !== TT.NATIVE &&\n token.type !== TT.CANVAS &&\n token.type !== TT.DEFAULT_CTX &&\n token.type !== TT.DEFAULT &&\n token.type !== TT.HOVER && \n token.type !== TT.ACTIVE &&\n token.type !== TT.DISABLED)) {\n throw new ParserError(\n `Expected context, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n return token.value;\n }\n \n /**\n * Expect specific token type\n * @param type - Expected token type\n */\n private expect(type: TokenType): void {\n const token = this.peek();\n if (!token || token.type !== type) {\n throw new ParserError(\n `Expected ${type}, got ${token?.type || 'EOF'}`,\n token?.line || 0,\n token?.column || 0\n );\n }\n \n this.advance();\n }\n \n /**\n * Peek at current token\n * @returns Current token or undefined\n */\n private peek(): Token | undefined {\n return this.tokens[this.position];\n }\n \n /**\n * Advance to next token\n */\n private advance(): void {\n this.position++;\n }\n}","export class ValidationError extends Error {\n readonly path: string;\n \n constructor(message: string, path: string) {\n super(message);\n this.name = 'ValidationError';\n this.path = path;\n }\n}\n","/**\n * Contract DSL Validator\n * \n * Validates Contract DSL AST structure and semantics.\n * \n * Responsibilities:\n * - Validate AST structure\n * - Check token references\n * - Validate constraints\n * \n * Key Principles:\n * - DRY: Single validation logic\n * - SOLID: Single responsibility\n * - YAGNI: Only validate what's needed\n * - DDD: Domain-specific validation rules\n */\n\nimport type { ContractAST, PropertyAST, ConstraintAST } from '../parser/Parser';\nimport type { StyleDomain } from '../../domain';\nimport { ValidationError } from './ValidationError';\n\n/**\n * ValidationResult\n * Result of validation.\n */\nexport interface ValidationResult {\n readonly isValid: boolean;\n readonly errors: ValidationError[];\n}\n\n/**\n * ContractDSLValidator\n * Validates Contract DSL AST.\n */\nexport class ContractDSLValidator {\n private readonly validDomains: Set<StyleDomain> = new Set([\n 'layout',\n 'typography',\n 'color',\n 'effect',\n 'interaction'\n ]);\n \n private readonly validContexts: Set<string> = new Set([\n 'mobile',\n 'tablet',\n 'desktop',\n 'light',\n 'dark',\n 'web',\n 'native',\n 'canvas',\n 'default',\n 'hover',\n 'active',\n 'disabled'\n ]);\n \n /**\n * Validate contract AST\n * @param ast - Contract AST\n * @returns Validation result\n */\n validate(ast: ContractAST): ValidationResult {\n const errors: ValidationError[] = [];\n \n // Validate contract name\n this.validateContractName(ast.name, errors);\n \n // Validate domain\n this.validateDomain(ast.domain, errors);\n \n // Validate properties\n this.validateProperties(ast.properties, errors);\n \n return {\n isValid: errors.length === 0,\n errors\n };\n }\n \n /**\n * Validate contract name\n * @param name - Contract name\n * @param errors - Array to collect errors\n */\n private validateContractName(name: string, errors: ValidationError[]): void {\n if (!name || name.trim().length === 0) {\n errors.push(new ValidationError(\n 'Contract name cannot be empty',\n 'contract.name'\n ));\n }\n \n if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name)) {\n errors.push(new ValidationError(\n `Invalid contract name: '${name}'. Must start with a letter and contain only letters, digits, underscores, and hyphens.`,\n 'contract.name'\n ));\n }\n }\n \n /**\n * Validate domain\n * @param domain - Domain name\n * @param errors - Array to collect errors\n */\n private validateDomain(domain: string, errors: ValidationError[]): void {\n if (!domain || domain.trim().length === 0) {\n errors.push(new ValidationError(\n 'Domain cannot be empty',\n 'contract.domain'\n ));\n return;\n }\n \n if (!this.validDomains.has(domain as StyleDomain)) {\n errors.push(new ValidationError(\n `Invalid domain: '${domain}'. Must be one of: ${Array.from(this.validDomains).join(', ')}`,\n 'contract.domain'\n ));\n }\n }\n \n /**\n * Validate properties\n * @param properties - Array of properties\n * @param errors - Array to collect errors\n */\n private validateProperties(properties: PropertyAST[], errors: ValidationError[]): void {\n if (!properties || properties.length === 0) {\n errors.push(new ValidationError(\n 'Contract must have at least one property',\n 'contract.properties'\n ));\n return;\n }\n \n // Check for duplicate property names\n const propertyNames = new Set<string>();\n for (const property of properties) {\n if (propertyNames.has(property.name)) {\n errors.push(new ValidationError(\n `Duplicate property name: '${property.name}'`,\n `contract.properties.${property.name}`\n ));\n }\n propertyNames.add(property.name);\n \n // Validate individual property\n this.validateProperty(property, errors);\n }\n }\n \n /**\n * Validate property\n * @param property - Property AST\n * @param errors - Array to collect errors\n */\n private validateProperty(property: PropertyAST, errors: ValidationError[]): void {\n const path = `contract.properties.${property.name}`;\n \n // Validate property name\n if (!property.name || property.name.trim().length === 0) {\n errors.push(new ValidationError(\n 'Property name cannot be empty',\n `${path}.name`\n ));\n }\n \n // Validate allows\n this.validateAllows(property.allows, `${path}.allows`, errors);\n \n // Validate default\n if (property.default) {\n this.validateDefault(property.default, property.allows, `${path}.default`, errors);\n }\n \n // Validate constraints\n if (property.constraints) {\n this.validateConstraints(property.constraints, property.allows, `${path}.constraints`, errors);\n }\n \n // Validate conflicts\n if (property.conflicts) {\n this.validateConflicts(property.conflicts, `${path}.conflicts`, errors);\n }\n }\n \n /**\n * Validate allows\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateAllows(allows: string[], path: string, errors: ValidationError[]): void {\n if (!allows || allows.length === 0) {\n errors.push(new ValidationError(\n 'Property must have at least one allowed token',\n path\n ));\n return;\n }\n \n // Check for duplicate tokens\n const tokenSet = new Set<string>();\n for (const token of allows) {\n if (tokenSet.has(token)) {\n errors.push(new ValidationError(\n `Duplicate allowed token: '${token}'`,\n path\n ));\n }\n tokenSet.add(token);\n \n // Validate token format\n this.validateTokenFormat(token, path, errors);\n }\n }\n \n /**\n * Validate default\n * @param defaultVal - Default token\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateDefault(defaultVal: string, allows: string[], path: string, errors: ValidationError[]): void {\n // Validate token format\n this.validateTokenFormat(defaultVal, path, errors);\n \n // Check if default is in allows\n if (!allows.includes(defaultVal)) {\n errors.push(new ValidationError(\n `Default token '${defaultVal}' is not in allowed tokens`,\n path\n ));\n }\n }\n \n /**\n * Validate constraints\n * @param constraints - Array of constraints\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateConstraints(constraints: ConstraintAST[], allows: string[], path: string, errors: ValidationError[]): void {\n if (!constraints || constraints.length === 0) {\n return;\n }\n \n // Check for duplicate contexts\n const contextSet = new Set<string>();\n for (const constraint of constraints) {\n if (contextSet.has(constraint.context)) {\n errors.push(new ValidationError(\n `Duplicate context: '${constraint.context}'`,\n `${path}.${constraint.context}`\n ));\n }\n contextSet.add(constraint.context);\n \n // Validate individual constraint\n this.validateConstraint(constraint, allows, `${path}.${constraint.context}`, errors);\n }\n }\n \n /**\n * Validate constraint\n * @param constraint - Constraint AST\n * @param allows - Array of allowed tokens\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateConstraint(constraint: ConstraintAST, allows: string[], path: string, errors: ValidationError[]): void {\n // Validate context\n if (!this.validContexts.has(constraint.context)) {\n errors.push(new ValidationError(\n `Invalid context: '${constraint.context}'. Must be one of: ${Array.from(this.validContexts).join(', ')}`,\n `${path}.context`\n ));\n }\n \n // Validate allows\n if (!constraint.allows || constraint.allows.length === 0) {\n errors.push(new ValidationError(\n 'Constraint must have at least one allowed token',\n `${path}.allows`\n ));\n return;\n }\n \n // Check if constraint allows are subset of property allows\n for (const token of constraint.allows) {\n if (!allows.includes(token)) {\n errors.push(new ValidationError(\n `Constraint token '${token}' is not in property allowed tokens`,\n `${path}.allows`\n ));\n }\n \n // Validate token format\n this.validateTokenFormat(token, `${path}.allows`, errors);\n }\n }\n \n /**\n * Validate conflicts\n * @param conflicts - Array of conflicting properties\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateConflicts(conflicts: string[], path: string, errors: ValidationError[]): void {\n if (!conflicts || conflicts.length === 0) {\n return;\n }\n \n // Check for duplicate properties\n const propertySet = new Set<string>();\n for (const property of conflicts) {\n if (propertySet.has(property)) {\n errors.push(new ValidationError(\n `Duplicate conflicting property: '${property}'`,\n path\n ));\n }\n propertySet.add(property);\n \n // Validate property name format\n if (!property || property.trim().length === 0) {\n errors.push(new ValidationError(\n 'Conflicting property name cannot be empty',\n path\n ));\n }\n }\n }\n \n /**\n * Validate token format\n * @param token - Token to validate\n * @param path - Path for error reporting\n * @param errors - Array to collect errors\n */\n private validateTokenFormat(token: string, path: string, errors: ValidationError[]): void {\n if (!token || token.trim().length === 0) {\n errors.push(new ValidationError(\n 'Token cannot be empty',\n path\n ));\n return;\n }\n \n // Token should be in format: category.subcategory.value\n const parts = token.split('.');\n if (parts.length < 2) {\n errors.push(new ValidationError(\n `Invalid token format: '${token}'. Must be in format: 'category.subcategory.value'`,\n path\n ));\n }\n \n // Each part should be valid identifier\n for (const part of parts) {\n if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(part)) {\n errors.push(new ValidationError(\n `Invalid token part: '${part}'. Must start with a letter and contain only letters, digits, underscores, and hyphens.`,\n path\n ));\n }\n }\n }\n}","/**\n * Contract DSL Compiler\n * \n * Compiles Contract DSL AST to ComponentConstitution and StyleContractDefinition.\n * \n * Responsibilities:\n * - Compile AST to ComponentConstitution\n * - Generate StyleContractDefinition\n * - Provide compile errors\n * \n * Key Principles:\n * - DRY: Single compilation logic\n * - SOLID: Single responsibility\n * - YAGNI: Only compile what's needed\n * - DDD: Domain-specific compilation\n */\n\nimport type { ContractAST, PropertyAST, ConstraintAST } from '../parser/Parser';\nimport type { ComponentConstitution, StyleContractDefinition, StyleRule, StyleDomain } from '../../domain';\nimport { CompilerError } from './CompilerError';\n\n/**\n * CompileResult\n * Result of compilation.\n */\nexport interface CompileResult {\n readonly constitution: ComponentConstitution;\n readonly contract: StyleContractDefinition;\n readonly errors: string[];\n}\n\n/**\n * ContractDSLCompiler\n * Compiles Contract DSL AST to ComponentConstitution and StyleContractDefinition.\n */\nexport class ContractDSLCompiler {\n /**\n * Compile AST to ComponentConstitution and StyleContractDefinition\n * @param ast - Contract AST\n * @returns Compile result\n */\n compile(ast: ContractAST): CompileResult {\n const errors: string[] = [];\n \n // Compile to ComponentConstitution\n const constitution = this.compileToConstitution(ast, errors);\n \n // Compile to StyleContractDefinition\n const contract = this.compileToContractDefinition(ast, errors);\n \n return {\n constitution,\n contract,\n errors\n };\n }\n \n /**\n * Compile AST to ComponentConstitution\n * @param ast - Contract AST\n * @param errors - Array to collect errors\n * @returns ComponentConstitution\n */\n private compileToConstitution(ast: ContractAST, errors: string[]): ComponentConstitution {\n const rules: StyleRule[] = [];\n \n for (const property of ast.properties) {\n const rule = this.compilePropertyToRule(property, errors);\n rules.push(rule);\n }\n \n return {\n componentName: ast.name,\n rules\n };\n }\n \n /**\n * Compile property to StyleRule\n * @param property - Property AST\n * @param errors - Array to collect errors\n * @returns StyleRule\n */\n private compilePropertyToRule(property: PropertyAST, errors: string[]): StyleRule {\n return {\n property: property.name,\n domain: this.inferDomain(property.name, errors),\n allowedTokens: property.allows,\n conflictsWith: property.conflicts\n };\n }\n \n /**\n * Infer domain from property name\n * @param propertyName - Property name\n * @param errors - Array to collect errors\n * @returns Inferred domain\n */\n private inferDomain(propertyName: string, errors: string[]): StyleDomain {\n // Simple heuristic to infer domain from property name\n const layoutProperties = ['padding', 'margin', 'spacing', 'gap', 'width', 'height', 'radius', 'shadow'];\n const typographyProperties = ['size', 'weight', 'line-height', 'color', 'font'];\n const colorProperties = ['background', 'foreground', 'border', 'text', 'intent'];\n const effectProperties = ['opacity', 'blur', 'transform', 'transition', 'animation'];\n const interactionProperties = ['hover', 'active', 'focus', 'disabled', 'state'];\n \n if (layoutProperties.some(prop => propertyName.includes(prop))) {\n return 'layout';\n }\n \n if (typographyProperties.some(prop => propertyName.includes(prop))) {\n return 'typography';\n }\n \n if (colorProperties.some(prop => propertyName.includes(prop))) {\n return 'color';\n }\n \n if (effectProperties.some(prop => propertyName.includes(prop))) {\n return 'effect';\n }\n \n if (interactionProperties.some(prop => propertyName.includes(prop))) {\n return 'interaction';\n }\n \n // Default to layout if unknown\n errors.push(`Warning: Could not infer domain for property '${propertyName}', defaulting to 'layout'`);\n return 'layout';\n }\n \n /**\n * Compile AST to StyleContractDefinition\n * @param ast - Contract AST\n * @param errors - Array to collect errors\n * @returns StyleContractDefinition\n */\n private compileToContractDefinition(ast: ContractAST, errors: string[]): StyleContractDefinition {\n const contract: Record<string, string> = {};\n \n for (const property of ast.properties) {\n const defaultValue = property.default || property.allows[0];\n contract[property.name] = defaultValue;\n }\n \n return contract as StyleContractDefinition;\n }\n \n /**\n * Generate TypeScript code for ComponentConstitution\n * @param ast - Contract AST\n * @returns TypeScript code\n */\n generateConstitutionCode(ast: ContractAST): string {\n const lines: string[] = [];\n \n lines.push(`import type { ComponentConstitution } from '../domain/types';`);\n lines.push('');\n lines.push(`export const ${ast.name}Constitution: ComponentConstitution = {`);\n lines.push(` componentName: '${ast.name}',`);\n lines.push(` domain: '${ast.domain}',`);\n lines.push(` rules: [`);\n \n for (const property of ast.properties) {\n lines.push(` {`);\n lines.push(` property: '${property.name}',`);\n lines.push(` domain: '${this.inferDomain(property.name, [])}',`);\n lines.push(` allowedTokens: [${property.allows.map((t: string) => `'${t}'`).join(', ')}],`);\n \n if (property.conflicts && property.conflicts.length > 0) {\n lines.push(` conflictsWith: [${property.conflicts.map((c: string) => `'${c}'`).join(', ')}],`);\n }\n \n lines.push(` },`);\n }\n \n lines.push(` ]`);\n lines.push(`};`);\n \n return lines.join('\\n');\n }\n \n /**\n * Generate TypeScript code for StyleContractDefinition\n * @param ast - Contract AST\n * @returns TypeScript code\n */\n generateContractCode(ast: ContractAST): string {\n const lines: string[] = [];\n \n lines.push(`import type { StyleContractDefinition } from '../domain/types';`);\n lines.push('');\n lines.push(`export const ${ast.name}Contract: StyleContractDefinition = {`);\n \n for (const property of ast.properties) {\n const defaultValue = property.default || property.allows[0];\n lines.push(` ${property.name}: '${defaultValue}',`);\n }\n \n lines.push(`};`);\n \n return lines.join('\\n');\n }\n \n /**\n * Generate complete TypeScript file\n * @param ast - Contract AST\n * @returns TypeScript file content\n */\n generateTypeScriptFile(ast: ContractAST): string {\n const lines: string[] = [];\n \n lines.push(`/**`);\n lines.push(` * ${ast.name} Contract`);\n lines.push(` * Generated from Contract DSL`);\n lines.push(` */`);\n lines.push('');\n lines.push(this.generateConstitutionCode(ast));\n lines.push('');\n lines.push(this.generateContractCode(ast));\n \n return lines.join('\\n');\n }\n}","import { Command } from 'commander';\nimport { ContractDSLTokenizer, ContractDSLParser, ContractDSLValidator } from '../../dsl';\nimport * as fs from 'fs';\n\nexport const validateCommand = new Command('validate')\n .description('Validate a contract DSL file')\n .argument('<contract-file>', 'Contract DSL file to validate')\n .option('--strict', 'Enable strict validation', false)\n .option('--fix', 'Auto-fix issues', false)\n .option('--watch', 'Watch for changes', false)\n .action((contractFile, options) => {\n console.log(`Validating ${contractFile}...`);\n \n try {\n // Read contract file\n const source = fs.readFileSync(contractFile, 'utf-8');\n \n // Tokenize\n const tokenizer = new ContractDSLTokenizer();\n const tokens = tokenizer.tokenize(source);\n \n // Parse\n const parser = new ContractDSLParser();\n const ast = parser.parse(tokens);\n \n // Validate\n const validator = new ContractDSLValidator();\n const validationResult = validator.validate(ast);\n \n if (validationResult.isValid) {\n console.log('✅ Contract is valid!');\n } else {\n console.error('❌ Validation errors:');\n validationResult.errors.forEach(error => {\n console.error(` - ${error.path}: ${error.message}`);\n });\n process.exit(1);\n }\n \n if (options.watch) {\n console.log('👀 Watching for changes...');\n // TODO: Implement watch mode\n }\n \n } catch (error) {\n console.error('❌ Error:', error);\n process.exit(1);\n }\n });\n","import { Command } from 'commander';\nimport { ContractDSLTokenizer, ContractDSLParser, ContractDSLValidator, ContractDSLCompiler } from '../../dsl';\nimport { CSSMaterializer } from '../../materializer';\nimport * as fs from 'fs';\n\nexport const generateCssCommand = new Command('generate-css')\n .description('Generate CSS from a contract DSL file')\n .argument('<contract-file>', 'Contract DSL file to generate CSS from')\n .option('-o, --output <file>', 'Output file (default: stdout)')\n .option('--format <format>', 'Output format (class, variable, inline)', 'class')\n .option('--theme <theme>', 'Theme (light, dark)', 'light')\n .option('--device <device>', 'Device (mobile, tablet, desktop)', 'desktop')\n .action((contractFile, options) => {\n console.log(`Generating CSS from ${contractFile}...`);\n \n try {\n // Read contract file\n const source = fs.readFileSync(contractFile, 'utf-8');\n \n // Tokenize\n const tokenizer = new ContractDSLTokenizer();\n const tokens = tokenizer.tokenize(source);\n \n // Parse\n const parser = new ContractDSLParser();\n const ast = parser.parse(tokens);\n \n // Validate\n const validator = new ContractDSLValidator();\n const validationResult = validator.validate(ast);\n \n if (!validationResult.isValid) {\n console.error('❌ Validation errors:');\n validationResult.errors.forEach(error => {\n console.error(` - ${error.path}: ${error.message}`);\n });\n process.exit(1);\n }\n \n // Compile\n const compiler = new ContractDSLCompiler();\n const result = compiler.compile(ast);\n \n // Materialize to CSS\n const materializer = new CSSMaterializer();\n const cssResult = materializer.materialize(\n result.constitution.rules.map(rule => ({\n domain: rule.domain,\n semantic: rule.property,\n tokenRef: rule.allowedTokens[0]\n })),\n {\n platform: 'web',\n theme: options.theme as 'light' | 'dark',\n device: options.device as 'mobile' | 'tablet' | 'desktop',\n outputFormat: options.format as 'class' | 'variable' | 'inline'\n }\n );\n \n // Output based on format\n let output: string;\n \n switch (options.format) {\n case 'variable':\n output = cssResult.output.variables;\n break;\n case 'inline':\n output = cssResult.output.inline;\n break;\n case 'class':\n default:\n output = cssResult.output.classes;\n break;\n }\n \n if (options.output) {\n fs.writeFileSync(options.output, output, 'utf-8');\n console.log(`✅ CSS generated to ${options.output}`);\n } else {\n console.log(output);\n }\n \n } catch (error) {\n console.error('❌ Error:', error);\n process.exit(1);\n }\n });\n","/**\n * CSS Materializer\n * \n * Converts semantic nodes to CSS output for web platform.\n * \n * Responsibilities:\n * - Map semantic → CSS property\n * - Map token → CSS value\n * - Map domain → CSS layer\n * - Generate CSS classes or variables\n * - Support responsive variants\n * \n * Key Principles:\n * - DRY: Single materialization logic\n * - SOLID: Single responsibility\n * - YAGNI: Only materialize what's needed\n * - DDD: Domain-specific CSS generation\n */\n\nimport type { Materializer, MaterializationContext, MaterializationResult } from '../core/Materializer';\nimport type { SemanticNode } from '../../domain';\nimport { MaterializationError } from '../core/MaterializationError';\n\n/**\n * CSSOutput\n * CSS output format.\n */\nexport interface CSSOutput {\n readonly classes: string;\n readonly variables: string;\n readonly inline: string;\n}\n\n/**\n * SemanticToCSSMapping\n * Mapping from semantic to CSS property.\n */\ninterface SemanticToCSSMapping {\n readonly [semantic: string]: string;\n}\n\n/**\n * CSSMaterializer\n * Materializes semantic nodes to CSS output.\n */\nexport class CSSMaterializer implements Materializer<CSSOutput> {\n private readonly semanticToCSS: SemanticToCSSMapping;\n \n constructor() {\n this.semanticToCSS = this.buildSemanticToCSSMapping();\n }\n \n /**\n * Materialize semantic nodes to CSS output\n * @param nodes - Resolved semantic nodes\n * @param context - Materialization context\n * @returns CSS output\n */\n materialize(\n nodes: readonly SemanticNode[],\n context: MaterializationContext\n ): MaterializationResult<CSSOutput> {\n const classes: string[] = [];\n const variables: string[] = [];\n const inline: string[] = [];\n \n for (const node of nodes) {\n const cssProperty = this.mapSemanticToCSS(node.semantic);\n const cssValue = this.mapTokenToCSS(node.tokenRef, context.theme);\n \n // Generate based on output format\n switch (context.outputFormat) {\n case 'class':\n classes.push(this.generateCSSClass(node.semantic, cssProperty, cssValue));\n break;\n case 'variable':\n variables.push(this.generateCSSVariable(node.tokenRef, cssValue));\n break;\n case 'inline':\n inline.push(this.generateInlineStyle(cssProperty, cssValue));\n break;\n }\n }\n \n return {\n output: {\n classes: classes.join('\\n'),\n variables: variables.join('\\n'),\n inline: inline.join('; ')\n },\n metadata: {\n platform: context.platform,\n theme: context.theme,\n device: context.device,\n format: context.outputFormat,\n timestamp: new Date().toISOString()\n }\n };\n }\n \n /**\n * Build semantic to CSS mapping\n * @returns Mapping object\n */\n private buildSemanticToCSSMapping(): SemanticToCSSMapping {\n return {\n // Spacing\n 'spacing.padding.small': 'padding',\n 'spacing.padding.medium': 'padding',\n 'spacing.padding.large': 'padding',\n 'spacing.margin.small': 'margin',\n 'spacing.margin.medium': 'margin',\n 'spacing.margin.large': 'margin',\n 'spacing.gap.small': 'gap',\n 'spacing.gap.medium': 'gap',\n 'spacing.gap.large': 'gap',\n \n // Color\n 'color.background.primary': 'background-color',\n 'color.background.secondary': 'background-color',\n 'color.background.tertiary': 'background-color',\n 'color.text.primary': 'color',\n 'color.text.secondary': 'color',\n 'color.text.tertiary': 'color',\n 'color.border.primary': 'border-color',\n 'color.border.secondary': 'border-color',\n \n // Typography\n 'typography.size.small': 'font-size',\n 'typography.size.base': 'font-size',\n 'typography.size.large': 'font-size',\n 'typography.weight.light': 'font-weight',\n 'typography.weight.normal': 'font-weight',\n 'typography.weight.bold': 'font-weight',\n 'typography.line-height.tight': 'line-height',\n 'typography.line-height.normal': 'line-height',\n 'typography.line-height.relaxed': 'line-height',\n \n // Effect\n 'effect.shadow.small': 'box-shadow',\n 'effect.shadow.medium': 'box-shadow',\n 'effect.shadow.large': 'box-shadow',\n 'effect.radius.small': 'border-radius',\n 'effect.radius.medium': 'border-radius',\n 'effect.radius.large': 'border-radius',\n 'effect.opacity.low': 'opacity',\n 'effect.opacity.medium': 'opacity',\n 'effect.opacity.high': 'opacity'\n };\n }\n \n /**\n * Map semantic to CSS property\n * @param semantic - Semantic string\n * @returns CSS property\n */\n private mapSemanticToCSS(semantic: string): string {\n const cssProperty = this.semanticToCSS[semantic];\n \n if (!cssProperty) {\n // Fallback: extract last part of semantic\n const parts = semantic.split('.');\n const lastPart = parts[parts.length - 1];\n \n // Map common patterns\n if (lastPart === 'small' || lastPart === 'medium' || lastPart === 'large') {\n return parts[parts.length - 2]; // e.g., padding, margin\n }\n \n return lastPart;\n }\n \n return cssProperty;\n }\n \n /**\n * Map token to CSS value\n * @param tokenRef - Token reference\n * @param theme - Theme\n * @returns CSS value\n */\n private mapTokenToCSS(tokenRef: string, theme: string): string {\n // In a real implementation, this would resolve the token from a token registry\n // For now, we'll use CSS variables as the default approach\n \n // Convert token reference to CSS variable name\n const cssVarName = tokenRef.replace(/\\./g, '-');\n \n // Add theme suffix if dark mode\n if (theme === 'dark') {\n return `var(--${cssVarName}-dark)`;\n }\n \n return `var(--${cssVarName})`;\n }\n \n /**\n * Generate CSS class\n * @param semantic - Semantic string\n * @param property - CSS property\n * @param value - CSS value\n * @returns CSS class string\n */\n private generateCSSClass(semantic: string, property: string, value: string): string {\n // Generate class name from semantic\n const className = this.generateClassName(semantic);\n \n return `.${className} { ${property}: ${value}; }`;\n }\n \n /**\n * Generate CSS variable\n * @param tokenRef - Token reference\n * @param value - CSS value\n * @returns CSS variable string\n */\n private generateCSSVariable(tokenRef: string, value: string): string {\n const varName = tokenRef.replace(/\\./g, '-');\n \n return `--${varName}: ${value};`;\n }\n \n /**\n * Generate inline style\n * @param property - CSS property\n * @param value - CSS value\n * @returns Inline style string\n */\n private generateInlineStyle(property: string, value: string): string {\n return `${property}: ${value}`;\n }\n \n /**\n * Generate class name from semantic\n * @param semantic - Semantic string\n * @returns Class name\n */\n private generateClassName(semantic: string): string {\n // Convert semantic to kebab-case class name\n return semantic\n .replace(/\\./g, '-')\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase();\n }\n}","import { Command } from 'commander';\n\nexport const watchCommand = new Command('watch')\n .description('Watch for changes and recompile')\n .argument('<contract-file>', 'Contract DSL file to watch')\n .option('--command <command>', 'Command to run on change', 'mase compile')\n .option('--debounce <ms>', 'Debounce time in ms', '300')\n .action((contractFile, options) => {\n console.log(`Watching ${contractFile}...`);\n console.log(`Command: ${options.command}`);\n console.log(`Debounce: ${options.debounce}ms`);\n // TODO: Implement watch mode logic using fs.watch or chokidar\n console.log('Watch mode started (Ctrl+C to stop)');\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAAA,oBAAwB;;;ACdxB,uBAAwB;AAEjB,IAAM,cAAc,IAAI,yBAAQ,MAAM,EAC1C,YAAY,oCAAoC,EAChD,SAAS,kBAAkB,cAAc,EACzC,OAAO,6BAA6B,4CAA4C,SAAS,EACzF,OAAO,gBAAgB,4BAA4B,IAAI,EACvD,OAAO,gBAAgB,gBAAgB,EACvC,OAAO,CAAC,aAAa,YAAY;AAChC,UAAQ,IAAI,8BAA8B;AAC1C,UAAQ,IAAI,iBAAiB,eAAe,cAAc,EAAE;AAC5D,UAAQ,IAAI,aAAa,QAAQ,QAAQ,EAAE;AAC3C,UAAQ,IAAI,eAAe,QAAQ,UAAU,EAAE;AAC/C,UAAQ,IAAI,0CAAqC;AACnD,CAAC;;;ACdH,IAAAC,oBAAwB;;;ACAjB,IAAM,iBAAN,cAA6B,MAAM;AAAA,EAIxC,YAAY,SAAiB,MAAc,QAAgB;AACzD,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,SAAS;AAAA,EAChB;AACF;;;ACyDO,IAAM,YAAY;AAAA;AAAA,EAEvB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,aAAa;AAAA,EACb,WAAW;AAAA;AAAA,EAGX,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,OAAO;AAAA,EACP,QAAQ;AAAA,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