From 436d3e006847ab75791351d3cbfa06b1f4c1fc50 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Fri, 31 Jul 2026 12:34:04 +0800 Subject: [PATCH] chore: stop tracking local .cursor IDE config Remove .cursor hooks from the repo and drop gitignore exceptions so local Cursor rules and hooks stay out of version control. --- .cursor/hooks.json | 11 ------- .cursor/hooks/pre-pr-create.sh | 55 ---------------------------------- .gitignore | 4 --- 3 files changed, 70 deletions(-) delete mode 100644 .cursor/hooks.json delete mode 100755 .cursor/hooks/pre-pr-create.sh diff --git a/.cursor/hooks.json b/.cursor/hooks.json deleted file mode 100644 index 7598d5ee..00000000 --- a/.cursor/hooks.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": 1, - "hooks": { - "beforeShellExecution": [ - { - "command": ".cursor/hooks/pre-pr-create.sh", - "matcher": "gh pr create" - } - ] - } -} diff --git a/.cursor/hooks/pre-pr-create.sh b/.cursor/hooks/pre-pr-create.sh deleted file mode 100755 index ba296b5d..00000000 --- a/.cursor/hooks/pre-pr-create.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -ROOT="$(cd "$(dirname "$0")/../.." && pwd)" -cd "$ROOT" - -input="$(cat)" -command="$( - INPUT="$input" node -e 'const j=JSON.parse(process.env.INPUT||"{}"); process.stdout.write(j.command||"")' -)" - -if [[ "$command" != *"gh pr create"* ]]; then - echo '{ "permission": "allow" }' - exit 0 -fi - -resolve_base_ref() { - local ref - for ref in "${WEKNORA_PR_BASE:-github_public/main}" github_public/main origin/main main; do - if git rev-parse --verify "$ref" >/dev/null 2>&1; then - echo "$ref" - return 0 - fi - done - echo "HEAD" -} - -base_ref="$(resolve_base_ref)" -needs_frontend=false - -if git diff --name-only "${base_ref}...HEAD" 2>/dev/null | grep -q '^frontend/'; then - needs_frontend=true -fi -if git diff --name-only | grep -q '^frontend/' || git diff --name-only --cached | grep -q '^frontend/'; then - needs_frontend=true -fi - -if [[ "$needs_frontend" != true ]]; then - echo '{ "permission": "allow" }' - exit 0 -fi - -if ! "$ROOT/scripts/verify_frontend_pr.sh"; then - cat <<'EOF' -{ - "permission": "deny", - "user_message": "Frontend CI 未通过(npm test / type-check / build)。请先修复后再创建 PR。", - "agent_message": "Run `scripts/verify_frontend_pr.sh` (or `cd frontend && npm test && npm run type-check && npm run build`) and fix failures before `gh pr create`." -} -EOF - exit 2 -fi - -echo '{ "permission": "allow" }' -exit 0 diff --git a/.gitignore b/.gitignore index de61b53e..1423ddab 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,6 @@ !.env.example !.gitignore !.github/ -!.cursor/ -!.cursor/hooks.json -!.cursor/hooks/ -!.cursor/hooks/** # 敏感文件 *.pem