Skip to content

Commit 895230c

Browse files
committed
feat: implement PR metadata ingestion for multi-agent detection
- Add database schema for pull_requests table with RLS policies - Implement GitHub PR fetch and upsert functionality - Extract PR signals for checklist, template markers and linked issues - Integrate PR signals into persona detection scoring - Add unit tests for AI config patterns and commit trailer parsing - Update docs with implementation tracker and PRD details
1 parent 8e53819 commit 895230c

2 files changed

Lines changed: 64 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
steps:
3838
- name: Checkout repository
3939
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
fetch-tags: true
4043

4144
- name: Set up Node
4245
uses: actions/setup-node@v4

packages/core/src/__tests__/integration.test.ts

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,60 @@ import { classifySubsystem } from "../vibe";
99
* and AI config files (AGENTS.md).
1010
*/
1111
describe("Integration: vibed-coding repo analysis", () => {
12+
const getCommitCount = (): number => {
13+
try {
14+
const output = execSync("git rev-list --count HEAD", {
15+
cwd: process.cwd(),
16+
encoding: "utf-8",
17+
maxBuffer: 1024 * 1024,
18+
});
19+
const count = Number(output.trim());
20+
return Number.isFinite(count) ? count : 0;
21+
} catch {
22+
return 0;
23+
}
24+
};
25+
26+
const isShallowRepo = (): boolean => {
27+
try {
28+
const output = execSync("git rev-parse --is-shallow-repository", {
29+
cwd: process.cwd(),
30+
encoding: "utf-8",
31+
maxBuffer: 1024 * 1024,
32+
});
33+
return output.trim() === "true";
34+
} catch {
35+
return false;
36+
}
37+
};
38+
39+
const ensureCommitHistory = (minCommits: number): void => {
40+
const currentCount = getCommitCount();
41+
if (currentCount >= minCommits) return;
42+
if (!isShallowRepo()) return;
43+
44+
try {
45+
execSync("git fetch --unshallow --tags", {
46+
cwd: process.cwd(),
47+
encoding: "utf-8",
48+
maxBuffer: 1024 * 1024,
49+
stdio: "ignore",
50+
});
51+
return;
52+
} catch {
53+
try {
54+
execSync(`git fetch --deepen=${minCommits} --tags`, {
55+
cwd: process.cwd(),
56+
encoding: "utf-8",
57+
maxBuffer: 1024 * 1024,
58+
stdio: "ignore",
59+
});
60+
} catch {
61+
return;
62+
}
63+
}
64+
};
65+
1266
// Get real git log from this repo
1367
const getRecentCommits = (count: number = 50): string[] => {
1468
try {
@@ -46,9 +100,10 @@ describe("Integration: vibed-coding repo analysis", () => {
46100

47101
describe("Commit trailer detection", () => {
48102
it("detects Co-authored-by: Claude trailers in repo history", () => {
103+
ensureCommitHistory(100);
49104
const rawCommits = getRecentCommits(100);
50-
if (rawCommits.length === 0) {
51-
console.log("Skipping: could not read git history");
105+
if (rawCommits.length < 10) {
106+
console.log("Skipping: insufficient git history (likely shallow checkout)");
52107
return;
53108
}
54109

@@ -80,6 +135,7 @@ describe("Integration: vibed-coding repo analysis", () => {
80135
});
81136

82137
it("parses various trailer formats correctly", () => {
138+
ensureCommitHistory(100);
83139
const rawCommits = getRecentCommits(100);
84140
if (rawCommits.length === 0) return;
85141

@@ -123,9 +179,10 @@ describe("Integration: vibed-coding repo analysis", () => {
123179

124180
describe("Full analysis pipeline", () => {
125181
it("computes insights with multi-agent signals from real commits", () => {
182+
ensureCommitHistory(50);
126183
const rawCommits = getRecentCommits(50);
127-
if (rawCommits.length === 0) {
128-
console.log("Skipping: could not read git history");
184+
if (rawCommits.length < 10) {
185+
console.log("Skipping: insufficient git history (likely shallow checkout)");
129186
return;
130187
}
131188

0 commit comments

Comments
 (0)