From 6a76528986f298bd1e77a9f0c00ffb77948298d8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 10 Dec 2025 20:05:20 +0000 Subject: [PATCH 1/3] Initial plan From cb85a212cfcba903547ab013166cc358b1c18de9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 10 Dec 2025 20:11:07 +0000 Subject: [PATCH 2/3] Update copilot-instructions.md to reflect actual WordPress plugin structure Co-authored-by: krugazul <1805603+krugazul@users.noreply.github.com> --- .github/copilot-instructions.md | 141 +++++++++++++++++++++----------- 1 file changed, 95 insertions(+), 46 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index df9ca1cc..6cb85b73 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -12,80 +12,121 @@ This repository is a WordPress plugin (Tour Operator) project. It is built using ## πŸ› οΈ Technologies and Tooling -- **Languages:** JavaScript (ES2022+), TypeScript -- **Runtime:** Node.js -- **Package Manager:** npm or yarn (based on `package.json`) -- **Linting:** ESLint with Prettier -- **Testing:** Vitest / Jest (unit tests), Playwright (E2E tests) -- **Frameworks:** None assumed unless otherwise declared in `/src` +- **Languages:** PHP 8.0+, JavaScript (ES2022+), SCSS +- **CMS:** WordPress 6.7+ (Gutenberg block-based architecture) +- **Runtime:** Node.js (build tools only) +- **Package Manager:** npm +- **Build Tools:** Gulp (task runner), @wordpress/scripts (for blocks) +- **Linting:** PHP_CodeSniffer (PHPCS) for WordPress Coding Standards, JSHint +- **Testing:** Manual testing with WordPress environment +- **Frameworks:** WordPress core APIs, Gutenberg/Block Editor --- ## 🧩 Project Structure +``` +.github/ # GitHub configuration and workflows +includes/ # Core PHP classes and functionality +β”œβ”€β”€ blocks/ # WordPress Gutenberg block definitions +β”œβ”€β”€ classes/ # PHP class files (admin, legacy, taxonomies) +β”‚ β”œβ”€β”€ admin/ # Admin-specific functionality +β”‚ β”œβ”€β”€ blocks/ # Block-related classes +β”‚ └── legacy/ # Legacy code and schema +β”œβ”€β”€ constants/ # PHP constants definitions +β”œβ”€β”€ metaboxes/ # Custom metabox definitions +β”œβ”€β”€ partials/ # Reusable PHP template partials +β”œβ”€β”€ patterns/ # WordPress block patterns +β”œβ”€β”€ taxonomies/ # Custom taxonomy definitions +└── template-tags/ # WordPress template tag functions +templates/ # WordPress template files for custom post types +β”œβ”€β”€ archive-*.html # Archive page templates +└── single-*.html # Single post type templates +assets/ # Static assets and compiled files +β”œβ”€β”€ css/ # Stylesheets (SCSS source and compiled CSS) +β”œβ”€β”€ js/ # JavaScript files +β”œβ”€β”€ img/ # Images and icons +└── flags/ # Country flag SVG files +post-types/ # JSON definitions for custom post types +languages/ # Translation files (.pot, .po, .mo) +tour-operator.php # Main plugin file +tour-operator-bootstrap.php # Plugin bootstrap/initialization ``` -.github/ -src/ -β”œβ”€β”€ core/ # Business logic modules -β”œβ”€β”€ api/ # API client utilities and request logic -β”œβ”€β”€ components/ # UI components (React or framework-agnostic) -└── utils/ # Helper utilities -tests/ -docs/ - -```` - -Avoid placing logic in `index.ts` filesβ€”prefer explicit imports. +This is a WordPress plugin following standard WordPress plugin architecture with Gutenberg block support. --- ## πŸ’‘ Coding Conventions -- Prefer functional, stateless patterns when applicable -- Use async/await; avoid `.then()` chains -- Use named exports; avoid default exports unless wrapping a module +### PHP +- Follow [WordPress Coding Standards (WPCS)](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/) +- Use WordPress core functions and APIs (never reinvent core functionality) +- Properly escape output with `esc_html()`, `esc_attr()`, `esc_url()`, etc. +- Sanitize input with `sanitize_text_field()`, `sanitize_email()`, etc. +- Use WordPress nonces for security verification +- Document functions with PHPDoc following [WordPress inline documentation standards](https://developer.wordpress.org/coding-standards/inline-documentation-standards/) +- Prefix all functions, classes, and global variables with `lsx_to_` or `LSX_TO_` + +### JavaScript +- Follow [WordPress JavaScript Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/javascript/) +- Use modern ES6+ syntax where appropriate +- Prefer WordPress block editor APIs for Gutenberg blocks - Keep logic modularβ€”each file should have a single clear responsibility -- Avoid adding logic in `src/index.ts` or top-level entry files -- Document public functions with JSDoc + +### CSS/SCSS +- Follow [WordPress CSS Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/css/) +- Use SCSS for styles (compiled via Gulp) +- Support RTL (Right-to-Left) languages with automatic RTL stylesheet generation --- ## πŸ“¦ Build & Run Commands -* **Development** -- +* **Build WordPress Blocks** ```bash - npm run dev -```` - -* **Lint and Format** + npm run build + ``` + Builds Gutenberg blocks using @wordpress/scripts (Create Gist Block) +* **Watch Mode for Block Development** ```bash - npm run lint - npm run format + npm run start ``` + Starts watch mode for live block development -* **Run Tests** - +* **Generate Translation Files** ```bash - npm test + npm run build-pot ``` + Creates .pot file for translations + + ```bash + npm run build-mopo + ``` + Generates .mo files from .po files -* **Build** +* **SCSS/CSS Compilation** + Use Gulp tasks for CSS compilation (configured in gulpfile.js) +* **PHP Linting** ```bash - npm run build + vendor/bin/phpcs ``` + Run PHP_CodeSniffer to check WordPress Coding Standards (configured in .phpcs.xml) --- ## β›” Avoid These Patterns -* Do not include any WordPress-related imports, functions, or file structures -* Do not scaffold routes or components using Express, Next.js, or any framework unless explicitly declared -* Do not generate `.php`, `.twig`, or legacy CMS files -* Do not reference or assume plugins like WooCommerce or Wetu +* Do not modify WordPress core files or bypass WordPress APIs +* Do not use direct database queriesβ€”use WordPress database abstraction (`$wpdb`, `WP_Query`, etc.) +* Do not create security vulnerabilities by forgetting to escape output or sanitize input +* Do not hardcode text stringsβ€”use translation functions (`__()`, `_e()`, `esc_html__()`, etc.) +* Do not add inline styles or scriptsβ€”enqueue them properly with `wp_enqueue_style()` and `wp_enqueue_script()` +* Do not create duplicate functionality that WordPress already provides +* Do not use PHP short tags (` Date: Wed, 10 Dec 2025 20:12:47 +0000 Subject: [PATCH 3/3] Remove unclear 'Create Gist Block' comment from build command Co-authored-by: krugazul <1805603+krugazul@users.noreply.github.com> --- .github/copilot-instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 6cb85b73..53ab9e12 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -87,7 +87,7 @@ This is a WordPress plugin following standard WordPress plugin architecture with ```bash npm run build ``` - Builds Gutenberg blocks using @wordpress/scripts (Create Gist Block) + Builds Gutenberg blocks using @wordpress/scripts * **Watch Mode for Block Development** ```bash