@mallardbay/cursor-rules 1.0.27 → 1.0.29

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.
@@ -14,7 +14,13 @@ alwaysApply: false
14
14
  - Functions: camelCase
15
15
  - Constants: UPPER_SNAKE_CASE
16
16
  - Types: PascalCase
17
- - Types should be defined at the bottom of files
17
+ - Follow this ordering within files:
18
+ 1. Imports
19
+ 2. Constants
20
+ 3. Exported functions / components
21
+ 4. Helpers and other non-exported definitions
22
+ 5. Types (when not imported)
23
+ - Exported members always come before non-exported members
18
24
  - PropTypes should be defined before component definitions
19
25
  - Prefer using alias for importing components. Only use relative for tests or when there's a direct sibling
20
26
 
@@ -53,13 +53,14 @@ We do not chase 100% coverage for its own sake. If a test doesn’t meaningfully
53
53
 
54
54
  ### Mocking Guidelines
55
55
 
56
- - Use mock helpers instead of inline mocks
57
- - Follow existing patterns for:
56
+ - **Always use mock helpers**—never define mocks inline. All mocks should come from dedicated mock helper files following existing patterns for:
58
57
  - Entity mocks
59
58
  - Apollo mocks
60
59
  - Provider mocks
60
+ - **Mock data through Apollo mocks, not module mocks**—use Apollo mock providers to control query/mutation responses instead of mocking modules or components directly
61
61
  - Keep mocks simple and maintainable
62
62
  - **Do not use variable matchers for Apollo mocks**—match exact variables (e.g. avoid `expect.anything()` or `variables: {}`) so tests fail when the component passes incorrect variables to queries or mutations
63
+ - **Never mock `@mallardbay/lib-react-components`**—if truly unavoidable, stop and ask for approval first
63
64
 
64
65
  ### Test Utilities
65
66
 
@@ -14,7 +14,13 @@ Be as strictly as possible where it delivers clear value—specifically in preve
14
14
 
15
15
  ### File Organization
16
16
 
17
- - Place types at the bottom of files
17
+ - Follow this ordering within files:
18
+ 1. Imports
19
+ 2. Constants
20
+ 3. Exported functions / components
21
+ 4. Helpers and other non-exported definitions
22
+ 5. Types (when not imported)
23
+ - Exported members always come before non-exported members
18
24
  - Define PropTypes before component definitions
19
25
 
20
26
  ## Best Practices
@@ -0,0 +1,14 @@
1
+ ---
2
+ description: When user invokes /check-and-fix-ci, apply the check-and-fix-ci skill—find PR for current branch, check CI status, fix non-transient failures, push.
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Check and Fix CI
7
+
8
+ When the user says **`/check-and-fix-ci`** (or asks to fix CI/build failures on their PR), apply the **check-and-fix-ci** skill:
9
+
10
+ 1. **Find PR** — `gh pr list --head $(git branch --show-current)`
11
+ 2. **Check CI status** — `gh pr checks <pr-number>` or `gh run list --branch <branch> --status failure`
12
+ 3. **Classify failures** — Transient (timeout, flaky, rate limit) vs non-transient (lint, tests, build, types)
13
+ 4. **Fix non-transient** — Run lint/tests/build locally, fix issues (apply fix-tests skill for local test/lint fixes)
14
+ 5. **Push** — Commit fixes and push; never use `eslint-disable` to silence errors
@@ -14,7 +14,13 @@ alwaysApply: false
14
14
  - Functions: camelCase
15
15
  - Constants: UPPER_SNAKE_CASE
16
16
  - Types: PascalCase
17
- - Types should be defined at the bottom of files
17
+ - Follow this ordering within files:
18
+ 1. Imports
19
+ 2. Constants
20
+ 3. Exported functions / components
21
+ 4. Helpers and other non-exported definitions
22
+ 5. Types (when not imported)
23
+ - Exported members always come before non-exported members
18
24
  - PropTypes should be defined before component definitions
19
25
  - Prefer using alias for importing components. Only use relative for tests or when there's a direct sibling
20
26
 
@@ -56,13 +56,14 @@ We do not chase 100% coverage for its own sake. If a test doesn’t meaningfully
56
56
 
