* Summarize a large file to function signatures. * Returns summary string or null on failure. * Cached by content hash (1h TTL). Only runs on files > 100 lines.
(filePath, content, targetTokens = 500)
| 68 | * Cached by content hash (1h TTL). Only runs on files > 100 lines. |
| 69 | */ |
| 70 | async function summarizeFileCompiled(filePath, content, targetTokens = 500) { |
| 71 | const prompts = _getPrompts(); |
| 72 | if (!prompts) return null; |
| 73 | if (!content || content.split('\n').length < 100) return null; |
| 74 | try { |
| 75 | const traceId = require('crypto').randomUUID(); |
| 76 | const result = await prompts.callPrompt('summarize_file', { |
| 77 | file_path: filePath, |
| 78 | content: content.slice(0, 8000), |
| 79 | target_tokens: targetTokens, |
| 80 | }, { trace_id: traceId }); |
| 81 | return String(result); |
| 82 | } catch { |
| 83 | return null; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // ─── Feature 3: Budget policy enforcement ──────────────────────────────────── |
| 88 |
no test coverage detected