scai
Version:
> **AI-powered CLI for local code analysis, commit message suggestions, and natural-language queries.** 100% local, private, GDPR-friendly, made in Denmark/EU with ❤️.
13 lines (12 loc) • 514 B
JavaScript
import fs from 'fs';
import path from 'path';
import { extractFunctionsFromFile } from './functionExtractors/index.js';
/**
* Extracts functions from file if language is supported.
* Returns true if functions were extracted, false otherwise.
*/
export async function indexCodeForFile(filePath, fileId) {
const normalizedPath = path.normalize(filePath).replace(/\\/g, '/');
const content = fs.readFileSync(filePath, 'utf-8');
return await extractFunctionsFromFile(normalizedPath, content, fileId);
}