@cbartens/bkit 5.5.1 → 6.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 (288) hide show
  1. package/.bkit/README.md +30 -20
  2. package/.bkit/core/.agents/docs.md +1 -0
  3. package/.bkit/core/.agents/rules.md +35 -26
  4. package/.bkit/core/.bkit/README.md +29 -19
  5. package/.bkit/core/.bkit/authoring.md +117 -0
  6. package/.bkit/core/.bkit/cloud.md +11 -11
  7. package/.bkit/core/.bkit/comparison.md +5 -5
  8. package/.bkit/core/.bkit/install.md +19 -18
  9. package/.bkit/core/.bkit/jsonl.md +202 -122
  10. package/.bkit/core/.bkit/lite.md +1 -1
  11. package/.bkit/core/.bkit/pipeline.md +49 -52
  12. package/.bkit/core/.bkit/prompts.md +91 -167
  13. package/.bkit/core/.bkit/providers.md +29 -32
  14. package/.bkit/core/.bkit/templates.md +12 -11
  15. package/.bkit/core/.bkit/trackers.md +51 -28
  16. package/.bkit/core/.bkit/workflows.md +394 -355
  17. package/.bkit/core/AGENTS.md +16 -22
  18. package/.bkit/core/docs/templates/bkit-audit-accessibility.md +14 -38
  19. package/.bkit/core/docs/templates/bkit-audit-adoption.md +16 -40
  20. package/.bkit/core/docs/templates/bkit-audit-agents.md +19 -43
  21. package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +16 -40
  22. package/.bkit/core/docs/templates/bkit-audit-analytics.md +14 -38
  23. package/.bkit/core/docs/templates/bkit-audit-annotations.md +11 -35
  24. package/.bkit/core/docs/templates/bkit-audit-app-performance.md +15 -39
  25. package/.bkit/core/docs/templates/bkit-audit-app-store.md +12 -36
  26. package/.bkit/core/docs/templates/bkit-audit-architecture.md +16 -40
  27. package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +16 -40
  28. package/.bkit/core/docs/templates/bkit-audit-config.md +18 -42
  29. package/.bkit/core/docs/templates/bkit-audit-cost.md +16 -40
  30. package/.bkit/core/docs/templates/bkit-audit-coverage.md +15 -39
  31. package/.bkit/core/docs/templates/bkit-audit-database.md +16 -40
  32. package/.bkit/core/docs/templates/bkit-audit-dead-code.md +15 -39
  33. package/.bkit/core/docs/templates/bkit-audit-deferrals.md +15 -38
  34. package/.bkit/core/docs/templates/bkit-audit-dependencies.md +16 -40
  35. package/.bkit/core/docs/templates/bkit-audit-documentation.md +11 -35
  36. package/.bkit/core/docs/templates/bkit-audit-duplication.md +18 -42
  37. package/.bkit/core/docs/templates/bkit-audit-failures.md +13 -37
  38. package/.bkit/core/docs/templates/bkit-audit-flakes.md +12 -36
  39. package/.bkit/core/docs/templates/bkit-audit-gates.md +14 -38
  40. package/.bkit/core/docs/templates/bkit-audit-issues.md +15 -39
  41. package/.bkit/core/docs/templates/bkit-audit-llm.md +16 -40
  42. package/.bkit/core/docs/templates/bkit-audit-logs.md +14 -38
  43. package/.bkit/core/docs/templates/bkit-audit-models.md +12 -36
  44. package/.bkit/core/docs/templates/bkit-audit-privacy.md +12 -36
  45. package/.bkit/core/docs/templates/bkit-audit-prompts.md +15 -39
  46. package/.bkit/core/docs/templates/bkit-audit-red-team.md +15 -39
  47. package/.bkit/core/docs/templates/bkit-audit-reliability.md +15 -39
  48. package/.bkit/core/docs/templates/bkit-audit-repo.md +12 -36
  49. package/.bkit/core/docs/templates/bkit-audit-security.md +13 -37
  50. package/.bkit/core/docs/templates/bkit-audit-slop.md +14 -38
  51. package/.bkit/core/docs/templates/bkit-audit-testing.md +12 -36
  52. package/.bkit/core/docs/templates/bkit-audit-usability.md +16 -40
  53. package/.bkit/core/docs/templates/bkit-plan.md +97 -226
  54. package/.bkit/core/engine/checks/after/ci-yml.ts +39 -29
  55. package/.bkit/core/engine/checks/after/github.ts +95 -17
  56. package/.bkit/core/engine/checks/after/index.ts +10 -7
  57. package/.bkit/core/engine/checks/after/suppression.ts +8 -5
  58. package/.bkit/core/engine/checks/after/tools.ts +46 -91
  59. package/.bkit/core/engine/checks/before/env.ts +2 -2
  60. package/.bkit/core/engine/checks/before/files.ts +5 -4
  61. package/.bkit/core/engine/checks/before/index.ts +18 -1
  62. package/.bkit/core/engine/checks/before/repo.ts +168 -2
  63. package/.bkit/core/engine/checks/tips/catalogue.ts +16 -5
  64. package/.bkit/core/engine/checks/tips/detect.ts +34 -0
  65. package/.bkit/core/engine/checks/tips/index.ts +6 -6
  66. package/.bkit/core/engine/cli.ts +20 -53
  67. package/.bkit/core/engine/commands/analysis.ts +171 -140
  68. package/.bkit/core/engine/commands/ci/ci.ts +6 -6
  69. package/.bkit/core/engine/commands/comply.ts +77 -103
  70. package/.bkit/core/engine/commands/install/doctor.ts +2 -2
  71. package/.bkit/core/engine/commands/install/install.ts +57 -18
  72. package/.bkit/core/engine/commands/install/uninstall.ts +65 -28
  73. package/.bkit/core/engine/commands/land.ts +18 -12
  74. package/.bkit/core/engine/commands/lib.ts +79 -17
  75. package/.bkit/core/engine/commands/registry.ts +4 -0
  76. package/.bkit/core/engine/commands/setup/setup.ts +7 -7
  77. package/.bkit/core/engine/commands/stats.ts +204 -0
  78. package/.bkit/core/engine/commands/tips.ts +10 -5
  79. package/.bkit/core/engine/commands/workflow/branches.ts +741 -62
  80. package/.bkit/core/engine/commands/workflow/challenge.ts +673 -0
  81. package/.bkit/core/engine/commands/workflow/context.ts +853 -29
  82. package/.bkit/core/engine/commands/workflow/counters.ts +267 -84
  83. package/.bkit/core/engine/commands/workflow/decisions.ts +541 -0
  84. package/.bkit/core/engine/commands/workflow/disk.ts +2 -2
  85. package/.bkit/core/engine/commands/workflow/fids.ts +793 -33
  86. package/.bkit/core/engine/commands/workflow/issues.ts +407 -64
  87. package/.bkit/core/engine/commands/workflow/ledgers.ts +884 -27
  88. package/.bkit/core/engine/commands/workflow/locks.ts +26 -2
  89. package/.bkit/core/engine/commands/workflow/plan-blocks.ts +582 -0
  90. package/.bkit/core/engine/commands/workflow/plan-versions.ts +21 -0
  91. package/.bkit/core/engine/commands/workflow/prs.ts +166 -30
  92. package/.bkit/core/engine/commands/workflow/repo.ts +58 -8
  93. package/.bkit/core/engine/commands/workflow/roadmap.ts +16 -7
  94. package/.bkit/core/engine/commands/workflow/run-facts.ts +501 -0
  95. package/.bkit/core/engine/commands/workflow/runs.ts +179 -49
  96. package/.bkit/core/engine/commands/workflow/runtime.ts +22 -1
  97. package/.bkit/core/engine/commands/workflow/status.ts +142 -29
  98. package/.bkit/core/engine/commands/workflow/step-table.ts +339 -0
  99. package/.bkit/core/engine/commands/workflow/steps.ts +213 -88
  100. package/.bkit/core/engine/commands/workflow/summary.ts +398 -0
  101. package/.bkit/core/engine/commands/workflow/tests.ts +1013 -148
  102. package/.bkit/core/engine/commands/workflow/tracker.ts +1195 -0
  103. package/.bkit/core/engine/commands/workflow/workflows.ts +984 -207
  104. package/.bkit/core/engine/commands/workflow/workstreams.ts +11 -5
  105. package/.bkit/core/engine/commands/workflow/worktrees.ts +185 -8
  106. package/.bkit/core/engine/install/manifest.ts +11 -9
  107. package/.bkit/core/engine/install/modules/cloud.ts +21 -13
  108. package/.bkit/core/engine/install/modules/core.ts +250 -3
  109. package/.bkit/core/engine/install/modules/opencode.ts +2 -2
  110. package/.bkit/core/engine/install/version-file.ts +6 -2
  111. package/.bkit/core/engine/ledgers/migrate.ts +92 -0
  112. package/.bkit/core/engine/ledgers/status.ts +92 -15
  113. package/.bkit/core/engine/ledgers/telemetry.ts +1261 -254
  114. package/.bkit/core/engine/render/hosts.ts +4 -0
  115. package/.bkit/core/engine/render/models.ts +12 -0
  116. package/.bkit/core/engine/shared/branches.ts +4 -1
  117. package/.bkit/core/engine/shared/egress.ts +7 -0
  118. package/.bkit/core/engine/shared/json.ts +25 -7
  119. package/.bkit/core/engine/shared/settings.ts +157 -20
  120. package/.bkit/core/engine/shared/text.ts +361 -0
  121. package/.bkit/core/engine/tools/grammar-density.ts +215 -0
  122. package/.bkit/core/engine/tools/instructions-sources.ts +834 -0
  123. package/.bkit/core/engine/tools/instructions.ts +1751 -0
  124. package/.bkit/core/hooks/gateguard-engine.js +24 -23
  125. package/.bkit/core/hooks/guardrails-shell.js +2 -3
  126. package/.bkit/core/hooks/guardrails-tiers.js +7 -1
  127. package/.bkit/core/hooks/readguard-engine.js +2 -2
  128. package/.bkit/core/prompts/bkit-audit-generate.md +62 -25
  129. package/.bkit/core/prompts/bkit-build-challenge-1.md +40 -17
  130. package/.bkit/core/prompts/bkit-build-challenge-2.md +44 -17
  131. package/.bkit/core/prompts/bkit-build-install-skills.md +26 -13
  132. package/.bkit/core/prompts/bkit-build-plan-convert.md +74 -0
  133. package/.bkit/core/prompts/bkit-build-plan-current.md +26 -13
  134. package/.bkit/core/prompts/bkit-build-plan-execute.md +74 -26
  135. package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +64 -23
  136. package/.bkit/core/prompts/bkit-build-plan-verify.md +57 -33
  137. package/.bkit/core/prompts/bkit-debug-abort-handover.md +29 -15
  138. package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +34 -14
  139. package/.bkit/core/prompts/bkit-debug-failure-remediate.md +34 -17
  140. package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +26 -13
  141. package/.bkit/core/prompts/bkit-debug-failure-soak.md +31 -16
  142. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +21 -11
  143. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +20 -11
  144. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +20 -11
  145. package/.bkit/core/prompts/bkit-design-generate.md +32 -14
  146. package/.bkit/core/prompts/bkit-design-organise.md +25 -12
  147. package/.bkit/core/prompts/bkit-design-review-1.md +31 -15
  148. package/.bkit/core/prompts/bkit-design-review-2.md +28 -13
  149. package/.bkit/core/prompts/bkit-design-spike.md +30 -13
  150. package/.bkit/core/prompts/bkit-design-update.md +33 -19
  151. package/.bkit/core/prompts/bkit-plan-generate.md +72 -18
  152. package/.bkit/core/prompts/bkit-plan-review-1.md +50 -27
  153. package/.bkit/core/prompts/bkit-plan-review-2.md +59 -28
  154. package/.bkit/core/prompts/bkit-plan-scope-check.md +109 -0
  155. package/.bkit/core/prompts/bkit-plan-update.md +61 -24
  156. package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +27 -15
  157. package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +31 -16
  158. package/.bkit/core/prompts/bkit-ship-update-docs.md +29 -14
  159. package/.bkit/core/prompts/bkit-utility-compress-markdown.md +24 -14
  160. package/.bkit/core/prompts/bkit-utility-update-decisions.md +32 -14
  161. package/.bkit/core/prompts/bkit-utility-update-deferrals.md +29 -14
  162. package/.bkit/core/prompts/bkit-utility-update-documentation.md +27 -12
  163. package/.bkit/core/prompts/bkit-utility-update-failures.md +31 -14
  164. package/.bkit/core/prompts/bkit-utility-update-knowledge.md +33 -14
  165. package/.bkit/core/prompts/bkit-utility-update-roadmap.md +38 -17
  166. package/.bkit/core/prompts/bkit-utility-update-tracker.md +41 -18
  167. package/.bkit/core/workflows/bkit-auto.md +54 -46
  168. package/.bkit/core/workflows/bkit-build.md +577 -458
  169. package/.bkit/core/workflows/bkit-debug.md +348 -333
  170. package/.bkit/core/workflows/bkit-design.md +201 -237
  171. package/.bkit/core/workflows/bkit-plan.md +210 -321
  172. package/.bkit/core/workflows/bkit-ship.md +328 -278
  173. package/.bkit/shared/.bkit/.env.example +2 -2
  174. package/.bkit/shared/.claude/settings.json +11 -0
  175. package/.bkit/shared/.cursor/mcp.json +1 -1
  176. package/.bkit/shared/.cursor/rules/bkit-rules.mdc +1 -1
  177. package/.bkit/shared/.gitattributes +1 -1
  178. package/.bkit/shared/.mcp.json +1 -1
  179. package/.bkit/shared/.opencode/opencode.json +11 -0
  180. package/.bkit/shared/CLAUDE.md +2 -2
  181. package/.bkit/shared/GEMINI.md +2 -2
  182. package/.bkit/shared/docs/architecture.md +1 -1
  183. package/.bkit/shared/docs/data-schema.md +1 -1
  184. package/.bkit/shared/docs/deployments.md +11 -11
  185. package/.bkit/shared/docs/design.md +1 -1
  186. package/.bkit/shared/docs/noise.md +1 -1
  187. package/.bkit/shared/docs/observability.md +2 -2
  188. package/.bkit/shared/docs/security.md +1 -1
  189. package/.bkit/shared/docs/setup.md +1 -1
  190. package/.bkit/shared/docs/technology.md +1 -1
  191. package/.bkit/shared/docs/testing.md +16 -7
  192. package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +1 -1
  193. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-change.yml +26 -5
  194. package/.bkit/templates/.github/workflows/bkit-ci.yml +1 -1
  195. package/.bkit/templates/.github/workflows/bkit-cloud.yml +21 -19
  196. package/.bkit/templates/.husky/pre-push +4 -4
  197. package/.bkit/templates/.prettierignore +7 -0
  198. package/.bkit/templates/scripts/cleanup/bkit-disk-prune.mjs +1 -1
  199. package/CHANGELOG.md +112 -0
  200. package/README.md +50 -35
  201. package/dist/checks/after/ci-yml.js +39 -28
  202. package/dist/checks/after/github.js +91 -17
  203. package/dist/checks/after/index.js +11 -8
  204. package/dist/checks/after/suppression.js +8 -5
  205. package/dist/checks/after/tools.js +39 -82
  206. package/dist/checks/before/env.js +2 -2
  207. package/dist/checks/before/files.js +5 -3
  208. package/dist/checks/before/index.js +15 -2
  209. package/dist/checks/before/repo.js +163 -2
  210. package/dist/checks/tips/catalogue.js +14 -5
  211. package/dist/checks/tips/detect.js +32 -0
  212. package/dist/checks/tips/index.js +4 -4
  213. package/dist/cli.js +19 -47
  214. package/dist/commands/analysis.js +109 -100
  215. package/dist/commands/ci/ci.js +6 -6
  216. package/dist/commands/comply.js +54 -91
  217. package/dist/commands/install/doctor.js +2 -2
  218. package/dist/commands/install/install.js +50 -19
  219. package/dist/commands/install/uninstall.js +59 -28
  220. package/dist/commands/land.js +16 -12
  221. package/dist/commands/lib.js +51 -16
  222. package/dist/commands/registry.js +4 -0
  223. package/dist/commands/setup/setup.js +7 -7
  224. package/dist/commands/stats.js +136 -0
  225. package/dist/commands/tips.js +7 -3
  226. package/dist/commands/workflow/branches.js +656 -56
  227. package/dist/commands/workflow/challenge.js +556 -0
  228. package/dist/commands/workflow/context.js +709 -30
  229. package/dist/commands/workflow/counters.js +208 -75
  230. package/dist/commands/workflow/decisions.js +441 -0
  231. package/dist/commands/workflow/disk.js +2 -2
  232. package/dist/commands/workflow/fids.js +689 -33
  233. package/dist/commands/workflow/issues.js +343 -59
  234. package/dist/commands/workflow/ledgers.js +762 -27
  235. package/dist/commands/workflow/locks.js +24 -2
  236. package/dist/commands/workflow/plan-blocks.js +437 -0
  237. package/dist/commands/workflow/plan-versions.js +22 -0
  238. package/dist/commands/workflow/prs.js +142 -32
  239. package/dist/commands/workflow/repo.js +52 -8
  240. package/dist/commands/workflow/roadmap.js +9 -7
  241. package/dist/commands/workflow/run-facts.js +426 -0
  242. package/dist/commands/workflow/runs.js +144 -43
  243. package/dist/commands/workflow/runtime.js +12 -1
  244. package/dist/commands/workflow/status.js +130 -29
  245. package/dist/commands/workflow/step-table.js +276 -0
  246. package/dist/commands/workflow/steps.js +171 -80
  247. package/dist/commands/workflow/summary.js +275 -0
  248. package/dist/commands/workflow/tests.js +834 -136
  249. package/dist/commands/workflow/tracker.js +983 -0
  250. package/dist/commands/workflow/workflows.js +834 -195
  251. package/dist/commands/workflow/workstreams.js +11 -5
  252. package/dist/commands/workflow/worktrees.js +147 -9
  253. package/dist/install/manifest.js +11 -9
  254. package/dist/install/modules/cloud.js +22 -13
  255. package/dist/install/modules/core.js +247 -3
  256. package/dist/install/modules/opencode.js +2 -2
  257. package/dist/install/version-file.js +6 -2
  258. package/dist/ledgers/migrate.js +81 -0
  259. package/dist/ledgers/status.js +61 -8
  260. package/dist/ledgers/telemetry.js +905 -124
  261. package/dist/render/hosts.js +4 -0
  262. package/dist/render/models.js +12 -0
  263. package/dist/shared/branches.js +3 -1
  264. package/dist/shared/egress.js +7 -0
  265. package/dist/shared/json.js +20 -7
  266. package/dist/shared/settings.js +125 -17
  267. package/dist/shared/text.js +333 -0
  268. package/dist/tools/grammar-density.js +183 -0
  269. package/dist/tools/instructions-sources.js +721 -0
  270. package/dist/tools/instructions.js +1579 -0
  271. package/package.json +113 -24
  272. package/.bkit/core/engine/commands/harvest.ts +0 -459
  273. package/.bkit/core/engine/tools/wording.ts +0 -748
  274. package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +0 -69
  275. package/.bkit/core/prompts/bkit-build-challenge-remediate.md +0 -71
  276. package/.bkit/core/prompts/bkit-build-challenge-tests.md +0 -74
  277. package/.bkit/core/prompts/bkit-build-summary.md +0 -94
  278. package/.bkit/core/prompts/bkit-debug-summary.md +0 -96
  279. package/.bkit/core/prompts/bkit-design-summary.md +0 -107
  280. package/.bkit/core/prompts/bkit-plan-complexity-check.md +0 -67
  281. package/.bkit/core/prompts/bkit-plan-complexity-split.md +0 -88
  282. package/.bkit/core/prompts/bkit-plan-review-3.md +0 -93
  283. package/.bkit/core/prompts/bkit-plan-scope-check-1.md +0 -85
  284. package/.bkit/core/prompts/bkit-plan-scope-check-2.md +0 -85
  285. package/.bkit/core/prompts/bkit-plan-summary.md +0 -107
  286. package/.bkit/core/prompts/bkit-ship-summary.md +0 -78
  287. package/dist/commands/harvest.js +0 -353
  288. package/dist/tools/wording.js +0 -680
