@cbartens/bkit 5.1.0 → 5.2.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 (194) hide show
  1. package/.bkit/README.md +11 -7
  2. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-gateguard.cjs +39 -50
  3. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +74 -56
  4. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-readguard.cjs +72 -0
  5. package/.bkit/core/.agents/rules.md +8 -4
  6. package/.bkit/core/.agents/shortcuts.md +1 -1
  7. package/.bkit/core/.bkit/LICENSE.md +18 -140
  8. package/.bkit/core/.bkit/README.md +10 -6
  9. package/.bkit/core/.bkit/cloud.md +12 -15
  10. package/.bkit/core/.bkit/comparison.md +66 -14
  11. package/.bkit/core/.bkit/install.md +31 -8
  12. package/.bkit/core/.bkit/jsonl.md +0 -1
  13. package/.bkit/core/.bkit/prompts.md +14 -13
  14. package/.bkit/core/.bkit/providers.md +90 -26
  15. package/.bkit/core/.bkit/templates.md +38 -11
  16. package/.bkit/core/.bkit/workflows.md +63 -41
  17. package/.bkit/core/.claude/hooks/bkit-gateguard.cjs +4 -3
  18. package/.bkit/core/.claude/hooks/bkit-readguard.cjs +60 -0
  19. package/.bkit/core/.codex/hooks/bkit-gateguard.cjs +8 -6
  20. package/.bkit/core/.codex/hooks/bkit-readguard.cjs +58 -0
  21. package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +12 -19
  22. package/.bkit/core/.cursor/hooks/bkit-readguard.cjs +59 -0
  23. package/.bkit/core/.opencode/plugin/bkit-gateguard.js +73 -22
  24. package/.bkit/core/.opencode/plugin/bkit-readguard.js +126 -0
  25. package/.bkit/core/docs/templates/bkit-audit-adoption.md +2 -2
  26. package/.bkit/core/docs/templates/bkit-plan.md +6 -3
  27. package/.bkit/core/engine/checks/after/auth.ts +32 -0
  28. package/.bkit/core/engine/checks/after/github.ts +4 -4
  29. package/.bkit/core/engine/checks/after/index.ts +36 -50
  30. package/.bkit/core/engine/checks/after/managed.ts +40 -0
  31. package/.bkit/core/engine/checks/before/index.ts +5 -4
  32. package/.bkit/core/engine/checks/before/mcp.ts +60 -54
  33. package/.bkit/core/engine/checks/status-holes.ts +1 -1
  34. package/.bkit/core/engine/checks/tips/catalogue.ts +356 -0
  35. package/.bkit/core/engine/checks/tips/detect.ts +144 -0
  36. package/.bkit/core/engine/checks/tips/index.ts +174 -0
  37. package/.bkit/core/engine/cli.ts +57 -9
  38. package/.bkit/core/engine/commands/install/doctor.ts +5 -1
  39. package/.bkit/core/engine/commands/install/install.ts +39 -9
  40. package/.bkit/core/engine/commands/install/uninstall.ts +32 -18
  41. package/.bkit/core/engine/commands/install/upgrade.ts +15 -28
  42. package/.bkit/core/engine/commands/launch.ts +33 -11
  43. package/.bkit/core/engine/commands/tips.ts +16 -0
  44. package/.bkit/core/engine/commands/workflow/runs.ts +57 -16
  45. package/.bkit/core/engine/commands/workflow/runtime.ts +12 -0
  46. package/.bkit/core/engine/commands/workflow/steps.ts +1 -0
  47. package/.bkit/core/engine/commands/workflow/tests.ts +647 -4
  48. package/.bkit/core/engine/commands/workflow/workstreams.ts +4 -4
  49. package/.bkit/core/engine/install/cloud-env.ts +7 -21
  50. package/.bkit/core/engine/install/hosts.ts +21 -0
  51. package/.bkit/core/engine/install/managed-block.ts +36 -0
  52. package/.bkit/core/engine/install/manifest.ts +46 -4
  53. package/.bkit/core/engine/install/modules/antigravity.ts +8 -7
  54. package/.bkit/core/engine/install/modules/claude.ts +6 -6
  55. package/.bkit/core/engine/install/modules/cloud.ts +2 -2
  56. package/.bkit/core/engine/install/modules/codex.ts +5 -5
  57. package/.bkit/core/engine/install/modules/core.ts +23 -9
  58. package/.bkit/core/engine/install/modules/cursor.ts +6 -6
  59. package/.bkit/core/engine/install/modules/opencode.ts +4 -4
  60. package/.bkit/core/engine/install/payload-links.ts +6 -10
  61. package/.bkit/core/engine/install/placeholders.ts +1 -1
  62. package/.bkit/core/engine/install/version-file.ts +17 -9
  63. package/.bkit/core/engine/install/write.ts +68 -1
  64. package/.bkit/core/engine/ledgers/telemetry.ts +0 -2
  65. package/.bkit/core/engine/shared/package-roots.ts +8 -10
  66. package/.bkit/core/hooks/antigravity-hook.js +67 -0
  67. package/.bkit/core/hooks/gateguard-edit-payload.js +4 -4
  68. package/.bkit/core/hooks/gateguard-engine.js +16 -6
  69. package/.bkit/core/hooks/guardrails-read.js +23 -0
  70. package/.bkit/core/hooks/readguard-engine.js +259 -0
  71. package/.bkit/core/hooks/readguard-payload.js +67 -0
  72. package/.bkit/core/prompts/bkit-audit-generate.md +1 -0
  73. package/.bkit/core/prompts/bkit-build-challenge-1.md +1 -0
  74. package/.bkit/core/prompts/bkit-build-challenge-2.md +1 -0
  75. package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +1 -0
  76. package/.bkit/core/prompts/bkit-build-challenge-remediate.md +1 -0
  77. package/.bkit/core/prompts/bkit-build-challenge-tests.md +1 -0
  78. package/.bkit/core/prompts/bkit-build-install-skills.md +1 -0
  79. package/.bkit/core/prompts/bkit-build-plan-current.md +1 -0
  80. package/.bkit/core/prompts/bkit-build-plan-execute.md +5 -1
  81. package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +1 -0
  82. package/.bkit/core/prompts/bkit-build-plan-verify.md +11 -3
  83. package/.bkit/core/prompts/bkit-build-summary.md +1 -0
  84. package/.bkit/core/prompts/bkit-debug-abort-handover.md +1 -0
  85. package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +1 -0
  86. package/.bkit/core/prompts/bkit-debug-failure-remediate.md +1 -0
  87. package/.bkit/core/prompts/bkit-debug-failure-soak.md +1 -0
  88. package/.bkit/core/prompts/bkit-debug-summary.md +1 -0
  89. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +1 -0
  90. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +1 -0
  91. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +1 -0
  92. package/.bkit/core/prompts/bkit-design-generate.md +9 -4
  93. package/.bkit/core/prompts/bkit-design-organise.md +1 -0
  94. package/.bkit/core/prompts/bkit-design-review-1.md +1 -0
  95. package/.bkit/core/prompts/bkit-design-review-2.md +1 -0
  96. package/.bkit/core/prompts/bkit-design-spike.md +1 -0
  97. package/.bkit/core/prompts/bkit-design-summary.md +1 -0
  98. package/.bkit/core/prompts/bkit-design-update.md +1 -0
  99. package/.bkit/core/prompts/bkit-plan-complexity-check.md +1 -0
  100. package/.bkit/core/prompts/bkit-plan-complexity-split.md +3 -2
  101. package/.bkit/core/prompts/bkit-plan-generate.md +1 -0
  102. package/.bkit/core/prompts/bkit-plan-review-1.md +1 -0
  103. package/.bkit/core/prompts/bkit-plan-review-2.md +1 -0
  104. package/.bkit/core/prompts/bkit-plan-review-3.md +1 -0
  105. package/.bkit/core/prompts/bkit-plan-scope-check-1.md +2 -1
  106. package/.bkit/core/prompts/bkit-plan-scope-check-2.md +2 -1
  107. package/.bkit/core/prompts/bkit-plan-summary.md +1 -0
  108. package/.bkit/core/prompts/bkit-plan-update.md +2 -1
  109. package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +1 -0
  110. package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +1 -0
  111. package/.bkit/core/prompts/bkit-ship-summary.md +1 -0
  112. package/.bkit/core/prompts/bkit-ship-update-docs.md +1 -0
  113. package/.bkit/core/prompts/bkit-utility-compress-markdown.md +1 -0
  114. package/.bkit/core/prompts/bkit-utility-update-decisions.md +1 -0
  115. package/.bkit/core/prompts/bkit-utility-update-deferrals.md +1 -0
  116. package/.bkit/core/prompts/bkit-utility-update-documentation.md +1 -0
  117. package/.bkit/core/prompts/bkit-utility-update-failures.md +1 -0
  118. package/.bkit/core/prompts/bkit-utility-update-knowledge.md +1 -0
  119. package/.bkit/core/prompts/bkit-utility-update-roadmap.md +1 -0
  120. package/.bkit/core/workflows/bkit-build.md +33 -21
  121. package/.bkit/core/workflows/bkit-debug.md +29 -22
  122. package/.bkit/core/workflows/bkit-design.md +81 -38
  123. package/.bkit/core/workflows/bkit-plan.md +8 -2
  124. package/.bkit/core/workflows/bkit-ship.md +8 -2
  125. package/.bkit/shared/.agents/plugins/bkit/hooks.json +13 -3
  126. package/.bkit/shared/.claude/settings.json +19 -0
  127. package/.bkit/shared/.codex/hooks.json +21 -0
  128. package/.bkit/shared/.cursor/hooks.json +6 -1
  129. package/.bkit/shared/.opencode/opencode.json +1 -1
  130. package/.bkit/shared/docs/deployments.md +1 -1
  131. package/.bkit/shared/docs/testing.md +12 -1
  132. package/.bkit/templates/.github/dependabot.yml +6 -0
  133. package/.bkit/templates/.github/renovate.json5 +3 -3
  134. package/.bkit/templates/.github/workflows/bkit-ci.yml +0 -13
  135. package/.bkit/templates/.github/workflows/bkit-cloud.yml +5 -5
  136. package/.bkit/templates/.prettierignore +1 -1
  137. package/.bkit/templates/context/bkit-expo.md +22 -13
  138. package/.bkit/templates/context/bkit-github.md +20 -6
  139. package/.bkit/templates/context/bkit-inngest.md +10 -4
  140. package/.bkit/templates/context/bkit-maestro.md +5 -5
  141. package/.bkit/templates/context/bkit-playwright.md +3 -3
  142. package/.bkit/templates/context/bkit-sentry.md +6 -5
  143. package/.bkit/templates/context/bkit-stripe.md +31 -8
  144. package/.bkit/templates/scripts/ci/check-accepted-divergences.mjs +65 -19
  145. package/.bkit/templates/scripts/ci/check-accepted-divergences.test.mjs +34 -0
  146. package/.bkit/templates/scripts/ci/lanes/resolve-push-base.mjs +33 -12
  147. package/.bkit/templates/scripts/ci/lanes/resolve-push-base.test.mjs +54 -0
  148. package/.bkit/templates/scripts/launchd/bkit-launchd-env.sh +76 -6
  149. package/.bkit/templates/slop-scan.config.json +7 -2
  150. package/CHANGELOG.md +42 -0
  151. package/LICENSE.md +21 -161
  152. package/README.md +58 -28
  153. package/dist/checks/after/auth.js +28 -0
  154. package/dist/checks/after/github.js +4 -4
  155. package/dist/checks/after/index.js +29 -45
  156. package/dist/checks/after/managed.js +40 -1
  157. package/dist/checks/before/index.js +5 -4
  158. package/dist/checks/before/mcp.js +53 -53
  159. package/dist/checks/status-holes.js +1 -1
  160. package/dist/checks/tips/catalogue.js +297 -0
  161. package/dist/checks/tips/detect.js +130 -0
  162. package/dist/checks/tips/index.js +146 -0
  163. package/dist/cli.js +47 -9
  164. package/dist/commands/install/doctor.js +5 -1
  165. package/dist/commands/install/install.js +27 -7
  166. package/dist/commands/install/uninstall.js +31 -16
  167. package/dist/commands/install/upgrade.js +15 -32
  168. package/dist/commands/launch.js +27 -11
  169. package/dist/commands/tips.js +10 -0
  170. package/dist/commands/workflow/runs.js +52 -16
  171. package/dist/commands/workflow/runtime.js +8 -0
  172. package/dist/commands/workflow/steps.js +1 -0
  173. package/dist/commands/workflow/tests.js +541 -4
  174. package/dist/commands/workflow/workstreams.js +4 -4
  175. package/dist/install/cloud-env.js +3 -14
  176. package/dist/install/hosts.js +22 -0
  177. package/dist/install/managed-block.js +36 -0
  178. package/dist/install/manifest.js +45 -4
  179. package/dist/install/modules/antigravity.js +8 -7
  180. package/dist/install/modules/claude.js +6 -6
  181. package/dist/install/modules/cloud.js +2 -2
  182. package/dist/install/modules/codex.js +5 -5
  183. package/dist/install/modules/core.js +14 -5
  184. package/dist/install/modules/cursor.js +6 -6
  185. package/dist/install/modules/opencode.js +4 -4
  186. package/dist/install/payload-links.js +5 -5
  187. package/dist/install/placeholders.js +1 -1
  188. package/dist/install/version-file.js +12 -3
  189. package/dist/install/write.js +61 -2
  190. package/dist/shared/package-roots.js +8 -11
  191. package/package.json +4 -6
  192. package/.bkit/core/LICENSE.md +0 -149
  193. package/.bkit/shared/LICENSE.md +0 -22
  194. package/.bkit/templates/LICENSE.md +0 -22
