@vertaaux/cli 0.2.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 (198) hide show
  1. package/README.md +345 -0
  2. package/dist/auth/ci-token.d.ts +49 -0
  3. package/dist/auth/ci-token.d.ts.map +1 -0
  4. package/dist/auth/ci-token.js +83 -0
  5. package/dist/auth/device-flow.d.ts +66 -0
  6. package/dist/auth/device-flow.d.ts.map +1 -0
  7. package/dist/auth/device-flow.js +156 -0
  8. package/dist/auth/token-store.d.ts +53 -0
  9. package/dist/auth/token-store.d.ts.map +1 -0
  10. package/dist/auth/token-store.js +78 -0
  11. package/dist/baseline/diff.d.ts +57 -0
  12. package/dist/baseline/diff.d.ts.map +1 -0
  13. package/dist/baseline/diff.js +152 -0
  14. package/dist/baseline/hash.d.ts +54 -0
  15. package/dist/baseline/hash.d.ts.map +1 -0
  16. package/dist/baseline/hash.js +66 -0
  17. package/dist/baseline/manager.d.ts +89 -0
  18. package/dist/baseline/manager.d.ts.map +1 -0
  19. package/dist/baseline/manager.js +157 -0
  20. package/dist/cache/index.d.ts +8 -0
  21. package/dist/cache/index.d.ts.map +1 -0
  22. package/dist/cache/index.js +7 -0
  23. package/dist/cache/route-cache.d.ts +119 -0
  24. package/dist/cache/route-cache.d.ts.map +1 -0
  25. package/dist/cache/route-cache.js +213 -0
  26. package/dist/ci/changed-routes.d.ts +95 -0
  27. package/dist/ci/changed-routes.d.ts.map +1 -0
  28. package/dist/ci/changed-routes.js +304 -0
  29. package/dist/ci/github-api.d.ts +68 -0
  30. package/dist/ci/github-api.d.ts.map +1 -0
  31. package/dist/ci/github-api.js +138 -0
  32. package/dist/ci/gitlab-api.d.ts +75 -0
  33. package/dist/ci/gitlab-api.d.ts.map +1 -0
  34. package/dist/ci/gitlab-api.js +180 -0
  35. package/dist/ci/index.d.ts +6 -0
  36. package/dist/ci/index.d.ts.map +1 -0
  37. package/dist/ci/index.js +4 -0
  38. package/dist/commands/audit.d.ts +58 -0
  39. package/dist/commands/audit.d.ts.map +1 -0
  40. package/dist/commands/audit.js +862 -0
  41. package/dist/commands/baseline.d.ts +22 -0
  42. package/dist/commands/baseline.d.ts.map +1 -0
  43. package/dist/commands/baseline.js +210 -0
  44. package/dist/commands/comment.d.ts +14 -0
  45. package/dist/commands/comment.d.ts.map +1 -0
  46. package/dist/commands/comment.js +363 -0
  47. package/dist/commands/diff.d.ts +24 -0
  48. package/dist/commands/diff.d.ts.map +1 -0
  49. package/dist/commands/diff.js +196 -0
  50. package/dist/commands/doctor.d.ts +58 -0
  51. package/dist/commands/doctor.d.ts.map +1 -0
  52. package/dist/commands/doctor.js +338 -0
  53. package/dist/commands/download.d.ts +12 -0
  54. package/dist/commands/download.d.ts.map +1 -0
  55. package/dist/commands/download.js +183 -0
  56. package/dist/commands/explain.d.ts +62 -0
  57. package/dist/commands/explain.d.ts.map +1 -0
  58. package/dist/commands/explain.js +302 -0
  59. package/dist/commands/init.d.ts +12 -0
  60. package/dist/commands/init.d.ts.map +1 -0
  61. package/dist/commands/init.js +212 -0
  62. package/dist/commands/login.d.ts +14 -0
  63. package/dist/commands/login.d.ts.map +1 -0
  64. package/dist/commands/login.js +222 -0
  65. package/dist/commands/policy.d.ts +13 -0
  66. package/dist/commands/policy.d.ts.map +1 -0
  67. package/dist/commands/policy.js +347 -0
  68. package/dist/commands/upload.d.ts +12 -0
  69. package/dist/commands/upload.d.ts.map +1 -0
  70. package/dist/commands/upload.js +158 -0
  71. package/dist/config/defaults.d.ts +21 -0
  72. package/dist/config/defaults.d.ts.map +1 -0
  73. package/dist/config/defaults.js +49 -0
  74. package/dist/config/loader.d.ts +66 -0
  75. package/dist/config/loader.d.ts.map +1 -0
  76. package/dist/config/loader.js +167 -0
  77. package/dist/config/schema.d.ts +55 -0
  78. package/dist/config/schema.d.ts.map +1 -0
  79. package/dist/config/schema.js +6 -0
  80. package/dist/index.d.ts +9 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/index.js +1090 -0
  83. package/dist/interactive/fix-wizard.d.ts +44 -0
  84. package/dist/interactive/fix-wizard.d.ts.map +1 -0
  85. package/dist/interactive/fix-wizard.js +286 -0
  86. package/dist/interactive/init-wizard.d.ts +32 -0
  87. package/dist/interactive/init-wizard.d.ts.map +1 -0
  88. package/dist/interactive/init-wizard.js +193 -0
  89. package/dist/interactive/prompts.d.ts +62 -0
  90. package/dist/interactive/prompts.d.ts.map +1 -0
  91. package/dist/interactive/prompts.js +78 -0
  92. package/dist/monorepo/detector.d.ts +70 -0
  93. package/dist/monorepo/detector.d.ts.map +1 -0
  94. package/dist/monorepo/detector.js +278 -0
  95. package/dist/monorepo/index.d.ts +9 -0
  96. package/dist/monorepo/index.d.ts.map +1 -0
  97. package/dist/monorepo/index.js +8 -0
  98. package/dist/monorepo/workspace.d.ts +142 -0
  99. package/dist/monorepo/workspace.d.ts.map +1 -0
  100. package/dist/monorepo/workspace.js +171 -0
  101. package/dist/output/envelope.d.ts +21 -0
  102. package/dist/output/envelope.d.ts.map +1 -0
  103. package/dist/output/envelope.js +27 -0
  104. package/dist/output/factory.d.ts +73 -0
  105. package/dist/output/factory.d.ts.map +1 -0
  106. package/dist/output/factory.js +60 -0
  107. package/dist/output/formats.d.ts +11 -0
  108. package/dist/output/formats.d.ts.map +1 -0
  109. package/dist/output/formats.js +41 -0
  110. package/dist/output/html.d.ts +45 -0
  111. package/dist/output/html.d.ts.map +1 -0
  112. package/dist/output/html.js +607 -0
  113. package/dist/output/human.d.ts +41 -0
  114. package/dist/output/human.d.ts.map +1 -0
  115. package/dist/output/human.js +274 -0
  116. package/dist/output/json.d.ts +42 -0
  117. package/dist/output/json.d.ts.map +1 -0
  118. package/dist/output/json.js +37 -0
  119. package/dist/output/junit.d.ts +56 -0
  120. package/dist/output/junit.d.ts.map +1 -0
  121. package/dist/output/junit.js +135 -0
  122. package/dist/output/markdown.d.ts +77 -0
  123. package/dist/output/markdown.d.ts.map +1 -0
  124. package/dist/output/markdown.js +411 -0
  125. package/dist/output/sarif.d.ts +160 -0
  126. package/dist/output/sarif.d.ts.map +1 -0
  127. package/dist/output/sarif.js +207 -0
  128. package/dist/policy/evaluator.d.ts +111 -0
  129. package/dist/policy/evaluator.d.ts.map +1 -0
  130. package/dist/policy/evaluator.js +362 -0
  131. package/dist/policy/index.d.ts +15 -0
  132. package/dist/policy/index.d.ts.map +1 -0
  133. package/dist/policy/index.js +11 -0
  134. package/dist/policy/loader.d.ts +97 -0
  135. package/dist/policy/loader.d.ts.map +1 -0
  136. package/dist/policy/loader.js +281 -0
  137. package/dist/policy/schema.d.ts +297 -0
  138. package/dist/policy/schema.d.ts.map +1 -0
  139. package/dist/policy/schema.js +230 -0
  140. package/dist/quality-gate/evaluator.d.ts +58 -0
  141. package/dist/quality-gate/evaluator.d.ts.map +1 -0
  142. package/dist/quality-gate/evaluator.js +274 -0
  143. package/dist/quality-gate/index.d.ts +10 -0
  144. package/dist/quality-gate/index.d.ts.map +1 -0
  145. package/dist/quality-gate/index.js +7 -0
  146. package/dist/quality-gate/types.d.ts +103 -0
  147. package/dist/quality-gate/types.d.ts.map +1 -0
  148. package/dist/quality-gate/types.js +23 -0
  149. package/dist/templates/azure-devops.d.ts +25 -0
  150. package/dist/templates/azure-devops.d.ts.map +1 -0
  151. package/dist/templates/azure-devops.js +109 -0
  152. package/dist/templates/circleci.d.ts +28 -0
  153. package/dist/templates/circleci.d.ts.map +1 -0
  154. package/dist/templates/circleci.js +86 -0
  155. package/dist/templates/github-actions.d.ts +81 -0
  156. package/dist/templates/github-actions.d.ts.map +1 -0
  157. package/dist/templates/github-actions.js +393 -0
  158. package/dist/templates/gitlab-ci.d.ts +26 -0
  159. package/dist/templates/gitlab-ci.d.ts.map +1 -0
  160. package/dist/templates/gitlab-ci.js +70 -0
  161. package/dist/templates/index.d.ts +72 -0
  162. package/dist/templates/index.d.ts.map +1 -0
  163. package/dist/templates/index.js +112 -0
  164. package/dist/templates/jenkins.d.ts +26 -0
  165. package/dist/templates/jenkins.d.ts.map +1 -0
  166. package/dist/templates/jenkins.js +110 -0
  167. package/dist/ui/banner.d.ts +31 -0
  168. package/dist/ui/banner.d.ts.map +1 -0
  169. package/dist/ui/banner.js +84 -0
  170. package/dist/ui/diagnostics.d.ts +39 -0
  171. package/dist/ui/diagnostics.d.ts.map +1 -0
  172. package/dist/ui/diagnostics.js +153 -0
  173. package/dist/ui/spinner.d.ts +61 -0
  174. package/dist/ui/spinner.d.ts.map +1 -0
  175. package/dist/ui/spinner.js +101 -0
  176. package/dist/ui/table.d.ts +63 -0
  177. package/dist/ui/table.d.ts.map +1 -0
  178. package/dist/ui/table.js +236 -0
  179. package/dist/utils/client.d.ts +82 -0
  180. package/dist/utils/client.d.ts.map +1 -0
  181. package/dist/utils/client.js +128 -0
  182. package/dist/utils/detect-env.d.ts +59 -0
  183. package/dist/utils/detect-env.d.ts.map +1 -0
  184. package/dist/utils/detect-env.js +115 -0
  185. package/dist/utils/exit-codes.d.ts +47 -0
  186. package/dist/utils/exit-codes.d.ts.map +1 -0
  187. package/dist/utils/exit-codes.js +61 -0
  188. package/dist/utils/logger.d.ts +87 -0
  189. package/dist/utils/logger.d.ts.map +1 -0
  190. package/dist/utils/logger.js +185 -0
  191. package/dist/utils/sanitize.d.ts +36 -0
  192. package/dist/utils/sanitize.d.ts.map +1 -0
  193. package/dist/utils/sanitize.js +64 -0
  194. package/dist/utils/validators.d.ts +41 -0
  195. package/dist/utils/validators.d.ts.map +1 -0
  196. package/dist/utils/validators.js +123 -0
  197. package/package.json +63 -0
  198. package/schemas/vertaaux.config.schema.json +103 -0
