@cbartens/bkit 5.4.0 → 5.5.1

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 (125) hide show
  1. package/.bkit/README.md +19 -7
  2. package/.bkit/core/.agents/rules.md +24 -9
  3. package/.bkit/core/.bkit/README.md +18 -6
  4. package/.bkit/core/.bkit/cloud.md +46 -15
  5. package/.bkit/core/.bkit/comparison.md +2 -2
  6. package/.bkit/core/.bkit/install.md +19 -18
  7. package/.bkit/core/.bkit/pipeline.md +3 -1
  8. package/.bkit/core/.bkit/prompts.md +38 -20
  9. package/.bkit/core/.bkit/providers.md +6 -6
  10. package/.bkit/core/.bkit/templates.md +44 -13
  11. package/.bkit/core/.bkit/trackers.md +99 -35
  12. package/.bkit/core/.bkit/workflows.md +50 -45
  13. package/.bkit/core/AGENTS.md +2 -2
  14. package/.bkit/core/docs/templates/bkit-audit-app-performance.md +1 -1
  15. package/.bkit/core/docs/templates/bkit-audit-issues.md +22 -6
  16. package/.bkit/core/engine/checks/after/auth.ts +88 -45
  17. package/.bkit/core/engine/checks/after/ci-yml.ts +0 -1
  18. package/.bkit/core/engine/checks/after/github.ts +42 -78
  19. package/.bkit/core/engine/checks/after/index.ts +1 -6
  20. package/.bkit/core/engine/checks/after/tools.ts +1 -1
  21. package/.bkit/core/engine/checks/before/env.ts +28 -18
  22. package/.bkit/core/engine/checks/before/mcp.ts +4 -2
  23. package/.bkit/core/engine/checks/tips/catalogue.ts +15 -2
  24. package/.bkit/core/engine/checks/tips/index.ts +5 -2
  25. package/.bkit/core/engine/cli.ts +7 -5
  26. package/.bkit/core/engine/commands/ci/ci.ts +107 -0
  27. package/.bkit/core/engine/commands/install/uninstall.ts +46 -0
  28. package/.bkit/core/engine/commands/workflow/fids.ts +23 -15
  29. package/.bkit/core/engine/commands/workflow/issues.ts +61 -63
  30. package/.bkit/core/engine/commands/workflow/ledgers.ts +28 -11
  31. package/.bkit/core/engine/commands/workflow/prs.ts +3 -1
  32. package/.bkit/core/engine/commands/workflow/repo.ts +8 -0
  33. package/.bkit/core/engine/commands/workflow/roadmap.ts +5 -1
  34. package/.bkit/core/engine/commands/workflow/steps.ts +2 -2
  35. package/.bkit/core/engine/commands/workflow/workflows.ts +9 -4
  36. package/.bkit/core/engine/commands/workflow/worktrees.ts +91 -14
  37. package/.bkit/core/engine/install/manifest.ts +31 -10
  38. package/.bkit/core/engine/install/modules/cloud.ts +3 -1
  39. package/.bkit/core/engine/install/modules/core.ts +153 -4
  40. package/.bkit/core/engine/install/modules/opencode.ts +5 -0
  41. package/.bkit/core/engine/install/write.ts +37 -1
  42. package/.bkit/core/engine/render/trackers.ts +35 -23
  43. package/.bkit/core/engine/shared/egress.ts +6 -0
  44. package/.bkit/core/engine/shared/settings.ts +130 -11
  45. package/.bkit/core/hooks/guardrails-tiers.js +1 -1
  46. package/.bkit/core/prompts/bkit-audit-generate.md +42 -12
  47. package/.bkit/core/prompts/bkit-build-challenge-remediate.md +1 -1
  48. package/.bkit/core/prompts/bkit-build-challenge-tests.md +1 -1
  49. package/.bkit/core/prompts/bkit-build-plan-execute.md +1 -1
  50. package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +1 -1
  51. package/.bkit/core/prompts/bkit-debug-abort-handover.md +2 -0
  52. package/.bkit/core/prompts/bkit-debug-failure-remediate.md +1 -1
  53. package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +1 -1
  54. package/.bkit/core/prompts/bkit-debug-failure-soak.md +1 -1
  55. package/.bkit/core/prompts/bkit-design-generate.md +4 -1
  56. package/.bkit/core/prompts/bkit-plan-generate.md +5 -3
  57. package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +1 -1
  58. package/.bkit/core/prompts/bkit-ship-update-docs.md +1 -1
  59. package/.bkit/core/prompts/bkit-utility-update-decisions.md +3 -1
  60. package/.bkit/core/prompts/bkit-utility-update-deferrals.md +3 -1
  61. package/.bkit/core/prompts/bkit-utility-update-documentation.md +12 -2
  62. package/.bkit/core/prompts/bkit-utility-update-failures.md +3 -1
  63. package/.bkit/core/prompts/bkit-utility-update-knowledge.md +3 -1
  64. package/.bkit/core/prompts/bkit-utility-update-roadmap.md +9 -2
  65. package/.bkit/core/prompts/bkit-utility-update-tracker.md +159 -0
  66. package/.bkit/core/workflows/bkit-auto.md +19 -6
  67. package/.bkit/core/workflows/bkit-build.md +59 -17
  68. package/.bkit/core/workflows/bkit-debug.md +64 -20
  69. package/.bkit/core/workflows/bkit-design.md +83 -28
  70. package/.bkit/core/workflows/bkit-plan.md +61 -20
  71. package/.bkit/core/workflows/bkit-ship.md +48 -18
  72. package/.bkit/shared/.bkit/.env.example +8 -0
  73. package/.bkit/shared/.claude/settings.json +3 -1
  74. package/.bkit/shared/.cursor/bkit-cloud.md +2 -2
  75. package/.bkit/shared/.cursor/mcp.json +11 -4
  76. package/.bkit/shared/.mcp.json +11 -4
  77. package/.bkit/shared/.opencode/opencode.json +2 -0
  78. package/.bkit/shared/docs/deployments.md +6 -7
  79. package/.bkit/shared/docs/security.md +1 -1
  80. package/.bkit/shared/docs/testing.md +13 -5
  81. package/.bkit/templates/.github/renovate.json5 +1 -1
  82. package/.bkit/templates/.github/workflows/bkit-ci.yml +21 -115
  83. package/.bkit/templates/.github/workflows/bkit-cloud.yml +40 -12
  84. package/.bkit/templates/.husky/pre-commit +4 -4
  85. package/.bkit/templates/.husky/pre-push +107 -18
  86. package/.bkit/templates/scripts/ci/bkit-local-stack-lock.sh +194 -0
  87. package/.bkit/templates/scripts/ci/check-capstone.mjs +2 -4
  88. package/.bkit/templates/scripts/ci/check-capstone.test.mjs +4 -23
  89. package/.bkit/templates/scripts/ci/lanes/resolve-push-base.mjs +104 -23
  90. package/.bkit/templates/scripts/ci/lanes/resolve-push-base.test.mjs +103 -6
  91. package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +3 -1
  92. package/.bkit/templates/scripts/graphify/bkit-graphify.sh +1 -1
  93. package/.bkit/templates/scripts/prettier/bkit-insert-ignore.mjs +49 -29
  94. package/CHANGELOG.md +67 -1
  95. package/README.md +16 -6
  96. package/dist/checks/after/auth.js +81 -45
  97. package/dist/checks/after/ci-yml.js +0 -1
  98. package/dist/checks/after/github.js +41 -76
  99. package/dist/checks/after/index.js +2 -7
  100. package/dist/checks/after/tools.js +1 -1
  101. package/dist/checks/before/env.js +24 -17
  102. package/dist/checks/before/mcp.js +4 -2
  103. package/dist/checks/tips/catalogue.js +14 -2
  104. package/dist/checks/tips/index.js +4 -2
  105. package/dist/cli.js +7 -5
  106. package/dist/commands/ci/ci.js +100 -0
  107. package/dist/commands/install/uninstall.js +42 -0
  108. package/dist/commands/workflow/fids.js +22 -15
  109. package/dist/commands/workflow/issues.js +53 -61
  110. package/dist/commands/workflow/ledgers.js +26 -11
  111. package/dist/commands/workflow/prs.js +3 -1
  112. package/dist/commands/workflow/repo.js +6 -0
  113. package/dist/commands/workflow/roadmap.js +3 -1
  114. package/dist/commands/workflow/steps.js +2 -2
  115. package/dist/commands/workflow/workflows.js +9 -4
  116. package/dist/commands/workflow/worktrees.js +74 -13
  117. package/dist/install/manifest.js +30 -10
  118. package/dist/install/modules/cloud.js +3 -1
  119. package/dist/install/modules/core.js +157 -5
  120. package/dist/install/modules/opencode.js +6 -0
  121. package/dist/install/write.js +26 -2
  122. package/dist/render/trackers.js +34 -20
  123. package/dist/shared/egress.js +6 -0
  124. package/dist/shared/settings.js +59 -7
  125. package/package.json +14 -3