@@ -82,6 +82,25 @@
82
82
  "command": "test -f .claude/hooks/bkit-guardrails.cjs && node .claude/hooks/bkit-guardrails.cjs || true"
83
83
  }
84
84
  ]
85
+ },
86
+ {
87
+ "matcher": "Read|Bash",
88
+ "hooks": [
89
+ {
90
+ "type": "command",
91
+ "command": "test -f .claude/hooks/bkit-readguard.cjs && node .claude/hooks/bkit-readguard.cjs || true"
92
+ }
93
+ ]
94
+ }
95
+ ],
96
+ "PreCompact": [
97
+ {
98
+ "hooks": [
99
+ {
100
+ "type": "command",
101
+ "command": "test -f .claude/hooks/bkit-readguard.cjs && node .claude/hooks/bkit-readguard.cjs || true"
102
+ }
103
+ ]
85
104
  }
86
105
  ]
87
106
  }
@@ -20,6 +20,27 @@
20
20
  "statusMessage": "bkit guardrails"
21
21
  }
22
22
  ]
23
+ },
24
+ {
25
+ "matcher": "Bash",
26
+ "hooks": [
27
+ {
28
+ "type": "command",
29
+ "command": "test -f .codex/hooks/bkit-readguard.cjs && node .codex/hooks/bkit-readguard.cjs || true",
30
+ "statusMessage": "bkit ReadGuard"
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "PreCompact": [
36
+ {
37
+ "hooks": [
38
+ {
39
+ "type": "command",
40
+ "command": "test -f .codex/hooks/bkit-readguard.cjs && node .codex/hooks/bkit-readguard.cjs || true",
41
+ "statusMessage": "bkit ReadGuard"
42
+ }
43
+ ]
23
44
  }
24
45
  ]
25
46
  }
@@ -20,7 +20,12 @@
20
20
  {
21
21
  "command": "node .cursor/hooks/bkit-gateguard.cjs",
22
22
  "matcher": "Write"
23
+ },
24
+ {
25
+ "command": "node .cursor/hooks/bkit-readguard.cjs",
26
+ "matcher": "Read|Shell"
23
27
  }
24
- ]
28
+ ],
29
+ "preCompact": [{ "command": "node .cursor/hooks/bkit-readguard.cjs" }]
25
30
  }
26
31
  }
@@ -50,7 +50,7 @@
50
50
  "mcp": {
51
51
  "@@OPENCODE_TRACKER_MCP@@": {}
52
52
  },
