- Moved sticky positioning from mobile-only to global CSS for .top-left-actions - Buttons now stay fixed at top above content on all screen sizes - Includes various other app updates (version management, server improvements)
4.0 KiB
4.0 KiB
WordPress Plugin Version Management - Implementation Summary
Overview
Automatic version number management for WordPress plugins has been implemented. The system now detects versions from plugin files, tracks version history, and automatically bumps versions when exporting ZIP files.
Files Created/Modified
New Files
chat/src/utils/versionManager.js- Core version management utilitieschat/src/utils/versionManager.test.js- Unit tests for version manager
Modified Files
chat/server.js- Added version tracking to session object (lines ~7641-7658)
- Added version manager import (line ~20)
- Modified
handleExportZip()to detect and bump versions (lines ~16944-17138) - Modified
handleUploadApp()to detect version from imported plugins (lines ~16837-16889) - Updated
serializeSession()to include version fields (lines ~7463-7481)
Features Implemented
1. Automatic Version Detection
- Detects version from WordPress plugin headers (
Version: X.X.X) - Detects version from PHP constants (
define('CONSTANT_NAME', 'X.X.X')) - Works with imported plugins of any version number
2. Version Bumping
- Automatically bumps patch version on export (1.0.0 → 1.0.1)
- Supports major, minor, patch, and keep bump types
- Tracks bump history in session
3. Imported Plugin Support
- Detects existing version from uploaded ZIP files
- Preserves original version number on import
- Maintains version continuity for imported plugins
4. Version History Tracking
session.pluginVersionHistory = [
{
version: '1.0.1',
previousVersion: '1.0.0',
bumpType: 'patch',
timestamp: '2026-02-11T10:30:00.000Z',
fileUpdated: 'my-plugin/my-plugin.php'
}
]
5. Session Data
session.pluginVersion = '1.2.3'; // Current version
session.lastVersionBumpType = 'patch'; // Last bump type
session.pluginVersionHistory = []; // Full history
How It Works
Export Flow
- User clicks "Export ZIP"
- System finds main plugin PHP file
- Extracts current version (from session or file)
- Bumps version number (patch by default)
- Updates version in plugin file content
- Adds updated file to ZIP archive
- Tracks version change in session history
Import Flow
- User uploads ZIP file
- System extracts files to workspace
- Searches for main plugin file
- Extracts version from plugin header/constants
- Stores detected version in session
- Records import event in version history
Version Formats Supported
Plugin Headers
/**
* Plugin Name: My Plugin
* Version: 1.2.3
*/
PHP Constants
define('MY_PLUGIN_VERSION', '1.2.3');
define( "PLUGIN_VERSION", "2.0.0" );
PHP Const Assignments
const PLUGIN_VERSION = '1.2.3';
API Response Changes
Sessions now include version fields:
{
"session": {
"id": "...",
"pluginVersion": "1.2.4",
"pluginVersionHistory": [...],
"lastVersionBumpType": "patch"
}
}
Future Enhancements (Optional)
- UI Controls: Add version bump selector in export UI (major/minor/patch/custom)
- Changelog Generation: Auto-generate changelog entries with AI
- Version Strategy: Let AI analyze changes and suggest appropriate bump type
- Multi-file Updates: Update version in all plugin files, not just main file
- readme.txt Support: Update version in WordPress.org readme.txt format
Testing
Run unit tests:
cd chat/src/utils
node versionManager.test.js
All tests pass:
- ✓ parseVersion
- ✓ formatVersion
- ✓ bumpVersion
- ✓ extractHeaderVersion
- ✓ extractDefineVersion
- ✓ extractAllVersions
- ✓ updateVersionInContent
- ✓ isWordPressPluginFile
- ✓ getPluginSlugFromPath
Backwards Compatibility
- Plugins without version detection start at 1.0.0
- Existing sessions without version data will detect from file on first export
- Import works with any plugin structure or version format
- Graceful fallback if version detection fails