Skip to content

A library of Agent Skills designed to work with the Stitch MCP server. Each skill follows the Agent Skills open standard, for compatibility with coding agents such as Antigravity, Gemini CLI, Claude Code, Cursor.

TypeScript

Merge pull request #84 from Emp1500/fix-validate-crash-on-bad-input

J XIA2df9dad15e41
diff --cc plugins/stitch-build/skills/react-components/scripts/validate.js
index c81418c,8d1036f..8de8b61
--- a/plugins/stitch-build/skills/react-components/scripts/validate.js
+++ b/plugins/stitch-build/skills/react-components/scripts/validate.js
@@@ -18,12 -18,16 +18,16 @@@ import swc from '@swc/core'
import fs from 'node:fs';
import path from 'node:path';
-const HEX_COLOR_REGEX = /#[0-9A-Fa-f]{6}/;
+const HEX_COLOR_REGEX = /#[0-9A-Fa-f]{3,8}\b/;
async function validateComponent(filePath) {
- const code = fs.readFileSync(filePath, 'utf-8');
- const filename = path.basename(filePath);
+ if (!filePath) {
+ console.error("Usage: node validate.js <path-to-component>");
+ process.exit(1);
+ }
try {
+ const code = fs.readFileSync(filePath, 'utf-8');
+ const filename = path.basename(filePath);
const ast = await swc.parse(code, { syntax: "typescript", tsx: true });
let hasInterface = false;
let tailwindIssues = [];