@cbartens/bkit 5.4.0 → 5.5.1

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 (125) hide show
  1. package/.bkit/README.md +19 -7
  2. package/.bkit/core/.agents/rules.md +24 -9
  3. package/.bkit/core/.bkit/README.md +18 -6
  4. package/.bkit/core/.bkit/cloud.md +46 -15
  5. package/.bkit/core/.bkit/comparison.md +2 -2
  6. package/.bkit/core/.bkit/install.md +19 -18
  7. package/.bkit/core/.bkit/pipeline.md +3 -1
  8. package/.bkit/core/.bkit/prompts.md +38 -20
  9. package/.bkit/core/.bkit/providers.md +6 -6
  10. package/.bkit/core/.bkit/templates.md +44 -13
  11. package/.bkit/core/.bkit/trackers.md +99 -35
  12. package/.bkit/core/.bkit/workflows.md +50 -45
  13. package/.bkit/core/AGENTS.md +2 -2
  14. package/.bkit/core/docs/templates/bkit-audit-app-performance.md +1 -1
  15. package/.bkit/core/docs/templates/bkit-audit-issues.md +22 -6
  16. package/.bkit/core/engine/checks/after/auth.ts +88 -45
  17. package/.bkit/core/engine/checks/after/ci-yml.ts +0 -1
  18. package/.bkit/core/engine/checks/after/github.ts +42 -78
  19. package/.bkit/core/engine/checks/after/index.ts +1 -6
  20. package/.bkit/core/engine/checks/after/tools.ts +1 -1
  21. package/.bkit/core/engine/checks/before/env.ts +28 -18
  22. package/.bkit/core/engine/checks/before/mcp.ts +4 -2
  23. package/.bkit/core/engine/checks/tips/catalogue.ts +15 -2
  24. package/.bkit/core/engine/checks/tips/index.ts +5 -2
  25. package/.bkit/core/engine/cli.ts +7 -5
  26. package/.bkit/core/engine/commands/ci/ci.ts +107 -0
  27. package/.bkit/core/engine/commands/install/uninstall.ts +46 -0
  28. package/.bkit/core/engine/commands/workflow/fids.ts +23 -15
  29. package/.bkit/core/engine/commands/workflow/issues.ts +61 -63
  30. package/.bkit/core/engine/commands/workflow/ledgers.ts +28 -11
  31. package/.bkit/core/engine/commands/workflow/prs.ts +3 -1
  32. package/.bkit/core/engine/commands/workflow/repo.ts +8 -0
  33. package/.bkit/core/engine/commands/workflow/roadmap.ts +5 -1
  34. package/.bkit/core/engine/commands/workflow/steps.ts +2 -2
  35. package/.bkit/core/engine/commands/workflow/workflows.ts +9 -4
  36. package/.bkit/core/engine/commands/workflow/worktrees.ts +91 -14
  37. package/.bkit/core/engine/install/manifest.ts +31 -10
  38. package/.bkit/core/engine/install/modules/cloud.ts +3 -1
  39. package/.bkit/core/engine/install/modules/core.ts +153 -4
  40. package/.bkit/core/engine/install/modules/opencode.ts +5 -0
  41. package/.bkit/core/engine/install/write.ts +37 -1
  42. package/.bkit/core/engine/render/trackers.ts +35 -23
  43. package/.bkit/core/engine/shared/egress.ts +6 -0
  44. package/.bkit/core/engine/shared/settings.ts +130 -11
  45. package/.bkit/core/hooks/guardrails-tiers.js +1 -1
  46. package/.bkit/core/prompts/bkit-audit-generate.md +42 -12
  47. package/.bkit/core/prompts/bkit-build-challenge-remediate.md +1 -1
  48. package/.bkit/core/prompts/bkit-build-challenge-tests.md +1 -1
  49. package/.bkit/core/prompts/bkit-build-plan-execute.md +1 -1
  50. package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +1 -1
  51. package/.bkit/core/prompts/bkit-debug-abort-handover.md +2 -0
  52. package/.bkit/core/prompts/bkit-debug-failure-remediate.md +1 -1
  53. package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +1 -1
  54. package/.bkit/core/prompts/bkit-debug-failure-soak.md +1 -1
  55. package/.bkit/core/prompts/bkit-design-generate.md +4 -1
  56. package/.bkit/core/prompts/bkit-plan-generate.md +5 -3
  57. package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +1 -1
  58. package/.bkit/core/prompts/bkit-ship-update-docs.md +1 -1
  59. package/.bkit/core/prompts/bkit-utility-update-decisions.md +3 -1
  60. package/.bkit/core/prompts/bkit-utility-update-deferrals.md +3 -1
  61. package/.bkit/core/prompts/bkit-utility-update-documentation.md +12 -2
  62. package/.bkit/core/prompts/bkit-utility-update-failures.md +3 -1
  63. package/.bkit/core/prompts/bkit-utility-update-knowledge.md +3 -1
  64. package/.bkit/core/prompts/bkit-utility-update-roadmap.md +9 -2
  65. package/.bkit/core/prompts/bkit-utility-update-tracker.md +159 -0
  66. package/.bkit/core/workflows/bkit-auto.md +19 -6
  67. package/.bkit/core/workflows/bkit-build.md +59 -17
  68. package/.bkit/core/workflows/bkit-debug.md +64 -20
  69. package/.bkit/core/workflows/bkit-design.md +83 -28
  70. package/.bkit/core/workflows/bkit-plan.md +61 -20
  71. package/.bkit/core/workflows/bkit-ship.md +48 -18
  72. package/.bkit/shared/.bkit/.env.example +8 -0
  73. package/.bkit/shared/.claude/settings.json +3 -1
  74. package/.bkit/shared/.cursor/bkit-cloud.md +2 -2
  75. package/.bkit/shared/.cursor/mcp.json +11 -4
  76. package/.bkit/shared/.mcp.json +11 -4
  77. package/.bkit/shared/.opencode/opencode.json +2 -0
  78. package/.bkit/shared/docs/deployments.md +6 -7
  79. package/.bkit/shared/docs/security.md +1 -1
  80. package/.bkit/shared/docs/testing.md +13 -5
  81. package/.bkit/templates/.github/renovate.json5 +1 -1
  82. package/.bkit/templates/.github/workflows/bkit-ci.yml +21 -115
  83. package/.bkit/templates/.github/workflows/bkit-cloud.yml +40 -12
  84. package/.bkit/templates/.husky/pre-commit +4 -4
  85. package/.bkit/templates/.husky/pre-push +107 -18
  86. package/.bkit/templates/scripts/ci/bkit-local-stack-lock.sh +194 -0
  87. package/.bkit/templates/scripts/ci/check-capstone.mjs +2 -4
  88. package/.bkit/templates/scripts/ci/check-capstone.test.mjs +4 -23
  89. package/.bkit/templates/scripts/ci/lanes/resolve-push-base.mjs +104 -23
  90. package/.bkit/templates/scripts/ci/lanes/resolve-push-base.test.mjs +103 -6
  91. package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +3 -1
  92. package/.bkit/templates/scripts/graphify/bkit-graphify.sh +1 -1
  93. package/.bkit/templates/scripts/prettier/bkit-insert-ignore.mjs +49 -29
  94. package/CHANGELOG.md +67 -1
  95. package/README.md +16 -6
  96. package/dist/checks/after/auth.js +81 -45
  97. package/dist/checks/after/ci-yml.js +0 -1
  98. package/dist/checks/after/github.js +41 -76
  99. package/dist/checks/after/index.js +2 -7
  100. package/dist/checks/after/tools.js +1 -1
  101. package/dist/checks/before/env.js +24 -17
  102. package/dist/checks/before/mcp.js +4 -2
  103. package/dist/checks/tips/catalogue.js +14 -2
  104. package/dist/checks/tips/index.js +4 -2
  105. package/dist/cli.js +7 -5
  106. package/dist/commands/ci/ci.js +100 -0
  107. package/dist/commands/install/uninstall.js +42 -0
  108. package/dist/commands/workflow/fids.js +22 -15
  109. package/dist/commands/workflow/issues.js +53 -61
  110. package/dist/commands/workflow/ledgers.js +26 -11
  111. package/dist/commands/workflow/prs.js +3 -1
  112. package/dist/commands/workflow/repo.js +6 -0
  113. package/dist/commands/workflow/roadmap.js +3 -1
  114. package/dist/commands/workflow/steps.js +2 -2
  115. package/dist/commands/workflow/workflows.js +9 -4
  116. package/dist/commands/workflow/worktrees.js +74 -13
  117. package/dist/install/manifest.js +30 -10
  118. package/dist/install/modules/cloud.js +3 -1
  119. package/dist/install/modules/core.js +157 -5
  120. package/dist/install/modules/opencode.js +6 -0
  121. package/dist/install/write.js +26 -2
  122. package/dist/render/trackers.js +34 -20
  123. package/dist/shared/egress.js +6 -0
  124. package/dist/shared/settings.js +59 -7
  125. package/package.json +14 -3
@@ -83,45 +83,7 @@ jobs:
83
83
  echo "🔊 [verbose ci] marker active — escalating log detail"
84
84
  echo "DEBUG=vercel:*,supabase:*" >> "$GITHUB_ENV"
85
85
 
86
- # [force build] / [force cache] run the suite even when this SHA already has a green run.
87
- - name: Check SHA Cache
88
- id: cache
89
- env:
90
- GH_TOKEN: ${{ github.token }}
91
- # User-controlled text (PR title) arrives via env: (runtime expansion,
92
- # injection-safe) — never inlined into the run: body.
93
- PR_TITLE: ${{ github.event.pull_request.title }}
94
- EVENT_NAME: ${{ github.event_name }}
95
- run: |
96
- if [ "$EVENT_NAME" = "pull_request" ]; then
97
- MSG="$PR_TITLE"
98
- else
99
- MSG=$(git log -1 --pretty=%B "$GITHUB_SHA" 2>/dev/null || echo "")
100
- fi
101
- case "$MSG" in
102
- *"[force build]"*|*"[force cache]"*)
103
- echo "skip=false" >> "$GITHUB_OUTPUT"
104
- echo "::notice::force marker present — ignoring SHA cache."
105
- exit 0 ;;
106
- esac
107
- SINCE=$(date -u -d '7 days ago' +%FT%TZ 2>/dev/null || date -u -v -7d +%FT%TZ)
108
- PRIOR=$(gh run list \
109
- --repo "$GITHUB_REPOSITORY" \
110
- --workflow "$GITHUB_WORKFLOW" \
111
- --status success \
112
- --limit 50 \
113
- --json headSha,createdAt \
114
- --jq "[.[] | select(.headSha == \"$GITHUB_SHA\") | select(.createdAt > \"$SINCE\")] | length" \
115
- 2>/dev/null || echo 0)
116
- if [ "${PRIOR:-0}" -gt 0 ]; then
117
- echo "skip=true" >> "$GITHUB_OUTPUT"
118
- echo "::notice::SHA $GITHUB_SHA has $PRIOR prior green run(s) since $SINCE — skipping suite."
119
- else
120
- echo "skip=false" >> "$GITHUB_OUTPUT"
121
- fi
122
-
123
86
  - name: Detect Direct Push
124
- if: steps.cache.outputs.skip != 'true'
125
87
  id: detect
126
88
  env:
127
89
  GH_TOKEN: ${{ github.token }}
@@ -192,7 +154,7 @@ jobs:
192
154
  # pre-planner shape (pull_request only). Once bkit-tests-scope exists, run this on every event
193
155
  # against the planner base. deployments.md § One run. To enable: uncomment and delete this header.
194
156
  # - name: Assert Migrations Immutable
195
- # if: github.event_name == 'pull_request' && steps.cache.outputs.skip != 'true'
157
+ # if: github.event_name == 'pull_request'
196
158
  # run: |
197
159
  # git fetch origin "${{ github.base_ref }}" --depth=50 2>/dev/null || true
198
160
  # CHANGED=$(git diff --name-only "origin/${{ github.base_ref }}..HEAD" -- supabase/migrations/ 2>/dev/null || true)
@@ -206,7 +168,6 @@ jobs:
206
168
  # exit $EXIT
207
169
 
208
170
  - name: Install Dependencies
209
- if: steps.cache.outputs.skip != 'true'
210
171
  run: pnpm install --frozen-lockfile
211
172
 
212
173
  # Static checks first — they read the source tree and must scan it CLEAN.
@@ -215,19 +176,16 @@ jobs:
215
176
  # Keep this group (typecheck → lint → prettier → vale → slop → bkit check) ahead of
216
177
  # the test/build group if you reorder.
217
178
  - name: Run Typecheck
218
- if: steps.cache.outputs.skip != 'true'
219
179
  env:
220
180
  TURBO_FORCE: ${{ steps.detect.outputs.turbo_force }}
221
181
  run: pnpm typecheck
222
182
 
223
183
  - name: Run Lint
224
- if: steps.cache.outputs.skip != 'true'
225
184
  env:
226
185
  TURBO_FORCE: ${{ steps.detect.outputs.turbo_force }}
227
186
  run: pnpm lint
228
187
 
229
188
  - name: Run Prettier
230
- if: steps.cache.outputs.skip != 'true'
231
189
  env:
232
190
  TURBO_FORCE: ${{ steps.detect.outputs.turbo_force }}
233
191
  run: pnpm format:check
@@ -236,7 +194,6 @@ jobs:
236
194
  # `pnpm lint:prose` guard-skips (write-good missing) and the prose gate is silently
237
195
  # dead. Pinned tarball + `vale sync` (else E100: write-good missing).
238
196
  - name: Install Vale
239
- if: steps.cache.outputs.skip != 'true'
240
197
  env:
241
198
  # renovate: datasource=github-releases depName=errata-ai/vale
242
199
  VALE_VERSION: "3.9.1"
@@ -256,18 +213,16 @@ jobs:
256
213
  done
257
214
 
258
215
  - name: Run Vale Prose Lint
259
- if: steps.cache.outputs.skip != 'true'
260
216
  run: pnpm lint:prose
261
217
 
262
218
  - name: Run Slop Scan
263
- if: steps.cache.outputs.skip != 'true'
264
219
  run: pnpm lint:slop
265
220
 
266
221
  # The ENFORCING slop gate (lint:slop above is an advisory full-scan that never fails).
267
222
  # PR-only: materialises the PR base as a worktree and fails on findings this PR ADDS or
268
223
  # WORSENS vs base. Needs fetch-depth: 0 (set on checkout) so the base SHA is present.
269
224
  - name: Run Slop Delta
270
- if: steps.cache.outputs.skip != 'true' && github.event_name == 'pull_request'
225
+ if: github.event_name == 'pull_request'
271
226
  env:
272
227
  BASE_SHA: ${{ github.event.pull_request.base.sha }}
273
228
  run: pnpm slop:delta "$BASE_SHA"
@@ -276,7 +231,6 @@ jobs:
276
231
  # (${{ }} expression syntax, shellcheck on run: blocks). A YAML linter accepts
277
232
  # workflows that are valid YAML but invalid GHA; actionlint catches that class.
278
233
  - name: Run actionlint
279
- if: steps.cache.outputs.skip != 'true'
280
234
  run: |
281
235
  # Script pinned to the v1.7.12 commit SHA (the git tag is mutable/forgeable); the binary version
282
236
  # is pinned separately via the 1.7.12 arg passed to the script below.
@@ -291,7 +245,6 @@ jobs:
291
245
  "$RUNNER_TEMP/actionlint" -color
292
246
 
293
247
  - name: Run bkit Check
294
- if: steps.cache.outputs.skip != 'true'
295
248
  run: pnpm bkit check
296
249
 
297
250
  # Dependency-audit gate: fails on a high or critical advisory in the lockfile that
