v1.4.0: Major Skills Expansion - 75 Total Skills
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"description": "Web search and Tavily integration hooks",
|
||||
"hooks": {
|
||||
"PreToolUse": [
|
||||
{
|
||||
"matcher": "WebFetch",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/webfetch_to_tavily_extract.py"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "WebSearch",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/websearch_to_tavily_search.py"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "mcp__tavily__tavily-extract",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/tavily_extract_to_advanced.py"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Intercept mcp__tavily__tavily-extract to upgrade extract_depth and suggest gh CLI for GitHub URLs."""
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
try:
|
||||
data = json.load(sys.stdin)
|
||||
tool_input = data["tool_input"]
|
||||
urls = tool_input.get("urls", [])
|
||||
|
||||
# Always ensure extract_depth="advanced"
|
||||
tool_input["extract_depth"] = "advanced"
|
||||
|
||||
# Check for GitHub URLs and add soft suggestion
|
||||
github_domains = ("github.com", "raw.githubusercontent.com", "gist.github.com")
|
||||
github_urls = [url for url in urls if any(domain in url for domain in github_domains)]
|
||||
|
||||
if github_urls:
|
||||
# Allow but suggest GitHub MCP/gh CLI for next time
|
||||
print(
|
||||
json.dumps(
|
||||
{
|
||||
"systemMessage": "Tip: For GitHub URLs, use gh CLI: `gh api repos/{owner}/{repo}/contents/{path} --jq '.content' | base64 -d` for files, `gh pr view` for PRs, `gh issue view` for issues.",
|
||||
"hookSpecificOutput": {
|
||||
"hookEventName": "PreToolUse",
|
||||
"permissionDecision": "allow",
|
||||
"updatedInput": tool_input,
|
||||
},
|
||||
},
|
||||
separators=(",", ":"),
|
||||
)
|
||||
)
|
||||
sys.exit(0)
|
||||
|
||||
# Allow the call to proceed
|
||||
print(
|
||||
json.dumps(
|
||||
{
|
||||
"hookSpecificOutput": {
|
||||
"hookEventName": "PreToolUse",
|
||||
"permissionDecision": "allow",
|
||||
"updatedInput": tool_input,
|
||||
}
|
||||
},
|
||||
separators=(",", ":"),
|
||||
)
|
||||
)
|
||||
sys.exit(0)
|
||||
|
||||
except (KeyError, json.JSONDecodeError) as err:
|
||||
print(f"hook-error: {err}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
PreToolUse hook: intercept WebFetch → suggest using tavily-extract instead
|
||||
"""
|
||||
import json
|
||||
import sys
|
||||
|
||||
try:
|
||||
data = json.load(sys.stdin)
|
||||
url = data["tool_input"]["url"]
|
||||
except (KeyError, json.JSONDecodeError) as err:
|
||||
print(f"hook-error: {err}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
print(json.dumps({
|
||||
"systemMessage": "WebFetch detected. AI is directed to use Tavily extract instead.",
|
||||
"hookSpecificOutput": {
|
||||
"hookEventName": "PreToolUse",
|
||||
"permissionDecision": "deny",
|
||||
"permissionDecisionReason": f"Please use mcp__tavily__tavily-extract with urls: ['{url}'] and extract_depth: 'advanced'"
|
||||
}
|
||||
}, separators=(',', ':')))
|
||||
sys.exit(0)
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
PreToolUse hook: intercept WebSearch → suggest using Tavily search instead
|
||||
"""
|
||||
import json
|
||||
import sys
|
||||
|
||||
try:
|
||||
data = json.load(sys.stdin)
|
||||
tool_input = data["tool_input"]
|
||||
query = tool_input["query"]
|
||||
except (KeyError, json.JSONDecodeError) as err:
|
||||
print(f"hook-error: {err}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
print(json.dumps({
|
||||
"systemMessage": "WebSearch detected. AI is directed to use Tavily search instead.",
|
||||
"hookSpecificOutput": {
|
||||
"hookEventName": "PreToolUse",
|
||||
"permissionDecision": "deny",
|
||||
"permissionDecisionReason": f"Please use mcp__tavily__tavily_search with query: '{query}'"
|
||||
}
|
||||
}, separators=(',', ':')))
|
||||
sys.exit(0)
|
||||
Reference in New Issue
Block a user