#!/usr/bin/env node
/**
* VibeCoding Prompt System Validation Script
*
* This script validates the integrity and completeness of the prompt system
*/
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const PROMPTS_DIR = path.join(__dirname, '../.vibecoding/prompts');
// Expected prompt structure
const EXPECTED_STRUCTURE = {
core: [
'system-identity.md',
'conversation-style.md',
'collaboration-rules.md'
],
services: [
'context-manager.md',
'code-generator.md',
'dependency-tracker.md',
'test-validator.md',
'doc-generator.md',
'deployment-manager.md'
],
workflows: [
'discovery-phase.md',
'design-phase.md',
'implementation-phase.md',
'validation-phase.md',
'deployment-phase.md'
]
};
// Validation functions
function validateFileExists(filePath) {
return fs.existsSync(filePath);
}
function validateFileContent(filePath, minLength = 1000) {
try {
const content = fs.readFileSync(filePath, 'utf8');
return {
exists: true,
length: content.length,
valid: content.length >= minLength,
hasHeaders: content.includes('##'),
hasPrompts: content.includes('π€'),
hasExamples: content.includes('```')
};
} catch (error) {
return {
exists: false,
error: error.message
};
}
}
function validatePromptStructure() {
console.log('π Validating VibeCoding Prompt System...\n');
let totalFiles = 0;
let validFiles = 0;
let issues = [];
// Check each category
for (const [category, files] of Object.entries(EXPECTED_STRUCTURE)) {
console.log(`π ${category.toUpperCase()} Prompts:`);
const categoryPath = path.join(PROMPTS_DIR, category);
if (!fs.existsSync(categoryPath)) {
issues.push(`β Missing ${category} directory`);
console.log(` β Directory not found: ${categoryPath}`);
continue;
}
for (const file of files) {
totalFiles++;
const filePath = path.join(categoryPath, file);
const validation = validateFileContent(filePath);
if (validation.exists && validation.valid) {
validFiles++;
console.log(` β
${file} (${validation.length} chars)`);
// Additional content checks
if (!validation.hasHeaders) {
console.log(` β οΈ Missing markdown headers`);
}
if (!validation.hasPrompts) {
console.log(` β οΈ Missing prompt examples (π€)`);
}
if (!validation.hasExamples) {
console.log(` β οΈ Missing code examples`);
}
} else if (validation.exists) {
console.log(` β οΈ ${file} (${validation.length} chars - too short)`);
issues.push(`File too short: ${file}`);
} else {
console.log(` β ${file} - Not found`);
issues.push(`Missing file: ${file}`);
}
}
console.log('');
}
return {
totalFiles,
validFiles,
issues,
completeness: (validFiles / totalFiles) * 100
};
}
function validatePromptManager() {
console.log('π§ Validating Prompt Manager...\n');
const promptManagerPath = path.join(__dirname, '../src/utils/prompt-manager.ts');
if (!validateFileExists(promptManagerPath)) {
console.log('β Prompt Manager not found');
return false;
}
const content = fs.readFileSync(promptManagerPath, 'utf8');
const checks = [
{ name: 'PromptManager class', pattern: /class PromptManager/ },
{ name: 'ServiceId enum', pattern: /enum ServiceId/ },
{ name: 'DevelopmentPhase enum', pattern: /enum DevelopmentPhase/ },
{ name: 'buildMCPServicePrompt function', pattern: /buildMCPServicePrompt/ },
{ name: 'Service configurations', pattern: /SERVICE_CONFIGS/ }
];
let passed = 0;
for (const check of checks) {
if (check.pattern.test(content)) {
console.log(` β
${check.name}`);
passed++;
} else {
console.log(` β ${check.name}`);
}
}
console.log(`\nπ Prompt Manager: ${passed}/${checks.length} checks passed\n`);
return passed === checks.length;
}
function validateServiceIntegration() {
console.log('π Validating Service Integration...\n');
const contextManagerPath = path.join(__dirname, '../vibe-services/context-manager/index.ts');
if (!validateFileExists(contextManagerPath)) {
console.log('β Context Manager service not found');
return false;
}
const content = fs.readFileSync(contextManagerPath, 'utf8');
const integrationChecks = [
{ name: 'MCP Server implementation', pattern: /Server/ },
{ name: 'Tool request handling', pattern: /CallToolRequestSchema/ },
{ name: 'Project management functionality', pattern: /VibeContextManager/ }
];
let passed = 0;
for (const check of integrationChecks) {
if (check.pattern.test(content)) {
console.log(` β
${check.name}`);
passed++;
} else {
console.log(` β ${check.name}`);
}
}
console.log(`\nπ Service Integration: ${passed}/${integrationChecks.length} checks passed\n`);
return passed === integrationChecks.length;
}
function generateReport(results) {
console.log('π VALIDATION REPORT');
console.log('='.repeat(50));
console.log(`π Total Prompt Files: ${results.totalFiles}`);
console.log(`β
Valid Files: ${results.validFiles}`);
console.log(`π Completeness: ${results.completeness.toFixed(1)}%`);
if (results.issues.length > 0) {
console.log('\nβ οΈ Issues Found:');
results.issues.forEach(issue => console.log(` - ${issue}`));
}
console.log('\nπ― Prompt System Status:');
if (results.completeness === 100) {
console.log(' π FULLY OPERATIONAL - All prompts are ready!');
} else if (results.completeness >= 80) {
console.log(' β
MOSTLY READY - Minor issues to fix');
} else {
console.log(' β οΈ NEEDS ATTENTION - Major issues found');
}
console.log('\nπ Next Steps:');
console.log(' 1. Fix any missing or incomplete prompt files');
console.log(' 2. Test prompt loading in services');
console.log(' 3. Validate service behavior with prompts');
console.log(' 4. Run integration tests');
}
// Main execution
function main() {
console.log('π― VibeCoding Prompt System Validator\n');
const promptResults = validatePromptStructure();
const managerValid = validatePromptManager();
const integrationValid = validateServiceIntegration();
generateReport(promptResults);
console.log('\nπ§ System Components:');
console.log(` Prompt Manager: ${managerValid ? 'β
' : 'β'}`);
console.log(` Service Integration: ${integrationValid ? 'β
' : 'β'}`);
const overallHealth = promptResults.completeness >= 80 && managerValid && integrationValid;
console.log(`\nπ₯ Overall System Health: ${overallHealth ? 'π’ HEALTHY' : 'π΄ NEEDS WORK'}`);
process.exit(overallHealth ? 0 : 1);
}
main();