#!/usr/bin/env bash # One-time sync: copy Cursor hooks and rules from the parser repo into this repo, then render hooks.json. # Run from kink_cli root: bash scripts/install_cursor_from_parser.sh set -euo pipefail KINK_ROOT="$(cd "$(dirname "$0")/.." && pwd)" PARSER_ROOT="${PARSER_ROOT:-${HOME}/PycharmProjects/parser}" if test ! -d "${PARSER_ROOT}/.cursor/hooks"; then echo "Missing ${PARSER_ROOT}/.cursor/hooks; set PARSER_ROOT to your parser checkout." >&2 exit 1 fi mkdir -p "${KINK_ROOT}/.cursor/hooks/state" "${KINK_ROOT}/.cursor/rules" cp -a "${PARSER_ROOT}/.cursor/hooks/"*.py "${PARSER_ROOT}/.cursor/hooks/"*.sh "${KINK_ROOT}/.cursor/hooks/" cp -a "${PARSER_ROOT}/.cursor/rules/"*.mdc "${KINK_ROOT}/.cursor/rules/" install -D -m0644 "${PARSER_ROOT}/semgrep.yml" "${KINK_ROOT}/semgrep.yml" install -D -m0644 "${PARSER_ROOT}/scripts/codex_baseline.py" "${KINK_ROOT}/scripts/codex_baseline.py" install -D -m0644 "${PARSER_ROOT}/scripts/codex_review.py" "${KINK_ROOT}/scripts/codex_review.py" PYTHON_BIN="${KINK_ROOT}/.venv/bin/python" if test ! -x "${PYTHON_BIN}"; then PYTHON_BIN="$(command -v python3)" fi cat >"${KINK_ROOT}/.cursor/hooks.json" <