feat: AI Codebase Doc Drift Detector CLI v0.1.0

This commit is contained in:
Bun Bun
2026-06-17 12:27:02 +00:00
commit ee14c4f691
16 changed files with 1101 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
/**
* Git Tracker — discover changed files via git.
*/
import { execSync } from 'node:child_process';
export function getGitRoot(cwd: string): string | null {
try {
return execSync('git rev-parse --show-toplevel', { cwd, encoding: 'utf-8' }).trim();
} catch {
return null;
}
}
export function getChangedFiles(cwd: string, sinceRef?: string): string[] {
try {
const cmd = sinceRef
? `git diff --name-only ${sinceRef} --`
: 'git diff --name-only HEAD~1 --';
const out = execSync(cmd, { cwd, encoding: 'utf-8' }).trim();
if (!out) return [];
return out.split('\n').filter(Boolean);
} catch {
return [];
}
}
export function getAllTrackedFiles(cwd: string): string[] {
try {
const out = execSync('git ls-files', { cwd, encoding: 'utf-8' }).trim();
if (!out) return [];
return out.split('\n').filter(Boolean);
} catch {
return [];
}
}
export function getLastCommitDate(cwd: string): string | null {
try {
return execSync('git log -1 --format=%cI', { cwd, encoding: 'utf-8' }).trim();
} catch {
return null;
}
}