feat(inspect): list hub commands and let the inspector execute them#127
Merged
Conversation
Adds a Commands tab to the inspector, backed by two new RPC functions: devframes:plugin:inspect:list-commands and devframes:plugin:inspect:execute-command. Both duck-type ctx.commands (the hub's commands host) so the plugin keeps no build/runtime dependency on @devframes/hub and degrades gracefully outside a hub (empty list / thrown diagnostic).
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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
Adds a Commands tab to the devframe inspector, alongside Functions / State / Agent / History, backed by two new RPC functions:
devframes:plugin:inspect:list-commands— enumerates commands registered on the hub's commands host (id, title, description, icon, category,hasHandler, children), query/snapshot so it also works inbuild/spamode.devframes:plugin:inspect:execute-command— runs a command by id and returns the sameInvokeResultenvelope the existinginvokefunction uses.Commands are a
@devframes/hubfeature, but the inspector plugin is deliberately hub-agnostic (no build/runtime dependency on@devframes/hub). Both functions readctx.commandsby duck-typing — the same pattern already established inplugins/terminals/src/node/manager.tsandplugins/code-server/src/node/supervisor.ts— so the plugin still builds and runs standalone: outside a hub,list-commandsreturns an empty list andexecute-commandthrows a new diagnostic (DP_INSPECT_0003).Unlike the existing generic
invokeRPC,execute-commandisn't gated to read-only types — running a command is the whole point of a command (unlike an arbitrary RPCaction, which the inspector otherwise refuses to fire unprompted).UI
CommandsSmart→CommandsView→CommandRowcomponent chain, mirroring the existingFunctionsSmart/FunctionsView/FunctionRowpattern (search box, category counts, expandable rows,ActionButton"Run", JSON result view with ok/fail + duration).DevframeCommandBase);CommandRowrenders children recursively, indented, with their own independent Run actions. Group-only commands (no handler) render without a Run action.CommandsView.stories.ts.Tests
@devframes/hubadded as a devDependency (test-only) to boot a real hub context (createHubContext) alongside the existing plain-context boot, mirroringplugins/messages' test setup.hasHandlerflags inside a hub; executing a command with args, a nested child command, and error envelopes for a group-only command and an unregistered id.list-commandsbakes into the snapshot dump.This PR was created with the help of an agent.