@cbartens/bkit 6.1.1 → 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 +42 -32
- 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 +97 -36
- package/.bkit/core/.bkit/templates.md +162 -34
- 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 +89 -37
- package/.bkit/core/engine/checks/after/index.ts +15 -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 +64 -11
- package/.bkit/core/engine/commands/ci/push-gate.ts +101 -43
- 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 +148 -14
- 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 +3 -1
- 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/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-machine-lock.sh +511 -103
- package/.bkit/templates/scripts/ci/bkit-test-awake.mjs +228 -35
- package/.bkit/templates/scripts/ci/bkit-test-awake.test.mjs +270 -2
- package/.bkit/templates/scripts/graphify/bkit-graphify-graphml.py +1 -1
- package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +92 -63
- package/.bkit/templates/scripts/graphify/bkit-graphify.sh +59 -11
- package/.bkit/templates/slop-scan.config.json +2 -0
- package/CHANGELOG.md +64 -0
- package/DETAILS.md +24 -19
- package/README.md +1 -1
- package/dist/checks/after/auth.js +114 -46
- package/dist/checks/after/github.js +77 -35
- package/dist/checks/after/index.js +12 -3
- 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 +56 -12
- package/dist/commands/ci/push-gate.js +79 -44
- 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 +133 -14
- 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 +3 -1
- 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 +22 -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
|
@@ -3,16 +3,19 @@
|
|
|
3
3
|
name: bkit-cloud
|
|
4
4
|
|
|
5
5
|
# Phase-routed cloud-agent workflow. One `context` job resolves the phase and its
|
|
6
|
-
# argument, then
|
|
7
|
-
# (via the opencode CLI `run` subcommand)
|
|
8
|
-
#
|
|
6
|
+
# argument, then ONE dispatch job (the recorded agent) — `claude` (via claude-code-action@v1),
|
|
7
|
+
# `opencode` (via the opencode CLI `run` subcommand) or `codex` (via openai/codex-action) —
|
|
8
|
+
# runs the same `/bkit-auto <phase> <arg>` orchestrator against the committed
|
|
9
|
+
# `.claude/` / `.opencode/` / `.codex/` config respectively.
|
|
9
10
|
#
|
|
10
|
-
# RUNTIME GATING —
|
|
11
|
-
# -
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
11
|
+
# RUNTIME GATING — one agent per run (in the context job):
|
|
12
|
+
# - The agent recorded in package.json `bkit.cloud.agent` (claude | opencode | codex)
|
|
13
|
+
# is the only router job that starts, and only when its credential is set:
|
|
14
|
+
# claude: BKIT_ANTHROPIC_API_KEY secret, or both ANTHROPIC_FEDERATION_RULE_ID and
|
|
15
|
+
# ANTHROPIC_ORGANIZATION_ID repo variables; opencode: any of BKIT_OPENCODE_API_KEY /
|
|
16
|
+
# BKIT_OPENROUTER_API_KEY / BKIT_OLLAMA_API_KEY; codex: BKIT_OPENAI_API_KEY.
|
|
17
|
+
# - No credential-presence fallback: another agent's secret never starts a job. A missing
|
|
18
|
+
# credential or an unrecorded agent starts nothing (zero billable runner minutes).
|
|
16
19
|
#
|
|
17
20
|
# Trigger surfaces:
|
|
18
21
|
# - workflow_run (CI completion on feat/**): success -> ship, failure -> debug
|
|
@@ -24,13 +27,13 @@ name: bkit-cloud
|
|
|
24
27
|
#
|
|
25
28
|
# Required credentials (claude job): Claude GitHub App (one-time `/install-github-app`;
|
|
26
29
|
# claude-code-action@v1 authenticates as the App via `id-token: write` OIDC) + ONE of:
|
|
27
|
-
# -
|
|
30
|
+
# - BKIT_ANTHROPIC_API_KEY repo secret, or
|
|
28
31
|
# - workload identity federation (keyless): ANTHROPIC_FEDERATION_RULE_ID +
|
|
29
32
|
# ANTHROPIC_ORGANIZATION_ID repo variables (+ optional ANTHROPIC_SERVICE_ACCOUNT_ID /
|
|
30
33
|
# ANTHROPIC_WORKSPACE_ID) from a Claude Console federation rule. A set
|
|
31
|
-
#
|
|
32
|
-
# Required secrets (opencode job):
|
|
33
|
-
# committed .opencode/opencode.json references
|
|
34
|
+
# BKIT_ANTHROPIC_API_KEY secret wins over federation — delete it when switching.
|
|
35
|
+
# Required secrets (opencode job): one of BKIT_OPENCODE_API_KEY / BKIT_OPENROUTER_API_KEY /
|
|
36
|
+
# BKIT_OLLAMA_API_KEY (the provider the committed .opencode/opencode.json references).
|
|
34
37
|
# Required tracker label on the issue: `bkit:auto` (opt-in) for the CI-driven path.
|
|
35
38
|
# Docs: bkit's cloud.md § Post-CI auto-routing.
|
|
36
39
|
|
|
@@ -65,32 +68,46 @@ run-name: >-
|
|
|
65
68
|
|| format('bkit auto {0}', github.event.workflow_run.head_commit.message) }}
|
|
66
69
|
|
|
67
70
|
concurrency:
|
|
68
|
-
#
|
|
69
|
-
# - dispatch path
|
|
70
|
-
# - CI-completion
|
|
71
|
-
#
|
|
72
|
-
#
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
71
|
+
# Keys a run by what it will do:
|
|
72
|
+
# - dispatch path keys on inputs.issue (e.g. bkit-auto-141)
|
|
73
|
+
# - CI-completion route keys on head_branch (e.g. bkit-auto-feat/141-cloud-app)
|
|
74
|
+
# - CI-completion no-op keys on its own run id (skip-<run_id>)
|
|
75
|
+
# The CI-completion route arm repeats the four conditions of the `context` job `if`
|
|
76
|
+
# (same repository, success or failure conclusion, the `bkit [auto route]` marker, not
|
|
77
|
+
# a green run on dev). A run that fails any of them does nothing, so it gets a group
|
|
78
|
+
# of its own and never queues behind, or displaces, a run that is working. The
|
|
79
|
+
# dispatch and CI-completion keys never match for one FID, so a dispatched build and
|
|
80
|
+
# the auto-ship it triggers do not share a group; the stale-run guard and the
|
|
81
|
+
# per-feature workflow lock (`bkit locks acquire`, `logs/{FID}/.lock`) handle that
|
|
82
|
+
# race.
|
|
83
|
+
group: >-
|
|
84
|
+
bkit-auto-${{ inputs.issue
|
|
85
|
+
|| (github.event.workflow_run.head_repository.full_name == github.repository
|
|
86
|
+
&& (github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure')
|
|
87
|
+
&& contains(github.event.workflow_run.head_commit.message, 'bkit [auto route]')
|
|
88
|
+
&& !(github.event.workflow_run.head_branch == 'dev' && github.event.workflow_run.conclusion == 'success')
|
|
89
|
+
&& github.event.workflow_run.head_branch)
|
|
90
|
+
|| format('skip-{0}', github.run_id) }}
|
|
91
|
+
# A newer run of a group replaces the one in flight (latest wins), so one branch
|
|
92
|
+
# never has two runs working, and pushing, at once. dev queues in place of
|
|
93
|
+
# cancelling: GitHub keeps at most one pending run per group and drops an older
|
|
94
|
+
# pending one when a newer one arrives, and the queued run re-checks staleness and
|
|
95
|
+
# the dispatch cap at its ctx step when it starts. `bkit-auto-dev` is ONE group
|
|
96
|
+
# shared by ALL FIDs (concurrency.group resolves from the trigger payload, before
|
|
97
|
+
# the ctx step derives the FID): if two DIFFERENT FIDs' dev CI runs fail
|
|
98
|
+
# near-simultaneously, the older pending run can be dropped. The ctx step's
|
|
99
|
+
# stale-run guard then writes a `dev-dispatch-dropped` row to the job summary + a
|
|
100
|
+
# `::warning::`.
|
|
84
101
|
cancel-in-progress: ${{ github.event.workflow_run.head_branch != 'dev' }}
|
|
85
102
|
|
|
86
103
|
jobs:
|
|
87
104
|
# ---------------------------------------------------------------------------
|
|
88
|
-
# context job —
|
|
89
|
-
# for
|
|
105
|
+
# context job — selects the recorded agent's job and resolves phase + arg ONCE
|
|
106
|
+
# for the router jobs. CI-driven runs fire only on terminal CI conclusions (skip
|
|
90
107
|
# cancelled / skipped). Free-tier gate: CI-driven runs additionally require
|
|
91
108
|
# 'bkit [auto route]' in the head commit message — zero runner minutes if the marker
|
|
92
109
|
# is absent (no opted-in close-workflow HEAD). Dispatched runs always proceed. When
|
|
93
|
-
# this job is skipped,
|
|
110
|
+
# this job is skipped, every router job is skipped with it.
|
|
94
111
|
# ---------------------------------------------------------------------------
|
|
95
112
|
context:
|
|
96
113
|
name: bkit-cloud-context (${{ github.event_name }})
|
|
@@ -110,61 +127,175 @@ jobs:
|
|
|
110
127
|
issues: read
|
|
111
128
|
actions: read
|
|
112
129
|
outputs:
|
|
113
|
-
|
|
114
|
-
|
|
130
|
+
agent: ${{ steps.select.outputs.agent }}
|
|
131
|
+
claude: ${{ steps.select.outputs.claude }}
|
|
132
|
+
opencode: ${{ steps.select.outputs.opencode }}
|
|
133
|
+
codex: ${{ steps.select.outputs.codex }}
|
|
134
|
+
dispatched: ${{ steps.select.outputs.dispatched }}
|
|
135
|
+
ignored: ${{ steps.select.outputs.ignored }}
|
|
115
136
|
skip: ${{ steps.ctx.outputs.skip }}
|
|
116
137
|
phase: ${{ steps.ctx.outputs.phase }}
|
|
117
138
|
arg: ${{ steps.ctx.outputs.arg }}
|
|
118
139
|
steps:
|
|
119
|
-
#
|
|
120
|
-
#
|
|
140
|
+
# With no router credential set, nothing below runs (no counter row, no checkout).
|
|
141
|
+
# Which single job starts is decided by `Select agent job` after checkout.
|
|
121
142
|
- name: Check runner credentials
|
|
122
143
|
id: gate
|
|
123
144
|
env:
|
|
124
|
-
|
|
145
|
+
BKIT_ANTHROPIC_API_KEY: ${{ secrets.BKIT_ANTHROPIC_API_KEY }}
|
|
125
146
|
ANTHROPIC_FEDERATION_RULE_ID: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
|
|
126
147
|
ANTHROPIC_ORGANIZATION_ID: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
|
|
127
|
-
|
|
148
|
+
BKIT_OPENCODE_API_KEY: ${{ secrets.BKIT_OPENCODE_API_KEY }}
|
|
149
|
+
BKIT_OPENROUTER_API_KEY: ${{ secrets.BKIT_OPENROUTER_API_KEY }}
|
|
150
|
+
BKIT_OLLAMA_API_KEY: ${{ secrets.BKIT_OLLAMA_API_KEY }}
|
|
151
|
+
BKIT_OPENAI_API_KEY: ${{ secrets.BKIT_OPENAI_API_KEY }}
|
|
128
152
|
run: |
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
claude=true
|
|
153
|
+
enabled=false
|
|
154
|
+
if [ -n "$BKIT_ANTHROPIC_API_KEY" ]; then
|
|
155
|
+
enabled=true
|
|
133
156
|
elif [ -n "$ANTHROPIC_FEDERATION_RULE_ID" ] && [ -n "$ANTHROPIC_ORGANIZATION_ID" ]; then
|
|
134
|
-
|
|
157
|
+
enabled=true
|
|
135
158
|
elif [ -n "$ANTHROPIC_FEDERATION_RULE_ID" ]; then
|
|
136
159
|
echo "::notice::ANTHROPIC_ORGANIZATION_ID repo variable not set — federation needs it alongside ANTHROPIC_FEDERATION_RULE_ID; claude job no-op."
|
|
137
160
|
elif [ -n "$ANTHROPIC_ORGANIZATION_ID" ]; then
|
|
138
161
|
echo "::notice::ANTHROPIC_FEDERATION_RULE_ID repo variable not set — federation needs it alongside ANTHROPIC_ORGANIZATION_ID; claude job no-op."
|
|
139
162
|
else
|
|
140
|
-
echo "::notice::Neither the
|
|
163
|
+
echo "::notice::Neither the BKIT_ANTHROPIC_API_KEY secret nor the ANTHROPIC_FEDERATION_RULE_ID + ANTHROPIC_ORGANIZATION_ID repo variables are set — claude job no-op."
|
|
141
164
|
fi
|
|
142
|
-
if [ -n "$
|
|
143
|
-
|
|
165
|
+
if [ -n "$BKIT_OPENCODE_API_KEY" ] || [ -n "$BKIT_OPENROUTER_API_KEY" ] || [ -n "$BKIT_OLLAMA_API_KEY" ]; then
|
|
166
|
+
enabled=true
|
|
144
167
|
else
|
|
145
|
-
echo "::notice::
|
|
168
|
+
echo "::notice::None of BKIT_OPENCODE_API_KEY, BKIT_OPENROUTER_API_KEY, BKIT_OLLAMA_API_KEY is set — opencode job no-op."
|
|
146
169
|
fi
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
echo "
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
} >> "$GITHUB_OUTPUT"
|
|
170
|
+
if [ -n "$BKIT_OPENAI_API_KEY" ]; then
|
|
171
|
+
enabled=true
|
|
172
|
+
else
|
|
173
|
+
echo "::notice::BKIT_OPENAI_API_KEY not set — codex job no-op."
|
|
174
|
+
fi
|
|
175
|
+
echo "enabled=$enabled" >> "$GITHUB_OUTPUT"
|
|
154
176
|
|
|
155
177
|
# SHA pins in this file — your updater refreshes them in your copy (keep this file out
|
|
156
178
|
# of renovate.json5 `ignorePaths`); `bkit upgrade` lists this template when bkit's pins move.
|
|
179
|
+
# Two checkouts. `pr-head` is DATA only: a feat/** run checks out the PR head branch
|
|
180
|
+
# (its `status.jsonl` and `.bkit/issues.jsonl` feature rows are what the router
|
|
181
|
+
# reads; `bkit.cloud` and `bkit.tracker` come from the `dev` checkout); a dev run and a workflow_dispatch check out `dev` there. The
|
|
182
|
+
# workspace root is always `dev`: bkit is installed and run from it, so a branch
|
|
183
|
+
# pushed by an agent session cannot change the code that decides the `bkit:auto` kill
|
|
184
|
+
# switch, and the dev arm commits its dispatch-cap counter row there.
|
|
185
|
+
# Order matters: the root `dev` checkout runs first because actions/checkout empties a
|
|
186
|
+
# workspace that has no .git, which would delete `pr-head/` if it ran second.
|
|
157
187
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
158
188
|
if: steps.gate.outputs.enabled == 'true'
|
|
159
189
|
with:
|
|
160
|
-
# `dev` at the workspace root: the dev arm's dispatch-cap counter row is
|
|
161
|
-
# committed to dev's `status.jsonl`; the feat/** arm reads the branch's
|
|
162
|
-
# `status.jsonl` from origin.
|
|
163
190
|
ref: dev
|
|
164
191
|
fetch-depth: 0
|
|
165
192
|
# The auto-provided GITHUB_TOKEN inherits the `permissions:` block above.
|
|
166
193
|
token: ${{ github.token }}
|
|
167
194
|
|
|
195
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
196
|
+
if: steps.gate.outputs.enabled == 'true'
|
|
197
|
+
with:
|
|
198
|
+
ref: ${{ startsWith(github.event.workflow_run.head_branch, 'feat/') && github.event.workflow_run.head_branch || 'dev' }}
|
|
199
|
+
path: pr-head
|
|
200
|
+
fetch-depth: 0
|
|
201
|
+
# Untrusted branch content: no credential is left in its git config.
|
|
202
|
+
persist-credentials: false
|
|
203
|
+
|
|
204
|
+
# The consumer's own bkit, from the `dev` lockfile, so the label gate reads the tracker through
|
|
205
|
+
# `bkit issues fetch` and FIDs through `bkit fids parse`. A failed install leaves
|
|
206
|
+
# node_modules/.bin/bkit absent: the gate reports bkit-unavailable and starts nothing.
|
|
207
|
+
# Pnpm version is resolved from the consumer's package.json#packageManager (single SoT).
|
|
208
|
+
# Do NOT add `with: version:` here — pnpm/action-setup errors when both are set.
|
|
209
|
+
# Both tooling steps are `continue-on-error`: a missing packageManager / lockfile or a failed
|
|
210
|
+
# download leaves bkit absent, and the gate then reports bkit-unavailable (green, nothing starts).
|
|
211
|
+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
|
|
212
|
+
if: steps.gate.outputs.enabled == 'true'
|
|
213
|
+
continue-on-error: true
|
|
214
|
+
|
|
215
|
+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
216
|
+
if: steps.gate.outputs.enabled == 'true'
|
|
217
|
+
continue-on-error: true
|
|
218
|
+
with:
|
|
219
|
+
node-version: {{NODE_VERSION}}
|
|
220
|
+
cache: pnpm
|
|
221
|
+
|
|
222
|
+
- name: Install bkit
|
|
223
|
+
if: steps.gate.outputs.enabled == 'true'
|
|
224
|
+
continue-on-error: true
|
|
225
|
+
run: pnpm install --frozen-lockfile --ignore-scripts
|
|
226
|
+
|
|
227
|
+
# Exactly one router job starts: the agent recorded in package.json `bkit.cloud.agent`,
|
|
228
|
+
# and only when that agent's BKIT_ secret is set. Another agent's secret never starts a
|
|
229
|
+
# job; Cursor runs through its own triggers and starts none here.
|
|
230
|
+
- name: Select agent job
|
|
231
|
+
id: select
|
|
232
|
+
if: steps.gate.outputs.enabled == 'true'
|
|
233
|
+
env:
|
|
234
|
+
BKIT_ANTHROPIC_API_KEY: ${{ secrets.BKIT_ANTHROPIC_API_KEY }}
|
|
235
|
+
ANTHROPIC_FEDERATION_RULE_ID: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
|
|
236
|
+
ANTHROPIC_ORGANIZATION_ID: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
|
|
237
|
+
BKIT_OPENCODE_API_KEY: ${{ secrets.BKIT_OPENCODE_API_KEY }}
|
|
238
|
+
BKIT_OPENROUTER_API_KEY: ${{ secrets.BKIT_OPENROUTER_API_KEY }}
|
|
239
|
+
BKIT_OLLAMA_API_KEY: ${{ secrets.BKIT_OLLAMA_API_KEY }}
|
|
240
|
+
BKIT_OPENAI_API_KEY: ${{ secrets.BKIT_OPENAI_API_KEY }}
|
|
241
|
+
HEAD_DIR: pr-head
|
|
242
|
+
run: |
|
|
243
|
+
# Routing config (`bkit.cloud.agent`) comes from the `dev` checkout (workspace root), never
|
|
244
|
+
# from the feat/** head: a branch cut before `bkit install --auto=` still dispatches,
|
|
245
|
+
# and the agent set on `dev` reaches in-flight branches. Only the five known values pass.
|
|
246
|
+
AGENT=$(jq -r '.bkit.cloud.agent // empty | strings' package.json 2>/dev/null || true)
|
|
247
|
+
case "$AGENT" in claude|opencode|codex|cursor|none) ;; *) AGENT="" ;; esac
|
|
248
|
+
AGENT="${AGENT:-none}"
|
|
249
|
+
claude=false
|
|
250
|
+
opencode=false
|
|
251
|
+
codex=false
|
|
252
|
+
dispatched=""
|
|
253
|
+
ignored=""
|
|
254
|
+
missing=""
|
|
255
|
+
have_claude=false
|
|
256
|
+
if [ -n "$BKIT_ANTHROPIC_API_KEY" ] || { [ -n "$ANTHROPIC_FEDERATION_RULE_ID" ] && [ -n "$ANTHROPIC_ORGANIZATION_ID" ]; }; then have_claude=true; fi
|
|
257
|
+
have_opencode=false
|
|
258
|
+
if [ -n "$BKIT_OPENCODE_API_KEY" ] || [ -n "$BKIT_OPENROUTER_API_KEY" ] || [ -n "$BKIT_OLLAMA_API_KEY" ]; then have_opencode=true; fi
|
|
259
|
+
have_codex=false
|
|
260
|
+
if [ -n "$BKIT_OPENAI_API_KEY" ]; then have_codex=true; fi
|
|
261
|
+
case "$AGENT" in
|
|
262
|
+
claude)
|
|
263
|
+
if [ "$have_claude" = true ]; then claude=true; dispatched=claude
|
|
264
|
+
else missing="BKIT_ANTHROPIC_API_KEY (or the ANTHROPIC_FEDERATION_RULE_ID + ANTHROPIC_ORGANIZATION_ID repo variables)"; fi
|
|
265
|
+
;;
|
|
266
|
+
opencode)
|
|
267
|
+
if [ "$have_opencode" = true ]; then opencode=true; dispatched=opencode
|
|
268
|
+
else missing="one of BKIT_OPENCODE_API_KEY, BKIT_OPENROUTER_API_KEY, BKIT_OLLAMA_API_KEY"; fi
|
|
269
|
+
;;
|
|
270
|
+
codex)
|
|
271
|
+
if [ "$have_codex" = true ]; then codex=true; dispatched=codex
|
|
272
|
+
else missing="BKIT_OPENAI_API_KEY"; fi
|
|
273
|
+
;;
|
|
274
|
+
cursor)
|
|
275
|
+
echo "::notice::bkit.cloud.agent is 'cursor' — Cursor runs through its own native triggers; no router job starts."
|
|
276
|
+
;;
|
|
277
|
+
*)
|
|
278
|
+
echo "::notice::bkit.cloud.agent is '$AGENT' — no router job starts. Run bkit install --auto=<claude|opencode|codex> to record one."
|
|
279
|
+
;;
|
|
280
|
+
esac
|
|
281
|
+
if [ -n "$missing" ]; then
|
|
282
|
+
echo "::notice::bkit.cloud.agent is '$AGENT' but its credential is not set (missing $missing) — no router job starts."
|
|
283
|
+
fi
|
|
284
|
+
[ "$have_claude" = true ] && [ "$AGENT" != claude ] && ignored="${ignored:+$ignored }claude"
|
|
285
|
+
[ "$have_opencode" = true ] && [ "$AGENT" != opencode ] && ignored="${ignored:+$ignored }opencode"
|
|
286
|
+
[ "$have_codex" = true ] && [ "$AGENT" != codex ] && ignored="${ignored:+$ignored }codex"
|
|
287
|
+
if [ -n "$ignored" ]; then
|
|
288
|
+
echo "::notice::Ignoring credentials for other agents ($ignored) — only the recorded agent '$AGENT' dispatches."
|
|
289
|
+
fi
|
|
290
|
+
{
|
|
291
|
+
echo "agent=$AGENT"
|
|
292
|
+
echo "claude=$claude"
|
|
293
|
+
echo "opencode=$opencode"
|
|
294
|
+
echo "codex=$codex"
|
|
295
|
+
echo "dispatched=$dispatched"
|
|
296
|
+
echo "ignored=$ignored"
|
|
297
|
+
} >> "$GITHUB_OUTPUT"
|
|
298
|
+
|
|
168
299
|
- name: Configure git user
|
|
169
300
|
if: steps.gate.outputs.enabled == 'true'
|
|
170
301
|
run: |
|
|
@@ -183,15 +314,30 @@ jobs:
|
|
|
183
314
|
BRANCH: ${{ github.event.workflow_run.head_branch }}
|
|
184
315
|
COMMIT_MSG: ${{ github.event.workflow_run.head_commit.message }}
|
|
185
316
|
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
|
|
317
|
+
BKIT_LINEAR_API_KEY: ${{ secrets.BKIT_LINEAR_API_KEY }}
|
|
318
|
+
BKIT_JIRA_API_KEY: ${{ secrets.BKIT_JIRA_API_KEY }}
|
|
319
|
+
SEL_AGENT: ${{ steps.select.outputs.agent }}
|
|
320
|
+
SEL_DISPATCHED: ${{ steps.select.outputs.dispatched }}
|
|
321
|
+
SEL_IGNORED: ${{ steps.select.outputs.ignored }}
|
|
322
|
+
HEAD_DIR: pr-head
|
|
186
323
|
run: |
|
|
187
324
|
set -euo pipefail
|
|
188
|
-
#
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
325
|
+
# bkit runs from the dev checkout (workspace root) against the data in HEAD_DIR.
|
|
326
|
+
HEAD_DIR="${HEAD_DIR:-.}"
|
|
327
|
+
BKIT_BIN="$PWD/node_modules/.bin/bkit"
|
|
328
|
+
# Routing config (`bkit.cloud`, `bkit.tracker`) is read from `dev`: overlay it onto the
|
|
329
|
+
# throwaway head checkout so bkit run there reads the same copy.
|
|
330
|
+
if [ "$HEAD_DIR" != "." ] && [ -f package.json ] && [ -f "$HEAD_DIR/package.json" ]; then
|
|
331
|
+
if jq -s '.[1] as $r | .[0] | .bkit = ((.bkit // {}) | del(.cloud, .tracker)
|
|
332
|
+
+ (if ($r.bkit.cloud // null) != null then {cloud: $r.bkit.cloud} else {} end)
|
|
333
|
+
+ (if ($r.bkit.tracker // null) != null then {tracker: $r.bkit.tracker} else {} end))' \
|
|
334
|
+
"$HEAD_DIR/package.json" package.json > "$HEAD_DIR/package.json.route" 2>/dev/null; then
|
|
335
|
+
mv "$HEAD_DIR/package.json.route" "$HEAD_DIR/package.json"
|
|
336
|
+
else
|
|
337
|
+
rm -f "$HEAD_DIR/package.json.route"
|
|
338
|
+
fi
|
|
194
339
|
fi
|
|
340
|
+
bkit_cli() { (cd "$HEAD_DIR" && "$BKIT_BIN" "$@"); }
|
|
195
341
|
if [ "$EVENT" = "workflow_dispatch" ]; then
|
|
196
342
|
# Dispatched: phase + issue come straight from inputs.
|
|
197
343
|
PHASE="$IN_PHASE"
|
|
@@ -222,12 +368,11 @@ jobs:
|
|
|
222
368
|
# proceeding). Returns 0 to proceed to dispatch.
|
|
223
369
|
bkit_dev_dispatch_guard() {
|
|
224
370
|
local guard_fid="$1" guard_head_sha="$2"
|
|
225
|
-
# assert the
|
|
226
|
-
#
|
|
227
|
-
#
|
|
228
|
-
#
|
|
229
|
-
|
|
230
|
-
if ! [[ "$guard_fid" =~ ^([0-9]+|[a-z]+-[0-9]+)-[a-z0-9-]+$ ]]; then
|
|
371
|
+
# assert the characters of the FID that `bkit fids parse` printed
|
|
372
|
+
# (the engine slug charset: lowercase letters, digits, '-'; no '/', no
|
|
373
|
+
# '.', non-empty) BEFORE it's used to build any path (find -path /
|
|
374
|
+
# mkdir -p / git commit -m). This checks characters, not FID shape.
|
|
375
|
+
if ! [[ "$guard_fid" =~ ^[a-z0-9][a-z0-9-]*$ ]]; then
|
|
231
376
|
echo "::notice::Invalid FID '$guard_fid' — refusing to write dev-dispatch counter (fail-closed)."
|
|
232
377
|
return 1
|
|
233
378
|
fi
|
|
@@ -295,6 +440,99 @@ jobs:
|
|
|
295
440
|
return 0
|
|
296
441
|
}
|
|
297
442
|
|
|
443
|
+
# bkit_gate <issue> — the tracker-agnostic bkit:auto gate. Reads the issue's labels
|
|
444
|
+
# through the consumer's own bkit (`issues fetch`), logs one `[bkit-cloud] gate:`
|
|
445
|
+
# line and writes one $GITHUB_STEP_SUMMARY row `tracker | issue | verdict | reason
|
|
446
|
+
# | jobs`. Returns 0 on pass; returns 1 (caller must skip, exit green) for every
|
|
447
|
+
# other outcome: no-issue, unreadable (bkit-unavailable, an exit 80 reason,
|
|
448
|
+
# output-unparseable), label-absent, no-agent. Unreadable fails closed: nothing starts.
|
|
449
|
+
bkit_gate() {
|
|
450
|
+
local gate_issue="${1:-}" tracker reason="" jobs="" rc=0 reply="" outbox secret_var secret_state
|
|
451
|
+
tracker=$(jq -r '.bkit.tracker.default // empty | strings' "$HEAD_DIR/package.json" 2>/dev/null || true)
|
|
452
|
+
tracker="${tracker:-none}"
|
|
453
|
+
# jobs: the dispatched job + its BKIT_ secret, each ignored job with its reason.
|
|
454
|
+
bkit_gate_secret() {
|
|
455
|
+
case "$1" in
|
|
456
|
+
claude) printf '%s' "BKIT_ANTHROPIC_API_KEY" ;;
|
|
457
|
+
opencode) printf '%s' "one of BKIT_OPENCODE_API_KEY, BKIT_OPENROUTER_API_KEY, BKIT_OLLAMA_API_KEY" ;;
|
|
458
|
+
codex) printf '%s' "BKIT_OPENAI_API_KEY" ;;
|
|
459
|
+
esac
|
|
460
|
+
}
|
|
461
|
+
local job
|
|
462
|
+
if [ -n "${SEL_DISPATCHED:-}" ]; then
|
|
463
|
+
jobs="${SEL_DISPATCHED}:$(bkit_gate_secret "$SEL_DISPATCHED")"
|
|
464
|
+
for job in ${SEL_IGNORED:-}; do jobs="$jobs; $job: not bkit.cloud.agent"; done
|
|
465
|
+
elif [ -n "${SEL_AGENT:-}" ]; then
|
|
466
|
+
case "$SEL_AGENT" in
|
|
467
|
+
claude | opencode | codex) jobs="$SEL_AGENT: missing $(bkit_gate_secret "$SEL_AGENT")" ;;
|
|
468
|
+
*) jobs="bkit.cloud.agent is '$SEL_AGENT': no router job" ;;
|
|
469
|
+
esac
|
|
470
|
+
for job in ${SEL_IGNORED:-}; do jobs="$jobs; $job: not bkit.cloud.agent ($(bkit_gate_secret "$job"))"; done
|
|
471
|
+
fi
|
|
472
|
+
bkit_gate_row() {
|
|
473
|
+
{
|
|
474
|
+
echo "### bkit-cloud gate"
|
|
475
|
+
echo ""
|
|
476
|
+
echo "| tracker | issue | verdict | reason | jobs |"
|
|
477
|
+
echo "| --- | --- | --- | --- | --- |"
|
|
478
|
+
echo "| $tracker | ${gate_issue:--} | $1 | $2 | ${jobs:--} |"
|
|
479
|
+
} >> "${GITHUB_STEP_SUMMARY:-/dev/null}"
|
|
480
|
+
}
|
|
481
|
+
if [ ! -x node_modules/.bin/bkit ]; then
|
|
482
|
+
echo "::warning::[bkit-cloud] gate: unreadable (bkit-unavailable) — node_modules/.bin/bkit is absent (the lockfile install failed); no agent starts."
|
|
483
|
+
bkit_gate_row unreadable bkit-unavailable
|
|
484
|
+
return 1
|
|
485
|
+
fi
|
|
486
|
+
if [ -z "$gate_issue" ]; then
|
|
487
|
+
echo "::notice::[bkit-cloud] gate: no-issue — no tracker issue is recorded for this run; no agent starts."
|
|
488
|
+
bkit_gate_row no-issue "no issue recorded"
|
|
489
|
+
return 1
|
|
490
|
+
fi
|
|
491
|
+
outbox=$(mktemp -d)
|
|
492
|
+
reply=$(bkit_cli issues fetch --issue "$gate_issue" --outbox "$outbox" --json 2>/dev/null) || rc=$?
|
|
493
|
+
if [ "$rc" -eq 80 ]; then
|
|
494
|
+
reason=$(printf '%s' "$reply" | jq -r '.reason // "unknown"' 2>/dev/null || echo unknown)
|
|
495
|
+
case "$tracker:$reason" in
|
|
496
|
+
linear:auth) secret_var=BKIT_LINEAR_API_KEY ;;
|
|
497
|
+
jira:auth) secret_var=BKIT_JIRA_API_KEY ;;
|
|
498
|
+
github:auth) secret_var=GH_TOKEN ;;
|
|
499
|
+
*) secret_var="" ;;
|
|
500
|
+
esac
|
|
501
|
+
if [ -n "$secret_var" ]; then
|
|
502
|
+
# Wording only: the secret's value is tested, never expanded.
|
|
503
|
+
if [ -n "${!secret_var:-}" ]; then secret_state="set but rejected"; else secret_state="empty or missing"; fi
|
|
504
|
+
echo "::warning::[bkit-cloud] gate: unreadable (reason=auth) — the $tracker read was refused; check the $secret_var secret ($secret_state). No agent starts."
|
|
505
|
+
else
|
|
506
|
+
echo "::warning::[bkit-cloud] gate: unreadable (reason=$reason) — the $tracker issue could not be read; no agent starts."
|
|
507
|
+
fi
|
|
508
|
+
bkit_gate_row unreadable "reason=$reason${secret_var:+ ($secret_var)}"
|
|
509
|
+
return 1
|
|
510
|
+
fi
|
|
511
|
+
if [ "$rc" -ne 0 ]; then
|
|
512
|
+
echo "::warning::[bkit-cloud] gate: unreadable (reason=exit-$rc) — bkit issues fetch failed; no agent starts."
|
|
513
|
+
bkit_gate_row unreadable "reason=exit-$rc"
|
|
514
|
+
return 1
|
|
515
|
+
fi
|
|
516
|
+
if ! printf '%s' "$reply" | jq -e '.labels | type == "array"' > /dev/null 2>&1; then
|
|
517
|
+
echo "::warning::[bkit-cloud] gate: unreadable (reason=output-unparseable) — bkit issues fetch printed no label list; no agent starts."
|
|
518
|
+
bkit_gate_row unreadable "reason=output-unparseable"
|
|
519
|
+
return 1
|
|
520
|
+
fi
|
|
521
|
+
if ! printf '%s' "$reply" | jq -e '.labels | index("bkit:auto") != null' > /dev/null 2>&1; then
|
|
522
|
+
echo "::notice::[bkit-cloud] gate: label-absent — issue $gate_issue no longer carries bkit:auto; no agent starts (kill switch)."
|
|
523
|
+
bkit_gate_row label-absent "bkit:auto not on the issue"
|
|
524
|
+
return 1
|
|
525
|
+
fi
|
|
526
|
+
if [ -n "${SEL_AGENT:-}" ] && [ -z "${SEL_DISPATCHED:-}" ]; then
|
|
527
|
+
echo "::notice::[bkit-cloud] gate: no-agent — $jobs; no agent starts."
|
|
528
|
+
bkit_gate_row no-agent "bkit:auto present, no agent job selected"
|
|
529
|
+
return 1
|
|
530
|
+
fi
|
|
531
|
+
echo "::notice::[bkit-cloud] gate: pass — issue $gate_issue carries bkit:auto."
|
|
532
|
+
bkit_gate_row pass "bkit:auto present"
|
|
533
|
+
return 0
|
|
534
|
+
}
|
|
535
|
+
|
|
298
536
|
if [ "$BRANCH" = "dev" ]; then
|
|
299
537
|
# Post-merge dev CI — no open PR. Recover FID from squash-merge commit
|
|
300
538
|
# scope. dev success = regression check passed = no-op (the merge
|
|
@@ -304,44 +542,50 @@ jobs:
|
|
|
304
542
|
echo "skip=true" >> "$GITHUB_OUTPUT"; exit 0
|
|
305
543
|
fi
|
|
306
544
|
# PHASE=debug below.
|
|
307
|
-
#
|
|
308
|
-
#
|
|
309
|
-
# (
|
|
310
|
-
#
|
|
311
|
-
#
|
|
312
|
-
#
|
|
313
|
-
# `
|
|
314
|
-
#
|
|
315
|
-
#
|
|
316
|
-
#
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
if [ -
|
|
320
|
-
#
|
|
321
|
-
#
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
545
|
+
# `bkit fids parse` (the consumer's own bkit) recovers the FID, for every
|
|
546
|
+
# wired tracker's shape (Jira keys with digits included): the squash subject
|
|
547
|
+
# (first line only — head_commit.message is subject+body, and a body line
|
|
548
|
+
# such as "feat(999-other): ..." must not key the cap counter, status path
|
|
549
|
+
# and /bkit-debug dispatch to an unrelated feature) through --prompt-file,
|
|
550
|
+
# else the merged PR's bkit:fid marker. The issue id comes from the
|
|
551
|
+
# feat/{FID} row in `.bkit/issues.jsonl` (`fids parse --branch`), never from
|
|
552
|
+
# the subject's "(#PR)". No bkit, a non-zero exit (no FID, or several issues
|
|
553
|
+
# named) or a null FID is the no-FID no-op below; `bkit_gate` reports an
|
|
554
|
+
# absent bkit.
|
|
555
|
+
FID=""
|
|
556
|
+
ISSUE=""
|
|
557
|
+
if [ ! -x node_modules/.bin/bkit ]; then
|
|
558
|
+
# Absent bkit (failed install): bkit_gate reports bkit-unavailable and writes the
|
|
559
|
+
# summary row; nothing starts.
|
|
560
|
+
bkit_gate "" || true
|
|
561
|
+
echo "skip=true" >> "$GITHUB_OUTPUT"; exit 0
|
|
562
|
+
fi
|
|
563
|
+
if [ -x node_modules/.bin/bkit ]; then
|
|
564
|
+
SUBJECT_FILE=$(mktemp "${RUNNER_TEMP:-${TMPDIR:-/tmp}}/bkit-cloud-subject.XXXXXX")
|
|
565
|
+
printf '%s\n' "$COMMIT_MSG" | head -1 > "$SUBJECT_FILE"
|
|
566
|
+
PARSED=$(bkit_cli fids parse --prompt-file "$SUBJECT_FILE" --json 2>/dev/null) || PARSED=""
|
|
567
|
+
FID=$(printf '%s' "$PARSED" | jq -r '.fidNamed // empty' 2>/dev/null || true)
|
|
568
|
+
if [ -z "$FID" ]; then
|
|
569
|
+
# Fallback: gh api merge-commit linked PR -> PR body bkit:fid marker.
|
|
570
|
+
# filter to same-repo MERGED PRs (the endpoint also returns OPEN
|
|
571
|
+
# fork PRs at this SHA).
|
|
572
|
+
PR_BODY=$(gh api "repos/${GITHUB_REPOSITORY}/commits/${HEAD_SHA}/pulls" \
|
|
573
|
+
--jq '[.[] | select(.head.repo.full_name == env.GITHUB_REPOSITORY and .merged_at != null)] | .[0].body // empty' 2>/dev/null || echo "")
|
|
574
|
+
PARSED=$(bkit_cli fids parse --marker "$PR_BODY" --json 2>/dev/null) || PARSED=""
|
|
575
|
+
FID=$(printf '%s' "$PARSED" | jq -r '.fid // empty' 2>/dev/null || true)
|
|
576
|
+
fi
|
|
326
577
|
fi
|
|
327
|
-
if [ -z "$FID" ] || ! [[ "$FID" =~ ^
|
|
578
|
+
if [ -z "$FID" ] || ! [[ "$FID" =~ ^[a-z0-9][a-z0-9-]*$ ]]; then
|
|
328
579
|
echo "::notice::Cannot derive FID by dev commit scope or linked PR — no-op exit (fail-safe)."
|
|
329
580
|
echo "skip=true" >> "$GITHUB_OUTPUT"; exit 0
|
|
330
581
|
fi
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
# (Renovate, a hand-named hotfix) yields no match,
|
|
334
|
-
# pipefail propagates grep's exit 1, and the step dies red
|
|
335
|
-
# instead of reaching the designed no-op exit just below.
|
|
336
|
-
ISSUE=$(printf '%s' "$FID" | grep -oE '^[0-9]+|^[a-z]+-[0-9]+' | head -1 || true)
|
|
582
|
+
BRANCH_PARSED=$(bkit_cli fids parse --branch "feat/$FID" --json 2>/dev/null) || BRANCH_PARSED=""
|
|
583
|
+
ISSUE=$(printf '%s' "$BRANCH_PARSED" | jq -r '.issueId // empty' 2>/dev/null || true)
|
|
337
584
|
ARG="$FID"
|
|
338
|
-
# Kill switch: re-check bkit:auto on the issue (live revocation)
|
|
339
|
-
#
|
|
340
|
-
#
|
|
341
|
-
|
|
342
|
-
echo "::notice::Issue #$ISSUE no longer carries bkit:auto — no-op exit (kill switch)."
|
|
343
|
-
echo "skip=true" >> "$GITHUB_OUTPUT"; exit 0
|
|
344
|
-
fi
|
|
585
|
+
# Kill switch: re-check bkit:auto on the issue (live revocation), through
|
|
586
|
+
# bkit_gate. MUST precede the stale-run guard and the dispatch-cap guard
|
|
587
|
+
# below; it needs nothing they set.
|
|
588
|
+
bkit_gate "$ISSUE" || { echo "skip=true" >> "$GITHUB_OUTPUT"; exit 0; }
|
|
345
589
|
# Stale-run guard: HEAD_SHA is current iff it is the headSha of the
|
|
346
590
|
# most recent COMPLETED CI run on dev ([skip ci] close commits never
|
|
347
591
|
# appear in gh run list). --workflow bkit-ci.yml (filename), not `bkit-ci`
|
|
@@ -385,47 +629,30 @@ jobs:
|
|
|
385
629
|
fi
|
|
386
630
|
ARG="$PR_NUMBER"
|
|
387
631
|
|
|
388
|
-
#
|
|
389
|
-
#
|
|
390
|
-
#
|
|
391
|
-
#
|
|
392
|
-
#
|
|
393
|
-
# commit) in
|
|
394
|
-
#
|
|
632
|
+
# `bkit fids parse` (the consumer's own bkit) recovers FID + issue id: the
|
|
633
|
+
# PR-body marker first (any wired tracker's shape, Jira keys with digits
|
|
634
|
+
# included), then the feat/{FID} branch, whose issue id counts only when
|
|
635
|
+
# `.bkit/issues.jsonl` has a feature row for it. The FID is asserted against
|
|
636
|
+
# the slug allowlist before it builds any path (find -path / mkdir -p / git
|
|
637
|
+
# commit) in the guards below. An absent bkit leaves both empty; bkit_gate
|
|
638
|
+
# then reports bkit-unavailable.
|
|
395
639
|
PR_BODY=$(gh pr view "$PR_NUMBER" --json body --jq .body 2>/dev/null || echo "")
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
# FALLBACK: extract FID from the branch name (feat/{FID}) when the
|
|
400
|
-
# PR body carries no usable bkit:fid= marker.
|
|
401
|
-
# keep the FULL slug (do NOT collapse to the leading
|
|
402
|
-
# numeric/alpha id, e.g. '363' instead of
|
|
403
|
-
# '363-widen-bkit-cloud-trigger'). ISSUE (short
|
|
404
|
-
# numeric/alpha prefix, used only for `gh issue view`) is derived
|
|
405
|
-
# FROM the full FID, not the other way round. NOTE the '#' sed
|
|
406
|
-
# delimiter: with '|' the alternation would need escaping and is
|
|
407
|
-
# ambiguous under -E.
|
|
408
|
-
FID=$(echo "$BRANCH" | sed -E 's#^feat/##')
|
|
409
|
-
# `|| true` is load-bearing under `set -euo pipefail` —
|
|
410
|
-
# this runs BEFORE the slug allowlist, so a non-FID branch
|
|
411
|
-
# (Renovate, a hand-named hotfix) yields no match,
|
|
412
|
-
# pipefail propagates grep's exit 1, and the step dies red
|
|
413
|
-
# instead of reaching the designed no-op exit just below.
|
|
414
|
-
ISSUE=$(printf '%s' "$FID" | grep -oE '^[0-9]+|^[a-z]+-[0-9]+' | head -1 || true)
|
|
640
|
+
PARSED=""
|
|
641
|
+
if [ -x node_modules/.bin/bkit ]; then
|
|
642
|
+
PARSED=$(bkit_cli fids parse --marker "$PR_BODY" --branch "$BRANCH" --json 2>/dev/null || true)
|
|
415
643
|
fi
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
644
|
+
FID=$(printf '%s' "$PARSED" | jq -r '.fid // empty' 2>/dev/null || true)
|
|
645
|
+
ISSUE=$(printf '%s' "$PARSED" | jq -r '.issueId // empty' 2>/dev/null || true)
|
|
646
|
+
if [ -n "$FID" ] && ! [[ "$FID" =~ ^[a-z0-9][a-z0-9-]*$ ]]; then
|
|
647
|
+
FID=""
|
|
648
|
+
ISSUE=""
|
|
649
|
+
fi
|
|
650
|
+
if [ -z "$FID" ] && [ -x node_modules/.bin/bkit ]; then
|
|
651
|
+
echo "::notice::Cannot derive FID/ISSUE for branch $BRANCH — no usable bkit:fid marker or feat/{FID} branch."
|
|
420
652
|
fi
|
|
421
653
|
|
|
422
654
|
# Cheap-tier kill switch: re-check bkit:auto on the issue (live revocation).
|
|
423
|
-
|
|
424
|
-
if ! gh issue view "$ISSUE" --json labels --jq '.labels[].name' 2>/dev/null | grep -qxF 'bkit:auto'; then
|
|
425
|
-
echo "::notice::Issue #$ISSUE no longer carries bkit:auto — no-op exit (kill switch)."
|
|
426
|
-
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
427
|
-
exit 0
|
|
428
|
-
fi
|
|
655
|
+
bkit_gate "$ISSUE" || { echo "skip=true" >> "$GITHUB_OUTPUT"; exit 0; }
|
|
429
656
|
|
|
430
657
|
# A build still writing this branch owns it: no-op exit. "Still
|
|
431
658
|
# running" = the branch's status.jsonl has a build workflow-started
|
|
@@ -451,7 +678,7 @@ jobs:
|
|
|
451
678
|
fi
|
|
452
679
|
# Guard: arg must be alphanumeric/dash/dot/slash (numeric PR/issue ids + FIDs like
|
|
453
680
|
# 245-opencode-provider-host). workflow_dispatch inputs.issue flows unsanitized into
|
|
454
|
-
#
|
|
681
|
+
# the selected router job's model prompt — reject anything else (prompt-injection guard).
|
|
455
682
|
if ! [[ "$ARG" =~ ^[0-9A-Za-z._/-]+$ ]]; then
|
|
456
683
|
echo "::error::Invalid arg value '${ARG}' — aborting." >&2
|
|
457
684
|
exit 1
|
|
@@ -463,8 +690,8 @@ jobs:
|
|
|
463
690
|
} >> "$GITHUB_OUTPUT"
|
|
464
691
|
|
|
465
692
|
# ---------------------------------------------------------------------------
|
|
466
|
-
# claude job — dispatch via claude-code-action@v1 (
|
|
467
|
-
# Runs only when
|
|
693
|
+
# claude job — dispatch via claude-code-action@v1 (BKIT_ANTHROPIC_API_KEY or federation).
|
|
694
|
+
# Runs only when `Select agent job` chose claude and the context job resolved a phase.
|
|
468
695
|
# OIDC auth via Claude GitHub App (id-token: write); requires one-time
|
|
469
696
|
# `/install-github-app` in the consumer repo.
|
|
470
697
|
# ---------------------------------------------------------------------------
|
|
@@ -500,8 +727,8 @@ jobs:
|
|
|
500
727
|
- name: Install vale
|
|
501
728
|
env:
|
|
502
729
|
# renovate: datasource=github-releases depName=errata-ai/vale
|
|
503
|
-
VALE_VERSION: "3.
|
|
504
|
-
VALE_SHA256: "
|
|
730
|
+
VALE_VERSION: "3.26.0"
|
|
731
|
+
VALE_SHA256: "22aa69a556558e4a9dfc63c17030777383d8d3c48dcdfad655fa98e839d666ed"
|
|
505
732
|
run: |
|
|
506
733
|
curl -fsSL --retry 3 --retry-all-errors "https://github.com/errata-ai/vale/releases/download/v${VALE_VERSION}/vale_${VALE_VERSION}_Linux_64-bit.tar.gz" -o "$RUNNER_TEMP/vale.tar.gz"
|
|
507
734
|
echo "${VALE_SHA256} $RUNNER_TEMP/vale.tar.gz" | sha256sum -c -
|
|
@@ -514,7 +741,7 @@ jobs:
|
|
|
514
741
|
git config user.email 'bkit-auto@users.noreply.github.com'
|
|
515
742
|
|
|
516
743
|
- name: Dispatch /bkit-auto on Claude Code runner
|
|
517
|
-
uses: anthropics/claude-code-action@
|
|
744
|
+
uses: anthropics/claude-code-action@c0949c50a78c1ec8ce2647db36629b870e715d0c # v1.0.268
|
|
518
745
|
with:
|
|
519
746
|
# Orchestrator contract: `/bkit-auto <phase> <arg>` where <arg> is the open
|
|
520
747
|
# PR number (ship/debug) or the tracker issue number/id (design/plan/build).
|
|
@@ -522,26 +749,26 @@ jobs:
|
|
|
522
749
|
prompt: "/bkit-auto ${{ needs.context.outputs.phase }} ${{ needs.context.outputs.arg }}"
|
|
523
750
|
# Lock the runner-side session to the same tool surface bkit grants the local
|
|
524
751
|
# orchestrator. GitHub MCP surface is always available; this workflow is
|
|
525
|
-
# GitHub
|
|
752
|
+
# GitHub MCP only; other trackers via bkit verbs.
|
|
526
753
|
claude_args: "--allowed-tools=Bash,Edit,Write,Read,Grep,Glob,WebFetch,Skill,mcp__github__*"
|
|
527
754
|
# Workload identity federation: the action exchanges this job's GitHub OIDC token
|
|
528
755
|
# for a short-lived Claude API token. Unset variables pass empty; a set
|
|
529
|
-
#
|
|
756
|
+
# BKIT_ANTHROPIC_API_KEY secret takes precedence.
|
|
530
757
|
anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
|
|
531
758
|
anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
|
|
532
759
|
anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
|
|
533
760
|
anthropic_workspace_id: ${{ vars.ANTHROPIC_WORKSPACE_ID }}
|
|
534
761
|
env:
|
|
535
|
-
ANTHROPIC_API_KEY: ${{ secrets.
|
|
762
|
+
ANTHROPIC_API_KEY: ${{ secrets.BKIT_ANTHROPIC_API_KEY }}
|
|
536
763
|
GH_TOKEN: ${{ github.token }}
|
|
764
|
+
BKIT_LINEAR_API_KEY: ${{ secrets.BKIT_LINEAR_API_KEY }}
|
|
765
|
+
BKIT_JIRA_API_KEY: ${{ secrets.BKIT_JIRA_API_KEY }}
|
|
537
766
|
|
|
538
767
|
# ---------------------------------------------------------------------------
|
|
539
|
-
# opencode job — dispatch via `opencode run` CLI (
|
|
540
|
-
# Runs only when
|
|
768
|
+
# opencode job — dispatch via `opencode run` CLI (a provider BKIT_ secret required).
|
|
769
|
+
# Runs only when `Select agent job` chose opencode and the context job resolved a phase.
|
|
541
770
|
# The committed .opencode/opencode.json provides provider config + model pins —
|
|
542
771
|
# no model is hard-coded in this YAML. No OIDC / Claude identity.
|
|
543
|
-
# OPENCODE_PROVIDER_KEY is fanned out to all known provider env var names so the
|
|
544
|
-
# opencode.json ${VAR} reference resolves regardless of which provider is installed.
|
|
545
772
|
# ---------------------------------------------------------------------------
|
|
546
773
|
opencode:
|
|
547
774
|
name: bkit-cloud-opencode (${{ github.event_name }})
|
|
@@ -565,6 +792,18 @@ jobs:
|
|
|
565
792
|
git config user.name 'bkit-auto[bot]'
|
|
566
793
|
git config user.email 'bkit-auto@users.noreply.github.com'
|
|
567
794
|
|
|
795
|
+
# Repo dependencies for the dispatched phase (bkit:* scripts, the committed config).
|
|
796
|
+
# Pnpm version comes from the consumer's package.json#packageManager (no `with: version:`).
|
|
797
|
+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
|
|
798
|
+
|
|
799
|
+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
800
|
+
with:
|
|
801
|
+
node-version: {{NODE_VERSION}}
|
|
802
|
+
cache: pnpm
|
|
803
|
+
|
|
804
|
+
- name: Install dependencies
|
|
805
|
+
run: pnpm install --frozen-lockfile
|
|
806
|
+
|
|
568
807
|
- name: Install opencode
|
|
569
808
|
run: |
|
|
570
809
|
# Version-pinned. Renovate bumps it through the `# renovate:` line below; without
|
|
@@ -573,23 +812,148 @@ jobs:
|
|
|
573
812
|
# (https://opencode.ai/install) installs OpenCode 1 only and refuses a 2.x version.
|
|
574
813
|
# npm's postinstall selects the runner's platform binary.
|
|
575
814
|
# renovate: datasource=npm depName=@opencode/cli
|
|
576
|
-
npm install -g @opencode/cli@2.
|
|
815
|
+
npm install -g @opencode/cli@2.2.5
|
|
577
816
|
echo "$(npm prefix -g)/bin" >> "$GITHUB_PATH"
|
|
578
817
|
|
|
579
818
|
- name: Dispatch /bkit-auto on opencode runner
|
|
580
819
|
env:
|
|
581
820
|
GH_TOKEN: ${{ github.token }}
|
|
582
|
-
#
|
|
583
|
-
#
|
|
584
|
-
#
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
OPENCODE_PROVIDER_KEY: ${{ secrets.OPENCODE_PROVIDER_KEY }}
|
|
821
|
+
# Each provider secret maps to its same-named env var, so the committed
|
|
822
|
+
# .opencode/opencode.json {env:VAR} reference resolves for the installed provider.
|
|
823
|
+
# No Claude identity leak — ANTHROPIC_API_KEY is absent.
|
|
824
|
+
BKIT_OPENCODE_API_KEY: ${{ secrets.BKIT_OPENCODE_API_KEY }}
|
|
825
|
+
BKIT_OPENROUTER_API_KEY: ${{ secrets.BKIT_OPENROUTER_API_KEY }}
|
|
826
|
+
BKIT_OLLAMA_API_KEY: ${{ secrets.BKIT_OLLAMA_API_KEY }}
|
|
827
|
+
BKIT_LINEAR_API_KEY: ${{ secrets.BKIT_LINEAR_API_KEY }}
|
|
828
|
+
BKIT_JIRA_API_KEY: ${{ secrets.BKIT_JIRA_API_KEY }}
|
|
591
829
|
# Pass phase/arg via env to avoid ${{ }} expansion in run: shell string (injection guard).
|
|
592
830
|
BKIT_PHASE: ${{ needs.context.outputs.phase }}
|
|
593
831
|
BKIT_ARG: ${{ needs.context.outputs.arg }}
|
|
594
832
|
run: |
|
|
595
833
|
opencode run "/bkit-auto $BKIT_PHASE $BKIT_ARG"
|
|
834
|
+
|
|
835
|
+
# ---------------------------------------------------------------------------
|
|
836
|
+
# codex job — dispatch via openai/codex-action (BKIT_OPENAI_API_KEY required).
|
|
837
|
+
# Runs only when `Select agent job` chose codex and the context job resolved a phase.
|
|
838
|
+
# The action runs `drop-sudo` on the runner, which is irreversible: a reused self-hosted
|
|
839
|
+
# `{{CLOUD_RUNNER}}` loses sudo for later jobs, so use an ephemeral runner. The action also
|
|
840
|
+
# puts its own Node 24 on PATH, which later steps in this job see.
|
|
841
|
+
# ---------------------------------------------------------------------------
|
|
842
|
+
codex:
|
|
843
|
+
name: bkit-cloud-codex (${{ github.event_name }})
|
|
844
|
+
needs: context
|
|
845
|
+
if: needs.context.outputs.codex == 'true' && needs.context.outputs.skip != 'true'
|
|
846
|
+
runs-on: {{CLOUD_RUNNER}}
|
|
847
|
+
permissions:
|
|
848
|
+
contents: write
|
|
849
|
+
pull-requests: write
|
|
850
|
+
issues: write
|
|
851
|
+
actions: read
|
|
852
|
+
# One run per FID; the `-codex` suffix keeps it apart from the workflow-level lane.
|
|
853
|
+
# This job runs only after the `context` job passed, so the key needs no skip
|
|
854
|
+
# fallback. A newer run replaces the one in flight, except on dev, where it waits.
|
|
855
|
+
concurrency:
|
|
856
|
+
group: bkit-auto-${{ inputs.issue || github.event.workflow_run.head_branch }}-codex
|
|
857
|
+
cancel-in-progress: ${{ github.event.workflow_run.head_branch != 'dev' }}
|
|
858
|
+
steps:
|
|
859
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
860
|
+
with:
|
|
861
|
+
ref: dev
|
|
862
|
+
fetch-depth: 0
|
|
863
|
+
token: ${{ github.token }}
|
|
864
|
+
|
|
865
|
+
- name: Configure git user
|
|
866
|
+
run: |
|
|
867
|
+
git config user.name 'bkit-auto[bot]'
|
|
868
|
+
git config user.email 'bkit-auto@users.noreply.github.com'
|
|
869
|
+
|
|
870
|
+
- name: Install vale
|
|
871
|
+
env:
|
|
872
|
+
# renovate: datasource=github-releases depName=errata-ai/vale
|
|
873
|
+
VALE_VERSION: "3.26.0"
|
|
874
|
+
VALE_SHA256: "22aa69a556558e4a9dfc63c17030777383d8d3c48dcdfad655fa98e839d666ed"
|
|
875
|
+
run: |
|
|
876
|
+
curl -fsSL --retry 3 --retry-all-errors "https://github.com/errata-ai/vale/releases/download/v${VALE_VERSION}/vale_${VALE_VERSION}_Linux_64-bit.tar.gz" -o "$RUNNER_TEMP/vale.tar.gz"
|
|
877
|
+
echo "${VALE_SHA256} $RUNNER_TEMP/vale.tar.gz" | sha256sum -c -
|
|
878
|
+
tar -xzf "$RUNNER_TEMP/vale.tar.gz" -C "$RUNNER_TEMP" vale
|
|
879
|
+
echo "$RUNNER_TEMP" >> "$GITHUB_PATH"
|
|
880
|
+
|
|
881
|
+
# Repo dependencies BEFORE the action: the action sandbox cannot fetch them.
|
|
882
|
+
# Pnpm version comes from the consumer's package.json#packageManager (no `with: version:`).
|
|
883
|
+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
|
|
884
|
+
|
|
885
|
+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
886
|
+
with:
|
|
887
|
+
node-version: {{NODE_VERSION}}
|
|
888
|
+
cache: pnpm
|
|
889
|
+
|
|
890
|
+
- name: Install dependencies
|
|
891
|
+
run: pnpm install --frozen-lockfile
|
|
892
|
+
|
|
893
|
+
# Codex loads project config (.codex/, hooks, skills) only for a trusted project; the
|
|
894
|
+
# runner has no interactive trust prompt, so the config in codex-home trusts the workspace.
|
|
895
|
+
- name: Trust the workspace in codex-home
|
|
896
|
+
run: |
|
|
897
|
+
mkdir -p "$RUNNER_TEMP/codex-home"
|
|
898
|
+
{
|
|
899
|
+
echo "[projects.\"$GITHUB_WORKSPACE\"]"
|
|
900
|
+
echo 'trust_level = "trusted"'
|
|
901
|
+
} > "$RUNNER_TEMP/codex-home/config.toml"
|
|
902
|
+
echo "BKIT_CODEX_STARTED=$(date -u +%FT%TZ)" >> "$GITHUB_ENV"
|
|
903
|
+
|
|
904
|
+
- name: Dispatch $bkit-auto on Codex runner
|
|
905
|
+
id: codex
|
|
906
|
+
uses: openai/codex-action@bdf19a4a223ec2549a3e2274a0cf61556bc07675 # v1
|
|
907
|
+
with:
|
|
908
|
+
openai-api-key: ${{ secrets.BKIT_OPENAI_API_KEY }}
|
|
909
|
+
# The runner is the sandbox: the dispatched phase needs git, network and the repo's
|
|
910
|
+
# own tooling. Bot-authored triggers (workflow_run) must be allowed.
|
|
911
|
+
sandbox: danger-full-access
|
|
912
|
+
allow-bots: true
|
|
913
|
+
codex-home: ${{ runner.temp }}/codex-home
|
|
914
|
+
# renovate: datasource=npm depName=@openai/codex
|
|
915
|
+
codex-version: "0.167.0"
|
|
916
|
+
prompt: "$bkit-auto ${{ needs.context.outputs.phase }} ${{ needs.context.outputs.arg }}"
|
|
917
|
+
env:
|
|
918
|
+
GH_TOKEN: ${{ github.token }}
|
|
919
|
+
BKIT_LINEAR_API_KEY: ${{ secrets.BKIT_LINEAR_API_KEY }}
|
|
920
|
+
BKIT_JIRA_API_KEY: ${{ secrets.BKIT_JIRA_API_KEY }}
|
|
921
|
+
|
|
922
|
+
- name: Codex run summary
|
|
923
|
+
if: always()
|
|
924
|
+
env:
|
|
925
|
+
GH_TOKEN: ${{ github.token }}
|
|
926
|
+
ACTION_OUTCOME: ${{ steps.codex.outcome }}
|
|
927
|
+
STARTED: ${{ env.BKIT_CODEX_STARTED }}
|
|
928
|
+
ARG: ${{ needs.context.outputs.arg }}
|
|
929
|
+
EVENT: ${{ github.event_name }}
|
|
930
|
+
run: |
|
|
931
|
+
commits="-"
|
|
932
|
+
comments="-"
|
|
933
|
+
if [[ -z "$STARTED" ]]; then
|
|
934
|
+
# An earlier step failed before the start time was recorded: no count can be known.
|
|
935
|
+
:
|
|
936
|
+
elif [[ "$EVENT" == "workflow_dispatch" ]]; then
|
|
937
|
+
# dispatch arm: ARG is an issue number, not a PR number, so no commits are tied to it.
|
|
938
|
+
if [[ "$ARG" =~ ^[0-9]+$ ]]; then
|
|
939
|
+
comments=$(gh api "repos/${GITHUB_REPOSITORY}/issues/${ARG}/comments" --paginate --jq "[.[] | select(.created_at >= \"${STARTED}\")] | length" 2>/dev/null | paste -sd+ - | bc 2>/dev/null || true)
|
|
940
|
+
fi
|
|
941
|
+
# Linear / Jira key: the comments live on the tracker issue, which this step does not read.
|
|
942
|
+
elif [[ "$ARG" =~ ^[0-9]+$ ]]; then
|
|
943
|
+
# feat arm: ARG is the PR number. Count PR commits and comments landed since start.
|
|
944
|
+
commits=$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${ARG}/commits" --paginate --jq "[.[] | select(.commit.committer.date >= \"${STARTED}\")] | length" 2>/dev/null | paste -sd+ - | bc 2>/dev/null || true)
|
|
945
|
+
comments=$(gh api "repos/${GITHUB_REPOSITORY}/issues/${ARG}/comments" --paginate --jq "[.[] | select(.created_at >= \"${STARTED}\")] | length" 2>/dev/null | paste -sd+ - | bc 2>/dev/null || true)
|
|
946
|
+
else
|
|
947
|
+
# dev arm: ARG is the FID, there is no PR or issue number to read comments from.
|
|
948
|
+
# A failed fetch or log leaves commits unknown ("-"), never a false 0.
|
|
949
|
+
if git fetch -q origin dev 2>/dev/null && log=$(git log origin/dev --since="$STARTED" --author='bkit-auto' --oneline 2>/dev/null); then
|
|
950
|
+
commits=$(printf '%s' "$log" | grep -c . || true)
|
|
951
|
+
fi
|
|
952
|
+
fi
|
|
953
|
+
{
|
|
954
|
+
echo "### bkit-cloud codex"
|
|
955
|
+
echo ""
|
|
956
|
+
echo "| action | commits | comments |"
|
|
957
|
+
echo "| --- | --- | --- |"
|
|
958
|
+
echo "| ${ACTION_OUTCOME:--} | ${commits:--} | ${comments:--} |"
|
|
959
|
+
} >> "${GITHUB_STEP_SUMMARY:-/dev/null}"
|