* fix(worktree): rmdir empty task parent after worktree removal (#1266)
removeWorktreeDir tore down only the inner {repoName}/ subdirectory under
{tasksBase}/{taskDirName}/, leaving the now-empty parent task directory
behind on every archive, delete, and rollback path. Husks accumulated
under ~/.kandev/tasks/ over time.
Now also attempts rmdir on the parent when it is a direct child of
TasksBasePath. os.Remove no-ops if the parent still has siblings or
workspace-scoped content, so multi-branch siblings and the tasksBase
itself are preserved.
* fix(worktree): normalize tasksBase path + cover multi-branch sibling case
Address PR #1267 review feedback:
- Apply filepath.Clean to ExpandedTasksBasePath() before comparing against
filepath.Dir(parent). A configured TasksBasePath with a trailing slash
or doubled separators previously fell through the equality guard,
silently re-introducing the issue-1266 husk for those users.
- Use cfg.ExpandedTasksBasePath() in the regression test for consistency
with production code.
- Add two test cases:
- multi-branch sibling worktrees share a parent; removing one preserves
the parent, removing both clears it.
- trailing-slash TasksBasePath still triggers cleanup.
* test(worktree): check ExpandedTasksBasePath error in tasksbase survival assert
---------
Co-authored-by: Kandev Agent <agent@kandev.dev>