diff --git a/.agents/code-review.md b/.agents/code-review.md index 49b0e0b..90c1d45 100644 --- a/.agents/code-review.md +++ b/.agents/code-review.md @@ -8,8 +8,13 @@ This document provides guidance for AI assistants to help with code review for t Before submitting code for review, test it with WordPress Playground: -* [ ] Test in single site environment: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/blueprint.json&_t=5) -* [ ] Test in multisite environment: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/multisite-blueprint.json&_t=18) +* [ ] Test in single site environment: + [Open in WordPress Playground][playground-single] +* [ ] Test in multisite environment: + [Open in WordPress Playground][playground-multisite] + +[playground-single]: https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/blueprint.json&_t=5 +[playground-multisite]: https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/multisite-blueprint.json&_t=18 * [ ] Verify plugin functionality works in both environments * [ ] Check for any JavaScript errors in the browser console * [ ] Run Cypress tests locally: `npm run test:playground:single` and `npm run test:playground:multisite` @@ -257,10 +262,20 @@ In function `handle_remove_reference()`: 3. The success message should be translatable: ```php // Change this: - add_settings_error('fpden', 'fpden_removed', 'Plugin reference removed successfully.', 'updated'); + add_settings_error( + 'fpden', + 'fpden_removed', + 'Plugin reference removed successfully.', + 'updated' + ); // To this: - add_settings_error('fpden', 'fpden_removed', __('Plugin reference removed successfully.', 'fix-plugin-does-not-exist-notices'), 'updated'); + add_settings_error( + 'fpden', + 'fpden_removed', + __( 'Plugin reference removed successfully.', 'fix-plugin-does-not-exist-notices' ), + 'updated' + ); ``` ``` diff --git a/.agents/error-checking-feedback-loops.md b/.agents/error-checking-feedback-loops.md index b4c66b7..66a7c12 100644 --- a/.agents/error-checking-feedback-loops.md +++ b/.agents/error-checking-feedback-loops.md @@ -365,27 +365,13 @@ function get_plugin_version() { ... } ### Complete Feedback Loop System ``` -┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ -│ │ │ │ │ │ -│ Code Changes │────▶│ Local Testing │────▶│ GitHub Actions │ -│ │ │ │ │ │ -└────────┬────────┘ └────────┬────────┘ └────────┬────────┘ - │ │ │ - │ │ │ - │ │ │ -┌────────▼────────┐ ┌────────▼────────┐ ┌────────▼────────┐ -│ │ │ │ │ │ -│ AI Assistant │◀────│ Error Analysis │◀────│ Status Check │ -│ │ │ │ │ │ -└────────┬────────┘ └─────────────────┘ └─────────────────┘ - │ - │ - │ -┌────────▼────────┐ ┌─────────────────┐ -│ │ │ │ -│ Fix Generation │────▶│ Human Review │ (only when necessary) -│ │ │ │ -└─────────────────┘ └─────────────────┘ +Code Changes ──► Local Testing ──► GitHub Actions + │ │ │ + ▼ ▼ ▼ +AI Assistant ◀── Error Analysis ◀── Status Check + │ + ▼ +Fix Generation ──► Human Review (only when necessary) ``` ### Key Components diff --git a/.wiki/Playground-Testing.md b/.wiki/Playground-Testing.md index 17a68d2..747533c 100644 --- a/.wiki/Playground-Testing.md +++ b/.wiki/Playground-Testing.md @@ -17,9 +17,12 @@ It uses WebAssembly, which means: The easiest way to test our plugin with WordPress Playground is to use the online version: -1. Single site testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/blueprint.json&_t=2) +1. Single site testing: [Open in WordPress Playground][playground-single] -2. Multisite testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/multisite-blueprint.json&_t=2) +2. Multisite testing: [Open in WordPress Playground][playground-multisite] + +[playground-single]: https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/blueprint.json&_t=2 +[playground-multisite]: https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/multisite-blueprint.json&_t=2 These links automatically set up WordPress with multisite enabled and WP_DEBUG enabled. @@ -117,8 +120,8 @@ We have two blueprints for testing: To run tests with WordPress Playground: 1. Open the appropriate WordPress Playground link: - * [Single site](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/blueprint.json&_t=2) - * [Multisite](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/multisite-blueprint.json&_t=2) + * [Single site][playground-single] + * [Multisite][playground-multisite] 2. Test the plugin manually in the browser @@ -128,7 +131,8 @@ We've also included HTML files that embed WordPress Playground: 1. Open `playground/index.html` in your browser for single site testing 2. Open `playground/multisite.html` in your browser for multisite testing -3. Open `playground/test.html` in your browser for a unified interface with buttons to switch between single site and multisite +3. Open `playground/test.html` in your browser for a unified interface with buttons + to switch between single site and multisite You can serve these files locally with a simple HTTP server: @@ -169,7 +173,9 @@ This will start a local WordPress instance with your plugin installed and activa You can customize the blueprints to suit your testing needs. -See the [WordPress Playground Blueprints documentation](https://wordpress.github.io/wordpress-playground/blueprints/) for details. +See the [WordPress Playground Blueprints documentation][blueprints-docs] for details. + +[blueprints-docs]: https://wordpress.github.io/wordpress-playground/blueprints/ ## WordPress Playground JavaScript API diff --git a/.wiki/Testing.md b/.wiki/Testing.md index 9f45a2b..8687875 100644 --- a/.wiki/Testing.md +++ b/.wiki/Testing.md @@ -134,9 +134,12 @@ WordPress Playground runs WordPress entirely in the browser using WebAssembly. T The easiest way to test our plugin with WordPress Playground is to use the online version: -1. Single site testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/blueprint.json&_t=2) +1. Single site testing: [Open in WordPress Playground][playground-single] -2. Multisite testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/multisite-blueprint.json&_t=2) +2. Multisite testing: [Open in WordPress Playground][playground-multisite] + +[playground-single]: https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/blueprint.json&_t=2 +[playground-multisite]: https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/main/playground/multisite-blueprint.json&_t=2 These links automatically set up WordPress with multisite enabled and WP_DEBUG enabled. @@ -148,7 +151,8 @@ We've also included HTML files that embed WordPress Playground: 1. Open `playground/index.html` in your browser for single site testing 2. Open `playground/multisite.html` in your browser for multisite testing -3. Open `playground/test.html` in your browser for a unified interface with buttons to switch between single site and multisite +3. Open `playground/test.html` in your browser for a unified interface with buttons + to switch between single site and multisite You can serve these files locally with a simple HTTP server: diff --git a/AGENTS.md b/AGENTS.md index 8b7ce8b..7f16763 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -99,17 +99,23 @@ For local testing with WordPress Playground, LocalWP, and wp-env, see **@.agents When working in a multi-repository workspace, follow these guidelines to avoid confusion: -1. **Verify Repository Context**: Always check which repository you're currently working in before making any changes or recommendations. +1. **Verify Repository Context**: Always check which repository you're currently working in + before making any changes or recommendations. -2. **Limit Code Search Scope**: When searching for code or functionality, explicitly limit your search to the current repository. +2. **Limit Code Search Scope**: When searching for code or functionality, + explicitly limit your search to the current repository. -3. **Don't Assume Features**: Never assume that features present in one repository should be implemented in another. Each repository has its own specific purpose and feature set. +3. **Don't Assume Features**: Never assume that features present in one repository + should be implemented in another. Each repository has its own specific purpose and feature set. -4. **Repository-Specific Documentation**: Documentation should only reflect the actual features and functionality of the current repository. +4. **Repository-Specific Documentation**: Documentation should only reflect the actual features + and functionality of the current repository. -5. **Cross-Repository Inspiration**: If you want to implement a feature inspired by another repository, explicitly mention that it's a new feature being added, not an existing one. +5. **Cross-Repository Inspiration**: If you want to implement a feature inspired by another + repository, explicitly mention that it's a new feature being added, not an existing one. -6. **Verify Before Implementation**: Before implementing or documenting a feature, verify that it actually exists in the current repository by checking the codebase. +6. **Verify Before Implementation**: Before implementing or documenting a feature, verify that + it actually exists in the current repository by checking the codebase. 7. **Consistent Markdown Formatting**: Always use asterisks (*) for bullet points in Markdown files, not hyphens (-). @@ -161,7 +167,9 @@ When working with this repository, remember these preferences: 3. Keep code modular and maintainable 4. Reference these preferences in future interactions -This ensures consistency across coding sessions and reduces the need for developers to repeatedly explain their preferences. +This ensures consistency across coding sessions. + +It reduces the need for developers to repeatedly explain their preferences. ## Autonomous CI/CD and Error Handling @@ -175,7 +183,8 @@ As an AI assistant, you should: 4. **Verify Solutions**: Ensure fixes pass all tests and quality checks 5. **Document Resolutions**: Update documentation with solutions for future reference -For detailed instructions on establishing feedback loops and error checking processes, see **@.agents/error-checking-feedback-loops.md**. +For detailed instructions on feedback loops and error checking, see +**@.agents/error-checking-feedback-loops.md**. ### When to Consult Humans diff --git a/README.md b/README.md index a15c90d..9a0d93b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,33 @@ # WordPress Plugin Starter Template for AI Coding -[![License](https://img.shields.io/badge/license-GPL--2.0%2B-blue.svg)](https://www.gnu.org/licenses/gpl-2.0.html) [![Build Status](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/actions/workflows/tests.yml/badge.svg)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/actions/workflows/tests.yml) [![Requires PHP](https://img.shields.io/badge/php-%3E%3D%207.4-blue.svg)](https://wordpress.org/about/requirements/) [![Requires WordPress](https://img.shields.io/badge/WordPress-%3E%3D%205.0-blue.svg)](https://wordpress.org/about/requirements/) [![Tested up to](https://img.shields.io/wordpress/plugin/tested/your-plugin-slug.svg)](https://wordpress.org/plugins/your-plugin-slug/) [![WordPress rating](https://img.shields.io/wordpress/plugin/r/your-plugin-slug.svg)](https://wordpress.org/plugins/your-plugin-slug/reviews/) [![WordPress downloads](https://img.shields.io/wordpress/plugin/dt/your-plugin-slug.svg)](https://wordpress.org/plugins/your-plugin-slug/) [![Latest Release](https://img.shields.io/github/v/release/wpallstars/wp-plugin-starter-template-for-ai-coding)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/releases) [![GitHub issues](https://img.shields.io/github/issues/wpallstars/wp-plugin-starter-template-for-ai-coding)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/issues) [![GitHub contributors](https://img.shields.io/github/contributors/wpallstars/wp-plugin-starter-template-for-ai-coding)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/graphs/contributors) [![Wiki](https://img.shields.io/badge/documentation-wiki-blue.svg)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/wiki) ![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/wpallstars/wp-plugin-starter-template-for-ai-coding?utm_source=oss&utm_medium=github&utm_campaign=wpallstars%2Fwp-plugin-starter-template-for-ai-coding&labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviews) [![CodeFactor](https://www.codefactor.io/repository/github/wpallstars/wp-plugin-starter-template-for-ai-coding/badge)](https://www.codefactor.io/repository/github/wpallstars/wp-plugin-starter-template-for-ai-coding) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=wpallstars_wp-plugin-starter-template-for-ai-coding&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=wpallstars_wp-plugin-starter-template-for-ai-coding) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=wpallstars_wp-plugin-starter-template-for-ai-coding&metric=bugs)](https://sonarcloud.io/summary/new_code?id=wpallstars_wp-plugin-starter-template-for-ai-coding) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=wpallstars_wp-plugin-starter-template-for-ai-coding&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=wpallstars_wp-plugin-starter-template-for-ai-coding) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=wpallstars_wp-plugin-starter-template-for-ai-coding&metric=coverage)](https://sonarcloud.io/summary/new_code?id=wpallstars_wp-plugin-starter-template-for-ai-coding) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=wpallstars_wp-plugin-starter-template-for-ai-coding&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=wpallstars_wp-plugin-starter-template-for-ai-coding) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/905754fd010b481490b496fb800e6144)](https://app.codacy.com/gh/wpallstars/wp-plugin-starter-template-for-ai-coding/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) +[![License][badge-license]][url-license] +[![Build Status][badge-build]][url-build] +[![Requires PHP][badge-php]][url-requirements] +[![Requires WordPress][badge-wp]][url-requirements] +[![Wiki][badge-wiki]][url-wiki] +[![CodeRabbit Reviews][badge-coderabbit]][url-coderabbit] +[![CodeFactor][badge-codefactor]][url-codefactor] +[![Quality Gate Status][badge-sonar-gate]][url-sonar] +[![Codacy Badge][badge-codacy]][url-codacy] + +[badge-license]: https://img.shields.io/badge/license-GPL--2.0%2B-blue.svg +[badge-build]: https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/actions/workflows/tests.yml/badge.svg +[badge-php]: https://img.shields.io/badge/php-%3E%3D%207.4-blue.svg +[badge-wp]: https://img.shields.io/badge/WordPress-%3E%3D%205.0-blue.svg +[badge-wiki]: https://img.shields.io/badge/documentation-wiki-blue.svg +[badge-coderabbit]: https://img.shields.io/coderabbit/prs/github/wpallstars/wp-plugin-starter-template-for-ai-coding?labelColor=171717&color=FF570A&label=CodeRabbit+Reviews +[badge-codefactor]: https://www.codefactor.io/repository/github/wpallstars/wp-plugin-starter-template-for-ai-coding/badge +[badge-sonar-gate]: https://sonarcloud.io/api/project_badges/measure?project=wpallstars_wp-plugin-starter-template-for-ai-coding&metric=alert_status +[badge-codacy]: https://app.codacy.com/project/badge/Grade/905754fd010b481490b496fb800e6144 + +[url-license]: https://www.gnu.org/licenses/gpl-2.0.html +[url-build]: https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/actions/workflows/tests.yml +[url-requirements]: https://wordpress.org/about/requirements/ +[url-wiki]: https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/wiki +[url-coderabbit]: https://coderabbit.ai +[url-codefactor]: https://www.codefactor.io/repository/github/wpallstars/wp-plugin-starter-template-for-ai-coding +[url-sonar]: https://sonarcloud.io/summary/new_code?id=wpallstars_wp-plugin-starter-template-for-ai-coding +[url-codacy]: https://app.codacy.com/gh/wpallstars/wp-plugin-starter-template-for-ai-coding/dashboard A comprehensive starter template for WordPress plugins with best practices for AI-assisted development. @@ -111,9 +138,14 @@ The template includes multiple testing approaches: Test your plugin directly in the browser without any local setup: -1. Single site testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=5) +1. Single site testing: + [Open in WordPress Playground][playground-single-readme] -2. Multisite testing: [Open in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=18) +2. Multisite testing: + [Open in WordPress Playground][playground-multisite-readme] + +[playground-single-readme]: https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=5 +[playground-multisite-readme]: https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=18 For more details, see the [Playground Testing](.wiki/Playground-Testing.md) documentation. diff --git a/includes/Multisite/README.md b/includes/Multisite/README.md index b1e8f79..f96e628 100644 --- a/includes/Multisite/README.md +++ b/includes/Multisite/README.md @@ -25,4 +25,5 @@ if ( is_multisite() ) { ## Testing -For information on testing your plugin in a multisite environment, see the [Testing Framework](../../.wiki/Testing.md) documentation. +For information on testing your plugin in a multisite environment, see the +[Testing Framework](../../.wiki/Testing.md) documentation.