diff --git a/hooks/hooks.json b/hooks/hooks.json deleted file mode 100644 index 8376587..0000000 --- a/hooks/hooks.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "hooks": { - "SessionStart": [{ - "matcher": "startup|resume|compact", - "hooks": [{ - "type": "command", - "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/detect-project.sh\"", - "shell": "bash", - "timeout": 10, - "async": false - }] - }], - "PreToolUse": [{ - "matcher": "Write|Edit", - "hooks": [{ - "type": "command", - "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/detect-file-type.sh\"", - "shell": "bash", - "timeout": 10 - }] - }] - } -} diff --git a/hooks/scripts/detect-file-type.sh b/hooks/scripts/detect-file-type.sh deleted file mode 100755 index 913803a..0000000 --- a/hooks/scripts/detect-file-type.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# hub-guide: detect file extension and suggest language-specific rules -# Reads PreToolUse event JSON from stdin. -set -euo pipefail - -INPUT=$(cat) -FILE_PATH=$(echo "$INPUT" | grep -o '"file_path"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"file_path"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/') -EXT="${FILE_PATH##*.}" - -case "$EXT" in - ts|tsx) echo "[hub-guide] .${EXT} -> typescript" ;; - py) echo "[hub-guide] .py -> python" ;; - rs) echo "[hub-guide] .rs -> rust" ;; - go) echo "[hub-guide] .go -> go" ;; - js|jsx) echo "[hub-guide] .${EXT} -> typescript" ;; - Dockerfile|dockerfile) echo "[hub-guide] Dockerfile -> docker" ;; - yml|yaml) echo "[hub-guide] .${EXT} -> ci-cd+docker" ;; -esac diff --git a/hooks/scripts/detect-project.sh b/hooks/scripts/detect-project.sh deleted file mode 100755 index a2abbb0..0000000 --- a/hooks/scripts/detect-project.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# hub-guide: detect project type and prime best-practice skills -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" -PROJECT_DIR="$(pwd)" -SKILL_NAMES="" - -has_dep() { local n="$1"; grep -q "\"$n\"" package.json 2>/dev/null; } - -if [ -f "pnpm-workspace.yaml" ] || [ -f "lerna.json" ] || [ -f "nx.json" ] || [ -f "rush.json" ] || [ -f "turborepo.json" ]; then - SKILL_NAMES="$SKILL_NAMES, monorepo" -fi -if [ -f "tsconfig.json" ] || [ -f "jsconfig.json" ]; then - SKILL_NAMES="$SKILL_NAMES, typescript" - if has_dep "next"; then SKILL_NAMES="$SKILL_NAMES, nextjs"; fi - if has_dep "elysia"; then SKILL_NAMES="$SKILL_NAMES, elysiajs"; fi - if has_dep "hono"; then SKILL_NAMES="$SKILL_NAMES, hono-backend"; fi - if has_dep "drizzle-orm"; then SKILL_NAMES="$SKILL_NAMES, drizzle-database"; fi -fi -if [ -f "vite.config.ts" ] || [ -f "vite.config.js" ] || has_dep "react" 2>/dev/null; then - case "$SKILL_NAMES" in *react-frontend*) ;; *) SKILL_NAMES="$SKILL_NAMES, react-frontend" ;; esac -fi -if [ -f "next.config.js" ] || [ -f "next.config.ts" ] || [ -f "next.config.mjs" ]; then - case "$SKILL_NAMES" in *nextjs*) ;; *) SKILL_NAMES="$SKILL_NAMES, nextjs" ;; esac -fi -if [ -f "pyproject.toml" ] || [ -f "setup.py" ] || [ -f "requirements.txt" ] || [ -f "Pipfile" ] || [ -f "poetry.lock" ] || [ -f "uv.lock" ]; then - SKILL_NAMES="$SKILL_NAMES, python" -fi -if [ -f "Cargo.toml" ]; then SKILL_NAMES="$SKILL_NAMES, rust"; fi -if [ -f "go.mod" ]; then SKILL_NAMES="$SKILL_NAMES, go"; fi -if [ -f "Dockerfile" ] || [ -f "docker-compose.yml" ] || [ -f "compose.yml" ] || ls Dockerfile.* 2>/dev/null | grep -q .; then - SKILL_NAMES="$SKILL_NAMES, docker" -fi -if [ -d ".github/workflows" ] || [ -f ".gitlab-ci.yml" ] || [ -f "Jenkinsfile" ] || [ -f "bitbucket-pipelines.yml" ]; then - SKILL_NAMES="$SKILL_NAMES, ci-cd" -fi - -MANDATORY="engineering-principles clean-code clean-architecture testing error-handling security git-workflow api-design" -SKILL_NAMES="${SKILL_NAMES#, }" - -echo "[hub-guide] session: ${PROJECT_DIR}" -echo "[hub-guide] mandatory: ${MANDATORY}" -if [ -n "$SKILL_NAMES" ]; then - echo "[hub-guide] active: ${SKILL_NAMES}" -fi