@mallardbay/cursor-rules 1.0.4 → 1.0.6

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.
@@ -61,3 +61,10 @@ Ensure responsive and accessible design:
61
61
 
62
62
  ## File Patterns
63
63
  These rules apply to all TypeScript and TSX files in the project.
64
+
65
+ ## Components
66
+ - Keep components small and focused on a single responsibility
67
+ - Use functional components with hooks instead of class components
68
+ - Prefer `export default function ImpersonationBox() {` over `function ImpersonationBox(): React.ReactElement | null {` when defining components
69
+
70
+
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # Cursor Rules
2
+
3
+ A tool for managing Cursor IDE rules across different environment types with shared base configurations.
4
+
5
+ ## Overview
6
+
7
+ This project provides a structured way to manage Cursor IDE rules for different development environments while maintaining a shared base configuration. It supports two main environment types:
8
+
9
+ - `frontend`: Basic frontend development rules
10
+ - `frontend-lib`: Extended rules for frontend library development, inheriting from frontend rules
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @mallardbay/cursor-rules
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ To set up Cursor rules for your project, run:
21
+
22
+ ```bash
23
+ npx @mallardbay/cursor-rules <env-type>
24
+ ```
25
+
26
+ Where `<env-type>` can be either:
27
+
28
+ - `frontend`
29
+ - `frontend-lib`
30
+
31
+ ### Example
32
+
33
+ ```bash
34
+ # For frontend development
35
+ npx @mallardbay/cursor-rules frontend
36
+
37
+ # For frontend library development
38
+ npx @mallardbay/cursor-rules frontend-lib
39
+ ```
40
+
41
+ ## Project Structure
42
+
43
+ The rules are organized in the following directory structure:
44
+
45
+ ```
46
+ .cursor/
47
+ ├── shared/
48
+ │ └── rules/ # Shared base rules
49
+ ├── frontend/
50
+ │ └── rules/ # Frontend-specific rules
51
+ └── frontend-lib/
52
+ └── rules/ # Frontend library-specific rules
53
+ ```
54
+
55
+ ## Rule Inheritance
56
+
57
+ The rules follow an inheritance pattern:
58
+
59
+ - All environments include the shared base rules
60
+ - `frontend-lib` inherits rules from both `frontend` and `frontend-lib` directories
61
+
62
+ ## Development
63
+
64
+ ### Adding New Rules
65
+
66
+ 1. Create `.mdc` files in the appropriate rules directory
67
+ 2. Rules will be automatically copied to `.cursor/rules/` when running the setup script
68
+
69
+ ### Directory Structure
70
+
71
+ - `bin/setup-cursor.sh`: Main setup script
72
+ - `.cursor/shared/rules/`: Shared base rules
73
+ - `.cursor/frontend/rules/`: Frontend-specific rules
74
+ - `.cursor/frontend-lib/rules/`: Frontend library-specific rules
75
+
76
+ ## License
77
+
78
+ [Add your license information here]
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # setup-cursor.sh
3
- # Combine shared and env-specific MDC rules into .cursor/rules/
2
+ # setup-cursor.sh — frontend & frontend-lib layering with shared base
4
3
 
5
4
  set -e
6
5
 
@@ -12,25 +11,39 @@ if [ -z "$ENV_TYPE" ]; then
12
11
  exit 1
13
12
  fi
14
13
 
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"
19
-
20
- if [ ! -d "$SHARED_DIR" ]; then
21
- echo "Shared rules directory not found: $SHARED_DIR"
22
- exit 1
23
- fi
14
+ SCRIPT_PATH="$(realpath "$0")"
15
+ SRC_DIR="$(cd "$(dirname "$SCRIPT_PATH")/.." && pwd)"
24
16
 