57
57
  ### Mocking Guidelines
58
58
 
59
- - Use mock helpers instead of inline mocks
60
- - Follow existing patterns for:
59
+ - **Always use mock helpers**—never define mocks inline. All mocks should come from dedicated mock helper files following existing patterns for:
61
60
  - Entity mocks
62
61
  - Apollo mocks
63
62
  - Provider mocks
63
+ - **Mock data through Apollo mocks, not module mocks**—use Apollo mock providers to control query/mutation responses instead of mocking modules or components directly
64
64
  - Keep mocks simple and maintainable
65
65
  - **Do not use variable matchers for Apollo mocks**—match exact variables (e.g. avoid `expect.anything()` or `variables: {}`) so tests fail when the component passes incorrect variables to queries or mutations
66
+ - **Never mock `@mallardbay/lib-react-components`**—if truly unavoidable, stop and ask for approval first
66
67
 
67
68
  ### Test Utilities
68
69
 
@@ -14,7 +14,13 @@ Be as strictly as possible where it delivers clear value—specifically in preve
14
14
 
15
15
  ### File Organization
16
16
 
17
- - Place types at the bottom of files
17
+ - Follow this ordering within files:
18
+ 1. Imports
19
+ 2. Constants
20
+ 3. Exported functions / components
21
+ 4. Helpers and other non-exported definitions
22
+ 5. Types (when not imported)
23
+ - Exported members always come before non-exported members
18
24
  - Define PropTypes before component definitions
19
25
 
