Repository navigation
351 lines (340 loc) · 15 KB
/
Copy pathci.yml
File metadata and controls
351 lines (340 loc) · 15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
name: CI
on:
push:
branches: [main, master, feature/**]
pull_request:
branches: [main, master, feature/**, cursor/vite-plus-toolchain-cdbd]
permissions:
contents: read
pull-requests: read
statuses: read
jobs:
coverage:
name: Coverage generators and drift checks
runs-on: ${{ (startsWith(vars.CI_RUNNER, 'blacksmith-') && vars.CI_RUNNER) || 'blacksmith-4vcpu-ubuntu-2404' }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version-file: .tool-versions
- name: Test coverage generators and verify generated artifacts
run: npm run test:coverage
toolchain:
name: Vite+ monorepo check
runs-on: ${{ (startsWith(vars.CI_RUNNER, 'blacksmith-') && vars.CI_RUNNER) || 'blacksmith-4vcpu-ubuntu-2404' }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version-file: .tool-versions
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install workspace dependencies
run: npm ci
- name: Check agent trust guards and generated OpenAPI artifacts
run: npm run check:agent-trust
- name: Check root and every workspace
run: npx vp run check
- name: Test every workspace
run: npx vp run test
- name: Build every workspace
run: npx vp run build
node26-compat:
name: Node 26 compatibility
runs-on: ${{ (startsWith(vars.CI_RUNNER, 'blacksmith-') && vars.CI_RUNNER) || 'blacksmith-4vcpu-ubuntu-2404' }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: '26.12.1'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install workspace dependencies
run: npm ci
- name: Check agent trust guards
run: node bin/check-agent-trust.mjs
- name: Check root and every workspace
run: npx --no-install vp run check
- name: Build every workspace
run: npx --no-install vp run build
- name: Test policy and every workspace
run: npm test
- name: Check generated OpenAPI artifacts
run: node bin/check-openapi-types.mjs
- name: Smoke all supported MCP protocols
run: |
for version in 2026-07-28 2025-11-25 2025-06-18 2025-03-26 2024-11-05 2024-10-07; do
MCP_PROTOCOL_VERSION="$version" npm run test:protocol --workspace @terminal49/mcp
done
# Consumer compatibility: the SDK on every supported Node version. npm ci
# from the SDK directory installs from the root workspace lockfile.
sdk:
runs-on: ${{ (startsWith(vars.CI_RUNNER, 'blacksmith-') && vars.CI_RUNNER) || 'blacksmith-4vcpu-ubuntu-2404' }}
strategy:
fail-fast: false
matrix:
node-version: [20, 22, 24]
defaults:
run:
working-directory: sdks/typescript-sdk
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install SDK deps
run: npm ci
- name: Build SDK
run: npm run build
- name: Type-check SDK
run: npm run type-check
- name: Import the built SDK
run: node --input-type=module -e "const sdk = await import('@terminal49/sdk'); if (typeof sdk.Terminal49Client !== 'function') throw new Error('Terminal49Client export missing');"
# Vitest 5 and Vite+ 1.x support Node 22.12+ only, so the Node 20 leg
# proves install, build, types, and import, and leaves tests to 22+.
- name: Test SDK
if: matrix.node-version != 20
run: npm test -- --run
# Development tooling: root workspace lockfile on the development runtime.
# Lint/format/docs are static checks, so one modern Node version suffices.
sdk-tooling:
runs-on: ${{ (startsWith(vars.CI_RUNNER, 'blacksmith-') && vars.CI_RUNNER) || 'blacksmith-4vcpu-ubuntu-2404' }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version-file: .tool-versions
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install workspace deps
run: npm ci
- name: Build SDK
run: npm run build --workspace @terminal49/sdk
- name: Generate SDK docs
run: npm run docs --workspace @terminal49/sdk
- name: Check generated SDK docs are up to date
run: |
git diff --exit-code -- docs/sdk/reference
test -z "$(git status --porcelain -- docs/sdk/reference)"
- name: Check SDK (Vite+ and anti-slop)
run: npm run lint --workspace @terminal49/sdk
cli:
runs-on: ${{ (startsWith(vars.CI_RUNNER, 'blacksmith-') && vars.CI_RUNNER) || 'blacksmith-4vcpu-ubuntu-2404' }}
strategy:
fail-fast: false
matrix:
node-version: [20, 22, 24]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install workspace deps
run: npm ci
- name: Build SDK (workspace dependency)
run: npm run build --workspace @terminal49/sdk
- name: Build CLI
run: npm run build --workspace @terminal49/cli
- name: Type-check CLI
run: npm run type-check --workspace @terminal49/cli
- name: Run the built CLI
run: node sdks/typescript-sdk-cli/dist/bin/t49.js --help
# Vitest 5 and Vite+ 1.x support Node 22.12+ only, so the Node 20 leg
# proves install, build, types, and the binary, and leaves tests to 22+.
- name: Test CLI
if: matrix.node-version != 20
run: npm run test --workspace @terminal49/cli
# Vite+ linting is static, so it only needs the development runtime.
- name: Check CLI (Vite+ and anti-slop)
if: matrix.node-version == 24
run: npm run lint --workspace @terminal49/cli
mcp:
runs-on: ${{ (startsWith(vars.CI_RUNNER, 'blacksmith-') && vars.CI_RUNNER) || 'blacksmith-4vcpu-ubuntu-2404' }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version-file: .tool-versions
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install MCP deps (published SDK)
run: npm ci
- name: Build SDK (workspace dependency)
run: npm run build --workspace @terminal49/sdk
- name: Verify generated MCP filter schemas
run: |
npm run generate:filters --workspace @terminal49/mcp
git diff --exit-code -- packages/mcp/src/generated
test -z "$(git status --porcelain -- packages/mcp/src/generated)"
- name: Build MCP
run: npm run build --workspace @terminal49/mcp
- name: Type-check SDK + MCP
run: |
npm run type-check --workspace @terminal49/sdk
npm run type-check --workspace @terminal49/mcp
- name: Type-check MCP eval suite
run: npm run eval:check --workspace @terminal49/mcp
- name: Test MCP
run: npm run test --workspace @terminal49/mcp -- --run --coverage
- name: Eval MCP tools against production (live; skips without MCP_EVAL_TOKEN secret)
if: github.event_name == 'push'
env:
MCP_EVAL_TOKEN: ${{ secrets.MCP_EVAL_TOKEN }}
run: npm run eval --workspace @terminal49/mcp
- name: Check MCP (Vite+ and anti-slop)
run: npm run lint --workspace @terminal49/mcp
- name: Check API gateway (Vite+ and anti-slop)
run: npm run lint:api
mcp-protocol-compat:
name: MCP protocol ${{ matrix.protocol-version }}
runs-on: ${{ (startsWith(vars.CI_RUNNER, 'blacksmith-') && vars.CI_RUNNER) || 'blacksmith-4vcpu-ubuntu-2404' }}
strategy:
fail-fast: false
matrix:
protocol-version:
- '2026-07-28'
- '2025-11-25'
- '2025-06-18'
- '2025-03-26'
- '2024-11-05'
- '2024-10-07'
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version-file: .tool-versions
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install workspace dependencies
run: npm ci
- name: Build SDK dependency
run: npm run build --workspace @terminal49/sdk
- name: Build MCP server
run: npm run build --workspace @terminal49/mcp
- name: POST protocol handshake to built MCP server
env:
MCP_PROTOCOL_VERSION: ${{ matrix.protocol-version }}
run: npm run test:protocol --workspace @terminal49/mcp
mcp-preview-protocol:
name: MCP preview ${{ matrix.protocol-version }}
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository &&
github.actor != 'dependabot[bot]'
needs: [mcp, mcp-protocol-compat]
runs-on: ${{ (startsWith(vars.CI_RUNNER, 'blacksmith-') && vars.CI_RUNNER) || 'blacksmith-4vcpu-ubuntu-2404' }}
strategy:
fail-fast: false
matrix:
protocol-version:
- '2026-07-28'
- '2025-11-25'
steps:
- name: Check preview credential availability
id: credential
env:
MCP_EVAL_TOKEN: ${{ secrets.MCP_EVAL_TOKEN }}
run: |
if [[ -n "$MCP_EVAL_TOKEN" ]]; then
echo "available=true" >> "$GITHUB_OUTPUT"
else
echo "available=false" >> "$GITHUB_OUTPUT"
echo "::notice::Skipping authenticated preview smoke because MCP_EVAL_TOKEN is unavailable"
fi
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
if: steps.credential.outputs.available == 'true'
with:
node-version-file: .tool-versions
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install workspace dependencies
if: steps.credential.outputs.available == 'true'
run: npm ci
- name: Wait for this commit's Vercel preview
id: vercel
env:
GH_TOKEN: ${{ github.token }}
PREVIEW_SHA: ${{ github.event.pull_request.head.sha }}
run: |
state=pending
for attempt in {1..60}; do
state="$(gh api "repos/${GITHUB_REPOSITORY}/commits/${PREVIEW_SHA}/status" \
--jq '[.statuses[] | select(.context == "Vercel")][0].state // "pending"')"
if [[ "$state" == "success" ]]; then
break
fi
if [[ "$state" == "failure" || "$state" == "error" ]]; then
echo "Vercel preview failed for ${PREVIEW_SHA}"
exit 1
fi
sleep 10
done
if [[ "$state" != "success" ]]; then
echo "Timed out waiting for Vercel preview for ${PREVIEW_SHA}"
exit 1
fi
inspector_url="$(gh api "repos/${GITHUB_REPOSITORY}/commits/${PREVIEW_SHA}/status" \
--jq '[.statuses[] | select(.context == "Vercel")][0].target_url // empty')"
if [[ -z "$inspector_url" ]]; then
echo "Vercel status for ${PREVIEW_SHA} has no deployment URL"
exit 1
fi
echo "inspector-url=${inspector_url}" >> "$GITHUB_OUTPUT"
- name: Resolve Vercel preview endpoint
id: preview
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
VERCEL_INSPECTOR_URL: ${{ steps.vercel.outputs.inspector-url }}
run: |
preview_url="$(gh api "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" \
--paginate --slurp | jq -r --arg inspector "$VERCEL_INSPECTOR_URL" \
'flatten | [.[] | select((.user.login == "vercel[bot]" or .user.login == "vercel") and (.body | contains($inspector)))][-1].body // "" | (try capture("\\[Preview\\]\\((?<url>https://[^)]+\\.vercel\\.app)\\)") catch {}) | .url // empty')"
if [[ -z "$preview_url" ]]; then
echo "Could not resolve a Vercel preview URL for ${VERCEL_INSPECTOR_URL}"
exit 1
fi
echo "endpoint=${preview_url}/mcp" >> "$GITHUB_OUTPUT"
- name: Verify authorization server advertises refresh support
if: matrix.protocol-version == '2026-07-28'
env:
AUTHORIZATION_SERVER_METADATA_URL: https://mcp.terminal49.com/.well-known/oauth-authorization-server
run: |
curl --fail --silent --show-error --location --max-time 30 \
"$AUTHORIZATION_SERVER_METADATA_URL" \
| jq --exit-status '
(.grant_types_supported // [] | index("refresh_token")) != null
and
(.scopes_supported // [] | index("offline_access")) != null
' > /dev/null
- name: POST handshake and tools/list to Vercel preview
if: steps.credential.outputs.available == 'true'
env:
MCP_HTTP_ENDPOINT: ${{ steps.preview.outputs.endpoint }}
MCP_HTTP_TOKEN: ${{ secrets.MCP_EVAL_TOKEN }}
MCP_PROTOCOL_VERSION: ${{ matrix.protocol-version }}
run: npm run test:http-protocol --workspace @terminal49/mcp
- name: Eval MCP tools against Vercel preview
if: steps.credential.outputs.available == 'true' && matrix.protocol-version == '2026-07-28'
env:
MCP_EVAL_ENDPOINT: ${{ steps.preview.outputs.endpoint }}
MCP_EVAL_TOKEN: ${{ secrets.MCP_EVAL_TOKEN }}
run: npm run eval --workspace @terminal49/mcp
- name: Verify preview still belongs to this commit
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
VERCEL_INSPECTOR_URL: ${{ steps.vercel.outputs.inspector-url }}
run: |
matches="$(gh api "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" \
--paginate --slurp | jq -r --arg inspector "$VERCEL_INSPECTOR_URL" \
'flatten | [.[] | select((.user.login == "vercel[bot]" or .user.login == "vercel") and (.body | contains($inspector)))] | length')"
if [[ "$matches" != "1" ]]; then
echo "Vercel preview changed while the smoke test was running"
exit 1
fi