@@ -299,7 +252,7 @@ jobs:
299
252
  # Self-skips when the guard is absent — a repo that did not adopt
300
253
  # scripts/ci/check-dependency-audit.mjs is a no-op. deployments.md § Dependency updaters.
301
254
  - name: Check Dependency Audit
302
- if: steps.cache.outputs.skip != 'true' && hashFiles('scripts/ci/check-dependency-audit.mjs') != ''
255
+ if: hashFiles('scripts/ci/check-dependency-audit.mjs') != ''
303
256
  run: node scripts/ci/check-dependency-audit.mjs
304
257
 
305
258
  # Capability-register freshness gate: rebuild the graph with graphify and fail when
@@ -310,13 +263,13 @@ jobs:
310
263
  # Push events only — a pull_request checkout is the MERGE ref, whose tree (base + head)
311
264
  # can differ from the head the register was built against: a false red no author can clear.
312
265
  - name: Setup uv
313
- if: steps.cache.outputs.skip != 'true' && github.event_name == 'push' && hashFiles('scripts/graphify/bkit-graphify.sh') != ''
266
+ if: github.event_name == 'push' && hashFiles('scripts/graphify/bkit-graphify.sh') != ''
314
267
  uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
315
268
  with:
316
269
  version: "0.13.0"
317
270
 
318
271
  - name: Check Capability Register
319
- if: steps.cache.outputs.skip != 'true' && github.event_name == 'push' && hashFiles('scripts/graphify/bkit-graphify.sh') != ''
272
+ if: github.event_name == 'push' && hashFiles('scripts/graphify/bkit-graphify.sh') != ''
320
273
  # graphify release pinned once: GRAPHIFY_SPEC in bkit-graphify.sh. Same release here,
321
274
  # in the pre-push gate and by hand.
322
275
  run: |
@@ -330,10 +283,8 @@ jobs:
330
283
  # and remote db push move out of this job when you adopt the scaffold below.
331
284
  bkit-tests-unit:
332
285
  runs-on: ubuntu-latest
333
- # bkit-tests-check reads both: cache_skip (a SHA-cache short-circuit asserts no count)
334
- # and tests_ran (the executed-test count the Run Unit Tests step writes).
286
+ # bkit-tests-check reads tests_ran (the executed-test count the Run Unit Tests step writes).
335
287
  outputs:
336
- cache_skip: ${{ steps.cache.outputs.skip }}
337
288
  tests_ran: ${{ steps.unit.outputs.ran }}
338
289
  # Env vars duplicated from bkit-tests-static's job-level `env:`.
339
290
  # See the comment above that `env:` in bkit-tests-static — NODE_OPTIONS is a
@@ -362,45 +313,7 @@ jobs:
362
313
  echo "🔊 [verbose ci] marker active — escalating log detail"
363
314
  echo "DEBUG=vercel:*,supabase:*" >> "$GITHUB_ENV"
364
315
 
365
- # [force build] / [force cache] run the suite even when this SHA already has a green run.
366
- - name: Check SHA Cache
367
- id: cache
368
- env:
369
- GH_TOKEN: ${{ github.token }}
370
- # User-controlled text (PR title) arrives via env: (runtime expansion,
371
- # injection-safe) — never inlined into the run: body.
372
- PR_TITLE: ${{ github.event.pull_request.title }}
373
- EVENT_NAME: ${{ github.event_name }}
374
- run: |
375
- if [ "$EVENT_NAME" = "pull_request" ]; then
376
- MSG="$PR_TITLE"
377
- else
378
- MSG=$(git log -1 --pretty=%B "$GITHUB_SHA" 2>/dev/null || echo "")
379
- fi
380
- case "$MSG" in
381
- *"[force build]"*|*"[force cache]"*)
382
- echo "skip=false" >> "$GITHUB_OUTPUT"
383
- echo "::notice::force marker present — ignoring SHA cache."
384
- exit 0 ;;
385
- esac
386
- SINCE=$(date -u -d '7 days ago' +%FT%TZ 2>/dev/null || date -u -v -7d +%FT%TZ)
387
- PRIOR=$(gh run list \
388
- --repo "$GITHUB_REPOSITORY" \
389
- --workflow "$GITHUB_WORKFLOW" \
390
- --status success \
391
- --limit 50 \
392
- --json headSha,createdAt \
393
- --jq "[.[] | select(.headSha == \"$GITHUB_SHA\") | select(.createdAt > \"$SINCE\")] | length" \
394
- 2>/dev/null || echo 0)
395
- if [ "${PRIOR:-0}" -gt 0 ]; then
396
- echo "skip=true" >> "$GITHUB_OUTPUT"
397
- echo "::notice::SHA $GITHUB_SHA has $PRIOR prior green run(s) since $SINCE — skipping suite."
398
- else
399
- echo "skip=false" >> "$GITHUB_OUTPUT"
400
- fi
401
-
402
316
  - name: Detect Direct Push
403
- if: steps.cache.outputs.skip != 'true'
404
317
  id: detect
405
318
  env:
406
319
  GH_TOKEN: ${{ github.token }}
@@ -427,7 +340,7 @@ jobs:
427
340
 
428
341
  # bkit-stub:auto-force-e2e — Auto-trigger the full lane (E2E etc.) for PRs touching sensitive paths. Orthogonal to the [force full] marker (sets needs_e2e, OR'd with should_run_full at the e2e gate). To enable: uncomment the step below and delete this stub header.
