@mallardbay/cursor-rules 1.0.2 → 1.0.4
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 +17 -38
- package/package.json +1 -1
package/bin/setup-cursor.sh
CHANGED
|
@@ -1,57 +1,36 @@
|
|
|
1
|
-
#!/bin/bash
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
2
|
# setup-cursor.sh
|
|
3
|
-
#
|
|
3
|
+
# Combine shared and env-specific MDC rules into .cursor/rules/
|
|
4
4
|
|
|
5
5
|
set -e
|
|
6
6
|
|
|
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
7
|
ENV_TYPE="$1"
|
|
15
8
|
|
|
16
9
|
if [ -z "$ENV_TYPE" ]; then
|
|
17
|
-
echo "Usage:
|
|
18
|
-
echo "Example:
|
|
10
|
+
echo "Usage: npx @mallardbay/cursor-rules <env-type>"
|
|
11
|
+
echo "Example: npx @mallardbay/cursor-rules frontend"
|
|
19
12
|
exit 1
|
|
20
13
|
fi
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
# Remove existing .cursor and temp dir
|
|
28
|
-
rm -rf .cursor "$TMP_DIR"
|
|
29
|
-
|
|
30
|
-
# Clone into a temporary folder
|
|
31
|
-
git clone --depth=1 "$REPO_URL" "$TMP_DIR"
|
|
32
|
-
|
|
33
|
-
# Check for required rule files
|
|
34
|
-
SHARED_RULES="$TMP_DIR/.cursor/shared/rules"
|
|
35
|
-
ENV_RULES="$TMP_DIR/.cursor/$ENV_TYPE/rules"
|
|
15
|
+
# Ensure we resolve relative to the package location (even when used via npx)
|
|
16
|
+
SRC_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
17
|
+
SHARED_DIR="$SRC_DIR/.cursor/shared/rules"
|
|
18
|
+
ENV_DIR="$SRC_DIR/.cursor/$ENV_TYPE/rules"
|
|
36
19
|
|
|
37
|
-
if [ ! -
|
|
38
|
-
echo "Shared rules not found
|
|
39
|
-
rm -rf "$TMP_DIR"
|
|
20
|
+
if [ ! -d "$SHARED_DIR" ]; then
|
|
21
|
+
echo "Shared rules directory not found: $SHARED_DIR"
|
|
40
22
|
exit 1
|
|
41
23
|
fi
|
|
42
24
|
|
|
43
|
-
if [ ! -
|
|
44
|
-
echo "
|
|
45
|
-
echo "Expected: .cursor/$ENV_TYPE/rules"
|
|
46
|
-
rm -rf "$TMP_DIR"
|
|
25
|
+
if [ ! -d "$ENV_DIR" ]; then
|
|
26
|
+
echo "Environment-specific rules directory not found: $ENV_DIR"
|
|
47
27
|
exit 1
|
|
48
28
|
fi
|
|
49
29
|
|
|
50
|
-
|
|
51
|
-
mkdir -p .cursor
|
|
52
|
-
cat "$SHARED_RULES" "$ENV_RULES" > .cursor/rules
|
|
30
|
+
mkdir -p .cursor/rules
|
|
53
31
|
|
|
54
|
-
#
|
|
55
|
-
|
|
32
|
+
# Copy shared and env-specific rules into local project
|
|
33
|
+
cp "$SHARED_DIR"/*.mdc .cursor/rules/
|
|
34
|
+
cp "$ENV_DIR"/*.mdc .cursor/rules/
|
|
56
35
|
|
|
57
|
-
echo ".cursor/rules setup complete for '$ENV_TYPE'
|
|
36
|
+
echo ".cursor/rules setup complete for '$ENV_TYPE'."
|