@cbartens/bkit 5.3.0 → 5.5.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 (186) hide show
  1. package/.bkit/README.md +20 -7
  2. package/.bkit/core/.agents/docs.md +1 -1
  3. package/.bkit/core/.agents/rules.md +14 -9
  4. package/.bkit/core/.bkit/README.md +19 -6
  5. package/.bkit/core/.bkit/cloud.md +77 -46
  6. package/.bkit/core/.bkit/comparison.md +3 -3
  7. package/.bkit/core/.bkit/install.md +21 -18
  8. package/.bkit/core/.bkit/lite.md +6 -6
  9. package/.bkit/core/.bkit/pipeline.md +6 -3
  10. package/.bkit/core/.bkit/prompts.md +14 -10
  11. package/.bkit/core/.bkit/providers.md +7 -7
  12. package/.bkit/core/.bkit/templates.md +46 -10
  13. package/.bkit/core/.bkit/trackers.md +92 -38
  14. package/.bkit/core/.bkit/workflows.md +140 -116
  15. package/.bkit/core/AGENTS.md +2 -2
  16. package/.bkit/core/docs/templates/bkit-audit-accessibility.md +3 -2
  17. package/.bkit/core/docs/templates/bkit-audit-adoption.md +1 -1
  18. package/.bkit/core/docs/templates/bkit-audit-agents.md +1 -1
  19. package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +1 -1
  20. package/.bkit/core/docs/templates/bkit-audit-analytics.md +1 -1
  21. package/.bkit/core/docs/templates/bkit-audit-annotations.md +1 -1
  22. package/.bkit/core/docs/templates/bkit-audit-app-performance.md +2 -2
  23. package/.bkit/core/docs/templates/bkit-audit-app-store.md +1 -1
  24. package/.bkit/core/docs/templates/bkit-audit-architecture.md +1 -1
  25. package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +4 -2
  26. package/.bkit/core/docs/templates/bkit-audit-config.md +3 -2
  27. package/.bkit/core/docs/templates/bkit-audit-cost.md +3 -2
  28. package/.bkit/core/docs/templates/bkit-audit-coverage.md +1 -1
  29. package/.bkit/core/docs/templates/bkit-audit-database.md +3 -2
  30. package/.bkit/core/docs/templates/bkit-audit-dead-code.md +5 -5
  31. package/.bkit/core/docs/templates/bkit-audit-deferrals.md +1 -1
  32. package/.bkit/core/docs/templates/bkit-audit-dependencies.md +14 -13
  33. package/.bkit/core/docs/templates/bkit-audit-documentation.md +1 -1
  34. package/.bkit/core/docs/templates/bkit-audit-duplication.md +2 -2
  35. package/.bkit/core/docs/templates/bkit-audit-failures.md +1 -1
  36. package/.bkit/core/docs/templates/bkit-audit-flakes.md +3 -2
  37. package/.bkit/core/docs/templates/bkit-audit-gates.md +5 -2
  38. package/.bkit/core/docs/templates/bkit-audit-issues.md +25 -8
  39. package/.bkit/core/docs/templates/bkit-audit-llm.md +3 -2
  40. package/.bkit/core/docs/templates/bkit-audit-logs.md +10 -6
  41. package/.bkit/core/docs/templates/bkit-audit-models.md +1 -1
  42. package/.bkit/core/docs/templates/bkit-audit-privacy.md +1 -1
  43. package/.bkit/core/docs/templates/bkit-audit-prompts.md +5 -5
  44. package/.bkit/core/docs/templates/bkit-audit-red-team.md +3 -2
  45. package/.bkit/core/docs/templates/bkit-audit-reliability.md +3 -2
  46. package/.bkit/core/docs/templates/bkit-audit-repo.md +1 -1
  47. package/.bkit/core/docs/templates/bkit-audit-security.md +11 -9
  48. package/.bkit/core/docs/templates/bkit-audit-slop.md +1 -1
  49. package/.bkit/core/docs/templates/bkit-audit-testing.md +6 -5
  50. package/.bkit/core/docs/templates/bkit-audit-usability.md +1 -1
  51. package/.bkit/core/engine/checks/after/auth.ts +88 -45
  52. package/.bkit/core/engine/checks/after/github.ts +18 -5
  53. package/.bkit/core/engine/checks/after/index.ts +1 -1
  54. package/.bkit/core/engine/checks/after/tools.ts +1 -1
  55. package/.bkit/core/engine/checks/before/env.ts +28 -18
  56. package/.bkit/core/engine/checks/before/mcp.ts +4 -2
  57. package/.bkit/core/engine/checks/status-holes.ts +0 -1
  58. package/.bkit/core/engine/checks/tips/catalogue.ts +31 -2
  59. package/.bkit/core/engine/checks/tips/index.ts +49 -27
  60. package/.bkit/core/engine/cli.ts +27 -18
  61. package/.bkit/core/engine/commands/ci/ci.ts +107 -0
  62. package/.bkit/core/engine/commands/comply.ts +25 -16
  63. package/.bkit/core/engine/commands/install/install.ts +11 -4
  64. package/.bkit/core/engine/commands/install/uninstall.ts +46 -0
  65. package/.bkit/core/engine/commands/land.ts +156 -0
  66. package/.bkit/core/engine/commands/lib.ts +10 -8
  67. package/.bkit/core/engine/commands/registry.ts +2 -0
  68. package/.bkit/core/engine/commands/tips.ts +7 -3
  69. package/.bkit/core/engine/commands/workflow/branches.ts +382 -282
  70. package/.bkit/core/engine/commands/workflow/disk.ts +556 -0
  71. package/.bkit/core/engine/commands/workflow/fids.ts +23 -15
  72. package/.bkit/core/engine/commands/workflow/issues.ts +106 -42
  73. package/.bkit/core/engine/commands/workflow/ledgers.ts +28 -11
  74. package/.bkit/core/engine/commands/workflow/locks.ts +38 -152
  75. package/.bkit/core/engine/commands/workflow/prs.ts +14 -3
  76. package/.bkit/core/engine/commands/workflow/repo.ts +6 -0
  77. package/.bkit/core/engine/commands/workflow/roadmap.ts +53 -54
  78. package/.bkit/core/engine/commands/workflow/runtime.ts +3 -2
  79. package/.bkit/core/engine/commands/workflow/status.ts +33 -11
  80. package/.bkit/core/engine/commands/workflow/steps.ts +26 -17
  81. package/.bkit/core/engine/commands/workflow/workflows.ts +442 -269
  82. package/.bkit/core/engine/commands/workflow/workstreams.ts +3 -2
  83. package/.bkit/core/engine/commands/workflow/worktrees.ts +11 -1
  84. package/.bkit/core/engine/install/manifest.ts +31 -10
  85. package/.bkit/core/engine/install/modules/cloud.ts +3 -1
  86. package/.bkit/core/engine/install/modules/core.ts +97 -4
  87. package/.bkit/core/engine/install/modules/opencode.ts +5 -0
  88. package/.bkit/core/engine/install/placeholders.ts +13 -17
  89. package/.bkit/core/engine/install/write.ts +37 -1
  90. package/.bkit/core/engine/render/trackers.ts +35 -23
  91. package/.bkit/core/engine/shared/egress.ts +6 -0
  92. package/.bkit/core/engine/shared/settings.ts +96 -1
  93. package/.bkit/core/engine/shared/timeouts.ts +8 -7
  94. package/.bkit/core/hooks/guardrails-tiers.js +1 -1
  95. package/.bkit/core/prompts/bkit-audit-generate.md +80 -7
  96. package/.bkit/core/prompts/bkit-build-challenge-remediate.md +1 -1
  97. package/.bkit/core/prompts/bkit-build-challenge-tests.md +1 -1
  98. package/.bkit/core/prompts/bkit-build-plan-execute.md +1 -1
  99. package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +1 -1
  100. package/.bkit/core/prompts/bkit-debug-failure-remediate.md +1 -1
  101. package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +1 -1
  102. package/.bkit/core/prompts/bkit-debug-failure-soak.md +1 -1
  103. package/.bkit/core/prompts/bkit-design-generate.md +2 -1
  104. package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +1 -1
  105. package/.bkit/core/prompts/bkit-utility-update-decisions.md +4 -2
  106. package/.bkit/core/prompts/bkit-utility-update-deferrals.md +4 -2
  107. package/.bkit/core/prompts/bkit-utility-update-documentation.md +12 -2
  108. package/.bkit/core/prompts/bkit-utility-update-failures.md +4 -2
  109. package/.bkit/core/prompts/bkit-utility-update-knowledge.md +4 -2
  110. package/.bkit/core/prompts/bkit-utility-update-roadmap.md +12 -5
  111. package/.bkit/core/prompts/bkit-utility-update-tracker.md +159 -0
  112. package/.bkit/core/workflows/bkit-auto.md +19 -6
  113. package/.bkit/core/workflows/bkit-build.md +64 -22
  114. package/.bkit/core/workflows/bkit-debug.md +72 -28
  115. package/.bkit/core/workflows/bkit-design.md +101 -37
  116. package/.bkit/core/workflows/bkit-plan.md +82 -31
  117. package/.bkit/core/workflows/bkit-ship.md +127 -108
  118. package/.bkit/shared/.bkit/.env.example +8 -0
  119. package/.bkit/shared/.claude/bkit-cloud.md +12 -12
  120. package/.bkit/shared/.claude/settings.json +4 -1
  121. package/.bkit/shared/.cursor/bkit-cloud.md +2 -2
  122. package/.bkit/shared/.cursor/mcp.json +11 -4
  123. package/.bkit/shared/.mcp.json +11 -4
  124. package/.bkit/shared/.opencode/opencode.json +2 -0
  125. package/.bkit/shared/docs/deployments.md +44 -29
  126. package/.bkit/shared/docs/security.md +1 -1
  127. package/.bkit/shared/docs/testing.md +3 -3
  128. package/.bkit/shared/gitignore +1 -2
  129. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-change.yml +2 -2
  130. package/.bkit/templates/.github/renovate.json5 +1 -1
  131. package/.bkit/templates/.github/workflows/bkit-ci.yml +29 -56
  132. package/.bkit/templates/.github/workflows/bkit-cloud.yml +40 -12
  133. package/.bkit/templates/.husky/pre-commit +10 -4
  134. package/.bkit/templates/.husky/pre-push +69 -12
  135. package/.bkit/templates/.lintstagedrc.json +5 -1
  136. package/.bkit/templates/scripts/ci/lanes/check-tree-cache.mjs +138 -0
  137. package/.bkit/templates/scripts/ci/lanes/check-tree-cache.test.mjs +181 -0
  138. package/.bkit/templates/scripts/cleanup/bkit-disk-prune.machine.mjs +197 -0
  139. package/.bkit/templates/scripts/cleanup/bkit-disk-prune.mjs +164 -0
  140. package/.bkit/templates/scripts/graphify/bkit-graphify.sh +1 -1
  141. package/CHANGELOG.md +85 -1
  142. package/README.md +102 -100
  143. package/dist/checks/after/auth.js +81 -45
  144. package/dist/checks/after/github.js +17 -5
  145. package/dist/checks/after/index.js +1 -1
  146. package/dist/checks/after/tools.js +1 -1
  147. package/dist/checks/before/env.js +24 -17
  148. package/dist/checks/before/mcp.js +4 -2
  149. package/dist/checks/status-holes.js +0 -1
  150. package/dist/checks/tips/catalogue.js +28 -2
  151. package/dist/checks/tips/index.js +44 -28
  152. package/dist/cli.js +27 -19
  153. package/dist/commands/ci/ci.js +100 -0
  154. package/dist/commands/comply.js +20 -13
  155. package/dist/commands/install/install.js +10 -4
  156. package/dist/commands/install/uninstall.js +42 -0
  157. package/dist/commands/land.js +129 -0
  158. package/dist/commands/lib.js +9 -6
  159. package/dist/commands/registry.js +2 -0
  160. package/dist/commands/tips.js +7 -3
  161. package/dist/commands/workflow/branches.js +300 -243
  162. package/dist/commands/workflow/disk.js +452 -0
  163. package/dist/commands/workflow/fids.js +22 -15
  164. package/dist/commands/workflow/issues.js +90 -41
  165. package/dist/commands/workflow/ledgers.js +26 -11
  166. package/dist/commands/workflow/locks.js +35 -130
  167. package/dist/commands/workflow/prs.js +8 -3
  168. package/dist/commands/workflow/repo.js +5 -0
  169. package/dist/commands/workflow/roadmap.js +52 -57
  170. package/dist/commands/workflow/runtime.js +3 -2
  171. package/dist/commands/workflow/status.js +32 -12
  172. package/dist/commands/workflow/steps.js +20 -13
  173. package/dist/commands/workflow/workflows.js +397 -251
  174. package/dist/commands/workflow/workstreams.js +3 -2
  175. package/dist/commands/workflow/worktrees.js +11 -1
  176. package/dist/install/manifest.js +30 -10
  177. package/dist/install/modules/cloud.js +3 -1
  178. package/dist/install/modules/core.js +95 -5
  179. package/dist/install/modules/opencode.js +6 -0
  180. package/dist/install/placeholders.js +13 -19
  181. package/dist/install/write.js +26 -2
  182. package/dist/render/trackers.js +34 -20
  183. package/dist/shared/egress.js +6 -0
  184. package/dist/shared/settings.js +44 -0
  185. package/dist/shared/timeouts.js +8 -7
  186. package/package.json +11 -2