429
342
  # - name: Auto Force E2E for Sensitive Paths
430
- # if: github.event_name == 'pull_request' && steps.cache.outputs.skip != 'true'
343
+ # if: github.event_name == 'pull_request'
431
344
  # id: e2e-paths
432
345
  # run: |
433
346
  # git fetch origin "${{ github.base_ref }}" --depth=1 2>/dev/null || true
@@ -440,7 +353,6 @@ jobs:
440
353
  # done
441
354
 
442
355
  - name: Install Dependencies
443
- if: steps.cache.outputs.skip != 'true'
444
356
  run: pnpm install --frozen-lockfile
445
357
 
446
358
  # bkit-stub:supabase-migrate — REMOTE `db push` belongs in `bkit-tests-migration`, NOT here
@@ -451,7 +363,7 @@ jobs:
451
363
  # legacy single-job shape only (no migration lane yet): uncomment below, set SUPABASE_*
452
364
  # secrets, delete this stub header — then migrate the step into bkit-tests-migration ASAP.
453
365
  # - name: Apply Supabase Migrations to Dev
454
- # if: github.event_name == 'push' && github.ref == 'refs/heads/dev' && steps.cache.outputs.skip != 'true'
366
+ # if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
455
367
  # env:
456
368
  # SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
457
369
  # SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DEV_DB_PASSWORD }}
@@ -470,14 +382,12 @@ jobs:
470
382
  # * @live catalog-RPC (JOB 3) — validates the REAL deployed schema in bkit-tests-live-web. Recommended default once you have a deploy + @live tier (RLS/tenancy especially: a passing fixture check is not evidence prod is locked down).
471
383
  # To enable pgTAP: uncomment, add pgTAP files under supabase/tests/, delete this stub header.
472
384
  # - name: Run DB Tests (pgTAP)
473
- # if: steps.cache.outputs.skip != 'true'
474
385
  # run: pnpm dlx supabase db test # spins up the local DB and runs supabase/tests/*.sql via pg_prove
475
386
  # @live route: a SECURITY DEFINER, service_role-only catalog RPC (e.g. public.rls_coverage_gaps()) called over
476
387
  # REST — direct port-5432 from CI runners is IPv4-flaky. Home: bkit-tests-live-web. docs/testing.md § Schema-invariant DB checks.
477
388
 
478
389
  # bkit-stub:test-presence — Warn on packages with a test script but zero *.test.ts files. To enable: uncomment the step below and delete this stub header.
479
390
  # - name: Check Test Presence
480
- # if: steps.cache.outputs.skip != 'true'
481
391
  # run: |
482
392
  # for pkg in $(jq -r '.workspaces // [] | .[]' package.json 2>/dev/null) $(ls -d packages/*/ apps/*/ 2>/dev/null); do
483
393
  # [ -f "$pkg/package.json" ] || continue
@@ -489,7 +399,6 @@ jobs:
489
399
 
490
400
  - name: Run Unit Tests
491
401
  id: unit
492
- if: steps.cache.outputs.skip != 'true'
493
402
  env:
494
403
  TURBO_FORCE: ${{ steps.detect.outputs.turbo_force }}
495
404
  # Write the executed-test count as the step output `ran` so bkit-tests-check can
@@ -499,7 +408,6 @@ jobs:
499
408
  run: pnpm test
500
409
 
501
410
  - name: Run Integration Tests
502
- if: steps.cache.outputs.skip != 'true'
503
411
  env:
504
412
  TURBO_FORCE: ${{ steps.detect.outputs.turbo_force }}
505
413
  run: |
@@ -542,10 +450,9 @@ jobs:
542
450
  # and rarely drives every branch). For a real integration %, add --coverage.include='src/server/**'
543
451
  # (a CLI flag on the integration run, same idiom as --exclude above) to scope it to the integration
544
452
  # surface THEN set a floor, or ratchet from current — never a picked number. See docs/testing.md § Coverage on PRs.
545
- # 4. JOB-LEVEL permissions on bkit-tests-unit. Job-level REPLACES the workflow-level block (not additive), and the
546
- # Check SHA Cache step calls `gh run list`, so you MUST re-include actions: read or the cache step breaks:
453
+ # 4. JOB-LEVEL permissions on bkit-tests-unit. Job-level REPLACES the workflow-level block (not additive), so
454
+ # re-include contents: read or the checkout breaks:
547
455
  # permissions:
548
- # actions: read
549
456
  # contents: read
550
457
  # pull-requests: write # required to post/update the sticky PR coverage comments
551
458
  # SEPARATE LANES: this stub wires both reports into bkit-tests-unit (the combined starter). If you run
@@ -564,7 +471,7 @@ jobs:
564
471
  # # Every event, including a red unit run (reportOnFailure keeps the summary): writes the coverage table, with
565
472
  # # the floor as its target, to the job summary; comments on same-repo PRs only. No floor yet → drop
566
473
  # # vite-config-path (a missing file only warns, on every run).
567
- # if: ${{ !cancelled() && steps.cache.outputs.skip != 'true' && hashFiles('coverage/unit/coverage-summary.json') != '' }}
474
+ # if: ${{ !cancelled() && hashFiles('coverage/unit/coverage-summary.json') != '' }}
568
475
  # uses: davelosert/vitest-coverage-report-action@c4bbc33a89b7ace0e63d35f1f7d4bcee31155a73 # v2.13.0
