@cbartens/bkit 0.0.0-stage → 5.0.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 +421 -0
- package/.bkit/core/.agents/context.md +95 -0
- package/.bkit/core/.agents/docs.md +62 -0
- package/.bkit/core/.agents/rules.md +147 -0
- package/.bkit/core/.agents/skills.md +43 -0
- package/.bkit/core/.bkit/LICENSE.md +151 -0
- package/.bkit/core/.bkit/README.md +421 -0
- package/.bkit/core/.bkit/cloud.md +502 -0
- package/.bkit/core/.bkit/comparison.md +318 -0
- package/.bkit/core/.bkit/install.md +496 -0
- package/.bkit/core/.bkit/jsonl.md +497 -0
- package/.bkit/core/.bkit/prompts.md +474 -0
- package/.bkit/core/.bkit/providers.md +598 -0
- package/.bkit/core/.bkit/templates.md +471 -0
- package/.bkit/core/.bkit/trackers.md +95 -0
- package/.bkit/core/.bkit/workflows.md +1546 -0
- package/.bkit/core/.claude/hooks/bkit-gateguard.cjs +82 -0
- package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +93 -0
- package/.bkit/core/.claude/hooks/bkit-preflight.sh +74 -0
- package/.bkit/core/.codex/hooks/bkit-gateguard.cjs +115 -0
- package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +135 -0
- package/.bkit/core/.cursor/hooks/bkit-gateguard.cjs +111 -0
- package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +169 -0
- package/.bkit/core/.cursor/hooks/bkit-preflight.sh +63 -0
- package/.bkit/core/.opencode/plugin/bkit-gateguard.js +225 -0
- package/.bkit/core/AGENTS.md +77 -0
- package/.bkit/core/LICENSE.md +149 -0
- package/.bkit/core/docs/templates/bkit-audit-accessibility.md +272 -0
- package/.bkit/core/docs/templates/bkit-audit-adoption.md +223 -0
- package/.bkit/core/docs/templates/bkit-audit-agents.md +230 -0
- package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +227 -0
- package/.bkit/core/docs/templates/bkit-audit-analytics.md +266 -0
- package/.bkit/core/docs/templates/bkit-audit-annotations.md +230 -0
- package/.bkit/core/docs/templates/bkit-audit-app-performance.md +270 -0
- package/.bkit/core/docs/templates/bkit-audit-app-store.md +254 -0
- package/.bkit/core/docs/templates/bkit-audit-architecture.md +221 -0
- package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +241 -0
- package/.bkit/core/docs/templates/bkit-audit-config.md +230 -0
- package/.bkit/core/docs/templates/bkit-audit-cost.md +218 -0
- package/.bkit/core/docs/templates/bkit-audit-coverage.md +221 -0
- package/.bkit/core/docs/templates/bkit-audit-database.md +229 -0
- package/.bkit/core/docs/templates/bkit-audit-dead-code.md +251 -0
- package/.bkit/core/docs/templates/bkit-audit-deferrals.md +283 -0
- package/.bkit/core/docs/templates/bkit-audit-dependencies.md +268 -0
- package/.bkit/core/docs/templates/bkit-audit-documentation.md +280 -0
- package/.bkit/core/docs/templates/bkit-audit-duplication.md +253 -0
- package/.bkit/core/docs/templates/bkit-audit-failures.md +259 -0
- package/.bkit/core/docs/templates/bkit-audit-flakes.md +237 -0
- package/.bkit/core/docs/templates/bkit-audit-gates.md +250 -0
- package/.bkit/core/docs/templates/bkit-audit-issues.md +273 -0
- package/.bkit/core/docs/templates/bkit-audit-llm.md +239 -0
- package/.bkit/core/docs/templates/bkit-audit-logs.md +266 -0
- package/.bkit/core/docs/templates/bkit-audit-models.md +210 -0
- package/.bkit/core/docs/templates/bkit-audit-privacy.md +211 -0
- package/.bkit/core/docs/templates/bkit-audit-prompts.md +216 -0
- package/.bkit/core/docs/templates/bkit-audit-red-team.md +220 -0
- package/.bkit/core/docs/templates/bkit-audit-reliability.md +222 -0
- package/.bkit/core/docs/templates/bkit-audit-repo.md +224 -0
- package/.bkit/core/docs/templates/bkit-audit-security.md +274 -0
- package/.bkit/core/docs/templates/bkit-audit-slop.md +200 -0
- package/.bkit/core/docs/templates/bkit-audit-testing.md +270 -0
- package/.bkit/core/docs/templates/bkit-audit-usability.md +237 -0
- package/.bkit/core/docs/templates/bkit-plan.md +476 -0
- package/.bkit/core/engine/checks/after/auth.ts +247 -0
- package/.bkit/core/engine/checks/after/ci-yml.ts +739 -0
- package/.bkit/core/engine/checks/after/github.ts +424 -0
- package/.bkit/core/engine/checks/after/index.ts +556 -0
- package/.bkit/core/engine/checks/after/managed.ts +217 -0
- package/.bkit/core/engine/checks/after/tools.ts +427 -0
- package/.bkit/core/engine/checks/after/vercel.ts +101 -0
- package/.bkit/core/engine/checks/before/context-fetch.ts +429 -0
- package/.bkit/core/engine/checks/before/env.ts +201 -0
- package/.bkit/core/engine/checks/before/files.ts +202 -0
- package/.bkit/core/engine/checks/before/index.ts +206 -0
- package/.bkit/core/engine/checks/before/mcp.ts +127 -0
- package/.bkit/core/engine/checks/before/repo.ts +77 -0
- package/.bkit/core/engine/checks/before/version.ts +67 -0
- package/.bkit/core/engine/checks/status-holes.ts +479 -0
- package/.bkit/core/engine/cli.ts +871 -0
- package/.bkit/core/engine/commands/analysis.ts +550 -0
- package/.bkit/core/engine/commands/ci/ci.ts +483 -0
- package/.bkit/core/engine/commands/comply.ts +415 -0
- package/.bkit/core/engine/commands/harvest.ts +459 -0
- package/.bkit/core/engine/commands/install/check.ts +70 -0
- package/.bkit/core/engine/commands/install/doctor.ts +247 -0
- package/.bkit/core/engine/commands/install/install.ts +528 -0
- package/.bkit/core/engine/commands/install/uninstall.ts +972 -0
- package/.bkit/core/engine/commands/install/upgrade.ts +1026 -0
- package/.bkit/core/engine/commands/launch.ts +139 -0
- package/.bkit/core/engine/commands/lib.ts +494 -0
- package/.bkit/core/engine/commands/registry.ts +53 -0
- package/.bkit/core/engine/commands/setup/setup.ts +184 -0
- package/.bkit/core/engine/commands/telemetry.ts +32 -0
- package/.bkit/core/engine/commands/workflow/branches.ts +1514 -0
- package/.bkit/core/engine/commands/workflow/context.ts +961 -0
- package/.bkit/core/engine/commands/workflow/counters.ts +268 -0
- package/.bkit/core/engine/commands/workflow/fids.ts +243 -0
- package/.bkit/core/engine/commands/workflow/issues.ts +675 -0
- package/.bkit/core/engine/commands/workflow/ledgers.ts +575 -0
- package/.bkit/core/engine/commands/workflow/locks.ts +478 -0
- package/.bkit/core/engine/commands/workflow/prs.ts +1087 -0
- package/.bkit/core/engine/commands/workflow/repo.ts +220 -0
- package/.bkit/core/engine/commands/workflow/roadmap.ts +576 -0
- package/.bkit/core/engine/commands/workflow/runs.ts +2140 -0
- package/.bkit/core/engine/commands/workflow/runtime.ts +300 -0
- package/.bkit/core/engine/commands/workflow/skills.ts +118 -0
- package/.bkit/core/engine/commands/workflow/status.ts +455 -0
- package/.bkit/core/engine/commands/workflow/steps.ts +1300 -0
- package/.bkit/core/engine/commands/workflow/tests.ts +161 -0
- package/.bkit/core/engine/commands/workflow/workflows.ts +1573 -0
- package/.bkit/core/engine/commands/workflow/workstreams.ts +164 -0
- package/.bkit/core/engine/commands/workflow/worktrees.ts +534 -0
- package/.bkit/core/engine/install/cloud-env.ts +925 -0
- package/.bkit/core/engine/install/managed-block.ts +212 -0
- package/.bkit/core/engine/install/manifest.ts +448 -0
- package/.bkit/core/engine/install/modules/claude.ts +362 -0
- package/.bkit/core/engine/install/modules/cloud.ts +174 -0
- package/.bkit/core/engine/install/modules/codex.ts +219 -0
- package/.bkit/core/engine/install/modules/core.ts +600 -0
- package/.bkit/core/engine/install/modules/cursor.ts +231 -0
- package/.bkit/core/engine/install/modules/index.ts +242 -0
- package/.bkit/core/engine/install/modules/opencode.ts +573 -0
- package/.bkit/core/engine/install/placeholders.ts +108 -0
- package/.bkit/core/engine/install/template-copies.ts +119 -0
- package/.bkit/core/engine/install/version-file.ts +284 -0
- package/.bkit/core/engine/install/write.ts +467 -0
- package/.bkit/core/engine/ledgers/clamp-log.ts +32 -0
- package/.bkit/core/engine/ledgers/status.ts +213 -0
- package/.bkit/core/engine/ledgers/telemetry.ts +1143 -0
- package/.bkit/core/engine/render/hosts.ts +372 -0
- package/.bkit/core/engine/render/models.ts +323 -0
- package/.bkit/core/engine/render/parts.ts +38 -0
- package/.bkit/core/engine/render/trackers.ts +170 -0
- package/.bkit/core/engine/shared/egress.ts +345 -0
- package/.bkit/core/engine/shared/json.ts +16 -0
- package/.bkit/core/engine/shared/log-prefix.ts +9 -0
- package/.bkit/core/engine/shared/package-json.ts +29 -0
- package/.bkit/core/engine/shared/package-manager.ts +38 -0
- package/.bkit/core/engine/shared/package-roots.ts +163 -0
- package/.bkit/core/engine/shared/protected-paths.ts +164 -0
- package/.bkit/core/engine/shared/settings.ts +72 -0
- package/.bkit/core/engine/shared/timeouts.ts +20 -0
- package/.bkit/core/engine/tools/wording.ts +748 -0
- package/.bkit/core/hooks/gateguard-edit-payload.js +18 -0
- package/.bkit/core/hooks/gateguard-engine.js +193 -0
- package/.bkit/core/hooks/guardrails-shell.js +154 -0
- package/.bkit/core/hooks/guardrails-tiers.js +68 -0
- package/.bkit/core/hooks/preflight-linear.sh +73 -0
- package/.bkit/core/prompts/bkit-audit-generate.md +66 -0
- package/.bkit/core/prompts/bkit-build-challenge-1.md +79 -0
- package/.bkit/core/prompts/bkit-build-challenge-2.md +81 -0
- package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +68 -0
- package/.bkit/core/prompts/bkit-build-challenge-remediate.md +70 -0
- package/.bkit/core/prompts/bkit-build-challenge-tests.md +73 -0
- package/.bkit/core/prompts/bkit-build-install-skills.md +67 -0
- package/.bkit/core/prompts/bkit-build-plan-current.md +75 -0
- package/.bkit/core/prompts/bkit-build-plan-execute.md +72 -0
- package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +73 -0
- package/.bkit/core/prompts/bkit-build-plan-verify.md +88 -0
- package/.bkit/core/prompts/bkit-build-summary.md +93 -0
- package/.bkit/core/prompts/bkit-debug-abort-handover.md +90 -0
- package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +151 -0
- package/.bkit/core/prompts/bkit-debug-failure-remediate.md +78 -0
- package/.bkit/core/prompts/bkit-debug-failure-soak.md +73 -0
- package/.bkit/core/prompts/bkit-debug-summary.md +95 -0
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +72 -0
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +72 -0
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +75 -0
- package/.bkit/core/prompts/bkit-design-generate.md +110 -0
- package/.bkit/core/prompts/bkit-design-organise.md +85 -0
- package/.bkit/core/prompts/bkit-design-review-1.md +121 -0
- package/.bkit/core/prompts/bkit-design-review-2.md +111 -0
- package/.bkit/core/prompts/bkit-design-spike.md +97 -0
- package/.bkit/core/prompts/bkit-design-summary.md +106 -0
- package/.bkit/core/prompts/bkit-design-update.md +66 -0
- package/.bkit/core/prompts/bkit-plan-complexity-check.md +66 -0
- package/.bkit/core/prompts/bkit-plan-complexity-split.md +87 -0
- package/.bkit/core/prompts/bkit-plan-generate.md +74 -0
- package/.bkit/core/prompts/bkit-plan-review-1.md +90 -0
- package/.bkit/core/prompts/bkit-plan-review-2.md +80 -0
- package/.bkit/core/prompts/bkit-plan-review-3.md +92 -0
- package/.bkit/core/prompts/bkit-plan-scope-check-1.md +84 -0
- package/.bkit/core/prompts/bkit-plan-scope-check-2.md +84 -0
- package/.bkit/core/prompts/bkit-plan-summary.md +106 -0
- package/.bkit/core/prompts/bkit-plan-update.md +68 -0
- package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +90 -0
- package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +94 -0
- package/.bkit/core/prompts/bkit-ship-summary.md +77 -0
- package/.bkit/core/prompts/bkit-ship-update-docs.md +71 -0
- package/.bkit/core/prompts/bkit-utility-compress-markdown.md +91 -0
- package/.bkit/core/prompts/bkit-utility-update-decisions.md +75 -0
- package/.bkit/core/prompts/bkit-utility-update-deferrals.md +76 -0
- package/.bkit/core/prompts/bkit-utility-update-documentation.md +61 -0
- package/.bkit/core/prompts/bkit-utility-update-failures.md +76 -0
- package/.bkit/core/prompts/bkit-utility-update-knowledge.md +75 -0
- package/.bkit/core/prompts/bkit-utility-update-roadmap.md +82 -0
- package/.bkit/core/workflows/bkit-auto.md +121 -0
- package/.bkit/core/workflows/bkit-build.md +802 -0
- package/.bkit/core/workflows/bkit-debug.md +642 -0
- package/.bkit/core/workflows/bkit-design.md +495 -0
- package/.bkit/core/workflows/bkit-plan.md +510 -0
- package/.bkit/core/workflows/bkit-ship.md +650 -0
- package/.bkit/shared/.bkit/.env.example +108 -0
- package/.bkit/shared/.claude/bkit-cloud.md +117 -0
- package/.bkit/shared/.claude/settings.json +88 -0
- package/.bkit/shared/.codex/hooks.json +26 -0
- package/.bkit/shared/.cursor/bkit-cloud.md +84 -0
- package/.bkit/shared/.cursor/hooks.json +26 -0
- package/.bkit/shared/.cursor/mcp.json +15 -0
- package/.bkit/shared/.cursor/rules/bkit-rules.mdc +12 -0
- package/.bkit/shared/.gitattributes +37 -0
- package/.bkit/shared/.mcp.json +16 -0
- package/.bkit/shared/.opencode/opencode.json +62 -0
- package/.bkit/shared/CLAUDE.md +11 -0
- package/.bkit/shared/LICENSE.md +22 -0
- package/.bkit/shared/docs/architecture.md +19 -0
- package/.bkit/shared/docs/data-schema.md +19 -0
- package/.bkit/shared/docs/deployments.md +438 -0
- package/.bkit/shared/docs/design.md +39 -0
- package/.bkit/shared/docs/noise.md +19 -0
- package/.bkit/shared/docs/observability.md +25 -0
- package/.bkit/shared/docs/security.md +42 -0
- package/.bkit/shared/docs/setup.md +30 -0
- package/.bkit/shared/docs/technology.md +18 -0
- package/.bkit/shared/docs/testing.md +413 -0
- package/.bkit/shared/gitignore +92 -0
- package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +192 -0
- package/.bkit/templates/.cursor/Dockerfile +68 -0
- package/.bkit/templates/.cursor/environment.json +6 -0
- package/.bkit/templates/.cursor/settings.json +11 -0
- package/.bkit/templates/.envrc +7 -0
- package/.bkit/templates/.github/dependabot.yml +52 -0
- package/.bkit/templates/.github/renovate.json5 +239 -0
- package/.bkit/templates/.github/workflows/bkit-ci.yml +1082 -0
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +566 -0
- package/.bkit/templates/.github/workflows/bkit-renovate.yml +107 -0
- package/.bkit/templates/.graphifyignore +108 -0
- package/.bkit/templates/.husky/pre-commit +16 -0
- package/.bkit/templates/.husky/pre-push +91 -0
- package/.bkit/templates/.lintstagedrc.json +3 -0
- package/.bkit/templates/.prettierignore +41 -0
- package/.bkit/templates/.serena/project.yml +243 -0
- package/.bkit/templates/.vale/styles/House/Filler.yml +11 -0
- package/.bkit/templates/.vale/styles/House/Hedging.yml +12 -0
- package/.bkit/templates/.vale/styles/House/LLMSlop.yml +13 -0
- package/.bkit/templates/.vale/styles/House/Verbose.yml +12 -0
- package/.bkit/templates/.vale.ini +67 -0
- package/.bkit/templates/LICENSE.md +22 -0
- package/.bkit/templates/context/bkit-cloudrun.md +84 -0
- package/.bkit/templates/context/bkit-expo.md +186 -0
- package/.bkit/templates/context/bkit-github.md +79 -0
- package/.bkit/templates/context/bkit-inngest.md +45 -0
- package/.bkit/templates/context/bkit-maestro.md +76 -0
- package/.bkit/templates/context/bkit-playwright.md +62 -0
- package/.bkit/templates/context/bkit-resend.md +36 -0
- package/.bkit/templates/context/bkit-sentry.md +65 -0
- package/.bkit/templates/context/bkit-serena.md +33 -0
- package/.bkit/templates/context/bkit-stripe.md +36 -0
- package/.bkit/templates/context/bkit-supabase.md +59 -0
- package/.bkit/templates/context/bkit-tavily.md +49 -0
- package/.bkit/templates/context/bkit-vercel.md +64 -0
- package/.bkit/templates/docs/capabilities.md +72 -0
- package/.bkit/templates/scripts/ci/accepted-divergences.json +21 -0
- package/.bkit/templates/scripts/ci/check-accepted-divergences.mjs +152 -0
- package/.bkit/templates/scripts/ci/check-accepted-divergences.test.mjs +130 -0
- package/.bkit/templates/scripts/ci/lanes/resolve-push-base.mjs +98 -0
- package/.bkit/templates/scripts/ci/lanes/resolve-push-base.test.mjs +86 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-drift-rules.json +23 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-drift.py +208 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-eager-rules.json +35 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-eager.py +236 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-external-rules.json +17 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-imports.py +290 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +19 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-repair.py +120 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-surface.py +232 -0
- package/.bkit/templates/scripts/graphify/bkit-graphify-graphml.py +36 -0
- package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +927 -0
- package/.bkit/templates/scripts/graphify/bkit-graphify.sh +351 -0
- package/.bkit/templates/scripts/launchd/ai.bkit.launchd.plist +26 -0
- package/.bkit/templates/scripts/launchd/bkit-launchd-env.sh +53 -0
- package/.bkit/templates/scripts/launchd/launchd.env.example +13 -0
- package/.bkit/templates/scripts/prettier/bkit-insert-ignore.mjs +275 -0
- package/.bkit/templates/scripts/secrets/bkit-secrets.config.mjs +66 -0
- package/.bkit/templates/scripts/secrets/bkit-secrets.mjs +785 -0
- package/.bkit/templates/scripts/serena/bkit-serena-mcp.sh +30 -0
- package/.bkit/templates/scripts/serena/bkit-serena.mcp.json +9 -0
- package/.bkit/templates/scripts/slop/bkit-slop-type-suppression.mjs +286 -0
- package/.bkit/templates/slop-scan.config.json +120 -0
- package/CHANGELOG.md +1486 -0
- package/LICENSE.md +161 -0
- package/README.md +185 -2
- package/dist/checks/after/auth.js +232 -0
- package/dist/checks/after/ci-yml.js +718 -0
- package/dist/checks/after/github.js +400 -0
- package/dist/checks/after/index.js +447 -0
- package/dist/checks/after/managed.js +187 -0
- package/dist/checks/after/tools.js +351 -0
- package/dist/checks/after/vercel.js +102 -0
- package/dist/checks/before/context-fetch.js +426 -0
- package/dist/checks/before/env.js +173 -0
- package/dist/checks/before/files.js +185 -0
- package/dist/checks/before/index.js +162 -0
- package/dist/checks/before/mcp.js +111 -0
- package/dist/checks/before/repo.js +71 -0
- package/dist/checks/before/version.js +60 -0
- package/dist/checks/status-holes.js +393 -0
- package/dist/cli.js +692 -0
- package/dist/commands/analysis.js +325 -0
- package/dist/commands/ci/ci.js +438 -0
- package/dist/commands/comply.js +310 -0
- package/dist/commands/harvest.js +354 -0
- package/dist/commands/install/check.js +61 -0
- package/dist/commands/install/doctor.js +207 -0
- package/dist/commands/install/install.js +461 -0
- package/dist/commands/install/uninstall.js +815 -0
- package/dist/commands/install/upgrade.js +771 -0
- package/dist/commands/launch.js +118 -0
- package/dist/commands/lib.js +362 -0
- package/dist/commands/registry.js +50 -0
- package/dist/commands/setup/setup.js +158 -0
- package/dist/commands/telemetry.js +29 -0
- package/dist/commands/workflow/branches.js +1265 -0
- package/dist/commands/workflow/context.js +846 -0
- package/dist/commands/workflow/counters.js +227 -0
- package/dist/commands/workflow/fids.js +224 -0
- package/dist/commands/workflow/issues.js +585 -0
- package/dist/commands/workflow/ledgers.js +472 -0
- package/dist/commands/workflow/locks.js +364 -0
- package/dist/commands/workflow/prs.js +904 -0
- package/dist/commands/workflow/repo.js +199 -0
- package/dist/commands/workflow/roadmap.js +495 -0
- package/dist/commands/workflow/runs.js +1717 -0
- package/dist/commands/workflow/runtime.js +257 -0
- package/dist/commands/workflow/skills.js +110 -0
- package/dist/commands/workflow/status.js +392 -0
- package/dist/commands/workflow/steps.js +1093 -0
- package/dist/commands/workflow/tests.js +144 -0
- package/dist/commands/workflow/workflows.js +1342 -0
- package/dist/commands/workflow/workstreams.js +141 -0
- package/dist/commands/workflow/worktrees.js +473 -0
- package/dist/install/cloud-env.js +819 -0
- package/dist/install/managed-block.js +182 -0
- package/dist/install/manifest.js +376 -0
- package/dist/install/modules/claude.js +288 -0
- package/dist/install/modules/cloud.js +152 -0
- package/dist/install/modules/codex.js +193 -0
- package/dist/install/modules/core.js +511 -0
- package/dist/install/modules/cursor.js +186 -0
- package/dist/install/modules/index.js +152 -0
- package/dist/install/modules/opencode.js +504 -0
- package/dist/install/placeholders.js +87 -0
- package/dist/install/template-copies.js +106 -0
- package/dist/install/version-file.js +204 -0
- package/dist/install/write.js +342 -0
- package/dist/ledgers/clamp-log.js +27 -0
- package/dist/ledgers/status.js +156 -0
- package/dist/ledgers/telemetry.js +637 -0
- package/dist/render/hosts.js +339 -0
- package/dist/render/models.js +288 -0
- package/dist/render/parts.js +33 -0
- package/dist/render/trackers.js +135 -0
- package/dist/shared/egress.js +299 -0
- package/dist/shared/json.js +16 -0
- package/dist/shared/log-prefix.js +7 -0
- package/dist/shared/package-json.js +22 -0
- package/dist/shared/package-manager.js +32 -0
- package/dist/shared/package-roots.js +145 -0
- package/dist/shared/protected-paths.js +153 -0
- package/dist/shared/settings.js +44 -0
- package/dist/shared/timeouts.js +19 -0
- package/dist/tools/wording.js +680 -0
- package/package.json +101 -4
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
// checks/after/tools.ts — local tooling: the Vale package, workflow lint tools, gate stubs, and
|
|
2
|
+
// the dependency-updater choice.
|
|
3
|
+
import * as fs from "node:fs";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { spawnSync } from "node:child_process";
|
|
6
|
+
/** True when `cmd --version` runs (binary on PATH, exits 0). */
|
|
7
|
+
function toolVersionRuns(cmd) {
|
|
8
|
+
const res = spawnSync(cmd, ["--version"], {
|
|
9
|
+
stdio: ["ignore", "ignore", "ignore"],
|
|
10
|
+
timeout: 5000,
|
|
11
|
+
});
|
|
12
|
+
return res.status === 0;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Detect whether vale is installed but write-good styles are not synced.
|
|
16
|
+
* Returns null if vale is not on PATH (silent skip — not an error).
|
|
17
|
+
*/
|
|
18
|
+
export function detectValePackageNotSynced(cwd) {
|
|
19
|
+
if (!toolVersionRuns("vale"))
|
|
20
|
+
return null; // vale not on PATH — silent skip
|
|
21
|
+
if (fs.existsSync(path.join(cwd, ".vale", "styles", "write-good")))
|
|
22
|
+
return null;
|
|
23
|
+
// `vale sync` reads `Packages` from .vale.ini; without one it has nothing to download.
|
|
24
|
+
if (!fs.existsSync(path.join(cwd, ".vale.ini"))) {
|
|
25
|
+
return {
|
|
26
|
+
id: "vale-package-not-synced",
|
|
27
|
+
severity: "advisory",
|
|
28
|
+
detect: "vale is on PATH but the repo has no .vale.ini and .vale/styles/write-good/ is absent — prose linting does not run.",
|
|
29
|
+
action: "Adopt bkit's Vale template first: copy .bkit/templates/.vale.ini to .vale.ini and .bkit/templates/.vale/styles/House/*.yml to .vale/styles/House/. Then run `vale sync` (one-time per repo) to download the write-good package the copied .vale.ini names. `vale sync` reads its package list from .vale.ini, so it cannot fetch write-good before that file exists.",
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
id: "vale-package-not-synced",
|
|
34
|
+
severity: "advisory",
|
|
35
|
+
detect: "vale is on PATH but .vale/styles/write-good/ is absent — vale packages not synced.",
|
|
36
|
+
action: "Run `vale sync` (one-time per repo) to download the write-good package. lint:prose tries to self-heal this (copy from the main worktree, then `vale sync`) and warns loudly on stderr if it cannot — but until the package is present, prose linting does not run.",
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Detect incomplete local workflow-lint tooling: `actionlint` and/or `shellcheck`
|
|
41
|
+
* not on PATH. `pnpm bkit:lint:workflows` soft-skips without actionlint, and actionlint
|
|
42
|
+
* skips shellcheck on `run:` blocks without shellcheck — so invalid GHA expressions
|
|
43
|
+
* and shell issues in `.github/workflows/*` surface only in CI (the runner preinstalls
|
|
44
|
+
* both). Recommends installing both for pre-push parity. Only fires when the repo has
|
|
45
|
+
* workflow files to lint. bkit does NOT install these binaries (same as vale).
|
|
46
|
+
*/
|
|
47
|
+
export function detectWorkflowLintToolsMissing(cwd) {
|
|
48
|
+
const wfDir = path.join(cwd, ".github", "workflows");
|
|
49
|
+
if (!fs.existsSync(wfDir))
|
|
50
|
+
return null;
|
|
51
|
+
const hasWorkflow = fs.readdirSync(wfDir).some((f) => f.endsWith(".yml") || f.endsWith(".yaml"));
|
|
52
|
+
if (!hasWorkflow)
|
|
53
|
+
return null;
|
|
54
|
+
const missing = ["actionlint", "shellcheck"].filter((t) => !toolVersionRuns(t));
|
|
55
|
+
if (missing.length === 0)
|
|
56
|
+
return null;
|
|
57
|
+
return {
|
|
58
|
+
id: "workflow-lint-tools-missing",
|
|
59
|
+
severity: "advisory",
|
|
60
|
+
detect: `Local workflow-lint tooling incomplete (missing: ${missing.join(", ")}). \`pnpm bkit:lint:workflows\` soft-skips without actionlint, and actionlint skips shellcheck on \`run:\` blocks without shellcheck — so GHA-expression and shell issues in .github/workflows/* are caught only in CI.`,
|
|
61
|
+
action: "Install both for pre-push parity (actionlint runs shellcheck automatically when it is on PATH):\n\n brew install actionlint shellcheck # macOS\n\nThen `pnpm bkit:lint:workflows` lints `.github/workflows/*` locally before you push.",
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const BKIT_STUBS = [
|
|
65
|
+
{
|
|
66
|
+
id: "auto-force-e2e",
|
|
67
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
68
|
+
description: "Auto-trigger E2E on PRs whose diff touches sensitive paths (auth, migrations, payment, api, server).",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: "migrations-immutable",
|
|
72
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
73
|
+
description: "Fail PRs that modify supabase/migrations/* files already present on the base branch — enforces migration immutability after merge.",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "test-presence",
|
|
77
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
78
|
+
description: "Warn when a workspace package declares a `test` script but contains zero `*.test.ts(x)` / `*.spec.ts(x)` files (guards against accidental deletion).",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "supabase-migrate",
|
|
82
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
83
|
+
description: "REMOTE `db push` belongs in `bkit-tests-migration`, not in the monolithic tests job and not in `bkit-tests-e2e-web`. Prefer the migration-lane stub (always-on; replay plan-/path-gated; push on every push to dev/main; e2e/live `needs:` it). Legacy single-job shape still documented under this stub for repos without a migration lane yet — migrate into bkit-tests-migration ASAP. Requires the host access token + project ref (e.g. SUPABASE_ACCESS_TOKEN, or the host's env pull).",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "test-db",
|
|
87
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
88
|
+
description: "Assert schema-invariant DB checks (e.g. 'every public table has RLS enabled', no hardcoded table list) so they aren't app-defined. Two co-equal routes — pick by deploy topology, not by whether you can run pgTAP locally: (1) pgTAP (`supabase db test` over `supabase/tests/*.sql`) against a CI-local fixture built from `supabase/migrations` — fast, hermetic, offline, but the fixture can differ from prod, so it can stay green while prod RLS is broken; best when there is no deploy/`@live` tier, or for pure-logic DB unit tests. (2) a `@live` catalog-RPC (SECURITY DEFINER, service_role-only, called over REST; direct port-5432 from CI runners is IPv4-flaky) that validates the real deployed schema in `bkit-tests-live-web` — the recommended default once you have a deploy + `@live` tier (RLS/tenancy especially: a passing local-fixture check is not evidence that prod is locked down). See docs/testing.md § Schema-invariant DB checks.",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: "vercel-await",
|
|
92
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
93
|
+
description: "Poll the Vercel API for the PR's preview deployment by commit SHA and export `target_url` for E2E. Requires VERCEL_TOKEN, VERCEL_TEAM_ID, VERCEL_PROJECT_ID secrets.",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "e2e",
|
|
97
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
98
|
+
description: "Run `pnpm test:e2e` gated on `should_run_full` (the `[force full]` commit/PR tag) or `needs_e2e` (auto-force-e2e). Pairs with vercel-await for PR-time runs against the preview deployment.",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: "smoke",
|
|
102
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
103
|
+
description: "Post-CI smoke test triggered by `workflow_run` after main-CI succeeds. Cannot share a file with push/pull_request triggers — copy the commented YAML to a new `.github/workflows/smoke.yml` file.",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "coverage",
|
|
107
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
108
|
+
description: "Report vitest coverage on PRs via davelosert/vitest-coverage-report-action (free, runs inside Actions with GITHUB_TOKEN — no third-party service, safe for private repos). PER-TIER: unit and integration are measured and commented SEPARATELY (a single merged number lets integration mask a hollow unit suite — coverage is a union). Report-only by default: nothing fails the build until a threshold is set. Enabling (documented in the stub header): (1) add `@vitest/coverage-v8` (pinned to your vitest major) plus a vitest.config coverage block with `reporter: ['text','json-summary','json']` and `reportOnFailure: true` — json-summary + json are load-bearing (the action reads coverage-summary.json and coverage-final.json); (2) run coverage TWICE into separate dirs — unit → coverage/unit (exclude integration files), integration → coverage/integration — so each tier gets its own honest number (avoids the last-writer-wins clobber a second same-dir run would cause); (3) add a JOB-LEVEL permissions block to bkit-tests-unit with `actions: read` + `contents: read` + `pull-requests: write` — job-level REPLACES the workflow-level block (not additive) and the Check SHA Cache step needs `actions: read`, so omitting it breaks the cache step; (4) two report steps with distinct `name:` (unit / integration) pointing at each dir's coverage-summary.json + coverage-final.json. SEPARATE LANES (one job per tier): put the integration run + report + its OWN pull-requests: write block in bkit-tests-integration, not bkit-tests-unit — each lane posts its own comment. Thresholds are opt-in and PER TIER: UNIT is the gate — pass `--coverage.thresholds.branches` as a CLI flag on the unit run ONLY (vitest coverage is per-RUN/root config, NOT per-project — `projects` does not scope it and a config `thresholds` block reds BOTH runs; a per-run flag cannot leak to integration; branches is the meaningful floor, set to current and ratchet up). INTEGRATION is REPORT-ONLY — gate it on EXECUTION (the capstone's integration_ran > 0), not a %: a whole-repo integration % is denominator-noise (it covers boundaries/flows, not pure logic). For a real integration %, add `--coverage.include=src/server/**` on the integration run (same CLI-flag idiom as --exclude) then set a floor, or ratchet from current — never a picked number. Fork PRs: GITHUB_TOKEN is read-only, so keep the `head.repo == repo` guard on the steps (or use the action's workflow_run two-workflow pattern). Guard the integration report on `hashFiles('coverage/integration/coverage-summary.json') != ''` so a repo with no integration tier skips it cleanly.",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "e2e-coverage",
|
|
112
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
113
|
+
description: "Report Playwright E2E code-coverage on PRs — the third coverage tier, sibling of `coverage` (unit/integration). Free, entirely inside Actions with GITHUB_TOKEN (no third-party service, private-repo safe). Report-only by default. Unlike vitest there is NO --coverage flag: Playwright is black-box and does not instrument your source, so enabling is a 3-part pipeline documented in the stub header: (1) COLLECT during the E2E run — either an Istanbul instrumented build (`vite-plugin-istanbul` → window.__coverage__, cross-browser, scraped in a Playwright fixture) or the V8 API (`page.coverage`, Chromium-only, needs source maps); (2) REPORT with Monocart (`monocart-coverage-reports`, via the `monocart-reporter` Playwright reporter) which ingests EITHER V8 or Istanbul input and emits Istanbul-format coverage/e2e/coverage-summary.json + coverage-final.json — the SAME two files davelosert reads, so no new commenter is needed; (3) COMMENT by reusing davelosert/vitest-coverage-report-action@v2 pointed at coverage/e2e with a DISTINCT `name: e2e` so its sticky comment does not collide with the unit/integration ones. This step posts from the bkit-tests-e2e-web lane (or, with the combined starter, the bkit-tests-unit job as `coverage`), and needs that lane's job-level permissions block (pull-requests: write + actions: read + contents: read) or the comment cannot post. Ship NO threshold: a whole-app E2E % is denominator-noise (E2E exercises flows, not every branch) — gate the tier on the E2E step succeeding, not a %; for a real E2E % scope Monocart's entryFilter/sourceFilter then ratchet from current. The head.repo == repo guard skips fork PRs (read-only GITHUB_TOKEN); the hashFiles('coverage/e2e/coverage-summary.json') guard skips repos with no E2E coverage. See docs/testing.md § E2E coverage on PRs.",
|
|
114
|
+
},
|
|
115
|
+
// --- The 4-job "green == validated" scaffold. ---
|
|
116
|
+
// These ship commented in the FULL CI SCAFFOLD REFERENCE block at the end of the
|
|
117
|
+
// template bkit-ci.yml. Order matters when adopting — see that block.
|
|
118
|
+
{
|
|
119
|
+
id: "bkit-tests-scope",
|
|
120
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
121
|
+
description: "Promote run-level detection into a standalone always-on `bkit-tests-scope` job that emits ONE bkit-test-plan JSON (run_level / web_affected / run_e2e / run_live / run_migration), consumed by every tier via `fromJSON(needs.bkit-tests-scope.outputs.plan).<field>`. `run_migration` (#385) gates migration-lane HEAVY replay steps only — the migration job itself stays always-on so e2e/live can `needs:` it. This is the foundation of the scaffold that makes 'CI green' mean 'the planned tests actually ran'. The FULL CI SCAFFOLD REFERENCE (JOB 1) in `.bkit/templates/.github/workflows/bkit-ci.yml` lays the job out step by step (a single-package repo drops the [M] steps; the plan then comes from the commit markers and the event alone); `.bkit/templates.md` § CI workflow covers the `bkit-tests-check` capstone it feeds. Add the planner to the capstone's `needs:` and gate each lane on `run_level != 'none'`. NAME: keep it inside the bkit-tests-* namespace so bkit's CI-Dispatch Gate (which polls for any bkit-tests-* check on the pushed HEAD) can see it. NAMESPACE TRAP: it is the PLANNER, not a test lane — any capstone/guard that treats every bkit-tests-* job as a lane must exempt it BY NAME and assert its result explicitly, or a scope failure goes unasserted and the capstone stays green.",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: "affected-graph",
|
|
125
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
126
|
+
description: "Inside bkit-tests-scope, replace any frozen path-allowlist with `turbo query affected --packages` so run_level / web_affected track the real dependency blast radius. Monorepo-only — drop for single-package repos. Capture turbo stdout/stderr SEPARATELY: `2>&1` merges turbo's banner into the JSON and jq silently falls back to [] (a ghost-green run).",
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: "bkit-tests-live-web",
|
|
130
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
131
|
+
description: "Add push-only `bkit-tests-live-web` running the @live tier against the deployed URL. Omit the job if you have no deploy. needs: [bkit-tests-scope, bkit-tests-migration, bkit-tests-reset, bkit-tests-build-web], each with result != 'failure' except scope (success) and the lane's own run_live gate. Do NOT also needs: static/unit/integration/e2e. A planned failure reds the capstone. /bkit-ship still filters a job named bkit-tests-live; this name does not match.",
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: "bkit-tests-migration",
|
|
135
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
136
|
+
description: "Add always-on `bkit-tests-migration` (#385): (1) prove every migration replays from an EMPTY database (+ seed) on a fresh ephemeral instance; (2) on every push to `dev`/`main`, `db push --linked --include-all` to the shared remote (NOT inside e2e — that races @live). NO job-level `if:` — e2e/live `needs:` this lane; a skip cascades. Gate HEAVY replay steps via `plan.run_migration` (preferred) or an in-job Detect step. Remote push is un-gated by `run_migration` (self-heal) and runs AFTER replay so from-empty failure never reaches remote. Capstone asserts `result == success` whenever scope succeeded. Supply stack reset+seed (Supabase: `db reset --local`; Prisma: `migrate reset`; Drizzle/raw: replay + seed). Fold into bkit-tests-check `needs:` — NOT in series before static/unit (they share no state).",
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: "bkit-tests-integration",
|
|
140
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
141
|
+
description: "Add the integration tier as its OWN parallel lane (job) — `bkit-tests-integration`, NOT a step in bkit-tests-unit. WHEN: you have *.integration.test.ts (multi-module wiring / real infra boundaries). Separate lanes give each tier its own honest coverage number, executed-count, and permissions. Wiring: needs:[bkit-tests-scope]; if run_level != 'none'; self-contained (own checkout/setup/install); gate the heavy steps on web_affected; emit `integration_ran` (vitest --reporter=json) so bkit-tests-check can assert it ran > 0. The bkit-stub:coverage integration report (davelosert, name: integration, report-only) posts from THIS lane with its own job-level `pull-requests: write`. Fold the lane into bkit-tests-check's `needs:`.",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "bkit-tests-e2e-web",
|
|
145
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
146
|
+
description: "Add browser E2E as its own lane — `bkit-tests-e2e-web` (e.g. Playwright). WHEN: you have a browser suite and a deploy or a local stack to hit. needs: [bkit-tests-scope, bkit-tests-migration, bkit-tests-reset, bkit-tests-build-web], migration/reset/build result != 'failure'. A feature→dev PR hits a local stack with this PR's migrations; every other event hits the deployment. Same outcome rules everywhere; a pass on retry is a failure; target from TEST_URL alone. Emit e2e_ran. Fold into bkit-tests-check's needs:. DROP if you have no browser E2E.",
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: "bkit-tests-build-web",
|
|
150
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
151
|
+
description: "Add `bkit-tests-build-web`. WHEN: a later lane tests this commit's deployment, or a compile break should report on its own. Either compile the workspace, or create the host deployment and publish deployment_url + deployment_id un-promoted (e.g. Vercel). needs:[bkit-tests-scope]. Emits no *_ran count. Fold into bkit-tests-check's needs:.",
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: "bkit-tests-reset",
|
|
155
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
156
|
+
description: "Add `bkit-tests-reset`. WHEN: two or more lanes use ONE long-lived resource (demo tenant, seeded account). Runs after scope + migration, takes a lease, and puts the resource in its known state BEFORE those lanes start. needs: [bkit-tests-scope, bkit-tests-migration]; if tenant_target != ''. Pair with bkit-tests-cleanup. DROP both when the resource is provisioned fresh per run.",
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: "bkit-tests-cleanup",
|
|
160
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
161
|
+
description: "Add `bkit-tests-cleanup`, the other half of bkit-tests-reset. Runs last, if: always(), after every lane that used the shared resource. Puts it back and releases the lease, including when a lane failed or the run was cancelled. Capstone reds if a planned reset skipped or cleanup failed.",
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: "bkit-tests-build-ios",
|
|
165
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
166
|
+
description: "Add `bkit-tests-build-ios`. WHEN: you ship an iOS app. Same rule on a PR, a push, and a dispatch — not a post-merge canary. needs:[bkit-tests-scope]; if: plan.run_native_ios. Pair with bkit-tests-e2e-ios. DROP if you have no iOS app. e.g. a hosted device-build service.",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "bkit-tests-e2e-ios",
|
|
170
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
171
|
+
description: "Add `bkit-tests-e2e-ios`. needs: [bkit-tests-scope, bkit-tests-migration, bkit-tests-reset, bkit-tests-build-ios, bkit-tests-build-web]. The if: must name each needs.result because !cancelled() disables GitHub's skip-on-failed-needs. Emit native_e2e_ran. Fold into bkit-tests-check. DROP if you have no iOS app.",
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: "bkit-tests-build-android",
|
|
175
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
176
|
+
description: "Add `bkit-tests-build-android`. Same contract as bkit-tests-build-ios, android tokens. DROP if you have no Android app.",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: "bkit-tests-e2e-android",
|
|
180
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
181
|
+
description: "Add `bkit-tests-e2e-android`. Same contract as bkit-tests-e2e-ios, android tokens. DROP if you have no Android app.",
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: "logging-probe",
|
|
185
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
186
|
+
description: "Inside each runtime lane (bkit-tests-e2e-web, bkit-tests-live-web, bkit-tests-e2e-ios, bkit-tests-e2e-android), emit one marked event and ask the error tracker whether it arrived. e.g. Sentry. Skip when that lane did not run the probe. A missing marker reds the lane. DROP if you have no error tracker. This is a step, not a job.",
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
id: "bkit-tests-deploy",
|
|
190
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
191
|
+
description: "Add `bkit-tests-deploy`. needs: [bkit-tests-check, bkit-tests-build-web]. Push to the default branch only. Not a required check. Promotes the exact deployment_id the build lane published. A red job means the previous deployment stays live. The host must not auto-build the default branch, and any hold-promotion-until-check setting stays empty.",
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
id: "health",
|
|
195
|
+
file: ".github/workflows/bkit-ci.yml",
|
|
196
|
+
description: "Copy the commented workflow to .github/workflows/health.yml. workflow_run after CI succeeds on the default branch; smoke the deployment this SHA promoted. Not a required check. DROP if you have no deployed health URL.",
|
|
197
|
+
},
|
|
198
|
+
];
|
|
199
|
+
export function detectBkitStubs(cwd) {
|
|
200
|
+
const findings = [];
|
|
201
|
+
// Cache file reads so repeated scans of the same file are O(1).
|
|
202
|
+
const fileCache = new Map();
|
|
203
|
+
const readOnce = (file) => {
|
|
204
|
+
if (fileCache.has(file))
|
|
205
|
+
return fileCache.get(file) ?? null;
|
|
206
|
+
const abs = path.join(cwd, file);
|
|
207
|
+
try {
|
|
208
|
+
const content = fs.existsSync(abs) ? fs.readFileSync(abs, "utf-8") : null;
|
|
209
|
+
fileCache.set(file, content);
|
|
210
|
+
return content;
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
fileCache.set(file, null);
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
// Track which stubs are still commented (sentinel present) so the pair-conflict
|
|
218
|
+
// pass below can compare against per-stub "enabled" markers (the named YAML step
|
|
219
|
+
// appearing uncommented).
|
|
220
|
+
const stubSentinelPresent = new Set();
|
|
221
|
+
for (const stub of BKIT_STUBS) {
|
|
222
|
+
const content = readOnce(stub.file);
|
|
223
|
+
if (content === null)
|
|
224
|
+
continue;
|
|
225
|
+
// Sentinel is the full HEADER form — `# bkit-stub:<id> — <description>` — the line the
|
|
226
|
+
// advisory tells you to delete. Prose back-references ("the bkit-stub:coverage integration
|
|
227
|
+
// report posts from HERE") do not match, and `# bkit-stub:e2e —` cannot match stub
|
|
228
|
+
// `e2e-coverage` (a `-` follows, not a space).
|
|
229
|
+
const sentinel = `# bkit-stub:${stub.id}`;
|
|
230
|
+
const re = new RegExp(`(^|\\n)\\s*${sentinel.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s+—`);
|
|
231
|
+
if (!re.test(content))
|
|
232
|
+
continue;
|
|
233
|
+
stubSentinelPresent.add(stub.id);
|
|
234
|
+
findings.push({
|
|
235
|
+
id: `bkit-stub-${stub.id}`,
|
|
236
|
+
severity: "advisory",
|
|
237
|
+
detect: `${stub.file} contains the bkit-stub:${stub.id} sentinel — a commented-in block shipped disabled by default.`,
|
|
238
|
+
action: `${stub.description}\n\n` +
|
|
239
|
+
`Before enabling a CI lane, read docs/testing.md § CI test tiers and docs/deployments.md (one run per branch, push base, promote after the capstone). The FULL CI SCAFFOLD REFERENCE in bkit-ci.yml is the job graph: needs, if, step names. Write the job from that graph and from those docs. Uncomment only a block that is already commented YAML or shell.\n\n` +
|
|
240
|
+
`Decide with the user: (a) enable — uncomment the YAML/shell block AND delete the \`# bkit-stub:${stub.id} — ...\` header line; (b) customise — adjust paths/secrets/conditions before uncommenting; (c) dismiss — delete the entire stub block (header + commented body).\n\n` +
|
|
241
|
+
`Until the sentinel is removed, this advisory fires every install / check.`,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
// Pair-conflict detection: enabling one half of a paired stub without the other
|
|
245
|
+
// produces a silent fallback. Detection signal: the named uncommented YAML step
|
|
246
|
+
// appears (sentinel removed → likely enabled), and the paired stub's sentinel
|
|
247
|
+
// is still present (still disabled).
|
|
248
|
+
const ciContent = readOnce(".github/workflows/bkit-ci.yml");
|
|
249
|
+
if (ciContent) {
|
|
250
|
+
// Match a YAML step name uncommented (leading `- name:` not preceded by `#`).
|
|
251
|
+
const isStepEnabled = (stepName) => {
|
|
252
|
+
const re = new RegExp(`(^|\\n)\\s*- name:\\s*${stepName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b`);
|
|
253
|
+
return re.test(ciContent);
|
|
254
|
+
};
|
|
255
|
+
const e2eEnabled = isStepEnabled("Run E2E Tests");
|
|
256
|
+
const vercelEnabled = isStepEnabled("Await Vercel Preview");
|
|
257
|
+
if (vercelEnabled && stubSentinelPresent.has("e2e")) {
|
|
258
|
+
findings.push({
|
|
259
|
+
id: "bkit-stub-pair-vercel-without-e2e",
|
|
260
|
+
severity: "advisory",
|
|
261
|
+
detect: ".github/workflows/bkit-ci.yml has `Await Vercel Preview` enabled but `Run E2E Tests` is still commented (bkit-stub:e2e sentinel present).",
|
|
262
|
+
action: "Either enable the `bkit-stub:e2e` block so the E2E step consumes `steps.vercel.outputs.target_url`, or remove the Vercel-await step — exporting `target_url` with no consumer wastes ~10 minutes of CI per PR.",
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
if (e2eEnabled && stubSentinelPresent.has("vercel-await")) {
|
|
266
|
+
findings.push({
|
|
267
|
+
id: "bkit-stub-pair-e2e-without-vercel",
|
|
268
|
+
severity: "advisory",
|
|
269
|
+
detect: ".github/workflows/bkit-ci.yml has `Run E2E Tests` enabled but `Await Vercel Preview` is still commented (bkit-stub:vercel-await sentinel present).",
|
|
270
|
+
action: "Enable the `bkit-stub:vercel-await` block so the E2E step's `TARGET_URL` resolves to the PR's Vercel preview deployment. Without it, `TARGET_URL` falls back to `http://localhost:3000` and the E2E run hits an empty origin.",
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
if (e2eEnabled && stubSentinelPresent.has("auto-force-e2e")) {
|
|
274
|
+
findings.push({
|
|
275
|
+
id: "bkit-stub-pair-e2e-without-auto-force",
|
|
276
|
+
severity: "advisory",
|
|
277
|
+
detect: ".github/workflows/bkit-ci.yml has `Run E2E Tests` enabled but `bkit-stub:auto-force-e2e` is still commented.",
|
|
278
|
+
action: "E2E now requires `[force full]` in the commit/PR title on every run. Enable `bkit-stub:auto-force-e2e` to auto-trigger for PRs touching sensitive paths (auth, migrations, payment, api, server) without the manual tag.",
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return findings;
|
|
283
|
+
}
|
|
284
|
+
const UPDATER_EXAMPLE_PATHS = [
|
|
285
|
+
".bkit/templates/.github/renovate.json5",
|
|
286
|
+
".bkit/templates/.github/workflows/bkit-renovate.yml",
|
|
287
|
+
".bkit/templates/.github/dependabot.yml",
|
|
288
|
+
].join("\n ");
|
|
289
|
+
function updaterConfigPaths(cwd) {
|
|
290
|
+
const renovateJson5 = path.join(cwd, ".github", "renovate.json5");
|
|
291
|
+
const renovateJson = path.join(cwd, ".github", "renovate.json");
|
|
292
|
+
const dependabotYml = path.join(cwd, ".github", "dependabot.yml");
|
|
293
|
+
const dependabotYaml = path.join(cwd, ".github", "dependabot.yaml");
|
|
294
|
+
const renovate = fs.existsSync(renovateJson5)
|
|
295
|
+
? renovateJson5
|
|
296
|
+
: fs.existsSync(renovateJson)
|
|
297
|
+
? renovateJson
|
|
298
|
+
: null;
|
|
299
|
+
const dependabot = fs.existsSync(dependabotYml)
|
|
300
|
+
? dependabotYml
|
|
301
|
+
: fs.existsSync(dependabotYaml)
|
|
302
|
+
? dependabotYaml
|
|
303
|
+
: null;
|
|
304
|
+
return { renovate, dependabot };
|
|
305
|
+
}
|
|
306
|
+
/** `bkit.depUpdater: "none"` silences the missing-updater suggestion. Other values are ignored. */
|
|
307
|
+
function depUpdaterOptOut(cwd) {
|
|
308
|
+
const pkgPath = path.join(cwd, "package.json");
|
|
309
|
+
if (!fs.existsSync(pkgPath))
|
|
310
|
+
return false;
|
|
311
|
+
try {
|
|
312
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
313
|
+
const bkitField = pkg.bkit;
|
|
314
|
+
return bkitField?.depUpdater === "none";
|
|
315
|
+
}
|
|
316
|
+
catch {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Read-only dependency-updater check.
|
|
322
|
+
*
|
|
323
|
+
* - Both Renovate and Dependabot configs → they open competing PRs.
|
|
324
|
+
* - No updater config, workflows exist, and the opt-out is unset → point
|
|
325
|
+
* at the example templates.
|
|
326
|
+
*/
|
|
327
|
+
export function buildDepUpdaterSetupAdvisory(cwd) {
|
|
328
|
+
const { renovate, dependabot } = updaterConfigPaths(cwd);
|
|
329
|
+
if (renovate && dependabot) {
|
|
330
|
+
return {
|
|
331
|
+
id: "dep-updater-both",
|
|
332
|
+
severity: "advisory",
|
|
333
|
+
detect: "Both Renovate and Dependabot configs are present. Each opens update PRs for the same packages.",
|
|
334
|
+
action: "Keep one. Delete the config you are not using, and turn off that bot in the host UI.",
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
if (renovate || dependabot)
|
|
338
|
+
return null;
|
|
339
|
+
if (depUpdaterOptOut(cwd))
|
|
340
|
+
return null;
|
|
341
|
+
if (!fs.existsSync(path.join(cwd, ".github", "workflows")))
|
|
342
|
+
return null;
|
|
343
|
+
return {
|
|
344
|
+
id: "dep-updater-absent",
|
|
345
|
+
severity: "advisory",
|
|
346
|
+
detect: "No dependency updater config. SHA-pinned actions and package bumps will not refresh on their own.",
|
|
347
|
+
action: "Copy one example and own it:\n\n" +
|
|
348
|
+
` ${UPDATER_EXAMPLE_PATHS}\n\n` +
|
|
349
|
+
'Use one updater, not both. To silence this advisory, set `bkit.depUpdater` to `"none"` in package.json. See .bkit/templates.md.',
|
|
350
|
+
};
|
|
351
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// checks/after/vercel.ts — the Vercel project link, env and install command auth.
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { execFileSync } from "node:child_process";
|
|
5
|
+
/**
|
|
6
|
+
* Detect whether a Vercel project exists in the consumer's repo.
|
|
7
|
+
* Heuristic: presence of vercel.json at root or under apps/<name>/.
|
|
8
|
+
*/
|
|
9
|
+
export function detectVercelProject(cwd) {
|
|
10
|
+
if (fs.existsSync(path.join(cwd, "vercel.json")))
|
|
11
|
+
return true;
|
|
12
|
+
const appsDir = path.join(cwd, "apps");
|
|
13
|
+
if (!fs.existsSync(appsDir) || !fs.statSync(appsDir).isDirectory())
|
|
14
|
+
return false;
|
|
15
|
+
for (const entry of fs.readdirSync(appsDir, { withFileTypes: true })) {
|
|
16
|
+
if (!entry.isDirectory())
|
|
17
|
+
continue;
|
|
18
|
+
if (fs.existsSync(path.join(appsDir, entry.name, "vercel.json")))
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Detect whether BKIT_GH_TOKEN_INSTALL is present in a Vercel environment.
|
|
25
|
+
*
|
|
26
|
+
* B3 Vercel CLI hang guard: pre-checks `.vercel/project.json` and SKIPS `vercel env ls`
|
|
27
|
+
* when the file is absent. Does NOT shell out unless the project file exists — this
|
|
28
|
+
* avoids the CLI login prompt / TTY hang in non-interactive CI environments.
|
|
29
|
+
*
|
|
30
|
+
* Fallback: if detectVercelProject finds vercel.json but .vercel/project.json is absent,
|
|
31
|
+
* the project is not yet linked to a Vercel deployment — skip CLI call.
|
|
32
|
+
*/
|
|
33
|
+
export function detectVercelEnv(env, cwd = process.cwd()) {
|
|
34
|
+
if (!detectVercelProject(cwd))
|
|
35
|
+
return "unknown";
|
|
36
|
+
// Runtime guard: reject unexpected env values even though TypeScript narrows them.
|
|
37
|
+
if (env !== "preview" && env !== "production")
|
|
38
|
+
return "unknown";
|
|
39
|
+
// B3: Guard against `vercel env ls` hanging when the project is not linked.
|
|
40
|
+
// `.vercel/project.json` is written by `vercel link` — absent means not linked.
|
|
41
|
+
// Without this guard, `vercel env ls` blocks on a TTY login prompt in CI.
|
|
42
|
+
const vercelProjectFile = path.join(cwd, ".vercel", "project.json");
|
|
43
|
+
if (!fs.existsSync(vercelProjectFile))
|
|
44
|
+
return "unknown";
|
|
45
|
+
try {
|
|
46
|
+
const out = execFileSync("vercel", ["env", "ls", env], {
|
|
47
|
+
encoding: "utf-8",
|
|
48
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
49
|
+
timeout: 10000,
|
|
50
|
+
});
|
|
51
|
+
return out.includes("BKIT_GH_TOKEN_INSTALL") ? "present" : "missing";
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return "unknown";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Detect Vercel projects whose `vercel.json` does not authenticate to GH Packages in its
|
|
59
|
+
* install step. Vercel runs `pnpm install` in a fresh container with no pre-install shell
|
|
60
|
+
* hook, so the token must be written by an `installCommand` that runs
|
|
61
|
+
* `pnpm config set "//npm.pkg.github.com/:_authToken=$BKIT_GH_TOKEN_INSTALL"` before install — the
|
|
62
|
+
* registry-only project .npmrc carries no token on pnpm >=10.34.3. A vercel.json with no
|
|
63
|
+
* installCommand (or one whose installCommand lacks that `pnpm config set`) 401s on the
|
|
64
|
+
* @cbartens/bkit download even when BKIT_GH_TOKEN_INSTALL is present in the Vercel env.
|
|
65
|
+
*
|
|
66
|
+
* Uses a raw-content regex (like detectCiYmlMissingTokenEnv), not JSON.parse, so a
|
|
67
|
+
* non-standard-but-valid vercel.json still matches.
|
|
68
|
+
*
|
|
69
|
+
* Returns the offending vercel.json paths (relative to cwd); empty when all authenticate.
|
|
70
|
+
*/
|
|
71
|
+
export function detectVercelInstallCommandMissingAuth(cwd) {
|
|
72
|
+
// `\\?["']?` tolerates the JSON-escaped (`\"//npm…`), plain-quoted, and unquoted forms
|
|
73
|
+
// an installCommand string may take inside vercel.json.
|
|
74
|
+
const authPattern = /pnpm\s+config\s+set\s+\\?["']?\/\/npm\.pkg\.github\.com\/:_authToken=/;
|
|
75
|
+
const offenders = [];
|
|
76
|
+
const check = (file) => {
|
|
77
|
+
if (!fs.existsSync(file))
|
|
78
|
+
return;
|
|
79
|
+
if (!authPattern.test(fs.readFileSync(file, "utf-8")))
|
|
80
|
+
offenders.push(path.relative(cwd, file));
|
|
81
|
+
};
|
|
82
|
+
check(path.join(cwd, "vercel.json"));
|
|
83
|
+
const appsDir = path.join(cwd, "apps");
|
|
84
|
+
if (fs.existsSync(appsDir)) {
|
|
85
|
+
for (const entry of fs.readdirSync(appsDir, { withFileTypes: true })) {
|
|
86
|
+
if (entry.isDirectory())
|
|
87
|
+
check(path.join(appsDir, entry.name, "vercel.json"));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return offenders;
|
|
91
|
+
}
|
|
92
|
+
export const VERCEL_MISSING_ACTION = "Add the @cbartens registry mapping to .npmrc at the repo root (the token is NOT stored here):\n\n" +
|
|
93
|
+
" @cbartens:registry=https://npm.pkg.github.com\n\n" +
|
|
94
|
+
"Commit this .npmrc — Vercel reads it during its build.\n\n" +
|
|
95
|
+
"Vercel runs pnpm install in a fresh container and cannot run a pre-install shell step, so write the auth token via an installCommand in vercel.json:\n\n" +
|
|
96
|
+
' "installCommand": "pnpm config set //npm.pkg.github.com/:_authToken=$BKIT_GH_TOKEN_INSTALL && pnpm install"\n\n' +
|
|
97
|
+
"Set BKIT_GH_TOKEN_INSTALL as a Vercel environment variable for each environment:\n\n" +
|
|
98
|
+
" vercel env add BKIT_GH_TOKEN_INSTALL preview\n" +
|
|
99
|
+
" vercel env add BKIT_GH_TOKEN_INSTALL production\n\n" +
|
|
100
|
+
"Or via web: Vercel project → Settings → Environment Variables.\n" +
|
|
101
|
+
"The token must be a GitHub PAT with read:packages scope (classic) or Packages: read permission (fine-grained).\n\n" +
|
|
102
|
+
"Why the installCommand: pnpm >=10.34.3 does not authenticate a project-.npmrc ${BKIT_GH_TOKEN_INSTALL} env-substitution (it 401s on download), so the token must reach pnpm's user-level config via `pnpm config set` before install.";
|