@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
@@ -3,7 +3,7 @@
3
3
 
4
4
  import * as fs from "node:fs";
5
5
  import * as path from "node:path";
6
- import { execSync } from "node:child_process";
6
+ import { spawnSync } from "node:child_process";
7
7
  import type { PreflightFinding } from "../before/index.js";
8
8
  import { readJsonFile } from "../../shared/json.js";
9
9
  import { readBkitConfig } from "../../shared/settings.js";
@@ -79,26 +79,32 @@ export function detectGhMcpToken(cwd: string): PreflightFinding | null {
79
79
  return null;
80
80
  }
81
81
 
82
+ /**
83
+ * Names of the consumer repo's GitHub Actions secrets or variables (repo level only).
84
+ * `null` if gh CLI unavailable, unauthenticated, or not a GitHub repo.
85
+ */
86
+ function listGhNames(kind: "secret" | "variable"): string[] | null {
87
+ const res = spawnSync("gh", [kind, "list", "--json", "name", "-q", ".[].name"], {
88
+ encoding: "utf-8",
89
+ stdio: ["ignore", "pipe", "ignore"],
90
+ timeout: 5000,
91
+ });
92
+ if (res.status !== 0 || typeof res.stdout !== "string") return null;
93
+ return res.stdout
94
+ .split("\n")
95
+ .map((s) => s.trim())
96
+ .filter(Boolean);
97
+ }
98
+
82
99
  /**
83
100
  * Detect whether a named secret is set on the consumer's GitHub repo.
84
101
  * Returns "present" | "missing" | "unknown".
85
102
  * "unknown" if gh CLI unavailable, unauthenticated, or not a GitHub repo.
86
103
  */
87
104
  export function detectGhSecret(secretName: string): TokenPresence {
88
- try {
89
- const out = execSync(`gh secret list --json name -q '.[].name'`, {
90
- encoding: "utf-8",
91
- stdio: ["ignore", "pipe", "ignore"],
92
- timeout: 5000,
93
- });
94
- const names = out
95
- .split("\n")
96
- .map((s) => s.trim())
97
- .filter(Boolean);
98
- return names.includes(secretName) ? "present" : "missing";
99
- } catch {
100
- return "unknown";
101
- }
105
+ const names = listGhNames("secret");
106
+ if (names === null) return "unknown";
107
+ return names.includes(secretName) ? "present" : "missing";
102
108
  }
103
109
 
104
110
  /**
@@ -116,18 +122,21 @@ export function buildCloudDashboardsAdvisory(cwd: string): PreflightFinding | nu
116
122
  const hasCursor = fs.existsSync(path.join(cwd, ".cursor"));
117
123
  if (!hasRouter && !hasClaude && !hasCursor) return null;
118
124
 
119
- // cloud=claude path (bkit-cloud.yml): GitHub-tracker only, ANTHROPIC_API_KEY only.
120
- // cloud=cursor path (.cursor/): BKIT_LINEAR_API_KEY for Cursor dashboard.
121
- // Distinguish by recorded variant; fall back to presence-based detection.
122
- const recordedVariant = readBkitConfig(cwd).cloudAgents;
123
- const isCursorCloud = recordedVariant === "cursor" || (!hasRouter && hasCursor);
125
+ // cloud=claude path (bkit-cloud.yml): GitHub-tracker only, ANTHROPIC_API_KEY or federation.
126
+ // cloud=cursor path (.cursor/): BKIT_LINEAR_API_KEY for Cursor dashboard; Linear-tracker only.
127
+ // Distinguish by recorded variant; fall back to presence-based detection under linear.
128
+ const config = readBkitConfig(cwd);
129
+ const isCursorCloud =
130
+ config.cloudAgents === "cursor" ||
131
+ (!hasRouter && hasCursor && config.issueTracker === "linear");
124
132
 
125
133
  const secretList = isCursorCloud ? "`BKIT_LINEAR_API_KEY`" : "`ANTHROPIC_API_KEY`";
126
134
  const ghSetLines = isCursorCloud
127
135
  ? " gh secret set BKIT_LINEAR_API_KEY --body='<value>'\n\n" +
128
136
  " Verify: `gh secret list | grep -E 'BKIT_LINEAR_API_KEY'`\n\n"
129
137
  : " gh secret set ANTHROPIC_API_KEY --body='<value>'\n\n" +
130
- " Verify: `gh secret list | grep -E 'ANTHROPIC_API_KEY'`\n\n";
138
+ " Verify: `gh secret list | grep -E 'ANTHROPIC_API_KEY'`\n\n" +
139
+ " Keyless alternative for bkit-cloud.yml (workload identity federation): leave the secret unset and set the `ANTHROPIC_FEDERATION_RULE_ID` + `ANTHROPIC_ORGANIZATION_ID` repo variables (`gh variable set`) from a Claude Console federation rule.\n\n";
131
140
  const vendorNote = isCursorCloud
132
141
  ? "BKIT_LINEAR_API_KEY is read from the Linear dashboard (https://linear.app/settings/api)."
133
142
  : "ANTHROPIC_API_KEY is read from the Anthropic dashboard (https://console.anthropic.com/settings/keys); `.bkit/.env` holds the same value as BKIT_ANTHROPIC_API_KEY. The Claude GitHub App (`/install-github-app`) is also required for `cloud=claude`.";
@@ -147,35 +156,69 @@ export function buildCloudDashboardsAdvisory(cwd: string): PreflightFinding | nu
147
156
  };
148
157
  }
149
158
 
159
+ /** Repo variables that, both set, switch bkit-cloud.yml's claude job to workload identity federation. */
160
+ const FEDERATION_VARIABLES = ["ANTHROPIC_FEDERATION_RULE_ID", "ANTHROPIC_ORGANIZATION_ID"];
161
+
150
162
  /**
151
- * Detect whether the GitHub Actions secrets `bkit-cloud.yml` needs are set.
152
- * Only fires when `.github/workflows/bkit-cloud.yml` exists. `ANTHROPIC_API_KEY` is
153
- * always required (claude-code-action) for the cloud=claude path. The workflow is
154
- * GitHub-tracker only — no `BKIT_LINEAR_API_KEY` dependency. Returns one finding per
155
- * missing secret.
163
+ * Detect whether `bkit-cloud.yml`'s claude job has a credential. Only fires when
164
+ * `.github/workflows/bkit-cloud.yml` exists. The claude job (claude-code-action) takes the
165
+ * `ANTHROPIC_API_KEY` repo secret OR workload identity federation (both
166
+ * `FEDERATION_VARIABLES` repo variables). The workflow is GitHub-tracker only — no
167
+ * `BKIT_LINEAR_API_KEY` dependency. Silent when gh cannot list secrets; when only the
168
+ * variables are unlistable, a missing key still raises the missing-credential finding.
156
169
  */
