{"_id":"@bestdesign/tcg-core","name":"@bestdesign/tcg-core","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@bestdesign/tcg-core","version":"0.1.0","description":"Typed Constraint Graph — validate AI-generated UI against your design system","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","prepublishOnly":"npm run build"},"keywords":["design-system","constraints","validation","ai-ui","tcg","typed-constraint-graph","claude-design","v0","design-tokens"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/bestdesign/best-design.git","directory":"packages/tcg-core"},"devDependencies":{"typescript":"^5.6.0"},"publishConfig":{"access":"public"},"gitHead":"300fdaeb28bd639af84644876dd34d8e939b96fc","_id":"@bestdesign/tcg-core@0.1.0","bugs":{"url":"https://github.com/bestdesign/best-design/issues"},"homepage":"https://github.com/bestdesign/best-design#readme","_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-G9jzqm+obYn1yOUmT3s8JcbySwkZsV7bPsLKQTfsEWWjeR8+I7nfdVcjHX+ewXCCkd2NfghrPHrYT+pEtqSSFg==","shasum":"49befc2c494602c160261305fced6162efc1a01f","tarball":"https://registry.npmjs.org/@bestdesign/tcg-core/-/tcg-core-0.1.0.tgz","fileCount":26,"unpackedSize":1277147,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCFl5J3a8PeNfy8HS4BEr4TPdmUo7/bwTfNeRKFxJQ4qgIhAI7IR0w0En3dgxu2lMjDrertQuEnZ/9N1gVVihGGXKPZ"}]},"_npmUser":{"name":"uthlatib","email":"ulatib@gmail.com"},"directories":{},"maintainers":[{"name":"uthlatib","email":"ulatib@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tcg-core_0.1.0_1778662818619_0.5948205659988077"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-13T09:00:18.489Z","0.1.0":"2026-05-13T09:00:18.803Z","modified":"2026-05-13T09:00:19.000Z"},"maintainers":[{"name":"uthlatib","email":"ulatib@gmail.com"}],"description":"Typed Constraint Graph — validate AI-generated UI against your design system","homepage":"https://github.com/bestdesign/best-design#readme","keywords":["design-system","constraints","validation","ai-ui","tcg","typed-constraint-graph","claude-design","v0","design-tokens"],"repository":{"type":"git","url":"git+https://github.com/bestdesign/best-design.git","directory":"packages/tcg-core"},"bugs":{"url":"https://github.com/bestdesign/best-design/issues"},"license":"MIT","readme":"# @bestdesign/tcg-core\n\nValidate AI-generated UI against your design system. Returns a compliance score, plain-English violations, and auto-corrected TSX.\n\n## Install\n\n```bash\nnpm install @bestdesign/tcg-core\n```\n\n## First call\n\n```ts\nimport { createConstraintGraph, validate } from '@bestdesign/tcg-core'\n\nconst graph = await createConstraintGraph({\n  spacing: { 1: '4px', 2: '8px', 3: '12px', 4: '16px' },\n  colors: { primary: '#0066CC', text: '#1A1A1A' },\n})\n\nconst result = await validate(\n  `<div style={{ padding: '13px', color: '#0066cc' }}>Hi</div>`,\n  graph,\n)\n\nconsole.log(result.score)              // 50\nconsole.log(result.violations[0].message)\n// \"padding is 13px — your design system uses 4 (16px). Auto-corrected.\"\nconsole.log(result.corrected)\n// `<div style={{ padding: '16px', color: '#0066CC' }}>Hi</div>`\n```\n\n## API\n\n```ts\ncreateConstraintGraph(tokens)              // build the graph\nvalidate(tsx, graph)                       // → { score, violations, corrected }\naddNode(graph, tsx)                        // ingest as tracked node\nexportConstraints(graph, format)           // 'json' | 'design-md' | 'claude-context'\ngenerateTsx(graph, nodeId?)                // project graph back to TSX\n```\n\nFull types: see `tcg-core.d.ts` — every exported function is typed.\n\n## Inputs accepted by `createConstraintGraph`\n\n```ts\n// 1. JSON tokens object\nawait createConstraintGraph({ spacing: { 1: '4px' }, colors: {...} })\n\n// 2. DESIGN.md string (Stitch / Claude Design export)\nawait createConstraintGraph(designMdString)\n\n// 3. File path (Node only)\nawait createConstraintGraph('./tokens.json')\n```\n\n## Status\n\n`0.1.0` ships pattern-matching validation — fast and useful for the 80% case (inline pixel values, hex colours, Tailwind spacing classes). `0.2` will add AST-level TSX parsing for prop-level checks and template-literal coverage.\n\nThe WASM module ships inside the package (~1.1 MB). No network calls, no telemetry.\n\nMIT licensed. Bug reports + PRs welcome.\n","readmeFilename":"README.md","_rev":"1-cea0e9c14626fcb029b7ccd28c0b4db0"}