@mallardbay/cursor-rules 1.0.14 → 1.0.16

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.
@@ -0,0 +1,267 @@
1
+ ---
2
+ name: review-pr
3
+ description: Review a pull request systematically, checking code quality, functionality, security, and adherence to project standards. Use when reviewing PRs, providing code review feedback, or checking someone else's changes.
4
+ version: 1.0.0
5
+ tags:
6
+ - pr
7
+ - review
8
+ - code-quality
9
+ - workflow
10
+ ---
11
+
12
+ # Review PR
13
+
14
+ Systematically review a pull request, checking code quality, functionality, security, tests, and adherence to project standards. Provide constructive feedback and approve or request changes.
15
+
16
+ ## When to Use
17
+
18
+ - User wants to review a pull request
19
+ - User mentions code review, PR review, or checking someone else's changes
20
+ - User provides a PR URL, number, or branch name
21
+ - When asked to review code before merge
22
+
23
+ ## Instructions
24
+
25
+ ### Step 1: Get PR Information
26
+
27
+ ```bash
28
+ # If PR number provided
29
+ gh pr view <pr-number> --json number,title,body,author,headRefName,baseRefName,files,commits
30
+
31
+ # If PR URL provided, extract number from URL
32
+ # Format: github.com/{owner}/{repo}/pull/{number}
33
+
34
+ # If branch name provided
35
+ gh pr list --head <branch-name> --json number,title,url
36
+ ```
37
+
38
+ **Key information to extract:**
39
+ - PR number, title, description
40
+ - Author and branch names
41
+ - Changed files and commit history
42
+ - Current review status
43
+
44
+ ### Step 2: Review PR Scope
45
+
46
+ - [ ] PR size is reasonable (see [code-review.mdc](mdc:.cursor/rules/code-review.mdc) - max 400 lines)
47
+ - [ ] PR description is clear and explains purpose
48
+ - [ ] Related issues/tickets are referenced
49
+ - [ ] Changes align with PR description
50
+ - [ ] No unrelated changes included
51
+
52
+ ### Step 3: Code Quality Review
53
+
54
+ Reference project standards:
55
+ - [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc) - DRY, patterns, semantic clarity, cognitive complexity
56
+ - [code-quality.mdc](mdc:.cursor/rules/code-quality.mdc) - Structure, naming, reuse
57
+ - [testing.mdc](mdc:.cursor/rules/testing.mdc) - Test requirements
58
+
59
+ **Check for:**
60
+
61
+ **Functionality & Logic**
62
+ - [ ] Code does what it's supposed to do
63
+ - [ ] Edge cases are handled
64
+ - [ ] Error handling is comprehensive
65
+ - [ ] Integration with existing code is smooth
66
+ - [ ] No obvious bugs or logic errors
67
+
68
+ **Code Quality**
69
+ - [ ] Follows existing patterns (see [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc))
70
+ - [ ] Reuses existing logic where possible
71
+ - [ ] Function names are semantic and clear
72
+ - [ ] Cognitive complexity is low
73
+ - [ ] Separation of concerns is maintained
74
+ - [ ] No code duplication (DRY principle)
75
+
76
+ **Security**
77
+ - [ ] No obvious security vulnerabilities
78
+ - [ ] Input validation and sanitization
79
+ - [ ] Authentication/authorization checks
80
+ - [ ] No sensitive data exposed
81
+ - [ ] Dependencies are up-to-date and secure
82
+
83
+ **Performance**
84
+ - [ ] No obvious performance bottlenecks
85
+ - [ ] Efficient algorithms and data structures
86
+ - [ ] No unnecessary re-renders/re-computations
87
+ - [ ] Resource cleanup (memory, connections)
88
+
89
+ **Style & Consistency**
90
+ - [ ] Follows project naming conventions
91
+ - [ ] Consistent with codebase style
92
+ - [ ] No commented-out code or debug statements
93
+ - [ ] Proper formatting
94
+
95
+ ### Step 4: Test Coverage Review
96
+
97
+ - [ ] New code has tests (see [testing.mdc](mdc:.cursor/rules/testing.mdc))
98
+ - [ ] Tests cover happy path, error cases, edge cases
99
+ - [ ] Test quality is good (clear, focused, maintainable)
100
+ - [ ] No duplicate or redundant tests
101
+ - [ ] Tests follow project patterns
102
+
103
+ ### Step 5: Breaking Changes Analysis
104
+
105
+ Check for breaking changes that could affect clients:
106
+
107
+ - [ ] API endpoints, request/response formats, or signatures changed?
108
+ - [ ] Public functions/interfaces modified or removed?
109
+ - [ ] Database schema changes that aren't backward compatible?
110
+ - [ ] Behavioral changes that alter existing functionality?
111
+ - [ ] Configuration options changed or removed?
112
+
113
+ **If breaking changes found:** Flag as **Blocking** unless properly handled with version bump, deprecation notices, migration guides, and CHANGELOG entries.
114
+
115
+ ### Step 6: Documentation Review
116
+
117
+ - [ ] Complex logic is documented
118
+ - [ ] Function/class documentation where needed
119
+ - [ ] README updated if needed
120
+ - [ ] Code comments explain "why" not "what"
121
+
122
+ ### Step 7: Architecture & Design
123
+
124
+ - [ ] Aligns with system architecture
125
+ - [ ] Follows established design patterns
126
+ - [ ] No unnecessary abstractions
127
+ - [ ] Proper separation of concerns
128
+ - [ ] Changes are maintainable
129
+
130
+ ### Step 8: Provide Feedback
131
+
132
+ **For each issue found:**
133
+
134
+ 1. **Categorize feedback:**
135
+ - **Blocking** - Must fix before merge (bugs, security, breaking changes)
136
+ - **Important** - Should fix (code quality, maintainability)
137
+ - **Suggestion** - Nice to have (style, minor improvements)
138
+ - **Question** - Need clarification
139
+
140
+ 2. **Write constructive comments:**
141
+ - Be specific about the issue
142
+ - Explain why it matters
143
+ - Suggest solutions when possible
144
+ - Reference project standards
145
+ - Use positive, respectful language
146
+
147
+ 3. **Post comments on GitHub:**
148
+
149
+ ```bash
150
+ # Post review comment on specific line
151
+ gh pr comment <pr-number> --body "Comment text" --file <file-path> --line <line-number>
152
+
153
+ # Or use API: POST /repos/{owner}/{repo}/pulls/{pull_number}/comments
154
+ # Body: {"body": "...", "path": "file.ts", "line": 42}
155
+ ```
156
+
157
+ **Comment format:**
158
+ ```markdown
159
+ **Issue:** [Brief description]
160
+
161
+ **Why:** [Why this matters - reference to standards if applicable]
162
+
163
+ **Suggestion:** [How to fix or improve]
164
+ ```
165
+
166
+ ### Step 9: Submit Review
167
+
168
+ **After reviewing:**
169
+
170
+ 1. **Summarize findings:**
171
+ - List blocking issues
172
+ - List important issues
173
+ - Note positive aspects
174
+
175
+ 2. **Submit review:**
176
+
177
+ ```bash
178
+ # Request changes (blocking issues)
179
+ gh pr review <pr-number> --request-changes --body "Review summary"
180
+
181
+ # Approve (no blocking issues)
182
+ gh pr review <pr-number> --approve --body "LGTM! Minor suggestions in comments."
183
+
184
+ # Comment only (suggestions but not blocking)
185
+ gh pr review <pr-number> --comment --body "Review summary"
186
+ ```
187
+
188
+ **API endpoint:** `POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews`
189
+ ```json
190
+ {
191
+ "body": "Review summary",
192
+ "event": "APPROVE" | "REQUEST_CHANGES" | "COMMENT",
193
+ "comments": [
194
+ {
195
+ "path": "file.ts",
196
+ "line": 42,
197
+ "body": "Comment text"
198
+ }
199
+ ]
200
+ }
201
+ ```
202
+
203
+ ### Step 10: Follow Up
204
+
205
+ - [ ] Respond to author's questions
206
+ - [ ] Re-review after changes are made
207
+ - [ ] Update review status if issues are resolved
208
+
209
+ ## Review Checklist Summary
210
+
211
+ **Must Check:**
212
+ - ✅ Functionality works correctly
213
+ - ✅ Security vulnerabilities
214
+ - ✅ Test coverage adequate
215
+ - ✅ Follows project patterns
216
+ - ✅ PR size reasonable
217
+ - ✅ Breaking changes identified and properly handled
218
+
219
+ **Should Check:**
220
+ - Code quality and maintainability
221
+ - Performance considerations
222
+ - Documentation completeness
223
+ - Error handling
224
+
225
+ **Nice to Check:**
226
+ - Code style consistency
227
+ - Minor optimizations
228
+ - Documentation improvements
229
+
230
+ ## Output Format
231
+
232
+ Provide:
233
+
234
+ 1. **Review Summary:**
235
+ - Overall assessment
236
+ - Number of blocking/important/suggestion comments
237
+ - Key findings
238
+
239
+ 2. **Comments Posted:**
240
+ - List of comments with file:line references
241
+ - Categorization (blocking/important/suggestion)
242
+
243
+ 3. **Review Decision:**
244
+ - Approve / Request Changes / Comment
245
+ - Rationale
246
+
247
+ 4. **Positive Feedback:**
248
+ - What was done well
249
+ - Appreciate good patterns or solutions
250
+
251
+ ## Notes
252
+
253
+ - **Read every line** of changed code
254
+ - **Understand context** before commenting
255
+ - **Be constructive** - focus on code, not person
256
+ - **Ask questions** rather than making demands
257
+ - **Reference standards** from project rules
258
+ - **Test locally** if possible for complex changes
259
+ - **Focus on scope** - don't request out-of-scope changes
260
+ - Use the ask questions tool if PR context is unclear
261
+
262
+ ## References
263
+
264
+ - [code-review.mdc](mdc:.cursor/rules/code-review.mdc) - PR review standards
265
+ - [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc) - Code quality standards
266
+ - [testing.mdc](mdc:.cursor/rules/testing.mdc) - Test requirements
267
+ - [code-quality.mdc](mdc:.cursor/rules/code-quality.mdc) - Code structure standards
package/README.md CHANGED
@@ -4,10 +4,12 @@ A tool for managing Cursor IDE rules and Claude Code configuration across differ
4
4
 
