@open-mercato/cli 0.10.1-develop.7600.1.57704c3ffb → 0.10.1-develop.7614.1.75d5ac1a6a

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 (101) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/agentic/guides/module-facts.json +152 -152
  3. package/dist/agentic/guides/module-facts.v2.json +152 -152
  4. package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
  5. package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
  6. package/dist/agentic/guides/modules/api_docs/index.md +1 -1
  7. package/dist/agentic/guides/modules/api_keys/index.md +1 -1
  8. package/dist/agentic/guides/modules/attachments/index.md +1 -1
  9. package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
  10. package/dist/agentic/guides/modules/auth/index.md +1 -1
  11. package/dist/agentic/guides/modules/availability/index.md +1 -1
  12. package/dist/agentic/guides/modules/business_rules/index.md +1 -1
  13. package/dist/agentic/guides/modules/catalog/index.md +1 -1
  14. package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
  15. package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
  16. package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
  17. package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
  18. package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
  19. package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
  20. package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
  21. package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
  22. package/dist/agentic/guides/modules/checkout/index.md +1 -1
  23. package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
  24. package/dist/agentic/guides/modules/configs/index.md +1 -1
  25. package/dist/agentic/guides/modules/content/index.md +1 -1
  26. package/dist/agentic/guides/modules/currencies/index.md +1 -1
  27. package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
  28. package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
  29. package/dist/agentic/guides/modules/customers/index.md +1 -1
  30. package/dist/agentic/guides/modules/dashboards/index.md +1 -1
  31. package/dist/agentic/guides/modules/data_sync/index.md +1 -1
  32. package/dist/agentic/guides/modules/design_system/index.md +1 -1
  33. package/dist/agentic/guides/modules/devices/index.md +1 -1
  34. package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
  35. package/dist/agentic/guides/modules/directory/index.md +1 -1
  36. package/dist/agentic/guides/modules/documents/index.md +1 -1
  37. package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
  38. package/dist/agentic/guides/modules/entities/index.md +1 -1
  39. package/dist/agentic/guides/modules/eudr/index.md +1 -1
  40. package/dist/agentic/guides/modules/events/index.md +1 -1
  41. package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
  42. package/dist/agentic/guides/modules/forms/index.md +1 -1
  43. package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
  44. package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
  45. package/dist/agentic/guides/modules/generators/index.md +1 -1
  46. package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
  47. package/dist/agentic/guides/modules/integrations/index.md +1 -1
  48. package/dist/agentic/guides/modules/messages/index.md +1 -1
  49. package/dist/agentic/guides/modules/notifications/index.md +1 -1
  50. package/dist/agentic/guides/modules/onboarding/index.md +1 -1
  51. package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
  52. package/dist/agentic/guides/modules/perspectives/index.md +1 -1
  53. package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
  54. package/dist/agentic/guides/modules/planner/index.md +1 -1
  55. package/dist/agentic/guides/modules/portal/index.md +1 -1
  56. package/dist/agentic/guides/modules/progress/index.md +1 -1
  57. package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
  58. package/dist/agentic/guides/modules/query_index/index.md +1 -1
  59. package/dist/agentic/guides/modules/record_locks/index.md +1 -1
  60. package/dist/agentic/guides/modules/resources/index.md +1 -1
  61. package/dist/agentic/guides/modules/sales/index.md +1 -1
  62. package/dist/agentic/guides/modules/scheduler/index.md +1 -1
  63. package/dist/agentic/guides/modules/search/index.md +1 -1
  64. package/dist/agentic/guides/modules/security/index.md +1 -1
  65. package/dist/agentic/guides/modules/seeds/index.md +1 -1
  66. package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
  67. package/dist/agentic/guides/modules/sso/index.md +1 -1
  68. package/dist/agentic/guides/modules/staff/index.md +1 -1
  69. package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
  70. package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
  71. package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
  72. package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
  73. package/dist/agentic/guides/modules/telemetry/index.md +1 -1
  74. package/dist/agentic/guides/modules/tillio/index.md +1 -1
  75. package/dist/agentic/guides/modules/translations/index.md +1 -1
  76. package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
  77. package/dist/agentic/guides/modules/webhooks/index.md +1 -1
  78. package/dist/agentic/guides/modules/wms/index.md +1 -1
  79. package/dist/agentic/guides/modules/workflows/index.md +1 -1
  80. package/dist/agentic/guides/reference-module-facts.json +1 -1
  81. package/dist/agentic/guides/upstream/manifest.json +1 -1
  82. package/dist/agentic/shared/ai/skills/om-setup-ci/SKILL.md +42 -0
  83. package/dist/agentic/shared/ai/skills/om-setup-ci/scripts/setup-ci.mjs +525 -0
  84. package/dist/agentic/shared/ai/skills/om-setup-ci/scripts/verify-semgrep-rules.mjs +54 -0
  85. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/docs/README.md +463 -0
  86. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/gitleaks/action.yml +25 -0
  87. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/playwright/action.yml +31 -0
  88. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/actions/setup/action.yml +55 -0
  89. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/dependabot.yml +27 -0
  90. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/audit.yml +193 -0
  91. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/ci.yml +477 -0
  92. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/codeql.yml +63 -0
  93. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/github/workflows/security.yml +254 -0
  94. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/audit-ci-allowlist.json +4 -0
  95. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/audit-ci.mjs +283 -0
  96. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/semgrep/open-mercato.fixture.txt +89 -0
  97. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/semgrep/open-mercato.yml +146 -0
  98. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/time-bomb-scanner.mjs +286 -0
  99. package/dist/agentic/shared/ai/skills/om-setup-ci/templates/scripts/ci/zap-rules.tsv +11 -0
  100. package/dist/agentic/shared/ai/skills/tiers.json +2 -1
  101. package/package.json +7 -7
