codingwithagent 1.0.0 → 1.1.1

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE +21 -21
  3. package/README.md +131 -37
  4. package/bin/init.js +257 -257
  5. package/package.json +56 -56
  6. package/templates/accessibility/.cursorrules +342 -342
  7. package/templates/accessibility/README.md +47 -47
  8. package/templates/antigravity/accessibility/.agent/rules/accessibility.md +501 -501
  9. package/templates/antigravity/accessibility/.agent/rules/aria-patterns.md +568 -568
  10. package/templates/antigravity/accessibility/.agent/rules/wcag-standard.md +225 -225
  11. package/templates/antigravity/accessibility/README.md +42 -42
  12. package/templates/antigravity/minimal/.agent/rules/accessibility.md +53 -53
  13. package/templates/antigravity/minimal/.agent/rules/code-quality.md +86 -86
  14. package/templates/antigravity/minimal/.agent/rules/react-components.md +164 -164
  15. package/templates/antigravity/minimal/README.md +34 -34
  16. package/templates/antigravity/standard/.agent/rules/accessibility.md +98 -98
  17. package/templates/antigravity/standard/.agent/rules/code-quality.md +166 -166
  18. package/templates/antigravity/standard/.agent/rules/pull-request-review.md +192 -192
  19. package/templates/antigravity/standard/.agent/rules/react-components.md +204 -204
  20. package/templates/antigravity/standard/.agent/rules/testing.md +197 -197
  21. package/templates/antigravity/standard/README.md +39 -39
  22. package/templates/antigravity/strict/.agent/README.md +46 -46
  23. package/templates/antigravity/strict/.agent/rules/accessibility.md +199 -199
  24. package/templates/antigravity/strict/.agent/rules/code-quality.md +268 -268
  25. package/templates/antigravity/strict/.agent/rules/pull-request-review.md +114 -114
  26. package/templates/antigravity/strict/.agent/rules/react-components.md +423 -423
  27. package/templates/antigravity/strict/.agent/rules/security.md +483 -483
  28. package/templates/antigravity/strict/.agent/rules/testing.md +280 -280
  29. package/templates/minimal/.cursorrules +48 -48
  30. package/templates/minimal/README.md +40 -40
  31. package/templates/standard/.cursorrules +184 -184
  32. package/templates/standard/README.md +43 -43
  33. package/templates/strict/.cursorrules +227 -227
  34. package/templates/strict/README.md +47 -47
