openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
20 lines (19 loc) • 1.01 kB
JavaScript
//#region src/agents/worktrees/gc-result.ts
function formatWorktreeGcResult(result) {
const limits = result.limitsSatisfied === null ? "unknown" : result.limitsSatisfied ? "satisfied" : "exceeded";
const shown = result.issues.map((issue) => `${issue.id ?? issue.stage}: ${issue.reason}`).join("; ");
const omitted = result.issueCount - result.issues.length;
return [
`Managed worktree cleanup ${result.outcome}: removed ${result.removed.length}`,
`deleted ${result.orphansDeleted} orphans`,
`retired ${result.orphansRetired} orphan records`,
...result.retiredCheckoutPaths.map((checkoutPath) => `preserved checkout: ${checkoutPath}`),
`pruned ${result.snapshotsPruned} snapshots`,
`protected ${result.protectedCount}`,
...Object.entries(result.protectionReasons).map(([reason, count]) => `${reason}: ${count}`),
`limits ${limits}`,
shown && `${shown}${omitted > 0 ? `; plus ${omitted} more` : ""}`
].filter(Boolean).join("; ") + ".";
}
//#endregion
export { formatWorktreeGcResult as t };