@patricio0312rev/skillset 0.1.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.
- package/CHANGELOG.md +29 -0
- package/LICENSE +21 -0
- package/README.md +176 -0
- package/bin/cli.js +37 -0
- package/package.json +55 -0
- package/src/commands/init.js +301 -0
- package/src/index.js +168 -0
- package/src/lib/config.js +200 -0
- package/src/lib/generator.js +166 -0
- package/src/utils/display.js +95 -0
- package/src/utils/readme.js +196 -0
- package/src/utils/tool-specific.js +233 -0
- package/templates/ai-engineering/agent-orchestration-planner/ SKILL.md +266 -0
- package/templates/ai-engineering/cost-latency-optimizer/ SKILL.md +270 -0
- package/templates/ai-engineering/doc-to-vector-dataset-generator/ SKILL.md +239 -0
- package/templates/ai-engineering/evaluation-harness/ SKILL.md +219 -0
- package/templates/ai-engineering/guardrails-safety-filter-builder/ SKILL.md +226 -0
- package/templates/ai-engineering/llm-debugger/ SKILL.md +283 -0
- package/templates/ai-engineering/prompt-regression-tester/ SKILL.md +216 -0
- package/templates/ai-engineering/prompt-template-builder/ SKILL.md +393 -0
- package/templates/ai-engineering/rag-pipeline-builder/ SKILL.md +244 -0
- package/templates/ai-engineering/tool-function-schema-designer/ SKILL.md +219 -0
- package/templates/architecture/adr-writer/ SKILL.md +250 -0
- package/templates/architecture/api-versioning-deprecation-planner/ SKILL.md +331 -0
- package/templates/architecture/domain-model-boundaries-mapper/ SKILL.md +300 -0
- package/templates/architecture/migration-planner/ SKILL.md +376 -0
- package/templates/architecture/performance-budget-setter/ SKILL.md +318 -0
- package/templates/architecture/reliability-strategy-builder/ SKILL.md +286 -0
- package/templates/architecture/rfc-generator/ SKILL.md +362 -0
- package/templates/architecture/scalability-playbook/ SKILL.md +279 -0
- package/templates/architecture/system-design-generator/ SKILL.md +339 -0
- package/templates/architecture/tech-debt-prioritizer/ SKILL.md +329 -0
- package/templates/backend/api-contract-normalizer/ SKILL.md +487 -0
- package/templates/backend/api-endpoint-generator/ SKILL.md +415 -0
- package/templates/backend/auth-module-builder/ SKILL.md +99 -0
- package/templates/backend/background-jobs-designer/ SKILL.md +166 -0
- package/templates/backend/caching-strategist/ SKILL.md +190 -0
- package/templates/backend/error-handling-standardizer/ SKILL.md +174 -0
- package/templates/backend/rate-limiting-abuse-protection/ SKILL.md +147 -0
- package/templates/backend/rbac-permissions-builder/ SKILL.md +158 -0
- package/templates/backend/service-layer-extractor/ SKILL.md +269 -0
- package/templates/backend/webhook-receiver-hardener/ SKILL.md +211 -0
- package/templates/ci-cd/artifact-sbom-publisher/ SKILL.md +236 -0
- package/templates/ci-cd/caching-strategy-optimizer/ SKILL.md +195 -0
- package/templates/ci-cd/deployment-checklist-generator/ SKILL.md +381 -0
- package/templates/ci-cd/github-actions-pipeline-creator/ SKILL.md +348 -0
- package/templates/ci-cd/monorepo-ci-optimizer/ SKILL.md +298 -0
- package/templates/ci-cd/preview-environments-builder/ SKILL.md +187 -0
- package/templates/ci-cd/quality-gates-enforcer/ SKILL.md +342 -0
- package/templates/ci-cd/release-automation-builder/ SKILL.md +281 -0
- package/templates/ci-cd/rollback-workflow-builder/ SKILL.md +372 -0
- package/templates/ci-cd/secrets-env-manager/ SKILL.md +242 -0
- package/templates/db-management/backup-restore-runbook-generator/ SKILL.md +505 -0
- package/templates/db-management/data-integrity-auditor/ SKILL.md +505 -0
- package/templates/db-management/data-retention-archiving-planner/ SKILL.md +430 -0
- package/templates/db-management/data-seeding-fixtures-builder/ SKILL.md +375 -0
- package/templates/db-management/db-performance-watchlist/ SKILL.md +425 -0
- package/templates/db-management/etl-sync-job-builder/ SKILL.md +457 -0
- package/templates/db-management/multi-tenant-safety-checker/ SKILL.md +398 -0
- package/templates/db-management/prisma-migration-assistant/ SKILL.md +379 -0
- package/templates/db-management/schema-consistency-checker/ SKILL.md +440 -0
- package/templates/db-management/sql-query-optimizer/ SKILL.md +324 -0
- package/templates/foundation/changelog-writer/ SKILL.md +431 -0
- package/templates/foundation/code-formatter-installer/ SKILL.md +320 -0
- package/templates/foundation/codebase-summarizer/ SKILL.md +360 -0
- package/templates/foundation/dependency-doctor/ SKILL.md +163 -0
- package/templates/foundation/dev-environment-bootstrapper/ SKILL.md +259 -0
- package/templates/foundation/dev-onboarding-builder/ SKILL.md +556 -0
- package/templates/foundation/docs-starter-kit/ SKILL.md +574 -0
- package/templates/foundation/explaining-code/SKILL.md +13 -0
- package/templates/foundation/git-hygiene-enforcer/ SKILL.md +455 -0
- package/templates/foundation/project-scaffolder/ SKILL.md +65 -0
- package/templates/foundation/project-scaffolder/references/templates.md +126 -0
- package/templates/foundation/repo-structure-linter/ SKILL.md +0 -0
- package/templates/foundation/repo-structure-linter/references/conventions.md +98 -0
- package/templates/frontend/animation-micro-interaction-pack/ SKILL.md +41 -0
- package/templates/frontend/component-scaffold-generator/ SKILL.md +562 -0
- package/templates/frontend/design-to-component-translator/ SKILL.md +547 -0
- package/templates/frontend/form-wizard-builder/ SKILL.md +553 -0
- package/templates/frontend/frontend-refactor-planner/ SKILL.md +37 -0
- package/templates/frontend/i18n-frontend-implementer/ SKILL.md +44 -0
- package/templates/frontend/modal-drawer-system/ SKILL.md +377 -0
- package/templates/frontend/page-layout-builder/ SKILL.md +630 -0
- package/templates/frontend/state-ux-flow-builder/ SKILL.md +23 -0
- package/templates/frontend/table-builder/ SKILL.md +350 -0
- package/templates/performance/alerting-dashboard-builder/ SKILL.md +162 -0
- package/templates/performance/backend-latency-profiler-helper/ SKILL.md +108 -0
- package/templates/performance/caching-cdn-strategy-planner/ SKILL.md +150 -0
- package/templates/performance/capacity-planning-helper/ SKILL.md +242 -0
- package/templates/performance/core-web-vitals-tuner/ SKILL.md +126 -0
- package/templates/performance/incident-runbook-generator/ SKILL.md +162 -0
- package/templates/performance/load-test-scenario-builder/ SKILL.md +256 -0
- package/templates/performance/observability-setup/ SKILL.md +232 -0
- package/templates/performance/postmortem-writer/ SKILL.md +203 -0
- package/templates/performance/structured-logging-standardizer/ SKILL.md +122 -0
- package/templates/security/auth-security-reviewer/ SKILL.md +428 -0
- package/templates/security/dependency-vulnerability-triage/ SKILL.md +495 -0
- package/templates/security/input-validation-sanitization-auditor/ SKILL.md +76 -0
- package/templates/security/pii-redaction-logging-policy-builder/ SKILL.md +65 -0
- package/templates/security/rbac-policy-tester/ SKILL.md +80 -0
- package/templates/security/secrets-scanner/ SKILL.md +462 -0
- package/templates/security/secure-headers-csp-builder/ SKILL.md +404 -0
- package/templates/security/security-incident-playbook-generator/ SKILL.md +76 -0
- package/templates/security/security-pr-checklist-skill/ SKILL.md +62 -0
- package/templates/security/threat-model-generator/ SKILL.md +394 -0
- package/templates/testing/contract-testing-builder/ SKILL.md +492 -0
- package/templates/testing/coverage-strategist/ SKILL.md +436 -0
- package/templates/testing/e2e-test-builder/ SKILL.md +382 -0
- package/templates/testing/flaky-test-detective/ SKILL.md +416 -0
- package/templates/testing/integration-test-builder/ SKILL.md +525 -0
- package/templates/testing/mocking-assistant/ SKILL.md +383 -0
- package/templates/testing/snapshot-test-refactorer/ SKILL.md +375 -0
- package/templates/testing/test-data-factory-builder/ SKILL.md +449 -0
- package/templates/testing/test-reporting-triage-skill/ SKILL.md +469 -0
- package/templates/testing/unit-test-generator/ SKILL.md +548 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: preview-environments-builder
|
|
3
|
+
description: Creates ephemeral preview deployments for each pull request with automatic deployment, unique URLs, and cleanup on PR close. Use for "preview deployments", "PR environments", "ephemeral environments", or "review apps".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Preview Environments Builder
|
|
7
|
+
|
|
8
|
+
Deploy isolated preview environments for every pull request.
|
|
9
|
+
|
|
10
|
+
## Vercel Preview Deployment
|
|
11
|
+
|
|
12
|
+
```yaml
|
|
13
|
+
# .github/workflows/preview.yml
|
|
14
|
+
name: Preview Deployment
|
|
15
|
+
|
|
16
|
+
on:
|
|
17
|
+
pull_request:
|
|
18
|
+
types: [opened, synchronize, reopened]
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
deploy-preview:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
environment:
|
|
24
|
+
name: preview-${{ github.event.pull_request.number }}
|
|
25
|
+
url: ${{ steps.deploy.outputs.url }}
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- uses: actions/setup-node@v4
|
|
31
|
+
with:
|
|
32
|
+
node-version: "20"
|
|
33
|
+
cache: "npm"
|
|
34
|
+
|
|
35
|
+
- run: npm ci
|
|
36
|
+
- run: npm run build
|
|
37
|
+
|
|
38
|
+
- name: Deploy to Vercel
|
|
39
|
+
id: deploy
|
|
40
|
+
uses: amondnet/vercel-action@v25
|
|
41
|
+
with:
|
|
42
|
+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
|
|
43
|
+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
|
|
44
|
+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
45
|
+
scope: ${{ secrets.VERCEL_ORG_ID }}
|
|
46
|
+
alias-domains: pr-${{ github.event.pull_request.number }}.myapp.dev
|
|
47
|
+
|
|
48
|
+
- name: Comment PR
|
|
49
|
+
uses: actions/github-script@v7
|
|
50
|
+
with:
|
|
51
|
+
script: |
|
|
52
|
+
github.rest.issues.createComment({
|
|
53
|
+
issue_number: context.issue.number,
|
|
54
|
+
owner: context.repo.owner,
|
|
55
|
+
repo: context.repo.repo,
|
|
56
|
+
body: `✅ Preview deployed!\n\n🔗 **URL:** ${{ steps.deploy.outputs.url }}\n\nCommit: ${context.sha.substring(0, 7)}`
|
|
57
|
+
})
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Docker-based Preview
|
|
61
|
+
|
|
62
|
+
```yaml
|
|
63
|
+
preview:
|
|
64
|
+
runs-on: ubuntu-latest
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v4
|
|
67
|
+
|
|
68
|
+
- name: Build Docker image
|
|
69
|
+
run: |
|
|
70
|
+
docker build -t myapp:pr-${{ github.event.pull_request.number }} .
|
|
71
|
+
|
|
72
|
+
- name: Deploy to Kubernetes
|
|
73
|
+
run: |
|
|
74
|
+
kubectl create namespace pr-${{ github.event.pull_request.number }} || true
|
|
75
|
+
kubectl apply -f k8s/preview.yml \
|
|
76
|
+
--namespace pr-${{ github.event.pull_request.number }}
|
|
77
|
+
kubectl set image deployment/myapp \
|
|
78
|
+
myapp=myapp:pr-${{ github.event.pull_request.number }} \
|
|
79
|
+
--namespace pr-${{ github.event.pull_request.number }}
|
|
80
|
+
|
|
81
|
+
- name: Get preview URL
|
|
82
|
+
id: url
|
|
83
|
+
run: |
|
|
84
|
+
URL=$(kubectl get ingress myapp \
|
|
85
|
+
--namespace pr-${{ github.event.pull_request.number }} \
|
|
86
|
+
-o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
|
|
87
|
+
echo "url=https://pr-${{ github.event.pull_request.number }}.preview.myapp.com" >> $GITHUB_OUTPUT
|
|
88
|
+
|
|
89
|
+
- name: Comment PR
|
|
90
|
+
uses: actions/github-script@v7
|
|
91
|
+
with:
|
|
92
|
+
script: |
|
|
93
|
+
github.rest.issues.createComment({
|
|
94
|
+
issue_number: context.issue.number,
|
|
95
|
+
owner: context.repo.owner,
|
|
96
|
+
repo: context.repo.repo,
|
|
97
|
+
body: `🚀 Preview deployed to: ${{ steps.url.outputs.url }}`
|
|
98
|
+
})
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Cleanup on PR Close
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
# .github/workflows/cleanup-preview.yml
|
|
105
|
+
name: Cleanup Preview
|
|
106
|
+
|
|
107
|
+
on:
|
|
108
|
+
pull_request:
|
|
109
|
+
types: [closed]
|
|
110
|
+
|
|
111
|
+
jobs:
|
|
112
|
+
cleanup:
|
|
113
|
+
runs-on: ubuntu-latest
|
|
114
|
+
steps:
|
|
115
|
+
- name: Delete Vercel deployment
|
|
116
|
+
uses: actions/github-script@v7
|
|
117
|
+
with:
|
|
118
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
119
|
+
script: |
|
|
120
|
+
const deployments = await github.rest.repos.listDeployments({
|
|
121
|
+
owner: context.repo.owner,
|
|
122
|
+
repo: context.repo.repo,
|
|
123
|
+
environment: `preview-${context.issue.number}`
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
for (const deployment of deployments.data) {
|
|
127
|
+
await github.rest.repos.createDeploymentStatus({
|
|
128
|
+
owner: context.repo.owner,
|
|
129
|
+
repo: context.repo.repo,
|
|
130
|
+
deployment_id: deployment.id,
|
|
131
|
+
state: 'inactive'
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
await github.rest.repos.deleteDeployment({
|
|
135
|
+
owner: context.repo.owner,
|
|
136
|
+
repo: context.repo.repo,
|
|
137
|
+
deployment_id: deployment.id
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
- name: Cleanup Kubernetes namespace
|
|
142
|
+
run: |
|
|
143
|
+
kubectl delete namespace pr-${{ github.event.pull_request.number }} --ignore-not-found=true
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Environment Naming
|
|
147
|
+
|
|
148
|
+
```yaml
|
|
149
|
+
# Consistent naming pattern
|
|
150
|
+
environment:
|
|
151
|
+
name: preview-pr-${{ github.event.pull_request.number }}
|
|
152
|
+
url: https://pr-${{ github.event.pull_request.number }}.preview.myapp.com
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Database Seeding
|
|
156
|
+
|
|
157
|
+
```yaml
|
|
158
|
+
- name: Setup preview database
|
|
159
|
+
run: |
|
|
160
|
+
# Create database
|
|
161
|
+
psql -c "CREATE DATABASE preview_pr_${{ github.event.pull_request.number }};"
|
|
162
|
+
|
|
163
|
+
# Seed with test data
|
|
164
|
+
npm run db:seed -- --database=preview_pr_${{ github.event.pull_request.number }}
|
|
165
|
+
env:
|
|
166
|
+
DATABASE_URL: ${{ secrets.PREVIEW_DB_URL }}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Best Practices
|
|
170
|
+
|
|
171
|
+
1. **Unique URLs**: pr-{number}.preview.domain.com
|
|
172
|
+
2. **Auto cleanup**: Delete on PR close
|
|
173
|
+
3. **Comment on PR**: Link to preview
|
|
174
|
+
4. **Environment protection**: Require approval
|
|
175
|
+
5. **Resource limits**: Prevent abuse
|
|
176
|
+
6. **TTL**: Auto-delete after 7 days
|
|
177
|
+
7. **Secrets management**: Use preview-specific secrets
|
|
178
|
+
|
|
179
|
+
## Output Checklist
|
|
180
|
+
|
|
181
|
+
- [ ] Preview deployment workflow
|
|
182
|
+
- [ ] Unique URL generation
|
|
183
|
+
- [ ] PR comment with link
|
|
184
|
+
- [ ] Cleanup workflow on close
|
|
185
|
+
- [ ] Environment naming strategy
|
|
186
|
+
- [ ] Database seeding (if needed)
|
|
187
|
+
- [ ] Resource limits configured
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: quality-gates-enforcer
|
|
3
|
+
description: Enforces minimum quality thresholds in CI including code coverage, linting, type checking, and security scanning. Provides required checks, PR rules, and automated enforcement. Use for "quality gates", "CI checks", "code quality", or "PR requirements".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Quality Gates Enforcer
|
|
7
|
+
|
|
8
|
+
Enforce minimum quality standards before merging code.
|
|
9
|
+
|
|
10
|
+
## Coverage Requirements
|
|
11
|
+
|
|
12
|
+
```yaml
|
|
13
|
+
# .github/workflows/quality-gates.yml
|
|
14
|
+
name: Quality Gates
|
|
15
|
+
|
|
16
|
+
on:
|
|
17
|
+
pull_request:
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
coverage:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- uses: actions/setup-node@v4
|
|
26
|
+
with:
|
|
27
|
+
node-version: "20"
|
|
28
|
+
cache: "npm"
|
|
29
|
+
|
|
30
|
+
- run: npm ci
|
|
31
|
+
|
|
32
|
+
- name: Run tests with coverage
|
|
33
|
+
run: npm test -- --coverage
|
|
34
|
+
|
|
35
|
+
- name: Check coverage threshold
|
|
36
|
+
run: |
|
|
37
|
+
COVERAGE=$(node -p "require('./coverage/coverage-summary.json').total.lines.pct")
|
|
38
|
+
THRESHOLD=80
|
|
39
|
+
|
|
40
|
+
if (( $(echo "$COVERAGE < $THRESHOLD" | bc -l) )); then
|
|
41
|
+
echo "❌ Coverage $COVERAGE% is below threshold $THRESHOLD%"
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
echo "✅ Coverage $COVERAGE% meets threshold $THRESHOLD%"
|
|
46
|
+
|
|
47
|
+
- name: Comment coverage on PR
|
|
48
|
+
uses: romeovs/lcov-reporter-action@v0.3.1
|
|
49
|
+
with:
|
|
50
|
+
lcov-file: ./coverage/lcov.info
|
|
51
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
52
|
+
delete-old-comments: true
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Jest Configuration
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
// jest.config.js
|
|
59
|
+
module.exports = {
|
|
60
|
+
coverageThreshold: {
|
|
61
|
+
global: {
|
|
62
|
+
branches: 80,
|
|
63
|
+
functions: 80,
|
|
64
|
+
lines: 80,
|
|
65
|
+
statements: 80,
|
|
66
|
+
},
|
|
67
|
+
"./src/critical/": {
|
|
68
|
+
branches: 90,
|
|
69
|
+
functions: 90,
|
|
70
|
+
lines: 90,
|
|
71
|
+
statements: 90,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Linting Gate
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
lint:
|
|
81
|
+
runs-on: ubuntu-latest
|
|
82
|
+
steps:
|
|
83
|
+
- uses: actions/checkout@v4
|
|
84
|
+
|
|
85
|
+
- uses: actions/setup-node@v4
|
|
86
|
+
with:
|
|
87
|
+
node-version: "20"
|
|
88
|
+
cache: "npm"
|
|
89
|
+
|
|
90
|
+
- run: npm ci
|
|
91
|
+
|
|
92
|
+
- name: Run ESLint
|
|
93
|
+
run: npm run lint -- --max-warnings 0
|
|
94
|
+
|
|
95
|
+
- name: Check formatting
|
|
96
|
+
run: npm run format:check
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Type Checking Gate
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
typecheck:
|
|
103
|
+
runs-on: ubuntu-latest
|
|
104
|
+
steps:
|
|
105
|
+
- uses: actions/checkout@v4
|
|
106
|
+
|
|
107
|
+
- uses: actions/setup-node@v4
|
|
108
|
+
with:
|
|
109
|
+
node-version: "20"
|
|
110
|
+
cache: "npm"
|
|
111
|
+
|
|
112
|
+
- run: npm ci
|
|
113
|
+
|
|
114
|
+
- name: TypeScript check
|
|
115
|
+
run: npx tsc --noEmit
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Security Scanning
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
security:
|
|
122
|
+
runs-on: ubuntu-latest
|
|
123
|
+
steps:
|
|
124
|
+
- uses: actions/checkout@v4
|
|
125
|
+
|
|
126
|
+
- name: Run Snyk security scan
|
|
127
|
+
uses: snyk/actions/node@master
|
|
128
|
+
env:
|
|
129
|
+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
|
130
|
+
with:
|
|
131
|
+
args: --severity-threshold=high
|
|
132
|
+
|
|
133
|
+
- name: Audit dependencies
|
|
134
|
+
run: npm audit --audit-level=moderate
|
|
135
|
+
|
|
136
|
+
- name: Check for outdated dependencies
|
|
137
|
+
run: |
|
|
138
|
+
OUTDATED=$(npm outdated || true)
|
|
139
|
+
if [ ! -z "$OUTDATED" ]; then
|
|
140
|
+
echo "⚠️ Outdated dependencies found:"
|
|
141
|
+
echo "$OUTDATED"
|
|
142
|
+
fi
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Bundle Size Gate
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
bundle-size:
|
|
149
|
+
runs-on: ubuntu-latest
|
|
150
|
+
steps:
|
|
151
|
+
- uses: actions/checkout@v4
|
|
152
|
+
|
|
153
|
+
- uses: actions/setup-node@v4
|
|
154
|
+
with:
|
|
155
|
+
node-version: "20"
|
|
156
|
+
cache: "npm"
|
|
157
|
+
|
|
158
|
+
- run: npm ci
|
|
159
|
+
- run: npm run build
|
|
160
|
+
|
|
161
|
+
- name: Check bundle size
|
|
162
|
+
uses: andresz1/size-limit-action@v1
|
|
163
|
+
with:
|
|
164
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
165
|
+
skip_step: install
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Required Status Checks
|
|
169
|
+
|
|
170
|
+
```yaml
|
|
171
|
+
# .github/workflows/required-checks.yml
|
|
172
|
+
name: Required Checks
|
|
173
|
+
|
|
174
|
+
on:
|
|
175
|
+
pull_request:
|
|
176
|
+
|
|
177
|
+
jobs:
|
|
178
|
+
required:
|
|
179
|
+
runs-on: ubuntu-latest
|
|
180
|
+
needs: [lint, typecheck, test, coverage, security]
|
|
181
|
+
if: always()
|
|
182
|
+
steps:
|
|
183
|
+
- name: Check all required jobs passed
|
|
184
|
+
run: |
|
|
185
|
+
if [ "${{ contains(needs.*.result, 'failure') }}" == "true" ]; then
|
|
186
|
+
echo "❌ Required checks failed"
|
|
187
|
+
exit 1
|
|
188
|
+
fi
|
|
189
|
+
echo "✅ All required checks passed"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Quality Thresholds
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
// quality-thresholds.ts
|
|
196
|
+
export const QUALITY_GATES = {
|
|
197
|
+
coverage: {
|
|
198
|
+
lines: 80,
|
|
199
|
+
branches: 80,
|
|
200
|
+
functions: 80,
|
|
201
|
+
statements: 80,
|
|
202
|
+
},
|
|
203
|
+
linting: {
|
|
204
|
+
maxWarnings: 0,
|
|
205
|
+
maxErrors: 0,
|
|
206
|
+
},
|
|
207
|
+
bundleSize: {
|
|
208
|
+
maxSize: "200kb",
|
|
209
|
+
maxGzipSize: "100kb",
|
|
210
|
+
},
|
|
211
|
+
performance: {
|
|
212
|
+
maxLighthouseScore: 90,
|
|
213
|
+
},
|
|
214
|
+
security: {
|
|
215
|
+
maxVulnerabilities: 0,
|
|
216
|
+
maxSeverity: "moderate",
|
|
217
|
+
},
|
|
218
|
+
dependencies: {
|
|
219
|
+
maxOutdated: 5,
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Branch Protection Rules
|
|
225
|
+
|
|
226
|
+
```yaml
|
|
227
|
+
# Configure via GitHub settings or API
|
|
228
|
+
{
|
|
229
|
+
"required_status_checks":
|
|
230
|
+
{
|
|
231
|
+
"strict": true,
|
|
232
|
+
"contexts":
|
|
233
|
+
["lint", "typecheck", "test", "coverage", "security", "bundle-size"],
|
|
234
|
+
},
|
|
235
|
+
"required_pull_request_reviews":
|
|
236
|
+
{
|
|
237
|
+
"required_approving_review_count": 1,
|
|
238
|
+
"dismiss_stale_reviews": true,
|
|
239
|
+
"require_code_owner_reviews": true,
|
|
240
|
+
},
|
|
241
|
+
"enforce_admins": true,
|
|
242
|
+
"restrictions": null,
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Quality Report
|
|
247
|
+
|
|
248
|
+
```yaml
|
|
249
|
+
- name: Generate quality report
|
|
250
|
+
run: |
|
|
251
|
+
cat > quality-report.md << EOF
|
|
252
|
+
# Quality Report
|
|
253
|
+
|
|
254
|
+
## Coverage
|
|
255
|
+
- Lines: $(node -p "require('./coverage/coverage-summary.json').total.lines.pct")%
|
|
256
|
+
- Branches: $(node -p "require('./coverage/coverage-summary.json').total.branches.pct")%
|
|
257
|
+
- Functions: $(node -p "require('./coverage/coverage-summary.json').total.functions.pct")%
|
|
258
|
+
|
|
259
|
+
## Linting
|
|
260
|
+
- ESLint warnings: $(npm run lint 2>&1 | grep -c warning || echo 0)
|
|
261
|
+
- ESLint errors: $(npm run lint 2>&1 | grep -c error || echo 0)
|
|
262
|
+
|
|
263
|
+
## Type Safety
|
|
264
|
+
- TypeScript errors: $(npx tsc --noEmit 2>&1 | grep -c error || echo 0)
|
|
265
|
+
|
|
266
|
+
## Security
|
|
267
|
+
- Vulnerabilities: $(npm audit --json | jq '.metadata.vulnerabilities.total')
|
|
268
|
+
|
|
269
|
+
## Bundle Size
|
|
270
|
+
- Main bundle: $(ls -lh dist/main.js | awk '{print $5}')
|
|
271
|
+
EOF
|
|
272
|
+
|
|
273
|
+
- name: Comment report on PR
|
|
274
|
+
uses: actions/github-script@v7
|
|
275
|
+
with:
|
|
276
|
+
script: |
|
|
277
|
+
const fs = require('fs');
|
|
278
|
+
const report = fs.readFileSync('quality-report.md', 'utf8');
|
|
279
|
+
github.rest.issues.createComment({
|
|
280
|
+
issue_number: context.issue.number,
|
|
281
|
+
owner: context.repo.owner,
|
|
282
|
+
repo: context.repo.repo,
|
|
283
|
+
body: report
|
|
284
|
+
});
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Auto-fail on Thresholds
|
|
288
|
+
|
|
289
|
+
```yaml
|
|
290
|
+
- name: Check all quality gates
|
|
291
|
+
run: |
|
|
292
|
+
EXIT_CODE=0
|
|
293
|
+
|
|
294
|
+
# Coverage
|
|
295
|
+
COVERAGE=$(node -p "require('./coverage/coverage-summary.json').total.lines.pct")
|
|
296
|
+
if (( $(echo "$COVERAGE < 80" | bc -l) )); then
|
|
297
|
+
echo "❌ Coverage below 80%"
|
|
298
|
+
EXIT_CODE=1
|
|
299
|
+
fi
|
|
300
|
+
|
|
301
|
+
# Lint warnings
|
|
302
|
+
WARNINGS=$(npm run lint 2>&1 | grep -c warning || echo 0)
|
|
303
|
+
if [ "$WARNINGS" -gt 0 ]; then
|
|
304
|
+
echo "❌ Found $WARNINGS lint warnings"
|
|
305
|
+
EXIT_CODE=1
|
|
306
|
+
fi
|
|
307
|
+
|
|
308
|
+
# TypeScript errors
|
|
309
|
+
if ! npx tsc --noEmit; then
|
|
310
|
+
echo "❌ TypeScript errors found"
|
|
311
|
+
EXIT_CODE=1
|
|
312
|
+
fi
|
|
313
|
+
|
|
314
|
+
# Security vulnerabilities
|
|
315
|
+
if ! npm audit --audit-level=moderate; then
|
|
316
|
+
echo "❌ Security vulnerabilities found"
|
|
317
|
+
EXIT_CODE=1
|
|
318
|
+
fi
|
|
319
|
+
|
|
320
|
+
exit $EXIT_CODE
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## Best Practices
|
|
324
|
+
|
|
325
|
+
1. **Strict thresholds**: No compromises on quality
|
|
326
|
+
2. **Fast feedback**: Run checks early in CI
|
|
327
|
+
3. **Clear messages**: Explain why checks failed
|
|
328
|
+
4. **Incremental improvement**: Gradually increase thresholds
|
|
329
|
+
5. **Bypass mechanism**: For emergencies only
|
|
330
|
+
6. **Local pre-commit**: Catch issues before push
|
|
331
|
+
7. **Team agreement**: Align on standards
|
|
332
|
+
|
|
333
|
+
## Output Checklist
|
|
334
|
+
|
|
335
|
+
- [ ] Coverage threshold enforced (80%+)
|
|
336
|
+
- [ ] Linting with zero warnings
|
|
337
|
+
- [ ] Type checking required
|
|
338
|
+
- [ ] Security scanning enabled
|
|
339
|
+
- [ ] Bundle size checks
|
|
340
|
+
- [ ] Branch protection rules
|
|
341
|
+
- [ ] Quality report generated
|
|
342
|
+
- [ ] PR comments automated
|