@cbartens/bkit 5.2.4 → 5.3.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 (221) hide show
  1. package/.bkit/README.md +26 -11
  2. package/.bkit/core/.agents/context.md +1 -1
  3. package/.bkit/core/.agents/docs.md +1 -1
  4. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +1 -1
  5. package/.bkit/core/.agents/rules.md +11 -0
  6. package/.bkit/core/.bkit/README.md +25 -10
  7. package/.bkit/core/.bkit/cloud.md +9 -8
  8. package/.bkit/core/.bkit/comparison.md +68 -345
  9. package/.bkit/core/.bkit/install.md +12 -6
  10. package/.bkit/core/.bkit/lite.md +73 -0
  11. package/.bkit/core/.bkit/pipeline.md +345 -0
  12. package/.bkit/core/.bkit/prompts.md +88 -73
  13. package/.bkit/core/.bkit/providers.md +41 -22
  14. package/.bkit/core/.bkit/templates.md +106 -17
  15. package/.bkit/core/.bkit/trackers.md +47 -1
  16. package/.bkit/core/.bkit/workflows.md +44 -43
  17. package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +1 -1
  18. package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +7 -4
  19. package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +8 -5
  20. package/.bkit/core/docs/templates/bkit-audit-adoption.md +1 -1
  21. package/.bkit/core/docs/templates/bkit-audit-dependencies.md +14 -10
  22. package/.bkit/core/docs/templates/bkit-audit-llm.md +20 -14
  23. package/.bkit/core/docs/templates/bkit-audit-prompts.md +2 -2
  24. package/.bkit/core/docs/templates/bkit-audit-red-team.md +10 -8
  25. package/.bkit/core/docs/templates/bkit-audit-security.md +3 -3
  26. package/.bkit/core/docs/templates/bkit-audit-testing.md +4 -3
  27. package/.bkit/core/docs/templates/bkit-plan.md +8 -6
  28. package/.bkit/core/engine/checks/after/auth.ts +9 -9
  29. package/.bkit/core/engine/checks/after/ci-yml.ts +14 -12
  30. package/.bkit/core/engine/checks/after/github.ts +29 -120
  31. package/.bkit/core/engine/checks/after/index.ts +2 -2
  32. package/.bkit/core/engine/checks/after/managed.ts +8 -28
  33. package/.bkit/core/engine/checks/after/tools.ts +3 -15
  34. package/.bkit/core/engine/checks/before/context-fetch.ts +1 -21
  35. package/.bkit/core/engine/checks/before/index.ts +7 -43
  36. package/.bkit/core/engine/checks/before/mcp.ts +17 -8
  37. package/.bkit/core/engine/checks/before/repo.ts +9 -12
  38. package/.bkit/core/engine/checks/status-holes.ts +4 -5
  39. package/.bkit/core/engine/checks/tips/catalogue.ts +60 -24
  40. package/.bkit/core/engine/checks/tips/detect.ts +45 -2
  41. package/.bkit/core/engine/checks/tips/index.ts +37 -8
  42. package/.bkit/core/engine/cli.ts +39 -16
  43. package/.bkit/core/engine/commands/analysis.ts +36 -26
  44. package/.bkit/core/engine/commands/comply.ts +17 -16
  45. package/.bkit/core/engine/commands/harvest.ts +12 -12
  46. package/.bkit/core/engine/commands/install/doctor.ts +57 -28
  47. package/.bkit/core/engine/commands/install/install.ts +62 -126
  48. package/.bkit/core/engine/commands/install/uninstall.ts +191 -33
  49. package/.bkit/core/engine/commands/install/upgrade.ts +49 -43
  50. package/.bkit/core/engine/commands/lib.ts +35 -10
  51. package/.bkit/core/engine/commands/tips.ts +8 -5
  52. package/.bkit/core/engine/commands/workflow/branches.ts +4 -4
  53. package/.bkit/core/engine/commands/workflow/counters.ts +21 -12
  54. package/.bkit/core/engine/commands/workflow/fids.ts +46 -0
  55. package/.bkit/core/engine/commands/workflow/ledgers.ts +3 -1
  56. package/.bkit/core/engine/commands/workflow/prs.ts +4 -2
  57. package/.bkit/core/engine/commands/workflow/repo.ts +2 -2
  58. package/.bkit/core/engine/commands/workflow/roadmap.ts +4 -3
  59. package/.bkit/core/engine/commands/workflow/runs.ts +8 -7
  60. package/.bkit/core/engine/commands/workflow/steps.ts +1 -0
  61. package/.bkit/core/engine/commands/workflow/tests.ts +17 -5
  62. package/.bkit/core/engine/commands/workflow/workflows.ts +15 -14
  63. package/.bkit/core/engine/commands/workflow/workstreams.ts +2 -1
  64. package/.bkit/core/engine/commands/workflow/worktrees.ts +13 -5
  65. package/.bkit/core/engine/install/cloud-env.ts +10 -31
  66. package/.bkit/core/engine/install/manifest.ts +14 -7
  67. package/.bkit/core/engine/install/modules/antigravity.ts +15 -26
  68. package/.bkit/core/engine/install/modules/claude.ts +20 -28
  69. package/.bkit/core/engine/install/modules/cloud.ts +5 -2
  70. package/.bkit/core/engine/install/modules/codex.ts +15 -29
  71. package/.bkit/core/engine/install/modules/core.ts +91 -70
  72. package/.bkit/core/engine/install/modules/cursor.ts +6 -20
  73. package/.bkit/core/engine/install/modules/index.ts +7 -1
  74. package/.bkit/core/engine/install/modules/opencode.ts +48 -70
  75. package/.bkit/core/engine/install/network-allowlist.ts +73 -0
  76. package/.bkit/core/engine/install/placeholders.ts +3 -18
  77. package/.bkit/core/engine/install/write.ts +59 -12
  78. package/.bkit/core/engine/ledgers/telemetry.ts +6 -4
  79. package/.bkit/core/engine/render/hosts.ts +47 -67
  80. package/.bkit/core/engine/render/models.ts +29 -11
  81. package/.bkit/core/engine/shared/branches.ts +13 -0
  82. package/.bkit/core/engine/shared/egress.ts +3 -3
  83. package/.bkit/core/engine/shared/json.ts +18 -1
  84. package/.bkit/core/engine/shared/package-json.ts +63 -0
  85. package/.bkit/core/engine/shared/package-roots.ts +0 -10
  86. package/.bkit/core/engine/shared/protected-paths.ts +5 -130
  87. package/.bkit/core/engine/shared/settings.ts +36 -0
  88. package/.bkit/core/hooks/antigravity-hook.js +1 -0
  89. package/.bkit/core/hooks/guardrails-shell.js +186 -40
  90. package/.bkit/core/hooks/guardrails-tiers.js +5 -78
  91. package/.bkit/core/prompts/bkit-audit-generate.md +60 -7
  92. package/.bkit/core/prompts/bkit-build-challenge-1.md +1 -1
  93. package/.bkit/core/prompts/bkit-build-challenge-2.md +1 -1
  94. package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +1 -1
  95. package/.bkit/core/prompts/bkit-build-challenge-remediate.md +1 -1
  96. package/.bkit/core/prompts/bkit-build-challenge-tests.md +1 -1
  97. package/.bkit/core/prompts/bkit-build-install-skills.md +1 -1
  98. package/.bkit/core/prompts/bkit-build-plan-current.md +1 -1
  99. package/.bkit/core/prompts/bkit-build-plan-execute.md +4 -4
  100. package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +1 -1
  101. package/.bkit/core/prompts/bkit-build-plan-verify.md +2 -2
  102. package/.bkit/core/prompts/bkit-debug-abort-handover.md +1 -1
  103. package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +1 -1
  104. package/.bkit/core/prompts/bkit-debug-failure-remediate.md +1 -1
  105. package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +78 -0
  106. package/.bkit/core/prompts/bkit-debug-failure-soak.md +1 -1
  107. package/.bkit/core/prompts/bkit-debug-summary.md +3 -3
  108. package/.bkit/core/prompts/bkit-design-spike.md +1 -1
  109. package/.bkit/core/prompts/bkit-design-summary.md +2 -2
  110. package/.bkit/core/prompts/bkit-design-update.md +1 -1
  111. package/.bkit/core/prompts/bkit-plan-complexity-check.md +1 -1
  112. package/.bkit/core/prompts/bkit-plan-generate.md +1 -1
  113. package/.bkit/core/prompts/bkit-plan-scope-check-1.md +1 -1
  114. package/.bkit/core/prompts/bkit-plan-scope-check-2.md +1 -1
  115. package/.bkit/core/prompts/bkit-plan-summary.md +1 -1
  116. package/.bkit/core/prompts/bkit-plan-update.md +1 -1
  117. package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +1 -1
  118. package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +1 -1
  119. package/.bkit/core/prompts/bkit-ship-update-docs.md +1 -1
  120. package/.bkit/core/prompts/bkit-utility-update-decisions.md +9 -2
  121. package/.bkit/core/prompts/bkit-utility-update-deferrals.md +9 -2
  122. package/.bkit/core/prompts/bkit-utility-update-documentation.md +2 -1
  123. package/.bkit/core/prompts/bkit-utility-update-failures.md +9 -2
  124. package/.bkit/core/prompts/bkit-utility-update-knowledge.md +9 -2
  125. package/.bkit/core/prompts/bkit-utility-update-roadmap.md +11 -4
  126. package/.bkit/core/workflows/bkit-build.md +3 -3
  127. package/.bkit/core/workflows/bkit-debug.md +69 -33
  128. package/.bkit/core/workflows/bkit-design.md +2 -2
  129. package/.bkit/core/workflows/bkit-plan.md +11 -4
  130. package/.bkit/core/workflows/bkit-ship.md +5 -5
  131. package/.bkit/shared/.claude/bkit-cloud.md +46 -13
  132. package/.bkit/shared/.claude/settings.json +18 -0
  133. package/.bkit/shared/.cursor/mcp.json +2 -1
  134. package/.bkit/shared/.opencode/opencode.json +19 -1
  135. package/.bkit/shared/docs/deployments.md +20 -4
  136. package/.bkit/shared/docs/security.md +8 -6
  137. package/.bkit/shared/docs/testing.md +9 -5
  138. package/.bkit/templates/.cursor/Dockerfile +30 -16
  139. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-bug.yml +78 -0
  140. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-change.yml +91 -0
  141. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-idea.yml +56 -0
  142. package/.bkit/templates/.github/renovate.json5 +91 -12
  143. package/.bkit/templates/.github/workflows/bkit-ci.yml +66 -53
  144. package/.bkit/templates/.github/workflows/bkit-cloud.yml +3 -1
  145. package/.bkit/templates/.github/workflows/bkit-renovate.yml +8 -1
  146. package/.bkit/templates/.github/workflows/bkit-trivy.yml +67 -0
  147. package/.bkit/templates/.husky/pre-push +8 -3
  148. package/.bkit/templates/.oxlintrc.json +21 -0
  149. package/.bkit/templates/docs/capabilities.md +1 -1
  150. package/.bkit/templates/scripts/ci/check-capstone.mjs +176 -0
  151. package/.bkit/templates/scripts/ci/check-capstone.test.mjs +311 -0
  152. package/.bkit/templates/scripts/graphify/bkit-graph-eager.py +2 -2
  153. package/.bkit/templates/scripts/graphify/bkit-graph-imports.py +43 -20
  154. package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +33 -11
  155. package/.bkit/templates/scripts/graphify/bkit-graph-repair.py +3 -2
  156. package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +5 -5
  157. package/.bkit/templates/scripts/graphify/bkit-graphify.sh +79 -19
  158. package/CHANGELOG.md +50 -3
  159. package/README.md +258 -129
  160. package/dist/checks/after/auth.js +10 -11
  161. package/dist/checks/after/ci-yml.js +11 -14
  162. package/dist/checks/after/github.js +32 -125
  163. package/dist/checks/after/index.js +3 -2
  164. package/dist/checks/after/managed.js +8 -24
  165. package/dist/checks/after/tools.js +3 -16
  166. package/dist/checks/before/context-fetch.js +1 -21
  167. package/dist/checks/before/index.js +6 -42
  168. package/dist/checks/before/mcp.js +14 -9
  169. package/dist/checks/before/repo.js +8 -11
  170. package/dist/checks/status-holes.js +5 -6
  171. package/dist/checks/tips/catalogue.js +51 -18
  172. package/dist/checks/tips/detect.js +41 -2
  173. package/dist/checks/tips/index.js +25 -5
  174. package/dist/cli.js +34 -14
  175. package/dist/commands/analysis.js +21 -5
  176. package/dist/commands/comply.js +20 -18
  177. package/dist/commands/harvest.js +12 -13
  178. package/dist/commands/install/doctor.js +55 -23
  179. package/dist/commands/install/install.js +62 -118
  180. package/dist/commands/install/uninstall.js +165 -31
  181. package/dist/commands/install/upgrade.js +46 -39
  182. package/dist/commands/lib.js +32 -10
  183. package/dist/commands/tips.js +6 -3
  184. package/dist/commands/workflow/branches.js +3 -5
  185. package/dist/commands/workflow/counters.js +17 -7
  186. package/dist/commands/workflow/fids.js +39 -0
  187. package/dist/commands/workflow/ledgers.js +3 -1
  188. package/dist/commands/workflow/prs.js +3 -3
  189. package/dist/commands/workflow/repo.js +2 -2
  190. package/dist/commands/workflow/roadmap.js +4 -4
  191. package/dist/commands/workflow/runs.js +5 -5
  192. package/dist/commands/workflow/steps.js +1 -0
  193. package/dist/commands/workflow/tests.js +16 -3
  194. package/dist/commands/workflow/workflows.js +15 -15
  195. package/dist/commands/workflow/workstreams.js +2 -1
  196. package/dist/commands/workflow/worktrees.js +4 -5
  197. package/dist/install/cloud-env.js +10 -23
  198. package/dist/install/manifest.js +14 -7
  199. package/dist/install/modules/antigravity.js +15 -26
  200. package/dist/install/modules/claude.js +17 -21
  201. package/dist/install/modules/cloud.js +6 -2
  202. package/dist/install/modules/codex.js +15 -29
  203. package/dist/install/modules/core.js +82 -63
  204. package/dist/install/modules/cursor.js +6 -9
  205. package/dist/install/modules/index.js +6 -1
  206. package/dist/install/modules/opencode.js +41 -72
  207. package/dist/install/network-allowlist.js +62 -0
  208. package/dist/install/placeholders.js +3 -16
  209. package/dist/install/write.js +55 -15
  210. package/dist/ledgers/telemetry.js +5 -4
  211. package/dist/render/hosts.js +30 -55
  212. package/dist/render/models.js +20 -9
  213. package/dist/shared/branches.js +11 -0
  214. package/dist/shared/egress.js +0 -2
  215. package/dist/shared/json.js +14 -0
  216. package/dist/shared/package-json.js +61 -0
  217. package/dist/shared/package-roots.js +0 -8
  218. package/dist/shared/protected-paths.js +5 -122
  219. package/dist/shared/settings.js +18 -1
  220. package/package.json +21 -17
  221. package/.bkit/core/.agents/shortcuts.md +0 -73