25
- if [ ! -d "$ENV_DIR" ]; then
26
- echo "Environment-specific rules directory not found: $ENV_DIR"
27
- exit 1
28
- fi
17
+ SHARED_DIR="$SRC_DIR/.cursor/shared/rules"
18
+ FRONTEND_DIR="$SRC_DIR/.cursor/frontend/rules"
19
+ FRONTEND_LIB_DIR="$SRC_DIR/.cursor/frontend-lib/rules"
29
20
 
30
21
  mkdir -p .cursor/rules
31
22
 
32
- # Copy shared and env-specific rules into local project
33
- cp "$SHARED_DIR"/*.mdc .cursor/rules/
34
- cp "$ENV_DIR"/*.mdc .cursor/rules/
35
-
36
- echo ".cursor/rules setup complete for '$ENV_TYPE'."
23
+ copy_rules() {
24
+ local DIR="$1"
25
+ if [ -d "$DIR" ]; then
26
+ echo "Copying rules from: $DIR"
27
+ cp "$DIR"/*.mdc .cursor/rules/ 2>/dev/null || true
28
+ fi
29
+ }
30
+
31
+ # Always include shared rules
32
+ copy_rules "$SHARED_DIR"
33
+
34
+ # Inheritance handling
35
+ case "$ENV_TYPE" in
36
+ frontend)
37
+ copy_rules "$FRONTEND_DIR"
38
+ ;;
39
+ frontend-lib)
40
+ copy_rules "$FRONTEND_DIR"
41
+ copy_rules "$FRONTEND_LIB_DIR"
42
+ ;;
43
+ *)
44
+ echo "Unknown environment type: $ENV_TYPE"
45
+ exit 1
46
+ ;;
47
+ esac
48
+
49
+ echo ".cursor/rules setup complete for '$ENV_TYPE'"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mallardbay/cursor-rules",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
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",
@@ -1,63 +0,0 @@
1
- ---
2
- description: Defines best practices for building consistent, maintainable, and responsive UI in Mallard Bay projects
3
- globs:
4
- alwaysApply: false
5
- ---
6
- # UI Development Standards
7
-
8
- ## Theme Usage
9
- Use theme values consistently across all components:
10
-
11
- ### Colors
12
- - Use theme colors instead of hardcoded values
13
- - Example: `theme.colors.primary` instead of `'#000000'`
14
-
15
- ### Spacing
16
- - Use theme spacing values for margins and padding
17
- - Example: `theme.space[4]` instead of `'16px'`
18
-
19
- ### Typography
20
- - Use theme typography settings for text styles
21
- - Example: `theme.fontSizes.md` instead of `'16px'`
22
-
23
- ### Borders
24
- - Use theme border styles and radius values
25
- - Example: `theme.borders.sm` instead of `'1px solid'`
26
-
27
- ## Component Structure
28
- Maintain clean and consistent component structure:
29
-
30
- ### Nesting
31
- - Limit component nesting to maximum depth of 3
32
- - Keep component hierarchy readable and maintainable
33
-
34
- ### Inline Styles
35
- - Limit inline styles to maximum of 2 per component
36
- - Prefer theme-based styling
37
-
38
- ### Component Library
39
- - Use existing components in @mallardbay/lib-react-components, @mallardbay/lib-react-components is based off Crakra UI v2
40
- - If no component available in @mallardbay/lib-react-components, create one using Crakra UI and place it under src/components/shared/todo-lib-react-components/ to me moved later
41
-
42
- ## Responsive Design
43
- Ensure responsive and accessible design:
44
-
45
- ### Breakpoints
46
- - Use theme breakpoints for responsive design
47
- - Implement mobile-first approach
48
-
49
- ### Spacing
50
- - Use responsive spacing values
51
- - Adapt layouts for different screen sizes
52
-
53
- ### Animations
54
- - Use theme transition values for animations
55
- - Keep animations smooth and performant
56
-
57
- ### Rendering
58
- - Optimize component rendering
59
- - Avoid unnecessary re-renders
60
- - Use React.memo and useMemo when appropriate
61
-
62
- ## File Patterns
63
- These rules apply to all TypeScript and TSX files in the project.