@@ -1,197 +1,197 @@
1
- ---
2
- trigger: always_on
3
- ---
4
-
5
- # Testing Standards and Requirements
6
-
7
- ## Testing Philosophy
8
-
9
- - Tests ensure code quality and prevent regressions
10
- - Unit tests must accompany all new code
11
- - Tests are living documentation
12
- - Coverage should increase or maintain, never decrease
13
- - Write tests that would catch real bugs
14
-
15
- ## Coverage Requirements
16
-
17
- - Maintain unit test threshold for modern codebases
18
- - Aim for 80%+ coverage on new code
19
- - Report previous and current coverage in PRs
20
- - 100% coverage = previous not needed in PR
21
- - Coverage decrease requires justification
22
-
23
- ## Unit Testing Standards
24
-
25
- ### What to Test
26
-
27
- - All exported functions and utilities
28
- - Component rendering with various props
29
- - Conditional logic and edge cases
30
- - Event handlers and user interactions
31
- - State changes and Redux actions
32
- - Error handling and boundary conditions
33
- - PropTypes validation
34
-
35
- ### What NOT to Test
36
-
37
- - Third-party library internals
38
- - Trivial getters/setters
39
- - Constant values
40
- - External API implementations (mock these)
41
-
42
- ### Unit Test Best Practices
43
-
44
- - **Shallow render preferred**: Use shallow unless hooks require mount
45
- - **Single instance per scope**: Reuse component instance, update props/state
46
- - **No long timeouts**: Keep setTimeout < 100ms if needed
47
- - **Avoid snapshots**: Remove when possible, update reluctantly
48
- - **Mock external dependencies**: APIs, Redux store, third-party libraries
49
- - **Clean up mocks**: Use beforeEach and afterAll to reset
50
-
51
- ### Test Structure
52
-
53
- ```javascript
54
- describe("ComponentName", () => {
55
- let wrapper;
56
- let props;
57
-
58
- beforeEach(() => {
59
- props = {
60
- // default props
61
- };
62
- });
63
-
64
- afterAll(() => {
65
- jest.clearAllMocks();
66
- });
67
-
68
- it("should render correctly with default props", () => {
69
- wrapper = shallow(<ComponentName {...props} />);
70
- expect(wrapper.exists()).toBe(true);
71
- });
72
-
73
- it("should call onClick handler when button clicked", () => {
74
- const mockOnClick = jest.fn();
75
- wrapper = shallow(<ComponentName {...props} onClick={mockOnClick} />);
76
- wrapper.find("button").simulate("click");
77
- expect(mockOnClick).toHaveBeenCalledTimes(1);
78
- });
79
- });
80
- ```
81
-
82
- ### Dates in Tests
83
-
84
- - Do NOT mock dates in the future
85
- - Override moment.now in tests if current date used
86
- - Use consistent date formats
87
- - Test timezone handling
88
-
89
- ### Component Testing
90
-
91
- - Test all user interactions
92
- - Verify proper prop handling
93
- - Test conditional rendering paths
94
- - Verify event handlers fire correctly
95
- - Test error states and loading states
96
- - Accessibility: Test keyboard navigation, ARIA labels
97
-
98
- ### Integration Testing
99
-
100
- - Test user journeys across multiple components
101
- - Verify data flow through Redux
102
- - Test routing and navigation
103
- - Verify API integration with mocked responses
104
-
105
- ### Testing Tools
106
-
107
- - Jest: Test runner and assertion library
108
- - React Testing Library: Component testing (preferred)
109
- - Enzyme: Shallow/mount rendering (legacy, minimize use)
110
- - React Hooks Testing Library: For custom hooks
111
- - Mock Service Worker (MSW): API mocking
112
-
113
- ### Test Naming Conventions
114
-
115
- - Describe blocks: Component or function name
116
- - It blocks: "should [expected behavior] when [condition]"
117
- - Be specific and descriptive
118
- - Avoid "works correctly" or "is defined"
119
-
120
- ```javascript
121
- // GOOD
122
- it("should display error message when form submission fails", () => {});
123
- it("should disable submit button when form is invalid", () => {});
124
-
125
- // BAD
126
- it("works correctly", () => {});
127
- it("handles errors", () => {});
128
- ```
129
-
130
- ## Mocking Best Practices
131
-
132
- ### When to Mock
133
-
134
- - External API calls
135
- - Redux store and actions
136
- - Browser APIs (localStorage, window, document)
137
- - Third-party libraries
138
- - Time-dependent functions (Date, moment)
139
- - File system operations
140
-
141
- ### How to Mock
142
-
143
- ```javascript
144
- // Mock module
145
- jest.mock("../utils/api", () => ({
146
- fetchData: jest.fn(),
147
- }));
148
-
149
- // Mock with implementation
150
- const mockFn = jest.fn((a, b) => a + b);
151
-
152
- // Restore after tests
153
- afterEach(() => {
154
- jest.clearAllMocks();
155
- });
156
-
157
- afterAll(() => {
158
- jest.restoreAllMocks();
159
- });
160
- ```
161
-
162
- ### What NOT to Mock
163
-
164
- - Component's own functions (test real behavior)
165
- - Simple utility functions (test actual implementation)
166
- - PropTypes validation
167
- - React internals
168
-
169
- ## Testing Anti-Patterns
170
-
171
- ### Avoid These
172
-
173
- - Testing implementation details instead of behavior
174
- - Testing third-party library internals
175
- - Snapshot tests without review
176
- - Excessive mocking that doesn't reflect real usage
177
- - Tests that pass regardless of code correctness
178
- - setTimeout without cleanup
179
- - Tests depending on execution order
180
-
181
- ### Do This Instead
182
-
183
- - Test user-visible behavior
184
- - Mock external dependencies only
185
- - Explicit assertions over snapshots
186
- - Realistic mocks reflecting actual API responses
187
- - Assertions that would fail if code breaks
188
- - Immediate assertions or controlled timing
189
- - Independent, isolated tests
190
-
191
- ### Accessibility Testing
192
-
193
- - Test keyboard navigation (Tab, Enter, Space, Escape)
194
- - Verify ARIA labels and roles
195
- - Test screen reader announcements
196
- - Verify focus management
197
- - Test with accessibility testing libraries
1
+ ---
2
+ trigger: always_on
3
+ ---
4
+
5
+ # Testing Standards and Requirements
6
+
7
+ ## Testing Philosophy
8
+
9
+ - Tests ensure code quality and prevent regressions
10
+ - Unit tests must accompany all new code
11
+ - Tests are living documentation
12
+ - Coverage should increase or maintain, never decrease
13
+ - Write tests that would catch real bugs
14
+
15
+ ## Coverage Requirements
16
+
17
+ - Maintain unit test threshold for modern codebases
18
+ - Aim for 80%+ coverage on new code
19
+ - Report previous and current coverage in PRs
20
+ - 100% coverage = previous not needed in PR
21
+ - Coverage decrease requires justification
22
+
23
+ ## Unit Testing Standards
24
+
25
+ ### What to Test
26
+
27
+ - All exported functions and utilities
28
+ - Component rendering with various props
29
+ - Conditional logic and edge cases
30
+ - Event handlers and user interactions
31
+ - State changes and Redux actions
32
+ - Error handling and boundary conditions
33
+ - PropTypes validation
34
+
35
+ ### What NOT to Test
36
+
37
+ - Third-party library internals
38
+ - Trivial getters/setters
39
+ - Constant values
40
+ - External API implementations (mock these)
41
+
42
+ ### Unit Test Best Practices
43
+
44
+ - **Shallow render preferred**: Use shallow unless hooks require mount
45
+ - **Single instance per scope**: Reuse component instance, update props/state
46
+ - **No long timeouts**: Keep setTimeout < 100ms if needed
47
+ - **Avoid snapshots**: Remove when possible, update reluctantly
48
+ - **Mock external dependencies**: APIs, Redux store, third-party libraries
49
+ - **Clean up mocks**: Use beforeEach and afterAll to reset
50
+
51
+ ### Test Structure
52
+
53
+ ```javascript
54
+ describe("ComponentName", () => {
55
+ let wrapper;
56
+ let props;
57
+
58
+ beforeEach(() => {
59
+ props = {
60
+ // default props
61
+ };
62
+ });
63
+
64
+ afterAll(() => {
65
+ jest.clearAllMocks();
66
+ });
67
+
68
+ it("should render correctly with default props", () => {
69
+ wrapper = shallow(<ComponentName {...props} />);
70
+ expect(wrapper.exists()).toBe(true);
71
+ });
72
+
73
+ it("should call onClick handler when button clicked", () => {
74
+ const mockOnClick = jest.fn();
75
+ wrapper = shallow(<ComponentName {...props} onClick={mockOnClick} />);
76
+ wrapper.find("button").simulate("click");
77
+ expect(mockOnClick).toHaveBeenCalledTimes(1);
78
+ });
79
+ });
80
+ ```
81
+
82
+ ### Dates in Tests
83
+
84
+ - Do NOT mock dates in the future
85
+ - Override moment.now in tests if current date used
86
+ - Use consistent date formats
87
+ - Test timezone handling
88
+
89
+ ### Component Testing
90
+
91
+ - Test all user interactions
92
+ - Verify proper prop handling
93
+ - Test conditional rendering paths
94
+ - Verify event handlers fire correctly
95
+ - Test error states and loading states
96
+ - Accessibility: Test keyboard navigation, ARIA labels
97
+
98
+ ### Integration Testing
99
+
100
+ - Test user journeys across multiple components
101
+ - Verify data flow through Redux
102
+ - Test routing and navigation
103
+ - Verify API integration with mocked responses
104
+
105
+ ### Testing Tools
106
+
107
+ - Jest: Test runner and assertion library
108
+ - React Testing Library: Component testing (preferred)
109
+ - Enzyme: Shallow/mount rendering (legacy, minimize use)
110
+ - React Hooks Testing Library: For custom hooks
111
+ - Mock Service Worker (MSW): API mocking
112
+
113
+ ### Test Naming Conventions
114
+
115
+ - Describe blocks: Component or function name
116
+ - It blocks: "should [expected behavior] when [condition]"
117
+ - Be specific and descriptive
118
+ - Avoid "works correctly" or "is defined"
119
+
120
+ ```javascript
121
+ // GOOD
122
+ it("should display error message when form submission fails", () => {});
123
+ it("should disable submit button when form is invalid", () => {});
124
+
125
+ // BAD
126
+ it("works correctly", () => {});
127
+ it("handles errors", () => {});
128
+ ```
129
+
130
+ ## Mocking Best Practices
131
+
132
+ ### When to Mock
133
+
134
+ - External API calls
135
+ - Redux store and actions
136
+ - Browser APIs (localStorage, window, document)
137
+ - Third-party libraries
138
+ - Time-dependent functions (Date, moment)
139
+ - File system operations
140
+
141
+ ### How to Mock
142
+
143
+ ```javascript
144
+ // Mock module
145
+ jest.mock("../utils/api", () => ({
146
+ fetchData: jest.fn(),
147
+ }));
148
+
149
+ // Mock with implementation
150
+ const mockFn = jest.fn((a, b) => a + b);
151
+
152
+ // Restore after tests
153
+ afterEach(() => {
154
+ jest.clearAllMocks();
155
+ });
156
+
157
+ afterAll(() => {
158
+ jest.restoreAllMocks();
159
+ });
160
+ ```
161
+
162
+ ### What NOT to Mock
163
+
164
+ - Component's own functions (test real behavior)
165
+ - Simple utility functions (test actual implementation)
166
+ - PropTypes validation
167
+ - React internals
168
+
169
+ ## Testing Anti-Patterns
170
+
171
+ ### Avoid These
172
+
173
+ - Testing implementation details instead of behavior
174
+ - Testing third-party library internals
175
+ - Snapshot tests without review
176
+ - Excessive mocking that doesn't reflect real usage
177
+ - Tests that pass regardless of code correctness
178
+ - setTimeout without cleanup
179
+ - Tests depending on execution order
180
+
181
+ ### Do This Instead
182
+
183
+ - Test user-visible behavior
184
+ - Mock external dependencies only
185
+ - Explicit assertions over snapshots
186
+ - Realistic mocks reflecting actual API responses
187
+ - Assertions that would fail if code breaks
188
+ - Immediate assertions or controlled timing
189
+ - Independent, isolated tests
190
+
191
+ ### Accessibility Testing
192
+
193
+ - Test keyboard navigation (Tab, Enter, Space, Escape)
194
+ - Verify ARIA labels and roles
195
+ - Test screen reader announcements
196
+ - Verify focus management
197
+ - Test with accessibility testing libraries
@@ -1,39 +1,39 @@
1
- # Antigravity - Standard Profile ⭐
2
-
3
- Recommended baseline for production code with comprehensive rules.
4
-
5
- ## What's Included
6
-
7
- 5 detailed rule files:
8
-
9
- - `accessibility.md` - WCAG 2.1 AA standards
10
- - `code-quality.md` - Naming, patterns, best practices
11
- - `react-components.md` - Hooks, JSX, component design
12
- - `testing.md` - 80%+ coverage, testing patterns
13
- - `pull-request-review.md` - PR standards and review checklist
14
-
15
- ## Installation
16
-
17
- ```bash
18
- npx codingwithagent init
19
- # Select tool: 3. Antigravity
20
- # Select profile: 2. Standard
21
- ```
22
-
23
- ## Files created
24
-
25
- ```
26
- .agent/rules/
27
- ├── accessibility.md
28
- ├── code-quality.md
29
- ├── react-components.md
30
- ├── testing.md
31
- └── pull-request-review.md
32
- ```
33
-
34
- ## Best For
35
-
36
- - Production applications
37
- - Team projects
38
- - Enterprise development
39
- - Long-term maintenance
1
+ # Antigravity - Standard Profile ⭐
2
+
3
+ Recommended baseline for production code with comprehensive rules.
4
+
5
+ ## What's Included
6
+
7
+ 5 detailed rule files:
8
+
9
+ - `accessibility.md` - WCAG 2.1 AA standards
10
+ - `code-quality.md` - Naming, patterns, best practices
11
+ - `react-components.md` - Hooks, JSX, component design
12
+ - `testing.md` - 80%+ coverage, testing patterns
13
+ - `pull-request-review.md` - PR standards and review checklist
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npx codingwithagent init
19
+ # Select tool: 3. Antigravity
20
+ # Select profile: 2. Standard
21
+ ```
22
+
23
+ ## Files created
24
+
25
+ ```
26
+ .agent/rules/
27
+ ├── accessibility.md
28
+ ├── code-quality.md
29
+ ├── react-components.md
30
+ ├── testing.md
31
+ └── pull-request-review.md
32
+ ```
33
+
34
+ ## Best For
35
+
36
+ - Production applications
37
+ - Team projects
38
+ - Enterprise development
39
+ - Long-term maintenance
@@ -1,46 +1,46 @@
1
- # Antigravity - Strict Profile
2
-
3
- Maximum enforcement with zero tolerance for violations.
4
-
5
- ## What's Included
6
-
7
- 6 comprehensive rule files:
8
-
9
- - `accessibility.md` - WCAG 2.1 AAA standards
10
- - `code-quality.md` - 90% coverage, TypeScript mandatory
11
- - `react-components.md` - 100% component coverage, strict hooks
12
- - `testing.md` - 90% minimum, zero flaky tests
13
- - `pull-request-review.md` - 2+ approvals, strict SLA
14
- - `security.md` - OWASP compliance, zero vulnerabilities
15
-
16
- ## Installation
17
-
18
- ```bash
19
- npx codingwithagent init
20
- # Select tool: 3. Antigravity
21
- # Select profile: 3. Strict
22
- ```
23
-
24
- ## Files created
25
-
26
- ```
27
- .agent/rules/
28
- ├── accessibility.md
29
- ├── code-quality.md
30
- ├── react-components.md
31
- ├── testing.md
32
- ├── pull-request-review.md
33
- └── security.md
34
- ```
35
-
36
- ## Requirements
37
-
38
- - TypeScript (no `any` type)
39
- - Components max 150 lines
40
- - Lighthouse accessibility: 100
41
- - Security vulnerabilities: 0
42
- - Performance score: >90
43
-
44
- ## Warning
45
-
46
- Only use if committed to maximum quality.
1
+ # Antigravity - Strict Profile
2
+
3
+ Maximum enforcement with zero tolerance for violations.
4
+
5
+ ## What's Included
6
+
7
+ 6 comprehensive rule files:
8
+
9
+ - `accessibility.md` - WCAG 2.1 AAA standards
10
+ - `code-quality.md` - 90% coverage, TypeScript mandatory
11
+ - `react-components.md` - 100% component coverage, strict hooks
12
+ - `testing.md` - 90% minimum, zero flaky tests
13
+ - `pull-request-review.md` - 2+ approvals, strict SLA
14
+ - `security.md` - OWASP compliance, zero vulnerabilities
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npx codingwithagent init
20
+ # Select tool: 3. Antigravity
21
+ # Select profile: 3. Strict
22
+ ```
23
+
24
+ ## Files created
25
+
26
+ ```
27
+ .agent/rules/
28
+ ├── accessibility.md
29
+ ├── code-quality.md
30
+ ├── react-components.md
31
+ ├── testing.md
32
+ ├── pull-request-review.md
33
+ └── security.md
34
+ ```
35
+
36
+ ## Requirements
37
+
38
+ - TypeScript (no `any` type)
39
+ - Components max 150 lines
40
+ - Lighthouse accessibility: 100
41
+ - Security vulnerabilities: 0
42
+ - Performance score: >90
43
+
44
+ ## Warning
45
+
46
+ Only use if committed to maximum quality.