@@ -669,6 +669,11 @@ export async function runUninstall(modules, ctx) {
669
669
  }
670
670
  }
671
671
  }
672
+ // Targeted uninstall: drop the `bkit.*` keys the removed module records, so its advisories
673
+ // stop firing. Core keeps every other key.
674
+ if (!moduleList.includes("core")) {
675
+ stripModuleBkitKeys(moduleList, ctx, result);
676
+ }
672
677
  // Clean up .agents/ bkit-prefix mirror files
673
678
  // (.claude/commands/bkit-*.md, .claude/agents/bkit-*.md, .opencode/agents/bkit-*.md, etc.)
674
679
  // A dry run lists the same paths in result.deleted and removes nothing.
@@ -858,6 +863,43 @@ export async function runUninstall(modules, ctx) {
858
863
  }
859
864
  return result;
860
865
  }
866
+ /** `package.json` `bkit.*` keys each module records on install. */
867
+ const MODULE_BKIT_KEYS = {
868
+ cloud: ["cloudAgents"],
869
+ opencode: ["opencodeProvider", "opencodeProviders"],
870
+ };
871
+ /**
872
+ * Remove the `bkit.*` keys recorded by the modules in `moduleList` from the consumer's
873
+ * package.json, keeping its indent. Lists each removed key in `result.stripped`; a dry run
874
+ * lists without writing.
875
+ */
876
+ function stripModuleBkitKeys(moduleList, ctx, result) {
877
+ const keys = moduleList.flatMap((m) => MODULE_BKIT_KEYS[m] ?? []);
878
+ if (keys.length === 0)
879
+ return;
880
+ const pkgPath = path.join(ctx.cwd, "package.json");
881
+ if (!fs.existsSync(pkgPath))
882
+ return;
883
+ const raw = fs.readFileSync(pkgPath, "utf-8");
884
+ const parsed = parseJson(raw);
885
+ const pkg = parsed.ok ? parsed.value : null;
886
+ if (pkg === null || !isJsonObject(pkg.bkit))
887
+ return;
888
+ const bkit = pkg.bkit;
889
+ const present = keys.filter((k) => k in bkit);
890
+ if (present.length === 0)
891
+ return;
892
+ for (const k of present) {
893
+ delete bkit[k];
894
+ result.stripped.push(`package.json#bkit.${k}`);
895
+ }
896
+ console.log(`${ctx.logPrefix}${ctx.dryRun ? " [dry-run]" : ""} package.json: removed bkit.${present.join(", bkit.")}`);
897
+ if (ctx.dryRun)
898
+ return;
899
+ const indentMatch = raw.match(/\n([ \t]+)"/);
900
+ const indent = indentMatch ? indentMatch[1] : " ";
901
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, indent) + "\n", "utf-8");
902
+ }
861
903
  // ---------------------------------------------------------------------------