5
5
  ## Overview
6
6
 
7
- This project provides a structured way to manage AI agent rules for different development environments while maintaining a shared base configuration. It generates:
7
+ This project provides a structured way to manage AI agent rules and skills for different development environments while maintaining a shared base configuration. It generates:
8
8
 
9
- - **Cursor IDE**: `.cursor/rules/*.mdc` files
10
- - **Claude Code**: A combined `CLAUDE.md` file at project root
9
+ - **Cursor IDE**: `.cursor/rules/*.mdc` files and `.cursor/skills/*/SKILL.md` files
10
+ - **Claude Code**: A combined `CLAUDE.md` file and `.claude/skills/*/SKILL.md` files
11
+ - **Codex**: `.codex/skills/*/SKILL.md` files
12
+ - **Cross-platform Skills**: Skills are automatically copied to all three platform directories for maximum compatibility
11
13
 
12
14
  It supports three main environment types:
13
15
 
@@ -50,12 +52,13 @@ npx @mallardbay/cursor-rules backend
50
52
 
51
53
  ## Project Structure
52
54
 
53
- The rules are organized in the following directory structure:
55
+ The rules and skills are organized in the following directory structure:
54
56
 
55
57
  ```
56
58
  .cursor/
57
59
  ├── shared/
58
- └── rules/ # Shared base rules
60
+ ├── rules/ # Shared base rules
61
+ │ └── skills/ # Shared skills (installable workflows)
59
62
  ├── frontend/
60
63
  │ └── rules/ # Frontend-specific rules
61
64
  ├── frontend-lib/
@@ -78,15 +81,40 @@ Running the setup script generates:
78
81
  ```
