developer-ai 1.0.0

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 (105) hide show
  1. package/README.md +241 -0
  2. package/bin/developer-ai.js +2 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +219 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/config/index.d.ts +7 -0
  8. package/dist/config/index.d.ts.map +1 -0
  9. package/dist/config/index.js +82 -0
  10. package/dist/config/index.js.map +1 -0
  11. package/dist/config/schema.d.ts +115 -0
  12. package/dist/config/schema.d.ts.map +1 -0
  13. package/dist/config/schema.js +29 -0
  14. package/dist/config/schema.js.map +1 -0
  15. package/dist/constants.d.ts +8 -0
  16. package/dist/constants.d.ts.map +1 -0
  17. package/dist/constants.js +8 -0
  18. package/dist/constants.js.map +1 -0
  19. package/dist/core/agent.d.ts +38 -0
  20. package/dist/core/agent.d.ts.map +1 -0
  21. package/dist/core/agent.js +155 -0
  22. package/dist/core/agent.js.map +1 -0
  23. package/dist/core/system-prompt.d.ts +6 -0
  24. package/dist/core/system-prompt.d.ts.map +1 -0
  25. package/dist/core/system-prompt.js +44 -0
  26. package/dist/core/system-prompt.js.map +1 -0
  27. package/dist/core/types.d.ts +42 -0
  28. package/dist/core/types.d.ts.map +1 -0
  29. package/dist/core/types.js +6 -0
  30. package/dist/core/types.js.map +1 -0
  31. package/dist/index.d.ts +15 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +12 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/mcp/client.d.ts +13 -0
  36. package/dist/mcp/client.d.ts.map +1 -0
  37. package/dist/mcp/client.js +202 -0
  38. package/dist/mcp/client.js.map +1 -0
  39. package/dist/providers/ollama.d.ts +13 -0
  40. package/dist/providers/ollama.d.ts.map +1 -0
  41. package/dist/providers/ollama.js +60 -0
  42. package/dist/providers/ollama.js.map +1 -0
  43. package/dist/providers/openai.d.ts +9 -0
  44. package/dist/providers/openai.d.ts.map +1 -0
  45. package/dist/providers/openai.js +40 -0
  46. package/dist/providers/openai.js.map +1 -0
  47. package/dist/skills/loader.d.ts +25 -0
  48. package/dist/skills/loader.d.ts.map +1 -0
  49. package/dist/skills/loader.js +93 -0
  50. package/dist/skills/loader.js.map +1 -0
  51. package/dist/tests/tools.test.d.ts +2 -0
  52. package/dist/tests/tools.test.d.ts.map +1 -0
  53. package/dist/tests/tools.test.js +170 -0
  54. package/dist/tests/tools.test.js.map +1 -0
  55. package/dist/tools/index.d.ts +5 -0
  56. package/dist/tools/index.d.ts.map +1 -0
  57. package/dist/tools/index.js +19 -0
  58. package/dist/tools/index.js.map +1 -0
  59. package/dist/tools/list-files.d.ts +3 -0
  60. package/dist/tools/list-files.d.ts.map +1 -0
  61. package/dist/tools/list-files.js +60 -0
  62. package/dist/tools/list-files.js.map +1 -0
  63. package/dist/tools/read-file.d.ts +3 -0
  64. package/dist/tools/read-file.d.ts.map +1 -0
  65. package/dist/tools/read-file.js +46 -0
  66. package/dist/tools/read-file.js.map +1 -0
  67. package/dist/tools/registry.d.ts +24 -0
  68. package/dist/tools/registry.d.ts.map +1 -0
  69. package/dist/tools/registry.js +37 -0
  70. package/dist/tools/registry.js.map +1 -0
  71. package/dist/tools/run-command.d.ts +3 -0
  72. package/dist/tools/run-command.d.ts.map +1 -0
  73. package/dist/tools/run-command.js +114 -0
  74. package/dist/tools/run-command.js.map +1 -0
  75. package/dist/tools/search-text.d.ts +3 -0
  76. package/dist/tools/search-text.d.ts.map +1 -0
  77. package/dist/tools/search-text.js +103 -0
  78. package/dist/tools/search-text.js.map +1 -0
  79. package/dist/tools/utils.d.ts +6 -0
  80. package/dist/tools/utils.d.ts.map +1 -0
  81. package/dist/tools/utils.js +14 -0
  82. package/dist/tools/utils.js.map +1 -0
  83. package/dist/tools/web-search.d.ts +3 -0
  84. package/dist/tools/web-search.d.ts.map +1 -0
  85. package/dist/tools/web-search.js +80 -0
  86. package/dist/tools/web-search.js.map +1 -0
  87. package/dist/tools/write-file.d.ts +3 -0
  88. package/dist/tools/write-file.d.ts.map +1 -0
  89. package/dist/tools/write-file.js +66 -0
  90. package/dist/tools/write-file.js.map +1 -0
  91. package/package.json +54 -0
  92. package/skills/accessibility/SKILL.md +496 -0
  93. package/skills/api-design/SKILL.md +419 -0
  94. package/skills/code-review/SKILL.md +267 -0
  95. package/skills/debugging/SKILL.md +332 -0
  96. package/skills/documentation/SKILL.md +496 -0
  97. package/skills/error-handling/SKILL.md +504 -0
  98. package/skills/git-workflow/SKILL.md +448 -0
  99. package/skills/human-like-coding/SKILL.md +400 -0
  100. package/skills/performance-optimization/SKILL.md +412 -0
  101. package/skills/prompt-engineering/SKILL.md +362 -0
  102. package/skills/refactoring/SKILL.md +457 -0
  103. package/skills/security-audit/SKILL.md +453 -0
  104. package/skills/testing-strategy/SKILL.md +501 -0
  105. package/skills/webapp-testing/SKILL.md +309 -0
