@cbartens/bkit 0.0.0-stage → 5.0.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.
Files changed (373) hide show
  1. package/.bkit/README.md +421 -0
  2. package/.bkit/core/.agents/context.md +95 -0
  3. package/.bkit/core/.agents/docs.md +62 -0
  4. package/.bkit/core/.agents/rules.md +147 -0
  5. package/.bkit/core/.agents/skills.md +43 -0
  6. package/.bkit/core/.bkit/LICENSE.md +151 -0
  7. package/.bkit/core/.bkit/README.md +421 -0
  8. package/.bkit/core/.bkit/cloud.md +502 -0
  9. package/.bkit/core/.bkit/comparison.md +318 -0
  10. package/.bkit/core/.bkit/install.md +496 -0
  11. package/.bkit/core/.bkit/jsonl.md +497 -0
  12. package/.bkit/core/.bkit/prompts.md +474 -0
  13. package/.bkit/core/.bkit/providers.md +598 -0
  14. package/.bkit/core/.bkit/templates.md +471 -0
  15. package/.bkit/core/.bkit/trackers.md +95 -0
  16. package/.bkit/core/.bkit/workflows.md +1546 -0
  17. package/.bkit/core/.claude/hooks/bkit-gateguard.cjs +82 -0
  18. package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +93 -0
  19. package/.bkit/core/.claude/hooks/bkit-preflight.sh +74 -0
  20. package/.bkit/core/.codex/hooks/bkit-gateguard.cjs +115 -0
  21. package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +135 -0
  22. package/.bkit/core/.cursor/hooks/bkit-gateguard.cjs +111 -0
  23. package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +169 -0
  24. package/.bkit/core/.cursor/hooks/bkit-preflight.sh +63 -0
  25. package/.bkit/core/.opencode/plugin/bkit-gateguard.js +225 -0
  26. package/.bkit/core/AGENTS.md +77 -0
  27. package/.bkit/core/LICENSE.md +149 -0
  28. package/.bkit/core/docs/templates/bkit-audit-accessibility.md +272 -0
  29. package/.bkit/core/docs/templates/bkit-audit-adoption.md +223 -0
  30. package/.bkit/core/docs/templates/bkit-audit-agents.md +230 -0
  31. package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +227 -0
  32. package/.bkit/core/docs/templates/bkit-audit-analytics.md +266 -0
  33. package/.bkit/core/docs/templates/bkit-audit-annotations.md +230 -0
  34. package/.bkit/core/docs/templates/bkit-audit-app-performance.md +270 -0
  35. package/.bkit/core/docs/templates/bkit-audit-app-store.md +254 -0
  36. package/.bkit/core/docs/templates/bkit-audit-architecture.md +221 -0
  37. package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +241 -0
  38. package/.bkit/core/docs/templates/bkit-audit-config.md +230 -0
  39. package/.bkit/core/docs/templates/bkit-audit-cost.md +218 -0
  40. package/.bkit/core/docs/templates/bkit-audit-coverage.md +221 -0
  41. package/.bkit/core/docs/templates/bkit-audit-database.md +229 -0
  42. package/.bkit/core/docs/templates/bkit-audit-dead-code.md +251 -0
  43. package/.bkit/core/docs/templates/bkit-audit-deferrals.md +283 -0
  44. package/.bkit/core/docs/templates/bkit-audit-dependencies.md +268 -0
  45. package/.bkit/core/docs/templates/bkit-audit-documentation.md +280 -0
  46. package/.bkit/core/docs/templates/bkit-audit-duplication.md +253 -0
  47. package/.bkit/core/docs/templates/bkit-audit-failures.md +259 -0
  48. package/.bkit/core/docs/templates/bkit-audit-flakes.md +237 -0
  49. package/.bkit/core/docs/templates/bkit-audit-gates.md +250 -0
  50. package/.bkit/core/docs/templates/bkit-audit-issues.md +273 -0
  51. package/.bkit/core/docs/templates/bkit-audit-llm.md +239 -0
  52. package/.bkit/core/docs/templates/bkit-audit-logs.md +266 -0
  53. package/.bkit/core/docs/templates/bkit-audit-models.md +210 -0
  54. package/.bkit/core/docs/templates/bkit-audit-privacy.md +211 -0
  55. package/.bkit/core/docs/templates/bkit-audit-prompts.md +216 -0
  56. package/.bkit/core/docs/templates/bkit-audit-red-team.md +220 -0
  57. package/.bkit/core/docs/templates/bkit-audit-reliability.md +222 -0
  58. package/.bkit/core/docs/templates/bkit-audit-repo.md +224 -0
  59. package/.bkit/core/docs/templates/bkit-audit-security.md +274 -0
  60. package/.bkit/core/docs/templates/bkit-audit-slop.md +200 -0
  61. package/.bkit/core/docs/templates/bkit-audit-testing.md +270 -0
  62. package/.bkit/core/docs/templates/bkit-audit-usability.md +237 -0
  63. package/.bkit/core/docs/templates/bkit-plan.md +476 -0
  64. package/.bkit/core/engine/checks/after/auth.ts +247 -0
  65. package/.bkit/core/engine/checks/after/ci-yml.ts +739 -0
  66. package/.bkit/core/engine/checks/after/github.ts +424 -0
  67. package/.bkit/core/engine/checks/after/index.ts +556 -0
  68. package/.bkit/core/engine/checks/after/managed.ts +217 -0
  69. package/.bkit/core/engine/checks/after/tools.ts +427 -0
  70. package/.bkit/core/engine/checks/after/vercel.ts +101 -0
  71. package/.bkit/core/engine/checks/before/context-fetch.ts +429 -0
  72. package/.bkit/core/engine/checks/before/env.ts +201 -0
  73. package/.bkit/core/engine/checks/before/files.ts +202 -0
  74. package/.bkit/core/engine/checks/before/index.ts +206 -0
  75. package/.bkit/core/engine/checks/before/mcp.ts +127 -0
  76. package/.bkit/core/engine/checks/before/repo.ts +77 -0
  77. package/.bkit/core/engine/checks/before/version.ts +67 -0
  78. package/.bkit/core/engine/checks/status-holes.ts +479 -0
  79. package/.bkit/core/engine/cli.ts +871 -0
  80. package/.bkit/core/engine/commands/analysis.ts +550 -0
  81. package/.bkit/core/engine/commands/ci/ci.ts +483 -0
  82. package/.bkit/core/engine/commands/comply.ts +415 -0
  83. package/.bkit/core/engine/commands/harvest.ts +459 -0
  84. package/.bkit/core/engine/commands/install/check.ts +70 -0
  85. package/.bkit/core/engine/commands/install/doctor.ts +247 -0
  86. package/.bkit/core/engine/commands/install/install.ts +528 -0
  87. package/.bkit/core/engine/commands/install/uninstall.ts +972 -0
  88. package/.bkit/core/engine/commands/install/upgrade.ts +1026 -0
  89. package/.bkit/core/engine/commands/launch.ts +139 -0
  90. package/.bkit/core/engine/commands/lib.ts +494 -0
  91. package/.bkit/core/engine/commands/registry.ts +53 -0
  92. package/.bkit/core/engine/commands/setup/setup.ts +184 -0
  93. package/.bkit/core/engine/commands/telemetry.ts +32 -0
  94. package/.bkit/core/engine/commands/workflow/branches.ts +1514 -0
  95. package/.bkit/core/engine/commands/workflow/context.ts +961 -0
  96. package/.bkit/core/engine/commands/workflow/counters.ts +268 -0
  97. package/.bkit/core/engine/commands/workflow/fids.ts +243 -0
  98. package/.bkit/core/engine/commands/workflow/issues.ts +675 -0
  99. package/.bkit/core/engine/commands/workflow/ledgers.ts +575 -0
  100. package/.bkit/core/engine/commands/workflow/locks.ts +478 -0
  101. package/.bkit/core/engine/commands/workflow/prs.ts +1087 -0
  102. package/.bkit/core/engine/commands/workflow/repo.ts +220 -0
  103. package/.bkit/core/engine/commands/workflow/roadmap.ts +576 -0
  104. package/.bkit/core/engine/commands/workflow/runs.ts +2140 -0
  105. package/.bkit/core/engine/commands/workflow/runtime.ts +300 -0
  106. package/.bkit/core/engine/commands/workflow/skills.ts +118 -0
  107. package/.bkit/core/engine/commands/workflow/status.ts +455 -0
  108. package/.bkit/core/engine/commands/workflow/steps.ts +1300 -0
  109. package/.bkit/core/engine/commands/workflow/tests.ts +161 -0
  110. package/.bkit/core/engine/commands/workflow/workflows.ts +1573 -0
  111. package/.bkit/core/engine/commands/workflow/workstreams.ts +164 -0
  112. package/.bkit/core/engine/commands/workflow/worktrees.ts +534 -0
  113. package/.bkit/core/engine/install/cloud-env.ts +925 -0
  114. package/.bkit/core/engine/install/managed-block.ts +212 -0
  115. package/.bkit/core/engine/install/manifest.ts +448 -0
  116. package/.bkit/core/engine/install/modules/claude.ts +362 -0
  117. package/.bkit/core/engine/install/modules/cloud.ts +174 -0
  118. package/.bkit/core/engine/install/modules/codex.ts +219 -0
  119. package/.bkit/core/engine/install/modules/core.ts +600 -0
  120. package/.bkit/core/engine/install/modules/cursor.ts +231 -0
  121. package/.bkit/core/engine/install/modules/index.ts +242 -0
  122. package/.bkit/core/engine/install/modules/opencode.ts +573 -0
  123. package/.bkit/core/engine/install/placeholders.ts +108 -0
  124. package/.bkit/core/engine/install/template-copies.ts +119 -0
  125. package/.bkit/core/engine/install/version-file.ts +284 -0
  126. package/.bkit/core/engine/install/write.ts +467 -0
  127. package/.bkit/core/engine/ledgers/clamp-log.ts +32 -0
  128. package/.bkit/core/engine/ledgers/status.ts +213 -0
  129. package/.bkit/core/engine/ledgers/telemetry.ts +1143 -0
  130. package/.bkit/core/engine/render/hosts.ts +372 -0
  131. package/.bkit/core/engine/render/models.ts +323 -0
  132. package/.bkit/core/engine/render/parts.ts +38 -0
  133. package/.bkit/core/engine/render/trackers.ts +170 -0
  134. package/.bkit/core/engine/shared/egress.ts +345 -0
  135. package/.bkit/core/engine/shared/json.ts +16 -0
  136. package/.bkit/core/engine/shared/log-prefix.ts +9 -0
  137. package/.bkit/core/engine/shared/package-json.ts +29 -0
  138. package/.bkit/core/engine/shared/package-manager.ts +38 -0
  139. package/.bkit/core/engine/shared/package-roots.ts +163 -0
  140. package/.bkit/core/engine/shared/protected-paths.ts +164 -0
  141. package/.bkit/core/engine/shared/settings.ts +72 -0
  142. package/.bkit/core/engine/shared/timeouts.ts +20 -0
  143. package/.bkit/core/engine/tools/wording.ts +748 -0
  144. package/.bkit/core/hooks/gateguard-edit-payload.js +18 -0
  145. package/.bkit/core/hooks/gateguard-engine.js +193 -0
  146. package/.bkit/core/hooks/guardrails-shell.js +154 -0
  147. package/.bkit/core/hooks/guardrails-tiers.js +68 -0
  148. package/.bkit/core/hooks/preflight-linear.sh +73 -0
  149. package/.bkit/core/prompts/bkit-audit-generate.md +66 -0
  150. package/.bkit/core/prompts/bkit-build-challenge-1.md +79 -0
  151. package/.bkit/core/prompts/bkit-build-challenge-2.md +81 -0
  152. package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +68 -0
  153. package/.bkit/core/prompts/bkit-build-challenge-remediate.md +70 -0
  154. package/.bkit/core/prompts/bkit-build-challenge-tests.md +73 -0
  155. package/.bkit/core/prompts/bkit-build-install-skills.md +67 -0
  156. package/.bkit/core/prompts/bkit-build-plan-current.md +75 -0
  157. package/.bkit/core/prompts/bkit-build-plan-execute.md +72 -0
  158. package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +73 -0
  159. package/.bkit/core/prompts/bkit-build-plan-verify.md +88 -0
  160. package/.bkit/core/prompts/bkit-build-summary.md +93 -0
  161. package/.bkit/core/prompts/bkit-debug-abort-handover.md +90 -0
  162. package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +151 -0
  163. package/.bkit/core/prompts/bkit-debug-failure-remediate.md +78 -0
  164. package/.bkit/core/prompts/bkit-debug-failure-soak.md +73 -0
  165. package/.bkit/core/prompts/bkit-debug-summary.md +95 -0
  166. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +72 -0
  167. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +72 -0
  168. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +75 -0
  169. package/.bkit/core/prompts/bkit-design-generate.md +110 -0
  170. package/.bkit/core/prompts/bkit-design-organise.md +85 -0
  171. package/.bkit/core/prompts/bkit-design-review-1.md +121 -0
  172. package/.bkit/core/prompts/bkit-design-review-2.md +111 -0
  173. package/.bkit/core/prompts/bkit-design-spike.md +97 -0
  174. package/.bkit/core/prompts/bkit-design-summary.md +106 -0
  175. package/.bkit/core/prompts/bkit-design-update.md +66 -0
  176. package/.bkit/core/prompts/bkit-plan-complexity-check.md +66 -0
  177. package/.bkit/core/prompts/bkit-plan-complexity-split.md +87 -0
  178. package/.bkit/core/prompts/bkit-plan-generate.md +74 -0
  179. package/.bkit/core/prompts/bkit-plan-review-1.md +90 -0
  180. package/.bkit/core/prompts/bkit-plan-review-2.md +80 -0
  181. package/.bkit/core/prompts/bkit-plan-review-3.md +92 -0
  182. package/.bkit/core/prompts/bkit-plan-scope-check-1.md +84 -0
  183. package/.bkit/core/prompts/bkit-plan-scope-check-2.md +84 -0
  184. package/.bkit/core/prompts/bkit-plan-summary.md +106 -0
  185. package/.bkit/core/prompts/bkit-plan-update.md +68 -0
  186. package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +90 -0
  187. package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +94 -0
  188. package/.bkit/core/prompts/bkit-ship-summary.md +77 -0
  189. package/.bkit/core/prompts/bkit-ship-update-docs.md +71 -0
  190. package/.bkit/core/prompts/bkit-utility-compress-markdown.md +91 -0
  191. package/.bkit/core/prompts/bkit-utility-update-decisions.md +75 -0
  192. package/.bkit/core/prompts/bkit-utility-update-deferrals.md +76 -0
  193. package/.bkit/core/prompts/bkit-utility-update-documentation.md +61 -0
  194. package/.bkit/core/prompts/bkit-utility-update-failures.md +76 -0
  195. package/.bkit/core/prompts/bkit-utility-update-knowledge.md +75 -0
  196. package/.bkit/core/prompts/bkit-utility-update-roadmap.md +82 -0
  197. package/.bkit/core/workflows/bkit-auto.md +121 -0
  198. package/.bkit/core/workflows/bkit-build.md +802 -0
  199. package/.bkit/core/workflows/bkit-debug.md +642 -0
  200. package/.bkit/core/workflows/bkit-design.md +495 -0
  201. package/.bkit/core/workflows/bkit-plan.md +510 -0
  202. package/.bkit/core/workflows/bkit-ship.md +650 -0
  203. package/.bkit/shared/.bkit/.env.example +108 -0
  204. package/.bkit/shared/.claude/bkit-cloud.md +117 -0
  205. package/.bkit/shared/.claude/settings.json +88 -0
  206. package/.bkit/shared/.codex/hooks.json +26 -0
  207. package/.bkit/shared/.cursor/bkit-cloud.md +84 -0
  208. package/.bkit/shared/.cursor/hooks.json +26 -0
  209. package/.bkit/shared/.cursor/mcp.json +15 -0
  210. package/.bkit/shared/.cursor/rules/bkit-rules.mdc +12 -0
  211. package/.bkit/shared/.gitattributes +37 -0
  212. package/.bkit/shared/.mcp.json +16 -0
  213. package/.bkit/shared/.opencode/opencode.json +62 -0
  214. package/.bkit/shared/CLAUDE.md +11 -0
  215. package/.bkit/shared/LICENSE.md +22 -0
  216. package/.bkit/shared/docs/architecture.md +19 -0
  217. package/.bkit/shared/docs/data-schema.md +19 -0
  218. package/.bkit/shared/docs/deployments.md +438 -0
  219. package/.bkit/shared/docs/design.md +39 -0
  220. package/.bkit/shared/docs/noise.md +19 -0
  221. package/.bkit/shared/docs/observability.md +25 -0
  222. package/.bkit/shared/docs/security.md +42 -0
  223. package/.bkit/shared/docs/setup.md +30 -0
  224. package/.bkit/shared/docs/technology.md +18 -0
  225. package/.bkit/shared/docs/testing.md +413 -0
  226. package/.bkit/shared/gitignore +92 -0
  227. package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +192 -0
  228. package/.bkit/templates/.cursor/Dockerfile +68 -0
  229. package/.bkit/templates/.cursor/environment.json +6 -0
  230. package/.bkit/templates/.cursor/settings.json +11 -0
  231. package/.bkit/templates/.envrc +7 -0
  232. package/.bkit/templates/.github/dependabot.yml +52 -0
  233. package/.bkit/templates/.github/renovate.json5 +239 -0
  234. package/.bkit/templates/.github/workflows/bkit-ci.yml +1082 -0
  235. package/.bkit/templates/.github/workflows/bkit-cloud.yml +566 -0
  236. package/.bkit/templates/.github/workflows/bkit-renovate.yml +107 -0
  237. package/.bkit/templates/.graphifyignore +108 -0
  238. package/.bkit/templates/.husky/pre-commit +16 -0
  239. package/.bkit/templates/.husky/pre-push +91 -0
  240. package/.bkit/templates/.lintstagedrc.json +3 -0
  241. package/.bkit/templates/.prettierignore +41 -0
  242. package/.bkit/templates/.serena/project.yml +243 -0
  243. package/.bkit/templates/.vale/styles/House/Filler.yml +11 -0
  244. package/.bkit/templates/.vale/styles/House/Hedging.yml +12 -0
  245. package/.bkit/templates/.vale/styles/House/LLMSlop.yml +13 -0
  246. package/.bkit/templates/.vale/styles/House/Verbose.yml +12 -0
  247. package/.bkit/templates/.vale.ini +67 -0
  248. package/.bkit/templates/LICENSE.md +22 -0
  249. package/.bkit/templates/context/bkit-cloudrun.md +84 -0
  250. package/.bkit/templates/context/bkit-expo.md +186 -0
  251. package/.bkit/templates/context/bkit-github.md +79 -0
  252. package/.bkit/templates/context/bkit-inngest.md +45 -0
  253. package/.bkit/templates/context/bkit-maestro.md +76 -0
  254. package/.bkit/templates/context/bkit-playwright.md +62 -0
  255. package/.bkit/templates/context/bkit-resend.md +36 -0
  256. package/.bkit/templates/context/bkit-sentry.md +65 -0
  257. package/.bkit/templates/context/bkit-serena.md +33 -0
  258. package/.bkit/templates/context/bkit-stripe.md +36 -0
  259. package/.bkit/templates/context/bkit-supabase.md +59 -0
  260. package/.bkit/templates/context/bkit-tavily.md +49 -0
  261. package/.bkit/templates/context/bkit-vercel.md +64 -0
  262. package/.bkit/templates/docs/capabilities.md +72 -0
  263. package/.bkit/templates/scripts/ci/accepted-divergences.json +21 -0
  264. package/.bkit/templates/scripts/ci/check-accepted-divergences.mjs +152 -0
  265. package/.bkit/templates/scripts/ci/check-accepted-divergences.test.mjs +130 -0
  266. package/.bkit/templates/scripts/ci/lanes/resolve-push-base.mjs +98 -0
  267. package/.bkit/templates/scripts/ci/lanes/resolve-push-base.test.mjs +86 -0
  268. package/.bkit/templates/scripts/graphify/bkit-graph-drift-rules.json +23 -0
  269. package/.bkit/templates/scripts/graphify/bkit-graph-drift.py +208 -0
  270. package/.bkit/templates/scripts/graphify/bkit-graph-eager-rules.json +35 -0
  271. package/.bkit/templates/scripts/graphify/bkit-graph-eager.py +236 -0
  272. package/.bkit/templates/scripts/graphify/bkit-graph-external-rules.json +17 -0
  273. package/.bkit/templates/scripts/graphify/bkit-graph-imports.py +290 -0
  274. package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +19 -0
  275. package/.bkit/templates/scripts/graphify/bkit-graph-repair.py +120 -0
  276. package/.bkit/templates/scripts/graphify/bkit-graph-surface.py +232 -0
  277. package/.bkit/templates/scripts/graphify/bkit-graphify-graphml.py +36 -0
  278. package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +927 -0
  279. package/.bkit/templates/scripts/graphify/bkit-graphify.sh +351 -0
  280. package/.bkit/templates/scripts/launchd/ai.bkit.launchd.plist +26 -0
  281. package/.bkit/templates/scripts/launchd/bkit-launchd-env.sh +53 -0
  282. package/.bkit/templates/scripts/launchd/launchd.env.example +13 -0
  283. package/.bkit/templates/scripts/prettier/bkit-insert-ignore.mjs +275 -0
  284. package/.bkit/templates/scripts/secrets/bkit-secrets.config.mjs +66 -0
  285. package/.bkit/templates/scripts/secrets/bkit-secrets.mjs +785 -0
  286. package/.bkit/templates/scripts/serena/bkit-serena-mcp.sh +30 -0
  287. package/.bkit/templates/scripts/serena/bkit-serena.mcp.json +9 -0
  288. package/.bkit/templates/scripts/slop/bkit-slop-type-suppression.mjs +286 -0
  289. package/.bkit/templates/slop-scan.config.json +120 -0
  290. package/CHANGELOG.md +1486 -0
  291. package/LICENSE.md +161 -0
  292. package/README.md +185 -2
  293. package/dist/checks/after/auth.js +232 -0
  294. package/dist/checks/after/ci-yml.js +718 -0
  295. package/dist/checks/after/github.js +400 -0
  296. package/dist/checks/after/index.js +447 -0
  297. package/dist/checks/after/managed.js +187 -0
  298. package/dist/checks/after/tools.js +351 -0
  299. package/dist/checks/after/vercel.js +102 -0
  300. package/dist/checks/before/context-fetch.js +426 -0
  301. package/dist/checks/before/env.js +173 -0
  302. package/dist/checks/before/files.js +185 -0
  303. package/dist/checks/before/index.js +162 -0
  304. package/dist/checks/before/mcp.js +111 -0
  305. package/dist/checks/before/repo.js +71 -0
  306. package/dist/checks/before/version.js +60 -0
  307. package/dist/checks/status-holes.js +393 -0
  308. package/dist/cli.js +692 -0
  309. package/dist/commands/analysis.js +325 -0
  310. package/dist/commands/ci/ci.js +438 -0
  311. package/dist/commands/comply.js +310 -0
  312. package/dist/commands/harvest.js +354 -0
  313. package/dist/commands/install/check.js +61 -0
  314. package/dist/commands/install/doctor.js +207 -0
  315. package/dist/commands/install/install.js +461 -0
  316. package/dist/commands/install/uninstall.js +815 -0
  317. package/dist/commands/install/upgrade.js +771 -0
  318. package/dist/commands/launch.js +118 -0
  319. package/dist/commands/lib.js +362 -0
  320. package/dist/commands/registry.js +50 -0
  321. package/dist/commands/setup/setup.js +158 -0
  322. package/dist/commands/telemetry.js +29 -0
  323. package/dist/commands/workflow/branches.js +1265 -0
  324. package/dist/commands/workflow/context.js +846 -0
  325. package/dist/commands/workflow/counters.js +227 -0
  326. package/dist/commands/workflow/fids.js +224 -0
  327. package/dist/commands/workflow/issues.js +585 -0
  328. package/dist/commands/workflow/ledgers.js +472 -0
  329. package/dist/commands/workflow/locks.js +364 -0
  330. package/dist/commands/workflow/prs.js +904 -0
  331. package/dist/commands/workflow/repo.js +199 -0
  332. package/dist/commands/workflow/roadmap.js +495 -0
  333. package/dist/commands/workflow/runs.js +1717 -0
  334. package/dist/commands/workflow/runtime.js +257 -0
  335. package/dist/commands/workflow/skills.js +110 -0
  336. package/dist/commands/workflow/status.js +392 -0
  337. package/dist/commands/workflow/steps.js +1093 -0
  338. package/dist/commands/workflow/tests.js +144 -0
  339. package/dist/commands/workflow/workflows.js +1342 -0
  340. package/dist/commands/workflow/workstreams.js +141 -0
  341. package/dist/commands/workflow/worktrees.js +473 -0
  342. package/dist/install/cloud-env.js +819 -0
  343. package/dist/install/managed-block.js +182 -0
  344. package/dist/install/manifest.js +376 -0
  345. package/dist/install/modules/claude.js +288 -0
  346. package/dist/install/modules/cloud.js +152 -0
  347. package/dist/install/modules/codex.js +193 -0
  348. package/dist/install/modules/core.js +511 -0
  349. package/dist/install/modules/cursor.js +186 -0
  350. package/dist/install/modules/index.js +152 -0
  351. package/dist/install/modules/opencode.js +504 -0
  352. package/dist/install/placeholders.js +87 -0
  353. package/dist/install/template-copies.js +106 -0
  354. package/dist/install/version-file.js +204 -0
  355. package/dist/install/write.js +342 -0
  356. package/dist/ledgers/clamp-log.js +27 -0
  357. package/dist/ledgers/status.js +156 -0
  358. package/dist/ledgers/telemetry.js +637 -0
  359. package/dist/render/hosts.js +339 -0
  360. package/dist/render/models.js +288 -0
  361. package/dist/render/parts.js +33 -0
  362. package/dist/render/trackers.js +135 -0
  363. package/dist/shared/egress.js +299 -0
  364. package/dist/shared/json.js +16 -0
  365. package/dist/shared/log-prefix.js +7 -0
  366. package/dist/shared/package-json.js +22 -0
  367. package/dist/shared/package-manager.js +32 -0
  368. package/dist/shared/package-roots.js +145 -0
  369. package/dist/shared/protected-paths.js +153 -0
  370. package/dist/shared/settings.js +44 -0
  371. package/dist/shared/timeouts.js +19 -0
  372. package/dist/tools/wording.js +680 -0
  373. package/package.json +101 -4