79
82
  your-project/
80
83
  ├── .cursor/
81
- └── rules/ # Cursor IDE rules (*.mdc files)
82
- ├── code-quality.mdc
83
- ├── testing.mdc
84
- └── ...
84
+ ├── rules/ # Cursor IDE rules (*.mdc files)
85
+ ├── code-quality.mdc
86
+ ├── testing.mdc
87
+ └── ...
88
+ │ └── skills/ # Cursor Skills (installable workflows)
89
+ │ ├── prep-for-pr/
90
+ │ │ └── SKILL.md
91
+ │ ├── review-pr/
92
+ │ │ └── SKILL.md
93
+ │ └── address-pr-feedback/
94
+ │ └── SKILL.md
95
+ ├── .claude/
96
+ │ └── skills/ # Claude Code Skills (same skills)
97
+ │ ├── prep-for-pr/
98
+ │ │ └── SKILL.md
99
+ │ ├── review-pr/
100
+ │ │ └── SKILL.md
101
+ │ └── address-pr-feedback/
102
+ │ └── SKILL.md
103
+ ├── .codex/
104
+ │ └── skills/ # Codex Skills (same skills)
105
+ │ ├── prep-for-pr/
106
+ │ │ └── SKILL.md
107
+ │ ├── review-pr/
108
+ │ │ └── SKILL.md
109
+ │ └── address-pr-feedback/
110
+ │ └── SKILL.md
85
111
  └── CLAUDE.md # Claude Code configuration (combined rules)
