Two critical features delivered by subagents: 1. TREND TRACKING & HISTORICAL ANALYSIS - TrendStorage: Persistent .quality/history.json storage - TrendAnalyzer: Trend direction, velocity, volatility detection - 44 new comprehensive tests (all passing) - Track 7-day/30-day averages, best/worst scores - Auto-generate context-aware recommendations - Enhanced ConsoleReporter with trend visualization (↑↓→) - Alerts on concerning metrics (>2% decline) - Rolling 30-day window for efficient storage 2. CI/CD INTEGRATION FOR CONTINUOUS QUALITY - GitHub Actions workflow: quality-check.yml - Pre-commit hook: Local quality feedback - Quality gates: Minimum thresholds enforcement - Badge generation: SVG badge with score/trend - npm scripts: quality-check (console/json/html) - PR commenting: Automated quality status reports - Artifact uploads: HTML reports with 30-day retention DELIVERABLES: - 2 new analysis modules (502 lines) - 44 trend tracking tests (all passing) - GitHub Actions workflow (175 lines) - Pre-commit hook script (155 lines) - Badge generation script (118 lines) - Quality gates config (47 lines) - 1196 lines of documentation TEST STATUS: ✅ 327/327 tests passing (0.457s) TEST CHANGE: 283 → 327 tests (+44 new trend tests) BUILD STATUS: ✅ Success CI/CD STATUS: ✅ Ready for deployment Quality score impact estimates: - Trend tracking: +2 points (feature completeness) - CI/CD integration: +3 points (quality assurance) - Total phase 3: +5 points (89 → 94) ESTIMATED CURRENT SCORE: 94/100 (Phase 3 complete) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
5.0 KiB
Quality CI/CD Quick Start Guide
This guide gets you up and running with the automated quality checks in just a few minutes.
What is This?
The quality CI/CD system automatically checks your code for quality issues at multiple stages:
- Locally: Before you commit (pre-commit hook)
- On GitHub: When you push to main/develop or open a PR (GitHub Actions)
- Reporting: Generates quality reports and scores
Quick Setup (5 minutes)
1. Install Pre-commit Hook
cp scripts/pre-commit-quality-check.sh .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
Verify it works:
.git/hooks/pre-commit
2. Install npm Scripts
Already installed! Just use:
npm run quality-check # Quick check
npm run quality-check:json # Generate JSON report
npm run quality-check:html # Generate HTML report
npm run quality-check:verbose # Detailed output
3. Done!
Your CI/CD is now set up. That's it!
Common Commands
# Check code quality locally
npm run quality-check
# Create detailed reports
npm run quality-check:json
npm run quality-check:html
# Bypass pre-commit check (use cautiously!)
git commit --no-verify
# View quality badge
cat .quality/badge.svg
Quality Thresholds
- Overall Score: Must be ≥ 85%
- Code Quality: Must be ≥ 80%
- Test Coverage: Must be ≥ 70%
- Architecture: Must be ≥ 80%
- Security: Must be ≥ 85%
What Happens When I Commit?
Passing Quality Check ✓
Pre-commit quality check PASSED
[main 1234567] My awesome feature
Failing Quality Check ✗
✗ Overall score (78%) is below minimum threshold (85%)
✗ Pre-commit quality check FAILED
To bypass this check, run: git commit --no-verify
What Happens in GitHub?
When you push or open a PR, GitHub Actions automatically:
- Runs tests
- Runs quality validator
- Generates reports
- Posts results to your PR
- Blocks merge if score < 85% (if configured)
Example PR comment:
## Quality Check Results ✅
| Metric | Value |
|--------|-------|
| Overall Score | 92.5% |
| Grade | A+ |
| Threshold | 85% |
✅ Quality gate **passed**
Fixing Quality Issues
If your quality check fails:
-
View the detailed report:
npm run quality-check:verbose npm run quality-check:html && open .quality/report.html -
Fix the issues (common ones):
- Run tests:
npm test - Fix linting:
npm run lint:fix - Reduce complexity: Refactor complex functions
- Improve test coverage: Add more tests
- Run tests:
-
Re-check:
npm run quality-check -
Commit:
git commit -m "Fix quality issues"
Need to Bypass Checks?
# Skip pre-commit hook (NOT recommended - CI will still check)
git commit --no-verify
# But note: GitHub Actions will still validate the code
# and block merge if quality gate not met
View Reports
After running quality checks:
# Console output (default)
npm run quality-check
# JSON report (for scripts/automation)
cat .quality/report.json | jq .
# HTML report (most detailed)
open .quality/report.html
# Quality badge
cat .quality/badge.svg
Badge in README
Add this to your README.md to show quality status:

Troubleshooting
Pre-commit hook not running?
# Check if file exists
ls -l .git/hooks/pre-commit
# Make executable
chmod +x .git/hooks/pre-commit
# Test manually
.git/hooks/pre-commit
GitHub Actions failing but local passes?
# Use same Node version as CI (18)
nvm install 18 && nvm use 18
# Use same install method
npm ci --legacy-peer-deps
# Run same commands as workflow
npm test -- --coverage
Badge not updating?
# Regenerate badge
bash scripts/generate-badge.sh
# Verify report exists
ls .quality/report.json
Full Documentation
For detailed information, see: QUALITY_CI_CD_SETUP.md
Architecture at a Glance
┌─ Pre-commit Hook (local, quick feedback)
│ └─ .git/hooks/pre-commit
│
├─ GitHub Actions (automated on push/PR)
│ └─ .github/workflows/quality-check.yml
│
├─ Configuration
│ ├─ .quality/gates.json (thresholds)
│ └─ .qualityrc.json (detailed rules)
│
├─ Scripts
│ ├─ scripts/pre-commit-quality-check.sh
│ └─ scripts/generate-badge.sh
│
└─ Reports
├─ .quality/report.json
├─ .quality/report.html
└─ .quality/badge.svg
Key Points
✓ Quality checks run before you commit locally ✓ Quality checks run again on GitHub for every PR ✓ Can't merge to main if score < 85% (if enforced) ✓ Scores & trends are tracked over time ✓ All tools are open source & configured in this repo
Next Steps
- Run a check:
npm run quality-check - View reports: Open
.quality/report.html - Fix any issues: Follow the report recommendations
- Commit with confidence: Your code passes quality gates!
Questions? See the full documentation in QUALITY_CI_CD_SETUP.md