[Blueprints] Support plugin activationOptions - #3852
Merged
Conversation
adamziel
force-pushed
the
add/plugin-activation-options
branch
4 times, most recently
from
July 1, 2026 12:10
6d74466 to
9952fb9
Compare
adamziel
force-pushed
the
add/plugin-activation-options
branch
from
July 1, 2026 12:38
9952fb9 to
84c71fd
Compare
adamziel
marked this pull request as ready for review
July 1, 2026 13:53
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for passing activationOptions through the v1 installPlugin Blueprint step by staging the options in a temporary WP option during plugin activation, aligning behavior with the Blueprint v2 contract.
Changes:
- Extend
installPluginoptions to acceptactivationOptions, stage them before activation, and delete them in afinally. - Add a PHP staging helper + JS output parser to locate the plugin file and compute the
blueprint_activation_<plugin_basename>option name. - Add tests and update the public Blueprint schema to include
activationOptions.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/playground/blueprints/src/tests/steps/install-plugin.spec.ts | Adds integration tests validating activationOptions exposure, cleanup, and error behavior. |
| packages/playground/blueprints/src/lib/steps/install-plugin.ts | Implements activation option staging/cleanup and parses helper output. |
| packages/playground/blueprints/public/blueprint-schema.json | Documents activationOptions in the v1 installPlugin step schema. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+191
to
+198
| let activationOptionName: string | undefined; | ||
| if (options.activationOptions !== undefined) { | ||
| activationOptionName = await setPluginActivationOptions( | ||
| playground, | ||
| assetFolderPath, | ||
| options.activationOptions | ||
| ); | ||
| } |
Comment on lines
+283
to
+284
| echo $payload_prefix . json_encode(array('optionName' => $option_name)); | ||
| `, |
Comment on lines
188
to
190
| const activate = 'activate' in options ? options.activate : true; | ||
|
|
||
| if (activate) { |
Comment on lines
+350
to
+354
| try { | ||
| return JSON.parse(payload) as Record<string, unknown>; | ||
| } catch { | ||
| throw new Error('Could not parse plugin activation options payload.'); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Adds
activationOptionsto theinstallPluginBlueprint step.{ "step": "installPlugin", "pluginData": { "resource": "wordpress.org/plugins", "slug": "my-plugin" }, "options": { "activate": true, "activationOptions": { "storeCity": "Wroclaw", "enabled": true } } }When activation options are provided,
installPluginstores them in a temporary WordPress option before running the plugin activation hook. The option name is based onplugin_basename(__FILE__), so plugin code can read:The temporary option is deleted after activation, even if activation fails.
Rationale
Some plugins need setup values during activation, not after activation. A later Blueprint step can update options or run PHP, but it cannot affect code that already ran inside
register_activation_hook().The Blueprint v2 schema already describes
activationOptionsas data exposed through a WordPress option namedblueprint_activation_plusplugin_basename(__FILE__), and removed after activation. This PR brings the v1installPluginstep in line with that contract so the behavior can be reviewed independently before #3725 depends on it.This does not change plugin installation, plugin path validation, overwrite behavior, or
onErrorhandling.Implementation
installPluginnow wraps the activation call:options.activationOptionsinblueprint_activation_<plugin_basename>.activatePlugin()as before.finally.The PHP staging helper prints a sentinel-prefixed JSON payload because plugin bootstrap code may write to stdout before the helper reports the option name.
Testing instructions
The new tests cover:
activationOptionsactivationOptionsis requested but no plugin PHP file can be found