569
476
  # with:
570
477
  # name: unit
@@ -576,7 +483,7 @@ jobs:
576
483
  # github-token: ${{ secrets.GITHUB_TOKEN }}
577
484
  # - name: Report Integration Coverage on PR
578
485
  # # hashFiles guard: skip cleanly when the repo has no integration tier (no coverage/integration report produced).
579
- # if: steps.cache.outputs.skip != 'true' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && hashFiles('coverage/integration/coverage-summary.json') != ''
486
+ # if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && hashFiles('coverage/integration/coverage-summary.json') != ''
580
487
  # uses: davelosert/vitest-coverage-report-action@c4bbc33a89b7ace0e63d35f1f7d4bcee31155a73 # v2.13.0
581
488
  # with:
582
489
  # name: integration
@@ -589,7 +496,7 @@ jobs:
589
496
  # Once bkit-tests-build-web publishes deployment_url, E2E reads TEST_URL from that output and this stub stays off.
590
497
  # To enable the pre-split shape: uncomment, set the host secrets, delete this header.
591
498
  # - name: Await Vercel Preview
592
- # if: github.event_name == 'pull_request' && steps.cache.outputs.skip != 'true'
499
+ # if: github.event_name == 'pull_request'
593
500
  # id: vercel
594
501
  # env:
595
502
  # VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
@@ -631,7 +538,7 @@ jobs:
631
538
  # surfaces them.
632
539
  # - name: Run E2E Tests
633
540
  # id: e2e
634
- # if: (steps.detect.outputs.should_run_full == 'true' || steps.e2e-paths.outputs.needs_e2e == 'true') && steps.cache.outputs.skip != 'true'
541
+ # if: (steps.detect.outputs.should_run_full == 'true' || steps.e2e-paths.outputs.needs_e2e == 'true')
635
542
  # env:
636
543
  # TARGET_URL: ${{ steps.vercel.outputs.target_url || 'http://localhost:3000' }}
637
544
  # run: |
@@ -662,13 +569,13 @@ jobs:
662
569
  # entryFilter/sourceFilter to the surface E2E is meant to cover, THEN ratchet from current — never a picked number.
663
570
  # See docs/testing.md § E2E coverage on PRs.
664
571
  # Permissions/forks/pin: this step runs in the SAME bkit-tests-unit job as bkit-stub:coverage, so it REUSES that
665
- # stub's job-level permissions block (pull-requests: write + actions: read + contents: read) — if you enable
572
+ # stub's job-level permissions block (pull-requests: write + contents: read) — if you enable
666
573
  # e2e-coverage WITHOUT the unit/integration coverage, add that same job-level block or the comment cannot post.
667
574
  # The head.repo == repo guard skips fork PRs (read-only GITHUB_TOKEN); the action is SHA-pinned to a commit
668
575
  # (# vX.Y.Z comment) per best practice, kept current by your updater (Renovate/Dependabot).
669
576
  # - name: Report E2E Coverage on PR
670
577
  # # Same gate as Run E2E Tests (coverage exists only if E2E ran); hashFiles skips repos that produced no E2E report.
671
- # if: (steps.detect.outputs.should_run_full == 'true' || steps.e2e-paths.outputs.needs_e2e == 'true') && steps.cache.outputs.skip != 'true' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && hashFiles('coverage/e2e/coverage-summary.json') != ''
578
+ # if: (steps.detect.outputs.should_run_full == 'true' || steps.e2e-paths.outputs.needs_e2e == 'true') && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && hashFiles('coverage/e2e/coverage-summary.json') != ''
672
579
  # uses: davelosert/vitest-coverage-report-action@c4bbc33a89b7ace0e63d35f1f7d4bcee31155a73 # v2.13.0
673
580
  # with:
674
581
  # name: e2e
@@ -719,17 +626,16 @@ jobs:
719
626
  - name: Assert Lanes Passed
720
627
  # The verdict is scripts/ci/check-capstone.mjs (copy it with this file from
721
628
  # .bkit/templates/scripts/ci/; check-capstone.test.mjs tests it). Every lane in LANES
722
- # must succeed; a lane with a *_RAN variable must have run more than 0 tests unless
723
- # cache_skip=true. EMPTY_COUNT=warn: a lane that writes no count yet warns instead of
724
- # failing; delete it once every counted lane writes one. Add each lane you adopt to
725
- # LANES and to its *_RESULT / *_RAN / *_CACHE_SKIP variables.
629
+ # must succeed; a lane with a *_RAN variable must have run more than 0 tests.
630
+ # EMPTY_COUNT=warn: a lane that writes no count yet warns instead of failing; delete it
631
+ # once every counted lane writes one. Add each lane you adopt to LANES and to its
632
+ # *_RESULT / *_RAN variables.
726
633
  env:
727
634
  LANES: static,unit
728
635
  EMPTY_COUNT: warn
729
636
  STATIC_RESULT: ${{ needs.bkit-tests-static.result }}
730
637
  UNIT_RESULT: ${{ needs.bkit-tests-unit.result }}
731
638
  UNIT_RAN: ${{ needs.bkit-tests-unit.outputs.tests_ran }}
