diff --git a/PR-DESCRIPTION.md b/PR-DESCRIPTION.md new file mode 100644 index 0000000..fa22b64 --- /dev/null +++ b/PR-DESCRIPTION.md @@ -0,0 +1,51 @@ +# Add Comprehensive Testing Framework for Single Site and Multisite + +This PR adds a comprehensive testing framework for our WordPress plugin template that allows testing in both single site and multisite WordPress environments. The focus is purely on testing functionality, not on adding any multisite-specific features to the plugin itself. + +## Changes + +- Added wp-env configuration for both single site and multisite environments +- Created Cypress e2e tests for both environments +- Added GitHub Actions workflow to run tests automatically on PRs +- Created a unified setup script for test environments +- Added detailed documentation in the wiki +- Updated README.md to reference the new testing approach +- Added placeholder files for multisite functionality + +## Testing + +The testing framework can be used as follows: + +### Single Site Testing + +```bash +# Set up single site environment +npm run setup:single + +# Run tests in interactive mode +npm run test:single + +# Run tests in headless mode +npm run test:single:headless +``` + +### Multisite Testing + +```bash +# Set up multisite environment +npm run setup:multisite + +# Run tests in interactive mode +npm run test:multisite + +# Run tests in headless mode +npm run test:multisite:headless +``` + +## Documentation + +Detailed documentation is available in the [Testing Framework](.wiki/Testing-Framework.md) wiki page. + +## Inspiration + +This implementation was inspired by the e2e testing approach mentioned in [wp-multisite-waas issue #55](https://github.com/superdav42/wp-multisite-waas/issues/55), but focuses specifically on testing our plugin in different WordPress environments without adding any of the domain mapping or other multisite-specific functionality from that plugin. diff --git a/wiki/Changelog.md b/wiki/Changelog.md deleted file mode 100644 index d9e1f2b..0000000 --- a/wiki/Changelog.md +++ /dev/null @@ -1,86 +0,0 @@ -# Changelog - -All notable changes to this project should be documented both here and in the main Readme files. - -#### [0.1.9] - 2025-04-18 - -#### Changed - -- Alphabetized AI IDE list in README.md - -#### [0.1.8] - 2025-04-19 - -#### Added - -- More informative badges to README.md (Build Status, Requirements, WP.org placeholders, Release, Issues, Contributors, Wiki). - -#### [0.1.7] - 2025-04-19 - -#### Fixed - -- GitHub Actions tests workflow with proper file paths and dependencies - -#### Improved - -- Workflow names for better clarity in GitHub Actions UI - -#### [0.1.6] - 2025-04-19 - -#### Fixed - -- GitHub Actions workflows permissions for releases and wiki sync - -#### [0.1.5] - 2025-04-19 - -#### Fixed - -- Release workflow to use correct plugin directory name - -#### Added - -- Testing setup with wp-env and Cypress -- Multisite compatibility -- npm scripts for development and testing - -#### [0.1.3] - 2025-04-19 - -#### Added - -- Improved AI IDE context recommendations in documentation -- Enhanced Starter Prompt with guidance on pinning .ai-assistant.md and .ai-workflows/ - -#### Changed - -- Updated README.md and readme.txt with AI IDE context recommendations -- Improved documentation for AI-assisted development -- Moved Starter Prompt to the wiki for better organization - -#### [0.1.2] - 2025-04-18 - -#### Added - -- STARTER-PROMPT.md with comprehensive guide for customizing the template -- Additional AI workflow files for better development guidance - -#### Changed - -- Updated documentation files with improved instructions - -#### [0.1.1] - 2025-04-18 - -#### Changed - -- Updated LICENSE file with correct GPL-2.0 text - -#### [0.1.0] - 2025-04-17 - -#### Added - -- Initial release with basic template structure -- Core plugin architecture with OOP approach -- Admin interface components and styling -- Update mechanism with multiple source options -- Documentation templates for users and developers -- AI workflow documentation for AI-assisted development -- GitHub Actions workflows for automated tasks -- Wiki documentation templates diff --git a/wiki/Coding-Standards.md b/wiki/Coding-Standards.md deleted file mode 100644 index c2efa87..0000000 --- a/wiki/Coding-Standards.md +++ /dev/null @@ -1,290 +0,0 @@ -# Coding Standards - -This document outlines the coding standards used in this plugin. Following these standards ensures consistency, readability, and maintainability of the codebase. - -## PHP Coding Standards - -This plugin follows the [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/) with some additional guidelines. - -### File Structure - -* Each PHP file should begin with the PHP opening tag ` Add New**. -3. Search for "WordPress Plugin Starter Template". -4. Click **Install Now** next to the plugin. -5. After installation, click **Activate**. - -### Method 2: Manual Installation - -1. Download the latest release from the [GitHub repository](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/releases). -2. Log in to your WordPress admin dashboard. -3. Navigate to **Plugins > Add New**. -4. Click the **Upload Plugin** button at the top of the page. -5. Click **Choose File** and select the downloaded ZIP file. -6. Click **Install Now**. -7. After installation, click **Activate**. - -### Method 3: Using as a Template for Your Plugin - -1. Clone or download the repository: - ```bash - git clone https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding.git your-plugin-name - ``` - -2. Navigate to your plugin directory: - ```bash - cd your-plugin-name - ``` - -3. Rename files and update namespaces: - - Rename `wp-plugin-starter-template.php` to your plugin name (e.g., `your-plugin-name.php`) - - Update the namespace from `WPALLSTARS\PluginStarterTemplate` to your own - - Update text domain from `wp-plugin-starter-template` to your own - -4. Update plugin headers in the main PHP file. - -5. Install dependencies: - ```bash - composer install - ``` - -6. Upload the plugin to your WordPress site or use the local development script: - ```bash - ./scripts/deploy-local.sh - ``` - -## Post-Installation - -After installing and activating the plugin, you should: - -1. Review the plugin settings (if applicable). -2. Customize the plugin for your specific needs. -3. Update documentation to reflect your plugin's features. - -## Troubleshooting Installation Issues - -If you encounter any issues during installation, please check the following: - -1. **Plugin Conflicts**: Deactivate other plugins to check for conflicts. -2. **Server Requirements**: Ensure your server meets the minimum requirements. -3. **File Permissions**: Check that your WordPress installation has the correct file permissions. -4. **Memory Limit**: Increase PHP memory limit if you encounter memory-related errors. - -## Next Steps - -After installation, refer to the [Usage Instructions](Usage-Instructions) to learn how to use and customize the plugin. diff --git a/wiki/Starter-Prompt.md b/wiki/Starter-Prompt.md deleted file mode 100644 index fa26ffe..0000000 --- a/wiki/Starter-Prompt.md +++ /dev/null @@ -1,190 +0,0 @@ -# WordPress Plugin Starter Template - AI Assistant Prompt - -This document provides a comprehensive prompt to help you get started with creating your own WordPress plugin using this starter template with the assistance of AI tools like GitHub Copilot, Claude, or ChatGPT. - -## Important: Optimize AI Context - -**Before starting, add the .ai-assistant.md file and .ai-workflows/ directory to your AI IDE chat context.** In most AI IDEs, you can pin these files to ensure they're considered in each message. This will help the AI understand the project structure and follow the established best practices. - -## Initial Setup Prompt - -Use the following prompt to guide the AI assistant in helping you set up your new plugin based on this template: - -``` -I'm creating a new WordPress plugin based on the wp-plugin-starter-template-for-ai-coding template. Please help me customize this template for my specific plugin needs. - -Here are the details for my new plugin: - -- Plugin Name: [YOUR PLUGIN NAME] -- Plugin Slug: [YOUR-PLUGIN-SLUG] -- Text Domain: [your-plugin-text-domain] -- Namespace: [VENDOR]\[PluginName] -- Description: [BRIEF DESCRIPTION OF YOUR PLUGIN] -- Version: 0.1.0 (starting version) -- Author: [YOUR NAME/ORGANIZATION] -- Author URI: [YOUR WEBSITE] -- License: GPL-2.0+ (or specify another compatible license) -- Requires WordPress: [MINIMUM WP VERSION, e.g., 5.0] -- Requires PHP: [MINIMUM PHP VERSION, e.g., 7.0] -- GitHub Repository: [YOUR GITHUB REPO URL] -- Gitea Repository (if applicable): [YOUR GITEA REPO URL] - -I need help with the following tasks: - -1. Updating all template placeholders with my plugin information -2. Customizing the plugin structure for my specific needs -3. Setting up the initial functionality for my plugin - -I've added the .ai-assistant.md and .ai-workflows/ directory to the chat context to ensure you have all the necessary information about the project structure and best practices. - -Please guide me through this process step by step, starting with identifying all files that need to be updated with my plugin information. -``` - -## Files That Need Updating - -The AI will help you identify and update the following files with your plugin information: - -1. **Main Plugin File**: Rename `wp-plugin-starter-template.php` to `your-plugin-slug.php` and update all plugin header information -2. **README.md**: Update with your plugin details, features, and installation instructions -3. **readme.txt**: Update WordPress.org plugin repository information -4. **CHANGELOG.md**: Initialize with your starting version -5. **composer.json**: Update package name and description -6. **languages/pot file**: Rename and update the POT file -7. **.github/workflows/**: Update GitHub Actions workflows with your repository information -8. **.wiki/**: Update wiki documentation with your plugin information -9. **.ai-assistant.md**: Update AI assistant guidance for your specific plugin -10. **includes/plugin.php**: Update namespace and class references -11. **includes/core.php**: Update namespace and customize core functionality -12. **admin/lib/admin.php**: Update namespace and customize admin functionality - -## Customization Process - -After providing the initial information, follow this process with your AI assistant: - -### 1. File Renaming - -Ask the AI to help you identify all files that need to be renamed: - -``` -Please list all files that need to be renamed to match my plugin slug, and provide the commands to rename them. -``` - -### 2. Namespace Updates - -Ask the AI to help you update all namespace references: - -``` -Please help me update all namespace references from WPALLSTARS\PluginStarterTemplate to [VENDOR]\[PluginName] throughout the codebase. -``` - -### 3. Text Domain Updates - -Ask the AI to help you update all text domain references: - -``` -Please help me update all text domain references from 'wp-plugin-starter-template' to '[your-plugin-text-domain]' throughout the codebase. -``` - -### 4. Function Prefix Updates - -Ask the AI to help you update any function prefixes: - -``` -Please help me update any function prefixes from 'wpst_' to '[your_prefix]_' throughout the codebase. -``` - -### 5. Customizing Core Functionality - -Ask the AI to help you customize the core functionality for your specific plugin needs: - -``` -Now I'd like to customize the core functionality for my plugin. Here's what my plugin should do: - -[DESCRIBE YOUR PLUGIN'S CORE FUNCTIONALITY] - -Please help me modify the includes/core.php file to implement this functionality. -``` - -### 6. Customizing Admin Interface - -Ask the AI to help you customize the admin interface for your specific plugin needs: - -``` -I'd like to customize the admin interface for my plugin. Here's what I need in the admin area: - -[DESCRIBE YOUR PLUGIN'S ADMIN INTERFACE NEEDS] - -Please help me modify the admin/lib/admin.php file and any other necessary files to implement this. -``` - -### 7. Testing Setup - -Ask the AI to help you set up testing for your plugin: - -``` -Please help me update the testing setup to match my plugin's namespace and functionality. I want to ensure I have proper test coverage for the core features. -``` - -## Additional Customization Areas - -Depending on your plugin's needs, you might want to ask the AI for help with: - -1. **Custom Post Types**: Setting up custom post types and taxonomies -2. **Settings API**: Implementing WordPress Settings API for your plugin options -3. **Shortcodes**: Creating shortcodes for front-end functionality -4. **Widgets**: Developing WordPress widgets -5. **REST API**: Adding custom REST API endpoints -6. **Blocks**: Creating Gutenberg blocks -7. **Internationalization**: Ensuring proper i18n setup -8. **Database Tables**: Creating custom database tables if needed -9. **Cron Jobs**: Setting up WordPress cron jobs -10. **User Roles and Capabilities**: Managing custom user roles and capabilities - -## Final Review - -Once you've completed the customization, ask the AI to help you review everything: - -``` -Please help me review all the changes we've made to ensure: - -1. All template placeholders have been replaced with my plugin information -2. All namespaces, text domains, and function prefixes have been updated consistently -3. The plugin structure matches my specific needs -4. The initial functionality is properly implemented -5. All documentation (README.md, readme.txt, wiki) is updated and consistent - -Are there any issues or inconsistencies that need to be addressed? -``` - -## Building and Testing - -Finally, ask the AI to guide you through building and testing your plugin: - -``` -Please guide me through the process of building and testing my plugin: - -1. How do I use the build script to create a deployable version? -2. What tests should I run to ensure everything is working correctly? -3. How do I set up a local testing environment? -4. What should I check before releasing the first version? -``` - -## Optimizing AI Assistance - -To ensure the AI assistant has all the necessary context about your plugin's structure and best practices: - -``` -Please add the .ai-assistant.md and .ai-workflows/ directory to your AI IDE chat context. In most AI IDEs, you can pin these files to ensure they're considered in each message. This will help the AI understand the project structure and follow the established best practices. -``` - -## Remember - -- This template is designed to be a starting point. Feel free to add, remove, or modify components as needed for your specific plugin. -- The AI assistant can help you understand the existing code and make appropriate modifications, but you should review all changes to ensure they meet your requirements. -- Always test your plugin thoroughly before releasing it. -- Keep documentation updated as you develop your plugin. -- Pin the .ai-assistant.md and .ai-workflows/ files in your AI IDE chat to ensure the AI has the necessary context for each interaction. - -## Credits - -This plugin is based on the [WordPress Plugin Starter Template for AI Coding](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding) by WPALLSTARS. diff --git a/wiki/Usage-Instructions.md b/wiki/Usage-Instructions.md deleted file mode 100644 index 9ef8781..0000000 --- a/wiki/Usage-Instructions.md +++ /dev/null @@ -1,121 +0,0 @@ -# Usage Instructions - -This guide provides instructions for using and customizing the WordPress Plugin Starter Template for your own plugin development. - -## Basic Usage - -The WordPress Plugin Starter Template is designed to be a starting point for your WordPress plugin development. It provides a well-structured codebase that you can customize to create your own plugin. - -### Template Structure - -The template follows a modular structure: - -- `wp-plugin-starter-template.php`: Main plugin file with plugin headers -- `includes/`: Core plugin functionality - - `plugin.php`: Main plugin class that initializes everything - - `core.php`: Core functionality class - - `updater.php`: Update mechanism for multiple sources -- `admin/`: Admin-specific functionality - - `lib/`: Admin classes - - `css/`: Admin stylesheets - - `js/`: Admin JavaScript files -- `languages/`: Translation files -- `.github/workflows/`: GitHub Actions workflows -- `.ai-workflows/`: Documentation for AI assistants -- `.wiki/`: Wiki documentation templates - -### Customizing for Your Plugin - -1. **Rename Files and Update Namespaces**: - - Rename `wp-plugin-starter-template.php` to your plugin name - - Update the namespace from `WPALLSTARS\PluginStarterTemplate` to your own - - Update text domain from `wp-plugin-starter-template` to your own - -2. **Update Plugin Headers**: - - Edit the plugin headers in the main PHP file - - Update GitHub/Gitea repository URLs - -3. **Customize Functionality**: - - Modify the core functionality in `includes/core.php` - - Add your own classes as needed - - Customize admin interfaces in the `admin/` directory - -4. **Update Documentation**: - - Update README.md and readme.txt with your plugin information - - Customize wiki documentation in the `.wiki/` directory - -## Advanced Usage - -### Adding Admin Pages - -The template includes a structure for adding admin pages to the WordPress dashboard. To add an admin page: - -1. Uncomment the `add_admin_menu` method in `admin/lib/admin.php` -2. Customize the menu parameters to match your plugin -3. Create the corresponding render method for your admin page -4. Create template files in an `admin/templates/` directory - -### Adding Settings - -To add settings to your plugin: - -1. Create a settings class in `includes/settings.php` -2. Register settings using the WordPress Settings API -3. Create form fields for your settings -4. Handle settings validation and sanitization - -### Adding Custom Post Types or Taxonomies - -To add custom post types or taxonomies: - -1. Create a new class in `includes/` for your post type or taxonomy -2. Register the post type or taxonomy in the class constructor -3. Initialize the class in `includes/plugin.php` - -### Internationalization - -The template is ready for internationalization. To make your plugin translatable: - -1. Use translation functions for all user-facing strings: - - `__()` for simple strings - - `_e()` for echoed strings - - `esc_html__()` for escaped strings -2. Update the text domain in all translation functions -3. Generate a POT file for translations - -### Update Mechanism - -The template includes an update mechanism that supports multiple sources: - -- WordPress.org -- GitHub -- Gitea - -To configure the update mechanism: - -1. Update the plugin headers in the main PHP file -2. Customize the `updater.php` file if needed -3. Ensure your repository follows the required structure for updates - -## Building and Releasing - -The template includes scripts for building and releasing your plugin: - -1. **Building the Plugin**: - ```bash - ./build.sh - ``` - -2. **Deploying to a Local WordPress Installation**: - ```bash - ./scripts/deploy-local.sh - ``` - -3. **Creating a Release**: - - Tag a new version in Git - - Push the tag to GitHub - - The GitHub Actions workflow will create a release - -## Next Steps - -After customizing the template for your needs, refer to the [Architecture Overview](Architecture-Overview) to understand the plugin's structure in more detail. diff --git a/wiki/_Sidebar.md b/wiki/_Sidebar.md deleted file mode 100644 index 0af7839..0000000 --- a/wiki/_Sidebar.md +++ /dev/null @@ -1,24 +0,0 @@ -## User Documentation - -* [Home](Home) -* [Installation Guide](Installation-Guide) -* [Usage Instructions](Usage-Instructions) -* [Frequently Asked Questions](Frequently-Asked-Questions) -* [Troubleshooting](Troubleshooting) - -## Developer Documentation - -* [Architecture Overview](Architecture-Overview) -* [Customization Guide](Customization-Guide) -* [Extending the Plugin](Extending-the-Plugin) -* [Coding Standards](Coding-Standards) -* [Release Process](Release-Process) - -## AI Documentation - -* [AI Workflow Documentation](AI-Workflow-Documentation) - -## Additional Resources - -* [Changelog](Changelog) -* [Contributing](Contributing)