UNPKG

vibe-coder-mcp

Version:

Production-ready MCP server with complete agent integration, multi-transport support, and comprehensive development automation tools for AI-assisted workflows.

56 lines (55 loc) 1.81 kB
import { EnhancementConfigManager } from '../config/enhancementConfig.js'; import { selectBestKeywords } from './semanticExtractor.js'; export class CommentProcessor { config; constructor(config) { this.config = config; } processComment(comment, context) { if (!comment) { return ''; } if (!this.config.contentDensity.enabled) { return comment; } const maxLength = this.config.contentDensity.maxContentLength; if (maxLength === 0) { return ''; } if (comment.length <= maxLength) { return comment; } return this.compressWithSemanticPreservation(comment, maxLength, context); } processComments(comments) { return comments.map(item => this.processComment(item.comment, item.context)); } isEnabled() { return this.config.contentDensity.enabled; } getMaxContentLength() { return this.config.contentDensity.maxContentLength; } compressWithSemanticPreservation(comment, maxLength, context) { const cleaned = this.cleanComment(comment); if (cleaned.length <= maxLength) { return cleaned; } return selectBestKeywords(cleaned, maxLength, context); } cleanComment(comment) { return comment .replace(/\s+/g, ' ') .replace(/^\s*[/*#]*\s*/, '') .replace(/\s*[/*#]*\s*$/, '') .trim(); } } export function createCommentProcessor() { const config = EnhancementConfigManager.getInstance().getConfig(); return new CommentProcessor(config); } export function processComment(comment, context) { const processor = createCommentProcessor(); return processor.processComment(comment, context); }