forked from RaminNietzsche/CVE-Radar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync-agent-rules-skills.sh
More file actions
executable file
·37 lines (32 loc) · 1.16 KB
/
Copy pathsync-agent-rules-skills.sh
File metadata and controls
executable file
·37 lines (32 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
# Sync Cursor rules/skills between tracked agent/ and local .cursor/ (gitignored).
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
AGENT_SKILLS="$ROOT/agent/skills"
AGENT_RULES="$ROOT/agent/rules"
CURSOR_SKILLS="$ROOT/.cursor/skills"
CURSOR_RULES="$ROOT/.cursor/rules"
usage() {
echo "Usage: $0 [--to-cursor]"
echo " (default) .cursor/ -> agent/ (refresh committed copy)"
echo " --to-cursor agent/ -> .cursor/ (after git clone)"
}
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
usage
exit 0
fi
mkdir -p "$AGENT_SKILLS" "$AGENT_RULES"
if [[ "${1:-}" == "--to-cursor" ]]; then
mkdir -p "$CURSOR_SKILLS" "$CURSOR_RULES"
rsync -a --delete --exclude='templates' "$AGENT_SKILLS/" "$CURSOR_SKILLS/"
rsync -a --delete "$AGENT_RULES/" "$CURSOR_RULES/"
echo "OK: agent/ -> .cursor/ (rules + skills, no templates)"
else
if [[ ! -d "$CURSOR_SKILLS" && ! -d "$CURSOR_RULES" ]]; then
echo "WARN: .cursor/ missing; nothing to pull into agent/" >&2
exit 1
fi
rsync -a --delete --exclude='templates' "$CURSOR_SKILLS/" "$AGENT_SKILLS/"
rsync -a --delete "$CURSOR_RULES/" "$AGENT_RULES/"
echo "OK: .cursor/ -> agent/"
fi