@cbartens/bkit 5.2.4 → 5.3.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.
- package/.bkit/README.md +26 -11
- package/.bkit/core/.agents/context.md +1 -1
- package/.bkit/core/.agents/docs.md +1 -1
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +1 -1
- package/.bkit/core/.agents/rules.md +11 -0
- package/.bkit/core/.bkit/README.md +25 -10
- package/.bkit/core/.bkit/cloud.md +9 -8
- package/.bkit/core/.bkit/comparison.md +68 -345
- package/.bkit/core/.bkit/install.md +12 -6
- package/.bkit/core/.bkit/lite.md +73 -0
- package/.bkit/core/.bkit/pipeline.md +345 -0
- package/.bkit/core/.bkit/prompts.md +88 -73
- package/.bkit/core/.bkit/providers.md +41 -22
- package/.bkit/core/.bkit/templates.md +106 -17
- package/.bkit/core/.bkit/trackers.md +47 -1
- package/.bkit/core/.bkit/workflows.md +44 -43
- package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +1 -1
- package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +7 -4
- package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +8 -5
- package/.bkit/core/docs/templates/bkit-audit-adoption.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-dependencies.md +14 -10
- package/.bkit/core/docs/templates/bkit-audit-llm.md +20 -14
- package/.bkit/core/docs/templates/bkit-audit-prompts.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-red-team.md +10 -8
- package/.bkit/core/docs/templates/bkit-audit-security.md +3 -3
- package/.bkit/core/docs/templates/bkit-audit-testing.md +4 -3
- package/.bkit/core/docs/templates/bkit-plan.md +8 -6
- package/.bkit/core/engine/checks/after/auth.ts +9 -9
- package/.bkit/core/engine/checks/after/ci-yml.ts +14 -12
- package/.bkit/core/engine/checks/after/github.ts +29 -120
- package/.bkit/core/engine/checks/after/index.ts +2 -2
- package/.bkit/core/engine/checks/after/managed.ts +8 -28
- package/.bkit/core/engine/checks/after/tools.ts +3 -15
- package/.bkit/core/engine/checks/before/context-fetch.ts +1 -21
- package/.bkit/core/engine/checks/before/index.ts +7 -43
- package/.bkit/core/engine/checks/before/mcp.ts +17 -8
- package/.bkit/core/engine/checks/before/repo.ts +9 -12
- package/.bkit/core/engine/checks/status-holes.ts +4 -5
- package/.bkit/core/engine/checks/tips/catalogue.ts +60 -24
- package/.bkit/core/engine/checks/tips/detect.ts +45 -2
- package/.bkit/core/engine/checks/tips/index.ts +37 -8
- package/.bkit/core/engine/cli.ts +39 -16
- package/.bkit/core/engine/commands/analysis.ts +36 -26
- package/.bkit/core/engine/commands/comply.ts +17 -16
- package/.bkit/core/engine/commands/harvest.ts +12 -12
- package/.bkit/core/engine/commands/install/doctor.ts +57 -28
- package/.bkit/core/engine/commands/install/install.ts +62 -126
- package/.bkit/core/engine/commands/install/uninstall.ts +191 -33
- package/.bkit/core/engine/commands/install/upgrade.ts +49 -43
- package/.bkit/core/engine/commands/lib.ts +35 -10
- package/.bkit/core/engine/commands/tips.ts +8 -5
- package/.bkit/core/engine/commands/workflow/branches.ts +4 -4
- package/.bkit/core/engine/commands/workflow/counters.ts +21 -12
- package/.bkit/core/engine/commands/workflow/fids.ts +46 -0
- package/.bkit/core/engine/commands/workflow/ledgers.ts +3 -1
- package/.bkit/core/engine/commands/workflow/prs.ts +4 -2
- package/.bkit/core/engine/commands/workflow/repo.ts +2 -2
- package/.bkit/core/engine/commands/workflow/roadmap.ts +4 -3
- package/.bkit/core/engine/commands/workflow/runs.ts +8 -7
- package/.bkit/core/engine/commands/workflow/steps.ts +1 -0
- package/.bkit/core/engine/commands/workflow/tests.ts +17 -5
- package/.bkit/core/engine/commands/workflow/workflows.ts +15 -14
- package/.bkit/core/engine/commands/workflow/workstreams.ts +2 -1
- package/.bkit/core/engine/commands/workflow/worktrees.ts +13 -5
- package/.bkit/core/engine/install/cloud-env.ts +10 -31
- package/.bkit/core/engine/install/manifest.ts +14 -7
- package/.bkit/core/engine/install/modules/antigravity.ts +15 -26
- package/.bkit/core/engine/install/modules/claude.ts +20 -28
- package/.bkit/core/engine/install/modules/cloud.ts +5 -2
- package/.bkit/core/engine/install/modules/codex.ts +15 -29
- package/.bkit/core/engine/install/modules/core.ts +91 -70
- package/.bkit/core/engine/install/modules/cursor.ts +6 -20
- package/.bkit/core/engine/install/modules/index.ts +7 -1
- package/.bkit/core/engine/install/modules/opencode.ts +48 -70
- package/.bkit/core/engine/install/network-allowlist.ts +73 -0
- package/.bkit/core/engine/install/placeholders.ts +3 -18
- package/.bkit/core/engine/install/write.ts +59 -12
- package/.bkit/core/engine/ledgers/telemetry.ts +6 -4
- package/.bkit/core/engine/render/hosts.ts +47 -67
- package/.bkit/core/engine/render/models.ts +29 -11
- package/.bkit/core/engine/shared/branches.ts +13 -0
- package/.bkit/core/engine/shared/egress.ts +3 -3
- package/.bkit/core/engine/shared/json.ts +18 -1
- package/.bkit/core/engine/shared/package-json.ts +63 -0
- package/.bkit/core/engine/shared/package-roots.ts +0 -10
- package/.bkit/core/engine/shared/protected-paths.ts +5 -130
- package/.bkit/core/engine/shared/settings.ts +36 -0
- package/.bkit/core/hooks/antigravity-hook.js +1 -0
- package/.bkit/core/hooks/guardrails-shell.js +186 -40
- package/.bkit/core/hooks/guardrails-tiers.js +5 -78
- package/.bkit/core/prompts/bkit-audit-generate.md +60 -7
- package/.bkit/core/prompts/bkit-build-challenge-1.md +1 -1
- package/.bkit/core/prompts/bkit-build-challenge-2.md +1 -1
- package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +1 -1
- package/.bkit/core/prompts/bkit-build-challenge-remediate.md +1 -1
- package/.bkit/core/prompts/bkit-build-challenge-tests.md +1 -1
- package/.bkit/core/prompts/bkit-build-install-skills.md +1 -1
- package/.bkit/core/prompts/bkit-build-plan-current.md +1 -1
- package/.bkit/core/prompts/bkit-build-plan-execute.md +4 -4
- package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +1 -1
- package/.bkit/core/prompts/bkit-build-plan-verify.md +2 -2
- package/.bkit/core/prompts/bkit-debug-abort-handover.md +1 -1
- package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +1 -1
- package/.bkit/core/prompts/bkit-debug-failure-remediate.md +1 -1
- package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +78 -0
- package/.bkit/core/prompts/bkit-debug-failure-soak.md +1 -1
- package/.bkit/core/prompts/bkit-debug-summary.md +3 -3
- package/.bkit/core/prompts/bkit-design-spike.md +1 -1
- package/.bkit/core/prompts/bkit-design-summary.md +2 -2
- package/.bkit/core/prompts/bkit-design-update.md +1 -1
- package/.bkit/core/prompts/bkit-plan-complexity-check.md +1 -1
- package/.bkit/core/prompts/bkit-plan-generate.md +1 -1
- package/.bkit/core/prompts/bkit-plan-scope-check-1.md +1 -1
- package/.bkit/core/prompts/bkit-plan-scope-check-2.md +1 -1
- package/.bkit/core/prompts/bkit-plan-summary.md +1 -1
- package/.bkit/core/prompts/bkit-plan-update.md +1 -1
- package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +1 -1
- package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +1 -1
- package/.bkit/core/prompts/bkit-ship-update-docs.md +1 -1
- package/.bkit/core/prompts/bkit-utility-update-decisions.md +9 -2
- package/.bkit/core/prompts/bkit-utility-update-deferrals.md +9 -2
- package/.bkit/core/prompts/bkit-utility-update-documentation.md +2 -1
- package/.bkit/core/prompts/bkit-utility-update-failures.md +9 -2
- package/.bkit/core/prompts/bkit-utility-update-knowledge.md +9 -2
- package/.bkit/core/prompts/bkit-utility-update-roadmap.md +11 -4
- package/.bkit/core/workflows/bkit-build.md +3 -3
- package/.bkit/core/workflows/bkit-debug.md +69 -33
- package/.bkit/core/workflows/bkit-design.md +2 -2
- package/.bkit/core/workflows/bkit-plan.md +11 -4
- package/.bkit/core/workflows/bkit-ship.md +5 -5
- package/.bkit/shared/.claude/bkit-cloud.md +46 -13
- package/.bkit/shared/.claude/settings.json +18 -0
- package/.bkit/shared/.cursor/mcp.json +2 -1
- package/.bkit/shared/.opencode/opencode.json +19 -1
- package/.bkit/shared/docs/deployments.md +20 -4
- package/.bkit/shared/docs/security.md +8 -6
- package/.bkit/shared/docs/testing.md +9 -5
- package/.bkit/templates/.cursor/Dockerfile +30 -16
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-bug.yml +78 -0
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-change.yml +91 -0
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-idea.yml +56 -0
- package/.bkit/templates/.github/renovate.json5 +91 -12
- package/.bkit/templates/.github/workflows/bkit-ci.yml +66 -53
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +3 -1
- package/.bkit/templates/.github/workflows/bkit-renovate.yml +8 -1
- package/.bkit/templates/.github/workflows/bkit-trivy.yml +67 -0
- package/.bkit/templates/.husky/pre-push +8 -3
- package/.bkit/templates/.oxlintrc.json +21 -0
- package/.bkit/templates/docs/capabilities.md +1 -1
- package/.bkit/templates/scripts/ci/check-capstone.mjs +176 -0
- package/.bkit/templates/scripts/ci/check-capstone.test.mjs +311 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-eager.py +2 -2
- package/.bkit/templates/scripts/graphify/bkit-graph-imports.py +43 -20
- package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +33 -11
- package/.bkit/templates/scripts/graphify/bkit-graph-repair.py +3 -2
- package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +5 -5
- package/.bkit/templates/scripts/graphify/bkit-graphify.sh +79 -19
- package/CHANGELOG.md +50 -3
- package/README.md +258 -129
- package/dist/checks/after/auth.js +10 -11
- package/dist/checks/after/ci-yml.js +11 -14
- package/dist/checks/after/github.js +32 -125
- package/dist/checks/after/index.js +3 -2
- package/dist/checks/after/managed.js +8 -24
- package/dist/checks/after/tools.js +3 -16
- package/dist/checks/before/context-fetch.js +1 -21
- package/dist/checks/before/index.js +6 -42
- package/dist/checks/before/mcp.js +14 -9
- package/dist/checks/before/repo.js +8 -11
- package/dist/checks/status-holes.js +5 -6
- package/dist/checks/tips/catalogue.js +51 -18
- package/dist/checks/tips/detect.js +41 -2
- package/dist/checks/tips/index.js +25 -5
- package/dist/cli.js +34 -14
- package/dist/commands/analysis.js +21 -5
- package/dist/commands/comply.js +20 -18
- package/dist/commands/harvest.js +12 -13
- package/dist/commands/install/doctor.js +55 -23
- package/dist/commands/install/install.js +62 -118
- package/dist/commands/install/uninstall.js +165 -31
- package/dist/commands/install/upgrade.js +46 -39
- package/dist/commands/lib.js +32 -10
- package/dist/commands/tips.js +6 -3
- package/dist/commands/workflow/branches.js +3 -5
- package/dist/commands/workflow/counters.js +17 -7
- package/dist/commands/workflow/fids.js +39 -0
- package/dist/commands/workflow/ledgers.js +3 -1
- package/dist/commands/workflow/prs.js +3 -3
- package/dist/commands/workflow/repo.js +2 -2
- package/dist/commands/workflow/roadmap.js +4 -4
- package/dist/commands/workflow/runs.js +5 -5
- package/dist/commands/workflow/steps.js +1 -0
- package/dist/commands/workflow/tests.js +16 -3
- package/dist/commands/workflow/workflows.js +15 -15
- package/dist/commands/workflow/workstreams.js +2 -1
- package/dist/commands/workflow/worktrees.js +4 -5
- package/dist/install/cloud-env.js +10 -23
- package/dist/install/manifest.js +14 -7
- package/dist/install/modules/antigravity.js +15 -26
- package/dist/install/modules/claude.js +17 -21
- package/dist/install/modules/cloud.js +6 -2
- package/dist/install/modules/codex.js +15 -29
- package/dist/install/modules/core.js +82 -63
- package/dist/install/modules/cursor.js +6 -9
- package/dist/install/modules/index.js +6 -1
- package/dist/install/modules/opencode.js +41 -72
- package/dist/install/network-allowlist.js +62 -0
- package/dist/install/placeholders.js +3 -16
- package/dist/install/write.js +55 -15
- package/dist/ledgers/telemetry.js +5 -4
- package/dist/render/hosts.js +30 -55
- package/dist/render/models.js +20 -9
- package/dist/shared/branches.js +11 -0
- package/dist/shared/egress.js +0 -2
- package/dist/shared/json.js +14 -0
- package/dist/shared/package-json.js +61 -0
- package/dist/shared/package-roots.js +0 -8
- package/dist/shared/protected-paths.js +5 -122
- package/dist/shared/settings.js +18 -1
- package/package.json +21 -17
- package/.bkit/core/.agents/shortcuts.md +0 -73
|
@@ -30,7 +30,7 @@ concurrency:
|
|
|
30
30
|
|
|
31
31
|
jobs:
|
|
32
32
|
# ── bkit-tests-static ────────────────────────────────────────────────────
|
|
33
|
-
# Static-analysis lane: typecheck, format, prose lint, slop, actionlint,
|
|
33
|
+
# Static-analysis lane: typecheck, lint, format, prose lint, slop, actionlint,
|
|
34
34
|
# bkit check. Runs on a CLEAN tree (no test artifacts). Parallel sibling of
|
|
35
35
|
# bkit-tests-unit — wall-clock = MAX(lane).
|
|
36
36
|
bkit-tests-static:
|
|
@@ -64,13 +64,13 @@ jobs:
|
|
|
64
64
|
# Node/TS toolchain region. On a non-Node repo, replace these steps with your
|
|
65
65
|
# stack's setup / install commands (and the typecheck / lint / test steps below with
|
|
66
66
|
# its own). Replace `{{NODE_VERSION}}` with your Node major (`.bkit/templates.md`).
|
|
67
|
-
- uses: actions/setup-node@
|
|
67
|
+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
68
68
|
with:
|
|
69
69
|
node-version: {{NODE_VERSION}}
|
|
70
70
|
|
|
71
71
|
# Pnpm version is resolved from the consumer's package.json#packageManager (single SoT).
|
|
72
72
|
# Do NOT add `with: version:` here — pnpm/action-setup errors when both are set.
|
|
73
|
-
- uses: pnpm/action-setup@
|
|
73
|
+
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
|
|
74
74
|
|
|
75
75
|
# Under [verbose ci]: propagate DEBUG to all subsequent steps via $GITHUB_ENV. Note
|
|
76
76
|
# that steps with their own `env:` block override $GITHUB_ENV — those steps must
|
|
@@ -212,7 +212,7 @@ jobs:
|
|
|
212
212
|
# Static checks first — they read the source tree and must scan it CLEAN.
|
|
213
213
|
# Vitest/build run AFTER (below): they write coverage, dist/, and other
|
|
214
214
|
# artifacts that would otherwise pollute the Slop Scan and bkit check inputs.
|
|
215
|
-
# Keep this group (typecheck → prettier → vale → slop → bkit check) ahead of
|
|
215
|
+
# Keep this group (typecheck → lint → prettier → vale → slop → bkit check) ahead of
|
|
216
216
|
# the test/build group if you reorder.
|
|
217
217
|
- name: Run Typecheck
|
|
218
218
|
if: steps.cache.outputs.skip != 'true'
|
|
@@ -220,6 +220,12 @@ jobs:
|
|
|
220
220
|
TURBO_FORCE: ${{ steps.detect.outputs.turbo_force }}
|
|
221
221
|
run: pnpm typecheck
|
|
222
222
|
|
|
223
|
+
- name: Run Lint
|
|
224
|
+
if: steps.cache.outputs.skip != 'true'
|
|
225
|
+
env:
|
|
226
|
+
TURBO_FORCE: ${{ steps.detect.outputs.turbo_force }}
|
|
227
|
+
run: pnpm lint
|
|
228
|
+
|
|
223
229
|
- name: Run Prettier
|
|
224
230
|
if: steps.cache.outputs.skip != 'true'
|
|
225
231
|
env:
|
|
@@ -232,6 +238,7 @@ jobs:
|
|
|
232
238
|
- name: Install Vale
|
|
233
239
|
if: steps.cache.outputs.skip != 'true'
|
|
234
240
|
env:
|
|
241
|
+
# renovate: datasource=github-releases depName=errata-ai/vale
|
|
235
242
|
VALE_VERSION: "3.9.1"
|
|
236
243
|
# sha256 of vale_${VALE_VERSION}_Linux_64-bit.tar.gz (from the release's checksums.txt).
|
|
237
244
|
# Bump alongside VALE_VERSION; verified before extract so a tampered/CDN-swapped tarball fails closed.
|
|
@@ -276,6 +283,7 @@ jobs:
|
|
|
276
283
|
curl -sSfL --retry 3 --retry-all-errors https://raw.githubusercontent.com/rhysd/actionlint/914e7df21a07ef503a81201c76d2b11c789d3fca/scripts/download-actionlint.bash -o "$RUNNER_TEMP/download-actionlint.bash"
|
|
277
284
|
# download-actionlint.bash fetches the binary from GitHub releases — retry to survive a transient CDN/network blip.
|
|
278
285
|
for i in 1 2 3; do
|
|
286
|
+
# renovate: datasource=github-releases depName=rhysd/actionlint
|
|
279
287
|
bash "$RUNNER_TEMP/download-actionlint.bash" 1.7.12 "$RUNNER_TEMP" && break
|
|
280
288
|
[ "$i" = 3 ] && { echo "::error::actionlint download failed after 3 attempts"; exit 1; }
|
|
281
289
|
echo "::warning::actionlint download attempt $i failed — retrying in 5s"; sleep 5
|
|
@@ -298,22 +306,21 @@ jobs:
|
|
|
298
306
|
# docs/capabilities.md is not what this tree produces, so the register cannot drift
|
|
299
307
|
# silently. Self-skips when the graphify wrapper is absent — a repo that did not adopt
|
|
300
308
|
# scripts/graphify/ is a no-op. graphify is pinned because its output must match the
|
|
301
|
-
# committed register to the byte: bump GRAPHIFY_SPEC and refresh the register together.
|
|
309
|
+
# committed register to the byte: bump GRAPHIFY_SPEC (bkit-graphify.sh) and refresh the register together.
|
|
302
310
|
# Push events only — a pull_request checkout is the MERGE ref, whose tree (base + head)
|
|
303
311
|
# can differ from the head the register was built against: a false red no author can clear.
|
|
304
312
|
- name: Setup uv
|
|
305
313
|
if: steps.cache.outputs.skip != 'true' && github.event_name == 'push' && hashFiles('scripts/graphify/bkit-graphify.sh') != ''
|
|
306
314
|
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
|
|
307
315
|
with:
|
|
308
|
-
version: "0.
|
|
316
|
+
version: "0.13.0"
|
|
309
317
|
|
|
310
318
|
- name: Check Capability Register
|
|
311
319
|
if: steps.cache.outputs.skip != 'true' && github.event_name == 'push' && hashFiles('scripts/graphify/bkit-graphify.sh') != ''
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
GRAPHIFY_SPEC: "graphifyy[sql]==0.9.50"
|
|
320
|
+
# graphify release pinned once: GRAPHIFY_SPEC in bkit-graphify.sh. Same release here,
|
|
321
|
+
# in the pre-push gate and by hand.
|
|
315
322
|
run: |
|
|
316
|
-
uv tool install "$
|
|
323
|
+
uv tool install "$(bash scripts/graphify/bkit-graphify.sh spec)"
|
|
317
324
|
# `uv tool install` drops the shim in ~/.local/bin, not on this step's PATH.
|
|
318
325
|
export PATH="$HOME/.local/bin:$PATH"
|
|
319
326
|
pnpm graph:check
|
|
@@ -341,11 +348,11 @@ jobs:
|
|
|
341
348
|
# Full history needed for E2E / supabase stubs when enabled.
|
|
342
349
|
fetch-depth: 0
|
|
343
350
|
|
|
344
|
-
- uses: actions/setup-node@
|
|
351
|
+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
345
352
|
with:
|
|
346
353
|
node-version: {{NODE_VERSION}}
|
|
347
354
|
|
|
348
|
-
- uses: pnpm/action-setup@
|
|
355
|
+
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
|
|
349
356
|
|
|
350
357
|
# NODE_OPTIONS is a job-level `env:` key above, never a $GITHUB_ENV write — the runner
|
|
351
358
|
# rejects that write and still reports success. See bkit-tests-static's block comment.
|
|
@@ -502,7 +509,7 @@ jobs:
|
|
|
502
509
|
echo "::warning::test:integration script not found in package.json — skipping integration tests"
|
|
503
510
|
fi
|
|
504
511
|
|
|
505
|
-
# bkit-stub:coverage — Report vitest coverage on PRs via davelosert/vitest-coverage-report-action (free, runs entirely inside Actions with GITHUB_TOKEN — no third-party service, safe for private repos). Report-only by default: nothing fails the build until YOU set a threshold. PER-TIER: unit and integration are measured and commented SEPARATELY (a single merged number lets integration mask a hollow unit suite). To enable: make the edits below, uncomment the two steps, and delete this stub header.
|
|
512
|
+
# bkit-stub:coverage — Report vitest coverage on PRs and in every run's job summary via davelosert/vitest-coverage-report-action (free, runs entirely inside Actions with GITHUB_TOKEN — no third-party service, safe for private repos). Report-only by default: nothing fails the build until YOU set a threshold. PER-TIER: unit and integration are measured and commented SEPARATELY (a single merged number lets integration mask a hollow unit suite). To enable: make the edits below, uncomment the two steps, and delete this stub header.
|
|
506
513
|
# 1. devDep + config. Add `@vitest/coverage-v8` (pin to your vitest major) and a coverage block in vitest.config:
|
|
507
514
|
# coverage: {
|
|
508
515
|
# provider: 'v8',
|
|
@@ -516,12 +523,20 @@ jobs:
|
|
|
516
523
|
# Wire these into the "Run Unit Tests" step(s) above (or your test / test:integration scripts). Separate dirs
|
|
517
524
|
# also avoid the clobber a second same-dir --coverage run would cause (last-writer-wins, not a merge).
|
|
518
525
|
# 3. Thresholds (opt-in) live PER TIER, never merged:
|
|
519
|
-
# UNIT = the gate.
|
|
520
|
-
#
|
|
521
|
-
#
|
|
522
|
-
#
|
|
523
|
-
#
|
|
524
|
-
#
|
|
526
|
+
# UNIT = the gate. Put coverage.thresholds.branches in a vitest.unit.config.ts that ONLY your unit run loads
|
|
527
|
+
# (`vitest run -c vitest.unit.config.ts --coverage …`); branches is the meaningful floor (line/statement
|
|
528
|
+
# % overstates confidence). Set it to your CURRENT coverage and ratchet up:
|
|
529
|
+
# import { defineConfig, mergeConfig } from 'vitest/config'
|
|
530
|
+
# import base from './vitest.config'
|
|
531
|
+
# export default mergeConfig(base, defineConfig({ test: { coverage: { thresholds: {
|
|
532
|
+
# branches: 70,
|
|
533
|
+
# } } } }))
|
|
534
|
+
# vitest coverage is per-RUN (root config), NOT per-project — `projects` does NOT scope it, and a
|
|
535
|
+
# `thresholds` block in vitest.config reds BOTH runs. One file feeds both readers: vitest gates on it,
|
|
536
|
+
# and the Report Unit Coverage step's vite-config-path shows it as the 🎯 target. The action reads
|
|
537
|
+
# that file as raw TEXT and regex-matches `<metric>: <number>`: keep the floor on one unquoted line
|
|
538
|
+
# and write no other metric name + colon + number in the file, or the target silently goes wrong.
|
|
539
|
+
# A --coverage.thresholds.branches=<n> CLI flag also gates, but the report cannot read it.
|
|
525
540
|
# INTEGRATION = REPORT-ONLY, no threshold. Gate integration on EXECUTION (the capstone's integration_ran > 0),
|
|
526
541
|
# not a %: a whole-repo integration % is denominator-noise (it covers boundaries/flows, not pure logic,
|
|
527
542
|
# and rarely drives every branch). For a real integration %, add --coverage.include='src/server/**'
|
|
@@ -537,26 +552,32 @@ jobs:
|
|
|
537
552
|
# integration as its OWN lane (bkit-tests-integration — the shape bkit's own CI + consumer repos run; see the
|
|
538
553
|
# FULL CI SCAFFOLD REFERENCE below), move the integration coverage run + its Report step + a pull-requests: write
|
|
539
554
|
# permissions block into THAT lane instead. Each lane posts its own comment; the distinct name: keeps them apart.
|
|
540
|
-
# Fork PRs: GITHUB_TOKEN is read-only for PRs from a fork, so
|
|
541
|
-
#
|
|
555
|
+
# Fork PRs: GITHUB_TOKEN is read-only for PRs from a fork, so commenting fails — the unit step sets comment-on: none
|
|
556
|
+
# there (its job summary still lands) and the integration step's head.repo == repo guard skips it (or adopt the
|
|
557
|
+
# action's workflow_run two-workflow pattern to comment on forks).
|
|
542
558
|
# Monorepo: set working-directory so the action finds the right report. Base-branch delta (up/down vs the default
|
|
543
559
|
# branch) needs the base's coverage-summary.json — see the action's json-summary-compare-path input (optional).
|
|
544
560
|
# The action is SHA-pinned to a commit (# vX.Y.Z comment) per best practice; your updater (Renovate/Dependabot,
|
|
545
561
|
# github-actions ecosystem) keeps the pin current — refresh the SHA if you enable this on a newer release.
|
|
546
562
|
# A distinct name: keys each sticky comment so the two do not collide.
|
|
547
|
-
# - name: Report Unit Coverage
|
|
548
|
-
#
|
|
549
|
-
#
|
|
563
|
+
# - name: Report Unit Coverage
|
|
564
|
+
# # Every event, including a red unit run (reportOnFailure keeps the summary): writes the coverage table, with
|
|
565
|
+
# # the floor as its target, to the job summary; comments on same-repo PRs only. No floor yet → drop
|
|
566
|
+
# # 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') != '' }}
|
|
568
|
+
# uses: davelosert/vitest-coverage-report-action@c4bbc33a89b7ace0e63d35f1f7d4bcee31155a73 # v2.13.0
|
|
550
569
|
# with:
|
|
551
570
|
# name: unit
|
|
552
571
|
# json-summary-path: coverage/unit/coverage-summary.json
|
|
553
572
|
# json-final-path: coverage/unit/coverage-final.json
|
|
573
|
+
# vite-config-path: vitest.unit.config.ts # the file the floor lives in
|
|
554
574
|
# file-coverage-mode: changes # per-file table limited to files changed in the PR
|
|
575
|
+
# comment-on: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) && 'pr' || 'none' }}
|
|
555
576
|
# github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
556
577
|
# - name: Report Integration Coverage on PR
|
|
557
578
|
# # hashFiles guard: skip cleanly when the repo has no integration tier (no coverage/integration report produced).
|
|
558
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') != ''
|
|
559
|
-
# uses: davelosert/vitest-coverage-report-action@
|
|
580
|
+
# uses: davelosert/vitest-coverage-report-action@c4bbc33a89b7ace0e63d35f1f7d4bcee31155a73 # v2.13.0
|
|
560
581
|
# with:
|
|
561
582
|
# name: integration
|
|
562
583
|
# json-summary-path: coverage/integration/coverage-summary.json
|
|
@@ -648,7 +669,7 @@ jobs:
|
|
|
648
669
|
# - name: Report E2E Coverage on PR
|
|
649
670
|
# # Same gate as Run E2E Tests (coverage exists only if E2E ran); hashFiles skips repos that produced no E2E report.
|
|
650
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') != ''
|
|
651
|
-
# uses: davelosert/vitest-coverage-report-action@
|
|
672
|
+
# uses: davelosert/vitest-coverage-report-action@c4bbc33a89b7ace0e63d35f1f7d4bcee31155a73 # v2.13.0
|
|
652
673
|
# with:
|
|
653
674
|
# name: e2e
|
|
654
675
|
# json-summary-path: coverage/e2e/coverage-summary.json
|
|
@@ -682,47 +703,39 @@ jobs:
|
|
|
682
703
|
# always(): a concurrency cancel must not stamp a failure. Each lane must succeed; a failed,
|
|
683
704
|
# skipped or cancelled lane reds it. A lane that writes an executed-test count must have run
|
|
684
705
|
# more than 0 tests. Each lane you adopt from the reference below joins needs: and the assert.
|
|
706
|
+
# The assert is scripts/ci/check-capstone.mjs, required with this file (copy it from
|
|
707
|
+
# .bkit/templates/scripts/ci/); the step reds when the script is missing.
|
|
685
708
|
bkit-tests-check:
|
|
686
709
|
needs: [bkit-tests-static, bkit-tests-unit]
|
|
687
710
|
if: ${{ !cancelled() }}
|
|
688
711
|
runs-on: ubuntu-latest
|
|
689
712
|
timeout-minutes: 2
|
|
690
713
|
steps:
|
|
714
|
+
# Ungated checkout, never continue-on-error: it fetches the script below. A checkout
|
|
715
|
+
# gated on a plan value leaves some runs with no script, and the required check then
|
|
716
|
+
# exits on "cannot find module" instead of judging the lanes.
|
|
717
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
718
|
+
|
|
691
719
|
- name: Assert Lanes Passed
|
|
720
|
+
# The verdict is scripts/ci/check-capstone.mjs (copy it with this file from
|
|
721
|
+
# .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.
|
|
692
726
|
env:
|
|
727
|
+
LANES: static,unit
|
|
728
|
+
EMPTY_COUNT: warn
|
|
693
729
|
STATIC_RESULT: ${{ needs.bkit-tests-static.result }}
|
|
694
730
|
UNIT_RESULT: ${{ needs.bkit-tests-unit.result }}
|
|
695
731
|
UNIT_RAN: ${{ needs.bkit-tests-unit.outputs.tests_ran }}
|
|
696
732
|
UNIT_CACHE_SKIP: ${{ needs.bkit-tests-unit.outputs.cache_skip }}
|
|
697
733
|
run: |
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
echo "::error::bkit-tests-static result=$STATIC_RESULT (expected success)"
|
|
701
|
-
FAIL=1
|
|
702
|
-
fi
|
|
703
|
-
if [ "$UNIT_RESULT" != "success" ]; then
|
|
704
|
-
echo "::error::bkit-tests-unit result=$UNIT_RESULT (expected success)"
|
|
705
|
-
FAIL=1
|
|
706
|
-
fi
|
|
707
|
-
# NON-HOLLOW: a real run (not a SHA-cache short-circuit) of a lane that writes a count
|
|
708
|
-
# must have executed >0 tests. An empty count is a lane that writes none yet.
|
|
709
|
-
if [ "$UNIT_RESULT" = "success" ] && [ "$UNIT_CACHE_SKIP" != "true" ]; then
|
|
710
|
-
case "$UNIT_RAN" in
|
|
711
|
-
'')
|
|
712
|
-
echo "::warning::bkit-tests-unit writes no executed-test count — green does not prove tests ran (see its Run Unit Tests step)." ;;
|
|
713
|
-
*[!0-9]*)
|
|
714
|
-
echo "::error::bkit-tests-unit executed-test count is non-numeric ('$UNIT_RAN')."
|
|
715
|
-
FAIL=1 ;;
|
|
716
|
-
0)
|
|
717
|
-
echo "::error::bkit-tests-unit succeeded but executed 0 tests — vacuous green."
|
|
718
|
-
FAIL=1 ;;
|
|
719
|
-
esac
|
|
720
|
-
fi
|
|
721
|
-
if [ "$FAIL" = "1" ]; then
|
|
722
|
-
echo "::error::bkit-tests-check FAILED — see above."
|
|
734
|
+
if [ ! -f scripts/ci/check-capstone.mjs ]; then
|
|
735
|
+
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."
|
|
723
736
|
exit 1
|
|
724
737
|
fi
|
|
725
|
-
|
|
738
|
+
node scripts/ci/check-capstone.mjs
|
|
726
739
|
|
|
727
740
|
# bkit-stub:smoke — Post-CI smoke triggered by workflow_run on {{DEFAULT_BRANCH}}. To enable: copy the YAML below into .github/workflows/smoke.yml (separate file — workflow_run cannot share a file with push/pull_request) and delete this stub header.
|
|
728
741
|
# name: Smoke
|
|
@@ -889,7 +902,7 @@ jobs:
|
|
|
889
902
|
# # docs/testing.md § Schema-invariant DB checks.
|
|
890
903
|
# - name: Run DB Tests (pgTAP) # [DB] if: schema invariants matter; runs supabase/tests/*.sql
|
|
891
904
|
# - name: Run Unit Tests # [U] the one tier every repo has (source CI_ENV_FILE if needed)
|
|
892
|
-
# - name: Report Coverage
|
|
905
|
+
# - name: Report Coverage # [U/PR] bkit-stub:coverage — davelosert/vitest-coverage-report-action posts a per-tier coverage comment (distinct name: unit|integration|e2e); the unit report also writes its table, with the floor as target, to the job summary on every event. With SEPARATE lanes each posts from its OWN lane: unit-cov here (gated on branches), integration-cov in bkit-tests-integration (report-only, gate-on-execution), e2e-cov in bkit-tests-e2e-web (bkit-stub:e2e-coverage, Monocart). Each lane needs job-level pull-requests: write + the json-summary/json reporters.
|
|
893
906
|
# - name: Build All Packages # moves to bkit-tests-build-web. Not this catalogue.
|
|
894
907
|
# - name: Run Integration Tests # moves to bkit-tests-integration. Not this catalogue.
|
|
895
908
|
# - name: Check Stale Test Data # [DB] continue-on-error. Lives in the lane that touches the shared resource.
|
|
@@ -476,6 +476,7 @@ jobs:
|
|
|
476
476
|
# SHA mirror bkit-ci.yml.
|
|
477
477
|
- name: Install vale
|
|
478
478
|
env:
|
|
479
|
+
# renovate: datasource=github-releases depName=errata-ai/vale
|
|
479
480
|
VALE_VERSION: "3.9.1"
|
|
480
481
|
VALE_SHA256: "fbc2eb47d0b8c50220ed1a2c5c611fbe0904ed567d638143d482016a18fd2db0"
|
|
481
482
|
run: |
|
|
@@ -490,7 +491,7 @@ jobs:
|
|
|
490
491
|
git config user.email 'bkit-auto@users.noreply.github.com'
|
|
491
492
|
|
|
492
493
|
- name: Dispatch /bkit-auto on Claude Code runner
|
|
493
|
-
uses: anthropics/claude-code-action@
|
|
494
|
+
uses: anthropics/claude-code-action@1d6de8cb0c237e7c15e9e1bdf973826ebae490cc # v1.0.248
|
|
494
495
|
with:
|
|
495
496
|
# Orchestrator contract: `/bkit-auto <phase> <arg>` where <arg> is the open
|
|
496
497
|
# PR number (ship/debug) or the tracker issue number/id (design/plan/build).
|
|
@@ -542,6 +543,7 @@ jobs:
|
|
|
542
543
|
# is v1.19.0), so the curl installer (https://opencode.ai/install downloads GitHub
|
|
543
544
|
# release binaries) cannot fetch 2.0.26. npm's postinstall selects the runner's
|
|
544
545
|
# platform binary.
|
|
546
|
+
# renovate: datasource=npm depName=@opencode/cli
|
|
545
547
|
npm install -g @opencode/cli@2.0.26
|
|
546
548
|
echo "$(npm prefix -g)/bin" >> "$GITHUB_PATH"
|
|
547
549
|
|
|
@@ -65,7 +65,7 @@ jobs:
|
|
|
65
65
|
# app-id: ${{ secrets.RENOVATE_APP_ID }}
|
|
66
66
|
# private-key: ${{ secrets.RENOVATE_APP_PRIVATE_KEY }}
|
|
67
67
|
# then set `token: ${{ steps.app-token.outputs.token }}` below.
|
|
68
|
-
- uses: renovatebot/github-action@
|
|
68
|
+
- uses: renovatebot/github-action@230ce922b08968d0a4f6f70f295601daff09ef1d # v46.3.7
|
|
69
69
|
with:
|
|
70
70
|
# PAT secret (default). FINE-GRAINED repository permissions (this repo):
|
|
71
71
|
# Contents: Read and write · Pull requests: Read and write ·
|
|
@@ -78,6 +78,13 @@ jobs:
|
|
|
78
78
|
# lets Renovate use your verified email as the git author — org-owned tokens have no
|
|
79
79
|
# such permission, so set RENOVATE_GIT_AUTHOR below instead.)
|
|
80
80
|
token: ${{ secrets.BKIT_GH_TOKEN }}
|
|
81
|
+
# Exact Renovate image tag. Unset, the action runs the floating `renovate:<major>`
|
|
82
|
+
# tag, which can sit a major behind the latest. renovate.json5 `customManagers`
|
|
83
|
+
# reads the comment below and opens a PR when a newer release lands. The lookup
|
|
84
|
+
# uses GitHub releases (they carry publish dates, so `minimumReleaseAge` applies);
|
|
85
|
+
# the image tags on ghcr.io carry none.
|
|
86
|
+
# renovate: datasource=github-releases depName=renovatebot/renovate
|
|
87
|
+
renovate-version: "44.151.0"
|
|
81
88
|
env:
|
|
82
89
|
# Scope to THIS repo only — never org-wide autodiscover.
|
|
83
90
|
RENOVATE_REPOSITORIES: ${{ github.repository }}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Example Trivy scan. Copy it to `.github/workflows/bkit-trivy.yml` and own it.
|
|
2
|
+
# bkit install does not write this file and does not overwrite a copy.
|
|
3
|
+
#
|
|
4
|
+
# Fails on a HIGH or CRITICAL finding in any lockfile (every language Trivy reads), in
|
|
5
|
+
# config files (Dockerfile, Terraform, Kubernetes, Helm, CloudFormation) and in secrets
|
|
6
|
+
# committed to tracked files. Accept a finding in `.trivyignore.yaml`, each entry with a
|
|
7
|
+
# `statement` (why) and an `expired_at` (when it comes back). See
|
|
8
|
+
# `.bkit/templates.md` § Trivy.
|
|
9
|
+
#
|
|
10
|
+
# Runs the official image pinned by tag AND digest. Never reference
|
|
11
|
+
# `aquasecurity/trivy-action` or `setup-trivy` by tag: in March 2026 their tags were
|
|
12
|
+
# re-pointed at a credential stealer. This file is yours, so Renovate bumps the tag and
|
|
13
|
+
# digest together. Do NOT add this path to renovate.json5 `ignorePaths`.
|
|
14
|
+
name: Trivy
|
|
15
|
+
|
|
16
|
+
on:
|
|
17
|
+
workflow_dispatch:
|
|
18
|
+
push:
|
|
19
|
+
branches: [{{DEFAULT_BRANCH}}, dev]
|
|
20
|
+
pull_request:
|
|
21
|
+
branches: [{{DEFAULT_BRANCH}}, dev]
|
|
22
|
+
schedule:
|
|
23
|
+
# New advisories land without a code change; the daily run catches them.
|
|
24
|
+
- cron: "41 5 * * *"
|
|
25
|
+
|
|
26
|
+
# The scan reads the checkout and needs no secret and no write scope.
|
|
27
|
+
permissions:
|
|
28
|
+
contents: read
|
|
29
|
+
|
|
30
|
+
concurrency:
|
|
31
|
+
group: trivy-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.ref }}
|
|
32
|
+
cancel-in-progress: true
|
|
33
|
+
|
|
34
|
+
jobs:
|
|
35
|
+
trivy:
|
|
36
|
+
runs-on: ubuntu-latest # Edit this label in your copy.
|
|
37
|
+
timeout-minutes: 15
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
40
|
+
with:
|
|
41
|
+
persist-credentials: false
|
|
42
|
+
|
|
43
|
+
# `scripts/ci/check-dependency-audit.mjs` (bkit-ci.yml `Check Dependency Audit`)
|
|
44
|
+
# already gates pnpm-lock.yaml against `accepted-advisories.json`; scanning it here
|
|
45
|
+
# too would need every acceptance twice. Without that gate, Trivy owns the lockfile.
|
|
46
|
+
- name: Plan Scan
|
|
47
|
+
id: plan
|
|
48
|
+
run: |
|
|
49
|
+
args=""
|
|
50
|
+
if [ -f scripts/ci/check-dependency-audit.mjs ]; then
|
|
51
|
+
args="$args --skip-files pnpm-lock.yaml"
|
|
52
|
+
fi
|
|
53
|
+
if [ -f .trivyignore.yaml ]; then
|
|
54
|
+
args="$args --ignorefile .trivyignore.yaml"
|
|
55
|
+
fi
|
|
56
|
+
echo "args=$args" >> "$GITHUB_OUTPUT"
|
|
57
|
+
|
|
58
|
+
# --include-dev-deps: without it Trivy drops every dev dependency from npm, yarn
|
|
59
|
+
# and pnpm lockfiles, and a repo of dev tooling scans zero packages and passes.
|
|
60
|
+
# --skip-dirs .bkit/templates: bkit rewrites those files; your adopted copies are
|
|
61
|
+
# scanned where they live.
|
|
62
|
+
- name: Run Trivy
|
|
63
|
+
uses: docker://ghcr.io/aquasecurity/trivy:0.75.0@sha256:af6acf9a6b85dfe389a1941505c0ce9efef52a4719635e1a962f022a3d855daa
|
|
64
|
+
with:
|
|
65
|
+
args: >-
|
|
66
|
+
fs --scanners vuln,misconfig,secret --severity HIGH,CRITICAL --exit-code 1
|
|
67
|
+
--include-dev-deps --skip-dirs .bkit/templates ${{ steps.plan.outputs.args }} .
|
|
@@ -20,15 +20,20 @@ set -e
|
|
|
20
20
|
# all-zero local sha. When EVERY line is a delete, the push carries no commits. A push
|
|
21
21
|
# mixing a delete with a real update still gates, and so does an empty ref list. Reading
|
|
22
22
|
# stdin here is safe: every later command redirects from /dev/null. `[ -t 0 ]` keeps a
|
|
23
|
-
# hand-run hook from hanging.
|
|
23
|
+
# hand-run hook from hanging. The loop also sets PUSH_DEV_SHA (commit pushed to dev) for
|
|
24
|
+
# repo extras that gate only dev pushes (e.g. scripts/graphify/bkit-graph-pre-push.sh).
|
|
24
25
|
PUSH_SAW_REF=0
|
|
25
26
|
PUSH_HAS_COMMITS=0
|
|
27
|
+
PUSH_DEV_SHA=""
|
|
26
28
|
if [ ! -t 0 ]; then
|
|
27
|
-
while read -r _push_local_ref push_local_sha
|
|
29
|
+
while read -r _push_local_ref push_local_sha push_remote_ref _push_remote_sha; do
|
|
28
30
|
[ -n "$push_local_sha" ] || continue
|
|
29
31
|
PUSH_SAW_REF=1
|
|
30
32
|
case "$push_local_sha" in
|
|
31
|
-
*[!0]*)
|
|
33
|
+
*[!0]*)
|
|
34
|
+
PUSH_HAS_COMMITS=1
|
|
35
|
+
[ "$push_remote_ref" = "refs/heads/dev" ] && PUSH_DEV_SHA="$push_local_sha"
|
|
36
|
+
;;
|
|
32
37
|
esac
|
|
33
38
|
done
|
|
34
39
|
fi
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": [],
|
|
4
|
+
"categories": {
|
|
5
|
+
"correctness": "off"
|
|
6
|
+
},
|
|
7
|
+
"ignorePatterns": [".bkit/templates/**", "scripts/ci/**/*.test.mjs"],
|
|
8
|
+
"overrides": [
|
|
9
|
+
{
|
|
10
|
+
"files": ["**/*.{test,spec}.{ts,tsx,mts,cts,js,jsx,mjs,cjs}"],
|
|
11
|
+
"plugins": ["vitest", "typescript"],
|
|
12
|
+
"rules": {
|
|
13
|
+
"vitest/expect-expect": "error",
|
|
14
|
+
"vitest/no-conditional-in-test": "error",
|
|
15
|
+
"vitest/no-conditional-expect": "error",
|
|
16
|
+
"vitest/valid-expect": ["error", { "maxArgs": 2 }],
|
|
17
|
+
"typescript/no-floating-promises": "error"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
>
|
|
10
10
|
> **Rules:**
|
|
11
11
|
>
|
|
12
|
-
> - GENERATED. `pnpm graph:
|
|
12
|
+
> - GENERATED. `pnpm graph:refresh` rewrites this file.
|
|
13
13
|
> - Source of truth: `scripts/graphify/bkit-graph-drift-rules.json`. Status is derived from the tree, never typed.
|
|
14
14
|
> - Markers literal, never regex. Regex metacharacter in a marker matches nothing → reads as clean result.
|
|
15
15
|
> - Optional `scope`: path prefixes. Optional `surface`: `product` (default), `tests`, or `all`.
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Example. Copy into scripts/ci/ and own it. bkit install does not write this file
|
|
3
|
+
// and does not overwrite a copy.
|
|
4
|
+
/**
|
|
5
|
+
* check-capstone.mjs — the decision behind the `bkit-tests-check` capstone.
|
|
6
|
+
*
|
|
7
|
+
* Reads the capstone's `needs` context from the environment and reds when green would prove
|
|
8
|
+
* nothing. It fails when:
|
|
9
|
+
* - a lane's result is not `success` (failed, skipped or cancelled),
|
|
10
|
+
* - a lane ran although the plan said skip (`run_level` is `none`),
|
|
11
|
+
* - a lane succeeded having executed 0 tests, or reports a count that is not a number,
|
|
12
|
+
* - the plan does not parse (not JSON, not an object, or no `run_level`),
|
|
13
|
+
* - the planner job (`SCOPE_RESULT`) did not succeed,
|
|
14
|
+
* - no lane is named, or a lane's result was never wired in.
|
|
15
|
+
* It asserts nothing for a lane that `<LANE>_CACHE_SKIP=true` marks as proven on a cached
|
|
16
|
+
* SHA, and nothing about a skipped lane when `run_level` is `none`.
|
|
17
|
+
*
|
|
18
|
+
* Environment:
|
|
19
|
+
* LANES comma-separated lane names, e.g. `static,unit`. The job named
|
|
20
|
+
* `bkit-tests-<lane>` is read from `<LANE>_RESULT` (name upper-cased,
|
|
21
|
+
* `-` becomes `_`: `e2e-web` reads `E2E_WEB_RESULT`).
|
|
22
|
+
* <LANE>_RESULT `needs.<job>.result`.
|
|
23
|
+
* <LANE>_RAN `needs.<job>.outputs.tests_ran`. Setting the variable (even empty)
|
|
24
|
+
* makes the lane counted: it must report a number above 0. A lane
|
|
25
|
+
* with no such variable is not count-checked.
|
|
26
|
+
* <LANE>_CACHE_SKIP `needs.<job>.outputs.cache_skip`; `true` skips the count check.
|
|
27
|
+
* PLAN optional planner JSON (`needs.bkit-tests-scope.outputs.plan`). Unset
|
|
28
|
+
* means every listed lane is expected to run. Set, it must parse and
|
|
29
|
+
* carry a `run_level`; `none` expects every lane to be skipped.
|
|
30
|
+
* SCOPE_RESULT optional `needs.bkit-tests-scope.result`; must be `success`.
|
|
31
|
+
* EMPTY_COUNT `warn` turns a lane that reports no count yet into a warning. Any
|
|
32
|
+
* other value fails it. A count of 0 or a non-number always fails.
|
|
33
|
+
*
|
|
34
|
+
* Usage: node scripts/ci/check-capstone.mjs
|
|
35
|
+
* Exit: 0 = every expectation met, 1 = at least one failure.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
import path from "node:path";
|
|
39
|
+
import { fileURLToPath } from "node:url";
|
|
40
|
+
|
|
41
|
+
const LANE_NAME = /^[a-z][a-z0-9-]*$/i;
|
|
42
|
+
const PREFIX = (lane) => lane.toUpperCase().replace(/-/g, "_");
|
|
43
|
+
|
|
44
|
+
/** The planner's `run_level` from `raw`, or why `raw` is not a usable plan. */
|
|
45
|
+
function readPlan(raw) {
|
|
46
|
+
let plan;
|
|
47
|
+
try {
|
|
48
|
+
plan = JSON.parse(raw);
|
|
49
|
+
} catch (err) {
|
|
50
|
+
return { runLevel: null, problem: err.message };
|
|
51
|
+
}
|
|
52
|
+
if (plan === null || typeof plan !== "object" || Array.isArray(plan)) {
|
|
53
|
+
return { runLevel: null, problem: "not a JSON object" };
|
|
54
|
+
}
|
|
55
|
+
if (typeof plan.run_level !== "string" || plan.run_level === "") {
|
|
56
|
+
return { runLevel: null, problem: "no run_level" };
|
|
57
|
+
}
|
|
58
|
+
return { runLevel: plan.run_level, problem: null };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Judge the capstone from its environment.
|
|
63
|
+
* @param {Record<string, string | undefined>} env
|
|
64
|
+
* @returns {{ errors: string[], warnings: string[], summary: string }}
|
|
65
|
+
*/
|
|
66
|
+
export function checkCapstone(env) {
|
|
67
|
+
const errors = [];
|
|
68
|
+
const warnings = [];
|
|
69
|
+
|
|
70
|
+
const lanes = (env.LANES ?? "")
|
|
71
|
+
.split(",")
|
|
72
|
+
.map((l) => l.trim())
|
|
73
|
+
.filter(Boolean);
|
|
74
|
+
if (lanes.length === 0) {
|
|
75
|
+
errors.push("LANES names no lane — a capstone that watches nothing proves nothing.");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (env.SCOPE_RESULT !== undefined && env.SCOPE_RESULT !== "success") {
|
|
79
|
+
errors.push(`bkit-tests-scope did not succeed (result=${env.SCOPE_RESULT})`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
let runLevel = null;
|
|
83
|
+
if (env.PLAN !== undefined) {
|
|
84
|
+
const plan = readPlan(env.PLAN);
|
|
85
|
+
runLevel = plan.runLevel;
|
|
86
|
+
if (plan.problem !== null) {
|
|
87
|
+
errors.push(
|
|
88
|
+
`the plan does not parse (${plan.problem}) — expected a JSON object with a run_level, got ${JSON.stringify(env.PLAN.slice(0, 80))}`,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const expectSkip = runLevel === "none";
|
|
93
|
+
const why = runLevel === null ? "" : `plan.run_level=${runLevel} but `;
|
|
94
|
+
|
|
95
|
+
const parts = [];
|
|
96
|
+
for (const lane of lanes) {
|
|
97
|
+
const job = `bkit-tests-${lane}`;
|
|
98
|
+
if (!LANE_NAME.test(lane)) {
|
|
99
|
+
errors.push(`LANES entry '${lane}' is not a lane name (letters, digits and '-').`);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const prefix = PREFIX(lane);
|
|
103
|
+
const result = env[`${prefix}_RESULT`];
|
|
104
|
+
if (result === undefined) {
|
|
105
|
+
errors.push(`${prefix}_RESULT is not set — the capstone cannot read ${job}'s result.`);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (expectSkip) {
|
|
110
|
+
if (result !== "skipped") {
|
|
111
|
+
errors.push(
|
|
112
|
+
`plan.run_level=none says skip but ${job} ran (result=${result}) — plan and lane disagree.`,
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
parts.push(`${lane}=${result}`);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (result !== "success") {
|
|
120
|
+
errors.push(
|
|
121
|
+
runLevel === null
|
|
122
|
+
? `${job} result=${result} (expected success)`
|
|
123
|
+
: `${why}${job} result=${result}`,
|
|
124
|
+
);
|
|
125
|
+
parts.push(`${lane}=${result}`);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const ranKey = `${prefix}_RAN`;
|
|
130
|
+
const counted = Object.hasOwn(env, ranKey);
|
|
131
|
+
if (!counted || env[`${prefix}_CACHE_SKIP`] === "true") {
|
|
132
|
+
parts.push(`${lane}=${result}`);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const ran = env[ranKey] ?? "";
|
|
137
|
+
if (ran === "" && env.EMPTY_COUNT === "warn") {
|
|
138
|
+
warnings.push(
|
|
139
|
+
`${job} writes no executed-test count — green does not prove tests ran (see its test step).`,
|
|
140
|
+
);
|
|
141
|
+
parts.push(`${lane}=${result} (count unreported)`);
|
|
142
|
+
} else if (!/^[0-9]+$/.test(ran)) {
|
|
143
|
+
errors.push(
|
|
144
|
+
`${job} succeeded but its executed-test count is non-numeric ('${ran}') — cannot confirm tests ran.`,
|
|
145
|
+
);
|
|
146
|
+
parts.push(`${lane}=${result}`);
|
|
147
|
+
} else if (Number(ran) === 0) {
|
|
148
|
+
errors.push(`${job} succeeded but executed 0 tests — vacuous green (expected >0).`);
|
|
149
|
+
parts.push(`${lane}=${result} (0 tests)`);
|
|
150
|
+
} else {
|
|
151
|
+
parts.push(`${lane}=${result} (${Number(ran)} tests)`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const level = runLevel === null ? "" : `, run_level=${runLevel}`;
|
|
156
|
+
return {
|
|
157
|
+
errors,
|
|
158
|
+
warnings,
|
|
159
|
+
summary: `bkit-tests-check passed — ${parts.join(", ")}${level}.`,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function main() {
|
|
164
|
+
const { errors, warnings, summary } = checkCapstone(process.env);
|
|
165
|
+
for (const w of warnings) console.log(`::warning::${w}`);
|
|
166
|
+
for (const e of errors) console.log(`::error::${e}`);
|
|
167
|
+
if (errors.length > 0) {
|
|
168
|
+
console.log("::error::bkit-tests-check FAILED — see above.");
|
|
169
|
+
process.exit(1);
|
|
170
|
+
}
|
|
171
|
+
console.log(`✅ ${summary}`);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
175
|
+
main();
|
|
176
|
+
}
|