@@ -0,0 +1,193 @@
1
+ # Generated by the Open Mercato om-setup-ci skill. Documentation: docs/ci/README.md
2
+ #
3
+ # The pull-request audit in ci.yml blocks only advisories a change introduces.
4
+ # This nightly job audits every protected branch WITHOUT a baseline, so an
5
+ # advisory published after a dependency was merged is still caught. It keeps
6
+ # one tracking issue per branch open while advisories exist and closes it on
7
+ # the first clean run.
8
+ name: Scheduled Dependency Audit
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ env:
14
+ FORCE_COLOR: '0'
15
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
16
+
17
+ on:
18
+ schedule:
19
+ - cron: '__OM_AUDIT_CRON__'
20
+ workflow_dispatch:
21
+
22
+ concurrency:
23
+ group: scheduled-dependency-audit
24
+ cancel-in-progress: false
25
+
26
+ jobs:
27
+ audit:
28
+ name: Audit ${{ matrix.branch }}
29
+ runs-on: __OM_RUNNER__
30
+ timeout-minutes: 15
31
+ permissions:
32
+ contents: read
33
+ issues: write
34
+ strategy:
35
+ fail-fast: false
36
+ matrix:
37
+ branch: [__OM_BRANCH_MATRIX__]
38
+ steps:
39
+ - name: Checkout ${{ matrix.branch }}
40
+ uses: __OM_ACTION_CHECKOUT__
41
+ with:
42
+ ref: ${{ matrix.branch }}
43
+ persist-credentials: false
44
+
45
+ - name: Setup Node.js
46
+ uses: __OM_ACTION_SETUP_NODE__
47
+ with:
48
+ #@if nodeVersionFile
49
+ node-version-file: __OM_NODE_VERSION_FILE__
50
+ #@endif
51
+ #@if !nodeVersionFile
52
+ node-version: '__OM_NODE_VERSION__'
53
+ #@endif
54
+
55
+ - name: Audit dependencies for known CVEs
56
+ id: audit
57
+ continue-on-error: true
58
+ shell: bash
59
+ run: |
60
+ set -o pipefail
61
+ node scripts/ci/audit-ci.mjs --severity __OM_AUDIT_SEVERITY__ 2>&1 | tee audit.log
62
+
63
+ - name: Publish job summary
64
+ if: always()
65
+ shell: bash
66
+ env:
67
+ BRANCH: ${{ matrix.branch }}
68
+ OUTCOME: ${{ steps.audit.outcome }}
69
+ run: |
70
+ {
71
+ echo "### Dependency audit (\`__OM_AUDIT_SEVERITY__\`+) — \`$BRANCH\`"
72
+ echo
73
+ if [ "$OUTCOME" = "success" ]; then
74
+ echo "No advisories at severity \`__OM_AUDIT_SEVERITY__\` or above."
75
+ else
76
+ echo '```text'
77
+ cat audit.log 2>/dev/null || echo "(no audit output captured)"
78
+ echo '```'
79
+ fi
80
+ } >> "$GITHUB_STEP_SUMMARY"
81
+
82
+ - name: Open or refresh tracking issue
83
+ if: steps.audit.outcome == 'failure'
84
+ uses: __OM_ACTION_GITHUB_SCRIPT__
85
+ env:
86
+ BRANCH: ${{ matrix.branch }}
87
+ with:
88
+ script: |
89
+ const fs = require('fs')
90
+ const branch = process.env.BRANCH
91
+ const marker = `<!-- scheduled-dependency-audit:${branch} -->`
92
+ const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
93
+
94
+ let report = ''
95
+ try {
96
+ report = fs.readFileSync('audit.log', 'utf8')
97
+ } catch {
98
+ report = '(no audit output captured)'
99
+ }
100
+ report = report.replace(/\u001b\[[0-9;]*m/g, '').trim()
101
+ const maxReportLength = 40000
102
+ if (report.length > maxReportLength) {
103
+ report = `${report.slice(0, maxReportLength)}\n… truncated, see the workflow run for the full report …`
104
+ }
105
+
106
+ const reportBlock = ['<!-- report:start -->', '```text', report, '```', '<!-- report:end -->'].join('\n')
107
+ const body = [
108
+ marker,
109
+ `The scheduled dependency audit is failing on \`${branch}\`.`,
110
+ '',
111
+ 'Opened and refreshed automatically by `.github/workflows/audit.yml`; it closes itself on the first run where the audit passes again.',
112
+ 'Resolve it by upgrading the affected dependencies, or — only when no patched release exists — by adding a justified entry to `scripts/ci/audit-ci-allowlist.json`. See `docs/ci/README.md`.',
113
+ '',
114
+ `- Branch: \`${branch}\``,
115
+ `- Last checked: ${runUrl}`,
116
+ '',
117
+ reportBlock,
118
+ ].join('\n')
119
+
120
+ const extractReport = (text) => {
121
+ const match = /<!-- report:start -->([\s\S]*?)<!-- report:end -->/.exec(text ?? '')
122
+ return match ? match[1].trim() : null
123
+ }
124
+
125
+ const openIssues = await github.paginate(github.rest.issues.listForRepo, {
126
+ ...context.repo,
127
+ state: 'open',
128
+ labels: 'security,dependencies',
129
+ per_page: 100,
130
+ })
131
+ const existing = openIssues.find((issue) => !issue.pull_request && (issue.body ?? '').includes(marker))
132
+
133
+ if (!existing) {
134
+ const created = await github.rest.issues.create({
135
+ ...context.repo,
136
+ title: `security: dependency advisories on \`${branch}\``,
137
+ body,
138
+ labels: ['security', 'dependencies'],
139
+ })
140
+ core.notice(`Opened tracking issue #${created.data.number} for ${branch}.`)
141
+ return
142
+ }
143
+
144
+ const advisoriesChanged = extractReport(existing.body) !== extractReport(body)
145
+ await github.rest.issues.update({ ...context.repo, issue_number: existing.number, body })
146
+ if (advisoriesChanged) {
147
+ await github.rest.issues.createComment({
148
+ ...context.repo,
149
+ issue_number: existing.number,
150
+ body: `The advisory set on \`${branch}\` changed. Refreshed from ${runUrl}.`,
151
+ })
152
+ }
153
+ core.notice(`Refreshed tracking issue #${existing.number} for ${branch}.`)
154
+
155
+ - name: Close tracking issue
156
+ if: steps.audit.outcome == 'success'
157
+ uses: __OM_ACTION_GITHUB_SCRIPT__
158
+ env:
159
+ BRANCH: ${{ matrix.branch }}
160
+ with:
161
+ script: |
162
+ const branch = process.env.BRANCH
163
+ const marker = `<!-- scheduled-dependency-audit:${branch} -->`
164
+ const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
165
+
166
+ const openIssues = await github.paginate(github.rest.issues.listForRepo, {
167
+ ...context.repo,
168
+ state: 'open',
169
+ labels: 'security,dependencies',
170
+ per_page: 100,
171
+ })
172
+ const existing = openIssues.find((issue) => !issue.pull_request && (issue.body ?? '').includes(marker))
173
+ if (!existing) return
174
+
175
+ await github.rest.issues.createComment({
176
+ ...context.repo,
177
+ issue_number: existing.number,
178
+ body: `The dependency audit passes again on \`${branch}\`. Closed from ${runUrl}.`,
179
+ })
180
+ await github.rest.issues.update({
181
+ ...context.repo,
182
+ issue_number: existing.number,
183
+ state: 'closed',
184
+ state_reason: 'completed',
185
+ })
186
+
187
+ - name: Fail the job when advisories were found
188
+ if: steps.audit.outcome == 'failure'
189
+ env:
190
+ BRANCH: ${{ matrix.branch }}
191
+ run: |
192
+ echo "::error::The dependency audit reported non-allowlisted advisories at severity __OM_AUDIT_SEVERITY__ or above on $BRANCH."
193
+ exit 1
@@ -0,0 +1,477 @@
1
+ # Generated by the Open Mercato om-setup-ci skill. Documentation: docs/ci/README.md
2
+ # Regenerate with: node .ai/skills/om-setup-ci/scripts/setup-ci.mjs --force
3
+ #
4
+ # Branch protection: require the single `CI` check. It aggregates every job
5
+ # below, so adding or removing a job never needs a branch-protection change.
6
+ name: CI
7
+
8
+ on:
9
+ push:
10
+ branches:
11
+ __OM_BRANCH_LIST__
12
+ pull_request:
13
+ branches:
14
+ __OM_BRANCH_LIST__
15
+ workflow_dispatch:
16
+
17
+ permissions:
18
+ contents: read
19
+
20
+ # A new push to a pull request cancels its previous run. Pushes to protected
21
+ # branches always run to completion so every merged commit has a verdict.
22
+ concurrency:
23
+ group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
24
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
25
+
26
+ env:
27
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
28
+ NEXT_TELEMETRY_DISABLED: '1'
29
+
30
+ jobs:
31
+ # ── Change detection ────────────────────────────────────────────────────────
32
+ # Decides which conditional jobs run and which commit is the "before" state
33
+ # that the audit, secret scan and SAST compare against: the base of a pull
34
+ # request, or the previous tip of a pushed branch.
35
+ changes:
36
+ name: Detect changes
37
+ runs-on: __OM_RUNNER__
38
+ timeout-minutes: 5
39
+ outputs:
40
+ base: ${{ steps.diff.outputs.base }}
41
+ dependencies: ${{ steps.diff.outputs.dependencies }}
42
+ docker: ${{ steps.diff.outputs.docker }}
43
+ workflows: ${{ steps.diff.outputs.workflows }}
44
+ steps:
45
+ - name: Checkout repository
46
+ uses: __OM_ACTION_CHECKOUT__
47
+ with:
48
+ fetch-depth: 0
49
+ persist-credentials: false
50
+
51
+ - name: Classify changed files
52
+ id: diff
53
+ shell: bash
54
+ env:
55
+ EVENT_NAME: ${{ github.event_name }}
56
+ PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
57
+ PUSH_BEFORE_SHA: ${{ github.event.before }}
58
+ run: |
59
+ set -euo pipefail
60
+ BASE=""
61
+ if [ "$EVENT_NAME" = "pull_request" ]; then
62
+ BASE="$PR_BASE_SHA"
63
+ elif [ -n "$PUSH_BEFORE_SHA" ] && ! [[ "$PUSH_BEFORE_SHA" =~ ^0+$ ]] && git cat-file -e "$PUSH_BEFORE_SHA^{commit}" 2>/dev/null; then
64
+ BASE="$PUSH_BEFORE_SHA"
65
+ fi
66
+ if [ -n "$BASE" ]; then
67
+ CHANGED=$(git diff --name-only "$BASE" HEAD)
68
+ else
69
+ CHANGED=$(git diff-tree --no-commit-id --name-only -r HEAD)
70
+ fi
71
+ echo "base=$BASE" >> "$GITHUB_OUTPUT"
72
+ printf 'Compared with: %s\nChanged files:\n%s\n' "${BASE:-<none, first push>}" "$CHANGED"
73
+
74
+ classify() {
75
+ if printf '%s\n' "$CHANGED" | grep -Eq "$2"; then
76
+ echo "$1=true" >> "$GITHUB_OUTPUT"
77
+ else
78
+ echo "$1=false" >> "$GITHUB_OUTPUT"
79
+ fi
80
+ }
81
+ classify dependencies '(^|/)(package\.json|yarn\.lock|\.yarnrc\.yml)$|^scripts/ci/audit-ci'
82
+ classify docker '^(Dockerfile|\.dockerignore|\.trivyignore|docker/|package\.json$|yarn\.lock$|\.yarnrc\.yml$|next\.config\.)'
83
+ classify workflows '^\.github/'
84
+
85
+ # ── Dependency audit (SCA) ──────────────────────────────────────────────────
86
+ # Runs only when dependencies change, and fails only on advisories the change
87
+ # INTRODUCES (compared with the base lockfile). Advisories already present on
88
+ # the base branch are owned by the nightly .github/workflows/audit.yml, which
89
+ # keeps a tracking issue open until they are fixed.
90
+ audit:
91
+ name: Dependency audit
92
+ needs: changes
93
+ if: needs.changes.outputs.dependencies == 'true'
94
+ runs-on: __OM_RUNNER__
95
+ timeout-minutes: 10
96
+ steps:
97
+ - name: Checkout repository
98
+ uses: __OM_ACTION_CHECKOUT__
99
+ with:
100
+ fetch-depth: 0
101
+ persist-credentials: false
102
+
103
+ - name: Setup Node.js
104
+ uses: __OM_ACTION_SETUP_NODE__
105
+ with:
106
+ #@if nodeVersionFile
107
+ node-version-file: __OM_NODE_VERSION_FILE__
108
+ #@endif
109
+ #@if !nodeVersionFile
110
+ node-version: '__OM_NODE_VERSION__'
111
+ #@endif
112
+
113
+ # The audit reads yarn.lock and queries the npm advisory database directly,
114
+ # so it needs no `yarn install`. It fails closed when advisory data cannot
115
+ # be fetched. Justified exceptions live in scripts/ci/audit-ci-allowlist.json.
116
+ - name: Audit dependencies for known CVEs
117
+ shell: bash
118
+ env:
119
+ BASE: ${{ needs.changes.outputs.base }}
120
+ run: |
121
+ set -uo pipefail
122
+ ARGS=()
123
+ if [ -n "$BASE" ] && git show "$BASE:yarn.lock" > "$RUNNER_TEMP/baseline-yarn.lock" 2>/dev/null; then
124
+ echo "Auditing against the baseline yarn.lock from $BASE."
125
+ ARGS=(--baseline "$RUNNER_TEMP/baseline-yarn.lock")
126
+ else
127
+ echo "::notice::No baseline yarn.lock available, auditing strictly."
128
+ fi
129
+ node scripts/ci/audit-ci.mjs --severity __OM_AUDIT_SEVERITY__ "${ARGS[@]}"
130
+
131
+ #@if secrets
132
+ # ── Secret scan ─────────────────────────────────────────────────────────────
133
+ # Gitleaks scans every commit the change adds — not just the final tree — so
134
+ # a key committed and then deleted in a later commit is still caught. The
135
+ # nightly .github/workflows/security.yml scans the full history.
136
+ secrets:
137
+ name: Secret scan
138
+ needs: changes
139
+ runs-on: __OM_RUNNER__
140
+ timeout-minutes: 10
141
+ steps:
142
+ - name: Checkout repository
143
+ uses: __OM_ACTION_CHECKOUT__
144
+ with:
145
+ fetch-depth: 0
146
+ persist-credentials: false
147
+
148
+ - name: Install Gitleaks
149
+ uses: ./.github/actions/gitleaks
150
+
151
+ - name: Scan new commits for secrets
152
+ shell: bash
153
+ env:
154
+ BASE: ${{ needs.changes.outputs.base }}
155
+ run: |
156
+ set -euo pipefail
157
+ ARGS=()
158
+ if [ -n "$BASE" ]; then
159
+ echo "Scanning commits $BASE..HEAD."
160
+ ARGS=(--log-opts="$BASE..HEAD")
161
+ else
162
+ echo "No base commit, scanning the full history."
163
+ fi
164
+ "$RUNNER_TEMP/gitleaks-bin/gitleaks" git --no-banner --redact --verbose "${ARGS[@]}" .
165
+
166
+ #@endif
167
+ #@if sast
168
+ # ── Static analysis (SAST) ──────────────────────────────────────────────────
169
+ # Semgrep over the app code in src/. Fails only on findings the change
170
+ # INTRODUCES (`--baseline-commit`):
171
+ # • Open Mercato rules (scripts/ci/semgrep/open-mercato.yml), every severity;
172
+ # • Semgrep registry `p/default`, ERROR severity only (its warnings are
173
+ # mostly noise on Next.js code).
174
+ # Silence a reviewed false positive with `// nosemgrep: <rule-id>` and a reason.
175
+ sast:
176
+ name: Static analysis
177
+ needs: changes
178
+ runs-on: __OM_RUNNER__
179
+ timeout-minutes: 20
180
+ #@if codeScanning
181
+ permissions:
182
+ contents: read
183
+ security-events: write
184
+ #@endif
185
+ steps:
186
+ - name: Checkout repository
187
+ uses: __OM_ACTION_CHECKOUT__
188
+ with:
189
+ fetch-depth: 0
190
+ persist-credentials: false
191
+
192
+ - name: Run Semgrep
193
+ shell: bash
194
+ env:
195
+ BASE: ${{ needs.changes.outputs.base }}
196
+ SEMGREP_IMAGE: __OM_SEMGREP_IMAGE__
197
+ run: |
198
+ set -uo pipefail
199
+ mkdir -p semgrep-sarif
200
+ BASELINE=()
201
+ if [ -n "$BASE" ]; then
202
+ echo "Reporting only findings introduced since $BASE."
203
+ BASELINE=(--baseline-commit "$BASE")
204
+ fi
205
+ run_semgrep() {
206
+ docker run --rm -v "$PWD:/src" -w /src \
207
+ -e GIT_CONFIG_COUNT=1 -e GIT_CONFIG_KEY_0=safe.directory -e GIT_CONFIG_VALUE_0=/src \
208
+ "$SEMGREP_IMAGE" semgrep scan --metrics=off --error \
209
+ --exclude '**/__tests__/**' --exclude '**/__integration__/**' \
210
+ --exclude '*.test.*' --exclude '*.spec.*' \
211
+ "${BASELINE[@]}" "$@" src
212
+ }
213
+ STATUS=0
214
+ echo "::group::Open Mercato rules"
215
+ run_semgrep --config scripts/ci/semgrep/open-mercato.yml --sarif-output=semgrep-sarif/open-mercato.sarif || STATUS=1
216
+ echo "::endgroup::"
217
+ echo "::group::Semgrep registry p/default (ERROR severity)"
218
+ run_semgrep --config p/default --severity ERROR --sarif-output=semgrep-sarif/default.sarif || STATUS=1
219
+ echo "::endgroup::"
220
+ exit "$STATUS"
221
+
222
+ #@if codeScanning
223
+ - name: Upload Semgrep results to code scanning
224
+ if: always()
225
+ uses: __OM_ACTION_UPLOAD_SARIF__
226
+ with:
227
+ sarif_file: semgrep-sarif
228
+ category: semgrep
229
+
230
+ #@endif
231
+ #@endif
232
+ #@if workflowLint
233
+ # ── Workflow security ───────────────────────────────────────────────────────
234
+ # zizmor audits the GitHub Actions workflows themselves: expression
235
+ # injection, over-broad token permissions, credential persistence, cache
236
+ # poisoning, unpinned actions. Runs when .github/ changes, and on pushes.
237
+ workflow-lint:
238
+ name: Workflow security
239
+ needs: changes
240
+ if: github.event_name != 'pull_request' || needs.changes.outputs.workflows == 'true'
241
+ runs-on: __OM_RUNNER__
242
+ timeout-minutes: 10
243
+ #@if codeScanning
244
+ permissions:
245
+ contents: read
246
+ security-events: write
247
+ #@endif
248
+ steps:
249
+ - name: Checkout repository
250
+ uses: __OM_ACTION_CHECKOUT__
251
+ with:
252
+ persist-credentials: false
253
+
254
+ #@if codeScanning
255
+ # SARIF mode never fails the job, so the blocking run below stays separate.
256
+ - name: Upload zizmor results to code scanning
257
+ uses: __OM_ACTION_ZIZMOR__
258
+ with:
259
+ inputs: .github
260
+ version: '__OM_ZIZMOR_VERSION__'
261
+ min-severity: medium
262
+ advanced-security: true
263
+
264
+ #@endif
265
+ - name: Run zizmor
266
+ uses: __OM_ACTION_ZIZMOR__
267
+ with:
268
+ inputs: .github
269
+ version: '__OM_ZIZMOR_VERSION__'
270
+ min-severity: medium
271
+ advanced-security: false
272
+
273
+ #@endif
274
+ #@if lint
275
+ # ── Lint ────────────────────────────────────────────────────────────────────
276
+ # Static analysis needs no generated files, so it fails fast in parallel.
277
+ lint:
278
+ name: Lint
279
+ runs-on: __OM_RUNNER__
280
+ timeout-minutes: 15
281
+ steps:
282
+ - name: Checkout repository
283
+ uses: __OM_ACTION_CHECKOUT__
284
+ with:
285
+ persist-credentials: false
286
+
287
+ - name: Setup Node and dependencies
288
+ uses: ./.github/actions/setup
289
+
290
+ - name: Lint
291
+ run: yarn lint
292
+
293
+ #@endif
294
+ # ── Validate ────────────────────────────────────────────────────────────────
295
+ # The same gate an agent runs before opening a pull request
296
+ # (.ai/agentic.config.json → validation.commands), in the same order.
297
+ validate:
298
+ name: Validate
299
+ runs-on: __OM_RUNNER__
300
+ timeout-minutes: 45
301
+ steps:
302
+ - name: Checkout repository
303
+ uses: __OM_ACTION_CHECKOUT__
304
+ with:
305
+ persist-credentials: false
306
+
307
+ - name: Setup Node and dependencies
308
+ uses: ./.github/actions/setup
309
+
310
+ # Every registry under .mercato/generated is derived from src/modules.ts
311
+ # and installed packages. Generating from scratch proves the app builds
312
+ # from committed sources alone.
313
+ - name: Generate module registries
314
+ run: yarn generate
315
+
316
+ # Generated output is never committed by hand. If `yarn generate` changes a
317
+ # tracked file, the committed copy is stale or was edited manually.
318
+ - name: Verify generation left tracked files untouched
319
+ shell: bash
320
+ run: |
321
+ if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
322
+ echo "::error::'yarn generate' modified tracked files. Run 'yarn generate' locally and commit the result."
323
+ git status --short --untracked-files=no
324
+ git --no-pager diff --stat
325
+ exit 1
326
+ fi
327
+
328
+ #@if typecheck
329
+ - name: Typecheck
330
+ run: yarn typecheck
331
+
332
+ #@endif
333
+ #@if dsCheck
334
+ # Design-system guard: no hard-coded palette colours, arbitrary Tailwind
335
+ # values or manual dark-mode overrides in app UI code.
336
+ - name: Design-system check
337
+ run: yarn ds:check
338
+
339
+ #@endif
340
+ #@if timeBombs
341
+ # Fails on tests that assert a hard-coded future date as "still valid":
342
+ # they pass today and turn red on an unrelated pull request once that date
343
+ # passes. Exceptions live in .ai/time-bomb-allowlist.json.
344
+ - name: Check for time-bomb test literals
345
+ run: node scripts/ci/time-bomb-scanner.mjs --fail src .ai/qa/tests
346
+
347
+ #@endif
348
+ #@if test
349
+ - name: Unit tests
350
+ run: __OM_TEST_COMMAND__
351
+
352
+ #@endif
353
+ #@if build
354
+ - name: Production build
355
+ run: yarn build
356
+
357
+ #@endif
358
+ #@if integration
359
+ # ── Integration tests ───────────────────────────────────────────────────────
360
+ # Boots the real app against a throwaway PostgreSQL container (testcontainers,
361
+ # via the Docker daemon that GitHub-hosted runners provide), runs the
362
+ # Playwright suites from src/modules/**/__integration__ and .ai/qa/tests,
363
+ # then tears everything down. Skipped when the app has no integration specs.
364
+ integration:
365
+ name: Integration tests
366
+ needs: [__OM_INTEGRATION_NEEDS__]
367
+ runs-on: __OM_RUNNER__
368
+ timeout-minutes: 60
369
+ env:
370
+ OM_INTEGRATION_APP_READY_TIMEOUT_SECONDS: '180'
371
+ steps:
372
+ - name: Checkout repository
373
+ uses: __OM_ACTION_CHECKOUT__
374
+ with:
375
+ persist-credentials: false
376
+
377
+ - name: Detect integration specs
378
+ id: specs
379
+ shell: bash
380
+ run: |
381
+ COUNT=$( { find src/modules -type d -name __integration__ -prune -exec find {} -name '*.spec.ts' \; 2>/dev/null; find .ai/qa/tests -name '*.spec.ts' 2>/dev/null; } | wc -l | tr -d ' ')
382
+ echo "count=$COUNT" >> "$GITHUB_OUTPUT"
383
+ if [ "$COUNT" = "0" ]; then
384
+ echo "::notice::No integration specs found (src/modules/**/__integration__/*.spec.ts or .ai/qa/tests/**/*.spec.ts), skipping."
385
+ else
386
+ echo "Found $COUNT integration spec file(s)."
387
+ fi
388
+
389
+ - name: Setup Node and dependencies
390
+ if: steps.specs.outputs.count != '0'
391
+ uses: ./.github/actions/setup
392
+
393
+ - name: Install Playwright browser
394
+ if: steps.specs.outputs.count != '0'
395
+ uses: ./.github/actions/playwright
396
+
397
+ - name: Run ephemeral integration tests
398
+ if: steps.specs.outputs.count != '0'
399
+ run: yarn test:integration:ephemeral
400
+
401
+ - name: Upload integration test report
402
+ if: failure() && steps.specs.outputs.count != '0'
403
+ uses: __OM_ACTION_UPLOAD_ARTIFACT__
404
+ with:
405
+ name: integration-test-results
406
+ path: .ai/qa/test-results
407
+ if-no-files-found: ignore
408
+ retention-days: 14
409
+
410
+ #@endif
411
+ #@if docker
412
+ # ── Docker image ────────────────────────────────────────────────────────────
413
+ # Builds (never pushes) the production image, so a broken Dockerfile or
414
+ # .dockerignore is caught before a deploy. Runs on pushes and on pull
415
+ # requests that touch the image inputs.
416
+ docker:
417
+ name: Docker image
418
+ needs: changes
419
+ if: github.event_name != 'pull_request' || needs.changes.outputs.docker == 'true'
420
+ runs-on: __OM_RUNNER__
421
+ timeout-minutes: 45
422
+ steps:
423
+ - name: Checkout repository
424
+ uses: __OM_ACTION_CHECKOUT__
425
+ with:
426
+ persist-credentials: false
427
+
428
+ - name: Setup Docker Buildx
429
+ uses: __OM_ACTION_SETUP_BUILDX__
430
+
431
+ - name: Build production image
432
+ uses: __OM_ACTION_BUILD_PUSH__
433
+ with:
434
+ context: .
435
+ file: __OM_DOCKERFILE__
436
+ push: false
437
+ load: true
438
+ tags: app:ci
439
+ cache-from: type=gha
440
+ cache-to: type=gha,mode=max
441
+
442
+ #@if imageScan
443
+ # Trivy covers what the npm audit cannot see: OS packages in the base
444
+ # image. Fails on HIGH/CRITICAL vulnerabilities that have a fix available.
445
+ # npm packages inside the image are left to the dependency audit; the
446
+ # nightly security workflow scans both. Exceptions: .trivyignore.
447
+ - name: Scan image OS packages
448
+ shell: bash
449
+ env:
450
+ TRIVY_IMAGE: __OM_TRIVY_IMAGE__
451
+ run: |
452
+ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$PWD:/work" -w /work "$TRIVY_IMAGE" \
453
+ image --no-progress --skip-version-check --exit-code 1 --severity HIGH,CRITICAL --ignore-unfixed --pkg-types os app:ci
454
+
455
+ #@endif
456
+ #@endif
457
+ # ── Aggregate verdict ───────────────────────────────────────────────────────
458
+ # The one check to mark as required in branch protection. A skipped job
459
+ # (no dependency change, no integration specs, …) counts as passed; a failed
460
+ # or cancelled one fails this check.
461
+ ci:
462
+ name: CI
463
+ if: always()
464
+ needs: [__OM_NEEDS__]
465
+ runs-on: __OM_RUNNER__
466
+ timeout-minutes: 5
467
+ steps:
468
+ - name: Evaluate job results
469
+ uses: __OM_ACTION_GITHUB_SCRIPT__
470
+ env:
471
+ NEEDS: ${{ toJSON(needs) }}
472
+ with:
473
+ script: |
474
+ const needs = JSON.parse(process.env.NEEDS)
475
+ for (const [name, job] of Object.entries(needs)) core.info(`${name}: ${job.result}`)
476
+ const failed = Object.keys(needs).filter((name) => ['failure', 'cancelled'].includes(needs[name].result))
477
+ if (failed.length > 0) core.setFailed(`Failed jobs: ${failed.join(', ')}`)