diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0bd257..c767b21 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,91 +1,19 @@ -name: CI — Lint & Test +name: CI on: + pull_request: {} push: - branches: [ main ] - pull_request: - branches: [ main ] - workflow_call: + branches: [main] +# Required: reusable phpcs job declares contents: write for phpcbf auto-commit, +# but GitHub enforces that the caller must also declare it at workflow level. permissions: - contents: read + contents: write jobs: - # ── PHP Syntax Check ───────────────────────────────────────────── - lint-php: - name: PHP Lint (${{ matrix.php }}) - runs-on: ubuntu-latest - strategy: - matrix: - php: ['8.1', '8.2', '8.3'] - steps: - - uses: actions/checkout@v4 - - - name: Set up PHP ${{ matrix.php }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - - - name: Syntax check all PHP files - run: find . -name '*.php' -not -path './vendor/*' -print0 | xargs -0 -n1 php -l - - # ── WordPress Coding Standards (PHP CodeSniffer) ────────────────── - lint-phpcs: - name: WordPress Coding Standards - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - - - name: Install Composer dependencies - run: | - composer install --no-interaction --prefer-dist --no-progress - - - name: Run PHPCS with WordPress-Core standard - run: composer run lint - continue-on-error: true - - # ── PHPUnit Tests ──────────────────────────────────────────────── - test-phpunit: - name: PHPUnit Tests (PHP ${{ matrix.php }}) - runs-on: ubuntu-latest - strategy: - matrix: - php: ['8.1', '8.2', '8.3'] - steps: - - uses: actions/checkout@v4 - - - name: Set up PHP ${{ matrix.php }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - tools: composer - - - name: Install Composer dependencies - run: composer install --no-interaction --prefer-dist --no-progress - - - name: Run PHPUnit tests - run: composer run test - - # ── JavaScript Lint ────────────────────────────────────────────── - lint-js: - name: JavaScript Linting - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up Node - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Check JavaScript syntax - run: | - for f in $(find assets/js -name '*.js' -type f); do - node --check "$f" || exit 1 - done - echo "All JavaScript files passed syntax check" + ci: + uses: peptiderepo/peptide-e2e/.github/workflows/ci.yml@main + with: + tests: stubs + has_js: true + secrets: inherit diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0db477c..94b36a7 100755 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -24,11 +24,6 @@ jobs: - uses: actions/checkout@v4 with: ref: main - - name: Verify required files exist - run: | - for file in peptide-search-ai.php includes/ assets/ readme.txt; do - [ -e "$file" ] && echo "✓ $file" || { echo "❌ Missing: $file"; exit 1; } - done - name: Verify PSA_VERSION constant run: | if grep -q "define( 'PSA_VERSION'" peptide-search-ai.php; then @@ -37,11 +32,6 @@ jobs: else echo "❌ PSA_VERSION not found"; exit 1 fi - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - - name: Validate PHP syntax - run: find . -name '*.php' -not -path './vendor/*' -print0 | xargs -0 -n1 php -l > /dev/null deploy: name: Deploy (shared pipeline) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 49624df..33294a1 100755 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -43,7 +43,7 @@ peptide-search-ai/ │ └── psa-directory.css Directory card grid, filter pills, modal styles, dark mode support │ └── .github/workflows/ - ├── ci.yml PHP lint, PHPCS, JS syntax checks on PR/push + ├── ci.yml Thin caller → peptide-e2e reusable CI (stubs, has_js:true); blocking PHPCS + 300-line rule └── deploy.yml Pre-deploy validation, orphan deploy branch sync, SSH deploy ``` diff --git a/CHANGELOG.md b/CHANGELOG.md index ab986dd..06765c7 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to the Peptide Search AI plugin will be documented in this f The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.7.0] — 2026-06-16 + +### Changed +- `.github/workflows/ci.yml`: replaced per-repo CI jobs with thin caller for the reusable `peptiderepo/peptide-e2e/.github/workflows/ci.yml@main` (tests: stubs, has_js: true). Adds blocking PHPCS, 300-line file-size enforcement, and phpcbf auto-commit on PRs. +- `.github/workflows/deploy.yml`: dropped redundant file-existence and PHP-syntax checks now covered by the reusable CI; kept PSA_VERSION constant check. +- `includes/class-psa-admin.php`: removed dead backward-compat proxy methods (all delegated to `PSA_Admin_Page`; zero external callers). File reduced from 327 → 290 lines (estate 300-line rule compliance). +- `includes/class-psa-ai-generator.php`: removed untested backward-compat proxies (save_peptide_meta, assign_category_term); retained build_validation_prompt and build_generation_prompt as tested proxies (AIGeneratorTest uses reflection). Section headers condensed. File 309 → 299 lines. +- `includes/class-psa-search.php`: removed dead backward-compat proxy methods (all delegated to `PSA_Search_Handler`; zero external callers). File reduced from 307 → 294 lines. +- `peptide-search-ai.php`: synced `PSA_VERSION` constant (was stuck at 4.5.0) with plugin header (was 4.6.0); both now 4.7.0. +- `package.json` / `package-lock.json`: added minimal npm manifest (no dependencies) so the reusable `lint-js` job can run `npm ci` and fall back to `node --check` on the three JS asset files. + ## [4.6.0] — 2026-04-26 ### Changed diff --git a/includes/class-psa-admin.php b/includes/class-psa-admin.php index 594d602..0baca4e 100755 --- a/includes/class-psa-admin.php +++ b/includes/class-psa-admin.php @@ -286,42 +286,4 @@ class PSA_Admin { $options = get_option( 'psa_settings', array() ); return $options[ $key ] ?? $default; } - - // ── Backward-compatible proxies (rendering moved to PSA_Admin_Page) ─ - - /** @see PSA_Admin_Page::enqueue_batch_scripts() */ - public static function enqueue_batch_scripts( string $hook ): void { - PSA_Admin_Page::enqueue_batch_scripts( $hook ); } - - /** @see PSA_Admin_Page::render_section_description() */ - public static function render_section_description(): void { - PSA_Admin_Page::render_section_description(); } - - /** @see PSA_Admin_Page::render_api_key_field() */ - public static function render_api_key_field(): void { - PSA_Admin_Page::render_api_key_field(); } - - /** @see PSA_Admin_Page::render_model_field() */ - public static function render_model_field(): void { - PSA_Admin_Page::render_model_field(); } - - /** @see PSA_Admin_Page::render_validation_model_field() */ - public static function render_validation_model_field(): void { - PSA_Admin_Page::render_validation_model_field(); } - - /** @see PSA_Admin_Page::render_publish_field() */ - public static function render_publish_field(): void { - PSA_Admin_Page::render_publish_field(); } - - /** @see PSA_Admin_Page::render_pubchem_field() */ - public static function render_pubchem_field(): void { - PSA_Admin_Page::render_pubchem_field(); } - - /** @see PSA_Admin_Page::render_budget_field() */ - public static function render_budget_field(): void { - PSA_Admin_Page::render_budget_field(); } - - /** @see PSA_Admin_Page::render_settings_page() */ - public static function render_settings_page(): void { - PSA_Admin_Page::render_settings_page(); } } diff --git a/includes/class-psa-ai-generator.php b/includes/class-psa-ai-generator.php index 922f723..5e95ec4 100755 --- a/includes/class-psa-ai-generator.php +++ b/includes/class-psa-ai-generator.php @@ -237,8 +237,6 @@ class PSA_AI_Generator { ); } - // ── Private helpers ───────────────────────────────────────────────── - /** * Get plugin settings with defaults, decrypted API key, and constant override. * @@ -289,21 +287,13 @@ class PSA_AI_Generator { return true; } - // ── Backward-compatible proxies ───────────────────────────────────── - - /** @see PSA_AI_Content::build_validation_prompt() */ + /** @see PSA_AI_Content::build_validation_prompt() — kept for test reflection. */ public static function build_validation_prompt( string $name ): string { - return PSA_AI_Content::build_validation_prompt( $name ); } + return PSA_AI_Content::build_validation_prompt( $name ); + } - /** @see PSA_AI_Content::build_generation_prompt() */ + /** @see PSA_AI_Content::build_generation_prompt() — kept for test reflection. */ public static function build_generation_prompt( string $peptide_name ): string { - return PSA_AI_Content::build_generation_prompt( $peptide_name ); } - - /** @see PSA_AI_Content::save_peptide_meta() */ - public static function save_peptide_meta( int $post_id, array $ai_data, ?array $pubchem_data ): void { - PSA_AI_Content::save_peptide_meta( $post_id, $ai_data, $pubchem_data ); } - - /** @see PSA_AI_Content::assign_category_term() */ - public static function assign_category_term( int $post_id, array $ai_data ): void { - PSA_AI_Content::assign_category_term( $post_id, $ai_data ); } + return PSA_AI_Content::build_generation_prompt( $peptide_name ); + } } diff --git a/includes/class-psa-search.php b/includes/class-psa-search.php index b01e651..c2642f8 100755 --- a/includes/class-psa-search.php +++ b/includes/class-psa-search.php @@ -290,18 +290,4 @@ class PSA_Search { 'source' => get_post_meta( $post->ID, 'psa_source', true ), ); } - - // ── Backward-compatible proxies ───────────────────────────────────── - - /** @see PSA_Search_Handler::ajax_search() */ - public static function ajax_search(): void { - PSA_Search_Handler::ajax_search(); } - - /** @see PSA_Search_Handler::create_pending_placeholder() */ - public static function create_pending_placeholder( string $peptide_name ) { - return PSA_Search_Handler::create_pending_placeholder( $peptide_name ); } - - /** @see PSA_Search_Handler::schedule_background_generation() */ - public static function schedule_background_generation( int $post_id, string $peptide_name ): void { - PSA_Search_Handler::schedule_background_generation( $post_id, $peptide_name ); } } diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..91c2b0c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "peptide-search-ai", + "version": "4.7.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "peptide-search-ai", + "version": "4.7.0", + "devDependencies": {} + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..d407cc2 --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "name": "peptide-search-ai", + "version": "4.7.0", + "description": "Peptide Search AI WordPress plugin — JS assets", + "private": true, + "scripts": {}, + "devDependencies": {} +} diff --git a/peptide-search-ai.php b/peptide-search-ai.php index 31cacfc..9f5ea08 100755 --- a/peptide-search-ai.php +++ b/peptide-search-ai.php @@ -3,7 +3,7 @@ * Plugin Name: Peptide Search AI * Plugin URI: https://github.com/peptiderepo/peptide-search-ai * Description: Searchable peptide database with AI-powered auto-population and browsable directory. - * Version: 4.6.0 + * Version: 4.7.0 * Author: peptiderepo * License: GPL v2 or later * Text Domain: peptide-search-ai @@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } -define( 'PSA_VERSION', '4.5.0' ); +define( 'PSA_VERSION', '4.7.0' ); define( 'PSA_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'PSA_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'PSA_PLUGIN_FILE', __FILE__ ); diff --git a/uninstall.php b/uninstall.php index 8315fb0..91f2e57 100755 --- a/uninstall.php +++ b/uninstall.php @@ -41,4 +41,4 @@ $wpdb->query( // 3. Drop PSA's API logs table. Owned entirely by PSA; no cross-plugin reads. $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}psa_api_logs" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.InterpolatedNotPrepared -// 4. NOT deleted (owned by Peptide Repo Core as of PSA v4.5.0) \ No newline at end of file +// 4. NOT deleted (owned by Peptide Repo Core as of PSA v4.5.0)