Delete page "unnamed"
96
unnamed.md
96
unnamed.md
@@ -1,96 +0,0 @@
|
|||||||
# Plugin Manifest Validation - Hooks and Agents Format Requirements
|
|
||||||
|
|
||||||
**Date:** 2026-01-25 (Updated)
|
|
||||||
**Impact:** Plugin installation fails with "invalid input" errors
|
|
||||||
**Severity:** Critical - blocks plugin usage entirely
|
|
||||||
|
|
||||||
## Context
|
|
||||||
|
|
||||||
When creating the data-platform plugin (v4.0.0), the plugin.json manifest had invalid formats for `hooks` and `agents` fields, causing installation to fail with:
|
|
||||||
|
|
||||||
```
|
|
||||||
Error: failed to install plugin has an invalid manifest file
|
|
||||||
validation errors: hooks: invalid input, agents: invalid input
|
|
||||||
```
|
|
||||||
|
|
||||||
## Problem
|
|
||||||
|
|
||||||
Two invalid patterns were used in plugin.json:
|
|
||||||
|
|
||||||
### 1. Any hooks field in plugin.json (INVALID)
|
|
||||||
```json
|
|
||||||
"hooks": "hooks/hooks.json"
|
|
||||||
```
|
|
||||||
OR
|
|
||||||
```json
|
|
||||||
"hooks": { "SessionStart": [...] }
|
|
||||||
```
|
|
||||||
Both are invalid. Hooks should NOT be in plugin.json at all.
|
|
||||||
|
|
||||||
### 2. Directory reference for agents (INVALID)
|
|
||||||
```json
|
|
||||||
"agents": ["./agents/"]
|
|
||||||
```
|
|
||||||
This assumed agent .md files needed to be registered in the manifest.
|
|
||||||
|
|
||||||
## Solution
|
|
||||||
|
|
||||||
### Hooks: Use separate hooks/hooks.json file (auto-discovered)
|
|
||||||
|
|
||||||
**WRONG (in plugin.json):**
|
|
||||||
```json
|
|
||||||
"hooks": "hooks/hooks.json"
|
|
||||||
```
|
|
||||||
```json
|
|
||||||
"hooks": { "SessionStart": [...] }
|
|
||||||
```
|
|
||||||
|
|
||||||
**CORRECT:** Create `hooks/hooks.json` file (separate from plugin.json):
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"hooks": {
|
|
||||||
"SessionStart": [
|
|
||||||
{
|
|
||||||
"type": "command",
|
|
||||||
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/startup-check.sh"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
The `hooks/hooks.json` file is AUTO-DISCOVERED by Claude Code. Do NOT reference it in plugin.json.
|
|
||||||
|
|
||||||
### Agents: Do NOT register .md files in plugin.json
|
|
||||||
|
|
||||||
Agent definition files (`.md`) in the `agents/` directory are automatically discovered by Claude Code. They do NOT need to be listed in plugin.json.
|
|
||||||
|
|
||||||
**WRONG:**
|
|
||||||
```json
|
|
||||||
"agents": ["./agents/"]
|
|
||||||
```
|
|
||||||
|
|
||||||
**CORRECT:** Simply omit the "agents" field entirely. Just have the .md files in the agents/ directory.
|
|
||||||
|
|
||||||
## Prevention
|
|
||||||
|
|
||||||
### Validation Checklist for New Plugins
|
|
||||||
|
|
||||||
1. **Hooks:** Create `hooks/hooks.json` file, NEVER add hooks field to plugin.json
|
|
||||||
2. **Agents:** Do not add "agents" field - .md files auto-discovered
|
|
||||||
3. **Run validation:** `./scripts/validate-marketplace.sh` before committing
|
|
||||||
4. **Test install:** Actually install the plugin before merging
|
|
||||||
|
|
||||||
### Reference Working Examples
|
|
||||||
|
|
||||||
- **projman:** Has `hooks/hooks.json`, no hooks field in plugin.json
|
|
||||||
- **pr-review:** Has `hooks/hooks.json`, no hooks field in plugin.json
|
|
||||||
- **claude-config-maintainer:** Has `hooks/hooks.json`, no hooks field in plugin.json
|
|
||||||
|
|
||||||
## Files Changed
|
|
||||||
|
|
||||||
- `plugins/data-platform/.claude-plugin/plugin.json` - Removed hooks field entirely
|
|
||||||
- `plugins/data-platform/hooks/hooks.json` - Created with proper format
|
|
||||||
|
|
||||||
---
|
|
||||||
**Tags:** plugin-development, manifest, validation, hooks, agents, data-platform, critical-fix
|
|
||||||
Reference in New Issue
Block a user