732
- UNIT_CACHE_SKIP: ${{ needs.bkit-tests-unit.outputs.cache_skip }}
733
639
  run: |
734
640
  if [ ! -f scripts/ci/check-capstone.mjs ]; then
735
641
  echo "::error::scripts/ci/check-capstone.mjs is missing. Copy it from .bkit/templates/scripts/ci/ into scripts/ci/; without it bkit-tests-check cannot tell a green lane from a lane that ran no tests."
@@ -919,7 +825,7 @@ jobs:
919
825
  # (own checkout/setup/install); gate heavy steps on web_affected; emit integration_ran; the
920
826
  # bkit-stub:coverage integration report (report-only, name: integration) posts from HERE, not bkit-tests-unit.
921
827
  # bkit-tests-integration: needs:[bkit-tests-scope]; if: run_level != 'none'; timeout-minutes: 20
922
- # # own job-level permissions: { actions: read, contents: read, pull-requests: write } for the coverage comment.
828
+ # # own job-level permissions: { contents: read, pull-requests: write } for the coverage comment.
923
829
  # steps: Checkout / Setup pnpm+Node / Install → Build (if needed) → Run Integration Tests
924
830
  # (id: vitest; --continue so one failure doesn't mask the rest; --reporter=json → integration_ran) →
925
831
  # Report Integration Coverage on PR (davelosert, name: integration). Step detail: JOB 2 catalogue above.
@@ -7,10 +7,11 @@ name: bkit-cloud
7
7
  # (via the opencode CLI `run` subcommand) — run the same `/bkit-auto <phase> <arg>`
8
8
  # orchestrator against the committed `.claude/` / `.opencode/` config respectively.
9
9
  #
10
- # RUNTIME GATING — secret-presence auto-detect (in the context job):
11
- # - ANTHROPIC_API_KEY set → claude job runs.
10
+ # RUNTIME GATING — credential-presence auto-detect (in the context job):
11
+ # - ANTHROPIC_API_KEY secret set, OR both ANTHROPIC_FEDERATION_RULE_ID and
12
+ # ANTHROPIC_ORGANIZATION_ID repo variables set → claude job runs.
12
13
  # - OPENCODE_PROVIDER_KEY set → opencode job runs.
13
- # Both can run on one event (additive); a missing secret skips that job (zero
14
+ # Both can run on one event (additive); a missing credential skips that job (zero
14
15
  # billable runner minutes).
15
16
  #
16
17
  # Trigger surfaces:
@@ -21,8 +22,13 @@ name: bkit-cloud
21
22
  # - workflow_dispatch: pick ANY phase (ship|debug|design|plan|build) for an issue.
22
23
  # design/plan/build have no tracker-event trigger; they run only via dispatch.
23
24
  #
24
- # Required secrets (claude job): ANTHROPIC_API_KEY + Claude GitHub App (one-time
25
- # `/install-github-app` — grants `id-token: write` OIDC for claude-code-action@v1).
25
+ # Required credentials (claude job): Claude GitHub App (one-time `/install-github-app`;
26
+ # claude-code-action@v1 authenticates as the App via `id-token: write` OIDC) + ONE of:
27
+ # - ANTHROPIC_API_KEY repo secret, or
28
+ # - workload identity federation (keyless): ANTHROPIC_FEDERATION_RULE_ID +
29
+ # ANTHROPIC_ORGANIZATION_ID repo variables (+ optional ANTHROPIC_SERVICE_ACCOUNT_ID /
30
+ # ANTHROPIC_WORKSPACE_ID) from a Claude Console federation rule. A set
31
+ # ANTHROPIC_API_KEY secret wins over federation — delete it when switching.
26
32
  # Required secrets (opencode job): OPENCODE_PROVIDER_KEY (any provider key the
27
33
  # committed .opencode/opencode.json references; fan-out maps it to known env var names).
28
34
  # Required tracker label on the issue: `bkit:auto` (opt-in) for the CI-driven path.
@@ -115,20 +121,28 @@ jobs:
115
121
  phase: ${{ steps.ctx.outputs.phase }}
116
122
  arg: ${{ steps.ctx.outputs.arg }}
117
123
  steps:
118
- # A runner job whose secret is missing is a no-op; with neither secret set, nothing
119
- # below runs (no counter row, no checkout).
120
- - name: Check runner secrets
124
+ # A runner job whose credential is missing is a no-op; with neither job enabled,
125
+ # nothing below runs (no counter row, no checkout).
126
+ - name: Check runner credentials
121
127
  id: gate
122
128
  env:
123
129
  ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
130
+ ANTHROPIC_FEDERATION_RULE_ID: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
131
+ ANTHROPIC_ORGANIZATION_ID: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
124
132
  OPENCODE_PROVIDER_KEY: ${{ secrets.OPENCODE_PROVIDER_KEY }}
125
133
  run: |
126
134
  claude=false
127
135
  opencode=false
128
136
  if [ -n "$ANTHROPIC_API_KEY" ]; then
129
137
  claude=true