862
904
  // runSurgicalOpencodeUninstall — remove exactly ONE provider block
863
905
  // ---------------------------------------------------------------------------
@@ -0,0 +1,129 @@
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]`).
8
+ import * as fs from "node:fs";
9
+ import * as path from "node:path";
10
+ import { CommandError, DEV, EXIT, git, runGit } from "./lib.js";
11
+ import { TIMEOUTS } from "../shared/timeouts.js";
12
+ const REMOTE = "origin";
13
+ const UPSTREAM = `${REMOTE}/${DEV}`;
14
+ /** dev moved before git sent anything: git compared the remote's dev and stopped. */
15
+ const MOVED_BEFORE = /\[rejected\][^\n]*\((?:fetch first|non-fast-forward)\)/;
16
+ /** dev moved while the push was in flight: the server's ref update lost the race. */
17
+ const MOVED_DURING = /\[remote rejected\][^\n]*\((?:incorrect old value provided|cannot lock ref[^\n]*)\)/;
18
+ /** The server turned the push away: branch protection, a ruleset, an HTTP 403. */
19
+ const REFUSED = /\[remote rejected\]|returned error: 403|\bGH0\d\d\b/;
20
+ /** A dev push rejected only because dev moved: rebuild on the new dev, push again. */
21
+ export const devMoved = (stderr) => MOVED_BEFORE.test(stderr) || MOVED_DURING.test(stderr);
22
+ /** A dev push the server refused for a reason other than dev moving. */
23
+ export const devRefused = (stderr) => !devMoved(stderr) && REFUSED.test(stderr);
24
+ /**
25
+ * Milliseconds to wait before retry `retry` (1-based) of a landing: `startS`
26
+ * doubling per retry, capped at `capS`, then jittered down by up to half so two
27
+ * landings that collided once do not retry in step.
28
+ */
29
+ export function landBackoffMs(retry, random = Math.random, startS = TIMEOUTS.LAND_BACKOFF_START_S, capS = TIMEOUTS.LAND_BACKOFF_CAP_S) {
30
+ const s = Math.min(startS * 2 ** (retry - 1), capS);
31
+ return Math.round(s * 1000 * (0.5 + random() / 2));
32
+ }
33
+ export const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
34
+ /** A FID names one folder: no separators, no `..`. */
35
+ const SAFE_FID = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
36
+ /** The throwaway checkout a landing is built in, beside the feature worktrees. */
37
+ export function landDir(root, fid) {
38
+ if (!SAFE_FID.test(fid) || fid.includes(".."))
39
+ throw new CommandError(EXIT.USAGE, `--fid "${fid}" is not a feature id`);
40
+ return path.join(root, ".worktrees", `_land-${fid}`);
41
+ }
42
+ /**
43
+ * Remove a throwaway checkout. A landing killed inside `worktree add` leaves it
44
+ * locked ("initializing"), which a single `--force` and `prune` both skip, so it
45
+ * is unlocked first; a folder git no longer lists is the landing's own scratch.
46
+ */
47
+ export function dropLandTree(root, dir) {
48
+ runGit(root, ["worktree", "unlock", dir]);
49
+ if (fs.existsSync(dir))
50
+ runGit(root, ["worktree", "remove", "--force", "--force", dir]);
51
+ runGit(root, ["worktree", "prune"]);
52
+ if (fs.existsSync(dir))
53
+ fs.rmSync(dir, { recursive: true, force: true });
54
+ }
55
+ /** `core.hooksPath` pointing nowhere, so no hook runs. */
56
+ const NO_HOOKS = process.platform === "win32" ? "NUL" : "/dev/null";
57
+ /**
58
+ * Run `fn` with git hooks off for every git child it starts: one more
59
+ * `GIT_CONFIG_*` entry (git >= 2.31) setting `core.hooksPath`, restored after.
60
+ */
61
+ export async function withoutHooks(fn) {
62
+ const saved = process.env.GIT_CONFIG_COUNT;
63
+ const n = Number(saved ?? 0) || 0;
64
+ const key = `GIT_CONFIG_KEY_${n}`;
65
+ const value = `GIT_CONFIG_VALUE_${n}`;
66
+ process.env.GIT_CONFIG_COUNT = String(n + 1);
67
+ process.env[key] = "core.hooksPath";
68
+ process.env[value] = NO_HOOKS;
69
+ try {
70
+ return await fn();
71
+ }
72
+ finally {
73
+ if (saved === undefined)
74
+ delete process.env.GIT_CONFIG_COUNT;
75
+ else
76
+ process.env.GIT_CONFIG_COUNT = saved;
77
+ delete process.env[key];
78
+ delete process.env[value];
79
+ }
80
+ }
81
+ /**
82
+ * Land one commit on dev: per attempt, fetch dev, add `dir` detached at
83
+ * origin/dev, let `build` make the commit there, push `HEAD:dev` — git hooks
84
+ * off. `build` throwing stops the landing with that throw. A server refusal runs
85
+ * `refused` on the built commit first, when given. `dir` is removed on every path.
86
+ */
87
+ export async function pushToDev(o) {
88
+ o.log("git hooks skipped in the throwaway dev checkout — it lands bookkeeping only");
89
+ for (let attempt = 1;; attempt++) {
90
+ let wait = 0;
91
+ dropLandTree(o.root, o.dir);
92
+ try {
93
+ const outcome = await withoutHooks(async () => {
94
+ const fetched = runGit(o.root, ["fetch", REMOTE, DEV]);
95
+ if (!fetched.ok)
96
+ return { kind: "fetch-failed", stderr: fetched.stderr };
97
+ const added = runGit(o.root, ["worktree", "add", "--detach", o.dir, UPSTREAM]);
98
+ if (!added.ok)
99
+ return { kind: "setup-failed", stderr: added.stderr };
100
+ o.build(o.dir, attempt);
101
+ const pushed = runGit(o.dir, ["push", REMOTE, `HEAD:${DEV}`]);
102
+ if (pushed.ok) {
103
+ return {
104
+ kind: "landed",
105
+ sha: git(o.dir, ["rev-parse", "HEAD"]) ?? "",
106
+ attempts: attempt,
107
+ };
108
+ }
109
+ if (devRefused(pushed.stderr)) {
110
+ await o.refused?.(o.dir, pushed.stderr);
111
+ return { kind: "refused", stderr: pushed.stderr };
112
+ }
113
+ if (!devMoved(pushed.stderr))
114
+ return { kind: "push-failed", stderr: pushed.stderr };
115
+ return null;
116
+ });
117
+ if (outcome !== null)
118
+ return outcome;
119
+ if (attempt >= TIMEOUTS.LAND_ATTEMPTS)
120
+ return { kind: "exhausted", attempts: attempt };
121
+ wait = landBackoffMs(attempt);
122
+ o.log(`dev moved before push ${attempt} of ${TIMEOUTS.LAND_ATTEMPTS} — rebuilding on the new dev in ${(wait / 1000).toFixed(1)}s`);
123
+ }
124
+ finally {
125
+ dropLandTree(o.root, o.dir);
126
+ }
127
+ await sleep(wait);
128
+ }
129
+ }
@@ -327,8 +327,12 @@ export function runGh(cwd, args, input) {
327
327
  status: res.status,
328
328
  };
329
329
  }
330
- /** gh cannot serve this call here: not installed, or exit 4 (not logged in). */
331
- export const ghUnavailable = (res) => res.missing || res.status === 4;
330
+ /**
331
+ * gh cannot serve this call here: not installed, exit 4 (not logged in), or an
332
+ * HTTP 403 — a token or proxy that may not use this API, where the GitHub MCP
333
+ * (its own credentials) can.
334
+ */
335
+ export const ghUnavailable = (res) => res.missing || res.status === 4 || (!res.ok && /\bHTTP 403\b/.test(res.stderr));
332
336
  /**
333
337
  * The main checkout's root, from any worktree. `--git-common-dir` points at the
334
338
  * shared `.git`, so a linked worktree resolves to the same root as the main one.
@@ -350,15 +354,14 @@ export const statusRelPath = (month, fid) => path.join("docs", "plans", month, "
350
354
  *
351
355
  * - design / plan / build / debug: the feature worktree's copy when it exists
352
356
  * (`.worktrees/{fid}`), else the main checkout's.
353
- * - ship: the main checkout when this runtime pushes to dev, else the current
354
- * worktree's top (the branch being shipped). An unresolved runtime takes the
355
- * least-capable answer: current worktree.
357
+ * - ship: the current worktree's top — the tree ship works in (the feature
358
+ * worktree, or the adopted checkout), so asked from inside it.
356
359
  */
357
360
  export function statusLocation(opts) {
358
361
  const root = repoRoot(opts.cwd);
359
362
  const rel = statusRelPath(opts.month, opts.fid);
360
363
  if (opts.workflow === "ship") {
361
- const bookRoot = opts.devPushes === true ? root : (git(opts.cwd, ["rev-parse", "--show-toplevel"]) ?? root);
364
+ const bookRoot = git(opts.cwd, ["rev-parse", "--show-toplevel"]) ?? root;
362
365
  return { bookRoot, path: path.join(bookRoot, rel) };
363
366
  }
364
367
  const worktree = path.join(root, ".worktrees", opts.fid);
@@ -9,6 +9,7 @@ import { setupCommand } from "./setup/setup.js";
9
9
  import { branchesCommand } from "./workflow/branches.js";
10
10
  import { contextCommand } from "./workflow/context.js";
11
11
  import { countersCommand } from "./workflow/counters.js";
12
+ import { diskCommand } from "./workflow/disk.js";
12
13
  import { fidsCommand } from "./workflow/fids.js";
13
14
  import { issuesCommand } from "./workflow/issues.js";
14
15
  import { ledgersCommand } from "./workflow/ledgers.js";
@@ -36,6 +37,7 @@ export const COMMANDS = [
36
37
  locksCommand,
37
38
  workflowsCommand,
38
39
  worktreesCommand,
40
+ diskCommand,
39
41
  branchesCommand,
40
42
  skillsCommand,
41
43
  prsCommand,
@@ -2,12 +2,16 @@
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 `star` is in `bkit.ignoreAdvisories`. Local checks only, no network; prints
6
- // nothing when no tip fires and no star line shows; exits 0.
5
+ // output unless `bkit-star` is in `bkit.ignoreAdvisories`. Local checks only, no network; prints
6
+ // nothing when no tip fires and no star line shows; exits 0. What the last disk clean-up left
7
+ // for the person to decide (`bkit disk prune` notes) comes first, outside the tip cap.
7
8
  import { collectTips, formatTips } from "../checks/tips/index.js";
9
+ import { formatNotes, readNotes } from "./workflow/disk.js";
8
10
  export function runTipsCommand(all, workflow, cwd = process.cwd()) {
9
11
  const { tips, star } = collectTips(cwd);
10
- const output = formatTips(tips, { all, workflow, star });
12
+ const output = [formatNotes(readNotes(cwd)), formatTips(tips, { all, workflow, star })]
13
+ .filter((part) => part !== "")
14
+ .join("\n\n");
11
15
  if (output)
12
16
  console.log(output);
13
17
  }