diff --git a/.github/workflows/context7-refresh.yml b/.github/workflows/context7-refresh.yml new file mode 100644 index 0000000..311eaf8 --- /dev/null +++ b/.github/workflows/context7-refresh.yml @@ -0,0 +1,26 @@ +name: "🔄 - Refresh Context7" + +on: + push: + branches: + - main + +jobs: + refresh: + name: "🔄 - Trigger Context7 refresh" + if: github.repository == 'mage-os/devdocs' + runs-on: ubuntu-latest + + steps: + - name: "🔄 - Request re-index of /mage-os/devdocs" + env: + CONTEXT7_API_KEY: ${{ secrets.CONTEXT7_API_KEY }} + run: | + if [ -z "$CONTEXT7_API_KEY" ]; then + echo "CONTEXT7_API_KEY secret not set; skipping refresh." + exit 0 + fi + curl -sS --fail-with-body -X POST https://context7.com/api/v1/refresh \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $CONTEXT7_API_KEY" \ + -d '{"libraryName": "/mage-os/devdocs"}' diff --git a/best-practices-for-extension-development.md b/best-practices-for-extension-development.md index 7c63cbe..0f7aa7e 100644 --- a/best-practices-for-extension-development.md +++ b/best-practices-for-extension-development.md @@ -12,7 +12,7 @@ provided by Magento to ensure consistency across projects. Here's a typical directory structure for a Magento 2 extension: -``` +```plaintext ├── app │ └── code │ └── VendorName diff --git a/brief-explanation-of-each-component.md b/brief-explanation-of-each-component.md index 905d738..9d6ad8c 100644 --- a/brief-explanation-of-each-component.md +++ b/brief-explanation-of-each-component.md @@ -32,7 +32,7 @@ the `VendorName_ModuleName` naming convention. Example module structure: -``` +```plaintext app ├── code │ └── VendorName @@ -55,7 +55,7 @@ located in the `app/design` directory and allow for customization and branding o Example of a theme structure: -``` +```plaintext app ├── design │ └── frontend diff --git a/context7.json b/context7.json new file mode 100644 index 0000000..cf92558 --- /dev/null +++ b/context7.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://context7.com/schema/context7.json", + "url": "https://context7.com/mage-os/devdocs", + "public_key": "pk_HsBSv7f4tLBOYsckJH4BP", + "projectTitle": "Mage-OS", + "description": "Developer documentation for Mage-OS, a community-governed independent distribution of Magento Open Source, compatible with Magento 2 extensions and themes. Covers installation, module development, theming, APIs, testing, and XML configuration file references. Mage-OS 3.x also ships features Magento Open Source lacks, such as built-in Returns Management (RMA).", + "excludeFiles": [ + "README.md", + "CODEOWNERS", + "documentation.md", + "acl.md", + "cron_groups.md", + "db_schema.md", + "di.md", + "extension_attributes.md", + "fieldset.md", + "indexer.md", + "menu.md", + "routes.md", + "webapi.md", + "widget.md", + "rest-apis-soap-apis.md", + "the-magento-application-and-service-contracts.md" + ], + "rules": [ + "Mage-OS is an independent distribution of Magento Open Source. Write the product name as 'Mage-OS' (hyphenated, capital OS).", + "PHP class namespaces in Mage-OS are unchanged from Magento: use Magento\\Framework, Magento\\Catalog, and so on. Never rewrite these to Mage-OS.", + "The CLI entrypoint is bin/magento, not bin/mage-os.", + "Install Mage-OS with: composer create-project --repository-url=https://repo.mage-os.org/ mage-os/project-community-edition .", + "Mage-OS 3.x requires PHP 8.3, 8.4, or 8.5. Do not suggest PHP 8.1 or 8.2.", + "For new modules, declare database schema with db_schema.xml (declarative schema), the recommended approach since Magento 2.3. The older InstallSchema.php / UpgradeSchema.php classes still work and are still @api, but do not generate them for new code.", + "Prefer a plugin (interceptor) or an observer over class preferences in di.xml when extending core behaviour.", + "Returns Management (RMA) ships in core Mage-OS from 3.0.0: the mage-os/product-community-edition metapackage requires mage-os/module-rma. Do not tell Mage-OS 3.x users they need a third-party or Adobe Commerce extension for customer returns.", + "Mage-OS is compatible with existing Magento 2 extensions and themes." + ] +} diff --git a/css-preprocessing.md b/css-preprocessing.md index 1bc73b9..5c64f87 100644 --- a/css-preprocessing.md +++ b/css-preprocessing.md @@ -196,7 +196,7 @@ preprocessors in these environments, additional setup steps are required. Example of overriding a LESS file in a Magento 2 custom theme: -``` +```plaintext app/design/frontend/MyVendor/my-theme/web/css/source/_extend.less ``` diff --git a/developing-extensions-in-magento-2.md b/developing-extensions-in-magento-2.md index fe7afdd..ecedc8e 100644 --- a/developing-extensions-in-magento-2.md +++ b/developing-extensions-in-magento-2.md @@ -33,7 +33,7 @@ To get started with extension development, you will need the following: A Magento 2 extension follows a specific directory structure that Magento recognizes. Below is an example structure for a basic extension called "MyExtension": -``` +```plaintext MyExtension/ ├── etc/ │ ├── module.xml diff --git a/diagrams-to-visually-represent-the-architecture.md b/diagrams-to-visually-represent-the-architecture.md index 8cd9eea..085cee8 100644 --- a/diagrams-to-visually-represent-the-architecture.md +++ b/diagrams-to-visually-represent-the-architecture.md @@ -87,7 +87,7 @@ represent the architecture of a PHP and Magento 2 application. **High-Level System Diagram:** -``` +```plaintext +------------------+ +-----------------+ +-----------------+ | Frontend | | Backend | | Database | | |<------>| |<------>| | @@ -97,7 +97,7 @@ represent the architecture of a PHP and Magento 2 application. **Layered Architecture Diagram:** -``` +```plaintext +------------------+ | Presentation | | Layer | @@ -115,7 +115,7 @@ represent the architecture of a PHP and Magento 2 application. **Component Diagram:** -``` +```plaintext +-----------------+ | Frontend | | Component | @@ -130,7 +130,7 @@ represent the architecture of a PHP and Magento 2 application. **Sequence Diagram:** -``` +```plaintext Frontend -> Backend: Request Product Details Backend -> Database: Retrieve Product Data Database --> Backend: Return Product Data diff --git a/glossary-of-terms.md b/glossary-of-terms.md index b2be214..08de991 100644 --- a/glossary-of-terms.md +++ b/glossary-of-terms.md @@ -75,7 +75,7 @@ to extend or modify the behavior of the platform. Example: -``` +```plaintext app/code/Vendor/Module ``` diff --git a/graphql-apis.md b/graphql-apis.md index b20c13a..89b3a7e 100644 --- a/graphql-apis.md +++ b/graphql-apis.md @@ -19,7 +19,7 @@ PHP and Magento 2. You'll also need to have a valid authentication token to acce To authenticate and obtain an access token, you can use the Magento 2 token-based authentication system. Once you have the token, you can include it in the headers of your GraphQL requests as follows: -``` +```http Authorization: Bearer ``` @@ -170,7 +170,7 @@ Playground. To retrieve the GraphQL schema, you can send a request to the following endpoint: -``` +```plaintext https://yourmagentoinstallation.com/graphql/schema?query={__schema{types{name}}} ``` diff --git a/how-to-use-and-extend-apis.md b/how-to-use-and-extend-apis.md index cc6adf2..fcf5698 100644 --- a/how-to-use-and-extend-apis.md +++ b/how-to-use-and-extend-apis.md @@ -56,7 +56,7 @@ JSON (JavaScript Object Notation) and XML (eXtensible Markup Language). By default, Magento 2 APIs return JSON responses. However, you can specify the desired response format by setting the `Accept` header in your requests. For example, to request XML responses, you can include the following header: -``` +```http Accept: application/xml ``` @@ -65,7 +65,7 @@ Accept: application/xml Magento 2 provides a wide range of pre-defined API endpoints for different resources. These endpoints follow a consistent pattern: -``` +```plaintext https://example.com/rest/V1/{resource}/{id} ``` @@ -77,7 +77,7 @@ Where: Here are some examples of API endpoints: -``` +```http GET https://example.com/rest/V1/products GET https://example.com/rest/V1/products/10 POST https://example.com/rest/V1/products @@ -141,7 +141,7 @@ class CustomProducts implements HttpGetActionInterface Now, you can access your custom API endpoint using the following URL: -``` +```http GET https://example.com/rest/V1/custom-products ``` diff --git a/magento-2-coding-standards.md b/magento-2-coding-standards.md index acc296e..8b928bc 100644 --- a/magento-2-coding-standards.md +++ b/magento-2-coding-standards.md @@ -14,7 +14,7 @@ that is easy to read, understand, and maintain. A well-organized file structure is crucial for a Magento 2 project. Following a consistent structure helps in easily locating and managing files. The recommended file structure for a Magento 2 project is as follows: -``` +```plaintext app/ code/ / @@ -87,7 +87,7 @@ tools analyze the code against configured rules and highlight any violations. For example, to check coding standards using PHP_CodeSniffer, run the following command: -``` +```bash vendor/bin/phpcs --standard=PSR12 app/code/Vendor/Module/ ``` @@ -99,7 +99,7 @@ Magento 2 has its own set of coding standards specific to module development. Le A well-structured module enhances code organization. A typical module follows this structure: -``` +```plaintext app/ code/ / diff --git a/module-development.md b/module-development.md index 4542ae7..a1b9abe 100644 --- a/module-development.md +++ b/module-development.md @@ -18,7 +18,7 @@ concepts. A Magento 2 module is organized in the following directory structure: -``` +```plaintext app └── code └── Vendor @@ -273,7 +273,7 @@ In this example, we're creating a table named `custom_table` with three columns: 3. Run the whitelist generation command: -``` +```bash bin/magento setup:db-declaration:generate-whitelist --module-name=Vendor_Module ``` diff --git a/theme-development.md b/theme-development.md index 2ecd4e3..8c6e764 100644 --- a/theme-development.md +++ b/theme-development.md @@ -80,7 +80,7 @@ You can specify a preview image for your theme using the following XML configura Ensure that the specified image file exists in your theme directory. If it doesn't, running `bin/magento setup:upgrade` will produce an error: -``` +```plaintext File "app/design/frontend/Acme/MyTheme/media/preview.jpg" does not exist. ``` diff --git a/troubleshooting-common-installation-issues.md b/troubleshooting-common-installation-issues.md index bc490c4..ce29464 100644 --- a/troubleshooting-common-installation-issues.md +++ b/troubleshooting-common-installation-issues.md @@ -62,7 +62,7 @@ This ensures the necessary read, write, and execute permissions are set correctl Magento 2 relies on various PHP extensions to function properly. If you encounter an error indicating a missing extension, you need to install it. Here's an example: -``` +```plaintext PHP Extension xsl is not loaded. ``` @@ -83,7 +83,7 @@ file (`php.ini`). Locate the `memory_limit` directive and adjust its value to a higher limit. For example: -``` +```ini memory_limit = 512M ``` diff --git a/web-api.md b/web-api.md index 2eb9bc8..dd5218f 100644 --- a/web-api.md +++ b/web-api.md @@ -44,7 +44,7 @@ curl -X POST \ Magento's Web API provides a wide range of endpoints to interact with various resources such as customers, products, orders, and more. Each endpoint follows a consistent URL structure: -``` +```plaintext https://your-magento-installation.com/rest// ```