@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
|
@@ -13,8 +13,13 @@ export const testCommand = (argv, platform = process.platform) => platform === "
|
|
|
13
13
|
export const PACKAGE_RUNNER = "pnpm";
|
|
14
14
|
/** argv for running one `package.json` script, e.g. `bkit:gate:static-unit`. */
|
|
15
15
|
export const scriptCommand = (script) => [PACKAGE_RUNNER, script];
|
|
16
|
-
/** argv for installing dependencies; `frozen` refuses to change the lockfile. */
|
|
17
|
-
export const installCommand = (opts) =>
|
|
16
|
+
/** argv for installing dependencies; `frozen` refuses to change the lockfile, `preferOffline` reads the local store first. */
|
|
17
|
+
export const installCommand = (opts) => [
|
|
18
|
+
PACKAGE_RUNNER,
|
|
19
|
+
"install",
|
|
20
|
+
...(opts.frozen ? ["--frozen-lockfile"] : []),
|
|
21
|
+
...(opts.preferOffline ? ["--prefer-offline"] : []),
|
|
22
|
+
];
|
|
18
23
|
/**
|
|
19
24
|
* argv that regenerates a lockfile from its manifest, keyed by lockfile name.
|
|
20
25
|
* Covers lockfiles from other ecosystems too: a rebase conflict in `Cargo.lock` is
|
package/dist/shared/settings.js
CHANGED
|
@@ -18,6 +18,7 @@ export function parseGithubBoardUrl(url) {
|
|
|
18
18
|
export const ASK_POINTS = [
|
|
19
19
|
"design.grill",
|
|
20
20
|
"build.verify",
|
|
21
|
+
"build.holistic",
|
|
21
22
|
"build.challenge",
|
|
22
23
|
"build.tests",
|
|
23
24
|
"debug.fix",
|
|
@@ -64,6 +65,7 @@ export const CONFIG_DEFAULTS = {
|
|
|
64
65
|
asks: {
|
|
65
66
|
"design.grill": { ask: true, max: 6 },
|
|
66
67
|
"build.verify": { ask: true, max: 2 },
|
|
68
|
+
"build.holistic": { ask: true, max: 2 },
|
|
67
69
|
"build.challenge": { ask: true, max: 2 },
|
|
68
70
|
"build.tests": { ask: true, max: 2 },
|
|
69
71
|
"debug.fix": { ask: true, max: 2 },
|
|
@@ -75,6 +77,7 @@ export const CONFIG_DEFAULTS = {
|
|
|
75
77
|
buildPublish: { remote: true, local: true },
|
|
76
78
|
depUpdater: null,
|
|
77
79
|
issueTrackerExplicit: false,
|
|
80
|
+
issueTrackerUnknown: null,
|
|
78
81
|
cloudAgentsExplicit: false,
|
|
79
82
|
};
|
|
80
83
|
const nonEmptyString = (v) => typeof v === "string" && v.trim() !== "";
|
|
@@ -256,6 +259,11 @@ export function readBkitConfig(root) {
|
|
|
256
259
|
buildPublish: buildPublish(record(workflows.build).publish),
|
|
257
260
|
depUpdater: parseDepUpdater(record(bkit.dependencies).updater),
|
|
258
261
|
issueTrackerExplicit: tracker.default !== undefined && tracker.default !== "",
|
|
262
|
+
issueTrackerUnknown: tracker.default !== undefined &&
|
|
263
|
+
tracker.default !== "" &&
|
|
264
|
+
parseIssueTracker(tracker.default) === null
|
|
265
|
+
? String(tracker.default)
|
|
266
|
+
: null,
|
|
259
267
|
cloudAgentsExplicit: cloud.agent !== undefined && cloud.agent !== "",
|
|
260
268
|
};
|
|
261
269
|
}
|
package/dist/shared/text.js
CHANGED
|
@@ -16,6 +16,19 @@ const isScalar = (v) => v === null || typeof v === "string" || typeof v === "num
|
|
|
16
16
|
const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
17
17
|
/** Escape backslashes and line breaks so a value stays on one line. */
|
|
18
18
|
const escapeLine = (s) => s.replace(/\\/g, "\\\\").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
|
|
19
|
+
/**
|
|
20
|
+
* A free-text value for one line of Markdown: each run of line breaks, tabs and other
|
|
21
|
+
* control characters becomes one space, and the ends are trimmed. With `max`, a longer
|
|
22
|
+
* result is cut to `max` characters, the last one `…`.
|
|
23
|
+
*/
|
|
24
|
+
export function oneLine(value, max) {
|
|
25
|
+
const isControl = (ch) => ch < " " || ch === "\u007f";
|
|
26
|
+
const folded = Array.from(value, (ch) => (isControl(ch) ? "\n" : ch))
|
|
27
|
+
.join("")
|
|
28
|
+
.replace(/\n+/g, " ")
|
|
29
|
+
.trim();
|
|
30
|
+
return max !== undefined && folded.length > max ? `${folded.slice(0, max - 1)}…` : folded;
|
|
31
|
+
}
|
|
19
32
|
const scalarText = (v) => (v === null ? "null" : String(v));
|
|
20
33
|
const NUMBER = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
|
|
21
34
|
const LITERALS = new Set(["null", "true", "false", "[]", "{}"]);
|
|
@@ -259,6 +259,7 @@ export function syncRules(store, masters) {
|
|
|
259
259
|
/** Hook files whose messages `## Hook Text` copies. */
|
|
260
260
|
export const HOOK_SOURCES = [
|
|
261
261
|
".bkit/core/hooks/gateguard-engine.js",
|
|
262
|
+
".bkit/core/hooks/guardrails-deny.js",
|
|
262
263
|
".bkit/core/hooks/guardrails-read.js",
|
|
263
264
|
".bkit/core/hooks/guardrails-shell.js",
|
|
264
265
|
".bkit/core/hooks/guardrails-tiers.js",
|
|
@@ -182,7 +182,6 @@ const DOC_DIRS = [
|
|
|
182
182
|
".bkit/core/.agents",
|
|
183
183
|
".bkit/core/.bkit",
|
|
184
184
|
".bkit/shared",
|
|
185
|
-
".bkit/shared/docs",
|
|
186
185
|
".bkit/shared/.cursor/rules",
|
|
187
186
|
];
|
|
188
187
|
const DOC_FILE = /\.mdc?$/;
|
|
@@ -547,7 +546,11 @@ function siblingsOf(canonical, allTexts) {
|
|
|
547
546
|
}
|
|
548
547
|
let hit = byText.get(canonical);
|
|
549
548
|
if (!hit) {
|
|
550
|
-
|
|
549
|
+
const { words, counts } = canonicalParts(canonical);
|
|
550
|
+
hit = [...allTexts].filter((t) => t !== canonical &&
|
|
551
|
+
!compileText(t).slotted &&
|
|
552
|
+
nearCandidate(canonicalParts(t).words, words, counts) &&
|
|
553
|
+
similarity(t, canonical) >= NEAR_COPY);
|
|
551
554
|
byText.set(canonical, hit);
|
|
552
555
|
}
|
|
553
556
|
return hit;
|
|
@@ -1200,46 +1203,56 @@ function citeFiles(ix, name) {
|
|
|
1200
1203
|
return COVERED.map((s) => ix.byName(s, name)).filter((f) => f !== undefined);
|
|
1201
1204
|
}
|
|
1202
1205
|
const lineHolds = (file, line, excerpt) => (file.content.split("\n")[line - 1] ?? "").includes(excerpt);
|
|
1203
|
-
/**
|
|
1204
|
-
|
|
1205
|
-
const out =
|
|
1206
|
-
const ix = coverageIndex(store, corpus);
|
|
1207
|
-
const partialOf = new Map();
|
|
1206
|
+
/** File id → the sentences of each rule the file carries partially. */
|
|
1207
|
+
function partialSentences(ix) {
|
|
1208
|
+
const out = new Map();
|
|
1208
1209
|
for (const r of ix.rules) {
|
|
1209
1210
|
for (const { file } of ruleCarriers(ix, r, ["partial"])) {
|
|
1210
|
-
|
|
1211
|
+
out.set(file.id, [...(out.get(file.id) ?? []), ...splitSentences(r.text)]);
|
|
1211
1212
|
}
|
|
1212
1213
|
}
|
|
1213
|
-
|
|
1214
|
+
return out;
|
|
1215
|
+
}
|
|
1216
|
+
/** File id → its own local entries plus the shared lines that list it as a carrier. */
|
|
1217
|
+
function localEntriesOf(ix, out) {
|
|
1218
|
+
const byFile = new Map();
|
|
1214
1219
|
for (const e of ix.local) {
|
|
1215
1220
|
if (e.file !== undefined)
|
|
1216
|
-
|
|
1221
|
+
byFile.set(e.file, [...(byFile.get(e.file) ?? []), e]);
|
|
1217
1222
|
else {
|
|
1218
1223
|
for (const [surface, names] of sharedCarriers(e.carriers ?? "", ix.namesOf)) {
|
|
1219
1224
|
for (const n of names) {
|
|
1220
1225
|
const f = ix.byName(surface, n);
|
|
1221
1226
|
if (!f) {
|
|
1222
|
-
out
|
|
1227
|
+
out?.push(`shared line: carrier \`${n}\` is no ${surface} file: ${e.text}`);
|
|
1223
1228
|
continue;
|
|
1224
1229
|
}
|
|
1225
|
-
|
|
1230
|
+
byFile.set(f.id, [...(byFile.get(f.id) ?? []), e]);
|
|
1226
1231
|
}
|
|
1227
1232
|
}
|
|
1228
1233
|
}
|
|
1229
1234
|
}
|
|
1235
|
+
return byFile;
|
|
1236
|
+
}
|
|
1237
|
+
/** The standing lines of `f` that no local entry, clause, rule or partial rule sentence covers. */
|
|
1238
|
+
function uncoveredLines(ix, f, local, partial) {
|
|
1239
|
+
const own = new Set(local.map((e) => e.text));
|
|
1240
|
+
return ix.standing
|
|
1241
|
+
.get(f.id)
|
|
1242
|
+
.filter(({ text }) => !own.has(text) &&
|
|
1243
|
+
!ix.clauseForms.some((c) => c.re.test(text)) &&
|
|
1244
|
+
!ix.rules.some((r) => text.includes(r.text)) &&
|
|
1245
|
+
!partial.some((s) => text.includes(s)));
|
|
1246
|
+
}
|
|
1247
|
+
/** Findings for the both-ways check of the store against the corpus. */
|
|
1248
|
+
export function checkCoverage(store, corpus) {
|
|
1249
|
+
const out = [];
|
|
1250
|
+
const ix = coverageIndex(store, corpus);
|
|
1251
|
+
const partialOf = partialSentences(ix);
|
|
1252
|
+
const localOf = localEntriesOf(ix, out);
|
|
1230
1253
|
// Nothing missing.
|
|
1231
1254
|
for (const f of ix.files) {
|
|
1232
|
-
const
|
|
1233
|
-
const partial = partialOf.get(f.id) ?? [];
|
|
1234
|
-
for (const { line, text } of ix.standing.get(f.id)) {
|
|
1235
|
-
if (own.has(text))
|
|
1236
|
-
continue;
|
|
1237
|
-
if (ix.clauseForms.some((c) => c.re.test(text)))
|
|
1238
|
-
continue;
|
|
1239
|
-
if (ix.rules.some((r) => text.includes(r.text)))
|
|
1240
|
-
continue;
|
|
1241
|
-
if (partial.some((s) => text.includes(s)))
|
|
1242
|
-
continue;
|
|
1255
|
+
for (const { line, text } of uncoveredLines(ix, f, localOf.get(f.id) ?? [], partialOf.get(f.id) ?? [])) {
|
|
1243
1256
|
out.push(`${f.id}:${line}: no entry — add under #### ${f.name}: ${text}`);
|
|
1244
1257
|
}
|
|
1245
1258
|
}
|
|
@@ -1481,6 +1494,63 @@ export function similarEntries(store) {
|
|
|
1481
1494
|
}
|
|
1482
1495
|
return out;
|
|
1483
1496
|
}
|
|
1497
|
+
/** How alike a reworded line must stay to its stored copy for `refreshLocal` to pair them. */
|
|
1498
|
+
export const REFRESH_MIN = 0.5;
|
|
1499
|
+
/**
|
|
1500
|
+
* The store with each per-file local entry whose line was reworded in place rewritten to the
|
|
1501
|
+
* new wording, tags kept, and one `{file}: {old} → {new}` note per rewrite. A stale entry pairs
|
|
1502
|
+
* with an uncovered line of its file only when the line sits between the file lines of the
|
|
1503
|
+
* nearest unchanged entries before and after it in the store, is at least `REFRESH_MIN` alike,
|
|
1504
|
+
* and no other pairing scores the same for either side; pairs never cross. A deleted line, a
|
|
1505
|
+
* new line and a shared line stay as findings for a person to settle.
|
|
1506
|
+
*/
|
|
1507
|
+
export function refreshLocal(store, corpus) {
|
|
1508
|
+
const ix = coverageIndex(store, corpus);
|
|
1509
|
+
const partialOf = partialSentences(ix);
|
|
1510
|
+
const localOf = localEntriesOf(ix);
|
|
1511
|
+
const lines = store.split("\n");
|
|
1512
|
+
const refreshed = [];
|
|
1513
|
+
for (const f of ix.files) {
|
|
1514
|
+
const own = ix.local.filter((e) => e.file === f.id).sort((a, b) => a.at - b.at);
|
|
1515
|
+
const standing = ix.standing.get(f.id);
|
|
1516
|
+
const lineOf = own.map((e) => standing.find((s) => s.text === e.text)?.line);
|
|
1517
|
+
const uncovered = uncoveredLines(ix, f, localOf.get(f.id) ?? [], partialOf.get(f.id) ?? []);
|
|
1518
|
+
const pairs = [];
|
|
1519
|
+
own.forEach((e, i) => {
|
|
1520
|
+
if (lineOf[i] !== undefined)
|
|
1521
|
+
return;
|
|
1522
|
+
const before = lineOf.slice(0, i).filter((n) => n !== undefined);
|
|
1523
|
+
const after = lineOf.slice(i + 1).find((n) => n !== undefined);
|
|
1524
|
+
const lo = before.length > 0 ? Math.max(...before) : 0;
|
|
1525
|
+
const hi = after ?? Infinity;
|
|
1526
|
+
for (const u of uncovered) {
|
|
1527
|
+
if (u.line <= lo || u.line >= hi)
|
|
1528
|
+
continue;
|
|
1529
|
+
const score = similarity(e.text, u.text);
|
|
1530
|
+
if (score >= REFRESH_MIN)
|
|
1531
|
+
pairs.push({ entry: i, line: u.line, text: u.text, score });
|
|
1532
|
+
}
|
|
1533
|
+
});
|
|
1534
|
+
const tied = (p) => pairs.some((q) => q !== p && q.score === p.score && (q.entry === p.entry || q.line === p.line));
|
|
1535
|
+
const taken = [];
|
|
1536
|
+
for (const p of [...pairs].sort((a, b) => b.score - a.score)) {
|
|
1537
|
+
if (tied(p))
|
|
1538
|
+
continue;
|
|
1539
|
+
if (taken.some((t) => t.entry === p.entry || t.line === p.line))
|
|
1540
|
+
continue;
|
|
1541
|
+
if (taken.some((t) => t.entry < p.entry !== t.line < p.line))
|
|
1542
|
+
continue;
|
|
1543
|
+
taken.push(p);
|
|
1544
|
+
}
|
|
1545
|
+
for (const p of taken.sort((a, b) => a.entry - b.entry)) {
|
|
1546
|
+
const e = own[p.entry];
|
|
1547
|
+
const at = lines[e.at];
|
|
1548
|
+
lines[e.at] = at.slice(0, at.length - e.text.length) + p.text;
|
|
1549
|
+
refreshed.push(`${f.name}: ${e.text} → ${p.text}`);
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
return { store: lines.join("\n"), refreshed };
|
|
1553
|
+
}
|
|
1484
1554
|
/** The store with shared-line carriers and drift line numbers recomputed from the corpus. */
|
|
1485
1555
|
export function syncCoverage(store, corpus) {
|
|
1486
1556
|
const ix = coverageIndex(store, corpus);
|
|
@@ -1585,7 +1655,10 @@ function main(argv) {
|
|
|
1585
1655
|
console.error(`[bkit-instructions] rewrote ${id}`);
|
|
1586
1656
|
}
|
|
1587
1657
|
files = loadCorpus(root);
|
|
1588
|
-
const
|
|
1658
|
+
const fresh = refreshLocal(syncStore(store, files), files);
|
|
1659
|
+
for (const r of fresh.refreshed)
|
|
1660
|
+
console.error(`[bkit-instructions] refreshed local entry ${r}`);
|
|
1661
|
+
const synced = syncCoverage(fresh.store, files);
|
|
1589
1662
|
if (synced !== store) {
|
|
1590
1663
|
fs.writeFileSync(storeFile, synced, "utf-8");
|
|
1591
1664
|
console.error(`[bkit-instructions] rewrote ${STORE_PATH}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cbartens/bkit",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "From vibe coding to production code. A senior engineering team's process, ready-made: AI agents design, plan, build, review, fix and ship your features on Claude Code, Cursor, Codex, Google Antigravity and opencode.",
|
|
6
6
|
"keywords": [
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=24"
|
|
45
45
|
},
|
|
46
|
-
"packageManager": "pnpm@10.34.
|
|
46
|
+
"packageManager": "pnpm@10.34.9",
|
|
47
47
|
"repository": {
|
|
48
48
|
"type": "git",
|
|
49
49
|
"url": "https://github.com/cbartens/bkit.git"
|
|
@@ -55,15 +55,15 @@
|
|
|
55
55
|
"license": "MIT",
|
|
56
56
|
"scripts": {
|
|
57
57
|
"bkit:gate:format": "node scripts/ci/bkit-test-awake.mjs pnpm lint-staged",
|
|
58
|
-
"bkit:gate:min": "node scripts/ci/bkit-test-awake.mjs --shell \"pnpm format:check && pnpm format:tables:check && pnpm bkit:lint:prose && pnpm bkit:slop:delta && vitest run .bkit/core/engine/audits/repo/ledger-integrity.test.ts\"",
|
|
58
|
+
"bkit:gate:min": "node scripts/ci/bkit-test-awake.mjs --shell \"pnpm format:check && pnpm format:tables:check && pnpm bkit:lint:prose && pnpm bkit:slop:delta && vitest run .bkit/core/engine/audits/repo/ledger-integrity.test.ts .bkit/core/engine/audits/templates/templates.test.ts .bkit/core/engine/audits/templates/template-no-userpath.test.ts\"",
|
|
59
59
|
"bkit:gate:static": "node scripts/ci/bkit-test-awake.mjs --shell \"pnpm typecheck && pnpm lint && pnpm format:check && pnpm format:tables:check && pnpm bkit:lint:prose && pnpm bkit:slop:delta\"",
|
|
60
|
-
"bkit:gate:static-unit": "
|
|
61
|
-
"bkit:gate:static-unit-integration": "
|
|
62
|
-
"bkit:gate:install-static-unit-build": "
|
|
60
|
+
"bkit:gate:static-unit": "bash scripts/ci/bkit-machine-lock.sh run --lock tests -- sh -c 'pnpm bkit:gate:static && pnpm test:coverage:unit && pnpm bkit:test:bats && pnpm bkit:test:awake'",
|
|
61
|
+
"bkit:gate:static-unit-integration": "bash scripts/ci/bkit-machine-lock.sh run --lock tests -- sh -c 'pnpm bkit:gate:static-unit && pnpm test:integration'",
|
|
62
|
+
"bkit:gate:install-static-unit-build": "bash scripts/ci/bkit-machine-lock.sh run --lock tests -- sh -c 'pnpm install --frozen-lockfile && pnpm bkit:gate:static-unit && pnpm build'",
|
|
63
63
|
"bkit:deps:outdated": "pnpm outdated",
|
|
64
64
|
"bkit:deps:audit": "pnpm audit",
|
|
65
65
|
"bkit:test:file": "node scripts/ci/bkit-test-awake.mjs node scripts/ci/bkit-test-file.mjs",
|
|
66
|
-
"bkit:gate:changed": "
|
|
66
|
+
"bkit:gate:changed": "bash scripts/ci/bkit-machine-lock.sh run --lock tests -- node scripts/gate/bkit-gate-changed.mjs",
|
|
67
67
|
"bkit:generate": "pnpm build && pnpm cli:sync && pnpm instructions:sync && pnpm bkit upgrade && vitest run .bkit/core/engine/render -u && bash -c 'if command -v graphify >/dev/null 2>&1; then pnpm bkit:graph:refresh; else echo \"[bkit] graphify missing — skipping the capability register (install graphify to rebuild docs/capabilities.md)\"; fi'",
|
|
68
68
|
"bkit:lint:file": "oxlint -c .oxlintrc.json --type-aware --tsconfig tsconfig.test.json --deny-warnings --no-error-on-unmatched-pattern",
|
|
69
69
|
"bkit": "node dist/cli.js",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"format:check": "prettier --check .",
|
|
75
75
|
"format:tables": "node scripts/prettier/bkit-insert-ignore.mjs .agents docs README.md .bkit/instructions.md .bkit/shared .bkit/core/.agents .bkit/core/docs .bkit/core/.bkit",
|
|
76
76
|
"format:tables:check": "node scripts/prettier/bkit-insert-ignore.mjs --check .agents docs README.md .bkit/instructions.md .bkit/shared .bkit/core/.agents .bkit/core/docs .bkit/core/.bkit",
|
|
77
|
-
"bkit:lint:prose": "bkit ci prose --glob='.agents/*.md' --glob='.bkit/core/.bkit/*.md' --glob='.bkit/core/workflows/**/*.md' --glob='.bkit/core/prompts/**/*.md' --glob='.bkit/core/.agents/*.md' --glob='.bkit/
|
|
77
|
+
"bkit:lint:prose": "bkit ci prose --glob='.agents/*.md' --glob='.bkit/core/.bkit/*.md' --glob='.bkit/core/workflows/**/*.md' --glob='.bkit/core/prompts/**/*.md' --glob='.bkit/core/.agents/*.md' --glob='.bkit/core/docs/**/*.md' --glob='.bkit/templates/**/*.md' --glob='docs/*.md' --glob='*.md'",
|
|
78
78
|
"lint:slop": "slop-scan scan .",
|
|
79
79
|
"bkit:slop:delta": "bkit ci slop",
|
|
80
80
|
"bkit:lint:workflows": "bash -c 'if command -v actionlint >/dev/null 2>&1; then actionlint; else echo \"[bkit] actionlint missing — skipping workflow lint (install actionlint to enable)\"; fi'",
|
|
@@ -101,29 +101,32 @@
|
|
|
101
101
|
"instructions:sync": "tsx .bkit/core/engine/tools/instructions.ts --write",
|
|
102
102
|
"cli:sync": "tsx .bkit/core/engine/tools/cli-doc.ts --write",
|
|
103
103
|
"prepare": "husky",
|
|
104
|
-
"bkit:test:awake": "node scripts/ci/bkit-test-awake.mjs node
|
|
104
|
+
"bkit:test:awake": "node scripts/ci/bkit-test-awake.mjs node scripts/ci/bkit-test-file.mjs scripts/ci/bkit-test-awake.test.mjs"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@types/node": "24.19.2",
|
|
108
|
-
"@vitest/coverage-v8": "5.0
|
|
108
|
+
"@vitest/coverage-v8": "5.1.0",
|
|
109
109
|
"bats": "1.13.0",
|
|
110
110
|
"bkit": "link:.",
|
|
111
111
|
"husky": "9.1.7",
|
|
112
112
|
"lint-staged": "17.6.0",
|
|
113
|
-
"oxlint": "1.
|
|
114
|
-
"oxlint-tsgolint": "7.0.
|
|
113
|
+
"oxlint": "1.92.0",
|
|
114
|
+
"oxlint-tsgolint": "7.0.2006",
|
|
115
115
|
"prettier": "3.9.10",
|
|
116
116
|
"slop-scan": "0.3.0",
|
|
117
117
|
"tsx": "4.23.15",
|
|
118
118
|
"typescript": "7.0.2",
|
|
119
119
|
"vite": "6.4.5",
|
|
120
|
-
"vitest": "5.0
|
|
120
|
+
"vitest": "5.1.0",
|
|
121
121
|
"yaml": "2.9.1"
|
|
122
122
|
},
|
|
123
123
|
"pnpm": {
|
|
124
124
|
"overrides": {
|
|
125
125
|
"vite": "$vite",
|
|
126
126
|
"esbuild": "^0.28.0"
|
|
127
|
+
},
|
|
128
|
+
"patchedDependencies": {
|
|
129
|
+
"bats@1.13.0": "patches/bats@1.13.0.patch"
|
|
127
130
|
}
|
|
128
131
|
},
|
|
129
132
|
"bkit": {
|
|
@@ -198,7 +201,11 @@
|
|
|
198
201
|
"build": {
|
|
199
202
|
"verify": {
|
|
200
203
|
"ask": true,
|
|
201
|
-
"maxAttempts":
|
|
204
|
+
"maxAttempts": 2
|
|
205
|
+
},
|
|
206
|
+
"holistic": {
|
|
207
|
+
"ask": true,
|
|
208
|
+
"maxAttempts": 2
|
|
202
209
|
},
|
|
203
210
|
"challenge": {
|
|
204
211
|
"ask": true,
|
|
@@ -210,7 +217,7 @@
|
|
|
210
217
|
},
|
|
211
218
|
"publish": {
|
|
212
219
|
"remote": true,
|
|
213
|
-
"local":
|
|
220
|
+
"local": false
|
|
214
221
|
}
|
|
215
222
|
},
|
|
216
223
|
"debug": {
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# --- Linear guard: identical in the Claude and Cursor preflight hooks (bkit renders it
|
|
2
|
-
# from one source). Pure bash + python3 + curl, no bkit runtime. Needs `emit_context`,
|
|
3
|
-
# which the host's code above defines in that host's output shape.
|
|
4
|
-
|
|
5
|
-
# BKIT_LINEAR_API_KEY required to call the Linear GraphQL API.
|
|
6
|
-
if [[ -z "${BKIT_LINEAR_API_KEY:-}" ]]; then
|
|
7
|
-
echo "Guard pre-check: FAIL. BKIT_LINEAR_API_KEY not set, so ${LINEAR_ISSUE_ID:-(unset)} cannot be validated." >&2
|
|
8
|
-
emit_context "Guard pre-check: FAIL. BKIT_LINEAR_API_KEY is not set, so bkit cannot check ${LINEAR_ISSUE_ID:-(unset)}. HARD STOP: refuse any Linear-related work. Report the failure to the user, then stop."
|
|
9
|
-
exit 1
|
|
10
|
-
fi
|
|
11
|
-
|
|
12
|
-
# LINEAR_ISSUE_ID required (Claude's trigger above already demands it; a Cursor Cloud
|
|
13
|
-
# Agent sets it from workflow context).
|
|
14
|
-
if [[ -z "${LINEAR_ISSUE_ID:-}" ]]; then
|
|
15
|
-
echo "Guard pre-check: FAIL. LINEAR_ISSUE_ID not set." >&2
|
|
16
|
-
emit_context "Guard pre-check: FAIL. LINEAR_ISSUE_ID is not set. HARD STOP: refuse any Linear-related work. Report the failure to the user, then stop."
|
|
17
|
-
exit 1
|
|
18
|
-
fi
|
|
19
|
-
|
|
20
|
-
# Query Linear for issue state and labels.
|
|
21
|
-
QUERY='query($id: String!) { issue(id: $id) { identifier title state { name } labels { nodes { name } } } }'
|
|
22
|
-
|
|
23
|
-
BODY=$(LINEAR_ISSUE_ID="$LINEAR_ISSUE_ID" Q="$QUERY" python3 -c '
|
|
24
|
-
import json, os
|
|
25
|
-
print(json.dumps({"query": os.environ["Q"], "variables": {"id": os.environ["LINEAR_ISSUE_ID"]}}))
|
|
26
|
-
')
|
|
27
|
-
|
|
28
|
-
RESPONSE=$(curl -sS \
|
|
29
|
-
-X POST \
|
|
30
|
-
-H "Content-Type: application/json" \
|
|
31
|
-
-H "Authorization: ${BKIT_LINEAR_API_KEY}" \
|
|
32
|
-
--data "$BODY" \
|
|
33
|
-
"https://api.linear.app/graphql" 2>/dev/null) || {
|
|
34
|
-
echo "Guard pre-check: FAIL. Linear API request failed for ${LINEAR_ISSUE_ID}." >&2
|
|
35
|
-
emit_context "Guard pre-check: FAIL. The Linear API could not be reached for ${LINEAR_ISSUE_ID}. HARD STOP: refuse any Linear-related work. Report the failure to the user, then stop."
|
|
36
|
-
exit 1
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
# Parse response: identifier, state, labels.
|
|
40
|
-
read -r ISSUE_ID_DISPLAY ISSUE_STATE LABELS < <(RESPONSE="$RESPONSE" LINEAR_ISSUE_ID="$LINEAR_ISSUE_ID" python3 -c '
|
|
41
|
-
import json, os, sys
|
|
42
|
-
try:
|
|
43
|
-
d = json.loads(os.environ["RESPONSE"])
|
|
44
|
-
except Exception:
|
|
45
|
-
print(os.environ["LINEAR_ISSUE_ID"], "UNKNOWN", "")
|
|
46
|
-
sys.exit(0)
|
|
47
|
-
issue = (d.get("data") or {}).get("issue") or {}
|
|
48
|
-
ident = issue.get("identifier") or os.environ["LINEAR_ISSUE_ID"]
|
|
49
|
-
state = (issue.get("state") or {}).get("name") or "UNKNOWN"
|
|
50
|
-
labels = ",".join(n["name"] for n in ((issue.get("labels") or {}).get("nodes") or []))
|
|
51
|
-
print(ident, state, labels if labels else "-")
|
|
52
|
-
')
|
|
53
|
-
|
|
54
|
-
FAIL_REASON=""
|
|
55
|
-
|
|
56
|
-
# Guard 1: `bkit:auto` label must be present.
|
|
57
|
-
if [[ ",${LABELS}," != *",bkit:auto,"* ]]; then
|
|
58
|
-
FAIL_REASON="bkit:auto label missing (labels: ${LABELS})"
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
# Guard 2: Issue must not be in a terminal state.
|
|
62
|
-
if [[ "$ISSUE_STATE" == "Cancelled" || "$ISSUE_STATE" == "Done" ]]; then
|
|
63
|
-
FAIL_REASON="the issue is in a terminal state (${ISSUE_STATE})"
|
|
64
|
-
fi
|
|
65
|
-
|
|
66
|
-
if [[ -n "$FAIL_REASON" ]]; then
|
|
67
|
-
echo "Guard pre-check: FAIL. Issue ${ISSUE_ID_DISPLAY}: ${FAIL_REASON}" >&2
|
|
68
|
-
emit_context "Guard pre-check: FAIL. Issue ${ISSUE_ID_DISPLAY}: ${FAIL_REASON}. HARD STOP: refuse any Linear-related work on this issue. Report the failure to the user, then stop."
|
|
69
|
-
exit 1
|
|
70
|
-
fi
|
|
71
|
-
|
|
72
|
-
emit_context "Guard pre-check: PASS | issue: ${ISSUE_ID_DISPLAY} | status: ${ISSUE_STATE} | labels: ${LABELS}"
|
|
73
|
-
exit 0
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<!-- bkit:start -->
|
|
2
|
-
|
|
3
|
-
{{BKIT_MANAGED_MARKER}}
|
|
4
|
-
|
|
5
|
-
# Architecture
|
|
6
|
-
|
|
7
|
-
> [!CAUTION]
|
|
8
|
-
> **Purpose:** The system design: service boundaries, deployment topology and an integration sketch.
|
|
9
|
-
>
|
|
10
|
-
> **Rules:**
|
|
11
|
-
>
|
|
12
|
-
> - Follow `.bkit/authoring.md` § All Agent-Read Files and § Docs when you edit this file.
|
|
13
|
-
> - Hold topology and boundaries only. Operational rules and library lists go in the domain docs.
|
|
14
|
-
> - Update this file when a package is added or removed, or a boundary shifts.
|
|
15
|
-
|
|
16
|
-
<!-- bkit:end -->
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<!-- bkit:start -->
|
|
2
|
-
|
|
3
|
-
{{BKIT_MANAGED_MARKER}}
|
|
4
|
-
|
|
5
|
-
# Data Schema
|
|
6
|
-
|
|
7
|
-
> [!CAUTION]
|
|
8
|
-
> **Purpose:** The active production database schema: entities / tables, fields, access policies (e.g. RLS), indices and triggers.
|
|
9
|
-
>
|
|
10
|
-
> **Rules:**
|
|
11
|
-
>
|
|
12
|
-
> - Follow `.bkit/authoring.md` § All Agent-Read Files and § Docs when you edit this file.
|
|
13
|
-
> - Give each table one section, holding a `Field | Type | Unique | Notes` table, `Indices` and `Pending`.
|
|
14
|
-
> - For a field whose existence is a decision, link its ADR in `decisions.jsonl`, and do not restate the rationale.
|
|
15
|
-
|
|
16
|
-
<!-- bkit:end -->
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<!-- bkit:start -->
|
|
2
|
-
|
|
3
|
-
{{BKIT_MANAGED_MARKER}}
|
|
4
|
-
|
|
5
|
-
# Design
|
|
6
|
-
|
|
7
|
-
> [!CAUTION]
|
|
8
|
-
> **Purpose:** The design system: palette, typography, components, spacing, a11y and layout tokens.
|
|
9
|
-
>
|
|
10
|
-
> **Rules:**
|
|
11
|
-
>
|
|
12
|
-
> - Follow `.bkit/authoring.md` § All Agent-Read Files and § Docs when you edit this file.
|
|
13
|
-
> - Use theme tokens only, with no ad-hoc hex.
|
|
14
|
-
> - All colours must support Dark Mode.
|
|
15
|
-
> - Touch targets must be >=44x44px.
|
|
16
|
-
> - Contrast must meet WCAG 2.1 AA.
|
|
17
|
-
|
|
18
|
-
## Machine-checked reference
|
|
19
|
-
|
|
20
|
-
This table is the sole hand-maintained source for token values. Nothing generates it, so changing an expected value forces a human to restate the intent in the same PR diff. To keep the gate honest:
|
|
21
|
-
|
|
22
|
-
- **Select the table by its header row**, never by "any row containing a hex", because this doc may hold >1 hex table. Renaming the header renames the contract, so update the parser in the same change.
|
|
23
|
-
- **Assert each implementation separately** (stylesheet variables, theme object, rendered style guide), so a red names its own culprit.
|
|
24
|
-
- **No silent gap.** Every implementation token maps to a row here, or to an explicit "intentionally undocumented" entry with a reason. A dropped token must red, not vanish.
|
|
25
|
-
- **Transcribed != ratified.** A row read out of the implementation is tautological on day one, so mark it as transcribed until a human confirms the value is intended.
|
|
26
|
-
|
|
27
|
-
An example shape follows. Choose your own columns, then pin them, because the header row is the contract:
|
|
28
|
-
|
|
29
|
-
<!-- prettier-ignore -->
|
|
30
|
-
| Token | Light | Dark | Use |
|
|
31
|
-
| --- | --- | --- | --- |
|
|
32
|
-
| Background (`--background`) | `#FFFFFF` | `#0A0A0A` | Page surface |
|
|
33
|
-
| Foreground (`--foreground`) | `#181818` | `#F1EFEA` | Headings / body — 17.8:1 light, 17.2:1 dark (AAA) |
|
|
34
|
-
| Primary (`--primary`) | `#2563EB` | `#2563EB` | Aligned L+D — buttons / active. **Transcribed-not-ratified**: read from source, pending human confirmation |
|
|
35
|
-
|
|
36
|
-
Lane map, tagging, cache rules: `testing.md` § "Design assertions are a dimension, not a lane".
|
|
37
|
-
|
|
38
|
-
<!-- bkit:end -->
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!-- bkit:start -->
|
|
2
|
-
|
|
3
|
-
{{BKIT_MANAGED_MARKER}}
|
|
4
|
-
|
|
5
|
-
# Noise
|
|
6
|
-
|
|
7
|
-
> [!CAUTION]
|
|
8
|
-
> **Purpose:** The registry of intentional signal downgrades (log-level reductions, error-tracker issue archives / mutes, alert-threshold raises), each with its trigger and rationale.
|
|
9
|
-
>
|
|
10
|
-
> **Rules:**
|
|
11
|
-
>
|
|
12
|
-
> - Follow `.bkit/authoring.md` § All Agent-Read Files and § Docs when you edit this file.
|
|
13
|
-
> - This file is append-only.
|
|
14
|
-
> - Add one entry per downgraded file / line, archived issue or raised threshold.
|
|
15
|
-
> - Downgrade a signal only when its trigger is known / expected.
|
|
16
|
-
> - Record the trigger, not just the verdict.
|
|
17
|
-
> - Never silence a signal at its source. Log it at a lower level instead.
|
|
18
|
-
> - Archive or mute an issue only when it is captured here.
|
|
19
|
-
|
|
20
|
-
<!-- bkit:end -->
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<!-- bkit:start -->
|
|
2
|
-
|
|
3
|
-
{{BKIT_MANAGED_MARKER}}
|
|
4
|
-
|
|
5
|
-
# Observability
|
|
6
|
-
|
|
7
|
-
> [!CAUTION]
|
|
8
|
-
> **Purpose:** The project's logging architecture, correlation tracing, telemetry pipelines and log drains.
|
|
9
|
-
>
|
|
10
|
-
> **Rules:**
|
|
11
|
-
>
|
|
12
|
-
> - Follow `.bkit/authoring.md` § All Agent-Read Files and § Docs when you edit this file.
|
|
13
|
-
> - NEVER log PII. Scrub sensitive fields at the source.
|
|
14
|
-
> - Observability never blocks business logic.
|
|
15
|
-
|
|
16
|
-
## Context Fetch
|
|
17
|
-
|
|
18
|
-
Configure failure-evidence fetching for `/bkit-debug` (`context-fetch:*` blocks and cloud CLI provisioning) in `.agents/context.md`. `.bkit/templates/context/` holds ready-made blocks, one file per provider (`.bkit/templates.md` § Context-fetch blocks). Author and enable each context in `.agents/context.md`: `ci`, `diff`, `e2e`, `runtime` (default) and the optional `web`. bkit hardcodes no CI host, workflow filename, branch name, or e2e framework. A context with no enabled block is fetched for no run, and is reported `NOT CONFIGURED` on every attempt. The `context=web` search host ships in bkit's egress registry, so it needs no declaration. A block whose host is unreachable anyway self-skips, and the external signal is then `UNCHECKED`, never "no known upstream issue".
|
|
19
|
-
|
|
20
|
-
The workflow commits every captured payload inside an untrusted fence (`===== BEGIN UNTRUSTED =====` … `===== END UNTRUSTED =====`, with the data-only instruction above it), because fetched web / log / diff text is data, never instructions. A block emits no fence of its own, because two wraps read as one nested payload.
|
|
21
|
-
|
|
22
|
-
<!-- bkit:end -->
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
<!-- bkit:start -->
|
|
2
|
-
|
|
3
|
-
{{BKIT_MANAGED_MARKER}}
|
|
4
|
-
|
|
5
|
-
# Security
|
|
6
|
-
|
|
7
|
-
> [!CAUTION]
|
|
8
|
-
> **Purpose:** The project's authentication, authorization, input validation, rate limiting, secrets management and PII handling.
|
|
9
|
-
>
|
|
10
|
-
> **Rules:**
|
|
11
|
-
>
|
|
12
|
-
> - Follow `.bkit/authoring.md` § All Agent-Read Files and § Docs when you edit this file.
|
|
13
|
-
> - Auth standards live only here. Other docs link to this file and do not restate them.
|
|
14
|
-
|
|
15
|
-
## Supply-Chain (GitHub Actions)
|
|
16
|
-
|
|
17
|
-
Action SHA-pinning and the dependency-update pipeline (Renovate / Dependabot, Trivy scan, CVE handling) are described in `deployments.md` § Dependency updaters. This section holds the security invariants only.
|
|
18
|
-
|
|
19
|
-
**Token isolation:**
|
|
20
|
-
|
|
21
|
-
- Renovate PRs get a restricted `GITHUB_TOKEN`.
|
|
22
|
-
- They have no access to the cloud lane's model-auth secrets (`secrets.ANTHROPIC_API_KEY` / `secrets.OPENCODE_PROVIDER_KEY`).
|
|
23
|
-
- They have no access to federated Claude tokens either. Only a `bkit-cloud.yml` job that matches the federation rule mints those.
|
|
24
|
-
- `bkit-cloud.yml` does not dispatch on Renovate PRs.
|
|
25
|
-
- As a result, a compromised dependency PR cannot reach agent API credentials.
|
|
26
|
-
|
|
27
|
-
**Scanner isolation:** The CI vulnerability scanner (e.g. `bkit-trivy.yml`) runs with `contents: read`, `persist-credentials: false` and no secret. Its image or action is pinned by digest, never by a floating tag. Setup is in `.bkit/templates.md` § Trivy.
|
|
28
|
-
|
|
29
|
-
## Untrusted Content & Prompt Injection
|
|
30
|
-
|
|
31
|
-
**Threat model.** Every phase workflow combines three things:
|
|
32
|
-
|
|
33
|
-
- it ingests attacker-controlled text (commit messages, PR bodies, diffs, CI and runtime logs, web results, installed skill bodies)
|
|
34
|
-
- it holds a broad write token
|
|
35
|
-
- it can act (commit, push, merge, write files)
|
|
36
|
-
|
|
37
|
-
When all three are present, an embedded directive executes.
|
|
38
|
-
|
|
39
|
-
**Contract.** Follow `.agents/rules.md` § Security & Data, **External input** and **External skills**. Skill selection and permitted use are defined in `.agents/skills.md` § Activation Rules.
|
|
40
|
-
|
|
41
|
-
**Three layers, nearest the payload first:**
|
|
42
|
-
|
|
43
|
-
- **Fenced at the write.** A workflow that writes fetched external evidence to disk wraps it as it lands, in this order: instruction lines, `===== BEGIN UNTRUSTED =====`, the payload, `===== END UNTRUSTED =====`.
|
|
44
|
-
- The instruction comes before the payload, and nothing comes after the closer.
|
|
45
|
-
- The payload is wrapped once.
|
|
46
|
-
- First-party breadcrumbs are not fenced.
|
|
47
|
-
- Tracker bodies are not fenced, because they are the task specification. The header contract governs them.
|
|
48
|
-
- **Named on the spawn.** A subagent whose `Read:` list includes fenced artifacts is told so on its `Context:` line. That line is its last trusted instruction before it reads them.
|
|
49
|
-
- **Standing header contract.** Every agent prompt and workflow header carries both rules. They cover tool results (web search / fetch) that never become files, and skill bodies loaded by name.
|
|
50
|
-
|
|
51
|
-
**Per-file coverage is load-bearing.** Subagents spawn self-contained and never read `.agents/rules.md`. A rule placed only there reaches the orchestrating workflows but no leaf. The three registers exist by design. They are not redundant copies to collapse.
|
|
52
|
-
|
|
53
|
-
**No runtime telemetry.** "Flag injection attempts" produces no metric, log-grep or alert. Detection is a human reviewing the agent's output.
|
|
54
|
-
|
|
55
|
-
**Prose is defence-in-depth.** Prose is the layer an injection is designed to defeat. The load-bearing control is structural:
|
|
56
|
-
|
|
57
|
-
- give each job the narrowest-scoped token
|
|
58
|
-
- scan any text that reaches a privileged action (merge body, commit message)
|
|
59
|
-
|
|
60
|
-
Prose never substitutes for token scope.
|
|
61
|
-
|
|
62
|
-
<!-- bkit:end -->
|