Skip to content

Conversation

@dermatz
Copy link
Collaborator

@dermatz dermatz commented Jan 17, 2026

Improve Hyvä Compatibility Check UX and Code Quality

Problem

The Hyvä compatibility checker had several UX and code quality issues:

  • Used MultiSelectPrompt with mutually exclusive options (e.g., "show-all" vs "incompatible-only")
  • Displayed [ERROR] box when finding compatibility issues, suggesting MageForge was broken rather than modules having issues
  • Magic strings throughout the code instead of constants
  • Exception handling could leave terminal in broken state
  • No spacing before exit, making error message appear cramped

Solution

Refactored interactive mode to use logical prompt flow and improved messaging:

1. Replace MultiSelect with Sequential Prompts

  • SelectPrompt for display mode (issues | incompatible-only | show-all)
  • SelectPrompt for module scope (third-party | all)
  • ConfirmPrompt for detailed view (yes | no)

2. Improved Result Messaging

  • Changed $io->error() to informative writeln() with icons
  • Clear context: "Found X issues in Y scanned modules"
  • Explains that modules need modifications, not MageForge

3. Code Quality Improvements

  • Added class constants for all magic strings (DISPLAY_MODE_*, SCOPE_*)
  • Changed \Exception to \Throwable for comprehensive error catching
  • Moved terminal cleanup to finally block for guaranteed execution
  • Added spacing before exit for better readability

Changes

  • ✅ Replace MultiSelectPrompt with SelectPrompt and ConfirmPrompt
  • ✅ Add constants: DISPLAY_MODE_ISSUES, DISPLAY_MODE_INCOMPATIBLE_ONLY, DISPLAY_MODE_SHOW_ALL, SCOPE_THIRD_PARTY, SCOPE_ALL
  • ✅ Replace all magic string comparisons with constants
  • ✅ Change error box to informative message with warning icon (⚠)
  • ✅ Include module count in result message ("in 394 scanned modules")
  • ✅ Move restoreTty() and resetPromptEnvironment() to finally block
  • ✅ Add newLine() before exit for spacing

Testing

# Test interactive mode
ddev magento m:h:c:c

# Test with options (non-interactive)
ddev magento m:h:c:c --show-all
ddev magento m:h:c:c --include-vendor
ddev magento m:h:c:c --detailed

# Test all aliases
ddev magento mageforge:hyva:compatibility:check
ddev magento hyva:check

@dermatz dermatz merged commit 428a133 into main Jan 17, 2026
8 checks passed
@dermatz dermatz deleted the fix-hyva-compatibility-checker-prompt branch January 17, 2026 00:21
@github-actions github-actions bot mentioned this pull request Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants