fix(wfctl plugin install): preserve cliCommands + buildHooks in installed plugin.json#612
Merged
Merged
Conversation
…n.json
`writeInstalledManifest` constructed `installedPluginCapabilities` from
the registry manifest by hand-copying ModuleTypes / StepTypes /
TriggerTypes / IaCProvider — but silently dropped CLICommands and
BuildHooks. Result: plugin.json on disk after install had no
cliCommands, so BuildCLIRegistry could not discover plugin-provided
wfctl subcommands.
Workflow-registry's payments manifest had been updated to declare
`cliCommands: [{name: payments, …}]`, but every BMW
`provision-stripe-issuing-webhook` retrigger still reported
`unknown command: payments` because the field never made it from the
registry manifest to the on-disk plugin.json.
Fix: extend `installedPluginCapabilities` with `CLICommands` +
`BuildHooks` fields and propagate them in writeInstalledManifest.
The registry-side struct already carries both fields; this just
plumbs them through.
Tests: TestInstalledManifestPreservesCLICommands as a regression
guard — read-back of writeInstalledManifest's output must contain the
CLICommands and BuildHooks the registry manifest declared.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes wfctl plugin install writing an incomplete installed plugin.json by ensuring registry-declared capabilities.cliCommands and capabilities.buildHooks are preserved on disk, enabling plugin-provided wfctl subcommands (and build-hook dispatch) to work post-install.
Changes:
- Extend
installedPluginCapabilitiesto includeCLICommandsandBuildHooks. - Plumb those fields through
writeInstalledManifestso installedplugin.jsonretains them. - Add a regression test ensuring
writeInstalledManifestoutput preserves bothcliCommandsandbuildHooks.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cmd/wfctl/plugin_install.go | Adds CLICommands/BuildHooks to the installed manifest capabilities and writes them out during install. |
| cmd/wfctl/plugin_install_e2e_test.go | Adds a regression test asserting installed plugin.json retains cliCommands + buildHooks. |
Comment on lines
+426
to
+431
| // TestInstalledManifestPreservesCLICommands is the regression test for the | ||
| // post-install plugin-CLI dispatch bug: writeInstalledManifest used to drop | ||
| // capabilities.cliCommands, so even when a registry manifest declared them, | ||
| // `wfctl <plugin-cmd>` reported `unknown command` because BuildCLIRegistry | ||
| // reads from the on-disk plugin.json (not the registry manifest). | ||
| func TestInstalledManifestPreservesCLICommands(t *testing.T) { |
Comment on lines
+446
to
+448
| BuildHooks: []RegistryBuildHook{ | ||
| {Event: "pre-build", Priority: 10}, | ||
| }, |
Round 2 of #612 Copilot review: - Test name now reflects both behaviors (CLICommands + BuildHooks). - BuildHooks fixture event renamed pre-build → pre_build to match interfaces.HookEvent* underscore convention. Hyphen variant was a placeholder that could mask validation drift. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
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.
Summary
`writeInstalledManifest` constructed `installedPluginCapabilities` from the registry manifest by hand-copying ModuleTypes / StepTypes / TriggerTypes / IaCProvider — but silently dropped `CLICommands` and `BuildHooks`. Result: plugin.json on disk after install had no cliCommands, so `BuildCLIRegistry` could not discover plugin-provided wfctl subcommands.
Reproduction
workflow-registry#28 added `cliCommands: [{name: payments, …}]` to the `workflow-plugin-payments` manifest. Every BMW `provision-stripe-issuing-webhook` retrigger still reported:
```
unknown command: payments
```
Diagnostic on the runner (buymywishlist#260 debug branch run) showed:
```
$ ls -la $WFCTL_PLUGIN_DIR/payments
-rw------- 1 runner runner 1091 plugin.json ← 1KB stub from writeInstalledManifest
-rwxr-xr-x 1 runner runner 73M workflow-plugin-payments
$ jq .capabilities.cliCommands $WFCTL_PLUGIN_DIR/payments/plugin.json
"<>"
```
The 27KB plugin.json the v0.3.1 release tarball shipped with cliCommands was overwritten by writeInstalledManifest's stripped version.
Fix
Extend `installedPluginCapabilities` with `CLICommands` + `BuildHooks` fields and propagate them in `writeInstalledManifest`. The registry-side struct already carries both fields; this just plumbs them through.
Tests
`TestInstalledManifestPreservesCLICommands` — regression guard: read-back of writeInstalledManifest's output must contain CLICommands + BuildHooks the registry manifest declared.
Verification
🤖 Generated with Claude Code