UNPKG

framework-mcp

Version:

Dual-architecture server (MCP + HTTP API) for determining vendor tool capability roles against CIS Controls Framework. Supports Microsoft Copilot custom connectors and DigitalOcean App Services deployment.

60 lines (43 loc) โ€ข 2 kB
#!/usr/bin/env node /** * Clean and format CIS Safeguards data for SafeguardManager compatibility */ const fs = require('fs'); console.log('๐Ÿงน Cleaning and Formatting CIS Safeguards Data\n'); // Read original data const originalData = fs.readFileSync('/tmp/complete_cis_safeguards.ts', 'utf8'); // Extract just the object content (without const declaration and type annotation) const objectMatch = originalData.match(/= {([\s\S]*)};\s*$/); if (!objectMatch) { console.log('โŒ Failed to extract object content'); process.exit(1); } let objectContent = objectMatch[1]; console.log('โœ… Extracted object content'); // Clean up the data: // 1. Remove TypeScript comments that might break parsing objectContent = objectContent.replace(/\/\/ [^\n\r]*/g, ''); // 2. Ensure consistent formatting objectContent = objectContent.replace(/\s+/g, ' ').replace(/\s*,\s*/g, ',').replace(/\s*:\s*/g, ':'); // 3. Add proper indentation for readability const lines = objectContent.split('\n'); const indentedLines = lines.map((line, index) => { if (index === 0) return line; // First line stays as is return ' ' + line.trim(); // Indent other lines }); objectContent = indentedLines.join('\n'); // Create the properly formatted safeguards object content const cleanedContent = ` this.safeguards = {${objectContent} };`; console.log('โœ… Formatted for SafeguardManager integration'); // Write cleaned data to temporary file fs.writeFileSync('/tmp/cleaned_safeguards_content.ts', cleanedContent); console.log('โœ… Cleaned data saved to /tmp/cleaned_safeguards_content.ts'); // Show a sample of the cleaned data const preview = cleanedContent.substring(0, 500); console.log('\n๐Ÿ“„ Preview of cleaned data:'); console.log(preview + '...\n'); console.log('๐Ÿ“Š Data Statistics:'); console.log(' Original size:', originalData.length, 'characters'); console.log(' Cleaned size:', cleanedContent.length, 'characters'); console.log(' Ready for SafeguardManager integration โœ…');