|
| 1 | +#!/bin/bash |
| 2 | +# user-prompt-submit hook for plugin-formatter |
| 3 | +# Suggests validation commands based on user intent |
| 4 | + |
| 5 | +# Read user message from stdin |
| 6 | +USER_MESSAGE=$(cat) |
| 7 | +MESSAGE_LOWER=$(echo "$USER_MESSAGE" | tr '[:upper:]' '[:lower:]') |
| 8 | + |
| 9 | +# Validation queries |
| 10 | +if echo "$MESSAGE_LOWER" | grep -qE "(validate|check|verify|lint).*plugin"; then |
| 11 | + echo "💡 Quick command: /validate-plugin for comprehensive checks" |
| 12 | + exit 0 |
| 13 | +fi |
| 14 | + |
| 15 | +# Naming issues |
| 16 | +if echo "$MESSAGE_LOWER" | grep -qE "(fix.*nam|renam|kebab|lowercase|camel.*case)"; then |
| 17 | + echo "💡 Quick command: /fix-naming to auto-fix naming conventions" |
| 18 | + exit 0 |
| 19 | +fi |
| 20 | + |
| 21 | +# Schema/JSON validation |
| 22 | +if echo "$MESSAGE_LOWER" | grep -qE "(schema|json.*valid|plugin.*json|check.*json)"; then |
| 23 | + echo "💡 Quick command: /check-schema for JSON validation" |
| 24 | + exit 0 |
| 25 | +fi |
| 26 | + |
| 27 | +# Creating new plugin |
| 28 | +if echo "$MESSAGE_LOWER" | grep -qE "(new plugin|create plugin|generate.*plugin|plugin.*template|start.*plugin)"; then |
| 29 | + echo "💡 Quick command: /generate-template to create plugin structure" |
| 30 | + exit 0 |
| 31 | +fi |
| 32 | + |
| 33 | +# Format/formatting queries |
| 34 | +if echo "$MESSAGE_LOWER" | grep -qE "(format.*plugin|plugin.*standard|plugin.*guideline)"; then |
| 35 | + echo "💡 This plugin enforces Claude Code marketplace standards" |
| 36 | + echo " Use /validate-plugin to check compliance" |
| 37 | + exit 0 |
| 38 | +fi |
| 39 | + |
| 40 | +# Error/issue queries |
| 41 | +if echo "$MESSAGE_LOWER" | grep -qE "(plugin.*error|plugin.*issue|plugin.*problem|fix.*plugin)"; then |
| 42 | + echo "💡 Start with /validate-plugin to identify issues" |
| 43 | + echo " Then use /fix-naming or /check-schema as needed" |
| 44 | + exit 0 |
| 45 | +fi |
| 46 | + |
| 47 | +# Help queries |
| 48 | +if echo "$MESSAGE_LOWER" | grep -qE "^(help|how|what.*command)" && echo "$MESSAGE_LOWER" | grep -q "plugin"; then |
| 49 | + echo "💡 Available commands:" |
| 50 | + echo " /validate-plugin - Comprehensive validation" |
| 51 | + echo " /fix-naming - Auto-fix naming issues" |
| 52 | + echo " /check-schema - Validate JSON schemas" |
| 53 | + echo " /generate-template - Create new plugin" |
| 54 | + exit 0 |
| 55 | +fi |
| 56 | + |
| 57 | +# Marketplace/publishing queries |
| 58 | +if echo "$MESSAGE_LOWER" | grep -qE "(publish|marketplace|submit.*plugin|ready.*publish)"; then |
| 59 | + echo "💡 Before publishing: /validate-plugin to ensure compliance" |
| 60 | + echo " All plugins must pass validation before submission" |
| 61 | + exit 0 |
| 62 | +fi |
| 63 | + |
| 64 | +# Always allow the message |
| 65 | +exit 0 |
0 commit comments