ALL hooks now use command type (bash scripts) instead of prompt type. Prompt hooks are unreliable - model ignores instructions. Changes: - projman: SessionStart → startup-check.sh with [projman] prefix - pr-review: SessionStart → startup-check.sh with [pr-review] prefix - project-hygiene: cleanup.sh now has [project-hygiene] prefix - doc-guardian: already fixed (notify.sh with [doc-guardian] prefix) - code-sentinel: already fixed (security-check.sh with [code-sentinel] prefix) All hook output now guaranteed to have plugin name prefix. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
31 lines
1009 B
Bash
Executable File
31 lines
1009 B
Bash
Executable File
#!/bin/bash
|
|
# projman startup check hook
|
|
# Checks for common issues at session start
|
|
# All output MUST have [projman] prefix
|
|
|
|
PREFIX="[projman]"
|
|
|
|
# Check if MCP venv exists
|
|
PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT:-$(dirname "$(dirname "$(realpath "$0")")")}"
|
|
VENV_PATH="$PLUGIN_ROOT/mcp-servers/gitea/.venv/bin/python"
|
|
|
|
if [[ ! -f "$VENV_PATH" ]]; then
|
|
echo "$PREFIX MCP venvs missing - run setup.sh from installed marketplace"
|
|
exit 0
|
|
fi
|
|
|
|
# Check git remote vs .env config (only if .env exists)
|
|
if [[ -f ".env" ]]; then
|
|
CONFIGURED_REPO=$(grep -E "^GITEA_REPO=" .env 2>/dev/null | cut -d'=' -f2 | tr -d '"' || true)
|
|
if [[ -n "$CONFIGURED_REPO" ]]; then
|
|
CURRENT_REMOTE=$(git remote get-url origin 2>/dev/null | sed 's/.*[:/]\([^/]*\/[^.]*\).*/\1/' || true)
|
|
if [[ -n "$CURRENT_REMOTE" && "$CONFIGURED_REPO" != "$CURRENT_REMOTE" ]]; then
|
|
echo "$PREFIX Git remote mismatch - run /project-sync"
|
|
exit 0
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# All checks passed - say nothing
|
|
exit 0
|