@@ -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
  }
@@ -78,7 +78,6 @@ export function detectCiYmlMissingActionlint(cwd: string): PreflightFinding | nu
78
78
  action:
79
79
  "Add an actionlint step among the static checks in .github/workflows/bkit-ci.yml (before the test/build group):\n\n" +
80
80
  " - name: Run actionlint\n" +
81
- " if: steps.cache.outputs.skip != 'true'\n" +
82
81
  " run: |\n" +
83
82
  ' curl -sSfL https://raw.githubusercontent.com/rhysd/actionlint/v1.7.12/scripts/download-actionlint.bash -o "$RUNNER_TEMP/download-actionlint.bash"\n' +
84
83
  ' bash "$RUNNER_TEMP/download-actionlint.bash" 1.7.12 "$RUNNER_TEMP"\n' +
@@ -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,21 +124,22 @@ 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
 
120
131
  /**
121
- * Classify the `bkit.githubProject` board-sync config in package.json:
122
- * - "configured" → object with at least `owner` + `number` (the lookup keys)
132
+ * Classify the `bkit.github.project` board-sync config in package.json:
133
+ * - "configured" → a Projects v2 board URL
123
134
  * - "opted-out" → set to `false` ("no board sync" — stay quiet)
135
+ * - "invalid" → a string that is not a board URL
124
136
  * - "absent" → missing, malformed, or unreadable
125
137
  */
