@cbartens/bkit 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.bkit/README.md +14 -12
- package/.bkit/core/.agents/docs.md +1 -11
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-gateguard.cjs +30 -9
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +25 -27
- package/.bkit/core/.agents/rules.md +22 -9
- package/.bkit/core/.bkit/README.md +13 -11
- package/.bkit/core/.bkit/authoring.md +58 -13
- package/.bkit/core/.bkit/cli.md +43 -33
- package/.bkit/core/.bkit/cloud.md +93 -30
- package/.bkit/core/.bkit/install.md +55 -16
- package/.bkit/core/.bkit/jsonl.md +24 -7
- package/.bkit/core/.bkit/pipeline.md +8 -8
- package/.bkit/core/.bkit/prompts.md +160 -43
- package/.bkit/core/.bkit/providers.md +99 -36
- package/.bkit/core/.bkit/templates.md +167 -37
- package/.bkit/core/.bkit/trackers.md +39 -6
- package/.bkit/core/.bkit/workflows.md +344 -136
- package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +50 -27
- package/.bkit/core/.claude/hooks/bkit-preflight.sh +11 -11
- package/.bkit/core/.codex/hooks/bkit-gateguard.cjs +13 -8
- package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +14 -25
- package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +20 -9
- package/.bkit/core/.cursor/hooks/bkit-preflight.sh +8 -8
- package/.bkit/core/.opencode/plugin/bkit-gateguard.js +14 -4
- package/.bkit/core/.opencode/plugin/bkit-guardrails.js +114 -0
- package/.bkit/core/docs/templates/bkit-audit-accessibility.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-adoption.md +30 -6
- package/.bkit/core/docs/templates/bkit-audit-agents.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-analytics.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-annotations.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-app-performance.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-app-store.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-architecture.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-config.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-cost.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-coverage.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-database.md +3 -3
- package/.bkit/core/docs/templates/bkit-audit-dead-code.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-deferrals.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-dependencies.md +3 -3
- package/.bkit/core/docs/templates/bkit-audit-documentation.md +32 -2
- package/.bkit/core/docs/templates/bkit-audit-duplication.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-failures.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-flakes.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-gates.md +5 -3
- package/.bkit/core/docs/templates/bkit-audit-issues.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-llm.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-logs.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-models.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-privacy.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-prompts.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-red-team.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-reliability.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-repo.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-security.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-slop.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-testing.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-usability.md +1 -1
- package/.bkit/core/docs/templates/bkit-plan.md +38 -8
- package/.bkit/core/engine/checks/after/auth.ts +118 -47
- package/.bkit/core/engine/checks/after/github.ts +161 -37
- package/.bkit/core/engine/checks/after/index.ts +18 -3
- package/.bkit/core/engine/checks/after/tools.ts +245 -1
- package/.bkit/core/engine/checks/before/files.ts +59 -1
- package/.bkit/core/engine/checks/before/index.ts +8 -0
- package/.bkit/core/engine/checks/status-holes.ts +20 -26
- package/.bkit/core/engine/checks/tips/catalogue.ts +107 -10
- package/.bkit/core/engine/checks/tips/detect.ts +36 -3
- package/.bkit/core/engine/checks/tips/index.ts +1 -1
- package/.bkit/core/engine/cli.ts +13 -13
- package/.bkit/core/engine/commands/ci/ci.ts +124 -19
- package/.bkit/core/engine/commands/ci/push-gate.ts +101 -43
- package/.bkit/core/engine/commands/install/doctor.ts +5 -5
- package/.bkit/core/engine/commands/install/install.ts +28 -25
- package/.bkit/core/engine/commands/install/uninstall.ts +42 -30
- package/.bkit/core/engine/commands/install/upgrade.ts +14 -2
- package/.bkit/core/engine/commands/land.ts +2 -3
- package/.bkit/core/engine/commands/lib.ts +394 -39
- package/.bkit/core/engine/commands/registry.ts +1 -1
- package/.bkit/core/engine/commands/workflow/branches.ts +351 -78
- package/.bkit/core/engine/commands/workflow/challenge.ts +63 -14
- package/.bkit/core/engine/commands/workflow/context.ts +71 -10
- package/.bkit/core/engine/commands/workflow/counters.ts +298 -23
- package/.bkit/core/engine/commands/workflow/decisions.ts +260 -125
- package/.bkit/core/engine/commands/workflow/disk.ts +2 -1
- package/.bkit/core/engine/commands/workflow/feature-base.ts +66 -0
- package/.bkit/core/engine/commands/workflow/issues.ts +312 -17
- package/.bkit/core/engine/commands/workflow/junit.ts +204 -0
- package/.bkit/core/engine/commands/workflow/ledgers.ts +904 -99
- package/.bkit/core/engine/commands/workflow/locks.ts +186 -29
- package/.bkit/core/engine/commands/workflow/loops.ts +87 -0
- package/.bkit/core/engine/commands/workflow/open-decision.ts +251 -0
- package/.bkit/core/engine/commands/workflow/plan-blocks.ts +8 -0
- package/.bkit/core/engine/commands/workflow/plans.ts +1 -1
- package/.bkit/core/engine/commands/workflow/prs.ts +311 -16
- package/.bkit/core/engine/commands/workflow/repo.ts +1 -1
- package/.bkit/core/engine/commands/workflow/run-facts.ts +6 -0
- package/.bkit/core/engine/commands/workflow/runs.ts +877 -174
- package/.bkit/core/engine/commands/workflow/runtime.ts +12 -4
- package/.bkit/core/engine/commands/workflow/status.ts +324 -11
- package/.bkit/core/engine/commands/workflow/step-table.ts +41 -15
- package/.bkit/core/engine/commands/workflow/steps.ts +604 -29
- package/.bkit/core/engine/commands/workflow/summary-findings.ts +1 -1
- package/.bkit/core/engine/commands/workflow/summary.ts +314 -8
- package/.bkit/core/engine/commands/workflow/tasks.ts +400 -27
- package/.bkit/core/engine/commands/workflow/tests-base.ts +319 -0
- package/.bkit/core/engine/commands/workflow/tests-changed.ts +138 -74
- package/.bkit/core/engine/commands/workflow/tests-jump.ts +93 -0
- package/.bkit/core/engine/commands/workflow/tests.ts +815 -182
- package/.bkit/core/engine/commands/workflow/tracker.ts +1134 -137
- package/.bkit/core/engine/commands/workflow/workflows.ts +100 -72
- package/.bkit/core/engine/commands/workflow/worktrees.ts +421 -57
- package/.bkit/core/engine/install/cloud-env.ts +38 -10
- package/.bkit/core/engine/install/managed-block.ts +105 -0
- package/.bkit/core/engine/install/manifest.ts +7 -1
- package/.bkit/core/engine/install/modules/claude.ts +6 -2
- package/.bkit/core/engine/install/modules/cloud.ts +84 -95
- package/.bkit/core/engine/install/modules/codex.ts +10 -2
- package/.bkit/core/engine/install/modules/core.ts +202 -26
- package/.bkit/core/engine/install/modules/opencode.ts +18 -23
- package/.bkit/core/engine/install/network-allowlist.ts +8 -3
- package/.bkit/core/engine/install/project-docs.ts +650 -0
- package/.bkit/core/engine/install/template-copies.ts +58 -5
- package/.bkit/core/engine/install/write.ts +128 -7
- package/.bkit/core/engine/ledgers/journal.ts +18 -10
- package/.bkit/core/engine/ledgers/migrate.ts +20 -8
- package/.bkit/core/engine/ledgers/status.ts +604 -8
- package/.bkit/core/engine/ledgers/telemetry.ts +115 -13
- package/.bkit/core/engine/render/trackers.ts +46 -11
- package/.bkit/core/engine/shared/package-manager.ts +7 -3
- package/.bkit/core/engine/shared/settings.ts +12 -1
- package/.bkit/core/engine/shared/text.ts +14 -0
- package/.bkit/core/engine/tools/instructions-sources.ts +1 -0
- package/.bkit/core/engine/tools/instructions.ts +116 -20
- package/.bkit/core/hooks/antigravity-hook.js +20 -4
- package/.bkit/core/hooks/gateguard-edit-payload.js +8 -5
- package/.bkit/core/hooks/gateguard-engine.js +249 -23
- package/.bkit/core/hooks/guardrails-deny.js +167 -0
- package/.bkit/core/hooks/guardrails-read.js +3 -3
- package/.bkit/core/hooks/guardrails-shell.js +1122 -167
- package/.bkit/core/hooks/guardrails-tiers.js +247 -176
- package/.bkit/core/hooks/preflight-tracker.sh +219 -0
- package/.bkit/core/prompts/bkit-audit-generate.md +23 -6
- package/.bkit/core/prompts/bkit-build-challenge-1.md +5 -4
- package/.bkit/core/prompts/bkit-build-challenge-2.md +6 -5
- package/.bkit/core/prompts/bkit-build-install-skills.md +2 -2
- package/.bkit/core/prompts/bkit-build-plan-convert.md +21 -7
- package/.bkit/core/prompts/bkit-build-plan-current.md +5 -4
- package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +22 -17
- package/.bkit/core/prompts/bkit-build-plan-tasks.md +16 -12
- package/.bkit/core/prompts/bkit-build-plan-tests.md +14 -10
- package/.bkit/core/prompts/bkit-build-plan-verify.md +21 -8
- package/.bkit/core/prompts/bkit-debug-abort-handover.md +10 -5
- package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +22 -6
- package/.bkit/core/prompts/bkit-debug-failure-remediate.md +19 -3
- package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +22 -6
- package/.bkit/core/prompts/bkit-debug-failure-soak.md +10 -7
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +3 -3
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +4 -4
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +3 -3
- package/.bkit/core/prompts/bkit-design-generate.md +6 -4
- package/.bkit/core/prompts/bkit-design-organise.md +4 -3
- package/.bkit/core/prompts/bkit-design-review-1.md +5 -4
- package/.bkit/core/prompts/bkit-design-review-2.md +6 -5
- package/.bkit/core/prompts/bkit-design-spike.md +4 -3
- package/.bkit/core/prompts/bkit-design-update.md +6 -4
- package/.bkit/core/prompts/bkit-plan-generate.md +35 -14
- package/.bkit/core/prompts/bkit-plan-review-1.md +9 -7
- package/.bkit/core/prompts/bkit-plan-review-2.md +9 -7
- package/.bkit/core/prompts/bkit-plan-scope-check.md +8 -6
- package/.bkit/core/prompts/bkit-plan-update.md +22 -8
- package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +11 -8
- package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +9 -5
- package/.bkit/core/prompts/bkit-ship-update-docs.md +26 -4
- package/.bkit/core/prompts/bkit-utility-compress-markdown.md +3 -3
- package/.bkit/core/prompts/bkit-utility-update-decisions.md +10 -7
- package/.bkit/core/prompts/bkit-utility-update-deferrals.md +8 -5
- package/.bkit/core/prompts/bkit-utility-update-documentation.md +31 -7
- package/.bkit/core/prompts/bkit-utility-update-failures.md +8 -5
- package/.bkit/core/prompts/bkit-utility-update-knowledge.md +10 -7
- package/.bkit/core/prompts/bkit-utility-update-roadmap.md +4 -4
- package/.bkit/core/prompts/bkit-utility-update-tracker.md +4 -4
- package/.bkit/core/workflows/bkit-auto.md +23 -11
- package/.bkit/core/workflows/bkit-build.md +331 -100
- package/.bkit/core/workflows/bkit-debug.md +135 -64
- package/.bkit/core/workflows/bkit-design.md +58 -32
- package/.bkit/core/workflows/bkit-plan.md +73 -45
- package/.bkit/core/workflows/bkit-ship.md +233 -167
- package/.bkit/shared/.agents/plugins/bkit/hooks.json +1 -1
- package/.bkit/shared/.bkit/.env.example +5 -0
- package/.bkit/shared/.claude/bkit-cloud.md +7 -7
- package/.bkit/shared/.claude/settings.json +5 -1
- package/.bkit/shared/.cursor/bkit-cloud.md +1 -1
- package/.bkit/shared/.cursor/hooks.json +1 -1
- package/.bkit/shared/.opencode/opencode.json +11 -2
- package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +27 -0
- package/.bkit/templates/.cursor/Dockerfile +7 -7
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-idea.yml +1 -1
- package/.bkit/templates/.github/dependabot.yml +5 -0
- package/.bkit/templates/.github/renovate.json5 +5 -3
- package/.bkit/templates/.github/workflows/bkit-ci.yml +11 -11
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +525 -161
- package/.bkit/templates/.github/workflows/bkit-renovate.yml +2 -2
- package/.bkit/templates/.husky/pre-push +123 -6
- package/.bkit/templates/context/bkit-serena.md +1 -1
- package/.bkit/templates/context/bkit-vercel.md +103 -59
- package/.bkit/templates/docs/architecture.md +98 -0
- package/.bkit/templates/docs/capabilities.md +33 -37
- package/.bkit/templates/docs/components.md +142 -0
- package/.bkit/templates/docs/data-schema.md +87 -0
- package/.bkit/{shared → templates}/docs/deployments.md +128 -142
- package/.bkit/templates/docs/design.md +117 -0
- package/.bkit/templates/docs/noise.md +54 -0
- package/.bkit/templates/docs/observability.md +99 -0
- package/.bkit/templates/docs/security.md +137 -0
- package/.bkit/templates/docs/setup.md +93 -0
- package/.bkit/templates/docs/technology.md +70 -0
- package/.bkit/{shared → templates}/docs/testing.md +200 -87
- package/.bkit/templates/scripts/ci/bkit-check-accepted-divergences.mjs +1 -6
- package/.bkit/templates/scripts/ci/bkit-machine-lock.sh +511 -103
- package/.bkit/templates/scripts/ci/bkit-test-awake.mjs +314 -28
- package/.bkit/templates/scripts/ci/bkit-test-awake.test.mjs +500 -1
- package/.bkit/templates/scripts/graphify/bkit-graphify-graphml.py +1 -1
- package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +91 -62
- package/.bkit/templates/scripts/graphify/bkit-graphify.sh +59 -11
- package/.bkit/templates/slop-scan.config.json +2 -0
- package/CHANGELOG.md +79 -0
- package/DETAILS.md +661 -0
- package/README.md +73 -604
- package/dist/checks/after/auth.js +114 -46
- package/dist/checks/after/github.js +138 -35
- package/dist/checks/after/index.js +16 -4
- package/dist/checks/after/tools.js +224 -1
- package/dist/checks/before/files.js +59 -1
- package/dist/checks/before/index.js +7 -1
- package/dist/checks/status-holes.js +20 -21
- package/dist/checks/tips/catalogue.js +99 -10
- package/dist/checks/tips/detect.js +35 -3
- package/dist/checks/tips/index.js +1 -1
- package/dist/cli.js +13 -13
- package/dist/commands/ci/ci.js +113 -20
- package/dist/commands/ci/push-gate.js +79 -44
- package/dist/commands/install/doctor.js +5 -5
- package/dist/commands/install/install.js +23 -22
- package/dist/commands/install/uninstall.js +36 -30
- package/dist/commands/install/upgrade.js +10 -2
- package/dist/commands/land.js +2 -3
- package/dist/commands/lib.js +323 -25
- package/dist/commands/workflow/branches.js +312 -72
- package/dist/commands/workflow/challenge.js +66 -13
- package/dist/commands/workflow/context.js +46 -10
- package/dist/commands/workflow/counters.js +231 -23
- package/dist/commands/workflow/decisions.js +221 -106
- package/dist/commands/workflow/disk.js +2 -1
- package/dist/commands/workflow/feature-base.js +60 -0
- package/dist/commands/workflow/issues.js +243 -15
- package/dist/commands/workflow/junit.js +137 -0
- package/dist/commands/workflow/ledgers.js +726 -112
- package/dist/commands/workflow/locks.js +150 -29
- package/dist/commands/workflow/loops.js +67 -0
- package/dist/commands/workflow/open-decision.js +199 -0
- package/dist/commands/workflow/plan-blocks.js +6 -0
- package/dist/commands/workflow/plans.js +1 -1
- package/dist/commands/workflow/prs.js +272 -16
- package/dist/commands/workflow/repo.js +1 -1
- package/dist/commands/workflow/run-facts.js +6 -0
- package/dist/commands/workflow/runs.js +747 -155
- package/dist/commands/workflow/runtime.js +8 -4
- package/dist/commands/workflow/status.js +259 -13
- package/dist/commands/workflow/step-table.js +41 -15
- package/dist/commands/workflow/steps.js +530 -26
- package/dist/commands/workflow/summary-findings.js +1 -1
- package/dist/commands/workflow/summary.js +289 -8
- package/dist/commands/workflow/tasks.js +294 -27
- package/dist/commands/workflow/tests-base.js +266 -0
- package/dist/commands/workflow/tests-changed.js +130 -56
- package/dist/commands/workflow/tests-jump.js +77 -0
- package/dist/commands/workflow/tests.js +608 -131
- package/dist/commands/workflow/tracker.js +920 -112
- package/dist/commands/workflow/workflows.js +80 -59
- package/dist/commands/workflow/worktrees.js +387 -58
- package/dist/install/cloud-env.js +32 -10
- package/dist/install/managed-block.js +101 -0
- package/dist/install/manifest.js +7 -1
- package/dist/install/modules/claude.js +6 -2
- package/dist/install/modules/cloud.js +73 -86
- package/dist/install/modules/codex.js +9 -2
- package/dist/install/modules/core.js +190 -27
- package/dist/install/modules/opencode.js +18 -23
- package/dist/install/network-allowlist.js +8 -3
- package/dist/install/project-docs.js +551 -0
- package/dist/install/template-copies.js +55 -5
- package/dist/install/write.js +117 -5
- package/dist/ledgers/journal.js +10 -8
- package/dist/ledgers/migrate.js +20 -9
- package/dist/ledgers/status.js +461 -8
- package/dist/ledgers/telemetry.js +71 -13
- package/dist/render/trackers.js +21 -12
- package/dist/shared/package-manager.js +7 -2
- package/dist/shared/settings.js +8 -0
- package/dist/shared/text.js +13 -0
- package/dist/tools/instructions-sources.js +1 -0
- package/dist/tools/instructions.js +97 -24
- package/package.json +23 -15
- package/.bkit/core/hooks/preflight-linear.sh +0 -73
- package/.bkit/shared/docs/architecture.md +0 -16
- package/.bkit/shared/docs/data-schema.md +0 -16
- package/.bkit/shared/docs/design.md +0 -38
- package/.bkit/shared/docs/noise.md +0 -20
- package/.bkit/shared/docs/observability.md +0 -22
- package/.bkit/shared/docs/security.md +0 -62
- package/.bkit/shared/docs/setup.md +0 -52
- package/.bkit/shared/docs/technology.md +0 -15
- /package/.bkit/templates/{.lintstagedrc.json → lintstagedrc.example.json} +0 -0
- /package/.bkit/templates/{.prettierignore → prettierignore.example} +0 -0
|
@@ -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[] = [];
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// Text rules: `line`, `why`, `caution` and `ask` are for the person, in plain English, and
|
|
15
15
|
// never name an outside service — examples of specific services go in `steps`, which is
|
|
16
16
|
// for the agent. A template's benefit reads the same here, in its `.bkit/templates.md`
|
|
17
|
-
// section opener and in
|
|
17
|
+
// section opener and in `DETAILS.md` § Templates ready to adopt; change all three in
|
|
18
18
|
// the same commit.
|
|
19
19
|
//
|
|
20
20
|
// Detection rules: every `fires` is local (files, settings, environment) — no network. The
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
} from "../before/env.js";
|
|
39
39
|
import { detectGhMcpToken, hasGithubMcpServer } from "../after/auth.js";
|
|
40
40
|
import { buildTrackerSetupAdvisory } from "../after/github.js";
|
|
41
|
-
import { buildDepUpdaterSetupAdvisory } from "../after/tools.js";
|
|
41
|
+
import { buildDepUpdaterSetupAdvisory, detectProjectDocs } from "../after/tools.js";
|
|
42
42
|
import { detectInstalledHostModules } from "../../install/hosts.js";
|
|
43
43
|
import { readBkitConfig } from "../../shared/settings.js";
|
|
44
44
|
import type { ComplyPhase, TipsContext } from "../../cli.js";
|
|
@@ -50,6 +50,8 @@ import {
|
|
|
50
50
|
hasJsTestRunner,
|
|
51
51
|
hasLintStagedConfig,
|
|
52
52
|
hasMcpServer,
|
|
53
|
+
hasNoProjectGoals,
|
|
54
|
+
hasProjectGoalsHeading,
|
|
53
55
|
hasNewerBkit,
|
|
54
56
|
hasTestLinter,
|
|
55
57
|
hasUnsharedFriction,
|
|
@@ -74,6 +76,8 @@ export interface SetupTip {
|
|
|
74
76
|
ask: string;
|
|
75
77
|
/** Where the agent finds the exact steps. */
|
|
76
78
|
steps: string;
|
|
79
|
+
/** Per-repo `ask` / `steps`; `collectTips` applies it before returning the tip. */
|
|
80
|
+
resolve?: (cwd: string) => { ask: string; steps: string };
|
|
77
81
|
/** False when no `bkit.advisories.ignore` entry may silence the tip. */
|
|
78
82
|
silenceable?: false;
|
|
79
83
|
/** Advisory ids this tip reuses the check of; a trailing `*` matches an id prefix. */
|
|
@@ -90,6 +94,37 @@ export const ALL_WORKFLOWS: readonly ComplyPhase[] = ["design", "plan", "build",
|
|
|
90
94
|
/** Every `bkit tips --workflow=` context: the phase workflows, then the two agent closes. */
|
|
91
95
|
export const EVERY_CONTEXT: readonly TipsContext[] = [...ALL_WORKFLOWS, "audit", "utility"];
|
|
92
96
|
|
|
97
|
+
const CLOUD_STEPS = "`.bkit/cloud.md`; `.bkit/templates.md` § Cloud-agent workflow and § Cursor.";
|
|
98
|
+
|
|
99
|
+
/** The `cloud` tip's `ask` / `steps` for the recorded `bkit.cloud.agent`. */
|
|
100
|
+
function cloudTipText(agent: string): { ask: string; steps: string } {
|
|
101
|
+
const copy =
|
|
102
|
+
"copy .bkit/templates/.github/workflows/bkit-cloud.yml to .github/workflows/bkit-cloud.yml";
|
|
103
|
+
const tail = "then tell me which dashboard settings are left.";
|
|
104
|
+
switch (agent) {
|
|
105
|
+
case "claude":
|
|
106
|
+
return {
|
|
107
|
+
ask: `Check my cloud-agent setup against .bkit/cloud.md: install the Claude GitHub App on the repo, ${copy} and .bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh to .claude/hooks/, run \`gh secret set BKIT_ANTHROPIC_API_KEY\` (or, keyless, \`gh variable set\` ANTHROPIC_FEDERATION_RULE_ID and ANTHROPIC_ORGANIZATION_ID from a Claude Console federation rule), ${tail}`,
|
|
108
|
+
steps: CLOUD_STEPS,
|
|
109
|
+
};
|
|
110
|
+
case "codex":
|
|
111
|
+
return {
|
|
112
|
+
ask: `Check my cloud-agent setup against .bkit/cloud.md: confirm bkit was installed with --codex, ${copy}, run \`gh secret set BKIT_OPENAI_API_KEY\`, ${tail}`,
|
|
113
|
+
steps: CLOUD_STEPS,
|
|
114
|
+
};
|
|
115
|
+
case "opencode":
|
|
116
|
+
return {
|
|
117
|
+
ask: `Check my cloud-agent setup against .bkit/cloud.md: ${copy}, set the opencode provider's BKIT_ API key as a repo secret (the name is in .bkit/cloud.md), ${tail}`,
|
|
118
|
+
steps: CLOUD_STEPS,
|
|
119
|
+
};
|
|
120
|
+
default:
|
|
121
|
+
return {
|
|
122
|
+
ask: `Check my cloud-agent setup against .bkit/cloud.md: copy .bkit/templates/.cursor/environment.json and .bkit/templates/.cursor/Dockerfile to .cursor/, ${tail}`,
|
|
123
|
+
steps: CLOUD_STEPS,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
93
128
|
export const SETUP_TIPS: readonly SetupTip[] = [
|
|
94
129
|
// --- current: is bkit itself up to date ---------------------------------------------
|
|
95
130
|
{
|
|
@@ -131,7 +166,9 @@ export const SETUP_TIPS: readonly SetupTip[] = [
|
|
|
131
166
|
advisories: ["gh-mcp-token-unset-shell", "gh-mcp-token-empty-shell"],
|
|
132
167
|
fires: (cwd) =>
|
|
133
168
|
readBkitConfig(cwd).issueTracker === "github" &&
|
|
134
|
-
(!hasGithubMcpServer(cwd) ||
|
|
169
|
+
(!hasGithubMcpServer(cwd) ||
|
|
170
|
+
// The pre-push hook's inner run unsets the .bkit/.env keys on purpose, so a missing token there is not real.
|
|
171
|
+
(!process.env.BKIT_PRE_PUSH_LOGGED && detectGhMcpToken(cwd) !== null)),
|
|
135
172
|
},
|
|
136
173
|
{
|
|
137
174
|
id: "bkit-env",
|
|
@@ -207,7 +244,7 @@ export const SETUP_TIPS: readonly SetupTip[] = [
|
|
|
207
244
|
title: "Consistent formatting",
|
|
208
245
|
line: "There's no shared formatting setup, so reviews fill up with spacing changes that hide the real ones. Add Prettier with bkit's ignore file.",
|
|
209
246
|
why: "Prettier (a code formatter) makes every file follow the same layout. bkit's ignore file stops it reformatting bkit's own files, which would otherwise show up as false changes every time bkit updates.",
|
|
210
|
-
ask: 'Copy .bkit/templates
|
|
247
|
+
ask: 'Copy .bkit/templates/prettierignore.example to .prettierignore first, then run `pnpm add -D prettier` and add `"format:check": "prettier --check ."` to the package.json scripts.',
|
|
211
248
|
steps: "`.bkit/templates.md` § Prettier.",
|
|
212
249
|
fires: (cwd) => !exists(cwd, ".prettierignore"),
|
|
213
250
|
},
|
|
@@ -247,7 +284,7 @@ export const SETUP_TIPS: readonly SetupTip[] = [
|
|
|
247
284
|
title: "Quick tidy-up on commit",
|
|
248
285
|
line: "The commit check has nothing to run. Add lint-staged so it tidies just the files you're committing.",
|
|
249
286
|
why: "It formats only the handful of files in each change, in about a second. Without it the commit check either does nothing or is slow enough that people start skipping it.",
|
|
250
|
-
ask: "Run `pnpm add -D lint-staged prettier` and copy .bkit/templates
|
|
287
|
+
ask: "Run `pnpm add -D lint-staged prettier` and copy .bkit/templates/lintstagedrc.example.json to .lintstagedrc.json.",
|
|
251
288
|
steps: "`.bkit/templates.md` § lint-staged.",
|
|
252
289
|
fires: (cwd) => !hasLintStagedConfig(cwd),
|
|
253
290
|
},
|
|
@@ -259,8 +296,9 @@ export const SETUP_TIPS: readonly SetupTip[] = [
|
|
|
259
296
|
title: "Finish cloud setup",
|
|
260
297
|
line: "You've turned on cloud agents, but setup isn't finished, so cloud runs will stop partway. Finish the remaining steps.",
|
|
261
298
|
why: "With cloud agents, bkit runs on its own: a change that passes its checks gets shipped and one that fails gets investigated, with nobody at the keyboard. That only works once every piece is in place.",
|
|
262
|
-
ask: "Check my cloud-agent setup against .bkit/cloud.md: copy .bkit/templates/.github/workflows/bkit-cloud.yml to .github/workflows/bkit-cloud.yml
|
|
299
|
+
ask: "Check my cloud-agent setup against .bkit/cloud.md: copy .bkit/templates/.github/workflows/bkit-cloud.yml to .github/workflows/bkit-cloud.yml, set the agent's credential as a repo secret under its BKIT_ name, then tell me which dashboard settings are left.",
|
|
263
300
|
steps: "`.bkit/cloud.md`; `.bkit/templates.md` § Cloud-agent workflow and § Cursor.",
|
|
301
|
+
resolve: (cwd) => cloudTipText(readBkitConfig(cwd).cloudAgents),
|
|
264
302
|
fires: (cwd) => {
|
|
265
303
|
const cloud = readBkitConfig(cwd).cloudAgents;
|
|
266
304
|
if (cloud === "none") return false;
|
|
@@ -359,6 +397,38 @@ export const SETUP_TIPS: readonly SetupTip[] = [
|
|
|
359
397
|
steps: "`.bkit/templates.md` § graphify.",
|
|
360
398
|
fires: (cwd) => !exists(cwd, "scripts/graphify"),
|
|
361
399
|
},
|
|
400
|
+
{
|
|
401
|
+
id: "project-docs",
|
|
402
|
+
workflows: ["design", "plan", "build"],
|
|
403
|
+
title: "Project docs",
|
|
404
|
+
line: "Fill the project docs in waves, because each doc reads facts the earlier ones record.",
|
|
405
|
+
why: "Agents read your architecture, testing and security docs before they plan and build. A doc that is missing or still holds the starter text gives them nothing to go on, so they guess from the code each time.",
|
|
406
|
+
caution:
|
|
407
|
+
"Ignoring either the missing-doc advisory or the unfilled-doc advisory also silences this tip and the other advisory.",
|
|
408
|
+
ask: "Fill in my project docs in the order of .bkit/templates.md § Project docs — adoption order: copy each missing starter from .bkit/templates/docs/ to docs/, fill it from the repository, and add its row to .agents/docs.md.",
|
|
409
|
+
steps: "`.bkit/templates.md` § Project docs — adoption order.",
|
|
410
|
+
advisories: ["project-docs-missing", "project-docs-unpopulated"],
|
|
411
|
+
fires: (cwd) =>
|
|
412
|
+
detectProjectDocs(cwd).some(
|
|
413
|
+
(f) => f.id === "project-docs-missing" || f.id === "project-docs-unpopulated",
|
|
414
|
+
),
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
id: "project-goals",
|
|
418
|
+
workflows: ["design", "plan"],
|
|
419
|
+
title: "Project goals",
|
|
420
|
+
line: "Agents have rules but no goals, so when two options both fit the rules they choose by guesswork. Write down what this project optimises for.",
|
|
421
|
+
why: "Design and plan agents choose between options on every run. The rules say what is allowed, not what matters most here, so each agent weighs speed, cost and polish its own way.",
|
|
422
|
+
ask: "Add a `## Project Goals` section to .agents/rules.md, between Project Rules and Project Settings, with a few goals in priority order. Ask me what this project optimises for first.",
|
|
423
|
+
steps: "`.bkit/prompts.md` § Special Behaviors, where the Project Goals row sits.",
|
|
424
|
+
resolve: (cwd) => ({
|
|
425
|
+
ask: hasProjectGoalsHeading(cwd)
|
|
426
|
+
? "Fill the `## Project Goals` section that already exists in .agents/rules.md instead of adding a second one, with a few goals in priority order. Ask me what this project optimises for first."
|
|
427
|
+
: "Add a `## Project Goals` section to .agents/rules.md, between Project Rules and Project Settings, with a few goals in priority order. Ask me what this project optimises for first.",
|
|
428
|
+
steps: "`.bkit/prompts.md` § Special Behaviors, where the Project Goals row sits.",
|
|
429
|
+
}),
|
|
430
|
+
fires: hasNoProjectGoals,
|
|
431
|
+
},
|
|
362
432
|
{
|
|
363
433
|
id: "dependabot-renovate",
|
|
364
434
|
workflows: ["ship", "audit"],
|
|
@@ -432,6 +502,34 @@ export const SETUP_TIPS: readonly SetupTip[] = [
|
|
|
432
502
|
);
|
|
433
503
|
},
|
|
434
504
|
},
|
|
505
|
+
{
|
|
506
|
+
id: "pre-push-pr-conflict",
|
|
507
|
+
workflows: ["plan", "ship"],
|
|
508
|
+
title: "Stop a push whose PR no longer merges",
|
|
509
|
+
line: "Your pre-push hook runs the whole gate even when the branch's open PR conflicts with its base, and CI never starts.",
|
|
510
|
+
why: "The newer hook looks up the open PR once, fetches its base and trial-merges the pushed commit. A conflict stops the push in seconds and names the files; a lookup or fetch that cannot answer only warns.",
|
|
511
|
+
ask: "Paste the `Open-PR lookup` block (above the CI-suppressor guard, which now reads the PR number from it) and the `PR conflict` block (before `pnpm bkit check`) of .bkit/templates/.husky/pre-push into .husky/pre-push, and add the `PUSH_BRANCH_SHA` line of its stdin loop: without it the check never runs.",
|
|
512
|
+
steps: "`.bkit/templates.md` § Git hooks.",
|
|
513
|
+
fires: (cwd) => {
|
|
514
|
+
if (!exists(cwd, ".husky/pre-push")) return false;
|
|
515
|
+
const hook = fs.readFileSync(path.join(cwd, ".husky/pre-push"), "utf-8");
|
|
516
|
+
return !hook.includes("merge-tree") || !hook.includes("PUSH_BRANCH_SHA=");
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
id: "pre-push-direnv",
|
|
521
|
+
workflows: ["plan", "ship"],
|
|
522
|
+
title: "Load .envrc when the pre-push hook runs",
|
|
523
|
+
line: "Your pre-push hook runs the gate without your .envrc variables when the shell that pushed never loaded them.",
|
|
524
|
+
why: "The newer hook runs its logged inner run through `direnv exec .`, so the gate always sees the repo's variables, and an untrusted .envrc stops the push in seconds with the fix instead of failing deep in the gate. The unset loops right after that block keep the fixed list of bkit tooling keys (BKIT_GH_TOKEN, ...), and every key `.bkit/.env` names, out of the gate and its log, however they were loaded.",
|
|
525
|
+
ask: "Replace the log block of .husky/pre-push (the `BKIT_PRE_PUSH_LOGGED` block) and the `.bkit/.env` unset block that follows it with the ones in .bkit/templates/.husky/pre-push.",
|
|
526
|
+
steps: "`.bkit/templates.md` § Git hooks.",
|
|
527
|
+
fires: (cwd) => {
|
|
528
|
+
if (!exists(cwd, ".husky/pre-push") || !exists(cwd, ".envrc")) return false;
|
|
529
|
+
const hook = fs.readFileSync(path.join(cwd, ".husky/pre-push"), "utf-8");
|
|
530
|
+
return !hook.includes("direnv exec");
|
|
531
|
+
},
|
|
532
|
+
},
|
|
435
533
|
{
|
|
436
534
|
id: "disk-prune",
|
|
437
535
|
workflows: ALL_WORKFLOWS,
|
|
@@ -448,11 +546,10 @@ export const SETUP_TIPS: readonly SetupTip[] = [
|
|
|
448
546
|
{
|
|
449
547
|
id: "share-friction",
|
|
450
548
|
title: "Tell bkit what slowed you down",
|
|
451
|
-
line: "Your workflows
|
|
549
|
+
line: "Your workflows logged problems its makers never see. Send them with your stats as one issue.",
|
|
452
550
|
why: "Workflows note every place bkit got in the way: a command that failed, rework, a manual step. Those notes stay in this repo, so the people who fix bkit never learn about them. One report from you is how they reach the fix list.",
|
|
453
|
-
caution:
|
|
454
|
-
|
|
455
|
-
ask: "Share this repo's bkit friction and stats with bkit's makers as one new issue: follow the paste block in .bkit/README.md § Share friction with bkit, show me the exact title and text, and post only after I say yes.",
|
|
551
|
+
caution: "bkit's issues are public. Your agent strips project names, paths and links first.",
|
|
552
|
+
ask: "Share this repo's bkit friction and stats as one issue per .bkit/README.md § Share friction with bkit. Show me the exact text; post only after I say yes.",
|
|
456
553
|
steps: "`.bkit/README.md` § Share friction with bkit.",
|
|
457
554
|
fires: hasUnsharedFriction,
|
|
458
555
|
},
|
|
@@ -132,11 +132,17 @@ const LINT_STAGED_CONFIGS = [
|
|
|
132
132
|
".lintstagedrc.yaml",
|
|
133
133
|
".lintstagedrc.yml",
|
|
134
134
|
".lintstagedrc.mjs",
|
|
135
|
-
".lintstagedrc.
|
|
135
|
+
".lintstagedrc.mts",
|
|
136
136
|
".lintstagedrc.js",
|
|
137
|
+
".lintstagedrc.ts",
|
|
138
|
+
".lintstagedrc.cjs",
|
|
139
|
+
".lintstagedrc.cts",
|
|
137
140
|
"lint-staged.config.mjs",
|
|
138
|
-
"lint-staged.config.
|
|
141
|
+
"lint-staged.config.mts",
|
|
139
142
|
"lint-staged.config.js",
|
|
143
|
+
"lint-staged.config.ts",
|
|
144
|
+
"lint-staged.config.cjs",
|
|
145
|
+
"lint-staged.config.cts",
|
|
140
146
|
];
|
|
141
147
|
|
|
142
148
|
/** True when any `.github/workflows/*.yml` / `*.yaml` contains `needle`. */
|
|
@@ -149,9 +155,11 @@ export function anyWorkflowMentions(cwd: string, needle: string): boolean {
|
|
|
149
155
|
.some((f) => readText(cwd, path.join(".github", "workflows", f)).includes(needle));
|
|
150
156
|
}
|
|
151
157
|
|
|
152
|
-
/** True when lint-staged is configured: any of its config files, or `package.
|
|
158
|
+
/** True when lint-staged is configured: any of its config files, `package.json` or `package.yaml` / `package.yml` `lint-staged` key. */
|
|
153
159
|
export function hasLintStagedConfig(cwd: string): boolean {
|
|
154
160
|
if (LINT_STAGED_CONFIGS.some((rel) => exists(cwd, rel))) return true;
|
|
161
|
+
if (["package.yaml", "package.yml"].some((rel) => /^lint-staged\s*:/m.test(readText(cwd, rel))))
|
|
162
|
+
return true;
|
|
155
163
|
const pkg = readPackageJson(cwd);
|
|
156
164
|
return pkg.ok && pkg.pkg["lint-staged"] !== undefined;
|
|
157
165
|
}
|
|
@@ -223,6 +231,31 @@ export function readsBkitText(cwd: string): string[] {
|
|
|
223
231
|
});
|
|
224
232
|
}
|
|
225
233
|
|
|
234
|
+
/** `.agents/rules.md` below `<!-- bkit:end -->` with HTML comments removed; null without the file. */
|
|
235
|
+
function rulesBelowEnd(cwd: string): string | null {
|
|
236
|
+
const text = readText(cwd, ".agents/rules.md");
|
|
237
|
+
if (!text) return null;
|
|
238
|
+
const end = text.indexOf("<!-- bkit:end -->");
|
|
239
|
+
return (end === -1 ? text : text.slice(end)).replace(/<!--[\s\S]*?-->/g, "");
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** True when the rules file already has a `## Project Goals` heading below `<!-- bkit:end -->`. */
|
|
243
|
+
export function hasProjectGoalsHeading(cwd: string): boolean {
|
|
244
|
+
return /^## Project Goals/m.test(rulesBelowEnd(cwd) ?? "");
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* True when `.agents/rules.md` exists and no `## Project Goals` section, read below
|
|
249
|
+
* `<!-- bkit:end -->`, holds a list item (`-`, `*`, `+` or `1.` / `1)`) once HTML comments
|
|
250
|
+
* are removed.
|
|
251
|
+
*/
|
|
252
|
+
export function hasNoProjectGoals(cwd: string): boolean {
|
|
253
|
+
const below = rulesBelowEnd(cwd);
|
|
254
|
+
if (below === null) return false;
|
|
255
|
+
const sections = [...below.matchAll(/^## Project Goals[^\n]*\n([\s\S]*?)(?=^## |(?![\s\S]))/gm)];
|
|
256
|
+
return !sections.some((m) => /^\s*(?:[-*+]|\d+[.)])\s/m.test(m[1] ?? ""));
|
|
257
|
+
}
|
|
258
|
+
|
|
226
259
|
/**
|
|
227
260
|
* True when `.bkit/friction.jsonl` holds an entry worth sending to bkit: its fold winner
|
|
228
261
|
* is `OPEN` (or has no status) and its `scope` is not `consumer`. A shared entry gets a
|
|
@@ -124,7 +124,7 @@ export function collectTips(cwd: string, catalogue: readonly SetupTip[] = SETUP_
|
|
|
124
124
|
for (const tip of catalogue) {
|
|
125
125
|
if (!tip.fires(base)) continue;
|
|
126
126
|
if (isTipSilenced(tip, ignored)) suppressed.push({ id: tip.id, scope: "." });
|
|
127
|
-
else tips.push(tip);
|
|
127
|
+
else tips.push(tip.resolve ? { ...tip, ...tip.resolve(base) } : tip);
|
|
128
128
|
}
|
|
129
129
|
const star = !ignored.has(STAR_TIP_ID) && !ignored.has(STAR_TIP_OLD_ID);
|
|
130
130
|
return { tips, suppressed, star };
|
package/.bkit/core/engine/cli.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type ModuleFlag =
|
|
|
24
24
|
"core" | "claude" | "cursor" | "opencode" | "codex" | "antigravity" | "cloud";
|
|
25
25
|
|
|
26
26
|
/** Cloud-agent variant chosen via `--auto=<variant>`. */
|
|
27
|
-
export const CLOUD_VARIANTS = ["claude", "cursor", "opencode"] as const;
|
|
27
|
+
export const CLOUD_VARIANTS = ["claude", "cursor", "opencode", "codex"] as const;
|
|
28
28
|
export type CloudVariant = (typeof CLOUD_VARIANTS)[number];
|
|
29
29
|
|
|
30
30
|
/** Narrow an unknown string to `CloudVariant` or return `null` if invalid. */
|
|
@@ -589,7 +589,7 @@ export const CLASSIC_VERB_HELP: readonly ClassicVerbHelp[] = [
|
|
|
589
589
|
"--antigravity",
|
|
590
590
|
"--cursor",
|
|
591
591
|
"--opencode=<provider>",
|
|
592
|
-
"--auto=<claude|cursor|opencode>",
|
|
592
|
+
"--auto=<claude|cursor|opencode|codex>",
|
|
593
593
|
"--tracker=<name>",
|
|
594
594
|
"--auto-revert",
|
|
595
595
|
],
|
|
@@ -645,7 +645,7 @@ export const CLASSIC_VERB_HELP: readonly ClassicVerbHelp[] = [
|
|
|
645
645
|
"--antigravity",
|
|
646
646
|
"--cursor",
|
|
647
647
|
"--opencode=<provider>",
|
|
648
|
-
"--auto=<claude|cursor|opencode>",
|
|
648
|
+
"--auto=<claude|cursor|opencode|codex>",
|
|
649
649
|
"--dry-run",
|
|
650
650
|
"--force",
|
|
651
651
|
"--nuke",
|
|
@@ -827,7 +827,7 @@ Module flags (composable; symmetric install ↔ uninstall):
|
|
|
827
827
|
opencode-zen, opencode-go (opencode-native gateways;
|
|
828
828
|
auth via BKIT_OPENCODE_API_KEY).
|
|
829
829
|
Ships .opencode/** (agents, commands, opencode.json, bkit-gateguard.js,
|
|
830
|
-
bkit-readguard.js).
|
|
830
|
+
bkit-readguard.js, bkit-guardrails.js).
|
|
831
831
|
Configure your provider key; verify with \`bkit doctor\`. All installed
|
|
832
832
|
providers tracked in bkit.providers.opencode.installed.
|
|
833
833
|
--codex Codex CLI host. BARE flag — takes no value: Codex runs on one gateway
|
|
@@ -851,14 +851,14 @@ Dependency updaters (copy an example and own it):
|
|
|
851
851
|
blocks when that value and the configs disagree.
|
|
852
852
|
All templates and install steps: .bkit/templates.md
|
|
853
853
|
|
|
854
|
-
--auto=<claude|cursor|opencode>
|
|
855
|
-
Cloud-agent (auto-dispatch) integration (opt-in).
|
|
856
|
-
tracker
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
needs
|
|
860
|
-
|
|
861
|
-
uninstall only.
|
|
854
|
+
--auto=<claude|cursor|opencode|codex>
|
|
855
|
+
Cloud-agent (auto-dispatch) integration (opt-in). Every variant needs
|
|
856
|
+
a wired tracker (github, linear or jira). Claude needs the
|
|
857
|
+
BKIT_ANTHROPIC_API_KEY repo secret or the ANTHROPIC_FEDERATION_RULE_ID
|
|
858
|
+
+ ANTHROPIC_ORGANIZATION_ID repo variables, plus the Claude GitHub App.
|
|
859
|
+
Codex needs --codex and BKIT_OPENAI_API_KEY. OpenCode needs --opencode
|
|
860
|
+
and its configured provider's BKIT_ key. Cursor uses its dashboard
|
|
861
|
+
triggers. Bare --auto is accepted on uninstall only.
|
|
862
862
|
|
|
863
863
|
Cross-cutting / modifiers:
|
|
864
864
|
--tracker=<name> Wire issue tracker integration. Values: github, linear, jira, none
|
|
@@ -966,7 +966,7 @@ export function validateModuleFlagsForVerb(
|
|
|
966
966
|
// The CLI entrypoint, run only when this file is executed and driven by real
|
|
967
967
|
// argv/fs/process.exit side effects; install.integration.test.ts exercises it through
|
|
968
968
|
// spawned processes. Pure decision logic lives in exported functions
|
|
969
|
-
// (validateModuleFlagsForVerb above,
|
|
969
|
+
// (validateModuleFlagsForVerb above, validateCloudTrackerWired in commands/install/install.ts)
|
|
970
970
|
// for unit coverage.
|
|
971
971
|
export async function main() {
|
|
972
972
|
const commandExit = await runCommand(process.argv.slice(2), COMMANDS, {
|