Skip to content

Commit 85eed54

Browse files
committed
Add confirmation when changing mobs dir with existing mobs
Abort init if user declines, with clear warning that worktrees will remain on disk but codemob will no longer track them. Also show init prompts for pre-feature configs missing repo_root.
1 parent 30ef7ea commit 85eed54

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

internal/mob/init.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,14 @@ func setupRepo(reprompt bool) string {
672672
if !isNew && oldMobsDir != cfg.MobsDirPath && len(cfg.Mobs) > 0 {
673673
fmt.Println()
674674
errMsg(fmt.Sprintf("You have %d existing mob(s) at the old location.", len(cfg.Mobs)))
675-
fmt.Println(" They will be orphaned and removed from config on the next operation.")
676-
fmt.Println(" Consider running 'codemob purge' first, or keep the current directory.")
675+
fmt.Println(" codemob will no longer track them, but the worktrees will remain on disk.")
676+
fmt.Println(" Run 'codemob purge' or 'codemob remove' first to clean them up.")
677+
fmt.Print("\nContinue anyway? [y/N]: ")
678+
input, _ = reader.ReadString('\n')
679+
if v := strings.TrimSpace(strings.ToLower(input)); v != "y" && v != "yes" {
680+
fmt.Println("Cancelled.")
681+
return root
682+
}
677683
}
678684

679685
if resolved, err := filepath.EvalSymlinks(root); err == nil {

0 commit comments

Comments
 (0)