126
- function readGithubProjectConfig(cwd: string): "configured" | "opted-out" | "absent" {
127
- const gp = readBkitConfig(cwd).githubProject;
128
- if (gp === false) return "opted-out";
129
- if (gp !== null && gp.owner !== undefined && gp.number !== undefined) return "configured";
130
- return "absent";
138
+ function readGithubProjectConfig(cwd: string): "configured" | "opted-out" | "invalid" | "absent" {
139
+ const { project, projectUrl } = readBkitConfig(cwd).github;
140
+ if (project === false) return "opted-out";
141
+ if (project !== null) return "configured";
142
+ return projectUrl === null ? "absent" : "invalid";
131
143
  }
132
144
 
133
145
  /**
@@ -157,13 +169,13 @@ export function detectProjectsToolset(cwd: string): TokenPresence {
157
169
  /**
158
170
  * GitHub Projects v2 board-sync prerequisite advisory. Board status sync needs
159
171
  * THREE things, none of which install seeds or verifies end-to-end:
160
- * `bkit.githubProject` config, the `projects` MCP toolset, and an org-scoped
161
- * Projects R/W PAT. Absent any of the first two (the detectable ones), board
162
- * sync silently no-ops — `bkit.githubProject` alone is useless if the toolset
163
- * lacks `projects`, and vice versa. Emits one advisory naming what's missing.
172
+ * `bkit.github.project` (the board URL), the `projects` MCP toolset, and a PAT
173
+ * with Projects R/W. Absent any of the first two (the detectable ones), board
174
+ * sync silently no-ops — the URL alone is useless if the toolset lacks
175
+ * `projects`, and vice versa. Emits one advisory naming what's missing.
164
176
  *
165
177
  * Gates: workflows installed (.claude/ or .cursor/) AND tracker === "github".
166
- * Stays quiet on explicit opt-out (`bkit.githubProject: false`) or when both
178
+ * Stays quiet on explicit opt-out (`bkit.github.project: false`) or when both
167
179
  * detectable prerequisites are satisfied (PAT scope can't be checked locally).
168
180
  */
169
181
  export function buildGithubProjectAdvisory(cwd: string): PreflightFinding | null {
@@ -181,7 +193,9 @@ export function buildGithubProjectAdvisory(cwd: string): PreflightFinding | null
181
193
  if (configOk && toolsetOk) return null;
182
194
 
183
195
  const missing: string[] = [];
184
- if (!configOk) missing.push("`bkit.githubProject` is absent from package.json");
196
+ if (configState === "absent") missing.push("`bkit.github.project` is absent from package.json");
197
+ if (configState === "invalid")
198
+ missing.push("`bkit.github.project` is not a GitHub Projects board URL");
185
199
  if (toolset === "missing")
186
200
  missing.push("the `projects` toolset is missing from `.mcp.json` `X-MCP-Toolsets`");
187
201
  const missingPhrase = missing.length > 0 ? `: ${missing.join("; ")}` : "";
@@ -194,70 +208,18 @@ export function buildGithubProjectAdvisory(cwd: string): PreflightFinding | null
194
208
  "Board sync silently no-ops — workflows never reflect phase on the project board.",
195
209
  action:
196
210
  "Board status sync is optional (workflows never gate on it) but invisible when half-configured. All three prerequisites are required:\n\n" +
197
- "1. Add `bkit.githubProject` to package.json (org-owned board only — fine-grained PATs cannot reach user-owned projects, nor span orgs; use a classic PAT with `project` to cover more than one owner):\n\n" +
211
+ "1. Add the board's URL to package.json, as the browser shows it on the board (`/orgs/<org>/…` for an organization board, `/users/<login>/…` for a personal one; a trailing `/views/<n>` is fine):\n\n" +
198
212
  ' "bkit": {\n' +
199
- ' "githubProject": {\n' +
200
- ' "owner": "<org>", "number": <project-number>,\n' +
201
- ' "statusFieldId": <numeric-field-id>, "progressOptionId": "<option-id>",\n' +
202
- ' "reviewOptionId": "<option-id>", "doneOptionId": "<option-id>"\n' +
203
- " }\n" +
213
+ ' "github": { "project": "https://github.com/orgs/<org>/projects/<number>" }\n' +
204
214
  " }\n\n" +
205
- " Discover the ids: `gh api /orgs/<org>/projectsV2/<number>/fields --jq '.[] | select(.name==\"Status\")'` → the Status field's " +
206
- "numeric `id` → `statusFieldId` (a JSON number, NOT quoted); each `options[].id` (e.g. `47fc9ee4`) → " +
207
- "the option ids (quoted strings). `gh project field-list`'s `id` is the GraphQL node id (`PVTSSF_…`) " +
208
- "and must NOT be used for `statusFieldId` — `projects_write` rejects it with " +
209
- "`updated_field.id: value must be a number`.\n\n" +
215
+ " Workflows set the board's Status field by option name: `In progress` when a phase starts, `In review` at hand-off. " +
216
+ 'A board whose Status options are named differently sets `"progress"` and `"review"` beside `"project"` to its own names.\n\n' +
210
217
  "2. Ensure the root `.mcp.json` github server enables the `projects` toolset:\n\n" +
211
218
  ' "X-MCP-Toolsets": "context,issues,pull_requests,repos,users,projects,actions"\n\n' +
212
- "3. The `BKIT_GH_TOKEN` PAT needs organization-scoped Projects read & write (repo scope is not enough).\n\n" +
213
- "To opt out and silence this advisory, set `bkit.githubProject` to `false` in package.json.",
214
- };
215
- }
216
-
217
- /**
218
- * Static-validate the `statusFieldId` shape on an otherwise-configured board.
219
- * Projects v2 board sync feeds `statusFieldId` straight into `projects_write`
220
- * `updated_field.id`, which requires the NUMERIC field id; a GraphQL node id
221
- * (`PVTSSF_…` — what `gh project field-list` returns) or any non-number value is
222
- * rejected with `updated_field.id: value must be a number`, and best-effort sync then
223
- * no-ops silently. Checked at install/check time, no network needed.
224
- *
225
- * Gates: workflows installed AND tracker === "github" AND `bkit.githubProject` is
226
- * an object carrying `owner` + `number` (an otherwise-usable board) AND
227
- * `statusFieldId` is present but not a JSON number. An absent `statusFieldId` is
228
- * the setup advisory's job; opt-out (`false`) and absent config never reach here.
229
- */
230
- export function detectGithubProjectFieldIdFormat(cwd: string): PreflightFinding | null {
231
- const hasClaude = fs.existsSync(path.join(cwd, ".claude"));
232
- const hasCursor = fs.existsSync(path.join(cwd, ".cursor"));
233
- if (!hasClaude && !hasCursor) return null;
234
- const { issueTracker, githubProject: gp } = readBkitConfig(cwd);
235
- if (issueTracker !== "github") return null;
236
-
237
- // Only judge a board that is otherwise configured (owner + number present) and
238
- // has a statusFieldId set — absent statusFieldId is handled by the setup advisory.
239
- if (!gp || gp.owner === undefined || gp.number === undefined) return null;
240
- const sfid = gp.statusFieldId;
241
- if (sfid === undefined || typeof sfid === "number") return null; // absent or already correct
242
-
243
- const looksLikeNodeId = typeof sfid === "string" && /^PVT/.test(sfid);
244
- const shape = looksLikeNodeId
245
- ? "a GraphQL node id (`PVTSSF_…`)"
246
- : `a ${typeof sfid} (\`${String(sfid)}\`)`;
247
-
248
- return {
249
- id: "github-project-status-field-id-format",
250
- severity: "advisory",
251
- detect:
252
- `\`bkit.githubProject.statusFieldId\` is ${shape}, but Projects v2 board sync feeds it to ` +
253
- "`projects_write` `updated_field.id`, which requires the numeric field id and rejects anything " +
254
- "else (`updated_field.id: value must be a number`). Board sync silently no-ops — the board never reflects phase.",
255
- action:
256
- "Re-derive the numeric Status field id and store it unquoted:\n\n" +
257
- " gh api /orgs/<org>/projectsV2/<number>/fields --jq '.[] | select(.name==\"Status\")'\n\n" +
258
- "The Status field's numeric `id` (e.g. `350038178`) → `statusFieldId` (a JSON number, NOT quoted); " +
259
- "each `options[].id` (e.g. `47fc9ee4`) → the option ids (quoted strings). `gh project field-list`'s " +
260
- "`id` is the GraphQL node id (`PVTSSF_…`) and must NOT be used for `statusFieldId`.",
219
+ "3. The `BKIT_GH_TOKEN` PAT needs Projects read & write (repo scope is not enough): a fine-grained PAT gets it as an " +
220
+ "organization permission, so it reaches organization boards only; a classic PAT with the `project` scope reaches " +
221
+ "organization and personal boards.\n\n" +
222
+ "To opt out and silence this advisory, set `bkit.github.project` to `false` in package.json.",
261
223
  };
262
224
  }
263
225
 
@@ -276,6 +238,7 @@ export function detectGithubProjectFieldIdFormat(cwd: string): PreflightFinding
276
238
  * opt-out):
277
239
  * - `.github/workflows/bkit-cloud.yml` present → `cloud-router` (informational; active)
278
240
  * - `bkit.cloudAgents === "none"` → null (opt-out — stay quiet)
241
+ * - `bkit.issueTracker === "jira"` → null (Jira runs locally only)
279
242
  * - otherwise (undecided) → `cloud-router-none` (nudge to choose)
280
243
  *
281
244
  * Only fires when there is a `.github/workflows/` dir (the router wakes on a CI
@@ -307,15 +270,16 @@ export function buildCloudSetupAdvisory(cwd: string): PreflightFinding | null {
307
270
  severity: "advisory",
308
271
  detect:
309
272
  "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".`,
273
+ 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
274
  };
312
275
  }
313
276
 
314
277
  // No router present — distinguish opt-out from undecided.
315
- const { cloudAgents, cloudAgentsExplicit } = readBkitConfig(cwd);
278
+ const { cloudAgents, cloudAgentsExplicit, issueTracker } = readBkitConfig(cwd);
316
279
  if (cloudAgents === "none" && cloudAgentsExplicit) {
317
280
  return null; // consumer explicitly chose `none` — stay quiet
318
281
  }
282
+ if (issueTracker === "jira") return null; // no cloud setup exists for a Jira tracker
319
283
 
320
284
  // Only nudge if there's a workflows dir for the router to wake on.
321
285
  if (!fs.existsSync(path.join(cwd, ".github", "workflows"))) return null;
@@ -327,7 +291,7 @@ export function buildCloudSetupAdvisory(cwd: string): PreflightFinding | null {
327
291
  "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
292
  action:
329
293
  "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" +
294
+ "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
295
  'To opt out and silence this advisory, set `bkit.cloudAgents` to `"none"` in package.json.',
332
296
  };
333
297
  }
@@ -21,7 +21,6 @@ import {
21
21
  buildGithubProjectAdvisory,
22
22
  buildTrackerSetupAdvisory,
23
23
  detectActionsWritePermissions,
24
- detectGithubProjectFieldIdFormat,
25
24
  detectMainBranchProtection,
26
25
  } from "./github.js";
27
26
  import {
@@ -395,16 +394,12 @@ export function runPostInstallCheck(
395
394
  // absent any prerequisite, sync silently no-ops.
396
395
  const githubProjectSetup = buildGithubProjectAdvisory(cwd);
397
396
  if (githubProjectSetup) phase3.push(githubProjectSetup);
398
- // A configured board can still silently no-op if statusFieldId holds the GraphQL
399
- // node id instead of the numeric field id projects_write requires.
400
- const githubProjectFieldId = detectGithubProjectFieldIdFormat(cwd);
401
- if (githubProjectFieldId) phase3.push(githubProjectFieldId);
402
397
  const depUpdaterSetup = buildDepUpdaterSetupAdvisory(cwd);
403
398
  if (depUpdaterSetup) phase3.push(depUpdaterSetup);
404
399
  const cloudSetup = buildCloudSetupAdvisory(cwd);
405
400
  if (cloudSetup) phase3.push(cloudSetup);
406
401
 
407
- // bkit-cloud.yml needs the ANTHROPIC_API_KEY repo secret.
402
+ // bkit-cloud.yml's claude job needs the ANTHROPIC_API_KEY repo secret or federation variables.
408
403
  for (const f of detectCiRouterSecrets(cwd)) phase3.push(f);
409
404
 
410
405
  // 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 `contents: read` + `pull-requests: write` — job-level REPLACES the workflow-level block (not additive), so omitting `contents: read` breaks the checkout; (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",
@@ -22,6 +22,7 @@
22
22
  // `bkit.ignoreAdvisories` entry silences both.
23
23
 
24
24
  import * as fs from "node:fs";
25
+ import * as path from "node:path";
25
26
 
26
27
  import { machineStepsPath, REPO_STEPS } from "../../commands/workflow/disk.js";
27
28
  import { detectContextFetchMissing } from "../before/context-fetch.js";
@@ -87,7 +88,7 @@ export const SETUP_TIPS: readonly SetupTip[] = [
87
88
  id: "tracker",
88
89
  workflows: EVERY_CONTEXT,
89
90
  title: "Connect an issue tracker",
90
- 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.",
91
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.",
92
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.',
93
94
  steps:
@@ -235,7 +236,7 @@ export const SETUP_TIPS: readonly SetupTip[] = [
235
236
  title: "Finish cloud setup",
236
237
  line: "You've turned on cloud agents, but setup isn't finished, so cloud runs will stop partway. Finish the remaining steps.",
237
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.",
238
- 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.",
239
240
  steps: "`.bkit/cloud.md`; `.bkit/templates.md` § Cloud-agent workflow and § Cursor.",
240
241
  fires: (cwd) => {
241
242
  const cloud = readBkitConfig(cwd).cloudAgents;
@@ -378,6 +379,18 @@ export const SETUP_TIPS: readonly SetupTip[] = [
378
379
  fires: (cwd) =>
379
380
  exists(cwd, ".husky/pre-push") && !exists(cwd, "scripts/cleanup/bkit-tmp-prune.mjs"),
380
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
+ },
381
394
  {
382
395
  id: "disk-prune",
383
396
  workflows: ALL_WORKFLOWS,
@@ -32,7 +32,7 @@ export function silenceLine(ids: readonly string[]): string {
32
32
  const names = ids.map((id) => `\`${id}\``);
33
33
  const list = names.length > 1 ? `${names.slice(0, -1).join(", ")} and ${names.at(-1)}` : names[0];
34
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".`;
35
+ return `**Want to silence ${what}?** Ask your agent to "add ${list} to \`bkit.ignoreAdvisories\` in package.json".`;
36
36
  }
