Compare commits
1 Commits
claude/ci-
...
claude/qa-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1fcb46116 |
97
.github/workflows/ci.yml
vendored
97
.github/workflows/ci.yml
vendored
@@ -1,20 +1,91 @@
|
|||||||
name: CI
|
name: CI — Lint & Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request: {}
|
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [ main ]
|
||||||
workflow_call: {}
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
# 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:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
# ── PHP Syntax Check ─────────────────────────────────────────────
|
||||||
uses: peptiderepo/peptide-e2e/.github/workflows/ci.yml@main
|
lint-php:
|
||||||
with:
|
name: PHP Lint (${{ matrix.php }})
|
||||||
tests: stubs
|
runs-on: ubuntu-latest
|
||||||
has_js: true
|
strategy:
|
||||||
secrets: inherit
|
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"
|
||||||
|
|||||||
10
.github/workflows/deploy.yml
vendored
10
.github/workflows/deploy.yml
vendored
@@ -24,6 +24,11 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: main
|
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
|
- name: Verify PSA_VERSION constant
|
||||||
run: |
|
run: |
|
||||||
if grep -q "define( 'PSA_VERSION'" peptide-search-ai.php; then
|
if grep -q "define( 'PSA_VERSION'" peptide-search-ai.php; then
|
||||||
@@ -32,6 +37,11 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "❌ PSA_VERSION not found"; exit 1
|
echo "❌ PSA_VERSION not found"; exit 1
|
||||||
fi
|
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:
|
deploy:
|
||||||
name: Deploy (shared pipeline)
|
name: Deploy (shared pipeline)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ peptide-search-ai/
|
|||||||
│ └── psa-directory.css Directory card grid, filter pills, modal styles, dark mode support
|
│ └── psa-directory.css Directory card grid, filter pills, modal styles, dark mode support
|
||||||
│
|
│
|
||||||
└── .github/workflows/
|
└── .github/workflows/
|
||||||
├── ci.yml Thin caller → peptide-e2e reusable CI (stubs, has_js:true); blocking PHPCS + 300-line rule
|
├── ci.yml PHP lint, PHPCS, JS syntax checks on PR/push
|
||||||
└── deploy.yml Pre-deploy validation, orphan deploy branch sync, SSH deploy
|
└── deploy.yml Pre-deploy validation, orphan deploy branch sync, SSH deploy
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
16
CHANGELOG.md
16
CHANGELOG.md
@@ -5,22 +5,6 @@ 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/),
|
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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- `.github/workflows/ci.yml`: added `workflow_call: {}` trigger so `deploy.yml`'s `uses: ./.github/workflows/ci.yml` gate resolves correctly. No plugin code changed.
|
|
||||||
|
|
||||||
## [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
|
## [4.6.0] — 2026-04-26
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -286,4 +286,42 @@ class PSA_Admin {
|
|||||||
$options = get_option( 'psa_settings', array() );
|
$options = get_option( 'psa_settings', array() );
|
||||||
return $options[ $key ] ?? $default;
|
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(); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,6 +237,8 @@ class PSA_AI_Generator {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Private helpers ─────────────────────────────────────────────────
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get plugin settings with defaults, decrypted API key, and constant override.
|
* Get plugin settings with defaults, decrypted API key, and constant override.
|
||||||
*
|
*
|
||||||
@@ -287,13 +289,21 @@ class PSA_AI_Generator {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @see PSA_AI_Content::build_validation_prompt() — kept for test reflection. */
|
// ── Backward-compatible proxies ─────────────────────────────────────
|
||||||
public static function build_validation_prompt( string $name ): string {
|
|
||||||
return PSA_AI_Content::build_validation_prompt( $name );
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @see PSA_AI_Content::build_generation_prompt() — kept for test reflection. */
|
/** @see PSA_AI_Content::build_validation_prompt() */
|
||||||
|
public static function build_validation_prompt( string $name ): string {
|
||||||
|
return PSA_AI_Content::build_validation_prompt( $name ); }
|
||||||
|
|
||||||
|
/** @see PSA_AI_Content::build_generation_prompt() */
|
||||||
public static function build_generation_prompt( string $peptide_name ): string {
|
public static function build_generation_prompt( string $peptide_name ): string {
|
||||||
return PSA_AI_Content::build_generation_prompt( $peptide_name );
|
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 ); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,4 +290,18 @@ class PSA_Search {
|
|||||||
'source' => get_post_meta( $post->ID, 'psa_source', true ),
|
'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 ); }
|
||||||
}
|
}
|
||||||
|
|||||||
13
package-lock.json
generated
13
package-lock.json
generated
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "peptide-search-ai",
|
|
||||||
"version": "4.7.0",
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {
|
|
||||||
"": {
|
|
||||||
"name": "peptide-search-ai",
|
|
||||||
"version": "4.7.0",
|
|
||||||
"devDependencies": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "peptide-search-ai",
|
|
||||||
"version": "4.7.0",
|
|
||||||
"description": "Peptide Search AI WordPress plugin — JS assets",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {},
|
|
||||||
"devDependencies": {}
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: Peptide Search AI
|
* Plugin Name: Peptide Search AI
|
||||||
* Plugin URI: https://github.com/peptiderepo/peptide-search-ai
|
* Plugin URI: https://github.com/peptiderepo/peptide-search-ai
|
||||||
* Description: Searchable peptide database with AI-powered auto-population and browsable directory.
|
* Description: Searchable peptide database with AI-powered auto-population and browsable directory.
|
||||||
* Version: 4.7.0
|
* Version: 4.6.0
|
||||||
* Author: peptiderepo
|
* Author: peptiderepo
|
||||||
* License: GPL v2 or later
|
* License: GPL v2 or later
|
||||||
* Text Domain: peptide-search-ai
|
* Text Domain: peptide-search-ai
|
||||||
@@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
define( 'PSA_VERSION', '4.7.0' );
|
define( 'PSA_VERSION', '4.5.0' );
|
||||||
define( 'PSA_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
define( 'PSA_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||||
define( 'PSA_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
define( 'PSA_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||||
define( 'PSA_PLUGIN_FILE', __FILE__ );
|
define( 'PSA_PLUGIN_FILE', __FILE__ );
|
||||||
|
|||||||
@@ -41,4 +41,4 @@ $wpdb->query(
|
|||||||
// 3. Drop PSA's API logs table. Owned entirely by PSA; no cross-plugin reads.
|
// 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
|
$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)
|
// 4. NOT deleted (owned by Peptide Repo Core as of PSA v4.5.0)
|
||||||
Reference in New Issue
Block a user