@@ -0,0 +1,393 @@
1
+ /**
2
+ * GitHub Actions workflow template generator.
3
+ *
4
+ * Generates production-ready GitHub Actions workflows for VertaaUX integration
5
+ * with SARIF upload for Code Scanning, artifact storage, and PR comments.
6
+ *
7
+ * @see https://docs.github.com/en/actions
8
+ * @see https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning
9
+ */
10
+ /**
11
+ * Default workflow options.
12
+ */
13
+ const DEFAULT_OPTIONS = {
14
+ auditUrl: "",
15
+ failOn: "error",
16
+ threshold: 0,
17
+ uploadSarif: true,
18
+ uploadArtifacts: true,
19
+ postComment: true,
20
+ nodeVersion: "20",
21
+ enableCaching: true,
22
+ monorepo: false,
23
+ };
24
+ /**
25
+ * Generate a production-ready GitHub Actions workflow for VertaaUX.
26
+ *
27
+ * Features:
28
+ * - Triggers on pull_request and push to main/master
29
+ * - SARIF upload for inline Code Scanning annotations
30
+ * - HTML report and artifact upload
31
+ * - PR comment with results summary using sticky comments
32
+ * - Proper exit code handling for CI gating
33
+ *
34
+ * @param options - Workflow generation options
35
+ * @returns YAML workflow content
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const workflow = generateGitHubActionsWorkflow({
40
+ * auditUrl: 'https://example.com',
41
+ * failOn: 'warning',
42
+ * uploadSarif: true,
43
+ * postComment: true,
44
+ * });
45
+ * ```
46
+ */
47
+ export function generateGitHubActionsWorkflow(options = {}) {
48
+ const opts = { ...DEFAULT_OPTIONS, ...options };
49
+ // Build audit command with options
50
+ const auditParts = ["vertaa audit"];
51
+ if (opts.auditUrl) {
52
+ auditParts.push(`"${opts.auditUrl}"`);
53
+ }
54
+ if (opts.failOn && opts.failOn !== "none") {
55
+ auditParts.push(`--fail-on ${opts.failOn}`);
56
+ }
57
+ if (opts.threshold > 0) {
58
+ auditParts.push(`--threshold ${opts.threshold}`);
59
+ }
60
+ const auditCommand = auditParts.join(" ");
61
+ // Build the YAML workflow
62
+ // Note: Using \${{ }} to escape GitHub Actions expressions
63
+ const yaml = `# VertaaUX Accessibility & UX Audit
64
+ # https://vertaaux.ai
65
+ #
66
+ # This workflow runs VertaaUX audits on pull requests and pushes,
67
+ # uploading results to GitHub Code Scanning and posting PR comments.
68
+
69
+ name: VertaaUX Audit
70
+
71
+ on:
72
+ pull_request:
73
+ branches: [main, master]
74
+ push:
75
+ branches: [main, master]
76
+
77
+ permissions:
78
+ contents: read
79
+ pull-requests: write
80
+ security-events: write
81
+
82
+ jobs:
83
+ audit:
84
+ runs-on: ubuntu-latest
85
+ steps:
86
+ - name: Checkout code
87
+ uses: actions/checkout@v4
88
+
89
+ - name: Setup Node.js
90
+ uses: actions/setup-node@v4
91
+ with:
92
+ node-version: '${opts.nodeVersion}'
93
+ cache: 'npm'
94
+ ${opts.enableCaching
95
+ ? `
96
+ # Cache node_modules for faster installs
97
+ - name: Cache node_modules
98
+ uses: actions/cache@v4
99
+ with:
100
+ path: node_modules
101
+ key: npm-\${{ runner.os }}-\${{ hashFiles('package-lock.json', 'yarn.lock', 'pnpm-lock.yaml') }}
102
+ restore-keys: |
103
+ npm-\${{ runner.os }}-
104
+
105
+ # Cache Playwright browsers (if used)
106
+ - name: Get Playwright version
107
+ id: playwright-version
108
+ run: echo "version=$(npm show playwright version 2>/dev/null || echo 'none')" >> $GITHUB_OUTPUT
109
+
110
+ - name: Cache Playwright browsers
111
+ if: steps.playwright-version.outputs.version != 'none'
112
+ uses: actions/cache@v4
113
+ with:
114
+ path: ~/.cache/ms-playwright
115
+ key: playwright-\${{ runner.os }}-\${{ steps.playwright-version.outputs.version }}
116
+
117
+ # Cache VertaaUX route results for incremental audits
118
+ - name: Cache VertaaUX results
119
+ uses: actions/cache@v4
120
+ with:
121
+ path: .vertaaux/route-cache.json
122
+ key: vertaaux-routes-\${{ github.sha }}
123
+ restore-keys: |
124
+ vertaaux-routes-
125
+ `
126
+ : ""}
127
+ - name: Install VertaaUX CLI
128
+ run: npm install -g @vertaaux/cli
129
+
130
+ - name: Run Audit
131
+ id: audit
132
+ continue-on-error: true
133
+ env:
134
+ VERTAAUX_API_KEY: \${{ secrets.VERTAAUX_API_KEY }}
135
+ run: |
136
+ # Run audit with SARIF output
137
+ ${auditCommand} --format sarif --output results.sarif
138
+ AUDIT_EXIT_CODE=$?
139
+ echo "exit_code=$AUDIT_EXIT_CODE" >> $GITHUB_OUTPUT
140
+
141
+ # Generate HTML report
142
+ ${auditCommand} --format html --output vertaaux-report.html
143
+
144
+ # Generate JSON for comment generation
145
+ ${auditCommand} --format json --output results.json
146
+
147
+ exit 0 # Don't fail yet, we want to upload artifacts first
148
+ ${opts.uploadSarif
149
+ ? `
150
+ - name: Upload SARIF to GitHub Code Scanning
151
+ uses: github/codeql-action/upload-sarif@v3
152
+ if: always()
153
+ with:
154
+ sarif_file: results.sarif
155
+ category: vertaaux
156
+ `
157
+ : ""}${opts.uploadArtifacts
158
+ ? `
159
+ - name: Upload Audit Artifacts
160
+ uses: actions/upload-artifact@v4
161
+ if: always()
162
+ with:
163
+ name: vertaaux-report
164
+ path: |
165
+ results.sarif
166
+ results.json
167
+ vertaaux-report.html
168
+ retention-days: 30
169
+ `
170
+ : ""}${opts.postComment
171
+ ? `
172
+ - name: Generate PR Comment
173
+ if: github.event_name == 'pull_request'
174
+ env:
175
+ VERTAAUX_API_KEY: \${{ secrets.VERTAAUX_API_KEY }}
176
+ run: |
177
+ vertaa comment --input results.json --format markdown > comment.md
178
+
179
+ - name: Post PR Comment
180
+ uses: marocchino/sticky-pull-request-comment@v2
181
+ if: github.event_name == 'pull_request'
182
+ with:
183
+ header: vertaaux-audit
184
+ path: comment.md
185
+ `
186
+ : ""}
187
+ - name: Check Audit Result
188
+ if: always()
189
+ run: |
190
+ if [ "\${{ steps.audit.outputs.exit_code }}" != "0" ]; then
191
+ echo "Audit found issues that exceed the configured threshold"
192
+ exit \${{ steps.audit.outputs.exit_code }}
193
+ fi
194
+ `;
195
+ return yaml;
196
+ }
197
+ /**
198
+ * Generate a minimal GitHub Actions workflow (basic SARIF upload only).
199
+ *
200
+ * @returns YAML workflow content
201
+ */
202
+ export function generateMinimalWorkflow() {
203
+ return generateGitHubActionsWorkflow({
204
+ uploadSarif: true,
205
+ uploadArtifacts: false,
206
+ postComment: false,
207
+ });
208
+ }
209
+ /**
210
+ * Generate a monorepo-aware GitHub Actions workflow.
211
+ *
212
+ * This workflow first detects all auditable apps in the monorepo,
213
+ * then runs audits in parallel using a matrix strategy.
214
+ *
215
+ * @param options - Workflow generation options
216
+ * @returns YAML workflow content
217
+ *
218
+ * @example
219
+ * ```typescript
220
+ * const workflow = generateMonorepoWorkflow({
221
+ * failOn: 'warning',
222
+ * uploadSarif: true,
223
+ * });
224
+ * ```
225
+ */
226
+ export function generateMonorepoWorkflow(options = {}) {
227
+ const opts = { ...DEFAULT_OPTIONS, ...options, monorepo: true };
228
+ return `# VertaaUX Monorepo Audit
229
+ # https://vertaaux.ai
230
+ #
231
+ # This workflow detects all apps in your monorepo and audits them in parallel.
232
+
233
+ name: VertaaUX Monorepo Audit
234
+
235
+ on:
236
+ pull_request:
237
+ branches: [main, master]
238
+ push:
239
+ branches: [main, master]
240
+
241
+ permissions:
242
+ contents: read
243
+ pull-requests: write
244
+ security-events: write
245
+
246
+ jobs:
247
+ detect-apps:
248
+ name: Detect Auditable Apps
249
+ runs-on: ubuntu-latest
250
+ outputs:
251
+ matrix: \${{ steps.detect.outputs.matrix }}
252
+ has_apps: \${{ steps.detect.outputs.has_apps }}
253
+ steps:
254
+ - name: Checkout code
255
+ uses: actions/checkout@v4
256
+
257
+ - name: Setup Node.js
258
+ uses: actions/setup-node@v4
259
+ with:
260
+ node-version: '${opts.nodeVersion}'
261
+
262
+ - name: Install VertaaUX CLI
263
+ run: npm install -g @vertaaux/cli
264
+
265
+ - name: Detect monorepo apps
266
+ id: detect
267
+ run: |
268
+ MATRIX=$(vertaa audit --detect-matrix --json)
269
+ echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
270
+ # Check if matrix has any apps
271
+ APP_COUNT=$(echo "$MATRIX" | jq '.include | length')
272
+ if [ "$APP_COUNT" -gt 0 ]; then
273
+ echo "has_apps=true" >> $GITHUB_OUTPUT
274
+ else
275
+ echo "has_apps=false" >> $GITHUB_OUTPUT
276
+ fi
277
+ echo "Detected $APP_COUNT auditable apps"
278
+
279
+ audit:
280
+ name: Audit \${{ matrix.name }}
281
+ needs: detect-apps
282
+ if: needs.detect-apps.outputs.has_apps == 'true'
283
+ runs-on: ubuntu-latest
284
+ strategy:
285
+ fail-fast: false
286
+ matrix: \${{ fromJson(needs.detect-apps.outputs.matrix) }}
287
+ steps:
288
+ - name: Checkout code
289
+ uses: actions/checkout@v4
290
+
291
+ - name: Setup Node.js
292
+ uses: actions/setup-node@v4
293
+ with:
294
+ node-version: '${opts.nodeVersion}'
295
+ cache: 'npm'
296
+ ${opts.enableCaching
297
+ ? `
298
+ - name: Cache node_modules
299
+ uses: actions/cache@v4
300
+ with:
301
+ path: node_modules
302
+ key: npm-\${{ runner.os }}-\${{ hashFiles('package-lock.json') }}
303
+ restore-keys: |
304
+ npm-\${{ runner.os }}-
305
+
306
+ - name: Cache VertaaUX results
307
+ uses: actions/cache@v4
308
+ with:
309
+ path: .vertaaux/route-cache.json
310
+ key: vertaaux-\${{ matrix.name }}-\${{ github.sha }}
311
+ restore-keys: |
312
+ vertaaux-\${{ matrix.name }}-
313
+ `
314
+ : ""}
315
+ - name: Install dependencies
316
+ run: npm ci
317
+
318
+ - name: Install VertaaUX CLI
319
+ run: npm install -g @vertaaux/cli
320
+
321
+ - name: Run Audit for \${{ matrix.name }}
322
+ id: audit
323
+ continue-on-error: true
324
+ env:
325
+ VERTAAUX_API_KEY: \${{ secrets.VERTAAUX_API_KEY }}
326
+ run: |
327
+ vertaa audit --workspace \${{ matrix.name }} ${opts.failOn !== "none" ? `--fail-on ${opts.failOn}` : ""} \\
328
+ --format sarif --output results-\${{ matrix.name }}.sarif
329
+ AUDIT_EXIT_CODE=$?
330
+ echo "exit_code=$AUDIT_EXIT_CODE" >> $GITHUB_OUTPUT
331
+
332
+ # Generate JSON for aggregation
333
+ vertaa audit --workspace \${{ matrix.name }} --format json --output results-\${{ matrix.name }}.json
334
+
335
+ exit 0
336
+ ${opts.uploadSarif
337
+ ? `
338
+ - name: Upload SARIF
339
+ uses: github/codeql-action/upload-sarif@v3
340
+ if: always()
341
+ with:
342
+ sarif_file: results-\${{ matrix.name }}.sarif
343
+ category: vertaaux-\${{ matrix.name }}
344
+ `
345
+ : ""}${opts.uploadArtifacts
346
+ ? `
347
+ - name: Upload Artifacts
348
+ uses: actions/upload-artifact@v4
349
+ if: always()
350
+ with:
351
+ name: vertaaux-\${{ matrix.name }}
352
+ path: |
353
+ results-\${{ matrix.name }}.sarif
354
+ results-\${{ matrix.name }}.json
355
+ retention-days: 30
356
+ `
357
+ : ""}
358
+ - name: Check Audit Result
359
+ if: always()
360
+ run: |
361
+ if [ "\${{ steps.audit.outputs.exit_code }}" != "0" ]; then
362
+ echo "Audit for \${{ matrix.name }} found issues"
363
+ exit \${{ steps.audit.outputs.exit_code }}
364
+ fi
365
+
366
+ summary:
367
+ name: Aggregate Results
368
+ needs: [detect-apps, audit]
369
+ if: always() && needs.detect-apps.outputs.has_apps == 'true'
370
+ runs-on: ubuntu-latest
371
+ steps:
372
+ - name: Checkout code
373
+ uses: actions/checkout@v4
374
+
375
+ - name: Download all artifacts
376
+ uses: actions/download-artifact@v4
377
+ with:
378
+ pattern: vertaaux-*
379
+ merge-multiple: true
380
+
381
+ - name: Summarize results
382
+ run: |
383
+ echo "## VertaaUX Audit Summary" >> $GITHUB_STEP_SUMMARY
384
+ echo "" >> $GITHUB_STEP_SUMMARY
385
+ for file in results-*.json; do
386
+ if [ -f "$file" ]; then
387
+ APP=$(echo "$file" | sed 's/results-//' | sed 's/.json//')
388
+ ISSUES=$(jq '.issues | length // 0' "$file" 2>/dev/null || echo "0")
389
+ echo "- **$APP**: $ISSUES issues" >> $GITHUB_STEP_SUMMARY
390
+ fi
391
+ done
392
+ `;
393
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * GitLab CI template generator for VertaaUX.
3
+ *
4
+ * Generates .gitlab-ci.yml configuration with native GitLab integrations:
5
+ * - JUnit reports for test results integration
6
+ * - Code Quality reports for merge request widget
7
+ * - HTML report as artifact
8
+ *
9
+ * @see https://docs.gitlab.com/ci/yaml/artifacts_reports/
10
+ */
11
+ export interface GitLabOptions {
12
+ /** URL to audit (optional, can be set in config) */
13
+ auditUrl?: string;
14
+ /** Severity threshold for CI failure */
15
+ failOn?: "error" | "warning" | "info" | "none";
16
+ /** Minimum score threshold (0 = disabled) */
17
+ threshold?: number;
18
+ }
19
+ /**
20
+ * Generate GitLab CI template for VertaaUX integration.
21
+ *
22
+ * @param options - Configuration options
23
+ * @returns YAML template content
24
+ */
25
+ export declare function generateGitLabCITemplate(options?: GitLabOptions): string;
26
+ //# sourceMappingURL=gitlab-ci.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-ci.d.ts","sourceRoot":"","sources":["../../src/templates/gitlab-ci.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,aAAa;IAC5B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/C,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,CAwD5E"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * GitLab CI template generator for VertaaUX.
3
+ *
4
+ * Generates .gitlab-ci.yml configuration with native GitLab integrations:
5
+ * - JUnit reports for test results integration
6
+ * - Code Quality reports for merge request widget
7
+ * - HTML report as artifact
8
+ *
9
+ * @see https://docs.gitlab.com/ci/yaml/artifacts_reports/
10
+ */
11
+ /**
12
+ * Generate GitLab CI template for VertaaUX integration.
13
+ *
14
+ * @param options - Configuration options
15
+ * @returns YAML template content
16
+ */
17
+ export function generateGitLabCITemplate(options = {}) {
18
+ const { auditUrl, failOn = "error", threshold } = options;
19
+ // Build audit command with options
20
+ const auditArgs = [];
21
+ if (auditUrl) {
22
+ auditArgs.push(`--url "${auditUrl}"`);
23
+ }
24
+ if (failOn !== "none") {
25
+ auditArgs.push(`--fail-on ${failOn}`);
26
+ }
27
+ if (threshold && threshold > 0) {
28
+ auditArgs.push(`--threshold ${threshold}`);
29
+ }
30
+ const auditSuffix = auditArgs.length > 0 ? ` ${auditArgs.join(" ")}` : "";
31
+ return `# VertaaUX Accessibility & UX Audit
32
+ # https://vertaaux.ai
33
+ #
34
+ # Add this to your .gitlab-ci.yml or merge into existing configuration.
35
+ # Requires VERTAAUX_API_KEY variable set in CI/CD settings.
36
+
37
+ vertaaux-audit:
38
+ image: node:20
39
+ stage: test
40
+ variables:
41
+ # Ensure npm installs globally without permission issues
42
+ npm_config_prefix: "\${CI_PROJECT_DIR}/.npm-global"
43
+ PATH: "\${CI_PROJECT_DIR}/.npm-global/bin:\${PATH}"
44
+ before_script:
45
+ - npm install -g @vertaaux/cli
46
+ script:
47
+ # Generate JUnit report for test results integration
48
+ - vertaa audit --format junit --output gl-junit.xml${auditSuffix}
49
+ # Generate Code Quality report for merge request widget
50
+ - vertaa audit --format codequality --output gl-code-quality.json${auditSuffix}
51
+ # Generate HTML report for human review
52
+ - vertaa audit --format html --output vertaaux-report.html${auditSuffix}
53
+ artifacts:
54
+ reports:
55
+ # JUnit integration - shows test results in pipeline
56
+ junit: gl-junit.xml
57
+ # Code Quality integration - shows issues in merge request widget
58
+ codequality: gl-code-quality.json
59
+ paths:
60
+ # HTML report for download
61
+ - vertaaux-report.html
62
+ when: always
63
+ expire_in: 1 week
64
+ # Only run on merge requests to avoid duplicate runs
65
+ rules:
66
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
67
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
68
+ allow_failure: true
69
+ `;
70
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * CI/CD template module barrel export.
3
+ *
4
+ * Provides unified template generation for all supported CI platforms:
5
+ * - GitHub Actions (.github/workflows/vertaa.yml)
6
+ * - GitLab CI (.gitlab-ci-vertaa.yml)
7
+ * - CircleCI (.circleci/config-vertaa.yml)
8
+ * - Azure DevOps (azure-pipelines-vertaa.yml)
9
+ * - Jenkins (Jenkinsfile-vertaa)
10
+ */
11
+ /**
12
+ * Supported CI providers.
13
+ */
14
+ export type CIProvider = "github" | "gitlab" | "circleci" | "azure" | "jenkins" | "none";
15
+ /**
16
+ * Common template generation options.
17
+ */
18
+ export interface TemplateOptions {
19
+ /** URL to audit (optional, can be set in config) */
20
+ auditUrl?: string;
21
+ /** Severity threshold for CI failure */
22
+ failOn?: "error" | "warning" | "info" | "none";
23
+ /** Minimum score threshold (0 = disabled) */
24
+ threshold?: number;
25
+ /** Upload SARIF results (GitHub only) */
26
+ uploadSarif?: boolean;
27
+ /** Upload HTML report and artifacts */
28
+ uploadArtifacts?: boolean;
29
+ /** Post PR comment with results summary (GitHub only) */
30
+ postComment?: boolean;
31
+ }
32
+ /**
33
+ * Generated template result.
34
+ */
35
+ export interface GeneratedTemplate {
36
+ /** File path relative to project root */
37
+ path: string;
38
+ /** Template content */
39
+ content: string;
40
+ /** Instructions for user (e.g., "merge into existing file") */
41
+ instructions?: string;
42
+ }
43
+ /**
44
+ * Generate CI/CD template for the specified provider.
45
+ *
46
+ * @param provider - CI provider to generate template for
47
+ * @param options - Template generation options
48
+ * @returns Generated template or null for 'none' provider
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * const template = generateTemplate('github', { failOn: 'warning' });
53
+ * if (template) {
54
+ * fs.writeFileSync(template.path, template.content);
55
+ * if (template.instructions) {
56
+ * console.log(template.instructions);
57
+ * }
58
+ * }
59
+ * ```
60
+ */
61
+ export declare function generateTemplate(provider: CIProvider, options?: TemplateOptions): GeneratedTemplate | null;
62
+ export { generateGitHubActionsWorkflow } from "./github-actions.js";
63
+ export { generateGitLabCITemplate } from "./gitlab-ci.js";
64
+ export { generateCircleCITemplate } from "./circleci.js";
65
+ export { generateAzureDevOpsTemplate } from "./azure-devops.js";
66
+ export { generateJenkinsTemplate } from "./jenkins.js";
67
+ export type { WorkflowOptions } from "./github-actions.js";
68
+ export type { GitLabOptions } from "./gitlab-ci.js";
69
+ export type { CircleCIOptions } from "./circleci.js";
70
+ export type { AzureDevOpsOptions } from "./azure-devops.js";
71
+ export type { JenkinsOptions } from "./jenkins.js";
72
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/C,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uCAAuC;IACvC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yDAAyD;IACzD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,UAAU,EACpB,OAAO,GAAE,eAAoB,GAC5B,iBAAiB,GAAG,IAAI,CA8E1B;AAGD,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGvD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * CI/CD template module barrel export.
3
+ *
4
+ * Provides unified template generation for all supported CI platforms:
5
+ * - GitHub Actions (.github/workflows/vertaa.yml)
6
+ * - GitLab CI (.gitlab-ci-vertaa.yml)
7
+ * - CircleCI (.circleci/config-vertaa.yml)
8
+ * - Azure DevOps (azure-pipelines-vertaa.yml)
9
+ * - Jenkins (Jenkinsfile-vertaa)
10
+ */
11
+ import { generateGitHubActionsWorkflow } from "./github-actions.js";
12
+ import { generateGitLabCITemplate } from "./gitlab-ci.js";
13
+ import { generateCircleCITemplate } from "./circleci.js";
14
+ import { generateAzureDevOpsTemplate } from "./azure-devops.js";
15
+ import { generateJenkinsTemplate } from "./jenkins.js";
16
+ /**
17
+ * Generate CI/CD template for the specified provider.
18
+ *
19
+ * @param provider - CI provider to generate template for
20
+ * @param options - Template generation options
21
+ * @returns Generated template or null for 'none' provider
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const template = generateTemplate('github', { failOn: 'warning' });
26
+ * if (template) {
27
+ * fs.writeFileSync(template.path, template.content);
28
+ * if (template.instructions) {
29
+ * console.log(template.instructions);
30
+ * }
31
+ * }
32
+ * ```
33
+ */
34
+ export function generateTemplate(provider, options = {}) {
35
+ switch (provider) {
36
+ case "github": {
37
+ const workflowOptions = {
38
+ auditUrl: options.auditUrl,
39
+ failOn: options.failOn,
40
+ threshold: options.threshold,
41
+ uploadSarif: options.uploadSarif ?? true,
42
+ uploadArtifacts: options.uploadArtifacts ?? true,
43
+ postComment: options.postComment ?? true,
44
+ };
45
+ return {
46
+ path: ".github/workflows/vertaa.yml",
47
+ content: generateGitHubActionsWorkflow(workflowOptions),
48
+ };
49
+ }
50
+ case "gitlab": {
51
+ const gitlabOptions = {
52
+ auditUrl: options.auditUrl,
53
+ failOn: options.failOn,
54
+ threshold: options.threshold,
55
+ };
56
+ return {
57
+ path: ".gitlab-ci-vertaa.yml",
58
+ content: generateGitLabCITemplate(gitlabOptions),
59
+ instructions: "Merge the contents of .gitlab-ci-vertaa.yml into your .gitlab-ci.yml",
60
+ };
61
+ }
62
+ case "circleci": {
63
+ const circleOptions = {
64
+ auditUrl: options.auditUrl,
65
+ failOn: options.failOn,
66
+ threshold: options.threshold,
67
+ };
68
+ return {
69
+ path: ".circleci/config-vertaa.yml",
70
+ content: generateCircleCITemplate(circleOptions),
71
+ instructions: "Merge the contents of .circleci/config-vertaa.yml into your .circleci/config.yml",
72
+ };
73
+ }
74
+ case "azure": {
75
+ const azureOptions = {
76
+ auditUrl: options.auditUrl,
77
+ failOn: options.failOn,
78
+ threshold: options.threshold,
79
+ };
80
+ return {
81
+ path: "azure-pipelines-vertaa.yml",
82
+ content: generateAzureDevOpsTemplate(azureOptions),
83
+ instructions: "Merge into azure-pipelines.yml or use as standalone pipeline",
84
+ };
85
+ }
86
+ case "jenkins": {
87
+ const jenkinsOptions = {
88
+ auditUrl: options.auditUrl,
89
+ failOn: options.failOn,
90
+ threshold: options.threshold,
91
+ };
92
+ return {
93
+ path: "Jenkinsfile-vertaa",
94
+ content: generateJenkinsTemplate(jenkinsOptions),
95
+ instructions: "Merge into Jenkinsfile or rename to Jenkinsfile for standalone use",
96
+ };
97
+ }
98
+ case "none":
99
+ return null;
100
+ default: {
101
+ // Type exhaustiveness check
102
+ const _exhaustive = provider;
103
+ return _exhaustive;
104
+ }
105
+ }
106
+ }
107
+ // Re-export individual generators for direct use
108
+ export { generateGitHubActionsWorkflow } from "./github-actions.js";
109
+ export { generateGitLabCITemplate } from "./gitlab-ci.js";
110
+ export { generateCircleCITemplate } from "./circleci.js";
111
+ export { generateAzureDevOpsTemplate } from "./azure-devops.js";
112
+ export { generateJenkinsTemplate } from "./jenkins.js";