37
37
 
38
38
  /** `bkit.ignoreAdvisories` key that silences `STAR_TIP`. */
@@ -49,6 +49,9 @@ export const STAR_TIP_OLD_ID = "star";
49
49
  export const STAR_TIP =
50
50
  "Do you like bkit? Then give it a star at [https://github.com/cbartens/bkit](https://github.com/cbartens/bkit)!";
51
51
 
52
+ /** `STAR_TIP` for a workflow's `## bkit Tips`, its question bold like each tip's title. */
53
+ export const STAR_TIP_PARAGRAPH = STAR_TIP.replace("Do you like bkit?", "**Do you like bkit?**");
54
+
52
55
  /** Intro of the Setup tips section: who reads which field, and how to silence a tip. */
53
56
  export const TIPS_SECTION_INTRO =
54
57
  "Things not set up yet, most useful first. For the person: each tip says what goes wrong today and a sentence to ask your agent. For an AI agent: follow each tip's Agent steps unless the person declines it. Silence a tip by adding its id to `bkit.ignoreAdvisories` in package.json. Full template catalogue: .bkit/templates.md.";
@@ -169,7 +172,7 @@ function formatWorkflowTips(
169
172
  const ids = shown.map((t) => t.id);
170
173
  const parts = shown.map(tipParagraph);
171
174
  if (star) {
172
- parts.push(STAR_TIP);
175
+ parts.push(STAR_TIP_PARAGRAPH);
173
176
  ids.push(STAR_TIP_ID);
174
177
  }
175
178
  if (ids.length === 0) return "";