Skip to content

Add WP-CLI command to migrate legacy beapi/key-figure content. - #25

Merged
stephane-gillot merged 5 commits into
developfrom
migration-script
Sep 22, 2026
Merged

stephane-gillot merged 5 commits into
developfrom
migration-script

Conversation

@stephane-gillot

@stephane-gillot stephane-gillot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Content saved by the old plugin stays invalid until block names, BEM classes, and markup are rewritten; this command does that as a manual dry-run by default.


Note

Medium Risk
With --live, the command writes to post_content and widget options (including direct DB updates for revisions); incorrect migration logic could corrupt stored block markup, though dry-run is the default and execution is manual.

Overview
Adds a WP-CLI migration path from legacy beapi/key-figure to blockparty/key-figure. When WP-CLI is available, the plugin registers wp blockparty key-figure migrate, which scans post content (batched) and block widgets, renames block delimiters and BEM classes, and optionally modernizes saved HTML (p key wrapper, number data-* attributes, raw increment text). --live persists changes; without it the command is a dry-run. Flags cover multisite (--blog_id), post types, revisions, batch size, and --no-modernize.

New PHP under includes/ (KeyFigureBlockMigrator, MigrateFromKeyFigureBlockCommand) is wired via Composer PSR-4 autoload. Quality tooling now covers includes/** (workflow paths, phpcs.xml, GrumPHP phpcs.xml). readme.txt documents migration usage.

Reviewed by Cursor Bugbot for commit 76775d7. Bugbot is set up for automated code reviews on this repo. Configure here.

Content saved by the old plugin stays invalid until block names, BEM classes, and markup are rewritten; this command does that as a manual dry-run by default.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 76775d7. Configure here.

Comment thread includes/Migration/KeyFigureBlockMigrator.php Outdated
stephane-gillot and others added 3 commits September 17, 2026 16:46
Iterating over every site with switch_to_blog() duplicated what --url already does, so --blog_id is dropped in favour of running the command once per site.

Co-authored-by: Cursor <cursoragent@cursor.com>
The previous --live flag inverted the usual WP-CLI convention; matching blockparty-icons keeps a no-op opt-in instead of an opt-in write.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@Rahe Rahe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rien de bloquant, en soit tu peux y aller.

$this->migrate_posts();
$this->migrate_widgets();

WP_CLI::success(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace the long success sprintf with a CLI table as suggested in review.

Co-authored-by: Cursor <cursoragent@cursor.com>
@stephane-gillot
stephane-gillot merged commit 52ec8ac into develop Sep 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants