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 ❤️.
15 lines (14 loc) • 525 B
JavaScript
import crypto from 'crypto';
import path from 'path';
import { normalizePath } from './contentUtils.js';
/**
* Generate a stable unique key for a repo path.
* Uses the basename plus a short hash of the full path.
* Example: "sps-1a2b3c"
*/
export function getHashedRepoKey(repoPath) {
const absPath = normalizePath(repoPath); // now cross-platform consistent
const base = path.basename(absPath);
const hash = crypto.createHash('md5').update(absPath).digest('hex').slice(0, 6);
return `${base}-${hash}`;
}