Skip to content

Commit d476f86

Browse files
Copilotdermatz
andcommitted
Add GitHub Copilot instructions configuration
Co-authored-by: dermatz <6103201+dermatz@users.noreply.github.com>
1 parent 4619e91 commit d476f86

1 file changed

Lines changed: 136 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# GitHub Copilot Instructions for MageForge
2+
3+
## Project Overview
4+
5+
MageForge is a powerful CLI front-end development toolkit for Magento 2 that simplifies theme development workflows. It provides tools for many types of Magento themes (Magento Standard, Hyvä, Hyvä Fallback, Custom TailwindCSS, Avanta B2B) and can be easily extended for custom themes.
6+
7+
## Technology Stack
8+
9+
- **Platform**: Magento 2 (requires 2.4.7 or higher)
10+
- **Language**: PHP 8.3+
11+
- **Package Manager**: Composer
12+
- **Type**: magento2-module
13+
- **Dependencies**:
14+
- Laravel Prompts (for interactive CLI)
15+
- Magento Framework
16+
17+
## Coding Standards
18+
19+
### General PHP Standards
20+
21+
- **Follow Magento Coding Standards**: All PHP code must adhere to the Magento 2 Coding Standards
22+
- **PSR-4 Autoloading**: The project uses PSR-4 with namespace `OpenForgeProject\MageForge\`
23+
- **Type Declarations**: Use strict typing (`declare(strict_types=1);`) at the top of every PHP file
24+
- **Type Hints**: Always use type hints for parameters and return types
25+
- **Property Promotion**: Use PHP 8+ constructor property promotion with readonly where appropriate
26+
- **Documentation**: Use PHPDoc blocks for classes and methods
27+
28+
### Code Formatting
29+
30+
- **Indentation**: Use 4 spaces (not tabs) for indentation
31+
- **Line Length**: Keep lines under 80 characters wherever possible
32+
- **Naming Conventions**:
33+
- Classes: PascalCase
34+
- Methods and properties: camelCase
35+
- Constants: UPPER_SNAKE_CASE
36+
- Choose meaningful names for variables and functions
37+
- **Comments**: Write clear and concise comments where necessary
38+
39+
### Code Structure
40+
41+
- **Directory Structure**:
42+
- `src/Console/Command/` - CLI commands
43+
- `src/Service/` - Business logic services
44+
- `src/Model/` - Data models
45+
- `src/Exception/` - Custom exceptions
46+
- `src/Service/ThemeBuilder/` - Theme builder implementations
47+
- **Interfaces**: Use interfaces for builder patterns (e.g., `BuilderInterface`)
48+
- **Dependency Injection**: Use constructor injection with readonly properties
49+
50+
## Build and Validation
51+
52+
### Linting
53+
54+
- **PHPCS**: Use Magento Coding Standard for PHP code
55+
```bash
56+
composer create-project magento/magento-coding-standard --stability=dev /tmp/magento-coding-standard
57+
/tmp/magento-coding-standard/vendor/bin/phpcs -p -s --standard=Magento2 src/
58+
```
59+
- **Trunk**: Run `trunk check` to lint code before submission (if available)
60+
61+
### Testing
62+
63+
- Thoroughly test code before submitting
64+
- Test all CLI commands with various theme types
65+
- Ensure compatibility with Magento 2.4.7+
66+
67+
## Documentation
68+
69+
- **Format**: Use Markdown syntax for all documentation files
70+
- **Location**: Documentation files go in the `docs/` directory
71+
- **README**: Keep README.md updated with new features or commands
72+
- **Comments**: Provide descriptions for functions, classes, and parameters
73+
74+
## Git Workflow
75+
76+
### Commits
77+
78+
- **Format**: Use format `#<issue-number> - <commit message>`
79+
- **Example**: `#123 - Add support for custom theme builder`
80+
- **Messages**: Write clear, descriptive commit messages
81+
- **VSCode**: Use Git Commit Message Helper extension for proper formatting
82+
83+
### Pull Requests
84+
85+
1. Create an issue first to describe the feature/bug
86+
2. Fork the repository and create a branch for your work
87+
3. Make changes with clear commit messages
88+
4. Submit PR to merge into `main` branch
89+
5. Ensure all GitHub Actions checks pass
90+
91+
## Magento-Specific Guidelines
92+
93+
- **Module Registration**: Module is registered via `src/registration.php`
94+
- **Commands**: All CLI commands extend `AbstractCommand` and follow Magento command patterns
95+
- **Command Naming**: Use format `mageforge:<category>:<action>` (e.g., `mageforge:theme:build`)
96+
- **Shortcodes**: Provide shortcodes for commands (e.g., `m:t:b` for `mageforge:theme:build`)
97+
- **Dependency Injection**: Use Magento's dependency injection container
98+
- **Services**: Service classes should be in the `Service/` directory and follow single responsibility principle
99+
100+
## Theme Builder Development
101+
102+
When adding or modifying theme builders:
103+
104+
- Implement `BuilderInterface`
105+
- Place builders in `src/Service/ThemeBuilder/<ThemeType>/Builder.php`
106+
- Register builders with `BuilderPool`
107+
- Support both build and watch modes
108+
- Handle npm/node dependencies appropriately
109+
- Follow existing builder patterns (Magento Standard, Hyvä, TailwindCSS)
110+
111+
## Best Practices
112+
113+
- **Error Handling**: Use custom exceptions in the `Exception/` directory
114+
- **Console Output**: Use Symfony Console's IO helpers for consistent output
115+
- **Configuration**: Keep configuration flexible to support different theme types
116+
- **Extensibility**: Design features to be easily extended for custom themes
117+
- **Performance**: Optimize build processes for fast development workflows
118+
- **Compatibility**: Ensure compatibility with Magento 2.4.7+ requirements
119+
120+
## Common Commands
121+
122+
- `mageforge:theme:list` (or `m:t:l`) - List available themes
123+
- `mageforge:theme:build` (or `m:t:b`) - Build theme CSS/TailwindCSS
124+
- `mageforge:theme:watch` (or `m:t:w`) - Start watch mode for development
125+
- `mageforge:system:check` (or `m:s:c`) - Get system information
126+
- `mageforge:system:version` (or `m:s:v`) - Show version information
127+
128+
## License
129+
130+
This project is licensed under GPL-3.0. By contributing, you agree that your work will be licensed under the same terms.
131+
132+
## Community
133+
134+
- Report bugs and request features via GitHub Issues
135+
- Join the OpenForgeProject Discord community for support
136+
- Follow the Contributing Guidelines in CONTRIBUTING.md

0 commit comments

Comments
 (0)