mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-26 16:06:16 +00:00
Plugins/CLI: add descriptor-backed lazy root command registration (#57165)
Merged via squash.
Prepared head SHA: ad1dee32eb
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
committed by
GitHub
parent
d330782ed1
commit
9b4f26e70a
@@ -93,6 +93,9 @@ export default defineChannelPluginEntry({
|
||||
(typically via `createPluginRuntimeStore`).
|
||||
- `registerFull` only runs when `api.registrationMode === "full"`. It is skipped
|
||||
during setup-only loading.
|
||||
- For plugin-owned root CLI commands, prefer `api.registerCli(..., { descriptors: [...] })`
|
||||
when you want the command to stay lazy-loaded without disappearing from the
|
||||
root CLI parse tree.
|
||||
|
||||
## `defineSetupPluginEntry`
|
||||
|
||||
@@ -135,6 +138,14 @@ register(api) {
|
||||
}
|
||||
```
|
||||
|
||||
For CLI registrars specifically:
|
||||
|
||||
- use `descriptors` when the registrar owns one or more root commands and you
|
||||
want OpenClaw to lazy-load the real CLI module on first invocation
|
||||
- make sure those descriptors cover every top-level command root exposed by the
|
||||
registrar
|
||||
- use `commands` alone only for eager compatibility paths
|
||||
|
||||
## Plugin shapes
|
||||
|
||||
OpenClaw classifies loaded plugins by their registration behavior:
|
||||
|
||||
Reference in New Issue
Block a user