@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
|
@@ -34,6 +34,10 @@ export const SESSION_HIJACK_KEYS = [
|
|
|
34
34
|
"BKIT_ANTHROPIC_API_KEY",
|
|
35
35
|
"ANTHROPIC_AUTH_TOKEN",
|
|
36
36
|
];
|
|
37
|
+
// Router-only keys: used by a router job as a repo Actions secret, never by a cloud agent
|
|
38
|
+
// session. Pasting them would hand a paid key to every session that reads untrusted issue /
|
|
39
|
+
// PR text. Always dropped from the paste block.
|
|
40
|
+
export const ROUTER_ONLY_KEYS = ["BKIT_OPENAI_API_KEY"];
|
|
37
41
|
// bkit baseline env-var NAMES every cloud environment needs, whatever the tracker:
|
|
38
42
|
// `gh` and the GitHub MCP server read BKIT_GH_TOKEN on every host. Emitted as a
|
|
39
43
|
// placeholder ONLY when absent from the resolved `.envrc` set — a present value keeps
|
|
@@ -111,6 +115,7 @@ export function resolveCloudEnvVars(cwd) {
|
|
|
111
115
|
included: [],
|
|
112
116
|
unset: [],
|
|
113
117
|
hijackDropped: [],
|
|
118
|
+
routerOnlyDropped: [],
|
|
114
119
|
emptySkipped: [],
|
|
115
120
|
placeholders: [],
|
|
116
121
|
sources: [],
|
|
@@ -151,6 +156,13 @@ export function resolveCloudEnvVars(cwd) {
|
|
|
151
156
|
map.delete(k);
|
|
152
157
|
}
|
|
153
158
|
}
|
|
159
|
+
// Drop router-only keys.
|
|
160
|
+
for (const k of ROUTER_ONLY_KEYS) {
|
|
161
|
+
if (map.has(k)) {
|
|
162
|
+
res.routerOnlyDropped.push(k);
|
|
163
|
+
map.delete(k);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
154
166
|
// Partition non-empty (included) vs empty (skipped).
|
|
155
167
|
for (const [k, v] of map) {
|
|
156
168
|
if (v === "")
|
|
@@ -200,6 +212,9 @@ export function renderCloudEnvNotes(res) {
|
|
|
200
212
|
if (res.hijackDropped.length) {
|
|
201
213
|
bullets.push(`- **Dropped — session-billing hijack:** ${fmtList(res.hijackDropped)} — would redirect the agent's own model calls onto API-key billing instead of your subscription.`);
|
|
202
214
|
}
|
|
215
|
+
if (res.routerOnlyDropped.length) {
|
|
216
|
+
bullets.push(`- **Dropped — router-only secret:** ${fmtList(res.routerOnlyDropped)} — set it as a repo Actions secret; no cloud agent session needs it.`);
|
|
217
|
+
}
|
|
203
218
|
if (res.emptySkipped.length) {
|
|
204
219
|
bullets.push(`- **Empty in source (skipped):** ${fmtList(res.emptySkipped)}`);
|
|
205
220
|
}
|
|
@@ -567,15 +582,15 @@ function writeGeneratedJson(cwd, rel, doc, dryRun) {
|
|
|
567
582
|
return true;
|
|
568
583
|
}
|
|
569
584
|
/**
|
|
570
|
-
* 8-hex fingerprint of
|
|
571
|
-
* the
|
|
572
|
-
* `allowed-domains` never moves it
|
|
585
|
+
* 8-hex fingerprint of an entry list, sorted and de-duplicated. With no argument it
|
|
586
|
+
* covers the DERIVED egress set only — bases and hosts, never the consumer union (the
|
|
587
|
+
* Cursor and Codex paste notes use that); editing `allowed-domains` never moves it,
|
|
588
|
+
* editing a registry row does. Pass the resolved allowlist to cover consumer
|
|
589
|
+
* `allowed-domains` too (the Claude paste list and `.bkit/allowlist.json`).
|
|
573
590
|
*/
|
|
574
|
-
export function egressFingerprint() {
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
].sort();
|
|
578
|
-
return sha256(derived.join("\n")).slice(0, 8);
|
|
591
|
+
export function egressFingerprint(entries) {
|
|
592
|
+
const set = entries ?? [...BKIT_SHIPPED_NETWORK_DOMAINS, ...BKIT_SHIPPED_NETWORK_HOSTS];
|
|
593
|
+
return sha256([...new Set(set)].sort().join("\n")).slice(0, 8);
|
|
579
594
|
}
|
|
580
595
|
/**
|
|
581
596
|
* The "where these came from" clause of a network list's count note. A declared entry
|
|
@@ -616,10 +631,17 @@ export function renderCloudNetworkAllowlist(cwd) {
|
|
|
616
631
|
"\n```\n\n" +
|
|
617
632
|
`_${domains.length} entries (${domains.length / 2} domains, each as apex + \`*.\` wildcard): ` +
|
|
618
633
|
networkSourceCounts(networkAllowlistBases(declared), BKIT_SHIPPED_NETWORK_DOMAINS) +
|
|
619
|
-
".
|
|
620
|
-
egressFingerprint() +
|
|
634
|
+
". Allowlist fingerprint `" +
|
|
635
|
+
egressFingerprint(domains) +
|
|
621
636
|
"`._" +
|
|
622
637
|
declaredNote +
|
|
638
|
+
"\n\nThe fingerprint is also recorded in `.bkit/allowlist.json`. After you paste the list, " +
|
|
639
|
+
"set `BKIT_CLOUD_ALLOWLIST_FINGERPRINT` to it in the cloud environment's variables (or " +
|
|
640
|
+
"the setup script); the SessionStart bootstrap compares it with the repo's current " +
|
|
641
|
+
"fingerprint and warns on a mismatch, then continues. The stamp is an operator " +
|
|
642
|
+
"assertion that you pasted this list: the deployed dashboard allowlist stays " +
|
|
643
|
+
"unverified. After any `allowed-domains` change, run `bkit upgrade`, re-paste the list " +
|
|
644
|
+
"and update the variable." +
|
|
623
645
|
"\n\nUnder **Trusted**, your app domains and most observability / API hosts are\n" +
|
|
624
646
|
"unreachable, so cloud `/bkit-debug` gets no runtime logs and e2e can't hit your\n" +
|
|
625
647
|
"deployment. **Full** works too but opens all egress.");
|
|
@@ -88,6 +88,20 @@ export function extractManagedBlock(content, markerStyle = "html-comment") {
|
|
|
88
88
|
const inner = startLineEnd === -1 ? "" : content.slice(startLineEnd + 1, lineStartOf(content, ends[0]));
|
|
89
89
|
return inner.replace(/^\n+/, "").replace(/\n+$/, "");
|
|
90
90
|
}
|
|
91
|
+
// The text from the first byte through the end-marker line (newline included). Null unless
|
|
92
|
+
// the file has exactly one start marker and one end marker, start first. Used to tell a
|
|
93
|
+
// change below the block from a change to the block or the text above it.
|
|
94
|
+
export function managedHead(content, markerStyle = "html-comment") {
|
|
95
|
+
const [startMarker, endMarker] = selectMarkers(markerStyle);
|
|
96
|
+
const starts = findLineAnchoredMarkers(content, startMarker);
|
|
97
|
+
const ends = findLineAnchoredMarkers(content, endMarker);
|
|
98
|
+
if (starts.length !== 1 || ends.length !== 1)
|
|
99
|
+
return null;
|
|
100
|
+
if (starts[0] >= ends[0])
|
|
101
|
+
return null;
|
|
102
|
+
const endLineEnd = content.indexOf("\n", ends[0] + endMarker.length);
|
|
103
|
+
return endLineEnd === -1 ? content : content.slice(0, endLineEnd + 1);
|
|
104
|
+
}
|
|
91
105
|
// Extract the FULL bkit-managed block INCLUDING marker lines from a file.
|
|
92
106
|
// markerStyle defaults to "html-comment".
|
|
93
107
|
// Used to append a fresh block to a destination that has none. Markers may be
|
|
@@ -216,3 +230,90 @@ export function updateManagedBlock(filePath, newContent, dryRun = false, markerS
|
|
|
216
230
|
fs.writeFileSync(filePath, result.content, "utf-8");
|
|
217
231
|
return true;
|
|
218
232
|
}
|
|
233
|
+
// ---------------------------------------------------------------------------
|
|
234
|
+
// Wrapper-only removal — the ownership metadata of a document that becomes the project's own
|
|
235
|
+
// ---------------------------------------------------------------------------
|
|
236
|
+
/** The generated notice line a managed block carries: `<!-- bkit:managed vX — do not edit; … -->`. */
|
|
237
|
+
const MANAGED_NOTICE_RE = /^<!-- bkit:managed v\S+ — (?:.* — )?do (?:not|NOT) edit; run `bkit upgrade` to refresh -->$/;
|
|
238
|
+
/** Lines with their terminators, so removing a line keeps every other byte, CRLF included. */
|
|
239
|
+
function splitKeepingEol(content) {
|
|
240
|
+
return content.match(/[^\n]*\n|[^\n]+$/g) ?? [];
|
|
241
|
+
}
|
|
242
|
+
const bareLine = (line) => line.replace(/\r?\n$/, "");
|
|
243
|
+
/**
|
|
244
|
+
* Remove the ownership wrapper of a markdown document: the one ordered pair of exact
|
|
245
|
+
* `<!-- bkit:start -->` / `<!-- bkit:end -->` lines and the generated `bkit:managed` notice line
|
|
246
|
+
* between them. Every other byte stays, original line endings included. The enclosed text is
|
|
247
|
+
* the project's. When both markers are absent the content is returned as it is. Anything that
|
|
248
|
+
* cannot be told apart from project text (one marker alone, reversed or repeated markers, a
|
|
249
|
+
* marker-looking line inside a Markdown fence, more than one notice) is `ambiguous` and the
|
|
250
|
+
* content is returned unchanged.
|
|
251
|
+
*/
|
|
252
|
+
export function stripManagedWrapper(content) {
|
|
253
|
+
const lines = splitKeepingEol(content);
|
|
254
|
+
const starts = [];
|
|
255
|
+
const ends = [];
|
|
256
|
+
const notices = [];
|
|
257
|
+
let fence = null;
|
|
258
|
+
let inFenceHit = false;
|
|
259
|
+
lines.forEach((line, i) => {
|
|
260
|
+
const text = bareLine(line);
|
|
261
|
+
const fenceMatch = /^\s*(`{3,}|~{3,})/.exec(text);
|
|
262
|
+
if (fenceMatch) {
|
|
263
|
+
const mark = fenceMatch[1][0];
|
|
264
|
+
if (fence === null)
|
|
265
|
+
fence = mark;
|
|
266
|
+
else if (fence === mark)
|
|
267
|
+
fence = null;
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const isStart = text === START_MARKER;
|
|
271
|
+
const isEnd = text === END_MARKER;
|
|
272
|
+
const isNotice = MANAGED_NOTICE_RE.test(text);
|
|
273
|
+
if (fence !== null) {
|
|
274
|
+
if (isStart || isEnd || isNotice)
|
|
275
|
+
inFenceHit = true;
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (isStart)
|
|
279
|
+
starts.push(i);
|
|
280
|
+
else if (isEnd)
|
|
281
|
+
ends.push(i);
|
|
282
|
+
else if (isNotice)
|
|
283
|
+
notices.push(i);
|
|
284
|
+
});
|
|
285
|
+
const ambiguous = (problem) => ({
|
|
286
|
+
status: "ambiguous",
|
|
287
|
+
content,
|
|
288
|
+
problem,
|
|
289
|
+
});
|
|
290
|
+
if (inFenceHit)
|
|
291
|
+
return ambiguous("inside-fence");
|
|
292
|
+
if (starts.length === 0 && ends.length === 0)
|
|
293
|
+
return { status: "none", content };
|
|
294
|
+
if (starts.length === 0 || ends.length === 0)
|
|
295
|
+
return ambiguous("missing-partner");
|
|
296
|
+
if (starts.length > 1 || ends.length > 1)
|
|
297
|
+
return ambiguous("multiple");
|
|
298
|
+
const start = starts[0];
|
|
299
|
+
const end = ends[0];
|
|
300
|
+
if (start >= end)
|
|
301
|
+
return ambiguous("inverted");
|
|
302
|
+
const inside = notices.filter((n) => n > start && n < end);
|
|
303
|
+
if (inside.length > 1 || notices.length > inside.length)
|
|
304
|
+
return ambiguous("multiple-notices");
|
|
305
|
+
const drop = new Set([start, end, ...inside]);
|
|
306
|
+
// The writer pads each wrapper line with one blank line (`start`, blank, notice, blank,
|
|
307
|
+
// content, blank, `end`). That padding goes with the wrapper, one line each.
|
|
308
|
+
const isBlank = (i) => i >= 0 && i < lines.length && bareLine(lines[i]) === "";
|
|
309
|
+
for (const i of [start, ...inside])
|
|
310
|
+
if (isBlank(i + 1) && i + 1 < end)
|
|
311
|
+
drop.add(i + 1);
|
|
312
|
+
if (isBlank(end - 1) && end - 1 > start)
|
|
313
|
+
drop.add(end - 1);
|
|
314
|
+
return {
|
|
315
|
+
status: "removed",
|
|
316
|
+
content: lines.filter((_, i) => !drop.has(i)).join(""),
|
|
317
|
+
removedLines: drop.size,
|
|
318
|
+
};
|
|
319
|
+
}
|
package/dist/install/manifest.js
CHANGED
|
@@ -58,7 +58,7 @@ export function parseIssueTracker(value) {
|
|
|
58
58
|
*
|
|
59
59
|
* Single self-describing field (mirrors `bkit.tracker.default`).
|
|
60
60
|
*/
|
|
61
|
-
export const CLOUD_MODES = ["claude", "cursor", "opencode", "none"];
|
|
61
|
+
export const CLOUD_MODES = ["claude", "cursor", "opencode", "codex", "none"];
|
|
62
62
|
/** Default when consumer manifest has no `bkit.cloud.agent` field (undecided). */
|
|
63
63
|
export const DEFAULT_CLOUD_AGENTS = "none";
|
|
64
64
|
/** Narrow an unknown string to `CloudAgents` or return `null` if invalid. */
|
|
@@ -371,6 +371,12 @@ export const OPENCODE_MANIFEST = [
|
|
|
371
371
|
format: "markered-text",
|
|
372
372
|
module: "opencode",
|
|
373
373
|
},
|
|
374
|
+
// bkit-guardrails.js — same split as bkit-gateguard.js. Refuses the shell deny tier.
|
|
375
|
+
{
|
|
376
|
+
path: ".opencode/plugin/bkit-guardrails.js",
|
|
377
|
+
format: "markered-text",
|
|
378
|
+
module: "opencode",
|
|
379
|
+
},
|
|
374
380
|
// bkit-rules.js — same split as bkit-gateguard.js. Delivers the rules-read advisory
|
|
375
381
|
// on the session's first tool call (opencode has no session-start event).
|
|
376
382
|
{
|
|
@@ -185,7 +185,9 @@ export function runClaudeModule(ctx) {
|
|
|
185
185
|
* never recorded, so it is never touched. An absent or empty record means bkit claims
|
|
186
186
|
* authorship of nothing and prunes nothing — old consumers converge by addition only.
|
|
187
187
|
*
|
|
188
|
-
* Returns the set to record for next time
|
|
188
|
+
* Returns the set to record for next time (the grants bkit added on this install and the
|
|
189
|
+
* recorded ones it still derives, never a grant the consumer already had), or `null`
|
|
190
|
+
* when nothing was determined and
|
|
189
191
|
* the caller must leave the prior record alone: no settings file, unparseable JSON,
|
|
190
192
|
* a non-array `allow`, or a dry run. `null` is a statement about PROVENANCE, never
|
|
191
193
|
* about the write set — the `ws.writes` push below still fires under `dryRun`, because
|
|
@@ -224,7 +226,9 @@ export function enrichClaudeSettingsAllows(settingsDst, cwd, dryRun, ws, advisor
|
|
|
224
226
|
});
|
|
225
227
|
}
|
|
226
228
|
}
|
|
227
|
-
|
|
229
|
+
// Record only what bkit wrote: grants it added before and still derives, plus the ones it
|
|
230
|
+
// added now. A grant the consumer already had is never recorded, so uninstall keeps it.
|
|
231
|
+
return dryRun ? null : [...new Set([...recorded.filter((r) => needed.includes(r)), ...add])];
|
|
228
232
|
}
|
|
229
233
|
// ---------------------------------------------------------------------------
|
|
230
234
|
// MCP config — `.mcp.json` (claude) and `.cursor/mcp.json` (cursor). bkit owns only
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as path from "node:path";
|
|
7
7
|
import { parseJson } from "../../shared/json.js";
|
|
8
|
+
import { isOpencodeProvider } from "../../render/models.js";
|
|
9
|
+
import { OPENCODE_PROVIDER_DEFAULTS } from "../../shared/egress.js";
|
|
8
10
|
// ---------------------------------------------------------------------------
|
|
9
11
|
// Helpers
|
|
10
12
|
// ---------------------------------------------------------------------------
|
|
@@ -52,8 +54,25 @@ function setConsumerBkitField(field, value, dryRun) {
|
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
// The cloud workflow is a template (`.bkit/templates.md`). Shared first step of the
|
|
55
|
-
//
|
|
56
|
-
const CLOUD_WORKFLOW_ADOPT_STEP = " - Copy `.bkit/templates/.github/workflows/bkit-cloud.yml` to `.github/workflows/bkit-cloud.yml` and own it: bkit never writes or overwrites that file after you copy it. The one exception is a brand migration: `bkit upgrade` rewrites exact shipped old names in it and leaves any edited line. Replace
|
|
57
|
+
// router-backed setup advisories.
|
|
58
|
+
const CLOUD_WORKFLOW_ADOPT_STEP = " - Copy `.bkit/templates/.github/workflows/bkit-cloud.yml` to `.github/workflows/bkit-cloud.yml` and own it: bkit never writes or overwrites that file after you copy it. The one exception is a brand migration: `bkit upgrade` rewrites exact shipped old names in it and leaves any edited line. Replace `{{CLOUD_RUNNER}}` with your runner label and `{{NODE_VERSION}}` with your Node major. `.bkit/templates.md` lists every placeholder; on each `bkit upgrade`, diff the refreshed template against your copy.\n";
|
|
59
|
+
function trackerAdvisoryLines(tracker, variant) {
|
|
60
|
+
const credentials = {
|
|
61
|
+
github: " - Tracker credential (GitHub): set `BKIT_GH_TOKEN` for the cloud environment.\n",
|
|
62
|
+
linear: " - Tracker credential (Linear): set `BKIT_LINEAR_API_KEY` in the cloud environment and as a repo Actions secret for the router. Generate it at https://linear.app/settings/api.\n",
|
|
63
|
+
jira: " - Tracker credential (Jira): set `BKIT_JIRA_API_KEY` in the cloud environment and as a repo Actions secret for the router. Use an Atlassian MCP V2 scoped token; `.bkit/trackers.md` § jira lists its permissions.\n",
|
|
64
|
+
none: " - Wire a tracker with `bkit install --tracker=<github|linear|jira>`.\n",
|
|
65
|
+
};
|
|
66
|
+
const cursorTriggers = {
|
|
67
|
+
github: " - Optional native launch: mention `@cursor` on a GitHub issue or pull request.\n",
|
|
68
|
+
linear: " - Optional native launch: use Cursor's Linear integration.\n",
|
|
69
|
+
jira: " - Launch Cursor manually or through its own GitHub triggers for a Jira issue.\n",
|
|
70
|
+
none: "",
|
|
71
|
+
};
|
|
72
|
+
return (credentials[tracker] +
|
|
73
|
+
" - Label the issue `bkit:auto` in the configured tracker before pushing the build commit.\n" +
|
|
74
|
+
(variant === "cursor" ? cursorTriggers[tracker] : ""));
|
|
75
|
+
}
|
|
57
76
|
// ---------------------------------------------------------------------------
|
|
58
77
|
// runCloudModule — opt-in cloud-agent integration
|
|
59
78
|
// ---------------------------------------------------------------------------
|
|
@@ -69,98 +88,66 @@ const CLOUD_WORKFLOW_ADOPT_STEP = " - Copy `.bkit/templates/.github/workflows/b
|
|
|
69
88
|
// = hard error). The context's cloudVariant carries the chosen variant.
|
|
70
89
|
export function runCloudModule(ctx) {
|
|
71
90
|
const { dryRun, advisories } = ctx;
|
|
72
|
-
// Default to "claude" (the Claude/GitHub path) when cloudVariant is not set.
|
|
73
|
-
// Callers should always pass cloudVariant.
|
|
74
91
|
const variant = ctx.cloudVariant ?? "claude";
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
" - Run `/install-github-app` (Claude Code CLI) to install the Claude GitHub App
|
|
88
|
-
" -
|
|
89
|
-
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
" -
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
"
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
else if (variant === "opencode") {
|
|
113
|
-
// --- cloud=opencode: GitHub-tracker path (same bkit-cloud.yml template, no OIDC) ---
|
|
114
|
-
// Record the variant.
|
|
115
|
-
setConsumerBkitField("cloud.agent", "opencode", dryRun);
|
|
116
|
-
// Advisory — cloud=opencode setup checklist.
|
|
117
|
-
advisories.push({
|
|
118
|
-
id: "bkit-cloud-setup",
|
|
119
|
-
severity: "advisory",
|
|
120
|
-
detect: "Cloud agents (opencode) need the unified cloud workflow (claude + opencode jobs, runtime-gated by secret presence), which ships as a template at `.bkit/templates/.github/workflows/bkit-cloud.yml`. The opencode job runs when `OPENCODE_PROVIDER_KEY` is set.",
|
|
121
|
-
action: "Full recipe in bkit's `cloud.md` § Post-CI auto-routing.\n\n" +
|
|
122
|
-
"REQUIRED ONE-TIME SETUP:\n" +
|
|
123
|
-
CLOUD_WORKFLOW_ADOPT_STEP +
|
|
124
|
-
" - Install the local opencode host first: `bkit install --opencode=<provider>` (e.g. `--opencode=opencode`). The cloud opencode job runs against the committed `.opencode/` config — provider and model pins come from there, not from this YAML.\n" +
|
|
125
|
-
" - Add `OPENCODE_PROVIDER_KEY` to repo secrets (Settings → Secrets and variables → Actions). Set it to your configured provider's API key. The workflow fans this one secret out to every supported provider env var name (`BKIT_OPENROUTER_API_KEY`/`BKIT_OLLAMA_API_KEY`/`BKIT_OPENCODE_API_KEY`) so the `.opencode/opencode.json` `{env:VAR}` reference resolves whichever provider you installed.\n" +
|
|
126
|
-
" - GitHub Actions permissions — flip BOTH org AND repo: Settings → Actions → General → Workflow permissions = **Read and write permissions** + tick **Allow GitHub Actions to create and approve pull requests**.\n" +
|
|
127
|
-
" - The opencode job does NOT use a Claude API key — it runs the opencode runner with your chosen provider key only. If you also install the claude job (separate secret), both jobs coexist on the same event.\n" +
|
|
128
|
-
" - Label the issue `bkit:auto` before pushing the build commit — without the label the CI auto-route exits no-op.\n\n" +
|
|
129
|
-
"REACTIVE HANDLER (separate, consumer self-installed): the stock `/oc` comment handler (`opencode github install`) is NOT managed by bkit — install it once per repo independently. It mirrors the `@claude`/`claude.yml` stance. `bkit-cloud.yml` handles the CI-driven + `workflow_dispatch` path only.",
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
// --- cloud=cursor: Linear-tracker path ---
|
|
134
|
-
// Record the variant.
|
|
135
|
-
setConsumerBkitField("cloud.agent", "cursor", dryRun);
|
|
136
|
-
// Advisory — cloud=cursor setup checklist.
|
|
137
|
-
advisories.push({
|
|
138
|
-
id: "bkit-cloud-setup",
|
|
139
|
-
severity: "advisory",
|
|
140
|
-
detect: "Cloud agents (cursor) need the Cursor Background Agent scaffolding, which ships as templates at `.bkit/templates/.cursor/Dockerfile` and `.bkit/templates/.cursor/environment.json`. The Cursor Background Agent trigger is configured in the Cursor cloud agents dashboard — bkit cannot automate that step.",
|
|
92
|
+
const trackerLines = trackerAdvisoryLines(ctx.issueTracker, variant);
|
|
93
|
+
const providerKey = ctx.opencodeProvider && isOpencodeProvider(ctx.opencodeProvider)
|
|
94
|
+
? OPENCODE_PROVIDER_DEFAULTS[ctx.opencodeProvider].envVar
|
|
95
|
+
: "your configured provider's BKIT_ key";
|
|
96
|
+
const routerSetup = "Full recipe in bkit's `cloud.md` § Post-CI auto-routing.\n\n" +
|
|
97
|
+
"REQUIRED ONE-TIME SETUP:\n" +
|
|
98
|
+
CLOUD_WORKFLOW_ADOPT_STEP +
|
|
99
|
+
" - GitHub Actions permissions — set org and repo Workflow permissions to **Read and write permissions** and tick **Allow GitHub Actions to create and approve pull requests**.\n";
|
|
100
|
+
const variants = {
|
|
101
|
+
claude: {
|
|
102
|
+
detect: "Cloud agents (claude) use the unified cloud workflow. It selects the recorded cloud agent and requires the Claude GitHub App for OIDC authentication.",
|
|
103
|
+
action: routerSetup +
|
|
104
|
+
" - Run `/install-github-app` (Claude Code CLI) to install the Claude GitHub App. The action needs `id-token: write` for OIDC.\n" +
|
|
105
|
+
" - Set the `BKIT_ANTHROPIC_API_KEY` repo secret, or configure keyless workload identity federation with the `ANTHROPIC_FEDERATION_RULE_ID` + `ANTHROPIC_ORGANIZATION_ID` repo variables (optional `ANTHROPIC_SERVICE_ACCOUNT_ID` / `ANTHROPIC_WORKSPACE_ID`). Leave the API key unset to use federation.\n" +
|
|
106
|
+
trackerLines +
|
|
107
|
+
"\nOPTIONAL: after installing the App, mention `@claude /bkit-plan` on a GitHub issue or pull request. Vendor-native handlers are installed separately; bkit does not install them.",
|
|
108
|
+
},
|
|
109
|
+
opencode: {
|
|
110
|
+
detect: "Cloud agents (opencode) use the unified cloud workflow and the provider configured in the committed .opencode/ host.",
|
|
111
|
+
action: routerSetup +
|
|
112
|
+
" - Install the local host: `bkit install --opencode=<provider>` (e.g. `--opencode=openrouter`). Commit its provider and model configuration.\n" +
|
|
113
|
+
` - Add \`${providerKey}\` to repo Actions secrets for the configured provider.\n` +
|
|
114
|
+
trackerLines +
|
|
115
|
+
"\nThe stock `/oc` comment handler (`opencode github install`) is a separate vendor-native installation; bkit does not install it.",
|
|
116
|
+
},
|
|
117
|
+
codex: {
|
|
118
|
+
detect: "Cloud agents (codex) use the unified cloud workflow and openai/codex-action with the installed Codex host.",
|
|
119
|
+
action: routerSetup +
|
|
120
|
+
" - Install the Codex host first: `bkit install --codex`. Copy the environment setup from `.codex/bkit-cloud.md` (gitignored).\n" +
|
|
121
|
+
" - Add `BKIT_OPENAI_API_KEY` to repo Actions secrets. The router starts the codex job only when codex is the recorded agent and its credential is set.\n" +
|
|
122
|
+
trackerLines +
|
|
123
|
+
"\nVendor-native `@Codex` mentions and Codex for Linear are configured separately; bkit documents them and does not install them.",
|
|
124
|
+
},
|
|
125
|
+
cursor: {
|
|
126
|
+
detect: "Cloud agents (cursor) use the Cursor Cloud Agents dashboard triggers and the .cursor/ scaffolding templates.",
|
|
141
127
|
action: "Full recipe in bkit's `cloud.md` § Post-CI auto-routing.\n\n" +
|
|
142
128
|
"IN CURSOR DASHBOARD:\n" +
|
|
143
129
|
" - Cursor → Cloud Agents dashboard → Triggers → + Add trigger.\n" +
|
|
144
130
|
" - Event: CI workflow completion. Branch filter: `feat/**`.\n" +
|
|
145
|
-
" - Prompt
|
|
146
|
-
|
|
147
|
-
"
|
|
148
|
-
" -
|
|
149
|
-
"
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
131
|
+
" - Prompt: `/bkit-auto $CI_STATUS $PR_NUMBER`. Allowed concurrency: latest-supersedes.\n" +
|
|
132
|
+
trackerLines +
|
|
133
|
+
"\nIN REPO (copy each template and own it):\n" +
|
|
134
|
+
" - `.bkit/templates/.cursor/Dockerfile` → `.cursor/Dockerfile`: match your Node major and add your stack's tools.\n" +
|
|
135
|
+
" - `.bkit/templates/.cursor/environment.json` → `.cursor/environment.json`: configure install, start and terminal commands.",
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
setConsumerBkitField("cloud.agent", variant, dryRun);
|
|
139
|
+
advisories.push({ id: "bkit-cloud-setup", severity: "advisory", ...variants[variant] });
|
|
140
|
+
if (variant === "claude" || variant === "cursor") {
|
|
141
|
+
const environment = variant === "claude"
|
|
142
|
+
? "Adopt `.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh` as `.claude/hooks/bkit-cloud-bootstrap.sh`. Configure the setup script and environment in the Claude app dashboard."
|
|
143
|
+
: "Configure the copied .cursor/Dockerfile and .cursor/environment.json, then add each token as a **Runtime Secret** in the Cursor Cloud Agents dashboard.";
|
|
154
144
|
advisories.push({
|
|
155
145
|
id: "cloud-env-customize",
|
|
156
146
|
severity: "advisory",
|
|
157
|
-
detect:
|
|
158
|
-
action:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
" - Tracker secret (Linear): `BKIT_LINEAR_API_KEY` (generate at https://linear.app/settings/api). `LINEAR_ISSUE_ID` is injected per-session — don't hardcode.\n" +
|
|
162
|
-
" - First session after Dockerfile changes rebuilds the image; subsequent sessions reuse cached layers.\n\n" +
|
|
163
|
-
"Full recipe in bkit's `cloud.md`; the paste-ready block is in `.cursor/bkit-cloud.md`.",
|
|
147
|
+
detect: `Cloud environment setup combines the repo templates and the ${variant} dashboard.`,
|
|
148
|
+
action: environment +
|
|
149
|
+
` Copy-paste-ready values resolved from your .envrc are in .${variant}/bkit-cloud.md (gitignored).\n` +
|
|
150
|
+
trackerLines,
|
|
164
151
|
});
|
|
165
152
|
}
|
|
166
153
|
}
|
|
@@ -10,6 +10,12 @@ import { substituteWorkflow } from "../../render/trackers.js";
|
|
|
10
10
|
import { readInstallingVersion } from "../../shared/package-json.js";
|
|
11
11
|
import { writeCodexCloudDoc } from "../cloud-env.js";
|
|
12
12
|
import { BKIT_PREFIX, installFile, listMdFiles, removeOrphans, trackMirrorWrite } from "./core.js";
|
|
13
|
+
/**
|
|
14
|
+
* Status of the Codex private-key shell-read deny. Set from the recorded real-host result
|
|
15
|
+
* (`tests/experiments/hooks/results/<date>/bkit-codex-key-deny.json`): only an outcome of
|
|
16
|
+
* `denied` allows "denied (verified on codex-cli {version}, {date})".
|
|
17
|
+
*/
|
|
18
|
+
const CODEX_KEY_DENY_STATUS = "configured to deny, not verified on a real Codex host";
|
|
13
19
|
/**
|
|
14
20
|
* Convert a workflow orchestrator (`.bkit/core/workflows/*.md`) into a Codex SKILL.md.
|
|
15
21
|
*
|
|
@@ -184,9 +190,10 @@ export function runCodexModule(ctx) {
|
|
|
184
190
|
id: "codex-setup",
|
|
185
191
|
severity: "advisory",
|
|
186
192
|
detect: "codex host installed (.codex/agents + .agents/skills/bkit-*).",
|
|
187
|
-
action: "
|
|
193
|
+
action: "Four things that differ from the other hosts:\n" +
|
|
188
194
|
"1. TRUST THE LAYER. Codex loads project-local hooks only once the `.codex/` layer is trusted. Until then GateGuard and ReadGuard are installed and never fire.\n" +
|
|
189
195
|
"2. Workflows are SKILLS here, not slash commands: invoke `$bkit-design`, not `/bkit-design`.\n" +
|
|
190
|
-
"3. Per-agent `tools:` is NOT enforced. Codex has no tool allowlist, so every agent gets the full built-in tool set. See .bkit/providers.md
|
|
196
|
+
"3. Per-agent `tools:` is NOT enforced. Codex has no tool allowlist, so every agent gets the full built-in tool set. See .bkit/providers.md.\n" +
|
|
197
|
+
`4. SHELL READS OF SECRET FILES. Private-key shell reads are ${CODEX_KEY_DENY_STATUS}: a command that prints a private key's content or sends it off the machine (\`cat\`, \`head\`, \`grep\`, \`dd if=\`, \`git show HEAD:key.pem\`, \`openssl rsa -in\`, \`curl -d @key.pem\`, \`scp key.pem host:\`) for \`id_rsa\`, \`id_dsa\`, \`id_ecdsa\`, \`id_ed25519\`, \`*.pem\`, \`*.p12\`, \`*.pfx\` or \`*.key\`, or for a glob that can match one (\`~/.ssh/*\`). A command that only uses a key (\`ssh -i\`, \`curl --cacert\`) runs with a note. The rule goes by file name, so a renamed or copied key, a path in a variable, and \`xargs\`, \`find -exec\` or a script language are not caught. To act on it: trust the \`.codex/\` layer (item 1), keep private keys out of the repo, and check the deny on a real Codex host before relying on it: trust the \`.codex/\` layer, write a synthetic \`id_rsa\` containing no real key, ask Codex to run \`cat ./id_rsa\`, and confirm a control that the same hook denies (\`bkit tests jump\`) is also denied; if the control is not denied the hook did not run. \`.env\` shell reads stay advisory: the command runs with a note, so the protection is advisory only. Keep secrets out of reach with direnv (\`.envrc\`) and do not rely on this hook for \`.env\` files.`,
|
|
191
198
|
});
|
|
192
199
|
}
|