86
112
  ```
87
113
 
88
114
  The `CLAUDE.md` file combines all applicable rules into a single file, with YAML frontmatter stripped for compatibility with Claude Code.
89
115
 
116
+ Skills are automatically discovered by Cursor, Claude Code, and Codex, and can be invoked with `/skill-name` in chat. The setup script copies skills to all three platform directories for cross-platform compatibility.
117
+
90
118
  ## Development
91
119
 
92
120
  ### Adding New Rules
@@ -94,14 +122,37 @@ The `CLAUDE.md` file combines all applicable rules into a single file, with YAML
94
122
  1. Create `.mdc` files in the appropriate rules directory
95
123
  2. Rules will be automatically copied to `.cursor/rules/` when running the setup script
96
124
 
125
+ ### Adding New Skills
126
+
127
+ 1. Create a skill directory in `.cursor/shared/skills/your-skill-name/`
128
+ 2. Add a `SKILL.md` file with YAML frontmatter and instructions
129
+ 3. Optionally add `scripts/`, `references/`, or `assets/` directories
130
+ 4. Skills will be automatically copied to `.cursor/skills/`, `.claude/skills/`, and `.codex/skills/` when running the setup script for cross-platform compatibility
131
+ 5. See [SKILLS.md](SKILLS.md) for detailed documentation
132
+
97
133
  ### Directory Structure
98
134
 
99
135
  - `bin/setup-cursor.sh`: Main setup script
100
136
  - `.cursor/shared/rules/`: Shared base rules
137
+ - `.cursor/shared/skills/`: Shared skills (installable workflows)
101
138
  - `.cursor/frontend/rules/`: Frontend-specific rules
102
139
  - `.cursor/frontend-lib/rules/`: Frontend library-specific rules
103
140
  - `.cursor/backend/rules/`: Backend-specific rules
104
141
 
142
+ ## Skills
143
+
144
+ This repository includes example Cursor Skills that can be installed:
145
+
146
+ - **prep-for-pr**: Prepare your branch for a PR by checking and fixing code quality issues
147
+ - **review-pr**: Systematically review someone else's PR with code quality, security, and standards checks
148
+ - **address-pr-feedback**: Find PR by branch, review feedback, create plan, implement fixes, and resolve GitHub conversations
149
+
150
+ See [SKILLS.md](SKILLS.md) for complete documentation on:
151
+ - Creating new skills
152
+ - Installing skills from GitHub
153
+ - Skill structure and format
154
+ - Best practices
155
+
105
156
  ## License
106
157
 
107
158
  [Add your license information here]
@@ -12,27 +12,29 @@ 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, 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")"
15
+ # Ensure we're in the project directory (where npx runs from)
16
+ PROJECT_DIR="$(pwd)"
17
+ echo "Setting up in project directory: $PROJECT_DIR"
18
+
19
+ # Get the real path of the script (portable across Mac/Linux)
20
+ get_real_path() {
21
+ local path="$1"
22
+ cd "$(dirname "$path")" && echo "$(pwd -P)/$(basename "$path")"
26
23
  }
27
- SCRIPT_PATH="$(resolve_path "$0")"
24
+ SCRIPT_PATH="$(get_real_path "$0")"
28
25
  SRC_DIR="$(cd "$(dirname "$SCRIPT_PATH")/.." && pwd -P)"
29
26
 
30
27
  SHARED_DIR="$SRC_DIR/.cursor/shared/rules"
31
28
  FRONTEND_DIR="$SRC_DIR/.cursor/frontend/rules"
32
29
  FRONTEND_LIB_DIR="$SRC_DIR/.cursor/frontend-lib/rules"
33
30
  BACKEND_DIR="$SRC_DIR/.cursor/backend/rules"
31
+ SHARED_SKILLS_DIR="$SRC_DIR/.cursor/shared/skills"
34
32
 
35
- mkdir -p .cursor/rules
33
+ # Create directories in project root
34
+ mkdir -p "$PROJECT_DIR/.cursor/rules"
35
+ mkdir -p "$PROJECT_DIR/.cursor/skills"
36
+ mkdir -p "$PROJECT_DIR/.claude/skills"
37
+ mkdir -p "$PROJECT_DIR/.codex/skills"
36
38
 
37
39
  # Temporary file to collect CLAUDE.md content
38
40
  CLAUDE_MD_TEMP=$(mktemp)
@@ -42,7 +44,53 @@ copy_rules() {
42
44
  local DIR="$1"
43
45
  if [ -d "$DIR" ]; then
44
46
  echo "Copying rules from: $DIR"
45
- cp "$DIR"/*.mdc .cursor/rules/ 2>/dev/null || true
47
+ cp "$DIR"/*.mdc "$PROJECT_DIR/.cursor/rules/" 2>/dev/null || true
48
+ fi
49
+ }
50
+
51
+ copy_skills() {
52
+ local DIR="$1"
53
+ echo "DEBUG: Checking skills directory: $DIR"
54
+ if [ -d "$DIR" ]; then
55
+ echo "Copying skills from: $DIR"
56
+ # Ensure target directories exist
57
+ mkdir -p "$PROJECT_DIR/.cursor/skills" "$PROJECT_DIR/.claude/skills" "$PROJECT_DIR/.codex/skills"
58
+ # Copy each skill directory to all three locations for cross-platform compatibility
59
+ local skill_count=0
60
+ for skill_dir in "$DIR"/*; do
61
+ if [ -d "$skill_dir" ] && [ -f "$skill_dir/SKILL.md" ]; then
62
+ skill_name=$(basename "$skill_dir")
63
+ echo " - Copying skill: $skill_name"
64
+ skill_count=$((skill_count + 1))
65
+ # Copy to Cursor, Claude, and Codex skill directories
66
+ if cp -r "$skill_dir" "$PROJECT_DIR/.cursor/skills/"; then
67
+ echo " ✓ Copied to .cursor/skills/"
68
+ else
69
+ echo " ✗ Failed to copy to .cursor/skills/"
70
+ fi
71
+ if cp -r "$skill_dir" "$PROJECT_DIR/.claude/skills/"; then
72
+ echo " ✓ Copied to .claude/skills/"
73
+ else
74
+ echo " ✗ Failed to copy to .claude/skills/"
75
+ fi
76
+ if cp -r "$skill_dir" "$PROJECT_DIR/.codex/skills/"; then
77
+ echo " ✓ Copied to .codex/skills/"
78
+ else
79
+ echo " ✗ Failed to copy to .codex/skills/"
80
+ fi
81
+ else
82
+ echo " - Skipping (not a valid skill): $(basename "$skill_dir")"
83
+ fi
84
+ done
85
+ if [ $skill_count -eq 0 ]; then
86
+ echo " Warning: No skills found in $DIR"
87
+ echo " Contents of $DIR:"
88
+ ls -la "$DIR" || echo " (directory listing failed)"
89
+ fi
90
+ else
91
+ echo "Warning: Skills directory not found: $DIR"
92
+ echo "DEBUG: SRC_DIR=$SRC_DIR"
93
+ echo "DEBUG: SHARED_SKILLS_DIR=$SHARED_SKILLS_DIR"
46
94
  fi
47
95
  }
48
96
 
@@ -73,6 +121,11 @@ append_to_claude_md() {
73
121
  copy_rules "$SHARED_DIR"
74
122
  append_to_claude_md "$SHARED_DIR"
75
123
 
124
+ # Always include shared skills
125
+ echo "DEBUG: SRC_DIR=$SRC_DIR"
126
+ echo "DEBUG: SHARED_SKILLS_DIR=$SHARED_SKILLS_DIR"
127
+ copy_skills "$SHARED_SKILLS_DIR"
128
+
76
129
  # Inheritance handling
77
130
  case "$ENV_TYPE" in
78
131
  frontend)
@@ -96,8 +149,18 @@ case "$ENV_TYPE" in
96
149
  esac
97
150
 
98
151
  # Generate CLAUDE.md
99
- mv "$CLAUDE_MD_TEMP" CLAUDE.md
152
+ mv "$CLAUDE_MD_TEMP" "$PROJECT_DIR/CLAUDE.md"
100
153
  trap - EXIT
101
154
  echo "CLAUDE.md generated for Claude Code"
102
155
 
103
- echo "Setup complete for '$ENV_TYPE' (Cursor + Claude)"
156
+ if [ -d "$PROJECT_DIR/.cursor/skills" ] && [ "$(ls -A "$PROJECT_DIR/.cursor/skills" 2>/dev/null)" ]; then
157
+ echo "Skills installed in:"
158
+ echo " - $PROJECT_DIR/.cursor/skills/ (Cursor)"
159
+ echo " - $PROJECT_DIR/.claude/skills/ (Claude Code)"
160
+ echo " - $PROJECT_DIR/.codex/skills/ (Codex)"
161
+ echo ""
162
+ echo "Installed skills:"
163
+ ls -1 "$PROJECT_DIR/.cursor/skills/" | sed 's/^/ - /'
164
+ fi
165
+
166
+ echo "Setup complete for '$ENV_TYPE' (Cursor + Claude + Codex)"
package/package.json CHANGED
@@ -1,12 +1,8 @@
1
1
  {
2
2
  "name": "@mallardbay/cursor-rules",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
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
- },
10
6
  "repository": "git@github.com:mallardbay/cursor-rules.git",
11
7
  "author": "mfrr1118 <mfrr@me.com>",
12
8
  "license": "MIT",
package/bin/test-setup.sh DELETED
@@ -1,108 +0,0 @@
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!"