138
+ elif [ -n "$ANTHROPIC_FEDERATION_RULE_ID" ] && [ -n "$ANTHROPIC_ORGANIZATION_ID" ]; then
139
+ claude=true
140
+ elif [ -n "$ANTHROPIC_FEDERATION_RULE_ID" ]; then
141
+ echo "::notice::ANTHROPIC_ORGANIZATION_ID repo variable not set — federation needs it alongside ANTHROPIC_FEDERATION_RULE_ID; claude job no-op."
142
+ elif [ -n "$ANTHROPIC_ORGANIZATION_ID" ]; then
143
+ echo "::notice::ANTHROPIC_FEDERATION_RULE_ID repo variable not set — federation needs it alongside ANTHROPIC_ORGANIZATION_ID; claude job no-op."
130
144
  else
131
- echo "::notice::ANTHROPIC_API_KEY not set — claude job no-op."
145
+ echo "::notice::Neither the ANTHROPIC_API_KEY secret nor the ANTHROPIC_FEDERATION_RULE_ID + ANTHROPIC_ORGANIZATION_ID repo variables are set — claude job no-op."
132
146
  fi
133
147
  if [ -n "$OPENCODE_PROVIDER_KEY" ]; then
134
148
  opencode=true
@@ -176,6 +190,13 @@ jobs:
176
190
  HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
177
191
  run: |
178
192
  set -euo pipefail
193
+ # Cloud runs serve the GitHub tracker only: Linear cloud runs start from Cursor's
194
+ # Linear integration, and Jira runs locally only. Unset tracker → continue.
195
+ TRACKER=$(sed -n 's/.*"issueTracker"[[:space:]]*:[[:space:]]*"\([a-z]*\)".*/\1/p' package.json 2>/dev/null | head -1 || true)
196
+ if [ -n "$TRACKER" ] && [ "$TRACKER" != "github" ]; then
197
+ echo "::notice::bkit.issueTracker is '$TRACKER' — bkit-cloud.yml serves the GitHub tracker only; no-op exit."
198
+ echo "skip=true" >> "$GITHUB_OUTPUT"; exit 0
199
+ fi
179
200
  if [ "$EVENT" = "workflow_dispatch" ]; then
180
201
  # Dispatched: phase + issue come straight from inputs.
181
202
  PHASE="$IN_PHASE"
@@ -440,8 +461,8 @@ jobs:
440
461
  } >> "$GITHUB_OUTPUT"
441
462
 
442
463
  # ---------------------------------------------------------------------------
443
- # claude job — dispatch via claude-code-action@v1 (ANTHROPIC_API_KEY required).
444
- # Runs only when the context job found ANTHROPIC_API_KEY set and resolved a phase.
464
+ # claude job — dispatch via claude-code-action@v1 (ANTHROPIC_API_KEY or federation).
465
+ # Runs only when the context job found a claude credential and resolved a phase.
445
466
  # OIDC auth via Claude GitHub App (id-token: write); requires one-time
446
467
  # `/install-github-app` in the consumer repo.
447
468
  # ---------------------------------------------------------------------------
@@ -456,7 +477,7 @@ jobs:
456
477
  issues: write
457
478
  actions: read
458
479
  # id-token: write — required for claude-code-action@v1 to authenticate as the
459
- # Claude GitHub App via OIDC (getOidcToken).
480
+ # Claude GitHub App via OIDC (getOidcToken), and for the federation token exchange.
460
481
  id-token: write
461
482
  steps:
462
483
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -501,6 +522,13 @@ jobs:
501
522
  # orchestrator. GitHub MCP surface is always available; this workflow is
502
523
  # GitHub-tracker only (cloud=claude requires tracker=github).
503
524
  claude_args: "--allowed-tools=Bash,Edit,Write,Read,Grep,Glob,WebFetch,Skill,mcp__github__*"
525
+ # Workload identity federation: the action exchanges this job's GitHub OIDC token
526
+ # for a short-lived Claude API token. Unset variables pass empty; a set
527
+ # ANTHROPIC_API_KEY secret takes precedence.
528
+ anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
529
+ anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
530
+ anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
531
+ anthropic_workspace_id: ${{ vars.ANTHROPIC_WORKSPACE_ID }}
504
532
  env:
505
533
  ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
506
534
  GH_TOKEN: ${{ github.token }}
@@ -3,10 +3,10 @@
3
3
  # bkit install does not write this file and does not overwrite a copy.
4
4
  #
5
5
  # FAST local gate only: format staged files (seconds). Heavier gates
6
- # (typecheck/unit/format:check/prose) and the enforcing slop gate (slop:delta) are in
7
- # pre-push; integration/E2E/@live run ONLY in CI (bkit-tests / bkit-tests-live, enforced
8
- # by bkit-tests-check) — see bkit-ci.yml § FULL CI SCAFFOLD REFERENCE. Rule: anything needing
9
- # a deployed URL, a DB, or >a few seconds belongs in a CI tier, not a hook. (lint:slop is `slop-scan scan` — report-only, never
6
+ # (typecheck/unit/format:check/prose), the enforcing slop gate (slop:delta) and the
7
+ # integration tier are in pre-push; E2E/@live run ONLY in CI (bkit-tests / bkit-tests-live,
8
+ # enforced by bkit-tests-check) — see bkit-ci.yml § FULL CI SCAFFOLD REFERENCE. Rule: nothing
9
+ # here that pre-push runs again, and nothing that takes more than a few seconds. (lint:slop is `slop-scan scan` — report-only, never
10
10
  # fails; the gate that fails on NEW findings is `slop:delta`, which runs in pre-push.)
11
11
  #
12
12
  # WHAT it runs lives in package.json `bkit:gate:format`, not here — the same script