scai
Version:
> **A local-first AI CLI for understanding, querying, and iterating on large codebases.** > **100% local • No token costs • No cloud • No prompt injection • Private by design**
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);
}