157
170
  export function detectCiRouterSecrets(cwd: string): PreflightFinding[] {
158
- const findings: PreflightFinding[] = [];
159
171
  const routerPath = path.join(cwd, ".github", "workflows", "bkit-cloud.yml");
160
- if (!fs.existsSync(routerPath)) return findings;
161
- // bkit-cloud.yml is cloud=claude / GitHub-tracker only — ANTHROPIC_API_KEY (GHA secret
162
- // name claude-code-action reads). Local `.bkit/.env` stores the same value as
163
- // BKIT_ANTHROPIC_API_KEY. No BKIT_LINEAR_API_KEY dependency.
164
- const required = ["ANTHROPIC_API_KEY"];
165
- for (const name of required) {
166
- const status = detectGhSecret(name);
167
- if (status === "missing") {
168
- findings.push({
169
- id: `${name.toLowerCase().replace(/_/g, "-")}-secret-missing`,
172
+ if (!fs.existsSync(routerPath)) return [];
173
+ const key = detectGhSecret("ANTHROPIC_API_KEY");
174
+ if (key === "unknown") return [];
175
+ const variables = listGhNames("variable");
176
+ const federated = variables !== null && FEDERATION_VARIABLES.every((v) => variables.includes(v));
177
+
178
+ if (key === "present" && federated) {
179
+ return [
180
+ {
181
+ id: "anthropic-api-key-shadows-federation",
170
182
  severity: "advisory",
171
- detect: `gh secret list confirms ${name} secret is NOT set on this GitHub repo.`,
183
+ detect:
184
+ "The `ANTHROPIC_API_KEY` repo secret and the `ANTHROPIC_FEDERATION_RULE_ID` + `ANTHROPIC_ORGANIZATION_ID` repo variables are all set. claude-code-action uses the key and skips workload identity federation.",
172
185
  action:
173
- `\`.github/workflows/bkit-cloud.yml\` requires ${name} to invoke its Claude Code action. Without it, the workflow exits no-op.\n\nSet the secret:\n\n` +
174
- ` gh secret set ${name} --body='<paste-value-here>'\n\n` +
175
- `Then verify: \`gh secret list | grep ${name}\`. The workflow itself does not need redeploying — secrets are read at run time.`,
176
- });
177
- }
178
- // "unknown" → silent skip (CLI absent / unauthenticated).
186
+ "To run keyless, delete the secret: `gh secret delete ANTHROPIC_API_KEY`. To stay on the key, delete the variables: `gh variable delete ANTHROPIC_FEDERATION_RULE_ID` and `gh variable delete ANTHROPIC_ORGANIZATION_ID`.",
187
+ },
188
+ ];
179
189
  }
180
- return findings;
190
+ if (key === "present") return [];
191
+
192
+ if (federated) {
193
+ if (fs.readFileSync(routerPath, "utf-8").includes("anthropic_federation_rule_id:")) return [];
194
+ return [
195
+ {
196
+ id: "anthropic-federation-template-stale",
197
+ severity: "advisory",
198
+ detect:
199
+ "The `ANTHROPIC_FEDERATION_RULE_ID` + `ANTHROPIC_ORGANIZATION_ID` repo variables are set, but `.github/workflows/bkit-cloud.yml` does not pass `anthropic_federation_rule_id` to claude-code-action — the claude job exits no-op.",
200
+ action:
201
+ "Re-copy the template: `cp .bkit/templates/.github/workflows/bkit-cloud.yml .github/workflows/bkit-cloud.yml`, then re-apply your own edits (the `runs-on` runner at minimum).",
202
+ },
203
+ ];
204
+ }
205
+
206
+ return [
207
+ {
208
+ id: "anthropic-api-key-secret-missing",
209
+ severity: "advisory",
210
+ detect:
211
+ variables === null
212
+ ? "gh confirms the `ANTHROPIC_API_KEY` repo secret is not set on this GitHub repo, and could not list repo variables to check for the `ANTHROPIC_FEDERATION_RULE_ID` + `ANTHROPIC_ORGANIZATION_ID` federation variables."
213
+ : "gh confirms neither the `ANTHROPIC_API_KEY` repo secret nor both `ANTHROPIC_FEDERATION_RULE_ID` + `ANTHROPIC_ORGANIZATION_ID` repo variables are set on this GitHub repo.",
214
+ action:
215
+ "`.github/workflows/bkit-cloud.yml`'s claude job needs one claude credential; without it, the job exits no-op. Set ONE of:\n\n" +
216
+ "- API key:\n\n gh secret set ANTHROPIC_API_KEY --body='<paste-value-here>'\n\n" +
217
+ "- Workload identity federation (keyless): Claude Console → Settings → Workload identity → Connect workload → GitHub Actions creates the issuer, service account and federation rule. Then:\n\n" +
218
+ " gh variable set ANTHROPIC_FEDERATION_RULE_ID --body='fdrl_...'\n" +
219
+ " gh variable set ANTHROPIC_ORGANIZATION_ID --body='<organization-uuid>'\n\n" +
220
+ " Optional: `ANTHROPIC_SERVICE_ACCOUNT_ID` (`svac_...`) and `ANTHROPIC_WORKSPACE_ID` (`wrkspc_...`, needed when the rule covers more than one workspace).\n\n" +
221
+ "Then verify: `gh secret list` / `gh variable list`. The workflow itself does not need redeploying — both are read at run time.",
222
+ },
223
+ ];
181
224
  }
@@ -70,7 +70,8 @@ export function detectActionsWritePermissions(): TokenPresence {
70
70
  *
71
71
  * - `github` → GitHub tracker: the GitHub MCP server authenticates with `BKIT_GH_TOKEN`; `gh` uses `gh auth login`.
72
72
  * - `linear` → existing Linear setup message (BKIT_LINEAR_API_KEY + LINEAR_ISSUE_ID).
73
- * - `none` → prompt to run `bkit install --tracker=github` or `--tracker=linear`.
73
+ * - `jira` → admin switch, BKIT_JIRA_API_TOKEN and `bkit.jira` in package.json.
74
+ * - `none` → prompt to run `bkit install --tracker=github`, `--tracker=linear` or `--tracker=jira`.
74
75
  *
75
76
  * Only fires when bkit workflows are installed (.claude/ or .cursor/ present).
76
77
  */
@@ -102,6 +103,16 @@ export function buildTrackerSetupAdvisory(cwd: string): PreflightFinding | null
102
103
  };
103
104
  }
