OPC # 0006: OPC Git Trunk-Based management
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -378,3 +378,49 @@ export function triggerCherryPick(
|
||||
|
||||
return () => { cancelled = true; controller.abort(); };
|
||||
}
|
||||
|
||||
// -- Branch Conformance API --------------------------------------------------
|
||||
|
||||
export type ConformanceViolation = 'OK' | 'Missing' | 'Diverged' | 'Stale';
|
||||
export type ConformanceSeverity = 'OK' | 'Info' | 'Warning' | 'Critical';
|
||||
|
||||
export interface BranchConformanceCheck {
|
||||
branch: string;
|
||||
sourceBranch: string | null;
|
||||
violation: ConformanceViolation;
|
||||
severity: ConformanceSeverity;
|
||||
detail: string;
|
||||
aheadOfSource: number;
|
||||
behindSource: number;
|
||||
fixSha: string | null;
|
||||
}
|
||||
|
||||
export interface ConformanceReport {
|
||||
repo: string;
|
||||
isConformant: boolean;
|
||||
checks: BranchConformanceCheck[];
|
||||
}
|
||||
|
||||
export async function getConformanceReport(repo = 'Clarity'): Promise<ConformanceReport> {
|
||||
const res = await fetch(`${BASE_URL}/api/promotions/conformance?repo=${encodeURIComponent(repo)}`);
|
||||
if (!res.ok) throw new Error(`Failed to get conformance report: ${res.statusText}`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function getAllConformanceReports(): Promise<ConformanceReport[]> {
|
||||
const res = await fetch(`${BASE_URL}/api/promotions/conformance/all`);
|
||||
if (!res.ok) throw new Error(`Failed to get conformance reports: ${res.statusText}`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function createLadderBranch(branch: string, fromSha: string, repo: string): Promise<void> {
|
||||
const res = await fetch(`${BASE_URL}/api/promotions/create-branch`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ branch, fromSha, repo }),
|
||||
});
|
||||
if (!res.ok) {
|
||||
const body = await res.json().catch(() => ({}));
|
||||
throw new Error((body as { error?: string }).error ?? res.statusText);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user