@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
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
import {
|
|
29
29
|
buildDepUpdaterSetupAdvisory,
|
|
30
30
|
detectBkitStubs,
|
|
31
|
+
detectProjectDocs,
|
|
31
32
|
detectValeMissing,
|
|
32
33
|
detectValePackageNotSynced,
|
|
33
34
|
detectWorkflowLintToolsMissing,
|
|
@@ -44,7 +45,11 @@ import {
|
|
|
44
45
|
detectTestIntegrationEnv,
|
|
45
46
|
detectTurboIntegrationInputs,
|
|
46
47
|
} from "./ci-yml.js";
|
|
47
|
-
import {
|
|
48
|
+
import {
|
|
49
|
+
isAdvisorySuppressed,
|
|
50
|
+
type SuppressionNote,
|
|
51
|
+
type SuppressionReporter,
|
|
52
|
+
} from "./suppression.js";
|
|
48
53
|
import {
|
|
49
54
|
dropTipSilencedAdvisories,
|
|
50
55
|
setupTipsChecklistLines,
|
|
@@ -361,8 +366,9 @@ export function runPostInstallCheck(
|
|
|
361
366
|
const managedDuplicate = detectManagedDuplicate(cwd);
|
|
362
367
|
if (managedDuplicate) phase3.push(managedDuplicate);
|
|
363
368
|
|
|
364
|
-
// BKIT_GH_TOKEN shell env — authenticates the GitHub MCP server.
|
|
365
|
-
|
|
369
|
+
// BKIT_GH_TOKEN shell env — authenticates the GitHub MCP server. Skipped inside the pre-push
|
|
370
|
+
// hook's inner run, which unsets the .bkit/.env keys on purpose (BKIT_PRE_PUSH_LOGGED is set).
|
|
371
|
+
const ghMcpToken = process.env.BKIT_PRE_PUSH_LOGGED ? null : detectGhMcpToken(cwd);
|
|
366
372
|
if (ghMcpToken) phase3.push(ghMcpToken);
|
|
367
373
|
|
|
368
374
|
// Main branch protection — bkit's PR-base gates (build Step 16, ship Step 2)
|
|
@@ -472,6 +478,12 @@ export function runPostInstallCheck(
|
|
|
472
478
|
// bkit-stub sentinels in shipped templates — one advisory per still-commented stub.
|
|
473
479
|
for (const stub of detectBkitStubs(cwd)) phase3.push(stub);
|
|
474
480
|
|
|
481
|
+
// Project documents (docs/*.md): missing, empty, starter-only or unindexed. Advisory only.
|
|
482
|
+
for (const f of detectProjectDocs(cwd)) {
|
|
483
|
+
if (!isAdvisorySuppressed(cwd, f.id, f.severity)) phase3.push(f);
|
|
484
|
+
else onSuppressed?.({ id: f.id, scope: "." });
|
|
485
|
+
}
|
|
486
|
+
|
|
475
487
|
// turbo.json inputs for cache-replay safety (KN-24).
|
|
476
488
|
for (const f of detectTurboIntegrationInputs(cwd)) phase3.push(f);
|
|
477
489
|
|
|
@@ -6,6 +6,23 @@ import * as path from "node:path";
|
|
|
6
6
|
import { spawnSync } from "node:child_process";
|
|
7
7
|
import type { PreflightFinding } from "../before/index.js";
|
|
8
8
|
import { readPackageJson } from "../../shared/package-json.js";
|
|
9
|
+
import { readTextFile } from "../../shared/json.js";
|
|
10
|
+
import { getPkgRoot } from "../../shared/package-roots.js";
|
|
11
|
+
import {
|
|
12
|
+
PROJECT_DOC_TOPICS,
|
|
13
|
+
PROJECT_INDEX_PATH,
|
|
14
|
+
type ProjectDocTopic,
|
|
15
|
+
findIndexedEquivalent,
|
|
16
|
+
listIndexedEquivalents,
|
|
17
|
+
inspectRepoFile,
|
|
18
|
+
isInTreePath,
|
|
19
|
+
legacyStarterTopic,
|
|
20
|
+
normalizeLegacyText,
|
|
21
|
+
projectDocPath,
|
|
22
|
+
readProjectIndex,
|
|
23
|
+
starterPath,
|
|
24
|
+
} from "../../install/project-docs.js";
|
|
25
|
+
import { stripManagedWrapper } from "../../install/managed-block.js";
|
|
9
26
|
import { ciWorkflowPath, readBkitConfig } from "../../shared/settings.js";
|
|
10
27
|
import {
|
|
11
28
|
DEP_UPDATER_NAMES,
|
|
@@ -283,7 +300,7 @@ export function detectBkitStubs(cwd: string): PreflightFinding[] {
|
|
|
283
300
|
detect: `${ciRel} contains the bkit-stub:${stub.id} sentinel — a commented-in block shipped disabled by default.`,
|
|
284
301
|
action:
|
|
285
302
|
`${stub.description}\n\n` +
|
|
286
|
-
`Before enabling a CI lane, read docs/testing.md § CI test tiers and docs/deployments.md (one run per branch, push base
|
|
303
|
+
`Before enabling a CI lane, read docs/testing.md § CI test tiers and docs/deployments.md (one run per branch, push base). The FULL CI SCAFFOLD REFERENCE in ${ciRel} is the job graph: needs, if, step names. Write the job from that graph and from those docs. Uncomment only a block that is already commented YAML or shell.\n\n` +
|
|
287
304
|
`Decide with the user: (a) enable — uncomment the YAML/shell block AND delete the \`# bkit-stub:${stub.id} — ...\` header line; (b) customise — adjust paths/secrets/conditions before uncommenting; (c) dismiss — delete the entire stub block (header + commented body).\n\n` +
|
|
288
305
|
`Until the sentinel is removed, this advisory fires every install / check.`,
|
|
289
306
|
});
|
|
@@ -415,3 +432,230 @@ export function buildDepUpdaterSetupAdvisory(cwd: string): PreflightFinding | nu
|
|
|
415
432
|
'Use one updater, not both, and set `bkit.dependencies.updater` to its name (`"renovate"` or `"dependabot"`) in package.json. To silence this advisory, set it to `"none"`. See .bkit/templates.md.',
|
|
416
433
|
};
|
|
417
434
|
}
|
|
435
|
+
|
|
436
|
+
// ---------------------------------------------------------------------------
|
|
437
|
+
// Project documentation adoption and population
|
|
438
|
+
// ---------------------------------------------------------------------------
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* `docs/components.md` is checked beside the ten topics, at its own path only: an indexed
|
|
442
|
+
* equivalent does not count for it, and `bkit upgrade` adds no index row for it.
|
|
443
|
+
*/
|
|
444
|
+
const COMPONENTS_DOC = "components";
|
|
445
|
+
const COMPONENTS_DOC_PATH = `docs/${COMPONENTS_DOC}.md`;
|
|
446
|
+
|
|
447
|
+
type StarterName = ProjectDocTopic | typeof COMPONENTS_DOC;
|
|
448
|
+
|
|
449
|
+
/** How every hand-filled starter's introduction opens. A filled document no longer has it. */
|
|
450
|
+
const STARTER_OPENER = "> Starter document.";
|
|
451
|
+
|
|
452
|
+
/** Text of a starter: the package copy first, then the consumer's own copy. */
|
|
453
|
+
function readStarterText(cwd: string, name: StarterName): string | null {
|
|
454
|
+
const rel =
|
|
455
|
+
name === COMPONENTS_DOC ? `.bkit/templates/${COMPONENTS_DOC_PATH}` : starterPath(name);
|
|
456
|
+
for (const base of [getPkgRoot(), cwd]) {
|
|
457
|
+
const read = readTextFile(path.join(base, rel));
|
|
458
|
+
if (read.ok) return read.text;
|
|
459
|
+
}
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
type DocAssessment = "empty" | "unpopulated" | "candidate";
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Mechanical read of a project document: empty, an untouched starter, a document that still
|
|
467
|
+
* opens with the starter's introduction, headings only, or a candidate.
|
|
468
|
+
*/
|
|
469
|
+
function assessDocText(cwd: string, name: StarterName, text: string): DocAssessment {
|
|
470
|
+
if (text.trim() === "") return "empty";
|
|
471
|
+
const normalized = normalizeLegacyText(text);
|
|
472
|
+
const legacy = legacyStarterTopic(text);
|
|
473
|
+
if (legacy === name) return "unpopulated";
|
|
474
|
+
const starter = readStarterText(cwd, name);
|
|
475
|
+
if (starter !== null && normalizeLegacyText(starter) === normalized) return "unpopulated";
|
|
476
|
+
if (normalized.startsWith(STARTER_OPENER)) return "unpopulated";
|
|
477
|
+
// Headings, comments and rules only: nothing a project wrote.
|
|
478
|
+
const meaningful = normalized
|
|
479
|
+
.split("\n")
|
|
480
|
+
.map((l) => l.trim())
|
|
481
|
+
.filter(
|
|
482
|
+
(l) => l !== "" && !l.startsWith("#") && !/^<!--.*-->$/.test(l) && !/^[-*_|: ]+$/.test(l),
|
|
483
|
+
);
|
|
484
|
+
return meaningful.length === 0 ? "unpopulated" : "candidate";
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Report the state of the ten project documents (`docs/architecture.md` ... `docs/setup.md`):
|
|
489
|
+
* the index missing, a document absent, empty, an untouched starter, still opening with the
|
|
490
|
+
* starter's introduction, present but unindexed, or unreadable. A document the index lists at
|
|
491
|
+
* another path (same basename, or a Scope cell `Equivalent to docs/<topic>.md`) counts for its
|
|
492
|
+
* topic. `docs/components.md` is reported too when it is absent or unfilled. Findings are
|
|
493
|
+
* advisories only and read no file outside the repository. A document that differs from every
|
|
494
|
+
* starter is a candidate for the agent to assess; the mechanical read makes no claim about
|
|
495
|
+
* what it covers.
|
|
496
|
+
*/
|
|
497
|
+
export function detectProjectDocs(cwd: string): PreflightFinding[] {
|
|
498
|
+
const index = readProjectIndex(cwd);
|
|
499
|
+
const rows = index.status === "ok" ? index.rows : [];
|
|
500
|
+
const indexedPaths = new Set(rows.map((r) => r.path));
|
|
501
|
+
const missing: string[] = [];
|
|
502
|
+
const unpopulated: string[] = [];
|
|
503
|
+
const unindexed: string[] = [];
|
|
504
|
+
const unindexedWrapped: string[] = [];
|
|
505
|
+
const unindexedBlocked: string[] = [];
|
|
506
|
+
const duplicates: string[] = [];
|
|
507
|
+
const ambiguous: string[] = [];
|
|
508
|
+
const cleanup: string[] = [];
|
|
509
|
+
|
|
510
|
+
const componentsState = inspectRepoFile(cwd, COMPONENTS_DOC_PATH);
|
|
511
|
+
if (componentsState === "absent") missing.push(COMPONENTS_DOC_PATH);
|
|
512
|
+
else if (componentsState !== "regular") {
|
|
513
|
+
ambiguous.push(`${COMPONENTS_DOC_PATH} (${componentsState.unsafe})`);
|
|
514
|
+
} else {
|
|
515
|
+
const read = readTextFile(path.join(cwd, COMPONENTS_DOC_PATH));
|
|
516
|
+
if (!read.ok) ambiguous.push(`${COMPONENTS_DOC_PATH} (it could not be read)`);
|
|
517
|
+
else if (assessDocText(cwd, COMPONENTS_DOC, read.text) !== "candidate") {
|
|
518
|
+
unpopulated.push(COMPONENTS_DOC_PATH);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
for (const topic of PROJECT_DOC_TOPICS) {
|
|
523
|
+
const recommended = projectDocPath(topic);
|
|
524
|
+
const isUsableRow = (row: string) =>
|
|
525
|
+
isInTreePath(row) && inspectRepoFile(cwd, row) === "regular";
|
|
526
|
+
// The first valid same-topic row wins; when none is valid every candidate row is named.
|
|
527
|
+
const equivalent = findIndexedEquivalent(rows, topic, isUsableRow);
|
|
528
|
+
const candidates = listIndexedEquivalents(rows, topic);
|
|
529
|
+
const defaultState = inspectRepoFile(cwd, recommended);
|
|
530
|
+
let target = recommended;
|
|
531
|
+
if (defaultState === "absent") {
|
|
532
|
+
if (equivalent === null) {
|
|
533
|
+
if (candidates.length > 0) {
|
|
534
|
+
ambiguous.push(
|
|
535
|
+
`${candidates.join(", ")} (${recommended}: every indexed row for it is unusable)`,
|
|
536
|
+
);
|
|
537
|
+
} else {
|
|
538
|
+
missing.push(recommended);
|
|
539
|
+
}
|
|
540
|
+
continue;
|
|
541
|
+
}
|
|
542
|
+
target = equivalent;
|
|
543
|
+
}
|
|
544
|
+
if (!isInTreePath(target)) {
|
|
545
|
+
ambiguous.push(`${target} (${recommended}: it resolves outside the repository)`);
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
const state = target === recommended ? defaultState : inspectRepoFile(cwd, target);
|
|
549
|
+
if (state === "absent") {
|
|
550
|
+
missing.push(recommended);
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
if (state !== "regular") {
|
|
554
|
+
ambiguous.push(`${target} (${state.unsafe})`);
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
const read = readTextFile(path.join(cwd, target));
|
|
558
|
+
if (!read.ok) {
|
|
559
|
+
ambiguous.push(`${target} (it could not be read)`);
|
|
560
|
+
continue;
|
|
561
|
+
}
|
|
562
|
+
const wrapper = stripManagedWrapper(read.text);
|
|
563
|
+
if (wrapper.status === "ambiguous") cleanup.push(`${target} (${wrapper.problem})`);
|
|
564
|
+
const assessed = assessDocText(cwd, topic, read.text);
|
|
565
|
+
if (assessed === "empty" || assessed === "unpopulated") unpopulated.push(target);
|
|
566
|
+
else if (index.status === "ok" && !indexedPaths.has(target)) {
|
|
567
|
+
const covering = findIndexedEquivalent(
|
|
568
|
+
rows,
|
|
569
|
+
topic,
|
|
570
|
+
(row) => isInTreePath(row) && inspectRepoFile(cwd, row) === "regular",
|
|
571
|
+
);
|
|
572
|
+
if (covering !== null && target === recommended)
|
|
573
|
+
duplicates.push(`${target} (beside ${covering})`);
|
|
574
|
+
else if (wrapper.status === "ambiguous") unindexedWrapped.push(target);
|
|
575
|
+
else if ((index.unparsed ?? []).length > 0) unindexedBlocked.push(target);
|
|
576
|
+
else unindexed.push(target);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
const findings: PreflightFinding[] = [];
|
|
581
|
+
if (index.status === "missing") {
|
|
582
|
+
findings.push({
|
|
583
|
+
id: "project-docs-index-missing",
|
|
584
|
+
severity: "advisory",
|
|
585
|
+
detect: `${PROJECT_INDEX_PATH} is absent, so agents have no list of the project's own documents to consult.`,
|
|
586
|
+
action: `Run \`bkit install\` to write ${PROJECT_INDEX_PATH}, then add a row under \`## Project Documents\` for each project document you keep. Until then agents warn and fall back to repository evidence.`,
|
|
587
|
+
});
|
|
588
|
+
} else if (index.status === "unreadable") {
|
|
589
|
+
ambiguous.push(`${PROJECT_INDEX_PATH} (${index.reason})`);
|
|
590
|
+
} else {
|
|
591
|
+
for (const row of index.unparsed ?? []) {
|
|
592
|
+
ambiguous.push(`${PROJECT_INDEX_PATH} (unreadable table row: ${row.slice(0, 80)})`);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
if (missing.length > 0) {
|
|
596
|
+
findings.push({
|
|
597
|
+
id: "project-docs-missing",
|
|
598
|
+
severity: "advisory",
|
|
599
|
+
detect: `No project document covers: ${missing.join(", ")}.`,
|
|
600
|
+
action: `Copy the starter for each topic you want from \`.bkit/templates/docs/\` into \`docs/\`, fill it in from the repository, and add its row to \`## Project Documents\` in ${PROJECT_INDEX_PATH}. A document you already keep elsewhere counts: index it with \`Equivalent to <recommended path>\` in its Scope cell. Skip topics that do not apply. Fill the docs in the order of .bkit/templates.md § Project docs — adoption order.`,
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
if (unpopulated.length > 0) {
|
|
604
|
+
findings.push({
|
|
605
|
+
id: "project-docs-unpopulated",
|
|
606
|
+
severity: "advisory",
|
|
607
|
+
detect: `These project documents are empty, still hold only the shipped starter text, or still open with the starter's introduction: ${unpopulated.join(", ")}.`,
|
|
608
|
+
action: `Replace the placeholders in ${unpopulated.join(", ")} with project facts taken from the repository, then delete the introduction above the title. Or index an equivalent document that already holds the facts (\`Equivalent to <recommended path>\` in the Scope cell of ${PROJECT_INDEX_PATH}). Agents warn about these topics until the text changes. Fill the docs in the order of .bkit/templates.md § Project docs — adoption order.`,
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
if (unindexed.length > 0) {
|
|
612
|
+
findings.push({
|
|
613
|
+
id: "project-docs-unindexed",
|
|
614
|
+
severity: "advisory",
|
|
615
|
+
detect: `These project documents exist but ${PROJECT_INDEX_PATH} does not list them: ${unindexed.join(", ")}.`,
|
|
616
|
+
action: `Add a row for each to \`## Project Documents\` in ${PROJECT_INDEX_PATH}, or run \`bkit upgrade\` to register the default paths.`,
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
if (unindexedWrapped.length > 0) {
|
|
620
|
+
findings.push({
|
|
621
|
+
id: "project-docs-unindexed",
|
|
622
|
+
severity: "advisory",
|
|
623
|
+
detect: `These project documents exist but ${PROJECT_INDEX_PATH} does not list them, and bkit will not register them while their ownership wrapper stays: ${unindexedWrapped.join(", ")}.`,
|
|
624
|
+
action: `Remove the wrapper as the cleanup advisory describes, then add a row for each to \`## Project Documents\` in ${PROJECT_INDEX_PATH} (or run \`bkit upgrade\` once the wrapper is gone).`,
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
if (unindexedBlocked.length > 0) {
|
|
628
|
+
findings.push({
|
|
629
|
+
id: "project-docs-unindexed",
|
|
630
|
+
severity: "advisory",
|
|
631
|
+
detect: `These project documents exist but ${PROJECT_INDEX_PATH} does not list them, and bkit will not register them while a row of \`## Project Documents\` is unreadable: ${unindexedBlocked.join(", ")}.`,
|
|
632
|
+
action: `Repair or remove the unreadable row named in the ambiguous advisory, then add a row for each to \`## Project Documents\` in ${PROJECT_INDEX_PATH} (or run \`bkit upgrade\` once the row is repaired).`,
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
if (duplicates.length > 0) {
|
|
636
|
+
findings.push({
|
|
637
|
+
id: "project-docs-unindexed",
|
|
638
|
+
severity: "advisory",
|
|
639
|
+
detect: `These project documents exist but ${PROJECT_INDEX_PATH} lists another document for the same topic: ${duplicates.join(", ")}.`,
|
|
640
|
+
action: `bkit does not register them while the other document is indexed. Keep one: delete the unused file, or add a row for the second one by hand under \`## Project Documents\` in ${PROJECT_INDEX_PATH}.`,
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
if (cleanup.length > 0) {
|
|
644
|
+
findings.push({
|
|
645
|
+
id: "project-docs-cleanup",
|
|
646
|
+
severity: "advisory",
|
|
647
|
+
detect: `These project documents still carry a bkit ownership wrapper (\`<!-- bkit:start -->\` / \`<!-- bkit:end -->\` lines or the \`bkit:managed\` notice) that bkit could not remove safely: ${cleanup.join("; ")}.`,
|
|
648
|
+
action: `Edit each file by hand: delete the \`<!-- bkit:start -->\` and \`<!-- bkit:end -->\` lines and the \`bkit:managed\` notice line, keeping the text between them. These documents belong to the project now; bkit changes none of them itself.`,
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
if (ambiguous.length > 0) {
|
|
652
|
+
findings.push({
|
|
653
|
+
id: "project-docs-ambiguous",
|
|
654
|
+
severity: "advisory",
|
|
655
|
+
detect: `bkit did not read these project documents or the index: ${ambiguous.join("; ")}.`,
|
|
656
|
+
action: `Replace each with a regular file inside the repository (no symbolic link, no \`..\` path), or repair the \`## Project Documents\` table in ${PROJECT_INDEX_PATH}. bkit changes none of them itself.`,
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
return findings;
|
|
661
|
+
}
|
|
@@ -7,7 +7,7 @@ import { deepContains, type JsonValue } from "../../install/write.js";
|
|
|
7
7
|
import { extractManagedBlock, stripManagedBlock } from "../../install/managed-block.js";
|
|
8
8
|
import { readTemplate } from "../../render/parts.js";
|
|
9
9
|
import { findTemplateSource, getPkgRoot } from "../../shared/package-roots.js";
|
|
10
|
-
import { parseJson } from "../../shared/json.js";
|
|
10
|
+
import { parseJson, readJsonFile } from "../../shared/json.js";
|
|
11
11
|
import { ciWorkflowPath } from "../../shared/settings.js";
|
|
12
12
|
import type { PreflightFinding } from "./index.js";
|
|
13
13
|
|
|
@@ -107,6 +107,64 @@ export function detectPlaywrightReporterHostile(cwd: string): PreflightFinding |
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
const OPENCODE_JSON_REL = path.join(".opencode", "opencode.json");
|
|
111
|
+
|
|
112
|
+
/** True for a `permission.bash` key of the legacy generated shape `curl *{host}*` / `wget *{host}*`. */
|
|
113
|
+
export function isOpencodeSubstringFetchKey(key: string): boolean {
|
|
114
|
+
return /^(curl|wget) \*[^*\s]+\*$/.test(key);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Drop URL user-info and query / fragment text from a permission key before it is printed. */
|
|
118
|
+
export function redactUrlParts(text: string): string {
|
|
119
|
+
return text.replace(/[^/@\s*]+@/g, "").replace(/[?#][^*\s]*/g, "?…");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Advisory: `.opencode/opencode.json` `permission.bash` holds substring `curl` / `wget`
|
|
124
|
+
* allows that an earlier bkit install generated. No per-entry ownership record exists, so
|
|
125
|
+
* they are reported for owner review and never removed. Reads only; never writes.
|
|
126
|
+
*/
|
|
127
|
+
export function detectOpencodeSubstringFetchGrants(cwd: string): PreflightFinding | null {
|
|
128
|
+
const read = readJsonFile(path.join(cwd, OPENCODE_JSON_REL));
|
|
129
|
+
if (!read.ok) return null;
|
|
130
|
+
const root = read.value as { permission?: unknown } | null;
|
|
131
|
+
const permission = root && typeof root === "object" ? root.permission : undefined;
|
|
132
|
+
if (!permission || typeof permission !== "object") return null;
|
|
133
|
+
const bash = (permission as { bash?: unknown }).bash;
|
|
134
|
+
if (!bash || typeof bash !== "object" || Array.isArray(bash)) return null;
|
|
135
|
+
const keys = Object.entries(bash as Record<string, unknown>)
|
|
136
|
+
.filter(([k, v]) => v === "allow" && isOpencodeSubstringFetchKey(k))
|
|
137
|
+
.map(([k]) => redactUrlParts(k));
|
|
138
|
+
if (keys.length === 0) return null;
|
|
139
|
+
return {
|
|
140
|
+
id: "opencode-substring-fetch-grants",
|
|
141
|
+
severity: "advisory",
|
|
142
|
+
detect: `${OPENCODE_JSON_REL} \`permission.bash\` holds substring fetch allows (${keys.map((k) => `\`${k}\``).join(", ")}). A glob over the command string also matches the host inside a query string or user-info part, so \`curl https://evil.example/?x=host\` runs without a prompt.`,
|
|
143
|
+
action: `Review each entry. If you did not add it, remove it from \`permission.bash\` in ${OPENCODE_JSON_REL}; shell \`curl\` / \`wget\` then fall back to the \`curl *\` / \`wget *\` ask. bkit no longer writes these entries and never removes them for you.`,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const CLOUD_BOOTSTRAP_REL = ".claude/hooks/bkit-cloud-bootstrap.sh";
|
|
148
|
+
const CLOUD_BOOTSTRAP_TEMPLATE_REL = ".bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh";
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Advisory: an adopted `.claude/hooks/bkit-cloud-bootstrap.sh` never reads
|
|
152
|
+
* `BKIT_CLOUD_ALLOWLIST_FINGERPRINT`, so a stale cloud network allowlist goes unwarned.
|
|
153
|
+
* Matches the variable name, never byte identity, so a customised bootstrap that compares
|
|
154
|
+
* the variable its own way is accepted. Silent when no bootstrap is adopted. Reads only.
|
|
155
|
+
*/
|
|
156
|
+
export function detectCloudBootstrapFingerprintMissing(cwd: string): PreflightFinding | null {
|
|
157
|
+
const abs = path.join(cwd, CLOUD_BOOTSTRAP_REL);
|
|
158
|
+
if (!fs.existsSync(abs)) return null;
|
|
159
|
+
if (fs.readFileSync(abs, "utf-8").includes("BKIT_CLOUD_ALLOWLIST_FINGERPRINT")) return null;
|
|
160
|
+
return {
|
|
161
|
+
id: "cloud-bootstrap-fingerprint-missing",
|
|
162
|
+
severity: "advisory",
|
|
163
|
+
detect: `${CLOUD_BOOTSTRAP_REL} never reads \`BKIT_CLOUD_ALLOWLIST_FINGERPRINT\`, so a cloud session cannot warn when the network allowlist pasted into the cloud dashboard is stale.`,
|
|
164
|
+
action: `Copy the fingerprint block (the \`EXPECTED_FP\` section after the workspace-trust check) from ${CLOUD_BOOTSTRAP_TEMPLATE_REL} into ${CLOUD_BOOTSTRAP_REL}, or compare \`BKIT_CLOUD_ALLOWLIST_FINGERPRINT\` with the \`fingerprint\` in \`.bkit/allowlist.json\` your own way. Then set the variable in the cloud environment to the fingerprint printed in \`.claude/bkit-cloud.md\` § Network access.`,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
110
168
|
/**
|
|
111
169
|
* Advisory: detect when a JSON file is missing content the template owns.
|
|
112
170
|
* Runs deepContains(template, consumerFile) — fires when ok=false.
|
|
@@ -31,6 +31,8 @@ import {
|
|
|
31
31
|
MARKERED_TEXT_DRIFT_PATHS,
|
|
32
32
|
detectGitignoreBlockDuplicates,
|
|
33
33
|
detectPlaywrightReporterHostile,
|
|
34
|
+
detectOpencodeSubstringFetchGrants,
|
|
35
|
+
detectCloudBootstrapFingerprintMissing,
|
|
34
36
|
detectTier2JsonDrift,
|
|
35
37
|
detectTier2TextDrift,
|
|
36
38
|
} from "./files.js";
|
|
@@ -154,6 +156,12 @@ export function runPreflight(
|
|
|
154
156
|
const playwrightReporterHostile = detectPlaywrightReporterHostile(cwd);
|
|
155
157
|
if (playwrightReporterHostile) advisories.push(playwrightReporterHostile);
|
|
156
158
|
|
|
159
|
+
const opencodeSubstringGrants = detectOpencodeSubstringFetchGrants(cwd);
|
|
160
|
+
if (opencodeSubstringGrants) advisories.push(opencodeSubstringGrants);
|
|
161
|
+
|
|
162
|
+
const cloudBootstrapFingerprint = detectCloudBootstrapFingerprintMissing(cwd);
|
|
163
|
+
if (cloudBootstrapFingerprint) advisories.push(cloudBootstrapFingerprint);
|
|
164
|
+
|
|
157
165
|
const contextFetch = detectContextFetchMissing(cwd);
|
|
158
166
|
if (contextFetch) advisories.push(contextFetch);
|
|
159
167
|
|
|
@@ -12,12 +12,10 @@
|
|
|
12
12
|
// Path-conditional expectations:
|
|
13
13
|
// - Path A (dev is ancestor): skips ship-conflict-resolve.
|
|
14
14
|
// - Path B (dev moved): includes ship-conflict-resolve.
|
|
15
|
-
// - MERGED-on-entry (Step 2 detects state=MERGED → Step
|
|
15
|
+
// - MERGED-on-entry (Step 2 detects state=MERGED → Step 11): skips the entire
|
|
16
16
|
// middle (base check, integrate, deferred-sweep, the pre-merge docs /
|
|
17
17
|
// summary / prune / bookkeeping-push steps, merge-pr).
|
|
18
18
|
// - Aborted (workflow-failed row present): no post-abort holes expected.
|
|
19
|
-
// - ship-failure-diagnose / ship-failure-remediate are NEVER mandatory — they
|
|
20
|
-
// appear only in the merge-retry loop.
|
|
21
19
|
//
|
|
22
20
|
// Usage (advisory CI step or manual):
|
|
23
21
|
// npx tsx .bkit/core/engine/checks/status-holes.ts <status.jsonl>...
|
|
@@ -53,22 +51,17 @@ export const SHIP_STEP_ORDER = [
|
|
|
53
51
|
"ship-prune-skills",
|
|
54
52
|
"ship-bookkeeping-push",
|
|
55
53
|
"ship-merge-pr",
|
|
56
|
-
"ship-failure-diagnose",
|
|
57
|
-
"ship-failure-remediate",
|
|
58
54
|
"ship-switch-to-dev",
|
|
59
55
|
"ship-close-workflow",
|
|
60
56
|
] as const;
|
|
61
57
|
|
|
62
|
-
/** Steps that appear only in the merge-retry loop — never mandatory, never holes. */
|
|
63
|
-
const RETRY_LOOP_STEPS = new Set<string>(["ship-failure-diagnose", "ship-failure-remediate"]);
|
|
64
|
-
|
|
65
58
|
/** The step that Path A skips (dev is ancestor → no integration needed). */
|
|
66
59
|
const PATH_B_ONLY_STEPS = new Set<string>(["ship-conflict-resolve"]);
|
|
67
60
|
|
|
68
61
|
/**
|
|
69
62
|
* The steps a MERGED-on-entry resume skips entirely.
|
|
70
63
|
*
|
|
71
|
-
* bkit-ship.md Step 2 routes to Step
|
|
64
|
+
* bkit-ship.md Step 2 routes to Step 11 at sub-step 5 (`state` = MERGED), which
|
|
72
65
|
* is BEFORE sub-step 8 writes `ship-worktree-setup` + `ship-regression-guard` —
|
|
73
66
|
* so those two are absent too, not just the middle. The pre-merge docs,
|
|
74
67
|
* summary, prune and bookkeeping-push steps (6-8) ride the PR, so a PR that is
|
|
@@ -84,7 +77,6 @@ const MERGED_ON_ENTRY_SKIP = new Set<string>([
|
|
|
84
77
|
"ship-prune-skills",
|
|
85
78
|
"ship-bookkeeping-push",
|
|
86
79
|
"ship-merge-pr",
|
|
87
|
-
// failure-diagnose/remediate are already in RETRY_LOOP_STEPS (never expected)
|
|
88
80
|
]);
|
|
89
81
|
|
|
90
82
|
// ---------------------------------------------------------------------------
|
|
@@ -176,10 +168,13 @@ export interface Contract {
|
|
|
176
168
|
|
|
177
169
|
/**
|
|
178
170
|
* Step rows an engine verb writes itself, keyed by noun + verb: `tests red` writes the
|
|
179
|
-
* `RED_STEP` row of `commands/workflow/tests.ts` inside build Step 7
|
|
171
|
+
* `RED_STEP` row of `commands/workflow/tests.ts` inside build Step 7, and a code step's
|
|
172
|
+
* `steps finish` the `TAKEOVER_STEP` row when its change contradicts a ticked task's test.
|
|
173
|
+
* Only keys with the workflow's own prefix count, so `steps finish` adds nothing elsewhere.
|
|
180
174
|
*/
|
|
181
175
|
const VERB_ROWS: Readonly<Record<string, readonly string[]>> = {
|
|
182
176
|
"tests red": ["build-tests-red"],
|
|
177
|
+
"steps finish": ["build-takeover"],
|
|
183
178
|
};
|
|
184
179
|
// A step that reads a verb row (`counters derive --step=build-tests-red`) does not own it.
|
|
185
180
|
const VERB_ROW_KEYS: ReadonlySet<string> = new Set(Object.values(VERB_ROWS).flat());
|
|
@@ -344,9 +339,12 @@ function stepWrites(text: string): string[] {
|
|
|
344
339
|
return [...new Set(found)];
|
|
345
340
|
}
|
|
346
341
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
]
|
|
342
|
+
// `{key}-fix` beside `{key}` is the label a fix agent's gate run puts on its test-run rows
|
|
343
|
+
// (`build-holistic-gate-fix`), not a row key: no step writes a step row under it.
|
|
344
|
+
const stepKeys = (text: string): string[] => {
|
|
345
|
+
const keys = new Set([...text.matchAll(STEP_KEY_RE)].filter((m) => !m[2]).map((m) => m[1]!));
|
|
346
|
+
return [...keys].filter((k) => !(k.endsWith("-fix") && keys.has(k.slice(0, -"-fix".length))));
|
|
347
|
+
};
|
|
350
348
|
|
|
351
349
|
/** A step is conditional under a column-0 marker line anywhere in its section, or a `(Path X only)` heading. */
|
|
352
350
|
export function isConditionalSection(body: string): boolean {
|
|
@@ -967,20 +965,16 @@ export function computeMandatoryForPath(path: RunPath, sourceUniverse: string[])
|
|
|
967
965
|
|
|
968
966
|
switch (path) {
|
|
969
967
|
case "PATH_A":
|
|
970
|
-
// Skip conflict-resolve
|
|
971
|
-
return new Set(
|
|
972
|
-
[...universe].filter((s) => !PATH_B_ONLY_STEPS.has(s) && !RETRY_LOOP_STEPS.has(s)),
|
|
973
|
-
);
|
|
968
|
+
// Skip conflict-resolve
|
|
969
|
+
return new Set([...universe].filter((s) => !PATH_B_ONLY_STEPS.has(s)));
|
|
974
970
|
|
|
975
971
|
case "PATH_B":
|
|
976
|
-
// Include conflict-resolve
|
|
977
|
-
return new Set(
|
|
972
|
+
// Include conflict-resolve
|
|
973
|
+
return new Set(universe);
|
|
978
974
|
|
|
979
975
|
case "MERGED_ON_ENTRY":
|
|
980
|
-
// Skip the entire middle
|
|
981
|
-
return new Set(
|
|
982
|
-
[...universe].filter((s) => !MERGED_ON_ENTRY_SKIP.has(s) && !RETRY_LOOP_STEPS.has(s)),
|
|
983
|
-
);
|
|
976
|
+
// Skip the entire middle
|
|
977
|
+
return new Set([...universe].filter((s) => !MERGED_ON_ENTRY_SKIP.has(s)));
|
|
984
978
|
|
|
985
979
|
case "COMPLETED":
|
|
986
980
|
// Non-ship runs derive their mandatory set from the contract (auditRun)
|
|
@@ -1029,8 +1023,8 @@ export function detectHoles(
|
|
|
1029
1023
|
if (lastObservedIdx < 0) return { missing: [], unexpected };
|
|
1030
1024
|
|
|
1031
1025
|
// For aborted runs, expected = everything before the last step, minus
|
|
1032
|
-
//
|
|
1033
|
-
const skipSet = new Set<string>(
|
|
1026
|
+
// conflict-resolve (unless it was observed)
|
|
1027
|
+
const skipSet = new Set<string>();
|
|
1034
1028
|
if (!observed.has("ship-conflict-resolve")) skipSet.add("ship-conflict-resolve");
|
|
1035
1029
|
|
|
1036
1030
|
const missing: string[] = [];
|