@mallardbay/cursor-rules 1.0.16 → 1.0.18

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,61 @@ 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
47
+ # When SRC_DIR is node_modules, package is at SRC_DIR/@mallardbay/cursor-rules
48
+ # When SRC_DIR is _npx cache, package might be at SRC_DIR/node_modules/@mallardbay/cursor-rules
49
+ POSSIBLE_LOCATIONS=(
50
+ "$SRC_DIR/@mallardbay/cursor-rules"
51
+ "$SRC_DIR/node_modules/@mallardbay/cursor-rules"
52
+ "$(dirname "$SRC_DIR")/@mallardbay/cursor-rules"
53
+ "$(dirname "$(dirname "$SRC_DIR"))/@mallardbay/cursor-rules"
54
+ )
55
+
56
+ for location in "${POSSIBLE_LOCATIONS[@]}"; do
57
+ if [ -d "$location/.cursor/shared/skills" ]; then
58
+ SRC_DIR="$location"
59
+ break
60
+ fi
61
+ done
62
+
63
+ # If still not found, search for package.json with our name
64
+ if [ ! -d "$SRC_DIR/.cursor/shared/skills" ]; then
65
+ 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)
66
+ if [ -n "$PACKAGE_ROOT" ] && [ -d "$PACKAGE_ROOT/.cursor/shared/skills" ]; then
67
+ SRC_DIR="$PACKAGE_ROOT"
68
+ fi
69
+ fi
70
+ fi
71
+
72
+ echo "DEBUG: Final SRC_DIR=$SRC_DIR"
73
+ echo "DEBUG: Checking if .cursor/shared/skills exists: $([ -d "$SRC_DIR/.cursor/shared/skills" ] && echo "YES" || echo "NO")"
26
74
 
27
75
  SHARED_DIR="$SRC_DIR/.cursor/shared/rules"
28
76
  FRONTEND_DIR="$SRC_DIR/.cursor/frontend/rules"
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.18",
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",