OPC # 0001: Extract OPC into standalone repo

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
amadzarak
2026-04-25 19:17:48 -04:00
parent 7561ac7530
commit 76962a6af4
6 changed files with 326 additions and 65 deletions
+14 -2
View File
@@ -114,6 +114,7 @@ export async function deleteArtifact(artifactId: string): Promise<void> {
// The git log endpoint supports ?grep=OPC+%230001 to filter.
export interface LinkedCommit {
repoKey: string;
hash: string;
shortHash: string;
author: string;
@@ -123,9 +124,9 @@ export interface LinkedCommit {
}
export async function getLinkedCommits(opcNumber: string): Promise<LinkedCommit[]> {
const res = await fetch(`${BASE_URL}/api/git/log?grep=${encodeURIComponent(opcNumber)}&limit=50`);
const res = await fetch(`${BASE_URL}/api/git/log?grep=${encodeURIComponent(opcNumber)}&limit=50&repo=all`);
if (!res.ok) throw new Error(`Failed to load commits: ${res.statusText}`);
return res.json();
return res.json(); // backend now returns { repoKey, hash, shortHash, author, date, subject, files }
}
// ── Pinned commits ────────────────────────────────────────────────────────────
@@ -192,6 +193,17 @@ export async function getBranchCoverage(hashes: string[]): Promise<BranchCoverag
return res.json();
}
// Query branch coverage against a specific repo from the Git:Repos registry.
// The backend ignores hashes it cannot resolve, so passing cross-repo hashes is safe.
export async function getBranchCoverageForRepo(repoKey: string, hashes: string[]): Promise<BranchCoverage[]> {
if (hashes.length === 0) return [];
const res = await fetch(
`${BASE_URL}/api/git/branch-coverage?commits=${hashes.join(',')}&repo=${encodeURIComponent(repoKey)}`,
);
if (!res.ok) throw new Error(`Failed to get branch coverage for ${repoKey}: ${res.statusText}`);
return res.json();
}
// ── Commit detail (full diff) ─────────────────────────────────────────────────
export interface CommitFile {