@mallardbay/cursor-rules 1.0.11 → 1.0.14
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/.cursor/shared/rules/code-quality.mdc +2 -0
- package/bin/setup-cursor.sh +12 -5
- package/bin/test-setup.sh +108 -0
- package/package.json +5 -1
|
@@ -17,6 +17,8 @@ alwaysApply: false
|
|
|
17
17
|
- Types should be defined at the bottom of files
|
|
18
18
|
- PropTypes should be defined before component definitions
|
|
19
19
|
- Prefer using alias for importing components. Only use relative for tests or when there's a direct sibling
|
|
20
|
+
- Exported functions should be at the top of the file, with helpers organized by knowledge domain under.
|
|
21
|
+
- React component prop types should be above the component definition.
|
|
20
22
|
|
|
21
23
|
## Code Reuse
|
|
22
24
|
|
package/bin/setup-cursor.sh
CHANGED
|
@@ -12,12 +12,19 @@ if [ -z "$ENV_TYPE" ]; then
|
|
|
12
12
|
exit 1
|
|
13
13
|
fi
|
|
14
14
|
|
|
15
|
-
# Get the real path of the script (portable across Mac/Linux)
|
|
16
|
-
|
|
17
|
-
local
|
|
18
|
-
|
|
15
|
+
# Get the real path of the script (portable across Mac/Linux, follows symlinks)
|
|
16
|
+
resolve_path() {
|
|
17
|
+
local target="$1"
|
|
18
|
+
# Follow symlinks until we get to the real file
|
|
19
|
+
while [ -L "$target" ]; do
|
|
20
|
+
local link_dir="$(cd "$(dirname "$target")" && pwd -P)"
|
|
21
|
+
target="$(readlink "$target")"
|
|
22
|
+
# Handle relative symlinks
|
|
23
|
+
[[ "$target" != /* ]] && target="$link_dir/$target"
|
|
24
|
+
done
|
|
25
|
+
cd "$(dirname "$target")" && echo "$(pwd -P)/$(basename "$target")"
|
|
19
26
|
}
|
|
20
|
-
SCRIPT_PATH="$(
|
|
27
|
+
SCRIPT_PATH="$(resolve_path "$0")"
|
|
21
28
|
SRC_DIR="$(cd "$(dirname "$SCRIPT_PATH")/.." && pwd -P)"
|
|
22
29
|
|
|
23
30
|
SHARED_DIR="$SRC_DIR/.cursor/shared/rules"
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test-setup.sh — Validates setup-cursor.sh works correctly before publishing
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
6
|
+
TEST_DIR=$(mktemp -d)
|
|
7
|
+
trap 'rm -rf "$TEST_DIR"' EXIT
|
|
8
|
+
|
|
9
|
+
echo "Testing cursor-rules setup script..."
|
|
10
|
+
echo "Test directory: $TEST_DIR"
|
|
11
|
+
echo ""
|
|
12
|
+
|
|
13
|
+
# Track test results
|
|
14
|
+
PASSED=0
|
|
15
|
+
FAILED=0
|
|
16
|
+
|
|
17
|
+
# Safe increment functions (avoid set -e issues with ((0)))
|
|
18
|
+
pass() { PASSED=$((PASSED + 1)); }
|
|
19
|
+
fail() { FAILED=$((FAILED + 1)); }
|
|
20
|
+
|
|
21
|
+
run_test() {
|
|
22
|
+
local env_type="$1"
|
|
23
|
+
local expected_patterns=("${@:2}")
|
|
24
|
+
|
|
25
|
+
echo "Testing env-type: $env_type"
|
|
26
|
+
|
|
27
|
+
cd "$TEST_DIR"
|
|
28
|
+
rm -rf .cursor CLAUDE.md 2>/dev/null || true
|
|
29
|
+
|
|
30
|
+
# Run the setup script
|
|
31
|
+
if ! "$SCRIPT_DIR/setup-cursor.sh" "$env_type" > /dev/null 2>&1; then
|
|
32
|
+
echo " ❌ FAILED: Script exited with error"
|
|
33
|
+
fail
|
|
34
|
+
return
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
# Check CLAUDE.md exists and has content
|
|
38
|
+
if [ ! -f "CLAUDE.md" ]; then
|
|
39
|
+
echo " ❌ FAILED: CLAUDE.md was not created"
|
|
40
|
+
fail
|
|
41
|
+
return
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
local line_count=$(wc -l < CLAUDE.md | tr -d ' ')
|
|
45
|
+
if [ "$line_count" -lt 50 ]; then
|
|
46
|
+
echo " ❌ FAILED: CLAUDE.md has only $line_count lines (expected 50+)"
|
|
47
|
+
fail
|
|
48
|
+
return
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
# Check .cursor/rules directory was created
|
|
52
|
+
if [ ! -d ".cursor/rules" ]; then
|
|
53
|
+
echo " ❌ FAILED: .cursor/rules directory was not created"
|
|
54
|
+
fail
|
|
55
|
+
return
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
# Check for expected content patterns
|
|
59
|
+
for pattern in "${expected_patterns[@]}"; do
|
|
60
|
+
if ! grep -q "$pattern" CLAUDE.md; then
|
|
61
|
+
echo " ❌ FAILED: Missing expected content: $pattern"
|
|
62
|
+
fail
|
|
63
|
+
return
|
|
64
|
+
fi
|
|
65
|
+
done
|
|
66
|
+
|
|
67
|
+
echo " ✓ PASSED ($line_count lines in CLAUDE.md)"
|
|
68
|
+
pass
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
# Test each environment type with expected content patterns
|
|
72
|
+
run_test "frontend" "TypeScript Development Standards" "UI Development Standards" "Mallard Bay"
|
|
73
|
+
run_test "backend" "TypeScript Development Standards" "Backend Development Rules" "Mallard Bay"
|
|
74
|
+
run_test "frontend-lib" "TypeScript Development Standards" "UI Development Standards" "Mallard Bay"
|
|
75
|
+
|
|
76
|
+
# Test via symlink (simulates npx behavior)
|
|
77
|
+
echo "Testing via symlink (simulates npx)..."
|
|
78
|
+
SYMLINK_DIR=$(mktemp -d)
|
|
79
|
+
ln -s "$SCRIPT_DIR/setup-cursor.sh" "$SYMLINK_DIR/cursor-rules"
|
|
80
|
+
cd "$TEST_DIR"
|
|
81
|
+
rm -rf .cursor CLAUDE.md 2>/dev/null || true
|
|
82
|
+
|
|
83
|
+
if ! "$SYMLINK_DIR/cursor-rules" frontend > /dev/null 2>&1; then
|
|
84
|
+
echo " ❌ FAILED: Symlink execution failed"
|
|
85
|
+
fail
|
|
86
|
+
else
|
|
87
|
+
symlink_lines=$(wc -l < CLAUDE.md | tr -d ' ')
|
|
88
|
+
if [ "$symlink_lines" -lt 50 ]; then
|
|
89
|
+
echo " ❌ FAILED: Symlink test - CLAUDE.md has only $symlink_lines lines"
|
|
90
|
+
fail
|
|
91
|
+
else
|
|
92
|
+
echo " ✓ PASSED: Symlink test ($symlink_lines lines)"
|
|
93
|
+
pass
|
|
94
|
+
fi
|
|
95
|
+
fi
|
|
96
|
+
rm -rf "$SYMLINK_DIR"
|
|
97
|
+
|
|
98
|
+
echo ""
|
|
99
|
+
echo "========================================"
|
|
100
|
+
echo "Results: $PASSED passed, $FAILED failed"
|
|
101
|
+
echo "========================================"
|
|
102
|
+
|
|
103
|
+
if [ $FAILED -gt 0 ]; then
|
|
104
|
+
echo "❌ Tests failed!"
|
|
105
|
+
exit 1
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
echo "✓ All tests passed!"
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mallardbay/cursor-rules",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "Mallard Bay shared cursor rules",
|
|
5
5
|
"main": "bin/setup-cursor.sh",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "bin/test-setup.sh",
|
|
8
|
+
"prepublishOnly": "bin/test-setup.sh"
|
|
9
|
+
},
|
|
6
10
|
"repository": "git@github.com:mallardbay/cursor-rules.git",
|
|
7
11
|
"author": "mfrr1118 <mfrr@me.com>",
|
|
8
12
|
"license": "MIT",
|