@@ -1,10 +1,13 @@
1
- // The one way bkit lands a commit on dev: build it in a detached throwaway
2
- // worktree off a fresh origin/dev and push it as dev. The main checkout's
3
- // branch, index and edits are never touched, and local dev commits missing from
4
- // origin/dev are never pushed. dev moved underneath → rebuild on the new dev and
5
- // push again, with backoff. Used by the design / plan close, the build / debug
6
- // roadmap mirror, and ship's close and FAILED record. The throwaway runs no git
7
- // hooks: what it lands is bookkeeping only (docs, logs, ledgers, `[skip ci]`).
1
+ // The one way bkit lands commits on dev from a throwaway: build them in a
2
+ // detached worktree off a fresh origin/dev and push it as dev. The main
3
+ // checkout's branch, index and edits are never touched, and local dev commits
4
+ // missing from origin/dev are never pushed as they stand — a caller that wants
5
+ // some of them replays exactly those. dev moved underneath → rebuild on the new
6
+ // dev and push again, with backoff. Used by the design / plan close, the
7
+ // build / debug roadmap mirror, ship's close and FAILED record, and the
8
+ // own-commit push of a debug run in place on dev, which replays the run's
9
+ // commits. The throwaway runs no git hooks: it lands bookkeeping (docs, logs,
10
+ // ledgers, `[skip ci]`) or the commits a debug run on dev made.
8
11
 
