Skip to main content
Glama
file-utils.ts805 B
import * as crypto from 'crypto'; import * as fs from 'fs/promises'; import * as path from 'path'; const DEBUG_LOG_FILE = 'debug-search.log'; const LOG_SEPARATOR = '---'; const JSON_INDENT = 2; export const hashFile = async (filePath: string): Promise<string> => { const content = await fs.readFile(filePath); return crypto.createHash('sha256').update(content).digest('hex'); }; export const debugLog = async (message: string, data?: any): Promise<void> => { const timestamp = new Date().toISOString(); const logEntry = `[${timestamp}] ${message}\n${data ? JSON.stringify(data, null, JSON_INDENT) : ''}\n${LOG_SEPARATOR}\n`; try { await fs.appendFile(path.join(process.cwd(), DEBUG_LOG_FILE), logEntry); } catch (error) { console.error('Failed to write debug log:', error); } };

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/drewdrewH/code-graph-context'

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