Skip to content

Conversation

@wasabeef
Copy link
Owner

@wasabeef wasabeef commented Jul 25, 2025

Description

This PR adds user confirmation prompts before executing lifecycle hooks (post-create, pre-remove, post-switch). Users are now shown the list of hooks that will be executed and can choose to proceed or skip execution.

Main changes:

  • Added execute_hooks_with_ui() function that accepts a UserInterface parameter
  • Shows expanded hook commands before execution
  • Prompts user with "Execute {hook_type} hooks?" (default: yes)
  • Maintains backward compatibility with legacy execute_hooks() wrapper
  • Added comprehensive tests for the confirmation functionality

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

  • Tests pass locally with cargo test
  • Added new tests for new functionality
  • Manual testing completed

Checklist

  • My code follows the style guidelines (cargo fmt)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings (cargo clippy)
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Example of hook confirmation prompt:

Running post-create hooks found:
  • echo '🤖 Created worktree: feature-xyz'
  • echo '🤖 Path: /workspace/feature-xyz'

Execute post-create hooks? (Y/n)

@wasabeef wasabeef added the enhancement New feature or request label Jul 25, 2025
@github-actions
Copy link

Code Metrics Report

Coverage Test Execution Time
64.6% 2m31s

Code coverage of files in pull request scope (86.4%)

Files Coverage
src/infrastructure/hooks.rs 86.4%

Reported by octocov

@wasabeef wasabeef marked this pull request as ready for review July 25, 2025 08:05
@wasabeef wasabeef merged commit 44c3f48 into main Jul 25, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants