create-qa-architect 5.0.0 → 5.0.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.
- package/.github/workflows/quality.yml +3 -0
- package/LICENSE +66 -0
- package/README.md +44 -30
- package/create-saas-monetization.js +10 -0
- package/docs/ARCHITECTURE.md +54 -0
- package/docs/DEPLOYMENT.md +63 -0
- package/docs/SLA_GATES.md +28 -0
- package/docs/TESTING.md +62 -0
- package/docs/security/SOC2_STARTER.md +29 -0
- package/lib/dependency-monitoring-basic.js +73 -26
- package/lib/licensing.js +5 -4
- package/lib/package-utils.js +215 -0
- package/lib/setup-enhancements.js +33 -0
- package/package.json +9 -7
- package/setup.js +131 -38
- package/templates/QUALITY_TROUBLESHOOTING.md +403 -0
- package/templates/ci/circleci-config.yml +35 -0
- package/templates/ci/gitlab-ci.yml +47 -0
- package/templates/integration-tests/api-service.test.js +244 -0
- package/templates/integration-tests/frontend-app.test.js +267 -0
- package/templates/scripts/smart-test-strategy.sh +109 -0
- package/templates/test-stubs/e2e.smoke.test.js +12 -0
- package/templates/test-stubs/unit.test.js +7 -0
- package/legal/README.md +0 -106
- package/legal/copyright.md +0 -76
- package/legal/disclaimer.md +0 -146
- package/legal/privacy-policy.html +0 -324
- package/legal/privacy-policy.md +0 -196
- package/legal/terms-of-service.md +0 -224
- package/marketing/beta-user-email-campaign.md +0 -372
- package/marketing/landing-page.html +0 -721
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
# Quality Troubleshooting Guide
|
|
2
|
+
|
|
3
|
+
**Auto-generated by create-qa-architect to prevent production issues**
|
|
4
|
+
|
|
5
|
+
## 🚨 Critical Issues That Caused Production Failures
|
|
6
|
+
|
|
7
|
+
### TypeScript Errors in Tests
|
|
8
|
+
|
|
9
|
+
**Symptom**: Tests pass locally but TypeScript compilation fails in CI
|
|
10
|
+
**Root Cause**: Tests excluded from TypeScript checking in `tsconfig.json`
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Check if tests are TypeScript validated
|
|
14
|
+
npm run type-check:tests
|
|
15
|
+
|
|
16
|
+
# If command doesn't exist, add to package.json:
|
|
17
|
+
{
|
|
18
|
+
"scripts": {
|
|
19
|
+
"type-check:tests": "tsc --noEmit --project tests/tsconfig.json"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Fix**: Ensure `tests/tsconfig.json` exists:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"extends": "../tsconfig.json",
|
|
29
|
+
"compilerOptions": {
|
|
30
|
+
"rootDir": "..",
|
|
31
|
+
"noEmit": true,
|
|
32
|
+
"types": ["vitest/globals", "node"]
|
|
33
|
+
},
|
|
34
|
+
"include": ["../src/**/*", "../tests/**/*"]
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Prevention**: Run `npm run quality:check` before commits
|
|
39
|
+
|
|
40
|
+
### Pre-commit Hooks Too Narrow
|
|
41
|
+
|
|
42
|
+
**Symptom**: Broken code reaches GitHub despite pre-commit hooks
|
|
43
|
+
**Root Cause**: lint-staged only checks specific files (like CLAUDE.md)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Check what runs on commit
|
|
47
|
+
cat .husky/pre-commit
|
|
48
|
+
|
|
49
|
+
# Should run comprehensive checks:
|
|
50
|
+
npx lint-staged && npm run type-check:all && npm test
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Fix**: Enhance `.husky/pre-commit`:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
#!/usr/bin/env sh
|
|
57
|
+
npx lint-staged
|
|
58
|
+
npm run type-check:all
|
|
59
|
+
npm run test:fast
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 🔍 Diagnostic Commands
|
|
63
|
+
|
|
64
|
+
### Quick Health Check
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Run all quality gates (should complete without errors)
|
|
68
|
+
npm run quality:check
|
|
69
|
+
|
|
70
|
+
# If this fails, debug individual components:
|
|
71
|
+
npm run type-check:all # TypeScript issues
|
|
72
|
+
npm run lint # ESLint issues
|
|
73
|
+
npm run format:check # Prettier issues
|
|
74
|
+
npm test # Test failures
|
|
75
|
+
npm run security:audit # Security vulnerabilities
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### TypeScript Troubleshooting
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Check main source TypeScript
|
|
82
|
+
npm run type-check
|
|
83
|
+
|
|
84
|
+
# Check tests TypeScript (common failure point)
|
|
85
|
+
npm run type-check:tests
|
|
86
|
+
|
|
87
|
+
# Check specific file
|
|
88
|
+
npx tsc --noEmit path/to/file.ts
|
|
89
|
+
|
|
90
|
+
# Common issues:
|
|
91
|
+
# 1. Missing type definitions: npm install --save-dev @types/package-name
|
|
92
|
+
# 2. Test globals: Add "vitest/globals" to types in tsconfig
|
|
93
|
+
# 3. Node types: Add "node" to types array
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Test Troubleshooting
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Run tests with verbose output
|
|
100
|
+
npm test -- --reporter=verbose
|
|
101
|
+
|
|
102
|
+
# Run specific test file
|
|
103
|
+
npx vitest path/to/test.test.js
|
|
104
|
+
|
|
105
|
+
# Debug integration tests
|
|
106
|
+
DEBUG=* npm run test:integration
|
|
107
|
+
|
|
108
|
+
# Common issues:
|
|
109
|
+
# 1. Test environment: Check NODE_ENV=test
|
|
110
|
+
# 2. Database setup: Ensure test DB is available
|
|
111
|
+
# 3. Async issues: Use proper async/await in tests
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Linting Issues
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Check specific linting rules
|
|
118
|
+
npx eslint path/to/file.js --format=verbose
|
|
119
|
+
|
|
120
|
+
# Auto-fix issues
|
|
121
|
+
npm run lint:fix
|
|
122
|
+
|
|
123
|
+
# Security-specific linting
|
|
124
|
+
npx eslint . --ext .js,.ts --config eslint-security.config.js
|
|
125
|
+
|
|
126
|
+
# Common issues:
|
|
127
|
+
# 1. Security rules: Remove hardcoded secrets, sanitize inputs
|
|
128
|
+
# 2. TypeScript rules: Fix any types, unused variables
|
|
129
|
+
# 3. Style rules: Use consistent naming, indentation
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## 🏗️ Project-Specific Issues
|
|
133
|
+
|
|
134
|
+
### API Service Projects
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Database connection tests
|
|
138
|
+
npm run test:integration
|
|
139
|
+
|
|
140
|
+
# API endpoint tests
|
|
141
|
+
npm run test:e2e
|
|
142
|
+
|
|
143
|
+
# Common issues:
|
|
144
|
+
# 1. Database not running: docker-compose up db
|
|
145
|
+
# 2. Environment variables missing: cp .env.example .env.test
|
|
146
|
+
# 3. Migrations not run: npm run db:migrate:test
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Frontend Projects
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Component integration tests
|
|
153
|
+
npm run test:component
|
|
154
|
+
|
|
155
|
+
# Browser E2E tests
|
|
156
|
+
npm run test:e2e
|
|
157
|
+
|
|
158
|
+
# Accessibility checks
|
|
159
|
+
npm run accessibility:check
|
|
160
|
+
|
|
161
|
+
# Common issues:
|
|
162
|
+
# 1. Build process: npm run build && npm run test:e2e
|
|
163
|
+
# 2. Browser drivers: npx playwright install
|
|
164
|
+
# 3. Test server: Ensure dev server running for E2E
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Library Projects
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Build and test distribution
|
|
171
|
+
npm run build && npm pack && tar -tf *.tgz
|
|
172
|
+
|
|
173
|
+
# Test TypeScript definitions
|
|
174
|
+
npm run type-check && tsc --noEmit --skipLibCheck
|
|
175
|
+
|
|
176
|
+
# Common issues:
|
|
177
|
+
# 1. Export paths: Check package.json main/module/exports
|
|
178
|
+
# 2. Type definitions: Ensure .d.ts files are included
|
|
179
|
+
# 3. Dependencies: Check peerDependencies vs dependencies
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## ⚡ Performance Issues
|
|
183
|
+
|
|
184
|
+
### Slow Test Suite
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Profile test performance
|
|
188
|
+
npm test -- --reporter=verbose --logHeapUsage
|
|
189
|
+
|
|
190
|
+
# Run only fast tests for development
|
|
191
|
+
npm run test:fast
|
|
192
|
+
|
|
193
|
+
# Optimize strategies:
|
|
194
|
+
# 1. Use test.concurrent for independent tests
|
|
195
|
+
# 2. Mock external dependencies
|
|
196
|
+
# 3. Use beforeAll for expensive setup
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Slow Linting
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Profile ESLint performance
|
|
203
|
+
npx eslint . --debug
|
|
204
|
+
|
|
205
|
+
# Use cache for faster subsequent runs
|
|
206
|
+
npx eslint . --cache --cache-location .eslintcache
|
|
207
|
+
|
|
208
|
+
# Optimize strategies:
|
|
209
|
+
# 1. Exclude node_modules explicitly
|
|
210
|
+
# 2. Use .eslintignore for generated files
|
|
211
|
+
# 3. Run lint-staged for incremental checking
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Slow CI/CD
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Check what's running in CI
|
|
218
|
+
cat .github/workflows/quality.yml
|
|
219
|
+
|
|
220
|
+
# Optimize strategies:
|
|
221
|
+
# 1. Cache dependencies: actions/cache@v3
|
|
222
|
+
# 2. Parallel jobs for independent checks
|
|
223
|
+
# 3. Smart test strategy based on changed files
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## 🔧 Configuration Debugging
|
|
227
|
+
|
|
228
|
+
### ESLint Configuration
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Check which config is being used
|
|
232
|
+
npx eslint --print-config path/to/file.js
|
|
233
|
+
|
|
234
|
+
# Debug configuration issues
|
|
235
|
+
npx eslint --debug path/to/file.js
|
|
236
|
+
|
|
237
|
+
# Common issues:
|
|
238
|
+
# 1. Conflicting configs: Check eslint.config.js vs .eslintrc
|
|
239
|
+
# 2. Plugin missing: npm install eslint-plugin-name
|
|
240
|
+
# 3. Parser issues: Check @typescript-eslint/parser for TS
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Prettier Configuration
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# Check formatting without changing files
|
|
247
|
+
npx prettier --check .
|
|
248
|
+
|
|
249
|
+
# See what would be formatted
|
|
250
|
+
npx prettier --list-different .
|
|
251
|
+
|
|
252
|
+
# Common issues:
|
|
253
|
+
# 1. Conflicting configs: .prettierrc vs package.json prettier
|
|
254
|
+
# 2. Parser detection: Use --parser option for ambiguous files
|
|
255
|
+
# 3. Ignore patterns: Check .prettierignore
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Husky/lint-staged Issues
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
# Check if Husky is installed
|
|
262
|
+
ls -la .husky/
|
|
263
|
+
|
|
264
|
+
# Test pre-commit hook manually
|
|
265
|
+
./.husky/pre-commit
|
|
266
|
+
|
|
267
|
+
# Test lint-staged configuration
|
|
268
|
+
npx lint-staged --debug
|
|
269
|
+
|
|
270
|
+
# Common issues:
|
|
271
|
+
# 1. Executable permissions: chmod +x .husky/pre-commit
|
|
272
|
+
# 2. Git hooks not installed: npx husky install
|
|
273
|
+
# 3. Pattern matching: Check lint-staged glob patterns
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## 🛡️ Security Debugging
|
|
277
|
+
|
|
278
|
+
### Secret Scanning Issues
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
# Run secret detection
|
|
282
|
+
npm run security:secrets
|
|
283
|
+
|
|
284
|
+
# Advanced secret scanning
|
|
285
|
+
npx gitleaks detect --verbose
|
|
286
|
+
|
|
287
|
+
# Common issues:
|
|
288
|
+
# 1. False positives: Add to .gitleaksignore
|
|
289
|
+
# 2. Test secrets: Use clearly marked dummy values
|
|
290
|
+
# 3. Environment files: Never commit .env files
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Dependency Vulnerabilities
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
# Check for vulnerabilities
|
|
297
|
+
npm audit
|
|
298
|
+
|
|
299
|
+
# Fix automatically fixable issues
|
|
300
|
+
npm audit fix
|
|
301
|
+
|
|
302
|
+
# Check specific package
|
|
303
|
+
npm audit --package=package-name
|
|
304
|
+
|
|
305
|
+
# Common issues:
|
|
306
|
+
# 1. Outdated packages: npm update
|
|
307
|
+
# 2. Breaking changes: Check CHANGELOG before updating
|
|
308
|
+
# 3. Alternative packages: Search for maintained alternatives
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## 📊 Quality Metrics
|
|
312
|
+
|
|
313
|
+
### Test Coverage
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# Generate coverage report
|
|
317
|
+
npm run test:coverage
|
|
318
|
+
|
|
319
|
+
# Check coverage thresholds
|
|
320
|
+
npx vitest run --coverage --reporter=verbose
|
|
321
|
+
|
|
322
|
+
# Common targets:
|
|
323
|
+
# - Lines: >80%
|
|
324
|
+
# - Functions: >80%
|
|
325
|
+
# - Branches: >70%
|
|
326
|
+
# - Statements: >80%
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Code Quality Metrics
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
# TypeScript strict mode compliance
|
|
333
|
+
npx tsc --strict --noEmit
|
|
334
|
+
|
|
335
|
+
# Complexity analysis
|
|
336
|
+
npx eslint . --format=json | jq '.[] | select(.errorCount > 5)'
|
|
337
|
+
|
|
338
|
+
# Common improvements:
|
|
339
|
+
# 1. Reduce function complexity
|
|
340
|
+
# 2. Remove code duplication
|
|
341
|
+
# 3. Improve type coverage
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
## 🚀 Quick Fixes for Common Production Issues
|
|
345
|
+
|
|
346
|
+
### Emergency Fix Checklist
|
|
347
|
+
|
|
348
|
+
1. **Identify the gap**: What check would have caught this?
|
|
349
|
+
2. **Add verification**: Create test that reproduces the issue
|
|
350
|
+
3. **Fix root cause**: Don't just patch symptoms
|
|
351
|
+
4. **Prevent recurrence**: Add to quality gates
|
|
352
|
+
5. **Update documentation**: Add to this troubleshooting guide
|
|
353
|
+
|
|
354
|
+
### Example: TypeScript Error in Production
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
# 1. Reproduce locally
|
|
358
|
+
npm run type-check:all # Should fail
|
|
359
|
+
|
|
360
|
+
# 2. Fix the error
|
|
361
|
+
# Edit the TypeScript code to resolve type issues
|
|
362
|
+
|
|
363
|
+
# 3. Verify fix
|
|
364
|
+
npm run type-check:all # Should pass
|
|
365
|
+
|
|
366
|
+
# 4. Prevent recurrence
|
|
367
|
+
# Ensure type-check:all is in CI and pre-commit hooks
|
|
368
|
+
|
|
369
|
+
# 5. Update configuration
|
|
370
|
+
# Add stricter TypeScript rules if needed
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
## 📞 Getting Help
|
|
374
|
+
|
|
375
|
+
### Internal Resources
|
|
376
|
+
|
|
377
|
+
- Check `scripts/check-docs.sh` for documentation validation
|
|
378
|
+
- Review `.github/workflows/` for CI configuration
|
|
379
|
+
- Check `lib/` directory for quality automation internals
|
|
380
|
+
|
|
381
|
+
### External Resources
|
|
382
|
+
|
|
383
|
+
- [ESLint Troubleshooting](https://eslint.org/docs/user-guide/troubleshooting)
|
|
384
|
+
- [TypeScript Handbook](https://www.typescriptlang.org/docs/)
|
|
385
|
+
- [Vitest Documentation](https://vitest.dev/guide/)
|
|
386
|
+
- [Playwright Debugging](https://playwright.dev/docs/debug)
|
|
387
|
+
|
|
388
|
+
### Debug Environment Setup
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
# Enable debug logging
|
|
392
|
+
export DEBUG=quality-automation:*
|
|
393
|
+
|
|
394
|
+
# Run with verbose output
|
|
395
|
+
npm run quality:check -- --verbose
|
|
396
|
+
|
|
397
|
+
# Generate debug report
|
|
398
|
+
npm run validate:comprehensive > debug-report.txt 2>&1
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
**Remember**: Quality gates exist to catch issues early when they're cheap to fix. Don't bypass them - fix the root cause.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
version: 2.1
|
|
2
|
+
|
|
3
|
+
orbs:
|
|
4
|
+
node: circleci/node@5.2.0
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
lint-test-security:
|
|
8
|
+
executor:
|
|
9
|
+
name: node/default
|
|
10
|
+
tag: '20.11'
|
|
11
|
+
steps:
|
|
12
|
+
- checkout
|
|
13
|
+
- node/install-packages:
|
|
14
|
+
pkg-manager: npm
|
|
15
|
+
override-ci-command: npm ci || npm install
|
|
16
|
+
- run:
|
|
17
|
+
name: Format Check
|
|
18
|
+
command: npm run format:check || npm run format
|
|
19
|
+
- run:
|
|
20
|
+
name: Lint
|
|
21
|
+
command: npm run lint
|
|
22
|
+
- run:
|
|
23
|
+
name: Tests
|
|
24
|
+
command: npm test
|
|
25
|
+
- run:
|
|
26
|
+
name: Security Scan
|
|
27
|
+
command: npm run security:audit || echo "⚠️ npm audit failed; review vulnerabilities"
|
|
28
|
+
- run:
|
|
29
|
+
name: Gitleaks Secrets Scan
|
|
30
|
+
command: npx gitleaks detect --redact --verbose || echo "⚠️ gitleaks failures; set GITLEAKS_LICENSE for premium features"
|
|
31
|
+
|
|
32
|
+
workflows:
|
|
33
|
+
quality:
|
|
34
|
+
jobs:
|
|
35
|
+
- lint-test-security
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
- install
|
|
3
|
+
- lint
|
|
4
|
+
- test
|
|
5
|
+
- security
|
|
6
|
+
|
|
7
|
+
variables:
|
|
8
|
+
NODE_VERSION: '20'
|
|
9
|
+
|
|
10
|
+
default:
|
|
11
|
+
image: node:${NODE_VERSION}
|
|
12
|
+
cache:
|
|
13
|
+
key: ${CI_COMMIT_REF_SLUG}
|
|
14
|
+
paths:
|
|
15
|
+
- node_modules/
|
|
16
|
+
|
|
17
|
+
install:
|
|
18
|
+
stage: install
|
|
19
|
+
script:
|
|
20
|
+
- npm ci || npm install
|
|
21
|
+
artifacts:
|
|
22
|
+
paths:
|
|
23
|
+
- node_modules/
|
|
24
|
+
expire_in: 1h
|
|
25
|
+
|
|
26
|
+
lint:
|
|
27
|
+
stage: lint
|
|
28
|
+
needs: ['install']
|
|
29
|
+
script:
|
|
30
|
+
- npm run format:check || npm run format
|
|
31
|
+
- npm run lint
|
|
32
|
+
|
|
33
|
+
test:
|
|
34
|
+
stage: test
|
|
35
|
+
needs: ['install']
|
|
36
|
+
script:
|
|
37
|
+
- npm test
|
|
38
|
+
|
|
39
|
+
security:
|
|
40
|
+
stage: security
|
|
41
|
+
needs: ['install']
|
|
42
|
+
script:
|
|
43
|
+
- npm run security:audit || echo "⚠️ npm audit failed; review vulnerabilities"
|
|
44
|
+
- npx gitleaks detect --redact --verbose || echo "⚠️ gitleaks failures (configure GITLEAKS_LICENSE for premium features)"
|
|
45
|
+
artifacts:
|
|
46
|
+
when: always
|
|
47
|
+
expire_in: 1 week
|