104
105
 
106
+ if (tracker === "jira") {
107
+ return {
108
+ id: "tracker-setup-jira",
109
+ severity: "advisory",
110
+ detect: "bkit tracker is configured as `jira`. Jira Cloud is the active tracker.",
111
+ action:
112
+ 'Jira tracker: (1) an org admin turns on API-token sign-in for the Rovo MCP server (admin.atlassian.com → Rovo → Rovo MCP server → Authentication → "Allow API token authentication"); (2) create an API token with scopes for the app "Atlassian MCP V2" at https://id.atlassian.com/manage-profile/security/api-tokens and set it as `BKIT_JIRA_API_TOKEN` in `.bkit/.env`, then `direnv allow`; (3) set `bkit.jira.site` (e.g. `https://acme.atlassian.net`) and `bkit.jira.project` (the project key) in package.json. Full steps: `.bkit/trackers.md` § jira.',
113
+ };
114
+ }
115
+
105
116
  // tracker === "none". Distinguish opt-out (explicit `bkit.issueTracker: "none"`)
106
117
  // from undecided (field absent). An explicit `none` silences the nudge, as with the
107
118
  // dep-updater advisory.
@@ -113,7 +124,7 @@ export function buildTrackerSetupAdvisory(cwd: string): PreflightFinding | null
113
124
  detect:
114
125
  "bkit tracker is not configured (`bkit.issueTracker` absent). Workflows run but every tracker call is a no-op.",
115
126
  action:
116
- 'Optional post-install decision. Run `bkit install --tracker=github` (recommended) or `bkit install --tracker=linear` to enable tracker integration. GitHub tracker requires `BKIT_GH_TOKEN` in `.bkit/.env` (fine-grained PAT for one owner, classic PAT across owners). Linear tracker requires `BKIT_LINEAR_API_KEY` in `.bkit/.env`. To opt out and silence this advisory, set `bkit.issueTracker` to `"none"` in package.json.',
127
+ 'Optional post-install decision. Run `bkit install --tracker=github` (recommended), `--tracker=linear` or `--tracker=jira` to enable tracker integration. GitHub tracker requires `BKIT_GH_TOKEN` in `.bkit/.env` (fine-grained PAT for one owner, classic PAT across owners). Linear tracker requires `BKIT_LINEAR_API_KEY` in `.bkit/.env`. Jira tracker requires `BKIT_JIRA_API_TOKEN` in `.bkit/.env` and `bkit.jira` in package.json. To opt out and silence this advisory, set `bkit.issueTracker` to `"none"` in package.json.',
117
128
  };
118
129
  }
119
130
 
@@ -276,6 +287,7 @@ export function detectGithubProjectFieldIdFormat(cwd: string): PreflightFinding
276
287
  * opt-out):
277
288
  * - `.github/workflows/bkit-cloud.yml` present → `cloud-router` (informational; active)
278
289
  * - `bkit.cloudAgents === "none"` → null (opt-out — stay quiet)
290
+ * - `bkit.issueTracker === "jira"` → null (Jira runs locally only)
279
291
  * - otherwise (undecided) → `cloud-router-none` (nudge to choose)
280
292
  *
281
293
  * Only fires when there is a `.github/workflows/` dir (the router wakes on a CI
@@ -307,15 +319,16 @@ export function buildCloudSetupAdvisory(cwd: string): PreflightFinding | null {
307
319
  severity: "advisory",
308
320
  detect:
309
321
  "Cloud agents: post-CI auto-routing is active (`.github/workflows/bkit-cloud.yml` present). The Claude GitHub App is required — run `/install-github-app` (Claude Code CLI) once if not already done.",
310
- action: `The workflow requires: the \`ANTHROPIC_API_KEY\` repo secret, the Claude GitHub App (\`/install-github-app\`), and GitHub Actions write permissions (org AND repo). See the \`bkit-auto-setup\` advisory (emitted by \`bkit install --auto=claude\`) and bkit's \`cloud.md\` § Post-CI auto-routing for the full checklist.\n\nbkit's agents comment as you, so every workflow those comments trigger notifies you, even ones that skip. To see only failures: GitHub → Settings → Notifications → System → Actions → "Only notify for failed workflows".`,
322
+ action: `The workflow requires: the \`ANTHROPIC_API_KEY\` repo secret OR the \`ANTHROPIC_FEDERATION_RULE_ID\` + \`ANTHROPIC_ORGANIZATION_ID\` repo variables (keyless workload identity federation), the Claude GitHub App (\`/install-github-app\`), and GitHub Actions write permissions (org AND repo). See the \`bkit-auto-setup\` advisory (emitted by \`bkit install --auto=claude\`) and bkit's \`cloud.md\` § Post-CI auto-routing for the full checklist.\n\nbkit's agents comment as you, so every workflow those comments trigger notifies you, even ones that skip. To see only failures: GitHub → Settings → Notifications → System → Actions → "Only notify for failed workflows".`,
311
323
  };
312
324
  }
