proagents 1.6.20 → 1.6.22
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/.claude/settings.local.json +3 -1
- package/.proagents/.cursorrules +1 -1
- package/.proagents/.windsurfrules +1 -1
- package/.proagents/AGENTS.md +1 -1
- package/.proagents/AI_INSTRUCTIONS.md +29 -1
- package/.proagents/BOLT.md +1 -1
- package/.proagents/CLAUDE.md +1 -1
- package/.proagents/GEMINI.md +1 -1
- package/.proagents/KIRO.md +1 -1
- package/.proagents/LOVABLE.md +1 -1
- package/.proagents/REPLIT.md +1 -1
- package/.proagents/custom-commands.yaml +1 -2
- package/.proagents/docs/command-details.md +1 -2
- package/.proagents/getting-started/ai-training-setup.md +0 -1
- package/.proagents/performance/README.md +59 -0
- package/.proagents/performance/bundle-analysis.md +375 -0
- package/.proagents/performance/load-testing.md +563 -0
- package/.proagents/performance/runtime-metrics.md +489 -0
- package/.proagents/performance/web-vitals.md +425 -0
- package/.proagents/proagents.config.yaml +55 -1
- package/.proagents/prompts/11-session-tracking.md +100 -0
- package/.proagents/prompts/13-commit.md +426 -0
- package/.proagents/workflow-modes/entry-modes.md +1 -6
- package/COMMANDS.md +19 -0
- package/lib/commands/init.js +62 -11
- package/package.json +1 -1
- package/.proagents/api-versioning/README.md +0 -257
- package/.proagents/api-versioning/changelog-template.md +0 -225
- package/.proagents/api-versioning/deprecation-workflow.md +0 -470
- package/.proagents/api-versioning/versioning-strategy.md +0 -291
- package/.proagents/automation/README.md +0 -38
- package/.proagents/automation/ai-behavior-rules.md +0 -339
- package/.proagents/automation/ai-prompt-injection.md +0 -331
- package/.proagents/automation/auto-decisions.md +0 -535
- package/.proagents/automation/decision-defaults.yaml +0 -317
- package/.proagents/cache/README.md +0 -110
- package/.proagents/cache/analysis-metadata.json +0 -76
- package/.proagents/cache/conventions.json +0 -125
- package/.proagents/cache/dependencies.json +0 -85
- package/.proagents/cache/features.json +0 -115
- package/.proagents/cache/patterns.json +0 -105
- package/.proagents/cache/schemas/conventions-schema.json +0 -138
- package/.proagents/cache/schemas/dependencies-schema.json +0 -95
- package/.proagents/cache/schemas/features-schema.json +0 -104
- package/.proagents/cache/schemas/metadata-schema.json +0 -83
- package/.proagents/cache/schemas/patterns-schema.json +0 -136
- package/.proagents/cache/schemas/structure-schema.json +0 -72
- package/.proagents/cache/structure.json +0 -109
- package/.proagents/checklists/README.md +0 -261
- package/.proagents/checklists/code-quality.md +0 -137
- package/.proagents/checklists/code-review.md +0 -148
- package/.proagents/checklists/pr-checklist.md +0 -78
- package/.proagents/checklists/pre-deployment.md +0 -132
- package/.proagents/checklists/pre-implementation.md +0 -80
- package/.proagents/checklists/testing.md +0 -120
- package/.proagents/checkpoints.json +0 -13
- package/.proagents/cicd/README.md +0 -338
- package/.proagents/cicd/azure-devops.md +0 -267
- package/.proagents/cicd/github-actions.md +0 -375
- package/.proagents/cicd/gitlab-ci.md +0 -278
- package/.proagents/cicd/jenkins.md +0 -317
- package/.proagents/collaboration/README.md +0 -143
- package/.proagents/collaboration/roles.md +0 -248
- package/.proagents/collaboration/sessions.md +0 -390
- package/.proagents/collaboration/sync.md +0 -358
- package/.proagents/cost/README.md +0 -48
- package/.proagents/cost/cost-template.md +0 -283
- package/.proagents/cost/estimation-framework.md +0 -287
- package/.proagents/database/README.md +0 -72
- package/.proagents/database/examples/001-create-users.sql +0 -129
- package/.proagents/database/examples/002-add-preferences.sql +0 -94
- package/.proagents/database/examples/003-add-index.sql +0 -105
- package/.proagents/database/examples/004-rename-column.sql +0 -122
- package/.proagents/database/examples/005-add-foreign-key.sql +0 -142
- package/.proagents/database/examples/006-data-migration.sql +0 -196
- package/.proagents/database/examples/007-drop-column.sql +0 -163
- package/.proagents/database/examples/README.md +0 -89
- package/.proagents/database/migration-workflow.md +0 -478
- package/.proagents/database/rollback-scripts.md +0 -487
- package/.proagents/database/safety-checks.md +0 -447
- package/.proagents/git/README.md +0 -68
- package/.proagents/git/branch-strategy.md +0 -164
- package/.proagents/git/commit-conventions.md +0 -241
- package/.proagents/git/pr-workflow.md +0 -286
- package/.proagents/git/rollback-procedures.md +0 -416
- package/.proagents/ide-integration/README.md +0 -124
- package/.proagents/ide-integration/cline-config.md +0 -429
- package/.proagents/ide-integration/continue-config.md +0 -380
- package/.proagents/ide-integration/cursor-rules.md +0 -280
- package/.proagents/ide-integration/github-copilot.md +0 -384
- package/.proagents/ide-integration/windsurf-rules.md +0 -314
- package/.proagents/integrations/README.md +0 -97
- package/.proagents/integrations/pm/README.md +0 -344
- package/.proagents/learning/README.md +0 -136
- package/.proagents/learning/adaptation.md +0 -305
- package/.proagents/learning/data-collection.md +0 -283
- package/.proagents/learning/implementation-guide.md +0 -865
- package/.proagents/learning/reports.md +0 -306
- package/.proagents/mcp/README.md +0 -133
- package/.proagents/mcp/context-providers.md +0 -442
- package/.proagents/mcp/server-config.md +0 -306
- package/.proagents/mcp/tools-definition.md +0 -513
- package/.proagents/pm-integration/README.md +0 -151
- package/.proagents/pm-integration/asana.md +0 -346
- package/.proagents/pm-integration/github-issues.md +0 -308
- package/.proagents/pm-integration/gitlab-issues.md +0 -482
- package/.proagents/pm-integration/jira.md +0 -364
- package/.proagents/pm-integration/linear.md +0 -409
- package/.proagents/pm-integration/notion.md +0 -275
- package/.proagents/pm-integration/sync-config.md +0 -533
- package/.proagents/pm-integration/trello.md +0 -159
- package/.proagents/rules/README.md +0 -179
- package/.proagents/rules/custom-rules-template.yaml +0 -286
- package/.proagents/rules/custom-rules.md +0 -754
- package/.proagents/rules/validation-rules-template.yaml +0 -517
- package/.proagents/runbooks/README.md +0 -219
- package/.proagents/runbooks/dependency-vulnerability.md +0 -505
- package/.proagents/runbooks/incident-response.md +0 -451
- package/.proagents/runbooks/performance-degradation.md +0 -584
- package/.proagents/runbooks/production-debugging.md +0 -489
- package/.proagents/sessions/README.md +0 -5
- package/.proagents/sprints/README.md +0 -58
- package/.proagents/team/README.md +0 -256
- package/.proagents/team/code-ownership.md +0 -306
- package/.proagents/team/communication-templates.md +0 -441
- package/.proagents/team/handoff-protocol.md +0 -380
- package/.proagents/team/ide-setup/README.md +0 -103
- package/.proagents/team/ide-setup/cursor.md +0 -276
- package/.proagents/team/ide-setup/jetbrains.md +0 -330
- package/.proagents/team/ide-setup/neovim.md +0 -640
- package/.proagents/team/ide-setup/vscode.md +0 -348
- package/.proagents/team/onboarding.md +0 -278
- package/.proagents/time-tracking.json +0 -19
- package/.proagents/troubleshooting/README.md +0 -730
- package/.proagents/troubleshooting/ai-issues.md +0 -601
- package/.proagents/troubleshooting/workflow-issues.md +0 -571
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
# GitHub Actions Templates
|
|
2
|
-
|
|
3
|
-
Ready-to-use GitHub Actions workflows for CI/CD.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Complete CI Workflow
|
|
8
|
-
|
|
9
|
-
```yaml
|
|
10
|
-
# .github/workflows/ci.yml
|
|
11
|
-
name: CI
|
|
12
|
-
|
|
13
|
-
on:
|
|
14
|
-
push:
|
|
15
|
-
branches: [main, develop]
|
|
16
|
-
pull_request:
|
|
17
|
-
branches: [main, develop]
|
|
18
|
-
|
|
19
|
-
env:
|
|
20
|
-
NODE_VERSION: '20'
|
|
21
|
-
|
|
22
|
-
jobs:
|
|
23
|
-
# Lint and type check
|
|
24
|
-
lint:
|
|
25
|
-
runs-on: ubuntu-latest
|
|
26
|
-
steps:
|
|
27
|
-
- uses: actions/checkout@v4
|
|
28
|
-
|
|
29
|
-
- name: Setup Node.js
|
|
30
|
-
uses: actions/setup-node@v4
|
|
31
|
-
with:
|
|
32
|
-
node-version: ${{ env.NODE_VERSION }}
|
|
33
|
-
cache: 'npm'
|
|
34
|
-
|
|
35
|
-
- name: Install dependencies
|
|
36
|
-
run: npm ci
|
|
37
|
-
|
|
38
|
-
- name: Run ESLint
|
|
39
|
-
run: npm run lint
|
|
40
|
-
|
|
41
|
-
- name: Run TypeScript check
|
|
42
|
-
run: npm run type-check
|
|
43
|
-
|
|
44
|
-
# Unit and integration tests
|
|
45
|
-
test:
|
|
46
|
-
runs-on: ubuntu-latest
|
|
47
|
-
steps:
|
|
48
|
-
- uses: actions/checkout@v4
|
|
49
|
-
|
|
50
|
-
- name: Setup Node.js
|
|
51
|
-
uses: actions/setup-node@v4
|
|
52
|
-
with:
|
|
53
|
-
node-version: ${{ env.NODE_VERSION }}
|
|
54
|
-
cache: 'npm'
|
|
55
|
-
|
|
56
|
-
- name: Install dependencies
|
|
57
|
-
run: npm ci
|
|
58
|
-
|
|
59
|
-
- name: Run tests
|
|
60
|
-
run: npm test -- --coverage
|
|
61
|
-
|
|
62
|
-
- name: Upload coverage
|
|
63
|
-
uses: codecov/codecov-action@v3
|
|
64
|
-
with:
|
|
65
|
-
files: ./coverage/lcov.info
|
|
66
|
-
fail_ci_if_error: true
|
|
67
|
-
|
|
68
|
-
# Security scanning
|
|
69
|
-
security:
|
|
70
|
-
runs-on: ubuntu-latest
|
|
71
|
-
steps:
|
|
72
|
-
- uses: actions/checkout@v4
|
|
73
|
-
|
|
74
|
-
- name: Run security audit
|
|
75
|
-
run: npm audit --audit-level=high
|
|
76
|
-
|
|
77
|
-
- name: Run Snyk scan
|
|
78
|
-
uses: snyk/actions/node@master
|
|
79
|
-
env:
|
|
80
|
-
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
|
81
|
-
|
|
82
|
-
# Build
|
|
83
|
-
build:
|
|
84
|
-
needs: [lint, test, security]
|
|
85
|
-
runs-on: ubuntu-latest
|
|
86
|
-
steps:
|
|
87
|
-
- uses: actions/checkout@v4
|
|
88
|
-
|
|
89
|
-
- name: Setup Node.js
|
|
90
|
-
uses: actions/setup-node@v4
|
|
91
|
-
with:
|
|
92
|
-
node-version: ${{ env.NODE_VERSION }}
|
|
93
|
-
cache: 'npm'
|
|
94
|
-
|
|
95
|
-
- name: Install dependencies
|
|
96
|
-
run: npm ci
|
|
97
|
-
|
|
98
|
-
- name: Build
|
|
99
|
-
run: npm run build
|
|
100
|
-
|
|
101
|
-
- name: Upload build artifacts
|
|
102
|
-
uses: actions/upload-artifact@v4
|
|
103
|
-
with:
|
|
104
|
-
name: build
|
|
105
|
-
path: dist/
|
|
106
|
-
retention-days: 7
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## Deployment Workflow
|
|
112
|
-
|
|
113
|
-
```yaml
|
|
114
|
-
# .github/workflows/deploy.yml
|
|
115
|
-
name: Deploy
|
|
116
|
-
|
|
117
|
-
on:
|
|
118
|
-
push:
|
|
119
|
-
branches: [main]
|
|
120
|
-
workflow_dispatch:
|
|
121
|
-
inputs:
|
|
122
|
-
environment:
|
|
123
|
-
description: 'Environment to deploy'
|
|
124
|
-
required: true
|
|
125
|
-
default: 'staging'
|
|
126
|
-
type: choice
|
|
127
|
-
options:
|
|
128
|
-
- staging
|
|
129
|
-
- production
|
|
130
|
-
|
|
131
|
-
jobs:
|
|
132
|
-
deploy-staging:
|
|
133
|
-
if: github.ref == 'refs/heads/main' || github.event.inputs.environment == 'staging'
|
|
134
|
-
runs-on: ubuntu-latest
|
|
135
|
-
environment: staging
|
|
136
|
-
steps:
|
|
137
|
-
- uses: actions/checkout@v4
|
|
138
|
-
|
|
139
|
-
- name: Download build
|
|
140
|
-
uses: actions/download-artifact@v4
|
|
141
|
-
with:
|
|
142
|
-
name: build
|
|
143
|
-
path: dist/
|
|
144
|
-
|
|
145
|
-
- name: Deploy to staging
|
|
146
|
-
run: |
|
|
147
|
-
# Your deployment command
|
|
148
|
-
npx proagents deploy --env staging
|
|
149
|
-
env:
|
|
150
|
-
DEPLOY_TOKEN: ${{ secrets.STAGING_DEPLOY_TOKEN }}
|
|
151
|
-
|
|
152
|
-
- name: Run smoke tests
|
|
153
|
-
run: npm run test:smoke -- --env staging
|
|
154
|
-
|
|
155
|
-
deploy-production:
|
|
156
|
-
if: github.event.inputs.environment == 'production'
|
|
157
|
-
needs: [deploy-staging]
|
|
158
|
-
runs-on: ubuntu-latest
|
|
159
|
-
environment: production
|
|
160
|
-
steps:
|
|
161
|
-
- uses: actions/checkout@v4
|
|
162
|
-
|
|
163
|
-
- name: Download build
|
|
164
|
-
uses: actions/download-artifact@v4
|
|
165
|
-
with:
|
|
166
|
-
name: build
|
|
167
|
-
path: dist/
|
|
168
|
-
|
|
169
|
-
- name: Deploy to production
|
|
170
|
-
run: |
|
|
171
|
-
npx proagents deploy --env production
|
|
172
|
-
env:
|
|
173
|
-
DEPLOY_TOKEN: ${{ secrets.PROD_DEPLOY_TOKEN }}
|
|
174
|
-
|
|
175
|
-
- name: Notify deployment
|
|
176
|
-
uses: slackapi/slack-github-action@v1
|
|
177
|
-
with:
|
|
178
|
-
payload: |
|
|
179
|
-
{
|
|
180
|
-
"text": "✅ Deployed to production: ${{ github.sha }}"
|
|
181
|
-
}
|
|
182
|
-
env:
|
|
183
|
-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## PR Workflow
|
|
189
|
-
|
|
190
|
-
```yaml
|
|
191
|
-
# .github/workflows/pr.yml
|
|
192
|
-
name: PR Checks
|
|
193
|
-
|
|
194
|
-
on:
|
|
195
|
-
pull_request:
|
|
196
|
-
types: [opened, synchronize, reopened]
|
|
197
|
-
|
|
198
|
-
jobs:
|
|
199
|
-
pr-checks:
|
|
200
|
-
runs-on: ubuntu-latest
|
|
201
|
-
steps:
|
|
202
|
-
- uses: actions/checkout@v4
|
|
203
|
-
with:
|
|
204
|
-
fetch-depth: 0
|
|
205
|
-
|
|
206
|
-
- name: Setup Node.js
|
|
207
|
-
uses: actions/setup-node@v4
|
|
208
|
-
with:
|
|
209
|
-
node-version: '20'
|
|
210
|
-
cache: 'npm'
|
|
211
|
-
|
|
212
|
-
- name: Install dependencies
|
|
213
|
-
run: npm ci
|
|
214
|
-
|
|
215
|
-
- name: Check PR title
|
|
216
|
-
uses: amannn/action-semantic-pull-request@v5
|
|
217
|
-
env:
|
|
218
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
219
|
-
|
|
220
|
-
- name: Run affected tests
|
|
221
|
-
run: |
|
|
222
|
-
# Only test changed files
|
|
223
|
-
npm run test -- --changedSince=origin/main
|
|
224
|
-
|
|
225
|
-
- name: Check bundle size
|
|
226
|
-
uses: preactjs/compressed-size-action@v2
|
|
227
|
-
with:
|
|
228
|
-
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
229
|
-
|
|
230
|
-
- name: Add coverage comment
|
|
231
|
-
uses: marocchino/sticky-pull-request-comment@v2
|
|
232
|
-
with:
|
|
233
|
-
message: |
|
|
234
|
-
## Coverage Report
|
|
235
|
-
${{ steps.coverage.outputs.summary }}
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
---
|
|
239
|
-
|
|
240
|
-
## Scheduled Jobs
|
|
241
|
-
|
|
242
|
-
```yaml
|
|
243
|
-
# .github/workflows/scheduled.yml
|
|
244
|
-
name: Scheduled Jobs
|
|
245
|
-
|
|
246
|
-
on:
|
|
247
|
-
schedule:
|
|
248
|
-
# Daily at 6 AM UTC
|
|
249
|
-
- cron: '0 6 * * *'
|
|
250
|
-
|
|
251
|
-
jobs:
|
|
252
|
-
dependency-update:
|
|
253
|
-
runs-on: ubuntu-latest
|
|
254
|
-
steps:
|
|
255
|
-
- uses: actions/checkout@v4
|
|
256
|
-
|
|
257
|
-
- name: Check for updates
|
|
258
|
-
run: npx proagents deps check --ci
|
|
259
|
-
|
|
260
|
-
- name: Create PR for updates
|
|
261
|
-
if: steps.check.outputs.has_updates == 'true'
|
|
262
|
-
run: npx proagents deps update --create-pr
|
|
263
|
-
|
|
264
|
-
security-scan:
|
|
265
|
-
runs-on: ubuntu-latest
|
|
266
|
-
steps:
|
|
267
|
-
- uses: actions/checkout@v4
|
|
268
|
-
|
|
269
|
-
- name: Run security scan
|
|
270
|
-
run: npx proagents security scan --ci
|
|
271
|
-
|
|
272
|
-
- name: Create issue on findings
|
|
273
|
-
if: failure()
|
|
274
|
-
uses: actions/github-script@v7
|
|
275
|
-
with:
|
|
276
|
-
script: |
|
|
277
|
-
github.rest.issues.create({
|
|
278
|
-
owner: context.repo.owner,
|
|
279
|
-
repo: context.repo.repo,
|
|
280
|
-
title: 'Security vulnerabilities detected',
|
|
281
|
-
body: 'Please review the security scan results.',
|
|
282
|
-
labels: ['security', 'automated']
|
|
283
|
-
})
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
## Reusable Workflows
|
|
289
|
-
|
|
290
|
-
```yaml
|
|
291
|
-
# .github/workflows/reusable-test.yml
|
|
292
|
-
name: Reusable Test Workflow
|
|
293
|
-
|
|
294
|
-
on:
|
|
295
|
-
workflow_call:
|
|
296
|
-
inputs:
|
|
297
|
-
node-version:
|
|
298
|
-
required: false
|
|
299
|
-
type: string
|
|
300
|
-
default: '20'
|
|
301
|
-
secrets:
|
|
302
|
-
npm-token:
|
|
303
|
-
required: false
|
|
304
|
-
|
|
305
|
-
jobs:
|
|
306
|
-
test:
|
|
307
|
-
runs-on: ubuntu-latest
|
|
308
|
-
steps:
|
|
309
|
-
- uses: actions/checkout@v4
|
|
310
|
-
|
|
311
|
-
- name: Setup Node.js
|
|
312
|
-
uses: actions/setup-node@v4
|
|
313
|
-
with:
|
|
314
|
-
node-version: ${{ inputs.node-version }}
|
|
315
|
-
cache: 'npm'
|
|
316
|
-
registry-url: 'https://registry.npmjs.org'
|
|
317
|
-
|
|
318
|
-
- name: Install dependencies
|
|
319
|
-
run: npm ci
|
|
320
|
-
env:
|
|
321
|
-
NODE_AUTH_TOKEN: ${{ secrets.npm-token }}
|
|
322
|
-
|
|
323
|
-
- name: Run tests
|
|
324
|
-
run: npm test
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
### Using Reusable Workflow
|
|
328
|
-
|
|
329
|
-
```yaml
|
|
330
|
-
# .github/workflows/ci.yml
|
|
331
|
-
jobs:
|
|
332
|
-
test:
|
|
333
|
-
uses: ./.github/workflows/reusable-test.yml
|
|
334
|
-
with:
|
|
335
|
-
node-version: '20'
|
|
336
|
-
secrets:
|
|
337
|
-
npm-token: ${{ secrets.NPM_TOKEN }}
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
---
|
|
341
|
-
|
|
342
|
-
## Matrix Builds
|
|
343
|
-
|
|
344
|
-
```yaml
|
|
345
|
-
jobs:
|
|
346
|
-
test:
|
|
347
|
-
runs-on: ${{ matrix.os }}
|
|
348
|
-
strategy:
|
|
349
|
-
matrix:
|
|
350
|
-
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
351
|
-
node: [18, 20, 22]
|
|
352
|
-
fail-fast: false
|
|
353
|
-
|
|
354
|
-
steps:
|
|
355
|
-
- uses: actions/checkout@v4
|
|
356
|
-
|
|
357
|
-
- name: Setup Node.js ${{ matrix.node }}
|
|
358
|
-
uses: actions/setup-node@v4
|
|
359
|
-
with:
|
|
360
|
-
node-version: ${{ matrix.node }}
|
|
361
|
-
|
|
362
|
-
- run: npm ci
|
|
363
|
-
- run: npm test
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
---
|
|
367
|
-
|
|
368
|
-
## Best Practices
|
|
369
|
-
|
|
370
|
-
1. **Cache Dependencies**: Use `actions/cache` or built-in caching
|
|
371
|
-
2. **Parallel Jobs**: Run independent jobs in parallel
|
|
372
|
-
3. **Fail Fast**: Use `fail-fast: false` for matrix builds
|
|
373
|
-
4. **Environment Protection**: Use environments for deployments
|
|
374
|
-
5. **Reusable Workflows**: DRY with reusable workflows
|
|
375
|
-
6. **Secrets Management**: Never hardcode secrets
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
# GitLab CI Templates
|
|
2
|
-
|
|
3
|
-
Ready-to-use GitLab CI/CD pipeline configurations.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Complete Pipeline
|
|
8
|
-
|
|
9
|
-
```yaml
|
|
10
|
-
# .gitlab-ci.yml
|
|
11
|
-
stages:
|
|
12
|
-
- validate
|
|
13
|
-
- test
|
|
14
|
-
- security
|
|
15
|
-
- build
|
|
16
|
-
- deploy
|
|
17
|
-
|
|
18
|
-
variables:
|
|
19
|
-
NODE_VERSION: "20"
|
|
20
|
-
npm_config_cache: "$CI_PROJECT_DIR/.npm"
|
|
21
|
-
|
|
22
|
-
# Cache configuration
|
|
23
|
-
.node_cache: &node_cache
|
|
24
|
-
cache:
|
|
25
|
-
key:
|
|
26
|
-
files:
|
|
27
|
-
- package-lock.json
|
|
28
|
-
paths:
|
|
29
|
-
- .npm/
|
|
30
|
-
- node_modules/
|
|
31
|
-
policy: pull-push
|
|
32
|
-
|
|
33
|
-
# Base template
|
|
34
|
-
.node_template: &node_template
|
|
35
|
-
image: node:${NODE_VERSION}
|
|
36
|
-
<<: *node_cache
|
|
37
|
-
before_script:
|
|
38
|
-
- npm ci --cache .npm --prefer-offline
|
|
39
|
-
|
|
40
|
-
# ============ VALIDATE STAGE ============
|
|
41
|
-
lint:
|
|
42
|
-
stage: validate
|
|
43
|
-
<<: *node_template
|
|
44
|
-
script:
|
|
45
|
-
- npm run lint
|
|
46
|
-
rules:
|
|
47
|
-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
48
|
-
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
49
|
-
|
|
50
|
-
typecheck:
|
|
51
|
-
stage: validate
|
|
52
|
-
<<: *node_template
|
|
53
|
-
script:
|
|
54
|
-
- npm run type-check
|
|
55
|
-
rules:
|
|
56
|
-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
57
|
-
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
58
|
-
|
|
59
|
-
# ============ TEST STAGE ============
|
|
60
|
-
unit_tests:
|
|
61
|
-
stage: test
|
|
62
|
-
<<: *node_template
|
|
63
|
-
script:
|
|
64
|
-
- npm run test:unit -- --coverage
|
|
65
|
-
coverage: '/Lines\s*:\s*(\d+\.?\d*)%/'
|
|
66
|
-
artifacts:
|
|
67
|
-
reports:
|
|
68
|
-
coverage_report:
|
|
69
|
-
coverage_format: cobertura
|
|
70
|
-
path: coverage/cobertura-coverage.xml
|
|
71
|
-
junit: junit.xml
|
|
72
|
-
paths:
|
|
73
|
-
- coverage/
|
|
74
|
-
expire_in: 1 week
|
|
75
|
-
|
|
76
|
-
integration_tests:
|
|
77
|
-
stage: test
|
|
78
|
-
<<: *node_template
|
|
79
|
-
services:
|
|
80
|
-
- postgres:15
|
|
81
|
-
- redis:7
|
|
82
|
-
variables:
|
|
83
|
-
POSTGRES_DB: test_db
|
|
84
|
-
POSTGRES_USER: test
|
|
85
|
-
POSTGRES_PASSWORD: test
|
|
86
|
-
DATABASE_URL: "postgresql://test:test@postgres:5432/test_db"
|
|
87
|
-
REDIS_URL: "redis://redis:6379"
|
|
88
|
-
script:
|
|
89
|
-
- npm run test:integration
|
|
90
|
-
|
|
91
|
-
# ============ SECURITY STAGE ============
|
|
92
|
-
dependency_scan:
|
|
93
|
-
stage: security
|
|
94
|
-
<<: *node_template
|
|
95
|
-
script:
|
|
96
|
-
- npm audit --audit-level=high
|
|
97
|
-
allow_failure: true
|
|
98
|
-
|
|
99
|
-
sast:
|
|
100
|
-
stage: security
|
|
101
|
-
image:
|
|
102
|
-
name: "semgrep/semgrep"
|
|
103
|
-
entrypoint: [""]
|
|
104
|
-
script:
|
|
105
|
-
- semgrep --config auto --json -o semgrep-report.json .
|
|
106
|
-
artifacts:
|
|
107
|
-
reports:
|
|
108
|
-
sast: semgrep-report.json
|
|
109
|
-
|
|
110
|
-
secret_detection:
|
|
111
|
-
stage: security
|
|
112
|
-
image: trufflesecurity/trufflehog:latest
|
|
113
|
-
script:
|
|
114
|
-
- trufflehog git file://. --only-verified
|
|
115
|
-
|
|
116
|
-
# ============ BUILD STAGE ============
|
|
117
|
-
build:
|
|
118
|
-
stage: build
|
|
119
|
-
<<: *node_template
|
|
120
|
-
script:
|
|
121
|
-
- npm run build
|
|
122
|
-
artifacts:
|
|
123
|
-
paths:
|
|
124
|
-
- dist/
|
|
125
|
-
expire_in: 1 week
|
|
126
|
-
rules:
|
|
127
|
-
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
128
|
-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
129
|
-
|
|
130
|
-
docker_build:
|
|
131
|
-
stage: build
|
|
132
|
-
image: docker:24
|
|
133
|
-
services:
|
|
134
|
-
- docker:24-dind
|
|
135
|
-
variables:
|
|
136
|
-
DOCKER_TLS_CERTDIR: "/certs"
|
|
137
|
-
script:
|
|
138
|
-
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
139
|
-
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
|
|
140
|
-
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
|
141
|
-
rules:
|
|
142
|
-
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
143
|
-
|
|
144
|
-
# ============ DEPLOY STAGE ============
|
|
145
|
-
deploy_staging:
|
|
146
|
-
stage: deploy
|
|
147
|
-
image: alpine:latest
|
|
148
|
-
environment:
|
|
149
|
-
name: staging
|
|
150
|
-
url: https://staging.example.com
|
|
151
|
-
script:
|
|
152
|
-
- apk add --no-cache curl
|
|
153
|
-
- curl -X POST $DEPLOY_WEBHOOK_STAGING
|
|
154
|
-
rules:
|
|
155
|
-
- if: $CI_COMMIT_BRANCH == "develop"
|
|
156
|
-
|
|
157
|
-
deploy_production:
|
|
158
|
-
stage: deploy
|
|
159
|
-
image: alpine:latest
|
|
160
|
-
environment:
|
|
161
|
-
name: production
|
|
162
|
-
url: https://example.com
|
|
163
|
-
script:
|
|
164
|
-
- apk add --no-cache curl
|
|
165
|
-
- curl -X POST $DEPLOY_WEBHOOK_PRODUCTION
|
|
166
|
-
rules:
|
|
167
|
-
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
168
|
-
when: manual
|
|
169
|
-
needs:
|
|
170
|
-
- build
|
|
171
|
-
- unit_tests
|
|
172
|
-
- integration_tests
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
---
|
|
176
|
-
|
|
177
|
-
## Merge Request Pipeline
|
|
178
|
-
|
|
179
|
-
```yaml
|
|
180
|
-
# Optimized for merge requests
|
|
181
|
-
workflow:
|
|
182
|
-
rules:
|
|
183
|
-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
184
|
-
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
185
|
-
|
|
186
|
-
mr_checks:
|
|
187
|
-
stage: validate
|
|
188
|
-
script:
|
|
189
|
-
- |
|
|
190
|
-
# Check MR title format
|
|
191
|
-
if [[ ! "$CI_MERGE_REQUEST_TITLE" =~ ^(feat|fix|docs|style|refactor|test|chore)\(.+\):.+ ]]; then
|
|
192
|
-
echo "MR title must follow conventional commits format"
|
|
193
|
-
exit 1
|
|
194
|
-
fi
|
|
195
|
-
rules:
|
|
196
|
-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
---
|
|
200
|
-
|
|
201
|
-
## Environment-Specific Variables
|
|
202
|
-
|
|
203
|
-
```yaml
|
|
204
|
-
# Per-environment configuration
|
|
205
|
-
.staging_vars: &staging_vars
|
|
206
|
-
variables:
|
|
207
|
-
ENVIRONMENT: staging
|
|
208
|
-
API_URL: https://api-staging.example.com
|
|
209
|
-
|
|
210
|
-
.production_vars: &production_vars
|
|
211
|
-
variables:
|
|
212
|
-
ENVIRONMENT: production
|
|
213
|
-
API_URL: https://api.example.com
|
|
214
|
-
|
|
215
|
-
deploy_staging:
|
|
216
|
-
<<: *staging_vars
|
|
217
|
-
# ... rest of config
|
|
218
|
-
|
|
219
|
-
deploy_production:
|
|
220
|
-
<<: *production_vars
|
|
221
|
-
# ... rest of config
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
## Scheduled Pipelines
|
|
227
|
-
|
|
228
|
-
```yaml
|
|
229
|
-
# Scheduled jobs
|
|
230
|
-
dependency_update:
|
|
231
|
-
stage: validate
|
|
232
|
-
script:
|
|
233
|
-
- npx proagents deps check --ci
|
|
234
|
-
- npx proagents deps update --create-mr
|
|
235
|
-
rules:
|
|
236
|
-
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
237
|
-
variables:
|
|
238
|
-
SCHEDULE_TYPE: "dependency_update"
|
|
239
|
-
|
|
240
|
-
nightly_security_scan:
|
|
241
|
-
stage: security
|
|
242
|
-
script:
|
|
243
|
-
- npm audit
|
|
244
|
-
- npx snyk test
|
|
245
|
-
rules:
|
|
246
|
-
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
247
|
-
variables:
|
|
248
|
-
SCHEDULE_TYPE: "security_scan"
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
---
|
|
252
|
-
|
|
253
|
-
## Include External Templates
|
|
254
|
-
|
|
255
|
-
```yaml
|
|
256
|
-
include:
|
|
257
|
-
# GitLab templates
|
|
258
|
-
- template: Security/SAST.gitlab-ci.yml
|
|
259
|
-
- template: Security/Dependency-Scanning.gitlab-ci.yml
|
|
260
|
-
|
|
261
|
-
# Local templates
|
|
262
|
-
- local: .gitlab/ci/test.yml
|
|
263
|
-
- local: .gitlab/ci/deploy.yml
|
|
264
|
-
|
|
265
|
-
# Remote templates
|
|
266
|
-
- remote: https://example.com/ci-templates/node.yml
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
---
|
|
270
|
-
|
|
271
|
-
## Best Practices
|
|
272
|
-
|
|
273
|
-
1. **Use Caching**: Cache npm dependencies
|
|
274
|
-
2. **Parallel Jobs**: Run independent jobs in parallel
|
|
275
|
-
3. **Use Artifacts**: Pass data between stages
|
|
276
|
-
4. **Environment Protection**: Use protected environments
|
|
277
|
-
5. **Include Templates**: DRY with includes
|
|
278
|
-
6. **Rules Over Only/Except**: Use `rules:` for conditional jobs
|