20
26
  ## Best Practices
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: check-and-fix-ci
3
+ description: Find the PR for the current branch, check CI/build status, fix non-transient failures, and push. Use when the user says /check-and-fix-ci, CI is failing, build is red, or needs to fix and re-push after CI failures.
4
+ version: 1.0.0
5
+ tags:
6
+ - ci
7
+ - pr
8
+ - build
9
+ - workflow
10
+ - fix
11
+ ---
12
+
13
+ # Check and Fix CI
14
+
15
+ Find the PR for the current branch, check the build status, fix any non-transient CI failures, and push again.
16
+
17
+ ## When to Use
18
+
19
+ - User says `/check-and-fix-ci`
20
+ - CI is failing on a PR and needs fixing
21
+ - Build is red and user wants to fix and re-push
22
+ - After pushing changes and CI fails
23
+
24
+ ## Prerequisites
25
+
26
+ - `gh` CLI installed and authenticated (`gh auth status`)
27
+ - Run `gh` commands with network access
28
+
29
+ ## Instructions
30
+
31
+ ### Step 1: Find the PR for the Current Branch
32
+
33
+ ```bash
34
+ BRANCH=$(git branch --show-current)
35
+ gh pr list --head "$BRANCH" --json number,title,url,headRefOid
36
+ ```
37
+
38
+ If no PR exists, inform the user and create one if appropriate. Otherwise proceed with the PR number.
39
+
40
+ ### Step 2: Check CI/Build Status
41
+
42
+ ```bash
43
+ # Get check status and details
44
+ gh pr checks <pr-number>
45
+ # Or: gh pr view <pr-number> --json statusCheckRollup
46
+ ```
47
+
48
+ **Get structured JSON for detailed failure info:**
49
+ ```bash
50
+ gh pr view <pr-number> --json statusCheckRollup
51
+ # Or for workflow runs: gh run list --branch <branch-name> --limit 5
52
+ ```
53
+
54
+ **Check failed runs:**
55
+ ```bash
56
+ gh run list --branch "$BRANCH" --status failure --limit 5
57
+ # For failed run details: gh run view <run-id> --log-failed
58
+ ```
59
+
60
+ ### Step 3: Classify Failures
61
+
62
+ **Transient (do not fix):**
63
+ - Timeout / network flakiness
64
+ - Rate limiting (429)
65
+ - Resource exhaustion (e.g. "out of memory")
66
+ - Infrastructure/service outages
67
+ - Known flaky tests that pass on retry
68
+ - Cancelled runs (e.g. superseded by new push)
69
+
70
+ **Non-transient (fix these):**
71
+ - Linting errors
72
+ - Test failures (unit, integration, e2e)
73
+ - Type errors (TypeScript)
74
+ - Build/compile errors
75
+ - Security/validation failures
76
+ - Missing or incorrect configuration
77
+
78
+ **How to tell:**
79
+ - Read error messages and logs
80
+ - Check if failure is consistent (same step/assertion always fails)
81
+ - Transient: "timeout", "connection refused", "rate limit", "cancelled"
82
+ - Non-transient: specific file:line, assertion, test name, lint rule
83
+
84
+ ### Step 4: Fix Non-Transient Issues
85
+
86
+ For each non-transient failure:
87
+
88
+ 1. **Linting:** Run `yarn lint:quiet` or `yarn lint:quiet:slow` locally and fix issues
89
+ 2. **Tests:** Run tests locally (use sharding when appropriate: `yarn test --shard=1/4`, etc.)
90
+ 3. **Build:** Run build command locally (`yarn build`, etc.)
91
+ 4. **Type errors:** Run `tsc --noEmit` or equivalent
92
+
93
+ **Reference:** [fix-tests](.cursor/shared/skills/fix-tests/SKILL.md) skill for local test/lint fixes; [testing.mdc](mdc:.cursor/rules/testing.mdc) and [general-best-practices.mdc](mdc:.cursor/rules/general-best-practices.mdc) for standards.
94
+
95
+ **Never add `eslint-disable`** to silence errors—fix the underlying issue.
96
+
97
+ ### Step 5: Push and Verify
98
+
99
+ ```bash
100
+ git add -A
101
+ git status
102
+ git commit -m "fix: <description of what was fixed>"
103
+ git push origin "$BRANCH"
104
+ ```
105
+
106
+ After pushing, wait for CI to re-run. If using `gh run watch`:
107
+ ```bash
108
+ gh run watch
109
+ ```
110
+
111
+ ### Step 6: Report Outcome
112
+
113
+ - **All fixed:** Summarize what was fixed and that CI should pass
114
+ - **Transient only:** Explain which failures are transient and suggest retrying (`gh pr checks --watch` or re-run in GitHub UI)
115
+ - **Mixed:** Fix non-transient, push, and note any transient ones to retry
116
+ - **Unclear:** Share failure logs and ask user for guidance
117
+
118
+ ## Output Format
119
+
120
+ ```markdown
121
+ ## CI Check Results
122
+
123
+ **PR:** #<number> - <title>
124
+ **Branch:** <branch>
125
+
126
+ ### Status
127
+ - [ ] / [x] Lint
128
+ - [ ] / [x] Tests
129
+ - [ ] / [x] Build
130
+ - Other: <list>
131
+
132
+ ### Failures
133
+ | Check | Type | Action |
134
+ |-------|------|--------|
135
+ | <name> | transient / non-transient | <fixed / retry / skip> |
136
+
137
+ ### Actions Taken
138
+ - <what was fixed>
139
+ - <what was pushed>
140
+
141
+ ### Next Steps
142
+ - <if any remain>
143
+ ```
144
+
145
+ ## Notes
146
+
147
+ - Prioritize fixing non-transient issues; don't waste time on flaky/timeout failures
148
+ - Run fixes locally before pushing to avoid repeated CI cycles
149
+ - Use `gh run view <run-id> --log-failed` to see detailed failure logs
150
+ - If `gh` hits auth/rate issues, prompt user to run `gh auth login` and retry
package/README.md CHANGED
@@ -147,6 +147,7 @@ This repository includes example Cursor Skills that can be installed:
147
147
  - **prep-for-pr**: Prepare your branch for a PR by checking and fixing code quality issues
148
148
  - **review-pr**: Systematically review someone else's PR with code quality, security, and standards checks
149
149
  - **address-pr-feedback**: Find PR by branch, review feedback, create plan, implement fixes, and resolve GitHub conversations
150
+ - **check-and-fix-ci**: Find PR for current branch, check CI status, fix non-transient failures, and push (invoke with `/check-and-fix-ci`)
150
151
 
151
152
  See [SKILLS.md](SKILLS.md) for complete documentation on:
152
153
  - Creating new skills
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mallardbay/cursor-rules",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
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",