scai
Version:
> AI-powered CLI tool for commit messages **and** pull request reviews — using local models.
15 lines (14 loc) • 526 B
JavaScript
import crypto from 'crypto';
import path from 'path';
import { normalizePath } from './normalizePath.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}`;
}