Plan, and optionally apply, worktree bucket consolidation. Returns a summary dict shaped for JSON printing by the CLI.
(home: Path | None = None, apply: bool = False)
| 320 | |
| 321 | |
| 322 | def run_migration(home: Path | None = None, apply: bool = False) -> dict[str, Any]: |
| 323 | """Plan, and optionally apply, worktree bucket consolidation. |
| 324 | |
| 325 | Returns a summary dict shaped for JSON printing by the CLI. |
| 326 | """ |
| 327 | plan = plan_migration(home=home) |
| 328 | result: dict[str, Any] = plan.to_dict() |
| 329 | result["applied"] = False |
| 330 | result["apply_results"] = [] |
| 331 | if apply and plan.plans: |
| 332 | for bucket_plan in plan.plans: |
| 333 | result["apply_results"].append(_apply_one(bucket_plan)) |
| 334 | result["applied"] = True |
| 335 | return result |