@mallardbay/cursor-rules 1.0.16 → 1.0.19

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.
@@ -16,13 +16,51 @@ fi
16
16
  PROJECT_DIR="$(pwd)"
17
17
  echo "Setting up in project directory: $PROJECT_DIR"
18
18
 
19
- # Get the real path of the script (portable across Mac/Linux)
19
+ # Get the real path of the script, following symlinks (for npx compatibility)
20
+ # When run via npx, $0 points to a symlink in the npx cache
20
21
  get_real_path() {
21
22
  local path="$1"
23
+ # Try readlink -f (Linux) or readlink with manual resolution (macOS)
24
+ if command -v readlink >/dev/null 2>&1; then
25
+ local resolved
26
+ resolved=$(readlink "$path" 2>/dev/null)
27
+ if [ -n "$resolved" ]; then
28
+ # If relative symlink, resolve relative to directory of original path
29
+ if [[ "$resolved" != /* ]]; then
30
+ resolved="$(cd "$(dirname "$path")" && cd "$(dirname "$resolved")" && pwd -P)/$(basename "$resolved")"
31
+ fi
32
+ path="$resolved"
33
+ fi
34
+ fi
22
35
  cd "$(dirname "$path")" && echo "$(pwd -P)/$(basename "$path")"
23
36
  }
37
+
24
38
  SCRIPT_PATH="$(get_real_path "$0")"
25
- SRC_DIR="$(cd "$(dirname "$SCRIPT_PATH")/.." && pwd -P)"
39
+ SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd -P)"
40
+
41
+ # The script is at bin/setup-cursor.sh, so go up one level to get package root
42
+ SRC_DIR="$(cd "$SCRIPT_DIR/.." && pwd -P)"
43
+
44
+ # When run via npx, if .cursor doesn't exist at SRC_DIR, find the actual package location
45
+ if [ ! -d "$SRC_DIR/.cursor/shared/skills" ]; then
46
+ # Try multiple possible locations for the package (using individual checks instead of array for sh compatibility)
47
+ # When SRC_DIR is node_modules, package is at SRC_DIR/@mallardbay/cursor-rules
48
+ if [ -d "$SRC_DIR/@mallardbay/cursor-rules/.cursor/shared/skills" ]; then
49
+ SRC_DIR="$SRC_DIR/@mallardbay/cursor-rules"
50
+ elif [ -d "$SRC_DIR/node_modules/@mallardbay/cursor-rules/.cursor/shared/skills" ]; then
51
+ SRC_DIR="$SRC_DIR/node_modules/@mallardbay/cursor-rules"
52
+ elif [ -d "$(dirname "$SRC_DIR")/@mallardbay/cursor-rules/.cursor/shared/skills" ]; then
53
+ SRC_DIR="$(dirname "$SRC_DIR")/@mallardbay/cursor-rules"
54
+ elif [ -d "$(dirname "$(dirname "$SRC_DIR")")/@mallardbay/cursor-rules/.cursor/shared/skills" ]; then
55
+ SRC_DIR="$(dirname "$(dirname "$SRC_DIR")")/@mallardbay/cursor-rules"
56
+ else
57
+ # If still not found, search for package.json with our name
58
+ PACKAGE_ROOT=$(find "$(dirname "$SRC_DIR")" -maxdepth 5 -type f -name "package.json" -exec grep -l '"name":\s*"@mallardbay/cursor-rules"' {} \; 2>/dev/null | head -1 | xargs dirname 2>/dev/null)
59
+ if [ -n "$PACKAGE_ROOT" ] && [ -d "$PACKAGE_ROOT/.cursor/shared/skills" ]; then
60
+ SRC_DIR="$PACKAGE_ROOT"
61
+ fi
62
+ fi
63
+ fi
26
64
 
27
65
  SHARED_DIR="$SRC_DIR/.cursor/shared/rules"
28
66
  FRONTEND_DIR="$SRC_DIR/.cursor/frontend/rules"
@@ -50,7 +88,6 @@ copy_rules() {
50
88
 
51
89
  copy_skills() {
52
90
  local DIR="$1"
53
- echo "DEBUG: Checking skills directory: $DIR"
54
91
  if [ -d "$DIR" ]; then
55
92
  echo "Copying skills from: $DIR"
56
93
  # Ensure target directories exist
@@ -89,8 +126,6 @@ copy_skills() {
89
126
  fi
90
127
  else
91
128
  echo "Warning: Skills directory not found: $DIR"
92
- echo "DEBUG: SRC_DIR=$SRC_DIR"
93
- echo "DEBUG: SHARED_SKILLS_DIR=$SHARED_SKILLS_DIR"
94
129
  fi
95
130
  }
96
131
 
@@ -122,8 +157,6 @@ copy_rules "$SHARED_DIR"
122
157
  append_to_claude_md "$SHARED_DIR"
123
158
 
124
159
  # Always include shared skills
125
- echo "DEBUG: SRC_DIR=$SRC_DIR"
126
- echo "DEBUG: SHARED_SKILLS_DIR=$SHARED_SKILLS_DIR"
127
160
  copy_skills "$SHARED_SKILLS_DIR"
128
161
 
129
162
  # Inheritance handling
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mallardbay/cursor-rules",
3
- "version": "1.0.16",
3
+ "version": "1.0.19",
4
4
  "description": "Mallard Bay shared cursor rules",
5
5
  "main": "bin/setup-cursor.sh",
6
6
  "repository": "git@github.com:mallardbay/cursor-rules.git",