(projectRoot: string, embeddingModel: string)
| 177 | } |
| 178 | |
| 179 | export function indexPath(projectRoot: string, embeddingModel: string): string { |
| 180 | const hash = createHash('sha1').update(`${projectRoot}::${embeddingModel}`).digest('hex').slice(0, 16); |
| 181 | return path.join(os.homedir(), '.qodex', 'embeddings', `${hash}.json`); |
| 182 | } |
| 183 | |
| 184 | export async function loadIndex(p: string): Promise<Index | null> { |
| 185 | try { return JSON.parse(await fs.readFile(p, 'utf-8')); } catch { return null; } |
no test coverage detected