Files
worktrunk/docs
Maximilian RoosandClaude Opus 5.5 2661ba15bf feat(plugin): add wt config plugins claude hook for the Claude hooks (#4304)
Adds a hidden `wt config plugins claude hook` subcommand that reads
Claude Code's hook payload from stdin and acts on its `hook_event_name`:
activity markers, the `EnterWorktree` approval, and `WorktreeCreate` /
`WorktreeRemove`. This is the first half of getting the Claude Code
plugin into Anthropic's plugin directory, whose validator blocks our
current `hooks/hooks.json` because its commands compute paths (`-C
"$CLAUDE_PROJECT_DIR"`) and carry inline programs (`bash -c '…$(jq
…)…'`). Once `hooks.json` runs this subcommand, every hook command is
the same literal line and the plugin no longer needs `jq`.

`hooks.json` itself is unchanged here. The marketplace serves the plugin
from `main`, so switching it before a release ships `hook` would break
worktree creation for everyone on v0.79. The switch is a separate draft
PR, to merge a few weeks after the release that ships this.

- `src/commands/config/plugins.rs`: `handle_claude_hook` dispatches on
the event and re-runs the same `wt` binary with the command a user would
type, so each action behaves exactly as the old hook command did. Its
doc comment carries the per-event contracts (#2939, #3545, #3754,
#3921).
- `approve-enter-worktree` stays, sharing its check with `hook`, for
plugin copies installed before `hook` existed: marketplace installs
don't update on their own.
- `tests/integration_tests/claude_hook.rs` covers the new subcommand
directly; the existing shell-integration tests still run the real
`hooks.json` commands.
- `plugin.json` gains the listing metadata the directory reads
(`license`, `homepage`, `repository`, `keywords`, `icon`, with
`icon.png` copied from `docs/public/logo.png`), and the plugin README
describes what each hook runs, which the directory's security scan
checks for.
- The direnv example in the tips docs builds its path with direnv's
`expand_path` instead of `$PWD`, which the directory scanner read as a
credential.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 23:44:24 -07:00
..