ai-debug-local-mcp
Version:
🎯 ENHANCED AI GUIDANCE v4.1.2: Dramatically improved tool descriptions help AI users choose the right tools instead of 'close enough' options. Ultra-fast keyboard automation (10x speed), universal recording, multi-ecosystem debugging support, and compreh
86 lines • 3.02 kB
JavaScript
/**
* Utility functions for formatting Next.js debug output
*/
export const RENDERING_DESCRIPTIONS = {
'SSR': 'Server-Side Rendering',
'SSG': 'Static Site Generation',
'ISR': 'Incremental Static Regeneration',
'RSC': 'React Server Components',
'CSR': 'Client-Side Rendering'
};
export function formatList(items, prefix = '- ') {
return items.map(item => `${prefix}${item}`);
}
export function formatSection(title, content) {
if (content.length === 0)
return [];
return [title, ...content, ''];
}
export function formatKeyValue(key, value) {
return `**${key}:** ${value}`;
}
export function formatMetadata(metadata) {
if (!metadata)
return [];
const items = [];
if (metadata.title)
items.push(`Title: "${metadata.title}"`);
if (metadata.description)
items.push(`Description: "${metadata.description}"`);
if (metadata.openGraph)
items.push('OpenGraph tags configured');
return items.length > 0 ? ['', '**Metadata:**', ...formatList(items)] : [];
}
export function formatPerformance(performance) {
if (!performance)
return [];
const items = [];
if (performance.fcp)
items.push(`FCP: ${performance.fcp}ms`);
if (performance.lcp)
items.push(`LCP: ${performance.lcp}ms`);
if (performance.ttfb)
items.push(`TTFB: ${performance.ttfb}ms`);
if (performance.cls !== undefined)
items.push(`CLS: ${performance.cls}`);
return items.length > 0 ? ['', '**Performance Metrics:**', ...formatList(items)] : [];
}
export function formatRecommendations(recommendations) {
return recommendations.length > 0
? ['', '**💡 Recommendations:**', ...formatList(recommendations)]
: [];
}
export function formatParams(params, title) {
if (!params || Object.keys(params).length === 0) {
return title === 'Search Parameters' ? ['No search parameters\n'] : [];
}
const sections = [`**${title}:**`];
Object.entries(params).forEach(([key, value]) => {
sections.push(`**${key}:** ${value}`);
});
sections.push('');
return sections;
}
export function formatConfigItems(config, items) {
const result = [];
items.forEach(([field, label, checkFalse]) => {
const value = config?.[field];
if (checkFalse) {
// For checkFalse items, show if false or missing
if (value === false || value === undefined) {
result.push(`${label}: Disabled`);
}
}
else if (value !== undefined) {
// For normal items, show if present
result.push(`${label}: ${typeof value === 'boolean' ? (value ? 'Enabled' : 'Disabled') : value}`);
}
});
return result;
}
export function formatCountItems(config, items) {
return items
.filter(([field]) => config?.[field]?.length > 0)
.map(([field, label]) => `${label}: ${config[field].length} configured`);
}
//# sourceMappingURL=nextjs-formatter-utils.js.map