@mallardbay/cursor-rules 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/setup-cursor.sh +21 -39
- package/package.json +1 -1
package/bin/setup-cursor.sh
CHANGED
|
@@ -1,57 +1,39 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
#
|
|
3
|
-
# Pulls shared Cursor rules unless running in CI, supports env-specific configs
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Combines shared and environment-specific Cursor MDC rules
|
|
4
3
|
|
|
5
4
|
set -e
|
|
6
5
|
|
|
7
|
-
# Detect CI environment
|
|
8
|
-
if [ "$CI" = "true" ] || [ "$GITHUB_ACTIONS" = "true" ] || [ "$GITLAB_CI" = "true" ] || [ "$CIRCLECI" = "true" ]; then
|
|
9
|
-
echo "Detected CI environment – skipping .cursor setup"
|
|
10
|
-
exit 0
|
|
11
|
-
fi
|
|
12
|
-
|
|
13
|
-
# Check if an argument was passed
|
|
14
6
|
ENV_TYPE="$1"
|
|
15
7
|
|
|
16
8
|
if [ -z "$ENV_TYPE" ]; then
|
|
17
|
-
echo "Usage:
|
|
18
|
-
echo "Example:
|
|
9
|
+
echo "Usage: npx @mallardbay/cursor-rules <env-type>"
|
|
10
|
+
echo "Example: npx @mallardbay/cursor-rules frontend"
|
|
19
11
|
exit 1
|
|
20
12
|
fi
|
|
21
13
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
echo "Cloning rules from $REPO_URL..."
|
|
26
|
-
|
|
27
|
-
# Remove existing .cursor and temp dir
|
|
28
|
-
rm -rf .cursor "$TMP_DIR"
|
|
14
|
+
SRC_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
15
|
+
SHARED_DIR="$SRC_DIR/.cursor/shared/rules"
|
|
16
|
+
ENV_DIR="$SRC_DIR/.cursor/$ENV_TYPE/rules"
|
|
29
17
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# Check for required rule files
|
|
34
|
-
SHARED_RULES="$TMP_DIR/.cursor/shared/rules"
|
|
35
|
-
ENV_RULES="$TMP_DIR/.cursor/$ENV_TYPE/rules"
|
|
36
|
-
|
|
37
|
-
if [ ! -f "$SHARED_RULES" ]; then
|
|
38
|
-
echo "Shared rules not found in repo."
|
|
39
|
-
rm -rf "$TMP_DIR"
|
|
18
|
+
if [ ! -d "$SHARED_DIR" ]; then
|
|
19
|
+
echo "Shared rules directory not found: $SHARED_DIR"
|
|
40
20
|
exit 1
|
|
41
21
|
fi
|
|
42
22
|
|
|
43
|
-
if [ ! -
|
|
44
|
-
echo "
|
|
45
|
-
echo "Expected: .cursor/$ENV_TYPE/rules"
|
|
46
|
-
rm -rf "$TMP_DIR"
|
|
23
|
+
if [ ! -d "$ENV_DIR" ]; then
|
|
24
|
+
echo "Environment-specific rules directory not found: $ENV_DIR"
|
|
47
25
|
exit 1
|
|
48
26
|
fi
|
|
49
27
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
28
|
+
mkdir -p .cursor/rules
|
|
29
|
+
|
|
30
|
+
# Copy all .mdc files from shared and env-specific folders into target
|
|
31
|
+
for f in "$SHARED_DIR"/*.mdc; do
|
|
32
|
+
cp "$f" .cursor/rules/
|
|
33
|
+
done
|
|
53
34
|
|
|
54
|
-
|
|
55
|
-
|
|
35
|
+
for f in "$ENV_DIR"/*.mdc; do
|
|
36
|
+
cp "$f" .cursor/rules/
|
|
37
|
+
done
|
|
56
38
|
|
|
57
|
-
echo ".cursor/rules
|
|
39
|
+
echo ".cursor/rules populated with shared and '$ENV_TYPE' rules."
|