feat(cli): unify hook pack installs under plugins

This commit is contained in:
Peter Steinberger
2026-03-22 11:19:07 -07:00
parent b44152fcc8
commit aa80b1eb7c
8 changed files with 740 additions and 400 deletions

View File

@@ -8,7 +8,7 @@ title: "Hooks"
# Hooks
Hooks provide an extensible event-driven system for automating actions in response to agent commands and events. Hooks are automatically discovered from directories and can be managed via CLI commands, similar to how skills work in OpenClaw.
Hooks provide an extensible event-driven system for automating actions in response to agent commands and events. Hooks are automatically discovered from directories and can be inspected with `openclaw hooks`, while hook-pack installation and updates now go through `openclaw plugins`.
## Getting Oriented
@@ -17,7 +17,7 @@ Hooks are small scripts that run when something happens. There are two kinds:
- **Hooks** (this page): run inside the Gateway when agent events fire, like `/new`, `/reset`, `/stop`, or lifecycle events.
- **Webhooks**: external HTTP webhooks that let other systems trigger work in OpenClaw. See [Webhook Hooks](/automation/webhook) or use `openclaw webhooks` for Gmail helper commands.
Hooks can also be bundled inside plugins; see [Plugin hooks](/plugins/architecture#provider-runtime-hooks).
Hooks can also be bundled inside plugins; see [Plugin hooks](/plugins/architecture#provider-runtime-hooks). `openclaw hooks list` shows both standalone hooks and plugin-managed hooks.
Common uses:
@@ -107,7 +107,7 @@ Hook packs are standard npm packages that export one or more hooks via `openclaw
`package.json`. Install them with:
```bash
openclaw hooks install <path-or-spec>
openclaw plugins install <path-or-spec>
```
Npm specs are registry-only (package name + optional exact version or dist-tag).
@@ -134,7 +134,7 @@ Hook packs can ship dependencies; they will be installed under `~/.openclaw/hook
Each `openclaw.hooks` entry must stay inside the package directory after symlink
resolution; entries that escape are rejected.
Security note: `openclaw hooks install` installs dependencies with `npm install --ignore-scripts`
Security note: `openclaw plugins install` installs hook-pack dependencies with `npm install --ignore-scripts`
(no lifecycle scripts). Keep hook pack dependency trees "pure JS/TS" and avoid packages that rely
on `postinstall` builds.

View File

@@ -2,7 +2,7 @@
summary: "CLI reference for `openclaw hooks` (agent hooks)"
read_when:
- You want to manage agent hooks
- You want to install or update hooks
- You want to inspect hook availability or enable workspace hooks
title: "hooks"
---
@@ -186,14 +186,17 @@ openclaw hooks disable command-logger
- Restart the gateway so hooks reload
## Install Hooks
## Install Hook Packs
```bash
openclaw hooks install <path-or-spec>
openclaw hooks install <npm-spec> --pin
openclaw plugins install <path-or-spec>
openclaw plugins install <npm-spec> --pin
```
Install a hook pack from a local folder/archive or npm.
Install hook packs through the unified plugins installer.
`openclaw hooks install` still works as a compatibility alias, but it prints a
deprecation warning and forwards to `openclaw plugins install`.
Npm specs are **registry-only** (package name + optional **exact version** or
**dist-tag**). Git/URL/file specs and semver ranges are rejected. Dependency
@@ -220,29 +223,32 @@ prerelease tag such as `@beta`/`@rc` or an exact prerelease version.
```bash
# Local directory
openclaw hooks install ./my-hook-pack
openclaw plugins install ./my-hook-pack
# Local archive
openclaw hooks install ./my-hook-pack.zip
openclaw plugins install ./my-hook-pack.zip
# NPM package
openclaw hooks install @openclaw/my-hook-pack
openclaw plugins install @openclaw/my-hook-pack
# Link a local directory without copying
openclaw hooks install -l ./my-hook-pack
openclaw plugins install -l ./my-hook-pack
```
Linked hook packs are treated as managed hooks from an operator-configured
directory, not as workspace hooks.
## Update Hooks
## Update Hook Packs
```bash
openclaw hooks update <id>
openclaw hooks update --all
openclaw plugins update <id>
openclaw plugins update --all
```
Update installed hook packs (npm installs only).
Update tracked npm-based hook packs through the unified plugins updater.
`openclaw hooks update` still works as a compatibility alias, but it prints a
deprecation warning and forwards to `openclaw plugins update`.
**Options:**

View File

@@ -8,7 +8,7 @@ title: "plugins"
# `openclaw plugins`
Manage Gateway plugins/extensions and compatible bundles.
Manage Gateway plugins/extensions, hook packs, and compatible bundles.
Related:
@@ -55,6 +55,10 @@ openclaw plugins install <plugin> --marketplace <marketplace>
Security note: treat plugin installs like running code. Prefer pinned versions.
`plugins install` is also the install surface for hook packs that expose
`openclaw.hooks` in `package.json`. Use `openclaw hooks` for filtered hook
visibility and per-hook enablement, not package installation.
Npm specs are **registry-only** (package name + optional **exact version** or
**dist-tag**). Git/URL/file specs and semver ranges are rejected. Dependency
installs run with `--ignore-scripts` for safety.
@@ -164,8 +168,8 @@ openclaw plugins update <id-or-npm-spec> --dry-run
openclaw plugins update @openclaw/voice-call@beta
```
Updates apply to tracked installs in `plugins.installs`, including npm,
ClawHub, and marketplace installs.
Updates apply to tracked installs in `plugins.installs` and tracked hook-pack
installs in `hooks.internal.installs`.
When you pass a plugin id, OpenClaw reuses the recorded install spec for that
plugin. That means previously stored dist-tags such as `@beta` and exact pinned