feat(FN-5329): remove orphan rescue and branch-recovery primitives from eng
Removes the branch-recovery CLI surface, orphan-rescue engine primitives, and their associated tests (over 1,500 lines deleted), while restoring a minimal prune-only orphan branch sweep with proper git audit mutation types. Documentation across `cli-reference.md`, `task-management.md`, and `AGENTS.m Fusion-Task-Id: FN-5329
This commit is contained in:
committed by
gsxdsm
parent
0e5cb4d292
commit
fd202e9356
@@ -16,14 +16,6 @@ export interface BranchCrossContaminationCommit extends BranchConflictCommit {
|
||||
foreignTaskId: string;
|
||||
}
|
||||
|
||||
export interface BranchRecoveryCandidate {
|
||||
branchName: string;
|
||||
tipSha: string;
|
||||
worktreePath: string | null;
|
||||
strandedCommits: BranchConflictCommit[];
|
||||
isCanonical: boolean;
|
||||
}
|
||||
|
||||
export interface BranchConflictDetails {
|
||||
branchName: string;
|
||||
conflictingWorktreePath: string;
|
||||
@@ -113,12 +105,6 @@ interface UniqueBranchCommitListResult {
|
||||
degraded: boolean;
|
||||
}
|
||||
|
||||
export interface ListBranchRecoveryCandidatesInput {
|
||||
repoDir: string;
|
||||
branchName: string;
|
||||
startPoint?: string;
|
||||
}
|
||||
|
||||
function quoteShellArg(value: string): string {
|
||||
return `'${value.replace(/'/g, `'\\''`)}'`;
|
||||
}
|
||||
@@ -244,47 +230,6 @@ async function getWorktreeBranchMap(repoDir: string): Promise<Map<string, string
|
||||
return map;
|
||||
}
|
||||
|
||||
function parseBranchNames(output: string): string[] {
|
||||
return output
|
||||
.split("\n")
|
||||
.map((line) => line.trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
export async function listBranchRecoveryCandidates(
|
||||
input: ListBranchRecoveryCandidatesInput,
|
||||
): Promise<BranchRecoveryCandidate[]> {
|
||||
const { repoDir, branchName } = input;
|
||||
const startPoint = input.startPoint ?? "HEAD";
|
||||
const [branchListOutput, worktreeBranches] = await Promise.all([
|
||||
runGit(
|
||||
repoDir,
|
||||
`git for-each-ref --format='%(refname:short)' refs/heads/${branchName} refs/heads/${branchName}-*`,
|
||||
),
|
||||
getWorktreeBranchMap(repoDir),
|
||||
]);
|
||||
|
||||
const candidates: BranchRecoveryCandidate[] = [];
|
||||
for (const candidateName of parseBranchNames(branchListOutput)) {
|
||||
const tipSha = await revParse(repoDir, candidateName);
|
||||
const strandedCommits = await listStrandedCommits(repoDir, startPoint, candidateName);
|
||||
candidates.push({
|
||||
branchName: candidateName,
|
||||
tipSha,
|
||||
worktreePath: worktreeBranches.get(candidateName) ?? null,
|
||||
strandedCommits,
|
||||
isCanonical: candidateName === branchName,
|
||||
});
|
||||
}
|
||||
|
||||
candidates.sort((left, right) => {
|
||||
if (left.branchName === branchName) return -1;
|
||||
if (right.branchName === branchName) return 1;
|
||||
return left.branchName.localeCompare(right.branchName);
|
||||
});
|
||||
|
||||
return candidates;
|
||||
}
|
||||
|
||||
interface TaskAttributionSummary {
|
||||
ownCount: number;
|
||||
@@ -970,7 +915,7 @@ export async function inspectBranchConflict(
|
||||
existingTipSha,
|
||||
strandedCommits: uniqueCommitResult.commits,
|
||||
startPoint: uniqueCommitResult.mainRef,
|
||||
recommendedAction: "Run branch recovery and explicitly choose whether to reclaim or discard prior work.",
|
||||
recommendedAction: "Inspect/reclaim or discard the conflicting local branch/worktree with git tooling before retrying.",
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user