9
12
  import * as fs from "node:fs";
10
13
  import * as path from "node:path";
@@ -104,10 +107,11 @@ export type DevPush =
104
107
  | { kind: "setup-failed"; stderr: string };
105
108
 
106
109
  /**
107
- * Land one commit on dev: per attempt, fetch dev, add `dir` detached at
108
- * origin/dev, let `build` make the commit there, push `HEAD:dev` — git hooks
109
- * off. `build` throwing stops the landing with that throw. A server refusal runs
110
- * `refused` on the built commit first, when given. `dir` is removed on every path.
110
+ * Land on dev what `build` makes: per attempt, fetch dev, add `dir` detached at
111
+ * origin/dev, let `build` make one or more commits there (a bookkeeping commit,
112
+ * or a replay of a run's commits), push `HEAD:dev` — git hooks off. `build`
113
+ * throwing stops the landing with that throw. A server refusal runs `refused` on
114
+ * the built commits first, when given. `dir` is removed on every path.
111
115
  */
112
116
  export async function pushToDev(o: {
113
117
  root: string;
@@ -116,7 +120,9 @@ export async function pushToDev(o: {
116
120
  refused?: (dir: string, stderr: string) => Promise<void>;
117
121
  log: (line: string) => void;
118
122
  }): Promise<DevPush> {
119
- o.log("git hooks skipped in the throwaway dev checkout — it lands bookkeeping only");
123
+ o.log(
124
+ "git hooks skipped in the throwaway dev checkout — it lands bookkeeping, or the commits a debug run on dev made",
125
+ );
120
126
  for (let attempt = 1; ; attempt++) {
121
127
  let wait = 0;
122
128
  dropLandTree(o.root, o.dir);
@@ -1,6 +1,7 @@
1
1
  // commands/lib.ts — what every `bkit <noun> <verb>` command shares.
2
2
  //
3
- // Flag parsing, one JSON object on stdout, `[bkit-<noun>]`-tagged logs on stderr,
3
+ // Flag parsing, one output object on stdout (text, or JSON with `--json`),
4
+ // `[bkit-<noun>]`-tagged logs on stderr,
4
5
  // the exit-code table, `--help` rendering, and the repo facts several workflow
5
6
  // steps each re-derived by hand: repo root, UTC month, where `status.jsonl` lives,
6
7
  // the skip-CI tokens, and which branches are shared. A command declares its flags,
@@ -13,6 +14,7 @@ import * as os from "node:os";
13
14
  import * as path from "node:path";
14
15
 
15
16
  import { gitEnv } from "../ledgers/telemetry.js";
17
+ import { renderText } from "../shared/text.js";
16
18
 
17
19
  // ---------------------------------------------------------------------------
18
20
  // Exit codes
@@ -82,17 +84,31 @@ export interface RunContext {
82
84
  /** Parsed flags, keyed by camelCase name. */
83
85
  flags: Record<string, FlagValue>;
84
86
  cwd: string;
87
+ /** The global `--json` flag was given. Taken by every verb, never declared in a verb's spec. */
88
+ json: boolean;
85
89
  /** Human-readable line on stderr, tagged `[bkit-<noun>]`. */
86
90
  log(message: string): void;
87
- /** The command's one JSON object on stdout. Call at most once. */
91
+ /**
92
+ * The command's one output object on stdout: text (`shared/text.ts` `renderText`,
93
+ * less the verb's `textOmit` keys), or one JSON object under `--json`. Call at most once.
94
+ */
88
95
  emit(output: Record<string, unknown>): void;
89
96
  }
90
97
 
98
+ /**
99
+ * An output key the text output leaves out: always, or only `when` its value holds.
100
+ * `audits/workflows/text-omit.test.ts` fails when a workflow or prompt reads one.
101
+ */
102
+ export type TextOmit =
103
+ string | { key: string; when: (value: unknown, output: Record<string, unknown>) => boolean };
104
+
91
105
  export interface VerbSpec {
92
106
  summary: string;
93
107
  flags: FlagSpec[];
94
108
  /** Output key -> meaning. Keys are camelCase, matching `status.jsonl`. */
95
109
  output: Record<string, string>;
110
+ /** Output keys no workflow or prompt reads: printed under `--json` only. */
111
+ textOmit?: readonly TextOmit[];
96
112
  /** This verb's own exit codes (3-79) -> meaning. */
97
113
  exitCodes?: Record<number, string>;
98
114
  run(ctx: RunContext): number | Promise<number>;
@@ -243,8 +259,8 @@ export function verbHelp(cmd: CommandSpec, verb: string): string {
243
259
  "Flags:",
244
260
  flags.length ? table(flags) : " none",
245
261
  "",
246
- "Output (one JSON object on stdout):",
247
- table(Object.entries(spec.output)),
262
+ "Output (one object on stdout: `key: value` text, JSON with --json):",
263
+ table(Object.entries(spec.output).map(([key, help]) => [key, help + omitNote(spec, key)])),
248
264
  "",
249
265
  "Exit codes:",
250
266
  table(exitCodeRows(spec.exitCodes)),
@@ -270,6 +286,26 @@ const processIo: Io = {
270
286
 
271
287
  const isHelp = (arg: string | undefined) => arg === "--help" || arg === "-h";
272
288
 
289
+ /** Global boolean flag every verb takes; it is removed before the verb's own flags parse. */
290
+ const JSON_FLAG = "--json";
291
+
292
+ /** `output` less the keys `spec.textOmit` leaves out of text. */
293
+ function textOutput(spec: VerbSpec, output: Record<string, unknown>): Record<string, unknown> {
294
+ const omit = new Set(
295
+ (spec.textOmit ?? []).flatMap((o) =>
296
+ typeof o === "string" ? [o] : o.when(output[o.key], output) ? [o.key] : [],
297
+ ),
298
+ );
299
+ return Object.fromEntries(Object.entries(output).filter(([k]) => !omit.has(k)));
300
+ }
301
+
302
+ /** `--help`'s note on an output key text leaves out: always, or only when it does not matter. */
303
+ function omitNote(spec: VerbSpec, key: string): string {
304
+ const o = (spec.textOmit ?? []).find((x) => (typeof x === "string" ? x : x.key) === key);
305
+ if (o === undefined) return "";
306
+ return typeof o === "string" ? " (--json only)" : " (text: only when it matters)";
307
+ }
308
+
273
309
  /**
274
310
  * Run `argv` (without the leading `bkit`) if it names a registered command.
275
311
  * Returns the exit code, or null when `argv` is not a command, so the caller falls
@@ -310,15 +346,21 @@ export async function runCommand(
310
346
  const ctx: RunContext = {
311
347
  flags: {},
312
348
  cwd: options.cwd ?? process.cwd(),
349
+ json: false,
313
350
  log: (message) => io.stderr(`${tag} ${message}\n`),
314
351
  emit: (output) => {
315
- if (emitted) throw new Error(`${tag} ${verb} emitted twice — one JSON object per run`);
352
+ if (emitted) throw new Error(`${tag} ${verb} emitted twice — one output object per run`);
316
353
  emitted = true;
317
- io.stdout(`${JSON.stringify(output)}\n`);
354
+ io.stdout(ctx.json ? `${JSON.stringify(output)}\n` : renderText(textOutput(spec, output)));
318
355
  },
319
356
  };
320
357
  try {
321
- ctx.flags = parseFlags(rest, spec.flags);
358
+ const own = rest.filter((arg) => arg !== JSON_FLAG);
359
+ if (own.some((arg) => arg.startsWith(`${JSON_FLAG}=`))) {
360
+ throw new CommandError(EXIT.USAGE, `${JSON_FLAG} takes no value`);
361
+ }
362
+ ctx.json = own.length !== rest.length;
363
+ ctx.flags = parseFlags(own, spec.flags);
322
364
  return await spec.run(ctx);
323
365
  } catch (err) {
324
366
  if (!(err instanceof CommandError)) throw err;
@@ -331,8 +373,8 @@ export async function runCommand(
331
373
  // Repo facts
332
374
  // ---------------------------------------------------------------------------
333
375
 
334
- /** Captured stdout / stderr cap for `runGit` / `runTool`; hook output (pre-push) counts. */
335
- const OUTPUT_LIMIT = 1 << 26;
376
+ /** Captured stdout / stderr cap for every git / gh spawn; hook output (pre-push) counts. */
377
+ export const OUTPUT_LIMIT = 1 << 26;
336
378
 
337
379
  /** Spawn error as a stderr lead line: ENOBUFS names the limit, anything else Node's message. */
338
380
  function spawnErrorText(cmd: string, args: string[], err: NodeJS.ErrnoException): string {
@@ -341,15 +383,16 @@ function spawnErrorText(cmd: string, args: string[], err: NodeJS.ErrnoException)
341
383
  : err.message;
342
384
  }
343
385
 
344
- /** `git <args>` in `cwd`, never throwing: exit status plus trimmed stdout / stderr. */
386
+ /** `git <args>` in `cwd`, never throwing: exit status plus trimmed stdout / stderr; `env` adds vars. */
345
387
  export function runGit(
346
388
  cwd: string,
347
389
  args: string[],
390
+ env: Record<string, string> = {},
348
391
  ): { ok: boolean; stdout: string; stderr: string } {
349
392
  const res = spawnSync("git", args, {
350
393
  cwd,
351
394
  encoding: "utf-8",
352
- env: gitEnv(),
395
+ env: { ...gitEnv(), ...env },
353
396
  maxBuffer: OUTPUT_LIMIT,
354
397
  });
355
398
  const stderr = (res.stderr ?? "").trim();
@@ -374,7 +417,7 @@ export function git(cwd: string, args: string[]): string | null {
374
417
  export { parseJson } from "../shared/json.js";
375
418
 
376
419
  // The shared-branch rule (`dev`, `main`) lives in shared/ so checks can read it too.
377
- export { DEV, isSharedBranch } from "../shared/branches.js";
420
+ export { DEV, MAIN, isSharedBranch } from "../shared/branches.js";
378
421
 
379
422
  export interface ToolResult {
380
423
  /** False when the binary is not on PATH (or could not be spawned). */
@@ -393,12 +436,12 @@ export function runTool(
393
436
  cmd: string,
394
437
  args: string[],
395
438
  cwd: string,
396
- opts: { input?: string } = {},
439
+ opts: { input?: string; env?: Record<string, string> } = {},
397
440
  ): ToolResult {
398
441
  const res = spawnSync(cmd, args, {
399
442
  cwd,
400
443
  encoding: "utf-8",
401
- env: gitEnv(),
444
+ env: { ...gitEnv(), ...opts.env },
402
445
  input: opts.input,
403
446
  maxBuffer: OUTPUT_LIMIT,
404
447
  });
@@ -430,9 +473,14 @@ export interface GhResult {
430
473
  status?: number;
431
474
  }
432
475
 
433
- /** `gh <args>` in `cwd`, never throwing; `input` goes to stdin. */
434
- export function runGh(cwd: string, args: string[], input?: string): GhResult {
435
- const res = runTool("gh", args, cwd, { input });
476
+ /** `gh <args>` in `cwd`, never throwing; `input` goes to stdin; `env` is added to the child's. */
477
+ export function runGh(
478
+ cwd: string,
479
+ args: string[],
480
+ input?: string,
481
+ env?: Record<string, string>,
482
+ ): GhResult {
483
+ const res = runTool("gh", args, cwd, { input, env });
436
484
  return {
437
485
  ok: res.found && res.status === 0,
438
486
  stdout: res.stdout.trim(),
@@ -460,6 +508,20 @@ export function repoRoot(cwd: string): string {
460
508
  return path.dirname(common);
461
509
  }
462
510
 
511
+ /** `<git common dir>/bkit-outbox`: per-run scratch files, never committed; null outside a git repo. */
512
+ export function outboxRoot(cwd: string): string | null {
513
+ const common = git(cwd, ["rev-parse", "--path-format=absolute", "--git-common-dir"]);
514
+ return common ? path.join(common, "bkit-outbox") : null;
515
+ }
516
+
517
+ /** An outbox path as a committed record names it: relative to the main checkout, never a home path. */
518
+ export function outboxRel(cwd: string, file: string): string {
519
+ const root = outboxRoot(cwd);
520
+ if (root === null) return file;
521
+ const rel = path.relative(path.dirname(path.dirname(root)), file);
522
+ return rel.startsWith("..") || path.isAbsolute(rel) ? file : rel.split(path.sep).join("/");
523
+ }
524
+
463
525
  /** `YYYYMM` in UTC, so every workflow picks the same month bucket at a month boundary. */
464
526
  export function utcMonth(now: Date = new Date()): string {
465
527
  return `${now.getUTCFullYear()}${String(now.getUTCMonth() + 1).padStart(2, "0")}`;
@@ -9,8 +9,10 @@ import { ciCommand } from "./ci/ci.js";
9
9
  import type { CommandSpec } from "./lib.js";
10
10
  import { setupCommand } from "./setup/setup.js";
11
11
  import { branchesCommand } from "./workflow/branches.js";
12
+ import { challengeCommand } from "./workflow/challenge.js";
12
13
  import { contextCommand } from "./workflow/context.js";
13
14
  import { countersCommand } from "./workflow/counters.js";
15
+ import { decisionsCommand } from "./workflow/decisions.js";
14
16
  import { diskCommand } from "./workflow/disk.js";
15
17
  import { fidsCommand } from "./workflow/fids.js";
16
18
  import { issuesCommand } from "./workflow/issues.js";
@@ -37,6 +39,8 @@ export const COMMANDS: readonly CommandSpec[] = [
37
39
  repoCommand,
38
40
  fidsCommand,
39
41
  testsCommand,
42
+ challengeCommand,
43
+ decisionsCommand,
40
44
  locksCommand,
41
45
  workflowsCommand,
42
46
  worktreesCommand,
@@ -5,7 +5,7 @@
5
5
  // The policy also binds admins. `dev` is left unprotected — operators choose
6
6
  // direct-push or feat/PR.
7
7
  //
8
- // The required check is `bkit.capstoneJob`, the always-on job that asserts every
8
+ // The required check is `bkit.testing.ciCapstone`, the always-on job that asserts every
9
9
  // expected tier ran and passed, so "required check green" means validated, not
10
10
  // merely "the tests job did not fail". Before requiring it the command checks a
11
11
  // job by that name exists in the CI workflow: a required check no job produces
@@ -27,9 +27,9 @@ import {
27
27
 
28
28
  /** Exit code: `gh repo view` did not name the repository. */
29
29
  export const EXIT_NO_REPO = 3;
30
- /** Exit code: the CI workflow file named by `bkit.ciWorkflow` does not exist. */
30
+ /** Exit code: the CI workflow file named by `bkit.testing.ciWorkflow` does not exist. */
31
31
  export const EXIT_NO_CI_WORKFLOW = 4;
32
- /** Exit code: the CI workflow has no job named `bkit.capstoneJob`. */
32
+ /** Exit code: the CI workflow has no job named `bkit.testing.ciCapstone`. */
33
33
  export const EXIT_NO_CAPSTONE_JOB = 5;
34
34
  /** Exit code: a `gh api` call failed. */
35
35
  export const EXIT_GH_API_FAILED = 6;
@@ -164,8 +164,8 @@ export const setupCommand: CommandSpec = {
164
164
  output: {
165
165
  repo: "owner/name the policy targets",
166
166
  branch: "always main",
167
- requiredCheck: "the required status check (bkit.capstoneJob)",
168
- ciWorkflow: "the CI workflow checked for that job (bkit.ciWorkflow)",
167
+ requiredCheck: "the required status check (bkit.testing.ciCapstone)",
168
+ ciWorkflow: "the CI workflow checked for that job (bkit.testing.ciWorkflow)",
169
169
  dryRun: "true with --dry-run",
170
170
  applied: "true when the policy was written to GitHub",
171
171
  payload: "the protection body sent (or that would be sent)",
@@ -174,8 +174,8 @@ export const setupCommand: CommandSpec = {
174
174
  },
175
175
  exitCodes: {
176
176
  [EXIT_NO_REPO]: "gh repo view could not name the repository",
177
- [EXIT_NO_CI_WORKFLOW]: "the CI workflow file (bkit.ciWorkflow) does not exist",
178
- [EXIT_NO_CAPSTONE_JOB]: "the CI workflow has no job named bkit.capstoneJob",
177
+ [EXIT_NO_CI_WORKFLOW]: "the CI workflow file (bkit.testing.ciWorkflow) does not exist",
178
+ [EXIT_NO_CAPSTONE_JOB]: "the CI workflow has no job named bkit.testing.ciCapstone",
179
179
  [EXIT_GH_API_FAILED]: "a gh api call failed",
180
180
  },
181
181
  run: protectMain,
@@ -0,0 +1,204 @@
1
+ // commands/stats.ts — `bkit stats`: this repo's stats report.
2
+ //
3
+ // Reads THIS repo's `.bkit/stats.jsonl`, `.bkit/friction.jsonl` and `docs/deferrals.jsonl`,
4
+ // runs the computations in commands/analysis.ts over them, writes `.bkit/stats.md` and
5
+ // prints it. Never reads another repo, chat history or `harvest/`: the cross-repo report is
6
+ // `harvest/stats.md`, written by the harvest script in bkit's own checkout.
7
+ //
8
+ // `.bkit/stats.md` is committed. It holds no timestamp, so it changes only when the ledgers do.
9
+ // `chat` / `run` rows left in `.bkit/stats.jsonl` (written there before they moved to
10
+ // `harvest/`) are not counted.
11
+ //
12
+ // Advisory + inform-only: never gates a workflow, always exits 0.
13
+ // See DE-34 for the shared-entrypoint + crash-isolation contract.
14
+
15
+ import * as fs from "node:fs";
16
+ import * as path from "node:path";
17
+ import { markdownTable } from "../shared/text.js";
18
+ import { runAnalysis, type AnalysisReport } from "./analysis.js";
19
+ import { CHALLENGE_SMALL } from "./workflow/challenge.js";
20
+
21
+ /** The ledgers `bkit stats` reads, relative to the repo root. */
22
+ export const STATS_SOURCES = [
23
+ ".bkit/stats.jsonl",
24
+ ".bkit/friction.jsonl",
25
+ "docs/deferrals.jsonl",
26
+ ] as const;
27
+
28
+ /** Where `bkit stats` writes its report, relative to the repo root. */
29
+ export const STATS_REPORT = ".bkit/stats.md";
30
+
31
+ /** Kinds the harvest owns: never counted in a repo's own report. */
32
+ const HARVEST_KINDS = new Set(["chat", "run"]);
33
+
34
+ const pct = (rate: number): string => `${(rate * 100).toFixed(1)}%`;
35
+
36
+ /** A markdown table under a prettier-ignore marker, or nothing when there are no rows. */
37
+ function table(head: string[], rows: (string | number)[][]): string[] {
38
+ const lines = markdownTable(head, rows);
39
+ return lines.length === 0 ? [] : ["<!-- prettier-ignore -->", ...lines, ""];
40
+ }
41
+
42
+ /** Sorted `[key, count]` pairs of a count map, largest first, then by name. */
43
+ function ranked(counts: Record<string, number>): [string, number][] {
44
+ return Object.entries(counts).sort(([a, x], [b, y]) => y - x || a.localeCompare(b));
45
+ }
46
+
47
+ /**
48
+ * The report as markdown sections under `## ` headings. `title` is the `# ` heading;
49
+ * `scope` the sentence under it saying which rows were read.
50
+ */
51
+ export function renderStatsMarkdown(report: AnalysisReport, title: string, scope: string): string {
52
+ const { counts, elapsed, regression, complianceRates, versionCompliance, deferralDiscipline } =
53
+ report;
54
+ const out: string[] = [`# ${title}`, "", scope, ""];
55
+
56
+ out.push("## Rows", "");
57
+ if (counts.total === 0) {
58
+ out.push("No rows yet. Workflows append them at close.", "");
59
+ return out.join("\n");
60
+ }
61
+ out.push(...table(["Kind", "Rows"], ranked(counts.byKind)));
62
+ out.push(...table(["Workflow", "Rows"], ranked(counts.byWorkflow)));
63
+ if (Object.keys(counts.byRepo).length > 1) {
64
+ out.push(...table(["Repo", "Rows"], ranked(counts.byRepo)));
65
+ }
66
+
67
+ out.push("## Run durations", "");
68
+ if (elapsed.count === 0) {
69
+ out.push("No outcome row records a duration.", "");
70
+ } else {
71
+ out.push(
72
+ ...table(
73
+ ["Runs", "Mean (min)", "Median (min)", "Min (min)", "Max (min)"],
74
+ [
75
+ [
76
+ elapsed.count,
77
+ elapsed.meanMinutes.toFixed(1),
78
+ elapsed.p50Minutes.toFixed(1),
79
+ elapsed.minMinutes,
80
+ elapsed.maxMinutes,
81
+ ],
82
+ ],
83
+ ),
84
+ );
85
+ }
86
+
87
+ out.push("## Change size vs failures", "");
88
+ out.push(
89
+ `A run counts as an error when it added failures. Dispatch-size threshold: ${regression.dispatchSizeThreshold} lines added.`,
90
+ "",
91
+ );
92
+ out.push(
93
+ ...table(
94
+ ["Lines added", "Runs", "Errors", "Error rate"],
95
+ regression.buckets
96
+ .filter((b) => b.count > 0)
97
+ .map((b) => [b.label, b.count, b.errorCount, pct(b.errorRate)]),
98
+ ),
99
+ );
100
+ out.push(
101
+ `Attempt counters: ${regression.shellBusCount} counted by the shell (trusted), ${regression.modelSelfReportCount} reported by the model (untrusted).`,
102
+ "",
103
+ );
104
+
105
+ if (report.challengeGate.runs > 0) {
106
+ const g = report.challengeGate;
107
+ out.push("## Build challenge size", "");
108
+ out.push(
109
+ `Small changes (under ${CHALLENGE_SMALL.lines} lines and ${CHALLENGE_SMALL.files} files) run the security reviewer alone.`,
110
+ "",
111
+ );
112
+ out.push(
113
+ ...table(["Runs", "Small (challenge-1 skipped)", "Large"], [[g.runs, g.small, g.large]]),
114
+ );
115
+ }
116
+
117
+ const context = report.agentContext;
118
+ out.push("## Agent context peaks", "");
119
+ if (context.recorded === 0) {
120
+ out.push(
121
+ "No context data. A close records it from the Claude Code session that ran the workflow.",
122
+ "",
123
+ );
124
+ } else {
125
+ out.push(
126
+ `Cap: ${context.cap} tokens per agent. ${context.recorded} of ${context.outcomes} runs recorded context.`,
127
+ "",
128
+ );
129
+ out.push(
130
+ ...table(
131
+ ["Agent type", "Subagents", "Runs", "Peak (tokens)", "Runs over cap"],
132
+ context.byAgent.map((a) => [a.agent, a.subagents, a.runs, a.peak, a.overCap]),
133
+ ),
134
+ );
135
+ }
136
+
137
+ if (complianceRates.length > 0) {
138
+ out.push("## Compliance by rule", "");
139
+ out.push(
140
+ ...table(
141
+ ["Rule", "Pass", "Fail", "n/a", "Pass rate"],
142
+ complianceRates.map((r) => [r.rule, r.passCount, r.failCount, r.naCount, pct(r.passRate)]),
143
+ ),
144
+ );
145
+ }
146
+
147
+ if (versionCompliance.length > 0) {
148
+ out.push("## Compliance by bkit version", "");
149
+ out.push(
150
+ ...table(
151
+ ["Version", "Runs", "Pass rate"],
152
+ versionCompliance.map((v) => [v.version, v.totalRuns, pct(v.passRate)]),
153
+ ),
154
+ );
155
+ }
156
+
157
+ if (deferralDiscipline.length > 0) {
158
+ out.push("## Deferral discipline", "");
159
+ out.push("Deferrals adjudicated unjustified, by the writer that deferred.", "");
160
+ out.push(
161
+ ...table(
162
+ ["Writer", "Model", "Deferrals", "Unjustified", "Rate", "Reasons"],
163
+ deferralDiscipline.map((d) => [
164
+ d.writer,
165
+ d.model,
166
+ d.total,
167
+ d.unjustifiedCount,
168
+ pct(d.unjustifiedRate),
169
+ Object.entries(d.byReason)
170
+ .sort(([a], [b]) => a.localeCompare(b))
171
+ .map(([reason, n]) => `${reason}=${n}`)
172
+ .join(" "),
173
+ ]),
174
+ ),
175
+ );
176
+ }
177
+
178
+ return out.join("\n").replace(/\n+$/, "\n");
179
+ }
180
+
181
+ /** Build this repo's report from the ledgers under `root`. */
182
+ export function buildRepoStats(root: string): string {
183
+ const files = STATS_SOURCES.map((rel) => path.join(root, rel)).filter((p) => fs.existsSync(p));
184
+ return renderStatsMarkdown(
185
+ runAnalysis(files, HARVEST_KINDS),
186
+ "bkit stats",
187
+ `This repo only: ${STATS_SOURCES.map((s) => `\`${s}\``).join(", ")}. Written by \`bkit stats\`; workflow closes append the rows.`,
188
+ );
189
+ }
190
+
191
+ // stats — this repo's stats report. Advisory + inform-only: exits 0.
192
+ // See DE-34 for the shared-entrypoint + crash-isolation contract.
193
+ export function runStatsCommand(): void {
194
+ try {
195
+ const root = process.cwd();
196
+ const markdown = buildRepoStats(root);
197
+ fs.writeFileSync(path.join(root, STATS_REPORT), markdown, "utf-8");
198
+ console.log(markdown);
199
+ console.error(`[bkit-stats] wrote ${STATS_REPORT}`);
200
+ } catch (err: unknown) {
201
+ const msg = err instanceof Error ? err.message : String(err);
202
+ console.error(`[bkit-stats] stats error (fail-open): ${msg}`);
203
+ }
204
+ }
@@ -2,7 +2,7 @@
2
2
  // apply to this repo. Each workflow passes its name at its close and gets the one tip that
3
3
  // matters most there (`audit` / `utility` for the audit agent and the ledger / roadmap
4
4
  // updaters); bare `bkit tips` prints the top three. The star line closes bare and phase
5
- // output unless `bkit-star` is in `bkit.ignoreAdvisories`. Local checks only, no network; prints
5
+ // output unless `bkit-star` is in `bkit.advisories.ignore`. Local checks only, no network; prints
6
6
  // nothing when no tip fires and no star line shows; exits 0. What the last disk clean-up left
7
7
  // for the person to decide (`bkit disk prune` notes) comes first, outside the tip cap.
8
8
 
@@ -10,14 +10,19 @@ import type { TipsContext } from "../cli.js";
10
10
  import { collectTips, formatTips } from "../checks/tips/index.js";
11
11
  import { formatNotes, readNotes } from "./workflow/disk.js";
12
12
 
13
+ /** What `bkit tips` prints: disk-prune notes, then the tips; "" when nothing applies. */
14
+ export function tipsText(all: boolean, workflow: TipsContext | null, cwd: string): string {
15
+ const { tips, star } = collectTips(cwd);
16
+ return [formatNotes(readNotes(cwd)), formatTips(tips, { all, workflow, star })]
17
+ .filter((part) => part !== "")
18
+ .join("\n\n");
19
+ }
20
+
13
21
  export function runTipsCommand(
14
22
  all: boolean,
15
23
  workflow: TipsContext | null,
16
24
  cwd: string = process.cwd(),
17
25
  ): void {
18
- const { tips, star } = collectTips(cwd);
19
- const output = [formatNotes(readNotes(cwd)), formatTips(tips, { all, workflow, star })]
20
- .filter((part) => part !== "")
21
- .join("\n\n");
26
+ const output = tipsText(all, workflow, cwd);
22
27
  if (output) console.log(output);
23
28
  }