Skip to main content
Glama
analysisUtils.ts2.47 kB
/** * Simple analysis utilities for session notes * Replaces over-engineered complexity scoring and learning tracking */ import type { SessionNote, ComplexityLevel, FileChange } from '../types/session.js'; /** * Get complexity level based on simple file count heuristic * Simple: < 3 files, Moderate: 3-7 files, Complex: 8+ files */ export function getComplexity(fileChanges?: FileChange[]): { level: ComplexityLevel; fileCount: number; } { const fileCount = fileChanges?.length || 0; let level: ComplexityLevel; if (fileCount < 3) { level = 'simple'; } else if (fileCount <= 7) { level = 'moderate'; } else { level = 'complex'; } return { level, fileCount }; } /** * Extract key files from file changes * Prioritizes created files and files with descriptions */ export function getKeyFiles(fileChanges?: FileChange[]): string[] { if (!fileChanges || fileChanges.length === 0) { return []; } // Prioritize created files const created = fileChanges .filter(f => f.type === 'created') .map(f => f.path); // Then files with descriptions const withDescriptions = fileChanges .filter(f => f.description && f.description.trim().length > 0) .map(f => f.path); // Combine, deduplicate, and limit to 5 const keyFiles = [...new Set([...created, ...withDescriptions])]; return keyFiles.slice(0, 5); } /** * Generate 2-3 concise bullet points for key changes */ export function generateKeyChanges(note: SessionNote): string[] { const changes: string[] = []; // Extract from file descriptions if (note.fileChanges) { const descriptions = note.fileChanges .filter(f => f.description && f.description.trim().length > 0) .map(f => f.description!.trim()) .slice(0, 3); changes.push(...descriptions); } // If no descriptions, create basic summary from file changes if (changes.length === 0 && note.fileChanges) { const created = note.fileChanges.filter(f => f.type === 'created').length; const modified = note.fileChanges.filter(f => f.type === 'modified').length; const deleted = note.fileChanges.filter(f => f.type === 'deleted').length; if (created > 0) changes.push(`Created ${created} file${created > 1 ? 's' : ''}`); if (modified > 0) changes.push(`Modified ${modified} file${modified > 1 ? 's' : ''}`); if (deleted > 0) changes.push(`Deleted ${deleted} file${deleted > 1 ? 's' : ''}`); } return changes.slice(0, 3); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/VoCoufi/second-brain-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server