check_compliance
Verify component source code meets compliance standards by scoring it against specifications to ensure it passes required thresholds.
Instructions
Quick check if component code is compliant (score >= 80)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The component source code to check |
Implementation Reference
- src/tools/index.ts:453-476 (handler)The handler function for the 'check_compliance' tool. It invokes gradeComponent on the input code, checks if the score is >= 80, and formats a compliance report with status, score, and any violations or confirmation of passing.function handleCheckCompliance(args: Record<string, unknown>): ToolResult { const code = args.code as string; const result = gradeComponent(code); const isCompliant = result.score >= 80; const status = isCompliant ? '✅ COMPLIANT' : '❌ NOT COMPLIANT'; const text = `# ${status} **Score:** ${result.score}/100 (${result.grade}) **Threshold:** 80/100 ${ result.violations.length > 0 ? `## Issues to Fix (${result.violations.length}) ${result.violations.map((v) => `- ${v.message}${v.suggestion ? ` → ${v.suggestion}` : ''}`).join('\n')}` : '## All checks passed!' } `; return { content: [{ type: 'text', text }], }; }
- src/tools/index.ts:145-158 (schema)The input schema and definition for the 'check_compliance' tool, specifying that it requires a 'code' string parameter.{ name: 'check_compliance', description: 'Quick check if component code is compliant (score >= 80)', inputSchema: { type: 'object', properties: { code: { type: 'string', description: 'The component source code to check', }, }, required: ['code'], }, },
- src/tools/index.ts:245-246 (registration)The switch case in executeTool that registers and dispatches to the check_compliance handler.case 'check_compliance': return handleCheckCompliance(args);