Files
Brandon Martin 39b89360ac fix(plugins): wrap packaged core hooks (#8)
## Summary
- wrap the generated `plugins/cce-core/hooks/hooks.json` contents under
a top-level `hooks` key
- keep `cce-core` pointing at `./hooks/hooks.json` while making the file
shape match the plugin loader schema
- update the package sync script so regenerated core hooks stay valid

## Why
Marketplace installs of `cce-core` failed with:

```text
Hook load failed: [
  {
    "expected": "record",
    "code": "invalid_type",
    "path": ["hooks"],
    "message": "Invalid input: expected record, received undefined"
  }
]
```

The plugin loader expects the external hooks file to contain a top-level
`hooks` record. Our generated file started directly with event keys like
`PreToolUse` and `PostToolUse`, so the loader could not find `hooks`.

## Changes
- update `scripts/sync_plugin_packages.py` to emit `{ "hooks": { ... }
}` for the generated core hooks file
- regenerate `plugins/cce-core/hooks/hooks.json`

## Verification
- `python3 scripts/sync_plugin_packages.py`
- `python3 -m py_compile scripts/sync_plugin_packages.py
install_extensions.py`
- validated `plugins/cce-core/hooks/hooks.json` contains a top-level
`hooks` object
2026-04-01 22:39:30 -05:00

109 lines
2.3 KiB
JSON

{
"hooks": {
"PreToolUse": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "uv run \"${CLAUDE_PLUGIN_ROOT}\"/hooks/pre_tool_use.py"
}
]
}
],
"PostToolUse": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "uv run \"${CLAUDE_PLUGIN_ROOT}\"/hooks/post_tool_use.py"
}
]
},
{
"matcher": "Edit|MultiEdit|Write",
"hooks": [
{
"type": "command",
"command": "uv run \"${CLAUDE_PLUGIN_ROOT}\"/hooks/lint/check.py"
}
]
}
],
"Notification": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "uv run \"${CLAUDE_PLUGIN_ROOT}\"/hooks/notification.py --notify"
},
{
"type": "command",
"command": "uv run \"${CLAUDE_PLUGIN_ROOT}\"/hooks/discord_notification.py"
}
]
}
],
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "uv run \"${CLAUDE_PLUGIN_ROOT}\"/hooks/stop.py --chat"
},
{
"type": "command",
"command": "uv run \"${CLAUDE_PLUGIN_ROOT}\"/hooks/discord_notification.py --emoji \u2705"
}
]
}
],
"SubagentStop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "uv run \"${CLAUDE_PLUGIN_ROOT}\"/hooks/subagent_stop.py"
}
]
}
],
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "uv run \"${CLAUDE_PLUGIN_ROOT}\"/hooks/user_prompt_submit.py --log-only"
}
]
}
],
"PreCompact": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "uv run \"${CLAUDE_PLUGIN_ROOT}\"/hooks/pre_compact.py"
}
]
}
],
"SessionStart": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "uv run \"${CLAUDE_PLUGIN_ROOT}\"/hooks/session_start.py"
}
]
}
]
}
}