chore: remove dead plugin hook loader

This commit is contained in:
Peter Steinberger
2026-02-22 08:45:15 +01:00
parent 185fba1d22
commit 121d027229
2 changed files with 14 additions and 123 deletions

View File

@@ -330,22 +330,29 @@ Plugins export either:
## Plugin hooks
Plugins can ship hooks and register them at runtime. This lets a plugin bundle
event-driven automation without a separate hook pack install.
Plugins can register hooks at runtime. This lets a plugin bundle event-driven
automation without a separate hook pack install.
### Example
```
import { registerPluginHooksFromDir } from "openclaw/plugin-sdk";
```ts
export default function register(api) {
registerPluginHooksFromDir(api, "./hooks");
api.registerHook(
"command:new",
async () => {
// Hook logic here.
},
{
name: "my-plugin.command-new",
description: "Runs when /new is invoked",
},
);
}
```
Notes:
- Hook directories follow the normal hook structure (`HOOK.md` + `handler.ts`).
- Register hooks explicitly via `api.registerHook(...)`.
- Hook eligibility rules still apply (OS/bins/env/config requirements).
- Plugin-managed hooks show up in `openclaw hooks list` with `plugin:<id>`.
- You cannot enable/disable plugin-managed hooks via `openclaw hooks`; enable/disable the plugin instead.