@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
|
@@ -38,6 +38,11 @@ export const SESSION_HIJACK_KEYS = [
|
|
|
38
38
|
"ANTHROPIC_AUTH_TOKEN",
|
|
39
39
|
] as const;
|
|
40
40
|
|
|
41
|
+
// Router-only keys: used by a router job as a repo Actions secret, never by a cloud agent
|
|
42
|
+
// session. Pasting them would hand a paid key to every session that reads untrusted issue /
|
|
43
|
+
// PR text. Always dropped from the paste block.
|
|
44
|
+
export const ROUTER_ONLY_KEYS = ["BKIT_OPENAI_API_KEY"] as const;
|
|
45
|
+
|
|
41
46
|
// bkit baseline env-var NAMES every cloud environment needs, whatever the tracker:
|
|
42
47
|
// `gh` and the GitHub MCP server read BKIT_GH_TOKEN on every host. Emitted as a
|
|
43
48
|
// placeholder ONLY when absent from the resolved `.envrc` set — a present value keeps
|
|
@@ -59,6 +64,8 @@ export interface CloudEnvResolution {
|
|
|
59
64
|
unset: string[];
|
|
60
65
|
/** Session-hijack keys that were present and were dropped. */
|
|
61
66
|
hijackDropped: string[];
|
|
67
|
+
/** Router-only keys that were present and were dropped. */
|
|
68
|
+
routerOnlyDropped: string[];
|
|
62
69
|
/** Keys whose resolved value was empty (skipped from the paste block). */
|
|
63
70
|
emptySkipped: string[];
|
|
64
71
|
/** Baseline token names absent from sources — emitted as placeholders. */
|
|
@@ -135,6 +142,7 @@ export function resolveCloudEnvVars(cwd: string): CloudEnvResolution {
|
|
|
135
142
|
included: [],
|
|
136
143
|
unset: [],
|
|
137
144
|
hijackDropped: [],
|
|
145
|
+
routerOnlyDropped: [],
|
|
138
146
|
emptySkipped: [],
|
|
139
147
|
placeholders: [],
|
|
140
148
|
sources: [],
|
|
@@ -177,6 +185,14 @@ export function resolveCloudEnvVars(cwd: string): CloudEnvResolution {
|
|
|
177
185
|
}
|
|
178
186
|
}
|
|
179
187
|
|
|
188
|
+
// Drop router-only keys.
|
|
189
|
+
for (const k of ROUTER_ONLY_KEYS) {
|
|
190
|
+
if (map.has(k)) {
|
|
191
|
+
res.routerOnlyDropped.push(k);
|
|
192
|
+
map.delete(k);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
180
196
|
// Partition non-empty (included) vs empty (skipped).
|
|
181
197
|
for (const [k, v] of map) {
|
|
182
198
|
if (v === "") res.emptySkipped.push(k);
|
|
@@ -234,6 +250,11 @@ export function renderCloudEnvNotes(res: CloudEnvResolution): string {
|
|
|
234
250
|
`- **Dropped — session-billing hijack:** ${fmtList(res.hijackDropped)} — would redirect the agent's own model calls onto API-key billing instead of your subscription.`,
|
|
235
251
|
);
|
|
236
252
|
}
|
|
253
|
+
if (res.routerOnlyDropped.length) {
|
|
254
|
+
bullets.push(
|
|
255
|
+
`- **Dropped — router-only secret:** ${fmtList(res.routerOnlyDropped)} — set it as a repo Actions secret; no cloud agent session needs it.`,
|
|
256
|
+
);
|
|
257
|
+
}
|
|
237
258
|
if (res.emptySkipped.length) {
|
|
238
259
|
bullets.push(`- **Empty in source (skipped):** ${fmtList(res.emptySkipped)}`);
|
|
239
260
|
}
|
|
@@ -627,15 +648,15 @@ function writeGeneratedJson(cwd: string, rel: string, doc: unknown, dryRun: bool
|
|
|
627
648
|
}
|
|
628
649
|
|
|
629
650
|
/**
|
|
630
|
-
* 8-hex fingerprint of
|
|
631
|
-
* the
|
|
632
|
-
* `allowed-domains` never moves it
|
|
651
|
+
* 8-hex fingerprint of an entry list, sorted and de-duplicated. With no argument it
|
|
652
|
+
* covers the DERIVED egress set only — bases and hosts, never the consumer union (the
|
|
653
|
+
* Cursor and Codex paste notes use that); editing `allowed-domains` never moves it,
|
|
654
|
+
* editing a registry row does. Pass the resolved allowlist to cover consumer
|
|
655
|
+
* `allowed-domains` too (the Claude paste list and `.bkit/allowlist.json`).
|
|
633
656
|
*/
|
|
634
|
-
export function egressFingerprint(): string {
|
|
635
|
-
const
|
|
636
|
-
|
|
637
|
-
].sort();
|
|
638
|
-
return sha256(derived.join("\n")).slice(0, 8);
|
|
657
|
+
export function egressFingerprint(entries?: readonly string[]): string {
|
|
658
|
+
const set = entries ?? [...BKIT_SHIPPED_NETWORK_DOMAINS, ...BKIT_SHIPPED_NETWORK_HOSTS];
|
|
659
|
+
return sha256([...new Set(set)].sort().join("\n")).slice(0, 8);
|
|
639
660
|
}
|
|
640
661
|
|
|
641
662
|
/**
|
|
@@ -682,10 +703,17 @@ export function renderCloudNetworkAllowlist(cwd: string): string {
|
|
|
682
703
|
"\n```\n\n" +
|
|
683
704
|
`_${domains.length} entries (${domains.length / 2} domains, each as apex + \`*.\` wildcard): ` +
|
|
684
705
|
networkSourceCounts(networkAllowlistBases(declared), BKIT_SHIPPED_NETWORK_DOMAINS) +
|
|
685
|
-
".
|
|
686
|
-
egressFingerprint() +
|
|
706
|
+
". Allowlist fingerprint `" +
|
|
707
|
+
egressFingerprint(domains) +
|
|
687
708
|
"`._" +
|
|
688
709
|
declaredNote +
|
|
710
|
+
"\n\nThe fingerprint is also recorded in `.bkit/allowlist.json`. After you paste the list, " +
|
|
711
|
+
"set `BKIT_CLOUD_ALLOWLIST_FINGERPRINT` to it in the cloud environment's variables (or " +
|
|
712
|
+
"the setup script); the SessionStart bootstrap compares it with the repo's current " +
|
|
713
|
+
"fingerprint and warns on a mismatch, then continues. The stamp is an operator " +
|
|
714
|
+
"assertion that you pasted this list: the deployed dashboard allowlist stays " +
|
|
715
|
+
"unverified. After any `allowed-domains` change, run `bkit upgrade`, re-paste the list " +
|
|
716
|
+
"and update the variable." +
|
|
689
717
|
"\n\nUnder **Trusted**, your app domains and most observability / API hosts are\n" +
|
|
690
718
|
"unreachable, so cloud `/bkit-debug` gets no runtime logs and e2e can't hit your\n" +
|
|
691
719
|
"deployment. **Full** works too but opens all egress."
|
|
@@ -107,6 +107,22 @@ export function extractManagedBlock(
|
|
|
107
107
|
return inner.replace(/^\n+/, "").replace(/\n+$/, "");
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// The text from the first byte through the end-marker line (newline included). Null unless
|
|
111
|
+
// the file has exactly one start marker and one end marker, start first. Used to tell a
|
|
112
|
+
// change below the block from a change to the block or the text above it.
|
|
113
|
+
export function managedHead(
|
|
114
|
+
content: string,
|
|
115
|
+
markerStyle: MarkerStyle = "html-comment",
|
|
116
|
+
): string | null {
|
|
117
|
+
const [startMarker, endMarker] = selectMarkers(markerStyle);
|
|
118
|
+
const starts = findLineAnchoredMarkers(content, startMarker);
|
|
119
|
+
const ends = findLineAnchoredMarkers(content, endMarker);
|
|
120
|
+
if (starts.length !== 1 || ends.length !== 1) return null;
|
|
121
|
+
if (starts[0]! >= ends[0]!) return null;
|
|
122
|
+
const endLineEnd = content.indexOf("\n", ends[0]! + endMarker.length);
|
|
123
|
+
return endLineEnd === -1 ? content : content.slice(0, endLineEnd + 1);
|
|
124
|
+
}
|
|
125
|
+
|
|
110
126
|
// Extract the FULL bkit-managed block INCLUDING marker lines from a file.
|
|
111
127
|
// markerStyle defaults to "html-comment".
|
|
112
128
|
// Used to append a fresh block to a destination that has none. Markers may be
|
|
@@ -246,3 +262,92 @@ export function updateManagedBlock(
|
|
|
246
262
|
if (!dryRun) fs.writeFileSync(filePath, result.content, "utf-8");
|
|
247
263
|
return true;
|
|
248
264
|
}
|
|
265
|
+
|
|
266
|
+
// ---------------------------------------------------------------------------
|
|
267
|
+
// Wrapper-only removal — the ownership metadata of a document that becomes the project's own
|
|
268
|
+
// ---------------------------------------------------------------------------
|
|
269
|
+
|
|
270
|
+
/** The generated notice line a managed block carries: `<!-- bkit:managed vX — do not edit; … -->`. */
|
|
271
|
+
const MANAGED_NOTICE_RE =
|
|
272
|
+
/^<!-- bkit:managed v\S+ — (?:.* — )?do (?:not|NOT) edit; run `bkit upgrade` to refresh -->$/;
|
|
273
|
+
|
|
274
|
+
/** Why a wrapper could not be removed without guessing. */
|
|
275
|
+
export type WrapperProblem =
|
|
276
|
+
"missing-partner" | "inverted" | "multiple" | "inside-fence" | "multiple-notices";
|
|
277
|
+
|
|
278
|
+
export type StripManagedWrapperResult =
|
|
279
|
+
| { status: "none"; content: string }
|
|
280
|
+
| { status: "removed"; content: string; removedLines: number }
|
|
281
|
+
| { status: "ambiguous"; content: string; problem: WrapperProblem };
|
|
282
|
+
|
|
283
|
+
/** Lines with their terminators, so removing a line keeps every other byte, CRLF included. */
|
|
284
|
+
function splitKeepingEol(content: string): string[] {
|
|
285
|
+
return content.match(/[^\n]*\n|[^\n]+$/g) ?? [];
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const bareLine = (line: string): string => line.replace(/\r?\n$/, "");
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Remove the ownership wrapper of a markdown document: the one ordered pair of exact
|
|
292
|
+
* `<!-- bkit:start -->` / `<!-- bkit:end -->` lines and the generated `bkit:managed` notice line
|
|
293
|
+
* between them. Every other byte stays, original line endings included. The enclosed text is
|
|
294
|
+
* the project's. When both markers are absent the content is returned as it is. Anything that
|
|
295
|
+
* cannot be told apart from project text (one marker alone, reversed or repeated markers, a
|
|
296
|
+
* marker-looking line inside a Markdown fence, more than one notice) is `ambiguous` and the
|
|
297
|
+
* content is returned unchanged.
|
|
298
|
+
*/
|
|
299
|
+
export function stripManagedWrapper(content: string): StripManagedWrapperResult {
|
|
300
|
+
const lines = splitKeepingEol(content);
|
|
301
|
+
const starts: number[] = [];
|
|
302
|
+
const ends: number[] = [];
|
|
303
|
+
const notices: number[] = [];
|
|
304
|
+
let fence: string | null = null;
|
|
305
|
+
let inFenceHit = false;
|
|
306
|
+
lines.forEach((line, i) => {
|
|
307
|
+
const text = bareLine(line);
|
|
308
|
+
const fenceMatch = /^\s*(`{3,}|~{3,})/.exec(text);
|
|
309
|
+
if (fenceMatch) {
|
|
310
|
+
const mark = fenceMatch[1]![0]!;
|
|
311
|
+
if (fence === null) fence = mark;
|
|
312
|
+
else if (fence === mark) fence = null;
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const isStart = text === START_MARKER;
|
|
316
|
+
const isEnd = text === END_MARKER;
|
|
317
|
+
const isNotice = MANAGED_NOTICE_RE.test(text);
|
|
318
|
+
if (fence !== null) {
|
|
319
|
+
if (isStart || isEnd || isNotice) inFenceHit = true;
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
if (isStart) starts.push(i);
|
|
323
|
+
else if (isEnd) ends.push(i);
|
|
324
|
+
else if (isNotice) notices.push(i);
|
|
325
|
+
});
|
|
326
|
+
const ambiguous = (problem: WrapperProblem): StripManagedWrapperResult => ({
|
|
327
|
+
status: "ambiguous",
|
|
328
|
+
content,
|
|
329
|
+
problem,
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
if (inFenceHit) return ambiguous("inside-fence");
|
|
333
|
+
if (starts.length === 0 && ends.length === 0) return { status: "none", content };
|
|
334
|
+
if (starts.length === 0 || ends.length === 0) return ambiguous("missing-partner");
|
|
335
|
+
if (starts.length > 1 || ends.length > 1) return ambiguous("multiple");
|
|
336
|
+
const start = starts[0]!;
|
|
337
|
+
const end = ends[0]!;
|
|
338
|
+
if (start >= end) return ambiguous("inverted");
|
|
339
|
+
const inside = notices.filter((n) => n > start && n < end);
|
|
340
|
+
if (inside.length > 1 || notices.length > inside.length) return ambiguous("multiple-notices");
|
|
341
|
+
|
|
342
|
+
const drop = new Set<number>([start, end, ...inside]);
|
|
343
|
+
// The writer pads each wrapper line with one blank line (`start`, blank, notice, blank,
|
|
344
|
+
// content, blank, `end`). That padding goes with the wrapper, one line each.
|
|
345
|
+
const isBlank = (i: number): boolean => i >= 0 && i < lines.length && bareLine(lines[i]!) === "";
|
|
346
|
+
for (const i of [start, ...inside]) if (isBlank(i + 1) && i + 1 < end) drop.add(i + 1);
|
|
347
|
+
if (isBlank(end - 1) && end - 1 > start) drop.add(end - 1);
|
|
348
|
+
return {
|
|
349
|
+
status: "removed",
|
|
350
|
+
content: lines.filter((_, i) => !drop.has(i)).join(""),
|
|
351
|
+
removedLines: drop.size,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
@@ -101,7 +101,7 @@ export function parseIssueTracker(value: unknown): IssueTracker | null {
|
|
|
101
101
|
*
|
|
102
102
|
* Single self-describing field (mirrors `bkit.tracker.default`).
|
|
103
103
|
*/
|
|
104
|
-
export const CLOUD_MODES = ["claude", "cursor", "opencode", "none"] as const;
|
|
104
|
+
export const CLOUD_MODES = ["claude", "cursor", "opencode", "codex", "none"] as const;
|
|
105
105
|
export type CloudAgents = (typeof CLOUD_MODES)[number];
|
|
106
106
|
|
|
107
107
|
/** Default when consumer manifest has no `bkit.cloud.agent` field (undecided). */
|
|
@@ -437,6 +437,12 @@ export const OPENCODE_MANIFEST: ManifestEntry[] = [
|
|
|
437
437
|
format: "markered-text",
|
|
438
438
|
module: "opencode",
|
|
439
439
|
},
|
|
440
|
+
// bkit-guardrails.js — same split as bkit-gateguard.js. Refuses the shell deny tier.
|
|
441
|
+
{
|
|
442
|
+
path: ".opencode/plugin/bkit-guardrails.js",
|
|
443
|
+
format: "markered-text",
|
|
444
|
+
module: "opencode",
|
|
445
|
+
},
|
|
440
446
|
// bkit-rules.js — same split as bkit-gateguard.js. Delivers the rules-read advisory
|
|
441
447
|
// on the session's first tool call (opencode has no session-start event).
|
|
442
448
|
{
|
|
@@ -230,7 +230,9 @@ export function runClaudeModule(ctx: ModuleContext): void {
|
|
|
230
230
|
* never recorded, so it is never touched. An absent or empty record means bkit claims
|
|
231
231
|
* authorship of nothing and prunes nothing — old consumers converge by addition only.
|
|
232
232
|
*
|
|
233
|
-
* Returns the set to record for next time
|
|
233
|
+
* Returns the set to record for next time (the grants bkit added on this install and the
|
|
234
|
+
* recorded ones it still derives, never a grant the consumer already had), or `null`
|
|
235
|
+
* when nothing was determined and
|
|
234
236
|
* the caller must leave the prior record alone: no settings file, unparseable JSON,
|
|
235
237
|
* a non-array `allow`, or a dry run. `null` is a statement about PROVENANCE, never
|
|
236
238
|
* about the write set — the `ws.writes` push below still fires under `dryRun`, because
|
|
@@ -277,7 +279,9 @@ export function enrichClaudeSettingsAllows(
|
|
|
277
279
|
});
|
|
278
280
|
}
|
|
279
281
|
}
|
|
280
|
-
|
|
282
|
+
// Record only what bkit wrote: grants it added before and still derives, plus the ones it
|
|
283
|
+
// added now. A grant the consumer already had is never recorded, so uninstall keeps it.
|
|
284
|
+
return dryRun ? null : [...new Set([...recorded.filter((r) => needed.includes(r)), ...add])];
|
|
281
285
|
}
|
|
282
286
|
|
|
283
287
|
// ---------------------------------------------------------------------------
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
import * as fs from "node:fs";
|
|
7
7
|
import * as path from "node:path";
|
|
8
8
|
import { parseJson } from "../../shared/json.js";
|
|
9
|
-
import type {
|
|
9
|
+
import type { CloudVariant } from "../../cli.js";
|
|
10
|
+
import { isOpencodeProvider } from "../../render/models.js";
|
|
11
|
+
import { OPENCODE_PROVIDER_DEFAULTS } from "../../shared/egress.js";
|
|
12
|
+
import type { IssueTracker } from "../manifest.js";
|
|
10
13
|
import type { ModuleContext } from "./index.js";
|
|
11
14
|
|
|
12
15
|
// ---------------------------------------------------------------------------
|
|
@@ -52,9 +55,30 @@ function setConsumerBkitField(field: string, value: string, dryRun: boolean): vo
|
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
// The cloud workflow is a template (`.bkit/templates.md`). Shared first step of the
|
|
55
|
-
//
|
|
58
|
+
// router-backed setup advisories.
|
|
56
59
|
const CLOUD_WORKFLOW_ADOPT_STEP =
|
|
57
|
-
" - 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
|
|
60
|
+
" - 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";
|
|
61
|
+
|
|
62
|
+
function trackerAdvisoryLines(tracker: IssueTracker, variant: CloudVariant): string {
|
|
63
|
+
const credentials: Record<IssueTracker, string> = {
|
|
64
|
+
github: " - Tracker credential (GitHub): set `BKIT_GH_TOKEN` for the cloud environment.\n",
|
|
65
|
+
linear:
|
|
66
|
+
" - 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",
|
|
67
|
+
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",
|
|
68
|
+
none: " - Wire a tracker with `bkit install --tracker=<github|linear|jira>`.\n",
|
|
69
|
+
};
|
|
70
|
+
const cursorTriggers: Record<IssueTracker, string> = {
|
|
71
|
+
github: " - Optional native launch: mention `@cursor` on a GitHub issue or pull request.\n",
|
|
72
|
+
linear: " - Optional native launch: use Cursor's Linear integration.\n",
|
|
73
|
+
jira: " - Launch Cursor manually or through its own GitHub triggers for a Jira issue.\n",
|
|
74
|
+
none: "",
|
|
75
|
+
};
|
|
76
|
+
return (
|
|
77
|
+
credentials[tracker] +
|
|
78
|
+
" - Label the issue `bkit:auto` in the configured tracker before pushing the build commit.\n" +
|
|
79
|
+
(variant === "cursor" ? cursorTriggers[tracker] : "")
|
|
80
|
+
);
|
|
81
|
+
}
|
|
58
82
|
|
|
59
83
|
// ---------------------------------------------------------------------------
|
|
60
84
|
// runCloudModule — opt-in cloud-agent integration
|
|
@@ -72,115 +96,80 @@ const CLOUD_WORKFLOW_ADOPT_STEP =
|
|
|
72
96
|
|
|
73
97
|
export function runCloudModule(ctx: ModuleContext): void {
|
|
74
98
|
const { dryRun, advisories } = ctx;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
severity: "advisory",
|
|
99
|
+
const variant = ctx.cloudVariant ?? "claude";
|
|
100
|
+
const trackerLines = trackerAdvisoryLines(ctx.issueTracker, variant);
|
|
101
|
+
const providerKey =
|
|
102
|
+
ctx.opencodeProvider && isOpencodeProvider(ctx.opencodeProvider)
|
|
103
|
+
? OPENCODE_PROVIDER_DEFAULTS[ctx.opencodeProvider].envVar
|
|
104
|
+
: "your configured provider's BKIT_ key";
|
|
105
|
+
const routerSetup =
|
|
106
|
+
"Full recipe in bkit's `cloud.md` § Post-CI auto-routing.\n\n" +
|
|
107
|
+
"REQUIRED ONE-TIME SETUP:\n" +
|
|
108
|
+
CLOUD_WORKFLOW_ADOPT_STEP +
|
|
109
|
+
" - 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";
|
|
110
|
+
const variants: Record<CloudVariant, { detect: string; action: string }> = {
|
|
111
|
+
claude: {
|
|
89
112
|
detect:
|
|
90
|
-
"Cloud agents (claude)
|
|
113
|
+
"Cloud agents (claude) use the unified cloud workflow. It selects the recorded cloud agent and requires the Claude GitHub App for OIDC authentication.",
|
|
91
114
|
action:
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
"
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
" - keyless workload identity federation: Claude Console → Settings → Workload identity → Connect workload → GitHub Actions creates the issuer, service account and federation rule; then set the `ANTHROPIC_FEDERATION_RULE_ID` + `ANTHROPIC_ORGANIZATION_ID` repo variables (optional `ANTHROPIC_SERVICE_ACCOUNT_ID` / `ANTHROPIC_WORKSPACE_ID`). Leave `ANTHROPIC_API_KEY` unset — a set key wins over federation.\n" +
|
|
100
|
-
" - Label the issue `bkit:auto` before pushing the build commit — without the label the CI auto-route exits no-op.\n\n" +
|
|
101
|
-
"OPTIONAL (manual phase launch): after `/install-github-app`, comment `@claude /bkit-plan` (or any phase) on a GitHub issue/PR to launch it from the tracker UI. The App's generated `claude.yml` triggers on mention events; `bkit-cloud.yml` triggers on CI completion + `workflow_dispatch` — the two coexist.\n\n" +
|
|
102
|
-
"Both the CI-driven path and the `@claude` mention path invoke the same `/bkit-auto` orchestrator (mirrored to `.claude/commands/bkit-auto.md` on each `pnpm bkit install`).",
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
// Advisory — cloud env scaffolding (Claude half).
|
|
106
|
-
advisories.push({
|
|
107
|
-
id: "cloud-env-customize",
|
|
108
|
-
severity: "advisory",
|
|
115
|
+
routerSetup +
|
|
116
|
+
" - Run `/install-github-app` (Claude Code CLI) to install the Claude GitHub App. The action needs `id-token: write` for OIDC.\n" +
|
|
117
|
+
" - 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" +
|
|
118
|
+
trackerLines +
|
|
119
|
+
"\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.",
|
|
120
|
+
},
|
|
121
|
+
opencode: {
|
|
109
122
|
detect:
|
|
110
|
-
"Cloud
|
|
123
|
+
"Cloud agents (opencode) use the unified cloud workflow and the provider configured in the committed .opencode/ host.",
|
|
111
124
|
action:
|
|
112
|
-
|
|
113
|
-
"
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
" - Tracker env vars (GitHub): `BKIT_GH_TOKEN` above is the only tracker credential — the GitHub MCP server sends it on every call, and the bootstrap hook signs `gh` in with it.\n" +
|
|
120
|
-
" - Network access: `Trusted` (default). One environment per repo (secrets differ per repo); the setup script + variable *names* are identical across repos, only the values change. See cloud.md § Sharing across repos → Claude.",
|
|
121
|
-
});
|
|
122
|
-
} else if (variant === "opencode") {
|
|
123
|
-
// --- cloud=opencode: GitHub-tracker path (same bkit-cloud.yml template, no OIDC) ---
|
|
124
|
-
|
|
125
|
-
// Record the variant.
|
|
126
|
-
setConsumerBkitField("cloud.agent", "opencode", dryRun);
|
|
127
|
-
|
|
128
|
-
// Advisory — cloud=opencode setup checklist.
|
|
129
|
-
advisories.push({
|
|
130
|
-
id: "bkit-cloud-setup",
|
|
131
|
-
severity: "advisory",
|
|
125
|
+
routerSetup +
|
|
126
|
+
" - Install the local host: `bkit install --opencode=<provider>` (e.g. `--opencode=openrouter`). Commit its provider and model configuration.\n" +
|
|
127
|
+
` - Add \`${providerKey}\` to repo Actions secrets for the configured provider.\n` +
|
|
128
|
+
trackerLines +
|
|
129
|
+
"\nThe stock `/oc` comment handler (`opencode github install`) is a separate vendor-native installation; bkit does not install it.",
|
|
130
|
+
},
|
|
131
|
+
codex: {
|
|
132
132
|
detect:
|
|
133
|
-
"Cloud agents (
|
|
133
|
+
"Cloud agents (codex) use the unified cloud workflow and openai/codex-action with the installed Codex host.",
|
|
134
134
|
action:
|
|
135
|
-
|
|
136
|
-
"
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
"
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
" - Label the issue `bkit:auto` before pushing the build commit — without the label the CI auto-route exits no-op.\n\n" +
|
|
143
|
-
"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.",
|
|
144
|
-
});
|
|
145
|
-
} else {
|
|
146
|
-
// --- cloud=cursor: Linear-tracker path ---
|
|
147
|
-
|
|
148
|
-
// Record the variant.
|
|
149
|
-
setConsumerBkitField("cloud.agent", "cursor", dryRun);
|
|
150
|
-
|
|
151
|
-
// Advisory — cloud=cursor setup checklist.
|
|
152
|
-
advisories.push({
|
|
153
|
-
id: "bkit-cloud-setup",
|
|
154
|
-
severity: "advisory",
|
|
135
|
+
routerSetup +
|
|
136
|
+
" - Install the Codex host first: `bkit install --codex`. Copy the environment setup from `.codex/bkit-cloud.md` (gitignored).\n" +
|
|
137
|
+
" - 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" +
|
|
138
|
+
trackerLines +
|
|
139
|
+
"\nVendor-native `@Codex` mentions and Codex for Linear are configured separately; bkit documents them and does not install them.",
|
|
140
|
+
},
|
|
141
|
+
cursor: {
|
|
155
142
|
detect:
|
|
156
|
-
"Cloud agents (cursor)
|
|
143
|
+
"Cloud agents (cursor) use the Cursor Cloud Agents dashboard triggers and the .cursor/ scaffolding templates.",
|
|
157
144
|
action:
|
|
158
145
|
"Full recipe in bkit's `cloud.md` § Post-CI auto-routing.\n\n" +
|
|
159
146
|
"IN CURSOR DASHBOARD:\n" +
|
|
160
147
|
" - Cursor → Cloud Agents dashboard → Triggers → + Add trigger.\n" +
|
|
161
148
|
" - Event: CI workflow completion. Branch filter: `feat/**`.\n" +
|
|
162
|
-
" - Prompt
|
|
163
|
-
|
|
164
|
-
"
|
|
165
|
-
" -
|
|
166
|
-
"
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
149
|
+
" - Prompt: `/bkit-auto $CI_STATUS $PR_NUMBER`. Allowed concurrency: latest-supersedes.\n" +
|
|
150
|
+
trackerLines +
|
|
151
|
+
"\nIN REPO (copy each template and own it):\n" +
|
|
152
|
+
" - `.bkit/templates/.cursor/Dockerfile` → `.cursor/Dockerfile`: match your Node major and add your stack's tools.\n" +
|
|
153
|
+
" - `.bkit/templates/.cursor/environment.json` → `.cursor/environment.json`: configure install, start and terminal commands.",
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
setConsumerBkitField("cloud.agent", variant, dryRun);
|
|
158
|
+
advisories.push({ id: "bkit-cloud-setup", severity: "advisory", ...variants[variant] });
|
|
170
159
|
|
|
171
|
-
|
|
160
|
+
if (variant === "claude" || variant === "cursor") {
|
|
161
|
+
const environment =
|
|
162
|
+
variant === "claude"
|
|
163
|
+
? "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."
|
|
164
|
+
: "Configure the copied .cursor/Dockerfile and .cursor/environment.json, then add each token as a **Runtime Secret** in the Cursor Cloud Agents dashboard.";
|
|
172
165
|
advisories.push({
|
|
173
166
|
id: "cloud-env-customize",
|
|
174
167
|
severity: "advisory",
|
|
175
|
-
detect:
|
|
176
|
-
"Cloud env config splits across the repo (`.cursor/Dockerfile` + `.cursor/environment.json`, copied from `.bkit/templates/.cursor/`) and the Cursor Cloud Agents dashboard (secrets, manual).",
|
|
168
|
+
detect: `Cloud environment setup combines the repo templates and the ${variant} dashboard.`,
|
|
177
169
|
action:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
" - 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" +
|
|
182
|
-
" - First session after Dockerfile changes rebuilds the image; subsequent sessions reuse cached layers.\n\n" +
|
|
183
|
-
"Full recipe in bkit's `cloud.md`; the paste-ready block is in `.cursor/bkit-cloud.md`.",
|
|
170
|
+
environment +
|
|
171
|
+
` Copy-paste-ready values resolved from your .envrc are in .${variant}/bkit-cloud.md (gitignored).\n` +
|
|
172
|
+
trackerLines,
|
|
184
173
|
});
|
|
185
174
|
}
|
|
186
175
|
}
|
|
@@ -18,6 +18,13 @@ import { writeCodexCloudDoc } from "../cloud-env.js";
|
|
|
18
18
|
import type { ModuleContext } from "./index.js";
|
|
19
19
|
import { BKIT_PREFIX, installFile, listMdFiles, removeOrphans, trackMirrorWrite } from "./core.js";
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Status of the Codex private-key shell-read deny. Set from the recorded real-host result
|
|
23
|
+
* (`tests/experiments/hooks/results/<date>/bkit-codex-key-deny.json`): only an outcome of
|
|
24
|
+
* `denied` allows "denied (verified on codex-cli {version}, {date})".
|
|
25
|
+
*/
|
|
26
|
+
const CODEX_KEY_DENY_STATUS = "configured to deny, not verified on a real Codex host";
|
|
27
|
+
|
|
21
28
|
/**
|
|
22
29
|
* Convert a workflow orchestrator (`.bkit/core/workflows/*.md`) into a Codex SKILL.md.
|
|
23
30
|
*
|
|
@@ -213,9 +220,10 @@ export function runCodexModule(ctx: ModuleContext): void {
|
|
|
213
220
|
severity: "advisory",
|
|
214
221
|
detect: "codex host installed (.codex/agents + .agents/skills/bkit-*).",
|
|
215
222
|
action:
|
|
216
|
-
"
|
|
223
|
+
"Four things that differ from the other hosts:\n" +
|
|
217
224
|
"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" +
|
|
218
225
|
"2. Workflows are SKILLS here, not slash commands: invoke `$bkit-design`, not `/bkit-design`.\n" +
|
|
219
|
-
"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
|
|
226
|
+
"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" +
|
|
227
|
+
`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.`,
|
|
220
228
|
});
|
|
221
229
|
}
|