313
325
 
314
326
  // No router present — distinguish opt-out from undecided.
315
- const { cloudAgents, cloudAgentsExplicit } = readBkitConfig(cwd);
327
+ const { cloudAgents, cloudAgentsExplicit, issueTracker } = readBkitConfig(cwd);
316
328
  if (cloudAgents === "none" && cloudAgentsExplicit) {
317
329
  return null; // consumer explicitly chose `none` — stay quiet
318
330
  }
331
+ if (issueTracker === "jira") return null; // no cloud setup exists for a Jira tracker
319
332
 
320
333
  // Only nudge if there's a workflows dir for the router to wake on.
321
334
  if (!fs.existsSync(path.join(cwd, ".github", "workflows"))) return null;
@@ -327,7 +340,7 @@ export function buildCloudSetupAdvisory(cwd: string): PreflightFinding | null {
327
340
  "Cloud agents: post-CI auto-routing is not configured. `.github/workflows/` exists but no `bkit-cloud.yml` — CI pass/fail does not auto-dispatch bkit-ship / bkit-debug.",
328
341
  action:
329
342
  "Optional post-install decision. For a GitHub-tracker repo: `pnpm bkit install --auto=claude --tracker=github`. For a Linear-tracker repo: `pnpm bkit install --auto=cursor --tracker=linear`.\n\n" +
330
- "Prerequisites for `--auto=claude`: `ANTHROPIC_API_KEY` repo secret + Claude GitHub App (`/install-github-app`) + GitHub Actions write permissions.\n\n" +
343
+ "Prerequisites for `--auto=claude`: `ANTHROPIC_API_KEY` repo secret (or the `ANTHROPIC_FEDERATION_RULE_ID` + `ANTHROPIC_ORGANIZATION_ID` repo variables for keyless workload identity federation) + Claude GitHub App (`/install-github-app`) + GitHub Actions write permissions.\n\n" +
331
344
  'To opt out and silence this advisory, set `bkit.cloudAgents` to `"none"` in package.json.',
332
345
  };
333
346
  }