@@ -0,0 +1,11 @@
1
+ // shared/branches.ts — which branches are shared, so nobody works on them directly.
2
+ //
3
+ // `dev` is the integration branch; `dev` and `main` are the shared branches. The workflow
4
+ // commands (`commands/lib.ts` re-exports these) and the managed-version check both read
5
+ // this one rule.
6
+ /** The integration branch feature work lands on. */
7
+ export const DEV = "dev";
8
+ /** True for `dev` and `main`: no feature work happens on them, no force-push touches them. */
9
+ export function isSharedBranch(branch) {
10
+ return branch === DEV || branch === "main";
11
+ }
@@ -3,8 +3,6 @@
3
3
  /**
4
4
  * Providers bkit supports for the opencode host. `--opencode=<provider>` accepts
5
5
  * ONLY these — anything else is rejected (no generic/arbitrary-endpoint fallback).
6
- * Keep in sync with OPENCODE_PROVIDER_DEFAULTS (below) and
7
- * GATEWAY_COLUMN (render/models.ts § Models lookup).
8
6
  */
9
7
  export const OPENCODE_PROVIDERS = [
10
8
  // OpenAI-compatible npm driver — endpoint + key per provider.
@@ -4,6 +4,8 @@
4
4
  // .bkit/version) must fail open into a result the caller reports in its own terms,
5
5
  // never abort install, upgrade or `bkit check`. One shape, one catch — so the
6
6
  // defensive-slop gate reads a single documented fallback instead of one per caller.
7
+ // `audits/repo/json-parse-owner.test.ts` fails on a `JSON.parse` inside a `try` anywhere else.
8
+ import * as fs from "node:fs";
7
9
  /** `JSON.parse(raw)` as a result: `{ ok: true, value }`, or `{ ok: false }` when not JSON. */
8
10
  export function parseJson(raw) {
9
11
  try {
@@ -14,3 +16,15 @@ export function parseJson(raw) {
14
16
  return { ok: false };
15
17
  }
16
18
  }
19
+ /** `parseJson` over the file at `file`; `{ ok: false }` also when the file cannot be read. */
20
+ export function readJsonFile(file) {
21
+ let raw;
22
+ try {
23
+ raw = fs.readFileSync(file, "utf-8");
24
+ }
25
+ catch {
26
+ // Missing, unreadable or a directory: the result says so, like malformed JSON.
27
+ return { ok: false };
28
+ }
29
+ return parseJson(raw);
30
+ }
@@ -3,9 +3,12 @@
3
3
  // Commands that look up a script or a `bkit` setting need to tell "no file" and
4
4
  // "file is not JSON" apart from "key absent", so a broken manifest is named in the
5
5
  // message instead of reading as an empty one.
6
+ //
7
+ // `readInstallingVersion` reads the same file for the bkit package doing the install.
6
8
  import * as fs from "node:fs";
7
9
  import * as path from "node:path";
8
10
  import { parseJson } from "./json.js";
11
+ import { getPkgRoot } from "./package-roots.js";
9
12
  /** `dir/package.json` as an object, or why it could not be read as one. */
10
13
  export function readPackageJson(dir) {
11
14
  const file = path.join(dir, "package.json");
@@ -20,3 +23,61 @@ export function readPackageJson(dir) {
20
23
  }
21
24
  return { ok: true, pkg: parsed.value };
22
25
  }
26
+ /** Every dependency name across the four `package.json` dependency fields; `[]` when unreadable. */
27
+ export function readDependencyNames(cwd) {
28
+ const read = readPackageJson(cwd);
29
+ if (!read.ok)
30
+ return [];
31
+ const names = [];
32
+ for (const field of [
33
+ "dependencies",
34
+ "devDependencies",
35
+ "optionalDependencies",
36
+ "peerDependencies",
37
+ ]) {
38
+ const deps = read.pkg[field];
39
+ if (deps && typeof deps === "object") {
40
+ names.push(...Object.keys(deps));
41
+ }
42
+ }
43
+ return names;
44
+ }
45
+ /**
46
+ * The spec `package.json` declares for dependency `name` (`"^5.2.0"`, `"file:../x.tgz"`, …),
47
+ * from `dependencies`, `devDependencies` or `optionalDependencies`; `null` when undeclared or
48
+ * the file is unreadable.
49
+ */
50
+ export function readDependencySpec(cwd, name) {
51
+ const read = readPackageJson(cwd);
52
+ if (!read.ok)
53
+ return null;
54
+ for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
55
+ const deps = read.pkg[field];
56
+ if (deps && typeof deps === "object") {
57
+ const spec = deps[name];
58
+ if (typeof spec === "string")
59
+ return spec;
60
+ }
61
+ }
62
+ return null;
63
+ }
64
+ /**
65
+ * The version of the bkit package doing the install, read from that package's own
66
+ * `package.json` (`root` defaults to the package root; never the consumer's file).
67
+ * Throws when the file is missing, is not a JSON object, or has no non-empty string
68
+ * `version`: the value is stamped into every managed file and the `.bkit/version` pin,
69
+ * so a damaged package stops the command instead of writing a guessed version.
70
+ */
71
+ export function readInstallingVersion(root = getPkgRoot()) {
72
+ const file = path.join(root, "package.json");
73
+ const read = readPackageJson(root);
74
+ if (!read.ok) {
75
+ const state = read.reason === "missing" ? "is missing" : "is not a JSON object";
76
+ throw new Error(`bkit's own package.json ${state} (${file}); reinstall @cbartens/bkit.`);
77
+ }
78
+ const version = read.pkg["version"];
79
+ if (typeof version !== "string" || version === "") {
80
+ throw new Error(`bkit's own package.json has no string "version" (${file}); reinstall @cbartens/bkit.`);
81
+ }
82
+ return version;
83
+ }
@@ -132,11 +132,3 @@ export function getHooksRoot() {
132
132
  export function getBkitDocsRoot() {
133
133
  return path.join(getCoreRoot(), ".bkit");
134
134
  }
135
- // ---------------------------------------------------------------------------
136
- // isDogfood — true when bkit is running inside its own repo (in-repo install).
137
- // In this case the source tree IS the consumer's .agents/ directory, so any
138
- // payload copy would overwrite the source with itself.
139
- // ---------------------------------------------------------------------------
140
- export function isDogfood() {
141
- return getPkgRoot() === process.cwd();
142
- }
@@ -1,19 +1,12 @@
1
- // shared/protected-paths.ts — single protected-path table shared by the compliance
2
- // grader (`commands/comply.ts`) and the committed generated hook
3
- // (`.claude/hooks/gate-paths.generated.cjs`).
1
+ // shared/protected-paths.ts — the table of bkit-managed IDE mirror directories, used by the
2
+ // compliance grader (`commands/comply.ts`).
4
3
  //
5
4
  // RULES:
6
- // - This file is the ONE source of truth for protected path definitions.
7
- // - The `.cjs` is generated from this table and committed; a drift test
8
- // (`shared/protected-paths.test.ts`) fails if the committed file diverges.
9
- // - The `.cjs` lives in bkit's own repo only; install never writes it. The
10
- // generation step is a manual bkit-dev tool (`generateGatePathsCjs()`).
5
+ // - This file is the ONE source of truth for mirror path definitions.
6
+ // - The gate-config list (quality-gate config basenames) lives only in
7
+ // `.bkit/core/hooks/gateguard-engine.js`, which every host's `bkit-gateguard` hook inlines.
11
8
  // - Never import install-tier logic from here (keeps grader crash-isolated from
12
9
  // the consumer-mutating install path — see DE-34).
13
- import * as fs from "node:fs";
14
- import * as path from "node:path";
15
- import { fileURLToPath } from "node:url";
16
- import { isDogfood, TEMPLATE_COPIES_DIR } from "./package-roots.js";
17
10
  // ---------------------------------------------------------------------------
18
11
  // Mirror-path patterns (bkit-managed IDE mirrors)
19
12
  // ---------------------------------------------------------------------------
@@ -41,113 +34,3 @@ export const MIRROR_PATH_PREFIXES = [
41
34
  export function isMirrorPath(posixPath) {
42
35
  return MIRROR_PATH_PREFIXES.some((prefix) => posixPath.startsWith(prefix));
43
36
  }
44
- // ---------------------------------------------------------------------------
45
- // Gate-config basename patterns (quality-gate configs)
46
- // ---------------------------------------------------------------------------
47
- /**
48
- * Basename patterns for quality-gate configs (lint / format / types / test / slop).
49
- * Mirrors `GATE_CONFIG_PATTERNS` in `bkit-gateguard.cjs` — kept in sync via the
50
- * generated `.cjs` drift test. Editing these configs to silence a gate is the
51
- * "weaken-the-gate" anti-pattern; prefer targeted per-file opt-outs.
52
- */
53
- export const GATE_CONFIG_PATTERNS = [
54
- /^tsconfig(\..+)?\.json$/,
55
- /^vitest\.config\.[mc]?[jt]s$/,
56
- /^vite\.config\.[mc]?[jt]s$/,
57
- /^eslint\.config\.[mc]?[jt]s$/,
58
- /^\.eslintrc(\.(json|js|cjs|ya?ml))?$/,
59
- /^\.prettierrc(\.(json|js|cjs|mjs|ya?ml|toml))?$/,
60
- /^prettier\.config\.[mc]?js$/,
61
- /^\.prettierignore$/,
62
- /^biome\.jsonc?$/,
63
- /^\.vale\.ini$/,
64
- /^slop-scan\.config\.json$/,
65
- /^\.lintstagedrc(\.(json|js|cjs|mjs|ya?ml))?$/,
66
- /^lint-staged\.config\.[mc]?js$/,
67
- ];
68
- /**
69
- * POSIX prefix of the consumer's template copies (`shared/package-roots.ts` TEMPLATE_COPIES_DIR).
70
- * Those are bkit's reference copies, refreshed on every upgrade, not the repo's gate config.
71
- */
72
- export const TEMPLATE_COPIES_PREFIX = TEMPLATE_COPIES_DIR.split(path.sep).join("/") + "/";
73
- /**
74
- * Returns true if the file basename matches any gate-config pattern. In a consumer repo a
75
- * path under `.bkit/templates/` never is one; in bkit's own repo (`dogfood`) that folder is
76
- * the template source, so it stays guarded.
77
- */
78
- export function isGateConfig(posixPath, dogfood = isDogfood()) {
79
- const inTemplateCopies = posixPath.startsWith(TEMPLATE_COPIES_PREFIX) ||
80
- posixPath.includes("/" + TEMPLATE_COPIES_PREFIX);
81
- if (inTemplateCopies && !dogfood)
82
- return false;
83
- const base = posixPath.split("/").pop() ?? posixPath;
84
- return GATE_CONFIG_PATTERNS.some((re) => re.test(base));
85
- }
86
- // ---------------------------------------------------------------------------
87
- // Code generator — emits the committed `.cjs` from this table.
88
- // Run manually by a bkit developer: `ts-node .bkit/core/engine/shared/protected-paths.ts`
89
- // The output must be committed to `.claude/hooks/gate-paths.generated.cjs`.
90
- // ---------------------------------------------------------------------------
91
- /**
92
- * Generate the content of `.claude/hooks/gate-paths.generated.cjs`.
93
- * This is the single committed snapshot derived from the tables above.
94
- */
95
- export function generateGatePathsCjs() {
96
- const mirrorLines = MIRROR_PATH_PREFIXES.map((p) => ` ${JSON.stringify(p)},`).join("\n");
97
- const gateLines = GATE_CONFIG_PATTERNS.map((re) => ` ${re.toString()},`).join("\n");
98
- return `// gate-paths.generated.cjs — AUTO-GENERATED from .bkit/core/engine/shared/protected-paths.ts
99
- // DO NOT EDIT BY HAND — regenerate via \`generateGatePathsCjs()\` then commit.
100
- // Drift is detected by .bkit/core/engine/shared/protected-paths.test.ts (Vitest).
101
- "use strict";
102
-
103
- /** Prefixes for bkit-managed IDE mirror directories. */
104
- const MIRROR_PATH_PREFIXES = [
105
- ${mirrorLines}
106
- ];
107
-
108
- /** Returns true if the POSIX path is inside a bkit-managed mirror directory. */
109
- function isMirrorPath(posixPath) {
110
- return MIRROR_PATH_PREFIXES.some((prefix) => posixPath.startsWith(prefix));
111
- }
112
-
113
- /** Basename patterns for quality-gate configs. */
114
- const GATE_CONFIG_PATTERNS = [
115
- ${gateLines}
116
- ];
117
-
118
- /** The consumer's template copies — reference copies, not the repo's gate config. */
119
- const TEMPLATE_COPIES_PREFIX = ${JSON.stringify(TEMPLATE_COPIES_PREFIX)};
120
-
121
- /**
122
- * Returns true if the file basename matches any gate-config pattern. Pass \`dogfood\` = true
123
- * in bkit's own repo, where \`.bkit/templates/\` is the template source and stays guarded.
124
- */
125
- function isGateConfig(posixPath, dogfood) {
126
- const inTemplateCopies =
127
- posixPath.startsWith(TEMPLATE_COPIES_PREFIX) || posixPath.includes("/" + TEMPLATE_COPIES_PREFIX);
128
- if (inTemplateCopies && !dogfood) return false;
129
- const base = posixPath.split("/").pop() || posixPath;
130
- return GATE_CONFIG_PATTERNS.some((re) => re.test(base));
131
- }
132
-
133
- module.exports = {
134
- MIRROR_PATH_PREFIXES,
135
- isMirrorPath,
136
- GATE_CONFIG_PATTERNS,
137
- TEMPLATE_COPIES_PREFIX,
138
- isGateConfig,
139
- };
140
- `;
141
- }
142
- // CLI: `node dist/shared/protected-paths.js` prints the generated content to stdout.
143
- // This file compiles to ESM, so use import.meta.url for main-module detection.
144
- if (process.argv[1]) {
145
- try {
146
- if (fs.realpathSync(fileURLToPath(import.meta.url)) === fs.realpathSync(process.argv[1])) {
147
- process.stdout.write(generateGatePathsCjs());
148
- }
149
- }
150
- catch (_e) {
151
- void _e; // realpathSync can fail on non-existent paths — skip silently
152
- }
153
- }
@@ -2,7 +2,8 @@
2
2
  //
3
3
  // One reader, one set of defaults, so no command hard-codes a CI workflow name,
4
4
  // a check name, or an app folder.
5
- import { DEFAULT_ISSUE_TRACKER, parseIssueTracker, } from "../install/manifest.js";
5
+ import { DEFAULT_CLOUD_AGENTS, DEFAULT_ISSUE_TRACKER, parseCloudAgents, parseIssueTracker, } from "../install/manifest.js";
6
+ import { isOpencodeProvider } from "../render/models.js";
6
7
  import { readPackageJson } from "./package-json.js";
7
8
  export const CONFIG_DEFAULTS = {
8
9
  ciWorkflow: "bkit-ci.yml",
@@ -12,6 +13,12 @@ export const CONFIG_DEFAULTS = {
12
13
  issueTracker: DEFAULT_ISSUE_TRACKER,
13
14
  githubProject: null,
14
15
  shipGateRequiredLanes: [],
16
+ opencodeProvider: null,
17
+ opencodeProviders: [],
18
+ cloudAgents: DEFAULT_CLOUD_AGENTS,
19
+ depUpdaterOptOut: false,
20
+ issueTrackerExplicit: false,
21
+ cloudAgentsExplicit: false,
15
22
  };
16
23
  const nonEmptyString = (v) => typeof v === "string" && v.trim() !== "";
17
24
  /**
@@ -26,6 +33,8 @@ export function readBkitConfig(root) {
26
33
  const copy = worktree.copy;
27
34
  const project = bkit.githubProject;
28
35
  const lanes = bkit.shipGateRequiredLanes;
36
+ const provider = bkit.opencodeProvider;
37
+ const providers = bkit.opencodeProviders;
29
38
  return {
30
39
  ciWorkflow: nonEmptyString(bkit.ciWorkflow) ? bkit.ciWorkflow : CONFIG_DEFAULTS.ciWorkflow,
31
40
  capstoneJob: nonEmptyString(bkit.capstoneJob) ? bkit.capstoneJob : CONFIG_DEFAULTS.capstoneJob,
@@ -40,5 +49,13 @@ export function readBkitConfig(root) {
40
49
  ? project
41
50
  : null,
42
51
  shipGateRequiredLanes: Array.isArray(lanes) ? lanes.filter(nonEmptyString) : [],
52
+ opencodeProvider: typeof provider === "string" && isOpencodeProvider(provider) ? provider : null,
53
+ opencodeProviders: Array.isArray(providers)
54
+ ? providers.filter((v) => typeof v === "string" && isOpencodeProvider(v))
55
+ : [],
56
+ cloudAgents: parseCloudAgents(bkit.cloudAgents) ?? CONFIG_DEFAULTS.cloudAgents,
57
+ depUpdaterOptOut: bkit.depUpdater === "none",
58
+ issueTrackerExplicit: bkit.issueTracker !== undefined,
59
+ cloudAgentsExplicit: bkit.cloudAgents !== undefined,
43
60
  };
44
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cbartens/bkit",
3
- "version": "5.2.4",
3
+ "version": "5.3.0",
4
4
  "private": false,
5
5
  "description": "From vibe coding to production code. A senior engineering team's process, ready-made: AI agents design, plan, build, review, fix and ship your features on Claude Code, Cursor, Codex, Google Antigravity and opencode.",
6
6
  "keywords": [
@@ -40,9 +40,9 @@
40
40
  "CHANGELOG.md"
41
41
  ],
42
42
  "engines": {
43
- "node": ">=20"
43
+ "node": ">=24"
44
44
  },
45
- "packageManager": "pnpm@10.34.5",
45
+ "packageManager": "pnpm@10.34.6",
46
46
  "repository": {
47
47
  "type": "git",
48
48
  "url": "https://github.com/cbartens/bkit.git"
@@ -63,7 +63,7 @@
63
63
  "bkit": "node dist/cli.js",
64
64
  "typecheck": "tsc --noEmit && pnpm bkit:typecheck:tests",
65
65
  "bkit:typecheck:tests": "tsc -p tsconfig.test.json",
66
- "lint": "bash -c 'if [ -f eslint.config.js ] || [ -f eslint.config.mjs ] || [ -f .eslintrc.json ]; then npx eslint .; else echo \"[bkit] no eslint config - skipping lint (bkit typechecks with tsc and scans with slop-scan)\"; fi'",
66
+ "lint": "oxlint -c .oxlintrc.json --type-aware --tsconfig tsconfig.test.json --deny-warnings .bkit/core/engine",
67
67
  "format": "prettier --write .",
68
68
  "format:check": "prettier --check .",
69
69
  "format:tables": "node scripts/prettier/bkit-insert-ignore.mjs .agents docs README.md .bkit/shared .bkit/core/.agents .bkit/core/docs",
@@ -73,14 +73,15 @@
73
73
  "slop:delta": "bkit ci slop",
74
74
  "bkit:lint:workflows": "bash -c 'if command -v actionlint >/dev/null 2>&1; then actionlint; else echo \"[bkit] actionlint missing — skipping workflow lint (install actionlint to enable)\"; fi'",
75
75
  "test": "vitest run",
76
- "test:coverage:unit": "vitest run --coverage --coverage.reportsDirectory=coverage/unit --exclude '**/*.integration.test.ts' --coverage.include='.bkit/core/engine/{cli,commands/analysis,install/cloud-env,commands/comply,commands/harvest,commands/install/install,commands/launch,install/manifest,install/managed-block,shared/package-roots,shared/protected-paths,checks/after/index,checks/after/auth,checks/after/ci-yml,checks/after/github,checks/after/managed,checks/after/tools,checks/after/suppression,checks/before/index,checks/before/context-fetch,checks/before/env,checks/before/files,checks/before/mcp,checks/before/repo,checks/before/version,ledgers/status,ledgers/telemetry,install/write,install/placeholders,install/template-copies,render/trackers,render/hosts,render/models,commands/install/uninstall,commands/install/upgrade,install/version-file,tools/wording}.ts' --coverage.include='.bkit/core/engine/commands/**/*.ts' --coverage.include='.bkit/core/engine/shared/{settings,package-json,package-manager,timeouts}.ts' --coverage.thresholds.branches=70",
77
- "bkit:test:bats": "bash -c 'if command -v bats >/dev/null 2>&1; then bats tests/*.bats; else echo \"[bkit] bats missing - skipping bats suite (install bats to enable)\" >&2; fi'",
76
+ "test:coverage:unit": "vitest run -c vitest.unit.config.ts --coverage --coverage.reportsDirectory=coverage/unit --exclude '**/*.integration.test.ts' --coverage.include='.bkit/core/engine/{cli,commands/analysis,install/cloud-env,commands/comply,commands/harvest,commands/install/install,commands/launch,install/manifest,install/managed-block,shared/package-roots,shared/protected-paths,checks/after/index,checks/after/auth,checks/after/ci-yml,checks/after/github,checks/after/managed,checks/after/tools,checks/after/suppression,checks/before/index,checks/before/context-fetch,checks/before/env,checks/before/files,checks/before/mcp,checks/before/repo,checks/before/version,ledgers/status,ledgers/telemetry,install/write,install/placeholders,install/template-copies,render/trackers,render/hosts,render/models,commands/install/uninstall,commands/install/upgrade,install/version-file,tools/wording}.ts' --coverage.include='.bkit/core/engine/commands/**/*.ts' --coverage.include='.bkit/core/engine/shared/{settings,package-json,package-manager,timeouts}.ts'",
77
+ "bkit:test:bats": "pnpm exec bats tests/*.bats",
78
78
  "build": "tsc && chmod +x dist/cli.js",
79
79
  "bkit:check:dist": "rm -rf dist && tsc && chmod +x dist/cli.js && git diff --exit-code dist/ || (echo '[bkit] dist/ is stale — run pnpm build and commit the result' && exit 1)",
80
80
  "graph": "bash scripts/graphify/bkit-graphify.sh build",
81
81
  "graph:check": "bash scripts/graphify/bkit-graphify.sh check",
82
82
  "graph:clean": "bash scripts/graphify/bkit-graphify.sh clean",
83
83
  "graph:graphml": "bash scripts/graphify/bkit-graphify.sh graphml",
84
+ "graph:refresh": "bash scripts/graphify/bkit-graphify.sh refresh",
84
85
  "graph:rollup": "bash scripts/graphify/bkit-graphify.sh rollup",
85
86
  "graph:scoped": "bash scripts/graphify/bkit-graphify.sh scoped",
86
87
  "graph:tree": "bash scripts/graphify/bkit-graphify.sh tree",
@@ -90,18 +91,21 @@
90
91
  "prepare": "husky"
91
92
  },
92
93
  "devDependencies": {
93
- "@types/node": "^24.0.0",
94
- "@vitest/coverage-v8": "^4.1.7",
94
+ "@types/node": "24.19.2",
95
+ "@vitest/coverage-v8": "5.0.3",
96
+ "bats": "1.13.0",
95
97
  "bkit": "link:.",
96
- "husky": "^9.1.7",
97
- "lint-staged": "^17.0.0",
98
- "prettier": "^3.5.3",
99
- "slop-scan": "^0.3.0",
100
- "tsx": "^4.19.2",
101
- "typescript": "^7.0.0",
102
- "vite": "^6.4.2",
103
- "vitest": "^4.1.7",
104
- "yaml": "^2.9.1"
98
+ "husky": "9.1.7",
99
+ "lint-staged": "17.6.0",
100
+ "oxlint": "1.87.0",
101
+ "oxlint-tsgolint": "7.0.2004",
102
+ "prettier": "3.9.10",
103
+ "slop-scan": "0.3.0",
104
+ "tsx": "4.23.15",
105
+ "typescript": "7.0.2",
106
+ "vite": "6.4.4",
107
+ "vitest": "5.0.3",
108
+ "yaml": "2.9.1"
105
109
  },
106
110
  "pnpm": {
107
111
  "overrides": {
@@ -1,73 +0,0 @@
1
- <!-- bkit:start -->
2
-
3
- {{BKIT_MANAGED_MARKER}}
4
-
5
- # Shortcuts
6
-
7
- > [!CAUTION]
8
- > **Purpose:** Opt-in prompts that run a phase's steps and subagents without the full workflow's ceremony. The full workflow is the default.
9
- >
10
- > **Rules:**
11
- >
12
- > - All `.agents/rules.md` rules still apply. Fewer steps, never fewer rules.
13
- > - The named reference is **inspiration, not a command file**: read it for its steps and subagents, take what fits, drop the rest.
14
- > - Assume the right repo and branch are already checked out; do not re-detect them.
15
- > - Local project shortcuts → `Project Shortcuts` below the bkit-managed block.
16
-
17
- ## When to use
18
-
19
- Full workflow when in doubt; a lite flow only when it is clearly enough. These are opt-in at your own judgement — they skip the gates, worktree isolation, PR, CI and audit trail, so they suit users who know what they are trading away. Add whichever full-phase step or subagent the work needs; go full when the cost of being wrong is high — irreversible changes (releases, data), blast radius past one small change, security / secrets / PII.
20
-
21
- NEVER shortcut: schema / migrations, public API, dependencies, secrets / config, auth / security, large multi-file refactors.
22
-
23
- ## Contract
24
-
25
- Read `.agents/rules.md`. Work on the current branch; commit as you go; push only when shipping or when asked. Tracker-wired: issue → **In progress** at start, **In review** at end, one short comment per step. No tracker: skip the tracker lines.
26
-
27
- ## Paste
28
-
29
- Copy one block, then insert the issue or instructions at the bracketed line.
30
-
31
- ### design
32
-
33
- ```text
34
- Handle the issue below as a design. Read `.bkit/workflows.md` § Per-Phase Workflows and `.bkit/prompts.md` as inspiration only — use the steps and subagents that fit, skip the rest. Follow `.agents/shortcuts.md` § Contract.
35
-
36
- [INSERT ISSUE ID / INSTRUCTIONS]
37
- ```
38
-
39
- ### plan
40
-
41
- ```text
42
- Handle the issue below as a plan. Read `.bkit/workflows.md` § Per-Phase Workflows and `.bkit/prompts.md` as inspiration only — use the steps and subagents that fit, skip the rest. Follow `.agents/shortcuts.md` § Contract.
43
-
44
- [INSERT ISSUE ID / INSTRUCTIONS]
45
- ```
46
-
47
- ### build
48
-
49
- ```text
50
- Handle the issue below as a build. Read `.bkit/workflows.md` § Per-Phase Workflows and `.bkit/prompts.md` as inspiration only — use the steps and subagents that fit, skip the rest. Follow `.agents/shortcuts.md` § Contract.
51
-
52
- [INSERT ISSUE ID / INSTRUCTIONS]
53
- ```
54
-
55
- ### debug
56
-
57
- ```text
58
- Handle the issue below as a debug. Read `.bkit/workflows.md` § Per-Phase Workflows and `.bkit/prompts.md` as inspiration only — use the steps and subagents that fit, skip the rest. Follow `.agents/shortcuts.md` § Contract.
59
-
60
- [INSERT ISSUE ID / INSTRUCTIONS]
61
- ```
62
-
63
- ### ship
64
-
65
- ```text
66
- Handle the issue below as a ship. Read `.bkit/workflows.md` § Per-Phase Workflows and `.bkit/prompts.md` as inspiration only — use the steps and subagents that fit, skip the rest. Follow `.agents/shortcuts.md` § Contract.
67
-
68
- [INSERT ISSUE ID / INSTRUCTIONS]
69
- ```
70
-
71
- <!-- bkit:end -->
72
-
73
- ## Project Shortcuts