@cbartens/bkit 5.0.3 → 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.
- package/.bkit/README.md +14 -10
- package/.bkit/core/.agents/docs.md +1 -0
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-gateguard.cjs +93 -0
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +137 -0
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-readguard.cjs +72 -0
- package/.bkit/core/.agents/rules.md +10 -6
- package/.bkit/core/.agents/shortcuts.md +73 -0
- package/.bkit/core/.agents/skills.md +5 -3
- package/.bkit/core/.bkit/LICENSE.md +18 -140
- package/.bkit/core/.bkit/README.md +13 -9
- package/.bkit/core/.bkit/cloud.md +12 -15
- package/.bkit/core/.bkit/comparison.md +68 -16
- package/.bkit/core/.bkit/install.md +36 -11
- package/.bkit/core/.bkit/jsonl.md +0 -1
- package/.bkit/core/.bkit/prompts.md +83 -81
- package/.bkit/core/.bkit/providers.md +110 -28
- package/.bkit/core/.bkit/templates.md +42 -13
- package/.bkit/core/.bkit/workflows.md +64 -42
- package/.bkit/core/.claude/hooks/bkit-gateguard.cjs +4 -3
- package/.bkit/core/.claude/hooks/bkit-readguard.cjs +60 -0
- package/.bkit/core/.codex/hooks/bkit-gateguard.cjs +8 -6
- package/.bkit/core/.codex/hooks/bkit-readguard.cjs +58 -0
- package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +12 -19
- package/.bkit/core/.cursor/hooks/bkit-readguard.cjs +59 -0
- package/.bkit/core/.opencode/plugin/bkit-gateguard.js +73 -22
- package/.bkit/core/.opencode/plugin/bkit-readguard.js +126 -0
- package/.bkit/core/AGENTS.md +11 -0
- package/.bkit/core/docs/templates/bkit-audit-adoption.md +2 -2
- package/.bkit/core/docs/templates/bkit-plan.md +6 -3
- package/.bkit/core/engine/checks/after/auth.ts +32 -0
- package/.bkit/core/engine/checks/after/github.ts +4 -4
- package/.bkit/core/engine/checks/after/index.ts +36 -50
- package/.bkit/core/engine/checks/after/managed.ts +44 -1
- package/.bkit/core/engine/checks/before/index.ts +5 -4
- package/.bkit/core/engine/checks/before/mcp.ts +60 -54
- package/.bkit/core/engine/checks/status-holes.ts +1 -1
- package/.bkit/core/engine/checks/tips/catalogue.ts +356 -0
- package/.bkit/core/engine/checks/tips/detect.ts +144 -0
- package/.bkit/core/engine/checks/tips/index.ts +174 -0
- package/.bkit/core/engine/cli.ts +82 -18
- package/.bkit/core/engine/commands/install/check.ts +2 -0
- package/.bkit/core/engine/commands/install/doctor.ts +14 -1
- package/.bkit/core/engine/commands/install/install.ts +59 -9
- package/.bkit/core/engine/commands/install/uninstall.ts +59 -34
- package/.bkit/core/engine/commands/install/upgrade.ts +30 -28
- package/.bkit/core/engine/commands/launch.ts +33 -11
- package/.bkit/core/engine/commands/tips.ts +16 -0
- package/.bkit/core/engine/commands/workflow/prs.ts +20 -2
- package/.bkit/core/engine/commands/workflow/runs.ts +82 -18
- package/.bkit/core/engine/commands/workflow/runtime.ts +12 -0
- package/.bkit/core/engine/commands/workflow/steps.ts +1 -0
- package/.bkit/core/engine/commands/workflow/tests.ts +647 -4
- package/.bkit/core/engine/commands/workflow/workstreams.ts +4 -4
- package/.bkit/core/engine/install/cloud-env.ts +7 -21
- package/.bkit/core/engine/install/hosts.ts +21 -0
- package/.bkit/core/engine/install/managed-block.ts +36 -0
- package/.bkit/core/engine/install/manifest.ts +83 -5
- package/.bkit/core/engine/install/modules/antigravity.ts +266 -0
- package/.bkit/core/engine/install/modules/claude.ts +6 -6
- package/.bkit/core/engine/install/modules/cloud.ts +2 -2
- package/.bkit/core/engine/install/modules/codex.ts +8 -5
- package/.bkit/core/engine/install/modules/core.ts +30 -10
- package/.bkit/core/engine/install/modules/cursor.ts +6 -6
- package/.bkit/core/engine/install/modules/index.ts +33 -6
- package/.bkit/core/engine/install/modules/opencode.ts +4 -4
- package/.bkit/core/engine/install/payload-links.ts +6 -10
- package/.bkit/core/engine/install/placeholders.ts +1 -1
- package/.bkit/core/engine/install/version-file.ts +17 -9
- package/.bkit/core/engine/install/write.ts +68 -1
- package/.bkit/core/engine/ledgers/telemetry.ts +0 -2
- package/.bkit/core/engine/render/hosts.ts +174 -1
- package/.bkit/core/engine/render/models.ts +10 -0
- package/.bkit/core/engine/shared/package-roots.ts +8 -10
- package/.bkit/core/hooks/antigravity-hook.js +67 -0
- package/.bkit/core/hooks/gateguard-edit-payload.js +4 -4
- package/.bkit/core/hooks/gateguard-engine.js +16 -6
- package/.bkit/core/hooks/guardrails-read.js +23 -0
- package/.bkit/core/hooks/readguard-engine.js +259 -0
- package/.bkit/core/hooks/readguard-payload.js +67 -0
- package/.bkit/core/prompts/bkit-audit-generate.md +2 -1
- package/.bkit/core/prompts/bkit-build-challenge-1.md +2 -1
- package/.bkit/core/prompts/bkit-build-challenge-2.md +2 -1
- package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +2 -1
- package/.bkit/core/prompts/bkit-build-challenge-remediate.md +2 -1
- package/.bkit/core/prompts/bkit-build-challenge-tests.md +2 -1
- package/.bkit/core/prompts/bkit-build-install-skills.md +7 -5
- package/.bkit/core/prompts/bkit-build-plan-current.md +2 -1
- package/.bkit/core/prompts/bkit-build-plan-execute.md +6 -2
- package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +2 -1
- package/.bkit/core/prompts/bkit-build-plan-verify.md +12 -4
- package/.bkit/core/prompts/bkit-build-summary.md +2 -1
- package/.bkit/core/prompts/bkit-debug-abort-handover.md +2 -1
- package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +2 -1
- package/.bkit/core/prompts/bkit-debug-failure-remediate.md +2 -1
- package/.bkit/core/prompts/bkit-debug-failure-soak.md +2 -1
- package/.bkit/core/prompts/bkit-debug-summary.md +2 -1
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +2 -1
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +2 -1
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +2 -1
- package/.bkit/core/prompts/bkit-design-generate.md +10 -5
- package/.bkit/core/prompts/bkit-design-organise.md +2 -1
- package/.bkit/core/prompts/bkit-design-review-1.md +2 -1
- package/.bkit/core/prompts/bkit-design-review-2.md +2 -1
- package/.bkit/core/prompts/bkit-design-spike.md +2 -1
- package/.bkit/core/prompts/bkit-design-summary.md +2 -1
- package/.bkit/core/prompts/bkit-design-update.md +2 -1
- package/.bkit/core/prompts/bkit-plan-complexity-check.md +2 -1
- package/.bkit/core/prompts/bkit-plan-complexity-split.md +4 -3
- package/.bkit/core/prompts/bkit-plan-generate.md +2 -1
- package/.bkit/core/prompts/bkit-plan-review-1.md +2 -1
- package/.bkit/core/prompts/bkit-plan-review-2.md +2 -1
- package/.bkit/core/prompts/bkit-plan-review-3.md +2 -1
- package/.bkit/core/prompts/bkit-plan-scope-check-1.md +3 -2
- package/.bkit/core/prompts/bkit-plan-scope-check-2.md +3 -2
- package/.bkit/core/prompts/bkit-plan-summary.md +2 -1
- package/.bkit/core/prompts/bkit-plan-update.md +3 -2
- package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +2 -1
- package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +2 -1
- package/.bkit/core/prompts/bkit-ship-summary.md +2 -1
- package/.bkit/core/prompts/bkit-ship-update-docs.md +2 -1
- package/.bkit/core/prompts/bkit-utility-compress-markdown.md +2 -1
- package/.bkit/core/prompts/bkit-utility-update-decisions.md +2 -1
- package/.bkit/core/prompts/bkit-utility-update-deferrals.md +2 -1
- package/.bkit/core/prompts/bkit-utility-update-documentation.md +2 -1
- package/.bkit/core/prompts/bkit-utility-update-failures.md +2 -1
- package/.bkit/core/prompts/bkit-utility-update-knowledge.md +2 -1
- package/.bkit/core/prompts/bkit-utility-update-roadmap.md +4 -3
- package/.bkit/core/workflows/bkit-auto.md +1 -1
- package/.bkit/core/workflows/bkit-build.md +35 -21
- package/.bkit/core/workflows/bkit-debug.md +31 -22
- package/.bkit/core/workflows/bkit-design.md +83 -38
- package/.bkit/core/workflows/bkit-plan.md +10 -2
- package/.bkit/core/workflows/bkit-ship.md +10 -2
- package/.bkit/shared/.agents/plugins/bkit/hooks.json +36 -0
- package/.bkit/shared/.agents/plugins/bkit/plugin.json +5 -0
- package/.bkit/shared/.claude/settings.json +19 -0
- package/.bkit/shared/.codex/hooks.json +21 -0
- package/.bkit/shared/.cursor/hooks.json +6 -1
- package/.bkit/shared/.opencode/opencode.json +1 -1
- package/.bkit/shared/GEMINI.md +11 -0
- package/.bkit/shared/docs/deployments.md +1 -1
- package/.bkit/shared/docs/security.md +3 -3
- package/.bkit/shared/docs/testing.md +12 -1
- package/.bkit/templates/.github/dependabot.yml +6 -0
- package/.bkit/templates/.github/renovate.json5 +3 -3
- package/.bkit/templates/.github/workflows/bkit-ci.yml +24 -13
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +5 -5
- package/.bkit/templates/.prettierignore +4 -1
- package/.bkit/templates/context/bkit-expo.md +22 -13
- package/.bkit/templates/context/bkit-github.md +20 -6
- package/.bkit/templates/context/bkit-inngest.md +10 -4
- package/.bkit/templates/context/bkit-maestro.md +5 -5
- package/.bkit/templates/context/bkit-playwright.md +3 -3
- package/.bkit/templates/context/bkit-sentry.md +6 -5
- package/.bkit/templates/context/bkit-stripe.md +31 -8
- package/.bkit/templates/scripts/ci/check-accepted-divergences.mjs +65 -19
- package/.bkit/templates/scripts/ci/check-accepted-divergences.test.mjs +34 -0
- package/.bkit/templates/scripts/ci/lanes/resolve-push-base.mjs +33 -12
- package/.bkit/templates/scripts/ci/lanes/resolve-push-base.test.mjs +54 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +2 -2
- package/.bkit/templates/scripts/launchd/bkit-launchd-env.sh +76 -6
- package/.bkit/templates/slop-scan.config.json +10 -3
- package/CHANGELOG.md +62 -0
- package/LICENSE.md +21 -161
- package/README.md +66 -35
- package/dist/checks/after/auth.js +28 -0
- package/dist/checks/after/github.js +4 -4
- package/dist/checks/after/index.js +29 -45
- package/dist/checks/after/managed.js +41 -1
- package/dist/checks/before/index.js +5 -4
- package/dist/checks/before/mcp.js +53 -53
- package/dist/checks/status-holes.js +1 -1
- package/dist/checks/tips/catalogue.js +297 -0
- package/dist/checks/tips/detect.js +130 -0
- package/dist/checks/tips/index.js +146 -0
- package/dist/cli.js +68 -17
- package/dist/commands/install/check.js +2 -0
- package/dist/commands/install/doctor.js +9 -1
- package/dist/commands/install/install.js +49 -8
- package/dist/commands/install/uninstall.js +61 -34
- package/dist/commands/install/upgrade.js +31 -33
- package/dist/commands/launch.js +27 -11
- package/dist/commands/tips.js +10 -0
- package/dist/commands/workflow/prs.js +13 -1
- package/dist/commands/workflow/runs.js +74 -18
- package/dist/commands/workflow/runtime.js +8 -0
- package/dist/commands/workflow/steps.js +1 -0
- package/dist/commands/workflow/tests.js +541 -4
- package/dist/commands/workflow/workstreams.js +4 -4
- package/dist/install/cloud-env.js +3 -14
- package/dist/install/hosts.js +22 -0
- package/dist/install/managed-block.js +36 -0
- package/dist/install/manifest.js +79 -4
- package/dist/install/modules/antigravity.js +225 -0
- package/dist/install/modules/claude.js +6 -6
- package/dist/install/modules/cloud.js +2 -2
- package/dist/install/modules/codex.js +8 -5
- package/dist/install/modules/core.js +21 -6
- package/dist/install/modules/cursor.js +6 -6
- package/dist/install/modules/index.js +17 -6
- package/dist/install/modules/opencode.js +4 -4
- package/dist/install/payload-links.js +5 -5
- package/dist/install/placeholders.js +1 -1
- package/dist/install/version-file.js +12 -3
- package/dist/install/write.js +61 -2
- package/dist/render/hosts.js +149 -1
- package/dist/render/models.js +9 -0
- package/dist/shared/package-roots.js +8 -11
- package/package.json +8 -8
- package/.bkit/core/LICENSE.md +0 -149
- package/.bkit/shared/LICENSE.md +0 -22
- package/.bkit/templates/LICENSE.md +0 -22
|
@@ -166,6 +166,7 @@ const CORE_TEMPLATE_DOCTRINE = [
|
|
|
166
166
|
{ path: ".agents/context.md", format: "markered-text", module: "core" },
|
|
167
167
|
{ path: ".agents/docs.md", format: "markered-text", module: "core" },
|
|
168
168
|
{ path: ".agents/rules.md", format: "markered-text", module: "core" },
|
|
169
|
+
{ path: ".agents/shortcuts.md", format: "markered-text", module: "core" },
|
|
169
170
|
{ path: ".agents/skills.md", format: "markered-text", module: "core" },
|
|
170
171
|
];
|
|
171
172
|
/**
|
|
@@ -195,7 +196,7 @@ export function buildDecisionTable(modules, ctx) {
|
|
|
195
196
|
const moduleList = modules instanceof Set
|
|
196
197
|
? [...modules].filter((m) =>
|
|
197
198
|
// Includes the opt-in add-ons (cloud) a Set caller passes.
|
|
198
|
-
["core", "claude", "cursor", "opencode", "codex", "cloud"].includes(m))
|
|
199
|
+
["core", "claude", "cursor", "opencode", "codex", "antigravity", "cloud"].includes(m))
|
|
199
200
|
: modules;
|
|
200
201
|
const entries = [
|
|
201
202
|
...getInstallManifest(moduleList),
|
|
@@ -383,13 +384,14 @@ export async function runUninstall(modules, ctx) {
|
|
|
383
384
|
deleted: [],
|
|
384
385
|
stripped: [],
|
|
385
386
|
preserved: [],
|
|
387
|
+
absent: [],
|
|
386
388
|
decisions: [],
|
|
387
389
|
dryRun: ctx.dryRun,
|
|
388
390
|
};
|
|
389
391
|
const moduleList = modules instanceof Set
|
|
390
392
|
? [...modules].filter((m) =>
|
|
391
393
|
// Includes the opt-in add-ons (cloud) a Set caller passes.
|
|
392
|
-
["core", "claude", "cursor", "opencode", "codex", "cloud"].includes(m))
|
|
394
|
+
["core", "claude", "cursor", "opencode", "codex", "antigravity", "cloud"].includes(m))
|
|
393
395
|
: modules;
|
|
394
396
|
// Nuke confirmation
|
|
395
397
|
if (ctx.nuke && !ctx.yes && !ctx.dryRun) {
|
|
@@ -412,7 +414,13 @@ export async function runUninstall(modules, ctx) {
|
|
|
412
414
|
seen.add(summary.file);
|
|
413
415
|
const absPath = path.join(ctx.cwd, summary.file);
|
|
414
416
|
switch (summary.decision) {
|
|
415
|
-
case "skip-absent":
|
|
417
|
+
case "skip-absent": {
|
|
418
|
+
result.absent.push(summary.file);
|
|
419
|
+
if (!ctx.dryRun) {
|
|
420
|
+
console.log(`${ctx.logPrefix} absent: ${summary.file} (${summary.reason})`);
|
|
421
|
+
}
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
416
424
|
case "skip-modified":
|
|
417
425
|
case "skip-unknown":
|
|
418
426
|
case "preserve": {
|
|
@@ -569,7 +577,8 @@ export async function runUninstall(modules, ctx) {
|
|
|
569
577
|
}
|
|
570
578
|
// Clean up .agents/ bkit-prefix mirror files
|
|
571
579
|
// (.claude/commands/bkit-*.md, .claude/agents/bkit-*.md, .opencode/agents/bkit-*.md, etc.)
|
|
572
|
-
|
|
580
|
+
// A dry run lists the same paths in result.deleted and removes nothing.
|
|
581
|
+
{
|
|
573
582
|
const mirrorDirs = [
|
|
574
583
|
// Each host's mirror dirs are gated on its own module so a targeted
|
|
575
584
|
// uninstall (e.g. --claude / --auto) leaves other hosts
|
|
@@ -583,6 +592,9 @@ export async function runUninstall(modules, ctx) {
|
|
|
583
592
|
// separately below: `.agents/skills/` is SHARED with third-party skills installed via
|
|
584
593
|
// skills.sh, so the directory itself must never be removed wholesale.
|
|
585
594
|
...(moduleList.includes("codex") ? [".codex/agents"] : []),
|
|
595
|
+
// antigravity plugin subagent mirrors (`.agents/plugins/bkit/agents/bkit-*.md`). The
|
|
596
|
+
// plugin's workflow skills (`.agents/plugins/bkit/skills/bkit-*`) are swept below.
|
|
597
|
+
...(moduleList.includes("antigravity") ? [".agents/plugins/bkit/agents"] : []),
|
|
586
598
|
];
|
|
587
599
|
for (const dir of mirrorDirs) {
|
|
588
600
|
const absDir = path.join(ctx.cwd, dir);
|
|
@@ -594,36 +606,49 @@ export async function runUninstall(modules, ctx) {
|
|
|
594
606
|
if (!f.startsWith("bkit-") || !(f.endsWith(".md") || f.endsWith(".toml")))
|
|
595
607
|
continue;
|
|
596
608
|
const absFile = path.join(absDir, f);
|
|
597
|
-
|
|
609
|
+
if (!ctx.dryRun)
|
|
610
|
+
fs.rmSync(absFile, { force: true });
|
|
598
611
|
result.deleted.push(path.join(dir, f));
|
|
599
|
-
|
|
612
|
+
if (!ctx.dryRun)
|
|
613
|
+
console.log(`${ctx.logPrefix} delete mirror: ${path.join(dir, f)}`);
|
|
600
614
|
}
|
|
601
615
|
}
|
|
602
616
|
catch (err) {
|
|
603
617
|
console.error(`${ctx.logPrefix} error cleaning up ${dir}: ${err.message}`);
|
|
604
618
|
}
|
|
605
619
|
}
|
|
606
|
-
// Workflow skills
|
|
607
|
-
// skills.sh, so only the bkit-prefixed DIRECTORIES are removed — never the
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
620
|
+
// Workflow skills. Codex's live at `.agents/skills/` (SHARED with third-party skills
|
|
621
|
+
// installed via skills.sh, so only the bkit-prefixed DIRECTORIES are removed — never the
|
|
622
|
+
// parent); Antigravity's live in its plugin at `.agents/plugins/bkit/skills/`. Sweep each
|
|
623
|
+
// host's set independently.
|
|
624
|
+
const skillDirs = [
|
|
625
|
+
...(moduleList.includes("codex") ? [path.join(".agents", "skills")] : []),
|
|
626
|
+
...(moduleList.includes("antigravity")
|
|
627
|
+
? [path.join(".agents", "plugins", "bkit", "skills")]
|
|
628
|
+
: []),
|
|
629
|
+
];
|
|
630
|
+
for (const skillsDir of skillDirs) {
|
|
631
|
+
const absDir = path.join(ctx.cwd, skillsDir);
|
|
632
|
+
if (!fs.existsSync(absDir))
|
|
633
|
+
continue;
|
|
634
|
+
try {
|
|
635
|
+
for (const d of fs.readdirSync(absDir)) {
|
|
636
|
+
if (!d.startsWith("bkit-"))
|
|
637
|
+
continue;
|
|
638
|
+
const abs = path.join(absDir, d);
|
|
639
|
+
if (!fs.statSync(abs).isDirectory())
|
|
640
|
+
continue;
|
|
641
|
+
if (!ctx.dryRun)
|
|
618
642
|
fs.rmSync(abs, { recursive: true, force: true });
|
|
619
|
-
|
|
620
|
-
|
|
643
|
+
result.deleted.push(path.join(skillsDir, d));
|
|
644
|
+
if (!ctx.dryRun) {
|
|
645
|
+
console.log(`${ctx.logPrefix} delete mirror: ${path.join(skillsDir, d)}`);
|
|
621
646
|
}
|
|
622
647
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
}
|
|
648
|
+
}
|
|
649
|
+
catch (err) {
|
|
650
|
+
const msg = err.message;
|
|
651
|
+
console.error(`${ctx.logPrefix} error cleaning up ${skillsDir}: ${msg}`);
|
|
627
652
|
}
|
|
628
653
|
}
|
|
629
654
|
}
|
|
@@ -728,7 +753,7 @@ export async function runUninstall(modules, ctx) {
|
|
|
728
753
|
const versionFile = path.join(ctx.cwd, ".bkit", "version");
|
|
729
754
|
const existing = readBkitVersion(versionFile);
|
|
730
755
|
if (existing) {
|
|
731
|
-
const { canonicalHashes, pruned } = mergeCanonicalHashes(ctx.cwd, existing.canonicalHashes, {});
|
|
756
|
+
const { canonicalHashes, pruned } = mergeCanonicalHashes(ctx.cwd, existing.canonicalHashes, {}, result.deleted);
|
|
732
757
|
if (pruned > 0) {
|
|
733
758
|
console.log(`${ctx.logPrefix}${ctx.dryRun ? " [dry-run]" : ""} update version pin: .bkit/version (pruned ${pruned})`);
|
|
734
759
|
if (!ctx.dryRun) {
|
|
@@ -847,13 +872,15 @@ export async function runUninstallCommand(modules, opencodeProvider, uninstallFl
|
|
|
847
872
|
const moduleList = [...modules];
|
|
848
873
|
console.log(`${LOG_PREFIX} Running uninstall${uninstallCtx.dryRun ? " (dry-run)" : ""}...`);
|
|
849
874
|
const result = await runUninstall(moduleList, uninstallCtx);
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
875
|
+
console.log(uninstallSummaryLine(result, LOG_PREFIX));
|
|
876
|
+
}
|
|
877
|
+
/** The closing totals line of an uninstall run (dry-run wording when `result.dryRun`). */
|
|
878
|
+
export function uninstallSummaryLine(result, logPrefix) {
|
|
879
|
+
const deleted = result.deleted.length;
|
|
880
|
+
const stripped = result.stripped.length;
|
|
881
|
+
const preserved = result.preserved.length;
|
|
882
|
+
const absent = result.absent.length;
|
|
883
|
+
return result.dryRun
|
|
884
|
+
? `${logPrefix} [dry-run] Would delete: ${deleted}, strip: ${stripped}, preserve: ${preserved}, already absent: ${absent}`
|
|
885
|
+
: `${logPrefix} Done. Deleted: ${deleted}, stripped: ${stripped}, preserved: ${preserved}, already absent: ${absent}`;
|
|
859
886
|
}
|
|
@@ -30,6 +30,7 @@ import { getInstallingVersion, requireOpencodeProvider, detectOpencodeProviders,
|
|
|
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";
|
|
33
|
+
import { detectInstalledHostModules } from "../../install/hosts.js";
|
|
33
34
|
import { detectInstalledModules } from "./check.js";
|
|
34
35
|
import { remapTemplateDest } from "../../install/template-copies.js";
|
|
35
36
|
import { CLAUDE_CLOUD_RELPATH, CURSOR_CLOUD_RELPATH, writeClaudeCloudDoc, writeCursorCloudDoc, writeNetworkAllowlistArtifact, writeCursorCliPermissionsArtifact, } from "../../install/cloud-env.js";
|
|
@@ -38,7 +39,7 @@ import { formatPayloadLinkChanges, syncPayloadLinks } from "../../install/payloa
|
|
|
38
39
|
import { renderOpencodeJson, reconcileOpencodeJson } from "../../install/modules/opencode.js";
|
|
39
40
|
import { renderManagedOutputs } from "../../install/modules/index.js";
|
|
40
41
|
import { reconcileMcpJson, enrichClaudeSettingsAllows } from "../../install/modules/claude.js";
|
|
41
|
-
import { parseModelLookup, applyModelOverrides, buildOpencodeModelLookup, parseEffortMap, } from "../../render/models.js";
|
|
42
|
+
import { parseModelLookup, applyModelOverrides, buildOpencodeModelLookup, buildAntigravityModelLookup, parseEffortMap, } from "../../render/models.js";
|
|
42
43
|
/** Zero-value token map — markered-text templates managed on upgrade are token-free. */
|
|
43
44
|
const EMPTY_TOKENS = {
|
|
44
45
|
DEFAULT_BRANCH: "",
|
|
@@ -293,8 +294,8 @@ export function updateCanonicalHashesAfterUpgrade(result, options) {
|
|
|
293
294
|
const seedablePaths = new Set([...result.updated, ...result.skippedSeedable]);
|
|
294
295
|
const fresh = {};
|
|
295
296
|
for (const relPath of seedablePaths) {
|
|
296
|
-
// Exclude .agents/ internal files (docs.md, friction.md, rules.md,
|
|
297
|
-
// .env.example etc.) from canonicalHashes — they are not consumer-facing files
|
|
297
|
+
// Exclude .agents/ internal files (docs.md, friction.md, rules.md, shortcuts.md,
|
|
298
|
+
// skills.md, .env.example etc.) from canonicalHashes — they are not consumer-facing files
|
|
298
299
|
// whose hashes bkit uses for drift detection. Mirrors the same filter applied
|
|
299
300
|
// in the install path (install/modules/index.ts postDispatch). Template copies carry no
|
|
300
301
|
// hash there either.
|
|
@@ -332,23 +333,6 @@ export function updateCanonicalHashesAfterUpgrade(result, options) {
|
|
|
332
333
|
};
|
|
333
334
|
writeBkitVersion(versionFile, updated);
|
|
334
335
|
}
|
|
335
|
-
/**
|
|
336
|
-
* Detect which host modules a consumer has installed, by the presence of each host's
|
|
337
|
-
* source-rendered agents directory. Used by `bkit upgrade` to re-render only the hosts
|
|
338
|
-
* the consumer installed — never force-creating an opencode/cursor tree.
|
|
339
|
-
*/
|
|
340
|
-
export function detectInstalledHostModules(cwd) {
|
|
341
|
-
const mods = new Set();
|
|
342
|
-
if (fs.existsSync(path.join(cwd, ".claude", "agents")))
|
|
343
|
-
mods.add("claude");
|
|
344
|
-
if (fs.existsSync(path.join(cwd, ".cursor", "agents")))
|
|
345
|
-
mods.add("cursor");
|
|
346
|
-
if (fs.existsSync(path.join(cwd, ".opencode", "agents")))
|
|
347
|
-
mods.add("opencode");
|
|
348
|
-
if (fs.existsSync(path.join(cwd, ".codex", "agents")))
|
|
349
|
-
mods.add("codex");
|
|
350
|
-
return mods;
|
|
351
|
-
}
|
|
352
336
|
/**
|
|
353
337
|
* Resolve the newest published @cbartens/bkit version from the registry for
|
|
354
338
|
* `bkit upgrade --latest`. Shells out to `pnpm view` (honours the consumer's
|
|
@@ -515,9 +499,6 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
515
499
|
collectPayload(entAbs, entRel, skipTopDirs);
|
|
516
500
|
}
|
|
517
501
|
else if (ent.isFile()) {
|
|
518
|
-
// Each payload root's LICENSE.md is package metadata, never an install source.
|
|
519
|
-
if (ent.name === "LICENSE.md")
|
|
520
|
-
continue;
|
|
521
502
|
// Single shared dotfile remap (gitignore → .gitignore, npmignore → .npmignore).
|
|
522
503
|
const relPath = remapTemplateDest(entRel);
|
|
523
504
|
// `.claude/bkit-cloud.md` + `.cursor/bkit-cloud.md` are GENERATED output files
|
|
@@ -530,15 +511,22 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
530
511
|
continue;
|
|
531
512
|
if (relPath === MCP_ROOT_RELPATH || relPath === CURSOR_MCP_RELPATH)
|
|
532
513
|
continue;
|
|
533
|
-
|
|
514
|
+
const entry = entryByPath.get(relPath);
|
|
515
|
+
const ownerModule = entry?.module;
|
|
516
|
+
// Skip opt-in-module files the consumer hasn't opted into: dest absent and the owning
|
|
517
|
+
// module not detected as installed. A detected opt-in host (opencode / codex /
|
|
518
|
+
// antigravity) gets the files a newer release adds; `cloud` has no install sentinel,
|
|
519
|
+
// so its files upgrade only when present. opencode.json is created only when its
|
|
520
|
+
// provider resolves — never written with raw `@@OPENCODE_*@@` sentinels.
|
|
534
521
|
if (optInPaths.has(relPath) && !fs.existsSync(path.join(process.cwd(), relPath))) {
|
|
535
|
-
|
|
522
|
+
const hostInstalled = ownerModule !== undefined && installedModules.has(ownerModule);
|
|
523
|
+
if (!hostInstalled || (relPath === OPENCODE_JSON_RELPATH && !upgradeOpencodeProvider)) {
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
536
526
|
}
|
|
537
|
-
const entry = entryByPath.get(relPath);
|
|
538
527
|
// Skip host-module files when that module is not installed — upgrade updates
|
|
539
528
|
// only what the consumer opted into, never force-creating a new module. opt-ins are
|
|
540
|
-
// handled by the
|
|
541
|
-
const ownerModule = entry?.module;
|
|
529
|
+
// handled by the check above; core + entry-less files always pass.
|
|
542
530
|
if (ownerModule &&
|
|
543
531
|
ownerModule !== "core" &&
|
|
544
532
|
!optInPaths.has(relPath) &&
|
|
@@ -583,11 +571,8 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
583
571
|
console.log(`${LOG_PREFIX} ${templateReport}`);
|
|
584
572
|
// Payload view links — the same sync install runs (`.bkit/core` + `.bkit/shared`
|
|
585
573
|
// point into the installed package). Never clobbers a real directory; a platform
|
|
586
|
-
// refusal is reported, never fatal.
|
|
587
|
-
const linkChanges = syncPayloadLinks(process.cwd(), {
|
|
588
|
-
dryRun: upgradeFlags.dryRun,
|
|
589
|
-
ws: { writes: [] },
|
|
590
|
-
});
|
|
574
|
+
// refusal is reported, never fatal. Links carry no hash.
|
|
575
|
+
const linkChanges = syncPayloadLinks(process.cwd(), { dryRun: upgradeFlags.dryRun });
|
|
591
576
|
const linkReport = formatPayloadLinkChanges(linkChanges);
|
|
592
577
|
if (linkReport)
|
|
593
578
|
console.log(`${LOG_PREFIX} ${linkReport}`);
|
|
@@ -633,6 +618,7 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
633
618
|
let renderModelLookup = new Map();
|
|
634
619
|
let renderOpencodeModelLookup = new Map();
|
|
635
620
|
let renderCodexModelLookup = new Map();
|
|
621
|
+
let renderAntigravityModelLookup = new Map();
|
|
636
622
|
let renderEffortMap = new Map();
|
|
637
623
|
const pkgPromptsMd = path.join(getBkitDocsRoot(), "prompts.md");
|
|
638
624
|
const consumerPromptsMd = path.join(process.cwd(), ".bkit", "prompts.md");
|
|
@@ -663,6 +649,15 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
663
649
|
}
|
|
664
650
|
applyModelOverrides(renderCodexModelLookup, "openai", consumerPromptsMd);
|
|
665
651
|
}
|
|
652
|
+
if (renderModules.has("antigravity")) {
|
|
653
|
+
try {
|
|
654
|
+
renderAntigravityModelLookup = buildAntigravityModelLookup(pkgPromptsMd);
|
|
655
|
+
}
|
|
656
|
+
catch {
|
|
657
|
+
// Not fatal — the antigravity module fails per-file if a model is missing
|
|
658
|
+
}
|
|
659
|
+
applyModelOverrides(renderAntigravityModelLookup, "google", consumerPromptsMd);
|
|
660
|
+
}
|
|
666
661
|
renderEffortMap = parseEffortMap(pkgPromptsMd);
|
|
667
662
|
}
|
|
668
663
|
const renderWs = { writes: [] };
|
|
@@ -672,6 +667,7 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
672
667
|
modelLookup: renderModelLookup,
|
|
673
668
|
opencodeModelLookup: renderOpencodeModelLookup,
|
|
674
669
|
codexModelLookup: renderCodexModelLookup,
|
|
670
|
+
antigravityModelLookup: renderAntigravityModelLookup,
|
|
675
671
|
effortMap: renderEffortMap,
|
|
676
672
|
opencodeProvider: renderProvider,
|
|
677
673
|
advisories: [],
|
|
@@ -683,6 +679,8 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
683
679
|
// Re-stamp every rendered agent + command at the version we are upgrading TO,
|
|
684
680
|
// so a clean upgrade refreshes the managed-version marker and `bkit check` stays green.
|
|
685
681
|
version: getInstallingVersion(),
|
|
682
|
+
// The detected host set — read by the Antigravity module for the Codex-overlap advisory.
|
|
683
|
+
installedModules: renderModules,
|
|
686
684
|
};
|
|
687
685
|
const rendered = renderManagedOutputs(renderModules, renderCtx);
|
|
688
686
|
// MCP config: bkit's tracker entry only (reconcileMcpJson), for the hosts the consumer
|
package/dist/commands/launch.js
CHANGED
|
@@ -72,11 +72,28 @@ export function isAlreadyRunning(binaryPath) {
|
|
|
72
72
|
});
|
|
73
73
|
return !result.error && result.status === 0 && result.stdout.trim().length > 0;
|
|
74
74
|
}
|
|
75
|
+
/** `pgrep -f` pattern for OpenCode 2.0's shared background server (`<dir>/opencode serve --service`). */
|
|
76
|
+
const OPENCODE_SERVER_PATTERN = "(^|/)opencode serve( |$)";
|
|
77
|
+
/**
|
|
78
|
+
* Return true if OpenCode 2.0's shared background server (`opencode serve`) is running.
|
|
79
|
+
* It outlives the desktop app and every client attaches to it, so it holds the stale env.
|
|
80
|
+
*/
|
|
81
|
+
export function isOpencodeServerRunning() {
|
|
82
|
+
return isAlreadyRunning(OPENCODE_SERVER_PATTERN);
|
|
83
|
+
}
|
|
84
|
+
const OPENCODE_SERVER_ADVICE = ` OpenCode 2.0 runs one shared background server for every client (TUI, web,\n` +
|
|
85
|
+
` desktop) and captures its environment once, at first start. A newly opened\n` +
|
|
86
|
+
` window talks to that server and still sees the OLD env, so the per-repo tokens\n` +
|
|
87
|
+
` in .bkit/.env are not picked up. Stop the shared server, then re-launch:\n` +
|
|
88
|
+
` opencode service stop && pnpm bkit opencode\n` +
|
|
89
|
+
` (that stops every opencode window, not just this one; quitting the app fully\n` +
|
|
90
|
+
` and re-running works too)`;
|
|
75
91
|
/**
|
|
76
92
|
* Launch `app` with .bkit/.env merged into its environment.
|
|
77
93
|
*
|
|
78
94
|
* - Loads `.bkit/.env` from `cwd` and merges into process.env (process.env wins).
|
|
79
|
-
* - Detects an already-running instance via pgrep
|
|
95
|
+
* - Detects an already-running instance via pgrep (for opencode also the 2.0 shared
|
|
96
|
+
* background server `opencode serve`); warns if found
|
|
80
97
|
* (the running process will not inherit the new env even if the binary hands off).
|
|
81
98
|
* - For Cursor: passes `cwd` as a positional arg so it opens the repo folder.
|
|
82
99
|
* - Spawns detached so the terminal is not blocked by the GUI app.
|
|
@@ -89,20 +106,19 @@ export async function launchApp(app, cwd) {
|
|
|
89
106
|
process.exit(1);
|
|
90
107
|
}
|
|
91
108
|
const { binPath } = resolved;
|
|
92
|
-
|
|
109
|
+
const appRunning = isAlreadyRunning(binPath);
|
|
110
|
+
const serverRunning = app === "opencode" && isOpencodeServerRunning();
|
|
111
|
+
if (appRunning) {
|
|
93
112
|
console.warn(`[bkit] ${app} is already running — opening folder in a new window, but the\n` +
|
|
94
113
|
`environment from .bkit/.env will NOT take effect (the running process keeps\n` +
|
|
95
114
|
`its original env). If you need per-repo tokens, quit ${app} fully (Cmd+Q)\n` +
|
|
96
115
|
`and re-run: pnpm bkit ${app}` +
|
|
97
|
-
(app === "opencode"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
` (that stops every opencode window, not just this one; quitting the app fully\n` +
|
|
104
|
-
` and re-running works too)`
|
|
105
|
-
: ""));
|
|
116
|
+
(app === "opencode" ? `\n\n${OPENCODE_SERVER_ADVICE}` : ""));
|
|
117
|
+
}
|
|
118
|
+
else if (serverRunning) {
|
|
119
|
+
console.warn(`[bkit] the opencode background server (opencode serve) is already running — the\n` +
|
|
120
|
+
`environment from .bkit/.env will NOT take effect (the server keeps the env it\n` +
|
|
121
|
+
`started with, even though the desktop app itself is not open).\n\n${OPENCODE_SERVER_ADVICE}`);
|
|
106
122
|
}
|
|
107
123
|
// Cursor: pass repo dir so it opens the folder. opencode: no positional needed
|
|
108
124
|
// (it reads opencode.json from cwd, and cwd is inherited via { cwd } spawn option).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// commands/tips.ts — `bkit tips [--workflow=<name>] [--all]`: print the setup tips that
|
|
2
|
+
// apply to this repo. Each workflow passes its name at its close and gets the one tip that
|
|
3
|
+
// matters most there; bare `bkit tips` prints the top three. Local checks only, no
|
|
4
|
+
// network; prints nothing when no tip fires; exits 0.
|
|
5
|
+
import { collectTips, formatTips } from "../checks/tips/index.js";
|
|
6
|
+
export function runTipsCommand(all, workflow, cwd = process.cwd()) {
|
|
7
|
+
const output = formatTips(collectTips(cwd).tips, { all, workflow });
|
|
8
|
+
if (output)
|
|
9
|
+
console.log(output);
|
|
10
|
+
}
|
|
@@ -17,6 +17,13 @@ import { EXIT_NO_STATUS, FILE_FLAG, readStatusRows, statusFile, str } from "./st
|
|
|
17
17
|
// gh
|
|
18
18
|
// ---------------------------------------------------------------------------
|
|
19
19
|
const PR_FIELDS = "number,url,state,baseRefName,headRefName,headRefOid,title,mergeCommit";
|
|
20
|
+
/**
|
|
21
|
+
* The `owner/repo` a PR URL points at, or undefined when it is not a recognizable
|
|
22
|
+
* GitHub PR URL. Lets a caller compare the repo a PR resolved in against `--repo`.
|
|
23
|
+
*/
|
|
24
|
+
export function prRepoSlug(url) {
|
|
25
|
+
return /^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/pull\//.exec(url ?? "")?.[1];
|
|
26
|
+
}
|
|
20
27
|
function ghFailure(res, what) {
|
|
21
28
|
const detail = res.stderr.split("\n").at(-1) || `exit ${String(res.status)}`;
|
|
22
29
|
return ghUnavailable(res)
|
|
@@ -30,7 +37,10 @@ function ghFailure(res, what) {
|
|
|
30
37
|
*/
|
|
31
38
|
export function probePr(cwd, opts) {
|
|
32
39
|
if (opts.number !== undefined) {
|
|
33
|
-
const
|
|
40
|
+
const args = ["pr", "view", opts.number, "--json", `${PR_FIELDS},mergeable`];
|
|
41
|
+
if (opts.repo !== undefined)
|
|
42
|
+
args.push("--repo", opts.repo);
|
|
43
|
+
const res = runGh(cwd, args);
|
|
34
44
|
if (!res.ok)
|
|
35
45
|
return ghFailure(res, `gh pr view ${opts.number}`);
|
|
36
46
|
const parsed = parseJson(res.stdout);
|
|
@@ -41,6 +51,8 @@ export function probePr(cwd, opts) {
|
|
|
41
51
|
const args = ["pr", "list", "--head", opts.head, "--state", opts.state, "--json", PR_FIELDS];
|
|
42
52
|
if (opts.base !== undefined)
|
|
43
53
|
args.push("--base", opts.base);
|
|
54
|
+
if (opts.repo !== undefined)
|
|
55
|
+
args.push("--repo", opts.repo);
|
|
44
56
|
const res = runGh(cwd, args);
|
|
45
57
|
if (!res.ok)
|
|
46
58
|
return ghFailure(res, `gh pr list --head ${opts.head}`);
|
|
@@ -28,7 +28,7 @@ import { TIMEOUTS } from "../../shared/timeouts.js";
|
|
|
28
28
|
import { FID_PATTERNS, fromBranch, fromMarker, issueIdOf, readIssueTracker } from "./fids.js";
|
|
29
29
|
import { AUTO_LABEL, AUTO_ROUTE_SUFFIX } from "./issues.js";
|
|
30
30
|
import { checkOnlyBookkeeping } from "./ledgers.js";
|
|
31
|
-
import { closeTransportRow, crossCheckFile, probePr } from "./prs.js";
|
|
31
|
+
import { closeTransportRow, crossCheckFile, prRepoSlug, probePr } from "./prs.js";
|
|
32
32
|
import { resolveOwnerRepo, splitSlug } from "./repo.js";
|
|
33
33
|
import { extraField, str } from "./status.js";
|
|
34
34
|
import { writeStepRow } from "./steps.js";
|
|
@@ -746,8 +746,21 @@ const INTERVAL_FLAG = {
|
|
|
746
746
|
type: "string",
|
|
747
747
|
help: "seconds between polls (>= 1)",
|
|
748
748
|
};
|
|
749
|
-
|
|
750
|
-
|
|
749
|
+
/**
|
|
750
|
+
* `gh` pinned to `repo`: `--repo` is appended to every subcommand that takes it.
|
|
751
|
+
* `gh api` is left alone because its path already names the repo. No `repo` = `gh` unchanged.
|
|
752
|
+
*/
|
|
753
|
+
export function repoScopedGh(gh, repo) {
|
|
754
|
+
if (repo === undefined)
|
|
755
|
+
return gh;
|
|
756
|
+
return (args) => (args[0] === "api" ? gh(args) : gh([...args, "--repo", repo]));
|
|
757
|
+
}
|
|
758
|
+
/** Whether `--repo` names a repo other than the checkout's own (local git then describes the wrong repo). */
|
|
759
|
+
function isForeignRepo(cwd, repo) {
|
|
760
|
+
return (repo !== undefined && resolveOwnerRepo(cwd)?.ownerRepo.toLowerCase() !== repo.toLowerCase());
|
|
761
|
+
}
|
|
762
|
+
const deps = (ctx, repo) => ({
|
|
763
|
+
gh: repoScopedGh((args) => runGh(ctx.cwd, args), repo),
|
|
751
764
|
sleep: realSleep,
|
|
752
765
|
log: ctx.log,
|
|
753
766
|
});
|
|
@@ -977,6 +990,24 @@ function auditRow(file, type, fields) {
|
|
|
977
990
|
throw new CommandError(EXIT.USAGE, `${file} does not exist`);
|
|
978
991
|
fs.appendFileSync(file, `${JSON.stringify({ type, workflow: "ship", at: statusTimestamp(), ...fields })}\n`);
|
|
979
992
|
}
|
|
993
|
+
/**
|
|
994
|
+
* Log where a `--pr` resolved so a `--repo` naming a repo other than the checkout
|
|
995
|
+
* is visible; the PR URL names the repo `gh` actually read from.
|
|
996
|
+
*/
|
|
997
|
+
function logResolvedPrRepo(repoFlag, prNumber, pr, log) {
|
|
998
|
+
if (repoFlag === undefined)
|
|
999
|
+
return;
|
|
1000
|
+
const resolved = prRepoSlug(pr?.url);
|
|
1001
|
+
if (resolved === undefined) {
|
|
1002
|
+
log(`PR ${prNumber}: could not read the resolved repo from its URL (--repo ${repoFlag})`);
|
|
1003
|
+
}
|
|
1004
|
+
else if (resolved !== repoFlag) {
|
|
1005
|
+
log(`PR ${prNumber} resolved in ${resolved} — --repo names ${repoFlag}`);
|
|
1006
|
+
}
|
|
1007
|
+
else {
|
|
1008
|
+
log(`PR ${prNumber} resolved in ${repoFlag}`);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
980
1011
|
function runGate(ctx) {
|
|
981
1012
|
const f = ctx.flags;
|
|
982
1013
|
const given = [f.head, f.pr, f.squashOf].filter((v) => v !== undefined).length;
|
|
@@ -993,12 +1024,13 @@ function runGate(ctx) {
|
|
|
993
1024
|
if (prNumber !== undefined) {
|
|
994
1025
|
if (!/^[1-9][0-9]*$/.test(prNumber))
|
|
995
1026
|
throw new CommandError(EXIT.USAGE, "--pr / --squash-of take a PR number");
|
|
996
|
-
pr = probePr(ctx.cwd, { number: prNumber, state: "open" });
|
|
1027
|
+
pr = probePr(ctx.cwd, { number: prNumber, state: "open", repo: str(f.repo) });
|
|
997
1028
|
if (pr.kind === "unavailable") {
|
|
998
1029
|
ctx.log(pr.message);
|
|
999
1030
|
return EXIT.USE_MCP;
|
|
1000
1031
|
}
|
|
1001
1032
|
const info = pr.kind === "ok" ? pr.pr : undefined;
|
|
1033
|
+
logResolvedPrRepo(str(f.repo), prNumber, info, ctx.log);
|
|
1002
1034
|
head = (f.squashOf !== undefined ? info?.mergeCommit?.oid : info?.headRefOid) ?? "";
|
|
1003
1035
|
if (head === "") {
|
|
1004
1036
|
ctx.log(`cannot read the ${f.squashOf !== undefined ? "squash commit" : "head"} of PR ${prNumber}`);
|
|
@@ -1018,10 +1050,23 @@ function runGate(ctx) {
|
|
|
1018
1050
|
const snapshot = str(f.snapshot);
|
|
1019
1051
|
if (snapshot !== undefined) {
|
|
1020
1052
|
const info = pr?.kind === "ok" ? pr.pr : undefined;
|
|
1021
|
-
const
|
|
1022
|
-
const
|
|
1053
|
+
const repoFlag = str(f.repo);
|
|
1054
|
+
const foreign = isForeignRepo(ctx.cwd, repoFlag);
|
|
1055
|
+
// A foreign repo's dev and ancestry come from the API: the checkout's origin/dev is another repo's.
|
|
1056
|
+
let dev;
|
|
1057
|
+
let ancestor;
|
|
1058
|
+
if (foreign && repoFlag !== undefined) {
|
|
1059
|
+
const devRes = gh(["api", `repos/${repoFlag}/commits/dev`, "--jq", ".sha"]);
|
|
1060
|
+
dev = devRes.ok ? devRes.stdout.trim() : "";
|
|
1061
|
+
const cmp = gh(["api", `repos/${repoFlag}/compare/dev...${head}`, "--jq", ".status"]);
|
|
1062
|
+
ancestor = cmp.ok && ["ahead", "identical"].includes(cmp.stdout.trim());
|
|
1063
|
+
}
|
|
1064
|
+
else {
|
|
1065
|
+
dev = git(ctx.cwd, ["rev-parse", "origin/dev"]) ?? "";
|
|
1066
|
+
ancestor = runGit(ctx.cwd, ["merge-base", "--is-ancestor", "origin/dev", head]).ok;
|
|
1067
|
+
}
|
|
1023
1068
|
const ciWorkflow = readBkitConfig(root).ciWorkflow;
|
|
1024
|
-
const runs = gh([
|
|
1069
|
+
const runs = repoScopedGh(gh, repoFlag)([
|
|
1025
1070
|
"run",
|
|
1026
1071
|
"list",
|
|
1027
1072
|
"--branch",
|
|
@@ -1113,7 +1158,9 @@ function devRequiresChecks(gh, repo) {
|
|
|
1113
1158
|
}
|
|
1114
1159
|
async function runRevalidate(ctx) {
|
|
1115
1160
|
const f = ctx.flags;
|
|
1116
|
-
const
|
|
1161
|
+
const repoFlag = str(f.repo);
|
|
1162
|
+
const d = deps(ctx, repoFlag);
|
|
1163
|
+
const foreign = isForeignRepo(ctx.cwd, repoFlag);
|
|
1117
1164
|
const branch = String(f.branch);
|
|
1118
1165
|
const entry = String(f.entryHead);
|
|
1119
1166
|
const codeHead = String(f.codeHead);
|
|
@@ -1121,12 +1168,14 @@ async function runRevalidate(ctx) {
|
|
|
1121
1168
|
if (!["head-move", "gate-refusal"].includes(reason))
|
|
1122
1169
|
throw new CommandError(EXIT.USAGE, "--reason must be head-move or gate-refusal");
|
|
1123
1170
|
const status = path.resolve(ctx.cwd, String(f.file));
|
|
1124
|
-
|
|
1125
|
-
|
|
1171
|
+
if (!foreign)
|
|
1172
|
+
runGit(ctx.cwd, ["fetch", "origin", branch]);
|
|
1173
|
+
const pr = probePr(ctx.cwd, { number: String(f.pr), state: "open", repo: repoFlag });
|
|
1126
1174
|
if (pr.kind === "unavailable") {
|
|
1127
1175
|
ctx.log(pr.message);
|
|
1128
1176
|
return EXIT.USE_MCP;
|
|
1129
1177
|
}
|
|
1178
|
+
logResolvedPrRepo(str(f.repo), String(f.pr), pr.kind === "ok" ? pr.pr : undefined, ctx.log);
|
|
1130
1179
|
const current = pr.kind === "ok" ? (pr.pr?.headRefOid ?? "") : "";
|
|
1131
1180
|
if (current === "") {
|
|
1132
1181
|
ctx.log("cannot read the PR head — query failed (403 = PAT scope)");
|
|
@@ -1135,15 +1184,22 @@ async function runRevalidate(ctx) {
|
|
|
1135
1184
|
// CI must pass at the code head while the PR head adds bookkeeping only and dev
|
|
1136
1185
|
// demands no status checks; otherwise at the PR head.
|
|
1137
1186
|
let validated = codeHead;
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
from: codeHead,
|
|
1142
|
-
to: current,
|
|
1143
|
-
});
|
|
1144
|
-
if (!book.ok)
|
|
1187
|
+
if (foreign) {
|
|
1188
|
+
// The bookkeeping diff reads the checkout's git, which is not the named repo's history.
|
|
1189
|
+
ctx.log(`--repo ${repoFlag} is not this checkout's repo — bookkeeping diff skipped, validating at the PR head ${current}`);
|
|
1145
1190
|
validated = current;
|
|
1146
|
-
|
|
1191
|
+
}
|
|
1192
|
+
else {
|
|
1193
|
+
const book = onlyBookkeeping(checkoutRoot(ctx.cwd), {
|
|
1194
|
+
month: String(f.month),
|
|
1195
|
+
fid: String(f.fid),
|
|
1196
|
+
from: codeHead,
|
|
1197
|
+
to: current,
|
|
1198
|
+
});
|
|
1199
|
+
if (!book.ok)
|
|
1200
|
+
validated = current;
|
|
1201
|
+
}
|
|
1202
|
+
const repo = repoFlag ?? resolveOwnerRepo(ctx.cwd)?.ownerRepo;
|
|
1147
1203
|
if (repo !== undefined && devRequiresChecks(d.gh, repo)) {
|
|
1148
1204
|
ctx.log(`dev requires status checks — validating at the PR head ${current}`);
|
|
1149
1205
|
validated = current;
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
// CLAUDE_CODE_REMOTE truthy CLOUD_CLAUDE
|
|
18
18
|
// GITHUB_ACTIONS or CI truthy GITHUB_ACTION
|
|
19
19
|
// otherwise LOCAL
|
|
20
|
+
//
|
|
21
|
+
// `runtimeHeadless` (no human attends the session) is derived from `runtime`, never
|
|
22
|
+
// stored on the row.
|
|
20
23
|
import * as fs from "node:fs";
|
|
21
24
|
import * as path from "node:path";
|
|
22
25
|
import { statusTimestamp } from "../../ledgers/status.js";
|
|
@@ -82,6 +85,8 @@ export function classify(env, root, log) {
|
|
|
82
85
|
* session's proxy only lets it push the current branch, so it gets neither.
|
|
83
86
|
*/
|
|
84
87
|
const capable = (runtime) => runtime === "LOCAL" || runtime === "GITHUB_ACTION" || runtime === "CLOUD_CURSOR";
|
|
88
|
+
/** No human attends the session: a runner, a triggered Cursor agent, or a runtime bkit cannot place. */
|
|
89
|
+
const headless = (runtime) => runtime === "GITHUB_ACTION" || runtime === "CLOUD_CURSOR" || runtime === "UNKNOWN";
|
|
85
90
|
/** The full table: classification, default capabilities, and the one live gh probe. */
|
|
86
91
|
export function detect(cwd, root, log) {
|
|
87
92
|
const runtime = classify(process.env, root, log);
|
|
@@ -95,6 +100,7 @@ export function detect(cwd, root, log) {
|
|
|
95
100
|
runtime,
|
|
96
101
|
runtimeWorktrees: capable(runtime),
|
|
97
102
|
runtimeDevPushes: capable(runtime),
|
|
103
|
+
runtimeHeadless: headless(runtime),
|
|
98
104
|
runtimeGithubCli: ok,
|
|
99
105
|
runtimeGithubCliExit: gh.status,
|
|
100
106
|
runtimeGithubCliErr: err,
|
|
@@ -135,6 +141,7 @@ const TABLE_OUTPUT = {
|
|
|
135
141
|
runtime: RUNTIMES.join(" | "),
|
|
136
142
|
runtimeWorktrees: "may mint git worktrees (default per runtime)",
|
|
137
143
|
runtimeDevPushes: "may push dev (a default, never probed)",
|
|
144
|
+
runtimeHeadless: "no human attends the session (GITHUB_ACTION | CLOUD_CURSOR | UNKNOWN); derived from runtime",
|
|
138
145
|
runtimeGithubCli: "gh auth status succeeded",
|
|
139
146
|
runtimeGithubCliExit: "gh auth status exit code (127 when gh is not on PATH)",
|
|
140
147
|
runtimeGithubCliErr: "last non-empty line of gh auth status stderr",
|
|
@@ -243,6 +250,7 @@ export const runtimeCommand = {
|
|
|
243
250
|
runtime: row.runtime,
|
|
244
251
|
runtimeWorktrees: row.runtimeWorktrees,
|
|
245
252
|
runtimeDevPushes: row.runtimeDevPushes,
|
|
253
|
+
runtimeHeadless: headless(row.runtime),
|
|
246
254
|
runtimeGithubCli: row.runtimeGithubCli,
|
|
247
255
|
runtimeGithubCliExit: typeof row.runtimeGithubCliExit === "number" ? row.runtimeGithubCliExit : null,
|
|
248
256
|
runtimeGithubCliErr: typeof row.runtimeGithubCliErr === "string" ? row.runtimeGithubCliErr : "",
|
|
@@ -208,6 +208,7 @@ export function failuresProblem(verdict, failures) {
|
|
|
208
208
|
* calls (a finish call's `--agent` writes `strategy` when its prompt declares one).
|
|
209
209
|
*/
|
|
210
210
|
export const ROW_FIELDS = {
|
|
211
|
+
"design/design-grill": ["attempt"],
|
|
211
212
|
"design/design-brainstorm-ideate": ["attempt"],
|
|
212
213
|
"design/design-generate": ["attempt"],
|
|
213
214
|
"design/design-review": ["attempt"],
|