@@ -404,7 +404,7 @@ export function runPostInstallCheck(
404
404
  const cloudSetup = buildCloudSetupAdvisory(cwd);
405
405
  if (cloudSetup) phase3.push(cloudSetup);
406
406
 
407
- // bkit-cloud.yml needs the ANTHROPIC_API_KEY repo secret.
407
+ // bkit-cloud.yml's claude job needs the ANTHROPIC_API_KEY repo secret or federation variables.
408
408
  for (const f of detectCiRouterSecrets(cwd)) phase3.push(f);
409
409
 
410
410
  // bkit-cloud.yml also needs repo Actions write permissions + PR-creation
@@ -148,7 +148,7 @@ const BKIT_STUBS: BkitStub[] = [
148
148
  id: "coverage",
149
149
  file: ".github/workflows/bkit-ci.yml",
150
150
  description:
151
- "Report vitest coverage on PRs and in every run's job summary via davelosert/vitest-coverage-report-action (free, runs inside Actions with GITHUB_TOKEN — no third-party service, safe for private repos). PER-TIER: unit and integration are measured and commented SEPARATELY (a single merged number lets integration mask a hollow unit suite — coverage is a union). Report-only by default: nothing fails the build until a threshold is set. Enabling (documented in the stub header): (1) add `@vitest/coverage-v8` (pinned to your vitest major) plus a vitest.config coverage block with `reporter: ['text','json-summary','json']` and `reportOnFailure: true` — json-summary + json are load-bearing (the action reads coverage-summary.json and coverage-final.json); (2) run coverage TWICE into separate dirs — unit → coverage/unit (exclude integration files), integration → coverage/integration — so each tier gets its own honest number (avoids the last-writer-wins clobber a second same-dir run would cause); (3) add a JOB-LEVEL permissions block to bkit-tests-unit with `actions: read` + `contents: read` + `pull-requests: write` — job-level REPLACES the workflow-level block (not additive) and the Check SHA Cache step needs `actions: read`, so omitting it breaks the cache step; (4) two report steps with distinct `name:` (unit / integration) pointing at each dir's coverage-summary.json + coverage-final.json; the unit step runs on every event (`if: !cancelled()` plus a `hashFiles` guard on its summary), sets `vite-config-path: vitest.unit.config.ts` so the job summary and PR comment show the floor as the target, and comments only on same-repo PRs (`comment-on: pr`, else `none`). SEPARATE LANES (one job per tier): put the integration run + report + its OWN pull-requests: write block in bkit-tests-integration, not bkit-tests-unit — each lane posts its own comment. Thresholds are opt-in and PER TIER: UNIT is the gate — put `coverage.thresholds.branches` in a `vitest.unit.config.ts` (`mergeConfig` over vitest.config) that ONLY the unit run loads via `-c` (vitest coverage is per-RUN/root config, NOT per-project — `projects` does not scope it and a `thresholds` block in vitest.config reds BOTH runs; the report action reads the same file as raw text, so keep the floor on one unquoted `branches: <n>` line and no other metric name + colon + number in it; branches is the meaningful floor, set to current and ratchet up). INTEGRATION is REPORT-ONLY — gate it on EXECUTION (the capstone's integration_ran > 0), not a %: a whole-repo integration % is denominator-noise (it covers boundaries/flows, not pure logic). For a real integration %, add `--coverage.include=src/server/**` on the integration run (same CLI-flag idiom as --exclude) then set a floor, or ratchet from current — never a picked number. Fork PRs: GITHUB_TOKEN is read-only, so the unit step sets `comment-on: none` there (its job summary still lands) and the integration step keeps the `head.repo == repo` guard (or use the action's workflow_run two-workflow pattern). Guard the integration report on `hashFiles('coverage/integration/coverage-summary.json') != ''` so a repo with no integration tier skips it cleanly.",
151
+ "Report vitest coverage on PRs and in every run's job summary via davelosert/vitest-coverage-report-action (free, runs inside Actions with GITHUB_TOKEN — no third-party service, safe for private repos). PER-TIER: unit and integration are measured and commented SEPARATELY (a single merged number lets integration mask a hollow unit suite — coverage is a union). Report-only by default: nothing fails the build until a threshold is set. Enabling (documented in the stub header): (1) add `@vitest/coverage-v8` (pinned to your vitest major) plus a vitest.config coverage block with `reporter: ['text','json-summary','json']` and `reportOnFailure: true` — json-summary + json are load-bearing (the action reads coverage-summary.json and coverage-final.json); (2) run coverage TWICE into separate dirs — unit → coverage/unit (exclude integration files), integration → coverage/integration — so each tier gets its own honest number (avoids the last-writer-wins clobber a second same-dir run would cause); (3) add a JOB-LEVEL permissions block to bkit-tests-unit with `actions: read` + `contents: read` + `pull-requests: write` — job-level REPLACES the workflow-level block (not additive) and the Check Tree Cache step needs `actions: read`, so omitting it breaks the cache step; (4) two report steps with distinct `name:` (unit / integration) pointing at each dir's coverage-summary.json + coverage-final.json; the unit step runs on every event (`if: !cancelled()` plus a `hashFiles` guard on its summary), sets `vite-config-path: vitest.unit.config.ts` so the job summary and PR comment show the floor as the target, and comments only on same-repo PRs (`comment-on: pr`, else `none`). SEPARATE LANES (one job per tier): put the integration run + report + its OWN pull-requests: write block in bkit-tests-integration, not bkit-tests-unit — each lane posts its own comment. Thresholds are opt-in and PER TIER: UNIT is the gate — put `coverage.thresholds.branches` in a `vitest.unit.config.ts` (`mergeConfig` over vitest.config) that ONLY the unit run loads via `-c` (vitest coverage is per-RUN/root config, NOT per-project — `projects` does not scope it and a `thresholds` block in vitest.config reds BOTH runs; the report action reads the same file as raw text, so keep the floor on one unquoted `branches: <n>` line and no other metric name + colon + number in it; branches is the meaningful floor, set to current and ratchet up). INTEGRATION is REPORT-ONLY — gate it on EXECUTION (the capstone's integration_ran > 0), not a %: a whole-repo integration % is denominator-noise (it covers boundaries/flows, not pure logic). For a real integration %, add `--coverage.include=src/server/**` on the integration run (same CLI-flag idiom as --exclude) then set a floor, or ratchet from current — never a picked number. Fork PRs: GITHUB_TOKEN is read-only, so the unit step sets `comment-on: none` there (its job summary still lands) and the integration step keeps the `head.repo == repo` guard (or use the action's workflow_run two-workflow pattern). Guard the integration report on `hashFiles('coverage/integration/coverage-summary.json') != ''` so a repo with no integration tier skips it cleanly.",
152
152
  },
153
153
  {
154
154
  id: "e2e-coverage",
@@ -11,14 +11,33 @@ import type { PreflightFinding } from "./index.js";
11
11
  // [mcp-env] advisories — direnv + .bkit/.env setup (BAR-260)
12
12
  // ---------------------------------------------------------------------------
13
13
 
14
+ /** The token a tracker's MCP server reads from `.bkit/.env`, beside `BKIT_GH_TOKEN`. */
15
+ const TRACKER_TOKENS: Partial<Record<IssueTracker, { key: string; description: string }>> = {
16
+ linear: {
17
+ key: "BKIT_LINEAR_API_KEY",
18
+ description:
19
+ "Linear personal API key for the Linear MCP server and the Linear preflight hook (generate at https://linear.app/settings/api)",
20
+ },
21
+ jira: {
22
+ key: "BKIT_JIRA_API_TOKEN",
23
+ description:
24
+ 'Atlassian API token with scopes for the app "Atlassian MCP V2", sent as Bearer to the Jira MCP server (create at https://id.atlassian.com/manage-profile/security/api-tokens; see .bkit/trackers.md § jira)',
25
+ },
26
+ };
27
+
28
+ /** The token names `tracker` needs, `BKIT_GH_TOKEN` first. */
29
+ function tokenKeys(tracker: IssueTracker): string[] {
30
+ const own = TRACKER_TOKENS[tracker];
31
+ return own ? ["BKIT_GH_TOKEN", own.key] : ["BKIT_GH_TOKEN"];
32
+ }
33
+
14
34
  /**
15
35
  * Advisory: .bkit/.env.example exists but .bkit/.env does not.
16
36
  * Consumer ran `bkit install` (which seeds .env.example) but has not yet
17
37
  * copied it to .bkit/.env and filled in their tokens.
18
38
  */
19
- // `tracker` controls whether `BKIT_LINEAR_API_KEY` appears in the token prose (Linear
20
- // tracker only). Defaults to `linear` (the superset: every token); the real Phase-3
21
- // caller passes the consumer's resolved `bkit.issueTracker`.
39
+ // `tracker` adds its own token to the token prose (`TRACKER_TOKENS`). Defaults to
40
+ // `linear`; the real Phase-3 caller passes the consumer's resolved `bkit.issueTracker`.
22
41
  export function detectMissingDotenv(
23
42
  cwd: string,
24
43
  tracker: IssueTracker = "linear",
@@ -27,7 +46,7 @@ export function detectMissingDotenv(
27
46
  const envPath = path.join(cwd, ".bkit", ".env");
28
47
  if (!fs.existsSync(examplePath)) return null;
29
48
  if (fs.existsSync(envPath)) return null;
30
- const tokens = tracker === "linear" ? "BKIT_GH_TOKEN, BKIT_LINEAR_API_KEY" : "BKIT_GH_TOKEN";
49
+ const tokens = tokenKeys(tracker).join(", ");
31
50
  return {
32
51
  id: "mcp-env-missing-dotenv",
33
52
  severity: "advisory",
@@ -68,16 +87,8 @@ export function detectBlankDotenvKeys(
68
87
  description:
69
88
  "fine-grained PAT for the GitHub MCP server (Contents, Pull requests, Issues, Actions, Workflows, Metadata — read/write), or a classic PAT when one token must span owners",
70
89
  },
71
- // BKIT_LINEAR_API_KEY is required only under the Linear tracker.
72
- ...(tracker === "linear"
73
- ? [
74
- {
75
- key: "BKIT_LINEAR_API_KEY",
76
- description:
77
- "Linear personal API key for the Linear MCP server and the Linear preflight hook (generate at https://linear.app/settings/api)",
78
- },
79
- ]
80
- : []),
90
+ // A tracker token is required only under its tracker.
91
+ ...(TRACKER_TOKENS[tracker] ? [TRACKER_TOKENS[tracker]] : []),
81
92
  ];
82
93
 
83
94
  const findings: PreflightFinding[] = [];
@@ -121,9 +132,8 @@ export function detectDirenvMissing(
121
132
 
122
133
  const result = spawnSync("which", ["direnv"], { encoding: "utf-8" });
123
134
  if (result.status === 0 && result.stdout.trim()) return null;
124
- // BKIT_LINEAR_API_KEY is required only under the Linear tracker.
125
- const editKeys = tracker === "linear" ? "BKIT_GH_TOKEN, BKIT_LINEAR_API_KEY" : "BKIT_GH_TOKEN";
126
- const exportKeys = tracker === "linear" ? "BKIT_GH_TOKEN / BKIT_LINEAR_API_KEY" : "BKIT_GH_TOKEN";
135
+ const editKeys = tokenKeys(tracker).join(", ");
136
+ const exportKeys = tokenKeys(tracker).join(" / ");
127
137
  return {
128
138
  id: "mcp-env-direnv-missing",
129
139
  severity: "advisory",
@@ -180,7 +190,7 @@ export function detectDirenvNotAllowed(
180
190
  severity: "advisory",
181
191
  detect:
182
192
  "direnv is installed but the .envrc in this repo is blocked. .bkit/.env is not being auto-loaded.",
183
- action: `[mcp-env] Run \`direnv allow\` in this repo to trust the .envrc and enable auto-load of .bkit/.env. direnv will then export ${tracker === "linear" ? "BKIT_GH_TOKEN and BKIT_LINEAR_API_KEY" : "BKIT_GH_TOKEN"} into your shell whenever you cd into the repo.`,
193
+ action: `[mcp-env] Run \`direnv allow\` in this repo to trust the .envrc and enable auto-load of .bkit/.env. direnv will then export ${tokenKeys(tracker).join(" and ")} into your shell whenever you cd into the repo.`,
184
194
  };
185
195
  }
186
196
  return null;
@@ -7,7 +7,7 @@ import type { IssueTracker } from "../../install/manifest.js";
7
7
  import type { PreflightFinding } from "./index.js";
8
8
 
9
9
  /** Every MCP server key bkit writes; `requiredMcpServersForTracker` picks the required subset. */
10
- const BKIT_MCP_SERVERS: readonly string[] = ["linear", "github"];
10
+ const BKIT_MCP_SERVERS: readonly string[] = ["linear", "github", "jira"];
11
11
 
12
12
  /**
13
13
  * bkit-written servers a workflow step calls under every tracker, so never flagged as extra:
@@ -78,7 +78,9 @@ export function detectMissingMcpServers(
78
78
  ? `"url": "https://mcp.linear.app/mcp"`
79
79
  : key === "github"
80
80
  ? `"url": "https://api.githubcopilot.com/mcp/"`
81
- : `"url": "<server-url>"`;
81
+ : key === "jira"
82
+ ? `"url": "https://mcp.atlassian.com/v2/mcp"`
83
+ : `"url": "<server-url>"`;
82
84
  findings.push({
83
85
  id: `mcp-missing-server-${key}-${advisoryPathSlug(relPath)}`,
84
86
  severity: "advisory",
@@ -51,7 +51,6 @@ export const SHIP_STEP_ORDER = [
51
51
  "ship-failure-diagnose",
52
52
  "ship-failure-remediate",
53
53
  "ship-switch-to-dev",
54
- "ship-worktree-cleanup",
55
54
  "ship-close-workflow",
56
55
  ] as const;
57
56
 
@@ -21,6 +21,10 @@
21
21
  // names its ids, so the tip and the advisory can never disagree and one
22
22
  // `bkit.ignoreAdvisories` entry silences both.
23
23
 
24
+ import * as fs from "node:fs";
25
+ import * as path from "node:path";
26
+
27
+ import { machineStepsPath, REPO_STEPS } from "../../commands/workflow/disk.js";
24
28
  import { detectContextFetchMissing } from "../before/context-fetch.js";
25
29
  import {
26
30
  detectBlankDotenvKeys,
@@ -84,7 +88,7 @@ export const SETUP_TIPS: readonly SetupTip[] = [
84
88
  id: "tracker",
85
89
  workflows: EVERY_CONTEXT,
86
90
  title: "Connect an issue tracker",
87
- line: "bkit isn't connected to an issue tracker, so it can't read the task it's working on or record what it did. Connect GitHub or Linear, or switch this tip off if you don't want one.",
91
+ line: "bkit isn't connected to an issue tracker, so it can't read the task it's working on or record what it did. Connect GitHub, Linear or Jira, or switch this tip off if you don't want one.",
88
92
  why: "Every workflow starts by reading the issue it's working on and reports progress back to it as it goes. Without a tracker, you have to paste in what the agent should look at each time, and nothing records what changed or why.",
89
93
  ask: 'Connect bkit to GitHub Issues: re-run `bkit install` with the tool flags I use plus `--tracker=github` (it records `bkit.issueTracker` in package.json and adds the tracker server to .mcp.json). If I don\'t want a tracker, set `"issueTracker": "none"` under `bkit` in package.json instead.',
90
94
  steps:
@@ -232,7 +236,7 @@ export const SETUP_TIPS: readonly SetupTip[] = [
232
236
  title: "Finish cloud setup",
233
237
  line: "You've turned on cloud agents, but setup isn't finished, so cloud runs will stop partway. Finish the remaining steps.",
234
238
  why: "With cloud agents, bkit runs on its own: a change that passes its checks gets shipped and one that fails gets investigated, with nobody at the keyboard. That only works once every piece is in place.",
235
- ask: "Check my cloud-agent setup against .bkit/cloud.md: copy .bkit/templates/.github/workflows/bkit-cloud.yml to .github/workflows/bkit-cloud.yml and .bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh to .claude/hooks/ (for Cursor: .bkit/templates/.cursor/environment.json and .bkit/templates/.cursor/Dockerfile to .cursor/), run `gh secret set ANTHROPIC_API_KEY`, then tell me which dashboard settings are left.",
239
+ ask: "Check my cloud-agent setup against .bkit/cloud.md: copy .bkit/templates/.github/workflows/bkit-cloud.yml to .github/workflows/bkit-cloud.yml and .bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh to .claude/hooks/ (for Cursor: .bkit/templates/.cursor/environment.json and .bkit/templates/.cursor/Dockerfile to .cursor/), run `gh secret set ANTHROPIC_API_KEY` (or, keyless, `gh variable set` ANTHROPIC_FEDERATION_RULE_ID and ANTHROPIC_ORGANIZATION_ID from a Claude Console federation rule), then tell me which dashboard settings are left.",
236
240
  steps: "`.bkit/cloud.md`; `.bkit/templates.md` § Cloud-agent workflow and § Cursor.",
237
241
  fires: (cwd) => {
238
242
  const cloud = readBkitConfig(cwd).cloudAgents;
@@ -375,6 +379,31 @@ export const SETUP_TIPS: readonly SetupTip[] = [
375
379
  fires: (cwd) =>
376
380
  exists(cwd, ".husky/pre-push") && !exists(cwd, "scripts/cleanup/bkit-tmp-prune.mjs"),
377
381
  },
382
+ {
383
+ id: "min-push",
384
+ workflows: ["plan", "ship"],
385
+ title: "Quick pushes for logs and records",
386
+ line: "Pushing only plan logs and records still runs every test. Add the quick path for those pushes.",
387
+ why: "A workflow's last push is often just its logs and records. The quick path checks only formatting and wording on such a push, so it takes seconds and never waits on anything another session is using. Any other file still runs everything.",
388
+ ask: 'Copy the min-push parts of .bkit/templates/.husky/pre-push into .husky/pre-push: PUSH_SHAS / PUSH_SHARED_SHAS in the stdin loop, the `Min push` and `CI-suppressor guard on dev / main` blocks, and the `bkit:gate:min` branch. Wrap slow checks below the gates in `if [ "$MIN_PUSH" != "1" ]`.',
389
+ steps: "`.bkit/templates.md` § Git hooks.",
390
+ fires: (cwd) =>
391
+ exists(cwd, ".husky/pre-push") &&
392
+ !fs.readFileSync(path.join(cwd, ".husky/pre-push"), "utf-8").includes("bkit ci min-push"),
393
+ },
394
+ {
395
+ id: "disk-prune",
396
+ workflows: ALL_WORKFLOWS,
397
+ title: "Keep enough disk free for new worktrees",
398
+ line: "Build caches, Docker images and simulators fill the disk until a workflow cannot make its worktree. Add your own clean-up steps, run after commits and pushes.",
399
+ why: "bkit deletes nothing on its own: you choose the steps, starting from examples that only delete what comes back by itself. Commits run the cheap steps, pushes run the rest, and a workflow runs them before making a worktree on a nearly full disk.",
400
+ ask: "Copy .bkit/templates/scripts/cleanup/bkit-disk-prune.mjs to scripts/cleanup/ and/or .bkit/templates/scripts/cleanup/bkit-disk-prune.machine.mjs to ~/.config/bkit/disk-prune.mjs, edit the steps, then paste the `disk prune` block from the end of each .bkit/templates/.husky hook at the end of yours.",
401
+ steps: "`.bkit/templates.md` § Disk prune.",
402
+ fires: (cwd) =>
403
+ exists(cwd, ".husky/pre-push") &&
404
+ !exists(cwd, REPO_STEPS) &&
405
+ !fs.existsSync(machineStepsPath()),
406
+ },
378
407
 
379
408
  // --- setup: only some setups -----------------------------------------------------------
380
409
  {
@@ -27,8 +27,19 @@ export const tipsIntro = (n: number) =>
27
27
  export const TIPS_DETAILS_POINTER =
28
28
  "Details for every tip: .bkit/advisories.md § Setup tips (refreshed by `bkit check`).";
29
29
 
30
+ /** Last line of a workflow's `## bkit Tips`: how to silence what it shows, by id. */
31
+ export function silenceLine(ids: readonly string[]): string {
32
+ const names = ids.map((id) => `\`${id}\``);
33
+ const list = names.length > 1 ? `${names.slice(0, -1).join(", ")} and ${names.at(-1)}` : names[0];
34
+ const what = ids.length > 1 ? "these tips" : "this tip";
35
+ return `Want to silence ${what}? Ask your agent to "add ${list} to \`bkit.ignoreAdvisories\` in package.json".`;
36
+ }
37
+
30
38
  /** `bkit.ignoreAdvisories` key that silences `STAR_TIP`. */
31
- export const STAR_TIP_ID = "star";
39
+ export const STAR_TIP_ID = "bkit-star";
40
+
41
+ /** Older key that also silences `STAR_TIP`, so repos that set it keep the line off. */
42
+ export const STAR_TIP_OLD_ID = "star";
32
43
 
33
44
  /**
34
45
  * Last line of `bkit tips` output while not silenced, in bare `bkit tips` and the phase
@@ -59,7 +70,7 @@ export interface TipsResult {
59
70
  tips: SetupTip[];
60
71
  /** Firing tips the root `bkit.ignoreAdvisories` silenced. */
61
72
  suppressed: SuppressionNote[];
62
- /** False when the root `bkit.ignoreAdvisories` names `STAR_TIP_ID`. */
73
+ /** False when the root `bkit.ignoreAdvisories` names `STAR_TIP_ID` or `STAR_TIP_OLD_ID`. */
63
74
  star: boolean;
64
75
  }
65
76
 
@@ -73,7 +84,8 @@ export function collectTips(cwd: string, catalogue: readonly SetupTip[] = SETUP_
73
84
  if (isTipSilenced(tip, ignored)) suppressed.push({ id: tip.id, scope: "." });
74
85
  else tips.push(tip);
75
86
  }
76
- return { tips, suppressed, star: !ignored.has(STAR_TIP_ID) };
87
+ const star = !ignored.has(STAR_TIP_ID) && !ignored.has(STAR_TIP_OLD_ID);
88
+ return { tips, suppressed, star };
77
89
  }
78
90
 
79
91
  /**
@@ -106,11 +118,10 @@ function tipTextLines(tip: SetupTip, n: number): string[] {
106
118
  return lines;
107
119
  }
108
120
 
109
- /** One tip as markdown paragraphs for a workflow's `## bkit Tips` section. */
110
- function tipMarkdownLines(tip: SetupTip): string[] {
111
- const lines = [`**${tip.title}.** ${tip.line}`, "", `Ask your agent: "${tip.ask}"`];
112
- if (tip.caution) lines.push("", `Caution: ${tip.caution}`);
113
- return lines;
121
+ /** One tip as one markdown paragraph for a workflow's `## bkit Tips` section. */
122
+ function tipParagraph(tip: SetupTip): string {
123
+ const caution = tip.caution ? ` Caution: ${tip.caution}` : "";
124
+ return `**${tip.title}.** ${tip.line} Ask your agent: "${tip.ask}"${caution}`;
114
125
  }
115
126
 
116
127
  /**
@@ -128,45 +139,56 @@ export function starShownIn(workflow: TipsContext | null | undefined): boolean {
128
139
  }
129
140
 
130
141
  /**
131
- * `bkit tips` output, then where the rest live, then `STAR_TIP` when `star` is set and
132
- * `starShownIn(workflow)`. `""` when no tip fires and no star line shows.
133
- * - `workflow`: the `WORKFLOW_TIPS_CAP` tips that matter most in that workflow, as
134
- * markdown paragraphs with no intro or numbers — the workflow appends them under its
135
- * own `## bkit Tips` heading.
136
- * - neither: the top `TIPS_CAP` tips as a numbered terminal list.
142
+ * `bkit tips` output. `""` when no tip fires and no star line shows.
143
+ * - `workflow`: the `WORKFLOW_TIPS_CAP` tips that matter most in that workflow as
144
+ * one markdown paragraph each, then `STAR_TIP` when shown, then `silenceLine` naming both — the
145
+ * workflow appends them under its own `## bkit Tips` heading.
146
+ * - neither: the top `TIPS_CAP` tips as a numbered terminal list, where the rest live,
147
+ * then `STAR_TIP` when shown.
137
148
  * - `all`: every tip as a numbered list (in the workflow's order when `workflow` is set).
149
+ * `STAR_TIP` shows when `opts.star` is set and `starShownIn(workflow)`.
138
150
  */
139
151
  export function formatTips(
140
152
  tips: readonly SetupTip[],
141
153
  opts: { all?: boolean; workflow?: TipsContext | null; star?: boolean } = {},
142
154
  ): string {
155
+ const star = !!opts.star && starShownIn(opts.workflow);
156
+ if (opts.workflow && !opts.all) return formatWorkflowTips(tips, opts.workflow, star);
143
157
  const body = formatSetupTips(tips, opts);
144
- if (!opts.star || !starShownIn(opts.workflow)) return body;
158
+ if (!star) return body;
145
159
  return body ? `${body}\n\n${STAR_TIP}` : STAR_TIP;
146
160
  }
147
161
 
148
- /** `formatTips` without `STAR_TIP`. */
162
+ /** `formatTips` for a workflow's `## bkit Tips`: tips, star line, how to silence both. */
163
+ function formatWorkflowTips(
164
+ tips: readonly SetupTip[],
165
+ workflow: TipsContext,
166
+ star: boolean,
167
+ ): string {
168
+ const shown = orderForWorkflow(tips, workflow).slice(0, WORKFLOW_TIPS_CAP);
169
+ const ids = shown.map((t) => t.id);
170
+ const parts = shown.map(tipParagraph);
171
+ if (star) {
172
+ parts.push(STAR_TIP);
173
+ ids.push(STAR_TIP_ID);
174
+ }
175
+ if (ids.length === 0) return "";
176
+ return [...parts, silenceLine(ids)].join("\n\n");
177
+ }
178
+
179
+ /** `formatTips` as a terminal list, without `STAR_TIP`. */
149
180
  function formatSetupTips(
150
181
  tips: readonly SetupTip[],
151
182
  opts: { all?: boolean; workflow?: TipsContext | null },
152
183
  ): string {
153
184
  if (tips.length === 0) return "";
154
185
  const ordered = opts.workflow ? orderForWorkflow(tips, opts.workflow) : [...tips];
155
- const cap = opts.workflow ? WORKFLOW_TIPS_CAP : TIPS_CAP;
156
- const shown = opts.all ? ordered : ordered.slice(0, cap);
186
+ const shown = opts.all ? ordered : ordered.slice(0, TIPS_CAP);
157
187
  const rest = tips.length - shown.length;
158
- const more = rest > 0 ? `${rest} more: \`bkit tips --all\`. ` : "";
159
-
160
- if (opts.workflow && !opts.all) {
161
- const lines: string[] = [];
162
- for (const tip of shown) lines.push(...tipMarkdownLines(tip), "");
163
- lines.push(`${more}${TIPS_DETAILS_POINTER}`);
164
- return lines.join("\n");
165
- }
166
188
 
167
189
  const lines = [tipsIntro(shown.length), ""];
168
190
  shown.forEach((tip, i) => lines.push(...tipTextLines(tip, i + 1), ""));
169
- if (more) lines.push(more.trimEnd());
191
+ if (rest > 0) lines.push(`${rest} more: \`bkit tips --all\`.`);
170
192
  lines.push(TIPS_DETAILS_POINTER);
171
193
  return lines.join("\n");
172
194
  }