Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 9, 2026

Implementation Plan for mageforge:static:clean Command

  • Understand the repository structure and existing command patterns
  • Create the Static directory under Console/Command
  • Create CleanCommand.php following existing command patterns
  • Register the command in di.xml
  • Update documentation (README.md and commands.md)
  • Address code review feedback (extract theme parsing logic)
  • Fix shortcode documentation issue
  • Run security checks with codeql_checker
  • Add additional directory cleaning (var/page_cache, var/tmp, generated)
  • Update documentation for new directories
  • Fix cleanGenerated method to track successful deletions
  • Add multi-theme support and dry-run option
  • Fix alias conflict (m:s:c → m:st:c)
  • Optimize global directory cleanup (clean only once)
  • Update documentation with all command options
  • Fix static cache variable handling completely

Summary

All code review feedback has been successfully addressed:

Fixes Applied:

  1. Alias Conflict - Changed from m:s:c to m:st:c to avoid conflict with system:check
  2. Global Cleanup Optimization - Global directories now cleaned only once using instance flag
  3. Static Cache Fix - Changed getCachedEnvironmentVariables from function-scoped static to class-level static variable for proper cache management with clearEnvironmentCache
  4. Description Clarity - Updated command description to distinguish theme-specific vs global directories
  5. Documentation Accuracy - Removed incorrect .htaccess preservation claim
  6. Documentation Completeness - Added examples for all options (single/multiple themes, --all, --dry-run)
  7. Interactive Behavior - Documented difference between interactive and non-interactive terminal behavior

Final Implementation:

  • Clean single or multiple themes
  • Interactive multi-select for theme selection
  • --all flag to clean all themes
  • --dry-run for previewing changes
  • Aliases: m:st:c, frontend:clean
  • Optimized: Global directories cleaned once per execution
Original prompt

This section details on the original issue you should resolve

<issue_title>Feature-Request: clean-up command</issue_title>
<issue_description>Clean var/view_preprocessed/* and pub/static/* folder for the specific theme which will be build

Command-Name:

mageforge:static:clean
mageforge:static:clean themename

Source-Branch: main</issue_description>

<agent_instructions>Source-Branch: main</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits January 9, 2026 07:48
Co-authored-by: dermatz <6103201+dermatz@users.noreply.github.com>
Co-authored-by: dermatz <6103201+dermatz@users.noreply.github.com>
Co-authored-by: dermatz <6103201+dermatz@users.noreply.github.com>
Co-authored-by: dermatz <6103201+dermatz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add clean-up command for static files Add mageforge:static:clean command for theme-specific cache cleanup Jan 9, 2026
Copilot AI requested a review from dermatz January 9, 2026 07:52
Copilot AI and others added 2 commits January 9, 2026 22:21
Co-authored-by: dermatz <6103201+dermatz@users.noreply.github.com>
Co-authored-by: dermatz <6103201+dermatz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 9, 2026

@copilot können wir auch diese ordner berücksichtigen?
var/page_cache/* var/tmp/* var/view_preprocessed/* pub/static/* generated/*

Ja, alle gewünschten Ordner wurden hinzugefügt. Der Befehl bereinigt jetzt:

Theme-spezifische Verzeichnisse:

  • var/view_preprocessed/css/frontend/Vendor/theme
  • var/view_preprocessed/source/frontend/Vendor/theme
  • pub/static/frontend/Vendor/theme

Globale Verzeichnisse:

  • var/page_cache/*
  • var/tmp/*
  • generated/* (.htaccess wird beibehalten)

Commit: 5596b42

Copilot AI changed the title Add mageforge:static:clean command for theme-specific cache cleanup Add mageforge:static:clean command for comprehensive cache and generated files cleanup Jan 9, 2026
@dermatz dermatz requested a review from Morgy93 January 9, 2026 22:59
@dermatz dermatz marked this pull request as ready for review January 9, 2026 22:59
Copilot AI review requested due to automatic review settings January 9, 2026 22:59
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 pull request adds a new mageforge:static:clean command that provides comprehensive cache and generated files cleanup functionality for Magento 2 themes, avoiding the overhead of a full cache flush.

Key Changes:

  • New command with support for single theme, multiple themes, or all themes at once
  • Interactive multi-select theme picker using Laravel Prompts for non-argument invocations
  • Dry-run mode to preview deletions without executing them

Reviewed changes

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

Show a summary per file
File Description
src/Console/Command/Static/CleanCommand.php New command implementation with theme-specific and global directory cleaning logic
src/etc/di.xml Registers the new CleanCommand in Magento's DI container
docs/commands.md Documents the new command with usage examples and implementation details
README.md Adds command to the available commands table
CHANGELOG.md Records new features and changes in the unreleased section
.github/workflows/magento-compatibility.yml Adds CI/CD tests for the new command with dry-run and alias tests

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
dermatz and others added 2 commits January 10, 2026 00:07
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
dermatz and others added 8 commits January 10, 2026 00:08
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: dermatz <6103201+dermatz@users.noreply.github.com>
Copilot AI requested a review from dermatz January 9, 2026 23:14
@dermatz dermatz enabled auto-merge (squash) January 10, 2026 11:32
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.

Feature-Request: clean-up command

2 participants