@@ -0,0 +1,250 @@
1
+ <!-- Note: Reports live at `docs/audits/{YYYYMM}/{slug}.md`. `{YYYYMM}` = UTC month of this run. `{slug}` = template basename without `bkit-audit-` and `.md`. **If** that month already has `{slug}.md` or `{slug}-{TIMESTAMP}.md` → write `{slug}-{TIMESTAMP}.md` (`{TIMESTAMP}` = `date -u +%Y%m%dT%H%M%SZ`). Never overwrite. `@bkit-audit-generate` fills this template. -->
2
+
3
+ <!-- bkit:start -->
4
+
5
+ {{BKIT_MANAGED_MARKER}}
6
+
7
+ # Gate Candidates
8
+
9
+ > [!CAUTION]
10
+ > **Purpose:** Ranking of which detective audit sweeps can become preventive gates, in what order, and which must stay audits.
11
+ >
12
+ > **Rules:**
13
+ >
14
+ > - Read-only audit; never edit code, config, or data.
15
+ > - `Universal Instructions` apply to all projects; `Project Instructions` apply only to this project.
16
+ > - Local audit instructions / overrides → `Project Instructions` below the bkit-managed block; universal instructions stay in-block.
17
+ > - Any tools mentioned in `Universal Instructions` are examples only; swap for actual tools in final output; drop inapplicable.
18
+ > - Use dense token-efficient phrasing; no filler / hedging / restating; tables > prose, bullets > paragraphs.
19
+ > - Read `.agents/docs.md` → load docs for workflow / step / task; skip missing; cite docs inline where required.
20
+ > - Every claim cites evidence (`file:line`, or command / query and its output) and tool behind it.
21
+ > - Read this document once at session start; do not trust session memory; do not re-read on every loop iteration.
22
+ > - never build, wire, or land a gate; never edit workflows, hooks, allowlists, or gate scripts.
23
+ > - NEVER weaken an existing gate — no skip, rule downgrade, lowered floor, or broader ignore — so a candidate looks adoptable.
24
+
25
+ ## Universal Instructions
26
+
27
+ ### Context & Goals
28
+
29
+ Maintenance sweeps find breakage; none prevent the next. Sibling audits repeat “make it a gate”; an unscheduled sweep is not a control, even when the sweep is the stated prevention. Converting checks costs: day-one red on unencoded noise → gate disabled; wrong altitude (one rule where the class needs a guard per case) → reverted. This pass ranks candidates; it does not build gates. **Stays an audit** is a valid verdict.
30
+
31
+ **Applies when:** at least one detective audit exists, and a CI job, hook, or test could block a class before merge. None → one `N/A` row with evidence, never "clean".
32
+
33
+ **Cadence:** quarterly. Extra pass when a sibling audit's `Process Improvements` proposes a new gate, or `bkit-audit-failures` names a recurring root-cause class as a gate candidate.
34
+
35
+ **Anchor Standards:** record version and date read. Newer version → `Standards` step reads what changed.
36
+
37
+ - Fitness functions (e.g. Ford, Parsons, Kua, and Sadalage, _Building Evolutionary Architectures_, 2nd ed.).
38
+ - Static-analysis review bar (e.g. Tricorder: under 10% effective false positives, and an actionable message; Sadowski et al., Communications of the ACM, 2018).
39
+ - Quality gates on new code (e.g. SonarQube Clean as You Code).
40
+ - Ratchet and baseline tools (e.g. Betterer; reviewdog `filter_mode: added`).
41
+ - Policy as code (e.g. Conftest / OPA; JSON Schema).
42
+ - Required status checks and a merge queue (e.g. GitHub rulesets).
43
+ - OpenSSF Scorecard checks, at the Scorecard version read.
44
+ - DORA continuous integration capability.
45
+
46
+ ### Scope
47
+
48
+ - Candidates from sibling audits, repeat defects, and standard gates nobody proposed.
49
+ - Score, disqualify, tier, moment, enforcement point, positive control, and report-only bar.
50
+ - Health of gates that already landed.
51
+ - Allowlist and ratchet-baseline expiry.
52
+ - Re-review of gates that were reverted or rejected.
53
+
54
+ ### Out of Scope
55
+
56
+ <!-- prettier-ignore -->
57
+ | Excluded item | Why | Where it belongs |
58
+ | --- | --- | --- |
59
+ | Running a sibling sweep, or clearing what it found | That audit | source `bkit-audit-*` |
60
+ | Building, wiring, or landing a gate, including workflow and allowlist edits | Audit reports only | Plan from this report |
61
+
62
+ ### Verdicts
63
+
64
+ One per candidate.
65
+
66
+ - **ADOPT:** passes every `Score` axis and no `Disqualify` item holds. Its rank sets its place in the order. The report names the tracker issue to open and the `docs/decisions.jsonl` row to append. Opening and appending are the next step.
67
+ - **REJECT:** fails a `Score` axis, or a `Disqualify` item holds. It stays an audit. Record why, so a later run can see when the reason stops holding.
68
+ - **OTHER:** fits neither (waiting on a decision or a tool). Say why, and what would settle it. The next run resolves it to ADOPT or REJECT. The same OTHER on 2 runs → propose a new verdict in `Process Improvements`.
69
+
70
+ ### Pre-Flight / Dependencies
71
+
72
+ **Checkpoint:** Check off all core items. Check conditional items only when applicable. Each item: available → tool and version; missing → fallback, gap in `Not Checked`, fix in `Process Improvements`. Unnamed gap reads as passed. never abort for a missing capability.
73
+
74
+ #### Core
75
+
76
+ Always verify.
77
+
78
+ - [ ] **Sibling Reports:** Steps 2, 3 — newest report per other `bkit-audit-*` slug under `docs/audits/`, else that template's `Process Improvements`. Fallback: templates only; a missing report = that audit `Not Checked`.
79
+ - [ ] **Ledgers:** Steps 3, 10, 11 — `docs/failures.jsonl`, `docs/decisions.jsonl`, `docs/deferrals.jsonl`. Fallback: incident evidence and prior rejections `Not Checked`.
80
+ - [ ] **Repo Gates:** Steps 7, 9, 12, 13, 15 — workflows, hook directory, gate scripts, allowlist files, e.g. `.github/workflows`, `.husky`, `.gitlab-ci.yml`, every `bkit:gate:*` script in `package.json`. Fallback: none; those items `Not Checked`.
81
+ - [ ] **Web:** Step 14 — fetch anchor standards. Fallback: versions recorded as unread.
82
+
83
+ #### Conditional
84
+
85
+ Verify only when applicable.
86
+
87
+ - [ ] **Ruleset Read:** Host exposes branch rules → Step 7 — required checks and bypass actors, e.g. `gh api` rulesets, GitLab protected branches. Fallback: workflow and hook files only; bypass actors `Not Checked`.
88
+ - [ ] **Run History:** A gate has already landed → Step 12 — how often it fired, e.g. `gh run list`, CI analytics. Fallback: code reading only; fire rate `Not Checked`.
89
+ - [ ] **Scorecard:** Repo is public, or a token is present → Steps 3, 14 — e.g. `scorecard`. Fallback: read the check list; live score `Not Checked`.
90
+
91
+ ### 🔒 Gate 1: Prerequisites Check
92
+
93
+ **Checkpoint.** Verify and check `[x]` all applicable boxes above, then continue to `Probe Steps` without asking.
94
+
95
+ - [ ] **Gaps named:** every missing item names its fallback and `Not Checked` entry.
96
+ - [ ] **Gate 1 - Verified:** All Core items checked. All applicable Conditional items checked.
97
+
98
+ ### Probe Steps
99
+
100
+ - [ ] **Step 1 — Previous Run:** Record `git rev-parse HEAD`. Read newest prior report for this slug under `docs/audits/`. Count findings fixed / still open; age of oldest open. Open after 2 runs → re-raise with age. **Done when:** closure rate in `Previous Run`, or run marked baseline.
101
+ - [ ] **Step 2 — Inventory:** Collect gate candidates from each other `bkit-audit-*` report's `Process Improvements` (else that template's), without re-deriving. Record source slug. Two audits proposing one guard = one candidate, both sources — not two work items. Re-grep of a swept class + owner-allowlist over same literals = one guard. **Done when:** `Inventory` row per candidate: source slug · one-line guard.
102
+ - [ ] **Step 3 — Widen:** Sibling sections are one source. Also add, record source each: (a) every defect class in `docs/failures.jsonl` on ≥2 rows, whether or not a sibling proposed a gate; (b) standard gates nobody proposed, each vs tree — secret-scanning push protection, code scanning (e.g. CodeQL), dependency-review check, workflow linters (e.g. `actionlint`, `zizmor`), lockfile lint, test-runner forbid-only flag (e.g. Playwright `--forbid-only`), typechecking of test files, OpenSSF Scorecard checks; (c) policy-as-code for config with no type system (e.g. JSON Schema, Conftest) — bot config, job-runner triggers and concurrency, hosting config, mobile build config, workflow YAML. Class (c) is what `bkit-audit-testing` flags. Already enforced → `Health`, not a second candidate. **Done when:** every added row in `Inventory` with source.
103
+ - [ ] **Step 4 — Score:** Per candidate, six axes. Fails if fail condition holds.
104
+ - **Determinism.** Can a machine decide pass/fail with no judgement? Fails if the verdict needs someone to read intent.
105
+ - **False-positive class.** Empty, a fixed allowlist, or structural? Fails if structural and unencoded.
106
+ - **Incident evidence.** Has this class shipped a defect here? Fails if purely theoretical.
107
+ - **Home lane.** Does a lane already exist to run it? Fails if it needs new infrastructure or an unavailable tool.
108
+ - **Cost.** Runtime per change + developer wait and upkeep (baseline maintenance, version bumps). Fails if slower than the value it returns.
109
+ - **Actionability.** Does failure say what to change and where (`file:line` plus fix)? Fails if developer must investigate. Deterministic but cryptic gate is bypassed as fast as a noisy one.
110
+
111
+ Rank by incident evidence × determinism ÷ effort. Prefer candidate with real incident over merely tidy. **Done when:** `Scores` holds six answers, rank, and fail axes.
112
+
113
+ - [ ] **Step 5 — Disqualify:** Candidate stays audit if any hold:
114
+ 1. **Judgement is the task.** Examples: log line that is bug or handled outcome; deferral that may still be live (`bkit-audit-deferrals`); duplication or two deliberately different decisions (`bkit-audit-duplication`). No gate decides these.
115
+ 2. **The false-positive class is structural and unencoded.** Gate only after exclusions committed as config. Default sequence, per `bkit-audit-dead-code`: clear findings → commit baseline → wire lane. Where clearing is >1 PR, ratchet (`Sequence`) may wire lane first: committed baseline holds existing findings; gate enforces on new ones.
116
+ 3. **The tool cannot run in CI.** Local-only graph tool with no CI provisioning (e.g. graphify) blocks graph-derived gate until that changes or check is reimplemented without it.
117
+
118
+ **Done when:** each holding disqualifier named in `Scores`.
119
+
120
+ - [ ] **Step 6 — Tier:** Lowest tier that can see the defect. Pushing check down a tier → faster, earlier, less flaky. Rule that can be unit test should never be end-to-end spec. Ratchet (`Sequence`) at any tier; changes what gate compares against, not where it runs.
121
+ - **Unit / contract test.** Rule computable from source constants. Example: contrast over a palette.
122
+ - **Static.** Signature is a literal. Example: env reachability, swept-class re-grep, migration hygiene.
123
+ - **Migration lane.** Truth in database catalogue. Example: row-level coverage, definer-rights grants.
124
+ - **Integration.** Needs real database and real request. Example: cross-tenant rejection.
125
+ - **End-to-end.** Needs rendered page. Example: contrast and target size in situ.
126
+ - **Scheduled.** Depends on external service. Example: model-id resolution against live catalogue.
127
+
128
+ Then moment, separate from tier: editor or language server, pre-commit, pre-push, pull request, merge queue, post-merge, or scheduled. Cheap deterministic check → as early as it can run. Slow or flaky → merge queue or scheduled. **Done when:** `Tiers` holds tier and moment per candidate.
129
+
130
+ - [ ] **Step 7 — Enforcement:** Where integration branch accepts direct push, CI check on that branch reds after code landed: detective, not preventive. Per candidate: required status check on integration and release branch? who bypasses? is only preventive point a pre-push hook a verify-skip flag skips? Ranking says so when only preventive point can be bypassed. **Done when:** `Enforcement` row per candidate: branch · required? · bypass · preventive point.
131
+ - [ ] **Step 8 — Positive Control:** Gate that passes because it measures nothing is worse than no gate — it stops anyone looking. Control every new gate meets: put defect back, watch it red. This run does not build the gate; report states that control. Gate with no proven-red demonstration is not finished. Related cheap checks: unmatched browser-test locator can be passing assertion; row-level denial can be silent zero rows, indistinguishable from empty table (`bkit-audit-database`). Skip = hollow pass. Required job skipped by job-level condition reports success. Workflow skipped by path filter, branch filter, or skip-CI marker leaves required check pending. Per candidate: skip behaviour; how skip is kept from standing in for pass. If proven-red is convention for gate change, not merge requirement → propose in `Process Improvements`. **Done when:** `Controls` states positive control and skip behaviour per candidate.
132
+ - [ ] **Step 9 — Sequence:** Each candidate: report-only ≥1 full cycle, then enforcing. This run does not land gate. Read current tree, fix or allowlist findings, flip enforcing. Name candidates that would red if enforced cold. Report-only ends when gate meets stated bar, not just when cycle passed. Per candidate, bar: minimum runs; effective false-positive rate under 10% (findings judged not real problem ÷ all findings); no unexplained reds; no flakes of its own; added p90 runtime under stated budget. Name one enforcement tier. **Clear-then-gate** default: fix or allowlist every existing finding, then enforce on all. **Ratchet** (new violations only) when clearing existing findings is >1 PR: gate fails only on findings not in committed baseline (guard baseline file, or tool's own, e.g. Betterer results file, reviewdog added-only mode). Baseline may only shrink; each entry names owner. Allowlist per-offender, keyed to identity — never rule downgrade or route exclusion. Every entry cites owner; no owner and no date = permanent exemption. Ratchet baseline same contract; never grows. **Done when:** `Sequence` names bar and tier per candidate.
133
+ - [ ] **Step 10 — Decision:** Any workflow change needs explicit human confirmation. Propose, do not edit. Rule forbidding weakening gate applies to new one: bar for adding is that what it catches will be fixed. Record ADOPT, REJECT, or OTHER, including `docs/decisions.jsonl` row to append for ADOPT and REJECT. Appending is next step. Rejection whose reason later stops holding must stay findable. **Done when:** every candidate in `Scores` has verdict and row text, or OTHER with what settles it; verdict counts (proposed, ADOPT, REJECT, OTHER, reverted) in `Scores`.
134
+ - [ ] **Step 11 — Re-Review:** Gate built and reverted is not settled. Re-read each rejection in `docs/decisions.jsonl` and prior reports; check whether reasoning still holds. Two decisions on one guard, neither retired → criterion cannot be judged = finding. Reasoning no longer holds → score again into `Scores`, with `docs/decisions.jsonl` row that would retire old decision. **Done when:** `Rejections` row per reverted or rejected gate: still holds?
135
+ - [ ] **Step 12 — Health:** Per landed gate, since previous report: fire rate, true-positive rate, overrides/bypasses, own flakes, runtime. Never fired = perfectly preventive or hollow — indistinguishable outside; fresh positive control (`Positive Control`) tells apart. Never fired or hollow → name that control as next step. Every `bkit:gate:*` script in `package.json` = landed gate; workflows, agents, pre-push run only these → expand each (follow every nested `pnpm <script>` to its body) → list each command. Hollow → `CRITICAL`: script missing, empty, or runs nothing that can fail (e.g. `echo`, `true`, `|| exit 0`); command exits 0 when its tool absent (e.g. `command -v … || echo skipping`) = that check hollow → name tool and install step. **Done when:** `Health` row per landed gate, or none landed; each `bkit:gate:*` row lists every command and which can skip.
136
+ - [ ] **Step 13 — Allowlists:** Every allowlist entry (known-offender maps, ratchet baseline, dead-code ignores) past date or with cited issue closed. Each lapsed = finding: renew with reason, or fix offender. Per ratchet baseline, compare entry count vs previous report: grew, or entry with no owner = finding. **Done when:** `Allowlists` lists every lapsed, grown, or ownerless entry, or `none`.
137
+ - [ ] **Step 14 — Standards:** Confirm current version per anchor standard; read changes since previous report's version. `Standards Coverage`: one row per anchor practice (fitness functions, static-analysis false-positive bar, new-code gating, ratchets, policy as code, rulesets and merge queue, DORA CI capability) and per OpenSSF Scorecard check → checked (name step) / not applicable (why) / finding. Unapplied recommended practice → adopt (propose step) / reject (why) / not applicable. **Done when:** no empty row.
138
+ - [ ] **Step 15 — Anything Else:** (a) Everything changed since previous report's commit touching gating (guards and contract tests, hook directory, gate scripts, workflow jobs, rulesets and branch protection, allowlists) → one-line verdict each. (b) Bounded ~30 min pass: what senior build and developer-productivity engineer flags that no step asks; read since previous run (incidents, `bkit-audit-logs` reports, new `docs/failures.jsonl` rows, vendor status incidents) — what would no step catch? **Done when:** `Beyond the Steps` holds both passes, or `none`. Class seen on 2 runs → propose step in `Process Improvements`.
139
+
140
+ ### 🔒 Gate 2: Probes Check
141
+
142
+ **Checkpoint.** Verify and check `[x]` all boxes below, then continue to `Findings` without asking.
143
+
144
+ - [ ] **Steps complete:** every step `[x]`, or explicit skip with evidence the surface is absent.
145
+ - [ ] **Evidence:** every finding cites re-checkable evidence and the tool behind it.
146
+ - [ ] **Sources read:** every candidate cites the section it came from; a score off a sibling summary alone is not a score.
147
+ - [ ] **No gate landed:** no workflow, hook, allowlist, or gate script changed.
148
+ - [ ] **Gate 2 - Verified:** Every checkbox above independently verified and checked off.
149
+
150
+ ## Findings
151
+
152
+ <!-- prettier-ignore -->
153
+ | Severity | Use |
154
+ | --- | --- |
155
+ | `CRITICAL` | Ungated class is data loss, a security hole, or a broken workflow with no workaround; a required check that reports success when skipped or when it measured nothing |
156
+ | `HIGH` | Class that has shipped real damage and still has a workaround; a landed gate that has never fired and has no positive control; structural false positives with no committed baseline |
157
+ | `MEDIUM` | Repeat defect class with a home lane and no gate; report-only candidate past its bar with no enforce-or-stay decision; allowlist entry past its date or with no owner |
158
+ | `LOW` | Candidate with no incident; OTHER waiting on a tool or a decision; gate-message wording that changes no pass/fail |
159
+
160
+ Scale per `.bkit/jsonl.md` § Severity. A candidate takes the severity of the class its gate would catch. Within a severity: higher `Score` first.
161
+
162
+ <!-- prettier-ignore -->
163
+ | ID | Severity | Verdict | Location | Evidence | Expected |
164
+ | --- | --- | --- | --- | --- | --- |
165
+ | PENDING | PENDING | PENDING | PENDING | PENDING | PENDING |
166
+
167
+ Empty and clean → one row `None`.
168
+
169
+ ## Report
170
+
171
+ ### Summary
172
+
173
+ PENDING
174
+
175
+ ### Previous Run
176
+
177
+ PENDING
178
+
179
+ ### Inventory
180
+
181
+ PENDING
182
+
183
+ ### Scores
184
+
185
+ PENDING
186
+
187
+ ### Tiers
188
+
189
+ PENDING
190
+
191
+ ### Enforcement
192
+
193
+ PENDING
194
+
195
+ ### Controls
196
+
197
+ PENDING
198
+
199
+ ### Sequence
200
+
201
+ PENDING
202
+
203
+ ### Rejections
204
+
205
+ PENDING
206
+
207
+ ### Health
208
+
209
+ PENDING
210
+
211
+ ### Allowlists
212
+
213
+ PENDING
214
+
215
+ ### Checked
216
+
217
+ PENDING
218
+
219
+ ### Not Checked
220
+
221
+ PENDING
222
+
223
+ ### Standards Coverage
224
+
225
+ PENDING
226
+
227
+ ### Beyond the Steps
228
+
229
+ PENDING
230
+
231
+ ### Process Improvements
232
+
233
+ PENDING
234
+
235
+ ### 🔒 Gate 3: Report Check
236
+
237
+ **Checkpoint.** Verify and check `[x]` all boxes below, then stop.
238
+
239
+ - [ ] **No placeholders:** Findings table and every `Report` section have no `PENDING`.
240
+ - [ ] **Summary:** names count per severity and per verdict (ADOPT / REJECT / OTHER).
241
+ - [ ] **Series:** verdict counts, `Health`, and allowlist sizes beside previous report's numbers, or marked baseline.
242
+ - [ ] **Writes:** only this report and template `Project Instructions` changed; throwaway worktrees / remote targets removed.
243
+ - [ ] **Process Improvements:** `Universal` = proposed step changes, template untouched; `Project` = edits applied below `bkit:end`; each `none` if empty.
244
+ - [ ] **Gate 3 - Verified:** Every checkbox above independently verified and checked off.
245
+
246
+ > `Project Instructions` below `bkit:end` are consumer-owned — `bkit install` never overwrites them, `bkit check` drift stays clean. Add project-specific tools, paths, commands, and checks there, keyed by section or step title; never results.
247
+
248
+ <!-- bkit:end -->
249
+
250
+ ## Project Instructions
@@ -0,0 +1,273 @@
1
+ <!-- Note: Reports live at `docs/audits/{YYYYMM}/{slug}.md`. `{YYYYMM}` = UTC month of this run. `{slug}` = template basename without `bkit-audit-` and `.md`. **If** that month already has `{slug}.md` or `{slug}-{TIMESTAMP}.md` → write `{slug}-{TIMESTAMP}.md` (`{TIMESTAMP}` = `date -u +%Y%m%dT%H%M%SZ`). Never overwrite. `@bkit-audit-generate` fills this template. -->
2
+
3
+ <!-- bkit:start -->
4
+
5
+ {{BKIT_MANAGED_MARKER}}
6
+
7
+ # Issue Prioritisation
8
+
9
+ > [!CAUTION]
10
+ > **Purpose:** A size and a priority for every open tracker issue, on two rules a later run can re-apply and get the same answer; plus board membership, parent, milestone, and blocked-by links the rules read.
11
+ >
12
+ > **Rules:**
13
+ >
14
+ > - Read-only audit; never edit code, config, or data.
15
+ > - `Universal Instructions` apply to all projects; `Project Instructions` apply only to this project.
16
+ > - Local audit instructions / overrides → `Project Instructions` below the bkit-managed block; universal instructions stay in-block.
17
+ > - Any tools mentioned in `Universal Instructions` are examples only; swap for actual tools in final output; drop inapplicable.
18
+ > - Use dense token-efficient phrasing; no filler / hedging / restating; tables > prose, bullets > paragraphs.
19
+ > - Read `.agents/docs.md` → load docs for workflow / step / task; skip missing; cite docs inline where required.
20
+ > - Every claim cites evidence (`file:line`, or command / query and its output) and tool behind it.
21
+ > - Read this document once at session start; do not trust session memory; do not re-read on every loop iteration.
22
+ > - never write tracker fields, labels, or comments; NEVER close, merge, or open issues. The report proposes size and priority.
23
+ > - never copy a personal-data value from an issue body into the report.
24
+
25
+ ## Universal Instructions
26
+
27
+ ### Context & Goals
28
+
29
+ Board with no stated rule = filing order. Search feature and authorisation bypass share a band; next pass reshuffles both. Target failure: **a ranking that cannot be re-derived**. Rule 1 picks the band. Rule 2 moves it. Rule lives in this template beside the ranking → later run, same board, same answer.
30
+
31
+ **Applies when:** tracker holds open issues. None → one `N/A` row with evidence, never "clean".
32
+
33
+ **Cadence:** monthly for clocks. Steps 1, 4, 11, 12 always; 2 membership only; 3 stale only; 5 in-flight age and launch target; 6 eight-week launch move and stuck-item lifts only. Other issues carry previous proposal. Full rank (Steps 2–10) when milestone opens/closes, ship cycle lands cluster, lane contents turn over, or audit files follow-up batch. Mini-pass when issue filed since previous report has gone a week with no size/priority or off-board (anchor-standard triage): Steps 3–8 and 10, plus 1, 2 membership, 11, 12; same two rules.
34
+
35
+ **Anchor Standards:** record version and date read. Newer version → `Standards` step reads what changed.
36
+
37
+ - Weighted Shortest Job First and cost of delay (e.g. SAFe WSJF, after Reinertsen, _The Principles of Product Development Flow_).
38
+ - RICE and ICE scoring (e.g. Intercom RICE).
39
+ - The Kanban Guide (WIP, work-item age, service level expectation); record the edition (e.g. May 2025).
40
+ - Kanban classes of service (Expedite, Fixed date, Standard, Intangible).
41
+ - Definition of Ready: the Scrum Guide's description of ready items under Product Backlog refinement; record the edition (e.g. November 2020). No separate published standard exists.
42
+ - Severity is not priority (e.g. Mozilla defect-severity guide and Bugzilla triage policy).
43
+ - Tracker dependency links (e.g. GitHub blocked-by / blocking).
44
+
45
+ ### Scope
46
+
47
+ - Every open issue, every open lane, one rule.
48
+ - Rule 1 band from the work, not the label.
49
+ - Rule 2 move from in flight, launch-gating, and waits on data that does not exist yet.
50
+ - Size of the work.
51
+ - Order inside a band. Tracker fields do not store order.
52
+ - Proposed size and priority per issue. This run does not write them.
53
+ - Board membership, parent, milestone, blocked-by: missing, stale, or contradicting → finding.
54
+
55
+ ### Out of Scope
56
+
57
+ <!-- prettier-ignore -->
58
+ | Excluded item | Why | Where it belongs |
59
+ | --- | --- | --- |
60
+ | Ranking the next items to work into `docs/roadmap.md` | Roadmap utility | `@bkit-utility-update-roadmap` |
61
+ | Whether a maintenance check should become a gate | Gate sweep | `bkit-audit-gates` |
62
+ | Ordering one migration programme's own queue | Project migration map | Project Instructions |
63
+ | Writing size, priority, labels, or links; closing, merging, or opening issues | Audit reports only | Plan from this report |
64
+ | Assignees, start / target dates, numeric estimate | Rules do not read them | Project Instructions |
65
+
66
+ ### Ranking Rules
67
+
68
+ Both rules load-bearing. Rule 1 decides band. Rule 2 moves one band. Re-apply; do not vote.
69
+
70
+ **Rule 1 — what kind of work it is.** Security issues, then error fixing, then design issues, then everything else.
71
+
72
+ <!-- prettier-ignore -->
73
+ | Category | Priority | What lands here |
74
+ | --- | --- | --- |
75
+ | Security | `Urgent` | Auth holes, authorisation bypass, credential exposure, data exposure, access-control gaps |
76
+ | Error fixing | `High` | Real defects — something is broken, wrong, or silently failing |
77
+ | Design | `Medium` | Layout, copy, icons, parity, accessibility, anything about how it looks or reads |
78
+ | Everything else | `Low` | New features, test coverage, CI, and tooling, dependency debt, trackers, and milestones |
79
+
80
+ Defect label = starting point, not answer. Read body. Presentation work and missing tests often labelled bugs. Record every override — those rows most likely wrong. Name label correction to match body (e.g. drop defect label from presentation work).
81
+
82
+ **Rule 2 — when it can be done.** In-flight neighbours move up. Lifecycle-later work moves down.
83
+
84
+ <!-- prettier-ignore -->
85
+ | Signal | Move |
86
+ | --- | --- |
87
+ | Parent, child, or sibling of something in progress or in review | Up one band |
88
+ | Split out of an in-flight issue, or touching the same harness | Up one band |
89
+ | Launch-gating: must ship before launch or before first production deploy | Never down. Up one band when the recorded launch or milestone target is eight weeks away or less. No target recorded → keep the Rule 1 band |
90
+ | Says "once we have usage data" or "when thresholds are hit" | Down one band |
91
+ | Protects data that does not exist yet | Down one band, except a critical path named in Project Instructions |
92
+
93
+ Launch-gating = fixed-date class of service. Cost of delay grows as date approaches → never down. Step 5 records target each run.
94
+
95
+ **Blockers take the band of what they block**, when that band is higher than their own. Non-security blocker of `Urgent` stops at `High`, first in `High` order (Step 8).
96
+
97
+ Two guards:
98
+
99
+ 1. Non-security work does not reach `Urgent`, however hot. No up-move and no blocker lifts past `High`. Exception: defect that loses or silently corrupts user data may be `Urgent`.
100
+ 2. Security drops at most one band, never for launch timing. Launch-gating security never down. Security on named critical path never takes "data does not exist yet" down-move. Security never `Low` on "no users yet" alone.
101
+
102
+ **Traps:**
103
+
104
+ - Do not rank by label alone — main wrong-answer source.
105
+ - `Urgent` inflation kills the band. Long `Urgent` list = category, not queue. If all protective work is `Urgent`, ask which matter in current lifecycle (Project Instructions: users?).
106
+ - Standing issues split across bands by subject. Shared process does not put them in one band.
107
+ - An auto-generated checklist is not work (e.g. a dependency-bot dashboard).
108
+ - Every open lane, same two rules. Two lanes ranked differently → unread across boundary.
109
+
110
+ Finding `CRITICAL`–`LOW` in another audit does not set priority. Two rules do. Severity orders inside `High` only (Step 8).
111
+
112
+ ### Pre-Flight / Dependencies
113
+
114
+ **Checkpoint:** Check off all core items. Check conditional items only when applicable. Each item: available → tool and version; missing → fallback, gap in `Not Checked`, fix in `Process Improvements`. Unnamed gap reads as passed. never abort for a missing capability.
115
+
116
+ #### Core
117
+
118
+ Always verify.
119
+
120
+ - [ ] **Tracker Read:** Steps 2, 5, 10 — every board item with lane, size, and priority, e.g. `gh project item-list`, Linear issues. Fallback: none; unread items `Not Checked`, proposal does not cover them.
121
+ - [ ] **Open-Issue List:** Steps 2, 10 — every open issue, every repo / team board draws from, read separately from board, e.g. `gh issue list --state open`, Linear team issues. Fallback: none; membership `Not Checked`, proposal covers board items only.
122
+ - [ ] **Issue Bodies:** Steps 3, 4, 6, 8 — title, labels, body, parent, milestone, blocked-by, e.g. `gh issue view`, Linear issue API. Fallback: titles only; each such rank low-confidence in `Judgement Calls`, links from structured fields only.
123
+ - [ ] **Web:** Step 11 — fetch anchor standards. Fallback: versions recorded as unread.
124
+
125
+ #### Conditional
126
+
127
+ Verify only when applicable.
128
+
129
+ - [ ] **Ship Ledger:** Ship outcomes recorded → Step 9 — e.g. `.bkit/stats.jsonl` `outcome` rows. Fallback: size table unchecked against what shipped; say so.
130
+ - [ ] **Link API:** Tracker exposes structured blocked-by or parent links → Step 4 — e.g. GitHub dependencies / sub-issues APIs, Linear `relations` / `parent`. Fallback: body text only; say so.
131
+
132
+ ### 🔒 Gate 1: Prerequisites Check
133
+
134
+ **Checkpoint.** Verify and check `[x]` all applicable boxes above, then continue to `Probe Steps` without asking.
135
+
136
+ - [ ] **Gaps named:** every missing item names its fallback and `Not Checked` entry.
137
+ - [ ] **Gate 1 - Verified:** All Core items checked. All applicable Conditional items checked.
138
+
139
+ ### Probe Steps
140
+
141
+ - [ ] **Step 1 — Previous Run:** Record `git rev-parse HEAD`. Read newest prior report for this slug under `docs/audits/`. Count findings fixed / still open; age of oldest open. Open after 2 runs → re-raise with age. **Done when:** closure rate in `Previous Run`, or run marked baseline.
142
+ - [ ] **Step 2 — Board:** Read every item. Assert read not truncated (count below limit; at limit → raise and re-read). Record lane names, size and priority field ids and option ids from live field list. Unused numeric estimate stays unused; size = estimate. Membership: diff open-issue list vs board. Open issue not on board = off-board; closed issue outside done lane = stale card; list each by number. Off-board stays in scope: Steps 3–10 treat as item with no lane, size, priority. **Done when:** item count, lanes, field ids, off-board, stale cards in `Board`, or `N/A` and STOP.
143
+ - [ ] **Step 3 — Triage:** Read every open issue, not titles only. Short body prefix OK when summary front-loaded; open umbrella/milestone issues in full. While reading: stale = no activity 90 days and body no longer true of code/plan (standing issue never stale for age); duplicate = same change twice or one wholly inside another; `Low` on 3+ passes and still true = won't-do candidate (standing excluded); ready-lane item missing acceptance criteria, defect reproduction, or test to write = not ready (still gets size/priority). Note each Rule 1 override for Step 6 with label correction. List stale/duplicate with merge target or stale reason. Closing = owner; this run does not close. Monthly clock → stale only. **Done when:** `Triage` lists stale, duplicates, won't-do, not-ready, overrides to rank.
144
+ - [ ] **Step 4 — Links:** Per open issue record parent, milestone, blocked-by. Blocked-by: read all three — structured links (`Link API`), body block build gates on (e.g. GitHub `###### bkit:blocked-by start` / `end`), body prose ("blocked by #N", "after #N"). Flag: (1) Parent — child listed in parent body, no link (or reverse); open child, closed parent; open non-standing parent, all children closed → `Judgement Calls`. (2) Milestone — closed / past-due milestone with open issues; child with no or later milestone than parent; body / title names milestone, field empty; open milestone, no open issues. (3) Blocked-by — prose only; structured link vs body block disagree; closed blocker still listed; blocked issue in ready or later lane, blocker open; blocker off-board; cycle. Edges → Step 5 blocker rule, Step 6 parent / child moves. **Done when:** `Links` holds per-kind counts (with / without parent, milestone, blocker) and every flag, or `none`.
145
+ - [ ] **Step 5 — In Flight:** Three sources: lanes in progress/review; open PRs; issues closed recently (shipped cluster still warm — next issue in cluster cheap). Record launch/milestone target and where written. None → say so; launch-gating keeps Rule 1 band. Count in-progress/in-review; age and last activity (commit, PR, comment). Flag older than service level expectation: 85th-percentile cycle time of issues closed last 90 days, start of work to close. Record how start taken. <20 closed → two weeks, say so. Stuck item lifts parent/children/siblings; list each lift as judgement call. Apply blocker rule to every Step 4 edge. **Done when:** `In Flight` holds counts, ages, target, blocker moves, stuck lifts.
146
+ - [ ] **Step 6 — Rank:** Apply `Ranking Rules` to every in-scope issue. Record every Rule 1 override (label vs body) and label correction. Record every Rule 2 move with signal and launch target read. Band change since previous report without body/labels/in-flight change → one pass misapplied rule — say which. Maintenance check belonging as gate → `bkit-audit-gates`, not band here. Mini-pass → this step on unsized/unprioritised subset only. Monthly clock → eight-week launch moves and stuck lifts only. **Done when:** `Ranking` lists every override, move, band change.
147
+ - [ ] **Step 7 — Size:** Size work, not body. Long evidence write-up can be one-file fix. XS = one file, one change, plus test. S = one surface, a day or less. M = few files one package, or one full pattern sweep. L = several packages, more than one client, or roughly a week. XL = milestone, full-product inventory, or subsystem not yet built. Multi-client change never sized as one. Standing/umbrella sized for one run, not series. Milestone sized for contents. **Done when:** `Sizes` row per in-scope issue.
148
+
149
+ - [ ] **Step 8 — Order:** Four bands tie issues. Order each ready-lane band; report top ten. Proposal does not invent order field. (1) Inside `High`: blockers of `Urgent` first, then severity. Defect with ledger/audit `CRITICAL` before `HIGH`, both before rest. Severity orders in band; never moves band. (2) Cost of delay ÷ size (WSJF). Score 1–3: user/business value, time-criticality, risk reduced/work unblocked. Sum ÷ size: XS 1, S 2, M 3, L 5, XL 8. Tie → older issue. Simplified WSJF; standard uses modified Fibonacci per part and job size. (3) Demand when any: error-tracker volume, store reviews, analytics, support, previous-product users → raise value score; name source. Empty → say so; do not guess. **Done when:** `Order` holds top ten with scores.
150
+ - [ ] **Step 9 — Shipped:** Issues closed since previous report → join ship outcome via closing PR (lines changed, duration). Compare with size given. Sizes overlapping heavily in lines/time → size table no longer means what it says; propose change in `Process Improvements`. **Done when:** `Shipped` holds comparison, or no outcomes and say so.
151
+ - [ ] **Step 10 — Propose:** One proposed size and priority per open item outside done lane, off-board included, from Steps 6–7. Assert set-equality proposal vs open-issue list (Step 2) before report finished. Missing issue = silent otherwise. This run does not write fields. Distribution before (fields as read) and after (proposal) leads `Summary`. `Judgement Calls`: every call owner should overturn — stuck lifts, won't-do, stale, duplicate closes, uncertain bands — recommendation and what would settle each. **Done when:** `Proposal` covers every in-scope item; `Judgement Calls` holds calls.
152
+ - [ ] **Step 11 — Standards:** Confirm current version per anchor standard; read changes since previous report's version. `Standards Coverage`: one row per anchor-standard practice (within-band order, classes of service, WIP, and work-item age, definition of ready, severity against priority, dependencies) → checked (name step) / not applicable (why) / finding. Unapplied recommended practice → adopt (propose step) / reject (why) / not applicable. **Done when:** no empty row.
153
+ - [ ] **Step 12 — Anything Else:** (a) Everything changed since previous report's commit touching prioritisation (board fields/options, lanes, labels, milestones, issue templates, two rules) → one-line verdict each. (b) Bounded ~30 min pass: what senior delivery lead flags that no step asks; read since previous run (incidents, `bkit-audit-logs` reports, new `docs/failures.jsonl` rows, vendor status) — what would no step catch? **Done when:** `Beyond the Steps` holds both passes, or `none`. Class seen on 2 runs → propose step in `Process Improvements`.
154
+
155
+ ### 🔒 Gate 2: Probes Check
156
+
157
+ **Checkpoint.** Verify and check `[x]` all boxes below, then continue to `Findings` without asking.
158
+
159
+ - [ ] **Steps complete:** every step `[x]`, or explicit skip with evidence the surface is absent. Monthly clock pass → Steps 7, 8, 9, and 10 explicit skip; Step 2 membership only.
160
+ - [ ] **Evidence:** every finding cites re-checkable evidence and the tool behind it.
161
+ - [ ] **Membership:** open-issue list read separately from board; every off-board issue, stale card listed.
162
+ - [ ] **Links:** parent, milestone, blocked-by recorded per open issue; blocked-by from all three Step 4 sources.
163
+ - [ ] **Proposal complete:** every open item outside Done has proposed size and priority; proposal set equals open-issue list. Monthly clock pass → previous proposal stands, plus stale calls, stuck lifts, eight-week moves.
164
+ - [ ] **Tracker untouched:** no tracker field, label, comment, or issue was written.
165
+ - [ ] **Gate 2 - Verified:** Every checkbox above independently verified and checked off.
166
+
167
+ ## Findings
168
+
169
+ <!-- prettier-ignore -->
170
+ | Severity | Use |
171
+ | --- | --- |
172
+ | `CRITICAL` | Security issue proposed more than one band down, or non-security proposed as `Urgent` (the data-loss exception in `Ranking Rules` is allowed) |
173
+ | `HIGH` | Launch-gating work the rules forbid moving down; blocker left below the issue it blocks; security issue moved down for "no users yet" |
174
+ | `MEDIUM` | Rule 1 override with no label correction; ready-lane item not ready; stale or duplicate still treated as open work; band change whose body, labels, and in-flight neighbours did not change; in-flight item older than the service level expectation; off-board issue; blocked-by prose only, or structured link vs body block disagree; blocked issue in ready or later lane, blocker open; blocked-by cycle; open child, closed parent; closed / past-due milestone with open issues |
175
+ | `LOW` | Won't-do candidate; label correction that changes no band; within-band order only; stale card; closed blocker still listed; parent named in body, no link; child outside parent's milestone; milestone named in body, field empty; empty open milestone |
176
+
177
+ Scale per `.bkit/jsonl.md` § Severity. Within a severity: security-band mistakes first.
178
+
179
+ Ranked issues are not findings. Their output is the proposed priority. Findings are stale, duplicate, not-ready, mis-ranked, stuck, off-board, and broken links.
180
+
181
+ <!-- prettier-ignore -->
182
+ | ID | Severity | Location | Evidence | Expected |
183
+ | --- | --- | --- | --- | --- |
184
+ | PENDING | PENDING | PENDING | PENDING | PENDING |
185
+
186
+ Empty and clean → one row `None`.
187
+
188
+ ## Report
189
+
190
+ ### Summary
191
+
192
+ PENDING
193
+
194
+ ### Previous Run
195
+
196
+ PENDING
197
+
198
+ ### Board
199
+
200
+ PENDING
201
+
202
+ ### Triage
203
+
204
+ PENDING
205
+
206
+ ### Links
207
+
208
+ PENDING
209
+
210
+ ### In Flight
211
+
212
+ PENDING
213
+
214
+ ### Ranking
215
+
216
+ PENDING
217
+
218
+ ### Sizes
219
+
220
+ PENDING
221
+
222
+ ### Order
223
+
224
+ PENDING
225
+
226
+ ### Shipped
227
+
228
+ PENDING
229
+
230
+ ### Proposal
231
+
232
+ PENDING
233
+
234
+ ### Judgement Calls
235
+
236
+ PENDING
237
+
238
+ ### Checked
239
+
240
+ PENDING
241
+
242
+ ### Not Checked
243
+
244
+ PENDING
245
+
246
+ ### Standards Coverage
247
+
248
+ PENDING
249
+
250
+ ### Beyond the Steps
251
+
252
+ PENDING
253
+
254
+ ### Process Improvements
255
+
256
+ PENDING
257
+
258
+ ### 🔒 Gate 3: Report Check
259
+
260
+ **Checkpoint.** Verify and check `[x]` all boxes below, then stop.
261
+
262
+ - [ ] **No placeholders:** Findings table and every `Report` section have no `PENDING`.
263
+ - [ ] **Summary:** names count per severity, the size and priority distribution before and after the proposal; off-board and broken-link counts.
264
+ - [ ] **Series:** every series beside previous report's numbers, or marked baseline.
265
+ - [ ] **Writes:** only this report and template `Project Instructions` changed; throwaway worktrees / remote targets removed.
266
+ - [ ] **Process Improvements:** `Universal` = proposed step changes, template untouched; `Project` = edits applied below `bkit:end`; each `none` if empty.
267
+ - [ ] **Gate 3 - Verified:** Every checkbox above independently verified and checked off.
268
+
269
+ > `Project Instructions` below `bkit:end` are consumer-owned — `bkit install` never overwrites them, `bkit check` drift stays clean. Add project-specific tools, paths, commands, and checks there, keyed by section or step title; never results.
270
+
271
+ <!-- bkit:end -->
272
+
273
+ ## Project Instructions