Skip to content

Improve stow conflict handling in setup.sh #118

@joshukraine

Description

@joshukraine

Summary

Improve the setup script's conflict detection and handling to prevent failures like those reported in #117. The current implementation only checks a predefined list of files for conflicts, but stow may encounter additional conflicts during execution.

Problem

  • Setup script fails when encountering unexpected stow conflicts
  • Current conflict detection only covers predefined files
  • No graceful recovery when stow operations fail
  • Users must manually resolve conflicts and re-run entire setup

Proposed Solution

1. Proactive Conflict Detection

  • Add detect_stow_conflicts() function using stow --simulate
  • Detect ALL potential conflicts before making any changes
  • Provide clear reporting of which packages have conflicts

2. Improved Error Handling

  • Create run_stow_command() wrapper with better error detection
  • Continue processing other packages when one fails
  • Provide specific resolution steps for each type of conflict

3. User Choice for Conflict Resolution

  • Interactive prompt: backup, adopt, skip, or quit
  • Command-line flags for automation:
    • --force: Don't prompt for user input
    • --strategy=[backup|adopt|skip]: Set conflict resolution strategy

4. Enhanced Setup Flow

  • Run conflict detection before any stow operations
  • Handle conflicts based on user preference
  • Report summary of successful/skipped/failed packages

Implementation Tasks

  • Add detect_stow_conflicts() function
  • Create run_stow_command() wrapper
  • Update setup_symlinks() with new conflict handling
  • Add command-line argument parsing
  • Update usage/help documentation
  • Test with various conflict scenarios

Benefits

  • Prevents setup failures due to existing config files
  • Gives users control over conflict resolution
  • Makes setup script more robust and user-friendly
  • Enables automated/CI usage with --force flag

Fixes #117

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions