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**
14 lines (13 loc) • 480 B
JavaScript
export function extractFileReferences(query, options) {
const text = String(query ?? "");
const fileRegex = /(?:[A-Za-z0-9_.\-]+\/)*[A-Za-z0-9_.\-]+\.[A-Za-z0-9_]{1,10}/g;
const matches = text.match(fileRegex) ?? [];
const out = new Set();
for (const token of matches) {
const cleaned = token.trim();
if (!cleaned)
continue;
out.add(options?.lowercase ? cleaned.toLowerCase() : cleaned);
}
return Array.from(out);
}