@cbartens/bkit 6.1.0 → 6.2.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 +14 -12
- package/.bkit/core/.agents/docs.md +1 -11
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-gateguard.cjs +30 -9
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +25 -27
- package/.bkit/core/.agents/rules.md +22 -9
- package/.bkit/core/.bkit/README.md +13 -11
- package/.bkit/core/.bkit/authoring.md +58 -13
- package/.bkit/core/.bkit/cli.md +43 -33
- package/.bkit/core/.bkit/cloud.md +93 -30
- package/.bkit/core/.bkit/install.md +55 -16
- package/.bkit/core/.bkit/jsonl.md +24 -7
- package/.bkit/core/.bkit/pipeline.md +8 -8
- package/.bkit/core/.bkit/prompts.md +160 -43
- package/.bkit/core/.bkit/providers.md +99 -36
- package/.bkit/core/.bkit/templates.md +167 -37
- package/.bkit/core/.bkit/trackers.md +39 -6
- package/.bkit/core/.bkit/workflows.md +344 -136
- package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +50 -27
- package/.bkit/core/.claude/hooks/bkit-preflight.sh +11 -11
- package/.bkit/core/.codex/hooks/bkit-gateguard.cjs +13 -8
- package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +14 -25
- package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +20 -9
- package/.bkit/core/.cursor/hooks/bkit-preflight.sh +8 -8
- package/.bkit/core/.opencode/plugin/bkit-gateguard.js +14 -4
- package/.bkit/core/.opencode/plugin/bkit-guardrails.js +114 -0
- package/.bkit/core/docs/templates/bkit-audit-accessibility.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-adoption.md +30 -6
- package/.bkit/core/docs/templates/bkit-audit-agents.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-analytics.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-annotations.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-app-performance.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-app-store.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-architecture.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-config.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-cost.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-coverage.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-database.md +3 -3
- package/.bkit/core/docs/templates/bkit-audit-dead-code.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-deferrals.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-dependencies.md +3 -3
- package/.bkit/core/docs/templates/bkit-audit-documentation.md +32 -2
- package/.bkit/core/docs/templates/bkit-audit-duplication.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-failures.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-flakes.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-gates.md +5 -3
- package/.bkit/core/docs/templates/bkit-audit-issues.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-llm.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-logs.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-models.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-privacy.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-prompts.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-red-team.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-reliability.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-repo.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-security.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-slop.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-testing.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-usability.md +1 -1
- package/.bkit/core/docs/templates/bkit-plan.md +38 -8
- package/.bkit/core/engine/checks/after/auth.ts +118 -47
- package/.bkit/core/engine/checks/after/github.ts +161 -37
- package/.bkit/core/engine/checks/after/index.ts +18 -3
- package/.bkit/core/engine/checks/after/tools.ts +245 -1
- package/.bkit/core/engine/checks/before/files.ts +59 -1
- package/.bkit/core/engine/checks/before/index.ts +8 -0
- package/.bkit/core/engine/checks/status-holes.ts +20 -26
- package/.bkit/core/engine/checks/tips/catalogue.ts +107 -10
- package/.bkit/core/engine/checks/tips/detect.ts +36 -3
- package/.bkit/core/engine/checks/tips/index.ts +1 -1
- package/.bkit/core/engine/cli.ts +13 -13
- package/.bkit/core/engine/commands/ci/ci.ts +124 -19
- package/.bkit/core/engine/commands/ci/push-gate.ts +101 -43
- package/.bkit/core/engine/commands/install/doctor.ts +5 -5
- package/.bkit/core/engine/commands/install/install.ts +28 -25
- package/.bkit/core/engine/commands/install/uninstall.ts +42 -30
- package/.bkit/core/engine/commands/install/upgrade.ts +14 -2
- package/.bkit/core/engine/commands/land.ts +2 -3
- package/.bkit/core/engine/commands/lib.ts +394 -39
- package/.bkit/core/engine/commands/registry.ts +1 -1
- package/.bkit/core/engine/commands/workflow/branches.ts +351 -78
- package/.bkit/core/engine/commands/workflow/challenge.ts +63 -14
- package/.bkit/core/engine/commands/workflow/context.ts +71 -10
- package/.bkit/core/engine/commands/workflow/counters.ts +298 -23
- package/.bkit/core/engine/commands/workflow/decisions.ts +260 -125
- package/.bkit/core/engine/commands/workflow/disk.ts +2 -1
- package/.bkit/core/engine/commands/workflow/feature-base.ts +66 -0
- package/.bkit/core/engine/commands/workflow/issues.ts +312 -17
- package/.bkit/core/engine/commands/workflow/junit.ts +204 -0
- package/.bkit/core/engine/commands/workflow/ledgers.ts +904 -99
- package/.bkit/core/engine/commands/workflow/locks.ts +186 -29
- package/.bkit/core/engine/commands/workflow/loops.ts +87 -0
- package/.bkit/core/engine/commands/workflow/open-decision.ts +251 -0
- package/.bkit/core/engine/commands/workflow/plan-blocks.ts +8 -0
- package/.bkit/core/engine/commands/workflow/plans.ts +1 -1
- package/.bkit/core/engine/commands/workflow/prs.ts +311 -16
- package/.bkit/core/engine/commands/workflow/repo.ts +1 -1
- package/.bkit/core/engine/commands/workflow/run-facts.ts +6 -0
- package/.bkit/core/engine/commands/workflow/runs.ts +877 -174
- package/.bkit/core/engine/commands/workflow/runtime.ts +12 -4
- package/.bkit/core/engine/commands/workflow/status.ts +324 -11
- package/.bkit/core/engine/commands/workflow/step-table.ts +41 -15
- package/.bkit/core/engine/commands/workflow/steps.ts +604 -29
- package/.bkit/core/engine/commands/workflow/summary-findings.ts +1 -1
- package/.bkit/core/engine/commands/workflow/summary.ts +314 -8
- package/.bkit/core/engine/commands/workflow/tasks.ts +400 -27
- package/.bkit/core/engine/commands/workflow/tests-base.ts +319 -0
- package/.bkit/core/engine/commands/workflow/tests-changed.ts +138 -74
- package/.bkit/core/engine/commands/workflow/tests-jump.ts +93 -0
- package/.bkit/core/engine/commands/workflow/tests.ts +815 -182
- package/.bkit/core/engine/commands/workflow/tracker.ts +1134 -137
- package/.bkit/core/engine/commands/workflow/workflows.ts +100 -72
- package/.bkit/core/engine/commands/workflow/worktrees.ts +421 -57
- package/.bkit/core/engine/install/cloud-env.ts +38 -10
- package/.bkit/core/engine/install/managed-block.ts +105 -0
- package/.bkit/core/engine/install/manifest.ts +7 -1
- package/.bkit/core/engine/install/modules/claude.ts +6 -2
- package/.bkit/core/engine/install/modules/cloud.ts +84 -95
- package/.bkit/core/engine/install/modules/codex.ts +10 -2
- package/.bkit/core/engine/install/modules/core.ts +202 -26
- package/.bkit/core/engine/install/modules/opencode.ts +18 -23
- package/.bkit/core/engine/install/network-allowlist.ts +8 -3
- package/.bkit/core/engine/install/project-docs.ts +650 -0
- package/.bkit/core/engine/install/template-copies.ts +58 -5
- package/.bkit/core/engine/install/write.ts +128 -7
- package/.bkit/core/engine/ledgers/journal.ts +18 -10
- package/.bkit/core/engine/ledgers/migrate.ts +20 -8
- package/.bkit/core/engine/ledgers/status.ts +604 -8
- package/.bkit/core/engine/ledgers/telemetry.ts +115 -13
- package/.bkit/core/engine/render/trackers.ts +46 -11
- package/.bkit/core/engine/shared/package-manager.ts +7 -3
- package/.bkit/core/engine/shared/settings.ts +12 -1
- package/.bkit/core/engine/shared/text.ts +14 -0
- package/.bkit/core/engine/tools/instructions-sources.ts +1 -0
- package/.bkit/core/engine/tools/instructions.ts +116 -20
- package/.bkit/core/hooks/antigravity-hook.js +20 -4
- package/.bkit/core/hooks/gateguard-edit-payload.js +8 -5
- package/.bkit/core/hooks/gateguard-engine.js +249 -23
- package/.bkit/core/hooks/guardrails-deny.js +167 -0
- package/.bkit/core/hooks/guardrails-read.js +3 -3
- package/.bkit/core/hooks/guardrails-shell.js +1122 -167
- package/.bkit/core/hooks/guardrails-tiers.js +247 -176
- package/.bkit/core/hooks/preflight-tracker.sh +219 -0
- package/.bkit/core/prompts/bkit-audit-generate.md +23 -6
- package/.bkit/core/prompts/bkit-build-challenge-1.md +5 -4
- package/.bkit/core/prompts/bkit-build-challenge-2.md +6 -5
- package/.bkit/core/prompts/bkit-build-install-skills.md +2 -2
- package/.bkit/core/prompts/bkit-build-plan-convert.md +21 -7
- package/.bkit/core/prompts/bkit-build-plan-current.md +5 -4
- package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +22 -17
- package/.bkit/core/prompts/bkit-build-plan-tasks.md +16 -12
- package/.bkit/core/prompts/bkit-build-plan-tests.md +14 -10
- package/.bkit/core/prompts/bkit-build-plan-verify.md +21 -8
- package/.bkit/core/prompts/bkit-debug-abort-handover.md +10 -5
- package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +22 -6
- package/.bkit/core/prompts/bkit-debug-failure-remediate.md +19 -3
- package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +22 -6
- package/.bkit/core/prompts/bkit-debug-failure-soak.md +10 -7
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +3 -3
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +4 -4
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +3 -3
- package/.bkit/core/prompts/bkit-design-generate.md +6 -4
- package/.bkit/core/prompts/bkit-design-organise.md +4 -3
- package/.bkit/core/prompts/bkit-design-review-1.md +5 -4
- package/.bkit/core/prompts/bkit-design-review-2.md +6 -5
- package/.bkit/core/prompts/bkit-design-spike.md +4 -3
- package/.bkit/core/prompts/bkit-design-update.md +6 -4
- package/.bkit/core/prompts/bkit-plan-generate.md +35 -14
- package/.bkit/core/prompts/bkit-plan-review-1.md +9 -7
- package/.bkit/core/prompts/bkit-plan-review-2.md +9 -7
- package/.bkit/core/prompts/bkit-plan-scope-check.md +8 -6
- package/.bkit/core/prompts/bkit-plan-update.md +22 -8
- package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +11 -8
- package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +9 -5
- package/.bkit/core/prompts/bkit-ship-update-docs.md +26 -4
- package/.bkit/core/prompts/bkit-utility-compress-markdown.md +3 -3
- package/.bkit/core/prompts/bkit-utility-update-decisions.md +10 -7
- package/.bkit/core/prompts/bkit-utility-update-deferrals.md +8 -5
- package/.bkit/core/prompts/bkit-utility-update-documentation.md +31 -7
- package/.bkit/core/prompts/bkit-utility-update-failures.md +8 -5
- package/.bkit/core/prompts/bkit-utility-update-knowledge.md +10 -7
- package/.bkit/core/prompts/bkit-utility-update-roadmap.md +4 -4
- package/.bkit/core/prompts/bkit-utility-update-tracker.md +4 -4
- package/.bkit/core/workflows/bkit-auto.md +23 -11
- package/.bkit/core/workflows/bkit-build.md +331 -100
- package/.bkit/core/workflows/bkit-debug.md +135 -64
- package/.bkit/core/workflows/bkit-design.md +58 -32
- package/.bkit/core/workflows/bkit-plan.md +73 -45
- package/.bkit/core/workflows/bkit-ship.md +233 -167
- package/.bkit/shared/.agents/plugins/bkit/hooks.json +1 -1
- package/.bkit/shared/.bkit/.env.example +5 -0
- package/.bkit/shared/.claude/bkit-cloud.md +7 -7
- package/.bkit/shared/.claude/settings.json +5 -1
- package/.bkit/shared/.cursor/bkit-cloud.md +1 -1
- package/.bkit/shared/.cursor/hooks.json +1 -1
- package/.bkit/shared/.opencode/opencode.json +11 -2
- package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +27 -0
- package/.bkit/templates/.cursor/Dockerfile +7 -7
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-idea.yml +1 -1
- package/.bkit/templates/.github/dependabot.yml +5 -0
- package/.bkit/templates/.github/renovate.json5 +5 -3
- package/.bkit/templates/.github/workflows/bkit-ci.yml +11 -11
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +525 -161
- package/.bkit/templates/.github/workflows/bkit-renovate.yml +2 -2
- package/.bkit/templates/.husky/pre-push +123 -6
- package/.bkit/templates/context/bkit-serena.md +1 -1
- package/.bkit/templates/context/bkit-vercel.md +103 -59
- package/.bkit/templates/docs/architecture.md +98 -0
- package/.bkit/templates/docs/capabilities.md +33 -37
- package/.bkit/templates/docs/components.md +142 -0
- package/.bkit/templates/docs/data-schema.md +87 -0
- package/.bkit/{shared → templates}/docs/deployments.md +128 -142
- package/.bkit/templates/docs/design.md +117 -0
- package/.bkit/templates/docs/noise.md +54 -0
- package/.bkit/templates/docs/observability.md +99 -0
- package/.bkit/templates/docs/security.md +137 -0
- package/.bkit/templates/docs/setup.md +93 -0
- package/.bkit/templates/docs/technology.md +70 -0
- package/.bkit/{shared → templates}/docs/testing.md +200 -87
- package/.bkit/templates/scripts/ci/bkit-check-accepted-divergences.mjs +1 -6
- package/.bkit/templates/scripts/ci/bkit-machine-lock.sh +511 -103
- package/.bkit/templates/scripts/ci/bkit-test-awake.mjs +314 -28
- package/.bkit/templates/scripts/ci/bkit-test-awake.test.mjs +500 -1
- package/.bkit/templates/scripts/graphify/bkit-graphify-graphml.py +1 -1
- package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +91 -62
- package/.bkit/templates/scripts/graphify/bkit-graphify.sh +59 -11
- package/.bkit/templates/slop-scan.config.json +2 -0
- package/CHANGELOG.md +79 -0
- package/DETAILS.md +661 -0
- package/README.md +73 -604
- package/dist/checks/after/auth.js +114 -46
- package/dist/checks/after/github.js +138 -35
- package/dist/checks/after/index.js +16 -4
- package/dist/checks/after/tools.js +224 -1
- package/dist/checks/before/files.js +59 -1
- package/dist/checks/before/index.js +7 -1
- package/dist/checks/status-holes.js +20 -21
- package/dist/checks/tips/catalogue.js +99 -10
- package/dist/checks/tips/detect.js +35 -3
- package/dist/checks/tips/index.js +1 -1
- package/dist/cli.js +13 -13
- package/dist/commands/ci/ci.js +113 -20
- package/dist/commands/ci/push-gate.js +79 -44
- package/dist/commands/install/doctor.js +5 -5
- package/dist/commands/install/install.js +23 -22
- package/dist/commands/install/uninstall.js +36 -30
- package/dist/commands/install/upgrade.js +10 -2
- package/dist/commands/land.js +2 -3
- package/dist/commands/lib.js +323 -25
- package/dist/commands/workflow/branches.js +312 -72
- package/dist/commands/workflow/challenge.js +66 -13
- package/dist/commands/workflow/context.js +46 -10
- package/dist/commands/workflow/counters.js +231 -23
- package/dist/commands/workflow/decisions.js +221 -106
- package/dist/commands/workflow/disk.js +2 -1
- package/dist/commands/workflow/feature-base.js +60 -0
- package/dist/commands/workflow/issues.js +243 -15
- package/dist/commands/workflow/junit.js +137 -0
- package/dist/commands/workflow/ledgers.js +726 -112
- package/dist/commands/workflow/locks.js +150 -29
- package/dist/commands/workflow/loops.js +67 -0
- package/dist/commands/workflow/open-decision.js +199 -0
- package/dist/commands/workflow/plan-blocks.js +6 -0
- package/dist/commands/workflow/plans.js +1 -1
- package/dist/commands/workflow/prs.js +272 -16
- package/dist/commands/workflow/repo.js +1 -1
- package/dist/commands/workflow/run-facts.js +6 -0
- package/dist/commands/workflow/runs.js +747 -155
- package/dist/commands/workflow/runtime.js +8 -4
- package/dist/commands/workflow/status.js +259 -13
- package/dist/commands/workflow/step-table.js +41 -15
- package/dist/commands/workflow/steps.js +530 -26
- package/dist/commands/workflow/summary-findings.js +1 -1
- package/dist/commands/workflow/summary.js +289 -8
- package/dist/commands/workflow/tasks.js +294 -27
- package/dist/commands/workflow/tests-base.js +266 -0
- package/dist/commands/workflow/tests-changed.js +130 -56
- package/dist/commands/workflow/tests-jump.js +77 -0
- package/dist/commands/workflow/tests.js +608 -131
- package/dist/commands/workflow/tracker.js +920 -112
- package/dist/commands/workflow/workflows.js +80 -59
- package/dist/commands/workflow/worktrees.js +387 -58
- package/dist/install/cloud-env.js +32 -10
- package/dist/install/managed-block.js +101 -0
- package/dist/install/manifest.js +7 -1
- package/dist/install/modules/claude.js +6 -2
- package/dist/install/modules/cloud.js +73 -86
- package/dist/install/modules/codex.js +9 -2
- package/dist/install/modules/core.js +190 -27
- package/dist/install/modules/opencode.js +18 -23
- package/dist/install/network-allowlist.js +8 -3
- package/dist/install/project-docs.js +551 -0
- package/dist/install/template-copies.js +55 -5
- package/dist/install/write.js +117 -5
- package/dist/ledgers/journal.js +10 -8
- package/dist/ledgers/migrate.js +20 -9
- package/dist/ledgers/status.js +461 -8
- package/dist/ledgers/telemetry.js +71 -13
- package/dist/render/trackers.js +21 -12
- package/dist/shared/package-manager.js +7 -2
- package/dist/shared/settings.js +8 -0
- package/dist/shared/text.js +13 -0
- package/dist/tools/instructions-sources.js +1 -0
- package/dist/tools/instructions.js +97 -24
- package/package.json +23 -15
- package/.bkit/core/hooks/preflight-linear.sh +0 -73
- package/.bkit/shared/docs/architecture.md +0 -16
- package/.bkit/shared/docs/data-schema.md +0 -16
- package/.bkit/shared/docs/design.md +0 -38
- package/.bkit/shared/docs/noise.md +0 -20
- package/.bkit/shared/docs/observability.md +0 -22
- package/.bkit/shared/docs/security.md +0 -62
- package/.bkit/shared/docs/setup.md +0 -52
- package/.bkit/shared/docs/technology.md +0 -15
- /package/.bkit/templates/{.lintstagedrc.json → lintstagedrc.example.json} +0 -0
- /package/.bkit/templates/{.prettierignore → prettierignore.example} +0 -0
|
@@ -4,6 +4,8 @@ import * as fs from "node:fs";
|
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
6
|
import { readJsonFile } from "../../shared/json.js";
|
|
7
|
+
import { readBkitConfig } from "../../shared/settings.js";
|
|
8
|
+
import { OPENCODE_PROVIDER_DEFAULTS } from "../../shared/egress.js";
|
|
7
9
|
/**
|
|
8
10
|
* Detect whether BKIT_GH_TOKEN is set in the shell environment. Distinguishes
|
|
9
11
|
* empty from unset so action text can guide the user precisely. Never reads the
|
|
@@ -126,11 +128,25 @@ export function buildCloudDashboardsAdvisory(cwd) {
|
|
|
126
128
|
return null;
|
|
127
129
|
const sections = [];
|
|
128
130
|
if (hasRouter) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
const config = readBkitConfig(cwd);
|
|
132
|
+
const agent = config.cloudAgents === "none" ? "claude" : config.cloudAgents;
|
|
133
|
+
let secret = "BKIT_ANTHROPIC_API_KEY";
|
|
134
|
+
if (agent === "codex")
|
|
135
|
+
secret = "BKIT_OPENAI_API_KEY";
|
|
136
|
+
else if (agent === "opencode")
|
|
137
|
+
secret = config.opencodeProvider
|
|
138
|
+
? OPENCODE_PROVIDER_DEFAULTS[config.opencodeProvider].envVar
|
|
139
|
+
: "BKIT_<PROVIDER>_API_KEY";
|
|
140
|
+
let text = "**GitHub Actions** (used by bkit-cloud.yml and your own workflows):\n" +
|
|
141
|
+
` gh secret set ${secret} --body='<value>'\n\n` +
|
|
142
|
+
` Verify: \`gh secret list | grep -E '${secret}'\`\n\n`;
|
|
143
|
+
if (agent === "claude")
|
|
144
|
+
text +=
|
|
145
|
+
" Keyless alternative for bkit-cloud.yml (workload identity federation): leave the secret unset and set the `ANTHROPIC_FEDERATION_RULE_ID` + `ANTHROPIC_ORGANIZATION_ID` repo variables (`gh variable set`) from a Claude Console federation rule.\n\n" +
|
|
146
|
+
" BKIT_ANTHROPIC_API_KEY is read from the Anthropic dashboard (https://console.anthropic.com/settings/keys); `.bkit/.env` holds the same value. The Claude GitHub App (`/install-github-app`) is also required for `cloud=claude`.";
|
|
147
|
+
else
|
|
148
|
+
text += ` \`.bkit/.env\` holds the same value as ${secret}.`;
|
|
149
|
+
sections.push(text);
|
|
134
150
|
}
|
|
135
151
|
for (const [, text] of present)
|
|
136
152
|
sections.push(text);
|
|
@@ -146,61 +162,113 @@ export function buildCloudDashboardsAdvisory(cwd) {
|
|
|
146
162
|
}
|
|
147
163
|
/** Repo variables that, both set, switch bkit-cloud.yml's claude job to workload identity federation. */
|
|
148
164
|
const FEDERATION_VARIABLES = ["ANTHROPIC_FEDERATION_RULE_ID", "ANTHROPIC_ORGANIZATION_ID"];
|
|
165
|
+
const LEGACY_ANTHROPIC = "ANTHROPIC_API_KEY";
|
|
166
|
+
const BKIT_ANTHROPIC = "BKIT_ANTHROPIC_API_KEY";
|
|
149
167
|
/**
|
|
150
|
-
*
|
|
151
|
-
* `.github/workflows/bkit-cloud.yml` exists.
|
|
152
|
-
* `
|
|
153
|
-
*
|
|
154
|
-
* `
|
|
155
|
-
*
|
|
168
|
+
* Secret findings for the adopted `bkit-cloud.yml`, per recorded variant and tracker.
|
|
169
|
+
* Only fires when `.github/workflows/bkit-cloud.yml` exists. Every finding is keyed on the
|
|
170
|
+
* secret names the adopted copy reads (`secrets.BKIT_` sniff): a legacy copy keeps its
|
|
171
|
+
* legacy names and gets no rename finding; a current copy gets `BKIT_` names plus
|
|
172
|
+
* `cloud-router-secret-renamed` when only the legacy twin is set. Claude: the key secret or
|
|
173
|
+
* workload identity federation (both `FEDERATION_VARIABLES` repo variables). Codex:
|
|
174
|
+
* `BKIT_OPENAI_API_KEY`. Linear / Jira: the tracker key (current copies only). Silent when
|
|
175
|
+
* gh cannot list secrets; when only the variables are unlistable, a missing key still
|
|
176
|
+
* raises the missing-credential finding.
|
|
156
177
|
*/
|
|
157
178
|
export function detectCiRouterSecrets(cwd) {
|
|
158
179
|
const routerPath = path.join(cwd, ".github", "workflows", "bkit-cloud.yml");
|
|
159
180
|
if (!fs.existsSync(routerPath))
|
|
160
181
|
return [];
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
182
|
+
const names = listGhNames("secret");
|
|
183
|
+
if (names === null)
|
|
163
184
|
return [];
|
|
185
|
+
const content = fs.readFileSync(routerPath, "utf-8");
|
|
186
|
+
const legacy = !content.includes("secrets.BKIT_");
|
|
187
|
+
const config = readBkitConfig(cwd);
|
|
188
|
+
const agent = config.cloudAgents === "none" ? "claude" : config.cloudAgents;
|
|
189
|
+
const findings = [];
|
|
190
|
+
if (!legacy && (config.issueTracker === "linear" || config.issueTracker === "jira")) {
|
|
191
|
+
const tk = config.issueTracker === "linear" ? "BKIT_LINEAR_API_KEY" : "BKIT_JIRA_API_KEY";
|
|
192
|
+
if (!names.includes(tk))
|
|
193
|
+
findings.push({
|
|
194
|
+
id: "cloud-router-tracker-secret-missing",
|
|
195
|
+
severity: "advisory",
|
|
196
|
+
detect: `The \`${tk}\` repo secret is not set. The router reads the \`bkit:auto\` label from ${config.issueTracker} with it; without it the router starts no agent.`,
|
|
197
|
+
action: `\`gh secret set ${tk} --body='<paste-value-here>'\`, then verify with \`gh secret list\`.`,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
if (agent === "codex") {
|
|
201
|
+
if (!legacy && !names.includes("BKIT_OPENAI_API_KEY"))
|
|
202
|
+
findings.push({
|
|
203
|
+
id: "codex-api-key-secret-missing",
|
|
204
|
+
severity: "advisory",
|
|
205
|
+
detect: "`bkit.cloud.agent` is `codex` but the `BKIT_OPENAI_API_KEY` repo secret is not set; the codex job exits no-op.",
|
|
206
|
+
action: "`gh secret set BKIT_OPENAI_API_KEY --body='<paste-value-here>'`, then verify with `gh secret list`.",
|
|
207
|
+
});
|
|
208
|
+
return findings;
|
|
209
|
+
}
|
|
210
|
+
if (agent === "opencode") {
|
|
211
|
+
const envVar = config.opencodeProvider
|
|
212
|
+
? OPENCODE_PROVIDER_DEFAULTS[config.opencodeProvider].envVar
|
|
213
|
+
: null;
|
|
214
|
+
if (!legacy && envVar && names.includes("OPENCODE_PROVIDER_KEY") && !names.includes(envVar))
|
|
215
|
+
findings.push({
|
|
216
|
+
id: "cloud-router-secret-renamed",
|
|
217
|
+
severity: "advisory",
|
|
218
|
+
detect: `The legacy \`OPENCODE_PROVIDER_KEY\` repo secret is set but \`${envVar}\`, the name the router now reads, is not.`,
|
|
219
|
+
action: `\`gh secret set ${envVar} --body='<same-value>'\`, then \`gh secret delete OPENCODE_PROVIDER_KEY\`.`,
|
|
220
|
+
});
|
|
221
|
+
return findings;
|
|
222
|
+
}
|
|
223
|
+
if (agent !== "claude")
|
|
224
|
+
return findings;
|
|
225
|
+
const keyName = legacy ? LEGACY_ANTHROPIC : BKIT_ANTHROPIC;
|
|
226
|
+
if (!legacy && names.includes(LEGACY_ANTHROPIC) && !names.includes(BKIT_ANTHROPIC)) {
|
|
227
|
+
findings.push({
|
|
228
|
+
id: "cloud-router-secret-renamed",
|
|
229
|
+
severity: "advisory",
|
|
230
|
+
detect: `The legacy \`${LEGACY_ANTHROPIC}\` repo secret is set but \`${BKIT_ANTHROPIC}\`, the name the router now reads, is not.`,
|
|
231
|
+
action: `\`gh secret set ${BKIT_ANTHROPIC} --body='<same-value>'\`, then \`gh secret delete ${LEGACY_ANTHROPIC}\`.`,
|
|
232
|
+
});
|
|
233
|
+
return findings;
|
|
234
|
+
}
|
|
235
|
+
const keyPresent = names.includes(keyName);
|
|
164
236
|
const variables = listGhNames("variable");
|
|
165
237
|
const federated = variables !== null && FEDERATION_VARIABLES.every((v) => variables.includes(v));
|
|
166
|
-
if (
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
];
|
|
238
|
+
if (keyPresent && federated) {
|
|
239
|
+
findings.push({
|
|
240
|
+
id: "anthropic-api-key-shadows-federation",
|
|
241
|
+
severity: "advisory",
|
|
242
|
+
detect: `The \`${keyName}\` repo secret and the \`ANTHROPIC_FEDERATION_RULE_ID\` + \`ANTHROPIC_ORGANIZATION_ID\` repo variables are all set. claude-code-action uses the key and skips workload identity federation.`,
|
|
243
|
+
action: `To run keyless, delete the secret: \`gh secret delete ${keyName}\`. To stay on the key, delete the variables: \`gh variable delete ANTHROPIC_FEDERATION_RULE_ID\` and \`gh variable delete ANTHROPIC_ORGANIZATION_ID\`.`,
|
|
244
|
+
});
|
|
245
|
+
return findings;
|
|
175
246
|
}
|
|
176
|
-
if (
|
|
177
|
-
return
|
|
247
|
+
if (keyPresent)
|
|
248
|
+
return findings;
|
|
178
249
|
if (federated) {
|
|
179
|
-
if (
|
|
180
|
-
|
|
181
|
-
return [
|
|
182
|
-
{
|
|
250
|
+
if (!content.includes("anthropic_federation_rule_id:"))
|
|
251
|
+
findings.push({
|
|
183
252
|
id: "anthropic-federation-template-stale",
|
|
184
253
|
severity: "advisory",
|
|
185
254
|
detect: "The `ANTHROPIC_FEDERATION_RULE_ID` + `ANTHROPIC_ORGANIZATION_ID` repo variables are set, but `.github/workflows/bkit-cloud.yml` does not pass `anthropic_federation_rule_id` to claude-code-action — the claude job exits no-op.",
|
|
186
255
|
action: "Re-copy the template: `cp .bkit/templates/.github/workflows/bkit-cloud.yml .github/workflows/bkit-cloud.yml`, then re-apply your own edits (the `runs-on` runner at minimum).",
|
|
187
|
-
}
|
|
188
|
-
|
|
256
|
+
});
|
|
257
|
+
return findings;
|
|
189
258
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
];
|
|
259
|
+
findings.push({
|
|
260
|
+
id: "anthropic-api-key-secret-missing",
|
|
261
|
+
severity: "advisory",
|
|
262
|
+
detect: variables === null
|
|
263
|
+
? `gh confirms the \`${keyName}\` repo secret is not set on this GitHub repo, and could not list repo variables to check for the \`ANTHROPIC_FEDERATION_RULE_ID\` + \`ANTHROPIC_ORGANIZATION_ID\` federation variables.`
|
|
264
|
+
: `gh confirms neither the \`${keyName}\` repo secret nor both \`ANTHROPIC_FEDERATION_RULE_ID\` + \`ANTHROPIC_ORGANIZATION_ID\` repo variables are set on this GitHub repo.`,
|
|
265
|
+
action: "`.github/workflows/bkit-cloud.yml`'s claude job needs one claude credential; without it, the job exits no-op. Set ONE of:\n\n" +
|
|
266
|
+
`- API key:\n\n gh secret set ${keyName} --body='<paste-value-here>'\n\n` +
|
|
267
|
+
"- Workload identity federation (keyless): Claude Console → Settings → Workload identity → Connect workload → GitHub Actions creates the issuer, service account and federation rule. Then:\n\n" +
|
|
268
|
+
" gh variable set ANTHROPIC_FEDERATION_RULE_ID --body='fdrl_...'\n" +
|
|
269
|
+
" gh variable set ANTHROPIC_ORGANIZATION_ID --body='<organization-uuid>'\n\n" +
|
|
270
|
+
" Optional: `ANTHROPIC_SERVICE_ACCOUNT_ID` (`svac_...`) and `ANTHROPIC_WORKSPACE_ID` (`wrkspc_...`, needed when the rule covers more than one workspace).\n\n" +
|
|
271
|
+
"Then verify: `gh secret list` / `gh variable list`. The workflow itself does not need redeploying — both are read at run time.",
|
|
272
|
+
});
|
|
273
|
+
return findings;
|
|
206
274
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import * as fs from "node:fs";
|
|
5
5
|
import * as path from "node:path";
|
|
6
6
|
import { execFileSync } from "node:child_process";
|
|
7
|
+
import { ISSUE_TRACKERS } from "../../install/manifest.js";
|
|
7
8
|
import { MCP_TOOLSETS_HEADER, parseToolsets } from "../../install/write.js";
|
|
8
9
|
import { parseJson, readJsonFile } from "../../shared/json.js";
|
|
9
10
|
import { readBkitConfig } from "../../shared/settings.js";
|
|
@@ -66,6 +67,7 @@ export function detectActionsWritePermissions() {
|
|
|
66
67
|
* - `github` → GitHub tracker: the GitHub MCP server authenticates with `BKIT_GH_TOKEN`; `gh` uses `gh auth login`.
|
|
67
68
|
* - `linear` → existing Linear setup message (BKIT_LINEAR_API_KEY + LINEAR_ISSUE_ID).
|
|
68
69
|
* - `jira` → admin switch, BKIT_JIRA_API_KEY and `bkit.tracker.jira` in package.json.
|
|
70
|
+
* - unknown → blocker naming the value and the valid names (the tracker guard fails on it too).
|
|
69
71
|
* - `none` → prompt to run `bkit install --tracker=github`, `--tracker=linear` or `--tracker=jira`.
|
|
70
72
|
*
|
|
71
73
|
* Only fires when bkit workflows are installed (.claude/ or .cursor/ present).
|
|
@@ -75,7 +77,15 @@ export function buildTrackerSetupAdvisory(cwd) {
|
|
|
75
77
|
const hasCursor = fs.existsSync(path.join(cwd, ".cursor"));
|
|
76
78
|
if (!hasClaude && !hasCursor)
|
|
77
79
|
return null;
|
|
78
|
-
const { issueTracker: tracker, issueTrackerExplicit } = readBkitConfig(cwd);
|
|
80
|
+
const { issueTracker: tracker, issueTrackerExplicit, issueTrackerUnknown } = readBkitConfig(cwd);
|
|
81
|
+
if (issueTrackerUnknown !== null) {
|
|
82
|
+
return {
|
|
83
|
+
id: "tracker-setup-unknown",
|
|
84
|
+
severity: "blocker",
|
|
85
|
+
detect: `\`bkit.tracker.default\` in package.json is "${issueTrackerUnknown}", which names no tracker bkit knows. bkit reads it as \`none\`, and the session-start tracker guard fails in every session it checks.`,
|
|
86
|
+
action: `Set \`bkit.tracker.default\` to one of: ${ISSUE_TRACKERS.join(", ")} (lowercase), or run \`bkit install --tracker=<name>\`.`,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
79
89
|
if (tracker === "github") {
|
|
80
90
|
return {
|
|
81
91
|
id: "tracker-setup-github",
|
|
@@ -219,6 +229,67 @@ function ghAsEngine(args) {
|
|
|
219
229
|
env: token ? { ...process.env, GH_TOKEN: token } : process.env,
|
|
220
230
|
});
|
|
221
231
|
}
|
|
232
|
+
const TRIVY_PROTECTION_ACTION = "Before landing a check rename, save the branch-protection and applicable ruleset settings. " +
|
|
233
|
+
"Coordinate `trivy` → `bkit-trivy` with the workflow change; verify the new check on the candidate commit before requiring it. " +
|
|
234
|
+
"Change only that context, preserving strict mode, app_id / integration_id bindings, bypass policies and unrelated checks. " +
|
|
235
|
+
"Never disable protection to unblock the rename. Re-read the settings and run `bkit doctor` afterwards. This advisory changes no remote settings.";
|
|
236
|
+
/** Inspect existing protected branches without changing their checks or rulesets. */
|
|
237
|
+
export function buildTrivyProtectionAdvisory(cwd) {
|
|
238
|
+
if (!fs.existsSync(path.join(cwd, ".github", "workflows", "bkit-trivy.yml")))
|
|
239
|
+
return null;
|
|
240
|
+
const stale = [];
|
|
241
|
+
let incomplete = false;
|
|
242
|
+
try {
|
|
243
|
+
const response = parseJson(ghAsEngine(["api", "repos/{owner}/{repo}/branches?protected=true&per_page=11"]));
|
|
244
|
+
if (!response.ok || !Array.isArray(response.value))
|
|
245
|
+
throw new Error("Branch list unavailable");
|
|
246
|
+
const branches = response.value;
|
|
247
|
+
incomplete = branches.length > 10;
|
|
248
|
+
for (const branch of branches.slice(0, 10)) {
|
|
249
|
+
if (typeof branch.name !== "string") {
|
|
250
|
+
incomplete = true;
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
const contexts = branch.protection?.required_status_checks?.contexts ?? [];
|
|
254
|
+
if (contexts.includes("trivy"))
|
|
255
|
+
stale.push(branch.name);
|
|
256
|
+
const rules = parseJson(ghAsEngine([
|
|
257
|
+
"api",
|
|
258
|
+
`repos/{owner}/{repo}/rules/branches/${encodeURIComponent(branch.name)}?per_page=100`,
|
|
259
|
+
]));
|
|
260
|
+
if (!rules.ok || !Array.isArray(rules.value)) {
|
|
261
|
+
incomplete = true;
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (rules.value.length === 100)
|
|
265
|
+
incomplete = true;
|
|
266
|
+
for (const rule of rules.value) {
|
|
267
|
+
if (rule?.type === "required_status_checks" &&
|
|
268
|
+
Array.isArray(rule.parameters?.required_status_checks) &&
|
|
269
|
+
rule.parameters.required_status_checks.some((check) => check.context === "trivy"))
|
|
270
|
+
stale.push(branch.name);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
incomplete = true;
|
|
276
|
+
}
|
|
277
|
+
if (stale.length > 0)
|
|
278
|
+
return {
|
|
279
|
+
id: "trivy-required-check-rename",
|
|
280
|
+
severity: "advisory",
|
|
281
|
+
detect: `Protected branches still require \`trivy\`: ${[...new Set(stale)].join(", ")}. The template emits \`bkit-trivy\`.${incomplete ? " Other protection was not fully checked." : ""}`,
|
|
282
|
+
action: TRIVY_PROTECTION_ACTION,
|
|
283
|
+
};
|
|
284
|
+
if (incomplete)
|
|
285
|
+
return {
|
|
286
|
+
id: "trivy-required-check-unchecked",
|
|
287
|
+
severity: "advisory",
|
|
288
|
+
detect: "Trivy required checks are unchecked: a GitHub read failed or exceeded the scan limit (10 protected branches, 100 rules per branch).",
|
|
289
|
+
action: "Inspect all affected branches and rulesets in GitHub Settings. " + TRIVY_PROTECTION_ACTION,
|
|
290
|
+
};
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
222
293
|
/**
|
|
223
294
|
* Whether the engine's token can move cards on the configured board: "present",
|
|
224
295
|
* "missing", or "unknown" (gh unavailable or unauthenticated). A classic token lists its
|
|
@@ -283,55 +354,87 @@ export function buildGithubProjectTokenScopeAdvisory(cwd) {
|
|
|
283
354
|
/**
|
|
284
355
|
* Emit a cloud-agents setup advisory (parity with the tracker / dep-updater
|
|
285
356
|
* advisories). Post-CI auto-routing (`bkit-cloud.yml`) is opt-in via
|
|
286
|
-
* `bkit install --auto
|
|
287
|
-
* consumers to make the choice post-install.
|
|
357
|
+
* `bkit install --auto=<claude|opencode|codex|cursor>`; it does NOT ship with a default
|
|
358
|
+
* install. This nudges consumers to make the choice post-install.
|
|
288
359
|
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
360
|
+
* Resolution order (file presence is authoritative, package.json field is the opt-out):
|
|
361
|
+
* - router present, claude without `id-token: write` → `cloud-claude-missing-id-token` (blocker)
|
|
362
|
+
* - router present, linear / jira, copy says it serves GitHub only → `cloud-router-tracker-stale`
|
|
363
|
+
* - router present, `cloud.agent` codex, no `openai/codex-action` → `cloud-router-codex-missing`
|
|
364
|
+
* - router present, `cloud.agent` absent → `cloud-router-agent-unset`
|
|
365
|
+
* - router present, `cloud.agent` none / cursor → `cloud-router` (router starts nothing)
|
|
366
|
+
* - router present otherwise → `cloud-router` (informational)
|
|
367
|
+
* - `bkit.cloud.agent === "none"` (explicit) → null (opt-out — stay quiet)
|
|
368
|
+
* - otherwise (undecided) → `cloud-router-none` (nudge)
|
|
293
369
|
*
|
|
294
|
-
*
|
|
295
|
-
* opt-out):
|
|
296
|
-
* - `.github/workflows/bkit-cloud.yml` present → `cloud-router` (informational; active)
|
|
297
|
-
* - `bkit.cloud.agent === "none"` → null (opt-out — stay quiet)
|
|
298
|
-
* - `bkit.tracker.default === "jira"` → null (Jira runs locally only)
|
|
299
|
-
* - otherwise (undecided) → `cloud-router-none` (nudge to choose)
|
|
300
|
-
*
|
|
301
|
-
* Only fires when there is a `.github/workflows/` dir (the router wakes on a CI
|
|
370
|
+
* Only nudges when there is a `.github/workflows/` dir (the router wakes on a CI
|
|
302
371
|
* completion event).
|
|
303
372
|
*/
|
|
304
373
|
export function buildCloudSetupAdvisory(cwd) {
|
|
305
374
|
const routerPath = path.join(cwd, ".github", "workflows", "bkit-cloud.yml");
|
|
306
375
|
if (fs.existsSync(routerPath)) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
if (
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
376
|
+
const { cloudAgents, cloudAgentsExplicit, issueTracker } = readBkitConfig(cwd);
|
|
377
|
+
const content = fs.readFileSync(routerPath, "utf-8");
|
|
378
|
+
const recopy = "Re-copy the template: `cp .bkit/templates/.github/workflows/bkit-cloud.yml .github/workflows/bkit-cloud.yml`, then re-apply your own edits (the `runs-on` runner and the `{{NODE_VERSION}}` value).";
|
|
379
|
+
if (cloudAgents === "claude" && !content.includes("id-token: write")) {
|
|
380
|
+
return {
|
|
381
|
+
id: "cloud-claude-missing-id-token",
|
|
382
|
+
severity: "blocker",
|
|
383
|
+
detect: "`bkit.cloud.agent` is `claude` but `.github/workflows/bkit-cloud.yml` lacks `id-token: write`. `claude-code-action@v1` will fail at boot with an OIDC error.",
|
|
384
|
+
action: `${recopy} Also verify the Claude GitHub App is installed (\`/install-github-app\`). See bkit's \`cloud.md\` § Post-CI auto-routing.`,
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
if ((issueTracker === "linear" || issueTracker === "jira") &&
|
|
388
|
+
content.includes("serves the GitHub tracker only")) {
|
|
389
|
+
return {
|
|
390
|
+
id: "cloud-router-tracker-stale",
|
|
391
|
+
severity: "advisory",
|
|
392
|
+
detect: `\`bkit.tracker.default\` is \`${issueTracker}\` but the adopted \`.github/workflows/bkit-cloud.yml\` serves the GitHub tracker only: it never dispatches an agent for ${issueTracker} issues.`,
|
|
393
|
+
action: recopy,
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
if (cloudAgents === "codex" && !content.includes("openai/codex-action")) {
|
|
397
|
+
return {
|
|
398
|
+
id: "cloud-router-codex-missing",
|
|
399
|
+
severity: "advisory",
|
|
400
|
+
detect: "`bkit.cloud.agent` is `codex` but the adopted `.github/workflows/bkit-cloud.yml` has no `openai/codex-action` job, so no Codex run starts.",
|
|
401
|
+
action: recopy,
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
if (!cloudAgentsExplicit) {
|
|
405
|
+
return {
|
|
406
|
+
id: "cloud-router-agent-unset",
|
|
407
|
+
severity: "advisory",
|
|
408
|
+
detect: "`.github/workflows/bkit-cloud.yml` is present but `bkit.cloud.agent` is not recorded, so the router cannot tell which agent job to start.",
|
|
409
|
+
action: "Record the variant: `pnpm bkit install --auto=claude`, `--auto=opencode` or `--auto=codex` (the agent whose credential you set).",
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
if (cloudAgents === "none" || cloudAgents === "cursor") {
|
|
413
|
+
return {
|
|
414
|
+
id: "cloud-router",
|
|
415
|
+
severity: "advisory",
|
|
416
|
+
detect: `\`.github/workflows/bkit-cloud.yml\` is present but \`bkit.cloud.agent\` is \`${cloudAgents}\`: the router starts no agent job for \`${cloudAgents}\`, so CI results dispatch nothing.`,
|
|
417
|
+
action: "Record the agent whose credential you set: `pnpm bkit install --auto=claude`, `--auto=opencode` or `--auto=codex`.",
|
|
418
|
+
};
|
|
320
419
|
}
|
|
420
|
+
const claude = cloudAgents === "claude";
|
|
421
|
+
const secret = cloudAgents === "codex"
|
|
422
|
+
? "`BKIT_OPENAI_API_KEY` repo secret"
|
|
423
|
+
: cloudAgents === "opencode"
|
|
424
|
+
? "opencode provider's `BKIT_` repo secret"
|
|
425
|
+
: "`BKIT_ANTHROPIC_API_KEY` repo secret OR the `ANTHROPIC_FEDERATION_RULE_ID` + `ANTHROPIC_ORGANIZATION_ID` repo variables (keyless workload identity federation)";
|
|
321
426
|
return {
|
|
322
427
|
id: "cloud-router",
|
|
323
428
|
severity: "advisory",
|
|
324
|
-
detect:
|
|
325
|
-
action: `The workflow requires: the
|
|
429
|
+
detect: `Cloud agents: post-CI auto-routing is configured for \`${cloudAgents}\` (\`.github/workflows/bkit-cloud.yml\` present).${claude ? " The Claude GitHub App is required — run `/install-github-app` (Claude Code CLI) once if not already done." : ""}`,
|
|
430
|
+
action: `The workflow requires: the ${secret}${claude ? ", the Claude GitHub App (`/install-github-app`)" : ""}, and GitHub Actions write permissions (org AND repo). See the \`bkit-auto-setup\` advisory (emitted by \`bkit install --auto=${cloudAgents}\`) and bkit's \`cloud.md\` § Post-CI auto-routing for the full checklist.\n\nbkit's agents comment as you, so every workflow those comments trigger notifies you, even ones that skip. To see only failures: GitHub → Settings → Notifications → System → Actions → "Only notify for failed workflows".`,
|
|
326
431
|
};
|
|
327
432
|
}
|
|
328
433
|
// No router present — distinguish opt-out from undecided.
|
|
329
|
-
const { cloudAgents, cloudAgentsExplicit
|
|
434
|
+
const { cloudAgents, cloudAgentsExplicit } = readBkitConfig(cwd);
|
|
330
435
|
if (cloudAgents === "none" && cloudAgentsExplicit) {
|
|
331
436
|
return null; // consumer explicitly chose `none` — stay quiet
|
|
332
437
|
}
|
|
333
|
-
if (issueTracker === "jira")
|
|
334
|
-
return null; // no cloud setup exists for a Jira tracker
|
|
335
438
|
// Only nudge if there's a workflows dir for the router to wake on.
|
|
336
439
|
if (!fs.existsSync(path.join(cwd, ".github", "workflows")))
|
|
337
440
|
return null;
|
|
@@ -339,8 +442,8 @@ export function buildCloudSetupAdvisory(cwd) {
|
|
|
339
442
|
id: "cloud-router-none",
|
|
340
443
|
severity: "advisory",
|
|
341
444
|
detect: "Cloud agents: post-CI auto-routing is not configured. `.github/workflows/` exists but no `bkit-cloud.yml` — CI pass/fail does not auto-dispatch bkit-ship / bkit-debug.",
|
|
342
|
-
action: "Optional post-install decision
|
|
343
|
-
"Prerequisites
|
|
445
|
+
action: "Optional post-install decision: `pnpm bkit install --auto=<claude|opencode|codex|cursor>` (any variant works with your wired tracker; `codex` also needs `--codex`).\n\n" +
|
|
446
|
+
"Prerequisites: the variant's `BKIT_` repo secret (`BKIT_ANTHROPIC_API_KEY`, `BKIT_OPENAI_API_KEY` or the opencode provider's key; claude may use the `ANTHROPIC_FEDERATION_RULE_ID` + `ANTHROPIC_ORGANIZATION_ID` repo variables instead), the tracker key under Linear / Jira, the Claude GitHub App (`/install-github-app`) for claude, and GitHub Actions write permissions.\n\n" +
|
|
344
447
|
'To opt out and silence this advisory, set `bkit.cloud.agent` to `"none"` in package.json.',
|
|
345
448
|
};
|
|
346
449
|
}
|
|
@@ -10,9 +10,10 @@ import { readBkitConfig } from "../../shared/settings.js";
|
|
|
10
10
|
import { detectOpencodeYmlProviderDrift } from "../../install/modules/opencode.js";
|
|
11
11
|
import { detectManagedDuplicate, detectManagedStale } from "./managed.js";
|
|
12
12
|
import { buildCloudDashboardsAdvisory, detectCiRouterSecrets, detectGhMcpToken } from "./auth.js";
|
|
13
|
-
import { buildCloudSetupAdvisory, buildGithubProjectAdvisory, buildGithubProjectTokenScopeAdvisory, buildTrackerSetupAdvisory, detectActionsWritePermissions, detectMainBranchProtection, } from "./github.js";
|
|
14
|
-
import { buildDepUpdaterSetupAdvisory, detectBkitStubs, detectValeMissing, detectValePackageNotSynced, detectWorkflowLintToolsMissing, } from "./tools.js";
|
|
13
|
+
import { buildCloudSetupAdvisory, buildGithubProjectAdvisory, buildGithubProjectTokenScopeAdvisory, buildTrackerSetupAdvisory, buildTrivyProtectionAdvisory, detectActionsWritePermissions, detectMainBranchProtection, } from "./github.js";
|
|
14
|
+
import { buildDepUpdaterSetupAdvisory, detectBkitStubs, detectProjectDocs, detectValeMissing, detectValePackageNotSynced, detectWorkflowLintToolsMissing, } from "./tools.js";
|
|
15
15
|
import { detectBkitCloudYmlAlwaysTrueGate, detectCiScriptsOldNames, detectCiYmlCapstoneContractDrift, detectCiYmlMissingActionlint, detectCiYmlRunInjection, detectGhaFloatingTags, detectRunLevelsNotComposed, detectTaggedTestsWithoutCiHome, detectTestIntegrationEnv, detectTurboIntegrationInputs, } from "./ci-yml.js";
|
|
16
|
+
import { isAdvisorySuppressed, } from "./suppression.js";
|
|
16
17
|
import { dropTipSilencedAdvisories, setupTipsChecklistLines, setupTipsMarkdownLines, } from "../tips/index.js";
|
|
17
18
|
// ---------------------------------------------------------------------------
|
|
18
19
|
// formatChecklist — pure renderer
|
|
@@ -261,14 +262,18 @@ export function runPostInstallCheck(preflightAdvisories, cwd = process.cwd(), su
|
|
|
261
262
|
const managedDuplicate = detectManagedDuplicate(cwd);
|
|
262
263
|
if (managedDuplicate)
|
|
263
264
|
phase3.push(managedDuplicate);
|
|
264
|
-
// BKIT_GH_TOKEN shell env — authenticates the GitHub MCP server.
|
|
265
|
-
|
|
265
|
+
// BKIT_GH_TOKEN shell env — authenticates the GitHub MCP server. Skipped inside the pre-push
|
|
266
|
+
// hook's inner run, which unsets the .bkit/.env keys on purpose (BKIT_PRE_PUSH_LOGGED is set).
|
|
267
|
+
const ghMcpToken = process.env.BKIT_PRE_PUSH_LOGGED ? null : detectGhMcpToken(cwd);
|
|
266
268
|
if (ghMcpToken)
|
|
267
269
|
phase3.push(ghMcpToken);
|
|
268
270
|
// Main branch protection — bkit's PR-base gates (build Step 16, ship Step 2)
|
|
269
271
|
// assert feat/* PRs target dev. Enforcing it at the GitHub layer needs branch
|
|
270
272
|
// protection on main restricting merges to PRs from dev.
|
|
271
273
|
const protectionStatus = detectMainBranchProtection();
|
|
274
|
+
const trivyProtection = buildTrivyProtectionAdvisory(cwd);
|
|
275
|
+
if (trivyProtection)
|
|
276
|
+
phase3.push(trivyProtection);
|
|
272
277
|
const scriptHint = "\n\nQuick path: run `bkit setup protect-main --dry-run` to preview the policy, then drop `--dry-run` to apply. It requires the CI capstone job named by `package.json` `bkit.testing.ciCapstone` (default `bkit-tests-check`, so the required check means 'validated', not just 'tests job did not fail') and pre-flights that the job exists in the `bkit.testing.ciWorkflow` file before requiring it.";
|
|
273
278
|
if (protectionStatus === "missing") {
|
|
274
279
|
phase3.push({
|
|
@@ -368,6 +373,13 @@ export function runPostInstallCheck(preflightAdvisories, cwd = process.cwd(), su
|
|
|
368
373
|
// bkit-stub sentinels in shipped templates — one advisory per still-commented stub.
|
|
369
374
|
for (const stub of detectBkitStubs(cwd))
|
|
370
375
|
phase3.push(stub);
|
|
376
|
+
// Project documents (docs/*.md): missing, empty, starter-only or unindexed. Advisory only.
|
|
377
|
+
for (const f of detectProjectDocs(cwd)) {
|
|
378
|
+
if (!isAdvisorySuppressed(cwd, f.id, f.severity))
|
|
379
|
+
phase3.push(f);
|
|
380
|
+
else
|
|
381
|
+
onSuppressed?.({ id: f.id, scope: "." });
|
|
382
|
+
}
|
|
371
383
|
// turbo.json inputs for cache-replay safety (KN-24).
|
|
372
384
|
for (const f of detectTurboIntegrationInputs(cwd))
|
|
373
385
|
phase3.push(f);
|