@cbartens/bkit 5.2.0 → 5.2.2
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.
- package/.bkit/README.md +1 -1
- package/.bkit/core/.bkit/cloud.md +1 -1
- package/.bkit/core/.bkit/install.md +5 -2
- package/.bkit/core/.bkit/providers.md +2 -0
- package/.bkit/core/.bkit/workflows.md +3 -3
- package/.bkit/core/engine/checks/after/index.ts +2 -2
- package/.bkit/core/engine/commands/install/install.ts +44 -11
- package/.bkit/core/engine/commands/install/upgrade.ts +4 -0
- package/.bkit/core/engine/commands/workflow/runtime.ts +4 -6
- package/.bkit/core/engine/install/manifest.ts +2 -2
- package/.bkit/core/engine/install/modules/core.ts +9 -6
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +5 -5
- package/CHANGELOG.md +14 -0
- package/README.md +3 -0
- package/dist/checks/after/index.js +1 -1
- package/dist/commands/install/install.js +42 -8
- package/dist/commands/install/upgrade.js +4 -1
- package/dist/commands/workflow/runtime.js +4 -4
- package/dist/install/manifest.js +2 -2
- package/dist/install/modules/core.js +9 -7
- package/package.json +1 -1
package/.bkit/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# bkit — Agent Workflow System
|
|
2
2
|
|
|
3
|
-
<!-- bkit:managed v5.2.
|
|
3
|
+
<!-- bkit:managed v5.2.2 — do not edit; run `bkit upgrade` to refresh -->
|
|
4
4
|
|
|
5
5
|
**bkit** wires Claude Code, Cursor, Codex, Google Antigravity and opencode into five-phase tracker-integrated cycle: `/bkit-design` → `/bkit-plan` → `/bkit-build` → `/bkit-debug` → `/bkit-ship`. Hosts additive, one flag each: `--claude`, `--cursor`, `--codex`, `--antigravity`, `--opencode=<provider>` — opencode providers: `openrouter`, `ollama`, `opencode-zen` + `opencode-go` (opencode-native gateways; auth via `BKIT_OPENCODE_API_KEY`). Same harness on every host; state lives in the repo, so a feature moves between hosts mid-run (see `.bkit/providers.md` § Hosts + Providers).
|
|
6
6
|
|
|
@@ -30,7 +30,7 @@ Three cloud stacks — each agent pairs with one tracker. Pick row for agent you
|
|
|
30
30
|
|
|
31
31
|
**Unified file — additive coexistence:** Claude + opencode share one `bkit-cloud.yml`: a `context` job resolves the phase once, then two runner jobs, each runtime-gated on its secret (`ANTHROPIC_API_KEY` claude, `OPENCODE_PROVIDER_KEY` opencode). Both jobs can fire on same CI event — both secrets → both agents; one secret → one agent. Cursor separate (no GH Action; native triggers). **Cursor cloud ↔ Linear.**
|
|
32
32
|
|
|
33
|
-
**Manual dispatch (Claude or opencode, path A):** GitHub → **Actions** → **bkit-cloud** → **Run workflow** → `phase` (`ship` / `debug` / `plan` / `build`) + `issue`. On-demand/smoke-test for `plan` / `build`; `ship` / `debug` normally CI-fired. `design` runs
|
|
33
|
+
**Manual dispatch (Claude or opencode, path A):** GitHub → **Actions** → **bkit-cloud** → **Run workflow** → `phase` (`ship` / `debug` / `design` / `plan` / `build`) + `issue`. On-demand/smoke-test for `design` / `plan` / `build`; `ship` / `debug` normally CI-fired. Dispatched `design` runs headless (`runtimeHeadless` = true on a GitHub runner): Grill asks nothing and records each recommended answer as `Assumed, not confirmed`. Dispatched `/bkit-auto` orchestrator → matching phase skill → brief from GitHub issue (MCP).
|
|
34
34
|
|
|
35
35
|
### Reactive comment handlers (`claude.yml` + `opencode.yml`) — separately managed, not bkit
|
|
36
36
|
|
|
@@ -234,13 +234,16 @@ After writes, bkit re-runs credential and environment checks — some only accur
|
|
|
234
234
|
| `opencode-setup` | opencode host installed (`--opencode=<provider>`) — names the provider key to set (e.g. `BKIT_OPENROUTER_API_KEY`; `BKIT_OPENCODE_API_KEY` for `opencode-zen` / `opencode-go`), confirms the pre-seeded base URL, and notes all four providers ship curated per-agent pins (re-pin via `.bkit/prompts.md` § Model Overrides). Verify with `bkit doctor` + `bkit status`. |
|
|
235
235
|
| `vale-package-not-synced` | vale on PATH but `.vale/styles/write-good/` absent |
|
|
236
236
|
| `gate-missing-called-scripts` | A `bkit:gate:*` script still at bkit's default chains a script `package.json` does not declare (e.g. `typecheck`, `format:check`, `test`). Add it (`.bkit/templates.md` lists the tool scripts and devDeps) or rewrite the gate. |
|
|
237
|
-
| `gate-noop` | A `bkit:gate:*` script is empty or cannot fail (`true`, `:`, `exit 0`, `echo …`), so every agent run and push passes it. Warn-only, at install and `bkit
|
|
237
|
+
| `gate-noop` | A `bkit:gate:*` script is empty or cannot fail (`true`, `:`, `exit 0`, `echo …`), so every agent run and push passes it. Warn-only, at install, `bkit check` and `bkit upgrade`, on every branch. Point it at real checks, or delete it and run `bkit upgrade` to restore bkit's default. |
|
|
238
238
|
| `gate-tier-not-wired` | `package.json` declares a deeper test tier (`test:integration`, `test:e2e`, `test:live`) that no `bkit:gate:*` script runs; the advisory prints the gate line to add. |
|
|
239
|
+
| `test-file-script-missing` | `package.json` does not declare `bkit:test:file`, so `/bkit-build` reports test-first as not enforced. The advisory prints the script contract and a Vitest line. |
|
|
239
240
|
|
|
240
241
|
Phase 1 and Phase 3 findings merged and deduplicated by `id` (Phase 3 wins on conflict — re-detection more accurate post-write). Zero findings → no banner.
|
|
241
242
|
|
|
242
243
|
**`bkit check` (dry-run)** runs Phase 1 and Phase 3 (read-only) — same advisory set as `bkit install` minus writes. Changes no managed file (regenerates `.bkit/advisories.md` artifact) and **exits 1 when any managed-file write would occur** in installed module — Tier-2 JSON deep-containment or markered-block drift, whole-file byte-equal mismatch, **host agent/command mirror content drift** (would-write / orphan delete), or when any file bkit writes (rendered agents / commands / skills, managed blocks, owned whole files) carries a stale managed-version marker (`bkit-managed-stale`). Gate covers the **installed** module set ({core, claude, cursor, codex, antigravity} plus **opencode**, each detected by sentinel files). A missing `bkit:gate:*` name counts as a write. antigravity gated: `.agents/plugins/bkit/**` (plugin manifest, hooks, agents, skills) and root `GEMINI.md`. opencode gated: `.opencode/opencode.json` (provider block + the recorded tracker's `mcp` entry + permission sandbox; another tracker's leftover `mcp` entry is not drift — `mcp-extra-server-linear--opencode-opencode-json` advises removing it) and the `bkit-gateguard.js` / `bkit-readguard.js` plugins drift fail `check` — render inputs fall back to installed provider (`package.json` `bkit.opencodeProvider`, authoritative for `opencode-zen` / `opencode-go`; all installed providers tracked in `bkit.opencodeProviders: string[]`) and recorded tracker, so clean install across providers checks green (no false drift). Remaining **opt-in** module (cloud) is not drift-gated. A missing bkit-owned hook file also fails `check`, one line per file naming it and the `bkit install` flag that restores it: the hook files of every installed host (`.claude/hooks/*`, `.cursor/hooks/*`, `.codex/hooks/*`, `.agents/plugins/bkit/hooks/*`, `.opencode/plugin/bkit-gateguard.js`, `.opencode/plugin/bkit-readguard.js`) — the hook commands skip a missing file (`test -f … || true`), so without this the guard would be off with no signal. Updater configs are not bkit files, so `bkit check` does not report them. Phase 3 stays read-only through read-only detector paths, not by being skipped.
|
|
243
244
|
|
|
245
|
+
**`bkit upgrade`** (not `--dry-run`) ends with the same read-only pass as `bkit check`: prints the checklist and rewrites `.bkit/advisories.md` (`Mode: upgrade`). Drift and blockers it finds are reported only — upgrade's exit code is unchanged.
|
|
246
|
+
|
|
244
247
|
**`PreflightFinding` shape** — stable contract for downstream tooling:
|
|
245
248
|
|
|
246
249
|
```typescript
|
|
@@ -328,7 +331,7 @@ bkit tips --all # every firing tip
|
|
|
328
331
|
| Order | One fixed priority list. `--workflow=<name>` moves the tips that matter in that workflow to the front: tracker, GitHub token, `.bkit/.env` and direnv matter in every workflow, so they lead until fixed; then e.g. context-fetch for debug, Husky / slop-scan for build, CI workflow / cloud for ship. |
|
|
329
332
|
| Detection | Local only — files, settings, environment; no network. A tip clears once its local half exists; dashboard steps live in the tip text. |
|
|
330
333
|
| Reuse | A tip for a gap an advisory already detects calls that advisory's detector — tip and advisory never disagree. |
|
|
331
|
-
| Artifact | `bkit install` / `check` / `doctor` list every firing tip, with its id, in `.bkit/advisories.md` § Setup tips and the console banner: line, why, caution, ask-your-agent sentence, agent steps. |
|
|
334
|
+
| Artifact | `bkit install` / `check` / `upgrade` / `doctor` list every firing tip, with its id, in `.bkit/advisories.md` § Setup tips and the console banner: line, why, caution, ask-your-agent sentence, agent steps. |
|
|
332
335
|
| Silence | Root `package.json` `bkit.ignoreAdvisories`: a tip id, or an advisory id the tip reuses, silences the tip and those advisories together; both show in the suppressed block. |
|
|
333
336
|
| Exit | Always 0. Prints nothing when no tip fires. |
|
|
334
337
|
|
|
@@ -409,6 +409,8 @@ bkit ships no compaction setting; each host auto-summarises near the model's ful
|
|
|
409
409
|
|
|
410
410
|
**Floor:** keep the window well above the largest single tool result plus the recent turns kept after a summary. Claude Code ends an agent whose context refills to the limit within 3 turns of a summary, 3 times in a row (`Autocompact is thrashing`).
|
|
411
411
|
|
|
412
|
+
**Compression proxies:** bkit ships none (caveman, Headroom). On 456 real Claude Code transcripts they saved ~1–3% of token cost: both keep the prompt cache intact, so each tool result is compressed once on arrival and reused, and tool results ≥ 2 KB are 27% of cost. Headroom's Kompress text model rewrote code (`=> void` → `void`). Method, results, scripts to measure own sessions: [comparison](https://github.com/cbartens/bkit/blob/main/tests/compression/bkit-caveman-headroom-compression-proxy-comparison.md). bkit cuts reading instead, losslessly: § ReadGuard + `Code reads` / `Narrow text search first` in `.agents/rules.md`.
|
|
413
|
+
|
|
412
414
|
## MCP project scope
|
|
413
415
|
|
|
414
416
|
A remote MCP server that can see a whole account makes agents look up account and project IDs before every task. Lock its URL to one project and those lookup tools disappear; calls default to that project. Lock it in every host file that declares the server (`.mcp.json`, `.cursor/mcp.json`, `.opencode/opencode.json`, `.codex/config.toml`).
|
|
@@ -130,7 +130,7 @@ Re-runnable: source carries wired variants; tracker switch (`--tracker=linear` a
|
|
|
130
130
|
- **Design / plan close on HARD STOP** — human review required before next phase.
|
|
131
131
|
- **No archive step in ship:** artifacts at canonical `docs/plans/{YYYYMM}/` from design start — nothing to move at close.
|
|
132
132
|
- **Debug three attempt counters = mode-matched pairs**.
|
|
133
|
-
- **Runtime capability table:** `bkit runtime detect` classifies the runtime (`LOCAL` / `GITHUB_ACTION` / `CLOUD_CLAUDE` / `CLOUD_CURSOR` / `UNKNOWN`) and emits `runtimeWorktrees` / `runtimeDevPushes` / `runtimeGithubCli` (the `runtime-resolved` row's keys; ship holds two as `{RUNTIME_DEVPUSHES}` / `{RUNTIME_WORKTREES}`) plus `runtimeHeadless`, derived from `runtime` and never stored on the row (`bkit runtime assert` re-derives it; design Step 3 holds it as `{RUNTIME_HEADLESS}`). Headless = `GITHUB_ACTION`
|
|
133
|
+
- **Runtime capability table:** `bkit runtime detect` classifies the runtime (`LOCAL` / `GITHUB_ACTION` / `CLOUD_CLAUDE` / `CLOUD_CURSOR` / `UNKNOWN`) and emits `runtimeWorktrees` / `runtimeDevPushes` / `runtimeGithubCli` (the `runtime-resolved` row's keys; ship holds two as `{RUNTIME_DEVPUSHES}` / `{RUNTIME_WORKTREES}`) plus `runtimeHeadless`, derived from `runtime` and never stored on the row (`bkit runtime assert` re-derives it; design Step 3 holds it as `{RUNTIME_HEADLESS}`). Headless = `GITHUB_ACTION` only: a runner job ends when the agent ends its turn, so no reply reaches it. Every other runtime counts as attended; `BKIT_RUNTIME` overrides. `CLOUD_CURSOR` is detected via a `.bkit/.runtime-cursor` marker written by `.cursor/hooks/bkit-preflight.sh` when `is_background_agent` is true (Cursor exposes that only on stdin JSON to the hook, not as an env var). `RUNTIME_DEVPUSHES` is a conservative DEFAULT, never probed — a `git push --dry-run` sends no ref-update, so a protected branch's pre-receive hook never fires and a false-positive would strand a cloud session on a `dev` checkout. `runtimeGithubCli` is the one live probe (`gh auth status`). An explicit falsy primitive (`CI=false`, `GITHUB_ACTIONS=false`) means ABSENCE, not ambiguity — treating it as ambiguous would cost a laptop its worktree model; only a non-truthy, non-falsy value goes `UNKNOWN`.
|
|
134
134
|
- **Local happy path is byte-identical across the three runtimes:** every runtime branch is additive. `RUNTIME_DEVPUSHES=true` (laptop, GH-Actions runner) runs the local block verbatim — local `merge --squash -X ours`, `docs({FID}): {phase} DONE bkit [skip ci]`, direct `dev` push, worktree teardown. Only `RUNTIME_DEVPUSHES != true` (claude.ai cloud, `unknown`) takes the PR-merge branch. Never replace a working local call site to serve a cloud runtime; branch around it.
|
|
135
135
|
- **PR-mode design/plan closes MUST push before `bkit prs open`:** PR creation and `gh pr merge` act on the REMOTE, so a close commit that is only committed locally never enters the PR and never reaches `dev`. The `RUNTIME_DEVPUSHES=true` branch pushes `dev` directly and is unaffected; the `false` branch produces two local commits (`chore({FID}): close-workflow` carrying the `status.jsonl` rows and close telemetry, then `docs({FID}): {phase} roadmap update` carrying `.bkit/issues.jsonl` + `docs/roadmap.md`) and needs an explicit `bkit branches push --mode=feature` to publish them. Placed after the STRAY guard so nothing unvetted is published, and before `bkit prs open --existing=reuse`. Build/debug close pushes the feature branch already. Omitting it silently loses every design/plan close on the PR path.
|
|
136
136
|
- **`bkit workflows close` runs in the worktree, before the squash, in both close modes:** the `workflow-done` row and the telemetry rows ride the `chore({FID}): close-workflow` commit on `feat/{FID}`, so the squash (local) or the PR (cloud) carries them to `dev`. `status.jsonl` and `.bkit/stats.jsonl` are `merge=union`, so the squash concatenates them with `dev`'s copies.
|
|
@@ -812,7 +812,7 @@ Each subsection documents command behaviour — steps, subagents, artifacts, ver
|
|
|
812
812
|
| --- | --- | --- | --- | --- |
|
|
813
813
|
| 1 — Start Workflow | — | tracker issue | `.lock`, tracker comment | Fetch `origin/dev`. Resolve `{ISSUE_ID}` from the session prompt (no match → stop; never create), set label `bkit:design`, state `In Progress`. no commits on `dev` — `status.jsonl` init + `start-workflow` step entry deferred to Step 2 inside the worktree. |
|
|
814
814
|
| 2 — Worktree Setup | — | repo | `.worktrees/{FID}`, `bkit.worktree.copy` files, `design-input-{RUN}.md` | `bkit worktrees setup`: create `feat/{FID}` off a freshly fetched `origin/dev`, resume it, or adopt the current branch in place; dependencies installed (install failure → **Failure Path**). `baseSha` → `runtime-resolved` row (§ Anchor Block). |
|
|
815
|
-
| 3 — Grill | — | `design-input-{RUN}.md`, newest earlier-run `design-grill-*.md` | `design-grill-{RUN}.md`, `Grill decisions` section appended to `design-input-{RUN}.md`, tracker comment (`--comment-body`) | Orchestrator interviews the human before any design work. Method adapted from Matt Pocock's `grilling` skill (MIT, https://github.com/mattpocock/skills/tree/main/skills/productivity/grilling). Open decisions mapped as a tree; each round asks the whole frontier (every decision whose prerequisites are settled), numbered, each with a recommended answer worded so "yes" accepts it; plain text, no host question tool. Orchestrator looks up facts; only decisions go to the human. Stops on an empty frontier plus human confirmation, a human stop, or 10 rounds. Agreed answers → `Settled`; unanswered at stop → `Assumed, not confirmed`; "don't know" → `Open`. An earlier run's `Settled` entries stay settled. `grill=false` in the session prompt skips the interview; the artifact then reads `Skipped (grill=false).` `runtimeHeadless` = true (read via `bkit runtime assert`) → no question asked, no turn ended: the tree is walked taking each recommended answer as given, every new answer lands in `Assumed, not confirmed`, and the artifact carries a `Headless run ({RUNTIME})` line. The ideate triplet, generate and both reviewers read the section through `design-input-{RUN}.md`. Waiting time is exempt from the 3600s timeout.
|
|
815
|
+
| 3 — Grill | — | `design-input-{RUN}.md`, newest earlier-run `design-grill-*.md` | `design-grill-{RUN}.md`, `Grill decisions` section appended to `design-input-{RUN}.md`, tracker comment (`--comment-body`) | Orchestrator interviews the human before any design work. Method adapted from Matt Pocock's `grilling` skill (MIT, https://github.com/mattpocock/skills/tree/main/skills/productivity/grilling). Open decisions mapped as a tree; each round asks the whole frontier (every decision whose prerequisites are settled), numbered, each with a recommended answer worded so "yes" accepts it; plain text, no host question tool. Orchestrator looks up facts; only decisions go to the human. Stops on an empty frontier plus human confirmation, a human stop, or 10 rounds. Agreed answers → `Settled`; unanswered at stop → `Assumed, not confirmed`; "don't know" → `Open`. An earlier run's `Settled` entries stay settled. `grill=false` in the session prompt skips the interview; the artifact then reads `Skipped (grill=false).` `runtimeHeadless` = true (read via `bkit runtime assert`) → no question asked, no turn ended: the tree is walked taking each recommended answer as given, every new answer lands in `Assumed, not confirmed`, and the artifact carries a `Headless run ({RUNTIME})` line. The ideate triplet, generate and both reviewers read the section through `design-input-{RUN}.md`. Waiting time is exempt from the 3600s timeout. A `bkit-cloud.yml` `workflow_dispatch` run is headless. |
|
|
816
816
|
| 4 — Brainstorm & Ideate | `@bkit-design-brainstorm-ideate-1` ‖ `-2` ‖ `-3` (parallel triplet) | `design-input-{RUN}.md` | `design-brainstorm-ideate-1.md`, `-2.md`, `-3.md` | Pragmatic / optimal-tradeoff / risk-premortem lenses; effort-tier diversity (`high`/`medium`/`high`); sibling-blind. `BRAINSTORM_VERDICT` = worst of three. |
|
|
817
817
|
| 5 — Generate Design | `@bkit-design-generate` | `design-input-{RUN}.md` (carries the `Grill decisions` section), all three brainstorms, `related-issues.md`, superseded `{YYYYMM}/{FID}-design.md` (if any) | `design-v1-draft.md` (versioned draft) | First write of deliverable design doc. Superseded design = context only, never a constraint; supplied HERE only — not to the sibling-blind ideate triplet. |
|
|
818
818
|
| 6 — Design Review | `@bkit-design-review-1` ‖ `@bkit-design-review-2` (parallel) | `design-v1-draft.md`, `design-input-{RUN}.md` | `design-review-1.md`, `design-review-2.md` (opinion-only logs) | Effort-tier diversity (high vs medium); sibling-blind. `REVIEW_VERDICT` = worst of two. FAIL → Failure Path. `SPIKE` = `Spike` header from `design-review-1.md` only. |
|
|
@@ -1400,7 +1400,7 @@ Each gate is the previous gate plus its own tier, so the name and the value desc
|
|
|
1400
1400
|
|
|
1401
1401
|
Dependency inspection is read-only, not a gate: `bkit:deps:outdated` and `bkit:deps:audit` exist so prompts stop hardcoding `pnpm outdated` / `pnpm audit`.
|
|
1402
1402
|
|
|
1403
|
-
`bkit:test:file` is not a gate either: it runs ONE test file — bkit appends the repo-relative path as its argument — and writes a JUnit report to the path in `$BKIT_TEST_REPORT`. `/bkit-build` reads that report for test-first (§ Test-first). Not seeded (no default runs one file on every stack);
|
|
1403
|
+
`bkit:test:file` is not a gate either: it runs ONE test file — bkit appends the repo-relative path as its argument — and writes a JUnit report to the path in `$BKIT_TEST_REPORT`. `/bkit-build` reads that report for test-first (§ Test-first). Not seeded (no default runs one file on every stack); the `test-file-script-missing` advisory (install, `bkit check`, `bkit upgrade`) hands over the line until it is declared. Call the runner directly: a task runner that caches results or runs dependent packages first breaks the one-file contract.
|
|
1404
1404
|
|
|
1405
1405
|
Agents and humans run the same scripts, so a green agent gate and a green `git push` mean the same thing. `bkit-ci.yml` deliberately stays off them: it needs per-step reporting, affected-package conditionals, and the heavier tiers the local gate excludes, so it calls `pnpm typecheck` / `pnpm test` / … directly.
|
|
1406
1406
|
|
|
@@ -154,7 +154,7 @@ export function formatChecklist(
|
|
|
154
154
|
// Advisories artifact — `.bkit/advisories.md`
|
|
155
155
|
// ---------------------------------------------------------------------------
|
|
156
156
|
|
|
157
|
-
export type AdvisoriesMode = "install" | "check" | "doctor";
|
|
157
|
+
export type AdvisoriesMode = "install" | "check" | "upgrade" | "doctor";
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
160
|
* Render findings as a markdown artifact suitable for `.bkit/advisories.md`.
|
|
@@ -182,7 +182,7 @@ export function renderAdvisoriesMarkdown(
|
|
|
182
182
|
lines.push(`_Mode: ${opts.mode}_`);
|
|
183
183
|
lines.push("");
|
|
184
184
|
lines.push(
|
|
185
|
-
"> Auto-generated by `bkit install` / `bkit check` / `bkit doctor`. Overwritten on each run.",
|
|
185
|
+
"> Auto-generated by `bkit install` / `bkit check` / `bkit upgrade` / `bkit doctor`. Overwritten on each run.",
|
|
186
186
|
);
|
|
187
187
|
lines.push("");
|
|
188
188
|
|
|
@@ -243,18 +243,40 @@ export function refreshPreflightAfterWrites(
|
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
/**
|
|
246
|
+
/**
|
|
247
|
+
* The advisory pass that closes a real `bkit upgrade`: `bkit check`'s read-only pipeline
|
|
248
|
+
* under upgrade's log prefix, printing the checklist and rewriting `.bkit/advisories.md`
|
|
249
|
+
* (mode `upgrade`). Never exits — blockers and drift are reported, upgrade keeps its own
|
|
250
|
+
* exit code.
|
|
251
|
+
*/
|
|
252
|
+
export function runUpgradeAdvisories(): Promise<void> {
|
|
253
|
+
return runInstall(
|
|
254
|
+
{
|
|
255
|
+
verb: "check",
|
|
256
|
+
modules: new Set(),
|
|
257
|
+
tracker: null,
|
|
258
|
+
cloudVariant: null,
|
|
259
|
+
opencodeProvider: null,
|
|
260
|
+
},
|
|
261
|
+
true,
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* `bkit install`, and `bkit check` (the same pipeline, dry-run). `upgradeReport` runs the
|
|
267
|
+
* check pipeline for runUpgradeAdvisories.
|
|
268
|
+
*/
|
|
247
269
|
export async function runInstall(
|
|
248
|
-
args: Pick<
|
|
249
|
-
ParsedArgs,
|
|
250
|
-
|
|
251
|
-
>,
|
|
270
|
+
args: Pick<ParsedArgs, "verb" | "modules" | "tracker" | "cloudVariant" | "opencodeProvider"> &
|
|
271
|
+
Partial<Pick<ParsedArgs, "uninstallFlags">>,
|
|
272
|
+
upgradeReport = false,
|
|
252
273
|
): Promise<void> {
|
|
253
274
|
const { verb, modules, tracker, cloudVariant, opencodeProvider, uninstallFlags } = args;
|
|
254
275
|
const dryRun = verb === "check";
|
|
255
|
-
if (dryRun) setLogPrefix("[bkit-check]");
|
|
276
|
+
if (dryRun && !upgradeReport) setLogPrefix("[bkit-check]");
|
|
256
277
|
|
|
257
|
-
if (
|
|
278
|
+
if (upgradeReport) console.log(`${LOG_PREFIX} Checking advisories (read-only)`);
|
|
279
|
+
else if (dryRun) console.log(`${LOG_PREFIX} Running in check (dry-run) mode`);
|
|
258
280
|
|
|
259
281
|
// `bkit check` scopes drift detection to what is INSTALLED (detected by sentinel files),
|
|
260
282
|
// not to a fixed full set. `install` keeps its explicit resolved set.
|
|
@@ -306,14 +328,25 @@ export async function runInstall(
|
|
|
306
328
|
console.log(`${LOG_PREFIX} Preflight blockers detected — aborting.`);
|
|
307
329
|
const blockerBanner = formatChecklist(blockers);
|
|
308
330
|
if (blockerBanner) console.log(blockerBanner);
|
|
331
|
+
if (upgradeReport) {
|
|
332
|
+
writeAdvisoriesArtifact(blockers, {
|
|
333
|
+
cwd: process.cwd(),
|
|
334
|
+
mode: "upgrade",
|
|
335
|
+
version: getInstallingVersion(),
|
|
336
|
+
logPrefix: LOG_PREFIX,
|
|
337
|
+
});
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
309
340
|
process.exit(1);
|
|
310
341
|
}
|
|
311
342
|
|
|
312
343
|
// Resolve tokens once for the whole install
|
|
313
344
|
const tokens = await resolveTokens(process.cwd()).catch((err: unknown) => {
|
|
314
345
|
console.error(`${LOG_PREFIX} Token resolution failed: ${(err as Error).message}`);
|
|
315
|
-
process.exit(1);
|
|
346
|
+
if (!upgradeReport) process.exit(1);
|
|
347
|
+
return undefined;
|
|
316
348
|
});
|
|
349
|
+
if (tokens === undefined) return;
|
|
317
350
|
|
|
318
351
|
// Parse model lookup (needed for cursor transforms).
|
|
319
352
|
// DEFAULTS come from the PACKAGE's .bkit/prompts.md § Models (authoritative, matches the
|
|
@@ -555,7 +588,7 @@ export async function runInstall(
|
|
|
555
588
|
if (banner) console.log(banner);
|
|
556
589
|
writeAdvisoriesArtifact(postFindings, {
|
|
557
590
|
cwd: process.cwd(),
|
|
558
|
-
mode: dryRun ? "check" : "install",
|
|
591
|
+
mode: upgradeReport ? "upgrade" : dryRun ? "check" : "install",
|
|
559
592
|
version: getInstallingVersion(),
|
|
560
593
|
logPrefix: LOG_PREFIX,
|
|
561
594
|
suppressed,
|
|
@@ -564,7 +597,7 @@ export async function runInstall(
|
|
|
564
597
|
|
|
565
598
|
// Check mode: exit 1 on drift (see reportCheckDrift).
|
|
566
599
|
if (dryRun) {
|
|
567
|
-
reportCheckDrift(postFindings, totalWrites, missingHooks);
|
|
600
|
+
if (!upgradeReport) reportCheckDrift(postFindings, totalWrites, missingHooks);
|
|
568
601
|
return;
|
|
569
602
|
}
|
|
570
603
|
|
|
@@ -579,7 +612,7 @@ export async function runInstall(
|
|
|
579
612
|
`${LOG_PREFIX} ${phase3Blockers.length} Phase 3 blocker(s) detected. Recovery:\n ${recoveryLine}`,
|
|
580
613
|
);
|
|
581
614
|
// P2.T10: --auto-revert: run uninstall in-process before exit-1
|
|
582
|
-
if (uninstallFlags
|
|
615
|
+
if (uninstallFlags?.autoRevert) {
|
|
583
616
|
console.log(`${LOG_PREFIX} --auto-revert: reverting install...`);
|
|
584
617
|
const uninstallCtx: UninstallContext = {
|
|
585
618
|
cwd: process.cwd(),
|
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
getInstallingVersion,
|
|
47
47
|
requireOpencodeProvider,
|
|
48
48
|
detectOpencodeProviders,
|
|
49
|
+
runUpgradeAdvisories,
|
|
49
50
|
} from "./install.js";
|
|
50
51
|
import { setLogPrefix } from "../../shared/log-prefix.js";
|
|
51
52
|
import {
|
|
@@ -1032,6 +1033,9 @@ export async function runUpgradeCommand(upgradeFlags: UpgradeFlags): Promise<voi
|
|
|
1032
1033
|
`${LOG_PREFIX} Done. updated: ${result.updated.length}, skipped: ${result.skipped.length}, conflicts: ${result.conflicts.length}, re-rendered: ${rendered.length}`,
|
|
1033
1034
|
);
|
|
1034
1035
|
|
|
1036
|
+
// `.bkit/advisories.md` describes the upgraded repo, not the last install or check.
|
|
1037
|
+
if (!upgradeFlags.dryRun) await runUpgradeAdvisories();
|
|
1038
|
+
|
|
1035
1039
|
// Non-interactive mode: exit non-zero on conflicts
|
|
1036
1040
|
if (upgradeFlags.nonInteractive && result.conflicts.length > 0) {
|
|
1037
1041
|
process.exit(1);
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// GITHUB_ACTIONS or CI truthy GITHUB_ACTION
|
|
19
19
|
// otherwise LOCAL
|
|
20
20
|
//
|
|
21
|
-
// `runtimeHeadless` (no human
|
|
21
|
+
// `runtimeHeadless` (no human can reply into the session) is derived from `runtime`, never
|
|
22
22
|
// stored on the row.
|
|
23
23
|
|
|
24
24
|
import * as fs from "node:fs";
|
|
@@ -112,9 +112,8 @@ export function classify(env: NodeJS.ProcessEnv, root: string, log: (m: string)
|
|
|
112
112
|
const capable = (runtime: Runtime) =>
|
|
113
113
|
runtime === "LOCAL" || runtime === "GITHUB_ACTION" || runtime === "CLOUD_CURSOR";
|
|
114
114
|
|
|
115
|
-
/** No human
|
|
116
|
-
const headless = (runtime: unknown) =>
|
|
117
|
-
runtime === "GITHUB_ACTION" || runtime === "CLOUD_CURSOR" || runtime === "UNKNOWN";
|
|
115
|
+
/** No human can reply into the session: a GitHub Actions run. */
|
|
116
|
+
const headless = (runtime: unknown) => runtime === "GITHUB_ACTION";
|
|
118
117
|
|
|
119
118
|
/** The full table: classification, default capabilities, and the one live gh probe. */
|
|
120
119
|
export function detect(cwd: string, root: string, log: (m: string) => void): RuntimeTable {
|
|
@@ -176,8 +175,7 @@ const TABLE_OUTPUT = {
|
|
|
176
175
|
runtime: RUNTIMES.join(" | "),
|
|
177
176
|
runtimeWorktrees: "may mint git worktrees (default per runtime)",
|
|
178
177
|
runtimeDevPushes: "may push dev (a default, never probed)",
|
|
179
|
-
runtimeHeadless:
|
|
180
|
-
"no human attends the session (GITHUB_ACTION | CLOUD_CURSOR | UNKNOWN); derived from runtime",
|
|
178
|
+
runtimeHeadless: "no human can reply into the session (GITHUB_ACTION only); derived from runtime",
|
|
181
179
|
runtimeGithubCli: "gh auth status succeeded",
|
|
182
180
|
runtimeGithubCliExit: "gh auth status exit code (127 when gh is not on PATH)",
|
|
183
181
|
runtimeGithubCliErr: "last non-empty line of gh auth status stderr",
|
|
@@ -275,8 +275,8 @@ export const BKIT_BUILD_GATES: readonly string[] = [
|
|
|
275
275
|
/**
|
|
276
276
|
* Runs ONE test file — `pnpm bkit:test:file <repo-relative path>` — and writes a JUnit
|
|
277
277
|
* report to `$BKIT_TEST_REPORT`. `/bkit-build` records each task's red and audits its
|
|
278
|
-
* green through it. Never seeded: no default works on every stack; install
|
|
279
|
-
* when it is missing (detectGateAdvisories).
|
|
278
|
+
* green through it. Never seeded: no default works on every stack; install, check and
|
|
279
|
+
* upgrade advise when it is missing (detectGateAdvisories).
|
|
280
280
|
*/
|
|
281
281
|
export const BKIT_TEST_FILE_SCRIPT = "bkit:test:file";
|
|
282
282
|
|
|
@@ -361,8 +361,11 @@ const PNPM_NOT_A_SCRIPT = new Set([
|
|
|
361
361
|
|
|
362
362
|
/**
|
|
363
363
|
* Advisories for the `bkit:gate:*` scripts: the scripts a still-default gate
|
|
364
|
-
* chains that package.json does not declare,
|
|
365
|
-
* but no gate runs
|
|
364
|
+
* chains that package.json does not declare, the deeper test tiers the repo has
|
|
365
|
+
* but no gate runs, and a missing `bkit:test:file`. Judges the scripts as install
|
|
366
|
+
* leaves them (missing gate names at their seeded defaults), so install, `bkit check`
|
|
367
|
+
* and `bkit upgrade` report the same set. Read-only; an absent or unparseable
|
|
368
|
+
* package.json yields none.
|
|
366
369
|
*/
|
|
367
370
|
export function detectGateAdvisories(cwd: string): PreflightFinding[] {
|
|
368
371
|
let declared: Record<string, string>;
|
|
@@ -370,7 +373,7 @@ export function detectGateAdvisories(cwd: string): PreflightFinding[] {
|
|
|
370
373
|
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, "package.json"), "utf-8")) as {
|
|
371
374
|
scripts?: Record<string, string>;
|
|
372
375
|
};
|
|
373
|
-
declared = pkg.scripts
|
|
376
|
+
declared = { ...BKIT_GATE_SCRIPTS, ...pkg.scripts };
|
|
374
377
|
} catch {
|
|
375
378
|
// Absent or malformed package.json — preflight's no-package-json /
|
|
376
379
|
// malformed-package-json blockers already report it.
|
|
@@ -386,7 +389,7 @@ export function detectGateAdvisories(cwd: string): PreflightFinding[] {
|
|
|
386
389
|
if (declared[name] !== seeded) continue;
|
|
387
390
|
for (const [, called] of seeded.matchAll(/\bpnpm ([\w:-]+)/g)) {
|
|
388
391
|
if (PNPM_NOT_A_SCRIPT.has(called)) continue;
|
|
389
|
-
if (!(called in declared)
|
|
392
|
+
if (!(called in declared)) missing.add(called);
|
|
390
393
|
}
|
|
391
394
|
}
|
|
392
395
|
if (missing.size > 0) {
|
|
@@ -447,7 +450,7 @@ export function isNoopScript(value: string): boolean {
|
|
|
447
450
|
|
|
448
451
|
/**
|
|
449
452
|
* Advisory for every `bkit:gate:*` script that is empty or a no-op: it checks nothing,
|
|
450
|
-
* so every agent run and push passes it. Warn-only, at install and `bkit
|
|
453
|
+
* so every agent run and push passes it. Warn-only, at install, `bkit check` and `bkit upgrade`, on
|
|
451
454
|
* every branch. Read-only; an absent or unparseable package.json yields none.
|
|
452
455
|
*/
|
|
453
456
|
export function detectNoopGates(cwd: string): PreflightFinding[] {
|
|
@@ -550,7 +553,7 @@ export function runCoreModule(ctx: ModuleContext): void {
|
|
|
550
553
|
// 3c. The bkit:gate:* / bkit:deps:* package.json scripts (add-if-missing). The
|
|
551
554
|
// advisories read the result.
|
|
552
555
|
seedCorePackageJsonScripts(ctx);
|
|
553
|
-
|
|
556
|
+
advisories.push(...detectGateAdvisories(cwd));
|
|
554
557
|
advisories.push(...detectNoopGates(cwd));
|
|
555
558
|
|
|
556
559
|
// 4. .bkit/version write — deferred to postDispatch so it only persists when ALL modules succeed.
|
|
@@ -18,9 +18,8 @@ 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|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.
|
|
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.
|
|
24
23
|
#
|
|
25
24
|
# Required secrets (claude job): ANTHROPIC_API_KEY + Claude GitHub App (one-time
|
|
26
25
|
# `/install-github-app` — grants `id-token: write` OIDC for claude-code-action@v1).
|
|
@@ -43,6 +42,7 @@ on:
|
|
|
43
42
|
options:
|
|
44
43
|
- ship
|
|
45
44
|
- 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
|
-
# plan/build start from dev. NDJSON + `*.jsonl merge=union` keeps it merge-safe.
|
|
468
|
+
# design/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 (plan/build).
|
|
496
|
+
# PR number (ship/debug) or the tracker issue number/id (design/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
|
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,20 @@ Format: `## [version] — YYYY-MM-DD`
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [5.2.2] — 2026-10-15
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **`bkit check` and `bkit upgrade` report the gate advisories install reports** (#524). `test-file-script-missing`, `gate-missing-called-scripts` and `gate-tier-not-wired` ran only on a real install, so an upgraded repo never saw them. They now judge `package.json` as install leaves it and run in every mode. A real `bkit upgrade` ends with `bkit check`'s read-only pass: prints the checklist and rewrites `.bkit/advisories.md` (`Mode: upgrade`), so the upgrade paste block's "read `.bkit/advisories.md`" step reads current findings. Upgrade's exit code is unchanged.
|
|
16
|
+
|
|
17
|
+
## [5.2.1] — 2026-10-15
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **`/bkit-design` Grill interviews in every runtime except a GitHub Actions run.** `runtimeHeadless` is true only for `GITHUB_ACTION`; `CLOUD_CURSOR` and `UNKNOWN` now count as attended, so Grill asks and waits. `grill=false` still skips; `BKIT_RUNTIME` still overrides.
|
|
22
|
+
- **`bkit-cloud.yml` offers `design` again** in `workflow_dispatch`. A dispatched design runs headless: Grill records its recommended answers as `Assumed, not confirmed` instead of waiting.
|
|
23
|
+
- **Docs: why bkit ships no compression proxy** (#545). `.bkit/providers.md` and the README FAQ: caveman and Headroom saved ~1–3% of token cost on 456 real Claude Code transcripts, and Headroom's text model rewrote code; bkit narrows reads instead.
|
|
24
|
+
|
|
11
25
|
## [5.2.0] — 2026-10-15
|
|
12
26
|
|
|
13
27
|
### Added
|
package/README.md
CHANGED
|
@@ -224,6 +224,9 @@ No. [bkit Vibecoding Kit](https://github.com/popup-studio-ai/bkit-claude-code) i
|
|
|
224
224
|
**How does it compare with other tools?**
|
|
225
225
|
Feature by feature against the main AI development frameworks, from spec toolkits to autonomous agents: [`.bkit/comparison.md`](.bkit/comparison.md#part-3--compared-with-other-ai-development-frameworks).
|
|
226
226
|
|
|
227
|
+
**Why doesn't bkit ship a compression proxy like caveman or Headroom?**
|
|
228
|
+
We measured both on 456 real Claude Code transcripts. They saved about 1–3% of token cost. Both protect Claude's prompt cache, so they only shrink tool output as it arrives, and that output was 27% of the cost. Headroom's text model also rewrote code along the way. bkit cuts reading instead, which loses nothing: agents find the definition first and read only those lines, and a hook flags re-reads of files that haven't changed. Method, results and scripts to measure your own sessions: [the comparison](tests/compression/bkit-caveman-headroom-compression-proxy-comparison.md).
|
|
229
|
+
|
|
227
230
|
<details>
|
|
228
231
|
<summary><strong>For engineers: what's under the hood</strong></summary>
|
|
229
232
|
|
|
@@ -117,7 +117,7 @@ export function renderAdvisoriesMarkdown(findings, opts, suppressed = [], tips =
|
|
|
117
117
|
lines.push(`_bkit: ${opts.version}_ `);
|
|
118
118
|
lines.push(`_Mode: ${opts.mode}_`);
|
|
119
119
|
lines.push("");
|
|
120
|
-
lines.push("> Auto-generated by `bkit install` / `bkit check` / `bkit doctor`. Overwritten on each run.");
|
|
120
|
+
lines.push("> Auto-generated by `bkit install` / `bkit check` / `bkit upgrade` / `bkit doctor`. Overwritten on each run.");
|
|
121
121
|
lines.push("");
|
|
122
122
|
if (findings.length === 0 && suppressed.length === 0 && tips.length === 0) {
|
|
123
123
|
lines.push("**No advisories.** Last run was clean.");
|
|
@@ -196,13 +196,33 @@ export function refreshPreflightAfterWrites(modules, cwd, issueTracker, seedCoun
|
|
|
196
196
|
blockers: fresh.blockers,
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
|
-
/**
|
|
200
|
-
|
|
199
|
+
/**
|
|
200
|
+
* The advisory pass that closes a real `bkit upgrade`: `bkit check`'s read-only pipeline
|
|
201
|
+
* under upgrade's log prefix, printing the checklist and rewriting `.bkit/advisories.md`
|
|
202
|
+
* (mode `upgrade`). Never exits — blockers and drift are reported, upgrade keeps its own
|
|
203
|
+
* exit code.
|
|
204
|
+
*/
|
|
205
|
+
export function runUpgradeAdvisories() {
|
|
206
|
+
return runInstall({
|
|
207
|
+
verb: "check",
|
|
208
|
+
modules: new Set(),
|
|
209
|
+
tracker: null,
|
|
210
|
+
cloudVariant: null,
|
|
211
|
+
opencodeProvider: null,
|
|
212
|
+
}, true);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* `bkit install`, and `bkit check` (the same pipeline, dry-run). `upgradeReport` runs the
|
|
216
|
+
* check pipeline for runUpgradeAdvisories.
|
|
217
|
+
*/
|
|
218
|
+
export async function runInstall(args, upgradeReport = false) {
|
|
201
219
|
const { verb, modules, tracker, cloudVariant, opencodeProvider, uninstallFlags } = args;
|
|
202
220
|
const dryRun = verb === "check";
|
|
203
|
-
if (dryRun)
|
|
221
|
+
if (dryRun && !upgradeReport)
|
|
204
222
|
setLogPrefix("[bkit-check]");
|
|
205
|
-
if (
|
|
223
|
+
if (upgradeReport)
|
|
224
|
+
console.log(`${LOG_PREFIX} Checking advisories (read-only)`);
|
|
225
|
+
else if (dryRun)
|
|
206
226
|
console.log(`${LOG_PREFIX} Running in check (dry-run) mode`);
|
|
207
227
|
// `bkit check` scopes drift detection to what is INSTALLED (detected by sentinel files),
|
|
208
228
|
// not to a fixed full set. `install` keeps its explicit resolved set.
|
|
@@ -247,13 +267,26 @@ export async function runInstall(args) {
|
|
|
247
267
|
const blockerBanner = formatChecklist(blockers);
|
|
248
268
|
if (blockerBanner)
|
|
249
269
|
console.log(blockerBanner);
|
|
270
|
+
if (upgradeReport) {
|
|
271
|
+
writeAdvisoriesArtifact(blockers, {
|
|
272
|
+
cwd: process.cwd(),
|
|
273
|
+
mode: "upgrade",
|
|
274
|
+
version: getInstallingVersion(),
|
|
275
|
+
logPrefix: LOG_PREFIX,
|
|
276
|
+
});
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
250
279
|
process.exit(1);
|
|
251
280
|
}
|
|
252
281
|
// Resolve tokens once for the whole install
|
|
253
282
|
const tokens = await resolveTokens(process.cwd()).catch((err) => {
|
|
254
283
|
console.error(`${LOG_PREFIX} Token resolution failed: ${err.message}`);
|
|
255
|
-
|
|
284
|
+
if (!upgradeReport)
|
|
285
|
+
process.exit(1);
|
|
286
|
+
return undefined;
|
|
256
287
|
});
|
|
288
|
+
if (tokens === undefined)
|
|
289
|
+
return;
|
|
257
290
|
// Parse model lookup (needed for cursor transforms).
|
|
258
291
|
// DEFAULTS come from the PACKAGE's .bkit/prompts.md § Models (authoritative, matches the
|
|
259
292
|
// prompt files about to be installed).
|
|
@@ -475,7 +508,7 @@ export async function runInstall(args) {
|
|
|
475
508
|
console.log(banner);
|
|
476
509
|
writeAdvisoriesArtifact(postFindings, {
|
|
477
510
|
cwd: process.cwd(),
|
|
478
|
-
mode: dryRun ? "check" : "install",
|
|
511
|
+
mode: upgradeReport ? "upgrade" : dryRun ? "check" : "install",
|
|
479
512
|
version: getInstallingVersion(),
|
|
480
513
|
logPrefix: LOG_PREFIX,
|
|
481
514
|
suppressed,
|
|
@@ -483,7 +516,8 @@ export async function runInstall(args) {
|
|
|
483
516
|
});
|
|
484
517
|
// Check mode: exit 1 on drift (see reportCheckDrift).
|
|
485
518
|
if (dryRun) {
|
|
486
|
-
|
|
519
|
+
if (!upgradeReport)
|
|
520
|
+
reportCheckDrift(postFindings, totalWrites, missingHooks);
|
|
487
521
|
return;
|
|
488
522
|
}
|
|
489
523
|
// P2.T9: exit-1 on Phase 3 blockers + recovery action text.
|
|
@@ -495,7 +529,7 @@ export async function runInstall(args) {
|
|
|
495
529
|
const recoveryLine = `pnpm bkit uninstall ${recoveryFlags} && <fix the issue> && pnpm bkit install ${recoveryFlags}`;
|
|
496
530
|
console.error(`${LOG_PREFIX} ${phase3Blockers.length} Phase 3 blocker(s) detected. Recovery:\n ${recoveryLine}`);
|
|
497
531
|
// P2.T10: --auto-revert: run uninstall in-process before exit-1
|
|
498
|
-
if (uninstallFlags
|
|
532
|
+
if (uninstallFlags?.autoRevert) {
|
|
499
533
|
console.log(`${LOG_PREFIX} --auto-revert: reverting install...`);
|
|
500
534
|
const uninstallCtx = {
|
|
501
535
|
cwd: process.cwd(),
|
|
@@ -26,7 +26,7 @@ import { detectMarkerStyle } from "../../install/managed-block.js";
|
|
|
26
26
|
import { applyTokens, resolveTokens } from "../../install/placeholders.js";
|
|
27
27
|
import { readTemplate } from "../../render/parts.js";
|
|
28
28
|
import { TEMPLATE_COPIES_DIR, getCoreRoot, getSharedRoot, getBkitDocsRoot, getPkgRoot, } from "../../shared/package-roots.js";
|
|
29
|
-
import { getInstallingVersion, requireOpencodeProvider, detectOpencodeProviders, } from "./install.js";
|
|
29
|
+
import { getInstallingVersion, requireOpencodeProvider, detectOpencodeProviders, runUpgradeAdvisories, } from "./install.js";
|
|
30
30
|
import { setLogPrefix } from "../../shared/log-prefix.js";
|
|
31
31
|
import { getInstallManifest, getModuleManifest, DEFAULT_ISSUE_TRACKER, parseIssueTracker, } from "../../install/manifest.js";
|
|
32
32
|
import { OPTIN_MODULES } from "../../install/manifest.js";
|
|
@@ -773,6 +773,9 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
console.log(`${LOG_PREFIX} Done. updated: ${result.updated.length}, skipped: ${result.skipped.length}, conflicts: ${result.conflicts.length}, re-rendered: ${rendered.length}`);
|
|
776
|
+
// `.bkit/advisories.md` describes the upgraded repo, not the last install or check.
|
|
777
|
+
if (!upgradeFlags.dryRun)
|
|
778
|
+
await runUpgradeAdvisories();
|
|
776
779
|
// Non-interactive mode: exit non-zero on conflicts
|
|
777
780
|
if (upgradeFlags.nonInteractive && result.conflicts.length > 0) {
|
|
778
781
|
process.exit(1);
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// GITHUB_ACTIONS or CI truthy GITHUB_ACTION
|
|
19
19
|
// otherwise LOCAL
|
|
20
20
|
//
|
|
21
|
-
// `runtimeHeadless` (no human
|
|
21
|
+
// `runtimeHeadless` (no human can reply into the session) is derived from `runtime`, never
|
|
22
22
|
// stored on the row.
|
|
23
23
|
import * as fs from "node:fs";
|
|
24
24
|
import * as path from "node:path";
|
|
@@ -85,8 +85,8 @@ export function classify(env, root, log) {
|
|
|
85
85
|
* session's proxy only lets it push the current branch, so it gets neither.
|
|
86
86
|
*/
|
|
87
87
|
const capable = (runtime) => runtime === "LOCAL" || runtime === "GITHUB_ACTION" || runtime === "CLOUD_CURSOR";
|
|
88
|
-
/** No human
|
|
89
|
-
const headless = (runtime) => runtime === "GITHUB_ACTION"
|
|
88
|
+
/** No human can reply into the session: a GitHub Actions run. */
|
|
89
|
+
const headless = (runtime) => runtime === "GITHUB_ACTION";
|
|
90
90
|
/** The full table: classification, default capabilities, and the one live gh probe. */
|
|
91
91
|
export function detect(cwd, root, log) {
|
|
92
92
|
const runtime = classify(process.env, root, log);
|
|
@@ -141,7 +141,7 @@ const TABLE_OUTPUT = {
|
|
|
141
141
|
runtime: RUNTIMES.join(" | "),
|
|
142
142
|
runtimeWorktrees: "may mint git worktrees (default per runtime)",
|
|
143
143
|
runtimeDevPushes: "may push dev (a default, never probed)",
|
|
144
|
-
runtimeHeadless: "no human
|
|
144
|
+
runtimeHeadless: "no human can reply into the session (GITHUB_ACTION only); derived from runtime",
|
|
145
145
|
runtimeGithubCli: "gh auth status succeeded",
|
|
146
146
|
runtimeGithubCliExit: "gh auth status exit code (127 when gh is not on PATH)",
|
|
147
147
|
runtimeGithubCliErr: "last non-empty line of gh auth status stderr",
|
package/dist/install/manifest.js
CHANGED
|
@@ -220,8 +220,8 @@ export const BKIT_BUILD_GATES = [
|
|
|
220
220
|
/**
|
|
221
221
|
* Runs ONE test file — `pnpm bkit:test:file <repo-relative path>` — and writes a JUnit
|
|
222
222
|
* report to `$BKIT_TEST_REPORT`. `/bkit-build` records each task's red and audits its
|
|
223
|
-
* green through it. Never seeded: no default works on every stack; install
|
|
224
|
-
* when it is missing (detectGateAdvisories).
|
|
223
|
+
* green through it. Never seeded: no default works on every stack; install, check and
|
|
224
|
+
* upgrade advise when it is missing (detectGateAdvisories).
|
|
225
225
|
*/
|
|
226
226
|
export const BKIT_TEST_FILE_SCRIPT = "bkit:test:file";
|
|
227
227
|
/**
|
|
@@ -291,14 +291,17 @@ const PNPM_NOT_A_SCRIPT = new Set([
|
|
|
291
291
|
]);
|
|
292
292
|
/**
|
|
293
293
|
* Advisories for the `bkit:gate:*` scripts: the scripts a still-default gate
|
|
294
|
-
* chains that package.json does not declare,
|
|
295
|
-
* but no gate runs
|
|
294
|
+
* chains that package.json does not declare, the deeper test tiers the repo has
|
|
295
|
+
* but no gate runs, and a missing `bkit:test:file`. Judges the scripts as install
|
|
296
|
+
* leaves them (missing gate names at their seeded defaults), so install, `bkit check`
|
|
297
|
+
* and `bkit upgrade` report the same set. Read-only; an absent or unparseable
|
|
298
|
+
* package.json yields none.
|
|
296
299
|
*/
|
|
297
300
|
export function detectGateAdvisories(cwd) {
|
|
298
301
|
let declared;
|
|
299
302
|
try {
|
|
300
303
|
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, "package.json"), "utf-8"));
|
|
301
|
-
declared = pkg.scripts
|
|
304
|
+
declared = { ...BKIT_GATE_SCRIPTS, ...pkg.scripts };
|
|
302
305
|
}
|
|
303
306
|
catch {
|
|
304
307
|
// Absent or malformed package.json — preflight's no-package-json /
|
|
@@ -316,7 +319,7 @@ export function detectGateAdvisories(cwd) {
|
|
|
316
319
|
for (const [, called] of seeded.matchAll(/\bpnpm ([\w:-]+)/g)) {
|
|
317
320
|
if (PNPM_NOT_A_SCRIPT.has(called))
|
|
318
321
|
continue;
|
|
319
|
-
if (!(called in declared)
|
|
322
|
+
if (!(called in declared))
|
|
320
323
|
missing.add(called);
|
|
321
324
|
}
|
|
322
325
|
}
|
|
@@ -372,7 +375,7 @@ export function isNoopScript(value) {
|
|
|
372
375
|
}
|
|
373
376
|
/**
|
|
374
377
|
* Advisory for every `bkit:gate:*` script that is empty or a no-op: it checks nothing,
|
|
375
|
-
* so every agent run and push passes it. Warn-only, at install and `bkit
|
|
378
|
+
* so every agent run and push passes it. Warn-only, at install, `bkit check` and `bkit upgrade`, on
|
|
376
379
|
* every branch. Read-only; an absent or unparseable package.json yields none.
|
|
377
380
|
*/
|
|
378
381
|
export function detectNoopGates(cwd) {
|
|
@@ -465,8 +468,7 @@ export function runCoreModule(ctx) {
|
|
|
465
468
|
// 3c. The bkit:gate:* / bkit:deps:* package.json scripts (add-if-missing). The
|
|
466
469
|
// advisories read the result.
|
|
467
470
|
seedCorePackageJsonScripts(ctx);
|
|
468
|
-
|
|
469
|
-
advisories.push(...detectGateAdvisories(cwd));
|
|
471
|
+
advisories.push(...detectGateAdvisories(cwd));
|
|
470
472
|
advisories.push(...detectNoopGates(cwd));
|
|
471
473
|
// 4. .bkit/version write — deferred to postDispatch so it only persists when ALL modules succeed.
|
|
472
474
|
// This ensures a mid-install crash in a subsequent module does not suppress the first-install
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cbartens/bkit",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.2",
|
|
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": [
|