Skip to content

Conversation

@dermatz
Copy link
Collaborator

@dermatz dermatz commented Jan 9, 2026

  • New command: mageforge:hyva:compatibility:check (aliases: m:h:c:c, hyva:check)
  • Scans Magento modules for Hyvä theme incompatibilities
  • Detects RequireJS, Knockout.js, jQuery, UI Components usage
  • Options: --show-all, --third-party-only, --include-vendor, --detailed
  • Service layer: CompatibilityChecker, ModuleScanner, IncompatibilityDetector
  • Exit code 1 for critical issues, 0 for success
  • Updated CI/CD workflow and documentation
image image

- New command: mageforge:hyva:compatibility:check (aliases: m:h:c:c, hyva:check)
- Scans Magento modules for Hyvä theme incompatibilities
- Detects RequireJS, Knockout.js, jQuery, UI Components usage
- Options: --show-all, --third-party-only, --include-vendor, --detailed
- Service layer: CompatibilityChecker, ModuleScanner, IncompatibilityDetector
- Exit code 1 for critical issues, 0 for success
- Updated CI/CD workflow and documentation
Copilot AI review requested due to automatic review settings January 9, 2026 23:53
- Changed default behavior from 0 modules to third-party modules (18)
- Without flags: Scans third-party only (excludes Magento_*)
- With --include-vendor: Scans all 394 modules including Magento core
- Updated documentation to reflect new default behavior
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a comprehensive Hyvä theme compatibility checker command to MageForge, enabling developers to scan Magento modules for incompatibilities with the Hyvä theme framework. The command detects RequireJS, Knockout.js, jQuery, and UI Components usage that would be problematic in a Hyvä environment.

Key changes:

  • New CLI command with multiple aliases (mageforge:hyva:compatibility:check, m:h:c:c, hyva:check)
  • Service layer architecture with three dedicated classes for scanning, detection, and orchestration
  • Pattern-based detection for JavaScript, XML, and PHTML files with severity classification
  • Multiple filtering options and detailed reporting capabilities
  • CI/CD integration and comprehensive documentation

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 25 comments.

Show a summary per file
File Description
src/etc/di.xml Registers the new CompatibilityCheckCommand in Magento's dependency injection configuration
src/Console/Command/Hyva/CompatibilityCheckCommand.php Main command class implementing the CLI interface with options for filtering and detailed output
src/Service/Hyva/CompatibilityChecker.php Orchestrator service that coordinates module scanning and result formatting
src/Service/Hyva/ModuleScanner.php Service for recursively scanning module directories and checking for Hyvä compatibility packages
src/Service/Hyva/IncompatibilityDetector.php Pattern matching service that detects incompatible code patterns in various file types
docs/commands.md Comprehensive documentation of the new command including usage examples, patterns detected, and recommendations
.github/workflows/magento-compatibility.yml Updated CI workflow to test the new command with help output validation

'severity' => self::SEVERITY_WARNING,
],
[
'pattern' => '/mage\//',
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern for detecting Magento RequireJS module references (/mage\//) on line 40 is too broad. This will match any occurrence of the string "mage/" including in comments, strings, or URLs. Consider using a more specific pattern that checks for RequireJS context, such as within define() or require() calls, or as part of a path string in quotes.

Suggested change
'pattern' => '/mage\//',
'pattern' => '/(?:define|require)\s*\(\s*\[[^\]]*["\']mage\/[^"\']*["\']/',

Copilot uses AI. Check for mistakes.
@dermatz dermatz changed the title Add Hyvä compatibility checker command [WIP] Add Hyvä compatibility checker command Jan 10, 2026
@dermatz dermatz marked this pull request as draft January 10, 2026 00:01
- Interactive mode activated when no options provided
- Multi-select menu for scan options:
  * Show all modules
  * Include Magento core modules
  * Detailed file-level issues
- Displays selected configuration before scan
- Falls back to direct mode if interactive fails
- Consistent with theme:build command UX
- New option: Show only incompatible modules (pre-selected by default)
- Improves UX by filtering out compatible modules
- Users can still choose 'Show all' for complete overview
- Configuration display updated to reflect selection
Copy link
Contributor

Copilot AI commented Jan 10, 2026

@dermatz I've opened a new pull request, #60, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Jan 10, 2026

@dermatz I've opened a new pull request, #61, to work on those changes. Once the pull request is ready, I'll request review from you.

@dermatz dermatz marked this pull request as ready for review January 10, 2026 00:18
dermatz and others added 3 commits January 10, 2026 01:18
* Initial plan

* Add actual execution tests for Hyvä compatibility checker command

Co-authored-by: dermatz <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: dermatz <[email protected]>
Co-authored-by: Mathias Elle <[email protected]>
#61)

* Initial plan

* Clarify exit code documentation for Hyvä compatibility checker

Co-authored-by: dermatz <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: dermatz <[email protected]>
Co-authored-by: Mathias Elle <[email protected]>
@dermatz dermatz changed the title [WIP] Add Hyvä compatibility checker command add Hyvä compatibility checker command Jan 10, 2026
@dermatz dermatz requested a review from Morgy93 January 10, 2026 00:23
@OpenForgeProject OpenForgeProject deleted a comment from Copilot AI Jan 10, 2026
@OpenForgeProject OpenForgeProject deleted a comment from Copilot AI Jan 10, 2026
@dermatz dermatz enabled auto-merge January 10, 2026 11:31
@dermatz
Copy link
Collaborator Author

dermatz commented Jan 12, 2026

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Jan 12, 2026

@dermatz I've opened a new pull request, #64, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 11 comments.

Comment on lines 372 to 374
// Additional check: try to detect if running in a proper TTY
$sttyOutput = shell_exec('stty -g 2>/dev/null');
return !empty($sttyOutput);
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shell_exec call at line 373 executes a system command without proper validation or sanitization. While 'stty -g 2>/dev/null' is a static string here, using shell_exec can be risky. Consider using a safer alternative or at least document why this approach is necessary for TTY detection.

Suggested change
// Additional check: try to detect if running in a proper TTY
$sttyOutput = shell_exec('stty -g 2>/dev/null');
return !empty($sttyOutput);
// Additional check: detect if running in a proper TTY without using shell_exec
if (\function_exists('stream_isatty')) {
return @\stream_isatty(STDIN);
}
if (\function_exists('posix_isatty')) {
return @\posix_isatty(\STDIN);
}
// Conservative default if no TTY-detection functions are available
return false;

Copilot uses AI. Check for mistakes.
@dermatz
Copy link
Collaborator Author

dermatz commented Jan 12, 2026

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Jan 12, 2026

@dermatz I've opened a new pull request, #65, to work on those changes. Once the pull request is ready, I'll request review from you.

…terns, enhance security (#65)

* Initial plan

* Apply code review feedback: fix duplicate di.xml, improve regex patterns, safer environment handling

Co-authored-by: dermatz <[email protected]>

* Replace error suppression with explicit exception handling in TTY detection

Co-authored-by: dermatz <[email protected]>

* Fix RequireJS pattern regex to properly match module references

Co-authored-by: dermatz <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: dermatz <[email protected]>
@dermatz dermatz disabled auto-merge January 12, 2026 08:54
@dermatz dermatz enabled auto-merge (squash) January 12, 2026 08:55
@dermatz dermatz disabled auto-merge January 12, 2026 09:03
@dermatz dermatz merged commit 2a05707 into main Jan 12, 2026
8 checks passed
@dermatz dermatz deleted the feature-hyva-compat-checker branch January 12, 2026 09:03
@dermatz dermatz restored the feature-hyva-compat-checker branch January 12, 2026 09:13
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