MCPcopy
hub / github.com/Doorman11991/smallcode / summarizeFileCompiled

Function summarizeFileCompiled

bin/features_adapter.js:70–85  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

68 * Cached by content hash (1h TTL). Only runs on files > 100 lines.
69 */
70async 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

Callers 1

executeToolFunction · 0.85

Calls 1

_getPromptsFunction · 0.85

Tested by

no test coverage detected