@@ -0,0 +1,309 @@
1
+ ---
2
+ name: webapp-testing
3
+ description: Comprehensive toolkit for testing web applications. Use when testing frontend functionality, debugging UI behavior, writing test cases, setting up testing frameworks, or verifying browser compatibility. Includes strategies for unit tests, integration tests, E2E tests, and visual regression testing.
4
+ ---
5
+
6
+ # Web Application Testing Skill
7
+
8
+ This skill provides guidance for comprehensive web application testing, from unit tests to end-to-end testing strategies.
9
+
10
+ ## Overview
11
+
12
+ Effective web testing requires a balanced approach across multiple testing layers. This skill helps you write better tests and choose the right testing strategy for each scenario.
13
+
14
+ ## Testing Pyramid
15
+
16
+ ### Unit Tests (Base - Most Tests)
17
+ - Test individual functions/components in isolation
18
+ - Fast execution, easy to debug
19
+ - Mock external dependencies
20
+ - Aim for 70-80% of total tests
21
+
22
+ ### Integration Tests (Middle)
23
+ - Test component interactions
24
+ - Verify API integrations work correctly
25
+ - Test database operations
26
+ - Aim for 15-20% of total tests
27
+
28
+ ### E2E Tests (Top - Fewest Tests)
29
+ - Test complete user flows
30
+ - Verify critical paths work
31
+ - Slower but most realistic
32
+ - Aim for 5-10% of total tests
33
+
34
+ ## Testing Framework Setup
35
+
36
+ ### React Testing (Vitest + Testing Library)
37
+ ```javascript
38
+ // vitest.config.js
39
+ import { defineConfig } from 'vitest/config';
40
+
41
+ export default defineConfig({
42
+ test: {
43
+ environment: 'jsdom',
44
+ globals: true,
45
+ setupFiles: './src/test/setup.js',
46
+ },
47
+ });
48
+ ```
49
+
50
+ ### Vue Testing
51
+ ```javascript
52
+ // vitest.config.js
53
+ import { defineConfig } from 'vitest/config';
54
+ import vue from '@vitejs/plugin-vue';
55
+
56
+ export default defineConfig({
57
+ plugins: [vue()],
58
+ test: {
59
+ environment: 'jsdom',
60
+ },
61
+ });
62
+ ```
63
+
64
+ ### E2E Testing (Playwright)
65
+ ```javascript
66
+ // playwright.config.js
67
+ import { defineConfig } from '@playwright/test';
68
+
69
+ export default defineConfig({
70
+ testDir: './e2e',
71
+ use: {
72
+ baseURL: 'http://localhost:3000',
73
+ screenshot: 'only-on-failure',
74
+ video: 'retain-on-failure',
75
+ },
76
+ });
77
+ ```
78
+
79
+ ## Component Testing Patterns
80
+
81
+ ### Testing User Interactions
82
+ ```javascript
83
+ import { render, screen, fireEvent } from '@testing-library/react';
84
+ import { Button } from './Button';
85
+
86
+ test('calls onClick when clicked', async () => {
87
+ const handleClick = vi.fn();
88
+ render(<Button onClick={handleClick}>Click me</Button>);
89
+
90
+ await fireEvent.click(screen.getByRole('button'));
91
+
92
+ expect(handleClick).toHaveBeenCalledTimes(1);
93
+ });
94
+ ```
95
+
96
+ ### Testing Async Operations
97
+ ```javascript
98
+ import { render, screen, waitFor } from '@testing-library/react';
99
+ import { UserProfile } from './UserProfile';
100
+
101
+ test('loads and displays user data', async () => {
102
+ render(<UserProfile userId="123" />);
103
+
104
+ // Wait for loading to complete
105
+ await waitFor(() => {
106
+ expect(screen.queryByText('Loading...')).not.toBeInTheDocument();
107
+ });
108
+
109
+ expect(screen.getByText('John Doe')).toBeInTheDocument();
110
+ });
111
+ ```
112
+
113
+ ### Testing Form Validation
114
+ ```javascript
115
+ test('shows validation errors for invalid input', async () => {
116
+ render(<ContactForm />);
117
+
118
+ // Submit empty form
119
+ await fireEvent.click(screen.getByRole('button', { name: /submit/i }));
120
+
121
+ expect(screen.getByText('Email is required')).toBeInTheDocument();
122
+ expect(screen.getByText('Name is required')).toBeInTheDocument();
123
+ });
124
+ ```
125
+
126
+ ## E2E Testing Patterns
127
+
128
+ ### Page Object Model
129
+ ```javascript
130
+ // e2e/pages/LoginPage.js
131
+ export class LoginPage {
132
+ constructor(page) {
133
+ this.page = page;
134
+ this.emailInput = page.locator('[data-testid="email"]');
135
+ this.passwordInput = page.locator('[data-testid="password"]');
136
+ this.submitButton = page.locator('[data-testid="submit"]');
137
+ }
138
+
139
+ async login(email, password) {
140
+ await this.emailInput.fill(email);
141
+ await this.passwordInput.fill(password);
142
+ await this.submitButton.click();
143
+ }
144
+ }
145
+ ```
146
+
147
+ ### Testing Critical User Flows
148
+ ```javascript
149
+ import { test, expect } from '@playwright/test';
150
+ import { LoginPage } from './pages/LoginPage';
151
+
152
+ test('user can complete checkout flow', async ({ page }) => {
153
+ const loginPage = new LoginPage(page);
154
+
155
+ await page.goto('/');
156
+ await loginPage.login('user@example.com', 'password');
157
+
158
+ // Add item to cart
159
+ await page.click('[data-testid="add-to-cart"]');
160
+ await page.click('[data-testid="cart-icon"]');
161
+
162
+ // Proceed to checkout
163
+ await page.click('[data-testid="checkout-button"]');
164
+
165
+ // Verify order confirmation
166
+ await expect(page.locator('.order-confirmation')).toBeVisible();
167
+ });
168
+ ```
169
+
170
+ ## Accessibility Testing
171
+
172
+ ### Automated A11y Checks
173
+ ```javascript
174
+ import { test, expect } from '@playwright/test';
175
+ import AxeBuilder from '@axe-core/playwright';
176
+
177
+ test('page should be accessible', async ({ page }) => {
178
+ await page.goto('/');
179
+
180
+ const results = await new AxeBuilder({ page }).analyze();
181
+
182
+ expect(results.violations).toEqual([]);
183
+ });
184
+ ```
185
+
186
+ ### Manual A11y Checklist
187
+ - [ ] All images have alt text
188
+ - [ ] Form inputs have labels
189
+ - [ ] Color contrast meets WCAG AA
190
+ - [ ] Keyboard navigation works
191
+ - [ ] Focus indicators are visible
192
+ - [ ] Screen reader announces content correctly
193
+
194
+ ## Visual Regression Testing
195
+
196
+ ### Using Playwright Screenshots
197
+ ```javascript
198
+ test('homepage visual regression', async ({ page }) => {
199
+ await page.goto('/');
200
+
201
+ await expect(page).toHaveScreenshot('homepage.png', {
202
+ maxDiffPixels: 100,
203
+ });
204
+ });
205
+ ```
206
+
207
+ ## API Testing
208
+
209
+ ### Testing API Endpoints
210
+ ```javascript
211
+ import { test, expect } from '@playwright/test';
212
+
213
+ test('API returns user data', async ({ request }) => {
214
+ const response = await request.get('/api/users/123');
215
+
216
+ expect(response.ok()).toBeTruthy();
217
+
218
+ const data = await response.json();
219
+ expect(data).toHaveProperty('id', '123');
220
+ expect(data).toHaveProperty('email');
221
+ });
222
+ ```
223
+
224
+ ## Test Organization Best Practices
225
+
226
+ ### File Structure
227
+ ```
228
+ src/
229
+ ├── components/
230
+ │ ├── Button/
231
+ │ │ ├── Button.jsx
232
+ │ │ ├── Button.test.jsx
233
+ │ │ └── Button.module.css
234
+ e2e/
235
+ ├── pages/
236
+ │ └── LoginPage.js
237
+ ├── tests/
238
+ │ └── auth.spec.js
239
+ └── fixtures/
240
+ └── users.json
241
+ ```
242
+
243
+ ### Naming Conventions
244
+ - Describe what is being tested
245
+ - Use clear, descriptive names
246
+ - Group related tests with `describe`
247
+
248
+ ```javascript
249
+ describe('Button component', () => {
250
+ describe('when clicked', () => {
251
+ test('calls onClick handler', () => {});
252
+ test('does not call handler when disabled', () => {});
253
+ });
254
+
255
+ describe('accessibility', () => {
256
+ test('has correct ARIA attributes', () => {});
257
+ });
258
+ });
259
+ ```
260
+
261
+ ## Debugging Tests
262
+
263
+ ### Common Issues and Solutions
264
+
265
+ **Flaky tests:**
266
+ - Add proper wait conditions
267
+ - Don't rely on timing
268
+ - Use data-testid for stable selectors
269
+
270
+ **Slow tests:**
271
+ - Mock external APIs
272
+ - Use test database snapshots
273
+ - Parallelize test execution
274
+
275
+ **Hard to debug:**
276
+ - Use trace viewer in Playwright
277
+ - Add descriptive error messages
278
+ - Log intermediate states
279
+
280
+ ## CI/CD Integration
281
+
282
+ ### GitHub Actions Example
283
+ ```yaml
284
+ name: Tests
285
+ on: [push, pull_request]
286
+
287
+ jobs:
288
+ test:
289
+ runs-on: ubuntu-latest
290
+ steps:
291
+ - uses: actions/checkout@v4
292
+ - uses: actions/setup-node@v4
293
+ - run: npm ci
294
+ - run: npm test
295
+ - run: npx playwright install
296
+ - run: npm run test:e2e
297
+ ```
298
+
299
+ ## Summary Checklist
300
+
301
+ When setting up tests:
302
+ - [ ] Choose appropriate test types for each feature
303
+ - [ ] Set up testing frameworks correctly
304
+ - [ ] Follow testing pyramid proportions
305
+ - [ ] Use Page Object Model for E2E
306
+ - [ ] Include accessibility testing
307
+ - [ ] Add visual regression tests for critical UI
308
+ - [ ] Configure CI/CD integration
309
+ - [ ] Document testing approach for team