53
- "plugin": ["./plugin/bkit-gateguard.js"],
53
+ "plugin": ["./plugin/bkit-gateguard.js", "./plugin/bkit-readguard.js"],
54
54
  "provider": {
55
55
  "@@OPENCODE_PROVIDER_KEY@@": {
56
56
  "npm": "@ai-sdk/openai-compatible",
@@ -404,7 +404,7 @@ Platform auth is a repo secret `BKIT_GH_TOKEN`, never `GITHUB_TOKEN` (those PRs
404
404
 
405
405
  `Commit statuses: Read and write` is what opens the PR. Without it Renovate creates the branch and 403s on commit status. There is no separate Checks permission on a fine-grained PAT. Classic equivalent: scopes `repo`, `workflow`, `security_events` (plus `user:email` for commit authorship). Org-owned tokens cannot read the owner email; set the Actions variable `RENOVATE_GIT_AUTHOR` (for example `Renovate Bot <renovate@your-domain>`).
406
406
 
407
- **pnpm 11 on Mend's runner.** A large graph can OOM during `pnpm update --lockfile-only`. The example sets `minimumReleaseAge: "1 day"` and caps `PNPM_WORKERS`. To clear the per-install gate, set `minimumReleaseAge: 0` in `pnpm-workspace.yaml`. Deleting the key does not: pnpm 11 defaults it to 1440. Self-hosted on `ubuntu-latest` has the memory; the freshness setting is still yours to keep or drop.
407
+ **pnpm 11 on Mend's runner.** A large graph can OOM during `pnpm update --lockfile-only`. The example sets `minimumReleaseAge: "7 days"` and caps `PNPM_WORKERS`. To clear the per-install gate, set `minimumReleaseAge: 0` in `pnpm-workspace.yaml`. Deleting the key does not: pnpm 11 defaults it to 1440. Self-hosted on `ubuntu-latest` has the memory; the freshness setting is still yours to keep or drop.
408
408
 
409
409
  **Fence a `pnpm.overrides` pin.** Renovate's lockfile regen does not honor `pnpm.overrides`. An eligible bump rewrites the lock while the override stays, and `pnpm install --frozen-lockfile` fails. Add a `packageRules` entry `{ matchPackageNames: ["<pkg>"], enabled: false }` in `renovate.json5`.
410
410
 
@@ -89,7 +89,7 @@ Scripts these files do not ship, so the plan names them and you write them: mark
89
89
 
90
90
  CI branches on the event in a few places. Each is a deliberate, recorded divergence from "one script runs everywhere" — not an accident. Every such site is registered so a new one is caught.
91
91
 
92
- **The guard.** A step that reads an event field (`github.event_name`, `github.ref`, `github.ref_name`, `github.base_ref`, `github.head_ref`, `github.event.head_commit.message`, `github.event.pull_request.title`) — and, by extension, a script / hook / test that reads `CI` or `GITHUB_*` or takes the pre-push revert path — must be listed in the registry (`scripts/ci/accepted-divergences.json`) with its decision and reason. The guard (`scripts/ci/check-accepted-divergences.mjs`) reds on an unregistered site, on a registered site that no longer exists, and on a decision missing from the table below. A new comparison inside an already-registered step is a new site.
92
+ **The guard.** A workflow step, or the workflow-level `concurrency:` block (keyed `file#(workflow)#concurrency#field`), that reads an event field (`github.event_name`, `github.ref`, `github.ref_name`, `github.base_ref`, `github.head_ref`, `github.event.head_commit.message`, `github.event.pull_request.title`) must be listed in the registry (`scripts/ci/accepted-divergences.json`) with its decision and reason. The guard (`scripts/ci/check-accepted-divergences.mjs`) reds on an unregistered site, on a registered site that no longer exists, and on a decision missing from the table below. A new comparison inside an already-registered step is a new site. The guard scans `.github/workflows/*.yml` only; scripts, hooks and tests that read `CI` / `GITHUB_*` are outside it.
93
93
 
94
94
  <!-- prettier-ignore -->
95
95
  | Decision | Rule |
@@ -247,6 +247,17 @@ Assign every behaviour its **lowest sufficient tier(s)** — the lowest tier tha
247
247
 
248
248
  A plan's `Derived Test Matrix` (`docs/templates/bkit-plan.md`) is the per-feature application of this rubric: one row per behaviour, each mapped to a build + verify task. Boundary rows carry the rigor above — reach the boundary; assert a signal only it can produce; no `as unknown as` at the call-site.
249
249
 
250
+ ## Test first
251
+
252
+ `/bkit-build` writes each task's tests before its code and proves them: each test fails against stubs (red), then passes once the code exists (green). Unit and integration tiers only; E2E and `@live` rows run in CI and stay planned in the `Derived Test Matrix`. Each plan task names its tests on a `**Test first:**` line (`;`-separated), or `n/a — {reason}`.
253
+
254
+ - **Declare `bkit:test:file`:** runs the ONE test file bkit appends as its argument (repo-relative path) and writes a JUnit XML report to the path in `$BKIT_TEST_REPORT`. Vitest: `vitest run --reporter=default --reporter=junit --outputFile.junit="$BKIT_TEST_REPORT"`; pytest: `pytest --junitxml="$BKIT_TEST_REPORT"`; jest needs the `jest-junit` reporter. Undeclared → build reports test-first as not enforced.
255
+ - **Call the runner directly:** a task runner that caches results or runs dependent packages' suites first breaks the one-file contract. A monorepo routes the path to the package and config owning it; an integration file gets the same environment setup the integration suite gets.
256
+ - **Judged by the report, never the exit code:** a misspelled path, a syntax error and an import of unwritten code all exit non-zero like a real failure. A red counts only when the named test ran and failed; green only when it ran and passed.
257
+ - **Stub first:** tests failing because the code they import does not exist never show their assertions failing. Write stubs, then see the assertions fail.
258
+ - **Test name:** as the runner reports it, or its last segment (`clamp > keeps a value inside the range` → `keeps a value inside the range`).
259
+ - **The red test stays:** after the red, the test may gain tests or formatting; a weakened, removed or rewritten assertion fails the build's verify.
260
+
250
261
  ## What each tier must do
251
262
 
252
263
  Tier-by-tier rules: **do** the rule, avoid the **Not** (the failure it prevents). Stack tools (Vitest / Playwright / a Supabase-style local stack / a Vercel-style preview) appear only as worked examples, because the rule is the principle; implement it for your stack.
@@ -23,6 +23,10 @@ updates:
23
23
  schedule:
24
24
  interval: weekly
25
25
  open-pull-requests-limit: 10
26
+ # Hold a release this many days before opening its PR, so a bad publish is
27
+ # pulled before it reaches the queue. Security updates skip the cooldown.
28
+ cooldown:
29
+ default-days: 7
26
30
  commit-message:
27
31
  prefix: "chore(deps)"
28
32
  include: scope
@@ -40,6 +44,8 @@ updates:
40
44
  # schedule:
41
45
  # interval: weekly
42
46
  # open-pull-requests-limit: 10
47
+ # cooldown:
48
+ # default-days: 7
43
49
  # commit-message:
44
50
  # prefix: "chore(deps)"
45
51
  # prefix-development: "chore(deps-dev)"
@@ -54,17 +54,17 @@
54
54
  // and local installs are untouched. PNPM_WORKERS / PNPM_MAX_WORKERS are on
55
55
  // Mend's `global:safeEnv` allow-list, so no admin `allowedEnv` change is needed.
56
56
  //
57
- // `minimumReleaseAge: "1 day"` holds any dependency younger than 24h out of
57
+ // `minimumReleaseAge: "7 days"` holds any dependency younger than 7 days out of
58
58
  // PRs. Security / osvVulnerabilityAlerts PRs are exempt. With this set, set
59
59
  // `minimumReleaseAge: 0` in pnpm-workspace.yaml: pnpm 11 defaults the
60
60
  // per-install gate to 1440 when the key is absent, and only 0 turns it off.
61
- // See docs/deployments.md § Renovate pnpm-11 freshness gate & microvm memory.
61
+ // See docs/deployments.md § Dependency updaters.
62
62
  // ─────────────────────────────────────────────────────────────────────
63
63
  env: {
64
64
  PNPM_WORKERS: "1",
65
65
  PNPM_MAX_WORKERS: "1",
66
66
  },
67
- minimumReleaseAge: "1 day",
67
+ minimumReleaseAge: "7 days",
68
68
 
69
69
  // Lockfile maintenance — picks up indirect-dependency updates that a
70
70
  // direct-dependency bump alone wouldn't catch. Same weekly slot.
@@ -282,19 +282,6 @@ jobs:
282
282
  done
283
283
  "$RUNNER_TEMP/actionlint" -color
284
284
 
285
- # bkit >= 5.0.1 gitignores `.bkit/core` + `.bkit/shared` (browse-only symlinks into
286
- # node_modules/@cbartens/bkit) yet `bkit check` counts a missing link as drift, so a
287
- # fresh checkout that never runs `bkit install` can never pass the gate below.
288
- # Recreate them exactly as install/upgrade does: relative targets, never clobber.
289
- - name: Materialize bkit Payload View Links
290
- if: steps.cache.outputs.skip != 'true'
291
- run: |
292
- for rel in core shared; do
293
- if [ ! -L ".bkit/$rel" ] && [ ! -e ".bkit/$rel" ]; then
294
- ln -s "../node_modules/@cbartens/bkit/.bkit/$rel" ".bkit/$rel"
295
- fi
296
- done
297
-
298
285
  - name: Run bkit Check
299
286
  if: steps.cache.outputs.skip != 'true'
300
287
  run: pnpm bkit check
@@ -18,8 +18,9 @@ name: bkit-cloud
18
18
  # - workflow_run (CI completion on dev): success -> no-op (regression check passed),
19
19
  # failure -> /bkit-debug {FID} (FID recovered from squash-merge commit scope;
20
20
  # loop-bounded by MAX_DEV_DISPATCH_ATTEMPTS). [skip ci] close commits never trigger CI.
21
- # - workflow_dispatch: pick ANY phase (ship|debug|design|plan|build) for an issue.
22
- # design/plan/build have no tracker-event trigger; they run only via dispatch.
21
+ # - workflow_dispatch: pick ANY phase (ship|debug|plan|build) for an issue.
22
+ # plan/build have no tracker-event trigger; they run only via dispatch.
23
+ # design is not offered: its Grill step interviews a human, so it runs locally only.
23
24
  #
24
25
  # Required secrets (claude job): ANTHROPIC_API_KEY + Claude GitHub App (one-time
25
26
  # `/install-github-app` — grants `id-token: write` OIDC for claude-code-action@v1).
@@ -42,7 +43,6 @@ on:
42
43
  options:
43
44
  - ship
44
45
  - debug
45
- - design
46
46
  - plan
47
47
  - build
48
48
  issue:
@@ -465,7 +465,7 @@ jobs:
465
465
  # `cloud` run to dev's `status.jsonl`, and the dispatched phase skill creates its
466
466
  # own `feat/{FID}` worktree under `.worktrees/`. ship/debug then read+write
467
467
  # their branch-local `status.jsonl` on `feat/{FID}` (worktree-prefer at Step 1);
468
- # design/plan/build start from dev. NDJSON + `*.jsonl merge=union` keeps it merge-safe.
468
+ # plan/build start from dev. NDJSON + `*.jsonl merge=union` keeps it merge-safe.
469
469
  ref: dev
470
470
  fetch-depth: 0
471
471
  # The auto-provided GITHUB_TOKEN inherits the `permissions:` block above.
@@ -493,7 +493,7 @@ jobs:
493
493
  uses: anthropics/claude-code-action@58985842b834ed26087302ba27d07bc24ca8697a # v1.0.244
494
494
  with:
495
495
  # Orchestrator contract: `/bkit-auto <phase> <arg>` where <arg> is the open
496
- # PR number (ship/debug) or the tracker issue number/id (design/plan/build).
496
+ # PR number (ship/debug) or the tracker issue number/id (plan/build).
497
497
  # The context job validated arg against its allowlist.
498
498
  prompt: "/bkit-auto ${{ needs.context.outputs.phase }} ${{ needs.context.outputs.arg }}"
499
499
  # Lock the runner-side session to the same tool surface bkit grants the local
@@ -7,7 +7,7 @@ dist/
7
7
  # Antigravity host installs as a workspace plugin; its skills/agents/hooks are
8
8
  # force-overwritten renders like the other host mirrors below.
9
9
  .agents/plugins/bkit/
10
- # Canonical-overwrite content (CANONICAL_OVERWRITE_RELPATHS in bkit's install engine):
10
+ # Canonical-overwrite content (byte-equal-text and markered-text entries of `getInstallManifest` in .bkit/core/engine/install/manifest.ts):
11
11
  # bkit force-overwrites these on every install, so consumer prettier must not
12
12
  # lint them. Width-sensitive rewrites would be reverted next install. The
13
13
  # .opencode agent + command mirrors are force-overwritten just like .claude /
@@ -6,7 +6,7 @@
6
6
  Fits: React Native / Expo apps on EAS. `context=runtime` (`expo` block): recent EAS Build status (id, platform, status, profile, commit, error), then the error-level lines of the latest errored builds' logs. `context=e2e` (`expo-workflows` block): for the latest failed EAS Workflow runs (`eas workflow:run`, Maestro) — job status and errors, step-log tails, the per-flow exception for every flow and retry (EAS GraphQL), JUnit, failure screenshot URLs, and from `artifacts.tar.gz` the failing Maestro commands, the view-hierarchy dump list, per-attempt JUnit, the XCUITest runner's own errors and the app's JS console. EAS drains build failures and Workflow runs nowhere else — no host log, no error tracker — so this is the only place they surface.
7
7
 
8
8
  - Secret: `EXPO_TOKEN` (an EAS access token), in the app's env (e.g. `apps/mobile/.env.local`), not `.bkit/.env`.
9
- - Non-secret: `EXPO_APP_DIR` (the EAS-linked app folder, default `apps/mobile`), both blocks; `expo`: `EAS_PLATFORM`, `EAS_N`, `EAS_ERR_N`; `expo-workflows`: `EAS_WF_N`, `EAS_WF_ERR_N`.
9
+ - Non-secret: `EXPO_APP_DIR` (the EAS-linked app folder, default `apps/mobile`), both blocks; `expo`: `EAS_PLATFORM`, `EAS_PROFILE`, `EAS_N`, `EAS_ERR_N`, `EAS_LOG_N`; `expo-workflows`: `EAS_WF_FILE`, `EAS_WF_N`, `EAS_WF_ERR_N`, `EAS_JUNIT_N`.
10
10
  - CLI: `eas` (`eas-cli`); each block's same-named provision block installs it in cloud, self-guarded, so copying both installs once. `expo` also uses `node` to decompress logs.
11
11
  - Domains: `expo.dev` (both), `googleapis.com` (`expo`), `eascdn.net` (`expo-workflows`); each section carries its own `allowed-domains` block.
12
12
  - `expo`: build logs are pre-signed, brotli-encoded storage URLs valid ~15 min; macOS curl has no brotli, so the block decompresses with Node zlib and filters the JSON lines with `jq`.
@@ -24,7 +24,7 @@ Copy the blocks below into `.agents/context.md`, below `<!-- bkit:end -->`. The
24
24
  # Expo EAS native build status + errored-build logs (read-only).
25
25
  # EXPO_TOKEN is an app/stack cred (it builds and ships the native apps) — app env, not .bkit/.env.
26
26
  # Run `eas` from the EAS-linked app folder: from anywhere else it writes a stub app.json there.
27
- # Customise: EXPO_APP_DIR; EAS_PLATFORM (android|ios|all); EAS_N (<= 50); EAS_ERR_N; the log-line filter.
27
+ # Customise: EXPO_APP_DIR; EAS_PLATFORM (android|ios|all); EAS_PROFILE (build profile, e.g. preview / production); EAS_N (<= 50); EAS_ERR_N; EAS_LOG_N (log lines per build); the log-line filter.
28
28
  EXPO_APP_DIR="${EXPO_APP_DIR:-apps/mobile}"
29
29
  command -v eas >/dev/null && [ -n "${EXPO_TOKEN:-}" ] \
30
30
  || { echo "[context-fetch:expo] skipped — eas CLI / EXPO_TOKEN missing" >&2; exit 0; }
@@ -34,18 +34,21 @@ cd "$EXPO_APP_DIR" || exit 0
34
34
  # 1) Recent build status. --status new|in-queue|in-progress|pending-cancel|errored|finished|canceled.
35
35
  eas build:list \
36
36
  --platform "${EAS_PLATFORM:-all}" \
37
+ ${EAS_PROFILE:+--build-profile "$EAS_PROFILE"} \
37
38
  --limit "${EAS_N:-10}" \
38
39
  --json --non-interactive \
39
40
  | jq -c '.[] | {id, platform, status, createdAt, buildProfile, gitCommitHash, error}' # gitCommitHash stitches to the CI run
40
41
  # 2) LOGS for recent failures. No `eas build:logs`; build:view exposes `logFiles`: pre-signed
41
42
  # URLs (signature in the query string, no auth header), valid ~900s, BROTLI-encoded JSON lines.
42
43
  # An install-dependencies failure (e.g. a private-registry 401) shows here.
43
- for id in $(eas build:list --status errored --limit "${EAS_ERR_N:-2}" --json --non-interactive | jq -r '.[].id'); do
44
+ for id in $(eas build:list --status errored --platform "${EAS_PLATFORM:-all}" ${EAS_PROFILE:+--build-profile "$EAS_PROFILE"} \
45
+ --limit "${EAS_ERR_N:-2}" --json --non-interactive | jq -r '.[].id'); do
44
46
  echo "===== errored build $id ====="
45
47
  eas build:view "$id" --json | jq -r '.logFiles[]?' | while read -r u; do
46
48
  curl -sS "$u" \
47
49
  | node -e "const z=require('zlib'),c=[];process.stdin.on('data',d=>c.push(d)).on('end',()=>{try{process.stdout.write(z.brotliDecompressSync(Buffer.concat(c)))}catch(e){process.stderr.write('[context-fetch:expo] log not brotli — encoding may have changed\n')}})" \
48
- | jq -rc 'select(.level>=40 or ((.msg//"") | test("ERR_|✗|error"))) | {phase, msg: (.msg // .err.message)}'
50
+ | jq -rc 'select(.level>=40 or ((.msg//"") | test("ERR_|✗|error"))) | {phase, msg: (.msg // .err.message)}' \
51
+ | tail -n "${EAS_LOG_N:-80}"
49
52
  done
50
53
  done
51
54
  ```
@@ -75,7 +78,7 @@ googleapis.com
75
78
  ```bash
76
79
  # EAS WORKFLOW runs — the native e2e (Maestro) lane (read-only). SEPARATE from the expo block:
77
80
  # that one covers `eas build`, this one covers `eas workflow:run`.
78
- # Customise: EXPO_APP_DIR; EAS_WF_N; EAS_WF_ERR_N; which artifacts to inline; the log greps.
81
+ # Customise: EXPO_APP_DIR; EAS_WF_FILE (e2e workflow file; unset = all); EAS_WF_N; EAS_WF_ERR_N; EAS_JUNIT_N (lines per JUnit file); which artifacts to inline; the log greps.
79
82
  EXPO_APP_DIR="${EXPO_APP_DIR:-apps/mobile}"
80
83
  command -v eas >/dev/null && [ -n "${EXPO_TOKEN:-}" ] \
81
84
  || { echo "[context-fetch:expo-workflows] skipped — eas CLI / EXPO_TOKEN missing" >&2; exit 0; }
@@ -87,18 +90,21 @@ trap 'rm -rf "$WORK"' EXIT
87
90
  # 1) Recent workflow runs, newest first. `workflow:runs` does NOT accept --non-interactive
88
91
  # (unlike its sibling commands): passing it errors out with no output, which reads exactly
89
92
  # like "no runs found". Its flags are only --json --limit --status --workflow.
90
- eas workflow:runs --json --limit "${EAS_WF_N:-10}" 2>/dev/null \
93
+ eas workflow:runs --json ${EAS_WF_FILE:+--workflow "$EAS_WF_FILE"} --limit "${EAS_WF_N:-10}" 2>/dev/null \
91
94
  | jq -c '.[]? | {id, status, gitCommitHash, createdAt}'
92
95
  # 2) Per-run detail. `workflow:status` is the only command that yields BOTH job ids and artifact URLs.
93
- for run in $(eas workflow:runs --json --status FAILURE --limit "${EAS_WF_ERR_N:-2}" 2>/dev/null \
94
- | jq -r '.[]?.id'); do
96
+ for run in $(eas workflow:runs --json ${EAS_WF_FILE:+--workflow "$EAS_WF_FILE"} --status FAILURE \
97
+ --limit "${EAS_WF_ERR_N:-2}" 2>/dev/null | jq -r '.[]?.id'); do
95
98
  echo "===== failed workflow run $run ====="
96
99
  STATUS="$WORK/status-$run.json"
97
- eas workflow:status "$run" --json --non-interactive > "$STATUS" 2>/dev/null || continue
100
+ # `workflow:status` exits 11 on a FAILED run after printing its JSON: test the output, not the exit code.
101
+ eas workflow:status "$run" --json --non-interactive > "$STATUS" 2>/dev/null
102
+ [ -s "$STATUS" ] || { echo "[context-fetch:expo-workflows] run $run: workflow:status returned no JSON" >&2; continue; }
98
103
  jq -r '.jobs[]? | "job \(.id) key=\(.key // "?") \(.status)", (.turtleJobRun.errors[]? | " \(.errorCode): \(.message)")' "$STATUS"
99
104
  # 2a) Step logs. `workflow:logs` takes the JOB id, not the run id (the run id returns "No
100
105
  # workflow job found"). --all-steps is required or it prompts for a step and hangs headless.
101
- for job in $(jq -r '.jobs[]?.id' "$STATUS"); do
106
+ # Failed jobs only: a passing job's log tail is noise.
107
+ for job in $(jq -r '.jobs[]? | select(.status=="FAILURE") | .id' "$STATUS"); do
102
108
  eas workflow:logs "$job" --all-steps --non-interactive 2>/dev/null | tail -60
103
109
  done
104
110
  # 2b) THE PER-FLOW EXCEPTION. Neither the GitHub job log nor the EAS job log carries it — both
@@ -114,7 +120,7 @@ for run in $(eas workflow:runs --json --status FAILURE --limit "${EAS_WF_ERR_N:-
114
120
  grep -oE 'https://wf-artifacts[^"]*(junit\.xml|failure-attempt[^"]*\.png)[^"]*' "$STATUS" \
115
121
  | while read -r u; do
116
122
  case "$u" in
117
- *junit.xml*) echo "===== JUnit ====="; curl -sS "$u" | tr -d '\r' ;;
123
+ *junit.xml*) echo "===== JUnit (first ${EAS_JUNIT_N:-300} lines) ====="; curl -sS "$u" | tr -d '\r' | head -n "${EAS_JUNIT_N:-300}" ;;
118
124
  *) echo "===== failure screenshot: $u" ;;
119
125
  esac
120
126
  done
@@ -140,8 +146,11 @@ for run in $(eas workflow:runs --json --status FAILURE --limit "${EAS_WF_ERR_N:-
140
146
  find "$DEST" -path '*screen-hierarchy*' -name '*.json' -exec ls -lh {} \; 2>/dev/null \
141
147
  | awk '{print " " $5 " " $NF}'
142
148
  # Per-ATTEMPT JUnit: the merged JUnit above hides a flow that failed and then passed on retry.
143
- find "$DEST" -path '*junit-reports*' -name '*.xml' 2>/dev/null \
144
- | while read -r j; do echo "===== $(basename "$j") ====="; tr -d '\r' < "$j"; done
149
+ find "$DEST" -path '*junit-reports*' -name '*.xml' 2>/dev/null | sort | head -n 20 \
150
+ | while read -r j; do
151
+ echo "===== $(basename "$j") (first ${EAS_JUNIT_N:-300} lines) ====="
152
+ tr -d '\r' < "$j" | head -n "${EAS_JUNIT_N:-300}"
153
+ done
145
154
  # 2e) WHY THE DRIVER DIED — read first for any DeviceUnreachableException. An `error:` line in
146
155
  # xctest_runner_*.log names the cause; neither job log does. A device-unreachable sweep is a
147
156
  # symptom shared by several faults, not a diagnosis.
@@ -3,7 +3,7 @@
3
3
 
4
4
  # GitHub Actions — failing CI run and diff since the last green run
5
5
 
6
- Fits: any repo whose CI runs on GitHub Actions. `context=ci`: the failing run on the current branch — failed jobs and steps, `::error` annotations, failed-step logs (bounded whole-run tail when `--log-failed` returns nothing). `context=diff`: `git diff --stat` from the last commit where your CI workflow passed on trunk to `HEAD`.
6
+ Fits: any repo whose CI runs on GitHub Actions. `context=ci`: the failing run on the current branch — failed jobs and steps, `::error` annotations, failed-step logs per failed job, each tail-bounded (bounded whole-run tail when `--log-failed` returns nothing). `context=diff`: `git diff --stat` (capped at `DIFF_STAT_N` files) from the last commit where your CI workflow passed on trunk to `HEAD`.
7
7
 
8
8
  - Secret: `GH_TOKEN` in cloud (local `gh auth login` works too).
9
9
  - Non-secret: `context=ci` none, the block discovers its own run. `context=diff`: `BASELINE_BRANCH` (your trunk, default `dev`) and `BASELINE_WORKFLOW` (your CI workflow file, default `bkit-ci.yml`); edit the defaults in the block so cloud agents inherit them.
@@ -20,7 +20,7 @@ Copy the blocks below into `.agents/context.md`, below `<!-- bkit:end -->`. The
20
20
  ```bash
21
21
  # GitHub Actions: failing-run job/step failures + error annotations + failed-step logs.
22
22
  # Discovers its own run. `gh` is base tooling — no context-fetch:provision sibling.
23
- # Customise: run (`--branch`, `--limit`, pin RUN_ID); log slice (`--log-failed` vs `--log`); job/step name filter; annotation grep.
23
+ # Customise: run (`--branch`, `--limit`, pin RUN_ID); log slice (`--log-failed` vs `--log`); CI_LOG_TAIL (lines kept per failed job, and of the whole-run fallback); job/step name filter; annotation grep.
24
24
  command -v gh >/dev/null 2>&1 \
25
25
  || { echo "[context-fetch:github] skipped — gh CLI not installed" >&2; exit 0; }
26
26
  gh auth status >/dev/null 2>&1 \
@@ -36,9 +36,23 @@ RUN_CONCLUSION=$(printf '%s' "$RUN_JSON" | jq -r '.[0].conclusion // ""')
36
36
  || { echo "[context-fetch:github] skipped — run $RUN_ID concluded success (nothing failing to fetch)" >&2; exit 0; }
37
37
  FAILED_STEPS=$(gh run view "$RUN_ID" --json conclusion,jobs \
38
38
  --jq '[.jobs[] | select(.conclusion=="failure") | {job: .name, steps: [.steps[] | select(.conclusion=="failure") | .name]}]' 2>/dev/null)
39
- CI_LOGS=$(gh run view "$RUN_ID" --log-failed 2>/dev/null)
40
- # Whole-run fallback is tens of MB — bound it. Raise CI_LOG_TAIL if the cause sits higher.
39
+ # Failed-step logs, one tail-bounded section per failed job, so a second failing job keeps its
40
+ # lines. Raise CI_LOG_TAIL if the cause sits higher in a job's log.
41
41
  CI_LOG_TAIL=2000
42
+ FAILED_JOBS=$(gh run view "$RUN_ID" --json jobs \
43
+ --jq '.jobs[] | select(.conclusion=="failure") | "\(.databaseId)\t\(.name)"' 2>/dev/null)
44
+ CI_LOGS=""
45
+ TAB=$(printf '\t')
46
+ while IFS="$TAB" read -r JOB JOB_NAME; do
47
+ [ -n "$JOB" ] || continue
48
+ JOB_LOG=$(gh run view "$RUN_ID" --job "$JOB" --log-failed 2>/dev/null | tail -n "$CI_LOG_TAIL")
49
+ [ -n "$JOB_LOG" ] && CI_LOGS="${CI_LOGS}===== job ${JOB_NAME} =====
50
+ ${JOB_LOG}
51
+ "
52
+ done <<EOF_JOBS
53
+ $FAILED_JOBS
54
+ EOF_JOBS
55
+ # Whole-run fallback is tens of MB — bound it the same way.
42
56
  [ -z "$CI_LOGS" ] && CI_LOGS=$(gh run view "$RUN_ID" --log 2>/dev/null | tail -n "$CI_LOG_TAIL")
43
57
  [ -n "$CI_LOGS" ] \
44
58
  || { echo "[context-fetch:github] skipped — no logs returned for run $RUN_ID" >&2; exit 0; }
@@ -58,7 +72,7 @@ printf '===== failed-step logs =====\n%s\n' "$CI_LOGS"
58
72
  ```bash
59
73
  # GitHub Actions: diff HEAD vs last-passing CI on trunk.
60
74
  # Set BASELINE_BRANCH / BASELINE_WORKFLOW to YOUR trunk and workflow file; commit them here.
61
- # Customise: BASELINE_BRANCH / BASELINE_WORKFLOW; last-passing `--limit`; `git diff` pathspec / `--stat` vs full patch.
75
+ # Customise: BASELINE_BRANCH / BASELINE_WORKFLOW; last-passing `--limit`; `git diff` pathspec / `--stat` vs full patch; DIFF_STAT_N (files listed).
62
76
  BASELINE_BRANCH="${BASELINE_BRANCH:-dev}"
63
77
  BASELINE_WORKFLOW="${BASELINE_WORKFLOW:-bkit-ci.yml}"
64
78
  command -v gh >/dev/null 2>&1 \
@@ -69,7 +83,7 @@ LAST_PASS_SHA=$(gh run list --branch "$BASELINE_BRANCH" --workflow "$BASELINE_WO
69
83
  || { echo "[context-fetch:github] skipped — no successful $BASELINE_WORKFLOW run on $BASELINE_BRANCH (check both names)" >&2; exit 0; }
70
84
  git cat-file -e "${LAST_PASS_SHA}^{commit}" 2>/dev/null \
71
85
  || { echo "[context-fetch:github] skipped — last-passing SHA $LAST_PASS_SHA not present locally (shallow clone?)" >&2; exit 0; }
72
- DIFF_STAT=$(git diff "$LAST_PASS_SHA..HEAD" --stat 2>/dev/null)
86
+ DIFF_STAT=$(git diff "$LAST_PASS_SHA..HEAD" --stat --stat-count="${DIFF_STAT_N:-200}" 2>/dev/null)
73
87
  [ -n "$DIFF_STAT" ] \
74
88
  || { echo "[context-fetch:github] skipped — no diff between HEAD and last-passing $LAST_PASS_SHA" >&2; exit 0; }
75
89
  printf '===== diff vs last-passing CI on %s (last-passing-sha: %s) =====\n\n%s\n' \
@@ -3,10 +3,10 @@
3
3
 
4
4
  # Inngest — failed function runs
5
5
 
6
- Fits: apps running durable functions on Inngest Cloud. `context=runtime`: recent `inngest/function.failed` system events — function id, run id, error message, and the opaque `*Id` keys of the triggering event.
6
+ Fits: apps running durable functions on Inngest Cloud. `context=runtime`: `inngest/function.failed` system events in a time window (default last 4 h) — function id, run id, error message, and the opaque `*Id` keys of the triggering event.
7
7
 
8
8
  - Secret: `INNGEST_SIGNING_KEY` — reuse the app's existing key. It is environment-scoped (branch environments and production have separate keys): use the key whose runs you want.
9
- - Non-secret: `INNGEST_N` (events, default 25).
9
+ - Non-secret: `INNGEST_N` (events, default 25, max 100), `SINCE_ISO` (window start, default 4 h ago; the API alone looks back only 1 h), `INNGEST_ENV` (branch environment name when the key is a branch key).
10
10
  - CLI: none (`curl` + `jq`), no provision block.
11
11
  - PII: the projection keeps only keys ending in `Id` from the triggering event's data. Keep free text and personal data out of `*Id` keys in your event payloads, or narrow the projection.
12
12
 
@@ -19,10 +19,16 @@ Copy the blocks below into `.agents/context.md`, below `<!-- bkit:end -->`.
19
19
  # INNGEST_SIGNING_KEY is ENV-SCOPED (branch env vs production) — use the key for the env whose
20
20
  # runs you want. Lists recent `inngest/function.failed` system events → function_id + run_id + error.
21
21
  # PII-safe: surfaces ONLY /Id$/ keys from the triggering event; every other key is dropped.
22
- # Customise: INNGEST_N; the ids projection (narrow it if any *Id key in your events carries PII).
22
+ # The API's own default window is the last 1 h; the block sets an explicit one.
23
+ # Customise: INNGEST_N (<= 100); SINCE_ISO window start (default 4 h ago); INNGEST_ENV (branch environment name, with a branch signing key); the ids projection (narrow it if any *Id key in your events carries PII).
23
24
  [ -n "${INNGEST_SIGNING_KEY:-}" ] \
24
25
  || { echo "[context-fetch:inngest] skipped — INNGEST_SIGNING_KEY unset" >&2; exit 0; }
25
- curl -s "https://api.inngest.com/v1/events?name=inngest/function.failed&limit=${INNGEST_N:-25}" \
26
+ START="${SINCE_ISO:-$(date -u -v-4H +%FT%TZ 2>/dev/null || date -u -d '4 hours ago' +%FT%TZ)}"
27
+ curl -sG "https://api.inngest.com/v1/events" \
28
+ --data-urlencode "name=inngest/function.failed" \
29
+ --data-urlencode "limit=${INNGEST_N:-25}" \
30
+ --data-urlencode "received_after=${START}" \
31
+ ${INNGEST_ENV:+-H "x-inngest-env: ${INNGEST_ENV}"} \
26
32
  -H "Authorization: Bearer ${INNGEST_SIGNING_KEY}" \
27
33
  | jq '[.data[]
28
34
  | {id, ts, function_id: .data.function_id, run_id: .data.run_id,
@@ -3,7 +3,7 @@
3
3
 
4
4
  # Maestro e2e lanes on GitHub Actions — job logs
5
5
 
6
- Fits: native e2e lanes (iOS, Android, or both) whose GitHub Actions jobs run Maestro, on the runner or by handing the run to Expo EAS, and upload no GitHub artifact. `context=e2e`: the full log of every failed Maestro job in the run, sliced to the steps that carry the per-flow result, else each log's tail.
6
+ Fits: native e2e lanes (iOS, Android, or both) whose GitHub Actions jobs run Maestro, on the runner or by handing the run to Expo EAS, and upload no GitHub artifact. `context=e2e`: the tail-bounded log of every failed Maestro job in the run, sliced to the steps that carry the per-flow result, else each log's tail.
7
7
 
8
8
  - Reads the per-flow result from steps that succeed inside the failed job, which `gh run view --log-failed` (the `context=ci` block) skips; the Playwright block's artifact download finds nothing on these lanes.
9
9
  - Secret: `GH_TOKEN` in cloud (local `gh auth login` works too).
@@ -23,7 +23,7 @@ Copy the block below into `.agents/context.md`, below `<!-- bkit:end -->`.
23
23
  # iOS: Maestro's driver is an XCUITest case hosting the HTTP server Maestro talks to, so one
24
24
  # failure inside it ends the suite and turns every later flow into DeviceUnreachableException;
25
25
  # read the per-flow table before the traces.
26
- # Customise: MAESTRO_JOB_RE; MAESTRO_STEPS (the steps that print per-flow results); MAESTRO_LOG_TAIL.
26
+ # Customise: MAESTRO_JOB_RE; MAESTRO_STEPS (the steps that print per-flow results); MAESTRO_LOG_TAIL (lines kept per step slice, and of the fallback tail).
27
27
  MAESTRO_JOB_RE="${MAESTRO_JOB_RE:-^your-maestro-e2e-job-name$}"
28
28
  MAESTRO_STEPS="${MAESTRO_STEPS:-Your per-flow results step|Your failure classification step}"
29
29
  MAESTRO_LOG_TAIL="${MAESTRO_LOG_TAIL:-800}"
@@ -50,12 +50,12 @@ while IFS="$TAB" read -r JOB_ID JOB_NAME; do
50
50
  fi
51
51
  PRINTED=1
52
52
  printf '===== Maestro job %s (run %s, job %s) =====\n' "$JOB_NAME" "$RUN_ID" "$JOB_ID"
53
- # Step names match as fixed strings against the step-name column gh prints; no match falls
54
- # through to the whole-log tail.
53
+ # Step names match as fixed strings against the step-name column gh prints; each slice keeps its
54
+ # last MAESTRO_LOG_TAIL lines. No match falls through to the whole-log tail.
55
55
  FOUND=0
56
56
  OLD_IFS=$IFS; IFS='|'
57
57
  for STEP in $MAESTRO_STEPS; do
58
- SLICE=$(grep -F "$STEP" "$JOB_LOG" 2>/dev/null)
58
+ SLICE=$(grep -F "$STEP" "$JOB_LOG" 2>/dev/null | tail -n "$MAESTRO_LOG_TAIL")
59
59
  [ -n "$SLICE" ] || continue
60
60
  FOUND=1
61
61
  printf '\n===== step: %s =====\n%s\n' "$STEP" "$SLICE"
@@ -23,7 +23,7 @@ Copy the block below into `.agents/context.md`, below `<!-- bkit:end -->`.
23
23
  # downloads THIS lane's artifact and files it as that lane's evidence; wrong evidence sends
24
24
  # diagnosis after the wrong failure, which is worse than the `NOT CONFIGURED` you get from
25
25
  # leaving the placeholder in. Until it is edited every run self-skips, naming the placeholder.
26
- # Customise: E2E_ARTIFACT; E2E_JOB_RE (anchored, this lane only); run selection; which report files to inline vs list as binary.
26
+ # Customise: E2E_ARTIFACT; E2E_JOB_RE (anchored, this lane only); run selection; which report files to inline vs list as binary; E2E_MAX_FILES / E2E_MAX_LINES / E2E_MAX_BIN (files inlined, lines per file, binary paths listed).
27
27
  E2E_ARTIFACT="${E2E_ARTIFACT:-playwright-report}"
28
28
  E2E_JOB_RE="${E2E_JOB_RE:-^your-e2e-job-name$}"
29
29
  command -v gh >/dev/null 2>&1 \
@@ -44,7 +44,7 @@ trap 'rm -rf "$DEST"' EXIT
44
44
  gh run download "$RUN_ID" -n "$E2E_ARTIFACT" -D "$DEST" 2>/dev/null \
45
45
  || { echo "[context-fetch:playwright] skipped — run $RUN_ID published no '$E2E_ARTIFACT' artifact; its e2e evidence is NOT in GitHub" >&2; exit 0; }
46
46
  # Failing specs first (`test-results/` holds only failures), then the rest. Bound both counts.
47
- E2E_MAX_FILES=20; E2E_MAX_LINES=300
47
+ E2E_MAX_FILES=20; E2E_MAX_LINES=300; E2E_MAX_BIN=50
48
48
  e2e_list() { find "$1" -type f \( -name '*.md' -o -name '*.json' -o -name '*.txt' -o -name '*.log' -o -name '*.xml' \) 2>/dev/null | sort; }
49
49
  E2E_FILES=$({ e2e_list "$DEST/test-results"; e2e_list "$DEST"; } | awk '!seen[$0]++')
50
50
  E2E_TOTAL=$(printf '%s' "$E2E_FILES" | grep -c . || true)
@@ -56,7 +56,7 @@ printf '%s\n' "$E2E_FILES" | head -n "$E2E_MAX_FILES" | while read -r f; do
56
56
  done
57
57
  [ "$E2E_TOTAL" -gt "$E2E_MAX_FILES" ] && printf '\n===== inlined %s of %s files; the rest were NOT read =====\n' "$E2E_MAX_FILES" "$E2E_TOTAL"
58
58
  printf '\n===== binary artifacts (not inlined) =====\n'
59
- find "$DEST" -type f \( -name '*.html' -o -name '*.png' -o -name '*.webm' -o -name '*.zip' \) | sed "s|^$DEST/||" | sort
59
+ find "$DEST" -type f \( -name '*.html' -o -name '*.png' -o -name '*.webm' -o -name '*.zip' \) | sed "s|^$DEST/||" | sort | head -n "$E2E_MAX_BIN"
60
60
  ```
61
61
 
62
62
  <!-- context-fetch:end -->
@@ -3,10 +3,10 @@
3
3
 
4
4
  # Sentry — unresolved issues
5
5
 
6
- Fits: apps reporting errors to Sentry (web, server or native). `context=runtime`: unresolved issues seen in the last 24 h, newest first (id, title, culprit, count, first / last seen, permalink). Commented recipes in the block pull one issue's `trace_id` (to stitch to the `vercel` block's `traceId`) and every event of one issue with timestamps (to count events inside a run's time window).
6
+ Fits: apps reporting errors to Sentry (web, server or native). `context=runtime`: one project's unresolved issues seen in a window (default last 24 h; optional environment), newest first (id, title, culprit, count, first / last seen, permalink). Commented recipes in the block pull one issue's `trace_id` (to stitch to the `vercel` block's `traceId`) and every event of one issue with timestamps (to count events inside a run's time window).
7
7
 
8
8
  - Secret: `SENTRY_AUTH_TOKEN` (an internal-integration or user token with `project:read`, `event:read`).
9
- - Non-secret: `SENTRY_ORG`, `SENTRY_PROJECT` (slugs) and `SENTRY_HOST` — uncomment the lines in the block so cloud agents inherit them. An EU-region org uses `de.sentry.io`: the global host 404s on its issue ids.
9
+ - Non-secret: `SENTRY_ORG`, `SENTRY_PROJECT` (slugs) and `SENTRY_HOST` — uncomment the lines in the block so cloud agents inherit them. An EU-region org uses `de.sentry.io`: the global host 404s on its issue ids. Optional: `SENTRY_SINCE` (window, default `24h`), `SENTRY_ENV`, `SENTRY_N`.
10
10
  - CLI: none (`curl` + `jq`), no provision block.
11
11
  - An empty list is not "no errors": a spent quota drops events silently. Check the org's quota usage before reading silence as clean.
12
12
 
@@ -15,7 +15,8 @@ Copy the blocks below into `.agents/context.md`, below `<!-- bkit:end -->`.
15
15
  <!-- context-fetch:start sentry context=runtime -->
16
16
 
17
17
  ```bash
18
- # Sentry issues API — unresolved issues, last 24h, sorted by last seen (read-only).
18
+ # Sentry organization issues API — unresolved issues of one project seen in the window (default
19
+ # 24h), sorted by last seen (read-only). statsPeriod is the query window on this endpoint.
19
20
  # Headless: SENTRY_AUTH_TOKEN (secret, from env). SENTRY_ORG / SENTRY_PROJECT / SENTRY_HOST are
20
21
  # non-secret — uncomment + set the lines below so local AND cloud agents inherit them:
21
22
  # SENTRY_ORG="your-org-slug"
@@ -23,13 +24,13 @@ Copy the blocks below into `.agents/context.md`, below `<!-- bkit:end -->`.
23
24
  # SENTRY_HOST="de.sentry.io" # EU-region org; the global host 404s on its issue ids
24
25
  # An empty array is NOT "no errors": a spent quota drops events silently — check the org's
25
26
  # quota usage (or /api/0/organizations/{org}/stats_v2/) before concluding silence = clean.
26
- # Customise: statsPeriod (1h / 7d); SENTRY_N; add `environment:production` to the query; jq keys.
27
+ # Customise: SENTRY_SINCE window (1h / 24h / 7d); SENTRY_ENV (environment name, e.g. production; unset = all); SENTRY_N (<= 100); jq keys.
27
28
  SENTRY_HOST="${SENTRY_HOST:-sentry.io}"
28
29
  [ -n "${SENTRY_AUTH_TOKEN:-}" ] && [ -n "${SENTRY_ORG:-}" ] && [ -n "${SENTRY_PROJECT:-}" ] \
29
30
  || { echo "[context-fetch:sentry] skipped — SENTRY_AUTH_TOKEN / SENTRY_ORG / SENTRY_PROJECT unset" >&2; exit 0; }
30
31
  curl -s \
31
32
  -H "Authorization: Bearer ${SENTRY_AUTH_TOKEN}" \
32
- "https://${SENTRY_HOST}/api/0/projects/${SENTRY_ORG}/${SENTRY_PROJECT}/issues/?query=is%3Aunresolved&statsPeriod=24h&limit=${SENTRY_N:-25}&sort=date" \
33
+ "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/?project=${SENTRY_PROJECT}&query=is%3Aunresolved&statsPeriod=${SENTRY_SINCE:-24h}&sort=date&limit=${SENTRY_N:-25}&collapse=stats${SENTRY_ENV:+&environment=${SENTRY_ENV}}" \
33
34
  | jq '[.[] | {id, title, culprit, count: .count, firstSeen, lastSeen, permalink}]'
34
35
 
35
36
  # Trace correlation — one issue's latest event → its trace_id. The same id appears in the
@@ -3,10 +3,10 @@
3
3
 
4
4
  # Stripe — failed payment events
5
5
 
6
- Fits: apps taking payments with Stripe. `context=runtime`: recent Events API entries whose type names a failure, dispute, error or refund (id, type, created, livemode only — never customer, card or metadata). The Events API keeps about 30 days.
6
+ Fits: apps taking payments with Stripe. `context=runtime`: Events API entries in a window (default last day) whose type names a failure, dispute or refund, filtered by the API (id, type, created, livemode only — never customer, card or metadata). The Events API keeps about 30 days.
7
7
 
8
8
  - Secret: `STRIPE_SECRET_KEY` — reuse the app's existing key, or a restricted key with read access to Events. The `sk_live_` / `sk_test_` prefix selects live vs test mode.
9
- - Non-secret: `STRIPE_N` (events scanned, default 50).
9
+ - Non-secret: `STRIPE_N` (events returned, default 50, max 100), `STRIPE_SINCE_S` (window in seconds, default 86400).
10
10
  - CLI: none (`curl` + `jq`), no provision block.
11
11
 
12
12
  Copy the blocks below into `.agents/context.md`, below `<!-- bkit:end -->`.
@@ -17,14 +17,37 @@ Copy the blocks below into `.agents/context.md`, below `<!-- bkit:end -->`.
17
17
  # Stripe event stream — payment / subscription / dispute / refund failures (read-only GET).
18
18
  # Headless: STRIPE_SECRET_KEY (secret, from env); the key prefix (sk_live_ / sk_test_) selects
19
19
  # live vs test mode. PII-safe: only id / type / created / livemode surfaced.
20
- # Customise: STRIPE_N; the type filter; add `&type=` to the URL to narrow server-side.
20
+ # Filters at the source: every event type naming a failure, dispute or refund, in two calls
21
+ # (the API takes at most 20 `types[]` per call), merged newest first.
22
+ # Customise: STRIPE_N (<= 100); STRIPE_SINCE_S window in seconds (default 1 day; the API keeps ~30 days); the two type lists.
21
23
  [ -n "${STRIPE_SECRET_KEY:-}" ] \
22
24
  || { echo "[context-fetch:stripe] skipped — STRIPE_SECRET_KEY unset" >&2; exit 0; }
23
- curl -s "https://api.stripe.com/v1/events?limit=${STRIPE_N:-50}" \
24
- -u "${STRIPE_SECRET_KEY}:" \
25
- | jq '[.data[]
26
- | select(.type | test("fail|dispute|error|refund"; "i"))
27
- | {id, type, created, livemode}]'
25
+ SINCE_TS=$(( $(date +%s) - ${STRIPE_SINCE_S:-86400} ))
26
+ stripe_events() {
27
+ TYPES=""
28
+ for t in "$@"; do TYPES="$TYPES -d types[]=$t"; done
29
+ # $TYPES unquoted on purpose: one `-d types[]=<name>` per word; type names hold no spaces.
30
+ curl -sgG "https://api.stripe.com/v1/events" -u "${STRIPE_SECRET_KEY}:" \
31
+ --data-urlencode "limit=${STRIPE_N:-50}" \
32
+ --data-urlencode "created[gte]=${SINCE_TS}" \
33
+ $TYPES
34
+ }
35
+ {
36
+ stripe_events charge.failed charge.refunded charge.refund.updated \
37
+ charge.dispute.created charge.dispute.updated charge.dispute.closed \
38
+ charge.dispute.funds_withdrawn charge.dispute.funds_reinstated \
39
+ payment_intent.payment_failed invoice.payment_failed invoice.finalization_failed \
40
+ checkout.session.async_payment_failed setup_intent.setup_failed \
41
+ refund.created refund.updated refund.failed
42
+ stripe_events application_fee.refunded application_fee.refund.updated \
43
+ payout.failed topup.failed source.failed source.refund_attributes_required \
44
+ issuing_dispute.created issuing_dispute.updated issuing_dispute.closed \
45
+ issuing_dispute.submitted issuing_dispute.funds_reinstated issuing_dispute.funds_rescinded \
46
+ reporting.report_run.failed terminal.reader.action_failed test_helpers.test_clock.internal_failure
47
+ } | jq -s --argjson n "${STRIPE_N:-50}" '
48
+ [.[] | if .error then error("[context-fetch:stripe] Stripe API error: \(.error.message)") else .data[] end]
49
+ | sort_by(-.created) | .[:$n]
50
+ | map({id, type, created, livemode})'
28
51
  ```
29
52
 
30
53
  <!-- context-fetch:end -->