@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,257 @@
1
+ // bkit runtime detect|assert|row — which runtime this is, and what it may do.
2
+ //
3
+ // Four runtimes behave differently: a laptop, a GitHub Actions runner, a Cursor
4
+ // Cloud Agent, and a claude.ai cloud session. Detection maps env markers to a
5
+ // conservative DEFAULT capability table; only `runtimeGithubCli` is probed live
6
+ // (`gh auth status`). `runtimeDevPushes` is never probed: `git push --dry-run` sends
7
+ // no ref update, so a protected branch's hook never fires.
8
+ //
9
+ // Each command run is its own process, so nothing survives between workflow
10
+ // blocks. The durable record is the `runtime-resolved` row `row` writes once per
11
+ // run; later steps read it back with `assert` instead of re-probing.
12
+ //
13
+ // Detection, first match wins:
14
+ // BKIT_RUNTIME=<enum> explicit override (invalid -> UNKNOWN)
15
+ // <repo root>/.bkit/.runtime-cursor CLOUD_CURSOR
16
+ // any primitive neither truthy nor falsy UNKNOWN, least-capable, loud
17
+ // CLAUDE_CODE_REMOTE truthy CLOUD_CLAUDE
18
+ // GITHUB_ACTIONS or CI truthy GITHUB_ACTION
19
+ // otherwise LOCAL
20
+ import * as fs from "node:fs";
21
+ import * as path from "node:path";
22
+ import { statusTimestamp } from "../../ledgers/status.js";
23
+ import { CommandError, EXIT, repoRoot, runTool } from "../lib.js";
24
+ import { EXIT_NO_STATUS, FILE_FLAG, WORKFLOW_FLAG, readStatusEvents, statusFile, str, } from "./status.js";
25
+ export const RUNTIMES = [
26
+ "LOCAL",
27
+ "GITHUB_ACTION",
28
+ "CLOUD_CLAUDE",
29
+ "CLOUD_CURSOR",
30
+ "UNKNOWN",
31
+ ];
32
+ /** Exit code: status.jsonl has no `runtime-resolved` row (for --workflow, when given). */
33
+ export const EXIT_NO_RUNTIME_ROW = 4;
34
+ /** Exit code: the latest `runtime-resolved` row has a field that is not a valid literal. */
35
+ export const EXIT_UNRESOLVED = 5;
36
+ // ---------------------------------------------------------------------------
37
+ // Tools
38
+ // ---------------------------------------------------------------------------
39
+ // ---------------------------------------------------------------------------
40
+ // Detection
41
+ // ---------------------------------------------------------------------------
42
+ /**
43
+ * One detection primitive as true / false / ambiguous. Unset and an explicit
44
+ * falsy literal (e.g. `CI=false`) both mean "not this runtime".
45
+ */
46
+ export function normFlag(value) {
47
+ if (["true", "TRUE", "True", "1", "yes", "YES"].includes(value ?? ""))
48
+ return "true";
49
+ if (["", "false", "FALSE", "False", "0", "no", "NO"].includes(value ?? ""))
50
+ return "false";
51
+ return "ambiguous";
52
+ }
53
+ /** Classify the runtime from `env` and the repo root's Cursor marker. */
54
+ export function classify(env, root, log) {
55
+ const override = env.BKIT_RUNTIME ?? "";
56
+ if (override !== "") {
57
+ if (RUNTIMES.includes(override))
58
+ return override;
59
+ log(`BKIT_RUNTIME='${override}' is not a valid runtime (${RUNTIMES.join(" | ")}) — defaulting runtime=UNKNOWN, least-capable`);
60
+ return "UNKNOWN";
61
+ }
62
+ // Cursor exposes "background agent" only on its sessionStart hook's stdin, so
63
+ // its preflight hook drops this gitignored marker; a Cursor VM is a fresh clone.
64
+ if (fs.existsSync(path.join(root, ".bkit", ".runtime-cursor")))
65
+ return "CLOUD_CURSOR";
66
+ const cloud = normFlag(env.CLAUDE_CODE_REMOTE);
67
+ const gha = normFlag(env.GITHUB_ACTIONS);
68
+ const ci = normFlag(env.CI);
69
+ if ([cloud, gha, ci].includes("ambiguous")) {
70
+ log(`ambiguous detection primitives (CLAUDE_CODE_REMOTE='${env.CLAUDE_CODE_REMOTE ?? ""}' GITHUB_ACTIONS='${env.GITHUB_ACTIONS ?? ""}' CI='${env.CI ?? ""}') — defaulting runtime=UNKNOWN, least-capable`);
71
+ return "UNKNOWN";
72
+ }
73
+ if (cloud === "true")
74
+ return "CLOUD_CLAUDE";
75
+ if (gha === "true" || ci === "true")
76
+ return "GITHUB_ACTION";
77
+ return "LOCAL";
78
+ }
79
+ /**
80
+ * Default capabilities per runtime. CLOUD_CURSOR matches GITHUB_ACTION on
81
+ * purpose (isolated VM, real git, mints and pushes its own branch); a claude.ai
82
+ * session's proxy only lets it push the current branch, so it gets neither.
83
+ */
84
+ const capable = (runtime) => runtime === "LOCAL" || runtime === "GITHUB_ACTION" || runtime === "CLOUD_CURSOR";
85
+ /** The full table: classification, default capabilities, and the one live gh probe. */
86
+ export function detect(cwd, root, log) {
87
+ const runtime = classify(process.env, root, log);
88
+ const gh = runTool("gh", ["auth", "status"], cwd);
89
+ const lines = gh.stderr.split("\n").filter((l) => l.trim() !== "");
90
+ const err = gh.found ? (lines[lines.length - 1] ?? "") : gh.stderr;
91
+ const ok = gh.status === 0;
92
+ if (!ok)
93
+ log(`gh-preflight: runtimeGithubCli=false (exit=${gh.status} err='${err}')`);
94
+ return {
95
+ runtime,
96
+ runtimeWorktrees: capable(runtime),
97
+ runtimeDevPushes: capable(runtime),
98
+ runtimeGithubCli: ok,
99
+ runtimeGithubCliExit: gh.status,
100
+ runtimeGithubCliErr: err,
101
+ };
102
+ }
103
+ /** Where the feature's work happens: a minted worktree, or the checkout itself (adopt). */
104
+ export const worktreePath = (root, fid, worktrees) => worktrees ? path.join(root, ".worktrees", fid) : root;
105
+ /** The `runtime-resolved` status.jsonl row. */
106
+ export function runtimeRow(table, opts) {
107
+ return {
108
+ type: "runtime-resolved",
109
+ workflow: opts.workflow,
110
+ at: opts.at,
111
+ runtime: table.runtime,
112
+ runtimeWorktrees: table.runtimeWorktrees,
113
+ runtimeDevPushes: table.runtimeDevPushes,
114
+ runtimeGithubCli: table.runtimeGithubCli,
115
+ runtimeGithubCliExit: table.runtimeGithubCliExit,
116
+ runtimeGithubCliErr: table.runtimeGithubCliErr,
117
+ baseSha: opts.baseSha,
118
+ };
119
+ }
120
+ /** Every field of a read-back row that is not a valid literal; empty = resolved. */
121
+ export function unresolvedFields(row) {
122
+ const bad = [];
123
+ if (!RUNTIMES.includes(row.runtime))
124
+ bad.push("runtime");
125
+ for (const key of ["runtimeWorktrees", "runtimeDevPushes", "runtimeGithubCli"]) {
126
+ if (typeof row[key] !== "boolean")
127
+ bad.push(key);
128
+ }
129
+ return bad;
130
+ }
131
+ // ---------------------------------------------------------------------------
132
+ // Command
133
+ // ---------------------------------------------------------------------------
134
+ const TABLE_OUTPUT = {
135
+ runtime: RUNTIMES.join(" | "),
136
+ runtimeWorktrees: "may mint git worktrees (default per runtime)",
137
+ runtimeDevPushes: "may push dev (a default, never probed)",
138
+ runtimeGithubCli: "gh auth status succeeded",
139
+ runtimeGithubCliExit: "gh auth status exit code (127 when gh is not on PATH)",
140
+ runtimeGithubCliErr: "last non-empty line of gh auth status stderr",
141
+ };
142
+ const FID_FLAG = {
143
+ name: "fid",
144
+ type: "string",
145
+ required: true,
146
+ help: "feature id, for worktreePath",
147
+ };
148
+ export const runtimeCommand = {
149
+ noun: "runtime",
150
+ summary: "Detect the runtime and its default capabilities; write and read the runtime-resolved row.",
151
+ verbs: {
152
+ detect: {
153
+ summary: "Classify the runtime, its default capabilities, gh auth, and the worktree path.",
154
+ flags: [FID_FLAG],
155
+ output: {
156
+ ...TABLE_OUTPUT,
157
+ worktreePath: "<repo root>/.worktrees/<fid> when worktrees are allowed, else the repo root",
158
+ },
159
+ run: (ctx) => {
160
+ const root = repoRoot(ctx.cwd);
161
+ const table = detect(ctx.cwd, root, ctx.log);
162
+ ctx.emit({
163
+ ...table,
164
+ worktreePath: worktreePath(root, String(ctx.flags.fid), table.runtimeWorktrees),
165
+ });
166
+ return EXIT.OK;
167
+ },
168
+ },
169
+ row: {
170
+ summary: "Detect, then build the runtime-resolved row (and append it with --file).",
171
+ flags: [
172
+ WORKFLOW_FLAG,
173
+ {
174
+ name: "base-sha",
175
+ type: "string",
176
+ help: "merge-base the design/plan worktree branched from (git merge-base origin/dev HEAD)",
177
+ },
178
+ { ...FILE_FLAG, required: false, help: "status.jsonl to append the row to" },
179
+ ],
180
+ output: {
181
+ row: "the runtime-resolved row",
182
+ file: "where it was appended (null without --file)",
183
+ },
184
+ run: (ctx) => {
185
+ const workflow = String(ctx.flags.workflow);
186
+ const at = statusTimestamp();
187
+ if (workflow === "")
188
+ throw new CommandError(EXIT.USAGE, "--workflow must be non-empty");
189
+ const root = repoRoot(ctx.cwd);
190
+ const row = runtimeRow(detect(ctx.cwd, root, ctx.log), {
191
+ workflow,
192
+ at,
193
+ baseSha: str(ctx.flags.baseSha) ?? "",
194
+ });
195
+ let file = null;
196
+ if (ctx.flags.file !== undefined) {
197
+ file = statusFile(ctx);
198
+ if (!fs.existsSync(path.dirname(file))) {
199
+ throw new CommandError(EXIT.USAGE, `log directory ${path.dirname(file)} does not exist`);
200
+ }
201
+ fs.appendFileSync(file, `${JSON.stringify(row)}\n`);
202
+ }
203
+ ctx.emit({ row, file });
204
+ return EXIT.OK;
205
+ },
206
+ },
207
+ assert: {
208
+ summary: "Read back the latest runtime-resolved row and fail unless every field is resolved.",
209
+ flags: [
210
+ FILE_FLAG,
211
+ { ...WORKFLOW_FLAG, required: false, help: "only rows written by this workflow" },
212
+ ],
213
+ output: {
214
+ ...TABLE_OUTPUT,
215
+ baseSha: "the row's baseSha (empty when the caller set none)",
216
+ workflow: "workflow that wrote the row",
217
+ at: "when the row was written",
218
+ },
219
+ exitCodes: {
220
+ [EXIT_NO_STATUS]: "status.jsonl missing, unreadable, or not valid NDJSON",
221
+ [EXIT_NO_RUNTIME_ROW]: "no runtime-resolved row (for --workflow, when given)",
222
+ [EXIT_UNRESOLVED]: "the latest row has a field that is not a valid literal",
223
+ },
224
+ run: (ctx) => {
225
+ const workflow = str(ctx.flags.workflow);
226
+ const events = readStatusEvents(statusFile(ctx));
227
+ const rows = events
228
+ .filter((r) => r.type === "runtime-resolved")
229
+ .filter((r) => workflow === undefined || r.workflow === workflow);
230
+ const row = rows[rows.length - 1];
231
+ if (!row) {
232
+ ctx.log(`no runtime-resolved row${workflow ? ` for ${workflow}` : ""} — Step 1 never recorded the runtime`);
233
+ return EXIT_NO_RUNTIME_ROW;
234
+ }
235
+ const bad = unresolvedFields(row);
236
+ if (bad.length > 0) {
237
+ for (const key of bad) {
238
+ ctx.log(`${key} is UNRESOLVED (got ${JSON.stringify(row[key] ?? "")}) — never default it`);
239
+ }
240
+ return EXIT_UNRESOLVED;
241
+ }
242
+ ctx.emit({
243
+ runtime: row.runtime,
244
+ runtimeWorktrees: row.runtimeWorktrees,
245
+ runtimeDevPushes: row.runtimeDevPushes,
246
+ runtimeGithubCli: row.runtimeGithubCli,
247
+ runtimeGithubCliExit: typeof row.runtimeGithubCliExit === "number" ? row.runtimeGithubCliExit : null,
248
+ runtimeGithubCliErr: typeof row.runtimeGithubCliErr === "string" ? row.runtimeGithubCliErr : "",
249
+ baseSha: typeof row.baseSha === "string" ? row.baseSha : "",
250
+ workflow: row.workflow ?? null,
251
+ at: row.at ?? null,
252
+ });
253
+ return EXIT.OK;
254
+ },
255
+ },
256
+ },
257
+ };
@@ -0,0 +1,110 @@
1
+ // bkit skills prune — ship's skill prune: uninstall every skill `.agents/skills.md` does not list.
2
+ //
3
+ // Build's install-skills step adds feature-specific skills with the skills CLI;
4
+ // ship removes them again before merge so they never reach dev. The candidates
5
+ // are the union of `.agents/skills/` folders and `skills-lock.json` keys: a skill
6
+ // whose folder is already gone still has a lock entry, and looping over folders
7
+ // alone leaves it installed. bkit's own `bkit-*` skills are never touched.
8
+ // Pruning is housekeeping: a missing registry skips it with a warning, and a
9
+ // failed uninstall is reported; neither stops the ship.
10
+ import { spawnSync } from "node:child_process";
11
+ import * as fs from "node:fs";
12
+ import * as path from "node:path";
13
+ import { COULD_NOT_RUN_EXIT_CODES } from "../../shared/package-manager.js";
14
+ import { EXIT, git, parseJson } from "../lib.js";
15
+ /** The skills.sh CLI, as `.agents/skills.md` documents it. */
16
+ export const SKILLS_CLI = ["npx", "skills"];
17
+ const REGISTRY = path.join(".agents", "skills.md");
18
+ const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
19
+ /** Listed = named in the registry as a whole word, where `-` counts as part of a name. */
20
+ export const listedIn = (registry, skill) => new RegExp(`(^|[^A-Za-z0-9-])${escapeRegExp(skill)}([^A-Za-z0-9-]|$)`, "m").test(registry);
21
+ /** Installed skills: `.agents/skills/` folders plus `skills-lock.json` keys, sorted and unique. */
22
+ export function installedSkills(top, log) {
23
+ const names = new Set();
24
+ const dir = path.join(top, ".agents", "skills");
25
+ if (fs.existsSync(dir)) {
26
+ for (const e of fs.readdirSync(dir, { withFileTypes: true }))
27
+ if (e.isDirectory())
28
+ names.add(e.name);
29
+ }
30
+ const lock = path.join(top, "skills-lock.json");
31
+ if (fs.existsSync(lock)) {
32
+ const skills = parseLock(fs.readFileSync(lock, "utf-8"), log).skills;
33
+ if (skills && typeof skills === "object")
34
+ for (const k of Object.keys(skills))
35
+ names.add(k);
36
+ }
37
+ return [...names].sort();
38
+ }
39
+ function parseLock(raw, log) {
40
+ const parsed = parseJson(raw);
41
+ if (parsed.ok && parsed.value !== null && typeof parsed.value === "object")
42
+ return parsed.value;
43
+ // An unreadable lock still leaves the folders to prune; say so rather than stop the ship.
44
+ log("skills-lock.json is not valid JSON — pruning by .agents/skills/ folders only");
45
+ return {};
46
+ }
47
+ export const skillsCommand = {
48
+ noun: "skills",
49
+ summary: "Prune feature-specific skills before ship merges.",
50
+ verbs: {
51
+ prune: {
52
+ summary: "Uninstall every non-bkit skill .agents/skills.md does not list (ship Step 7).",
53
+ flags: [],
54
+ output: {
55
+ removed: "skills uninstalled",
56
+ kept: "skills left installed: listed in .agents/skills.md, or bkit's own",
57
+ failed: "unlisted skills still installed: the CLI failed, or could not run (warned, exit 0)",
58
+ skipped: "no-registry when .agents/skills.md is missing and nothing was pruned (warned, exit 0); null otherwise",
59
+ },
60
+ run: (ctx) => {
61
+ const top = git(ctx.cwd, ["rev-parse", "--show-toplevel"]) ?? ctx.cwd;
62
+ const registryFile = path.join(top, REGISTRY);
63
+ // Without the registry every skill reads as unlisted and would be uninstalled.
64
+ if (!fs.existsSync(registryFile)) {
65
+ ctx.log(`WARNING ${REGISTRY} missing — skill prune skipped, nothing uninstalled`);
66
+ ctx.emit({ removed: [], kept: [], failed: [], skipped: "no-registry" });
67
+ return EXIT.OK;
68
+ }
69
+ const registry = fs.readFileSync(registryFile, "utf-8");
70
+ const removed = [];
71
+ const kept = [];
72
+ const failed = [];
73
+ let couldNotRun = false;
74
+ for (const skill of installedSkills(top, ctx.log)) {
75
+ if (skill.startsWith("bkit-") || listedIn(registry, skill)) {
76
+ kept.push(skill);
77
+ continue;
78
+ }
79
+ if (couldNotRun) {
80
+ failed.push(skill);
81
+ continue;
82
+ }
83
+ const [cmd, ...args] = SKILLS_CLI;
84
+ const res = spawnSync(cmd, [...args, "remove", skill, "-y"], {
85
+ cwd: top,
86
+ encoding: "utf-8",
87
+ stdio: ["ignore", "pipe", "pipe"],
88
+ });
89
+ const status = res.error ? 127 : (res.status ?? 1);
90
+ if (status === 0) {
91
+ removed.push(skill);
92
+ continue;
93
+ }
94
+ ctx.log(`could not uninstall ${skill} (exit ${status}): ${(res.stderr ?? "").trim()}`);
95
+ if (COULD_NOT_RUN_EXIT_CODES.has(status))
96
+ couldNotRun = true;
97
+ failed.push(skill);
98
+ }
99
+ ctx.emit({ removed, kept, failed, skipped: null });
100
+ if (couldNotRun) {
101
+ ctx.log(`WARNING ${SKILLS_CLI.join(" ")} could not run — the skills in "failed" are still installed`);
102
+ }
103
+ else if (failed.length > 0) {
104
+ ctx.log(`WARNING could not uninstall ${failed.join(", ")} — still installed`);
105
+ }
106
+ return EXIT.OK;
107
+ },
108
+ },
109
+ },
110
+ };